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 +170 -69 3.63.7 View file →
@@ -3,75 +3,108 @@
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: 2.1.0
8 - Author: Oscitas Themes
7 + Version: 2.3.6
8 + Author: oscitas
9 9 Author URI: http://www.oscitasthemes.com
10 10 License: Under the GPL v2 or later
11 11 */
12 -register_activation_hook(__FILE__, 'ebs_activate_plugin');
13 -register_deactivation_hook(__FILE__, 'ebs_deactivate_plugin');
14 -add_action('admin_enqueue_scripts', 'osc_add_admin_shortcode_scripts');
15 -add_action('wp_enqueue_scripts', 'osc_add_frontend_shortcode_scripts');
16 -add_action('admin_menu', 'ebs_add_admin_menu');
17 12
18 -function ebs_activate_plugin() {
19 - global $wpdb;
20 - $sqlebs = "CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "ebs_settings (
21 - id int(10) unsigned NOT NULL AUTO_INCREMENT,
22 - ebs_js varchar(100),
23 - ebs_css varchar(100),
24 - ebs_cdn_path varchar(500),
25 - PRIMARY KEY (id)
26 - )";
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)){
27 18
28 - $wpdb->query($sqlebs);
29 - $wpdb->insert(
30 - $wpdb->prefix . 'ebs_settings', array(
31 - 'ebs_js' => 'plugin',
32 - 'ebs_css' => 'plugin',
33 - 'ebs_cdn_path' => 'http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js'
34 - ), array(
35 - '%s',
36 - '%s',
37 - '%s'
38 - )
39 - );
19 + add_action('wp_enqueue_scripts', 'osc_add_frontend_ebs_scripts');
20 + add_action('admin_menu', 'osc_ebs_add_admin_menu');
21 + }
40 22 }
41 23
42 -function ebs_deactivate_plugin() {
43 - global $wpdb;
44 - $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "ebs_settings");
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 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 +}
46 54
47 -function ebs_add_admin_menu() {
48 - add_menu_page('EBS Settings', ' EBS Settings', 'manage_options', 'ebs/ebs-settings.php', 'ebs_setting_page', plugins_url('/images/icon.png', __FILE__));
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 + }
49 66 }
50 67
51 -function ebs_setting_page() {
52 - global $wpdb;
53 - $result = $wpdb->get_results('SELECT * from ' . $wpdb->prefix . "ebs_settings where id=1");
54 - foreach ($result as $res) {
55 - $js = $res->ebs_js;
56 - $css = $res->ebs_css;
57 - $cdn = $res->ebs_cdn_path;
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__));
58 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 + }
59 98 include 'ebs_settings.php';
60 - if (isset($_POST['ebs_submit'])) {
61 -// $cdnins = ($_POST['b_js'] == 'cdn') ? $_POST['cdn_path'] : '';
62 - $sqlins = 'UPDATE ' . $wpdb->prefix . 'ebs_settings set ebs_js="' . $_POST['b_js'] . '", ebs_css="' . $_POST['b_css'] . '", ebs_cdn_path="' . $_POST['cdn_path'] . '" where id=1';
63 - $wpdb->query($sqlins);
64 - echo ' <script type="text/javascript">window.location=document.URL;</script>';
65 - }
66 99 }
67 100
68 -// add_submenu_page('optine
69 -function osc_add_admin_shortcode_scripts() {
101 +/* / add_submenu_page('optine
102 +function osc_add_admin_ebs_scripts() {
70 103 global $pagenow;
71 104 $screen = get_current_screen();
72 105 if ($screen->id == 'toplevel_page_ebs/ebs-settings') {
73 - wp_enqueue_style('ebs-setting', plugins_url('/styles/ebs-setting.css', __FILE__));
106 + wp_enqueue_style('ebs-setting', plugins_url('/styles/ebs-setting.min.css', __FILE__));
74 107 }
75 108 if ('post-new.php' == $pagenow || 'post.php' == $pagenow) {
76 109 wp_enqueue_script('jquery');
77 110 wp_enqueue_style('thickbox');
@@ -78,34 +111,102 @@
78 111 wp_enqueue_script('media-upload');
79 112 wp_enqueue_script('thickbox');
80 113 wp_enqueue_script('jquery.fancybox', plugins_url('/js/jquery.fancybox.js', __FILE__));
81 114 wp_enqueue_style('fancyboxcss', plugins_url('/styles/jquery.fancybox.css', __FILE__));
82 - wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.css', __FILE__));
83 - 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 + }
84 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 + }
85 133 }
86 134
87 -function osc_add_frontend_shortcode_scripts() {
135 +function osc_editor_enable_mce(){
88 136 wp_enqueue_script('jquery');
89 - global $wpdb;
90 - $result = $wpdb->get_results('SELECT * from ' . $wpdb->prefix . "ebs_settings where id=1");
91 - foreach ($result as $res) {
92 - $js = $res->ebs_js;
93 - $css = $res->ebs_css;
94 - $cdn = $res->ebs_cdn_path;
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));
95 146 }
96 - if ($js == 'plugin') {
97 - wp_enqueue_script('bootstrap', plugins_url('/js/bootstrap.js', __FILE__));
98 - } elseif ($js == 'cdn') {
99 - wp_enqueue_script('bootstrap', $cdn);
147 + if (!apply_filters('ebs_custom_bootstrap_admin_css',false)) {
148 + wp_enqueue_style('bootstrap_admin', plugins_url('/styles/bootstrap_admin.min.css', __FILE__));
100 149 }
101 - if ($css == 'plugin') {
102 - wp_enqueue_style('bootstrap', plugins_url('/styles/bootstrap.css', __FILE__));
103 - } else {
104 - wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.css', __FILE__));
150 +
151 +}
152 +add_filter('mce_external_plugins', 'osc_editor_enable_mce');
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 + }
105 208 }
106 209 }
107 210
108 211 // Shortcodes
109 -include('shortcode/functions.php');
110 -
111 -
212 +include('shortcode/functions.php');