'advanced-ads', 'plugin_name' => 'Advanced Ads', 'hook' => 'advanced-ads-overview-below-support', ) ); // show errors if( Advanced_Ads_Ad_Health_Notices::notices_enabled() && count( Advanced_Ads_Ad_Health_Notices::get_instance()->displayed_notices ) ){ self::add_meta_box('advads_overview_notices', false, 'full', 'render_notices' ); } self::add_meta_box('advads_overview_news', __( 'Next steps', 'advanced-ads' ), 'left', 'render_next_steps'); self::add_meta_box('advads_overview_support', __( 'Manual and Support', 'advanced-ads' ), 'right', 'render_support' ); if ( Advanced_Ads_AdSense_Data::get_instance()->is_setup() && ! Advanced_Ads_AdSense_Data::get_instance()->is_hide_stats() ){ $disable_link_markup = '' . esc_attr__('Disable', 'advanced-ads') . ''; self::add_meta_box('advads_overview_adsense_stats', __( 'AdSense Earnings', 'advanced-ads' ) . $disable_link_markup, 'full', 'render_adsense_stats' ); } // add widgets for pro add ons self::add_meta_box('advads_overview_addons', __( 'Add-Ons', 'advanced-ads' ), 'full', 'render_addons' ); do_action( 'advanced-ads-overview-widgets-after' ); } /** * loads a meta box into output */ public static function add_meta_box( $id = '', $title = '', $position = 'full', $callback ){ ob_start(); call_user_func(array('Advanced_Ads_Overview_Widgets_Callbacks', $callback)); do_action( 'advanced-ads-overview-widget-content-' . $id, $id ); $content = ob_get_clean(); include( ADVADS_BASE_PATH . 'admin/views/overview-widget.php' ); } /** * render Ad Health notices widget * * @since 1.11.x */ public static function render_notices(){ /*?> render_widget(); ?>get_model(); $recent_ads = $model->get_ads(); if ( count( $recent_ads ) == 0 ) : echo '

' . __( 'Create your first ad', 'advanced-ads' ) . '

'; // Connect to AdSense echo '

' . esc_attr__( 'Connect to AdSense', 'advanced-ads' ) . '

'; $primary_taken = true; endif; $is_subscribed = Advanced_Ads_Admin_Notices::get_instance()->is_subscribed(); $can_subscribe = Advanced_Ads_Admin_Notices::get_instance()->user_can_subscribe(); $options = Advanced_Ads_Admin_Notices::get_instance()->options(); $_notice = 'nl_free_addons'; if ( $can_subscribe ) { ?>

3 && ! isset($options[ 'closed' ][ 'review' ] ) ){ /** * ask for a review if the review message was not closed before */ ?>

     

0 ){ // link to manage ads echo '

' . __( 'Manage your ads', 'advanced-ads' ) . '

'; } if ( $is_subscribed ) { ?>

how much you can earn with AdSense and Advanced Ads from the dedicated newsletter group.', 'advanced-ads' ); ?>

ignore ); $displayed_count = count( Advanced_Ads_Ad_Health_Notices::get_instance()->displayed_notices ); if( !$displayed_count && $ignored_count ){ // translators: %s includes a number and markup like 6. ?>

 

"DOMAIN_NAME", "allow_refresh" => true, "filter_value" => $filter_value ); include(ADVADS_BASE_PATH . 'admin/views/gadsense-dashboard.php'); } public static final function adsense_stats_js($pub_id){ if (self::$processed_adsense_stats_js) return; self::$processed_adsense_stats_js = true; $nonce = self::get_adsense_dashboard_nonce(); ?> 1 ? $matches[2] : null; return $domain; } /** * this method should be used, if you want to render a dashboard summary. * it takes an associative options array as parameter to create a summary object, * which can be used to create a json or html response. * @param array $options * @return Advanced_Ads_AdSense_Dashboard_Summary */ public static function create_dashboard_summary($options){ if (! $options) $options = array(); $options = array_merge( array( "dimension_name" => null, "filter_value" => null, "hide_dimensions" => false, "force_refresh" => false, "allow_refresh" => true, ), $options); $dimension_name = $options['dimension_name']; $filter_value = $options['filter_value']; $hide_dimensions = $options['hide_dimensions']; $force_refresh = $options['force_refresh']; $allow_refresh = $options['allow_refresh']; $pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id(); $optional_dimension_names = $dimension_name == "AD_UNIT_CODE" ? Advanced_Ads_Overview_Widgets_Callbacks::get_ad_code_map($pub_id) : null; $summary = Advanced_Ads_AdSense_Report_Builder::createDashboardSummary($dimension_name, $filter_value, "dashboard", $optional_dimension_names, $force_refresh, $allow_refresh); if ($hide_dimensions){ $summary->dimensions = null; } $summary->hide_dimensions = $hide_dimensions; return $summary; } /** * we want to display the name of the ad code insted of the code itself. * @param string $pub_id the publisher id of the adsense account * @return array an associative array with ad codes as key and their respective name as value */ public static function get_ad_code_map($pub_id){ $map = array(); $ad_units_opts = get_option(Advanced_Ads_AdSense_MAPI::OPTNAME); if (! isset($ad_units_opts['accounts'])) return null; foreach ($ad_units_opts['accounts'] as $key => $account){ if ($key === $pub_id && isset($account['ad_units']) && is_array($account['ad_units'])){ $units = $account['ad_units']; foreach ($units as $unit){ $map[$unit['code']] = $unit['name']; } } } return $map; } /** * this method is called when the dashboard data is requested via ajax * it prints the relevant data as json, then dies. */ public static function ajax_gadsense_dashboard(){ // retrieve our post parameters. $dimension_name = isset($_POST['dimension_name']) ? $_POST['dimension_name'] : "DOMAIN_NAME"; $filter_value = isset($_POST['filter']) ? $_POST['filter'] : null; $dimension_name = sanitize_text_field($dimension_name); if ($filter_value) $filter_value = sanitize_text_field($filter_value); $errors = array(); // check nonce and capabilities if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options') ) ) { $errors[] = "missing capability"; } // check nonce if (! check_ajax_referer( 'advads-gadsense-dashboard', 'nonce', false)){ $errors[] = "invalid request"; } // when there is an error, send it right away if (count($errors) > 0){ $r = array("summary" => array("valid" => false, "errors" => $errors)); header( 'Content-Type: application/json' ); echo wp_json_encode($r); die(); } $options = array( "dimension_name" => $dimension_name, ); if ($dimension_name === "DOMAIN_NAME"){ if ($filter_value){ update_option("advanced-ads-adsense-dashboard-filter", $filter_value); } } else if ($dimension_name === "AD_UNIT_CODE"){ $options["hide_dimensions"] = true; } if ($filter_value && $filter_value === "*") $filter_value = null; $options["filter_value"] = $filter_value; $r = array(); $summary = self::create_dashboard_summary($options); $r['summary'] = $summary; header( 'Content-Type: application/json' ); echo wp_json_encode($r); die(); } public static final function render_stats_box($title, $main, $footer){ ?>

array( 'title' => 'Tracking', 'desc' => __( 'Analyze clicks and impressions of your ads locally or in Google Analytics, share reports, and limit ads to a specific number of impressions or clicks.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/tracking/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'order' => 4, ), 'responsive' => array( 'title' => 'Responsive, AMP and Mobile ads', 'desc' => __( 'Display ads based on the device or the size of your visitor’s browser, and control ads on AMP pages.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/responsive-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'order' => 4, ), 'pro' => array( 'title' => 'Advanced Ads Pro', 'desc' => $pro_content, 'link' => ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'order' => 4, 'class' => 'recommended' ), 'selling' => array( 'title' => 'Selling Ads', 'desc' => __( 'Earn more money and let advertisers pay for ad space directly on the frontend of your site.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/selling-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'order' => 5, ), 'geo' => array( 'title' => 'Geo Targeting', 'desc' => __( 'Target visitors with ads that match their geo location and make more money with regional campaigns.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/geo-targeting/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'order' => 5, ), 'sticky' => array( 'title' => 'Sticky ads', 'desc' => __( 'Increase click rates on your ads by placing them in sticky positions above, next or below your site.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/sticky-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'order' => 5, ), 'layer' => array( 'title' => 'PopUps and Layers', 'desc' => __( 'Users will never miss an ad or other information in a PopUp. Choose when it shows up and for how long a user can close it.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/popup-and-layer-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'order' => 5, ), 'slider' => array( 'title' => 'Ad Slider', 'desc' => __( 'Create a beautiful and simple slider from your ads to show more information on less space.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/slider/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'order' => 5, ), 'adsense-in-feed' => array( 'title' => 'AdSense In-feed', 'desc' => __( 'Place AdSense In-feed ads between posts on homepage, category, and archive pages.', 'advanced-ads' ), 'class' => 'free', 'link' => wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'advanced-ads-adsense-in-feed'), 'install-plugin_' . 'advanced-ads-adsense-in-feed'), 'link_title' => __( 'Install now', 'advanced-ads' ), 'order' => 9, ) ); // get all installed plugins; installed is not activated $installed_plugins = get_plugins(); $installed_pro_plugins = 0; // handle AdSense In-feed if already installed or not activated if( isset( $installed_plugins['advanced-ads-adsense-in-feed/advanced-ads-in-feed.php'] ) ){ // is installed, but not active // remove plugin from the list unset( $add_ons['adsense-in-feed'] ); } // PRO if( isset( $installed_plugins['advanced-ads-pro/advanced-ads-pro.php'] ) && ! class_exists( 'Advanced_Ads_Pro') ){ // is installed, but not active $add_ons['pro']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-pro/advanced-ads-pro.php&', 'activate-plugin_advanced-ads-pro/advanced-ads-pro.php' ); $add_ons['pro']['link_title'] = __( 'Activate now', 'advanced-ads' ); $installed_pro_plugins++; } elseif( class_exists( 'Advanced_Ads_Pro') ) { $add_ons['pro']['link'] = ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual'; $add_ons['pro']['desc'] = ''; $add_ons['pro']['installed'] = true; $add_ons['pro']['order'] = 20; $installed_pro_plugins++; // remove the add-on if( $hide_activated ){ unset( $add_ons['pro'] ); } } elseif( $caching_used ) { // for now, "recommended" is always set for this plugin since there are so many advantages // $add_ons['pro']['class'] = 'recommended'; } // TRACKING if( isset( $installed_plugins['advanced-ads-tracking/tracking.php'] ) && ! class_exists( 'Advanced_Ads_Tracking_Plugin') ){ // is installed, but not active $add_ons['tracking']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-tracking/tracking.php&', 'activate-plugin_advanced-ads-tracking/tracking.php' ); $add_ons['tracking']['link_title'] = __( 'Activate now', 'advanced-ads' ); $installed_pro_plugins++; } elseif( class_exists( 'Advanced_Ads_Tracking_Plugin', false ) && method_exists( Advanced_Ads_Tracking_Plugin::get_instance(), 'get_tracking_method' ) ) { $add_ons['tracking']['link'] = ADVADS_URL . 'add-ons/tracking/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual'; if( 'ga' !== Advanced_Ads_Tracking_Plugin::get_instance()->get_tracking_method() ){ // don’t show Tracking link if Analytics method is enabled $add_ons['tracking']['desc'] = '' . __('Visit your ad stats', 'advanced-ads') . ''; } else { $add_ons['tracking']['desc'] = ''; } $add_ons['tracking']['installed'] = true; $add_ons['tracking']['order'] = 20; $installed_pro_plugins++; // remove the add-on if( $hide_activated ){ unset( $add_ons['tracking'] ); } } // RESPONSIVE if( isset( $installed_plugins['advanced-ads-responsive/responsive-ads.php'] ) && ! class_exists( 'Advanced_Ads_Responsive_Plugin') ){ // is installed, but not active $add_ons['responsive']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-responsive/responsive-ads.php&', 'activate-plugin_advanced-ads-responsive/responsive-ads.php' ); $add_ons['responsive']['link_title'] = __( 'Activate now', 'advanced-ads' ); $installed_pro_plugins++; } elseif( class_exists( 'Advanced_Ads_Responsive_Plugin') ) { $add_ons['responsive']['link'] = ADVADS_URL . 'add-ons/responsive-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual'; $add_ons['responsive']['desc'] = '' . __('List of responsive ads by browser width', 'advanced-ads-responsive') . ''; $add_ons['responsive']['installed'] = true; $add_ons['responsive']['order'] = 20; $installed_pro_plugins++; // remove the add-on if( $hide_activated ){ unset( $add_ons['responsive'] ); } } // STICKY if( isset( $installed_plugins['advanced-ads-sticky-ads/sticky-ads.php'] ) && ! class_exists( 'Advanced_Ads_Sticky_Plugin') ){ // is installed, but not active $add_ons['sticky']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-sticky-ads/sticky-ads.php&', 'activate-plugin_advanced-ads-sticky-ads/sticky-ads.php' ); $add_ons['sticky']['link_title'] = __( 'Activate now', 'advanced-ads' ); $installed_pro_plugins++; } elseif( class_exists( 'Advanced_Ads_Sticky_Plugin') ) { $add_ons['sticky']['link'] = ADVADS_URL . 'add-ons/sticky-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual'; $add_ons['sticky']['desc'] = ''; $add_ons['sticky']['installed'] = true; $add_ons['sticky']['order'] = 20; $installed_pro_plugins++; // remove the add-on if( $hide_activated ){ unset( $add_ons['sticky'] ); } } // LAYER if( isset( $installed_plugins['advanced-ads-layer/layer-ads.php'] ) && ! class_exists( 'Advanced_Ads_Layer_Plugin') ){ // is installed, but not active $add_ons['layer']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-layer/layer-ads.php&', 'activate-plugin_advanced-ads-layer/layer-ads.php' ); $add_ons['layer']['link_title'] = __( 'Activate now', 'advanced-ads' ); $installed_pro_plugins++; } elseif( class_exists( 'Advanced_Ads_Layer_Plugin') ) { $add_ons['layer']['link'] = ADVADS_URL . 'add-ons/popup-and-layer-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual'; $add_ons['layer']['desc'] = ''; $add_ons['layer']['installed'] = true; $add_ons['layer']['order'] = 20; $installed_pro_plugins++; // remove the add-on if( $hide_activated ){ unset( $add_ons['layer'] ); } } // SELLING ADS if( isset( $installed_plugins['advanced-ads-selling/advanced-ads-selling.php'] ) && ! class_exists( 'Advanced_Ads_Selling_Plugin') ){ // is installed, but not active $add_ons['selling']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-selling/advanced-ads-selling.php&', 'activate-plugin_advanced-ads-selling/advanced-ads-selling.php' ); $add_ons['selling']['link_title'] = __( 'Activate now', 'advanced-ads' ); $installed_pro_plugins++; } elseif( class_exists( 'Advanced_Ads_Selling_Plugin') ) { $add_ons['selling']['link'] = ADVADS_URL . 'add-ons/selling-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual'; $add_ons['selling']['desc'] = ''; $add_ons['selling']['installed'] = true; $add_ons['selling']['order'] = 20; $installed_pro_plugins++; // remove the add-on if( $hide_activated ){ unset( $add_ons['selling'] ); } } // GEO TARGETING if( isset( $installed_plugins['advanced-ads-geo/advanced-ads-geo.php'] ) && ! class_exists( 'Advanced_Ads_Geo_Plugin') ){ // is installed, but not active $add_ons['geo']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-geo/advanced-ads-geo.php&', 'activate-plugin_advanced-ads-geo/advanced-ads-geo.php' ); $add_ons['geo']['link_title'] = __( 'Activate now', 'advanced-ads' ); $installed_pro_plugins++; } elseif( class_exists( 'Advanced_Ads_Geo_Plugin') ) { $add_ons['geo']['link'] = ADVADS_URL . 'add-ons/geo-targeting/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual'; $add_ons['geo']['desc'] = ''; $add_ons['geo']['installed'] = true; $add_ons['geo']['order'] = 20; $installed_pro_plugins++; // remove the add-on if( $hide_activated ){ unset( $add_ons['geo'] ); } } // SLIDER if( isset( $installed_plugins['advanced-ads-slider/slider.php'] ) && ! class_exists( 'Advanced_Ads_Slider_Plugin') ){ // is installed, but not active $add_ons['slider']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-slider/slider.php&', 'activate-plugin_advanced-ads-slider/slider.php' ); $add_ons['slider']['link_title'] = __( 'Activate now', 'advanced-ads' ); } elseif( class_exists( 'Advanced_Ads_Slider_Plugin') ) { $add_ons['slider']['link'] = ADVADS_URL . 'add-ons/slider/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual'; $add_ons['slider']['desc'] = ''; $add_ons['slider']['installed'] = true; $add_ons['slider']['order'] = 20; // remove the add-on if( $hide_activated ){ unset( $add_ons['slider'] ); } } // add Genesis Ads, if Genesis based theme was detected if( defined( 'PARENT_THEME_NAME') && 'Genesis' === PARENT_THEME_NAME ) { $add_ons['genesis'] = array( 'title' => 'Genesis Ads', 'desc' => __( 'Use Genesis specific ad positions.', 'advanced-ads' ), 'order' => 2, 'class' => 'free', 'link' => wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'advanced-ads-genesis'), 'install-plugin_' . 'advanced-ads-genesis'), 'link_title' => __( 'Install now', 'advanced-ads' ), ); // handle install link as long as we can not be sure this is done by the Genesis plugin itself if( isset( $installed_plugins['advanced-ads-genesis/genesis-ads.php'] ) ){ // is installed (active or not) unset( $add_ons['genesis'] ); } } // add Ads for WPBakery Page Builder (formerly Visual Composer), if VC was detected if( defined( 'WPB_VC_VERSION') ) { $add_ons['visual_composer'] = array( 'title' => 'Ads for WPBakery Page Builder (formerly Visual Composer)', 'desc' => __( 'Manage ad positions with WPBakery Page Builder (formerly Visual Composer).', 'advanced-ads' ), 'order' => 2, 'class' => 'free', 'link' => wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'ads-for-visual-composer'), 'install-plugin_' . 'ads-for-visual-composer'), 'link_title' => __( 'Install now', 'advanced-ads' ), ); // handle install link as long as we can not be sure this is done by the Genesis plugin itself if( isset( $installed_plugins['ads-for-visual-composer/advanced-ads-vc.php'] ) ){ // is installed (active or not) unset( $add_ons['visual_composer'] ); } } // only show All Access Pitch if less than 2 add-ons exist if( $installed_pro_plugins < 2 ){ $add_ons['bundle'] = array( 'title' => 'All Access', 'desc' => __( 'Our best deal with all add-ons included.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/all-access/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'link_title' => __( 'Get full access', 'advanced-ads' ), 'link_primary' => true, 'order' => 0, ); } // allow add-ons to manipulate the output $add_ons = apply_filters( 'advanced-ads-overview-add-ons', $add_ons ); uasort( $add_ons, array( 'self', 'sort_by_order' ) ); ?> ' . $_addon['title']; } else { $link_title = isset( $_addon['link_title'] ) ? $_addon['link_title'] : __( 'Get this add-on', 'advanced-ads' ); } include ADVADS_BASE_PATH . 'admin/views/overview-addons-line.php'; endforeach; ?>