setIsAsTheme( true ); // $composer = WPBakeryVisualComposer::getInstance(); // $composer->setSettingsAsTheme(); // if($disable_updater) $composer->disableUpdater(); TODO: disable update $disable_updater && vc_manager()->disableUpdater(); } } if ( ! function_exists( 'vc_is_as_theme' ) ) { /** * Is VC as-theme-plugin. * * @return bool */ function vc_is_as_theme() { return vc_manager()->isAsTheme(); } } if ( ! function_exists( 'vc_is_updater_disabled' ) ) { function vc_is_updater_disabled() { return vc_manager()->isUpdaterDisabled(); } } if ( ! function_exists( 'vc_default_editor_post_types' ) ) { /** * Returns list of default post type. * * @return bool */ function vc_default_editor_post_types() { return vc_manager()->editorDefaultPostTypes(); } } if ( ! function_exists( 'vc_set_default_editor_post_types' ) ) { /** * Set post types for VC editor. * * @param array $list - list of valid post types to set */ function vc_set_default_editor_post_types( array $list ) { vc_manager()->setEditorDefaultPostTypes( $list ); } } if ( ! function_exists( ( 'vc_editor_post_types' ) ) ) { /** * Returns list of port types where VC editor is enabled. * * @return array */ function vc_editor_post_types() { return vc_manager()->editorPostTypes(); } } if ( ! function_exists( 'vc_mode' ) ) { /** * Return current VC mode. * * @see Vc_Mapper::$mode * @return string */ function vc_mode() { return vc_manager()->mode(); } } if ( ! function_exists( 'vc_set_shortcodes_templates_dir' ) ) { /** * Sets directory where Visual Composer should look for template files for content elements. * * @param string full directory path to new template directory with trailing slash */ function vc_set_shortcodes_templates_dir( $dir ) { vc_manager()->setCustomUserShortcodesTemplateDir( $dir ); } } if ( ! function_exists( 'vc_shortcodes_theme_templates_dir' ) ) { /** * Get custom theme template path * * @param $template - filename for template * @return string */ function vc_shortcodes_theme_templates_dir( $template ) { return vc_manager()->getShortcodesTemplateDir( $template ); } } if ( ! function_exists( 'vc_set_template_dir' ) ) { /** * Sets directory where Visual Composer should look for template files for content elements. * * @deprecated 2.4 * @param string full directory path to new template directory with trailing slash */ function vc_set_template_dir( $dir ) { vc_set_shortcodes_templates_dir( $dir ); } } function set_vc_is_inline($value = true) { global $vc_is_inline; $vc_is_inline = $value; } /** * New Vc now called Frontend editor * @deprecated * @return Vc_Frontend_Editor */ function new_vc() { return vc_frontend_editor(); } /** * Disable frontend editor for VC * @param bool $disable */ function vc_disable_frontend( $disable = true ) { vc_frontend_editor()->disableInline( $disable ); } /** * Check is front end enabled. * @return bool */ function vc_enabled_frontend() { return vc_frontend_editor()->inlineEnabled(); } if ( ! function_exists( 'vc_add_default_templates' ) ) { /** * Add custom template in default templates list * * @param array $data | template data (name, content, custom_class, image_path) * @since 4.3 * @return bool */ function vc_add_default_templates( $data ) { return visual_composer()->templatesEditor()->addDefaultTemplates( $data ); } } if ( ! function_exists( 'vc_load_default_templates' ) ) { /** * load default templates list * * @param none * @since 4.3 prestashop * @return array */ function vc_load_default_templates( ) { return visual_composer()->templatesEditor()->loadDefaultTemplates(); } } /** * Get settings of the mapped shortcode. * * @param $tag * * @since 4.4.3 * @return array|null - settings or null if shortcode not mapped */ function vc_get_shortcode( $tag ) { return WPBMap::getShortCode( $tag ); } /** * Function to get defaults values for shortcode. * @since 4.6 * * @param $tag - shortcode tag * * @return array - list of param=>default_value */ function vc_map_get_defaults( $tag ) { $shortcode = vc_get_shortcode( $tag ); $params = array(); if ( is_array( $shortcode ) && isset( $shortcode['params'] ) && ! empty( $shortcode['params'] ) ) { foreach ( $shortcode['params'] as $param ) { if ( isset( $param['param_name'] ) && 'content' !== $param['param_name'] ) { $value = ''; if ( isset( $param['std'] ) ) { $value = $param['std']; } elseif ( isset( $param['value'] ) && 'checkbox' !== $param['type'] ) { if ( is_array( $param['value'] ) ) { $value = current( $param['value'] ); if ( is_array( $value ) ) { // in case if two-dimensional array provided (vc_basic_grid) $value = current( $value ); } // return first value from array (by default) } else { $value = $param['value']; } } $params[ $param['param_name'] ] = $value; } } } return $params; } /** * @param $tag - shortcode tag3 * @param $atts - shortcode attributes * * @return array - return merged values with provided attributes ( 'a'=>1,'b'=>2 + 'b'=>3,'c'=>4 --> 'a'=>1,'b'=>3 ) * * @see vc_shortcode_attribute_parse - return union of provided attributes ( 'a'=>1,'b'=>2 + 'b'=>3,'c'=>4 --> 'a'=>1, * 'b'=>3, 'c'=>4 ) */ function vc_map_get_attributes( $tag, $atts = array() ) { return JsComposer::shortcode_atts( vc_map_get_defaults( $tag ), $atts, $tag ); }