Version Description
- Updated compatibility with WordPress 4.8
- Reversed the order of changelog
Download this release
Release Info
Developer | gagan0123 |
Plugin | Shortcode Widget |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 1.4
- class-shortcode-widget.php +0 -72
- readme.txt +20 -16
- shortcode-widget.php +1 -1
class-shortcode-widget.php
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Shortcode Widget Class
|
4 |
-
*
|
5 |
-
* @since 0.1
|
6 |
-
*/
|
7 |
-
class Shortcode_Widget extends WP_Widget {
|
8 |
-
|
9 |
-
public function __construct() {
|
10 |
-
$widget_ops = array('classname' => 'shortcode_widget', 'description' => __('Shortcode or HTML or Plain Text.', SHORTCODE_WIDGET_TEXT_DOMAIN));
|
11 |
-
$control_ops = array('width' => 400, 'height' => 350);
|
12 |
-
parent::__construct('shortcode-widget', __('Shortcode Widget', SHORTCODE_WIDGET_TEXT_DOMAIN), $widget_ops, $control_ops);
|
13 |
-
}
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @param array $args
|
17 |
-
* @param array $instance
|
18 |
-
*/
|
19 |
-
public function widget( $args, $instance ) {
|
20 |
-
/** This filter is documented in wp-includes/default-widgets.php */
|
21 |
-
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Filter the content of the Text widget.
|
25 |
-
*
|
26 |
-
* @param string $widget_text The widget content.
|
27 |
-
* @param WP_Widget $instance WP_Widget instance.
|
28 |
-
*/
|
29 |
-
$text = do_shortcode(apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance ));
|
30 |
-
echo $args['before_widget'];
|
31 |
-
if ( ! empty( $title ) ) {
|
32 |
-
echo $args['before_title'] . $title . $args['after_title'];
|
33 |
-
} ?>
|
34 |
-
<div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
|
35 |
-
<?php
|
36 |
-
echo $args['after_widget'];
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* @param array $new_instance
|
41 |
-
* @param array $old_instance
|
42 |
-
* @return array
|
43 |
-
*/
|
44 |
-
public function update( $new_instance, $old_instance ) {
|
45 |
-
$instance = $old_instance;
|
46 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
47 |
-
if ( current_user_can('unfiltered_html') )
|
48 |
-
$instance['text'] = $new_instance['text'];
|
49 |
-
else
|
50 |
-
$instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed
|
51 |
-
$instance['filter'] = ! empty( $new_instance['filter'] );
|
52 |
-
return $instance;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* @param array $instance
|
57 |
-
*/
|
58 |
-
public function form( $instance ) {
|
59 |
-
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
|
60 |
-
$title = strip_tags($instance['title']);
|
61 |
-
$text = esc_textarea($instance['text']);
|
62 |
-
?>
|
63 |
-
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', SHORTCODE_WIDGET_TEXT_DOMAIN); ?></label>
|
64 |
-
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
65 |
-
|
66 |
-
<p><label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label>
|
67 |
-
<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea></p>
|
68 |
-
|
69 |
-
<p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> /> <label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs', SHORTCODE_WIDGET_TEXT_DOMAIN); ?></label></p>
|
70 |
-
<?php
|
71 |
-
}
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: gagan0123
|
3 |
Tags: Shortcode, Widget
|
4 |
Requires at least: 3.3
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -23,25 +23,29 @@ To test the widget you can add the widget and use the shortcode "[shortcode_widg
|
|
23 |
|
24 |
== Changelog ==
|
25 |
|
26 |
-
=
|
27 |
-
*
|
|
|
28 |
|
29 |
-
=
|
30 |
-
*
|
|
|
|
|
31 |
|
32 |
-
=
|
33 |
-
*
|
|
|
|
|
|
|
34 |
|
35 |
= 1.0 =
|
36 |
* Tested with WP 4.0
|
37 |
|
38 |
-
=
|
39 |
-
*
|
40 |
|
41 |
-
=
|
42 |
-
*
|
43 |
|
44 |
-
= 1
|
45 |
-
*
|
46 |
-
* Changed tested up to version number
|
47 |
-
* Made it translation ready, constant was being used for text domains, silly error, I know :)
|
2 |
Contributors: gagan0123
|
3 |
Tags: Shortcode, Widget
|
4 |
Requires at least: 3.3
|
5 |
+
Tested up to: 4.8
|
6 |
+
Stable tag: 1.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
23 |
|
24 |
== Changelog ==
|
25 |
|
26 |
+
= 1.4 =
|
27 |
+
* Updated compatibility with WordPress 4.8
|
28 |
+
* Reversed the order of changelog
|
29 |
|
30 |
+
= 1.3 =
|
31 |
+
* Minor bug fix
|
32 |
+
* Changed tested up to version number
|
33 |
+
* Made it translation ready, constant was being used for text domains, silly error, I know :)
|
34 |
|
35 |
+
= 1.2 =
|
36 |
+
* Corrections in text domain and added one more string as translatable
|
37 |
+
|
38 |
+
= 1.1 =
|
39 |
+
* Reflecting the changes that have been done to the default text widget over the years
|
40 |
|
41 |
= 1.0 =
|
42 |
* Tested with WP 4.0
|
43 |
|
44 |
+
= 0.3 =
|
45 |
+
* Added a shortcode for testing the plugin '[shortcode_widget_test]'
|
46 |
|
47 |
+
= 0.2 =
|
48 |
+
* Added translation support
|
49 |
|
50 |
+
= 0.1 =
|
51 |
+
* Added the shortcode widget
|
|
|
|
shortcode-widget.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
Description: Adds a text-like widget that allows you to write shortcode in it. (Just whats missing in the default text widget)
|
7 |
Author: Gagan Deep Singh
|
8 |
Author URI: http://gagan.pro/
|
9 |
-
Version: 1.
|
10 |
Text Domain: shortcode-widget
|
11 |
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
12 |
*/
|
6 |
Description: Adds a text-like widget that allows you to write shortcode in it. (Just whats missing in the default text widget)
|
7 |
Author: Gagan Deep Singh
|
8 |
Author URI: http://gagan.pro/
|
9 |
+
Version: 1.4
|
10 |
Text Domain: shortcode-widget
|
11 |
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
12 |
*/
|