Advanced Ads - Version 1.3.2

Version Description

  • hotfix: prevent infinite loops (ads within ads) for rich content ads
Download this release

Release Info

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

Code changes from version 1.3.1 to 1.3.2

advanced-ads.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: http://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
- * Version: 1.3.1
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
12
  * Plugin Name: Advanced Ads
13
  * Plugin URI: http://wpadvancedads.com
14
  * Description: Manage and optimize your ads in WordPress
15
+ * Version: 1.3.2
16
  * Author: Thomas Maier
17
  * Author URI: http://webgilde.com
18
  * Text Domain: advanced-ads
classes/ad.php CHANGED
@@ -131,6 +131,7 @@ class Advads_Ad {
131
  }
132
 
133
  $this->type = $this->options('type');
 
134
  /* load ad type object */
135
  $types = Advanced_Ads::get_instance()->ad_types;
136
  if(isset($types[$this->type])){
@@ -214,6 +215,11 @@ class Advads_Ad {
214
  if(!$this->is_ad) return '';
215
 
216
  $output = $this->prepare_frontend_output();
 
 
 
 
 
217
  return $output;
218
  }
219
 
131
  }
132
 
133
  $this->type = $this->options('type');
134
+ $this->title = $_data->post_title;
135
  /* load ad type object */
136
  $types = Advanced_Ads::get_instance()->ad_types;
137
  if(isset($types[$this->type])){
215
  if(!$this->is_ad) return '';
216
 
217
  $output = $this->prepare_frontend_output();
218
+
219
+ // add the ad to the global output array
220
+ $advads = Advanced_Ads::get_instance();
221
+ $advads->current_ads[] = array('type' => 'ad', 'id' => $this->id, 'title' => $this->title);
222
+
223
  return $output;
224
  }
225
 
classes/ad_group.php CHANGED
@@ -115,6 +115,10 @@ class Advads_Ad_Group {
115
  if (!is_object($ad))
116
  return '';
117
 
 
 
 
 
118
  // makes sure the ad filters can also run here
119
  $adcontent = $ad->output();
120
 
115
  if (!is_object($ad))
116
  return '';
117
 
118
+ // add the group to the global output array
119
+ $advads = Advanced_Ads::get_instance();
120
+ $advads->current_ads[] = array('type' => 'group', 'id' => $this->id, 'title' => $this->name);
121
+
122
  // makes sure the ad filters can also run here
123
  $adcontent = $ad->output();
124
 
classes/ad_placements.php CHANGED
@@ -175,8 +175,16 @@ class Advads_Ad_Placements {
175
 
176
  // return either ad or group content
177
  if ($_item[0] == 'ad') {
 
 
 
 
178
  return get_ad($_item_id);
179
  } elseif ($_item[0] == 'group') {
 
 
 
 
180
  return get_ad_group($_item_id);
181
  }
182
  } else {
175
 
176
  // return either ad or group content
177
  if ($_item[0] == 'ad') {
178
+ // add the placement to the global output array
179
+ $advads = Advanced_Ads::get_instance();
180
+ $advads->current_ads[] = array('type' => 'placement', 'id' => $id, 'title' => $placements[$id]['name']);
181
+
182
  return get_ad($_item_id);
183
  } elseif ($_item[0] == 'group') {
184
+ // add the placement to the global output array
185
+ $advads = Advanced_Ads::get_instance();
186
+ $advads->current_ads[] = array('type' => 'placement', 'id' => $id, 'title' => $placements[$id]['name']);
187
+
188
  return get_ad_group($_item_id);
189
  }
190
  } else {
classes/ad_type_content.php CHANGED
@@ -104,7 +104,18 @@ class Advads_Ad_Type_Content extends Advads_Ad_Type_Abstract{
104
  * @since 1.0.0
105
  */
106
  public function prepare_output($ad){
107
- return apply_filters('the_content', $ad->content);
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
 
110
  }
104
  * @since 1.0.0
105
  */
106
  public function prepare_output($ad){
107
+
108
+ // apply functions normally running through the_content filter
109
+ // the_content filter not used here because it created an infinite loop (ads within ads)
110
+
111
+ $output = wptexturize($ad->content);
112
+ $output = convert_smilies($output);
113
+ $output = convert_chars($output);
114
+ $output = wpautop($output);
115
+ $output = shortcode_unautop($output);
116
+ $output = prepend_attachment($output);
117
+
118
+ return $output;
119
  }
120
 
121
  }
public/class-advanced-ads.php CHANGED
@@ -63,6 +63,11 @@ class Advanced_Ads {
63
  */
64
  protected static $instance = null;
65
 
 
 
 
 
 
66
  /**
67
  * ad types
68
  */
63
  */
64
  protected static $instance = null;
65
 
66
+ /**
67
+ * array with ads currently delivered in the frontend
68
+ */
69
+ public $current_ads = array();
70
+
71
  /**
72
  * ad types
73
  */
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.0.1
7
- Stable tag: 1.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -146,6 +146,10 @@ There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way t
146
 
147
  == Changelog ==
148
 
 
 
 
 
149
  = 1.3.1 =
150
 
151
  * COOL: new ad type: rich media and formatable content – it’s like editing a normal post
@@ -244,6 +248,10 @@ other fixes:
244
 
245
  == Upgrade Notice ==
246
 
 
 
 
 
247
  = 1.3 =
248
 
249
  Don’t miss out on the new layout options to align ads and set margins
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.0.1
7
+ Stable tag: 1.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
146
 
147
  == Changelog ==
148
 
149
+ = 1.3.2 =
150
+
151
+ * hotfix: prevent infinite loops (ads within ads…) for rich content ads
152
+
153
  = 1.3.1 =
154
 
155
  * COOL: new ad type: rich media and formatable content – it’s like editing a normal post
248
 
249
  == Upgrade Notice ==
250
 
251
+ = 1.3.2 =
252
+
253
+ Hotfix: prevent infinite loops (ads within ads) for rich content ads
254
+
255
  = 1.3 =
256
 
257
  Don’t miss out on the new layout options to align ads and set margins