Error in aurifox plugn, please check Settings > Requirements for details.'; add_action( "admin_notices", array( $this, $message ) ); } } public function aurifox_process_page_request() { if (is_front_page()) { if ($this->aurifox_get_home()) { status_header(200); $this->aurifox_show_post( $this->aurifox_get_home() ); exit(); } else { return; } } $full_request_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $request_url_parts = explode( "?", $full_request_url ); $request_url = $request_url_parts[0]; $base_url = get_home_url()."/"; $slug = str_replace( $base_url, "", $request_url ); $slug = rtrim( $slug, '/' ); if ($slug != '') { $query_args = array( 'meta_key' => 'sd_slug', 'meta_value' => $slug, 'post_type' => 'aurifox', 'compare' => '=' ); $the_posts = get_posts($query_args); $sd_page = current($the_posts); if ($sd_page) { status_header(200); $this->aurifox_show_post( $sd_page->ID ); exit(); } } if (is_404()) { if ($this->aurifox_get_404()) { $this->aurifox_show_post( $this->aurifox_get_404() ); exit(); } else { return; } } return; } public function aurifox_show_post( $post_id ) { $url = get_post_meta( $post_id, "sd_step_url", true ); $method = get_option('aurifox_display_method'); if ($method == 'download') { echo $this->aurifox_get_page_content($url); } else if ($method == 'iframe') { echo $this->aurifox_get_page_iframe($url); } else if ($method == 'redirect') { wp_redirect($url, 301); } exit(); } public function aurifox_get_page_content( $url ) { $response11 = wp_remote_post($url); $body = $response11['body']; return $body; } public function aurifox_get_page_iframe( $sd_step_url ) { if (has_site_icon() && (get_option('aurifox_favicon_method') == 'wordpress')) { $favicon = ''; } else { $url = AURIFOX_API_URL.'getsiteicon'; $args = array( 'step_url' => $sd_step_url, ); $response = wp_remote_post($url, $args); $favicon = ''; } $additional_snippet = html_entity_decode(stripslashes(get_option('aurifox_additional_snippet'))); return ' '.esc_html($favicon).' '.esc_html($additional_snippet).' '; } public function aurifox_updated_message( $messages ) { $post_id = get_the_ID(); if ( get_post_meta( $post_id, "sd_step_id", true ) == "" ) return $messages; $our_message = ' Successfully saved and updated your aurifox page.'; $messages['post'][1] = $our_message; $messages['post'][4] = $our_message; $messages['post'][6] = $our_message; $messages['post'][10] = $our_message; return $messages; } public function aurifox_post_trash( $post_id ) { if ( $this->is_404( $post_id ) ) { $this->aurifox_set_404(NULL); } if ( $this->aurifox_is_home( $post_id ) ) { $this->aurifox_set_home(NULL); } } public function aurifox_save_meta( $post_id ) { global $_POST; if (sanitize_key($_POST['post_type']) != 'aurifox') { return; } $sd_slug = sanitize_key($_POST['sd_slug']); $sd_page_type = sanitize_key($_POST['sd_page_type']); $sd_step_id = sanitize_key($_POST['sd_step_id']); $sd_step_name = sanitize_key($_POST['sd_step_name']); $sd_aurifox_id = sanitize_key($_POST['sd_aurifox_id']); $sd_aurifox_name = sanitize_key($_POST['sd_aurifox_name']); $sd_step_url = sanitize_text_field($_POST['sd_step_url']); if (isset($sd_slug)) { update_post_meta( $post_id, "sd_slug", $sd_slug ); } if (isset($sd_page_type)) { update_post_meta( $post_id, "sd_page_type", $sd_page_type ); } if (isset($sd_step_id)) { update_post_meta( $post_id, "sd_step_id", $sd_step_id ); } if (isset($sd_step_name)) { update_post_meta( $post_id, "sd_step_name", $sd_step_name ); } if (isset($sd_aurifox_id)) { update_post_meta( $post_id, "sd_aurifox_id", $sd_aurifox_id ); } if (isset($sd_aurifox_name)) { update_post_meta( $post_id, "sd_aurifox_name", $sd_aurifox_name ); } if (isset($sd_step_url)) { update_post_meta( $post_id, "sd_step_url", $sd_step_url ); } if ($this->is_404($post_id)) { $this->aurifox_set_404(NULL); } else if ($this->aurifox_is_home($post_id)) { $this->aurifox_set_home(NULL); } if ($sd_page_type == "homepage") { $this->aurifox_set_home( $post_id ); } else if ($sd_page_type == "404") { $this->aurifox_set_404( $post_id ); } } public function aurifox_set_home( $post_id ) { update_option( 'aurifox_homepage_post_id', $post_id); } public function aurifox_get_home() { return get_option( "aurifox_homepage_post_id" ); } public function aurifox_is_home( $post_id ) { return $post_id == get_option( "aurifox_homepage_post_id" ); } public function aurifox_set_404( $post_id ) { update_option( 'aurifox_404_post_id', $post_id); } public function aurifox_get_404() { return get_option( "aurifox_404_post_id" ); } public function is_404( $post_id ) { return $post_id == get_option( "aurifox_404_post_id" ); } public function aurifox_add_columns( $columns ) { $new_columns = array(); $new_columns['cb'] = $columns['cb']; $new_columns['sd_post_name'] = "Page"; $new_columns['sd_post_aurifox'] = "Funnel"; $new_columns['sd_path'] = 'View'; $new_columns['sd_open_in_editor'] = 'Edit Funnel'; $new_columns['sd_page_type'] = 'Type'; return $new_columns; } public function aurifox_fill_columns( $column ) { $id = get_the_ID(); $sd_page_type = get_post_meta( $id, 'sd_page_type', true ); $sd_slug = get_post_meta( $id, 'sd_slug', true ); $sd_step_id = get_post_meta( $id, 'sd_step_id', true ); $sd_step_name = get_post_meta( $id, 'sd_step_name', true ); $sd_aurifox_id = get_post_meta( $id, 'sd_aurifox_id', true ); $sd_aurifox_name = get_post_meta( $id, 'sd_aurifox_name', true ); if ( 'sd_post_name' == $column ) { $url = get_edit_post_link( get_the_ID() ); echo ''. esc_html($sd_step_name) .''; } if ( 'sd_post_aurifox' == $column ) { echo ''.esc_html($sd_aurifox_name).''; } if ( 'sd_open_in_editor' == $column ) { echo "Open in aurifox"; } switch ( $sd_page_type ) { case "page": $post_type = "Page"; $url = get_home_url()."/".$sd_slug; break; case "homepage": $post_type = "Home Page"; $url = get_home_url().'/'; break; case "404": $post_type = "404 Page"; $url = get_home_url().'/test-url-404-page'; break; default: $post_type = $sd_page_type; $url = get_edit_post_link( get_the_ID() ); } if ( 'sd_page_type' == $column ) { echo "$post_type"; } if ( 'sd_path' == $column ) { echo "View Page"; } } public function aurifox_add_meta_box() { add_meta_box( 'aurifox_meta_box', 'Setup Your aurifox Page', array( $this, "aurifox_show_meta_box" ), 'aurifox', 'normal', 'high' ); } public function aurifox_show_meta_box( $post ) { include 'pages/edit.php'; } public function aurifox_remove_save_box() { global $wp_meta_boxes; foreach ( $wp_meta_boxes['aurifox'] as $k=>$v ) foreach ( $v as $l=>$m ) foreach ( $m as $o=>$p ) if ( $o !="aurifox_meta_box" ) unset( $wp_meta_boxes['aurifox'][$k][$l][$o] ); } public function aurifox_create_custom_post_type() { $labels = array( 'name' => _x( 'AuriFox', 'post type general name' ), 'singular_name' => _x( 'Pages', 'post type singular name' ), 'add_new' => _x( 'Add Funnels', 'AuriFox' ), 'add_new_item' => __( 'Add New aurifox Page' ), 'edit_item' => __( 'Edit Funnel' ), 'new_item' => __( 'Add Funnels' ), 'all_items' => __( 'Funnels' ), 'view_item' => __( 'View AuriFox Pages' ), 'search_items' => __( 'Search AuriFox Funnels' ), 'not_found' => __( 'No Funnels Yet
add a new page or finish plugin set-up' ), 'parent_item_colon' => '', 'hide_post_row_actions' => array('trash', 'edit' ,'quick-edit') ); register_post_type( 'aurifox', array( 'labels' => $labels, 'public' => true, 'menu_icon' => plugins_url( 'images/icon.png', __FILE__ ), 'has_archive' => true, 'supports' => array( '' ), 'rewrite' => array( 'slug' => 'aurifox' ), 'register_meta_box_cb' => array( $this, "aurifox_remove_save_box" ), 'hide_post_row_actions' => array( 'trash' ) ) ); } } function aurifox_plugin_activated() { if (!get_option('aurifox_display_method')) { update_option('aurifox_display_method', 'download'); } aurifox_upgrade_existing_posts(); } function aurifox_upgrading_aurifox_posts() { ?>

Your aurifoxs posts have been upgraded to a new version.

In order to confirm to the new format, you may need to recreate your homepage and 404 page manually.

-1, 'post_type' =>'aurifox', 'post_status' => 'any', 'fields' => 'id' ); $the_posts = get_posts( $args ); if (is_array($the_posts)) { foreach ($the_posts as $the_post) { $id = $the_post->ID; $sep = '{#}'; $url = get_post_meta($id, 'sd_iframe_url', true); $aurifox = get_post_meta($id, 'sd_theaurifox', true); $thepage = get_post_meta($id, 'sd_thepage', true); $slug = get_post_meta($id, 'sd_slug', true); if ($url && $aurifox && $thepage && $slug) { $aurifox_parts = explode($sep, $aurifox); $aurifox_id = $aurifox_parts[0]; $aurifox_name = $aurifox_parts[11]; $page_parts = explode($sep, $thepage); $page_name = $page_parts[5]; } else { if (isset($sd_options)) { foreach ($sd_options['pages'] as $key => $value) { $parts = explode($sep, $value); if ($parts[5] == $id) { $url = $parts[7]; $aurifox_id = $parts[0]; $aurifox_name = $parts[11]; $page_name = $parts[6]; $slug = $key; break; } } } } if ($url && $aurifox_id && $slug) { if (!get_post_meta($id, 'sd_slug', true)){ update_post_meta($id, 'sd_slug', $slug); } if (!get_post_meta($id, 'sd_step_url', true)){ update_post_meta($id, 'sd_step_url', $url); } if (!get_post_meta($id, 'sd_aurifox_id', true)){ update_post_meta($id, 'sd_aurifox_id', $aurifox_id); } if (!get_post_meta($id, 'sd_aurifox_name', true)){ update_post_meta($id, 'sd_aurifox_name', $aurifox_name); } if (!get_post_meta($id, 'sd_step_name', true)){ update_post_meta($id, 'sd_step_name', $page_name); } $page_type = get_post_meta($id, 'sd_type', true); if ($page_type == 'hp' || $page_type == 'homepage') { if (!get_option('aurifox_homepage_post_id')) { update_option( 'aurifox_homepage_post_id', $id); } update_post_meta($id, 'sd_page_type', 'homepage'); } else if ($page_type == 'np' || $page_type == '404') { if (!get_option('aurifox_404_post_id')) { update_option( 'aurifox_404_post_id', $id); } update_post_meta($id, 'sd_page_type', '404'); } else { update_post_meta($id, 'sd_page_type', 'page'); } } } } update_option('aurifox_posts_schema_version', 1); } register_activation_hook( __FILE__, 'aurifox_plugin_activated' ); function aurifox_sd_plugin_submenu() { add_submenu_page( 'edit.php?post_type=aurifox', __( 'aurifox Shortcodes', 'aurifox-menu' ), __( 'Shortcodes', 'aurifox-menu' ), 'manage_options', 'aurifox_shortcodes', 'aurifox_shortcodes' ); add_submenu_page( 'edit.php?post_type=aurifox', __( 'Settings', 'aurifox-menu' ), __( 'Settings', 'aurifox-menu' ), 'manage_options', 'sd_api', 'aurifox_sd_api_settings_page' ); add_submenu_page( null, __( 'Reset Data', 'aurifox-menu' ), __( 'Reset Data', 'aurifox-menu' ), 'manage_options', 'reset_data', 'aurifox_reset_data_show_page' ); } add_action( 'admin_menu', 'aurifox_sd_plugin_submenu' ); function aurifox_reset_data_show_page(){ include 'pages/reset_data.php'; } function aurifox_sd_api_settings_page() { include 'pages/settings.php'; } function aurifox_shortcodes() { include 'pages/shortcodes.php'; } function aurifox_loadjquery($hook) { if( $hook != 'edit.php' && $hook != 'post.php' && $hook != 'post-new.php' ) { return; } wp_enqueue_script( 'jquery' ); } add_action('admin_enqueue_scripts', 'aurifox_loadjquery'); function aurifox_embed( $atts ) { $a = shortcode_atts( array( 'height' => '650', 'scroll' => 'on', 'url' => '', ), $atts ); return ""; } add_shortcode( 'aurifox_embed', 'aurifox_embed' ); function aurifox_clickpop_script() { wp_enqueue_script( 'sd_clickpop' ); } add_action( 'wp_enqueue_scripts', 'aurifox_clickpop_script' ); function aurifox_clickpop( $atts, $content = null ) { $a = shortcode_atts( array( 'exit' => 'false', 'delay' => '', 'id' => '', 'subdomain' => '', ), $atts ); if ($a['delay'] != '') { $delayTime = "{$a['delay']}000"; $delay_js = ""; } else { $delayTime = ''; $delay_js = ""; } if (strpos($a['subdomain'], '.') !== false) { return "$content$delay_js"; } else { return "$content$delay_js"; } } add_shortcode( 'aurifox_clickpop', 'aurifox_clickpop' ); function aurifox_clickoptin( $atts ) { $a = shortcode_atts( array( 'button_text' => 'Subscribe To Our Mailing List', 'button_color' => 'blue', 'placeholder' => 'Enter Your Email Address Here', 'id' => '#', 'subdomain' => '#', 'input_icon' => 'show', 'redirect' => '', ), $atts ); if ($a['button_text'] == '') { $button_text = 'Subscribe To Our Mailing List'; } else { $button_text = $a['button_text']; } if ($a['placeholder'] == '') { $placeholder = 'Enter Your Email Address Here'; } else { $placeholder = $a['placeholder']; } if (strpos($a['subdomain'], '.') !== false) { $subdomain = $a['subdomain']; } else { $subdomain = $a['subdomain'] . '.aurifox.com'; } return "
".esc_html($button_text)."
"; } add_shortcode( 'aurifox_clickoptin', 'aurifox_clickoptin' ); add_filter('widget_text', 'do_shortcode'); class aurifox_widget extends WP_Widget { function __construct() { parent::__construct( 'aurifox_widget', esc_html(__('aurifox Shortcode', 'aurifox_widget_domain')), array( 'description' => esc_html(__( 'Paste your aurifox shortcodes here to embed an iframe, a ClickPop link or show a ClickForm box in your sidebar or footer.', 'aurifox_widget_domain' )), ) ); } public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $shortcode = apply_filters( 'widget_title', $instance['shortcode'] ); echo $args['before_widget']; if ( ! empty( $title ) ) echo '

'.$title.'

'; if ( ! empty( $shortcode ) ) echo do_shortcode(htmlspecialchars_decode(($shortcode))); echo $args['after_widget']; } public function form( $instance ) { if ( isset( $instance[ 'title' ] ) ) { $title = $instance[ 'title' ]; } else { $title = esc_html(__( '', 'aurifox_widget_domain' )); } if ( isset( $instance[ 'shortcode' ] ) ) { $shortcode = $instance[ 'shortcode' ]; } else { $shortcode = esc_html(__( '', 'aurifox_widget_domain' )); } ?>