Version Description
- search for title or id instead of content when selecting a Specific Page Display Condition
- fixed double display conditions
- fixes notices appearing once after update
- fixed display condition error warning
- fixed content injection breaking when unescaped
</script>
was used withindocument.write
- added taxonomies created by Custom Post Type UI plugin to the display conditions
- add content placement for paragraphs without images
Download this release
Release Info
Developer | webzunft |
Plugin | Advanced Ads |
Version | 1.7.1.4 |
Comparing to | |
See all releases |
Code changes from version 1.7.1.3 to 1.7.1.4
- admin/assets/js/admin.js +12 -13
- admin/class-advanced-ads-admin.php +2 -1
- admin/views/ad-display-metabox.php +1 -1
- advanced-ads.php +2 -2
- classes/ad_ajax_callbacks.php +17 -0
- classes/ad_placements.php +13 -1
- classes/display-conditions.php +59 -6
- classes/upgrades.php +2 -2
- languages/advanced-ads-de_DE.po +2 -2
- languages/advanced-ads-es_ES.po +1 -1
- languages/advanced-ads-fr_FR.po +2 -2
- languages/advanced-ads-it_IT.po +1 -1
- languages/advanced-ads-nl_NL.po +1 -1
- public/class-advanced-ads.php +1 -1
- readme.txt +13 -3
admin/assets/js/admin.js
CHANGED
@@ -74,7 +74,7 @@ jQuery( document ).ready(function ($) {
|
|
74 |
$( '<label class="button ui-state-active">' + ui.item.label + '<input type="hidden" name="' + self.data('inputName') + '" value="' + ui.item.value + '"></label>' ).appendTo( self.siblings( '.advads-conditions-terms-buttons' ) );
|
75 |
|
76 |
// show / hide other elements
|
77 |
-
// $( '
|
78 |
// $( '.advads-conditions-postids-list .show-search a' ).show();
|
79 |
},
|
80 |
close: function( event, ui ) {
|
@@ -86,12 +86,12 @@ jQuery( document ).ready(function ($) {
|
|
86 |
$( document ).on( 'click', '.advads-conditions-postids-show-search', function (e) {
|
87 |
e.preventDefault();
|
88 |
// display input field
|
89 |
-
$( '
|
90 |
-
|
91 |
$( this ).hide();
|
92 |
});
|
93 |
// register autocomplete to display condition individual posts
|
94 |
-
$(document).on("focus","
|
95 |
var self = this;
|
96 |
if ( !$(this).data("autocomplete") ) { // If the autocomplete wasn't called yet:
|
97 |
$( this ).autocomplete({
|
@@ -104,16 +104,16 @@ jQuery( document ).ready(function ($) {
|
|
104 |
// append new line with input fields
|
105 |
var newline = $( '<label class="button ui-state-active">' + ui.item.label + '</label>' );
|
106 |
$( '<input type="hidden" name="' + self.dataset.fieldName + '[value][]" value="' + ui.item.value + '"/>' ).appendTo( newline );
|
107 |
-
newline.insertBefore( $( '.advads-conditions-postids-search-line' ) );
|
108 |
},
|
109 |
close: function( event, ui ) {
|
110 |
-
$(
|
111 |
},
|
112 |
})
|
113 |
.autocomplete().data("ui-autocomplete")._renderItem = function( ul, item ) {
|
114 |
ul.addClass( "advads-conditions-postids-autocomplete-suggestions" );
|
115 |
return $( "<li></li>" )
|
116 |
-
.append( "<span class='left'>" + item.label + "</span
|
117 |
.appendTo( ul );
|
118 |
};
|
119 |
};
|
@@ -459,20 +459,19 @@ function advads_term_search(field, callback) {
|
|
459 |
/**
|
460 |
* callback for post search autocomplete
|
461 |
*
|
462 |
-
* @param {
|
463 |
* @param {type} callback
|
464 |
* @returns {obj} json object with labels and values
|
465 |
*/
|
466 |
-
function advads_post_search(
|
467 |
|
468 |
// return ['post', 'poster'];
|
469 |
var query = {
|
470 |
-
action: '
|
471 |
-
_ajax_linking_nonce: jQuery( '#_ajax_linking_nonce' ).val()
|
|
|
472 |
};
|
473 |
|
474 |
-
query.search = jQuery( '#advads-display-conditions-individual-post' ).val();
|
475 |
-
|
476 |
var querying = true;
|
477 |
|
478 |
var results = {};
|
74 |
$( '<label class="button ui-state-active">' + ui.item.label + '<input type="hidden" name="' + self.data('inputName') + '" value="' + ui.item.value + '"></label>' ).appendTo( self.siblings( '.advads-conditions-terms-buttons' ) );
|
75 |
|
76 |
// show / hide other elements
|
77 |
+
// $( '.advads-display-conditions-individual-post' ).hide();
|
78 |
// $( '.advads-conditions-postids-list .show-search a' ).show();
|
79 |
},
|
80 |
close: function( event, ui ) {
|
86 |
$( document ).on( 'click', '.advads-conditions-postids-show-search', function (e) {
|
87 |
e.preventDefault();
|
88 |
// display input field
|
89 |
+
$( this).next().find( '.advads-display-conditions-individual-post' ).show();
|
90 |
+
//$( '.advads-conditions-postids-search-line .description' ).hide();
|
91 |
$( this ).hide();
|
92 |
});
|
93 |
// register autocomplete to display condition individual posts
|
94 |
+
$( document ).on( "focus", ".advads-display-conditions-individual-post", function(e) {
|
95 |
var self = this;
|
96 |
if ( !$(this).data("autocomplete") ) { // If the autocomplete wasn't called yet:
|
97 |
$( this ).autocomplete({
|
104 |
// append new line with input fields
|
105 |
var newline = $( '<label class="button ui-state-active">' + ui.item.label + '</label>' );
|
106 |
$( '<input type="hidden" name="' + self.dataset.fieldName + '[value][]" value="' + ui.item.value + '"/>' ).appendTo( newline );
|
107 |
+
newline.insertBefore( $( self ).parent( '.advads-conditions-postids-search-line' ) );
|
108 |
},
|
109 |
close: function( event, ui ) {
|
110 |
+
$( self ).val( '' );
|
111 |
},
|
112 |
})
|
113 |
.autocomplete().data("ui-autocomplete")._renderItem = function( ul, item ) {
|
114 |
ul.addClass( "advads-conditions-postids-autocomplete-suggestions" );
|
115 |
return $( "<li></li>" )
|
116 |
+
.append( "<span class='left'>" + item.label + "</span> <span class='right'>" + item.info + "</span>" )
|
117 |
.appendTo( ul );
|
118 |
};
|
119 |
};
|
459 |
/**
|
460 |
* callback for post search autocomplete
|
461 |
*
|
462 |
+
* @param {str} searchParam
|
463 |
* @param {type} callback
|
464 |
* @returns {obj} json object with labels and values
|
465 |
*/
|
466 |
+
function advads_post_search( searchParam, callback ) {
|
467 |
|
468 |
// return ['post', 'poster'];
|
469 |
var query = {
|
470 |
+
action: 'advads-post-search',
|
471 |
+
_ajax_linking_nonce: jQuery( '#_ajax_linking_nonce' ).val(),
|
472 |
+
'search': searchParam
|
473 |
};
|
474 |
|
|
|
|
|
475 |
var querying = true;
|
476 |
|
477 |
var results = {};
|
admin/class-advanced-ads-admin.php
CHANGED
@@ -1694,7 +1694,8 @@ class Advanced_Ads_Admin {
|
|
1694 |
}
|
1695 |
|
1696 |
if( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
|
1697 |
-
$this->notices = Advanced_Ads_Admin_Notices::get_instance();
|
|
|
1698 |
}
|
1699 |
}
|
1700 |
|
1694 |
}
|
1695 |
|
1696 |
if( current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
|
1697 |
+
$this->notices = Advanced_Ads_Admin_Notices::get_instance()->notices;
|
1698 |
+
Advanced_Ads_Admin_Notices::get_instance()->display_notices();
|
1699 |
}
|
1700 |
}
|
1701 |
|
admin/views/ad-display-metabox.php
CHANGED
@@ -20,7 +20,7 @@ $options = $ad->options('conditions');
|
|
20 |
// get type attribute from previous option format
|
21 |
$_options['type'] = isset($_options['type']) ? $_options['type'] : $_index;
|
22 |
$connector = ( ! isset($_options['connector'] ) || 'or' !== $_options['connector'] ) ? 'and' : 'or';
|
23 |
-
if (isset($display_conditions[$_options['type']]['metabox'])) {
|
24 |
$metabox = $display_conditions[$_options['type']]['metabox'];
|
25 |
} else {
|
26 |
continue;
|
20 |
// get type attribute from previous option format
|
21 |
$_options['type'] = isset($_options['type']) ? $_options['type'] : $_index;
|
22 |
$connector = ( ! isset($_options['connector'] ) || 'or' !== $_options['connector'] ) ? 'and' : 'or';
|
23 |
+
if (isset($_options['type']) && isset($display_conditions[$_options['type']]['metabox'])) {
|
24 |
$metabox = $display_conditions[$_options['type']]['metabox'];
|
25 |
} else {
|
26 |
continue;
|
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.1.
|
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.1.
|
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.1.4
|
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.1.4' );
|
43 |
|
44 |
/*----------------------------------------------------------------------------*
|
45 |
* Autoloading, modules and functions
|
classes/ad_ajax_callbacks.php
CHANGED
@@ -31,6 +31,7 @@ class Advanced_Ads_Ad_Ajax_Callbacks {
|
|
31 |
add_action( 'wp_ajax_advads-activate-license', array( $this, 'activate_license' ) );
|
32 |
add_action( 'wp_ajax_advads-deactivate-license', array( $this, 'deactivate_license' ) );
|
33 |
add_action( 'wp_ajax_advads-adblock-rebuild-assets', array( $this, 'adblock_rebuild_assets' ) );
|
|
|
34 |
|
35 |
}
|
36 |
|
@@ -235,4 +236,20 @@ class Advanced_Ads_Ad_Ajax_Callbacks {
|
|
235 |
exit();
|
236 |
}
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
}
|
31 |
add_action( 'wp_ajax_advads-activate-license', array( $this, 'activate_license' ) );
|
32 |
add_action( 'wp_ajax_advads-deactivate-license', array( $this, 'deactivate_license' ) );
|
33 |
add_action( 'wp_ajax_advads-adblock-rebuild-assets', array( $this, 'adblock_rebuild_assets' ) );
|
34 |
+
add_action( 'wp_ajax_advads-post-search', array( $this, 'post_search' ) );
|
35 |
|
36 |
}
|
37 |
|
236 |
exit();
|
237 |
}
|
238 |
|
239 |
+
/**
|
240 |
+
* post search (used in Display conditions)
|
241 |
+
*
|
242 |
+
*/
|
243 |
+
public function post_search(){
|
244 |
+
if ( ! current_user_can( Advanced_Ads_Plugin::user_cap( 'advanced_ads_edit_ads') ) ) {
|
245 |
+
return;
|
246 |
+
}
|
247 |
+
|
248 |
+
add_filter( 'wp_link_query_args', array( 'Advanced_Ads_Display_Conditions', 'modify_post_search' ) );
|
249 |
+
add_filter( 'posts_search', array( 'Advanced_Ads_Display_Conditions', 'modify_post_search_sql' ) );
|
250 |
+
|
251 |
+
wp_ajax_wp_link_ajax();
|
252 |
+
|
253 |
+
}
|
254 |
+
|
255 |
}
|
classes/ad_placements.php
CHANGED
@@ -202,6 +202,7 @@ class Advanced_Ads_Placements {
|
|
202 |
public static function tags_for_content_injection(){
|
203 |
$tags = apply_filters( 'advanced-ads-tags-for-injection', array(
|
204 |
'p' => sprintf( __( 'paragraph (%s)', 'advanced-ads' ), '<p>' ),
|
|
|
205 |
'h2' => sprintf( __( 'headline 2 (%s)', 'advanced-ads' ), '<h2>' ),
|
206 |
'h3' => sprintf( __( 'headline 3 (%s)', 'advanced-ads' ), '<h3>' ),
|
207 |
'h4' => sprintf( __( 'headline 4 (%s)', 'advanced-ads' ), '<h4>' ),
|
@@ -313,7 +314,7 @@ class Advanced_Ads_Placements {
|
|
313 |
if ( trim( $adContent, $whitespaces ) === '' ) {
|
314 |
return $content;
|
315 |
}
|
316 |
-
|
317 |
// parse document as DOM (fragment - having only a part of an actual post given)
|
318 |
// -TODO may want to verify the wpcharset is supported by server (mb_list_encodings)
|
319 |
// prevent messages from dom parser
|
@@ -352,6 +353,10 @@ class Advanced_Ads_Placements {
|
|
352 |
// allow more complex xPath expression
|
353 |
$tag = apply_filters( 'advanced-ads-placement-content-injection-xpath', $tag, $options );
|
354 |
|
|
|
|
|
|
|
|
|
355 |
// only has before and after
|
356 |
$before = isset($options['position']) && $options['position'] === 'before';
|
357 |
$paragraph_id = isset($options['index']) ? $options['index'] : 1;
|
@@ -405,7 +410,14 @@ class Advanced_Ads_Placements {
|
|
405 |
// convert HTML to XML!
|
406 |
$adDom = new DOMDocument('1.0', $wpCharset);
|
407 |
libxml_use_internal_errors(true);
|
|
|
|
|
|
|
408 |
$adDom->loadHtml('<!DOCTYPE html><html><meta http-equiv="Content-Type" content="text/html; charset=' . $wpCharset . '" /><body>' . $adContent);
|
|
|
|
|
|
|
|
|
409 |
$adNode = $adDom->lastChild->lastChild; // >html>body
|
410 |
libxml_use_internal_errors(false);
|
411 |
$adContent = $adDom->saveXML($adNode);
|
202 |
public static function tags_for_content_injection(){
|
203 |
$tags = apply_filters( 'advanced-ads-tags-for-injection', array(
|
204 |
'p' => sprintf( __( 'paragraph (%s)', 'advanced-ads' ), '<p>' ),
|
205 |
+
'pwithoutimg' => sprintf( __( 'paragraph without image (%s)', 'advanced-ads' ), '<p>' ),
|
206 |
'h2' => sprintf( __( 'headline 2 (%s)', 'advanced-ads' ), '<h2>' ),
|
207 |
'h3' => sprintf( __( 'headline 3 (%s)', 'advanced-ads' ), '<h3>' ),
|
208 |
'h4' => sprintf( __( 'headline 4 (%s)', 'advanced-ads' ), '<h4>' ),
|
314 |
if ( trim( $adContent, $whitespaces ) === '' ) {
|
315 |
return $content;
|
316 |
}
|
317 |
+
|
318 |
// parse document as DOM (fragment - having only a part of an actual post given)
|
319 |
// -TODO may want to verify the wpcharset is supported by server (mb_list_encodings)
|
320 |
// prevent messages from dom parser
|
353 |
// allow more complex xPath expression
|
354 |
$tag = apply_filters( 'advanced-ads-placement-content-injection-xpath', $tag, $options );
|
355 |
|
356 |
+
if ( $tag === 'pwithoutimg' ) {
|
357 |
+
$tag = 'p[not(descendant::img)]';
|
358 |
+
}
|
359 |
+
|
360 |
// only has before and after
|
361 |
$before = isset($options['position']) && $options['position'] === 'before';
|
362 |
$paragraph_id = isset($options['index']) ? $options['index'] : 1;
|
410 |
// convert HTML to XML!
|
411 |
$adDom = new DOMDocument('1.0', $wpCharset);
|
412 |
libxml_use_internal_errors(true);
|
413 |
+
// replace `</sc` in ad content when placed within `document.write()` to prevent code from breaking
|
414 |
+
// source for this regex: http://stackoverflow.com/questions/17852537/preg-replace-only-specific-part-of-string
|
415 |
+
$adContent = preg_replace('#(document.write[^<^)]+)</sc(.*)#', '$1<\/sc$2', $adContent);
|
416 |
$adDom->loadHtml('<!DOCTYPE html><html><meta http-equiv="Content-Type" content="text/html; charset=' . $wpCharset . '" /><body>' . $adContent);
|
417 |
+
// log errors
|
418 |
+
if( libxml_get_last_error() instanceof LibXMLError ){
|
419 |
+
Advanced_Ads::log( 'content injection error: ' . print_r( libxml_get_last_error(), true ) );
|
420 |
+
}
|
421 |
$adNode = $adDom->lastChild->lastChild; // >html>body
|
422 |
libxml_use_internal_errors(false);
|
423 |
$adContent = $adDom->saveXML($adNode);
|
classes/display-conditions.php
CHANGED
@@ -54,7 +54,16 @@ class Advanced_Ads_Display_Conditions {
|
|
54 |
add_filter('advanced-ads-ad-select-args', array($this, 'ad_select_args_callback'));
|
55 |
add_filter('advanced-ads-can-display', array($this, 'can_display'), 10, 2);
|
56 |
|
57 |
-
// register conditions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
$conditions = array(
|
59 |
'posttypes' => array(// post types condition
|
60 |
'label' => __('post type', 'advanced-ads'),
|
@@ -84,7 +93,7 @@ class Advanced_Ads_Display_Conditions {
|
|
84 |
);
|
85 |
|
86 |
// register a condition for each taxonomy for posts
|
87 |
-
$taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true), 'objects', 'or');
|
88 |
foreach ($taxonomies as $_tax) :
|
89 |
// check if there are any terms available
|
90 |
$terms = get_terms($_tax->name, array('hide_empty' => false, 'number' => 1));
|
@@ -137,7 +146,7 @@ class Advanced_Ads_Display_Conditions {
|
|
137 |
static function frontend_check($options = array(), $ad = false) {
|
138 |
$display_conditions = Advanced_Ads_Display_Conditions::get_instance()->conditions;
|
139 |
|
140 |
-
if (is_array($options) && isset($display_conditions[$options['type']]['check'])) {
|
141 |
$check = $display_conditions[$options['type']]['check'];
|
142 |
} else {
|
143 |
return true;
|
@@ -385,10 +394,10 @@ class Advanced_Ads_Display_Conditions {
|
|
385 |
}
|
386 |
?>>+</span>
|
387 |
<p class="advads-conditions-postids-search-line">
|
388 |
-
<input type="text"
|
389 |
echo 'style="display:none;"';
|
390 |
} ?>
|
391 |
-
placeholder="<?php _e('
|
392 |
data-field-name="<?php echo $name; ?>"/><?php
|
393 |
wp_nonce_field('internal-linking', '_ajax_linking_nonce', false);
|
394 |
?></p></div><?php
|
@@ -417,7 +426,7 @@ class Advanced_Ads_Display_Conditions {
|
|
417 |
// activate by default
|
418 |
$value = ( $values === array() || in_array($_key, $values) ) ? 1 : 0;
|
419 |
|
420 |
-
$field_id = "advads-conditions-$_key";
|
421 |
?><input type="checkbox" id="<?php echo $field_id; ?>" name="<?php echo $name; ?>[value][]" value="<?php echo $_key; ?>" <?php checked(1, $value); ?>><label for="<?php echo $field_id; ?>"><?php echo $_condition['label']; ?></label><?php
|
422 |
endforeach;
|
423 |
?></div><?php
|
@@ -853,5 +862,49 @@ class Advanced_Ads_Display_Conditions {
|
|
853 |
return $args;
|
854 |
}
|
855 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
856 |
}
|
857 |
|
54 |
add_filter('advanced-ads-ad-select-args', array($this, 'ad_select_args_callback'));
|
55 |
add_filter('advanced-ads-can-display', array($this, 'can_display'), 10, 2);
|
56 |
|
57 |
+
// register conditions with init hook
|
58 |
+
add_action( 'init', array($this, 'register_conditions'), 10 );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* register display conditions
|
63 |
+
*
|
64 |
+
* @since 1.7.1.4
|
65 |
+
*/
|
66 |
+
public function register_conditions(){
|
67 |
$conditions = array(
|
68 |
'posttypes' => array(// post types condition
|
69 |
'label' => __('post type', 'advanced-ads'),
|
93 |
);
|
94 |
|
95 |
// register a condition for each taxonomy for posts
|
96 |
+
$taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true), 'objects', 'or');
|
97 |
foreach ($taxonomies as $_tax) :
|
98 |
// check if there are any terms available
|
99 |
$terms = get_terms($_tax->name, array('hide_empty' => false, 'number' => 1));
|
146 |
static function frontend_check($options = array(), $ad = false) {
|
147 |
$display_conditions = Advanced_Ads_Display_Conditions::get_instance()->conditions;
|
148 |
|
149 |
+
if (is_array($options) && isset( $options['type'] ) && isset($display_conditions[$options['type']]['check'])) {
|
150 |
$check = $display_conditions[$options['type']]['check'];
|
151 |
} else {
|
152 |
return true;
|
394 |
}
|
395 |
?>>+</span>
|
396 |
<p class="advads-conditions-postids-search-line">
|
397 |
+
<input type="text" class="advads-display-conditions-individual-post" <?php if (count($values)) {
|
398 |
echo 'style="display:none;"';
|
399 |
} ?>
|
400 |
+
placeholder="<?php _e('title or id', 'advanced-ads'); ?>"
|
401 |
data-field-name="<?php echo $name; ?>"/><?php
|
402 |
wp_nonce_field('internal-linking', '_ajax_linking_nonce', false);
|
403 |
?></p></div><?php
|
426 |
// activate by default
|
427 |
$value = ( $values === array() || in_array($_key, $values) ) ? 1 : 0;
|
428 |
|
429 |
+
$field_id = "advads-conditions-$index-$_key";
|
430 |
?><input type="checkbox" id="<?php echo $field_id; ?>" name="<?php echo $name; ?>[value][]" value="<?php echo $_key; ?>" <?php checked(1, $value); ?>><label for="<?php echo $field_id; ?>"><?php echo $_condition['label']; ?></label><?php
|
431 |
endforeach;
|
432 |
?></div><?php
|
862 |
return $args;
|
863 |
}
|
864 |
|
865 |
+
/**
|
866 |
+
* modify post search query to search by post_title or ID
|
867 |
+
*
|
868 |
+
* @param array $query
|
869 |
+
* @return string
|
870 |
+
*/
|
871 |
+
public static function modify_post_search( $query ) {
|
872 |
+
$query['suppress_filters'] = false;
|
873 |
+
$query['orderby'] = 'post_title';
|
874 |
+
return $query;
|
875 |
+
}
|
876 |
+
|
877 |
+
/**
|
878 |
+
* modify post search sql to search by post_title or ID
|
879 |
+
*
|
880 |
+
* @param string $sql
|
881 |
+
* @return string
|
882 |
+
*/
|
883 |
+
public static function modify_post_search_sql( $sql ) {
|
884 |
+
global $wpdb;
|
885 |
+
|
886 |
+
$sql = preg_replace_callback( "/{$wpdb->posts}.post_(content|excerpt)( NOT)? LIKE '%(.*?)%'/", array( 'Advanced_Ads_Display_Conditions', 'modify_post_search_sql_callback' ), $sql );
|
887 |
+
|
888 |
+
return $sql;
|
889 |
+
}
|
890 |
+
|
891 |
+
/**
|
892 |
+
* preg_replace callback used in modify_post_search_sql()
|
893 |
+
*
|
894 |
+
* @param array $matches
|
895 |
+
* @return string
|
896 |
+
*/
|
897 |
+
public static function modify_post_search_sql_callback( $matches ) {
|
898 |
+
global $wpdb;
|
899 |
+
if ( $matches[1] === 'content' && preg_match( '@^([0-9]+)$@', $matches[3], $matches_id ) ) {
|
900 |
+
$equals_op = $matches[2] === ' NOT' ? '!=' : '=';
|
901 |
+
return "{$wpdb->posts}.ID$equals_op$matches_id[1]";
|
902 |
+
} else if ( $matches[2] === ' NOT' ) {
|
903 |
+
return '1=1';
|
904 |
+
} else {
|
905 |
+
return '1=0';
|
906 |
+
}
|
907 |
+
}
|
908 |
+
|
909 |
}
|
910 |
|
classes/upgrades.php
CHANGED
@@ -22,9 +22,9 @@ class Advanced_Ads_Upgrades {
|
|
22 |
// run with wp_loaded action, because WP_Query is needed and some plugins inject data that is not yet initialized
|
23 |
add_action( 'wp_loaded', array( $this, 'upgrade_1_7') );
|
24 |
}
|
25 |
-
|
26 |
// update version notices – if this doesn’t happen here, the upgrade might run multiple times and destroy updated data
|
27 |
-
Advanced_Ads_Admin_Notices::get_instance()->
|
28 |
}
|
29 |
|
30 |
/**
|
22 |
// run with wp_loaded action, because WP_Query is needed and some plugins inject data that is not yet initialized
|
23 |
add_action( 'wp_loaded', array( $this, 'upgrade_1_7') );
|
24 |
}
|
25 |
+
|
26 |
// update version notices – if this doesn’t happen here, the upgrade might run multiple times and destroy updated data
|
27 |
+
Advanced_Ads_Admin_Notices::get_instance()->update_version_number();
|
28 |
}
|
29 |
|
30 |
/**
|
languages/advanced-ads-de_DE.po
CHANGED
@@ -2352,8 +2352,8 @@ msgid "term name or id"
|
|
2352 |
msgstr "Name oder ID"
|
2353 |
|
2354 |
#: ../classes/display-conditions.php:389
|
2355 |
-
msgid "
|
2356 |
-
msgstr "Titel
|
2357 |
|
2358 |
#: ../classes/display-conditions.php:434 ../includes/array_ad_conditions.php:63
|
2359 |
msgid "Home Page"
|
2352 |
msgstr "Name oder ID"
|
2353 |
|
2354 |
#: ../classes/display-conditions.php:389
|
2355 |
+
msgid "title or id"
|
2356 |
+
msgstr "Titel oder ID"
|
2357 |
|
2358 |
#: ../classes/display-conditions.php:434 ../includes/array_ad_conditions.php:63
|
2359 |
msgid "Home Page"
|
languages/advanced-ads-es_ES.po
CHANGED
@@ -230,7 +230,7 @@ msgid "hide"
|
|
230 |
msgstr ""
|
231 |
|
232 |
#: ../classes/display-conditions.php:391
|
233 |
-
msgid "
|
234 |
msgstr ""
|
235 |
|
236 |
#: ../classes/display-conditions.php:471
|
230 |
msgstr ""
|
231 |
|
232 |
#: ../classes/display-conditions.php:391
|
233 |
+
msgid "title or id"
|
234 |
msgstr ""
|
235 |
|
236 |
#: ../classes/display-conditions.php:471
|
languages/advanced-ads-fr_FR.po
CHANGED
@@ -2382,8 +2382,8 @@ msgid "term name or id"
|
|
2382 |
msgstr "nom du terme ou id"
|
2383 |
|
2384 |
#: ../classes/display-conditions.php:373
|
2385 |
-
msgid "
|
2386 |
-
msgstr "Titre
|
2387 |
|
2388 |
#: ../classes/display-conditions.php:418 ../includes/array_ad_conditions.php:63
|
2389 |
msgid "Home Page"
|
2382 |
msgstr "nom du terme ou id"
|
2383 |
|
2384 |
#: ../classes/display-conditions.php:373
|
2385 |
+
msgid "title or id"
|
2386 |
+
msgstr "Titre ou id"
|
2387 |
|
2388 |
#: ../classes/display-conditions.php:418 ../includes/array_ad_conditions.php:63
|
2389 |
msgid "Home Page"
|
languages/advanced-ads-it_IT.po
CHANGED
@@ -1697,7 +1697,7 @@ msgid "term name or id"
|
|
1697 |
msgstr ""
|
1698 |
|
1699 |
#: ../classes/display-conditions.php:391
|
1700 |
-
msgid "
|
1701 |
msgstr ""
|
1702 |
|
1703 |
#: ../classes/display-conditions.php:437 ../includes/array_ad_conditions.php:64
|
1697 |
msgstr ""
|
1698 |
|
1699 |
#: ../classes/display-conditions.php:391
|
1700 |
+
msgid "title or id"
|
1701 |
msgstr ""
|
1702 |
|
1703 |
#: ../classes/display-conditions.php:437 ../includes/array_ad_conditions.php:64
|
languages/advanced-ads-nl_NL.po
CHANGED
@@ -540,7 +540,7 @@ msgid "hide"
|
|
540 |
msgstr ""
|
541 |
|
542 |
#: ../classes/display-conditions.php:391
|
543 |
-
msgid "
|
544 |
msgstr ""
|
545 |
|
546 |
#: ../classes/display-conditions.php:471
|
540 |
msgstr ""
|
541 |
|
542 |
#: ../classes/display-conditions.php:391
|
543 |
+
msgid "title or id"
|
544 |
msgstr ""
|
545 |
|
546 |
#: ../classes/display-conditions.php:471
|
public/class-advanced-ads.php
CHANGED
@@ -374,7 +374,7 @@ class Advanced_Ads {
|
|
374 |
if ( get_post_type() == self::POST_TYPE_SLUG ){
|
375 |
return $content;
|
376 |
}
|
377 |
-
|
378 |
// check if admin allows injection in all places
|
379 |
if( ! isset( $options['content-injection-everywhere'] ) ){
|
380 |
// check if this is a singular page within the loop
|
374 |
if ( get_post_type() == self::POST_TYPE_SLUG ){
|
375 |
return $content;
|
376 |
}
|
377 |
+
|
378 |
// check if admin allows injection in all places
|
379 |
if( ! isset( $options['content-injection-everywhere'] ) ){
|
380 |
// check if this is a singular page within the loop
|
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.5
|
7 |
-
Stable tag: 1.7.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -39,7 +39,7 @@ choose between different ad types that enable you to:
|
|
39 |
|
40 |
* auto inject banner (see _ad injection_ below)
|
41 |
* display advertising in template files (with functions)
|
42 |
-
* display advertising in post content (with
|
43 |
* ad widget for sidebars and widget areas
|
44 |
* display ad groups based on customizable ad weight
|
45 |
* use placements in your theme to insert ads and ad groups in template files without coding
|
@@ -124,7 +124,7 @@ You can also use it to insert additional ad network tags into header or footer o
|
|
124 |
|
125 |
Learn more on the [plugin homepage](https://wpadvancedads.com).
|
126 |
|
127 |
-
Localizations: English, German, Spanish, Dutch, Italian, Portuguese
|
128 |
|
129 |
> <strong>Add-Ons</strong>
|
130 |
>
|
@@ -198,6 +198,16 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
|
|
198 |
|
199 |
== Changelog ==
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
= 1.7.1.3 =
|
202 |
|
203 |
* fixed error when $wp_query is not set
|
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.5
|
7 |
+
Stable tag: 1.7.1.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
39 |
|
40 |
* auto inject banner (see _ad injection_ below)
|
41 |
* display advertising in template files (with functions)
|
42 |
+
* display advertising in post content (with shortcodes)
|
43 |
* ad widget for sidebars and widget areas
|
44 |
* display ad groups based on customizable ad weight
|
45 |
* use placements in your theme to insert ads and ad groups in template files without coding
|
124 |
|
125 |
Learn more on the [plugin homepage](https://wpadvancedads.com).
|
126 |
|
127 |
+
Localizations: English, German, French, Spanish, Dutch, Italian, Portuguese
|
128 |
|
129 |
> <strong>Add-Ons</strong>
|
130 |
>
|
198 |
|
199 |
== Changelog ==
|
200 |
|
201 |
+
= 1.7.1.4 =
|
202 |
+
|
203 |
+
* search for title or id instead of content when selecting a Specific Page Display Condition
|
204 |
+
* fixed double display conditions
|
205 |
+
* fixes notices appearing once after update
|
206 |
+
* fixed display condition error warning
|
207 |
+
* fixed content injection breaking when unescaped `</script>` was used within `document.write`
|
208 |
+
* added taxonomies created by Custom Post Type UI plugin to the display conditions
|
209 |
+
* add content placement for paragraphs without images
|
210 |
+
|
211 |
= 1.7.1.3 =
|
212 |
|
213 |
* fixed error when $wp_query is not set
|