dvadf
File manager - Edit - /home/theblueo/tv/wp-includes/pomo/lib/autoload.tar
Back
params-to-init.php 0000666 00000002517 15214117146 0010134 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } add_filter( 'vc_edit_form_fields_optional_params', 'vc_edit_for_fields_add_optional_params' ); if ( 'vc_edit_form' === vc_post_param( 'action' ) ) { add_action( 'vc_edit_form_fields_after_render', 'vc_output_required_params_to_init' ); add_filter( 'vc_edit_form_fields_optional_params', 'vc_edit_for_fields_add_optional_params' ); } function vc_edit_for_fields_add_optional_params( $params ) { $arr = array( 'hidden', 'textfield', 'dropdown', 'checkbox', 'posttypes', 'taxonomies', 'taxomonies', 'exploded_textarea', 'textarea_raw_html', 'textarea_safe', 'textarea', 'attach_images', 'attach_image', 'widgetised_sidebars', 'colorpicker', 'loop', 'vc_link', 'sorted_list', 'tab_id', 'href', 'custom_markup', 'animation_style', 'iconpicker', 'el_id', 'vc_grid_item', 'google_fonts', ); $params = array_values( array_unique( array_merge( $params, $arr ) ) ); return $params; } function vc_output_required_params_to_init() { $params = WpbakeryShortcodeParams::getRequiredInitParams(); $js_array = array(); foreach ( $params as $param ) { $js_array[] = '"' . $param . '"'; } echo ' <script type="text/javascript"> if ( window.vc ) { window.vc.required_params_to_init = [' . implode( ',', $js_array ) . ']; } </script> '; } post-type-default-template.php 0000666 00000012734 15214117146 0012471 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Return true value for filter 'wpb_vc_js_status_filter'. * It allows to start backend editor on load. * @since 4.12 * * @return string */ function vc_set_default_content_for_post_type_wpb_vc_js_status_filter() { return 'true'; } /** * Set default content by post type in editor. * * Data for post type templates stored in settings. * * @param $post_content * @param $post * @since 4.12 * * @return null */ function vc_set_default_content_for_post_type( $post_content, $post ) { if ( ! empty( $post_content ) || ! vc_backend_editor()->isValidPostType( $post->post_type ) ) { return $post_content; } $template_settings = new Vc_Setting_Post_Type_Default_Template_Field( 'general', 'default_template_post_type' ); if ( ( $new_post_content = $template_settings->getTemplateByPostType( $post->post_type ) ) !== null ) { add_filter( 'wpb_vc_js_status_filter', 'vc_set_default_content_for_post_type_wpb_vc_js_status_filter' ); return $new_post_content; } return $post_content; } /** * Default template for post types manager * * Class Vc_Setting_Post_Type_Default_Template_Field * * @since 4.12 */ class Vc_Setting_Post_Type_Default_Template_Field { protected $tab; protected $key; protected $post_types = false; function __construct( $tab, $key ) { $this->tab = $tab; $this->key = $key; add_action( 'vc_settings_tab-general', array( $this, 'addField', ) ); } protected function getFieldName() { return __( 'Default template for post types', 'js_composer' ); } protected function getFieldKey() { require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-settings.php' ); return Vc_Settings::getFieldPrefix() . $this->key; } protected function isValidPostType( $type ) { return post_type_exists( $type ); } protected function getPostTypes() { if ( false === $this->post_types ) { require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-roles.php' ); $vc_roles = new Vc_Roles(); $this->post_types = $vc_roles->getPostTypes(); } return $this->post_types; } protected function getTemplates() { return $this->getTemplatesEditor()->getAllTemplates(); } protected function getTemplatesEditor() { return visual_composer()->templatesPanelEditor(); } /** * Get settings data for default templates * * @return array|mixed|void */ protected function get() { require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-settings.php' ); return ( $value = Vc_Settings::get( $this->key ) ) ? $value : array(); } /** * Get template's shortcodes string * * @param $template_data * @return string|null */ protected function getTemplate( $template_data ) { $template = null; $template_settings = preg_split( '/\:\:/', $template_data ); $template_id = $template_settings[1]; $template_type = $template_settings[0]; if ( ! isset( $template_id, $template_type ) || '' === $template_id || '' === $template_type ) { return $template; } WPBMap::addAllMappedShortcodes(); if ( 'my_templates' === $template_type ) { $saved_templates = get_option( $this->getTemplatesEditor()->getOptionName() ); $content = trim( $saved_templates[ $template_id ]['template'] ); $content = str_replace( '\"', '"', $content ); $pattern = get_shortcode_regex(); $template = preg_replace_callback( "/{$pattern}/s", 'vc_convert_shortcode', $content ); } else { if ( 'default_templates' === $template_type ) { $template_data = $this->getTemplatesEditor()->getDefaultTemplate( $template_id ); if ( isset( $template_data['content'] ) ) { $template = $template_data['content']; } } else { $template_preview = apply_filters( 'vc_templates_render_backend_template_preview', $template_id, $template_type ); if ( (string) $template_preview !== (string) $template_id ) { $template = $template_preview; } } } return $template; } public function getTemplateByPostType( $type ) { $value = $this->get(); return isset( $value[ $type ] ) ? $this->getTemplate( $value[ $type ] ) : null; } public function sanitize( $settings ) { foreach ( $settings as $type => $template ) { if ( empty( $template ) ) { unset( $settings[ $type ] ); } else if ( ! $this->isValidPostType( $type ) || ! $this->getTemplate( $template ) ) { add_settings_error( $this->getFieldKey(), 1, __( 'Invalid template or post type.', 'js_composer' ), 'error' ); return $settings; } } return $settings; } public function render() { vc_include_template( 'pages/vc-settings/default-template-post-type.tpl.php', array( 'post_types' => $this->getPostTypes(), 'templates' => $this->getTemplates(), 'title' => $this->getFieldName(), 'value' => $this->get(), 'field_key' => $this->getFieldKey(), ) ); } /** * Add field settings page * * Method called by vc hook vc_settings_tab-general. */ public function addField() { vc_settings()->addField( $this->tab, $this->getFieldName(), $this->key, array( $this, 'sanitize', ), array( $this, 'render', ) ); } } /** * Start only for admin part with hooks */ if ( is_admin() ) { /** * Initialize Vc_Setting_Post_Type_Default_Template_Field * Called by admin_init hook */ function vc_settings_post_type_default_template_field_init() { new Vc_Setting_Post_Type_Default_Template_Field( 'general', 'default_template_post_type' ); } add_filter( 'default_content', 'vc_set_default_content_for_post_type', 100, 2 ); add_action( 'admin_init', 'vc_settings_post_type_default_template_field_init', 8 ); } components.json 0000666 00000003762 15214117146 0007642 0 ustar 00 { "params/hidden.php": "", "params/vc_grid_item.php": "", "vendors/acf.php": "", "vendors/cf7.php": "", "vendors/gravity_forms.php": "", "vendors/jwplayer.php": "", "vendors/layerslider.php": "", "vendors/mqtranslate.php": "", "vendors/ninja_forms.php": "", "vendors/qtranslate.php": "", "vendors/qtranslate-x.php": "", "vendors/revslider.php": "", "vendors/woocommerce.php": "", "vendors/wp_customize.php": "", "vendors/yoast_seo.php": "", "vendors/wpml.php": "", "hook-vc-grid.php": "Logic for shortcode vc_grid", "hook-vc-iconpicker-param.php": "Logic for shortcode param iconpicker", "hook-vc-message.php": "Logic for shortcode vc_message", "hook-vc-progress-bar.php": "Logic for shortcode vc_progress_bar", "hook-vc-wp-text.php": "Logic for shortcode vc_wp_text fix", "hook-vc-pie.php": "Logic for shortcode vc_pie", "vc-grid-item-editor.php": "Create new post type vc_grid_item or Grid item", "ui-vc-pointers.php": "Integrating With WordPress’ UI: Admin Pointers", "vc-pages/automapper.php": "", "vc-pages/page-custom-css.php": "Vc Special pages.", "vc-pages/page-design-options.php": "Vc Special pages.", "vc-pages/page-role-manager.php": "Vc Special pages.", "vc-pages/pages.php": "Vc Special pages.", "vc-pages/settings-tabs.php": "Vc Special pages.", "vc-pages/welcome-screen.php": "Vc Special pages.", "vc-pointers-backend-editor.php": "Backend editor VC Pointers", "vc-pointers-frontend-editor.php": "Frontend editor VC Pointers", "vc-image-filters.php": "PHP class for photo effects like Instagram", "vc-settings-presets.php": "Logic for settings presets", "vc-single-image.php": "add bc for single image", "backend-editor-ie.php": "add ie9 degradation", "frontend-editor-ie.php": "add ie9 degradation", "params-to-init.php": "add required init params", "bc-access-rules-4.8.php": "BC for roles via filters >= VC 4.8", "post-type-default-template.php": "Load default templates", "bc-multisite-options.php": "BC for multisite options" } backend-editor-ie.php 0000666 00000000477 15214117146 0010541 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } function vc_add_ie9_degradation() { echo '<!--[if lte IE 9]><link rel="stylesheet" type="text/css" href="' . vc_asset_url( 'css/vc_lte_ie9.min.css' ) . '" media="screen"><![endif]-->'; } add_action( 'vc_backend_editor_footer_render', 'vc_add_ie9_degradation' ); class-vc-settings-presets.php 0000666 00000016522 15214117146 0012325 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Collection of static methods for work with settings presets * * @since 4.8 */ class Vc_Settings_Preset { /** * Get default preset id for specific shortcode * * @since 4.7 * * @param string $shortcode_name * * @return mixed int|null */ public static function getDefaultSettingsPresetId( $shortcode_name = null ) { if ( ! $shortcode_name ) { return null; } $args = array( 'post_type' => 'vc_settings_preset', 'post_mime_type' => self::constructShortcodeMimeType( $shortcode_name ), 'posts_per_page' => - 1, 'meta_key' => '_vc_default', 'meta_value' => true, ); $posts = get_posts( $args ); if ( $posts ) { $default_id = $posts[0]->ID; } else { // check for vendor presets $default_id = vc_vendor_preset()->getDefaultId( $shortcode_name ); } return $default_id; } /** * Set existing preset as default * * If this is vendor preset, clone it and set new one as default * * @param int $id If falsy, no default will be set * @param string $shortcode_name * * @return boolean * * @since 4.7 */ public static function setAsDefaultSettingsPreset( $id, $shortcode_name ) { $post_id = self::getDefaultSettingsPresetId( $shortcode_name ); if ( $post_id ) { delete_post_meta( $post_id, '_vc_default' ); } if ( $id ) { if ( is_numeric( $id ) ) { // user preset update_post_meta( $id, '_vc_default', true ); } else { // vendor preset $preset = vc_vendor_preset()->get( $id ); if ( ! $preset || $shortcode_name !== $preset['shortcode'] ) { return false; } self::saveSettingsPreset( $preset['shortcode'], $preset['title'], json_encode( $preset['params'] ), true ); } } return true; } /** * Get mime type for specific shortcode * * @since 4.7 * * @param $shortcode_name * * @return string */ public static function constructShortcodeMimeType( $shortcode_name ) { return 'vc-settings-preset/' . str_replace( '_', '-', $shortcode_name ); } /** * Get shortcode name from post's mime type * * @since 4.7 * * @param string $post_mime_type * * @return string */ public static function extractShortcodeMimeType( $post_mime_type ) { $chunks = explode( '/', $post_mime_type ); if ( 2 !== count( $chunks ) ) { return ''; } return str_replace( '-', '_', $chunks[1] ); } /** * Get all default presets * * @since 4.7 * * @return array E.g. array(shortcode_name => value, shortcode_name => value, ...) */ public static function listDefaultSettingsPresets() { $list = array(); $args = array( 'post_type' => 'vc_settings_preset', 'posts_per_page' => - 1, 'meta_key' => '_vc_default', 'meta_value' => true, ); // user presets $posts = get_posts( $args ); foreach ( $posts as $post ) { $shortcode_name = self::extractShortcodeMimeType( $post->post_mime_type ); $list[ $shortcode_name ] = (array) json_decode( $post->post_content ); } // vendor presets $presets = self::listDefaultVendorSettingsPresets(); foreach ( $presets as $shortcode => $params ) { if ( ! isset( $list[ $shortcode ] ) ) { $list[ $shortcode ] = $params; } } return $list; } /** * Get all default vendor presets * * @since 4.8 * * @return array E.g. array(shortcode_name => value, shortcode_name => value, ...) */ public static function listDefaultVendorSettingsPresets() { $list = array(); $presets = vc_vendor_preset()->getDefaults(); foreach ( $presets as $id => $preset ) { $list[ $preset['shortcode'] ] = $preset['params']; } return $list; } /** * Save shortcode preset * * @since 4.7 * * @param string $shortcode_name * @param string $title * @param string $content * @param boolean $is_default * * @return mixed int|false Post ID */ public static function saveSettingsPreset( $shortcode_name, $title, $content, $is_default = false ) { $post_id = wp_insert_post( array( 'post_title' => $title, 'post_content' => $content, 'post_status' => 'publish', 'post_type' => 'vc_settings_preset', 'post_mime_type' => self::constructShortcodeMimeType( $shortcode_name ), ), false ); if ( $post_id && $is_default ) { self::setAsDefaultSettingsPreset( $post_id, $shortcode_name ); } return $post_id; } /** * Get list of all presets for specific shortcode * * @since 4.7 * * @param string $shortcode_name * * @return array E.g. array(id1 => title1, id2 => title2, ...) */ public static function listSettingsPresets( $shortcode_name = null ) { $list = array(); if ( ! $shortcode_name ) { return $list; } $args = array( 'post_type' => 'vc_settings_preset', 'orderby' => array( 'post_date' => 'DESC' ), 'posts_per_page' => - 1, 'post_mime_type' => self::constructShortcodeMimeType( $shortcode_name ), ); $posts = get_posts( $args ); foreach ( $posts as $post ) { $list[ $post->ID ] = $post->post_title; } return $list; } /** * Get list of all vendor presets for specific shortcode * * @since 4.8 * * @param string $shortcode_name * * @return array E.g. array(id1 => title1, id2 => title2, ...) */ public static function listVendorSettingsPresets( $shortcode_name = null ) { $list = array(); if ( ! $shortcode_name ) { return $list; } $presets = vc_vendor_preset()->getAll( $shortcode_name ); foreach ( $presets as $id => $preset ) { $list[ $id ] = $preset['title']; } return $list; } /** * Get specific shortcode preset * * @since 4.7 * * @param mixed $id Can be int (user preset) or string (vendor preset) * @param bool $array If true, return array instead of string * * @return mixed string?array Post content */ public static function getSettingsPreset( $id, $array = false ) { if ( is_numeric( $id ) ) { // user preset $post = get_post( $id ); if ( ! $post ) { return false; } $params = $array ? (array) json_decode( $post->post_content ) : $post->post_content; } else { // vendor preset $preset = vc_vendor_preset()->get( $id ); if ( ! $preset ) { return false; } $params = $preset['params']; } return $params; } /** * Delete shortcode preset * * @since 4.7 * * @param int $post_id Post must be of type 'vc_settings_preset' * * @return bool */ public static function deleteSettingsPreset( $post_id ) { $post = get_post( $post_id ); if ( ! $post || 'vc_settings_preset' !== $post->post_type ) { return false; } return (bool) wp_delete_post( $post_id, true ); } /** * Return rendered popup menu * * @since 4.7 * * @param string $shortcode_name * * @return string */ public static function getRenderedSettingsPresetPopup( $shortcode_name ) { $list_vendor_presets = self::listVendorSettingsPresets( $shortcode_name ); $list_presets = self::listSettingsPresets( $shortcode_name ); $default_id = self::getDefaultSettingsPresetId( $shortcode_name ); if ( ! $default_id ) { $default_id = vc_vendor_preset()->getDefaultId( $shortcode_name ); } ob_start(); vc_include_template( apply_filters( 'vc_render_settings_preset_popup', 'editors/partials/settings_presets_popup.tpl.php' ), array( 'list_presets' => array( $list_presets, $list_vendor_presets, ), 'default_id' => $default_id, 'shortcode_name' => $shortcode_name, ) ); $html = ob_get_clean(); return $html; } } hook-vc-wp-text.php 0000666 00000000523 15214117146 0010237 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } if ( 'vc_edit_form' === vc_post_param( 'action' ) ) { VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Wp_Text' ); add_filter( 'vc_edit_form_fields_attributes_vc_wp_text', array( 'WPBakeryShortCode_VC_Wp_Text', 'convertTextAttributeToContent', ) ); } ui-vc-pointers.php 0000666 00000006020 15214117146 0010145 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } global $vc_default_pointers, $vc_pointers; $vc_default_pointers = (array) apply_filters( 'vc_pointers_list', array( 'vc_grid_item', 'vc_pointers_backend_editor', 'vc_pointers_frontend_editor', ) ); if ( is_admin() ) { add_action( 'admin_enqueue_scripts', 'vc_pointer_load', 1000 ); } function vc_pointer_load() { global $vc_pointers; // Don't run on WP < 3.3 if ( get_bloginfo( 'version' ) < '3.3' ) { return; } $screen = get_current_screen(); $screen_id = $screen->id; // Get pointers for this screen $pointers = apply_filters( 'vc-ui-pointers', array() ); $pointers = apply_filters( 'vc_ui-pointers-' . $screen_id, $pointers ); if ( ! $pointers || ! is_array( $pointers ) ) { return; } // Get dismissed pointers $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); $vc_pointers = array( 'pointers' => array() ); // Check pointers and remove dismissed ones. foreach ( $pointers as $pointer_id => $pointer ) { // Sanity check if ( in_array( $pointer_id, $dismissed ) || empty( $pointer ) || empty( $pointer_id ) || empty( $pointer['name'] ) ) { continue; } $pointer['pointer_id'] = $pointer_id; // Add the pointer to $valid_pointers array $vc_pointers['pointers'][] = $pointer; } // No valid pointers? Stop here. if ( empty( $vc_pointers['pointers'] ) ) { return; } wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'wp-pointer' ); // messages $vc_pointers['texts'] = array( 'finish' => __( 'Finish', 'js_composer' ), 'next' => __( 'Next', 'js_composer' ), 'prev' => __( 'Prev', 'js_composer' ), ); // Add pointer options to script. wp_localize_script( 'wp-pointer', 'vcPointer', $vc_pointers ); } /** * Remove Vc pointers keys to show Tour markers again. * @sine 4.5 */ function vc_pointer_reset() { global $vc_default_pointers; vc_user_access() ->checkAdminNonce() ->validateDie() ->wpAny( 'manage_options' ) ->validateDie() ->part( 'settings' ) ->can( 'vc-general-tab' ) ->validateDie(); $pointers = (array) apply_filters( 'vc_pointers_list', $vc_default_pointers ); $prev_meta_value = get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ); $dismissed = explode( ',', (string) $prev_meta_value ); if ( count( $dismissed ) > 0 && count( $pointers ) ) { $meta_value = implode( ',', array_diff( $dismissed, $pointers ) ); update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $meta_value, $prev_meta_value ); } wp_send_json( array( 'success' => true ) ); } /** * Reset tour guid * @return bool */ function vc_pointers_is_dismissed() { global $vc_default_pointers; $pointers = (array) apply_filters( 'vc_pointers_list', $vc_default_pointers ); $prev_meta_value = get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ); $dismissed = explode( ',', (string) $prev_meta_value ); return count( array_diff( $dismissed, $pointers ) ) < count( $dismissed ); } add_action( 'wp_ajax_vc_pointer_reset', 'vc_pointer_reset' ); class-vc-vendor-presets.php 0000666 00000004644 15214117146 0011764 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Singleton to hold all vendor presets * * @since 4.8 */ class Vc_Vendor_Preset { private static $_instance; private static $presets = array(); public static function getInstance() { if ( ! self::$_instance ) { self::$_instance = new self(); } return self::$_instance; } protected function __construct() { } /** * Add vendor preset to collection * * @since 4.8 * * @param string $title * @param string $shortcode * @param array $params * @param bool $default * * @return bool */ public function add( $title, $shortcode, $params, $default = false ) { if ( ! $title || ! is_string( $title ) || ! $shortcode || ! is_string( $shortcode ) || ! $params || ! is_array( $params ) ) { return false; } $preset = array( 'shortcode' => $shortcode, 'default' => $default, 'params' => $params, 'title' => $title, ); $id = md5( serialize( $preset ) ); self::$presets[ $id ] = $preset; return true; } /** * Get specific vendor preset * * @since 4.8 * * @param string $id * * @return mixed array|false */ public function get( $id ) { if ( isset( self::$presets[ $id ] ) ) { return self::$presets[ $id ]; } return false; } /** * Get all vendor presets for specific shortcode * * @since 4.8 * * @param string $shortcode * * @return array */ public function getAll( $shortcode ) { $list = array(); foreach ( self::$presets as $id => $preset ) { if ( $shortcode === $preset['shortcode'] ) { $list[ $id ] = $preset; } } return $list; } /** * Get all default vendor presets * * Include only one default preset per shortcode * * @since 4.8 * * @return array */ public function getDefaults() { $list = array(); $added = array(); foreach ( self::$presets as $id => $preset ) { if ( $preset['default'] && ! in_array( $preset['shortcode'], $added ) ) { $added[] = $preset['shortcode']; $list[ $id ] = $preset; } } return $list; } /** * Get ID of default preset for specific shortcode * * If multiple presets are default, return first * * @since 4.8 * * @param string $shortcode * * @return string|null */ public function getDefaultId( $shortcode ) { foreach ( self::$presets as $id => $preset ) { if ( $shortcode === $preset['shortcode'] && $preset['default'] ) { return $id; } } return null; } } vendors/qtranslate-x.php 0000666 00000001023 15214117146 0011362 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin qtranslate vendor. */ add_action( 'plugins_loaded', 'vc_init_vendor_qtranslatex' ); function vc_init_vendor_qtranslatex() { if ( defined( 'QTX_VERSION' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-qtranslate-x.php' ); $vendor = new Vc_Vendor_QtranslateX(); add_action( 'vc_after_set_mode', array( $vendor, 'load', ) ); } } vendors/acf.php 0000666 00000002021 15214117146 0007467 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize advanced custom fields vendor. */ add_action( 'acf/init', 'vc_init_vendor_acf' ); // pro version add_action( 'acf/register_fields', 'vc_init_vendor_acf' ); // free version add_action( 'plugins_loaded', 'vc_init_vendor_acf' ); add_action( 'after_setup_theme', 'vc_init_vendor_acf' ); // for themes function vc_init_vendor_acf() { if ( did_action( 'vc-vendor-acf-load' ) ) { return; } include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( class_exists( 'acf' ) || is_plugin_active( 'advanced-custom-fields/acf.php' ) || is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-advanced-custom-fields.php' ); $vendor = new Vc_Vendor_AdvancedCustomFields(); add_action( 'vc_after_set_mode', array( $vendor, 'load', ) ); } } vendors/qtranslate.php 0000666 00000001276 15214117146 0011127 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin qtranslate vendor. */ add_action( 'plugins_loaded', 'vc_init_vendor_qtranslate' ); function vc_init_vendor_qtranslate() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( is_plugin_active( 'qtranslate/qtranslate.php' ) || defined( 'QT_SUPPORTED_WP_VERSION' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-qtranslate.php' ); $vendor = new Vc_Vendor_Qtranslate(); add_action( 'vc_after_set_mode', array( $vendor, 'load', ) ); } } vendors/layerslider.php 0000666 00000001245 15214117146 0011264 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin layerslider vendor. */ add_action( 'plugins_loaded', 'vc_init_vendor_layerslider' ); function vc_init_vendor_layerslider() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( is_plugin_active( 'LayerSlider/layerslider.php' ) || class_exists( 'LS_Sliders' ) || defined( 'LS_ROOT_PATH' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-layerslider.php' ); $vendor = new Vc_Vendor_Layerslider(); $vendor->load(); } } vendors/woocommerce.php 0000666 00000003645 15214117146 0011272 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Add script for grid item add to card link * * @since 4.5 */ function vc_woocommerce_add_to_cart_script() { wp_enqueue_script( 'vc_woocommerce-add-to-cart-js', vc_asset_url( 'js/vendors/woocommerce-add-to-cart.js' ), array( 'wc-add-to-cart' ), WPB_VC_VERSION ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin WooCommerce vendor. (adds tons of WooCommerce shortcodes and some fixes) */ add_action( 'plugins_loaded', 'vc_init_vendor_woocommerce' ); function vc_init_vendor_woocommerce() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( is_plugin_active( 'woocommerce/woocommerce.php' ) || class_exists( 'WooCommerce' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-woocommerce.php' ); $vendor = new Vc_Vendor_Woocommerce(); add_action( 'vc_after_set_mode', array( $vendor, 'load', ) ); require_once vc_path_dir( 'VENDORS_DIR', 'plugins/woocommerce/grid-item-filters.php' ); // Add 'add to card' link to the list of Add link. add_filter( 'vc_gitem_add_link_param', 'vc_gitem_add_link_param_woocommerce' ); // Filter to add link attributes for grid element shortcode. add_filter( 'vc_gitem_post_data_get_link_link', 'vc_gitem_post_data_get_link_link_woocommerce', 10, 3 ); add_filter( 'vc_gitem_post_data_get_link_target', 'vc_gitem_post_data_get_link_target_woocommerce', 12, 2 ); add_filter( 'vc_gitem_post_data_get_link_real_link', 'vc_gitem_post_data_get_link_real_link_woocommerce', 10, 4 ); add_filter( 'vc_gitem_post_data_get_link_real_target', 'vc_gitem_post_data_get_link_real_target_woocommerce', 12, 3 ); add_filter( 'vc_gitem_zone_image_block_link', 'vc_gitem_zone_image_block_link_woocommerce', 10, 3 ); add_action( 'wp_enqueue_scripts', 'vc_woocommerce_add_to_cart_script' ); } } vendors/gravity_forms.php 0000666 00000006504 15214117146 0011643 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to add gravity forms shortcode into visual composer */ add_action( 'plugins_loaded', 'vc_init_vendor_gravity_forms' ); function vc_init_vendor_gravity_forms() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( is_plugin_active( 'gravityforms/gravityforms.php' ) || class_exists( 'RGForms' ) || class_exists( 'RGFormsModel' ) ) { // Call on map add_action( 'vc_after_init', 'vc_vendor_gravityforms_load' ); } // if gravityforms active } function vc_vendor_gravityforms_load() { $gravity_forms_array[ __( 'No Gravity forms found.', 'js_composer' ) ] = ''; if ( class_exists( 'RGFormsModel' ) ) { $gravity_forms = RGFormsModel::get_forms( 1, 'title' ); if ( $gravity_forms ) { $gravity_forms_array = array( __( 'Select a form to display.', 'js_composer' ) => '' ); foreach ( $gravity_forms as $gravity_form ) { $gravity_forms_array[ $gravity_form->title ] = $gravity_form->id; } } } vc_map( array( 'name' => __( 'Gravity Form', 'js_composer' ), 'base' => 'gravityform', 'icon' => 'icon-wpb-vc_gravityform', 'category' => __( 'Content', 'js_composer' ), 'description' => __( 'Place Gravity form', 'js_composer' ), 'params' => array( array( 'type' => 'dropdown', 'heading' => __( 'Form', 'js_composer' ), 'param_name' => 'id', 'value' => $gravity_forms_array, 'save_always' => true, 'description' => __( 'Select a form to add it to your post or page.', 'js_composer' ), 'admin_label' => true, ), array( 'type' => 'dropdown', 'heading' => __( 'Display Form Title', 'js_composer' ), 'param_name' => 'title', 'value' => array( __( 'No', 'js_composer' ) => 'false', __( 'Yes', 'js_composer' ) => 'true', ), 'save_always' => true, 'description' => __( 'Would you like to display the forms title?', 'js_composer' ), 'dependency' => array( 'element' => 'id', 'not_empty' => true, ), ), array( 'type' => 'dropdown', 'heading' => __( 'Display Form Description', 'js_composer' ), 'param_name' => 'description', 'value' => array( __( 'No', 'js_composer' ) => 'false', __( 'Yes', 'js_composer' ) => 'true', ), 'save_always' => true, 'description' => __( 'Would you like to display the forms description?', 'js_composer' ), 'dependency' => array( 'element' => 'id', 'not_empty' => true, ), ), array( 'type' => 'dropdown', 'heading' => __( 'Enable AJAX?', 'js_composer' ), 'param_name' => 'ajax', 'value' => array( __( 'No', 'js_composer' ) => 'false', __( 'Yes', 'js_composer' ) => 'true', ), 'save_always' => true, 'description' => __( 'Enable AJAX submission?', 'js_composer' ), 'dependency' => array( 'element' => 'id', 'not_empty' => true, ), ), array( 'type' => 'textfield', 'heading' => __( 'Tab Index', 'js_composer' ), 'param_name' => 'tabindex', 'description' => __( '(Optional) Specify the starting tab index for the fields of this form. Leave blank if you\'re not sure what this is.', 'js_composer' ), 'dependency' => array( 'element' => 'id', 'not_empty' => true, ), ), ), ) ); } vendors/cf7.php 0000666 00000001415 15214117146 0007423 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin contact form 7 vendor - fix load cf7 shortcode when in editor (frontend) */ add_action( 'plugins_loaded', 'vc_init_vendor_cf7' ); function vc_init_vendor_cf7() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) || defined( 'WPCF7_PLUGIN' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-contact-form7.php' ); $vendor = new Vc_Vendor_ContactForm7(); add_action( 'vc_after_set_mode', array( $vendor, 'load', ) ); } // if contact form7 plugin active } vendors/yoast_seo.php 0000666 00000002236 15214117146 0010753 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin yoast vendor. */ // 16 is required to be called after WPSEO_Admin_Init constructor. @since 4.9 add_action( 'plugins_loaded', 'vc_init_vendor_yoast', 16 ); // add_action( 'plugins_loaded', 'vc_init_vendor_yoast_reset_page_now', 16 ); function vc_init_vendor_yoast() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) || class_exists( 'WPSEO_Metabox' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-yoast_seo.php' ); $vendor = new Vc_Vendor_YoastSeo(); if ( defined( 'WPSEO_VERSION' ) && version_compare( WPSEO_VERSION, '3.0.0' ) === - 1 ) { add_action( 'vc_after_set_mode', array( $vendor, 'load', ) ); } elseif ( is_admin() && 'vc_inline' === vc_action() ) { // $GLOBALS['pagenow'] = 'post.php?vc_action=vc_inline'; $vendor->frontendEditorBuild(); } } } /*function vc_init_vendor_yoast_reset_page_now() { $GLOBALS['pagenow'] = 'post.php'; }*/ vendors/wp_customize.php 0000666 00000001363 15214117146 0011476 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. */ // Remove scripts from the Visual Composer while in the Customizer = Temp Fix // Actually we need to check if this is really needed in 4.4 uncomment if you have customizer issues // But this actually will break any VC js in Customizer preview. // removed by fixing vcTabsBevahiour in js_composer_front.js /* if ( ! function_exists( 'vc_wpex_remove_vc_scripts' ) ) { function vc_wpex_remove_vc_scripts() { if ( is_customize_preview() ) { wp_deregister_script( 'wpb_composer_front_js' ); wp_dequeue_script( 'wpb_composer_front_js' ); } } }*/ //add_action( 'wp_enqueue_scripts', 'vc_wpex_remove_vc_scripts' ); vendors/revslider.php 0000666 00000001171 15214117146 0010742 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin revslider vendor. */ add_action( 'plugins_loaded', 'vc_init_vendor_revslider' ); function vc_init_vendor_revslider() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( is_plugin_active( 'revslider/revslider.php' ) || class_exists( 'RevSlider' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-revslider.php' ); $vendor = new Vc_Vendor_Revslider(); $vendor->load(); } } vendors/wpml.php 0000666 00000000574 15214117146 0007730 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } add_action( 'plugins_loaded', 'vc_init_vendor_wpml' ); function vc_init_vendor_wpml() { if ( defined( 'ICL_SITEPRESS_VERSION' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-wpml.php' ); $vendor = new Vc_Vendor_WPML(); add_action( 'vc_after_set_mode', array( $vendor, 'load', ) ); } } vendors/jwplayer.php 0000666 00000001110 15214117146 0010571 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin jwplayer vendor for frontend editor. */ add_action( 'plugins_loaded', 'vc_init_vendor_jwplayer' ); function vc_init_vendor_jwplayer() { if ( is_plugin_active( 'jw-player-plugin-for-wordpress/jwplayermodule.php' ) || defined( 'JWP6' ) || class_exists( 'JWP6_Plugin' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-jwplayer.php' ); $vendor = new Vc_Vendor_Jwplayer(); $vendor->load(); } } vendors/ninja_forms.php 0000666 00000001355 15214117146 0011254 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin ninja forms vendor */ add_action( 'plugins_loaded', 'vc_init_vendor_ninja_forms' ); function vc_init_vendor_ninja_forms() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( is_plugin_active( 'ninja-forms/ninja-forms.php' ) || defined( 'NINJA_FORMS_DIR' ) || function_exists( 'ninja_forms_get_all_forms' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-ninja-forms.php' ); $vendor = new Vc_Vendor_NinjaForms(); add_action( 'vc_after_set_mode', array( $vendor, 'load', ) ); } } vendors/mqtranslate.php 0000666 00000001321 15214117146 0011273 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.4 vendors initialization moved to hooks in autoload/vendors. * * Used to initialize plugin mqtranslate vendor */ add_action( 'plugins_loaded', 'vc_init_vendor_mqtranslate' ); function vc_init_vendor_mqtranslate() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require plugin.php to use is_plugin_active() below if ( is_plugin_active( 'mqtranslate/mqtranslate.php' ) || function_exists( 'mqtranslate_activation_check' ) ) { require_once vc_path_dir( 'VENDORS_DIR', 'plugins/class-vc-vendor-mqtranslate.php' ); $vendor = new Vc_Vendor_Mqtranslate(); add_action( 'vc_after_set_mode', array( $vendor, 'load', ) ); } } params/hidden.php 0000666 00000000717 15214117146 0010006 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * required hooks for hidden field. * @since 4.5 */ require_once vc_path_dir( 'PARAMS_DIR', 'hidden/hidden.php' ); vc_add_shortcode_param( 'hidden', 'vc_hidden_form_field' ); add_filter( 'vc_edit_form_fields_render_field_hidden_before', 'vc_edit_form_fields_render_field_hidden_before' ); add_filter( 'vc_edit_form_fields_render_field_hidden_after', 'vc_edit_form_fields_render_field_hidden_after' ); params/vc_grid_item.php 0000666 00000014675 15214117146 0011216 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } function vc_vc_grid_item_form_field( $settings, $value ) { require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php' ); require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' ); $output = '<div data-vc-grid-element="container">' . '<select data-vc-grid-element="value" type="hidden" name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-select ' . $settings['param_name'] . ' ' . $settings['type'] . '_field" ' . '>'; $vc_grid_item_templates = Vc_Grid_Item::predefinedTemplates(); if ( is_array( $vc_grid_item_templates ) ) { foreach ( $vc_grid_item_templates as $key => $data ) { $output .= '<option data-vc-link="' . esc_url( admin_url( 'post-new.php?post_type=vc_grid_item&vc_gitem_template=' . $key ) ) . '" value="' . $key . '"' . ( $key === $value ? ' selected="true"' : '' ) . '>' . esc_html( $data['name'] ) . '</option>'; } } $grid_item_posts = get_posts( array( 'posts_per_page' => '-1', 'orderby' => 'post_title', 'post_type' => Vc_Grid_Item_Editor::postType(), ) ); foreach ( $grid_item_posts as $post ) { $output .= '<option data-vc-link="' . esc_url( get_edit_post_link( $post->ID ) ) . '"value="' . $post->ID . '"' . ( (string) $post->ID === $value ? ' selected="true"' : '' ) . '>' . esc_html( $post->post_title ) . '</option>'; } $output .= '</select></div>'; return $output; } function vc_load_vc_grid_item_param() { vc_add_shortcode_param( 'vc_grid_item', 'vc_vc_grid_item_form_field' ); } add_action( 'vc_load_default_params', 'vc_load_vc_grid_item_param' ); function vc_gitem_post_data_get_link_target_frontend_editor( $target ) { return ' target="_blank"'; } function vc_gitem_post_data_get_link_rel_frontend_editor( $rel ) { return ' rel="' . $rel . '"'; } function vc_gitem_create_link( $atts, $default_class = '', $title = '' ) { $link = ''; $target = ''; $rel = ''; $title_attr = ''; $css_class = 'vc_gitem-link' . ( strlen( $default_class ) > 0 ? ' ' . $default_class : '' ); if ( isset( $atts['link'] ) ) { if ( 'custom' === $atts['link'] && ! empty( $atts['url'] ) ) { $link = vc_build_link( $atts['url'] ); if ( strlen( $link['target'] ) ) { $target = ' target="' . esc_attr( $link['target'] ) . '"'; } if ( strlen( $link['rel'] ) ) { $rel = ' rel="' . esc_attr( $link['rel'] ) . '"'; } if ( strlen( $link['title'] ) ) { $title = $link['title']; } $link = 'a href="' . esc_attr( $link['url'] ) . '" class="' . esc_attr( $css_class ) . '"'; } elseif ( 'post_link' === $atts['link'] ) { $link = 'a href="{{ post_link_url }}" class="' . esc_attr( $css_class ) . '"'; if ( ! strlen( $title ) ) { $title = '{{ post_title }}'; } } elseif ( 'post_author' === $atts['link'] ) { $link = 'a href="{{ post_author_href }}" class="' . esc_attr( $css_class ) . '"'; if ( ! strlen( $title ) ) { $title = '{{ post_author }}'; } } elseif ( 'image' === $atts['link'] ) { $link = 'a{{ post_image_url_href }} class="' . esc_attr( $css_class ) . '"'; } elseif ( 'image_lightbox' === $atts['link'] ) { $link = 'a{{ post_image_url_attr_prettyphoto:' . $css_class . ' }}'; } } if ( strlen( $title ) > 0 ) { $title_attr = ' title="' . esc_attr( $title ) . '"'; } return apply_filters( 'vc_gitem_post_data_get_link_link', $link, $atts, $css_class ) . apply_filters( 'vc_gitem_post_data_get_link_target', $target, $atts ) . apply_filters( 'vc_gitem_post_data_get_link_rel', $rel, $atts ) . apply_filters( 'vc_gitem_post_data_get_link_title', $title_attr, $atts ); } function vc_gitem_create_link_real( $atts, $post, $default_class = '', $title = '' ) { $link = ''; $target = ''; $rel = ''; $title_attr = ''; $link_css_class = 'vc_gitem-link'; if ( isset( $atts['link'] ) ) { $link_css_class = 'vc_gitem-link' . ( strlen( $default_class ) > 0 ? ' ' . $default_class : '' ); if ( strlen( $atts['el_class'] ) > 0 ) { $link_css_class .= $atts['el_class']; } if ( 'custom' === $atts['link'] && ! empty( $atts['url'] ) ) { $link = vc_build_link( $atts['url'] ); if ( strlen( $link['target'] ) ) { $target = ' target="' . esc_attr( $link['target'] ) . '"'; } if ( strlen( $link['rel'] ) ) { $rel = ' rel="' . esc_attr( $link['rel'] ) . '"'; } if ( strlen( $link['title'] ) ) { $title = $link['title']; } $link = 'a href="' . esc_attr( $link['url'] ) . '" class="' . esc_attr( $link_css_class ) . '"'; } elseif ( 'post_link' === $atts['link'] ) { $link = 'a href="' . get_permalink( $post->ID ) . '" class="' . esc_attr( $link_css_class ) . '"'; if ( ! strlen( $title ) ) { $title = the_title( '', '', false ); } } elseif ( 'image' === $atts['link'] ) { $href_link = vc_gitem_template_attribute_post_image_url( '', array( 'post' => $post, 'data' => '' ) ); $link = 'a href="' . $href_link . '" class="' . esc_attr( $link_css_class ) . '"'; } elseif ( 'image_lightbox' === $atts['link'] ) { $link = 'a' . vc_gitem_template_attribute_post_image_url_attr_prettyphoto( '', array( 'post' => $post, 'data' => esc_attr( $link_css_class ), ) ); } } if ( strlen( $title ) > 0 ) { $title_attr = ' title="' . esc_attr( $title ) . '"'; } return apply_filters( 'vc_gitem_post_data_get_link_real_link', $link, $atts, $post, $link_css_class ) . apply_filters( 'vc_gitem_post_data_get_link_real_target', $target, $atts, $post ) . apply_filters( 'vc_gitem_post_data_get_link_real_rel', $rel, $atts, $post ) . apply_filters( 'vc_gitem_post_data_get_link_real_title', $title_attr, $atts ); } function vc_gitem_post_data_get_link_link_frontend_editor( $link ) { return empty( $link ) ? 'a' : $link; } if ( vc_is_page_editable() ) { add_filter( 'vc_gitem_post_data_get_link_link', 'vc_gitem_post_data_get_link_link_frontend_editor' ); add_filter( 'vc_gitem_post_data_get_link_real_link', 'vc_gitem_post_data_get_link_link_frontend_editor' ); add_filter( 'vc_gitem_post_data_get_link_target', 'vc_gitem_post_data_get_link_target_frontend_editor' ); add_filter( 'vc_gitem_post_data_get_link_rel', 'vc_gitem_post_data_get_link_rel_frontend_editor' ); add_filter( 'vc_gitem_post_data_get_link_real_target', 'vc_gitem_post_data_get_link_target_frontend_editor' ); add_filter( 'vc_gitem_post_data_get_link_real_rel', 'vc_gitem_post_data_get_link_rel_frontend_editor' ); } hook-vc-iconpicker-param.php 0000666 00000010137 15214117146 0012055 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /*** * @since 4.4 * Hook Vc-Iconpicker-Param.php * * Adds actions and filters for iconpicker param. * Used to: * - register/enqueue icons fonts for admin pages * - register/enqueue js for iconpicker param * - register/enqueue css for iconpicker param */ // @see Vc_Base::frontCss, used to append actions when frontCss(frontend editor/and real view mode) method called // This action registers all styles(fonts) to be enqueue later add_action( 'vc_base_register_front_css', 'vc_iconpicker_base_register_css' ); // @see Vc_Base::registerAdminCss, used to append action when registerAdminCss(backend editor) method called // This action registers all styles(fonts) to be enqueue later add_action( 'vc_base_register_admin_css', 'vc_iconpicker_base_register_css' ); // @see Vc_Base::registerAdminJavascript, used to append action when registerAdminJavascript(backend/frontend editor) method called // This action will register needed js file, and also you can use it for localizing js. add_action( 'vc_base_register_admin_js', 'vc_iconpicker_base_register_js' ); // @see Vc_Backend_Editor::printScriptsMessages (wp-content/plugins/js_composer/include/classes/editors/class-vc-backend-editor.php), // used to enqueue needed js/css files when backend editor is rendering add_action( 'vc_backend_editor_enqueue_js_css', 'vc_iconpicker_editor_jscss' ); // @see Vc_Frontend_Editor::enqueueAdmin (wp-content/plugins/js_composer/include/classes/editors/class-vc-frontend-editor.php), // used to enqueue needed js/css files when frontend editor is rendering add_action( 'vc_frontend_editor_enqueue_js_css', 'vc_iconpicker_editor_jscss' ); /** * This action registers all styles(fonts) to be enqueue later * @see filter 'vc_base_register_front_css' - preview/frontend-editor * filter 'vc_base_register_admin_css' - backend editor * * @since 4.4 */ function vc_iconpicker_base_register_css() { // Vc Icon picker fonts: wp_register_style( 'font-awesome', vc_asset_url( 'lib/bower/font-awesome/css/font-awesome.min.css' ), array(), WPB_VC_VERSION ); wp_register_style( 'vc_typicons', vc_asset_url( 'css/lib/typicons/src/font/typicons.min.css' ), false, WPB_VC_VERSION ); wp_register_style( 'vc_openiconic', vc_asset_url( 'css/lib/vc-open-iconic/vc_openiconic.min.css' ), false, WPB_VC_VERSION ); wp_register_style( 'vc_linecons', vc_asset_url( 'css/lib/vc-linecons/vc_linecons_icons.min.css' ), false, WPB_VC_VERSION ); wp_register_style( 'vc_entypo', vc_asset_url( 'css/lib/vc-entypo/vc_entypo.min.css' ), false, WPB_VC_VERSION ); wp_register_style( 'vc_monosocialiconsfont', vc_asset_url( 'css/lib/monosocialiconsfont/monosocialiconsfont.min.css' ), false, WPB_VC_VERSION ); wp_register_style( 'vc_material', vc_asset_url( 'css/lib/vc-material/vc_material.min.css' ), false, WPB_VC_VERSION ); // Theme wp_register_style( 'vc-icon-picker-main-css', vc_asset_url( 'lib/bower/vcIconPicker/css/jquery.fonticonpicker.min.css' ), false, WPB_VC_VERSION ); wp_register_style( 'vc-icon-picker-main-css-theme', vc_asset_url( 'lib/bower/vcIconPicker/themes/grey-theme/jquery.fonticonpicker.vcgrey.min.css' ), false, WPB_VC_VERSION ); } /** * Register admin js for iconpicker functionality * * @since 4.4 */ function vc_iconpicker_base_register_js() { wp_register_script( 'vc-icon-picker', vc_asset_url( 'lib/bower/vcIconPicker/jquery.fonticonpicker.min.js' ), array( 'jquery' ), WPB_VC_VERSION ); } /** * Enqueue ALL fonts/styles for Editor(admin) mode. (to allow easy change icons) * - To append your icons fonts add action: * vc_backend_editor_enqueue_jscss and vc_frontend_editor_enqueue_jscss * * @since 4.4 */ function vc_iconpicker_editor_jscss() { // Enqueue js and theme css files wp_enqueue_script( 'vc-icon-picker' ); wp_enqueue_style( 'vc-icon-picker-main-css' ); wp_enqueue_style( 'vc-icon-picker-main-css-theme' ); // Fonts wp_enqueue_style( 'font-awesome' ); wp_enqueue_style( 'vc_openiconic' ); wp_enqueue_style( 'vc_typicons' ); wp_enqueue_style( 'vc_entypo' ); wp_enqueue_style( 'vc_linecons' ); wp_enqueue_style( 'vc_monosocialiconsfont' ); wp_enqueue_style( 'vc_material' ); } vc-single-image.php 0000666 00000001475 15214117146 0010241 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } if ( 'vc_edit_form' === vc_post_param( 'action' ) ) { add_filter( 'vc_edit_form_fields_attributes_vc_single_image', 'vc_single_image_convert_old_link_to_new' ); } /** * Backward compatibility * * @since 4.6 * @param $atts * @return mixed */ function vc_single_image_convert_old_link_to_new( $atts ) { if ( empty( $atts['onclick'] ) && isset( $atts['img_link_large'] ) && 'yes' === $atts['img_link_large'] ) { $atts['onclick'] = 'img_link_large'; unset( $atts['img_link_large'] ); } elseif ( empty( $atts['onclick'] ) && ( ! isset( $atts['img_link_large'] ) || 'yes' !== $atts['img_link_large'] ) ) { unset( $atts['img_link_large'] ); } if ( empty( $atts['onclick'] ) && ! empty( $atts['link'] ) ) { $atts['onclick'] = 'custom_link'; } return $atts; } hook-vc-progress-bar.php 0000666 00000000575 15214117146 0011244 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } if ( 'vc_edit_form' === vc_post_param( 'action' ) ) { VcShortcodeAutoloader::getInstance() ->includeClass( 'WPBakeryShortCode_VC_Progress_Bar' ); add_filter( 'vc_edit_form_fields_attributes_vc_progress_bar', array( 'WPBakeryShortCode_VC_Progress_Bar', 'convertAttributesToNewProgressBar', ) ); } hook-vc-grid.php 0000666 00000022045 15214117146 0007557 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Class Vc_Hooks_Vc_Grid * @since 4.4 */ class Vc_Hooks_Vc_Grid implements Vc_Vendor_Interface { protected $grid_id_unique_name = 'vc_gid'; // if you change this also change in vc-basic-grid.php /** * Initializing hooks for grid element, * Add actions to save appended shortcodes to post meta (for rendering in preview with shortcode id) * And add action to hook request for grid data, to output it. * @since 4.4 */ public function load() { // Hook for set post settings meta with shortcodes data /** * @since 4.4.3 */ add_filter( 'vc_hooks_vc_post_settings', array( &$this, 'gridSavePostSettingsId', ), 10, 3 ); /** * Used to output shortcode data for ajax request. called on any page request. */ add_action( 'wp_ajax_vc_get_vc_grid_data', array( &$this, 'getGridDataForAjax', ) ); add_action( 'wp_ajax_nopriv_vc_get_vc_grid_data', array( &$this, 'getGridDataForAjax', ) ); } /** * @since 4.4 * @deprecated and should not be used and will be removed in future! since 4.4.3 * @return string */ private function getShortcodeRegexForHash() { // _deprecated_function( 'Vc_Hooks_Vc_Grid: getShortcodeRegexForHash method', '4.4.3', 'getShortcodeRegexForId' ); $tagnames = apply_filters( 'vc_grid_shortcodes_tags', array( 'vc_basic_grid', 'vc_masonry_grid', 'vc_media_grid', 'vc_masonry_media_grid', ) ); // return only grid shortcodes $tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) ); // WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag() // Also, see shortcode_unautop() and shortcode.js. return '\\[' // Opening bracket . '(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]] . "($tagregexp)" // 2: Shortcode name . '(?![\\w-])' // Not followed by word character or hyphen . '(' // 3: Unroll the loop: Inside the opening shortcode tag . '[^\\]\\/]*' // Not a closing bracket or forward slash . '(?:' . '\\/(?!\\])' // A forward slash not followed by a closing bracket . '[^\\]\\/]*' // Not a closing bracket or forward slash . ')*?' . ')' . '(?:' . '(\\/)' // 4: Self closing tag ... . '\\]' // ... and closing bracket . '|' . '\\]' // Closing bracket . '(?:' . '(' // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags . '[^\\[]*+' // Not an opening bracket . '(?:' . '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag . '[^\\[]*+' // Not an opening bracket . ')*+' . ')' . '\\[\\/\\2\\]' // Closing shortcode tag . ')?' . ')' . '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]] } /** * @since 4.4.3 * @return string */ private function getShortcodeRegexForId() { return '\\[' // Opening bracket . '(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]] . '([\\w-_]+)' // 2: Shortcode name . '(?![\\w-])' // Not followed by word character or hyphen . '(' // 3: Unroll the loop: Inside the opening shortcode tag . '[^\\]\\/]*' // Not a closing bracket or forward slash . '(?:' . '\\/(?!\\])' // A forward slash not followed by a closing bracket . '[^\\]\\/]*' // Not a closing bracket or forward slash . ')*?' . '(?:' . '(' . $this->grid_id_unique_name // 4: GridId must exist . '[^\\]\\/]*' // Not a closing bracket or forward slash . ')+' . ')' . ')' . '(?:' . '(\\/)' // 5: Self closing tag ... . '\\]' // ... and closing bracket . '|' . '\\]' // Closing bracket . '(?:' . '(' // 6: Unroll the loop: Optionally, anything between the opening and closing shortcode tags . '[^\\[]*+' // Not an opening bracket . '(?:' . '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag . '[^\\[]*+' // Not an opening bracket . ')*+' . ')' . '\\[\\/\\2\\]' // Closing shortcode tag . ')?' . ')' . '(\\]?)'; // 7: Optional second closing brocket for escaping shortcodes: [[tag]] } /** * Set page meta box values with vc_adv_pager shortcodes data * @since 4.4 * @deprecated 4.4.3 * * @param array $settings * @param $post_id * @param $post * * @return array - shortcode settings to save. */ public function gridSavePostSettings( array $settings, $post_id, $post ) { // _deprecated_function( 'Vc_Hooks_Vc_Grid: gridSavePostSettings method', '4.4.3 (will be removed in 4.10)', 'gridSavePostSettingsId' ); $pattern = $this->getShortcodeRegexForHash(); preg_match_all( "/$pattern/", $post->post_content, $found ); // fetch only needed shortcodes $settings['vc_grid'] = array(); if ( is_array( $found ) && ! empty( $found[0] ) ) { $to_save = array(); if ( isset( $found[3] ) && is_array( $found[3] ) ) { foreach ( $found[3] as $key => $shortcode_atts ) { if ( false !== strpos( $shortcode_atts, 'vc_gid:' ) ) { continue; } $atts = shortcode_parse_atts( $shortcode_atts ); $data = array( 'tag' => $found[2][ $key ], 'atts' => $atts, 'content' => $found[5][ $key ], ); $hash = sha1( serialize( $data ) ); $to_save[ $hash ] = $data; } } if ( ! empty( $to_save ) ) { $settings['vc_grid'] = array( 'shortcodes' => $to_save ); } } return $settings; } /** * @since 4.4.3 * * @param array $settings * @param $post_id * @param $post * * @return array */ public function gridSavePostSettingsId( array $settings, $post_id, $post ) { $pattern = $this->getShortcodeRegexForId(); preg_match_all( "/$pattern/", $post->post_content, $found ); // fetch only needed shortcodes $settings['vc_grid_id'] = array(); if ( is_array( $found ) && ! empty( $found[0] ) ) { $to_save = array(); if ( isset( $found[1] ) && is_array( $found[1] ) ) { foreach ( $found[1] as $key => $parse_able ) { if ( empty( $parse_able ) || '[' !== $parse_able ) { $id_pattern = '/' . $this->grid_id_unique_name . '\:([\w-_]+)/'; $id_value = $found[4][ $key ]; preg_match( $id_pattern, $id_value, $id_matches ); if ( ! empty( $id_matches ) ) { $id_to_save = $id_matches[1]; // why we need to check if shortcode is parse able? // 1: if it is escaped it must not be displayed (parsed) // 2: so if 1 is true it must not be saved in database meta $shortcode_tag = $found[2][ $key ]; $shortcode_atts_string = $found[3][ $key ]; /** @var $atts array */ $atts = shortcode_parse_atts( $shortcode_atts_string ); $content = $found[6][ $key ]; $data = array( 'tag' => $shortcode_tag, 'atts' => $atts, 'content' => $content, ); $to_save[ $id_to_save ] = $data; } } } } if ( ! empty( $to_save ) ) { $settings['vc_grid_id'] = array( 'shortcodes' => $to_save ); } } return $settings; } /** * @since 4.4 * * @output/@return string - grid data for ajax request. */ public function getGridDataForAjax() { $tag = vc_request_param( 'tag' ); $allowed = apply_filters( 'vc_grid_get_grid_data_access', vc_verify_public_nonce() && $tag, $tag ); if ( $allowed ) { $shortcode_fishbone = visual_composer()->getShortCode( $tag ); if ( is_object( $shortcode_fishbone ) ) { /** @var $vc_grid WPBakeryShortcode_Vc_Basic_Grid */ $vc_grid = $shortcode_fishbone->shortcodeClass(); if ( method_exists( $vc_grid, 'isObjectPageable' ) && $vc_grid->isObjectPageable() && method_exists( $vc_grid, 'renderAjax' ) ) { echo $vc_grid->renderAjax( vc_request_param( 'data' ) ); die(); } } } } } /** * @since 4.4 * @var Vc_Hooks_Vc_Grid $hook */ $hook = new Vc_Hooks_Vc_Grid(); // when visual composer initialized let's trigger Vc_Grid hooks. add_action( 'vc_after_init', array( $hook, 'load', ) ); if ( 'vc_edit_form' === vc_post_param( 'action' ) ) { VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Basic_Grid' ); add_filter( 'vc_edit_form_fields_attributes_vc_basic_grid', array( 'WPBakeryShortCode_VC_Basic_Grid', 'convertButton2ToButton3', ) ); add_filter( 'vc_edit_form_fields_attributes_vc_media_grid', array( 'WPBakeryShortCode_VC_Basic_Grid', 'convertButton2ToButton3', ) ); add_filter( 'vc_edit_form_fields_attributes_vc_masonry_grid', array( 'WPBakeryShortCode_VC_Basic_Grid', 'convertButton2ToButton3', ) ); add_filter( 'vc_edit_form_fields_attributes_vc_masonry_media_grid', array( 'WPBakeryShortCode_VC_Basic_Grid', 'convertButton2ToButton3', ) ); } vc-settings-presets.php 0000666 00000015141 15214117146 0011216 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } add_action( 'wp_ajax_vc_action_save_settings_preset', 'vc_action_save_settings_preset' ); add_action( 'wp_ajax_vc_action_set_as_default_settings_preset', 'vc_action_set_as_default_settings_preset' ); add_action( 'wp_ajax_vc_action_delete_settings_preset', 'vc_action_delete_settings_preset' ); add_action( 'wp_ajax_vc_action_restore_default_settings_preset', 'vc_action_restore_default_settings_preset' ); add_action( 'wp_ajax_vc_action_get_settings_preset', 'vc_action_get_settings_preset' ); add_action( 'wp_ajax_vc_action_render_settings_preset_popup', 'vc_action_render_settings_preset_popup' ); add_action( 'wp_ajax_vc_action_render_settings_preset_title_prompt', 'vc_action_render_settings_preset_title_prompt' ); add_action( 'wp_ajax_vc_action_render_settings_templates_prompt', 'vc_action_render_settings_templates_prompt' ); add_action( 'vc_restore_default_settings_preset', 'vc_action_set_as_default_settings_preset', 10, 2 ); add_action( 'vc_register_settings_preset', 'vc_register_settings_preset', 10, 4 ); function vc_include_settings_preset_class() { vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie()->part( 'presets' )->can()->validateDie(); require_once vc_path_dir( 'AUTOLOAD_DIR', 'class-vc-settings-presets.php' ); } /** * @return Vc_Vendor_Preset */ function vc_vendor_preset() { require_once vc_path_dir( 'AUTOLOAD_DIR', 'class-vc-vendor-presets.php' ); return Vc_Vendor_Preset::getInstance(); } /** * Save settings preset for specific shortcode * * Include freshly rendered html in response * * Required _POST params: * - shortcode_name string * - title string * - data string params in json * - is_default * * @since 4.7 */ function vc_action_save_settings_preset() { vc_include_settings_preset_class(); vc_user_access()->part( 'presets' )->checkStateAny( true, null )->validateDie(); // user must have permission to save presets $id = Vc_Settings_Preset::saveSettingsPreset( vc_post_param( 'shortcode_name' ), vc_post_param( 'title' ), vc_post_param( 'data' ), vc_post_param( 'is_default' ) ); $response = array( 'success' => (bool) $id, 'html' => Vc_Settings_Preset::getRenderedSettingsPresetPopup( vc_post_param( 'shortcode_name' ) ), 'id' => $id, ); wp_send_json( $response ); } /** * Set existing preset as default * * Include freshly rendered html in response * * Required _POST params: * - id int * - shortcode_name string * * @since 4.7 */ function vc_action_set_as_default_settings_preset() { vc_include_settings_preset_class(); vc_user_access()->part( 'presets' )->checkStateAny( true, null )->validateDie(); // user must have permission to set as default presets $id = vc_post_param( 'id' ); $shortcode_name = vc_post_param( 'shortcode_name' ); $status = Vc_Settings_Preset::setAsDefaultSettingsPreset( $id, $shortcode_name ); $response = array( 'success' => $status, 'html' => Vc_Settings_Preset::getRenderedSettingsPresetPopup( $shortcode_name ), ); wp_send_json( $response ); } /** * Unmark current default preset as default * * Include freshly rendered html in response * * Required _POST params: * - shortcode_name string * * @since 4.7 */ function vc_action_restore_default_settings_preset() { vc_include_settings_preset_class(); vc_user_access()->part( 'presets' )->checkStateAny( true, null )->validateDie(); // user must have permission to restore presets $shortcode_name = vc_post_param( 'shortcode_name' ); $status = Vc_Settings_Preset::setAsDefaultSettingsPreset( null, $shortcode_name ); $response = array( 'success' => $status, 'html' => Vc_Settings_Preset::getRenderedSettingsPresetPopup( $shortcode_name ), ); wp_send_json( $response ); } /** * Delete specific settings preset * * Include freshly rendered html in response * * Required _POST params: * - shortcode_name string * - id int * * @since 4.7 */ function vc_action_delete_settings_preset() { vc_include_settings_preset_class(); vc_user_access()->part( 'presets' )->checkStateAny( true, null )->validateDie(); // user must have permission to delete presets $default = get_post_meta( vc_post_param( 'id' ), '_vc_default', true ); $status = Vc_Settings_Preset::deleteSettingsPreset( vc_post_param( 'id' ) ); $response = array( 'success' => $status, 'default' => $default, 'html' => Vc_Settings_Preset::getRenderedSettingsPresetPopup( vc_post_param( 'shortcode_name' ) ), ); wp_send_json( $response ); } /** * Get data for specific settings preset * * Required _POST params: * - id int * * @since 4.7 */ function vc_action_get_settings_preset() { vc_include_settings_preset_class(); $data = Vc_Settings_Preset::getSettingsPreset( vc_post_param( 'id' ), true ); if ( false !== $data ) { $response = array( 'success' => true, 'data' => $data, ); } else { $response = array( 'success' => false, ); } wp_send_json( $response ); } /** * Respond with rendered popup menu * * Required _POST params: * - shortcode_name string * * @since 4.7 */ function vc_action_render_settings_preset_popup() { vc_include_settings_preset_class(); $html = Vc_Settings_Preset::getRenderedSettingsPresetPopup( vc_post_param( 'shortcode_name' ) ); $response = array( 'success' => true, 'html' => $html, ); wp_send_json( $response ); } /** * Return rendered title prompt * * @since 4.7 * */ function vc_action_render_settings_preset_title_prompt() { vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie()->part( 'presets' )->can()->validateDie(); ob_start(); vc_include_template( apply_filters( 'vc_render_settings_preset_title_prompt', 'editors/partials/prompt-presets.tpl.php' ) ); $html = ob_get_clean(); $response = array( 'success' => true, 'html' => $html, ); wp_send_json( $response ); } /** * Return rendered template prompt */ function vc_action_render_settings_templates_prompt() { vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie()->part( 'templates' )->can()->validateDie(); ob_start(); vc_include_template( apply_filters( 'vc_render_settings_preset_title_prompt', 'editors/partials/prompt-templates.tpl.php' ) ); $html = ob_get_clean(); $response = array( 'success' => true, 'html' => $html, ); wp_send_json( $response ); } /** * Register (add) new vendor preset * * @since 4.8 * * @param string $title * @param string $shortcode * @param array $params * @param bool $default */ function vc_register_settings_preset( $title, $shortcode, $params, $default = false ) { vc_vendor_preset()->add( $title, $shortcode, $params, $default ); } frontend-editor-ie.php 0000666 00000000205 15214117146 0010756 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } add_action( 'vc_frontend_editor_render_template', 'vc_add_ie9_degradation' ); bc-access-rules-4.8.php 0000666 00000012632 15214117146 0010551 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } // Part BC: Post types // ========================= function vc_bc_access_rule_48_post_type_get_state( $state ) { if ( null === $state ) { $content_types = vc_settings()->get( 'content_types' ); if ( empty( $content_types ) ) { $state = true; } else { $state = 'custom'; } } return $state; } function vc_bc_access_rule_48_post_type_rule( $value, $role, $rule ) { if ( ! $role ) { return $value; } global $vc_bc_access_rule_48_editor_post_types; $part = vc_role_access()->who( $role->name )->part( 'post_types' ); if ( ! isset( $part->getRole()->capabilities[ $part->getStateKey() ] ) ) { if ( is_null( $vc_bc_access_rule_48_editor_post_types ) ) { $pt_array = vc_settings()->get( 'content_types' ); $vc_bc_access_rule_48_editor_post_types = $pt_array ? $pt_array : vc_default_editor_post_types(); } return in_array( $rule, $vc_bc_access_rule_48_editor_post_types ); } return $value; } // Part BC: shortcodes // ========================= function vc_bc_access_rule_48_shortcodes_get_state( $state, $role ) { if ( ! $role ) { return $state; } if ( null === $state ) { $group_access_settings = vc_settings()->get( 'groups_access_rules' ); if ( ! isset( $group_access_settings[ $role->name ]['shortcodes'] ) ) { $state = true; } else { $state = 'custom'; } } return $state; } function vc_bc_access_rule_48_shortcodes_rule( $value, $role, $rule ) { if ( ! $role ) { return $value; } if ( ! vc_bc_access_get_shortcodes_state_is_set( $role ) ) { if ( preg_match( '/_edit$/', $rule ) ) { return false; } $group_access_settings = vc_settings()->get( 'groups_access_rules' ); if ( isset( $group_access_settings[ $role->name ]['shortcodes'] ) && ! empty( $group_access_settings[ $role->name ]['shortcodes'] ) ) { $rule = preg_replace( '/_all$/', '', $rule ); return 'vc_row' === $rule || ( isset( $group_access_settings[ $role->name ]['shortcodes'][ $rule ] ) && 1 === (int) $group_access_settings[ $role->name ]['shortcodes'][ $rule ] ); } else { return true; } } return $value; } /** * Check is state set * * @param $role * * @return bool */ function vc_bc_access_get_shortcodes_state_is_set( $role ) { if ( ! $role ) { return false; } $part = vc_role_access()->who( $role->name )->part( 'shortcodes' ); return isset( $part->getRole()->capabilities[ $part->getStateKey() ] ); } // Part BC: backened editor // =========================== function vc_bc_access_rule_48_backend_editor_get_state( $state, $role ) { if ( ! $role ) { return $state; } if ( null === $state ) { $group_access_settings = vc_settings()->get( 'groups_access_rules' ); if ( ! isset( $group_access_settings[ $role->name ]['show'] ) || 'all' === $group_access_settings[ $role->name ]['show'] ) { $state = true; } elseif ( 'no' === $group_access_settings[ $role->name ]['show'] ) { $state = false; } else { $state = 'default'; } } return $state; } function vc_bc_access_rule_48_frontend_editor_get_state( $state, $role ) { if ( ! $role ) { return $state; } if ( null === $state ) { $group_access_settings = vc_settings()->get( 'groups_access_rules' ); if ( isset( $group_access_settings[ $role->name ]['show'] ) && 'no' === $group_access_settings[ $role->name ]['show'] ) { $state = false; } else { $state = true; } } return $state; } function vc_bc_access_rule_48_backend_editor_can_disabled_ce_editor_rule( $value, $role ) { if ( ! $role ) { return $value; } $part = vc_role_access()->who( $role->name )->part( 'backend_editor' ); if ( ! isset( $part->getRole()->capabilities[ $part->getStateKey() ] ) ) { $group_access_settings = vc_settings()->get( 'groups_access_rules' ); return isset( $group_access_settings[ $role->name ]['show'] ) && 'only' === $group_access_settings[ $role->name ]['show']; } return $value; } function vc_bc_access_rule_48_backend_editor_add_cap_disabled_ce_editor( $role ) { if ( ! $role ) { return $role; } $part = vc_role_access()->who( $role->name )->part( 'backend_editor' ); if ( ! isset( $part->getRole()->capabilities[ $part->getStateKey() ] ) ) { $group_access_settings = vc_settings()->get( 'groups_access_rules' ); if ( isset( $group_access_settings[ $role->name ]['show'] ) && 'only' === $group_access_settings[ $role->name ]['show'] ) { $role->capabilities[ $part->getStateKey() . '/disabled_ce_editor' ] = true; } } return $role; } function vc_bc_access_rule_48() { add_filter( 'vc_role_access_with_post_types_get_state', 'vc_bc_access_rule_48_post_type_get_state' ); add_filter( 'vc_role_access_with_post_types_can', 'vc_bc_access_rule_48_post_type_rule', 10, 3 ); add_filter( 'vc_role_access_with_shortcodes_get_state', 'vc_bc_access_rule_48_shortcodes_get_state', 10, 3 ); add_filter( 'vc_role_access_with_shortcodes_can', 'vc_bc_access_rule_48_shortcodes_rule', 10, 3 ); add_filter( 'vc_role_access_with_backend_editor_get_state', 'vc_bc_access_rule_48_backend_editor_get_state', 10, 3 ); add_filter( 'vc_role_access_with_backend_editor_can_disabled_ce_editor', 'vc_bc_access_rule_48_backend_editor_can_disabled_ce_editor_rule', 10, 2 ); add_filter( 'vc_role_access_with_frontend_editor_get_state', 'vc_bc_access_rule_48_frontend_editor_get_state', 10, 3 ); add_filter( 'vc_role_access_all_caps_role', 'vc_bc_access_rule_48_backend_editor_add_cap_disabled_ce_editor' ); } // BC function for shortcode add_action( 'vc_before_init', 'vc_bc_access_rule_48' ); vc-pointers-backend-editor.php 0000666 00000005606 15214117146 0012414 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Add WP ui pointers to backend editor. */ function vc_add_admin_pointer() { if ( is_admin() ) { foreach ( vc_editor_post_types() as $post_type ) { add_filter( 'vc_ui-pointers-' . $post_type, 'vc_backend_editor_register_pointer' ); } } } add_action( 'admin_init', 'vc_add_admin_pointer' ); function vc_backend_editor_register_pointer( $pointers ) { $screen = get_current_screen(); if ( 'add' === $screen->action ) { $pointers['vc_pointers_backend_editor'] = array( 'name' => 'vcPointerController', 'messages' => array( array( 'target' => '.composer-switch', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s </p>', __( 'Welcome to Visual Composer', 'js_composer' ), __( 'Choose Backend or Frontend editor.', 'js_composer' ) ), 'position' => array( 'edge' => 'left', 'align' => 'center', ), 'buttonsEvent' => 'vcPointersEditorsTourEvents', ), ), array( 'target' => '#vc_templates-editor-button, #vc-templatera-editor-button', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s </p>', __( 'Add Elements', 'js_composer' ), __( 'Add new element or start with a template.', 'js_composer' ) ), 'position' => array( 'edge' => 'left', 'align' => 'center', ), 'buttonsEvent' => 'vcPointersEditorsTourEvents', ), 'closeEvent' => 'shortcodes:vc_row:add', 'showEvent' => 'backendEditor.show', ), array( 'target' => '[data-vc-control="add"]:first', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s </p>', __( 'Rows and Columns', 'js_composer' ), __( 'This is a row container. Divide it into columns and style it. You can add elements into columns.', 'js_composer' ) ), 'position' => array( 'edge' => 'left', 'align' => 'center', ), 'buttonsEvent' => 'vcPointersEditorsTourEvents', ), 'closeEvent' => 'click #wpb_visual_composer', 'showEvent' => 'shortcodeView:ready', ), array( 'target' => '.wpb_column_container:first .wpb_content_element:first .vc_controls-cc', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s <br/><br/> %s</p>', __( 'Control Elements', 'js_composer' ), __( 'You can edit your element at any time and drag it around your layout.', 'js_composer' ), sprintf( __( 'P.S. Learn more at our <a href="%s" target="_blank">Knowledge Base</a>.', 'js_composer' ), 'http://kb.wpbakery.com' ) ), 'position' => array( 'edge' => 'left', 'align' => 'center', ), 'buttonsEvent' => 'vcPointersEditorsTourEvents', ), 'showCallback' => 'vcPointersShowOnContentElementControls', 'closeEvent' => 'click #wpb_visual_composer', ), ), ); } return $pointers; } vc-image-filters.php 0000666 00000021610 15214117146 0010421 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } add_filter( 'attachment_fields_to_edit', 'vc_attachment_filter_field', 10, 2 ); add_filter( 'media_meta', 'vc_attachment_filter_media_meta', 10, 2 ); add_action( 'wp_ajax_vc_media_editor_add_image', 'vc_media_editor_add_image' ); add_action( 'wp_ajax_vc_media_editor_preview_image', 'vc_media_editor_preview_image' ); /** * @return array */ function vc_get_filters() { return array( 'antique' => __( 'Antique', 'js_composer' ), 'blackwhite' => __( 'Black & White', 'js_composer' ), 'boost' => __( 'Boost', 'js_composer' ), 'concentrate' => __( 'Concentrate', 'js_composer' ), 'country' => __( 'Country', 'js_composer' ), 'darken' => __( 'Darken', 'js_composer' ), 'dream' => __( 'Dream', 'js_composer' ), 'everglow' => __( 'Everglow', 'js_composer' ), 'forest' => __( 'Forest', 'js_composer' ), 'freshblue' => __( 'Fresh Blue', 'js_composer' ), 'frozen' => __( 'Frozen', 'js_composer' ), 'hermajesty' => __( 'Her Majesty', 'js_composer' ), 'light' => __( 'Light', 'js_composer' ), 'orangepeel' => __( 'Orange Peel', 'js_composer' ), 'rain' => __( 'Rain', 'js_composer' ), 'retro' => __( 'Retro', 'js_composer' ), 'sepia' => __( 'Sepia', 'js_composer' ), 'summer' => __( 'Summer', 'js_composer' ), 'tender' => __( 'Tender', 'js_composer' ), 'vintage' => __( 'Vintage', 'js_composer' ), 'washed' => __( 'Washed', 'js_composer' ), ); } /** * Add Image Filter field to media uploader * * @param $form_fields array, fields to include in attachment form * @param $post object, attachment record in database * * @return array $form_fields, modified form fields */ function vc_attachment_filter_field( $form_fields, $post ) { // don't add filter field, if image already has filter applied if ( get_post_meta( $post->ID, 'vc-applied-image-filter', true ) ) { return $form_fields; } $options = vc_get_filters(); $html_options = '<option value="">' . __( 'None', 'js_composer' ) . '</option>'; foreach ( $options as $value => $title ) { $html_options .= '<option value="' . $value . '">' . $title . '</option>'; } $form_fields['vc-image-filter'] = array( 'label' => '', 'input' => 'html', 'html' => ' <div style="display:none"> <span class="vc-filter-label">' . __( 'Image filter', 'js_composer' ) . '</span> <select name="attachments[' . $post->ID . '][vc-image-filter]" id="attachments-' . $post->ID . '-vc-image-filter" data-vc-preview-image-filter="' . $post->ID . '"> ' . $html_options . ' </select> </div>', 'value' => get_post_meta( $post->ID, 'vc_image_filter', true ), 'helps' => '', ); return $form_fields; } /** * Apply filters to specified images * * If image(s) has filter specified via filters _POST param: * 1) copy it * 2) apply specified filter * 3) return new image id * * Required _POST params: * - array ids: array of attachment ids * * Optional _POST params: * - array filters: mapped array of ids and filters to apply * */ function vc_media_editor_add_image() { vc_user_access() ->checkAdminNonce() ->validateDie() ->wpAny( 'upload_files' ) ->validateDie(); require_once vc_path_dir( 'APP_ROOT', 'vendor/mmihey/PHP-Instagram-effects/src/Image/Filter.php' ); $response = array( 'success' => true, 'data' => array( 'ids' => array(), ), ); $filters = (array) vc_post_param( 'filters', array() ); $ids = (array) vc_post_param( 'ids', array() ); if ( ! $ids ) { wp_send_json( $response ); } // default action is wp_handle_upload, which forces wp to check upload with is_uploaded_file() // override action to anything else to skip security checks $action = 'vc_handle_upload_imitation'; $file_key = 0; $post_id = 0; $post_data = array(); $overrides = array( 'action' => $action ); $_POST = array( 'action' => $action ); foreach ( $ids as $key => $attachment_id ) { if ( ! empty( $filters[ $attachment_id ] ) ) { $filter_name = $filters[ $attachment_id ]; } else { continue; } $source_path = get_attached_file( $attachment_id ); if ( empty( $source_path ) ) { continue; } $temp_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . basename( $source_path ); if ( ! copy( $source_path, $temp_path ) ) { continue; } $extension = strtolower( pathinfo( $temp_path, PATHINFO_EXTENSION ) ); $mime_type = ''; switch ( $extension ) { case 'jpeg': case 'jpg': $image = imagecreatefromjpeg( $temp_path ); $mime_type = 'image/jpeg'; break; case 'png': $image = imagecreatefrompng( $temp_path ); $mime_type = 'image/png'; break; case 'gif': $image = imagecreatefromgif( $temp_path ); $mime_type = 'image/gif'; break; default: $image = false; } if ( ! $image ) { continue; } $Filter = new vcImageFilter( $image ); $Filter->$filter_name(); if ( ! vc_save_gd_resource( $Filter->getImage(), $temp_path ) ) { continue; } $new_filename = basename( $temp_path, '.' . $extension ) . '-' . $filter_name . '.' . $extension; $_FILES = array( array( 'name' => $new_filename, 'type' => $mime_type, 'tmp_name' => $temp_path, 'error' => UPLOAD_ERR_OK, 'size' => filesize( $temp_path ), ), ); $new_attachment_id = media_handle_upload( $file_key, $post_id, $post_data, $overrides ); if ( ! $new_attachment_id || is_wp_error( $new_attachment_id ) ) { continue; } update_post_meta( $new_attachment_id, 'vc-applied-image-filter', $filter_name ); $ids[ $key ] = $new_attachment_id; } $response['data']['ids'] = $ids; wp_send_json( $response ); } /** * Generate filter preview * * Preview url is generated as data uri (base64) * * Required _POST params: * - string filter: filter name * - int attachment_id: attachment id * * @return void Results are sent out as json */ function vc_media_editor_preview_image() { vc_user_access() ->checkAdminNonce() ->validateDie() ->wpAny( 'upload_files' ) ->validateDie(); require_once vc_path_dir( 'APP_ROOT', 'vendor/mmihey/PHP-Instagram-effects/src/Image/Filter.php' ); $response = array( 'success' => true, 'data' => array( 'src' => '', ), ); $filter_name = vc_post_param( 'filter', '' ); $attachment_id = vc_post_param( 'attachment_id', false ); $preferred_size = vc_post_param( 'preferred_size', 'medium' ); if ( ! $filter_name || ! $attachment_id ) { wp_send_json( $response ); } $attachment_path = get_attached_file( $attachment_id ); $attachment_details = wp_prepare_attachment_for_js( $attachment_id ); if ( ! isset( $attachment_details['sizes'][ $preferred_size ] ) ) { $preferred_size = 'thumbnail'; } $attachment_url = wp_get_attachment_image_src( $attachment_id, $preferred_size ); if ( empty( $attachment_path ) || empty( $attachment_url[0] ) ) { wp_send_json( $response ); } $source_path = dirname( $attachment_path ) . '/' . basename( $attachment_url[0] ); $image = vc_get_gd_resource( $source_path ); if ( ! $image ) { wp_send_json( $response ); } $Filter = new vcImageFilter( $image ); $Filter->$filter_name(); $extension = strtolower( pathinfo( $source_path, PATHINFO_EXTENSION ) ); ob_start(); switch ( $extension ) { case 'jpeg': case 'jpg': imagejpeg( $Filter->getImage() ); break; case 'png': imagepng( $Filter->getImage() ); break; case 'gif': imagegif( $Filter->getImage() ); break; } $data = ob_get_clean(); $response['data']['src'] = 'data:image/' . $extension . ';base64,' . base64_encode( $data ); wp_send_json( $response ); } /** * Read file from disk as GD resource * * @param string $file * * @return bool|resource */ function vc_get_gd_resource( $file ) { $extension = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); switch ( $extension ) { case 'jpeg': case 'jpg': return imagecreatefromjpeg( $file ); case 'png': return imagecreatefrompng( $file ); case 'gif': return imagecreatefromgif( $file ); } return false; } /** * Save GD resource to file * * @param resource $resource * @param string $file * * @return bool */ function vc_save_gd_resource( $resource, $file ) { $extension = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); switch ( $extension ) { case 'jpeg': case 'jpg': return imagejpeg( $resource, $file ); case 'png': return imagepng( $resource, $file ); case 'gif': return imagegif( $resource, $file ); } return false; } /** * Add "Filter: ..." meta field to attachment details box * * @param $media_meta array, meta to include in attachment form * @param $post object, attachment record in database * * @return array $media_meta, modified meta fields */ function vc_attachment_filter_media_meta( $media_meta, $post ) { $filter_name = get_post_meta( $post->ID, 'vc-applied-image-filter', true ); if ( ! $filter_name ) { return $media_meta; } $filters = vc_get_filters(); if ( ! isset( $filters[ $filter_name ] ) ) { return $media_meta; } $media_meta .= __( 'Filter:', 'js_composer' ) . ' ' . $filters[ $filter_name ]; return $media_meta; } hook-vc-pie.php 0000666 00000000476 15214117146 0007413 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } if ( 'vc_edit_form' === vc_post_param( 'action' ) ) { VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_Vc_Pie' ); add_filter( 'vc_edit_form_fields_attributes_vc_pie', array( 'WPBakeryShortCode_VC_Pie', 'convertOldColorsToNew', ) ); } bc-multisite-options.php 0000666 00000001326 15214117146 0011357 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } add_action( 'vc_activation_hook', 'vc_bc_multisite_options', 9 ); function vc_bc_multisite_options( $networkWide ) { global $current_site; if ( ! is_multisite() || empty( $current_site ) || ! $networkWide || get_site_option( 'vc_bc_options_called', false ) || get_site_option( 'wpb_js_js_composer_purchase_code', false ) ) { return; } // Now we need to check BC with license keys $is_main_blog_activated = get_blog_option( (int) $current_site->id, 'wpb_js_js_composer_purchase_code' ); if ( $is_main_blog_activated ) { update_site_option( 'wpb_js_js_composer_purchase_code', $is_main_blog_activated ); } update_site_option( 'vc_bc_options_called', true ); } vc-grid-item-editor.php 0000666 00000022336 15214117146 0011044 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } global $vc_grid_item_editor; /** * Creates new post type for grid_editor. * * @since 4.4 */ function vc_grid_item_editor_create_post_type() { if ( is_admin() ) { require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php' ); Vc_Grid_Item_Editor::createPostType(); add_action( 'vc_menu_page_build', 'vc_gitem_add_submenu_page' ); // TODO: add check vendor is active add_filter( 'vc_vendor_qtranslate_enqueue_js_backend', 'vc_vendor_qtranslate_enqueue_js_backend_grid_editor' ); } } /** * @since 4.5 */ function vc_vendor_qtranslate_enqueue_js_backend_grid_editor() { return true; } /** * Set required objects to render editor for grid item * * @since 4.4 */ function vc_grid_item_editor_init() { global $vc_grid_item_editor; require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php' ); require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-wpb-map-grid-item.php' ); $vc_grid_item_editor = new Vc_Grid_Item_Editor(); $vc_grid_item_editor->addMetaBox(); add_action( 'wp_ajax_vc_grid_item_editor_load_template_preview', array( &$vc_grid_item_editor, 'renderTemplatePreview', ) ); $vc_grid_item_editor->addHooksSettings(); } /** * Render preview for grid item * @since 4.4 */ function vc_grid_item_render_preview() { vc_user_access()->checkAdminNonce()->validateDie()->wpAny( array( 'edit_post', (int) vc_request_param( 'post_id' ), ) )->validateDie()->part( 'grid_builder' )->can()->validateDie(); require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' ); $grid_item = new Vc_Grid_Item(); $grid_item->mapShortcodes(); require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-preview.php' ); $vcGridPreview = new Vc_Grid_Item_Preview(); add_filter( 'vc_gitem_template_attribute_post_image_background_image_css_value', array( $vcGridPreview, 'addCssBackgroundImage', ) ); add_filter( 'vc_gitem_template_attribute_post_image_url_value', array( $vcGridPreview, 'addImageUrl', ) ); add_filter( 'vc_gitem_template_attribute_post_image_html', array( $vcGridPreview, 'addImage', ) ); add_filter( 'vc_gitem_attribute_featured_image_img', array( $vcGridPreview, 'addPlaceholderImage', ) ); add_filter( 'vc_gitem_post_data_get_link_real_link', array( $vcGridPreview, 'disableRealContentLink', ), 10, 4 ); add_filter( 'vc_gitem_post_data_get_link_link', array( $vcGridPreview, 'disableContentLink', ), 10, 3 ); add_filter( 'vc_gitem_zone_image_block_link', array( $vcGridPreview, 'disableGitemZoneLink', ) ); $vcGridPreview->render(); die(); } /** * Map grid element shortcodes. * * @since 4.5 */ function vc_grid_item_map_shortcodes() { require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' ); $grid_item = new Vc_Grid_Item(); $grid_item->mapShortcodes(); vc_mapper()->setCheckForAccess( false ); } /** * Get current post type * * @return null|string */ function vc_grid_item_get_post_type() { $post_type = null; if ( vc_request_param( 'post_type' ) ) { $post_type = vc_request_param( 'post_type' ); } elseif ( vc_request_param( 'post' ) ) { $post = get_post( vc_request_param( 'post' ) ); $post_type = $post instanceof WP_Post && $post->post_type ? $post->post_type : null; } return $post_type; } /** * Check and Map grid element shortcodes if required. * @since 4.5 */ function vc_grid_item_editor_shortcodes() { require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php' ); // TODO: remove this because mapping can be based on post_type if ( ( 'true' === vc_request_param( 'vc_grid_item_editor' ) || ( is_admin() && vc_grid_item_get_post_type() === Vc_Grid_Item_Editor::postType() ) && vc_user_access() ->wpAny( 'edit_posts', 'edit_pages' )->part( 'grid_builder' )->can()->get() ) ) { global $vc_grid_item_editor; add_action( 'vc_user_access_check-shortcode_edit', array( &$vc_grid_item_editor, 'accessCheckShortcodeEdit', ), 10, 2 ); add_action( 'vc_user_access_check-shortcode_all', array( &$vc_grid_item_editor, 'accessCheckShortcodeAll', ), 10, 2 ); vc_grid_item_map_shortcodes(); } } /** * add action in admin for vc grid item editor manager */ add_action( 'init', 'vc_grid_item_editor_create_post_type' ); add_action( 'admin_init', 'vc_grid_item_editor_init' ); add_action( 'vc_after_init', 'vc_grid_item_editor_shortcodes' ); /** * Call preview as ajax request is called. */ add_action( 'wp_ajax_vc_gitem_preview', 'vc_grid_item_render_preview', 5 ); /** * Add WP ui pointers in grid element editor. */ if ( is_admin() ) { add_filter( 'vc_ui-pointers-vc_grid_item', 'vc_grid_item_register_pointer' ); } function vc_grid_item_register_pointer( $pointers ) { $screen = get_current_screen(); if ( 'add' === $screen->action ) { $pointers['vc_grid_item'] = array( 'name' => 'vcPointersController', 'messages' => array( array( 'target' => '#vc_templates-editor-button', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s </p>', __( 'Start Here!', 'js_composer' ), __( 'Start easy - use predefined template as a starting point and modify it.', 'js_composer' ) ), 'position' => array( 'edge' => 'left', 'align' => 'center', ), ), ), array( 'target' => '[data-vc-navbar-control="animation"]', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s </p>', __( 'Use Animations', 'js_composer' ), __( 'Select animation preset for grid element. "Hover" state will be added next to the "Normal" state tab.', 'js_composer' ) ), 'position' => array( 'edge' => 'right', 'align' => 'center', ), ), ), array( 'target' => '.vc_gitem_animated_block-shortcode', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s </p>', __( 'Style Design Options', 'js_composer' ), __( 'Edit "Normal" state to set "Featured image" as a background, control zone sizing proportions and other design options (Height mode: Select "Original" to scale image without cropping).', 'js_composer' ) ), 'position' => array( 'edge' => 'bottom', 'align' => 'center', ), ), ), array( 'target' => '[data-vc-gitem="add-c"][data-vc-position="top"]', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s </p>', __( 'Extend Element', 'js_composer' ), __( 'Additional content zone can be added to grid element edges (Note: This zone can not be animated).', 'js_composer' ) ) . '<p><img src="' . vc_asset_url( 'vc/gb_additional_content.png' ) . '" alt="" /></p>', 'position' => array( 'edge' => 'right', 'align' => 'center', ), ), ), array( 'target' => '#wpadminbar', 'options' => array( 'content' => sprintf( '<h3> %s </h3> %s', __( 'Watch Video Tutorial', 'js_composer' ), '<p>' . __( 'Have a look how easy it is to work with grid element builder.', 'js_composer' ) . '</p>' . '<iframe width="500" height="281" src="//www.youtube.com/embed/sBvEiIL6Blo" frameborder="0" allowfullscreen></iframe>' ), 'position' => array( 'edge' => 'top', 'align' => 'center', ), 'pointerClass' => 'vc_gitem-animated-block-pointer-video', 'pointerWidth' => '530', ), ), ), ); } return $pointers; } function vc_gitem_content_shortcodes() { require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' ); $grid_item = new Vc_Grid_Item(); $invalid_shortcodes = apply_filters( 'vc_gitem_zone_grid_item_not_content_shortcodes', array( 'vc_gitem', 'vc_gitem_animated_block', 'vc_gitem_zone', 'vc_gitem_zone_a', 'vc_gitem_zone_b', 'vc_gitem_zone_c', 'vc_gitem_row', 'vc_gitem_col', ) ); return array_diff( array_keys( $grid_item->shortcodes() ), $invalid_shortcodes ); } function vc_gitem_has_content( $content ) { $tags = vc_gitem_content_shortcodes(); $regexp = vc_get_shortcode_regex( implode( '|', $tags ) ); return preg_match( '/' . $regexp . '/', $content ); } /** * Add sub page to Visual Composer pages * * @since 4.5 */ function vc_gitem_add_submenu_page() { if ( vc_user_access()->part( 'grid_builder' )->can()->get() ) { $labels = Vc_Grid_Item_Editor::getPostTypesLabels(); add_submenu_page( VC_PAGE_MAIN_SLUG, $labels['name'], $labels['name'], 'edit_posts', 'edit.php?post_type=' . rawurlencode( Vc_Grid_Item_Editor::postType() ), '' ); } } /** * Highlight Vc submenu. * @since 4.5 */ function vc_gitem_menu_highlight() { global $parent_file, $submenu_file, $post_type; require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php' ); if ( Vc_Grid_Item_Editor::postType() === $post_type && defined( 'VC_PAGE_MAIN_SLUG' ) ) { $parent_file = VC_PAGE_MAIN_SLUG; $submenu_file = 'edit.php?post_type=' . rawurlencode( Vc_Grid_Item_Editor::postType() ); } } add_action( 'admin_head', 'vc_gitem_menu_highlight' ); function vc_gitem_set_mapper_check_access() { if ( vc_user_access()->checkAdminNonce()->wpAny( 'edit_posts', 'edit_pages' )->part( 'grid_builder' )->can()->get() && 'true' === vc_post_param( 'vc_grid_item_editor' ) ) { vc_mapper()->setCheckForAccess( false ); } } add_action( 'wp_ajax_vc_edit_form', 'vc_gitem_set_mapper_check_access' ); hook-vc-message.php 0000666 00000000524 15214117146 0010254 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } if ( 'vc_edit_form' === vc_post_param( 'action' ) ) { VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Message' ); add_filter( 'vc_edit_form_fields_attributes_vc_message', array( 'WPBakeryShortCode_VC_Message', 'convertAttributesToMessageBox2', ) ); } vc-pages/pages.php 0000666 00000004357 15214117146 0010100 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * @since 4.5 */ function vc_page_css_enqueue() { wp_enqueue_style( 'vc_page-css', vc_asset_url( 'css/js_composer_settings.min.css' ), array(), WPB_VC_VERSION ); } /** * Build group page objects. * * @param $slug * @param $title * @param $tab * * @since 4.5 * * @return Vc_Pages_Group */ function vc_pages_group_build( $slug, $title, $tab = '' ) { $vc_page_welcome_tabs = vc_get_page_welcome_tabs(); require_once vc_path_dir( 'CORE_DIR', 'class-vc-page.php' ); require_once vc_path_dir( 'CORE_DIR', 'class-vc-pages-group.php' ); // Create page. if ( ! strlen( $tab ) ) { $tab = $slug; } $page = new Vc_Page(); $page->setSlug( $tab ) ->setTitle( $title ) ->setTemplatePath( 'pages/' . $slug . '/' . $tab . '.php' ); // Create page group to stick with other in template. $pages_group = new Vc_Pages_Group(); $pages_group->setSlug( $slug ) ->setPages( $vc_page_welcome_tabs ) ->setActivePage( $page ) ->setTemplatePath( 'pages/vc-welcome/index.php' ); return $pages_group; } /** * @since 4.5 */ function vc_menu_page_build() { if ( vc_user_access() ->wpAny( 'manage_options' ) ->part( 'settings' ) ->can( 'vc-general-tab' ) ->get() ) { define( 'VC_PAGE_MAIN_SLUG', 'vc-general' ); } else { define( 'VC_PAGE_MAIN_SLUG', 'vc-welcome' ); } add_menu_page( __( 'Visual Composer', 'js_composer' ), __( 'Visual Composer', 'js_composer' ), 'exist', VC_PAGE_MAIN_SLUG, null, vc_asset_url( 'vc/visual_composer.png' ), 76 ); do_action( 'vc_menu_page_build' ); } function vc_network_menu_page_build() { if ( ! vc_is_network_plugin() ) { return; } if ( vc_user_access() ->wpAny( 'manage_options' ) ->part( 'settings' ) ->can( 'vc-general-tab' ) ->get() && ! is_main_site() ) { define( 'VC_PAGE_MAIN_SLUG', 'vc-general' ); } else { define( 'VC_PAGE_MAIN_SLUG', 'vc-welcome' ); } add_menu_page( __( 'Visual Composer', 'js_composer' ), __( 'Visual Composer', 'js_composer' ), 'exist', VC_PAGE_MAIN_SLUG, null, vc_asset_url( 'vc/visual_composer.png' ), 76 ); do_action( 'vc_network_menu_page_build' ); } add_action( 'admin_menu', 'vc_menu_page_build' ); add_action( 'network_admin_menu', 'vc_network_menu_page_build' ); vc-pages/settings-tabs.php 0000666 00000002313 15214117146 0011556 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } function vc_page_settings_render() { $page = vc_get_param( 'page' ); do_action( 'vc_page_settings_render-' . $page ); vc_settings()->renderTab( $page ); } function vc_page_settings_build() { if ( ! vc_user_access()->wpAny( 'manage_options' )->get() ) { return; } $tabs = vc_settings()->getTabs(); foreach ( $tabs as $slug => $title ) { $has_access = vc_user_access()->part( 'settings' )->can( $slug . '-tab' )->get(); if ( $has_access ) { $page = add_submenu_page( VC_PAGE_MAIN_SLUG, $title, $title, 'manage_options', $slug, 'vc_page_settings_render' ); add_action( 'load-' . $page, array( vc_settings(), 'adminLoad', ) ); } } do_action( 'vc_page_settings_build' ); } function vc_page_settings_admin_init() { vc_settings()->initAdmin(); } add_action( 'vc_menu_page_build', 'vc_page_settings_build' ); add_action( 'vc_network_menu_page_build', 'vc_page_settings_build' ); add_action( 'admin_init', 'vc_page_settings_admin_init' ); add_action( 'vc-settings-render-tab-vc-roles', 'vc_settings_enqueue_js' ); function vc_settings_enqueue_js() { // enqueue accordion in vc-roles page only wp_enqueue_script( 'vc_accordion_script' ); } vc-pages/page-custom-css.php 0000666 00000000521 15214117146 0012000 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } function vc_page_settings_custom_css_load() { wp_enqueue_script( 'ace-editor', vc_asset_url( 'lib/bower/ace-builds/src-min-noconflict/ace.js' ), array( 'jquery' ), WPB_VC_VERSION, true ); } add_action( 'vc-settings-render-tab-vc-custom_css', 'vc_page_settings_custom_css_load' ); vc-pages/automapper.php 0000666 00000001422 15214117146 0011144 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Build and enqueue js/css for automapper settings tab. * @since 4.5 */ function vc_automapper_init() { if ( vc_user_access() ->wpAny( 'manage_options' ) ->part( 'settings' ) ->can( 'vc-automapper-tab' ) ->get() ) { vc_automapper()->addAjaxActions(); } } /** * Returns automapper template. * * @since 4.5 * @return string */ function vc_page_automapper_build() { return 'pages/vc-settings/vc-automapper.php'; } // TODO: move to separate file in autoload add_filter( 'vc_settings-render-tab-vc-automapper', 'vc_page_automapper_build' ); is_admin() && ( 'vc_automapper' === vc_request_param( 'action' ) || 'vc-automapper' === vc_get_param( 'page' ) ) && add_action( 'admin_init', 'vc_automapper_init' ); vc-pages/welcome-screen.php 0000666 00000006033 15214117146 0011702 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Get welcome pages main slug. * * @since 4.5 * @return mixed|string */ function vc_page_welcome_slug() { $vc_page_welcome_tabs = vc_get_page_welcome_tabs(); return isset( $vc_page_welcome_tabs ) ? key( $vc_page_welcome_tabs ) : ''; } /** * Build vc-welcome page block which will be shown after Vc installation. * * vc_filter: vc_page_welcome_render_capabilities * * @since 4.5 */ function vc_page_welcome_render() { $vc_page_welcome_tabs = vc_get_page_welcome_tabs(); $slug = vc_page_welcome_slug(); $tab_slug = vc_get_param( 'tab', $slug ); // If tab slug in the list please render; if ( ! empty( $tab_slug ) && isset( $vc_page_welcome_tabs[ $tab_slug ] ) ) { $pages_group = vc_pages_group_build( $slug, $vc_page_welcome_tabs[ $tab_slug ], $tab_slug ); $pages_group->render(); } } function vc_page_welcome_add_sub_page() { // Add submenu page $page = add_submenu_page( VC_PAGE_MAIN_SLUG, __( 'About', 'js_composer' ), __( 'About', 'js_composer' ), 'exist', vc_page_welcome_slug(), 'vc_page_welcome_render' ); // Css for perfect styling. add_action( 'admin_print_styles-' . $page, 'vc_page_css_enqueue' ); } function vc_welcome_menu_hooks() { $settings_tab_enabled = vc_user_access()->wpAny( 'manage_options' )->part( 'settings' )->can( 'vc-general-tab' )->get(); add_action( 'vc_menu_page_build', 'vc_page_welcome_add_sub_page', $settings_tab_enabled ? 11 : 1 ); } function vc_welcome_menu_hooks_network() { if ( ! vc_is_network_plugin() ) { return; } $settings_tab_enabled = vc_user_access()->wpAny( 'manage_options' )->part( 'settings' )->can( 'vc-general-tab' )->get(); add_action( 'vc_network_menu_page_build', 'vc_page_welcome_add_sub_page', $settings_tab_enabled && ! is_main_site() ? 11 : 1 ); } add_action( 'admin_menu', 'vc_welcome_menu_hooks', 9 ); add_action( 'network_admin_menu', 'vc_welcome_menu_hooks_network', 9 ); /** * ==================== * Redirect to welcome page on plugin activation. * ==================== */ /** * Set redirect transition on update or activation * @since 4.5 */ function vc_page_welcome_set_redirect() { if ( ! is_network_admin() && ! vc_get_param( 'activate-multi' ) ) { set_transient( '_vc_page_welcome_redirect', 1, 30 ); } } /** * Do redirect if required on welcome page * @since 4.5 */ function vc_page_welcome_redirect() { $redirect = get_transient( '_vc_page_welcome_redirect' ); delete_transient( '_vc_page_welcome_redirect' ); $redirect && wp_redirect( admin_url( 'admin.php?page=' . rawurlencode( vc_page_welcome_slug() ) ) ); } // Enables redirect on activation. add_action( 'vc_activation_hook', 'vc_page_welcome_set_redirect' ); add_action( 'admin_init', 'vc_page_welcome_redirect' ); function vc_get_page_welcome_tabs() { global $vc_page_welcome_tabs; $vc_page_welcome_tabs = apply_filters( 'vc_page-welcome-slugs-list', array( 'vc-welcome' => __( 'What\'s New', 'js_composer' ), 'vc-faq' => __( 'FAQ', 'js_composer' ), 'vc-resources' => __( 'Resources', 'js_composer' ), ) ); return $vc_page_welcome_tabs; } vc-pages/page-role-manager.php 0000666 00000002754 15214117146 0012263 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } function vc_settings_tabs_vc_roles( $tabs ) { //inster after vc-general tab if ( array_key_exists( 'vc-general', $tabs ) ) { $new = array(); foreach ( $tabs as $key => $value ) { $new[ $key ] = $value; if ( 'vc-general' === $key ) { $new['vc-roles'] = __( 'Role Manager', 'js_composer' ); } } $tabs = $new; } else { $tabs['vc-roles'] = __( 'Roles Manager', 'js_composer' ); } return $tabs; } if ( ! is_network_admin() ) { add_filter( 'vc_settings_tabs', 'vc_settings_tabs_vc_roles' ); } function vc_settings_render_tab_vc_roles() { return 'pages/vc-settings/tab-vc-roles.php'; } add_filter( 'vc_settings-render-tab-vc-roles', 'vc_settings_render_tab_vc_roles' ); function vc_roles_settings_save() { if ( check_admin_referer( 'vc_settings-roles-action', 'vc_nonce_field' ) && current_user_can( 'manage_options' ) ) { require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-roles.php' ); $vc_roles = new Vc_Roles(); $data = $vc_roles->save( vc_request_param( 'vc_roles', array() ) ); echo json_encode( $data ); die(); } } add_action( 'wp_ajax_vc_roles_settings_save', 'vc_roles_settings_save' ); if ( 'vc-roles' == vc_get_param( 'page' ) ) { function vc_settings_render_tab_vc_roles_scripts() { wp_register_script( 'vc_accordion_script', vc_asset_url( 'lib/vc_accordion/vc-accordion.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true ); } add_action( 'admin_init', 'vc_settings_render_tab_vc_roles_scripts' ); } vc-pages/page-design-options.php 0000666 00000011643 15214117146 0012651 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Used to check for current less version during page open * * @since 4.5 */ add_action( 'vc_before_init', 'vc_check_for_custom_css_build' ); /** * Function check is system has custom build of css * and check it version in comparison with current VC version * * @since 4.5 */ function vc_check_for_custom_css_build() { $version = vc_settings()->getCustomCssVersion(); if ( vc_user_access() ->wpAny( 'manage_options' ) ->part( 'settings' ) ->can( 'vc-color-tab' ) ->get() && vc_settings()->useCustomCss() && ( ! $version || version_compare( WPB_VC_VERSION, $version, '<>' ) ) ) { add_action( 'admin_notices', 'vc_custom_css_admin_notice' ); } } /** * Display admin notice depending on current page * * @since 4.5 */ function vc_custom_css_admin_notice() { global $current_screen; vc_settings()->set( 'compiled_js_composer_less', '' ); $class = 'notice notice-warning vc_settings-custom-design-notice'; $message_important = __( 'Important notice', 'js_composer' ); if ( is_object( $current_screen ) && isset( $current_screen->id ) && 'visual-composer_page_vc-color' === $current_screen->id ) { $message = __( 'You have an outdated version of Visual Composer Design Options. It is required to review and save it.', 'js_composer' ); $html = '<p><strong>' . esc_html( $message_important ) . '</strong>: ' . esc_html( $message ) . '</p>'; } else { $message = __( 'You have an outdated version of Visual Composer Design Options. It is required to review and save it.', 'js_composer' ); $btnClass = 'button button-primary button-large vc_button-settings-less'; $btnAtts = array( 'href="' . admin_url( 'admin.php?page=vc-color' ) . '"', 'class="' . esc_attr( $btnClass ) . '"', 'id="vc_less-save-button"', 'style="vertical-align: baseline;"', // needed to fix ":active bug" ); $html = '<p><strong>' . esc_html( $message_important ) . '</strong>: ' . esc_html( $message ) . '</p>' . '<p><a ' . implode( ' ', $btnAtts ) . '>' . __( 'Open Design Options', 'js_composer' ) . '</a></p>'; } echo '<div class="' . esc_attr( $class ) . '">' . $html . '</div>'; } function vc_page_settings_tab_color_submit_attributes( $submitButtonAttributes ) { $submitButtonAttributes['data-vc-less-path'] = vc_str_remove_protocol( vc_asset_url( 'less/js_composer.less' ) ); $submitButtonAttributes['data-vc-less-root'] = vc_str_remove_protocol( vc_asset_url( 'less' ) ); $submitButtonAttributes['data-vc-less-variables'] = json_encode( apply_filters( 'vc_settings-less-variables', array( // Main accent color: 'vc_grey' => array( 'key' => 'wpb_js_vc_color', 'default' => vc_settings()->getDefault( 'vc_color' ), ), // Hover color 'vc_grey_hover' => array( 'key' => 'wpb_js_vc_color_hover', 'default' => vc_settings()->getDefault( 'vc_color_hover' ), ), 'vc_image_slider_link_active' => 'wpb_js_vc_color_hover', // Call to action background color 'vc_call_to_action_bg' => 'wpb_js_vc_color_call_to_action_bg', 'vc_call_to_action_2_bg' => 'wpb_js_vc_color_call_to_action_bg', 'vc_call_to_action_border' => array( 'key' => 'wpb_js_vc_color_call_to_action_border', // darken 5% 'default_key' => 'wpb_js_vc_color', 'modify_output' => array( array( 'plain' => array( 'darken({{ value }}, 5%)', ), ), ), ), // Google maps background color 'vc_google_maps_bg' => 'wpb_js_vc_color_google_maps_bg', // Post slider caption background color 'vc_post_slider_caption_bg' => 'wpb_js_vc_color_post_slider_caption_bg', // Progress bar background color 'vc_progress_bar_bg' => 'wpb_js_vc_color_progress_bar_bg', // Separator border color 'vc_separator_border' => 'wpb_js_vc_color_separator_border', // Tabs navigation background color 'vc_tab_bg' => 'wpb_js_vc_color_tab_bg', // Active tab background color 'vc_tab_bg_active' => 'wpb_js_vc_color_tab_bg_active', // Elements bottom margin 'vc_element_margin_bottom' => array( 'key' => 'wpb_js_margin', 'default' => vc_settings()->getDefault( 'margin' ), ), // Grid gutter width 'grid-gutter-width' => array( 'key' => 'wpb_js_gutter', 'default' => vc_settings()->getDefault( 'gutter' ), 'modify_output' => array( array( 'plain' => array( '{{ value }}px', ), ), ), ), 'screen-sm-min' => array( 'key' => 'wpb_js_responsive_max', 'default' => vc_settings()->getDefault( 'responsive_max' ), 'modify_output' => array( array( 'plain' => array( '{{ value }}px', ), ), ), ), ) ) ); return $submitButtonAttributes; } function vc_page_settings_desing_options_load() { add_filter( 'vc_settings-tab-submit-button-attributes-color', 'vc_page_settings_tab_color_submit_attributes' ); wp_enqueue_script( 'vc_less_js', vc_asset_url( 'lib/bower/lessjs/dist/less.min.js' ), array(), WPB_VC_VERSION ); } add_action( 'vc-settings-render-tab-vc-color', 'vc_page_settings_desing_options_load' ); vc-shortcode-autoloader.php 0000666 00000014477 15214117146 0012035 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } class VcShortcodeAutoloader { private static $_instance = null; private static $config = null; private static $cached = null; public static function getInstance( $load_config = true ) { if ( null === self::$_instance ) { self::$_instance = new VcShortcodeAutoloader( $load_config ); } return self::$_instance; } private function __construct( $load_config = true ) { if ( ! $load_config ) { return; } $config = array( 'classmap_file' => vc_path_dir( 'APP_ROOT', 'vc_classmap.json.php' ), 'shortcodes_dir' => vc_path_dir( 'SHORTCODES_DIR' ), 'root_dir' => vc_path_dir( 'APP_ROOT' ), ); if ( is_file( $config['classmap_file'] ) ) { $config['classmap'] = require $config['classmap_file']; self::$cached = true; } else { $config['classmap'] = self::generateClassMap( $config['shortcodes_dir'] ); self::$cached = false; } self::$config = $config; } /** * Include class dependencies * * @param string $class Class name * * @return string[] Included (if any) files */ public static function includeClass( $class ) { $class = strtolower( $class ); $files = array(); if ( self::$config['classmap'] ) { $files = isset( self::$config['classmap'][ $class ] ) ? self::$config['classmap'][ $class ] : array(); } if ( $files ) { foreach ( $files as $k => $file ) { if ( self::$cached ) { $files[ $k ] = $file = self::$config['root_dir'] . DIRECTORY_SEPARATOR . $file; } if ( is_file( $file ) ) { require_once( $file ); } } } return $files; } /** * Find all classes defined in file * * @param string $file Full path to file * * @return string[] */ public static function extractClassNames( $file ) { $classes = array(); $contents = file_get_contents( $file ); if ( ! $contents ) { return $classes; } $tokens = token_get_all( $contents ); $class_token = false; foreach ( $tokens as $token ) { if ( is_array( $token ) ) { if ( T_CLASS == $token[0] ) { $class_token = true; } elseif ( $class_token && T_STRING == $token[0] ) { $classes[] = $token[1]; $class_token = false; } } } return $classes; } /** * Extract all classes from file with their extends * * @param $file * * @return array Associative array where key is class name and value is parent class name (if any)) */ public static function extractClassesAndExtends( $file ) { $classes = array(); $contents = file_get_contents( $file ); if ( ! $contents ) { return $classes; } // class Foo extends Bar { preg_match_all( '/class\s+(\w+)\s+extends\s(\w+)\s+\{/i', $contents, $matches, PREG_SET_ORDER ); foreach ( $matches as $v ) { $classes[ $v[1] ] = $v[2]; } // class Foo { preg_match_all( '/class\s+(\w+)\s+\{/i', $contents, $matches, PREG_SET_ORDER ); foreach ( $matches as $v ) { $classes[ $v[1] ] = null; } return $classes; } /** * Find file by class name * * Search is case-insensitive * * @param string $class * @param string[]|string $dirs One or more directories where to look (recursive) * * @return string|false Full path to class file */ public static function findClassFile( $class, $dirs ) { foreach ( (array) $dirs as $dir ) { $Directory = new RecursiveDirectoryIterator( $dir ); $Iterator = new RecursiveIteratorIterator( $Directory ); $Regex = new RegexIterator( $Iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH ); $class = strtolower( $class ); foreach ( $Regex as $file => $object ) { $classes = self::extractClassNames( $file ); if ( $classes && in_array( $class, array_map( 'strtolower', $classes ) ) ) { return $file; } } } return false; } /** * Construct full dependency list of classes for each class in right order (including class itself) * * @param string[]|string $dirs Directories where to look (recursive) * * @return array Associative array where key is lowercase class name and value is array of files to include for * that class to work */ public static function generateClassMap( $dirs ) { $flat_map = array(); foreach ( (array) $dirs as $dir ) { $Directory = new RecursiveDirectoryIterator( $dir ); $Iterator = new RecursiveIteratorIterator( $Directory ); $Regex = new RegexIterator( $Iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH ); foreach ( $Regex as $file => $object ) { $classes = self::extractClassesAndExtends( $file ); foreach ( $classes as $class => $extends ) { $class = strtolower( $class ); $extends = strtolower( $extends ); if ( in_array( $extends, array( 'wpbakeryshortcodescontainer', 'wpbakeryvisualcomposer', 'wpbakeryshortcode', 'wpbmap', ) ) ) { $extends = null; } $flat_map[ $class ] = array( 'class' => $class, 'file' => $file, 'extends' => $extends, ); } } } $map = array(); foreach ( $flat_map as $params ) { $dependencies = array( array( 'class' => $params['class'], 'file' => $params['file'], ), ); if ( $params['extends'] ) { $queue = array( $params['extends'] ); while ( $queue ) { $current_class = array_pop( $queue ); $current_class = $flat_map[ $current_class ]; $dependencies[] = array( 'class' => $current_class['class'], 'file' => $current_class['file'], ); if ( ! empty( $current_class['extends'] ) ) { $queue[] = $current_class['extends']; } } $map[ $params['class'] ] = array_reverse( $dependencies ); } else { $map[ $params['class'] ] = $dependencies; } } // simplify array $classmap = array(); foreach ( $map as $class => $dependencies ) { $classmap[ $class ] = array(); foreach ( $dependencies as $v ) { $classmap[ $class ][] = str_replace( '\\', '/', $v['file'] ); } } return $classmap; } /** * Regenerate and save class map file * * @param string[]|string $dirs Directories where to look (recursive) * @param string $target Output file * * @return bool */ public static function saveClassMap( $dirs, $target ) { if ( ! $target ) { return false; } $classmap = self::generateClassMap( $dirs ); $code = '<?php return (array) json_decode(\'' . json_encode( $classmap ) . '\') ?>'; return (bool) file_put_contents( $target, $code ); } } vc-pointers-frontend-editor.php 0000666 00000005104 15214117146 0012635 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Add WP ui pointers to backend editor. */ function vc_frontend_editor_pointer() { vc_is_frontend_editor() && add_filter( 'vc-ui-pointers', 'vc_frontend_editor_register_pointer' ); } add_action( 'admin_init', 'vc_frontend_editor_pointer' ); function vc_frontend_editor_register_pointer( $pointers ) { global $post; if ( is_object( $post ) && ! strlen( $post->post_content ) ) { $pointers['vc_pointers_frontend_editor'] = array( 'name' => 'vcPointerController', 'messages' => array( array( 'target' => '#vc_add-new-element', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s </p>', __( 'Add Elements', 'js_composer' ), __( 'Add new element or start with a template.', 'js_composer' ) ), 'position' => array( 'edge' => 'top', 'align' => 'left', ), 'buttonsEvent' => 'vcPointersEditorsTourEvents', ), 'closeEvent' => 'shortcodes:add', ), array( 'target' => '.vc_controls-out-tl:first', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s </p>', __( 'Rows and Columns', 'js_composer' ), __( 'This is a row container. Divide it into columns and style it. You can add elements into columns.', 'js_composer' ) ), 'position' => array( 'edge' => 'left', 'align' => 'center', ), 'buttonsEvent' => 'vcPointersEditorsTourEvents', ), 'closeCallback' => 'vcPointersCloseInIFrame', 'showCallback' => 'vcPointersSetInIFrame', ), array( 'target' => '.vc_controls-cc:first', 'options' => array( 'content' => sprintf( '<h3> %s </h3> <p> %s <br/><br/> %s</p>', __( 'Control Elements', 'js_composer' ), __( 'You can edit your element at any time and drag it around your layout.', 'js_composer' ), sprintf( __( 'P.S. Learn more at our <a href="%s" target="_blank">Knowledge Base</a>.', 'js_composer' ), 'http://kb.wpbakery.com' ) ), 'position' => array( 'edge' => 'left', 'align' => 'center', ), 'buttonsEvent' => 'vcPointersEditorsTourEvents', ), 'closeCallback' => 'vcPointersCloseInIFrame', 'showCallback' => 'vcPointersSetInIFrame', ), ), ); } return $pointers; } // @todo check is this correct place (editable page) function vc_page_editable_enqueue_pointer_scripts() { if ( vc_is_page_editable() ) { wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'wp-pointer' ); } } add_action( 'wp_enqueue_scripts', 'vc_page_editable_enqueue_pointer_scripts' );
dvadf
dvadf
| ver. 1.4 |
Github
|
.
| PHP 7.0.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings