Shortcoder - Version 4.4

Version Description

  • New: Insert shortcode automatically adds "closing tag" if the shortcode has enclosed content parameter.
  • Fix: Codemirror has been updated to latest version.
Download this release

Release Info

Developer vaakash
Plugin Icon 128x128 Shortcoder
Version 4.4
Comparing to
See all releases

Code changes from version 4.3 to 4.4

admin/js/script-insert.js CHANGED
@@ -8,7 +8,7 @@ $(document).ready(function(){
8
  if( typeof parent.send_to_editor === 'function' ){
9
  parent.send_to_editor( content );
10
  }else{
11
- alert( 'Editor does not exist. Cannot insert content !' );
12
  }
13
  }
14
 
@@ -53,6 +53,11 @@ $(document).ready(function(){
53
  });
54
 
55
  sc = '[sc name="' + scname + '" ' + params + ']';
 
 
 
 
 
56
  send_editor( sc );
57
  close_window();
58
 
8
  if( typeof parent.send_to_editor === 'function' ){
9
  parent.send_to_editor( content );
10
  }else{
11
+ alert( 'Editor does not exist. Cannot insert shortcode !' );
12
  }
13
  }
14
 
53
  });
54
 
55
  sc = '[sc name="' + scname + '" ' + params + ']';
56
+
57
+ if( $(this).hasClass( 'has_enclosed_sc' ) ){
58
+ sc += '[/sc]';
59
+ }
60
+
61
  send_editor( sc );
62
  close_window();
63
 
admin/sc-admin.php CHANGED
@@ -494,13 +494,13 @@ class Shortcoder_Admin{
494
  }
495
 
496
  public static function load_codemirror_editor( $value ){
497
- echo '<link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.0/codemirror.min.css" rel="stylesheet">';
498
- echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.0/codemirror.min.js"></script>';
499
- echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.0/mode/htmlmixed/htmlmixed.min.js"></script>';
500
- echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.0/mode/css/css.min.js"></script>';
501
- echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.0/mode/xml/xml.min.js"></script>';
502
- echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.0/mode/javascript/javascript.min.js"></script>';
503
- echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.0/addon/selection/active-line.min.js"></script>';
504
 
505
  echo '<div class="sc_cm_menu"></div>';
506
  echo '<textarea name="sc_content" id="sc_content">' . esc_textarea( $value ) . '</textarea>';
494
  }
495
 
496
  public static function load_codemirror_editor( $value ){
497
+ echo '<link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/codemirror.min.css" rel="stylesheet">';
498
+ echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/codemirror.min.js"></script>';
499
+ echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/mode/htmlmixed/htmlmixed.min.js"></script>';
500
+ echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/mode/css/css.min.js"></script>';
501
+ echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/mode/xml/xml.min.js"></script>';
502
+ echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/mode/javascript/javascript.min.js"></script>';
503
+ echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/addon/selection/active-line.min.js"></script>';
504
 
505
  echo '<div class="sc_cm_menu"></div>';
506
  echo '<textarea name="sc_content" id="sc_content">' . esc_textarea( $value ) . '</textarea>';
admin/sc-insert.php CHANGED
@@ -80,7 +80,10 @@ if( empty( $shortcodes ) ){
80
  }else{
81
  echo 'No parameters available - ';
82
  }
83
- echo '<input type="button" class="sc_insert button button-primary" value="Insert Shortcode"/>';
 
 
 
84
  echo '</div>';
85
  echo '</div>';
86
  }
80
  }else{
81
  echo 'No parameters available - ';
82
  }
83
+
84
+ $enclosed_sc = ( strpos( $value['content'], '$$enclosed_content$$' ) !== false ) ? 'has_enclosed_sc' : '';
85
+
86
+ echo '<input type="button" class="sc_insert button button-primary ' . $enclosed_sc . '" value="Insert Shortcode"/>';
87
  echo '</div>';
88
  echo '</div>';
89
  }
readme.txt CHANGED
@@ -6,8 +6,8 @@ Tags: shortcode, html, javascript, shortcodes, short code, posts, pages, widgets
6
  Donate link: https://goo.gl/qMF3iE
7
  License: GPLv2 or later
8
  Requires at least: 4.4.0
9
- Tested up to: 5.0.3
10
- Stable tag: 4.3
11
 
12
  Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
13
 
@@ -91,6 +91,10 @@ Note: When you disable a shortcode, the shortcode will not be executed in the pa
91
 
92
  == Changelog ==
93
 
 
 
 
 
94
  = 4.3 =
95
  * New: Edit shortcode name after creating.
96
  * New: Post modified date parameter added.
6
  Donate link: https://goo.gl/qMF3iE
7
  License: GPLv2 or later
8
  Requires at least: 4.4.0
9
+ Tested up to: 5.2
10
+ Stable tag: 4.4
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.4 =
95
+ * New: Insert shortcode automatically adds "closing tag" if the shortcode has enclosed content parameter.
96
+ * Fix: Codemirror has been updated to latest version.
97
+
98
  = 4.3 =
99
  * New: Edit shortcode name after creating.
100
  * New: Post modified date parameter added.
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.3
8
  Author URI: https://www.aakashweb.com/
9
  */
10
 
11
- define( 'SC_VERSION', '4.3' );
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' ) );
@@ -18,6 +18,9 @@ class Shortcoder{
18
 
19
  public static function init(){
20
 
 
 
 
21
  add_action( 'plugins_loaded', array( __class__, 'load_text_domain' ) );
22
 
23
  register_activation_hook( __FILE__, array( __class__, 'on_activate' ) );
@@ -27,9 +30,6 @@ class Shortcoder{
27
  // Register the shortcode
28
  add_shortcode( 'sc', array( __class__, 'execute_shortcode' ) );
29
 
30
- // Include the required
31
- self::includes();
32
-
33
  }
34
 
35
  public static function list_all(){
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.4
8
  Author URI: https://www.aakashweb.com/
9
  */
10
 
11
+ define( 'SC_VERSION', '4.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' ) );
18
 
19
  public static function init(){
20
 
21
+ // Include the required
22
+ self::includes();
23
+
24
  add_action( 'plugins_loaded', array( __class__, 'load_text_domain' ) );
25
 
26
  register_activation_hook( __FILE__, array( __class__, 'on_activate' ) );
30
  // Register the shortcode
31
  add_shortcode( 'sc', array( __class__, 'execute_shortcode' ) );
32
 
 
 
 
33
  }
34
 
35
  public static function list_all(){