Version Description
Download this release
Release Info
Developer | vaakash |
Plugin | Shortcoder |
Version | 5.8 |
Comparing to | |
See all releases |
Code changes from version 5.7 to 5.8
- admin/css/style-insert.css +16 -0
- admin/css/style.css +4 -1
- admin/edit.php +9 -1
- admin/insert.php +1 -0
- admin/js/script-insert.js +2 -1
- admin/js/script.js +9 -0
- admin/manage.php +6 -0
- readme.txt +7 -2
- shortcoder.php +14 -9
admin/css/style-insert.css
CHANGED
@@ -126,6 +126,8 @@ p .button {
|
|
126 |
cursor: pointer;
|
127 |
position: relative;
|
128 |
box-shadow: 0 1px 5px -3px rgba(0, 0, 0, 0.5);
|
|
|
|
|
129 |
}
|
130 |
.sc_head:hover {
|
131 |
background: lightyellow;
|
@@ -138,11 +140,25 @@ p .button {
|
|
138 |
margin-right: 10px;
|
139 |
transition: transform 0.8s;
|
140 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
.sc_tools{
|
142 |
position: absolute;
|
143 |
top: 10px;
|
144 |
right: 10px;
|
145 |
display: none;
|
|
|
146 |
}
|
147 |
.sc_tools .button{
|
148 |
margin-left: 10px;
|
126 |
cursor: pointer;
|
127 |
position: relative;
|
128 |
box-shadow: 0 1px 5px -3px rgba(0, 0, 0, 0.5);
|
129 |
+
display: flex;
|
130 |
+
flex-wrap: nowrap;
|
131 |
}
|
132 |
.sc_head:hover {
|
133 |
background: lightyellow;
|
140 |
margin-right: 10px;
|
141 |
transition: transform 0.8s;
|
142 |
}
|
143 |
+
.sc_head p{
|
144 |
+
white-space: nowrap;
|
145 |
+
display: inline-block;
|
146 |
+
margin: 0 10px 0 15px;
|
147 |
+
color: #666;
|
148 |
+
flex: 1;
|
149 |
+
overflow: hidden;
|
150 |
+
text-overflow: ellipsis;
|
151 |
+
}
|
152 |
+
.sc_head:hover .sc_tools{
|
153 |
+
background: lightyellow;
|
154 |
+
}
|
155 |
+
|
156 |
.sc_tools{
|
157 |
position: absolute;
|
158 |
top: 10px;
|
159 |
right: 10px;
|
160 |
display: none;
|
161 |
+
background: #fff;
|
162 |
}
|
163 |
.sc_tools .button{
|
164 |
margin-left: 10px;
|
admin/css/style.css
CHANGED
@@ -203,6 +203,10 @@
|
|
203 |
margin-bottom: 10px;
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
206 |
/* Shortcode list page */
|
207 |
.sc_copy_list_wrap{
|
208 |
position: relative;
|
@@ -230,7 +234,6 @@
|
|
230 |
|
231 |
|
232 |
/* Codemirror */
|
233 |
-
|
234 |
.cm-sc_param{
|
235 |
font-weight: bold;
|
236 |
}
|
203 |
margin-bottom: 10px;
|
204 |
}
|
205 |
|
206 |
+
.sc_settings_link{
|
207 |
+
float: right;
|
208 |
+
}
|
209 |
+
|
210 |
/* Shortcode list page */
|
211 |
.sc_copy_list_wrap{
|
212 |
position: relative;
|
234 |
|
235 |
|
236 |
/* Codemirror */
|
|
|
237 |
.cm-sc_param{
|
238 |
font-weight: bold;
|
239 |
}
|
admin/edit.php
CHANGED
@@ -36,6 +36,7 @@ class SC_Admin_Edit{
|
|
36 |
echo '<strong>' . __( 'Your shortcode', 'shortcoder' ) . ': </strong>';
|
37 |
echo '<code class="sc_preview_text">' . Shortcoder::get_sc_tag( $post->ID ) . '</code>';
|
38 |
echo '<span id="edit-slug-buttons"><button type="button" class="sc_copy button button-small"><span class="dashicons dashicons-yes"></span> ' . __( 'Copy', 'shortcoder' ) . '</button></span>';
|
|
|
39 |
echo '</div>';
|
40 |
|
41 |
// Editor
|
@@ -77,6 +78,13 @@ class SC_Admin_Edit{
|
|
77 |
'helper' => __( 'Name of the shortcode to display when it is listed', 'shortcoder' )
|
78 |
))),
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
array( __( 'Temporarily disable shortcode', 'shortcoder' ), SC_Admin_Form::field( 'select', array(
|
81 |
'value' => $settings[ '_sc_disable_sc' ],
|
82 |
'name' => '_sc_disable_sc',
|
@@ -97,7 +105,7 @@ class SC_Admin_Edit{
|
|
97 |
'helper' => __( 'Select to disable the shortcode from executing for administrators.', 'shortcoder' )
|
98 |
))),
|
99 |
|
100 |
-
array( __( 'Execute shortcode
|
101 |
'value' => $settings[ '_sc_allowed_devices' ],
|
102 |
'name' => '_sc_allowed_devices',
|
103 |
'list' => array(
|
36 |
echo '<strong>' . __( 'Your shortcode', 'shortcoder' ) . ': </strong>';
|
37 |
echo '<code class="sc_preview_text">' . Shortcoder::get_sc_tag( $post->ID ) . '</code>';
|
38 |
echo '<span id="edit-slug-buttons"><button type="button" class="sc_copy button button-small"><span class="dashicons dashicons-yes"></span> ' . __( 'Copy', 'shortcoder' ) . '</button></span>';
|
39 |
+
echo '<a href="#sc_mb_settings" class="sc_settings_link">' . __( 'Settings', 'shortcoder' ) . '</a>';
|
40 |
echo '</div>';
|
41 |
|
42 |
// Editor
|
78 |
'helper' => __( 'Name of the shortcode to display when it is listed', 'shortcoder' )
|
79 |
))),
|
80 |
|
81 |
+
array( __( 'Description', 'shortcoder' ), SC_Admin_Form::field( 'textarea', array(
|
82 |
+
'value' => $settings[ '_sc_description' ],
|
83 |
+
'name' => '_sc_description',
|
84 |
+
'class' => 'widefat',
|
85 |
+
'helper' => __( 'Description of the shortcode for identification', 'shortcoder' )
|
86 |
+
))),
|
87 |
+
|
88 |
array( __( 'Temporarily disable shortcode', 'shortcoder' ), SC_Admin_Form::field( 'select', array(
|
89 |
'value' => $settings[ '_sc_disable_sc' ],
|
90 |
'name' => '_sc_disable_sc',
|
105 |
'helper' => __( 'Select to disable the shortcode from executing for administrators.', 'shortcoder' )
|
106 |
))),
|
107 |
|
108 |
+
array( __( 'Execute shortcode on devices', 'shortcoder' ), SC_Admin_Form::field( 'select', array(
|
109 |
'value' => $settings[ '_sc_allowed_devices' ],
|
110 |
'name' => '_sc_allowed_devices',
|
111 |
'list' => array(
|
admin/insert.php
CHANGED
@@ -70,6 +70,7 @@ if( empty( $shortcodes ) ){
|
|
70 |
echo '<div class="sc_head">';
|
71 |
echo '<img src="' . SC_ADMIN_URL . '/images/arrow.svg" width="16" />';
|
72 |
echo '<h3>' . $settings[ '_sc_title' ] . '</h3>';
|
|
|
73 |
echo '<div class="sc_tools">';
|
74 |
if( current_user_can( 'edit_post', $id ) ){
|
75 |
echo '<a href="' . admin_url( 'post.php?action=edit&post=' . $id ) . '" class="button" target="_blank">' . __( 'View', 'shortcoder' ) . '</a>';
|
70 |
echo '<div class="sc_head">';
|
71 |
echo '<img src="' . SC_ADMIN_URL . '/images/arrow.svg" width="16" />';
|
72 |
echo '<h3>' . $settings[ '_sc_title' ] . '</h3>';
|
73 |
+
echo '<p>' . esc_html( $settings[ '_sc_description' ] ) . '</p>';
|
74 |
echo '<div class="sc_tools">';
|
75 |
if( current_user_can( 'edit_post', $id ) ){
|
76 |
echo '<a href="' . admin_url( 'post.php?action=edit&post=' . $id ) . '" class="button" target="_blank">' . __( 'View', 'shortcoder' ) . '</a>';
|
admin/js/script-insert.js
CHANGED
@@ -152,7 +152,8 @@ $(document).ready(function(){
|
|
152 |
|
153 |
$('.sc_wrap').each(function(){
|
154 |
var name = $(this).find('.sc_head h3').text();
|
155 |
-
|
|
|
156 |
$(this).hide();
|
157 |
}else{
|
158 |
$(this).show();
|
152 |
|
153 |
$('.sc_wrap').each(function(){
|
154 |
var name = $(this).find('.sc_head h3').text();
|
155 |
+
var desc = $(this).find('.sc_head p').text();
|
156 |
+
if(name.match(re) === null && desc.match(re) === null){
|
157 |
$(this).hide();
|
158 |
}else{
|
159 |
$(this).show();
|
admin/js/script.js
CHANGED
@@ -270,6 +270,15 @@ $(document).ready(function(){
|
|
270 |
});
|
271 |
});
|
272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
$('.cfe_amt').on('click', function(){
|
274 |
var $btn = $(this).closest('.cfe_form').find('.cfe_btn');
|
275 |
$btn.attr('href', $btn.data('link') + $(this).val());
|
270 |
});
|
271 |
});
|
272 |
|
273 |
+
$('.sc_settings_link').on('click', function(e){
|
274 |
+
e.preventDefault();
|
275 |
+
$('html').animate({
|
276 |
+
scrollTop: $("#sc_mb_settings").offset().top
|
277 |
+
}, 1000, function(){
|
278 |
+
$('input[name="post_title"]').focus();
|
279 |
+
});
|
280 |
+
});
|
281 |
+
|
282 |
$('.cfe_amt').on('click', function(){
|
283 |
var $btn = $(this).closest('.cfe_form').find('.cfe_btn');
|
284 |
$btn.attr('href', $btn.data('link') + $(this).val());
|
admin/manage.php
CHANGED
@@ -22,6 +22,7 @@ class SC_Admin_Manage{
|
|
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 |
}
|
@@ -37,6 +38,11 @@ class SC_Admin_Manage{
|
|
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 |
}
|
41 |
|
42 |
public static function per_page_count( $count, $post_type ){
|
22 |
foreach( $columns as $id => $val ){
|
23 |
if( $id == 'taxonomy-sc_tag' ){
|
24 |
$new_columns[ 'shortcode' ] = __( 'Shortcode', 'sc');
|
25 |
+
$new_columns[ 'desc' ] = __( 'Description', 'sc');
|
26 |
}
|
27 |
$new_columns[$id] = $val;
|
28 |
}
|
38 |
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>';
|
39 |
}
|
40 |
|
41 |
+
if( $column == 'desc' ){
|
42 |
+
$sc_settings = Shortcoder::get_sc_settings( $post_id );
|
43 |
+
echo esc_html( $sc_settings[ '_sc_description' ] );
|
44 |
+
}
|
45 |
+
|
46 |
}
|
47 |
|
48 |
public static function per_page_count( $count, $post_type ){
|
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:
|
11 |
-
Stable tag: 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.7
|
118 |
* New: Reordered shortcode column in the "All shortcodes" page.
|
119 |
* New: Option to copy shortcode directly from "All shortcodes" page.
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
Requires at least: 4.9.0
|
10 |
+
Tested up to: 6.0
|
11 |
+
Stable tag: 5.8
|
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.8
|
118 |
+
* New: Option to set description for the shortcode.
|
119 |
+
* New: New actions and filters introduced.
|
120 |
+
* Fix: Minor admin UI enhancements.
|
121 |
+
|
122 |
### 5.7
|
123 |
* New: Reordered shortcode column in the "All shortcodes" page.
|
124 |
* New: Option to copy shortcode directly from "All shortcodes" page.
|
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.
|
8 |
Author URI: https://www.aakashweb.com/
|
9 |
Text Domain: shortcoder
|
10 |
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
-
define( 'SC_VERSION', '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' ) );
|
@@ -58,6 +58,9 @@ final class Shortcoder{
|
|
58 |
|
59 |
$shortcode = self::find_shortcode( $atts, $shortcodes );
|
60 |
|
|
|
|
|
|
|
61 |
if( !is_array( $shortcode ) ){
|
62 |
return $shortcode;
|
63 |
}
|
@@ -66,15 +69,16 @@ final class Shortcoder{
|
|
66 |
$sc_settings = $shortcode[ 'settings' ];
|
67 |
|
68 |
if( !self::can_display( $shortcode ) ){
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
|
72 |
-
$sc_content = apply_filters( '
|
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 );
|
77 |
-
$sc_content = do_shortcode( $sc_content );
|
78 |
|
79 |
return $sc_content;
|
80 |
|
@@ -110,6 +114,7 @@ final class Shortcoder{
|
|
110 |
public static function default_sc_settings(){
|
111 |
|
112 |
return array(
|
|
|
113 |
'_sc_disable_sc' => 'no',
|
114 |
'_sc_disable_admin' => 'no',
|
115 |
'_sc_editor' => '',
|
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.8
|
8 |
Author URI: https://www.aakashweb.com/
|
9 |
Text Domain: shortcoder
|
10 |
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
+
define( 'SC_VERSION', '5.8' );
|
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' ) );
|
58 |
|
59 |
$shortcode = self::find_shortcode( $atts, $shortcodes );
|
60 |
|
61 |
+
$shortcode = apply_filters( 'sc_mod_shortcode', $shortcode, $atts, $enclosed_content );
|
62 |
+
do_action( 'sc_do_before', $shortcode, $atts );
|
63 |
+
|
64 |
if( !is_array( $shortcode ) ){
|
65 |
return $shortcode;
|
66 |
}
|
69 |
$sc_settings = $shortcode[ 'settings' ];
|
70 |
|
71 |
if( !self::can_display( $shortcode ) ){
|
72 |
+
$sc_content = '<!-- Shortcode does not match the conditions -->';
|
73 |
+
}else{
|
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 );
|
77 |
+
$sc_content = do_shortcode( $sc_content );
|
78 |
}
|
79 |
|
80 |
+
$sc_content = apply_filters( 'sc_mod_output', $sc_content, $atts, $sc_settings, $enclosed_content );
|
81 |
+
do_action( 'sc_do_after', $sc_content, $atts, $sc_settings );
|
|
|
|
|
|
|
|
|
82 |
|
83 |
return $sc_content;
|
84 |
|
114 |
public static function default_sc_settings(){
|
115 |
|
116 |
return array(
|
117 |
+
'_sc_description' => '',
|
118 |
'_sc_disable_sc' => 'no',
|
119 |
'_sc_disable_admin' => 'no',
|
120 |
'_sc_editor' => '',
|