Shortcoder - Version 5.6

Version Description

Download this release

Release Info

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

Code changes from version 5.5 to 5.6

admin/css/style-insert.css CHANGED
@@ -196,6 +196,46 @@ p .button {
196
  border-radius: 10px;
197
  }
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  /** Footer **/
200
  .footer_thanks {
201
  margin: 20px 0 0 0;
196
  border-radius: 10px;
197
  }
198
 
199
+ /** Note **/
200
+ .note{
201
+ position: fixed;
202
+ bottom: 0;
203
+ left: 0;
204
+ right: 0;
205
+ background: #fff;
206
+ padding: 15px 20px;
207
+ border-top: 1px solid #dfdfdf;
208
+ box-shadow: 0 -2px 6px -5px #7d7d7d6e;
209
+ }
210
+ .note > p{
211
+ cursor: pointer;
212
+ font-size: 14px;
213
+ }
214
+ .note > p:hover{
215
+ color: #000;
216
+ }
217
+ .note table {
218
+ border-top: 1px solid #dfdfdf;
219
+ margin: 15px 0 0 0;
220
+ display: none;
221
+ }
222
+ .note pre{
223
+ background: #f7f7f7;
224
+ color: #333;
225
+ padding: 15px;
226
+ display: block;
227
+ margin: 0 0 20px 0;
228
+ border: 1px solid #dfdfdf;
229
+ }
230
+ .note td{
231
+ width: 50%;
232
+ padding: 15px 30px 0 30px;
233
+ vertical-align: top;
234
+ }
235
+ .note td p {
236
+ margin: 0 0 10px 0;
237
+ }
238
+
239
  /** Footer **/
240
  .footer_thanks {
241
  margin: 20px 0 0 0;
admin/insert.php CHANGED
@@ -118,6 +118,42 @@ if( empty( $shortcodes ) ){
118
  ?>
119
  </div>
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  <div class="footer_thanks">Thanks for using <a href="https://www.aakashweb.com/wordpress-plugins/shortcoder/" target="_blank">Shortcoder</a> &bull; Please <a href="https://wordpress.org/support/plugin/shortcoder/reviews/?rate=5#new-post" target="_blank">rate 5 stars</a> and spread the word.</div>
122
 
123
  <?php do_action( 'sc_do_insert_popup_footer' ); ?>
118
  ?>
119
  </div>
120
 
121
+ <div class="note">
122
+ <p><strong>Note:</strong> When shortcodes are inserted in a post, please ensure all the shortcodes are closed. Click for more details.</p>
123
+ <table>
124
+ <tr>
125
+ <td>
126
+ <pre>
127
+ Paragraph 1
128
+ [sc name="my-shortcode-1"]
129
+
130
+ Paragraph 2
131
+ [sc name="my-shortcode-2"]
132
+
133
+ Paragraph 3
134
+ [sc name="my-shortcode-3"][/sc]
135
+ </pre>
136
+ <p>❌ Here, everything between <code>my-shortcode-1</code> and <code>my-shortcode-3</code> won't be displayed because <code>my-shortcode-3</code> has a closing shortcode.</p>
137
+ <p>So all the contents between <code>[sc name="my-shortcode-1"] ... [/sc]</code> are taken inside <code>my-shortcode-1</code>.</p>
138
+ </td>
139
+
140
+ <td>
141
+ <pre>
142
+ Paragraph 1
143
+ [sc name="my-shortcode-1"][/sc]
144
+
145
+ Paragraph 2
146
+ [sc name="my-shortcode-2"][/sc]
147
+
148
+ Paragraph 3
149
+ [sc name="my-shortcode-3"][/sc]
150
+ </pre>
151
+ <p>✅ Close all the Shortcoder's shortcodes in a post with <code>[/sc]</code>. <a href="https://codex.wordpress.org/Shortcode_API#Unclosed_Shortcodes" target="_blank">Learn more</a></p>
152
+ </td>
153
+ </tr>
154
+ </table>
155
+ </div>
156
+
157
  <div class="footer_thanks">Thanks for using <a href="https://www.aakashweb.com/wordpress-plugins/shortcoder/" target="_blank">Shortcoder</a> &bull; Please <a href="https://wordpress.org/support/plugin/shortcoder/reviews/?rate=5#new-post" target="_blank">rate 5 stars</a> and spread the word.</div>
158
 
159
  <?php do_action( 'sc_do_insert_popup_footer' ); ?>
admin/js/script-insert.js CHANGED
@@ -175,6 +175,10 @@ $(document).ready(function(){
175
  $btn.attr('href', $btn.data('link') + $(this).val());
176
  });
177
 
 
 
 
 
178
  window.addEventListener('message', function(e){
179
  var key = e.message ? 'message' : 'data';
180
  var data = e[key];
175
  $btn.attr('href', $btn.data('link') + $(this).val());
176
  });
177
 
178
+ $('.note').on('click', function(){
179
+ $(this).find('table').slideToggle();
180
+ });
181
+
182
  window.addEventListener('message', function(e){
183
  var key = e.message ? 'message' : 'data';
184
  var data = e[key];
admin/js/script.js CHANGED
@@ -33,7 +33,7 @@ $(document).ready(function(){
33
  }
34
 
35
  var set_sc_preview_text = function(name){
36
- $('.sc_preview_text').text('[sc name="' + name + '"]');
37
  }
38
 
39
  var insert_in_editor = function(data){
33
  }
34
 
35
  var set_sc_preview_text = function(name){
36
+ $('.sc_preview_text').text('[sc name="' + name + '"][/sc]');
37
  }
38
 
39
  var insert_in_editor = function(data){
readme.txt CHANGED
@@ -7,8 +7,8 @@ Donate link: https://www.paypal.me/vaakash/
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
  Requires at least: 4.9.0
10
- Tested up to: 5.7.2
11
- Stable tag: 5.5
12
 
13
  Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
14
 
@@ -114,6 +114,11 @@ No, right now the plugin supports only HTML, Javascript and CSS as shortcode con
114
 
115
  ## Changelog
116
 
 
 
 
 
 
117
  ### 5.5
118
  * New: General settings page to configure default editor and shortcode content.
119
  * New: Block to insert shortcode rewritten from scratch.
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
  Requires at least: 4.9.0
10
+ Tested up to: 5.8
11
+ Stable tag: 5.6
12
 
13
  Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
14
 
114
 
115
  ## Changelog
116
 
117
+ ### 5.6
118
+ * New: Shortcodes available to copy/insert are now closed by default.
119
+ * Fix: Custom parameter value 0 is not displayed.
120
+ * Fix: Support for WordPress 5.8
121
+
122
  ### 5.5
123
  * New: General settings page to configure default editor and shortcode content.
124
  * New: Block to insert shortcode rewritten from scratch.
shortcoder.php CHANGED
@@ -4,13 +4,13 @@ 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.5
8
  Author URI: https://www.aakashweb.com/
9
  Text Domain: shortcoder
10
  Domain Path: /languages
11
  */
12
 
13
- define( 'SC_VERSION', '5.5' );
14
  define( 'SC_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
15
  define( 'SC_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'SC_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
@@ -156,7 +156,7 @@ final class Shortcoder{
156
 
157
  public static function get_sc_tag( $post_id ){
158
  $post = get_post( $post_id );
159
- return '[sc name="' . $post->post_name . '"]';
160
  }
161
 
162
  public static function find_shortcode( $atts, $shortcodes ){
@@ -250,7 +250,7 @@ final class Shortcoder{
250
 
251
  }
252
 
253
- if( empty( $value ) ){
254
  array_push( $to_replace, $default );
255
  }else{
256
  array_push( $to_replace, $value );
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.6
8
  Author URI: https://www.aakashweb.com/
9
  Text Domain: shortcoder
10
  Domain Path: /languages
11
  */
12
 
13
+ define( 'SC_VERSION', '5.6' );
14
  define( 'SC_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
15
  define( 'SC_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'SC_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
156
 
157
  public static function get_sc_tag( $post_id ){
158
  $post = get_post( $post_id );
159
+ return '[sc name="' . $post->post_name . '"][/sc]';
160
  }
161
 
162
  public static function find_shortcode( $atts, $shortcodes ){
250
 
251
  }
252
 
253
+ if( $value == '' ){
254
  array_push( $to_replace, $default );
255
  }else{
256
  array_push( $to_replace, $value );