PluginProbe
Easy Bootstrap Shortcode / 2.5
Easy Bootstrap Shortcode v2.5
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
easy-bootstrap-shortcodes / osc_bootstrap_shortcode.php

osc_bootstrap_shortcode.php in Easy Bootstrap Shortcode 2.5, at osc_bootstrap_shortcode.php

276 lines 12.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 Plugin Name: Easy Bootstrap Shortcode
5 Plugin URI: http://www.oscitasthemes.com
6 Description: Add bootstrap 3.0.3 styles to your theme by wordpress editor shortcode buttons.
7 Version: 3.7.0
8 Author: oscitas
9 Author URI: http://www.oscitasthemes.com
10 License: Under the GPL v2 or later
11 */
12 function osc_ebs_plugin_exists( $prevent ) {
13 return 'ebs';
14 }
15 $checkplugin=apply_filters('osc_ebs_pro_plugin_exists',false);
16 if(isset($checkplugin) && $checkplugin=='ebsp'):
17 add_action('admin_notices', 'ebs_showAdminMessages');
18
19 function ebs_showMessage($message, $errormsg = false)
20 {
21 if ($errormsg) {
22 echo '<div id="message" class="error ebs_notification">';
23 }
24 else {
25 echo '<div id="message" class="update-nag ebs_notification">';
26 }
27 echo '<p><strong>' . $message . '</strong></p></div>';
28 }
29
30 function ebs_showAdminMessages()
31 {
32 ebs_showMessage("Easy Bootstrap Shortcode Pro activated, deactivate Easy Bootstrap Shortcode free version", false);
33 }
34 else:
35 add_filter( 'osc_ebs_plugin_exists', 'osc_ebs_plugin_exists' );
36 define('EBS_PLUGIN_URL',plugins_url('/',__FILE__));
37 define('EBS_JS_CDN','http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js');
38 define('EBS_RESPOND_CDN','http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.min.js');
39 add_action('admin_init','check_ebsp_status');
40 function check_ebsp_status(){
41 $file = basename( __FILE__ );
42 $folder = basename( dirname( __FILE__ ) );
43 $hook = "after_plugin_row_{$folder}/{$file}";
44 add_action( $hook, 'ebsp_register_licence_key');
45 }
46 function ebsp_register_licence_key( $plugin_name )
47
48 {
49 $ebsprefix='ebsp';
50 $plugin_name='easy-bootstrap-shortcode-pro/osc_bootstrap_shortcode.php ';
51 echo '</tr><tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">' . __('Easy Bootstrap Shortcode Pro also available, <a href="http://oscitasthemes.com/products/easy-bootstrap-shortcodes-pro/">click here</a> to purchase one now',$ebsprefix) . '</div></td>';
52 }
53
54 add_action('admin_enqueue_scripts', 'osc_add_admin_ebs_scripts');
55 add_action('admin_menu', 'osc_ebs_add_admin_menu');
56 add_action('wp_enqueue_scripts', 'osc_add_dynamic_css',100);
57 add_filter('mce_external_plugins', 'osc_editor_enable_mce');
58 if(!apply_filters('plugin_oscitas_theme_check',false)){
59 add_action('wp_enqueue_scripts', 'osc_add_frontend_ebs_scripts',-100);
60 }
61
62
63
64 register_activation_hook(__FILE__, 'osc_ebs_activate_plugin');
65 register_deactivation_hook(__FILE__, 'osc_ebs_deactivate_plugin');
66
67
68 function osc_ebs_activate_plugin() {
69 $isSet=apply_filters('ebs_custom_option',false);
70 if (!$isSet) {
71
72 // 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
73 update_option( 'EBS_BOOTSTRAP_JS_LOCATION', 1 );
74 update_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', EBS_JS_CDN );
75 update_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', EBS_RESPOND_CDN );
76 // 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
77 update_option('EBS_BOOTSTRAP_RESPOND_LOCATION',2);
78
79 // EBS_BOOTSTRAP_CSS_LOCATION '1' - for plugin file, '2' - don't user EBS files but use from other plugin or theme
80 update_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 );
81 update_option( 'EBS_EDITOR_OPT','icon');
82 update_option( 'EBS_EDITOR_OPT','icon');
83 if(get_option('EBS_CUSTOM_CSS')==''){
84 update_option( 'EBS_CUSTOM_CSS','');
85 }
86 }
87
88 }
89 function osc_ebs_settings_link( $links ) {
90 $isSet=apply_filters('ebs_custom_option',false);
91 if (!$isSet) {
92 $settings_link = '<a href="admin.php?page=ebs/ebs-settings.php">Settings</a>';
93 array_push( $links, $settings_link );
94 }
95 return $links;
96 }
97
98 add_filter( "plugin_action_links_".plugin_basename( __FILE__ ), 'osc_ebs_settings_link' );
99
100 function osc_ebs_deactivate_plugin() {
101 $isSet=apply_filters('ebs_custom_option',false);
102 if (!$isSet) {
103 delete_option( 'EBS_BOOTSTRAP_JS_LOCATION' );
104 delete_option( 'EBS_BOOTSTRAP_JS_CDN_PATH' );
105 delete_option( 'EBS_BOOTSTRAP_CSS_LOCATION');
106 delete_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION' );
107 delete_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH' );
108 delete_option('EBS_EDITOR_OPT');
109 }
110 }
111
112 function osc_ebs_add_admin_menu() {
113 $isSet=apply_filters('ebs_custom_option',false);
114 if (!$isSet) {
115 add_menu_page('EBS Settings', ' EBS Settings', 'manage_options', 'ebs/ebs-settings.php', 'osc_ebs_setting_page', plugins_url('/images/icon.png', __FILE__));
116 }
117 }
118
119 function osc_ebs_setting_page() {
120 if (isset($_POST['ebs_submit'])) {
121 update_option( 'EBS_BOOTSTRAP_JS_LOCATION', isset($_POST['b_js'])?$_POST['b_js']:1 );
122 update_option( 'EBS_BOOTSTRAP_JS_CDN_PATH',isset($_POST['cdn_path'])? $_POST['cdn_path']:EBS_JS_CDN );
123 update_option( 'EBS_BOOTSTRAP_CSS_LOCATION', isset($_POST['b_css'])?$_POST['b_css']:1 );
124 update_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION', isset($_POST['respond_js'])?$_POST['respond_js']:2 );
125 update_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', isset($_POST['respond_cdn_path'])?$_POST['respond_cdn_path']:EBS_RESPOND_CDN );
126 update_option( 'EBS_EDITOR_OPT', isset($_POST['ebsp_editor_opt'])?$_POST['ebsp_editor_opt']:'icon' );
127 update_option( 'EBS_CUSTOM_CSS', isset($_POST['ebs_custom_css'])?$_POST['ebs_custom_css']:'' );
128
129 $_SESSION['ebs_dynamic_css'] =$_POST['ebs_custom_css'];
130 $js =isset($_POST['b_js'])?$_POST['b_js']:1;
131 $cdn = isset($_POST['cdn_path'])? $_POST['cdn_path']:EBS_JS_CDN;
132 $css = isset($_POST['b_css'])?$_POST['b_css']:1;
133 $respond = isset($_POST['respond_js'])?$_POST['respond_js']:2;
134 $respondcdn = isset($_POST['respond_cdn_path'])?$_POST['respond_cdn_path']:EBS_RESPOND_CDN;
135 $ebsp_editor_opt=isset($_POST['ebsp_editor_opt'])?$_POST['ebsp_editor_opt']:'icon' ;
136 $ebs_custom_css=isset($_POST['ebs_custom_css'])?$_POST['ebs_custom_css']:'' ;
137
138 } else {
139 $js = get_option( 'EBS_BOOTSTRAP_JS_LOCATION', 1 );
140 $cdn = get_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', EBS_JS_CDN );
141 $css = get_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 );
142 $respond = get_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION', 2 );
143 $respondcdn = get_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', EBS_RESPOND_CDN );
144 $ebsp_editor_opt=get_option('EBS_EDITOR_OPT','icon');
145 $ebs_custom_css=get_option('EBS_CUSTOM_CSS','');
146 }
147 include 'ebs_settings.php';
148 }
149
150 add_action('admin_head', 'osc_ebs_ajax_ul');
151 function osc_ebs_ajax_ul(){
152 $ebsp_editor_opt=get_option('EBS_EDITOR_OPT','icon');
153
154 ?>
155 <script type="text/javascript">
156 var ebs_ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
157 var ebs_url='<?php echo EBS_PLUGIN_URL;?>';
158 var ebs_editor_opt='<?php echo $ebsp_editor_opt; ?>'
159
160 </script>
161 <?php
162 }
163 // add_submenu_page('optine
164 function osc_add_admin_ebs_scripts() {
165 global $pagenow;
166 $screen = get_current_screen();
167 if ($screen->id == 'toplevel_page_ebs/ebs-settings') {
168 wp_enqueue_style('ebs-setting', plugins_url('/styles/ebs-setting.min.css', __FILE__));
169 }
170 wp_enqueue_script('ebs-main', plugins_url('/js/ebs_main.js', __FILE__));
171
172 }
173
174 function osc_editor_enable_mce(){
175 wp_enqueue_script('jquery');
176 wp_enqueue_style('thickbox');
177 wp_enqueue_script('media-upload');
178 wp_enqueue_script('thickbox');
179 wp_enqueue_style('wp-color-picker');
180 wp_enqueue_script('wp-color-picker');
181 wp_enqueue_script('jquery-ui-slider');
182 wp_enqueue_style('EBS_jquery-ui-slider-css', plugins_url('/styles/slider.css', __FILE__));
183 if (!apply_filters('ebs_bootstrap_icon_css_url',false)) {
184 wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.min.css', __FILE__));
185 } else{
186 wp_enqueue_style('bootstrap-icon', apply_filters('ebs_bootstrap_icon_css_url',false));
187 }
188 if (!apply_filters('ebs_custom_bootstrap_admin_css',false)) {
189 wp_enqueue_style('ebs_bootstrap_admin', plugins_url('/styles/bootstrap_admin.min.css', __FILE__));
190 }
191
192 }
193
194 function osc_add_dynamic_css(){
195 $_SESSION['ebs_dynamic_css'] = get_option('EBS_CUSTOM_CSS','');
196 wp_enqueue_style('ebs_dynamic_css', plugins_url('/styles/ebs_dynamic_css.php', __FILE__));
197
198 }
199 function osc_add_frontend_ebs_scripts() {
200 wp_enqueue_script('jquery');
201 $isSet=apply_filters('ebs_custom_option',false);
202 if (!$isSet) {
203 $js = get_option( 'EBS_BOOTSTRAP_JS_LOCATION', 1 );
204 $respond = get_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION', 2 );
205 $cdn = get_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', EBS_JS_CDN );
206 $respondcdn = get_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', EBS_RESPOND_CDN );
207 $css = get_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 );
208
209 // http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.min.js
210
211
212 if ($js == 1) {
213 if (!apply_filters('ebs_bootstrap_js_url',false)) {
214 wp_enqueue_script('bootstrap', plugins_url('/js/bootstrap.min.js', __FILE__));
215 } else{
216 wp_enqueue_script('bootstrap', apply_filters('ebs_bootstrap_js_url',false));
217 }
218 } elseif ($js == 3) {
219 if (!apply_filters('ebs_bootstrap_js_cdn',false)) {
220 wp_enqueue_script('bootstrap', $cdn);
221 } else{
222 wp_enqueue_script('bootstrap', apply_filters('ebs_bootstrap_js_cdn',false));
223 }
224 }
225 if(preg_match('/(?i)msie [1-8]/',$_SERVER['HTTP_USER_AGENT'])){
226 if ($respond == 1) {
227 if (!apply_filters('ebs_bootstrap_respond_url',false)) {
228 wp_enqueue_script('bootstrap_respond', plugins_url('/js/respond.min.js', __FILE__));
229 } else{
230 wp_enqueue_script('bootstrap_respond', apply_filters('ebs_bootstrap_respond_url',false));
231 }
232 } elseif ($respond == 3) {
233 if (!apply_filters('ebs_bootstrap_respond_cdn',false)) {
234 wp_enqueue_script('bootstrap_respond', $respondcdn);
235 } else{
236 wp_enqueue_script('bootstrap_respond', apply_filters('ebs_bootstrap_respond_cdn',false));
237 }
238 }
239 }
240 if ($css == 1) {
241 if (!apply_filters('ebs_bootstrap_css_url',false)) {
242 wp_enqueue_style('bootstrap', plugins_url('/styles/bootstrap.min.css', __FILE__));
243 } else {
244 wp_enqueue_style('bootstrap', apply_filters('ebs_bootstrap_css_url',false));
245 }
246 }
247 elseif($css==3){
248 if (!apply_filters('ebs_no_bootstrap_theme_css_url',false)) {
249 wp_enqueue_style('bootstrap', plugins_url('/styles/bootstrap-oscitas.css', __FILE__));
250 } else {
251 wp_enqueue_style('bootstrap', apply_filters('ebs_no_bootstrap_theme_css_url',false));
252 }
253
254 }
255 else {
256 if (!apply_filters('ebs_bootstrap_icon_css_url',false)) {
257 //wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.min.css', __FILE__));
258 } else{
259 wp_enqueue_style('bootstrap-icon', apply_filters('ebs_bootstrap_icon_css_url',false));
260 }
261 }
262 }
263 }
264
265 // Shortcodes
266
267 add_action('init','ebs_session_start');
268 function ebs_session_start() {
269 if(!session_id()){
270 @session_start();
271 }
272 }
273
274 include('shortcode/functions.php');
275 include('lib/widget.php');
276 endif;