Shortcoder - Version 5.7

Version Description

Download this release

Release Info

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

Code changes from version 5.6 to 5.7

admin/css/style-insert.css CHANGED
@@ -202,7 +202,7 @@ p .button {
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;
202
  bottom: 0;
203
  left: 0;
204
  right: 0;
205
+ background: #ffffe2;
206
  padding: 15px 20px;
207
  border-top: 1px solid #dfdfdf;
208
  box-shadow: 0 -2px 6px -5px #7d7d7d6e;
admin/css/style.css CHANGED
@@ -116,7 +116,7 @@
116
  box-shadow: 0 2px 5px -2px rgba(0,0,0,.2);
117
  border: 1px solid #dfdfdf;
118
  z-index: 9999;
119
- max-height: 300px;
120
  overflow: auto;
121
  }
122
  .sc_params_list li:hover ul{
@@ -137,7 +137,7 @@
137
 
138
  .sc_params_form{
139
  cursor: auto !important;
140
- width: 330px;
141
  }
142
  .sc_params_form h4:first-child{
143
  margin: 0 0 15px 0;
@@ -151,6 +151,17 @@
151
  .sc_params_form .button {
152
  margin: 15px 0 5px 0;
153
  }
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  .sc_cm_menu {
156
  margin: 15px 0 10px 0;
@@ -192,6 +203,32 @@
192
  margin-bottom: 10px;
193
  }
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  /* Codemirror */
196
 
197
  .cm-sc_param{
116
  box-shadow: 0 2px 5px -2px rgba(0,0,0,.2);
117
  border: 1px solid #dfdfdf;
118
  z-index: 9999;
119
+ max-height: 350px;
120
  overflow: auto;
121
  }
122
  .sc_params_list li:hover ul{
137
 
138
  .sc_params_form{
139
  cursor: auto !important;
140
+ width: 300px !important;
141
  }
142
  .sc_params_form h4:first-child{
143
  margin: 0 0 15px 0;
151
  .sc_params_form .button {
152
  margin: 15px 0 5px 0;
153
  }
154
+ .sc_params_form a{
155
+ text-decoration: none !important;
156
+ line-height: 0;
157
+ vertical-align: middle;
158
+ }
159
+ .sc_params_form a:hover{
160
+ opacity: 0.8;
161
+ }
162
+ .sc_params_form a .dashicons{
163
+ position: static !important;
164
+ }
165
 
166
  .sc_cm_menu {
167
  margin: 15px 0 10px 0;
203
  margin-bottom: 10px;
204
  }
205
 
206
+ /* Shortcode list page */
207
+ .sc_copy_list_wrap{
208
+ position: relative;
209
+ }
210
+ .sc_copy_list_wrap .sc_copy_list{
211
+ position: absolute;
212
+ right: 10px;
213
+ top: 0;
214
+ }
215
+ .sc_copy_list_wrap input.widefat{
216
+ border: none;
217
+ }
218
+ .sc_copy_text.copied{
219
+ background-color: lightgreen;
220
+ }
221
+ .sc_copy_list{
222
+ display: none;
223
+ }
224
+ #the-list tr.type-shortcoder:hover a.sc_copy_list{
225
+ display: inline-block;
226
+ }
227
+ #the-list tr.type-shortcoder td.column-shortcode{
228
+ vertical-align: middle;
229
+ }
230
+
231
+
232
  /* Codemirror */
233
 
234
  .cm-sc_param{
admin/edit.php CHANGED
@@ -264,7 +264,9 @@ class SC_Admin_Edit{
264
  }
265
 
266
  echo '<li><span class="dashicons dashicons-list-view"></span>' . __( 'Custom parameter', 'shortcoder' ) . '<ul>';
267
- echo '<li class="sc_params_form"><h4>' . __( 'Enter custom parameter name', 'shortcoder' ) . '</h4>';
 
 
268
  echo '<input type="text" class="sc_cp_box widefat" pattern="[a-zA-Z0-9_-]+"/>';
269
  echo '<h4>' . __( 'Default value', 'shortcoder' ) . '</h4>';
270
  echo '<input type="text" class="sc_cp_default widefat"/>';
@@ -273,7 +275,9 @@ class SC_Admin_Edit{
273
  echo '</ul></li>';
274
 
275
  echo '<li><span class="dashicons dashicons-screenoptions"></span>' . __( 'Custom Fields', 'shortcoder' ) . '<ul>';
276
- echo '<li class="sc_params_form"><h4>' . __( 'Enter custom field name', 'shortcoder' ) . '</h4>';
 
 
277
  echo '<input type="text" class="sc_cf_box widefat" pattern="[a-zA-Z0-9_-]+"/>';
278
  echo '<button class="button sc_cf_btn">' . __( 'Insert custom field', 'shortcoder' ) . '</button>';
279
  echo '<p class="sc_cf_info"><small>' . __( 'Only alphabets, numbers, underscore and hyphens are allowed. Cannot be empty.', 'shortcoder' ) . '</small></p></li>';
@@ -295,7 +299,7 @@ class SC_Admin_Edit{
295
  echo '<p>Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam.</p>';
296
 
297
  echo '<div class="subscribe_form" data-action="https://aakashweb.us19.list-manage.com/subscribe/post-json?u=b7023581458d048107298247e&id=ef5ab3c5c4&c=">
298
- <input type="email" value="' . get_option( 'admin_email' ) . '" class="subscribe_email_box" placeholder="Your email address">
299
  <p class="subscribe_confirm">Thanks for subscribing !</p>
300
  <button class="button subscribe_btn"><span class="dashicons dashicons-email"></span> Subscribe</button>
301
  </div>';
264
  }
265
 
266
  echo '<li><span class="dashicons dashicons-list-view"></span>' . __( 'Custom parameter', 'shortcoder' ) . '<ul>';
267
+ echo '<li class="sc_params_form">';
268
+ echo '<p>' . __( 'Insert parameters in content and replace them with custom values when using the shortcode.', 'shortcoder' ) . '<a href="https://www.aakashweb.com/docs/shortcoder/custom-parameters/" target="_blank" title="' . __( 'More information', 'shortcoder' ) . '"><span class="dashicons dashicons-info"></span></a></p>';
269
+ echo '<h4>' . __( 'Enter custom parameter name', 'shortcoder' ) . '</h4>';
270
  echo '<input type="text" class="sc_cp_box widefat" pattern="[a-zA-Z0-9_-]+"/>';
271
  echo '<h4>' . __( 'Default value', 'shortcoder' ) . '</h4>';
272
  echo '<input type="text" class="sc_cp_default widefat"/>';
275
  echo '</ul></li>';
276
 
277
  echo '<li><span class="dashicons dashicons-screenoptions"></span>' . __( 'Custom Fields', 'shortcoder' ) . '<ul>';
278
+ echo '<li class="sc_params_form">';
279
+ echo '<p>' . __( 'Pull a custom field value of the current post and display it inside the shortcode content.', 'shortcoder' ) . '<a href="https://www.aakashweb.com/docs/shortcoder/shortcode-parameters/#custom-fields" target="_blank" title="' . __( 'More information', 'shortcoder' ) . '"><span class="dashicons dashicons-info"></span></a></p>';
280
+ echo '<h4>' . __( 'Enter custom field name', 'shortcoder' ) . '</h4>';
281
  echo '<input type="text" class="sc_cf_box widefat" pattern="[a-zA-Z0-9_-]+"/>';
282
  echo '<button class="button sc_cf_btn">' . __( 'Insert custom field', 'shortcoder' ) . '</button>';
283
  echo '<p class="sc_cf_info"><small>' . __( 'Only alphabets, numbers, underscore and hyphens are allowed. Cannot be empty.', 'shortcoder' ) . '</small></p></li>';
299
  echo '<p>Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam.</p>';
300
 
301
  echo '<div class="subscribe_form" data-action="https://aakashweb.us19.list-manage.com/subscribe/post-json?u=b7023581458d048107298247e&id=ef5ab3c5c4&c=">
302
+ <input type="text" value="' . get_option( 'admin_email' ) . '" class="subscribe_email_box" placeholder="Your email address">
303
  <p class="subscribe_confirm">Thanks for subscribing !</p>
304
  <button class="button subscribe_btn"><span class="dashicons dashicons-email"></span> Subscribe</button>
305
  </div>';
admin/js/script.js CHANGED
@@ -103,7 +103,7 @@ $(document).ready(function(){
103
  wp.CodeMirror.defineMode('sc_mode', function(config, parserConfig){
104
  var sc_overlay = {
105
  token: function(stream, state){
106
- if(stream.match(/\$\$[a-z0-9A-Z:_]+\$\$/)){
107
  return 'number sc_param';
108
  }
109
  if(stream.match(/%%.*?%%/)){
@@ -249,6 +249,16 @@ $(document).ready(function(){
249
  }, 3000);
250
  })
251
 
 
 
 
 
 
 
 
 
 
 
252
  $('.sc_changelog .dismiss_btn').on('click', function(){
253
  var url = SC_VARS.ajax_url + '?action=sc_admin_ajax&do=close_changelog';
254
  $.get(url, function( data ){
103
  wp.CodeMirror.defineMode('sc_mode', function(config, parserConfig){
104
  var sc_overlay = {
105
  token: function(stream, state){
106
+ if(stream.match(/\$\$[a-z0-9A-Z:_\-]+\$\$/)){
107
  return 'number sc_param';
108
  }
109
  if(stream.match(/%%.*?%%/)){
249
  }, 3000);
250
  })
251
 
252
+ $('.sc_copy_list').on('click', function(e){
253
+ e.preventDefault();
254
+ var $copy_field = $(this).siblings('.sc_copy_text');
255
+ copy_to_clipboard($copy_field.val());
256
+ $copy_field.addClass('copied');
257
+ setTimeout(function() {
258
+ $copy_field.removeClass('copied');
259
+ }, 3000);
260
+ });
261
+
262
  $('.sc_changelog .dismiss_btn').on('click', function(){
263
  var url = SC_VARS.ajax_url + '?action=sc_admin_ajax&do=close_changelog';
264
  $.get(url, function( data ){
admin/manage.php CHANGED
@@ -17,9 +17,16 @@ class SC_Admin_Manage{
17
 
18
  unset( $columns[ 'views' ] );
19
 
20
- $columns[ 'shortcode' ] = __( 'Shortcode', 'sc');
21
 
22
- return $columns;
 
 
 
 
 
 
 
23
 
24
  }
25
 
@@ -27,7 +34,7 @@ class SC_Admin_Manage{
27
 
28
  if( $column == 'shortcode' ){
29
  $sc_tag = Shortcoder::get_sc_tag( $post_id );
30
- echo '<code>' . $sc_tag . '</code>';
31
  }
32
 
33
  }
17
 
18
  unset( $columns[ 'views' ] );
19
 
20
+ $new_columns = array();
21
 
22
+ foreach( $columns as $id => $val ){
23
+ if( $id == 'taxonomy-sc_tag' ){
24
+ $new_columns[ 'shortcode' ] = __( 'Shortcode', 'sc');
25
+ }
26
+ $new_columns[$id] = $val;
27
+ }
28
+
29
+ return $new_columns;
30
 
31
  }
32
 
34
 
35
  if( $column == 'shortcode' ){
36
  $sc_tag = Shortcoder::get_sc_tag( $post_id );
37
+ echo '<span class="sc_copy_list_wrap"><input type="text" class="widefat sc_copy_text" readonly value="' . esc_attr( $sc_tag ) . '" /><a href="#" class="sc_copy_list" title="' . __( 'Copy', 'shortcoder' ) . '"><span class="dashicons dashicons-clipboard"></span></a></span>';
38
  }
39
 
40
  }
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.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,6 +114,14 @@ No, right now the plugin supports only HTML, Javascript and CSS as shortcode con
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.
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
  Requires at least: 4.9.0
10
+ Tested up to: 5.9.1
11
+ Stable tag: 5.7
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.7
118
+ * New: Reordered shortcode column in the "All shortcodes" page.
119
+ * New: Option to copy shortcode directly from "All shortcodes" page.
120
+ * New: Filter `sc_mod_content` to modify shortcode content before execution.
121
+ * Fix: Shortcode won't save if the email field in the feedback form has invalid value.
122
+ * Fix: Custom parameter with hyphen was not highlighted in code editor.
123
+ * Fix: Minor admin UI enhancements.
124
+
125
  ### 5.6
126
  * New: Shortcodes available to copy/insert are now closed by default.
127
  * Fix: Custom parameter value 0 is not displayed.
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.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' ) );
@@ -69,6 +69,8 @@ final class Shortcoder{
69
  return '<!-- Shortcode does not match the conditions -->';
70
  }
71
 
 
 
72
  $sc_content = self::replace_sc_params( $sc_content, $atts );
73
  $sc_content = self::replace_wp_params( $sc_content, $enclosed_content );
74
  $sc_content = self::replace_custom_fields( $sc_content );
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.7
8
  Author URI: https://www.aakashweb.com/
9
  Text Domain: shortcoder
10
  Domain Path: /languages
11
  */
12
 
13
+ define( 'SC_VERSION', '5.7' );
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' ) );
69
  return '<!-- Shortcode does not match the conditions -->';
70
  }
71
 
72
+ $sc_content = apply_filters( 'sc_mod_content', $sc_content, $atts, $sc_settings );
73
+
74
  $sc_content = self::replace_sc_params( $sc_content, $atts );
75
  $sc_content = self::replace_wp_params( $sc_content, $enclosed_content );
76
  $sc_content = self::replace_custom_fields( $sc_content );