Version Description
- Removed the main plugin file for the previous version.
Download this release
Release Info
Developer | blazersix |
Plugin | Simple Image Widget |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 3.0 to 3.0.1
- readme.txt +4 -1
- simple-image-widget.php +1 -1
- simpleimage.php +0 -134
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: blazersix, bradyvercher
|
|
3 |
Tags: image widget, widget, media, media manager, sidebar, image, photo, picture
|
4 |
Requires at least: 3.3
|
5 |
Tested up to: 3.5
|
6 |
-
Stable tag: 3.0
|
7 |
License: GPL-2.0+
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -32,5 +32,8 @@ Read about the original thought behind creating this widget and ways it can be e
|
|
32 |
|
33 |
== Changelog ==
|
34 |
|
|
|
|
|
|
|
35 |
= 3.0 =
|
36 |
* Complete rewrite with new media manager support.
|
3 |
Tags: image widget, widget, media, media manager, sidebar, image, photo, picture
|
4 |
Requires at least: 3.3
|
5 |
Tested up to: 3.5
|
6 |
+
Stable tag: 3.0.1
|
7 |
License: GPL-2.0+
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 3.0.1 =
|
36 |
+
* Removed the main plugin file for the previous version.
|
37 |
+
|
38 |
= 3.0 =
|
39 |
* Complete rewrite with new media manager support.
|
simple-image-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Simple Image Widget
|
4 |
* Plugin URI: https://wordpress.org/extend/plugins/simple-image-widget/
|
5 |
* Description: A simple image widget utilizing the new WordPress media manager.
|
6 |
-
* Version: 3.0
|
7 |
* Author: Blazer Six
|
8 |
* Author URI: http://www.blazersix.com/
|
9 |
* License: GPL-2.0+
|
3 |
* Plugin Name: Simple Image Widget
|
4 |
* Plugin URI: https://wordpress.org/extend/plugins/simple-image-widget/
|
5 |
* Description: A simple image widget utilizing the new WordPress media manager.
|
6 |
+
* Version: 3.0.1
|
7 |
* Author: Blazer Six
|
8 |
* Author URI: http://www.blazersix.com/
|
9 |
* License: GPL-2.0+
|
simpleimage.php
DELETED
@@ -1,134 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Simple Image Widget
|
4 |
-
Description: Using this widget you can easily place an image and link in the sidebar. It supports multiple instances, so you can use it multiple times in multiple sidebars.
|
5 |
-
Version: 2.1
|
6 |
-
Author: Chris Vickio
|
7 |
-
Author URI: http://vickio.net
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<?php
|
11 |
-
/* Copyright 2011 Chris Vickio (email : chris@vickio.net)
|
12 |
-
|
13 |
-
This program is free software; you can redistribute it and/or modify
|
14 |
-
it under the terms of the GNU General Public License as published by
|
15 |
-
the Free Software Foundation; either version 2 of the License, or
|
16 |
-
(at your option) any later version.
|
17 |
-
|
18 |
-
This program is distributed in the hope that it will be useful,
|
19 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
-
GNU General Public License for more details.
|
22 |
-
|
23 |
-
You should have received a copy of the GNU General Public License
|
24 |
-
along with this program; if not, write to the Free Software
|
25 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<?php
|
29 |
-
|
30 |
-
// Inspired by the built-in WP_Widget_Text class
|
31 |
-
class WP_Widget_Simple_Image extends WP_Widget {
|
32 |
-
|
33 |
-
// Set up the widget classname and description
|
34 |
-
function WP_Widget_Simple_Image() {
|
35 |
-
$widget_ops = array('classname' => 'widget_simpleimage', 'description' => __('Display an image'));
|
36 |
-
$control_ops = array();
|
37 |
-
$this->WP_Widget('simpleimage', __('Simple Image'), $widget_ops, $control_ops);
|
38 |
-
}
|
39 |
-
|
40 |
-
// Display the widget on the web site
|
41 |
-
function widget( $args, $instance ) {
|
42 |
-
extract($args);
|
43 |
-
|
44 |
-
// Optionally generate the link code
|
45 |
-
if ($instance['link']) {
|
46 |
-
if ($instance['new_window'])
|
47 |
-
$before_image = "<a href=\"".$instance['link']."\" target=\"_blank\">";
|
48 |
-
else
|
49 |
-
$before_image = "<a href=\"".$instance['link']."\">";
|
50 |
-
|
51 |
-
$after_image = "</a>";
|
52 |
-
}
|
53 |
-
|
54 |
-
echo $before_widget; ?>
|
55 |
-
<div class="simpleimage">
|
56 |
-
<?php echo $before_image; ?>
|
57 |
-
<img src="<?php echo $instance['image']; ?>" alt="<?php echo $instance['alt']; ?>" title="<?php echo $instance['img_title']; ?>" />
|
58 |
-
<?php echo $after_image; ?>
|
59 |
-
</div>
|
60 |
-
<?php echo $after_widget;
|
61 |
-
}
|
62 |
-
|
63 |
-
// Save the settings for this instance
|
64 |
-
function update( $new_instance, $old_instance ) {
|
65 |
-
$instance = $old_instance;
|
66 |
-
$instance['image'] = strip_tags($new_instance['image']);
|
67 |
-
$instance['alt'] = strip_tags($new_instance['alt']);
|
68 |
-
$instance['img_title'] = strip_tags($new_instance['img_title']);
|
69 |
-
$instance['link'] = strip_tags($new_instance['link']);
|
70 |
-
$instance['new_window'] = isset($new_instance['new_window']);
|
71 |
-
return $instance;
|
72 |
-
}
|
73 |
-
|
74 |
-
// Display the widget form in the admin interface
|
75 |
-
function form( $instance ) {
|
76 |
-
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'image' => '', 'alt' => '', 'img_title' => '', 'link' => '', 'new_window' => false ) );
|
77 |
-
|
78 |
-
// Generate a title based on the image URL
|
79 |
-
if ($instance['image'])
|
80 |
-
$title = preg_replace('/\?.*/', "", basename($instance['image']));
|
81 |
-
|
82 |
-
?>
|
83 |
-
<?php // Hidden title field for the admin interface to display ?>
|
84 |
-
<input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="hidden" value="<?php echo $title; ?>" />
|
85 |
-
|
86 |
-
<p>
|
87 |
-
<label for="<?php echo $this->get_field_id('image'); ?>">
|
88 |
-
<?php _e('Image URL (required):'); ?>
|
89 |
-
<input class="widefat" id="<?php echo $this->get_field_id('image'); ?>" name="<?php echo $this->get_field_name('image'); ?>" type="text" value="<?php echo $instance['image']; ?>" />
|
90 |
-
</label>
|
91 |
-
</p>
|
92 |
-
|
93 |
-
<p>
|
94 |
-
<label for="<?php echo $this->get_field_id('alt'); ?>">
|
95 |
-
<?php _e('Alternate Text:'); ?>
|
96 |
-
<input class="widefat" id="<?php echo $this->get_field_id('alt'); ?>" name="<?php echo $this->get_field_name('alt'); ?>" type="text" value="<?php echo $instance['alt']; ?>" />
|
97 |
-
<br />
|
98 |
-
<small><?php _e( 'Shown if the image cannot be displayed' ); ?></small>
|
99 |
-
</label>
|
100 |
-
</p>
|
101 |
-
|
102 |
-
<p>
|
103 |
-
<label for="<?php echo $this->get_field_id('img_title'); ?>">
|
104 |
-
<?php _e('Title:'); ?>
|
105 |
-
<input class="widefat" id="<?php echo $this->get_field_id('img_title'); ?>" name="<?php echo $this->get_field_name('img_title'); ?>" type="text" value="<?php echo $instance['img_title']; ?>" />
|
106 |
-
<br />
|
107 |
-
<small><?php _e( 'Shown when the mouse cursor is held over the image' ); ?></small>
|
108 |
-
</label>
|
109 |
-
</p>
|
110 |
-
|
111 |
-
<p>
|
112 |
-
<label for="<?php echo $this->get_field_id('link'); ?>">
|
113 |
-
<?php _e('Link URL:'); ?>
|
114 |
-
<input class="widefat" id="<?php echo $this->get_field_id('link'); ?>" name="<?php echo $this->get_field_name('link'); ?>" type="text" value="<?php echo $instance['link']; ?>" />
|
115 |
-
</label>
|
116 |
-
</p>
|
117 |
-
|
118 |
-
<p>
|
119 |
-
<label for="<?php echo $this->get_field_id('new_window'); ?>">
|
120 |
-
<input id="<?php echo $this->get_field_id('new_window'); ?>" name="<?php echo $this->get_field_name('new_window'); ?>" type="checkbox" <?php if ($instance['new_window']) echo 'checked="checked"'; ?> />
|
121 |
-
<?php _e('Open link in new window'); ?>
|
122 |
-
</label>
|
123 |
-
</p>
|
124 |
-
<?php
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
// Init function for registering the widget
|
129 |
-
function widget_simpleimage_init() {
|
130 |
-
register_widget('WP_Widget_Simple_Image');
|
131 |
-
}
|
132 |
-
add_action('init', 'widget_simpleimage_init', 1);
|
133 |
-
|
134 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|