Version Description
- added option to also consider elements in containers for ad content injection
- show warning in Ad Health bar when not all ads could be injected
- added logic to display ad specific warnings and possible conflicts
- added warning to disable shortcode button or ad blocker in order to use the visual editor for posts
- reapplied user capabilities to create or edit ads to make sure they are never wrong
- added warning about left and right position not working with responsive AdSense units
- edited feedback form
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.7.22 |
Comparing to | |
See all releases |
Code changes from version 1.7.21 to 1.7.22
- admin/assets/css/admin.css +7 -2
- admin/class-advanced-ads-admin.php +10 -5
- admin/includes/class-licenses.php +2 -1
- admin/includes/class-meta-box.php +25 -0
- admin/includes/class-settings.php +44 -2
- admin/includes/class-shortcode-creator.php +40 -7
- admin/views/ad-info-after-textarea.php +0 -4
- admin/views/ad-visitor-metabox.php +3 -0
- admin/views/feedback-disable.php +2 -2
- admin/views/notices/adblock.php +0 -1
- advanced-ads.php +2 -2
- classes/ad_placements.php +43 -3
- classes/frontend_checks.php +3 -1
- classes/plugin.php +2 -0
- modules/gadsense/admin/admin.php +34 -0
- modules/gadsense/admin/assets/js/new-ad.js +8 -0
- modules/marketpress-license/main.php +0 -8
- readme.txt +11 -1
admin/assets/css/admin.css
CHANGED
@@ -50,7 +50,6 @@ h2.hndle .advads-hndlelinks a + a { margin-left: 1em; }
|
|
50 |
#advads-ad-injection-box button:hover { background: #0085ba !important; color: #fff; text-indent: 0; white-space: normal; cursor: pointer; }
|
51 |
#advads-ad-injection-box input[type="number"] { width: 4em; }
|
52 |
|
53 |
-
|
54 |
#advads-ad-injection-shortcode { width: 130px; border: none; background: #ededed; }
|
55 |
#advads-ad-injection-message-placement-created { font-size: 1.5em; }
|
56 |
.advads-pro-link { opacity: 0.5; }
|
@@ -63,6 +62,12 @@ h2.hndle .advads-hndlelinks a + a { margin-left: 1em; }
|
|
63 |
#advads-ad-info > label { margin-left: 1em; }
|
64 |
#advads-ad-info pre input { background: transparent; }
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
#ad-main-box { overflow: hidden; }
|
67 |
.post-type-advanced_ads #poststuff .meta-box-sortables .inside {
|
68 |
margin: 0;
|
@@ -122,7 +127,7 @@ select + .advads-conditions-single { display: inline-block; }
|
|
122 |
.post-type-advanced_ads select + .advads-conditions-single { padding-left: 10px }
|
123 |
.post-type-advanced_ads .advads-conditions-single.disabled { display: none; opacity: .5; }
|
124 |
.post-type-advanced_ads .advads-conditions-table .advads-conditions-single.advads-buttonset label { margin: 0 -1px .3em 0; padding: 0 .5em; background: #f7f7f7; height: 26px; line-height: 26px; color: #555; border: 1px solid #ccc; border-radius: 0; font-family: inherit; box-shadow: none; }
|
125 |
-
.post-type-advanced_ads
|
126 |
.post-type-advanced_ads .advads-conditions-postid-buttons { padding: 0 10px; }
|
127 |
.advads-conditions-postids-show-search { margin-left: .5em !important; }
|
128 |
.advads-conditions-postids-list li { background: #F1F1F1; padding: 3px; }
|
50 |
#advads-ad-injection-box button:hover { background: #0085ba !important; color: #fff; text-indent: 0; white-space: normal; cursor: pointer; }
|
51 |
#advads-ad-injection-box input[type="number"] { width: 4em; }
|
52 |
|
|
|
53 |
#advads-ad-injection-shortcode { width: 130px; border: none; background: #ededed; }
|
54 |
#advads-ad-injection-message-placement-created { font-size: 1.5em; }
|
55 |
.advads-pro-link { opacity: 0.5; }
|
62 |
#advads-ad-info > label { margin-left: 1em; }
|
63 |
#advads-ad-info pre input { background: transparent; }
|
64 |
|
65 |
+
.advads-metabox-notices { }
|
66 |
+
.advads-metabox-notices li { border: solid 1px #eee; margin: -1px 0 0; padding: 5px; }
|
67 |
+
.advads-metabox-notices a { color: inherit; }
|
68 |
+
.advads-metabox-notices .error { color: red; }
|
69 |
+
.advads-metabox-notices .warning { color: #de8400; }
|
70 |
+
|
71 |
#ad-main-box { overflow: hidden; }
|
72 |
.post-type-advanced_ads #poststuff .meta-box-sortables .inside {
|
73 |
margin: 0;
|
127 |
.post-type-advanced_ads select + .advads-conditions-single { padding-left: 10px }
|
128 |
.post-type-advanced_ads .advads-conditions-single.disabled { display: none; opacity: .5; }
|
129 |
.post-type-advanced_ads .advads-conditions-table .advads-conditions-single.advads-buttonset label { margin: 0 -1px .3em 0; padding: 0 .5em; background: #f7f7f7; height: 26px; line-height: 26px; color: #555; border: 1px solid #ccc; border-radius: 0; font-family: inherit; box-shadow: none; }
|
130 |
+
.post-type-advanced_ads .advads-conditions-single.advads-buttonset label span { margin: 0; padding: 0; line-height: inherit; }
|
131 |
.post-type-advanced_ads .advads-conditions-postid-buttons { padding: 0 10px; }
|
132 |
.advads-conditions-postids-show-search { margin-left: .5em !important; }
|
133 |
.advads-conditions-postids-list li { background: #F1F1F1; padding: 3px; }
|
admin/class-advanced-ads-admin.php
CHANGED
@@ -168,6 +168,7 @@ class Advanced_Ads_Admin {
|
|
168 |
|
169 |
// global js script
|
170 |
wp_enqueue_script( $this->plugin_slug . '-admin-global-script', plugins_url( 'assets/js/admin-global.js', __FILE__ ), array('jquery'), ADVADS_VERSION );
|
|
|
171 |
|
172 |
if( self::screen_belongs_to_advanced_ads() ){
|
173 |
wp_register_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery', 'jquery-ui-autocomplete' , 'jquery-ui-button' ), ADVADS_VERSION );
|
@@ -353,15 +354,15 @@ class Advanced_Ads_Admin {
|
|
353 |
public function add_deactivation_logic(){
|
354 |
|
355 |
$screen = get_current_screen();
|
356 |
-
if( ! isset( $screen->id ) ||
|
357 |
return;
|
358 |
}
|
359 |
|
360 |
$current_user = wp_get_current_user();
|
361 |
if ( !($current_user instanceof WP_User) ){
|
362 |
-
$
|
363 |
} else {
|
364 |
-
$
|
365 |
}
|
366 |
|
367 |
include ADVADS_BASE_PATH . 'admin/views/feedback-disable.php';
|
@@ -383,6 +384,12 @@ class Advanced_Ads_Admin {
|
|
383 |
$text = implode( "\n\r", $form[ 'advanced_ads_disable_text' ] );
|
384 |
}
|
385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
$headers = array();
|
387 |
|
388 |
$from = isset( $form['advanced_ads_disable_from'] ) ? $form['advanced_ads_disable_from'] : '';
|
@@ -395,8 +402,6 @@ class Advanced_Ads_Admin {
|
|
395 |
|
396 |
$success = wp_mail( 'improve@wpadvancedads.com', $subject, $text, $headers );
|
397 |
|
398 |
-
// error_log(print_r($success, true));
|
399 |
-
|
400 |
die();
|
401 |
|
402 |
}
|
168 |
|
169 |
// global js script
|
170 |
wp_enqueue_script( $this->plugin_slug . '-admin-global-script', plugins_url( 'assets/js/admin-global.js', __FILE__ ), array('jquery'), ADVADS_VERSION );
|
171 |
+
wp_enqueue_script( $this->plugin_slug . '-admin-find-adblocker', plugins_url( 'assets/js/advertisement.js', __FILE__ ), array(), ADVADS_VERSION );
|
172 |
|
173 |
if( self::screen_belongs_to_advanced_ads() ){
|
174 |
wp_register_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery', 'jquery-ui-autocomplete' , 'jquery-ui-button' ), ADVADS_VERSION );
|
354 |
public function add_deactivation_logic(){
|
355 |
|
356 |
$screen = get_current_screen();
|
357 |
+
if ( ! isset( $screen->id ) || ! in_array( $screen->id, array( 'plugins', 'plugins-network' ), true ) ) {
|
358 |
return;
|
359 |
}
|
360 |
|
361 |
$current_user = wp_get_current_user();
|
362 |
if ( !($current_user instanceof WP_User) ){
|
363 |
+
$from = '';
|
364 |
} else {
|
365 |
+
$from = $current_user->user_nicename . ' <' . trim( $current_user->user_email ) . '>';
|
366 |
}
|
367 |
|
368 |
include ADVADS_BASE_PATH . 'admin/views/feedback-disable.php';
|
384 |
$text = implode( "\n\r", $form[ 'advanced_ads_disable_text' ] );
|
385 |
}
|
386 |
|
387 |
+
// get first version to see if this is a new problem or might be an older on
|
388 |
+
$options = Advanced_Ads_Plugin::get_instance()->internal_options();
|
389 |
+
$installed = isset( $options['installed'] ) ? date( 'd.m.Y', $options['installed'] ) : '–';
|
390 |
+
|
391 |
+
$text .= "\n\n" . home_url() . " ($installed)";
|
392 |
+
|
393 |
$headers = array();
|
394 |
|
395 |
$from = isset( $form['advanced_ads_disable_from'] ) ? $form['advanced_ads_disable_from'] : '';
|
402 |
|
403 |
$success = wp_mail( 'improve@wpadvancedads.com', $subject, $text, $headers );
|
404 |
|
|
|
|
|
405 |
die();
|
406 |
|
407 |
}
|
admin/includes/class-licenses.php
CHANGED
@@ -460,7 +460,8 @@ class Advanced_Ads_Admin_Licenses {
|
|
460 |
}
|
461 |
|
462 |
if( isset( $plugin_file ) && $plugin_file ){
|
463 |
-
|
|
|
464 |
//$updater->skin->feedback( 'downloading_package' );
|
465 |
|
466 |
// if AJAX; show direct update link as first possible solution
|
460 |
}
|
461 |
|
462 |
if( isset( $plugin_file ) && $plugin_file ){
|
463 |
+
// hides the download url, but makes debugging harder
|
464 |
+
// $updater->strings['downloading_package'] = __( 'Downloading updated version...', 'advanced-ads' );
|
465 |
//$updater->skin->feedback( 'downloading_package' );
|
466 |
|
467 |
// if AJAX; show direct update link as first possible solution
|
admin/includes/class-meta-box.php
CHANGED
@@ -155,6 +155,31 @@ class Advanced_Ads_Admin_Meta_Boxes {
|
|
155 |
if( isset( $videomarkup ) ){
|
156 |
echo '<div class="advads-video-link-container" data-videolink=\'' . $videomarkup . '\'></div>';
|
157 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
include ADVADS_BASE_PATH . 'admin/views/' . $view;
|
159 |
}
|
160 |
|
155 |
if( isset( $videomarkup ) ){
|
156 |
echo '<div class="advads-video-link-container" data-videolink=\'' . $videomarkup . '\'></div>';
|
157 |
}
|
158 |
+
/**
|
159 |
+
* list general notices
|
160 |
+
*
|
161 |
+
* elements in $warnings contain [text] and [class] attributes
|
162 |
+
*/
|
163 |
+
$warnings = array();
|
164 |
+
// show warning if ad contains https in parameters box
|
165 |
+
if ( 'ad-parameters-box' === $box['id'] && $message = Advanced_Ads_Ad_Debug::is_https_and_http( $ad ) ) {
|
166 |
+
$warnings[] = array(
|
167 |
+
'text' => $message,
|
168 |
+
'class' =>'advads-ad-notice-https-missing error'
|
169 |
+
);
|
170 |
+
}
|
171 |
+
|
172 |
+
$warnings = apply_filters( 'advanced-ads-ad-notices', $warnings, $box, $post );
|
173 |
+
echo '<ul id="' .$box['id'].'-notices" class="advads-metabox-notices">';
|
174 |
+
foreach( $warnings as $_warning ){
|
175 |
+
if( isset( $_warning['text'] ) ) :
|
176 |
+
$warning_class = isset( $_warning['class'] ) ? $_warning['class'] : '';
|
177 |
+
echo '<li class="'. $warning_class . '">';
|
178 |
+
echo $_warning['text'];
|
179 |
+
echo '</li>';
|
180 |
+
endif;
|
181 |
+
}
|
182 |
+
echo '</ul>';
|
183 |
include ADVADS_BASE_PATH . 'admin/views/' . $view;
|
184 |
}
|
185 |
|
admin/includes/class-settings.php
CHANGED
@@ -104,7 +104,15 @@ class Advanced_Ads_Admin_Settings {
|
|
104 |
$hook,
|
105 |
'advanced_ads_setting_section'
|
106 |
);
|
107 |
-
// add setting fields
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
add_settings_field(
|
109 |
'block-bots',
|
110 |
__( 'Hide ads from bots', 'advanced-ads' ),
|
@@ -164,6 +172,15 @@ class Advanced_Ads_Admin_Settings {
|
|
164 |
);
|
165 |
}
|
166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
// hook for additional settings from add-ons
|
168 |
do_action( 'advanced-ads-settings-init', $hook );
|
169 |
}
|
@@ -307,6 +324,19 @@ class Advanced_Ads_Admin_Settings {
|
|
307 |
echo '</p>';
|
308 |
}
|
309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
/**
|
311 |
* render setting for blocking bots
|
312 |
*
|
@@ -431,6 +461,18 @@ class Advanced_Ads_Admin_Settings {
|
|
431 |
<?php
|
432 |
}
|
433 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
434 |
/**
|
435 |
* sanitize plugin settings
|
436 |
*
|
@@ -481,4 +523,4 @@ class Advanced_Ads_Admin_Settings {
|
|
481 |
return $options;
|
482 |
}
|
483 |
|
484 |
-
}
|
104 |
$hook,
|
105 |
'advanced_ads_setting_section'
|
106 |
);
|
107 |
+
// add setting fields to remove injection level limitation
|
108 |
+
add_settings_field(
|
109 |
+
'content-injection-level-limitation',
|
110 |
+
__( 'Disable level limitation', 'advanced-ads' ),
|
111 |
+
array($this, 'render_settings_content_injection_level_limitation'),
|
112 |
+
$hook,
|
113 |
+
'advanced_ads_setting_section'
|
114 |
+
);
|
115 |
+
// add setting fields for hiding ads from bots
|
116 |
add_settings_field(
|
117 |
'block-bots',
|
118 |
__( 'Hide ads from bots', 'advanced-ads' ),
|
172 |
);
|
173 |
}
|
174 |
|
175 |
+
// allow to disable shortcode button in TinyMCE
|
176 |
+
add_settings_field(
|
177 |
+
'disable-shortcode-button',
|
178 |
+
__( 'Disable shortcode button', 'advanced-ads' ),
|
179 |
+
array( $this, 'render_settings_disable_shortcode_button' ),
|
180 |
+
$hook,
|
181 |
+
'advanced_ads_setting_section'
|
182 |
+
);
|
183 |
+
|
184 |
// hook for additional settings from add-ons
|
185 |
do_action( 'advanced-ads-settings-init', $hook );
|
186 |
}
|
324 |
echo '</p>';
|
325 |
}
|
326 |
|
327 |
+
/**
|
328 |
+
* render setting to disable content injection level limitation
|
329 |
+
*
|
330 |
+
* @since 1.7.22
|
331 |
+
*/
|
332 |
+
public function render_settings_content_injection_level_limitation(){
|
333 |
+
$options = Advanced_Ads::get_instance()->options();
|
334 |
+
$checked = ( ! empty($options['content-injection-level-disabled'])) ? 1 : 0;
|
335 |
+
|
336 |
+
echo '<input id="advanced-ads-content-injection-level-disabled" type="checkbox" value="1" name="'.ADVADS_SLUG.'[content-injection-level-disabled]" '.checked( $checked, 1, false ).'>';
|
337 |
+
echo '<p class="description">'. __( 'Advanced Ads ignores paragraphs and other elements in containers when injecting ads into the post content. Check this option to ignore this limitation and ads might show up again.', 'advanced-ads' ) . '</p>';
|
338 |
+
}
|
339 |
+
|
340 |
/**
|
341 |
* render setting for blocking bots
|
342 |
*
|
461 |
<?php
|
462 |
}
|
463 |
|
464 |
+
/**
|
465 |
+
* Render setting to disable shortcode button.
|
466 |
+
*/
|
467 |
+
public function render_settings_disable_shortcode_button(){
|
468 |
+
$options = Advanced_Ads::get_instance()->options();
|
469 |
+
|
470 |
+
$checked = ! empty( $options['disable-shortcode-button'] );
|
471 |
+
|
472 |
+
echo '<input id="advanced-ads-disable-shortcode-button" type="checkbox" ' . checked( $checked, true, false ) . ' name="' . ADVADS_SLUG . '[disable-shortcode-button]" />';
|
473 |
+
echo '<p class="description">' . __( 'Disable shortcode button in visual editor.', 'advanced-ads' ) . '</p>';
|
474 |
+
}
|
475 |
+
|
476 |
/**
|
477 |
* sanitize plugin settings
|
478 |
*
|
523 |
return $options;
|
524 |
}
|
525 |
|
526 |
+
}
|
admin/includes/class-shortcode-creator.php
CHANGED
@@ -30,16 +30,22 @@ class Advanced_Ads_Shortcode_Creator {
|
|
30 |
}
|
31 |
|
32 |
public function init() {
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
return;
|
35 |
}
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
}
|
44 |
|
45 |
/**
|
@@ -135,4 +141,31 @@ class Advanced_Ads_Shortcode_Creator {
|
|
135 |
$mce_external_languages[ 'advads_shortcode' ] = ADVADS_BASE_PATH . 'admin/includes/shortcode-creator-l10n.php';
|
136 |
return $mce_external_languages;
|
137 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
30 |
}
|
31 |
|
32 |
public function init() {
|
33 |
+
$options = Advanced_Ads::get_instance()->options();
|
34 |
+
|
35 |
+
if ( 'true' != get_user_option( 'rich_editing' )
|
36 |
+
|| ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_place_ads' ) )
|
37 |
+
|| defined( 'ADVANCED_ADS_DISABLE_SHORTCODE_BUTTON' )
|
38 |
+
|| ! empty( $options['disable-shortcode-button'] )
|
39 |
+
) {
|
40 |
return;
|
41 |
}
|
42 |
|
43 |
+
add_filter( 'mce_external_plugins', array( $this, 'add_plugin' ) );
|
44 |
+
add_filter( 'mce_buttons', array( $this, 'register_buttons' ) );
|
45 |
+
add_filter( 'mce_external_languages', array( $this, 'add_l10n' ) );
|
46 |
+
add_action( 'wp_ajax_advads_content_for_shortcode_creator', array( $this, 'get_content_for_shortcode_creator' ) );
|
47 |
+
|
48 |
+
add_filter( 'the_editor', array( $this, 'add_addblocker_warning' ) );
|
49 |
}
|
50 |
|
51 |
/**
|
141 |
$mce_external_languages[ 'advads_shortcode' ] = ADVADS_BASE_PATH . 'admin/includes/shortcode-creator-l10n.php';
|
142 |
return $mce_external_languages;
|
143 |
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Show a warning above TinyMCE editor when an adblock is enabled.
|
147 |
+
*
|
148 |
+
* @param string $output Editor's HTML markup.
|
149 |
+
*/
|
150 |
+
public function add_addblocker_warning( $output ) {
|
151 |
+
ob_start(); ?>
|
152 |
+
<div style="display: none; margin: 10px 8px; color: red;" class="advanced-ads-shortcode-button-warning"><?php
|
153 |
+
printf( __ ( 'Please, either switch off your ad blocker or disable the shortcode button in the <a href="%s" target="_blank">settings</a>.', 'advanced-ads' ),
|
154 |
+
admin_url( 'admin.php?page=advanced-ads-settings' ) ); ?>
|
155 |
+
</div>
|
156 |
+
<script>
|
157 |
+
(function(){
|
158 |
+
if ( 'undefined' === typeof advanced_ads_adblocker_test ) {
|
159 |
+
try {
|
160 |
+
var messages = document.querySelectorAll( '.advanced-ads-shortcode-button-warning' )
|
161 |
+
} catch ( e ) { return; }
|
162 |
+
for ( var i = 0; i < messages.length; i++ ) {
|
163 |
+
messages[ i ].style.display = 'block';
|
164 |
+
}
|
165 |
+
}
|
166 |
+
})();
|
167 |
+
</script>
|
168 |
+
<?php
|
169 |
+
return ob_get_clean() . $output;
|
170 |
+
}
|
171 |
}
|
admin/views/ad-info-after-textarea.php
CHANGED
@@ -9,10 +9,6 @@ if ( defined ( 'WP_DEBUG' ) && WP_DEBUG &&
|
|
9 |
<?php endif;
|
10 |
?>
|
11 |
</p>
|
12 |
-
<?php endif;
|
13 |
-
|
14 |
-
if ( $message = Advanced_Ads_Ad_Debug::is_https_and_http( $ad ) ) : ?>
|
15 |
-
<p class="advads-error-message"><?php echo $message; ?></p>
|
16 |
<?php endif;
|
17 |
|
18 |
do_action( 'advanced-ads-ad-params-below-textarea', $ad );
|
9 |
<?php endif;
|
10 |
?>
|
11 |
</p>
|
|
|
|
|
|
|
|
|
12 |
<?php endif;
|
13 |
|
14 |
do_action( 'advanced-ads-ad-params-below-textarea', $ad );
|
admin/views/ad-visitor-metabox.php
CHANGED
@@ -81,6 +81,9 @@ jQuery( document ).ready(function ($) {
|
|
81 |
var connector = '<input type="checkbox" name="<?php echo Advanced_Ads_Visitor_Conditions::FORM_NAME; ?>[' + visitor_condition_index + '][connector]" value="or" id="advads-visitor-conditions-'+ visitor_condition_index +'-connector"><label for="advads-visitor-conditions-'+ visitor_condition_index +'-connector"><?php _e( 'and', 'advanced-ads' ); ?></label>';
|
82 |
var newline = '<tr class="advads-conditions-connector advads-conditions-connector-and"><td colspan="3">'+connector+'</td></tr><tr><td>' + visitor_condition_title + '</td><td>' + r + '</td><td><button type="button" class="advads-conditions-remove button">x</button></td></tr>';
|
83 |
$( '#advads-visitor-conditions table tbody' ).append( newline );
|
|
|
|
|
|
|
84 |
if ( jQuery.fn.advads_button ) {
|
85 |
$('#advads-visitor-conditions table tbody .advads-conditions-connector input').advads_button();
|
86 |
}
|
81 |
var connector = '<input type="checkbox" name="<?php echo Advanced_Ads_Visitor_Conditions::FORM_NAME; ?>[' + visitor_condition_index + '][connector]" value="or" id="advads-visitor-conditions-'+ visitor_condition_index +'-connector"><label for="advads-visitor-conditions-'+ visitor_condition_index +'-connector"><?php _e( 'and', 'advanced-ads' ); ?></label>';
|
82 |
var newline = '<tr class="advads-conditions-connector advads-conditions-connector-and"><td colspan="3">'+connector+'</td></tr><tr><td>' + visitor_condition_title + '</td><td>' + r + '</td><td><button type="button" class="advads-conditions-remove button">x</button></td></tr>';
|
83 |
$( '#advads-visitor-conditions table tbody' ).append( newline );
|
84 |
+
if ( advads_use_ui_buttonset() ) { // only used in Pro right now
|
85 |
+
$('#advads-visitor-conditions table tbody .advads-conditions-single.advads-buttonset').buttonset();
|
86 |
+
}
|
87 |
if ( jQuery.fn.advads_button ) {
|
88 |
$('#advads-visitor-conditions table tbody .advads-conditions-connector input').advads_button();
|
89 |
}
|
admin/views/feedback-disable.php
CHANGED
@@ -14,8 +14,8 @@
|
|
14 |
<li><label><input type="radio" name="advanced_ads_disable_reason" value="other"/><?php _e('other reason', 'advanced-ads'); ?></label></li>
|
15 |
<li><textarea name="advanced_ads_disable_text[]" placeholder="<?php _e('Please specify, if possible', 'advanced-ads'); ?>"></textarea></li>
|
16 |
</ul>
|
17 |
-
<?php if ($
|
18 |
-
<input type="hidden" name="advanced_ads_disable_from" value="<?php echo $
|
19 |
<?php endif; ?>
|
20 |
<input id="advanced-ads-feedback-submit" class="button button-primary" type="submit" name="advanced_ads_disable_submit" value="<?php _e('Submit & Deactivate', 'advanced-ads'); ?>"/>
|
21 |
<a class="button"><?php _e('Only Deactivate', 'advanced-ads'); ?></a>
|
14 |
<li><label><input type="radio" name="advanced_ads_disable_reason" value="other"/><?php _e('other reason', 'advanced-ads'); ?></label></li>
|
15 |
<li><textarea name="advanced_ads_disable_text[]" placeholder="<?php _e('Please specify, if possible', 'advanced-ads'); ?>"></textarea></li>
|
16 |
</ul>
|
17 |
+
<?php if ($from) : ?>
|
18 |
+
<input type="hidden" name="advanced_ads_disable_from" value="<?php echo $from; ?>"/>
|
19 |
<?php endif; ?>
|
20 |
<input id="advanced-ads-feedback-submit" class="button button-primary" type="submit" name="advanced_ads_disable_submit" value="<?php _e('Submit & Deactivate', 'advanced-ads'); ?>"/>
|
21 |
<a class="button"><?php _e('Only Deactivate', 'advanced-ads'); ?></a>
|
admin/views/notices/adblock.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<div class="advads-ad-block-check">
|
2 |
-
<script type="text/javascript" src="<?php echo ADVADS_BASE_URL . 'admin/assets/js/advertisement.js' ?>"></script>
|
3 |
<div class="message error" style="display: none;"><p><?php _e( 'Please disable your <strong>AdBlocker</strong> to prevent problems with your ad setup.', 'advanced-ads' ); ?></p></div>
|
4 |
</div>
|
5 |
<script>
|
1 |
<div class="advads-ad-block-check">
|
|
|
2 |
<div class="message error" style="display: none;"><p><?php _e( 'Please disable your <strong>AdBlocker</strong> to prevent problems with your ad setup.', 'advanced-ads' ); ?></p></div>
|
3 |
</div>
|
4 |
<script>
|
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.22
|
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.22' );
|
43 |
|
44 |
/*----------------------------------------------------------------------------*
|
45 |
* Autoloading, modules and functions
|
classes/ad_placements.php
CHANGED
@@ -325,6 +325,10 @@ class Advanced_Ads_Placements {
|
|
325 |
* @link inspired by http://www.wpbeginner.com/wp-tutorials/how-to-insert-ads-within-your-post-content-in-wordpress/
|
326 |
*/
|
327 |
public static function &inject_in_content($placement_id, $options, &$content) {
|
|
|
|
|
|
|
|
|
328 |
// test ad is emtpy
|
329 |
$whitespaces = json_decode('"\t\n\r \u00A0"');
|
330 |
$adContent = Advanced_Ads_Select::get_instance()->get_ad_by_method( $placement_id, 'placement', $options );
|
@@ -393,6 +397,11 @@ class Advanced_Ads_Placements {
|
|
393 |
// if there are too few items at this level test nesting
|
394 |
$options['itemLimit'] = $tag === 'p' ? 2 : 1;
|
395 |
|
|
|
|
|
|
|
|
|
|
|
396 |
// allow hooks to change some options
|
397 |
$options = apply_filters(
|
398 |
'advanced-ads-placement-content-injection-options',
|
@@ -403,14 +412,14 @@ class Advanced_Ads_Placements {
|
|
403 |
$items = $xpath->query('/html/body/*/' . $tag);
|
404 |
}
|
405 |
// try third level
|
406 |
-
if ($items->length < $options['itemLimit']) {
|
407 |
$items = $xpath->query('/html/body/*/*/' . $tag);
|
408 |
}
|
409 |
// try all levels as last resort
|
410 |
if ( $items->length < $options['itemLimit'] ) {
|
411 |
$items = $xpath->query( '//' . $tag );
|
412 |
}
|
413 |
-
|
414 |
// allow to select other elements
|
415 |
$items = apply_filters( 'advanced-ads-placement-content-injection-items', $items, $xpath, $tag );
|
416 |
|
@@ -474,6 +483,37 @@ class Advanced_Ads_Placements {
|
|
474 |
}
|
475 |
|
476 |
libxml_use_internal_errors(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
}
|
478 |
|
479 |
// convert to text-representation
|
@@ -495,7 +535,7 @@ class Advanced_Ads_Placements {
|
|
495 |
|
496 |
return $content;
|
497 |
}
|
498 |
-
|
499 |
/**
|
500 |
* check if the placement can be displayed
|
501 |
*
|
325 |
* @link inspired by http://www.wpbeginner.com/wp-tutorials/how-to-insert-ads-within-your-post-content-in-wordpress/
|
326 |
*/
|
327 |
public static function &inject_in_content($placement_id, $options, &$content) {
|
328 |
+
|
329 |
+
// get plugin options
|
330 |
+
$plugin_options = Advanced_Ads::get_instance()->options();
|
331 |
+
|
332 |
// test ad is emtpy
|
333 |
$whitespaces = json_decode('"\t\n\r \u00A0"');
|
334 |
$adContent = Advanced_Ads_Select::get_instance()->get_ad_by_method( $placement_id, 'placement', $options );
|
397 |
// if there are too few items at this level test nesting
|
398 |
$options['itemLimit'] = $tag === 'p' ? 2 : 1;
|
399 |
|
400 |
+
// trigger such a high item limit that all elements will be considered
|
401 |
+
if( ! empty($plugin_options['content-injection-level-disabled'] ) ){
|
402 |
+
$options['itemLimit'] = 1000;
|
403 |
+
}
|
404 |
+
|
405 |
// allow hooks to change some options
|
406 |
$options = apply_filters(
|
407 |
'advanced-ads-placement-content-injection-options',
|
412 |
$items = $xpath->query('/html/body/*/' . $tag);
|
413 |
}
|
414 |
// try third level
|
415 |
+
if ( $items->length < $options['itemLimit'] ) {
|
416 |
$items = $xpath->query('/html/body/*/*/' . $tag);
|
417 |
}
|
418 |
// try all levels as last resort
|
419 |
if ( $items->length < $options['itemLimit'] ) {
|
420 |
$items = $xpath->query( '//' . $tag );
|
421 |
}
|
422 |
+
|
423 |
// allow to select other elements
|
424 |
$items = apply_filters( 'advanced-ads-placement-content-injection-items', $items, $xpath, $tag );
|
425 |
|
483 |
}
|
484 |
|
485 |
libxml_use_internal_errors(false);
|
486 |
+
/**
|
487 |
+
* show a warning to ad admins in the Ad Health bar in the frontend, when
|
488 |
+
*
|
489 |
+
* * the level limitation was not disabled
|
490 |
+
* * could not inject one ad (as by use of `elseif` here)
|
491 |
+
* * but there are enough elements on the site, but just in sub-containers
|
492 |
+
*
|
493 |
+
*/
|
494 |
+
} elseif( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_manage_options') )
|
495 |
+
&& empty($plugin_options['content-injection-level-disabled'] ) ) {
|
496 |
+
|
497 |
+
// check if there are more elements without limitation
|
498 |
+
$all_items = $xpath->query( '//' . $tag );
|
499 |
+
if( $paragraph_id <= $all_items->length ){
|
500 |
+
|
501 |
+
// add item to ad health
|
502 |
+
global $wp_admin_bar;
|
503 |
+
$wp_admin_bar->add_node( array(
|
504 |
+
'parent' => 'advanced_ads_ad_health',
|
505 |
+
'id' => 'advanced_ads_ad_health_the_content_not_enough_elements',
|
506 |
+
'title' => sprintf(__( 'Set <em>%s</em> to show more ads', 'advanced-ads' ), __('Disable level limitation', 'advanced-ads' ) ),
|
507 |
+
'href' => admin_url( '/admin.php?page=advanced-ads-settings#top#general' ),
|
508 |
+
'meta' => array(
|
509 |
+
'class' => 'advanced_ads_ad_health_warning',
|
510 |
+
'target' => '_blank'
|
511 |
+
)
|
512 |
+
) );
|
513 |
+
|
514 |
+
// manipulate $display_fine
|
515 |
+
add_filter( 'advanced-ads-ad-health-display-fine', '__return_false' );
|
516 |
+
}
|
517 |
}
|
518 |
|
519 |
// convert to text-representation
|
535 |
|
536 |
return $content;
|
537 |
}
|
538 |
+
|
539 |
/**
|
540 |
* check if the placement can be displayed
|
541 |
*
|
classes/frontend_checks.php
CHANGED
@@ -166,6 +166,8 @@ class Advanced_Ads_Frontend_Checks {
|
|
166 |
) );
|
167 |
$display_fine = false;
|
168 |
}
|
|
|
|
|
169 |
|
170 |
if ( $display_fine ) {
|
171 |
$wp_admin_bar->add_node( array(
|
@@ -193,7 +195,7 @@ class Advanced_Ads_Frontend_Checks {
|
|
193 |
$wp_admin_bar->add_node( array(
|
194 |
'parent' => 'advanced_ads_ad_health',
|
195 |
'id' => 'advanced_ads_ad_health_highlight_ads',
|
196 |
-
'title' => sprintf( '<label><input id="advanced_ads_highlight_ads_checkbox" type="checkbox"> %s</label>', __( 'highlight ads', 'advanced-ads' ) )
|
197 |
) );
|
198 |
}
|
199 |
|
166 |
) );
|
167 |
$display_fine = false;
|
168 |
}
|
169 |
+
|
170 |
+
$display_fine = apply_filters( 'advanced-ads-ad-health-display-fine', $display_fine );
|
171 |
|
172 |
if ( $display_fine ) {
|
173 |
$wp_admin_bar->add_node( array(
|
195 |
$wp_admin_bar->add_node( array(
|
196 |
'parent' => 'advanced_ads_ad_health',
|
197 |
'id' => 'advanced_ads_ad_health_highlight_ads',
|
198 |
+
'title' => sprintf( '<label style="color: inherit;"><input id="advanced_ads_highlight_ads_checkbox" type="checkbox"> %s</label>', __( 'highlight ads', 'advanced-ads' ) )
|
199 |
) );
|
200 |
}
|
201 |
|
classes/plugin.php
CHANGED
@@ -424,6 +424,8 @@ class Advanced_Ads_Plugin {
|
|
424 |
if($this->internal_options === array()){
|
425 |
$this->internal_options = $defaults;
|
426 |
$this->update_internal_options($this->internal_options);
|
|
|
|
|
427 |
}
|
428 |
|
429 |
// for versions installed prior to 1.5.3 set installed date for now
|
424 |
if($this->internal_options === array()){
|
425 |
$this->internal_options = $defaults;
|
426 |
$this->update_internal_options($this->internal_options);
|
427 |
+
|
428 |
+
Advanced_Ads_Plugin::get_instance()->create_capabilities();
|
429 |
}
|
430 |
|
431 |
// for versions installed prior to 1.5.3 set installed date for now
|
modules/gadsense/admin/admin.php
CHANGED
@@ -18,6 +18,7 @@ class Advanced_Ads_AdSense_Admin {
|
|
18 |
add_action( 'admin_print_scripts', array($this, 'print_scripts') );
|
19 |
add_filter( 'advanced-ads-list-ad-size', array($this, 'ad_details_column'), 10, 2 );
|
20 |
add_filter( 'advanced-ads-ad-settings-pre-save', array($this, 'sanitize_ad_settings') );
|
|
|
21 |
}
|
22 |
|
23 |
public function ad_details_column($size, $the_ad) {
|
@@ -292,5 +293,38 @@ class Advanced_Ads_AdSense_Admin {
|
|
292 |
|
293 |
return $ad_settings_post;
|
294 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
|
296 |
}
|
18 |
add_action( 'admin_print_scripts', array($this, 'print_scripts') );
|
19 |
add_filter( 'advanced-ads-list-ad-size', array($this, 'ad_details_column'), 10, 2 );
|
20 |
add_filter( 'advanced-ads-ad-settings-pre-save', array($this, 'sanitize_ad_settings') );
|
21 |
+
add_filter( 'advanced-ads-ad-notices', array($this, 'ad_notices'), 10, 3 );
|
22 |
}
|
23 |
|
24 |
public function ad_details_column($size, $the_ad) {
|
293 |
|
294 |
return $ad_settings_post;
|
295 |
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* show AdSense ad specific notices in parameters box
|
299 |
+
*
|
300 |
+
* @since 1.7.22
|
301 |
+
*/
|
302 |
+
public function ad_notices( $notices, $box, $post ){
|
303 |
+
|
304 |
+
$ad = new Advanced_Ads_Ad( $post->ID );
|
305 |
+
|
306 |
+
// $content = json_decode( stripslashes( $ad->content ) );
|
307 |
+
|
308 |
+
switch ($box['id']){
|
309 |
+
case 'ad-parameters-box' :
|
310 |
+
// add warning if this is a responsive ad unit without custom sizes and position is set to left or right
|
311 |
+
// hidden by default and made visible with JS
|
312 |
+
$notices[] = array(
|
313 |
+
'text' => sprintf(__( 'Responsive AdSense ads don’t work reliably with <em>Position</em> set to left or right. Either switch the <em>Type</em> to "normal" or follow <a href="%s" target="_blank">this tutorial</a> if you want the ad to be wrapped in text.', 'advanced-ads' ), ADVADS_URL . 'adsense-responsive-custom-sizes/#utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-custom-sizes-tutorial' ),
|
314 |
+
'class' => 'advads-ad-notice-responsive-position error hidden',
|
315 |
+
);
|
316 |
+
// show hint about Content ad, Link unit or Matched content being defined in AdSense account
|
317 |
+
if( 'adsense' === $ad->type ){
|
318 |
+
$notices[] = array(
|
319 |
+
'text' => sprintf( __( 'The type of your AdSense ad unit (content unit, link unit or matched content) needs to be defined in <a href="%s" target="_blank">your AdSense account</a>.', 'advanced-ads' ), 'https://www.google.com/adsense' ),
|
320 |
+
'class' => 'advads-ad-notice-adsense-ad-unit-type',
|
321 |
+
);
|
322 |
+
}
|
323 |
+
break;
|
324 |
+
}
|
325 |
+
|
326 |
+
|
327 |
+
return $notices;
|
328 |
+
}
|
329 |
|
330 |
}
|
modules/gadsense/admin/assets/js/new-ad.js
CHANGED
@@ -162,6 +162,14 @@
|
|
162 |
}
|
163 |
$( document ).trigger( 'gadsenseUnitChanged' );
|
164 |
window.gadsenseFormatAdContent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
advads_update_adsense_type();
|
167 |
|
162 |
}
|
163 |
$( document ).trigger( 'gadsenseUnitChanged' );
|
164 |
window.gadsenseFormatAdContent();
|
165 |
+
|
166 |
+
// show / hide position warning
|
167 |
+
var position = $( '#advanced-ad-output-position input[name="advanced_ad[output][position]"]:checked' ).val();
|
168 |
+
if ('responsive' == type && ( 'left' == position || 'right' == position ) ){
|
169 |
+
$('#ad-parameters-box-notices .advads-ad-notice-responsive-position').show();
|
170 |
+
} else {
|
171 |
+
$('#ad-parameters-box-notices .advads-ad-notice-responsive-position').hide();
|
172 |
+
}
|
173 |
}
|
174 |
advads_update_adsense_type();
|
175 |
|
modules/marketpress-license/main.php
CHANGED
@@ -104,10 +104,6 @@ if ( class_exists( 'Advanced_Ads', false ) ) {
|
|
104 |
|
105 |
foreach ( $add_ons as $key => $add_on ) {
|
106 |
|
107 |
-
if ( $key == 'laye' ) {
|
108 |
-
$key = 'layer';
|
109 |
-
}
|
110 |
-
|
111 |
update_option( $add_on[ 'options_slug' ] . '-license-status', 'valid', false );
|
112 |
update_option( $add_on[ 'options_slug' ] . '-license-expires', $expires_date , false );
|
113 |
$licenses[ $key ] = $license_key;
|
@@ -161,10 +157,6 @@ if ( class_exists( 'Advanced_Ads', false ) ) {
|
|
161 |
$add_ons = apply_filters( 'advanced-ads-add-ons', array() );
|
162 |
|
163 |
foreach ( $add_ons as $key => $add_on ) {
|
164 |
-
|
165 |
-
if ( $key == 'laye' ) {
|
166 |
-
$key = 'layer';
|
167 |
-
}
|
168 |
|
169 |
if ( $licenses[ $key] == $marketpress_key ) {
|
170 |
delete_option( $add_on[ 'options_slug' ] . '-license-status' );
|
104 |
|
105 |
foreach ( $add_ons as $key => $add_on ) {
|
106 |
|
|
|
|
|
|
|
|
|
107 |
update_option( $add_on[ 'options_slug' ] . '-license-status', 'valid', false );
|
108 |
update_option( $add_on[ 'options_slug' ] . '-license-expires', $expires_date , false );
|
109 |
$licenses[ $key ] = $license_key;
|
157 |
$add_ons = apply_filters( 'advanced-ads-add-ons', array() );
|
158 |
|
159 |
foreach ( $add_ons as $key => $add_on ) {
|
|
|
|
|
|
|
|
|
160 |
|
161 |
if ( $licenses[ $key] == $marketpress_key ) {
|
162 |
delete_option( $add_on[ 'options_slug' ] . '-license-status' );
|
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.3
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -210,6 +210,16 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
210 |
|
211 |
== Changelog ==
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
= 1.7.21 =
|
214 |
|
215 |
* fixed jumping "more terms" button in taxonomy conditions
|
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.3
|
7 |
+
Stable tag: 1.7.22
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
210 |
|
211 |
== Changelog ==
|
212 |
|
213 |
+
= 1.7.22 =
|
214 |
+
|
215 |
+
* added option to also consider elements in containers for ad content injection
|
216 |
+
* show warning in Ad Health bar when not all ads could be injected
|
217 |
+
* added logic to display ad specific warnings and possible conflicts
|
218 |
+
* added warning to disable shortcode button or ad blocker in order to use the visual editor for posts
|
219 |
+
* reapplied user capabilities to create or edit ads to make sure they are never wrong
|
220 |
+
* added warning about left and right position not working with responsive AdSense units
|
221 |
+
* edited feedback form
|
222 |
+
|
223 |
= 1.7.21 =
|
224 |
|
225 |
* fixed jumping "more terms" button in taxonomy conditions
|