function themebutler_load_dependencies() { // Load the necessary Beans components. beans_load_api_components(array('uikit')); // Add third party styles and scripts compiler support. beans_add_api_component_support('wp_styles_compiler'); beans_add_api_component_support('wp_scripts_compiler'); }
/** * Load dependencies. * * @ignore */ function beans_load_dependencies() { require_once trailingslashit(dirname(__FILE__)) . 'api/init.php'; // Load the necessary Beans components. beans_load_api_components(array('actions', 'html', 'term-meta', 'post-meta', 'image', 'wp-customize', 'compiler', 'uikit', 'template', 'layout', 'widget')); // Add third party styles and scripts compiler support. beans_add_api_component_support('wp_styles_compiler'); beans_add_api_component_support('wp_scripts_compiler'); do_action('beans_after_load_api'); }
/** * Load dependencies. * * @ignore */ function beans_load_dependencies() { require_once BEANS_API_PATH . 'init.php'; // Load the necessary Beans components. beans_load_api_components(array('actions', 'html', 'term-meta', 'post-meta', 'image', 'wp-customize', 'compiler', 'uikit', 'template', 'layout', 'widget')); // Add third party styles and scripts compiler support. beans_add_api_component_support('wp_styles_compiler'); beans_add_api_component_support('wp_scripts_compiler'); /** * Fires after Beans API loads. * * @since 1.0.0 */ do_action('beans_after_load_api'); }
/** * Load Beans API components. * * This function loads Beans API components. Components are only loaded once, even if they are called many times. * Admin components/functions are automatically wrapped in an is_admin() check. * * @since 1.0.0 * * @param string|array $components Name of the API component(s) to include as and indexed array. The name(s) must be * the Beans API component folder. * * @return bool Will always return true. */ function beans_load_api_components($components) { static $loaded = array(); $root = BEANS_API_COMPONENTS_PATH; $common = array('html' => array($root . 'html/functions.php', $root . 'html/class.php'), 'actions' => $root . 'actions/functions.php', 'filters' => $root . 'filters/functions.php', 'wp-customize' => $root . 'wp-customize/functions.php', 'post-meta' => $root . 'post-meta/functions.php', 'term-meta' => $root . 'term-meta/functions.php', 'fields' => $root . 'fields/functions.php', 'image' => $root . 'image/functions.php', 'compiler' => array($root . 'compiler/functions.php', $root . 'compiler/class-compiler.php', $root . 'compiler/class-page-compiler.php'), 'uikit' => array($root . 'uikit/functions.php', $root . 'uikit/class.php'), 'layout' => $root . 'layout/functions.php', 'template' => $root . 'template/functions.php', 'widget' => $root . 'widget/functions.php'); // Only load admin fragments if is_admin() is true. if (is_admin()) { $admin = array('options' => $root . 'options/functions.php', 'post-meta' => $root . 'post-meta/functions-admin.php', 'term-meta' => $root . 'term-meta/functions-admin.php', 'compiler' => $root . 'compiler/class-options.php', 'image' => $root . 'image/class-options.php', '_admin_menu' => $root . 'admin-menu.php'); } else { $admin = array(); } // Set dependencies. $dependencies = array('html' => array('_admin_menu', 'filters'), 'fields' => array('actions', 'html'), 'options' => 'fields', 'post-meta' => 'fields', 'term-meta' => 'fields', 'wp-customize' => 'fields', 'layout' => 'fields', 'image' => '_admin_menu', 'compiler' => '_admin_menu', 'uikit' => 'compiler', '_admin_menu' => 'options'); foreach ((array) $components as $component) { // Stop here if the component is already loaded or doesn't exists. if (in_array($component, $loaded) || !isset($common[$component]) && !isset($admin[$component])) { continue; } // Cache loaded component before calling dependencies. $loaded[] = $component; // Load dependencies. if (array_key_exists($component, $dependencies)) { beans_load_api_components($dependencies[$component]); } $_components = array(); // Add common components. if (isset($common[$component])) { $_components = (array) $common[$component]; } // Add admin components. if (isset($admin[$component])) { $_components = array_merge((array) $_components, (array) $admin[$component]); } // Load components. foreach ($_components as $component_path) { require_once $component_path; } /** * Fires when an API component is loaded. * * The dynamic portion of the hook name, $component, refers to the name of the API component loaded. * * @since 1.0.0 */ do_action('beans_loaded_api_component_' . $component); } return true; }
Plugin Name: WooCommerce Overrides for Beans Plugin URI: http://www.themebutler.com Description: Utilize the power of Beans in your WooCommerce projects. Can be used with the Beans parent theme or child-themes created for Beans. Version: 1.0.0-Alpha-1 Author: ThemeButler Author URI: http://www.themebutler.com License: GNU GPL v2 */ // Stop here if Beans is not available. if (!file_exists(get_template_directory() . '/lib/api/init.php')) { return; } // Include Beans require_once get_template_directory() . '/lib/api/init.php'; // Register needed components beans_load_api_components(array('actions', 'html', 'image', 'compiler', 'uikit', 'template', 'layout', 'widget')); function wcb_plugin_path() { // gets the absolute path to this plugin directory return untrailingslashit(plugin_dir_path(__FILE__)); } // Register the plugins WooCommerce template overrides add_filter('woocommerce_locate_template', 'wcb_woocommerce_locate_template', 10, 3); function wcb_woocommerce_locate_template($template, $template_name, $template_path) { global $woocommerce; $_template = $template; if (!$template_path) { $template_path = $woocommerce->template_url; } $plugin_path = wcb_plugin_path() . '/woocommerce/';