Advanced Ads - Version 1.8.12

Version Description

  • linked the new AdSense In-feed add-on where needed
  • optimized settings page layout
  • process Advanced Ads shortcodes correctly when they are nested inside Rich Content ads
Download this release

Release Info

Developer webzunft
Plugin Icon 128x128 Advanced Ads
Version 1.8.12
Comparing to
See all releases

Code changes from version 1.8.11 to 1.8.12

admin/assets/css/admin.css CHANGED
@@ -19,7 +19,7 @@
19
  #advads-overview .postbox.position-full { clear: both; float: none; }
20
  #advads-overview .postbox h2 { border-bottom: 1px solid #eee; font-size: 14px; padding: 8px 12px; margin: 0; line-height: 1.4; }
21
  #advads-overview #advads_overview_addons ul, #advads-overview #advads_overview_addons ul li { list-style: disc inside; }
22
- #advads-overview #advads_overview_addons table th { vertical-align: top; font-weight: bold; max-width: 150px; position: relative; top: 0; }
23
  #advads-overview #advads_overview_addons table tr.recommended th:before { position:absolute; top: 2px; left: 10px; font-size: .9em; content: 'Recommended'; color: green; font-weight: normal; }
24
  #advads-overview #advads_overview_addons table tr.free th:before { position:absolute; top: 2px; left: 10px; font-size: .9em; content: 'Free'; color: green; }
25
  #advads-overview #advads_overview_addons table tr.recommended th,
@@ -289,7 +289,10 @@ tr:hover .on-hover { display: block; }
289
  /**
290
  - TABS + SETTINGS
291
  -*/
292
- .advads-tab { display: none; }
 
 
 
293
  .advads-tab.active { display: block; }
294
  .advads-license-activate-active { color: green; }
295
  .advads-license-activate-error { color: red; }
@@ -370,4 +373,9 @@ tr:hover .on-hover { display: block; }
370
  height: 0;
371
  width: 0;
372
  margin: 0;
373
- }
 
 
 
 
 
19
  #advads-overview .postbox.position-full { clear: both; float: none; }
20
  #advads-overview .postbox h2 { border-bottom: 1px solid #eee; font-size: 14px; padding: 8px 12px; margin: 0; line-height: 1.4; }
21
  #advads-overview #advads_overview_addons ul, #advads-overview #advads_overview_addons ul li { list-style: disc inside; }
22
+ #advads-overview #advads_overview_addons table th { vertical-align: top; font-weight: bold; max-width: 300px; position: relative; top: 0; }
23
  #advads-overview #advads_overview_addons table tr.recommended th:before { position:absolute; top: 2px; left: 10px; font-size: .9em; content: 'Recommended'; color: green; font-weight: normal; }
24
  #advads-overview #advads_overview_addons table tr.free th:before { position:absolute; top: 2px; left: 10px; font-size: .9em; content: 'Free'; color: green; }
25
  #advads-overview #advads_overview_addons table tr.recommended th,
289
  /**
290
  - TABS + SETTINGS
291
  -*/
292
+ #advads-tabs .nav-tab-active { background: #fff; border-bottom: 0; margin-top: 1px; }
293
+ .advads-tab { display: none; padding: 5px 15px; overflow: hidden; background-color: #fff; border: 1px solid #ccc; border-top: none; }
294
+ .advads-tab input[type="checkbox"] { margin-right: 8px; }
295
+ .advads-tab .form-table th, .advads-tab, .advads-tab .form-table td { padding-bottom: 30px; }
296
  .advads-tab.active { display: block; }
297
  .advads-license-activate-active { color: green; }
298
  .advads-license-activate-error { color: red; }
373
  height: 0;
374
  width: 0;
375
  margin: 0;
376
+ }
377
+
378
+ /* Pro Pitch List */
379
+ .advads-pro-pitch { max-width: 500px; float: left; padding: 1em; margin-right: 1em; line-height: 2em; font-size: 14px; text-transform: capitalize; }
380
+ .advads-pro-pitch .dashicons { line-height: 1.4em; }
381
+ #advads-tracking-pitch .advads-pro-pitch { float: none; }
admin/assets/img/placements/adsense-in-feed.png ADDED
Binary file
admin/class-advanced-ads-admin.php CHANGED
@@ -453,5 +453,17 @@ class Advanced_Ads_Admin {
453
 
454
  return $mceInit;
455
  }
 
 
 
 
 
 
 
 
 
 
 
 
456
 
457
  }
453
 
454
  return $mceInit;
455
  }
456
+
457
+ /**
458
+ * sort visitor and display condition arrays alphabetically by their label
459
+ *
460
+ * @since 1.8.12
461
+ */
462
+ static function sort_condition_array_by_label( $a, $b ){
463
+ if( ! isset( $a['label'] ) || ! isset( $b['label'] ) ){
464
+ return;
465
+ }
466
+ return strcmp( strtolower( $a['label'] ), strtolower( $b['label'] ) );
467
+ }
468
 
469
  }
admin/includes/class-meta-box.php CHANGED
@@ -67,6 +67,16 @@ class Advanced_Ads_Admin_Meta_Boxes {
67
  add_meta_box(
68
  'ad-visitor-box', __( 'Visitor Conditions', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
69
  );
 
 
 
 
 
 
 
 
 
 
70
 
71
  // register meta box ids
72
  $this->meta_box_ids = array(
@@ -75,6 +85,8 @@ class Advanced_Ads_Admin_Meta_Boxes {
75
  'ad-output-box',
76
  'ad-display-box',
77
  'ad-visitor-box',
 
 
78
  'revisionsdiv', // revisions – only when activated
79
  'advanced_ads_groupsdiv' // automatically added by ad groups taxonomy
80
  );
@@ -141,6 +153,14 @@ class Advanced_Ads_Admin_Meta_Boxes {
141
  $view = 'ad-visitor-metabox.php';
142
  $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>';
143
  break;
 
 
 
 
 
 
 
 
144
  }
145
 
146
  if ( ! isset( $view ) ) {
67
  add_meta_box(
68
  'ad-visitor-box', __( 'Visitor Conditions', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
69
  );
70
+ if( ! defined( 'AAP_VERSION' ) ){
71
+ add_meta_box(
72
+ 'advads-pro-pitch', __( 'Increase your ad revenue', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'side', 'low'
73
+ );
74
+ }
75
+ if( ! defined( 'AAT_VERSION' ) ){
76
+ add_meta_box(
77
+ 'advads-tracking-pitch', __( 'Ad Stats', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'low'
78
+ );
79
+ }
80
 
81
  // register meta box ids
82
  $this->meta_box_ids = array(
85
  'ad-output-box',
86
  'ad-display-box',
87
  'ad-visitor-box',
88
+ 'advads-pro-pitch',
89
+ 'advads-tracking-pitch',
90
  'revisionsdiv', // revisions – only when activated
91
  'advanced_ads_groupsdiv' // automatically added by ad groups taxonomy
92
  );
153
  $view = 'ad-visitor-metabox.php';
154
  $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>';
155
  break;
156
+ case 'advads-pro-pitch':
157
+ $view = 'pitch-bundle.php';
158
+ // $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>';
159
+ break;
160
+ case 'advads-tracking-pitch':
161
+ $view = 'pitch-tracking.php';
162
+ // $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>';
163
+ break;
164
  }
165
 
166
  if ( ! isset( $view ) ) {
admin/includes/class-overview-widgets.php CHANGED
@@ -110,8 +110,10 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
110
 
111
  /**
112
  * pro addons widget
 
 
113
  */
114
- public static function render_addons(){
115
 
116
  $caching_used = Advanced_Ads_Checks::cache();
117
 
@@ -126,6 +128,7 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
126
  <?php if ( class_exists( 'BuddyPress', false ) ) : ?><li><?php printf( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), 'BuddyPress' ); ?></li><?php endif; /* BuddyPress */ ?>
127
  <?php if ( defined( 'PMPRO_VERSION' ) ) : ?><li><?php printf( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), 'Paid Memberships Pro' ); ?></li><?php endif; /* Paid Memberships Pro */ ?>
128
  <?php if ( defined( 'ICL_SITEPRESS_VERSION' ) ) : ?><li><?php printf( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), 'WPML' ); ?></li><?php endif; /* WPML */ ?>
 
129
  <li><?php _e( '11 more display and visitor conditions', 'advanced-ads' ); ?></li>
130
  <li><?php _e( '6 more placements', 'advanced-ads' ); ?></li>
131
  <li><?php _e( 'placement tests for ad optimization', 'advanced-ads' ); ?></li>
@@ -190,6 +193,14 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
190
  'link' => wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'advanced-ads-code-highlighter'), 'install-plugin_' . 'advanced-ads-code-highlighter'),
191
  'link_title' => __( 'Install now', 'advanced-ads' ),
192
  'order' => 9,
 
 
 
 
 
 
 
 
193
  )
194
  );
195
 
@@ -198,14 +209,17 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
198
  $installed_pro_plugins = 0;
199
 
200
  // handle Code Highlighter if already installed or not activated
201
- if( isset( $installed_plugins['advanced-ads-code-highlighter/advanced-ads-code-highlighter.php'] ) && ! class_exists( 'Advanced_Ads_Code_Highlighter') ){ // is installed, but not active
202
- $add_ons['code-highlighter']['link'] = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=advanced-ads-code-highlighter/advanced-ads-code-highlighter.php&amp', 'activate-plugin_advanced-ads-code-highlighter/advanced-ads-code-highlighter.php' );
203
- $add_ons['code-highlighter']['link_title'] = __( 'Activate now', 'advanced-ads' );
204
- } elseif( class_exists( 'Advanced_Ads_Code_Highlighter') ) {
205
  // remove plugin from the list
206
  unset( $add_ons['code-highlighter'] );
207
  }
208
 
 
 
 
 
 
 
209
  // PRO
210
  if( isset( $installed_plugins['advanced-ads-pro/advanced-ads-pro.php'] ) && ! class_exists( 'Advanced_Ads_Pro') ){ // is installed, but not active
211
  $add_ons['pro']['link'] = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=advanced-ads-pro/advanced-ads-pro.php&amp', 'activate-plugin_advanced-ads-pro/advanced-ads-pro.php' );
@@ -217,6 +231,11 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
217
  $add_ons['pro']['installed'] = true;
218
  $add_ons['pro']['order'] = 20;
219
  $installed_pro_plugins++;
 
 
 
 
 
220
  } elseif( $caching_used ) {
221
  // for now, "recommended" is always set for this plugin since there are so many advantages
222
  // $add_ons['pro']['class'] = 'recommended';
@@ -238,6 +257,11 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
238
  $add_ons['tracking']['installed'] = true;
239
  $add_ons['tracking']['order'] = 20;
240
  $installed_pro_plugins++;
 
 
 
 
 
241
  }
242
 
243
  // RESPONSIVE
@@ -251,6 +275,11 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
251
  $add_ons['responsive']['installed'] = true;
252
  $add_ons['responsive']['order'] = 20;
253
  $installed_pro_plugins++;
 
 
 
 
 
254
  }
255
 
256
  // STICKY
@@ -264,6 +293,11 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
264
  $add_ons['sticky']['installed'] = true;
265
  $add_ons['sticky']['order'] = 20;
266
  $installed_pro_plugins++;
 
 
 
 
 
267
  }
268
 
269
  // LAYER
@@ -277,6 +311,11 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
277
  $add_ons['layer']['installed'] = true;
278
  $add_ons['layer']['order'] = 20;
279
  $installed_pro_plugins++;
 
 
 
 
 
280
  }
281
 
282
  // SELLING ADS
@@ -290,6 +329,11 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
290
  $add_ons['selling']['installed'] = true;
291
  $add_ons['selling']['order'] = 20;
292
  $installed_pro_plugins++;
 
 
 
 
 
293
  }
294
 
295
  // GEO TARGETING
@@ -303,6 +347,11 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
303
  $add_ons['geo']['installed'] = true;
304
  $add_ons['geo']['order'] = 20;
305
  $installed_pro_plugins++;
 
 
 
 
 
306
  }
307
 
308
  // SLIDER
@@ -314,6 +363,11 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
314
  $add_ons['slider']['desc'] = '';
315
  $add_ons['slider']['installed'] = true;
316
  $add_ons['slider']['order'] = 20;
 
 
 
 
 
317
  }
318
 
319
  // add Genesis Ads, if Genesis based theme was detected
@@ -327,10 +381,7 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
327
  'link_title' => __( 'Install now', 'advanced-ads' ),
328
  );
329
  // handle install link as long as we can not be sure this is done by the Genesis plugin itself
330
- if( isset( $installed_plugins['genesis-ads/genesis-ads.php'] ) && ! defined( 'AAG_SLUG') ){ // is installed, but not active
331
- $add_ons['genesis']['link'] = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=genesis-ads/genesis-ads.php&amp', 'activate-plugin_genesis-ads/genesis-ads.php' );
332
- $add_ons['genesis']['link_title'] = __( 'Activate now', 'advanced-ads' );
333
- } elseif( defined( 'AAG_SLUG') ) {
334
  unset( $add_ons['genesis'] );
335
  }
336
  }
@@ -346,10 +397,7 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
346
  'link_title' => __( 'Install now', 'advanced-ads' ),
347
  );
348
  // handle install link as long as we can not be sure this is done by the Genesis plugin itself
349
- if( isset( $installed_plugins['ads-for-visual-composer/advanced-ads-vc.php'] ) && ! class_exists( 'Advanced_Ads_Visual_Composer') ){ // is installed, but not active
350
- $add_ons['visual_composer']['link'] = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=ads-for-visual-composer/advanced-ads-vc.php&amp', 'activate-plugin_ads-for-visual-composer/advanced-ads-vc.php' );
351
- $add_ons['visual_composer']['link_title'] = __( 'Activate now', 'advanced-ads' );
352
- } elseif( class_exists( 'Advanced_Ads_Visual_Composer') ) {
353
  unset( $add_ons['visual_composer'] );
354
  }
355
  }
110
 
111
  /**
112
  * pro addons widget
113
+ *
114
+ * @param bool $hide_activated if true, hide activated add-ons
115
  */
116
+ public static function render_addons( $hide_activated = false ){
117
 
118
  $caching_used = Advanced_Ads_Checks::cache();
119
 
128
  <?php if ( class_exists( 'BuddyPress', false ) ) : ?><li><?php printf( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), 'BuddyPress' ); ?></li><?php endif; /* BuddyPress */ ?>
129
  <?php if ( defined( 'PMPRO_VERSION' ) ) : ?><li><?php printf( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), 'Paid Memberships Pro' ); ?></li><?php endif; /* Paid Memberships Pro */ ?>
130
  <?php if ( defined( 'ICL_SITEPRESS_VERSION' ) ) : ?><li><?php printf( __( 'integrates with <strong>%s</strong>', 'advanced-ads' ), 'WPML' ); ?></li><?php endif; /* WPML */ ?>
131
+ <li><?php _e( 'click fraud protection, lazy load, ad-block ads', 'advanced-ads' ); ?></li>
132
  <li><?php _e( '11 more display and visitor conditions', 'advanced-ads' ); ?></li>
133
  <li><?php _e( '6 more placements', 'advanced-ads' ); ?></li>
134
  <li><?php _e( 'placement tests for ad optimization', 'advanced-ads' ); ?></li>
193
  'link' => wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'advanced-ads-code-highlighter'), 'install-plugin_' . 'advanced-ads-code-highlighter'),
194
  'link_title' => __( 'Install now', 'advanced-ads' ),
195
  'order' => 9,
196
+ ),
197
+ 'adsense-in-feed' => array(
198
+ 'title' => 'AdSense In-feed',
199
+ 'desc' => __( 'Place AdSense In-feed ads between posts on homepage, category, and archive pages.', 'advanced-ads' ),
200
+ 'class' => 'free',
201
+ 'link' => wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'advanced-ads-adsense-in-feed'), 'install-plugin_' . 'advanced-ads-adsense-in-feed'),
202
+ 'link_title' => __( 'Install now', 'advanced-ads' ),
203
+ 'order' => 9,
204
  )
205
  );
206
 
209
  $installed_pro_plugins = 0;
210
 
211
  // handle Code Highlighter if already installed or not activated
212
+ if( isset( $installed_plugins['advanced-ads-code-highlighter/advanced-ads-code-highlighter.php'] ) ) {
 
 
 
213
  // remove plugin from the list
214
  unset( $add_ons['code-highlighter'] );
215
  }
216
 
217
+ // handle AdSense In-feed if already installed or not activated
218
+ if( isset( $installed_plugins['advanced-ads-adsense-in-feed/advanced-ads-in-feed.php'] ) ){ // is installed, but not active
219
+ // remove plugin from the list
220
+ unset( $add_ons['adsense-in-feed'] );
221
+ }
222
+
223
  // PRO
224
  if( isset( $installed_plugins['advanced-ads-pro/advanced-ads-pro.php'] ) && ! class_exists( 'Advanced_Ads_Pro') ){ // is installed, but not active
225
  $add_ons['pro']['link'] = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=advanced-ads-pro/advanced-ads-pro.php&amp', 'activate-plugin_advanced-ads-pro/advanced-ads-pro.php' );
231
  $add_ons['pro']['installed'] = true;
232
  $add_ons['pro']['order'] = 20;
233
  $installed_pro_plugins++;
234
+
235
+ // remove the add-on
236
+ if( $hide_activated ){
237
+ unset( $add_ons['pro'] );
238
+ }
239
  } elseif( $caching_used ) {
240
  // for now, "recommended" is always set for this plugin since there are so many advantages
241
  // $add_ons['pro']['class'] = 'recommended';
257
  $add_ons['tracking']['installed'] = true;
258
  $add_ons['tracking']['order'] = 20;
259
  $installed_pro_plugins++;
260
+
261
+ // remove the add-on
262
+ if( $hide_activated ){
263
+ unset( $add_ons['tracking'] );
264
+ }
265
  }
266
 
267
  // RESPONSIVE
275
  $add_ons['responsive']['installed'] = true;
276
  $add_ons['responsive']['order'] = 20;
277
  $installed_pro_plugins++;
278
+
279
+ // remove the add-on
280
+ if( $hide_activated ){
281
+ unset( $add_ons['responsive'] );
282
+ }
283
  }
284
 
285
  // STICKY
293
  $add_ons['sticky']['installed'] = true;
294
  $add_ons['sticky']['order'] = 20;
295
  $installed_pro_plugins++;
296
+
297
+ // remove the add-on
298
+ if( $hide_activated ){
299
+ unset( $add_ons['sticky'] );
300
+ }
301
  }
302
 
303
  // LAYER
311
  $add_ons['layer']['installed'] = true;
312
  $add_ons['layer']['order'] = 20;
313
  $installed_pro_plugins++;
314
+
315
+ // remove the add-on
316
+ if( $hide_activated ){
317
+ unset( $add_ons['layer'] );
318
+ }
319
  }
320
 
321
  // SELLING ADS
329
  $add_ons['selling']['installed'] = true;
330
  $add_ons['selling']['order'] = 20;
331
  $installed_pro_plugins++;
332
+
333
+ // remove the add-on
334
+ if( $hide_activated ){
335
+ unset( $add_ons['selling'] );
336
+ }
337
  }
338
 
339
  // GEO TARGETING
347
  $add_ons['geo']['installed'] = true;
348
  $add_ons['geo']['order'] = 20;
349
  $installed_pro_plugins++;
350
+
351
+ // remove the add-on
352
+ if( $hide_activated ){
353
+ unset( $add_ons['geo'] );
354
+ }
355
  }
356
 
357
  // SLIDER
363
  $add_ons['slider']['desc'] = '';
364
  $add_ons['slider']['installed'] = true;
365
  $add_ons['slider']['order'] = 20;
366
+
367
+ // remove the add-on
368
+ if( $hide_activated ){
369
+ unset( $add_ons['slider'] );
370
+ }
371
  }
372
 
373
  // add Genesis Ads, if Genesis based theme was detected
381
  'link_title' => __( 'Install now', 'advanced-ads' ),
382
  );
383
  // handle install link as long as we can not be sure this is done by the Genesis plugin itself
384
+ if( isset( $installed_plugins['genesis-ads/genesis-ads.php'] ) ){ // is installed, but not active
 
 
 
385
  unset( $add_ons['genesis'] );
386
  }
387
  }
397
  'link_title' => __( 'Install now', 'advanced-ads' ),
398
  );
399
  // handle install link as long as we can not be sure this is done by the Genesis plugin itself
400
+ if( isset( $installed_plugins['ads-for-visual-composer/advanced-ads-vc.php'] ) ){ // is installed, but not activated
 
 
 
401
  unset( $add_ons['visual_composer'] );
402
  }
403
  }
admin/includes/class-settings.php CHANGED
@@ -44,10 +44,34 @@ class Advanced_Ads_Admin_Settings {
44
  // general settings section
45
  add_settings_section(
46
  'advanced_ads_setting_section',
47
- __( 'General', 'advanced-ads' ),
48
  array($this, 'render_settings_section_callback'),
49
  $hook
50
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  // licenses section only for main blog
53
  if( is_main_site( get_current_blog_id() ) ){
@@ -56,12 +80,19 @@ class Advanced_Ads_Admin_Settings {
56
 
57
  add_settings_section(
58
  'advanced_ads_settings_license_section',
59
- __( 'Licenses', 'advanced-ads' ),
60
  array($this, 'render_settings_licenses_section_callback'),
61
  'advanced-ads-settings-license-page'
62
  );
63
 
64
  add_filter( 'advanced-ads-setting-tabs', array( $this, 'license_tab') );
 
 
 
 
 
 
 
65
  }
66
 
67
  // add setting fields to disable ads
@@ -210,6 +241,39 @@ class Advanced_Ads_Admin_Settings {
210
 
211
  return $tabs;
212
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
 
214
  /**
215
  * render settings section
@@ -231,6 +295,38 @@ class Advanced_Ads_Admin_Settings {
231
  // nonce field
232
  echo '<input type="hidden" id="advads-licenses-ajax-referrer" value="' . wp_create_nonce( "advads_ajax_license_nonce" ) . '"/>';
233
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
 
235
  /**
236
  * options to disable ads
44
  // general settings section
45
  add_settings_section(
46
  'advanced_ads_setting_section',
47
+ '',//__( 'General', 'advanced-ads' ),
48
  array($this, 'render_settings_section_callback'),
49
  $hook
50
  );
51
+
52
+ // Pro pitch section
53
+ if( ! defined( 'AAP_VERSION' ) ){
54
+ add_settings_section(
55
+ 'advanced_ads_settings_pro_pitch_section',
56
+ '',
57
+ array($this, 'render_settings_pro_pitch_section_callback'),
58
+ 'advanced-ads-settings-pro-pitch-page'
59
+ );
60
+
61
+ add_filter( 'advanced-ads-setting-tabs', array( $this, 'pro_pitch_tab') );
62
+ }
63
+
64
+ // Tracking pitch section
65
+ if( ! defined( 'AAT_VERSION' ) ){
66
+ add_settings_section(
67
+ 'advanced_ads_settings_tracking_pitch_section',
68
+ '',
69
+ array($this, 'render_settings_tracking_pitch_section_callback'),
70
+ 'advanced-ads-settings-tracking-pitch-page'
71
+ );
72
+
73
+ add_filter( 'advanced-ads-setting-tabs', array( $this, 'tracking_pitch_tab') );
74
+ }
75
 
76
  // licenses section only for main blog
77
  if( is_main_site( get_current_blog_id() ) ){
80
 
81
  add_settings_section(
82
  'advanced_ads_settings_license_section',
83
+ '', //__( 'Licenses', 'advanced-ads' ),
84
  array($this, 'render_settings_licenses_section_callback'),
85
  'advanced-ads-settings-license-page'
86
  );
87
 
88
  add_filter( 'advanced-ads-setting-tabs', array( $this, 'license_tab') );
89
+
90
+ add_settings_section(
91
+ 'advanced_ads_settings_license_pitch_section',
92
+ '', //__( 'Licenses', 'advanced-ads' ),
93
+ array($this, 'render_settings_licenses_pitch_section_callback'),
94
+ 'advanced-ads-settings-license-page'
95
+ );
96
  }
97
 
98
  // add setting fields to disable ads
241
 
242
  return $tabs;
243
  }
244
+
245
+ /**
246
+ * add pro pitch tab
247
+ *
248
+ * arr $tabs setting tabs
249
+ */
250
+ public function pro_pitch_tab( array $tabs ){
251
+
252
+ $tabs['pro_pitch'] = array(
253
+ 'page' => 'advanced-ads-settings-pro-pitch-page',
254
+ //'group' => ADVADS_SLUG . '-pro-pitch',
255
+ 'tabid' => 'pro-pitch',
256
+ 'title' => __( 'Pro', 'advanced-ads' )
257
+ );
258
+
259
+ return $tabs;
260
+ }
261
+
262
+ /**
263
+ * add tracking pitch tab
264
+ *
265
+ * arr $tabs setting tabs
266
+ */
267
+ public function tracking_pitch_tab( array $tabs ){
268
+
269
+ $tabs['tracking_pitch'] = array(
270
+ 'page' => 'advanced-ads-settings-tracking-pitch-page',
271
+ 'tabid' => 'tracking-pitch',
272
+ 'title' => __( 'Tracking', 'advanced-ads' )
273
+ );
274
+
275
+ return $tabs;
276
+ }
277
 
278
  /**
279
  * render settings section
295
  // nonce field
296
  echo '<input type="hidden" id="advads-licenses-ajax-referrer" value="' . wp_create_nonce( "advads_ajax_license_nonce" ) . '"/>';
297
  }
298
+
299
+ /**
300
+ * render licenses pithces settings section
301
+ *
302
+ * @since 1.8.12
303
+ */
304
+ public function render_settings_licenses_pitch_section_callback(){
305
+
306
+ echo '<h3>' . __( 'Are you missing something?', 'advanced-ads' ) . '</h3>';
307
+
308
+ Advanced_Ads_Overview_Widgets_Callbacks::render_addons( $hide_activated = true );
309
+ }
310
+
311
+ /**
312
+ * render pro pitch settings section
313
+ *
314
+ * @since 1.8.12
315
+ */
316
+ public function render_settings_pro_pitch_section_callback(){
317
+ echo '<br/>';
318
+ include ADVADS_BASE_PATH . 'admin/views/pitch-pro-tab.php';
319
+ }
320
+
321
+ /**
322
+ * render tracking pitch settings section
323
+ *
324
+ * @since 1.8.12
325
+ */
326
+ public function render_settings_tracking_pitch_section_callback(){
327
+ echo '<br/>';
328
+ include ADVADS_BASE_PATH . 'admin/views/pitch-tracking.php';
329
+ }
330
 
331
  /**
332
  * options to disable ads
admin/views/ad-display-metabox.php CHANGED
@@ -1,8 +1,20 @@
1
  <?php
2
- $display_conditions = Advanced_Ads_Display_Conditions::get_instance()->conditions;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  $options = $ad->options('conditions');
4
- // error_log(print_r($display_conditions, true));
5
- // error_log(print_r($options, true));
6
  $empty_options = ( !is_array( $options ) || !count( $options ) );
7
  if( $empty_options ) :
8
  ?><div class="advads-show-in-wizard">
@@ -83,8 +95,15 @@ endif;
83
  <option value=""><?php _e('-- choose a condition --', 'advanced-ads'); ?></option>
84
  <?php foreach ($display_conditions as $_condition_id => $_condition) : ?>
85
  <option value="<?php echo $_condition_id; ?>"><?php echo $_condition['label']; ?></option>
86
- <?php endforeach; ?>
87
- </select>
 
 
 
 
 
 
 
88
  <button type="button" class="button"><?php _e('add', 'advanced-ads'); ?></button>
89
  <span class="advads-loader" style="display: none;"></span>
90
  </div>
1
  <?php
2
+ $display_conditions = Advanced_Ads_Display_Conditions::get_instance()->get_conditions();
3
+
4
+ // add mockup conditions if add-ons are missing
5
+ $pro_conditions = array();
6
+ if( ! defined( 'AAP_VERSION' ) ){
7
+ $pro_conditions[] = __( 'parent page', 'advanced-ads');
8
+ $pro_conditions[] = __( 'post meta', 'advanced-ads');
9
+ $pro_conditions[] = __( 'page template', 'advanced-ads');
10
+ $pro_conditions[] = __( 'url parameters', 'advanced-ads');
11
+ }
12
+ if( ! defined( 'AAR_VERSION') ){
13
+ $pro_conditions[] = __( 'accelerated mobile pages', 'advanced-ads');
14
+ }
15
+ asort( $pro_conditions );
16
+
17
  $options = $ad->options('conditions');
 
 
18
  $empty_options = ( !is_array( $options ) || !count( $options ) );
19
  if( $empty_options ) :
20
  ?><div class="advads-show-in-wizard">
95
  <option value=""><?php _e('-- choose a condition --', 'advanced-ads'); ?></option>
96
  <?php foreach ($display_conditions as $_condition_id => $_condition) : ?>
97
  <option value="<?php echo $_condition_id; ?>"><?php echo $_condition['label']; ?></option>
98
+ <?php endforeach;
99
+ if( count( $pro_conditions ) ) :
100
+ ?><optgroup label="<?php _e( 'Add-On features', 'advanced-ads' ); ?>"><?php
101
+ foreach ( $pro_conditions as $_pro_condition ) :
102
+ ?><option disabled="disabled"><?php echo $_pro_condition; ?></option><?php
103
+ endforeach;
104
+ ?></optgroup><?php
105
+ endif;
106
+ ?></select>
107
  <button type="button" class="button"><?php _e('add', 'advanced-ads'); ?></button>
108
  <span class="advads-loader" style="display: none;"></span>
109
  </div>
admin/views/ad-visitor-metabox.php CHANGED
@@ -1,5 +1,27 @@
1
  <?php
2
- $visitor_conditions = Advanced_Ads_Visitor_Conditions::get_instance()->conditions;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  $options = $ad->options( 'visitors' );
4
  $empty_options = ( !is_array( $options ) || !count( $options ) );
5
  if( $empty_options ) :
@@ -59,8 +81,15 @@ endif;
59
  <?php if( empty( $_condition['disabled'] ) ) : ?>
60
  <option value="<?php echo $_condition_id; ?>"><?php echo $_condition['label']; ?></option>
61
  <?php endif; ?>
62
- <?php endforeach; ?>
63
- </select>
 
 
 
 
 
 
 
64
  <button type="button" class="button"><?php _e( 'add', 'advanced-ads' ); ?></button>
65
  <span class="advads-loader" style="display: none;"></span>
66
  </div>
1
  <?php
2
+ $visitor_conditions = Advanced_Ads_Visitor_Conditions::get_instance()->get_conditions();
3
+
4
+ // add mockup conditions if add-ons are missing
5
+ $pro_conditions = array();
6
+ if( ! defined( 'AAP_VERSION' ) ){
7
+ $pro_conditions[] = __( 'browser language', 'advanced-ads');
8
+ $pro_conditions[] = __( 'cookie', 'advanced-ads');
9
+ $pro_conditions[] = __( 'max. ad clicks', 'advanced-ads');
10
+ $pro_conditions[] = __( 'max. ad impressions', 'advanced-ads');
11
+ $pro_conditions[] = __( 'new visitor', 'advanced-ads');
12
+ $pro_conditions[] = __( 'page impressions', 'advanced-ads');
13
+ $pro_conditions[] = __( 'referrer url', 'advanced-ads');
14
+ $pro_conditions[] = __( 'user agent', 'advanced-ads');
15
+ $pro_conditions[] = __( 'user can (capabilities)', 'advanced-ads');
16
+ }
17
+ if( ! defined( 'AAGT_VERSION') ){
18
+ $pro_conditions[] = __( 'geo location', 'advanced-ads');
19
+ }
20
+ if( ! defined( 'AAR_VERSION') ){
21
+ $pro_conditions[] = __( 'browser width', 'advanced-ads');
22
+ }
23
+ asort( $pro_conditions );
24
+
25
  $options = $ad->options( 'visitors' );
26
  $empty_options = ( !is_array( $options ) || !count( $options ) );
27
  if( $empty_options ) :
81
  <?php if( empty( $_condition['disabled'] ) ) : ?>
82
  <option value="<?php echo $_condition_id; ?>"><?php echo $_condition['label']; ?></option>
83
  <?php endif; ?>
84
+ <?php endforeach;
85
+ if( count( $pro_conditions ) ) :
86
+ ?><optgroup label="<?php _e( 'Add-On features', 'advanced-ads' ); ?>"><?php
87
+ foreach ( $pro_conditions as $_pro_condition ) :
88
+ ?><option disabled="disabled"><?php echo $_pro_condition; ?></option><?php
89
+ endforeach;
90
+ ?></optgroup><?php
91
+ endif;
92
+ ?></select>
93
  <button type="button" class="button"><?php _e( 'add', 'advanced-ads' ); ?></button>
94
  <span class="advads-loader" style="display: none;"></span>
95
  </div>
admin/views/pitch-bundle.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3><?php _e( 'Pro Bundle – with all available add-ons', 'advanced-ads' ); ?></h3>
2
+ <ul>
3
+ <li><span class="dashicons dashicons-yes"></span><?php echo 'Advanced Ads Pro'; ?></li>
4
+ <li><span class="dashicons dashicons-yes"></span><?php echo 'Tracking'; ?></li>
5
+ <li><span class="dashicons dashicons-yes"></span><?php echo 'Responsive, AMP and Mobile ads'; ?></li>
6
+ <li><span class="dashicons dashicons-yes"></span><?php echo 'Selling Ads'; ?></li>
7
+ <li><span class="dashicons dashicons-yes"></span><?php echo 'Geo Targeting'; ?></li>
8
+ <li><span class="dashicons dashicons-yes"></span><?php echo 'Sticky Ads'; ?></li>
9
+ <li><span class="dashicons dashicons-yes"></span><?php echo 'PopUp Ads'; ?></li>
10
+ <li><span class="dashicons dashicons-yes"></span><?php echo 'Ad Slider'; ?></li>
11
+ </ul>
12
+ <p><?php _e( 'Risk free with 30-day Money-Back guarantee', 'advanced-ads' ); ?></p>
13
+ <a class="button button-primary" href="<?php echo ADVADS_URL; ?>add-ons/pro-bundle/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-bundle" target="_blank"><?php _e( 'Get the Pro Bundle', 'advanced-ads' ); ?></a>
admin/views/pitch-pro-tab.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="advads-pro-pitch postbox">
2
+ <h3><?php _e( 'Advanced Ads Pro – test and optimize your ad performance', 'advanced-ads' ); ?></h3>
3
+ <ul>
4
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'Ads for Ad Blockers', 'advanced-ads' ); ?></li>
5
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'Click Fraud Protection', 'advanced-ads' ); ?></li>
6
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'Lazy Loading', 'advanced-ads' ); ?></li>
7
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'support for cached sites', 'advanced-ads' ); ?></li>
8
+ <li><span class="dashicons dashicons-yes"></span><?php _e( '11 more display and visitor conditions', 'advanced-ads' ); ?></li>
9
+ <li><span class="dashicons dashicons-yes"></span><?php _e( '6 more placements', 'advanced-ads' ); ?></li>
10
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'placement tests for ad optimization', 'advanced-ads' ); ?></li>
11
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'ad grids and many more advanced features', 'advanced-ads' ); ?></li>
12
+ </ul>
13
+ <a class="button button-primary" href="<?php echo ADVADS_URL; ?>add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-pro" target="_blank"><?php _e( 'See all features and pricing', 'advanced-ads' ); ?></a>
14
+ </div>
15
+ <div class="advads-pro-pitch postbox">
16
+ <?php include ADVADS_BASE_PATH . 'admin/views/pitch-bundle.php'; ?>
17
+ </div>
18
+ <div class="clear"></div>
admin/views/pitch-tracking.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="advads-pro-pitch postbox">
2
+ <h3><?php _e( 'Tracking', 'advanced-ads' ); ?></h3>
3
+ <ul>
4
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'track impressions and click on your ads', 'advanced-ads' ); ?></li>
5
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'compare ads and periods', 'advanced-ads' ); ?></li>
6
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'share reports via link or email', 'advanced-ads' ); ?></li>
7
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'limit ads views by overall number of impressions or clicks', 'advanced-ads' ); ?></li>
8
+ <li><span class="dashicons dashicons-yes"></span><?php _e( 'spread impressions or clicks equally over a given period', 'advanced-ads' ); ?></li>
9
+ </ul>
10
+ <a class="button button-primary" href="<?php echo ADVADS_URL; ?>add-ons/tracking/#utm_source=advanced-ads&utm_medium=link&utm_campaign=pitch-tracking" target="_blank"><?php _e( 'See all features and pricing', 'advanced-ads' ); ?></a>
11
+ </div>
12
+ <div class="clear"></div>
admin/views/placement-injection-top.php CHANGED
@@ -24,6 +24,9 @@ if( isset( $_GET['message'] ) && 6 === $_GET['message'] ) : ?>
24
  else :
25
  ?><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="custom_position" style="background-image: url(<?php echo ADVADS_BASE_URL . 'admin/assets/img/placements/custom-position.png'; ?>)"><?php _e( 'Custom Position', 'advanced-ads'); ?></button></div><?php
26
  endif;
 
 
 
27
 
28
  if( ! defined( 'AASADS_VERSION' ) ) :
29
  ?><a href="<?php echo ADVADS_URL . 'add-ons/sticky-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-created-injection-sticky' ?>" target="_blank"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary advads-pro-link" style="background-image: url(<?php echo ADVADS_BASE_URL . 'admin/assets/img/placements/sticky-sidebar-left.png'; ?>)"><?php _e( 'Show Sticky Places', 'advanced-ads'); ?></button></div></a><?php
24
  else :
25
  ?><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="custom_position" style="background-image: url(<?php echo ADVADS_BASE_URL . 'admin/assets/img/placements/custom-position.png'; ?>)"><?php _e( 'Custom Position', 'advanced-ads'); ?></button></div><?php
26
  endif;
27
+ if( class_exists( 'Advanced_Ads_In_Feed', false ) ) :
28
+ ?><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="adsense_in_feed" style="background-image: url(<?php echo ADVADS_BASE_URL . 'admin/assets/img/placements/adsense-in-feed.png'; ?>)"><?php _e( 'AdSense In-feed', 'advanced-ads'); ?></button></div><?php
29
+ endif;
30
 
31
  if( ! defined( 'AASADS_VERSION' ) ) :
32
  ?><a href="<?php echo ADVADS_URL . 'add-ons/sticky-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-created-injection-sticky' ?>" target="_blank"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary advads-pro-link" style="background-image: url(<?php echo ADVADS_BASE_URL . 'admin/assets/img/placements/sticky-sidebar-left.png'; ?>)"><?php _e( 'Show Sticky Places', 'advanced-ads'); ?></button></div></a><?php
admin/views/settings.php CHANGED
@@ -15,12 +15,12 @@ $setting_tabs = apply_filters('advanced-ads-setting-tabs', array(
15
  ?><div class="wrap">
16
  <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
17
  <?php settings_errors(); ?>
18
- <h2 class="nav-tab-wrapper" id="advads-tabs">
19
  <?php foreach ( $setting_tabs as $_setting_tab_id => $_setting_tab ) : ?>
20
  <a class="nav-tab" id="<?php echo $_setting_tab_id; ?>-tab"
21
  href="#top#<?php echo $_setting_tab_id; ?>"><?php echo $_setting_tab['title']; ?></a>
22
  <?php endforeach; ?>
23
- </h2>
24
  <?php foreach ( $setting_tabs as $_setting_tab_id => $_setting_tab ) : ?>
25
  <div id="<?php echo $_setting_tab_id; ?>" class="advads-tab">
26
  <form class="advads-settings-tab-main-form" method="post" action="options.php">
@@ -37,6 +37,11 @@ $setting_tabs = apply_filters('advanced-ads-setting-tabs', array(
37
  ?>
38
  </form>
39
  <?php do_action( 'advanced-ads-settings-tab-after-form', $_setting_tab_id, $_setting_tab ); ?>
 
 
 
 
 
40
  </div>
41
  <?php endforeach; ?>
42
  <?php
@@ -44,12 +49,6 @@ $setting_tabs = apply_filters('advanced-ads-setting-tabs', array(
44
  // print the filesystem credentials modal if needed
45
  Advanced_Ads_Filesystem::get_instance()->print_request_filesystem_credentials_modal();
46
  ?>
47
- <ul>
48
-
49
- <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=advanced-ads-import-export' ) ); ?>"><?php _e( 'Import &amp; Export', 'advanced-ads' ); ?></a></li>
50
- <li><a href="http://wordpress.org/plugins/advanced-ads/" title="<?php _e( 'Advanced Ads on WordPress.org', 'advanced-ads' ); ?>"><?php _e( 'Advanced Ads on wp.org', 'advanced-ads' ); ?></a></li>
51
- <li><a href="http://webgilde.com" title="<?php _e( 'the company behind Advanced Ads', 'advanced-ads' ); ?>"><?php echo 'webgilde GmbH'; ?></a></li>
52
- </ul>
53
 
54
  </div>
55
  <script>
15
  ?><div class="wrap">
16
  <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
17
  <?php settings_errors(); ?>
18
+ <div class="nav-tab-wrapper" id="advads-tabs">
19
  <?php foreach ( $setting_tabs as $_setting_tab_id => $_setting_tab ) : ?>
20
  <a class="nav-tab" id="<?php echo $_setting_tab_id; ?>-tab"
21
  href="#top#<?php echo $_setting_tab_id; ?>"><?php echo $_setting_tab['title']; ?></a>
22
  <?php endforeach; ?>
23
+ </div>
24
  <?php foreach ( $setting_tabs as $_setting_tab_id => $_setting_tab ) : ?>
25
  <div id="<?php echo $_setting_tab_id; ?>" class="advads-tab">
26
  <form class="advads-settings-tab-main-form" method="post" action="options.php">
37
  ?>
38
  </form>
39
  <?php do_action( 'advanced-ads-settings-tab-after-form', $_setting_tab_id, $_setting_tab ); ?>
40
+ <?php if( 'general' === $_setting_tab_id ) : ?>
41
+ <ul>
42
+ <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=advanced-ads-import-export' ) ); ?>"><?php _e( 'Import &amp; Export', 'advanced-ads' ); ?></a></li>
43
+ </ul>
44
+ <?php endif; ?>
45
  </div>
46
  <?php endforeach; ?>
47
  <?php
49
  // print the filesystem credentials modal if needed
50
  Advanced_Ads_Filesystem::get_instance()->print_request_filesystem_credentials_modal();
51
  ?>
 
 
 
 
 
 
52
 
53
  </div>
54
  <script>
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.8.11
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.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, textdomain
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.8.11' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.8.12
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
39
  // general and global slug, e.g. to store options in WP, textdomain
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
+ define( 'ADVADS_VERSION', '1.8.12' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/ad_type_content.php CHANGED
@@ -148,9 +148,7 @@ class Advanced_Ads_Ad_Type_Content extends Advanced_Ads_Ad_Type_Abstract{
148
  public function save_ad_options( $options, $ad ) {
149
  if ( $ad->type === $this->ID ) {
150
  $pattern = get_shortcode_regex( array( 'the_ad', 'the_ad_group', 'the_ad_placement' ) );
151
- if ( preg_match( '/' . $pattern . '/s', $ad->content, $matches ) ) {
152
- $options['output']['has_shortcode'] = true;
153
- };
154
  }
155
  return $options;
156
  }
@@ -164,7 +162,7 @@ class Advanced_Ads_Ad_Type_Content extends Advanced_Ads_Ad_Type_Abstract{
164
  private function do_shortcode( $output, Advanced_Ads_Ad $ad ) {
165
  $ad_options = $ad->options();
166
 
167
- if ( ! empty( $ad_options['output']['has_shortcode'] ) ) {
168
  // Store arguments so that shortcode hooks can access it.
169
  $ad_args = $ad->args;
170
  $ad_args['shortcode_ad_id'] = $ad->id;
148
  public function save_ad_options( $options, $ad ) {
149
  if ( $ad->type === $this->ID ) {
150
  $pattern = get_shortcode_regex( array( 'the_ad', 'the_ad_group', 'the_ad_placement' ) );
151
+ $options['output']['has_shortcode'] = preg_match( '/' . $pattern . '/s', $ad->content );
 
 
152
  }
153
  return $options;
154
  }
162
  private function do_shortcode( $output, Advanced_Ads_Ad $ad ) {
163
  $ad_options = $ad->options();
164
 
165
+ if ( ! isset( $ad_options['output']['has_shortcode'] ) || $ad_options['output']['has_shortcode'] ) {
166
  // Store arguments so that shortcode hooks can access it.
167
  $ad_args = $ad->args;
168
  $ad_args['shortcode_ad_id'] = $ad->id;
classes/display-conditions.php CHANGED
@@ -137,8 +137,6 @@ class Advanced_Ads_Display_Conditions {
137
  endforeach;
138
 
139
  $this->conditions = apply_filters('advanced-ads-display-conditions', $conditions);
140
-
141
- ksort($this->conditions);
142
  }
143
 
144
  /**
@@ -153,6 +151,18 @@ class Advanced_Ads_Display_Conditions {
153
 
154
  return self::$instance;
155
  }
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
  /**
158
  * controls frontend checks for conditions
137
  endforeach;
138
 
139
  $this->conditions = apply_filters('advanced-ads-display-conditions', $conditions);
 
 
140
  }
141
 
142
  /**
151
 
152
  return self::$instance;
153
  }
154
+
155
+
156
+ /**
157
+ * get the conditions array alphabetically by label
158
+ *
159
+ * @since 1.8.12
160
+ */
161
+ public function get_conditions(){
162
+ uasort( $this->conditions, 'Advanced_Ads_Admin::sort_condition_array_by_label' );
163
+
164
+ return $this->conditions;
165
+ }
166
 
167
  /**
168
  * controls frontend checks for conditions
classes/visitor-conditions.php CHANGED
@@ -42,8 +42,6 @@ class Advanced_Ads_Visitor_Conditions {
42
  'check' => array( 'Advanced_Ads_Visitor_Conditions', 'check_logged_in' ) // callback for frontend check
43
  ),
44
  ));
45
-
46
- ksort( $this->conditions );
47
  }
48
 
49
  /**
@@ -58,6 +56,18 @@ class Advanced_Ads_Visitor_Conditions {
58
 
59
  return self::$instance;
60
  }
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  /**
63
  * callback to render the mobile condition using the "is not" condition
42
  'check' => array( 'Advanced_Ads_Visitor_Conditions', 'check_logged_in' ) // callback for frontend check
43
  ),
44
  ));
 
 
45
  }
46
 
47
  /**
56
 
57
  return self::$instance;
58
  }
59
+
60
+
61
+ /**
62
+ * get the conditions array alphabetically by label
63
+ *
64
+ * @since 1.8.12
65
+ */
66
+ public function get_conditions(){
67
+ uasort( $this->conditions, 'Advanced_Ads_Admin::sort_condition_array_by_label' );
68
+
69
+ return $this->conditions;
70
+ }
71
 
72
  /**
73
  * callback to render the mobile condition using the "is not" condition
modules/ad-blocker/admin/views/setting-use-adblocker.php CHANGED
@@ -3,4 +3,7 @@
3
  <?php else: ?>
4
  <?php _e( 'The ad block disguise can only be set by the super admin on the main site in the network.', 'advanced-ads' ); ?>
5
  <?php endif ?>
6
- <p class="description"><?php _e( 'Prevents ad block software from breaking your website when blocking asset files (.js, .css).', 'advanced-ads' ); ?></p>
 
 
 
3
  <?php else: ?>
4
  <?php _e( 'The ad block disguise can only be set by the super admin on the main site in the network.', 'advanced-ads' ); ?>
5
  <?php endif ?>
6
+ <p class="description"><?php _e( 'Prevents ad block software from breaking your website when blocking asset files (.js, .css).', 'advanced-ads' ); ?></p>
7
+ <?php if( ! defined('AAP_VERSION') ) : ?>
8
+ <p><?php printf(__( 'Learn how to display alternative content to ad block users <a href="%s" target="_blank">in the manual</a>.', 'advanced-ads' ), ADVADS_URL . '/manual/ad-blockers/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adblock-manual' ); ?></p>
9
+ <?php endif;
modules/gadsense/admin/admin.php CHANGED
@@ -121,7 +121,7 @@ class Advanced_Ads_AdSense_Admin {
121
  // add new section
122
  add_settings_section(
123
  'advanced_ads_adsense_setting_section',
124
- __( 'AdSense', 'advanced-ads' ),
125
  array($this, 'render_settings_section_callback'),
126
  $hook
127
  );
@@ -354,6 +354,21 @@ class Advanced_Ads_AdSense_Admin {
354
  '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' ),
355
  'class' => 'advads-ad-notice-responsive-position error hidden',
356
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  // show hint about Content ad, Link unit or Matched content being defined in AdSense account
358
  // disabled since it might no longer be needed with the new ad types
359
  /* if( 'adsense' === $ad->type ){
121
  // add new section
122
  add_settings_section(
123
  'advanced_ads_adsense_setting_section',
124
+ '', //__( 'AdSense', 'advanced-ads' ),
125
  array($this, 'render_settings_section_callback'),
126
  $hook
127
  );
354
  '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' ),
355
  'class' => 'advads-ad-notice-responsive-position error hidden',
356
  );
357
+ // show hint about AdSense In-feed add-on
358
+ if( ! class_exists( 'Advanced_Ads_In_Feed', false ) ){
359
+ $notices[] = array(
360
+ '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') ),
361
+ 'class' => 'advads-ad-notice-in-feed-add-on hidden',
362
+ );
363
+ }
364
+ // show message about Responsive add-on
365
+ if ( ! defined( 'AAR_SLUG' ) ) {
366
+ $notices[] = array(
367
+ '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' ),
368
+ 'class' => 'advads-ad-notice-responsive-add-on',
369
+ );
370
+ }
371
+
372
  // show hint about Content ad, Link unit or Matched content being defined in AdSense account
373
  // disabled since it might no longer be needed with the new ad types
374
  /* if( 'adsense' === $ad->type ){
modules/gadsense/admin/assets/js/new-ad.js CHANGED
@@ -209,7 +209,7 @@
209
  $( '.advads-adsense-layout' ).next('div').hide();
210
  $( '.advads-adsense-layout-key' ).hide();
211
  $( '.advads-adsense-layout-key' ).next('div').hide();
212
- $( '#advads-adsense-infeed-tutorial' ).hide();
213
  if ( 'responsive' == type || 'link-responsive' == type || 'matched-content' == type ) {
214
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
215
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
@@ -222,7 +222,8 @@
222
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
223
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
224
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
225
- $( '#advads-adsense-infeed-tutorial' ).show();
 
226
  } else if ( 'in-article' == type ) {
227
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
228
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
209
  $( '.advads-adsense-layout' ).next('div').hide();
210
  $( '.advads-adsense-layout-key' ).hide();
211
  $( '.advads-adsense-layout-key' ).next('div').hide();
212
+ $( '.advads-ad-notice-in-feed-add-on' ).hide();
213
  if ( 'responsive' == type || 'link-responsive' == type || 'matched-content' == type ) {
214
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
215
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
222
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
223
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
224
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
225
+ // show add-on notice
226
+ $( '.advads-ad-notice-in-feed-add-on' ).show();
227
  } else if ( 'in-article' == type ) {
228
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
229
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
modules/gadsense/admin/views/adsense-ad-parameters.php CHANGED
@@ -66,10 +66,6 @@ if( $pub_id_errors ) : ?>
66
  <a href="<?php echo ADVADS_URL . 'manual/adsense-ads/#adsense-ad-types'; ?>" target="_blank"><?php _e( 'manual', 'advanced-ads' ); ?></a>
67
  </div>
68
  <hr/>
69
- <?php if ( ! defined( 'AAR_SLUG' ) ) : ?>
70
- <p><?php printf( __( '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' ); ?></p>
71
- <?php else : ?>
72
- <?php endif; ?>
73
  <label class="label" <?php if ( ! $is_responsive || 2 > count( $sizing_array ) ) { echo 'style="display: none;"'; } ?> id="resize-label"><?php _e( 'Resizing', 'advanced-ads' ); ?></label>
74
  <div <?php if ( ! $is_responsive || 2 > count( $sizing_array ) ) { echo 'style="display: none;"'; } ?>>
75
  <select name="ad-resize-type" id="ad-resize-type">
@@ -78,7 +74,6 @@ if( $pub_id_errors ) : ?>
78
  <?php endforeach; ?>
79
  </select>
80
  </div>
81
- <p id="advads-adsense-infeed-tutorial" <?php if ( 'in-feed' !== $unit_type ) { echo 'style="display: none;"'; } ?>><a href="<?php echo ADVADS_URL . 'insert-ads-between-posts-wordpress/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-between-posts'; ?>" target="_blank"><?php _e( 'Tutorial: How to place ads between posts?', 'advanced-ads' ); ?></a></p>
82
  <label class="label advads-adsense-layout" <?php if ( 'in-feed' !== $unit_type ) { echo 'style="display: none;"'; } ?> id="advads-adsense-layout"><?php _e( 'Layout', 'advanced-ads' ); ?></label>
83
  <div <?php if ( 'in-feed' !== $unit_type ) { echo 'style="display: none;"'; } ?>>
84
  <input name="ad-layout" id="ad-layout" value="<?php echo isset( $layout ) ? $layout : ''; ?>"/>
66
  <a href="<?php echo ADVADS_URL . 'manual/adsense-ads/#adsense-ad-types'; ?>" target="_blank"><?php _e( 'manual', 'advanced-ads' ); ?></a>
67
  </div>
68
  <hr/>
 
 
 
 
69
  <label class="label" <?php if ( ! $is_responsive || 2 > count( $sizing_array ) ) { echo 'style="display: none;"'; } ?> id="resize-label"><?php _e( 'Resizing', 'advanced-ads' ); ?></label>
70
  <div <?php if ( ! $is_responsive || 2 > count( $sizing_array ) ) { echo 'style="display: none;"'; } ?>>
71
  <select name="ad-resize-type" id="ad-resize-type">
74
  <?php endforeach; ?>
75
  </select>
76
  </div>
 
77
  <label class="label advads-adsense-layout" <?php if ( 'in-feed' !== $unit_type ) { echo 'style="display: none;"'; } ?> id="advads-adsense-layout"><?php _e( 'Layout', 'advanced-ads' ); ?></label>
78
  <div <?php if ( 'in-feed' !== $unit_type ) { echo 'style="display: none;"'; } ?>>
79
  <input name="ad-layout" id="ad-layout" value="<?php echo isset( $layout ) ? $layout : ''; ?>"/>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: ads, ad, ad inserter, ad injection, ad manager, ads manager, ad widget, ad
5
  Requires at least: 4.6
6
  Tested up to: 4.8
7
  Requires PHP: 5.2
8
- Stable tag: 1.8.11
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -229,6 +229,12 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
229
 
230
  == Changelog ==
231
 
 
 
 
 
 
 
232
  = 1.8.11 =
233
 
234
  * added option to make AdSense background transparent
5
  Requires at least: 4.6
6
  Tested up to: 4.8
7
  Requires PHP: 5.2
8
+ Stable tag: 1.8.12
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
229
 
230
  == Changelog ==
231
 
232
+ = 1.8.12 =
233
+
234
+ * linked the new [AdSense In-feed add-on](https://wordpress.org/plugins/advanced-ads-adsense-in-feed/) where needed
235
+ * optimized settings page layout
236
+ * process Advanced Ads shortcodes correctly when they are nested inside Rich Content ads
237
+
238
  = 1.8.11 =
239
 
240
  * added option to make AdSense background transparent