| @@ -1,441 +1,212 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | /* |
| 3 | 4 | Plugin Name: Easy Bootstrap Shortcode |
| 4 | - Plugin URI: http://www.oscitasthemes.in | |
| 5 | - Description: Add bootstrap 3.0.3 styles to your theme by wordpress editor shortcode buttons. | |
| 6 | - Version: 5.0.2 | |
| 7 | - Requires at least: 6.5 | |
| 8 | - Tested up to: 7.1 | |
| 9 | - Requires PHP: 7.4 | |
| 5 | + Plugin URI: http://www.oscitasthemes.com | |
| 6 | + Description: Add bootstrap 3.0 styles to your theme by wordpress editor shortcode buttons. | |
| 7 | + Version: 2.3.6 | |
| 10 | 8 | Author: oscitas |
| 11 | - Author URI: http://www.oscitasthemes.in | |
| 12 | - License: GPLv2 or later | |
| 13 | - License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
| 14 | - Text Domain: easy-bootstrap-shortcodes | |
| 15 | - Domain Path: /languages | |
| 9 | + Author URI: http://www.oscitasthemes.com | |
| 10 | + License: Under the GPL v2 or later | |
| 16 | 11 | */ |
| 17 | 12 | |
| 18 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 19 | - exit; | |
| 20 | -} | |
| 21 | - | |
| 22 | -/* | |
| 23 | - * function used to check whether ebs activated this check included in EBS Pro | |
| 24 | - */ | |
| 25 | -// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Legacy global kept for extension compatibility. | |
| 26 | -$_EBS_SESSION_STARTED = false; | |
| 27 | -function osc_ebs_plugin_exists( $prevent ) { | |
| 28 | - return 'ebs'; | |
| 29 | -} | |
| 30 | -$checkplugin=apply_filters('osc_ebs_pro_plugin_exists',false); | |
| 31 | -if(isset($checkplugin) && $checkplugin=='ebsp'): | |
| 32 | - add_action('admin_notices', 'ebs_showAdminMessages'); | |
| 33 | - | |
| 34 | - function ebs_showMessage($message, $errormsg = false) | |
| 35 | - { | |
| 36 | - if ($errormsg) { | |
| 37 | - echo '<div id="message" class="error ebs_notification">'; | |
| 38 | - } | |
| 39 | - else { | |
| 40 | - echo '<div id="message" class="update-nag ebs_notification">'; | |
| 41 | - } | |
| 42 | - echo '<p><strong>' . esc_html( $message ) . '</strong></p></div>'; | |
| 43 | - } | |
| 44 | - | |
| 45 | - /* | |
| 46 | - * Show message when EBS and EBS pro both activated | |
| 47 | - */ | |
| 48 | - function ebs_showAdminMessages() | |
| 49 | - { | |
| 50 | - ebs_showMessage(__("Easy Bootstrap Shortcode Pro activated, deactivate Easy Bootstrap Shortcode free version", 'easy-bootstrap-shortcodes'), false); | |
| 51 | - } | |
| 52 | -else: | |
| 53 | - /* | |
| 54 | - Define Global variable and constants | |
| 55 | - */ | |
| 56 | - add_filter( 'osc_ebs_plugin_exists', 'osc_ebs_plugin_exists' ); | |
| 57 | - define('EBS_PLUGIN_URL',plugins_url('/',__FILE__)); | |
| 58 | - define('EBS_JS_CDN','https://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js'); | |
| 59 | - define('EBS_RESPOND_CDN','https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.min.js'); | |
| 60 | - define('EBS_VERSION', '5.0.2'); | |
| 61 | - | |
| 62 | - require_once __DIR__ . '/includes/class-ebs-sanitizer.php'; | |
| 63 | - require_once __DIR__ . '/includes/class-ebs-dynamic-css.php'; | |
| 64 | - require_once __DIR__ . '/includes/class-ebs-gutenberg.php'; | |
| 65 | - | |
| 66 | - \EBS\Styles\Dynamic_Css::register(); | |
| 67 | - \EBS\Editor\Gutenberg::register(); | |
| 68 | - add_action('admin_init','check_ebsp_status'); | |
| 69 | - function check_ebsp_status(){ | |
| 70 | - $file = basename( __FILE__ ); | |
| 71 | - $folder = basename( dirname( __FILE__ ) ); | |
| 72 | - $hook = "after_plugin_row_{$folder}/{$file}"; | |
| 73 | - add_action( $hook, 'ebsp_register_licence_key'); | |
| 74 | - } | |
| 75 | - function ebsp_register_licence_key( $plugin_name ) | |
| 76 | - | |
| 77 | - { | |
| 78 | - $ebsprefix='ebsp'; | |
| 79 | - $plugin_name='easy-bootstrap-shortcode-pro/osc_bootstrap_shortcode.php '; | |
| 80 | - echo '</tr><tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">' . wp_kses( | |
| 81 | - __( 'Easy Bootstrap Shortcode Pro also available, <a href="http://oscitasthemes.in/products/easy-bootstrap-shortcodes-pro/">click here</a> to purchase one now', 'easy-bootstrap-shortcodes' ), | |
| 82 | - array( | |
| 83 | - 'a' => array( 'href' => true ), | |
| 84 | - ) | |
| 85 | - ) . '</div></td>'; | |
| 86 | - } | |
| 87 | - | |
| 88 | - add_action('admin_enqueue_scripts', 'osc_add_admin_ebs_scripts'); | |
| 89 | - add_action('admin_menu', 'osc_ebs_add_admin_menu'); | |
| 90 | - add_filter('mce_external_plugins', 'osc_editor_enable_mce'); | |
| 91 | - /* | |
| 92 | - * Include bootstrap js and css file if activated theme is not an oscitas product | |
| 93 | - */ | |
| 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'); | |
| 94 | 17 | if(!apply_filters('plugin_oscitas_theme_check',false)){ |
| 95 | - add_action('wp_enqueue_scripts', 'osc_add_frontend_ebs_scripts',-100); | |
| 96 | - } | |
| 97 | 18 | |
| 98 | - | |
| 99 | - | |
| 100 | - register_activation_hook(__FILE__, 'osc_ebs_activate_plugin'); | |
| 101 | - register_deactivation_hook(__FILE__, 'osc_ebs_deactivate_plugin'); | |
| 102 | - | |
| 103 | - /* | |
| 104 | - * Plugin activation hook set default plugin setting on activation | |
| 105 | - */ | |
| 106 | - function osc_ebs_activate_plugin() { | |
| 107 | - $isSet=apply_filters('ebs_custom_option',false); | |
| 108 | - if (!$isSet) { | |
| 109 | - | |
| 110 | - // 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 | |
| 111 | - update_option( 'EBS_BOOTSTRAP_JS_LOCATION', 1 ); | |
| 112 | - update_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', EBS_JS_CDN ); | |
| 113 | - update_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', EBS_RESPOND_CDN ); | |
| 114 | - // 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 | |
| 115 | - update_option('EBS_BOOTSTRAP_RESPOND_LOCATION',2); | |
| 116 | - | |
| 117 | - // EBS_BOOTSTRAP_CSS_LOCATION '1' - for plugin file, '2' - don't user EBS files but use from other plugin or theme | |
| 118 | - update_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 ); | |
| 119 | - update_option( 'EBS_EDITOR_OPT','icon'); | |
| 120 | - update_option( 'EBS_EDITOR_OPT','icon'); | |
| 121 | - if(get_option('EBS_SHORTCODE_PREFIX')==false){ | |
| 122 | - update_option( 'EBS_SHORTCODE_PREFIX', '' ); | |
| 123 | - } | |
| 124 | - update_option( 'EBS_INCLUDE_FA',1); | |
| 125 | - update_option( 'EBS_SESSION_CLOSE',0); | |
| 126 | - if(get_option('EBS_CUSTOM_CSS')==''){ | |
| 127 | - update_option( 'EBS_CUSTOM_CSS',''); | |
| 128 | - } | |
| 129 | - } | |
| 130 | - | |
| 19 | + add_action('wp_enqueue_scripts', 'osc_add_frontend_ebs_scripts'); | |
| 20 | + add_action('admin_menu', 'osc_ebs_add_admin_menu'); | |
| 131 | 21 | } |
| 22 | +} | |
| 132 | 23 | |
| 133 | - /* | |
| 134 | - * Plugin deactivation hook, delete option on deactivation | |
| 135 | - */ | |
| 136 | - function osc_ebs_deactivate_plugin() { | |
| 137 | - $isSet=apply_filters('ebs_custom_option',false); | |
| 138 | - if (!$isSet) { | |
| 139 | - delete_option( 'EBS_BOOTSTRAP_JS_LOCATION' ); | |
| 140 | - delete_option( 'EBS_BOOTSTRAP_JS_CDN_PATH' ); | |
| 141 | - delete_option( 'EBS_BOOTSTRAP_CSS_LOCATION'); | |
| 142 | - delete_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION' ); | |
| 143 | - delete_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH' ); | |
| 144 | - delete_option('EBS_EDITOR_OPT'); | |
| 145 | - delete_option('EBS_INCLUDE_FA'); | |
| 146 | - delete_option('EBS_SESSION_CLOSE'); | |
| 147 | - } | |
| 148 | - } | |
| 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'); | |
| 149 | 29 | |
| 150 | - /* | |
| 151 | - * Add plugin setting page on plugin listing page after activation | |
| 152 | - */ | |
| 153 | - function osc_ebs_settings_link( $links ) { | |
| 154 | - $isSet=apply_filters('ebs_custom_option',false); | |
| 155 | - if (!$isSet) { | |
| 156 | - $settings_link = '<a href="admin.php?page=ebs/ebs-settings.php">'.__('Settings', 'easy-bootstrap-shortcodes').'</a>'; | |
| 157 | - array_push( $links, $settings_link ); | |
| 158 | - } | |
| 159 | - return $links; | |
| 160 | - } | |
| 30 | +function osc_ebs_activate_plugin() { | |
| 31 | + $isSet=apply_filters('ebs_custom_option',false); | |
| 32 | + if (!$isSet) { | |
| 161 | 33 | |
| 162 | - add_filter( "plugin_action_links_".plugin_basename( __FILE__ ), 'osc_ebs_settings_link' ); | |
| 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); | |
| 163 | 40 | |
| 164 | - /* | |
| 165 | - * Create EBS admin Menu | |
| 166 | - */ | |
| 167 | - function osc_ebs_add_admin_menu() { | |
| 168 | - $isSet=apply_filters('ebs_custom_option',false); | |
| 169 | - if (!$isSet) { | |
| 170 | - add_menu_page(__('EBS Settings', 'easy-bootstrap-shortcodes'), __('EBS Settings', 'easy-bootstrap-shortcodes'), 'manage_options', 'ebs/ebs-settings.php', 'osc_ebs_setting_page', plugins_url('/images/icon.png', __FILE__)); | |
| 171 | - | |
| 172 | - $sub_page= add_submenu_page( 'ebs/ebs-settings.php',__('osCitas Offers', 'easy-bootstrap-shortcodes'), __('osCitas Offers', 'easy-bootstrap-shortcodes'), 'manage_options', 'ebs-pro-demo', 'osc_ebs_pro_demo_page' ); | |
| 173 | - add_action('admin_print_styles-' . $sub_page, 'ebsProDemoPage_register_admin_styles'); | |
| 174 | - } | |
| 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 ); | |
| 175 | 43 | } |
| 176 | 44 | |
| 177 | - | |
| 178 | - /* | |
| 179 | - * Add EBS pto Demo page css | |
| 180 | - */ | |
| 181 | - function ebsProDemoPage_register_admin_styles(){ | |
| 182 | - wp_enqueue_style('ebs_pro_demo', EBS_PLUGIN_URL.'styles/ebs_pro_demo.css'); | |
| 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 ); | |
| 183 | 51 | } |
| 184 | - function osc_ebs_pro_demo_page(){ | |
| 185 | - include 'lib/ebspro-demo.php'; | |
| 186 | - } | |
| 52 | + return $links; | |
| 53 | +} | |
| 187 | 54 | |
| 188 | -/* | |
| 189 | - * Render EBS Setting Page & update EBS options | |
| 190 | - */ | |
| 191 | - function osc_ebs_setting_page() { | |
| 192 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 193 | - wp_die( esc_html__( 'You do not have permission to access this page.', 'easy-bootstrap-shortcodes' ) ); | |
| 194 | - } | |
| 55 | +add_filter( "plugin_action_links_".plugin_basename( __FILE__ ), 'osc_ebs_settings_link' ); | |
| 195 | 56 | |
| 196 | - if ( isset( $_POST['ebs_submit'] ) ) { | |
| 197 | - check_admin_referer( 'ebs_save_settings', 'ebs_settings_nonce' ); | |
| 198 | - | |
| 199 | - $js_location = isset( $_POST['b_js'] ) ? absint( $_POST['b_js'] ) : 1; | |
| 200 | - if ( $js_location < 1 || $js_location > 3 ) { | |
| 201 | - $js_location = 1; | |
| 202 | - } | |
| 203 | - | |
| 204 | - $css_location = isset( $_POST['b_css'] ) ? absint( $_POST['b_css'] ) : 1; | |
| 205 | - if ( $css_location < 1 || $css_location > 3 ) { | |
| 206 | - $css_location = 1; | |
| 207 | - } | |
| 208 | - | |
| 209 | - $respond_location = isset( $_POST['respond_js'] ) ? absint( $_POST['respond_js'] ) : 2; | |
| 210 | - if ( $respond_location < 1 || $respond_location > 3 ) { | |
| 211 | - $respond_location = 2; | |
| 212 | - } | |
| 213 | - | |
| 214 | - $editor_opt = isset( $_POST['ebsp_editor_opt'] ) ? sanitize_key( $_POST['ebsp_editor_opt'] ) : 'icon'; | |
| 215 | - if ( ! in_array( $editor_opt, array( 'icon', 'dropdown' ), true ) ) { | |
| 216 | - $editor_opt = 'icon'; | |
| 217 | - } | |
| 218 | - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized via Sanitizer::custom_css(). | |
| 219 | - $custom_css = isset( $_POST['ebs_custom_css'] ) ? \EBS\Security\Sanitizer::custom_css( wp_unslash( $_POST['ebs_custom_css'] ) ) : ''; | |
| 220 | - $fa_icon = isset( $_POST['fa_icon'] ) ? 1 : 0; | |
| 221 | - $session_close = isset( $_POST['use_ebs_session_close'] ) ? 1 : 0; | |
| 222 | - $shortcode_prefix = isset( $_POST['shortcode_prefix'] ) ? sanitize_key( wp_unslash( $_POST['shortcode_prefix'] ) ) : ''; | |
| 223 | - $cdn_path = isset( $_POST['cdn_path'] ) ? esc_url_raw( wp_unslash( $_POST['cdn_path'] ) ) : EBS_JS_CDN; | |
| 224 | - $respond_cdn_path = isset( $_POST['respond_cdn_path'] ) ? esc_url_raw( wp_unslash( $_POST['respond_cdn_path'] ) ) : EBS_RESPOND_CDN; | |
| 225 | - | |
| 226 | - update_option( 'EBS_BOOTSTRAP_JS_LOCATION', $js_location ); | |
| 227 | - update_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', $cdn_path ); | |
| 228 | - update_option( 'EBS_BOOTSTRAP_CSS_LOCATION', $css_location ); | |
| 229 | - update_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION', $respond_location ); | |
| 230 | - update_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', $respond_cdn_path ); | |
| 231 | - update_option( 'EBS_EDITOR_OPT', $editor_opt ); | |
| 232 | - update_option( 'EBS_CUSTOM_CSS', $custom_css ); | |
| 233 | - update_option( 'EBS_INCLUDE_FA', $fa_icon ); | |
| 234 | - update_option( 'EBS_SESSION_CLOSE', $session_close ); | |
| 235 | - update_option( 'EBS_SHORTCODE_PREFIX', $shortcode_prefix ); | |
| 236 | - | |
| 237 | - $js = $js_location; | |
| 238 | - $cdn = $cdn_path; | |
| 239 | - $css = $css_location; | |
| 240 | - $respond = $respond_location; | |
| 241 | - $respondcdn = $respond_cdn_path; | |
| 242 | - $ebsp_editor_opt = $editor_opt; | |
| 243 | - $ebs_custom_css = $custom_css; | |
| 244 | - $shortcode_prefix = $shortcode_prefix; | |
| 245 | - $use_ebs_session_close = $session_close; | |
| 246 | - } else { | |
| 247 | - $js = get_option( 'EBS_BOOTSTRAP_JS_LOCATION', 1 ); | |
| 248 | - $cdn = get_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', EBS_JS_CDN ); | |
| 249 | - $css = get_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 ); | |
| 250 | - $respond = get_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION', 2 ); | |
| 251 | - $respondcdn = get_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', EBS_RESPOND_CDN ); | |
| 252 | - $ebsp_editor_opt=get_option('EBS_EDITOR_OPT','icon'); | |
| 253 | - $ebs_custom_css=get_option('EBS_CUSTOM_CSS',''); | |
| 254 | - $shortcode_prefix=get_option('EBS_SHORTCODE_PREFIX',''); | |
| 255 | - $fa_icon=get_option('EBS_INCLUDE_FA',1); | |
| 256 | - $use_ebs_session_close=get_option('EBS_SESSION_CLOSE',0); | |
| 257 | - } | |
| 258 | - include 'ebs_settings.php'; | |
| 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' ); | |
| 259 | 65 | } |
| 66 | +} | |
| 260 | 67 | |
| 261 | - /* | |
| 262 | - * Define global JS variable for admin panel | |
| 263 | - */ | |
| 264 | - add_action('admin_head', 'osc_ebs_ajax_ul'); | |
| 265 | - function osc_ebs_ajax_ul(){ | |
| 266 | - $ebsp_editor_opt=get_option('EBS_EDITOR_OPT','icon'); | |
| 267 | - | |
| 268 | - ?> | |
| 269 | - <script type="text/javascript"> | |
| 270 | - var ebs_ajaxurl = '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>'; | |
| 271 | - var ebs_url='<?php echo esc_url( EBS_PLUGIN_URL ); ?>'; | |
| 272 | - var ebs_editor_opt='<?php echo esc_js( $ebsp_editor_opt ); ?>'; | |
| 273 | - var ebs_dropdown_obj=<?php echo wp_json_encode( ebs_shortcodes() ); ?>; | |
| 274 | - var ebs_dropdown_grp=<?php echo wp_json_encode( ebs_groups() ); ?>; | |
| 275 | - | |
| 276 | - </script> | |
| 277 | - <?php | |
| 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__)); | |
| 278 | 72 | } |
| 73 | +} | |
| 279 | 74 | |
| 280 | - /* | |
| 281 | - * Add css and scripts to admin panel | |
| 282 | - */ | |
| 283 | - function osc_add_admin_ebs_scripts() { | |
| 284 | - global $pagenow; | |
| 285 | - $fa_icon=get_option('EBS_INCLUDE_FA',1); | |
| 286 | - $use_ebs_session_close=get_option('EBS_SESSION_CLOSE',0); | |
| 287 | - $screen = get_current_screen(); | |
| 288 | - if ($screen->id == 'toplevel_page_ebs/ebs-settings') { | |
| 289 | - wp_enqueue_style('ebs-setting', plugins_url('/styles/ebs-setting.min.css', __FILE__)); | |
| 290 | - } | |
| 291 | - wp_enqueue_script('ebs-main', plugins_url('/js/ebs_main.js', __FILE__), array( 'jquery' ), EBS_VERSION, true ); | |
| 292 | - $shortcode_prefix=get_option('EBS_SHORTCODE_PREFIX',''); | |
| 293 | - wp_localize_script( 'ebs-main', 'ebs', array( | |
| 294 | - 'font_awe'=>$fa_icon, | |
| 295 | - 'ebs_prefix'=>$shortcode_prefix | |
| 296 | - )); | |
| 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'] ); | |
| 297 | 82 | |
| 298 | - } | |
| 299 | 83 | |
| 300 | - /* | |
| 301 | - * Add additional css to tinymce editor | |
| 302 | - */ | |
| 303 | - add_action('admin_print_styles','ebsp_tinymce_button_css'); | |
| 304 | - function ebsp_tinymce_button_css() { | |
| 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']; | |
| 305 | 89 | |
| 306 | - wp_register_style('ebsp_tinymce_button_css', plugins_url('/styles/editor.css', __FILE__), array()); | |
| 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 | +} | |
| 307 | 100 | |
| 308 | - wp_enqueue_style('ebsp_tinymce_button_css'); | |
| 309 | - | |
| 310 | - | |
| 311 | - wp_enqueue_style('dashicons'); | |
| 312 | - | |
| 101 | +/* / add_submenu_page('optine | |
| 102 | +function osc_add_admin_ebs_scripts() { | |
| 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__)); | |
| 313 | 107 | } |
| 314 | -/* | |
| 315 | - * Add css to tinymce editor | |
| 316 | - */ | |
| 317 | - function osc_editor_enable_mce($plugin_array){ | |
| 318 | - $fa_icon=get_option('EBS_INCLUDE_FA',1); | |
| 319 | - $use_ebs_session_close=get_option('EBS_SESSION_CLOSE',0); | |
| 108 | + if ('post-new.php' == $pagenow || 'post.php' == $pagenow) { | |
| 320 | 109 | wp_enqueue_script('jquery'); |
| 321 | 110 | wp_enqueue_style('thickbox'); |
| 322 | 111 | wp_enqueue_script('media-upload'); |
| 323 | 112 | wp_enqueue_script('thickbox'); |
| 324 | - wp_enqueue_style('wp-color-picker'); | |
| 325 | - wp_enqueue_script('wp-color-picker'); | |
| 326 | - wp_enqueue_script('jquery-ui-slider'); | |
| 327 | -// wp_enqueue_script('jquery-ui-dialog'); | |
| 328 | -// wp_enqueue_style ( 'wp-jquery-ui-dialog'); | |
| 329 | - wp_enqueue_style('ebs-magnific-popup', plugins_url('/styles/magnific-popup.css', __FILE__)); wp_enqueue_script('ebs-magnific-popup', plugins_url('/js/magnific-popup.js', __FILE__)); | |
| 330 | - wp_enqueue_style('EBS_jquery-ui-slider-css', plugins_url('/styles/slider.css', __FILE__)); | |
| 113 | + wp_enqueue_script('jquery.fancybox', plugins_url('/js/jquery.fancybox.js', __FILE__)); | |
| 114 | + wp_enqueue_style('fancyboxcss', plugins_url('/styles/jquery.fancybox.css', __FILE__)); | |
| 331 | 115 | if (!apply_filters('ebs_bootstrap_icon_css_url',false)) { |
| 332 | 116 | wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.min.css', __FILE__)); |
| 333 | 117 | } else{ |
| 334 | 118 | wp_enqueue_style('bootstrap-icon', apply_filters('ebs_bootstrap_icon_css_url',false)); |
| 335 | 119 | } |
| 336 | - | |
| 337 | 120 | if (!apply_filters('ebs_custom_bootstrap_admin_css',false)) { |
| 338 | - wp_enqueue_style('ebs_bootstrap_admin', plugins_url('/styles/bootstrap_admin.min.css', __FILE__)); | |
| 339 | - } if($fa_icon==1){ | |
| 340 | - wp_enqueue_style('bootstrap-fa-icon', plugins_url('/styles/font-awesome.min.css', __FILE__)); | |
| 121 | + wp_enqueue_style('bootstrap_admin', plugins_url('/styles/bootstrap_admin.min.css', __FILE__)); | |
| 341 | 122 | } |
| 342 | - return $plugin_array; | |
| 343 | 123 | } |
| 124 | +}*/ | |
| 344 | 125 | |
| 345 | - /* | |
| 346 | - * Add bootstrap css and js to frontend if current theme is not an oscitas theme | |
| 347 | - */ | |
| 348 | - function osc_add_frontend_ebs_scripts() { | |
| 349 | - wp_enqueue_script('jquery'); | |
| 350 | - $isSet=apply_filters('ebs_custom_option',false); | |
| 351 | - if (!$isSet) { | |
| 352 | - $js = get_option( 'EBS_BOOTSTRAP_JS_LOCATION', 1 ); | |
| 353 | - $respond = get_option( 'EBS_BOOTSTRAP_RESPOND_LOCATION', 2 ); | |
| 354 | - $cdn = get_option( 'EBS_BOOTSTRAP_JS_CDN_PATH', EBS_JS_CDN ); | |
| 355 | - $respondcdn = get_option( 'EBS_BOOTSTRAP_RESPOND_CDN_PATH', EBS_RESPOND_CDN ); | |
| 356 | - $css = get_option( 'EBS_BOOTSTRAP_CSS_LOCATION', 1 ); | |
| 357 | - $fa_icon=get_option('EBS_INCLUDE_FA',1); | |
| 358 | - $use_ebs_session_close=get_option('EBS_SESSION_CLOSE',0); | |
| 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 | + } | |
| 133 | +} | |
| 134 | + | |
| 135 | +function osc_editor_enable_mce(){ | |
| 136 | + wp_enqueue_script('jquery'); | |
| 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 | + | |
| 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 | + | |
| 359 | 164 | // http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.min.js |
| 360 | 165 | |
| 361 | - if ($js == 1) { | |
| 362 | - if (!apply_filters('ebs_bootstrap_js_url',false)) { | |
| 363 | - wp_enqueue_script('bootstrap', plugins_url('/js/bootstrap.min.js', __FILE__)); | |
| 364 | - } else{ | |
| 365 | - wp_enqueue_script('bootstrap', apply_filters('ebs_bootstrap_js_url',false)); | |
| 366 | - } | |
| 367 | - } elseif ($js == 3) { | |
| 368 | - if (!apply_filters('ebs_bootstrap_js_cdn',false)) { | |
| 369 | - wp_enqueue_script('bootstrap', $cdn); | |
| 370 | - } else{ | |
| 371 | - wp_enqueue_script('bootstrap', apply_filters('ebs_bootstrap_js_cdn',false)); | |
| 372 | - } | |
| 373 | - } | |
| 374 | - //$user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : ''; | |
| 375 | - $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) | |
| 376 | - ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) | |
| 377 | - : ''; | |
| 378 | - if ( $user_agent && preg_match( '/(?i)msie [1-8]/', $user_agent ) ) { | |
| 379 | - if ($respond == 1) { | |
| 380 | - if (!apply_filters('ebs_bootstrap_respond_url',false)) { | |
| 381 | - wp_enqueue_script('bootstrap_respond', plugins_url('/js/respond.min.js', __FILE__)); | |
| 382 | - } else{ | |
| 383 | - wp_enqueue_script('bootstrap_respond', apply_filters('ebs_bootstrap_respond_url',false)); | |
| 384 | - } | |
| 385 | - } elseif ($respond == 3) { | |
| 386 | - if (!apply_filters('ebs_bootstrap_respond_cdn',false)) { | |
| 387 | - wp_enqueue_script('bootstrap_respond', $respondcdn); | |
| 388 | - } else{ | |
| 389 | - wp_enqueue_script('bootstrap_respond', apply_filters('ebs_bootstrap_respond_cdn',false)); | |
| 390 | - } | |
| 391 | - } | |
| 392 | - } | |
| 393 | - if ($css == 1) { | |
| 394 | - if (!apply_filters('ebs_bootstrap_css_url',false)) { | |
| 395 | - wp_enqueue_style('bootstrap', plugins_url('/styles/bootstrap.min.css', __FILE__)); | |
| 396 | - } else { | |
| 397 | - wp_enqueue_style('bootstrap', apply_filters('ebs_bootstrap_css_url',false)); | |
| 398 | - } | |
| 399 | - } | |
| 400 | - elseif($css==3){ | |
| 401 | - if (!apply_filters('ebs_no_bootstrap_theme_css_url',false)) { | |
| 402 | - wp_enqueue_style('bootstrap', plugins_url('/styles/bootstrap-oscitas.css', __FILE__)); | |
| 403 | - } else { | |
| 404 | - wp_enqueue_style('bootstrap', apply_filters('ebs_no_bootstrap_theme_css_url',false)); | |
| 405 | - } | |
| 406 | 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)); | |
| 407 | 200 | } |
| 408 | - else { | |
| 409 | - if (!apply_filters('ebs_bootstrap_icon_css_url',false)) { | |
| 410 | - //wp_enqueue_style('bootstrap-icon', plugins_url('/styles/bootstrap-icon.min.css', __FILE__)); | |
| 411 | - } else{ | |
| 412 | - wp_enqueue_style('bootstrap-icon', apply_filters('ebs_bootstrap_icon_css_url',false)); | |
| 413 | - } | |
| 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)); | |
| 414 | 206 | } |
| 415 | - if($fa_icon==1){ | |
| 416 | - if(!apply_filters('ebs_bootstrap_fa_icon_include_from_theme_or_plugin',false)){ | |
| 417 | - if (!apply_filters('ebs_bootstrap_fa_icon_frontend_css_url',false)) { | |
| 418 | - wp_enqueue_style('bootstrap-fa-icon', plugins_url('/styles/font-awesome.min.css', __FILE__)); | |
| 419 | - } else{ | |
| 420 | - wp_enqueue_style('bootstrap-fa-icon', apply_filters('ebs_bootstrap_fa_icon_frontend_css_url',false)); | |
| 421 | - } | |
| 422 | - } | |
| 423 | - } | |
| 424 | 207 | } |
| 425 | 208 | } |
| 209 | +} | |
| 426 | 210 | |
| 427 | 211 | // Shortcodes |
| 428 | - | |
| 429 | - /** | |
| 430 | - * Legacy no-op kept for backward compatibility with extensions. | |
| 431 | - */ | |
| 432 | - function ebs_session_start() {} | |
| 433 | - | |
| 434 | - /** | |
| 435 | - * Legacy no-op kept for backward compatibility with extensions. | |
| 436 | - */ | |
| 437 | - function ebs_session_end() {} | |
| 438 | - | |
| 439 | - include('shortcode/functions.php'); | |
| 440 | - include('lib/widget.php'); | |
| 441 | -endif; | |
| 212 | +include('shortcode/functions.php'); | |