'advanced-ads', 'plugin_name' => 'Advanced Ads', 'hook' => 'advanced-ads-overview-below-support', 'glotpress_logo' => false, // disables the plugin icon so we don’t need to keep up with potential changes. ] ); // 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 * * @param string $id meta box ID. * @param string $title title of the meta box. * @param string $position context in which to show the box. * @param callable $callback function that fills the box with the desired content. */ public static function add_meta_box( $id, $title, $position, $callback ) { ob_start(); call_user_func( [ '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 */ public static function render_notices() { Advanced_Ads_Ad_Health_Notices::get_instance()->render_widget(); ?> get_model(); $recent_ads = $model->get_ads(); if ( count( $recent_ads ) === 0 ) : echo '

' . esc_html( __( '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 '

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

'; } $all_access = Advanced_Ads_Admin_Licenses::get_instance()->get_probably_all_access(); if ( $is_subscribed && ! $all_access ) { ?> 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. ?>

 

1 ? $matches[2] : null; return $domain; } /** * 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() { $post_data = wp_unslash( $_POST ); if ( wp_verify_nonce( $post_data['nonce'], 'advads-gadsense-dashboard' ) === false ) { wp_send_json_error( 'Unauthorized request', 401 ); } $report_type = in_array( $post_data['type'], [ 'domain', 'unit' ], true ) ? $post_data['type'] : false; if ( ! $report_type ) { wp_send_json_error( 'Invalid arguments', 400 ); } $report_filter = wp_strip_all_tags( $post_data['filter'] ); $report = new Advanced_Ads_AdSense_Report( $report_type, $report_filter ); if ( $report->get_data()->is_valid() ) { // There is valid data wp_send_json_success( [ 'html' => $report->get_markup() ] ); } if ( $report->refresh_report() ) { // we got new data from Google; wp_send_json_success( [ 'html' => $report->get_markup() ] ); } $error_message = $report->get_last_api_error(); // Send markup with error info. wp_send_json_success( [ 'html' => '

' . wp_kses_post( $error_message ) . '

' ] ); } /** * Render stats box * * @param string $title title of the box. * @param string $main main content. * @param string $footer footer content. * * @deprecated ? */ final public static function render_stats_box( $title, $main, $footer ) { ?>

[ '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', ], 'tracking' => [ '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' => [ '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, ], 'gam' => [ 'title' => 'Google Ad Manager Integration', 'desc' => __( 'A quick and error-free way of implementing ad units from your Google Ad Manager account.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/google-ad-manager/?utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'order' => 5, ], 'sticky' => [ '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' => [ '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, ], 'selling' => [ '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' => 6, ], 'slider' => [ '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' => 6, ], 'adsense-in-feed' => [ '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 . 'manual/?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'] ); } } // 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 . 'manual/tracking-documentation/?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 statistics', '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 . 'manual/responsive-ads-documentation/?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' ) . ''; $add_ons['responsive']['installed'] = true; $add_ons['responsive']['order'] = 20; $installed_pro_plugins++; // remove the add-on. if ( $hide_activated ) { unset( $add_ons['responsive'] ); } } // GOOGLE AD MANAGER. if ( isset( $installed_plugins['advanced-ads-gam/advanced-ads-gam.php'] ) && ! class_exists( 'Advanced_Ads_Network_Gam' ) ) { // is installed, but not active. $add_ons['gam']['link'] = wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads-gam/advanced-ads-gam.php&', 'activate-plugin_advanced-ads-gam/advanced-ads-gam.php' ); $add_ons['gam']['link_title'] = __( 'Activate now', 'advanced-ads' ); $installed_pro_plugins++; } elseif ( class_exists( 'Advanced_Ads_Network_Gam' ) ) { $add_ons['gam']['link'] = ADVADS_URL . 'manual/google-ad-manager-integration-manual/?utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons-manual'; $add_ons['gam']['desc'] = ''; $add_ons['gam']['installed'] = true; $add_ons['gam']['order'] = 20; $installed_pro_plugins++; // remove the add-on. if ( $hide_activated ) { unset( $add_ons['gam'] ); } } // 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 . 'manual/sticky-ads-documentation/?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 . 'manual/popup-and-layer-ads-documentation/?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 . 'manual/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'] ); } } // 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 . 'manual/ad-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'] = [ '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'] = [ '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'] ); } } // show All Access Pitch if less than 2 add-ons exist. if ( $installed_pro_plugins < 2 ) { $add_ons['bundle'] = [ '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, ]; } $all_access_expiry = Advanced_Ads_Admin_Licenses::get_instance()->get_probably_all_access_expiry(); // show All Access long-term pitch if less than 2 add-ons exist or All Access license is expiring within next 12 month or already expired if ( $installed_pro_plugins < 2 || ( $all_access_expiry && ( time() + YEAR_IN_SECONDS ) > strtotime( $all_access_expiry ) ) ) { $add_ons['long_term'] = [ 'title' => 'All Access long-term', 'desc' => __( 'A one-time payment for four years of support and updates. The package saves you up to 70% compared to individually purchasing our add-ons.', 'advanced-ads' ), 'link' => ADVADS_URL . 'add-ons/all-access-long-term/?utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons', 'link_title' => __( 'Get full access', 'advanced-ads' ), 'link_primary' => true, 'order' => 1, ]; } // allow add-ons to manipulate the output. $add_ons = apply_filters( 'advanced-ads-overview-add-ons', $add_ons ); uasort( $add_ons, [ '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; ?>