Version Description
- Made compatible with WP 5.0+.
Download this release
Release Info
Developer | MyThemeShop |
Plugin | WP Shortcode by MyThemeShop |
Version | 1.4.15 |
Comparing to | |
See all releases |
Code changes from version 1.4.14 to 1.4.15
- readme.txt +136 -133
- tinymce/editor_plugin.js +0 -2
- wp-shortcode.php +534 -534
readme.txt
CHANGED
@@ -1,133 +1,136 @@
|
|
1 |
-
=== WP Shortcode by MyThemeShop ===
|
2 |
-
Contributors: mythemeshop
|
3 |
-
Creator's website link: http://mythemeshop.com/
|
4 |
-
Tags: shortcodes, shortcode, shortcodes list, toggle shortcode, buttons, google map shortcode, youtube shortcode, vimeo shortcode, alert shortcode, notification shortcode, column shortcodes
|
5 |
-
Requires at least: 3.0.1
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.4.
|
8 |
-
License: GPLv2 or later
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
|
11 |
-
WP Shortcode is a premium WP plugin for free, that provides easy to use over 24 shortcodes. You can easily add buttons, alerts, videos and more.
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
Add sexy-buttons, spoiler warnings, column layouts and much more to WordPress. WP Shortcode makes it happen with a click of a button. Until now, this premium plugin was available to premium members of <a href="http://mythemeshop.com/">MyThemeShop</a>, but now everyone can use this premium plugin.
|
16 |
-
|
17 |
-
Why use WP Shortcode plugin? Tired of using a theme with built-in shortcodes, switching themes and then losing all your awesome styles? WP Shortcode offers over 24 useful shortcodes, so you'll never lose anything when changing your theme. Now you can add buttons, highlights, boxes, toggles, tabs, pricing tables, among other awesomeness, and take them with you no matter what theme you decide to use.
|
18 |
-
|
19 |
-
We at MyThemeShop realise there are already some free shortcode plugins out, but they either only include a very few amount of shortcodes, they are way too complex, not well-coded, not styled to our liking or they weren’t free. We wanted to create something that was 100% GPL so you can use it and abuse it on all of your websites and client projects – and of course that’s very easy to use and minimally styled, so it can fit most sites right out of the box or be easily customized.
|
20 |
-
|
21 |
-
To see a full list of options available with this powerful plugin, try this page: <a href="http://demo.mythemeshop.com/spike/shortcodes-examples/">http://demo.mythemeshop.com/spike/shortcodes-examples/</a>
|
22 |
-
|
23 |
-
= Shortcodes Included =
|
24 |
-
Buttons, Videos, Alerts, Google Maps, Toggle, Tabs, dividers, Columns And much more! Easily add nice looking elements to your WordPress website without any knowledge of coding!
|
25 |
-
|
26 |
-
= Support =
|
27 |
-
|
28 |
-
All support for this plugin is provided through our forums. If you have not registered yet, you can do so here for **FREE** <br>
|
29 |
-
<a href=“https://mythemeshop.com/#signup”>https://mythemeshop.com/#signup</a>
|
30 |
-
|
31 |
-
If after checking our Free WordPress video tutorials here:<br>
|
32 |
-
<a href=“https://mythemeshop.com/wordpress-101/”>https://mythemeshop.com/wordpress-101/</a><br>
|
33 |
-
&<br>
|
34 |
-
<a href=“https://community.mythemeshop.com/tutorials/category/2-free-video-tutorials/“>https://community.mythemeshop.com/tutorials/category/2-free-video-tutorials/</a><br>
|
35 |
-
<br>
|
36 |
-
you are still stuck, please feel free to open a new thread, and a member of our support team will be happy to help.<br>
|
37 |
-
|
38 |
-
Support link:<br>
|
39 |
-
<a href=“https://community.mythemeshop.com/forum/11-free-plugin-support/”>https://community.mythemeshop.com/forum/11-free-plugin-support/</a><br>
|
40 |
-
<br>
|
41 |
-
|
42 |
-
== Installation ==
|
43 |
-
|
44 |
-
This section describes how to install the plugin and get it working.
|
45 |
-
|
46 |
-
1. Upload the `wp-shortcode` folder to the to the `/wp-content/plugins/` directory
|
47 |
-
2. Activate the plugin through the 'Plugins' menu in WordPress
|
48 |
-
3. You can see '+' button on post editor, using this button, you can add shortcodes in your posts.
|
49 |
-
|
50 |
-
== Frequently Asked Questions ==
|
51 |
-
|
52 |
-
= Shortcodes + button is not working =
|
53 |
-
|
54 |
-
Please disable all plugins and check if shortcode plugin is working properly. Then you can enable all plugins one by one to find out which plugin is conflicting with WP Shortcode plugin.
|
55 |
-
|
56 |
-
== Screenshots ==
|
57 |
-
|
58 |
-
1. Single Shortcode Configuration
|
59 |
-
2. List of all plugins.
|
60 |
-
3. Alerts and Buttons
|
61 |
-
4. Tabs and Toggles
|
62 |
-
5. Videos and Dividers
|
63 |
-
6. Columns Shortcodes
|
64 |
-
7. Google Maps Shortcode
|
65 |
-
|
66 |
-
== Changelog ==
|
67 |
-
|
68 |
-
= 1.4.
|
69 |
-
*
|
70 |
-
|
71 |
-
= 1.4.
|
72 |
-
*
|
73 |
-
|
74 |
-
= 1.4.
|
75 |
-
*
|
76 |
-
|
77 |
-
= 1.4.
|
78 |
-
* Fixed
|
79 |
-
|
80 |
-
= 1.4.
|
81 |
-
*
|
82 |
-
|
83 |
-
= 1.4.
|
84 |
-
*
|
85 |
-
|
86 |
-
= 1.4.
|
87 |
-
*
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
*
|
92 |
-
|
93 |
-
= 1.4.
|
94 |
-
*
|
95 |
-
|
96 |
-
= 1.4.
|
97 |
-
* Fixed
|
98 |
-
|
99 |
-
= 1.4.
|
100 |
-
* Fixed
|
101 |
-
|
102 |
-
= 1.4.
|
103 |
-
*
|
104 |
-
|
105 |
-
|
106 |
-
*
|
107 |
-
|
108 |
-
|
109 |
-
*
|
110 |
-
|
111 |
-
= 1.4.
|
112 |
-
*
|
113 |
-
|
114 |
-
= 1.4 =
|
115 |
-
*
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
*
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
* Made
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
*
|
131 |
-
|
132 |
-
= 1.
|
133 |
-
*
|
|
|
|
|
|
1 |
+
=== WP Shortcode by MyThemeShop ===
|
2 |
+
Contributors: mythemeshop
|
3 |
+
Creator's website link: http://mythemeshop.com/
|
4 |
+
Tags: shortcodes, shortcode, shortcodes list, toggle shortcode, buttons, google map shortcode, youtube shortcode, vimeo shortcode, alert shortcode, notification shortcode, column shortcodes
|
5 |
+
Requires at least: 3.0.1
|
6 |
+
Tested up to: 5.0.1
|
7 |
+
Stable tag: 1.4.15
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
WP Shortcode is a premium WP plugin for free, that provides easy to use over 24 shortcodes. You can easily add buttons, alerts, videos and more.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
Add sexy-buttons, spoiler warnings, column layouts and much more to WordPress. WP Shortcode makes it happen with a click of a button. Until now, this premium plugin was available to premium members of <a href="http://mythemeshop.com/">MyThemeShop</a>, but now everyone can use this premium plugin.
|
16 |
+
|
17 |
+
Why use WP Shortcode plugin? Tired of using a theme with built-in shortcodes, switching themes and then losing all your awesome styles? WP Shortcode offers over 24 useful shortcodes, so you'll never lose anything when changing your theme. Now you can add buttons, highlights, boxes, toggles, tabs, pricing tables, among other awesomeness, and take them with you no matter what theme you decide to use.
|
18 |
+
|
19 |
+
We at MyThemeShop realise there are already some free shortcode plugins out, but they either only include a very few amount of shortcodes, they are way too complex, not well-coded, not styled to our liking or they weren’t free. We wanted to create something that was 100% GPL so you can use it and abuse it on all of your websites and client projects – and of course that’s very easy to use and minimally styled, so it can fit most sites right out of the box or be easily customized.
|
20 |
+
|
21 |
+
To see a full list of options available with this powerful plugin, try this page: <a href="http://demo.mythemeshop.com/spike/shortcodes-examples/">http://demo.mythemeshop.com/spike/shortcodes-examples/</a>
|
22 |
+
|
23 |
+
= Shortcodes Included =
|
24 |
+
Buttons, Videos, Alerts, Google Maps, Toggle, Tabs, dividers, Columns And much more! Easily add nice looking elements to your WordPress website without any knowledge of coding!
|
25 |
+
|
26 |
+
= Support =
|
27 |
+
|
28 |
+
All support for this plugin is provided through our forums. If you have not registered yet, you can do so here for **FREE** <br>
|
29 |
+
<a href=“https://mythemeshop.com/#signup”>https://mythemeshop.com/#signup</a>
|
30 |
+
|
31 |
+
If after checking our Free WordPress video tutorials here:<br>
|
32 |
+
<a href=“https://mythemeshop.com/wordpress-101/”>https://mythemeshop.com/wordpress-101/</a><br>
|
33 |
+
&<br>
|
34 |
+
<a href=“https://community.mythemeshop.com/tutorials/category/2-free-video-tutorials/“>https://community.mythemeshop.com/tutorials/category/2-free-video-tutorials/</a><br>
|
35 |
+
<br>
|
36 |
+
you are still stuck, please feel free to open a new thread, and a member of our support team will be happy to help.<br>
|
37 |
+
|
38 |
+
Support link:<br>
|
39 |
+
<a href=“https://community.mythemeshop.com/forum/11-free-plugin-support/”>https://community.mythemeshop.com/forum/11-free-plugin-support/</a><br>
|
40 |
+
<br>
|
41 |
+
|
42 |
+
== Installation ==
|
43 |
+
|
44 |
+
This section describes how to install the plugin and get it working.
|
45 |
+
|
46 |
+
1. Upload the `wp-shortcode` folder to the to the `/wp-content/plugins/` directory
|
47 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
48 |
+
3. You can see '+' button on post editor, using this button, you can add shortcodes in your posts.
|
49 |
+
|
50 |
+
== Frequently Asked Questions ==
|
51 |
+
|
52 |
+
= Shortcodes + button is not working =
|
53 |
+
|
54 |
+
Please disable all plugins and check if shortcode plugin is working properly. Then you can enable all plugins one by one to find out which plugin is conflicting with WP Shortcode plugin.
|
55 |
+
|
56 |
+
== Screenshots ==
|
57 |
+
|
58 |
+
1. Single Shortcode Configuration
|
59 |
+
2. List of all plugins.
|
60 |
+
3. Alerts and Buttons
|
61 |
+
4. Tabs and Toggles
|
62 |
+
5. Videos and Dividers
|
63 |
+
6. Columns Shortcodes
|
64 |
+
7. Google Maps Shortcode
|
65 |
+
|
66 |
+
== Changelog ==
|
67 |
+
|
68 |
+
= 1.4.15 =
|
69 |
+
* Made compatible with WP 5.0+.
|
70 |
+
|
71 |
+
= 1.4.14 =
|
72 |
+
* Updated admin notices
|
73 |
+
|
74 |
+
= 1.4.13 =
|
75 |
+
* Changed admin notices
|
76 |
+
|
77 |
+
= 1.4.12 =
|
78 |
+
* Fixed responsive column issue.
|
79 |
+
|
80 |
+
= 1.4.11 =
|
81 |
+
* Fixed broken pages.
|
82 |
+
|
83 |
+
= 1.4.10 =
|
84 |
+
* Enqueued required scripts only on the pages where the plugin's shortcodes are used.
|
85 |
+
|
86 |
+
= 1.4.9 =
|
87 |
+
* Fixed shortcodes filter
|
88 |
+
|
89 |
+
= 1.4.8 =
|
90 |
+
* Added filter to extend list of shortcodes
|
91 |
+
* Minor fixes
|
92 |
+
|
93 |
+
= 1.4.7 =
|
94 |
+
* Removed unused code
|
95 |
+
|
96 |
+
= 1.4.6 =
|
97 |
+
* Fixed styling and escaping issues
|
98 |
+
|
99 |
+
= 1.4.5 =
|
100 |
+
* Fixed sanitize_html_class() functions
|
101 |
+
|
102 |
+
= 1.4.4 =
|
103 |
+
* Fixed XSS vulnerability (thanks to https://www.threatpress.com)
|
104 |
+
|
105 |
+
= 1.4.3 =
|
106 |
+
* Added shortcode attribute "rel" to buttons
|
107 |
+
* Updated tabs shortcode to support more characters like emojis!
|
108 |
+
* Fixed toggle shortcode styling bug on smaller screens
|
109 |
+
* Fixed notices when no title is provided in tabs shortcode
|
110 |
+
|
111 |
+
= 1.4.2 =
|
112 |
+
* Changed text domain to 'wp-shortcode'
|
113 |
+
|
114 |
+
= 1.4.1 =
|
115 |
+
* Fixed embed video issue in half column
|
116 |
+
|
117 |
+
= 1.4 =
|
118 |
+
* Complete revamp of notification and button shortcode design.
|
119 |
+
* Removed unnecessary images.
|
120 |
+
* Optimized CSS code.
|
121 |
+
|
122 |
+
= 1.3 =
|
123 |
+
* Added Tooltip shortcode
|
124 |
+
* Fixed tab titles issue
|
125 |
+
* Made embed URLs protocol-relative
|
126 |
+
|
127 |
+
= 1.2 =
|
128 |
+
* Made compatible with (with TinyMCE 3 & 4).
|
129 |
+
* Made translation-ready
|
130 |
+
* Added "centre" position for buttons.
|
131 |
+
|
132 |
+
= 1.1 =
|
133 |
+
* Fixed small issue in button shortcode CSS.
|
134 |
+
|
135 |
+
= 1.0 =
|
136 |
+
* Official plugin release.
|
tinymce/editor_plugin.js
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
(function() {
|
2 |
-
// Load plugin specific language pack
|
3 |
-
tinymce.PluginManager.requireLangPack('wpspanel');
|
4 |
tinymce.create('tinymce.plugins.wpspanel', {
|
5 |
/**
|
6 |
* Initializes the plugin, this will be executed after the plugin has been created.
|
1 |
(function() {
|
|
|
|
|
2 |
tinymce.create('tinymce.plugins.wpspanel', {
|
3 |
/**
|
4 |
* Initializes the plugin, this will be executed after the plugin has been created.
|
wp-shortcode.php
CHANGED
@@ -1,535 +1,535 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: WP Shortcode by MyThemeShop
|
4 |
-
Plugin URI: http://mythemeshop.com/
|
5 |
-
Description: With the vast array of shortcodes, you can quickly and easily build content for your posts and pages and turbocharge your blogging experience.
|
6 |
-
Author: MyThemeShop
|
7 |
-
Version: 1.4.
|
8 |
-
Author URI: http://mythemeshop.com/
|
9 |
-
*/
|
10 |
-
|
11 |
-
function mts_wpshortcodes_scripts() {
|
12 |
-
wp_register_style('tipsy', plugins_url('css/tipsy.css', __FILE__));
|
13 |
-
wp_register_style('mts_wpshortcodes', plugins_url('css/wp-shortcode.css', __FILE__));
|
14 |
-
wp_register_script('tipsy', plugins_url('js/jquery.tipsy.js', __FILE__), array('jquery'));
|
15 |
-
wp_register_script('mts_wpshortcodes', plugins_url('js/wp-shortcode.js', __FILE__), array('jquery'));
|
16 |
-
}
|
17 |
-
add_action('wp_enqueue_scripts', 'mts_wpshortcodes_scripts', 99);
|
18 |
-
|
19 |
-
add_action('admin_enqueue_scripts', function(){
|
20 |
-
wp_enqueue_script( 'mts_wpshortcodes_admin', plugins_url('js/admin.js', __FILE__), array('jquery') );
|
21 |
-
});
|
22 |
-
|
23 |
-
function mts_wps_enqueue_scripts($shortcode = '') {
|
24 |
-
|
25 |
-
if($shortcode == 'tooltip') {
|
26 |
-
wp_enqueue_style( 'tipsy' );
|
27 |
-
wp_enqueue_script( 'tipsy' );
|
28 |
-
}
|
29 |
-
wp_enqueue_style('mts_wpshortcodes');
|
30 |
-
if($shortcode == 'tooltip' || $shortcode == 'tabs' || $shortcode == 'toggle') {
|
31 |
-
wp_enqueue_script('mts_wpshortcodes');
|
32 |
-
}
|
33 |
-
}
|
34 |
-
add_action('wps_enqueue_style', 'mts_wps_enqueue_scripts', 10, 1);
|
35 |
-
|
36 |
-
function mts_wpshortcodes_load_textdomain() {
|
37 |
-
load_plugin_textdomain( 'wp-shortcode', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
38 |
-
}
|
39 |
-
add_action( 'plugins_loaded', 'mts_wpshortcodes_load_textdomain' );
|
40 |
-
|
41 |
-
// hide built-in shortcodes button for MTS themes
|
42 |
-
add_action('admin_head', 'mts_wpshortcodes_theme_compatibility');
|
43 |
-
|
44 |
-
function mts_wpshortcodes_theme_compatibility() {
|
45 |
-
echo '<style type="text/css">#content_mnmpanel {display: none;}</style>';
|
46 |
-
}
|
47 |
-
|
48 |
-
include('tinymce/tinymce.php');
|
49 |
-
|
50 |
-
// override theme shortcodes
|
51 |
-
add_action( 'after_setup_theme', 'mts_wpshortcodes_add' );
|
52 |
-
|
53 |
-
function mts_wpshortcodes_add() {
|
54 |
-
remove_shortcode('button-brown'); add_shortcode('button-brown', 'mts_button_brown');
|
55 |
-
remove_shortcode('button-blue'); add_shortcode('button-blue', 'mts_button_blue');
|
56 |
-
remove_shortcode('button-green'); add_shortcode('button-green', 'mts_button_green');
|
57 |
-
remove_shortcode('button-red'); add_shortcode('button-red', 'mts_button_red');
|
58 |
-
remove_shortcode('button-white'); add_shortcode('button-white', 'mts_button_white');
|
59 |
-
remove_shortcode('button-yellow'); add_shortcode('button-yellow', 'mts_button_yellow');
|
60 |
-
remove_shortcode('alert-note'); add_shortcode('alert-note', 'mts_alert_note');
|
61 |
-
remove_shortcode('alert-announce'); add_shortcode('alert-announce', 'mts_alert_announce');
|
62 |
-
remove_shortcode('alert-success'); add_shortcode('alert-success', 'mts_alert_success');
|
63 |
-
remove_shortcode('alert-warning'); add_shortcode('alert-warning', 'mts_alert_warning');
|
64 |
-
remove_shortcode('one_third'); add_shortcode('one_third', 'mts_one_third');
|
65 |
-
remove_shortcode('one_third_last'); add_shortcode('one_third_last', 'mts_one_third_last');
|
66 |
-
remove_shortcode('two_third'); add_shortcode('two_third', 'mts_two_third');
|
67 |
-
remove_shortcode('two_third_last'); add_shortcode('two_third_last', 'mts_two_third_last');
|
68 |
-
remove_shortcode('one_half'); add_shortcode('one_half', 'mts_one_half');
|
69 |
-
remove_shortcode('one_half_last'); add_shortcode('one_half_last', 'mts_one_half_last');
|
70 |
-
remove_shortcode('one_fourth'); add_shortcode('one_fourth', 'mts_one_fourth');
|
71 |
-
remove_shortcode('one_fourth_last'); add_shortcode('one_fourth_last', 'mts_one_fourth_last');
|
72 |
-
remove_shortcode('three_fourth'); add_shortcode('three_fourth', 'mts_three_fourth');
|
73 |
-
remove_shortcode('three_fourth_last'); add_shortcode('three_fourth_last', 'mts_three_fourth_last');
|
74 |
-
remove_shortcode('one_fifth'); add_shortcode('one_fifth', 'mts_one_fifth');
|
75 |
-
remove_shortcode('one_fifth_last'); add_shortcode('one_fifth_last', 'mts_one_fifth_last');
|
76 |
-
remove_shortcode('two_fifth'); add_shortcode('two_fifth', 'mts_two_fifth');
|
77 |
-
remove_shortcode('two_fifth_last'); add_shortcode('two_fifth_last', 'mts_two_fifth_last');
|
78 |
-
remove_shortcode('three_fifth'); add_shortcode('three_fifth', 'mts_three_fifth');
|
79 |
-
remove_shortcode('three_fifth_last'); add_shortcode('three_fifth_last', 'mts_three_fifth_last');
|
80 |
-
remove_shortcode('four_fifth'); add_shortcode('four_fifth', 'mts_four_fifth');
|
81 |
-
remove_shortcode('four_fifth_last'); add_shortcode('four_fifth_last', 'mts_four_fifth_last');
|
82 |
-
remove_shortcode('one_sixth'); add_shortcode('one_sixth', 'mts_one_sixth');
|
83 |
-
remove_shortcode('one_sixth_last'); add_shortcode('one_sixth_last', 'mts_one_sixth_last');
|
84 |
-
remove_shortcode('five_sixth'); add_shortcode('five_sixth', 'mts_five_sixth');
|
85 |
-
remove_shortcode('five_sixth_last'); add_shortcode('five_sixth_last', 'mts_five_sixth_last');
|
86 |
-
remove_shortcode('youtube'); add_shortcode('youtube', 'mts_youtube_video');
|
87 |
-
remove_shortcode('vimeo'); add_shortcode('vimeo', 'mts_vimeo_video');
|
88 |
-
remove_shortcode('googlemap'); add_shortcode('googlemap', 'mts_googleMaps');
|
89 |
-
remove_shortcode('tabs'); add_shortcode('tabs', 'mts_tabs');
|
90 |
-
remove_shortcode('toggle'); add_shortcode('toggle', 'mts_toggle');
|
91 |
-
remove_shortcode('divider'); add_shortcode('divider', 'mts_divider');
|
92 |
-
remove_shortcode('divider_top'); add_shortcode('divider_top', 'mts_divider_top');
|
93 |
-
remove_shortcode('clear'); add_shortcode('clear', 'mts_clear');
|
94 |
-
add_shortcode('tooltip', 'mts_tooltip');
|
95 |
-
}
|
96 |
-
|
97 |
-
|
98 |
-
/*-----------------------------------------------------------------------------------*/
|
99 |
-
/* Buttons Shortcodes
|
100 |
-
/*-----------------------------------------------------------------------------------*/
|
101 |
-
|
102 |
-
function mts_button_brown( $atts, $content = null ) {
|
103 |
-
extract(shortcode_atts(array(
|
104 |
-
'url' => '#',
|
105 |
-
'target' => '_self',
|
106 |
-
'position' => 'left',
|
107 |
-
'rel' => '',
|
108 |
-
), $atts));
|
109 |
-
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_brown " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
110 |
-
if ($position == 'center') {
|
111 |
-
$out = '<div class="button-center">'.$out.'</div>';
|
112 |
-
}
|
113 |
-
do_action('wps_enqueue_style');
|
114 |
-
return $out;
|
115 |
-
}
|
116 |
-
|
117 |
-
function mts_button_blue( $atts, $content = null ) {
|
118 |
-
extract(shortcode_atts(array(
|
119 |
-
'url' => '#',
|
120 |
-
'target' => '_self',
|
121 |
-
'position' => 'left',
|
122 |
-
'rel' => '',
|
123 |
-
), $atts));
|
124 |
-
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_blue " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
125 |
-
if ($position == 'center') {
|
126 |
-
$out = '<div class="button-center">'.$out.'</div>';
|
127 |
-
}
|
128 |
-
|
129 |
-
do_action('wps_enqueue_style');
|
130 |
-
return $out;
|
131 |
-
}
|
132 |
-
|
133 |
-
function mts_button_green( $atts, $content = null ) {
|
134 |
-
extract(shortcode_atts(array(
|
135 |
-
'url' => '#',
|
136 |
-
'target' => '_self',
|
137 |
-
'position' => 'left',
|
138 |
-
'rel' => '',
|
139 |
-
), $atts));
|
140 |
-
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_green " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
141 |
-
if ($position == 'center') {
|
142 |
-
$out = '<div class="button-center">'.$out.'</div>';
|
143 |
-
}
|
144 |
-
|
145 |
-
do_action('wps_enqueue_style');
|
146 |
-
return $out;
|
147 |
-
}
|
148 |
-
|
149 |
-
function mts_button_red( $atts, $content = null ) {
|
150 |
-
extract(shortcode_atts(array(
|
151 |
-
'url' => '#',
|
152 |
-
'target' => '_self',
|
153 |
-
'position' => 'left',
|
154 |
-
'rel' => '',
|
155 |
-
), $atts));
|
156 |
-
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_red " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
157 |
-
if ($position == 'center') {
|
158 |
-
$out = '<div class="button-center">'.$out.'</div>';
|
159 |
-
}
|
160 |
-
|
161 |
-
do_action('wps_enqueue_style');
|
162 |
-
return $out;
|
163 |
-
}
|
164 |
-
|
165 |
-
function mts_button_white( $atts, $content = null ) {
|
166 |
-
extract(shortcode_atts(array(
|
167 |
-
'url' => '#',
|
168 |
-
'target' => '_self',
|
169 |
-
'position' => 'left',
|
170 |
-
'rel' => '',
|
171 |
-
), $atts));
|
172 |
-
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_white " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
173 |
-
if ($position == 'center') {
|
174 |
-
$out = '<div class="button-center">'.$out.'</div>';
|
175 |
-
}
|
176 |
-
|
177 |
-
do_action('wps_enqueue_style');
|
178 |
-
return $out;
|
179 |
-
}
|
180 |
-
|
181 |
-
function mts_button_yellow( $atts, $content = null ) {
|
182 |
-
extract(shortcode_atts(array(
|
183 |
-
'url' => '#',
|
184 |
-
'target' => '_self',
|
185 |
-
'position' => 'left',
|
186 |
-
'rel' => '',
|
187 |
-
), $atts));
|
188 |
-
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_yellow " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
189 |
-
if ($position == 'center') {
|
190 |
-
$out = '<div class="button-center">'.$out.'</div>';
|
191 |
-
}
|
192 |
-
|
193 |
-
do_action('wps_enqueue_style');
|
194 |
-
return $out;
|
195 |
-
}
|
196 |
-
|
197 |
-
/*-----------------------------------------------------------------------------------*/
|
198 |
-
/* Alert Shortcodes
|
199 |
-
/*-----------------------------------------------------------------------------------*/
|
200 |
-
|
201 |
-
function mts_alert_note( $atts, $content = null ) {
|
202 |
-
extract(shortcode_atts(array(
|
203 |
-
'style' => 'note'
|
204 |
-
), $atts));
|
205 |
-
$out = "<div class=\"message_box note\"><p>".do_shortcode($content)."</p></div>";
|
206 |
-
|
207 |
-
do_action('wps_enqueue_style');
|
208 |
-
return $out;
|
209 |
-
}
|
210 |
-
|
211 |
-
function mts_alert_announce( $atts, $content = null ) {
|
212 |
-
extract(shortcode_atts(array(
|
213 |
-
'style' => 'announce'
|
214 |
-
), $atts));
|
215 |
-
$out = "<div class=\"message_box announce\"><p>".do_shortcode($content)."</p></div>";
|
216 |
-
|
217 |
-
do_action('wps_enqueue_style');
|
218 |
-
return $out;
|
219 |
-
}
|
220 |
-
|
221 |
-
function mts_alert_success( $atts, $content = null ) {
|
222 |
-
extract(shortcode_atts(array(
|
223 |
-
'style' => 'success'
|
224 |
-
), $atts));
|
225 |
-
$out = "<div class=\"message_box success\"><p>".do_shortcode($content)."</p></div>";
|
226 |
-
|
227 |
-
do_action('wps_enqueue_style');
|
228 |
-
return $out;
|
229 |
-
}
|
230 |
-
|
231 |
-
function mts_alert_warning( $atts, $content = null ) {
|
232 |
-
extract(shortcode_atts(array(
|
233 |
-
'style' => 'warning'
|
234 |
-
), $atts));
|
235 |
-
$out = "<div class=\"message_box warning\"><p>".do_shortcode($content)."</p></div>";
|
236 |
-
|
237 |
-
do_action('wps_enqueue_style');
|
238 |
-
return $out;
|
239 |
-
}
|
240 |
-
|
241 |
-
/*-----------------------------------------------------------------------------------*/
|
242 |
-
/* Column Shortcodes
|
243 |
-
/*-----------------------------------------------------------------------------------*/
|
244 |
-
|
245 |
-
function mts_one_third( $atts, $content = null ) {
|
246 |
-
do_action('wps_enqueue_style');
|
247 |
-
return '<div class="one_third">' . do_shortcode($content) . '</div>';
|
248 |
-
}
|
249 |
-
|
250 |
-
function mts_one_third_last( $atts, $content = null ) {
|
251 |
-
do_action('wps_enqueue_style');
|
252 |
-
return '<div class="one_third column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
253 |
-
}
|
254 |
-
|
255 |
-
function mts_two_third( $atts, $content = null ) {
|
256 |
-
do_action('wps_enqueue_style');
|
257 |
-
return '<div class="two_third">' . do_shortcode($content) . '</div>';
|
258 |
-
}
|
259 |
-
|
260 |
-
function mts_two_third_last( $atts, $content = null ) {
|
261 |
-
do_action('wps_enqueue_style');
|
262 |
-
return '<div class="two_third column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
263 |
-
}
|
264 |
-
|
265 |
-
function mts_one_half( $atts, $content = null ) {
|
266 |
-
do_action('wps_enqueue_style');
|
267 |
-
return '<div class="one_half">' . do_shortcode($content) . '</div>';
|
268 |
-
}
|
269 |
-
|
270 |
-
function mts_one_half_last( $atts, $content = null ) {
|
271 |
-
do_action('wps_enqueue_style');
|
272 |
-
return '<div class="one_half column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
273 |
-
}
|
274 |
-
|
275 |
-
function mts_one_fourth( $atts, $content = null ) {
|
276 |
-
do_action('wps_enqueue_style');
|
277 |
-
return '<div class="one_fourth">' . do_shortcode($content) . '</div>';
|
278 |
-
}
|
279 |
-
|
280 |
-
function mts_one_fourth_last( $atts, $content = null ) {
|
281 |
-
do_action('wps_enqueue_style');
|
282 |
-
return '<div class="one_fourth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
283 |
-
}
|
284 |
-
|
285 |
-
function mts_three_fourth( $atts, $content = null ) {
|
286 |
-
do_action('wps_enqueue_style');
|
287 |
-
return '<div class="three_fourth">' . do_shortcode($content) . '</div>';
|
288 |
-
}
|
289 |
-
|
290 |
-
function mts_three_fourth_last( $atts, $content = null ) {
|
291 |
-
do_action('wps_enqueue_style');
|
292 |
-
return '<div class="three_fourth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
293 |
-
}
|
294 |
-
|
295 |
-
function mts_one_fifth( $atts, $content = null ) {
|
296 |
-
do_action('wps_enqueue_style');
|
297 |
-
return '<div class="one_fifth">' . do_shortcode($content) . '</div>';
|
298 |
-
}
|
299 |
-
|
300 |
-
function mts_one_fifth_last( $atts, $content = null ) {
|
301 |
-
do_action('wps_enqueue_style');
|
302 |
-
return '<div class="one_fifth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
303 |
-
}
|
304 |
-
|
305 |
-
function mts_two_fifth( $atts, $content = null ) {
|
306 |
-
do_action('wps_enqueue_style');
|
307 |
-
return '<div class="two_fifth">' . do_shortcode($content) . '</div>';
|
308 |
-
}
|
309 |
-
|
310 |
-
function mts_two_fifth_last( $atts, $content = null ) {
|
311 |
-
do_action('wps_enqueue_style');
|
312 |
-
return '<div class="two_fifth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
313 |
-
}
|
314 |
-
|
315 |
-
function mts_three_fifth( $atts, $content = null ) {
|
316 |
-
do_action('wps_enqueue_style');
|
317 |
-
return '<div class="three_fifth">' . do_shortcode($content) . '</div>';
|
318 |
-
}
|
319 |
-
|
320 |
-
function mts_three_fifth_last( $atts, $content = null ) {
|
321 |
-
do_action('wps_enqueue_style');
|
322 |
-
return '<div class="three_fifth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
323 |
-
}
|
324 |
-
|
325 |
-
function mts_four_fifth( $atts, $content = null ) {
|
326 |
-
do_action('wps_enqueue_style');
|
327 |
-
return '<div class="four_fifth">' . do_shortcode($content) . '</div>';
|
328 |
-
}
|
329 |
-
|
330 |
-
function mts_four_fifth_last( $atts, $content = null ) {
|
331 |
-
do_action('wps_enqueue_style');
|
332 |
-
return '<div class="four_fifth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
333 |
-
}
|
334 |
-
|
335 |
-
function mts_one_sixth( $atts, $content = null ) {
|
336 |
-
do_action('wps_enqueue_style');
|
337 |
-
return '<div class="one_sixth">' . do_shortcode($content) . '</div>';
|
338 |
-
}
|
339 |
-
|
340 |
-
function mts_one_sixth_last( $atts, $content = null ) {
|
341 |
-
do_action('wps_enqueue_style');
|
342 |
-
return '<div class="one_sixth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
343 |
-
}
|
344 |
-
|
345 |
-
function mts_five_sixth( $atts, $content = null ) {
|
346 |
-
do_action('wps_enqueue_style');
|
347 |
-
return '<div class="five_sixth">' . do_shortcode($content) . '</div>';
|
348 |
-
}
|
349 |
-
|
350 |
-
function mts_five_sixth_last( $atts, $content = null ) {
|
351 |
-
do_action('wps_enqueue_style');
|
352 |
-
return '<div class="five_sixth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
353 |
-
}
|
354 |
-
|
355 |
-
/*-----------------------------------------------------------------------------------*/
|
356 |
-
/* Video Shortcodes
|
357 |
-
/*-----------------------------------------------------------------------------------*/
|
358 |
-
function mts_youtube_video( $atts, $content = null ) {
|
359 |
-
extract(shortcode_atts( array(
|
360 |
-
'id' => '',
|
361 |
-
'width' => '600',
|
362 |
-
'height' => '340',
|
363 |
-
'position' => 'left'
|
364 |
-
), $atts));
|
365 |
-
$out = "<div class=\"youtube-video " .sanitize_html_class( $position ) . "\"><iframe width=\"" .esc_attr( $width ) . "\" height=\"" .esc_attr( $height ) ."\" src=\"//www.youtube.com/embed/" . esc_attr( $id ) . "?rel=0\" frameborder=\"0\" allowfullscreen></iframe></div>";
|
366 |
-
do_action('wps_enqueue_style');
|
367 |
-
return $out;
|
368 |
-
}
|
369 |
-
|
370 |
-
function mts_vimeo_video( $atts, $content = null ) {
|
371 |
-
extract(shortcode_atts( array(
|
372 |
-
'id' => '',
|
373 |
-
'width' => '600',
|
374 |
-
'height' => '340',
|
375 |
-
'position' => 'left'
|
376 |
-
), $atts));
|
377 |
-
$out = "<div class=\"vimeo-video " . sanitize_html_class( $position ) . "\"><iframe width=\"" .esc_attr( $width ) . "\" height=\"" .esc_attr( $height ) ."\" src=\"//player.vimeo.com/video/" . esc_attr( $id ) . "?title=0&byline=0&portrait=0\" frameborder=\"0\" allowfullscreen></iframe></div>";
|
378 |
-
do_action('wps_enqueue_style');
|
379 |
-
return $out;
|
380 |
-
}
|
381 |
-
|
382 |
-
/*-----------------------------------------------------------------------------------*/
|
383 |
-
/* GoogleMaps Shortcode
|
384 |
-
/*-----------------------------------------------------------------------------------*/
|
385 |
-
function mts_googleMaps($atts, $content = null) {
|
386 |
-
extract(shortcode_atts(array(
|
387 |
-
'width' => '640',
|
388 |
-
'height' => '480',
|
389 |
-
'address' => '',
|
390 |
-
'src' => '', // for backwards compatibility
|
391 |
-
'position' => 'left'
|
392 |
-
), $atts));
|
393 |
-
if (!empty($src)) {
|
394 |
-
$out = "<div class=\"googlemaps " .sanitize_html_class( $position ) . "\"><iframe width=\"".esc_attr( $width )."\" height=\"".esc_attr( $height )."\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"".esc_url( $src )."&output=embed\"></iframe></div>";
|
395 |
-
} else {
|
396 |
-
$out = "<div class=\"googlemaps " .sanitize_html_class( $position ) . "\"><iframe width=\"".esc_attr( $width )."\" height=\"".esc_attr( $height )."\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"//maps.google.com/maps?q=".urlencode( $address )."&output=embed\"></iframe></div>";
|
397 |
-
}
|
398 |
-
do_action('wps_enqueue_style');
|
399 |
-
return $out;
|
400 |
-
}
|
401 |
-
|
402 |
-
/*-----------------------------------------------------------------------------------*/
|
403 |
-
/* Tabs
|
404 |
-
/*-----------------------------------------------------------------------------------*/
|
405 |
-
function mts_tabs( $atts, $content = null ) {
|
406 |
-
|
407 |
-
if (!preg_match_all("/(.?)\[(tab)\b(.*?)(?:(\/))?\](?:(.+?)\[\/tab\])?(.?)/s", $content, $matches)) {
|
408 |
-
return do_shortcode($content);
|
409 |
-
} else {
|
410 |
-
for($i = 0; $i < count($matches[0]); $i++) {
|
411 |
-
$matches[3][$i] = shortcode_atts(
|
412 |
-
array('title' => __('Untitled', 'wp-shortcode')),
|
413 |
-
shortcode_parse_atts($matches[3][$i])
|
414 |
-
);
|
415 |
-
$tabid[$i] = 'tab-'.$i.'-'.str_replace('%','',strtolower(sanitize_title($matches[3][$i]['title'])));
|
416 |
-
}
|
417 |
-
$tabnav = '<ul class="wps_tabs">';
|
418 |
-
|
419 |
-
for($i = 0; $i < count($matches[0]); $i++) {
|
420 |
-
$tabnav .= '<li><a href="#" data-tab="'.$tabid[$i].'">' . $matches[3][$i]['title'] . '</a></li>';
|
421 |
-
}
|
422 |
-
$tabnav .= '</ul>';
|
423 |
-
|
424 |
-
$tabcontent = '<div class="tab_container">';
|
425 |
-
for($i = 0; $i < count($matches[0]); $i++) {
|
426 |
-
$tabcontent .= '<div id="'.$tabid[$i].'" class="tab_content clearfix">' . do_shortcode(trim($matches[5][$i])) . '</div>';
|
427 |
-
}
|
428 |
-
$tabcontent .= '</div>';
|
429 |
-
|
430 |
-
do_action('wps_enqueue_style', 'tabs');
|
431 |
-
return '<div class="tab_widget wp_shortcodes_tabs">' . $tabnav . $tabcontent . '</div><div class="clear"></div>';
|
432 |
-
}
|
433 |
-
|
434 |
-
}
|
435 |
-
add_filter( 'no_texturize_shortcodes', 'no_texturize_tabs' );
|
436 |
-
function no_texturize_tabs($shortcodes){
|
437 |
-
$shortcodes[] = 'tabs';
|
438 |
-
return $shortcodes;
|
439 |
-
}
|
440 |
-
|
441 |
-
/*--------------------------------------------------------
|
442 |
-
Toggles
|
443 |
-
--------------------------------------------------------*/
|
444 |
-
|
445 |
-
function mts_toggle( $atts, $content = null ) {
|
446 |
-
extract(shortcode_atts(array(
|
447 |
-
'title' => __('Toggle Title', 'wp-shortcode')
|
448 |
-
), $atts));
|
449 |
-
do_action('wps_enqueue_style', 'toggle');
|
450 |
-
return '<div class="toggle clearfix wp_shortcodes_toggle"><div class="wps_togglet"><span>' . wp_kses_post( $title ) . '</span></div><div class="togglec clearfix">' . do_shortcode(trim($content)) . '</div></div><div class="clear"></div>';
|
451 |
-
}
|
452 |
-
|
453 |
-
/*-----------------------------------------------------------------------------------*/
|
454 |
-
/* Divider
|
455 |
-
/*-----------------------------------------------------------------------------------*/
|
456 |
-
// simple divider
|
457 |
-
function mts_divider( $atts ) {
|
458 |
-
do_action('wps_enqueue_style');
|
459 |
-
return '<div class="divider"></div>';
|
460 |
-
}
|
461 |
-
|
462 |
-
// Divider with an anchor link to top of page.
|
463 |
-
function mts_divider_top( $atts ) {
|
464 |
-
do_action('wps_enqueue_style');
|
465 |
-
return '<div class="top-of-page"><a href="#top">'.__('Back to Top', 'wp-shortcode').'</a></div>';
|
466 |
-
}
|
467 |
-
|
468 |
-
// Used to clear an element of its neighbors, no floating elements are allowed on the left or the right side.
|
469 |
-
function mts_clear( $atts ) {
|
470 |
-
do_action('wps_enqueue_style');
|
471 |
-
return '<div class="clear"></div>';
|
472 |
-
}
|
473 |
-
|
474 |
-
|
475 |
-
/*-----------------------------------------------------------------------------------*/
|
476 |
-
/* Tooltip
|
477 |
-
/*-----------------------------------------------------------------------------------*/
|
478 |
-
|
479 |
-
function mts_tooltip( $atts, $content ) {
|
480 |
-
$atts = shortcode_atts(array(
|
481 |
-
'content' => '',
|
482 |
-
'gravity' => 'n',
|
483 |
-
'fade' => '0'
|
484 |
-
), $atts);
|
485 |
-
do_action('wps_enqueue_style', 'tooltip');
|
486 |
-
return '<span class="wp_shortcodes_tooltip" title="'.esc_attr( $atts['content'] ).'" data-gravity="'.esc_attr( $atts['gravity'] ).'" data-fade="'.esc_attr( $atts['fade'] ).'">'.$content.'</span>';
|
487 |
-
}
|
488 |
-
|
489 |
-
register_activation_hook( __FILE__, 'wp_shortcode_activation' );
|
490 |
-
|
491 |
-
if(!function_exists('wp_shortcode_activation')) {
|
492 |
-
function wp_shortcode_activation(){
|
493 |
-
/* Loads activation functions */
|
494 |
-
update_option('wp_shortcode_activated', time());
|
495 |
-
}
|
496 |
-
}
|
497 |
-
|
498 |
-
|
499 |
-
/* Display a notice */
|
500 |
-
add_action('admin_notices', 'wp_shortcode_admin_notice');
|
501 |
-
function wp_shortcode_admin_notice() {
|
502 |
-
global $current_user ;
|
503 |
-
$user_id = $current_user->ID;
|
504 |
-
/* Check that the user hasn't already clicked to ignore the message */
|
505 |
-
/* Only show the notice 2 days after plugin activation */
|
506 |
-
if ( ! get_user_meta($user_id, 'wp_shortcode_ignore_notice') && time() >= (get_option( 'wp_shortcode_activated', 0 ) + (2 * 24 * 60 * 60)) ) {
|
507 |
-
echo '<div class="updated notice-info wp-shortcode-notice" id="wpshortcode-notice" style="position:relative;">';
|
508 |
-
printf(__('<p>Like WP Shortcode plugin? You will LOVE <a target="_blank" href="https://mythemeshop.com/plugins/wp-shortcode-pro/?utm_source=WP+Shortcode&utm_medium=Notification+Link&utm_content=WP+Shortcode+Pro+LP&utm_campaign=WordPressOrg"><strong>WP Shortcode Pro!</strong></a></p><a class="notice-dismiss mts-notice-dismiss" data-ignore="0" href="%1$s"></a>', 'wp-shortcode'), '?wp_shortcode_admin_notice_ignore=0');
|
509 |
-
echo "</div>";
|
510 |
-
}
|
511 |
-
/* Other notice appears right after activating */
|
512 |
-
/* And it gets hidden after showing 3 times */
|
513 |
-
if ( ! get_user_meta($user_id, 'wp_shortcode_ignore_notice_2') && get_option('wp_shortcode_notice_views', 0) < 3 && get_option( 'wp_shortcode_activated', 0 ) ) {
|
514 |
-
$views = get_option('wp_shortcode_notice_views', 0);
|
515 |
-
update_option( 'wp_shortcode_notice_views', ($views + 1) );
|
516 |
-
echo '<div class="updated notice-info wp-shortcode-notice" id="wpshortcode-notice2" style="position:relative;">';
|
517 |
-
echo '<p>';
|
518 |
-
_e('Thank you for trying WP Shortcode. We hope you will like it.', 'wp-shortcode');
|
519 |
-
echo '</p><a class="notice-dismiss mts-notice-dismiss" data-ignore="1" href="?wp_shortcode_admin_notice_ignore=0"></a>';
|
520 |
-
echo "</div>";
|
521 |
-
}
|
522 |
-
}
|
523 |
-
|
524 |
-
add_action('wp_ajax_mts_dismiss_plugin_notice', function(){
|
525 |
-
global $current_user;
|
526 |
-
$user_id = $current_user->ID;
|
527 |
-
/* If user clicks to ignore the notice, add that to their user meta */
|
528 |
-
if ( isset($_POST['dismiss']) ) {
|
529 |
-
if ( '0' == $_POST['dismiss'] ) {
|
530 |
-
add_user_meta($user_id, 'wp_shortcode_ignore_notice', '1', true);
|
531 |
-
} elseif ( '1' == $_POST['dismiss'] ) {
|
532 |
-
add_user_meta($user_id, 'wp_shortcode_ignore_notice_2', '1', true);
|
533 |
-
}
|
534 |
-
}
|
535 |
});
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP Shortcode by MyThemeShop
|
4 |
+
Plugin URI: http://mythemeshop.com/
|
5 |
+
Description: With the vast array of shortcodes, you can quickly and easily build content for your posts and pages and turbocharge your blogging experience.
|
6 |
+
Author: MyThemeShop
|
7 |
+
Version: 1.4.15
|
8 |
+
Author URI: http://mythemeshop.com/
|
9 |
+
*/
|
10 |
+
|
11 |
+
function mts_wpshortcodes_scripts() {
|
12 |
+
wp_register_style('tipsy', plugins_url('css/tipsy.css', __FILE__));
|
13 |
+
wp_register_style('mts_wpshortcodes', plugins_url('css/wp-shortcode.css', __FILE__));
|
14 |
+
wp_register_script('tipsy', plugins_url('js/jquery.tipsy.js', __FILE__), array('jquery'));
|
15 |
+
wp_register_script('mts_wpshortcodes', plugins_url('js/wp-shortcode.js', __FILE__), array('jquery'));
|
16 |
+
}
|
17 |
+
add_action('wp_enqueue_scripts', 'mts_wpshortcodes_scripts', 99);
|
18 |
+
|
19 |
+
add_action('admin_enqueue_scripts', function(){
|
20 |
+
wp_enqueue_script( 'mts_wpshortcodes_admin', plugins_url('js/admin.js', __FILE__), array('jquery') );
|
21 |
+
});
|
22 |
+
|
23 |
+
function mts_wps_enqueue_scripts($shortcode = '') {
|
24 |
+
|
25 |
+
if($shortcode == 'tooltip') {
|
26 |
+
wp_enqueue_style( 'tipsy' );
|
27 |
+
wp_enqueue_script( 'tipsy' );
|
28 |
+
}
|
29 |
+
wp_enqueue_style('mts_wpshortcodes');
|
30 |
+
if($shortcode == 'tooltip' || $shortcode == 'tabs' || $shortcode == 'toggle') {
|
31 |
+
wp_enqueue_script('mts_wpshortcodes');
|
32 |
+
}
|
33 |
+
}
|
34 |
+
add_action('wps_enqueue_style', 'mts_wps_enqueue_scripts', 10, 1);
|
35 |
+
|
36 |
+
function mts_wpshortcodes_load_textdomain() {
|
37 |
+
load_plugin_textdomain( 'wp-shortcode', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
38 |
+
}
|
39 |
+
add_action( 'plugins_loaded', 'mts_wpshortcodes_load_textdomain' );
|
40 |
+
|
41 |
+
// hide built-in shortcodes button for MTS themes
|
42 |
+
add_action('admin_head', 'mts_wpshortcodes_theme_compatibility');
|
43 |
+
|
44 |
+
function mts_wpshortcodes_theme_compatibility() {
|
45 |
+
echo '<style type="text/css">#content_mnmpanel {display: none;}</style>';
|
46 |
+
}
|
47 |
+
|
48 |
+
include('tinymce/tinymce.php');
|
49 |
+
|
50 |
+
// override theme shortcodes
|
51 |
+
add_action( 'after_setup_theme', 'mts_wpshortcodes_add' );
|
52 |
+
|
53 |
+
function mts_wpshortcodes_add() {
|
54 |
+
remove_shortcode('button-brown'); add_shortcode('button-brown', 'mts_button_brown');
|
55 |
+
remove_shortcode('button-blue'); add_shortcode('button-blue', 'mts_button_blue');
|
56 |
+
remove_shortcode('button-green'); add_shortcode('button-green', 'mts_button_green');
|
57 |
+
remove_shortcode('button-red'); add_shortcode('button-red', 'mts_button_red');
|
58 |
+
remove_shortcode('button-white'); add_shortcode('button-white', 'mts_button_white');
|
59 |
+
remove_shortcode('button-yellow'); add_shortcode('button-yellow', 'mts_button_yellow');
|
60 |
+
remove_shortcode('alert-note'); add_shortcode('alert-note', 'mts_alert_note');
|
61 |
+
remove_shortcode('alert-announce'); add_shortcode('alert-announce', 'mts_alert_announce');
|
62 |
+
remove_shortcode('alert-success'); add_shortcode('alert-success', 'mts_alert_success');
|
63 |
+
remove_shortcode('alert-warning'); add_shortcode('alert-warning', 'mts_alert_warning');
|
64 |
+
remove_shortcode('one_third'); add_shortcode('one_third', 'mts_one_third');
|
65 |
+
remove_shortcode('one_third_last'); add_shortcode('one_third_last', 'mts_one_third_last');
|
66 |
+
remove_shortcode('two_third'); add_shortcode('two_third', 'mts_two_third');
|
67 |
+
remove_shortcode('two_third_last'); add_shortcode('two_third_last', 'mts_two_third_last');
|
68 |
+
remove_shortcode('one_half'); add_shortcode('one_half', 'mts_one_half');
|
69 |
+
remove_shortcode('one_half_last'); add_shortcode('one_half_last', 'mts_one_half_last');
|
70 |
+
remove_shortcode('one_fourth'); add_shortcode('one_fourth', 'mts_one_fourth');
|
71 |
+
remove_shortcode('one_fourth_last'); add_shortcode('one_fourth_last', 'mts_one_fourth_last');
|
72 |
+
remove_shortcode('three_fourth'); add_shortcode('three_fourth', 'mts_three_fourth');
|
73 |
+
remove_shortcode('three_fourth_last'); add_shortcode('three_fourth_last', 'mts_three_fourth_last');
|
74 |
+
remove_shortcode('one_fifth'); add_shortcode('one_fifth', 'mts_one_fifth');
|
75 |
+
remove_shortcode('one_fifth_last'); add_shortcode('one_fifth_last', 'mts_one_fifth_last');
|
76 |
+
remove_shortcode('two_fifth'); add_shortcode('two_fifth', 'mts_two_fifth');
|
77 |
+
remove_shortcode('two_fifth_last'); add_shortcode('two_fifth_last', 'mts_two_fifth_last');
|
78 |
+
remove_shortcode('three_fifth'); add_shortcode('three_fifth', 'mts_three_fifth');
|
79 |
+
remove_shortcode('three_fifth_last'); add_shortcode('three_fifth_last', 'mts_three_fifth_last');
|
80 |
+
remove_shortcode('four_fifth'); add_shortcode('four_fifth', 'mts_four_fifth');
|
81 |
+
remove_shortcode('four_fifth_last'); add_shortcode('four_fifth_last', 'mts_four_fifth_last');
|
82 |
+
remove_shortcode('one_sixth'); add_shortcode('one_sixth', 'mts_one_sixth');
|
83 |
+
remove_shortcode('one_sixth_last'); add_shortcode('one_sixth_last', 'mts_one_sixth_last');
|
84 |
+
remove_shortcode('five_sixth'); add_shortcode('five_sixth', 'mts_five_sixth');
|
85 |
+
remove_shortcode('five_sixth_last'); add_shortcode('five_sixth_last', 'mts_five_sixth_last');
|
86 |
+
remove_shortcode('youtube'); add_shortcode('youtube', 'mts_youtube_video');
|
87 |
+
remove_shortcode('vimeo'); add_shortcode('vimeo', 'mts_vimeo_video');
|
88 |
+
remove_shortcode('googlemap'); add_shortcode('googlemap', 'mts_googleMaps');
|
89 |
+
remove_shortcode('tabs'); add_shortcode('tabs', 'mts_tabs');
|
90 |
+
remove_shortcode('toggle'); add_shortcode('toggle', 'mts_toggle');
|
91 |
+
remove_shortcode('divider'); add_shortcode('divider', 'mts_divider');
|
92 |
+
remove_shortcode('divider_top'); add_shortcode('divider_top', 'mts_divider_top');
|
93 |
+
remove_shortcode('clear'); add_shortcode('clear', 'mts_clear');
|
94 |
+
add_shortcode('tooltip', 'mts_tooltip');
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
/*-----------------------------------------------------------------------------------*/
|
99 |
+
/* Buttons Shortcodes
|
100 |
+
/*-----------------------------------------------------------------------------------*/
|
101 |
+
|
102 |
+
function mts_button_brown( $atts, $content = null ) {
|
103 |
+
extract(shortcode_atts(array(
|
104 |
+
'url' => '#',
|
105 |
+
'target' => '_self',
|
106 |
+
'position' => 'left',
|
107 |
+
'rel' => '',
|
108 |
+
), $atts));
|
109 |
+
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_brown " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
110 |
+
if ($position == 'center') {
|
111 |
+
$out = '<div class="button-center">'.$out.'</div>';
|
112 |
+
}
|
113 |
+
do_action('wps_enqueue_style');
|
114 |
+
return $out;
|
115 |
+
}
|
116 |
+
|
117 |
+
function mts_button_blue( $atts, $content = null ) {
|
118 |
+
extract(shortcode_atts(array(
|
119 |
+
'url' => '#',
|
120 |
+
'target' => '_self',
|
121 |
+
'position' => 'left',
|
122 |
+
'rel' => '',
|
123 |
+
), $atts));
|
124 |
+
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_blue " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
125 |
+
if ($position == 'center') {
|
126 |
+
$out = '<div class="button-center">'.$out.'</div>';
|
127 |
+
}
|
128 |
+
|
129 |
+
do_action('wps_enqueue_style');
|
130 |
+
return $out;
|
131 |
+
}
|
132 |
+
|
133 |
+
function mts_button_green( $atts, $content = null ) {
|
134 |
+
extract(shortcode_atts(array(
|
135 |
+
'url' => '#',
|
136 |
+
'target' => '_self',
|
137 |
+
'position' => 'left',
|
138 |
+
'rel' => '',
|
139 |
+
), $atts));
|
140 |
+
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_green " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
141 |
+
if ($position == 'center') {
|
142 |
+
$out = '<div class="button-center">'.$out.'</div>';
|
143 |
+
}
|
144 |
+
|
145 |
+
do_action('wps_enqueue_style');
|
146 |
+
return $out;
|
147 |
+
}
|
148 |
+
|
149 |
+
function mts_button_red( $atts, $content = null ) {
|
150 |
+
extract(shortcode_atts(array(
|
151 |
+
'url' => '#',
|
152 |
+
'target' => '_self',
|
153 |
+
'position' => 'left',
|
154 |
+
'rel' => '',
|
155 |
+
), $atts));
|
156 |
+
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_red " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
157 |
+
if ($position == 'center') {
|
158 |
+
$out = '<div class="button-center">'.$out.'</div>';
|
159 |
+
}
|
160 |
+
|
161 |
+
do_action('wps_enqueue_style');
|
162 |
+
return $out;
|
163 |
+
}
|
164 |
+
|
165 |
+
function mts_button_white( $atts, $content = null ) {
|
166 |
+
extract(shortcode_atts(array(
|
167 |
+
'url' => '#',
|
168 |
+
'target' => '_self',
|
169 |
+
'position' => 'left',
|
170 |
+
'rel' => '',
|
171 |
+
), $atts));
|
172 |
+
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_white " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
173 |
+
if ($position == 'center') {
|
174 |
+
$out = '<div class="button-center">'.$out.'</div>';
|
175 |
+
}
|
176 |
+
|
177 |
+
do_action('wps_enqueue_style');
|
178 |
+
return $out;
|
179 |
+
}
|
180 |
+
|
181 |
+
function mts_button_yellow( $atts, $content = null ) {
|
182 |
+
extract(shortcode_atts(array(
|
183 |
+
'url' => '#',
|
184 |
+
'target' => '_self',
|
185 |
+
'position' => 'left',
|
186 |
+
'rel' => '',
|
187 |
+
), $atts));
|
188 |
+
$out = "<a href=\"" . esc_url( $url ) . "\" target=\"" . esc_attr( $target ) . "\" class=\"buttons btn_yellow " .sanitize_html_class( $position ). "\"" .($rel? " rel=\"" . esc_attr( $rel ) . "\"" : "")."><span class=\"left\">".do_shortcode($content)."</span></a>";
|
189 |
+
if ($position == 'center') {
|
190 |
+
$out = '<div class="button-center">'.$out.'</div>';
|
191 |
+
}
|
192 |
+
|
193 |
+
do_action('wps_enqueue_style');
|
194 |
+
return $out;
|
195 |
+
}
|
196 |
+
|
197 |
+
/*-----------------------------------------------------------------------------------*/
|
198 |
+
/* Alert Shortcodes
|
199 |
+
/*-----------------------------------------------------------------------------------*/
|
200 |
+
|
201 |
+
function mts_alert_note( $atts, $content = null ) {
|
202 |
+
extract(shortcode_atts(array(
|
203 |
+
'style' => 'note'
|
204 |
+
), $atts));
|
205 |
+
$out = "<div class=\"message_box note\"><p>".do_shortcode($content)."</p></div>";
|
206 |
+
|
207 |
+
do_action('wps_enqueue_style');
|
208 |
+
return $out;
|
209 |
+
}
|
210 |
+
|
211 |
+
function mts_alert_announce( $atts, $content = null ) {
|
212 |
+
extract(shortcode_atts(array(
|
213 |
+
'style' => 'announce'
|
214 |
+
), $atts));
|
215 |
+
$out = "<div class=\"message_box announce\"><p>".do_shortcode($content)."</p></div>";
|
216 |
+
|
217 |
+
do_action('wps_enqueue_style');
|
218 |
+
return $out;
|
219 |
+
}
|
220 |
+
|
221 |
+
function mts_alert_success( $atts, $content = null ) {
|
222 |
+
extract(shortcode_atts(array(
|
223 |
+
'style' => 'success'
|
224 |
+
), $atts));
|
225 |
+
$out = "<div class=\"message_box success\"><p>".do_shortcode($content)."</p></div>";
|
226 |
+
|
227 |
+
do_action('wps_enqueue_style');
|
228 |
+
return $out;
|
229 |
+
}
|
230 |
+
|
231 |
+
function mts_alert_warning( $atts, $content = null ) {
|
232 |
+
extract(shortcode_atts(array(
|
233 |
+
'style' => 'warning'
|
234 |
+
), $atts));
|
235 |
+
$out = "<div class=\"message_box warning\"><p>".do_shortcode($content)."</p></div>";
|
236 |
+
|
237 |
+
do_action('wps_enqueue_style');
|
238 |
+
return $out;
|
239 |
+
}
|
240 |
+
|
241 |
+
/*-----------------------------------------------------------------------------------*/
|
242 |
+
/* Column Shortcodes
|
243 |
+
/*-----------------------------------------------------------------------------------*/
|
244 |
+
|
245 |
+
function mts_one_third( $atts, $content = null ) {
|
246 |
+
do_action('wps_enqueue_style');
|
247 |
+
return '<div class="one_third">' . do_shortcode($content) . '</div>';
|
248 |
+
}
|
249 |
+
|
250 |
+
function mts_one_third_last( $atts, $content = null ) {
|
251 |
+
do_action('wps_enqueue_style');
|
252 |
+
return '<div class="one_third column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
253 |
+
}
|
254 |
+
|
255 |
+
function mts_two_third( $atts, $content = null ) {
|
256 |
+
do_action('wps_enqueue_style');
|
257 |
+
return '<div class="two_third">' . do_shortcode($content) . '</div>';
|
258 |
+
}
|
259 |
+
|
260 |
+
function mts_two_third_last( $atts, $content = null ) {
|
261 |
+
do_action('wps_enqueue_style');
|
262 |
+
return '<div class="two_third column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
263 |
+
}
|
264 |
+
|
265 |
+
function mts_one_half( $atts, $content = null ) {
|
266 |
+
do_action('wps_enqueue_style');
|
267 |
+
return '<div class="one_half">' . do_shortcode($content) . '</div>';
|
268 |
+
}
|
269 |
+
|
270 |
+
function mts_one_half_last( $atts, $content = null ) {
|
271 |
+
do_action('wps_enqueue_style');
|
272 |
+
return '<div class="one_half column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
273 |
+
}
|
274 |
+
|
275 |
+
function mts_one_fourth( $atts, $content = null ) {
|
276 |
+
do_action('wps_enqueue_style');
|
277 |
+
return '<div class="one_fourth">' . do_shortcode($content) . '</div>';
|
278 |
+
}
|
279 |
+
|
280 |
+
function mts_one_fourth_last( $atts, $content = null ) {
|
281 |
+
do_action('wps_enqueue_style');
|
282 |
+
return '<div class="one_fourth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
283 |
+
}
|
284 |
+
|
285 |
+
function mts_three_fourth( $atts, $content = null ) {
|
286 |
+
do_action('wps_enqueue_style');
|
287 |
+
return '<div class="three_fourth">' . do_shortcode($content) . '</div>';
|
288 |
+
}
|
289 |
+
|
290 |
+
function mts_three_fourth_last( $atts, $content = null ) {
|
291 |
+
do_action('wps_enqueue_style');
|
292 |
+
return '<div class="three_fourth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
293 |
+
}
|
294 |
+
|
295 |
+
function mts_one_fifth( $atts, $content = null ) {
|
296 |
+
do_action('wps_enqueue_style');
|
297 |
+
return '<div class="one_fifth">' . do_shortcode($content) . '</div>';
|
298 |
+
}
|
299 |
+
|
300 |
+
function mts_one_fifth_last( $atts, $content = null ) {
|
301 |
+
do_action('wps_enqueue_style');
|
302 |
+
return '<div class="one_fifth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
303 |
+
}
|
304 |
+
|
305 |
+
function mts_two_fifth( $atts, $content = null ) {
|
306 |
+
do_action('wps_enqueue_style');
|
307 |
+
return '<div class="two_fifth">' . do_shortcode($content) . '</div>';
|
308 |
+
}
|
309 |
+
|
310 |
+
function mts_two_fifth_last( $atts, $content = null ) {
|
311 |
+
do_action('wps_enqueue_style');
|
312 |
+
return '<div class="two_fifth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
313 |
+
}
|
314 |
+
|
315 |
+
function mts_three_fifth( $atts, $content = null ) {
|
316 |
+
do_action('wps_enqueue_style');
|
317 |
+
return '<div class="three_fifth">' . do_shortcode($content) . '</div>';
|
318 |
+
}
|
319 |
+
|
320 |
+
function mts_three_fifth_last( $atts, $content = null ) {
|
321 |
+
do_action('wps_enqueue_style');
|
322 |
+
return '<div class="three_fifth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
323 |
+
}
|
324 |
+
|
325 |
+
function mts_four_fifth( $atts, $content = null ) {
|
326 |
+
do_action('wps_enqueue_style');
|
327 |
+
return '<div class="four_fifth">' . do_shortcode($content) . '</div>';
|
328 |
+
}
|
329 |
+
|
330 |
+
function mts_four_fifth_last( $atts, $content = null ) {
|
331 |
+
do_action('wps_enqueue_style');
|
332 |
+
return '<div class="four_fifth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
333 |
+
}
|
334 |
+
|
335 |
+
function mts_one_sixth( $atts, $content = null ) {
|
336 |
+
do_action('wps_enqueue_style');
|
337 |
+
return '<div class="one_sixth">' . do_shortcode($content) . '</div>';
|
338 |
+
}
|
339 |
+
|
340 |
+
function mts_one_sixth_last( $atts, $content = null ) {
|
341 |
+
do_action('wps_enqueue_style');
|
342 |
+
return '<div class="one_sixth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
343 |
+
}
|
344 |
+
|
345 |
+
function mts_five_sixth( $atts, $content = null ) {
|
346 |
+
do_action('wps_enqueue_style');
|
347 |
+
return '<div class="five_sixth">' . do_shortcode($content) . '</div>';
|
348 |
+
}
|
349 |
+
|
350 |
+
function mts_five_sixth_last( $atts, $content = null ) {
|
351 |
+
do_action('wps_enqueue_style');
|
352 |
+
return '<div class="five_sixth column-last">' . do_shortcode($content) . '</div><div class="clear"></div>';
|
353 |
+
}
|
354 |
+
|
355 |
+
/*-----------------------------------------------------------------------------------*/
|
356 |
+
/* Video Shortcodes
|
357 |
+
/*-----------------------------------------------------------------------------------*/
|
358 |
+
function mts_youtube_video( $atts, $content = null ) {
|
359 |
+
extract(shortcode_atts( array(
|
360 |
+
'id' => '',
|
361 |
+
'width' => '600',
|
362 |
+
'height' => '340',
|
363 |
+
'position' => 'left'
|
364 |
+
), $atts));
|
365 |
+
$out = "<div class=\"youtube-video " .sanitize_html_class( $position ) . "\"><iframe width=\"" .esc_attr( $width ) . "\" height=\"" .esc_attr( $height ) ."\" src=\"//www.youtube.com/embed/" . esc_attr( $id ) . "?rel=0\" frameborder=\"0\" allowfullscreen></iframe></div>";
|
366 |
+
do_action('wps_enqueue_style');
|
367 |
+
return $out;
|
368 |
+
}
|
369 |
+
|
370 |
+
function mts_vimeo_video( $atts, $content = null ) {
|
371 |
+
extract(shortcode_atts( array(
|
372 |
+
'id' => '',
|
373 |
+
'width' => '600',
|
374 |
+
'height' => '340',
|
375 |
+
'position' => 'left'
|
376 |
+
), $atts));
|
377 |
+
$out = "<div class=\"vimeo-video " . sanitize_html_class( $position ) . "\"><iframe width=\"" .esc_attr( $width ) . "\" height=\"" .esc_attr( $height ) ."\" src=\"//player.vimeo.com/video/" . esc_attr( $id ) . "?title=0&byline=0&portrait=0\" frameborder=\"0\" allowfullscreen></iframe></div>";
|
378 |
+
do_action('wps_enqueue_style');
|
379 |
+
return $out;
|
380 |
+
}
|
381 |
+
|
382 |
+
/*-----------------------------------------------------------------------------------*/
|
383 |
+
/* GoogleMaps Shortcode
|
384 |
+
/*-----------------------------------------------------------------------------------*/
|
385 |
+
function mts_googleMaps($atts, $content = null) {
|
386 |
+
extract(shortcode_atts(array(
|
387 |
+
'width' => '640',
|
388 |
+
'height' => '480',
|
389 |
+
'address' => '',
|
390 |
+
'src' => '', // for backwards compatibility
|
391 |
+
'position' => 'left'
|
392 |
+
), $atts));
|
393 |
+
if (!empty($src)) {
|
394 |
+
$out = "<div class=\"googlemaps " .sanitize_html_class( $position ) . "\"><iframe width=\"".esc_attr( $width )."\" height=\"".esc_attr( $height )."\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"".esc_url( $src )."&output=embed\"></iframe></div>";
|
395 |
+
} else {
|
396 |
+
$out = "<div class=\"googlemaps " .sanitize_html_class( $position ) . "\"><iframe width=\"".esc_attr( $width )."\" height=\"".esc_attr( $height )."\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"//maps.google.com/maps?q=".urlencode( $address )."&output=embed\"></iframe></div>";
|
397 |
+
}
|
398 |
+
do_action('wps_enqueue_style');
|
399 |
+
return $out;
|
400 |
+
}
|
401 |
+
|
402 |
+
/*-----------------------------------------------------------------------------------*/
|
403 |
+
/* Tabs
|
404 |
+
/*-----------------------------------------------------------------------------------*/
|
405 |
+
function mts_tabs( $atts, $content = null ) {
|
406 |
+
|
407 |
+
if (!preg_match_all("/(.?)\[(tab)\b(.*?)(?:(\/))?\](?:(.+?)\[\/tab\])?(.?)/s", $content, $matches)) {
|
408 |
+
return do_shortcode($content);
|
409 |
+
} else {
|
410 |
+
for($i = 0; $i < count($matches[0]); $i++) {
|
411 |
+
$matches[3][$i] = shortcode_atts(
|
412 |
+
array('title' => __('Untitled', 'wp-shortcode')),
|
413 |
+
shortcode_parse_atts($matches[3][$i])
|
414 |
+
);
|
415 |
+
$tabid[$i] = 'tab-'.$i.'-'.str_replace('%','',strtolower(sanitize_title($matches[3][$i]['title'])));
|
416 |
+
}
|
417 |
+
$tabnav = '<ul class="wps_tabs">';
|
418 |
+
|
419 |
+
for($i = 0; $i < count($matches[0]); $i++) {
|
420 |
+
$tabnav .= '<li><a href="#" data-tab="'.$tabid[$i].'">' . $matches[3][$i]['title'] . '</a></li>';
|
421 |
+
}
|
422 |
+
$tabnav .= '</ul>';
|
423 |
+
|
424 |
+
$tabcontent = '<div class="tab_container">';
|
425 |
+
for($i = 0; $i < count($matches[0]); $i++) {
|
426 |
+
$tabcontent .= '<div id="'.$tabid[$i].'" class="tab_content clearfix">' . do_shortcode(trim($matches[5][$i])) . '</div>';
|
427 |
+
}
|
428 |
+
$tabcontent .= '</div>';
|
429 |
+
|
430 |
+
do_action('wps_enqueue_style', 'tabs');
|
431 |
+
return '<div class="tab_widget wp_shortcodes_tabs">' . $tabnav . $tabcontent . '</div><div class="clear"></div>';
|
432 |
+
}
|
433 |
+
|
434 |
+
}
|
435 |
+
add_filter( 'no_texturize_shortcodes', 'no_texturize_tabs' );
|
436 |
+
function no_texturize_tabs($shortcodes){
|
437 |
+
$shortcodes[] = 'tabs';
|
438 |
+
return $shortcodes;
|
439 |
+
}
|
440 |
+
|
441 |
+
/*--------------------------------------------------------
|
442 |
+
Toggles
|
443 |
+
--------------------------------------------------------*/
|
444 |
+
|
445 |
+
function mts_toggle( $atts, $content = null ) {
|
446 |
+
extract(shortcode_atts(array(
|
447 |
+
'title' => __('Toggle Title', 'wp-shortcode')
|
448 |
+
), $atts));
|
449 |
+
do_action('wps_enqueue_style', 'toggle');
|
450 |
+
return '<div class="toggle clearfix wp_shortcodes_toggle"><div class="wps_togglet"><span>' . wp_kses_post( $title ) . '</span></div><div class="togglec clearfix">' . do_shortcode(trim($content)) . '</div></div><div class="clear"></div>';
|
451 |
+
}
|
452 |
+
|
453 |
+
/*-----------------------------------------------------------------------------------*/
|
454 |
+
/* Divider
|
455 |
+
/*-----------------------------------------------------------------------------------*/
|
456 |
+
// simple divider
|
457 |
+
function mts_divider( $atts ) {
|
458 |
+
do_action('wps_enqueue_style');
|
459 |
+
return '<div class="divider"></div>';
|
460 |
+
}
|
461 |
+
|
462 |
+
// Divider with an anchor link to top of page.
|
463 |
+
function mts_divider_top( $atts ) {
|
464 |
+
do_action('wps_enqueue_style');
|
465 |
+
return '<div class="top-of-page"><a href="#top">'.__('Back to Top', 'wp-shortcode').'</a></div>';
|
466 |
+
}
|
467 |
+
|
468 |
+
// Used to clear an element of its neighbors, no floating elements are allowed on the left or the right side.
|
469 |
+
function mts_clear( $atts ) {
|
470 |
+
do_action('wps_enqueue_style');
|
471 |
+
return '<div class="clear"></div>';
|
472 |
+
}
|
473 |
+
|
474 |
+
|
475 |
+
/*-----------------------------------------------------------------------------------*/
|
476 |
+
/* Tooltip
|
477 |
+
/*-----------------------------------------------------------------------------------*/
|
478 |
+
|
479 |
+
function mts_tooltip( $atts, $content ) {
|
480 |
+
$atts = shortcode_atts(array(
|
481 |
+
'content' => '',
|
482 |
+
'gravity' => 'n',
|
483 |
+
'fade' => '0'
|
484 |
+
), $atts);
|
485 |
+
do_action('wps_enqueue_style', 'tooltip');
|
486 |
+
return '<span class="wp_shortcodes_tooltip" title="'.esc_attr( $atts['content'] ).'" data-gravity="'.esc_attr( $atts['gravity'] ).'" data-fade="'.esc_attr( $atts['fade'] ).'">'.$content.'</span>';
|
487 |
+
}
|
488 |
+
|
489 |
+
register_activation_hook( __FILE__, 'wp_shortcode_activation' );
|
490 |
+
|
491 |
+
if(!function_exists('wp_shortcode_activation')) {
|
492 |
+
function wp_shortcode_activation(){
|
493 |
+
/* Loads activation functions */
|
494 |
+
update_option('wp_shortcode_activated', time());
|
495 |
+
}
|
496 |
+
}
|
497 |
+
|
498 |
+
|
499 |
+
/* Display a notice */
|
500 |
+
add_action('admin_notices', 'wp_shortcode_admin_notice');
|
501 |
+
function wp_shortcode_admin_notice() {
|
502 |
+
global $current_user ;
|
503 |
+
$user_id = $current_user->ID;
|
504 |
+
/* Check that the user hasn't already clicked to ignore the message */
|
505 |
+
/* Only show the notice 2 days after plugin activation */
|
506 |
+
if ( ! get_user_meta($user_id, 'wp_shortcode_ignore_notice') && time() >= (get_option( 'wp_shortcode_activated', 0 ) + (2 * 24 * 60 * 60)) ) {
|
507 |
+
echo '<div class="updated notice-info wp-shortcode-notice" id="wpshortcode-notice" style="position:relative;">';
|
508 |
+
printf(__('<p>Like WP Shortcode plugin? You will LOVE <a target="_blank" href="https://mythemeshop.com/plugins/wp-shortcode-pro/?utm_source=WP+Shortcode&utm_medium=Notification+Link&utm_content=WP+Shortcode+Pro+LP&utm_campaign=WordPressOrg"><strong>WP Shortcode Pro!</strong></a></p><a class="notice-dismiss mts-notice-dismiss" data-ignore="0" href="%1$s"></a>', 'wp-shortcode'), '?wp_shortcode_admin_notice_ignore=0');
|
509 |
+
echo "</div>";
|
510 |
+
}
|
511 |
+
/* Other notice appears right after activating */
|
512 |
+
/* And it gets hidden after showing 3 times */
|
513 |
+
if ( ! get_user_meta($user_id, 'wp_shortcode_ignore_notice_2') && get_option('wp_shortcode_notice_views', 0) < 3 && get_option( 'wp_shortcode_activated', 0 ) ) {
|
514 |
+
$views = get_option('wp_shortcode_notice_views', 0);
|
515 |
+
update_option( 'wp_shortcode_notice_views', ($views + 1) );
|
516 |
+
echo '<div class="updated notice-info wp-shortcode-notice" id="wpshortcode-notice2" style="position:relative;">';
|
517 |
+
echo '<p>';
|
518 |
+
_e('Thank you for trying WP Shortcode. We hope you will like it.', 'wp-shortcode');
|
519 |
+
echo '</p><a class="notice-dismiss mts-notice-dismiss" data-ignore="1" href="?wp_shortcode_admin_notice_ignore=0"></a>';
|
520 |
+
echo "</div>";
|
521 |
+
}
|
522 |
+
}
|
523 |
+
|
524 |
+
add_action('wp_ajax_mts_dismiss_plugin_notice', function(){
|
525 |
+
global $current_user;
|
526 |
+
$user_id = $current_user->ID;
|
527 |
+
/* If user clicks to ignore the notice, add that to their user meta */
|
528 |
+
if ( isset($_POST['dismiss']) ) {
|
529 |
+
if ( '0' == $_POST['dismiss'] ) {
|
530 |
+
add_user_meta($user_id, 'wp_shortcode_ignore_notice', '1', true);
|
531 |
+
} elseif ( '1' == $_POST['dismiss'] ) {
|
532 |
+
add_user_meta($user_id, 'wp_shortcode_ignore_notice_2', '1', true);
|
533 |
+
}
|
534 |
+
}
|
535 |
});
|