Shortcoder - Version 4.0.3

Version Description

  • New: Added feature to sort created shortcodes list.
  • Fix: HTML errors in admin page
Download this release

Release Info

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

Code changes from version 4.0.2 to 4.0.3

admin/css/style-insert.css CHANGED
@@ -127,13 +127,15 @@ hr{
127
  color: #F44336;
128
  }
129
 
130
- .new_btn{
131
  float: right;
 
 
132
  border: 1px solid #cecece;
133
  color: #333;
134
- opacity: 0.4;
135
  }
136
- .new_btn:hover{
137
  opacity: 1;
138
  }
139
 
127
  color: #F44336;
128
  }
129
 
130
+ .sc_menu{
131
  float: right;
132
+ }
133
+ .sc_menu .button{
134
  border: 1px solid #cecece;
135
  color: #333;
136
+ opacity: 0.8;
137
  }
138
+ .sc_menu .button:hover{
139
  opacity: 1;
140
  }
141
 
admin/css/style.css CHANGED
@@ -124,11 +124,14 @@ h1.sc_title .title-count {
124
  color: #F44336;
125
  }
126
 
127
- .page_title .button{
128
  position: absolute;
129
  top: 10px;
130
  right: 20px;
131
  }
 
 
 
132
 
133
  #content .button .dashicons{
134
  margin: 0.5em 0 0 0;
@@ -257,6 +260,33 @@ h1.sc_title .title-count {
257
  margin-right: 5px;
258
  color: #838383;
259
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
  .coffee_box{
262
  padding: 15px 15px 25px 15px;
124
  color: #F44336;
125
  }
126
 
127
+ .sc_menu{
128
  position: absolute;
129
  top: 10px;
130
  right: 20px;
131
  }
132
+ .sc_menu > *{
133
+ margin-left: 10px !important;
134
+ }
135
 
136
  #content .button .dashicons{
137
  margin: 0.5em 0 0 0;
260
  margin-right: 5px;
261
  color: #838383;
262
  }
263
+ .share_btn{
264
+ background: #333;
265
+ color: #fff;
266
+ text-decoration: none;
267
+ padding: 4px 10px;
268
+ border-radius: 2em;
269
+ font-size: 12px;
270
+ line-height: 2em;
271
+ }
272
+ .share_btn:hover{
273
+ opacity: 0.5;
274
+ color: #fff;
275
+ }
276
+ .share_btn:active, .share_btn:focus{
277
+ color: #fff;
278
+ }
279
+ .share_btn .dashicons {
280
+ font-size: 14px;
281
+ margin: 5px 2px 0 0;
282
+ height: 14px;
283
+ }
284
+ .share_btn.twitter{
285
+ background-color: #2196F3;
286
+ }
287
+ .share_btn.googleplus{
288
+ background-color: #dd4b39;
289
+ }
290
 
291
  .coffee_box{
292
  padding: 15px 15px 25px 15px;
admin/js/script-insert.js CHANGED
@@ -2,6 +2,8 @@
2
 
3
  $(document).ready(function(){
4
 
 
 
5
  var send_editor = function( content = '' ){
6
  if( typeof parent.send_to_editor === 'function' ){
7
  parent.send_to_editor( content );
@@ -16,6 +18,24 @@ $(document).ready(function(){
16
  }
17
  }
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  $('.sc_shortcode_name').append('<span class="sc_toggle"></span>');
20
 
21
  $( document ).on( 'click', '.sc_insert', function(){
@@ -62,6 +82,11 @@ $(document).ready(function(){
62
  btn.attr( 'href', btn.data( 'link' ) + $(this).val() );
63
  });
64
 
 
 
 
 
 
65
  });
66
 
67
  })( jQuery );
2
 
3
  $(document).ready(function(){
4
 
5
+ var last_sort = 'desc';
6
+
7
  var send_editor = function( content = '' ){
8
  if( typeof parent.send_to_editor === 'function' ){
9
  parent.send_to_editor( content );
18
  }
19
  }
20
 
21
+ var sort = function( ele, orderby ){
22
+ var total = ele.length;
23
+ while( total ){
24
+ ele.each(function(){
25
+ var $cur = $(this);
26
+ var $next = $cur.next();
27
+ if( $next.length ){
28
+ var cur_name = $cur.attr( 'data-name' ).toLowerCase();
29
+ var nxt_name = $next.attr( 'data-name' ).toLowerCase();
30
+ if( ( orderby == 'asc' && cur_name > nxt_name ) || ( orderby == 'desc' && cur_name < nxt_name ) ){
31
+ $next.after( $cur );
32
+ }
33
+ }
34
+ });
35
+ total--;
36
+ }
37
+ }
38
+
39
  $('.sc_shortcode_name').append('<span class="sc_toggle"></span>');
40
 
41
  $( document ).on( 'click', '.sc_insert', function(){
82
  btn.attr( 'href', btn.data( 'link' ) + $(this).val() );
83
  });
84
 
85
+ $( document ).on( 'click', '.sort_btn', function(){
86
+ last_sort = ( last_sort == 'asc' ) ? 'desc' : 'asc';
87
+ sort( $( '.sc_shortcode' ), last_sort );
88
+ });
89
+
90
  });
91
 
92
  })( jQuery );
admin/js/script.js CHANGED
@@ -2,6 +2,25 @@
2
  $(document).ready(function(){
3
 
4
  var delete_ctext = 'Are you sure want to delete this shortcode ?';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  $( document ).on( 'click', '.sc_delete', function(e){
7
 
@@ -128,5 +147,12 @@ $(document).ready(function(){
128
  btn.attr( 'href', btn.data( 'link' ) + $(this).val() );
129
  });
130
 
 
 
 
 
 
 
 
131
  });
132
  })( jQuery );
2
  $(document).ready(function(){
3
 
4
  var delete_ctext = 'Are you sure want to delete this shortcode ?';
5
+ var last_sort = 'desc';
6
+
7
+ var sort = function( ele, orderby ){
8
+ var total = ele.length;
9
+ while( total ){
10
+ ele.each(function(){
11
+ var $cur = $(this);
12
+ var $next = $cur.next();
13
+ if( $next.length ){
14
+ var cur_name = $cur.attr( 'data-name' ).toLowerCase();
15
+ var nxt_name = $next.attr( 'data-name' ).toLowerCase();
16
+ if( ( orderby == 'asc' && cur_name > nxt_name ) || ( orderby == 'desc' && cur_name < nxt_name ) ){
17
+ $next.after( $cur );
18
+ }
19
+ }
20
+ });
21
+ total--;
22
+ }
23
+ }
24
 
25
  $( document ).on( 'click', '.sc_delete', function(e){
26
 
147
  btn.attr( 'href', btn.data( 'link' ) + $(this).val() );
148
  });
149
 
150
+ $( document ).on( 'click', '.sort_btn', function(){
151
+ last_sort = ( last_sort == 'asc' ) ? 'desc' : 'asc';
152
+ sort( $( '.sc_list li' ), last_sort );
153
+ $( '.sort_icon' ).toggleClass( 'dashicons-arrow-down-alt' );
154
+ $( '.sort_icon' ).toggleClass( 'dashicons-arrow-up-alt' );
155
+ });
156
+
157
  });
158
  })( jQuery );
admin/sc-admin.php CHANGED
@@ -84,11 +84,25 @@ class Shortcoder_Admin{
84
  public static function list_shortcodes(){
85
 
86
  $shortcodes = Shortcoder::list_all();
 
87
 
88
  echo '<h3 class="page_title">' . __( 'List of shortcodes created', 'shortcoder' );
 
 
89
  echo '<a href="' . self::get_link(array( 'action' => 'new' )) . '" class="button button-primary sc_new_btn"><span class="dashicons dashicons-plus"></span> ' . __( 'Create a new shortcode', 'shortcoder' ) . '</a>';
 
90
  echo '</h3>';
91
 
 
 
 
 
 
 
 
 
 
 
92
  echo '<ul class="sc_list" data-empty="' . __( 'No shortcodes are created. Go ahead create one !', 'shortcoder' ) . '">';
93
  foreach( $shortcodes as $name => $data ){
94
 
@@ -108,7 +122,7 @@ class Shortcoder_Admin{
108
 
109
  $disabled_text = ( $data[ 'disabled' ] == '1' ) ? '<small class="disabled_text">' . __( 'Temporarily disabled', 'shortcoder' ) . '</small>' : '';
110
 
111
- echo '<li>';
112
  echo '<a href="' . $link . '" class="sc_link" title="' . __( 'Edit shortcode', 'shortcoder' ) . '">' . $name . $disabled_text . '</a>';
113
  echo '<span class="sc_controls">';
114
  echo '<a href="#" class="sc_copy" title="' . __( 'Copy shortcode', 'shortcoder' ) . '"><span class="dashicons dashicons-editor-code"></span></a>';
@@ -160,7 +174,9 @@ class Shortcoder_Admin{
160
  $values = wp_parse_args( $values, Shortcoder::defaults() );
161
 
162
  echo '<h3 class="page_title">' . $page_title;
 
163
  echo '<a href="' . self::get_link() . '" class="button sc_back_btn"><span class="dashicons dashicons-arrow-left-alt2"></span> ' . __( 'Back', 'shortcoder' ) . '</a>';
 
164
  echo '</h3>';
165
 
166
  echo '<form method="post">';
@@ -388,7 +404,7 @@ class Shortcoder_Admin{
388
  <p>Thank you for using Shortcoder. If you found the plugin useful buy me a coffee ! Your donation will motivate and make me happy for all the efforts. You can donate via PayPal.</p>';
389
  echo '</div>';
390
 
391
- echo '<p class="credits_box"><img src="' . SC_ADMIN_URL . '/images/aw.png" /> Created by <a href="https://goo.gl/aHKnsM" target="_blank">Aakash Chakravarthy</a> - Follow me on <a href="https://twitter.com/vaakash", target="_blank">Twitter</a>, <a href="https://fb.com/aakashweb" target="_blank">Facebook</a>, <a href="https://www.linkedin.com/in/vaakash/" target="_blank">LinkedIn</a>. Check out <a href="https://goo.gl/OAxx4l" target="_blank">my other works</a>.
392
 
393
  <a href="https://goo.gl/ltvnIE" class="rate_link" target="_blank">Rate <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span> if you like Shortcoder</a>
394
 
@@ -403,28 +419,10 @@ class Shortcoder_Admin{
403
  <a href="https://goo.gl/r8Qr7Y" class="help_link" target="_blank" title="Help"><span class="dashicons dashicons-editor-help"></span></a>
404
  <a href="https://goo.gl/URfxp2" class="help_link" target="_blank" title="Report issue"><span class="dashicons dashicons-flag"></span></a>
405
 
406
- <div class="a2a_kit a2a_kit_size_32 a2a_default_style">
407
- <a class="a2a_button_twitter"></a>
408
- <a class="a2a_button_facebook"></a>
409
- <a class="a2a_button_google_plus"></a>
410
- <a class="a2a_dd" href="https://www.addtoany.com/share"></a>
411
- </div>
412
-
413
- <div class="admin_sb share_text">Share &amp; talk about<br/> Shortcoder</div>
414
 
415
  </div>';
416
-
417
- echo '
418
- <script>
419
- var a2a_config = a2a_config || {};
420
- a2a_config.linkname = "Shortcoder - A WordPress plugin to create custom Shortcodes for HTML, Javascript snippets !";
421
- a2a_config.linkurl = "https://www.aakashweb.com/wordpress-plugins/shortcoder/";
422
- a2a_config.templates = {
423
- twitter: "Check out ${title} ${link} - @vaakash"
424
- };
425
- </script>
426
- <script async src="https://static.addtoany.com/menu/page.js"></script>
427
- ';
428
  }
429
 
430
  public static function action_links( $links ){
84
  public static function list_shortcodes(){
85
 
86
  $shortcodes = Shortcoder::list_all();
87
+ $g = self::clean_get();
88
 
89
  echo '<h3 class="page_title">' . __( 'List of shortcodes created', 'shortcoder' );
90
+ echo '<span class="sc_menu">';
91
+ echo '<button class="button sort_btn" title="' . __( 'Sort list', 'shortcoder' ) . '"><span class="dashicons dashicons-menu"></span> <span class="dashicons dashicons-arrow-down-alt sort_icon"></span></button>';
92
  echo '<a href="' . self::get_link(array( 'action' => 'new' )) . '" class="button button-primary sc_new_btn"><span class="dashicons dashicons-plus"></span> ' . __( 'Create a new shortcode', 'shortcoder' ) . '</a>';
93
+ echo '</span>';
94
  echo '</h3>';
95
 
96
+ if( isset( $g[ 'sort' ] ) ){
97
+ $sort = $g[ 'sort' ];
98
+ if( $sort == 'asc' ){
99
+ uksort($shortcodes, 'strcasecmp' );
100
+ }else if( $sort == 'desc' ){
101
+ uksort($shortcodes, 'strcasecmp' );
102
+ $shortcodes = array_reverse( $shortcodes, True );
103
+ }
104
+ }
105
+
106
  echo '<ul class="sc_list" data-empty="' . __( 'No shortcodes are created. Go ahead create one !', 'shortcoder' ) . '">';
107
  foreach( $shortcodes as $name => $data ){
108
 
122
 
123
  $disabled_text = ( $data[ 'disabled' ] == '1' ) ? '<small class="disabled_text">' . __( 'Temporarily disabled', 'shortcoder' ) . '</small>' : '';
124
 
125
+ echo '<li data-name="' . esc_attr( $name ) . '">';
126
  echo '<a href="' . $link . '" class="sc_link" title="' . __( 'Edit shortcode', 'shortcoder' ) . '">' . $name . $disabled_text . '</a>';
127
  echo '<span class="sc_controls">';
128
  echo '<a href="#" class="sc_copy" title="' . __( 'Copy shortcode', 'shortcoder' ) . '"><span class="dashicons dashicons-editor-code"></span></a>';
174
  $values = wp_parse_args( $values, Shortcoder::defaults() );
175
 
176
  echo '<h3 class="page_title">' . $page_title;
177
+ echo '<div class="sc_menu">';
178
  echo '<a href="' . self::get_link() . '" class="button sc_back_btn"><span class="dashicons dashicons-arrow-left-alt2"></span> ' . __( 'Back', 'shortcoder' ) . '</a>';
179
+ echo '</div>';
180
  echo '</h3>';
181
 
182
  echo '<form method="post">';
404
  <p>Thank you for using Shortcoder. If you found the plugin useful buy me a coffee ! Your donation will motivate and make me happy for all the efforts. You can donate via PayPal.</p>';
405
  echo '</div>';
406
 
407
+ echo '<p class="credits_box"><img src="' . SC_ADMIN_URL . '/images/aw.png" /> Created by <a href="https://goo.gl/aHKnsM" target="_blank">Aakash Chakravarthy</a> - Follow me on <a href="https://twitter.com/vaakash" target="_blank">Twitter</a>, <a href="https://fb.com/aakashweb" target="_blank">Facebook</a>, <a href="https://www.linkedin.com/in/vaakash/" target="_blank">LinkedIn</a>. Check out <a href="https://goo.gl/OAxx4l" target="_blank">my other works</a>.
408
 
409
  <a href="https://goo.gl/ltvnIE" class="rate_link" target="_blank">Rate <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span> if you like Shortcoder</a>
410
 
419
  <a href="https://goo.gl/r8Qr7Y" class="help_link" target="_blank" title="Help"><span class="dashicons dashicons-editor-help"></span></a>
420
  <a href="https://goo.gl/URfxp2" class="help_link" target="_blank" title="Report issue"><span class="dashicons dashicons-flag"></span></a>
421
 
422
+ <a class="share_btn googleplus" href="https://plus.google.com/share?url=https%3A%2F%2Fwww.aakashweb.com%2Fwordpress-plugins%2Fshortcoder%2F" target="_blank"><span class="dashicons dashicons-googleplus"></span> Share</a>
423
+ <a class="share_btn twitter" href="https://twitter.com/intent/tweet?ref_src=twsrc%5Etfw&related=vaakash&text=Check%20out%20Shortcoder,%20a%20%23wordpress%20plugin%20to%20create%20shortcodes%20for%20HTML,%20JavaScript%20snippets%20easily&tw_p=tweetbutton&url=https%3A%2F%2Fwww.aakashweb.com%2Fwordpress-plugins%2Fwp-socializer%2F&via=vaakash" target="_blank"><span class="dashicons dashicons-twitter"></span> Tweet about Shortcoder</a>
 
 
 
 
 
 
424
 
425
  </div>';
 
 
 
 
 
 
 
 
 
 
 
 
426
  }
427
 
428
  public static function action_links( $links ){
admin/sc-insert.php CHANGED
@@ -1,13 +1,18 @@
1
  <html>
2
  <head>
3
  <title>Insert shortcode</title>
4
- <link href="<?php echo SC_ADMIN_URL; ?>css/style-insert.css" media="all" rel="stylesheet" />
5
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
6
- <script src="<?php echo SC_ADMIN_URL; ?>js/script-insert.js"></script>
7
  </head>
8
  <body>
9
 
10
- <h2 class="sc_head">Insert shortcode to editor <a href="<?php echo admin_url( 'options-general.php?page=shortcoder&action=new' ); ?>" target="_blank" class="button new_btn">Create new shortcode</a></h2>
 
 
 
 
 
11
 
12
  <div class="sc_wrap">
13
  <?php
1
  <html>
2
  <head>
3
  <title>Insert shortcode</title>
4
+ <link href="<?php echo SC_ADMIN_URL; ?>css/style-insert.css<?php echo '?ver=' . SC_VERSION; ?>" media="all" rel="stylesheet" />
5
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
6
+ <script src="<?php echo SC_ADMIN_URL; ?>js/script-insert.js<?php echo '?ver=' . SC_VERSION; ?>"></script>
7
  </head>
8
  <body>
9
 
10
+ <h2 class="sc_head">Insert shortcode to editor
11
+ <span class="sc_menu">
12
+ <a href="#" class="button sort_btn">Sort list</a>
13
+ <a href="<?php echo admin_url( 'options-general.php?page=shortcoder&action=new' ); ?>" target="_blank" class="button new_btn">Create new shortcode</a>
14
+ </span>
15
+ </h2>
16
 
17
  <div class="sc_wrap">
18
  <?php
readme.txt CHANGED
@@ -7,9 +7,9 @@ Donate link: https://goo.gl/qMF3iE
7
  License: GPLv2 or later
8
  Requires at least: 3.3
9
  Tested up to: 4.8
10
- Stable tag: 4.0.2
11
 
12
- Create custom "Shortcodes" easily for HTML, Javascript snippets and use the shortcodes within posts, pages & widgets.
13
 
14
  == Description ==
15
 
@@ -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.0.2 =
95
  * Fix: Sometimes `get_current_screen()` was called early in some setups.
96
 
7
  License: GPLv2 or later
8
  Requires at least: 3.3
9
  Tested up to: 4.8
10
+ Stable tag: 4.0.3
11
 
12
+ Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
13
 
14
  == Description ==
15
 
91
 
92
  == Changelog ==
93
 
94
+ = 4.0.3 =
95
+ * New: Added feature to sort created shortcodes list.
96
+ * Fix: HTML errors in admin page
97
+
98
  = 4.0.2 =
99
  * Fix: Sometimes `get_current_screen()` was called early in some setups.
100
 
shortcoder.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /*
3
  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.0.2
8
  Author URI: https://www.aakashweb.com/
9
  */
10
 
11
- define( 'SC_VERSION', '4.0.2');
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' ) );
1
  <?php
2
  /*
3
  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.0.3
8
  Author URI: https://www.aakashweb.com/
9
  */
10
 
11
+ define( 'SC_VERSION', '4.0.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' ) );