Version Description
- added
ADVANCED_ADS_ENABLE_REVISIONS
constant to allow revisions for ads - fixed wrong output after using quick edit in the ads list
- fixed custom position logic to not leave critical errors when localStorage is disabled
- fixed update checks on every admin page impression due to W3TC object cache breaking transients
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.7.14 |
Comparing to | |
See all releases |
Code changes from version 1.7.13 to 1.7.14
- admin/class-advanced-ads-admin.php +28 -1
- admin/includes/class-meta-box.php +1 -0
- admin/includes/class-notices.php +5 -0
- advanced-ads.php +2 -2
- classes/EDD_SL_Plugin_Updater.php +51 -20
- public/assets/js/advanced.js +1 -1
- public/assets/js/advanced.orig.js +11 -1
- public/class-advanced-ads.php +6 -1
- readme.txt +8 -229
admin/class-advanced-ads-admin.php
CHANGED
@@ -64,6 +64,7 @@ class Advanced_Ads_Admin {
|
|
64 |
private function __construct() {
|
65 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
66 |
new Advanced_Ads_Ad_Ajax_Callbacks;
|
|
|
67 |
} else {
|
68 |
add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
|
69 |
add_action( 'load-plugins.php', array( $this, 'check_plugin_licenses' ) );
|
@@ -73,6 +74,9 @@ class Advanced_Ads_Admin {
|
|
73 |
|
74 |
}
|
75 |
|
|
|
|
|
|
|
76 |
public function wp_plugins_loaded() {
|
77 |
/*
|
78 |
* Call $plugin_slug from public plugin class.
|
@@ -110,6 +114,14 @@ class Advanced_Ads_Admin {
|
|
110 |
Advanced_Ads_Admin_Settings::get_instance();
|
111 |
}
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
/**
|
114 |
* Return an instance of this class.
|
115 |
*
|
@@ -626,7 +638,8 @@ class Advanced_Ads_Admin {
|
|
626 |
$slug = basename( $_add_on['path'], '.php' );
|
627 |
$transient_key = md5( serialize( $slug . $license_key ) );
|
628 |
|
629 |
-
add_filter( 'expiration_of_transient_' . $transient_key, array( $this, 'set_expiration_of_update_transient' ) );
|
|
|
630 |
|
631 |
new EDD_SL_Plugin_Updater( ADVADS_URL, $_add_on['path'], array(
|
632 |
'version' => $_add_on['version'],
|
@@ -641,12 +654,26 @@ class Advanced_Ads_Admin {
|
|
641 |
|
642 |
/**
|
643 |
* set the expiration of the updater transient key to 1 day instead of 1 hour to prevent too many update checks
|
|
|
|
|
644 |
*/
|
645 |
public function set_expiration_of_update_transient( $expiration ){
|
646 |
|
647 |
return 86400;
|
648 |
}
|
649 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
/**
|
651 |
* add links to the plugins list
|
652 |
*
|
64 |
private function __construct() {
|
65 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
66 |
new Advanced_Ads_Ad_Ajax_Callbacks;
|
67 |
+
add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded_ajax' ) );
|
68 |
} else {
|
69 |
add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
|
70 |
add_action( 'load-plugins.php', array( $this, 'check_plugin_licenses' ) );
|
74 |
|
75 |
}
|
76 |
|
77 |
+
/**
|
78 |
+
* actions and filter available after all plugins are initialized
|
79 |
+
*/
|
80 |
public function wp_plugins_loaded() {
|
81 |
/*
|
82 |
* Call $plugin_slug from public plugin class.
|
114 |
Advanced_Ads_Admin_Settings::get_instance();
|
115 |
}
|
116 |
|
117 |
+
/**
|
118 |
+
* actions and filters that should also be available for ajax
|
119 |
+
*/
|
120 |
+
public function wp_plugins_loaded_ajax() {
|
121 |
+
// needed here in order to work with Quick Edit option on ad list page
|
122 |
+
Advanced_Ads_Admin_Ad_Type::get_instance();
|
123 |
+
}
|
124 |
+
|
125 |
/**
|
126 |
* Return an instance of this class.
|
127 |
*
|
638 |
$slug = basename( $_add_on['path'], '.php' );
|
639 |
$transient_key = md5( serialize( $slug . $license_key ) );
|
640 |
|
641 |
+
// add_filter( 'expiration_of_transient_' . $transient_key, array( $this, 'set_expiration_of_update_transient' ) );
|
642 |
+
add_filter( 'pre_update_option_' . $transient_key, array( $this, 'set_expiration_of_update_option' ) );
|
643 |
|
644 |
new EDD_SL_Plugin_Updater( ADVADS_URL, $_add_on['path'], array(
|
645 |
'version' => $_add_on['version'],
|
654 |
|
655 |
/**
|
656 |
* set the expiration of the updater transient key to 1 day instead of 1 hour to prevent too many update checks
|
657 |
+
*
|
658 |
+
* @deprecated since version 1.7.14 – not using transient anymore, but option
|
659 |
*/
|
660 |
public function set_expiration_of_update_transient( $expiration ){
|
661 |
|
662 |
return 86400;
|
663 |
}
|
664 |
|
665 |
+
/**
|
666 |
+
* set the expiration of the updater transient key to 1 day instead of 1 hour to prevent too many update checks
|
667 |
+
*
|
668 |
+
* @since 1.7.14
|
669 |
+
*/
|
670 |
+
public function set_expiration_of_update_option( $value ){
|
671 |
+
|
672 |
+
$value['timeout'] = time() + 86400;
|
673 |
+
|
674 |
+
return $value;
|
675 |
+
}
|
676 |
+
|
677 |
/**
|
678 |
* add links to the plugins list
|
679 |
*
|
admin/includes/class-meta-box.php
CHANGED
@@ -75,6 +75,7 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
75 |
'ad-output-box',
|
76 |
'ad-display-box',
|
77 |
'ad-visitor-box',
|
|
|
78 |
'advanced_ads_groupsdiv' // automatically added by ad groups taxonomy
|
79 |
);
|
80 |
|
75 |
'ad-output-box',
|
76 |
'ad-display-box',
|
77 |
'ad-visitor-box',
|
78 |
+
'revisionsdiv', // revisions – only when activated
|
79 |
'advanced_ads_groupsdiv' // automatically added by ad groups taxonomy
|
80 |
);
|
81 |
|
admin/includes/class-notices.php
CHANGED
@@ -343,6 +343,11 @@ class Advanced_Ads_Admin_Notices {
|
|
343 |
&& ! Advanced_Ads_Admin::screen_belongs_to_advanced_ads() ) {
|
344 |
continue;
|
345 |
}
|
|
|
|
|
|
|
|
|
|
|
346 |
|
347 |
switch ( $type ) {
|
348 |
case 'info' :
|
343 |
&& ! Advanced_Ads_Admin::screen_belongs_to_advanced_ads() ) {
|
344 |
continue;
|
345 |
}
|
346 |
+
|
347 |
+
// don't display license nag if ADVANCED_ADS_SUPPRESS_PLUGIN_ERROR_NOTICES is defined
|
348 |
+
if( defined( 'ADVANCED_ADS_SUPPRESS_PLUGIN_ERROR_NOTICES' ) && $advanced_ads_admin_notices[$_notice]['type'] == 'plugin_error' ) {
|
349 |
+
continue;
|
350 |
+
}
|
351 |
|
352 |
switch ( $type ) {
|
353 |
case 'info' :
|
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.7.
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.com
|
18 |
* Text Domain: advanced-ads
|
@@ -39,7 +39,7 @@ define( 'ADVADS_BASE_DIR', dirname( ADVADS_BASE ) ); // directory of the plugin
|
|
39 |
// general and global slug, e.g. to store options in WP, textdomain
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
-
define( 'ADVADS_VERSION', '1.7.
|
43 |
|
44 |
/*----------------------------------------------------------------------------*
|
45 |
* Autoloading, modules and functions
|
12 |
* Plugin Name: Advanced Ads
|
13 |
* Plugin URI: https://wpadvancedads.com
|
14 |
* Description: Manage and optimize your ads in WordPress
|
15 |
+
* Version: 1.7.14
|
16 |
* Author: Thomas Maier
|
17 |
* Author URI: http://webgilde.com
|
18 |
* Text Domain: advanced-ads
|
39 |
// general and global slug, e.g. to store options in WP, textdomain
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
+
define( 'ADVADS_VERSION', '1.7.14' );
|
43 |
|
44 |
/*----------------------------------------------------------------------------*
|
45 |
* Autoloading, modules and functions
|
classes/EDD_SL_Plugin_Updater.php
CHANGED
@@ -35,7 +35,7 @@ class EDD_SL_Plugin_Updater {
|
|
35 |
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
36 |
|
37 |
global $edd_plugin_data;
|
38 |
-
|
39 |
$this->api_url = trailingslashit( $_api_url );
|
40 |
$this->api_data = $_api_data;
|
41 |
$this->name = plugin_basename( $_plugin_file );
|
@@ -60,7 +60,7 @@ class EDD_SL_Plugin_Updater {
|
|
60 |
* @return void
|
61 |
*/
|
62 |
public function init() {
|
63 |
-
|
64 |
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
|
65 |
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
66 |
remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10, 2 );
|
@@ -85,7 +85,7 @@ class EDD_SL_Plugin_Updater {
|
|
85 |
public function check_update( $_transient_data ) {
|
86 |
|
87 |
global $pagenow;
|
88 |
-
|
89 |
if ( ! is_object( $_transient_data ) ) {
|
90 |
$_transient_data = new stdClass;
|
91 |
}
|
@@ -98,12 +98,13 @@ class EDD_SL_Plugin_Updater {
|
|
98 |
return $_transient_data;
|
99 |
}
|
100 |
|
101 |
-
$version_info =
|
102 |
|
103 |
if ( false === $version_info ) {
|
104 |
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
105 |
|
106 |
-
|
|
|
107 |
}
|
108 |
|
109 |
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
@@ -129,7 +130,7 @@ class EDD_SL_Plugin_Updater {
|
|
129 |
* @param array $plugin
|
130 |
*/
|
131 |
public function show_update_notification( $file, $plugin ) {
|
132 |
-
|
133 |
if ( is_network_admin() ) {
|
134 |
return;
|
135 |
}
|
@@ -155,12 +156,12 @@ class EDD_SL_Plugin_Updater {
|
|
155 |
|
156 |
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
157 |
|
158 |
-
$version_info =
|
159 |
|
160 |
if ( false === $version_info ) {
|
161 |
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
162 |
|
163 |
-
|
164 |
}
|
165 |
|
166 |
if ( ! is_object( $version_info ) ) {
|
@@ -235,8 +236,7 @@ class EDD_SL_Plugin_Updater {
|
|
235 |
* @return object $_data
|
236 |
*/
|
237 |
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
238 |
-
|
239 |
-
|
240 |
if ( $_action != 'plugin_information' ) {
|
241 |
|
242 |
return $_data;
|
@@ -258,18 +258,18 @@ class EDD_SL_Plugin_Updater {
|
|
258 |
)
|
259 |
);
|
260 |
|
261 |
-
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data
|
262 |
-
|
263 |
-
//Get the transient where we store the api request for this plugin for 24 hours
|
264 |
-
$edd_api_request_transient =
|
265 |
|
266 |
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
267 |
if ( empty( $edd_api_request_transient ) ){
|
268 |
|
269 |
$api_response = $this->api_request( 'plugin_information', $to_send );
|
270 |
|
271 |
-
//Expires in
|
272 |
-
|
273 |
|
274 |
if ( false !== $api_response ) {
|
275 |
$_data = $api_response;
|
@@ -309,7 +309,7 @@ class EDD_SL_Plugin_Updater {
|
|
309 |
private function api_request( $_action, $_data ) {
|
310 |
|
311 |
global $wp_version;
|
312 |
-
|
313 |
$data = array_merge( $this->api_data, $_data );
|
314 |
|
315 |
if ( $data['slug'] != $this->slug ) {
|
@@ -347,7 +347,7 @@ class EDD_SL_Plugin_Updater {
|
|
347 |
}
|
348 |
|
349 |
public function show_changelog() {
|
350 |
-
|
351 |
global $edd_plugin_data;
|
352 |
|
353 |
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
|
@@ -368,7 +368,7 @@ class EDD_SL_Plugin_Updater {
|
|
368 |
|
369 |
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
370 |
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' );
|
371 |
-
$version_info =
|
372 |
|
373 |
if( false === $version_info ) {
|
374 |
|
@@ -393,7 +393,7 @@ class EDD_SL_Plugin_Updater {
|
|
393 |
$version_info = false;
|
394 |
}
|
395 |
|
396 |
-
|
397 |
|
398 |
}
|
399 |
|
@@ -404,4 +404,35 @@ class EDD_SL_Plugin_Updater {
|
|
404 |
exit;
|
405 |
}
|
406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
}
|
35 |
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
36 |
|
37 |
global $edd_plugin_data;
|
38 |
+
|
39 |
$this->api_url = trailingslashit( $_api_url );
|
40 |
$this->api_data = $_api_data;
|
41 |
$this->name = plugin_basename( $_plugin_file );
|
60 |
* @return void
|
61 |
*/
|
62 |
public function init() {
|
63 |
+
|
64 |
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
|
65 |
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
66 |
remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10, 2 );
|
85 |
public function check_update( $_transient_data ) {
|
86 |
|
87 |
global $pagenow;
|
88 |
+
|
89 |
if ( ! is_object( $_transient_data ) ) {
|
90 |
$_transient_data = new stdClass;
|
91 |
}
|
98 |
return $_transient_data;
|
99 |
}
|
100 |
|
101 |
+
$version_info = $this->get_cached_version_info();
|
102 |
|
103 |
if ( false === $version_info ) {
|
104 |
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
105 |
|
106 |
+
$this->set_version_info_cache( $version_info );
|
107 |
+
|
108 |
}
|
109 |
|
110 |
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
130 |
* @param array $plugin
|
131 |
*/
|
132 |
public function show_update_notification( $file, $plugin ) {
|
133 |
+
|
134 |
if ( is_network_admin() ) {
|
135 |
return;
|
136 |
}
|
156 |
|
157 |
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
158 |
|
159 |
+
$version_info = $this->get_cached_version_info();
|
160 |
|
161 |
if ( false === $version_info ) {
|
162 |
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
163 |
|
164 |
+
$this->set_version_info_cache( $version_info );
|
165 |
}
|
166 |
|
167 |
if ( ! is_object( $version_info ) ) {
|
236 |
* @return object $_data
|
237 |
*/
|
238 |
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
239 |
+
|
|
|
240 |
if ( $_action != 'plugin_information' ) {
|
241 |
|
242 |
return $_data;
|
258 |
)
|
259 |
);
|
260 |
|
261 |
+
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] ) );
|
262 |
+
|
263 |
+
// Get the transient where we store the api request for this plugin for 24 hours
|
264 |
+
$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
|
265 |
|
266 |
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
267 |
if ( empty( $edd_api_request_transient ) ){
|
268 |
|
269 |
$api_response = $this->api_request( 'plugin_information', $to_send );
|
270 |
|
271 |
+
// Expires in 3 hours
|
272 |
+
$this->set_version_info_cache( $api_response, $cache_key );
|
273 |
|
274 |
if ( false !== $api_response ) {
|
275 |
$_data = $api_response;
|
309 |
private function api_request( $_action, $_data ) {
|
310 |
|
311 |
global $wp_version;
|
312 |
+
|
313 |
$data = array_merge( $this->api_data, $_data );
|
314 |
|
315 |
if ( $data['slug'] != $this->slug ) {
|
347 |
}
|
348 |
|
349 |
public function show_changelog() {
|
350 |
+
|
351 |
global $edd_plugin_data;
|
352 |
|
353 |
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
|
368 |
|
369 |
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
370 |
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' );
|
371 |
+
$version_info = $this->get_cached_version_info( $cache_key );
|
372 |
|
373 |
if( false === $version_info ) {
|
374 |
|
393 |
$version_info = false;
|
394 |
}
|
395 |
|
396 |
+
$this->set_version_info_cache( $version_info, $cache_key );
|
397 |
|
398 |
}
|
399 |
|
404 |
exit;
|
405 |
}
|
406 |
|
407 |
+
public function get_cached_version_info( $cache_key = '' ) {
|
408 |
+
|
409 |
+
if( empty( $cache_key ) ) {
|
410 |
+
$cache_key = $this->cache_key;
|
411 |
+
}
|
412 |
+
|
413 |
+
$cache = get_option( $cache_key );
|
414 |
+
|
415 |
+
if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) {
|
416 |
+
return false; // Cache is expired
|
417 |
+
}
|
418 |
+
|
419 |
+
return json_decode( $cache['value'] );
|
420 |
+
|
421 |
+
}
|
422 |
+
|
423 |
+
public function set_version_info_cache( $value = '', $cache_key = '' ) {
|
424 |
+
|
425 |
+
if( empty( $cache_key ) ) {
|
426 |
+
$cache_key = $this->cache_key;
|
427 |
+
}
|
428 |
+
|
429 |
+
$data = array(
|
430 |
+
'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ),
|
431 |
+
'value' => json_encode( $value )
|
432 |
+
);
|
433 |
+
|
434 |
+
update_option( $this->cache_key, $data );
|
435 |
+
|
436 |
+
}
|
437 |
+
|
438 |
}
|
public/assets/js/advanced.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
advads={max_per_session:function(e,t){var
|
1 |
+
advads={supports_localstorage:function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}},max_per_session:function(e,t){var o=1;if((void 0===t||0===parseInt(t))&&(t=1),this.cookie_exists(e)){if(this.get_cookie(e)>=t)return!0;o+=parseInt(this.get_cookie(e))}return this.set_cookie(e,o),!1},count_up:function(e){var t=1;this.cookie_exists(e)&&(t+=parseInt(this.get_cookie(e))),this.set_cookie(e,t)},set_cookie_exists:function(e){return get_cookie(e)?!0:(set_cookie(e,"",0),!1)},get_cookie:function(e){var t,o,i,s=document.cookie.split(";");for(t=0;t<s.length;t++)if(o=s[t].substr(0,s[t].indexOf("=")),i=s[t].substr(s[t].indexOf("=")+1),o=o.replace(/^\s+|\s+$/g,""),o===e)return unescape(i)},set_cookie:function(e,t,o,i,s,r){var n=24*o*60*60;this.set_cookie_sec(e,t,n,i,s,r)},set_cookie_sec:function(e,t,o,i,s,r){var n=new Date;n.setSeconds(n.getSeconds()+parseInt(o)),document.cookie=e+"="+escape(t)+(null==o?"":"; expires="+n.toUTCString())+(null==i?"; path=/":"; path="+i)+(null==s?"":"; domain="+s)+(null==r?"":"; secure")},cookie_exists:function(e){var t=this.get_cookie(e);return null!==t&&""!==t&&void 0!==t?!0:!1},move:function(e,t,o){var i=jQuery(e);if(void 0===o&&(o={}),void 0===o.css&&(o.css={}),void 0===o.method&&(o.method="prependTo"),""===t&&void 0!==o.target)switch(o.target){case"wrapper":var s="left";void 0!==o.offset&&(s=o.offset),t=this.find_wrapper(e,s)}switch(o.method){case"insertBefore":i.insertBefore(t);break;case"insertAfter":i.insertAfter(t);break;case"appendTo":i.appendTo(t);break;case"prependTo":i.prependTo(t);break;default:i.prependTo(t)}},fix_element:function(e,t){var o=jQuery(e),i=o.parent();("static"===i.css("position")||""===i.css("position"))&&i.css("position","relative"),void 0!==t&&t.is_invisible&&o.show();var s=parseInt(o.offset().top),r=parseInt(o.offset().left);void 0!==t&&t.is_invisible&&o.hide(),o.css("position","fixed").css("top",s+"px").css("left",r+"px")},find_wrapper:function(e,t){var o;return jQuery("body").children().each(function(i,s){if(s.id!==e.substring(1)){var r=jQuery(s);if("right"===t&&r.offset().left+jQuery(r).width()<jQuery(window).width()||"left"===t&&r.offset().left>0)return("static"===r.css("position")||""===r.css("position"))&&r.css("position","relative"),o=s,!1}}),o},center_fixed_element:function(e){var t=jQuery(e),o=jQuery(window).width()/2-parseInt(t.css("width"))/2;t.css("left",o+"px")},center_vertically:function(e){var t=jQuery(e),o=jQuery(window).height()/2-parseInt(t.css("height"))/2;t.css("top",o+"px")},close:function(e){var t=jQuery(e);t.remove()}},jQuery(document).ready(function(){if(advads.supports_localstorage()&&localStorage.getItem("advads_frontend_picker")){var e,t=jQuery("<div id='advads-picker-overlay'>"),o=[document.body,document.documentElement,document];t.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(i){if(i.target!==e){if(~o.indexOf(i.target))return e=null,void t.hide();var s=jQuery(i.target),r=s.offset(),n=s.outerWidth(),a=s.outerHeight();e=i.target,t.css({top:r.top,left:r.left,width:n,height:a}).show(),console.log(jQuery(e).getPath())}}),jQuery(document).click(function(){var t=jQuery(e).getPath();localStorage.setItem("advads_frontend_element",t),window.location=localStorage.getItem("advads_prev_url")})}}),jQuery.fn.extend({getPath:function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=0),this.is("html"))return"html > "+e;if(3===t)return e;var o=this.get(0).nodeName.toLowerCase(),i=this.attr("id"),s=this.attr("class");return t+=1,void 0===i||/\d/.test(i)?void 0!==s&&(s=s.split(/[\s\n]+/),s=jQuery.grep(s,function(e){return!/\d/.test(e)}),s.length&&(o+="."+s.slice(0,2).join("."))):o+="#"+i,this.siblings(o).length&&(o+=":eq("+this.siblings(o).addBack().not("#advads-picker-overlay").index(this)+")"),""===e?this.parent().getPath(o,t):this.parent().getPath(o+" > "+e,t)}});
|
public/assets/js/advanced.orig.js
CHANGED
@@ -3,6 +3,16 @@
|
|
3 |
*/
|
4 |
|
5 |
advads = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
/**
|
7 |
* check if the ad is displayed more than {max} times per session
|
8 |
* every check increases the counter
|
@@ -268,7 +278,7 @@ advads = {
|
|
268 |
// highlight elements in frontend, if local storage variable is set
|
269 |
jQuery(document).ready(function(){
|
270 |
// only trigger if local storage is available
|
271 |
-
if( localStorage.getItem('advads_frontend_picker') ) {
|
272 |
var advads_picker_cur, advads_picker_overlay = jQuery("<div id='advads-picker-overlay'>"),
|
273 |
advads_picker_no = [document.body, document.documentElement, document];
|
274 |
advads_picker_overlay.css({position: 'absolute', border: 'solid 2px #428bca',
|
3 |
*/
|
4 |
|
5 |
advads = {
|
6 |
+
/**
|
7 |
+
* check if localstorage is supported/enabled by client
|
8 |
+
*/
|
9 |
+
supports_localstorage: function() {
|
10 |
+
try {
|
11 |
+
return "localStorage" in window && null !== window.localStorage
|
12 |
+
} catch (e) {
|
13 |
+
return !1
|
14 |
+
}
|
15 |
+
},
|
16 |
/**
|
17 |
* check if the ad is displayed more than {max} times per session
|
18 |
* every check increases the counter
|
278 |
// highlight elements in frontend, if local storage variable is set
|
279 |
jQuery(document).ready(function(){
|
280 |
// only trigger if local storage is available
|
281 |
+
if( advads.supports_localstorage() && localStorage.getItem('advads_frontend_picker') ) {
|
282 |
var advads_picker_cur, advads_picker_overlay = jQuery("<div id='advads-picker-overlay'>"),
|
283 |
advads_picker_no = [document.body, document.documentElement, document];
|
284 |
advads_picker_overlay.css({position: 'absolute', border: 'solid 2px #428bca',
|
public/class-advanced-ads.php
CHANGED
@@ -608,6 +608,11 @@ class Advanced_Ads {
|
|
608 |
'not_found_in_trash' => __( 'No Ads found in Trash', 'advanced-ads' ),
|
609 |
'parent' => __( 'Parent Ad', 'advanced-ads' ),
|
610 |
);
|
|
|
|
|
|
|
|
|
|
|
611 |
|
612 |
$post_type_params = array(
|
613 |
'labels' => $labels,
|
@@ -641,7 +646,7 @@ class Advanced_Ads {
|
|
641 |
'has_archive' => false,
|
642 |
//'rewrite' => array( 'slug' => ADVADS_SLUG ),
|
643 |
'query_var' => true,
|
644 |
-
'supports' =>
|
645 |
'taxonomies' => array( Advanced_Ads::AD_GROUP_TAXONOMY )
|
646 |
);
|
647 |
|
608 |
'not_found_in_trash' => __( 'No Ads found in Trash', 'advanced-ads' ),
|
609 |
'parent' => __( 'Parent Ad', 'advanced-ads' ),
|
610 |
);
|
611 |
+
|
612 |
+
$supports = array( 'title' );
|
613 |
+
if( defined( 'ADVANCED_ADS_ENABLE_REVISIONS') ){
|
614 |
+
$supports[] = 'revisions';
|
615 |
+
};
|
616 |
|
617 |
$post_type_params = array(
|
618 |
'labels' => $labels,
|
646 |
'has_archive' => false,
|
647 |
//'rewrite' => array( 'slug' => ADVADS_SLUG ),
|
648 |
'query_var' => true,
|
649 |
+
'supports' => $supports,
|
650 |
'taxonomies' => array( Advanced_Ads::AD_GROUP_TAXONOMY )
|
651 |
);
|
652 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id
|
|
4 |
Tags: ads, ad, ad inserter, ad injection, ad manager, ads manager, ad widget, adrotate, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banners, buysellads, chitika, clickbank, dfp, doubleclick, geotarget, geolocation, geo location, google dfp, monetization, widget
|
5 |
Requires at least: WP 4.2, PHP 5.3
|
6 |
Tested up to: 4.7
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -206,6 +206,13 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
206 |
|
207 |
== Changelog ==
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
= 1.7.13 =
|
210 |
|
211 |
* fix for class name sensitive systems and Tracking autoloader
|
@@ -245,234 +252,6 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
245 |
* restructured support page to reach helper more quickly
|
246 |
* fixed header ad bug
|
247 |
|
248 |
-
= 1.7.9.3 =
|
249 |
-
|
250 |
-
* added Selling Ads widget on overview page
|
251 |
-
* removed add-on update transient hopefully fixing update checks
|
252 |
-
* updated EDD class
|
253 |
-
* workaround for empty post-id error caused by BuddyPress
|
254 |
-
|
255 |
-
= 1.7.9.2 =
|
256 |
-
|
257 |
-
* display ad health menu only to ad admins
|
258 |
-
* removed update notices prior to 1.7
|
259 |
-
* fixed is_not operator for specific pages did not display the ad on archive pages
|
260 |
-
* fixed disabled-ads notice showing on support page when no option was selected
|
261 |
-
* fixed user rights not set correctly on network activate in a multisite – please disable and reenable the plugin if you have it network activated
|
262 |
-
|
263 |
-
= 1.7.9.1 =
|
264 |
-
|
265 |
-
* removed the `the_content` check from non-singular pages
|
266 |
-
* moved ad blocker check into footer
|
267 |
-
|
268 |
-
= 1.7.9 =
|
269 |
-
|
270 |
-
* added frontend error checks to the admin bar
|
271 |
-
* changed default value for AdSense limit from true to false due to AdSense policy change, [read more](https://webgilde.com/en/ad-limit-adsense/)
|
272 |
-
* fixed unhighlighted placement type in Chrome
|
273 |
-
|
274 |
-
= 1.7.8 =
|
275 |
-
|
276 |
-
* prevent any ad container output in the header
|
277 |
-
* show advertisement label also for manually placed ads
|
278 |
-
* fixed AdSense slot ID when delivered through cache-busting
|
279 |
-
* fixed reserved place option not working after image upload
|
280 |
-
* fixed placement type display
|
281 |
-
* fixed missing translation for show/hide options
|
282 |
-
|
283 |
-
= 1.7.7 =
|
284 |
-
|
285 |
-
* allow to inject a new ad into existing placements
|
286 |
-
* added is/is_not operator to “post type” display condition
|
287 |
-
* show ads with the “specific pages” display condition only on these pages and not on archives
|
288 |
-
* set expired ads to “draft” post status
|
289 |
-
* highlight draft and pending ads in ad list
|
290 |
-
* updated AdSense 3-ads-limit text. AdSense has no explicit limit anymore
|
291 |
-
|
292 |
-
= 1.7.6 =
|
293 |
-
|
294 |
-
* prevent third part meta boxes in the ad edit screen
|
295 |
-
* set `ADVANCED_ADS_DISABLE_FRONTEND_AD_WEIGHT_UPDATE` constant to disable frontend group updates (for high traffic sites)
|
296 |
-
* enabled overriding placements through the import
|
297 |
-
* added uninstall option to remove all data on plugin uninstall (default: not removed)
|
298 |
-
* optimized element selector script used in Pro and Sticky
|
299 |
-
* fixed specific page display condition on archive pages
|
300 |
-
* fixed output of wrong publisher ID in admin panel
|
301 |
-
* fixed missing index error with ad block disguise
|
302 |
-
* fixed minor widget error on ad dashboard page
|
303 |
-
|
304 |
-
= 1.7.5.1 =
|
305 |
-
|
306 |
-
* add and remove ads in groups in the group overview page
|
307 |
-
* separated admin code into multiple files for better overview
|
308 |
-
* log possible content injection errors only for admin users in the frontend
|
309 |
-
* double error messages hidden on plugin support page
|
310 |
-
|
311 |
-
= 1.7.5 =
|
312 |
-
|
313 |
-
* prepared for [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/) 1.4 with ad reloads, single request mode and placement tests
|
314 |
-
|
315 |
-
= 1.7.4.5 =
|
316 |
-
|
317 |
-
* extended feed cache to 48 hours
|
318 |
-
* updated EDD add-on updater class
|
319 |
-
* display possible injection errors only, when WP_DEBUG is enabled
|
320 |
-
* fixed content injection when duplicate ids are found in content
|
321 |
-
* fixed JavaScript conflict that prevented Display Conditions from working
|
322 |
-
|
323 |
-
= 1.7.4.4 =
|
324 |
-
|
325 |
-
* linked first-ad tutorials above ad list if less than 3 ads created yet
|
326 |
-
* fixed Wizard buttons not working due to JavaScript conflict
|
327 |
-
* fixed manual added container id not displayed for ads not added through placement
|
328 |
-
|
329 |
-
= 1.7.4.3 =
|
330 |
-
|
331 |
-
* changed content injection parsing from xml to html to decrease issues with broken html
|
332 |
-
* added check for content injection compatibility on ad edit page
|
333 |
-
* fixed error when ad list columns are missing
|
334 |
-
* fixed missing post format display condition
|
335 |
-
* added fix for sticky ads with timeout
|
336 |
-
|
337 |
-
= 1.7.4.2 =
|
338 |
-
|
339 |
-
* hide contrainer class, id and ad debug mode in Wizard
|
340 |
-
* fixed term query showing on every page impression
|
341 |
-
* fixed capabilities issue with Theia post slider
|
342 |
-
* fixed unnecessary admin notifications queries
|
343 |
-
* fixed ad title disappear when type was selected
|
344 |
-
* fixed ad group parameter layout
|
345 |
-
* fixed init hook to allow adding custom taxonomies
|
346 |
-
* ad meta boxes are now forced to be visible
|
347 |
-
* added link to advertisement label manual
|
348 |
-
|
349 |
-
= 1.7.4.1 =
|
350 |
-
|
351 |
-
* order ads in widgets and placements by ad title
|
352 |
-
* set OR as default connector in Display Conditions
|
353 |
-
* force OR on Display Conditions where conditions with AND never show the ad
|
354 |
-
|
355 |
-
= 1.7.4 =
|
356 |
-
|
357 |
-
* added Wizard to quickly create new ads, [manual](https://wpadvancedads.com/manual/wizard/)
|
358 |
-
* import / export feature
|
359 |
-
* optimized ad setting lists layout
|
360 |
-
* select scheduled ads for placements or in the ad widget
|
361 |
-
* allow wrapper class to include uppercase letters
|
362 |
-
* display ad image icon on ad overview page
|
363 |
-
* reactivate existing add-on licenses after shop upgrade
|
364 |
-
* don’t show ads on unrelated page types when a "show" + category display condition is set
|
365 |
-
* fix for using groups in some advanced placements
|
366 |
-
* fixed caching of dashboard widget
|
367 |
-
* fixed missing user capabilities after update
|
368 |
-
* fixed public url for ads due to possible WP bug
|
369 |
-
* updated Portuguese (Brazil) translation
|
370 |
-
|
371 |
-
= 1.7.3 =
|
372 |
-
|
373 |
-
* allow ad injection with just one click after ad was published
|
374 |
-
* fix for unset ad type breaks saving the ad
|
375 |
-
* fix for ads injected into main content which use document.write with closing tags
|
376 |
-
* fixed pro placements not visible when adblocker is enabled
|
377 |
-
* forces ad type metabox to stay open for new ads
|
378 |
-
|
379 |
-
= 1.7.2.1 =
|
380 |
-
|
381 |
-
* fix for missing index with newly created ads
|
382 |
-
|
383 |
-
= 1.7.2 =
|
384 |
-
|
385 |
-
* license settings page rewritten
|
386 |
-
* added Ad Group ad type
|
387 |
-
* added ad specific capabilities
|
388 |
-
* added label above ads
|
389 |
-
* collapse ad type meta box for existing ads
|
390 |
-
* added links to manual and inline videos to the meta box headline
|
391 |
-
* updated translation files
|
392 |
-
* remove hyphen from automatically created id prefix to not break ID creation
|
393 |
-
|
394 |
-
= 1.7.1.5 =
|
395 |
-
|
396 |
-
* hotfix: added missing file
|
397 |
-
|
398 |
-
= 1.7.1.4 =
|
399 |
-
|
400 |
-
* search for title or id instead of content when selecting a Specific Page Display Condition
|
401 |
-
* fixed double display conditions
|
402 |
-
* fixes notices appearing once after update
|
403 |
-
* fixed display condition error warning
|
404 |
-
* fixed content injection breaking when unescaped `</script>` was used within `document.write`
|
405 |
-
* added taxonomies created by Custom Post Type UI plugin to the display conditions
|
406 |
-
* add content placement for paragraphs without images
|
407 |
-
|
408 |
-
= 1.7.1.3 =
|
409 |
-
|
410 |
-
* fixed error when $wp_query is not set
|
411 |
-
* added French translation
|
412 |
-
|
413 |
-
= 1.7.1.2 =
|
414 |
-
|
415 |
-
* tested with WP 4.5
|
416 |
-
* create random widget id, if not set yet
|
417 |
-
* allow content injection into nested paragraphs if none found at level 1 and 2
|
418 |
-
* minor security update for admin ajax actions
|
419 |
-
* fixed home condition for some cases
|
420 |
-
* fixed secondary query check
|
421 |
-
* fixed de/activation hook
|
422 |
-
* fixed Spanish translation
|
423 |
-
* updated translation files
|
424 |
-
|
425 |
-
= 1.7.1.1 =
|
426 |
-
|
427 |
-
* added Feed condition to General Display Conditions
|
428 |
-
* trim license keys when saving
|
429 |
-
* reverted too strict display condition checks for taxonomies
|
430 |
-
* shortened debug page
|
431 |
-
|
432 |
-
= 1.7.1 =
|
433 |
-
|
434 |
-
* introduced AND/OR connectors for Display Conditions
|
435 |
-
* display conditions for some pages (archive page) are now stricter
|
436 |
-
* connectors for existing visitor conditions can be changed now
|
437 |
-
* added option to reserve ad space
|
438 |
-
* set ADVANCED_ADS_DISALLOW_PHP constant to prevent usage of PHP in plain ad code
|
439 |
-
* update ad block disguise files automatically, when Advanced Ads scripts changed after an update
|
440 |
-
|
441 |
-
= 1.7.0.3 =
|
442 |
-
|
443 |
-
* added debug mode for ads, see [manual](https://wpadvancedads.com/manual/ad-debug-mode/)
|
444 |
-
* skip check for general conditions if all are on (allows ad injection also in iframes and new wp instances)
|
445 |
-
* display jQuery issue notice in display conditions
|
446 |
-
* lifted the restriction to choose each display condition only once
|
447 |
-
* add notice when ad block folder needs to be rebuild
|
448 |
-
* hide an ad with a tag condition in posts that don’t have a tag at all
|
449 |
-
* prevent broken custom queries to interfere with display conditions
|
450 |
-
|
451 |
-
= 1.7.0.2 =
|
452 |
-
|
453 |
-
* hide ad if no term is selected for taxonomy display conditions
|
454 |
-
* show warning, if no items selected in display conditions
|
455 |
-
* fixed 500 error caused by plugins using WP_Query unsecured
|
456 |
-
|
457 |
-
= 1.7.0.1 =
|
458 |
-
|
459 |
-
* hotfix for missing get_current_screen issue
|
460 |
-
|
461 |
-
= 1.7 =
|
462 |
-
|
463 |
-
* rewritten Display Conditions interface and logic, see [manual](http://wpadvancedads.com/manual/display-conditions/)
|
464 |
-
* rich content ads now render oembed links
|
465 |
-
* added author display condition
|
466 |
-
* added link to Visitor Conditions manual
|
467 |
-
* added incompatibility warning for Q2W3 plugin
|
468 |
-
* home page display condition honored also on static pages
|
469 |
-
* single post display condition honored also on archive pages
|
470 |
-
* prevent ads from being loaded in wp_head when they are not a header placement
|
471 |
-
* optimized support form and added feedback messages
|
472 |
-
* fixed general secondary query setting
|
473 |
-
* fixes for jQuery issues and message for solutions
|
474 |
-
* fix error when editor role is missing
|
475 |
-
|
476 |
[Changelog Archive](http://wpadvancedads.com/codex/changelog-archive/)
|
477 |
|
478 |
== Upgrade Notice ==
|
4 |
Tags: ads, ad, ad inserter, ad injection, ad manager, ads manager, ad widget, adrotate, adsense, advertise, advertisements, advertising, adverts, advert, amazon, banner, banners, buysellads, chitika, clickbank, dfp, doubleclick, geotarget, geolocation, geo location, google dfp, monetization, widget
|
5 |
Requires at least: WP 4.2, PHP 5.3
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 1.7.14
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
206 |
|
207 |
== Changelog ==
|
208 |
|
209 |
+
= 1.7.14 =
|
210 |
+
|
211 |
+
* added `ADVANCED_ADS_ENABLE_REVISIONS` constant to allow revisions for ads
|
212 |
+
* fixed wrong output after using quick edit in the ads list
|
213 |
+
* fixed custom position logic to not leave critical errors when localStorage is disabled
|
214 |
+
* fixed update checks on every admin page impression due to W3TC object cache breaking transients
|
215 |
+
|
216 |
= 1.7.13 =
|
217 |
|
218 |
* fix for class name sensitive systems and Tracking autoloader
|
252 |
* restructured support page to reach helper more quickly
|
253 |
* fixed header ad bug
|
254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
[Changelog Archive](http://wpadvancedads.com/codex/changelog-archive/)
|
256 |
|
257 |
== Upgrade Notice ==
|