Advanced Ads - Version 1.28.0

Version Description

  • Improvement: add an inline attribute to the the_ad shortcode that allows the user to change the wrapper from div to span
  • Improvement: update plugin updater class
  • Improvement: rename "Item" option into "Ad / Group" to clarify its purpose
  • Improvement: show a link to create a new ad on the placement page
  • Improvement: show content placements first when creating a new one
  • Improvement: remove welcome panel on ad edit screen
  • Improvement: rename last button in the wizard to "Save" to highlight that this is the last step
  • Fix: wrap advanced_ads_ready_queue in an IIEF to prevent naming collisions
Download this release

Release Info

Developer advancedads
Plugin Icon 128x128 Advanced Ads
Version 1.28.0
Comparing to
See all releases

Code changes from version 1.27.0 to 1.28.0

.phpcs.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="AdvAds_CodeSniffer">
3
+ <description>Advanced Ads Coding Standards.</description>
4
+
5
+ <!-- FILES -->
6
+ <exclude-pattern>*/vendor/*</exclude-pattern>
7
+ <exclude-pattern>lib/*</exclude-pattern>
8
+ <exclude-pattern>classes/EDD_SL_Plugin_Updater.php</exclude-pattern>
9
+
10
+ <!-- RULE -->
11
+ <rule ref="./vendor/advanced-ads/build-tools/src/AdvancedAds/"/>
12
+ </ruleset>
admin/includes/class-notices.php CHANGED
@@ -333,6 +333,15 @@ class Advanced_Ads_Admin_Notices {
333
  }
334
  }
335
 
 
 
 
 
 
 
 
 
 
336
  // load notices.
337
  include ADVADS_BASE_PATH . '/admin/includes/notices.php';
338
 
333
  }
334
  }
335
 
336
+ // hide the welcome panel on the ad edit page
337
+ $screen = get_current_screen();
338
+ if ( isset( $screen->id ) && $screen->id === 'advanced_ads' ) {
339
+ $intro_key = array_search( 'nl_intro', $this->notices, true );
340
+ if ( $intro_key ) {
341
+ unset( $this->notices[ $intro_key ] );
342
+ }
343
+ }
344
+
345
  // load notices.
346
  include ADVADS_BASE_PATH . '/admin/includes/notices.php';
347
 
admin/includes/class-overview-widgets.php CHANGED
@@ -447,7 +447,7 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
447
  public static function render_addons( $hide_activated = false ) {
448
  if ( ! $hide_activated ) :
449
  ?>
450
- <p><a href="<?php echo esc_url( ADVADS_URL ) . 'manual/how-to-install-an-add-on/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-install-add-ons'; ?>" target="_blank"><?php echo esc_attr__( 'How to install and activate an add-on.', 'advanced-ads' ); ?></a></p>
451
  <?php
452
  endif;
453
 
447
  public static function render_addons( $hide_activated = false ) {
448
  if ( ! $hide_activated ) :
449
  ?>
450
+ <p><a href="<?php echo esc_url( ADVADS_URL ) . 'manual/how-to-install-an-add-on/?utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-install-add-ons'; ?>" target="_blank"><?php echo esc_attr__( 'How to download, install and activate an add-on.', 'advanced-ads' ); ?></a></p>
451
  <?php
452
  endif;
453
 
admin/views/ad-info-bottom.php CHANGED
@@ -14,12 +14,7 @@
14
  ?><div id="advads-wizard-controls" class="hidden">
15
  <button type="button" id="advads-wizard-controls-prev" class="button button-secondary button-large"><span class="dashicons dashicons-controls-back"></span>&nbsp;<?php echo esc_attr_x( 'previous', 'wizard navigation', 'advanced-ads' ); ?></button>
16
  <button id="advads-wizard-controls-save" class="button button-primary button-large">
17
- <?php
18
- // display different message depending on a new ad (filter = raw) or an existing one.
19
- echo $post->filter === 'raw'
20
- ? esc_attr_x( 'next', 'wizard navigation', 'advanced-ads' )
21
- : esc_attr_x( 'save', 'wizard navigation', 'advanced-ads' );
22
- ?>
23
  <span class="dashicons dashicons-controls-forward"></span>
24
  </button>
25
  <button type="button" id="advads-wizard-controls-next" class="button button-primary button-large"><?php echo esc_attr_x( 'next', 'wizard navigation', 'advanced-ads' ); ?>&nbsp;<span class="dashicons dashicons-controls-forward"></span></button>
14
  ?><div id="advads-wizard-controls" class="hidden">
15
  <button type="button" id="advads-wizard-controls-prev" class="button button-secondary button-large"><span class="dashicons dashicons-controls-back"></span>&nbsp;<?php echo esc_attr_x( 'previous', 'wizard navigation', 'advanced-ads' ); ?></button>
16
  <button id="advads-wizard-controls-save" class="button button-primary button-large">
17
+ <?php echo esc_attr_x( 'save', 'wizard navigation', 'advanced-ads' ); ?>
 
 
 
 
 
18
  <span class="dashicons dashicons-controls-forward"></span>
19
  </button>
20
  <button type="button" id="advads-wizard-controls-next" class="button button-primary button-large"><?php echo esc_attr_x( 'next', 'wizard navigation', 'advanced-ads' ); ?>&nbsp;<span class="dashicons dashicons-controls-forward"></span></button>
admin/views/placement-injection-top.php CHANGED
@@ -79,8 +79,8 @@ $is_page_level_ad_in_code_field = ( isset( $ad->type ) && 'plain' === $ad->type
79
  <div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="post_top" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-before.png'; ?>)"><?php esc_html_e( 'Before Content', 'advanced-ads' ); ?></button></div>
80
  <div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="post_content" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-within.png'; ?>)"><?php esc_html_e( 'Content', 'advanced-ads' ); ?></button></div>
81
  <div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="post_bottom" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-after.png'; ?>)"><?php esc_html_e( 'After Content', 'advanced-ads' ); ?></button></div>
82
- <div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="default" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/manual.png'; ?>)"><?php esc_html_e( 'PHP or Shortcode', 'advanced-ads' ); ?></button></div>
83
  <a href="<?php echo esc_url( admin_url( 'widgets.php' ) ); ?>"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/widget.png'; ?>)"><?php esc_html_e( 'Manage Sidebar', 'advanced-ads' ); ?></button></div></a>
 
84
  <a href="<?php echo esc_url( ADVADS_URL ) . 'place-ads-in-website-header/#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-placements'; ?>" target="_blank"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/ads-in-header.png'; ?>)"><?php esc_html_e( 'Header (Manual)', 'advanced-ads' ); ?></button></div></a>
85
  <?php
86
  if ( ! defined( 'AAP_VERSION' ) ) :
79
  <div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="post_top" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-before.png'; ?>)"><?php esc_html_e( 'Before Content', 'advanced-ads' ); ?></button></div>
80
  <div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="post_content" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-within.png'; ?>)"><?php esc_html_e( 'Content', 'advanced-ads' ); ?></button></div>
81
  <div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="post_bottom" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/content-after.png'; ?>)"><?php esc_html_e( 'After Content', 'advanced-ads' ); ?></button></div>
 
82
  <a href="<?php echo esc_url( admin_url( 'widgets.php' ) ); ?>"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/widget.png'; ?>)"><?php esc_html_e( 'Manage Sidebar', 'advanced-ads' ); ?></button></div></a>
83
+ <div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" data-placement-type="default" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/manual.png'; ?>)"><?php esc_html_e( 'PHP or Shortcode', 'advanced-ads' ); ?></button></div>
84
  <a href="<?php echo esc_url( ADVADS_URL ) . 'place-ads-in-website-header/#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-placements'; ?>" target="_blank"><div class="advads-ad-injection-box-button-wrap"><button type="button" class="advads-ad-injection-button button-primary" style="background-image: url(<?php echo esc_url( ADVADS_BASE_URL ) . 'admin/assets/img/placements/ads-in-header.png'; ?>)"><?php esc_html_e( 'Header (Manual)', 'advanced-ads' ); ?></button></div></a>
85
  <?php
86
  if ( ! defined( 'AAP_VERSION' ) ) :
admin/views/placements-item.php CHANGED
@@ -81,3 +81,9 @@ if ( $placement_item_type ) :
81
  <?php
82
  }
83
  endif;
 
 
 
 
 
 
81
  <?php
82
  }
83
  endif;
84
+ // show a button when no ads exist, yet
85
+ if ( empty( $items ) ) :
86
+ ?>
87
+ <a class="button" href="<?php echo esc_url( admin_url( 'post-new.php?post_type=advanced_ads' ) ); ?>"><?php esc_html_e( 'Create your first ad', 'advanced-ads' ); ?></a>
88
+ <?php
89
+ endif;
admin/views/placements.php CHANGED
@@ -340,7 +340,12 @@ $quick_actions['delete'] = '<a style="cursor: pointer;" class="advads-delete-tag
340
 
341
  Advanced_Ads_Admin_Options::render_option(
342
  'placement-item',
343
- __( 'Item', 'advanced-ads' ),
 
 
 
 
 
344
  $item_option_content
345
  );
346
  switch ( $_placement['type'] ) :
340
 
341
  Advanced_Ads_Admin_Options::render_option(
342
  'placement-item',
343
+ // translators: 1: "Ad", 2: "Group"
344
+ sprintf(
345
+ '%1$s / %2$s',
346
+ __( 'Ad', 'advanced-ads' ),
347
+ __( 'Group', 'advanced-ads' )
348
+ ),
349
  $item_option_content
350
  );
351
  switch ( $_placement['type'] ) :
advanced-ads.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
- * Version: 1.27.0
16
  * Author: Thomas Maier, Advanced Ads GmbH
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
@@ -39,7 +39,7 @@ define( 'ADVADS_BASE_DIR', dirname( ADVADS_BASE ) ); // directory of the plugin
39
  // general and global slug, e.g. to store options in WP.
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
- define( 'ADVADS_VERSION', '1.27.0' );
43
 
44
  // Autoloading, modules and functions.
45
 
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: https://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.28.0
16
  * Author: Thomas Maier, Advanced Ads GmbH
17
  * Author URI: https://wpadvancedads.com
18
  * Text Domain: advanced-ads
39
  // general and global slug, e.g. to store options in WP.
40
  define( 'ADVADS_SLUG', 'advanced-ads' );
41
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
42
+ define( 'ADVADS_VERSION', '1.28.0' );
43
 
44
  // Autoloading, modules and functions.
45
 
classes/EDD_SL_Plugin_Updater.php CHANGED
@@ -1,35 +1,33 @@
1
  <?php
2
 
3
- // Exit if accessed directly
4
- if ( ! defined( 'ABSPATH' ) ) exit;
5
-
6
  /**
7
  * Allows plugins to use their own update API.
8
  *
9
- * @author Easy Digital Downloads
10
- * @version 1.8.0
11
  */
12
  class ADVADS_SL_Plugin_Updater {
13
 
14
- private $api_url = '';
15
- private $api_data = array();
16
- private $name = '';
17
- private $slug = '';
18
- private $version = '';
19
- private $wp_override = false;
20
- private $cache_key = '';
21
-
22
  private $health_check_timeout = 5;
23
 
24
  /**
25
  * Class constructor.
26
  *
27
- * @uses plugin_basename()
 
 
 
28
  * @uses hook()
29
  *
30
- * @param string $_api_url The URL pointing to the custom API endpoint.
31
- * @param string $_plugin_file Path to the plugin file.
32
- * @param array $_api_data Optional data to send with API calls.
33
  */
34
  public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
35
 
@@ -37,44 +35,42 @@ class ADVADS_SL_Plugin_Updater {
37
 
38
  $this->api_url = trailingslashit( $_api_url );
39
  $this->api_data = $_api_data;
 
40
  $this->name = plugin_basename( $_plugin_file );
41
  $this->slug = basename( $_plugin_file, '.php' );
42
  $this->version = $_api_data['version'];
43
  $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
44
  $this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
45
- $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
46
 
47
  $edd_plugin_data[ $this->slug ] = $this->api_data;
48
 
49
  /**
50
  * Fires after the $edd_plugin_data is setup.
51
  *
 
 
52
  * @since x.x.x
53
  *
54
- * @param array $edd_plugin_data Array of EDD SL plugin data.
55
  */
56
  do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
57
 
58
  // Set up hooks.
59
  $this->init();
60
-
61
  }
62
 
63
  /**
64
  * Set up WordPress filters to hook into WP's update process.
65
  *
 
66
  * @uses add_filter()
67
  *
68
- * @return void
69
  */
70
  public function init() {
71
 
72
  add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
73
  add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
74
- remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
75
- add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
76
  add_action( 'admin_init', array( $this, 'show_changelog' ) );
77
-
78
  }
79
 
80
  /**
@@ -85,21 +81,18 @@ class ADVADS_SL_Plugin_Updater {
85
  * It is reassembled from parts of the native WordPress plugin update code.
86
  * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
87
  *
88
- * @uses api_request()
89
- *
90
  * @param array $_transient_data Update array build by WordPress.
 
91
  * @return array Modified update array with custom plugin data.
 
 
92
  */
93
  public function check_update( $_transient_data ) {
94
 
95
  global $pagenow;
96
 
97
  if ( ! is_object( $_transient_data ) ) {
98
- $_transient_data = new stdClass;
99
- }
100
-
101
- if ( 'plugins.php' == $pagenow && is_multisite() ) {
102
- return $_transient_data;
103
  }
104
 
105
  if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
@@ -125,7 +118,7 @@ class ADVADS_SL_Plugin_Updater {
125
  * Get repo API data from store.
126
  * Save to cache.
127
  *
128
- * @return stdClass
129
  */
130
  public function get_repo_api_data() {
131
  $version_info = $this->get_cached_version_info();
@@ -153,146 +146,143 @@ class ADVADS_SL_Plugin_Updater {
153
  }
154
 
155
  /**
156
- * Show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
157
  *
158
- * @param string $file needs to be explained by EDD.
159
- * @param array $plugin needs to be explained by EDD.
160
  */
161
  public function show_update_notification( $file, $plugin ) {
162
 
163
- if ( is_network_admin() ) {
164
- return;
165
- }
166
-
167
- if( ! current_user_can( 'update_plugins' ) ) {
168
  return;
169
  }
170
 
171
- if( ! is_multisite() ) {
172
  return;
173
  }
174
 
175
- if ( $this->name != $file ) {
176
  return;
177
  }
178
 
179
- // Remove our filter on the site transient
180
- remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
181
-
182
  $update_cache = get_site_transient( 'update_plugins' );
183
 
184
- $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
185
-
186
- if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
187
-
188
- $version_info = $this->get_repo_api_data();
189
-
190
- if ( false === $version_info ) {
191
- $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
192
-
193
- // Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
194
- if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
195
- $version_info->banners = $this->convert_object_to_array( $version_info->banners );
196
- }
197
-
198
- if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
199
- $version_info->sections = $this->convert_object_to_array( $version_info->sections );
200
- }
201
-
202
- if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
203
- $version_info->icons = $this->convert_object_to_array( $version_info->icons );
204
- }
205
-
206
- if ( isset( $version_info->contributors ) && ! is_array( $version_info->contributors ) ) {
207
- $version_info->contributors = $this->convert_object_to_array( $version_info->contributors );
208
- }
209
-
210
- $this->set_version_info_cache( $version_info );
211
- }
212
-
213
- if ( ! is_object( $version_info ) ) {
214
- return;
215
- }
216
-
217
- if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
218
- $update_cache->response[ $this->name ] = $version_info;
219
- } else {
220
- $update_cache->no_update[ $this->name ] = $version_info;
221
  }
 
 
222
 
223
- $update_cache->last_checked = time();
224
- $update_cache->checked[ $this->name ] = $this->version;
225
-
226
- set_site_transient( 'update_plugins', $update_cache );
227
 
228
- } else {
 
 
 
 
 
229
 
230
- $version_info = $update_cache->response[ $this->name ];
 
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  }
 
 
 
 
 
 
 
233
 
234
- // Restore our filter
235
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
236
-
237
- if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
 
238
 
239
- // build a plugin list row, with update notification
240
- $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
241
- # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
242
- echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
243
- echo '<td colspan="3" class="plugin-update colspanchange">';
244
- echo '<div class="update-message notice inline notice-warning notice-alt">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
 
246
- $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
247
 
248
- if ( empty( $version_info->download_link ) ) {
249
- printf(
250
- __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'advanced-ads' ),
251
- esc_html( $version_info->name ),
252
- '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
253
- esc_html( $version_info->new_version ),
254
- '</a>'
255
- );
256
- } else {
257
- printf(
258
- __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'advanced-ads' ),
259
- esc_html( $version_info->name ),
260
- '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
261
- esc_html( $version_info->new_version ),
262
- '</a>',
263
- '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
264
- '</a>'
265
- );
266
- }
267
 
268
- do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
 
 
 
 
 
 
 
269
 
270
- echo '</div></td></tr>';
271
- }
272
  }
273
 
274
  /**
275
  * Updates information on the "View version x.x details" page with custom data.
276
  *
277
- * @uses api_request()
 
 
278
  *
279
- * @param mixed $_data needs to be explained by EDD.
280
- * @param string $_action needs to be explained by EDD.
281
- * @param object $_args needs to be explained by EDD.
282
  * @return object $_data
 
 
283
  */
284
  public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
285
 
286
- if ( $_action != 'plugin_information' ) {
287
 
288
  return $_data;
289
-
290
  }
291
 
292
- if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
293
 
294
  return $_data;
295
-
296
  }
297
 
298
  $to_send = array(
@@ -302,7 +292,7 @@ class ADVADS_SL_Plugin_Updater {
302
  'banners' => array(),
303
  'reviews' => false,
304
  'icons' => array(),
305
- )
306
  );
307
 
308
  // Get the transient where we store the api request for this plugin for 24 hours
@@ -319,7 +309,6 @@ class ADVADS_SL_Plugin_Updater {
319
  if ( false !== $api_response ) {
320
  $_data = $api_response;
321
  }
322
-
323
  } else {
324
  $_data = $edd_api_request_transient;
325
  }
@@ -344,7 +333,7 @@ class ADVADS_SL_Plugin_Updater {
344
  $_data->contributors = $this->convert_object_to_array( $_data->contributors );
345
  }
346
 
347
- if( ! isset( $_data->plugin ) ) {
348
  $_data->plugin = $this->name;
349
  }
350
 
@@ -357,13 +346,16 @@ class ADVADS_SL_Plugin_Updater {
357
  * Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
358
  * decoding, they are objects. This method allows us to pass in the object and return an associative array.
359
  *
360
- * @since 3.6.5
361
- *
362
  * @param stdClass $data
363
  *
364
  * @return array
 
 
365
  */
366
  private function convert_object_to_array( $data ) {
 
 
 
367
  $new_data = array();
368
  foreach ( $data as $key => $value ) {
369
  $new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
@@ -375,51 +367,56 @@ class ADVADS_SL_Plugin_Updater {
375
  /**
376
  * Disable SSL verification in order to prevent download update failures
377
  *
378
- * @param array $args
379
- * @param string $url
 
380
  * @return object $array
381
  */
382
  public function http_request_args( $args, $url ) {
383
 
384
- $verify_ssl = $this->verify_ssl();
385
  if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
386
- $args['sslverify'] = $verify_ssl;
387
  }
388
- return $args;
389
 
 
390
  }
391
 
392
  /**
393
  * Calls the API and, if successfull, returns the object delivered by the API.
394
  *
 
 
 
 
395
  * @uses get_bloginfo()
396
  * @uses wp_remote_post()
397
  * @uses is_wp_error()
398
  *
399
- * @param string $_action The requested action.
400
- * @param array $_data Parameters for the API action.
401
- * @return false|object
402
  */
403
  private function api_request( $_action, $_data ) {
404
 
405
- global $wp_version, $edd_plugin_url_available;
406
-
407
- $verify_ssl = $this->verify_ssl();
408
 
409
  // Do a quick status check on this domain if we haven't already checked it.
410
  $store_hash = md5( $this->api_url );
411
  if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
412
- $test_url_parts = parse_url( $this->api_url );
413
 
414
- $scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
415
- $host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
416
- $port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
417
 
418
  if ( empty( $host ) ) {
419
  $edd_plugin_url_available[ $store_hash ] = false;
420
  } else {
421
- $test_url = $scheme . '://' . $host . $port;
422
- $response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
 
 
 
 
 
 
423
  $edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
424
  }
425
  }
@@ -430,53 +427,16 @@ class ADVADS_SL_Plugin_Updater {
430
 
431
  $data = array_merge( $this->api_data, $_data );
432
 
433
- if ( $data['slug'] != $this->slug ) {
434
- return false;
435
- }
436
-
437
- if( $this->api_url == trailingslashit ( home_url() ) ) {
438
- return false; // Don't allow a plugin to ping itself
439
- }
440
-
441
- $api_params = array(
442
- 'edd_action' => 'get_version',
443
- 'license' => ! empty( $data['license'] ) ? $data['license'] : '',
444
- 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
445
- 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
446
- 'version' => isset( $data['version'] ) ? $data['version'] : false,
447
- 'slug' => $data['slug'],
448
- 'author' => $data['author'],
449
- 'url' => home_url(),
450
- 'beta' => ! empty( $data['beta'] ),
451
- );
452
-
453
- $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
454
-
455
- if ( ! is_wp_error( $request ) ) {
456
- $request = json_decode( wp_remote_retrieve_body( $request ) );
457
- }
458
-
459
- if ( $request && isset( $request->sections ) ) {
460
- $request->sections = maybe_unserialize( $request->sections );
461
- } else {
462
- $request = false;
463
- }
464
-
465
- if ( $request && isset( $request->banners ) ) {
466
- $request->banners = maybe_unserialize( $request->banners );
467
- }
468
-
469
- if ( $request && isset( $request->icons ) ) {
470
- $request->icons = maybe_unserialize( $request->icons );
471
  }
472
 
473
- if ( ! empty( $request->sections ) ) {
474
- foreach( $request->sections as $key => $section ) {
475
- $request->$key = (array) $section;
476
- }
477
  }
478
 
479
- return $request;
480
  }
481
 
482
  /**
@@ -484,98 +444,120 @@ class ADVADS_SL_Plugin_Updater {
484
  */
485
  public function show_changelog() {
486
 
487
- global $edd_plugin_data;
488
-
489
- if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
490
  return;
491
  }
492
 
493
- if( empty( $_REQUEST['plugin'] ) ) {
494
  return;
495
  }
496
 
497
- if( empty( $_REQUEST['slug'] ) ) {
498
  return;
499
  }
500
 
501
- if( ! current_user_can( 'update_plugins' ) ) {
502
- wp_die( __( 'You do not have permission to install plugin updates', 'advanced-ads' ), __( 'Error', 'advanced-ads' ), array( 'response' => 403 ) );
503
  }
504
 
505
- $data = $edd_plugin_data[ $_REQUEST['slug'] ];
506
- $version_info = $this->get_cached_version_info();
 
 
 
 
 
507
 
508
- if( false === $version_info ) {
 
509
 
510
- $api_params = array(
511
- 'edd_action' => 'get_version',
512
- 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
513
- 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
514
- 'slug' => $_REQUEST['slug'],
515
- 'author' => $data['author'],
516
- 'url' => home_url(),
517
- 'beta' => ! empty( $data['beta'] )
518
- );
 
 
 
 
 
 
 
 
 
 
519
 
520
- $verify_ssl = $this->verify_ssl();
521
- $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
 
523
- if ( ! is_wp_error( $request ) ) {
524
- $version_info = json_decode( wp_remote_retrieve_body( $request ) );
525
- }
526
 
527
- if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
528
- $version_info->sections = maybe_unserialize( $version_info->sections );
529
- } else {
530
- $version_info = false;
531
- }
532
 
533
- if( ! empty( $version_info ) ) {
534
- foreach( $version_info->sections as $key => $section ) {
535
- $version_info->$key = (array) $section;
536
- }
537
- }
538
 
539
- $this->set_version_info_cache( $version_info );
 
 
540
 
541
- // Delete the unneeded option
542
- delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) );
543
  }
544
 
545
- if ( isset( $version_info->sections ) ) {
546
- $sections = $this->convert_object_to_array( $version_info->sections );
547
- if ( ! empty( $sections['changelog'] ) ) {
548
- echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
549
  }
550
  }
551
 
552
- exit;
553
  }
554
 
555
  /**
556
- * Gets the plugin's cached version information from the database.
 
 
557
  *
558
- * @param string $cache_key needs to be explained by EDD.
559
- * @return boolean|string
560
  */
561
  public function get_cached_version_info( $cache_key = '' ) {
562
 
563
- if( empty( $cache_key ) ) {
564
- $cache_key = $this->cache_key;
565
  }
566
 
567
  $cache = get_option( $cache_key );
568
 
569
- // Remove cache when WordPress’ "force-update" option is used through Dashboard > Updates
570
- if ( ! empty( $_GET['force-check'] ) ) {
571
- delete_option( $cache_key );
572
  return false;
573
  }
574
 
575
- if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
576
- return false; // Cache is expired
577
- }
578
-
579
  // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
580
  $cache['value'] = json_decode( $cache['value'] );
581
  if ( ! empty( $cache['value']->icons ) ) {
@@ -583,24 +565,23 @@ class ADVADS_SL_Plugin_Updater {
583
  }
584
 
585
  return $cache['value'];
586
-
587
  }
588
 
589
  /**
590
  * Adds the plugin version information to the database.
591
  *
592
- * @param string $value needs to be explained by EDD.
593
- * @param string $cache_key needs to be explained by EDD.
594
  */
595
  public function set_version_info_cache( $value = '', $cache_key = '' ) {
596
 
597
- if( empty( $cache_key ) ) {
598
- $cache_key = $this->cache_key;
599
  }
600
 
601
  $data = array(
602
  'timeout' => strtotime( '+3 hours', time() ),
603
- 'value' => json_encode( $value )
604
  );
605
 
606
  update_option( $cache_key, $data, 'no' );
@@ -612,11 +593,23 @@ class ADVADS_SL_Plugin_Updater {
612
  /**
613
  * Returns if the SSL of the store should be verified.
614
  *
615
- * @since 1.6.13
616
  * @return bool
 
617
  */
618
  private function verify_ssl() {
619
  return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
620
  }
621
 
 
 
 
 
 
 
 
 
 
 
 
 
622
  }
1
  <?php
2
 
 
 
 
3
  /**
4
  * Allows plugins to use their own update API.
5
  *
6
+ * @author Easy Digital Downloads
7
+ * @version 1.9.0
8
  */
9
  class ADVADS_SL_Plugin_Updater {
10
 
11
+ private $api_url = '';
12
+ private $api_data = array();
13
+ private $plugin_file = '';
14
+ private $name = '';
15
+ private $slug = '';
16
+ private $version = '';
17
+ private $wp_override = false;
18
+ private $beta = false;
19
  private $health_check_timeout = 5;
20
 
21
  /**
22
  * Class constructor.
23
  *
24
+ * @param string $_api_url The URL pointing to the custom API endpoint.
25
+ * @param string $_plugin_file Path to the plugin file.
26
+ * @param array $_api_data Optional data to send with API calls.
27
+ *
28
  * @uses hook()
29
  *
30
+ * @uses plugin_basename()
 
 
31
  */
32
  public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
33
 
35
 
36
  $this->api_url = trailingslashit( $_api_url );
37
  $this->api_data = $_api_data;
38
+ $this->plugin_file = $_plugin_file;
39
  $this->name = plugin_basename( $_plugin_file );
40
  $this->slug = basename( $_plugin_file, '.php' );
41
  $this->version = $_api_data['version'];
42
  $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
43
  $this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
 
44
 
45
  $edd_plugin_data[ $this->slug ] = $this->api_data;
46
 
47
  /**
48
  * Fires after the $edd_plugin_data is setup.
49
  *
50
+ * @param array $edd_plugin_data Array of EDD SL plugin data.
51
+ *
52
  * @since x.x.x
53
  *
 
54
  */
55
  do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
56
 
57
  // Set up hooks.
58
  $this->init();
 
59
  }
60
 
61
  /**
62
  * Set up WordPress filters to hook into WP's update process.
63
  *
64
+ * @return void
65
  * @uses add_filter()
66
  *
 
67
  */
68
  public function init() {
69
 
70
  add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
71
  add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
72
+ add_action( 'after_plugin_row', array( $this, 'show_update_notification' ), 10, 2 );
 
73
  add_action( 'admin_init', array( $this, 'show_changelog' ) );
 
74
  }
75
 
76
  /**
81
  * It is reassembled from parts of the native WordPress plugin update code.
82
  * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
83
  *
 
 
84
  * @param array $_transient_data Update array build by WordPress.
85
+ *
86
  * @return array Modified update array with custom plugin data.
87
+ * @uses api_request()
88
+ *
89
  */
90
  public function check_update( $_transient_data ) {
91
 
92
  global $pagenow;
93
 
94
  if ( ! is_object( $_transient_data ) ) {
95
+ $_transient_data = new stdClass();
 
 
 
 
96
  }
97
 
98
  if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
118
  * Get repo API data from store.
119
  * Save to cache.
120
  *
121
+ * @return \stdClass
122
  */
123
  public function get_repo_api_data() {
124
  $version_info = $this->get_cached_version_info();
146
  }
147
 
148
  /**
149
+ * Show the update notification on multisite subsites.
150
  *
151
+ * @param string $file
152
+ * @param array $plugin
153
  */
154
  public function show_update_notification( $file, $plugin ) {
155
 
156
+ // Return early if in the network admin, or if this is not a multisite install.
157
+ if ( is_network_admin() || ! is_multisite() ) {
 
 
 
158
  return;
159
  }
160
 
161
+ if ( ! current_user_can( 'update_plugins' ) ) {
162
  return;
163
  }
164
 
165
+ if ( $this->name !== $file ) {
166
  return;
167
  }
168
 
169
+ // Do not print any message if update does not exist.
 
 
170
  $update_cache = get_site_transient( 'update_plugins' );
171
 
172
+ if ( ! isset( $update_cache->response[ $this->name ] ) ) {
173
+ if ( ! is_object( $update_cache ) ) {
174
+ $update_cache = new stdClass();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
176
+ $update_cache->response[ $this->name ] = $this->get_repo_api_data();
177
+ }
178
 
179
+ // Return early if this plugin isn't in the transient->response or if the site is running the current or newer version of the plugin.
180
+ if ( empty( $update_cache->response[ $this->name ] ) || version_compare( $this->version, $update_cache->response[ $this->name ]->new_version, '>=' ) ) {
181
+ return;
182
+ }
183
 
184
+ printf(
185
+ '<tr class="plugin-update-tr %3$s" id="%1$s-update" data-slug="%1$s" data-plugin="%2$s">',
186
+ $this->slug,
187
+ $file,
188
+ in_array( $this->name, $this->get_active_plugins(), true ) ? 'active' : 'inactive'
189
+ );
190
 
191
+ echo '<td colspan="3" class="plugin-update colspanchange">';
192
+ echo '<div class="update-message notice inline notice-warning notice-alt"><p>';
193
 
194
+ $changelog_link = '';
195
+ if ( ! empty( $update_cache->response[ $this->name ]->sections->changelog ) ) {
196
+ $changelog_link = add_query_arg(
197
+ array(
198
+ 'edd_sl_action' => 'view_plugin_changelog',
199
+ 'plugin' => urlencode( $this->name ),
200
+ 'slug' => urlencode( $this->slug ),
201
+ 'TB_iframe' => 'true',
202
+ 'width' => 77,
203
+ 'height' => 911,
204
+ ),
205
+ self_admin_url( 'index.php' )
206
+ );
207
  }
208
+ $update_link = add_query_arg(
209
+ array(
210
+ 'action' => 'upgrade-plugin',
211
+ 'plugin' => urlencode( $this->name ),
212
+ ),
213
+ self_admin_url( 'update.php' )
214
+ );
215
 
216
+ printf(
217
+ /* translators: the plugin name. */
218
+ esc_html__( 'There is a new version of %1$s available.', 'advanced-ads' ),
219
+ esc_html( $plugin['Name'] )
220
+ );
221
 
222
+ if ( empty( $update_cache->response[ $this->name ]->package ) && ! empty( $changelog_link ) ) {
223
+ printf(
224
+ /* translators: 1. opening anchor tag, do not translate 2. the new plugin version 3. closing anchor tag, do not translate. */
225
+ __( ' %1$sView version %2$s details%3$s.', 'advanced-ads' ),
226
+ '<a target="_blank" class="thickbox open-plugin-details-modal" href="' . esc_url( $changelog_link ) . '">',
227
+ esc_html( $update_cache->response[ $this->name ]->new_version ),
228
+ '</a>'
229
+ );
230
+ } elseif ( ! empty( $changelog_link ) ) {
231
+ printf(
232
+ __( ' %1$sView version %2$s details%3$s or %4$supdate now%5$s.', 'advanced-ads' ),
233
+ '<a target="_blank" class="thickbox open-plugin-details-modal" href="' . esc_url( $changelog_link ) . '">',
234
+ esc_html( $update_cache->response[ $this->name ]->new_version ),
235
+ '</a>',
236
+ '<a target="_blank" class="update-link" href="' . esc_url( wp_nonce_url( $update_link, 'upgrade-plugin_' . $file ) ) . '">',
237
+ '</a>'
238
+ );
239
+ } else {
240
+ printf(
241
+ ' %1$s%2$s%3$s',
242
+ '<a target="_blank" class="update-link" href="' . esc_url( wp_nonce_url( $update_link, 'upgrade-plugin_' . $file ) ) . '">',
243
+ esc_html__( 'Update now.', 'advanced-ads' ),
244
+ '</a>'
245
+ );
246
+ }
247
 
248
+ do_action( "in_plugin_update_message-{$file}", $plugin, $plugin );
249
 
250
+ echo '</p></div></td></tr>';
251
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
 
253
+ /**
254
+ * Gets the plugins active in a multisite network.
255
+ *
256
+ * @return array
257
+ */
258
+ private function get_active_plugins() {
259
+ $active_plugins = (array) get_option( 'active_plugins' );
260
+ $active_network_plugins = (array) get_site_option( 'active_sitewide_plugins' );
261
 
262
+ return array_merge( $active_plugins, array_keys( $active_network_plugins ) );
 
263
  }
264
 
265
  /**
266
  * Updates information on the "View version x.x details" page with custom data.
267
  *
268
+ * @param mixed $_data
269
+ * @param string $_action
270
+ * @param object $_args
271
  *
 
 
 
272
  * @return object $_data
273
+ * @uses api_request()
274
+ *
275
  */
276
  public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
277
 
278
+ if ( 'plugin_information' !== $_action ) {
279
 
280
  return $_data;
 
281
  }
282
 
283
+ if ( ! isset( $_args->slug ) || ( $_args->slug !== $this->slug ) ) {
284
 
285
  return $_data;
 
286
  }
287
 
288
  $to_send = array(
292
  'banners' => array(),
293
  'reviews' => false,
294
  'icons' => array(),
295
+ ),
296
  );
297
 
298
  // Get the transient where we store the api request for this plugin for 24 hours
309
  if ( false !== $api_response ) {
310
  $_data = $api_response;
311
  }
 
312
  } else {
313
  $_data = $edd_api_request_transient;
314
  }
333
  $_data->contributors = $this->convert_object_to_array( $_data->contributors );
334
  }
335
 
336
+ if ( ! isset( $_data->plugin ) ) {
337
  $_data->plugin = $this->name;
338
  }
339
 
346
  * Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
347
  * decoding, they are objects. This method allows us to pass in the object and return an associative array.
348
  *
 
 
349
  * @param stdClass $data
350
  *
351
  * @return array
352
+ * @since 3.6.5
353
+ *
354
  */
355
  private function convert_object_to_array( $data ) {
356
+ if ( ! is_array( $data ) && ! is_object( $data ) ) {
357
+ return array();
358
+ }
359
  $new_data = array();
360
  foreach ( $data as $key => $value ) {
361
  $new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
367
  /**
368
  * Disable SSL verification in order to prevent download update failures
369
  *
370
+ * @param array $args
371
+ * @param string $url
372
+ *
373
  * @return object $array
374
  */
375
  public function http_request_args( $args, $url ) {
376
 
 
377
  if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
378
+ $args['sslverify'] = $this->verify_ssl();
379
  }
 
380
 
381
+ return $args;
382
  }
383
 
384
  /**
385
  * Calls the API and, if successfull, returns the object delivered by the API.
386
  *
387
+ * @param string $_action The requested action.
388
+ * @param array $_data Parameters for the API action.
389
+ *
390
+ * @return false|object
391
  * @uses get_bloginfo()
392
  * @uses wp_remote_post()
393
  * @uses is_wp_error()
394
  *
 
 
 
395
  */
396
  private function api_request( $_action, $_data ) {
397
 
398
+ global $edd_plugin_url_available;
 
 
399
 
400
  // Do a quick status check on this domain if we haven't already checked it.
401
  $store_hash = md5( $this->api_url );
402
  if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
403
+ $test_url_parts = wp_parse_url( $this->api_url );
404
 
405
+ $scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
406
+ $host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
407
+ $port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
408
 
409
  if ( empty( $host ) ) {
410
  $edd_plugin_url_available[ $store_hash ] = false;
411
  } else {
412
+ $test_url = $scheme . '://' . $host . $port;
413
+ $response = wp_remote_get(
414
+ $test_url,
415
+ array(
416
+ 'timeout' => $this->health_check_timeout,
417
+ 'sslverify' => $this->verify_ssl(),
418
+ )
419
+ );
420
  $edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
421
  }
422
  }
427
 
428
  $data = array_merge( $this->api_data, $_data );
429
 
430
+ if ( $data['slug'] !== $this->slug ) {
431
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
  }
433
 
434
+ // Don't allow a plugin to ping itself
435
+ if ( trailingslashit( home_url() ) === $this->api_url ) {
436
+ return false;
 
437
  }
438
 
439
+ return $this->get_version_from_remote();
440
  }
441
 
442
  /**
444
  */
445
  public function show_changelog() {
446
 
447
+ if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' !== $_REQUEST['edd_sl_action'] ) {
 
 
448
  return;
449
  }
450
 
451
+ if ( empty( $_REQUEST['plugin'] ) ) {
452
  return;
453
  }
454
 
455
+ if ( empty( $_REQUEST['slug'] ) || $this->slug !== $_REQUEST['slug'] ) {
456
  return;
457
  }
458
 
459
+ if ( ! current_user_can( 'update_plugins' ) ) {
460
+ wp_die( esc_html__( 'You do not have permission to install plugin updates', 'advanced-ads' ), esc_html__( 'Error', 'advanced-ads' ), array( 'response' => 403 ) );
461
  }
462
 
463
+ $version_info = $this->get_repo_api_data();
464
+ if ( isset( $version_info->sections ) ) {
465
+ $sections = $this->convert_object_to_array( $version_info->sections );
466
+ if ( ! empty( $sections['changelog'] ) ) {
467
+ echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
468
+ }
469
+ }
470
 
471
+ exit;
472
+ }
473
 
474
+ /**
475
+ * Gets the current version information from the remote site.
476
+ *
477
+ * @return array|false
478
+ */
479
+ private function get_version_from_remote() {
480
+ $api_params = array(
481
+ 'edd_action' => 'get_version',
482
+ 'license' => ! empty( $this->api_data['license'] ) ? $this->api_data['license'] : '',
483
+ 'item_name' => isset( $this->api_data['item_name'] ) ? $this->api_data['item_name'] : false,
484
+ 'item_id' => isset( $this->api_data['item_id'] ) ? $this->api_data['item_id'] : false,
485
+ 'version' => isset( $this->api_data['version'] ) ? $this->api_data['version'] : false,
486
+ 'slug' => $this->slug,
487
+ 'author' => $this->api_data['author'],
488
+ 'url' => home_url(),
489
+ 'beta' => $this->beta,
490
+ 'php_version' => phpversion(),
491
+ 'wp_version' => get_bloginfo( 'version' ),
492
+ );
493
 
494
+ /**
495
+ * Filters the parameters sent in the API request.
496
+ *
497
+ * @param array $api_params The array of data sent in the request.
498
+ * @param array $this- >api_data The array of data set up in the class constructor.
499
+ * @param string $this- >plugin_file The full path and filename of the file.
500
+ */
501
+ $api_params = apply_filters( 'edd_sl_plugin_updater_api_params', $api_params, $this->api_data, $this->plugin_file );
502
+
503
+ $request = wp_remote_post(
504
+ $this->api_url,
505
+ array(
506
+ 'timeout' => 15,
507
+ 'sslverify' => $this->verify_ssl(),
508
+ 'body' => $api_params,
509
+ )
510
+ );
511
 
512
+ if ( is_wp_error( $request ) ) {
513
+ return false;
514
+ }
515
 
516
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
 
 
 
 
517
 
518
+ if ( $request && isset( $request->sections ) ) {
519
+ $request->sections = maybe_unserialize( $request->sections );
520
+ } else {
521
+ $request = false;
522
+ }
523
 
524
+ if ( $request && isset( $request->banners ) ) {
525
+ $request->banners = maybe_unserialize( $request->banners );
526
+ }
527
 
528
+ if ( $request && isset( $request->icons ) ) {
529
+ $request->icons = maybe_unserialize( $request->icons );
530
  }
531
 
532
+ if ( ! empty( $request->sections ) ) {
533
+ foreach ( $request->sections as $key => $section ) {
534
+ $request->$key = (array) $section;
 
535
  }
536
  }
537
 
538
+ return $request;
539
  }
540
 
541
  /**
542
+ * Get the version info from the cache, if it exists.
543
+ *
544
+ * @param string $cache_key
545
  *
546
+ * @return object
 
547
  */
548
  public function get_cached_version_info( $cache_key = '' ) {
549
 
550
+ if ( empty( $cache_key ) ) {
551
+ $cache_key = $this->get_cache_key();
552
  }
553
 
554
  $cache = get_option( $cache_key );
555
 
556
+ // Cache is expired
557
+ if ( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
 
558
  return false;
559
  }
560
 
 
 
 
 
561
  // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
562
  $cache['value'] = json_decode( $cache['value'] );
563
  if ( ! empty( $cache['value']->icons ) ) {
565
  }
566
 
567
  return $cache['value'];
 
568
  }
569
 
570
  /**
571
  * Adds the plugin version information to the database.
572
  *
573
+ * @param string $value
574
+ * @param string $cache_key
575
  */
576
  public function set_version_info_cache( $value = '', $cache_key = '' ) {
577
 
578
+ if ( empty( $cache_key ) ) {
579
+ $cache_key = $this->get_cache_key();
580
  }
581
 
582
  $data = array(
583
  'timeout' => strtotime( '+3 hours', time() ),
584
+ 'value' => wp_json_encode( $value ),
585
  );
586
 
587
  update_option( $cache_key, $data, 'no' );
593
  /**
594
  * Returns if the SSL of the store should be verified.
595
  *
 
596
  * @return bool
597
+ * @since 1.6.13
598
  */
599
  private function verify_ssl() {
600
  return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
601
  }
602
 
603
+ /**
604
+ * Gets the unique key (option name) for a plugin.
605
+ *
606
+ * @return string
607
+ * @since 1.9.0
608
+ */
609
+ private function get_cache_key() {
610
+ $string = $this->slug . $this->api_data['license'] . $this->beta;
611
+
612
+ return 'edd_sl_' . md5( serialize( $string ) );
613
+ }
614
+
615
  }
classes/ad.php CHANGED
@@ -963,13 +963,15 @@ class Advanced_Ads_Ad {
963
  $this->wrapper['id'] = $wrapper_options['id'];
964
  }
965
 
 
 
966
  // build the box
967
- $wrapper = '<div' . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
968
  $wrapper .= $this->label;
969
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-before-content', '', $this );
970
  $wrapper .= $ad_content;
971
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-after-content', '', $this );
972
- $wrapper .= '</div>';
973
 
974
  return $wrapper;
975
  }
963
  $this->wrapper['id'] = $wrapper_options['id'];
964
  }
965
 
966
+ $wrapper_element = ! empty( $this->args['inline_wrapper_element'] ) ? 'span' : 'div';
967
+
968
  // build the box
969
+ $wrapper = '<' . $wrapper_element . Advanced_Ads_Utils::build_html_attributes( $wrapper_options ) . '>';
970
  $wrapper .= $this->label;
971
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-before-content', '', $this );
972
  $wrapper .= $ad_content;
973
  $wrapper .= apply_filters( 'advanced-ads-output-wrapper-after-content', '', $this );
974
+ $wrapper .= '</' . $wrapper_element . '>';
975
 
976
  return $wrapper;
977
  }
classes/ad_placements.php CHANGED
@@ -42,30 +42,6 @@ class Advanced_Ads_Placements {
42
  */
43
  public static function get_placement_types() {
44
  $types = array(
45
- 'default' => array(
46
- 'title' => __( 'Manual Placement', 'advanced-ads' ),
47
- 'description' => __( 'Manual placement to use as function or shortcode.', 'advanced-ads' ),
48
- 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/manual.png',
49
- 'order' => 80,
50
- 'options' => array(
51
- 'show_position' => true,
52
- 'show_lazy_load' => true,
53
- 'amp' => true,
54
- ),
55
- ),
56
- 'header' => array(
57
- 'title' => __( 'Header Code', 'advanced-ads' ),
58
- 'description' => __( 'Injected in Header (before closing &lt;/head&gt; Tag, often not visible).', 'advanced-ads' ),
59
- 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/header.png',
60
- 'order' => 3,
61
- ),
62
- 'footer' => array(
63
- 'title' => __( 'Footer Code', 'advanced-ads' ),
64
- 'description' => __( 'Injected in Footer (before closing &lt;/body&gt; Tag).', 'advanced-ads' ),
65
- 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/footer.png',
66
- 'order' => 95,
67
- 'options' => array( 'amp' => true ),
68
- ),
69
  'post_top' => array(
70
  'title' => __( 'Before Content', 'advanced-ads' ),
71
  'description' => __( 'Injected before the post content.', 'advanced-ads' ),
@@ -78,11 +54,11 @@ class Advanced_Ads_Placements {
78
  'amp' => true,
79
  ),
80
  ),
81
- 'post_bottom' => array(
82
- 'title' => __( 'After Content', 'advanced-ads' ),
83
- 'description' => __( 'Injected after the post content.', 'advanced-ads' ),
84
- 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-after.png',
85
- 'order' => 35,
86
  'options' => array(
87
  'show_position' => true,
88
  'show_lazy_load' => true,
@@ -90,11 +66,11 @@ class Advanced_Ads_Placements {
90
  'amp' => true,
91
  ),
92
  ),
93
- 'post_content' => array(
94
- 'title' => __( 'Content', 'advanced-ads' ),
95
- 'description' => __( 'Injected into the content. You can choose the paragraph after which the ad content is displayed.', 'advanced-ads' ),
96
- 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-within.png',
97
- 'order' => 21,
98
  'options' => array(
99
  'show_position' => true,
100
  'show_lazy_load' => true,
@@ -113,6 +89,30 @@ class Advanced_Ads_Placements {
113
  'amp' => true,
114
  ),
115
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  );
117
 
118
  return apply_filters( 'advanced-ads-placement-types', $types );
42
  */
43
  public static function get_placement_types() {
44
  $types = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  'post_top' => array(
46
  'title' => __( 'Before Content', 'advanced-ads' ),
47
  'description' => __( 'Injected before the post content.', 'advanced-ads' ),
54
  'amp' => true,
55
  ),
56
  ),
57
+ 'post_content' => array(
58
+ 'title' => __( 'Content', 'advanced-ads' ),
59
+ 'description' => __( 'Injected into the content. You can choose the paragraph after which the ad content is displayed.', 'advanced-ads' ),
60
+ 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-within.png',
61
+ 'order' => 21,
62
  'options' => array(
63
  'show_position' => true,
64
  'show_lazy_load' => true,
66
  'amp' => true,
67
  ),
68
  ),
69
+ 'post_bottom' => array(
70
+ 'title' => __( 'After Content', 'advanced-ads' ),
71
+ 'description' => __( 'Injected after the post content.', 'advanced-ads' ),
72
+ 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/content-after.png',
73
+ 'order' => 35,
74
  'options' => array(
75
  'show_position' => true,
76
  'show_lazy_load' => true,
89
  'amp' => true,
90
  ),
91
  ),
92
+ 'default' => array(
93
+ 'title' => __( 'Manual Placement', 'advanced-ads' ),
94
+ 'description' => __( 'Manual placement to use as function or shortcode.', 'advanced-ads' ),
95
+ 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/manual.png',
96
+ 'order' => 80,
97
+ 'options' => array(
98
+ 'show_position' => true,
99
+ 'show_lazy_load' => true,
100
+ 'amp' => true,
101
+ ),
102
+ ),
103
+ 'header' => array(
104
+ 'title' => __( 'Header Code', 'advanced-ads' ),
105
+ 'description' => __( 'Injected in Header (before closing &lt;/head&gt; Tag, often not visible).', 'advanced-ads' ),
106
+ 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/header.png',
107
+ 'order' => 3,
108
+ ),
109
+ 'footer' => array(
110
+ 'title' => __( 'Footer Code', 'advanced-ads' ),
111
+ 'description' => __( 'Injected in Footer (before closing &lt;/body&gt; Tag).', 'advanced-ads' ),
112
+ 'image' => ADVADS_BASE_URL . 'admin/assets/img/placements/footer.png',
113
+ 'order' => 95,
114
+ 'options' => array( 'amp' => true ),
115
+ ),
116
  );
117
 
118
  return apply_filters( 'advanced-ads-placement-types', $types );
classes/plugin.php CHANGED
@@ -378,6 +378,10 @@ class Advanced_Ads_Plugin {
378
  public function shortcode_display_ad( $atts ) {
379
  $atts = is_array( $atts ) ? $atts : array();
380
  $id = isset( $atts['id'] ) ? (int) $atts['id'] : 0;
 
 
 
 
381
  $atts = $this->prepare_shortcode_atts( $atts );
382
 
383
  // use the public available function here.
378
  public function shortcode_display_ad( $atts ) {
379
  $atts = is_array( $atts ) ? $atts : array();
380
  $id = isset( $atts['id'] ) ? (int) $atts['id'] : 0;
381
+ // check if there is an inline attribute with or without value.
382
+ if ( isset( $atts['inline'] ) || in_array( 'inline', $atts, true ) ) {
383
+ $atts['inline_wrapper_element'] = true;
384
+ }
385
  $atts = $this->prepare_shortcode_atts( $atts );
386
 
387
  // use the public available function here.
languages/advanced-ads.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Advanced Ads 1.27.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
7
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
8
  "Language-Team: webgilde <support@wpadvancedads.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-08-24T09:19:55+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: advanced-ads\n"
@@ -121,7 +121,7 @@ msgstr ""
121
  #. translators: %s is a list of PHP extensions.
122
  #. Translators: %s is a name of a module.
123
  #: admin/includes/ad-health-notices.php:54
124
- #: admin/views/placements.php:382
125
  msgid "Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s"
126
  msgstr ""
127
 
@@ -639,14 +639,14 @@ msgstr ""
639
 
640
  #: admin/includes/class-meta-box.php:104
641
  #: admin/views/placements.php:183
642
- #: admin/views/placements.php:423
643
  #: classes/ad-debug.php:152
644
  msgid "Display Conditions"
645
  msgstr ""
646
 
647
  #: admin/includes/class-meta-box.php:112
648
  #: admin/views/placements.php:192
649
- #: admin/views/placements.php:431
650
  #: classes/ad-debug.php:239
651
  msgid "Visitor Conditions"
652
  msgstr ""
@@ -712,16 +712,16 @@ msgid "Latest posts on wpadvancedads.com"
712
  msgstr ""
713
 
714
  #. translators: %s is a URL.
715
- #: admin/includes/class-notices.php:427
716
  msgid "You don’t seem to have an email address. Please use <a href=\"%s\" target=\"_blank\">this form</a> to sign up."
717
  msgstr ""
718
 
719
- #: admin/includes/class-notices.php:448
720
  msgid "How embarrassing. The email server seems to be down. Please try again later."
721
  msgstr ""
722
 
723
  #. translators: the first %s is an email address, the seconds %s is a URL.
724
- #: admin/includes/class-notices.php:455
725
  msgid "Please check your email (%1$s) for the confirmation message. If you didn’t receive one or want to use another email address then please use <a href=\"%2$s\" target=\"_blank\">this form</a> to sign up."
726
  msgstr ""
727
 
@@ -735,6 +735,7 @@ msgstr ""
735
 
736
  #: admin/includes/class-overview-widgets.php:115
737
  #: admin/views/notices/welcome-panel.php:15
 
738
  msgid "Create your first ad"
739
  msgstr ""
740
 
@@ -796,8 +797,7 @@ msgid "Show %s hidden notices"
796
  msgstr ""
797
 
798
  #: admin/includes/class-overview-widgets.php:450
799
- #: admin/views/settings/license/section.php:3
800
- msgid "How to install and activate an add-on."
801
  msgstr ""
802
 
803
  #: admin/includes/class-overview-widgets.php:458
@@ -1165,6 +1165,7 @@ msgid "Update"
1165
  msgstr ""
1166
 
1167
  #: admin/views/ad-group-list-ads.php:20
 
1168
  #: classes/ad-debug.php:118
1169
  #: classes/ad-debug.php:167
1170
  #: classes/ad-debug.php:169
@@ -1285,18 +1286,17 @@ msgctxt "wizard navigation"
1285
  msgid "previous"
1286
  msgstr ""
1287
 
1288
- #: admin/views/ad-info-bottom.php:20
1289
- #: admin/views/ad-info-bottom.php:25
1290
  msgctxt "wizard navigation"
1291
- msgid "next"
1292
  msgstr ""
1293
 
1294
- #: admin/views/ad-info-bottom.php:21
1295
  msgctxt "wizard navigation"
1296
- msgid "save"
1297
  msgstr ""
1298
 
1299
- #: admin/views/ad-info-bottom.php:26
1300
  #: admin/views/ad-info-top.php:27
1301
  msgid "Stop Wizard and show all options"
1302
  msgstr ""
@@ -1876,26 +1876,26 @@ msgid "New placement"
1876
  msgstr ""
1877
 
1878
  #: admin/views/placement-injection-top.php:79
1879
- #: classes/ad_placements.php:70
1880
  msgid "Before Content"
1881
  msgstr ""
1882
 
1883
  #: admin/views/placement-injection-top.php:80
1884
- #: classes/ad_placements.php:94
1885
  msgid "Content"
1886
  msgstr ""
1887
 
1888
  #: admin/views/placement-injection-top.php:81
1889
- #: classes/ad_placements.php:82
1890
  msgid "After Content"
1891
  msgstr ""
1892
 
1893
  #: admin/views/placement-injection-top.php:82
1894
- msgid "PHP or Shortcode"
1895
  msgstr ""
1896
 
1897
  #: admin/views/placement-injection-top.php:83
1898
- msgid "Manage Sidebar"
1899
  msgstr ""
1900
 
1901
  #: admin/views/placement-injection-top.php:84
@@ -1995,12 +1995,12 @@ msgid "Placements updated"
1995
  msgstr ""
1996
 
1997
  #: admin/views/placements.php:25
1998
- #: admin/views/placements.php:459
1999
  msgid "Create a new placement"
2000
  msgstr ""
2001
 
2002
  #: admin/views/placements.php:26
2003
- #: admin/views/placements.php:461
2004
  msgid "New Placement"
2005
  msgstr ""
2006
 
@@ -2076,45 +2076,45 @@ msgstr ""
2076
  msgid "template (PHP)"
2077
  msgstr ""
2078
 
2079
- #: admin/views/placements.php:343
2080
- msgid "Item"
2081
  msgstr ""
2082
 
2083
- #: admin/views/placements.php:358
2084
  msgid "after"
2085
  msgstr ""
2086
 
2087
- #: admin/views/placements.php:359
2088
  msgid "before"
2089
  msgstr ""
2090
 
2091
- #: admin/views/placements.php:372
2092
  msgid "position"
2093
  msgstr ""
2094
 
2095
- #: admin/views/placements.php:378
2096
  msgid "Important Notice"
2097
  msgstr ""
2098
 
2099
  #. Translators: %s is a URL.
2100
- #: admin/views/placements.php:401
2101
  msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
2102
  msgstr ""
2103
 
2104
- #: admin/views/placements.php:417
2105
  msgid "show all options"
2106
  msgstr ""
2107
 
2108
- #: admin/views/placements.php:440
2109
  msgid "edit conditions"
2110
  msgstr ""
2111
 
2112
- #: admin/views/placements.php:450
2113
  msgctxt "checkbox to remove placement"
2114
  msgid "delete"
2115
  msgstr ""
2116
 
2117
- #: admin/views/placements.php:457
2118
  msgid "Save Placements"
2119
  msgstr ""
2120
 
@@ -2292,6 +2292,10 @@ msgstr ""
2292
  msgid "Clean up all data related to Advanced Ads when removing the plugin."
2293
  msgstr ""
2294
 
 
 
 
 
2295
  #. translators: %s is a URL.
2296
  #: admin/views/settings/license/section.php:9
2297
  msgid "See also <a href=\"%s\" target=\"_blank\">Issues and questions about licenses</a>."
@@ -2537,48 +2541,48 @@ msgstr ""
2537
  msgid "An error occurred. Please use <a href=\"%s\" target=\"_blank\">this form</a> to sign up."
2538
  msgstr ""
2539
 
2540
- #: classes/ad_placements.php:46
2541
- msgid "Manual Placement"
2542
  msgstr ""
2543
 
2544
- #: classes/ad_placements.php:47
2545
- msgid "Manual placement to use as function or shortcode."
2546
  msgstr ""
2547
 
2548
- #: classes/ad_placements.php:57
2549
- msgid "Header Code"
2550
  msgstr ""
2551
 
2552
- #: classes/ad_placements.php:58
2553
- msgid "Injected in Header (before closing &lt;/head&gt; Tag, often not visible)."
2554
  msgstr ""
2555
 
2556
- #: classes/ad_placements.php:63
2557
- msgid "Footer Code"
2558
  msgstr ""
2559
 
2560
- #: classes/ad_placements.php:64
2561
- msgid "Injected in Footer (before closing &lt;/body&gt; Tag)."
2562
  msgstr ""
2563
 
2564
- #: classes/ad_placements.php:71
2565
- msgid "Injected before the post content."
2566
  msgstr ""
2567
 
2568
- #: classes/ad_placements.php:83
2569
- msgid "Injected after the post content."
2570
  msgstr ""
2571
 
2572
- #: classes/ad_placements.php:95
2573
- msgid "Injected into the content. You can choose the paragraph after which the ad content is displayed."
2574
  msgstr ""
2575
 
2576
- #: classes/ad_placements.php:106
2577
- msgid "Sidebar Widget"
2578
  msgstr ""
2579
 
2580
- #: classes/ad_placements.php:107
2581
- msgid "Create a sidebar widget with an ad. Can be placed and used like any other widget."
2582
  msgstr ""
2583
 
2584
  #. translators: %s is an html tag.
@@ -2936,19 +2940,29 @@ msgstr ""
2936
  msgid "days"
2937
  msgstr ""
2938
 
2939
- #: classes/EDD_SL_Plugin_Updater.php:250
2940
- msgid "There is a new version of %1$s available. %2$sView version %3$s details%4$s."
 
 
 
 
 
 
 
 
 
 
2941
  msgstr ""
2942
 
2943
- #: classes/EDD_SL_Plugin_Updater.php:258
2944
- msgid "There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s."
2945
  msgstr ""
2946
 
2947
- #: classes/EDD_SL_Plugin_Updater.php:502
2948
  msgid "You do not have permission to install plugin updates"
2949
  msgstr ""
2950
 
2951
- #: classes/EDD_SL_Plugin_Updater.php:502
2952
  msgid "Error"
2953
  msgstr ""
2954
 
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Advanced Ads 1.28.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
7
  "Last-Translator: Thomas Maier <post@webzunft.de>\n"
8
  "Language-Team: webgilde <support@wpadvancedads.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-09-07T08:14:36+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: advanced-ads\n"
121
  #. translators: %s is a list of PHP extensions.
122
  #. Translators: %s is a name of a module.
123
  #: admin/includes/ad-health-notices.php:54
124
+ #: admin/views/placements.php:387
125
  msgid "Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s"
126
  msgstr ""
127
 
639
 
640
  #: admin/includes/class-meta-box.php:104
641
  #: admin/views/placements.php:183
642
+ #: admin/views/placements.php:428
643
  #: classes/ad-debug.php:152
644
  msgid "Display Conditions"
645
  msgstr ""
646
 
647
  #: admin/includes/class-meta-box.php:112
648
  #: admin/views/placements.php:192
649
+ #: admin/views/placements.php:436
650
  #: classes/ad-debug.php:239
651
  msgid "Visitor Conditions"
652
  msgstr ""
712
  msgstr ""
713
 
714
  #. translators: %s is a URL.
715
+ #: admin/includes/class-notices.php:436
716
  msgid "You don’t seem to have an email address. Please use <a href=\"%s\" target=\"_blank\">this form</a> to sign up."
717
  msgstr ""
718
 
719
+ #: admin/includes/class-notices.php:457
720
  msgid "How embarrassing. The email server seems to be down. Please try again later."
721
  msgstr ""
722
 
723
  #. translators: the first %s is an email address, the seconds %s is a URL.
724
+ #: admin/includes/class-notices.php:464
725
  msgid "Please check your email (%1$s) for the confirmation message. If you didn’t receive one or want to use another email address then please use <a href=\"%2$s\" target=\"_blank\">this form</a> to sign up."
726
  msgstr ""
727
 
735
 
736
  #: admin/includes/class-overview-widgets.php:115
737
  #: admin/views/notices/welcome-panel.php:15
738
+ #: admin/views/placements-item.php:87
739
  msgid "Create your first ad"
740
  msgstr ""
741
 
797
  msgstr ""
798
 
799
  #: admin/includes/class-overview-widgets.php:450
800
+ msgid "How to download, install and activate an add-on."
 
801
  msgstr ""
802
 
803
  #: admin/includes/class-overview-widgets.php:458
1165
  msgstr ""
1166
 
1167
  #: admin/views/ad-group-list-ads.php:20
1168
+ #: admin/views/placements.php:346
1169
  #: classes/ad-debug.php:118
1170
  #: classes/ad-debug.php:167
1171
  #: classes/ad-debug.php:169
1286
  msgid "previous"
1287
  msgstr ""
1288
 
1289
+ #: admin/views/ad-info-bottom.php:17
 
1290
  msgctxt "wizard navigation"
1291
+ msgid "save"
1292
  msgstr ""
1293
 
1294
+ #: admin/views/ad-info-bottom.php:20
1295
  msgctxt "wizard navigation"
1296
+ msgid "next"
1297
  msgstr ""
1298
 
1299
+ #: admin/views/ad-info-bottom.php:21
1300
  #: admin/views/ad-info-top.php:27
1301
  msgid "Stop Wizard and show all options"
1302
  msgstr ""
1876
  msgstr ""
1877
 
1878
  #: admin/views/placement-injection-top.php:79
1879
+ #: classes/ad_placements.php:46
1880
  msgid "Before Content"
1881
  msgstr ""
1882
 
1883
  #: admin/views/placement-injection-top.php:80
1884
+ #: classes/ad_placements.php:58
1885
  msgid "Content"
1886
  msgstr ""
1887
 
1888
  #: admin/views/placement-injection-top.php:81
1889
+ #: classes/ad_placements.php:70
1890
  msgid "After Content"
1891
  msgstr ""
1892
 
1893
  #: admin/views/placement-injection-top.php:82
1894
+ msgid "Manage Sidebar"
1895
  msgstr ""
1896
 
1897
  #: admin/views/placement-injection-top.php:83
1898
+ msgid "PHP or Shortcode"
1899
  msgstr ""
1900
 
1901
  #: admin/views/placement-injection-top.php:84
1995
  msgstr ""
1996
 
1997
  #: admin/views/placements.php:25
1998
+ #: admin/views/placements.php:464
1999
  msgid "Create a new placement"
2000
  msgstr ""
2001
 
2002
  #: admin/views/placements.php:26
2003
+ #: admin/views/placements.php:466
2004
  msgid "New Placement"
2005
  msgstr ""
2006
 
2076
  msgid "template (PHP)"
2077
  msgstr ""
2078
 
2079
+ #: admin/views/placements.php:347
2080
+ msgid "Group"
2081
  msgstr ""
2082
 
2083
+ #: admin/views/placements.php:363
2084
  msgid "after"
2085
  msgstr ""
2086
 
2087
+ #: admin/views/placements.php:364
2088
  msgid "before"
2089
  msgstr ""
2090
 
2091
+ #: admin/views/placements.php:377
2092
  msgid "position"
2093
  msgstr ""
2094
 
2095
+ #: admin/views/placements.php:383
2096
  msgid "Important Notice"
2097
  msgstr ""
2098
 
2099
  #. Translators: %s is a URL.
2100
+ #: admin/views/placements.php:406
2101
  msgid "Tutorial: <a href=\"%s\" target=\"_blank\">How to place visible ads in the header of your website</a>."
2102
  msgstr ""
2103
 
2104
+ #: admin/views/placements.php:422
2105
  msgid "show all options"
2106
  msgstr ""
2107
 
2108
+ #: admin/views/placements.php:445
2109
  msgid "edit conditions"
2110
  msgstr ""
2111
 
2112
+ #: admin/views/placements.php:455
2113
  msgctxt "checkbox to remove placement"
2114
  msgid "delete"
2115
  msgstr ""
2116
 
2117
+ #: admin/views/placements.php:462
2118
  msgid "Save Placements"
2119
  msgstr ""
2120
 
2292
  msgid "Clean up all data related to Advanced Ads when removing the plugin."
2293
  msgstr ""
2294
 
2295
+ #: admin/views/settings/license/section.php:3
2296
+ msgid "How to install and activate an add-on."
2297
+ msgstr ""
2298
+
2299
  #. translators: %s is a URL.
2300
  #: admin/views/settings/license/section.php:9
2301
  msgid "See also <a href=\"%s\" target=\"_blank\">Issues and questions about licenses</a>."
2541
  msgid "An error occurred. Please use <a href=\"%s\" target=\"_blank\">this form</a> to sign up."
2542
  msgstr ""
2543
 
2544
+ #: classes/ad_placements.php:47
2545
+ msgid "Injected before the post content."
2546
  msgstr ""
2547
 
2548
+ #: classes/ad_placements.php:59
2549
+ msgid "Injected into the content. You can choose the paragraph after which the ad content is displayed."
2550
  msgstr ""
2551
 
2552
+ #: classes/ad_placements.php:71
2553
+ msgid "Injected after the post content."
2554
  msgstr ""
2555
 
2556
+ #: classes/ad_placements.php:82
2557
+ msgid "Sidebar Widget"
2558
  msgstr ""
2559
 
2560
+ #: classes/ad_placements.php:83
2561
+ msgid "Create a sidebar widget with an ad. Can be placed and used like any other widget."
2562
  msgstr ""
2563
 
2564
+ #: classes/ad_placements.php:93
2565
+ msgid "Manual Placement"
2566
  msgstr ""
2567
 
2568
+ #: classes/ad_placements.php:94
2569
+ msgid "Manual placement to use as function or shortcode."
2570
  msgstr ""
2571
 
2572
+ #: classes/ad_placements.php:104
2573
+ msgid "Header Code"
2574
  msgstr ""
2575
 
2576
+ #: classes/ad_placements.php:105
2577
+ msgid "Injected in Header (before closing &lt;/head&gt; Tag, often not visible)."
2578
  msgstr ""
2579
 
2580
+ #: classes/ad_placements.php:110
2581
+ msgid "Footer Code"
2582
  msgstr ""
2583
 
2584
+ #: classes/ad_placements.php:111
2585
+ msgid "Injected in Footer (before closing &lt;/body&gt; Tag)."
2586
  msgstr ""
2587
 
2588
  #. translators: %s is an html tag.
2940
  msgid "days"
2941
  msgstr ""
2942
 
2943
+ #. translators: the plugin name.
2944
+ #: classes/EDD_SL_Plugin_Updater.php:218
2945
+ msgid "There is a new version of %1$s available."
2946
+ msgstr ""
2947
+
2948
+ #. translators: 1. opening anchor tag, do not translate 2. the new plugin version 3. closing anchor tag, do not translate.
2949
+ #: classes/EDD_SL_Plugin_Updater.php:225
2950
+ msgid " %1$sView version %2$s details%3$s."
2951
+ msgstr ""
2952
+
2953
+ #: classes/EDD_SL_Plugin_Updater.php:232
2954
+ msgid " %1$sView version %2$s details%3$s or %4$supdate now%5$s."
2955
  msgstr ""
2956
 
2957
+ #: classes/EDD_SL_Plugin_Updater.php:243
2958
+ msgid "Update now."
2959
  msgstr ""
2960
 
2961
+ #: classes/EDD_SL_Plugin_Updater.php:460
2962
  msgid "You do not have permission to install plugin updates"
2963
  msgstr ""
2964
 
2965
+ #: classes/EDD_SL_Plugin_Updater.php:460
2966
  msgid "Error"
2967
  msgstr ""
2968
 
modules/gadsense/public/public.php CHANGED
@@ -50,6 +50,7 @@ class Advanced_Ads_AdSense_Public {
50
 
51
  // Inject CSS to make AdSense background transparent.
52
  if ( ! empty( $options['background'] ) ) {
 
53
  echo '<style>ins.adsbygoogle { background-color: transparent; padding: 0; }</style>';
54
  }
55
 
50
 
51
  // Inject CSS to make AdSense background transparent.
52
  if ( ! empty( $options['background'] ) ) {
53
+ // Some themes not only get the background wrong, but also add some padding to ins element.
54
  echo '<style>ins.adsbygoogle { background-color: transparent; padding: 0; }</style>';
55
  }
56
 
public/assets/js/ready-queue.js CHANGED
@@ -1,9 +1,11 @@
1
- window.advanced_ads_ready_queue = window.advanced_ads_ready_queue || [];
 
2
 
3
- // replace native push method with our advanced_ads_ready function; do this early to prevent race condition between pushing and the loop.
4
- advanced_ads_ready_queue.push = window.advanced_ads_ready;
5
 
6
- // handle all callbacks that have been added to the queue previously.
7
- for ( var i = 0, length = advanced_ads_ready_queue.length; i < length; i ++ ) {
8
- advanced_ads_ready( advanced_ads_ready_queue[i] );
9
- }
 
1
+ ( function () {
2
+ window.advanced_ads_ready_queue = window.advanced_ads_ready_queue || [];
3
 
4
+ // replace native push method with our advanced_ads_ready function; do this early to prevent race condition between pushing and the loop.
5
+ advanced_ads_ready_queue.push = window.advanced_ads_ready;
6
 
7
+ // handle all callbacks that have been added to the queue previously.
8
+ for ( var i = 0, length = advanced_ads_ready_queue.length; i < length; i ++ ) {
9
+ advanced_ads_ready( advanced_ads_ready_queue[i] );
10
+ }
11
+ } )();
public/assets/js/ready-queue.min.js CHANGED
@@ -1 +1 @@
1
- window.advanced_ads_ready_queue=window.advanced_ads_ready_queue||[],advanced_ads_ready_queue.push=window.advanced_ads_ready;for(var i=0,length=advanced_ads_ready_queue.length;i<length;i++)advanced_ads_ready(advanced_ads_ready_queue[i]);
1
+ !function(){window.advanced_ads_ready_queue=window.advanced_ads_ready_queue||[],advanced_ads_ready_queue.push=window.advanced_ads_ready;for(var d=0,a=advanced_ads_ready_queue.length;d<a;d++)advanced_ads_ready(advanced_ads_ready_queue[d])}();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ads, ad manager, ad rotation, adsense, banner
4
  Requires at least: 4.9
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 1.27.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -322,6 +322,17 @@ Yes. You can use plenty of [hooks](https://wpadvancedads.com/codex/) to customiz
322
 
323
  == Changelog ==
324
 
 
 
 
 
 
 
 
 
 
 
 
325
  = 1.27.0 =
326
 
327
  - Improvement: prevent issues with functionality from other plugins that delay JavaScript execution (WP Rocket, Complianz, et al.).
4
  Requires at least: 4.9
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 1.28.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
322
 
323
  == Changelog ==
324
 
325
+ = 1.28.0 =
326
+
327
+ - Improvement: add an `inline` attribute to the `the_ad` shortcode that allows the user to change the wrapper from `div` to `span`
328
+ - Improvement: update plugin updater class
329
+ - Improvement: rename "Item" option into "Ad / Group" to clarify its purpose
330
+ - Improvement: show a link to create a new ad on the placement page
331
+ - Improvement: show content placements first when creating a new one
332
+ - Improvement: remove welcome panel on ad edit screen
333
+ - Improvement: rename last button in the wizard to "Save" to highlight that this is the last step
334
+ - Fix: wrap `advanced_ads_ready_queue` in an IIEF to prevent naming collisions
335
+
336
  = 1.27.0 =
337
 
338
  - Improvement: prevent issues with functionality from other plugins that delay JavaScript execution (WP Rocket, Complianz, et al.).