Advanced Ads - Version 1.10

Version Description

  • added AdSense integration
  • added sub menus to setting pages
  • added name to taxonomies in Display Conditions if the same label is repeated
  • added clearfix option to fix possible layout issue with AdSense responsive ads
  • removed title attribute from image ads
  • plugin update warning now only appears for Advanced Ads plugin and add-ons
  • rewritten filters on ad list to work with all ads not just those on the current page
  • allowed to create new placement with same name
  • fixed issue with license activations on sites using the Multilanguage by BestWebSoft plugin
  • fixed duplicate queries in backend
  • fixed possible conflict between assets created by the Ad Blocker module
  • WP Rocket: compatibility with the recent version of deferred JavaScript
Download this release

Release Info

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

Code changes from version 1.9 to 1.10

Files changed (82) hide show
  1. admin/assets/css/admin.css +31 -4
  2. admin/assets/js/admin-global.js +1 -1
  3. admin/assets/js/admin.js +5 -83
  4. admin/class-advanced-ads-admin.php +392 -237
  5. admin/includes/class-ad-type.php +4 -11
  6. admin/includes/class-licenses.php +18 -1
  7. admin/includes/class-list-filters.php +463 -0
  8. admin/includes/class-notices.php +18 -1
  9. admin/includes/notices.php +2 -1
  10. admin/views/ad-conditions-string-operators.php +12 -0
  11. admin/views/ad-list-filters.php +40 -10
  12. admin/views/feedback-disable.php +4 -8
  13. admin/views/notices/error.php +1 -1
  14. admin/views/notices/info.php +1 -1
  15. admin/views/notices/inline.php +1 -1
  16. admin/views/notices/jqueryui_error.php +1 -1
  17. admin/views/notices/plugin_error.php +1 -1
  18. admin/views/notices/subscribe.php +1 -1
  19. admin/views/notices/welcome-panel.php +27 -0
  20. admin/views/settings.php +25 -1
  21. advanced-ads.php +2 -2
  22. classes/ad.php +5 -0
  23. classes/ad_ajax_callbacks.php +1 -12
  24. classes/ad_placements.php +15 -0
  25. classes/ad_type_image.php +2 -5
  26. classes/checks.php +9 -6
  27. classes/compatibility.php +15 -0
  28. classes/display-conditions.php +15 -3
  29. classes/plugin.php +1 -1
  30. classes/visitor-conditions.php +2 -12
  31. composer.lock +9 -6
  32. languages/advanced-ads.pot +587 -409
  33. modules/ad-blocker/admin/admin.php +14 -5
  34. modules/gadsense/admin/admin.php +25 -16
  35. modules/gadsense/admin/assets/js/mapi-settings.js +124 -0
  36. modules/gadsense/admin/assets/js/new-ad.js +461 -19
  37. modules/gadsense/admin/views/adsense-account.php +179 -0
  38. modules/gadsense/admin/views/adsense-ad-parameters.php +50 -5
  39. modules/gadsense/admin/views/mapi-ad-selector.php +55 -0
  40. modules/gadsense/config.php +1 -0
  41. modules/gadsense/includes/class-ad-type-adsense.php +3 -1
  42. modules/gadsense/includes/class-mapi.php +722 -0
  43. modules/gadsense/main.php +4 -0
  44. modules/import-export/classes/import.php +2 -0
  45. modules/privacy/admin/views/setting-enable.php +2 -1
  46. public/class-advanced-ads.php +270 -234
  47. readme.txt +37 -11
  48. vendor/autoload.php +1 -1
  49. vendor/autoload_52.php +1 -1
  50. vendor/composer/ClassLoader.php +18 -50
  51. vendor/composer/LICENSE +1 -1
  52. vendor/composer/autoload_classmap.php +1 -87
  53. vendor/composer/autoload_real.php +18 -20
  54. vendor/composer/autoload_real_52.php +3 -3
  55. vendor/composer/installed.json +50 -47
  56. vendor/composer/installers/CHANGELOG.md +17 -0
  57. vendor/composer/installers/README.md +5 -2
  58. vendor/composer/installers/composer.json +4 -1
  59. vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +0 -1
  60. vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php +4 -1
  61. vendor/composer/installers/src/Composer/Installers/Installer.php +7 -8
  62. vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php +37 -0
  63. vendor/composer/installers/src/Composer/Installers/ModxInstaller.php +12 -0
  64. vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php +3 -3
  65. vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php +63 -0
  66. vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php +2 -2
  67. vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php +1 -2
  68. vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php +25 -0
  69. vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php +1 -0
  70. vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php +2 -1
  71. vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php +1 -2
  72. vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php +0 -1
  73. vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php +2 -1
  74. vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php +17 -1
  75. vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php +2 -1
  76. vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php +2 -1
  77. vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php +3 -2
  78. vendor/composer/installers/tests/Composer/Installers/Test/OntoWikiInstallerTest.php +2 -3
  79. vendor/composer/installers/tests/Composer/Installers/Test/SiteDirectInstallerTest.php +120 -0
  80. vendor/composer/installers/tests/Composer/Installers/Test/SyDESInstallerTest.php +2 -1
  81. vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php +2 -1
  82. vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.php +2 -1
admin/assets/css/admin.css CHANGED
@@ -273,13 +273,33 @@ tr:hover .on-hover { display: block; }
273
  .advads-spinner { float: none; visibility: visible; }
274
  .advads-wide-input { width: 30em; }
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  /**
277
  - GOOGLE ADSENSE MODULE
278
  -*/
279
  #adsense-ad-param-error { color: red; font-weight: bold; }
280
  .advads-adsense-content { width: 100%; }
281
- .advads-adsense-show-code a { padding: 0 10px; color: inherit; }
282
-
 
 
283
  /**
284
  - TABS + SETTINGS
285
  -*/
@@ -290,6 +310,11 @@ tr:hover .on-hover { display: block; }
290
  .advads-tab.active { display: block; }
291
  .advads-license-activate-active { color: green; }
292
  .advads-license-activate-error { color: red; }
 
 
 
 
 
293
 
294
  /**
295
  - SUPPORT PAGE
@@ -323,8 +348,10 @@ tr:hover .on-hover { display: block; }
323
  background-color: #fff;
324
  overflow-y: scroll;
325
  }
 
 
326
  #advanced-ads-feedback-content textarea,
327
- #advanced-ads-feedback-content input[type="text"] { display:none; width: 100%; }
328
  #advanced-ads-feedback-content .advanced_ads_disable_reply { display:none; }
329
  .advanced-ads-feedback-only-deactivate { display: block; text-align: right; }
330
 
@@ -351,7 +378,7 @@ tr:hover .on-hover { display: block; }
351
  /* Filter dropdowns on the ad list table */
352
  .advads-ad-list-even { background-color: #f9f9f9 !important; }
353
  .advads-ad-list-odd { background-color: #fff !important; }
354
- .edit-php.post-type-advanced_ads #filter-by-date, .edit-php.post-type-advanced_ads label[for=filter-by-date], .edit-php.post-type-advanced_ads #post-query-submit { display: none; }
355
 
356
  /* Hide 'New Ad' in menu */
357
  .wp-submenu li a[href="post-new.php?post_type=advanced_ads"] { display:none !important; }
273
  .advads-spinner { float: none; visibility: visible; }
274
  .advads-wide-input { width: 30em; }
275
 
276
+ /** WELCOME PANEL
277
+ */
278
+
279
+
280
+ .advads-admin-notice[data-notice="nl_intro"] { border: 4px solid #0073aa; }
281
+ #aa-welcome-panel h2 { margin: 0; font-size: 21px; font-weight: 400; line-height: 1.2; }
282
+ #aa-welcome-panel h3 { margin: 1.33em 0; font-size: 16px; }
283
+ #aa-welcome-panel li { font-size: 14px; }
284
+ #aa-welcome-panel a { text-decoration: none; }
285
+ .aa-welcome-panel-content { margin-left: 13px; max-width: 1500px; }
286
+ #aa-welcome-panel .aa-welcome-panel-column-container { clear: both; position: relative; }
287
+ #aa-welcome-panel .aa-welcome-panel-column { width: 32%; min-width: 200px; float: left; }
288
+ #aa-welcome-panel .aa-welcome-panel-column:first-child { width: 36%; }
289
+ #aa-welcome-panel .aa-welcome-panel-column ul { margin: 0.8em 1em 1em 0; }
290
+ #aa-welcome-panel .aa-welcome-panel-column li { line-height: 16px; list-style-type: none; padding: 0 0 8px; }
291
+ .aa-welcome-panel-column p { margin-top: 7px; color: #444; }
292
+ .aa-welcome-panel-column .button { margin-left: 0; }
293
+
294
  /**
295
  - GOOGLE ADSENSE MODULE
296
  -*/
297
  #adsense-ad-param-error { color: red; font-weight: bold; }
298
  .advads-adsense-content { width: 100%; }
299
+ .advads-adsense-show-code a, #mapi-open-selector a { padding: 0 10px; color: inherit; }
300
+ #mapi-wrap { border: 1px solid #ddd; padding: .5rem; position: relative; margin: 1rem auto; display:none; overflow: hidden; }
301
+ #mapi-wrap .label { font-weight:bold; display:block; margin:.75em auto .25rem; }
302
+ #mapi-quota-message{ color: #ef8e00; font-style: italic; font-weight: bold; }
303
  /**
304
  - TABS + SETTINGS
305
  -*/
310
  .advads-tab.active { display: block; }
311
  .advads-license-activate-active { color: green; }
312
  .advads-license-activate-error { color: red; }
313
+ .advads-tab-sub-menu ul { overflow: hidden; }
314
+ .advads-tab-sub-menu ul li { float: left; padding-right: 0.5em; }
315
+ .advads-tab-sub-menu ul li a { cursor: pointer; }
316
+ .advads-tab-sub-menu ul li + li:before { content: '|'; }
317
+ .advads-tab-sub-menu ul li + li a { padding-left: 0.5em; }
318
 
319
  /**
320
  - SUPPORT PAGE
348
  background-color: #fff;
349
  overflow-y: scroll;
350
  }
351
+ #advanced-ads-feedback-content textarea:not(.advanced_ads_disable_help_text),
352
+ #advanced-ads-feedback-content input[type="text"] { display:none; }
353
  #advanced-ads-feedback-content textarea,
354
+ #advanced-ads-feedback-content input[type="text"] { width: 100%; }
355
  #advanced-ads-feedback-content .advanced_ads_disable_reply { display:none; }
356
  .advanced-ads-feedback-only-deactivate { display: block; text-align: right; }
357
 
378
  /* Filter dropdowns on the ad list table */
379
  .advads-ad-list-even { background-color: #f9f9f9 !important; }
380
  .advads-ad-list-odd { background-color: #fff !important; }
381
+ .edit-php.post-type-advanced_ads #filter-by-date, .edit-php.post-type-advanced_ads label[for=filter-by-date]{ display: none; }
382
 
383
  /* Hide 'New Ad' in menu */
384
  .wp-submenu li a[href="post-new.php?post_type=advanced_ads"] { display:none !important; }
admin/assets/js/admin-global.js CHANGED
@@ -83,7 +83,7 @@ jQuery( document ).ready(function () {
83
  jQuery(this).parents('li').next('li').children('input[type="text"], textarea').show();
84
  });
85
  // handle technical issue feedback in particular
86
- jQuery('#advanced-ads-feedback-content .advanced_ads_disable_technical_issue input[type="radio"]').click(function () {
87
  // show text field if there is one
88
  jQuery(this).parents('li').siblings('.advanced_ads_disable_reply').show();
89
  });
83
  jQuery(this).parents('li').next('li').children('input[type="text"], textarea').show();
84
  });
85
  // handle technical issue feedback in particular
86
+ jQuery('#advanced-ads-feedback-content .advanced_ads_disable_help_text').focus(function () {
87
  // show text field if there is one
88
  jQuery(this).parents('li').siblings('.advanced_ads_disable_reply').show();
89
  });
admin/assets/js/admin.js CHANGED
@@ -70,6 +70,11 @@ jQuery( document ).ready(function ($) {
70
  nonce: advadsglobal.ajax_nonce
71
  },
72
  success: function (r, textStatus, XMLHttpRequest) {
 
 
 
 
 
73
  $( '#advads-ad-injection-box *' ).hide();
74
  // append anchor to placement message
75
  $( '#advads-ad-injection-message-placement-created .advads-placement-link' ).attr( 'href', $( '#advads-ad-injection-message-placement-created a' ).attr( 'href' ) + r );
@@ -500,8 +505,6 @@ jQuery( document ).ready(function ($) {
500
  var file_frame;
501
  window.formfield = '';
502
 
503
- advads_ad_list_build_filters();
504
-
505
  // adblocker related code
506
  $( '#advanced-ads-use-adblocker' ).change( function() {
507
  advads_toggle_box( this, '#advads-adblocker-wrapper' );
@@ -774,87 +777,6 @@ function advads_maybe_textarea_to_tinymce( ad_type ) {
774
  }
775
  }
776
 
777
- /**
778
- * adds <option> tags to <select> dropdowns before the 'Filter' button on the ad list table
779
- * @param {string} jQuery wrapped set where to find value/text for <option>
780
- * @param {string} jQuery wrapped set with <select> tag
781
- */
782
- function advads_ad_list_add_items_to_dropdowns( $input, $select ) {
783
- var all_unique_rows = [];
784
-
785
- $input.each( function() {
786
- var one_row = jQuery( this ).text();
787
-
788
- if ( jQuery.inArray( one_row, all_unique_rows ) === -1 ) {
789
- all_unique_rows.push( one_row );
790
- $select.append(
791
- jQuery("<option/>", {
792
- value: one_row,
793
- text: one_row
794
- })
795
- );
796
- }
797
- });
798
- }
799
-
800
- /**
801
- * adds filter dropdowns before the 'Filter' button on the ad list table
802
- */
803
- function advads_ad_list_build_filters() {
804
- var $filter_type = jQuery( '#advads-filter-type' ),
805
- $filter_size = jQuery( '#advads-filter-size' ),
806
- $filter_group = jQuery( '#advads-filter-group' ),
807
- $filter_date = jQuery( '#advads-filter-date' ),
808
- $ad_planning_col = jQuery( '.advads-filter-timing' );
809
-
810
- advads_ad_list_add_items_to_dropdowns( jQuery( '.advads-ad-type' ), $filter_type );
811
- advads_ad_list_add_items_to_dropdowns( jQuery( '.advads-ad-size' ), $filter_size );
812
- advads_ad_list_add_items_to_dropdowns( jQuery( '.taxonomy-advanced_ads_groups a' ), $filter_group );
813
- // if such classes exist on the page - show related <option>s
814
- jQuery( '#advads-filter-date option:gt(0)' ).each( function() {
815
- var v = jQuery( this ).val();
816
- if ( $ad_planning_col.hasClass( v ) ) {
817
- $filter_date.children( 'option[value="' + v + '"] ' ).show();
818
- }
819
- });
820
-
821
- jQuery( "#advads-filter-type, #advads-filter-size, #advads-filter-group, #advads-filter-date" ).change( function() {
822
- var $the_list_tr = jQuery( '#the-list tr' ).removeClass( 'advads-hidden' );
823
-
824
- if ( $filter_type.val() ) {
825
- $the_list_tr.filter( function() {
826
- return jQuery( this ).find( '.advads-ad-type' ).text() !== $filter_type.val();
827
- }).addClass( 'advads-hidden' );
828
- }
829
- if ( $filter_size.val() ) {
830
- $the_list_tr.not( '.advads-hidden' ).filter ( function() {
831
- return jQuery( this ).find( '.advads-ad-size' ).text() !== $filter_size.val();
832
- }).addClass( 'advads-hidden' );
833
- }
834
- if ( $filter_date.val() ) {
835
- $the_list_tr.not( '.advads-hidden' ).filter( function() {
836
- return jQuery( this ).find( '.' + $filter_date.val() ).length === 0;
837
- }).addClass( 'advads-hidden' );
838
- }
839
- if ( $filter_group.val() ) {
840
- $the_list_tr.not( '.advads-hidden' ).filter( function() {
841
- var ret = false;
842
- //iterate through each group within current tr
843
- jQuery( this ).find( '.taxonomy-advanced_ads_groups a' ).each( function() {
844
- if ( jQuery( this ).text() === $filter_group.val() ) {
845
- ret = true;
846
- return false; //break the loop
847
- }
848
- });
849
- return ret === false;
850
- }).addClass( 'advads-hidden' );
851
- }
852
- // create stripped table, because css nth-child does not counts hidden rows
853
- $the_list_tr.not( '.advads-hidden' ).filter( ':odd' ).addClass( 'advads-ad-list-odd' ).removeClass( 'advads-ad-list-even' ).end()
854
- .filter( ':even' ).addClass( 'advads-ad-list-even' ).removeClass( 'advads-ad-list-odd' );
855
- });
856
- }
857
-
858
  // Change JQueryUI names to fix name collision with other libraries, eg. Bootstrap
859
  jQuery.fn.advads_button = jQuery.fn.button;
860
 
70
  nonce: advadsglobal.ajax_nonce
71
  },
72
  success: function (r, textStatus, XMLHttpRequest) {
73
+ if ( ! r ) {
74
+ $( '#advads-ad-injection-box' ).html( 'an error occured' );
75
+ return;
76
+ }
77
+
78
  $( '#advads-ad-injection-box *' ).hide();
79
  // append anchor to placement message
80
  $( '#advads-ad-injection-message-placement-created .advads-placement-link' ).attr( 'href', $( '#advads-ad-injection-message-placement-created a' ).attr( 'href' ) + r );
505
  var file_frame;
506
  window.formfield = '';
507
 
 
 
508
  // adblocker related code
509
  $( '#advanced-ads-use-adblocker' ).change( function() {
510
  advads_toggle_box( this, '#advads-adblocker-wrapper' );
777
  }
778
  }
779
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  // Change JQueryUI names to fix name collision with other libraries, eg. Bootstrap
781
  jQuery.fn.advads_button = jQuery.fn.button;
782
 
admin/class-advanced-ads-admin.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  /**
4
  * Advanced Ads.
5
  *
@@ -7,7 +6,7 @@
7
  * @author Thomas Maier <thomas.maier@webgilde.com>
8
  * @license GPL-2.0+
9
  * @link http://webgilde.com
10
- * @copyright 2013-2015 Thomas Maier, webgilde GmbH
11
  */
12
 
13
  /**
@@ -44,7 +43,7 @@ class Advanced_Ads_Admin {
44
  public $plugin_screen_hook_suffix = null;
45
 
46
  /**
47
- * general plugin slug
48
  *
49
  * @since 1.0.0
50
  * @var string
@@ -59,74 +58,89 @@ class Advanced_Ads_Admin {
59
  */
60
  private function __construct() {
61
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
62
- new Advanced_Ads_Ad_Ajax_Callbacks;
63
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded_ajax' ) );
64
  } else {
65
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
 
 
66
  }
67
- // add shortcode creator to TinyMCE
68
  Advanced_Ads_Shortcode_Creator::get_instance();
69
  Advanced_Ads_Admin_Licenses::get_instance();
70
  }
71
-
72
  /**
73
- * license handling legacy code after moving license handling code to Advanced_Ads_Admin_Licenses
74
- *
 
 
 
75
  * @since version 1.7.16 (early January 2017)
76
  */
77
- public function deactivate_license( $addon = '', $plugin_name = '', $options_slug = '' ){ return Advanced_Ads_Admin_Licenses::get_instance()->deactivate_license( $addon = '', $plugin_name = '', $options_slug = '' ); }
78
- public function get_license_status( $slug = '' ){ return Advanced_Ads_Admin_Licenses::get_instance()->get_license_status( $slug = '' ); }
 
 
 
 
 
 
 
 
 
79
 
80
  /**
81
- * actions and filter available after all plugins are initialized
82
  */
83
  public function wp_plugins_loaded() {
84
- /*
85
- * Call $plugin_slug from public plugin class.
86
- *
87
- */
88
- $plugin = Advanced_Ads::get_instance();
89
  $this->plugin_slug = $plugin->get_plugin_slug();
90
-
91
  add_action( 'current_screen', array( $this, 'current_screen' ) );
92
-
93
  // Load admin style sheet and JavaScript.
94
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
95
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 9 );
96
 
97
- // update placements
98
- add_action( 'admin_init', array('Advanced_Ads_Placements', 'update_placements') );
99
-
100
- // check for update logic
101
- add_action( 'admin_notices', array($this, 'admin_notices') );
102
-
103
- // add links to plugin page
104
  add_filter( 'plugin_action_links_' . ADVADS_BASE, array( $this, 'add_plugin_links' ) );
105
-
106
- // display information when user is going to disable the plugin
107
  add_filter( 'admin_footer', array( $this, 'add_deactivation_logic' ) );
108
  // add_filter( 'after_plugin_row_' . ADVADS_BASE, array( $this, 'display_deactivation_message' ) );
109
-
110
- // disable adding rel="noopener noreferrer" to link added through TinyMCE for rich content ads
111
  add_filter( 'tiny_mce_before_init', array( $this, 'tinymce_allow_unsafe_link_target' ) );
112
-
 
 
113
  Advanced_Ads_Admin_Meta_Boxes::get_instance();
114
  Advanced_Ads_Admin_Menu::get_instance();
115
  Advanced_Ads_Admin_Ad_Type::get_instance();
116
  Advanced_Ads_Admin_Settings::get_instance();
117
  }
118
-
119
  /**
120
- * actions and filters that should also be available for ajax
121
  */
122
  public function wp_plugins_loaded_ajax() {
123
- // needed here in order to work with Quick Edit option on ad list page
124
  Advanced_Ads_Admin_Ad_Type::get_instance();
125
-
126
  add_action( 'wp_ajax_advads_send_feedback', array( $this, 'send_feedback' ) );
127
  add_action( 'wp_ajax_advads_load_rss_widget_content', array( 'Advanced_Ads_Admin_Meta_Boxes', 'dashboard_widget_function_output' ) );
128
  }
129
-
130
  /**
131
  * Return an instance of this class.
132
  *
@@ -136,31 +150,30 @@ class Advanced_Ads_Admin {
136
  */
137
  public static function get_instance() {
138
  // If the single instance hasn't been set, set it now.
139
- if ( null == self::$instance ) {
140
- self::$instance = new self;
141
  }
142
 
143
  return self::$instance;
144
  }
145
-
146
  /**
147
- * general stuff after page is loaded and screen variable is available
148
  */
149
- public function current_screen(){
150
  $screen = get_current_screen();
151
-
152
- if( !isset( $screen->id ) ){
153
  return;
154
  }
155
-
156
- switch( $screen->id ){
157
- case 'edit-advanced_ads' : // ad overview page
158
- case 'advanced_ads' : // ad edit page
159
- // remove notice about missing first ad
160
- Advanced_Ads_Admin_Notices::get_instance()->remove_from_queue( 'nl_intro' );
161
- break;
162
  }
163
- }
164
 
165
  /**
166
  * Register and enqueue admin-specific style sheet.
@@ -169,59 +182,56 @@ class Advanced_Ads_Admin {
169
  */
170
  public function enqueue_admin_styles() {
171
  wp_enqueue_style( $this->plugin_slug . '-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), ADVADS_VERSION );
172
- if( self::screen_belongs_to_advanced_ads() ){
173
- // jQuery ui smoothness style 1.11.4
174
  wp_enqueue_style( $this->plugin_slug . '-jquery-ui-styles', plugins_url( 'assets/jquery-ui/jquery-ui.min.css', __FILE__ ), array(), '1.11.4' );
175
  }
176
- //wp_enqueue_style( 'jquery-style', '//code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css' );
177
  }
178
 
179
  /**
180
  * Register and enqueue admin-specific JavaScript.
181
  *
182
  * @since 1.0.0
183
- *
184
- * @return null Return early if no settings page is registered.
185
  */
186
  public function enqueue_admin_scripts() {
187
 
188
- // global js script
189
- wp_enqueue_script( $this->plugin_slug . '-admin-global-script', plugins_url( 'assets/js/admin-global.js', __FILE__ ), array('jquery'), ADVADS_VERSION );
190
- wp_enqueue_script( $this->plugin_slug . '-admin-find-adblocker', plugins_url( 'assets/js/advertisement.js', __FILE__ ), array(), ADVADS_VERSION );
191
-
192
- // register ajax nonce
193
  $params = array(
194
  'ajax_nonce' => wp_create_nonce( 'advanced-ads-admin-ajax-nonce' ),
195
  );
196
  wp_localize_script( $this->plugin_slug . '-admin-global-script', 'advadsglobal', $params );
197
 
198
- if( self::screen_belongs_to_advanced_ads() ){
199
- wp_register_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery', 'jquery-ui-autocomplete' , 'jquery-ui-button' ), ADVADS_VERSION );
200
- wp_register_script( $this->plugin_slug . '-wizard-script', plugins_url( 'assets/js/wizard.js', __FILE__ ), array('jquery'), ADVADS_VERSION );
201
-
202
- // jquery ui
203
- wp_enqueue_script( 'jquery-ui-accordion' );
204
- wp_enqueue_script( 'jquery-ui-button' );
205
- wp_enqueue_script( 'jquery-ui-tooltip' );
206
-
207
- // just register this script for later inclusion on ad group list page
208
- wp_register_script( 'inline-edit-group-ads', plugins_url( 'assets/js/inline-edit-group-ads.js', __FILE__ ), array('jquery'), ADVADS_VERSION );
209
-
210
- // register admin.js translations
211
- $translation_array = array(
212
- 'condition_or' => __( 'or', 'advanced-ads' ),
213
- 'condition_and' => __( 'and', 'advanced-ads' ),
214
- 'after_paragraph_promt' => __( 'After which paragraph?', 'advanced-ads' ),
215
- );
216
- wp_localize_script( $this->plugin_slug . '-admin-script', 'advadstxt', $translation_array );
217
-
218
- wp_enqueue_script( $this->plugin_slug . '-admin-script' );
219
- wp_enqueue_script( $this->plugin_slug . '-wizard-script' );
220
- }
221
-
222
- //call media manager for image upload only on ad edit pages
223
  $screen = get_current_screen();
224
- if( isset( $screen->id ) && Advanced_Ads::POST_TYPE_SLUG === $screen->id ) {
225
  // the 'wp_enqueue_media' function can be executed only once and should be called with the 'post' parameter
226
  // in this case, the '_wpMediaViewsL10n' js object inside html will contain id of the post, that is necessary to view oEmbed priview inside tinyMCE editor.
227
  // since other plugins can call the 'wp_enqueue_media' function without the 'post' parameter, Advanced Ads should call it earlier.
@@ -232,253 +242,398 @@ class Advanced_Ads_Admin {
232
  }
233
 
234
  /**
235
- * check if the current screen belongs to Advanced Ads
236
  *
237
  * @since 1.6.6
238
  * @return bool true if screen belongs to Advanced Ads
239
  */
240
- static function screen_belongs_to_advanced_ads(){
241
 
242
- if( ! function_exists( 'get_current_screen' ) ){
243
- return false;
244
  }
245
-
246
  $screen = get_current_screen();
247
- //echo $screen->id;
248
- if( !isset( $screen->id ) ) {
249
  return false;
250
  }
251
 
252
- $advads_pages = apply_filters( 'advanced-ads-dashboard-screens', array(
253
- 'advanced-ads_page_advanced-ads-groups', // ad groups
254
- 'edit-advanced_ads', // ads overview
255
- 'advanced_ads', // ad edit page
256
- 'advanced-ads_page_advanced-ads-placements', // placements
257
- 'advanced-ads_page_advanced-ads-settings', // settings
258
- 'toplevel_page_advanced-ads', // overview
259
- 'admin_page_advanced-ads-debug', // debug
260
- // 'advanced-ads_page_advanced-ads-support', // support
261
- 'admin_page_advanced-ads-import-export', // import & export
262
- ));
 
 
263
 
264
- if( in_array( $screen->id, $advads_pages )){
265
  return true;
266
  }
267
 
268
  return false;
269
  }
270
 
271
-
272
  /**
273
- * get action from the params
274
  *
275
  * @since 1.0.0
276
  */
277
  public function current_action() {
278
- if ( isset($_REQUEST['action']) && -1 != $_REQUEST['action'] ) {
279
- return $_REQUEST['action'];
 
280
  }
281
 
282
  return false;
283
  }
284
 
285
-
286
- /**
287
- * get DateTimeZone object for the WP installation
288
- */
289
- public static function get_wp_timezone() {
290
- $_time_zone = get_option( 'timezone_string' );
291
- $time_zone = new DateTimeZone( 'UTC' );
292
- if ( $_time_zone ) {
293
- $time_zone = new DateTimeZone( $_time_zone );
294
- } else {
295
- $gmt_offset = floatval( get_option( 'gmt_offset' ) );
296
- $sign = ( 0 > $gmt_offset )? '-' : '+';
297
- $int = floor( abs( $gmt_offset ) );
298
- $frac = abs( $gmt_offset ) - $int;
299
-
300
- $gmt = '';
301
- if ( $gmt_offset ) {
302
- $gmt .= $sign . zeroise( $int, 2 ) . ':' . zeroise( 60 * $frac, 2 );
303
- $time_zone = date_create( '2017-10-01T12:00:00' . $gmt )->getTimezone();
304
- }
305
-
306
- }
307
- return $time_zone;
308
- }
309
-
310
- /**
311
- * get literal expression of timezone
312
- */
313
- public static function timezone_get_name( $DTZ ) {
314
- if ( $DTZ instanceof DateTimeZone ) {
315
- $TZ = timezone_name_get( $DTZ );
316
- if ( 'UTC' == $TZ ) {
317
- return 'UTC+0';
318
- }
319
- if ( false === strpos( $TZ, '/' ) ) {
320
- $TZ = 'UTC' . $TZ;
321
- } else {
322
- $TZ = sprintf( __( 'time of %s', 'advanced-ads' ), $TZ );
323
- }
324
- return $TZ;
325
- }
326
- return 'UTC+0';
327
- }
 
328
 
329
  /**
330
- * initiate the admin notices class
331
  *
332
  * @since 1.5.3
333
  */
334
- public function admin_notices(){
335
- // display ad block warning to everyone who can edit ads
336
- if( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
337
- if ( $this->screen_belongs_to_advanced_ads() ){
338
  include ADVADS_BASE_PATH . 'admin/views/notices/adblock.php';
339
  include ADVADS_BASE_PATH . 'admin/views/notices/jqueryui_error.php';
340
  }
341
  }
342
-
343
- if( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
344
  $this->notices = Advanced_Ads_Admin_Notices::get_instance()->notices;
345
  Advanced_Ads_Admin_Notices::get_instance()->display_notices();
346
  }
347
  }
348
-
349
  /**
350
- * add links to the plugins list
351
  *
352
  * @since 1.6.14
353
  * @param arr $links array of links for the plugins, adapted when the current plugin is found.
354
- * @param str $file the filename for the current plugin, which the filter loops through.
355
  * @return array $links
356
  */
357
  public function add_plugin_links( $links ) {
358
-
359
- if( ! is_array( $links ) ){
360
  return $links;
361
  }
362
-
363
- // add link to settings
364
- //$settings_link = '<a href="' . admin_url( 'admin.php?page=advanced_ads&page=advanced-ads-settings' ) . '">' . __( 'Settings', 'advanced-ads' ) . '</a>';
365
- //array_unshift( $links, $settings_link );
366
 
367
- // add link to support page
368
  $support_link = '<a href="' . esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#support' ) ) . '">' . __( 'Support', 'advanced-ads' ) . '</a>';
369
  array_unshift( $links, $support_link );
370
 
371
- // add link to add-ons
372
  $extend_link = '<a href="' . ADVADS_URL . 'add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=plugin-page" target="_blank">' . __( 'Add-Ons', 'advanced-ads' ) . '</a>';
373
  array_unshift( $links, $extend_link );
374
-
375
  return $links;
376
  }
377
-
378
  /**
379
- * display deactivation logic on plugins page
380
- *
381
  * @since 1.7.14
382
  */
383
- public function add_deactivation_logic(){
384
-
385
  $screen = get_current_screen();
386
  if ( ! isset( $screen->id ) || ! in_array( $screen->id, array( 'plugins', 'plugins-network' ), true ) ) {
387
  return;
388
  }
389
-
390
  $current_user = wp_get_current_user();
391
- if ( !($current_user instanceof WP_User) ){
392
- $from = '';
393
- $email = '';
394
  } else {
395
- $from = $current_user->user_nicename . ' <' . trim( $current_user->user_email ) . '>';
396
- $email = $current_user->user_email;
397
  }
398
-
399
- include ADVADS_BASE_PATH . 'admin/views/feedback-disable.php';
400
  }
401
-
402
  /**
403
- * send feedback via email
404
- *
405
  * @since 1.7.14
406
  */
407
- public function send_feedback(){
408
-
 
 
 
409
  if ( isset( $_POST['formdata'] ) ) {
410
- parse_str( $_POST['formdata'], $form );
411
  }
412
-
413
- if( ! wp_verify_nonce( $form[ 'advanced_ads_disable_form_nonce' ], 'advanced_ads_disable_form' ) ){
414
- die();
415
  }
416
-
417
  $text = '';
418
- if( isset( $form[ 'advanced_ads_disable_text' ] ) ){
419
- $text = implode( "\n\r", $form[ 'advanced_ads_disable_text' ] );
420
  }
421
-
422
- // get first version to see if this is a new problem or might be an older on
423
- $options = Advanced_Ads_Plugin::get_instance()->internal_options();
424
  $installed = isset( $options['installed'] ) ? date( 'd.m.Y', $options['installed'] ) : '–';
425
-
426
  $text .= "\n\n" . home_url() . " ($installed)";
427
-
428
  $headers = array();
429
-
430
  $from = isset( $form['advanced_ads_disable_from'] ) ? $form['advanced_ads_disable_from'] : '';
431
- // the user clicked on the "don’t disable" button or if an address is given in the form then use that one
432
- if( ( isset( $_POST['feedback'] ) && $_POST['feedback'] && 'false' !== $_POST['feedback'] )
433
- || (
434
- isset( $form['advanced_ads_disable_reason'] )
435
- && in_array( $form['advanced_ads_disable_reason'], array( 'technical issue', 'get help' ) )
436
- && !empty( $form[ 'advanced_ads_disable_reply_email' ] ) ) )
437
- {
438
- $email = isset( $form[ 'advanced_ads_disable_reply_email' ] ) ? trim( $form[ 'advanced_ads_disable_reply_email' ] ) : $current_user->email;
439
  $current_user = wp_get_current_user();
440
- $name = ($current_user instanceof WP_User) ? $current_user->user_nicename : '';
441
- $from = $name . ' <' . $email . '>';
442
- $text .= "\n\n PLEASE REPLY";
 
 
 
 
 
443
  }
444
- if( $from ){
445
  $headers[] = "From: $from";
446
  $headers[] = "Reply-To: $from";
447
  }
448
-
449
  $subject = isset( $form['advanced_ads_disable_reason'] ) ? $form['advanced_ads_disable_reason'] : '(no reason given)';
450
-
451
  $success = wp_mail( 'improve@wpadvancedads.com', $subject, $text, $headers );
452
-
453
  die();
454
-
455
  }
456
-
457
- public function tinymce_allow_unsafe_link_target( $mceInit ) {
458
-
459
- // check if we are on the ad edit screen
460
- if( ! function_exists( 'get_current_screen' ) ){
461
- return $mceInit;
462
- }
463
-
 
 
 
 
 
 
464
  $screen = get_current_screen();
465
- if( isset( $screen->id ) && $screen->id === 'advanced_ads' ) {
466
- $mceInit['allow_unsafe_link_target'] = true;
467
  }
468
-
469
- return $mceInit;
470
- }
471
-
472
  /**
473
- * sort visitor and display condition arrays alphabetically by their label
474
- *
 
 
475
  * @since 1.8.12
476
  */
477
- static function sort_condition_array_by_label( $a, $b ){
478
- if( ! isset( $a['label'] ) || ! isset( $b['label'] ) ){
479
- return;
480
  }
481
  return strcmp( strtolower( $a['label'] ), strtolower( $b['label'] ) );
482
  }
483
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  }
1
  <?php
 
2
  /**
3
  * Advanced Ads.
4
  *
6
  * @author Thomas Maier <thomas.maier@webgilde.com>
7
  * @license GPL-2.0+
8
  * @link http://webgilde.com
9
+ * @copyright 2013-2018 Thomas Maier, webgilde GmbH
10
  */
11
 
12
  /**
43
  public $plugin_screen_hook_suffix = null;
44
 
45
  /**
46
+ * General plugin slug
47
  *
48
  * @since 1.0.0
49
  * @var string
58
  */
59
  private function __construct() {
60
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
61
+ new Advanced_Ads_Ad_Ajax_Callbacks();
62
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded_ajax' ) );
63
  } else {
64
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
65
+ add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 100 );
66
+ Advanced_Ads_Ad_List_Filters::get_instance();
67
  }
68
+ // add shortcode creator to TinyMCE.
69
  Advanced_Ads_Shortcode_Creator::get_instance();
70
  Advanced_Ads_Admin_Licenses::get_instance();
71
  }
72
+
73
  /**
74
+ * License handling legacy code after moving license handling code to Advanced_Ads_Admin_Licenses
75
+ *
76
+ * @param string $addon slug of the add-on.
77
+ * @param string $plugin_name name of the add-on.
78
+ * @param string $options_slug slug of the options the plugin is saving in the options table.
79
  * @since version 1.7.16 (early January 2017)
80
  */
81
+ public function deactivate_license( $addon = '', $plugin_name = '', $options_slug = '' ) {
82
+ return Advanced_Ads_Admin_Licenses::get_instance()->deactivate_license( $addon, $plugin_name, $options_slug ); }
83
+
84
+ /**
85
+ * Get license status.
86
+ *
87
+ * @param string $slug slug of the add-on.
88
+ * @return string license status
89
+ */
90
+ public function get_license_status( $slug = '' ) {
91
+ return Advanced_Ads_Admin_Licenses::get_instance()->get_license_status( $slug ); }
92
 
93
  /**
94
+ * Actions and filter available after all plugins are initialized.
95
  */
96
  public function wp_plugins_loaded() {
97
+ /*
98
+ * Call $plugin_slug from public plugin class.
99
+ *
100
+ */
101
+ $plugin = Advanced_Ads::get_instance();
102
  $this->plugin_slug = $plugin->get_plugin_slug();
103
+
104
  add_action( 'current_screen', array( $this, 'current_screen' ) );
105
+
106
  // Load admin style sheet and JavaScript.
107
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
108
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 9 );
109
 
110
+ // update placements.
111
+ add_action( 'admin_init', array( 'Advanced_Ads_Placements', 'update_placements' ) );
112
+
113
+ // check for update logic.
114
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
115
+
116
+ // add links to plugin page.
117
  add_filter( 'plugin_action_links_' . ADVADS_BASE, array( $this, 'add_plugin_links' ) );
118
+
119
+ // display information when user is going to disable the plugin.
120
  add_filter( 'admin_footer', array( $this, 'add_deactivation_logic' ) );
121
  // add_filter( 'after_plugin_row_' . ADVADS_BASE, array( $this, 'display_deactivation_message' ) );
122
+ // disable adding rel="noopener noreferrer" to link added through TinyMCE for rich content ads.
 
123
  add_filter( 'tiny_mce_before_init', array( $this, 'tinymce_allow_unsafe_link_target' ) );
124
+
125
+ add_action( 'plugins_api_result', array( $this, 'recommend_suitable_add_ons' ), 11, 3 );
126
+
127
  Advanced_Ads_Admin_Meta_Boxes::get_instance();
128
  Advanced_Ads_Admin_Menu::get_instance();
129
  Advanced_Ads_Admin_Ad_Type::get_instance();
130
  Advanced_Ads_Admin_Settings::get_instance();
131
  }
132
+
133
  /**
134
+ * Actions and filters that should also be available for ajax
135
  */
136
  public function wp_plugins_loaded_ajax() {
137
+ // needed here in order to work with Quick Edit option on ad list page.
138
  Advanced_Ads_Admin_Ad_Type::get_instance();
139
+
140
  add_action( 'wp_ajax_advads_send_feedback', array( $this, 'send_feedback' ) );
141
  add_action( 'wp_ajax_advads_load_rss_widget_content', array( 'Advanced_Ads_Admin_Meta_Boxes', 'dashboard_widget_function_output' ) );
142
  }
143
+
144
  /**
145
  * Return an instance of this class.
146
  *
150
  */
151
  public static function get_instance() {
152
  // If the single instance hasn't been set, set it now.
153
+ if ( null === self::$instance ) {
154
+ self::$instance = new self();
155
  }
156
 
157
  return self::$instance;
158
  }
159
+
160
  /**
161
+ * General stuff after page is loaded and screen variable is available
162
  */
163
+ public function current_screen() {
164
  $screen = get_current_screen();
165
+
166
+ if ( ! isset( $screen->id ) ) {
167
  return;
168
  }
169
+
170
+ switch ( $screen->id ) {
171
+ case 'edit-advanced_ads': // ad overview page.
172
+ case 'advanced_ads': // ad edit page.
173
+ // remove notice about missing first ad.
174
+ break;
 
175
  }
176
+ }
177
 
178
  /**
179
  * Register and enqueue admin-specific style sheet.
182
  */
183
  public function enqueue_admin_styles() {
184
  wp_enqueue_style( $this->plugin_slug . '-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), ADVADS_VERSION );
185
+ if ( self::screen_belongs_to_advanced_ads() ) {
186
+ // jQuery ui smoothness style 1.11.4.
187
  wp_enqueue_style( $this->plugin_slug . '-jquery-ui-styles', plugins_url( 'assets/jquery-ui/jquery-ui.min.css', __FILE__ ), array(), '1.11.4' );
188
  }
 
189
  }
190
 
191
  /**
192
  * Register and enqueue admin-specific JavaScript.
193
  *
194
  * @since 1.0.0
 
 
195
  */
196
  public function enqueue_admin_scripts() {
197
 
198
+ // global js script.
199
+ wp_enqueue_script( $this->plugin_slug . '-admin-global-script', plugins_url( 'assets/js/admin-global.js', __FILE__ ), array( 'jquery' ), ADVADS_VERSION, false );
200
+ wp_enqueue_script( $this->plugin_slug . '-admin-find-adblocker', plugins_url( 'assets/js/advertisement.js', __FILE__ ), array(), ADVADS_VERSION, false );
201
+
202
+ // register ajax nonce.
203
  $params = array(
204
  'ajax_nonce' => wp_create_nonce( 'advanced-ads-admin-ajax-nonce' ),
205
  );
206
  wp_localize_script( $this->plugin_slug . '-admin-global-script', 'advadsglobal', $params );
207
 
208
+ if ( self::screen_belongs_to_advanced_ads() ) {
209
+ wp_register_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery', 'jquery-ui-autocomplete', 'jquery-ui-button' ), ADVADS_VERSION, false );
210
+ wp_register_script( $this->plugin_slug . '-wizard-script', plugins_url( 'assets/js/wizard.js', __FILE__ ), array( 'jquery' ), ADVADS_VERSION, false );
211
+
212
+ // jquery ui.
213
+ wp_enqueue_script( 'jquery-ui-accordion' );
214
+ wp_enqueue_script( 'jquery-ui-button' );
215
+ wp_enqueue_script( 'jquery-ui-tooltip' );
216
+
217
+ // just register this script for later inclusion on ad group list page.
218
+ wp_register_script( 'inline-edit-group-ads', plugins_url( 'assets/js/inline-edit-group-ads.js', __FILE__ ), array( 'jquery' ), ADVADS_VERSION, false );
219
+
220
+ // register admin.js translations.
221
+ $translation_array = array(
222
+ 'condition_or' => __( 'or', 'advanced-ads' ),
223
+ 'condition_and' => __( 'and', 'advanced-ads' ),
224
+ 'after_paragraph_promt' => __( 'After which paragraph?', 'advanced-ads' ),
225
+ );
226
+ wp_localize_script( $this->plugin_slug . '-admin-script', 'advadstxt', $translation_array );
227
+
228
+ wp_enqueue_script( $this->plugin_slug . '-admin-script' );
229
+ wp_enqueue_script( $this->plugin_slug . '-wizard-script' );
230
+ }
231
+
232
+ // call media manager for image upload only on ad edit pages.
233
  $screen = get_current_screen();
234
+ if ( isset( $screen->id ) && Advanced_Ads::POST_TYPE_SLUG === $screen->id ) {
235
  // the 'wp_enqueue_media' function can be executed only once and should be called with the 'post' parameter
236
  // in this case, the '_wpMediaViewsL10n' js object inside html will contain id of the post, that is necessary to view oEmbed priview inside tinyMCE editor.
237
  // since other plugins can call the 'wp_enqueue_media' function without the 'post' parameter, Advanced Ads should call it earlier.
242
  }
243
 
244
  /**
245
+ * Check if the current screen belongs to Advanced Ads
246
  *
247
  * @since 1.6.6
248
  * @return bool true if screen belongs to Advanced Ads
249
  */
250
+ public static function screen_belongs_to_advanced_ads() {
251
 
252
+ if ( ! function_exists( 'get_current_screen' ) ) {
253
+ return false;
254
  }
255
+
256
  $screen = get_current_screen();
257
+ if ( ! isset( $screen->id ) ) {
 
258
  return false;
259
  }
260
 
261
+ $advads_pages = apply_filters(
262
+ 'advanced-ads-dashboard-screens', array(
263
+ 'advanced-ads_page_advanced-ads-groups', // ad groups.
264
+ 'edit-advanced_ads', // ads overview.
265
+ 'advanced_ads', // ad edit page.
266
+ 'advanced-ads_page_advanced-ads-placements', // placements.
267
+ 'advanced-ads_page_advanced-ads-settings', // settings.
268
+ 'toplevel_page_advanced-ads', // overview.
269
+ 'admin_page_advanced-ads-debug', // debug.
270
+ // 'advanced-ads_page_advanced-ads-support', // support.
271
+ 'admin_page_advanced-ads-import-export', // import & export.
272
+ )
273
+ );
274
 
275
+ if ( in_array( $screen->id, $advads_pages, true ) ) {
276
  return true;
277
  }
278
 
279
  return false;
280
  }
281
 
 
282
  /**
283
+ * Get action from the params
284
  *
285
  * @since 1.0.0
286
  */
287
  public function current_action() {
288
+ $request = wp_unslash( $_REQUEST );
289
+ if ( isset( $request['action'] ) && -1 !== $request['action'] ) {
290
+ return $request['action'];
291
  }
292
 
293
  return false;
294
  }
295
 
296
+ /**
297
+ * Get DateTimeZone object for the WP installation
298
+ */
299
+ public static function get_wp_timezone() {
300
+ $_time_zone = get_option( 'timezone_string' );
301
+ $time_zone = new DateTimeZone( 'UTC' );
302
+ if ( $_time_zone ) {
303
+ $time_zone = new DateTimeZone( $_time_zone );
304
+ } else {
305
+ $gmt_offset = floatval( get_option( 'gmt_offset' ) );
306
+ $sign = ( 0 > $gmt_offset ) ? '-' : '+';
307
+ $int = floor( abs( $gmt_offset ) );
308
+ $frac = abs( $gmt_offset ) - $int;
309
+
310
+ $gmt = '';
311
+ if ( $gmt_offset ) {
312
+ $gmt .= $sign . zeroise( $int, 2 ) . ':' . zeroise( 60 * $frac, 2 );
313
+ $time_zone = date_create( '2017-10-01T12:00:00' . $gmt )->getTimezone();
314
+ }
315
+ }
316
+ return $time_zone;
317
+ }
318
+
319
+ /**
320
+ * Get literal expression of timezone
321
+ *
322
+ * @param DateTimeZone $date_time_zone the DateTimeZone object to get literal value from.
323
+ */
324
+ public static function timezone_get_name( $date_time_zone ) {
325
+ if ( $date_time_zone instanceof DateTimeZone ) {
326
+ $time_zone = timezone_name_get( $date_time_zone );
327
+ if ( 'UTC' === $time_zone ) {
328
+ return 'UTC+0';
329
+ }
330
+ if ( false === strpos( $time_zone, '/' ) ) {
331
+ $time_zone = 'UTC' . $time_zone;
332
+ } else {
333
+ // translators: time zone name.
334
+ $time_zone = sprintf( __( 'time of %s', 'advanced-ads' ), $time_zone );
335
+ }
336
+ return $time_zone;
337
+ }
338
+ return 'UTC+0';
339
+ }
340
 
341
  /**
342
+ * Initiate the admin notices class
343
  *
344
  * @since 1.5.3
345
  */
346
+ public function admin_notices() {
347
+ // display ad block warning to everyone who can edit ads.
348
+ if ( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
349
+ if ( $this->screen_belongs_to_advanced_ads() ) {
350
  include ADVADS_BASE_PATH . 'admin/views/notices/adblock.php';
351
  include ADVADS_BASE_PATH . 'admin/views/notices/jqueryui_error.php';
352
  }
353
  }
354
+
355
+ if ( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads' ) ) ) {
356
  $this->notices = Advanced_Ads_Admin_Notices::get_instance()->notices;
357
  Advanced_Ads_Admin_Notices::get_instance()->display_notices();
358
  }
359
  }
360
+
361
  /**
362
+ * Add links to the plugins list
363
  *
364
  * @since 1.6.14
365
  * @param arr $links array of links for the plugins, adapted when the current plugin is found.
 
366
  * @return array $links
367
  */
368
  public function add_plugin_links( $links ) {
369
+
370
+ if ( ! is_array( $links ) ) {
371
  return $links;
372
  }
 
 
 
 
373
 
374
+ // add link to support page.
375
  $support_link = '<a href="' . esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#support' ) ) . '">' . __( 'Support', 'advanced-ads' ) . '</a>';
376
  array_unshift( $links, $support_link );
377
 
378
+ // add link to add-ons.
379
  $extend_link = '<a href="' . ADVADS_URL . 'add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=plugin-page" target="_blank">' . __( 'Add-Ons', 'advanced-ads' ) . '</a>';
380
  array_unshift( $links, $extend_link );
381
+
382
  return $links;
383
  }
384
+
385
  /**
386
+ * Display deactivation logic on plugins page
387
+ *
388
  * @since 1.7.14
389
  */
390
+ public function add_deactivation_logic() {
391
+
392
  $screen = get_current_screen();
393
  if ( ! isset( $screen->id ) || ! in_array( $screen->id, array( 'plugins', 'plugins-network' ), true ) ) {
394
  return;
395
  }
396
+
397
  $current_user = wp_get_current_user();
398
+ if ( ! ( $current_user instanceof WP_User ) ) {
399
+ $from = '';
400
+ $email = '';
401
  } else {
402
+ $from = $current_user->user_nicename . ' <' . trim( $current_user->user_email ) . '>';
403
+ $email = $current_user->user_email;
404
  }
405
+
406
+ include ADVADS_BASE_PATH . 'admin/views/feedback-disable.php';
407
  }
408
+
409
  /**
410
+ * Send feedback via email
411
+ *
412
  * @since 1.7.14
413
  */
414
+ public function send_feedback() {
415
+ /**
416
+ * We first need to get the form data from the string and can verify the nonce afterwards
417
+ * This throws an issue with the WP Coding Standards though
418
+ */
419
  if ( isset( $_POST['formdata'] ) ) {
420
+ parse_str( wp_unslash( $_POST['formdata'] ), $form );
421
  }
422
+
423
+ if ( ! wp_verify_nonce( $form['advanced_ads_disable_form_nonce'], 'advanced_ads_disable_form' ) ) {
424
+ die();
425
  }
426
+
427
  $text = '';
428
+ if ( isset( $form['advanced_ads_disable_text'] ) ) {
429
+ $text = implode( "\n\r", $form['advanced_ads_disable_text'] );
430
  }
431
+
432
+ // get first version to see if this is a new problem or might be an older on.
433
+ $options = Advanced_Ads_Plugin::get_instance()->internal_options();
434
  $installed = isset( $options['installed'] ) ? date( 'd.m.Y', $options['installed'] ) : '–';
435
+
436
  $text .= "\n\n" . home_url() . " ($installed)";
437
+
438
  $headers = array();
439
+
440
  $from = isset( $form['advanced_ads_disable_from'] ) ? $form['advanced_ads_disable_from'] : '';
441
+ // the user clicked on the "don’t disable" button or if an address is given in the form then use that one.
442
+ if ( isset( $form['advanced_ads_disable_reason'] )
443
+ && 'get help' === $form['advanced_ads_disable_reason']
444
+ && ! empty( $form['advanced_ads_disable_reply_email'] ) ) {
445
+ $email = isset( $form['advanced_ads_disable_reply_email'] ) ? trim( $form['advanced_ads_disable_reply_email'] ) : $current_user->email;
 
 
 
446
  $current_user = wp_get_current_user();
447
+ $name = ( $current_user instanceof WP_User ) ? $current_user->user_nicename : '';
448
+ $from = $name . ' <' . $email . '>';
449
+ if ( isset( $form['advanced_ads_disable_text'][0] )
450
+ && trim( $form['advanced_ads_disable_text'][0] ) !== '' ) { // is a text given then ask for help.
451
+ $text .= "\n\n PLEASE HELP";
452
+ } else { // if no text is given, just reply.
453
+ $text .= "\n\n PLEASE REPLY";
454
+ }
455
  }
456
+ if ( $from ) {
457
  $headers[] = "From: $from";
458
  $headers[] = "Reply-To: $from";
459
  }
460
+
461
  $subject = isset( $form['advanced_ads_disable_reason'] ) ? $form['advanced_ads_disable_reason'] : '(no reason given)';
462
+
463
  $success = wp_mail( 'improve@wpadvancedads.com', $subject, $text, $headers );
464
+
465
  die();
466
+
467
  }
468
+
469
+ /**
470
+ * Configure TinyMCE to allow unsafe link target.
471
+ *
472
+ * @param boolean $mce_init the tinyMce initialization array.
473
+ * @return boolean
474
+ */
475
+ public function tinymce_allow_unsafe_link_target( $mce_init ) {
476
+
477
+ // check if we are on the ad edit screen.
478
+ if ( ! function_exists( 'get_current_screen' ) ) {
479
+ return $mce_init;
480
+ }
481
+
482
  $screen = get_current_screen();
483
+ if ( isset( $screen->id ) && 'advanced_ads' === $screen->id ) {
484
+ $mce_init['allow_unsafe_link_target'] = true;
485
  }
486
+
487
+ return $mce_init;
488
+ }
489
+
490
  /**
491
+ * Sort visitor and display condition arrays alphabetically by their label.
492
+ *
493
+ * @param array $a array to be compared.
494
+ * @param array $b array to be compared.
495
  * @since 1.8.12
496
  */
497
+ public static function sort_condition_array_by_label( $a, $b ) {
498
+ if ( ! isset( $a['label'] ) || ! isset( $b['label'] ) ) {
499
+ return;
500
  }
501
  return strcmp( strtolower( $a['label'] ), strtolower( $b['label'] ) );
502
  }
503
 
504
+ /**
505
+ * Recommend additional add-ons
506
+ *
507
+ * @param object $result original result object.
508
+ * @param unknown $action action.
509
+ * @param object $args additional arguments.
510
+ */
511
+ public function recommend_suitable_add_ons( $result, $action, $args ) {
512
+ if ( empty( $args->browse ) ) {
513
+ return $result;
514
+ }
515
+
516
+ if ( 'featured' !== $args->browse && 'recommended' !== $args->browse && 'popular' !== $args->browse ) {
517
+ return $result;
518
+ }
519
+
520
+ if ( ! isset( $result->info['page'] ) || 1 < $result->info['page'] ) {
521
+ return $result;
522
+ }
523
+
524
+ // Recommend AdSense In-Feed add-on.
525
+ if ( ! is_plugin_active( 'advanced-ads-adsense-in-feed/advanced-ads-in-feed.php' )
526
+ && ! is_plugin_active_for_network( 'advanced-ads-adsense-in-feed/advanced-ads-in-feed.php' ) ) {
527
+
528
+ // Grab all slugs from the api results.
529
+ $result_slugs = wp_list_pluck( $result->plugins, 'slug' );
530
+
531
+ if ( in_array( 'advanced-ads-adsense-in-feed', $result_slugs, true ) ) {
532
+ return $result;
533
+ }
534
+
535
+ $query_args = array(
536
+ 'slug' => 'advanced-ads-adsense-in-feed',
537
+ 'fields' => array(
538
+ 'icons' => true,
539
+ 'active_installs' => true,
540
+ 'short_description' => true,
541
+ 'group' => true,
542
+ ),
543
+ );
544
+ $plugin_data = plugins_api( 'plugin_information', $query_args );
545
+
546
+ if ( ! is_wp_error( $plugin_data ) ) {
547
+ if ( 'featured' === $args->browse ) {
548
+ array_push( $result->plugins, $plugin_data );
549
+ } else {
550
+ array_unshift( $result->plugins, $plugin_data );
551
+ }
552
+ }
553
+ }
554
+
555
+ // Recommend Genesis Ads add-on.
556
+ if ( defined( 'PARENT_THEME_NAME' ) && 'Genesis' === PARENT_THEME_NAME
557
+ && ! is_plugin_active( 'advanced-ads-genesis/genesis-ads.php' )
558
+ && ! is_plugin_active_for_network( 'advanced-ads-genesis/genesis-ads.php' ) ) {
559
+
560
+ // Grab all slugs from the api results.
561
+ $result_slugs = wp_list_pluck( $result->plugins, 'slug' );
562
+
563
+ if ( in_array( 'advanced-ads-genesis', $result_slugs, true ) ) {
564
+ return $result;
565
+ }
566
+
567
+ $query_args = array(
568
+ 'slug' => 'advanced-ads-genesis',
569
+ 'fields' => array(
570
+ 'icons' => true,
571
+ 'active_installs' => true,
572
+ 'short_description' => true,
573
+ 'group' => true,
574
+ ),
575
+ );
576
+ $plugin_data = plugins_api( 'plugin_information', $query_args );
577
+
578
+ if ( ! is_wp_error( $plugin_data ) ) {
579
+ if ( 'featured' === $args->browse ) {
580
+ array_push( $result->plugins, $plugin_data );
581
+ } else {
582
+ array_unshift( $result->plugins, $plugin_data );
583
+ }
584
+ }
585
+ }
586
+
587
+ // Recommend WP Bakery (former Visual Composer) add-on.
588
+ if ( defined( 'WPB_VC_VERSION' )
589
+ && ! is_plugin_active( 'ads-for-visual-composer/advanced-ads-vc.php' )
590
+ && ! is_plugin_active_for_network( 'ads-for-visual-composer/advanced-ads-vc.php' ) ) {
591
+
592
+ // Grab all slugs from the api results.
593
+ $result_slugs = wp_list_pluck( $result->plugins, 'slug' );
594
+
595
+ if ( in_array( 'ads-for-visual-composer', $result_slugs, true ) ) {
596
+ return $result;
597
+ }
598
+
599
+ $query_args = array(
600
+ 'slug' => 'ads-for-visual-composer',
601
+ 'fields' => array(
602
+ 'icons' => true,
603
+ 'active_installs' => true,
604
+ 'short_description' => true,
605
+ 'group' => true,
606
+ ),
607
+ );
608
+ $plugin_data = plugins_api( 'plugin_information', $query_args );
609
+
610
+ if ( ! is_wp_error( $plugin_data ) ) {
611
+ if ( 'featured' === $args->browse ) {
612
+ array_push( $result->plugins, $plugin_data );
613
+ } else {
614
+ array_unshift( $result->plugins, $plugin_data );
615
+ }
616
+ }
617
+ }
618
+
619
+ return $result;
620
+ }
621
+
622
+ /**
623
+ * Overrides WordPress text in Footer
624
+ *
625
+ * @param String $default_text The default footer text.
626
+ *
627
+ * @return string
628
+ */
629
+ public function admin_footer_text( $default_text ) {
630
+ if ( $this->screen_belongs_to_advanced_ads() ) {
631
+
632
+ /* translators: %s is the URL to add a new review, https://wordpress.org/support/plugin/advanced-ads/reviews/?filter=5#new-post */
633
+ return sprintf( __( 'Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a href="%s" target="_blank">wordpress.org</a>', 'advanced-ads' ), 'https://wordpress.org/support/plugin/advanced-ads/reviews/?filter=5#new-post' );
634
+
635
+ }
636
+ return $default_text;
637
+ }
638
+
639
  }
admin/includes/class-ad-type.php CHANGED
@@ -179,15 +179,8 @@ class Advanced_Ads_Admin_Ad_Type {
179
  if ( ! isset( $screen->id ) || $screen->id !== 'edit-advanced_ads' ) {
180
  return;
181
  }
182
-
183
- $timing_filter = apply_filters( 'advanced-ads-ad-list-timing-column-filter', array(
184
- 'advads-filter-expired' => __( 'expired', 'advanced-ads' ),
185
- 'advads-filter-any-exp-date' => __( 'any expiry date', 'advanced-ads' ),
186
- 'advads-filter-future' => __( 'planned', 'advanced-ads' )
187
- ) );
188
-
189
- include ADVADS_BASE_PATH . 'admin/views/ad-list-filters.php';
190
- }
191
 
192
  /**
193
  * edit ad bulk update messages
@@ -222,7 +215,7 @@ class Advanced_Ads_Admin_Ad_Type {
222
  public function ad_list_request($vars){
223
 
224
  // order ads by title on ads list
225
- if ( is_admin() && empty( $vars['orderby'] ) && $this->post_type == $vars['post_type'] ) {
226
  $vars = array_merge( $vars, array(
227
  'orderby' => 'title',
228
  'order' => 'ASC'
@@ -406,7 +399,7 @@ class Advanced_Ads_Admin_Ad_Type {
406
  }
407
 
408
  // highlight Dummy ad if this is the first ad
409
- if( ! Advanced_Ads::get_instance()->get_number_of_ads() ){
410
  ?><style>.advanced-ads-type-list-dummy { font-weight: bold; }</style><?php
411
  }
412
 
179
  if ( ! isset( $screen->id ) || $screen->id !== 'edit-advanced_ads' ) {
180
  return;
181
  }
182
+ include ADVADS_BASE_PATH . 'admin/views/ad-list-filters.php';
183
+ }
 
 
 
 
 
 
 
184
 
185
  /**
186
  * edit ad bulk update messages
215
  public function ad_list_request($vars){
216
 
217
  // order ads by title on ads list
218
+ if ( is_admin() && empty( $vars['orderby'] ) && isset( $vars['post_type'] ) && $this->post_type == $vars['post_type'] ) {
219
  $vars = array_merge( $vars, array(
220
  'orderby' => 'title',
221
  'order' => 'ASC'
399
  }
400
 
401
  // highlight Dummy ad if this is the first ad
402
+ if( ! Advanced_Ads::get_number_of_ads() ){
403
  ?><style>.advanced-ads-type-list-dummy { font-weight: bold; }</style><?php
404
  }
405
 
admin/includes/class-licenses.php CHANGED
@@ -110,12 +110,28 @@ class Advanced_Ads_Admin_Licenses {
110
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
111
  }
112
 
 
 
 
 
 
 
 
 
113
  $api_params = array(
114
  'edd_action'=> 'activate_license',
115
  'license' => $license_key,
116
  'item_name' => urlencode( $plugin_name ),
117
  'url' => home_url()
118
  );
 
 
 
 
 
 
 
 
119
  // Call the custom API.
120
  $response = wp_remote_post( ADVADS_URL, array(
121
  'timeout' => 15,
@@ -129,7 +145,8 @@ class Advanced_Ads_Admin_Licenses {
129
  return $body;
130
  } else {
131
  // return print_r($response, true);
132
- return __( 'License couldn’t be activated. Please try again later.', 'advanced-ads' );
 
133
  }
134
  }
135
 
110
  return apply_filters( 'advanced_ads_license_' . $options_slug, false, __METHOD__, $plugin_name, $options_slug, $license_key );
111
  }
112
 
113
+ /**
114
+ * we need to remove the mltlngg_get_url_translated filter added by Multilanguage by BestWebSoft, https://wordpress.org/plugins/multilanguage/
115
+ * it causes the URL to look much different than it originally is
116
+ * we are adding it again later
117
+ *
118
+ */
119
+ remove_filter( 'home_url', 'mltlngg_get_url_translated' );
120
+
121
  $api_params = array(
122
  'edd_action'=> 'activate_license',
123
  'license' => $license_key,
124
  'item_name' => urlencode( $plugin_name ),
125
  'url' => home_url()
126
  );
127
+
128
+ /**
129
+ * re-add the filter removed from above
130
+ */
131
+ if ( function_exists( 'mltlngg_get_url_translated' ) ) {
132
+ add_filter( 'home_url', 'mltlngg_get_url_translated' );
133
+ }
134
+
135
  // Call the custom API.
136
  $response = wp_remote_post( ADVADS_URL, array(
137
  'timeout' => 15,
145
  return $body;
146
  } else {
147
  // return print_r($response, true);
148
+ $curl = curl_version();
149
+ return __( 'License couldn’t be activated. Please try again later.', 'advanced-ads' ) . " (cURL {$curl['version']})";
150
  }
151
  }
152
 
admin/includes/class-list-filters.php ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Container class for custom filters on admin ad list page.
4
+ *
5
+ * @package WordPress
6
+ * @subpackage Advanced Ads Plugin
7
+ */
8
+
9
+ class Advanced_Ads_Ad_List_Filters {
10
+ /**
11
+ * The unique instance of this class.
12
+ *
13
+ * @var object
14
+ */
15
+ protected static $instance = null;
16
+
17
+ /**
18
+ * Ads data for the ad list table
19
+ *
20
+ * @var array
21
+ */
22
+ protected $all_ads = array();
23
+
24
+ /**
25
+ * Ads ad groups
26
+ *
27
+ * @var array
28
+ */
29
+ protected $all_groups = array();
30
+
31
+ /**
32
+ * Ads in each group
33
+ *
34
+ * @var array
35
+ */
36
+ protected $ads_in_groups = array();
37
+
38
+ /**
39
+ * Ads array with ID as key
40
+ *
41
+ * @var array
42
+ */
43
+ protected $adsbyid = array();
44
+
45
+ /**
46
+ * All filters available in the current ad list table
47
+ *
48
+ * @var array
49
+ */
50
+ protected $all_filters = array();
51
+
52
+ /**
53
+ * All ad options for the ad list table
54
+ *
55
+ * @var array
56
+ */
57
+ protected $all_ads_options = array();
58
+
59
+ /**
60
+ * Constructs the unique instance.
61
+ */
62
+ private function __construct() {
63
+ if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
64
+ add_filter( 'posts_results', array( $this, 'post_results' ), 10, 2 );
65
+ add_filter( 'posts_orderby', array( $this, 'orderby_filter' ), 10, 2 );
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Collect available filters for ad overview page.
71
+ *
72
+ * @param array $posts array of ads.
73
+ * @return array
74
+ */
75
+ private function collect_filters( $posts ) {
76
+
77
+ $all_sizes = array();
78
+ $all_types = array();
79
+ $all_dates = array();
80
+ $all_groups = array();
81
+
82
+ $all_filters = array(
83
+ 'all_sizes' => array(),
84
+ 'all_types' => array(),
85
+ 'all_dates' => array(),
86
+ 'all_groups' => array(),
87
+ );
88
+
89
+ // can not filter correctly with "trashed" posts. Do not display any filtering option in this case.
90
+ if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) {
91
+ $this->all_filters = $all_filters;
92
+ return;
93
+ }
94
+
95
+ $advads = Advanced_Ads::get_instance();
96
+
97
+ foreach ( $posts as $post ) {
98
+
99
+ if ( ! isset( $this->all_ads_options[ $post->ID ] ) ) {
100
+ continue;
101
+ }
102
+ $ad_option = $this->all_ads_options[ $post->ID ];
103
+
104
+ foreach ( $this->ads_in_groups as $key => $ads ) {
105
+ if ( in_array( $post->ID, $ads, true ) ) {
106
+ $all_filters['all_groups'][ $key ] = $this->all_groups[ $key ]['name'];
107
+ break;
108
+ }
109
+ }
110
+
111
+ if ( isset( $ad_option['width'], $ad_option['height'] ) && $ad_option['width'] && $ad_option['height'] ) {
112
+ if ( ! array_key_exists( $ad_option['width'] . 'x' . $ad_option['height'], $all_filters['all_sizes'] ) ) {
113
+ $all_filters['all_sizes'][ $ad_option['width'] . 'x' . $ad_option['height'] ] = $ad_option['width'] . ' x ' . $ad_option['height'];
114
+ }
115
+ }
116
+
117
+ if ( isset( $ad_option['type'] ) && 'adsense' === $ad_option['type'] ) {
118
+ $content = $this->adsbyid[ $post->ID ]->post_content;
119
+ $adsense_obj = false;
120
+ try {
121
+ $adsense_obj = json_decode( $content, true );
122
+ } catch ( Exception $e ) {
123
+ $adsense_obj = false;
124
+ }
125
+
126
+ if ( $adsense_obj ) {
127
+ if ( 'responsive' === $adsense_obj['unitType'] ) {
128
+ if ( ! array_key_exists( 'responsive', $all_filters['all_sizes'] ) ) {
129
+ $all_filters['all_sizes']['responsive'] = __( 'Responsive', 'advanced-ads' );
130
+ }
131
+ }
132
+ }
133
+ }
134
+
135
+ if ( isset( $ad_option['expiry_date'] ) && $ad_option['expiry_date'] ) {
136
+ if ( time() >= absint( $ad_option['expiry_date'] ) ) {
137
+ if ( ! array_key_exists( 'advads-filter-expired', $all_filters['all_dates'] ) ) {
138
+ $all_filters['all_dates']['advads-filter-expired'] = __( 'expired', 'advanced-ads' );
139
+ }
140
+ } else {
141
+ if ( ! array_key_exists( 'advads-filter-any-exp-date', $all_filters['all_dates'] ) ) {
142
+ $all_filters['all_dates']['advads-filter-any-exp-date'] = __( 'any expiry date', 'advanced-ads' );
143
+ }
144
+ }
145
+ }
146
+
147
+ if ( ! array_key_exists( $ad_option['type'], $all_filters['all_types'] )
148
+ && isset( $advads->ad_types[ $ad_option['type'] ] )
149
+ ) {
150
+ $all_filters['all_types'][ $ad_option['type'] ] = $advads->ad_types[ $ad_option['type'] ]->title;
151
+ }
152
+
153
+ $all_filters = apply_filters( 'advanced-ads-ad-list-column-filter', $all_filters, $post, $ad_option );
154
+
155
+ }
156
+
157
+ $this->all_filters = $all_filters;
158
+ }
159
+
160
+ /**
161
+ * Collects all ads data.
162
+ *
163
+ * @param array $posts array of ads.
164
+ */
165
+ public function collect_all_ads( $posts ) {
166
+ $postsbyid = array();
167
+
168
+ foreach ( $posts as $post ) {
169
+ $postsbyid[ $post->ID ] = $post;
170
+ }
171
+
172
+ global $wpdb;
173
+ $meta_results = $wpdb->get_results( $wpdb->prepare( 'SELECT post_id, meta_value FROM `' . $wpdb->prefix . 'postmeta` WHERE `meta_key` = %s', 'advanced_ads_ad_options' ), 'ARRAY_A' );
174
+
175
+ $options = array();
176
+ foreach ( $meta_results as $_value ) {
177
+ $value = unserialize( $_value['meta_value'] );
178
+ $options[ $_value['post_id'] ] = $value;
179
+ }
180
+
181
+ $_groups = Advanced_Ads::get_ad_groups();
182
+
183
+ $groups = array();
184
+
185
+ foreach ( $_groups as $g ) {
186
+ $groups[ $g->term_id ] = array(
187
+ 'name' => $g->name,
188
+ 'slug' => $g->slug,
189
+ );
190
+ }
191
+
192
+ $group_ids = array_keys( $groups );
193
+ $group_ids_str = implode( $group_ids );
194
+ $term_relations = $wpdb->get_results( $wpdb->prepare( 'SELECT object_id, term_taxonomy_id FROM `' . $wpdb->prefix . 'term_relationships` WHERE `term_taxonomy_id` IN (%s)', implode( ',', $group_ids ) ), 'ARRAY_A' );
195
+ foreach ( $term_relations as $value ) {
196
+ if ( ! array_key_exists( absint( $value['term_taxonomy_id'] ), $this->ads_in_groups ) ) {
197
+ $this->ads_in_groups[ absint( $value['term_taxonomy_id'] ) ] = array();
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Store all data
203
+ */
204
+ $this->all_ads = $posts;
205
+ $this->adsbyid = $postsbyid;
206
+ $this->all_ads_options = $options;
207
+
208
+ $this->all_groups = $groups;
209
+ }
210
+
211
+ /**
212
+ * Retrieve the stored ads list.
213
+ */
214
+ public function get_all_ads() {
215
+ return $this->all_ads;
216
+ }
217
+
218
+ /**
219
+ * Retrieve all filters that can be applied.
220
+ */
221
+ public function get_all_filters() {
222
+ return $this->all_filters;
223
+ }
224
+
225
+ /**
226
+ * Re-order the posts list by post title.
227
+ *
228
+ * @param string $orderby the previous orderby value.
229
+ * @param WP_Query $the_query the current WP_Query object.
230
+ */
231
+ public function orderby_filter( $orderby, $the_query ) {
232
+ if ( ! function_exists( 'get_current_screen' ) ) {
233
+ return;
234
+ }
235
+ $scr = get_current_screen();
236
+ global $wpdb;
237
+
238
+ // execute only on the first query.
239
+ if ( ! $scr ) {
240
+ // and only on the ad list page.
241
+ $request = wp_unslash( $_REQUEST );
242
+ $server = wp_unslash( $_SERVER );
243
+ if ( false !== strpos( $server['PHP_SELF'], 'edit.php' ) && isset( $request['post_type'] ) && 'advanced_ads' === $request['post_type'] ) {
244
+ $orderby = 'post_title ASC';
245
+ }
246
+ }
247
+ return $orderby;
248
+ }
249
+
250
+ /**
251
+ * Edit the query for list table.
252
+ *
253
+ * @param array $posts the posts array from the query.
254
+ * @param WP_Query $the_query the current WP_Query object.
255
+ */
256
+ public function post_results( $posts, $the_query ) {
257
+ if ( ! function_exists( 'get_current_screen' ) ) {
258
+ return;
259
+ }
260
+ $scr = get_current_screen();
261
+ // execute only on the first query.
262
+ if ( ! $scr ) {
263
+ // and only on the ad list page.
264
+ $request = wp_unslash( $_REQUEST );
265
+ $server = wp_unslash( $_SERVER );
266
+ if ( false !== strpos( $server['PHP_SELF'], 'edit.php' ) && isset( $request['post_type'] ) && 'advanced_ads' === $request['post_type'] ) {
267
+ $this->collect_all_ads( $posts );
268
+ }
269
+ return $posts;
270
+ }
271
+
272
+ // edit only on ad list page.
273
+ if ( 'edit-advanced_ads' !== $scr->id ) {
274
+ return $posts;
275
+ }
276
+
277
+ // the new post list.
278
+ if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) {
279
+ // if looking in trash, return the original trashed posts list.
280
+ $new_posts = $posts;
281
+ } else {
282
+ // in other cases, apply our custom filters.
283
+ $new_posts = $this->ad_filters( $this->all_ads, $the_query );
284
+ }
285
+
286
+ // re-collect data from the search results.
287
+ if ( isset( $_REQUEST['s'] ) ) {
288
+ $this->collect_all_ads( $posts );
289
+ $new_posts = $this->ad_filters( $this->all_ads, $the_query );
290
+ }
291
+
292
+ // replace the post list.
293
+ $the_query->posts = $new_posts;
294
+
295
+ return $new_posts;
296
+ }
297
+
298
+ /**
299
+ * Apply ad filters on post array
300
+ *
301
+ * @param array $posts the oriinal post array.
302
+ * @param WP_Query $the_query the current WP_Query object.
303
+ */
304
+ private function ad_filters( $posts, &$the_query ) {
305
+ $using_original = true;
306
+ $request = wp_unslash( $_REQUEST );
307
+ /**
308
+ * Filter post status
309
+ */
310
+ if ( isset( $request['post_status'] ) && '' !== $request['post_status'] && ! in_array( $request['post_status'], array( 'all', 'trash' ), true ) ) {
311
+ $new_posts = array();
312
+ foreach ( $this->all_ads as $post ) {
313
+ if ( $request['post_status'] === $post->post_status ) {
314
+ $new_posts[] = $post;
315
+ }
316
+ }
317
+ $posts = $new_posts;
318
+ $the_query->found_posts = count( $posts );
319
+ $using_original = false;
320
+ }
321
+
322
+ /**
323
+ * Filter post author
324
+ */
325
+ if ( isset( $request['author'] ) && '' !== $request['author'] ) {
326
+ $author = absint( $request['author'] );
327
+ $new_posts = array();
328
+ $the_list = $using_original ? $this->all_ads : $posts;
329
+ foreach ( $the_list as $post ) {
330
+ if ( $author === absint( $post->post_author ) ) {
331
+ $new_posts[] = $post;
332
+ }
333
+ }
334
+ $posts = $new_posts;
335
+ $the_query->found_posts = count( $posts );
336
+ $using_original = false;
337
+ }
338
+
339
+ /**
340
+ * Filter groups
341
+ */
342
+ if ( isset( $request['adgroup'] ) && '' !== $request['adgroup'] ) {
343
+ $new_posts = array();
344
+ $the_list = $using_original ? $this->all_ads : $posts;
345
+ foreach ( $the_list as $post ) {
346
+ if ( isset( $this->ads_in_groups[ absint( $request['adgroup'] ) ] ) && in_array( $post->ID, $this->ads_in_groups[ absint( $request['adgroup'] ) ], true ) ) {
347
+ $new_posts[] = $post;
348
+ }
349
+ }
350
+ $posts = $new_posts;
351
+ $the_query->found_posts = count( $posts );
352
+ $using_original = false;
353
+ }
354
+
355
+ /**
356
+ * Filter ad type
357
+ */
358
+ if ( isset( $request['adtype'] ) && '' !== $request['adtype'] ) {
359
+ $new_posts = array();
360
+ $the_list = $using_original ? $this->all_ads : $posts;
361
+ foreach ( $the_list as $post ) {
362
+ if ( isset( $this->all_ads_options[ $post->ID ] ) ) {
363
+ $option = $this->all_ads_options[ $post->ID ];
364
+ if ( $request['adtype'] === $option['type'] ) {
365
+ $new_posts[] = $post;
366
+ }
367
+ }
368
+ }
369
+ $posts = $new_posts;
370
+ $the_query->found_posts = count( $posts );
371
+ $using_original = false;
372
+ }
373
+
374
+ /**
375
+ * Filter ad size
376
+ */
377
+ if ( isset( $request['adsize'] ) && '' !== $request['adsize'] ) {
378
+ $new_posts = array();
379
+ $the_list = $using_original ? $this->all_ads : $posts;
380
+ foreach ( $the_list as $post ) {
381
+ if ( isset( $this->all_ads_options[ $post->ID ] ) ) {
382
+ $option = $this->all_ads_options[ $post->ID ];
383
+ if ( 'responsive' === $request['adsize'] ) {
384
+ if ( 'adsense' === $option['type'] ) {
385
+ $content = false;
386
+ try {
387
+ $content = json_decode( $post->post_content, true );
388
+ } catch ( Exception $e ) {
389
+ $content = false;
390
+ }
391
+ if ( $content && 'responsive' === $content['unitType'] ) {
392
+ $new_posts[] = $post;
393
+ }
394
+ }
395
+ } else {
396
+ $width = isset( $option['width'] ) ? $option['width'] : 0;
397
+ $height = isset( $option['height'] ) ? $option['height'] : 0;
398
+ if ( $request['adsize'] === $width . 'x' . $height ) {
399
+ $new_posts[] = $post;
400
+ }
401
+ }
402
+ }
403
+ }
404
+ $posts = $new_posts;
405
+ $the_query->found_posts = count( $posts );
406
+ $using_original = false;
407
+ }
408
+
409
+ /**
410
+ * Filter ad timing
411
+ */
412
+ if ( isset( $request['addate'] ) && '' !== $request['addate'] ) {
413
+ if ( 'advads-filter-any-exp-date' === urldecode( $request['addate'] ) ) {
414
+ $new_posts = array();
415
+ $the_list = $using_original ? $this->all_ads : $posts;
416
+ foreach ( $the_list as $post ) {
417
+ if ( isset( $this->all_ads_options[ $post->ID ] ) ) {
418
+ $option = $this->all_ads_options[ $post->ID ];
419
+ if ( $option['expiry_date'] ) {
420
+ $new_posts[] = $post;
421
+ }
422
+ }
423
+ }
424
+ $posts = $new_posts;
425
+ $the_query->found_posts = count( $posts );
426
+ $using_original = false;
427
+ } elseif ( 'advads-filter-expired' === urldecode( $request['addate'] ) ) {
428
+ $new_posts = array();
429
+ $the_list = $using_original ? $this->all_ads : $posts;
430
+ foreach ( $the_list as $post ) {
431
+ if ( isset( $this->all_ads_options[ $post->ID ] ) ) {
432
+ $option = $this->all_ads_options[ $post->ID ];
433
+ if ( $option['expiry_date'] && time() >= $option['expiry_date'] ) {
434
+ $new_posts[] = $post;
435
+ }
436
+ }
437
+ }
438
+ $posts = $new_posts;
439
+ $the_query->found_posts = count( $posts );
440
+ $using_original = false;
441
+ }
442
+ }
443
+
444
+ $posts = apply_filters( 'advanced-ads-ad-list-filter', $posts, $this->all_ads_options );
445
+ $the_query->found_posts = count( $posts );
446
+
447
+ $this->collect_filters( $posts );
448
+
449
+ return $posts;
450
+ }
451
+
452
+ /**
453
+ * Return the instance of this class.
454
+ */
455
+ public static function get_instance() {
456
+ // If the single instance hasn't been set, set it now.
457
+ if ( null === self::$instance ) {
458
+ self::$instance = new self();
459
+ }
460
+
461
+ return self::$instance;
462
+ }
463
+ }
admin/includes/class-notices.php CHANGED
@@ -162,8 +162,14 @@ class Advanced_Ads_Admin_Notices {
162
  $paused = isset($options['paused']) ? $options['paused'] : array();
163
 
164
  // register intro message
165
- if( $options === array() && ! in_array( 'nl_intro', $queue ) && ! isset( $closed['nl_intro'] ) ){
 
166
  $this->notices[] = 'nl_intro';
 
 
 
 
 
167
  }
168
  // offer free add-ons if not yet subscribed
169
  if ( $this->user_can_subscribe( ) && ! in_array( 'nl_free_addons', $queue ) && ! isset( $closed['nl_free_addons'] )) {
@@ -573,4 +579,15 @@ class Advanced_Ads_Admin_Notices {
573
  $text = $notice['text'];
574
  include ADVADS_BASE_PATH . '/admin/views/notices/inline.php';
575
  }
 
 
 
 
 
 
 
 
 
 
 
576
  }
162
  $paused = isset($options['paused']) ? $options['paused'] : array();
163
 
164
  // register intro message
165
+ if( ! Advanced_Ads_Admin::get_instance()->screen_belongs_to_advanced_ads()
166
+ && $options === array() && ! in_array( 'nl_intro', $queue ) && ! isset( $closed['nl_intro'] ) ){
167
  $this->notices[] = 'nl_intro';
168
+ } elseif ( Advanced_Ads_Admin::get_instance()->screen_belongs_to_advanced_ads() ){
169
+ $key = array_search( 'nl_intro', $this->notices );
170
+ if ( $key !== false ) {
171
+ unset( $this->notices[$key]);
172
+ }
173
  }
174
  // offer free add-ons if not yet subscribed
175
  if ( $this->user_can_subscribe( ) && ! in_array( 'nl_free_addons', $queue ) && ! isset( $closed['nl_free_addons'] )) {
579
  $text = $notice['text'];
580
  include ADVADS_BASE_PATH . '/admin/views/notices/inline.php';
581
  }
582
+
583
+ /**
584
+ * create the content of a welcome panel like WordPress core does
585
+ */
586
+ public function get_welcome_panel(){
587
+
588
+ ob_start();
589
+ include ADVADS_BASE_PATH . '/admin/views/notices/welcome-panel.php';
590
+ return ob_get_clean();
591
+
592
+ }
593
  }
admin/includes/notices.php CHANGED
@@ -6,7 +6,8 @@ $advanced_ads_admin_notices = apply_filters( 'advanced-ads-notices', array(
6
  // email tutorial
7
  'nl_intro' => array(
8
  'type' => 'info',
9
- 'text' => sprintf(__( 'Advanced Ads successfully installed. <a href="%s" class="button button-primary">Create your first ad</a>', 'advanced-ads' ), admin_url( 'post-new.php?post_type=advanced_ads' )),
 
10
  'global' => true
11
  ),
12
  // email tutorial
6
  // email tutorial
7
  'nl_intro' => array(
8
  'type' => 'info',
9
+ // 'text' => sprintf(__( 'Advanced Ads successfully installed. <a href="%s" class="button button-primary">Create your first ad</a>', 'advanced-ads' ), admin_url( 'post-new.php?post_type=advanced_ads' )),
10
+ 'text' => Advanced_Ads_Admin_Notices::get_welcome_panel(),
11
  'global' => true
12
  ),
13
  // email tutorial
admin/views/ad-conditions-string-operators.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <select name="<?php echo $name; ?>[operator]">
2
+ <option value="contain" <?php selected( 'contain', $operator ); ?>><?php _e( 'contains', 'advanced-ads' ); ?></option>
3
+ <option value="start" <?php selected( 'start', $operator ); ?>><?php _e( 'starts with', 'advanced-ads' ); ?></option>
4
+ <option value="end" <?php selected( 'end', $operator ); ?>><?php _e( 'ends with', 'advanced-ads' ); ?></option>
5
+ <option value="match" <?php selected( 'match', $operator ); ?>><?php _e( 'matches', 'advanced-ads' ); ?></option>
6
+ <option value="regex" <?php selected( 'regex', $operator ); ?>><?php _e( 'matches regex', 'advanced-ads' ); ?></option>
7
+ <option value="contain_not" <?php selected( 'contain_not', $operator ); ?>><?php _e( 'does not contain', 'advanced-ads' ); ?></option>
8
+ <option value="start_not" <?php selected( 'start_not', $operator ); ?>><?php _e( 'does not start with', 'advanced-ads' ); ?></option>
9
+ <option value="end_not" <?php selected( 'end_not', $operator ); ?>><?php _e( 'does not end with', 'advanced-ads' ); ?></option>
10
+ <option value="match_not" <?php selected( 'match_not', $operator ); ?>><?php _e( 'does not match', 'advanced-ads' ); ?></option>
11
+ <option value="regex_not" <?php selected( 'regex_not', $operator ); ?>><?php _e( 'does not match regex', 'advanced-ads' ); ?></option>
12
+ </select>
admin/views/ad-list-filters.php CHANGED
@@ -1,17 +1,47 @@
1
- <select id="advads-filter-type">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  <option value="">- <?php _e( 'all ad types', 'advanced-ads' ); ?> -</option>
 
 
 
3
  </select>
4
- <select id="advads-filter-size">
 
 
5
  <option value="">- <?php _e( 'all ad sizes', 'advanced-ads' ); ?> -</option>
 
 
 
6
  </select>
7
- <select id="advads-filter-date">
 
 
8
  <option value="">- <?php _e( 'all ad dates', 'advanced-ads' ); ?> -</option>
9
- <?php
10
- foreach ( $timing_filter as $_key => $_item ) {
11
- printf( '<option value="%s" style="display:none;">%s</option>', $_key, $_item );
12
- }
13
- ?>
14
  </select>
15
- <select id="advads-filter-group">
 
 
16
  <option value="">- <?php _e( 'all ad groups', 'advanced-ads' ); ?> -</option>
17
- </select>
 
 
 
 
1
+ <?php
2
+ $ad_list_filters = Advanced_Ads_Ad_List_Filters::get_instance();
3
+ $all_filters = $ad_list_filters->get_all_filters();
4
+
5
+ $ad_type = isset( $_REQUEST['adtype'] ) ? $_REQUEST['adtype'] : '';
6
+ $ad_size = isset( $_REQUEST['adsize'] ) ? $_REQUEST['adsize'] : '';
7
+ $ad_date = isset( $_REQUEST['addate'] ) ? $_REQUEST['addate'] : '';
8
+ $ad_group = isset( $_REQUEST['adgroup'] ) ? $_REQUEST['adgroup'] : '';
9
+
10
+ // hide the filter button. Can not filter correctly with "trashed" posts.
11
+ if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) {
12
+ echo '<style type="text/css">#post-query-submit{display:none;}</style>';
13
+ }
14
+
15
+ ?>
16
+ <?php if ( !empty( $all_filters['all_types'] ) ) : ?>
17
+ <select id="advads-filter-type" name="adtype">
18
  <option value="">- <?php _e( 'all ad types', 'advanced-ads' ); ?> -</option>
19
+ <?php foreach( $all_filters['all_types'] as $key => $value ) : ?>
20
+ <option <?php selected( $ad_type, $key ) ?> value="<?php echo esc_attr( $key ) ?>"><?php echo $value ?></option>
21
+ <?php endforeach; ?>
22
  </select>
23
+ <?php endif; ?>
24
+ <?php if ( !empty( $all_filters['all_sizes'] ) ) : ?>
25
+ <select id="advads-filter-size" name="adsize">
26
  <option value="">- <?php _e( 'all ad sizes', 'advanced-ads' ); ?> -</option>
27
+ <?php foreach( $all_filters['all_sizes'] as $key => $value ) : ?>
28
+ <option <?php selected( $ad_size, $key ) ?> value="<?php echo esc_attr( $key ) ?>"><?php echo $value ?></option>
29
+ <?php endforeach; ?>
30
  </select>
31
+ <?php endif; ?>
32
+ <?php if ( !empty( $all_filters['all_dates'] ) ) : ?>
33
+ <select id="advads-filter-date" name="addate">
34
  <option value="">- <?php _e( 'all ad dates', 'advanced-ads' ); ?> -</option>
35
+ <?php foreach ( $all_filters['all_dates'] as $key => $value ) : ?>
36
+ <option <?php selected( $ad_date, $key ) ?> value="<?php echo esc_attr( $key ) ?>"><?php echo $value ?></option>
37
+ <?php endforeach; ?>
 
 
38
  </select>
39
+ <?php endif; ?>
40
+ <?php if ( !empty( $all_filters['all_groups'] ) ) : ?>
41
+ <select id="advads-filter-group" name="adgroup">
42
  <option value="">- <?php _e( 'all ad groups', 'advanced-ads' ); ?> -</option>
43
+ <?php foreach ( $all_filters['all_groups'] as $key => $value ) : ?>
44
+ <option <?php selected( $ad_group, $key ) ?> value="<?php echo esc_attr( $key ) ?>"><?php echo $value ?></option>
45
+ <?php endforeach; ?>
46
+ </select>
47
+ <?php endif; ?>
admin/views/feedback-disable.php CHANGED
@@ -3,23 +3,19 @@
3
  <form action="" method="post">
4
  <p><strong><?php _e('Why did you decide to disable Advanced Ads?', 'advanced-ads'); ?></strong></p>
5
  <ul>
6
- <li><label><input type="radio" name="advanced_ads_disable_reason" value="temporary"/><?php _e('It is only temporary', 'advanced-ads'); ?></label></li>
7
- <li class="advanced_ads_disable_help"><label><input type="radio" name="advanced_ads_disable_reason" value="get help"/><?php _e('I need help to set it up', 'advanced-ads'); ?></label></li>
8
- <li class="advanced_ads_disable_technical_issue"><label><input type="radio" name="advanced_ads_disable_reason" value="technical issue"/><?php _e('I have a problem', 'advanced-ads'); ?></label></li>
9
- <li><textarea name="advanced_ads_disable_text[]" placeholder="<?php _e('Please let us know how we can help', 'advanced-ads'); ?>"></textarea></li>
10
  <?php if( $email ) : ?>
11
  <?php $mailinput = '<input type="email" name="advanced_ads_disable_reply_email" value="'. $email .'"/>'; ?>
12
  <li class="advanced_ads_disable_reply"><label><?php printf(
13
  /* translators: %s is the email address of the current user */
14
  __('Send me free help to %s', 'advanced-ads'), $mailinput ); ?></label></li>
15
  <?php endif; ?>
 
16
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="missing feature"/><?php _e('I miss a feature', 'advanced-ads'); ?></label></li>
17
  <li><input type="text" name="advanced_ads_disable_text[]" value="" placeholder="<?php _e('Which one?', 'advanced-ads'); ?>"/></li>
18
- <li><label><input type="radio" name="advanced_ads_disable_reason" value="stopped showing ads"/><?php _e('I don’t use ads on my site', 'advanced-ads'); ?></label></li>
19
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="other plugin"/><?php _e('I switched to another plugin', 'advanced-ads'); ?></label></li>
20
- <li><input type="text" name="advanced_ads_disable_text[]" value="" placeholder="<?php _e('Which one?', 'advanced-ads'); ?>"/></li>
21
- <li><label><input type="radio" name="advanced_ads_disable_reason" value="other"/><?php _e('other reason', 'advanced-ads'); ?></label></li>
22
- <li><textarea class="advanced_ads_disable_other_text" name="advanced_ads_disable_text[]" placeholder="<?php _e('Please specify', 'advanced-ads'); ?>"></textarea></li>
23
  </ul>
24
  <?php if ($from) : ?>
25
  <input type="hidden" name="advanced_ads_disable_from" value="<?php echo $from; ?>"/>
3
  <form action="" method="post">
4
  <p><strong><?php _e('Why did you decide to disable Advanced Ads?', 'advanced-ads'); ?></strong></p>
5
  <ul>
6
+ <li class="advanced_ads_disable_help"><label><input type="radio" name="advanced_ads_disable_reason" value="get help" checked="checked"/><?php _e('I have a problem, a question or need help.', 'advanced-ads'); ?></label></li>
7
+ <li><textarea class="advanced_ads_disable_help_text" name="advanced_ads_disable_text[]" placeholder="<?php _e('Please let us know how we can help', 'advanced-ads'); ?>"></textarea></li>
 
 
8
  <?php if( $email ) : ?>
9
  <?php $mailinput = '<input type="email" name="advanced_ads_disable_reply_email" value="'. $email .'"/>'; ?>
10
  <li class="advanced_ads_disable_reply"><label><?php printf(
11
  /* translators: %s is the email address of the current user */
12
  __('Send me free help to %s', 'advanced-ads'), $mailinput ); ?></label></li>
13
  <?php endif; ?>
14
+ <li><label><input type="radio" name="advanced_ads_disable_reason" value="temporary"/><?php _e('It is only temporary', 'advanced-ads'); ?></label></li>
15
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="missing feature"/><?php _e('I miss a feature', 'advanced-ads'); ?></label></li>
16
  <li><input type="text" name="advanced_ads_disable_text[]" value="" placeholder="<?php _e('Which one?', 'advanced-ads'); ?>"/></li>
17
+ <li><label><input type="radio" name="advanced_ads_disable_reason" value="stopped showing ads"/><?php _e('I stopped using ads on my site.', 'advanced-ads'); ?></label></li>
18
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="other plugin"/><?php _e('I switched to another plugin', 'advanced-ads'); ?></label></li>
 
 
 
19
  </ul>
20
  <?php if ($from) : ?>
21
  <input type="hidden" name="advanced_ads_disable_from" value="<?php echo $from; ?>"/>
admin/views/notices/error.php CHANGED
@@ -1 +1 @@
1
- <div class="error advads-admin-notice notice is-dismissible message" data-notice="<?php echo $_notice; ?>"><p><?php echo $text; ?></p></div>
1
+ <div class="notice notice-error advads-admin-notice is-dismissible" data-notice="<?php echo $_notice; ?>"><p><?php echo $text; ?></p></div>
admin/views/notices/info.php CHANGED
@@ -1,3 +1,3 @@
1
- <div class="updated advads-admin-notice message notice is-dismissible" data-notice="<?php echo $_notice; ?>">
2
  <p><?php echo $text; ?></p>
3
  </div>
1
+ <div class="notice notice-info advads-admin-notice message is-dismissible" data-notice="<?php echo $_notice; ?>">
2
  <p><?php echo $text; ?></p>
3
  </div>
admin/views/notices/inline.php CHANGED
@@ -1,4 +1,4 @@
1
- <div class="advads-admin-notice-inline advads-admin-notice notice is-dismissible" data-notice="<?php echo $_notice ?>">
2
  <p><?php echo $text; ?>
3
  <button type="button" class="button-primary advads-notices-button-subscribe"><?php echo isset( $notice['confirm_text'] ) ? $notice['confirm_text'] : __('Subscribe me now', 'advanced-ads'); ?></button>
4
  </p>
1
+ <div class="notice notice-info advads-admin-notice-inline advads-admin-notice is-dismissible" data-notice="<?php echo $_notice ?>">
2
  <p><?php echo $text; ?>
3
  <button type="button" class="button-primary advads-notices-button-subscribe"><?php echo isset( $notice['confirm_text'] ) ? $notice['confirm_text'] : __('Subscribe me now', 'advanced-ads'); ?></button>
4
  </p>
admin/views/notices/jqueryui_error.php CHANGED
@@ -1,3 +1,3 @@
1
- <div class="advads-jqueryui-error message error" style="display: none;">
2
  <p><?php printf(__( 'There might be a problem with layouts and scripts in your dashboard. Please check <a href="%s" target="_blank">this article to learn more</a>.', 'advanced-ads' ), ADVADS_URL . 'manual/jquery-problem-in-dashboard/#utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-jquery-error' ); ?></p>
3
  </div>
1
+ <div class="notice notice-error advads-jqueryui-error" style="display: none;">
2
  <p><?php printf(__( 'There might be a problem with layouts and scripts in your dashboard. Please check <a href="%s" target="_blank">this article to learn more</a>.', 'advanced-ads' ), ADVADS_URL . 'manual/jquery-problem-in-dashboard/#utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-jquery-error' ); ?></p>
3
  </div>
admin/views/notices/plugin_error.php CHANGED
@@ -1 +1 @@
1
- <div class="error advads-admin-notice message"><p><?php echo $text; ?><?php ?></p></div>
1
+ <div class="notice notice-error advads-admin-notice"><p><?php echo $text; ?><?php ?></p></div>
admin/views/notices/subscribe.php CHANGED
@@ -1,4 +1,4 @@
1
- <div class="updated advads-admin-notice notice is-dismissible" data-notice="<?php echo $_notice ?>">
2
  <p><?php echo $text; ?>
3
  <button type="button" class="button-primary advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>"><?php echo isset( $notice['confirm_text'] ) ? $notice['confirm_text'] : __('Subscribe me now', 'advanced-ads'); ?></button>
4
  </p>
1
+ <div class="notice notice-info advads-admin-notice is-dismissible" data-notice="<?php echo $_notice ?>">
2
  <p><?php echo $text; ?>
3
  <button type="button" class="button-primary advads-notices-button-subscribe" data-notice="<?php echo $_notice ?>"><?php echo isset( $notice['confirm_text'] ) ? $notice['confirm_text'] : __('Subscribe me now', 'advanced-ads'); ?></button>
4
  </p>
admin/views/notices/welcome-panel.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="aa-welcome-panel">
2
+ <h2><?php _e( 'Welcome to Advanced Ads!', 'advanced-ads' ); ?></h2>
3
+ <div class="aa-welcome-panel-column-container">
4
+ <div class="aa-welcome-panel-column">
5
+ <h3><?php _e( 'Get Started', 'advanced-ads' ); ?></h3>
6
+ <a href="<?php echo admin_url( 'post-new.php?post_type=advanced_ads' ); ?>" class="button button-primary"><?php _e( 'Create your first ad', 'advanced-ads' ); ?></a>
7
+ <ul>
8
+ <li><a href="<?php echo ADVADS_URL . 'manual/first-ad/#utm_source=advanced-ads&utm_medium=link&utm_campaign=welcome-first-ad'; ?>" target="_blank"><?php _e( 'First ad tutorial', 'advanced-ads' ); ?></a></li>
9
+ </ul>
10
+ </div>
11
+ <div class="aa-welcome-panel-column">
12
+ <h3><?php _e( 'AdSense Options', 'advanced-ads' ); ?></h3>
13
+ <a href="<?php echo admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ); ?>" class="button button-primary"><?php _e( 'Import ads from AdSense', 'advanced-ads' ); ?></a>
14
+ <ul>
15
+ <li><a href="<?php echo ADVADS_URL . 'manual/adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=welcome-auto-ads'; ?>" target="_blank"><?php _e( 'Setting up Auto ads', 'advanced-ads' ); ?></a></li>
16
+ <li><a href="<?php echo ADVADS_URL . 'manual/adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=welcome-adsense'; ?>" target="_blank"><?php _e( 'Setting up AdSense ads manually', 'advanced-ads' ); ?></a></li>
17
+ </ul>
18
+ </div>
19
+ <div class="aa-welcome-panel-column aa-welcome-panel-last">
20
+ <h3><?php _e( 'Get Help', 'advanced-ads' ); ?></h3>
21
+ <ul>
22
+ <li><?php printf( __( '<a href="%s" target="_blank">Manual</a>', 'advanced-ads' ), ADVADS_URL . 'manual/#utm_source=advanced-ads&utm_medium=link&utm_campaign=welcome-manual' ); ?></li>
23
+ <li><a href="<?php echo ADVADS_URL . 'support/#utm_source=advanced-ads&utm_medium=link&utm_campaign=welcome-support'; ?>" target="_blank"><?php _e( 'Reach out for help', 'advanced-ads' ); ?></a></li>
24
+ </ul>
25
+ </div>
26
+ </div>
27
+ </div>
admin/views/settings.php CHANGED
@@ -26,7 +26,8 @@ $setting_tabs = apply_filters('advanced-ads-setting-tabs', array(
26
  href="#top#support"><?php _e('Support', 'advanced-ads'); ?></a>
27
  </div>
28
  <?php foreach ( $setting_tabs as $_setting_tab_id => $_setting_tab ) : ?>
29
- <div id="<?php echo $_setting_tab_id; ?>" class="advads-tab">
 
30
  <form class="advads-settings-tab-main-form" method="post" action="options.php">
31
  <?php
32
  if ( isset( $_setting_tab['group'] ) ) {
@@ -89,4 +90,27 @@ jQuery('.toplevel_page_advanced-ads a[href*=#top#support]').click(function(){
89
  }
90
  });
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  </script>
26
  href="#top#support"><?php _e('Support', 'advanced-ads'); ?></a>
27
  </div>
28
  <?php foreach ( $setting_tabs as $_setting_tab_id => $_setting_tab ) : ?>
29
+ <div id="<?php echo $_setting_tab_id; ?>" class="advads-tab">
30
+ <div id="advads-sub-menu-<?php echo $_setting_tab_id; ?>" class="advads-tab-sub-menu"></div>
31
  <form class="advads-settings-tab-main-form" method="post" action="options.php">
32
  <?php
33
  if ( isset( $_setting_tab['group'] ) ) {
90
  }
91
  });
92
 
93
+ // dynamically generate the sub-menu
94
+ jQuery( '.advads-tab-sub-menu' ).each( function( key, e ){
95
+ // abort if scrollIntoView is not supported; we can’t use anchors because they are used for tabs already
96
+ if (typeof e.scrollIntoView !== "function") { return; };
97
+ // get all h2 headlines
98
+ advads_settings_parent_tab = jQuery( e ).parent( '.advads-tab');
99
+ var headlines = advads_settings_parent_tab.find( 'h2' );
100
+ // create list
101
+ if( headlines.length ){
102
+ advads_submenu_list = jQuery('<ul>');
103
+ headlines.each( function( key, h ){
104
+ // create anchor for this headline
105
+ var headline_id = 'advads-tab-headline-' + advads_settings_parent_tab.attr( 'id' ) + key;
106
+ jQuery( h ).attr( 'id', headline_id );
107
+ // place the link in the top menu
108
+ var text = text = h.textContent || h.innerText;
109
+ jQuery( '<li><a onclick="document.getElementById(\'' + headline_id + '\').scrollIntoView()">' + text + '</a></li>' ).appendTo( advads_submenu_list );
110
+ });
111
+ // place the menu
112
+ advads_submenu_list.appendTo( e );
113
+ }
114
+ });
115
+
116
  </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.9
16
  * Author: Thomas Maier
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.9' );
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.10
16
  * Author: Thomas Maier
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.10' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/ad.php CHANGED
@@ -738,6 +738,11 @@ class Advanced_Ads_Ad {
738
  $wrapper['style']['height'] = intval( $this->height ) . 'px';
739
  }
740
 
 
 
 
 
 
741
  return $wrapper;
742
  }
743
 
738
  $wrapper['style']['height'] = intval( $this->height ) . 'px';
739
  }
740
 
741
+ if ( ! empty( $this->output['clearfix_before'] ) ) {
742
+ $wrapper['style']['clear'] = 'both';
743
+ }
744
+
745
+
746
  return $wrapper;
747
  }
748
 
classes/ad_ajax_callbacks.php CHANGED
@@ -7,7 +7,7 @@
7
  * @author Thomas Maier <thomas.maier@webgilde.com>
8
  * @license GPL-2.0+
9
  * @link http://webgilde.com
10
- * @copyright 2013-2015 Thomas Maier, webgilde GmbH
11
  */
12
 
13
  /**
@@ -370,18 +370,7 @@ class Advanced_Ads_Ad_Ajax_Callbacks {
370
  );
371
  }
372
 
373
- $i = 1;
374
- // try to save placement until we found an empty slug
375
- do {
376
  $slug = Advanced_Ads_Placements::save_new_placement( $new_placement );
377
- $new_placement['name'] = $title . ' ' . $i;
378
- $i ++;
379
- if( $i === 100 ){ // prevent endless loop, just in case
380
- Advanced_Ads::log( 'endless loop when injecting placement' );
381
- break;
382
- }
383
- } while ( ! $slug );
384
-
385
  // return potential slug
386
  echo $slug;
387
 
7
  * @author Thomas Maier <thomas.maier@webgilde.com>
8
  * @license GPL-2.0+
9
  * @link http://webgilde.com
10
+ * @copyright 2013-2018 Thomas Maier, webgilde GmbH
11
  */
12
 
13
  /**
370
  );
371
  }
372
 
 
 
 
373
  $slug = Advanced_Ads_Placements::save_new_placement( $new_placement );
 
 
 
 
 
 
 
 
374
  // return potential slug
375
  echo $slug;
376
 
classes/ad_placements.php CHANGED
@@ -118,6 +118,21 @@ class Advanced_Ads_Placements {
118
  // create slug
119
  $new_placement['slug'] = sanitize_title( $new_placement['name'] );
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  // check if slug already exists or is empty
122
  if ( $new_placement['slug'] === '' || isset( $placements[$new_placement['slug']]) || !isset( $new_placement['type'] ) ) {
123
  return false;
118
  // create slug
119
  $new_placement['slug'] = sanitize_title( $new_placement['name'] );
120
 
121
+ if ( isset( $placements[ $new_placement['slug'] ] ) ) {
122
+ $i = 1;
123
+ // try to save placement until we found an empty slug
124
+ do {
125
+ $i ++;
126
+ if ( $i === 100 ) { // prevent endless loop, just in case
127
+ Advanced_Ads::log( 'endless loop when injecting placement' );
128
+ break;
129
+ }
130
+ } while ( isset( $placements[ $new_placement['slug'] . '_' . $i ] ) );
131
+
132
+ $new_placement['slug'] .= '_' . $i;
133
+ $new_placement['name'] .= ' ' . $i;
134
+ }
135
+
136
  // check if slug already exists or is empty
137
  if ( $new_placement['slug'] === '' || isset( $placements[$new_placement['slug']]) || !isset( $new_placement['type'] ) ) {
138
  return false;
classes/ad_type_image.php CHANGED
@@ -86,7 +86,6 @@ class Advanced_Ads_Ad_Type_Image extends Advanced_Ads_Ad_Type_Abstract{
86
  $hwstring = image_hwstring($width, $height);
87
  $attachment = get_post($attachment_id);
88
  $alt = trim(esc_textarea( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) ));
89
- $title = trim(esc_textarea( $attachment->post_title )); // Finally, use the title
90
 
91
  global $wp_current_filter;
92
 
@@ -116,7 +115,7 @@ class Advanced_Ads_Ad_Type_Image extends Advanced_Ads_Ad_Type_Abstract{
116
 
117
  $more_attributes = apply_filters( 'advanced-ads-ad-image-tag-attributes', $more_attributes );
118
 
119
- echo rtrim("<img $hwstring") . " src='$src' alt='$alt' title='$title' $more_attributes $style/>";
120
  }
121
  }
122
 
@@ -145,9 +144,7 @@ class Advanced_Ads_Ad_Type_Image extends Advanced_Ads_Ad_Type_Abstract{
145
  $attachment = get_post($attachment_id);
146
  $alt = trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) ));
147
 
148
- $title = ( $attachment instanceof WP_Post ) ? trim(strip_tags( $attachment->post_title )) : ''; // Finally, use the title
149
-
150
- echo "<img $hwstring src='$src' alt='$alt' title='$title'/>";
151
  }
152
  }
153
 
86
  $hwstring = image_hwstring($width, $height);
87
  $attachment = get_post($attachment_id);
88
  $alt = trim(esc_textarea( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) ));
 
89
 
90
  global $wp_current_filter;
91
 
115
 
116
  $more_attributes = apply_filters( 'advanced-ads-ad-image-tag-attributes', $more_attributes );
117
 
118
+ echo rtrim("<img $hwstring") . " src='$src' alt='$alt' $more_attributes $style/>";
119
  }
120
  }
121
 
144
  $attachment = get_post($attachment_id);
145
  $alt = trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) ));
146
 
147
+ echo "<img $hwstring src='$src' alt='$alt' />";
 
 
148
  }
149
  }
150
 
classes/checks.php CHANGED
@@ -71,12 +71,15 @@ class Advanced_Ads_Checks {
71
  * @return bool true if plugin updates are available
72
  */
73
  public static function plugin_updates_available(){
74
-
75
- $update_data = wp_get_update_data();
76
- $count = absint( $update_data['counts']['plugins'] );
77
-
78
- if( $count ){
79
- return true;
 
 
 
80
  }
81
 
82
  return false;
71
  * @return bool true if plugin updates are available
72
  */
73
  public static function plugin_updates_available(){
74
+
75
+ // iterate throught the plugins and check if any of them is ours (i.e., starts with the string "advanced-ads")
76
+ $update_plugins = get_site_transient( 'update_plugins' );
77
+ if ( ! empty( $update_plugins->response ) ) {
78
+ foreach( $update_plugins->response as $_key => $_responsive ){
79
+ if( 0 === strpos( $_key, 'advanced-ads') ){
80
+ return true;
81
+ }
82
+ }
83
  }
84
 
85
  return false;
classes/compatibility.php CHANGED
@@ -5,6 +5,9 @@ class Advanced_Ads_Compatibility {
5
  if ( defined( 'ELEMENTOR_VERSION' ) ) {
6
  add_filter( 'advanced-ads-placement-content-injection-xpath', array( $this, 'content_injection_elementor' ), 10, 1 );
7
  }
 
 
 
8
  }
9
 
10
  /**
@@ -21,4 +24,16 @@ class Advanced_Ads_Compatibility {
21
  }
22
  return $tag;
23
  }
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
5
  if ( defined( 'ELEMENTOR_VERSION' ) ) {
6
  add_filter( 'advanced-ads-placement-content-injection-xpath', array( $this, 'content_injection_elementor' ), 10, 1 );
7
  }
8
+ if ( defined( 'WP_ROCKET_VERSION' ) ) {
9
+ add_filter( 'rocket_excluded_inline_js_content', array( $this, 'exclude_inline_js' ) );
10
+ }
11
  }
12
 
13
  /**
24
  }
25
  return $tag;
26
  }
27
+
28
+ /**
29
+ * Prevent the 'advanced_ads_ready' function declaration from being merged with other JS
30
+ * and outputted into the footer. This is needed because WP Rocket does not output all
31
+ * the code that depends on this function into the footer.
32
+ *
33
+ * @param array $pattern Patterns to match in inline JS content.
34
+ */
35
+ function exclude_inline_js( $pattern ) {
36
+ $pattern[] = 'advanced_ads_ready';
37
+ return $pattern;
38
+ }
39
  }
classes/display-conditions.php CHANGED
@@ -113,14 +113,26 @@ class Advanced_Ads_Display_Conditions {
113
 
114
 
115
  // register a condition for each taxonomy for posts
116
- $taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true), 'objects', 'or');
 
 
 
117
  foreach ($taxonomies as $_tax) :
118
  if ( in_array( $_tax->name, array( 'advanced_ads_groups' ) ) ) {
119
  continue;
120
  }
 
 
 
 
 
 
 
 
 
121
 
122
  $conditions['taxonomy_' . $_tax->name] = array(
123
- 'label' => $_tax->label,
124
  // 'description' => sprintf(__( 'Choose terms from the %s taxonomy a post must belong to for showing or hiding ads.', 'advanced-ads' ), $_tax->label ),
125
  'metabox' => array('Advanced_Ads_Display_Conditions', 'metabox_taxonomy_terms'), // callback to generate the metabox
126
  'check' => array('Advanced_Ads_Display_Conditions', 'check_taxonomies'), // callback for frontend check
@@ -128,7 +140,7 @@ class Advanced_Ads_Display_Conditions {
128
  );
129
 
130
  $conditions['archive_' . $_tax->name] = array(
131
- 'label' => sprintf(__('archive: %s', 'advanced-ads'), $_tax->labels->singular_name),
132
  // 'description' => sprintf(__( 'Choose on which %s archive page ads are hidden or displayeds.', 'advanced-ads' ), $_tax->label ),
133
  'metabox' => array('Advanced_Ads_Display_Conditions', 'metabox_taxonomy_terms'), // callback to generate the metabox
134
  'check' => array('Advanced_Ads_Display_Conditions', 'check_taxonomy_archive'), // callback for frontend check
113
 
114
 
115
  // register a condition for each taxonomy for posts
116
+ $taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true), 'objects', 'or');
117
+ // count names of taxonomies and adjust label if there are duplicates
118
+ $tax_label_counts = array_count_values( wp_list_pluck( $taxonomies, 'label' ) );
119
+
120
  foreach ($taxonomies as $_tax) :
121
  if ( in_array( $_tax->name, array( 'advanced_ads_groups' ) ) ) {
122
  continue;
123
  }
124
+
125
+ // add tax type to label if we find it multiple times
126
+ if ( $tax_label_counts[ $_tax->label ] < 2 ) {
127
+ $label = $_tax->label;
128
+ $archive_label = $_tax->labels->singular_name;
129
+ } else {
130
+ $label = sprintf( '%s (%s)', $_tax->label, $_tax->name );
131
+ $archive_label = sprintf( '%s (%s)', $_tax->labels->singular_name, $_tax->name );
132
+ }
133
 
134
  $conditions['taxonomy_' . $_tax->name] = array(
135
+ 'label' => $label,
136
  // 'description' => sprintf(__( 'Choose terms from the %s taxonomy a post must belong to for showing or hiding ads.', 'advanced-ads' ), $_tax->label ),
137
  'metabox' => array('Advanced_Ads_Display_Conditions', 'metabox_taxonomy_terms'), // callback to generate the metabox
138
  'check' => array('Advanced_Ads_Display_Conditions', 'check_taxonomies'), // callback for frontend check
140
  );
141
 
142
  $conditions['archive_' . $_tax->name] = array(
143
+ 'label' => sprintf(__('archive: %s', 'advanced-ads'), $archive_label),
144
  // 'description' => sprintf(__( 'Choose on which %s archive page ads are hidden or displayeds.', 'advanced-ads' ), $_tax->label ),
145
  'metabox' => array('Advanced_Ads_Display_Conditions', 'metabox_taxonomy_terms'), // callback to generate the metabox
146
  'check' => array('Advanced_Ads_Display_Conditions', 'check_taxonomy_archive'), // callback for frontend check
classes/plugin.php CHANGED
@@ -165,7 +165,7 @@ class Advanced_Ads_Plugin {
165
  * } );
166
  */
167
 
168
- echo apply_filters( 'advanced-ads-attribution', '<!-- managing ads with Advanced Ads -->' );
169
 
170
  ob_start();
171
  ?><script>
165
  * } );
166
  */
167
 
168
+ echo apply_filters( 'advanced-ads-attribution', sprintf( '<!-- managing ads with Advanced Ads – %s -->', ADVADS_URL ) );
169
 
170
  ob_start();
171
  ?><script>
classes/visitor-conditions.php CHANGED
@@ -200,18 +200,8 @@ class Advanced_Ads_Visitor_Conditions {
200
 
201
  ?><input type="hidden" name="<?php echo $name; ?>[type]" value="<?php echo $options['type']; ?>"/>
202
  <div class="advads-condition-line-wrap">
203
- <select name="<?php echo $name; ?>[operator]">
204
- <option value="contain" <?php selected( 'contain', $operator ); ?>><?php _e( 'contains', 'advanced-ads' ); ?></option>
205
- <option value="start" <?php selected( 'start', $operator ); ?>><?php _e( 'starts with', 'advanced-ads' ); ?></option>
206
- <option value="end" <?php selected( 'end', $operator ); ?>><?php _e( 'ends with', 'advanced-ads' ); ?></option>
207
- <option value="match" <?php selected( 'match', $operator ); ?>><?php _e( 'matches', 'advanced-ads' ); ?></option>
208
- <option value="regex" <?php selected( 'regex', $operator ); ?>><?php _e( 'matches regex', 'advanced-ads' ); ?></option>
209
- <option value="contain_not" <?php selected( 'contain_not', $operator ); ?>><?php _e( 'does not contain', 'advanced-ads' ); ?></option>
210
- <option value="start_not" <?php selected( 'start_not', $operator ); ?>><?php _e( 'does not start with', 'advanced-ads' ); ?></option>
211
- <option value="end_not" <?php selected( 'end_not', $operator ); ?>><?php _e( 'does not end with', 'advanced-ads' ); ?></option>
212
- <option value="match_not" <?php selected( 'match_not', $operator ); ?>><?php _e( 'does not match', 'advanced-ads' ); ?></option>
213
- <option value="regex_not" <?php selected( 'regex_not', $operator ); ?>><?php _e( 'does not match regex', 'advanced-ads' ); ?></option>
214
- </select><input type="text" name="<?php echo $name; ?>[value]" value="<?php echo $value; ?>"/>
215
  </div>
216
  <p class="description"><?php echo $type_options[ $options['type'] ]['description']; ?></p><?php
217
  }
200
 
201
  ?><input type="hidden" name="<?php echo $name; ?>[type]" value="<?php echo $options['type']; ?>"/>
202
  <div class="advads-condition-line-wrap">
203
+ <?php include( ADVADS_BASE_PATH . 'admin/views/ad-conditions-string-operators.php' ); ?>
204
+ <input type="text" name="<?php echo $name; ?>[value]" value="<?php echo $value; ?>"/>
 
 
 
 
 
 
 
 
 
 
205
  </div>
206
  <p class="description"><?php echo $type_options[ $options['type'] ]['description']; ?></p><?php
207
  }
composer.lock CHANGED
@@ -9,16 +9,16 @@
9
  "packages": [
10
  {
11
  "name": "composer/installers",
12
- "version": "v1.4.0",
13
  "source": {
14
  "type": "git",
15
  "url": "https://github.com/composer/installers.git",
16
- "reference": "9ce17fb70e9a38dd8acff0636a29f5cf4d575c1b"
17
  },
18
  "dist": {
19
  "type": "zip",
20
- "url": "https://api.github.com/repos/composer/installers/zipball/9ce17fb70e9a38dd8acff0636a29f5cf4d575c1b",
21
- "reference": "9ce17fb70e9a38dd8acff0636a29f5cf4d575c1b",
22
  "shasum": ""
23
  },
24
  "require": {
@@ -30,7 +30,7 @@
30
  },
31
  "require-dev": {
32
  "composer/composer": "1.0.*@dev",
33
- "phpunit/phpunit": "4.1.*"
34
  },
35
  "type": "composer-plugin",
36
  "extra": {
@@ -101,15 +101,18 @@
101
  "lavalite",
102
  "lithium",
103
  "magento",
 
104
  "mako",
105
  "mediawiki",
106
  "modulework",
 
107
  "moodle",
108
  "osclass",
109
  "phpbb",
110
  "piwik",
111
  "ppi",
112
  "puppet",
 
113
  "reindex",
114
  "roundcube",
115
  "shopware",
@@ -122,7 +125,7 @@
122
  "zend",
123
  "zikula"
124
  ],
125
- "time": "2017-08-09 07:53:48"
126
  },
127
  {
128
  "name": "xrstf/composer-php52",
9
  "packages": [
10
  {
11
  "name": "composer/installers",
12
+ "version": "v1.5.0",
13
  "source": {
14
  "type": "git",
15
  "url": "https://github.com/composer/installers.git",
16
+ "reference": "049797d727261bf27f2690430d935067710049c2"
17
  },
18
  "dist": {
19
  "type": "zip",
20
+ "url": "https://api.github.com/repos/composer/installers/zipball/049797d727261bf27f2690430d935067710049c2",
21
+ "reference": "049797d727261bf27f2690430d935067710049c2",
22
  "shasum": ""
23
  },
24
  "require": {
30
  },
31
  "require-dev": {
32
  "composer/composer": "1.0.*@dev",
33
+ "phpunit/phpunit": "^4.8.36"
34
  },
35
  "type": "composer-plugin",
36
  "extra": {
101
  "lavalite",
102
  "lithium",
103
  "magento",
104
+ "majima",
105
  "mako",
106
  "mediawiki",
107
  "modulework",
108
+ "modx",
109
  "moodle",
110
  "osclass",
111
  "phpbb",
112
  "piwik",
113
  "ppi",
114
  "puppet",
115
+ "pxcms",
116
  "reindex",
117
  "roundcube",
118
  "shopware",
125
  "zend",
126
  "zikula"
127
  ],
128
+ "time": "2017-12-29 09:13:20"
129
  },
130
  {
131
  "name": "xrstf/composer-php52",
languages/advanced-ads.pot CHANGED
@@ -3,18 +3,18 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Advanved Ads\n"
5
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
6
- "POT-Creation-Date: 2018-02-08 11:52+0000\n"
7
  "POT-Revision-Date: Wed Jul 13 2016 13:23:05 GMT+0200 (CEST)\n"
8
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
9
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
10
  "Language-Team: webgilde <thomas.maier@webgilde.com>\n"
11
  "Language: \n"
12
- "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION\n"
13
  "MIME-Version: 1.0\n"
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Generator: Loco - https://localise.biz/\n"
18
  "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
19
  "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
20
  "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
@@ -23,35 +23,44 @@ msgstr ""
23
  "X-Poedit-Basepath: ../\n"
24
  "X-Poedit-SearchPath-0: ."
25
 
26
- #: admin/class-advanced-ads-admin.php:212 classes/display-conditions.php:199
27
- #: classes/visitor-conditions.php:251 admin/views/ad-display-metabox.php:134
 
28
  msgid "or"
29
  msgstr ""
30
 
31
- #: admin/class-advanced-ads-admin.php:213 classes/display-conditions.php:199
32
- #: classes/visitor-conditions.php:251 admin/views/ad-visitor-metabox.php:120
33
  msgid "and"
34
  msgstr ""
35
 
36
- #: admin/class-advanced-ads-admin.php:214
37
  msgid "After which paragraph?"
38
  msgstr ""
39
 
40
- #: admin/class-advanced-ads-admin.php:322
41
  #, php-format
42
  msgid "time of %s"
43
  msgstr ""
44
 
45
- #: admin/class-advanced-ads-admin.php:368 admin/includes/class-menu.php:106
46
- #: admin/includes/class-menu.php:109 admin/views/settings.php:26
47
  msgid "Support"
48
  msgstr ""
49
 
50
- #: admin/class-advanced-ads-admin.php:372
51
  #: admin/includes/class-overview-widgets.php:33
52
  msgid "Add-Ons"
53
  msgstr ""
54
 
 
 
 
 
 
 
 
 
55
  #: classes/ad-debug.php:32
56
  msgid "The ad is displayed on the page"
57
  msgstr ""
@@ -85,11 +94,11 @@ msgid "main query"
85
  msgstr ""
86
 
87
  #: classes/ad-debug.php:118 classes/ad-debug.php:167 classes/ad-debug.php:169
88
- #: public/class-advanced-ads.php:635 admin/views/ad-group-list-ads.php:2
89
  msgid "Ad"
90
  msgstr ""
91
 
92
- #: classes/ad-debug.php:121 public/class-advanced-ads.php:598
93
  msgctxt "ad group singular name"
94
  msgid "Ad Group"
95
  msgstr ""
@@ -173,37 +182,37 @@ msgid ""
173
  "widget."
174
  msgstr ""
175
 
176
- #: classes/ad_placements.php:222
177
  #, php-format
178
  msgid "paragraph (%s)"
179
  msgstr ""
180
 
181
- #: classes/ad_placements.php:223
182
  #, php-format
183
  msgid "paragraph without image (%s)"
184
  msgstr ""
185
 
186
- #: classes/ad_placements.php:224
187
  #, php-format
188
  msgid "headline 2 (%s)"
189
  msgstr ""
190
 
191
- #: classes/ad_placements.php:225
192
  #, php-format
193
  msgid "headline 3 (%s)"
194
  msgstr ""
195
 
196
- #: classes/ad_placements.php:226
197
  #, php-format
198
  msgid "headline 4 (%s)"
199
  msgstr ""
200
 
201
- #: classes/ad_placements.php:556
202
  #, php-format
203
  msgid "Set <em>%s</em> to show more ads"
204
  msgstr ""
205
 
206
- #: classes/ad_placements.php:557 admin/includes/class-settings.php:141
207
  msgid "Disable level limitation"
208
  msgstr ""
209
 
@@ -239,11 +248,7 @@ msgid ""
239
  "display and visitor conditions to all ads in that group."
240
  msgstr ""
241
 
242
- #: classes/ad_type_group.php:92
243
- msgid "The ad cannot use an ad group it is also assigned to."
244
- msgstr ""
245
-
246
- #: classes/ad_type_group.php:96
247
  msgid "ad group"
248
  msgstr ""
249
 
@@ -355,30 +360,30 @@ msgstr ""
355
  msgid "Display ads based on the taxonomy of an archive page."
356
  msgstr ""
357
 
358
- #: classes/display-conditions.php:131
359
  #, php-format
360
  msgid "archive: %s"
361
  msgstr ""
362
 
363
- #: classes/display-conditions.php:234 classes/display-conditions.php:287
364
- #: classes/display-conditions.php:342 classes/display-conditions.php:459
365
  #: classes/visitor-conditions.php:136
366
  msgid "is"
367
  msgstr ""
368
 
369
- #: classes/display-conditions.php:235 classes/display-conditions.php:288
370
- #: classes/display-conditions.php:343 classes/display-conditions.php:460
371
  #: classes/visitor-conditions.php:137
372
  msgid "is not"
373
  msgstr ""
374
 
375
- #: classes/display-conditions.php:258 classes/display-conditions.php:303
376
- #: classes/display-conditions.php:390 classes/display-conditions.php:434
377
  msgctxt "Error message shown when no display condition term is selected"
378
  msgid "Please select some items."
379
  msgstr ""
380
 
381
- #: classes/display-conditions.php:304
382
  #, php-format
383
  msgid ""
384
  "Only %d elements are displayed above. Use the <code>advanced-ads-admin-max-"
@@ -386,80 +391,80 @@ msgid ""
386
  "target=\"_blank\">this page</a>."
387
  msgstr ""
388
 
389
- #: classes/display-conditions.php:425
390
  msgctxt "display the terms search field on ad edit page"
391
  msgid "add more terms"
392
  msgstr ""
393
 
394
- #: classes/display-conditions.php:427
395
  msgid "term name or id"
396
  msgstr ""
397
 
398
- #: classes/display-conditions.php:488
399
  msgid "title or id"
400
  msgstr ""
401
 
402
- #: classes/display-conditions.php:533 includes/array_ad_conditions.php:63
403
  msgid "Home Page"
404
  msgstr ""
405
 
406
- #: classes/display-conditions.php:534 includes/array_ad_conditions.php:64
407
  msgid "show on Home page"
408
  msgstr ""
409
 
410
- #: classes/display-conditions.php:538 includes/array_ad_conditions.php:68
411
  msgid "Singular Pages"
412
  msgstr ""
413
 
414
- #: classes/display-conditions.php:539 includes/array_ad_conditions.php:69
415
  msgid "show on singular pages/posts"
416
  msgstr ""
417
 
418
- #: classes/display-conditions.php:543 includes/array_ad_conditions.php:73
419
  msgid "Archive Pages"
420
  msgstr ""
421
 
422
- #: classes/display-conditions.php:544 includes/array_ad_conditions.php:74
423
  msgid "show on any type of archive page (category, tag, author and date)"
424
  msgstr ""
425
 
426
- #: classes/display-conditions.php:548 includes/array_ad_conditions.php:78
427
  msgid "Search Results"
428
  msgstr ""
429
 
430
- #: classes/display-conditions.php:549 includes/array_ad_conditions.php:79
431
  msgid "show on search result pages"
432
  msgstr ""
433
 
434
- #: classes/display-conditions.php:553 includes/array_ad_conditions.php:83
435
  msgid "404 Page"
436
  msgstr ""
437
 
438
- #: classes/display-conditions.php:554 includes/array_ad_conditions.php:84
439
  msgid "show on 404 error page"
440
  msgstr ""
441
 
442
- #: classes/display-conditions.php:558 includes/array_ad_conditions.php:88
443
  msgid "Attachment Pages"
444
  msgstr ""
445
 
446
- #: classes/display-conditions.php:559 includes/array_ad_conditions.php:89
447
  msgid "show on attachment pages"
448
  msgstr ""
449
 
450
- #: classes/display-conditions.php:563 includes/array_ad_conditions.php:93
451
  msgid "Secondary Queries"
452
  msgstr ""
453
 
454
- #: classes/display-conditions.php:564 includes/array_ad_conditions.php:94
455
  msgid "allow ads in secondary queries"
456
  msgstr ""
457
 
458
- #: classes/display-conditions.php:568
459
  msgid "Feed"
460
  msgstr ""
461
 
462
- #: classes/display-conditions.php:569
463
  msgid "allow ads in Feed"
464
  msgstr ""
465
 
@@ -501,7 +506,7 @@ msgstr ""
501
  msgid "Random AdSense ads"
502
  msgstr ""
503
 
504
- #: classes/frontend_checks.php:92 admin/includes/class-settings.php:456
505
  msgid "You look like a bot"
506
  msgstr ""
507
 
@@ -552,42 +557,51 @@ msgstr ""
552
  msgid "Ad IDs: %s"
553
  msgstr ""
554
 
555
- #: classes/frontend_checks.php:251
 
 
 
 
 
556
  msgid "AdSense violation"
557
  msgstr ""
558
 
559
- #: classes/frontend_checks.php:252
560
  msgid "Ad is hidden"
561
  msgstr ""
562
 
563
- #: classes/frontend_checks.php:253
564
  #, php-format
565
  msgid "IDs: %s"
566
  msgstr ""
567
 
568
- #: classes/frontend_checks.php:266
 
 
 
 
569
  msgid "debug DFP ads"
570
  msgstr ""
571
 
572
- #: classes/frontend_checks.php:277
573
  msgid "highlight ads"
574
  msgstr ""
575
 
576
- #: classes/frontend_checks.php:293
577
  msgid "Ad Health"
578
  msgstr ""
579
 
580
- #: classes/frontend_checks.php:308
581
  msgid "Everything is fine"
582
  msgstr ""
583
 
584
- #: classes/frontend_checks.php:354
585
  msgid ""
586
  "the following code is used for automatic error detection and only visible to "
587
  "admins"
588
  msgstr ""
589
 
590
- #: classes/frontend_checks.php:469
591
  #, php-format
592
  msgid ""
593
  "This ad was automatically placed here by AdSense. <a href=\"%s\" "
@@ -642,75 +656,40 @@ msgstr ""
642
  msgid "equal or lower"
643
  msgstr ""
644
 
645
- #: classes/visitor-conditions.php:204
646
- msgid "contains"
647
- msgstr ""
648
-
649
- #: classes/visitor-conditions.php:205
650
- msgid "starts with"
651
- msgstr ""
652
-
653
- #: classes/visitor-conditions.php:206
654
- msgid "ends with"
655
- msgstr ""
656
-
657
- #: classes/visitor-conditions.php:207
658
- msgid "matches"
659
- msgstr ""
660
-
661
- #: classes/visitor-conditions.php:208
662
- msgid "matches regex"
663
- msgstr ""
664
-
665
- #: classes/visitor-conditions.php:209
666
- msgid "does not contain"
667
- msgstr ""
668
-
669
- #: classes/visitor-conditions.php:210
670
- msgid "does not start with"
671
- msgstr ""
672
-
673
- #: classes/visitor-conditions.php:211
674
- msgid "does not end with"
675
- msgstr ""
676
-
677
- #: classes/visitor-conditions.php:212
678
- msgid "does not match"
679
- msgstr ""
680
-
681
- #: classes/visitor-conditions.php:213
682
- msgid "does not match regex"
683
- msgstr ""
684
-
685
  #: classes/widget.php:22
686
  msgid "Display Ads and Ad Groups."
687
  msgstr ""
688
 
689
- #: classes/widget.php:61
690
  msgid "Title:"
691
  msgstr ""
692
 
693
- #: classes/widget.php:67 admin/includes/class-shortcode-creator.php:82
 
694
  msgid "--empty--"
695
  msgstr ""
696
 
697
- #: classes/widget.php:69 admin/includes/class-menu.php:89
698
  #: admin/includes/class-shortcode-creator.php:98 admin/views/placements.php:18
 
699
  #: modules/import-export/views/page.php:25
700
  msgid "Placements"
701
  msgstr ""
702
 
703
- #: classes/widget.php:76 admin/includes/class-shortcode-creator.php:91
704
- #: admin/views/placements-item.php:4 admin/views/placements.php:192
 
705
  msgid "Ad Groups"
706
  msgstr ""
707
 
708
- #: classes/widget.php:83 public/class-advanced-ads.php:634
709
  #: admin/includes/class-menu.php:62 admin/includes/class-menu.php:62
710
  #: admin/includes/class-shortcode-creator.php:84
711
  #: admin/views/ad-group-list-form-row.php:68
712
  #: admin/views/ad-group-list-header.php:5 admin/views/placements-item.php:11
713
- #: admin/views/placements.php:199 modules/import-export/views/page.php:23
 
 
714
  msgid "Ads"
715
  msgstr ""
716
 
@@ -740,106 +719,106 @@ msgstr ""
740
  msgid "Individual Posts, Pages and Public Post Types"
741
  msgstr ""
742
 
743
- #: public/class-advanced-ads.php:329
744
  msgid "Advanced Ads Error following:"
745
  msgstr ""
746
 
747
- #: public/class-advanced-ads.php:332
748
  #, php-format
749
  msgid "Advanced Ads Error: %s"
750
  msgstr ""
751
 
752
- #: public/class-advanced-ads.php:597
753
  msgctxt "ad group general name"
754
  msgid "Ad Groups & Rotations"
755
  msgstr ""
756
 
757
- #: public/class-advanced-ads.php:599
758
  msgid "Search Ad Groups"
759
  msgstr ""
760
 
761
- #: public/class-advanced-ads.php:600
762
  msgid "All Ad Groups"
763
  msgstr ""
764
 
765
- #: public/class-advanced-ads.php:601
766
  msgid "Parent Ad Groups"
767
  msgstr ""
768
 
769
- #: public/class-advanced-ads.php:602
770
  msgid "Parent Ad Groups:"
771
  msgstr ""
772
 
773
- #: public/class-advanced-ads.php:603
774
  msgid "Edit Ad Group"
775
  msgstr ""
776
 
777
- #: public/class-advanced-ads.php:604
778
  msgid "Update Ad Group"
779
  msgstr ""
780
 
781
- #: public/class-advanced-ads.php:605
782
  msgid "Add New Ad Group"
783
  msgstr ""
784
 
785
- #: public/class-advanced-ads.php:606
786
  msgid "New Ad Groups Name"
787
  msgstr ""
788
 
789
- #: public/class-advanced-ads.php:607 modules/import-export/views/page.php:24
790
  msgid "Groups"
791
  msgstr ""
792
 
793
- #: public/class-advanced-ads.php:608
794
  msgid "No Ad Group found"
795
  msgstr ""
796
 
797
- #: public/class-advanced-ads.php:636 public/class-advanced-ads.php:640
798
  #: admin/includes/class-menu.php:79 admin/views/ad-group-list-ads.php:17
799
  msgid "New Ad"
800
  msgstr ""
801
 
802
- #: public/class-advanced-ads.php:637 admin/includes/class-menu.php:79
803
  msgid "Add New Ad"
804
  msgstr ""
805
 
806
- #: public/class-advanced-ads.php:638
807
  #: admin/includes/class-ad-groups-list.php:313
808
  #: modules/import-export/classes/import.php:146
809
  #: modules/import-export/classes/import.php:186
810
- #: modules/import-export/classes/import.php:562
811
  msgid "Edit"
812
  msgstr ""
813
 
814
- #: public/class-advanced-ads.php:639
815
  msgid "Edit Ad"
816
  msgstr ""
817
 
818
- #: public/class-advanced-ads.php:641
819
  msgid "View"
820
  msgstr ""
821
 
822
- #: public/class-advanced-ads.php:642
823
  msgid "View the Ad"
824
  msgstr ""
825
 
826
- #: public/class-advanced-ads.php:643
827
  msgid "Search Ads"
828
  msgstr ""
829
 
830
- #: public/class-advanced-ads.php:644
831
  msgid "No Ads found"
832
  msgstr ""
833
 
834
- #: public/class-advanced-ads.php:645
835
  msgid "No Ads found in Trash"
836
  msgstr ""
837
 
838
- #: public/class-advanced-ads.php:646
839
  msgid "Parent Ad"
840
  msgstr ""
841
 
842
- #: public/class-advanced-ads.php:771
843
  msgctxt "label above ads"
844
  msgid "Advertisements"
845
  msgstr ""
@@ -934,86 +913,74 @@ msgstr ""
934
  msgid "Ad Planning"
935
  msgstr ""
936
 
937
- #: admin/includes/class-ad-type.php:184
938
- msgid "expired"
939
- msgstr ""
940
-
941
- #: admin/includes/class-ad-type.php:185
942
- msgid "any expiry date"
943
- msgstr ""
944
-
945
- #: admin/includes/class-ad-type.php:186
946
- msgid "planned"
947
- msgstr ""
948
-
949
- #: admin/includes/class-ad-type.php:206
950
  #, php-format
951
  msgid "%s ad updated."
952
  msgid_plural "%s ads updated."
953
  msgstr[0] ""
954
  msgstr[1] ""
955
 
956
- #: admin/includes/class-ad-type.php:207
957
  #, php-format
958
  msgid "%s ad not updated, somebody is editing it."
959
  msgid_plural "%s ads not updated, somebody is editing them."
960
  msgstr[0] ""
961
  msgstr[1] ""
962
 
963
- #: admin/includes/class-ad-type.php:208
964
  #, php-format
965
  msgid "%s ad permanently deleted."
966
  msgid_plural "%s ads permanently deleted."
967
  msgstr[0] ""
968
  msgstr[1] ""
969
 
970
- #: admin/includes/class-ad-type.php:209
971
  #, php-format
972
  msgid "%s ad moved to the Trash."
973
  msgid_plural "%s ads moved to the Trash."
974
  msgstr[0] ""
975
  msgstr[1] ""
976
 
977
- #: admin/includes/class-ad-type.php:210
978
  #, php-format
979
  msgid "%s ad restored from the Trash."
980
  msgid_plural "%s ads restored from the Trash."
981
  msgstr[0] ""
982
  msgstr[1] ""
983
 
984
- #: admin/includes/class-ad-type.php:539 admin/includes/class-ad-type.php:540
985
  msgid "Ad updated."
986
  msgstr ""
987
 
988
  #. translators: %s: date and time of the revision
989
- #: admin/includes/class-ad-type.php:542
990
  #, php-format
991
  msgid "Ad restored to revision from %s"
992
  msgstr ""
993
 
994
- #: admin/includes/class-ad-type.php:543 admin/includes/class-ad-type.php:544
995
  msgid "Ad saved."
996
  msgstr ""
997
 
998
- #: admin/includes/class-ad-type.php:545
999
  msgid "Ad submitted."
1000
  msgstr ""
1001
 
1002
- #: admin/includes/class-ad-type.php:547
1003
  #, php-format
1004
  msgid "Ad scheduled for: <strong>%1$s</strong>."
1005
  msgstr ""
1006
 
1007
  #. translators: Publish box date format, see http://php.net/date
1008
- #: admin/includes/class-ad-type.php:549
1009
  msgid "M j, Y @ G:i"
1010
  msgstr ""
1011
 
1012
- #: admin/includes/class-ad-type.php:551
1013
  msgid "Ad draft updated."
1014
  msgstr ""
1015
 
1016
- #: admin/includes/class-ad-type.php:638
1017
  msgid ""
1018
  "You don’t have access to ads. Please deactivate and re-enable Advanced Ads "
1019
  "again to fix this."
@@ -1035,47 +1002,68 @@ msgstr ""
1035
  msgid "Please enter a valid license key"
1036
  msgstr ""
1037
 
1038
- #: admin/includes/class-licenses.php:132
1039
  msgid "License couldn’t be activated. Please try again later."
1040
  msgstr ""
1041
 
1042
- #: admin/includes/class-licenses.php:147
1043
  msgid "This is the bundle license key."
1044
  msgstr ""
1045
 
1046
- #: admin/includes/class-licenses.php:148
1047
  msgid "This is not the correct key for this add-on."
1048
  msgstr ""
1049
 
1050
- #: admin/includes/class-licenses.php:149
1051
  msgid "There are no activations left."
1052
  msgstr ""
1053
 
1054
- #: admin/includes/class-licenses.php:158
1055
  #, php-format
1056
  msgid "License is invalid. Reason: %s"
1057
  msgstr ""
1058
 
1059
- #: admin/includes/class-licenses.php:218
1060
  msgid "Error while trying to disable the license. Please contact support."
1061
  msgstr ""
1062
 
1063
- #: admin/includes/class-licenses.php:245 admin/includes/class-licenses.php:262
1064
  msgid "License couldn’t be deactivated. Please try again later."
1065
  msgstr ""
1066
 
1067
- #: admin/includes/class-licenses.php:469
 
 
 
 
 
 
 
1068
  #, php-format
1069
  msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
1070
  msgstr ""
1071
 
1072
- #: admin/includes/class-licenses.php:471
1073
  #, php-format
1074
  msgid ""
1075
  "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>"
1076
  "."
1077
  msgstr ""
1078
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1079
  #: admin/includes/class-menu.php:55 admin/includes/class-menu.php:68
1080
  #: admin/includes/class-menu.php:72 admin/includes/class-menu.php:72
1081
  msgid "Overview"
@@ -1101,11 +1089,11 @@ msgstr ""
1101
  msgid "Settings"
1102
  msgstr ""
1103
 
1104
- #: admin/includes/class-menu.php:191 admin/includes/class-menu.php:218
1105
  msgid "Sorry, you are not allowed to access this feature."
1106
  msgstr ""
1107
 
1108
- #: admin/includes/class-menu.php:204
1109
  msgid ""
1110
  "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was "
1111
  "deleted?"
@@ -1132,8 +1120,9 @@ msgid "Ad Stats"
1132
  msgstr ""
1133
 
1134
  #: admin/includes/class-meta-box.php:140 admin/includes/class-meta-box.php:151
1135
- #: admin/includes/class-meta-box.php:156 admin/includes/class-settings.php:554
1136
  #: admin/views/ad-output-metabox.php:51
 
1137
  msgid "Manual"
1138
  msgstr ""
1139
 
@@ -1174,19 +1163,19 @@ msgstr ""
1174
  msgid "Advanced Ads Tutorials"
1175
  msgstr ""
1176
 
1177
- #: admin/includes/class-notices.php:458
1178
  #, php-format
1179
  msgid ""
1180
  "You don’t seem to have an email address. Please use <a href=\"%s\" "
1181
  "target=\"_blank\">this form</a> to sign up."
1182
  msgstr ""
1183
 
1184
- #: admin/includes/class-notices.php:476
1185
  msgid ""
1186
  "How embarrassing. The email server seems to be down. Please try again later."
1187
  msgstr ""
1188
 
1189
- #: admin/includes/class-notices.php:481
1190
  #, php-format
1191
  msgid ""
1192
  "Please check your email (%s) for the confirmation message. If you didn’t "
@@ -1203,6 +1192,7 @@ msgid "Manual and Support"
1203
  msgstr ""
1204
 
1205
  #: admin/includes/class-overview-widgets.php:65
 
1206
  msgid "Create your first ad"
1207
  msgstr ""
1208
 
@@ -1226,17 +1216,17 @@ msgstr ""
1226
  msgid "Join now"
1227
  msgstr ""
1228
 
1229
- #: admin/includes/class-overview-widgets.php:90 admin/includes/notices.php:48
1230
  msgid ""
1231
  "Do you find Advanced Ads useful and would like to keep us motivated? Please "
1232
  "help us with a review."
1233
  msgstr ""
1234
 
1235
- #: admin/includes/class-overview-widgets.php:92 admin/includes/notices.php:51
1236
  msgid "Sure, I’ll rate the plugin"
1237
  msgstr ""
1238
 
1239
- #: admin/includes/class-overview-widgets.php:94 admin/includes/notices.php:52
1240
  msgid "I already did"
1241
  msgstr ""
1242
 
@@ -1249,6 +1239,7 @@ msgid "Get the All Access pass"
1249
  msgstr ""
1250
 
1251
  #: admin/includes/class-overview-widgets.php:130
 
1252
  #, php-format
1253
  msgid "<a href=\"%s\" target=\"_blank\">Manual</a>"
1254
  msgstr ""
@@ -1258,13 +1249,6 @@ msgstr ""
1258
  msgid "<a href=\"%s\" target=\"_blank\">FAQ and Support</a>"
1259
  msgstr ""
1260
 
1261
- #: admin/includes/class-overview-widgets.php:132
1262
- #, php-format
1263
- msgid ""
1264
- "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a "
1265
- "href=\"%s\" target=\"_blank\">wordpress.org</a>"
1266
- msgstr ""
1267
-
1268
  #: admin/includes/class-overview-widgets.php:149
1269
  msgid "The solution for professional websites."
1270
  msgstr ""
@@ -1380,7 +1364,8 @@ msgid "Use Genesis specific ad positions."
1380
  msgstr ""
1381
 
1382
  #: admin/includes/class-overview-widgets.php:409
1383
- msgid "Manage ad positions with Visual Composer."
 
1384
  msgstr ""
1385
 
1386
  #: admin/includes/class-overview-widgets.php:425
@@ -1433,94 +1418,90 @@ msgid "ID prefix"
1433
  msgstr ""
1434
 
1435
  #: admin/includes/class-settings.php:173
1436
- msgid "Remove Widget ID"
1437
- msgstr ""
1438
-
1439
- #: admin/includes/class-settings.php:181
1440
  msgid "Allow editors to manage ads"
1441
  msgstr ""
1442
 
1443
- #: admin/includes/class-settings.php:189
1444
  msgid "Ad label"
1445
  msgstr ""
1446
 
1447
- #: admin/includes/class-settings.php:198
1448
  msgid "Open links in a new window"
1449
  msgstr ""
1450
 
1451
- #: admin/includes/class-settings.php:208
1452
  msgid "Delete data on uninstall"
1453
  msgstr ""
1454
 
1455
- #: admin/includes/class-settings.php:218
1456
  msgid "Disable shortcode button"
1457
  msgstr ""
1458
 
1459
- #: admin/includes/class-settings.php:239
1460
  msgid "Licenses"
1461
  msgstr ""
1462
 
1463
- #: admin/includes/class-settings.php:256
1464
  msgid "Pro"
1465
  msgstr ""
1466
 
1467
- #: admin/includes/class-settings.php:272 admin/views/pitch-tracking.php:2
1468
  msgid "Tracking"
1469
  msgstr ""
1470
 
1471
- #: admin/includes/class-settings.php:293
1472
  #, php-format
1473
  msgid ""
1474
  "Enter license keys for our powerful <a href=\"%s\" target=\"_blank\">add-"
1475
  "ons</a>."
1476
  msgstr ""
1477
 
1478
- #: admin/includes/class-settings.php:294
1479
  #, php-format
1480
  msgid ""
1481
  "See also <a href=\"%s\" target=\"_blank\">Issues and questions about "
1482
  "licenses</a>."
1483
  msgstr ""
1484
 
1485
- #: admin/includes/class-settings.php:306
1486
  msgid "Are you missing something?"
1487
  msgstr ""
1488
 
1489
- #: admin/includes/class-settings.php:360
1490
  msgid "(display to all)"
1491
  msgstr ""
1492
 
1493
- #: admin/includes/class-settings.php:361
1494
  msgid "Subscriber"
1495
  msgstr ""
1496
 
1497
- #: admin/includes/class-settings.php:362
1498
  msgid "Contributor"
1499
  msgstr ""
1500
 
1501
- #: admin/includes/class-settings.php:363
1502
  msgid "Author"
1503
  msgstr ""
1504
 
1505
- #: admin/includes/class-settings.php:364
1506
  msgid "Editor"
1507
  msgstr ""
1508
 
1509
- #: admin/includes/class-settings.php:365
1510
  msgid "Admin"
1511
  msgstr ""
1512
 
1513
- #: admin/includes/class-settings.php:373
1514
  msgid "Choose the lowest role a user must have in order to not see any ads."
1515
  msgstr ""
1516
 
1517
- #: admin/includes/class-settings.php:387
1518
  msgid ""
1519
  "<strong>notice: </strong>the file is currently enabled by an add-on that "
1520
  "needs it."
1521
  msgstr ""
1522
 
1523
- #: admin/includes/class-settings.php:390
1524
  #, php-format
1525
  msgid ""
1526
  "Enable advanced JavaScript functions (<a href=\"%s\" target=\"_blank\">"
@@ -1528,7 +1509,7 @@ msgid ""
1528
  "need features from this file."
1529
  msgstr ""
1530
 
1531
- #: admin/includes/class-settings.php:410
1532
  msgid ""
1533
  "Some plugins and themes trigger ad injections where it shouldn’t happen. "
1534
  "Therefore, Advanced Ads ignores injected placements on non-singular pages "
@@ -1538,84 +1519,72 @@ msgid ""
1538
  "injection only in the first x posts on your archive pages."
1539
  msgstr ""
1540
 
1541
- #: admin/includes/class-settings.php:426
1542
  msgid ""
1543
  "Please check your post content. A priority of 10 and below might cause "
1544
  "issues (wpautop function might run twice)."
1545
  msgstr ""
1546
 
1547
- #: admin/includes/class-settings.php:428
1548
  msgid ""
1549
  "Play with this value in order to change the priority of the injected ads "
1550
  "compared to other auto injected elements in the post content."
1551
  msgstr ""
1552
 
1553
- #: admin/includes/class-settings.php:442
1554
  msgid ""
1555
  "Advanced Ads ignores paragraphs and other elements in containers when "
1556
  "injecting ads into the post content. Check this option to ignore this "
1557
  "limitation and ads might show up again."
1558
  msgstr ""
1559
 
1560
- #: admin/includes/class-settings.php:458
1561
  msgid "Read this first"
1562
  msgstr ""
1563
 
1564
- #: admin/includes/class-settings.php:459
1565
  msgid "Hide ads from crawlers, bots and empty user agents."
1566
  msgstr ""
1567
 
1568
- #: admin/includes/class-settings.php:472
1569
  msgid ""
1570
  "Disable internal notices like tips, tutorials, email newsletters and update "
1571
  "notices. Disabling notices is recommended if you run multiple blogs with "
1572
  "Advanced Ads already."
1573
  msgstr ""
1574
 
1575
- #: admin/includes/class-settings.php:489
1576
  msgid ""
1577
  "Prefix of class or id attributes in the frontend. Change it if you don’t "
1578
  "want <strong>ad blockers</strong> to mark these blocks as ads.<br/>You might "
1579
  "need to <strong>rewrite css rules afterwards</strong>."
1580
  msgstr ""
1581
 
1582
- #: admin/includes/class-settings.php:510
1583
- msgid ""
1584
- "Remove the ID attribute from widgets in order to not make them an easy "
1585
- "target of ad blockers."
1586
- msgstr ""
1587
-
1588
- #: admin/includes/class-settings.php:513
1589
- msgid ""
1590
- "If checked, the Advanced Ads Widget will not work with the fixed option of "
1591
- "the <strong>Q2W3 Fixed Widget</strong> plugin."
1592
- msgstr ""
1593
-
1594
- #: admin/includes/class-settings.php:535
1595
  msgid "Allow editors to also manage and publish ads."
1596
  msgstr ""
1597
 
1598
- #: admin/includes/class-settings.php:536
1599
  #, php-format
1600
  msgid ""
1601
  "You can assign different ad-related roles on a user basis with <a "
1602
  "href=\"%s\" target=\"_blank\">Advanced Ads Pro</a>."
1603
  msgstr ""
1604
 
1605
- #: admin/includes/class-settings.php:547
1606
  msgctxt "label before ads"
1607
  msgid "Advertisements"
1608
  msgstr ""
1609
 
1610
- #: admin/includes/class-settings.php:554
1611
  msgid "Displayed above ads."
1612
  msgstr ""
1613
 
1614
- #: admin/includes/class-settings.php:588
1615
  msgid "Clean up all data related to Advanced Ads when removing the plugin."
1616
  msgstr ""
1617
 
1618
- #: admin/includes/class-settings.php:601
1619
  msgid "Disable shortcode button in visual editor."
1620
  msgstr ""
1621
 
@@ -1626,69 +1595,62 @@ msgid ""
1626
  "the <a href=\"%s\" target=\"_blank\">settings</a>."
1627
  msgstr ""
1628
 
1629
- #: admin/includes/notices.php:9
1630
- #, php-format
1631
- msgid ""
1632
- "Advanced Ads successfully installed. <a href=\"%s\" class=\"button button-"
1633
- "primary\">Create your first ad</a>"
1634
- msgstr ""
1635
-
1636
- #: admin/includes/notices.php:15
1637
  msgid ""
1638
  "Thank you for activating <strong>Advanced Ads</strong>. Would you like to "
1639
  "receive the first steps via email?"
1640
  msgstr ""
1641
 
1642
- #: admin/includes/notices.php:16
1643
  msgid "Yes, send it"
1644
  msgstr ""
1645
 
1646
- #: admin/includes/notices.php:22
1647
  msgid ""
1648
  "Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive "
1649
  "<strong>2 free add-ons</strong> for joining the newsletter."
1650
  msgstr ""
1651
 
1652
- #: admin/includes/notices.php:23
1653
  msgid "Add me now"
1654
  msgstr ""
1655
 
1656
- #: admin/includes/notices.php:29
1657
  msgid ""
1658
  "Learn more about how and <strong>how much you can earn with AdSense</strong> "
1659
  "and Advanced Ads from my dedicated newsletter."
1660
  msgstr ""
1661
 
1662
- #: admin/includes/notices.php:30 admin/views/notices/inline.php:3
1663
  #: admin/views/notices/subscribe.php:3
1664
  msgid "Subscribe me now"
1665
  msgstr ""
1666
 
1667
- #: admin/includes/notices.php:41
1668
  msgid ""
1669
  "One or more license keys for <strong>Advanced Ads add-ons are invalid or "
1670
  "missing</strong>."
1671
  msgstr ""
1672
 
1673
- #: admin/includes/notices.php:41
1674
  #, php-format
1675
  msgid "Please add valid license keys <a href=\"%s\">here</a>."
1676
  msgstr ""
1677
 
1678
- #: admin/includes/notices.php:47
1679
  #, php-format
1680
  msgid "You’ve successfully <strong>created %s ads using Advanced Ads</strong>."
1681
  msgstr ""
1682
 
1683
- #: admin/includes/notices.php:53
1684
  msgid "I am not happy, please help"
1685
  msgstr ""
1686
 
1687
- #: admin/includes/notices.php:54
1688
  msgid "Ask me later"
1689
  msgstr ""
1690
 
1691
- #: admin/includes/notices.php:61
1692
  #, php-format
1693
  msgid ""
1694
  "Some assets were changed. Please <strong>rebuild the asset folder</strong> "
@@ -1711,6 +1673,47 @@ msgctxt "shortcode creator"
1711
  msgid "Cancel"
1712
  msgstr ""
1713
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1714
  #: admin/views/ad-display-metabox.php:7
1715
  msgid "parent page"
1716
  msgstr ""
@@ -1762,7 +1765,7 @@ msgid "Forced to OR."
1762
  msgstr ""
1763
 
1764
  #: admin/views/ad-display-metabox.php:72
1765
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:66
1766
  msgid "manual"
1767
  msgstr ""
1768
 
@@ -1824,11 +1827,12 @@ msgid "weight"
1824
  msgstr ""
1825
 
1826
  #: admin/views/ad-group-list-form-row.php:12 admin/views/placements.php:24
 
1827
  msgid "Name"
1828
  msgstr ""
1829
 
1830
  #: admin/views/ad-group-list-form-row.php:41 admin/views/placements.php:23
1831
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:55
1832
  msgid "Type"
1833
  msgstr ""
1834
 
@@ -1980,19 +1984,19 @@ msgstr ""
1980
  msgid "Internal description or your own notes about this ad."
1981
  msgstr ""
1982
 
1983
- #: admin/views/ad-list-filters.php:2
1984
  msgid "all ad types"
1985
  msgstr ""
1986
 
1987
- #: admin/views/ad-list-filters.php:5
1988
  msgid "all ad sizes"
1989
  msgstr ""
1990
 
1991
- #: admin/views/ad-list-filters.php:8
1992
  msgid "all ad dates"
1993
  msgstr ""
1994
 
1995
- #: admin/views/ad-list-filters.php:16
1996
  msgid "all ad groups"
1997
  msgstr ""
1998
 
@@ -2214,6 +2218,7 @@ msgid ""
2214
  msgstr ""
2215
 
2216
  #: admin/views/ad-visitor-metabox.php:71
 
2217
  msgid "It seems that a caching plugin is activated."
2218
  msgstr ""
2219
 
@@ -2314,59 +2319,47 @@ msgid "Why did you decide to disable Advanced Ads?"
2314
  msgstr ""
2315
 
2316
  #: admin/views/feedback-disable.php:6
2317
- msgid "It is only temporary"
2318
  msgstr ""
2319
 
2320
  #: admin/views/feedback-disable.php:7
2321
- msgid "I need help to set it up"
2322
- msgstr ""
2323
-
2324
- #: admin/views/feedback-disable.php:8
2325
- msgid "I have a problem"
2326
- msgstr ""
2327
-
2328
- #: admin/views/feedback-disable.php:9
2329
  msgid "Please let us know how we can help"
2330
  msgstr ""
2331
 
2332
- #: admin/views/feedback-disable.php:14
2333
  #, php-format
2334
  msgid "Send me free help to %s"
2335
  msgstr ""
2336
 
2337
- #: admin/views/feedback-disable.php:16
 
 
 
 
2338
  msgid "I miss a feature"
2339
  msgstr ""
2340
 
2341
- #: admin/views/feedback-disable.php:17 admin/views/feedback-disable.php:20
2342
  msgid "Which one?"
2343
  msgstr ""
2344
 
2345
- #: admin/views/feedback-disable.php:18
2346
- msgid "I don’t use ads on my site"
2347
  msgstr ""
2348
 
2349
- #: admin/views/feedback-disable.php:19
2350
  msgid "I switched to another plugin"
2351
  msgstr ""
2352
 
2353
- #: admin/views/feedback-disable.php:21
2354
- msgid "other reason"
2355
- msgstr ""
2356
-
2357
- #: admin/views/feedback-disable.php:22
2358
- msgid "Please specify"
2359
- msgstr ""
2360
-
2361
- #: admin/views/feedback-disable.php:27
2362
  msgid "Submit & Deactivate"
2363
  msgstr ""
2364
 
2365
- #: admin/views/feedback-disable.php:28
2366
  msgid "Keep it & get a reply within 12h"
2367
  msgstr ""
2368
 
2369
- #: admin/views/feedback-disable.php:30
2370
  msgid "Only Deactivate"
2371
  msgstr ""
2372
 
@@ -2527,7 +2520,7 @@ msgstr ""
2527
  msgid "start counting from bottom"
2528
  msgstr ""
2529
 
2530
- #: admin/views/placements-item.php:2 admin/views/placements.php:190
2531
  msgid "--not selected--"
2532
  msgstr ""
2533
 
@@ -2577,95 +2570,95 @@ msgstr ""
2577
  msgid "Item"
2578
  msgstr ""
2579
 
2580
- #: admin/views/placements.php:95
2581
  msgid "position"
2582
  msgstr ""
2583
 
2584
- #: admin/views/placements.php:99
2585
  msgid "Important Notice"
2586
  msgstr ""
2587
 
2588
- #: admin/views/placements.php:99
2589
  msgid ""
2590
  "Your server is missing an extension. This might break the content injection."
2591
  "<br/>Ignore this warning if everything works fine or else ask your hosting "
2592
  "provider to enable <em>mbstring</em>."
2593
  msgstr ""
2594
 
2595
- #: admin/views/placements.php:120
2596
  msgid "ad label"
2597
  msgstr ""
2598
 
2599
- #: admin/views/placements.php:128
2600
  msgid "show all options"
2601
  msgstr ""
2602
 
2603
- #: admin/views/placements.php:137
2604
  #, php-format
2605
  msgid ""
2606
  "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the "
2607
  "header of your website</a>."
2608
  msgstr ""
2609
 
2610
- #: admin/views/placements.php:144
2611
  msgctxt "checkbox to remove placement"
2612
  msgid "delete"
2613
  msgstr ""
2614
 
2615
- #: admin/views/placements.php:151
2616
  msgid "Save Placements"
2617
  msgstr ""
2618
 
2619
- #: admin/views/placements.php:153
2620
  msgid "Create a new placement"
2621
  msgstr ""
2622
 
2623
- #: admin/views/placements.php:154
2624
  msgid "New Placement"
2625
  msgstr ""
2626
 
2627
- #: admin/views/placements.php:163
2628
  msgid "Choose a placement type"
2629
  msgstr ""
2630
 
2631
- #: admin/views/placements.php:164
2632
  #, php-format
2633
  msgid ""
2634
  "Placement types define where the ad is going to be displayed. Learn more "
2635
  "about the different types from the <a href=\"%s\">manual</a>"
2636
  msgstr ""
2637
 
2638
- #: admin/views/placements.php:181
2639
  msgid "Please select a placement type."
2640
  msgstr ""
2641
 
2642
- #: admin/views/placements.php:183
2643
  msgid "Choose a Name"
2644
  msgstr ""
2645
 
2646
- #: admin/views/placements.php:184
2647
  msgid ""
2648
  "The name of the placement is only visible to you. Tip: choose a descriptive "
2649
  "one, e.g. <em>Below Post Headline</em>."
2650
  msgstr ""
2651
 
2652
- #: admin/views/placements.php:185
2653
  msgid "Placement Name"
2654
  msgstr ""
2655
 
2656
- #: admin/views/placements.php:186
2657
  msgid "Please enter a name for your placement."
2658
  msgstr ""
2659
 
2660
- #: admin/views/placements.php:187
2661
  msgid "Choose the Ad or Group"
2662
  msgstr ""
2663
 
2664
- #: admin/views/placements.php:188
2665
  msgid "The ad or group that should be displayed."
2666
  msgstr ""
2667
 
2668
- #: admin/views/placements.php:207
2669
  msgid "Save New Placement"
2670
  msgstr ""
2671
 
@@ -2765,11 +2758,11 @@ msgstr ""
2765
  msgid "General"
2766
  msgstr ""
2767
 
2768
- #: admin/views/settings.php:39
2769
  msgid "Save settings on this page"
2770
  msgstr ""
2771
 
2772
- #: admin/views/settings.php:46 modules/import-export/main.php:15
2773
  #: modules/import-export/main.php:15
2774
  msgid "Import &amp; Export"
2775
  msgstr ""
@@ -2810,13 +2803,21 @@ msgstr ""
2810
  msgid "search"
2811
  msgstr ""
2812
 
2813
- #: admin/views/support.php:20
2814
  #, php-format
2815
  msgid ""
2816
  "Take a look at more common issues or contact us directly through the <a "
2817
  "href=\"%s\" target=\"_blank\">support page</a>."
2818
  msgstr ""
2819
 
 
 
 
 
 
 
 
 
2820
  #: modules/gadsense/main.php:19
2821
  msgid " at "
2822
  msgstr ""
@@ -2835,44 +2836,73 @@ msgid ""
2835
  "ad setup."
2836
  msgstr ""
2837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2838
  #: modules/ad-blocker/admin/admin.php:96
2839
  msgid "Ad blocker fix"
2840
  msgstr ""
2841
 
2842
- #: modules/ad-blocker/admin/admin.php:162
2843
  msgid "The asset folder was rebuilt successfully"
2844
  msgstr ""
2845
 
2846
- #: modules/ad-blocker/admin/admin.php:223
2847
  msgid "There is no writable upload folder"
2848
  msgstr ""
2849
 
2850
- #: modules/ad-blocker/admin/admin.php:252
2851
  #, php-format
2852
  msgid "Unable to rename \"%s\" directory"
2853
  msgstr ""
2854
 
2855
- #: modules/ad-blocker/admin/admin.php:268
2856
- #: modules/ad-blocker/admin/admin.php:281
2857
- #: modules/ad-blocker/admin/admin.php:298
2858
  #, php-format
2859
  msgid "Unable to copy assets to the \"%s\" directory"
2860
  msgstr ""
2861
 
2862
- #: modules/ad-blocker/admin/admin.php:331
2863
- #: modules/ad-blocker/admin/admin.php:351
2864
  #, php-format
2865
  msgid "We do not have direct write access to the \"%s\" directory"
2866
  msgstr ""
2867
 
2868
- #: modules/ad-blocker/admin/admin.php:417
2869
- #, php-format
2870
- msgid ""
2871
- "Unable to create \"%s\" directory. Is its parent directory writable by the "
2872
- "server?"
2873
- msgstr ""
2874
-
2875
- #: modules/ad-blocker/admin/admin.php:428
2876
  #, php-format
2877
  msgid "Unable to copy files to %s"
2878
  msgstr ""
@@ -2885,105 +2915,85 @@ msgstr ""
2885
  msgid "Ad blocker counter"
2886
  msgstr ""
2887
 
2888
- #: modules/gadsense/admin/admin.php:27
2889
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:59
2890
- msgid "Responsive"
2891
- msgstr ""
2892
-
2893
- #: modules/gadsense/admin/admin.php:46
2894
  msgid "The ad details couldn't be retrieved from the ad code"
2895
  msgstr ""
2896
 
2897
- #: modules/gadsense/admin/admin.php:47
2898
  msgid ""
2899
  "Warning : The AdSense account from this code does not match the one set with "
2900
  "the Advanced Ads Plugin. This ad might cause troubles when used in the front "
2901
  "end."
2902
  msgstr ""
2903
 
2904
- #: modules/gadsense/admin/admin.php:51
2905
  msgid ""
2906
  "This type of ad code is set up in the AdSense settings. Click on the "
2907
  "following button to enable it now."
2908
  msgstr ""
2909
 
2910
- #: modules/gadsense/admin/admin.php:52
2911
  msgid "Activate"
2912
  msgstr ""
2913
 
2914
- #: modules/gadsense/admin/admin.php:138
2915
- msgid "AdSense ID"
2916
  msgstr ""
2917
 
2918
- #: modules/gadsense/admin/admin.php:147
2919
- msgid "Limit to 3 ads"
2920
  msgstr ""
2921
 
2922
- #: modules/gadsense/admin/admin.php:156
2923
- msgid "Activate Page-Level ads"
2924
  msgstr ""
2925
 
2926
- #: modules/gadsense/admin/admin.php:165
2927
  msgid "Disable violation warnings"
2928
  msgstr ""
2929
 
2930
- #: modules/gadsense/admin/admin.php:173
2931
  msgid "Transparent background"
2932
  msgstr ""
2933
 
2934
- #: modules/gadsense/admin/admin.php:193
2935
- #, php-format
2936
- msgid ""
2937
- "Please enter your Publisher ID in order to use AdSense on your page. See the "
2938
- "<a href=\"%s\" target=\"_blank\">manual</a> for more information."
2939
- msgstr ""
2940
-
2941
- #: modules/gadsense/admin/admin.php:207
2942
- msgid "Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>"
2943
- msgstr ""
2944
-
2945
- #: modules/gadsense/admin/admin.php:219
2946
  #, php-format
2947
  msgid "Limit to %d AdSense ads"
2948
  msgstr ""
2949
 
2950
- #: modules/gadsense/admin/admin.php:223
2951
  msgid ""
2952
  "There is no explicit limit for AdSense ads anymore, but you can still use "
2953
  "this setting to prevent too many AdSense ads to show accidentally on your "
2954
  "site."
2955
  msgstr ""
2956
 
2957
- #: modules/gadsense/admin/admin.php:227
2958
  msgid ""
2959
  "Due to technical restrictions, the limit does not work on placements with "
2960
  "cache-busting enabled."
2961
  msgstr ""
2962
 
2963
- #: modules/gadsense/admin/admin.php:241
2964
- msgid "Insert Page-Level ads code on all pages."
2965
- msgstr ""
2966
-
2967
- #: modules/gadsense/admin/admin.php:242
2968
  msgid ""
2969
- "You still need to enable Page-Level ads in your AdSense account. See <a "
2970
- "href=\"https://support.google.com/adsense/answer/6245304\" target=\"_blank\">"
2971
- "AdSense Help</a> (requires AdSense-login) for more information."
2972
  msgstr ""
2973
 
2974
- #: modules/gadsense/admin/admin.php:243
2975
  #, php-format
2976
  msgid ""
2977
- "Please notice that this code might also activate QuickStart ads. Please read "
2978
- "<a href=\"%s\" target=\"_blank\">this article</a> if <strong>ads appear in "
2979
- "random places</strong>."
2980
  msgstr ""
2981
 
2982
- #: modules/gadsense/admin/admin.php:256
2983
  msgid "Disable warnings about potential violations of the AdSense terms."
2984
  msgstr ""
2985
 
2986
- #: modules/gadsense/admin/admin.php:257
2987
  #, php-format
2988
  msgid ""
2989
  "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if "
@@ -2991,22 +3001,22 @@ msgid ""
2991
  "managed with Advanced Ads. Enable this option to remove these checks"
2992
  msgstr ""
2993
 
2994
- #: modules/gadsense/admin/admin.php:268
2995
  msgid ""
2996
  "Enable this option in case your theme adds an unfortunate background color "
2997
  "to AdSense ads."
2998
  msgstr ""
2999
 
3000
- #: modules/gadsense/admin/admin.php:286
3001
  #: modules/gadsense/includes/class-ad-type-adsense.php:73
3002
  msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
3003
  msgstr ""
3004
 
3005
- #: modules/gadsense/admin/admin.php:308
3006
  msgid "AdSense"
3007
  msgstr ""
3008
 
3009
- #: modules/gadsense/admin/admin.php:360
3010
  #, php-format
3011
  msgid ""
3012
  "Responsive AdSense ads don’t work reliably with <em>Position</em> set to "
@@ -3015,14 +3025,14 @@ msgid ""
3015
  "wrapped in text."
3016
  msgstr ""
3017
 
3018
- #: modules/gadsense/admin/admin.php:366
3019
  #, php-format
3020
  msgid ""
3021
  "<a href=\"%s\" target=\"_blank\">Install the free AdSense In-feed add-on</a> "
3022
  "in order to place ads between posts."
3023
  msgstr ""
3024
 
3025
- #: modules/gadsense/admin/admin.php:373
3026
  #, php-format
3027
  msgid ""
3028
  "Use the <a href=\"%s\" target=\"_blank\">Responsive add-on</a> in order to "
@@ -3046,12 +3056,27 @@ msgstr ""
3046
  msgid "Auto"
3047
  msgstr ""
3048
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3049
  #: modules/import-export/classes/import.php:66
3050
  msgid "Please enter XML content"
3051
  msgstr ""
3052
 
3053
  #: modules/import-export/classes/import.php:147
3054
- #: modules/import-export/classes/import.php:563
3055
  #, php-format
3056
  msgid "New attachment created <em>%s</em> %s"
3057
  msgstr ""
@@ -3086,62 +3111,62 @@ msgstr ""
3086
  msgid "Placement <em>%s</em> created"
3087
  msgstr ""
3088
 
3089
- #: modules/import-export/classes/import.php:474
3090
  #, php-format
3091
  msgid "Option was updated: <em>%s</em>"
3092
  msgstr ""
3093
 
3094
- #: modules/import-export/classes/import.php:477
3095
  #, php-format
3096
  msgid "Option already exists: <em>%s</em>"
3097
  msgstr ""
3098
 
3099
- #: modules/import-export/classes/import.php:499
3100
  #, php-format
3101
  msgid "Failed to create import directory <em>%s</em>"
3102
  msgstr ""
3103
 
3104
- #: modules/import-export/classes/import.php:504
3105
  #, php-format
3106
  msgid "Import directory is not writable: <em>%s</em>"
3107
  msgstr ""
3108
 
3109
- #: modules/import-export/classes/import.php:512
3110
  msgid ""
3111
  "File is empty, uploads are disabled or post_max_size is smaller than "
3112
  "upload_max_filesize in php.ini"
3113
  msgstr ""
3114
 
3115
- #: modules/import-export/classes/import.php:522
3116
  #, php-format
3117
  msgid "Failed to upload file, error: <em>%s</em>"
3118
  msgstr ""
3119
 
3120
- #: modules/import-export/classes/import.php:527
3121
  msgid "File is empty."
3122
  msgstr ""
3123
 
3124
- #: modules/import-export/classes/import.php:532
3125
  #, php-format
3126
  msgid ""
3127
  "The file could not be created: <em>%s</em>. This is probably a permissions "
3128
  "problem"
3129
  msgstr ""
3130
 
3131
- #: modules/import-export/classes/import.php:605
3132
  #, php-format
3133
  msgid "Invalid filetype <em>%s</em>"
3134
  msgstr ""
3135
 
3136
- #: modules/import-export/classes/import.php:610
3137
- #: modules/import-export/classes/import.php:617
3138
- #: modules/import-export/classes/import.php:625
3139
- #: modules/import-export/classes/import.php:640
3140
  #, php-format
3141
  msgid "Error getting remote image <em>%s</em>"
3142
  msgstr ""
3143
 
3144
- #: modules/import-export/classes/import.php:634
3145
  #, php-format
3146
  msgid "Zero size file downloaded <em>%s</em>"
3147
  msgstr ""
@@ -3215,6 +3240,26 @@ msgstr ""
3215
  msgid "Start import"
3216
  msgstr ""
3217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3218
  #: modules/ad-blocker/admin/views/rebuild_form.php:1
3219
  msgid "Ad blocker file folder"
3220
  msgstr ""
@@ -3275,72 +3320,205 @@ msgid ""
3275
  "Google Analytics property ID above to count them."
3276
  msgstr ""
3277
 
3278
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3279
  msgid ""
3280
  "Copy the ad code from your AdSense account, paste it into the area below and "
3281
  "click on <em>Get details</em>."
3282
  msgstr ""
3283
 
3284
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:26
3285
  msgid "Get details"
3286
  msgstr ""
3287
 
3288
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:30
 
 
 
 
3289
  msgid "Insert new AdSense code"
3290
  msgstr ""
3291
 
3292
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:35
 
 
 
 
3293
  msgid "Ad Slot ID"
3294
  msgstr ""
3295
 
3296
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:40
3297
  #, php-format
3298
  msgid "Publisher ID: %s"
3299
  msgstr ""
3300
 
3301
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:52
 
 
 
 
 
 
3302
  #, php-format
3303
  msgid "Please <a href=\"%s\" target=\"_blank\">change it here</a>."
3304
  msgstr ""
3305
 
3306
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:58
3307
  msgid "Normal"
3308
  msgstr ""
3309
 
3310
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:60
3311
  msgid "Responsive (Matched Content)"
3312
  msgstr ""
3313
 
3314
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:61
3315
  msgid "Link ads"
3316
  msgstr ""
3317
 
3318
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:62
3319
  msgid "Link ads (Responsive)"
3320
  msgstr ""
3321
 
3322
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:63
3323
  msgid "InArticle"
3324
  msgstr ""
3325
 
3326
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:64
3327
  msgid "InFeed"
3328
  msgstr ""
3329
 
3330
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:69
3331
  msgid "Resizing"
3332
  msgstr ""
3333
 
3334
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:77
3335
  msgid "Layout"
3336
  msgstr ""
3337
 
3338
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:81
3339
  msgid "Layout-Key"
3340
  msgstr ""
3341
 
3342
- #. Name of the plugin
3343
- msgid "Advanced Ads"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3344
  msgstr ""
3345
 
3346
  #. Description of the plugin
3
  msgstr ""
4
  "Project-Id-Version: Advanved Ads\n"
5
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
6
+ "POT-Creation-Date: 2018-08-20 12:08+0000\n"
7
  "POT-Revision-Date: Wed Jul 13 2016 13:23:05 GMT+0200 (CEST)\n"
8
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
9
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
10
  "Language-Team: webgilde <thomas.maier@webgilde.com>\n"
11
  "Language: \n"
12
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
13
  "MIME-Version: 1.0\n"
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Generator: Loco https://localise.biz/\n"
18
  "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
19
  "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
20
  "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
23
  "X-Poedit-Basepath: ../\n"
24
  "X-Poedit-SearchPath-0: ."
25
 
26
+ #: admin/class-advanced-ads-admin.php:222 classes/display-conditions.php:211
27
+ #: classes/visitor-conditions.php:241 admin/views/ad-display-metabox.php:134
28
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:68
29
  msgid "or"
30
  msgstr ""
31
 
32
+ #: admin/class-advanced-ads-admin.php:223 classes/display-conditions.php:211
33
+ #: classes/visitor-conditions.php:241 admin/views/ad-visitor-metabox.php:120
34
  msgid "and"
35
  msgstr ""
36
 
37
+ #: admin/class-advanced-ads-admin.php:224
38
  msgid "After which paragraph?"
39
  msgstr ""
40
 
41
+ #: admin/class-advanced-ads-admin.php:334
42
  #, php-format
43
  msgid "time of %s"
44
  msgstr ""
45
 
46
+ #: admin/class-advanced-ads-admin.php:375 admin/includes/class-menu.php:107
47
+ #: admin/includes/class-menu.php:110 admin/views/settings.php:26
48
  msgid "Support"
49
  msgstr ""
50
 
51
+ #: admin/class-advanced-ads-admin.php:379
52
  #: admin/includes/class-overview-widgets.php:33
53
  msgid "Add-Ons"
54
  msgstr ""
55
 
56
+ #: admin/class-advanced-ads-admin.php:633
57
+ #: admin/includes/class-overview-widgets.php:132
58
+ #, php-format
59
+ msgid ""
60
+ "Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a "
61
+ "href=\"%s\" target=\"_blank\">wordpress.org</a>"
62
+ msgstr ""
63
+
64
  #: classes/ad-debug.php:32
65
  msgid "The ad is displayed on the page"
66
  msgstr ""
94
  msgstr ""
95
 
96
  #: classes/ad-debug.php:118 classes/ad-debug.php:167 classes/ad-debug.php:169
97
+ #: public/class-advanced-ads.php:692 admin/views/ad-group-list-ads.php:2
98
  msgid "Ad"
99
  msgstr ""
100
 
101
+ #: classes/ad-debug.php:121 public/class-advanced-ads.php:655
102
  msgctxt "ad group singular name"
103
  msgid "Ad Group"
104
  msgstr ""
182
  "widget."
183
  msgstr ""
184
 
185
+ #: classes/ad_placements.php:237
186
  #, php-format
187
  msgid "paragraph (%s)"
188
  msgstr ""
189
 
190
+ #: classes/ad_placements.php:238
191
  #, php-format
192
  msgid "paragraph without image (%s)"
193
  msgstr ""
194
 
195
+ #: classes/ad_placements.php:239
196
  #, php-format
197
  msgid "headline 2 (%s)"
198
  msgstr ""
199
 
200
+ #: classes/ad_placements.php:240
201
  #, php-format
202
  msgid "headline 3 (%s)"
203
  msgstr ""
204
 
205
+ #: classes/ad_placements.php:241
206
  #, php-format
207
  msgid "headline 4 (%s)"
208
  msgstr ""
209
 
210
+ #: classes/ad_placements.php:589
211
  #, php-format
212
  msgid "Set <em>%s</em> to show more ads"
213
  msgstr ""
214
 
215
+ #: classes/ad_placements.php:590 admin/includes/class-settings.php:141
216
  msgid "Disable level limitation"
217
  msgstr ""
218
 
248
  "display and visitor conditions to all ads in that group."
249
  msgstr ""
250
 
251
+ #: classes/ad_type_group.php:85
 
 
 
 
252
  msgid "ad group"
253
  msgstr ""
254
 
360
  msgid "Display ads based on the taxonomy of an archive page."
361
  msgstr ""
362
 
363
+ #: classes/display-conditions.php:143
364
  #, php-format
365
  msgid "archive: %s"
366
  msgstr ""
367
 
368
+ #: classes/display-conditions.php:246 classes/display-conditions.php:299
369
+ #: classes/display-conditions.php:354 classes/display-conditions.php:471
370
  #: classes/visitor-conditions.php:136
371
  msgid "is"
372
  msgstr ""
373
 
374
+ #: classes/display-conditions.php:247 classes/display-conditions.php:300
375
+ #: classes/display-conditions.php:355 classes/display-conditions.php:472
376
  #: classes/visitor-conditions.php:137
377
  msgid "is not"
378
  msgstr ""
379
 
380
+ #: classes/display-conditions.php:270 classes/display-conditions.php:315
381
+ #: classes/display-conditions.php:402 classes/display-conditions.php:446
382
  msgctxt "Error message shown when no display condition term is selected"
383
  msgid "Please select some items."
384
  msgstr ""
385
 
386
+ #: classes/display-conditions.php:316
387
  #, php-format
388
  msgid ""
389
  "Only %d elements are displayed above. Use the <code>advanced-ads-admin-max-"
391
  "target=\"_blank\">this page</a>."
392
  msgstr ""
393
 
394
+ #: classes/display-conditions.php:437
395
  msgctxt "display the terms search field on ad edit page"
396
  msgid "add more terms"
397
  msgstr ""
398
 
399
+ #: classes/display-conditions.php:439
400
  msgid "term name or id"
401
  msgstr ""
402
 
403
+ #: classes/display-conditions.php:500
404
  msgid "title or id"
405
  msgstr ""
406
 
407
+ #: classes/display-conditions.php:545 includes/array_ad_conditions.php:63
408
  msgid "Home Page"
409
  msgstr ""
410
 
411
+ #: classes/display-conditions.php:546 includes/array_ad_conditions.php:64
412
  msgid "show on Home page"
413
  msgstr ""
414
 
415
+ #: classes/display-conditions.php:550 includes/array_ad_conditions.php:68
416
  msgid "Singular Pages"
417
  msgstr ""
418
 
419
+ #: classes/display-conditions.php:551 includes/array_ad_conditions.php:69
420
  msgid "show on singular pages/posts"
421
  msgstr ""
422
 
423
+ #: classes/display-conditions.php:555 includes/array_ad_conditions.php:73
424
  msgid "Archive Pages"
425
  msgstr ""
426
 
427
+ #: classes/display-conditions.php:556 includes/array_ad_conditions.php:74
428
  msgid "show on any type of archive page (category, tag, author and date)"
429
  msgstr ""
430
 
431
+ #: classes/display-conditions.php:560 includes/array_ad_conditions.php:78
432
  msgid "Search Results"
433
  msgstr ""
434
 
435
+ #: classes/display-conditions.php:561 includes/array_ad_conditions.php:79
436
  msgid "show on search result pages"
437
  msgstr ""
438
 
439
+ #: classes/display-conditions.php:565 includes/array_ad_conditions.php:83
440
  msgid "404 Page"
441
  msgstr ""
442
 
443
+ #: classes/display-conditions.php:566 includes/array_ad_conditions.php:84
444
  msgid "show on 404 error page"
445
  msgstr ""
446
 
447
+ #: classes/display-conditions.php:570 includes/array_ad_conditions.php:88
448
  msgid "Attachment Pages"
449
  msgstr ""
450
 
451
+ #: classes/display-conditions.php:571 includes/array_ad_conditions.php:89
452
  msgid "show on attachment pages"
453
  msgstr ""
454
 
455
+ #: classes/display-conditions.php:575 includes/array_ad_conditions.php:93
456
  msgid "Secondary Queries"
457
  msgstr ""
458
 
459
+ #: classes/display-conditions.php:576 includes/array_ad_conditions.php:94
460
  msgid "allow ads in secondary queries"
461
  msgstr ""
462
 
463
+ #: classes/display-conditions.php:580
464
  msgid "Feed"
465
  msgstr ""
466
 
467
+ #: classes/display-conditions.php:581
468
  msgid "allow ads in Feed"
469
  msgstr ""
470
 
506
  msgid "Random AdSense ads"
507
  msgstr ""
508
 
509
+ #: classes/frontend_checks.php:92 admin/includes/class-settings.php:448
510
  msgid "You look like a bot"
511
  msgstr ""
512
 
557
  msgid "Ad IDs: %s"
558
  msgstr ""
559
 
560
+ #: classes/frontend_checks.php:248
561
+ #, php-format
562
+ msgid "Visible ads should not use the Header placement: %s"
563
+ msgstr ""
564
+
565
+ #: classes/frontend_checks.php:262
566
  msgid "AdSense violation"
567
  msgstr ""
568
 
569
+ #: classes/frontend_checks.php:263
570
  msgid "Ad is hidden"
571
  msgstr ""
572
 
573
+ #: classes/frontend_checks.php:264
574
  #, php-format
575
  msgid "IDs: %s"
576
  msgstr ""
577
 
578
+ #: classes/frontend_checks.php:280
579
+ msgid "Consent not given"
580
+ msgstr ""
581
+
582
+ #: classes/frontend_checks.php:292
583
  msgid "debug DFP ads"
584
  msgstr ""
585
 
586
+ #: classes/frontend_checks.php:303
587
  msgid "highlight ads"
588
  msgstr ""
589
 
590
+ #: classes/frontend_checks.php:319
591
  msgid "Ad Health"
592
  msgstr ""
593
 
594
+ #: classes/frontend_checks.php:334
595
  msgid "Everything is fine"
596
  msgstr ""
597
 
598
+ #: classes/frontend_checks.php:380
599
  msgid ""
600
  "the following code is used for automatic error detection and only visible to "
601
  "admins"
602
  msgstr ""
603
 
604
+ #: classes/frontend_checks.php:507
605
  #, php-format
606
  msgid ""
607
  "This ad was automatically placed here by AdSense. <a href=\"%s\" "
656
  msgid "equal or lower"
657
  msgstr ""
658
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  #: classes/widget.php:22
660
  msgid "Display Ads and Ad Groups."
661
  msgstr ""
662
 
663
+ #: classes/widget.php:71
664
  msgid "Title:"
665
  msgstr ""
666
 
667
+ #: classes/widget.php:77 admin/includes/class-shortcode-creator.php:82
668
+ #: modules/gutenberg/includes/class-gutenberg.php:77
669
  msgid "--empty--"
670
  msgstr ""
671
 
672
+ #: classes/widget.php:79 admin/includes/class-menu.php:89
673
  #: admin/includes/class-shortcode-creator.php:98 admin/views/placements.php:18
674
+ #: modules/gutenberg/includes/class-gutenberg.php:81
675
  #: modules/import-export/views/page.php:25
676
  msgid "Placements"
677
  msgstr ""
678
 
679
+ #: classes/widget.php:86 admin/includes/class-shortcode-creator.php:91
680
+ #: admin/views/placements-item.php:4 admin/views/placements.php:193
681
+ #: modules/gutenberg/includes/class-gutenberg.php:80
682
  msgid "Ad Groups"
683
  msgstr ""
684
 
685
+ #: classes/widget.php:93 public/class-advanced-ads.php:691
686
  #: admin/includes/class-menu.php:62 admin/includes/class-menu.php:62
687
  #: admin/includes/class-shortcode-creator.php:84
688
  #: admin/views/ad-group-list-form-row.php:68
689
  #: admin/views/ad-group-list-header.php:5 admin/views/placements-item.php:11
690
+ #: admin/views/placements.php:200
691
+ #: modules/gutenberg/includes/class-gutenberg.php:79
692
+ #: modules/import-export/views/page.php:23
693
  msgid "Ads"
694
  msgstr ""
695
 
719
  msgid "Individual Posts, Pages and Public Post Types"
720
  msgstr ""
721
 
722
+ #: public/class-advanced-ads.php:347
723
  msgid "Advanced Ads Error following:"
724
  msgstr ""
725
 
726
+ #: public/class-advanced-ads.php:351
727
  #, php-format
728
  msgid "Advanced Ads Error: %s"
729
  msgstr ""
730
 
731
+ #: public/class-advanced-ads.php:654
732
  msgctxt "ad group general name"
733
  msgid "Ad Groups & Rotations"
734
  msgstr ""
735
 
736
+ #: public/class-advanced-ads.php:656
737
  msgid "Search Ad Groups"
738
  msgstr ""
739
 
740
+ #: public/class-advanced-ads.php:657
741
  msgid "All Ad Groups"
742
  msgstr ""
743
 
744
+ #: public/class-advanced-ads.php:658
745
  msgid "Parent Ad Groups"
746
  msgstr ""
747
 
748
+ #: public/class-advanced-ads.php:659
749
  msgid "Parent Ad Groups:"
750
  msgstr ""
751
 
752
+ #: public/class-advanced-ads.php:660
753
  msgid "Edit Ad Group"
754
  msgstr ""
755
 
756
+ #: public/class-advanced-ads.php:661
757
  msgid "Update Ad Group"
758
  msgstr ""
759
 
760
+ #: public/class-advanced-ads.php:662
761
  msgid "Add New Ad Group"
762
  msgstr ""
763
 
764
+ #: public/class-advanced-ads.php:663
765
  msgid "New Ad Groups Name"
766
  msgstr ""
767
 
768
+ #: public/class-advanced-ads.php:664 modules/import-export/views/page.php:24
769
  msgid "Groups"
770
  msgstr ""
771
 
772
+ #: public/class-advanced-ads.php:665
773
  msgid "No Ad Group found"
774
  msgstr ""
775
 
776
+ #: public/class-advanced-ads.php:693 public/class-advanced-ads.php:697
777
  #: admin/includes/class-menu.php:79 admin/views/ad-group-list-ads.php:17
778
  msgid "New Ad"
779
  msgstr ""
780
 
781
+ #: public/class-advanced-ads.php:694 admin/includes/class-menu.php:79
782
  msgid "Add New Ad"
783
  msgstr ""
784
 
785
+ #: public/class-advanced-ads.php:695
786
  #: admin/includes/class-ad-groups-list.php:313
787
  #: modules/import-export/classes/import.php:146
788
  #: modules/import-export/classes/import.php:186
789
+ #: modules/import-export/classes/import.php:564
790
  msgid "Edit"
791
  msgstr ""
792
 
793
+ #: public/class-advanced-ads.php:696
794
  msgid "Edit Ad"
795
  msgstr ""
796
 
797
+ #: public/class-advanced-ads.php:698
798
  msgid "View"
799
  msgstr ""
800
 
801
+ #: public/class-advanced-ads.php:699
802
  msgid "View the Ad"
803
  msgstr ""
804
 
805
+ #: public/class-advanced-ads.php:700
806
  msgid "Search Ads"
807
  msgstr ""
808
 
809
+ #: public/class-advanced-ads.php:701
810
  msgid "No Ads found"
811
  msgstr ""
812
 
813
+ #: public/class-advanced-ads.php:702
814
  msgid "No Ads found in Trash"
815
  msgstr ""
816
 
817
+ #: public/class-advanced-ads.php:703
818
  msgid "Parent Ad"
819
  msgstr ""
820
 
821
+ #: public/class-advanced-ads.php:827
822
  msgctxt "label above ads"
823
  msgid "Advertisements"
824
  msgstr ""
913
  msgid "Ad Planning"
914
  msgstr ""
915
 
916
+ #: admin/includes/class-ad-type.php:199
 
 
 
 
 
 
 
 
 
 
 
 
917
  #, php-format
918
  msgid "%s ad updated."
919
  msgid_plural "%s ads updated."
920
  msgstr[0] ""
921
  msgstr[1] ""
922
 
923
+ #: admin/includes/class-ad-type.php:200
924
  #, php-format
925
  msgid "%s ad not updated, somebody is editing it."
926
  msgid_plural "%s ads not updated, somebody is editing them."
927
  msgstr[0] ""
928
  msgstr[1] ""
929
 
930
+ #: admin/includes/class-ad-type.php:201
931
  #, php-format
932
  msgid "%s ad permanently deleted."
933
  msgid_plural "%s ads permanently deleted."
934
  msgstr[0] ""
935
  msgstr[1] ""
936
 
937
+ #: admin/includes/class-ad-type.php:202
938
  #, php-format
939
  msgid "%s ad moved to the Trash."
940
  msgid_plural "%s ads moved to the Trash."
941
  msgstr[0] ""
942
  msgstr[1] ""
943
 
944
+ #: admin/includes/class-ad-type.php:203
945
  #, php-format
946
  msgid "%s ad restored from the Trash."
947
  msgid_plural "%s ads restored from the Trash."
948
  msgstr[0] ""
949
  msgstr[1] ""
950
 
951
+ #: admin/includes/class-ad-type.php:532 admin/includes/class-ad-type.php:533
952
  msgid "Ad updated."
953
  msgstr ""
954
 
955
  #. translators: %s: date and time of the revision
956
+ #: admin/includes/class-ad-type.php:535
957
  #, php-format
958
  msgid "Ad restored to revision from %s"
959
  msgstr ""
960
 
961
+ #: admin/includes/class-ad-type.php:536 admin/includes/class-ad-type.php:537
962
  msgid "Ad saved."
963
  msgstr ""
964
 
965
+ #: admin/includes/class-ad-type.php:538
966
  msgid "Ad submitted."
967
  msgstr ""
968
 
969
+ #: admin/includes/class-ad-type.php:540
970
  #, php-format
971
  msgid "Ad scheduled for: <strong>%1$s</strong>."
972
  msgstr ""
973
 
974
  #. translators: Publish box date format, see http://php.net/date
975
+ #: admin/includes/class-ad-type.php:542
976
  msgid "M j, Y @ G:i"
977
  msgstr ""
978
 
979
+ #: admin/includes/class-ad-type.php:544
980
  msgid "Ad draft updated."
981
  msgstr ""
982
 
983
+ #: admin/includes/class-ad-type.php:631
984
  msgid ""
985
  "You don’t have access to ads. Please deactivate and re-enable Advanced Ads "
986
  "again to fix this."
1002
  msgid "Please enter a valid license key"
1003
  msgstr ""
1004
 
1005
+ #: admin/includes/class-licenses.php:149
1006
  msgid "License couldn’t be activated. Please try again later."
1007
  msgstr ""
1008
 
1009
+ #: admin/includes/class-licenses.php:166
1010
  msgid "This is the bundle license key."
1011
  msgstr ""
1012
 
1013
+ #: admin/includes/class-licenses.php:167
1014
  msgid "This is not the correct key for this add-on."
1015
  msgstr ""
1016
 
1017
+ #: admin/includes/class-licenses.php:168
1018
  msgid "There are no activations left."
1019
  msgstr ""
1020
 
1021
+ #: admin/includes/class-licenses.php:177
1022
  #, php-format
1023
  msgid "License is invalid. Reason: %s"
1024
  msgstr ""
1025
 
1026
+ #: admin/includes/class-licenses.php:237
1027
  msgid "Error while trying to disable the license. Please contact support."
1028
  msgstr ""
1029
 
1030
+ #: admin/includes/class-licenses.php:264 admin/includes/class-licenses.php:286
1031
  msgid "License couldn’t be deactivated. Please try again later."
1032
  msgstr ""
1033
 
1034
+ #: admin/includes/class-licenses.php:272
1035
+ #, php-format
1036
+ msgid ""
1037
+ "Your call was blocked by a Firewall. <a href=\"%s\" target=\"_blank\">Learn "
1038
+ "more</a>"
1039
+ msgstr ""
1040
+
1041
+ #: admin/includes/class-licenses.php:493
1042
  #, php-format
1043
  msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
1044
  msgstr ""
1045
 
1046
+ #: admin/includes/class-licenses.php:495
1047
  #, php-format
1048
  msgid ""
1049
  "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>"
1050
  "."
1051
  msgstr ""
1052
 
1053
+ #: admin/includes/class-list-filters.php:129
1054
+ #: modules/gadsense/admin/admin.php:29
1055
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:102
1056
+ msgid "Responsive"
1057
+ msgstr ""
1058
+
1059
+ #: admin/includes/class-list-filters.php:138
1060
+ msgid "expired"
1061
+ msgstr ""
1062
+
1063
+ #: admin/includes/class-list-filters.php:142
1064
+ msgid "any expiry date"
1065
+ msgstr ""
1066
+
1067
  #: admin/includes/class-menu.php:55 admin/includes/class-menu.php:68
1068
  #: admin/includes/class-menu.php:72 admin/includes/class-menu.php:72
1069
  msgid "Overview"
1089
  msgid "Settings"
1090
  msgstr ""
1091
 
1092
+ #: admin/includes/class-menu.php:193 admin/includes/class-menu.php:220
1093
  msgid "Sorry, you are not allowed to access this feature."
1094
  msgstr ""
1095
 
1096
+ #: admin/includes/class-menu.php:206
1097
  msgid ""
1098
  "You attempted to edit an ad group that doesn&#8217;t exist. Perhaps it was "
1099
  "deleted?"
1120
  msgstr ""
1121
 
1122
  #: admin/includes/class-meta-box.php:140 admin/includes/class-meta-box.php:151
1123
+ #: admin/includes/class-meta-box.php:156 admin/includes/class-settings.php:519
1124
  #: admin/views/ad-output-metabox.php:51
1125
+ #: modules/privacy/admin/views/setting-enable.php:2
1126
  msgid "Manual"
1127
  msgstr ""
1128
 
1163
  msgid "Advanced Ads Tutorials"
1164
  msgstr ""
1165
 
1166
+ #: admin/includes/class-notices.php:464
1167
  #, php-format
1168
  msgid ""
1169
  "You don’t seem to have an email address. Please use <a href=\"%s\" "
1170
  "target=\"_blank\">this form</a> to sign up."
1171
  msgstr ""
1172
 
1173
+ #: admin/includes/class-notices.php:482
1174
  msgid ""
1175
  "How embarrassing. The email server seems to be down. Please try again later."
1176
  msgstr ""
1177
 
1178
+ #: admin/includes/class-notices.php:487
1179
  #, php-format
1180
  msgid ""
1181
  "Please check your email (%s) for the confirmation message. If you didn’t "
1192
  msgstr ""
1193
 
1194
  #: admin/includes/class-overview-widgets.php:65
1195
+ #: admin/views/notices/welcome-panel.php:6
1196
  msgid "Create your first ad"
1197
  msgstr ""
1198
 
1216
  msgid "Join now"
1217
  msgstr ""
1218
 
1219
+ #: admin/includes/class-overview-widgets.php:90 admin/includes/notices.php:49
1220
  msgid ""
1221
  "Do you find Advanced Ads useful and would like to keep us motivated? Please "
1222
  "help us with a review."
1223
  msgstr ""
1224
 
1225
+ #: admin/includes/class-overview-widgets.php:92 admin/includes/notices.php:52
1226
  msgid "Sure, I’ll rate the plugin"
1227
  msgstr ""
1228
 
1229
+ #: admin/includes/class-overview-widgets.php:94 admin/includes/notices.php:53
1230
  msgid "I already did"
1231
  msgstr ""
1232
 
1239
  msgstr ""
1240
 
1241
  #: admin/includes/class-overview-widgets.php:130
1242
+ #: admin/views/notices/welcome-panel.php:22
1243
  #, php-format
1244
  msgid "<a href=\"%s\" target=\"_blank\">Manual</a>"
1245
  msgstr ""
1249
  msgid "<a href=\"%s\" target=\"_blank\">FAQ and Support</a>"
1250
  msgstr ""
1251
 
 
 
 
 
 
 
 
1252
  #: admin/includes/class-overview-widgets.php:149
1253
  msgid "The solution for professional websites."
1254
  msgstr ""
1364
  msgstr ""
1365
 
1366
  #: admin/includes/class-overview-widgets.php:409
1367
+ msgid ""
1368
+ "Manage ad positions with WPBakery Page Builder (formerly Visual Composer)."
1369
  msgstr ""
1370
 
1371
  #: admin/includes/class-overview-widgets.php:425
1418
  msgstr ""
1419
 
1420
  #: admin/includes/class-settings.php:173
 
 
 
 
1421
  msgid "Allow editors to manage ads"
1422
  msgstr ""
1423
 
1424
+ #: admin/includes/class-settings.php:181
1425
  msgid "Ad label"
1426
  msgstr ""
1427
 
1428
+ #: admin/includes/class-settings.php:190
1429
  msgid "Open links in a new window"
1430
  msgstr ""
1431
 
1432
+ #: admin/includes/class-settings.php:200
1433
  msgid "Delete data on uninstall"
1434
  msgstr ""
1435
 
1436
+ #: admin/includes/class-settings.php:210
1437
  msgid "Disable shortcode button"
1438
  msgstr ""
1439
 
1440
+ #: admin/includes/class-settings.php:231
1441
  msgid "Licenses"
1442
  msgstr ""
1443
 
1444
+ #: admin/includes/class-settings.php:248
1445
  msgid "Pro"
1446
  msgstr ""
1447
 
1448
+ #: admin/includes/class-settings.php:264 admin/views/pitch-tracking.php:2
1449
  msgid "Tracking"
1450
  msgstr ""
1451
 
1452
+ #: admin/includes/class-settings.php:285
1453
  #, php-format
1454
  msgid ""
1455
  "Enter license keys for our powerful <a href=\"%s\" target=\"_blank\">add-"
1456
  "ons</a>."
1457
  msgstr ""
1458
 
1459
+ #: admin/includes/class-settings.php:286
1460
  #, php-format
1461
  msgid ""
1462
  "See also <a href=\"%s\" target=\"_blank\">Issues and questions about "
1463
  "licenses</a>."
1464
  msgstr ""
1465
 
1466
+ #: admin/includes/class-settings.php:298
1467
  msgid "Are you missing something?"
1468
  msgstr ""
1469
 
1470
+ #: admin/includes/class-settings.php:352
1471
  msgid "(display to all)"
1472
  msgstr ""
1473
 
1474
+ #: admin/includes/class-settings.php:353
1475
  msgid "Subscriber"
1476
  msgstr ""
1477
 
1478
+ #: admin/includes/class-settings.php:354
1479
  msgid "Contributor"
1480
  msgstr ""
1481
 
1482
+ #: admin/includes/class-settings.php:355
1483
  msgid "Author"
1484
  msgstr ""
1485
 
1486
+ #: admin/includes/class-settings.php:356
1487
  msgid "Editor"
1488
  msgstr ""
1489
 
1490
+ #: admin/includes/class-settings.php:357
1491
  msgid "Admin"
1492
  msgstr ""
1493
 
1494
+ #: admin/includes/class-settings.php:365
1495
  msgid "Choose the lowest role a user must have in order to not see any ads."
1496
  msgstr ""
1497
 
1498
+ #: admin/includes/class-settings.php:379
1499
  msgid ""
1500
  "<strong>notice: </strong>the file is currently enabled by an add-on that "
1501
  "needs it."
1502
  msgstr ""
1503
 
1504
+ #: admin/includes/class-settings.php:382
1505
  #, php-format
1506
  msgid ""
1507
  "Enable advanced JavaScript functions (<a href=\"%s\" target=\"_blank\">"
1509
  "need features from this file."
1510
  msgstr ""
1511
 
1512
+ #: admin/includes/class-settings.php:402
1513
  msgid ""
1514
  "Some plugins and themes trigger ad injections where it shouldn’t happen. "
1515
  "Therefore, Advanced Ads ignores injected placements on non-singular pages "
1519
  "injection only in the first x posts on your archive pages."
1520
  msgstr ""
1521
 
1522
+ #: admin/includes/class-settings.php:418
1523
  msgid ""
1524
  "Please check your post content. A priority of 10 and below might cause "
1525
  "issues (wpautop function might run twice)."
1526
  msgstr ""
1527
 
1528
+ #: admin/includes/class-settings.php:420
1529
  msgid ""
1530
  "Play with this value in order to change the priority of the injected ads "
1531
  "compared to other auto injected elements in the post content."
1532
  msgstr ""
1533
 
1534
+ #: admin/includes/class-settings.php:434
1535
  msgid ""
1536
  "Advanced Ads ignores paragraphs and other elements in containers when "
1537
  "injecting ads into the post content. Check this option to ignore this "
1538
  "limitation and ads might show up again."
1539
  msgstr ""
1540
 
1541
+ #: admin/includes/class-settings.php:450
1542
  msgid "Read this first"
1543
  msgstr ""
1544
 
1545
+ #: admin/includes/class-settings.php:451
1546
  msgid "Hide ads from crawlers, bots and empty user agents."
1547
  msgstr ""
1548
 
1549
+ #: admin/includes/class-settings.php:464
1550
  msgid ""
1551
  "Disable internal notices like tips, tutorials, email newsletters and update "
1552
  "notices. Disabling notices is recommended if you run multiple blogs with "
1553
  "Advanced Ads already."
1554
  msgstr ""
1555
 
1556
+ #: admin/includes/class-settings.php:481
1557
  msgid ""
1558
  "Prefix of class or id attributes in the frontend. Change it if you don’t "
1559
  "want <strong>ad blockers</strong> to mark these blocks as ads.<br/>You might "
1560
  "need to <strong>rewrite css rules afterwards</strong>."
1561
  msgstr ""
1562
 
1563
+ #: admin/includes/class-settings.php:500
 
 
 
 
 
 
 
 
 
 
 
 
1564
  msgid "Allow editors to also manage and publish ads."
1565
  msgstr ""
1566
 
1567
+ #: admin/includes/class-settings.php:501
1568
  #, php-format
1569
  msgid ""
1570
  "You can assign different ad-related roles on a user basis with <a "
1571
  "href=\"%s\" target=\"_blank\">Advanced Ads Pro</a>."
1572
  msgstr ""
1573
 
1574
+ #: admin/includes/class-settings.php:512
1575
  msgctxt "label before ads"
1576
  msgid "Advertisements"
1577
  msgstr ""
1578
 
1579
+ #: admin/includes/class-settings.php:519
1580
  msgid "Displayed above ads."
1581
  msgstr ""
1582
 
1583
+ #: admin/includes/class-settings.php:553
1584
  msgid "Clean up all data related to Advanced Ads when removing the plugin."
1585
  msgstr ""
1586
 
1587
+ #: admin/includes/class-settings.php:566
1588
  msgid "Disable shortcode button in visual editor."
1589
  msgstr ""
1590
 
1595
  "the <a href=\"%s\" target=\"_blank\">settings</a>."
1596
  msgstr ""
1597
 
1598
+ #: admin/includes/notices.php:16
 
 
 
 
 
 
 
1599
  msgid ""
1600
  "Thank you for activating <strong>Advanced Ads</strong>. Would you like to "
1601
  "receive the first steps via email?"
1602
  msgstr ""
1603
 
1604
+ #: admin/includes/notices.php:17
1605
  msgid "Yes, send it"
1606
  msgstr ""
1607
 
1608
+ #: admin/includes/notices.php:23
1609
  msgid ""
1610
  "Thank you for using <strong>Advanced Ads</strong>. Stay informed and receive "
1611
  "<strong>2 free add-ons</strong> for joining the newsletter."
1612
  msgstr ""
1613
 
1614
+ #: admin/includes/notices.php:24
1615
  msgid "Add me now"
1616
  msgstr ""
1617
 
1618
+ #: admin/includes/notices.php:30
1619
  msgid ""
1620
  "Learn more about how and <strong>how much you can earn with AdSense</strong> "
1621
  "and Advanced Ads from my dedicated newsletter."
1622
  msgstr ""
1623
 
1624
+ #: admin/includes/notices.php:31 admin/views/notices/inline.php:3
1625
  #: admin/views/notices/subscribe.php:3
1626
  msgid "Subscribe me now"
1627
  msgstr ""
1628
 
1629
+ #: admin/includes/notices.php:42
1630
  msgid ""
1631
  "One or more license keys for <strong>Advanced Ads add-ons are invalid or "
1632
  "missing</strong>."
1633
  msgstr ""
1634
 
1635
+ #: admin/includes/notices.php:42
1636
  #, php-format
1637
  msgid "Please add valid license keys <a href=\"%s\">here</a>."
1638
  msgstr ""
1639
 
1640
+ #: admin/includes/notices.php:48
1641
  #, php-format
1642
  msgid "You’ve successfully <strong>created %s ads using Advanced Ads</strong>."
1643
  msgstr ""
1644
 
1645
+ #: admin/includes/notices.php:54
1646
  msgid "I am not happy, please help"
1647
  msgstr ""
1648
 
1649
+ #: admin/includes/notices.php:55
1650
  msgid "Ask me later"
1651
  msgstr ""
1652
 
1653
+ #: admin/includes/notices.php:62
1654
  #, php-format
1655
  msgid ""
1656
  "Some assets were changed. Please <strong>rebuild the asset folder</strong> "
1673
  msgid "Cancel"
1674
  msgstr ""
1675
 
1676
+ #: admin/views/ad-conditions-string-operators.php:2
1677
+ #: modules/privacy/admin/views/setting-consent-method.php:10
1678
+ msgid "contains"
1679
+ msgstr ""
1680
+
1681
+ #: admin/views/ad-conditions-string-operators.php:3
1682
+ msgid "starts with"
1683
+ msgstr ""
1684
+
1685
+ #: admin/views/ad-conditions-string-operators.php:4
1686
+ msgid "ends with"
1687
+ msgstr ""
1688
+
1689
+ #: admin/views/ad-conditions-string-operators.php:5
1690
+ msgid "matches"
1691
+ msgstr ""
1692
+
1693
+ #: admin/views/ad-conditions-string-operators.php:6
1694
+ msgid "matches regex"
1695
+ msgstr ""
1696
+
1697
+ #: admin/views/ad-conditions-string-operators.php:7
1698
+ msgid "does not contain"
1699
+ msgstr ""
1700
+
1701
+ #: admin/views/ad-conditions-string-operators.php:8
1702
+ msgid "does not start with"
1703
+ msgstr ""
1704
+
1705
+ #: admin/views/ad-conditions-string-operators.php:9
1706
+ msgid "does not end with"
1707
+ msgstr ""
1708
+
1709
+ #: admin/views/ad-conditions-string-operators.php:10
1710
+ msgid "does not match"
1711
+ msgstr ""
1712
+
1713
+ #: admin/views/ad-conditions-string-operators.php:11
1714
+ msgid "does not match regex"
1715
+ msgstr ""
1716
+
1717
  #: admin/views/ad-display-metabox.php:7
1718
  msgid "parent page"
1719
  msgstr ""
1765
  msgstr ""
1766
 
1767
  #: admin/views/ad-display-metabox.php:72
1768
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:109
1769
  msgid "manual"
1770
  msgstr ""
1771
 
1827
  msgstr ""
1828
 
1829
  #: admin/views/ad-group-list-form-row.php:12 admin/views/placements.php:24
1830
+ #: modules/privacy/admin/views/setting-consent-method.php:9
1831
  msgid "Name"
1832
  msgstr ""
1833
 
1834
  #: admin/views/ad-group-list-form-row.php:41 admin/views/placements.php:23
1835
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:98
1836
  msgid "Type"
1837
  msgstr ""
1838
 
1984
  msgid "Internal description or your own notes about this ad."
1985
  msgstr ""
1986
 
1987
+ #: admin/views/ad-list-filters.php:18
1988
  msgid "all ad types"
1989
  msgstr ""
1990
 
1991
+ #: admin/views/ad-list-filters.php:26
1992
  msgid "all ad sizes"
1993
  msgstr ""
1994
 
1995
+ #: admin/views/ad-list-filters.php:34
1996
  msgid "all ad dates"
1997
  msgstr ""
1998
 
1999
+ #: admin/views/ad-list-filters.php:42
2000
  msgid "all ad groups"
2001
  msgstr ""
2002
 
2218
  msgstr ""
2219
 
2220
  #: admin/views/ad-visitor-metabox.php:71
2221
+ #: modules/privacy/admin/views/setting-enable.php:4
2222
  msgid "It seems that a caching plugin is activated."
2223
  msgstr ""
2224
 
2319
  msgstr ""
2320
 
2321
  #: admin/views/feedback-disable.php:6
2322
+ msgid "I have a problem, a question or need help."
2323
  msgstr ""
2324
 
2325
  #: admin/views/feedback-disable.php:7
 
 
 
 
 
 
 
 
2326
  msgid "Please let us know how we can help"
2327
  msgstr ""
2328
 
2329
+ #: admin/views/feedback-disable.php:12
2330
  #, php-format
2331
  msgid "Send me free help to %s"
2332
  msgstr ""
2333
 
2334
+ #: admin/views/feedback-disable.php:14
2335
+ msgid "It is only temporary"
2336
+ msgstr ""
2337
+
2338
+ #: admin/views/feedback-disable.php:15
2339
  msgid "I miss a feature"
2340
  msgstr ""
2341
 
2342
+ #: admin/views/feedback-disable.php:16
2343
  msgid "Which one?"
2344
  msgstr ""
2345
 
2346
+ #: admin/views/feedback-disable.php:17
2347
+ msgid "I stopped using ads on my site."
2348
  msgstr ""
2349
 
2350
+ #: admin/views/feedback-disable.php:18
2351
  msgid "I switched to another plugin"
2352
  msgstr ""
2353
 
2354
+ #: admin/views/feedback-disable.php:23
 
 
 
 
 
 
 
 
2355
  msgid "Submit & Deactivate"
2356
  msgstr ""
2357
 
2358
+ #: admin/views/feedback-disable.php:24
2359
  msgid "Keep it & get a reply within 12h"
2360
  msgstr ""
2361
 
2362
+ #: admin/views/feedback-disable.php:26
2363
  msgid "Only Deactivate"
2364
  msgstr ""
2365
 
2520
  msgid "start counting from bottom"
2521
  msgstr ""
2522
 
2523
+ #: admin/views/placements-item.php:2 admin/views/placements.php:191
2524
  msgid "--not selected--"
2525
  msgstr ""
2526
 
2570
  msgid "Item"
2571
  msgstr ""
2572
 
2573
+ #: admin/views/placements.php:96
2574
  msgid "position"
2575
  msgstr ""
2576
 
2577
+ #: admin/views/placements.php:100
2578
  msgid "Important Notice"
2579
  msgstr ""
2580
 
2581
+ #: admin/views/placements.php:100
2582
  msgid ""
2583
  "Your server is missing an extension. This might break the content injection."
2584
  "<br/>Ignore this warning if everything works fine or else ask your hosting "
2585
  "provider to enable <em>mbstring</em>."
2586
  msgstr ""
2587
 
2588
+ #: admin/views/placements.php:121
2589
  msgid "ad label"
2590
  msgstr ""
2591
 
2592
+ #: admin/views/placements.php:129
2593
  msgid "show all options"
2594
  msgstr ""
2595
 
2596
+ #: admin/views/placements.php:138
2597
  #, php-format
2598
  msgid ""
2599
  "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the "
2600
  "header of your website</a>."
2601
  msgstr ""
2602
 
2603
+ #: admin/views/placements.php:145
2604
  msgctxt "checkbox to remove placement"
2605
  msgid "delete"
2606
  msgstr ""
2607
 
2608
+ #: admin/views/placements.php:152
2609
  msgid "Save Placements"
2610
  msgstr ""
2611
 
2612
+ #: admin/views/placements.php:154
2613
  msgid "Create a new placement"
2614
  msgstr ""
2615
 
2616
+ #: admin/views/placements.php:155
2617
  msgid "New Placement"
2618
  msgstr ""
2619
 
2620
+ #: admin/views/placements.php:164
2621
  msgid "Choose a placement type"
2622
  msgstr ""
2623
 
2624
+ #: admin/views/placements.php:165
2625
  #, php-format
2626
  msgid ""
2627
  "Placement types define where the ad is going to be displayed. Learn more "
2628
  "about the different types from the <a href=\"%s\">manual</a>"
2629
  msgstr ""
2630
 
2631
+ #: admin/views/placements.php:182
2632
  msgid "Please select a placement type."
2633
  msgstr ""
2634
 
2635
+ #: admin/views/placements.php:184
2636
  msgid "Choose a Name"
2637
  msgstr ""
2638
 
2639
+ #: admin/views/placements.php:185
2640
  msgid ""
2641
  "The name of the placement is only visible to you. Tip: choose a descriptive "
2642
  "one, e.g. <em>Below Post Headline</em>."
2643
  msgstr ""
2644
 
2645
+ #: admin/views/placements.php:186
2646
  msgid "Placement Name"
2647
  msgstr ""
2648
 
2649
+ #: admin/views/placements.php:187
2650
  msgid "Please enter a name for your placement."
2651
  msgstr ""
2652
 
2653
+ #: admin/views/placements.php:188
2654
  msgid "Choose the Ad or Group"
2655
  msgstr ""
2656
 
2657
+ #: admin/views/placements.php:189
2658
  msgid "The ad or group that should be displayed."
2659
  msgstr ""
2660
 
2661
+ #: admin/views/placements.php:208
2662
  msgid "Save New Placement"
2663
  msgstr ""
2664
 
2758
  msgid "General"
2759
  msgstr ""
2760
 
2761
+ #: admin/views/settings.php:40
2762
  msgid "Save settings on this page"
2763
  msgstr ""
2764
 
2765
+ #: admin/views/settings.php:47 modules/import-export/main.php:15
2766
  #: modules/import-export/main.php:15
2767
  msgid "Import &amp; Export"
2768
  msgstr ""
2803
  msgid "search"
2804
  msgstr ""
2805
 
2806
+ #: admin/views/support.php:21
2807
  #, php-format
2808
  msgid ""
2809
  "Take a look at more common issues or contact us directly through the <a "
2810
  "href=\"%s\" target=\"_blank\">support page</a>."
2811
  msgstr ""
2812
 
2813
+ #: admin/views/support.php:23
2814
+ #, php-format
2815
+ msgid ""
2816
+ "Upgrade to any premium add-on and get <strong>priority email support</strong>"
2817
+ " or reach out through the <a href=\"%s\" target=\"_blank\">support forum</a> "
2818
+ "for individual help."
2819
+ msgstr ""
2820
+
2821
  #: modules/gadsense/main.php:19
2822
  msgid " at "
2823
  msgstr ""
2836
  "ad setup."
2837
  msgstr ""
2838
 
2839
+ #: admin/views/notices/welcome-panel.php:2
2840
+ msgid "Welcome to Advanced Ads!"
2841
+ msgstr ""
2842
+
2843
+ #: admin/views/notices/welcome-panel.php:5
2844
+ msgid "Get Started"
2845
+ msgstr ""
2846
+
2847
+ #: admin/views/notices/welcome-panel.php:8
2848
+ msgid "First ad tutorial"
2849
+ msgstr ""
2850
+
2851
+ #: admin/views/notices/welcome-panel.php:12
2852
+ msgid "AdSense Options"
2853
+ msgstr ""
2854
+
2855
+ #: admin/views/notices/welcome-panel.php:13
2856
+ msgid "Import ads from AdSense"
2857
+ msgstr ""
2858
+
2859
+ #: admin/views/notices/welcome-panel.php:15
2860
+ msgid "Setting up Auto ads"
2861
+ msgstr ""
2862
+
2863
+ #: admin/views/notices/welcome-panel.php:16
2864
+ msgid "Setting up AdSense ads manually"
2865
+ msgstr ""
2866
+
2867
+ #: admin/views/notices/welcome-panel.php:20
2868
+ msgid "Get Help"
2869
+ msgstr ""
2870
+
2871
+ #: admin/views/notices/welcome-panel.php:23
2872
+ msgid "Reach out for help"
2873
+ msgstr ""
2874
+
2875
  #: modules/ad-blocker/admin/admin.php:96
2876
  msgid "Ad blocker fix"
2877
  msgstr ""
2878
 
2879
+ #: modules/ad-blocker/admin/admin.php:165
2880
  msgid "The asset folder was rebuilt successfully"
2881
  msgstr ""
2882
 
2883
+ #: modules/ad-blocker/admin/admin.php:226
2884
  msgid "There is no writable upload folder"
2885
  msgstr ""
2886
 
2887
+ #: modules/ad-blocker/admin/admin.php:255
2888
  #, php-format
2889
  msgid "Unable to rename \"%s\" directory"
2890
  msgstr ""
2891
 
2892
+ #: modules/ad-blocker/admin/admin.php:271
2893
+ #: modules/ad-blocker/admin/admin.php:284
2894
+ #: modules/ad-blocker/admin/admin.php:301
2895
  #, php-format
2896
  msgid "Unable to copy assets to the \"%s\" directory"
2897
  msgstr ""
2898
 
2899
+ #: modules/ad-blocker/admin/admin.php:334
2900
+ #: modules/ad-blocker/admin/admin.php:419
2901
  #, php-format
2902
  msgid "We do not have direct write access to the \"%s\" directory"
2903
  msgstr ""
2904
 
2905
+ #: modules/ad-blocker/admin/admin.php:430
 
 
 
 
 
 
 
2906
  #, php-format
2907
  msgid "Unable to copy files to %s"
2908
  msgstr ""
2915
  msgid "Ad blocker counter"
2916
  msgstr ""
2917
 
2918
+ #: modules/gadsense/admin/admin.php:48
 
 
 
 
 
2919
  msgid "The ad details couldn't be retrieved from the ad code"
2920
  msgstr ""
2921
 
2922
+ #: modules/gadsense/admin/admin.php:49
2923
  msgid ""
2924
  "Warning : The AdSense account from this code does not match the one set with "
2925
  "the Advanced Ads Plugin. This ad might cause troubles when used in the front "
2926
  "end."
2927
  msgstr ""
2928
 
2929
+ #: modules/gadsense/admin/admin.php:53
2930
  msgid ""
2931
  "This type of ad code is set up in the AdSense settings. Click on the "
2932
  "following button to enable it now."
2933
  msgstr ""
2934
 
2935
+ #: modules/gadsense/admin/admin.php:54
2936
  msgid "Activate"
2937
  msgstr ""
2938
 
2939
+ #: modules/gadsense/admin/admin.php:141
2940
+ msgid "AdSense account"
2941
  msgstr ""
2942
 
2943
+ #: modules/gadsense/admin/admin.php:150
2944
+ msgid "Verification code & Auto ads"
2945
  msgstr ""
2946
 
2947
+ #: modules/gadsense/admin/admin.php:159
2948
+ msgid "Limit to 3 ads"
2949
  msgstr ""
2950
 
2951
+ #: modules/gadsense/admin/admin.php:168
2952
  msgid "Disable violation warnings"
2953
  msgstr ""
2954
 
2955
+ #: modules/gadsense/admin/admin.php:176
2956
  msgid "Transparent background"
2957
  msgstr ""
2958
 
2959
+ #: modules/gadsense/admin/admin.php:233
 
 
 
 
 
 
 
 
 
 
 
2960
  #, php-format
2961
  msgid "Limit to %d AdSense ads"
2962
  msgstr ""
2963
 
2964
+ #: modules/gadsense/admin/admin.php:237
2965
  msgid ""
2966
  "There is no explicit limit for AdSense ads anymore, but you can still use "
2967
  "this setting to prevent too many AdSense ads to show accidentally on your "
2968
  "site."
2969
  msgstr ""
2970
 
2971
+ #: modules/gadsense/admin/admin.php:241
2972
  msgid ""
2973
  "Due to technical restrictions, the limit does not work on placements with "
2974
  "cache-busting enabled."
2975
  msgstr ""
2976
 
2977
+ #: modules/gadsense/admin/admin.php:255
2978
+ #: modules/gadsense/admin/views/adsense-account.php:117
 
 
 
2979
  msgid ""
2980
+ "Insert the AdSense header code used for verification and the Auto Ads "
2981
+ "feature."
 
2982
  msgstr ""
2983
 
2984
+ #: modules/gadsense/admin/admin.php:256
2985
  #, php-format
2986
  msgid ""
2987
+ "This code might also activate Auto ads. Please read <a href=\"%s\" "
2988
+ "target=\"_blank\">this article</a> if <strong>ads appear in random "
2989
+ "places</strong>."
2990
  msgstr ""
2991
 
2992
+ #: modules/gadsense/admin/admin.php:269
2993
  msgid "Disable warnings about potential violations of the AdSense terms."
2994
  msgstr ""
2995
 
2996
+ #: modules/gadsense/admin/admin.php:270
2997
  #, php-format
2998
  msgid ""
2999
  "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if "
3001
  "managed with Advanced Ads. Enable this option to remove these checks"
3002
  msgstr ""
3003
 
3004
+ #: modules/gadsense/admin/admin.php:281
3005
  msgid ""
3006
  "Enable this option in case your theme adds an unfortunate background color "
3007
  "to AdSense ads."
3008
  msgstr ""
3009
 
3010
+ #: modules/gadsense/admin/admin.php:304
3011
  #: modules/gadsense/includes/class-ad-type-adsense.php:73
3012
  msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
3013
  msgstr ""
3014
 
3015
+ #: modules/gadsense/admin/admin.php:326
3016
  msgid "AdSense"
3017
  msgstr ""
3018
 
3019
+ #: modules/gadsense/admin/admin.php:378
3020
  #, php-format
3021
  msgid ""
3022
  "Responsive AdSense ads don’t work reliably with <em>Position</em> set to "
3025
  "wrapped in text."
3026
  msgstr ""
3027
 
3028
+ #: modules/gadsense/admin/admin.php:384
3029
  #, php-format
3030
  msgid ""
3031
  "<a href=\"%s\" target=\"_blank\">Install the free AdSense In-feed add-on</a> "
3032
  "in order to place ads between posts."
3033
  msgstr ""
3034
 
3035
+ #: modules/gadsense/admin/admin.php:391
3036
  #, php-format
3037
  msgid ""
3038
  "Use the <a href=\"%s\" target=\"_blank\">Responsive add-on</a> in order to "
3056
  msgid "Auto"
3057
  msgstr ""
3058
 
3059
+ #: modules/gadsense/includes/class-mapi.php:488
3060
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:20
3061
+ msgid "No ad unit found"
3062
+ msgstr ""
3063
+
3064
+ #: modules/gadsense/includes/class-mapi.php:490
3065
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:24
3066
+ msgid "--select ad--"
3067
+ msgstr ""
3068
+
3069
+ #. Name of the plugin
3070
+ #: modules/gutenberg/includes/class-gutenberg.php:78
3071
+ msgid "Advanced Ads"
3072
+ msgstr ""
3073
+
3074
  #: modules/import-export/classes/import.php:66
3075
  msgid "Please enter XML content"
3076
  msgstr ""
3077
 
3078
  #: modules/import-export/classes/import.php:147
3079
+ #: modules/import-export/classes/import.php:565
3080
  #, php-format
3081
  msgid "New attachment created <em>%s</em> %s"
3082
  msgstr ""
3111
  msgid "Placement <em>%s</em> created"
3112
  msgstr ""
3113
 
3114
+ #: modules/import-export/classes/import.php:476
3115
  #, php-format
3116
  msgid "Option was updated: <em>%s</em>"
3117
  msgstr ""
3118
 
3119
+ #: modules/import-export/classes/import.php:479
3120
  #, php-format
3121
  msgid "Option already exists: <em>%s</em>"
3122
  msgstr ""
3123
 
3124
+ #: modules/import-export/classes/import.php:501
3125
  #, php-format
3126
  msgid "Failed to create import directory <em>%s</em>"
3127
  msgstr ""
3128
 
3129
+ #: modules/import-export/classes/import.php:506
3130
  #, php-format
3131
  msgid "Import directory is not writable: <em>%s</em>"
3132
  msgstr ""
3133
 
3134
+ #: modules/import-export/classes/import.php:514
3135
  msgid ""
3136
  "File is empty, uploads are disabled or post_max_size is smaller than "
3137
  "upload_max_filesize in php.ini"
3138
  msgstr ""
3139
 
3140
+ #: modules/import-export/classes/import.php:524
3141
  #, php-format
3142
  msgid "Failed to upload file, error: <em>%s</em>"
3143
  msgstr ""
3144
 
3145
+ #: modules/import-export/classes/import.php:529
3146
  msgid "File is empty."
3147
  msgstr ""
3148
 
3149
+ #: modules/import-export/classes/import.php:534
3150
  #, php-format
3151
  msgid ""
3152
  "The file could not be created: <em>%s</em>. This is probably a permissions "
3153
  "problem"
3154
  msgstr ""
3155
 
3156
+ #: modules/import-export/classes/import.php:607
3157
  #, php-format
3158
  msgid "Invalid filetype <em>%s</em>"
3159
  msgstr ""
3160
 
3161
+ #: modules/import-export/classes/import.php:612
3162
+ #: modules/import-export/classes/import.php:619
3163
+ #: modules/import-export/classes/import.php:627
3164
+ #: modules/import-export/classes/import.php:642
3165
  #, php-format
3166
  msgid "Error getting remote image <em>%s</em>"
3167
  msgstr ""
3168
 
3169
+ #: modules/import-export/classes/import.php:636
3170
  #, php-format
3171
  msgid "Zero size file downloaded <em>%s</em>"
3172
  msgstr ""
3240
  msgid "Start import"
3241
  msgstr ""
3242
 
3243
+ #: modules/privacy/admin/admin.php:63
3244
+ msgid "Privacy"
3245
+ msgstr ""
3246
+
3247
+ #: modules/privacy/admin/admin.php:84
3248
+ msgid "Enable Privacy module"
3249
+ msgstr ""
3250
+
3251
+ #: modules/privacy/admin/admin.php:87
3252
+ msgid "Consent method"
3253
+ msgstr ""
3254
+
3255
+ #: modules/privacy/classes/plugin.php:141
3256
+ msgid "Show all ads even without consent."
3257
+ msgstr ""
3258
+
3259
+ #: modules/privacy/classes/plugin.php:142
3260
+ msgid "Cookie"
3261
+ msgstr ""
3262
+
3263
  #: modules/ad-blocker/admin/views/rebuild_form.php:1
3264
  msgid "Ad blocker file folder"
3265
  msgstr ""
3320
  "Google Analytics property ID above to count them."
3321
  msgstr ""
3322
 
3323
+ #: modules/gadsense/admin/views/adsense-account.php:33
3324
+ #: modules/gadsense/admin/views/adsense-account.php:47
3325
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:47
3326
+ msgid "Connect to AdSense"
3327
+ msgstr ""
3328
+
3329
+ #: modules/gadsense/admin/views/adsense-account.php:36
3330
+ msgid "Revoke API acccess"
3331
+ msgstr ""
3332
+
3333
+ #: modules/gadsense/admin/views/adsense-account.php:41
3334
+ msgid "Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>"
3335
+ msgstr ""
3336
+
3337
+ #: modules/gadsense/admin/views/adsense-account.php:46
3338
+ msgid "Yes, I have an AdSense account"
3339
+ msgstr ""
3340
+
3341
+ #: modules/gadsense/admin/views/adsense-account.php:48
3342
+ msgid "Configure everything manually"
3343
+ msgstr ""
3344
+
3345
+ #: modules/gadsense/admin/views/adsense-account.php:51
3346
+ msgid "No, I still don't have an AdSense account"
3347
+ msgstr ""
3348
+
3349
+ #: modules/gadsense/admin/views/adsense-account.php:52
3350
+ msgid "Get a free AdSense account"
3351
+ msgstr ""
3352
+
3353
+ #: modules/gadsense/admin/views/adsense-account.php:101
3354
+ #, php-format
3355
+ msgid ""
3356
+ "Problems with AdSense? Check out the <a href=\"%s\" target=\"_blank\">"
3357
+ "manual</a> and get a free setup check."
3358
+ msgstr ""
3359
+
3360
+ #: modules/gadsense/admin/views/adsense-account.php:115
3361
+ msgid "Please enter the confirmation code."
3362
+ msgstr ""
3363
+
3364
+ #: modules/gadsense/admin/views/adsense-account.php:119
3365
+ msgid "Submit code"
3366
+ msgstr ""
3367
+
3368
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:52
3369
  msgid ""
3370
  "Copy the ad code from your AdSense account, paste it into the area below and "
3371
  "click on <em>Get details</em>."
3372
  msgstr ""
3373
 
3374
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:54
3375
  msgid "Get details"
3376
  msgstr ""
3377
 
3378
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:56
3379
+ msgid "connect to your AdSense account"
3380
+ msgstr ""
3381
+
3382
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:64
3383
  msgid "Insert new AdSense code"
3384
  msgstr ""
3385
 
3386
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:68
3387
+ msgid "Get ad code from your linked account"
3388
+ msgstr ""
3389
+
3390
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:75
3391
  msgid "Ad Slot ID"
3392
  msgstr ""
3393
 
3394
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:80
3395
  #, php-format
3396
  msgid "Publisher ID: %s"
3397
  msgstr ""
3398
 
3399
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:84
3400
+ msgid ""
3401
+ "The ad slot ID is either a number or empty and not the same as the publisher "
3402
+ "ID."
3403
+ msgstr ""
3404
+
3405
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:95
3406
  #, php-format
3407
  msgid "Please <a href=\"%s\" target=\"_blank\">change it here</a>."
3408
  msgstr ""
3409
 
3410
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:101
3411
  msgid "Normal"
3412
  msgstr ""
3413
 
3414
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:103
3415
  msgid "Responsive (Matched Content)"
3416
  msgstr ""
3417
 
3418
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:104
3419
  msgid "Link ads"
3420
  msgstr ""
3421
 
3422
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:105
3423
  msgid "Link ads (Responsive)"
3424
  msgstr ""
3425
 
3426
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:106
3427
  msgid "InArticle"
3428
  msgstr ""
3429
 
3430
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:107
3431
  msgid "InFeed"
3432
  msgstr ""
3433
 
3434
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:112
3435
  msgid "Resizing"
3436
  msgstr ""
3437
 
3438
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:120
3439
  msgid "Layout"
3440
  msgstr ""
3441
 
3442
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:124
3443
  msgid "Layout-Key"
3444
  msgstr ""
3445
 
3446
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:15
3447
+ msgid "AdSense Ad Unit"
3448
+ msgstr ""
3449
+
3450
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:15
3451
+ msgid "Update ad units list"
3452
+ msgstr ""
3453
+
3454
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:32
3455
+ msgid "Update Details"
3456
+ msgstr ""
3457
+
3458
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:35
3459
+ msgid "Unrecognized ad code"
3460
+ msgstr ""
3461
+
3462
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:38
3463
+ msgid "This ad type can currently not be imported from AdSense."
3464
+ msgstr ""
3465
+
3466
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:39
3467
+ msgid "Learn more and help us to enable it here."
3468
+ msgstr ""
3469
+
3470
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:40
3471
+ msgid "In the meantime, you can use AdSense with one of these methods:"
3472
+ msgstr ""
3473
+
3474
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:42
3475
+ msgid ""
3476
+ "Click on <em>Insert new AdSense code</em> and copy the code from your "
3477
+ "AdSense account into it."
3478
+ msgstr ""
3479
+
3480
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:43
3481
+ msgid ""
3482
+ "Create an ad on the fly. Just select the <em>Normal</em> or <em>"
3483
+ "Responsive</em> type and the size."
3484
+ msgstr ""
3485
+
3486
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:44
3487
+ msgid ""
3488
+ "Choose a <em>Normal</em>, <em>Responsive</em> or <em>Link Unit</em> ad from "
3489
+ "your AdSense account."
3490
+ msgstr ""
3491
+
3492
+ #: modules/privacy/admin/views/setting-ad-ignore-consent.php:2
3493
+ msgid "privacy"
3494
+ msgstr ""
3495
+
3496
+ #: modules/privacy/admin/views/setting-ad-ignore-consent.php:6
3497
+ #, php-format
3498
+ msgid ""
3499
+ "Ignore <a href=\"%s\">general Privacy settings</a> and display the ad even "
3500
+ "without consent."
3501
+ msgstr ""
3502
+
3503
+ #: modules/privacy/admin/views/setting-consent-method.php:12
3504
+ msgid "Value"
3505
+ msgstr ""
3506
+
3507
+ #: modules/privacy/admin/views/setting-consent-method.php:18
3508
+ msgid "Show non-personalized AdSense ads until consent is given."
3509
+ msgstr ""
3510
+
3511
+ #: modules/privacy/admin/views/setting-enable.php:5
3512
+ msgid ""
3513
+ "Your users’ consent might get cached and show ads to users who didn’t give "
3514
+ "their consent yet. "
3515
+ msgstr ""
3516
+
3517
+ #: modules/privacy/admin/views/setting-enable.php:6
3518
+ #, php-format
3519
+ msgid ""
3520
+ "Cache-busting in <a href=\"%s\" target=\"_blank\">Advanced Ads Pro</a> "
3521
+ "solves that."
3522
  msgstr ""
3523
 
3524
  #. Description of the plugin
modules/ad-blocker/admin/admin.php CHANGED
@@ -343,6 +343,7 @@ class Advanced_Ads_Ad_Blocker_Admin
343
  $orig_path_components = preg_split('/\//', $orig_path, -1, PREG_SPLIT_NO_EMPTY);
344
  $replaced_path_components = preg_split('/\//', $replaced_path, -1, PREG_SPLIT_NO_EMPTY);
345
 
 
346
  foreach ( $orig_path_components as $k=> $orig_path_part ) {
347
  $rand_asset_names[ $orig_path_part] = (string) $replaced_path_components[$k];
348
  }
@@ -376,6 +377,7 @@ class Advanced_Ads_Ad_Blocker_Admin
376
  $path_components = preg_split('/\//', $first_cleanup_dir, -1, PREG_SPLIT_NO_EMPTY);
377
  $path_components_new = array();
378
 
 
379
  foreach ( $path_components as $k => $dir ) {
380
  if ( in_array( $dir, $not_rename_assets ) ) {
381
  $path_components_new[ $k ] = $dir;
@@ -400,7 +402,7 @@ class Advanced_Ads_Ad_Blocker_Admin
400
  $new_abs_file = $new_dir_full_normalized . $rand_asset_names[$first_cleanup_filename];
401
  $new_rel_file = $new_dir . $rand_asset_names[$first_cleanup_filename];
402
  } else {
403
- $new_filename = $this->generate_unique_name( array_values( $rand_asset_names ) ) . '.' . $first_cleanup_file_extension;
404
  $rand_asset_names[$first_cleanup_filename] = (string) $new_filename;
405
  $new_abs_file = $new_dir_full_normalized . $new_filename;
406
  $new_rel_file = $new_dir . $new_filename;
@@ -530,22 +532,29 @@ class Advanced_Ads_Ad_Blocker_Admin
530
  * Generate unique name
531
  *
532
  * @param array $haystack array to check, that the returned string does not exist in this array
 
533
  * @return string unique name
534
  */
535
- function generate_unique_name( $haystack = false ) {
 
536
  if ( $haystack ) {
537
  $i = 0;
538
 
539
  do {
 
540
  if ( ++$i < 100 ) {
541
- $needle = (string) mt_rand( 1, 999 );
542
  } else {
543
- $needle .= '_' . $i;
544
  }
 
545
  } while( in_array( $needle, $haystack ) );
 
 
546
  }
547
 
548
- return (string) mt_rand( 1, 999 );
 
549
  }
550
 
551
  /**
343
  $orig_path_components = preg_split('/\//', $orig_path, -1, PREG_SPLIT_NO_EMPTY);
344
  $replaced_path_components = preg_split('/\//', $replaced_path, -1, PREG_SPLIT_NO_EMPTY);
345
 
346
+ // (css, style.css) => (1, 2.css)
347
  foreach ( $orig_path_components as $k=> $orig_path_part ) {
348
  $rand_asset_names[ $orig_path_part] = (string) $replaced_path_components[$k];
349
  }
377
  $path_components = preg_split('/\//', $first_cleanup_dir, -1, PREG_SPLIT_NO_EMPTY);
378
  $path_components_new = array();
379
 
380
+ // Interate over directories.
381
  foreach ( $path_components as $k => $dir ) {
382
  if ( in_array( $dir, $not_rename_assets ) ) {
383
  $path_components_new[ $k ] = $dir;
402
  $new_abs_file = $new_dir_full_normalized . $rand_asset_names[$first_cleanup_filename];
403
  $new_rel_file = $new_dir . $rand_asset_names[$first_cleanup_filename];
404
  } else {
405
+ $new_filename = $this->generate_unique_name( array_values( $rand_asset_names ), $first_cleanup_file_extension );
406
  $rand_asset_names[$first_cleanup_filename] = (string) $new_filename;
407
  $new_abs_file = $new_dir_full_normalized . $new_filename;
408
  $new_rel_file = $new_dir . $new_filename;
532
  * Generate unique name
533
  *
534
  * @param array $haystack array to check, that the returned string does not exist in this array
535
+ * @param string $extension Extension to append to the name.
536
  * @return string unique name
537
  */
538
+ function generate_unique_name( $haystack = false, $extension = '' ) {
539
+ $extension = $extension ? '.' . $extension : '';
540
  if ( $haystack ) {
541
  $i = 0;
542
 
543
  do {
544
+ $rand = (string) mt_rand( 1, 999 );
545
  if ( ++$i < 100 ) {
546
+ $needle = (string) $rand . $extension;
547
  } else {
548
+ $needle = (string) $rand . '_' . $i . $extension;
549
  }
550
+
551
  } while( in_array( $needle, $haystack ) );
552
+
553
+ return $needle;
554
  }
555
 
556
+ $needle = (string) mt_rand( 1, 999 ) . $extension;
557
+ return $needle;
558
  }
559
 
560
  /**
modules/gadsense/admin/admin.php CHANGED
@@ -52,7 +52,8 @@ class Advanced_Ads_AdSense_Admin {
52
  printf( '%s <button id="adsense_enable_pla" type="button" class="button">%s</button>',
53
  esc_attr__( 'This type of ad code is set up in the AdSense settings. Click on the following button to enable it now.', 'advanced-ads' ),
54
  esc_attr__( 'Activate', 'advanced-ads' ) ); ?>'
55
- }
 
56
  };
57
  </script>
58
  <?php
@@ -137,7 +138,7 @@ class Advanced_Ads_AdSense_Admin {
137
  // add setting field to disable ads
138
  add_settings_field(
139
  'adsense-id',
140
- __( 'AdSense ID', 'advanced-ads' ),
141
  array($this, 'render_settings_adsense_id'),
142
  $hook,
143
  'advanced_ads_adsense_setting_section'
@@ -177,7 +178,20 @@ class Advanced_Ads_AdSense_Admin {
177
  $hook,
178
  'advanced_ads_adsense_setting_section'
179
  );
180
-
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  // hook for additional settings from add-ons
182
  do_action( 'advanced-ads-adsense-settings-init', $hook );
183
  }
@@ -191,25 +205,20 @@ class Advanced_Ads_AdSense_Admin {
191
  // for whatever purpose there might come
192
  }
193
 
 
 
 
 
 
 
 
194
  /**
195
  * render adsense id setting
196
  *
197
  * @since 1.5.1
198
  */
199
  public function render_settings_adsense_id(){
200
- $adsense_id = $this->data->get_adsense_id();
201
-
202
- ?><input type="text" name="<?php echo GADSENSE_OPT_NAME; ?>[adsense-id]" id="adsense-id" size="32" value="<?php echo $adsense_id; ?>" />
203
- <?php if( empty( $adsense_id ) ) :
204
- ?><a class="button button-primary" target="_blank" href="<?php echo self::ADSENSE_NEW_ACCOUNT_LINK; ?>"><?php _e( 'Get a free AdSense account', 'advanced-ads' ); ?></a><?php
205
- endif; ?>
206
- <p class="description"><?php _e( 'Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>', 'advanced-ads' ) ?></p><?php
207
-
208
- if( ! $adsense_id ){
209
- ?><p class="advads-error-message"><?php
210
- printf(__( 'Please enter your Publisher ID in order to use AdSense on your page. See the <a href="%s" target="_blank">manual</a> for more information.', 'advanced-ads' ), ADVADS_URL . 'manual/ad-types/adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-adsense' );
211
- ?></p><?php
212
- }
213
  }
214
 
215
  /**
52
  printf( '%s <button id="adsense_enable_pla" type="button" class="button">%s</button>',
53
  esc_attr__( 'This type of ad code is set up in the AdSense settings. Click on the following button to enable it now.', 'advanced-ads' ),
54
  esc_attr__( 'Activate', 'advanced-ads' ) ); ?>'
55
+ },
56
+ pagenow: '<?php echo $pagenow ?>',
57
  };
58
  </script>
59
  <?php
138
  // add setting field to disable ads
139
  add_settings_field(
140
  'adsense-id',
141
+ __( 'AdSense account', 'advanced-ads' ),
142
  array($this, 'render_settings_adsense_id'),
143
  $hook,
144
  'advanced_ads_adsense_setting_section'
178
  $hook,
179
  'advanced_ads_adsense_setting_section'
180
  );
181
+
182
+ $adsense_id = $this->data->get_adsense_id();
183
+
184
+ // if ( !empty( $adsense_id ) ) {
185
+
186
+ // add_settings_field(
187
+ // 'adsense-mapi',
188
+ // __( 'Google AdSense Management API', 'advanced-ads' ),
189
+ // array( $this, 'render_settings_management_api' ),
190
+ // $hook,
191
+ // 'advanced_ads_adsense_setting_section'
192
+ // );
193
+
194
+ // }
195
  // hook for additional settings from add-ons
196
  do_action( 'advanced-ads-adsense-settings-init', $hook );
197
  }
205
  // for whatever purpose there might come
206
  }
207
 
208
+ /**
209
+ * render adsense management api setting
210
+ */
211
+ public function render_settings_management_api() {
212
+ require_once GADSENSE_BASE_PATH . 'admin/views/mapi-settings.php';
213
+ }
214
+
215
  /**
216
  * render adsense id setting
217
  *
218
  * @since 1.5.1
219
  */
220
  public function render_settings_adsense_id(){
221
+ require_once GADSENSE_BASE_PATH . 'admin/views/adsense-account.php';
 
 
 
 
 
 
 
 
 
 
 
 
222
  }
223
 
224
  /**
modules/gadsense/admin/assets/js/mapi-settings.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Advanced Ads.
3
+ *
4
+ * @author Thomas Maier <thomas.maier@webgilde.com>
5
+ * @license GPL-2.0+
6
+ * @link http://webgilde.com
7
+ * @copyright 2013-2017 Thomas Maier, webgilde GmbH
8
+ */
9
+ ;(function($){
10
+ var AUTH_WINDOW = null;
11
+ $( document ).on( 'click', '.preventDefault', function( ev ) {
12
+ ev.preventDefault();
13
+ } )
14
+
15
+ $( document ).on( 'keypress', '#adsense input[type="text"]', function( ev ) {
16
+ if ( $( this ).hasClass( 'preventDefault' ) ) {
17
+ ev.preventDefault();
18
+ return;
19
+ }
20
+ if ( ev.which == 13 || ev.keyCode == 13 ) {
21
+ $( '#adsense .advads-settings-tab-main-form #submit' ).trigger( 'click' );
22
+ }
23
+ } );
24
+
25
+ $( document ).on( 'click', '#connect-adsense', function(){
26
+ if ( $( this ).hasClass( 'disabled' ) ) return;
27
+ $( '#gadsense-modal' ).css( 'display', 'block' );
28
+ var oW = window.outerWidth || $( window ).width(),
29
+ oH = window.outerHeight || $( window ).height(),
30
+ w = Math.min( oW, oH ) * 0.8,
31
+ h = Math.min( oW, oH ) * 0.8,
32
+ l = (oW - w) / 2,
33
+ t = (oH - h) / 2,
34
+ args = 'resize=1,titlebar=1,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t;
35
+
36
+ AUTH_WINDOW = window.open( AdsenseMAPI.oAuth2, 'advadsOAuth2', args );
37
+
38
+ } );
39
+
40
+ $( document ).on( 'click', '#gadsense-modal .dashicons-dismiss', function(){
41
+ $( '#mapi-confirm-code' ).val( '' );
42
+ $( '#gadsense-modal' ).css( 'display', 'none' );
43
+ } );
44
+
45
+ $( document ).on( 'click', '#revoke-token', function(){
46
+
47
+ $( '#gadsense-freeze-all' ).css( 'display', 'block' );
48
+ var ID = $( '#adsense-id' ).val();
49
+ $.ajax({
50
+ url: ajaxurl,
51
+ type: 'post',
52
+ data: {
53
+ action: 'advads-mapi-revoke-token',
54
+ adsenseId: ID,
55
+ nonce: AdsenseMAPI.nonce,
56
+ },
57
+ success:function(response, status, XHR){
58
+ window.location.reload();
59
+ },
60
+ error:function(request, status, error){
61
+ $( '#gadsense-freeze-all' ).css( 'display', 'none' );
62
+ },
63
+ });
64
+
65
+ } );
66
+
67
+ $( document ).on( 'click', '#mapi-confirm-code', function(){
68
+
69
+ var code = $( '#mapi-code' ).val();
70
+ if ( '' == code ) return;
71
+ $( '#gadsense-overlay' ).css( 'display', 'block' );
72
+ var data = {
73
+ action: 'advads_gadsense_mapi_confirm_code',
74
+ code: code,
75
+ nonce: AdsenseMAPI.nonce,
76
+ };
77
+ if ( $( '#mapi-autoads' ).prop( 'checked' ) ) {
78
+ data['autoads'] = true;
79
+ }
80
+ $.ajax({
81
+ url: ajaxurl,
82
+ type: 'post',
83
+ data: data,
84
+ success:function(response, status, XHR){
85
+ if ( null !== AUTH_WINDOW ) {
86
+ AUTH_WINDOW.close();
87
+ }
88
+ if ( response.status && true === response.status ) {
89
+ window.location.reload();
90
+ } else {
91
+ console.log( response );
92
+ $( '#gadsense-overlay' ).css( 'display', 'none' );
93
+ $( '#mapi-code' ).val( '' );
94
+ $( '#mapi-autoads' ).prop( 'checked', false );
95
+ $( '#gadsense-modal-content-inner .dashicons-dismiss' ).trigger( 'click' );
96
+ }
97
+ },
98
+ error:function(request, status, error){
99
+ $( '#gadsense-loading-overlay' ).css( 'display', 'none' );
100
+ },
101
+ });
102
+
103
+ } );
104
+
105
+ $( document ).on( 'click', '#adsense-manual-config', function(){
106
+ $( '#adsense .form-table tr' ).css( 'display', 'table-row' );
107
+ $( '#adsense #auto-adsense-settings-div' ).css( 'display', 'none' );
108
+ $( '#adsense #full-adsense-settings-div' ).css( 'display', 'block' );
109
+ $( '#adsense-id' ).after( $( '#connect-adsense' ).addClass( 'disabled' ) );
110
+ } );
111
+
112
+ $( document ).on( 'change', '#adsense-id', function(){
113
+ if ( '' != $( this ).val().trim() ) {
114
+ $( '#adsense #submit' ).parent().css( 'display', 'block' );
115
+ }
116
+ } );
117
+
118
+ $( function(){
119
+ if ( '' == $( '#adsense-id' ).val().trim() ) {
120
+ $( '#adsense #submit' ).parent().css( 'display', 'none' );
121
+ }
122
+ } );
123
+
124
+ })(window.jQuery);
modules/gadsense/admin/assets/js/new-ad.js CHANGED
@@ -4,39 +4,377 @@
4
  * @author Thomas Maier <thomas.maier@webgilde.com>
5
  * @license GPL-2.0+
6
  * @link http://webgilde.com
7
- * @copyright 2013-2015 Thomas Maier, webgilde GmbH
8
  */
9
  ;
10
  (function ($) {
11
  "use strict";
12
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  // On DOM ready
14
  $(function () {
15
  $( document ).on('click', '.advads-adsense-show-code', function(e){
16
  e.preventDefault();
17
  $( '.advads-adsense-code' ).show();
 
 
18
  $( this ).hide();
19
  })
 
20
  $( document ).on('click', '.advads-adsense-submit-code', function(ev){
21
  ev.preventDefault();
 
22
  var rawContent = $( '.advads-adsense-content' ).val();
23
 
24
  var parseResult = parseAdContent( rawContent );
25
  handleParseResult( parseResult );
26
  });
27
-
28
- $( document ).on('click', '#advanced-ad-type-adsense', function(){
29
- $( '#advanced-ads-ad-parameters' ).on('paramloaded', function(){
30
- var content = $( '#advanced-ads-ad-parameters input[name="advanced_ad[content]"]' ).val();
31
- var parseResult = parseAdContent( content );
32
- handleParseResult( parseResult );
33
- });
34
- });
35
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  $( document ).on('change', '#unit-type, #unit-code', function (ev) {
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  advads_update_adsense_type();
38
  });
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  /**
41
  * Parse ad content.
42
  *
@@ -47,16 +385,17 @@
47
  var theAd = {};
48
  var theContent = $( '<div />' ).html( rawContent );
49
  var adByGoogle = theContent.find( 'ins' );
50
- theAd.slotId = adByGoogle.attr( 'data-ad-slot' );
51
  if ('undefined' != typeof(adByGoogle.attr( 'data-ad-client' ))) {
52
  theAd.pubId = adByGoogle.attr( 'data-ad-client' ).substr( 3 );
53
  }
 
54
  if (undefined !== theAd.slotId && '' != theAd.pubId) {
55
  theAd.display = adByGoogle.css( 'display' );
56
  theAd.format = adByGoogle.attr( 'data-ad-format' );
57
  theAd.layout = adByGoogle.attr( 'data-ad-layout' ); // for InFeed and InArticle
58
  theAd.layout_key = adByGoogle.attr( 'data-ad-layout-key' ); // for InFeed
59
- theAd.style = adByGoogle.attr( 'style' );
60
 
61
  /* normal ad */
62
  if ('undefined' == typeof(theAd.format) && -1 != theAd.style.indexOf( 'width' )) {
@@ -102,7 +441,44 @@
102
  }
103
  }
104
  }
105
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  /* Page-Level ad */
107
  if ( rawContent.indexOf( 'enable_page_level_ads' ) !== -1 ) {
108
  theAd = { 'parse_message': 'pageLevelAd' };
@@ -130,10 +506,18 @@
130
  break;
131
  case 'unknownAd' :
132
  // Not recognized ad code
133
- $( '#pastecode-msg' ).append( $( '<p />' ).css( 'color', 'red' ).html( gadsenseData.msg.unknownAd ) );
 
 
 
134
  break;
135
  default:
136
  setDetailsFromAdCode( parseResult );
 
 
 
 
 
137
  $( '.advads-adsense-code' ).hide();
138
  $( '.advads-adsense-show-code' ).show();
139
  }
@@ -143,6 +527,7 @@
143
  * Set ad parameters fields from the result of parsing ad code
144
  */
145
  function setDetailsFromAdCode(theAd) {
 
146
  $( '#unit-code' ).val( theAd.slotId );
147
  $( '#advads-adsense-pub-id' ).val( theAd.pubId );
148
  if ('normal' == theAd.type) {
@@ -186,7 +571,7 @@
186
  $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
187
  }
188
  var storedPubId = gadsenseData.pubId;
189
- if ('' !== storedPubId && theAd.pubId != storedPubId) {
190
  $( '#adsense-ad-param-error' ).text( gadsenseData.msg.pubIdMismatch );
191
  } else {
192
  $( '#adsense-ad-param-error' ).empty();
@@ -201,7 +586,6 @@
201
  */
202
  window.gadsenseFormatAdContent = function () {
203
  var slotId = $( '#ad-parameters-box #unit-code' ).val();
204
- if ('' == slotId) { return false; }
205
  var unitType = $( '#ad-parameters-box #unit-type' ).val();
206
  var adContent = {
207
  slotId: slotId,
@@ -226,8 +610,58 @@
226
  delete( window.gadsenseAdContent );
227
  }
228
  $( '#advads-ad-content-adsense' ).val( JSON.stringify( adContent, false, 2 ) );
 
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  function advads_update_adsense_type(){
232
  var type = $( '#unit-type' ).val();
233
  $( '.advads-adsense-layout' ).hide();
@@ -235,6 +669,7 @@
235
  $( '.advads-adsense-layout-key' ).hide();
236
  $( '.advads-adsense-layout-key' ).next('div').hide();
237
  $( '.advads-ad-notice-in-feed-add-on' ).hide();
 
238
  if ( 'responsive' == type || 'link-responsive' == type || 'matched-content' == type ) {
239
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
240
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
@@ -268,10 +703,17 @@
268
  } else {
269
  $('#ad-parameters-box-notices .advads-ad-notice-responsive-position').hide();
270
  }
 
271
  }
 
272
  advads_update_adsense_type();
273
-
274
- });
 
 
 
 
 
275
 
276
  /**
277
  * Show a message depending on whether Auto ads are enabled.
4
  * @author Thomas Maier <thomas.maier@webgilde.com>
5
  * @license GPL-2.0+
6
  * @link http://webgilde.com
7
+ * @copyright 2013-2018 Thomas Maier, webgilde GmbH
8
  */
9
  ;
10
  (function ($) {
11
  "use strict";
12
+ var parseCodeBtnClicked = false, advancedAdSenseHidden = false;
13
+ $( document ).on( 'click', '.prevent-default', function( ev ) { ev.preventDefault() } );
14
+
15
+ function MapiMayBeSaveAdCode(){
16
+
17
+ // MAPI not set up
18
+ if ( 'undefined' == typeof AdsenseMAPI ) return;
19
+
20
+ var slotId = $( '#unit-code' ).val();
21
+ if ( !slotId ) return;
22
+
23
+ var type = $( '#unit-type' ).val();
24
+ var width = $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[width]"]' ).val().trim();
25
+ var height = $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val().trim();
26
+ var layout = $( '#ad-layout' ).val();
27
+ var layoutKey = $( '#ad-layout-key' ).val();
28
+
29
+ var code = false;
30
+
31
+ switch ( type ) {
32
+ case 'in-feed':
33
+ code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
34
+ '<ins class="adsbygoogle" ' +
35
+ 'style="display:block;" ' +
36
+ 'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
37
+ 'data-ad-slot="' + slotId + '" ' +
38
+ 'data-ad-layout-key="' + layoutKey + '" ';
39
+ if ( '' != layout ) {
40
+ code += 'data-ad-layout="' + layout + '" ';
41
+ }
42
+ code += 'data-ad-format="fluid"></ins>' +
43
+ '<script>' +
44
+ '(adsbygoogle = window.adsbygoogle || []).push({});' +
45
+ '</script>';
46
+ break;
47
+ case 'in-article':
48
+ code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
49
+ '<ins class="adsbygoogle" ' +
50
+ 'style="display:block;text-align:center;" ' +
51
+ 'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
52
+ 'data-ad-slot="' + slotId + '" ' +
53
+ 'data-ad-layout="in-article" ' +
54
+ 'data-ad-format="fluid"></ins>' +
55
+ '<script>' +
56
+ '(adsbygoogle = window.adsbygoogle || []).push({});' +
57
+ '</script>';
58
+ break;
59
+ case 'matched-content':
60
+ code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
61
+ '<ins class="adsbygoogle" ' +
62
+ 'style="display:block;" ' +
63
+ 'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
64
+ 'data-ad-slot="' + slotId + '" ' +
65
+ 'data-ad-format="autorelaxed"></ins>' +
66
+ '<script>' +
67
+ '(adsbygoogle = window.adsbygoogle || []).push({});' +
68
+ '</script>';
69
+ break;
70
+ case 'link-responsive':
71
+ code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
72
+ '<ins class="adsbygoogle" ' +
73
+ 'style="display:block;" ' +
74
+ 'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
75
+ 'data-ad-slot="' + slotId + '" ' +
76
+ 'data-ad-format="link"></ins>' +
77
+ '<script>' +
78
+ '(adsbygoogle = window.adsbygoogle || []).push({});' +
79
+ '</script>';
80
+ break;
81
+ case 'link':
82
+ code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
83
+ '<ins class="adsbygoogle" ' +
84
+ 'style="display:block;width:' + width + 'px;height:' + height + 'px" ' +
85
+ 'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
86
+ 'data-ad-slot="' + slotId + '" ' +
87
+ 'data-ad-format="link"></ins>' +
88
+ '<script>' +
89
+ '(adsbygoogle = window.adsbygoogle || []).push({});' +
90
+ '</script>';
91
+ break;
92
+ case 'responsive':
93
+ code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
94
+ '<ins class="adsbygoogle" ' +
95
+ 'style="display:block;" ' +
96
+ 'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
97
+ 'data-ad-slot="' + slotId + '" ' +
98
+ 'data-ad-format="auto"></ins>' +
99
+ '<script>' +
100
+ '(adsbygoogle = window.adsbygoogle || []).push({});' +
101
+ '</script>';
102
+ break;
103
+ case 'normal':
104
+ code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' +
105
+ '<ins class="adsbygoogle" ' +
106
+ 'style="display:inline-block;width:' + width + 'px;height:' + height + 'px" ' +
107
+ 'data-ad-client="ca-' + AdsenseMAPI.pubId + '" ' +
108
+ 'data-ad-slot="' + slotId + '"></ins>' +
109
+ '<script>' +
110
+ '(adsbygoogle = window.adsbygoogle || []).push({});' +
111
+ '</script>';
112
+ break;
113
+ default:
114
+ }
115
+
116
+ if ( code ) {
117
+ MapiSaveAdCode( code, slotId );
118
+ }
119
+
120
+ }
121
+
122
+ function MapiSaveAdCode( code, slot ) {
123
+ if ( 'undefined' == typeof AdsenseMAPI.codes[ 'ca-' + AdsenseMAPI.pubId + ':' + slot ] ) {
124
+ AdsenseMAPI.codes['ca-' + AdsenseMAPI.pubId + ':' + slot] = code;
125
+ $( '#mapi-loading-overlay' ).css( 'display', 'block' );
126
+ $.ajax({
127
+ type: 'post',
128
+ url: ajaxurl,
129
+ data: {
130
+ nonce: AdsenseMAPI.nonce,
131
+ slot: slot,
132
+ code: code,
133
+ action: 'advads-mapi-reconstructed-code',
134
+ },
135
+ success: function( resp, status, XHR ) {
136
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
137
+ },
138
+ error: function( req, status, err ) {
139
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
140
+ },
141
+ });
142
+ }
143
+ makeReadOnly();
144
+ }
145
+
146
+ /**
147
+ * Update details button state
148
+ */
149
+ function canUpdateDetails() {
150
+ if ( 'undefined' == typeof AdsenseMAPI ) return;
151
+ if ( 0 == 1 ) {
152
+ $( '#mapi-get-adcode' ).prop( 'disabled', true );
153
+ $( '#mapi-update-unit-list' ).prop( 'disabled', true );
154
+ return;
155
+ }
156
+
157
+ var unit = $( '#mapi-adunit-select' ).val();
158
+
159
+ // Disable the update button for an un-supported ad format
160
+ if ( 'undefined' != typeof AdsenseMAPI.codes[unit] ) {
161
+
162
+ var badFormats = [
163
+ 'data-ad-format="autorelaxed"',
164
+ 'data-ad-format="fluid"',
165
+ ];
166
+
167
+ var disabled = false;
168
+ for ( var i in badFormats ) {
169
+ if ( -1 != AdsenseMAPI.codes[unit].indexOf( badFormats[i] ) ) {
170
+ disabled = true;
171
+ break;
172
+ }
173
+ }
174
+ $( '#mapi-get-adcode' ).prop( 'disabled', disabled );
175
+
176
+ } else {
177
+ if ( '' == $( '#mapi-adunit-select' ).val() ) {
178
+ $( '#mapi-get-adcode' ).prop( 'disabled', true );
179
+ } else {
180
+ $( '#mapi-get-adcode' ).prop( 'disabled', false );
181
+ }
182
+ }
183
+ }
184
+
185
+ function makeReadOnly() {
186
+ $( '#unit-code,#ad-layout,#ad-layout-key,[name="advanced_ad[width]"],[name="advanced_ad[height]"]' ).prop( 'readonly', true );
187
+ $( '#unit-type option:not(:selected)' ).prop( 'disabled', true );
188
+ }
189
+
190
+ function undoReadOnly() {
191
+ $( '#unit-code,#ad-layout,#ad-layout-key,[name="advanced_ad[width]"],[name="advanced_ad[height]"]' ).prop( 'readonly', false );
192
+ $( '#unit-type option:not(:selected)' ).prop( 'disabled', false );
193
+ }
194
+
195
+ function closeAdSelector() {
196
+
197
+ // close the ad unit selector
198
+ setTimeout(function(){
199
+ $( '#mapi-wrap' ).animate(
200
+ { height: 0, },
201
+ 360,
202
+ function(){
203
+ $( '#mapi-open-selector,.advads-adsense-show-code' ).css( 'display', 'inline' );
204
+ $( '#mapi-wrap' ).css({
205
+ display: 'none',
206
+ height: 'auto',
207
+ });
208
+ }
209
+ );
210
+ }, 80);
211
+
212
+ }
213
+
214
  // On DOM ready
215
  $(function () {
216
  $( document ).on('click', '.advads-adsense-show-code', function(e){
217
  e.preventDefault();
218
  $( '.advads-adsense-code' ).show();
219
+ $( '#mapi-open-selector' ).css( 'display', 'inline' );
220
+ $( '#mapi-wrap' ).css( 'display', 'none' );
221
  $( this ).hide();
222
  })
223
+
224
  $( document ).on('click', '.advads-adsense-submit-code', function(ev){
225
  ev.preventDefault();
226
+ parseCodeBtnClicked = true;
227
  var rawContent = $( '.advads-adsense-content' ).val();
228
 
229
  var parseResult = parseAdContent( rawContent );
230
  handleParseResult( parseResult );
231
  });
232
+
233
+ $( document ).on( 'paramloaded', '#advanced-ads-ad-parameters', function(){
234
+ var content = $( '#advanced-ads-ad-parameters input[name="advanced_ad[content]"]' ).val();
235
+ var parseResult = parseAdContent( content );
236
+ var adType = $( '[name="advanced_ad[type]"]:checked' ).val();
237
+
238
+ if ( 'undefined' != typeof AdsenseMAPI ) {
239
+ if ( 'adsense' != adType ) {
240
+ if ( 'undefined' == typeof window['AdsenseMAPI'] ) {
241
+ delete( window['AdsenseMAPI'] );
242
+ }
243
+ } else {
244
+ if ( 'post-new.php' == gadsenseData.pagenow || ( 'draft' == AdsenseMAPI.adStatus && ! $( '#advads-ad-content-adsense' ).val() ) ) {
245
+ advancedAdSenseHidden = true;
246
+ $( '#mapi-wrap' ).siblings( 'label,div,hr,span.label' ).css( 'display', 'none' );
247
+ $( '#mapi-open-selector a' ).trigger( 'click' );
248
+ if ( '' == $( '#mapi-adunit-select' ).val() && 1 == $( '#mapi-adunit-select option' ).length ) {
249
+ $( '#mapi-get-adunits' ).trigger( 'click' );
250
+ }
251
+ }
252
+ }
253
+ }
254
+ handleParseResult( parseResult );
255
+ } );
256
+
257
+ $( document ).on( 'change', '#mapi-adunit-select', function(){
258
+
259
+ canUpdateDetails();
260
+ var unit = $( this ).val();
261
+ if ( 'undefined' != typeof AdsenseMAPI.codes[unit] ) {
262
+ getSavedDetails();
263
+ } else {
264
+ getRemoteCode();
265
+ }
266
+
267
+ // display ad slot and ad type for newly created AdSense ad
268
+ if ( advancedAdSenseHidden ) {
269
+ $( '#unit-type-block' ).add( $( '#unit-type-block' ).next() ).add( $( '#unit-type-block' ).next().next() ).css( 'display', 'block' );
270
+ var codeBlock = $( '#unit-code' ).parent();
271
+ codeBlock.add( codeBlock.prev() ).add( codeBlock.next() ).css( 'display', 'block' );
272
+ }
273
+
274
+ } );
275
+
276
+ $( document ).on( 'mapi-selector-loaded', function(){
277
+ canUpdateDetails();
278
+ } );
279
+
280
  $( document ).on('change', '#unit-type, #unit-code', function (ev) {
281
+ if ( 'unit-code' == $( this ).attr( 'id' ) ) {
282
+ var val = $( this ).val();
283
+ if ( -1 != val.indexOf( gadsenseData.pubId.substr( 4 ) ) ) {
284
+ $( '#advads-pubid-in-slot' ).css( 'display', 'block' );
285
+ $( this ).css( 'background-color', 'rgba(255, 235, 59, 0.33)' );
286
+ } else {
287
+ $( '#unit-code' ).css( 'background-color', '#fff' );
288
+ $( '#advads-pubid-in-slot' ).css( 'display', 'none' );
289
+ }
290
+ } else {
291
+ $( '#unit-code' ).css( 'background-color', '#fff' );
292
+ $( '#advads-pubid-in-slot' ).css( 'display', 'none' );
293
+ }
294
  advads_update_adsense_type();
295
  });
296
 
297
+ function getRemoteCode() {
298
+
299
+ var unit = $( '#mapi-adunit-select' ).val();
300
+
301
+ if ( '' == unit ) return;
302
+
303
+ $( '#mapi-loading-overlay' ).css( 'display', 'block' );
304
+
305
+ $.ajax({
306
+ type: 'post',
307
+ url: ajaxurl,
308
+ data: {
309
+ nonce: AdsenseMAPI.nonce,
310
+ action: 'advads_mapi_get_adCode',
311
+ unit: unit,
312
+ },
313
+ success: function(response,status,XHR){
314
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
315
+ if ( 'undefined' != typeof response.code ) {
316
+ $( '#remote-ad-code-msg' ).empty();
317
+ AdsenseMAPI.codes[unit] = response.code;
318
+ var parsed = parseAdContent( response.code );
319
+ if ( false !== parsed ) {
320
+ undoReadOnly();
321
+ setDetailsFromAdCode( parsed );
322
+ makeReadOnly();
323
+ $( '#remote-ad-code-error' ).css( 'display', 'none' );
324
+ $( '#remote-ad-unsupported-ad-type' ).css( 'display', 'none' );
325
+ } else {
326
+ $( '#remote-ad-code-error' ).css( 'display', 'block' );
327
+ }
328
+
329
+ // Update quota message if needed
330
+ if ( 1 == 0 ) {
331
+ $( '#mapi-quota-message' ).text( response.quotaMsg );
332
+ AdsenseMAPI.quota = response.quota;
333
+ if ( 0 == response.quota ) {
334
+ $( '#mapi-get-adcode,#mapi-get-adunits' ).prop( 'disabled', true );
335
+ }
336
+ }
337
+
338
+ closeAdSelector();
339
+
340
+ } else {
341
+ if ( 'undefined' != typeof response.raw ) {
342
+ $( '#remote-ad-code-msg' ).text( response.raw );
343
+ } else if( 'undefined' != typeof response.msg ) {
344
+ if ( 'doesNotSupportAdUnitType' == response.msg ) {
345
+ $( '#remote-ad-unsupported-ad-type' ).css( 'display', 'block' );
346
+ } else {
347
+ $( '#remote-ad-code-msg' ).text( response.msg );
348
+ }
349
+ }
350
+ }
351
+ },
352
+ error: function(request,status,err){
353
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
354
+
355
+ },
356
+ });
357
+
358
+ }
359
+
360
+ function getSavedDetails() {
361
+ var unit = $( '#mapi-adunit-select' ).val();
362
+ if ( 'undefined' != typeof AdsenseMAPI.codes[unit] ) {
363
+ var code = AdsenseMAPI.codes[unit];
364
+ var parsed = parseAdContent( code );
365
+ if ( false !== parsed ) {
366
+ undoReadOnly();
367
+ setDetailsFromAdCode( parsed );
368
+ makeReadOnly();
369
+ $( '#remote-ad-code-error' ).css( 'display', 'none' );
370
+ $( '#remote-ad-unsupported-ad-type' ).css( 'display', 'none' );
371
+ closeAdSelector();
372
+ } else {
373
+ $( '#remote-ad-code-error' ).css( 'display', 'block' );
374
+ }
375
+ }
376
+ }
377
+
378
  /**
379
  * Parse ad content.
380
  *
385
  var theAd = {};
386
  var theContent = $( '<div />' ).html( rawContent );
387
  var adByGoogle = theContent.find( 'ins' );
388
+ theAd.slotId = adByGoogle.attr( 'data-ad-slot' ) || '';
389
  if ('undefined' != typeof(adByGoogle.attr( 'data-ad-client' ))) {
390
  theAd.pubId = adByGoogle.attr( 'data-ad-client' ).substr( 3 );
391
  }
392
+
393
  if (undefined !== theAd.slotId && '' != theAd.pubId) {
394
  theAd.display = adByGoogle.css( 'display' );
395
  theAd.format = adByGoogle.attr( 'data-ad-format' );
396
  theAd.layout = adByGoogle.attr( 'data-ad-layout' ); // for InFeed and InArticle
397
  theAd.layout_key = adByGoogle.attr( 'data-ad-layout-key' ); // for InFeed
398
+ theAd.style = adByGoogle.attr( 'style' ) || '';
399
 
400
  /* normal ad */
401
  if ('undefined' == typeof(theAd.format) && -1 != theAd.style.indexOf( 'width' )) {
441
  }
442
  }
443
  }
444
+
445
+ /**
446
+ * Synchronous code
447
+ */
448
+ if ( -1 != rawContent.indexOf( 'google_ad_slot' ) ) {
449
+ var _client = rawContent.match( /google_ad_client ?= ?["']([^'"]+)/ );
450
+ var _slot = rawContent.match( /google_ad_slot ?= ?["']([^'"]+)/ );
451
+ var _format = rawContent.match( /google_ad_format ?= ?["']([^'"]+)/ );
452
+ var _width = rawContent.match( /google_ad_width ?= ?([\d]+)/ );
453
+ var _height = rawContent.match( /google_ad_height ?= ?([\d]+)/ );
454
+
455
+ theAd = {};
456
+
457
+ theAd.pubId = _client[1].substr( 3 );
458
+
459
+ if ( null !== _slot ) {
460
+ theAd.slotId = _slot[1];
461
+ }
462
+ if ( null !== _format ) {
463
+ theAd.format = _format[1];
464
+ }
465
+ if ( null !== _width ) {
466
+ theAd.width = parseInt( _width[1] );
467
+ }
468
+ if ( null !== _height ) {
469
+ theAd.height = parseInt( _height[1] );
470
+ }
471
+
472
+ if ( 'undefined' == typeof theAd.format ) {
473
+ theAd.type = 'normal';
474
+ }
475
+
476
+ }
477
+
478
+ if ( '' == theAd.slotId && gadsenseData.pubId && '' != gadsenseData.pubId ) {
479
+ theAd.type = $( '#unit-type' ).val();
480
+ }
481
+
482
  /* Page-Level ad */
483
  if ( rawContent.indexOf( 'enable_page_level_ads' ) !== -1 ) {
484
  theAd = { 'parse_message': 'pageLevelAd' };
506
  break;
507
  case 'unknownAd' :
508
  // Not recognized ad code
509
+ if ( parseCodeBtnClicked && 'post-new.php' == gadsenseData.pagenow ) {
510
+ // do not show if just afer switching to AdSense ad type on ad creation
511
+ $( '#pastecode-msg' ).append( $( '<p />' ).css( 'color', 'red' ).html( gadsenseData.msg.unknownAd ) );
512
+ }
513
  break;
514
  default:
515
  setDetailsFromAdCode( parseResult );
516
+ if ( 'undefined' != typeof AdsenseMAPI && parseResult.pubId == AdsenseMAPI.pubId ) {
517
+ var content = $( '#advanced-ads-ad-parameters input[name="advanced_ad[content]"]' ).val();
518
+ MapiSaveAdCode( content, parseResult.slotId );
519
+ makeReadOnly();
520
+ }
521
  $( '.advads-adsense-code' ).hide();
522
  $( '.advads-adsense-show-code' ).show();
523
  }
527
  * Set ad parameters fields from the result of parsing ad code
528
  */
529
  function setDetailsFromAdCode(theAd) {
530
+ undoReadOnly();
531
  $( '#unit-code' ).val( theAd.slotId );
532
  $( '#advads-adsense-pub-id' ).val( theAd.pubId );
533
  if ('normal' == theAd.type) {
571
  $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
572
  }
573
  var storedPubId = gadsenseData.pubId;
574
+ if ( '' !== storedPubId && theAd.pubId != storedPubId && '' != theAd.slotId ) {
575
  $( '#adsense-ad-param-error' ).text( gadsenseData.msg.pubIdMismatch );
576
  } else {
577
  $( '#adsense-ad-param-error' ).empty();
586
  */
587
  window.gadsenseFormatAdContent = function () {
588
  var slotId = $( '#ad-parameters-box #unit-code' ).val();
 
589
  var unitType = $( '#ad-parameters-box #unit-type' ).val();
590
  var adContent = {
591
  slotId: slotId,
610
  delete( window.gadsenseAdContent );
611
  }
612
  $( '#advads-ad-content-adsense' ).val( JSON.stringify( adContent, false, 2 ) );
613
+
614
  }
615
 
616
+ $( document ).on( 'click', '#mapi-get-adcode', function(){
617
+ getRemoteCode();
618
+ } );
619
+
620
+ $( document ).on( 'click', '#mapi-get-adunits', function(){
621
+ $( '#mapi-loading-overlay' ).css( 'display', 'block' );
622
+
623
+ $.ajax({
624
+ type: 'post',
625
+ url: ajaxurl,
626
+ data: {
627
+ nonce: AdsenseMAPI.nonce,
628
+ action: 'advads_gadsense_mapi_get_adUnits',
629
+ account: AdsenseMAPI.pubId,
630
+ },
631
+ success: function(response,status,XHR){
632
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
633
+ if ( response.html ) {
634
+ $( '#mapi-adunit-select' ).replaceWith( $( response.html ) );
635
+ canUpdateDetails();
636
+ }
637
+ },
638
+ error: function(request,status,err){
639
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
640
+ },
641
+ });
642
+
643
+ } );
644
+
645
+ $( document ).on( 'click', '#mapi-open-selector a', function(){
646
+ $( '.advads-adsense-show-code' ).css( 'display', 'inline' );
647
+ $( '#mapi-open-selector' ).css( 'display', 'none' );
648
+ $( '.advads-adsense-code' ).css( 'display', 'none' );
649
+ var pubId = gadsenseData.pubId || false;
650
+ var slotId = $( '#unit-code' ).val().trim();
651
+ if ( pubId && slotId ) {
652
+ if ( $( '#mapi-adunit-select option[value="ca-' + pubId + ':' + slotId + '"]' ).length ) {
653
+ $( '#mapi-adunit-select' ).val( 'ca-' + pubId + ':' + slotId );
654
+ }
655
+ }
656
+ $( '#mapi-wrap' ).css( 'display', 'block' );
657
+ });
658
+
659
+ $( document ).on( 'click', '#mapi-close-selector', function(){
660
+ $( '#mapi-open-selector,.advads-adsense-show-code' ).css( 'display', 'inline' );
661
+ $( '#mapi-wrap' ).css( 'display', 'none' );
662
+ $( '#mapi-adclient-select' ).val( 'none' ).trigger( 'change' );
663
+ } );
664
+
665
  function advads_update_adsense_type(){
666
  var type = $( '#unit-type' ).val();
667
  $( '.advads-adsense-layout' ).hide();
669
  $( '.advads-adsense-layout-key' ).hide();
670
  $( '.advads-adsense-layout-key' ).next('div').hide();
671
  $( '.advads-ad-notice-in-feed-add-on' ).hide();
672
+ $( '.clearfix-before' ).toggle ( type === 'responsive' );
673
  if ( 'responsive' == type || 'link-responsive' == type || 'matched-content' == type ) {
674
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
675
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
703
  } else {
704
  $('#ad-parameters-box-notices .advads-ad-notice-responsive-position').hide();
705
  }
706
+
707
  }
708
+
709
  advads_update_adsense_type();
710
+
711
+ if ( 'undefined' != typeof AdsenseMAPI ) {
712
+ MapiMayBeSaveAdCode();
713
+ canUpdateDetails();
714
+ }
715
+
716
+ }); // DOM ready
717
 
718
  /**
719
  * Show a message depending on whether Auto ads are enabled.
modules/gadsense/admin/views/adsense-account.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $MAPI = Advanced_Ads_AdSense_MAPI::get_instance();
3
+ $options = $this->data->get_options();
4
+ $adsense_id = $this->data->get_adsense_id();
5
+ $nonce = wp_create_nonce( 'advads-mapi' );
6
+ $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
7
+
8
+ $CID = Advanced_Ads_AdSense_MAPI::CID;
9
+
10
+ $use_user_app = Advanced_Ads_AdSense_MAPI::use_user_app();
11
+ if ( $use_user_app ) {
12
+ $CID = ADVANCED_ADS_MAPI_CID;
13
+ }
14
+
15
+ $auth_url = 'https://accounts.google.com/o/oauth2/v2/auth?scope=' .
16
+ urlencode( 'https://www.googleapis.com/auth/adsense.readonly' ) .
17
+ '&client_id=' . $CID .
18
+ '&redirect_uri=' . urlencode( 'urn:ietf:wg:oauth:2.0:oob' ) .
19
+ '&access_type=offline&include_granted_scopes=true&prompt=select_account&response_type=code';
20
+
21
+ $can_connect = true;
22
+
23
+ if ( $use_user_app && !( ( defined( 'ADVANCED_ADS_MAPI_CID' ) && '' != ADVANCED_ADS_MAPI_CID ) && ( defined( 'ADVANCED_ADS_MAPI_CIS' ) && '' != ADVANCED_ADS_MAPI_CIS ) ) ) {
24
+ $can_connect = false;
25
+ }
26
+
27
+ $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
28
+
29
+ ?>
30
+ <div id="full-adsense-settings-div" <?php if ( empty( $adsense_id ) ) echo 'style="display:none"' ?>>
31
+ <input type="text" <?php if ( $has_token ) echo 'readonly' ?> name="<?php echo GADSENSE_OPT_NAME; ?>[adsense-id]" style="margin-right:.8em" id="adsense-id" size="32" value="<?php echo $adsense_id; ?>" />
32
+ <?php if ( !empty( $adsense_id ) && !$has_token ) : ?>
33
+ <a id="connect-adsense" class="button-primary preventDefault" <?php if ( !$can_connect ) echo 'disabled'; ?>><?php _e( 'Connect to AdSense', 'advanced-ads' ) ?></a>
34
+ <?php endif; ?>
35
+ <?php if ( $has_token ) : ?>
36
+ <a id="revoke-token" class="button-secondary preventDefault"><?php _e( 'Revoke API acccess', 'advanced-ads' ) ?></a>
37
+ <div id="gadsense-freeze-all" style="position:fixed;top:0;bottom:0;right:0;left:0;background-color:rgba(255,255,255,.5);text-align:center;display:none;">
38
+ <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:40vh" />
39
+ </div>
40
+ <?php endif; ?>
41
+ <p class="description"><?php _e( 'Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>', 'advanced-ads' ) ?></p>
42
+ </div>
43
+ <?php if ( empty( $adsense_id ) ) : ?>
44
+ <div id="auto-adsense-settings-div" <?php if ( !empty( $adsense_id ) ) echo 'style="display:none;"' ?>>
45
+ <div class="widget-col">
46
+ <h3><?php _e( 'Yes, I have an AdSense account', 'advanced-ads' ) ?></h3>
47
+ <a id="connect-adsense" class="button-primary preventDefault"><?php _e( 'Connect to AdSense', 'advanced-ads' ) ?></a>
48
+ <a id="adsense-manual-config" class="button-secondary preventDefault"><?php _e( 'Configure everything manually', 'advanced-ads' ) ?></a>
49
+ </div>
50
+ <div class="widget-col">
51
+ <h3><?php _e( "No, I still don't have an AdSense account", 'advanced-ads' ) ?></h3>
52
+ <a class="button button-secondary" target="_blank" href="<?php echo self::ADSENSE_NEW_ACCOUNT_LINK; ?>"><?php _e( 'Get a free AdSense account', 'advanced-ads' ); ?></a>
53
+ </div>
54
+ </div>
55
+ <style type="text/css">
56
+ #adsense table h3 {
57
+ margin-top: 0;
58
+ margin-bottom: .2em;
59
+ }
60
+ #adsense table button {
61
+ margin-bottom: .8em;
62
+ }
63
+ #adsense .form-table tr {
64
+ display: none;
65
+ }
66
+ #adsense .form-table tr:first-of-type {
67
+ display: table-row;
68
+ }
69
+ #auto-adsense-settings-div .widget-col {
70
+ float: left;
71
+ margin: 0px 5px 5px 0px;
72
+ }
73
+ #auto-adsense-settings-div:after {
74
+ display: block;
75
+ content: "";
76
+ clear: left;
77
+ }
78
+ #auto-adsense-settings-div .widget-col:first-child {
79
+ margin-right: 20px;
80
+ border-right: 1px solid #cccccc;
81
+ padding: 0px 20px 0px 0px;
82
+ position: relative;
83
+ }
84
+ #auto-adsense-settings-div .widget-col:first-child:after {
85
+ position: absolute;
86
+ content: "or";
87
+ display: block;
88
+ top: 20px;
89
+ right: -10px;
90
+ background: #ffffff;
91
+ color: #cccccc;
92
+ font-size: 20px;
93
+ }
94
+ @media screen and (max-width: 1199px) {
95
+ #auto-adsense-settings-div .widget-col { float: none; margin-right: 0; }
96
+ #auto-adsense-settings-div .widget-col:first-child { margin: 0px 0px 20px 0px; padding: 0px 0px 20px 0px; border-bottom: 1px solid #cccccc; border-right: 0; }
97
+ #auto-adsense-settings-div .widget-col:first-child:after { top: auto; right: auto; bottom: -10px; left: 20px; display: inline-block; padding: 0px 5px 0px 5px; }
98
+ }
99
+ </style>
100
+ <?php else : ?>
101
+ <p><?php printf(__( 'Problems with AdSense? Check out the <a href="%s" target="_blank">manual</a> and get a free setup check.', 'advanced-ads' ), ADVADS_URL . 'manual/adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-manual-check' ); ?></p>
102
+ <?php endif; ?>
103
+ <script type="text/javascript">
104
+ var AdsenseMAPI = {
105
+ nonce: '<?php echo $nonce ?>',
106
+ oAuth2: '<?php echo $auth_url ?>',
107
+ };
108
+ </script>
109
+ <div id="gadsense-modal">
110
+ <div id="gadsense-modal-outer">
111
+ <div id="gadsense-modal-inner">
112
+ <div id="gadsense-modal-content">
113
+ <div id="gadsense-modal-content-inner">
114
+ <i class="dashicons dashicons-dismiss"></i>
115
+ <label style="font-size:1.1em;font-weight:600;margin-bottom:.3em;display:block;"><?php _e( 'Please enter the confirmation code.', 'advanced-ads' ) ?></label>
116
+ <input type="text" class="widefat preventDefault" id="mapi-code" value="" />
117
+ <p><label><input type="checkbox" value="1" id="mapi-autoads"<?php echo ( $options['page-level-enabled'] ) ? ' checked="checked"' : ''; ?> />&nbsp;<?php _e( 'Insert the AdSense header code used for verification and the Auto Ads feature.', 'advanced-ads' ) ?></label></p>
118
+ <p class="submit">
119
+ <button id="mapi-confirm-code" class="button-primary preventDefault"><?php _e( 'Submit code', 'advanced-ads' ) ?></button>
120
+ </p>
121
+ <div id="gadsense-overlay">
122
+ <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:3em" />
123
+ </div>
124
+ </div>
125
+ </div>
126
+ </div>
127
+ </div>
128
+ </div>
129
+ <style type="text/css">
130
+ #gadsense-overlay {
131
+ display:none;
132
+ background-color:rgba(255,255,255,.5);
133
+ position:absolute;
134
+ width: 100%;
135
+ height: 100%;
136
+ top: 0;
137
+ left: 0;
138
+ text-align:center;
139
+ }
140
+ #gadsense-modal {
141
+ display: none;
142
+ background-color: rgba(0,0,0,.5);
143
+ position:fixed;
144
+ top:0;
145
+ left:0;
146
+ right:0;
147
+ bottom:0;
148
+ }
149
+ #gadsense-modal-outer {
150
+ position: relative;
151
+ width: 60%;
152
+ height: 100%;
153
+ margin-left: 20%;
154
+ }
155
+ #gadsense-modal-inner {
156
+ display: table;
157
+ width: 100%;
158
+ height: 100%;
159
+ }
160
+ #gadsense-modal-content {
161
+ display: table-cell;
162
+ vertical-align: middle;
163
+ }
164
+ #gadsense-modal-content-inner {
165
+ padding: 1em;
166
+ background-color: #f0f0f0;
167
+ position: relative;
168
+ border: 3px solid #808b94;
169
+ }
170
+ #gadsense-modal-content-inner .dashicons-dismiss {
171
+ background-color: #fff;
172
+ border-radius: 100%;
173
+ cursor: pointer;
174
+ top: -.5em;
175
+ right: -.5em;
176
+ position: absolute;
177
+ z-index: 2;
178
+ }
179
+ </style>
modules/gadsense/admin/views/adsense-ad-parameters.php CHANGED
@@ -10,28 +10,64 @@ if ( $is_responsive || $is_link_responsive_unit || $is_matched_content ) {
10
  echo '<style type="text/css"> #advanced-ads-ad-parameters-size {display: none;} </style>';
11
  }
12
 
 
 
 
13
  $use_paste_code = true;
14
  $use_paste_code = apply_filters( 'advanced-ads-gadsense-use-pastecode', $use_paste_code );
15
 
16
  $db = Advanced_Ads_AdSense_Data::get_instance();
 
17
  $sizing_array = $db->get_responsive_sizing();
18
 
 
 
 
 
 
 
 
 
 
19
  ?>
 
 
 
 
 
 
 
 
 
 
 
20
  <input type="hidden" id="advads-ad-content-adsense" name="advanced_ad[content]" value="<?php echo esc_attr( $json_content ); ?>" />
21
  <input type="hidden" name="unit_id" id="unit_id" value="<?php echo esc_attr( $unit_id ); ?>" />
22
  <?php if( empty( $pub_id ) ) :
23
- ?><p><a class="button button-primary" target="_blank" href="<?php echo Advanced_Ads_AdSense_Admin::ADSENSE_NEW_ACCOUNT_LINK; ?>"><?php _e( 'Get a free AdSense account', 'advanced-ads' );
24
  ?></a></p><?php
25
  endif;
26
  if ( $use_paste_code ) : ?>
27
- <div class="advads-adsense-code" <?php if( !empty( $unit_code ) ): echo 'style="display: none;"'; endif; ?>>
28
  <p class="description"><?php _e( 'Copy the ad code from your AdSense account, paste it into the area below and click on <em>Get details</em>.', 'advanced-ads' ); ?></p>
29
  <textarea rows="10" cols="40" class="advads-adsense-content"></textarea>
30
  <button class="button button-primary advads-adsense-submit-code"><?php _e( 'Get details', 'advanced-ads' ); ?></button>&nbsp;&nbsp;
 
 
 
31
  <div id="pastecode-msg"></div>
32
  </div>
33
- <p class="advads-adsense-show-code" <?php if( empty( $unit_code ) ) : echo 'style="display: none;"'; endif; ?>>
34
- <a href="#"><?php _e( 'Insert new AdSense code', 'advanced-ads' ); ?></a>
 
 
 
 
 
 
 
 
 
35
  </p>
36
  <?php endif; ?>
37
  <p id="adsense-ad-param-error"></p>
@@ -43,6 +79,9 @@ if ( $use_paste_code ) : ?>
43
  <?php if( $pub_id ) : ?>
44
  <?php printf(__( 'Publisher ID: %s', 'advanced-ads' ), $pub_id ); ?>
45
  <?php endif; ?>
 
 
 
46
  </div>
47
  <hr/>
48
  <?php
@@ -87,4 +126,10 @@ if( $pub_id_errors ) : ?>
87
  <input name="ad-layout-key" id="ad-layout-key" value="<?php echo isset( $layout_key ) ? $layout_key : ''; ?>"/>
88
  </div>
89
  <hr/>
90
- <?php do_action( 'advanced-ads-gadsense-extra-ad-param', $extra_params, $content, $ad );
 
 
 
 
 
 
10
  echo '<style type="text/css"> #advanced-ads-ad-parameters-size {display: none;} </style>';
11
  }
12
 
13
+ $MAPI = Advanced_Ads_AdSense_MAPI::get_instance();
14
+ $use_user_app = Advanced_Ads_AdSense_MAPI::use_user_app();
15
+
16
  $use_paste_code = true;
17
  $use_paste_code = apply_filters( 'advanced-ads-gadsense-use-pastecode', $use_paste_code );
18
 
19
  $db = Advanced_Ads_AdSense_Data::get_instance();
20
+ $adsense_id = $db->get_adsense_id();
21
  $sizing_array = $db->get_responsive_sizing();
22
 
23
+ $gadsense_options = $db->get_options();
24
+ $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
25
+ $mapi_nonce = wp_create_nonce( 'advads-mapi' );
26
+ $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
27
+ $quota = $MAPI->get_quota();
28
+
29
+ $mapi_ad_codes = $mapi_options['ad_codes'];
30
+ $mapi_ad_codes['length'] = count( $mapi_ad_codes );
31
+
32
  ?>
33
+ <?php if ( $has_token ) : ?>
34
+ <script type="text/javascript">
35
+ var AdsenseMAPI = {
36
+ nonce: '<?php echo $mapi_nonce ?>',
37
+ codes: <?php echo json_encode( $mapi_ad_codes ) ?>,
38
+ quota: <?php echo json_encode( $quota ) ?>,
39
+ pubId: '<?php echo $pub_id ?>',
40
+ adStatus: '<?php echo $ad->status ?>',
41
+ };
42
+ </script>
43
+ <?php endif; ?>
44
  <input type="hidden" id="advads-ad-content-adsense" name="advanced_ad[content]" value="<?php echo esc_attr( $json_content ); ?>" />
45
  <input type="hidden" name="unit_id" id="unit_id" value="<?php echo esc_attr( $unit_id ); ?>" />
46
  <?php if( empty( $pub_id ) ) :
47
+ ?><p><a class="button button-primary" href="<?php echo admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ); ?>"><?php _e( 'Connect to AdSense', 'advanced-ads' );
48
  ?></a></p><?php
49
  endif;
50
  if ( $use_paste_code ) : ?>
51
+ <div class="advads-adsense-code" style="display: none;">
52
  <p class="description"><?php _e( 'Copy the ad code from your AdSense account, paste it into the area below and click on <em>Get details</em>.', 'advanced-ads' ); ?></p>
53
  <textarea rows="10" cols="40" class="advads-adsense-content"></textarea>
54
  <button class="button button-primary advads-adsense-submit-code"><?php _e( 'Get details', 'advanced-ads' ); ?></button>&nbsp;&nbsp;
55
+ <?php if ( !$has_token ) : ?>
56
+ <a style="vertical-align:sub;font-weight:600;font-style:italic;" href="<?php echo admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ?>"><?php _e( 'connect to your AdSense account', 'advanced-ads' ) ?></a>
57
+ <?php endif; ?>
58
  <div id="pastecode-msg"></div>
59
  </div>
60
+ <?php if ( $has_token ) require_once GADSENSE_BASE_PATH . 'admin/views/mapi-ad-selector.php'; ?>
61
+
62
+ <p>
63
+ <span class="advads-adsense-show-code">
64
+ <a href="#"><?php _e( 'Insert new AdSense code', 'advanced-ads' ); ?></a>
65
+ </span>
66
+ <?php if ( $has_token ) : ?>
67
+ <span id="mapi-open-selector">
68
+ <?php _e( 'or', 'advanced-ads' ); ?><a href="#" class="prevent-default"><?php _e( 'Get ad code from your linked account', 'advanced-ads' ); ?></a>
69
+ </span>
70
+ <?php endif; ?>
71
  </p>
72
  <?php endif; ?>
73
  <p id="adsense-ad-param-error"></p>
79
  <?php if( $pub_id ) : ?>
80
  <?php printf(__( 'Publisher ID: %s', 'advanced-ads' ), $pub_id ); ?>
81
  <?php endif; ?>
82
+ <p id="advads-pubid-in-slot" class="advads-error-message description"
83
+ <?php echo ! ( 0 === strpos( $pub_id, 'pub-' ) && false !== strpos( $unit_code, substr( $pub_id, 4 ) ) ) ? 'style="display:none"' : ''; ?>
84
+ ><?php _e( 'The ad slot ID is either a number or empty and not the same as the publisher ID.', 'advanced-ads' ) ?></p>
85
  </div>
86
  <hr/>
87
  <?php
126
  <input name="ad-layout-key" id="ad-layout-key" value="<?php echo isset( $layout_key ) ? $layout_key : ''; ?>"/>
127
  </div>
128
  <hr/>
129
+ <label class="label clearfix-before" <?php if ( ! $is_responsive ) { echo 'style="display: none;"'; } ?>><?php _e( 'Clearfix', 'advanced-ads' ); ?></label>
130
+ <div class="clearfix-before" <?php if ( ! $is_responsive ) { echo 'style="display: none;"'; } ?>>
131
+ <label><input type="checkbox" name="advanced_ad[output][clearfix_before]" value="1" <?php checked( ! empty( $options['output']['clearfix_before'] ), true ); ?> /><?php
132
+ _e( 'Enable this box if responsive ads cover something on your site', 'advanced-ads' ); ?></label>
133
+ </div>
134
+ <hr class="clearfix-before" <?php if ( ! $is_responsive ) { echo 'style="display: none;"'; } ?> />
135
+ <?php do_action( 'advanced-ads-gadsense-extra-ad-param', $extra_params, $content, $ad );
modules/gadsense/admin/views/mapi-ad-selector.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $G_Data = Advanced_Ads_AdSense_Data::get_instance();
3
+ $adsense_id = $G_Data->get_adsense_id();
4
+ $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
5
+ $MAPI = Advanced_Ads_AdSense_MAPI::get_instance();
6
+ $use_user_app = Advanced_Ads_AdSense_MAPI::use_user_app();
7
+ $quota = $MAPI->get_quota();
8
+ $can_connect = $use_user_app || 0 < $quota['count'];
9
+ $can_connect = true;
10
+ $ad_units = $mapi_options['accounts'][$adsense_id]['ad_units'];
11
+ ?>
12
+ <div id="mapi-wrap">
13
+ <button type="button" id="mapi-close-selector" class="notice-dismiss"></button>
14
+ <div id="mapi-wrap-inner">
15
+ <label class="label"><?php _e( 'AdSense Ad Unit', 'advanced-ads' ); ?><i id="mapi-get-adunits" class="dashicons dashicons-update" style="cursor:pointer;margin-left:.3em;color:#008ec2;" title="<?php echo esc_attr( __( 'Update ad units list', 'advanced-ads' ) ); ?>"></i></label>
16
+ <div>
17
+ <select id="mapi-adunit-select">
18
+ <?php if ( empty( $ad_units ) ) : ?>
19
+
20
+ <option value=""><?php _e( 'No ad unit found', 'advanced-ads' ); ?></option>
21
+
22
+ <?php else : $sorted_adunits = Advanced_Ads_AdSense_MAPI::get_sorted_adunits( $ad_units ); ?>
23
+
24
+ <option value=""><?php _e( '--select ad--', 'advanced-ads' ) ?></option>
25
+ <?php foreach ( $sorted_adunits as $key => $value ) : ?>
26
+ <option value="<?php echo esc_attr( $key ); ?>"><?php echo $value; ?></option>
27
+ <?php endforeach; ?>
28
+
29
+ <?php endif; ?>
30
+ </select>
31
+
32
+ <button class="button-secondary prevent-default" disabled <?php if ( !$can_connect ) echo 'disabled="disabled"' ?> id="mapi-get-adcode"><?php _e( 'Update Details', 'advanced-ads' ); ?></button>
33
+ </div>
34
+
35
+ <p class="advads-error-message" id="remote-ad-code-error" style="display:none;"><strong><?php _e( 'Unrecognized ad code', 'advanced-ads' ); ?></strong></p>
36
+ <p class="advads-error-message" id="remote-ad-code-msg"></p>
37
+ <div style="display:none;" id="remote-ad-unsupported-ad-type"><p><i class="dashicons dashicons-warning"></i><b class="advads-error-message"><?php
38
+ _e( 'This ad type can currently not be imported from AdSense.', 'advanced-ads' ) ?></b>&nbsp;<a href="<?php echo ADVADS_URL . 'adsense-ad-type-not-available/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-type-not-available'; ?>" target="_blank"><?php
39
+ _e( 'Learn more and help us to enable it here.', 'advanced-ads' ) ?></a></p>
40
+ <?php _e( 'In the meantime, you can use AdSense with one of these methods:', 'advanced-ads' ) ?>
41
+ <ul>
42
+ <li><?php _e( 'Click on <em>Insert new AdSense code</em> and copy the code from your AdSense account into it.', 'advanced-ads' ) ?></li>
43
+ <li><?php _e( 'Create an ad on the fly. Just select the <em>Normal</em> or <em>Responsive</em> type and the size.', 'advanced-ads' ) ?></li>
44
+ <li><?php _e( 'Choose a <em>Normal</em>, <em>Responsive</em> or <em>Link Unit</em> ad from your AdSense account.', 'advanced-ads' ) ?></li>
45
+ </ul>
46
+ </div>
47
+ <p id="mapi-quota-message"></p>
48
+
49
+ </div>
50
+ </div>
51
+
52
+ <div id="mapi-loading-overlay" style="position:absolute;background-color:rgba(255,255,255,.75);top:0;right:0;bottom:0;left:0;text-align:center;display:none;">
53
+ <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:8em;" />
54
+ </div>
55
+ <script type="text/javascript">jQuery( document ).trigger( 'mapi-selector-loaded' ); </script>
modules/gadsense/config.php CHANGED
@@ -8,6 +8,7 @@ return array(
8
  'classmap' => array(
9
  'Advanced_Ads_Ad_Type_Adsense' => $path . '/includes/class-ad-type-adsense.php',
10
  'Advanced_Ads_AdSense_Data' => $path . '/includes/class-gadsense-data.php',
 
11
  'Advanced_Ads_AdSense_Admin' => $path . '/admin/admin.php',
12
  'Advanced_Ads_AdSense_Public' => $path . '/public/public.php',
13
  ),
8
  'classmap' => array(
9
  'Advanced_Ads_Ad_Type_Adsense' => $path . '/includes/class-ad-type-adsense.php',
10
  'Advanced_Ads_AdSense_Data' => $path . '/includes/class-gadsense-data.php',
11
+ 'Advanced_Ads_AdSense_MAPI' => $path . '/includes/class-mapi.php',
12
  'Advanced_Ads_AdSense_Admin' => $path . '/admin/admin.php',
13
  'Advanced_Ads_AdSense_Public' => $path . '/public/public.php',
14
  ),
modules/gadsense/includes/class-ad-type-adsense.php CHANGED
@@ -7,7 +7,7 @@
7
  * @author Thomas Maier <thomas.maier@webgilde.com>
8
  * @license GPL-2.0+
9
  * @link http://webgilde.com
10
- * @copyright 2015 Thomas Maier, webgilde GmbH
11
  *
12
  * Class containing information about the adsense ad type
13
  *
@@ -50,6 +50,8 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
50
  * @since 1.4
51
  */
52
  public function render_parameters($ad) {
 
 
53
  $content = (string) ( isset( $ad->content ) ? $ad->content : '' );
54
  $unit_id = '';
55
  $unit_code = '';
7
  * @author Thomas Maier <thomas.maier@webgilde.com>
8
  * @license GPL-2.0+
9
  * @link http://webgilde.com
10
+ * @copyright 2013-2018 Thomas Maier, webgilde GmbH
11
  *
12
  * Class containing information about the adsense ad type
13
  *
50
  * @since 1.4
51
  */
52
  public function render_parameters($ad) {
53
+ $options = $ad->options();
54
+
55
  $content = (string) ( isset( $ad->content ) ? $ad->content : '' );
56
  $unit_id = '';
57
  $unit_code = '';
modules/gadsense/includes/class-mapi.php ADDED
@@ -0,0 +1,722 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Advanced_Ads_AdSense_MAPI
3
+ {
4
+ const OPTNAME = 'advanced-ads-adsense-mapi';
5
+
6
+ const CID = '400595147946-alk0j13qk563bg94rd4f3ip2t0b2tr5r.apps.googleusercontent.com';
7
+
8
+ const CS = '5jecyWgvCszB8UxSM0oS1W22';
9
+
10
+ const CALL_PER_24H = 20;
11
+
12
+ private static $instance = null;
13
+
14
+ private static $default_options = array();
15
+
16
+ private static $empty_account_data = array(
17
+ 'default_app' => array(
18
+ 'access_token' => '',
19
+ 'refresh_token' => '',
20
+ 'expires' => 0,
21
+ 'token_type' => '',
22
+ ),
23
+ 'user_app' => array(
24
+ 'access_token' => '',
25
+ 'refresh_token' => '',
26
+ 'expires' => 0,
27
+ 'token_type' => '',
28
+ ),
29
+ 'ad_units' => array(),
30
+ );
31
+
32
+ private function __construct() {
33
+
34
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
35
+
36
+ add_action( 'wp_ajax_advads_gadsense_mapi_confirm_code', array( $this, 'ajax_confirm_code' ) );
37
+ add_action( 'wp_ajax_advads_gadsense_mapi_get_adUnits', array( $this, 'ajax_get_adUnits' ) );
38
+ add_action( 'wp_ajax_advads_mapi_get_adCode', array( $this, 'ajax_get_adCode' ) );
39
+ add_action( 'wp_ajax_advads-mapi-reconstructed-code', array( $this, 'ajax_save_reconstructed_code' ) );
40
+ add_action( 'wp_ajax_advads-mapi-revoke-token', array( $this, 'ajax_revoke_tokken' ) );
41
+
42
+ self::$default_options = array(
43
+ 'accounts' => array(),
44
+ 'ad_codes' => array(),
45
+ 'quota' => array(
46
+ 'count' => self::CALL_PER_24H,
47
+ 'ts' => 0,
48
+ ),
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Get available quota and eventual message about remaining call
54
+ */
55
+ public function get_quota() {
56
+ $options = $this->get_option();
57
+ $now = time();
58
+ if ( self::use_user_app() ) {
59
+ return array( 'count' => PHP_INT_MAX );
60
+ } else {
61
+ if ( $now > $options['quota']['ts'] + ( 24 * 3600 ) ) {
62
+ return array(
63
+ 'count' => self::CALL_PER_24H,
64
+ );
65
+ } else {
66
+ $msg = $this->get_quota_msg();
67
+ return array(
68
+ 'count' => $options['quota']['count'],
69
+ 'msg' => $msg,
70
+ );
71
+ }
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Get the readable quota
77
+ */
78
+ public function get_quota_msg() {
79
+
80
+ $options = $this->get_option();
81
+ $now = time();
82
+ $secs = $options['quota']['ts'] + ( 24 * 3600 ) - $now;
83
+ $hours = floor( $secs / 3600 );
84
+ $mins = ceil( ( $secs - ( $hours * 3600 ) ) / 60 );
85
+
86
+ if ( 60 == $mins ) {
87
+ $hours += 1;
88
+ $mins = 0;
89
+ }
90
+
91
+ if ( 0 == $options['quota']['count'] ) {
92
+
93
+ $msg = sprintf(
94
+ /* commented out so that these unused strings don’t show up for translators; using fixed strings instead in case we forget this when we might add the check again later
95
+ _x( 'No API call left before %1$s %2$s.', 'No call left for the next X hours Y minutes.', 'advanced-ads' ),
96
+ sprintf( _n( '%s hour', '%s hours', $hours, 'advanced-ads' ), $hours ),
97
+ sprintf( _n( '%s minute', '%s minutes', $mins, 'advanced-ads' ), $mins )
98
+ */
99
+ 'No API call left before %1$s %2$s.',
100
+ sprintf( '%s hours', $hours ),
101
+ sprintf( '%s minutes', $mins )
102
+ );
103
+
104
+ if ( 0 == $hours ) {
105
+ /* commented out so that these unused strings don’t show up for translators; using fixed strings instead in case we forget this when we might add the check again later
106
+ $msg = sprintf(
107
+ _x( 'No API call left before %s.', 'No call left for the next X time.', 'advanced-ads' ),
108
+ sprintf( _n( '%s minute', '%s minutes', $mins, 'advanced-ads' ), $mins )
109
+ );
110
+ */
111
+ $msg = 'No API call left before.';
112
+ }
113
+
114
+ if ( 0 == $mins ) {
115
+ /* commented out so that these unused strings don’t show up for translators; using fixed strings instead in case we forget this when we might add the check again later
116
+ $msg = sprintf(
117
+ _x( 'No API call left before %s.', 'No call left for the next X time.', 'advanced-ads' ),
118
+ sprintf( _n( '%s hour', '%s hours', $hours, 'advanced-ads' ), $hours )
119
+ );
120
+ */
121
+ $msg = 'No API call left.';
122
+ }
123
+
124
+ } else {
125
+
126
+ $msg = sprintf(
127
+ /* commented out so that these unused strings don’t show up for translators; using fixed strings instead in case we forget this when we might add the check again later
128
+ _x( '%1$s for the next %2$s %3$s.', 'Calls remaining for the next X hours Y minutes.', 'advanced-ads' ),
129
+ sprintf( _n( '%s API call remaining.', '%s API calls remaining.', $options['quota']['count'], 'advanced-ads' ), $options['quota']['count'] ),
130
+ sprintf( _n( '%s hour', '%s hours', $hours, 'advanced-ads' ), $hours ),
131
+ sprintf( _n( '%s minute', '%s minutes', $mins, 'advanced-ads' ), $mins )
132
+ */
133
+ '%1$s for the next %2$s %3$s',
134
+ sprintf( '%s API calls remaining', $options['quota']['count'] ),
135
+ sprintf( '%s hours', $hours ),
136
+ sprintf( '%s minutes', $mins )
137
+ );
138
+
139
+ if ( 0 == $hours ) {
140
+ /* commented out so that these unused strings don’t show up for translators; using fixed strings instead in case we forget this when we might add the check again later
141
+ $msg = sprintf(
142
+ _x( '%1$s for the next %2$s', 'Calls remaining for the next X time.', 'advanced-ads' ),
143
+ sprintf( _n( '%s API call remaining.', '%s API calls remaining.', $options['quota']['count'], 'advanced-ads' ), $options['quota']['count'] ),
144
+ sprintf( _n( '%s minute', '%s minutes', $mins, 'advanced-ads' ), $mins )
145
+ );
146
+ */
147
+ $msg = sprintf( '%s API calls remaining.', $options['quota']['count'] );
148
+ }
149
+
150
+ if ( 0 == $mins ) {
151
+ /* commented out so that these unused strings don’t show up for translators; using fixed strings instead in case we forget this when we might add the check again later
152
+ $msg = sprintf(
153
+ _x( '%1$s for the next %2$s', 'calls remaining for the next X time', 'advanced-ads' ),
154
+ sprintf( _n( '%s API call remaining', '%s API calls remaining', $options['quota']['count'], 'advanced-ads' ), $options['quota']['count'] ),
155
+ sprintf( _n( '%s hour', '%s hours', $hours, 'advanced-ads' ), $hours )
156
+ );
157
+ */
158
+ $msg = sprintf(
159
+ '%1$s for the next %2$s',
160
+ sprintf( '%s API calls remaining', $options['quota']['count'] ),
161
+ sprintf( '%s hours', $hours )
162
+ );
163
+ }
164
+
165
+ }
166
+ return $msg;
167
+ }
168
+
169
+ /**
170
+ * Decrement quota by 1, and return message about remaining call
171
+ */
172
+ public function decrement_quota() {
173
+ $options = $this->get_option();
174
+ if ( 0 < $options['quota']['count'] ) {
175
+ $options['quota']['count']--;
176
+ $now = time();
177
+ if ( $now > $options['quota']['ts'] + ( 24 * 3600 ) ) {
178
+ $options['quota']['ts'] = $now;
179
+ }
180
+ update_option( self::OPTNAME, $options );
181
+ return $this->get_quota_msg();
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Return the ad code for a given client and unit
187
+ *
188
+ * @return [str]|[arr] the ad code or info on the error.
189
+ */
190
+ public function get_ad_code( $adUnit ) {
191
+ $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
192
+ $adsense_id = $gadsense_data->get_adsense_id();
193
+ $options = self::get_option();
194
+
195
+ $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
196
+ $adsense_id = $gadsense_data->get_adsense_id();
197
+
198
+ $url = 'https://www.googleapis.com/adsense/v1.4/accounts/' . $adsense_id . '/adclients/ca-' . $adsense_id . '/adunits/' . $adUnit . '/adcode';
199
+ $access_token = $this->get_access_token( $adsense_id );
200
+
201
+ if ( !isset( $access_token['msg'] ) ) {
202
+ $headers = array(
203
+ 'Authorization' => 'Bearer ' . $access_token,
204
+ );
205
+ $response = wp_remote_get( $url, array( 'headers' => $headers ) );
206
+ if ( is_wp_error( $response ) ) {
207
+ return array( 'status' => false, 'msg' => 'error while retrieving adUnits list', 'raw' => $response->get_error_message() );
208
+ } else {
209
+ $adCode = json_decode( $response['body'], true );
210
+ if ( null === $adCode || !isset( $adCode['adCode'] ) ) {
211
+ if (
212
+ $adCode['error'] &&
213
+ $adCode['error']['errors'] &&
214
+ isset( $adCode['error']['errors'][0] ) &&
215
+ isset( $adCode['error']['errors'][0]['reason'] ) &&
216
+ 'doesNotSupportAdUnitType' == $adCode['error']['errors'][0]['reason']
217
+ ) {
218
+ return array( 'status' => false, 'msg' => 'doesNotSupportAdUnitType' );
219
+ } else {
220
+ return array( 'status' => false, 'msg' => 'invalid response while retrieving adCode for ' . $adUnit, 'raw' => $response['body'] );
221
+ }
222
+ } else {
223
+ $options['ad_codes'][$adUnit] = $adCode['adCode'];
224
+ update_option( self::OPTNAME, $options );
225
+ return $adCode['adCode'];
226
+ }
227
+ }
228
+ } else {
229
+ // return the original error info
230
+ return $access_token;
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Get/Update ad unit list for a given client
236
+ *
237
+ * @return [bool]|[array] TRUE on success, error info (as array) if an error occurred.
238
+ */
239
+ public function get_ad_units( $account ) {
240
+ $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
241
+ $url = 'https://www.googleapis.com/adsense/v1.4/accounts/' . $account . '/adclients/ca-' . $account . '/adunits?includeInactive=true';
242
+ $access_token = $this->get_access_token( $account );
243
+
244
+ $options = self::get_option();
245
+
246
+ if ( !isset( $access_token['msg'] ) ) {
247
+ $headers = array(
248
+ 'Authorization' => 'Bearer ' . $access_token,
249
+ );
250
+ $response = wp_remote_get( $url, array( 'headers' => $headers ) );
251
+ if ( is_wp_error( $response ) ) {
252
+ return array( 'status' => false, 'msg' => 'error while retrieving adUnits list for "' . $account . '"', 'raw' => $response->get_error_message() );
253
+ } else {
254
+ $adUnits = json_decode( $response['body'], true );
255
+ if ( null === $adUnits || !isset( $adUnits['items'] ) ) {
256
+ return array( 'status' => false, 'msg' => 'invalid response while retrieving adUnits list for "' . $account . '"', 'raw' => $response['body'] );
257
+ } else {
258
+ $new_adUnits = array();
259
+ foreach( $adUnits['items'] as $item ) {
260
+ $new_adUnits[$item['id']] = $item;
261
+ }
262
+ $options['accounts'][$account]['ad_units'] = $new_adUnits;
263
+ update_option( self::OPTNAME, $options );
264
+ return true;
265
+ }
266
+ }
267
+ } else {
268
+ // return the original error info
269
+ return $access_token;
270
+ }
271
+ }
272
+
273
+ /**
274
+ * Get the appropriate access token (default one or from user's Google app). Update it if needed.
275
+ *
276
+ * @return [str]|[array] the token on success, error info (as array) if an error occurred.
277
+ */
278
+ public function get_access_token( $account ) {
279
+ $options = self::get_option();
280
+ if ( self::use_user_app() ) {
281
+ if ( time() > $options['accounts'][$account]['user_app']['expires'] ) {
282
+ $new_tokens = $this->renew_access_token( $account );
283
+ if ( $new_tokens['status'] ) {
284
+ return $new_tokens['access_token'];
285
+ } else {
286
+ // return all error info [arr]
287
+ return $new_tokens;
288
+ }
289
+ } else {
290
+ return $options['accounts'][$account]['user_app']['access_token'];
291
+ }
292
+ } else {
293
+ if ( time() > $options['accounts'][$account]['default_app']['expires'] ) {
294
+ $new_tokens = $this->renew_access_token( $account );
295
+ if ( $new_tokens['status'] ) {
296
+ return $new_tokens['access_token'];
297
+ } else {
298
+ // return all error info [arr]
299
+ return $new_tokens;
300
+ }
301
+ } else {
302
+ return $options['accounts'][$account]['default_app']['access_token'];
303
+ }
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Renew the current access token.
309
+ */
310
+ public function renew_access_token( $account ) {
311
+ $cid = self::CID;
312
+ $cs = self::CS;
313
+ $options = self::get_option();
314
+ $access_token = $options['accounts'][$account]['default_app']['access_token'];
315
+ $refresh_token = $options['accounts'][$account]['default_app']['refresh_token'];
316
+
317
+ if ( self::use_user_app() ) {
318
+ $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
319
+ $_options = $gadsense_data->get_options();
320
+ $cid = ADVANCED_ADS_MAPI_CID;
321
+ $cs = ADVANCED_ADS_MAPI_CIS;
322
+ $access_token = $options['accounts'][$account]['user_app']['access_token'];
323
+ $refresh_token = $options['accounts'][$account]['user_app']['refresh_token'];
324
+ }
325
+
326
+ $url = 'https://www.googleapis.com/oauth2/v4/token';
327
+ $args = array(
328
+ 'body' => array(
329
+ 'refresh_token' => $refresh_token,
330
+ 'client_id' => $cid,
331
+ 'client_secret' => $cs,
332
+ 'grant_type' => 'refresh_token',
333
+ ),
334
+ );
335
+
336
+ $response = wp_remote_post( $url, $args );
337
+ if ( is_wp_error( $response ) ) {
338
+ return array( 'status' => false, 'msg' => 'error while renewing access token for "' . $account . '"', 'raw' => $response->get_error_message() );
339
+ } else {
340
+ $tokens = json_decode( $response['body'], true );
341
+ if ( null !== $tokens ) {
342
+ $expires = time() + absint( $tokens['expires_in'] );
343
+ if ( self::use_user_app() ) {
344
+ $options['accounts'][$account]['user_app']['access_token'] = $tokens['access_token'];
345
+ $options['accounts'][$account]['user_app']['expires'] = $expires;
346
+ } else {
347
+ $options['accounts'][$account]['default_app']['access_token'] = $tokens['access_token'];
348
+ $options['accounts'][$account]['default_app']['expires'] = $expires;
349
+ }
350
+ update_option( self::OPTNAME, $options );
351
+ return array( 'status' => true, 'access_token' => $tokens['access_token'] );
352
+ } else {
353
+ return array( 'status' => false, 'msg' => 'invalid response received while renewing access token for "' . $account . '"', 'raw' => $response['body'] );
354
+ }
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Recoke a refresh token
360
+ */
361
+ public function ajax_revoke_tokken() {
362
+
363
+ $nonce = isset( $_POST['nonce'] )? $_POST['nonce'] : '';
364
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
365
+ $adsense_id = stripslashes( $_POST['adsenseId'] );
366
+ $options = self::get_option();
367
+ if ( self::use_user_app() ) {
368
+ $token = $options['accounts'][$adsense_id]['user_app']['refresh_token'];
369
+ } else {
370
+ $token = $options['accounts'][$adsense_id]['default_app']['refresh_token'];
371
+ }
372
+ $url = 'https://accounts.google.com/o/oauth2/revoke?token=' . $token;
373
+ $args = array(
374
+ 'timeout' => 5,
375
+ 'header' => array( 'Content-type' => 'application/x-www-form-urlencoded' ),
376
+ );
377
+
378
+ $response = wp_remote_post( $url, $args );
379
+ if ( is_wp_error( $response ) ) {
380
+ echo json_encode( array( 'status' => false ) );
381
+ } else {
382
+ header( 'Content-Type: application/json' );
383
+ unset( $options['accounts'][$adsense_id] );
384
+ update_option( self::OPTNAME, $options );
385
+ echo json_encode( array( 'status' => true ) );
386
+ }
387
+ }
388
+ die;
389
+
390
+ }
391
+
392
+ /**
393
+ * Save ad code reconstructed from ad parameters
394
+ */
395
+ public function ajax_save_reconstructed_code() {
396
+ $nonce = isset( $_POST['nonce'] )? $_POST['nonce'] : '';
397
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
398
+ $code = stripslashes( $_POST['code'] );
399
+ $slot = stripslashes( $_POST['slot'] );
400
+ $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
401
+ $adsense_id = $gadsense_data->get_adsense_id();
402
+ $options = self::get_option();
403
+ $options['ad_codes']['ca-' . $adsense_id . ':' . $slot] = $code;
404
+ update_option( self::OPTNAME, $options );
405
+ header( 'Content-Type: application/json' );
406
+ echo json_encode( array( 'status' => true ) );
407
+ }
408
+ die;
409
+ }
410
+
411
+ /**
412
+ * Get ad code for a given unit
413
+ */
414
+ public function ajax_get_adCode() {
415
+ $nonce = isset( $_POST['nonce'] )? $_POST['nonce'] : '';
416
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
417
+ $unit = stripslashes( $_POST['unit'] );
418
+
419
+ if ( !self::use_user_app() ) {
420
+ $quota = $this->get_quota();
421
+
422
+ // No more quota left
423
+ if ( $quota['count'] < 1 ) {
424
+ $quota_msg = $this->get_quota_msg();
425
+ header( 'Content-Type: application/json' );
426
+ $quota_msg = $this->get_quota_msg();
427
+ echo wp_json_encode(
428
+ array(
429
+ 'quota' => 0,
430
+ 'quotaMsg' => $quota_msg,
431
+ )
432
+ );
433
+ die;
434
+ }
435
+
436
+ }
437
+
438
+ $code = $this->get_ad_code( $unit );
439
+
440
+ /**
441
+ * Ad code is returned as string. Otherwise it's an error
442
+ */
443
+ if ( is_string( $code ) ) {
444
+
445
+ $response = array( 'code' => $code );
446
+
447
+ /**
448
+ * Add quota info for default API creds
449
+ */
450
+ if ( !self::use_user_app() ) {
451
+ $quota = $this->get_quota();
452
+ $quota_msg = $this->get_quota_msg();
453
+ $response['quota'] = $quota['count'];
454
+ $response['quotaMsg'] = $quota_msg;
455
+ }
456
+
457
+ header( 'Content-Type: application/json' );
458
+ echo wp_json_encode( $response );
459
+
460
+ } else {
461
+
462
+ // return info about the error
463
+ header( 'Content-Type: application/json' );
464
+ echo wp_json_encode( $code );
465
+
466
+ }
467
+
468
+ }
469
+ die;
470
+ }
471
+
472
+ /**
473
+ * Get / Update the ad unit list for a given ad client. The corresponding <select /> input used in the ad selector is passed as a fied of an array
474
+ */
475
+ public function ajax_get_adUnits() {
476
+ $nonce = isset( $_POST['nonce'] )? $_POST['nonce'] : '';
477
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
478
+ $account = stripslashes( $_POST['account'] );
479
+ $units = $this->get_ad_units( $account );
480
+
481
+ if ( true == $units ) {
482
+ $options = self::get_option();
483
+ $ad_units = $options['accounts'][$account]['ad_units'];
484
+ ob_start();
485
+
486
+ echo '<select id="mapi-adunit-select">';
487
+ if ( empty( $ad_units ) ) {
488
+ echo '<option value="">' . __( 'No ad unit found', 'advanced-ads' ) . '</option>';
489
+ } else {
490
+ echo '<option value="">' . __( '--select ad--', 'advanced-ads' ) . '</option>';
491
+ $sorted_adunits = self::get_sorted_adunits( $ad_units );
492
+ foreach ( $sorted_adunits as $key => $value ) {
493
+ echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
494
+ }
495
+ }
496
+ echo '</select>';
497
+
498
+ $ad_selector = ob_get_clean();
499
+
500
+ $response = array(
501
+ 'status' => true,
502
+ 'html' => $ad_selector,
503
+ );
504
+
505
+ /**
506
+ * Add quota info for default API creds
507
+ */
508
+ if ( !self::use_user_app() ) {
509
+ $quota = $this->get_quota();
510
+ $quota_msg = $this->get_quota_msg();
511
+ $response['quota'] = $quota['count'];
512
+ $response['quotaMsg'] = $quota_msg;
513
+ }
514
+
515
+ } else {
516
+ /**
517
+ * return the error info [arr]
518
+ */
519
+ $response = $units;
520
+ }
521
+ header( 'Content-Type: application/json' );
522
+ echo wp_json_encode( $response );
523
+ }
524
+ die;
525
+ }
526
+
527
+ /**
528
+ * Submit Google API confirmation code. Save the token and update ad client list.
529
+ */
530
+ public function ajax_confirm_code() {
531
+ $nonce = isset( $_POST['nonce'] )? $_POST['nonce'] : '';
532
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
533
+ $code = urldecode( $_POST['code'] );
534
+ $cid = self::CID;
535
+ $cs = self::CS;
536
+
537
+ $use_user_app = self::use_user_app();
538
+
539
+ $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
540
+
541
+ if ( $use_user_app ) {
542
+ $_options = $gadsense_data->get_options();
543
+ $cid = ADVANCED_ADS_MAPI_CID;
544
+ $cs = ADVANCED_ADS_MAPI_CIS;
545
+ }
546
+
547
+ $code_url = 'https://www.googleapis.com/oauth2/v4/token';
548
+ $redirect_uri = 'urn:ietf:wg:oauth:2.0:oob';
549
+ $grant_type = 'authorization_code';
550
+
551
+ $args = array(
552
+ 'timeout' => 10,
553
+ 'body' => array(
554
+ 'code' => $code,
555
+ 'client_id' => $cid,
556
+ 'client_secret' => $cs,
557
+ 'redirect_uri' => $redirect_uri,
558
+ 'grant_type' => $grant_type,
559
+ ),
560
+ );
561
+
562
+ $response = wp_remote_post( $code_url, $args );
563
+
564
+ if ( is_wp_error( $response ) ) {
565
+ return json_encode( array( 'status' => false, 'msg' => 'error while submitting code', 'raw' => $response->get_error_message() ) );
566
+ } else {
567
+ $token = json_decode( $response['body'], true );
568
+ $adsense_id = $gadsense_data->get_adsense_id();
569
+
570
+ if ( null !== $token && isset( $token['refresh_token'] ) ) {
571
+
572
+ if ( !empty( $adsense_id ) ) {
573
+ self::save_token_from_code( $token, $adsense_id );
574
+
575
+ $gadsense_options = $gadsense_data->get_options();
576
+ $gadsense_options['page-level-enabled'] = isset( $_POST['autoads'] );
577
+ update_option( GADSENSE_OPT_NAME, $gadsense_options );
578
+
579
+ header( 'Content-Type: application/json' );
580
+ echo json_encode( array( 'status' => true ) );
581
+
582
+ } else {
583
+ /**
584
+ * get AdSense ID first
585
+ */
586
+ $url = 'https://www.googleapis.com/adsense/v1.4/accounts';
587
+
588
+ $headers = array( 'Authorization' => 'Bearer ' . $token['access_token'] );
589
+ $response = wp_remote_get( $url, array( 'headers' => $headers ) );
590
+
591
+ if ( is_wp_error( $response ) ) {
592
+
593
+ header( 'Content-Type: application/json' );
594
+ echo json_encode( array( 'status' => false, 'error_msg' => $response->get_error_message() ) );
595
+
596
+ } else {
597
+
598
+ $accounts = json_decode( $response['body'], true );
599
+ $adsense_id = $accounts['items'][0]['id'];
600
+
601
+ $gadsense_options = $gadsense_data->get_options();
602
+ $gadsense_options['adsense-id'] = $adsense_id;
603
+
604
+ $gadsense_options['page-level-enabled'] = isset( $_POST['autoads'] );
605
+
606
+ update_option( GADSENSE_OPT_NAME, $gadsense_options );
607
+ self::save_token_from_code( $token, $adsense_id );
608
+
609
+ header( 'Content-Type: application/json' );
610
+ echo json_encode( array( 'status' => true ) );
611
+
612
+ }
613
+ }
614
+
615
+
616
+ } else {
617
+ header( 'Content-Type: application/json' );
618
+ echo json_encode( array( 'status' => false, 'response_body' => $response['body'] ) );
619
+ }
620
+ }
621
+ }
622
+ die;
623
+ }
624
+
625
+ /**
626
+ * Enqueue admin scripts
627
+ */
628
+ public function admin_scripts( $hook ) {
629
+ if ( 'advanced-ads_page_advanced-ads-settings' == $hook ) {
630
+ wp_enqueue_script( 'gasense/mapi/settings', GADSENSE_BASE_URL . 'admin/assets/js/mapi-settings.js', array( 'jquery' ), ADVADS_VERSION );
631
+ }
632
+ }
633
+
634
+ /**
635
+ * Sort ad units list alphabetically
636
+ */
637
+ public static function get_sorted_adunits( $adunits ) {
638
+ $results = array();
639
+ foreach ( $adunits as $unit ) {
640
+ $results[$unit['name']] = $unit['id'];
641
+ }
642
+ ksort( $results );
643
+ $results = array_flip( $results );
644
+ return $results;
645
+ }
646
+
647
+ /**
648
+ * Check if the credential are the default ones or from user's app
649
+ */
650
+ public static function use_user_app() {
651
+ if ( ( defined( 'ADVANCED_ADS_MAPI_CID' ) && '' != ADVANCED_ADS_MAPI_CID ) && ( defined( 'ADVANCED_ADS_MAPI_CIS' ) && '' != ADVANCED_ADS_MAPI_CIS ) ) {
652
+ return true;
653
+ } else {
654
+ return false;
655
+ }
656
+ }
657
+
658
+ public static function has_token( $adsense_id = '' ) {
659
+ if ( empty( $adsense_id ) ) {
660
+ return false;
661
+ }
662
+
663
+ $has_token = false;
664
+ $options = self::get_option();
665
+ if ( self::use_user_app() ) {
666
+ if ( isset( $options['accounts'][$adsense_id] ) && !empty( $options['accounts'][$adsense_id]['user_app']['refresh_token'] ) ) {
667
+ $has_token = true;
668
+ }
669
+ } else {
670
+ if ( isset( $options['accounts'][$adsense_id] ) && !empty( $options['accounts'][$adsense_id]['default_app']['refresh_token'] ) ) {
671
+ $has_token = true;
672
+ }
673
+ }
674
+ return $has_token;
675
+
676
+ }
677
+
678
+ /**
679
+ * save token obtained from confirmation code
680
+ */
681
+ public static function save_token_from_code( $token, $adsense_id ) {
682
+
683
+ $options = self::get_option();
684
+ $expires = time() + absint( $token['expires_in'] );
685
+ if ( !isset( $options['accounts'][$adsense_id] ) ) {
686
+ $options['accounts'][$adsense_id] = self::$empty_account_data;
687
+ }
688
+ if ( self::use_user_app() ) {
689
+ $options['accounts'][$adsense_id]['user_app'] = array(
690
+ 'access_token' => $token['access_token'],
691
+ 'refresh_token' => $token['refresh_token'],
692
+ 'expires' => $expires,
693
+ 'token_type' => $token['token_type'],
694
+ );
695
+ } else {
696
+ $options['accounts'][$adsense_id]['default_app'] = array(
697
+ 'access_token' => $token['access_token'],
698
+ 'refresh_token' => $token['refresh_token'],
699
+ 'expires' => $expires,
700
+ 'token_type' => $token['token_type'],
701
+ );
702
+ }
703
+ update_option( self::OPTNAME, $options );
704
+
705
+ }
706
+
707
+ /**
708
+ * Get the class's option
709
+ */
710
+ public static function get_option() {
711
+ $options = get_option( self::OPTNAME, array() );
712
+ if ( !is_array( $options ) ) $options = array();
713
+ return $options + self::$default_options;
714
+ }
715
+
716
+ public static function get_instance() {
717
+ if (null == self::$instance) {
718
+ self::$instance = new self;
719
+ }
720
+ return self::$instance;
721
+ }
722
+ }
modules/gadsense/main.php CHANGED
@@ -23,6 +23,10 @@ if ( class_exists( 'Advanced_Ads', false ) ) {
23
  Advanced_Ads_AdSense_Data::get_instance();
24
  add_filter( 'advanced-ads-ad-types', 'advads_add_ad_type_adsense' );
25
 
 
 
 
 
26
  if ( ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX) && is_admin() ) {
27
  Advanced_Ads_AdSense_Admin::get_instance();
28
  } else {
23
  Advanced_Ads_AdSense_Data::get_instance();
24
  add_filter( 'advanced-ads-ad-types', 'advads_add_ad_type_adsense' );
25
 
26
+ if ( is_admin() ) {
27
+ Advanced_Ads_AdSense_MAPI::get_instance();
28
+ }
29
+
30
  if ( ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX) && is_admin() ) {
31
  Advanced_Ads_AdSense_Admin::get_instance();
32
  } else {
modules/import-export/classes/import.php CHANGED
@@ -399,6 +399,8 @@ class Advanced_Ads_Import {
399
  }
400
 
401
  $placement['item'] = 'ad_' . $found;
 
 
402
  break;
403
  case Advanced_Ads_Select::GROUP :
404
  $found = $this->search_item( $_item[1], Advanced_Ads_Select::GROUP );
399
  }
400
 
401
  $placement['item'] = 'ad_' . $found;
402
+ // new placement key => old placement key
403
+ $this->imported_data['placements'][ $placement_key_uniq ] = $placement_key_uniq;
404
  break;
405
  case Advanced_Ads_Select::GROUP :
406
  $found = $this->search_item( $_item[1], Advanced_Ads_Select::GROUP );
modules/privacy/admin/views/setting-enable.php CHANGED
@@ -2,5 +2,6 @@
2
  <a href="<?php echo ADVADS_URL . 'manual/ad-cookie-consent/#utm_source=advanced-ads&utm_medium=link&utm_campaign=privacy-tab'; ?>" target="_blank"><?php _e( 'Manual', 'advanced-ads' ); ?></a>
3
  <?php if( Advanced_Ads_Checks::cache() && ! defined('AAP_VERSION') ) :
4
  ?><p><span class="advads-error-message"><?php _e( 'It seems that a caching plugin is activated.', 'advanced-ads' ); ?></span>&nbsp;<?php
5
- printf( __( 'Your users’ consent might get cached and show ads without to users who didn’t give their consent yet. Cache-busting in <a href="%s" target="_blank">Advanced Ads Pro</a> solves that.', 'advanced-ads' ), ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=privacy-cache' ); ?></p><?php
 
6
  endif;
2
  <a href="<?php echo ADVADS_URL . 'manual/ad-cookie-consent/#utm_source=advanced-ads&utm_medium=link&utm_campaign=privacy-tab'; ?>" target="_blank"><?php _e( 'Manual', 'advanced-ads' ); ?></a>
3
  <?php if( Advanced_Ads_Checks::cache() && ! defined('AAP_VERSION') ) :
4
  ?><p><span class="advads-error-message"><?php _e( 'It seems that a caching plugin is activated.', 'advanced-ads' ); ?></span>&nbsp;<?php
5
+ _e( 'Your users’ consent might get cached and show ads to users who didn’t give their consent yet. ', 'advanced-ads' );
6
+ ?> <?php printf( __( 'Cache-busting in <a href="%s" target="_blank">Advanced Ads Pro</a> solves that.', 'advanced-ads' ), ADVADS_URL . 'add-ons/advanced-ads-pro/#utm_source=advanced-ads&utm_medium=link&utm_campaign=privacy-cache' ); ?></p><?php
7
  endif;
public/class-advanced-ads.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  /**
4
  * Advanced Ads.
5
  *
@@ -7,7 +6,7 @@
7
  * @author Thomas Maier <thomas.maier@webgilde.com>
8
  * @license GPL-2.0+
9
  * @link http://webgilde.com
10
- * @copyright 2013-2015 Thomas Maier, webgilde GmbH
11
  */
12
 
13
  /**
@@ -20,7 +19,7 @@
20
  class Advanced_Ads {
21
 
22
  /**
23
- * post type slug
24
  *
25
  * @since 1.0.0
26
  * @var string
@@ -28,7 +27,7 @@ class Advanced_Ads {
28
  const POST_TYPE_SLUG = 'advanced_ads';
29
 
30
  /**
31
- * ad group slug
32
  *
33
  * @since 1.0.0
34
  * @var string
@@ -44,17 +43,21 @@ class Advanced_Ads {
44
  private static $instance = null;
45
 
46
  /**
47
- * array with ads currently delivered in the frontend
 
 
48
  */
49
  public $current_ads = array();
50
 
51
  /**
52
- * ad types
 
 
53
  */
54
  public $ad_types = array();
55
 
56
  /**
57
- * plugin options
58
  *
59
  * @since 1.0.1
60
  * @var array (if loaded)
@@ -62,7 +65,7 @@ class Advanced_Ads {
62
  protected $options = false;
63
 
64
  /**
65
- * interal plugin options – set by the plugin
66
  *
67
  * @since 1.4.5
68
  * @var array (if loaded)
@@ -70,54 +73,66 @@ class Advanced_Ads {
70
  protected $internal_options = false;
71
 
72
  /**
73
- * list of bots and crawlers to exclude from ad impressions
74
  *
75
  * @since 1.4.9
76
  * @var array list of bots
77
  */
78
- protected $bots = array('bot','spider','crawler','scraper','parser','008','Accoona-AI-Agent','ADmantX','alexa','appie','Apple-PubSub','Arachmo','Ask Jeeves','avira\.com','B-l-i-t-z-B-O-T','boitho\.com-dc','BUbiNG','Cerberian Drtrs','Charlotte','cosmos','Covario IDS','curl','DataparkSearch','DDG-Android','expo9','facebookexternalhit','Feedfetcher-Google','FindLinks','Firefly','froogle','Genieo','heritrix','Holmes','htdig','https://developers\.google\.com','ia_archiver','ichiro','igdeSpyder','InfoSeek','inktomi','Kraken','L\.webis','Larbin','Linguee','LinkWalker','looksmart','lwp-trivial','mabontland','Mnogosearch','mogimogi','Morning Paper','MVAClient','NationalDirectory','NetResearchServer','NewsGator','NG-Search','Nusearch','NutchCVS','Nymesis','oegp','Orbiter','Peew','Pompos','PostPost','proximic','PycURL','Qseero','rabaz','Radian6','Reeder', 'savetheworldheritage','SBIder','Scooter','ScoutJet','Scrubby','SearchSight','semanticdiscovery','Sensis','ShopWiki','silk','Snappy','Spade','Sqworm','StackRambler','TechnoratiSnoop','TECNOSEEK','Teoma','Thumbnail\.CZ','TinEye','truwoGPS','updated','Vagabondo','voltron','Vortex','voyager','VYU2','WebBug','webcollage','WebIndex','Websquash\.com','WeSEE:Ads','wf84','Wget','WomlpeFactory','WordPress','yacy','Yahoo! Slurp','Yahoo! Slurp China','YahooSeeker','YahooSeeker-Testing','YandexBot','YandexMedia','YandexBlogs','YandexNews','YandexCalendar','YandexImages','Yeti','yoogliFetchAgent','Zao','ZyBorg','okhttp','ips-agent','ltx71','Optimizer','Daum','Qwantify');
79
 
80
  /**
 
81
  *
82
  * @var Advanced_Ads_Model
83
  */
84
  protected $model;
85
 
86
  /**
 
87
  *
88
  * @var Advanced_Ads_Plugin
89
  */
90
  protected $plugin;
91
 
92
  /**
 
93
  *
94
  * @var Advanced_Ads_Select
95
  */
96
  protected $ad_selector;
97
 
98
  /**
99
- * is the query the main query?, when WP_Query is used
100
  *
101
  * @var bool
102
  */
103
  private $is_main_query;
104
 
 
 
 
 
 
 
105
 
 
 
 
106
  private function __construct() {
107
  $this->plugin = Advanced_Ads_Plugin::get_instance();
108
- $this->plugin->set_model($this->get_model());
109
  $this->ad_selector = Advanced_Ads_Select::get_instance();
110
 
111
- // initialize plugin specific functions
112
  add_action( 'init', array( $this, 'wp_init' ) );
113
 
114
- // only when not doing ajax
115
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
116
  Advanced_Ads_Ajax::get_instance();
117
  }
118
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
119
-
120
- // allow add-ons to interact
121
  add_action( 'init', array( $this, 'advanced_ads_loaded' ), 9 );
122
  }
123
 
@@ -129,15 +144,16 @@ class Advanced_Ads {
129
  */
130
  public static function get_instance() {
131
 
132
- // If the single instance hasn't been set, set it now.
133
  if ( null === self::$instance ) {
134
- self::$instance = new self;
135
  }
136
 
137
  return self::$instance;
138
  }
139
 
140
  /**
 
141
  *
142
  * @return Advanced_Ads_Model
143
  */
@@ -145,7 +161,7 @@ class Advanced_Ads {
145
 
146
  global $wpdb;
147
 
148
- if ( ! isset($this->model) ) {
149
  $this->model = new Advanced_Ads_Model( $wpdb );
150
  }
151
 
@@ -158,51 +174,48 @@ class Advanced_Ads {
158
  *
159
  * @since 1.0.0
160
  */
161
- public function wp_plugins_loaded()
162
- {
163
- // register hook for global constants
164
  add_action( 'wp', array( $this, 'set_disabled_constant' ) );
165
 
166
- // setup default ad types
167
  add_filter( 'advanced-ads-ad-types', array( $this, 'setup_default_ad_types' ), 5 );
168
 
169
- // register hooks and filters for auto ad injection
170
  $this->init_injection();
171
 
172
- // manipulate sidebar widget
173
  add_filter( 'dynamic_sidebar_params', array( $this, 'manipulate_widget_output' ) );
174
 
175
- // add meta robots noindex, nofollow to images, which are part of 'Image ad' ad type
176
  add_action( 'wp_head', array( $this, 'noindex_attachment_images' ) );
177
 
178
- // check if ads are disabled in secondary queries
179
  add_action( 'the_post', array( $this, 'set_query_type' ), 10, 2 );
180
 
181
-
182
  }
183
 
184
  /**
185
- * allow add-ons to hook
186
  */
187
  public function advanced_ads_loaded() {
188
  do_action( 'advanced-ads-plugin-loaded' );
189
  }
190
-
191
  /**
192
- * init / load plugin specific functions and settings
193
  *
194
  * @since 1.0.0
195
  */
196
- public function wp_init(){
197
- // load ad post types
198
  $this->create_post_types();
199
- // set ad types array
200
  $this->set_ad_types();
201
  }
202
 
203
  /**
204
- * define ad types with their options
205
- *
206
  * name => publically readable name
207
  * description => publically readable description
208
  * editor => kind of editor: text (normal text field), content (WP content field), none (no content field)
@@ -213,18 +226,21 @@ class Advanced_Ads {
213
  public function set_ad_types() {
214
 
215
  /**
216
- * load default ad type files
217
  * custom ad types can also be loaded in your own plugin or functions.php
218
  */
219
  $types = array();
220
 
221
  /**
222
- * developers can add new ad types using this filter
223
  * see classes/ad-type-content.php for an example for an ad type and usage of this filter
224
  */
225
  $this->ad_types = apply_filters( 'advanced-ads-ad-types', $types );
226
  }
227
 
 
 
 
228
  public function init_injection() {
229
  // -TODO abstract
230
  add_action( 'wp_head', array( $this, 'inject_header' ), 20 );
@@ -233,58 +249,59 @@ class Advanced_Ads {
233
  }
234
 
235
  /**
236
- * set global constant that prevents ads from being displayed on the current page view
237
  *
238
  * @since 1.3.10
239
  */
240
- public function set_disabled_constant(){
241
 
242
  global $post, $wp_the_query;
243
 
244
- // don't set the constant if already defined
245
- if ( defined( 'ADVADS_ADS_DISABLED' ) ) { return; }
 
246
 
247
  $options = $this->plugin->options();
248
 
249
- // check if ads are disabled completely
250
- if ( ! empty($options['disabled-ads']['all']) ){
251
  define( 'ADVADS_ADS_DISABLED', true );
252
  return;
253
  }
254
 
255
- // check if ads are disabled from 404 pages
256
- if ( $wp_the_query->is_404() && ! empty($options['disabled-ads']['404']) ){
257
  define( 'ADVADS_ADS_DISABLED', true );
258
  return;
259
  }
260
 
261
- // check if ads are disabled from non singular pages (often = archives)
262
- if ( ! $wp_the_query->is_singular() && ! empty($options['disabled-ads']['archives']) ){
263
  define( 'ADVADS_ADS_DISABLED', true );
264
  return;
265
  }
266
 
267
- // check if ads are disabled in Feed
268
  if ( $wp_the_query->is_feed() && ( ! isset( $options['disabled-ads']['feed'] ) || $options['disabled-ads']['feed'] ) ) {
269
  define( 'ADVADS_ADS_DISABLED', true );
270
  return;
271
  }
272
 
273
- // check if ads are disabled on the current page
274
- if ( $wp_the_query->is_singular() && isset($post->ID) ){
275
  $post_ad_options = get_post_meta( $post->ID, '_advads_ad_settings', true );
276
 
277
- if ( ! empty($post_ad_options['disable_ads']) ){
278
  define( 'ADVADS_ADS_DISABLED', true );
279
  }
280
  };
281
-
282
  /**
283
- * check if ads are disabled on WooCommerce shop page (and currently on shop page)
284
- * since WooCommerce changes the post ID of the static page selected to be the product overview page, we need to get the original page id from the WC options
285
  */
286
  if ( function_exists( 'is_shop' ) && is_shop() ) {
287
- $shop_id = get_option( 'woocommerce_shop_page_id' );
288
  $shop_ad_options = get_post_meta( absint( $shop_id ), '_advads_ad_settings', true );
289
  if ( ! empty( $shop_ad_options['disable_ads'] ) ) {
290
  define( 'ADVADS_ADS_DISABLED', true );
@@ -303,58 +320,68 @@ class Advanced_Ads {
303
  }
304
 
305
  /**
306
- * add plain and content ad types to the default ads of the plugin using a filter
307
  *
 
308
  * @since 1.0.0
309
- *
310
  */
311
- function setup_default_ad_types($types){
312
- $types['plain'] = new Advanced_Ads_Ad_Type_Plain(); /* plain text and php code */
313
- $types['dummy'] = new Advanced_Ads_Ad_Type_Dummy(); /* dummy ad */
314
  $types['content'] = new Advanced_Ads_Ad_Type_Content(); /* rich content editor */
315
- $types['image'] = new Advanced_Ads_Ad_Type_Image(); /* image ads */
316
- $types['group'] = new Advanced_Ads_Ad_Type_Group(); /* group ad */
317
  return $types;
318
  }
319
 
320
  /**
321
- * log error messages when debug is enabled
322
  *
 
323
  * @since 1.0.0
324
  * @link http://www.smashingmagazine.com/2011/03/08/ten-things-every-wordpress-plugin-developer-should-know/
325
  */
326
- static function log($message) {
327
  if ( true === WP_DEBUG ) {
328
  if ( is_array( $message ) || is_object( $message ) ) {
329
- error_log( __('Advanced Ads Error following:', 'advanced-ads' ) );
330
  error_log( print_r( $message, true ) );
331
  } else {
 
332
  $message = sprintf( __( 'Advanced Ads Error: %s', 'advanced-ads' ), $message );
333
  error_log( $message );
334
  }
335
  }
336
  }
337
 
338
- // compat method
 
 
 
 
339
  public function options() {
340
  return $this->plugin->options();
341
  }
342
 
343
- // compat method
 
 
 
 
344
  public function internal_options() {
345
  return $this->plugin->internal_options();
346
  }
347
 
348
  /**
349
- * injected ad into header
350
  *
351
  * @since 1.1.0
352
  */
353
- public function inject_header(){
354
  $placements = get_option( 'advads-ads-placements', array() );
355
- if( is_array( $placements ) ){
356
- foreach ( $placements as $_placement_id => $_placement ){
357
- if ( isset($_placement['type']) && 'header' == $_placement['type'] ){
358
  $_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
359
  echo Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options );
360
  }
@@ -363,15 +390,15 @@ class Advanced_Ads {
363
  }
364
 
365
  /**
366
- * injected ads into footer
367
  *
368
  * @since 1.1.0
369
  */
370
- public function inject_footer(){
371
  $placements = get_option( 'advads-ads-placements', array() );
372
- if( is_array( $placements ) ){
373
- foreach ( $placements as $_placement_id => $_placement ){
374
- if ( isset($_placement['type']) && 'footer' == $_placement['type'] ){
375
  $_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
376
  echo Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options );
377
  }
@@ -380,64 +407,70 @@ class Advanced_Ads {
380
  }
381
 
382
  /**
383
- * injected ad into content (before and after)
384
- * displays ALL ads
385
  *
386
  * @since 1.1.0
387
- * @param str $content post content
388
  */
389
- public function inject_content($content = ''){
390
  $options = $this->plugin->options();
391
 
392
- // do not inject in content when on a BuddyPress profile upload page (avatar & cover image)
393
  if ( ( function_exists( 'bp_is_user_change_avatar' ) && bp_is_user_change_avatar() ) || ( function_exists( 'bp_is_user_change_cover_image' ) && bp_is_user_change_cover_image() ) ) {
394
  return $content;
395
  }
396
-
397
- // check if ads are disabled in secondary queries and this function was called by ajax (in secondary query)
398
  if ( ! empty( $options['disabled-ads']['secondary'] ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
399
  return $content;
400
  }
401
 
402
- // run only within the loop on single pages of public post types
403
- $public_post_types = get_post_types( array( 'public' => true, 'publicly_queryable' => true ), 'names', 'or' );
 
 
 
 
 
404
 
405
- // make sure that no ad is injected into another ad
406
- if ( get_post_type() == self::POST_TYPE_SLUG ){
407
  return $content;
408
  }
409
-
410
- // check if admin allows injection in all places
411
- if( ! isset( $options['content-injection-everywhere'] ) || 0 === $options['content-injection-everywhere'] ){
412
- // check if this is a singular page within the loop or an AMP page
413
- $is_amp = advads_is_amp();
414
- if ( ( ! is_singular( $public_post_types ) && ! is_feed() ) || ( ! $is_amp && ! in_the_loop() ) ) { return $content; }
 
415
  } else {
416
- global $wp_query;
417
- if ( is_main_query() && $options['content-injection-everywhere'] !== 'true' && isset ( $wp_query->current_post ) && $wp_query->current_post >= ( $options['content-injection-everywhere'] ) ){
418
- return $content;
419
- }
420
- }
421
 
422
  $placements = get_option( 'advads-ads-placements', array() );
423
 
424
- if( ! apply_filters( 'advanced-ads-can-inject-into-content', true, $content, $placements )){
425
  return $content;
426
  }
427
 
428
- if( is_array( $placements ) ){
429
- foreach ( $placements as $_placement_id => $_placement ){
430
- if ( empty($_placement['item']) || ! isset($_placement['type']) ) { continue; }
 
431
  $_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
432
 
433
- // check if injection is ok for a specific placement id
434
- if( ! apply_filters( 'advanced-ads-can-inject-into-content-' . $_placement_id, true, $content, $_placement_id )){
435
  continue;
436
  }
437
 
438
  switch ( $_placement['type'] ) {
439
  case 'post_top':
440
- // TODO broken: does not serve placement but serves ad directly
441
  $content = Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options ) . $content;
442
  break;
443
  case 'post_bottom':
@@ -454,42 +487,43 @@ class Advanced_Ads {
454
  }
455
 
456
  /**
457
- * load all ads based on WP_Query conditions
458
  *
459
  * @deprecated 1.4.8 use model class
460
  * @since 1.1.0
461
- * @param arr $args WP_Query arguments that are more specific that default
462
  * @return arr $ads array with post objects
463
  */
464
- static function get_ads($args = array()){
465
- return self::get_instance()->get_model()->get_ads($args);
466
  }
467
 
468
  /**
469
- * load all ad groups
470
  *
471
  * @deprecated 1.4.8 use model class
472
  * @since 1.1.0
473
- * @param arr $args array with options
474
  * @return arr $groups array with ad groups
475
  * @link http://codex.wordpress.org/Function_Reference/get_terms
476
  */
477
- static function get_ad_groups($args = array()){
478
- return self::get_instance()->get_model()->get_ad_groups($args);
479
  }
480
 
481
  /**
482
- * get the array with ad placements
483
  *
484
  * @since 1.1.0
485
  * @deprecated 1.4.8 use model
486
  * @return arr $ad_placements
487
  */
488
- static public function get_ad_placements_array(){
489
  return self::get_instance()->get_model()->get_ad_placements_array();
490
  }
491
 
492
  /**
 
493
  *
494
  * @deprecated 1.4.8 use model
495
  * @return array
@@ -499,35 +533,35 @@ class Advanced_Ads {
499
  }
500
 
501
  /**
502
- * general check if ads can be displayed for the whole page impression
503
  *
504
  * @since 1.4.9
505
- * @return bool true, if ads can be displayed
506
- * @todo move this to set_disabled_constant()
507
  */
508
- public function can_display_ads(){
509
 
510
- // check global constant if ads are enabled or disabled
511
  if ( defined( 'ADVADS_ADS_DISABLED' ) ) {
512
  return false;
513
  }
514
 
515
  $options = $this->options();
516
 
517
- // check if ads are disabled in secondary queries
518
- // and this is not main query and this is not ajax (because main query does not exist in ajax but ad needs to be shown)
519
  if ( ! empty( $options['disabled-ads']['secondary'] ) && ! $this->is_main_query() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
520
  return false;
521
  }
522
 
523
- $see_ads_capability = isset($options['hide-for-user-role']) && $options['hide-for-user-role'] != '' ? $options['hide-for-user-role'] : false;
524
 
525
- // check if user is logged in and if so if users with his rights can see ads
526
  if ( $see_ads_capability && is_user_logged_in() && current_user_can( $see_ads_capability ) ) {
527
  return false;
528
  }
529
 
530
- // check bots if option is enabled
531
  if ( ( isset( $options['block-bots'] ) && $options['block-bots']
532
  && ! $this->is_cache_bot() && $this->is_bot() ) ) {
533
  return false;
@@ -537,49 +571,48 @@ class Advanced_Ads {
537
  }
538
 
539
  /**
540
- * check if the current user agent is given or a bot
541
  *
542
  * @since 1.4.9
543
- * @return bool true if the current user agent is empty or a bot
544
  */
545
- public function is_bot(){
546
- // show ads on AMP version also for bots in order to allow Google (and maybe others) to cache the page
547
  if ( advads_is_amp() ) {
548
  return false;
549
  }
550
 
 
551
 
552
- $bots = apply_filters('advanced-ads-bots', $this->bots);
553
-
554
- $bots = implode('|', $bots);
555
- $bots = preg_replace('@[^-_;/|\][ :.!a-z0-9]@i', '', $bots);
556
  $regex = "@$bots@i";
557
 
558
- if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] !== '') {
559
- $agent = $_SERVER['HTTP_USER_AGENT'];
560
 
561
- return preg_match($regex, $agent) === 1;
562
  }
563
 
564
  return true;
565
  }
566
 
567
  /**
568
- * check if the current user is a bot prepopulating the cache
569
- * ads should be loaded for the bot, because they should show up on the cached site
570
  *
571
  * @return bool
572
  */
573
- public function is_cache_bot(){
574
- if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] !== '' ) {
575
- // WP Rocket
576
- if ( false !== strpos( $_SERVER['HTTP_USER_AGENT'], 'wprocketbot' ) ) {
577
  return true;
578
  }
579
 
580
  // WP Super Cache.
581
  $wp_useragent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) );
582
- if ( $wp_useragent === $_SERVER['HTTP_USER_AGENT'] ) {
583
  return true;
584
  }
585
  }
@@ -597,16 +630,16 @@ class Advanced_Ads {
597
  return;
598
  }
599
 
600
- // register ad group taxonomy
601
- if ( ! taxonomy_exists( Advanced_Ads::AD_GROUP_TAXONOMY ) ){
602
  $post_type_params = $this->get_group_taxonomy_params();
603
- register_taxonomy( Advanced_Ads::AD_GROUP_TAXONOMY, array( Advanced_Ads::POST_TYPE_SLUG ), $post_type_params );
604
  }
605
 
606
- // register ad post type
607
- if ( ! post_type_exists( Advanced_Ads::POST_TYPE_SLUG ) ) {
608
  $post_type_params = $this->get_post_type_params();
609
- register_post_type( Advanced_Ads::POST_TYPE_SLUG, $post_type_params );
610
  }
611
  }
612
 
@@ -616,7 +649,7 @@ class Advanced_Ads {
616
  * @since 1.0.0
617
  * @return array
618
  */
619
- protected function get_group_taxonomy_params(){
620
  $labels = array(
621
  'name' => _x( 'Ad Groups & Rotations', 'ad group general name', 'advanced-ads' ),
622
  'singular_name' => _x( 'Ad Group', 'ad group singular name', 'advanced-ads' ),
@@ -633,7 +666,7 @@ class Advanced_Ads {
633
  );
634
 
635
  $args = array(
636
- 'public' => false,
637
  'hierarchical' => true,
638
  'labels' => $labels,
639
  'show_ui' => true,
@@ -655,94 +688,93 @@ class Advanced_Ads {
655
  */
656
  protected function get_post_type_params() {
657
  $labels = array(
658
- 'name' => __( 'Ads', 'advanced-ads' ),
659
- 'singular_name' => __( 'Ad', 'advanced-ads' ),
660
- 'add_new' => __( 'New Ad', 'advanced-ads' ),
661
- 'add_new_item' => __( 'Add New Ad', 'advanced-ads' ),
662
- 'edit' => __( 'Edit', 'advanced-ads' ),
663
- 'edit_item' => __( 'Edit Ad', 'advanced-ads' ),
664
- 'new_item' => __( 'New Ad', 'advanced-ads' ),
665
- 'view' => __( 'View', 'advanced-ads' ),
666
- 'view_item' => __( 'View the Ad', 'advanced-ads' ),
667
- 'search_items' => __( 'Search Ads', 'advanced-ads' ),
668
- 'not_found' => __( 'No Ads found', 'advanced-ads' ),
669
  'not_found_in_trash' => __( 'No Ads found in Trash', 'advanced-ads' ),
670
- 'parent' => __( 'Parent Ad', 'advanced-ads' ),
671
  );
672
-
673
  $supports = array( 'title' );
674
- if( defined( 'ADVANCED_ADS_ENABLE_REVISIONS') ){
675
- $supports[] = 'revisions';
676
  };
677
 
678
  $post_type_params = array(
679
- 'labels' => $labels,
680
- 'public' => false,
681
- 'show_ui' => true,
682
  'show_in_menu' => false,
683
  'hierarchical' => false,
684
  'capabilities' => array(
685
- // Meta capabilities
686
- 'edit_post' => 'advanced_ads_edit_ads',
687
- 'read_post' => 'advanced_ads_edit_ads',
688
- 'delete_post' => 'advanced_ads_edit_ads',
689
- 'edit_page' => 'advanced_ads_edit_ads',
690
- 'read_page' => 'advanced_ads_edit_ads',
691
- 'delete_page' => 'advanced_ads_edit_ads',
692
- // Primitive capabilities used outside of map_meta_cap()
693
- 'edit_posts' => 'advanced_ads_edit_ads',
694
- 'edit_others_posts' => 'advanced_ads_edit_ads',
695
- 'publish_posts' => 'advanced_ads_edit_ads',
696
- 'read_private_posts' => 'advanced_ads_edit_ads',
697
- // Primitive capabilities used within map_meta_cap():
698
- 'read' => 'advanced_ads_edit_ads',
699
- 'delete_posts' => 'advanced_ads_edit_ads',
700
- 'delete_private_posts' => 'advanced_ads_edit_ads',
701
  'delete_published_posts' => 'advanced_ads_edit_ads',
702
- 'delete_others_posts' => 'advanced_ads_edit_ads',
703
- 'edit_private_posts' => 'advanced_ads_edit_ads',
704
- 'edit_published_posts' => 'advanced_ads_edit_ads',
705
- 'create_posts' => 'advanced_ads_edit_ads',
706
  ),
707
- 'has_archive' => false,
708
- //'rewrite' => array( 'slug' => ADVADS_SLUG ),
709
- 'query_var' => true,
710
- 'supports' => $supports,
711
- 'taxonomies' => array( Advanced_Ads::AD_GROUP_TAXONOMY )
712
  );
713
-
714
  return apply_filters( 'advanced-ads-post-type-params', $post_type_params );
715
  }
716
 
717
  /**
718
- * manipulate output of ad widget
719
  *
720
  * @since 1.6.8.2
721
- * @param arr $params widget and sidebar params
722
  */
723
- public function manipulate_widget_output( $params = array() ){
724
 
725
- if( $params[0]['widget_name'] === 'Advanced Ads' ){
726
 
727
- $options = $this->plugin->options();
728
- // hide id by default (when options are empty) or when option is enabled
729
- if( $options === array() || ( isset( $options['remove-widget-id'] ) && $options['remove-widget-id'] ) ){
730
- $pattern = '#\s(id)=("|\')[^"^\']+("|\')#';
731
- $params[0]['before_widget'] = preg_replace( $pattern, '', $params[0]['before_widget']);
732
- }
733
- }
734
 
735
- return $params;
736
  }
737
 
738
  /**
739
  * Add meta robots noindex, nofollow to images, which are part of 'Image ad' ad type
740
  */
741
- function noindex_attachment_images() {
742
  global $post;
743
- // if the image was not attached to any post
744
- if ( is_attachment() && is_object( $post ) && isset( $post->post_parent ) && $post->post_parent === 0 ) {
745
- // if at least one ad contains the image
746
  if ( get_post_meta( get_the_ID(), '_advanced-ads_parent_id', true ) > 0 ) {
747
  echo '<meta name="robots" content="noindex, nofollow" />';
748
  }
@@ -752,10 +784,10 @@ class Advanced_Ads {
752
  /**
753
  * Supports the "$this->is_main_query=true" while main query is being executed
754
  *
755
- * @param WP_Post &$post The Post object (passed by reference).
756
- * @param WP_Query &$this The current Query object (passed by reference).
757
  */
758
- function set_query_type( $post, $query = null ) {
759
  if ( $query instanceof WP_Query ) {
760
  $this->is_main_query = $query->is_main_query();
761
  }
@@ -768,27 +800,27 @@ class Advanced_Ads {
768
  */
769
  public function is_main_query() {
770
  if ( ! in_the_loop() ) {
771
- // the secondary query check only designed for within post content
772
  return true;
773
  }
774
 
775
- return $this->is_main_query === true;
776
  }
777
 
778
  /**
779
- * get an "Advertisement" label to use before single ad or before first ad in a group
780
  *
781
- * @param string $placement_state default/enabled/disabled
782
- * @return string label, empty string if label should not be displayed
783
  */
784
  public function get_label( $placement_state = 'default' ) {
785
- if ( $placement_state === 'disabled' ) {
786
  return '';
787
  }
788
 
789
- $advads_options = Advanced_Ads::get_instance()->options();
790
 
791
- if ( $placement_state !== 'enabled' && empty( $advads_options['custom-label']['enabled'] ) ) {
792
  return '';
793
  }
794
 
@@ -797,26 +829,30 @@ class Advanced_Ads {
797
  $template = sprintf( '<div class="%s">%s</div>', Advanced_Ads_Plugin::get_instance()->get_frontend_prefix() . 'adlabel', $label );
798
  return apply_filters( 'advanced-ads-custom-label', $template, $label );
799
  }
800
-
801
  /**
802
- * retrieve the number of ads in any status except trash
803
  */
804
- public static function get_number_of_ads(){
805
- $args = array( 'post_status' => 'any' );
806
- $recent_ads = self::get_instance()->get_model()->get_ads( $args );
807
-
808
- return count( $recent_ads );
 
 
 
 
809
  }
810
 
811
  /**
812
  * Switch the current blog.
813
  *
814
- * @param int $blog_id
815
  */
816
  public function switch_to_blog( $blog_id ) {
817
  if ( is_multisite() ) {
818
  switch_to_blog( $blog_id );
819
- Advanced_Ads::get_instance()->get_model()->reset_placement_array();
820
  }
821
  }
822
 
@@ -826,7 +862,7 @@ class Advanced_Ads {
826
  public function restore_current_blog() {
827
  if ( is_multisite() ) {
828
  restore_current_blog();
829
- Advanced_Ads::get_instance()->get_model()->reset_placement_array();
830
  }
831
  }
832
  }
1
  <?php
 
2
  /**
3
  * Advanced Ads.
4
  *
6
  * @author Thomas Maier <thomas.maier@webgilde.com>
7
  * @license GPL-2.0+
8
  * @link http://webgilde.com
9
+ * @copyright 2013-2018 Thomas Maier, webgilde GmbH
10
  */
11
 
12
  /**
19
  class Advanced_Ads {
20
 
21
  /**
22
+ * Post type slug
23
  *
24
  * @since 1.0.0
25
  * @var string
27
  const POST_TYPE_SLUG = 'advanced_ads';
28
 
29
  /**
30
+ * Ad group slug
31
  *
32
  * @since 1.0.0
33
  * @var string
43
  private static $instance = null;
44
 
45
  /**
46
+ * Array with ads currently delivered in the frontend
47
+ *
48
+ * @var array Ads already loaded in the frontend
49
  */
50
  public $current_ads = array();
51
 
52
  /**
53
+ * Ad types
54
+ *
55
+ * @var array Ad types
56
  */
57
  public $ad_types = array();
58
 
59
  /**
60
+ * Plugin options
61
  *
62
  * @since 1.0.1
63
  * @var array (if loaded)
65
  protected $options = false;
66
 
67
  /**
68
+ * Interal plugin options – set by the plugin
69
  *
70
  * @since 1.4.5
71
  * @var array (if loaded)
73
  protected $internal_options = false;
74
 
75
  /**
76
+ * List of bots and crawlers to exclude from ad impressions
77
  *
78
  * @since 1.4.9
79
  * @var array list of bots
80
  */
81
+ protected $bots = array( 'bot', 'spider', 'crawler', 'scraper', 'parser', '008', 'Accoona-AI-Agent', 'ADmantX', 'alexa', 'appie', 'Apple-PubSub', 'Arachmo', 'Ask Jeeves', 'avira\.com', 'B-l-i-t-z-B-O-T', 'boitho\.com-dc', 'BUbiNG', 'Cerberian Drtrs', 'Charlotte', 'cosmos', 'Covario IDS', 'curl', 'DataparkSearch', 'DDG-Android', 'expo9', 'facebookexternalhit', 'Feedfetcher-Google', 'FindLinks', 'Firefly', 'froogle', 'Genieo', 'heritrix', 'Holmes', 'htdig', 'https://developers\.google\.com', 'ia_archiver', 'ichiro', 'igdeSpyder', 'InfoSeek', 'inktomi', 'Kraken', 'L\.webis', 'Larbin', 'Linguee', 'LinkWalker', 'looksmart', 'lwp-trivial', 'mabontland', 'Mnogosearch', 'mogimogi', 'Morning Paper', 'MVAClient', 'NationalDirectory', 'NetResearchServer', 'NewsGator', 'NG-Search', 'Nusearch', 'NutchCVS', 'Nymesis', 'oegp', 'Orbiter', 'Peew', 'Pompos', 'PostPost', 'proximic', 'PycURL', 'Qseero', 'rabaz', 'Radian6', 'Reeder', 'savetheworldheritage', 'SBIder', 'Scooter', 'ScoutJet', 'Scrubby', 'SearchSight', 'semanticdiscovery', 'Sensis', 'ShopWiki', 'silk', 'Snappy', 'Spade', 'Sqworm', 'StackRambler', 'TechnoratiSnoop', 'TECNOSEEK', 'Teoma', 'Thumbnail\.CZ', 'TinEye', 'truwoGPS', 'updated', 'Vagabondo', 'voltron', 'Vortex', 'voyager', 'VYU2', 'WebBug', 'webcollage', 'WebIndex', 'Websquash\.com', 'WeSEE:Ads', 'wf84', 'Wget', 'WomlpeFactory', 'WordPress', 'yacy', 'Yahoo! Slurp', 'Yahoo! Slurp China', 'YahooSeeker', 'YahooSeeker-Testing', 'YandexBot', 'YandexMedia', 'YandexBlogs', 'YandexNews', 'YandexCalendar', 'YandexImages', 'Yeti', 'yoogliFetchAgent', 'Zao', 'ZyBorg', 'okhttp', 'ips-agent', 'ltx71', 'Optimizer', 'Daum', 'Qwantify' );
82
 
83
  /**
84
+ * Loaded instance of Advanced_Ads_Model
85
  *
86
  * @var Advanced_Ads_Model
87
  */
88
  protected $model;
89
 
90
  /**
91
+ * Loaded instance of Advanced_Ads_Plugin
92
  *
93
  * @var Advanced_Ads_Plugin
94
  */
95
  protected $plugin;
96
 
97
  /**
98
+ * Loaded instance of Advanced_Ads_Select
99
  *
100
  * @var Advanced_Ads_Select
101
  */
102
  protected $ad_selector;
103
 
104
  /**
105
+ * Is the query the main query?, when WP_Query is used
106
  *
107
  * @var bool
108
  */
109
  private $is_main_query;
110
 
111
+ /**
112
+ * Save number of ads
113
+ *
114
+ * @var int
115
+ */
116
+ private $number_of_ads = false;
117
 
118
+ /**
119
+ * Initialize frontend features
120
+ */
121
  private function __construct() {
122
  $this->plugin = Advanced_Ads_Plugin::get_instance();
123
+ $this->plugin->set_model( $this->get_model() );
124
  $this->ad_selector = Advanced_Ads_Select::get_instance();
125
 
126
+ // initialize plugin specific functions.
127
  add_action( 'init', array( $this, 'wp_init' ) );
128
 
129
+ // only when not doing ajax.
130
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
131
  Advanced_Ads_Ajax::get_instance();
132
  }
133
  add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
134
+
135
+ // allow add-ons to interact.
136
  add_action( 'init', array( $this, 'advanced_ads_loaded' ), 9 );
137
  }
138
 
144
  */
145
  public static function get_instance() {
146
 
147
+ // if the single instance hasn't been set, set it now.
148
  if ( null === self::$instance ) {
149
+ self::$instance = new self();
150
  }
151
 
152
  return self::$instance;
153
  }
154
 
155
  /**
156
+ * Return the Advanced_Ads_Model responsible for loading ads, groups and placements into the frontend
157
  *
158
  * @return Advanced_Ads_Model
159
  */
161
 
162
  global $wpdb;
163
 
164
+ if ( ! isset( $this->model ) ) {
165
  $this->model = new Advanced_Ads_Model( $wpdb );
166
  }
167
 
174
  *
175
  * @since 1.0.0
176
  */
177
+ public function wp_plugins_loaded() {
178
+ // register hook for global constants.
 
179
  add_action( 'wp', array( $this, 'set_disabled_constant' ) );
180
 
181
+ // setup default ad types.
182
  add_filter( 'advanced-ads-ad-types', array( $this, 'setup_default_ad_types' ), 5 );
183
 
184
+ // register hooks and filters for auto ad injection.
185
  $this->init_injection();
186
 
187
+ // manipulate sidebar widget.
188
  add_filter( 'dynamic_sidebar_params', array( $this, 'manipulate_widget_output' ) );
189
 
190
+ // add meta robots noindex, nofollow to images, which are part of 'Image ad' ad type.
191
  add_action( 'wp_head', array( $this, 'noindex_attachment_images' ) );
192
 
193
+ // check if ads are disabled in secondary queries.
194
  add_action( 'the_post', array( $this, 'set_query_type' ), 10, 2 );
195
 
 
196
  }
197
 
198
  /**
199
+ * Allow add-ons to hook
200
  */
201
  public function advanced_ads_loaded() {
202
  do_action( 'advanced-ads-plugin-loaded' );
203
  }
204
+
205
  /**
206
+ * Init / load plugin specific functions and settings
207
  *
208
  * @since 1.0.0
209
  */
210
+ public function wp_init() {
211
+ // load ad post types.
212
  $this->create_post_types();
213
+ // set ad types array.
214
  $this->set_ad_types();
215
  }
216
 
217
  /**
218
+ * Define ad types with their options
 
219
  * name => publically readable name
220
  * description => publically readable description
221
  * editor => kind of editor: text (normal text field), content (WP content field), none (no content field)
226
  public function set_ad_types() {
227
 
228
  /**
229
+ * Load default ad type files
230
  * custom ad types can also be loaded in your own plugin or functions.php
231
  */
232
  $types = array();
233
 
234
  /**
235
+ * Developers can add new ad types using this filter
236
  * see classes/ad-type-content.php for an example for an ad type and usage of this filter
237
  */
238
  $this->ad_types = apply_filters( 'advanced-ads-ad-types', $types );
239
  }
240
 
241
+ /**
242
+ * Load filters to inject ads into various sections of our site
243
+ */
244
  public function init_injection() {
245
  // -TODO abstract
246
  add_action( 'wp_head', array( $this, 'inject_header' ), 20 );
249
  }
250
 
251
  /**
252
+ * Set global constant that prevents ads from being displayed on the current page view
253
  *
254
  * @since 1.3.10
255
  */
256
+ public function set_disabled_constant() {
257
 
258
  global $post, $wp_the_query;
259
 
260
+ // don't set the constant if already defined.
261
+ if ( defined( 'ADVADS_ADS_DISABLED' ) ) {
262
+ return; }
263
 
264
  $options = $this->plugin->options();
265
 
266
+ // check if ads are disabled completely.
267
+ if ( ! empty( $options['disabled-ads']['all'] ) ) {
268
  define( 'ADVADS_ADS_DISABLED', true );
269
  return;
270
  }
271
 
272
+ // check if ads are disabled from 404 pages.
273
+ if ( $wp_the_query->is_404() && ! empty( $options['disabled-ads']['404'] ) ) {
274
  define( 'ADVADS_ADS_DISABLED', true );
275
  return;
276
  }
277
 
278
+ // check if ads are disabled from non singular pages (often = archives).
279
+ if ( ! $wp_the_query->is_singular() && ! empty( $options['disabled-ads']['archives'] ) ) {
280
  define( 'ADVADS_ADS_DISABLED', true );
281
  return;
282
  }
283
 
284
+ // check if ads are disabled in Feed.
285
  if ( $wp_the_query->is_feed() && ( ! isset( $options['disabled-ads']['feed'] ) || $options['disabled-ads']['feed'] ) ) {
286
  define( 'ADVADS_ADS_DISABLED', true );
287
  return;
288
  }
289
 
290
+ // check if ads are disabled on the current page.
291
+ if ( $wp_the_query->is_singular() && isset( $post->ID ) ) {
292
  $post_ad_options = get_post_meta( $post->ID, '_advads_ad_settings', true );
293
 
294
+ if ( ! empty( $post_ad_options['disable_ads'] ) ) {
295
  define( 'ADVADS_ADS_DISABLED', true );
296
  }
297
  };
298
+
299
  /**
300
+ * Check if ads are disabled on WooCommerce shop page (and currently on shop page).
301
+ * since WooCommerce changes the post ID of the static page selected to be the product overview page, we need to get the original page id from the WC options.
302
  */
303
  if ( function_exists( 'is_shop' ) && is_shop() ) {
304
+ $shop_id = get_option( 'woocommerce_shop_page_id' );
305
  $shop_ad_options = get_post_meta( absint( $shop_id ), '_advads_ad_settings', true );
306
  if ( ! empty( $shop_ad_options['disable_ads'] ) ) {
307
  define( 'ADVADS_ADS_DISABLED', true );
320
  }
321
 
322
  /**
323
+ * Add plain and content ad types to the default ads of the plugin using a filter
324
  *
325
+ * @param arr $types array with ad types.
326
  * @since 1.0.0
 
327
  */
328
+ public function setup_default_ad_types( $types ) {
329
+ $types['plain'] = new Advanced_Ads_Ad_Type_Plain(); /* plain text and php code */
330
+ $types['dummy'] = new Advanced_Ads_Ad_Type_Dummy(); /* dummy ad */
331
  $types['content'] = new Advanced_Ads_Ad_Type_Content(); /* rich content editor */
332
+ $types['image'] = new Advanced_Ads_Ad_Type_Image(); /* image ads */
333
+ $types['group'] = new Advanced_Ads_Ad_Type_Group(); /* group ad */
334
  return $types;
335
  }
336
 
337
  /**
338
+ * Log error messages when debug is enabled
339
  *
340
+ * @param string $message error message.
341
  * @since 1.0.0
342
  * @link http://www.smashingmagazine.com/2011/03/08/ten-things-every-wordpress-plugin-developer-should-know/
343
  */
344
+ public static function log( $message ) {
345
  if ( true === WP_DEBUG ) {
346
  if ( is_array( $message ) || is_object( $message ) ) {
347
+ error_log( __( 'Advanced Ads Error following:', 'advanced-ads' ) );
348
  error_log( print_r( $message, true ) );
349
  } else {
350
+ // translators: %s is an error message generated by the plugin.
351
  $message = sprintf( __( 'Advanced Ads Error: %s', 'advanced-ads' ), $message );
352
  error_log( $message );
353
  }
354
  }
355
  }
356
 
357
+ /**
358
+ * Compat method
359
+ *
360
+ * @return array with plugin options
361
+ */
362
  public function options() {
363
  return $this->plugin->options();
364
  }
365
 
366
+ /**
367
+ * Compat method
368
+ *
369
+ * @return array with internal plugin options
370
+ */
371
  public function internal_options() {
372
  return $this->plugin->internal_options();
373
  }
374
 
375
  /**
376
+ * Injected ad into header
377
  *
378
  * @since 1.1.0
379
  */
380
+ public function inject_header() {
381
  $placements = get_option( 'advads-ads-placements', array() );
382
+ if ( is_array( $placements ) ) {
383
+ foreach ( $placements as $_placement_id => $_placement ) {
384
+ if ( isset( $_placement['type'] ) && 'header' === $_placement['type'] ) {
385
  $_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
386
  echo Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options );
387
  }
390
  }
391
 
392
  /**
393
+ * Injected ads into footer
394
  *
395
  * @since 1.1.0
396
  */
397
+ public function inject_footer() {
398
  $placements = get_option( 'advads-ads-placements', array() );
399
+ if ( is_array( $placements ) ) {
400
+ foreach ( $placements as $_placement_id => $_placement ) {
401
+ if ( isset( $_placement['type'] ) && 'footer' === $_placement['type'] ) {
402
  $_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
403
  echo Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options );
404
  }
407
  }
408
 
409
  /**
410
+ * Injected ad into content (before and after)
411
+ * Displays ALL ads
412
  *
413
  * @since 1.1.0
414
+ * @param str $content post content.
415
  */
416
+ public function inject_content( $content = '' ) {
417
  $options = $this->plugin->options();
418
 
419
+ // do not inject in content when on a BuddyPress profile upload page (avatar & cover image).
420
  if ( ( function_exists( 'bp_is_user_change_avatar' ) && bp_is_user_change_avatar() ) || ( function_exists( 'bp_is_user_change_cover_image' ) && bp_is_user_change_cover_image() ) ) {
421
  return $content;
422
  }
423
+
424
+ // check if ads are disabled in secondary queries and this function was called by ajax (in secondary query).
425
  if ( ! empty( $options['disabled-ads']['secondary'] ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
426
  return $content;
427
  }
428
 
429
+ // run only within the loop on single pages of public post types.
430
+ $public_post_types = get_post_types(
431
+ array(
432
+ 'public' => true,
433
+ 'publicly_queryable' => true,
434
+ ), 'names', 'or'
435
+ );
436
 
437
+ // make sure that no ad is injected into another ad.
438
+ if ( get_post_type() === self::POST_TYPE_SLUG ) {
439
  return $content;
440
  }
441
+
442
+ // check if admin allows injection in all places.
443
+ if ( ! isset( $options['content-injection-everywhere'] ) || 0 === $options['content-injection-everywhere'] ) {
444
+ // check if this is a singular page within the loop or an AMP page.
445
+ $is_amp = advads_is_amp();
446
+ if ( ( ! is_singular( $public_post_types ) && ! is_feed() ) || ( ! $is_amp && ! in_the_loop() ) ) {
447
+ return $content; }
448
  } else {
449
+ global $wp_query;
450
+ if ( is_main_query() && 'true' !== $options['content-injection-everywhere'] && isset( $wp_query->current_post ) && $wp_query->current_post >= ( $options['content-injection-everywhere'] ) ) {
451
+ return $content;
452
+ }
453
+ }
454
 
455
  $placements = get_option( 'advads-ads-placements', array() );
456
 
457
+ if ( ! apply_filters( 'advanced-ads-can-inject-into-content', true, $content, $placements ) ) {
458
  return $content;
459
  }
460
 
461
+ if ( is_array( $placements ) ) {
462
+ foreach ( $placements as $_placement_id => $_placement ) {
463
+ if ( empty( $_placement['item'] ) || ! isset( $_placement['type'] ) ) {
464
+ continue; }
465
  $_options = isset( $_placement['options'] ) ? $_placement['options'] : array();
466
 
467
+ // check if injection is ok for a specific placement ID.
468
+ if ( ! apply_filters( 'advanced-ads-can-inject-into-content-' . $_placement_id, true, $content, $_placement_id ) ) {
469
  continue;
470
  }
471
 
472
  switch ( $_placement['type'] ) {
473
  case 'post_top':
 
474
  $content = Advanced_Ads_Select::get_instance()->get_ad_by_method( $_placement_id, Advanced_Ads_Select::PLACEMENT, $_options ) . $content;
475
  break;
476
  case 'post_bottom':
487
  }
488
 
489
  /**
490
+ * Load all ads based on WP_Query conditions
491
  *
492
  * @deprecated 1.4.8 use model class
493
  * @since 1.1.0
494
+ * @param arr $args WP_Query arguments that are more specific that default.
495
  * @return arr $ads array with post objects
496
  */
497
+ public static function get_ads( $args = array() ) {
498
+ return self::get_instance()->get_model()->get_ads( $args );
499
  }
500
 
501
  /**
502
+ * Load all ad groups
503
  *
504
  * @deprecated 1.4.8 use model class
505
  * @since 1.1.0
506
+ * @param arr $args array with options.
507
  * @return arr $groups array with ad groups
508
  * @link http://codex.wordpress.org/Function_Reference/get_terms
509
  */
510
+ public static function get_ad_groups( $args = array() ) {
511
+ return self::get_instance()->get_model()->get_ad_groups( $args );
512
  }
513
 
514
  /**
515
+ * Get the array with ad placements
516
  *
517
  * @since 1.1.0
518
  * @deprecated 1.4.8 use model
519
  * @return arr $ad_placements
520
  */
521
+ public static function get_ad_placements_array() {
522
  return self::get_instance()->get_model()->get_ad_placements_array();
523
  }
524
 
525
  /**
526
+ * Get ad conditions.
527
  *
528
  * @deprecated 1.4.8 use model
529
  * @return array
533
  }
534
 
535
  /**
536
+ * General check if ads can be displayed for the whole page impression
537
  *
538
  * @since 1.4.9
539
+ * @return bool true, if ads can be displayed.
540
+ * @todo move this to set_disabled_constant().
541
  */
542
+ public function can_display_ads() {
543
 
544
+ // check global constant if ads are enabled or disabled.
545
  if ( defined( 'ADVADS_ADS_DISABLED' ) ) {
546
  return false;
547
  }
548
 
549
  $options = $this->options();
550
 
551
+ // check if ads are disabled in secondary queries.
552
+ // and this is not main query and this is not ajax (because main query does not exist in ajax but ad needs to be shown).
553
  if ( ! empty( $options['disabled-ads']['secondary'] ) && ! $this->is_main_query() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
554
  return false;
555
  }
556
 
557
+ $see_ads_capability = isset( $options['hide-for-user-role'] ) && '' !== $options['hide-for-user-role'] ? $options['hide-for-user-role'] : false;
558
 
559
+ // check if user is logged in and if so if users with his rights can see ads.
560
  if ( $see_ads_capability && is_user_logged_in() && current_user_can( $see_ads_capability ) ) {
561
  return false;
562
  }
563
 
564
+ // check bots if option is enabled.
565
  if ( ( isset( $options['block-bots'] ) && $options['block-bots']
566
  && ! $this->is_cache_bot() && $this->is_bot() ) ) {
567
  return false;
571
  }
572
 
573
  /**
574
+ * Check if the current user agent is given or a bot
575
  *
576
  * @since 1.4.9
577
+ * @return bool true if the current user agent is empty or a bot.
578
  */
579
+ public function is_bot() {
580
+ // show ads on AMP version also for bots in order to allow Google (and maybe others) to cache the page.
581
  if ( advads_is_amp() ) {
582
  return false;
583
  }
584
 
585
+ $bots = apply_filters( 'advanced-ads-bots', $this->bots );
586
 
587
+ $bots = implode( '|', $bots );
588
+ $bots = preg_replace( '@[^-_;/|\][ :.!a-z0-9]@i', '', $bots );
 
 
589
  $regex = "@$bots@i";
590
 
591
+ if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && '' !== $_SERVER['HTTP_USER_AGENT'] ) {
592
+ $agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) );
593
 
594
+ return preg_match( $regex, $agent ) === 1;
595
  }
596
 
597
  return true;
598
  }
599
 
600
  /**
601
+ * Check if the current user is a bot prepopulating the cache
602
+ * Ads should be loaded for the bot, because they should show up on the cached site
603
  *
604
  * @return bool
605
  */
606
+ public function is_cache_bot() {
607
+ if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && '' !== $_SERVER['HTTP_USER_AGENT'] ) {
608
+ // WP Rocket.
609
+ if ( false !== strpos( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ), 'wprocketbot' ) ) {
610
  return true;
611
  }
612
 
613
  // WP Super Cache.
614
  $wp_useragent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) );
615
+ if ( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) === $wp_useragent ) {
616
  return true;
617
  }
618
  }
630
  return;
631
  }
632
 
633
+ // register ad group taxonomy.
634
+ if ( ! taxonomy_exists( self::AD_GROUP_TAXONOMY ) ) {
635
  $post_type_params = $this->get_group_taxonomy_params();
636
+ register_taxonomy( self::AD_GROUP_TAXONOMY, array( self::POST_TYPE_SLUG ), $post_type_params );
637
  }
638
 
639
+ // register ad post type.
640
+ if ( ! post_type_exists( self::POST_TYPE_SLUG ) ) {
641
  $post_type_params = $this->get_post_type_params();
642
+ register_post_type( self::POST_TYPE_SLUG, $post_type_params );
643
  }
644
  }
645
 
649
  * @since 1.0.0
650
  * @return array
651
  */
652
+ protected function get_group_taxonomy_params() {
653
  $labels = array(
654
  'name' => _x( 'Ad Groups & Rotations', 'ad group general name', 'advanced-ads' ),
655
  'singular_name' => _x( 'Ad Group', 'ad group singular name', 'advanced-ads' ),
666
  );
667
 
668
  $args = array(
669
+ 'public' => false,
670
  'hierarchical' => true,
671
  'labels' => $labels,
672
  'show_ui' => true,
688
  */
689
  protected function get_post_type_params() {
690
  $labels = array(
691
+ 'name' => __( 'Ads', 'advanced-ads' ),
692
+ 'singular_name' => __( 'Ad', 'advanced-ads' ),
693
+ 'add_new' => __( 'New Ad', 'advanced-ads' ),
694
+ 'add_new_item' => __( 'Add New Ad', 'advanced-ads' ),
695
+ 'edit' => __( 'Edit', 'advanced-ads' ),
696
+ 'edit_item' => __( 'Edit Ad', 'advanced-ads' ),
697
+ 'new_item' => __( 'New Ad', 'advanced-ads' ),
698
+ 'view' => __( 'View', 'advanced-ads' ),
699
+ 'view_item' => __( 'View the Ad', 'advanced-ads' ),
700
+ 'search_items' => __( 'Search Ads', 'advanced-ads' ),
701
+ 'not_found' => __( 'No Ads found', 'advanced-ads' ),
702
  'not_found_in_trash' => __( 'No Ads found in Trash', 'advanced-ads' ),
703
+ 'parent' => __( 'Parent Ad', 'advanced-ads' ),
704
  );
705
+
706
  $supports = array( 'title' );
707
+ if ( defined( 'ADVANCED_ADS_ENABLE_REVISIONS' ) ) {
708
+ $supports[] = 'revisions';
709
  };
710
 
711
  $post_type_params = array(
712
+ 'labels' => $labels,
713
+ 'public' => false,
714
+ 'show_ui' => true,
715
  'show_in_menu' => false,
716
  'hierarchical' => false,
717
  'capabilities' => array(
718
+ // Meta capabilities.
719
+ 'edit_post' => 'advanced_ads_edit_ads',
720
+ 'read_post' => 'advanced_ads_edit_ads',
721
+ 'delete_post' => 'advanced_ads_edit_ads',
722
+ 'edit_page' => 'advanced_ads_edit_ads',
723
+ 'read_page' => 'advanced_ads_edit_ads',
724
+ 'delete_page' => 'advanced_ads_edit_ads',
725
+ // Primitive capabilities used outside of map_meta_cap().
726
+ 'edit_posts' => 'advanced_ads_edit_ads',
727
+ 'edit_others_posts' => 'advanced_ads_edit_ads',
728
+ 'publish_posts' => 'advanced_ads_edit_ads',
729
+ 'read_private_posts' => 'advanced_ads_edit_ads',
730
+ // Primitive capabilities used within map_meta_cap().
731
+ 'read' => 'advanced_ads_edit_ads',
732
+ 'delete_posts' => 'advanced_ads_edit_ads',
733
+ 'delete_private_posts' => 'advanced_ads_edit_ads',
734
  'delete_published_posts' => 'advanced_ads_edit_ads',
735
+ 'delete_others_posts' => 'advanced_ads_edit_ads',
736
+ 'edit_private_posts' => 'advanced_ads_edit_ads',
737
+ 'edit_published_posts' => 'advanced_ads_edit_ads',
738
+ 'create_posts' => 'advanced_ads_edit_ads',
739
  ),
740
+ 'has_archive' => false,
741
+ 'query_var' => true,
742
+ 'supports' => $supports,
743
+ 'taxonomies' => array( self::AD_GROUP_TAXONOMY ),
 
744
  );
745
+
746
  return apply_filters( 'advanced-ads-post-type-params', $post_type_params );
747
  }
748
 
749
  /**
750
+ * Manipulate output of ad widget
751
  *
752
  * @since 1.6.8.2
753
+ * @param arr $params widget and sidebar params.
754
  */
755
+ public function manipulate_widget_output( $params = array() ) {
756
 
757
+ if ( 'Advanced Ads' === $params[0]['widget_name'] ) {
758
 
759
+ $options = $this->plugin->options();
760
+ // hide id by default (when options are empty) or when option is enabled.
761
+ if ( array() === $options || ( isset( $options['remove-widget-id'] ) && $options['remove-widget-id'] ) ) {
762
+ $pattern = '#\s(id)=("|\')[^"^\']+("|\')#';
763
+ $params[0]['before_widget'] = preg_replace( $pattern, '', $params[0]['before_widget'] );
764
+ }
765
+ }
766
 
767
+ return $params;
768
  }
769
 
770
  /**
771
  * Add meta robots noindex, nofollow to images, which are part of 'Image ad' ad type
772
  */
773
+ public function noindex_attachment_images() {
774
  global $post;
775
+ // if the image was not attached to any post.
776
+ if ( is_attachment() && is_object( $post ) && isset( $post->post_parent ) && 0 === $post->post_parent ) {
777
+ // if at least one ad contains the image.
778
  if ( get_post_meta( get_the_ID(), '_advanced-ads_parent_id', true ) > 0 ) {
779
  echo '<meta name="robots" content="noindex, nofollow" />';
780
  }
784
  /**
785
  * Supports the "$this->is_main_query=true" while main query is being executed
786
  *
787
+ * @param WP_Post $post The Post object (passed by reference).
788
+ * @param WP_Query $query The current Query object (passed by reference).
789
  */
790
+ public function set_query_type( $post, $query = null ) {
791
  if ( $query instanceof WP_Query ) {
792
  $this->is_main_query = $query->is_main_query();
793
  }
800
  */
801
  public function is_main_query() {
802
  if ( ! in_the_loop() ) {
803
+ // the secondary query check only designed for within post content.
804
  return true;
805
  }
806
 
807
+ return true === $this->is_main_query;
808
  }
809
 
810
  /**
811
+ * Get an "Advertisement" label to use before single ad or before first ad in a group
812
  *
813
+ * @param string $placement_state default/enabled/disabled.
814
+ * @return string label, empty string if label should not be displayed.
815
  */
816
  public function get_label( $placement_state = 'default' ) {
817
+ if ( 'disabled' === $placement_state ) {
818
  return '';
819
  }
820
 
821
+ $advads_options = self::get_instance()->options();
822
 
823
+ if ( 'enabled' !== $placement_state && empty( $advads_options['custom-label']['enabled'] ) ) {
824
  return '';
825
  }
826
 
829
  $template = sprintf( '<div class="%s">%s</div>', Advanced_Ads_Plugin::get_instance()->get_frontend_prefix() . 'adlabel', $label );
830
  return apply_filters( 'advanced-ads-custom-label', $template, $label );
831
  }
832
+
833
  /**
834
+ * Retrieve the number of ads in any status except trash
835
  */
836
+ public static function get_number_of_ads() {
837
+ // query number of ads only, if not retrieved, yet.
838
+ if ( self::get_instance()->number_of_ads === false ) {
839
+ $args = array( 'post_status' => 'any' );
840
+ $recent_ads = self::get_instance()->get_model()->get_ads( $args );
841
+ self::get_instance()->number_of_ads = count( $recent_ads );
842
+ }
843
+
844
+ return self::get_instance()->number_of_ads;
845
  }
846
 
847
  /**
848
  * Switch the current blog.
849
  *
850
+ * @param int $blog_id ID of the blog in the WP network.
851
  */
852
  public function switch_to_blog( $blog_id ) {
853
  if ( is_multisite() ) {
854
  switch_to_blog( $blog_id );
855
+ self::get_instance()->get_model()->reset_placement_array();
856
  }
857
  }
858
 
862
  public function restore_current_blog() {
863
  if ( is_multisite() ) {
864
  restore_current_blog();
865
+ self::get_instance()->get_model()->reset_placement_array();
866
  }
867
  }
868
  }
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
- === Advanced Ads ===
2
  Contributors: webzunft
3
  Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RRRCEBGN3UT2
4
- Tags: ads, ad manager, ad widget, ad rotation, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banners, buysellads, chitika, clickbank, dfp, doubleclick, geotarget, geolocation, geo location, google dfp, monetization, widget
5
  Requires at least: 4.6
6
  Tested up to: 4.9
7
  Requires PHP: 5.2
8
- Stable tag: 1.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -20,7 +20,7 @@ Are you looking for a simple ad manager plugin? These are the top arguments to u
20
  * most features to test and optimize ads
21
  * unlimited ad units
22
  * [GDPR support](https://wpadvancedads.com/manual/ad-cookie-consent/): hide ads until consent is given
23
- * works with all ad types and networks (e.g. AdSense or Amazon)
24
  * the only solution with *Ad Health* integration and AdSense violation checks
25
  * best rated [free support](https://wordpress.org/support/plugin/advanced-ads)
26
 
@@ -43,13 +43,13 @@ I built Advanced Ads based on my experience delivering millions of ads per month
43
 
44
  choose between different ad types that enable you to:
45
 
46
- * insert code for any ad and affiliate networks (e.g., AdSense, Chitika, Amazon, BuySellAds, DoubleClick, media.net, … )
47
  * dedicated support for all types of Google AdSense banners, including Responsive, InFeed and InArticle ads
48
  * display images and image banners
49
  * create content-rich ads with the WordPress TinyMCE editor
50
  * use shortcodes within ads (to also deliver advertisements from other ad plugins like Ad Inserter, AdRotate or the AdSense Plugin WP QUADS)
51
 
52
- = display ads =
53
 
54
  * use functions to display ads in template files
55
  * use shortcodes to place them manually in post content
@@ -94,14 +94,15 @@ Placements to insert ads in pre-defined positions in your theme and content. [Li
94
 
95
  = mobile devices =
96
 
97
- * display ads for mobile and tablets or desktop only
98
  * display responsive image ads
99
  * ads for specific browser sizes only using [Responsive Ads](https://wpadvancedads.com/add-ons/responsive-ads/)
100
  * insert ads on AMP pages with [Responsive Ads](https://wpadvancedads.com/add-ons/responsive-ads/)
101
 
102
  = Google AdSense =
103
 
104
- * supports all AdSense ad types, including AdSense display ads, AdSense link units, AdSense In-feed, AdSense In-article, and AdSense matched content
 
105
  * change type and sizes of an ad without going into your AdSense account
106
  * optional limit to 3 AdSense banners
107
  * hide AdSense advertisements on 404 pages by default (to comply with AdSense terms)
@@ -122,7 +123,7 @@ Learn more on the [plugin homepage](https://wpadvancedads.com).
122
 
123
  Thank you for motivating us with your [positive review](https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post).
124
 
125
- Localizations: English, German, French, Spanish, Dutch, Italian, Portuguese, Vietnamese
126
 
127
  > <strong>Add-Ons</strong>
128
  >
@@ -166,6 +167,16 @@ How to install the plugin and get it working?
166
 
167
  == Frequently Asked Questions ==
168
 
 
 
 
 
 
 
 
 
 
 
169
  = What about my users’ privacy and GDPR? =
170
 
171
  You can show ads only to visitors that give their consent. See [GDPR support](https://wpadvancedads.com/manual/ad-cookie-consent/).
@@ -178,7 +189,7 @@ You can learn more about how Advanced Ads and its add-ons handles data and priva
178
 
179
  = Which ad networks are supported? =
180
 
181
- Advanced Ads is compatible with all ad networks and banners from affiliate programs like Google AdSense, Chitika, Clickbank, Amazon, and also Google Double Click (DFP), media.net.
182
 
183
  You can also use it to insert additional ad network tags into header or footer of your site without coding.
184
 
@@ -217,7 +228,7 @@ Yes. I would add a "Manual" placement into your theme files. It would allow you
217
 
218
  Yes. Advanced Ads can be combined with other ad plugins.
219
  Just use their shortcodes in our "Rich Media" ad type to combine both features.
220
- Works with AdRotate, Ad Inserter, Ad Injection, Quick AdSense, QuickAdSense Reloaded (WPQUADS), Simple Ads Manager, and other plugins.
221
 
222
  = Can I use Flash ads? =
223
 
@@ -253,6 +264,21 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
253
 
254
  == Changelog ==
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  = 1.9 =
257
 
258
  * added Privacy module to hide ads until consent is given, see new [Privacy settings](https://wpadvancedads.com/manual/ad-cookie-consent/)
1
+ === Advanced Ads – Ad Manager with AdSense Integration ===
2
  Contributors: webzunft
3
  Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RRRCEBGN3UT2
4
+ Tags: ads, ad manager, ad widget, ad rotation, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banner ads, banners, buysellads, chitika, clickbank, dfp, doubleclick, double click, geotarget, geolocation, geo location, google dfp, google ad manager, monetization, widget, wordpress, wordpress ads
5
  Requires at least: 4.6
6
  Tested up to: 4.9
7
  Requires PHP: 5.2
8
+ Stable tag: 1.10
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
20
  * most features to test and optimize ads
21
  * unlimited ad units
22
  * [GDPR support](https://wpadvancedads.com/manual/ad-cookie-consent/): hide ads until consent is given
23
+ * works with all ad types and networks (e.g. AdSense or Amazon ads)
24
  * the only solution with *Ad Health* integration and AdSense violation checks
25
  * best rated [free support](https://wordpress.org/support/plugin/advanced-ads)
26
 
43
 
44
  choose between different ad types that enable you to:
45
 
46
+ * insert code for any ad and affiliate networks (e.g., AdSense, Chitika, Amazon, BuySellAds, Google Ad Manager, DoubleClick, Ezoic, media.net, … )
47
  * dedicated support for all types of Google AdSense banners, including Responsive, InFeed and InArticle ads
48
  * display images and image banners
49
  * create content-rich ads with the WordPress TinyMCE editor
50
  * use shortcodes within ads (to also deliver advertisements from other ad plugins like Ad Inserter, AdRotate or the AdSense Plugin WP QUADS)
51
 
52
+ = display ads for WP =
53
 
54
  * use functions to display ads in template files
55
  * use shortcodes to place them manually in post content
94
 
95
  = mobile devices =
96
 
97
+ * display ads on mobile and tablets or desktop only
98
  * display responsive image ads
99
  * ads for specific browser sizes only using [Responsive Ads](https://wpadvancedads.com/add-ons/responsive-ads/)
100
  * insert ads on AMP pages with [Responsive Ads](https://wpadvancedads.com/add-ons/responsive-ads/)
101
 
102
  = Google AdSense =
103
 
104
+ * pull ad units directly from your AdSense account
105
+ * supports all AdSense ad types, including AdSense display ads, AdSense link units, and native ads like AdSense In-feed, AdSense In-article, and AdSense matched content
106
  * change type and sizes of an ad without going into your AdSense account
107
  * optional limit to 3 AdSense banners
108
  * hide AdSense advertisements on 404 pages by default (to comply with AdSense terms)
123
 
124
  Thank you for motivating us with your [positive review](https://wordpress.org/support/plugin/advanced-ads/reviews/?rate=5#new-post).
125
 
126
+ Localizations: English, German, French, Spanish, Italian, Dutch, Portuguese, Japanese, Vietnamese, Slovak, Norwegian, Turkish
127
 
128
  > <strong>Add-Ons</strong>
129
  >
167
 
168
  == Frequently Asked Questions ==
169
 
170
+ = How to put ads on WordPress? =
171
+
172
+ You can use Advanced Ads to insert ads into your WordPress site without any coding.
173
+
174
+ To get started, just take a look at
175
+
176
+ * the [general first ad tutorial](https://wpadvancedads.com/manual/first-ad/)
177
+ * using [AdSense Auto ads] in WordPress (https://wpadvancedads.com/adsense-auto-ads-wordpress/)
178
+ * the [AdSense overview page](https://wpadvancedads.com/manual/adsense-ads).
179
+
180
  = What about my users’ privacy and GDPR? =
181
 
182
  You can show ads only to visitors that give their consent. See [GDPR support](https://wpadvancedads.com/manual/ad-cookie-consent/).
189
 
190
  = Which ad networks are supported? =
191
 
192
+ Advanced Ads is compatible with all ad networks and banners from affiliate programs like Google AdSense, Chitika, Clickbank, Amazon, and also Google Ad Manager (Google Double Click, DFP), media.net.
193
 
194
  You can also use it to insert additional ad network tags into header or footer of your site without coding.
195
 
228
 
229
  Yes. Advanced Ads can be combined with other ad plugins.
230
  Just use their shortcodes in our "Rich Media" ad type to combine both features.
231
+ Works with AdRotate, Ad Inserter, Ad Injection, Quick AdSense, Quick AdSense Reloaded (WPQUADS), Simple Ads Manager, and other plugins.
232
 
233
  = Can I use Flash ads? =
234
 
264
 
265
  == Changelog ==
266
 
267
+ = 1.10 =
268
+
269
+ * added AdSense integration
270
+ * added sub menus to setting pages
271
+ * added name to taxonomies in Display Conditions if the same label is repeated
272
+ * added clearfix option to fix possible layout issue with AdSense responsive ads
273
+ * removed title attribute from image ads
274
+ * plugin update warning now only appears for Advanced Ads plugin and add-ons
275
+ * rewritten filters on ad list to work with all ads not just those on the current page
276
+ * allowed to create new placement with same name
277
+ * fixed issue with license activations on sites using the Multilanguage by BestWebSoft plugin
278
+ * fixed duplicate queries in backend
279
+ * fixed possible conflict between assets created by the Ad Blocker module
280
+ * WP Rocket: compatibility with the recent version of deferred JavaScript
281
+
282
  = 1.9 =
283
 
284
  * added Privacy module to hide ads until consent is given, see new [Privacy settings](https://wpadvancedads.com/manual/ad-cookie-consent/)
vendor/autoload.php CHANGED
@@ -2,6 +2,6 @@
2
 
3
  // autoload.php @generated by Composer
4
 
5
- require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
  return ComposerAutoloaderInitd24de3c06687d3cf4aad0b15c83747be::getLoader();
2
 
3
  // autoload.php @generated by Composer
4
 
5
+ require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
  return ComposerAutoloaderInitd24de3c06687d3cf4aad0b15c83747be::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit5ae8dad84deb2106336f0180e962d503::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit7e435a20ca545f8783e709e05dbdc63b::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -13,7 +13,9 @@
13
  namespace Composer\Autoload;
14
 
15
  /**
16
- * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
 
 
17
  *
18
  * $loader = new \Composer\Autoload\ClassLoader();
19
  *
@@ -37,8 +39,6 @@ namespace Composer\Autoload;
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see http://www.php-fig.org/psr/psr-0/
41
- * @see http://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
@@ -53,9 +53,8 @@ class ClassLoader
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
 
56
  private $classMapAuthoritative = false;
57
- private $missingClasses = array();
58
- private $apcuPrefix;
59
 
60
  public function getPrefixes()
61
  {
@@ -148,7 +147,7 @@ class ClassLoader
148
  * appending or prepending to the ones previously set for this namespace.
149
  *
150
  * @param string $prefix The prefix/namespace, with trailing '\\'
151
- * @param array|string $paths The PSR-4 base directories
152
  * @param bool $prepend Whether to prepend the directories
153
  *
154
  * @throws \InvalidArgumentException
@@ -272,26 +271,6 @@ class ClassLoader
272
  return $this->classMapAuthoritative;
273
  }
274
 
275
- /**
276
- * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
- *
278
- * @param string|null $apcuPrefix
279
- */
280
- public function setApcuPrefix($apcuPrefix)
281
- {
282
- $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
- }
284
-
285
- /**
286
- * The APCu prefix in use, or null if APCu caching is not enabled.
287
- *
288
- * @return string|null
289
- */
290
- public function getApcuPrefix()
291
- {
292
- return $this->apcuPrefix;
293
- }
294
-
295
  /**
296
  * Registers this instance as an autoloader.
297
  *
@@ -334,34 +313,29 @@ class ClassLoader
334
  */
335
  public function findFile($class)
336
  {
 
 
 
 
 
337
  // class map lookup
338
  if (isset($this->classMap[$class])) {
339
  return $this->classMap[$class];
340
  }
341
- if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
  return false;
343
  }
344
- if (null !== $this->apcuPrefix) {
345
- $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
- if ($hit) {
347
- return $file;
348
- }
349
- }
350
 
351
  $file = $this->findFileWithExtension($class, '.php');
352
 
353
  // Search for Hack files if we are running on HHVM
354
- if (false === $file && defined('HHVM_VERSION')) {
355
  $file = $this->findFileWithExtension($class, '.hh');
356
  }
357
 
358
- if (null !== $this->apcuPrefix) {
359
- apcu_add($this->apcuPrefix.$class, $file);
360
- }
361
-
362
- if (false === $file) {
363
  // Remember that this class does not exist.
364
- $this->missingClasses[$class] = true;
365
  }
366
 
367
  return $file;
@@ -374,14 +348,10 @@ class ClassLoader
374
 
375
  $first = $class[0];
376
  if (isset($this->prefixLengthsPsr4[$first])) {
377
- $subPath = $class;
378
- while (false !== $lastPos = strrpos($subPath, '\\')) {
379
- $subPath = substr($subPath, 0, $lastPos);
380
- $search = $subPath.'\\';
381
- if (isset($this->prefixDirsPsr4[$search])) {
382
- $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
- foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
- if (file_exists($file = $dir . $pathEnd)) {
385
  return $file;
386
  }
387
  }
@@ -429,8 +399,6 @@ class ClassLoader
429
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
  return $file;
431
  }
432
-
433
- return false;
434
  }
435
  }
436
 
13
  namespace Composer\Autoload;
14
 
15
  /**
16
+ * ClassLoader implements a PSR-0 class loader
17
+ *
18
+ * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
19
  *
20
  * $loader = new \Composer\Autoload\ClassLoader();
21
  *
39
  *
40
  * @author Fabien Potencier <fabien@symfony.com>
41
  * @author Jordi Boggiano <j.boggiano@seld.be>
 
 
42
  */
43
  class ClassLoader
44
  {
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
56
+
57
  private $classMapAuthoritative = false;
 
 
58
 
59
  public function getPrefixes()
60
  {
147
  * appending or prepending to the ones previously set for this namespace.
148
  *
149
  * @param string $prefix The prefix/namespace, with trailing '\\'
150
+ * @param array|string $paths The PSR-0 base directories
151
  * @param bool $prepend Whether to prepend the directories
152
  *
153
  * @throws \InvalidArgumentException
271
  return $this->classMapAuthoritative;
272
  }
273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  /**
275
  * Registers this instance as an autoloader.
276
  *
313
  */
314
  public function findFile($class)
315
  {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
  // class map lookup
322
  if (isset($this->classMap[$class])) {
323
  return $this->classMap[$class];
324
  }
325
+ if ($this->classMapAuthoritative) {
326
  return false;
327
  }
 
 
 
 
 
 
328
 
329
  $file = $this->findFileWithExtension($class, '.php');
330
 
331
  // Search for Hack files if we are running on HHVM
332
+ if ($file === null && defined('HHVM_VERSION')) {
333
  $file = $this->findFileWithExtension($class, '.hh');
334
  }
335
 
336
+ if ($file === null) {
 
 
 
 
337
  // Remember that this class does not exist.
338
+ return $this->classMap[$class] = false;
339
  }
340
 
341
  return $file;
348
 
349
  $first = $class[0];
350
  if (isset($this->prefixLengthsPsr4[$first])) {
351
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
+ if (0 === strpos($class, $prefix)) {
353
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
 
 
 
 
355
  return $file;
356
  }
357
  }
399
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
  return $file;
401
  }
 
 
402
  }
403
  }
404
 
vendor/composer/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
 
2
- Copyright (c) Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
1
 
2
+ Copyright (c) 2015 Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
vendor/composer/autoload_classmap.php CHANGED
@@ -12,6 +12,7 @@ return array(
12
  'Advanced_Ads_Ad' => $baseDir . '/classes/ad.php',
13
  'Advanced_Ads_Ad_Ajax_Callbacks' => $baseDir . '/classes/ad_ajax_callbacks.php',
14
  'Advanced_Ads_Ad_Debug' => $baseDir . '/classes/ad-debug.php',
 
15
  'Advanced_Ads_Ad_Type_Abstract' => $baseDir . '/classes/ad_type_abstract.php',
16
  'Advanced_Ads_Ad_Type_Content' => $baseDir . '/classes/ad_type_content.php',
17
  'Advanced_Ads_Ad_Type_Dummy' => $baseDir . '/classes/ad_type_dummy.php',
@@ -44,93 +45,6 @@ return array(
44
  'Advanced_Ads_Utils' => $baseDir . '/classes/utils.php',
45
  'Advanced_Ads_Visitor_Conditions' => $baseDir . '/classes/visitor-conditions.php',
46
  'Advanced_Ads_Widget' => $baseDir . '/classes/widget.php',
47
- 'Composer\\Installers\\AglInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AglInstaller.php',
48
- 'Composer\\Installers\\AimeosInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AimeosInstaller.php',
49
- 'Composer\\Installers\\AnnotateCmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php',
50
- 'Composer\\Installers\\AsgardInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AsgardInstaller.php',
51
- 'Composer\\Installers\\AttogramInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AttogramInstaller.php',
52
- 'Composer\\Installers\\BaseInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BaseInstaller.php',
53
- 'Composer\\Installers\\BitrixInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BitrixInstaller.php',
54
- 'Composer\\Installers\\BonefishInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BonefishInstaller.php',
55
- 'Composer\\Installers\\CakePHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CakePHPInstaller.php',
56
- 'Composer\\Installers\\ChefInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ChefInstaller.php',
57
- 'Composer\\Installers\\ClanCatsFrameworkInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php',
58
- 'Composer\\Installers\\CockpitInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CockpitInstaller.php',
59
- 'Composer\\Installers\\CodeIgniterInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php',
60
- 'Composer\\Installers\\Concrete5Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Concrete5Installer.php',
61
- 'Composer\\Installers\\CraftInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CraftInstaller.php',
62
- 'Composer\\Installers\\CroogoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
63
- 'Composer\\Installers\\DecibelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
64
- 'Composer\\Installers\\DokuWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DokuWikiInstaller.php',
65
- 'Composer\\Installers\\DolibarrInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DolibarrInstaller.php',
66
- 'Composer\\Installers\\DrupalInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DrupalInstaller.php',
67
- 'Composer\\Installers\\ElggInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ElggInstaller.php',
68
- 'Composer\\Installers\\EliasisInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/EliasisInstaller.php',
69
- 'Composer\\Installers\\ExpressionEngineInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php',
70
- 'Composer\\Installers\\EzPlatformInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/EzPlatformInstaller.php',
71
- 'Composer\\Installers\\FuelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/FuelInstaller.php',
72
- 'Composer\\Installers\\FuelphpInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/FuelphpInstaller.php',
73
- 'Composer\\Installers\\GravInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/GravInstaller.php',
74
- 'Composer\\Installers\\HuradInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/HuradInstaller.php',
75
- 'Composer\\Installers\\ImageCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ImageCMSInstaller.php',
76
- 'Composer\\Installers\\Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Installer.php',
77
- 'Composer\\Installers\\ItopInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ItopInstaller.php',
78
- 'Composer\\Installers\\JoomlaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/JoomlaInstaller.php',
79
- 'Composer\\Installers\\KanboardInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KanboardInstaller.php',
80
- 'Composer\\Installers\\KirbyInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KirbyInstaller.php',
81
- 'Composer\\Installers\\KodiCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KodiCMSInstaller.php',
82
- 'Composer\\Installers\\KohanaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KohanaInstaller.php',
83
- 'Composer\\Installers\\LanManagementSystemInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php',
84
- 'Composer\\Installers\\LaravelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LaravelInstaller.php',
85
- 'Composer\\Installers\\LavaLiteInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LavaLiteInstaller.php',
86
- 'Composer\\Installers\\LithiumInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LithiumInstaller.php',
87
- 'Composer\\Installers\\MODULEWorkInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php',
88
- 'Composer\\Installers\\MODXEvoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODXEvoInstaller.php',
89
- 'Composer\\Installers\\MagentoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MagentoInstaller.php',
90
- 'Composer\\Installers\\MakoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MakoInstaller.php',
91
- 'Composer\\Installers\\MauticInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MauticInstaller.php',
92
- 'Composer\\Installers\\MayaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MayaInstaller.php',
93
- 'Composer\\Installers\\MediaWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MediaWikiInstaller.php',
94
- 'Composer\\Installers\\MicroweberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MicroweberInstaller.php',
95
- 'Composer\\Installers\\MoodleInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MoodleInstaller.php',
96
- 'Composer\\Installers\\OctoberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OctoberInstaller.php',
97
- 'Composer\\Installers\\OntoWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OntoWikiInstaller.php',
98
- 'Composer\\Installers\\OsclassInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OsclassInstaller.php',
99
- 'Composer\\Installers\\OxidInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OxidInstaller.php',
100
- 'Composer\\Installers\\PPIInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PPIInstaller.php',
101
- 'Composer\\Installers\\PhiftyInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PhiftyInstaller.php',
102
- 'Composer\\Installers\\PhpBBInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PhpBBInstaller.php',
103
- 'Composer\\Installers\\PimcoreInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PimcoreInstaller.php',
104
- 'Composer\\Installers\\PiwikInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PiwikInstaller.php',
105
- 'Composer\\Installers\\PlentymarketsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php',
106
- 'Composer\\Installers\\Plugin' => $vendorDir . '/composer/installers/src/Composer/Installers/Plugin.php',
107
- 'Composer\\Installers\\PortoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PortoInstaller.php',
108
- 'Composer\\Installers\\PrestashopInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PrestashopInstaller.php',
109
- 'Composer\\Installers\\PuppetInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PuppetInstaller.php',
110
- 'Composer\\Installers\\RadPHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
111
- 'Composer\\Installers\\ReIndexInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
112
- 'Composer\\Installers\\RedaxoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
113
- 'Composer\\Installers\\RoundcubeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RoundcubeInstaller.php',
114
- 'Composer\\Installers\\SMFInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
115
- 'Composer\\Installers\\ShopwareInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ShopwareInstaller.php',
116
- 'Composer\\Installers\\SilverStripeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SilverStripeInstaller.php',
117
- 'Composer\\Installers\\SyDESInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SyDESInstaller.php',
118
- 'Composer\\Installers\\Symfony1Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
119
- 'Composer\\Installers\\TYPO3CmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php',
120
- 'Composer\\Installers\\TYPO3FlowInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php',
121
- 'Composer\\Installers\\TheliaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TheliaInstaller.php',
122
- 'Composer\\Installers\\TuskInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TuskInstaller.php',
123
- 'Composer\\Installers\\UserFrostingInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/UserFrostingInstaller.php',
124
- 'Composer\\Installers\\VanillaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/VanillaInstaller.php',
125
- 'Composer\\Installers\\VgmcpInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/VgmcpInstaller.php',
126
- 'Composer\\Installers\\WHMCSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/WHMCSInstaller.php',
127
- 'Composer\\Installers\\WolfCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/WolfCMSInstaller.php',
128
- 'Composer\\Installers\\WordPressInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/WordPressInstaller.php',
129
- 'Composer\\Installers\\YawikInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/YawikInstaller.php',
130
- 'Composer\\Installers\\ZendInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ZendInstaller.php',
131
- 'Composer\\Installers\\ZikulaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
132
  'Yoast_I18n_WordPressOrg_v3' => $vendorDir . '/yoast/i18n-module/src/i18n-module-wordpressorg.php',
133
  'Yoast_I18n_v3' => $vendorDir . '/yoast/i18n-module/src/i18n-module.php',
134
- 'xrstf\\Composer52\\AutoloadGenerator' => $vendorDir . '/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php',
135
- 'xrstf\\Composer52\\Generator' => $vendorDir . '/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php',
136
  );
12
  'Advanced_Ads_Ad' => $baseDir . '/classes/ad.php',
13
  'Advanced_Ads_Ad_Ajax_Callbacks' => $baseDir . '/classes/ad_ajax_callbacks.php',
14
  'Advanced_Ads_Ad_Debug' => $baseDir . '/classes/ad-debug.php',
15
+ 'Advanced_Ads_Ad_List_Filters' => $baseDir . '/admin/includes/class-list-filters.php',
16
  'Advanced_Ads_Ad_Type_Abstract' => $baseDir . '/classes/ad_type_abstract.php',
17
  'Advanced_Ads_Ad_Type_Content' => $baseDir . '/classes/ad_type_content.php',
18
  'Advanced_Ads_Ad_Type_Dummy' => $baseDir . '/classes/ad_type_dummy.php',
45
  'Advanced_Ads_Utils' => $baseDir . '/classes/utils.php',
46
  'Advanced_Ads_Visitor_Conditions' => $baseDir . '/classes/visitor-conditions.php',
47
  'Advanced_Ads_Widget' => $baseDir . '/classes/widget.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  'Yoast_I18n_WordPressOrg_v3' => $vendorDir . '/yoast/i18n-module/src/i18n-module-wordpressorg.php',
49
  'Yoast_I18n_v3' => $vendorDir . '/yoast/i18n-module/src/i18n-module.php',
 
 
50
  );
vendor/composer/autoload_real.php CHANGED
@@ -23,26 +23,19 @@ class ComposerAutoloaderInitd24de3c06687d3cf4aad0b15c83747be
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
  spl_autoload_unregister(array('ComposerAutoloaderInitd24de3c06687d3cf4aad0b15c83747be', 'loadClassLoader'));
25
 
26
- $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
- if ($useStaticLoader) {
28
- require_once __DIR__ . '/autoload_static.php';
29
-
30
- call_user_func(\Composer\Autoload\ComposerStaticInitd24de3c06687d3cf4aad0b15c83747be::getInitializer($loader));
31
- } else {
32
- $map = require __DIR__ . '/autoload_namespaces.php';
33
- foreach ($map as $namespace => $path) {
34
- $loader->set($namespace, $path);
35
- }
36
-
37
- $map = require __DIR__ . '/autoload_psr4.php';
38
- foreach ($map as $namespace => $path) {
39
- $loader->setPsr4($namespace, $path);
40
- }
41
-
42
- $classMap = require __DIR__ . '/autoload_classmap.php';
43
- if ($classMap) {
44
- $loader->addClassMap($classMap);
45
- }
46
  }
47
 
48
  $loader->register(true);
@@ -50,3 +43,8 @@ class ComposerAutoloaderInitd24de3c06687d3cf4aad0b15c83747be
50
  return $loader;
51
  }
52
  }
 
 
 
 
 
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
  spl_autoload_unregister(array('ComposerAutoloaderInitd24de3c06687d3cf4aad0b15c83747be', 'loadClassLoader'));
25
 
26
+ $map = require __DIR__ . '/autoload_namespaces.php';
27
+ foreach ($map as $namespace => $path) {
28
+ $loader->set($namespace, $path);
29
+ }
30
+
31
+ $map = require __DIR__ . '/autoload_psr4.php';
32
+ foreach ($map as $namespace => $path) {
33
+ $loader->setPsr4($namespace, $path);
34
+ }
35
+
36
+ $classMap = require __DIR__ . '/autoload_classmap.php';
37
+ if ($classMap) {
38
+ $loader->addClassMap($classMap);
 
 
 
 
 
 
 
39
  }
40
 
41
  $loader->register(true);
43
  return $loader;
44
  }
45
  }
46
+
47
+ function composerRequired24de3c06687d3cf4aad0b15c83747be($file)
48
+ {
49
+ require $file;
50
+ }
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit5ae8dad84deb2106336f0180e962d503 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit5ae8dad84deb2106336f0180e962d503 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit5ae8dad84deb2106336f0180e962d503', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit5ae8dad84deb2106336f0180e962d503', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit7e435a20ca545f8783e709e05dbdc63b {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit7e435a20ca545f8783e709e05dbdc63b', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit7e435a20ca545f8783e709e05dbdc63b', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/installed.json CHANGED
@@ -32,19 +32,59 @@
32
  "MIT"
33
  ]
34
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  {
36
  "name": "composer/installers",
37
- "version": "v1.4.0",
38
- "version_normalized": "1.4.0.0",
39
  "source": {
40
  "type": "git",
41
  "url": "https://github.com/composer/installers.git",
42
- "reference": "9ce17fb70e9a38dd8acff0636a29f5cf4d575c1b"
43
  },
44
  "dist": {
45
  "type": "zip",
46
- "url": "https://api.github.com/repos/composer/installers/zipball/9ce17fb70e9a38dd8acff0636a29f5cf4d575c1b",
47
- "reference": "9ce17fb70e9a38dd8acff0636a29f5cf4d575c1b",
48
  "shasum": ""
49
  },
50
  "require": {
@@ -56,9 +96,9 @@
56
  },
57
  "require-dev": {
58
  "composer/composer": "1.0.*@dev",
59
- "phpunit/phpunit": "4.1.*"
60
  },
61
- "time": "2017-08-09 07:53:48",
62
  "type": "composer-plugin",
63
  "extra": {
64
  "class": "Composer\\Installers\\Plugin",
@@ -129,15 +169,18 @@
129
  "lavalite",
130
  "lithium",
131
  "magento",
 
132
  "mako",
133
  "mediawiki",
134
  "modulework",
 
135
  "moodle",
136
  "osclass",
137
  "phpbb",
138
  "piwik",
139
  "ppi",
140
  "puppet",
 
141
  "reindex",
142
  "roundcube",
143
  "shopware",
@@ -150,45 +193,5 @@
150
  "zend",
151
  "zikula"
152
  ]
153
- },
154
- {
155
- "name": "yoast/i18n-module",
156
- "version": "3.0.0",
157
- "version_normalized": "3.0.0.0",
158
- "source": {
159
- "type": "git",
160
- "url": "https://github.com/Yoast/i18n-module.git",
161
- "reference": "76b1645aaf8cf9a07dc06ec0bbe2a6838feeed4c"
162
- },
163
- "dist": {
164
- "type": "zip",
165
- "url": "https://api.github.com/repos/Yoast/i18n-module/zipball/76b1645aaf8cf9a07dc06ec0bbe2a6838feeed4c",
166
- "reference": "76b1645aaf8cf9a07dc06ec0bbe2a6838feeed4c",
167
- "shasum": ""
168
- },
169
- "time": "2017-09-06 07:17:52",
170
- "type": "library",
171
- "installation-source": "dist",
172
- "autoload": {
173
- "classmap": [
174
- "src/"
175
- ]
176
- },
177
- "notification-url": "https://packagist.org/downloads/",
178
- "license": [
179
- "GPL-2.0+"
180
- ],
181
- "authors": [
182
- {
183
- "name": "Team Yoast",
184
- "email": "support@yoast.com",
185
- "homepage": "https://yoast.com"
186
- }
187
- ],
188
- "description": "Handle i18n for WordPress plugins.",
189
- "homepage": "https://github.com/Yoast/i18n-module",
190
- "keywords": [
191
- "wordpress"
192
- ]
193
  }
194
  ]
32
  "MIT"
33
  ]
34
  },
35
+ {
36
+ "name": "yoast/i18n-module",
37
+ "version": "3.0.0",
38
+ "version_normalized": "3.0.0.0",
39
+ "source": {
40
+ "type": "git",
41
+ "url": "https://github.com/Yoast/i18n-module.git",
42
+ "reference": "76b1645aaf8cf9a07dc06ec0bbe2a6838feeed4c"
43
+ },
44
+ "dist": {
45
+ "type": "zip",
46
+ "url": "https://api.github.com/repos/Yoast/i18n-module/zipball/76b1645aaf8cf9a07dc06ec0bbe2a6838feeed4c",
47
+ "reference": "76b1645aaf8cf9a07dc06ec0bbe2a6838feeed4c",
48
+ "shasum": ""
49
+ },
50
+ "time": "2017-09-06 07:17:52",
51
+ "type": "library",
52
+ "installation-source": "dist",
53
+ "autoload": {
54
+ "classmap": [
55
+ "src/"
56
+ ]
57
+ },
58
+ "notification-url": "https://packagist.org/downloads/",
59
+ "license": [
60
+ "GPL-2.0+"
61
+ ],
62
+ "authors": [
63
+ {
64
+ "name": "Team Yoast",
65
+ "email": "support@yoast.com",
66
+ "homepage": "https://yoast.com"
67
+ }
68
+ ],
69
+ "description": "Handle i18n for WordPress plugins.",
70
+ "homepage": "https://github.com/Yoast/i18n-module",
71
+ "keywords": [
72
+ "wordpress"
73
+ ]
74
+ },
75
  {
76
  "name": "composer/installers",
77
+ "version": "v1.5.0",
78
+ "version_normalized": "1.5.0.0",
79
  "source": {
80
  "type": "git",
81
  "url": "https://github.com/composer/installers.git",
82
+ "reference": "049797d727261bf27f2690430d935067710049c2"
83
  },
84
  "dist": {
85
  "type": "zip",
86
+ "url": "https://api.github.com/repos/composer/installers/zipball/049797d727261bf27f2690430d935067710049c2",
87
+ "reference": "049797d727261bf27f2690430d935067710049c2",
88
  "shasum": ""
89
  },
90
  "require": {
96
  },
97
  "require-dev": {
98
  "composer/composer": "1.0.*@dev",
99
+ "phpunit/phpunit": "^4.8.36"
100
  },
101
+ "time": "2017-12-29 09:13:20",
102
  "type": "composer-plugin",
103
  "extra": {
104
  "class": "Composer\\Installers\\Plugin",
169
  "lavalite",
170
  "lithium",
171
  "magento",
172
+ "majima",
173
  "mako",
174
  "mediawiki",
175
  "modulework",
176
+ "modx",
177
  "moodle",
178
  "osclass",
179
  "phpbb",
180
  "piwik",
181
  "ppi",
182
  "puppet",
183
+ "pxcms",
184
  "reindex",
185
  "roundcube",
186
  "shopware",
193
  "zend",
194
  "zikula"
195
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  }
197
  ]
vendor/composer/installers/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
 
3
  ## [Unreleased]
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  ## v1.4.0 - 2017-08-09
6
  ### Added
7
  * Installer for eZ Platform.
2
 
3
  ## [Unreleased]
4
 
5
+ ## v1.5.0 - 2017-12-29
6
+ ### Added
7
+ * Added WordPress dropin support.
8
+ * Added new types supported for Eliasis.
9
+ * Added support for Phoenix CMS.
10
+ * Added MODX installer.
11
+ * Added Majima instaler.
12
+ * Added SiteDirect installer.
13
+ * Added support optional prefix in OctoberCMS installers.
14
+ * Added PHP 7.2 support.
15
+
16
+ ### Changed
17
+ * Changed remove packages, see [#348](https://github.com/composer/installers/pull/348).
18
+
19
+ ### Fixed
20
+ * Fixed code style, removed unused imports.
21
+
22
  ## v1.4.0 - 2017-08-09
23
  ### Added
24
  * Installer for eZ Platform.
vendor/composer/installers/README.md CHANGED
@@ -53,7 +53,7 @@ is not needed to install packages with these frameworks:
53
  | Dolibarr | `dolibarr-module`
54
  | Drupal | <b>`drupal-core`<br>`drupal-module`<br>`drupal-theme`</b><br>`drupal-library`<br>`drupal-profile`<br>`drupal-drush`
55
  | Elgg | `elgg-plugin`
56
- | Eliasis | `eliasis-module`
57
  | ExpressionEngine 3 | `ee3-addon`<br>`ee3-theme`
58
  | eZ Platform | `ezplatform-assets`<br>`ezplatform-meta-assets`
59
  | FuelPHP v1.x | `fuel-module`<br>`fuel-package`<br/>`fuel-theme`
@@ -72,9 +72,11 @@ is not needed to install packages with these frameworks:
72
  | Lavalite | `lavalite-theme`<br>`lavalite-package`
73
  | Lithium | **`lithium-library`<br>`lithium-source`**
74
  | Magento | `magento-library`<br>`magento-skin`<br>`magento-theme`
 
75
  | Mako | `mako-package`
76
  | Mautic | `mautic-plugin`<br>`mautic-theme`
77
  | Maya | `maya-module`
 
78
  | MODX Evo | `modxevo-snippet`<br>`modxevo-plugin`<br>`modxevo-module`<br>`modxevo-template`<br>`modxevo-lib`
79
  | MediaWiki | `mediawiki-extension`
80
  | October | **`october-module`<br>`october-plugin`<br>`october-theme`**
@@ -96,6 +98,7 @@ is not needed to install packages with these frameworks:
96
  | Roundcube | `roundcube-plugin`
97
  | shopware | `shopware-backend-plugin`<br/>`shopware-core-plugin`<br/>`shopware-frontend-plugin`<br/>`shopware-theme`<br/>`shopware-plugin`<br/>`shopware-frontend-theme`
98
  | SilverStripe | `silverstripe-module`<br>`silverstripe-theme`
 
99
  | SMF | `smf-module`<br>`smf-theme`
100
  | SyDES | `sydes-module`<br>`sydes-theme`
101
  | symfony1 | **`symfony1-plugin`**
@@ -106,7 +109,7 @@ is not needed to install packages with these frameworks:
106
  | Vanilla | `vanilla-plugin`<br>`vanilla-theme`
107
  | Vgmcp | `vgmcp-bundle`<br>`vgmcp-theme`
108
  | Wolf CMS | `wolfcms-plugin`
109
- | WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`
110
  | YAWIK | `yawik-module`
111
  | Zend | `zend-library`<br>`zend-extra`<br>`zend-module`
112
  | Zikula | `zikula-module`<br>`zikula-theme`
53
  | Dolibarr | `dolibarr-module`
54
  | Drupal | <b>`drupal-core`<br>`drupal-module`<br>`drupal-theme`</b><br>`drupal-library`<br>`drupal-profile`<br>`drupal-drush`
55
  | Elgg | `elgg-plugin`
56
+ | Eliasis | `eliasis-component`<br>`eliasis-module`<br>`eliasis-plugin`<br>`eliasis-template`
57
  | ExpressionEngine 3 | `ee3-addon`<br>`ee3-theme`
58
  | eZ Platform | `ezplatform-assets`<br>`ezplatform-meta-assets`
59
  | FuelPHP v1.x | `fuel-module`<br>`fuel-package`<br/>`fuel-theme`
72
  | Lavalite | `lavalite-theme`<br>`lavalite-package`
73
  | Lithium | **`lithium-library`<br>`lithium-source`**
74
  | Magento | `magento-library`<br>`magento-skin`<br>`magento-theme`
75
+ | majima | `majima-plugin`
76
  | Mako | `mako-package`
77
  | Mautic | `mautic-plugin`<br>`mautic-theme`
78
  | Maya | `maya-module`
79
+ | MODX | `modx-extra`
80
  | MODX Evo | `modxevo-snippet`<br>`modxevo-plugin`<br>`modxevo-module`<br>`modxevo-template`<br>`modxevo-lib`
81
  | MediaWiki | `mediawiki-extension`
82
  | October | **`october-module`<br>`october-plugin`<br>`october-theme`**
98
  | Roundcube | `roundcube-plugin`
99
  | shopware | `shopware-backend-plugin`<br/>`shopware-core-plugin`<br/>`shopware-frontend-plugin`<br/>`shopware-theme`<br/>`shopware-plugin`<br/>`shopware-frontend-theme`
100
  | SilverStripe | `silverstripe-module`<br>`silverstripe-theme`
101
+ | SiteDirect | `sitedirect-module`<br>`sitedirect-plugin`
102
  | SMF | `smf-module`<br>`smf-theme`
103
  | SyDES | `sydes-module`<br>`sydes-theme`
104
  | symfony1 | **`symfony1-plugin`**
109
  | Vanilla | `vanilla-plugin`<br>`vanilla-theme`
110
  | Vgmcp | `vgmcp-bundle`<br>`vgmcp-theme`
111
  | Wolf CMS | `wolfcms-plugin`
112
+ | WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`<br>`wordpress-dropin`
113
  | YAWIK | `yawik-module`
114
  | Zend | `zend-library`<br>`zend-extra`<br>`zend-module`
115
  | Zikula | `zikula-module`<br>`zikula-theme`
vendor/composer/installers/composer.json CHANGED
@@ -37,9 +37,11 @@
37
  "Lavalite",
38
  "Lithium",
39
  "Magento",
 
40
  "Mako",
41
  "Mautic",
42
  "Maya",
 
43
  "MODX Evo",
44
  "MediaWiki",
45
  "OXID",
@@ -47,6 +49,7 @@
47
  "MODULEWork",
48
  "Moodle",
49
  "Piwik",
 
50
  "phpBB",
51
  "Plentymarkets",
52
  "PPI",
@@ -94,7 +97,7 @@
94
  },
95
  "require-dev": {
96
  "composer/composer": "1.0.*@dev",
97
- "phpunit/phpunit": "4.1.*"
98
  },
99
  "scripts": {
100
  "test": "phpunit"
37
  "Lavalite",
38
  "Lithium",
39
  "Magento",
40
+ "majima",
41
  "Mako",
42
  "Mautic",
43
  "Maya",
44
+ "MODX",
45
  "MODX Evo",
46
  "MediaWiki",
47
  "OXID",
49
  "MODULEWork",
50
  "Moodle",
51
  "Piwik",
52
+ "pxcms",
53
  "phpBB",
54
  "Plentymarkets",
55
  "PPI",
97
  },
98
  "require-dev": {
99
  "composer/composer": "1.0.*@dev",
100
+ "phpunit/phpunit": "^4.8.36"
101
  },
102
  "scripts": {
103
  "test": "phpunit"
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php CHANGED
@@ -2,7 +2,6 @@
2
  namespace Composer\Installers;
3
 
4
  use Composer\DependencyResolver\Pool;
5
- use Composer\Package\PackageInterface;
6
 
7
  class CakePHPInstaller extends BaseInstaller
8
  {
2
  namespace Composer\Installers;
3
 
4
  use Composer\DependencyResolver\Pool;
 
5
 
6
  class CakePHPInstaller extends BaseInstaller
7
  {
vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php CHANGED
@@ -4,6 +4,9 @@ namespace Composer\Installers;
4
  class EliasisInstaller extends BaseInstaller
5
  {
6
  protected $locations = array(
7
- 'module' => 'modules/{$name}/'
 
 
 
8
  );
9
  }
4
  class EliasisInstaller extends BaseInstaller
5
  {
6
  protected $locations = array(
7
+ 'component' => 'components/{$name}/',
8
+ 'module' => 'modules/{$name}/',
9
+ 'plugin' => 'plugins/{$name}/',
10
+ 'template' => 'templates/{$name}/',
11
  );
12
  }
vendor/composer/installers/src/Composer/Installers/Installer.php CHANGED
@@ -54,18 +54,21 @@ class Installer extends LibraryInstaller
54
  'lavalite' => 'LavaLiteInstaller',
55
  'lithium' => 'LithiumInstaller',
56
  'magento' => 'MagentoInstaller',
 
57
  'mako' => 'MakoInstaller',
58
  'maya' => 'MayaInstaller',
59
  'mautic' => 'MauticInstaller',
60
  'mediawiki' => 'MediaWikiInstaller',
61
  'microweber' => 'MicroweberInstaller',
62
  'modulework' => 'MODULEWorkInstaller',
 
63
  'modxevo' => 'MODXEvoInstaller',
64
  'moodle' => 'MoodleInstaller',
65
  'october' => 'OctoberInstaller',
66
  'ontowiki' => 'OntoWikiInstaller',
67
  'oxid' => 'OxidInstaller',
68
  'osclass' => 'OsclassInstaller',
 
69
  'phpbb' => 'PhpBBInstaller',
70
  'pimcore' => 'PimcoreInstaller',
71
  'piwik' => 'PiwikInstaller',
@@ -79,6 +82,7 @@ class Installer extends LibraryInstaller
79
  'reindex' => 'ReIndexInstaller',
80
  'roundcube' => 'RoundcubeInstaller',
81
  'shopware' => 'ShopwareInstaller',
 
82
  'silverstripe' => 'SilverStripeInstaller',
83
  'smf' => 'SMFInstaller',
84
  'sydes' => 'SyDESInstaller',
@@ -120,14 +124,9 @@ class Installer extends LibraryInstaller
120
 
121
  public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
122
  {
123
- if (!$repo->hasPackage($package)) {
124
- throw new \InvalidArgumentException('Package is not installed: '.$package);
125
- }
126
-
127
- $repo->removePackage($package);
128
-
129
- $installPath = $this->getInstallPath($package);
130
- $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
131
  }
132
 
133
  /**
54
  'lavalite' => 'LavaLiteInstaller',
55
  'lithium' => 'LithiumInstaller',
56
  'magento' => 'MagentoInstaller',
57
+ 'majima' => 'MajimaInstaller',
58
  'mako' => 'MakoInstaller',
59
  'maya' => 'MayaInstaller',
60
  'mautic' => 'MauticInstaller',
61
  'mediawiki' => 'MediaWikiInstaller',
62
  'microweber' => 'MicroweberInstaller',
63
  'modulework' => 'MODULEWorkInstaller',
64
+ 'modx' => 'ModxInstaller',
65
  'modxevo' => 'MODXEvoInstaller',
66
  'moodle' => 'MoodleInstaller',
67
  'october' => 'OctoberInstaller',
68
  'ontowiki' => 'OntoWikiInstaller',
69
  'oxid' => 'OxidInstaller',
70
  'osclass' => 'OsclassInstaller',
71
+ 'pxcms' => 'PxcmsInstaller',
72
  'phpbb' => 'PhpBBInstaller',
73
  'pimcore' => 'PimcoreInstaller',
74
  'piwik' => 'PiwikInstaller',
82
  'reindex' => 'ReIndexInstaller',
83
  'roundcube' => 'RoundcubeInstaller',
84
  'shopware' => 'ShopwareInstaller',
85
+ 'sitedirect' => 'SiteDirectInstaller',
86
  'silverstripe' => 'SilverStripeInstaller',
87
  'smf' => 'SMFInstaller',
88
  'sydes' => 'SyDESInstaller',
124
 
125
  public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
126
  {
127
+ parent::uninstall($repo, $package);
128
+ $installPath = $this->getPackageBasePath($package);
129
+ $this->io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
 
 
 
 
 
130
  }
131
 
132
  /**
vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Plugin/theme installer for majima
6
+ * @author David Neustadt
7
+ */
8
+ class MajimaInstaller extends BaseInstaller
9
+ {
10
+ protected $locations = array(
11
+ 'plugin' => 'plugins/{$name}/',
12
+ );
13
+
14
+ /**
15
+ * Transforms the names
16
+ * @param array $vars
17
+ * @return array
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ return $this->correctPluginName($vars);
22
+ }
23
+
24
+ /**
25
+ * Change hyphenated names to camelcase
26
+ * @param array $vars
27
+ * @return array
28
+ */
29
+ private function correctPluginName($vars)
30
+ {
31
+ $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
32
+ return strtoupper($matches[0][1]);
33
+ }, $vars['name']);
34
+ $vars['name'] = ucfirst($camelCasedName);
35
+ return $vars;
36
+ }
37
+ }
vendor/composer/installers/src/Composer/Installers/ModxInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * An installer to handle MODX specifics when installing packages.
6
+ */
7
+ class ModxInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'extra' => 'core/packages/{$name}/'
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php CHANGED
@@ -32,15 +32,15 @@ class OctoberInstaller extends BaseInstaller
32
 
33
  protected function inflectPluginVars($vars)
34
  {
35
- $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
36
 
37
  return $vars;
38
  }
39
 
40
  protected function inflectThemeVars($vars)
41
  {
42
- $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
43
 
44
  return $vars;
45
  }
46
- }
32
 
33
  protected function inflectPluginVars($vars)
34
  {
35
+ $vars['name'] = preg_replace('/^oc-|-plugin$/', '', $vars['name']);
36
 
37
  return $vars;
38
  }
39
 
40
  protected function inflectThemeVars($vars)
41
  {
42
+ $vars['name'] = preg_replace('/^oc-|-theme$/', '', $vars['name']);
43
 
44
  return $vars;
45
  }
46
+ }
vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PxcmsInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'app/Modules/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * @param array $vars
15
+ *
16
+ * @return array
17
+ */
18
+ public function inflectPackageVars($vars)
19
+ {
20
+ if ($vars['type'] === 'pxcms-module') {
21
+ return $this->inflectModuleVars($vars);
22
+ }
23
+
24
+ if ($vars['type'] === 'pxcms-theme') {
25
+ return $this->inflectThemeVars($vars);
26
+ }
27
+
28
+ return $vars;
29
+ }
30
+
31
+ /**
32
+ * For package type pxcms-module, cut off a trailing '-plugin' if present.
33
+ *
34
+ * return string
35
+ */
36
+ protected function inflectModuleVars($vars)
37
+ {
38
+ $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
39
+ $vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
40
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
41
+ $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
42
+ $vars['name'] = ucwords($vars['name']); // make module name camelcased
43
+
44
+ return $vars;
45
+ }
46
+
47
+
48
+ /**
49
+ * For package type pxcms-module, cut off a trailing '-plugin' if present.
50
+ *
51
+ * return string
52
+ */
53
+ protected function inflectThemeVars($vars)
54
+ {
55
+ $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
56
+ $vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
57
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
58
+ $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
59
+ $vars['name'] = ucwords($vars['name']); // make module name camelcased
60
+
61
+ return $vars;
62
+ }
63
+ }
vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php CHANGED
@@ -25,9 +25,9 @@ class ShopwareInstaller extends BaseInstaller
25
  {
26
  if ($vars['type'] === 'shopware-theme') {
27
  return $this->correctThemeName($vars);
28
- } else {
29
- return $this->correctPluginName($vars);
30
  }
 
 
31
  }
32
 
33
  /**
25
  {
26
  if ($vars['type'] === 'shopware-theme') {
27
  return $this->correctThemeName($vars);
 
 
28
  }
29
+
30
+ return $this->correctPluginName($vars);
31
  }
32
 
33
  /**
vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php CHANGED
@@ -28,9 +28,8 @@ class SilverStripeInstaller extends BaseInstaller
28
  && version_compare($package->getVersion(), '2.999.999') < 0
29
  ) {
30
  return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
31
- } else {
32
- return parent::getInstallPath($package, $frameworkType);
33
  }
34
 
 
35
  }
36
  }
28
  && version_compare($package->getVersion(), '2.999.999') < 0
29
  ) {
30
  return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
 
 
31
  }
32
 
33
+ return parent::getInstallPath($package, $frameworkType);
34
  }
35
  }
vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class SiteDirectInstaller extends BaseInstaller
6
+ {
7
+ protected $locations = array(
8
+ 'module' => 'modules/{$vendor}/{$name}/',
9
+ 'plugin' => 'plugins/{$vendor}/{$name}/'
10
+ );
11
+
12
+ public function inflectPackageVars($vars)
13
+ {
14
+ return $this->parseVars($vars);
15
+ }
16
+
17
+ protected function parseVars($vars)
18
+ {
19
+ $vars['vendor'] = strtolower($vars['vendor']) == 'sitedirect' ? 'SiteDirect' : $vars['vendor'];
20
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
21
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
22
+
23
+ return $vars;
24
+ }
25
+ }
vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php CHANGED
@@ -7,5 +7,6 @@ class WordPressInstaller extends BaseInstaller
7
  'plugin' => 'wp-content/plugins/{$name}/',
8
  'theme' => 'wp-content/themes/{$name}/',
9
  'muplugin' => 'wp-content/mu-plugins/{$name}/',
 
10
  );
11
  }
7
  'plugin' => 'wp-content/plugins/{$name}/',
8
  'theme' => 'wp-content/themes/{$name}/',
9
  'muplugin' => 'wp-content/mu-plugins/{$name}/',
10
+ 'dropin' => 'wp-content/{$name}/',
11
  );
12
  }
vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php CHANGED
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
4
  use Composer\Installers\AsgardInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
 
7
 
8
- class AsgardInstallerTest extends \PHPUnit_Framework_TestCase
9
  {
10
  /**
11
  * @var AsgardInstaller
4
  use Composer\Installers\AsgardInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
7
+ use PHPUnit\Framework\TestCase;
8
 
9
+ class AsgardInstallerTest extends TestCase
10
  {
11
  /**
12
  * @var AsgardInstaller
vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php CHANGED
@@ -3,7 +3,6 @@
3
  namespace Composer\Installers\Test;
4
 
5
  use Composer\Installers\BitrixInstaller;
6
- use Composer\Package\PackageInterface;
7
  use Composer\Package\Package;
8
  use Composer\Composer;
9
 
@@ -73,4 +72,4 @@ class BitrixInstallerTest extends TestCase
73
  ),
74
  );
75
  }
76
- }
3
  namespace Composer\Installers\Test;
4
 
5
  use Composer\Installers\BitrixInstaller;
 
6
  use Composer\Package\Package;
7
  use Composer\Composer;
8
 
72
  ),
73
  );
74
  }
75
+ }
vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php CHANGED
@@ -6,7 +6,6 @@ use Composer\Repository\RepositoryManager;
6
  use Composer\Repository\InstalledArrayRepository;
7
  use Composer\Package\Package;
8
  use Composer\Package\RootPackage;
9
- use Composer\Package\Link;
10
  use Composer\Package\Version\VersionParser;
11
  use Composer\Composer;
12
  use Composer\Config;
6
  use Composer\Repository\InstalledArrayRepository;
7
  use Composer\Package\Package;
8
  use Composer\Package\RootPackage;
 
9
  use Composer\Package\Version\VersionParser;
10
  use Composer\Composer;
11
  use Composer\Config;
vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php CHANGED
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
4
  use Composer\Installers\DokuWikiInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
 
7
 
8
- class DokuWikiInstallerTest extends \PHPUnit_Framework_TestCase
9
  {
10
  /**
11
  * @var DokuWikiInstaller
4
  use Composer\Installers\DokuWikiInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
7
+ use PHPUnit\Framework\TestCase as BaseTestCase;
8
 
9
+ class DokuWikiInstallerTest extends BaseTestCase
10
  {
11
  /**
12
  * @var DokuWikiInstaller
vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php CHANGED
@@ -123,7 +123,10 @@ class InstallerTest extends TestCase
123
  array('ee2-theme', true),
124
  array('ee2-addon', true),
125
  array('elgg-plugin', true),
 
126
  array('eliasis-module', true),
 
 
127
  array('ezplatform-assets', true),
128
  array('ezplatform-meta-assets', true),
129
  array('fuel-module', true),
@@ -149,7 +152,9 @@ class InstallerTest extends TestCase
149
  array('lavalite-package', true),
150
  array('lithium-library', true),
151
  array('magento-library', true),
 
152
  array('mako-package', true),
 
153
  array('modxevo-snippet', true),
154
  array('modxevo-plugin', true),
155
  array('modxevo-module', true),
@@ -163,6 +168,8 @@ class InstallerTest extends TestCase
163
  array('october-module', true),
164
  array('october-plugin', true),
165
  array('piwik-plugin', true),
 
 
166
  array('phpbb-extension', true),
167
  array('pimcore-plugin', true),
168
  array('plentymarkets-plugin', true),
@@ -277,7 +284,10 @@ class InstallerTest extends TestCase
277
  array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
278
  array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
279
  array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
 
280
  array('eliasis-module', 'modules/my_module/', 'shama/my_module'),
 
 
281
  array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'),
282
  array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'),
283
  array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'),
@@ -311,6 +321,8 @@ class InstallerTest extends TestCase
311
  array('lavalite-package', 'packages/my_group/my_package/', 'my_group/my_package'),
312
  array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
313
  array('magento-library', 'lib/foo/', 'test/foo'),
 
 
314
  array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
315
  array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'),
316
  array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'),
@@ -332,6 +344,10 @@ class InstallerTest extends TestCase
332
  array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
333
  array('prestashop-module', 'modules/a-module/', 'vendor/a-module'),
334
  array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'),
 
 
 
 
335
  array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
336
  array('phpbb-style', 'styles/foo/', 'test/foo'),
337
  array('phpbb-language', 'language/foo/', 'test/foo'),
@@ -525,7 +541,7 @@ class InstallerTest extends TestCase
525
  $package = new Package('foo', '1.0.0', '1.0.0');
526
 
527
  $installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer));
528
- $installer->expects($this->once())->method('getInstallPath')->with($package)->will($this->returnValue(sys_get_temp_dir().'/foo'));
529
 
530
  $repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
531
  $repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true));
123
  array('ee2-theme', true),
124
  array('ee2-addon', true),
125
  array('elgg-plugin', true),
126
+ array('eliasis-component', true),
127
  array('eliasis-module', true),
128
+ array('eliasis-plugin', true),
129
+ array('eliasis-template', true),
130
  array('ezplatform-assets', true),
131
  array('ezplatform-meta-assets', true),
132
  array('fuel-module', true),
152
  array('lavalite-package', true),
153
  array('lithium-library', true),
154
  array('magento-library', true),
155
+ array('majima-plugin', true),
156
  array('mako-package', true),
157
+ array('modx-extra', true),
158
  array('modxevo-snippet', true),
159
  array('modxevo-plugin', true),
160
  array('modxevo-module', true),
168
  array('october-module', true),
169
  array('october-plugin', true),
170
  array('piwik-plugin', true),
171
+ array('pxcms-module', true),
172
+ array('pxcms-theme', true),
173
  array('phpbb-extension', true),
174
  array('pimcore-plugin', true),
175
  array('plentymarkets-plugin', true),
284
  array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
285
  array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
286
  array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
287
+ array('eliasis-component', 'components/my_component/', 'shama/my_component'),
288
  array('eliasis-module', 'modules/my_module/', 'shama/my_module'),
289
+ array('eliasis-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
290
+ array('eliasis-template', 'templates/my_template/', 'shama/my_template'),
291
  array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'),
292
  array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'),
293
  array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'),
321
  array('lavalite-package', 'packages/my_group/my_package/', 'my_group/my_package'),
322
  array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
323
  array('magento-library', 'lib/foo/', 'test/foo'),
324
+ array('majima-plugin', 'plugins/MyPlugin/', 'shama/my-plugin'),
325
+ array('modx-extra', 'core/packages/extra/', 'vendor/extra'),
326
  array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
327
  array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'),
328
  array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'),
344
  array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
345
  array('prestashop-module', 'modules/a-module/', 'vendor/a-module'),
346
  array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'),
347
+ array('pxcms-module', 'app/Modules/Foo/', 'vendor/module-foo'),
348
+ array('pxcms-module', 'app/Modules/Foo/', 'vendor/pxcms-foo'),
349
+ array('pxcms-theme', 'themes/Foo/', 'vendor/theme-foo'),
350
+ array('pxcms-theme', 'themes/Foo/', 'vendor/pxcms-foo'),
351
  array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
352
  array('phpbb-style', 'styles/foo/', 'test/foo'),
353
  array('phpbb-language', 'language/foo/', 'test/foo'),
541
  $package = new Package('foo', '1.0.0', '1.0.0');
542
 
543
  $installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer));
544
+ $installer->expects($this->atLeastOnce())->method('getInstallPath')->with($package)->will($this->returnValue(sys_get_temp_dir().'/foo'));
545
 
546
  $repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
547
  $repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true));
vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php CHANGED
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
4
  use Composer\Installers\MayaInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
 
7
 
8
- class MayaInstallerTest extends \PHPUnit_Framework_TestCase
9
  {
10
  /**
11
  * @var MayaInstaller
4
  use Composer\Installers\MayaInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
7
+ use PHPUnit\Framework\TestCase as BaseTestCase;
8
 
9
+ class MayaInstallerTest extends BaseTestCase
10
  {
11
  /**
12
  * @var MayaInstaller
vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php CHANGED
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
4
  use Composer\Installers\MediaWikiInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
 
7
 
8
- class MediaWikiInstallerTest extends \PHPUnit_Framework_TestCase
9
  {
10
  /**
11
  * @var MediaWikiInstaller
4
  use Composer\Installers\MediaWikiInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
7
+ use PHPUnit\Framework\TestCase as BaseTestCase;
8
 
9
+ class MediaWikiInstallerTest extends BaseTestCase
10
  {
11
  /**
12
  * @var MediaWikiInstaller
vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php CHANGED
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
4
  use Composer\Installers\OctoberInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
 
7
 
8
- class OctoberInstallerTest extends \PHPUnit_Framework_TestCase
9
  {
10
  /**
11
  * @var OctoberInstaller
@@ -63,4 +64,4 @@ class OctoberInstallerTest extends \PHPUnit_Framework_TestCase
63
  ),
64
  );
65
  }
66
- }
4
  use Composer\Installers\OctoberInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
7
+ use PHPUnit\Framework\TestCase as BaseTestCase;
8
 
9
+ class OctoberInstallerTest extends BaseTestCase
10
  {
11
  /**
12
  * @var OctoberInstaller
64
  ),
65
  );
66
  }
67
+ }
vendor/composer/installers/tests/Composer/Installers/Test/OntoWikiInstallerTest.php CHANGED
@@ -2,14 +2,13 @@
2
  namespace Composer\Installers\Test;
3
 
4
  use Composer\Installers\OntoWikiInstaller;
5
- use Composer\Package\Package;
6
- use Composer\Composer;
7
 
8
  /**
9
  * Test for the OntoWikiInstaller
10
  * code was taken from DokuWikiInstaller
11
  */
12
- class OntoWikiInstallerTest extends \PHPUnit_Framework_TestCase
13
  {
14
  /**
15
  * @var OntoWikiInstaller
2
  namespace Composer\Installers\Test;
3
 
4
  use Composer\Installers\OntoWikiInstaller;
5
+ use PHPUnit\Framework\TestCase as BaseTestCase;
 
6
 
7
  /**
8
  * Test for the OntoWikiInstaller
9
  * code was taken from DokuWikiInstaller
10
  */
11
+ class OntoWikiInstallerTest extends BaseTestCase
12
  {
13
  /**
14
  * @var OntoWikiInstaller
vendor/composer/installers/tests/Composer/Installers/Test/SiteDirectInstallerTest.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers\Test;
4
+
5
+ use Composer\Composer;
6
+ use Composer\Installers\SiteDirectInstaller;
7
+ use Composer\Package\Package;
8
+
9
+ class SiteDirectInstallerTest extends TestCase
10
+ {
11
+ /** @var SiteDirectInstaller $installer */
12
+ protected $installer;
13
+
14
+ /** @var Package */
15
+ private $package;
16
+
17
+ public function SetUp()
18
+ {
19
+ $this->package = new Package('sitedirect/some_name', '1.0.9', '1.0');
20
+ $this->installer = new SiteDirectInstaller(
21
+ $this->package,
22
+ new Composer()
23
+ );
24
+
25
+ }
26
+
27
+ /**
28
+ * @dataProvider dataProvider
29
+ */
30
+ public function testInflectPackageVars($data, $expected)
31
+ {
32
+ $result = $this->installer->inflectPackageVars($data);
33
+ $this->assertEquals($result, $expected);
34
+ }
35
+
36
+ /**
37
+ * @dataProvider dataProvider
38
+ */
39
+ public function testInstallPath($data, $expected)
40
+ {
41
+ $result = $this->installer->inflectPackageVars($data);
42
+ $path = $this->createPackage($data);
43
+
44
+ // use $result to get the proper capitalization for the vendor path
45
+ $expectedPath = "modules/{$result['vendor']}/{$result['name']}/";
46
+ $notExpectedPath = "modules/{$data['vendor']}/{$data['name']}/";
47
+ $this->assertEquals($expectedPath, $path);
48
+ $this->assertNotEquals($notExpectedPath, $path);
49
+ }
50
+
51
+ /**
52
+ * @param $data
53
+ * @return string
54
+ */
55
+ private function createPackage($data)
56
+ {
57
+ $fullName = "{$data['vendor']}/{$data['name']}";
58
+
59
+ $package = new Package($fullName, '1.0', '1.0');
60
+ $package->setType('sitedirect-module');
61
+ $installer = new SiteDirectInstaller($package, new Composer());
62
+
63
+ $path = $installer->getInstallPath($package, 'sitedirect');
64
+ return $path;
65
+ }
66
+
67
+ public function dataProvider()
68
+ {
69
+ return array(
70
+ array(
71
+ 'data' => array(
72
+ 'name' => 'kernel',
73
+ 'vendor' => 'sitedirect',
74
+ 'type' => 'sitedirect-module',
75
+ ),
76
+ 'expected' => array(
77
+ 'name' => 'Kernel',
78
+ 'vendor' => 'SiteDirect',
79
+ 'type' => 'sitedirect-module',
80
+ )
81
+ ),
82
+ array(
83
+ 'data' => array(
84
+ 'name' => 'that_guy',
85
+ 'vendor' => 'whatGuy',
86
+ 'type' => 'sitedirect-module',
87
+ ),
88
+ 'expected' => array(
89
+ 'name' => 'ThatGuy',
90
+ 'vendor' => 'whatGuy',
91
+ 'type' => 'sitedirect-module',
92
+ )
93
+ ),
94
+ array(
95
+ 'data' => array(
96
+ 'name' => 'checkout',
97
+ 'vendor' => 'someVendor',
98
+ 'type' => 'sitedirect-plugin',
99
+ ),
100
+ 'expected' => array(
101
+ 'name' => 'Checkout',
102
+ 'vendor' => 'someVendor',
103
+ 'type' => 'sitedirect-plugin',
104
+ )
105
+ ),
106
+ array(
107
+ 'data' => array(
108
+ 'name' => 'checkout',
109
+ 'vendor' => 'siteDirect',
110
+ 'type' => 'sitedirect-plugin',
111
+ ),
112
+ 'expected' => array(
113
+ 'name' => 'Checkout',
114
+ 'vendor' => 'SiteDirect',
115
+ 'type' => 'sitedirect-plugin',
116
+ )
117
+ ),
118
+ );
119
+ }
120
+ }
vendor/composer/installers/tests/Composer/Installers/Test/SyDESInstallerTest.php CHANGED
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
4
  use Composer\Installers\SyDESInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
 
7
 
8
- class SyDESInstallerTest extends \PHPUnit_Framework_TestCase
9
  {
10
  /**
11
  * @var SyDESInstaller
4
  use Composer\Installers\SyDESInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
7
+ use PHPUnit\Framework\TestCase as BaseTestCase;
8
 
9
+ class SyDESInstallerTest extends BaseTestCase
10
  {
11
  /**
12
  * @var SyDESInstaller
vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php CHANGED
@@ -17,8 +17,9 @@ use Composer\Package\Package;
17
  use Composer\Package\AliasPackage;
18
  use Composer\Package\LinkConstraint\VersionConstraint;
19
  use Composer\Util\Filesystem;
 
20
 
21
- abstract class TestCase extends \PHPUnit_Framework_TestCase
22
  {
23
  private static $parser;
24
 
17
  use Composer\Package\AliasPackage;
18
  use Composer\Package\LinkConstraint\VersionConstraint;
19
  use Composer\Util\Filesystem;
20
+ use PHPUnit\Framework\TestCase as BaseTestCase;
21
 
22
+ abstract class TestCase extends BaseTestCase
23
  {
24
  private static $parser;
25
 
vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.php CHANGED
@@ -4,8 +4,9 @@ namespace Composer\Installers\Test;
4
  use Composer\Installers\VgmcpInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
 
7
 
8
- class VgmcpInstallerTest extends \PHPUnit_Framework_TestCase
9
  {
10
  /**
11
  * @var VgmcpInstaller
4
  use Composer\Installers\VgmcpInstaller;
5
  use Composer\Package\Package;
6
  use Composer\Composer;
7
+ use PHPUnit\Framework\TestCase as BaseTestCase;
8
 
9
+ class VgmcpInstallerTest extends BaseTestCase
10
  {
11
  /**
12
  * @var VgmcpInstaller