Version Description
- New: Added support for underscores in custom parameters.
- New: Getting ready for internationalization of the plugin.
- Fix: Insert shortcode popup shows duplicate available parameters in case of same parameter with different case.
Download this release
Release Info
Developer | vaakash |
Plugin | Shortcoder |
Version | 5.3 |
Comparing to | |
See all releases |
Code changes from version 5.2.1 to 5.3
- admin/admin.php +61 -61
- admin/edit.php +21 -21
- admin/insert.php +4 -1
- includes/updates.php +2 -2
- readme.txt +8 -3
- shortcoder.php +5 -3
admin/admin.php
CHANGED
@@ -25,37 +25,37 @@ class SC_Admin{
|
|
25 |
public static function register_post_type(){
|
26 |
|
27 |
$labels = array(
|
28 |
-
'name' => _x( 'Shortcoder', 'Post Type General Name', '
|
29 |
-
'singular_name' => _x( 'Shortcode', 'Post Type Singular Name', '
|
30 |
-
'menu_name' => __( 'Shortcoder', '
|
31 |
-
'name_admin_bar' => __( 'Shortcode', '
|
32 |
-
'archives' => __( 'Shortcode Archives', '
|
33 |
-
'attributes' => __( 'Shortcode Attributes', '
|
34 |
-
'parent_item_colon' => __( 'Parent Shortcode:', '
|
35 |
-
'all_items' => __( 'All Shortcodes', '
|
36 |
-
'add_new_item' => __( 'Create shortcode', '
|
37 |
-
'add_new' => __( 'Create shortcode', '
|
38 |
-
'new_item' => __( 'New Shortcode', '
|
39 |
-
'edit_item' => __( 'Edit Shortcode', '
|
40 |
-
'update_item' => __( 'Update Shortcode', '
|
41 |
-
'view_item' => __( 'View Shortcode', '
|
42 |
-
'view_items' => __( 'View Shortcodes', '
|
43 |
-
'search_items' => __( 'Search Shortcode', '
|
44 |
-
'not_found' => __( 'Not found', '
|
45 |
-
'not_found_in_trash' => __( 'Not found in Trash', '
|
46 |
-
'featured_image' => __( 'Featured Image', '
|
47 |
-
'set_featured_image' => __( 'Set featured image', '
|
48 |
-
'remove_featured_image' => __( 'Remove featured image', '
|
49 |
-
'use_featured_image' => __( 'Use as featured image', '
|
50 |
-
'insert_into_item' => __( 'Insert into shortcode', '
|
51 |
-
'uploaded_to_this_item' => __( 'Uploaded to this shortcode', '
|
52 |
-
'items_list' => __( 'Shortcodes list', '
|
53 |
-
'items_list_navigation' => __( 'Shortcodes list navigation', '
|
54 |
-
'filter_items_list' => __( 'Filter shortcodes list', '
|
55 |
);
|
56 |
|
57 |
$args = array(
|
58 |
-
'label' => __( 'Shortcode', '
|
59 |
'labels' => $labels,
|
60 |
'supports' => false,
|
61 |
'taxonomies' => array( 'sc_tag' ),
|
@@ -83,26 +83,26 @@ class SC_Admin{
|
|
83 |
public static function register_taxonomy(){
|
84 |
|
85 |
$labels = array(
|
86 |
-
'name' => _x( 'Tags', 'Taxonomy General Name', '
|
87 |
-
'singular_name' => _x( 'Tag', 'Taxonomy Singular Name', '
|
88 |
-
'menu_name' => __( 'Tags', '
|
89 |
-
'all_items' => __( 'All Tags', '
|
90 |
-
'parent_item' => __( 'Parent Tag', '
|
91 |
-
'parent_item_colon' => __( 'Parent Tag:', '
|
92 |
-
'new_item_name' => __( 'New Tag Name', '
|
93 |
-
'add_new_item' => __( 'Add New Tag', '
|
94 |
-
'edit_item' => __( 'Edit Tag', '
|
95 |
-
'update_item' => __( 'Update Tag', '
|
96 |
-
'view_item' => __( 'View Tag', '
|
97 |
-
'separate_items_with_commas' => __( 'Separate tags with commas', '
|
98 |
-
'add_or_remove_items' => __( 'Add or remove tags', '
|
99 |
-
'choose_from_most_used' => __( 'Choose from the most used', '
|
100 |
-
'popular_items' => __( 'Popular Tags', '
|
101 |
-
'search_items' => __( 'Search Tags', '
|
102 |
-
'not_found' => __( 'Not Found', '
|
103 |
-
'no_terms' => __( 'No tags', '
|
104 |
-
'items_list' => __( 'Tags list', '
|
105 |
-
'items_list_navigation' => __( 'Tags list navigation', '
|
106 |
);
|
107 |
$args = array(
|
108 |
'labels' => $labels,
|
@@ -137,7 +137,7 @@ class SC_Admin{
|
|
137 |
'sc_version' => SC_VERSION,
|
138 |
'ajax_url' => get_admin_url() . 'admin-ajax.php',
|
139 |
'screen' => get_current_screen(),
|
140 |
-
'text_editor_switch_notice' => __( 'Switching editor will refresh the page. Please save your changes before refreshing. Do you want to refresh the page now ?', '
|
141 |
);
|
142 |
|
143 |
}
|
@@ -199,7 +199,7 @@ class SC_Admin{
|
|
199 |
|
200 |
echo '<div class="sc_changelog"><main>
|
201 |
<article>' . $changelog . '</article>
|
202 |
-
<footer><button href="#" class="button button-primary dismiss_btn">' . __( 'Continue using Shortcoder', '
|
203 |
</main></div>';
|
204 |
|
205 |
}
|
@@ -220,24 +220,24 @@ class SC_Admin{
|
|
220 |
<div id="contextual-help-columns">
|
221 |
<div class="contextual-help-tabs">
|
222 |
<ul>
|
223 |
-
<li class="active"><a href="#export-tab" aria-controls="export-tab">Export</a></li>
|
224 |
-
<li><a href="#import-tab" aria-controls="import-tab">Import</a></li>
|
225 |
-
<li><a href="#import-others-tab" aria-controls="import-others-tab">Import from other sources</a></li>
|
226 |
</ul>
|
227 |
</div>
|
228 |
-
<div class="contextual-help-sidebar"><p><a href="https://www.aakashweb.com/docs/shortcoder-doc/" target="_blank">Documentation</a></p></div>
|
229 |
<div class="contextual-help-tabs-wrap">
|
230 |
<div id="export-tab" class="help-tab-content active">
|
231 |
-
<h3>' . __( 'Export', '
|
232 |
-
<a href="' . admin_url( 'export.php' ) . '" class="button button-primary">' . __( 'Go to export page', '
|
233 |
</div>
|
234 |
<div id="import-tab" class="help-tab-content">
|
235 |
-
<h3>' . __( 'Import', '
|
236 |
-
<a href="' . admin_url( 'import.php' ) . '" class="button button-primary">' . __( 'Go to import page', '
|
237 |
</div>
|
238 |
<div id="import-others-tab" class="help-tab-content">
|
239 |
-
<h3>' . __( 'Import from other sources', '
|
240 |
-
<a href="https://www.aakashweb.com/docs/shortcoder-doc/import-export/" target="_blank" class="button button-primary">' . __( 'Open documentation', '
|
241 |
</div>
|
242 |
</div>
|
243 |
</div>
|
@@ -246,7 +246,7 @@ class SC_Admin{
|
|
246 |
}
|
247 |
|
248 |
public static function action_links( $links ){
|
249 |
-
array_unshift( $links, '<a href="'. esc_url( admin_url( 'edit.php?post_type=shortcoder') ) .'">Manage shortcodes</a>' );
|
250 |
return $links;
|
251 |
}
|
252 |
|
25 |
public static function register_post_type(){
|
26 |
|
27 |
$labels = array(
|
28 |
+
'name' => _x( 'Shortcoder', 'Post Type General Name', 'shortcoder' ),
|
29 |
+
'singular_name' => _x( 'Shortcode', 'Post Type Singular Name', 'shortcoder' ),
|
30 |
+
'menu_name' => __( 'Shortcoder', 'shortcoder' ),
|
31 |
+
'name_admin_bar' => __( 'Shortcode', 'shortcoder' ),
|
32 |
+
'archives' => __( 'Shortcode Archives', 'shortcoder' ),
|
33 |
+
'attributes' => __( 'Shortcode Attributes', 'shortcoder' ),
|
34 |
+
'parent_item_colon' => __( 'Parent Shortcode:', 'shortcoder' ),
|
35 |
+
'all_items' => __( 'All Shortcodes', 'shortcoder' ),
|
36 |
+
'add_new_item' => __( 'Create shortcode', 'shortcoder' ),
|
37 |
+
'add_new' => __( 'Create shortcode', 'shortcoder' ),
|
38 |
+
'new_item' => __( 'New Shortcode', 'shortcoder' ),
|
39 |
+
'edit_item' => __( 'Edit Shortcode', 'shortcoder' ),
|
40 |
+
'update_item' => __( 'Update Shortcode', 'shortcoder' ),
|
41 |
+
'view_item' => __( 'View Shortcode', 'shortcoder' ),
|
42 |
+
'view_items' => __( 'View Shortcodes', 'shortcoder' ),
|
43 |
+
'search_items' => __( 'Search Shortcode', 'shortcoder' ),
|
44 |
+
'not_found' => __( 'Not found', 'shortcoder' ),
|
45 |
+
'not_found_in_trash' => __( 'Not found in Trash', 'shortcoder' ),
|
46 |
+
'featured_image' => __( 'Featured Image', 'shortcoder' ),
|
47 |
+
'set_featured_image' => __( 'Set featured image', 'shortcoder' ),
|
48 |
+
'remove_featured_image' => __( 'Remove featured image', 'shortcoder' ),
|
49 |
+
'use_featured_image' => __( 'Use as featured image', 'shortcoder' ),
|
50 |
+
'insert_into_item' => __( 'Insert into shortcode', 'shortcoder' ),
|
51 |
+
'uploaded_to_this_item' => __( 'Uploaded to this shortcode', 'shortcoder' ),
|
52 |
+
'items_list' => __( 'Shortcodes list', 'shortcoder' ),
|
53 |
+
'items_list_navigation' => __( 'Shortcodes list navigation', 'shortcoder' ),
|
54 |
+
'filter_items_list' => __( 'Filter shortcodes list', 'shortcoder' ),
|
55 |
);
|
56 |
|
57 |
$args = array(
|
58 |
+
'label' => __( 'Shortcode', 'shortcoder' ),
|
59 |
'labels' => $labels,
|
60 |
'supports' => false,
|
61 |
'taxonomies' => array( 'sc_tag' ),
|
83 |
public static function register_taxonomy(){
|
84 |
|
85 |
$labels = array(
|
86 |
+
'name' => _x( 'Tags', 'Taxonomy General Name', 'shortcoder' ),
|
87 |
+
'singular_name' => _x( 'Tag', 'Taxonomy Singular Name', 'shortcoder' ),
|
88 |
+
'menu_name' => __( 'Tags', 'shortcoder' ),
|
89 |
+
'all_items' => __( 'All Tags', 'shortcoder' ),
|
90 |
+
'parent_item' => __( 'Parent Tag', 'shortcoder' ),
|
91 |
+
'parent_item_colon' => __( 'Parent Tag:', 'shortcoder' ),
|
92 |
+
'new_item_name' => __( 'New Tag Name', 'shortcoder' ),
|
93 |
+
'add_new_item' => __( 'Add New Tag', 'shortcoder' ),
|
94 |
+
'edit_item' => __( 'Edit Tag', 'shortcoder' ),
|
95 |
+
'update_item' => __( 'Update Tag', 'shortcoder' ),
|
96 |
+
'view_item' => __( 'View Tag', 'shortcoder' ),
|
97 |
+
'separate_items_with_commas' => __( 'Separate tags with commas', 'shortcoder' ),
|
98 |
+
'add_or_remove_items' => __( 'Add or remove tags', 'shortcoder' ),
|
99 |
+
'choose_from_most_used' => __( 'Choose from the most used', 'shortcoder' ),
|
100 |
+
'popular_items' => __( 'Popular Tags', 'shortcoder' ),
|
101 |
+
'search_items' => __( 'Search Tags', 'shortcoder' ),
|
102 |
+
'not_found' => __( 'Not Found', 'shortcoder' ),
|
103 |
+
'no_terms' => __( 'No tags', 'shortcoder' ),
|
104 |
+
'items_list' => __( 'Tags list', 'shortcoder' ),
|
105 |
+
'items_list_navigation' => __( 'Tags list navigation', 'shortcoder' ),
|
106 |
);
|
107 |
$args = array(
|
108 |
'labels' => $labels,
|
137 |
'sc_version' => SC_VERSION,
|
138 |
'ajax_url' => get_admin_url() . 'admin-ajax.php',
|
139 |
'screen' => get_current_screen(),
|
140 |
+
'text_editor_switch_notice' => __( 'Switching editor will refresh the page. Please save your changes before refreshing. Do you want to refresh the page now ?', 'shortcoder' )
|
141 |
);
|
142 |
|
143 |
}
|
199 |
|
200 |
echo '<div class="sc_changelog"><main>
|
201 |
<article>' . $changelog . '</article>
|
202 |
+
<footer><button href="#" class="button button-primary dismiss_btn">' . __( 'Continue using Shortcoder', 'shortcoder' ) . '</a></footer>
|
203 |
</main></div>';
|
204 |
|
205 |
}
|
220 |
<div id="contextual-help-columns">
|
221 |
<div class="contextual-help-tabs">
|
222 |
<ul>
|
223 |
+
<li class="active"><a href="#export-tab" aria-controls="export-tab">' . __( 'Export', 'shortcoder' ) . '</a></li>
|
224 |
+
<li><a href="#import-tab" aria-controls="import-tab">' . __( 'Import', 'shortcoder' ) . '</a></li>
|
225 |
+
<li><a href="#import-others-tab" aria-controls="import-others-tab">' . __( 'Import from other sources', 'shortcoder' ) . '</a></li>
|
226 |
</ul>
|
227 |
</div>
|
228 |
+
<div class="contextual-help-sidebar"><p><a href="https://www.aakashweb.com/docs/shortcoder-doc/" target="_blank">' . __( 'Documentation', 'shortcoder' ) . '</a></p></div>
|
229 |
<div class="contextual-help-tabs-wrap">
|
230 |
<div id="export-tab" class="help-tab-content active">
|
231 |
+
<h3>' . __( 'Export', 'shortcoder' ) . '</h3><p>' . __( 'WordPress has a native exporter tool which can be used to export shortcoder data. Navigate to <code>Tools -> Export</code> and select "Shortcoder" as the content to export.', 'shortcoder' ) . '</p>
|
232 |
+
<a href="' . admin_url( 'export.php' ) . '" class="button button-primary">' . __( 'Go to export page', 'shortcoder' ) . '</a>
|
233 |
</div>
|
234 |
<div id="import-tab" class="help-tab-content">
|
235 |
+
<h3>' . __( 'Import', 'shortcoder' ) . '</h3><p>' . __( 'The XML file downloaded through the native export process can be imported via WordPress\'s own import tool. Navigate to <code>Tools -> Import</code>, install the importer plugin if not installed and run the importer under WordPress section.', 'shortcoder' ) . '</p>
|
236 |
+
<a href="' . admin_url( 'import.php' ) . '" class="button button-primary">' . __( 'Go to import page', 'shortcoder' ) . '</a>
|
237 |
</div>
|
238 |
<div id="import-others-tab" class="help-tab-content">
|
239 |
+
<h3>' . __( 'Import from other sources', 'shortcoder' ) . '</h3><p>' . __( 'To import from other sources like CSV, excel please read the below linked documentation.', 'shortcoder' ) . '</p>
|
240 |
+
<a href="https://www.aakashweb.com/docs/shortcoder-doc/import-export/" target="_blank" class="button button-primary">' . __( 'Open documentation', 'shortcoder' ) . '</a>
|
241 |
</div>
|
242 |
</div>
|
243 |
</div>
|
246 |
}
|
247 |
|
248 |
public static function action_links( $links ){
|
249 |
+
array_unshift( $links, '<a href="'. esc_url( admin_url( 'edit.php?post_type=shortcoder') ) .'">' . __( 'Manage shortcodes', 'shortcoder' ) . '</a>' );
|
250 |
return $links;
|
251 |
}
|
252 |
|
admin/edit.php
CHANGED
@@ -29,13 +29,13 @@ class SC_Admin_Edit{
|
|
29 |
$settings = Shortcoder::get_sc_settings( $post->ID );
|
30 |
|
31 |
echo '<div id="sc_name">';
|
32 |
-
echo '<input type="text" class="widefat" title="' . __( 'Name of the shortcode. Allowed characters are alphabets, numbers, hyphens and underscore.', '
|
33 |
echo '</div>';
|
34 |
|
35 |
echo '<div id="edit-slug-box">';
|
36 |
-
echo '<strong>' . __( 'Your shortcode', '
|
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</button></span>';
|
39 |
echo '</div>';
|
40 |
|
41 |
// Editor
|
@@ -48,11 +48,11 @@ class SC_Admin_Edit{
|
|
48 |
|
49 |
public static function add_meta_boxes(){
|
50 |
|
51 |
-
add_meta_box( 'sc_mb_settings', __( 'Shortcode settings', '
|
52 |
|
53 |
-
add_meta_box( 'sc_mb_coffee', __( 'Buy me a coffee !', '
|
54 |
|
55 |
-
add_meta_box( 'sc_mb_links', __( 'Feedback', '
|
56 |
|
57 |
remove_meta_box( 'slugdiv', SC_POST_TYPE, 'normal' );
|
58 |
|
@@ -70,34 +70,34 @@ class SC_Admin_Edit{
|
|
70 |
|
71 |
$fields = array(
|
72 |
|
73 |
-
array( __( 'Display name', '
|
74 |
'value' => $post->post_title,
|
75 |
'name' => 'post_title',
|
76 |
'class' => 'widefat',
|
77 |
-
'helper' => __( 'Name of the shortcode to display when it is listed', '
|
78 |
))),
|
79 |
|
80 |
-
array( __( 'Temporarily disable shortcode', '
|
81 |
'value' => $settings[ '_sc_disable_sc' ],
|
82 |
'name' => '_sc_disable_sc',
|
83 |
'list' => array(
|
84 |
'yes' => 'Yes',
|
85 |
'no' => 'No'
|
86 |
),
|
87 |
-
'helper' => __( 'Select to disable the shortcode from executing in all the places where it is used.', '
|
88 |
))),
|
89 |
|
90 |
-
array( __( 'Disable shortcode for administrators', '
|
91 |
'value' => $settings[ '_sc_disable_admin' ],
|
92 |
'name' => '_sc_disable_admin',
|
93 |
'list' => array(
|
94 |
'yes' => 'Yes',
|
95 |
'no' => 'No'
|
96 |
),
|
97 |
-
'helper' => __( 'Select to disable the shortcode from executing for administrators.', '
|
98 |
))),
|
99 |
|
100 |
-
array( __( 'Execute shortcode in devices', '
|
101 |
'value' => $settings[ '_sc_allowed_devices' ],
|
102 |
'name' => '_sc_allowed_devices',
|
103 |
'list' => array(
|
@@ -105,7 +105,7 @@ class SC_Admin_Edit{
|
|
105 |
'desktop_only' => 'Desktop only',
|
106 |
'mobile_only' => 'Mobile only'
|
107 |
),
|
108 |
-
'helper' => __( 'Select the devices where the shortcode should be executed. Note: If any caching plugin is used, a separate caching for desktop and mobile might be required.', '
|
109 |
))),
|
110 |
|
111 |
);
|
@@ -162,15 +162,15 @@ class SC_Admin_Edit{
|
|
162 |
$g = SC_Admin::clean_get();
|
163 |
|
164 |
$list = array(
|
165 |
-
'text' => __( 'Text editor', '
|
166 |
-
'visual' => __( 'Visual editor', '
|
167 |
-
'code' => __( 'Code editor', '
|
168 |
);
|
169 |
|
170 |
$editor = ( isset( $g[ 'editor' ] ) && array_key_exists( $g[ 'editor' ], $list ) ) ? $g[ 'editor' ] : $settings[ '_sc_editor' ];
|
171 |
|
172 |
$switch = '<span class="sc_editor_list sc_editor_icon_' . $editor . '">';
|
173 |
-
$switch .= '<select name="_sc_editor" class="sc_editor" title="' . __( 'Switch editor', '
|
174 |
foreach( $list as $id => $name ){
|
175 |
$switch .= '<option value="' . $id . '" ' . selected( $editor, $id, false ) . '>' . $name . '</option>';
|
176 |
}
|
@@ -274,11 +274,11 @@ class SC_Admin_Edit{
|
|
274 |
|
275 |
echo '<li><span class="dashicons dashicons-list-view"></span>' . __( 'Custom parameter', 'shortcoder' ) . '<ul>';
|
276 |
echo '<li class="sc_params_form"><h4>' . __( 'Enter custom parameter name', 'shortcoder' ) . '</h4>';
|
277 |
-
echo '<input type="text" class="sc_cp_box widefat" pattern="[a-zA-Z0-
|
278 |
echo '<h4>' . __( 'Default value', 'shortcoder' ) . '</h4>';
|
279 |
echo '<input type="text" class="sc_cp_default widefat"/>';
|
280 |
echo '<button class="button sc_cp_btn">' . __( 'Insert parameter', 'shortcoder' ) . '</button>';
|
281 |
-
echo '<p class="sc_cp_info"><small>' . __( 'Only alphabets and
|
282 |
echo '</ul></li>';
|
283 |
|
284 |
echo '<li><span class="dashicons dashicons-screenoptions"></span>' . __( 'Custom Fields', 'shortcoder' ) . '<ul>';
|
@@ -311,7 +311,7 @@ class SC_Admin_Edit{
|
|
311 |
}
|
312 |
echo '<option value="">Custom</option>';
|
313 |
echo '</select>';
|
314 |
-
echo '<a class="button button-primary cfe_btn" href="https://www.paypal.me/vaakash/6" data-link="https://www.paypal.me/vaakash/" target="_blank">Buy me coffee
|
315 |
echo '</div>';
|
316 |
echo '</div>';
|
317 |
}
|
29 |
$settings = Shortcoder::get_sc_settings( $post->ID );
|
30 |
|
31 |
echo '<div id="sc_name">';
|
32 |
+
echo '<input type="text" class="widefat" title="' . __( 'Name of the shortcode. Allowed characters are alphabets, numbers, hyphens and underscore.', 'shortcoder' ) . '" value="' . $post->post_name . '" name="post_name" id="post_name" pattern="[a-zA-z0-9\-_]+" required placeholder="' . __( 'Enter shortcode name', 'shortcoder' ) . '" />';
|
33 |
echo '</div>';
|
34 |
|
35 |
echo '<div id="edit-slug-box">';
|
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
|
48 |
|
49 |
public static function add_meta_boxes(){
|
50 |
|
51 |
+
add_meta_box( 'sc_mb_settings', __( 'Shortcode settings', 'shortcoder' ), array( __class__, 'settings_form' ), SC_POST_TYPE, 'normal', 'default' );
|
52 |
|
53 |
+
add_meta_box( 'sc_mb_coffee', __( 'Buy me a coffee !', 'shortcoder' ), array( __class__, 'coffee_box' ), SC_POST_TYPE, 'side', 'default' );
|
54 |
|
55 |
+
add_meta_box( 'sc_mb_links', __( 'Feedback', 'shortcoder' ), array( __class__, 'feedback' ), SC_POST_TYPE, 'side', 'default' );
|
56 |
|
57 |
remove_meta_box( 'slugdiv', SC_POST_TYPE, 'normal' );
|
58 |
|
70 |
|
71 |
$fields = array(
|
72 |
|
73 |
+
array( __( 'Display name', 'shortcoder' ), SC_Admin_Form::field( 'text', array(
|
74 |
'value' => $post->post_title,
|
75 |
'name' => 'post_title',
|
76 |
'class' => 'widefat',
|
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',
|
83 |
'list' => array(
|
84 |
'yes' => 'Yes',
|
85 |
'no' => 'No'
|
86 |
),
|
87 |
+
'helper' => __( 'Select to disable the shortcode from executing in all the places where it is used.', 'shortcoder' )
|
88 |
))),
|
89 |
|
90 |
+
array( __( 'Disable shortcode for administrators', 'shortcoder' ), SC_Admin_Form::field( 'select', array(
|
91 |
'value' => $settings[ '_sc_disable_admin' ],
|
92 |
'name' => '_sc_disable_admin',
|
93 |
'list' => array(
|
94 |
'yes' => 'Yes',
|
95 |
'no' => 'No'
|
96 |
),
|
97 |
+
'helper' => __( 'Select to disable the shortcode from executing for administrators.', 'shortcoder' )
|
98 |
))),
|
99 |
|
100 |
+
array( __( 'Execute shortcode in devices', 'shortcoder' ), SC_Admin_Form::field( 'select', array(
|
101 |
'value' => $settings[ '_sc_allowed_devices' ],
|
102 |
'name' => '_sc_allowed_devices',
|
103 |
'list' => array(
|
105 |
'desktop_only' => 'Desktop only',
|
106 |
'mobile_only' => 'Mobile only'
|
107 |
),
|
108 |
+
'helper' => __( 'Select the devices where the shortcode should be executed. Note: If any caching plugin is used, a separate caching for desktop and mobile might be required.', 'shortcoder' )
|
109 |
))),
|
110 |
|
111 |
);
|
162 |
$g = SC_Admin::clean_get();
|
163 |
|
164 |
$list = array(
|
165 |
+
'text' => __( 'Text editor', 'shortcoder' ),
|
166 |
+
'visual' => __( 'Visual editor', 'shortcoder' ),
|
167 |
+
'code' => __( 'Code editor', 'shortcoder' )
|
168 |
);
|
169 |
|
170 |
$editor = ( isset( $g[ 'editor' ] ) && array_key_exists( $g[ 'editor' ], $list ) ) ? $g[ 'editor' ] : $settings[ '_sc_editor' ];
|
171 |
|
172 |
$switch = '<span class="sc_editor_list sc_editor_icon_' . $editor . '">';
|
173 |
+
$switch .= '<select name="_sc_editor" class="sc_editor" title="' . __( 'Switch editor', 'shortcoder' ) . '">';
|
174 |
foreach( $list as $id => $name ){
|
175 |
$switch .= '<option value="' . $id . '" ' . selected( $editor, $id, false ) . '>' . $name . '</option>';
|
176 |
}
|
274 |
|
275 |
echo '<li><span class="dashicons dashicons-list-view"></span>' . __( 'Custom parameter', 'shortcoder' ) . '<ul>';
|
276 |
echo '<li class="sc_params_form"><h4>' . __( 'Enter custom parameter name', 'shortcoder' ) . '</h4>';
|
277 |
+
echo '<input type="text" class="sc_cp_box widefat" pattern="[a-zA-Z0-9_]+"/>';
|
278 |
echo '<h4>' . __( 'Default value', 'shortcoder' ) . '</h4>';
|
279 |
echo '<input type="text" class="sc_cp_default widefat"/>';
|
280 |
echo '<button class="button sc_cp_btn">' . __( 'Insert parameter', 'shortcoder' ) . '</button>';
|
281 |
+
echo '<p class="sc_cp_info"><small>' . __( 'Only alphabets, numbers and underscores are allowed. Custom parameters are case insensitive', 'shortcoder' ) . '</small></p></li>';
|
282 |
echo '</ul></li>';
|
283 |
|
284 |
echo '<li><span class="dashicons dashicons-screenoptions"></span>' . __( 'Custom Fields', 'shortcoder' ) . '<ul>';
|
311 |
}
|
312 |
echo '<option value="">Custom</option>';
|
313 |
echo '</select>';
|
314 |
+
echo '<a class="button button-primary cfe_btn" href="https://www.paypal.me/vaakash/6" data-link="https://www.paypal.me/vaakash/" target="_blank">' . __( 'Buy me a coffee !', 'shortcoder' ) . '</a>';
|
315 |
echo '</div>';
|
316 |
echo '</div>';
|
317 |
}
|
admin/insert.php
CHANGED
@@ -35,6 +35,9 @@ if( empty( $shortcodes ) ){
|
|
35 |
$cp_data = $matches[1];
|
36 |
|
37 |
if( !empty( $cp_data ) ){
|
|
|
|
|
|
|
38 |
foreach( $cp_data as $data ){
|
39 |
$colon_pos = strpos( $data, ':' );
|
40 |
if( $colon_pos === false ){
|
@@ -83,7 +86,7 @@ if( empty( $shortcodes ) ){
|
|
83 |
}
|
84 |
|
85 |
echo '<div class="sc_foot">';
|
86 |
-
echo '<button class="sc_insert button button-primary">' . __( 'Insert shortcode', '
|
87 |
if( $enclosed_sc == 'true' ){
|
88 |
echo '<span>' . __( 'Has enclosed content parameter', 'shortcoder' ) . '</span>';
|
89 |
}
|
35 |
$cp_data = $matches[1];
|
36 |
|
37 |
if( !empty( $cp_data ) ){
|
38 |
+
|
39 |
+
$cp_data = array_map( 'strtolower', $cp_data );
|
40 |
+
|
41 |
foreach( $cp_data as $data ){
|
42 |
$colon_pos = strpos( $data, ':' );
|
43 |
if( $colon_pos === false ){
|
86 |
}
|
87 |
|
88 |
echo '<div class="sc_foot">';
|
89 |
+
echo '<button class="sc_insert button button-primary">' . __( 'Insert shortcode', 'shortcoder' ) . '</button>';
|
90 |
if( $enclosed_sc == 'true' ){
|
91 |
echo '<span>' . __( 'Has enclosed content parameter', 'shortcoder' ) . '</span>';
|
92 |
}
|
includes/updates.php
CHANGED
@@ -31,13 +31,13 @@ class Shortcoder_Updates{
|
|
31 |
}
|
32 |
}
|
33 |
|
34 |
-
if( version_compare( $previous_version, '5.0', '>' ) ){
|
35 |
if( !self::do_update_504() ){
|
36 |
return false;
|
37 |
}
|
38 |
}
|
39 |
|
40 |
-
// Register roles
|
41 |
self::register_roles();
|
42 |
|
43 |
delete_transient( 'sc_upgrade' );
|
31 |
}
|
32 |
}
|
33 |
|
34 |
+
if( version_compare( $previous_version, '5.0', '>' ) && version_compare( $previous_version, '5.1', '<' ) ){
|
35 |
if( !self::do_update_504() ){
|
36 |
return false;
|
37 |
}
|
38 |
}
|
39 |
|
40 |
+
// Register roles every time plugin is updated.
|
41 |
self::register_roles();
|
42 |
|
43 |
delete_transient( 'sc_upgrade' );
|
readme.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
=== Shortcoder ===
|
2 |
Contributors: vaakash
|
3 |
Author URI: https://www.aakashweb.com/
|
4 |
Plugin URI: https://www.aakashweb.com/wordpress-plugins/shortcoder/
|
@@ -8,7 +8,7 @@ License: GPLv2 or later
|
|
8 |
Requires PHP: 5.3
|
9 |
Requires at least: 4.4
|
10 |
Tested up to: 5.3.2
|
11 |
-
Stable tag: 5.
|
12 |
|
13 |
Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
|
14 |
|
@@ -88,6 +88,11 @@ Please check the following if you notice that the shortcode content is not print
|
|
88 |
|
89 |
== Changelog ==
|
90 |
|
|
|
|
|
|
|
|
|
|
|
91 |
= 5.2.1 =
|
92 |
* Fix: Custom parameters being not replaced in some scenarios.
|
93 |
* Fix: Minor enhancement to insert custom parameter form.
|
@@ -202,7 +207,7 @@ Please check the following if you notice that the shortcode content is not print
|
|
202 |
= 4.0 =
|
203 |
* New: Plugin rewritten from scratch.
|
204 |
* New: Brand new administration page
|
205 |
-
* New: Shortcode
|
206 |
* New: Insert WordPress information into shortcode content.
|
207 |
* Fix: Insert shortcode window is not loading.
|
208 |
* Fix: Unable to delete the shortcodes
|
1 |
+
=== Shortcoder - Create your own shortcodes ===
|
2 |
Contributors: vaakash
|
3 |
Author URI: https://www.aakashweb.com/
|
4 |
Plugin URI: https://www.aakashweb.com/wordpress-plugins/shortcoder/
|
8 |
Requires PHP: 5.3
|
9 |
Requires at least: 4.4
|
10 |
Tested up to: 5.3.2
|
11 |
+
Stable tag: 5.3
|
12 |
|
13 |
Create custom "Shortcodes" easily for HTML, JavaScript snippets and use the shortcodes within posts, pages & widgets.
|
14 |
|
88 |
|
89 |
== Changelog ==
|
90 |
|
91 |
+
= 5.3 =
|
92 |
+
* New: Added support for underscores in custom parameters.
|
93 |
+
* New: Getting ready for internationalization of the plugin.
|
94 |
+
* Fix: Insert shortcode popup shows duplicate available parameters in case of same parameter with different case.
|
95 |
+
|
96 |
= 5.2.1 =
|
97 |
* Fix: Custom parameters being not replaced in some scenarios.
|
98 |
* Fix: Minor enhancement to insert custom parameter form.
|
207 |
= 4.0 =
|
208 |
* New: Plugin rewritten from scratch.
|
209 |
* New: Brand new administration page
|
210 |
+
* New: Shortcode visibility settings, show/hide in desktop/mobile devices
|
211 |
* New: Insert WordPress information into shortcode content.
|
212 |
* Fix: Insert shortcode window is not loading.
|
213 |
* Fix: Unable to delete the shortcodes
|
shortcoder.php
CHANGED
@@ -4,11 +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 |
*/
|
10 |
|
11 |
-
define( 'SC_VERSION', '5.
|
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' ) );
|
@@ -202,7 +204,7 @@ final class Shortcoder{
|
|
202 |
|
203 |
$params = array_change_key_case( $params, CASE_LOWER );
|
204 |
|
205 |
-
preg_match_all('/%%([a-zA-
|
206 |
|
207 |
$cp_tags = $matches[0];
|
208 |
$cp_names = $matches[1];
|
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.3
|
8 |
Author URI: https://www.aakashweb.com/
|
9 |
+
Text Domain: shortcoder
|
10 |
+
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
+
define( 'SC_VERSION', '5.3' );
|
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' ) );
|
204 |
|
205 |
$params = array_change_key_case( $params, CASE_LOWER );
|
206 |
|
207 |
+
preg_match_all('/%%([a-zA-Z0-9_]+)\:?(.*?)%%/', $content, $matches);
|
208 |
|
209 |
$cp_tags = $matches[0];
|
210 |
$cp_names = $matches[1];
|