Shortcoder - Version 4.1.9

Version Description

  • Fix: Minor UI refinements for better experience.
  • Fix: Import error where some exported JSON files have 0 as EOF.
Download this release

Release Info

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

Code changes from version 4.1.8 to 4.1.9

admin/css/style-insert.css CHANGED
@@ -48,34 +48,34 @@ hr{
48
  padding: 20px;
49
  display: none;
50
  box-shadow: inset 0 2px 6px -5px;
 
51
  }
52
- .button{
53
- display: inline-block;
54
- text-decoration: none;
55
- font-size: 13px;
56
- line-height: 26px;
57
- height: 28px;
58
- margin: 0;
59
- padding: 0 10px 1px;
60
- cursor: pointer;
61
- border-width: 1px;
62
- border-style: solid;
63
- -webkit-appearance: none;
64
- -webkit-border-radius: 3px;
65
- border-radius: 3px;
66
- white-space: nowrap;
67
- -webkit-box-sizing: border-box;
68
- -moz-box-sizing: border-box;
69
  box-sizing: border-box;
70
  }
71
- .button.button-primary{
72
- background: #0085ba;
73
- border-color: #0073aa #006799 #006799;
74
- -webkit-box-shadow: 0 1px 0 #006799;
75
- box-shadow: 0 1px 0 #006799;
76
- color: #fff;
77
- text-decoration: none;
78
- text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  .sc_insert:hover{
@@ -84,8 +84,9 @@ hr{
84
  .sc_wrap input[type=text]{
85
  padding: 5px;
86
  border: 1px solid #CCC;
87
- width: 120px;
88
- margin: 0px 25px 10px 0px;
 
89
  }
90
  .sc_toggle{
91
  background: url(../images/toggle-arrow.png) no-repeat;
@@ -121,6 +122,35 @@ hr{
121
  border-color: #607D8B;
122
  }
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  .disabled_text{
125
  font-size: 10px;
126
  background: #ffdfdd;
@@ -216,5 +246,8 @@ hr{
216
  font-size: 0;
217
  }
218
 
219
- @media screen and (max-width:750px){
 
 
 
220
  }
48
  padding: 20px;
49
  display: none;
50
  box-shadow: inset 0 2px 6px -5px;
51
+ position: relative;
52
  }
53
+ .sc_params label {
54
+ flex-basis: 33%;
55
+ line-height: 1;
56
+ font-size: 14px;
57
+ padding: 10px;
 
 
 
 
 
 
 
 
 
 
 
 
58
  box-sizing: border-box;
59
  }
60
+ .sc_params:before {
61
+ content: '';
62
+ position: absolute;
63
+ border: 12px solid;
64
+ border-color: #bbb transparent transparent transparent;
65
+ top: 0px;
66
+ left: 12px;
67
+ }
68
+ .sc_params:after {
69
+ content: '';
70
+ position: absolute;
71
+ border: 12px solid;
72
+ border-color: #fff transparent transparent transparent;
73
+ top: -1px;
74
+ left: 12px;
75
+ }
76
+ .sc_params_wrap{
77
+ display: flex;
78
+ flex-wrap: wrap;
79
  }
80
 
81
  .sc_insert:hover{
84
  .sc_wrap input[type=text]{
85
  padding: 5px;
86
  border: 1px solid #CCC;
87
+ margin: 10px 25px 0 0px;
88
+ display: block;
89
+ width: 100%;
90
  }
91
  .sc_toggle{
92
  background: url(../images/toggle-arrow.png) no-repeat;
122
  border-color: #607D8B;
123
  }
124
 
125
+ .button{
126
+ display: inline-block;
127
+ text-decoration: none;
128
+ font-size: 13px;
129
+ line-height: 26px;
130
+ height: 28px;
131
+ margin: 0;
132
+ padding: 0 10px 1px;
133
+ cursor: pointer;
134
+ border-width: 1px;
135
+ border-style: solid;
136
+ -webkit-appearance: none;
137
+ -webkit-border-radius: 3px;
138
+ border-radius: 3px;
139
+ white-space: nowrap;
140
+ -webkit-box-sizing: border-box;
141
+ -moz-box-sizing: border-box;
142
+ box-sizing: border-box;
143
+ }
144
+ .button.button-primary{
145
+ background: #0085ba;
146
+ border-color: #0073aa #006799 #006799;
147
+ -webkit-box-shadow: 0 1px 0 #006799;
148
+ box-shadow: 0 1px 0 #006799;
149
+ color: #fff;
150
+ text-decoration: none;
151
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
152
+ }
153
+
154
  .disabled_text{
155
  font-size: 10px;
156
  background: #ffdfdd;
246
  font-size: 0;
247
  }
248
 
249
+ @media screen and (max-width: 750px){
250
+ .sc_params label {
251
+ flex-basis: 50%;
252
+ }
253
  }
admin/css/style.css CHANGED
@@ -38,24 +38,37 @@ h1.sc_title .title-count {
38
  .sc_list {
39
  margin: -20px 0;
40
  position: relative;
 
41
  }
42
- .sc_list li {
43
  margin: 0;
44
  position: relative;
 
45
  }
46
  .sc_list li a {
47
  text-decoration: none;
48
  }
49
- .sc_list li .sc_link {
50
  display: block;
51
  margin: 0 -20px;
52
- padding: 20px;
53
  border-bottom: 1px solid #dfdfdf;
54
- font-size: 18px;
 
55
  }
56
- .sc_list li:last-child .sc_link{
57
  border-bottom: 0;
58
  }
 
 
 
 
 
 
 
 
 
 
59
  .sc_link:hover{
60
  background: #fffeea;
61
  }
@@ -68,11 +81,11 @@ h1.sc_title .title-count {
68
  }
69
  .sc_controls {
70
  position: absolute;
71
- top: 7px;
72
  right: 0;
73
  }
74
  .sc_list .sc_controls a {
75
- padding: 10px;
76
  border-radius: 50%;
77
  margin: 0 0 0 15px;
78
  border: 1px solid transparent;
@@ -104,16 +117,18 @@ h1.sc_title .title-count {
104
  }
105
  .sc_copy_box {
106
  position: absolute;
107
- top: -2px;
108
- font-size: 20px;
109
- width: 92%;
110
- padding: 16px;
111
- left: -22px;
112
  display: none;
113
  cursor: copy;
114
- background: #e6fffe !important;
115
  box-shadow: none !important;
116
  text-align: center;
 
 
117
  }
118
  .sc_list .disabled_text{
119
  font-size: 10px;
@@ -196,6 +211,19 @@ h1.sc_title .title-count {
196
  background: #ffe1e1 !important;
197
  }
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  .sc_menu{
200
  position: absolute;
201
  top: 10px;
38
  .sc_list {
39
  margin: -20px 0;
40
  position: relative;
41
+ counter-reset: sccounter;
42
  }
43
+ .sc_list > li {
44
  margin: 0;
45
  position: relative;
46
+ counter-increment: sccounter;
47
  }
48
  .sc_list li a {
49
  text-decoration: none;
50
  }
51
+ .sc_list > li .sc_link {
52
  display: block;
53
  margin: 0 -20px;
54
+ padding: 15px;
55
  border-bottom: 1px solid #dfdfdf;
56
+ font-size: 17px;
57
+ padding-left: 65px;
58
  }
59
+ .sc_list > li:last-child .sc_link{
60
  border-bottom: 0;
61
  }
62
+ .sc_list > li:before {
63
+ content: counter(sccounter);
64
+ position: absolute;
65
+ left: 0;
66
+ top: 50%;
67
+ border-right: 1px solid #dfdfdf;
68
+ padding-right: 15px;
69
+ margin-top: -10px;
70
+ color: #666;
71
+ }
72
  .sc_link:hover{
73
  background: #fffeea;
74
  }
81
  }
82
  .sc_controls {
83
  position: absolute;
84
+ top: 5px;
85
  right: 0;
86
  }
87
  .sc_list .sc_controls a {
88
+ padding: 8px;
89
  border-radius: 50%;
90
  margin: 0 0 0 15px;
91
  border: 1px solid transparent;
117
  }
118
  .sc_copy_box {
119
  position: absolute;
120
+ top: 0px;
121
+ font-size: 19px;
122
+ width: 91%;
123
+ padding: 10px;
124
+ left: -20px;
125
  display: none;
126
  cursor: copy;
127
+ background: #f9f9f9 !important;
128
  box-shadow: none !important;
129
  text-align: center;
130
+ border: none !important;
131
+ bottom: 0;
132
  }
133
  .sc_list .disabled_text{
134
  font-size: 10px;
211
  background: #ffe1e1 !important;
212
  }
213
 
214
+ .sc_copy_field {
215
+ background: transparent !important;
216
+ border: none !important;
217
+ box-shadow: none !important;
218
+ font-size: 13px;
219
+ padding: 0 !important;
220
+ cursor: text;
221
+ margin: 0 !important;
222
+ }
223
+ .sc_copy_field:readonly{
224
+ color: #000;
225
+ }
226
+
227
  .sc_menu{
228
  position: absolute;
229
  top: 10px;
admin/js/script.js CHANGED
@@ -37,6 +37,12 @@ $(document).ready(function(){
37
  }
38
  }
39
 
 
 
 
 
 
 
40
  }
41
 
42
  var sort = function( ele, orderby ){
@@ -231,6 +237,11 @@ $(document).ready(function(){
231
 
232
  });
233
 
 
 
 
 
 
234
  $( document ).on( 'click', '.cp_btn', function(){
235
 
236
  var $cp_box = $( '.cp_box' );
37
  }
38
  }
39
 
40
+ var $sc_copy_field = $('.sc_copy_field');
41
+ if( $sc_copy_field.length ){
42
+ var sc_code = $sc_copy_field.val();
43
+ $sc_copy_field.width(sc_code.length * 6);
44
+ }
45
+
46
  }
47
 
48
  var sort = function( ele, orderby ){
237
 
238
  });
239
 
240
+ $( document ).on( 'click', '.sc_copy_field', function(e){
241
+ e.preventDefault();
242
+ $(this).select();
243
+ });
244
+
245
  $( document ).on( 'click', '.cp_btn', function(){
246
 
247
  var $cp_box = $( '.cp_box' );
admin/sc-admin.php CHANGED
@@ -218,7 +218,7 @@ class Shortcoder_Admin{
218
  echo '<div class="sc_section">';
219
  echo '<label for="sc_name">' . __( 'Name', 'shortcoder' ) . '</label>';
220
  echo '<div class="sc_name_wrap"><input type="text" id="sc_name" name="sc_name" value="' . esc_attr( $sc_name ) . '" class="widefat" required="required" ' . ( ( $action == 'edit' ) ? 'readonly="readonly"' : 'placeholder="' . __( 'Enter a name for the shortcode, case sensitive', 'shortcoder' ) . '"' ) . ' pattern="[a-zA-z0-9 \-]+" />';
221
- echo ( $action == 'edit' ) ? '<div class="copy_shortcode">Your shortcode is - <strong contenteditable>' . self::get_shortcode( $sc_name ) . '</strong></div>' : '';
222
  echo ( $action != 'edit' ) ? '<div class="copy_shortcode">' . __( 'Allowed characters A to Z, a to z, 0 to 9, hyphens, underscores and space', 'shortcoder' ) . '</div>' : '';
223
  echo '</div></div>';
224
 
218
  echo '<div class="sc_section">';
219
  echo '<label for="sc_name">' . __( 'Name', 'shortcoder' ) . '</label>';
220
  echo '<div class="sc_name_wrap"><input type="text" id="sc_name" name="sc_name" value="' . esc_attr( $sc_name ) . '" class="widefat" required="required" ' . ( ( $action == 'edit' ) ? 'readonly="readonly"' : 'placeholder="' . __( 'Enter a name for the shortcode, case sensitive', 'shortcoder' ) . '"' ) . ' pattern="[a-zA-z0-9 \-]+" />';
221
+ echo ( $action == 'edit' ) ? '<div class="copy_shortcode">Your shortcode is - <input type="text" value="' . esc_attr( self::get_shortcode( $sc_name ) ) . '" class="sc_copy_field" readonly="readonly" title="' . __( 'Copy shortcode', 'shortcoder' ) . '"/></div>' : '';
222
  echo ( $action != 'edit' ) ? '<div class="copy_shortcode">' . __( 'Allowed characters A to Z, a to z, 0 to 9, hyphens, underscores and space', 'shortcoder' ) . '</div>' : '';
223
  echo '</div></div>';
224
 
admin/sc-insert.php CHANGED
@@ -1,6 +1,7 @@
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>
@@ -64,6 +65,7 @@ if( empty( $shortcodes ) ){
64
  echo '<div class="sc_params">';
65
  if(!empty($matches[0])){
66
  echo '<h4>Available parameters: </h4>';
 
67
  $temp = array();
68
  foreach($matches[0] as $k=>$v){
69
  $cleaned = str_replace('%', '', $v);
@@ -72,6 +74,7 @@ if( empty( $shortcodes ) ){
72
  echo '<label>' . $cleaned . ': <input type="text" data-param="' . $cleaned . '"/></label> ';
73
  }
74
  }
 
75
  echo'<hr/>';
76
  }else{
77
  echo 'No parameters available - ';
1
  <html>
2
  <head>
3
  <title>Insert shortcode</title>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
5
  <link href="<?php echo SC_ADMIN_URL; ?>css/style-insert.css<?php echo '?ver=' . SC_VERSION; ?>" media="all" rel="stylesheet" />
6
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
7
  <script src="<?php echo SC_ADMIN_URL; ?>js/script-insert.js<?php echo '?ver=' . SC_VERSION; ?>"></script>
65
  echo '<div class="sc_params">';
66
  if(!empty($matches[0])){
67
  echo '<h4>Available parameters: </h4>';
68
+ echo '<div class="sc_params_wrap">';
69
  $temp = array();
70
  foreach($matches[0] as $k=>$v){
71
  $cleaned = str_replace('%', '', $v);
74
  echo '<label>' . $cleaned . ': <input type="text" data-param="' . $cleaned . '"/></label> ';
75
  }
76
  }
77
+ echo '</div>';
78
  echo'<hr/>';
79
  }else{
80
  echo 'No parameters available - ';
includes/import.php CHANGED
@@ -51,6 +51,7 @@ class Shortcoder_Import{
51
  }
52
 
53
  $imported_json = utf8_encode( file_get_contents( $file_path ) );
 
54
  $imported_data = json_decode( $imported_json, true );
55
 
56
  if( $imported_data && !empty( $imported_data ) ){
@@ -68,7 +69,7 @@ class Shortcoder_Import{
68
  if( update_option( 'shortcoder_data', $shortcodes ) ){
69
  self::print_notice( $import_count . __( ' shortcodes imported successfully !', 'shortcoder' ), 'success' );
70
  }else{
71
- self::print_notice( __( 'shortcodes are not updated because all the shortcodes remain the same.', 'shortcoder' ) );
72
  return false;
73
  }
74
 
51
  }
52
 
53
  $imported_json = utf8_encode( file_get_contents( $file_path ) );
54
+ $imported_json = ( substr($imported_json, -1) == '0' ) ? substr($imported_json, 0 , -1) : $imported_json;
55
  $imported_data = json_decode( $imported_json, true );
56
 
57
  if( $imported_data && !empty( $imported_data ) ){
69
  if( update_option( 'shortcoder_data', $shortcodes ) ){
70
  self::print_notice( $import_count . __( ' shortcodes imported successfully !', 'shortcoder' ), 'success' );
71
  }else{
72
+ self::print_notice( __( 'Shortcodes are not updated because all the shortcodes remain the same.', 'shortcoder' ) );
73
  return false;
74
  }
75
 
readme.txt CHANGED
@@ -7,7 +7,7 @@ Donate link: https://goo.gl/qMF3iE
7
  License: GPLv2 or later
8
  Requires at least: 3.3
9
  Tested up to: 4.9.8
10
- Stable tag: 4.1.8
11
 
12
  Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
13
 
@@ -26,7 +26,7 @@ Shortcoder is a plugin which allows to create a custom shortcode and store HTML,
26
 
27
  * Create **"custom shortcodes"** easily and use them within WordPress
28
  * Use any kind of **HTML** as Shortcode content.
29
- * Insert: Custom parameters in shortcode
30
  * Insert: WordPress parameters in shortcode
31
  * Visual editor for adding shortcode contents.
32
  * Globally disable the shortcode when not needed.
@@ -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.1.8 =
95
  * New: Insert custom fields in shortcode content.
96
  * Fix: Removed comments in shortcode output
@@ -201,4 +205,4 @@ Note: When you disable a shortcode, the shortcode will not be executed in the pa
201
 
202
  == Upgrade Notice ==
203
 
204
- 4.4 is a major upgrade. Entire code is rewritten from scratch.
7
  License: GPLv2 or later
8
  Requires at least: 3.3
9
  Tested up to: 4.9.8
10
+ Stable tag: 4.1.9
11
 
12
  Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
13
 
26
 
27
  * Create **"custom shortcodes"** easily and use them within WordPress
28
  * Use any kind of **HTML** as Shortcode content.
29
+ * Insert: **Custom parameters** in shortcode
30
  * Insert: WordPress parameters in shortcode
31
  * Visual editor for adding shortcode contents.
32
  * Globally disable the shortcode when not needed.
91
 
92
  == Changelog ==
93
 
94
+ = 4.1.9 =
95
+ * Fix: Minor UI refinements for better experience.
96
+ * Fix: Import error where some exported JSON files have 0 as EOF.
97
+
98
  = 4.1.8 =
99
  * New: Insert custom fields in shortcode content.
100
  * Fix: Removed comments in shortcode output
205
 
206
  == Upgrade Notice ==
207
 
208
+ 4.0 is a major upgrade. Entire code is rewritten from scratch.
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.1.8
8
  Author URI: https://www.aakashweb.com/
9
  */
10
 
11
- define( 'SC_VERSION', '4.1.8' );
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.1.9
8
  Author URI: https://www.aakashweb.com/
9
  */
10
 
11
+ define( 'SC_VERSION', '4.1.9' );
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' ) );