WordPress Ad Widget - Version 2.17.0

Version Description

Download this release

Release Info

Developer broadstreetads
Plugin Icon wp plugin WordPress Ad Widget
Version 2.17.0
Comparing to
See all releases

Code changes from version 2.16.0 to 2.17.0

Files changed (2) hide show
  1. adwidget.php +43 -43
  2. readme.txt +3 -3
adwidget.php CHANGED
@@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
5
  Plugin Name: Wordpress Ad Widget
6
  Plugin URI: https://github.com/broadstreetads/wordpress-ad-widget
7
  Description: The easiest way to place ads in your Wordpress sidebar. Go to Settings -> Ad Widget
8
- Version: 2.16.0
9
  Author: Broadstreet XPRESS
10
  Author URI: http://broadstreetads.com
11
  */
@@ -24,7 +24,7 @@ class AdWidget_Core
24
  CONST KEY_INSTALL_REPORT = 'AdWidget_Installed';
25
  CONST VERSION = '2.16.0';
26
  CONST KEY_WELCOME = 'AdWidget_Welcome';
27
-
28
  /**
29
  * The callback used to register the scripts
30
  */
@@ -38,25 +38,25 @@ class AdWidget_Core
38
  wp_enqueue_script('adwidget-main', self::getBaseURL().'assets/widgets.js');
39
  }
40
  }
41
-
42
  /**
43
  * The callback used to register the widget
44
  */
45
  static function registerWidgets()
46
- {
47
  register_widget('AdWidget_HTMLWidget');
48
  register_widget('AdWidget_ImageWidget');
49
  }
50
-
51
  /**
52
  * Get the base URL of the plugin installation
53
  * @return string the base URL
54
  */
55
  public static function getBaseURL()
56
- {
57
  return plugin_dir_url(__FILE__);
58
  }
59
-
60
  /**
61
  * Register the admin settings page
62
  */
@@ -73,13 +73,13 @@ class AdWidget_Core
73
 
74
  if(isset($_POST['cancel']))
75
  Broadstreet_Adwidget_Mini_Utility::hasAdserving(false);
76
-
77
  if(isset($_POST['subscribe']))
78
  Broadstreet_Adwidget_Mini_Utility::hasAdserving(true);
79
-
80
  include dirname(__FILE__) . '/views/admin.php';
81
  }
82
-
83
  /**
84
  * Sets a Wordpress option
85
  * @param string $name The name of the option to set
@@ -138,7 +138,7 @@ class AdWidget_HTMLWidget extends WP_Widget
138
  extract($args);
139
 
140
  echo $before_widget;
141
-
142
  echo "<div style='text-align: center;'>{$instance['w_adcode']}</div>";
143
 
144
  echo $after_widget;
@@ -153,26 +153,26 @@ class AdWidget_HTMLWidget extends WP_Widget
153
  function update($new_instance, $old_instance)
154
  {
155
  $instance = $old_instance;
156
-
157
  $instance['w_adcode'] = $new_instance['w_adcode'];
158
  $instance['w_adv'] = $new_instance['w_adv'];
159
-
160
  /* New ad? Upload it to Broadstreet */
161
  if($instance['w_adcode'] && Broadstreet_Adwidget_Mini_Utility::hasAdserving()) {
162
-
163
  $advertisement_id = false;
164
  # New ad?
165
  if(is_numeric(@$instance['bs_ad_id'])) $advertisement_id = $instance['bs_ad_id'];
166
-
167
  # New advertiser?
168
  if(!$advertisement_id) {
169
  $api = Broadstreet_Adwidget_Mini_Utility::getClient();
170
  $adv = $api->createAdvertiser(Broadstreet_Adwidget_Mini_Utility::getNetworkID(), $instance['w_adv']);
171
  $instance['bs_adv_id'] = $adv->id;
172
  }
173
-
174
- $ad = Broadstreet_Adwidget_Mini_Utility::importHTMLAd(Broadstreet_Adwidget_Mini_Utility::getNetworkID(),
175
- $instance['bs_adv_id'],
176
  $instance['w_adcode'],
177
  $advertisement_id);
178
 
@@ -190,7 +190,7 @@ class AdWidget_HTMLWidget extends WP_Widget
190
  * Display the widget update form
191
  * @param array $instance
192
  */
193
- function form($instance)
194
  {
195
 
196
  $defaults = array('w_adcode' => '', 'w_adv' => 'New Advertiser');
@@ -210,7 +210,7 @@ class AdWidget_HTMLWidget extends WP_Widget
210
  <?php
211
  }
212
  }
213
-
214
  /**
215
  * This is an optional widget to display GitHub projects
216
  */
@@ -219,7 +219,7 @@ class AdWidget_ImageWidget extends WP_Widget
219
  /**
220
  * Set the widget options
221
  */
222
- function AdWidget_ImageWidget()
223
  {
224
  $widget_ops = array('classname' => 'AdWidget_ImageWidget', 'description' => 'Place an image ad with a link');
225
  parent::__construct('AdWidget_ImageWidget', 'Ad: Image/Banner Ad', $widget_ops);
@@ -233,13 +233,13 @@ class AdWidget_ImageWidget extends WP_Widget
233
  function widget($args, $instance)
234
  {
235
  extract($args);
236
-
237
  $link = @$instance['w_link'];
238
  $img = @$instance['w_img'];
239
  $resize = @$instance['w_resize'];
240
  $new = @$instance['w_new'];
241
  $id = rand(1, 100000);
242
-
243
  if($resize == 'yes')
244
  {
245
  $resize_s = "style='width: 100%;'";
@@ -248,25 +248,25 @@ class AdWidget_ImageWidget extends WP_Widget
248
  {
249
  $resize_s = '';
250
  }
251
-
252
  # There's a reason for this dumb condition
253
  if($new == 'yes')
254
  {
255
- $target = 'target="_blank"';
256
  }
257
  else
258
  {
259
  $target = '';
260
  }
261
-
262
  echo $before_widget;
263
-
264
  if(!$img)
265
  {
266
  $img = AdWidget_Core::getBaseURL() . 'assets/sample-ad.png';
267
  $link = '#';
268
  }
269
-
270
  if(Broadstreet_Adwidget_Mini_Utility::hasAdserving() && is_numeric($instance['bs_ad_id']))
271
  {
272
  if($resize == 'yes') echo '<style type="text/css">.adwidget-id'.$id.' img { width: 100% !important; height: auto !important; }</style>';
@@ -289,8 +289,8 @@ class AdWidget_ImageWidget extends WP_Widget
289
  function update($new_instance, $old_instance)
290
  {
291
  $instance = $old_instance;
292
-
293
- $changed = ($instance['w_img'] != $new_instance['w_img']
294
  || $instance['w_link'] !== $new_instance['w_link']);
295
 
296
  $instance['w_link'] = $new_instance['w_link'];
@@ -298,24 +298,24 @@ class AdWidget_ImageWidget extends WP_Widget
298
  $instance['w_resize'] = @$new_instance['w_resize'];
299
  $instance['w_new'] = @$new_instance['w_new'];
300
  $instance['w_adv'] = $new_instance['w_adv'];
301
-
302
  /* New ad? Upload it to Broadstreet */
303
  if($instance['w_img'] && $changed && Broadstreet_Adwidget_Mini_Utility::hasAdserving()) {
304
-
305
  $advertisement_id = false;
306
  # New ad?
307
  if(is_numeric(@$instance['bs_ad_id'])) $advertisement_id = $instance['bs_ad_id'];
308
-
309
  # New advertiser?
310
  if(!$advertisement_id) {
311
  $api = Broadstreet_Adwidget_Mini_Utility::getClient();
312
  $adv = $api->createAdvertiser(Broadstreet_Adwidget_Mini_Utility::getNetworkID(), $instance['w_adv']);
313
  $instance['bs_adv_id'] = $adv->id;
314
  }
315
-
316
- $ad = Broadstreet_Adwidget_Mini_Utility::importImageAd(Broadstreet_Adwidget_Mini_Utility::getNetworkID(),
317
- $instance['bs_adv_id'],
318
- $instance['w_img'],
319
  $instance['w_link'],
320
  $advertisement_id);
321
 
@@ -333,15 +333,15 @@ class AdWidget_ImageWidget extends WP_Widget
333
  * Display the widget update form
334
  * @param array $instance
335
  */
336
- function form($instance)
337
  {
338
  $link_id = $this->get_field_id('w_link');
339
  $img_id = $this->get_field_id('w_img');
340
-
341
  $defaults = array('w_link' => get_bloginfo('url'), 'w_img' => '', 'w_adv' => 'New Advertiser', 'w_resize' => 'no', 'w_new' => 'no');
342
-
343
  $instance = wp_parse_args((array) $instance, $defaults);
344
-
345
  $img = $instance['w_img'];
346
  $link = $instance['w_link'];
347
  $adv = $instance['w_adv'];
@@ -355,10 +355,10 @@ class AdWidget_ImageWidget extends WP_Widget
355
  <div class="bs-proof"><img style="width:100%;" src="<?php echo $instance['w_img'] ?>" alt="Ad" /></div><br/>
356
  <?php endif; ?>
357
  <a href="#" class="upload-button" rel="<?php echo $img_id ?>">Click here to upload a new image.</a> You can also paste in an image URL below.
358
-
359
  </p>
360
  <input class="widefat tag" placeholder="Image URL" type="text" id="<?php echo $img_id; ?>" name="<?php echo $this->get_field_name('w_img'); ?>" value="<?php echo htmlentities($instance['w_img']); ?>" />
361
- <br/><br/>
362
  <p>
363
  <label for="<?php echo $this->get_field_id('w_link'); ?>">Ad Click Destination:</label><br/>
364
  <input class="widefat" type="text" id="<?php echo $this->get_field_id('w_link'); ?>" name="<?php echo $this->get_field_name('w_link'); ?>" value="<?php echo $instance['w_link']; ?>" />
5
  Plugin Name: Wordpress Ad Widget
6
  Plugin URI: https://github.com/broadstreetads/wordpress-ad-widget
7
  Description: The easiest way to place ads in your Wordpress sidebar. Go to Settings -> Ad Widget
8
+ Version: 2.17.0
9
  Author: Broadstreet XPRESS
10
  Author URI: http://broadstreetads.com
11
  */
24
  CONST KEY_INSTALL_REPORT = 'AdWidget_Installed';
25
  CONST VERSION = '2.16.0';
26
  CONST KEY_WELCOME = 'AdWidget_Welcome';
27
+
28
  /**
29
  * The callback used to register the scripts
30
  */
38
  wp_enqueue_script('adwidget-main', self::getBaseURL().'assets/widgets.js');
39
  }
40
  }
41
+
42
  /**
43
  * The callback used to register the widget
44
  */
45
  static function registerWidgets()
46
+ {
47
  register_widget('AdWidget_HTMLWidget');
48
  register_widget('AdWidget_ImageWidget');
49
  }
50
+
51
  /**
52
  * Get the base URL of the plugin installation
53
  * @return string the base URL
54
  */
55
  public static function getBaseURL()
56
+ {
57
  return plugin_dir_url(__FILE__);
58
  }
59
+
60
  /**
61
  * Register the admin settings page
62
  */
73
 
74
  if(isset($_POST['cancel']))
75
  Broadstreet_Adwidget_Mini_Utility::hasAdserving(false);
76
+
77
  if(isset($_POST['subscribe']))
78
  Broadstreet_Adwidget_Mini_Utility::hasAdserving(true);
79
+
80
  include dirname(__FILE__) . '/views/admin.php';
81
  }
82
+
83
  /**
84
  * Sets a Wordpress option
85
  * @param string $name The name of the option to set
138
  extract($args);
139
 
140
  echo $before_widget;
141
+
142
  echo "<div style='text-align: center;'>{$instance['w_adcode']}</div>";
143
 
144
  echo $after_widget;
153
  function update($new_instance, $old_instance)
154
  {
155
  $instance = $old_instance;
156
+
157
  $instance['w_adcode'] = $new_instance['w_adcode'];
158
  $instance['w_adv'] = $new_instance['w_adv'];
159
+
160
  /* New ad? Upload it to Broadstreet */
161
  if($instance['w_adcode'] && Broadstreet_Adwidget_Mini_Utility::hasAdserving()) {
162
+
163
  $advertisement_id = false;
164
  # New ad?
165
  if(is_numeric(@$instance['bs_ad_id'])) $advertisement_id = $instance['bs_ad_id'];
166
+
167
  # New advertiser?
168
  if(!$advertisement_id) {
169
  $api = Broadstreet_Adwidget_Mini_Utility::getClient();
170
  $adv = $api->createAdvertiser(Broadstreet_Adwidget_Mini_Utility::getNetworkID(), $instance['w_adv']);
171
  $instance['bs_adv_id'] = $adv->id;
172
  }
173
+
174
+ $ad = Broadstreet_Adwidget_Mini_Utility::importHTMLAd(Broadstreet_Adwidget_Mini_Utility::getNetworkID(),
175
+ $instance['bs_adv_id'],
176
  $instance['w_adcode'],
177
  $advertisement_id);
178
 
190
  * Display the widget update form
191
  * @param array $instance
192
  */
193
+ function form($instance)
194
  {
195
 
196
  $defaults = array('w_adcode' => '', 'w_adv' => 'New Advertiser');
210
  <?php
211
  }
212
  }
213
+
214
  /**
215
  * This is an optional widget to display GitHub projects
216
  */
219
  /**
220
  * Set the widget options
221
  */
222
+ function __construct()
223
  {
224
  $widget_ops = array('classname' => 'AdWidget_ImageWidget', 'description' => 'Place an image ad with a link');
225
  parent::__construct('AdWidget_ImageWidget', 'Ad: Image/Banner Ad', $widget_ops);
233
  function widget($args, $instance)
234
  {
235
  extract($args);
236
+
237
  $link = @$instance['w_link'];
238
  $img = @$instance['w_img'];
239
  $resize = @$instance['w_resize'];
240
  $new = @$instance['w_new'];
241
  $id = rand(1, 100000);
242
+
243
  if($resize == 'yes')
244
  {
245
  $resize_s = "style='width: 100%;'";
248
  {
249
  $resize_s = '';
250
  }
251
+
252
  # There's a reason for this dumb condition
253
  if($new == 'yes')
254
  {
255
+ $target = 'target="_blank"';
256
  }
257
  else
258
  {
259
  $target = '';
260
  }
261
+
262
  echo $before_widget;
263
+
264
  if(!$img)
265
  {
266
  $img = AdWidget_Core::getBaseURL() . 'assets/sample-ad.png';
267
  $link = '#';
268
  }
269
+
270
  if(Broadstreet_Adwidget_Mini_Utility::hasAdserving() && is_numeric($instance['bs_ad_id']))
271
  {
272
  if($resize == 'yes') echo '<style type="text/css">.adwidget-id'.$id.' img { width: 100% !important; height: auto !important; }</style>';
289
  function update($new_instance, $old_instance)
290
  {
291
  $instance = $old_instance;
292
+
293
+ $changed = ($instance['w_img'] != $new_instance['w_img']
294
  || $instance['w_link'] !== $new_instance['w_link']);
295
 
296
  $instance['w_link'] = $new_instance['w_link'];
298
  $instance['w_resize'] = @$new_instance['w_resize'];
299
  $instance['w_new'] = @$new_instance['w_new'];
300
  $instance['w_adv'] = $new_instance['w_adv'];
301
+
302
  /* New ad? Upload it to Broadstreet */
303
  if($instance['w_img'] && $changed && Broadstreet_Adwidget_Mini_Utility::hasAdserving()) {
304
+
305
  $advertisement_id = false;
306
  # New ad?
307
  if(is_numeric(@$instance['bs_ad_id'])) $advertisement_id = $instance['bs_ad_id'];
308
+
309
  # New advertiser?
310
  if(!$advertisement_id) {
311
  $api = Broadstreet_Adwidget_Mini_Utility::getClient();
312
  $adv = $api->createAdvertiser(Broadstreet_Adwidget_Mini_Utility::getNetworkID(), $instance['w_adv']);
313
  $instance['bs_adv_id'] = $adv->id;
314
  }
315
+
316
+ $ad = Broadstreet_Adwidget_Mini_Utility::importImageAd(Broadstreet_Adwidget_Mini_Utility::getNetworkID(),
317
+ $instance['bs_adv_id'],
318
+ $instance['w_img'],
319
  $instance['w_link'],
320
  $advertisement_id);
321
 
333
  * Display the widget update form
334
  * @param array $instance
335
  */
336
+ function form($instance)
337
  {
338
  $link_id = $this->get_field_id('w_link');
339
  $img_id = $this->get_field_id('w_img');
340
+
341
  $defaults = array('w_link' => get_bloginfo('url'), 'w_img' => '', 'w_adv' => 'New Advertiser', 'w_resize' => 'no', 'w_new' => 'no');
342
+
343
  $instance = wp_parse_args((array) $instance, $defaults);
344
+
345
  $img = $instance['w_img'];
346
  $link = $instance['w_link'];
347
  $adv = $instance['w_adv'];
355
  <div class="bs-proof"><img style="width:100%;" src="<?php echo $instance['w_img'] ?>" alt="Ad" /></div><br/>
356
  <?php endif; ?>
357
  <a href="#" class="upload-button" rel="<?php echo $img_id ?>">Click here to upload a new image.</a> You can also paste in an image URL below.
358
+
359
  </p>
360
  <input class="widefat tag" placeholder="Image URL" type="text" id="<?php echo $img_id; ?>" name="<?php echo $this->get_field_name('w_img'); ?>" value="<?php echo htmlentities($instance['w_img']); ?>" />
361
+ <br/><br/>
362
  <p>
363
  <label for="<?php echo $this->get_field_id('w_link'); ?>">Ad Click Destination:</label><br/>
364
  <input class="widefat" type="text" id="<?php echo $this->get_field_id('w_link'); ?>" name="<?php echo $this->get_field_name('w_link'); ?>" value="<?php echo $instance['w_link']; ?>" />
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: Broadstreet
3
  Tags: wordpress,ad,widget,sidebar,google,tag,code
4
  Requires at least: 3.0
5
- Tested up to: 4.9
6
- Stable tag: 2.16.0
7
 
8
  Easily upload ad images and ad code to your sidebar. For those that don't need or
9
  want a complicated ad management system.
@@ -20,7 +20,7 @@ Watch a short video demo: http://www.screenr.com/u0t7
20
  * Easily place image banner ads
21
  * Easily place Google ad tags and other ad code
22
 
23
- If you like Ad Widget and you're selling ads, you might like our new [ad formats for publishers
24
  and salespeople](http://broadstreetads.com/ad-platform/ad-formats/).
25
 
26
  You will not find an easier way to run ads on your website!
2
  Contributors: Broadstreet
3
  Tags: wordpress,ad,widget,sidebar,google,tag,code
4
  Requires at least: 3.0
5
+ Tested up to: 5.1
6
+ Stable tag: 2.17.0
7
 
8
  Easily upload ad images and ad code to your sidebar. For those that don't need or
9
  want a complicated ad management system.
20
  * Easily place image banner ads
21
  * Easily place Google ad tags and other ad code
22
 
23
+ If you like Ad Widget and you're selling ads, you might like our new [ad formats for publishers
24
  and salespeople](http://broadstreetads.com/ad-platform/ad-formats/).
25
 
26
  You will not find an easier way to run ads on your website!