function et_fb_load_portability() { et_core_register_admin_assets(); et_core_load_component('portability'); // Register the Builder individual layouts portability. et_core_portability_register('et_builder', array('name' => esc_html__('Divi Builder Layout', 'et_builder'), 'type' => 'post', 'view' => true)); }
/** * Load Core components. * * This function loads Core 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 Core component(s) to include as and indexed array. * * @return bool Always return true. */ function et_core_load_component($components) { static $loaded = array(); // Load in front end and backend. $common = array(); // Only load admin components if is_admin() is true or is FB opened. $admin = is_admin() || et_fb_enabled() ? array('portability' => ET_CORE_PATH . 'admin/includes/portability.php', 'cache' => array(ET_CORE_PATH . 'admin/includes/cache.php', ET_CORE_PATH . 'admin/includes/class-cache.php')) : array(); // Set dependencies. $dependencies = array('portability' => 'cache'); 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)) { et_core_load_component($dependencies[$component]); } $_components = array(); if (isset($common[$component])) { $_components = (array) $common[$component]; } if (isset($admin[$component])) { $_components = array_merge((array) $_components, (array) $admin[$component]); } foreach ($_components as $component_path) { require_once $component_path; } /** * Fires when an Core component is loaded. * * The dynamic portion of the hook name, $component, refers to the name of the Core component loaded. * * @since 1.0.0 */ do_action('et_core_loaded_component_' . $component); } }
/** * Register ePanel portability. * * @since To define * * @return bool Always return true. */ function et_epanel_register_portability() { global $shortname, $themename, $options; // Make sure the Portability is loaded. et_core_load_component('portability'); // Load ePanel options. et_load_core_options(); // Include only ePanel options. $include = array(); foreach ($options as $option) { if (isset($option['id'])) { $include[$option['id']] = true; } } // Register the portability. et_core_portability_register('epanel', array('name' => sprintf(esc_html__('%s Theme Options', $themename), $themename), 'type' => 'options', 'target' => "et_{$shortname}", 'include' => $include, 'view' => isset($_GET['page']) && $_GET['page'] == "et_{$shortname}_options")); }
/** * Register theme and modules Customizer portability. * * @since 2.7.0 * * @return bool Always return true. */ function et_divi_register_customizer_portability() { global $options; // Make sure the Portability is loaded. et_core_load_component('portability'); // Load ePanel options. et_load_core_options(); // Exclude ePanel options. $exclude = array(); foreach ($options as $option) { if (isset($option['id'])) { $exclude[$option['id']] = true; } } // Register the portability. et_core_portability_register('et_divi_mods', array('name' => esc_html__('Divi Customizer Settings', 'Divi'), 'type' => 'options', 'target' => 'et_divi', 'exclude' => $exclude, 'view' => is_customize_preview())); }
/** * Register Builder portabilities. * * @since To define * * @return bool Always return true. */ function et_pb_register_builder_portabilities() { global $shortname; // Don't overwrite global. $_shortname = empty($shortname) ? 'divi' : $shortname; // Make sure the Portability is loaded. et_core_load_component('portability'); // Register the Roles Editor portability. et_core_portability_register('et_pb_roles', array('name' => esc_html__('Divi Role Editor Settings', 'et_builder'), 'type' => 'options', 'target' => 'et_pb_role_settings', 'view' => isset($_GET['page']) && $_GET['page'] === "et_{$_shortname}_role_editor")); // Register the Builder individual layouts portability. et_core_portability_register('et_builder', array('name' => esc_html__('Divi Builder Layout', 'et_builder'), 'type' => 'post', 'view' => function_exists('et_builder_should_load_framework') && et_builder_should_load_framework())); // Register the Builder Layouts Post Type portability. et_core_portability_register('et_builder_layouts', array('name' => esc_html__('Divi Builder Layouts', 'et_builder'), 'type' => 'post_type', 'target' => ET_BUILDER_LAYOUT_POST_TYPE, 'view' => isset($_GET['post_type']) && $_GET['post_type'] === ET_BUILDER_LAYOUT_POST_TYPE)); }