Version Description
- Fix: Show proper error when shortcoder saving fails.
- Fix: Shortcode metadata throws undefined url error sometimes.
- Fix: Show proper error when Code editor fails to load.
Download this release
Release Info
Developer | vaakash |
Plugin | Shortcoder |
Version | 4.6 |
Comparing to | |
See all releases |
Code changes from version 4.5 to 4.6
- admin/js/script.js +15 -11
- admin/sc-admin.php +18 -7
- includes/metadata.php +5 -4
- readme.txt +6 -1
- shortcoder.php +2 -2
admin/js/script.js
CHANGED
@@ -7,17 +7,21 @@ $(document).ready(function(){
|
|
7 |
|
8 |
var init = function(){
|
9 |
if(window.sc_cm_editor){
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
sc_cm.
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
if( $.fn.selectize ){
|
7 |
|
8 |
var init = function(){
|
9 |
if(window.sc_cm_editor){
|
10 |
+
if( typeof CodeMirror.fromTextArea !== 'undefined' ){
|
11 |
+
window.sc_cm = CodeMirror.fromTextArea( document.getElementById( 'sc_content' ), {
|
12 |
+
lineNumbers: true,
|
13 |
+
mode: "htmlmixed",
|
14 |
+
indentWithTabs: false,
|
15 |
+
lineWrapping: true,
|
16 |
+
styleActiveLine: true
|
17 |
+
});
|
18 |
+
sc_cm.setSize( null, 500 );
|
19 |
+
sc_cm.on( 'change', function(){
|
20 |
+
sc_cm.save();
|
21 |
+
});
|
22 |
+
}else{
|
23 |
+
alert('Cannot load code editor. Looks like there is a conflict with some other plugin.');
|
24 |
+
}
|
25 |
}
|
26 |
|
27 |
if( $.fn.selectize ){
|
admin/sc-admin.php
CHANGED
@@ -368,16 +368,22 @@ class Shortcoder_Admin{
|
|
368 |
unset( $shortcodes[ $old_name ] );
|
369 |
}
|
370 |
|
371 |
-
|
372 |
-
|
373 |
-
}else{
|
374 |
-
self::print_notice( 1 );
|
375 |
-
}
|
376 |
-
|
377 |
$shortcodes[ $name ] = $values;
|
378 |
|
379 |
-
update_option( 'shortcoder_data', $shortcodes );
|
380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
if( $sc_name_changed ){
|
382 |
wp_safe_redirect( self::get_link( array(
|
383 |
'action' => 'edit',
|
@@ -593,6 +599,11 @@ class Shortcoder_Admin{
|
|
593 |
$msg = __( 'Shortcode name edited successfully', 'shortcoder' );
|
594 |
}
|
595 |
|
|
|
|
|
|
|
|
|
|
|
596 |
if( $msg != '' ){
|
597 |
echo '<div class="notice notice-' . $type . ' is-dismissible"><p>' . $msg . '</p></div>';
|
598 |
}
|
368 |
unset( $shortcodes[ $old_name ] );
|
369 |
}
|
370 |
|
371 |
+
$is_new_shortcode = array_key_exists( $name, $shortcodes );
|
372 |
+
|
|
|
|
|
|
|
|
|
373 |
$shortcodes[ $name ] = $values;
|
374 |
|
375 |
+
$save_success = update_option( 'shortcoder_data', $shortcodes );
|
376 |
|
377 |
+
if( $save_success ){
|
378 |
+
if( $is_new_shortcode ){
|
379 |
+
self::print_notice( 2 );
|
380 |
+
}else{
|
381 |
+
self::print_notice( 1 );
|
382 |
+
}
|
383 |
+
}else{
|
384 |
+
self::print_notice( 5 );
|
385 |
+
}
|
386 |
+
|
387 |
if( $sc_name_changed ){
|
388 |
wp_safe_redirect( self::get_link( array(
|
389 |
'action' => 'edit',
|
599 |
$msg = __( 'Shortcode name edited successfully', 'shortcoder' );
|
600 |
}
|
601 |
|
602 |
+
if( $id == 5 ){
|
603 |
+
$msg = __( 'Failed to save shortcode. Please check if any other plugin is interfering while saving the shortcode content.', 'shortcoder' );
|
604 |
+
$type = 'error';
|
605 |
+
}
|
606 |
+
|
607 |
if( $msg != '' ){
|
608 |
echo '<div class="notice notice-' . $type . ' is-dismissible"><p>' . $msg . '</p></div>';
|
609 |
}
|
includes/metadata.php
CHANGED
@@ -173,10 +173,11 @@ class Shortcoder_Metadata{
|
|
173 |
'post_date' => get_the_date(),
|
174 |
'post_modified_date' => get_the_modified_date()
|
175 |
);
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
|
|
180 |
}
|
181 |
|
182 |
return $d;
|
173 |
'post_date' => get_the_date(),
|
174 |
'post_modified_date' => get_the_modified_date()
|
175 |
);
|
176 |
+
|
177 |
+
if( empty( $d[ 'short_url' ] ) ){
|
178 |
+
$d[ 'short_url' ] = $d[ 'url' ];
|
179 |
+
}
|
180 |
+
|
181 |
}
|
182 |
|
183 |
return $d;
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ Donate link: https://www.paypal.me/vaakash/6
|
|
7 |
License: GPLv2 or later
|
8 |
Requires at least: 4.4.0
|
9 |
Tested up to: 5.2.2
|
10 |
-
Stable tag: 4.
|
11 |
|
12 |
Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
|
13 |
|
@@ -91,6 +91,11 @@ Note: When you disable a shortcode, the shortcode will not be executed in the pa
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
|
|
|
|
94 |
= 4.5 =
|
95 |
* Fix: Copy shortcode box having incorrect width.
|
96 |
* Fix: Codemirror has been updated to latest version.
|
7 |
License: GPLv2 or later
|
8 |
Requires at least: 4.4.0
|
9 |
Tested up to: 5.2.2
|
10 |
+
Stable tag: 4.6
|
11 |
|
12 |
Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
|
13 |
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 4.6 =
|
95 |
+
* Fix: Show proper error when shortcoder saving fails.
|
96 |
+
* Fix: Shortcode metadata throws undefined url error sometimes.
|
97 |
+
* Fix: Show proper error when Code editor fails to load.
|
98 |
+
|
99 |
= 4.5 =
|
100 |
* Fix: Copy shortcode box having incorrect width.
|
101 |
* Fix: Codemirror has been updated to latest version.
|
shortcoder.php
CHANGED
@@ -4,11 +4,11 @@ Plugin Name: Shortcoder
|
|
4 |
Plugin URI: https://www.aakashweb.com/
|
5 |
Description: Shortcoder is a plugin which allows to create a custom shortcode and store HTML, JavaScript and other snippets in it. So if that shortcode is used in any post or pages, then the code stored in the shortcode get executed in that place. You can create a shortcode for Youtube videos, adsense ads, buttons and more.
|
6 |
Author: Aakash Chakravarthy
|
7 |
-
Version: 4.
|
8 |
Author URI: https://www.aakashweb.com/
|
9 |
*/
|
10 |
|
11 |
-
define( 'SC_VERSION', '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' ) );
|
4 |
Plugin URI: https://www.aakashweb.com/
|
5 |
Description: Shortcoder is a plugin which allows to create a custom shortcode and store HTML, JavaScript and other snippets in it. So if that shortcode is used in any post or pages, then the code stored in the shortcode get executed in that place. You can create a shortcode for Youtube videos, adsense ads, buttons and more.
|
6 |
Author: Aakash Chakravarthy
|
7 |
+
Version: 4.6
|
8 |
Author URI: https://www.aakashweb.com/
|
9 |
*/
|
10 |
|
11 |
+
define( 'SC_VERSION', '4.6' );
|
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' ) );
|