Advanced Ads - Version 1.6.7.1

Version Description

  • hotfix to prevent error message on empty content injection placements
Download this release

Release Info

Developer webzunft
Plugin Icon 128x128 Advanced Ads
Version 1.6.7.1
Comparing to
See all releases

Code changes from version 1.6.7 to 1.6.7.1

Files changed (3) hide show
  1. advanced-ads.php +2 -2
  2. classes/ad_placements.php +7 -2
  3. readme.txt +5 -1
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.6.7
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
@@ -38,7 +38,7 @@ define( 'ADVADS_BASE_DIR', dirname( plugin_basename( __FILE__ ) ) ); // director
38
  // general and global slug, e.g. to store options in WP, textdomain
39
  define( 'ADVADS_SLUG', 'advanced-ads' );
40
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
41
- define( 'ADVADS_VERSION', '1.6.7' );
42
 
43
  /*----------------------------------------------------------------------------*
44
  * 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.6.7.1
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
38
  // general and global slug, e.g. to store options in WP, textdomain
39
  define( 'ADVADS_SLUG', 'advanced-ads' );
40
  define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
41
+ define( 'ADVADS_VERSION', '1.6.7.1' );
42
 
43
  /*----------------------------------------------------------------------------*
44
  * Autoloading, modules and functions
classes/ad_placements.php CHANGED
@@ -284,6 +284,13 @@ class Advanced_Ads_Placements {
284
  * @link inspired by http://www.wpbeginner.com/wp-tutorials/how-to-insert-ads-within-your-post-content-in-wordpress/
285
  */
286
  public static function &inject_in_content($placement_id, $options, &$content) {
 
 
 
 
 
 
 
287
  // parse document as DOM (fragment - having only a part of an actual post given)
288
  // -TODO may want to verify the wpcharset is supported by server (mb_list_encodings)
289
  // -TODO mb extension might not be available for really old hosts
@@ -318,7 +325,6 @@ class Advanced_Ads_Placements {
318
 
319
  // filter empty tags from items
320
  $paragraphs = array();
321
- $whitespaces = json_decode('"\t\n\r \u00A0"');
322
  foreach ($items as $item) {
323
  if ( isset($item->textContent) && trim($item->textContent, $whitespaces) !== '' ) {
324
  $paragraphs[] = $item;
@@ -328,7 +334,6 @@ class Advanced_Ads_Placements {
328
  $paragraph_count = count($paragraphs);
329
  if ($paragraph_count >= $paragraph_id) {
330
  $offset = $paragraph_select_from_bottom ? $paragraph_count - $paragraph_id : $paragraph_id - 1;
331
- $adContent = Advanced_Ads_Select::get_instance()->get_ad_by_method( $placement_id, 'placement', $options );
332
 
333
  // convert HTML to XML!
334
  $adDom = new DOMDocument('1.0', $wpCharset);
284
  * @link inspired by http://www.wpbeginner.com/wp-tutorials/how-to-insert-ads-within-your-post-content-in-wordpress/
285
  */
286
  public static function &inject_in_content($placement_id, $options, &$content) {
287
+ // test ad is emtpy
288
+ $whitespaces = json_decode('"\t\n\r \u00A0"');
289
+ $adContent = Advanced_Ads_Select::get_instance()->get_ad_by_method( $placement_id, 'placement', $options );
290
+ if ( trim( $adContent, $whitespaces ) === '' ) {
291
+ return $content;
292
+ }
293
+
294
  // parse document as DOM (fragment - having only a part of an actual post given)
295
  // -TODO may want to verify the wpcharset is supported by server (mb_list_encodings)
296
  // -TODO mb extension might not be available for really old hosts
325
 
326
  // filter empty tags from items
327
  $paragraphs = array();
 
328
  foreach ($items as $item) {
329
  if ( isset($item->textContent) && trim($item->textContent, $whitespaces) !== '' ) {
330
  $paragraphs[] = $item;
334
  $paragraph_count = count($paragraphs);
335
  if ($paragraph_count >= $paragraph_id) {
336
  $offset = $paragraph_select_from_bottom ? $paragraph_count - $paragraph_id : $paragraph_id - 1;
 
337
 
338
  // convert HTML to XML!
339
  $adDom = new DOMDocument('1.0', $wpCharset);
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, adsense, display, banner, advertisements, adverts, advert, monetization
5
  Requires at least: WP 3.5, PHP 5.3
6
  Tested up to: 4.2.3
7
- Stable tag: 1.6.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -182,6 +182,10 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
182
 
183
  == Changelog ==
184
 
 
 
 
 
185
  = 1.6.7 =
186
 
187
  *features*
4
  Tags: ads, ad, adsense, display, banner, advertisements, adverts, advert, monetization
5
  Requires at least: WP 3.5, PHP 5.3
6
  Tested up to: 4.2.3
7
+ Stable tag: 1.6.7.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
182
 
183
  == Changelog ==
184
 
185
+ = 1.6.7.1 =
186
+
187
+ * hotfix to prevent error message on empty content injection placements
188
+
189
  = 1.6.7 =
190
 
191
  *features*