Advanced Ads - Version 1.17.12-rc.1

Version Description

Download this release

Release Info

Developer advancedads
Plugin Icon 128x128 Advanced Ads
Version 1.17.12-rc.1
Comparing to
See all releases

Code changes from version 1.17.11 to 1.17.12-rc.1

admin/class-advanced-ads-admin.php CHANGED
@@ -124,6 +124,7 @@ class Advanced_Ads_Admin {
124
  Advanced_Ads_Admin_Menu::get_instance();
125
  Advanced_Ads_Admin_Ad_Type::get_instance();
126
  Advanced_Ads_Admin_Settings::get_instance();
 
127
  }
128
 
129
  /**
@@ -732,18 +733,4 @@ class Advanced_Ads_Admin {
732
 
733
  include ADVADS_BASE_PATH . 'admin/views/notices/starter-setup-success.php';
734
  }
735
-
736
- /**
737
- * Show a Pro upsell pitch
738
- *
739
- * @param string $utm_campaign utm_campaign value to attach to the URL.
740
- */
741
- public static function pro_feature_link( $utm_campaign = '' ) {
742
-
743
- $utm_parameter_base = '#utm_source=advanced-ads&utm_medium=link&utm_campaign=';
744
- $utm_parameter = ( $utm_campaign ) ? $utm_parameter_base . $utm_campaign : $utm_parameter_base . 'pro_feature_link';
745
-
746
- include ADVADS_BASE_PATH . 'admin/views/pitches/pro-feature-link.php';
747
- }
748
-
749
  }
124
  Advanced_Ads_Admin_Menu::get_instance();
125
  Advanced_Ads_Admin_Ad_Type::get_instance();
126
  Advanced_Ads_Admin_Settings::get_instance();
127
+ new Advanced_Ads_Admin_Upgrades();
128
  }
129
 
130
  /**
733
 
734
  include ADVADS_BASE_PATH . 'admin/views/notices/starter-setup-success.php';
735
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
736
  }
admin/includes/class-ad-type.php CHANGED
@@ -102,9 +102,18 @@ class Advanced_Ads_Admin_Ad_Type {
102
  'no_ads_yet_notice',
103
  )
104
  );
105
- // save ads post type.
 
 
 
 
 
 
 
 
 
106
  add_action(
107
- 'save_post',
108
  array(
109
  $this,
110
  'save_ad',
@@ -492,8 +501,6 @@ class Advanced_Ads_Admin_Ad_Type {
492
  * Prepare the ad post type to be saved
493
  *
494
  * @param int $post_id id of the post.
495
- *
496
- * @since 1.0.0
497
  * @todo handling this more dynamic based on ad type
498
  */
499
  public function save_ad( $post_id ) {
@@ -621,6 +628,38 @@ class Advanced_Ads_Admin_Ad_Type {
621
  $ad->save();
622
  }
623
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  /**
625
  * Prepare the ad post type to be removed
626
  *
102
  'no_ads_yet_notice',
103
  )
104
  );
105
+ // Manipulate post data when post is created.
106
+ add_filter(
107
+ 'wp_insert_post_data',
108
+ array(
109
+ $this,
110
+ 'prepare_insert_post_data',
111
+ )
112
+ );
113
+ // Save ads post type.
114
+ // @source https://developer.wordpress.org/reference/hooks/save_post_post-post_type/
115
  add_action(
116
+ 'save_post_advanced_ads',
117
  array(
118
  $this,
119
  'save_ad',
501
  * Prepare the ad post type to be saved
502
  *
503
  * @param int $post_id id of the post.
 
 
504
  * @todo handling this more dynamic based on ad type
505
  */
506
  public function save_ad( $post_id ) {
628
  $ad->save();
629
  }
630
 
631
+ /**
632
+ * Prepare main post data for ads when being saved.
633
+ *
634
+ * Set default title if it is empty.
635
+ *
636
+ * @param array $data An array of slashed post data.
637
+ * @return array
638
+ */
639
+ public static function prepare_insert_post_data( $data ) {
640
+
641
+ if ( Advanced_Ads::POST_TYPE_SLUG === $data['post_type']
642
+ && '' === $data['post_title'] ) {
643
+
644
+ if ( function_exists( 'wp_date' ) ) {
645
+ // The function wp_date was added in WP 5.3.
646
+ $created_time = wp_date( get_option( 'date_format' ) ) . ' ' . wp_date( get_option( 'time_format' ) );
647
+ } else {
648
+ // Just attach the post date raw form.
649
+ $created_time = $data['post_date'];
650
+ }
651
+
652
+ // Create timestamp from current data.
653
+ $data['post_title'] = sprintf(
654
+ // Translators: %s is the time the ad was first saved.
655
+ __( 'Ad created on %s', 'advanced-ads' ),
656
+ $created_time
657
+ );
658
+ }
659
+
660
+ return $data;
661
+ }
662
+
663
  /**
664
  * Prepare the ad post type to be removed
665
  *
admin/includes/class-admin-upgrades.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // phpcs:ignore
2
+ /**
3
+ * Functions around promoting upgrades
4
+ *
5
+ * @package Advanced Ads
6
+ */
7
+ class Advanced_Ads_Admin_Upgrades {
8
+
9
+ /**
10
+ * Advanced_Ads_Admin_Upgrades constructor.
11
+ */
12
+ public function __construct() {
13
+ // Show premium ad types on the ad edit page.
14
+ add_action( 'advanced-ads-ad-types', array( $this, 'ad_types' ), 1000 );
15
+ // Show notice in Ad Parameters when someone uses an Ad Manager ad in the plain text code field.
16
+ add_filter( 'advanced-ads-ad-notices', array( $this, 'ad_notices' ), 10, 3 );
17
+ // Show AMP options on ad edit page of AdSense ads.
18
+ add_action( 'advanced-ads-gadsense-extra-ad-param', array( $this, 'adsense_type_amp_options' ) );
19
+ }
20
+
21
+ /**
22
+ * Add premium ad types to ad type list on ad edit screens.
23
+ *
24
+ * @param array $ad_types ad types registered with Advanced Ads.
25
+ * @return array ad types.
26
+ */
27
+ public function ad_types( $ad_types ) {
28
+ // Add Google Ad Manager ad type.
29
+ if ( ! defined( 'AAGAM_VERSION' ) ) {
30
+ $ad_types['upgrade-gam'] = new stdClass();
31
+ $ad_types['upgrade-gam']->ID = 'gam';
32
+ $ad_types['upgrade-gam']->title = 'Google Ad Manager'; // Do not translate.
33
+ $ad_types['upgrade-gam']->description = __( 'Load ad units directly from your Google Ad Manager account', 'advanced-ads' );
34
+ $ad_types['upgrade-gam']->is_upgrade = true;
35
+ $ad_types['upgrade-gam']->upgrade_url = ADVADS_URL . 'add-ons/google-ad-manager/';
36
+ }
37
+
38
+ // Add AMP ad type from Responsive Ads add-on.
39
+ if ( ! defined( 'AAR_VERSION' ) ) {
40
+ $ad_types['upgrade-amp'] = new stdClass();
41
+ $ad_types['upgrade-amp']->ID = 'amp';
42
+ $ad_types['upgrade-amp']->title = 'AMP'; // Do not translate.
43
+ $ad_types['upgrade-amp']->description = __( 'Ads that are visible on Accelerated Mobile Pages', 'advanced-ads' );
44
+ $ad_types['upgrade-amp']->is_upgrade = true;
45
+ $ad_types['upgrade-amp']->upgrade_url = ADVADS_URL . 'add-ons/responsive-ads/';
46
+ }
47
+
48
+ return $ad_types;
49
+ }
50
+
51
+ /**
52
+ * Show an upgrade link
53
+ *
54
+ * @param string $title link text.
55
+ * @param string $url target URL.
56
+ * @param string $utm_campaign utm_campaign value to attach to the URL.
57
+ */
58
+ public static function upgrade_link( $title = '', $url = '', $utm_campaign = '' ) {
59
+
60
+ $title = ! empty( $title ) ? $title : __( 'Upgrade', 'advanced-ads' );
61
+ $url = ! empty( $url ) ? $url : ADVADS_URL . 'add-ons/';
62
+ $utm_parameter_base = '#utm_source=advanced-ads&utm_medium=link&utm_campaign=';
63
+ $utm_parameter = ( $utm_campaign ) ? $utm_parameter_base . $utm_campaign : $utm_parameter_base . 'upgrade';
64
+
65
+ // Add parameter to URL.
66
+ $url = $url . $utm_parameter;
67
+
68
+ include ADVADS_BASE_PATH . 'admin/views/upgrades/upgrade-link.php';
69
+ }
70
+
71
+ /**
72
+ * Show an Advanced Ads Pro upsell pitch
73
+ *
74
+ * @param string $utm_campaign utm_campaign value to attach to the URL.
75
+ * @deprecated use upgrade_link()
76
+ */
77
+ public static function pro_feature_link( $utm_campaign = '' ) {
78
+
79
+ self::upgrade_link(
80
+ __( 'Pro Feature', 'advanced-ads' ),
81
+ ADVADS_URL . 'add-ons/advanced-ads-pro/',
82
+ $utm_campaign
83
+ );
84
+ }
85
+
86
+ /**
87
+ * Show notices in the Ad Parameters meta box
88
+ *
89
+ * @param array $notices Notices.
90
+ * @param array $box current meta box.
91
+ * @param WP_Post $post post object.
92
+ * @return array $notices Notices.
93
+ */
94
+ public function ad_notices( $notices, $box, $post ) {
95
+ // Show notice when someone uses an Ad Manager ad in the plain text code field.
96
+ if ( ! defined( 'AAGAM_VERSION' ) && 'ad-parameters-box' === $box['id'] ) {
97
+ $ad = new Advanced_Ads_Ad( $post->ID );
98
+ if ( 'plain' === $ad->type && strpos( $ad->content, 'div-gpt-ad-' ) ) {
99
+ $notices[] = array(
100
+ 'text' => sprintf(
101
+ // Translators: %1$s opening a tag, %2$s closing a tag.
102
+ esc_html__( 'This looks like a Google Ad Manager ad. Use the %1$sGAM Integration%2$s.', 'advanced' ),
103
+ '<a href="' . ADVADS_URL . 'add-ons/google-ad-manager/#utm_source=advanced-ads&utm_medium=link&utm_campaign=upgrade-ad-parameters-gam" target="_blank">',
104
+ '</a>'
105
+ ) . ' ' . __( 'A quick and error-free way of implementing ad units from your Google Ad Manager account.', 'advanced-ads' ),
106
+ );
107
+ }
108
+ }
109
+
110
+ return $notices;
111
+ }
112
+
113
+ /**
114
+ * AMP options for AdSense ads in the Ad Parameters on the ad edit page.
115
+ */
116
+ public function adsense_type_amp_options() {
117
+ if ( ! defined( 'AAR_VERSION ' ) && Advanced_Ads_Checks::active_amp_plugin() ) {
118
+ include ADVADS_BASE_PATH . 'admin/views/upgrades/adsense-amp.php';
119
+ }
120
+ }
121
+ }
admin/includes/class-meta-box.php CHANGED
@@ -223,11 +223,11 @@ class Advanced_Ads_Admin_Meta_Boxes {
223
  $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __( 'Manual', 'advanced-ads' ) . '</a>';
224
  break;
225
  case 'advads-pro-pitch':
226
- $view = 'pitches/all-access.php';
227
  // $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
228
  break;
229
  case 'advads-tracking-pitch':
230
- $view = 'pitches/tracking.php';
231
  // $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
232
  break;
233
  case 'advads-gadsense-box':
@@ -321,6 +321,7 @@ class Advanced_Ads_Admin_Meta_Boxes {
321
  }
322
  }
323
 
 
324
  if ( 'ad-parameters-box' === $box['id'] && Advanced_Ads_Ad_Type_Adsense::content_is_adsense( $ad->content ) && in_array( $ad->type, array( 'plain', 'content' ), true ) ) {
325
  if (
326
  false === strpos( $ad->content, 'enable_page_level_ads' )
223
  $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __( 'Manual', 'advanced-ads' ) . '</a>';
224
  break;
225
  case 'advads-pro-pitch':
226
+ $view = 'upgrades/all-access.php';
227
  // $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
228
  break;
229
  case 'advads-tracking-pitch':
230
+ $view = 'upgrades/tracking.php';
231
  // $hndlelinks = '<a href="' . ADVADS_URL . 'manual/visitor-conditions#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-visitor" target="_blank">' . __('Manual', 'advanced-ads') . '</a>';
232
  break;
233
  case 'advads-gadsense-box':
321
  }
322
  }
323
 
324
+ // Let users know that they could use the Google AdSense ad type when they enter an AdSense code.
325
  if ( 'ad-parameters-box' === $box['id'] && Advanced_Ads_Ad_Type_Adsense::content_is_adsense( $ad->content ) && in_array( $ad->type, array( 'plain', 'content' ), true ) ) {
326
  if (
327
  false === strpos( $ad->content, 'enable_page_level_ads' )
admin/includes/class-options.php CHANGED
@@ -53,8 +53,8 @@ class Advanced_Ads_Admin_Options {
53
  <div>
54
  <?php
55
  if ( 'is_pro_pitch' === $content ) {
56
- // skip this step and place an upgrade link below the description if there is one.
57
- } elseif ( file_exists( $content ) ) {
58
  include $content;
59
  } else {
60
  // phpcs:ignore
@@ -69,7 +69,7 @@ class Advanced_Ads_Admin_Options {
69
 
70
  // place an upgrade link below the description if there is one.
71
  if ( 'is_pro_pitch' === $content ) {
72
- Advanced_Ads_Admin::pro_feature_link( 'pitch-pro-' . $id );
73
  }
74
  ?>
75
  </div>
53
  <div>
54
  <?php
55
  if ( 'is_pro_pitch' === $content ) {
56
+ // Skip this step and place an upgrade link below the description if there is one.
57
+ } elseif ( strlen( $content ) < 500 && file_exists( $content ) ) { // Check length of the string because too long content can break `file_exists`.
58
  include $content;
59
  } else {
60
  // phpcs:ignore
69
 
70
  // place an upgrade link below the description if there is one.
71
  if ( 'is_pro_pitch' === $content ) {
72
+ Advanced_Ads_Admin_Upgrades::pro_feature_link( 'upgrade-pro-' . $id );
73
  }
74
  ?>
75
  </div>
admin/includes/class-settings.php CHANGED
@@ -362,7 +362,7 @@ class Advanced_Ads_Admin_Settings {
362
  */
363
  public function render_settings_pro_pitch_section_callback() {
364
  echo '<br/>';
365
- include ADVADS_BASE_PATH . 'admin/views/pitches/pro-tab.php';
366
  }
367
 
368
  /**
@@ -370,7 +370,7 @@ class Advanced_Ads_Admin_Settings {
370
  */
371
  public function render_settings_tracking_pitch_section_callback() {
372
  echo '<br/>';
373
- include ADVADS_BASE_PATH . 'admin/views/pitches/tracking.php';
374
  }
375
 
376
  /**
362
  */
363
  public function render_settings_pro_pitch_section_callback() {
364
  echo '<br/>';
365
+ include ADVADS_BASE_PATH . 'admin/views/upgrades/pro-tab.php';
366
  }
367
 
368
  /**
370
  */
371
  public function render_settings_tracking_pitch_section_callback() {
372
  echo '<br/>';
373
+ include ADVADS_BASE_PATH . 'admin/views/upgrades/tracking.php';
374
  }
375
 
376
  /**
admin/views/ad-main-metabox.php CHANGED
@@ -4,19 +4,47 @@
4
  <?php else : ?>
5
  <ul id="advanced-ad-type">
6
  <?php
7
- // choose first type if none set.
8
  $ad_type = ( isset( $ad->type ) ) ? $ad->type : current( $types )->ID;
9
  foreach ( $types as $_type ) :
10
- ?>
11
- <li class="advanced-ads-type-list-<?php echo esc_attr( $_type->ID ); ?>">
12
- <input type="radio" name="advanced_ad[type]" id="advanced-ad-type-<?php echo esc_attr( $_type->ID ); ?>" value="<?php echo esc_attr( $_type->ID ); ?>" <?php checked( $ad_type, $_type->ID ); ?>/>
13
- <label for="advanced-ad-type-<?php echo esc_attr( $_type->ID ); ?>"><?php echo empty( $_type->title ) ? esc_html( $_type->ID ) : esc_html( $_type->title ); ?></label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  <?php
15
- if ( ! empty( $_type->description ) ) :
16
- ?>
17
- <span class="description"><?php echo esc_html( $_type->description ); ?></span><?php endif; ?>
18
- </li>
19
- <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
20
  </ul>
21
  <?php endif; ?>
22
  <script>
4
  <?php else : ?>
5
  <ul id="advanced-ad-type">
6
  <?php
7
+ // Choose first type if none set.
8
  $ad_type = ( isset( $ad->type ) ) ? $ad->type : current( $types )->ID;
9
  foreach ( $types as $_type ) :
10
+ $ad_type_title = empty( $_type->title ) ? $_type->ID : $_type->title;
11
+ if ( isset( $_type->is_upgrade ) && $_type->is_upgrade ) :
12
+ // Ad types that are available through an upgrade.
13
+ ?>
14
+ <li class="advanced-ads-type-list-<?php echo esc_attr( $_type->ID ); ?>">
15
+ <input type="radio" disabled="disabled"/>
16
+ <label><?php echo esc_html( $ad_type_title ); ?></label>
17
+ <?php
18
+ if ( ! empty( $_type->description ) ) :
19
+ ?>
20
+ <span class="description">
21
+ <?php
22
+ echo esc_html( $_type->description );
23
+ if ( ! empty( $_type->upgrade_url ) ) :
24
+ echo ' ';
25
+ Advanced_Ads_Admin_Upgrades::upgrade_link( null, $_type->upgrade_url, 'upgrade-ad-type-' . $_type->ID );
26
+ endif;
27
+ ?>
28
+ </span>
29
+ <?php
30
+ endif;
31
+ ?>
32
+ </li>
33
  <?php
34
+ else :
35
+ ?>
36
+ <li class="advanced-ads-type-list-<?php echo esc_attr( $_type->ID ); ?>">
37
+ <input type="radio" name="advanced_ad[type]" id="advanced-ad-type-<?php echo esc_attr( $_type->ID ); ?>" value="<?php echo esc_attr( $_type->ID ); ?>" <?php checked( $ad_type, $_type->ID ); ?>/>
38
+ <label for="advanced-ad-type-<?php echo esc_attr( $_type->ID ); ?>"><?php echo esc_html( $ad_type_title ); ?></label>
39
+ <?php
40
+ if ( ! empty( $_type->description ) ) :
41
+ ?>
42
+ <span class="description"><?php echo esc_html( $_type->description ); ?></span><?php endif; ?>
43
+ </li>
44
+ <?php
45
+ endif;
46
+ endforeach;
47
+ ?>
48
  </ul>
49
  <?php endif; ?>
50
  <script>
admin/views/ad-output-metabox.php CHANGED
@@ -67,16 +67,23 @@
67
  <div class="advads-hide-in-wizard">
68
  <?php
69
  esc_html_e( 'Display the ad only once per page', 'advanced-ads' );
70
- Advanced_Ads_Admin::pro_feature_link( 'pitch-pro-display-only-once' );
71
  ?>
 
 
 
 
 
72
  </div><hr class="advads-hide-in-wizard"/>
73
  <label class="label advads-hide-in-wizard"><?php esc_html_e( 'Custom Code', 'advanced-ads' ); ?></label>
74
  <div class="advads-hide-in-wizard">
75
  <?php
76
  esc_html_e( 'Place your own code below the ad', 'advanced-ads' );
77
- Advanced_Ads_Admin::pro_feature_link( 'pitch-pro-custom-code' );
78
  ?>
79
- </div>
 
 
 
 
80
  <?php endif; ?>
81
 
82
  <?php do_action( 'advanced-ads-output-metabox-after', $ad ); ?>
67
  <div class="advads-hide-in-wizard">
68
  <?php
69
  esc_html_e( 'Display the ad only once per page', 'advanced-ads' );
 
70
  ?>
71
+ <p>
72
+ <?php
73
+ Advanced_Ads_Admin_Upgrades::pro_feature_link( 'upgrade-pro-display-only-once' );
74
+ ?>
75
+ </p>
76
  </div><hr class="advads-hide-in-wizard"/>
77
  <label class="label advads-hide-in-wizard"><?php esc_html_e( 'Custom Code', 'advanced-ads' ); ?></label>
78
  <div class="advads-hide-in-wizard">
79
  <?php
80
  esc_html_e( 'Place your own code below the ad', 'advanced-ads' );
 
81
  ?>
82
+ <p>
83
+ <?php
84
+ Advanced_Ads_Admin_Upgrades::pro_feature_link( 'upgrade-pro-custom-code' );
85
+ ?>
86
+ </p> </div>
87
  <?php endif; ?>
88
 
89
  <?php do_action( 'advanced-ads-output-metabox-after', $ad ); ?>
admin/views/pitches/pro-feature-link.php DELETED
@@ -1 +0,0 @@
1
- <p><a href="<?php echo esc_url( ADVADS_URL . 'add-ons/advanced-ads-pro/' . $utm_parameter ); ?>" target="_blank"><?php esc_html_e( 'Pro Feature', 'advanced-ads' ); ?></a></p>
 
admin/views/placement-form.php CHANGED
@@ -60,7 +60,7 @@
60
 
61
  // show Pro placements if Pro is not actiavated.
62
  if ( ! defined( 'AAP_VERSION' ) ) :
63
- include ADVADS_BASE_PATH . 'admin/views/pitches/pro-placements.php';
64
  ?>
65
  <div class="clear"></div>
66
  <?php
60
 
61
  // show Pro placements if Pro is not actiavated.
62
  if ( ! defined( 'AAP_VERSION' ) ) :
63
+ include ADVADS_BASE_PATH . 'admin/views/upgrades/pro-placements.php';
64
  ?>
65
  <div class="clear"></div>
66
  <?php
admin/views/placements.php CHANGED
@@ -178,22 +178,27 @@ endif;
178
  ob_start();
179
 
180
  if ( 'header' !== $_placement['type'] ) :
181
- $_label = isset( $_placement['options']['ad_label'] ) ? $_placement['options']['ad_label'] : 'default';
182
- $_position = ! empty( $_placement['options']['placement_position'] ) ? $_placement['options']['placement_position'] : 'default';
183
- $_clearfix = ! empty( $_placement['options']['placement_clearfix'] );
184
 
185
- ob_start();
186
- include ADVADS_BASE_PATH . 'admin/views/placements-ad-label.php';
187
- if ( ! empty( $placement_types[ $_placement['type'] ]['options']['show_position'] ) ) :
188
- include ADVADS_BASE_PATH . 'admin/views/placements-ad-label-position.php';
189
- endif;
190
- $option_content = ob_get_clean();
 
 
 
 
 
 
 
 
 
 
 
 
191
 
192
- Advanced_Ads_Admin_Options::render_option(
193
- 'placement-ad-label',
194
- __( 'ad label', 'advanced-ads' ),
195
- $option_content
196
- );
197
 
198
  // show Pro features if Pro is not actiavated.
199
  if ( ! defined( 'AAP_VERSION' ) ) {
178
  ob_start();
179
 
180
  if ( 'header' !== $_placement['type'] ) :
181
+ $type_options = isset( $placement_types[ $_placement['type'] ]['options'] ) ? $placement_types[ $_placement['type'] ]['options'] : array();
 
 
182
 
183
+ if ( ! isset( $type_options['placement-ad-label'] ) || $type_options['placement-ad-label'] ) {
184
+ $_label = isset( $_placement['options']['ad_label'] ) ? $_placement['options']['ad_label'] : 'default';
185
+ $_position = ! empty( $_placement['options']['placement_position'] ) ? $_placement['options']['placement_position'] : 'default';
186
+ $_clearfix = ! empty( $_placement['options']['placement_clearfix'] );
187
+
188
+ ob_start();
189
+ include ADVADS_BASE_PATH . 'admin/views/placements-ad-label.php';
190
+ if ( ! empty( $placement_types[ $_placement['type'] ]['options']['show_position'] ) ) :
191
+ include ADVADS_BASE_PATH . 'admin/views/placements-ad-label-position.php';
192
+ endif;
193
+ $option_content = ob_get_clean();
194
+
195
+ Advanced_Ads_Admin_Options::render_option(
196
+ 'placement-ad-label',
197
+ __( 'ad label', 'advanced-ads' ),
198
+ $option_content
199
+ );
200
+ }
201
 
 
 
 
 
 
202
 
203
  // show Pro features if Pro is not actiavated.
204
  if ( ! defined( 'AAP_VERSION' ) ) {
admin/views/settings/general/disable-post-types.php CHANGED
@@ -14,7 +14,4 @@ endforeach;
14
  <?php
15
  esc_html_e( 'The free version provides the post type display condition on the ad edit page.', 'advanced-ads' );
16
  ?>
17
- </p>
18
- <?php
19
-
20
- Advanced_Ads_Admin::pro_feature_link( 'pitch-pro-disable-post-type' );
14
  <?php
15
  esc_html_e( 'The free version provides the post type display condition on the ad edit page.', 'advanced-ads' );
16
  ?>
17
+ </p><p><?php Advanced_Ads_Admin_Upgrades::pro_feature_link( 'upgrade-pro-disable-post-type' ); ?></p>
 
 
 
admin/views/upgrades/adsense-amp.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <label class="label">AMP</label>
2
+ <div id="advads-adsense-responsive-amp-inputs">
3
+ <?php esc_html_e( 'Automatically convert AdSense ads into their AMP format', 'advanced-ads' ); ?>
4
+ <p><?php Advanced_Ads_Admin_Upgrades::upgrade_link( null, ADVADS_URL . 'add-ons/responsive-ads/', 'upgrade-ad-edit-adsense-amp' ); ?></p>
5
+ </div>
6
+ <hr />
admin/views/{pitches → upgrades}/all-access.php RENAMED
File without changes
admin/views/{pitches → upgrades}/pro-placements.php RENAMED
@@ -54,7 +54,7 @@ if ( class_exists( 'bbPress', false ) ) {
54
  );
55
  }
56
 
57
- ?><h4><?php Advanced_Ads_Admin::pro_feature_link( 'pitch-pro-placements' ); ?></h4>
58
  <?php
59
  if ( is_array( $pro_placements ) ) :
60
  foreach ( $pro_placements as $_key => $_place ) :
54
  );
55
  }
56
 
57
+ ?><h4><?php Advanced_Ads_Admin_Upgrades::pro_feature_link( 'upgrades-pro-placements' ); ?></h4>
58
  <?php
59
  if ( is_array( $pro_placements ) ) :
60
  foreach ( $pro_placements as $_key => $_place ) :
admin/views/{pitches → upgrades}/pro-tab.php RENAMED
@@ -13,6 +13,6 @@
13
  <a class="button button-primary" href="<?php echo esc_url( ADVADS_URL ); ?>add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-pro" target="_blank"><?php esc_html_e( 'See all features and pricing', 'advanced-ads' ); ?></a>
14
  </div>
15
  <div class="advads-pro-pitch postbox">
16
- <?php require ADVADS_BASE_PATH . 'admin/views/pitches/all-access.php'; ?>
17
  </div>
18
  <div class="clear"></div>
13
  <a class="button button-primary" href="<?php echo esc_url( ADVADS_URL ); ?>add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-pro" target="_blank"><?php esc_html_e( 'See all features and pricing', 'advanced-ads' ); ?></a>
14
  </div>
15
  <div class="advads-pro-pitch postbox">
16
+ <?php require ADVADS_BASE_PATH . 'admin/views/upgrades/all-access.php'; ?>
17
  </div>
18
  <div class="clear"></div>
admin/views/{pitches → upgrades}/tracking.php RENAMED
File without changes
admin/views/upgrades/upgrade-link.php ADDED
@@ -0,0 +1 @@
 
1
+ <a href="<?php echo esc_url( $url ); ?>" target="_blank"><?php echo esc_html( $title ); ?></a>
advanced-ads.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
- * Version: 1.17.11
16
  * Author: Thomas Maier, Advanced Ads GmbH
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
@@ -39,7 +39,7 @@ define( 'ADVADS_BASE_DIR', dirname( ADVADS_BASE ) ); // directory of the plugin
39
  // general and global slug, e.g. to store options in WP.
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.17.11' );
43
 
44
  // Autoloading, modules and functions.
45
 
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.17.12-rc.1
16
  * Author: Thomas Maier, Advanced Ads GmbH
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
39
  // general and global slug, e.g. to store options in WP.
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
+ define( 'ADVADS_VERSION', '1.17.12-rc.1' );
43
 
44
  // Autoloading, modules and functions.
45
 
classes/ad.php CHANGED
@@ -188,7 +188,6 @@ class Advanced_Ads_Ad {
188
  } elseif ( function_exists( 'advads_sanitize_condition_' . $_type ) ) {
189
  // check for public function to sanitize this.
190
  add_filter( 'advanced-ads-sanitize-condition-' . $_type, 'advads_sanitize_condition_' . $_type, 10, 1 );
191
-
192
  }
193
  }
194
  }
@@ -402,7 +401,8 @@ class Advanced_Ads_Ad {
402
  );
403
 
404
  // prevent ad to show up through wp_head, if this is not a header placement.
405
- if ( doing_action( 'wp_head' ) && isset( $this->options['placement_type'] ) && 'header' !== $this->options['placement_type'] ) {
 
406
  return false;
407
  }
408
 
@@ -614,7 +614,6 @@ class Advanced_Ads_Ad {
614
  * Native filter for content field before being saved
615
  *
616
  * @return string $content ad content
617
- * @since 1.0.0
618
  */
619
  public function prepare_content_to_save() {
620
 
188
  } elseif ( function_exists( 'advads_sanitize_condition_' . $_type ) ) {
189
  // check for public function to sanitize this.
190
  add_filter( 'advanced-ads-sanitize-condition-' . $_type, 'advads_sanitize_condition_' . $_type, 10, 1 );
 
191
  }
192
  }
193
  }
401
  );
402
 
403
  // prevent ad to show up through wp_head, if this is not a header placement.
404
+ if ( doing_action( 'wp_head' ) && isset( $this->options['placement_type'] ) && 'header' !== $this->options['placement_type']
405
+ && ! Advanced_Ads_Compatibility::can_inject_during_wp_head() ) {
406
  return false;
407
  }
408
 
614
  * Native filter for content field before being saved
615
  *
616
  * @return string $content ad content
 
617
  */
618
  public function prepare_content_to_save() {
619
 
classes/compatibility.php CHANGED
@@ -184,4 +184,15 @@ class Advanced_Ads_Compatibility {
184
  return $shortcode;
185
  }
186
  }
 
 
 
 
 
 
 
 
 
 
 
187
  }
184
  return $shortcode;
185
  }
186
  }
187
+
188
+ /**
189
+ * Check if placements of type other than `header` can be injected during `wp_head` action.
190
+ */
191
+ public static function can_inject_during_wp_head() {
192
+ // the "Thrive Theme Builder" theme.
193
+ if ( did_action( 'before_theme_builder_template_render' ) && ! did_action( 'after_theme_builder_template_render' ) ) {
194
+ return true;
195
+ }
196
+ return false;
197
+ }
198
  }
languages/advanced-ads.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Advanced Ads plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Advanced Ads 1.17.11\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads-git\n"
7
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
8
  "Language-Team: webgilde <support@wpadvancedads.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-04-27T10:45:44+02:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: advanced-ads\n"
@@ -32,7 +32,7 @@ msgstr ""
32
  msgid "Thomas Maier, Advanced Ads GmbH"
33
  msgstr ""
34
 
35
- #: admin/class-advanced-ads-admin.php:215
36
  #: classes/display-conditions.php:290
37
  #: classes/visitor-conditions.php:311
38
  #: modules/gadsense/admin/views/external-ads-links.php:17
@@ -41,70 +41,70 @@ msgstr ""
41
  msgid "or"
42
  msgstr ""
43
 
44
- #: admin/class-advanced-ads-admin.php:216
45
  #: classes/display-conditions.php:290
46
  #: classes/visitor-conditions.php:311
47
  msgid "and"
48
  msgstr ""
49
 
50
- #: admin/class-advanced-ads-admin.php:217
51
  msgid "After which paragraph?"
52
  msgstr ""
53
 
54
- #: admin/class-advanced-ads-admin.php:219
55
  msgid "Today"
56
  msgstr ""
57
 
58
- #: admin/class-advanced-ads-admin.php:220
59
  msgid "Yesterday"
60
  msgstr ""
61
 
62
- #: admin/class-advanced-ads-admin.php:221
63
  msgid "This Month"
64
  msgstr ""
65
 
66
  #. translators: 1: The number of days.
67
- #: admin/class-advanced-ads-admin.php:223
68
  msgid "Last %1$d days"
69
  msgstr ""
70
 
71
- #: admin/class-advanced-ads-admin.php:226
72
  msgid "All"
73
  msgstr ""
74
 
75
- #: admin/class-advanced-ads-admin.php:227
76
  msgid "There were no results returned for this ad. Please make sure it is active, generating impressions and double check your ad parameters."
77
  msgstr ""
78
 
79
- #: admin/class-advanced-ads-admin.php:228
80
  #: modules/gadsense/admin/views/external-ads-list.php:33
81
  msgid "Show inactive ads"
82
  msgstr ""
83
 
84
- #: admin/class-advanced-ads-admin.php:229
85
  msgid "Hide inactive ads"
86
  msgstr ""
87
 
88
  #. translators: time zone name.
89
- #: admin/class-advanced-ads-admin.php:343
90
  msgid "time of %s"
91
  msgstr ""
92
 
93
- #: admin/class-advanced-ads-admin.php:414
94
  #: admin/includes/class-menu.php:156
95
  #: admin/includes/class-menu.php:159
96
  #: admin/views/settings.php:29
97
  msgid "Support"
98
  msgstr ""
99
 
100
- #: admin/class-advanced-ads-admin.php:418
101
  #: admin/includes/class-overview-widgets.php:71
102
  msgid "Add-Ons"
103
  msgstr ""
104
 
105
  #. translators: %s is the URL to add a new review, https://wordpress.org/support/plugin/advanced-ads/reviews/#new-post
106
  #. translators: %s is a URL.
107
- #: admin/class-advanced-ads-admin.php:689
108
  #: admin/includes/class-overview-widgets.php:194
109
  msgid "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a href=\"%s\" target=\"_blank\">wordpress.org</a>"
110
  msgstr ""
@@ -344,98 +344,124 @@ msgstr ""
344
  msgid "No ad group created"
345
  msgstr ""
346
 
347
- #: admin/includes/class-ad-type.php:261
348
- #: admin/includes/class-ad-type.php:267
349
  msgid "Ad Details"
350
  msgstr ""
351
 
352
- #: admin/includes/class-ad-type.php:262
353
- #: admin/includes/class-ad-type.php:268
354
  msgid "Ad Planning"
355
  msgstr ""
356
 
357
- #: admin/includes/class-ad-type.php:263
358
- #: admin/includes/class-ad-type.php:269
359
  msgid "Ad Shortcode"
360
  msgstr ""
361
 
362
  #. translators: %s is the number of ads.
363
- #: admin/includes/class-ad-type.php:431
364
  msgid "%s ad updated."
365
  msgid_plural "%s ads updated."
366
  msgstr[0] ""
367
  msgstr[1] ""
368
 
369
  #. translators: %s is the number of ads.
370
- #: admin/includes/class-ad-type.php:433
371
  msgid "%s ad not updated, somebody is editing it."
372
  msgid_plural "%s ads not updated, somebody is editing them."
373
  msgstr[0] ""
374
  msgstr[1] ""
375
 
376
  #. translators: %s is the number of ads.
377
- #: admin/includes/class-ad-type.php:435
378
  msgid "%s ad permanently deleted."
379
  msgid_plural "%s ads permanently deleted."
380
  msgstr[0] ""
381
  msgstr[1] ""
382
 
383
  #. translators: %s is the number of ads.
384
- #: admin/includes/class-ad-type.php:437
385
  msgid "%s ad moved to the Trash."
386
  msgid_plural "%s ads moved to the Trash."
387
  msgstr[0] ""
388
  msgstr[1] ""
389
 
390
  #. translators: %s is the number of ads.
391
- #: admin/includes/class-ad-type.php:439
392
  msgid "%s ad restored from the Trash."
393
  msgid_plural "%s ads restored from the Trash."
394
  msgstr[0] ""
395
  msgstr[1] ""
396
 
397
- #: admin/includes/class-ad-type.php:794
398
- #: admin/includes/class-ad-type.php:795
 
 
 
 
 
399
  msgid "Ad updated."
400
  msgstr ""
401
 
402
  #. translators: %s: date and time of the revision
403
- #: admin/includes/class-ad-type.php:796
404
  msgid "Ad restored to revision from %s"
405
  msgstr ""
406
 
407
- #: admin/includes/class-ad-type.php:797
408
- #: admin/includes/class-ad-type.php:798
409
  msgid "Ad saved."
410
  msgstr ""
411
 
412
- #: admin/includes/class-ad-type.php:799
413
  msgid "Ad submitted."
414
  msgstr ""
415
 
416
  #. translators: %1$s is a date.
417
- #: admin/includes/class-ad-type.php:802
418
  msgid "Ad scheduled for: <strong>%1$s</strong>."
419
  msgstr ""
420
 
421
  #. translators: Publish box date format, see http://php.net/date.
422
- #: admin/includes/class-ad-type.php:804
423
  msgid "M j, Y @ G:i"
424
  msgstr ""
425
 
426
- #: admin/includes/class-ad-type.php:806
427
  msgid "Ad draft updated."
428
  msgstr ""
429
 
430
- #: admin/includes/class-ad-type.php:862
431
  msgid "You don’t have access to ads. Please deactivate and re-enable Advanced Ads again to fix this."
432
  msgstr ""
433
 
434
- #: admin/includes/class-ad-type.php:863
435
  #: classes/frontend_checks.php:434
436
  msgid "Get help"
437
  msgstr ""
438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  #: admin/includes/class-licenses.php:90
440
  msgid "There might be a new version of %1$s. Please <strong>provide a valid license key</strong> in order to receive updates and support <a href=\"%2$s\">on this page</a>."
441
  msgstr ""
@@ -498,7 +524,7 @@ msgid "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why
498
  msgstr ""
499
 
500
  #: admin/includes/class-list-filters.php:142
501
- #: modules/gadsense/admin/admin.php:25
502
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:109
503
  msgid "Responsive"
504
  msgstr ""
@@ -607,13 +633,13 @@ msgid "Layout / Output"
607
  msgstr ""
608
 
609
  #: admin/includes/class-meta-box.php:104
610
- #: admin/views/placements.php:203
611
  #: classes/ad-debug.php:152
612
  msgid "Display Conditions"
613
  msgstr ""
614
 
615
  #: admin/includes/class-meta-box.php:112
616
- #: admin/views/placements.php:212
617
  #: classes/ad-debug.php:239
618
  msgid "Visitor Conditions"
619
  msgstr ""
@@ -646,34 +672,34 @@ msgstr ""
646
  msgid "Disable"
647
  msgstr ""
648
 
649
- #: admin/includes/class-meta-box.php:401
650
  msgid "Ad Settings"
651
  msgstr ""
652
 
653
- #: admin/includes/class-meta-box.php:500
654
  #: admin/views/overview.php:8
655
  msgid "Ads Dashboard"
656
  msgstr ""
657
 
658
  #. translators: %1$d is the number of ads, %2$s and %3$s are URLs.
659
- #: admin/includes/class-meta-box.php:516
660
  msgid "%1$d ads – <a href=\"%2$s\">manage</a> - <a href=\"%3$s\">new</a>"
661
  msgstr ""
662
 
663
- #: admin/includes/class-meta-box.php:529
664
  msgid "Get the tutorial via email"
665
  msgstr ""
666
 
667
- #: admin/includes/class-meta-box.php:538
668
  msgid "Get AdSense tips via email"
669
  msgstr ""
670
 
671
- #: admin/includes/class-meta-box.php:547
672
  msgid "Visit our blog for more articles about ad optimization"
673
  msgstr ""
674
 
675
  #. translators: %s is our URL.
676
- #: admin/includes/class-meta-box.php:601
677
  msgid "Latest posts on wpadvancedads.com"
678
  msgstr ""
679
 
@@ -770,7 +796,7 @@ msgid "The solution for professional websites."
770
  msgstr ""
771
 
772
  #: admin/includes/class-overview-widgets.php:471
773
- #: admin/views/pitches/pro-tab.php:7
774
  msgid "support for cached sites"
775
  msgstr ""
776
 
@@ -787,22 +813,22 @@ msgid "click fraud protection, lazy load, ad-block ads"
787
  msgstr ""
788
 
789
  #: admin/includes/class-overview-widgets.php:529
790
- #: admin/views/pitches/pro-tab.php:8
791
  msgid "11 more display and visitor conditions"
792
  msgstr ""
793
 
794
  #: admin/includes/class-overview-widgets.php:530
795
- #: admin/views/pitches/pro-tab.php:9
796
  msgid "6 more placements"
797
  msgstr ""
798
 
799
  #: admin/includes/class-overview-widgets.php:531
800
- #: admin/views/pitches/pro-tab.php:10
801
  msgid "placement tests for ad optimization"
802
  msgstr ""
803
 
804
  #: admin/includes/class-overview-widgets.php:532
805
- #: admin/views/pitches/pro-tab.php:11
806
  msgid "ad grids and many more advanced features"
807
  msgstr ""
808
 
@@ -814,10 +840,6 @@ msgstr ""
814
  msgid "Display ads based on the device or the size of your visitor’s browser, and control ads on AMP pages."
815
  msgstr ""
816
 
817
- #: admin/includes/class-overview-widgets.php:559
818
- msgid "A quick and error-free way of implementing ad units from your Google Ad Manager account."
819
- msgstr ""
820
-
821
  #: admin/includes/class-overview-widgets.php:565
822
  msgid "Target visitors with ads that match their geo location and make more money with regional campaigns."
823
  msgstr ""
@@ -965,7 +987,7 @@ msgid "Pro"
965
  msgstr ""
966
 
967
  #: admin/includes/class-settings.php:309
968
- #: admin/views/pitches/tracking.php:2
969
  msgid "Tracking"
970
  msgstr ""
971
 
@@ -1350,7 +1372,7 @@ msgstr ""
1350
  #: admin/views/placements-ad-label.php:9
1351
  #: admin/views/placements-ad-label.php:11
1352
  #: admin/views/placements.php:108
1353
- #: modules/gadsense/includes/class-network-adsense.php:239
1354
  msgid "default"
1355
  msgstr ""
1356
 
@@ -1428,11 +1450,11 @@ msgstr ""
1428
  msgid "Display the ad only once per page"
1429
  msgstr ""
1430
 
1431
- #: admin/views/ad-output-metabox.php:73
1432
  msgid "Custom Code"
1433
  msgstr ""
1434
 
1435
- #: admin/views/ad-output-metabox.php:76
1436
  msgid "Place your own code below the ad"
1437
  msgstr ""
1438
 
@@ -1745,129 +1767,6 @@ msgstr ""
1745
  msgid "Setting up AdSense ads manually"
1746
  msgstr ""
1747
 
1748
- #: admin/views/pitches/all-access.php:1
1749
- msgid "All Access – with all available add-ons"
1750
- msgstr ""
1751
-
1752
- #: admin/views/pitches/all-access.php:13
1753
- msgid "Risk free with 30-day Money-Back guarantee"
1754
- msgstr ""
1755
-
1756
- #: admin/views/pitches/all-access.php:14
1757
- msgid "Get All Access"
1758
- msgstr ""
1759
-
1760
- #: admin/views/pitches/pro-feature-link.php:1
1761
- msgid "Pro Feature"
1762
- msgstr ""
1763
-
1764
- #: admin/views/pitches/pro-placements.php:6
1765
- msgid "Random Paragraph"
1766
- msgstr ""
1767
-
1768
- #: admin/views/pitches/pro-placements.php:7
1769
- msgid "After a random paragraph in the main content."
1770
- msgstr ""
1771
-
1772
- #: admin/views/pitches/pro-placements.php:12
1773
- msgid "Above Headline"
1774
- msgstr ""
1775
-
1776
- #: admin/views/pitches/pro-placements.php:13
1777
- msgid "Above the main headline on the page (&lt;h1&gt;)."
1778
- msgstr ""
1779
-
1780
- #: admin/views/pitches/pro-placements.php:18
1781
- msgid "Content Middle"
1782
- msgstr ""
1783
-
1784
- #: admin/views/pitches/pro-placements.php:19
1785
- msgid "In the middle of the main content based on the number of paragraphs."
1786
- msgstr ""
1787
-
1788
- #: admin/views/pitches/pro-placements.php:24
1789
- #: admin/views/placement-injection-top.php:90
1790
- #: admin/views/placement-injection-top.php:94
1791
- msgid "Custom Position"
1792
- msgstr ""
1793
-
1794
- #: admin/views/pitches/pro-placements.php:25
1795
- msgid "Attach the ad to any element in the frontend."
1796
- msgstr ""
1797
-
1798
- #: admin/views/pitches/pro-placements.php:30
1799
- msgid "Post Lists"
1800
- msgstr ""
1801
-
1802
- #: admin/views/pitches/pro-placements.php:31
1803
- msgid "Display the ad between posts on post lists, e.g. home, archives, search etc."
1804
- msgstr ""
1805
-
1806
- #: admin/views/pitches/pro-placements.php:35
1807
- msgid "Background Ad"
1808
- msgstr ""
1809
-
1810
- #: admin/views/pitches/pro-placements.php:36
1811
- msgid "Background of the website behind the main wrapper."
1812
- msgstr ""
1813
-
1814
- #: admin/views/pitches/pro-placements.php:43
1815
- msgid "BuddyPress Content"
1816
- msgstr ""
1817
-
1818
- #: admin/views/pitches/pro-placements.php:44
1819
- msgid "Display ads on BuddyPress related pages."
1820
- msgstr ""
1821
-
1822
- #: admin/views/pitches/pro-placements.php:51
1823
- msgid "bbPress Content"
1824
- msgstr ""
1825
-
1826
- #: admin/views/pitches/pro-placements.php:52
1827
- msgid "Display ads in content created with bbPress."
1828
- msgstr ""
1829
-
1830
- #: admin/views/pitches/pro-tab.php:2
1831
- msgid "Advanced Ads Pro – test and optimize your ad performance"
1832
- msgstr ""
1833
-
1834
- #: admin/views/pitches/pro-tab.php:4
1835
- msgid "Ads for Ad Blockers"
1836
- msgstr ""
1837
-
1838
- #: admin/views/pitches/pro-tab.php:5
1839
- msgid "Click Fraud Protection"
1840
- msgstr ""
1841
-
1842
- #: admin/views/pitches/pro-tab.php:6
1843
- msgid "Lazy Loading"
1844
- msgstr ""
1845
-
1846
- #: admin/views/pitches/pro-tab.php:13
1847
- #: admin/views/pitches/tracking.php:10
1848
- msgid "See all features and pricing"
1849
- msgstr ""
1850
-
1851
- #: admin/views/pitches/tracking.php:4
1852
- msgid "track impressions and click on your ads"
1853
- msgstr ""
1854
-
1855
- #: admin/views/pitches/tracking.php:5
1856
- msgid "compare ads and periods"
1857
- msgstr ""
1858
-
1859
- #: admin/views/pitches/tracking.php:6
1860
- msgid "share reports via link or email"
1861
- msgstr ""
1862
-
1863
- #: admin/views/pitches/tracking.php:7
1864
- msgid "limit ads views by overall number of impressions or clicks"
1865
- msgstr ""
1866
-
1867
- #: admin/views/pitches/tracking.php:8
1868
- msgid "spread impressions or clicks equally over a given period"
1869
- msgstr ""
1870
-
1871
  #: admin/views/placement-form.php:15
1872
  msgid "Choose a placement type"
1873
  msgstr ""
@@ -1932,13 +1831,14 @@ msgid "Where do you want to display the ad?"
1932
  msgstr ""
1933
 
1934
  #. translators: %s is a URL.
 
1935
  #: admin/views/placement-injection-top.php:48
1936
- #: modules/gadsense/admin/admin.php:178
1937
  msgid "The AdSense verification and Auto ads code is already activated in the <a href=\"%s\">AdSense settings</a>."
1938
  msgstr ""
1939
 
1940
  #: admin/views/placement-injection-top.php:60
1941
- #: modules/gadsense/admin/admin.php:180
1942
  msgid "No need to add the code manually here, unless you want to include it into certain pages only."
1943
  msgstr ""
1944
 
@@ -1981,6 +1881,12 @@ msgstr ""
1981
  msgid "Header (Manual)"
1982
  msgstr ""
1983
 
 
 
 
 
 
 
1984
  #: admin/views/placement-injection-top.php:90
1985
  msgid "Show Pro Places"
1986
  msgstr ""
@@ -2058,12 +1964,12 @@ msgid "Placements updated"
2058
  msgstr ""
2059
 
2060
  #: admin/views/placements.php:22
2061
- #: admin/views/placements.php:291
2062
  msgid "Create a new placement"
2063
  msgstr ""
2064
 
2065
  #: admin/views/placements.php:23
2066
- #: admin/views/placements.php:293
2067
  msgid "New Placement"
2068
  msgstr ""
2069
 
@@ -2106,54 +2012,54 @@ msgstr ""
2106
  msgid "Important Notice"
2107
  msgstr ""
2108
 
2109
- #: admin/views/placements.php:194
2110
  msgid "ad label"
2111
  msgstr ""
2112
 
2113
- #: admin/views/placements.php:205
2114
  msgid "Use display conditions for placements."
2115
  msgstr ""
2116
 
2117
- #: admin/views/placements.php:206
2118
- #: admin/views/placements.php:215
2119
  msgid "The free version provides conditions on the ad edit page."
2120
  msgstr ""
2121
 
2122
- #: admin/views/placements.php:214
2123
  msgid "Use visitor conditions for placements."
2124
  msgstr ""
2125
 
2126
- #: admin/views/placements.php:221
2127
  msgid "Minimum Content Length"
2128
  msgstr ""
2129
 
2130
- #: admin/views/placements.php:223
2131
  msgid "Minimum length of content before automatically injected ads are allowed in them."
2132
  msgstr ""
2133
 
2134
- #: admin/views/placements.php:229
2135
  msgid "Words Between Ads"
2136
  msgstr ""
2137
 
2138
- #: admin/views/placements.php:231
2139
  msgid "A minimum amount of words between automatically injected ads."
2140
  msgstr ""
2141
 
2142
- #: admin/views/placements.php:241
2143
  msgid "show all options"
2144
  msgstr ""
2145
 
2146
  #. translators: %s is a URL.
2147
- #: admin/views/placements.php:262
2148
  msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
2149
  msgstr ""
2150
 
2151
- #: admin/views/placements.php:282
2152
  msgctxt "checkbox to remove placement"
2153
  msgid "delete"
2154
  msgstr ""
2155
 
2156
- #: admin/views/placements.php:289
2157
  msgid "Save Placements"
2158
  msgstr ""
2159
 
@@ -2399,6 +2305,123 @@ msgstr ""
2399
  msgid "Upgrade to any premium add-on and get <strong>priority email support</strong> or reach out through the <a href=\"%s\" target=\"_blank\">support forum</a> for individual help."
2400
  msgstr ""
2401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2402
  #: classes/ad-debug.php:32
2403
  msgid "The ad is displayed on the page"
2404
  msgstr ""
@@ -2987,7 +3010,7 @@ msgid "I want to change the position of the ads"
2987
  msgstr ""
2988
 
2989
  #: classes/frontend_checks.php:827
2990
- #: modules/gadsense/includes/class-network-adsense.php:202
2991
  msgid "Display Auto ads only on specific pages"
2992
  msgstr ""
2993
 
@@ -3263,23 +3286,22 @@ msgstr ""
3263
  msgid "Usually, this should be enabled on the main site of the network - often the one without a subdomain or subdirectory."
3264
  msgstr ""
3265
 
3266
- #: modules/gadsense/admin/admin.php:121
 
3267
  msgid "Responsive AdSense ads don’t work reliably with <em>Position</em> set to left or right. Either switch the <em>Type</em> to \"normal\" or follow <a href=\"%s\" target=\"_blank\">this tutorial</a> if you want the ad to be wrapped in text."
3268
  msgstr ""
3269
 
3270
- #: modules/gadsense/admin/admin.php:127
 
3271
  msgid "<a href=\"%s\" target=\"_blank\">Install the free AdSense In-feed add-on</a> in order to place ads between posts."
3272
  msgstr ""
3273
 
3274
- #: modules/gadsense/admin/admin.php:134
3275
- msgid "Use the <a href=\"%s\" target=\"_blank\">Responsive add-on</a> in order to define the exact size for each browser width or choose between horizontal, vertical, or rectangle formats."
3276
- msgstr ""
3277
-
3278
- #: modules/gadsense/admin/admin.php:182
3279
  msgid "The AdSense verification and Auto ads code should be set up in the <a href=\"%s\">AdSense settings</a>. Click on the following button to enable it now."
3280
  msgstr ""
3281
 
3282
- #: modules/gadsense/admin/admin.php:183
3283
  msgid "Activate"
3284
  msgstr ""
3285
 
@@ -3441,7 +3463,7 @@ msgid "This is not the correct confirmation code. %1$sPlease try again%2$s."
3441
  msgstr ""
3442
 
3443
  #: modules/gadsense/admin/views/connect-adsense.php:43
3444
- #: modules/gadsense/includes/class-network-adsense.php:194
3445
  msgid "Insert the AdSense header code used for verification and the Auto Ads feature."
3446
  msgstr ""
3447
 
@@ -3635,31 +3657,31 @@ msgid "An error occurred while requesting account details."
3635
  msgstr ""
3636
 
3637
  #: modules/gadsense/includes/class-mapi.php:1320
3638
- #: modules/gadsense/includes/class-network-adsense.php:384
3639
  msgctxt "AdSense ad type"
3640
  msgid "Matched Content"
3641
  msgstr ""
3642
 
3643
  #: modules/gadsense/includes/class-mapi.php:1323
3644
- #: modules/gadsense/includes/class-network-adsense.php:385
3645
  msgctxt "AdSense ad type"
3646
  msgid "In-article"
3647
  msgstr ""
3648
 
3649
  #: modules/gadsense/includes/class-mapi.php:1325
3650
- #: modules/gadsense/includes/class-network-adsense.php:386
3651
  msgctxt "AdSense ad type"
3652
  msgid "In-feed"
3653
  msgstr ""
3654
 
3655
  #: modules/gadsense/includes/class-mapi.php:1330
3656
- #: modules/gadsense/includes/class-network-adsense.php:387
3657
  msgctxt "AdSense ad type"
3658
  msgid "Display"
3659
  msgstr ""
3660
 
3661
  #: modules/gadsense/includes/class-mapi.php:1332
3662
- #: modules/gadsense/includes/class-network-adsense.php:388
3663
  msgctxt "AdSense ad type"
3664
  msgid "Link"
3665
  msgstr ""
@@ -3673,95 +3695,99 @@ msgstr ""
3673
  msgid "Please try to <a href=\"%1$s\" target=\"_blank\">reconnect to your %2$s account</a>."
3674
  msgstr ""
3675
 
3676
- #: modules/gadsense/includes/class-network-adsense.php:34
3677
  msgid "AdSense account"
3678
  msgstr ""
3679
 
3680
- #: modules/gadsense/includes/class-network-adsense.php:43
3681
  msgid "Verification code & Auto ads"
3682
  msgstr ""
3683
 
3684
- #: modules/gadsense/includes/class-network-adsense.php:54
3685
  msgid "Auto ads"
3686
  msgstr ""
3687
 
3688
- #: modules/gadsense/includes/class-network-adsense.php:54
3689
  msgid "Disable top anchor ad"
3690
  msgstr ""
3691
 
3692
- #: modules/gadsense/includes/class-network-adsense.php:64
3693
  msgid "Disable stats"
3694
  msgstr ""
3695
 
3696
- #: modules/gadsense/includes/class-network-adsense.php:76
3697
  msgid "Limit to 3 ads"
3698
  msgstr ""
3699
 
3700
- #: modules/gadsense/includes/class-network-adsense.php:86
3701
  msgid "Disable violation warnings"
3702
  msgstr ""
3703
 
3704
- #: modules/gadsense/includes/class-network-adsense.php:94
3705
  msgid "Transparent background"
3706
  msgstr ""
3707
 
3708
- #: modules/gadsense/includes/class-network-adsense.php:102
3709
  msgid "Full width responsive ads on mobile"
3710
  msgstr ""
3711
 
3712
- #: modules/gadsense/includes/class-network-adsense.php:146
 
3713
  msgid "Limit to %d AdSense ads"
3714
  msgstr ""
3715
 
3716
- #: modules/gadsense/includes/class-network-adsense.php:150
3717
  msgid "There is no explicit limit for AdSense ads anymore, but you can still use this setting to prevent too many AdSense ads to show accidentally on your site."
3718
  msgstr ""
3719
 
3720
- #: modules/gadsense/includes/class-network-adsense.php:154
3721
  msgid "Due to technical restrictions, the limit does not work on placements with cache-busting enabled."
3722
  msgstr ""
3723
 
3724
- #: modules/gadsense/includes/class-network-adsense.php:166
3725
  msgid "Enable this box if you don’t want Google Auto ads to place anchor ads at the top of your page."
3726
  msgstr ""
3727
 
3728
- #: modules/gadsense/includes/class-network-adsense.php:179
3729
  msgid "Enable this option to stop loading stats from AdSense into your WordPress backend."
3730
  msgstr ""
3731
 
3732
- #: modules/gadsense/includes/class-network-adsense.php:199
3733
  msgid "Adjust Auto ads options"
3734
  msgstr ""
3735
 
3736
- #: modules/gadsense/includes/class-network-adsense.php:201
 
3737
  msgid "Please read <a href=\"%s\" target=\"_blank\">this article</a> if <strong>ads appear in random places</strong>."
3738
  msgstr ""
3739
 
3740
- #: modules/gadsense/includes/class-network-adsense.php:203
3741
- msgid "Auto ads on AMP pages"
3742
  msgstr ""
3743
 
3744
- #: modules/gadsense/includes/class-network-adsense.php:216
3745
  msgid "Disable warnings about potential violations of the AdSense terms."
3746
  msgstr ""
3747
 
3748
- #: modules/gadsense/includes/class-network-adsense.php:217
 
3749
  msgid "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if AdSense is implemented correctly on your site. It also considers ads not managed with Advanced Ads. Enable this option to remove these checks"
3750
  msgstr ""
3751
 
3752
- #: modules/gadsense/includes/class-network-adsense.php:228
3753
  msgid "Enable this option in case your theme adds an unfortunate background color to AdSense ads."
3754
  msgstr ""
3755
 
3756
- #: modules/gadsense/includes/class-network-adsense.php:240
3757
  msgid "enable"
3758
  msgstr ""
3759
 
3760
- #: modules/gadsense/includes/class-network-adsense.php:241
3761
  msgid "disable"
3762
  msgstr ""
3763
 
3764
- #: modules/gadsense/includes/class-network-adsense.php:246
 
3765
  msgid "Whether your responsive ad unit may expand to <a href='%s' target='blank'>use the full width</a> of your visitor's mobile device screen"
3766
  msgstr ""
3767
 
2
  # This file is distributed under the same license as the Advanced Ads plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Advanced Ads 1.17.12-rc.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads-git\n"
7
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
8
  "Language-Team: webgilde <support@wpadvancedads.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-05-19T08:11:34+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: advanced-ads\n"
32
  msgid "Thomas Maier, Advanced Ads GmbH"
33
  msgstr ""
34
 
35
+ #: admin/class-advanced-ads-admin.php:216
36
  #: classes/display-conditions.php:290
37
  #: classes/visitor-conditions.php:311
38
  #: modules/gadsense/admin/views/external-ads-links.php:17
41
  msgid "or"
42
  msgstr ""
43
 
44
+ #: admin/class-advanced-ads-admin.php:217
45
  #: classes/display-conditions.php:290
46
  #: classes/visitor-conditions.php:311
47
  msgid "and"
48
  msgstr ""
49
 
50
+ #: admin/class-advanced-ads-admin.php:218
51
  msgid "After which paragraph?"
52
  msgstr ""
53
 
54
+ #: admin/class-advanced-ads-admin.php:220
55
  msgid "Today"
56
  msgstr ""
57
 
58
+ #: admin/class-advanced-ads-admin.php:221
59
  msgid "Yesterday"
60
  msgstr ""
61
 
62
+ #: admin/class-advanced-ads-admin.php:222
63
  msgid "This Month"
64
  msgstr ""
65
 
66
  #. translators: 1: The number of days.
67
+ #: admin/class-advanced-ads-admin.php:224
68
  msgid "Last %1$d days"
69
  msgstr ""
70
 
71
+ #: admin/class-advanced-ads-admin.php:227
72
  msgid "All"
73
  msgstr ""
74
 
75
+ #: admin/class-advanced-ads-admin.php:228
76
  msgid "There were no results returned for this ad. Please make sure it is active, generating impressions and double check your ad parameters."
77
  msgstr ""
78
 
79
+ #: admin/class-advanced-ads-admin.php:229
80
  #: modules/gadsense/admin/views/external-ads-list.php:33
81
  msgid "Show inactive ads"
82
  msgstr ""
83
 
84
+ #: admin/class-advanced-ads-admin.php:230
85
  msgid "Hide inactive ads"
86
  msgstr ""
87
 
88
  #. translators: time zone name.
89
+ #: admin/class-advanced-ads-admin.php:344
90
  msgid "time of %s"
91
  msgstr ""
92
 
93
+ #: admin/class-advanced-ads-admin.php:415
94
  #: admin/includes/class-menu.php:156
95
  #: admin/includes/class-menu.php:159
96
  #: admin/views/settings.php:29
97
  msgid "Support"
98
  msgstr ""
99
 
100
+ #: admin/class-advanced-ads-admin.php:419
101
  #: admin/includes/class-overview-widgets.php:71
102
  msgid "Add-Ons"
103
  msgstr ""
104
 
105
  #. translators: %s is the URL to add a new review, https://wordpress.org/support/plugin/advanced-ads/reviews/#new-post
106
  #. translators: %s is a URL.
107
+ #: admin/class-advanced-ads-admin.php:690
108
  #: admin/includes/class-overview-widgets.php:194
109
  msgid "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a href=\"%s\" target=\"_blank\">wordpress.org</a>"
110
  msgstr ""
344
  msgid "No ad group created"
345
  msgstr ""
346
 
347
+ #: admin/includes/class-ad-type.php:270
348
+ #: admin/includes/class-ad-type.php:276
349
  msgid "Ad Details"
350
  msgstr ""
351
 
352
+ #: admin/includes/class-ad-type.php:271
353
+ #: admin/includes/class-ad-type.php:277
354
  msgid "Ad Planning"
355
  msgstr ""
356
 
357
+ #: admin/includes/class-ad-type.php:272
358
+ #: admin/includes/class-ad-type.php:278
359
  msgid "Ad Shortcode"
360
  msgstr ""
361
 
362
  #. translators: %s is the number of ads.
363
+ #: admin/includes/class-ad-type.php:440
364
  msgid "%s ad updated."
365
  msgid_plural "%s ads updated."
366
  msgstr[0] ""
367
  msgstr[1] ""
368
 
369
  #. translators: %s is the number of ads.
370
+ #: admin/includes/class-ad-type.php:442
371
  msgid "%s ad not updated, somebody is editing it."
372
  msgid_plural "%s ads not updated, somebody is editing them."
373
  msgstr[0] ""
374
  msgstr[1] ""
375
 
376
  #. translators: %s is the number of ads.
377
+ #: admin/includes/class-ad-type.php:444
378
  msgid "%s ad permanently deleted."
379
  msgid_plural "%s ads permanently deleted."
380
  msgstr[0] ""
381
  msgstr[1] ""
382
 
383
  #. translators: %s is the number of ads.
384
+ #: admin/includes/class-ad-type.php:446
385
  msgid "%s ad moved to the Trash."
386
  msgid_plural "%s ads moved to the Trash."
387
  msgstr[0] ""
388
  msgstr[1] ""
389
 
390
  #. translators: %s is the number of ads.
391
+ #: admin/includes/class-ad-type.php:448
392
  msgid "%s ad restored from the Trash."
393
  msgid_plural "%s ads restored from the Trash."
394
  msgstr[0] ""
395
  msgstr[1] ""
396
 
397
+ #. Translators: %s is the time the ad was first saved.
398
+ #: admin/includes/class-ad-type.php:655
399
+ msgid "Ad created on %s"
400
+ msgstr ""
401
+
402
+ #: admin/includes/class-ad-type.php:833
403
+ #: admin/includes/class-ad-type.php:834
404
  msgid "Ad updated."
405
  msgstr ""
406
 
407
  #. translators: %s: date and time of the revision
408
+ #: admin/includes/class-ad-type.php:835
409
  msgid "Ad restored to revision from %s"
410
  msgstr ""
411
 
412
+ #: admin/includes/class-ad-type.php:836
413
+ #: admin/includes/class-ad-type.php:837
414
  msgid "Ad saved."
415
  msgstr ""
416
 
417
+ #: admin/includes/class-ad-type.php:838
418
  msgid "Ad submitted."
419
  msgstr ""
420
 
421
  #. translators: %1$s is a date.
422
+ #: admin/includes/class-ad-type.php:841
423
  msgid "Ad scheduled for: <strong>%1$s</strong>."
424
  msgstr ""
425
 
426
  #. translators: Publish box date format, see http://php.net/date.
427
+ #: admin/includes/class-ad-type.php:843
428
  msgid "M j, Y @ G:i"
429
  msgstr ""
430
 
431
+ #: admin/includes/class-ad-type.php:845
432
  msgid "Ad draft updated."
433
  msgstr ""
434
 
435
+ #: admin/includes/class-ad-type.php:901
436
  msgid "You don’t have access to ads. Please deactivate and re-enable Advanced Ads again to fix this."
437
  msgstr ""
438
 
439
+ #: admin/includes/class-ad-type.php:902
440
  #: classes/frontend_checks.php:434
441
  msgid "Get help"
442
  msgstr ""
443
 
444
+ #: admin/includes/class-admin-upgrades.php:33
445
+ msgid "Load ad units directly from your Google Ad Manager account"
446
+ msgstr ""
447
+
448
+ #: admin/includes/class-admin-upgrades.php:43
449
+ msgid "Ads that are visible on Accelerated Mobile Pages"
450
+ msgstr ""
451
+
452
+ #: admin/includes/class-admin-upgrades.php:60
453
+ msgid "Upgrade"
454
+ msgstr ""
455
+
456
+ #: admin/includes/class-admin-upgrades.php:80
457
+ msgid "Pro Feature"
458
+ msgstr ""
459
+
460
+ #: admin/includes/class-admin-upgrades.php:105
461
+ #: admin/includes/class-overview-widgets.php:559
462
+ msgid "A quick and error-free way of implementing ad units from your Google Ad Manager account."
463
+ msgstr ""
464
+
465
  #: admin/includes/class-licenses.php:90
466
  msgid "There might be a new version of %1$s. Please <strong>provide a valid license key</strong> in order to receive updates and support <a href=\"%2$s\">on this page</a>."
467
  msgstr ""
524
  msgstr ""
525
 
526
  #: admin/includes/class-list-filters.php:142
527
+ #: modules/gadsense/admin/admin.php:73
528
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:109
529
  msgid "Responsive"
530
  msgstr ""
633
  msgstr ""
634
 
635
  #: admin/includes/class-meta-box.php:104
636
+ #: admin/views/placements.php:208
637
  #: classes/ad-debug.php:152
638
  msgid "Display Conditions"
639
  msgstr ""
640
 
641
  #: admin/includes/class-meta-box.php:112
642
+ #: admin/views/placements.php:217
643
  #: classes/ad-debug.php:239
644
  msgid "Visitor Conditions"
645
  msgstr ""
672
  msgid "Disable"
673
  msgstr ""
674
 
675
+ #: admin/includes/class-meta-box.php:402
676
  msgid "Ad Settings"
677
  msgstr ""
678
 
679
+ #: admin/includes/class-meta-box.php:501
680
  #: admin/views/overview.php:8
681
  msgid "Ads Dashboard"
682
  msgstr ""
683
 
684
  #. translators: %1$d is the number of ads, %2$s and %3$s are URLs.
685
+ #: admin/includes/class-meta-box.php:517
686
  msgid "%1$d ads – <a href=\"%2$s\">manage</a> - <a href=\"%3$s\">new</a>"
687
  msgstr ""
688
 
689
+ #: admin/includes/class-meta-box.php:530
690
  msgid "Get the tutorial via email"
691
  msgstr ""
692
 
693
+ #: admin/includes/class-meta-box.php:539
694
  msgid "Get AdSense tips via email"
695
  msgstr ""
696
 
697
+ #: admin/includes/class-meta-box.php:548
698
  msgid "Visit our blog for more articles about ad optimization"
699
  msgstr ""
700
 
701
  #. translators: %s is our URL.
702
+ #: admin/includes/class-meta-box.php:602
703
  msgid "Latest posts on wpadvancedads.com"
704
  msgstr ""
705
 
796
  msgstr ""
797
 
798
  #: admin/includes/class-overview-widgets.php:471
799
+ #: admin/views/upgrades/pro-tab.php:7
800
  msgid "support for cached sites"
801
  msgstr ""
802
 
813
  msgstr ""
814
 
815
  #: admin/includes/class-overview-widgets.php:529
816
+ #: admin/views/upgrades/pro-tab.php:8
817
  msgid "11 more display and visitor conditions"
818
  msgstr ""
819
 
820
  #: admin/includes/class-overview-widgets.php:530
821
+ #: admin/views/upgrades/pro-tab.php:9
822
  msgid "6 more placements"
823
  msgstr ""
824
 
825
  #: admin/includes/class-overview-widgets.php:531
826
+ #: admin/views/upgrades/pro-tab.php:10
827
  msgid "placement tests for ad optimization"
828
  msgstr ""
829
 
830
  #: admin/includes/class-overview-widgets.php:532
831
+ #: admin/views/upgrades/pro-tab.php:11
832
  msgid "ad grids and many more advanced features"
833
  msgstr ""
834
 
840
  msgid "Display ads based on the device or the size of your visitor’s browser, and control ads on AMP pages."
841
  msgstr ""
842
 
 
 
 
 
843
  #: admin/includes/class-overview-widgets.php:565
844
  msgid "Target visitors with ads that match their geo location and make more money with regional campaigns."
845
  msgstr ""
987
  msgstr ""
988
 
989
  #: admin/includes/class-settings.php:309
990
+ #: admin/views/upgrades/tracking.php:2
991
  msgid "Tracking"
992
  msgstr ""
993
 
1372
  #: admin/views/placements-ad-label.php:9
1373
  #: admin/views/placements-ad-label.php:11
1374
  #: admin/views/placements.php:108
1375
+ #: modules/gadsense/includes/class-network-adsense.php:324
1376
  msgid "default"
1377
  msgstr ""
1378
 
1450
  msgid "Display the ad only once per page"
1451
  msgstr ""
1452
 
1453
+ #: admin/views/ad-output-metabox.php:77
1454
  msgid "Custom Code"
1455
  msgstr ""
1456
 
1457
+ #: admin/views/ad-output-metabox.php:80
1458
  msgid "Place your own code below the ad"
1459
  msgstr ""
1460
 
1767
  msgid "Setting up AdSense ads manually"
1768
  msgstr ""
1769
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1770
  #: admin/views/placement-form.php:15
1771
  msgid "Choose a placement type"
1772
  msgstr ""
1831
  msgstr ""
1832
 
1833
  #. translators: %s is a URL.
1834
+ #. Translators: %s is a URL.
1835
  #: admin/views/placement-injection-top.php:48
1836
+ #: modules/gadsense/admin/admin.php:237
1837
  msgid "The AdSense verification and Auto ads code is already activated in the <a href=\"%s\">AdSense settings</a>."
1838
  msgstr ""
1839
 
1840
  #: admin/views/placement-injection-top.php:60
1841
+ #: modules/gadsense/admin/admin.php:240
1842
  msgid "No need to add the code manually here, unless you want to include it into certain pages only."
1843
  msgstr ""
1844
 
1881
  msgid "Header (Manual)"
1882
  msgstr ""
1883
 
1884
+ #: admin/views/placement-injection-top.php:90
1885
+ #: admin/views/placement-injection-top.php:94
1886
+ #: admin/views/upgrades/pro-placements.php:24
1887
+ msgid "Custom Position"
1888
+ msgstr ""
1889
+
1890
  #: admin/views/placement-injection-top.php:90
1891
  msgid "Show Pro Places"
1892
  msgstr ""
1964
  msgstr ""
1965
 
1966
  #: admin/views/placements.php:22
1967
+ #: admin/views/placements.php:296
1968
  msgid "Create a new placement"
1969
  msgstr ""
1970
 
1971
  #: admin/views/placements.php:23
1972
+ #: admin/views/placements.php:298
1973
  msgid "New Placement"
1974
  msgstr ""
1975
 
2012
  msgid "Important Notice"
2013
  msgstr ""
2014
 
2015
+ #: admin/views/placements.php:197
2016
  msgid "ad label"
2017
  msgstr ""
2018
 
2019
+ #: admin/views/placements.php:210
2020
  msgid "Use display conditions for placements."
2021
  msgstr ""
2022
 
2023
+ #: admin/views/placements.php:211
2024
+ #: admin/views/placements.php:220
2025
  msgid "The free version provides conditions on the ad edit page."
2026
  msgstr ""
2027
 
2028
+ #: admin/views/placements.php:219
2029
  msgid "Use visitor conditions for placements."
2030
  msgstr ""
2031
 
2032
+ #: admin/views/placements.php:226
2033
  msgid "Minimum Content Length"
2034
  msgstr ""
2035
 
2036
+ #: admin/views/placements.php:228
2037
  msgid "Minimum length of content before automatically injected ads are allowed in them."
2038
  msgstr ""
2039
 
2040
+ #: admin/views/placements.php:234
2041
  msgid "Words Between Ads"
2042
  msgstr ""
2043
 
2044
+ #: admin/views/placements.php:236
2045
  msgid "A minimum amount of words between automatically injected ads."
2046
  msgstr ""
2047
 
2048
+ #: admin/views/placements.php:246
2049
  msgid "show all options"
2050
  msgstr ""
2051
 
2052
  #. translators: %s is a URL.
2053
+ #: admin/views/placements.php:267
2054
  msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
2055
  msgstr ""
2056
 
2057
+ #: admin/views/placements.php:287
2058
  msgctxt "checkbox to remove placement"
2059
  msgid "delete"
2060
  msgstr ""
2061
 
2062
+ #: admin/views/placements.php:294
2063
  msgid "Save Placements"
2064
  msgstr ""
2065
 
2305
  msgid "Upgrade to any premium add-on and get <strong>priority email support</strong> or reach out through the <a href=\"%s\" target=\"_blank\">support forum</a> for individual help."
2306
  msgstr ""
2307
 
2308
+ #: admin/views/upgrades/adsense-amp.php:3
2309
+ msgid "Automatically convert AdSense ads into their AMP format"
2310
+ msgstr ""
2311
+
2312
+ #: admin/views/upgrades/all-access.php:1
2313
+ msgid "All Access – with all available add-ons"
2314
+ msgstr ""
2315
+
2316
+ #: admin/views/upgrades/all-access.php:13
2317
+ msgid "Risk free with 30-day Money-Back guarantee"
2318
+ msgstr ""
2319
+
2320
+ #: admin/views/upgrades/all-access.php:14
2321
+ msgid "Get All Access"
2322
+ msgstr ""
2323
+
2324
+ #: admin/views/upgrades/pro-placements.php:6
2325
+ msgid "Random Paragraph"
2326
+ msgstr ""
2327
+
2328
+ #: admin/views/upgrades/pro-placements.php:7
2329
+ msgid "After a random paragraph in the main content."
2330
+ msgstr ""
2331
+
2332
+ #: admin/views/upgrades/pro-placements.php:12
2333
+ msgid "Above Headline"
2334
+ msgstr ""
2335
+
2336
+ #: admin/views/upgrades/pro-placements.php:13
2337
+ msgid "Above the main headline on the page (&lt;h1&gt;)."
2338
+ msgstr ""
2339
+
2340
+ #: admin/views/upgrades/pro-placements.php:18
2341
+ msgid "Content Middle"
2342
+ msgstr ""
2343
+
2344
+ #: admin/views/upgrades/pro-placements.php:19
2345
+ msgid "In the middle of the main content based on the number of paragraphs."
2346
+ msgstr ""
2347
+
2348
+ #: admin/views/upgrades/pro-placements.php:25
2349
+ msgid "Attach the ad to any element in the frontend."
2350
+ msgstr ""
2351
+
2352
+ #: admin/views/upgrades/pro-placements.php:30
2353
+ msgid "Post Lists"
2354
+ msgstr ""
2355
+
2356
+ #: admin/views/upgrades/pro-placements.php:31
2357
+ msgid "Display the ad between posts on post lists, e.g. home, archives, search etc."
2358
+ msgstr ""
2359
+
2360
+ #: admin/views/upgrades/pro-placements.php:35
2361
+ msgid "Background Ad"
2362
+ msgstr ""
2363
+
2364
+ #: admin/views/upgrades/pro-placements.php:36
2365
+ msgid "Background of the website behind the main wrapper."
2366
+ msgstr ""
2367
+
2368
+ #: admin/views/upgrades/pro-placements.php:43
2369
+ msgid "BuddyPress Content"
2370
+ msgstr ""
2371
+
2372
+ #: admin/views/upgrades/pro-placements.php:44
2373
+ msgid "Display ads on BuddyPress related pages."
2374
+ msgstr ""
2375
+
2376
+ #: admin/views/upgrades/pro-placements.php:51
2377
+ msgid "bbPress Content"
2378
+ msgstr ""
2379
+
2380
+ #: admin/views/upgrades/pro-placements.php:52
2381
+ msgid "Display ads in content created with bbPress."
2382
+ msgstr ""
2383
+
2384
+ #: admin/views/upgrades/pro-tab.php:2
2385
+ msgid "Advanced Ads Pro – test and optimize your ad performance"
2386
+ msgstr ""
2387
+
2388
+ #: admin/views/upgrades/pro-tab.php:4
2389
+ msgid "Ads for Ad Blockers"
2390
+ msgstr ""
2391
+
2392
+ #: admin/views/upgrades/pro-tab.php:5
2393
+ msgid "Click Fraud Protection"
2394
+ msgstr ""
2395
+
2396
+ #: admin/views/upgrades/pro-tab.php:6
2397
+ msgid "Lazy Loading"
2398
+ msgstr ""
2399
+
2400
+ #: admin/views/upgrades/pro-tab.php:13
2401
+ #: admin/views/upgrades/tracking.php:10
2402
+ msgid "See all features and pricing"
2403
+ msgstr ""
2404
+
2405
+ #: admin/views/upgrades/tracking.php:4
2406
+ msgid "track impressions and click on your ads"
2407
+ msgstr ""
2408
+
2409
+ #: admin/views/upgrades/tracking.php:5
2410
+ msgid "compare ads and periods"
2411
+ msgstr ""
2412
+
2413
+ #: admin/views/upgrades/tracking.php:6
2414
+ msgid "share reports via link or email"
2415
+ msgstr ""
2416
+
2417
+ #: admin/views/upgrades/tracking.php:7
2418
+ msgid "limit ads views by overall number of impressions or clicks"
2419
+ msgstr ""
2420
+
2421
+ #: admin/views/upgrades/tracking.php:8
2422
+ msgid "spread impressions or clicks equally over a given period"
2423
+ msgstr ""
2424
+
2425
  #: classes/ad-debug.php:32
2426
  msgid "The ad is displayed on the page"
2427
  msgstr ""
3010
  msgstr ""
3011
 
3012
  #: classes/frontend_checks.php:827
3013
+ #: modules/gadsense/includes/class-network-adsense.php:256
3014
  msgid "Display Auto ads only on specific pages"
3015
  msgstr ""
3016
 
3286
  msgid "Usually, this should be enabled on the main site of the network - often the one without a subdomain or subdirectory."
3287
  msgstr ""
3288
 
3289
+ #. Translators: %s is a URL.
3290
+ #: modules/gadsense/admin/admin.php:186
3291
  msgid "Responsive AdSense ads don’t work reliably with <em>Position</em> set to left or right. Either switch the <em>Type</em> to \"normal\" or follow <a href=\"%s\" target=\"_blank\">this tutorial</a> if you want the ad to be wrapped in text."
3292
  msgstr ""
3293
 
3294
+ #. Translators: %s is a URL.
3295
+ #: modules/gadsense/admin/admin.php:196
3296
  msgid "<a href=\"%s\" target=\"_blank\">Install the free AdSense In-feed add-on</a> in order to place ads between posts."
3297
  msgstr ""
3298
 
3299
+ #. Translators: %s is a URL.
3300
+ #: modules/gadsense/admin/admin.php:245
 
 
 
3301
  msgid "The AdSense verification and Auto ads code should be set up in the <a href=\"%s\">AdSense settings</a>. Click on the following button to enable it now."
3302
  msgstr ""
3303
 
3304
+ #: modules/gadsense/admin/admin.php:248
3305
  msgid "Activate"
3306
  msgstr ""
3307
 
3463
  msgstr ""
3464
 
3465
  #: modules/gadsense/admin/views/connect-adsense.php:43
3466
+ #: modules/gadsense/includes/class-network-adsense.php:224
3467
  msgid "Insert the AdSense header code used for verification and the Auto Ads feature."
3468
  msgstr ""
3469
 
3657
  msgstr ""
3658
 
3659
  #: modules/gadsense/includes/class-mapi.php:1320
3660
+ #: modules/gadsense/includes/class-network-adsense.php:515
3661
  msgctxt "AdSense ad type"
3662
  msgid "Matched Content"
3663
  msgstr ""
3664
 
3665
  #: modules/gadsense/includes/class-mapi.php:1323
3666
+ #: modules/gadsense/includes/class-network-adsense.php:516
3667
  msgctxt "AdSense ad type"
3668
  msgid "In-article"
3669
  msgstr ""
3670
 
3671
  #: modules/gadsense/includes/class-mapi.php:1325
3672
+ #: modules/gadsense/includes/class-network-adsense.php:517
3673
  msgctxt "AdSense ad type"
3674
  msgid "In-feed"
3675
  msgstr ""
3676
 
3677
  #: modules/gadsense/includes/class-mapi.php:1330
3678
+ #: modules/gadsense/includes/class-network-adsense.php:518
3679
  msgctxt "AdSense ad type"
3680
  msgid "Display"
3681
  msgstr ""
3682
 
3683
  #: modules/gadsense/includes/class-mapi.php:1332
3684
+ #: modules/gadsense/includes/class-network-adsense.php:519
3685
  msgctxt "AdSense ad type"
3686
  msgid "Link"
3687
  msgstr ""
3695
  msgid "Please try to <a href=\"%1$s\" target=\"_blank\">reconnect to your %2$s account</a>."
3696
  msgstr ""
3697
 
3698
+ #: modules/gadsense/includes/class-network-adsense.php:54
3699
  msgid "AdSense account"
3700
  msgstr ""
3701
 
3702
+ #: modules/gadsense/includes/class-network-adsense.php:63
3703
  msgid "Verification code & Auto ads"
3704
  msgstr ""
3705
 
3706
+ #: modules/gadsense/includes/class-network-adsense.php:74
3707
  msgid "Auto ads"
3708
  msgstr ""
3709
 
3710
+ #: modules/gadsense/includes/class-network-adsense.php:74
3711
  msgid "Disable top anchor ad"
3712
  msgstr ""
3713
 
3714
+ #: modules/gadsense/includes/class-network-adsense.php:84
3715
  msgid "Disable stats"
3716
  msgstr ""
3717
 
3718
+ #: modules/gadsense/includes/class-network-adsense.php:96
3719
  msgid "Limit to 3 ads"
3720
  msgstr ""
3721
 
3722
+ #: modules/gadsense/includes/class-network-adsense.php:106
3723
  msgid "Disable violation warnings"
3724
  msgstr ""
3725
 
3726
+ #: modules/gadsense/includes/class-network-adsense.php:114
3727
  msgid "Transparent background"
3728
  msgstr ""
3729
 
3730
+ #: modules/gadsense/includes/class-network-adsense.php:122
3731
  msgid "Full width responsive ads on mobile"
3732
  msgstr ""
3733
 
3734
+ #. Translators: $d a number of ads.
3735
+ #: modules/gadsense/includes/class-network-adsense.php:165
3736
  msgid "Limit to %d AdSense ads"
3737
  msgstr ""
3738
 
3739
+ #: modules/gadsense/includes/class-network-adsense.php:172
3740
  msgid "There is no explicit limit for AdSense ads anymore, but you can still use this setting to prevent too many AdSense ads to show accidentally on your site."
3741
  msgstr ""
3742
 
3743
+ #: modules/gadsense/includes/class-network-adsense.php:179
3744
  msgid "Due to technical restrictions, the limit does not work on placements with cache-busting enabled."
3745
  msgstr ""
3746
 
3747
+ #: modules/gadsense/includes/class-network-adsense.php:193
3748
  msgid "Enable this box if you don’t want Google Auto ads to place anchor ads at the top of your page."
3749
  msgstr ""
3750
 
3751
+ #: modules/gadsense/includes/class-network-adsense.php:207
3752
  msgid "Enable this option to stop loading stats from AdSense into your WordPress backend."
3753
  msgstr ""
3754
 
3755
+ #: modules/gadsense/includes/class-network-adsense.php:232
3756
  msgid "Adjust Auto ads options"
3757
  msgstr ""
3758
 
3759
+ #. Translators: %s is a URL.
3760
+ #: modules/gadsense/includes/class-network-adsense.php:243
3761
  msgid "Please read <a href=\"%s\" target=\"_blank\">this article</a> if <strong>ads appear in random places</strong>."
3762
  msgstr ""
3763
 
3764
+ #: modules/gadsense/includes/class-network-adsense.php:261
3765
+ msgid "Enable AMP Auto ads"
3766
  msgstr ""
3767
 
3768
+ #: modules/gadsense/includes/class-network-adsense.php:282
3769
  msgid "Disable warnings about potential violations of the AdSense terms."
3770
  msgstr ""
3771
 
3772
+ #. Translators: %s is a URL.
3773
+ #: modules/gadsense/includes/class-network-adsense.php:288
3774
  msgid "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if AdSense is implemented correctly on your site. It also considers ads not managed with Advanced Ads. Enable this option to remove these checks"
3775
  msgstr ""
3776
 
3777
+ #: modules/gadsense/includes/class-network-adsense.php:312
3778
  msgid "Enable this option in case your theme adds an unfortunate background color to AdSense ads."
3779
  msgstr ""
3780
 
3781
+ #: modules/gadsense/includes/class-network-adsense.php:325
3782
  msgid "enable"
3783
  msgstr ""
3784
 
3785
+ #: modules/gadsense/includes/class-network-adsense.php:326
3786
  msgid "disable"
3787
  msgstr ""
3788
 
3789
+ #. Translators: %s is a URL.
3790
+ #: modules/gadsense/includes/class-network-adsense.php:333
3791
  msgid "Whether your responsive ad unit may expand to <a href='%s' target='blank'>use the full width</a> of your visitor's mobile device screen"
3792
  msgstr ""
3793
 
lib/composer/autoload_classmap.php CHANGED
@@ -31,6 +31,7 @@ return array(
31
  'Advanced_Ads_Admin_Notices' => $baseDir . '/admin/includes/class-notices.php',
32
  'Advanced_Ads_Admin_Options' => $baseDir . '/admin/includes/class-options.php',
33
  'Advanced_Ads_Admin_Settings' => $baseDir . '/admin/includes/class-settings.php',
 
34
  'Advanced_Ads_Ajax' => $baseDir . '/classes/ad-ajax.php',
35
  'Advanced_Ads_Checks' => $baseDir . '/classes/checks.php',
36
  'Advanced_Ads_Compatibility' => $baseDir . '/classes/compatibility.php',
31
  'Advanced_Ads_Admin_Notices' => $baseDir . '/admin/includes/class-notices.php',
32
  'Advanced_Ads_Admin_Options' => $baseDir . '/admin/includes/class-options.php',
33
  'Advanced_Ads_Admin_Settings' => $baseDir . '/admin/includes/class-settings.php',
34
+ 'Advanced_Ads_Admin_Upgrades' => $baseDir . '/admin/includes/class-admin-upgrades.php',
35
  'Advanced_Ads_Ajax' => $baseDir . '/classes/ad-ajax.php',
36
  'Advanced_Ads_Checks' => $baseDir . '/classes/checks.php',
37
  'Advanced_Ads_Compatibility' => $baseDir . '/classes/compatibility.php',
lib/composer/autoload_real.php CHANGED
@@ -13,9 +13,6 @@ class ComposerAutoloaderInit_advanced_ads
13
  }
14
  }
15
 
16
- /**
17
- * @return \AdvancedAds\Autoload\ClassLoader
18
- */
19
  public static function getLoader()
20
  {
21
  if (null !== self::$loader) {
13
  }
14
  }
15
 
 
 
 
16
  public static function getLoader()
17
  {
18
  if (null !== self::$loader) {
lib/composer/autoload_static.php CHANGED
@@ -32,6 +32,7 @@ class ComposerStaticInit_advanced_ads
32
  'Advanced_Ads_Admin_Notices' => __DIR__ . '/../..' . '/admin/includes/class-notices.php',
33
  'Advanced_Ads_Admin_Options' => __DIR__ . '/../..' . '/admin/includes/class-options.php',
34
  'Advanced_Ads_Admin_Settings' => __DIR__ . '/../..' . '/admin/includes/class-settings.php',
 
35
  'Advanced_Ads_Ajax' => __DIR__ . '/../..' . '/classes/ad-ajax.php',
36
  'Advanced_Ads_Checks' => __DIR__ . '/../..' . '/classes/checks.php',
37
  'Advanced_Ads_Compatibility' => __DIR__ . '/../..' . '/classes/compatibility.php',
32
  'Advanced_Ads_Admin_Notices' => __DIR__ . '/../..' . '/admin/includes/class-notices.php',
33
  'Advanced_Ads_Admin_Options' => __DIR__ . '/../..' . '/admin/includes/class-options.php',
34
  'Advanced_Ads_Admin_Settings' => __DIR__ . '/../..' . '/admin/includes/class-settings.php',
35
+ 'Advanced_Ads_Admin_Upgrades' => __DIR__ . '/../..' . '/admin/includes/class-admin-upgrades.php',
36
  'Advanced_Ads_Ajax' => __DIR__ . '/../..' . '/classes/ad-ajax.php',
37
  'Advanced_Ads_Checks' => __DIR__ . '/../..' . '/classes/checks.php',
38
  'Advanced_Ads_Compatibility' => __DIR__ . '/../..' . '/classes/compatibility.php',
modules/gadsense/admin/admin.php CHANGED
@@ -1,204 +1,270 @@
1
  <?php
2
 
 
 
 
3
  class Advanced_Ads_AdSense_Admin {
4
 
 
 
 
 
 
5
  private $data;
 
 
 
 
 
 
 
6
  private $nonce;
 
 
 
 
 
 
7
  private static $instance = null;
 
 
 
 
 
 
 
8
  protected $notice = null;
9
- private $settings_page_hook = 'advanced-ads-adsense-settings-page';
10
-
11
- const ADSENSE_NEW_ACCOUNT_LINK = 'https://www.google.com/adsense/start/?utm_source=AdvancedAdsPlugIn&utm_medium=partnerships&utm_campaign=AdvancedAdsPartner1';
12
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  private function __construct() {
14
  $this->data = Advanced_Ads_AdSense_Data::get_instance();
15
 
16
- add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts') );
17
- add_action( 'admin_print_scripts', array($this, 'print_scripts') );
18
- add_filter( 'advanced-ads-list-ad-size', array($this, 'ad_details_column'), 10, 2 );
19
- add_filter( 'advanced-ads-ad-notices', array($this, 'ad_notices'), 10, 3 );
20
  }
21
 
22
- public function ad_details_column($size, $the_ad) {
23
- if ( 'adsense' == $the_ad->type ) {
 
 
 
 
 
 
 
 
24
  $content = json_decode( $the_ad->content );
25
- if ( $content && 'responsive' == $content->unitType ) { $size = __( 'Responsive', 'advanced-ads' ); }
 
 
 
26
  }
27
  return $size;
28
  }
29
 
 
 
 
30
  public function print_scripts() {
31
  global $pagenow, $post_type;
32
  if (
33
- ('post-new.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type) ||
34
- ('post.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type && isset($_GET['action']) && 'edit' == $_GET['action'])
35
  ) {
36
- $db = Advanced_Ads_AdSense_Data::get_instance();
37
  $pub_id = $db->get_adsense_id();
38
  ?>
39
  <script type="text/javascript">
40
  if ( 'undefined' == typeof gadsenseData ) {
41
- window.gadsenseData = {};
42
- }
43
- gadsenseData['pagenow'] = '<?php echo $pagenow ?>';
 
44
  </script>
45
  <?php
46
  }
47
  }
48
 
 
 
 
49
  public function enqueue_scripts() {
50
  global $gadsense_globals, $pagenow, $post_type;
51
  $screen = get_current_screen();
52
  $plugin = Advanced_Ads_Admin::get_instance();
53
-
54
- if ( Advanced_Ads_Admin::screen_belongs_to_advanced_ads() ) {
55
- self::enqueue_connect_adsense();
56
- }
57
  if (
58
- ('post-new.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type) ||
59
- ('post.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type && isset($_GET['action']) && 'edit' == $_GET['action'])
60
  ) {
61
  $scripts = array();
62
 
63
- // Allow modifications of script files to enqueue
64
  $scripts = apply_filters( 'advanced-ads-gadsense-ad-param-script', $scripts );
65
 
66
  foreach ( $scripts as $handle => $value ) {
67
- if ( empty($handle) ) {
68
  continue;
69
  }
70
- if ( ! empty($handle) && empty($value) ) {
71
- // Allow inclusion of WordPress's built-in script like jQuery
72
  wp_enqueue_script( $handle );
73
  } else {
74
- if ( ! isset($value['version']) ) { $value['version'] = null; }
 
75
  wp_enqueue_script( $handle, $value['path'], $value['dep'], $value['version'] );
76
  }
77
  }
78
 
79
  $styles = array();
80
 
81
- // Allow modifications of default style files to enqueue
82
  $styles = apply_filters( 'advanced-ads-gadsense-ad-param-style', $styles );
83
 
84
  foreach ( $styles as $handle => $value ) {
85
- if ( ! isset($value['path']) ||
86
- ! isset($value['dep']) ||
87
- empty($handle)
88
  ) {
89
  continue;
90
  }
91
- if ( ! isset($value['version']) ) {
92
  $value['version'] = null; }
93
  wp_enqueue_style( $handle, $value['path'], $value['dep'], $value['version'] );
94
  }
95
  }
96
  }
97
 
 
 
 
 
 
98
  public static function get_instance() {
99
  if ( null == self::$instance ) {
100
- self::$instance = new self;
101
  }
102
  return self::$instance;
103
  }
104
-
105
  /**
106
- * show AdSense ad specific notices in parameters box
107
- *
108
- * @since 1.7.22
 
 
109
  */
110
- public function ad_notices( $notices, $box, $post ){
111
-
112
- $ad = new Advanced_Ads_Ad( $post->ID );
113
-
114
- // $content = json_decode( stripslashes( $ad->content ) );
115
-
116
- switch ($box['id']){
117
- case 'ad-parameters-box' :
118
- // add warning if this is a responsive ad unit without custom sizes and position is set to left or right
119
- // hidden by default and made visible with JS
120
- $notices[] = array(
121
- 'text' => sprintf(__( 'Responsive AdSense ads don’t work reliably with <em>Position</em> set to left or right. Either switch the <em>Type</em> to "normal" or follow <a href="%s" target="_blank">this tutorial</a> if you want the ad to be wrapped in text.', 'advanced-ads' ), ADVADS_URL . 'adsense-responsive-custom-sizes/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-custom-sizes-tutorial' ),
122
- 'class' => 'advads-ad-notice-responsive-position error hidden',
123
- );
124
- // show hint about AdSense In-feed add-on
125
- if( ! class_exists( 'Advanced_Ads_In_Feed', false ) ){
126
  $notices[] = array(
127
- 'text' => sprintf(__( '<a href="%s" target="_blank">Install the free AdSense In-feed add-on</a> in order to place ads between posts.', 'advanced-ads' ), wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'advanced-ads-adsense-in-feed'), 'install-plugin_' . 'advanced-ads-adsense-in-feed') ),
128
- 'class' => 'advads-ad-notice-in-feed-add-on hidden',
 
 
 
 
129
  );
130
- }
131
- // show message about Responsive add-on
132
- if ( ! defined( 'AAR_SLUG' ) ) {
133
- $notices[] = array(
134
- 'text' => sprintf( __( 'Use the <a href="%s" target="_blank">Responsive add-on</a> in order to define the exact size for each browser width or choose between horizontal, vertical, or rectangle formats.', 'advanced-ads' ), ADVADS_URL . 'add-ons/responsive-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-adsense' ),
135
- 'class' => 'advads-ad-notice-responsive-add-on',
136
- );
137
- }
138
-
139
- // show hint about Content ad, Link unit or Matched content being defined in AdSense account
140
- // disabled since it might no longer be needed with the new ad types
141
- /* if( 'adsense' === $ad->type ){
142
- $notices[] = array(
143
- 'text' => sprintf( __( 'The type of your AdSense ad unit (content unit, link unit or matched content) needs to be defined in <a href="%s" target="_blank">your AdSense account</a>.', 'advanced-ads' ), 'https://www.google.com/adsense' ),
144
- 'class' => 'advads-ad-notice-adsense-ad-unit-type',
145
- );
146
- }*/
147
- break;
148
- }
149
-
150
-
151
- return $notices;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  }
153
 
154
- /**
155
- * Enqueue AdSense connection script.
156
- */
157
- public static function enqueue_connect_adsense() {
158
- if ( ! wp_script_is( 'advads/connect-adsense', $list = 'registered' ) ) {
159
- wp_enqueue_script( 'advads/connect-adsense', GADSENSE_BASE_URL . 'admin/assets/js/connect-adsense.js', array( 'jquery' ), '0.8' );
160
- }
161
- if ( ! has_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) ) ) {
162
- add_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) );
163
- }
164
- }
165
-
166
- /**
167
- * Prints AdSense connection markup.
168
- */
169
- public static function print_connect_adsense() {
170
- require_once GADSENSE_BASE_PATH . 'admin/views/connect-adsense.php';
171
- }
172
-
173
  /**
174
  * Get Auto Ads messages.
175
  */
176
  public static function get_auto_ads_messages() {
177
  return array(
178
- 'enabled' => sprintf(__( 'The AdSense verification and Auto ads code is already activated in the <a href="%s">AdSense settings</a>.', 'advanced-ads' ),
179
- admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) )
180
- . ' ' . __( 'No need to add the code manually here, unless you want to include it into certain pages only.', 'advanced-ads' ),
181
- 'disabled' => sprintf( '%s <button id="adsense_enable_pla" type="button" class="button">%s</button>',
182
- sprintf ( __( 'The AdSense verification and Auto ads code should be set up in the <a href="%s">AdSense settings</a>. Click on the following button to enable it now.', 'advanced-ads' ), admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ),
183
- esc_attr__( 'Activate', 'advanced-ads' ) )
 
 
 
 
 
 
 
 
 
184
  );
185
  }
186
 
187
- /**
188
- * Get the ad selecto markup
189
- *
190
- * @param type $hide_idle Whether to hide idle ads.
191
- */
192
- public static function get_mapi_ad_selector( $hide_idle_ads = true ) {
193
- global $closeable, $use_dashicons, $network, $ad_units, $display_slot_id;
194
- $closeable = true;
195
- $use_dashicons = false;
196
- $network = Advanced_Ads_Network_Adsense::get_instance();
197
- $ad_units = $network->get_external_ad_units();
198
- $display_slot_id = true;
199
- $pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
200
-
201
- require_once GADSENSE_BASE_PATH . 'admin/views/external-ads-list.php';
202
- // require_once GADSENSE_BASE_PATH . 'admin/views/external-ads-adsense.php';
203
- }
204
  }
1
  <?php
2
 
3
+ /**
4
+ * Class Advanced_Ads_AdSense_Admin
5
+ */
6
  class Advanced_Ads_AdSense_Admin {
7
 
8
+ /**
9
+ * AdSense options.
10
+ *
11
+ * @var Advanced_Ads_AdSense_Data
12
+ */
13
  private $data;
14
+
15
+ /**
16
+ * Noncetodo: check if this is still used
17
+ * todo: check if this is still used
18
+ *
19
+ * @var string $nonce
20
+ */
21
  private $nonce;
22
+
23
+ /**
24
+ * Instance of Advanced_Ads_AdSense_Admin
25
+ *
26
+ * @var null
27
+ */
28
  private static $instance = null;
29
+
30
+ /**
31
+ * Notices
32
+ * todo: still used?
33
+ *
34
+ * @var null
35
+ */
36
  protected $notice = null;
 
 
 
37
 
38
+ /**
39
+ * Settings page hook
40
+ *
41
+ * @var string
42
+ */
43
+ private $settings_page_hook = 'advanced-ads-adsense-settings-page';
44
+
45
+ const ADSENSE_NEW_ACCOUNT_LINK = 'https://www.google.com/adsense/start/?utm_source=AdvancedAdsPlugIn&utm_medium=partnerships&utm_campaign=AdvancedAdsPartner1';
46
+
47
+ /**
48
+ * Advanced_Ads_AdSense_Admin constructor.
49
+ */
50
  private function __construct() {
51
  $this->data = Advanced_Ads_AdSense_Data::get_instance();
52
 
53
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
54
+ add_action( 'admin_print_scripts', array( $this, 'print_scripts' ) );
55
+ add_filter( 'advanced-ads-list-ad-size', array( $this, 'ad_details_column' ), 10, 2 );
56
+ add_filter( 'advanced-ads-ad-notices', array( $this, 'ad_notices' ), 10, 3 );
57
  }
58
 
59
+ /**
60
+ * Add content to ad details column on ad overview list.
61
+ *
62
+ * @param string $size size string.
63
+ * @param Advanced_Ads_Ad $the_ad ad object.
64
+ *
65
+ * @return string|void
66
+ */
67
+ public function ad_details_column( $size, $the_ad ) {
68
+ if ( 'adsense' === $the_ad->type ) {
69
  $content = json_decode( $the_ad->content );
70
+
71
+ //phpcs:ignore
72
+ if ( $content && 'responsive' === $content->unitType ) {
73
+ $size = __( 'Responsive', 'advanced-ads' ); }
74
  }
75
  return $size;
76
  }
77
 
78
+ /**
79
+ * Load JavaScript needed on some pages.
80
+ */
81
  public function print_scripts() {
82
  global $pagenow, $post_type;
83
  if (
84
+ ( 'post-new.php' === $pagenow && Advanced_Ads::POST_TYPE_SLUG === $post_type ) ||
85
+ ( 'post.php' === $pagenow && Advanced_Ads::POST_TYPE_SLUG === $post_type && isset( $_GET['action'] ) && 'edit' === $_GET['action'] )
86
  ) {
87
+ $db = Advanced_Ads_AdSense_Data::get_instance();
88
  $pub_id = $db->get_adsense_id();
89
  ?>
90
  <script type="text/javascript">
91
  if ( 'undefined' == typeof gadsenseData ) {
92
+ window.gadsenseData = {};
93
+ }
94
+ // todo: check why we are using echo here.
95
+ gadsenseData['pagenow'] = '<?php echo esc_attr( $pagenow ); ?>';
96
  </script>
97
  <?php
98
  }
99
  }
100
 
101
+ /**
102
+ * Add AdSense-related scripts.
103
+ */
104
  public function enqueue_scripts() {
105
  global $gadsense_globals, $pagenow, $post_type;
106
  $screen = get_current_screen();
107
  $plugin = Advanced_Ads_Admin::get_instance();
108
+
109
+ if ( Advanced_Ads_Admin::screen_belongs_to_advanced_ads() ) {
110
+ self::enqueue_connect_adsense();
111
+ }
112
  if (
113
+ ( 'post-new.php' === $pagenow && Advanced_Ads::POST_TYPE_SLUG === $post_type ) ||
114
+ ( 'post.php' === $pagenow && Advanced_Ads::POST_TYPE_SLUG === $post_type && isset( $_GET['action'] ) && 'edit' === $_GET['action'] )
115
  ) {
116
  $scripts = array();
117
 
118
+ // Allow modifications of script files to enqueue.
119
  $scripts = apply_filters( 'advanced-ads-gadsense-ad-param-script', $scripts );
120
 
121
  foreach ( $scripts as $handle => $value ) {
122
+ if ( empty( $handle ) ) {
123
  continue;
124
  }
125
+ if ( ! empty( $handle ) && empty( $value ) ) {
126
+ // Allow inclusion of WordPress's built-in script like jQuery.
127
  wp_enqueue_script( $handle );
128
  } else {
129
+ if ( ! isset( $value['version'] ) ) {
130
+ $value['version'] = null; }
131
  wp_enqueue_script( $handle, $value['path'], $value['dep'], $value['version'] );
132
  }
133
  }
134
 
135
  $styles = array();
136
 
137
+ // Allow modifications of default style files to enqueue.
138
  $styles = apply_filters( 'advanced-ads-gadsense-ad-param-style', $styles );
139
 
140
  foreach ( $styles as $handle => $value ) {
141
+ if ( ! isset( $value['path'] ) ||
142
+ ! isset( $value['dep'] ) ||
143
+ empty( $handle )
144
  ) {
145
  continue;
146
  }
147
+ if ( ! isset( $value['version'] ) ) {
148
  $value['version'] = null; }
149
  wp_enqueue_style( $handle, $value['path'], $value['dep'], $value['version'] );
150
  }
151
  }
152
  }
153
 
154
+ /**
155
+ * Get instance of Advanced_Ads_AdSense_Admin.
156
+ *
157
+ * @return Advanced_Ads_AdSense_Admin|null
158
+ */
159
  public static function get_instance() {
160
  if ( null == self::$instance ) {
161
+ self::$instance = new self();
162
  }
163
  return self::$instance;
164
  }
165
+
166
  /**
167
+ * Show AdSense ad specific notices in parameters box
168
+ *
169
+ * @param array $notices some notices to show in the parameters box.
170
+ * @param string $box ID of the meta box.
171
+ * @param WP_Post $post post object.
172
  */
173
+ public function ad_notices( $notices, $box, $post ) {
174
+
175
+ $ad = new Advanced_Ads_Ad( $post->ID );
176
+
177
+ // $content = json_decode( stripslashes( $ad->content ) );
178
+
179
+ switch ( $box['id'] ) {
180
+ case 'ad-parameters-box':
181
+ // Add warning if this is a responsive ad unit without custom sizes and position is set to left or right.
182
+ // Hidden by default and made visible with JS.
 
 
 
 
 
 
183
  $notices[] = array(
184
+ 'text' => sprintf(
185
+ // Translators: %s is a URL.
186
+ __( 'Responsive AdSense ads don’t work reliably with <em>Position</em> set to left or right. Either switch the <em>Type</em> to "normal" or follow <a href="%s" target="_blank">this tutorial</a> if you want the ad to be wrapped in text.', 'advanced-ads' ),
187
+ ADVADS_URL . 'adsense-responsive-custom-sizes/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-custom-sizes-tutorial'
188
+ ),
189
+ 'class' => 'advads-ad-notice-responsive-position error hidden',
190
  );
191
+ // Show hint about AdSense In-feed add-on.
192
+ if ( ! class_exists( 'Advanced_Ads_In_Feed', false ) ) {
193
+ $notices[] = array(
194
+ 'text' => sprintf(
195
+ // Translators: %s is a URL.
196
+ __( '<a href="%s" target="_blank">Install the free AdSense In-feed add-on</a> in order to place ads between posts.', 'advanced-ads' ),
197
+ wp_nonce_url(
198
+ self_admin_url( 'update.php?action=install-plugin&plugin=advanced-ads-adsense-in-feed' ),
199
+ 'install-plugin_advanced-ads-adsense-in-feed'
200
+ )
201
+ ),
202
+ 'class' => 'advads-ad-notice-in-feed-add-on hidden',
203
+ );
204
+ }
205
+ break;
206
+ }
207
+
208
+ return $notices;
209
+ }
210
+
211
+ /**
212
+ * Enqueue AdSense connection script.
213
+ */
214
+ public static function enqueue_connect_adsense() {
215
+ if ( ! wp_script_is( 'advads/connect-adsense', 'registered' ) ) {
216
+ wp_enqueue_script( 'advads/connect-adsense', GADSENSE_BASE_URL . 'admin/assets/js/connect-adsense.js', array( 'jquery' ), '0.8' );
217
+ }
218
+ if ( ! has_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) ) ) {
219
+ add_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) );
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Prints AdSense connection markup.
225
+ */
226
+ public static function print_connect_adsense() {
227
+ require_once GADSENSE_BASE_PATH . 'admin/views/connect-adsense.php';
228
  }
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  /**
231
  * Get Auto Ads messages.
232
  */
233
  public static function get_auto_ads_messages() {
234
  return array(
235
+ 'enabled' => sprintf(
236
+ // Translators: %s is a URL.
237
+ __( 'The AdSense verification and Auto ads code is already activated in the <a href="%s">AdSense settings</a>.', 'advanced-ads' ),
238
+ admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' )
239
+ )
240
+ . ' ' . __( 'No need to add the code manually here, unless you want to include it into certain pages only.', 'advanced-ads' ),
241
+ 'disabled' => sprintf(
242
+ '%s <button id="adsense_enable_pla" type="button" class="button">%s</button>',
243
+ sprintf(
244
+ // Translators: %s is a URL.
245
+ __( 'The AdSense verification and Auto ads code should be set up in the <a href="%s">AdSense settings</a>. Click on the following button to enable it now.', 'advanced-ads' ),
246
+ admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' )
247
+ ),
248
+ esc_attr__( 'Activate', 'advanced-ads' )
249
+ ),
250
  );
251
  }
252
 
253
+ /**
254
+ * Get the ad selector markup
255
+ *
256
+ * @param bool $hide_idle_ads Whether to hide idle ads.
257
+ */
258
+ public static function get_mapi_ad_selector( $hide_idle_ads = true ) {
259
+ global $closeable, $use_dashicons, $network, $ad_units, $display_slot_id;
260
+ $closeable = true;
261
+ $use_dashicons = false;
262
+ $network = Advanced_Ads_Network_Adsense::get_instance();
263
+ $ad_units = $network->get_external_ad_units();
264
+ $display_slot_id = true;
265
+ $pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
266
+
267
+ require_once GADSENSE_BASE_PATH . 'admin/views/external-ads-list.php';
268
+ // Require_once GADSENSE_BASE_PATH . 'admin/views/external-ads-adsense.php';.
269
+ }
270
  }
modules/gadsense/includes/class-network-adsense.php CHANGED
@@ -1,50 +1,70 @@
1
  <?php
2
- class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network{
3
- /**
4
- * @var array an array containing all the AdSense status codes that flag an {$link Advanced_Ads_Ad_Network_Ad_Unit} ad unit as active
5
- * for downward compatibility with PHP < 5.6 the const had to be changed to static field. you can revert to const when PHP5 support is FINALLY dropped
6
- */
7
- // const STATUS_CODES_ACTIVE = array("ACTIVE", "NEW");
8
- private static $STATUS_CODES_ACTIVE = array("ACTIVE", "NEW");
9
-
10
- /**
11
- * @var Advanced_Ads_Ad_Type_Adsense a globally usable instance, that will be created when calling {$link Advanced_Ads_Ad_Network#get_instance) for the first time
12
- */
13
- private static $instance;
14
-
15
- public static final function get_instance(){
16
- if (! self::$instance) self::$instance = new Advanced_Ads_Network_Adsense();
17
- return self::$instance;
18
- }
19
-
20
- public function __construct()
21
- {
22
- parent::__construct('adsense', 'AdSense');
23
- $this->data = Advanced_Ads_AdSense_Data::get_instance();
24
-
25
- //adsense does not use the default generated settings section id. overwrite it with the old value.
26
- $this->settings_section_id = 'advanced_ads_adsense_setting_section';
27
- }
28
-
29
- protected function register_settings($hook, $section_id)
30
- {
31
- // add setting field to disable ads
32
- add_settings_field(
33
- 'adsense-id',
34
- __( 'AdSense account', 'advanced-ads' ),
35
- array($this, 'render_settings_adsense_id'),
36
- $hook,
37
- $section_id
38
- );
39
-
40
- // activate AdSense verification code and Auto ads (previously Page-Level ads)
41
- add_settings_field(
42
- 'adsense-page-level',
43
- __( 'Verification code & Auto ads', 'advanced-ads' ),
44
- array($this, 'render_settings_adsense_page_level'),
45
- $hook,
46
- $section_id
47
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  // AdSense anchor ad on top of pages.
50
  // Only show this field if selected, otherwise use new auto ads code.
@@ -58,276 +78,357 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network{
58
  );
59
  }
60
 
61
- // hide AdSense stats in the backend
62
- add_settings_field(
63
- 'hide_stats',
64
- __( 'Disable stats', 'advanced-ads' ),
65
- array( $this, 'render_settings_adsense_hide_stats' ),
66
- $hook,
67
- $section_id
68
- );
69
-
70
- // add setting field for adsense limit
71
- // deprecated of January, 2019; will be removed one year later
72
- $limit_per_page = $this->data->get_limit_per_page();
73
- if( $limit_per_page ){
74
- add_settings_field(
75
- 'adsense-limit',
76
- __( 'Limit to 3 ads', 'advanced-ads' ),
77
- array($this, 'render_settings_adsense_limit'),
78
- $hook,
79
- $section_id
80
- );
81
- };
82
-
83
- // disable AdSense violation warnings
84
- add_settings_field(
85
- 'adsense-warnings-disable',
86
- __( 'Disable violation warnings', 'advanced-ads' ),
87
- array($this, 'render_settings_adsense_warnings_disable'),
88
- $hook,
89
- $section_id
90
- );
91
-
92
- add_settings_field(
93
- 'adsense-background',
94
- __( 'Transparent background', 'advanced-ads' ),
95
- array( $this, 'render_settings_adsense_background' ),
96
- $hook,
97
- $section_id
98
- );
99
-
100
- add_settings_field(
101
- 'adsense-full-width',
102
- __( 'Full width responsive ads on mobile', 'advanced-ads' ),
103
- array( $this, 'render_settings_adsense_fullwidth' ),
104
- $hook,
105
- 'advanced_ads_adsense_setting_section'
106
- );
107
- }
108
-
109
-
110
-
111
- /**
112
- * render AdSense settings section
113
- *
114
- * @since 1.5.1
115
- */
116
- public function render_settings_section_callback(){
117
- // for whatever purpose there might come
118
- }
119
-
120
- /**
121
- * render AdSense management api setting
122
- */
123
- public function render_settings_management_api() {
124
- require_once GADSENSE_BASE_PATH . 'admin/views/mapi-settings.php';
125
- }
126
-
127
- /**
128
- * render AdSense id setting
129
- *
130
- * @since 1.5.1
131
- */
132
- public function render_settings_adsense_id(){
133
- require_once GADSENSE_BASE_PATH . 'admin/views/adsense-account.php';
134
- }
135
-
136
- /**
137
- * render AdSense limit setting
138
- *
139
- * @since 1.5.1
140
- * @deprecated January, 2019 – let’s give users one year until we remove the whole logic completely
141
- */
142
- public function render_settings_adsense_limit(){
143
- $limit_per_page = $this->data->get_limit_per_page();
144
-
145
- ?><label><input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[limit-per-page]" value="1" <?php checked( $limit_per_page ); ?> />
146
- <?php printf( __( 'Limit to %d AdSense ads', 'advanced-ads' ), 3 ); ?></label>
147
- <p class="description">
148
- <?php
149
- printf(
150
- __( 'There is no explicit limit for AdSense ads anymore, but you can still use this setting to prevent too many AdSense ads to show accidentally on your site.', 'advanced-ads' ),
151
- esc_url( 'https://www.google.com/adsense/terms' )
152
- ); ?></p>
153
- <?php if( defined( 'AAP_VERSION' ) ) : /* give warning when cache-busting in Pro is active */ ?>
154
- <p class="advads-error-message"><?php _e( 'Due to technical restrictions, the limit does not work on placements with cache-busting enabled.', 'advanced-ads' ); ?></p>
155
- <?php endif;
156
- }
157
-
158
- /**
159
- * Render top anchor ad setting
160
- */
161
- public function render_settings_adsense_top_anchor_ad() {
162
- $options = $this->data->get_options();
163
- $anchor_ad = isset( $options['top-anchor-ad'] )? $options['top-anchor-ad'] : ''; ?>
164
- <label>
165
- <input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[top-anchor-ad]" value="1" <?php checked( $anchor_ad ); ?> />
166
- <?php esc_html_e( 'Enable this box if you don’t want Google Auto ads to place anchor ads at the top of your page.', 'advanced-ads' ); ?>
167
- </label>
168
- <?php
169
- }
170
-
171
- /**
172
- * Render setting to hide AdSense stats showing in the backend
173
- */
174
- public function render_settings_adsense_hide_stats() {
175
- $options = $this->data->get_options();
176
- $hide_stats = isset( $options['hide-stats'] )? true : false; ?>
177
- <label>
178
- <input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[hide-stats]" value="1" <?php checked( $hide_stats ); ?> />
179
- <?php esc_html_e( 'Enable this option to stop loading stats from AdSense into your WordPress backend.', 'advanced-ads' ); ?>
180
- </label>
181
- <?php
182
- }
183
-
184
- /**
185
- * render page-level ads setting
186
- *
187
- * @since 1.6.9
188
- */
189
- public function render_settings_adsense_page_level(){
190
- $options = $this->data->get_options();
191
- $page_level = $options['page-level-enabled'];
192
-
193
- ?><label><input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[page-level-enabled]" value="1" <?php checked( $page_level ); ?> />
194
- <?php esc_attr_e( 'Insert the AdSense header code used for verification and the Auto Ads feature.', 'advanced-ads' );
195
- if( !empty( $options['adsense-id'] ) ) :
196
- ?>&nbsp;<a href="https://www.google.com/adsense/new/u/0/<?php echo $options['adsense-id']; ?>/myads/auto-ads" target="_blank"><?php /**
197
- * translators: this is the text for a link to a sub-page in an AdSense account
198
- */
199
- esc_attr_e( 'Adjust Auto ads options', 'advanced-ads' ); ?></a>
200
- <?php endif; ?>
201
- </label><p class="description"><?php printf(__( 'Please read <a href="%s" target="_blank">this article</a> if <strong>ads appear in random places</strong>.', 'advanced-ads' ), ADVADS_URL . 'adsense-in-random-positions-auto-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=backend-autoads-ads' ); ?></p>
202
- <p class="description"><a href="<?php echo ADVADS_URL . 'adsense-auto-ads-wordpress/#Display_Auto_Ads_only_on_specific_pages'; ?>" target="_blank"><?php esc_attr_e( 'Display Auto ads only on specific pages', 'advanced-ads' ); ?></a></p>
203
- <p class="description"><a href="<?php echo ADVADS_URL . 'adsense-auto-ads-wordpress/#AMP_Auto_Ads'; ?>" target="_blank"><?php esc_attr_e( 'Auto ads on AMP pages', 'advanced-ads' ); ?></a></p><?php
204
- }
205
-
206
- /**
207
- * render AdSense violation warnings setting
208
- *
209
- * @since 1.6.9
210
- */
211
- public function render_settings_adsense_warnings_disable(){
212
- $options = $this->data->get_options();
213
- $disable_violation_warnings = isset( $options['violation-warnings-disable'] ) ? 1 : 0;
214
-
215
- ?><label><input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[violation-warnings-disable]" value="1" <?php checked( 1, $disable_violation_warnings ); ?> />
216
- <?php _e( 'Disable warnings about potential violations of the AdSense terms.', 'advanced-ads' ); ?></label>
217
- <p class="description"><?php printf(__( 'Our <a href="%s" target="_blank">Ad Health</a> feature monitors if AdSense is implemented correctly on your site. It also considers ads not managed with Advanced Ads. Enable this option to remove these checks', 'advanced-ads' ), ADVADS_URL . 'manual/ad-health/#utm_source=advanced-ads&utm_medium=link&utm_campaign=backend-autoads-ads' ); ?></p><?php
218
- }
219
-
220
- /**
221
- * Render transparent background setting.
222
- */
223
- public function render_settings_adsense_background() {
224
- $options = $this->data->get_options();
225
- $background = $options['background'];
226
-
227
- ?><label><input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[background]" value="1" <?php checked( $background ); ?> />
228
- <?php _e( 'Enable this option in case your theme adds an unfortunate background color to AdSense ads.', 'advanced-ads' ); ?></label><?php
229
- }
230
-
231
- /**
232
- * Render full width ads setting.
233
- */
234
- public function render_settings_adsense_fullwidth() {
235
- $options = $this->data->get_options();
236
- $fw = !empty( $options['fullwidth-ads'] ) ? $options['fullwidth-ads'] : 'default';
237
- ?>
238
- <select name="<?php echo GADSENSE_OPT_NAME; ?>[fullwidth-ads]">
239
- <option value="default" <?php selected( $fw, 'default' ); ?>><?php esc_html_e( 'default', 'advanced-ads' ) ?></option>
240
- <option value="enable" <?php selected( $fw, 'enable' ); ?>><?php esc_html_e( 'enable', 'advanced-ads' ) ?></option>
241
- <option value="disable" <?php selected( $fw, 'disable' ); ?>><?php esc_html_e( 'disable', 'advanced-ads' ) ?></option>
242
- </select>
243
- <p class="description"><?php
244
- echo wp_kses(
245
- sprintf(
246
- __( "Whether your responsive ad unit may expand to <a href='%s' target='blank'>use the full width</a> of your visitor's mobile device screen", 'advanced-ads' ),
247
- esc_url( 'https://support.google.com/adsense/answer/7445870' )
248
- ),
249
- array( 'a' => array( 'href' => true, 'target' => true ) )
250
- ); ?></p>
251
- <?php
252
- }
253
-
254
- /**
255
- * sanitize AdSense settings
256
- *
257
- * @since 1.5.1
258
- * @param array $options all the options
259
- */
260
- protected function sanitize_settings($options){
261
- // sanitize whatever option one wants to sanitize
262
- if(isset($options['adsense-id']) && $options['adsense-id'] != ''){
263
- // remove "ca-" prefix if it was added by the user
264
- if( 0 === strpos( $options['adsense-id'], 'ca-' ) ){
265
- $options['adsense-id'] = str_replace( 'ca-', '', $options['adsense-id'] );
266
- }
267
-
268
- // trim publisher id
269
- $options['adsense-id'] = trim($options['adsense-id']);
270
- }
271
- return $options;
272
- }
273
-
274
- /**
275
- * sanitize ad settings
276
- * save publisher id from new ad unit if not given in main options
277
- *
278
- * @since 1.6.2
279
- * @param arr $ad_settings_post
280
- * @return arr $ad_settings_post
281
- */
282
- public function sanitize_ad_settings( $ad_settings_post ){
283
- // check ad type
284
- if( ! isset( $ad_settings_post['type'] ) || 'adsense' !== $ad_settings_post['type'] ){
285
- return $ad_settings_post;
286
- }
287
-
288
- // save AdSense publisher ID if there is no one stored yet
289
- if ( ! empty($ad_settings_post['output']['adsense-pub-id']) ) {
290
- // get options
291
- $adsense_options = get_option( 'advanced-ads-adsense', array() );
292
-
293
- if ( empty( $adsense_options['adsense-id'] ) ) {
294
- $adsense_options['adsense-id'] = $ad_settings_post['output']['adsense-pub-id'];
295
- update_option( 'advanced-ads-adsense', $adsense_options );
296
- }
297
- }
298
- unset( $ad_settings_post['output']['adsense-pub-id'] );
299
- return $ad_settings_post;
300
- }
301
-
302
- public function get_ad_type()
303
- {
304
- return new Advanced_Ads_Ad_Type_Adsense();
305
- }
306
-
307
- public function get_external_ad_units()
308
- {
309
- $db = Advanced_Ads_AdSense_Data::get_instance();
310
- $adsense_id = trim( $db->get_adsense_id() );
311
-
312
- $units = array();
313
- $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
314
-
315
- if (isset($mapi_options['ad_codes'])
316
- && isset($mapi_options['accounts'])
317
- && isset($mapi_options['accounts'][$adsense_id])
318
- && isset($mapi_options['accounts'][$adsense_id]['ad_units'])){
319
- $ad_codes = $mapi_options['ad_codes'];
320
- foreach ($mapi_options['accounts'][$adsense_id]['ad_units'] as $id => $raw){
321
- $ad_unit = new Advanced_Ads_Ad_Network_Ad_Unit($raw);
322
- $ad_unit->id = $id;
323
- $ad_unit->slot_id = isset($raw['code']) ? $raw['code'] : '-';
324
- $ad_unit->name = isset($raw['name']) ? $raw['name'] : '-';
325
- $ad_unit->active = isset($raw['status']) && in_array($raw['status'], self::$STATUS_CODES_ACTIVE);
326
-
327
- if (isset($ad_codes[$id])) {
328
- $ad_unit->code = $ad_codes[$id];
329
- }
330
- if (isset ($raw['contentAdsSettings'])){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  if ( isset( $raw['contentAdsSettings']['type'] ) ) {
332
  $ad_unit->display_type = $raw['contentAdsSettings']['type'];
333
  $ad_unit->display_type = Advanced_Ads_AdSense_MAPI::format_ad_data( $ad_unit, 'type' );
@@ -336,18 +437,33 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network{
336
  $ad_unit->display_size = $raw['contentAdsSettings']['size'];
337
  $ad_unit->display_size = Advanced_Ads_AdSense_MAPI::format_ad_data( $ad_unit, 'size' );
338
  }
339
- }
340
- $units[] = $ad_unit;
341
- }
342
- }
343
- return $units;
344
- }
345
-
346
- public function print_external_ads_list($hide_idle_ads = true, $ad_unit_id = null)
347
- {
348
- Advanced_Ads_AdSense_Admin::get_mapi_ad_selector($hide_idle_ads);
349
- }
 
 
 
 
 
 
 
350
 
 
 
 
 
 
 
 
 
351
  public function is_supported( $ad_unit ) {
352
  $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
353
  $supported = ! array_key_exists( $ad_unit->id, $mapi_options['unsupported_units'] );
@@ -358,23 +474,38 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network{
358
  return $supported;
359
  }
360
 
361
- public function update_external_ad_units()
362
- {
363
- Advanced_Ads_AdSense_MAPI::get_instance()->ajax_get_adUnits();
364
- }
 
 
365
 
366
- public function is_account_connected()
367
- {
368
- return Advanced_Ads_AdSense_Data::get_instance()->is_setup();
369
- }
 
 
 
 
370
 
371
- public function get_javascript_base_path()
372
- {
373
- return GADSENSE_BASE_URL . 'admin/assets/js/adsense.js';
374
- }
 
 
 
 
375
 
376
  /**
 
 
377
  * @inheritDoc
 
 
 
378
  */
379
  public function append_javascript_data( &$data ) {
380
  $pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
@@ -391,8 +522,12 @@ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network{
391
  return $data;
392
  }
393
 
394
- public function supports_manual_ad_setup()
395
- {
396
- return true;
397
- }
 
 
 
 
398
  }
1
  <?php
2
+ /**
3
+ * Class Advanced_Ads_Network_Adsense
4
+ */
5
+ class Advanced_Ads_Network_Adsense extends Advanced_Ads_Ad_Network {
6
+ /**
7
+ * An array containing all the AdSense status codes that flag an {$link Advanced_Ads_Ad_Network_Ad_Unit} ad unit as active
8
+ * for downward compatibility with PHP < 5.6 the const had to be changed to static field. you can revert to const when PHP5 support is FINALLY dropped
9
+ *
10
+ * @var array
11
+ */
12
+ private static $status_codes_active = array( 'ACTIVE', 'NEW' );
13
+
14
+ /**
15
+ * A globally usable instance, that will be created when calling {$link Advanced_Ads_Ad_Network#get_instance) for the first time
16
+ *
17
+ * @var Advanced_Ads_Ad_Type_Adsense
18
+ */
19
+ private static $instance;
20
+
21
+ /**
22
+ * Instance of Advanced_Ads_Network_Adsense
23
+ *
24
+ * @return Advanced_Ads_Ad_Type_Adsense|Advanced_Ads_Network_Adsense
25
+ */
26
+ final public static function get_instance() {
27
+ if ( ! self::$instance ) {
28
+ self::$instance = new Advanced_Ads_Network_Adsense();
29
+ }
30
+ return self::$instance;
31
+ }
32
+
33
+ /**
34
+ * Advanced_Ads_Network_Adsense constructor.
35
+ */
36
+ public function __construct() {
37
+ parent::__construct( 'adsense', 'AdSense' );
38
+ $this->data = Advanced_Ads_AdSense_Data::get_instance();
39
+
40
+ // Adsense does not use the default generated settings section id. overwrite it with the old value.
41
+ $this->settings_section_id = 'advanced_ads_adsense_setting_section';
42
+ }
43
+
44
+ /**
45
+ * Register settings to Advanced Ads > Settings > AdSense
46
+ *
47
+ * @param string $hook settings page hook.
48
+ * @param string $section_id settings section id.
49
+ */
50
+ protected function register_settings( $hook, $section_id ) {
51
+ // Add setting field to disable ads.
52
+ add_settings_field(
53
+ 'adsense-id',
54
+ __( 'AdSense account', 'advanced-ads' ),
55
+ array( $this, 'render_settings_adsense_id' ),
56
+ $hook,
57
+ $section_id
58
+ );
59
+
60
+ // Activate AdSense verification code and Auto ads (previously Page-Level ads).
61
+ add_settings_field(
62
+ 'adsense-page-level',
63
+ __( 'Verification code & Auto ads', 'advanced-ads' ),
64
+ array( $this, 'render_settings_adsense_page_level' ),
65
+ $hook,
66
+ $section_id
67
+ );
68
 
69
  // AdSense anchor ad on top of pages.
70
  // Only show this field if selected, otherwise use new auto ads code.
78
  );
79
  }
80
 
81
+ // Hide AdSense stats in the backend.
82
+ add_settings_field(
83
+ 'hide_stats',
84
+ __( 'Disable stats', 'advanced-ads' ),
85
+ array( $this, 'render_settings_adsense_hide_stats' ),
86
+ $hook,
87
+ $section_id
88
+ );
89
+
90
+ // Add setting field for adsense limit.
91
+ // Deprecated of January, 2019; will be removed one year later.
92
+ $limit_per_page = $this->data->get_limit_per_page();
93
+ if ( $limit_per_page ) {
94
+ add_settings_field(
95
+ 'adsense-limit',
96
+ __( 'Limit to 3 ads', 'advanced-ads' ),
97
+ array( $this, 'render_settings_adsense_limit' ),
98
+ $hook,
99
+ $section_id
100
+ );
101
+ };
102
+
103
+ // Disable AdSense violation warnings.
104
+ add_settings_field(
105
+ 'adsense-warnings-disable',
106
+ __( 'Disable violation warnings', 'advanced-ads' ),
107
+ array( $this, 'render_settings_adsense_warnings_disable' ),
108
+ $hook,
109
+ $section_id
110
+ );
111
+
112
+ add_settings_field(
113
+ 'adsense-background',
114
+ __( 'Transparent background', 'advanced-ads' ),
115
+ array( $this, 'render_settings_adsense_background' ),
116
+ $hook,
117
+ $section_id
118
+ );
119
+
120
+ add_settings_field(
121
+ 'adsense-full-width',
122
+ __( 'Full width responsive ads on mobile', 'advanced-ads' ),
123
+ array( $this, 'render_settings_adsense_fullwidth' ),
124
+ $hook,
125
+ 'advanced_ads_adsense_setting_section'
126
+ );
127
+ }
128
+
129
+
130
+
131
+ /**
132
+ * Render AdSense settings section
133
+ */
134
+ public function render_settings_section_callback() {
135
+ // For whatever purpose there might come.
136
+ }
137
+
138
+ /**
139
+ * Render AdSense management api setting
140
+ */
141
+ public function render_settings_management_api() {
142
+ require_once GADSENSE_BASE_PATH . 'admin/views/mapi-settings.php';
143
+ }
144
+
145
+ /**
146
+ * Render AdSense id setting
147
+ */
148
+ public function render_settings_adsense_id() {
149
+ require_once GADSENSE_BASE_PATH . 'admin/views/adsense-account.php';
150
+ }
151
+
152
+ /**
153
+ * Render AdSense limit setting
154
+ *
155
+ * @since 1.5.1
156
+ * @deprecated January, 2019 – let’s give users one year until we remove the whole logic completely
157
+ */
158
+ public function render_settings_adsense_limit() {
159
+ $limit_per_page = $this->data->get_limit_per_page();
160
+
161
+ ?><label><input type="checkbox" name="<?php echo esc_attr( GADSENSE_OPT_NAME ); ?>[limit-per-page]" value="1" <?php checked( $limit_per_page ); ?> />
162
+ <?php
163
+ printf(
164
+ // Translators: $d a number of ads.
165
+ esc_html( __( 'Limit to %d AdSense ads', 'advanced-ads' ) ),
166
+ 3
167
+ );
168
+ ?>
169
+ </label>
170
+ <p class="description">
171
+ <?php
172
+ esc_html_e( 'There is no explicit limit for AdSense ads anymore, but you can still use this setting to prevent too many AdSense ads to show accidentally on your site.', 'advanced-ads' );
173
+ ?>
174
+ </p>
175
+ <?php
176
+ if ( defined( 'AAP_VERSION' ) ) :
177
+ // Give warning when cache-busting in Pro is active.
178
+ ?>
179
+ <p class="advads-error-message"><?php esc_html_e( 'Due to technical restrictions, the limit does not work on placements with cache-busting enabled.', 'advanced-ads' ); ?></p>
180
+ <?php
181
+ endif;
182
+ }
183
+
184
+ /**
185
+ * Render top anchor ad setting
186
+ */
187
+ public function render_settings_adsense_top_anchor_ad() {
188
+ $options = $this->data->get_options();
189
+ $anchor_ad = isset( $options['top-anchor-ad'] ) ? $options['top-anchor-ad'] : '';
190
+ ?>
191
+ <label>
192
+ <input type="checkbox" name="<?php echo esc_attr( GADSENSE_OPT_NAME ); ?>[top-anchor-ad]" value="1" <?php checked( $anchor_ad ); ?> />
193
+ <?php esc_html_e( 'Enable this box if you don’t want Google Auto ads to place anchor ads at the top of your page.', 'advanced-ads' ); ?>
194
+ </label>
195
+ <?php
196
+ }
197
+
198
+ /**
199
+ * Render setting to hide AdSense stats showing in the backend
200
+ */
201
+ public function render_settings_adsense_hide_stats() {
202
+ $options = $this->data->get_options();
203
+ $hide_stats = isset( $options['hide-stats'] );
204
+ ?>
205
+ <label>
206
+ <input type="checkbox" name="<?php echo esc_attr( GADSENSE_OPT_NAME ); ?>[hide-stats]" value="1" <?php checked( $hide_stats ); ?> />
207
+ <?php esc_html_e( 'Enable this option to stop loading stats from AdSense into your WordPress backend.', 'advanced-ads' ); ?>
208
+ </label>
209
+ <?php
210
+ }
211
+
212
+ /**
213
+ * Render page-level ads setting
214
+ *
215
+ * @since 1.6.9
216
+ */
217
+ public function render_settings_adsense_page_level() {
218
+ $options = $this->data->get_options();
219
+ $page_level = $options['page-level-enabled'];
220
+
221
+ ?>
222
+ <label><input type="checkbox" name="<?php echo esc_attr( GADSENSE_OPT_NAME ); ?>[page-level-enabled]" value="1" <?php checked( $page_level ); ?> />
223
+ <?php
224
+ esc_attr_e( 'Insert the AdSense header code used for verification and the Auto Ads feature.', 'advanced-ads' );
225
+ if ( ! empty( $options['adsense-id'] ) ) :
226
+ ?>
227
+ &nbsp;<a href="https://www.google.com/adsense/new/u/0/<?php echo esc_attr( $options['adsense-id'] ); ?>/myads/auto-ads" target="_blank">
228
+ <?php
229
+ /**
230
+ * Translators: this is the text for a link to a sub-page in an AdSense account
231
+ */
232
+ esc_attr_e( 'Adjust Auto ads options', 'advanced-ads' );
233
+ ?>
234
+ </a>
235
+ <?php
236
+ endif;
237
+ ?>
238
+ </label><p class="description">
239
+ <?php
240
+ printf(
241
+ wp_kses(
242
+ // Translators: %s is a URL.
243
+ __( 'Please read <a href="%s" target="_blank">this article</a> if <strong>ads appear in random places</strong>.', 'advanced-ads' ),
244
+ array(
245
+ 'a' => array(
246
+ 'href' => array(),
247
+ 'target' => array(),
248
+ ),
249
+ 'strong' => array(),
250
+ )
251
+ ),
252
+ esc_url( ADVADS_URL ) . 'adsense-in-random-positions-auto-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=backend-autoads-ads'
253
+ );
254
+ ?>
255
+ </p>
256
+ <p class="description"><a href="<?php echo esc_url( ADVADS_URL ) . 'adsense-auto-ads-wordpress/#Display_Auto_Ads_only_on_specific_pages'; ?>" target="_blank"><?php esc_attr_e( 'Display Auto ads only on specific pages', 'advanced-ads' ); ?></a></p>
257
+ <?php
258
+ // Show information about AMP Auto ads when an AMP plugin is installed and Responsive Ads is missing.
259
+ if ( ! defined( 'AAR_VERSION' ) && Advanced_Ads_Checks::active_amp_plugin() ) :
260
+ ?>
261
+ <p><label><input type="checkbox" disabled="disabled"/><?php esc_html_e( 'Enable AMP Auto ads', 'advanced-ads' ); ?></label>
262
+ <?php
263
+ Advanced_Ads_Admin_Upgrades::upgrade_link( null, ADVADS_URL . 'add-ons/responsive-ads/', 'upgrade-settings-adsense-amp-auto-ads' );
264
+ ?>
265
+ </p>
266
+ <?php
267
+ endif;
268
+ do_action( 'advanced-ads-settings-adsense-below-auto-ads-option' );
269
+ }
270
+
271
+ /**
272
+ * Render AdSense violation warnings setting
273
+ *
274
+ * @since 1.6.9
275
+ */
276
+ public function render_settings_adsense_warnings_disable() {
277
+ $options = $this->data->get_options();
278
+ $disable_violation_warnings = isset( $options['violation-warnings-disable'] ) ? 1 : 0;
279
+
280
+ ?>
281
+ <label><input type="checkbox" name="<?php echo esc_attr( GADSENSE_OPT_NAME ); ?>[violation-warnings-disable]" value="1" <?php checked( 1, $disable_violation_warnings ); ?> />
282
+ <?php esc_html_e( 'Disable warnings about potential violations of the AdSense terms.', 'advanced-ads' ); ?></label>
283
+ <p class="description">
284
+ <?php
285
+ printf(
286
+ wp_kses(
287
+ // Translators: %s is a URL.
288
+ __( 'Our <a href="%s" target="_blank">Ad Health</a> feature monitors if AdSense is implemented correctly on your site. It also considers ads not managed with Advanced Ads. Enable this option to remove these checks', 'advanced-ads' ),
289
+ array(
290
+ 'a' => array(
291
+ 'href' => true,
292
+ 'target' => true,
293
+ ),
294
+ )
295
+ ),
296
+ esc_url( ADVADS_URL ) . 'manual/ad-health/#utm_source=advanced-ads&utm_medium=link&utm_campaign=backend-autoads-ads'
297
+ );
298
+ ?>
299
+ </p>
300
+ <?php
301
+ }
302
+
303
+ /**
304
+ * Render transparent background setting.
305
+ */
306
+ public function render_settings_adsense_background() {
307
+ $options = $this->data->get_options();
308
+ $background = $options['background'];
309
+
310
+ ?>
311
+ <label><input type="checkbox" name="<?php echo esc_attr( GADSENSE_OPT_NAME ); ?>[background]" value="1" <?php checked( $background ); ?> />
312
+ <?php esc_html_e( 'Enable this option in case your theme adds an unfortunate background color to AdSense ads.', 'advanced-ads' ); ?></label>
313
+ <?php
314
+ }
315
+
316
+ /**
317
+ * Render full width ads setting.
318
+ */
319
+ public function render_settings_adsense_fullwidth() {
320
+ $options = $this->data->get_options();
321
+ $fw = ! empty( $options['fullwidth-ads'] ) ? $options['fullwidth-ads'] : 'default';
322
+ ?>
323
+ <select name="<?php echo esc_attr( GADSENSE_OPT_NAME ); ?>[fullwidth-ads]">
324
+ <option value="default" <?php selected( $fw, 'default' ); ?>><?php esc_html_e( 'default', 'advanced-ads' ); ?></option>
325
+ <option value="enable" <?php selected( $fw, 'enable' ); ?>><?php esc_html_e( 'enable', 'advanced-ads' ); ?></option>
326
+ <option value="disable" <?php selected( $fw, 'disable' ); ?>><?php esc_html_e( 'disable', 'advanced-ads' ); ?></option>
327
+ </select>
328
+ <p class="description">
329
+ <?php
330
+ echo wp_kses(
331
+ sprintf(
332
+ // Translators: %s is a URL.
333
+ __( "Whether your responsive ad unit may expand to <a href='%s' target='blank'>use the full width</a> of your visitor's mobile device screen", 'advanced-ads' ),
334
+ esc_url( 'https://support.google.com/adsense/answer/7445870' )
335
+ ),
336
+ array(
337
+ 'a' => array(
338
+ 'href' => true,
339
+ 'target' => true,
340
+ ),
341
+ )
342
+ );
343
+ ?>
344
+ </p>
345
+ <?php
346
+ }
347
+
348
+ /**
349
+ * Sanitize AdSense settings
350
+ *
351
+ * @param array $options all the options.
352
+ */
353
+ protected function sanitize_settings( $options ) {
354
+ // Sanitize whatever option one wants to sanitize.
355
+ if ( isset( $options['adsense-id'] ) && '' !== $options['adsense-id'] ) {
356
+ // Remove "ca-" prefix if it was added by the user.
357
+ if ( 0 === strpos( $options['adsense-id'], 'ca-' ) ) {
358
+ $options['adsense-id'] = str_replace( 'ca-', '', $options['adsense-id'] );
359
+ }
360
+
361
+ // Trim publisher id.
362
+ $options['adsense-id'] = trim( $options['adsense-id'] );
363
+ }
364
+ return $options;
365
+ }
366
+
367
+ /**
368
+ * Sanitize ad settingssave publisher id from new ad unit if not given in main options
369
+ * save publisher id from new ad unit if not given in main options
370
+ *
371
+ * @param array $ad_settings_post ad settings.
372
+ * @return array sanitized ad settings.
373
+ */
374
+ public function sanitize_ad_settings( $ad_settings_post ) {
375
+ // Check ad type.
376
+ if ( ! isset( $ad_settings_post['type'] ) || 'adsense' !== $ad_settings_post['type'] ) {
377
+ return $ad_settings_post;
378
+ }
379
+
380
+ // Save AdSense publisher ID if there is no one stored yet.
381
+ if ( ! empty( $ad_settings_post['output']['adsense-pub-id'] ) ) {
382
+ // Get options.
383
+ $adsense_options = get_option( 'advanced-ads-adsense', array() );
384
+
385
+ if ( empty( $adsense_options['adsense-id'] ) ) {
386
+ $adsense_options['adsense-id'] = $ad_settings_post['output']['adsense-pub-id'];
387
+ update_option( 'advanced-ads-adsense', $adsense_options );
388
+ }
389
+ }
390
+ unset( $ad_settings_post['output']['adsense-pub-id'] );
391
+ return $ad_settings_post;
392
+ }
393
+
394
+ /**
395
+ * Return ad type object.
396
+ *
397
+ * @return Advanced_Ads_Ad_Type_Adsense
398
+ */
399
+ public function get_ad_type() {
400
+ return new Advanced_Ads_Ad_Type_Adsense();
401
+ }
402
+
403
+ /**
404
+ * Return ad units loaded through the API.
405
+ *
406
+ * @return array
407
+ */
408
+ public function get_external_ad_units() {
409
+ $db = Advanced_Ads_AdSense_Data::get_instance();
410
+ $adsense_id = trim( $db->get_adsense_id() );
411
+
412
+ $units = array();
413
+ $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
414
+
415
+ if ( isset( $mapi_options['ad_codes'] )
416
+ && isset( $mapi_options['accounts'] )
417
+ && isset( $mapi_options['accounts'][ $adsense_id ] )
418
+ && isset( $mapi_options['accounts'][ $adsense_id ]['ad_units'] ) ) {
419
+ $ad_codes = $mapi_options['ad_codes'];
420
+ foreach ( $mapi_options['accounts'][ $adsense_id ]['ad_units'] as $id => $raw ) {
421
+ $ad_unit = new Advanced_Ads_Ad_Network_Ad_Unit( $raw );
422
+ $ad_unit->id = $id;
423
+ $ad_unit->slot_id = isset( $raw['code'] ) ? $raw['code'] : '-';
424
+ $ad_unit->name = isset( $raw['name'] ) ? $raw['name'] : '-';
425
+ // phpcs:ignore
426
+ $ad_unit->active = isset( $raw['status'] ) && in_array( $raw['status'], self::$status_codes_active );
427
+
428
+ if ( isset( $ad_codes[ $id ] ) ) {
429
+ $ad_unit->code = $ad_codes[ $id ];
430
+ }
431
+ if ( isset( $raw['contentAdsSettings'] ) ) {
432
  if ( isset( $raw['contentAdsSettings']['type'] ) ) {
433
  $ad_unit->display_type = $raw['contentAdsSettings']['type'];
434
  $ad_unit->display_type = Advanced_Ads_AdSense_MAPI::format_ad_data( $ad_unit, 'type' );
437
  $ad_unit->display_size = $raw['contentAdsSettings']['size'];
438
  $ad_unit->display_size = Advanced_Ads_AdSense_MAPI::format_ad_data( $ad_unit, 'size' );
439
  }
440
+ }
441
+ $units[] = $ad_unit;
442
+ }
443
+ }
444
+ return $units;
445
+ }
446
+
447
+ /**
448
+ * Render the list of ads loaded through the API.
449
+ *
450
+ * @param bool $hide_idle_ads true to hide inactive ads.
451
+ * @param null $ad_unit_id ID of the ad unit.
452
+ *
453
+ * @return mixed|void
454
+ */
455
+ public function print_external_ads_list( $hide_idle_ads = true, $ad_unit_id = null ) {
456
+ Advanced_Ads_AdSense_Admin::get_mapi_ad_selector( $hide_idle_ads );
457
+ }
458
 
459
+ /**
460
+ * Whether the loaded AdSense ad is supported through the API.
461
+ * at the time we wrote this, native ad formats like In-article, In-feed and Matched Content are not supported.
462
+ *
463
+ * @param object $ad_unit ad unit object.
464
+ *
465
+ * @return bool
466
+ */
467
  public function is_supported( $ad_unit ) {
468
  $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
469
  $supported = ! array_key_exists( $ad_unit->id, $mapi_options['unsupported_units'] );
474
  return $supported;
475
  }
476
 
477
+ /**
478
+ * Update the list of external ad units.
479
+ */
480
+ public function update_external_ad_units() {
481
+ Advanced_Ads_AdSense_MAPI::get_instance()->ajax_get_adUnits();
482
+ }
483
 
484
+ /**
485
+ * If the AdSense account is connected.
486
+ *
487
+ * @return bool
488
+ */
489
+ public function is_account_connected() {
490
+ return Advanced_Ads_AdSense_Data::get_instance()->is_setup();
491
+ }
492
 
493
+ /**
494
+ * Return path to module-specific JavaScript.
495
+ *
496
+ * @return string
497
+ */
498
+ public function get_javascript_base_path() {
499
+ return GADSENSE_BASE_URL . 'admin/assets/js/adsense.js';
500
+ }
501
 
502
  /**
503
+ * JavaScript data to print in the source code.
504
+ *
505
  * @inheritDoc
506
+ *
507
+ * @param array $data data to be printed.
508
+ * @return array
509
  */
510
  public function append_javascript_data( &$data ) {
511
  $pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
522
  return $data;
523
  }
524
 
525
+ /**
526
+ * If the ad also has a manual ad setup option.
527
+ *
528
+ * @return bool
529
+ */
530
+ public function supports_manual_ad_setup() {
531
+ return true;
532
+ }
533
  }
readme.txt CHANGED
@@ -288,7 +288,7 @@ Advanced Ads can create that file automatically with the correct information for
288
 
289
  = I am a developer. Can I customize the plugin? =
290
 
291
- Yes. Advanced Ads is based on WordPress standards and therefore easily customizable using either WordPress hooks or the ones we defined [here](https://wpadvancedads.com/codex/).
292
 
293
  == Screenshots ==
294
 
@@ -305,6 +305,12 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
305
 
306
  == Changelog ==
307
 
 
 
 
 
 
 
308
  = 1.17.11 =
309
 
310
  * added Datanyze and Ecosia to bots list
288
 
289
  = I am a developer. Can I customize the plugin? =
290
 
291
+ Yes. Advanced Ads is built on WordPress standards and therefore easily customizable using either WordPress hooks or the ones we defined [here](https://wpadvancedads.com/codex/).
292
 
293
  == Screenshots ==
294
 
305
 
306
  == Changelog ==
307
 
308
+ = untagged =
309
+
310
+ * set default name for ads where none was given
311
+ * fixed issue where long option markup could break the group page
312
+ * made placements of type other than "Header Code" work with "Thrive Theme Builder" theme
313
+
314
  = 1.17.11 =
315
 
316
  * added Datanyze and Ecosia to bots list