Advanced Ads - Version 1.11

Version Description

  • improved the AdSense onboarding process
  • hide idle ads in the ads list loaded from the AdSense server
  • dont inject ads into content when ads are disabled on Secondary Queries (problem caused by Similar Posts plugin)
  • limited Edit-button in the frontend to ads with a container around them
  • fixed issue caused by browsers with a default ad blocker
  • fixed ad group filter on the ad overview page not appearing
  • fixed "Ad block counter" being needed to display ads for ad blockers
  • compatibility with the "Render Blocking JS" option of the WP Fastest Cache plugin
  • added clearfix option to fix possible layout issue with all types of AdSense responsive ads
  • use same URL field for Tracking and basic plugin
  • Sticky Ads: fixed incorrect centering when parent element begins lower
Download this release

Release Info

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

Code changes from version 1.10.12 to 1.11

Files changed (82) hide show
  1. admin/assets/css/admin.css +8 -0
  2. admin/assets/js/admin.js +29 -12
  3. admin/includes/class-ad-type.php +4 -2
  4. admin/includes/class-licenses.php +35 -3
  5. admin/includes/class-list-filters.php +29 -9
  6. admin/includes/class-meta-box.php +3 -18
  7. admin/includes/class-notices.php +0 -6
  8. admin/includes/notices.php +0 -5
  9. admin/views/ad-group-list-form-row.php +4 -2
  10. admin/views/ad-group.php +17 -1
  11. admin/views/ad-visitor-metabox.php +6 -0
  12. admin/views/feedback-disable.php +9 -0
  13. admin/views/notices/adblock.php +7 -6
  14. admin/views/placements-item.php +1 -1
  15. admin/views/placements.php +1 -1
  16. admin/views/post-ad-settings-metabox.php +1 -0
  17. advanced-ads.php +3 -3
  18. classes/ad.php +30 -8
  19. classes/ad_type_dummy.php +2 -2
  20. classes/ad_type_image.php +2 -3
  21. classes/ad_type_plain.php +0 -1
  22. classes/checks.php +3 -0
  23. classes/frontend_checks.php +12 -2
  24. classes/plugin.php +26 -0
  25. classes/upgrades.php +10 -234
  26. classes/utils.php +5 -0
  27. classes/visitor-conditions.php +4 -3
  28. composer.lock +5 -5
  29. languages/advanced-ads.pot +340 -242
  30. modules/adblock-finder/public/public.php +2 -2
  31. modules/gadsense/admin/admin.php +66 -15
  32. modules/gadsense/admin/assets/js/connect-adsense.js +265 -0
  33. modules/gadsense/admin/assets/js/mapi-settings.js +90 -73
  34. modules/gadsense/admin/assets/js/new-ad.js +185 -72
  35. modules/gadsense/admin/views/adsense-account.php +140 -85
  36. modules/gadsense/admin/views/adsense-ad-parameters.php +49 -29
  37. modules/gadsense/admin/views/connect-adsense.php +135 -0
  38. modules/gadsense/admin/views/mapi-ad-selector.php +32 -20
  39. modules/gadsense/includes/class-ad-type-adsense.php +6 -4
  40. modules/gadsense/includes/class-gadsense-data.php +10 -2
  41. modules/gadsense/includes/class-mapi.php +506 -90
  42. public/assets/js/advanced.js +1 -1
  43. public/assets/js/advanced.orig.js +21 -4
  44. public/class-advanced-ads.php +26 -6
  45. readme.txt +28 -381
  46. vendor/autoload.php +1 -1
  47. vendor/autoload_52.php +1 -1
  48. vendor/composer/ClassLoader.php +50 -18
  49. vendor/composer/LICENSE +1 -1
  50. vendor/composer/autoload_real.php +20 -18
  51. vendor/composer/autoload_real_52.php +3 -3
  52. vendor/composer/autoload_static.php +1 -87
  53. vendor/composer/installed.json +6 -6
  54. vendor/composer/installers/CHANGELOG.md +0 -86
  55. vendor/composer/installers/CONTRIBUTING.md +0 -24
  56. vendor/composer/installers/README.md +0 -221
  57. vendor/composer/installers/_config.yml +0 -1
  58. vendor/composer/installers/phpunit.xml.dist +0 -25
  59. vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php +9 -0
  60. vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php +1 -1
  61. vendor/composer/installers/src/Composer/Installers/Installer.php +75 -1
  62. vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php +1 -0
  63. vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php +1 -0
  64. vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php +0 -80
  65. vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php +0 -75
  66. vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php +0 -114
  67. vendor/composer/installers/tests/Composer/Installers/Test/CraftInstallerTest.php +0 -83
  68. vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php +0 -90
  69. vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php +0 -63
  70. vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php +0 -552
  71. vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php +0 -62
  72. vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php +0 -67
  73. vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php +0 -67
  74. vendor/composer/installers/tests/Composer/Installers/Test/OntoWikiInstallerTest.php +0 -84
  75. vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php +0 -44
  76. vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php +0 -63
  77. vendor/composer/installers/tests/Composer/Installers/Test/SiteDirectInstallerTest.php +0 -120
  78. vendor/composer/installers/tests/Composer/Installers/Test/SyDESInstallerTest.php +0 -82
  79. vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php +0 -65
  80. vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.php +0 -80
  81. vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php +0 -64
  82. vendor/composer/installers/tests/bootstrap.php +0 -4
admin/assets/css/admin.css CHANGED
@@ -312,6 +312,7 @@ tr:hover .on-hover { display: block; }
312
  #mapi-wrap tbody .disabled[data-mapiaction="getCode"] { color: #a7a7a7; cursor: default; }
313
  #mapi-wrap tbody [data-mapiaction="updateCode"] { color: #0085ba; }
314
  #mapi-wrap #mapi-update-unit-lists { font-size: 20px; padding: 13px; position: absolute; top: 0; right: 47px; }
 
315
  #mapi-wrap #mapi-list-header { font-weight: 700; display: inline-block; font-size: 13px; line-height: 1.5em; }
316
  #mapi-wrap #mapi-list-header span { display: inline-block; padding: 8px 9px; }
317
  #mapi-table-wrap { position: relative; }
@@ -323,6 +324,10 @@ tr:hover .on-hover { display: block; }
323
  #mapi-table-wrap .unsupported span { text-decoration:none;color:#555 }
324
  #mapi-table-wrap table { border-left:none; border-right: none; }
325
  #mapi-table-wrap { margin-left: -.5rem; margin-right: -.5rem; }
 
 
 
 
326
  /**
327
  - TABS + SETTINGS
328
  -*/
@@ -378,6 +383,9 @@ tr:hover .on-hover { display: block; }
378
  #advanced-ads-feedback-content input[type="text"] { width: 100%; }
379
  #advanced-ads-feedback-content .advanced_ads_disable_reply { display:none; }
380
  .advanced-ads-feedback-only-deactivate { display: block; text-align: right; }
 
 
 
381
 
382
  /**
383
  - GENERAL
312
  #mapi-wrap tbody .disabled[data-mapiaction="getCode"] { color: #a7a7a7; cursor: default; }
313
  #mapi-wrap tbody [data-mapiaction="updateCode"] { color: #0085ba; }
314
  #mapi-wrap #mapi-update-unit-lists { font-size: 20px; padding: 13px; position: absolute; top: 0; right: 47px; }
315
+ #mapi-show-idle, #mapi-hide-idle { font-size: 20px; padding: 9px; position: absolute; top: 0; right: 78px; color: #72777c; cursor: pointer; }
316
  #mapi-wrap #mapi-list-header { font-weight: 700; display: inline-block; font-size: 13px; line-height: 1.5em; }
317
  #mapi-wrap #mapi-list-header span { display: inline-block; padding: 8px 9px; }
318
  #mapi-table-wrap { position: relative; }
324
  #mapi-table-wrap .unsupported span { text-decoration:none;color:#555 }
325
  #mapi-table-wrap table { border-left:none; border-right: none; }
326
  #mapi-table-wrap { margin-left: -.5rem; margin-right: -.5rem; }
327
+ .advanced-ads-adsense-support { background-color: #fbfbfb; border: 1px solid #eee; padding: 1em; }
328
+ .advanced-ads-adsense-support-text { font-size: 1.4em; font-weight: 400; }
329
+ .advanced-ads-adsense-support .dashicons { color: #ffb900; }
330
+
331
  /**
332
  - TABS + SETTINGS
333
  -*/
383
  #advanced-ads-feedback-content input[type="text"] { width: 100%; }
384
  #advanced-ads-feedback-content .advanced_ads_disable_reply { display:none; }
385
  .advanced-ads-feedback-only-deactivate { display: block; text-align: right; }
386
+ .advanced-ads-feedback-review { background-color: #fbfbfb; border: 1px solid #eee; padding: 0.5em; }
387
+ .advanced-ads-feedback-review-text { font-size: 1.2em; font-weight: 400; }
388
+ .advanced-ads-feedback-review .dashicons { color: #ffb900; }
389
 
390
  /**
391
  - GENERAL
admin/assets/js/admin.js CHANGED
@@ -226,7 +226,7 @@ jQuery( document ).ready(function ($) {
226
  $('#advads-last-edited-group').val('');
227
  } else {
228
  advadsgroupformrow.show();
229
- var group_id = $( this ).parents( '.advads-group-row' ).find('.advads-group-id').val();
230
  $('#advads-last-edited-group').val( group_id );
231
  // remember that we opened that one
232
  advadsgroupformrow.data('touched', true);
@@ -255,17 +255,7 @@ jQuery( document ).ready(function ($) {
255
  // display placement settings form
256
  $( '.advads-placements-table a.advads-placement-options-link' ).click(function(e){
257
  e.preventDefault();
258
- var advadsplacementformrow = $( this ).next( '.advads-placements-advanced-options' );
259
- if( advadsplacementformrow.is( ':visible' ) ){
260
- advadsplacementformrow.hide();
261
- // clear last edited id
262
- $('#advads-last-edited-placement').val('');
263
- } else {
264
- var placement_id = $( this ).parents( '.advads-placements-table-options' ).find('.advads-placement-slug').val();
265
- advadsplacementformrow.show();
266
- $('#advads-last-edited-placement').val( placement_id );
267
-
268
- }
269
  });
270
  // display manual placement usage
271
  $( '.advads-placements-table .usage-link' ).click(function(e){
@@ -473,6 +463,16 @@ jQuery( document ).ready(function ($) {
473
  }
474
  });
475
 
 
 
 
 
 
 
 
 
 
 
476
  // on submit remove placements that were untouched
477
  $ ('form#advanced-ads-placements-form').submit(function(){
478
  var grouprows = jQuery( 'form#advanced-ads-placements-form tr.advanced-ads-placement-row' );
@@ -988,5 +988,22 @@ window.Advanced_Ads_Admin = window.Advanced_Ads_Admin || {
988
  else{
989
  jQuery('#advads-parameters-shortcodes-warning').hide();
990
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
991
  }
992
  };
226
  $('#advads-last-edited-group').val('');
227
  } else {
228
  advadsgroupformrow.show();
229
+ var group_id = advadsgroupformrow.find('.advads-group-id').val();
230
  $('#advads-last-edited-group').val( group_id );
231
  // remember that we opened that one
232
  advadsgroupformrow.data('touched', true);
255
  // display placement settings form
256
  $( '.advads-placements-table a.advads-placement-options-link' ).click(function(e){
257
  e.preventDefault();
258
+ Advanced_Ads_Admin.toggle_placements_visibility(this);
 
 
 
 
 
 
 
 
 
 
259
  });
260
  // display manual placement usage
261
  $( '.advads-placements-table .usage-link' ).click(function(e){
463
  }
464
  });
465
 
466
+ // some special form elements overwrite the jquery listeners (or render them unusable in some strange way)
467
+ // to counter that and make it more robust in general, we now listen for mouseover events, that will
468
+ // only occur, when the settings of a placement are expanded (let's just assume this means editing)
469
+ $( 'form#advanced-ads-placements-form .advads-placements-advanced-options' ).on( 'mouseover' , function(){
470
+ var tr = $( this ).closest( 'tr.advanced-ads-placement-row' );
471
+ if (tr){
472
+ tr.data('touched', true);
473
+ }
474
+ });
475
+
476
  // on submit remove placements that were untouched
477
  $ ('form#advanced-ads-placements-form').submit(function(){
478
  var grouprows = jQuery( 'form#advanced-ads-placements-form tr.advanced-ads-placement-row' );
988
  else{
989
  jQuery('#advads-parameters-shortcodes-warning').hide();
990
  }
991
+ },
992
+ toggle_placements_visibility: function(elm){
993
+ var advadsplacementformrow = jQuery( elm ).next( '.advads-placements-advanced-options' );
994
+ if( advadsplacementformrow.is( ':visible' ) ){
995
+ advadsplacementformrow.hide();
996
+ // clear last edited id
997
+ jQuery('#advads-last-edited-placement').val('');
998
+ } else {
999
+ var placement_id = jQuery( elm ).parents( '.advads-placements-table-options' ).find('.advads-placement-slug').val();
1000
+ advadsplacementformrow.show();
1001
+ jQuery('#advads-last-edited-placement').val( placement_id );
1002
+ // some special elements (color picker) may not be detected with jquery
1003
+ var tr = jQuery( elm ).closest( 'tr.advanced-ads-placement-row' );
1004
+ if (tr){
1005
+ tr.data('touched', true);
1006
+ }
1007
+ }
1008
  }
1009
  };
admin/includes/class-ad-type.php CHANGED
@@ -331,8 +331,10 @@ class Advanced_Ads_Admin_Ad_Type {
331
  }
332
  $ad->url = 0;
333
  if ( isset($_POST['advanced_ad']['url']) ) {
334
- $ad->url = esc_url( $_POST['advanced_ad']['url'] );
 
335
  }
 
336
  // save size
337
  $ad->width = 0;
338
  if ( isset($_POST['advanced_ad']['width']) ) {
@@ -542,7 +544,7 @@ class Advanced_Ads_Admin_Ad_Type {
542
  wp_add_inline_script(
543
  'code-editor',
544
  sprintf(
545
- 'jQuery( function() { if( jQuery( "#advads-ad-content-plain" ).length ){ Advanced_Ads_Admin.editor = wp.codeEditor.initialize( "advads-ad-content-plain", %s ); Advanced_Ads_Admin.editor.codemirror.on("keyup", Advanced_Ads_Admin.check_ad_source); } } );',
546
  wp_json_encode( $settings )
547
  )
548
  );
331
  }
332
  $ad->url = 0;
333
  if ( isset($_POST['advanced_ad']['url']) ) {
334
+ // May contain placeholders added by the tracking add-on.
335
+ $ad->url = trim( $_POST['advanced_ad']['url'] );
336
  }
337
+
338
  // save size
339
  $ad->width = 0;
340
  if ( isset($_POST['advanced_ad']['width']) ) {
544
  wp_add_inline_script(
545
  'code-editor',
546
  sprintf(
547
+ 'jQuery( function() { if( jQuery( "#advads-ad-content-plain" ).length && typeof Advanced_Ads_Admin !== "undefined" ){ Advanced_Ads_Admin.editor = wp.codeEditor.initialize( "advads-ad-content-plain", %s ); Advanced_Ads_Admin.editor.codemirror.on("keyup", Advanced_Ads_Admin.check_ad_source); jQuery( function() { Advanced_Ads_Admin.check_ad_source(); } ); } } );',
548
  wp_json_encode( $settings )
549
  )
550
  );
admin/includes/class-licenses.php CHANGED
@@ -144,6 +144,13 @@ class Advanced_Ads_Admin_Licenses {
144
  return '<pre>' . print_r( $response, true ) . '</pre>';
145
  }
146
 
 
 
 
 
 
 
 
147
  if ( is_wp_error( $response ) ) {
148
  $body = wp_remote_retrieve_body( $response );
149
  if ( $body ){
@@ -196,6 +203,29 @@ class Advanced_Ads_Admin_Licenses {
196
  return 1;
197
  }
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  /**
200
  * check if a specific license key was already activated for the current page
201
  *
@@ -277,9 +307,11 @@ class Advanced_Ads_Admin_Licenses {
277
 
278
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
279
 
280
- // check if call was blocked by our site (e.g., Firewall)
281
- if( isset( $response['response']['code'] ) && 403 === $response['response']['code'] ){
282
- return sprintf(__( 'Your call was blocked by a Firewall. <a href="%s" target="_blank">Learn more</a>', 'advanced-ads' ), ADVADS_URL . "manual/i-cant-activate-my-license/" );
 
 
283
  }
284
 
285
  // save license status
144
  return '<pre>' . print_r( $response, true ) . '</pre>';
145
  }
146
 
147
+ /**
148
+ * send the user to our support when his request is blocked by our firewall
149
+ */
150
+ if( $error = $this->blocked_by_firewall( $response) ){
151
+ return $error;
152
+ }
153
+
154
  if ( is_wp_error( $response ) ) {
155
  $body = wp_remote_retrieve_body( $response );
156
  if ( $body ){
203
  return 1;
204
  }
205
 
206
+ /**
207
+ * check if a request was blocked by our firewall
208
+ */
209
+ public function blocked_by_firewall( $response ){
210
+ $response_code = wp_remote_retrieve_response_code( $response );
211
+ if( '403' == $response_code ){
212
+ $blocked_information = '–';
213
+ if( isset( $response['body'] ) ){
214
+ // look for the IP address in this line: `<td><span>95.90.238.103</span></td>`
215
+ $pattern = '/<span>([.0-9]*)<\/span>/';
216
+ $matches = array();
217
+ preg_match( $pattern, $response['body'], $matches );
218
+ $ip = isset( $matches[ 1 ] ) ? $matches[ 1 ] : '–';
219
+ $blocked_information = 'IP: ' . $ip;
220
+ }
221
+
222
+ // translators: %s is a list of server information like IP address. Just keep it as is.
223
+ return sprintf( __( 'Your request was blocked by our firewall. Please send us the following information to unblock you: %s.', 'advanced-ads' ), $blocked_information );
224
+ }
225
+
226
+ return false;
227
+ }
228
+
229
  /**
230
  * check if a specific license key was already activated for the current page
231
  *
307
 
308
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
309
 
310
+ /**
311
+ * send the user to our support when his request is blocked by our firewall
312
+ */
313
+ if( $error = $this->blocked_by_firewall( $response) ){
314
+ return $error;
315
  }
316
 
317
  // save license status
admin/includes/class-list-filters.php CHANGED
@@ -93,7 +93,10 @@ class Advanced_Ads_Ad_List_Filters {
93
  }
94
 
95
  $advads = Advanced_Ads::get_instance();
96
-
 
 
 
97
  foreach ( $posts as $post ) {
98
 
99
  if ( ! isset( $this->all_ads_options[ $post->ID ] ) ) {
@@ -101,10 +104,18 @@ class Advanced_Ads_Ad_List_Filters {
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
 
@@ -190,11 +201,20 @@ class Advanced_Ads_Ad_List_Filters {
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
 
93
  }
94
 
95
  $advads = Advanced_Ads::get_instance();
96
+
97
+ // put potential groups in another array which we later reduce so that we only check groups we don’t know, yet
98
+ $groups_to_check = $this->ads_in_groups;
99
+
100
  foreach ( $posts as $post ) {
101
 
102
  if ( ! isset( $this->all_ads_options[ $post->ID ] ) ) {
104
  }
105
  $ad_option = $this->all_ads_options[ $post->ID ];
106
 
107
+ /**
108
+ * check if this particular ad belongs to a group and if so,
109
+ * add the group to the list of filterable groups
110
+ * skip when the group is already known
111
+ */
112
+ foreach ( $groups_to_check as $key => $ads ) {
113
+ if( ! isset( $all_filters['all_groups'][ $key ] ) // skip if this group is already known
114
+ && in_array( $post->ID, $ads, true ) ) {
115
  $all_filters['all_groups'][ $key ] = $this->all_groups[ $key ]['name'];
116
+ // remove groups that are already selected for the filter
117
+ unset( $groups_to_check[ $key ] );
118
+ continue;
119
  }
120
  }
121
 
201
  }
202
 
203
  $group_ids = array_keys( $groups );
204
+ $group_ids_str = implode( ',', $group_ids );
205
+ $term_relations = array();
206
+
207
+ /**
208
+ * we need to use %1$s below, because when using %s the $wpdb->prepare function adds quotation marks around the value,
209
+ * which breaks the SQL, because the numbers are no longer recognised as such
210
+ */
211
+ if ( ! empty( $group_ids ) ) {
212
+ $term_relations = $wpdb->get_results( $wpdb->prepare( 'SELECT object_id, term_taxonomy_id FROM `' . $wpdb->prefix . 'term_relationships` WHERE `term_taxonomy_id` IN (%1$s)', implode( ',', $group_ids ) ), 'ARRAY_A' );
213
+ }
214
+ foreach ( $term_relations as $value ) {
215
+ if ( isset( $value['term_taxonomy_id'] ) && isset( $value['object_id'] ) ) {
216
+ // if ( ! array_key_exists( absint( $value['term_taxonomy_id'] ), $this->ads_in_groups ) ) {
217
+ $this->ads_in_groups[ absint( $value['term_taxonomy_id'] ) ][] = absint( $value['object_id'] );
218
  }
219
  }
220
 
admin/includes/class-meta-box.php CHANGED
@@ -377,14 +377,6 @@ class Advanced_Ads_Admin_Meta_Boxes {
377
  echo '</p>';
378
  }
379
 
380
- // get and display plugin version
381
- $advads_plugin_data = get_plugin_data( ADVADS_BASE_PATH . 'advanced-ads.php' );
382
- if ( isset($advads_plugin_data['Version']) ){
383
- $version = $advads_plugin_data['Version'];
384
- echo '<p><a href="'.ADVADS_URL.'#utm_source=advanced-ads&utm_medium=link&utm_campaign=dashboard" target="_blank" title="'.
385
- __( 'plugin manual and homepage', 'advanced-ads' ).'">Advanced Ads</a> '. $version .'</p>';
386
- }
387
-
388
  $notice_options = Advanced_Ads_Admin_Notices::get_instance()->options();
389
  $_notice = 'nl_first_steps';
390
  if ( ! isset($notice_options['closed'][ $_notice ] ) ) {
@@ -402,6 +394,8 @@ class Advanced_Ads_Admin_Meta_Boxes {
402
 
403
  // rss feed
404
  self::dashboard_cached_rss_widget();
 
 
405
 
406
  // add markup for utm variables
407
  // todo: move to js file
@@ -449,21 +443,12 @@ class Advanced_Ads_Admin_Meta_Boxes {
449
  $cache_key = 'dash_' . md5( 'advads_dashboard_widget' );
450
 
451
  $feeds = array(
452
- array(
453
- 'link' => 'http://webgilde.com/en/ad-optimization/',
454
- 'url' => 'http://webgilde.com/en/ad-optimization/feed/',
455
- 'title' => __( 'From the ad optimization universe', 'advanced-ads' ),
456
- 'items' => 2,
457
- 'show_summary' => 0,
458
- 'show_author' => 0,
459
- 'show_date' => 0,
460
- ),
461
  array(
462
  'link' => ADVADS_URL,
463
  'url' => ADVADS_URL . 'feed/',
464
  'title' => __( 'Advanced Ads Tutorials', 'advanced-ads' ),
465
  'items' => 2,
466
- 'show_summary' => 0,
467
  'show_author' => 0,
468
  'show_date' => 0,
469
  ),
377
  echo '</p>';
378
  }
379
 
 
 
 
 
 
 
 
 
380
  $notice_options = Advanced_Ads_Admin_Notices::get_instance()->options();
381
  $_notice = 'nl_first_steps';
382
  if ( ! isset($notice_options['closed'][ $_notice ] ) ) {
394
 
395
  // rss feed
396
  self::dashboard_cached_rss_widget();
397
+
398
+ ?><p><a href="<?php echo ADVADS_URL . 'category/tutorials/#utm_source=advanced-ads&utm_medium=link&utm_campaign=dashboard'; ?>" target="_blank"><?php _e('Visit our blog for more articles about ad optimization', 'advanced-ads' ) ?></a></p><?php
399
 
400
  // add markup for utm variables
401
  // todo: move to js file
443
  $cache_key = 'dash_' . md5( 'advads_dashboard_widget' );
444
 
445
  $feeds = array(
 
 
 
 
 
 
 
 
 
446
  array(
447
  'link' => ADVADS_URL,
448
  'url' => ADVADS_URL . 'feed/',
449
  'title' => __( 'Advanced Ads Tutorials', 'advanced-ads' ),
450
  'items' => 2,
451
+ 'show_summary' => 1,
452
  'show_author' => 0,
453
  'show_date' => 0,
454
  ),
admin/includes/class-notices.php CHANGED
@@ -124,12 +124,6 @@ class Advanced_Ads_Admin_Notices {
124
  // empty version for new installations
125
  $old_version = 0;
126
  }
127
-
128
- if ( isset($internal_options['version']) && ($internal_options['version'] !== ADVADS_VERSION) && $old_version ) {
129
- if ( version_compare( $old_version, '1.7' ) == -1 ) {
130
- $this->notices[] = '1.7';
131
- }
132
- }
133
  }
134
 
135
  /**
124
  // empty version for new installations
125
  $old_version = 0;
126
  }
 
 
 
 
 
 
127
  }
128
 
129
  /**
admin/includes/notices.php CHANGED
@@ -31,11 +31,6 @@ $advanced_ads_admin_notices = apply_filters( 'advanced-ads-notices', array(
31
  'confirm_text' => __( 'Subscribe me now', 'advanced-ads' ),
32
  'global' => true
33
  ),
34
- // if users updated from a previous version to 1.7
35
- '1.7' => array(
36
- 'type' => 'update',
37
- 'text' => 'Advanced Ads 1.7 made changes to the Display Conditions interface. Please check your settings and the <a href="https://wpadvancedads.com/manual/display-conditions/" target="_blank">manual</a>, if you are using them.',
38
- ),
39
  // missing license codes
40
  'license_invalid' => array(
41
  'type' => 'plugin_error',
31
  'confirm_text' => __( 'Subscribe me now', 'advanced-ads' ),
32
  'global' => true
33
  ),
 
 
 
 
 
34
  // missing license codes
35
  'license_invalid' => array(
36
  'type' => 'plugin_error',
admin/views/ad-group-list-form-row.php CHANGED
@@ -10,8 +10,10 @@
10
  */
11
 
12
  // Open form if this was the last edited.
13
- $hidden = ( isset( $_POST['advads-last-edited-group'] ) && $group->id === $_POST['advads-last-edited-group'] ) ? '' : ' hidden';
14
- ?><tr class="advads-ad-group-form<?php echo esc_attr( $hidden ); ?>">
 
 
15
  <td colspan="3">
16
  <?php
17
  // group name.
10
  */
11
 
12
  // Open form if this was the last edited.
13
+ $is_last_edited = isset( $_REQUEST['advads-last-edited-group'] ) && $group->id == $_REQUEST['advads-last-edited-group'];
14
+ $hidden = $is_last_edited ? '' : ' hidden';
15
+ $jquery_data = $is_last_edited ? 'data-touched="true"' : '';
16
+ ?><tr id="advads-ad-group-<?php echo $group->id;?>" class="advads-ad-group-form<?php echo esc_attr( $hidden ); ?>" <?php echo $jquery_data; ?>>
17
  <td colspan="3">
18
  <?php
19
  // group name.
admin/views/ad-group.php CHANGED
@@ -35,6 +35,22 @@ if ( isset( $_REQUEST['advads-group-update-nonce'] ) ) {
35
  }
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  ?><div class="wrap nosubsub">
39
  <h1 class="wp-heading-inline">
40
  <?php
@@ -86,7 +102,7 @@ if ( isset( $_REQUEST['advads-group-update-nonce'] ) ) {
86
  <?php $ad_groups_list->render_header(); ?>
87
  <?php $ad_groups_list->render_rows(); ?>
88
  </table>
89
- <input type="hidden" name="advads-last-edited-group" id="advads-last-edited-group" value="0"/>
90
  <div class="tablenav bottom">
91
  <?php submit_button( __( 'Update Groups', 'advanced-ads' ) ); ?>
92
  </div>
35
  }
36
  }
37
 
38
+ $last_edited_group_id = 0;
39
+ if (isset( $_REQUEST['advads-last-edited-group'] )){
40
+ $last_edited_group_id = $_REQUEST['advads-last-edited-group'];
41
+ wp_add_inline_script(
42
+ 'advads-ad-groups', 'alert("TEST");'
43
+ );
44
+ ?>
45
+ <script>
46
+ var body = document.getElementsByTagName("body")[0];
47
+ body.addEventListener("load", function(){
48
+ jQuery('#advads-ad-group-<?php echo $last_edited_group_id?>').get(0).scrollIntoView(false);
49
+ }, true);
50
+ </script>
51
+ <?php
52
+ }
53
+
54
  ?><div class="wrap nosubsub">
55
  <h1 class="wp-heading-inline">
56
  <?php
102
  <?php $ad_groups_list->render_header(); ?>
103
  <?php $ad_groups_list->render_rows(); ?>
104
  </table>
105
+ <input type="hidden" name="advads-last-edited-group" id="advads-last-edited-group" value="<?php echo $last_edited_group_id;?>"/>
106
  <div class="tablenav bottom">
107
  <?php submit_button( __( 'Update Groups', 'advanced-ads' ) ); ?>
108
  </div>
admin/views/ad-visitor-metabox.php CHANGED
@@ -140,6 +140,8 @@ jQuery( document ).ready(function ($) {
140
  var visitor_condition_index = parseInt( $('#advads-visitor-conditions-index').val() );
141
  if( ! visitor_condition_type ) return;
142
  $('#advads-visitor-conditions-new .advads-loader').show();
 
 
143
  $.ajax({
144
  type: 'POST',
145
  url: ajaxurl,
@@ -170,6 +172,10 @@ jQuery( document ).ready(function ($) {
170
  error: function (MLHttpRequest, textStatus, errorThrown) {
171
  $( '#advads-visitor-conditions-new' ).append( errorThrown );
172
  $('#advads-visitor-conditions-new .advads-loader').hide();
 
 
 
 
173
  }
174
  });
175
  });
140
  var visitor_condition_index = parseInt( $('#advads-visitor-conditions-index').val() );
141
  if( ! visitor_condition_type ) return;
142
  $('#advads-visitor-conditions-new .advads-loader').show();
143
+ $('#advads-visitor-conditions-new button').hide();
144
+
145
  $.ajax({
146
  type: 'POST',
147
  url: ajaxurl,
172
  error: function (MLHttpRequest, textStatus, errorThrown) {
173
  $( '#advads-visitor-conditions-new' ).append( errorThrown );
174
  $('#advads-visitor-conditions-new .advads-loader').hide();
175
+ },
176
+ complete: function( MLHttpRequest, textStatus ) {
177
+ $('#advads-visitor-conditions-new .advads-loader').hide(); // hide loader
178
+ $('#advads-visitor-conditions-new button').show(); // display add button
179
  }
180
  });
181
  });
admin/views/feedback-disable.php CHANGED
@@ -22,6 +22,15 @@
22
  <li><input type="text" name="advanced_ads_disable_text[]" value="" placeholder="<?php esc_attr_e( 'Which one?', 'advanced-ads' ); ?>"/></li>
23
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="stopped showing ads"/><?php esc_attr_e( 'I stopped using ads on my site.', 'advanced-ads' ); ?></label></li>
24
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="other plugin"/><?php esc_attr_e( 'I switched to another plugin', 'advanced-ads' ); ?></label></li>
 
 
 
 
 
 
 
 
 
25
  </ul>
26
  <?php if ( $from ) : ?>
27
  <input type="hidden" name="advanced_ads_disable_from" value="<?php echo $from; ?>"/>
22
  <li><input type="text" name="advanced_ads_disable_text[]" value="" placeholder="<?php esc_attr_e( 'Which one?', 'advanced-ads' ); ?>"/></li>
23
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="stopped showing ads"/><?php esc_attr_e( 'I stopped using ads on my site.', 'advanced-ads' ); ?></label></li>
24
  <li><label><input type="radio" name="advanced_ads_disable_reason" value="other plugin"/><?php esc_attr_e( 'I switched to another plugin', 'advanced-ads' ); ?></label></li>
25
+ <li class="advanced-ads-feedback-review"><span class="advanced-ads-feedback-review-text"><?php _e( 'Faster than the AdSense support!', 'advanced-ads' ); ?></span>
26
+ <span class="dashicons dashicons-star-filled"></span>
27
+ <span class="dashicons dashicons-star-filled"></span>
28
+ <span class="dashicons dashicons-star-filled"></span>
29
+ <span class="dashicons dashicons-star-filled"></span>
30
+ <span class="dashicons dashicons-star-filled"></span>
31
+ <a href="<?php echo Advanced_Ads_Plugin::support_url( '#utm_source=advanced-ads&utm_medium=link&utm_campaign=disable-support' ); ?>" target="_blank"><?php
32
+ _e( 'reach out for help', 'advanced-ads' ); ?></a>
33
+ </li>
34
  </ul>
35
  <?php if ( $from ) : ?>
36
  <input type="hidden" name="advanced_ads_disable_from" value="<?php echo $from; ?>"/>
admin/views/notices/adblock.php CHANGED
@@ -1,10 +1,11 @@
1
- <div class="advads-ad-block-check">
2
- <div class="message error update-message notice notice-alt notice-error" style="display: none;"><p><?php _e( 'Please disable your <strong>AdBlocker</strong> to prevent problems with your ad setup.', 'advanced-ads' ); ?></p></div>
3
- </div>
 
4
  <script>
5
  jQuery( document ).ready( function() {
6
- if ( typeof advanced_ads_adblocker_test === 'undefined' ) {
7
- jQuery('.advads-ad-block-check .message').show();
8
  }
9
  } );
10
- </script>
1
+ <?php
2
+ $advads_ad_blocker_id = Advanced_Ads_Plugin::get_instance()->get_frontend_prefix() ."abcheck-" . md5(microtime());
3
+ ?>
4
+ <div id="<?php echo $advads_ad_blocker_id; ?>" class="message error update-message notice notice-alt notice-error" style="display: none;"><p><?php _e( 'Please disable your <strong>AdBlocker</strong> to prevent problems with your ad setup.', 'advanced-ads' ); ?></p></div>
5
  <script>
6
  jQuery( document ).ready( function() {
7
+ if ( typeof advanced_ads_adblocker_test == 'undefined' ) {
8
+ jQuery('#<?php echo $advads_ad_blocker_id; ?>.message').show();
9
  }
10
  } );
11
+ </script>
admin/views/placements-item.php CHANGED
@@ -35,7 +35,7 @@ if ( isset( $_placement['item'] ) ) :
35
  $link_to_item = get_edit_post_link( $currently_linked_item[1] );
36
  break;
37
  case 'group':
38
- $link_to_item = admin_url( 'admin.php?page=advanced-ads-groups' ); // ( $currently_linked_item[1] );
39
  break;
40
  endswitch;
41
  if ( $link_to_item ) :
35
  $link_to_item = get_edit_post_link( $currently_linked_item[1] );
36
  break;
37
  case 'group':
38
+ $link_to_item = admin_url( 'admin.php?page=advanced-ads-groups&advads-last-edited-group=' . $currently_linked_item[1] );
39
  break;
40
  endswitch;
41
  if ( $link_to_item ) :
admin/views/placements.php CHANGED
@@ -159,7 +159,7 @@ if ( isset( $placements ) && is_array( $placements ) && count( $placements ) ) :
159
  $advanced_options = ob_get_clean();
160
  if ( $advanced_options ) :
161
  ?>
162
- <a class="advads-toggle-link advads-placement-options-link"><?php _e( 'show all options', 'advanced-ads' ); ?></a>
163
  <?php
164
  $hidden = ( isset( $_POST['advads-last-edited-placement'] ) && $_placement_slug == $_POST['advads-last-edited-placement'] ) ? '' : ' hidden';
165
  ?>
159
  $advanced_options = ob_get_clean();
160
  if ( $advanced_options ) :
161
  ?>
162
+ <a class="advads-toggle-link advads-placement-options-link" data-placement="<?php echo $_placement_slug ?>"><?php _e( 'show all options', 'advanced-ads' ); ?></a>
163
  <?php
164
  $hidden = ( isset( $_POST['advads-last-edited-placement'] ) && $_placement_slug == $_POST['advads-last-edited-placement'] ) ? '' : ' hidden';
165
  ?>
admin/views/post-ad-settings-metabox.php CHANGED
@@ -1,3 +1,4 @@
 
1
  <label><input type="checkbox" name="advanced_ads[disable_ads]" value="1" <?php
2
  if ( isset( $values['disable_ads'] ) ) {
3
  checked( $values['disable_ads'], true ); }
1
+ <p><a href="<?php echo ADVADS_URL ?>how-to-block-ads-on-a-specific-page/#utm_source=advanced-ads&utm_medium=link&utm_campaign=disable-ads-on-specific-pages" target="_blank"><?php _e( 'How to disable ads on specific pages', 'advanced-ads'); ?></a></p>
2
  <label><input type="checkbox" name="advanced_ads[disable_ads]" value="1" <?php
3
  if ( isset( $values['disable_ads'] ) ) {
4
  checked( $values['disable_ads'], true ); }
advanced-ads.php CHANGED
@@ -6,13 +6,13 @@
6
  * @author Thomas Maier <thomas.maier@webgilde.com>
7
  * @license GPL-2.0+
8
  * @link https://wpadvancedads.com
9
- * @copyright 2013-2018 Thomas Maier, webgilde GmbH
10
  *
11
  * @wordpress-plugin
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
- * Version: 1.10.12
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.10.12' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
6
  * @author Thomas Maier <thomas.maier@webgilde.com>
7
  * @license GPL-2.0+
8
  * @link https://wpadvancedads.com
9
+ * @copyright 2013-2019 Thomas Maier, webgilde GmbH
10
  *
11
  * @wordpress-plugin
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.11
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.11' );
43
 
44
  /*----------------------------------------------------------------------------*
45
  * Autoloading, modules and functions
classes/ad.php CHANGED
@@ -176,7 +176,7 @@ class Advanced_Ads_Ad {
176
  } else {
177
  $this->type_obj = new Advanced_Ads_Ad_Type_Abstract;
178
  }
179
- $this->url = $this->options( 'url' );
180
  $this->width = absint( $this->options( 'width' ) );
181
  $this->height = absint( $this->options( 'height' ) );
182
  $this->conditions = $this->options( 'conditions' );
@@ -475,6 +475,8 @@ class Advanced_Ads_Ad {
475
 
476
  $options['type'] = $this->type;
477
  $options['url'] = $this->url;
 
 
478
  $options['width'] = $this->width;
479
  $options['height'] = $this->height;
480
  $options['conditions'] = $conditions;
@@ -551,13 +553,6 @@ class Advanced_Ads_Ad {
551
  $output = $this->label . $output;
552
  }
553
 
554
- // add edit button for users with the appropriate rights
555
- if( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ){
556
- ob_start();
557
- include ADVADS_BASE_PATH . 'public/views/ad-edit-bar.php';
558
- $output = ob_get_clean() . $output;
559
- }
560
-
561
  // build wrapper around the ad
562
  $output = $this->add_wrapper( $output );
563
 
@@ -775,6 +770,13 @@ class Advanced_Ads_Ad {
775
  $this->wrapper['id'] = $wrapper_options['id'] = $this->create_wrapper_id();
776
  }
777
 
 
 
 
 
 
 
 
778
  // build the box
779
  $wrapper = '<div' . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
780
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-before-content', '', $this );
@@ -838,6 +840,26 @@ class Advanced_Ads_Ad {
838
  }
839
  }
840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
841
 
842
 
843
  }
176
  } else {
177
  $this->type_obj = new Advanced_Ads_Ad_Type_Abstract;
178
  }
179
+ $this->url = $this->get_url();
180
  $this->width = absint( $this->options( 'width' ) );
181
  $this->height = absint( $this->options( 'height' ) );
182
  $this->conditions = $this->options( 'conditions' );
475
 
476
  $options['type'] = $this->type;
477
  $options['url'] = $this->url;
478
+ // Inform the tracking add-on about the new url.
479
+ unset ( $options['tracking']['link'] );
480
  $options['width'] = $this->width;
481
  $options['height'] = $this->height;
482
  $options['conditions'] = $conditions;
553
  $output = $this->label . $output;
554
  }
555
 
 
 
 
 
 
 
 
556
  // build wrapper around the ad
557
  $output = $this->add_wrapper( $output );
558
 
770
  $this->wrapper['id'] = $wrapper_options['id'] = $this->create_wrapper_id();
771
  }
772
 
773
+ // add edit button for users with the appropriate rights
774
+ if( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ){
775
+ ob_start();
776
+ include ADVADS_BASE_PATH . 'public/views/ad-edit-bar.php';
777
+ $ad_content = ob_get_clean() . $ad_content;
778
+ }
779
+
780
  // build the box
781
  $wrapper = '<div' . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
782
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-before-content', '', $this );
840
  }
841
  }
842
 
843
+ /**
844
+ * Get the ad url.
845
+ *
846
+ * @return string
847
+ */
848
+ private function get_url() {
849
+ $this->url = $this->options( 'url' );
850
+
851
+ // If the tracking add-on is not active.
852
+ if ( ! defined( 'AAT_VERSION' ) ) {
853
+ global $pagenow;
854
+ // If this is not the ad edit page.
855
+ if ( 'post.php' !== $pagenow && 'post-new.php' !== $pagenow ) {
856
+ // Remove placeholders.
857
+ $this->url = str_replace( array( '[POST_ID]', '[POST_SLUG]', '[CAT_SLUG]', '[AD_ID]' ), '', $this->url );
858
+ }
859
+ }
860
+ return $this->url;
861
+ }
862
+
863
 
864
 
865
  }
classes/ad_type_dummy.php CHANGED
@@ -41,9 +41,9 @@ class Advanced_Ads_Ad_Type_Dummy extends Advanced_Ads_Ad_Type_Abstract{
41
 
42
  // don’t show url field if tracking plugin enabled
43
  if( ! defined( 'AAT_VERSION' )) :
44
- $url = ( ! empty( $ad->url ) ) ? esc_url( $ad->url ) : home_url();
45
  ?><span class="label"><?php _e( 'URL', 'advanced-ads' ); ?></span>
46
- <div><input type="url" name="advanced_ad[url]" id="advads-url" class="advads-ad-url" value="<?php echo $url; ?>"/></div><hr/>
47
  <?php endif;
48
 
49
  ?><img src="<?php echo ADVADS_BASE_URL ?>/public/assets/img/dummy.jpg" width="300" height="250"/><?php
41
 
42
  // don’t show url field if tracking plugin enabled
43
  if( ! defined( 'AAT_VERSION' )) :
44
+ $url = ( ! empty( $ad->url ) ) ? esc_attr( $ad->url ) : home_url();
45
  ?><span class="label"><?php _e( 'URL', 'advanced-ads' ); ?></span>
46
+ <div><input type="text" name="advanced_ad[url]" id="advads-url" class="advads-ad-url" value="<?php echo $url; ?>"/></div><hr/>
47
  <?php endif;
48
 
49
  ?><img src="<?php echo ADVADS_BASE_URL ?>/public/assets/img/dummy.jpg" width="300" height="250"/><?php
classes/ad_type_image.php CHANGED
@@ -49,7 +49,7 @@ class Advanced_Ads_Ad_Type_Image extends Advanced_Ads_Ad_Type_Abstract{
49
  public function render_parameters($ad){
50
  // load tinymc content exitor
51
  $id = ( isset( $ad->output['image_id'] ) ) ? $ad->output['image_id'] : '';
52
- $url = ( isset( $ad->url ) ) ? esc_url( $ad->url ) : '';
53
 
54
  ?><p><button href="#" class="advads_image_upload button button-secondary" type="button" data-uploader-title="<?php
55
  _e( 'Insert File', 'advanced-ads' ); ?>" data-uploader-button-text="<?php _e( 'Insert', 'advanced-ads' ); ?>" onclick="return false;"><?php _e( 'select image', 'advanced-ads' ); ?></button>
@@ -59,12 +59,11 @@ class Advanced_Ads_Ad_Type_Image extends Advanced_Ads_Ad_Type_Abstract{
59
  <div id="advads-image-preview">
60
  <?php $this->create_image_tag( $id, $ad ); ?>
61
  </div>
62
-
63
  <?php // don’t show if tracking plugin enabled
64
  if( ! defined( 'AAT_VERSION' )) : ?>
65
  <span class="label"><?php _e( 'URL', 'advanced-ads' ); ?></span>
66
  <div>
67
- <input type="url" name="advanced_ad[url]" id="advads-url" class="advads-ad-url" value="<?php echo $url; ?>" placeholder="<?php _e( 'Link to target site', 'advanced-ads' ); ?>" /></p>
68
  </div><hr/><?php
69
  endif;
70
  }
49
  public function render_parameters($ad){
50
  // load tinymc content exitor
51
  $id = ( isset( $ad->output['image_id'] ) ) ? $ad->output['image_id'] : '';
52
+ $url = ( isset( $ad->url ) ) ? esc_attr( $ad->url ) : '';
53
 
54
  ?><p><button href="#" class="advads_image_upload button button-secondary" type="button" data-uploader-title="<?php
55
  _e( 'Insert File', 'advanced-ads' ); ?>" data-uploader-button-text="<?php _e( 'Insert', 'advanced-ads' ); ?>" onclick="return false;"><?php _e( 'select image', 'advanced-ads' ); ?></button>
59
  <div id="advads-image-preview">
60
  <?php $this->create_image_tag( $id, $ad ); ?>
61
  </div>
 
62
  <?php // don’t show if tracking plugin enabled
63
  if( ! defined( 'AAT_VERSION' )) : ?>
64
  <span class="label"><?php _e( 'URL', 'advanced-ads' ); ?></span>
65
  <div>
66
+ <input type="text" name="advanced_ad[url]" id="advads-url" class="advads-ad-url" value="<?php echo $url; ?>" placeholder="<?php _e( 'Link to target site', 'advanced-ads' ); ?>" /></p>
67
  </div><hr/><?php
68
  endif;
69
  }
classes/ad_type_plain.php CHANGED
@@ -64,7 +64,6 @@ class Advanced_Ads_Ad_Type_Plain extends Advanced_Ads_Ad_Type_Abstract{
64
  * @param $ad Advanced_Ads_Ad object
65
  */
66
  public function render_php_allow( $ad ){
67
-
68
  if( defined( 'ADVANCED_ADS_DISALLOW_PHP' ) ){
69
  return;
70
  }
64
  * @param $ad Advanced_Ads_Ad object
65
  */
66
  public function render_php_allow( $ad ){
 
67
  if( defined( 'ADVANCED_ADS_DISALLOW_PHP' ) ){
68
  return;
69
  }
classes/checks.php CHANGED
@@ -207,6 +207,9 @@ class Advanced_Ads_Checks {
207
  if( class_exists( 'ITSEC_Core', false ) && defined ( 'AAP_VERSION' ) ){ // iThemes Security, but only if Pro is enabled
208
  $conflicting_plugins[] = 'iThemes Security';
209
  }
 
 
 
210
 
211
  return $conflicting_plugins;
212
  }
207
  if( class_exists( 'ITSEC_Core', false ) && defined ( 'AAP_VERSION' ) ){ // iThemes Security, but only if Pro is enabled
208
  $conflicting_plugins[] = 'iThemes Security';
209
  }
210
+ if( class_exists( 'SimilarPosts', false ) ){ // Similar Posts, https://de.wordpress.org/plugins/similar-posts/
211
+ $conflicting_plugins[] = 'Similar Posts';
212
+ }
213
 
214
  return $conflicting_plugins;
215
  }
classes/frontend_checks.php CHANGED
@@ -123,7 +123,7 @@ class Advanced_Ads_Frontend_Checks {
123
  'parent' => 'advanced_ads_ad_health',
124
  'id' => 'advanced_ads_ad_health_the_content_not_invoked',
125
  'title' => sprintf( __( '<em>%s</em> filter does not exist', 'advanced-ads' ), 'the_content' ),
126
- 'href' => ADVADS_URL . 'manual/ads-not-showing-up/#the_content-filter-missing',
127
  'meta' => array(
128
  'class' => 'advanced_ads_ad_health_warning',
129
  'target' => '_blank'
@@ -361,7 +361,17 @@ class Advanced_Ads_Frontend_Checks {
361
  )
362
  ) );
363
  }
364
-
 
 
 
 
 
 
 
 
 
 
365
  }
366
 
367
  /**
123
  'parent' => 'advanced_ads_ad_health',
124
  'id' => 'advanced_ads_ad_health_the_content_not_invoked',
125
  'title' => sprintf( __( '<em>%s</em> filter does not exist', 'advanced-ads' ), 'the_content' ),
126
+ 'href' => ADVADS_URL . 'manual/ads-not-showing-up/?utm_source=advanced-ads&utm_medium=link&utm_campaign=adhealth-content-filter-missing#the_content-filter-missing',
127
  'meta' => array(
128
  'class' => 'advanced_ads_ad_health_warning',
129
  'target' => '_blank'
361
  )
362
  ) );
363
  }
364
+
365
+ $wp_admin_bar->add_node( array(
366
+ 'parent' => 'advanced_ads_ad_health',
367
+ 'id' => 'advanced_ads_ad_health_support',
368
+ 'title' => __( 'Get help', 'advanced-ads' ),
369
+ 'href' => Advanced_Ads_Plugin::support_url( '#utm_source=advanced-ads&utm_medium=link&utm_campaign=health-support' ),
370
+ 'meta' => array(
371
+ 'target' => '_blank',
372
+ )
373
+ ) );
374
+
375
  }
376
 
377
  /**
classes/plugin.php CHANGED
@@ -684,5 +684,31 @@ class Advanced_Ads_Plugin {
684
 
685
  wp_cache_flush();
686
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
 
688
  }
684
 
685
  wp_cache_flush();
686
  }
687
+
688
+ /**
689
+ * check if any add-on is activated
690
+ *
691
+ * @return bol true if there is any add-on activated
692
+ */
693
+ static function any_activated_add_on(){
694
+ return ( defined( 'AAP_VERSION' ) // Advanced Ads Pro
695
+ || defined( 'AASA_VERSION' ) // Selling Ads
696
+ || defined( 'AAT_VERSION' ) // Tracking
697
+ || defined( 'AASADS_VERSION' ) // Sticky Ads
698
+ || defined( 'AAR_VERSION' ) // Responsive Ads
699
+ || defined( 'AAPLDS_VERSION' ) // PopUp and Layer Ads
700
+ || defined( 'AAGT_SLUG' ) // Geo-Targeting
701
+ );
702
+ }
703
+
704
+ /**
705
+ * Get the correct support URL: wp.org for free users and website for those with any add-on installed
706
+ *
707
+ * @param str $utm add UTM parameter to the link leading to https://wpadvancedads.com, if given
708
+ */
709
+ static function support_url( $utm = '' ){
710
+
711
+ return self::any_activated_add_on() ? ADVADS_URL . 'support/' .$utm : 'https://wordpress.org/support/plugin/advanced-ads#new-post';
712
+ }
713
 
714
  }
classes/upgrades.php CHANGED
@@ -4,8 +4,9 @@
4
  * Upgrade logic from older data to new one
5
  *
6
  * the version number itself is changed in /admin/includes/class-notices.php::register_version_notices()
7
- *
8
- * @since 1.7
 
9
  */
10
  class Advanced_Ads_Upgrades {
11
 
@@ -23,20 +24,16 @@ class Advanced_Ads_Upgrades {
23
 
24
  // don’t upgrade if no previous version existed
25
  if( ! empty( $internal_options['version'] ) ) {
 
 
 
 
 
 
26
  if ( version_compare( $internal_options['version'], '1.7' ) == -1 ) {
27
  // run with wp_loaded action, because WP_Query is needed and some plugins inject data that is not yet initialized
28
  add_action( 'wp_loaded', array( $this, 'upgrade_1_7') );
29
- }
30
-
31
- if ( version_compare( $internal_options['version'], '1.7.4' ) == -1 ) {
32
- // upgrate version number only after this ran through, because of the used filter only available in admin
33
- if( ! is_admin() ){
34
- $suppress_version_number_update = true;
35
- // run with wp_loaded action, because Upgrades are checked in the plugins_loaded hook
36
- } else {
37
- add_action( 'wp_loaded', array( $this, 'upgrade_1_7_4') );
38
- }
39
- }
40
  }
41
 
42
  // update version notices – if this doesn’t happen here, the upgrade might run multiple times and destroy updated data
@@ -44,225 +41,4 @@ class Advanced_Ads_Upgrades {
44
  Advanced_Ads_Admin_Notices::get_instance()->update_version_number();
45
  }
46
  }
47
-
48
- /**
49
- * upgrade data to version 1.7
50
- * rewrite existing display conditions
51
- */
52
- public function upgrade_1_7(){
53
-
54
- // get all ads, regardless of the publish status
55
- $args['post_status'] = 'any';
56
- $args['suppress_filters'] = true; // needed to remove issue with a broken plugin from the repository
57
- $ads = Advanced_Ads::get_instance()->get_model()->get_ads( $args );
58
-
59
- // iterate through ads
60
- // error_log(print_r($ads, true));
61
- error_log(print_r('–– STARTING ADVANCED ADS data upgrade to version 1.7 ––', true));
62
- foreach( $ads as $_ad ){
63
- // ad options
64
- $option_key = Advanced_Ads_Ad::$options_meta_field;
65
- if( !isset( $_ad->ID ) || ! $option_key ){
66
- continue;
67
- }
68
- $options = get_post_meta( $_ad->ID, $option_key, true );
69
- // rewrite display conditions
70
- if( ! isset( $options['conditions'] ) ){
71
- continue;
72
- }
73
-
74
- error_log(print_r('AD ID: ' . $_ad->ID, true));
75
- error_log(print_r('OLD CONDITIONS', true));
76
- error_log(print_r($options['conditions'], true));
77
-
78
- $old_conditions = $options['conditions'];
79
-
80
- // check if conditions are disabled
81
- if( ! isset( $old_conditions['enabled'] ) || ! $old_conditions['enabled'] ){
82
- $new_conditions = '';
83
- } else {
84
- $new_conditions = array();
85
-
86
- // rewrite general conditions
87
- $old_general_conditions = array(
88
- 'is_front_page',
89
- 'is_singular',
90
- 'is_archive',
91
- 'is_search',
92
- 'is_404',
93
- 'is_attachment',
94
- 'is_main_query'
95
- );
96
- $general = array();
97
- foreach( $old_general_conditions as $_general_condition ){
98
- if( isset( $old_conditions[ $_general_condition ] ) && $old_conditions[ $_general_condition ] ) {
99
- $general[] = $_general_condition;
100
- }
101
- }
102
- // move general conditions into display conditions
103
- // only, if the number of conditions in the previous setting is lower, because only that means there is an active limitation
104
- // not sure if allowing an empty array is logical, but some users might have set this up to hide an ad
105
- if( count( $general ) < count( $old_general_conditions ) ){
106
- $new_conditions[] = array(
107
- 'type' => 'general',
108
- 'value' => $general
109
- );
110
- }
111
-
112
- // rewrite post types condition
113
- if( isset( $old_conditions[ 'posttypes' ]['include'] )
114
- && ( !isset ( $old_conditions[ 'posttypes' ]['all'] )
115
- || ! $old_conditions[ 'posttypes' ]['all'] ) ) {
116
- if ( is_string( $old_conditions[ 'posttypes' ]['include']) ) {
117
- $old_conditions[ 'posttypes' ]['include'] = explode( ',', $old_conditions[ 'posttypes' ]['include'] );
118
- }
119
- $new_conditions[] = array(
120
- 'type' => 'posttypes',
121
- 'value' => $old_conditions[ 'posttypes' ]['include']
122
- );
123
- }
124
-
125
- /**
126
- * rewrite category ids and category archive ids
127
- *
128
- * the problem is that before there was no connection between term ids and taxonomy, now, each taxonomy has its own condition
129
- */
130
- // check, if there are even such options set
131
- if( ( isset( $old_conditions[ 'categoryids' ] )
132
- && ( !isset ( $old_conditions[ 'categoryids' ]['all'] )
133
- || ! $old_conditions[ 'categoryids' ]['all'] ) )
134
- || ( isset( $old_conditions[ 'categoryarchiveids' ] )
135
- && ( !isset ( $old_conditions[ 'categoryarchiveids' ]['all'] )
136
- || ! $old_conditions[ 'categoryarchiveids' ]['all'] ) ))
137
- {
138
-
139
- // get all taxonomies
140
- $taxonomies = get_taxonomies( array('public' => true, 'publicly_queryable' => true), 'objects', 'or' );
141
- $taxonomy_terms = array();
142
- foreach ( $taxonomies as $_tax ) {
143
- if( $_tax->name === 'advanced_ads_groups' ){
144
- continue;
145
- }
146
- // get all terms
147
- $terms = get_terms( $_tax->name, array('hide_empty' => false, 'number' => 0, 'fields' => 'ids' ) );
148
- if ( is_wp_error( $terms ) || ! count( $terms ) ){
149
- continue;
150
- } else {
151
- $taxonomy_terms[ $_tax->name ] = $terms;
152
- }
153
-
154
- // get terms that are in all terms and in active terms
155
- if( isset( $old_conditions[ 'categoryids' ] )
156
- && ( !isset ( $old_conditions[ 'categoryids' ]['all'] )
157
- || ! $old_conditions[ 'categoryids' ]['all'] ) )
158
- {
159
- // honor "include" option first
160
- if( isset ( $old_conditions[ 'categoryids' ]['include'] ) && count( $old_conditions[ 'categoryids' ]['include'] )
161
- && $same_values = array_intersect($terms, $old_conditions[ 'categoryids' ]['include']) ){
162
- $new_conditions[] = array(
163
- 'type' => 'taxonomy_' . $_tax->name ,
164
- 'operator' => 'is',
165
- 'value' => $same_values
166
- );
167
- } elseif ( isset ( $old_conditions[ 'categoryids' ]['exclude'] ) && count( $old_conditions[ 'categoryids' ]['exclude'] )
168
- && $same_values = array_intersect($terms, $old_conditions[ 'categoryids' ]['exclude']) ){
169
- $new_conditions[] = array(
170
- 'type' => 'taxonomy_' . $_tax->name ,
171
- 'operator' => 'is_not',
172
- 'value' => $same_values
173
- );
174
- }
175
- }
176
-
177
- // get terms that are in all terms and in active terms
178
- if( isset( $old_conditions[ 'categoryarchiveids' ] )
179
- && ( !isset ( $old_conditions[ 'categoryarchiveids' ]['all'] )
180
- || ! $old_conditions[ 'categoryarchiveids' ]['all'] ) )
181
- {
182
- // honor "include" option first
183
- if( isset ( $old_conditions[ 'categoryarchiveids' ]['include'] ) && count( $old_conditions[ 'categoryarchiveids' ]['include'] )
184
- && $same_values = array_intersect($terms, $old_conditions[ 'categoryarchiveids' ]['include']) ){
185
- $new_conditions[] = array(
186
- 'type' => 'archive_' . $_tax->name ,
187
- 'operator' => 'is',
188
- 'value' => $same_values
189
- );
190
- } elseif ( isset ( $old_conditions[ 'categoryarchiveids' ]['exclude'] ) && count( $old_conditions[ 'categoryarchiveids' ]['exclude'] )
191
- && $same_values = array_intersect($terms, $old_conditions[ 'categoryarchiveids' ]['exclude']) ){
192
- $new_conditions[] = array(
193
- 'type' => 'archive_' . $_tax->name ,
194
- 'operator' => 'is_not',
195
- 'value' => $same_values
196
- );
197
- }
198
- }
199
- }
200
- }
201
-
202
- // rewrite single post ids
203
- if( isset ( $old_conditions[ 'postids' ]['ids'] )
204
- && isset ( $old_conditions[ 'postids' ]['method'] )
205
- && $old_conditions[ 'postids' ]['method']
206
- && ( !isset ( $old_conditions[ 'postids' ]['all'] )
207
- || ! $old_conditions[ 'postids' ]['all'] ) ) {
208
- $operator = ( $old_conditions[ 'postids' ]['method'] === 'exclude' ) ? 'is_not' : 'is';
209
- if ( is_string( $old_conditions[ 'postids' ]['ids']) ) {
210
- $old_conditions[ 'postids' ]['ids'] = explode( ',', $old_conditions[ 'postids' ]['ids'] );
211
- }
212
- $new_conditions[] = array(
213
- 'type' => 'postids',
214
- 'operator' => $operator,
215
- 'value' => $old_conditions[ 'postids' ]['ids']
216
- );
217
- }
218
- }
219
-
220
- error_log(print_r('NEW CONDITIONS', true));
221
- error_log(print_r($new_conditions, true));
222
-
223
- $options['conditions'] = $new_conditions;
224
-
225
- // save conditions
226
- update_post_meta( $_ad->ID, $option_key, $options );
227
- }
228
-
229
- error_log(print_r('up to 1.7', true));
230
- }
231
-
232
- /**
233
- * upgrades for version 1.7.4
234
- * reactivate active add-on licenses, needed only once after upgrade of the plugin shop
235
- */
236
- public function upgrade_1_7_4(){
237
-
238
- // ignore, if not main blog
239
- if( is_multisite() && ! is_main_site() ){
240
- return;
241
- }
242
-
243
- $add_ons = apply_filters( 'advanced-ads-add-ons', array() );
244
-
245
- // return if no add-ons found
246
- if( $add_ons === array() ) {
247
- return;
248
- }
249
-
250
- error_log(print_r('–– STARTING ADVANCED ADS 1.7.4 upgrade ––', true));
251
- foreach( $add_ons as $_add_on_key => $_add_on ){
252
-
253
- // check status
254
- if(Advanced_Ads_Admin_Licenses::get_instance()->get_license_status( $_add_on['options_slug'] ) !== 'valid' ) {
255
- continue;
256
- }
257
-
258
- // retrieve our license key from the DB
259
- $licenses = get_option(ADVADS_SLUG . '-licenses', array());
260
- $license_key = isset($licenses[$_add_on_key]) ? $licenses[$_add_on_key] : '';
261
-
262
- $result = Advanced_Ads_Admin::get_instance()->activate_license( $_add_on_key, $_add_on['name'], $_add_on['options_slug'], $license_key );
263
- error_log( sprintf( 'Register license key for %s: %s', $_add_on['name'], $result ) );
264
-
265
- }
266
- }
267
-
268
  }
4
  * Upgrade logic from older data to new one
5
  *
6
  * the version number itself is changed in /admin/includes/class-notices.php::register_version_notices()
7
+ *
8
+ * @since 1.7
9
+ * @todo we need internal markers to check if the update ran on a normal request and not AJAX, where it happened to break sometimes
10
  */
11
  class Advanced_Ads_Upgrades {
12
 
24
 
25
  // don’t upgrade if no previous version existed
26
  if( ! empty( $internal_options['version'] ) ) {
27
+
28
+ /**
29
+ * example of how to use an update
30
+ * this is no longer valid
31
+ */
32
+ /*
33
  if ( version_compare( $internal_options['version'], '1.7' ) == -1 ) {
34
  // run with wp_loaded action, because WP_Query is needed and some plugins inject data that is not yet initialized
35
  add_action( 'wp_loaded', array( $this, 'upgrade_1_7') );
36
+ }*/
 
 
 
 
 
 
 
 
 
 
37
  }
38
 
39
  // update version notices – if this doesn’t happen here, the upgrade might run multiple times and destroy updated data
41
  Advanced_Ads_Admin_Notices::get_instance()->update_version_number();
42
  }
43
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
classes/utils.php CHANGED
@@ -82,6 +82,11 @@ class Advanced_Ads_Utils {
82
  if ( Advanced_Ads_Checks::active_autoptimize() || Advanced_Ads_Checks::active_wp_rocket() ) {
83
  return '<!--noptimize-->' . $content . '<!--/noptimize-->';
84
  }
 
 
 
 
 
85
  return $content;
86
  }
87
 
82
  if ( Advanced_Ads_Checks::active_autoptimize() || Advanced_Ads_Checks::active_wp_rocket() ) {
83
  return '<!--noptimize-->' . $content . '<!--/noptimize-->';
84
  }
85
+ // WP Fastest Cache Premium: "Render Blocking Js" feature.
86
+ if ( class_exists( 'WpFastestCache', false )
87
+ && '<script' === substr( $content, 0, 7 ) ) {
88
+ $content = substr_replace( $content, '<script data-wpfc-render="false"', 0, 7 );
89
+ }
90
  return $content;
91
  }
92
 
classes/visitor-conditions.php CHANGED
@@ -39,9 +39,10 @@ class Advanced_Ads_Visitor_Conditions {
39
  'label' => __( 'logged in visitor', 'advanced-ads' ),
40
  'description' => __( 'Whether the visitor has to be logged in or not in order to see the ads.', 'advanced-ads' ),
41
  'metabox' => array( 'Advanced_Ads_Visitor_Conditions', 'metabox_is_or_not' ), // callback to generate the metabox
42
- 'check' => array( 'Advanced_Ads_Visitor_Conditions', 'check_logged_in' ) // callback for frontend check
43
- ),
44
- ));
 
45
  }
46
 
47
  /**
39
  'label' => __( 'logged in visitor', 'advanced-ads' ),
40
  'description' => __( 'Whether the visitor has to be logged in or not in order to see the ads.', 'advanced-ads' ),
41
  'metabox' => array( 'Advanced_Ads_Visitor_Conditions', 'metabox_is_or_not' ), // callback to generate the metabox
42
+ 'check' => array( 'Advanced_Ads_Visitor_Conditions', 'check_logged_in' ), // callback for frontend check
43
+ 'passive_info' => array( 'hash_fields' => null, 'remove' => 'login', 'function' => 'is_user_logged_in' )
44
+ ),
45
+ ));
46
  }
47
 
48
  /**
composer.lock CHANGED
@@ -9,16 +9,16 @@
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": {
@@ -125,7 +125,7 @@
125
  "zend",
126
  "zikula"
127
  ],
128
- "time": "2017-12-29 09:13:20"
129
  },
130
  {
131
  "name": "xrstf/composer-php52",
9
  "packages": [
10
  {
11
  "name": "composer/installers",
12
+ "version": "v1.6.0",
13
  "source": {
14
  "type": "git",
15
  "url": "https://github.com/composer/installers.git",
16
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
17
  },
18
  "dist": {
19
  "type": "zip",
20
+ "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
21
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
22
  "shasum": ""
23
  },
24
  "require": {
125
  "zend",
126
  "zikula"
127
  ],
128
+ "time": "2018-08-27 06:10:37"
129
  },
130
  {
131
  "name": "xrstf/composer-php52",
languages/advanced-ads.pot CHANGED
@@ -3,7 +3,7 @@ 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-11-22 10:21+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"
@@ -24,13 +24,14 @@ msgstr ""
24
  "X-Poedit-SearchPath-0: ."
25
 
26
  #: admin/class-advanced-ads-admin.php:220 classes/display-conditions.php:215
27
- #: classes/visitor-conditions.php:241 admin/views/ad-display-metabox.php:189
28
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:74
 
29
  msgid "or"
30
  msgstr ""
31
 
32
  #: admin/class-advanced-ads-admin.php:221 classes/display-conditions.php:215
33
- #: classes/visitor-conditions.php:241 admin/views/ad-visitor-metabox.php:155
34
  msgid "and"
35
  msgstr ""
36
 
@@ -45,6 +46,7 @@ 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:28
 
48
  msgid "Support"
49
  msgstr ""
50
 
@@ -94,11 +96,11 @@ msgid "main query"
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:695 admin/views/ad-group-list-ads.php:13
98
  msgid "Ad"
99
  msgstr ""
100
 
101
- #: classes/ad-debug.php:121 public/class-advanced-ads.php:658
102
  msgctxt "ad group singular name"
103
  msgid "Ad Group"
104
  msgstr ""
@@ -234,7 +236,7 @@ msgstr ""
234
  msgid "Uses a simple placeholder ad for quick testing."
235
  msgstr ""
236
 
237
- #: classes/ad_type_dummy.php:45 classes/ad_type_image.php:65
238
  msgid "URL"
239
  msgstr ""
240
 
@@ -276,7 +278,7 @@ msgstr ""
276
  msgid "edit"
277
  msgstr ""
278
 
279
- #: classes/ad_type_image.php:67
280
  msgid "Link to target site"
281
  msgstr ""
282
 
@@ -284,7 +286,7 @@ msgstr ""
284
  #. This string shows up on the ad edit page of
285
  #. image ads if the size entered for the ad is
286
  #. different from the size of the uploaded image.
287
- #: classes/ad_type_image.php:202
288
  #, php-format
289
  msgid "Original size: %s"
290
  msgstr ""
@@ -303,35 +305,35 @@ msgstr ""
303
  msgid "Insert plain text or code into this field."
304
  msgstr ""
305
 
306
- #: classes/ad_type_plain.php:89
307
  msgid "Allow PHP"
308
  msgstr ""
309
 
310
- #: classes/ad_type_plain.php:91
311
  msgid "Execute PHP code (wrapped in <code>&lt;?php ?&gt;</code>)"
312
  msgstr ""
313
 
314
- #: classes/ad_type_plain.php:92
315
  msgid "No PHP tag detected in your code."
316
  msgstr ""
317
 
318
- #: classes/ad_type_plain.php:92 classes/ad_type_plain.php:107
319
  msgid "Uncheck this checkbox for improved performance."
320
  msgstr ""
321
 
322
- #: classes/ad_type_plain.php:103
323
  msgid "Allow shortcodes"
324
  msgstr ""
325
 
326
- #: classes/ad_type_plain.php:106
327
  msgid "Execute shortcodes"
328
  msgstr ""
329
 
330
- #: classes/ad_type_plain.php:107
331
  msgid "No shortcode detected in your code."
332
  msgstr ""
333
 
334
- #: classes/checks.php:263
335
  #, php-format
336
  msgid ""
337
  "Possible conflict between jQueryUI library, used by Advanced Ads and other "
@@ -388,13 +390,13 @@ msgstr ""
388
 
389
  #: classes/display-conditions.php:250 classes/display-conditions.php:303
390
  #: classes/display-conditions.php:358 classes/display-conditions.php:475
391
- #: classes/visitor-conditions.php:136
392
  msgid "is"
393
  msgstr ""
394
 
395
  #: classes/display-conditions.php:251 classes/display-conditions.php:304
396
  #: classes/display-conditions.php:359 classes/display-conditions.php:476
397
- #: classes/visitor-conditions.php:137
398
  msgid "is not"
399
  msgstr ""
400
 
@@ -625,13 +627,17 @@ msgstr ""
625
  msgid "Everything is fine"
626
  msgstr ""
627
 
628
- #: classes/frontend_checks.php:403
 
 
 
 
629
  msgid ""
630
  "the following code is used for automatic error detection and only visible to "
631
  "admins"
632
  msgstr ""
633
 
634
- #: classes/frontend_checks.php:562
635
  #, php-format
636
  msgid ""
637
  "This ad was automatically placed here by AdSense. <a href=\"%s\" "
@@ -655,34 +661,34 @@ msgstr ""
655
  msgid "Whether the visitor has to be logged in or not in order to see the ads."
656
  msgstr ""
657
 
658
- #: classes/visitor-conditions.php:96
659
  msgid "Mobile (including tablets)"
660
  msgstr ""
661
 
662
- #: classes/visitor-conditions.php:97
663
  msgid "Desktop"
664
  msgstr ""
665
 
666
- #: classes/visitor-conditions.php:102 classes/visitor-conditions.php:142
667
  msgid "Manual and Troubleshooting"
668
  msgstr ""
669
 
670
- #: classes/visitor-conditions.php:108
671
  #, php-format
672
  msgid ""
673
  "Display ads by the available space on the device or target tablets with the "
674
  "<a href=\"%s\" target=\"_blank\">Responsive add-on</a>"
675
  msgstr ""
676
 
677
- #: classes/visitor-conditions.php:171
678
  msgid "equal"
679
  msgstr ""
680
 
681
- #: classes/visitor-conditions.php:172
682
  msgid "equal or higher"
683
  msgstr ""
684
 
685
- #: classes/visitor-conditions.php:173
686
  msgid "equal or lower"
687
  msgstr ""
688
 
@@ -712,10 +718,10 @@ msgstr ""
712
  msgid "Ad Groups"
713
  msgstr ""
714
 
715
- #: classes/widget.php:93 public/class-advanced-ads.php:694
716
  #: admin/includes/class-menu.php:62 admin/includes/class-menu.php:62
717
  #: admin/includes/class-shortcode-creator.php:84
718
- #: admin/views/ad-group-list-form-row.php:88
719
  #: admin/views/ad-group-list-header.php:17 admin/views/placements-item.php:16
720
  #: admin/views/placements.php:260
721
  #: modules/gutenberg/includes/class-gutenberg.php:79
@@ -758,61 +764,61 @@ msgstr ""
758
  msgid "Advanced Ads Error: %s"
759
  msgstr ""
760
 
761
- #: public/class-advanced-ads.php:657
762
  msgctxt "ad group general name"
763
  msgid "Ad Groups & Rotations"
764
  msgstr ""
765
 
766
- #: public/class-advanced-ads.php:659
767
  msgid "Search Ad Groups"
768
  msgstr ""
769
 
770
- #: public/class-advanced-ads.php:660
771
  msgid "All Ad Groups"
772
  msgstr ""
773
 
774
- #: public/class-advanced-ads.php:661
775
  msgid "Parent Ad Groups"
776
  msgstr ""
777
 
778
- #: public/class-advanced-ads.php:662
779
  msgid "Parent Ad Groups:"
780
  msgstr ""
781
 
782
- #: public/class-advanced-ads.php:663
783
  msgid "Edit Ad Group"
784
  msgstr ""
785
 
786
- #: public/class-advanced-ads.php:664
787
  msgid "Update Ad Group"
788
  msgstr ""
789
 
790
- #: public/class-advanced-ads.php:665
791
  msgid "Add New Ad Group"
792
  msgstr ""
793
 
794
- #: public/class-advanced-ads.php:666
795
  msgid "New Ad Groups Name"
796
  msgstr ""
797
 
798
- #: public/class-advanced-ads.php:667 modules/import-export/views/page.php:24
799
  msgid "Groups"
800
  msgstr ""
801
 
802
- #: public/class-advanced-ads.php:668
803
  msgid "No Ad Group found"
804
  msgstr ""
805
 
806
- #: public/class-advanced-ads.php:696 public/class-advanced-ads.php:700
807
  #: admin/includes/class-menu.php:79 admin/views/ad-group-list-ads.php:28
808
  msgid "New Ad"
809
  msgstr ""
810
 
811
- #: public/class-advanced-ads.php:697 admin/includes/class-menu.php:79
812
  msgid "Add New Ad"
813
  msgstr ""
814
 
815
- #: public/class-advanced-ads.php:698
816
  #: admin/includes/class-ad-groups-list.php:313
817
  #: modules/import-export/classes/import.php:146
818
  #: modules/import-export/classes/import.php:186
@@ -820,35 +826,35 @@ msgstr ""
820
  msgid "Edit"
821
  msgstr ""
822
 
823
- #: public/class-advanced-ads.php:699
824
  msgid "Edit Ad"
825
  msgstr ""
826
 
827
- #: public/class-advanced-ads.php:701
828
  msgid "View"
829
  msgstr ""
830
 
831
- #: public/class-advanced-ads.php:702
832
  msgid "View the Ad"
833
  msgstr ""
834
 
835
- #: public/class-advanced-ads.php:703
836
  msgid "Search Ads"
837
  msgstr ""
838
 
839
- #: public/class-advanced-ads.php:704
840
  msgid "No Ads found"
841
  msgstr ""
842
 
843
- #: public/class-advanced-ads.php:705
844
  msgid "No Ads found in Trash"
845
  msgstr ""
846
 
847
- #: public/class-advanced-ads.php:706
848
  msgid "Parent Ad"
849
  msgstr ""
850
 
851
- #: public/class-advanced-ads.php:850
852
  msgctxt "label above ads"
853
  msgid "Advertisements"
854
  msgstr ""
@@ -922,12 +928,12 @@ msgid "Delete"
922
  msgstr ""
923
 
924
  #: admin/includes/class-ad-groups-list.php:344
925
- #: admin/includes/class-ad-groups-list.php:394
926
  msgid "Invalid Ad Group"
927
  msgstr ""
928
 
929
  #: admin/includes/class-ad-groups-list.php:349
930
- #: admin/includes/class-ad-groups-list.php:399
931
  msgid "You don’t have permission to change the ad groups"
932
  msgstr ""
933
 
@@ -982,39 +988,39 @@ msgid_plural "%s ads restored from the Trash."
982
  msgstr[0] ""
983
  msgstr[1] ""
984
 
985
- #: admin/includes/class-ad-type.php:570 admin/includes/class-ad-type.php:571
986
  msgid "Ad updated."
987
  msgstr ""
988
 
989
  #. translators: %s: date and time of the revision
990
- #: admin/includes/class-ad-type.php:573
991
  #, php-format
992
  msgid "Ad restored to revision from %s"
993
  msgstr ""
994
 
995
- #: admin/includes/class-ad-type.php:574 admin/includes/class-ad-type.php:575
996
  msgid "Ad saved."
997
  msgstr ""
998
 
999
- #: admin/includes/class-ad-type.php:576
1000
  msgid "Ad submitted."
1001
  msgstr ""
1002
 
1003
- #: admin/includes/class-ad-type.php:578
1004
  #, php-format
1005
  msgid "Ad scheduled for: <strong>%1$s</strong>."
1006
  msgstr ""
1007
 
1008
  #. translators: Publish box date format, see http://php.net/date
1009
- #: admin/includes/class-ad-type.php:580
1010
  msgid "M j, Y @ G:i"
1011
  msgstr ""
1012
 
1013
- #: admin/includes/class-ad-type.php:582
1014
  msgid "Ad draft updated."
1015
  msgstr ""
1016
 
1017
- #: admin/includes/class-ad-type.php:669
1018
  msgid ""
1019
  "You don’t have access to ads. Please deactivate and re-enable Advanced Ads "
1020
  "again to fix this."
@@ -1032,69 +1038,70 @@ msgstr ""
1032
  msgid "Error while trying to register the license. Please contact support."
1033
  msgstr ""
1034
 
1035
- #: admin/includes/class-licenses.php:106 admin/views/setting-license.php:58
1036
  msgid "Please enter a valid license key"
1037
  msgstr ""
1038
 
1039
- #: admin/includes/class-licenses.php:154
1040
  msgid "License couldn’t be activated. Please try again later."
1041
  msgstr ""
1042
 
1043
- #: admin/includes/class-licenses.php:171
1044
  msgid "This is the bundle license key."
1045
  msgstr ""
1046
 
1047
- #: admin/includes/class-licenses.php:172
1048
  msgid "This is not the correct key for this add-on."
1049
  msgstr ""
1050
 
1051
- #: admin/includes/class-licenses.php:173
1052
  msgid "There are no activations left."
1053
  msgstr ""
1054
 
1055
- #: admin/includes/class-licenses.php:182
1056
  #, php-format
1057
  msgid "License is invalid. Reason: %s"
1058
  msgstr ""
1059
 
1060
- #: admin/includes/class-licenses.php:242
1061
- msgid "Error while trying to disable the license. Please contact support."
 
 
 
 
1062
  msgstr ""
1063
 
1064
- #: admin/includes/class-licenses.php:274 admin/includes/class-licenses.php:296
1065
- msgid "License couldn’t be deactivated. Please try again later."
1066
  msgstr ""
1067
 
1068
- #: admin/includes/class-licenses.php:282
1069
- #, php-format
1070
- msgid ""
1071
- "Your call was blocked by a Firewall. <a href=\"%s\" target=\"_blank\">Learn "
1072
- "more</a>"
1073
  msgstr ""
1074
 
1075
- #: admin/includes/class-licenses.php:503
1076
  #, php-format
1077
  msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
1078
  msgstr ""
1079
 
1080
- #: admin/includes/class-licenses.php:505
1081
  #, php-format
1082
  msgid ""
1083
  "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>"
1084
  "."
1085
  msgstr ""
1086
 
1087
- #: admin/includes/class-list-filters.php:129
1088
  #: modules/gadsense/admin/admin.php:29
1089
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:112
1090
  msgid "Responsive"
1091
  msgstr ""
1092
 
1093
- #: admin/includes/class-list-filters.php:138
1094
  msgid "expired"
1095
  msgstr ""
1096
 
1097
- #: admin/includes/class-list-filters.php:142
1098
  msgid "any expiry date"
1099
  msgstr ""
1100
 
@@ -1177,39 +1184,35 @@ msgstr ""
1177
  msgid "%d ads – <a href=\"%s\">manage</a> - <a href=\"%s\">new</a>"
1178
  msgstr ""
1179
 
1180
- #: admin/includes/class-meta-box.php:385
1181
- msgid "plugin manual and homepage"
1182
- msgstr ""
1183
-
1184
- #: admin/includes/class-meta-box.php:392
1185
  msgid "Get the tutorial via email"
1186
  msgstr ""
1187
 
1188
- #: admin/includes/class-meta-box.php:399
1189
  msgid "Get AdSense tips via email"
1190
  msgstr ""
1191
 
1192
- #: admin/includes/class-meta-box.php:455
1193
- msgid "From the ad optimization universe"
1194
  msgstr ""
1195
 
1196
- #: admin/includes/class-meta-box.php:464
1197
  msgid "Advanced Ads Tutorials"
1198
  msgstr ""
1199
 
1200
- #: admin/includes/class-notices.php:478
1201
  #, php-format
1202
  msgid ""
1203
  "You don’t seem to have an email address. Please use <a href=\"%s\" "
1204
  "target=\"_blank\">this form</a> to sign up."
1205
  msgstr ""
1206
 
1207
- #: admin/includes/class-notices.php:496
1208
  msgid ""
1209
  "How embarrassing. The email server seems to be down. Please try again later."
1210
  msgstr ""
1211
 
1212
- #: admin/includes/class-notices.php:501
1213
  #, php-format
1214
  msgid ""
1215
  "Please check your email (%s) for the confirmation message. If you didn’t "
@@ -1231,9 +1234,10 @@ msgid "Create your first ad"
1231
  msgstr ""
1232
 
1233
  #: admin/includes/class-overview-widgets.php:68
1234
- #: modules/gadsense/admin/views/adsense-account.php:33
1235
- #: modules/gadsense/admin/views/adsense-account.php:47
1236
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:53
 
1237
  msgid "Connect to AdSense"
1238
  msgstr ""
1239
 
@@ -1257,17 +1261,17 @@ msgstr ""
1257
  msgid "Join now"
1258
  msgstr ""
1259
 
1260
- #: admin/includes/class-overview-widgets.php:93 admin/includes/notices.php:49
1261
  msgid ""
1262
  "Do you find Advanced Ads useful and would like to keep us motivated? Please "
1263
  "help us with a review."
1264
  msgstr ""
1265
 
1266
- #: admin/includes/class-overview-widgets.php:95 admin/includes/notices.php:52
1267
  msgid "Sure, I’ll rate the plugin"
1268
  msgstr ""
1269
 
1270
- #: admin/includes/class-overview-widgets.php:97 admin/includes/notices.php:53
1271
  msgid "I already did"
1272
  msgstr ""
1273
 
@@ -1667,31 +1671,31 @@ msgstr ""
1667
  msgid "Subscribe me now"
1668
  msgstr ""
1669
 
1670
- #: admin/includes/notices.php:42
1671
  msgid ""
1672
  "One or more license keys for <strong>Advanced Ads add-ons are invalid or "
1673
  "missing</strong>."
1674
  msgstr ""
1675
 
1676
- #: admin/includes/notices.php:42
1677
  #, php-format
1678
  msgid "Please add valid license keys <a href=\"%s\">here</a>."
1679
  msgstr ""
1680
 
1681
- #: admin/includes/notices.php:48
1682
  #, php-format
1683
  msgid "You’ve successfully <strong>created %s ads using Advanced Ads</strong>."
1684
  msgstr ""
1685
 
1686
- #: admin/includes/notices.php:54
1687
  msgid "I am not happy, please help"
1688
  msgstr ""
1689
 
1690
- #: admin/includes/notices.php:55
1691
  msgid "Ask me later"
1692
  msgstr ""
1693
 
1694
- #: admin/includes/notices.php:62
1695
  #, php-format
1696
  msgid ""
1697
  "Some assets were changed. Please <strong>rebuild the asset folder</strong> "
@@ -1699,7 +1703,7 @@ msgid ""
1699
  "disguise."
1700
  msgstr ""
1701
 
1702
- #: admin/includes/notices.php:68
1703
  #, php-format
1704
  msgid ""
1705
  "Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
@@ -1708,7 +1712,7 @@ msgid ""
1708
  "Access</a>"
1709
  msgstr ""
1710
 
1711
- #: admin/includes/notices.php:74
1712
  #, php-format
1713
  msgid ""
1714
  "Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
@@ -1823,7 +1827,7 @@ msgid "Forced to OR."
1823
  msgstr ""
1824
 
1825
  #: admin/views/ad-display-metabox.php:104
1826
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:119
1827
  msgid "manual"
1828
  msgstr ""
1829
 
@@ -1887,28 +1891,28 @@ msgstr ""
1887
  msgid "weight"
1888
  msgstr ""
1889
 
1890
- #: admin/views/ad-group-list-form-row.php:27 admin/views/placements.php:32
1891
- #: modules/gadsense/admin/views/mapi-ad-selector.php:29
1892
- #: modules/gadsense/admin/views/mapi-ad-selector.php:41
1893
  #: modules/privacy/admin/views/setting-consent-method.php:9
1894
  msgid "Name"
1895
  msgstr ""
1896
 
1897
- #: admin/views/ad-group-list-form-row.php:53 admin/views/placements.php:31
1898
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:108
1899
  msgid "Type"
1900
  msgstr ""
1901
 
1902
- #: admin/views/ad-group-list-form-row.php:69
1903
  msgctxt "option to display all ads in an ad groups"
1904
  msgid "all"
1905
  msgstr ""
1906
 
1907
- #: admin/views/ad-group-list-form-row.php:76
1908
  msgid "Visible ads"
1909
  msgstr ""
1910
 
1911
- #: admin/views/ad-group-list-form-row.php:78
1912
  msgid "Number of ads that are visible at the same time"
1913
  msgstr ""
1914
 
@@ -1950,20 +1954,20 @@ msgstr ""
1950
  msgid "Ad Groups successfully updated"
1951
  msgstr ""
1952
 
1953
- #: admin/views/ad-group.php:47
1954
  #, php-format
1955
  msgid "Search results for &#8220;%s&#8221;"
1956
  msgstr ""
1957
 
1958
- #: admin/views/ad-group.php:54
1959
  msgid "Group title"
1960
  msgstr ""
1961
 
1962
- #: admin/views/ad-group.php:55
1963
  msgid "save"
1964
  msgstr ""
1965
 
1966
- #: admin/views/ad-group.php:57
1967
  msgid ""
1968
  "Ad Groups are a very flexible method to bundle ads. You can use them to "
1969
  "display random ads in the frontend or run split tests, but also just for "
@@ -1971,14 +1975,14 @@ msgid ""
1971
  "ad can belong to multiple ad groups."
1972
  msgstr ""
1973
 
1974
- #: admin/views/ad-group.php:63
1975
  #, php-format
1976
  msgid ""
1977
  "Find more information about ad groups in the <a href=\"%s\" "
1978
  "target=\"_blank\">manual</a>."
1979
  msgstr ""
1980
 
1981
- #: admin/views/ad-group.php:91
1982
  msgid "Update Groups"
1983
  msgstr ""
1984
 
@@ -2299,21 +2303,21 @@ msgid ""
2299
  "<a href=\"%s\" target=\"_blank\">Responsive add-on</a>."
2300
  msgstr ""
2301
 
2302
- #: admin/views/ad-visitor-metabox.php:182
2303
  msgid ""
2304
  "The visitor conditions below are deprecated. Please use the new version of "
2305
  "visitor conditions to replace it."
2306
  msgstr ""
2307
 
2308
- #: admin/views/ad-visitor-metabox.php:188
2309
  msgid "Display on all devices"
2310
  msgstr ""
2311
 
2312
- #: admin/views/ad-visitor-metabox.php:192
2313
  msgid "only on mobile devices"
2314
  msgstr ""
2315
 
2316
- #: admin/views/ad-visitor-metabox.php:196
2317
  msgid "not on mobile devices"
2318
  msgstr ""
2319
 
@@ -2418,31 +2422,39 @@ msgstr ""
2418
  msgid "I switched to another plugin"
2419
  msgstr ""
2420
 
2421
- #: admin/views/feedback-disable.php:29
 
 
 
 
 
 
 
 
2422
  msgid "Send feedback & deactivate"
2423
  msgstr ""
2424
 
2425
- #: admin/views/feedback-disable.php:30
2426
  msgid "Send feedback"
2427
  msgstr ""
2428
 
2429
- #: admin/views/feedback-disable.php:32
2430
  msgid "Only Deactivate"
2431
  msgstr ""
2432
 
2433
- #: admin/views/feedback-disable.php:35
2434
  msgid ""
2435
  "Thanks for submitting your feedback. I will reply within 24 hours on working "
2436
  "days."
2437
  msgstr ""
2438
 
2439
  #. %s is the title of the website
2440
- #: admin/views/feedback-disable.php:40
2441
  #, php-format
2442
  msgid "All the best to you and %s."
2443
  msgstr ""
2444
 
2445
- #: admin/views/feedback-disable.php:41
2446
  msgid "Disabling the plugin now…"
2447
  msgstr ""
2448
 
@@ -2517,7 +2529,7 @@ msgid "Where do you want to display the ad?"
2517
  msgstr ""
2518
 
2519
  #: admin/views/placement-injection-top.php:24
2520
- #: modules/gadsense/admin/admin.php:418
2521
  #, php-format
2522
  msgid ""
2523
  "The AdSense verification and Auto ads code is already activated in the <a "
@@ -2525,7 +2537,7 @@ msgid ""
2525
  msgstr ""
2526
 
2527
  #: admin/views/placement-injection-top.php:30
2528
- #: modules/gadsense/admin/admin.php:420
2529
  msgid ""
2530
  "No need to add the code manually here, unless you want to include it into "
2531
  "certain pages only."
@@ -2773,7 +2785,11 @@ msgstr ""
2773
  msgid "Save New Placement"
2774
  msgstr ""
2775
 
2776
- #: admin/views/post-ad-settings-metabox.php:4
 
 
 
 
2777
  msgid "Disable ads on this page"
2778
  msgstr ""
2779
 
@@ -2785,39 +2801,39 @@ msgstr ""
2785
  msgid "Update expiry date"
2786
  msgstr ""
2787
 
2788
- #: admin/views/setting-license.php:16
2789
  #, php-format
2790
  msgid ""
2791
  "Click on %2$s if you renewed it or have a subscription or <a href=\"%1$s\" "
2792
- "target=\"_blank\">renew your license</a>."
2793
  msgstr ""
2794
 
2795
- #: admin/views/setting-license.php:28
2796
  #, php-format
2797
  msgid "(%d days left)"
2798
  msgstr ""
2799
 
2800
- #: admin/views/setting-license.php:32
2801
  msgid "License key"
2802
  msgstr ""
2803
 
2804
- #: admin/views/setting-license.php:49
2805
  msgid "Deactivate License"
2806
  msgstr ""
2807
 
2808
- #: admin/views/setting-license.php:55
2809
  msgid "Update License"
2810
  msgstr ""
2811
 
2812
- #: admin/views/setting-license.php:55
2813
  msgid "Activate License"
2814
  msgstr ""
2815
 
2816
- #: admin/views/setting-license.php:60
2817
  msgid "License key invalid"
2818
  msgstr ""
2819
 
2820
- #: admin/views/setting-license.php:68
2821
  msgid "active"
2822
  msgstr ""
2823
 
@@ -2941,7 +2957,7 @@ msgstr ""
2941
  msgid "Find solutions in the manual"
2942
  msgstr ""
2943
 
2944
- #: admin/views/notices/adblock.php:2
2945
  msgid ""
2946
  "Please disable your <strong>AdBlocker</strong> to prevent problems with your "
2947
  "ad setup."
@@ -3026,17 +3042,6 @@ msgstr ""
3026
  msgid "Ad blocker counter"
3027
  msgstr ""
3028
 
3029
- #: modules/gadsense/admin/admin.php:47
3030
- msgid "The ad details couldn't be retrieved from the ad code"
3031
- msgstr ""
3032
-
3033
- #: modules/gadsense/admin/admin.php:48
3034
- msgid ""
3035
- "Warning : The AdSense account from this code does not match the one set with "
3036
- "the Advanced Ads Plugin. This ad might cause troubles when used in the front "
3037
- "end."
3038
- msgstr ""
3039
-
3040
  #: modules/gadsense/admin/admin.php:135
3041
  msgid "AdSense account"
3042
  msgstr ""
@@ -3057,56 +3062,56 @@ msgstr ""
3057
  msgid "Transparent background"
3058
  msgstr ""
3059
 
3060
- #: modules/gadsense/admin/admin.php:227
3061
  #, php-format
3062
  msgid "Limit to %d AdSense ads"
3063
  msgstr ""
3064
 
3065
- #: modules/gadsense/admin/admin.php:231
3066
  msgid ""
3067
  "There is no explicit limit for AdSense ads anymore, but you can still use "
3068
  "this setting to prevent too many AdSense ads to show accidentally on your "
3069
  "site."
3070
  msgstr ""
3071
 
3072
- #: modules/gadsense/admin/admin.php:235
3073
  msgid ""
3074
  "Due to technical restrictions, the limit does not work on placements with "
3075
  "cache-busting enabled."
3076
  msgstr ""
3077
 
3078
- #: modules/gadsense/admin/admin.php:249
3079
- #: modules/gadsense/admin/views/adsense-account.php:120
3080
  msgid ""
3081
  "Insert the AdSense header code used for verification and the Auto Ads "
3082
  "feature."
3083
  msgstr ""
3084
 
3085
  #. this is the text for a link to a sub-page in an AdSense account
3086
- #: modules/gadsense/admin/admin.php:254
3087
  msgid "Adjust Auto ads options"
3088
  msgstr ""
3089
 
3090
- #: modules/gadsense/admin/admin.php:256
3091
  #, php-format
3092
  msgid ""
3093
  "Please read <a href=\"%s\" target=\"_blank\">this article</a> if <strong>ads "
3094
  "appear in random places</strong>."
3095
  msgstr ""
3096
 
3097
- #: modules/gadsense/admin/admin.php:257
3098
  msgid "Display Auto ads only on specific pages"
3099
  msgstr ""
3100
 
3101
- #: modules/gadsense/admin/admin.php:258
3102
  msgid "Auto ads on AMP pages"
3103
  msgstr ""
3104
 
3105
- #: modules/gadsense/admin/admin.php:271
3106
  msgid "Disable warnings about potential violations of the AdSense terms."
3107
  msgstr ""
3108
 
3109
- #: modules/gadsense/admin/admin.php:272
3110
  #, php-format
3111
  msgid ""
3112
  "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if "
@@ -3114,22 +3119,22 @@ msgid ""
3114
  "managed with Advanced Ads. Enable this option to remove these checks"
3115
  msgstr ""
3116
 
3117
- #: modules/gadsense/admin/admin.php:283
3118
  msgid ""
3119
  "Enable this option in case your theme adds an unfortunate background color "
3120
  "to AdSense ads."
3121
  msgstr ""
3122
 
3123
- #: modules/gadsense/admin/admin.php:306
3124
- #: modules/gadsense/includes/class-ad-type-adsense.php:75
3125
  msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
3126
  msgstr ""
3127
 
3128
- #: modules/gadsense/admin/admin.php:328
3129
  msgid "AdSense"
3130
  msgstr ""
3131
 
3132
- #: modules/gadsense/admin/admin.php:380
3133
  #, php-format
3134
  msgid ""
3135
  "Responsive AdSense ads don’t work reliably with <em>Position</em> set to "
@@ -3138,14 +3143,14 @@ msgid ""
3138
  "wrapped in text."
3139
  msgstr ""
3140
 
3141
- #: modules/gadsense/admin/admin.php:386
3142
  #, php-format
3143
  msgid ""
3144
  "<a href=\"%s\" target=\"_blank\">Install the free AdSense In-feed add-on</a> "
3145
  "in order to place ads between posts."
3146
  msgstr ""
3147
 
3148
- #: modules/gadsense/admin/admin.php:393
3149
  #, php-format
3150
  msgid ""
3151
  "Use the <a href=\"%s\" target=\"_blank\">Responsive add-on</a> in order to "
@@ -3153,7 +3158,7 @@ msgid ""
3153
  "vertical, or rectangle formats."
3154
  msgstr ""
3155
 
3156
- #: modules/gadsense/admin/admin.php:422
3157
  #, php-format
3158
  msgid ""
3159
  "The AdSense verification and Auto ads code should be set up in the <a "
@@ -3161,7 +3166,7 @@ msgid ""
3161
  "now."
3162
  msgstr ""
3163
 
3164
- #: modules/gadsense/admin/admin.php:423
3165
  msgid "Activate"
3166
  msgstr ""
3167
 
@@ -3173,7 +3178,7 @@ msgstr ""
3173
  msgid "Use ads from your Google AdSense account"
3174
  msgstr ""
3175
 
3176
- #: modules/gadsense/includes/class-ad-type-adsense.php:110
3177
  msgid "Your AdSense Publisher ID is missing."
3178
  msgstr ""
3179
 
@@ -3181,6 +3186,38 @@ msgstr ""
3181
  msgid "Auto"
3182
  msgstr ""
3183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3184
  #. Name of the plugin
3185
  #: modules/gutenberg/includes/class-gutenberg.php:78
3186
  msgid "Advanced Ads"
@@ -3435,215 +3472,276 @@ msgid ""
3435
  "Google Analytics property ID above to count them."
3436
  msgstr ""
3437
 
3438
- #: modules/gadsense/admin/views/adsense-account.php:36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3439
  msgid "Revoke API acccess"
3440
  msgstr ""
3441
 
3442
- #: modules/gadsense/admin/views/adsense-account.php:41
 
 
 
 
3443
  msgid "Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>"
3444
  msgstr ""
3445
 
3446
- #: modules/gadsense/admin/views/adsense-account.php:46
3447
  msgid "Yes, I have an AdSense account"
3448
  msgstr ""
3449
 
3450
- #: modules/gadsense/admin/views/adsense-account.php:48
3451
  msgid "Configure everything manually"
3452
  msgstr ""
3453
 
3454
- #: modules/gadsense/admin/views/adsense-account.php:51
3455
  msgid "No, I still don't have an AdSense account"
3456
  msgstr ""
3457
 
3458
- #: modules/gadsense/admin/views/adsense-account.php:52
3459
  msgid "Get a free AdSense account"
3460
  msgstr ""
3461
 
3462
- #: modules/gadsense/admin/views/adsense-account.php:101
 
3463
  #, php-format
3464
  msgid ""
3465
- "Problems with AdSense? Check out the <a href=\"%s\" target=\"_blank\">"
3466
- "manual</a> and get a free setup check."
3467
  msgstr ""
3468
 
3469
- #: modules/gadsense/admin/views/adsense-account.php:104
 
3470
  msgid "Can not connect AdSense account. PHP version is too low."
3471
  msgstr ""
3472
 
3473
- #: modules/gadsense/admin/views/adsense-account.php:118
3474
- msgid "Please enter the confirmation code."
 
 
 
3475
  msgstr ""
3476
 
3477
- #: modules/gadsense/admin/views/adsense-account.php:122
3478
- msgid "Submit code"
3479
  msgstr ""
3480
 
3481
- #. this is a label for an ad that we can currently not import from the AdSense account
3482
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:46
3483
- #: modules/gadsense/admin/views/mapi-ad-selector.php:73
3484
- #: modules/gadsense/admin/views/mapi-ad-selector.php:82
3485
- msgid "unsupported"
3486
  msgstr ""
3487
 
3488
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:58
3489
  msgid ""
3490
  "Copy the ad code from your AdSense account, paste it into the area below and "
3491
  "click on <em>Get details</em>."
3492
  msgstr ""
3493
 
3494
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:60
3495
  msgid "Get details"
3496
  msgstr ""
3497
 
3498
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:62
3499
- msgid "connect to your AdSense account"
3500
  msgstr ""
3501
 
3502
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:70
3503
- msgid "Insert new AdSense code"
3504
  msgstr ""
3505
 
3506
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:74
3507
- msgid "Get ad code from your linked account"
3508
  msgstr ""
3509
 
3510
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:79
3511
- msgid "Your PHP version is too low to connect an AdSense account"
3512
  msgstr ""
3513
 
3514
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:85
3515
  msgid "Ad Slot ID"
3516
  msgstr ""
3517
 
3518
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:90
3519
  #, php-format
3520
  msgid "Publisher ID: %s"
3521
  msgstr ""
3522
 
3523
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:94
3524
  msgid ""
3525
  "The ad slot ID is either a number or empty and not the same as the publisher "
3526
  "ID."
3527
  msgstr ""
3528
 
3529
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:105
3530
  #, php-format
3531
  msgid "Please <a href=\"%s\" target=\"_blank\">change it here</a>."
3532
  msgstr ""
3533
 
3534
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:111
3535
  msgid "Normal"
3536
  msgstr ""
3537
 
3538
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:113
3539
  msgid "Responsive (Matched Content)"
3540
  msgstr ""
3541
 
3542
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:114
3543
  msgid "Link ads"
3544
  msgstr ""
3545
 
3546
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:115
3547
  msgid "Link ads (Responsive)"
3548
  msgstr ""
3549
 
3550
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:116
3551
  msgid "InArticle"
3552
  msgstr ""
3553
 
3554
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:117
3555
  msgid "InFeed"
3556
  msgstr ""
3557
 
3558
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:122
3559
  msgid "Resizing"
3560
  msgstr ""
3561
 
3562
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:130
3563
  msgid "Layout"
3564
  msgstr ""
3565
 
3566
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:134
3567
  msgid "Layout-Key"
3568
  msgstr ""
3569
 
3570
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:139
3571
  msgid "Clearfix"
3572
  msgstr ""
3573
 
3574
- #: modules/gadsense/admin/views/adsense-ad-parameters.php:142
3575
  msgid "Enable this box if responsive ads cover something on your site"
3576
  msgstr ""
3577
 
3578
- #: modules/gadsense/admin/views/mapi-ad-selector.php:19
3579
- #: modules/gadsense/admin/views/mapi-ad-selector.php:51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3580
  msgid "Update the ad units list"
3581
  msgstr ""
3582
 
3583
- #: modules/gadsense/admin/views/mapi-ad-selector.php:28
3584
- #: modules/gadsense/admin/views/mapi-ad-selector.php:40
3585
  msgctxt "AdSense ad"
3586
  msgid "Ad unit"
3587
  msgstr ""
3588
 
3589
- #: modules/gadsense/admin/views/mapi-ad-selector.php:30
3590
- #: modules/gadsense/admin/views/mapi-ad-selector.php:42
3591
  msgctxt "AdSense ad"
3592
  msgid "Slot ID"
3593
  msgstr ""
3594
 
3595
- #: modules/gadsense/admin/views/mapi-ad-selector.php:31
3596
- #: modules/gadsense/admin/views/mapi-ad-selector.php:43
3597
  msgctxt "AdSense ad"
3598
  msgid "Type"
3599
  msgstr ""
3600
 
3601
- #: modules/gadsense/admin/views/mapi-ad-selector.php:32
3602
- #: modules/gadsense/admin/views/mapi-ad-selector.php:44
3603
  msgid "Size"
3604
  msgstr ""
3605
 
3606
- #: modules/gadsense/admin/views/mapi-ad-selector.php:50
3607
  msgid "No ad units found"
3608
  msgstr ""
3609
 
3610
- #: modules/gadsense/admin/views/mapi-ad-selector.php:59
3611
  msgid "Get the code for this ad"
3612
  msgstr ""
3613
 
3614
- #: modules/gadsense/admin/views/mapi-ad-selector.php:60
3615
  msgid "Update and get the code for this ad from Google"
3616
  msgstr ""
3617
 
3618
- #: modules/gadsense/admin/views/mapi-ad-selector.php:96
3619
  msgid "Unrecognized ad code"
3620
  msgstr ""
3621
 
3622
- #: modules/gadsense/admin/views/mapi-ad-selector.php:99
3623
  msgid "This ad type can currently not be imported from AdSense."
3624
  msgstr ""
3625
 
3626
- #: modules/gadsense/admin/views/mapi-ad-selector.php:100
3627
  msgid "Learn more and help us to enable it here."
3628
  msgstr ""
3629
 
3630
- #: modules/gadsense/admin/views/mapi-ad-selector.php:101
3631
  msgid "In the meantime, you can use AdSense with one of these methods:"
3632
  msgstr ""
3633
 
3634
- #: modules/gadsense/admin/views/mapi-ad-selector.php:103
3635
  msgid ""
3636
  "Click on <em>Insert new AdSense code</em> and copy the code from your "
3637
  "AdSense account into it."
3638
  msgstr ""
3639
 
3640
- #: modules/gadsense/admin/views/mapi-ad-selector.php:104
3641
  msgid ""
3642
  "Create an ad on the fly. Just select the <em>Normal</em> or <em>"
3643
  "Responsive</em> type and the size."
3644
  msgstr ""
3645
 
3646
- #: modules/gadsense/admin/views/mapi-ad-selector.php:105
3647
  msgid ""
3648
  "Choose a <em>Normal</em>, <em>Responsive</em> or <em>Link Unit</em> ad from "
3649
  "your AdSense account."
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: 2019-01-16 11: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"
24
  "X-Poedit-SearchPath-0: ."
25
 
26
  #: admin/class-advanced-ads-admin.php:220 classes/display-conditions.php:215
27
+ #: classes/visitor-conditions.php:242 admin/views/ad-display-metabox.php:189
28
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:86
29
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:89
30
  msgid "or"
31
  msgstr ""
32
 
33
  #: admin/class-advanced-ads-admin.php:221 classes/display-conditions.php:215
34
+ #: classes/visitor-conditions.php:242 admin/views/ad-visitor-metabox.php:157
35
  msgid "and"
36
  msgstr ""
37
 
46
 
47
  #: admin/class-advanced-ads-admin.php:375 admin/includes/class-menu.php:107
48
  #: admin/includes/class-menu.php:110 admin/views/settings.php:28
49
+ #: modules/gadsense/admin/admin.php:194
50
  msgid "Support"
51
  msgstr ""
52
 
96
  msgstr ""
97
 
98
  #: classes/ad-debug.php:118 classes/ad-debug.php:167 classes/ad-debug.php:169
99
+ #: public/class-advanced-ads.php:701 admin/views/ad-group-list-ads.php:13
100
  msgid "Ad"
101
  msgstr ""
102
 
103
+ #: classes/ad-debug.php:121 public/class-advanced-ads.php:664
104
  msgctxt "ad group singular name"
105
  msgid "Ad Group"
106
  msgstr ""
236
  msgid "Uses a simple placeholder ad for quick testing."
237
  msgstr ""
238
 
239
+ #: classes/ad_type_dummy.php:45 classes/ad_type_image.php:64
240
  msgid "URL"
241
  msgstr ""
242
 
278
  msgid "edit"
279
  msgstr ""
280
 
281
+ #: classes/ad_type_image.php:66
282
  msgid "Link to target site"
283
  msgstr ""
284
 
286
  #. This string shows up on the ad edit page of
287
  #. image ads if the size entered for the ad is
288
  #. different from the size of the uploaded image.
289
+ #: classes/ad_type_image.php:201
290
  #, php-format
291
  msgid "Original size: %s"
292
  msgstr ""
305
  msgid "Insert plain text or code into this field."
306
  msgstr ""
307
 
308
+ #: classes/ad_type_plain.php:88
309
  msgid "Allow PHP"
310
  msgstr ""
311
 
312
+ #: classes/ad_type_plain.php:90
313
  msgid "Execute PHP code (wrapped in <code>&lt;?php ?&gt;</code>)"
314
  msgstr ""
315
 
316
+ #: classes/ad_type_plain.php:91
317
  msgid "No PHP tag detected in your code."
318
  msgstr ""
319
 
320
+ #: classes/ad_type_plain.php:91 classes/ad_type_plain.php:106
321
  msgid "Uncheck this checkbox for improved performance."
322
  msgstr ""
323
 
324
+ #: classes/ad_type_plain.php:102
325
  msgid "Allow shortcodes"
326
  msgstr ""
327
 
328
+ #: classes/ad_type_plain.php:105
329
  msgid "Execute shortcodes"
330
  msgstr ""
331
 
332
+ #: classes/ad_type_plain.php:106
333
  msgid "No shortcode detected in your code."
334
  msgstr ""
335
 
336
+ #: classes/checks.php:302
337
  #, php-format
338
  msgid ""
339
  "Possible conflict between jQueryUI library, used by Advanced Ads and other "
390
 
391
  #: classes/display-conditions.php:250 classes/display-conditions.php:303
392
  #: classes/display-conditions.php:358 classes/display-conditions.php:475
393
+ #: classes/visitor-conditions.php:137
394
  msgid "is"
395
  msgstr ""
396
 
397
  #: classes/display-conditions.php:251 classes/display-conditions.php:304
398
  #: classes/display-conditions.php:359 classes/display-conditions.php:476
399
+ #: classes/visitor-conditions.php:138
400
  msgid "is not"
401
  msgstr ""
402
 
627
  msgid "Everything is fine"
628
  msgstr ""
629
 
630
+ #: classes/frontend_checks.php:368
631
+ msgid "Get help"
632
+ msgstr ""
633
+
634
+ #: classes/frontend_checks.php:413
635
  msgid ""
636
  "the following code is used for automatic error detection and only visible to "
637
  "admins"
638
  msgstr ""
639
 
640
+ #: classes/frontend_checks.php:572
641
  #, php-format
642
  msgid ""
643
  "This ad was automatically placed here by AdSense. <a href=\"%s\" "
661
  msgid "Whether the visitor has to be logged in or not in order to see the ads."
662
  msgstr ""
663
 
664
+ #: classes/visitor-conditions.php:97
665
  msgid "Mobile (including tablets)"
666
  msgstr ""
667
 
668
+ #: classes/visitor-conditions.php:98
669
  msgid "Desktop"
670
  msgstr ""
671
 
672
+ #: classes/visitor-conditions.php:103 classes/visitor-conditions.php:143
673
  msgid "Manual and Troubleshooting"
674
  msgstr ""
675
 
676
+ #: classes/visitor-conditions.php:109
677
  #, php-format
678
  msgid ""
679
  "Display ads by the available space on the device or target tablets with the "
680
  "<a href=\"%s\" target=\"_blank\">Responsive add-on</a>"
681
  msgstr ""
682
 
683
+ #: classes/visitor-conditions.php:172
684
  msgid "equal"
685
  msgstr ""
686
 
687
+ #: classes/visitor-conditions.php:173
688
  msgid "equal or higher"
689
  msgstr ""
690
 
691
+ #: classes/visitor-conditions.php:174
692
  msgid "equal or lower"
693
  msgstr ""
694
 
718
  msgid "Ad Groups"
719
  msgstr ""
720
 
721
+ #: classes/widget.php:93 public/class-advanced-ads.php:700
722
  #: admin/includes/class-menu.php:62 admin/includes/class-menu.php:62
723
  #: admin/includes/class-shortcode-creator.php:84
724
+ #: admin/views/ad-group-list-form-row.php:90
725
  #: admin/views/ad-group-list-header.php:17 admin/views/placements-item.php:16
726
  #: admin/views/placements.php:260
727
  #: modules/gutenberg/includes/class-gutenberg.php:79
764
  msgid "Advanced Ads Error: %s"
765
  msgstr ""
766
 
767
+ #: public/class-advanced-ads.php:663
768
  msgctxt "ad group general name"
769
  msgid "Ad Groups & Rotations"
770
  msgstr ""
771
 
772
+ #: public/class-advanced-ads.php:665
773
  msgid "Search Ad Groups"
774
  msgstr ""
775
 
776
+ #: public/class-advanced-ads.php:666
777
  msgid "All Ad Groups"
778
  msgstr ""
779
 
780
+ #: public/class-advanced-ads.php:667
781
  msgid "Parent Ad Groups"
782
  msgstr ""
783
 
784
+ #: public/class-advanced-ads.php:668
785
  msgid "Parent Ad Groups:"
786
  msgstr ""
787
 
788
+ #: public/class-advanced-ads.php:669
789
  msgid "Edit Ad Group"
790
  msgstr ""
791
 
792
+ #: public/class-advanced-ads.php:670
793
  msgid "Update Ad Group"
794
  msgstr ""
795
 
796
+ #: public/class-advanced-ads.php:671
797
  msgid "Add New Ad Group"
798
  msgstr ""
799
 
800
+ #: public/class-advanced-ads.php:672
801
  msgid "New Ad Groups Name"
802
  msgstr ""
803
 
804
+ #: public/class-advanced-ads.php:673 modules/import-export/views/page.php:24
805
  msgid "Groups"
806
  msgstr ""
807
 
808
+ #: public/class-advanced-ads.php:674
809
  msgid "No Ad Group found"
810
  msgstr ""
811
 
812
+ #: public/class-advanced-ads.php:702 public/class-advanced-ads.php:706
813
  #: admin/includes/class-menu.php:79 admin/views/ad-group-list-ads.php:28
814
  msgid "New Ad"
815
  msgstr ""
816
 
817
+ #: public/class-advanced-ads.php:703 admin/includes/class-menu.php:79
818
  msgid "Add New Ad"
819
  msgstr ""
820
 
821
+ #: public/class-advanced-ads.php:704
822
  #: admin/includes/class-ad-groups-list.php:313
823
  #: modules/import-export/classes/import.php:146
824
  #: modules/import-export/classes/import.php:186
826
  msgid "Edit"
827
  msgstr ""
828
 
829
+ #: public/class-advanced-ads.php:705
830
  msgid "Edit Ad"
831
  msgstr ""
832
 
833
+ #: public/class-advanced-ads.php:707
834
  msgid "View"
835
  msgstr ""
836
 
837
+ #: public/class-advanced-ads.php:708
838
  msgid "View the Ad"
839
  msgstr ""
840
 
841
+ #: public/class-advanced-ads.php:709
842
  msgid "Search Ads"
843
  msgstr ""
844
 
845
+ #: public/class-advanced-ads.php:710
846
  msgid "No Ads found"
847
  msgstr ""
848
 
849
+ #: public/class-advanced-ads.php:711
850
  msgid "No Ads found in Trash"
851
  msgstr ""
852
 
853
+ #: public/class-advanced-ads.php:712
854
  msgid "Parent Ad"
855
  msgstr ""
856
 
857
+ #: public/class-advanced-ads.php:870
858
  msgctxt "label above ads"
859
  msgid "Advertisements"
860
  msgstr ""
928
  msgstr ""
929
 
930
  #: admin/includes/class-ad-groups-list.php:344
931
+ #: admin/includes/class-ad-groups-list.php:403
932
  msgid "Invalid Ad Group"
933
  msgstr ""
934
 
935
  #: admin/includes/class-ad-groups-list.php:349
936
+ #: admin/includes/class-ad-groups-list.php:408
937
  msgid "You don’t have permission to change the ad groups"
938
  msgstr ""
939
 
988
  msgstr[0] ""
989
  msgstr[1] ""
990
 
991
+ #: admin/includes/class-ad-type.php:572 admin/includes/class-ad-type.php:573
992
  msgid "Ad updated."
993
  msgstr ""
994
 
995
  #. translators: %s: date and time of the revision
996
+ #: admin/includes/class-ad-type.php:575
997
  #, php-format
998
  msgid "Ad restored to revision from %s"
999
  msgstr ""
1000
 
1001
+ #: admin/includes/class-ad-type.php:576 admin/includes/class-ad-type.php:577
1002
  msgid "Ad saved."
1003
  msgstr ""
1004
 
1005
+ #: admin/includes/class-ad-type.php:578
1006
  msgid "Ad submitted."
1007
  msgstr ""
1008
 
1009
+ #: admin/includes/class-ad-type.php:580
1010
  #, php-format
1011
  msgid "Ad scheduled for: <strong>%1$s</strong>."
1012
  msgstr ""
1013
 
1014
  #. translators: Publish box date format, see http://php.net/date
1015
+ #: admin/includes/class-ad-type.php:582
1016
  msgid "M j, Y @ G:i"
1017
  msgstr ""
1018
 
1019
+ #: admin/includes/class-ad-type.php:584
1020
  msgid "Ad draft updated."
1021
  msgstr ""
1022
 
1023
+ #: admin/includes/class-ad-type.php:671
1024
  msgid ""
1025
  "You don’t have access to ads. Please deactivate and re-enable Advanced Ads "
1026
  "again to fix this."
1038
  msgid "Error while trying to register the license. Please contact support."
1039
  msgstr ""
1040
 
1041
+ #: admin/includes/class-licenses.php:106 admin/views/setting-license.php:59
1042
  msgid "Please enter a valid license key"
1043
  msgstr ""
1044
 
1045
+ #: admin/includes/class-licenses.php:161
1046
  msgid "License couldn’t be activated. Please try again later."
1047
  msgstr ""
1048
 
1049
+ #: admin/includes/class-licenses.php:178
1050
  msgid "This is the bundle license key."
1051
  msgstr ""
1052
 
1053
+ #: admin/includes/class-licenses.php:179
1054
  msgid "This is not the correct key for this add-on."
1055
  msgstr ""
1056
 
1057
+ #: admin/includes/class-licenses.php:180
1058
  msgid "There are no activations left."
1059
  msgstr ""
1060
 
1061
+ #: admin/includes/class-licenses.php:189
1062
  #, php-format
1063
  msgid "License is invalid. Reason: %s"
1064
  msgstr ""
1065
 
1066
+ #. %s is a list of server information like IP address. Just keep it as is.
1067
+ #: admin/includes/class-licenses.php:223
1068
+ #, php-format
1069
+ msgid ""
1070
+ "Your request was blocked by our firewall. Please send us the following "
1071
+ "information to unblock you: %s."
1072
  msgstr ""
1073
 
1074
+ #: admin/includes/class-licenses.php:272
1075
+ msgid "Error while trying to disable the license. Please contact support."
1076
  msgstr ""
1077
 
1078
+ #: admin/includes/class-licenses.php:304 admin/includes/class-licenses.php:328
1079
+ msgid "License couldn’t be deactivated. Please try again later."
 
 
 
1080
  msgstr ""
1081
 
1082
+ #: admin/includes/class-licenses.php:535
1083
  #, php-format
1084
  msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
1085
  msgstr ""
1086
 
1087
+ #: admin/includes/class-licenses.php:537
1088
  #, php-format
1089
  msgid ""
1090
  "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>"
1091
  "."
1092
  msgstr ""
1093
 
1094
+ #: admin/includes/class-list-filters.php:140
1095
  #: modules/gadsense/admin/admin.php:29
1096
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:132
1097
  msgid "Responsive"
1098
  msgstr ""
1099
 
1100
+ #: admin/includes/class-list-filters.php:149
1101
  msgid "expired"
1102
  msgstr ""
1103
 
1104
+ #: admin/includes/class-list-filters.php:153
1105
  msgid "any expiry date"
1106
  msgstr ""
1107
 
1184
  msgid "%d ads – <a href=\"%s\">manage</a> - <a href=\"%s\">new</a>"
1185
  msgstr ""
1186
 
1187
+ #: admin/includes/class-meta-box.php:384
 
 
 
 
1188
  msgid "Get the tutorial via email"
1189
  msgstr ""
1190
 
1191
+ #: admin/includes/class-meta-box.php:391
1192
  msgid "Get AdSense tips via email"
1193
  msgstr ""
1194
 
1195
+ #: admin/includes/class-meta-box.php:398
1196
+ msgid "Visit our blog for more articles about ad optimization"
1197
  msgstr ""
1198
 
1199
+ #: admin/includes/class-meta-box.php:449
1200
  msgid "Advanced Ads Tutorials"
1201
  msgstr ""
1202
 
1203
+ #: admin/includes/class-notices.php:472
1204
  #, php-format
1205
  msgid ""
1206
  "You don’t seem to have an email address. Please use <a href=\"%s\" "
1207
  "target=\"_blank\">this form</a> to sign up."
1208
  msgstr ""
1209
 
1210
+ #: admin/includes/class-notices.php:490
1211
  msgid ""
1212
  "How embarrassing. The email server seems to be down. Please try again later."
1213
  msgstr ""
1214
 
1215
+ #: admin/includes/class-notices.php:495
1216
  #, php-format
1217
  msgid ""
1218
  "Please check your email (%s) for the confirmation message. If you didn’t "
1234
  msgstr ""
1235
 
1236
  #: admin/includes/class-overview-widgets.php:68
1237
+ #: modules/gadsense/admin/views/adsense-account.php:93
1238
+ #: modules/gadsense/admin/views/adsense-account.php:111
1239
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:91
1240
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:93
1241
  msgid "Connect to AdSense"
1242
  msgstr ""
1243
 
1261
  msgid "Join now"
1262
  msgstr ""
1263
 
1264
+ #: admin/includes/class-overview-widgets.php:93 admin/includes/notices.php:44
1265
  msgid ""
1266
  "Do you find Advanced Ads useful and would like to keep us motivated? Please "
1267
  "help us with a review."
1268
  msgstr ""
1269
 
1270
+ #: admin/includes/class-overview-widgets.php:95 admin/includes/notices.php:47
1271
  msgid "Sure, I’ll rate the plugin"
1272
  msgstr ""
1273
 
1274
+ #: admin/includes/class-overview-widgets.php:97 admin/includes/notices.php:48
1275
  msgid "I already did"
1276
  msgstr ""
1277
 
1671
  msgid "Subscribe me now"
1672
  msgstr ""
1673
 
1674
+ #: admin/includes/notices.php:37
1675
  msgid ""
1676
  "One or more license keys for <strong>Advanced Ads add-ons are invalid or "
1677
  "missing</strong>."
1678
  msgstr ""
1679
 
1680
+ #: admin/includes/notices.php:37
1681
  #, php-format
1682
  msgid "Please add valid license keys <a href=\"%s\">here</a>."
1683
  msgstr ""
1684
 
1685
+ #: admin/includes/notices.php:43
1686
  #, php-format
1687
  msgid "You’ve successfully <strong>created %s ads using Advanced Ads</strong>."
1688
  msgstr ""
1689
 
1690
+ #: admin/includes/notices.php:49
1691
  msgid "I am not happy, please help"
1692
  msgstr ""
1693
 
1694
+ #: admin/includes/notices.php:50
1695
  msgid "Ask me later"
1696
  msgstr ""
1697
 
1698
+ #: admin/includes/notices.php:57
1699
  #, php-format
1700
  msgid ""
1701
  "Some assets were changed. Please <strong>rebuild the asset folder</strong> "
1703
  "disguise."
1704
  msgstr ""
1705
 
1706
+ #: admin/includes/notices.php:63
1707
  #, php-format
1708
  msgid ""
1709
  "Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
1712
  "Access</a>"
1713
  msgstr ""
1714
 
1715
+ #: admin/includes/notices.php:69
1716
  #, php-format
1717
  msgid ""
1718
  "Our Black Friday / Cyber Monday Offer: <span style=\"font-weight: bold; font-"
1827
  msgstr ""
1828
 
1829
  #: admin/views/ad-display-metabox.php:104
1830
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:139
1831
  msgid "manual"
1832
  msgstr ""
1833
 
1891
  msgid "weight"
1892
  msgstr ""
1893
 
1894
+ #: admin/views/ad-group-list-form-row.php:29 admin/views/placements.php:32
1895
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:42
1896
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:54
1897
  #: modules/privacy/admin/views/setting-consent-method.php:9
1898
  msgid "Name"
1899
  msgstr ""
1900
 
1901
+ #: admin/views/ad-group-list-form-row.php:55 admin/views/placements.php:31
1902
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:128
1903
  msgid "Type"
1904
  msgstr ""
1905
 
1906
+ #: admin/views/ad-group-list-form-row.php:71
1907
  msgctxt "option to display all ads in an ad groups"
1908
  msgid "all"
1909
  msgstr ""
1910
 
1911
+ #: admin/views/ad-group-list-form-row.php:78
1912
  msgid "Visible ads"
1913
  msgstr ""
1914
 
1915
+ #: admin/views/ad-group-list-form-row.php:80
1916
  msgid "Number of ads that are visible at the same time"
1917
  msgstr ""
1918
 
1954
  msgid "Ad Groups successfully updated"
1955
  msgstr ""
1956
 
1957
+ #: admin/views/ad-group.php:63
1958
  #, php-format
1959
  msgid "Search results for &#8220;%s&#8221;"
1960
  msgstr ""
1961
 
1962
+ #: admin/views/ad-group.php:70
1963
  msgid "Group title"
1964
  msgstr ""
1965
 
1966
+ #: admin/views/ad-group.php:71
1967
  msgid "save"
1968
  msgstr ""
1969
 
1970
+ #: admin/views/ad-group.php:73
1971
  msgid ""
1972
  "Ad Groups are a very flexible method to bundle ads. You can use them to "
1973
  "display random ads in the frontend or run split tests, but also just for "
1975
  "ad can belong to multiple ad groups."
1976
  msgstr ""
1977
 
1978
+ #: admin/views/ad-group.php:79
1979
  #, php-format
1980
  msgid ""
1981
  "Find more information about ad groups in the <a href=\"%s\" "
1982
  "target=\"_blank\">manual</a>."
1983
  msgstr ""
1984
 
1985
+ #: admin/views/ad-group.php:107
1986
  msgid "Update Groups"
1987
  msgstr ""
1988
 
2303
  "<a href=\"%s\" target=\"_blank\">Responsive add-on</a>."
2304
  msgstr ""
2305
 
2306
+ #: admin/views/ad-visitor-metabox.php:188
2307
  msgid ""
2308
  "The visitor conditions below are deprecated. Please use the new version of "
2309
  "visitor conditions to replace it."
2310
  msgstr ""
2311
 
2312
+ #: admin/views/ad-visitor-metabox.php:194
2313
  msgid "Display on all devices"
2314
  msgstr ""
2315
 
2316
+ #: admin/views/ad-visitor-metabox.php:198
2317
  msgid "only on mobile devices"
2318
  msgstr ""
2319
 
2320
+ #: admin/views/ad-visitor-metabox.php:202
2321
  msgid "not on mobile devices"
2322
  msgstr ""
2323
 
2422
  msgid "I switched to another plugin"
2423
  msgstr ""
2424
 
2425
+ #: admin/views/feedback-disable.php:25 modules/gadsense/admin/admin.php:298
2426
+ msgid "Faster than the AdSense support!"
2427
+ msgstr ""
2428
+
2429
+ #: admin/views/feedback-disable.php:32 modules/gadsense/admin/admin.php:307
2430
+ msgid "reach out for help"
2431
+ msgstr ""
2432
+
2433
+ #: admin/views/feedback-disable.php:38
2434
  msgid "Send feedback & deactivate"
2435
  msgstr ""
2436
 
2437
+ #: admin/views/feedback-disable.php:39
2438
  msgid "Send feedback"
2439
  msgstr ""
2440
 
2441
+ #: admin/views/feedback-disable.php:41
2442
  msgid "Only Deactivate"
2443
  msgstr ""
2444
 
2445
+ #: admin/views/feedback-disable.php:44
2446
  msgid ""
2447
  "Thanks for submitting your feedback. I will reply within 24 hours on working "
2448
  "days."
2449
  msgstr ""
2450
 
2451
  #. %s is the title of the website
2452
+ #: admin/views/feedback-disable.php:49
2453
  #, php-format
2454
  msgid "All the best to you and %s."
2455
  msgstr ""
2456
 
2457
+ #: admin/views/feedback-disable.php:50
2458
  msgid "Disabling the plugin now…"
2459
  msgstr ""
2460
 
2529
  msgstr ""
2530
 
2531
  #: admin/views/placement-injection-top.php:24
2532
+ #: modules/gadsense/admin/admin.php:461
2533
  #, php-format
2534
  msgid ""
2535
  "The AdSense verification and Auto ads code is already activated in the <a "
2537
  msgstr ""
2538
 
2539
  #: admin/views/placement-injection-top.php:30
2540
+ #: modules/gadsense/admin/admin.php:463
2541
  msgid ""
2542
  "No need to add the code manually here, unless you want to include it into "
2543
  "certain pages only."
2785
  msgid "Save New Placement"
2786
  msgstr ""
2787
 
2788
+ #: admin/views/post-ad-settings-metabox.php:1
2789
+ msgid "How to disable ads on specific pages"
2790
+ msgstr ""
2791
+
2792
+ #: admin/views/post-ad-settings-metabox.php:5
2793
  msgid "Disable ads on this page"
2794
  msgstr ""
2795
 
2801
  msgid "Update expiry date"
2802
  msgstr ""
2803
 
2804
+ #: admin/views/setting-license.php:17
2805
  #, php-format
2806
  msgid ""
2807
  "Click on %2$s if you renewed it or have a subscription or <a href=\"%1$s\" "
2808
+ "class=\"advads-renewal-link\" target=\"_blank\">renew your license</a>."
2809
  msgstr ""
2810
 
2811
+ #: admin/views/setting-license.php:29
2812
  #, php-format
2813
  msgid "(%d days left)"
2814
  msgstr ""
2815
 
2816
+ #: admin/views/setting-license.php:33
2817
  msgid "License key"
2818
  msgstr ""
2819
 
2820
+ #: admin/views/setting-license.php:50
2821
  msgid "Deactivate License"
2822
  msgstr ""
2823
 
2824
+ #: admin/views/setting-license.php:56
2825
  msgid "Update License"
2826
  msgstr ""
2827
 
2828
+ #: admin/views/setting-license.php:56
2829
  msgid "Activate License"
2830
  msgstr ""
2831
 
2832
+ #: admin/views/setting-license.php:61
2833
  msgid "License key invalid"
2834
  msgstr ""
2835
 
2836
+ #: admin/views/setting-license.php:69
2837
  msgid "active"
2838
  msgstr ""
2839
 
2957
  msgid "Find solutions in the manual"
2958
  msgstr ""
2959
 
2960
+ #: admin/views/notices/adblock.php:4
2961
  msgid ""
2962
  "Please disable your <strong>AdBlocker</strong> to prevent problems with your "
2963
  "ad setup."
3042
  msgid "Ad blocker counter"
3043
  msgstr ""
3044
 
 
 
 
 
 
 
 
 
 
 
 
3045
  #: modules/gadsense/admin/admin.php:135
3046
  msgid "AdSense account"
3047
  msgstr ""
3062
  msgid "Transparent background"
3063
  msgstr ""
3064
 
3065
+ #: modules/gadsense/admin/admin.php:235
3066
  #, php-format
3067
  msgid "Limit to %d AdSense ads"
3068
  msgstr ""
3069
 
3070
+ #: modules/gadsense/admin/admin.php:239
3071
  msgid ""
3072
  "There is no explicit limit for AdSense ads anymore, but you can still use "
3073
  "this setting to prevent too many AdSense ads to show accidentally on your "
3074
  "site."
3075
  msgstr ""
3076
 
3077
+ #: modules/gadsense/admin/admin.php:243
3078
  msgid ""
3079
  "Due to technical restrictions, the limit does not work on placements with "
3080
  "cache-busting enabled."
3081
  msgstr ""
3082
 
3083
+ #: modules/gadsense/admin/admin.php:257
3084
+ #: modules/gadsense/admin/views/connect-adsense.php:37
3085
  msgid ""
3086
  "Insert the AdSense header code used for verification and the Auto Ads "
3087
  "feature."
3088
  msgstr ""
3089
 
3090
  #. this is the text for a link to a sub-page in an AdSense account
3091
+ #: modules/gadsense/admin/admin.php:262
3092
  msgid "Adjust Auto ads options"
3093
  msgstr ""
3094
 
3095
+ #: modules/gadsense/admin/admin.php:264
3096
  #, php-format
3097
  msgid ""
3098
  "Please read <a href=\"%s\" target=\"_blank\">this article</a> if <strong>ads "
3099
  "appear in random places</strong>."
3100
  msgstr ""
3101
 
3102
+ #: modules/gadsense/admin/admin.php:265
3103
  msgid "Display Auto ads only on specific pages"
3104
  msgstr ""
3105
 
3106
+ #: modules/gadsense/admin/admin.php:266
3107
  msgid "Auto ads on AMP pages"
3108
  msgstr ""
3109
 
3110
+ #: modules/gadsense/admin/admin.php:279
3111
  msgid "Disable warnings about potential violations of the AdSense terms."
3112
  msgstr ""
3113
 
3114
+ #: modules/gadsense/admin/admin.php:280
3115
  #, php-format
3116
  msgid ""
3117
  "Our <a href=\"%s\" target=\"_blank\">Ad Health</a> feature monitors if "
3119
  "managed with Advanced Ads. Enable this option to remove these checks"
3120
  msgstr ""
3121
 
3122
+ #: modules/gadsense/admin/admin.php:291
3123
  msgid ""
3124
  "Enable this option in case your theme adds an unfortunate background color "
3125
  "to AdSense ads."
3126
  msgstr ""
3127
 
3128
+ #: modules/gadsense/admin/admin.php:330
3129
+ #: modules/gadsense/includes/class-ad-type-adsense.php:76
3130
  msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
3131
  msgstr ""
3132
 
3133
+ #: modules/gadsense/admin/admin.php:352
3134
  msgid "AdSense"
3135
  msgstr ""
3136
 
3137
+ #: modules/gadsense/admin/admin.php:404
3138
  #, php-format
3139
  msgid ""
3140
  "Responsive AdSense ads don’t work reliably with <em>Position</em> set to "
3143
  "wrapped in text."
3144
  msgstr ""
3145
 
3146
+ #: modules/gadsense/admin/admin.php:410
3147
  #, php-format
3148
  msgid ""
3149
  "<a href=\"%s\" target=\"_blank\">Install the free AdSense In-feed add-on</a> "
3150
  "in order to place ads between posts."
3151
  msgstr ""
3152
 
3153
+ #: modules/gadsense/admin/admin.php:417
3154
  #, php-format
3155
  msgid ""
3156
  "Use the <a href=\"%s\" target=\"_blank\">Responsive add-on</a> in order to "
3158
  "vertical, or rectangle formats."
3159
  msgstr ""
3160
 
3161
+ #: modules/gadsense/admin/admin.php:465
3162
  #, php-format
3163
  msgid ""
3164
  "The AdSense verification and Auto ads code should be set up in the <a "
3166
  "now."
3167
  msgstr ""
3168
 
3169
+ #: modules/gadsense/admin/admin.php:466
3170
  msgid "Activate"
3171
  msgstr ""
3172
 
3178
  msgid "Use ads from your Google AdSense account"
3179
  msgstr ""
3180
 
3181
+ #: modules/gadsense/includes/class-ad-type-adsense.php:112
3182
  msgid "Your AdSense Publisher ID is missing."
3183
  msgstr ""
3184
 
3186
  msgid "Auto"
3187
  msgstr ""
3188
 
3189
+ #: modules/gadsense/includes/class-mapi.php:70
3190
+ msgid "Your account was not approved by AdSense."
3191
+ msgstr ""
3192
+
3193
+ #: modules/gadsense/includes/class-mapi.php:72
3194
+ #, php-format
3195
+ msgid "Create a new AdSense account %1$shere%2$s."
3196
+ msgstr ""
3197
+
3198
+ #: modules/gadsense/includes/class-mapi.php:383
3199
+ msgid ""
3200
+ "It seems that some changes have been made in the Advanced Ads settings. "
3201
+ "Please refresh this page."
3202
+ msgstr ""
3203
+
3204
+ #: modules/gadsense/includes/class-mapi.php:390
3205
+ #, php-format
3206
+ msgid ""
3207
+ "Advanced Ads does not have access to your account (<code>%s</code>) anymore."
3208
+ msgstr ""
3209
+
3210
+ #: modules/gadsense/includes/class-mapi.php:868
3211
+ msgid "An error occurred while requesting account details."
3212
+ msgstr ""
3213
+
3214
+ #: modules/gadsense/includes/class-mapi.php:1176
3215
+ #, php-format
3216
+ msgid ""
3217
+ "There are one or more warnings about the currently linked AdSense account. "
3218
+ "You can view them <a href=\"%s\">here</a>"
3219
+ msgstr ""
3220
+
3221
  #. Name of the plugin
3222
  #: modules/gutenberg/includes/class-gutenberg.php:78
3223
  msgid "Advanced Ads"
3472
  "Google Analytics property ID above to count them."
3473
  msgstr ""
3474
 
3475
+ #: modules/gadsense/admin/views/adsense-account.php:29
3476
+ msgid "AdSense warnings"
3477
+ msgstr ""
3478
+
3479
+ #: modules/gadsense/admin/views/adsense-account.php:30
3480
+ #: modules/gadsense/admin/views/adsense-account.php:78
3481
+ msgid "dismiss"
3482
+ msgstr ""
3483
+
3484
+ #: modules/gadsense/admin/views/adsense-account.php:35
3485
+ msgid ""
3486
+ "One of your sites is missing the AdSense publisher ID in the ads.txt file."
3487
+ msgstr ""
3488
+
3489
+ #: modules/gadsense/admin/views/adsense-account.php:42
3490
+ #: modules/gadsense/admin/views/adsense-account.php:83
3491
+ #, php-format
3492
+ msgid ""
3493
+ "Learn more about AdSense account issues <a href=\"%s\" target=\"_blank\">"
3494
+ "here</a>"
3495
+ msgstr ""
3496
+
3497
+ #: modules/gadsense/admin/views/adsense-account.php:69
3498
+ msgid "Last AdSense account connection attempt failed."
3499
+ msgstr ""
3500
+
3501
+ #: modules/gadsense/admin/views/adsense-account.php:96
3502
  msgid "Revoke API acccess"
3503
  msgstr ""
3504
 
3505
+ #: modules/gadsense/admin/views/adsense-account.php:102
3506
+ msgid "Account holder name"
3507
+ msgstr ""
3508
+
3509
+ #: modules/gadsense/admin/views/adsense-account.php:104
3510
  msgid "Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>"
3511
  msgstr ""
3512
 
3513
+ #: modules/gadsense/admin/views/adsense-account.php:110
3514
  msgid "Yes, I have an AdSense account"
3515
  msgstr ""
3516
 
3517
+ #: modules/gadsense/admin/views/adsense-account.php:112
3518
  msgid "Configure everything manually"
3519
  msgstr ""
3520
 
3521
+ #: modules/gadsense/admin/views/adsense-account.php:115
3522
  msgid "No, I still don't have an AdSense account"
3523
  msgstr ""
3524
 
3525
+ #: modules/gadsense/admin/views/adsense-account.php:116
3526
  msgid "Get a free AdSense account"
3527
  msgstr ""
3528
 
3529
+ #. %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
3530
+ #: modules/gadsense/admin/views/adsense-account.php:166
3531
  #, php-format
3532
  msgid ""
3533
+ "Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s."
 
3534
  msgstr ""
3535
 
3536
+ #: modules/gadsense/admin/views/adsense-account.php:174
3537
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:99
3538
  msgid "Can not connect AdSense account. PHP version is too low."
3539
  msgstr ""
3540
 
3541
+ #. this is a label for an ad that we can currently not import from the AdSense account
3542
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:49
3543
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:86
3544
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:95
3545
+ msgid "unsupported"
3546
  msgstr ""
3547
 
3548
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:56
3549
+ msgid "The ad details couldn't be retrieved from the ad code"
3550
  msgstr ""
3551
 
3552
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:57
3553
+ msgid ""
3554
+ "Warning : The AdSense account from this code does not match the one set in "
3555
+ "the Advanced Ads options."
 
3556
  msgstr ""
3557
 
3558
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:65
3559
  msgid ""
3560
  "Copy the ad code from your AdSense account, paste it into the area below and "
3561
  "click on <em>Get details</em>."
3562
  msgstr ""
3563
 
3564
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:67
3565
  msgid "Get details"
3566
  msgstr ""
3567
 
3568
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:68
3569
+ msgid "cancel"
3570
  msgstr ""
3571
 
3572
  #: modules/gadsense/admin/views/adsense-ad-parameters.php:70
3573
+ msgid "connect to your AdSense account"
3574
  msgstr ""
3575
 
3576
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:81
3577
+ msgid "Insert new AdSense code"
3578
  msgstr ""
3579
 
3580
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:86
3581
+ msgid "Get ad code from your linked account"
3582
  msgstr ""
3583
 
3584
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:105
3585
  msgid "Ad Slot ID"
3586
  msgstr ""
3587
 
3588
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:110
3589
  #, php-format
3590
  msgid "Publisher ID: %s"
3591
  msgstr ""
3592
 
3593
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:114
3594
  msgid ""
3595
  "The ad slot ID is either a number or empty and not the same as the publisher "
3596
  "ID."
3597
  msgstr ""
3598
 
3599
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:125
3600
  #, php-format
3601
  msgid "Please <a href=\"%s\" target=\"_blank\">change it here</a>."
3602
  msgstr ""
3603
 
3604
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:131
3605
  msgid "Normal"
3606
  msgstr ""
3607
 
3608
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:133
3609
  msgid "Responsive (Matched Content)"
3610
  msgstr ""
3611
 
3612
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:134
3613
  msgid "Link ads"
3614
  msgstr ""
3615
 
3616
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:135
3617
  msgid "Link ads (Responsive)"
3618
  msgstr ""
3619
 
3620
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:136
3621
  msgid "InArticle"
3622
  msgstr ""
3623
 
3624
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:137
3625
  msgid "InFeed"
3626
  msgstr ""
3627
 
3628
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:142
3629
  msgid "Resizing"
3630
  msgstr ""
3631
 
3632
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:150
3633
  msgid "Layout"
3634
  msgstr ""
3635
 
3636
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:154
3637
  msgid "Layout-Key"
3638
  msgstr ""
3639
 
3640
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:159
3641
  msgid "Clearfix"
3642
  msgstr ""
3643
 
3644
+ #: modules/gadsense/admin/views/adsense-ad-parameters.php:162
3645
  msgid "Enable this box if responsive ads cover something on your site"
3646
  msgstr ""
3647
 
3648
+ #: modules/gadsense/admin/views/connect-adsense.php:35
3649
+ msgid "Please enter the confirmation code."
3650
+ msgstr ""
3651
+
3652
+ #: modules/gadsense/admin/views/connect-adsense.php:39
3653
+ msgid "Submit code"
3654
+ msgstr ""
3655
+
3656
+ #: modules/gadsense/admin/views/connect-adsense.php:47
3657
+ msgid "Cannot access your account information."
3658
+ msgstr ""
3659
+
3660
+ #: modules/gadsense/admin/views/connect-adsense.php:53
3661
+ msgid "Please select an account"
3662
+ msgstr ""
3663
+
3664
+ #: modules/gadsense/admin/views/connect-adsense.php:58
3665
+ msgid "Use this account"
3666
+ msgstr ""
3667
+
3668
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:27
3669
+ msgid "Show inactive ads"
3670
+ msgstr ""
3671
+
3672
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:29
3673
+ msgid "Hide inactive ads"
3674
+ msgstr ""
3675
+
3676
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:33
3677
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:64
3678
  msgid "Update the ad units list"
3679
  msgstr ""
3680
 
3681
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:41
3682
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:53
3683
  msgctxt "AdSense ad"
3684
  msgid "Ad unit"
3685
  msgstr ""
3686
 
3687
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:43
3688
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:55
3689
  msgctxt "AdSense ad"
3690
  msgid "Slot ID"
3691
  msgstr ""
3692
 
3693
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:44
3694
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:56
3695
  msgctxt "AdSense ad"
3696
  msgid "Type"
3697
  msgstr ""
3698
 
3699
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:45
3700
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:57
3701
  msgid "Size"
3702
  msgstr ""
3703
 
3704
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:63
3705
  msgid "No ad units found"
3706
  msgstr ""
3707
 
3708
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:72
3709
  msgid "Get the code for this ad"
3710
  msgstr ""
3711
 
3712
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:73
3713
  msgid "Update and get the code for this ad from Google"
3714
  msgstr ""
3715
 
3716
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:108
3717
  msgid "Unrecognized ad code"
3718
  msgstr ""
3719
 
3720
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:111
3721
  msgid "This ad type can currently not be imported from AdSense."
3722
  msgstr ""
3723
 
3724
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:112
3725
  msgid "Learn more and help us to enable it here."
3726
  msgstr ""
3727
 
3728
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:113
3729
  msgid "In the meantime, you can use AdSense with one of these methods:"
3730
  msgstr ""
3731
 
3732
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:115
3733
  msgid ""
3734
  "Click on <em>Insert new AdSense code</em> and copy the code from your "
3735
  "AdSense account into it."
3736
  msgstr ""
3737
 
3738
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:116
3739
  msgid ""
3740
  "Create an ad on the fly. Just select the <em>Normal</em> or <em>"
3741
  "Responsive</em> type and the size."
3742
  msgstr ""
3743
 
3744
+ #: modules/gadsense/admin/views/mapi-ad-selector.php:117
3745
  msgid ""
3746
  "Choose a <em>Normal</em>, <em>Responsive</em> or <em>Link Unit</em> ad from "
3747
  "your AdSense account."
modules/adblock-finder/public/public.php CHANGED
@@ -8,9 +8,9 @@ class Advanced_Ads_Adblock_Finder {
8
 
9
  public function print_adblock_check_js() {
10
  $options = Advanced_Ads::get_instance()->options();
11
- if ( !empty( $options['ga-UID'] ) ) {
12
  ?><script>
13
- var advanced_ads_ga_UID = <?php echo isset( $options['ga-UID'] ) ? "'" . esc_js( $options['ga-UID'] ). "'" : 'false' ?>;
14
  var advanced_ads_ga_anonymIP = <?php
15
 
16
  if ( defined( 'ADVANCED_ADS_DISABLE_ANALYTICS_ANONYMIZE_IP' ) ) {
8
 
9
  public function print_adblock_check_js() {
10
  $options = Advanced_Ads::get_instance()->options();
11
+ if ( ! empty( $options['ga-UID'] ) || defined( 'AAP_SLUG' ) ) {
12
  ?><script>
13
+ var advanced_ads_ga_UID = <?php echo ! empty( $options['ga-UID'] ) ? "'" . esc_js( $options['ga-UID'] ). "'" : 'false' ?>;
14
  var advanced_ads_ga_anonymIP = <?php
15
 
16
  if ( defined( 'ADVANCED_ADS_DISABLE_ANALYTICS_ANONYMIZE_IP' ) ) {
modules/gadsense/admin/admin.php CHANGED
@@ -41,14 +41,10 @@ class Advanced_Ads_AdSense_Admin {
41
  $pub_id = $db->get_adsense_id();
42
  ?>
43
  <script type="text/javascript">
44
- var gadsenseData = {
45
- pubId : '<?php echo $pub_id; ?>',
46
- msg : {
47
- unknownAd : '<?php esc_attr_e( "The ad details couldn't be retrieved from the ad code", 'advanced-ads' ); ?>',
48
- pubIdMismatch : '<?php esc_attr_e( 'Warning : The AdSense account from this code does not match the one set with the Advanced Ads Plugin. This ad might cause troubles when used in the front end.', 'advanced-ads' ); ?>',
49
- },
50
- pagenow: '<?php echo $pagenow ?>',
51
- };
52
  </script>
53
  <?php
54
  }
@@ -58,6 +54,10 @@ class Advanced_Ads_AdSense_Admin {
58
  global $gadsense_globals, $pagenow, $post_type;
59
  $screen = get_current_screen();
60
  $plugin = Advanced_Ads_Admin::get_instance();
 
 
 
 
61
  if (
62
  ('post-new.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type) ||
63
  ('post.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type && isset($_GET['action']) && 'edit' == $_GET['action'])
@@ -188,6 +188,14 @@ class Advanced_Ads_AdSense_Admin {
188
  // }
189
  // hook for additional settings from add-ons
190
  do_action( 'advanced-ads-adsense-settings-init', $hook );
 
 
 
 
 
 
 
 
191
  }
192
 
193
  /**
@@ -281,7 +289,23 @@ class Advanced_Ads_AdSense_Admin {
281
 
282
  ?><label><input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[background]" value="1" <?php checked( $background ); ?> />
283
  <?php _e( 'Enable this option in case your theme adds an unfortunate background color to AdSense ads.', 'advanced-ads' ); ?></label><?php
284
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
 
286
  /**
287
  * sanitize adsense settings
@@ -346,15 +370,15 @@ class Advanced_Ads_AdSense_Admin {
346
  return $ad_settings_post;
347
  }
348
 
349
- // save AdSense publisher ID if given and remove it from options
350
  if ( ! empty($ad_settings_post['output']['adsense-pub-id']) ) {
351
  // get options
352
  $adsense_options = get_option( 'advanced-ads-adsense', array() );
353
- $adsense_options['adsense-id'] = $ad_settings_post['output']['adsense-pub-id'];
354
-
355
- // save adsense options including publisher id
356
- update_option( 'advanced-ads-adsense', $adsense_options );
357
-
358
  }
359
  unset( $ad_settings_post['output']['adsense-pub-id'] );
360
 
@@ -410,6 +434,25 @@ class Advanced_Ads_AdSense_Admin {
410
  return $notices;
411
  }
412
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  /**
414
  * Get Auto Ads messages.
415
  */
@@ -424,4 +467,12 @@ class Advanced_Ads_AdSense_Admin {
424
  );
425
  }
426
 
 
 
 
 
 
 
 
 
427
  }
41
  $pub_id = $db->get_adsense_id();
42
  ?>
43
  <script type="text/javascript">
44
+ if ( 'undefined' == typeof gadsenseData ) {
45
+ window.gadsenseData = {};
46
+ }
47
+ gadsenseData['pagenow'] = '<?php echo $pagenow ?>';
 
 
 
 
48
  </script>
49
  <?php
50
  }
54
  global $gadsense_globals, $pagenow, $post_type;
55
  $screen = get_current_screen();
56
  $plugin = Advanced_Ads_Admin::get_instance();
57
+
58
+ if ( Advanced_Ads_Admin::screen_belongs_to_advanced_ads() ) {
59
+ self::enqueue_connect_adsense();
60
+ }
61
  if (
62
  ('post-new.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type) ||
63
  ('post.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type && isset($_GET['action']) && 'edit' == $_GET['action'])
188
  // }
189
  // hook for additional settings from add-ons
190
  do_action( 'advanced-ads-adsense-settings-init', $hook );
191
+
192
+ add_settings_field(
193
+ 'adsense-support',
194
+ __( 'Support', 'advanced-ads' ),
195
+ array( $this, 'render_settings_adsense_support' ),
196
+ $hook,
197
+ 'advanced_ads_adsense_setting_section'
198
+ );
199
  }
200
 
201
  /**
289
 
290
  ?><label><input type="checkbox" name="<?php echo GADSENSE_OPT_NAME; ?>[background]" value="1" <?php checked( $background ); ?> />
291
  <?php _e( 'Enable this option in case your theme adds an unfortunate background color to AdSense ads.', 'advanced-ads' ); ?></label><?php
292
+ }
293
+
294
+ /**
295
+ * Render support info for AdSense
296
+ */
297
+ public function render_settings_adsense_support() {
298
+ ?><p class="advanced-ads-adsense-support"><span class="advanced-ads-adsense-support-text"><?php _e( 'Faster than the AdSense support!', 'advanced-ads' ); ?></span>
299
+ <br/>
300
+ <span class="dashicons dashicons-star-filled"></span>
301
+ <span class="dashicons dashicons-star-filled"></span>
302
+ <span class="dashicons dashicons-star-filled"></span>
303
+ <span class="dashicons dashicons-star-filled"></span>
304
+ <span class="dashicons dashicons-star-filled"></span>
305
+ </p>
306
+ <p><a href="<?php echo Advanced_Ads_Plugin::support_url( '#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-tab-support' )?>" target="_blank"><?php
307
+ _e( 'reach out for help', 'advanced-ads' ); ?></a></p><?php
308
+ }
309
 
310
  /**
311
  * sanitize adsense settings
370
  return $ad_settings_post;
371
  }
372
 
373
+ // save AdSense publisher ID if there is no one stored yet
374
  if ( ! empty($ad_settings_post['output']['adsense-pub-id']) ) {
375
  // get options
376
  $adsense_options = get_option( 'advanced-ads-adsense', array() );
377
+
378
+ if ( empty( $adsense_options['adsense-id'] ) ) {
379
+ $adsense_options['adsense-id'] = $ad_settings_post['output']['adsense-pub-id'];
380
+ update_option( 'advanced-ads-adsense', $adsense_options );
381
+ }
382
  }
383
  unset( $ad_settings_post['output']['adsense-pub-id'] );
384
 
434
  return $notices;
435
  }
436
 
437
+ /**
438
+ * Enqueue AdSense connection script.
439
+ */
440
+ public static function enqueue_connect_adsense() {
441
+ if ( ! wp_script_is( 'advads/connect-adsense', $list = 'registered' ) ) {
442
+ wp_enqueue_script( 'advads/connect-adsense', GADSENSE_BASE_URL . 'admin/assets/js/connect-adsense.js', array( 'jquery' ), '0.8' );
443
+ }
444
+ if ( ! has_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) ) ) {
445
+ add_action( 'admin_footer', array( 'Advanced_Ads_AdSense_Admin', 'print_connect_adsense' ) );
446
+ }
447
+ }
448
+
449
+ /**
450
+ * Prints AdSense connection markup.
451
+ */
452
+ public static function print_connect_adsense() {
453
+ require_once GADSENSE_BASE_PATH . 'admin/views/connect-adsense.php';
454
+ }
455
+
456
  /**
457
  * Get Auto Ads messages.
458
  */
467
  );
468
  }
469
 
470
+ /**
471
+ * Get the ad selecto markup
472
+ *
473
+ * @param type $hide_idle Whether to hide idle ads.
474
+ */
475
+ public static function get_mapi_ad_selector( $hide_idle_ads = true ) {
476
+ require_once GADSENSE_BASE_PATH . 'admin/views/mapi-ad-selector.php';
477
+ }
478
  }
modules/gadsense/admin/assets/js/connect-adsense.js ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($){
2
+
3
+ // Unique instance of "advadsMapiConnectClass"
4
+ var INSTANCE = null;
5
+
6
+ var advadsMapiConnectClass = function( content, options ) {
7
+ this.options = {};
8
+ this.AUTH_WINDOW = null;
9
+ this.modal = $( '#gadsense-modal' );
10
+ this.frame = null;
11
+ if ( 'undefined' == typeof content || ! content ) {
12
+ content = 'confirm-code';
13
+ }
14
+ this.setOptions( options );
15
+ this.init();
16
+
17
+
18
+ this.show( content );
19
+ return this;
20
+ };
21
+
22
+ advadsMapiConnectClass.prototype = {
23
+
24
+ constructor: advadsMapiConnectClass,
25
+
26
+ // Set options, for re-use of existing instance for a different purpose.
27
+ setOptions: function( options ) {
28
+ var defaultOptions = {
29
+ autoads: false,
30
+ onSuccess: false,
31
+ onError: false,
32
+ };
33
+ if ( 'undefined' == typeof options ) {
34
+ options = defaultOptions;
35
+ }
36
+ this.options = $.extend( {}, defaultOptions, options);
37
+ },
38
+
39
+ // Tasks to do after a successful connection.
40
+ exit: function(){
41
+ if ( this.options.onSuccess ) {
42
+ if ( 'function' == typeof this.options.onSuccess ) {
43
+ this.options.onSuccess( this );
44
+ }
45
+ } else {
46
+ window.location.reload();
47
+ }
48
+ },
49
+
50
+ // Initialization - mostly binding events.
51
+ init: function(){
52
+
53
+ var that = this;
54
+
55
+ // Close the modal.
56
+ $( document ).on( 'click', '#gadsense-modal .dashicons-dismiss', function(){
57
+ $( '#mapi-code' ).val( '' );
58
+ $( '#gadsense-modal' ).css( 'display', 'none' );
59
+ } );
60
+
61
+ // Confirm code for account connection.
62
+ $( document ).on( 'click', '#mapi-confirm-code', function(){
63
+
64
+ var code = $( '#mapi-code' ).val();
65
+ if ( '' == code ) return;
66
+ $( '.gadsense-overlay' ).css( 'display', 'block' );
67
+ var data = {
68
+ action: 'advads_gadsense_mapi_confirm_code',
69
+ code: code,
70
+ nonce: AdsenseMAPI.nonce,
71
+ };
72
+
73
+ $.ajax({
74
+ url: ajaxurl,
75
+ type: 'post',
76
+ data: data,
77
+ success:function(response, status, XHR){
78
+ if ( null !== that.AUTH_WINDOW ) {
79
+ that.AUTH_WINDOW.close();
80
+ }
81
+ $( '#mapi-code' ).val( '' );
82
+ if ( response.status && true === response.status && response['token_data'] ) {
83
+ that.getAccountDetails( response['token_data'] );
84
+ } else {
85
+ /**
86
+ * Connection error handling.
87
+ */
88
+ console.log( response );
89
+ $( '.gadsense-overlay' ).css( 'display', 'none' );
90
+ $( '#mapi-code' ).val( '' );
91
+ $( '#mapi-autoads' ).prop( 'checked', false );
92
+ $( '#gadsense-modal-content-inner .dashicons-dismiss' ).trigger( 'click' );
93
+ }
94
+ },
95
+ error:function(request, status, error){
96
+ $( '#gadsense-loading-overlay' ).css( 'display', 'none' );
97
+ },
98
+ });
99
+
100
+ } );
101
+
102
+ // Account selection
103
+ $( document ).on( 'click', '.gadsense-modal-content-inner[data-content="account-selector"] button', function( ev ) {
104
+ var adsenseID = $( '#mapi-select-account' ).val();
105
+ var tokenData = false;
106
+ var tokenString = $( '.gadsense-modal-content-inner[data-content="account-selector"] input.token-data' ).val();
107
+ var details = false;
108
+ var detailsString = $( '.gadsense-modal-content-inner[data-content="account-selector"] input.accounts-details' ).val();
109
+
110
+ try {
111
+ tokenData = JSON.parse( tokenString );
112
+ } catch ( Ex ) {
113
+ console.error( 'Bad token data : ' + tokenString );
114
+ }
115
+ try {
116
+ details = JSON.parse( detailsString );
117
+ } catch ( Ex ) {
118
+ console.error( 'Bad account details : ' + detailsString );
119
+ }
120
+ if ( details && JSON ) {
121
+ $( '.gadsense-overlay' ).css( 'display', 'block' );
122
+ var data = {
123
+ action: 'advads_gadsense_mapi_select_account',
124
+ nonce: AdsenseMAPI.nonce,
125
+ account : details[ adsenseID ],
126
+ 'token_data': tokenData,
127
+ autoads: $( '#mapi-autoads' ).prop( 'checked' ),
128
+ };
129
+
130
+ $.ajax({
131
+ url: ajaxurl,
132
+ type: 'post',
133
+ data: data,
134
+ success:function(response, status, XHR){
135
+ if ( response.status && true === response.status ) {
136
+ INSTANCE.exit();
137
+ } else {
138
+ console.log( response );
139
+ }
140
+ },
141
+ error:function(request, status, error){
142
+ $( '#gadsense-loading-overlay' ).css( 'display', 'none' );
143
+ },
144
+ });
145
+ }
146
+
147
+ } );
148
+
149
+ },
150
+
151
+ // Get account info based on a newly obtained token.
152
+ getAccountDetails: function( tokenData ){
153
+ var data = {
154
+ action: 'advads_gadsense_mapi_get_details',
155
+ nonce: AdsenseMAPI.nonce,
156
+ };
157
+ data['token_data'] = tokenData;
158
+ if ( $( '#mapi-autoads' ).prop( 'checked' ) ) {
159
+ data['autoads'] = true;
160
+ }
161
+
162
+ $.ajax({
163
+ url: ajaxurl,
164
+ type: 'post',
165
+ data: data,
166
+ success:function(response, status, XHR){
167
+ if ( response.status && true === response.status ) {
168
+ if ( response['adsense_id'] ) {
169
+ INSTANCE.exit();
170
+ } else if ( response['token_data'] ) {
171
+ INSTANCE.switchContent( 'account-selector' );
172
+ INSTANCE.frame.find( 'select' ).html( response.html );
173
+ INSTANCE.frame.find( 'input.token-data' ).val( JSON.stringify( response['token_data'] ) );
174
+ INSTANCE.frame.find( 'input.accounts-details' ).val( JSON.stringify( response['details'] ) );
175
+ } else {
176
+ INSTANCE.switchContent( 'error' );
177
+ INSTANCE.frame.find( '.error-message' ).text( JSON.stringify( response ) );
178
+ }
179
+ } else {
180
+ if ( response['raw']['errors'][0]['message'] ) {
181
+ INSTANCE.switchContent( 'error' );
182
+ INSTANCE.frame.find( '.error-message' ).text( response['raw']['errors'][0]['message'] );
183
+ if ( 'undefined' != typeof AdsenseMAPI.connectErrorMsg[response['raw']['errors'][0]['reason']] ) {
184
+ INSTANCE.frame.find( '.error-description' ).html( AdsenseMAPI.connectErrorMsg[response['raw']['errors'][0]['reason']] );
185
+ } else {
186
+ INSTANCE.frame.find( '.error-message' ).append( '&nbsp;<code>(' + response['raw']['errors'][0]['reason'] + ')</code>' );
187
+ }
188
+ } else if ( response['raw']['message'] ) {
189
+ INSTANCE.frame.find( '.error-message' ).text( response['raw']['errors'][0]['message'] );
190
+ }
191
+ }
192
+ },
193
+ error:function(request, status, error){
194
+ $( '#gadsense-loading-overlay' ).css( 'display', 'none' );
195
+ },
196
+ });
197
+
198
+ },
199
+
200
+ // Switch between frames in the modal container.
201
+ switchContent: function( content ) {
202
+ if ( this.modal.find( '.gadsense-modal-content-inner[data-content="' + content + '"]' ).length ) {
203
+ this.modal.find( '.gadsense-modal-content-inner' ).css( 'display', 'none' );
204
+ this.frame = this.modal.find( '.gadsense-modal-content-inner[data-content="' + content + '"]' );
205
+ this.frame.css( 'display', 'block' );
206
+ $( '.gadsense-overlay' ).css( 'display', 'none' );
207
+ }
208
+ },
209
+
210
+ // Show the modal frame with a given content.
211
+ show: function( content ) {
212
+ if ( 'undefined' == typeof content ) {
213
+ content = 'confirm-code';
214
+ }
215
+ this.switchContent( content );
216
+
217
+ if ( 'confirm-code' == content ) {
218
+
219
+ // Open Google authentication in a child window.
220
+ this.modal.css( 'display', 'block' );
221
+
222
+ var oW = $( window ).width(),
223
+ oH = $( window ).height(),
224
+ w = Math.min( oW, oH ) * 0.8,
225
+ h = Math.min( oW, oH ) * 0.8,
226
+ l = (oW - w) / 2,
227
+ t = (oH - h) / 2,
228
+
229
+ args = 'resize=1,titlebar=1,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t;
230
+ this.AUTH_WINDOW = window.open( AdsenseMAPI.oAuth2, 'advadsOAuth2', args );
231
+
232
+ }
233
+ },
234
+
235
+ // Hide the modal frame
236
+ hide: function(){
237
+ this.switchContent( 'confirm-code' );
238
+ this.modal.css( 'display', 'none' );
239
+ },
240
+
241
+ };
242
+
243
+ window.advadsMapiConnectClass = advadsMapiConnectClass;
244
+
245
+ // Shortcut function.
246
+ window.advadsMapiConnect = function( content, options ) {
247
+ if ( 'undefined' == typeof content || ! content ) {
248
+ content = 'confirm-code';
249
+ }
250
+ if ( 'undefined' == typeof options ) {
251
+ options = {};
252
+ }
253
+ if ( null === INSTANCE ) {
254
+ INSTANCE = new advadsMapiConnectClass( content, options );
255
+ } else {
256
+ INSTANCE.show( content, options );
257
+ }
258
+ }
259
+
260
+ $(function(){
261
+ // Move the the pop-up outside of any form.
262
+ $( '#wpwrap' ).append( $( '#gadsense-modal' ) );
263
+ });
264
+
265
+ })(window.jQuery);
modules/gadsense/admin/assets/js/mapi-settings.js CHANGED
@@ -4,14 +4,45 @@
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();
@@ -21,29 +52,9 @@
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({
@@ -61,67 +72,73 @@
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
- // move the API connection code submission pop-up outside of the settings form
120
- $( '#wpwrap' ).append( $( '#gadsense-modal' ) );
121
-
122
  if ( '' == $( '#adsense-id' ).val().trim() ) {
123
  $( '#adsense #submit' ).parent().css( 'display', 'none' );
124
  }
125
  } );
126
-
127
  })(window.jQuery);
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
  ;(function($){
10
+
11
+ function printAlerts( alerts ) {
12
+ var $div = $( '#mapi-account-alerts' );
13
+ $div.empty();
14
+ if ( alerts.length ) {
15
+ $div.append( $( '<p />' ).text( $div.attr( 'data-heading' ) ) );
16
+ var $ul = $( '<ul />' );
17
+ for ( var id in alerts.alerts ) {
18
+ var msg = alerts.alerts[id].message;
19
+ if ( 'undefined' != typeof AdsenseMAPI.alertsMsg[alerts.alerts[id]['id']] ) {
20
+ msg = AdsenseMAPI.alertsMsg[alerts.alerts[id]['id']];
21
+ }
22
+ $ul.append( $( '<li />' ).html( msg + ' ' +
23
+ '<a href="#" class="mapi-dismiss-alert" data-id="' + id + '">' + $div.attr( 'data-dismiss' ) + '</a>' ) );
24
+ }
25
+ $div.append( $ul );
26
+ $div.append( $( AdsenseMAPI.errorPageLink ) );
27
+ }
28
+ }
29
+
30
  $( document ).on( 'click', '.preventDefault', function( ev ) {
31
  ev.preventDefault();
32
+ } );
33
+
34
+ $( document ).on( 'click', '#dissmiss-connect-error', function() {
35
+ $( '#mapi-connect-errors' ).empty();
36
+ $.ajax({
37
+ url: ajaxurl,
38
+ type: 'get',
39
+ data: {
40
+ action: 'advads-mapi-dismiss-connect-error',
41
+ nonce: AdsenseMAPI.nonce,
42
+ }
43
+ });
44
+ } );
45
+
46
  $( document ).on( 'keypress', '#adsense input[type="text"]', function( ev ) {
47
  if ( $( this ).hasClass( 'preventDefault' ) ) {
48
  ev.preventDefault();
52
  $( '#adsense .advads-settings-tab-main-form #submit' ).trigger( 'click' );
53
  }
54
  } );
55
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  $( document ).on( 'click', '#revoke-token', function(){
57
+
58
  $( '#gadsense-freeze-all' ).css( 'display', 'block' );
59
  var ID = $( '#adsense-id' ).val();
60
  $.ajax({
72
  $( '#gadsense-freeze-all' ).css( 'display', 'none' );
73
  },
74
  });
75
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  } );
77
+
78
  $( document ).on( 'click', '#adsense-manual-config', function(){
79
  $( '#adsense .form-table tr' ).css( 'display', 'table-row' );
80
  $( '#adsense #auto-adsense-settings-div' ).css( 'display', 'none' );
81
  $( '#adsense #full-adsense-settings-div' ).css( 'display', 'block' );
82
+ $( '#adsense-id' ).after( $( '#connect-adsense' ) );
83
  } );
84
+
85
  $( document ).on( 'change', '#adsense-id', function(){
86
  if ( '' != $( this ).val().trim() ) {
87
  $( '#adsense #submit' ).parent().css( 'display', 'block' );
88
  }
89
  } );
90
+
91
+ // Open the code confirmation modal.
92
+ $( document ).on( 'click', '#connect-adsense', function(){
93
+ if ( $( this ).hasClass( 'disabled' ) ) return;
94
+ if ( 'undefined' != typeof window.advadsMapiConnect ) {
95
+ window.advadsMapiConnect();
96
+ }
97
+ } );
98
+
99
+ $( document ).on( 'click', '.mapi-dismiss-alert', function( ev ) {
100
+ ev.preventDefault();
101
+
102
+ var pubId = $( '#adsense-id' ).val();
103
+ var alertId = $( this ).attr( 'data-id' );
104
+
105
+ $( '#gadsense-modal' ).css( 'display', 'block' );
106
+ $( '#gadsense-modal-outer' ).css( 'display', 'none' );
107
+
108
+ $.ajax({
109
+ url: ajaxurl,
110
+ type: 'post',
111
+ data: {
112
+ action: 'advads-mapi-dismiss-alert',
113
+ account: pubId,
114
+ id: alertId,
115
+ nonce: AdsenseMAPI.nonce,
116
+ },
117
+ success:function(response, status, XHR){
118
+ if ( 'undefined' != typeof response.alerts ) {
119
+ printAlerts( response );
120
+ }
121
+ $( '#gadsense-modal' ).css( 'display', 'none' );
122
+ $( '#gadsense-modal-outer' ).css( 'display', 'block' );
123
+ },
124
+ error:function(request, status, error){
125
+ $( '#gadsense-modal' ).css( 'display', 'none' );
126
+ $( '#gadsense-modal-outer' ).css( 'display', 'block' );
127
+ },
128
+ });
129
+
130
+ } );
131
+
132
+ $( document ).on( 'advadsMapiRefreshAlerts', function ( ev, response ) {
133
+ if ( 'undefined' != typeof response.status && response.status && response.alerts ) {
134
+ printAlerts( response );
135
+ }
136
+ } );
137
+
138
  $( function(){
 
 
 
139
  if ( '' == $( '#adsense-id' ).val().trim() ) {
140
  $( '#adsense #submit' ).parent().css( 'display', 'none' );
141
  }
142
  } );
143
+
144
  })(window.jQuery);
modules/gadsense/admin/assets/js/new-ad.js CHANGED
@@ -9,9 +9,60 @@
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 resizeAdListHeader() {
16
  var th = $( '#mapi-list-header span' );
17
  var tb = $( '#mapi-table-wrap tbody tr' );
@@ -37,7 +88,7 @@
37
  function MapiMayBeSaveAdCode(){
38
 
39
  // MAPI not set up
40
- if ( 'undefined' == typeof AdsenseMAPI ) return;
41
 
42
  var slotId = $( '#unit-code' ).val();
43
  if ( !slotId ) return;
@@ -142,7 +193,7 @@
142
  }
143
 
144
  function MapiSaveAdCode( code, slot ) {
145
- if ( 'undefined' == typeof AdsenseMAPI.codes[ 'ca-' + AdsenseMAPI.pubId + ':' + slot ] ) {
146
  AdsenseMAPI.codes['ca-' + AdsenseMAPI.pubId + ':' + slot] = code;
147
  $( '#mapi-loading-overlay' ).css( 'display', 'block' );
148
  $.ajax({
@@ -187,12 +238,19 @@
187
  display: 'none',
188
  height: 'auto',
189
  });
 
 
190
  }
191
  );
192
  }, 80);
193
 
194
  }
195
 
 
 
 
 
 
196
 
197
  /**
198
  * Show / hide position warning.
@@ -221,9 +279,20 @@
221
  $( '.advads-adsense-code' ).show();
222
  $( '#mapi-open-selector' ).css( 'display', 'inline' );
223
  $( '#mapi-wrap' ).css( 'display', 'none' );
 
 
224
  $( this ).hide();
225
  })
226
 
 
 
 
 
 
 
 
 
 
227
  $( document ).on('click', '.advads-adsense-submit-code', function(ev){
228
  ev.preventDefault();
229
  parseCodeBtnClicked = true;
@@ -247,12 +316,7 @@
247
  }
248
  } else {
249
  if ( 'post-new.php' == gadsenseData.pagenow || ( 'draft' == AdsenseMAPI.adStatus && ! $( '#advads-ad-content-adsense' ).val() ) ) {
250
- advancedAdSenseHidden = true;
251
- $( '#mapi-wrap' ).siblings( 'label,div,hr,span.label' ).css( 'display', 'none' );
252
  $( '#mapi-open-selector a' ).trigger( 'click' );
253
- if ( '' == $( '#mapi-adunit-select' ).val() && 1 == $( '#mapi-adunit-select option' ).length ) {
254
- $( '#mapi-get-adunits' ).trigger( 'click' );
255
- }
256
  }
257
  }
258
  }
@@ -265,14 +329,6 @@
265
  } else {
266
  getRemoteCode( slotID );
267
  }
268
-
269
- // display ad slot and ad type for newly created AdSense ad
270
- if ( advancedAdSenseHidden ) {
271
- $( '#unit-type-block' ).add( $( '#unit-type-block' ).next() ).add( $( '#unit-type-block' ).next().next() ).css( 'display', 'block' );
272
- var codeBlock = $( '#unit-code' ).parent();
273
- codeBlock.add( codeBlock.prev() ).add( codeBlock.next() ).css( 'display', 'block' );
274
- }
275
-
276
  }
277
 
278
  $( document ).on('change', '#unit-type, #unit-code', function (ev) {
@@ -338,12 +394,16 @@
338
 
339
  } else {
340
  if ( 'undefined' != typeof response.raw ) {
341
- $( '#remote-ad-code-msg' ).text( response.raw );
342
  } else if( 'undefined' != typeof response.msg ) {
343
- if ( 'doesNotSupportAdUnitType' == response.msg ) {
344
- unitIsNotSupported( slotID );
345
- } else {
346
- $( '#remote-ad-code-msg' ).text( response.msg );
 
 
 
 
347
  }
348
  }
349
  }
@@ -542,7 +602,7 @@
542
  case 'unknownAd' :
543
  // Not recognized ad code
544
  if ( parseCodeBtnClicked && 'post-new.php' == gadsenseData.pagenow ) {
545
- // do not show if just afer switching to AdSense ad type on ad creation
546
  $( '#pastecode-msg' ).append( $( '<p />' ).css( 'color', 'red' ).html( gadsenseData.msg.unknownAd ) );
547
  }
548
  break;
@@ -555,6 +615,8 @@
555
  }
556
  $( '.advads-adsense-code' ).hide();
557
  $( '.advads-adsense-show-code' ).show();
 
 
558
  }
559
  }
560
 
@@ -606,6 +668,7 @@
606
  $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
607
  }
608
  var storedPubId = gadsenseData.pubId;
 
609
  if ( '' !== storedPubId && theAd.pubId != storedPubId && '' != theAd.slotId ) {
610
  $( '#adsense-ad-param-error' ).text( gadsenseData.msg.pubIdMismatch );
611
  } else {
@@ -622,9 +685,11 @@
622
  window.gadsenseFormatAdContent = function () {
623
  var slotId = $( '#ad-parameters-box #unit-code' ).val();
624
  var unitType = $( '#ad-parameters-box #unit-type' ).val();
 
625
  var adContent = {
626
  slotId: slotId,
627
  unitType: unitType,
 
628
  };
629
  if ('responsive' == unitType) {
630
  var resize = $( '#ad-parameters-box #ad-resize-type' ).val();
@@ -662,6 +727,10 @@
662
  tbody.find( 'tr i[data-slotid="ca-' + pubId + ':' + slotId + '"]' ).parents( 'tr' ).addClass( 'selected' );
663
  }
664
  }
 
 
 
 
665
  $( '#mapi-wrap' ).css( 'display', 'block' );
666
  if ( $( '#mapi-no-ad-units-found' ).length ) {
667
  $( '#mapi-no-ad-units-found' ).trigger( 'click' );
@@ -673,55 +742,96 @@
673
  $( document ).on( 'click', '#mapi-close-selector', function(){
674
  $( '#mapi-open-selector,.advads-adsense-show-code' ).css( 'display', 'inline' );
675
  $( '#mapi-wrap' ).css( 'display', 'none' );
676
- $( '#mapi-adclient-select' ).val( 'none' ).trigger( 'change' );
 
 
 
677
  } );
678
 
679
- function updateAdList() {
680
-
681
- $( '#mapi-loading-overlay' ).css( 'display', 'block' );
682
-
683
- $.ajax({
684
- type: 'post',
685
- url: ajaxurl,
686
- data: {
687
- nonce: AdsenseMAPI.nonce,
688
- action: 'advads_gadsense_mapi_get_adUnits',
689
- account: AdsenseMAPI.pubId,
690
- },
691
- success: function(response,status,XHR){
692
- $( '#mapi-loading-overlay' ).css( 'display', 'none' );
693
- if ( response.html ) {
694
- $( '#mapi-wrap' ).replaceWith( $( response.html ) );
695
- $( '#mapi-open-selector a' ).trigger( 'click' );
696
- }
697
- },
698
- error: function(request,status,err){
699
- $( '#mapi-loading-overlay' ).css( 'display', 'none' );
700
- },
701
- });
702
-
703
- }
704
-
705
- $( document ).on( 'click', '.mapiaction', function( ev ) {
706
- var action = $( this ).attr( 'data-mapiaction' );
707
- switch ( action ) {
708
- case 'updateList':
709
- updateAdList();
710
- break;
711
- case 'getCode':
712
- if ( $( this ).hasClass( 'disabled' ) ) {
713
- break;
714
- }
715
- var slotID = $( this ).attr( 'data-slotid' );
716
- getAdCode( slotID );
717
- break;
718
- case 'updateCode':
719
- var slotID = $( this ).attr( 'data-slotid' );
720
- getRemoteCode( slotID );
721
- break;
722
- default:
723
- }
724
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
725
 
726
  function advads_update_adsense_type(){
727
  var type = $( '#unit-type' ).val();
@@ -730,11 +840,11 @@
730
  $( '.advads-adsense-layout-key' ).hide();
731
  $( '.advads-adsense-layout-key' ).next('div').hide();
732
  $( '.advads-ad-notice-in-feed-add-on' ).hide();
733
- $( '.clearfix-before' ).toggle ( type === 'responsive' );
734
  if ( 'responsive' == type || 'link-responsive' == type || 'matched-content' == type ) {
735
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
736
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
737
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
 
738
  } else if ( 'in-feed' == type ) {
739
  $( '.advads-adsense-layout' ).css( 'display', 'block' );
740
  $( '.advads-adsense-layout' ).next('div').css( 'display', 'block' );
@@ -745,14 +855,17 @@
745
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
746
  // show add-on notice
747
  $( '.advads-ad-notice-in-feed-add-on' ).show();
 
748
  } else if ( 'in-article' == type ) {
749
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
750
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
751
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
 
752
  } else if ( 'normal' == type || 'link' == type ) {
753
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'block' );
754
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'block' );
755
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'block' );
 
756
  }
757
  $( document ).trigger( 'gadsenseUnitChanged' );
758
  window.gadsenseFormatAdContent();
@@ -762,7 +875,7 @@
762
 
763
  advads_update_adsense_type();
764
 
765
- if ( 'undefined' != typeof AdsenseMAPI ) {
766
  MapiMayBeSaveAdCode();
767
  }
768
 
9
  ;
10
  (function ($) {
11
  "use strict";
12
+ var parseCodeBtnClicked = false;
13
  $( document ).on( 'click', '.prevent-default', function( ev ) { ev.preventDefault() } );
14
+
15
+ function reloadAdparameter( connect ) {
16
+
17
+ $( '#advanced-ad-type input' ).prop( 'disabled', true );
18
+ $( '#advanced-ads-tinymce-wrapper' ).hide();
19
+ $( '#advanced-ads-ad-parameters' ).html( '<span class="spinner advads-ad-parameters-spinner advads-spinner"></span>' );
20
+
21
+ $.ajax({
22
+ type: 'POST',
23
+ url: ajaxurl,
24
+ data: {
25
+ 'action': 'load_ad_parameters_metabox',
26
+ 'ad_type': 'adsense',
27
+ 'ad_id': $( '#post_ID' ).val(),
28
+ 'nonce': advadsglobal.ajax_nonce
29
+ },
30
+ success: function (data, textStatus, XMLHttpRequest) {
31
+ // toggle main content field
32
+ if (data) {
33
+ $( '#advanced-ads-ad-parameters' ).html( data ).trigger( 'paramloaded' );
34
+ $( '#mapi-open-selector a' ).trigger( 'click' );
35
+ advads_maybe_textarea_to_tinymce( 'adsense' );
36
+ }
37
+ },
38
+ error: function (MLHttpRequest, textStatus, errorThrown) {
39
+ $( '#advanced-ads-ad-parameters' ).html( errorThrown );
40
+ }
41
+ }).always( function ( MLHttpRequest, textStatus, errorThrown ) {
42
+ $( '#advanced-ad-type input').prop( 'disabled', false );
43
+ connect.hide();
44
+ });
45
+
46
+ }
47
+
48
+ $( document ).on( 'click', '#mapi-connect-adsense', function ( ev ) {
49
+ ev.preventDefault();
50
+ if ( 'undefined' != typeof window.advadsMapiConnect ) {
51
+ window.advadsMapiConnect( 'confirm-code', {onSuccess:reloadAdparameter} );
52
+ }
53
+ } );
54
+
55
+ function getSlotAndType_jq() {
56
+ var $div1 = $( '#unit-code' ).closest( 'div' );
57
+ var $label1 = $div1.prev();
58
+ var $hr1 = $div1.next();
59
+ var $label2 = $hr1.next();
60
+ var $div2 = $label2.next();
61
+
62
+ var $elems = $div1.add( $label1 ).add( $hr1 ).add( $label2 ).add( $div2 );
63
+ return $elems;
64
+ }
65
+
66
  function resizeAdListHeader() {
67
  var th = $( '#mapi-list-header span' );
68
  var tb = $( '#mapi-table-wrap tbody tr' );
88
  function MapiMayBeSaveAdCode(){
89
 
90
  // MAPI not set up
91
+ if ( 'undefined' == typeof AdsenseMAPI.hasToken ) return;
92
 
93
  var slotId = $( '#unit-code' ).val();
94
  if ( !slotId ) return;
193
  }
194
 
195
  function MapiSaveAdCode( code, slot ) {
196
+ if ( 'undefined' != typeof AdsenseMAPI.hasToken && 'undefined' == typeof AdsenseMAPI.codes[ 'ca-' + AdsenseMAPI.pubId + ':' + slot ] ) {
197
  AdsenseMAPI.codes['ca-' + AdsenseMAPI.pubId + ':' + slot] = code;
198
  $( '#mapi-loading-overlay' ).css( 'display', 'block' );
199
  $.ajax({
238
  display: 'none',
239
  height: 'auto',
240
  });
241
+ var SNT = getSlotAndType_jq();
242
+ SNT.css( 'display', 'block' );
243
  }
244
  );
245
  }, 80);
246
 
247
  }
248
 
249
+ function emptyMapiSelector( msg ) {
250
+ var nag = '<div class="notice notice-error" style="font-size:1.1em;padding:.6em 1em;font-weight:bold;">' + msg + '</div>';
251
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
252
+ $( '#mapi-wrap' ).html( $( nag ) );
253
+ }
254
 
255
  /**
256
  * Show / hide position warning.
279
  $( '.advads-adsense-code' ).show();
280
  $( '#mapi-open-selector' ).css( 'display', 'inline' );
281
  $( '#mapi-wrap' ).css( 'display', 'none' );
282
+ var SNT = getSlotAndType_jq();
283
+ SNT.css( 'display', 'none' );
284
  $( this ).hide();
285
  })
286
 
287
+ $( document ).on( 'click', '.advads-adsense-close-code', function( ev ) {
288
+ ev.preventDefault();
289
+ $( '.advads-adsense-content' ).val( '' );
290
+ $( '.advads-adsense-code' ).hide();
291
+ $( '.advads-adsense-show-code' ).show();
292
+ var SNT = getSlotAndType_jq();
293
+ SNT.css( 'display', 'block' );
294
+ } );
295
+
296
  $( document ).on('click', '.advads-adsense-submit-code', function(ev){
297
  ev.preventDefault();
298
  parseCodeBtnClicked = true;
316
  }
317
  } else {
318
  if ( 'post-new.php' == gadsenseData.pagenow || ( 'draft' == AdsenseMAPI.adStatus && ! $( '#advads-ad-content-adsense' ).val() ) ) {
 
 
319
  $( '#mapi-open-selector a' ).trigger( 'click' );
 
 
 
320
  }
321
  }
322
  }
329
  } else {
330
  getRemoteCode( slotID );
331
  }
 
 
 
 
 
 
 
 
332
  }
333
 
334
  $( document ).on('change', '#unit-type, #unit-code', function (ev) {
394
 
395
  } else {
396
  if ( 'undefined' != typeof response.raw ) {
397
+ $( '#remote-ad-code-msg' ).html( response.raw );
398
  } else if( 'undefined' != typeof response.msg ) {
399
+ if ( 'undefined' != typeof response.reload ) {
400
+ emptyMapiSelector( response.msg );
401
+ } else {
402
+ if ( 'doesNotSupportAdUnitType' == response.msg ) {
403
+ unitIsNotSupported( slotID );
404
+ } else {
405
+ $( '#remote-ad-code-msg' ).html( response.msg );
406
+ }
407
  }
408
  }
409
  }
602
  case 'unknownAd' :
603
  // Not recognized ad code
604
  if ( parseCodeBtnClicked && 'post-new.php' == gadsenseData.pagenow ) {
605
+ // do not show if just after switching to AdSense ad type on ad creation
606
  $( '#pastecode-msg' ).append( $( '<p />' ).css( 'color', 'red' ).html( gadsenseData.msg.unknownAd ) );
607
  }
608
  break;
615
  }
616
  $( '.advads-adsense-code' ).hide();
617
  $( '.advads-adsense-show-code' ).show();
618
+ var SNT = getSlotAndType_jq();
619
+ SNT.css( 'display', 'block' );
620
  }
621
  }
622
 
668
  $( '#advanced-ads-ad-parameters-size input[name="advanced_ad[height]"]' ).val( '' );
669
  }
670
  var storedPubId = gadsenseData.pubId;
671
+
672
  if ( '' !== storedPubId && theAd.pubId != storedPubId && '' != theAd.slotId ) {
673
  $( '#adsense-ad-param-error' ).text( gadsenseData.msg.pubIdMismatch );
674
  } else {
685
  window.gadsenseFormatAdContent = function () {
686
  var slotId = $( '#ad-parameters-box #unit-code' ).val();
687
  var unitType = $( '#ad-parameters-box #unit-type' ).val();
688
+ var publisherId = $( '#advads-adsense-pub-id' ).val() ? $( '#advads-adsense-pub-id' ).val() : gadsenseData.pubId;
689
  var adContent = {
690
  slotId: slotId,
691
  unitType: unitType,
692
+ pubId: publisherId,
693
  };
694
  if ('responsive' == unitType) {
695
  var resize = $( '#ad-parameters-box #ad-resize-type' ).val();
727
  tbody.find( 'tr i[data-slotid="ca-' + pubId + ':' + slotId + '"]' ).parents( 'tr' ).addClass( 'selected' );
728
  }
729
  }
730
+
731
+ var SNT = getSlotAndType_jq();
732
+ SNT.css( 'display', 'none' );
733
+
734
  $( '#mapi-wrap' ).css( 'display', 'block' );
735
  if ( $( '#mapi-no-ad-units-found' ).length ) {
736
  $( '#mapi-no-ad-units-found' ).trigger( 'click' );
742
  $( document ).on( 'click', '#mapi-close-selector', function(){
743
  $( '#mapi-open-selector,.advads-adsense-show-code' ).css( 'display', 'inline' );
744
  $( '#mapi-wrap' ).css( 'display', 'none' );
745
+
746
+ var SNT = getSlotAndType_jq();
747
+ SNT.css( 'display', 'block' );
748
+
749
  } );
750
 
751
+ function updateAdList() {
752
+
753
+ $( '#mapi-loading-overlay' ).css( 'display', 'block' );
754
+
755
+ $.ajax({
756
+ type: 'post',
757
+ url: ajaxurl,
758
+ data: {
759
+ nonce: AdsenseMAPI.nonce,
760
+ action: 'advads_gadsense_mapi_get_adUnits',
761
+ account: gadsenseData.pubId,
762
+ },
763
+ success: function(response,status,XHR){
764
+ if ( 'undefined' != typeof response.html ) {
765
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
766
+ $( '#mapi-wrap' ).replaceWith( $( response.html ) );
767
+ $( '#mapi-open-selector a' ).trigger( 'click' );
768
+ } else if ( 'undefined' != typeof response.msg ) {
769
+ emptyMapiSelector( response.msg );
770
+ }
771
+ },
772
+ error: function(request,status,err){
773
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
774
+ },
775
+ });
776
+
777
+ }
778
+
779
+ function toggleIdleAds( hide ) {
780
+ if ( 'undefined' == typeof hide ) {
781
+ hide = true;
782
+ }
783
+ $( '#mapi-loading-overlay' ).css( 'display', 'block' );
784
+
785
+ $.ajax({
786
+ type: 'post',
787
+ url: ajaxurl,
788
+ data: {
789
+ nonce: AdsenseMAPI.nonce,
790
+ action: 'advads-mapi-idle-ads',
791
+ hide: hide? 1 : 0,
792
+ },
793
+ success: function(response,status,XHR){
794
+ if ( 'undefined' != typeof response.html ) {
795
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
796
+ $( '#mapi-wrap' ).replaceWith( $( response.html ) );
797
+ $( '#mapi-open-selector a' ).trigger( 'click' );
798
+ } else if ( 'undefined' != typeof response.msg ) {
799
+ emptyMapiSelector( response.msg );
800
+ }
801
+ },
802
+ error: function(request,status,err){
803
+ $( '#mapi-loading-overlay' ).css( 'display', 'none' );
804
+ },
805
+ });
806
+
807
+ }
808
+
809
+ $( document ).on( 'click', '.mapiaction', function( ev ) {
810
+ var action = $( this ).attr( 'data-mapiaction' );
811
+ switch ( action ) {
812
+ case 'updateList':
813
+ updateAdList();
814
+ break;
815
+ case 'getCode':
816
+ if ( $( this ).hasClass( 'disabled' ) ) {
817
+ break;
818
+ }
819
+ var slotID = $( this ).attr( 'data-slotid' );
820
+ getAdCode( slotID );
821
+ break;
822
+ case 'updateCode':
823
+ var slotID = $( this ).attr( 'data-slotid' );
824
+ getRemoteCode( slotID );
825
+ break;
826
+ case 'showidle':
827
+ toggleIdleAds( false );
828
+ break;
829
+ case 'hideidle':
830
+ toggleIdleAds( true );
831
+ break;
832
+ default:
833
+ }
834
+ } );
835
 
836
  function advads_update_adsense_type(){
837
  var type = $( '#unit-type' ).val();
840
  $( '.advads-adsense-layout-key' ).hide();
841
  $( '.advads-adsense-layout-key' ).next('div').hide();
842
  $( '.advads-ad-notice-in-feed-add-on' ).hide();
 
843
  if ( 'responsive' == type || 'link-responsive' == type || 'matched-content' == type ) {
844
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
845
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
846
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
847
+ $( '.clearfix-before' ).show();
848
  } else if ( 'in-feed' == type ) {
849
  $( '.advads-adsense-layout' ).css( 'display', 'block' );
850
  $( '.advads-adsense-layout' ).next('div').css( 'display', 'block' );
855
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
856
  // show add-on notice
857
  $( '.advads-ad-notice-in-feed-add-on' ).show();
858
+ $( '.clearfix-before' ).show();
859
  } else if ( 'in-article' == type ) {
860
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'none' );
861
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'none' );
862
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'none' );
863
+ $( '.clearfix-before' ).show();
864
  } else if ( 'normal' == type || 'link' == type ) {
865
  $( '#advanced-ads-ad-parameters-size' ).css( 'display', 'block' );
866
  $( '#advanced-ads-ad-parameters-size' ).prev('.label').css( 'display', 'block' );
867
  $( '#advanced-ads-ad-parameters-size' ).next('.hr').css( 'display', 'block' );
868
+ $( '.clearfix-before' ).hide();
869
  }
870
  $( document ).trigger( 'gadsenseUnitChanged' );
871
  window.gadsenseFormatAdContent();
875
 
876
  advads_update_adsense_type();
877
 
878
+ if ( 'undefined' != typeof AdsenseMAPI.hasToken ) {
879
  MapiMayBeSaveAdCode();
880
  }
881
 
modules/gadsense/admin/views/adsense-account.php CHANGED
@@ -2,9 +2,10 @@
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();
@@ -12,12 +13,6 @@ 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 ) ) ) {
@@ -26,7 +21,72 @@ if ( $use_user_app && !( ( defined( 'ADVANCED_ADS_MAPI_CID' ) && '' != ADVANCED_
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 ) : ?>
@@ -38,7 +98,11 @@ $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
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;"' ?>>
@@ -95,88 +159,79 @@ $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
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 . 'adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-manual-check' ); ?></p>
 
 
 
 
 
 
102
  <?php endif; ?>
103
  <?php if ( ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
104
  <p class="advads-error-message"><?php _e( 'Can not connect AdSense account. PHP version is too low.', 'advanced-ads' ) ?></p>
105
  <?php endif; ?>
 
 
 
 
 
 
 
106
  <script type="text/javascript">
107
- var AdsenseMAPI = {
108
- nonce: '<?php echo $nonce ?>',
109
- oAuth2: '<?php echo $auth_url ?>',
110
- };
 
111
  </script>
112
- <div id="gadsense-modal">
113
- <div id="gadsense-modal-outer">
114
- <div id="gadsense-modal-inner">
115
- <div id="gadsense-modal-content">
116
- <div id="gadsense-modal-content-inner">
117
- <i class="dashicons dashicons-dismiss"></i>
118
- <label style="font-size:1.1em;font-weight:600;margin-bottom:.3em;display:block;"><?php _e( 'Please enter the confirmation code.', 'advanced-ads' ) ?></label>
119
- <input type="text" class="widefat" id="mapi-code" value="" />
120
- <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>
121
- <p class="submit">
122
- <button id="mapi-confirm-code" class="button-primary preventDefault"><?php _e( 'Submit code', 'advanced-ads' ) ?></button>
123
- </p>
124
- <div id="gadsense-overlay">
125
- <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:3em" />
126
- </div>
127
- </div>
128
- </div>
129
- </div>
130
- </div>
131
- </div>
132
  <style type="text/css">
133
- #gadsense-overlay {
134
- display:none;
135
- background-color:rgba(255,255,255,.5);
136
- position:absolute;
137
- width: 100%;
138
- height: 100%;
139
- top: 0;
140
- left: 0;
141
- text-align:center;
142
- }
143
- #gadsense-modal {
144
- display: none;
145
- background-color: rgba(0,0,0,.5);
146
- position:fixed;
147
- top:0;
148
- left:0;
149
- right:0;
150
- bottom:0;
151
- }
152
- #gadsense-modal-outer {
153
- position: relative;
154
- width: 60%;
155
- height: 100%;
156
- margin-left: 20%;
157
- }
158
- #gadsense-modal-inner {
159
- display: table;
160
- width: 100%;
161
- height: 100%;
162
- }
163
- #gadsense-modal-content {
164
- display: table-cell;
165
- vertical-align: middle;
166
- }
167
- #gadsense-modal-content-inner {
168
- padding: 1em;
169
- background-color: #f0f0f0;
170
- position: relative;
171
- border: 3px solid #808b94;
172
- }
173
- #gadsense-modal-content-inner .dashicons-dismiss {
174
- background-color: #fff;
175
- border-radius: 100%;
176
- cursor: pointer;
177
- top: -.5em;
178
- right: -.5em;
179
- position: absolute;
180
- z-index: 2;
181
- }
182
- </style>
2
  $MAPI = Advanced_Ads_AdSense_MAPI::get_instance();
3
  $options = $this->data->get_options();
4
  $adsense_id = $this->data->get_adsense_id();
 
5
  $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
6
 
7
+ $mapi_account_details = false;
8
+
9
  $CID = Advanced_Ads_AdSense_MAPI::CID;
10
 
11
  $use_user_app = Advanced_Ads_AdSense_MAPI::use_user_app();
13
  $CID = ADVANCED_ADS_MAPI_CID;
14
  }
15
 
 
 
 
 
 
 
16
  $can_connect = true;
17
 
18
  if ( $use_user_app && !( ( defined( 'ADVANCED_ADS_MAPI_CID' ) && '' != ADVANCED_ADS_MAPI_CID ) && ( defined( 'ADVANCED_ADS_MAPI_CIS' ) && '' != ADVANCED_ADS_MAPI_CIS ) ) ) {
21
 
22
  $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
23
 
24
+ if ( $has_token && isset( $mapi_options['accounts'][ $adsense_id ]['details'] ) ) {
25
+ $mapi_account_details = $mapi_options['accounts'][ $adsense_id ]['details'];
26
+ }
27
+
28
+ $alerts = Advanced_Ads_AdSense_MAPI::get_stored_account_alerts( $adsense_id );
29
+ $alerts_heading = __( 'AdSense warnings', 'advanced-ads' );
30
+ $alerts_dismiss = __( 'dismiss', 'advanced-ads' );
31
+
32
+ $connection_error_messages = Advanced_Ads_AdSense_MAPI::get_connect_error_messages();
33
+
34
+ $alerts_advads_messages = array(
35
+ 'ALERT_TYPE_ADS_TXT_UNAUTHORIZED' => __( 'One of your sites is missing the AdSense publisher ID in the ads.txt file.', 'advanced-ads' ),
36
+ );
37
+
38
+ ob_start();
39
+
40
+ echo '<p style="font-weight:normal">';
41
+ printf(
42
+ __( 'Learn more about AdSense account issues <a href="%s" target="_blank">here</a>', 'advanced-ads' ),
43
+ ADVADS_URL . 'adsense-errors/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-error'
44
+ );
45
+ echo '</p>';
46
+
47
+ $adsense_error_page_link = ob_get_clean();
48
+
49
+ ?>
50
+ <div id="mapi-account-alerts" data-heading="<?php echo esc_attr( $alerts_heading ); ?>" data-dismiss="<?php echo esc_attr( $alerts_dismiss ); ?>">
51
+ <?php if ( is_array( $alerts ) && isset( $alerts['items'] ) && is_array( $alerts['items'] ) && $alerts['items'] ) : ?>
52
+ <p><?php echo esc_html( $alerts_heading ); ?></p>
53
+ <ul>
54
+ <?php foreach( $alerts['items'] as $alert_id => $alert ) : ?>
55
+ <?php if ( isset( $alerts_advads_messages[ $alert['id'] ] ) ) : ?>
56
+ <li><?php echo esc_html( $alerts_advads_messages[ $alert['id'] ] ); ?>&nbsp;<a href="#" class="mapi-dismiss-alert" data-id="<?php echo esc_attr( $alert_id ); ?>"><?php echo esc_html( $alerts_dismiss ); ?></a></li>
57
+ <?php else : ?>
58
+ <li><?php echo esc_html( $alert['message'] ); ?>&nbsp;<a href="#" class="mapi-dismiss-alert" data-id="<?php echo esc_attr( $alert_id ); ?>"><?php echo esc_html( $alerts_dismiss ); ?></a></li>
59
+ <?php endif; ?>
60
+ <?php endforeach; ?>
61
+ </ul>
62
+ <?php echo $adsense_error_page_link; ?>
63
+ <?php endif; ?>
64
+ </div>
65
+ <div id="mapi-connect-errors">
66
+ <?php if ( !empty( $mapi_options['connect_error'] ) ) {
67
+
68
+ echo '<p>';
69
+ _e( 'Last AdSense account connection attempt failed.', 'advanced-ads' );
70
+
71
+ if ( isset( $connection_error_messages[ $mapi_options['connect_error']['reason'] ] ) ) {
72
+ echo ' ' . $connection_error_messages[ $mapi_options['connect_error']['reason'] ];
73
+ } else {
74
+ echo ' ' . $connection_error_messages[ $mapi_options['connect_error']['message'] ];
75
+ }
76
+ echo '<i id="dissmiss-connect-error" class="dashicons dashicons-dismiss align';
77
+ echo is_rtl()? 'left' : 'right';
78
+ echo '" title=" ' . esc_attr( __( 'dismiss', 'advanced-ads' ) ) . '"></i>';
79
+ echo '</p>';
80
+
81
+ echo '<p>';
82
+ printf(
83
+ __( 'Learn more about AdSense account issues <a href="%s" target="_blank">here</a>', 'advanced-ads' ),
84
+ ADVADS_URL . 'adsense-errors/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-error'
85
+ );
86
+ echo '</p>';
87
+ }
88
+ ?>
89
+ </div>
90
  <div id="full-adsense-settings-div" <?php if ( empty( $adsense_id ) ) echo 'style="display:none"' ?>>
91
  <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; ?>" />
92
  <?php if ( !empty( $adsense_id ) && !$has_token ) : ?>
98
  <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:40vh" />
99
  </div>
100
  <?php endif; ?>
101
+ <?php if ( $mapi_account_details ) : ?>
102
+ <p class="description"><?php esc_html_e( 'Account holder name', 'advanced-ads' ); echo ': <strong>' . esc_html( $mapi_account_details['name'] ) . '</strong>'; ?></p>
103
+ <?php else : ?>
104
+ <p class="description"><?php _e( 'Your AdSense Publisher ID <em>(pub-xxxxxxxxxxxxxx)</em>', 'advanced-ads' ) ?></p>
105
+ <?php endif; ?>
106
  </div>
107
  <?php if ( empty( $adsense_id ) ) : ?>
108
  <div id="auto-adsense-settings-div" <?php if ( !empty( $adsense_id ) ) echo 'style="display:none;"' ?>>
159
  #auto-adsense-settings-div .widget-col { float: none; margin-right: 0; }
160
  #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; }
161
  #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; }
162
+ }
163
  </style>
164
  <?php else : ?>
165
+ <p><?php // translators: %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag
166
+ printf(__( 'Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s.', 'advanced-ads' ),
167
+ '<a href="' . ADVADS_URL . 'adsense-ads/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-manual-check" target="_blank">',
168
+ '</a>',
169
+ '<a href="https://wordpress.org/support/plugin/advanced-ads/#new-post" target="_blank">',
170
+ '</a>'
171
+ ); ?></p>
172
  <?php endif; ?>
173
  <?php if ( ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
174
  <p class="advads-error-message"><?php _e( 'Can not connect AdSense account. PHP version is too low.', 'advanced-ads' ) ?></p>
175
  <?php endif; ?>
176
+ <div id="mapi-alerts-overlay">
177
+ <div style="position:relative;text-align:center;display:table;width:100%;height:100%;">
178
+ <div style="display:table-cell;vertical-align:middle;">
179
+ <img alt="loading" src="<?php echo esc_url( ADVADS_BASE_URL . 'admin/assets/img/loader.gif;' ); ?>" />
180
+ </div>
181
+ </div>
182
+ </div>
183
  <script type="text/javascript">
184
+ if ( 'undefined' == typeof window.AdsenseMAPI ) {
185
+ AdsenseMAPI = {};
186
+ }
187
+ AdsenseMAPI.alertsMsg = <?php echo json_encode( $alerts_advads_messages ) ?>;
188
+ AdsenseMAPI.errorPageLink = '<?php echo $adsense_error_page_link; ?>';
189
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  <style type="text/css">
191
+ #adsense {
192
+ position: relative;
193
+ }
194
+ #mapi-alerts-overlay {
195
+ position:absolute;
196
+ top:0;
197
+ right:0;
198
+ bottom:0;
199
+ left:0;
200
+ background-color: rgb(255, 255, 255, .90);
201
+ display: none;
202
+ }
203
+ #mapi-account-alerts, #mapi-connect-errors {
204
+ background-color: #ffecd1;
205
+ margin-bottom: .5em;
206
+ color: #c52f00;
207
+ }
208
+ #mapi-account-alerts p {
209
+ font-weight: bold;
210
+ padding: .5em
211
+ }
212
+ #mapi-connect-errors p {
213
+ padding: .5em;
214
+ }
215
+ #mapi-connect-errors p span {
216
+ font-weight: bold;
217
+ }
218
+ #mapi-account-alerts ul {
219
+ list-style-type: disc;
220
+ margin: .5em;
221
+ margin-left: 2em;
222
+ padding: .5em;
223
+ }
224
+ #dissmiss-connect-error {
225
+ cursor: pointer;
226
+ }
227
+ #gadsense-overlay {
228
+ display:none;
229
+ background-color:rgba(255,255,255,.5);
230
+ position:absolute;
231
+ width: 100%;
232
+ height: 100%;
233
+ top: 0;
234
+ left: 0;
235
+ text-align:center;
236
+ }
237
+ </style>
 
 
 
modules/gadsense/admin/views/adsense-ad-parameters.php CHANGED
@@ -17,7 +17,7 @@ $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();
@@ -32,51 +32,71 @@ $mapi_ad_codes['length'] = count( $mapi_ad_codes );
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
- unsupportedUnits: <?php echo wp_json_encode( $mapi_options['unsupported_units'] ); ?>,
42
- unsupportedLink: '<?php echo Advanced_Ads_AdSense_MAPI::UNSUPPORTED_TYPE_LINK; ?>',
43
- unsupportedText: '<?php /**
44
- * translators: this is a label for an ad that we can currently not import from the AdSense account
45
- */
46
- esc_html_e( 'unsupported', 'advanced-ads' ); ?>'
47
- };
 
 
 
 
 
 
 
 
 
 
 
48
  </script>
49
  <?php endif; ?>
50
  <input type="hidden" id="advads-ad-content-adsense" name="advanced_ad[content]" value="<?php echo esc_attr( $json_content ); ?>" />
51
  <input type="hidden" name="unit_id" id="unit_id" value="<?php echo esc_attr( $unit_id ); ?>" />
52
- <?php if( empty( $pub_id ) ) :
53
- ?><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' );
54
- ?></a></p><?php
55
- endif;
56
- if ( $use_paste_code ) : ?>
57
  <div class="advads-adsense-code" style="display: none;">
58
  <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>
59
  <textarea rows="10" cols="40" class="advads-adsense-content"></textarea>
60
  <button class="button button-primary advads-adsense-submit-code"><?php _e( 'Get details', 'advanced-ads' ); ?></button>&nbsp;&nbsp;
 
61
  <?php if ( !$has_token ) : ?>
62
  <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>
63
  <?php endif; ?>
64
  <div id="pastecode-msg"></div>
65
  </div>
66
- <?php if ( $has_token && Advanced_Ads_Checks::php_version_minimum() ) require_once GADSENSE_BASE_PATH . 'admin/views/mapi-ad-selector.php'; ?>
 
 
 
67
 
68
  <p>
69
  <span class="advads-adsense-show-code">
70
  <a href="#"><?php _e( 'Insert new AdSense code', 'advanced-ads' ); ?></a>
71
  </span>
72
- <?php if ( $has_token && Advanced_Ads_Checks::php_version_minimum() ) : ?>
73
- <span id="mapi-open-selector">
74
- <?php _e( 'or', 'advanced-ads' ); ?><a href="#" class="prevent-default"><?php _e( 'Get ad code from your linked account', 'advanced-ads' ); ?></a>
75
- </span>
76
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
77
  </p>
78
  <?php if ( $has_token && ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
79
- <p class="advads-error-message"><?php _e( 'Your PHP version is too low to connect an AdSense account', 'advanced-ads' ); ?></p>
80
  <?php endif; ?>
81
 
82
  <?php endif; ?>
@@ -85,9 +105,9 @@ if ( $use_paste_code ) : ?>
85
  <label class="label"><?php _e( 'Ad Slot ID', 'advanced-ads' ); ?></label>
86
  <div>
87
  <input type="text" name="unit-code" id="unit-code" value="<?php echo $unit_code; ?>" />
88
- <input type="hidden" name="advanced_ad[output][adsense-pub-id]" id="advads-adsense-pub-id" value="" />
89
- <?php if( $pub_id ) : ?>
90
- <?php printf(__( 'Publisher ID: %s', 'advanced-ads' ), $pub_id ); ?>
91
  <?php endif; ?>
92
  <p id="advads-pubid-in-slot" class="advads-error-message description"
93
  <?php echo ! ( 0 === strpos( $pub_id, 'pub-' ) && false !== strpos( $unit_code, substr( $pub_id, 4 ) ) ) ? 'style="display:none"' : ''; ?>
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 = trim( $db->get_adsense_id() );
21
  $sizing_array = $db->get_responsive_sizing();
22
 
23
  $gadsense_options = $db->get_options();
32
  ?>
33
  <?php if ( $has_token ) : ?>
34
  <script type="text/javascript">
35
+ if ( 'undefined' == typeof window.AdsenseMAPI ) {
36
+ var AdsenseMAPI = {};
37
+ }
38
+ AdsenseMAPI.hasToken = true;
39
+ AdsenseMAPI.nonce = '<?php echo $mapi_nonce ?>';
40
+ AdsenseMAPI.codes = <?php echo json_encode( $mapi_ad_codes ) ?>;
41
+ AdsenseMAPI.quota = <?php echo json_encode( $quota ) ?>;
42
+ AdsenseMAPI.pubId = '<?php echo $pub_id ?>';
43
+ AdsenseMAPI.adStatus = '<?php echo $ad->status ?>';
44
+ AdsenseMAPI.unsupportedUnits = <?php echo wp_json_encode( $mapi_options['unsupported_units'] ); ?>;
45
+ AdsenseMAPI.unsupportedLink = '<?php echo Advanced_Ads_AdSense_MAPI::UNSUPPORTED_TYPE_LINK; ?>';
46
+ AdsenseMAPI.unsupportedText = '<?php /**
47
+ * translators: this is a label for an ad that we can currently not import from the AdSense account
48
+ */
49
+ esc_html_e( 'unsupported', 'advanced-ads' ); ?>';
50
+
51
+ if ( 'undefined' == typeof gadsenseData ) {
52
+ window.gadsenseData = {};
53
+ }
54
+ gadsenseData['pubId'] = '<?php echo $adsense_id; ?>';
55
+ gadsenseData['msg'] = {
56
+ unknownAd : '<?php esc_attr_e( "The ad details couldn't be retrieved from the ad code", 'advanced-ads' ); ?>',
57
+ pubIdMismatch: '<?php esc_attr_e( 'Warning : The AdSense account from this code does not match the one set in the Advanced Ads options.', 'advanced-ads' ); ?>',
58
+ };
59
  </script>
60
  <?php endif; ?>
61
  <input type="hidden" id="advads-ad-content-adsense" name="advanced_ad[content]" value="<?php echo esc_attr( $json_content ); ?>" />
62
  <input type="hidden" name="unit_id" id="unit_id" value="<?php echo esc_attr( $unit_id ); ?>" />
63
+ <?php if ( $use_paste_code ) : ?>
 
 
 
 
64
  <div class="advads-adsense-code" style="display: none;">
65
  <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>
66
  <textarea rows="10" cols="40" class="advads-adsense-content"></textarea>
67
  <button class="button button-primary advads-adsense-submit-code"><?php _e( 'Get details', 'advanced-ads' ); ?></button>&nbsp;&nbsp;
68
+ <button class="button button-secondary advads-adsense-close-code"><?php _e( 'cancel', 'advanced-ads' ); ?></button>&nbsp;&nbsp;
69
  <?php if ( !$has_token ) : ?>
70
  <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>
71
  <?php endif; ?>
72
  <div id="pastecode-msg"></div>
73
  </div>
74
+ <?php if ( $has_token && Advanced_Ads_Checks::php_version_minimum() ) {
75
+ Advanced_Ads_AdSense_Admin::get_mapi_ad_selector();
76
+ }
77
+ ?>
78
 
79
  <p>
80
  <span class="advads-adsense-show-code">
81
  <a href="#"><?php _e( 'Insert new AdSense code', 'advanced-ads' ); ?></a>
82
  </span>
83
+ <?php if ( Advanced_Ads_Checks::php_version_minimum() ) : ?>
84
+ <?php if ( $has_token ) : ?>
85
+ <span id="mapi-open-selector">
86
+ <?php _e( 'or', 'advanced-ads' ); ?><a href="#" class="prevent-default"><?php _e( 'Get ad code from your linked account', 'advanced-ads' ); ?></a>
87
+ </span>
88
+ <?php else : ?>
89
+ <?php _e( 'or', 'advanced-ads' ); ?>
90
+ <?php if ( $adsense_id ) : ?>
91
+ <a href="<?php echo admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ?>" style="padding:0 10px;font-weight:bold;"><?php _e( 'Connect to AdSense', 'advanced-ads' ); ?></a>
92
+ <?php else : ?>
93
+ <a id="mapi-connect-adsense" href="#" style="padding:0 10px;font-weight:bold;"><?php _e( 'Connect to AdSense', 'advanced-ads' ); ?></a>
94
+ <?php endif; ?>
95
+ <?php endif; ?>
96
+ <?php endif; ?>
97
  </p>
98
  <?php if ( $has_token && ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
99
+ <p class="advads-error-message"><?php _e( 'Can not connect AdSense account. PHP version is too low.', 'advanced-ads' ); ?></p>
100
  <?php endif; ?>
101
 
102
  <?php endif; ?>
105
  <label class="label"><?php _e( 'Ad Slot ID', 'advanced-ads' ); ?></label>
106
  <div>
107
  <input type="text" name="unit-code" id="unit-code" value="<?php echo $unit_code; ?>" />
108
+ <input type="hidden" name="advanced_ad[output][adsense-pub-id]" id="advads-adsense-pub-id" value="<?php echo esc_attr( $unit_pubid ); ?>" />
109
+ <?php if( $unit_pubid ) : ?>
110
+ <?php printf(__( 'Publisher ID: %s', 'advanced-ads' ), $unit_pubid ); ?>
111
  <?php endif; ?>
112
  <p id="advads-pubid-in-slot" class="advads-error-message description"
113
  <?php echo ! ( 0 === strpos( $pub_id, 'pub-' ) && false !== strpos( $unit_code, substr( $pub_id, 4 ) ) ) ? 'style="display:none"' : ''; ?>
modules/gadsense/admin/views/connect-adsense.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * HTML markup for AdSense connection modal frame.
4
+ *
5
+ * @package Advanced_Ads_Admin
6
+ */
7
+
8
+ $data_obj = Advanced_Ads_AdSense_Data::get_instance();
9
+ $options = $data_obj->get_options();
10
+
11
+ $nonce = wp_create_nonce( 'advads-mapi' );
12
+
13
+ $CID = Advanced_Ads_AdSense_MAPI::CID;
14
+
15
+ $use_user_app = Advanced_Ads_AdSense_MAPI::use_user_app();
16
+ if ( $use_user_app ) {
17
+ $CID = ADVANCED_ADS_MAPI_CID;
18
+ }
19
+
20
+ $connection_error_messages = Advanced_Ads_AdSense_MAPI::get_connect_error_messages();
21
+
22
+ $auth_url = 'https://accounts.google.com/o/oauth2/v2/auth?scope=' .
23
+ urlencode( 'https://www.googleapis.com/auth/adsense.readonly' ) .
24
+ '&client_id=' . $CID .
25
+ '&redirect_uri=' . urlencode( 'urn:ietf:wg:oauth:2.0:oob' ) .
26
+ '&access_type=offline&include_granted_scopes=true&prompt=select_account&response_type=code';
27
+
28
+ ?>
29
+ <div id="gadsense-modal">
30
+ <div id="gadsense-modal-outer">
31
+ <div id="gadsense-modal-inner">
32
+ <div id="gadsense-modal-content">
33
+ <div class="gadsense-modal-content-inner" data-content="confirm-code">
34
+ <i class="dashicons dashicons-dismiss"></i>
35
+ <label style="font-size:1.1em;font-weight:600;margin-bottom:.3em;display:block;"><?php _e( 'Please enter the confirmation code.', 'advanced-ads' ); ?></label>
36
+ <input type="text" class="widefat" id="mapi-code" value="" />
37
+ <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>
38
+ <p class="submit">
39
+ <button id="mapi-confirm-code" class="button-primary preventDefault"><?php _e( 'Submit code', 'advanced-ads' ); ?></button>
40
+ </p>
41
+ <div class="gadsense-overlay">
42
+ <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:3em" />
43
+ </div>
44
+ </div>
45
+ <div class="gadsense-modal-content-inner" data-content="error" style="display:none;">
46
+ <i class="dashicons dashicons-dismiss"></i>
47
+ <h3><?php esc_html_e( 'Cannot access your account information.', 'advanced-ads' ); ?></h3>
48
+ <p class="error-message" style="font-size:1.15em;background-color:#e4e4e4;padding:.3em .8em;"></p>
49
+ <p class="error-description" style="font-size:1.1em;"></p>
50
+ </div>
51
+ <div class="gadsense-modal-content-inner" data-content="account-selector" style="display:none;">
52
+ <i class="dashicons dashicons-dismiss"></i>
53
+ <h3><?php esc_html_e( 'Please select an account', 'advanced-ads' ); ?></h3>
54
+ <p>
55
+ <select id="mapi-select-account">
56
+ </select>
57
+ </p>
58
+ <p><button class="button-primary"><?php esc_html_e( 'Use this account', 'advanced-ads' ); ?></button></p>
59
+ <input type="hidden" class="token-data" value="" />
60
+ <input type="hidden" class="accounts-details" value="" />
61
+ <div class="gadsense-overlay">
62
+ <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:3em" />
63
+ </div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ <script type="text/javascript">
70
+ if ( 'undefined' == typeof window.AdsenseMAPI ) {
71
+ AdsenseMAPI = {};
72
+ }
73
+ AdsenseMAPI.nonce = '<?php echo wp_strip_all_tags( $nonce ); ?>';
74
+ AdsenseMAPI.oAuth2 = '<?php echo wp_strip_all_tags( $auth_url ); ?>';
75
+ AdsenseMAPI.connectErrorMsg = <?php echo wp_json_encode( $connection_error_messages ); ?>;
76
+ </script>
77
+ <style type="text/css">
78
+ .gadsense-overlay {
79
+ display:none;
80
+ background-color:rgba(255,255,255,.5);
81
+ position:absolute;
82
+ width: 100%;
83
+ height: 100%;
84
+ top: 0;
85
+ left: 0;
86
+ text-align:center;
87
+ }
88
+ #gadsense-modal {
89
+ display: none;
90
+ background-color: rgba(0,0,0,.5);
91
+ position:fixed;
92
+ top:0;
93
+ left:0;
94
+ right:0;
95
+ bottom:0;
96
+ }
97
+ #gadsense-modal-outer {
98
+ position: relative;
99
+ width: 60%;
100
+ height: 100%;
101
+ <?php if ( is_rtl() ) : ?>
102
+ margin-right: 20%;
103
+ <?php else : ?>
104
+ margin-left: 20%;
105
+ <?php endif; ?>
106
+ }
107
+ #gadsense-modal-inner {
108
+ display: table;
109
+ width: 100%;
110
+ height: 100%;
111
+ }
112
+ #gadsense-modal-content {
113
+ display: table-cell;
114
+ vertical-align: middle;
115
+ }
116
+ .gadsense-modal-content-inner {
117
+ padding: 1em;
118
+ background-color: #f0f0f0;
119
+ position: relative;
120
+ border: 3px solid #808b94;
121
+ }
122
+ .gadsense-modal-content-inner .dashicons-dismiss {
123
+ background-color: #fff;
124
+ border-radius: 100%;
125
+ cursor: pointer;
126
+ top: -.5em;
127
+ <?php if ( is_rtl() ) : ?>
128
+ left: -.5em;
129
+ <?php else : ?>
130
+ right: -.5em;
131
+ <?php endif; ?>
132
+ position: absolute;
133
+ z-index: 2;
134
+ }
135
+ </style>
modules/gadsense/admin/views/mapi-ad-selector.php CHANGED
@@ -2,18 +2,32 @@
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
  $unsupported_ad_type_link = Advanced_Ads_AdSense_MAPI::UNSUPPORTED_TYPE_LINK;
13
 
14
  ?>
15
  <div id="mapi-wrap">
16
  <button type="button" id="mapi-close-selector" class="notice-dismiss"></button>
 
 
 
 
 
17
  <?php if ( !empty( $ad_units ) ) : ?>
18
  <i id="mapi-update-unit-lists" class="dashicons dashicons-update mapiaction" data-mapiaction="updateList" style="color:#0085ba;cursor:pointer;font-size:20px;" title="<?php
19
  esc_attr_e( 'Update the ad units list', 'advanced-ads' ) ?>"></i>
@@ -22,7 +36,6 @@ $unsupported_ad_type_link = Advanced_Ads_AdSense_MAPI::UNSUPPORTED_TYPE_LINK;
22
  <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:8em;" />
23
  </div>
24
 
25
- <?php if ( $can_connect ) : ?>
26
  <?php if ( !empty( $ad_units ) ) : ?>
27
  <div id="mapi-list-header">
28
  <span><?php echo esc_attr_x( 'Ad unit', 'AdSense ad', 'advanced-ads' ); ?></span>
@@ -91,7 +104,6 @@ $unsupported_ad_type_link = Advanced_Ads_AdSense_MAPI::UNSUPPORTED_TYPE_LINK;
91
  </tbody>
92
  </table>
93
  </div>
94
- <?php endif; ?>
95
 
96
  <p class="advads-error-message" id="remote-ad-code-error" style="display:none;"><strong><?php esc_attr_e( 'Unrecognized ad code', 'advanced-ads' ); ?></strong></p>
97
  <p class="advads-error-message" id="remote-ad-code-msg"></p>
@@ -105,15 +117,15 @@ $unsupported_ad_type_link = Advanced_Ads_AdSense_MAPI::UNSUPPORTED_TYPE_LINK;
105
  <li><?php _e( 'Choose a <em>Normal</em>, <em>Responsive</em> or <em>Link Unit</em> ad from your AdSense account.', 'advanced-ads' ) ?></li>
106
  </ul>
107
  </div>
108
- </div>
109
- <?php if ( 8 < count( $ad_units ) ) : ?>
110
- <style type="text/css">
111
- #mapi-table-wrap {
112
- height: 22.2em;
113
- overflow: auto;
114
- }
115
- #mapi-wrap table {
116
- position: absolute;
117
- }
118
- </style>
119
- <?php endif; ?>
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
+ $ad_units = array();
6
+ if ( isset( $mapi_options['accounts'][$adsense_id]['ad_units'] ) ) {
7
+ $ad_units = $mapi_options['accounts'][$adsense_id]['ad_units'];
8
+ }
9
+ if ( ! isset( $hide_idle_ads ) ) $hide_idle_ads = true;
10
+
11
+ if ( $hide_idle_ads ) {
12
+ $_ads = array();
13
+ foreach( $ad_units as $unit ) {
14
+ if ( 'ACTIVE' === $unit['status'] ) {
15
+ $_ads[ $unit['id'] ] = $unit;
16
+ }
17
+ }
18
+ $ad_units = $_ads;
19
+ }
20
 
21
  $unsupported_ad_type_link = Advanced_Ads_AdSense_MAPI::UNSUPPORTED_TYPE_LINK;
22
 
23
  ?>
24
  <div id="mapi-wrap">
25
  <button type="button" id="mapi-close-selector" class="notice-dismiss"></button>
26
+ <?php if ( $hide_idle_ads ) : ?>
27
+ <i id="mapi-show-idle" title="<?php esc_attr_e( 'Show inactive ads' , 'advanced-ads' ); ?>" class="dashicons dashicons-visibility mapiaction" data-mapiaction="showidle"></i>
28
+ <?php else : ?>
29
+ <i id="mapi-hide-idle" title="<?php esc_attr_e( 'Hide inactive ads' , 'advanced-ads' ); ?>" class="dashicons dashicons-hidden mapiaction" data-mapiaction="hideidle"></i>
30
+ <?php endif; ?>
31
  <?php if ( !empty( $ad_units ) ) : ?>
32
  <i id="mapi-update-unit-lists" class="dashicons dashicons-update mapiaction" data-mapiaction="updateList" style="color:#0085ba;cursor:pointer;font-size:20px;" title="<?php
33
  esc_attr_e( 'Update the ad units list', 'advanced-ads' ) ?>"></i>
36
  <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:8em;" />
37
  </div>
38
 
 
39
  <?php if ( !empty( $ad_units ) ) : ?>
40
  <div id="mapi-list-header">
41
  <span><?php echo esc_attr_x( 'Ad unit', 'AdSense ad', 'advanced-ads' ); ?></span>
104
  </tbody>
105
  </table>
106
  </div>
 
107
 
108
  <p class="advads-error-message" id="remote-ad-code-error" style="display:none;"><strong><?php esc_attr_e( 'Unrecognized ad code', 'advanced-ads' ); ?></strong></p>
109
  <p class="advads-error-message" id="remote-ad-code-msg"></p>
117
  <li><?php _e( 'Choose a <em>Normal</em>, <em>Responsive</em> or <em>Link Unit</em> ad from your AdSense account.', 'advanced-ads' ) ?></li>
118
  </ul>
119
  </div>
120
+ <?php if ( 8 < count( $ad_units ) ) : ?>
121
+ <style type="text/css">
122
+ #mapi-table-wrap {
123
+ height: 22.2em;
124
+ overflow: auto;
125
+ }
126
+ #mapi-wrap table {
127
+ position: absolute;
128
+ }
129
+ </style>
130
+ <?php endif; ?>
131
+ </div>
modules/gadsense/includes/class-ad-type-adsense.php CHANGED
@@ -54,6 +54,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
54
 
55
  $content = (string) ( isset( $ad->content ) ? $ad->content : '' );
56
  $unit_id = '';
 
57
  $unit_code = '';
58
  $unit_type = '';
59
  $unit_width = 0;
@@ -67,7 +68,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
67
  );
68
 
69
  $db = Advanced_Ads_AdSense_Data::get_instance();
70
- $pub_id = trim( $db->get_adsense_id() );
71
 
72
  // check pub_id for errors
73
  $pub_id_errors = false;
@@ -86,6 +87,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
86
  $content->json = $json_content;
87
  $unit_type = $content->unitType;
88
  $unit_code = $content->slotId;
 
89
  $layout = isset( $content->layout ) ? $content->layout : '';
90
  $layout_key = isset( $content->layout_key ) ? $content->layout_key : '';
91
 
@@ -100,8 +102,8 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
100
  $extra_params = apply_filters( 'advanced-ads-gadsense-ad-param-data', $extra_params, $content, $ad );
101
  }
102
  }
103
- if ( ! empty($pub_id) ) {
104
- $unit_id = 'ca-' . $pub_id . ':' . $unit_code;
105
  }
106
  }
107
  }
@@ -155,7 +157,7 @@ class Advanced_Ads_Ad_Type_Adsense extends Advanced_Ads_Ad_Type_Abstract {
155
 
156
  $output = '';
157
  $db = Advanced_Ads_AdSense_Data::get_instance();
158
- $pub_id = $db->get_adsense_id();
159
  $limit_per_page = $db->get_limit_per_page();
160
 
161
  if ( ! isset($content->unitType) || empty($pub_id) ) {
54
 
55
  $content = (string) ( isset( $ad->content ) ? $ad->content : '' );
56
  $unit_id = '';
57
+ $unit_pubid = '';
58
  $unit_code = '';
59
  $unit_type = '';
60
  $unit_width = 0;
68
  );
69
 
70
  $db = Advanced_Ads_AdSense_Data::get_instance();
71
+ $pub_id = trim( $db->get_adsense_id( $ad ) );
72
 
73
  // check pub_id for errors
74
  $pub_id_errors = false;
87
  $content->json = $json_content;
88
  $unit_type = $content->unitType;
89
  $unit_code = $content->slotId;
90
+ $unit_pubid = !empty( $content->pubId ) ? $content->pubId : $pub_id;
91
  $layout = isset( $content->layout ) ? $content->layout : '';
92
  $layout_key = isset( $content->layout_key ) ? $content->layout_key : '';
93
 
102
  $extra_params = apply_filters( 'advanced-ads-gadsense-ad-param-data', $extra_params, $content, $ad );
103
  }
104
  }
105
+ if ( ! empty( $unit_pubid ) ) {
106
+ $unit_id = 'ca-' . $unit_pubid . ':' . $unit_code;
107
  }
108
  }
109
  }
157
 
158
  $output = '';
159
  $db = Advanced_Ads_AdSense_Data::get_instance();
160
+ $pub_id = $db->get_adsense_id( $ad );
161
  $limit_per_page = $db->get_limit_per_page();
162
 
163
  if ( ! isset($content->unitType) || empty($pub_id) ) {
modules/gadsense/includes/class-gadsense-data.php CHANGED
@@ -48,8 +48,16 @@ class Advanced_Ads_AdSense_Data {
48
  return $this->options;
49
  }
50
 
51
- public function get_adsense_id() {
52
- return trim($this->options['adsense-id']);
 
 
 
 
 
 
 
 
53
  }
54
 
55
  public function get_limit_per_page() {
48
  return $this->options;
49
  }
50
 
51
+ public function get_adsense_id( $ad = null ) {
52
+ if ( ! empty( $ad ) ) {
53
+ if ( isset( $ad->is_ad ) && true === $ad->is_ad && 'adsense' === $ad->type ) {
54
+ $ad_content = json_decode( $ad->content );
55
+ if ( $ad_content && isset( $ad_content->pubId ) ) {
56
+ return $ad_content->pubId;
57
+ }
58
+ }
59
+ }
60
+ return trim($this->options['adsense-id']);
61
  }
62
 
63
  public function get_limit_per_page() {
modules/gadsense/includes/class-mapi.php CHANGED
@@ -3,16 +3,20 @@ 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
  const UNSUPPORTED_TYPE_LINK = 'https://wpadvancedads.com/adsense-ad-type-not-available/';
13
 
14
  private static $instance = null;
15
 
 
 
16
  private static $default_options = array();
17
 
18
  private static $empty_account_data = array(
@@ -29,6 +33,8 @@ class Advanced_Ads_AdSense_MAPI {
29
  'token_type' => '',
30
  ),
31
  'ad_units' => array(),
 
 
32
  );
33
 
34
  private function __construct() {
@@ -37,9 +43,17 @@ class Advanced_Ads_AdSense_MAPI {
37
 
38
  add_action( 'wp_ajax_advads_gadsense_mapi_confirm_code', array( $this, 'ajax_confirm_code' ) );
39
  add_action( 'wp_ajax_advads_gadsense_mapi_get_adUnits', array( $this, 'ajax_get_adUnits' ) );
 
 
40
  add_action( 'wp_ajax_advads_mapi_get_adCode', array( $this, 'ajax_get_adCode' ) );
41
  add_action( 'wp_ajax_advads-mapi-reconstructed-code', array( $this, 'ajax_save_reconstructed_code' ) );
42
  add_action( 'wp_ajax_advads-mapi-revoke-token', array( $this, 'ajax_revoke_tokken' ) );
 
 
 
 
 
 
43
 
44
  self::$default_options = array(
45
  'accounts' => array(),
@@ -49,9 +63,35 @@ class Advanced_Ads_AdSense_MAPI {
49
  'count' => self::CALL_PER_24H,
50
  'ts' => 0,
51
  ),
 
52
  );
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * Get available quota and eventual message about remaining call
57
  */
@@ -308,31 +348,50 @@ class Advanced_Ads_AdSense_MAPI {
308
  */
309
  public function get_access_token( $account ) {
310
  $options = self::get_option();
311
- if ( self::use_user_app() ) {
312
- if ( time() > $options['accounts'][ $account ]['user_app']['expires'] ) {
313
- $new_tokens = $this->renew_access_token( $account );
314
- if ( $new_tokens['status'] ) {
315
- return $new_tokens['access_token'];
316
- } else {
317
- // return all error info [arr]
318
- return $new_tokens;
319
- }
320
- } else {
321
- return $options['accounts'][ $account ]['user_app']['access_token'];
322
- }
323
- } else {
324
- if ( time() > $options['accounts'][ $account ]['default_app']['expires'] ) {
325
- $new_tokens = $this->renew_access_token( $account );
326
- if ( $new_tokens['status'] ) {
327
- return $new_tokens['access_token'];
328
- } else {
329
- // return all error info [arr]
330
- return $new_tokens;
331
- }
332
- } else {
333
- return $options['accounts'][ $account ]['default_app']['access_token'];
334
- }
335
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  }
337
 
338
  /**
@@ -406,6 +465,7 @@ class Advanced_Ads_AdSense_MAPI {
406
  if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
407
  $adsense_id = stripslashes( $_POST['adsenseId'] );
408
  $options = self::get_option();
 
409
  if ( self::use_user_app() ) {
410
  $token = $options['accounts'][ $adsense_id ]['user_app']['refresh_token'];
411
  } else {
@@ -509,6 +569,141 @@ class Advanced_Ads_AdSense_MAPI {
509
  die;
510
  }
511
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  /**
513
  * 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
514
  */
@@ -518,13 +713,12 @@ class Advanced_Ads_AdSense_MAPI {
518
  $account = stripslashes( $_POST['account'] );
519
  $units = $this->get_ad_units( $account );
520
 
521
- if ( true == $units ) {
522
  $options = self::get_option();
523
  $ad_units = $options['accounts'][ $account ]['ad_units'];
 
524
  ob_start();
525
-
526
- include_once ADVADS_BASE_PATH . '/modules/gadsense/admin/views/mapi-ad-selector.php';
527
-
528
  $ad_selector = ob_get_clean();
529
 
530
  $response = array(
@@ -553,6 +747,156 @@ class Advanced_Ads_AdSense_MAPI {
553
  die;
554
  }
555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
  /**
557
  * Submit Google API confirmation code. Save the token and update ad client list.
558
  */
@@ -562,15 +906,12 @@ class Advanced_Ads_AdSense_MAPI {
562
  $code = urldecode( $_POST['code'] );
563
  $cid = self::CID;
564
  $cs = self::CS;
565
-
566
  $use_user_app = self::use_user_app();
567
 
568
- $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
569
-
570
  if ( $use_user_app ) {
571
- $_options = $gadsense_data->get_options();
572
- $cid = ADVANCED_ADS_MAPI_CID;
573
- $cs = ADVANCED_ADS_MAPI_CIS;
574
  }
575
 
576
  $code_url = 'https://www.googleapis.com/oauth2/v4/token';
@@ -600,57 +941,18 @@ class Advanced_Ads_AdSense_MAPI {
600
  );
601
  } else {
602
  $token = json_decode( $response['body'], true );
603
- $adsense_id = $gadsense_data->get_adsense_id();
604
-
605
  if ( null !== $token && isset( $token['refresh_token'] ) ) {
 
 
 
 
 
 
 
 
 
606
 
607
- if ( ! empty( $adsense_id ) ) {
608
- self::save_token_from_code( $token, $adsense_id );
609
-
610
- $gadsense_options = $gadsense_data->get_options();
611
- $gadsense_options['page-level-enabled'] = isset( $_POST['autoads'] );
612
- update_option( GADSENSE_OPT_NAME, $gadsense_options );
613
-
614
- header( 'Content-Type: application/json' );
615
- echo json_encode( array( 'status' => true ) );
616
-
617
- } else {
618
- /**
619
- * get AdSense ID first
620
- */
621
- $url = 'https://www.googleapis.com/adsense/v1.4/accounts';
622
-
623
- $headers = array( 'Authorization' => 'Bearer ' . $token['access_token'] );
624
- $response = wp_remote_get( $url, array( 'headers' => $headers ) );
625
-
626
- if ( is_wp_error( $response ) ) {
627
-
628
- header( 'Content-Type: application/json' );
629
- echo json_encode(
630
- array(
631
- 'status' => false,
632
- 'error_msg' => $response->get_error_message(),
633
- )
634
- );
635
-
636
- } else {
637
-
638
- $accounts = json_decode( $response['body'], true );
639
- $adsense_id = $accounts['items'][0]['id'];
640
-
641
- $gadsense_options = $gadsense_data->get_options();
642
- $gadsense_options['adsense-id'] = $adsense_id;
643
-
644
- $gadsense_options['page-level-enabled'] = isset( $_POST['autoads'] );
645
-
646
- update_option( GADSENSE_OPT_NAME, $gadsense_options );
647
- self::save_token_from_code( $token, $adsense_id );
648
-
649
- header( 'Content-Type: application/json' );
650
- echo json_encode( array( 'status' => true ) );
651
-
652
- }
653
- }
654
  } else {
655
  header( 'Content-Type: application/json' );
656
  echo json_encode(
@@ -674,6 +976,61 @@ class Advanced_Ads_AdSense_MAPI {
674
  }
675
  }
676
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
677
  /**
678
  * Sort ad units list alphabetically
679
  */
@@ -745,10 +1102,11 @@ class Advanced_Ads_AdSense_MAPI {
745
  /**
746
  * save token obtained from confirmation code
747
  */
748
- public static function save_token_from_code( $token, $adsense_id ) {
 
 
 
749
 
750
- $options = self::get_option();
751
- $expires = time() + absint( $token['expires_in'] );
752
  if ( ! isset( $options['accounts'][ $adsense_id ] ) ) {
753
  $options['accounts'][ $adsense_id ] = self::$empty_account_data;
754
  }
@@ -756,21 +1114,72 @@ class Advanced_Ads_AdSense_MAPI {
756
  $options['accounts'][ $adsense_id ]['user_app'] = array(
757
  'access_token' => $token['access_token'],
758
  'refresh_token' => $token['refresh_token'],
759
- 'expires' => $expires,
760
  'token_type' => $token['token_type'],
761
  );
762
  } else {
763
  $options['accounts'][ $adsense_id ]['default_app'] = array(
764
  'access_token' => $token['access_token'],
765
  'refresh_token' => $token['refresh_token'],
766
- 'expires' => $expires,
767
  'token_type' => $token['token_type'],
768
  );
769
  }
 
770
  update_option( self::OPTNAME, $options );
771
 
 
 
 
 
 
 
772
  }
773
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  /**
775
  * Get the class's option
776
  */
@@ -782,6 +1191,13 @@ class Advanced_Ads_AdSense_MAPI {
782
  return $options + self::$default_options;
783
  }
784
 
 
 
 
 
 
 
 
785
  public static function get_instance() {
786
  if ( null == self::$instance ) {
787
  self::$instance = new self();
3
 
4
  const OPTNAME = 'advanced-ads-adsense-mapi';
5
 
6
+ const ALERTS_URL = 'https://www.googleapis.com/adsense/v1.4/accounts/PUBID/alerts/';
7
+
8
  const CID = '400595147946-alk0j13qk563bg94rd4f3ip2t0b2tr5r.apps.googleusercontent.com';
9
 
10
  const CS = '5jecyWgvCszB8UxSM0oS1W22';
11
 
12
  const CALL_PER_24H = 20;
13
+
14
  const UNSUPPORTED_TYPE_LINK = 'https://wpadvancedads.com/adsense-ad-type-not-available/';
15
 
16
  private static $instance = null;
17
 
18
+ private static $connect_error_messages = array();
19
+
20
  private static $default_options = array();
21
 
22
  private static $empty_account_data = array(
33
  'token_type' => '',
34
  ),
35
  'ad_units' => array(),
36
+ 'details' => array(),
37
+ 'alerts' => array(),
38
  );
39
 
40
  private function __construct() {
43
 
44
  add_action( 'wp_ajax_advads_gadsense_mapi_confirm_code', array( $this, 'ajax_confirm_code' ) );
45
  add_action( 'wp_ajax_advads_gadsense_mapi_get_adUnits', array( $this, 'ajax_get_adUnits' ) );
46
+ add_action( 'wp_ajax_advads_gadsense_mapi_get_details', array( $this, 'ajax_get_account_details' ) );
47
+ add_action( 'wp_ajax_advads_gadsense_mapi_select_account', array( $this, 'ajax_account_selected' ) );
48
  add_action( 'wp_ajax_advads_mapi_get_adCode', array( $this, 'ajax_get_adCode' ) );
49
  add_action( 'wp_ajax_advads-mapi-reconstructed-code', array( $this, 'ajax_save_reconstructed_code' ) );
50
  add_action( 'wp_ajax_advads-mapi-revoke-token', array( $this, 'ajax_revoke_tokken' ) );
51
+ add_action( 'wp_ajax_advads-mapi-get-alerts', array( $this, 'ajax_get_account_alerts' ) );
52
+ add_action( 'wp_ajax_advads-mapi-dismiss-alert', array( $this, 'ajax_dismiss_alert' ) );
53
+ add_action( 'wp_ajax_advads-mapi-dismiss-connect-error', array( $this, 'ajax_dismiss_connect_error' ) );
54
+ add_action( 'wp_ajax_advads-mapi-idle-ads', array( $this, 'ajax_toggle_idle_ads' ) );
55
+
56
+ add_action( 'admin_footer', array( $this, 'admin_footer' ) );
57
 
58
  self::$default_options = array(
59
  'accounts' => array(),
63
  'count' => self::CALL_PER_24H,
64
  'ts' => 0,
65
  ),
66
+ 'connect_error' => array(),
67
  );
68
+
69
+ self::$connect_error_messages = array(
70
+ 'disapprovedAccount' => __( 'Your account was not approved by AdSense.', 'advanced-ads' ),
71
+ 'noAdSenseAccount' => sprintf(
72
+ __( 'Create a new AdSense account %1$shere%2$s.', 'advanced-ads' ),
73
+ '<a href="https://www.google.com/adsense/start/?utm_source=AdvancedAdsPlugIn&utm_medium=partnerships&utm_campaign=AdvancedAdsPartner" target="_blank">',
74
+ '</a>'
75
+ ),
76
+ );
77
+
78
+ add_filter( 'advanced-ads-support-messages', array( 'Advanced_Ads_AdSense_MAPI', 'adsense_warnings_check' ) );
79
  }
80
 
81
+ /**
82
+ * Discard account connection error
83
+ */
84
+ public function ajax_dismiss_connect_error() {
85
+ $nonce = isset( $_GET['nonce'] ) ? $_GET['nonce'] : '';
86
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
87
+ $options = self::get_option();
88
+ $options['connect_error'] = array();
89
+ update_option( self::OPTNAME, $options );
90
+ echo 1;
91
+ }
92
+ die;
93
+ }
94
+
95
  /**
96
  * Get available quota and eventual message about remaining call
97
  */
348
  */
349
  public function get_access_token( $account ) {
350
  $options = self::get_option();
351
+ if ( isset( $options['accounts'][ $account ] ) ) {
352
+ if ( self::use_user_app() ) {
353
+ if ( time() > $options['accounts'][ $account ]['user_app']['expires'] ) {
354
+ $new_tokens = $this->renew_access_token( $account );
355
+ if ( $new_tokens['status'] ) {
356
+ return $new_tokens['access_token'];
357
+ } else {
358
+ // return all error info [arr]
359
+ return $new_tokens;
360
+ }
361
+ } else {
362
+ return $options['accounts'][ $account ]['user_app']['access_token'];
363
+ }
364
+ } else {
365
+ if ( time() > $options['accounts'][ $account ]['default_app']['expires'] ) {
366
+ $new_tokens = $this->renew_access_token( $account );
367
+ if ( $new_tokens['status'] ) {
368
+ return $new_tokens['access_token'];
369
+ } else {
370
+ // return all error info [arr]
371
+ return $new_tokens;
372
+ }
373
+ } else {
374
+ return $options['accounts'][ $account ]['default_app']['access_token'];
375
+ }
376
+ }
377
+ } else {
378
+ // Account does not exists.
379
+ if ( ! empty( $options['accounts'] ) ) {
380
+ // There is another account connected.
381
+ return array(
382
+ 'status' => false,
383
+ 'msg' => sprintf( __( 'It seems that some changes have been made in the Advanced Ads settings. Please refresh this page.', 'advanced-ads' ), $account ),
384
+ 'reload' => true,
385
+ );
386
+ } else {
387
+ // No account at all.
388
+ return array(
389
+ 'status' => false,
390
+ 'msg' => sprintf( __( 'Advanced Ads does not have access to your account (<code>%s</code>) anymore.', 'advanced-ads' ), $account ),
391
+ 'reload' => true,
392
+ );
393
+ }
394
+ }
395
  }
396
 
397
  /**
465
  if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
466
  $adsense_id = stripslashes( $_POST['adsenseId'] );
467
  $options = self::get_option();
468
+
469
  if ( self::use_user_app() ) {
470
  $token = $options['accounts'][ $adsense_id ]['user_app']['refresh_token'];
471
  } else {
569
  die;
570
  }
571
 
572
+ /**
573
+ * Dismiss an account alert
574
+ */
575
+ public function ajax_dismiss_alert() {
576
+ $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
577
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
578
+ $account = stripslashes( $_POST['account'] );
579
+ $id = stripslashes( $_POST['id'] );
580
+ $options = self::get_option();
581
+
582
+ $items = array();
583
+
584
+ // the account exists.
585
+ if ( isset( $options['accounts'][ $account ] ) ) {
586
+ // the alert exists.
587
+ if ( isset( $options['accounts'][ $account ]['alerts']['items'][ $id ] ) ) {
588
+ unset( $options['accounts'][ $account ]['alerts']['items'][ $id ] );
589
+ update_option( self::OPTNAME, $options );
590
+ $items = $options['accounts'][ $account ]['alerts']['items'];
591
+ }
592
+ }
593
+ header( 'Content-Type: application/json' );
594
+ echo json_encode( array(
595
+ 'status' => true,
596
+ 'alerts' => $items,
597
+ 'length' => count( $items ),
598
+ ) );
599
+ }
600
+ die;
601
+ }
602
+
603
+ /**
604
+ * Get / Update the list of alerts on an AdSense account.
605
+ */
606
+ public function ajax_get_account_alerts() {
607
+ $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
608
+ if ( false !== wp_verify_nonce( $nonce, 'mapi-alerts' ) ) {
609
+ $account = stripslashes( $_POST['account'] );
610
+ $options = self::get_option();
611
+
612
+ // the account exists.
613
+ if ( isset( $options['accounts'][ $account ] ) && self::has_token( $account ) ) {
614
+ $access_token = $this->get_access_token( $account );
615
+ $url = str_replace( 'PUBID', $account, self::ALERTS_URL );
616
+
617
+ // the token is valid.
618
+ if ( ! isset( $access_token['msg'] ) ) {
619
+ $headers = array(
620
+ 'Authorization' => 'Bearer ' . $access_token,
621
+ );
622
+ $response = wp_remote_get( $url, array( 'headers' => $headers ) );
623
+
624
+ // the HTTP response is not an error.
625
+ if ( ! is_wp_error( $response ) ) {
626
+ $alerts = json_decode( $response['body'], true );
627
+
628
+ // the response body is valid.
629
+ if ( null !== $alerts || !is_array( $alerts ) || empty( $alerts['kind'] ) ) {
630
+ $items = array();
631
+ if ( isset( $alerts['items'] ) ) {
632
+ foreach ( $alerts['items'] as $item ) {
633
+ // Do not store alerts of type "INFO".
634
+ if ( 0 != strcasecmp( $item['severity'], 'INFO' ) ) {
635
+ $items[ wp_generate_password( 6,false ) ] = $item;
636
+ }
637
+ }
638
+ }
639
+ $alerts_array = array(
640
+ 'items' => $items ,
641
+ 'lastCheck' => time(),
642
+ );
643
+ $options['accounts'][ $account ]['alerts'] = $alerts_array;
644
+ update_option( self::OPTNAME, $options );
645
+ $results = array(
646
+ 'status' => true,
647
+ 'alerts' => $items,
648
+ 'length' => count( $items ),
649
+ );
650
+ header( 'Content-Type:application/json' );
651
+ echo wp_json_encode( $results );
652
+ } else {
653
+ $results = array(
654
+ 'status' => false,
655
+ 'msg' => 'invalid response body while retrieving account alerts',
656
+ );
657
+ header( 'Content-Type:application/json' );
658
+ echo wp_json_encode( $results );
659
+ }
660
+
661
+ } else {
662
+ $results = array(
663
+ 'status' => false,
664
+ 'msg' => 'error while retrieving account alerts',
665
+ 'raw' => $response->get_error_message(),
666
+ );
667
+ header( 'Content-Type:application/json' );
668
+ echo wp_json_encode( $results );
669
+ }
670
+ } else {
671
+ // return the original error info
672
+ return $access_token;
673
+ }
674
+
675
+ } else {
676
+ header( 'Content-Type:application/json' );
677
+ echo wp_json_encode( array( 'status' => false ) );
678
+ }
679
+
680
+ }
681
+ die;
682
+ }
683
+
684
+ /**
685
+ * Show / Hide idle ads on the ad list table.
686
+ */
687
+ public function ajax_toggle_idle_ads() {
688
+ $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
689
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
690
+
691
+ $hide = (bool)$_POST['hide'];
692
+
693
+ ob_start();
694
+ Advanced_Ads_AdSense_Admin::get_mapi_ad_selector( $hide );
695
+ $ad_selector = ob_get_clean();
696
+
697
+ $response = array(
698
+ 'status' => true,
699
+ 'html' => $ad_selector,
700
+ );
701
+ header( 'Content-Type: application/json' );
702
+ echo wp_json_encode( $response );
703
+ }
704
+ die;
705
+ }
706
+
707
  /**
708
  * 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
709
  */
713
  $account = stripslashes( $_POST['account'] );
714
  $units = $this->get_ad_units( $account );
715
 
716
+ if ( true === $units ) {
717
  $options = self::get_option();
718
  $ad_units = $options['accounts'][ $account ]['ad_units'];
719
+
720
  ob_start();
721
+ Advanced_Ads_AdSense_Admin::get_mapi_ad_selector();
 
 
722
  $ad_selector = ob_get_clean();
723
 
724
  $response = array(
747
  die;
748
  }
749
 
750
+ /**
751
+ * Save account and token after account selection MCN.
752
+ */
753
+ public function ajax_account_selected() {
754
+ $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
755
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
756
+ $token_data = wp_unslash( $_POST['token_data'] );
757
+ $account = wp_unslash( $_POST['account'] );
758
+
759
+ if ( $token_data && $account ) {
760
+
761
+ self::save_token_from_data( $token_data, $account, array( 'autoads' => isset( $_POST['autoads'] ) ) );
762
+
763
+ header( 'Content-Type: application/json' );
764
+ echo json_encode(
765
+ array(
766
+ 'status' => true,
767
+ 'adsense_id' => $account['id'],
768
+ )
769
+ );
770
+
771
+ } else {
772
+
773
+ $error = 'Token data missing';
774
+ if ( $token_data ) {
775
+ $error = 'No account provided';
776
+ }
777
+ header( 'Content-Type: application/json' );
778
+ echo json_encode(
779
+ array(
780
+ 'status' => false,
781
+ 'error_msg' => $error,
782
+ )
783
+ );
784
+
785
+ }
786
+ }
787
+ die;
788
+ }
789
+
790
+ /**
791
+ * Get AdSense account details from a new access token.
792
+ */
793
+ public function ajax_get_account_details() {
794
+ $nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
795
+ if ( false !== wp_verify_nonce( $nonce, 'advads-mapi' ) ) {
796
+
797
+ $url = 'https://www.googleapis.com/adsense/v1.4/accounts';
798
+ $token_data = wp_unslash( $_POST['token_data'] );
799
+
800
+ if ( ! is_array( $token_data ) ) {
801
+
802
+ header( 'Content-Type: application/json' );
803
+ echo json_encode(
804
+ array(
805
+ 'status' => false,
806
+ 'error_msg' => 'No token provided. Token data needed to get account details.',
807
+ )
808
+ );
809
+ die;
810
+
811
+ }
812
+
813
+ $headers = array( 'Authorization' => 'Bearer ' . $token_data['access_token'] );
814
+ $response = wp_remote_get( $url, array( 'headers' => $headers ) );
815
+ if ( is_wp_error( $response ) ) {
816
+
817
+ header( 'Content-Type: application/json' );
818
+ echo json_encode(
819
+ array(
820
+ 'status' => false,
821
+ 'error_msg' => $response->get_error_message(),
822
+ )
823
+ );
824
+
825
+ } else {
826
+
827
+ $accounts = json_decode( $response['body'], true );
828
+
829
+ if ( isset( $accounts['items'] ) ) {
830
+ $options = self::get_option();
831
+ $options['connect_error'] = array();
832
+ update_option( self::OPTNAME, $options );
833
+
834
+ if ( 2 > count( $accounts['items'] ) ) {
835
+
836
+ $adsense_id = $accounts['items'][0]['id'];
837
+ self::save_token_from_data( $token_data, $accounts['items'][0], array( 'autoads' => isset( $_POST['autoads'] ) ) );
838
+
839
+ header( 'Content-Type: application/json' );
840
+ echo json_encode(
841
+ array(
842
+ 'status' => true,
843
+ 'adsense_id' => $adsense_id,
844
+ )
845
+ );
846
+
847
+ } else {
848
+ $html = '';
849
+ $details = array();
850
+ foreach ( $accounts['items'] as $item ) {
851
+ $html .= '<option value="' . esc_attr( $item['id'] ) . '">' . $item['name'] . ' [' . $item['id'] . ']</option>';
852
+ $details[ $item['id'] ] = $item;
853
+ }
854
+ header( 'Content-Type: application/json' );
855
+ echo json_encode(
856
+ array(
857
+ 'status' => true,
858
+ 'html' => $html,
859
+ 'details' => $details,
860
+ 'token_data' => $token_data,
861
+ )
862
+ );
863
+
864
+ }
865
+ } else {
866
+ if ( isset( $accounts['error'] ) ) {
867
+
868
+ $msg = __( 'An error occurred while requesting account details.', 'advanced-ads' );
869
+ if ( isset( $accounts['error']['message'] ) ) {
870
+ $msg = $accounts['error']['message'];
871
+ }
872
+
873
+ $options = self::get_option();
874
+ $options['connect_error'] = array(
875
+ 'message' => $msg,
876
+ );
877
+
878
+ if ( isset( $accounts['error']['errors'][0]['reason'] ) ) {
879
+ $options['connect_error']['reason'] = $accounts['error']['errors'][0]['reason'];
880
+ }
881
+
882
+ update_option( self::OPTNAME, $options );
883
+
884
+ header( 'Content-Type: application/json' );
885
+ echo json_encode(
886
+ array(
887
+ 'status' => false,
888
+ 'error_msg' => $msg,
889
+ 'raw' => $accounts['error'],
890
+ )
891
+ );
892
+
893
+ }
894
+ }
895
+ }
896
+ }
897
+ die;
898
+ }
899
+
900
  /**
901
  * Submit Google API confirmation code. Save the token and update ad client list.
902
  */
906
  $code = urldecode( $_POST['code'] );
907
  $cid = self::CID;
908
  $cs = self::CS;
909
+
910
  $use_user_app = self::use_user_app();
911
 
 
 
912
  if ( $use_user_app ) {
913
+ $cid = ADVANCED_ADS_MAPI_CID;
914
+ $cs = ADVANCED_ADS_MAPI_CIS;
 
915
  }
916
 
917
  $code_url = 'https://www.googleapis.com/oauth2/v4/token';
941
  );
942
  } else {
943
  $token = json_decode( $response['body'], true );
944
+
 
945
  if ( null !== $token && isset( $token['refresh_token'] ) ) {
946
+ $expires = time() + absint( $token['expires_in'] );
947
+ $token['expires'] = $expires;
948
+ header( 'Content-Type: application/json' );
949
+ echo json_encode(
950
+ array(
951
+ 'status' => true,
952
+ 'token_data' => $token,
953
+ )
954
+ );
955
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  } else {
957
  header( 'Content-Type: application/json' );
958
  echo json_encode(
976
  }
977
  }
978
 
979
+ /**
980
+ * Print alert data in admin footer
981
+ */
982
+ public function admin_footer() {
983
+ $data = Advanced_Ads_AdSense_Data::get_instance();
984
+ $adsense_id = $data->get_adsense_id();
985
+ $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
986
+ $alerts = self::get_stored_account_alerts( $adsense_id );
987
+ $refresh_alerts = false;
988
+
989
+ // default value, never checked for alerts.
990
+ if ( array() === $alerts && $has_token ) {
991
+ $refresh_alerts = true;
992
+ }
993
+ if ( $has_token && is_array( $alerts ) && isset( $alerts['lastCheck'] ) ) {
994
+ // check weekly for alerts.
995
+ if ( time() > absint( $alerts['lastCheck'] ) + 3600 *24 * 7 ) {
996
+ $refresh_alerts = true;
997
+ }
998
+ }
999
+ if ( $refresh_alerts ) {
1000
+ $nonce = wp_create_nonce( 'mapi-alerts' );
1001
+ ?>
1002
+ <input type="hidden" id="advads-mapi-refresh-alerts" />
1003
+ <script type="text/javascript">
1004
+ ;(function($){
1005
+
1006
+ $( '#mapi-alerts-overlay' ).css( 'display', 'block' );
1007
+
1008
+ var pubId = $( '#adsense-id' ).val();
1009
+ $.ajax({
1010
+ url: ajaxurl,
1011
+ type: 'post',
1012
+ data: {
1013
+ action: 'advads-mapi-get-alerts',
1014
+ account: '<?php echo wp_strip_all_tags( $adsense_id ); ?>',
1015
+ nonce: '<?php echo wp_strip_all_tags( $nonce ); ?>',
1016
+ },
1017
+ success:function(response, status, XHR){
1018
+ if ( 'undefined' != typeof response.alerts ) {
1019
+ $( '#advads-mapi-refresh-alerts' ).trigger( 'advadsMapiRefreshAlerts', [response] );
1020
+ }
1021
+ $( '#mapi-alerts-overlay' ).css( 'display', 'none' );
1022
+ },
1023
+ error:function(request, status, error){
1024
+ $( '#mapi-alerts-overlay' ).css( 'display', 'none' );
1025
+ },
1026
+ });
1027
+
1028
+ })(window.jQuery);
1029
+ </script>
1030
+ <?php
1031
+ }
1032
+ }
1033
+
1034
  /**
1035
  * Sort ad units list alphabetically
1036
  */
1102
  /**
1103
  * save token obtained from confirmation code
1104
  */
1105
+ public static function save_token_from_data( $token, $details, $args = array() ) {
1106
+
1107
+ $options = self::get_option();
1108
+ $adsense_id = $details['id'];
1109
 
 
 
1110
  if ( ! isset( $options['accounts'][ $adsense_id ] ) ) {
1111
  $options['accounts'][ $adsense_id ] = self::$empty_account_data;
1112
  }
1114
  $options['accounts'][ $adsense_id ]['user_app'] = array(
1115
  'access_token' => $token['access_token'],
1116
  'refresh_token' => $token['refresh_token'],
1117
+ 'expires' => $token['expires'],
1118
  'token_type' => $token['token_type'],
1119
  );
1120
  } else {
1121
  $options['accounts'][ $adsense_id ]['default_app'] = array(
1122
  'access_token' => $token['access_token'],
1123
  'refresh_token' => $token['refresh_token'],
1124
+ 'expires' => $token['expires'],
1125
  'token_type' => $token['token_type'],
1126
  );
1127
  }
1128
+ $options['accounts'][ $adsense_id ]['details'] = $details;
1129
  update_option( self::OPTNAME, $options );
1130
 
1131
+ $gadsense_data = Advanced_Ads_AdSense_Data::get_instance();
1132
+ $gadsense_options = $gadsense_data->get_options();
1133
+ $gadsense_options['adsense-id'] = $adsense_id;
1134
+ $gadsense_options['page-level-enabled'] = isset( $args['autoads'] ) && $args['autoads'];
1135
+ update_option( GADSENSE_OPT_NAME, $gadsense_options );
1136
+
1137
  }
1138
 
1139
+ /**
1140
+ * Get a list of stored alerts for a given AdSense account.
1141
+ *
1142
+ * @param string $pub_id the publisher account.
1143
+ * @return array $alerts
1144
+ */
1145
+ public static function get_stored_account_alerts( $pub_id = '' ) {
1146
+ if ( empty( $pub_id ) ) {
1147
+ return false;
1148
+ }
1149
+ $options = self::get_option();
1150
+ if ( isset( $options['accounts'][ $pub_id ] ) ) {
1151
+ if ( isset( $options['accounts'][ $pub_id ]['alerts'] ) && is_array( $options['accounts'][ $pub_id ]['alerts'] ) ) {
1152
+ return $options['accounts'][ $pub_id ]['alerts'];
1153
+ } else {
1154
+ return array();
1155
+ }
1156
+ }
1157
+ return false;
1158
+ }
1159
+
1160
+ /**
1161
+ * Checks if there is any AdSense warning for the currently connected AdSense account.
1162
+ *
1163
+ * @param array $messages The array of messages.
1164
+ *
1165
+ * @return array The modified array.
1166
+ */
1167
+ public static function adsense_warnings_check( $messages ) {
1168
+ $data = Advanced_Ads_AdSense_Data::get_instance();
1169
+ $adsense_id = $data->get_adsense_id();
1170
+ $alerts = self::get_stored_account_alerts( $adsense_id );
1171
+ if ( !is_array( $messages ) ) {
1172
+ $messages = array();
1173
+ }
1174
+ if ( !empty( $alerts ) && !empty( $alerts['items'] ) ) {
1175
+ $messages[] = sprintf(
1176
+ __( 'There are one or more warnings about the currently linked AdSense account. You can view them <a href="%s">here</a>', 'advanced-ads' ),
1177
+ esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) )
1178
+ );
1179
+ }
1180
+ return $messages;
1181
+ }
1182
+
1183
  /**
1184
  * Get the class's option
1185
  */
1191
  return $options + self::$default_options;
1192
  }
1193
 
1194
+ /**
1195
+ * Get custom account connection error message list.
1196
+ */
1197
+ public static function get_connect_error_messages() {
1198
+ return self::$connect_error_messages;
1199
+ }
1200
+
1201
  public static function get_instance() {
1202
  if ( null == self::$instance ) {
1203
  self::$instance = new self();
public/assets/js/advanced.js CHANGED
@@ -1 +1 @@
1
- advads={supports_localstorage:function(){"use strict";try{if(!window||window.localStorage===undefined){return false}window.localStorage.setItem("x","x");window.localStorage.removeItem("x");return true}catch(e){return false}},max_per_session:function(name,max){var num=1;if(max===undefined||parseInt(max)===0){max=1}if(this.cookie_exists(name)){if(this.get_cookie(name)>=max){return true}num=num+parseInt(this.get_cookie(name))}this.set_cookie(name,num);return false},count_up:function(name,exdays){var num=1;if(this.cookie_exists(name)){num=num+parseInt(this.get_cookie(name))}this.set_cookie(name,num)},set_cookie_exists:function(name){if(get_cookie(name)){return true}set_cookie(name,"",0);return false},get_cookie:function(name){var i,x,y,ADVcookies=document.cookie.split(";");for(i=0;i<ADVcookies.length;i++){x=ADVcookies[i].substr(0,ADVcookies[i].indexOf("="));y=ADVcookies[i].substr(ADVcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x===name){return unescape(y)}}},set_cookie:function(name,value,exdays,path,domain,secure){var expiry=exdays==null?null:exdays*24*60*60;this.set_cookie_sec(name,value,expiry,path,domain,secure)},set_cookie_sec:function(name,value,expiry,path,domain,secure){var exdate=new Date;exdate.setSeconds(exdate.getSeconds()+parseInt(expiry));document.cookie=name+"="+escape(value)+(expiry==null?"":"; expires="+exdate.toUTCString())+(path==null?"; path=/":"; path="+path)+(domain==null?"":"; domain="+domain)+(secure==null?"":"; secure")},cookie_exists:function(name){var c_value=this.get_cookie(name);if(c_value!==null&&c_value!==""&&c_value!==undefined){return true}return false},move:function(element,target,options){var el=jQuery(element);if(typeof options==="undefined"){options={}}if(typeof options.css==="undefined"){options.css={}}if(typeof options.method==="undefined"){options.method="prependTo"}if(target===""&&typeof options.target!=="undefined"){switch(options.target){case"wrapper":var offset="left";if(typeof options.offset!=="undefined"){offset=options.offset}target=this.find_wrapper(element,offset);break}}if(typeof options.moveintohidden==="undefined"){target=jQuery(target).filter(":visible")}switch(options.method){case"insertBefore":el.insertBefore(target);break;case"insertAfter":el.insertAfter(target);break;case"appendTo":el.appendTo(target);break;case"prependTo":el.prependTo(target);break;default:el.prependTo(target)}},set_parent_relative:function(element){var el=jQuery(element);var parent=el.parent();if(parent.css("position")==="static"||parent.css("position")===""){parent.css("position","relative")}},fix_element:function(element,options){this.set_parent_relative(element);var el=jQuery(element);if(typeof options!=="undefined"&&options.is_invisible){el.show()}var topoffset=parseInt(el.offset().top);var leftoffset=parseInt(el.offset().left);if(typeof options!=="undefined"&&options.is_invisible){el.hide()}el.css("position","fixed").css("top",topoffset+"px").css("left",leftoffset+"px").css("right","")},find_wrapper:function(element,offset){var returnValue;jQuery("body").children().each(function(key,value){if(value.id!==element.substring(1)){var checkedelement=jQuery(value);if(offset==="right"&&checkedelement.offset().left+jQuery(checkedelement).width()<jQuery(window).width()||offset==="left"&&checkedelement.offset().left>0){if(checkedelement.css("position")==="static"||checkedelement.css("position")===""){checkedelement.css("position","relative")}returnValue=value;return false}}});return returnValue},center_fixed_element:function(element){var el=jQuery(element);var left=jQuery(window).width()/2-parseInt(el.css("width"))/2;el.css("left",left+"px")},center_vertically:function(element){var el=jQuery(element);var left=jQuery(window).height()/2-parseInt(el.css("height"))/2;el.css("top",left+"px")},close:function(element){var wrapper=jQuery(element);wrapper.remove()},wait_for_images:function($el,ready_callback){var loaded_count=0;var srcs=[];$el.find('img[src][src!=""]').each(function(){srcs.push(this.src)});if(srcs.length===0){ready_callback.call($el)}jQuery.each(srcs,function(i,src){var image=new Image;image.src=src;var events="load error";jQuery(image).one(events,function me(event){jQuery(this).off(events,me);loaded_count++;if(loaded_count==srcs.length){ready_callback.call($el[0]);return false}})})},privacy:{get_state:function(){if(!window.advads_options||!window.advads_options.privacy){return"not_needed"}var options=window.advads_options.privacy;if(!options.enabled){return"not_needed"}var method=options["consent-method"]?options["consent-method"]:"0";switch(method){case"0":return"not_needed";break;case"custom":if(options["custom-cookie-value"===undefined]||options["custom-cookie-value"]===undefined){return"not_needed"}var found=advads.get_cookie(options["custom-cookie-name"]);if(typeof found!=="string"){return"unknown"}if(options["custom-cookie-value"]===""&&found===""||options["custom-cookie-value"]!==""&&found.indexOf(options["custom-cookie-value"])!==-1){return"accepted"}return"unknown";break;default:return advads.cookie_exists(method)?"accepted":"unknown"}},is_adsense_npa_enabled:function(){if(!window.advads_options||!window.advads_options.privacy){return true}var options=window.advads_options.privacy;return!!options["show-non-personalized-adsense"]}}};jQuery(document).ready(function(){if(advads.supports_localstorage()&&localStorage.getItem("advads_frontend_picker")){var advads_picker_cur,advads_picker_overlay=jQuery("<div id='advads-picker-overlay'>"),advads_picker_no=[document.body,document.documentElement,document];advads_picker_overlay.css({position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:1e6,pointerEvents:"none"}).prependTo("body");jQuery(document).mousemove(function(e){if(e.target===advads_picker_cur){return}if(~advads_picker_no.indexOf(e.target)){advads_picker_cur=null;advads_picker_overlay.hide();return}var target=jQuery(e.target),offset=target.offset(),width=target.outerWidth(),height=target.outerHeight();advads_picker_cur=e.target;advads_picker_overlay.css({top:offset.top,left:offset.left,width:width,height:height}).show();console.log(jQuery(advads_picker_cur).getPath())});jQuery(document).click(function(e){var path=jQuery(advads_picker_cur).getPath();localStorage.setItem("advads_frontend_element",path);window.location=localStorage.getItem("advads_prev_url")})}});jQuery.fn.extend({getPath:function(path,depth){if(typeof path==="undefined")path="";if(typeof depth==="undefined")depth=0;if(this.is("html")){return"html > "+path}else if(3===depth){return path}var cur=this.get(0).nodeName.toLowerCase();var el_id=this.attr("id"),el_class=this.attr("class");depth=depth+1;if(typeof el_id!=="undefined"&&!/\d/.test(el_id)){cur+="#"+el_id}else if(typeof el_class!=="undefined"){el_class=el_class.split(/[\s\n]+/);el_class=jQuery.grep(el_class,function(element,index){return!/\d/.test(element)});if(el_class.length){cur+="."+el_class.slice(0,2).join(".")}}if(this.siblings(cur).length){cur+=":eq("+this.siblings(cur).addBack().not("#advads-picker-overlay").index(this)+")"}if(path===""){return this.parent().getPath(cur,depth)}else{return this.parent().getPath(cur+" > "+path,depth)}}});
1
+ advads={supports_localstorage:function(){"use strict";try{if(!window||window.localStorage===undefined){return false}window.localStorage.setItem("x","x");window.localStorage.removeItem("x");return true}catch(e){return false}},max_per_session:function(name,max){var num=1;if(max===undefined||parseInt(max)===0){max=1}if(this.cookie_exists(name)){if(this.get_cookie(name)>=max){return true}num=num+parseInt(this.get_cookie(name))}this.set_cookie(name,num);return false},count_up:function(name,exdays){var num=1;if(this.cookie_exists(name)){num=num+parseInt(this.get_cookie(name))}this.set_cookie(name,num)},set_cookie_exists:function(name){if(get_cookie(name)){return true}set_cookie(name,"",0);return false},get_cookie:function(name){var i,x,y,ADVcookies=document.cookie.split(";");for(i=0;i<ADVcookies.length;i++){x=ADVcookies[i].substr(0,ADVcookies[i].indexOf("="));y=ADVcookies[i].substr(ADVcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x===name){return unescape(y)}}},set_cookie:function(name,value,exdays,path,domain,secure){var expiry=exdays==null?null:exdays*24*60*60;this.set_cookie_sec(name,value,expiry,path,domain,secure)},set_cookie_sec:function(name,value,expiry,path,domain,secure){var exdate=new Date;exdate.setSeconds(exdate.getSeconds()+parseInt(expiry));document.cookie=name+"="+escape(value)+(expiry==null?"":"; expires="+exdate.toUTCString())+(path==null?"; path=/":"; path="+path)+(domain==null?"":"; domain="+domain)+(secure==null?"":"; secure")},cookie_exists:function(name){var c_value=this.get_cookie(name);if(c_value!==null&&c_value!==""&&c_value!==undefined){return true}return false},move:function(element,target,options){var el=jQuery(element);if(typeof options==="undefined"){options={}}if(typeof options.css==="undefined"){options.css={}}if(typeof options.method==="undefined"){options.method="prependTo"}if(target===""&&typeof options.target!=="undefined"){switch(options.target){case"wrapper":var offset="left";if(typeof options.offset!=="undefined"){offset=options.offset}target=this.find_wrapper(element,offset);break}}if(typeof options.moveintohidden==="undefined"){target=jQuery(target).filter(":visible")}switch(options.method){case"insertBefore":el.insertBefore(target);break;case"insertAfter":el.insertAfter(target);break;case"appendTo":el.appendTo(target);break;case"prependTo":el.prependTo(target);break;default:el.prependTo(target)}},set_parent_relative:function(element,options){var options=typeof options!=="undefined"?options:{};var el=jQuery(element);var parent=el.parent();if(options.use_grandparent){parent=parent.parent()}if(parent.css("position")==="static"||parent.css("position")===""){parent.css("position","relative")}},fix_element:function(element,options){var options=typeof options!=="undefined"?options:{};var el=jQuery(element);if(options.use_grandparent){this.set_parent_relative(el.parent())}else{this.set_parent_relative(el)}if(options.is_invisible){el.show()}var topoffset=parseInt(el.offset().top);var leftoffset=parseInt(el.offset().left);if(options.is_invisible){el.hide()}el.css("position","fixed").css("top",topoffset+"px").css("left",leftoffset+"px").css("right","")},find_wrapper:function(element,offset){var returnValue;jQuery("body").children().each(function(key,value){if(value.id!==element.substring(1)){var checkedelement=jQuery(value);if(offset==="right"&&checkedelement.offset().left+jQuery(checkedelement).width()<jQuery(window).width()||offset==="left"&&checkedelement.offset().left>0){if(checkedelement.css("position")==="static"||checkedelement.css("position")===""){checkedelement.css("position","relative")}returnValue=value;return false}}});return returnValue},center_fixed_element:function(element){var el=jQuery(element);var left=jQuery(window).width()/2-parseInt(el.css("width"))/2;el.css("left",left+"px")},center_vertically:function(element){var el=jQuery(element);var left=jQuery(window).height()/2-parseInt(el.css("height"))/2;if(el.css("position")!=="fixed"){left-=topoffset=parseInt(el.offset().top)}el.css("top",left+"px")},close:function(element){var wrapper=jQuery(element);wrapper.remove()},wait_for_images:function($el,ready_callback){var loaded_count=0;var srcs=[];$el.find('img[src][src!=""]').each(function(){srcs.push(this.src)});if(srcs.length===0){ready_callback.call($el)}jQuery.each(srcs,function(i,src){var image=new Image;image.src=src;var events="load error";jQuery(image).one(events,function me(event){jQuery(this).off(events,me);loaded_count++;if(loaded_count==srcs.length){ready_callback.call($el[0]);return false}})})},privacy:{get_state:function(){if(!window.advads_options||!window.advads_options.privacy){return"not_needed"}var options=window.advads_options.privacy;if(!options.enabled){return"not_needed"}var method=options["consent-method"]?options["consent-method"]:"0";switch(method){case"0":return"not_needed";break;case"custom":if(options["custom-cookie-value"===undefined]||options["custom-cookie-value"]===undefined){return"not_needed"}var found=advads.get_cookie(options["custom-cookie-name"]);if(typeof found!=="string"){return"unknown"}if(options["custom-cookie-value"]===""&&found===""||options["custom-cookie-value"]!==""&&found.indexOf(options["custom-cookie-value"])!==-1){return"accepted"}return"unknown";break;default:return advads.cookie_exists(method)?"accepted":"unknown"}},is_adsense_npa_enabled:function(){if(!window.advads_options||!window.advads_options.privacy){return true}var options=window.advads_options.privacy;return!!options["show-non-personalized-adsense"]}}};jQuery(document).ready(function(){if(advads.supports_localstorage()&&localStorage.getItem("advads_frontend_picker")){var advads_picker_cur,advads_picker_overlay=jQuery("<div id='advads-picker-overlay'>"),advads_picker_no=[document.body,document.documentElement,document];advads_picker_overlay.css({position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:1e6,pointerEvents:"none"}).prependTo("body");jQuery(document).mousemove(function(e){if(e.target===advads_picker_cur){return}if(~advads_picker_no.indexOf(e.target)){advads_picker_cur=null;advads_picker_overlay.hide();return}var target=jQuery(e.target),offset=target.offset(),width=target.outerWidth(),height=target.outerHeight();advads_picker_cur=e.target;advads_picker_overlay.css({top:offset.top,left:offset.left,width:width,height:height}).show();console.log(jQuery(advads_picker_cur).getPath())});jQuery(document).click(function(e){var path=jQuery(advads_picker_cur).getPath();localStorage.setItem("advads_frontend_element",path);window.location=localStorage.getItem("advads_prev_url")})}});jQuery.fn.extend({getPath:function(path,depth){if(typeof path==="undefined")path="";if(typeof depth==="undefined")depth=0;if(this.is("html")){return"html > "+path}else if(3===depth){return path}var cur=this.get(0).nodeName.toLowerCase();var el_id=this.attr("id"),el_class=this.attr("class");depth=depth+1;if(typeof el_id!=="undefined"&&!/\d/.test(el_id)){cur+="#"+el_id}else if(typeof el_class!=="undefined"){el_class=el_class.split(/[\s\n]+/);el_class=jQuery.grep(el_class,function(element,index){return!/\d/.test(element)});if(el_class.length){cur+="."+el_class.slice(0,2).join(".")}}if(this.siblings(cur).length){cur+=":eq("+this.siblings(cur).addBack().not("#advads-picker-overlay").index(this)+")"}if(path===""){return this.parent().getPath(cur,depth)}else{return this.parent().getPath(cur+" > "+path,depth)}}});
public/assets/js/advanced.orig.js CHANGED
@@ -200,10 +200,16 @@ advads = {
200
  *
201
  * @param {str} element selector
202
  */
203
- set_parent_relative: function( element ) {
 
204
  var el = jQuery(element);
205
  // give "position" style to parent element, if missing
206
  var parent = el.parent();
 
 
 
 
 
207
  if(parent.css('position') === 'static' || parent.css('position') === ''){
208
  parent.css('position', 'relative');
209
  }
@@ -217,18 +223,24 @@ advads = {
217
  * @param {obj} options
218
  */
219
  fix_element: function( element, options ){
220
- this.set_parent_relative( element );
221
 
222
  var el = jQuery(element);
223
 
 
 
 
 
 
 
224
  // fix element at current position
225
  // get position for hidden elements by showing them for a very short time
226
- if( typeof options !== 'undefined' && options.is_invisible ){
227
  el.show();
228
  }
229
  var topoffset = parseInt(el.offset().top);
230
  var leftoffset = parseInt(el.offset().left);
231
- if( typeof options !== 'undefined' && options.is_invisible ){
232
  el.hide();
233
  }
234
  // reset "right" to prevent conflicts
@@ -286,6 +298,11 @@ advads = {
286
  var el = jQuery(element);
287
  // half window height minus half element height
288
  var left = ( jQuery(window).height() / 2 ) - ( parseInt( el.css('height')) / 2 );
 
 
 
 
 
289
  el.css('top', left + 'px');
290
  },
291
  /**
200
  *
201
  * @param {str} element selector
202
  */
203
+ set_parent_relative: function( element, options ) {
204
+ var options = typeof options !== 'undefined' ? options: {};
205
  var el = jQuery(element);
206
  // give "position" style to parent element, if missing
207
  var parent = el.parent();
208
+
209
+ if ( options.use_grandparent ) {
210
+ parent = parent.parent();
211
+ }
212
+
213
  if(parent.css('position') === 'static' || parent.css('position') === ''){
214
  parent.css('position', 'relative');
215
  }
223
  * @param {obj} options
224
  */
225
  fix_element: function( element, options ){
226
+ var options = typeof options !== 'undefined' ? options: {};
227
 
228
  var el = jQuery(element);
229
 
230
+ if ( options.use_grandparent ) {
231
+ this.set_parent_relative( el.parent() );
232
+ } else {
233
+ this.set_parent_relative( el );
234
+ }
235
+
236
  // fix element at current position
237
  // get position for hidden elements by showing them for a very short time
238
+ if ( options.is_invisible ) {
239
  el.show();
240
  }
241
  var topoffset = parseInt(el.offset().top);
242
  var leftoffset = parseInt(el.offset().left);
243
+ if ( options.is_invisible ) {
244
  el.hide();
245
  }
246
  // reset "right" to prevent conflicts
298
  var el = jQuery(element);
299
  // half window height minus half element height
300
  var left = ( jQuery(window).height() / 2 ) - ( parseInt( el.css('height')) / 2 );
301
+
302
+ // Center correctly when the ad is attached to the element that begins lower.
303
+ if ( el.css( 'position' ) !== 'fixed' ) {
304
+ left -= topoffset = parseInt( el.offset().top );
305
+ }
306
  el.css('top', left + 'px');
307
  },
308
  /**
public/class-advanced-ads.php CHANGED
@@ -424,9 +424,15 @@ class Advanced_Ads {
424
  return $content;
425
  }
426
 
427
- // check if ads are disabled in secondary queries and this function was called by ajax (in secondary query).
428
- if ( ! empty( $options['disabled-ads']['secondary'] ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
429
- return $content;
 
 
 
 
 
 
430
  }
431
 
432
  // run only within the loop on single pages of public post types.
@@ -794,13 +800,13 @@ class Advanced_Ads {
794
  ?><style>
795
  div.advads-edit-bar{position:relative;top:0;left:0;height:0;display:none;z-index:10000;animation:advads-edit-appear 2s linear 1;}
796
  @keyframes advads-edit-appear {
797
- 0% {opacity: 0.0;}
798
  66% {opacity: 0.0;}
799
  100% {opacity: 1.0;}
800
  }
801
- a.advads-edit-button{position:absolute;top:0;left:0;text-decoration:none !important;box-shadow:none;border-bottom:none;color:#0074a2;margin-top:-5px;cursor:default;}
802
  a.advads-edit-button span{top:10px;line-height:25px;margin-left:-5px;width:26px;height:26px;border-radius:13px;border:solid 1px #0074a2;background:#fff}
803
- div:hover > .advads-edit-bar:first-child{display:block;}</style><?php
804
  }
805
  }
806
 
@@ -830,6 +836,20 @@ class Advanced_Ads {
830
  return true === $this->is_main_query;
831
  }
832
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
833
  /**
834
  * Get an "Advertisement" label to use before single ad or before first ad in a group
835
  *
424
  return $content;
425
  }
426
 
427
+ // Check if ads are disabled in secondary queries.
428
+ if ( ! empty( $options['disabled-ads']['secondary'] ) ) {
429
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
430
+ // This function was called by ajax (in secondary query).
431
+ return $content;
432
+ }
433
+ if ( $this->has_many_the_content() ) {
434
+ return $content;
435
+ }
436
  }
437
 
438
  // run only within the loop on single pages of public post types.
800
  ?><style>
801
  div.advads-edit-bar{position:relative;top:0;left:0;height:0;display:none;z-index:10000;animation:advads-edit-appear 2s linear 1;}
802
  @keyframes advads-edit-appear {
803
+ 0% {opacity: 0.0;pointer-events: none;}
804
  66% {opacity: 0.0;}
805
  100% {opacity: 1.0;}
806
  }
807
+ a.advads-edit-button{position:absolute;top:0;left:0;text-decoration:none !important;box-shadow:none;border-bottom:none;color:#0074a2;margin-top:-5px;}
808
  a.advads-edit-button span{top:10px;line-height:25px;margin-left:-5px;width:26px;height:26px;border-radius:13px;border:solid 1px #0074a2;background:#fff}
809
+ :hover > .advads-edit-bar:first-child{display:block;}</style><?php
810
  }
811
  }
812
 
836
  return true === $this->is_main_query;
837
  }
838
 
839
+ /**
840
+ * Find the calls to `the_content` inside functions hooked to `the_content`.
841
+ *
842
+ * @return bool
843
+ */
844
+ public function has_many_the_content() {
845
+ global $wp_current_filter;
846
+ if ( count( array_keys( $wp_current_filter, 'the_content', true ) ) > 1 ) {
847
+ // More then one `the_content` in the stack.
848
+ return true;
849
+ }
850
+ return false;
851
+ }
852
+
853
  /**
854
  * Get an "Advertisement" label to use before single ad or before first ad in a group
855
  *
readme.txt CHANGED
@@ -1,11 +1,11 @@
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: 5.0
7
  Requires PHP: 5.4
8
- Stable tag: 1.10.12
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -26,7 +26,7 @@ Are you looking for a simple ad manager plugin? These are the top arguments to u
26
 
27
  Would you like to know if there is a certain feature, what the optimized setup would be, or how to implement your client’s demands? Just [open a thread in the forum](https://wordpress.org/support/plugin/advanced-ads#new-post)!
28
 
29
- Based on my experience as a publisher with millions of monthly served ads, I've developed this ad management plugin for WordPress when no other solution offered testing and optimization features. It allowed us to grow to 100 MM monthly ad impressions. Benefit from this knowledge and monetize your website today!
30
 
31
  [Full Feature List](https://wpadvancedads.com/features/).
32
 
@@ -93,7 +93,7 @@ Placements to insert ads in pre-defined positions in your theme and content. [Li
93
  * ads in the footer
94
  * test placements against each other with [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/)
95
  * many more ad positions with [add-ons](https://wpadvancedads.com/add-ons/)
96
- * automatic insertion of any kind of code into header or footer, not only advertising
97
 
98
  = mobile devices =
99
 
@@ -178,10 +178,10 @@ How to install the plugin and get it working?
178
 
179
  You can use Advanced Ads to insert ads into your WordPress site without any coding.
180
 
181
- To get started, just take a look at
182
 
183
- * the [general first ad tutorial](https://wpadvancedads.com/manual/first-ad/)
184
- * using [AdSense Auto ads](https://wpadvancedads.com/adsense-auto-ads-wordpress/) in WordPress
185
  * the [AdSense overview page](https://wpadvancedads.com/adsense-ads).
186
  * Ads not showing up? Take a look [here](https://wpadvancedads.com/manual/ads-not-showing-up).
187
 
@@ -234,7 +234,7 @@ Yes. I would add a "Manual" placement into your theme files. It would allow you
234
 
235
  = Does it work with other ad plugins? =
236
 
237
- Yes. Advanced Ads can be combined with other ad plugins.
238
  Just use their shortcodes in our "Rich Media" ad type to combine both features.
239
  Works with AdRotate, Ad Inserter, Ad Injection, Quick AdSense, Quick AdSense Reloaded (WPQUADS), Simple Ads Manager, and other plugins.
240
 
@@ -254,7 +254,7 @@ You can still monetize those spots with custom content.
254
 
255
  Read more about ad blockers and the features Advanced Ads has to deal with them [on this page](https://wpadvancedads.com/manual/ad-blockers/).
256
 
257
- = Does the plugin supports an ads.txt? =
258
 
259
  Google AdSense and some other networks ask you to provide an ads.txt. You can create and integrate this file easily with [this plugin](https://wordpress.org/plugins/ads-txt/).
260
 
@@ -276,6 +276,20 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
276
 
277
  == Changelog ==
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  = 1.10.12 =
280
 
281
  * added function that allows Advanced Ads Pro to prevent script optimizing plugins to break ad codes
@@ -286,6 +300,7 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
286
  * added `advanced-ads-frontend-prefix` to adjust the frontend prefix dynamically
287
  * placement position set to center does cause selected ad to be placed to the left
288
  * fix ads within multiple groups not being saved
 
289
 
290
  = 1.10.10 =
291
 
@@ -363,378 +378,10 @@ Yes. Advanced Ads is based on WordPress standards and therefore easily customiza
363
  * fixed possible conflict between assets created by the Ad Blocker module
364
  * WP Rocket: compatibility with the recent version of deferred JavaScript
365
 
366
- = 1.9 =
367
-
368
- * added Privacy module to hide ads until consent is given, see new [Privacy settings](https://wpadvancedads.com/manual/ad-cookie-consent/)
369
-
370
- = 1.8.30 =
371
-
372
- * prevented entering 0 in the position index field of the Content placement
373
- * compatibility between Elementor plugin and Content placement
374
- * made Ad Health available to all users that can edit ads
375
- * hide dashboard widget for user roles that can’t edit ads
376
- * don't use wrapper when using the "Header Code" placement
377
- * compatibility between Responsive add-on and "WP AMP Ninja" plugin
378
-
379
- = 1.8.29 =
380
-
381
- * added ad block that works with Gutenberg version 2.8.0
382
- * allowed to use uppercase letters in wrapper ID
383
- * do not count cache preload features of caching plugins as bots
384
- * removed orange border for just updated placements since it implicated that there was something wrong
385
- * use AnonymizeIP by default for ad block counter feature
386
- * remove "ca-" from AdSense publisher ID dynamically if entered by accident
387
- * fixed possible content breaking by empty Content placement
388
- * fixed issue with Pagination condition in Pro
389
- * fixed minor license check issue
390
- * fixed issue with legacy value for the Unlimited Ad Injection option
391
-
392
- = 1.8.28 =
393
-
394
- * prevent possible issue with empty groups
395
- * show only 1 ad in groups by default
396
- * fix for loading the wrong plugin language in WP Admin
397
- * added helpful advice when license activation was blocked by firewall
398
- * made ads for ad blockers (Pro) work when Google Analytics ID is not set
399
- * prevented Google Custom Search tags from breaking with content injection
400
- * added code to fix Analytics tracking in Tracking add-on for multisites loading an ad from another blog
401
-
402
- = 1.8.27 =
403
-
404
- * prepared for repeating content ad injections in [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/)
405
- * minor backend fixes
406
-
407
- = 1.8.26 =
408
-
409
- * fixed issue for new installations
410
-
411
- = 1.8.25 =
412
-
413
- * updated labels and links for AdSense Page-Level ads and QuickStart since both are now combined as "Auto Ads"
414
- * added link to create new AdSense account
415
- * removed "Remove Widget ID" option. No longer needed after fixing a compatibility issue with Q2W3 Fixed Widget plugin
416
- * prepared for Pro feature to repeat an ad multiple times by injecting it into the content
417
-
418
- = 1.8.24 =
419
-
420
- * fixed minor conflict caused by Bridge theme
421
- * fixed links to support page
422
- * fixed possibility to create an infinite loop by adding an ad (type: group) to a group which it represents
423
- * fixed issue when rebuilding Ad Blocker file folder and using not direct filesystem method
424
-
425
- = 1.8.23 =
426
-
427
- * moved support page into a tab on the settings page
428
- * show link to assigned ad and ad group on placement page
429
-
430
- = 1.8.22 =
431
-
432
- * dynamically adjust available ad weight in a group depending on the number of ads
433
- * added option to interpret shortcodes in plain text ad type
434
- * specified some of the warnings on settings page
435
- * fixed 'Display only once' feature when used together with Content placement
436
-
437
- = 1.8.21 =
438
-
439
- * added more checks for conflicting plugins
440
- * show critical warnings also on settings page
441
- * reopen placement options that were opened last when saving the placement list
442
- * added check for missing PHP extensions
443
- * updated label for bot detection setting and warn, if current user is bot-like
444
- * minified ad block counter code in frontend or remove, if not used
445
- * introduced `advanced-ads-ad-image-tag-style` filter to adjust image ad style
446
- * fixed images not being centered when in a placement
447
-
448
- = 1.8.20 =
449
-
450
- * added "placement_has_ads" and "group_has_ads" functions to test if a placement/group has not empty output
451
- * allowed to rotate ordered ads with same weight
452
- * show warning if Page-level ad code is used for AdSense ad type
453
-
454
- = 1.8.19 =
455
-
456
- * delayed Ad Health checks for hidden AdSense ads
457
- * added fix for WooCommerce store page to work with Specific Pages condition
458
- * prepared for more AMP features in next update of Responsive add-on
459
-
460
- = 1.8.18 =
461
-
462
- * fixed bug when old version of [Tracking](https://wpadvancedads.com/add-ons/tracking/) was running
463
-
464
- = 1.8.17 =
465
-
466
- * updated review message
467
- * prepared for upcoming fixes for Pro add-ons with WP Rocket defer option
468
- * fixed index issue
469
-
470
- = 1.8.16 =
471
-
472
- * fixed issue introduced to some ad types with last code highlighting support update
473
- * fixed layout issue on sites with 'Right to Left' locale
474
- * ignore content and excerpt when searching for a post in the Specific Pages condition
475
-
476
- = 1.8.15 =
477
-
478
- * use code highlighting by default for plain text ad type
479
- * fixed newsletter signup form
480
- * fixed bug that shows install message for Genesis add-on even if already installed
481
-
482
- = 1.8.14 =
483
-
484
- * prevent ad injection on BuddyPress image upload pages
485
- * added more Yandex bots to bot check
486
- * compatibility with iOS 9.3
487
-
488
- = 1.8.13 =
489
-
490
- * improved security of WP Admin forms and AJAX requests
491
- * added translation notice
492
- * fixed publish date showing up for newly created ads
493
- * fixed issue when searching for post IDs in the "Specific Pages" Display Condition
494
-
495
- = 1.8.12 =
496
-
497
- * linked the new [AdSense In-feed add-on](https://wordpress.org/plugins/advanced-ads-adsense-in-feed/) where needed
498
- * optimized settings page layout
499
- * process Advanced Ads shortcodes correctly when they are nested inside Rich Content ads
500
-
501
- = 1.8.11 =
502
-
503
- * added option to make AdSense background transparent
504
- * only show missing the_content filter warning if relevant
505
- * show Ad Health warning if current user looks like a bot
506
- * fixed showing correct group type options
507
-
508
- = 1.8.10 =
509
-
510
- * added Ad Health warning if ads are disabled in the frontend
511
- * fix for Wizard navigation
512
-
513
- = 1.8.9 =
514
-
515
- * added option to disable AdSense-related Ad-Health warnings
516
- * fixed search for terms with numbers in them
517
- * added check for hidden AdSense units
518
- * added warning that AdSense InFeed and InArticle ads can’t be aligned left or right
519
-
520
- = 1.8.8 =
521
-
522
- * fix to feedback form
523
-
524
- = 1.8.7 =
525
-
526
- * added option to analyze the number of visitors using an ad blocker
527
- * exchanged Dummy ad image and URL to something more neutral
528
- * compatibility with PHP 5.2
529
- * use margin: auto to center reserved ad space
530
- * renamed Groups menu item to also mention "Rotations"
531
- * do not execute shortcodes of the current ad in its own content
532
- * updated first-ad video tutorial link
533
- * fixed wizard skipping a step after being stopped and reopened
534
- * fixed wrong scheduled time displayed on ad overview list
535
-
536
- = 1.8.6 =
537
-
538
- * hotfix for PHP below 5.4
539
- * fixed HTTPS warning showing up for links
540
-
541
- = 1.8.5 =
542
-
543
- * optimized Wizard – fewer steps and less clutter
544
- * added more options to the placement box after a new ad is saved
545
- * load dashboard widget using AJAX
546
- * show a warning in Ad Health if an ad contains HTTPS, but the site is using HTTP
547
- * fixed problem when multiple add-ons were updated at once
548
-
549
- = 1.8.4 =
550
-
551
- * added "Taxonomy" Display Condition
552
- * display arrow if an Ad Health message is a link
553
- * removed "jQuery not in Header" warning after we fixed all known issues
554
- * renamed and updated add-on updater class to use SSL only
555
- * updated pt_BR translation
556
- * added Japanese translation
557
- * replaced "Cheatin' uh?" message with something useful if user role does not have required permissions
558
- * prevent output of Adsense ads on AMP pages if they are not converted to AMP-format with Responsive add-on
559
-
560
- = 1.8.3 =
561
-
562
- * introduced `advads_is_amp` function to fix ad injections on AMP pages
563
- * implemented a simple ad block counter with Google Analytics
564
-
565
- = 1.8.2 =
566
-
567
- * fixed Content Age condition
568
- * fixed group options not changing correctly when switching types
569
-
570
- = 1.8.1 =
571
-
572
- * added support for new AdSense InFeed and InArticle ad codes
573
- * create a new ad group on group page
574
- * add group wrapper even if the group was not edited on the group edit page
575
- * add the 'advanced-ads-output-wrapper-after-content-group' filter
576
- * removed unused MarketPress license code
577
- * removed debug page
578
- * removed license expires notice
579
- * updated composer
580
- * updated translation files
581
- * fixed issue with inheriting settings of ad group ad type
582
- * removed PHP notice in Import feature
583
-
584
- = 1.8 =
585
-
586
- This release is even larger under the hood than the following list. Please make sure to also update all [your add-ons](https://wpadvancedads.com/add-ons/) and let us know directly about any issues [here](https://wpadvancedads.com/support/).
587
-
588
- * new Content Age display condition added – display ads based on post age
589
- * allow to enable/disable ad label for each placement
590
- * complete rework of group and placement options
591
- * added Dummy ad type
592
- * show AdSense code form inline instead of in a popup
593
- * optimized workflow in wizard to show only relevant information
594
- * select draft, pending and future posts in the Specific Pages condition, too
595
- * warn if QuickStart ads from AdSense are loaded
596
- * show ads on AMP pages for all bots
597
- * properly escaped output of image ad title and alt attribute
598
- * removed description field from groups since we have never seen this being used, let us know when you need it though
599
- * updated all translation files
600
- * fixed wrong month names in translated versions of the ad overview list
601
- * fixed with small image ads not appearing on AMP pages
602
- * fixed missing and wrong textdomains
603
- * fixed search for single digit IDs in Specific Pages condition not working
604
-
605
- = 1.7.25 =
606
-
607
- * added explicit "link ads" AdSense type with normal and responsive format
608
- * included link to AdSense types manual
609
- * optimized bot check
610
- * removed TinyMCE security features from links added to the rich media ad type to not break affiliate links
611
- * fixed error appearing when image of an image ad does not exist anymore
612
- * fixed wizard not going to ad parameters box automatically after selecting ad type
613
-
614
- = 1.7.24 =
615
-
616
- * fixed issue with shortcode button that caused some page builders and scripts to break
617
- * fixed saving settings on multisite sub-blogs
618
- * applied fix to updater class
619
- * fixed basic fix function needed for Sticky ads
620
-
621
- = 1.7.23 =
622
-
623
- * fix a warning that appears when wp admin bar is missing.
624
-
625
- = 1.7.22 =
626
-
627
- * added option to also consider elements in containers for ad content injection
628
- * show warning in Ad Health bar when not all ads could be injected
629
- * added logic to display ad specific warnings and possible conflicts
630
- * added warning to disable shortcode button or ad blocker in order to use the visual editor for posts
631
- * reapplied user capabilities to create or edit ads to make sure they are never wrong
632
- * added warning about left and right position not working with responsive AdSense units
633
- * edited feedback form
634
- * add ad/group wrapper, if needed
635
-
636
- = 1.7.21 =
637
-
638
- * fixed jumping "more terms" button in taxonomy conditions
639
- * fixed advanced JavaScript for frontend picker in Pro
640
-
641
- = 1.7.20 =
642
-
643
- * updated local storage script
644
- * fixed issue causing passive-cache busting and layer not to work together
645
-
646
- = 1.7.19 =
647
-
648
- * check if local storage is supported by the browser, if needed
649
- * use flexbox layout for longer input fields in conditions
650
- * use `advanced-ads-admin-max-terms` filter also for limit in author condition
651
- * updated EDD Updater Class for add-on updates
652
- * fixed error message when all placements were removed
653
- * fixed adblock disguise folder not working correctly on https pages
654
-
655
- = 1.7.18 =
656
-
657
- * use the same ad block disguise settings for all sites in a multisite
658
- * update to advanced.js to allow injection into hidden elements
659
- * fixed group options being overridden, when filtered groups are being saved
660
- * fixed missing attribute for responsive Matched Content ads
661
- * fixed issue with MarketPress license check
662
-
663
- = 1.7.17 =
664
-
665
- * add `ADVANCED_ADS_DISABLE_SHORTCODE_BUTTON` constant to wp-config.php in order to remove the shortcode button from the TinyMCE interface
666
- * don’t move ads into hidden elements
667
- * set license key fields to readonly after updated
668
- * show "reserve ad space" only for ad types where it makes sense
669
- * using WordPress Filesystem to create ad block disguise folder
670
- * disable page level ads on pages where all ads are disabled
671
- * hide double compatibility warning with cache-busting in Advanced Ads Pro
672
- * hide warning about unexcaped `&` in urls
673
-
674
- = 1.7.16 =
675
-
676
- * added helpful links when download of an add-on failed
677
- * set active license key fields to readonly
678
- * bundles add-on related functions into one class
679
- * updated Spanish translation
680
- * added Vietnamese translation
681
-
682
- = 1.7.15 =
683
-
684
- * allow Unlimited Ad Injection setting to specify the number of posts in the loop to show ads
685
- * allow to override specific options in functions and shortcodes
686
- * added feedback form on deactivation
687
- * fixed Visitor Conditions connector being saved wrongly first
688
- * fixed ads not appearing on AMP pages
689
-
690
- = 1.7.14 =
691
-
692
- * added `ADVANCED_ADS_ENABLE_REVISIONS` constant to allow revisions for ads
693
- * fixed wrong output after using quick edit in the ads list
694
- * fixed custom position logic to not leave critical errors when localStorage is disabled
695
- * fixed update checks on every admin page impression due to W3TC object cache breaking transients
696
-
697
- = 1.7.13 =
698
-
699
- * fix for class name sensitive systems and Tracking autoloader
700
-
701
- = 1.7.12 =
702
-
703
- * better highlighting of AND and OR connectors in display and visitor conditions
704
- * removed general conditions as default from display conditions
705
- * highlighted video and manual links for conditions
706
- * show is_home and is_front_page as the same item in ad debug mode
707
- * show warning if plain ad code contains HTTP, but the website is using HTTPS
708
- * added notice if add-on licenses expired to plugin page
709
- * changed "mobile device" into "device" condition with better option descriptions (mobile + tablet | desktop)
710
- * changed "Post Content" placement label into "Content" since it is used for all post types
711
- * hide manage ads link in dashboard widget from users who can not edit ads
712
- * fixed dependency issue with Tracking add-on
713
- * fixed dependency issue with AJAX cache-busting
714
- * fixed missing scripts for ad block disguise
715
-
716
- = 1.7.11 =
717
-
718
- * added filter to change General display conditions set
719
- * set `ADVANCED_ADS_AD_DEBUG_FOR_ADMIN_ONLY` in order to allow only admins to see ad debug mode
720
- * introduced `advanced-ads-output-final` filter
721
- * only check once per day for add-on updates
722
- * fixed one support link
723
- * fixed multiple add-on update checks
724
- * fixed error message when ad group is empty
725
-
726
- = 1.7.10 =
727
-
728
- * highlight ads in the frontend through the "Ad Health" options
729
- * check if PHP DOM module is enabled and warn in "Ad Health" if not
730
- * added DFP debug link to "Ad Health"
731
- * added button to check Add-On license keys for changes
732
- * extended ad debug mode with more information
733
- * restructured support page to reach helper more quickly
734
- * fixed header ad bug
735
- * fixed compatibility issues with Yoast SEO, WPML, and Jetpack
736
- * confirmed working with Divi Themes and NewsMag
737
-
738
  [Changelog Archive](https://wpadvancedads.com/codex/changelog-archive/)
739
 
740
  == Upgrade Notice ==
 
 
 
 
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 rotation, adsense, banner
5
  Requires at least: 4.6
6
  Tested up to: 5.0
7
  Requires PHP: 5.4
8
+ Stable tag: 1.11
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
26
 
27
  Would you like to know if there is a certain feature, what the optimized setup would be, or how to implement your client’s demands? Just [open a thread in the forum](https://wordpress.org/support/plugin/advanced-ads#new-post)!
28
 
29
+ Based on my experience as a publisher with millions of monthly served ads, I've developed this ad management plugin for WordPress when no other solution offered testing and optimization features. It allowed us to grow to 100 MM monthly ad impressions. Benefit from this knowledge and monetize your website today!
30
 
31
  [Full Feature List](https://wpadvancedads.com/features/).
32
 
93
  * ads in the footer
94
  * test placements against each other with [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/)
95
  * many more ad positions with [add-ons](https://wpadvancedads.com/add-ons/)
96
+ * automatic insertion of any kind of code into header or footer, not only advertising
97
 
98
  = mobile devices =
99
 
178
 
179
  You can use Advanced Ads to insert ads into your WordPress site without any coding.
180
 
181
+ To get started, just take a look at
182
 
183
+ * the [general first ad tutorial](https://wpadvancedads.com/manual/first-ad/)
184
+ * using [AdSense Auto ads](https://wpadvancedads.com/adsense-auto-ads-wordpress/) in WordPress
185
  * the [AdSense overview page](https://wpadvancedads.com/adsense-ads).
186
  * Ads not showing up? Take a look [here](https://wpadvancedads.com/manual/ads-not-showing-up).
187
 
234
 
235
  = Does it work with other ad plugins? =
236
 
237
+ Yes. Advanced Ads can be combined with other ad plugins.
238
  Just use their shortcodes in our "Rich Media" ad type to combine both features.
239
  Works with AdRotate, Ad Inserter, Ad Injection, Quick AdSense, Quick AdSense Reloaded (WPQUADS), Simple Ads Manager, and other plugins.
240
 
254
 
255
  Read more about ad blockers and the features Advanced Ads has to deal with them [on this page](https://wpadvancedads.com/manual/ad-blockers/).
256
 
257
+ = Does the plugin support an ads.txt? =
258
 
259
  Google AdSense and some other networks ask you to provide an ads.txt. You can create and integrate this file easily with [this plugin](https://wordpress.org/plugins/ads-txt/).
260
 
276
 
277
  == Changelog ==
278
 
279
+ = 1.11 =
280
+
281
+ * improved the AdSense onboarding process
282
+ * hide idle ads in the ads list loaded from the AdSense server
283
+ * don’t inject ads into content when ads are disabled on Secondary Queries (problem caused by Similar Posts plugin)
284
+ * limited Edit-button in the frontend to ads with a container around them
285
+ * fixed issue caused by browsers with a default ad blocker
286
+ * fixed ad group filter on the ad overview page not appearing
287
+ * fixed "Ad block counter" being needed to display ads for ad blockers
288
+ * compatibility with the "Render Blocking JS" option of the WP Fastest Cache plugin
289
+ * added clearfix option to fix possible layout issue with all types of AdSense responsive ads
290
+ * use same URL field for Tracking and basic plugin
291
+ * Sticky Ads: fixed incorrect centering when parent element begins lower
292
+
293
  = 1.10.12 =
294
 
295
  * added function that allows Advanced Ads Pro to prevent script optimizing plugins to break ad codes
300
  * added `advanced-ads-frontend-prefix` to adjust the frontend prefix dynamically
301
  * placement position set to center does cause selected ad to be placed to the left
302
  * fix ads within multiple groups not being saved
303
+ * made compatible with improved cache-busting in Advanced Ads Pro 2.3
304
 
305
  = 1.10.10 =
306
 
378
  * fixed possible conflict between assets created by the Ad Blocker module
379
  * WP Rocket: compatibility with the recent version of deferred JavaScript
380
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  [Changelog Archive](https://wpadvancedads.com/codex/changelog-archive/)
382
 
383
  == Upgrade Notice ==
384
+
385
+ = 1.11 =
386
+
387
+ Improves AdSense onboarding
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 ComposerAutoloaderInit7e435a20ca545f8783e709e05dbdc63b::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInitf5d5d78e14ee3ef64a684f6e70b265cd::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -13,9 +13,7 @@
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,6 +37,8 @@ namespace Composer\Autoload;
39
  *
40
  * @author Fabien Potencier <fabien@symfony.com>
41
  * @author Jordi Boggiano <j.boggiano@seld.be>
 
 
42
  */
43
  class ClassLoader
44
  {
@@ -53,8 +53,9 @@ class ClassLoader
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
56
-
57
  private $classMapAuthoritative = false;
 
 
58
 
59
  public function getPrefixes()
60
  {
@@ -147,7 +148,7 @@ class ClassLoader
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,6 +272,26 @@ class ClassLoader
271
  return $this->classMapAuthoritative;
272
  }
273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  /**
275
  * Registers this instance as an autoloader.
276
  *
@@ -313,29 +334,34 @@ class ClassLoader
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,10 +374,14 @@ class ClassLoader
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,6 +429,8 @@ class ClassLoader
399
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
  return $file;
401
  }
 
 
402
  }
403
  }
404
 
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
  *
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
 
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
  * 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
  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') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $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
  */
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
 
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
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
  return $file;
431
  }
432
+
433
+ return false;
434
  }
435
  }
436
 
vendor/composer/LICENSE CHANGED
@@ -1,5 +1,5 @@
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
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
vendor/composer/autoload_real.php CHANGED
@@ -23,19 +23,26 @@ class ComposerAutoloaderInitd24de3c06687d3cf4aad0b15c83747be
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,8 +50,3 @@ class ComposerAutoloaderInitd24de3c06687d3cf4aad0b15c83747be
43
  return $loader;
44
  }
45
  }
46
-
47
- function composerRequired24de3c06687d3cf4aad0b15c83747be($file)
48
- {
49
- require $file;
50
- }
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
  return $loader;
51
  }
52
  }
 
 
 
 
 
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 ComposerAutoloaderInit7e435a20ca545f8783e709e05dbdc63b {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit7e435a20ca545f8783e709e05dbdc63b {
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);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInitf5d5d78e14ee3ef64a684f6e70b265cd {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitf5d5d78e14ee3ef64a684f6e70b265cd', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitf5d5d78e14ee3ef64a684f6e70b265cd', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/autoload_static.php CHANGED
@@ -37,6 +37,7 @@ class ComposerStaticInitd24de3c06687d3cf4aad0b15c83747be
37
  'Advanced_Ads_Ad' => __DIR__ . '/../..' . '/classes/ad.php',
38
  'Advanced_Ads_Ad_Ajax_Callbacks' => __DIR__ . '/../..' . '/classes/ad_ajax_callbacks.php',
39
  'Advanced_Ads_Ad_Debug' => __DIR__ . '/../..' . '/classes/ad-debug.php',
 
40
  'Advanced_Ads_Ad_Type_Abstract' => __DIR__ . '/../..' . '/classes/ad_type_abstract.php',
41
  'Advanced_Ads_Ad_Type_Content' => __DIR__ . '/../..' . '/classes/ad_type_content.php',
42
  'Advanced_Ads_Ad_Type_Dummy' => __DIR__ . '/../..' . '/classes/ad_type_dummy.php',
@@ -69,95 +70,8 @@ class ComposerStaticInitd24de3c06687d3cf4aad0b15c83747be
69
  'Advanced_Ads_Utils' => __DIR__ . '/../..' . '/classes/utils.php',
70
  'Advanced_Ads_Visitor_Conditions' => __DIR__ . '/../..' . '/classes/visitor-conditions.php',
71
  'Advanced_Ads_Widget' => __DIR__ . '/../..' . '/classes/widget.php',
72
- 'Composer\\Installers\\AglInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AglInstaller.php',
73
- 'Composer\\Installers\\AimeosInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AimeosInstaller.php',
74
- 'Composer\\Installers\\AnnotateCmsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php',
75
- 'Composer\\Installers\\AsgardInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AsgardInstaller.php',
76
- 'Composer\\Installers\\AttogramInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AttogramInstaller.php',
77
- 'Composer\\Installers\\BaseInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BaseInstaller.php',
78
- 'Composer\\Installers\\BitrixInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BitrixInstaller.php',
79
- 'Composer\\Installers\\BonefishInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BonefishInstaller.php',
80
- 'Composer\\Installers\\CakePHPInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CakePHPInstaller.php',
81
- 'Composer\\Installers\\ChefInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ChefInstaller.php',
82
- 'Composer\\Installers\\ClanCatsFrameworkInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php',
83
- 'Composer\\Installers\\CockpitInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CockpitInstaller.php',
84
- 'Composer\\Installers\\CodeIgniterInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php',
85
- 'Composer\\Installers\\Concrete5Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Concrete5Installer.php',
86
- 'Composer\\Installers\\CraftInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CraftInstaller.php',
87
- 'Composer\\Installers\\CroogoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
88
- 'Composer\\Installers\\DecibelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
89
- 'Composer\\Installers\\DokuWikiInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DokuWikiInstaller.php',
90
- 'Composer\\Installers\\DolibarrInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DolibarrInstaller.php',
91
- 'Composer\\Installers\\DrupalInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DrupalInstaller.php',
92
- 'Composer\\Installers\\ElggInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ElggInstaller.php',
93
- 'Composer\\Installers\\EliasisInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/EliasisInstaller.php',
94
- 'Composer\\Installers\\ExpressionEngineInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php',
95
- 'Composer\\Installers\\EzPlatformInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/EzPlatformInstaller.php',
96
- 'Composer\\Installers\\FuelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/FuelInstaller.php',
97
- 'Composer\\Installers\\FuelphpInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/FuelphpInstaller.php',
98
- 'Composer\\Installers\\GravInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/GravInstaller.php',
99
- 'Composer\\Installers\\HuradInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/HuradInstaller.php',
100
- 'Composer\\Installers\\ImageCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ImageCMSInstaller.php',
101
- 'Composer\\Installers\\Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Installer.php',
102
- 'Composer\\Installers\\ItopInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ItopInstaller.php',
103
- 'Composer\\Installers\\JoomlaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/JoomlaInstaller.php',
104
- 'Composer\\Installers\\KanboardInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KanboardInstaller.php',
105
- 'Composer\\Installers\\KirbyInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KirbyInstaller.php',
106
- 'Composer\\Installers\\KodiCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KodiCMSInstaller.php',
107
- 'Composer\\Installers\\KohanaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KohanaInstaller.php',
108
- 'Composer\\Installers\\LanManagementSystemInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php',
109
- 'Composer\\Installers\\LaravelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LaravelInstaller.php',
110
- 'Composer\\Installers\\LavaLiteInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LavaLiteInstaller.php',
111
- 'Composer\\Installers\\LithiumInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LithiumInstaller.php',
112
- 'Composer\\Installers\\MODULEWorkInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php',
113
- 'Composer\\Installers\\MODXEvoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MODXEvoInstaller.php',
114
- 'Composer\\Installers\\MagentoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MagentoInstaller.php',
115
- 'Composer\\Installers\\MakoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MakoInstaller.php',
116
- 'Composer\\Installers\\MauticInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MauticInstaller.php',
117
- 'Composer\\Installers\\MayaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MayaInstaller.php',
118
- 'Composer\\Installers\\MediaWikiInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MediaWikiInstaller.php',
119
- 'Composer\\Installers\\MicroweberInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MicroweberInstaller.php',
120
- 'Composer\\Installers\\MoodleInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MoodleInstaller.php',
121
- 'Composer\\Installers\\OctoberInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OctoberInstaller.php',
122
- 'Composer\\Installers\\OntoWikiInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OntoWikiInstaller.php',
123
- 'Composer\\Installers\\OsclassInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OsclassInstaller.php',
124
- 'Composer\\Installers\\OxidInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OxidInstaller.php',
125
- 'Composer\\Installers\\PPIInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PPIInstaller.php',
126
- 'Composer\\Installers\\PhiftyInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PhiftyInstaller.php',
127
- 'Composer\\Installers\\PhpBBInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PhpBBInstaller.php',
128
- 'Composer\\Installers\\PimcoreInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PimcoreInstaller.php',
129
- 'Composer\\Installers\\PiwikInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PiwikInstaller.php',
130
- 'Composer\\Installers\\PlentymarketsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php',
131
- 'Composer\\Installers\\Plugin' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Plugin.php',
132
- 'Composer\\Installers\\PortoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PortoInstaller.php',
133
- 'Composer\\Installers\\PrestashopInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PrestashopInstaller.php',
134
- 'Composer\\Installers\\PuppetInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PuppetInstaller.php',
135
- 'Composer\\Installers\\RadPHPInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
136
- 'Composer\\Installers\\ReIndexInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
137
- 'Composer\\Installers\\RedaxoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
138
- 'Composer\\Installers\\RoundcubeInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/RoundcubeInstaller.php',
139
- 'Composer\\Installers\\SMFInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
140
- 'Composer\\Installers\\ShopwareInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ShopwareInstaller.php',
141
- 'Composer\\Installers\\SilverStripeInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SilverStripeInstaller.php',
142
- 'Composer\\Installers\\SyDESInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SyDESInstaller.php',
143
- 'Composer\\Installers\\Symfony1Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
144
- 'Composer\\Installers\\TYPO3CmsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php',
145
- 'Composer\\Installers\\TYPO3FlowInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php',
146
- 'Composer\\Installers\\TheliaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TheliaInstaller.php',
147
- 'Composer\\Installers\\TuskInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TuskInstaller.php',
148
- 'Composer\\Installers\\UserFrostingInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/UserFrostingInstaller.php',
149
- 'Composer\\Installers\\VanillaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/VanillaInstaller.php',
150
- 'Composer\\Installers\\VgmcpInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/VgmcpInstaller.php',
151
- 'Composer\\Installers\\WHMCSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/WHMCSInstaller.php',
152
- 'Composer\\Installers\\WolfCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/WolfCMSInstaller.php',
153
- 'Composer\\Installers\\WordPressInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/WordPressInstaller.php',
154
- 'Composer\\Installers\\YawikInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/YawikInstaller.php',
155
- 'Composer\\Installers\\ZendInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ZendInstaller.php',
156
- 'Composer\\Installers\\ZikulaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
157
  'Yoast_I18n_WordPressOrg_v3' => __DIR__ . '/..' . '/yoast/i18n-module/src/i18n-module-wordpressorg.php',
158
  'Yoast_I18n_v3' => __DIR__ . '/..' . '/yoast/i18n-module/src/i18n-module.php',
159
- 'xrstf\\Composer52\\AutoloadGenerator' => __DIR__ . '/..' . '/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php',
160
- 'xrstf\\Composer52\\Generator' => __DIR__ . '/..' . '/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php',
161
  );
162
 
163
  public static function getInitializer(ClassLoader $loader)
37
  'Advanced_Ads_Ad' => __DIR__ . '/../..' . '/classes/ad.php',
38
  'Advanced_Ads_Ad_Ajax_Callbacks' => __DIR__ . '/../..' . '/classes/ad_ajax_callbacks.php',
39
  'Advanced_Ads_Ad_Debug' => __DIR__ . '/../..' . '/classes/ad-debug.php',
40
+ 'Advanced_Ads_Ad_List_Filters' => __DIR__ . '/../..' . '/admin/includes/class-list-filters.php',
41
  'Advanced_Ads_Ad_Type_Abstract' => __DIR__ . '/../..' . '/classes/ad_type_abstract.php',
42
  'Advanced_Ads_Ad_Type_Content' => __DIR__ . '/../..' . '/classes/ad_type_content.php',
43
  'Advanced_Ads_Ad_Type_Dummy' => __DIR__ . '/../..' . '/classes/ad_type_dummy.php',
70
  'Advanced_Ads_Utils' => __DIR__ . '/../..' . '/classes/utils.php',
71
  'Advanced_Ads_Visitor_Conditions' => __DIR__ . '/../..' . '/classes/visitor-conditions.php',
72
  'Advanced_Ads_Widget' => __DIR__ . '/../..' . '/classes/widget.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  'Yoast_I18n_WordPressOrg_v3' => __DIR__ . '/..' . '/yoast/i18n-module/src/i18n-module-wordpressorg.php',
74
  'Yoast_I18n_v3' => __DIR__ . '/..' . '/yoast/i18n-module/src/i18n-module.php',
 
 
75
  );
76
 
77
  public static function getInitializer(ClassLoader $loader)
vendor/composer/installed.json CHANGED
@@ -74,17 +74,17 @@
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": {
@@ -98,7 +98,7 @@
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",
74
  },
75
  {
76
  "name": "composer/installers",
77
+ "version": "v1.6.0",
78
+ "version_normalized": "1.6.0.0",
79
  "source": {
80
  "type": "git",
81
  "url": "https://github.com/composer/installers.git",
82
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
83
  },
84
  "dist": {
85
  "type": "zip",
86
+ "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
87
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
88
  "shasum": ""
89
  },
90
  "require": {
98
  "composer/composer": "1.0.*@dev",
99
  "phpunit/phpunit": "^4.8.36"
100
  },
101
+ "time": "2018-08-27 06:10:37",
102
  "type": "composer-plugin",
103
  "extra": {
104
  "class": "Composer\\Installers\\Plugin",
vendor/composer/installers/CHANGELOG.md DELETED
@@ -1,86 +0,0 @@
1
- # Change Log
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.
25
- * Installer for UserFrosting.
26
- * Installer for Osclass.
27
- * Installer for Lan Management System.
28
-
29
- ### Changed
30
- * Added vendor name to package path for Lavalite.
31
-
32
- ## v1.3.0 - 2017-04-24
33
- ### Added
34
- * Kanboard plugins installer.
35
- * Porto-SAP installer.
36
- * Add `core` to concrete5 installer.
37
- * Support Moodle "search" plugin type.
38
- * SyDES installer.
39
- * iTop installer.
40
- * Lavalite installer.
41
- * Module type for Eliasis.
42
- * Vgmcp installer.
43
- * OntoWiki installer.
44
- * The requirements for contributing (CONTRIBUTING.md).
45
-
46
- ## v1.2.0 - 2016-08-13
47
- ### Added
48
- * Installer for Attogram.
49
- * Installer for Cockpit.
50
- * Installer for Plentymarkets.
51
- * Installer for ReIndex.
52
- * Installer for Vanilla.
53
- * Installer for YAWIK.
54
- * Added missing environments for new Shopware (5.2) Plugin System.
55
-
56
- ## v1.1.0 - 2016-07-05
57
- ### Added
58
- * Installer for ReIndex.
59
- * Installer for RadPHP.
60
- * Installer for Decibel.
61
- * Installer for Phifty.
62
- * Installer for ExpressionEngine.
63
-
64
- ### Changed
65
- * New paths for new Bitrix CMS. Old paths is deprecated.
66
-
67
- ### Deprecated
68
- * Old paths in Bitrix CMS Installer is deprecated.
69
-
70
- ## v1.0.25 - 2016-04-13
71
- ### Removed
72
- * Revert TYPO3 installer deletion.
73
-
74
- ## v1.0.24 - 2016-04-05
75
- ### Added
76
- * Installer for ImageCMS.
77
- * Installer for Mautic.
78
- * New types in the Kirby installer: `kirby-plugin` and `kirby-field`.
79
- * New types in the Drupal installer: `custom-theme` and `custom-module`.
80
-
81
- ### Changed
82
- * Switch to PSR-4.
83
- * Update Bitrix Installer: configuration for setting custom path to directory with kernel.
84
-
85
- ### Removed
86
- * Remove TYPO3 Extension installers.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/CONTRIBUTING.md DELETED
@@ -1,24 +0,0 @@
1
- # Contributing
2
-
3
- If you would like to help, please take a look at the list of
4
- [issues](https://github.com/composer/installers/issues).
5
-
6
- ## Pull requests
7
-
8
- * [Fork and clone](https://help.github.com/articles/fork-a-repo).
9
- * Run the command `php composer.phar install` to install the dependencies.
10
- This will also install the dev dependencies. See [Composer](https://getcomposer.org/doc/03-cli.md#install).
11
- * Use the command `phpunit` to run the tests. See [PHPUnit](http://phpunit.de).
12
- * Create a branch, commit, push and send us a
13
- [pull request](https://help.github.com/articles/using-pull-requests).
14
-
15
- To ensure a consistent code base, you should make sure the code follows the
16
- coding standards [PSR-1](http://www.php-fig.org/psr/psr-1/) and
17
- [PSR-2](http://www.php-fig.org/psr/psr-2/).
18
-
19
- ### Create a new Installer
20
-
21
- * Create class extends `Composer\Installers\BaseInstaller` with your Installer.
22
- * Create unit tests as a separate class or as part of a `Composer\Installers\Test\InstallerTest`.
23
- * Add information about your Installer in `README.md` in section "Current Supported Package Types".
24
- * Run the tests.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/README.md DELETED
@@ -1,221 +0,0 @@
1
- # A Multi-Framework [Composer](http://getcomposer.org) Library Installer
2
-
3
- [![Build Status](http://img.shields.io/travis/composer/installers.svg)](http://travis-ci.org/composer/installers)
4
-
5
- This is for PHP package authors to require in their `composer.json`. It will
6
- install their package to the correct location based on the specified package
7
- type.
8
-
9
- The goal of Installers is to be a simple package type to install path map.
10
- Users can also customize the install path per package and package authors can
11
- modify the package name upon installing.
12
-
13
- Installers isn't intended on replacing all custom installers. If your
14
- package requires special installation handling then by all means, create a
15
- custom installer to handle it.
16
-
17
- **Natively Supported Frameworks**:
18
-
19
- The following frameworks natively work with Composer and will be
20
- installed to the default `vendor` directory. `composer/installers`
21
- is not needed to install packages with these frameworks:
22
-
23
- * Aura
24
- * Symfony2
25
- * Yii
26
- * Yii2
27
-
28
- ## Current Supported Package Types
29
-
30
- > Stable types are marked as **bold**, this means that installation paths
31
- > for those type will not be changed. Any adjustment for those types would
32
- > require creation of brand new type that will cover required changes.
33
-
34
- | Framework | Types
35
- | --------- | -----
36
- | Aimeos | `aimeos-extension`
37
- | Asgard | `asgard-module`<br>`asgard-theme`
38
- | Attogram | `attogram-module`
39
- | AGL | `agl-module`
40
- | Bonefish | `bonefish-package`
41
- | AnnotateCms | `annotatecms-module`<br>`annotatecms-component`<br>`annotatecms-service`
42
- | Bitrix | `bitrix-module` (deprecated) <br>`bitrix-component` (deprecated) <br>`bitrix-theme` (deprecated) <br><br> `bitrix-d7-module` <br> `bitrix-d7-component` <br> `bitrix-d7-template`
43
- | CakePHP 2+ | **`cakephp-plugin`**
44
- | Chef | `chef-cookbook`<br>`chef-role`
45
- | CCFramework | `ccframework-ship`<br>`ccframework-theme`
46
- | Cockpit | `cockpit-module`
47
- | CodeIgniter | `codeigniter-library`<br>`codeigniter-third-party`<br>`codeigniter-module`
48
- | concrete5 | `concrete5-core`<br>`concrete5-package`<br>`concrete5-theme`<br>`concrete5-block`<br>`concrete5-update`
49
- | Craft | `craft-plugin`
50
- | Croogo | `croogo-plugin`<br>`croogo-theme`
51
- | Decibel | `decibel-app`
52
- | DokuWiki | `dokuwiki-plugin`<br>`dokuwiki-template`
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`
60
- | FuelPHP v2.x | `fuelphp-component`
61
- | Grav | `grav-plugin`<br>`grav-theme`
62
- | Hurad | `hurad-plugin`<br>`hurad-theme`
63
- | ImageCMS | `imagecms-template`<br>`imagecms-module`<br>`imagecms-library`
64
- | iTop | `itop-extension`
65
- | Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
66
- | Kanboard | `kanboard-plugin`
67
- | Kirby | **`kirby-plugin`**<br>`kirby-field`<br>`kirby-tag`
68
- | KodiCMS | `kodicms-plugin`<br>`kodicms-media`
69
- | Kohana | **`kohana-module`**
70
- | Lan Management System | `lms-plugin`<br>`lms-template`<br>`lms-document-template`<br>`lms-userpanel-module`
71
- | Laravel | `laravel-library`
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`**
83
- | OntoWiki | `ontowiki-extension`<br>`ontowiki-theme`<br>`ontowiki-translation`
84
- | OXID | `oxid-module`<br>`oxid-theme`<br>`oxid-out`
85
- | Osclass | `osclass-plugin`<br>`osclass-theme`<br>`osclass-language`
86
- | MODULEWork | `modulework-module`
87
- | Moodle | `moodle-*` (Please [check source](https://raw.githubusercontent.com/composer/installers/master/src/Composer/Installers/MoodleInstaller.php) for all supported types)
88
- | Piwik | `piwik-plugin`
89
- | phpBB | `phpbb-extension`<br>`phpbb-style`<br>`phpbb-language`
90
- | Pimcore | `pimcore-plugin`
91
- | Plentymarkets | `plentymarkets-plugin`
92
- | PPI | **`ppi-module`**
93
- | Puppet | `puppet-module`
94
- | Porto | `porto-container`
95
- | RadPHP | `radphp-bundle`
96
- | REDAXO | `redaxo-addon`
97
- | ReIndex | **`reindex-plugin`** <br> **`reindex-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`**
105
- | Tusk | `tusk-task`<br>`tusk-command`<br>`tusk-asset`
106
- | TYPO3 Flow | `typo3-flow-package`<br>`typo3-flow-framework`<br>`typo3-flow-plugin`<br>`typo3-flow-site`<br>`typo3-flow-boilerplate`<br>`typo3-flow-build`
107
- | TYPO3 CMS | `typo3-cms-extension` (Deprecated in this package, use the [TYPO3 CMS Installers](https://packagist.org/packages/typo3/cms-composer-installers) instead)
108
- | UserFrosting | `userfrosting-sprinkle`
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`
116
- | Prestashop | `prestashop-module`<br>`prestashop-theme`
117
- | Phifty | `phifty-bundle`<br>`phifty-framework`<br>`phifty-library`
118
-
119
- ## Example `composer.json` File
120
-
121
- This is an example for a CakePHP plugin. The only important parts to set in your
122
- composer.json file are `"type": "cakephp-plugin"` which describes what your
123
- package is and `"require": { "composer/installers": "~1.0" }` which tells composer
124
- to load the custom installers.
125
-
126
- ```json
127
- {
128
- "name": "you/ftp",
129
- "type": "cakephp-plugin",
130
- "require": {
131
- "composer/installers": "~1.0"
132
- }
133
- }
134
- ```
135
-
136
- This would install your package to the `Plugin/Ftp/` folder of a CakePHP app
137
- when a user runs `php composer.phar install`.
138
-
139
- So submit your packages to [packagist.org](http://packagist.org)!
140
-
141
- ## Custom Install Paths
142
-
143
- If you are consuming a package that uses the `composer/installers` you can
144
- override the install path with the following extra in your `composer.json`:
145
-
146
- ```json
147
- {
148
- "extra": {
149
- "installer-paths": {
150
- "your/custom/path/{$name}/": ["shama/ftp", "vendor/package"]
151
- }
152
- }
153
- }
154
- ```
155
-
156
- A package type can have a custom installation path with a `type:` prefix.
157
-
158
- ``` json
159
- {
160
- "extra": {
161
- "installer-paths": {
162
- "your/custom/path/{$name}/": ["type:wordpress-plugin"]
163
- }
164
- }
165
- }
166
- ```
167
-
168
- You can also have the same vendor packages with a custom installation path by
169
- using the `vendor:` prefix.
170
-
171
- ``` json
172
- {
173
- "extra": {
174
- "installer-paths": {
175
- "your/custom/path/{$name}/": ["vendor:my_organization"]
176
- }
177
- }
178
- }
179
- ```
180
-
181
- These would use your custom path for each of the listed packages. The available
182
- variables to use in your paths are: `{$name}`, `{$vendor}`, `{$type}`.
183
-
184
- ## Custom Install Names
185
-
186
- If you're a package author and need your package to be named differently when
187
- installed consider using the `installer-name` extra.
188
-
189
- For example you have a package named `shama/cakephp-ftp` with the type
190
- `cakephp-plugin`. Installing with `composer/installers` would install to the
191
- path `Plugin/CakephpFtp`. Due to the strict naming conventions, you as a
192
- package author actually need the package to be named and installed to
193
- `Plugin/Ftp`. Using the following config within your **package** `composer.json`
194
- will allow this:
195
-
196
- ```json
197
- {
198
- "name": "shama/cakephp-ftp",
199
- "type": "cakephp-plugin",
200
- "extra": {
201
- "installer-name": "Ftp"
202
- }
203
- }
204
- ```
205
-
206
- Please note the name entered into `installer-name` will be the final and will
207
- not be inflected.
208
-
209
- ## Should we allow dynamic package types or paths? No.
210
-
211
- What are they? The ability for a package author to determine where a package
212
- will be installed either through setting the path directly in their
213
- `composer.json` or through a dynamic package type: `"type":
214
- "framework-install-here"`.
215
-
216
- It has been proposed many times. Even implemented once early on and then
217
- removed. Installers won't do this because it would allow a single package
218
- author to wipe out entire folders without the user's consent. That user would
219
- then come here to yell at us.
220
-
221
- Anyone still wanting this capability should consider requiring https://github.com/oomphinc/composer-installers-extender.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/_config.yml DELETED
@@ -1 +0,0 @@
1
- theme: jekyll-theme-cayman
 
vendor/composer/installers/phpunit.xml.dist DELETED
@@ -1,25 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
-
3
- <phpunit backupGlobals="false"
4
- backupStaticAttributes="false"
5
- colors="true"
6
- convertErrorsToExceptions="true"
7
- convertNoticesToExceptions="true"
8
- convertWarningsToExceptions="true"
9
- processIsolation="false"
10
- stopOnFailure="false"
11
- syntaxCheck="false"
12
- bootstrap="tests/bootstrap.php"
13
- >
14
- <testsuites>
15
- <testsuite name="Installers Test Suite">
16
- <directory>tests/Composer/Installers</directory>
17
- </testsuite>
18
- </testsuites>
19
-
20
- <filter>
21
- <whitelist>
22
- <directory>src/Composer/Installers</directory>
23
- </whitelist>
24
- </filter>
25
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CiviCrmInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'ext' => 'ext/{$name}/'
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php CHANGED
@@ -11,6 +11,6 @@ class DrupalInstaller extends BaseInstaller
11
  'profile' => 'profiles/{$name}/',
12
  'drush' => 'drush/{$name}/',
13
  'custom-theme' => 'themes/custom/{$name}/',
14
- 'custom-module' => 'modules/custom/{$name}',
15
  );
16
  }
11
  'profile' => 'profiles/{$name}/',
12
  'drush' => 'drush/{$name}/',
13
  'custom-theme' => 'themes/custom/{$name}/',
14
+ 'custom-module' => 'modules/custom/{$name}/',
15
  );
16
  }
vendor/composer/installers/src/Composer/Installers/Installer.php CHANGED
@@ -1,13 +1,18 @@
1
  <?php
 
2
  namespace Composer\Installers;
3
 
4
- use Composer\IO\IOInterface;
 
5
  use Composer\Installer\LibraryInstaller;
 
6
  use Composer\Package\PackageInterface;
7
  use Composer\Repository\InstalledRepositoryInterface;
 
8
 
9
  class Installer extends LibraryInstaller
10
  {
 
11
  /**
12
  * Package types to installer class map
13
  *
@@ -23,6 +28,7 @@ class Installer extends LibraryInstaller
23
  'bonefish' => 'BonefishInstaller',
24
  'cakephp' => 'CakePHPInstaller',
25
  'chef' => 'ChefInstaller',
 
26
  'ccframework' => 'ClanCatsFrameworkInstaller',
27
  'cockpit' => 'CockpitInstaller',
28
  'codeigniter' => 'CodeIgniterInstaller',
@@ -102,6 +108,30 @@ class Installer extends LibraryInstaller
102
  'prestashop' => 'PrestashopInstaller'
103
  );
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  /**
106
  * {@inheritDoc}
107
  */
@@ -197,4 +227,48 @@ class Installer extends LibraryInstaller
197
  {
198
  return $this->io;
199
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  }
1
  <?php
2
+
3
  namespace Composer\Installers;
4
 
5
+ use Composer\Composer;
6
+ use Composer\Installer\BinaryInstaller;
7
  use Composer\Installer\LibraryInstaller;
8
+ use Composer\IO\IOInterface;
9
  use Composer\Package\PackageInterface;
10
  use Composer\Repository\InstalledRepositoryInterface;
11
+ use Composer\Util\Filesystem;
12
 
13
  class Installer extends LibraryInstaller
14
  {
15
+
16
  /**
17
  * Package types to installer class map
18
  *
28
  'bonefish' => 'BonefishInstaller',
29
  'cakephp' => 'CakePHPInstaller',
30
  'chef' => 'ChefInstaller',
31
+ 'civicrm' => 'CiviCrmInstaller',
32
  'ccframework' => 'ClanCatsFrameworkInstaller',
33
  'cockpit' => 'CockpitInstaller',
34
  'codeigniter' => 'CodeIgniterInstaller',
108
  'prestashop' => 'PrestashopInstaller'
109
  );
110
 
111
+ /**
112
+ * Installer constructor.
113
+ *
114
+ * Disables installers specified in main composer extra installer-disable
115
+ * list
116
+ *
117
+ * @param IOInterface $io
118
+ * @param Composer $composer
119
+ * @param string $type
120
+ * @param Filesystem|null $filesystem
121
+ * @param BinaryInstaller|null $binaryInstaller
122
+ */
123
+ public function __construct(
124
+ IOInterface $io,
125
+ Composer $composer,
126
+ $type = 'library',
127
+ Filesystem $filesystem = null,
128
+ BinaryInstaller $binaryInstaller = null
129
+ ) {
130
+ parent::__construct($io, $composer, $type, $filesystem,
131
+ $binaryInstaller);
132
+ $this->removeDisabledInstallers();
133
+ }
134
+
135
  /**
136
  * {@inheritDoc}
137
  */
227
  {
228
  return $this->io;
229
  }
230
+
231
+ /**
232
+ * Look for installers set to be disabled in composer's extra config and
233
+ * remove them from the list of supported installers.
234
+ *
235
+ * Globals:
236
+ * - true, "all", and "*" - disable all installers.
237
+ * - false - enable all installers (useful with
238
+ * wikimedia/composer-merge-plugin or similar)
239
+ *
240
+ * @return void
241
+ */
242
+ protected function removeDisabledInstallers()
243
+ {
244
+ $extra = $this->composer->getPackage()->getExtra();
245
+
246
+ if (!isset($extra['installer-disable']) || $extra['installer-disable'] === false) {
247
+ // No installers are disabled
248
+ return;
249
+ }
250
+
251
+ // Get installers to disable
252
+ $disable = $extra['installer-disable'];
253
+
254
+ // Ensure $disabled is an array
255
+ if (!is_array($disable)) {
256
+ $disable = array($disable);
257
+ }
258
+
259
+ // Check which installers should be disabled
260
+ $all = array(true, "all", "*");
261
+ $intersect = array_intersect($all, $disable);
262
+ if (!empty($intersect)) {
263
+ // Disable all installers
264
+ $this->supportedTypes = array();
265
+ } else {
266
+ // Disable specified installers
267
+ foreach ($disable as $key => $installer) {
268
+ if (is_string($installer) && key_exists($installer, $this->supportedTypes)) {
269
+ unset($this->supportedTypes[$installer]);
270
+ }
271
+ }
272
+ }
273
+ }
274
  }
vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php CHANGED
@@ -4,6 +4,7 @@ namespace Composer\Installers;
4
  class MediaWikiInstaller extends BaseInstaller
5
  {
6
  protected $locations = array(
 
7
  'extension' => 'extensions/{$name}/',
8
  'skin' => 'skins/{$name}/',
9
  );
4
  class MediaWikiInstaller extends BaseInstaller
5
  {
6
  protected $locations = array(
7
+ 'core' => 'core/',
8
  'extension' => 'extensions/{$name}/',
9
  'skin' => 'skins/{$name}/',
10
  );
vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php CHANGED
@@ -33,6 +33,7 @@ class OctoberInstaller extends BaseInstaller
33
  protected function inflectPluginVars($vars)
34
  {
35
  $vars['name'] = preg_replace('/^oc-|-plugin$/', '', $vars['name']);
 
36
 
37
  return $vars;
38
  }
33
  protected function inflectPluginVars($vars)
34
  {
35
  $vars['name'] = preg_replace('/^oc-|-plugin$/', '', $vars['name']);
36
+ $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
37
 
38
  return $vars;
39
  }
vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
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
13
- */
14
- private $installer;
15
-
16
- public function setUp()
17
- {
18
- $this->installer = new AsgardInstaller(
19
- new Package('NyanCat', '4.2', '4.2'),
20
- new Composer()
21
- );
22
- }
23
-
24
- /**
25
- * @dataProvider packageNameInflectionProvider
26
- */
27
- public function testInflectPackageVars($type, $name, $expected)
28
- {
29
- $this->assertEquals(
30
- array('name' => $expected, 'type' => $type),
31
- $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
32
- );
33
- }
34
-
35
- public function packageNameInflectionProvider()
36
- {
37
- return array(
38
- // Should keep module name StudlyCase
39
- array(
40
- 'asgard-module',
41
- 'user-profile',
42
- 'UserProfile'
43
- ),
44
- array(
45
- 'asgard-module',
46
- 'asgard-module',
47
- 'Asgard'
48
- ),
49
- array(
50
- 'asgard-module',
51
- 'blog',
52
- 'Blog'
53
- ),
54
- // tests that exactly one '-module' is cut off
55
- array(
56
- 'asgard-module',
57
- 'some-module-module',
58
- 'SomeModule',
59
- ),
60
- // tests that exactly one '-theme' is cut off
61
- array(
62
- 'asgard-theme',
63
- 'some-theme-theme',
64
- 'SomeTheme',
65
- ),
66
- // tests that names without '-theme' suffix stay valid
67
- array(
68
- 'asgard-theme',
69
- 'someothertheme',
70
- 'Someothertheme',
71
- ),
72
- // Should keep theme name StudlyCase
73
- array(
74
- 'asgard-theme',
75
- 'adminlte-advanced',
76
- 'AdminlteAdvanced'
77
- ),
78
- );
79
- }
80
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
-
3
- namespace Composer\Installers\Test;
4
-
5
- use Composer\Installers\BitrixInstaller;
6
- use Composer\Package\Package;
7
- use Composer\Composer;
8
-
9
- /**
10
- * Tests for the BitrixInstaller Class
11
- *
12
- * @coversDefaultClass Composer\Installers\BitrixInstaller
13
- */
14
- class BitrixInstallerTest extends TestCase
15
- {
16
- /** @var BitrixInstaller */
17
- private $installer;
18
-
19
- /** @var Composer */
20
- private $composer;
21
-
22
-
23
- /**
24
- * Sets up the fixture, for example, instantiate the class-under-test.
25
- *
26
- * This method is called before a test is executed.
27
- */
28
- final function setUp()
29
- {
30
- $this->composer = new Composer();
31
- }
32
-
33
- /**
34
- * @param string $vars
35
- * @param string $expectedVars
36
- *
37
- * @covers ::inflectPackageVars
38
- *
39
- * @dataProvider provideExpectedInflectionResults
40
- */
41
- final public function testInflectPackageVars($vars, $expectedVars)
42
- {
43
-
44
- $this->installer = new BitrixInstaller(
45
- new Package($vars['name'], '4.2', '4.2'),
46
- $this->composer
47
- );
48
- $actual = $this->installer->inflectPackageVars($vars);
49
- $this->assertEquals($actual, $expectedVars);
50
- }
51
-
52
- /**
53
- * Provides various parameters for packages and the expected result after inflection
54
- *
55
- * @return array
56
- */
57
- final public function provideExpectedInflectionResults()
58
- {
59
- return array(
60
- //check bitrix-dir is correct
61
- array(
62
- array('name' => 'Nyan/Cat'),
63
- array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix')
64
- ),
65
- array(
66
- array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix'),
67
- array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix')
68
- ),
69
- array(
70
- array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local'),
71
- array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local')
72
- ),
73
- );
74
- }
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php DELETED
@@ -1,114 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
4
- use Composer\Installers\CakePHPInstaller;
5
- use Composer\Repository\RepositoryManager;
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;
12
-
13
- class CakePHPInstallerTest extends TestCase
14
- {
15
- private $composer;
16
- private $io;
17
-
18
- /**
19
- * setUp
20
- *
21
- * @return void
22
- */
23
- public function setUp()
24
- {
25
- $this->package = new Package('CamelCased', '1.0', '1.0');
26
- $this->io = $this->getMock('Composer\IO\PackageInterface');
27
- $this->composer = new Composer();
28
- $this->composer->setConfig(new Config(false));
29
- }
30
-
31
- /**
32
- * testInflectPackageVars
33
- *
34
- * @return void
35
- */
36
- public function testInflectPackageVars()
37
- {
38
- $installer = new CakePHPInstaller($this->package, $this->composer);
39
- $result = $installer->inflectPackageVars(array('name' => 'CamelCased'));
40
- $this->assertEquals($result, array('name' => 'CamelCased'));
41
-
42
- $installer = new CakePHPInstaller($this->package, $this->composer);
43
- $result = $installer->inflectPackageVars(array('name' => 'with-dash'));
44
- $this->assertEquals($result, array('name' => 'WithDash'));
45
-
46
- $installer = new CakePHPInstaller($this->package, $this->composer);
47
- $result = $installer->inflectPackageVars(array('name' => 'with_underscore'));
48
- $this->assertEquals($result, array('name' => 'WithUnderscore'));
49
-
50
- $installer = new CakePHPInstaller($this->package, $this->composer);
51
- $result = $installer->inflectPackageVars(array('name' => 'cake/acl'));
52
- $this->assertEquals($result, array('name' => 'Cake/Acl'));
53
-
54
- $installer = new CakePHPInstaller($this->package, $this->composer);
55
- $result = $installer->inflectPackageVars(array('name' => 'cake/debug-kit'));
56
- $this->assertEquals($result, array('name' => 'Cake/DebugKit'));
57
- }
58
-
59
- /**
60
- * Test getLocations returning appropriate values based on CakePHP version
61
- *
62
- */
63
- public function testGetLocations() {
64
- $package = new RootPackage('CamelCased', '1.0', '1.0');
65
- $composer = $this->composer;
66
- $rm = new RepositoryManager(
67
- $this->getMock('Composer\IO\IOInterface'),
68
- $this->getMock('Composer\Config')
69
- );
70
- $composer->setRepositoryManager($rm);
71
- $installer = new CakePHPInstaller($package, $composer);
72
-
73
- // 2.0 < cakephp < 3.0
74
- $this->setCakephpVersion($rm, '2.0.0');
75
- $result = $installer->getLocations();
76
- $this->assertContains('Plugin/', $result['plugin']);
77
-
78
- $this->setCakephpVersion($rm, '2.5.9');
79
- $result = $installer->getLocations();
80
- $this->assertContains('Plugin/', $result['plugin']);
81
-
82
- $this->setCakephpVersion($rm, '~2.5');
83
- $result = $installer->getLocations();
84
- $this->assertContains('Plugin/', $result['plugin']);
85
-
86
- // special handling for 2.x versions when 3.x is still in development
87
- $this->setCakephpVersion($rm, 'dev-master');
88
- $result = $installer->getLocations();
89
- $this->assertContains('Plugin/', $result['plugin']);
90
-
91
- $this->setCakephpVersion($rm, '>=2.5');
92
- $result = $installer->getLocations();
93
- $this->assertContains('Plugin/', $result['plugin']);
94
-
95
- // cakephp >= 3.0
96
- $this->setCakephpVersion($rm, '3.0.*-dev');
97
- $result = $installer->getLocations();
98
- $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']);
99
-
100
- $this->setCakephpVersion($rm, '~8.8');
101
- $result = $installer->getLocations();
102
- $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']);
103
- }
104
-
105
- protected function setCakephpVersion($rm, $version) {
106
- $parser = new VersionParser();
107
- list(, $version) = explode(' ', $parser->parseConstraints($version));
108
- $installed = new InstalledArrayRepository();
109
- $package = new Package('cakephp/cakephp', $version, $version);
110
- $installed->addPackage($package);
111
- $rm->setLocalRepository($installed);
112
- }
113
-
114
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/CraftInstallerTest.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
-
3
- namespace Composer\Installers\Test;
4
-
5
- use Composer\Installers\CraftInstaller;
6
-
7
- /**
8
- * Tests for the CraftInstaller Class
9
- *
10
- * @coversDefaultClass Composer\Installers\CraftInstaller
11
- */
12
- class CraftInstallerTest extends TestCase
13
- {
14
- /** @var CraftInstaller */
15
- private $installer;
16
-
17
- /**
18
- * Sets up the fixture, for example, instantiate the class-under-test.
19
- *
20
- * This method is called before a test is executed.
21
- */
22
- final public function setup()
23
- {
24
- $this->installer = new CraftInstaller();
25
- }
26
-
27
- /**
28
- * @param string $packageName
29
- * @param string $expectedName
30
- *
31
- * @covers ::inflectPackageVars
32
- *
33
- * @dataProvider provideExpectedInflectionResults
34
- */
35
- final public function testInflectPackageVars($packageName, $expectedName)
36
- {
37
- $installer = $this->installer;
38
-
39
- $vars = array('name' => $packageName);
40
- $expected = array('name' => $expectedName);
41
-
42
- $actual = $installer->inflectPackageVars($vars);
43
-
44
- $this->assertEquals($actual, $expected);
45
- }
46
-
47
- /**
48
- * Provides various names for packages and the expected result after inflection
49
- *
50
- * @return array
51
- */
52
- final public function provideExpectedInflectionResults()
53
- {
54
- return array(
55
- // lowercase
56
- array('foo', 'foo'),
57
- array('craftfoo', 'craftfoo'),
58
- array('fooplugin', 'fooplugin'),
59
- array('craftfooplugin', 'craftfooplugin'),
60
- // lowercase - dash
61
- array('craft-foo', 'foo'),
62
- array('foo-plugin', 'foo'),
63
- array('craft-foo-plugin', 'foo'),
64
- // lowercase - underscore
65
- array('craft_foo', 'craft_foo'),
66
- array('foo_plugin', 'foo_plugin'),
67
- array('craft_foo_plugin', 'craft_foo_plugin'),
68
- // CamelCase
69
- array('Foo', 'Foo'),
70
- array('CraftFoo', 'CraftFoo'),
71
- array('FooPlugin', 'FooPlugin'),
72
- array('CraftFooPlugin', 'CraftFooPlugin'),
73
- // CamelCase - Dash
74
- array('Craft-Foo', 'Foo'),
75
- array('Foo-Plugin', 'Foo'),
76
- array('Craft-Foo-Plugin', 'Foo'),
77
- // CamelCase - underscore
78
- array('Craft_Foo', 'Craft_Foo'),
79
- array('Foo_Plugin', 'Foo_Plugin'),
80
- array('Craft_Foo_Plugin', 'Craft_Foo_Plugin'),
81
- );
82
- }
83
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php DELETED
@@ -1,90 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
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
13
- */
14
- private $installer;
15
-
16
- public function setUp()
17
- {
18
- $this->installer = new DokuWikiInstaller(
19
- new Package('NyanCat', '4.2', '4.2'),
20
- new Composer()
21
- );
22
- }
23
-
24
- /**
25
- * @dataProvider packageNameInflectionProvider
26
- */
27
- public function testInflectPackageVars($type, $name, $expected)
28
- {
29
- $this->assertEquals(
30
- $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)),
31
- array('name' => $expected, 'type'=>$type)
32
- );
33
- }
34
-
35
- public function packageNameInflectionProvider()
36
- {
37
- return array(
38
- array(
39
- 'dokuwiki-plugin',
40
- 'dokuwiki-test-plugin',
41
- 'test',
42
- ),
43
- array(
44
- 'dokuwiki-plugin',
45
- 'test-plugin',
46
- 'test',
47
- ),
48
- array(
49
- 'dokuwiki-plugin',
50
- 'dokuwiki_test',
51
- 'test',
52
- ),
53
- array(
54
- 'dokuwiki-plugin',
55
- 'test',
56
- 'test',
57
- ),
58
- array(
59
- 'dokuwiki-plugin',
60
- 'test-template',
61
- 'test-template',
62
- ),
63
- array(
64
- 'dokuwiki-template',
65
- 'dokuwiki-test-template',
66
- 'test',
67
- ),
68
- array(
69
- 'dokuwiki-template',
70
- 'test-template',
71
- 'test',
72
- ),
73
- array(
74
- 'dokuwiki-template',
75
- 'dokuwiki_test',
76
- 'test',
77
- ),
78
- array(
79
- 'dokuwiki-template',
80
- 'test',
81
- 'test',
82
- ),
83
- array(
84
- 'dokuwiki-template',
85
- 'test-plugin',
86
- 'test-plugin',
87
- ),
88
- );
89
- }
90
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
4
- use Composer\Composer;
5
- use Composer\Installers\GravInstaller;
6
-
7
- class GravInstallerTest extends TestCase
8
- {
9
- /* @var \Composer\Composer */
10
- protected $composer;
11
-
12
- public function setUp()
13
- {
14
- $this->composer = new Composer();
15
- }
16
-
17
- public function testInflectPackageVars()
18
- {
19
- $package = $this->getPackage('vendor/name', '0.0.0');
20
- $installer = new GravInstaller($package, $this->composer);
21
- $packageVars = $this->getPackageVars($package);
22
-
23
- $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => 'test')));
24
- $this->assertEquals('test', $result['name']);
25
-
26
- foreach ($installer->getLocations() as $name => $location) {
27
- $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test")));
28
- $this->assertEquals('test', $result['name']);
29
- $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-$name")));
30
- $this->assertEquals('test', $result['name']);
31
- $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test-test")));
32
- $this->assertEquals('test-test', $result['name']);
33
- $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-test-$name")));
34
- $this->assertEquals('test-test', $result['name']);
35
- $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test")));
36
- $this->assertEquals('test', $result['name']);
37
- $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-$name")));
38
- $this->assertEquals('test', $result['name']);
39
- $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test-test")));
40
- $this->assertEquals('test-test', $result['name']);
41
- $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-test-$name")));
42
- $this->assertEquals('test-test', $result['name']);
43
- }
44
- }
45
-
46
- /**
47
- * @param $package \Composer\Package\PackageInterface
48
- */
49
- public function getPackageVars($package)
50
- {
51
- $type = $package->getType();
52
-
53
- $prettyName = $package->getPrettyName();
54
- if (strpos($prettyName, '/') !== false) {
55
- list($vendor, $name) = explode('/', $prettyName);
56
- } else {
57
- $vendor = '';
58
- $name = $prettyName;
59
- }
60
-
61
- return compact('name', 'vendor', 'type');
62
- }
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php DELETED
@@ -1,552 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
4
- use Composer\Installers\Installer;
5
- use Composer\Util\Filesystem;
6
- use Composer\Package\Package;
7
- use Composer\Package\RootPackage;
8
- use Composer\Composer;
9
- use Composer\Config;
10
-
11
- class InstallerTest extends TestCase
12
- {
13
- private $composer;
14
- private $config;
15
- private $vendorDir;
16
- private $binDir;
17
- private $dm;
18
- private $repository;
19
- private $io;
20
- private $fs;
21
-
22
- /**
23
- * setUp
24
- *
25
- * @return void
26
- */
27
- public function setUp()
28
- {
29
- $this->fs = new Filesystem;
30
-
31
- $this->composer = new Composer();
32
- $this->config = new Config();
33
- $this->composer->setConfig($this->config);
34
-
35
- $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-vendor';
36
- $this->ensureDirectoryExistsAndClear($this->vendorDir);
37
-
38
- $this->binDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-bin';
39
- $this->ensureDirectoryExistsAndClear($this->binDir);
40
-
41
- $this->config->merge(array(
42
- 'config' => array(
43
- 'vendor-dir' => $this->vendorDir,
44
- 'bin-dir' => $this->binDir,
45
- ),
46
- ));
47
-
48
- $this->dm = $this->getMockBuilder('Composer\Downloader\DownloadManager')
49
- ->disableOriginalConstructor()
50
- ->getMock();
51
- $this->composer->setDownloadManager($this->dm);
52
-
53
- $this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
54
- $this->io = $this->getMock('Composer\IO\IOInterface');
55
- }
56
-
57
- /**
58
- * tearDown
59
- *
60
- * @return void
61
- */
62
- public function tearDown()
63
- {
64
- $this->fs->removeDirectory($this->vendorDir);
65
- $this->fs->removeDirectory($this->binDir);
66
- }
67
-
68
- /**
69
- * testSupports
70
- *
71
- * @return void
72
- *
73
- * @dataProvider dataForTestSupport
74
- */
75
- public function testSupports($type, $expected)
76
- {
77
- $installer = new Installer($this->io, $this->composer);
78
- $this->assertSame($expected, $installer->supports($type), sprintf('Failed to show support for %s', $type));
79
- }
80
-
81
- /**
82
- * dataForTestSupport
83
- */
84
- public function dataForTestSupport()
85
- {
86
- return array(
87
- array('agl-module', true),
88
- array('aimeos-extension', true),
89
- array('annotatecms-module', true),
90
- array('annotatecms-component', true),
91
- array('annotatecms-service', true),
92
- array('attogram-module', true),
93
- array('bitrix-module', true),
94
- array('bitrix-component', true),
95
- array('bitrix-theme', true),
96
- array('bonefish-package', true),
97
- array('cakephp', false),
98
- array('cakephp-', false),
99
- array('cakephp-app', false),
100
- array('cakephp-plugin', true),
101
- array('chef-cookbook', true),
102
- array('chef-role', true),
103
- array('cockpit-module', true),
104
- array('codeigniter-app', false),
105
- array('codeigniter-library', true),
106
- array('codeigniter-third-party', true),
107
- array('codeigniter-module', true),
108
- array('concrete5-block', true),
109
- array('concrete5-package', true),
110
- array('concrete5-theme', true),
111
- array('concrete5-core', true),
112
- array('concrete5-update', true),
113
- array('craft-plugin', true),
114
- array('croogo-plugin', true),
115
- array('croogo-theme', true),
116
- array('decibel-app', true),
117
- array('dokuwiki-plugin', true),
118
- array('dokuwiki-template', true),
119
- array('drupal-module', true),
120
- array('dolibarr-module', true),
121
- array('ee3-theme', true),
122
- array('ee3-addon', 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),
133
- array('fuel-package', true),
134
- array('fuel-theme', true),
135
- array('fuelphp-component', true),
136
- array('hurad-plugin', true),
137
- array('hurad-theme', true),
138
- array('imagecms-template', true),
139
- array('imagecms-module', true),
140
- array('imagecms-library', true),
141
- array('itop-extension', true),
142
- array('joomla-library', true),
143
- array('kanboard-plugin', true),
144
- array('kirby-plugin', true),
145
- array('kohana-module', true),
146
- array('lms-plugin', true),
147
- array('lms-template', true),
148
- array('lms-document-template', true),
149
- array('lms-userpanel-module', true),
150
- array('laravel-library', true),
151
- array('lavalite-theme', 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),
161
- array('modxevo-template', true),
162
- array('modxevo-lib', true),
163
- array('mediawiki-extension', true),
164
- array('mediawiki-skin', true),
165
- array('microweber-module', true),
166
- array('modulework-module', true),
167
- array('moodle-mod', 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),
176
- array('ppi-module', true),
177
- array('prestashop-module', true),
178
- array('prestashop-theme', true),
179
- array('puppet-module', true),
180
- array('porto-container', true),
181
- array('radphp-bundle', true),
182
- array('redaxo-addon', true),
183
- array('redaxo-bestyle-plugin', true),
184
- array('reindex-theme', true),
185
- array('reindex-plugin', true),
186
- array('roundcube-plugin', true),
187
- array('shopware-backend-plugin', true),
188
- array('shopware-core-plugin', true),
189
- array('shopware-frontend-plugin', true),
190
- array('shopware-theme', true),
191
- array('shopware-plugin', true),
192
- array('shopware-frontend-theme', true),
193
- array('silverstripe-module', true),
194
- array('silverstripe-theme', true),
195
- array('smf-module', true),
196
- array('smf-theme', true),
197
- array('sydes-module', true),
198
- array('sydes-theme', true),
199
- array('symfony1-plugin', true),
200
- array('thelia-module', true),
201
- array('thelia-frontoffice-template', true),
202
- array('thelia-backoffice-template', true),
203
- array('thelia-email-template', true),
204
- array('tusk-task', true),
205
- array('tusk-asset', true),
206
- array('typo3-flow-plugin', true),
207
- array('typo3-cms-extension', true),
208
- array('userfrosting-sprinkle', true),
209
- array('vanilla-plugin', true),
210
- array('vanilla-theme', true),
211
- array('whmcs-gateway', true),
212
- array('wolfcms-plugin', true),
213
- array('wordpress-plugin', true),
214
- array('wordpress-core', false),
215
- array('yawik-module', true),
216
- array('zend-library', true),
217
- array('zikula-module', true),
218
- array('zikula-theme', true),
219
- array('kodicms-plugin', true),
220
- array('kodicms-media', true),
221
- array('phifty-bundle', true),
222
- array('phifty-library', true),
223
- array('phifty-framework', true),
224
- array('osclass-plugin', true),
225
- array('osclass-theme', true),
226
- array('osclass-language', true),
227
- );
228
- }
229
-
230
- /**
231
- * testInstallPath
232
- *
233
- * @dataProvider dataForTestInstallPath
234
- */
235
- public function testInstallPath($type, $path, $name, $version = '1.0.0')
236
- {
237
- $installer = new Installer($this->io, $this->composer);
238
- $package = new Package($name, $version, $version);
239
-
240
- $package->setType($type);
241
- $result = $installer->getInstallPath($package);
242
- $this->assertEquals($path, $result);
243
- }
244
-
245
- /**
246
- * dataFormTestInstallPath
247
- */
248
- public function dataForTestInstallPath()
249
- {
250
- return array(
251
- array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'),
252
- array('aimeos-extension', 'ext/ai-test/', 'author/ai-test'),
253
- array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'),
254
- array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'),
255
- array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'),
256
- array('attogram-module', 'modules/my_module/', 'author/my_module'),
257
- array('bitrix-module', 'bitrix/modules/my_module/', 'author/my_module'),
258
- array('bitrix-component', 'bitrix/components/my_component/', 'author/my_component'),
259
- array('bitrix-theme', 'bitrix/templates/my_theme/', 'author/my_theme'),
260
- array('bitrix-d7-module', 'bitrix/modules/author.my_module/', 'author/my_module'),
261
- array('bitrix-d7-component', 'bitrix/components/author/my_component/', 'author/my_component'),
262
- array('bitrix-d7-template', 'bitrix/templates/author_my_template/', 'author/my_template'),
263
- array('bonefish-package', 'Packages/bonefish/package/', 'bonefish/package'),
264
- array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'),
265
- array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'),
266
- array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'),
267
- array('cockpit-module', 'cockpit/modules/addons/My_module/', 'piotr-cz/cockpit-my_module'),
268
- array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'),
269
- array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'),
270
- array('concrete5-block', 'application/blocks/concrete5_block/', 'remo/concrete5_block'),
271
- array('concrete5-package', 'packages/concrete5_package/', 'remo/concrete5_package'),
272
- array('concrete5-theme', 'application/themes/concrete5_theme/', 'remo/concrete5_theme'),
273
- array('concrete5-core', 'concrete/', 'concrete5/core'),
274
- array('concrete5-update', 'updates/concrete5/', 'concrete5/concrete5'),
275
- array('craft-plugin', 'craft/plugins/my_plugin/', 'mdcpepper/my_plugin'),
276
- array('croogo-plugin', 'Plugin/Sitemaps/', 'fahad19/sitemaps'),
277
- array('croogo-theme', 'View/Themed/Readable/', 'rchavik/readable'),
278
- array('decibel-app', 'app/someapp/', 'author/someapp'),
279
- array('dokuwiki-plugin', 'lib/plugins/someplugin/', 'author/someplugin'),
280
- array('dokuwiki-template', 'lib/tpl/sometemplate/', 'author/sometemplate'),
281
- array('dolibarr-module', 'htdocs/custom/my_module/', 'shama/my_module'),
282
- array('drupal-module', 'modules/my_module/', 'shama/my_module'),
283
- array('drupal-theme', 'themes/my_module/', 'shama/my_module'),
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'),
294
- array('ee2-theme', 'themes/third_party/ee_package/', 'author/ee_package'),
295
- array('ezplatform-assets', 'web/assets/ezplatform/ezplatform_comp/', 'author/ezplatform_comp'),
296
- array('ezplatform-meta-assets', 'web/assets/ezplatform/', 'author/ezplatform_comp'),
297
- array('fuel-module', 'fuel/app/modules/module/', 'fuel/module'),
298
- array('fuel-package', 'fuel/packages/orm/', 'fuel/orm'),
299
- array('fuel-theme', 'fuel/app/themes/theme/', 'fuel/theme'),
300
- array('fuelphp-component', 'components/demo/', 'fuelphp/demo'),
301
- array('hurad-plugin', 'plugins/Akismet/', 'atkrad/akismet'),
302
- array('hurad-theme', 'plugins/Hurad2013/', 'atkrad/Hurad2013'),
303
- array('imagecms-template', 'templates/my_template/', 'shama/my_template'),
304
- array('imagecms-module', 'application/modules/my_module/', 'shama/my_module'),
305
- array('imagecms-library', 'application/libraries/my_library/', 'shama/my_library'),
306
- array('itop-extension', 'extensions/my_extension/', 'shama/my_extension'),
307
- array('joomla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
308
- array('kanboard-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
309
- array('kirby-plugin', 'site/plugins/my_plugin/', 'shama/my_plugin'),
310
- array('kohana-module', 'modules/my_package/', 'shama/my_package'),
311
- array('lms-plugin', 'plugins/MyPackage/', 'shama/MyPackage'),
312
- array('lms-plugin', 'plugins/MyPackage/', 'shama/my_package'),
313
- array('lms-template', 'templates/MyPackage/', 'shama/MyPackage'),
314
- array('lms-template', 'templates/MyPackage/', 'shama/my_package'),
315
- array('lms-document-template', 'documents/templates/MyPackage/', 'shama/MyPackage'),
316
- array('lms-document-template', 'documents/templates/MyPackage/', 'shama/my_package'),
317
- array('lms-userpanel-module', 'userpanel/modules/MyPackage/', 'shama/MyPackage'),
318
- array('lms-userpanel-module', 'userpanel/modules/MyPackage/', 'shama/my_package'),
319
- array('laravel-library', 'libraries/my_package/', 'shama/my_package'),
320
- array('lavalite-theme', 'public/themes/my_theme/', 'shama/my_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'),
329
- array('modxevo-template', 'assets/templates/my_template/', 'shama/my_template'),
330
- array('modxevo-lib', 'assets/lib/my_lib/', 'shama/my_lib'),
331
- array('mako-package', 'app/packages/my_package/', 'shama/my_package'),
332
- array('mediawiki-extension', 'extensions/APC/', 'author/APC'),
333
- array('mediawiki-extension', 'extensions/APC/', 'author/APC-extension'),
334
- array('mediawiki-extension', 'extensions/UploadWizard/', 'author/upload-wizard'),
335
- array('mediawiki-extension', 'extensions/SyntaxHighlight_GeSHi/', 'author/syntax-highlight_GeSHi'),
336
- array('mediawiki-skin', 'skins/someskin/', 'author/someskin-skin'),
337
- array('mediawiki-skin', 'skins/someskin/', 'author/someskin'),
338
- array('microweber-module', 'userfiles/modules/my-thing/', 'author/my-thing-module'),
339
- array('modulework-module', 'modules/my_package/', 'shama/my_package'),
340
- array('moodle-mod', 'mod/my_package/', 'shama/my_package'),
341
- array('october-module', 'modules/my_plugin/', 'shama/my_plugin'),
342
- array('october-plugin', 'plugins/shama/my_plugin/', 'shama/my_plugin'),
343
- array('october-theme', 'themes/my_theme/', 'shama/my_theme'),
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'),
354
- array('pimcore-plugin', 'plugins/MyPlugin/', 'ubikz/my_plugin'),
355
- array('plentymarkets-plugin', 'HelloWorld/', 'plugin-hello-world'),
356
- array('ppi-module', 'modules/foo/', 'test/foo'),
357
- array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'),
358
- array('porto-container', 'app/Containers/container-name/', 'test/container-name'),
359
- array('radphp-bundle', 'src/Migration/', 'atkrad/migration'),
360
- array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'),
361
- array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'),
362
- array('reindex-theme', 'themes/my_module/', 'author/my_module'),
363
- array('reindex-plugin', 'plugins/my_module/', 'author/my_module'),
364
- array('roundcube-plugin', 'plugins/base/', 'test/base'),
365
- array('roundcube-plugin', 'plugins/replace_dash/', 'test/replace-dash'),
366
- array('shopware-backend-plugin', 'engine/Shopware/Plugins/Local/Backend/ShamaMyBackendPlugin/', 'shama/my-backend-plugin'),
367
- array('shopware-core-plugin', 'engine/Shopware/Plugins/Local/Core/ShamaMyCorePlugin/', 'shama/my-core-plugin'),
368
- array('shopware-frontend-plugin', 'engine/Shopware/Plugins/Local/Frontend/ShamaMyFrontendPlugin/', 'shama/my-frontend-plugin'),
369
- array('shopware-theme', 'templates/my_theme/', 'shama/my-theme'),
370
- array('shopware-frontend-theme', 'themes/Frontend/ShamaMyFrontendTheme/', 'shama/my-frontend-theme'),
371
- array('shopware-plugin', 'custom/plugins/ShamaMyPlugin/', 'shama/my-plugin'),
372
- array('silverstripe-module', 'my_module/', 'shama/my_module'),
373
- array('silverstripe-module', 'sapphire/', 'silverstripe/framework', '2.4.0'),
374
- array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0'),
375
- array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0-rc1'),
376
- array('silverstripe-module', 'framework/', 'silverstripe/framework', 'my/branch'),
377
- array('silverstripe-theme', 'themes/my_theme/', 'shama/my_theme'),
378
- array('smf-module', 'Sources/my_module/', 'shama/my_module'),
379
- array('smf-theme', 'Themes/my_theme/', 'shama/my_theme'),
380
- array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sfShamaPlugin'),
381
- array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sf-shama-plugin'),
382
- array('thelia-module', 'local/modules/my_module/', 'shama/my_module'),
383
- array('thelia-frontoffice-template', 'templates/frontOffice/my_template_fo/', 'shama/my_template_fo'),
384
- array('thelia-backoffice-template', 'templates/backOffice/my_template_bo/', 'shama/my_template_bo'),
385
- array('thelia-email-template', 'templates/email/my_template_email/', 'shama/my_template_email'),
386
- array('tusk-task', '.tusk/tasks/my_task/', 'shama/my_task'),
387
- array('typo3-flow-package', 'Packages/Application/my_package/', 'shama/my_package'),
388
- array('typo3-flow-build', 'Build/my_package/', 'shama/my_package'),
389
- array('typo3-cms-extension', 'typo3conf/ext/my_extension/', 'shama/my_extension'),
390
- array('userfrosting-sprinkle', 'app/sprinkles/my_sprinkle/', 'shama/my_sprinkle'),
391
- array('vanilla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
392
- array('vanilla-theme', 'themes/my_theme/', 'shama/my_theme'),
393
- array('whmcs-gateway', 'modules/gateways/gateway_name/', 'vendor/gateway_name'),
394
- array('wolfcms-plugin', 'wolf/plugins/my_plugin/', 'shama/my_plugin'),
395
- array('wordpress-plugin', 'wp-content/plugins/my_plugin/', 'shama/my_plugin'),
396
- array('wordpress-muplugin', 'wp-content/mu-plugins/my_plugin/', 'shama/my_plugin'),
397
- array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'),
398
- array('zikula-module', 'modules/my-test_module/', 'my/test_module'),
399
- array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'),
400
- array('kodicms-media', 'cms/media/vendor/my_media/', 'shama/my_media'),
401
- array('kodicms-plugin', 'cms/plugins/my_plugin/', 'shama/my_plugin'),
402
- array('phifty-bundle', 'bundles/core/', 'shama/core'),
403
- array('phifty-library', 'libraries/my-lib/', 'shama/my-lib'),
404
- array('phifty-framework', 'frameworks/my-framework/', 'shama/my-framework'),
405
- array('yawik-module', 'module/MyModule/', 'shama/my_module'),
406
- array('osclass-plugin', 'oc-content/plugins/sample_plugin/', 'test/sample_plugin'),
407
- array('osclass-theme', 'oc-content/themes/sample_theme/', 'test/sample_theme'),
408
- array('osclass-language', 'oc-content/languages/sample_lang/', 'test/sample_lang'),
409
- );
410
- }
411
-
412
- /**
413
- * testGetCakePHPInstallPathException
414
- *
415
- * @return void
416
- *
417
- * @expectedException \InvalidArgumentException
418
- */
419
- public function testGetCakePHPInstallPathException()
420
- {
421
- $installer = new Installer($this->io, $this->composer);
422
- $package = new Package('shama/ftp', '1.0.0', '1.0.0');
423
-
424
- $package->setType('cakephp-whoops');
425
- $result = $installer->getInstallPath($package);
426
- }
427
-
428
- /**
429
- * testCustomInstallPath
430
- */
431
- public function testCustomInstallPath()
432
- {
433
- $installer = new Installer($this->io, $this->composer);
434
- $package = new Package('shama/ftp', '1.0.0', '1.0.0');
435
- $package->setType('cakephp-plugin');
436
- $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
437
- $this->composer->setPackage($consumerPackage);
438
- $consumerPackage->setExtra(array(
439
- 'installer-paths' => array(
440
- 'my/custom/path/{$name}/' => array(
441
- 'shama/ftp',
442
- 'foo/bar',
443
- ),
444
- ),
445
- ));
446
- $result = $installer->getInstallPath($package);
447
- $this->assertEquals('my/custom/path/Ftp/', $result);
448
- }
449
-
450
- /**
451
- * testCustomInstallerName
452
- */
453
- public function testCustomInstallerName()
454
- {
455
- $installer = new Installer($this->io, $this->composer);
456
- $package = new Package('shama/cakephp-ftp-plugin', '1.0.0', '1.0.0');
457
- $package->setType('cakephp-plugin');
458
- $package->setExtra(array(
459
- 'installer-name' => 'FTP',
460
- ));
461
- $result = $installer->getInstallPath($package);
462
- $this->assertEquals('Plugin/FTP/', $result);
463
- }
464
-
465
- /**
466
- * testCustomTypePath
467
- */
468
- public function testCustomTypePath()
469
- {
470
- $installer = new Installer($this->io, $this->composer);
471
- $package = new Package('slbmeh/my_plugin', '1.0.0', '1.0.0');
472
- $package->setType('wordpress-plugin');
473
- $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
474
- $this->composer->setPackage($consumerPackage);
475
- $consumerPackage->setExtra(array(
476
- 'installer-paths' => array(
477
- 'my/custom/path/{$name}/' => array(
478
- 'type:wordpress-plugin'
479
- ),
480
- ),
481
- ));
482
- $result = $installer->getInstallPath($package);
483
- $this->assertEquals('my/custom/path/my_plugin/', $result);
484
- }
485
-
486
- /**
487
- * testVendorPath
488
- */
489
- public function testVendorPath()
490
- {
491
- $installer = new Installer($this->io, $this->composer);
492
- $package = new Package('penyaskito/my_module', '1.0.0', '1.0.0');
493
- $package->setType('drupal-module');
494
- $consumerPackage = new RootPackage('drupal/drupal', '1.0.0', '1.0.0');
495
- $this->composer->setPackage($consumerPackage);
496
- $consumerPackage->setExtra(array(
497
- 'installer-paths' => array(
498
- 'modules/custom/{$name}/' => array(
499
- 'vendor:penyaskito'
500
- ),
501
- ),
502
- ));
503
- $result = $installer->getInstallPath($package);
504
- $this->assertEquals('modules/custom/my_module/', $result);
505
- }
506
-
507
- /**
508
- * testNoVendorName
509
- */
510
- public function testNoVendorName()
511
- {
512
- $installer = new Installer($this->io, $this->composer);
513
- $package = new Package('sfPhpunitPlugin', '1.0.0', '1.0.0');
514
-
515
- $package->setType('symfony1-plugin');
516
- $result = $installer->getInstallPath($package);
517
- $this->assertEquals('plugins/sfPhpunitPlugin/', $result);
518
- }
519
-
520
- /**
521
- * testTypo3Inflection
522
- */
523
- public function testTypo3Inflection()
524
- {
525
- $installer = new Installer($this->io, $this->composer);
526
- $package = new Package('typo3/fluid', '1.0.0', '1.0.0');
527
-
528
- $package->setAutoload(array(
529
- 'psr-0' => array(
530
- 'TYPO3\\Fluid' => 'Classes',
531
- ),
532
- ));
533
-
534
- $package->setType('typo3-flow-package');
535
- $result = $installer->getInstallPath($package);
536
- $this->assertEquals('Packages/Application/TYPO3.Fluid/', $result);
537
- }
538
-
539
- public function testUninstallAndDeletePackageFromLocalRepo()
540
- {
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));
548
- $repo->expects($this->once())->method('removePackage')->with($package);
549
-
550
- $installer->uninstall($repo, $package);
551
- }
552
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php DELETED
@@ -1,62 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
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
13
- */
14
- private $installer;
15
-
16
- public function setUp()
17
- {
18
- $this->installer = new MayaInstaller(
19
- new Package('NyanCat', '4.2', '4.2'),
20
- new Composer()
21
- );
22
- }
23
-
24
- /**
25
- * @dataProvider packageNameInflectionProvider
26
- */
27
- public function testInflectPackageVars($type, $name, $expected)
28
- {
29
- $this->assertEquals(
30
- array('name' => $expected, 'type' => $type),
31
- $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
32
- );
33
- }
34
-
35
- public function packageNameInflectionProvider()
36
- {
37
- return array(
38
- // Should keep module name StudlyCase
39
- array(
40
- 'maya-module',
41
- 'user-profile',
42
- 'UserProfile'
43
- ),
44
- array(
45
- 'maya-module',
46
- 'maya-module',
47
- 'Maya'
48
- ),
49
- array(
50
- 'maya-module',
51
- 'blog',
52
- 'Blog'
53
- ),
54
- // tests that exactly one '-module' is cut off
55
- array(
56
- 'maya-module',
57
- 'some-module-module',
58
- 'SomeModule',
59
- ),
60
- );
61
- }
62
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
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
13
- */
14
- private $installer;
15
-
16
- public function setUp()
17
- {
18
- $this->installer = new MediaWikiInstaller(
19
- new Package('NyanCat', '4.2', '4.2'),
20
- new Composer()
21
- );
22
- }
23
-
24
- /**
25
- * @dataProvider packageNameInflectionProvider
26
- */
27
- public function testInflectPackageVars($type, $name, $expected)
28
- {
29
- $this->assertEquals(
30
- $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)),
31
- array('name' => $expected, 'type'=>$type)
32
- );
33
- }
34
-
35
- public function packageNameInflectionProvider()
36
- {
37
- return array(
38
- array(
39
- 'mediawiki-extension',
40
- 'sub-page-list',
41
- 'SubPageList',
42
- ),
43
- array(
44
- 'mediawiki-extension',
45
- 'sub-page-list-extension',
46
- 'SubPageList',
47
- ),
48
- array(
49
- 'mediawiki-extension',
50
- 'semantic-mediawiki',
51
- 'SemanticMediawiki',
52
- ),
53
- // tests that exactly one '-skin' is cut off, and that skins do not get ucwords treatment like extensions
54
- array(
55
- 'mediawiki-skin',
56
- 'some-skin-skin',
57
- 'some-skin',
58
- ),
59
- // tests that names without '-skin' suffix stay valid
60
- array(
61
- 'mediawiki-skin',
62
- 'someotherskin',
63
- 'someotherskin',
64
- ),
65
- );
66
- }
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
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
13
- */
14
- private $installer;
15
-
16
- public function setUp()
17
- {
18
- $this->installer = new OctoberInstaller(
19
- new Package('NyanCat', '4.2', '4.2'),
20
- new Composer()
21
- );
22
- }
23
-
24
- /**
25
- * @dataProvider packageNameInflectionProvider
26
- */
27
- public function testInflectPackageVars($type, $name, $expected)
28
- {
29
- $this->assertEquals(
30
- $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)),
31
- array('name' => $expected, 'type' => $type)
32
- );
33
- }
34
-
35
- public function packageNameInflectionProvider()
36
- {
37
- return array(
38
- array(
39
- 'october-plugin',
40
- 'subpagelist',
41
- 'subpagelist',
42
- ),
43
- array(
44
- 'october-plugin',
45
- 'subpagelist-plugin',
46
- 'subpagelist',
47
- ),
48
- array(
49
- 'october-plugin',
50
- 'semanticoctober',
51
- 'semanticoctober',
52
- ),
53
- // tests that exactly one '-theme' is cut off
54
- array(
55
- 'october-theme',
56
- 'some-theme-theme',
57
- 'some-theme',
58
- ),
59
- // tests that names without '-theme' suffix stay valid
60
- array(
61
- 'october-theme',
62
- 'someothertheme',
63
- 'someothertheme',
64
- ),
65
- );
66
- }
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/OntoWikiInstallerTest.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
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
15
- */
16
- private $installer;
17
-
18
- public function setUp()
19
- {
20
- $this->installer = new OntoWikiInstaller();
21
- }
22
-
23
- /**
24
- * @dataProvider packageNameInflectionProvider
25
- */
26
- public function testInflectPackageVars($type, $name, $expected)
27
- {
28
- $this->assertEquals(
29
- $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)),
30
- array('name' => $expected, 'type'=>$type)
31
- );
32
- }
33
-
34
- public function packageNameInflectionProvider()
35
- {
36
- return array(
37
- array(
38
- 'ontowiki-extension',
39
- 'CSVImport.ontowiki',
40
- 'csvimport',
41
- ),
42
- array(
43
- 'ontowiki-extension',
44
- 'csvimport',
45
- 'csvimport',
46
- ),
47
- array(
48
- 'ontowiki-extension',
49
- 'some_ontowiki_extension',
50
- 'some_ontowiki_extension',
51
- ),
52
- array(
53
- 'ontowiki-extension',
54
- 'some_ontowiki_extension.ontowiki',
55
- 'some_ontowiki_extension',
56
- ),
57
- array(
58
- 'ontowiki-translation',
59
- 'de-translation.ontowiki',
60
- 'de',
61
- ),
62
- array(
63
- 'ontowiki-translation',
64
- 'en-US-translation.ontowiki',
65
- 'en-us',
66
- ),
67
- array(
68
- 'ontowiki-translation',
69
- 'en-US-translation',
70
- 'en-us',
71
- ),
72
- array(
73
- 'ontowiki-theme',
74
- 'blue-theme.ontowiki',
75
- 'blue',
76
- ),
77
- array(
78
- 'ontowiki-theme',
79
- 'blue-theme',
80
- 'blue',
81
- ),
82
- );
83
- }
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
4
- use Composer\Installers\PimcoreInstaller;
5
- use Composer\Package\Package;
6
- use Composer\Composer;
7
-
8
- class PimcoreInstallerTest extends TestCase
9
- {
10
- private $composer;
11
- private $io;
12
-
13
- /**
14
- * setUp
15
- *
16
- * @return void
17
- */
18
- public function setUp()
19
- {
20
- $this->package = new Package('CamelCased', '1.0', '1.0');
21
- $this->io = $this->getMock('Composer\IO\PackageInterface');
22
- $this->composer = new Composer();
23
- }
24
-
25
- /**
26
- * testInflectPackageVars
27
- *
28
- * @return void
29
- */
30
- public function testInflectPackageVars()
31
- {
32
- $installer = new PimcoreInstaller($this->package, $this->composer);
33
- $result = $installer->inflectPackageVars(array('name' => 'CamelCased'));
34
- $this->assertEquals($result, array('name' => 'CamelCased'));
35
-
36
- $installer = new PimcoreInstaller($this->package, $this->composer);
37
- $result = $installer->inflectPackageVars(array('name' => 'with-dash'));
38
- $this->assertEquals($result, array('name' => 'WithDash'));
39
-
40
- $installer = new PimcoreInstaller($this->package, $this->composer);
41
- $result = $installer->inflectPackageVars(array('name' => 'with_underscore'));
42
- $this->assertEquals($result, array('name' => 'WithUnderscore'));
43
- }
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
4
- use Composer\Composer;
5
- use Composer\Installers\PiwikInstaller;
6
- use Composer\Package\Package;
7
- use Composer\Package\PackageInterface;
8
-
9
- /**
10
- * Class PiwikInstallerTest
11
- *
12
- * @package Composer\Installers\Test
13
- */
14
- class PiwikInstallerTest extends TestCase
15
- {
16
- /**
17
- * @varComposer
18
- */
19
- private $composer;
20
-
21
- /**
22
- * @var PackageInterface
23
- */
24
- private $io;
25
-
26
- /**
27
- * @var Package
28
- */
29
- private $package;
30
-
31
- /**
32
- * setUp
33
- *
34
- * @return void
35
- */
36
- public function setUp()
37
- {
38
- $this->package = new Package('VisitSummary', '1.0', '1.0');
39
- $this->io = $this->getMock('Composer\IO\PackageInterface');
40
- $this->composer = new Composer();
41
- }
42
-
43
- /**
44
- * testInflectPackageVars
45
- *
46
- * @return void
47
- */
48
- public function testInflectPackageVars()
49
- {
50
- $installer = new PiwikInstaller($this->package, $this->composer);
51
- $result = $installer->inflectPackageVars(array('name' => 'VisitSummary'));
52
- $this->assertEquals($result, array('name' => 'VisitSummary'));
53
-
54
- $installer = new PiwikInstaller($this->package, $this->composer);
55
- $result = $installer->inflectPackageVars(array('name' => 'visit-summary'));
56
- $this->assertEquals($result, array('name' => 'VisitSummary'));
57
-
58
- $installer = new PiwikInstaller($this->package, $this->composer);
59
- $result = $installer->inflectPackageVars(array('name' => 'visit_summary'));
60
- $this->assertEquals($result, array('name' => 'VisitSummary'));
61
- }
62
-
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/SiteDirectInstallerTest.php DELETED
@@ -1,120 +0,0 @@
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 DELETED
@@ -1,82 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
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
13
- */
14
- private $installer;
15
-
16
- public function setUp()
17
- {
18
- $this->installer = new SyDESInstaller(
19
- new Package('NyanCat', '4.2', '4.2'),
20
- new Composer()
21
- );
22
- }
23
-
24
- /**
25
- * @dataProvider packageNameInflectionProvider
26
- */
27
- public function testInflectPackageVars($type, $name, $expected)
28
- {
29
- $this->assertEquals(
30
- array('name' => $expected, 'type' => $type),
31
- $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
32
- );
33
- }
34
-
35
- public function packageNameInflectionProvider()
36
- {
37
- return array(
38
- // modules
39
- array(
40
- 'sydes-module',
41
- 'name',
42
- 'Name'
43
- ),
44
- array(
45
- 'sydes-module',
46
- 'sample-name',
47
- 'SampleName'
48
- ),
49
- array(
50
- 'sydes-module',
51
- 'sydes-name',
52
- 'Name'
53
- ),
54
- array(
55
- 'sydes-module',
56
- 'sample-name-module',
57
- 'SampleName',
58
- ),
59
- array(
60
- 'sydes-module',
61
- 'sydes-sample-name-module',
62
- 'SampleName'
63
- ),
64
- // themes
65
- array(
66
- 'sydes-theme',
67
- 'some-theme-theme',
68
- 'some-theme',
69
- ),
70
- array(
71
- 'sydes-theme',
72
- 'sydes-sometheme',
73
- 'sometheme',
74
- ),
75
- array(
76
- 'sydes-theme',
77
- 'Sample-Name',
78
- 'sample-name'
79
- ),
80
- );
81
- }
82
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Composer.
5
- *
6
- * (c) Nils Adermann <naderman@naderman.de>
7
- * Jordi Boggiano <j.boggiano@seld.be>
8
- *
9
- * For the full copyright and license information, please view the LICENSE
10
- * file that was distributed with this source code.
11
- */
12
-
13
- namespace Composer\Installers\Test;
14
-
15
- use Composer\Package\Version\VersionParser;
16
- use Composer\Package\Package;
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
-
26
- protected static function getVersionParser()
27
- {
28
- if (!self::$parser) {
29
- self::$parser = new VersionParser();
30
- }
31
-
32
- return self::$parser;
33
- }
34
-
35
- protected function getVersionConstraint($operator, $version)
36
- {
37
- return new VersionConstraint(
38
- $operator,
39
- self::getVersionParser()->normalize($version)
40
- );
41
- }
42
-
43
- protected function getPackage($name, $version)
44
- {
45
- $normVersion = self::getVersionParser()->normalize($version);
46
-
47
- return new Package($name, $normVersion, $version);
48
- }
49
-
50
- protected function getAliasPackage($package, $version)
51
- {
52
- $normVersion = self::getVersionParser()->normalize($version);
53
-
54
- return new AliasPackage($package, $normVersion, $version);
55
- }
56
-
57
- protected function ensureDirectoryExistsAndClear($directory)
58
- {
59
- $fs = new Filesystem();
60
- if (is_dir($directory)) {
61
- $fs->removeDirectory($directory);
62
- }
63
- mkdir($directory, 0777, true);
64
- }
65
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.php DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
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
13
- */
14
- private $installer;
15
-
16
- public function setUp()
17
- {
18
- $this->installer = new VgmcpInstaller(
19
- new Package('NyanCat', '4.2', '4.2'),
20
- new Composer()
21
- );
22
- }
23
-
24
- /**
25
- * @dataProvider packageNameInflectionProvider
26
- */
27
- public function testInflectPackageVars($type, $name, $expected)
28
- {
29
- $this->assertEquals(
30
- array('name' => $expected, 'type' => $type),
31
- $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
32
- );
33
- }
34
-
35
- public function packageNameInflectionProvider()
36
- {
37
- return array(
38
- // Should keep bundle name StudlyCase
39
- array(
40
- 'vgmcp-bundle',
41
- 'user-profile',
42
- 'UserProfile'
43
- ),
44
- array(
45
- 'vgmcp-bundle',
46
- 'vgmcp-bundle',
47
- 'Vgmcp'
48
- ),
49
- array(
50
- 'vgmcp-bundle',
51
- 'blog',
52
- 'Blog'
53
- ),
54
- // tests that exactly one '-bundle' is cut off
55
- array(
56
- 'vgmcp-bundle',
57
- 'some-bundle-bundle',
58
- 'SomeBundle',
59
- ),
60
- // tests that exactly one '-theme' is cut off
61
- array(
62
- 'vgmcp-theme',
63
- 'some-theme-theme',
64
- 'SomeTheme',
65
- ),
66
- // tests that names without '-theme' suffix stay valid
67
- array(
68
- 'vgmcp-theme',
69
- 'someothertheme',
70
- 'Someothertheme',
71
- ),
72
- // Should keep theme name StudlyCase
73
- array(
74
- 'vgmcp-theme',
75
- 'adminlte-advanced',
76
- 'AdminlteAdvanced'
77
- ),
78
- );
79
- }
80
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
- namespace Composer\Installers\Test;
3
-
4
- use Composer\Composer;
5
- use Composer\Installers\YawikInstaller;
6
- use Composer\Package\Package;
7
- use Composer\Package\PackageInterface;
8
-
9
- /**
10
- * Class YawikInstallerTest
11
- *
12
- * @package Composer\Installers\Test
13
- */
14
- class YawikInstallerTest extends TestCase
15
- {
16
- /**
17
- * @varComposer
18
- */
19
- private $composer;
20
-
21
- /**
22
- * @var PackageInterface
23
- */
24
- private $io;
25
-
26
- /**
27
- * @var Package
28
- */
29
- private $package;
30
-
31
- /**
32
- * setUp
33
- *
34
- * @return void
35
- */
36
- public function setUp()
37
- {
38
- $this->package = new Package('YawikCompanyRegistration', '1.0', '1.0');
39
- $this->io = $this->getMock('Composer\IO\PackageInterface');
40
- $this->composer = new Composer();
41
- }
42
-
43
- /**
44
- * testInflectPackageVars
45
- *
46
- * @dataProvider packageNameProvider
47
- * @return void
48
- */
49
- public function testInflectPackageVars($input)
50
- {
51
- $installer = new YawikInstaller($this->package, $this->composer);
52
- $result = $installer->inflectPackageVars(array('name' => $input));
53
- $this->assertEquals($result, array('name' => 'YawikCompanyRegistration'));
54
- }
55
-
56
- public function packageNameProvider()
57
- {
58
- return array(
59
- array('yawik-company-registration'),
60
- array('yawik_company_registration'),
61
- array('YawikCompanyRegistration')
62
- );
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installers/tests/bootstrap.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
-
3
- $loader = require __DIR__ . '/../src/bootstrap.php';
4
- $loader->add('Composer\Installers\Test', __DIR__);