Version Description
- Fix:
script
andstyle
tags stripped after 4.x upgrade. New migration will run in this version and shortcode content will now be fixed.
Download this release
Release Info
Developer | vaakash |
Plugin | Shortcoder |
Version | 5.0.4 |
Comparing to | |
See all releases |
Code changes from version 5.0.3 to 5.0.4
- includes/updates.php +61 -1
- readme.txt +4 -1
- shortcoder.php +2 -2
includes/updates.php
CHANGED
@@ -23,7 +23,7 @@ class Shortcoder_Updates{
|
|
23 |
return false;
|
24 |
}
|
25 |
|
26 |
-
set_transient( 'sc_upgrade', 'yes', MINUTE_IN_SECONDS *
|
27 |
|
28 |
if( version_compare( $previous_version, '5.0', '<' ) ){
|
29 |
if( !self::do_update_50() ){
|
@@ -31,6 +31,12 @@ class Shortcoder_Updates{
|
|
31 |
}
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
// Register roles everytime plugin is updated.
|
35 |
self::register_roles();
|
36 |
|
@@ -49,6 +55,10 @@ class Shortcoder_Updates{
|
|
49 |
return true;
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
52 |
foreach( $o_scs as $o_name => $o_props ){
|
53 |
|
54 |
if( array_key_exists( 'post_id', $o_props ) || array_key_exists( $o_name, $n_scs ) ){
|
@@ -94,6 +104,56 @@ class Shortcoder_Updates{
|
|
94 |
|
95 |
update_option( 'shortcoder_data', $o_scs );
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
return true;
|
98 |
|
99 |
}
|
23 |
return false;
|
24 |
}
|
25 |
|
26 |
+
set_transient( 'sc_upgrade', 'yes', MINUTE_IN_SECONDS * 3 );
|
27 |
|
28 |
if( version_compare( $previous_version, '5.0', '<' ) ){
|
29 |
if( !self::do_update_50() ){
|
31 |
}
|
32 |
}
|
33 |
|
34 |
+
if( version_compare( $previous_version, '5.0', '>' ) ){
|
35 |
+
if( !self::do_update_504() ){
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
// Register roles everytime plugin is updated.
|
41 |
self::register_roles();
|
42 |
|
55 |
return true;
|
56 |
}
|
57 |
|
58 |
+
// Remove kses filtering before the migration
|
59 |
+
remove_filter( 'content_save_pre', 'wp_filter_post_kses' );
|
60 |
+
remove_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
|
61 |
+
|
62 |
foreach( $o_scs as $o_name => $o_props ){
|
63 |
|
64 |
if( array_key_exists( 'post_id', $o_props ) || array_key_exists( $o_name, $n_scs ) ){
|
104 |
|
105 |
update_option( 'shortcoder_data', $o_scs );
|
106 |
|
107 |
+
// Enabling the filters back
|
108 |
+
add_filter( 'content_save_pre', 'wp_filter_post_kses' );
|
109 |
+
add_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
|
110 |
+
|
111 |
+
return true;
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
public static function do_update_504(){
|
116 |
+
|
117 |
+
$o_scs = get_option( 'shortcoder_data' );
|
118 |
+
|
119 |
+
if( empty( $o_scs ) ){
|
120 |
+
return true;
|
121 |
+
}
|
122 |
+
|
123 |
+
// Remove kses filtering before the migration
|
124 |
+
remove_filter( 'content_save_pre', 'wp_filter_post_kses' );
|
125 |
+
remove_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
|
126 |
+
|
127 |
+
foreach( $o_scs as $o_name => $o_props ){
|
128 |
+
|
129 |
+
if( !array_key_exists( 'post_id', $o_props ) || !isset( $o_props[ 'content' ] ) ){
|
130 |
+
continue;
|
131 |
+
}
|
132 |
+
|
133 |
+
if( array_key_exists( '_scc_fix', $o_props ) ){
|
134 |
+
continue;
|
135 |
+
}
|
136 |
+
|
137 |
+
$sc_pid = $o_props[ 'post_id' ];
|
138 |
+
$sc_content = $o_props[ 'content' ];
|
139 |
+
|
140 |
+
wp_insert_post( array(
|
141 |
+
'ID' => $sc_pid,
|
142 |
+
'post_content' => $sc_content,
|
143 |
+
'post_type' => SC_POST_TYPE,
|
144 |
+
'post_status' => 'publish'
|
145 |
+
));
|
146 |
+
|
147 |
+
$o_scs[ $o_name ][ '_scc_fix' ] = true;
|
148 |
+
|
149 |
+
}
|
150 |
+
|
151 |
+
update_option( 'shortcoder_data', $o_scs );
|
152 |
+
|
153 |
+
// Enabling the filters back
|
154 |
+
add_filter( 'content_save_pre', 'wp_filter_post_kses' );
|
155 |
+
add_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
|
156 |
+
|
157 |
return true;
|
158 |
|
159 |
}
|
readme.txt
CHANGED
@@ -8,7 +8,7 @@ License: GPLv2 or later
|
|
8 |
Requires PHP: 5.3
|
9 |
Requires at least: 4.4
|
10 |
Tested up to: 5.3.2
|
11 |
-
Stable tag: 5.0.
|
12 |
|
13 |
Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
|
14 |
|
@@ -88,6 +88,9 @@ Please check the following if you notice that the shortcode content is not print
|
|
88 |
|
89 |
== Changelog ==
|
90 |
|
|
|
|
|
|
|
91 |
= 5.0.3 =
|
92 |
* Fix: Shortcode content is not escaped when code editor is used. This is requirement because `post_content` behaves strangely when user has rich editing enabled.
|
93 |
|
8 |
Requires PHP: 5.3
|
9 |
Requires at least: 4.4
|
10 |
Tested up to: 5.3.2
|
11 |
+
Stable tag: 5.0.4
|
12 |
|
13 |
Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
|
14 |
|
88 |
|
89 |
== Changelog ==
|
90 |
|
91 |
+
= 5.0.4 =
|
92 |
+
* Fix: `script` and `style` tags stripped after 4.x upgrade. New migration will run in this version and shortcode content will now be fixed.
|
93 |
+
|
94 |
= 5.0.3 =
|
95 |
* Fix: Shortcode content is not escaped when code editor is used. This is requirement because `post_content` behaves strangely when user has rich editing enabled.
|
96 |
|
shortcoder.php
CHANGED
@@ -4,11 +4,11 @@ Plugin Name: Shortcoder
|
|
4 |
Plugin URI: https://www.aakashweb.com/wordpress-plugins/shortcoder/
|
5 |
Description: Shortcoder plugin allows to create a custom shortcodes for HTML, JavaScript and other snippets. Now the shortcodes can be used in posts/pages and the snippet will be replaced in place.
|
6 |
Author: Aakash Chakravarthy
|
7 |
-
Version: 5.0.
|
8 |
Author URI: https://www.aakashweb.com/
|
9 |
*/
|
10 |
|
11 |
-
define( 'SC_VERSION', '5.0.
|
12 |
define( 'SC_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
|
13 |
define( 'SC_URL', plugin_dir_url( __FILE__ ) );
|
14 |
define( 'SC_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
|
4 |
Plugin URI: https://www.aakashweb.com/wordpress-plugins/shortcoder/
|
5 |
Description: Shortcoder plugin allows to create a custom shortcodes for HTML, JavaScript and other snippets. Now the shortcodes can be used in posts/pages and the snippet will be replaced in place.
|
6 |
Author: Aakash Chakravarthy
|
7 |
+
Version: 5.0.4
|
8 |
Author URI: https://www.aakashweb.com/
|
9 |
*/
|
10 |
|
11 |
+
define( 'SC_VERSION', '5.0.4' );
|
12 |
define( 'SC_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
|
13 |
define( 'SC_URL', plugin_dir_url( __FILE__ ) );
|
14 |
define( 'SC_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
|