PluginProbe
Easy Bootstrap Shortcode / 3.7
Easy Bootstrap Shortcode v3.7
trunk 2.4.0 2.5 3.4 3.5 3.6 3.7 4.0.0 4.4 4.5 4.5.4 5.0.0 5.0.1 5.0.2
← All changes | osc_bootstrap_shortcode.php +190 -13 3.43.7 View file →
@@ -3,33 +3,210 @@
3 3 /*
4 4 Plugin Name: Easy Bootstrap Shortcode
5 5 Plugin URI: http://www.oscitasthemes.com
6 6 Description: Add bootstrap 3.0 styles to your theme by wordpress editor shortcode buttons.
7 - Version: 1.0
8 - Author: Oscitas Themes
7 + Version: 2.3.6
8 + Author: oscitas
9 9 Author URI: http://www.oscitasthemes.com
10 + License: Under the GPL v2 or later
10 11 */
11 12
12 -add_action('admin_enqueue_scripts', 'osc_add_admin_shortcode_scripts');
13 -add_action('wp_enqueue_scripts', 'osc_add_frontend_shortcode_scripts');
13 +add_action('init','is_oscitas_theme_exists');
14 +function is_oscitas_theme_exists(){
15 + global $oscitaschecktheme;
16 + add_action('admin_enqueue_scripts', 'osc_add_admin_ebs_scripts');
17 + if(!apply_filters('plugin_oscitas_theme_check',false)){
14 18
15 -function osc_add_admin_shortcode_scripts() {
19 + add_action('wp_enqueue_scripts', 'osc_add_frontend_ebs_scripts');
20 + add_action('admin_menu', 'osc_ebs_add_admin_menu');
21 + }
22 +}
23 +
24 +register_activation_hook(__FILE__, 'osc_ebs_activate_plugin');
25 +register_deactivation_hook(__FILE__, 'osc_ebs_deactivate_plugin');
26 +//add_action('admin_enqueue_scripts', 'osc_add_admin_ebs_scripts');
27 +//add_action('wp_enqueue_scripts', 'osc_add_frontend_ebs_scripts');
28 +//add_action('admin_menu', 'osc_ebs_add_admin_menu');
29 +
30 +function osc_ebs_activate_plugin() {
31 + $isSet=apply_filters('ebs_custom_option',false);
32 + if (!$isSet) {
33 +
34 + // EBS_BOOTSTRAP_JS_LOCATION '1' - for plugin file, '2' - don't user EBS files but use from other plugin or theme, '3' - to user CDN path
35 + update_option( 'EBS_BOOTSTRAP_JS_LOCATION', 1 );
36 + update_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', 'http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js' );
37 + update_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', 'http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.min.js' );
38 + // EBS_BOOTSTRAP_RESPOND_LOCATION '1' - for plugin file, '2' - don't user EBS files but use from other plugin or theme, '3' - to user CDN path
39 + update_option('EBS_BOOTSTRAP_RESPOND_LOCATION',2);
40 +
41 + // EBS_BOOTSTRAP_CSS_LOCATION '1' - for plugin file, '2' - don't user EBS files but use from other plugin or theme
42 + update_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 );
43 + }
44 +
45 +}
46 +function osc_ebs_settings_link( $links ) {
47 + $isSet=apply_filters('ebs_custom_option',false);
48 + if (!$isSet) {
49 + $settings_link = '<a href="admin.php?page=ebs/ebs-settings.php">Settings</a>';
50 + array_push( $links, $settings_link );
51 + }
52 + return $links;
53 +}
54 +
55 +add_filter( "plugin_action_links_".plugin_basename( __FILE__ ), 'osc_ebs_settings_link' );
56 +
57 +function osc_ebs_deactivate_plugin() {
58 + $isSet=apply_filters('ebs_custom_option',false);
59 + if (!$isSet) {
60 + delete_option( 'EBS_BOOTSTRAP_JS_LOCATION' );
61 + delete_option( 'EBS_BOOTSTRAP_JS_CDN_PATH' );
62 + delete_option( 'EBS_BOOTSTRAP_CSS_LOCATION');
63 + delete_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION' );
64 + delete_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH' );
65 + }
66 +}
67 +
68 +function osc_ebs_add_admin_menu() {
69 + $isSet=apply_filters('ebs_custom_option',false);
70 + if (!$isSet) {
71 + add_menu_page('EBS Settings', ' EBS Settings', 'manage_options', 'ebs/ebs-settings.php', 'osc_ebs_setting_page', plugins_url('/images/icon.png', __FILE__));
72 + }
73 +}
74 +
75 +function osc_ebs_setting_page() {
76 + if (isset($_POST['ebs_submit'])) {
77 + update_option( 'EBS_BOOTSTRAP_JS_LOCATION', $_POST['b_js'] );
78 + update_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', $_POST['cdn_path'] );
79 + update_option( 'EBS_BOOTSTRAP_CSS_LOCATION', $_POST['b_css'] );
80 + update_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION', $_POST['b_js'] );
81 + update_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', $_POST['cdn_path'] );
82 +
83 +
84 + $js = $_POST['b_js'];
85 + $cdn = $_POST['cdn_path'];
86 + $css = $_POST['b_css'];
87 + $respond = $_POST['respond_js'];
88 + $respondcdn = $_POST['respond_cdn_path'];
89 +
90 + }
91 + else {
92 + $js = get_option( 'EBS_BOOTSTRAP_JS_LOCATION', 1 );
93 + $cdn = get_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', 'http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js' );
94 + $css = get_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 );
95 + $respond = get_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION', 2 );
96 + $respondcdn = get_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', 'http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.min.js' );
97 + }
98 + include 'ebs_settings.php';
99 +}
100 +
101 +/* / add_submenu_page('optine
102 +function osc_add_admin_ebs_scripts() {
16 103 global $pagenow;
104 + $screen = get_current_screen();
105 + if ($screen->id == 'toplevel_page_ebs/ebs-settings') {
106 + wp_enqueue_style('ebs-setting', plugins_url('/styles/ebs-setting.min.css', __FILE__));
107 + }
17 108 if ('post-new.php' == $pagenow || 'post.php' == $pagenow) {
18 109 wp_enqueue_script('jquery');
19 - wp_enqueue_script('colorpickerjs', plugins_url('/js/colorpicker.js', __FILE__));
110 + wp_enqueue_style('thickbox');
111 + wp_enqueue_script('media-upload');
112 + wp_enqueue_script('thickbox');
20 113 wp_enqueue_script('jquery.fancybox', plugins_url('/js/jquery.fancybox.js', __FILE__));
21 114 wp_enqueue_style('fancyboxcss', plugins_url('/styles/jquery.fancybox.css', __FILE__));
22 - wp_enqueue_style('colorpickercss', plugins_url('/styles/colorpicker.css', __FILE__));
23 - wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.css', __FILE__));
24 - wp_enqueue_style('bootstrap_admin', plugins_url('/styles/bootstrap_admin.css', __FILE__));
115 + if (!apply_filters('ebs_bootstrap_icon_css_url',false)) {
116 + wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.min.css', __FILE__));
117 + } else{
118 + wp_enqueue_style('bootstrap-icon', apply_filters('ebs_bootstrap_icon_css_url',false));
119 + }
120 + if (!apply_filters('ebs_custom_bootstrap_admin_css',false)) {
121 + wp_enqueue_style('bootstrap_admin', plugins_url('/styles/bootstrap_admin.min.css', __FILE__));
122 + }
25 123 }
124 +}*/
125 +
126 +// add_submenu_page('optine
127 +function osc_add_admin_ebs_scripts() {
128 + global $pagenow;
129 + $screen = get_current_screen();
130 + if ($screen->id == 'toplevel_page_ebs/ebs-settings') {
131 + wp_enqueue_style('ebs-setting', plugins_url('/styles/ebs-setting.min.css', __FILE__));
132 + }
26 133 }
27 134
28 -function osc_add_frontend_shortcode_scripts() {
135 +function osc_editor_enable_mce(){
29 136 wp_enqueue_script('jquery');
30 - wp_enqueue_script('bootstrap', plugins_url('/js/bootstrap.js', __FILE__));
31 - wp_enqueue_style('bootstrap', plugins_url('/styles/bootstrap.css', __FILE__));
137 + wp_enqueue_style('thickbox');
138 + wp_enqueue_script('media-upload');
139 + wp_enqueue_script('thickbox');
140 + wp_enqueue_script('jquery.fancybox', plugins_url('/js/jquery.fancybox.js', __FILE__));
141 + wp_enqueue_style('fancyboxcss', plugins_url('/styles/jquery.fancybox.css', __FILE__));
142 + if (!apply_filters('ebs_bootstrap_icon_css_url',false)) {
143 + wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.min.css', __FILE__));
144 + } else{
145 + wp_enqueue_style('bootstrap-icon', apply_filters('ebs_bootstrap_icon_css_url',false));
146 + }
147 + if (!apply_filters('ebs_custom_bootstrap_admin_css',false)) {
148 + wp_enqueue_style('bootstrap_admin', plugins_url('/styles/bootstrap_admin.min.css', __FILE__));
149 + }
150 +
32 151 }
152 +add_filter('mce_external_plugins', 'osc_editor_enable_mce');
33 153
154 +function osc_add_frontend_ebs_scripts() {
155 + wp_enqueue_script('jquery');
156 + $isSet=apply_filters('ebs_custom_option',false);
157 + if (!$isSet) {
158 + $js = get_option( 'EBS_BOOTSTRAP_JS_LOCATION', 1 );
159 + $respond = get_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION', 2 );
160 + $cdn = get_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', 'http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js' );
161 + $respondcdn = get_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', 'http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js' );
162 + $css = get_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 );
163 +
164 +// http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.min.js
165 +
166 +
167 + if ($js == 1) {
168 + if (!apply_filters('ebs_bootstrap_js_url',false)) {
169 + wp_enqueue_script('bootstrap', plugins_url('/js/bootstrap.min.js', __FILE__));
170 + } else{
171 + wp_enqueue_script('bootstrap', apply_filters('ebs_bootstrap_js_url',false));
172 + }
173 + } elseif ($js == 3) {
174 + if (!apply_filters('ebs_bootstrap_js_cdn',false)) {
175 + wp_enqueue_script('bootstrap', $cdn);
176 + } else{
177 + wp_enqueue_script('bootstrap', apply_filters('ebs_bootstrap_js_cdn',false));
178 + }
179 + }
180 + if(preg_match('/(?i)msie [1-8]/',$_SERVER['HTTP_USER_AGENT'])){
181 + if ($respond == 1) {
182 + if (!apply_filters('ebs_bootstrap_respond_url',false)) {
183 + wp_enqueue_script('bootstrap_respond', plugins_url('/js/respond.min.js', __FILE__));
184 + } else{
185 + wp_enqueue_script('bootstrap_respond', apply_filters('ebs_bootstrap_respond_url',false));
186 + }
187 + } elseif ($respond == 3) {
188 + if (!apply_filters('ebs_bootstrap_respond_cdn',false)) {
189 + wp_enqueue_script('bootstrap_respond', $respondcdn);
190 + } else{
191 + wp_enqueue_script('bootstrap_respond', apply_filters('ebs_bootstrap_respond_cdn',false));
192 + }
193 + }
194 + }
195 + if ($css == 1) {
196 + if (!apply_filters('ebs_bootstrap_css_url',false)) {
197 + wp_enqueue_style('bootstrap', plugins_url('/styles/bootstrap.min.css', __FILE__));
198 + } else {
199 + wp_enqueue_style('bootstrap', apply_filters('ebs_bootstrap_css_url',false));
200 + }
201 + } else {
202 + if (!apply_filters('ebs_bootstrap_icon_css_url',false)) {
203 + //wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.min.css', __FILE__));
204 + } else{
205 + wp_enqueue_style('bootstrap-icon', apply_filters('ebs_bootstrap_icon_css_url',false));
206 + }
207 + }
208 + }
209 +}
210 +
34 211 // Shortcodes
35 -include('shortcode/functions.php');
212 +include('shortcode/functions.php');