Image Widget - Version 2.1

Version Description

Download this release

Release Info

Developer peterchester
Plugin Icon 128x128 Image Widget
Version 2.1
Comparing to
See all releases

Code changes from version 2.0 to 2.1

Files changed (3) hide show
  1. image-widget.php +11 -3
  2. readme.txt +6 -1
  3. screenshot-1.png +0 -0
image-widget.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: Image Widget
5
  Plugin URI: http://www.shaneandpeter.com/wordpress
6
  Description: This widget accepts a title, a link and an image and displays them. The admin panel is separated from the widget to offer independant control
7
  Author: Shane and Peter, Inc. [Contributors: Kevin Miller, Nick Ohrn]
8
- Version: 2.0
9
  Author URI: http://www.shaneandpeter.com
10
  */
11
 
@@ -24,6 +24,7 @@ class sp_image_widget {
24
  'default_widget_options' => array(
25
  'title' => '',
26
  'link' => '',
 
27
  'description' => '',
28
  'image' => ''
29
  ),
@@ -102,6 +103,7 @@ class sp_image_widget {
102
 
103
 
104
  $link = !empty($widget_options['link']);
 
105
 
106
  echo '<div id="'.$this->options['control_options']['id_base'].'-'.$number.'" class="widget '.$this->options['widget_options']['classname'].'">';
107
  ?>
@@ -119,14 +121,14 @@ class sp_image_widget {
119
 
120
  <?php if (!empty($widget_options['image'])): ?>
121
 
122
- <?= ($link ? '<a class="' . $this->options['widget_options']['classname'] . '-image-link" href="' . $widget_options['link'] . '">' : '') . '<img class="' . $this->options['widget_options']['classname'] . '-image" src="' . $widget_options['image'] . '" alt="image widget" />' . ($link ? '</a>' : '') ?>
123
 
124
  <?php endif; ?>
125
 
126
  <?php if (!empty($widget_options['description'])): ?>
127
 
128
  <p class="<?= $this->options['widget_options']['classname'] ?>-description" >
129
- <?= ($link ? '<a class="' . $this->options['widget_options']['classname'] . '-image-link-p" href="' . $widget_options['link'] . '">' : '')?>
130
  <?= html_entity_decode($widget_options['description']) ?>
131
  <?= ($link ? '</a>' : '') ?></p>
132
 
@@ -256,6 +258,8 @@ class sp_image_widget {
256
 
257
  $new_options['link'] = htmlentities(stripslashes($_POST[$this->options['control_options']['id_base'] . '-link']));
258
 
 
 
259
  $new_options['description'] = $_POST[$this->options['control_options']['id_base'] . '-description'];
260
  $new_options['description'] = ereg_replace("[^A-Za-z0-9 _!-@#$%^&*()_+={}\":<>?/.,;'|\\~`]", "", $new_options['description']);
261
  $new_options['description'] = htmlentities(stripslashes($new_options['description']));
@@ -424,6 +428,10 @@ class sp_image_widget {
424
  </th>
425
  <td>
426
  <input type="text" id="<?= $this->options['control_options']['id_base'] ?>[<?= $number ?>][link]" name="<?= $this->options['control_options']['id_base'] ?>-link" value="<?= $form_options['link'] ?>" >
 
 
 
 
427
  </td>
428
  </tr>
429
 
5
  Plugin URI: http://www.shaneandpeter.com/wordpress
6
  Description: This widget accepts a title, a link and an image and displays them. The admin panel is separated from the widget to offer independant control
7
  Author: Shane and Peter, Inc. [Contributors: Kevin Miller, Nick Ohrn]
8
+ Version: 2.1
9
  Author URI: http://www.shaneandpeter.com
10
  */
11
 
24
  'default_widget_options' => array(
25
  'title' => '',
26
  'link' => '',
27
+ 'linktarget' => '',
28
  'description' => '',
29
  'image' => ''
30
  ),
103
 
104
 
105
  $link = !empty($widget_options['link']);
106
+ $linktarget = !empty($widget_options['linktarget']);
107
 
108
  echo '<div id="'.$this->options['control_options']['id_base'].'-'.$number.'" class="widget '.$this->options['widget_options']['classname'].'">';
109
  ?>
121
 
122
  <?php if (!empty($widget_options['image'])): ?>
123
 
124
+ <?= ($link ? '<a class="' . $this->options['widget_options']['classname'] . '-image-link" href="' . $widget_options['link'] . '" target="' . $widget_options['linktarget'] . '">' : '') . '<img class="' . $this->options['widget_options']['classname'] . '-image" src="' . $widget_options['image'] . '" alt="image widget" />' . ($link ? '</a>' : '') ?>
125
 
126
  <?php endif; ?>
127
 
128
  <?php if (!empty($widget_options['description'])): ?>
129
 
130
  <p class="<?= $this->options['widget_options']['classname'] ?>-description" >
131
+ <?= ($link ? '<a class="' . $this->options['widget_options']['classname'] . '-image-link-p" href="' . $widget_options['link'] . '" target="' . $widget_options['linktarget'] . '">' : '')?>
132
  <?= html_entity_decode($widget_options['description']) ?>
133
  <?= ($link ? '</a>' : '') ?></p>
134
 
258
 
259
  $new_options['link'] = htmlentities(stripslashes($_POST[$this->options['control_options']['id_base'] . '-link']));
260
 
261
+ $new_options['linktarget'] = htmlentities(stripslashes($_POST[$this->options['control_options']['id_base'] . '-linktarget']));
262
+
263
  $new_options['description'] = $_POST[$this->options['control_options']['id_base'] . '-description'];
264
  $new_options['description'] = ereg_replace("[^A-Za-z0-9 _!-@#$%^&*()_+={}\":<>?/.,;'|\\~`]", "", $new_options['description']);
265
  $new_options['description'] = htmlentities(stripslashes($new_options['description']));
428
  </th>
429
  <td>
430
  <input type="text" id="<?= $this->options['control_options']['id_base'] ?>[<?= $number ?>][link]" name="<?= $this->options['control_options']['id_base'] ?>-link" value="<?= $form_options['link'] ?>" >
431
+ <select id="<?= $this->options['control_options']['id_base'] ?>[<?= $number ?>][linktarget]" name="<?= $this->options['control_options']['id_base'] ?>-linktarget">
432
+ <option value="_self"<?php if ($form_options['linktarget']=="_self") { echo " selected"; } ?>>Same Window</option>
433
+ <option value="_blank"<?php if ($form_options['linktarget']=="_blank") { echo " selected"; } ?>>New Window</option>
434
+ </select>
435
  </td>
436
  </tr>
437
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.shaneandpeter.com
4
  Tags: widget, image, ad, banner, simple
5
  Requires at least: 2.0
6
  Tested up to: 2.7.1
7
- Stable tag: 2.0
8
 
9
  Simple image widget. Allows for placement of an image in the sidebar without requiring Design access.
10
 
@@ -33,7 +33,12 @@ If you find any bugs or have any ideas, please mail us.
33
 
34
  == Changelog ==
35
 
 
 
 
 
36
  New in version 2.0
 
37
  * Multi widget support
38
  * WP 2.7.1 Compatibility
39
  * Class encapsulation
4
  Tags: widget, image, ad, banner, simple
5
  Requires at least: 2.0
6
  Tested up to: 2.7.1
7
+ Stable tag: 2.1
8
 
9
  Simple image widget. Allows for placement of an image in the sidebar without requiring Design access.
10
 
33
 
34
  == Changelog ==
35
 
36
+ New in version 2.1
37
+
38
+ * Link Target
39
+
40
  New in version 2.0
41
+
42
  * Multi widget support
43
  * WP 2.7.1 Compatibility
44
  * Class encapsulation
screenshot-1.png CHANGED
Binary file