Version Description
- prevent third part meta boxes in the ad edit screen
- set
ADVANCED_ADS_DISABLE_FRONTEND_AD_WEIGHT_UPDATE
constant to disable frontend group updates (for high traffic sites) - enabled overriding placements through the import
- added uninstall option to remove all data on plugin uninstall (default: not removed)
- optimized element selector script used in Pro and Sticky
- fixed specific page display condition on archive pages
- fixed output of wrong publisher ID in admin panel
- fixed missing index error with ad block disguise
- fixed minor widget error on ad dashboard page
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.7.6 |
Comparing to | |
See all releases |
Code changes from version 1.7.5.1 to 1.7.6
- admin/assets/css/admin.css +4 -2
- admin/assets/js/wizard.js +1 -1
- admin/class-advanced-ads-admin.php +1 -2
- admin/includes/class-ad-type.php +1 -1
- admin/includes/class-meta-box.php +38 -6
- admin/includes/class-overview-widgets.php +11 -1
- admin/includes/class-settings.php +24 -0
- admin/views/post-ad-settings-metabox.php +1 -1
- admin/views/setting-license.php +7 -3
- advanced-ads.php +2 -2
- classes/ad_group.php +8 -1
- classes/checks.php +2 -2
- classes/display-conditions.php +4 -3
- classes/plugin.php +91 -1
- classes/widget.php +14 -7
- includes/load_modules.php +7 -4
- modules/ad-blocker/admin/admin.php +43 -13
- modules/ad-blocker/classes/plugin.php +1 -1
- modules/gadsense/admin/views/adsense-ad-parameters.php +1 -1
- modules/import-export/classes/import.php +78 -29
- public/assets/js/advanced.js +1 -1
- public/assets/js/advanced.orig.js +17 -8
- public/class-advanced-ads.php +1 -1
- readme.txt +13 -1
- uninstall.php +0 -17
admin/assets/css/admin.css
CHANGED
@@ -9,8 +9,8 @@
|
|
9 |
* OVERVIEW PAGE
|
10 |
*/
|
11 |
.toplevel_page_advanced-ads #dashboard-widgets .postbox-container { width: 100% !important; }
|
12 |
-
.toplevel_page_advanced-ads #dashboard-widgets .postbox-container .postbox { float: left; width:
|
13 |
-
.toplevel_page_advanced-ads #dashboard-widgets .postbox-container .postbox + .postbox { margin-left: 1%; }
|
14 |
.toplevel_page_advanced-ads #dashboard-widgets .postbox-container .postbox ul.list { list-style: inside; }
|
15 |
.toplevel_page_advanced-ads .metabox-holder .postbox-container .empty-container { display: none; }
|
16 |
|
@@ -207,6 +207,7 @@ fieldset.advads-group-add-ad { margin-top: 1em; }
|
|
207 |
.advads-placements-table-options { text-align: right; }
|
208 |
.advads-placement-options input, .advads-placement-options select { background: transparent; }
|
209 |
.advads-placements-table-options input[type="number"] { width: 4em; }
|
|
|
210 |
|
211 |
/**
|
212 |
GENERAL ELEMENTS
|
@@ -222,6 +223,7 @@ tr:hover .on-hover { display: block; }
|
|
222 |
.advads-admin-notice-inline p { margin: 0.5em 0; padding: 2px; }
|
223 |
.advads-review-image { margin-right: 10px; margin-bottom: 10px; float: left; }
|
224 |
.advads-spinner { float: none; visibility: visible; }
|
|
|
225 |
|
226 |
/**
|
227 |
- GOOGLE ADSENSE MODULE
|
9 |
* OVERVIEW PAGE
|
10 |
*/
|
11 |
.toplevel_page_advanced-ads #dashboard-widgets .postbox-container { width: 100% !important; }
|
12 |
+
.toplevel_page_advanced-ads #dashboard-widgets .postbox-container .postbox { float: left; width: 23%; min-width: 310px; margin-right: 1%; }
|
13 |
+
/* .toplevel_page_advanced-ads #dashboard-widgets .postbox-container .postbox + .postbox { margin-left: 1%; } */
|
14 |
.toplevel_page_advanced-ads #dashboard-widgets .postbox-container .postbox ul.list { list-style: inside; }
|
15 |
.toplevel_page_advanced-ads .metabox-holder .postbox-container .empty-container { display: none; }
|
16 |
|
207 |
.advads-placements-table-options { text-align: right; }
|
208 |
.advads-placement-options input, .advads-placement-options select { background: transparent; }
|
209 |
.advads-placements-table-options input[type="number"] { width: 4em; }
|
210 |
+
.advads-placements-table ol { margin: 0.5em 0; list-style-position: inside; }
|
211 |
|
212 |
/**
|
213 |
GENERAL ELEMENTS
|
223 |
.advads-admin-notice-inline p { margin: 0.5em 0; padding: 2px; }
|
224 |
.advads-review-image { margin-right: 10px; margin-bottom: 10px; float: left; }
|
225 |
.advads-spinner { float: none; visibility: visible; }
|
226 |
+
.advads-wide-input { width: 30em; }
|
227 |
|
228 |
/**
|
229 |
- GOOGLE ADSENSE MODULE
|
admin/assets/js/wizard.js
CHANGED
@@ -19,7 +19,7 @@ var advads_wizard = {
|
|
19 |
var _this = this;
|
20 |
jQuery('#advads-wizard-controls-next').click( function( ){ _this.next(); } );
|
21 |
jQuery('#advads-wizard-controls-prev').click( function( ){ _this.prev(); } );
|
22 |
-
jQuery('#advads-wizard-controls-save').click( function( ){ jQuery('#publish').click(); } ); // save ad
|
23 |
jQuery( '#advads-start-wizard' ).click( function(){
|
24 |
_this.start();
|
25 |
});
|
19 |
var _this = this;
|
20 |
jQuery('#advads-wizard-controls-next').click( function( ){ _this.next(); } );
|
21 |
jQuery('#advads-wizard-controls-prev').click( function( ){ _this.prev(); } );
|
22 |
+
jQuery('#advads-wizard-controls-save').click( function( e ){ e.preventDefault(); jQuery('#publish').click(); } ); // save ad
|
23 |
jQuery( '#advads-start-wizard' ).click( function(){
|
24 |
_this.start();
|
25 |
});
|
admin/class-advanced-ads-admin.php
CHANGED
@@ -342,7 +342,6 @@ class Advanced_Ads_Admin {
|
|
342 |
if ( $body ){
|
343 |
return $body;
|
344 |
} else {
|
345 |
-
error_log(print_r($response, true));
|
346 |
// return print_r($response, true);
|
347 |
return __( 'License couldn’t be activated. Please try again later.', 'advanced-ads' );
|
348 |
}
|
@@ -598,7 +597,7 @@ class Advanced_Ads_Admin {
|
|
598 |
// check if a license expired over time
|
599 |
$expiry_date = $this->get_license_expires( $_add_on['options_slug'] );
|
600 |
$now = time();
|
601 |
-
if( $expiry_date && strtotime( $expiry_date ) < $now ){
|
602 |
// remove license status
|
603 |
delete_option( $_add_on['options_slug'] . '-license-status' );
|
604 |
continue;
|
342 |
if ( $body ){
|
343 |
return $body;
|
344 |
} else {
|
|
|
345 |
// return print_r($response, true);
|
346 |
return __( 'License couldn’t be activated. Please try again later.', 'advanced-ads' );
|
347 |
}
|
597 |
// check if a license expired over time
|
598 |
$expiry_date = $this->get_license_expires( $_add_on['options_slug'] );
|
599 |
$now = time();
|
600 |
+
if( $expiry_date && 'lifetime' !== $expiry_date && strtotime( $expiry_date ) < $now ){
|
601 |
// remove license status
|
602 |
delete_option( $_add_on['options_slug'] . '-license-status' );
|
603 |
continue;
|
admin/includes/class-ad-type.php
CHANGED
@@ -475,7 +475,7 @@ class Advanced_Ads_Admin_Ad_Type {
|
|
475 |
4 => __( 'Ad updated.', 'advanced-ads' ),
|
476 |
/* translators: %s: date and time of the revision */
|
477 |
5 => isset( $_GET['revision'] ) ? sprintf( __( 'Ad restored to revision from %s', 'advanced-ads' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
478 |
-
6 => __( 'Ad published.', 'advanced-ads' ),
|
479 |
7 => __( 'Ad saved.', 'advanced-ads' ),
|
480 |
8 => __( 'Ad submitted.', 'advanced-ads' ),
|
481 |
9 => sprintf(
|
475 |
4 => __( 'Ad updated.', 'advanced-ads' ),
|
476 |
/* translators: %s: date and time of the revision */
|
477 |
5 => isset( $_GET['revision'] ) ? sprintf( __( 'Ad restored to revision from %s', 'advanced-ads' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
478 |
+
6 => __( 'Ad published.', 'advanced-ads' ) . ' ' . sprintf(__( 'Ad not showing up? Take a look <a href="%s" target="_blank">here</a>', 'advanced-ads' ), ADVADS_URL . 'manual/ads-not-showing-up/#utm_source=advanced-ads&utm_medium=link&utm_campaign=edit-ad-not-visible'),
|
479 |
7 => __( 'Ad saved.', 'advanced-ads' ),
|
480 |
8 => __( 'Ad submitted.', 'advanced-ads' ),
|
481 |
9 => sprintf(
|
admin/includes/class-meta-box.php
CHANGED
@@ -19,7 +19,7 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
19 |
|
20 |
|
21 |
private function __construct() {
|
22 |
-
add_action( '
|
23 |
// add meta box for post types edit pages
|
24 |
add_action( 'add_meta_boxes', array( $this, 'add_post_meta_box' ) );
|
25 |
add_action( 'save_post', array( $this, 'save_post_meta_box' ) );
|
@@ -47,23 +47,25 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
47 |
* @since 1.0.0
|
48 |
*/
|
49 |
public function add_meta_boxes() {
|
|
|
|
|
50 |
add_meta_box(
|
51 |
-
'ad-main-box', __( 'Ad Type', 'advanced-ads' ), array($this, 'markup_meta_boxes'),
|
52 |
);
|
53 |
// use dynamic filter from to add close class to ad type meta box after saved first time
|
54 |
add_filter( 'postbox_classes_advanced_ads_ad-main-box', array( $this, 'close_ad_type_metabox' ) );
|
55 |
|
56 |
add_meta_box(
|
57 |
-
'ad-parameters-box', __( 'Ad Parameters', 'advanced-ads' ), array($this, 'markup_meta_boxes'),
|
58 |
);
|
59 |
add_meta_box(
|
60 |
-
'ad-output-box', __( 'Layout / Output', 'advanced-ads' ), array($this, 'markup_meta_boxes'),
|
61 |
);
|
62 |
add_meta_box(
|
63 |
-
'ad-display-box', __( 'Display Conditions', 'advanced-ads' ), array($this, 'markup_meta_boxes'),
|
64 |
);
|
65 |
add_meta_box(
|
66 |
-
'ad-visitor-box', __( 'Visitor Conditions', 'advanced-ads' ), array($this, 'markup_meta_boxes'),
|
67 |
);
|
68 |
|
69 |
// register meta box ids
|
@@ -78,6 +80,32 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
78 |
|
79 |
// force AA meta boxes to never be completely hidden by screen options
|
80 |
add_filter( 'hidden_meta_boxes', array( $this, 'unhide_meta_boxes' ), 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
/**
|
@@ -190,6 +218,8 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
190 |
|
191 |
// load the view
|
192 |
include ADVADS_BASE_PATH . 'admin/views/post-ad-settings-metabox.php';
|
|
|
|
|
193 |
}
|
194 |
|
195 |
/**
|
@@ -230,6 +260,8 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
230 |
// Sanitize the user input.
|
231 |
$_data['disable_ads'] = isset($_POST['advanced_ads']['disable_ads']) ? absint( $_POST['advanced_ads']['disable_ads'] ) : 0;
|
232 |
|
|
|
|
|
233 |
// Update the meta field.
|
234 |
update_post_meta( $post_id, '_advads_ad_settings', $_data );
|
235 |
}
|
19 |
|
20 |
|
21 |
private function __construct() {
|
22 |
+
add_action( 'add_meta_boxes_' . Advanced_Ads::POST_TYPE_SLUG, array( $this, 'add_meta_boxes' ) );
|
23 |
// add meta box for post types edit pages
|
24 |
add_action( 'add_meta_boxes', array( $this, 'add_post_meta_box' ) );
|
25 |
add_action( 'save_post', array( $this, 'save_post_meta_box' ) );
|
47 |
* @since 1.0.0
|
48 |
*/
|
49 |
public function add_meta_boxes() {
|
50 |
+
$post_type = Advanced_Ads::POST_TYPE_SLUG;
|
51 |
+
|
52 |
add_meta_box(
|
53 |
+
'ad-main-box', __( 'Ad Type', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
|
54 |
);
|
55 |
// use dynamic filter from to add close class to ad type meta box after saved first time
|
56 |
add_filter( 'postbox_classes_advanced_ads_ad-main-box', array( $this, 'close_ad_type_metabox' ) );
|
57 |
|
58 |
add_meta_box(
|
59 |
+
'ad-parameters-box', __( 'Ad Parameters', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
|
60 |
);
|
61 |
add_meta_box(
|
62 |
+
'ad-output-box', __( 'Layout / Output', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
|
63 |
);
|
64 |
add_meta_box(
|
65 |
+
'ad-display-box', __( 'Display Conditions', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
|
66 |
);
|
67 |
add_meta_box(
|
68 |
+
'ad-visitor-box', __( 'Visitor Conditions', 'advanced-ads' ), array($this, 'markup_meta_boxes'), $post_type, 'normal', 'high'
|
69 |
);
|
70 |
|
71 |
// register meta box ids
|
80 |
|
81 |
// force AA meta boxes to never be completely hidden by screen options
|
82 |
add_filter( 'hidden_meta_boxes', array( $this, 'unhide_meta_boxes' ), 10, 2 );
|
83 |
+
|
84 |
+
$whitelist = apply_filters( 'advanced-ads-ad-edit-allowed-metaboxes', array_merge(
|
85 |
+
$this->meta_box_ids,
|
86 |
+
array(
|
87 |
+
'submitdiv',
|
88 |
+
'slugdiv',
|
89 |
+
'tracking-ads-box',
|
90 |
+
'ad-layer-ads-box', // deprecated
|
91 |
+
)
|
92 |
+
) );
|
93 |
+
|
94 |
+
global $wp_meta_boxes;
|
95 |
+
// remove non-white-listed meta boxes
|
96 |
+
foreach ( array( 'normal', 'advanced', 'side' ) as $context ) {
|
97 |
+
if ( isset( $wp_meta_boxes[ $post_type ][ $context ] ) ) {
|
98 |
+
foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
|
99 |
+
if ( isset( $wp_meta_boxes[ $post_type ][ $context ][ $priority ]) ) {
|
100 |
+
foreach ( (array) $wp_meta_boxes[ $post_type ][ $context ][ $priority ] as $id => $box ) {
|
101 |
+
if ( ! in_array( $id, $whitelist ) ) {
|
102 |
+
unset( $wp_meta_boxes[ $post_type ][ $context ][ $priority ][ $id ] );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
}
|
110 |
|
111 |
/**
|
218 |
|
219 |
// load the view
|
220 |
include ADVADS_BASE_PATH . 'admin/views/post-ad-settings-metabox.php';
|
221 |
+
|
222 |
+
do_action( 'advanced_ads_render_post_meta_box', $post, $values );
|
223 |
}
|
224 |
|
225 |
/**
|
260 |
// Sanitize the user input.
|
261 |
$_data['disable_ads'] = isset($_POST['advanced_ads']['disable_ads']) ? absint( $_POST['advanced_ads']['disable_ads'] ) : 0;
|
262 |
|
263 |
+
$_data = apply_filters( 'advanced_ads_save_post_meta_box', $_data );
|
264 |
+
|
265 |
// Update the meta field.
|
266 |
update_post_meta( $post_id, '_advads_ad_settings', $_data );
|
267 |
}
|
admin/includes/class-overview-widgets.php
CHANGED
@@ -64,7 +64,8 @@ class Advanced_Ads_Overview_Widgets_Callbacks {
|
|
64 |
array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_layer'), $screen->id, 'side', 'high');
|
65 |
add_meta_box('advads_overview_addon_slider', __( 'Ad Slider', 'advanced-ads' ),
|
66 |
array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_slider'), $screen->id, 'side', 'high');
|
67 |
-
|
|
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -248,4 +249,13 @@ foreach ( $next_steps as $_step ){
|
|
248 |
_e( 'Get the Slider add-on', 'advanced-ads' ); ?></a></p><?php
|
249 |
}
|
250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
64 |
array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_layer'), $screen->id, 'side', 'high');
|
65 |
add_meta_box('advads_overview_addon_slider', __( 'Ad Slider', 'advanced-ads' ),
|
66 |
array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_slider'), $screen->id, 'side', 'high');
|
67 |
+
add_meta_box('advads_overview_addon_sellingads', __( 'Selling Ads', 'advanced-ads' ),
|
68 |
+
array('Advanced_Ads_Overview_Widgets_Callbacks', 'render_add_on_sellingads'), $screen->id, 'side', 'high');
|
69 |
}
|
70 |
|
71 |
/**
|
249 |
_e( 'Get the Slider add-on', 'advanced-ads' ); ?></a></p><?php
|
250 |
}
|
251 |
|
252 |
+
/**
|
253 |
+
* selling ads add-on widget
|
254 |
+
*/
|
255 |
+
public static function render_add_on_sellingads(){
|
256 |
+
?><p><?php _e( 'Let users purchase ads directly in the frontend of your site.', 'advanced-ads' ); ?></p>
|
257 |
+
<p><a class="button button-primary" href="<?php echo ADVADS_URL; ?>add-ons/slider/#utm_source=advanced-ads&utm_medium=link&utm_campaign=overview-add-ons" target="_blank"><?php
|
258 |
+
_e( 'Get the Selling Ads add-on', 'advanced-ads' ); ?></a></p><?php
|
259 |
+
}
|
260 |
+
|
261 |
}
|
admin/includes/class-settings.php
CHANGED
@@ -153,6 +153,17 @@ class Advanced_Ads_Admin_Settings {
|
|
153 |
'advanced_ads_setting_section'
|
154 |
);
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
// hook for additional settings from add-ons
|
157 |
do_action( 'advanced-ads-settings-init', $hook );
|
158 |
}
|
@@ -400,6 +411,19 @@ class Advanced_Ads_Admin_Settings {
|
|
400 |
<?php
|
401 |
}
|
402 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
/**
|
404 |
* sanitize plugin settings
|
405 |
*
|
153 |
'advanced_ads_setting_section'
|
154 |
);
|
155 |
|
156 |
+
// only for main blog
|
157 |
+
if ( is_main_site( get_current_blog_id() ) ) {
|
158 |
+
add_settings_field(
|
159 |
+
'uninstall-delete-data',
|
160 |
+
__( 'Delete data on uninstall', 'advanced-ads' ),
|
161 |
+
array( $this, 'render_settings_uninstall_delete_data' ),
|
162 |
+
$hook,
|
163 |
+
'advanced_ads_setting_section'
|
164 |
+
);
|
165 |
+
}
|
166 |
+
|
167 |
// hook for additional settings from add-ons
|
168 |
do_action( 'advanced-ads-settings-init', $hook );
|
169 |
}
|
411 |
<?php
|
412 |
}
|
413 |
|
414 |
+
/**
|
415 |
+
* render setting 'Delete data on uninstall"
|
416 |
+
*
|
417 |
+
*/
|
418 |
+
public function render_settings_uninstall_delete_data(){
|
419 |
+
$options = Advanced_Ads::get_instance()->options();
|
420 |
+
$enabled = ! empty( $options['uninstall-delete-data'] ); ?>
|
421 |
+
|
422 |
+
<input type="checkbox" value="1" name="<?php echo ADVADS_SLUG; ?>[uninstall-delete-data]" <?php checked( $enabled, 1 ); ?>>
|
423 |
+
<p class="description"><?php _e( 'Clean up all data related to Advanced Ads when removing the plugin.', 'advanced-ads' ); ?></p>
|
424 |
+
<?php
|
425 |
+
}
|
426 |
+
|
427 |
/**
|
428 |
* sanitize plugin settings
|
429 |
*
|
admin/views/post-ad-settings-metabox.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
<label><input type="checkbox" name="advanced_ads[disable_ads]" value="1" <?php
|
2 |
-
|
3 |
?>/><?php _e( 'Disable ads on this page', 'advanced-ads' ); ?></label>
|
1 |
<label><input type="checkbox" name="advanced_ads[disable_ads]" value="1" <?php
|
2 |
+
if ( isset($values['disable_ads']) ) { checked( $values['disable_ads'], true ); }
|
3 |
?>/><?php _e( 'Disable ads on this page', 'advanced-ads' ); ?></label>
|
admin/views/setting-license.php
CHANGED
@@ -4,9 +4,13 @@ $expires = Advanced_Ads_Admin::get_instance()->get_license_expires( $options_slu
|
|
4 |
$expired = false;
|
5 |
$expired_error = __( 'Your license expired.', 'advanced-ads' );
|
6 |
$expired_error .= $expired_renew_link = ' ' . sprintf(__( '<a href="%s" target="_blank">Renew it with a discount</a>.', 'advanced-ads' ), ADVADS_URL . 'checkout/?edd_license_key=' . esc_attr($license_key) . '#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses' );
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
10 |
$plugin_url = isset( $plugin_url ) ? $plugin_url : ADVADS_URL;
|
11 |
$errortext = $expired_error;
|
12 |
$expired = true;
|
4 |
$expired = false;
|
5 |
$expired_error = __( 'Your license expired.', 'advanced-ads' );
|
6 |
$expired_error .= $expired_renew_link = ' ' . sprintf(__( '<a href="%s" target="_blank">Renew it with a discount</a>.', 'advanced-ads' ), ADVADS_URL . 'checkout/?edd_license_key=' . esc_attr($license_key) . '#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses' );
|
7 |
+
if( 'lifetime' !== $expires ){
|
8 |
+
$expires_time = strtotime( $expires );
|
9 |
+
$days_left = ( $expires_time - time() ) / DAY_IN_SECONDS;
|
10 |
+
}
|
11 |
+
if( 'lifetime' === $expires ){
|
12 |
+
// do nothing
|
13 |
+
} elseif( $days_left <= 0 ){
|
14 |
$plugin_url = isset( $plugin_url ) ? $plugin_url : ADVADS_URL;
|
15 |
$errortext = $expired_error;
|
16 |
$expired = true;
|
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.6
|
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.6' );
|
43 |
|
44 |
/*----------------------------------------------------------------------------*
|
45 |
* Autoloading, modules and functions
|
classes/ad_group.php
CHANGED
@@ -435,7 +435,14 @@ class Advanced_Ads_Group {
|
|
435 |
|
436 |
$global_weights[$this->id] = $this->sanitize_ad_weights( $weights );
|
437 |
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
|
440 |
// refresh ad weights after update to avoid conflict
|
441 |
$this->ad_weights = $global_weights[$this->id];
|
435 |
|
436 |
$global_weights[$this->id] = $this->sanitize_ad_weights( $weights );
|
437 |
|
438 |
+
/**
|
439 |
+
* save ad weights in frontend only, if contanst is not set
|
440 |
+
* always save in admin
|
441 |
+
* use the constant to prevent accidental overriding of ad settings in the frontend as happened on very large sites
|
442 |
+
*/
|
443 |
+
if( !defined( 'ADVANCED_ADS_DISABLE_FRONTEND_AD_WEIGHT_UPDATE' ) || is_admin() ){
|
444 |
+
update_option( 'advads-ad-weights', $global_weights );
|
445 |
+
}
|
446 |
|
447 |
// refresh ad weights after update to avoid conflict
|
448 |
$this->ad_weights = $global_weights[$this->id];
|
classes/checks.php
CHANGED
@@ -134,7 +134,7 @@ class Advanced_Ads_Checks {
|
|
134 |
|
135 |
$expiry_date = Advanced_Ads_Admin::get_instance()->get_license_expires( $_add_on['options_slug'] );
|
136 |
|
137 |
-
if( $expiry_date ){
|
138 |
$expiry_date_t = strtotime( $expiry_date );
|
139 |
$in_two_weeks = time() + ( WEEK_IN_SECONDS * 2) ;
|
140 |
// check if expiry date is within next comming 2 weeks
|
@@ -173,7 +173,7 @@ class Advanced_Ads_Checks {
|
|
173 |
|
174 |
$expiry_date = Advanced_Ads_Admin::get_instance()->get_license_expires( $_add_on['options_slug'] );
|
175 |
|
176 |
-
if( $expiry_date && strtotime( $expiry_date ) < $now ){
|
177 |
return true;
|
178 |
}
|
179 |
}
|
134 |
|
135 |
$expiry_date = Advanced_Ads_Admin::get_instance()->get_license_expires( $_add_on['options_slug'] );
|
136 |
|
137 |
+
if( $expiry_date && 'lifetime' !== $expiry_date ){
|
138 |
$expiry_date_t = strtotime( $expiry_date );
|
139 |
$in_two_weeks = time() + ( WEEK_IN_SECONDS * 2) ;
|
140 |
// check if expiry date is within next comming 2 weeks
|
173 |
|
174 |
$expiry_date = Advanced_Ads_Admin::get_instance()->get_license_expires( $_add_on['options_slug'] );
|
175 |
|
176 |
+
if( $expiry_date && 'lifetime' !== $expiry_date && strtotime( $expiry_date ) < $now ){
|
177 |
return true;
|
178 |
}
|
179 |
}
|
classes/display-conditions.php
CHANGED
@@ -638,10 +638,11 @@ class Advanced_Ads_Display_Conditions {
|
|
638 |
$ad_options = $ad->options();
|
639 |
$query = $ad_options['wp_the_query'];
|
640 |
$post_id = isset($ad_options['post']['id']) ? $ad_options['post']['id'] : null;
|
|
|
641 |
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
|
646 |
return self::can_display_ids($post_id, $options['value'], $operator);
|
647 |
}
|
638 |
$ad_options = $ad->options();
|
639 |
$query = $ad_options['wp_the_query'];
|
640 |
$post_id = isset($ad_options['post']['id']) ? $ad_options['post']['id'] : null;
|
641 |
+
$is_singular = ! empty( $ad_options['wp_the_query']['is_singular'] );
|
642 |
|
643 |
+
if ( ! isset( $options['value'] ) || ! is_array( $options['value'] ) || ! $post_id || ! $is_singular ) {
|
644 |
+
return true;
|
645 |
+
}
|
646 |
|
647 |
return self::can_display_ids($post_id, $options['value'], $operator);
|
648 |
}
|
classes/plugin.php
CHANGED
@@ -56,6 +56,7 @@ class Advanced_Ads_Plugin {
|
|
56 |
private function __construct() {
|
57 |
register_activation_hook( ADVADS_BASE, array( $this, 'activate' ) );
|
58 |
register_deactivation_hook( ADVADS_BASE, array( $this, 'deactivate' ) );
|
|
|
59 |
|
60 |
add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
|
61 |
}
|
@@ -175,7 +176,7 @@ class Advanced_Ads_Plugin {
|
|
175 |
* @since 1.0.0
|
176 |
*/
|
177 |
protected function single_activate() {
|
178 |
-
$this->post_types_rewrite_flush();
|
179 |
// -TODO inform modules
|
180 |
}
|
181 |
|
@@ -507,4 +508,93 @@ class Advanced_Ads_Plugin {
|
|
507 |
}
|
508 |
}
|
509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
}
|
56 |
private function __construct() {
|
57 |
register_activation_hook( ADVADS_BASE, array( $this, 'activate' ) );
|
58 |
register_deactivation_hook( ADVADS_BASE, array( $this, 'deactivate' ) );
|
59 |
+
register_uninstall_hook( ADVADS_BASE, array( 'Advanced_Ads_Plugin', 'uninstall' ) );
|
60 |
|
61 |
add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
|
62 |
}
|
176 |
* @since 1.0.0
|
177 |
*/
|
178 |
protected function single_activate() {
|
179 |
+
// $this->post_types_rewrite_flush();
|
180 |
// -TODO inform modules
|
181 |
}
|
182 |
|
508 |
}
|
509 |
}
|
510 |
|
511 |
+
/**
|
512 |
+
* Fired when the plugin is uninstalled.
|
513 |
+
*/
|
514 |
+
public static function uninstall() {
|
515 |
+
$advads_options = Advanced_Ads::get_instance()->options();
|
516 |
+
|
517 |
+
if ( ! empty( $advads_options['uninstall-delete-data'] ) ) {
|
518 |
+
global $wpdb;
|
519 |
+
$main_blog_id = $wpdb->blogid;
|
520 |
+
|
521 |
+
Advanced_Ads::get_instance()->create_post_types();
|
522 |
+
|
523 |
+
if ( ! is_multisite() ) {
|
524 |
+
Advanced_Ads_Plugin::get_instance()->uninstall_single();
|
525 |
+
} else {
|
526 |
+
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
527 |
+
|
528 |
+
foreach ( $blog_ids as $blog_id ) {
|
529 |
+
switch_to_blog( $blog_id );
|
530 |
+
Advanced_Ads_Plugin::get_instance()->uninstall_single();
|
531 |
+
}
|
532 |
+
switch_to_blog( $main_blog_id );
|
533 |
+
}
|
534 |
+
|
535 |
+
// Delete assets (main blog).
|
536 |
+
Advanced_Ads_Ad_Blocker_Admin::get_instance()->clear_assets();
|
537 |
+
delete_option( ADVADS_AB_SLUG );
|
538 |
+
}
|
539 |
+
|
540 |
+
}
|
541 |
+
|
542 |
+
/**
|
543 |
+
* Fired for each blog when the plugin is uninstalled.
|
544 |
+
*
|
545 |
+
*/
|
546 |
+
protected function uninstall_single() {
|
547 |
+
global $wpdb;
|
548 |
+
|
549 |
+
// Ads.
|
550 |
+
$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s", Advanced_Ads::POST_TYPE_SLUG ) );
|
551 |
+
|
552 |
+
if ( $post_ids ) {
|
553 |
+
$wpdb->delete(
|
554 |
+
$wpdb->posts,
|
555 |
+
array( 'post_type' => Advanced_Ads::POST_TYPE_SLUG ),
|
556 |
+
array( '%s' )
|
557 |
+
);
|
558 |
+
|
559 |
+
$wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE post_id IN( " . implode( ',', $post_ids ) . " )" );
|
560 |
+
}
|
561 |
+
|
562 |
+
// Groups.
|
563 |
+
$term_ids = $wpdb->get_col( $wpdb->prepare( "SELECT t.term_id FROM {$wpdb->terms} AS t INNER JOIN {$wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s", Advanced_Ads::AD_GROUP_TAXONOMY ) );
|
564 |
+
|
565 |
+
foreach ( $term_ids as $term_id ) {
|
566 |
+
wp_delete_term( $term_id, Advanced_Ads::AD_GROUP_TAXONOMY );
|
567 |
+
}
|
568 |
+
|
569 |
+
delete_option( 'advads-ad-groups' );
|
570 |
+
delete_option( Advanced_Ads::AD_GROUP_TAXONOMY . '_children' );
|
571 |
+
delete_option( 'advads-ad-weights' );
|
572 |
+
|
573 |
+
// Placements.
|
574 |
+
delete_option( 'advads-ads-placements' );
|
575 |
+
|
576 |
+
// User metadata.
|
577 |
+
delete_metadata( 'user', null, 'advanced-ads-hide-wizard', '', true );
|
578 |
+
delete_metadata( 'user', null, 'advanced-ads-subscribed', '', true );
|
579 |
+
|
580 |
+
// Post metadata.
|
581 |
+
delete_metadata( 'post', null, '_advads_ad_settings', '', true );
|
582 |
+
|
583 |
+
// Transients.
|
584 |
+
delete_transient( ADVADS_SLUG . '_add-on-updates-checked' );
|
585 |
+
|
586 |
+
delete_option( GADSENSE_OPT_NAME );
|
587 |
+
delete_option( ADVADS_SLUG );
|
588 |
+
delete_option( ADVADS_SLUG . '-internal' );
|
589 |
+
delete_option( ADVADS_SLUG . '-notices' );
|
590 |
+
|
591 |
+
// Widget.
|
592 |
+
$base_widget_id = Advanced_Ads_Widget::get_base_id();
|
593 |
+
delete_option( 'widget_' . $base_widget_id );
|
594 |
+
|
595 |
+
do_action( 'advanced-ads-uninstall' );
|
596 |
+
|
597 |
+
wp_cache_flush();
|
598 |
+
}
|
599 |
+
|
600 |
}
|
classes/widget.php
CHANGED
@@ -16,18 +16,12 @@
|
|
16 |
class Advanced_Ads_Widget extends WP_Widget {
|
17 |
|
18 |
function __construct() {
|
19 |
-
|
20 |
-
$options = Advanced_Ads_Plugin::get_instance()->options();
|
21 |
-
|
22 |
$prefix = Advanced_Ads_Plugin::get_instance()->get_frontend_prefix();
|
23 |
$classname = $prefix . 'widget';
|
24 |
|
25 |
$widget_ops = array('classname' => $classname, 'description' => __( 'Display Ads and Ad Groups.', 'advanced-ads' ));
|
26 |
$control_ops = array();
|
27 |
-
|
28 |
-
// deprecated to keep previously changed prefixed working
|
29 |
-
$prefix2 = ( isset( $options['id-prefix'] ) && $options['id-prefix'] !== '' ) ? $options['id-prefix'] : 'advads_ad_';
|
30 |
-
$base_id = $prefix2 . 'widget';
|
31 |
|
32 |
parent::__construct( $base_id,'Advanced Ads', $widget_ops, $control_ops );
|
33 |
}
|
@@ -169,4 +163,17 @@ class Advanced_Ads_Widget extends WP_Widget {
|
|
169 |
return;
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
16 |
class Advanced_Ads_Widget extends WP_Widget {
|
17 |
|
18 |
function __construct() {
|
|
|
|
|
|
|
19 |
$prefix = Advanced_Ads_Plugin::get_instance()->get_frontend_prefix();
|
20 |
$classname = $prefix . 'widget';
|
21 |
|
22 |
$widget_ops = array('classname' => $classname, 'description' => __( 'Display Ads and Ad Groups.', 'advanced-ads' ));
|
23 |
$control_ops = array();
|
24 |
+
$base_id = Advanced_Ads_Widget::get_base_id();
|
|
|
|
|
|
|
25 |
|
26 |
parent::__construct( $base_id,'Advanced Ads', $widget_ops, $control_ops );
|
27 |
}
|
163 |
return;
|
164 |
}
|
165 |
|
166 |
+
/**
|
167 |
+
* get the base id of the widget
|
168 |
+
*
|
169 |
+
* @return string
|
170 |
+
*/
|
171 |
+
public static function get_base_id() {
|
172 |
+
$options = Advanced_Ads_Plugin::get_instance()->options();
|
173 |
+
|
174 |
+
// deprecated to keep previously changed prefixed working
|
175 |
+
$prefix2 = ( isset( $options['id-prefix'] ) && $options['id-prefix'] !== '' ) ? $options['id-prefix'] : 'advads_ad_';
|
176 |
+
return $prefix2 . 'widget';
|
177 |
+
}
|
178 |
+
|
179 |
}
|
includes/load_modules.php
CHANGED
@@ -41,9 +41,9 @@ final class Advanced_Ads_ModuleLoader {
|
|
41 |
$loader->addClassmap( $config['classmap'] );
|
42 |
}
|
43 |
// append textdomain
|
44 |
-
if ( isset($config['textdomain']) && $config['textdomain'] ) {
|
45 |
self::$textdomains[$config['textdomain']] = "modules/$moduleName/languages";
|
46 |
-
}
|
47 |
}
|
48 |
|
49 |
// admin is enabled by default
|
@@ -60,9 +60,9 @@ final class Advanced_Ads_ModuleLoader {
|
|
60 |
}
|
61 |
|
62 |
// register textdomains if non-empty
|
63 |
-
if ( self::$textdomains !== array() ) {
|
64 |
add_action( 'plugins_loaded', array( 'Advanced_Ads_ModuleLoader', 'load_module_textdomains') );
|
65 |
-
}
|
66 |
|
67 |
// load modules
|
68 |
foreach ( self::$modules as $name => $path ) {
|
@@ -70,6 +70,9 @@ final class Advanced_Ads_ModuleLoader {
|
|
70 |
}
|
71 |
}
|
72 |
|
|
|
|
|
|
|
73 |
public static function load_module_textdomains() {
|
74 |
foreach ( self::$textdomains as $slug => $rel_path ) {
|
75 |
load_plugin_textdomain( ADVADS_SLUG, false, ADVADS_BASE_DIR . '/languages' );
|
41 |
$loader->addClassmap( $config['classmap'] );
|
42 |
}
|
43 |
// append textdomain
|
44 |
+
/*if ( isset($config['textdomain']) && $config['textdomain'] ) {
|
45 |
self::$textdomains[$config['textdomain']] = "modules/$moduleName/languages";
|
46 |
+
}*/
|
47 |
}
|
48 |
|
49 |
// admin is enabled by default
|
60 |
}
|
61 |
|
62 |
// register textdomains if non-empty
|
63 |
+
/* if ( self::$textdomains !== array() ) {
|
64 |
add_action( 'plugins_loaded', array( 'Advanced_Ads_ModuleLoader', 'load_module_textdomains') );
|
65 |
+
}*/
|
66 |
|
67 |
// load modules
|
68 |
foreach ( self::$modules as $name => $path ) {
|
70 |
}
|
71 |
}
|
72 |
|
73 |
+
/**
|
74 |
+
* @deprecated since 1.7.6
|
75 |
+
*/
|
76 |
public static function load_module_textdomains() {
|
77 |
foreach ( self::$textdomains as $slug => $rel_path ) {
|
78 |
load_plugin_textdomain( ADVADS_SLUG, false, ADVADS_BASE_DIR . '/languages' );
|
modules/ad-blocker/admin/admin.php
CHANGED
@@ -263,6 +263,13 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
263 |
// $new_options_error does not have the 'module_can_work' key - ad-blocker script will be inactive and the asset folder will be rebuilt next time
|
264 |
$new_options['module_can_work'] = true;
|
265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
if ( ! empty( $this->options['folder_name'] ) ) {
|
267 |
$new_options['folder_name'] = $new_options_error['folder_name'] = $this->options['folder_name'];
|
268 |
|
@@ -271,7 +278,8 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
271 |
if ( $wp_filesystem->exists( $old_folder_normalized ) ) {
|
272 |
|
273 |
if ( $need_assign_new_name ) {
|
274 |
-
$
|
|
|
275 |
$new_folder_normalized = $this->normalize_path( trailingslashit( $this->upload_dir['basedir'] ) . $new_folder_name );
|
276 |
|
277 |
if ( ! $wp_filesystem->move( $old_folder_normalized, $new_folder_normalized ) ) {
|
@@ -313,7 +321,7 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
313 |
} else {
|
314 |
// It seems this is the first time this plugin was ran, let's create everything we need in order to
|
315 |
// have this plugin function normally.
|
316 |
-
$new_folder_name = $this->generate_unique_name();
|
317 |
// Create a unique folder name
|
318 |
$new_options['folder_name'] = $new_options_error['folder_name'] = $new_folder_name;
|
319 |
// we have an error while the method is being executed
|
@@ -368,7 +376,7 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
368 |
$replaced_path_components = preg_split('/\//', $replaced_path, -1, PREG_SPLIT_NO_EMPTY);
|
369 |
|
370 |
foreach ( $orig_path_components as $k=> $orig_path_part ) {
|
371 |
-
$rand_asset_names[ $orig_path_part] = $replaced_path_components[$k];
|
372 |
}
|
373 |
}
|
374 |
}
|
@@ -414,9 +422,9 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
414 |
} elseif ( array_key_exists( $dir, $rand_asset_names ) ) {
|
415 |
$path_components_new[ $k ] = $rand_asset_names[ $dir ];
|
416 |
} else {
|
417 |
-
$new_rand_folder_name = $this->generate_unique_name( $rand_asset_names );
|
418 |
$path_components_new[ $k ] = $new_rand_folder_name;
|
419 |
-
$rand_asset_names[ $dir ] = $new_rand_folder_name;
|
420 |
}
|
421 |
}
|
422 |
|
@@ -429,8 +437,8 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
429 |
$new_abs_file = $new_dir_full . $rand_asset_names[$first_cleanup_filename];
|
430 |
$new_rel_file = $new_dir . $rand_asset_names[$first_cleanup_filename];
|
431 |
} else {
|
432 |
-
$new_filename = $this->generate_unique_name( $rand_asset_names ) . '.' . $first_cleanup_file_extension;
|
433 |
-
$rand_asset_names[$first_cleanup_filename] = $new_filename;
|
434 |
$new_abs_file = $new_dir_full . $new_filename;
|
435 |
$new_rel_file = $new_dir . $new_filename;
|
436 |
}
|
@@ -600,13 +608,35 @@ class Advanced_Ads_Ad_Blocker_Admin
|
|
600 |
*/
|
601 |
function generate_unique_name( $haystack = false ) {
|
602 |
if ( $haystack ) {
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
|
|
|
|
|
|
607 |
}
|
608 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
609 |
}
|
610 |
-
return mt_rand( 0, 999 );
|
611 |
}
|
612 |
}
|
263 |
// $new_options_error does not have the 'module_can_work' key - ad-blocker script will be inactive and the asset folder will be rebuilt next time
|
264 |
$new_options['module_can_work'] = true;
|
265 |
|
266 |
+
$existing_files = @scandir( $this->upload_dir['basedir'] );
|
267 |
+
if ( $existing_files ) {
|
268 |
+
$existing_files = array_diff( $existing_files, array( '..', '.' ) );
|
269 |
+
} else {
|
270 |
+
$existing_files = array();
|
271 |
+
}
|
272 |
+
|
273 |
if ( ! empty( $this->options['folder_name'] ) ) {
|
274 |
$new_options['folder_name'] = $new_options_error['folder_name'] = $this->options['folder_name'];
|
275 |
|
278 |
if ( $wp_filesystem->exists( $old_folder_normalized ) ) {
|
279 |
|
280 |
if ( $need_assign_new_name ) {
|
281 |
+
$existing_files[] = (string) $new_options['folder_name'];
|
282 |
+
$new_folder_name = $this->generate_unique_name( $existing_files );
|
283 |
$new_folder_normalized = $this->normalize_path( trailingslashit( $this->upload_dir['basedir'] ) . $new_folder_name );
|
284 |
|
285 |
if ( ! $wp_filesystem->move( $old_folder_normalized, $new_folder_normalized ) ) {
|
321 |
} else {
|
322 |
// It seems this is the first time this plugin was ran, let's create everything we need in order to
|
323 |
// have this plugin function normally.
|
324 |
+
$new_folder_name = $this->generate_unique_name( $existing_files );
|
325 |
// Create a unique folder name
|
326 |
$new_options['folder_name'] = $new_options_error['folder_name'] = $new_folder_name;
|
327 |
// we have an error while the method is being executed
|
376 |
$replaced_path_components = preg_split('/\//', $replaced_path, -1, PREG_SPLIT_NO_EMPTY);
|
377 |
|
378 |
foreach ( $orig_path_components as $k=> $orig_path_part ) {
|
379 |
+
$rand_asset_names[ $orig_path_part] = (string) $replaced_path_components[$k];
|
380 |
}
|
381 |
}
|
382 |
}
|
422 |
} elseif ( array_key_exists( $dir, $rand_asset_names ) ) {
|
423 |
$path_components_new[ $k ] = $rand_asset_names[ $dir ];
|
424 |
} else {
|
425 |
+
$new_rand_folder_name = $this->generate_unique_name( array_values( $rand_asset_names ) );
|
426 |
$path_components_new[ $k ] = $new_rand_folder_name;
|
427 |
+
$rand_asset_names[ $dir ] = (string) $new_rand_folder_name;
|
428 |
}
|
429 |
}
|
430 |
|
437 |
$new_abs_file = $new_dir_full . $rand_asset_names[$first_cleanup_filename];
|
438 |
$new_rel_file = $new_dir . $rand_asset_names[$first_cleanup_filename];
|
439 |
} else {
|
440 |
+
$new_filename = $this->generate_unique_name( array_values( $rand_asset_names ) ) . '.' . $first_cleanup_file_extension;
|
441 |
+
$rand_asset_names[$first_cleanup_filename] = (string) $new_filename;
|
442 |
$new_abs_file = $new_dir_full . $new_filename;
|
443 |
$new_rel_file = $new_dir . $new_filename;
|
444 |
}
|
608 |
*/
|
609 |
function generate_unique_name( $haystack = false ) {
|
610 |
if ( $haystack ) {
|
611 |
+
$i = 0;
|
612 |
+
|
613 |
+
do {
|
614 |
+
if ( ++$i < 100 ) {
|
615 |
+
$needle = (string) mt_rand( 1, 999 );
|
616 |
+
} else {
|
617 |
+
$needle .= '_' . $i;
|
618 |
}
|
619 |
+
} while( in_array( $needle, $haystack ) );
|
620 |
+
}
|
621 |
+
|
622 |
+
return (string) mt_rand( 1, 999 );
|
623 |
+
}
|
624 |
+
|
625 |
+
/**
|
626 |
+
* clear assets (on uninstall)
|
627 |
+
*/
|
628 |
+
function clear_assets() {
|
629 |
+
$advads_options = Advanced_Ads::get_instance()->options();
|
630 |
+
|
631 |
+
if ( ! empty( $advads_options['use-adblocker'] )
|
632 |
+
&& ! empty( $this->options['folder_name'] )
|
633 |
+
&& ! empty( $this->options['module_can_work'] )
|
634 |
+
&& $this->upload_dir
|
635 |
+
&& class_exists( 'WP_Filesystem_Direct', false )
|
636 |
+
) {
|
637 |
+
$wp_filesystem = new WP_Filesystem_Direct( new StdClass() );
|
638 |
+
$path = trailingslashit( $this->upload_dir['basedir'] ) . trailingslashit( $this->options['folder_name'] );
|
639 |
+
$wp_filesystem->rmdir( $path, true );
|
640 |
}
|
|
|
641 |
}
|
642 |
}
|
modules/ad-blocker/classes/plugin.php
CHANGED
@@ -107,7 +107,7 @@ class Advanced_Ads_Ad_Blocker
|
|
107 |
$options = $this->options();
|
108 |
$upload_dir = $this->get_upload_directory();
|
109 |
$url = str_replace( WP_PLUGIN_URL, '', $file );
|
110 |
-
if ( is_array( $options['lookup_table'][ $url ] ) && isset( $options['lookup_table'][ $url ]['path'] ) ) {
|
111 |
return trailingslashit( $upload_dir['baseurl'] ) . trailingslashit( $options['folder_name'] ) . $options['lookup_table'][ $url ]['path'];
|
112 |
} elseif ( isset( $options['lookup_table'][ $url ] ) ) {
|
113 |
return trailingslashit( $upload_dir['baseurl'] ) . trailingslashit( $options['folder_name'] ) . $options['lookup_table'][ $url ];
|
107 |
$options = $this->options();
|
108 |
$upload_dir = $this->get_upload_directory();
|
109 |
$url = str_replace( WP_PLUGIN_URL, '', $file );
|
110 |
+
if ( isset( $options['lookup_table'][ $url ] ) && is_array( $options['lookup_table'][ $url ] ) && isset( $options['lookup_table'][ $url ]['path'] ) ) {
|
111 |
return trailingslashit( $upload_dir['baseurl'] ) . trailingslashit( $options['folder_name'] ) . $options['lookup_table'][ $url ]['path'];
|
112 |
} elseif ( isset( $options['lookup_table'][ $url ] ) ) {
|
113 |
return trailingslashit( $upload_dir['baseurl'] ) . trailingslashit( $options['folder_name'] ) . $options['lookup_table'][ $url ];
|
modules/gadsense/admin/views/adsense-ad-parameters.php
CHANGED
@@ -29,7 +29,7 @@ if ( $use_paste_code ) {
|
|
29 |
<input type="text" name="unit-code" id="unit-code" value="<?php echo $unit_code; ?>" />
|
30 |
<input type="hidden" name="advanced_ad[output][adsense-pub-id]" id="advads-adsense-pub-id" value="" />
|
31 |
<?php if( $pub_id ) : ?>
|
32 |
-
<?php
|
33 |
<?php endif; ?>
|
34 |
</div>
|
35 |
<hr/>
|
29 |
<input type="text" name="unit-code" id="unit-code" value="<?php echo $unit_code; ?>" />
|
30 |
<input type="hidden" name="advanced_ad[output][adsense-pub-id]" id="advads-adsense-pub-id" value="" />
|
31 |
<?php if( $pub_id ) : ?>
|
32 |
+
<?php printf(__( 'Publisher ID: %s', 'advanced-ads' ), $pub_id ); ?>
|
33 |
<?php endif; ?>
|
34 |
</div>
|
35 |
<hr/>
|
modules/import-export/classes/import.php
CHANGED
@@ -16,9 +16,13 @@ class Advanced_Ads_Import {
|
|
16 |
private $messages = array();
|
17 |
|
18 |
/**
|
19 |
-
* imported data mapped with previous data, e.g.
|
20 |
*/
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
|
23 |
/**
|
24 |
* Created groups during this import session ['slug' => 'id']
|
@@ -180,11 +184,8 @@ class Advanced_Ads_Import {
|
|
180 |
$this->messages[] = array( 'update', sprintf( __( 'New ad created: <em>%s</em> %s', 'advanced-ads' ), $post_id, $link ) );
|
181 |
}
|
182 |
|
183 |
-
//
|
184 |
-
|
185 |
-
$this->imported_data['ads'][ absint( $ad['ID'] ) ] = $post_id;
|
186 |
-
}
|
187 |
-
|
188 |
|
189 |
// import ad groups
|
190 |
if ( ! empty( $ad['groups'] ) && is_array( $ad['groups'] ) ) {
|
@@ -227,7 +228,6 @@ class Advanced_Ads_Import {
|
|
227 |
|
228 |
$tt_ids = wp_set_post_terms( $post_id, $groups_to_set, Advanced_Ads::AD_GROUP_TAXONOMY );
|
229 |
}
|
230 |
-
|
231 |
}
|
232 |
}
|
233 |
}
|
@@ -296,9 +296,8 @@ class Advanced_Ads_Import {
|
|
296 |
return false;
|
297 |
}
|
298 |
|
299 |
-
|
300 |
-
|
301 |
-
}
|
302 |
|
303 |
return $group_id;
|
304 |
}
|
@@ -315,22 +314,49 @@ class Advanced_Ads_Import {
|
|
315 |
$placement_types = Advanced_Ads_Placements::get_placement_types();
|
316 |
|
317 |
foreach ( $decoded['placements'] as &$placement ) {
|
318 |
-
|
319 |
-
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
|
322 |
-
|
|
|
323 |
|
324 |
-
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
|
|
|
|
332 |
}
|
333 |
-
|
|
|
|
|
|
|
|
|
334 |
}
|
335 |
|
336 |
// try to set "Item" (ad or group)
|
@@ -340,22 +366,45 @@ class Advanced_Ads_Import {
|
|
340 |
switch ( $_item[0] ) {
|
341 |
case 'ad':
|
342 |
case Advanced_Ads_Select::AD :
|
343 |
-
if (
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
}
|
346 |
break;
|
347 |
case Advanced_Ads_Select::GROUP :
|
348 |
-
if (
|
349 |
-
$placement['item'] = 'group_' . $
|
350 |
}
|
351 |
break;
|
352 |
}
|
353 |
}
|
354 |
}
|
355 |
|
356 |
-
$this->messages[] = array( 'update', sprintf( __( 'Placement <em>%s</em> created', 'advanced-ads' ), esc_html( $placement['name'] ) ) );
|
357 |
$updated_placements[ $placement_key_uniq ] = $placement;
|
358 |
-
$this->imported_data['placements'][ $placement['key'] ] = $placement_key_uniq;
|
359 |
}
|
360 |
|
361 |
if ( $existing_placements !== $updated_placements ) {
|
16 |
private $messages = array();
|
17 |
|
18 |
/**
|
19 |
+
* imported data mapped with previous data, e.g. ['ads'][ new_ad_id => old_ad_id (or null if does not exist) ]
|
20 |
*/
|
21 |
+
public $imported_data = array(
|
22 |
+
'ads' => array(),
|
23 |
+
'groups' => array(),
|
24 |
+
'placements' => array()
|
25 |
+
);
|
26 |
|
27 |
/**
|
28 |
* Created groups during this import session ['slug' => 'id']
|
184 |
$this->messages[] = array( 'update', sprintf( __( 'New ad created: <em>%s</em> %s', 'advanced-ads' ), $post_id, $link ) );
|
185 |
}
|
186 |
|
187 |
+
// new ad id => old ad id, if exists
|
188 |
+
$this->imported_data['ads'][ $post_id ] = isset( $ad['ID'] ) ? absint( $ad['ID'] ) : null;
|
|
|
|
|
|
|
189 |
|
190 |
// import ad groups
|
191 |
if ( ! empty( $ad['groups'] ) && is_array( $ad['groups'] ) ) {
|
228 |
|
229 |
$tt_ids = wp_set_post_terms( $post_id, $groups_to_set, Advanced_Ads::AD_GROUP_TAXONOMY );
|
230 |
}
|
|
|
231 |
}
|
232 |
}
|
233 |
}
|
296 |
return false;
|
297 |
}
|
298 |
|
299 |
+
// new group id => old group id, if exists
|
300 |
+
$this->imported_data['groups'][ $group_id ] = isset( $_group['term_id'] ) ? absint( $_group['term_id'] ) : null;
|
|
|
301 |
|
302 |
return $group_id;
|
303 |
}
|
314 |
$placement_types = Advanced_Ads_Placements::get_placement_types();
|
315 |
|
316 |
foreach ( $decoded['placements'] as &$placement ) {
|
317 |
+
$use_existing = ! empty( $placement['use_existing'] );
|
318 |
+
|
319 |
+
// use existing placement
|
320 |
+
if ( $use_existing ) {
|
321 |
+
if ( empty( $placement['key'] ) ) {
|
322 |
+
continue;
|
323 |
+
}
|
324 |
+
|
325 |
+
$placement_key_uniq = sanitize_title( $placement['key'] );
|
326 |
+
if ( ! isset( $existing_placements[ $placement_key_uniq ] ) ) {
|
327 |
+
continue;
|
328 |
+
}
|
329 |
|
330 |
+
$existing_placement = $existing_placements[ $placement_key_uniq ];
|
331 |
+
$existing_placement['key'] = $placement_key_uniq;
|
332 |
|
333 |
+
// create new placement
|
334 |
+
} else {
|
335 |
+
if ( empty( $placement['key'] ) || empty( $placement['name'] ) || empty( $placement['type'] ) ) {
|
336 |
+
continue;
|
337 |
+
}
|
338 |
+
|
339 |
+
$placement_key_uniq = sanitize_title( $placement['key'] );
|
340 |
+
if ( $placement_key_uniq === '' ) {
|
341 |
+
continue;
|
342 |
+
}
|
343 |
+
|
344 |
+
$placement['type'] = ( isset( $placement_types[ $placement['type'] ] ) ) ? $placement['type'] : 'default';
|
345 |
+
$placement['name'] = esc_attr( $placement['name'] );
|
346 |
|
347 |
+
// make sure the key in placement array is unique
|
348 |
+
if ( isset( $existing_placements[ $placement_key_uniq ] ) ) {
|
349 |
+
$count = 1;
|
350 |
+
while ( isset( $existing_placements[ $placement_key_uniq . '_' . $count ] ) ) {
|
351 |
+
$count++;
|
352 |
+
}
|
353 |
+
$placement_key_uniq .= '_' . $count;
|
354 |
}
|
355 |
+
|
356 |
+
$this->messages[] = array( 'update', sprintf( __( 'Placement <em>%s</em> created', 'advanced-ads' ), esc_html( $placement['name'] ) ) );
|
357 |
+
|
358 |
+
// new placement key => old placement key
|
359 |
+
$this->imported_data['placements'][ $placement_key_uniq ] = $placement['key'];
|
360 |
}
|
361 |
|
362 |
// try to set "Item" (ad or group)
|
366 |
switch ( $_item[0] ) {
|
367 |
case 'ad':
|
368 |
case Advanced_Ads_Select::AD :
|
369 |
+
if ( $use_existing ) {
|
370 |
+
// assign new ad to an existing placement
|
371 |
+
// - if the placement has no or a single ad assigned, it will be swapped against the new one
|
372 |
+
// - if a group is assigned to the placement, the new ad will be added to this group with a weight of 1
|
373 |
+
$placement = $existing_placement;
|
374 |
+
|
375 |
+
if ( ! empty( $placement['item'] ) ) {
|
376 |
+
// get the item from the existing placement
|
377 |
+
$_item_existing = explode( '_', $placement['item'] );
|
378 |
+
|
379 |
+
if ( ! empty( $_item_existing[1] ) && $_item_existing[0] === Advanced_Ads_Select::GROUP ) {
|
380 |
+
$advads_ad_weights = get_option( 'advads-ad-weights', array() );
|
381 |
+
|
382 |
+
if ( term_exists( absint( $_item_existing[1] ), Advanced_Ads::AD_GROUP_TAXONOMY )
|
383 |
+
&& ( $found = array_search( $_item[1], $this->imported_data['ads'] ) )
|
384 |
+
) {
|
385 |
+
wp_set_post_terms( $found, $_item_existing[1], Advanced_Ads::AD_GROUP_TAXONOMY, true );
|
386 |
+
$advads_ad_weights[ $_item_existing[1] ][ $found ] = 1;
|
387 |
+
update_option( 'advads-ad-weights', $advads_ad_weights );
|
388 |
+
break;
|
389 |
+
}
|
390 |
+
}
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
if ( $found = array_search( $_item[1], $this->imported_data['ads'] ) ) {
|
395 |
+
$placement['item'] = 'ad_' . $found;
|
396 |
}
|
397 |
break;
|
398 |
case Advanced_Ads_Select::GROUP :
|
399 |
+
if ( $found = array_search( $_item[1], $this->imported_data['groups'] ) ) {
|
400 |
+
$placement['item'] = 'group_' . $found;
|
401 |
}
|
402 |
break;
|
403 |
}
|
404 |
}
|
405 |
}
|
406 |
|
|
|
407 |
$updated_placements[ $placement_key_uniq ] = $placement;
|
|
|
408 |
}
|
409 |
|
410 |
if ( $existing_placements !== $updated_placements ) {
|
public/assets/js/advanced.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
advads={max_per_session:function(e,t){var
|
1 |
+
advads={max_per_session:function(e,t){var i=1;if((void 0===t||0===parseInt(t))&&(t=1),this.cookie_exists(e)){if(this.get_cookie(e)>=t)return!0;i+=parseInt(this.get_cookie(e))}return this.set_cookie(e,i),!1},count_up:function(e,t){var i=1;this.cookie_exists(e)&&(i+=parseInt(this.get_cookie(e))),this.set_cookie(e,i)},set_cookie_exists:function(e){return get_cookie(e)?!0:(set_cookie(e,"",0),!1)},get_cookie:function(e){var t,i,o,n=document.cookie.split(";");for(t=0;t<n.length;t++)if(i=n[t].substr(0,n[t].indexOf("=")),o=n[t].substr(n[t].indexOf("=")+1),i=i.replace(/^\s+|\s+$/g,""),i===e)return unescape(o)},set_cookie:function(e,t,i,o,n,s){var r=24*i*60*60;this.set_cookie_sec(e,t,r,o,n,s)},set_cookie_sec:function(e,t,i,o,n,s){var r=new Date;r.setSeconds(r.getSeconds()+parseInt(i)),document.cookie=e+"="+escape(t)+(null==i?"":"; expires="+r.toUTCString())+(null==o?"; path=/":"; path="+o)+(null==n?"":"; domain="+n)+(null==s?"":"; secure")},cookie_exists:function(e){var t=this.get_cookie(e);return null!==t&&""!==t&&void 0!==t?!0:!1},move:function(e,t,i){var o=jQuery(e);if("undefined"==typeof i&&(i={}),"undefined"==typeof i.css&&(i.css={}),"undefined"==typeof i.method&&(i.method="prependTo"),""===t&&"undefined"!=typeof i.target)switch(i.target){case"wrapper":var n="left";"undefined"!=typeof i.offset&&(n=i.offset),t=this.find_wrapper(e,n)}switch(i.method){case"insertBefore":o.insertBefore(t);break;case"insertAfter":o.insertAfter(t);break;case"appendTo":o.appendTo(t);break;case"prependTo":o.prependTo(t);break;default:o.prependTo(t)}},fix_element:function(e,t){var i=jQuery(e),o=i.parent();("static"===o.css("position")||""===o.css("position"))&&o.css("position","relative"),"undefined"!=typeof t&&t.is_invisible&&i.show();var n=parseInt(i.offset().top),s=parseInt(i.offset().left);"undefined"!=typeof t&&t.is_invisible&&i.hide(),i.css("position","fixed").css("top",n+"px").css("left",s+"px")},find_wrapper:function(e,t){var i;return jQuery("body").children().each(function(o,n){if(n.id!==e.substring(1)){var s=jQuery(n);if("right"===t&&s.offset().left+jQuery(s).width()<jQuery(window).width()||"left"===t&&s.offset().left>0)return("static"===s.css("position")||""===s.css("position"))&&s.css("position","relative"),i=n,!1}}),i},center_fixed_element:function(e){var t=jQuery(e),i=jQuery(window).width()/2-parseInt(t.css("width"))/2;t.css("left",i+"px")},center_vertically:function(e){var t=jQuery(e),i=jQuery(window).height()/2-parseInt(t.css("height"))/2;t.css("top",i+"px")},close:function(e){var t=jQuery(e);t.remove()}},jQuery(document).ready(function(){if(localStorage.getItem("advads_frontend_picker")){var e,t=jQuery("<div id='advads-picker-overlay'>"),i=[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(o){if(o.target!==e){if(~i.indexOf(o.target))return e=null,void t.hide();var n=jQuery(o.target),s=n.offset(),r=n.outerWidth(),a=n.outerHeight();e=o.target,t.css({top:s.top,left:s.left,width:r,height:a}).show(),console.log(jQuery(e).getPath())}}),jQuery(document).click(function(t){var i=jQuery(e).getPath();localStorage.setItem("advads_frontend_element",i),window.location=localStorage.getItem("advads_prev_url")})}}),jQuery.fn.extend({getPath:function(e,t){if("undefined"==typeof e&&(e=""),"undefined"==typeof t&&(t=0),this.is("html"))return"html > "+e;if(3===t)return e;var i=this.get(0).nodeName.toLowerCase(),o=this.attr("id"),n=this.attr("class");return t+=1,"undefined"==typeof o||/\d/.test(o)?"undefined"!=typeof n&&(n=n.split(/[\s\n]+/),n=jQuery.grep(n,function(e,t){return!/\d/.test(e)}),n.length&&(i+="."+n.slice(0,2).join("."))):i+="#"+o,this.siblings(i).length&&(i+=":eq("+this.siblings(i).addBack().not("#advads-picker-overlay").index(this)+")"),""===e?this.parent().getPath(i,t):this.parent().getPath(i+" > "+e,t)}});
|
public/assets/js/advanced.orig.js
CHANGED
@@ -326,10 +326,10 @@ jQuery.fn.extend({
|
|
326 |
if ( typeof depth === 'undefined' ) depth = 0;
|
327 |
|
328 |
// If this element is <html> we've reached the end of the path.
|
329 |
-
// also end after 2 elements
|
330 |
if ( this.is('html')){
|
331 |
return 'html > ' + path;
|
332 |
-
} else if (
|
333 |
return path;
|
334 |
}
|
335 |
|
@@ -340,18 +340,27 @@ jQuery.fn.extend({
|
|
340 |
var el_id = this.attr('id'),
|
341 |
el_class = this.attr('class');
|
342 |
|
343 |
-
|
344 |
-
|
|
|
|
|
345 |
cur += '#' + el_id;
|
346 |
-
depth = depth + 1;
|
347 |
} else if ( typeof el_class !== 'undefined' ){
|
348 |
-
// Add
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
}
|
351 |
|
352 |
// add index if this element is not unique among its siblings
|
353 |
if( this.siblings( cur ).length ){
|
354 |
-
cur += ":eq(" + this.index() + ")";
|
355 |
}
|
356 |
|
357 |
// Recurse up the DOM.
|
326 |
if ( typeof depth === 'undefined' ) depth = 0;
|
327 |
|
328 |
// If this element is <html> we've reached the end of the path.
|
329 |
+
// also end after 2 elements
|
330 |
if ( this.is('html')){
|
331 |
return 'html > ' + path;
|
332 |
+
} else if ( 3 === depth ){
|
333 |
return path;
|
334 |
}
|
335 |
|
340 |
var el_id = this.attr('id'),
|
341 |
el_class = this.attr('class');
|
342 |
|
343 |
+
depth = depth + 1;
|
344 |
+
|
345 |
+
// Add the #id if there is one. Ignore ID with number.
|
346 |
+
if ( typeof el_id !== 'undefined' && ! /\d/.test( el_id ) ) {
|
347 |
cur += '#' + el_id;
|
|
|
348 |
} else if ( typeof el_class !== 'undefined' ){
|
349 |
+
// Add classes if there is no id.
|
350 |
+
el_class = el_class.split( /[\s\n]+/ );
|
351 |
+
// Skip classes with numbers.
|
352 |
+
el_class = jQuery.grep( el_class, function( element, index ) {
|
353 |
+
return ! /\d/.test( element )
|
354 |
+
});
|
355 |
+
// Add 2 classes.
|
356 |
+
if ( el_class.length ) {
|
357 |
+
cur += '.' + el_class.slice( 0, 2 ).join( '.' );
|
358 |
+
}
|
359 |
}
|
360 |
|
361 |
// add index if this element is not unique among its siblings
|
362 |
if( this.siblings( cur ).length ){
|
363 |
+
cur += ":eq(" + this.siblings( cur ).addBack().not( '#advads-picker-overlay' ).index( this ) + ")";
|
364 |
}
|
365 |
|
366 |
// Recurse up the DOM.
|
public/class-advanced-ads.php
CHANGED
@@ -525,7 +525,7 @@ class Advanced_Ads {
|
|
525 |
* @since 1.0.0
|
526 |
*/
|
527 |
public function create_post_types() {
|
528 |
-
if ( 1 !== did_action( 'init' ) ) {
|
529 |
return;
|
530 |
}
|
531 |
|
525 |
* @since 1.0.0
|
526 |
*/
|
527 |
public function create_post_types() {
|
528 |
+
if ( 1 !== did_action( 'init' ) && 1 !== did_action( 'uninstall_' . ADVADS_BASE ) ) {
|
529 |
return;
|
530 |
}
|
531 |
|
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.6
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -204,6 +204,18 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
204 |
|
205 |
== Changelog ==
|
206 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
= 1.7.5.1 =
|
208 |
|
209 |
* add and remove ads in groups in the group overview page
|
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.6
|
7 |
+
Stable tag: 1.7.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
204 |
|
205 |
== Changelog ==
|
206 |
|
207 |
+
= 1.7.6 =
|
208 |
+
|
209 |
+
* prevent third part meta boxes in the ad edit screen
|
210 |
+
* set `ADVANCED_ADS_DISABLE_FRONTEND_AD_WEIGHT_UPDATE` constant to disable frontend group updates (for high traffic sites)
|
211 |
+
* enabled overriding placements through the import
|
212 |
+
* added uninstall option to remove all data on plugin uninstall (default: not removed)
|
213 |
+
* optimized element selector script used in Pro and Sticky
|
214 |
+
* fixed specific page display condition on archive pages
|
215 |
+
* fixed output of wrong publisher ID in admin panel
|
216 |
+
* fixed missing index error with ad block disguise
|
217 |
+
* fixed minor widget error on ad dashboard page
|
218 |
+
|
219 |
= 1.7.5.1 =
|
220 |
|
221 |
* add and remove ads in groups in the group overview page
|
uninstall.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fired when the plugin is uninstalled.
|
4 |
-
*
|
5 |
-
* @package Advanced_Ads_Admin
|
6 |
-
* @author Thomas Maier <thomas.maier@webgilde.com>
|
7 |
-
* @license GPL-2.0+
|
8 |
-
* @link http://webgilde.com
|
9 |
-
* @copyright 2013 Thomas Maier, webgilde GmbH
|
10 |
-
*/
|
11 |
-
|
12 |
-
// If uninstall not called from WordPress, then exit
|
13 |
-
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
// @TODO: Define uninstall functionality here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|