WordPress Ad Widget - Version 2.1.4

Version Description

Download this release

Release Info

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

Code changes from version 2.1.3 to 2.1.4

Files changed (3) hide show
  1. adwidget.php +25 -9
  2. assets/sample-ad.png +0 -0
  3. readme.txt +1 -1
adwidget.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Wordpress Ad Widget
4
  Plugin URI: https://github.com/broadstreetads/wordpress-ad-widget
5
  Description: The easiest way to place ads in your Wordpress sidebar. Go to Settings -> Ad Widget
6
- Version: 2.1.3
7
  Author: Broadstreet Ads
8
  Author URI: http://broadstreetads.com
9
  */
@@ -18,7 +18,7 @@ add_action('admin_menu', array('AdWidget_Core', 'registerAdmin'));
18
  class AdWidget_Core
19
  {
20
  CONST KEY_INSTALL_REPORT = 'AdWidget_Installed';
21
- CONST VERSION = '2.1.3';
22
 
23
  /**
24
  * The callback used to register the scripts
@@ -241,12 +241,24 @@ class AdWidget_ImageWidget extends WP_Widget
241
  {
242
  extract($args);
243
 
244
- $link = $instance['w_link'];
245
- $img = $instance['w_img'];
 
 
 
 
 
 
246
 
247
  echo $before_widget;
 
 
 
 
 
 
248
 
249
- echo "<a target='_blank' href='$link' alt='Ad'><img style='width: 100%' src='$img' alt='Ad' /></a>";
250
 
251
  echo $after_widget;
252
  }
@@ -261,8 +273,9 @@ class AdWidget_ImageWidget extends WP_Widget
261
  {
262
  $instance = $old_instance;
263
 
264
- $instance['w_link'] = $new_instance['w_link'];
265
- $instance['w_img'] = $new_instance['w_img'];
 
266
 
267
  return $instance;
268
  }
@@ -275,9 +288,8 @@ class AdWidget_ImageWidget extends WP_Widget
275
  {
276
  $link_id = $this->get_field_id('w_link');
277
  $img_id = $this->get_field_id('w_img');
278
-
279
 
280
- $defaults = array('w_link' => get_bloginfo('url'), 'w_img' => '');
281
 
282
  $instance = wp_parse_args((array) $instance, $defaults);
283
 
@@ -301,6 +313,10 @@ class AdWidget_ImageWidget extends WP_Widget
301
  <label for="<?php echo $this->get_field_id('w_link'); ?>">Ad Click Destination:</label><br/>
302
  <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']; ?>" />
303
  </p>
 
 
 
 
304
  <p>
305
  When you're ready for a more powerful adserver, visit <a target="_blank" href="http://broadstreetads.com/ad-platform/adserving/">Broadstreet</a>.
306
  </p>
3
  Plugin Name: Wordpress Ad Widget
4
  Plugin URI: https://github.com/broadstreetads/wordpress-ad-widget
5
  Description: The easiest way to place ads in your Wordpress sidebar. Go to Settings -> Ad Widget
6
+ Version: 2.1.4
7
  Author: Broadstreet Ads
8
  Author URI: http://broadstreetads.com
9
  */
18
  class AdWidget_Core
19
  {
20
  CONST KEY_INSTALL_REPORT = 'AdWidget_Installed';
21
+ CONST VERSION = '2.1.4';
22
 
23
  /**
24
  * The callback used to register the scripts
241
  {
242
  extract($args);
243
 
244
+ $link = @$instance['w_link'];
245
+ $img = @$instance['w_img'];
246
+ $resize = @$instance['w_resize'];
247
+
248
+ if($resize == 'yes')
249
+ {
250
+ $resize = "style='width: 100%;'";
251
+ }
252
 
253
  echo $before_widget;
254
+
255
+ if(!$img)
256
+ {
257
+ $img = AdWidget_Core::getBaseURL() . 'assets/sample-ad.png';
258
+ $link = 'http://adsofthefuture.com';
259
+ }
260
 
261
+ echo "<a target='_blank' href='$link' alt='Ad'><img $resize src='$img' alt='Ad' /></a>";
262
 
263
  echo $after_widget;
264
  }
273
  {
274
  $instance = $old_instance;
275
 
276
+ $instance['w_link'] = $new_instance['w_link'];
277
+ $instance['w_img'] = $new_instance['w_img'];
278
+ $instance['w_resize'] = $new_instance['w_resize'];
279
 
280
  return $instance;
281
  }
288
  {
289
  $link_id = $this->get_field_id('w_link');
290
  $img_id = $this->get_field_id('w_img');
 
291
 
292
+ $defaults = array('w_link' => get_bloginfo('url'), 'w_img' => '', 'w_resize' => 'no');
293
 
294
  $instance = wp_parse_args((array) $instance, $defaults);
295
 
313
  <label for="<?php echo $this->get_field_id('w_link'); ?>">Ad Click Destination:</label><br/>
314
  <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']; ?>" />
315
  </p>
316
+ <p>
317
+ <label for="<?php echo $this->get_field_id('w_resize'); ?>">Auto Resize to Max Width? </label>
318
+ <input type="checkbox" name="<?php echo $this->get_field_name('w_resize'); ?>" value="yes" <?php if($instance['w_resize'] == 'yes') echo 'checked'; ?> />
319
+ </p>
320
  <p>
321
  When you're ready for a more powerful adserver, visit <a target="_blank" href="http://broadstreetads.com/ad-platform/adserving/">Broadstreet</a>.
322
  </p>
assets/sample-ad.png ADDED
Binary file
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Broadstreet
3
  Tags: wordpress,ad,widget,sidebar,google,tag,code
4
  Requires at least: 3.0
5
  Tested up to: 3.5.1
6
- Stable tag: 2.1.3
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.
3
  Tags: wordpress,ad,widget,sidebar,google,tag,code
4
  Requires at least: 3.0
5
  Tested up to: 3.5.1
6
+ Stable tag: 2.1.4
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.