Esempio n. 1
0
 function spb_register_assets()
 {
     $pb_assets = array();
     $path = dirname(__FILE__) . '/shortcodes/';
     $folders = scandir($path, 1);
     foreach ($folders as $file) {
         if ($file == '.' || $file == '..' || $file == '.DS_Store' || strpos($file, '.php') != true) {
             continue;
         }
         $file = substr($file, 0, -4);
         $pb_assets[$file] = SPB_SHORTCODES . $file . '.php';
     }
     $pb_assets = apply_filters('spb_assets_filter', $pb_assets);
     if (!sf_gravityforms_activated()) {
         unset($pb_assets['gravityforms']);
     }
     if (!sf_woocommerce_activated()) {
         unset($pb_assets['products']);
         unset($pb_assets['product-reviews']);
     }
     if (!sf_gopricing_activated()) {
         unset($pb_assets['gopricing']);
     }
     if (!sf_ninjaforms_activated()) {
         unset($pb_assets['ninjaforms']);
     }
     // Load Each Asset
     foreach ($pb_assets as $asset) {
         require_once $asset;
     }
 }
Esempio n. 2
0
 function sf_remove_plugin_scripts()
 {
     global $sf_options;
     if (!sf_theme_supports('swift-smartscript') || is_admin()) {
         return;
     }
     $enable_swift_smartscript = $sf_options['enable_swift_smartscript'];
     if (!$enable_swift_smartscript) {
         return;
     }
     global $post;
     $page_has_swiftslider = $page_has_gopricing = false;
     $woo_shop_slider = $sf_options['woo_shop_slider'];
     $page_slider = "";
     if ($post) {
         $page_has_swiftslider = sf_get_post_meta($post->ID, 'sf_page_has_swiftslider', true);
         $page_slider = sf_get_post_meta($post->ID, 'sf_page_slider', true);
         $page_has_gopricing = sf_get_post_meta($post->ID, 'sf_page_has_gopricing', true);
     }
     // Swift Slider
     if (function_exists('is_shop') && is_shop() && $woo_shop_slider == "swift-slider") {
         $page_has_swiftslider = true;
     }
     if (function_exists('is_product_category') && is_product_category() && $woo_shop_slider == "swift-slider") {
         $page_has_swiftslider = true;
     }
     if (is_singular('swift-slider')) {
         $page_has_swiftslider = true;
     }
     if (!$page_has_swiftslider && $page_slider != "swift-slider") {
         wp_dequeue_style('swift-slider');
         wp_dequeue_style('swift-slider-min');
         wp_dequeue_script('swift-slider');
         wp_dequeue_script('swift-slider-min');
     }
     // GoPricing
     if (sf_gopricing_activated() && !$page_has_gopricing) {
         wp_dequeue_style('go_pricing_styles');
         wp_dequeue_style('go_pricing_jqplugin-mediaelementjs');
         wp_dequeue_style('go_pricing_jqplugin-mediaelementjs-skin');
         wp_dequeue_script('go_pricing_scripts');
         wp_dequeue_script('go_pricing_jqplugin-mediaelementjs');
     }
 }