PK ! wf f ! autoload/hook-vc-progress-bar.phpnu [ includeClass( 'WPBakeryShortCode_Vc_Progress_Bar' );
add_filter( 'vc_edit_form_fields_attributes_vc_progress_bar', array(
'WPBakeryShortCode_Vc_Progress_Bar',
'convertAttributesToNewProgressBar',
) );
}
PK ! 1/T T autoload/hook-vc-message.phpnu [ includeClass( 'WPBakeryShortCode_Vc_Message' );
add_filter( 'vc_edit_form_fields_attributes_vc_message', array(
'WPBakeryShortCode_Vc_Message',
'convertAttributesToMessageBox2',
) );
}
PK ! Zm5QS S autoload/hook-vc-wp-text.phpnu [ includeClass( 'WPBakeryShortCode_Vc_Wp_Text' );
add_filter( 'vc_edit_form_fields_attributes_vc_wp_text', array(
'WPBakeryShortCode_Vc_Wp_Text',
'convertTextAttributeToContent',
) );
}
PK ! h ! autoload/bc-multisite-options.phpnu [ 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 );
}
PK ! ڃ8
8
( autoload/vc-pointers-frontend-editor.phpnu [ post_content ) ) {
$pointers['vc_pointers_frontend_editor'] = array(
'name' => 'vcPointerController',
'messages' => array(
array(
'target' => '#vc_add-new-element',
'options' => array(
'content' => sprintf( '
%s %s
', esc_html__( 'Add Elements', 'js_composer' ), esc_html__( '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( ' %s %s
', esc_html__( 'Rows and Columns', 'js_composer' ), esc_html__( '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( ' %s %s %s
', esc_html__( 'Control Elements', 'js_composer' ), esc_html__( 'You can edit your element at any time and drag it around your layout.', 'js_composer' ), sprintf( esc_html__( 'P.S. Learn more at our %sKnowledge Base%s.', 'js_composer' ), '', ' ' ) ),
'position' => array(
'edge' => 'left',
'align' => 'center',
),
'buttonsEvent' => 'vcPointersEditorsTourEvents',
),
'closeCallback' => 'vcPointersCloseInIFrame',
'showCallback' => 'vcPointersSetInIFrame',
),
),
);
}
return $pointers;
}
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' );
PK ! > > autoload/hook-vc-pie.phpnu [ includeClass( 'WPBakeryShortCode_Vc_Pie' );
add_filter( 'vc_edit_form_fields_attributes_vc_pie', array(
'WPBakeryShortCode_Vc_Pie',
'convertOldColorsToNew',
) );
}
PK ! %;- autoload/params-to-init.phpnu [ ' . $data . '' . $custom_tag . '>';
echo $output;
}
add_action( 'wp_ajax_wpb_gallery_html', 'vc_gallery_html' );
function vc_gallery_html() {
vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie();
$images = vc_post_param( 'content' );
if ( ! empty( $images ) ) {
wp_send_json_success( vc_field_attached_images( explode( ',', $images ) ) );
}
die();
}
PK ! G autoload/bc-access-rules-4.8.phpnu [ get( 'content_types' );
if ( empty( $content_types ) ) {
$state = true;
} else {
$state = 'custom';
}
}
return $state;
}
/**
* @param $value
* @param $role
* @param $rule
* @return bool
* @throws \Exception
*/
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, true );
}
return $value;
}
// Part BC: shortcodes
// =========================
/**
* @param $state
* @param $role
* @return bool|string
*/
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;
}
/**
* @param $value
* @param $role
* @param $rule
* @return bool
* @throws \Exception
*/
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
* @throws \Exception
*/
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
// ===========================
/**
* @param $state
* @param $role
* @return bool|string
*/
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;
}
/**
* @param $state
* @param $role
* @return bool
*/
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;
}
/**
* @param $value
* @param $role
* @return bool
* @throws \Exception
*/
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;
}
/**
* @param $role
* @return mixed
* @throws \Exception
*/
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' );
PK ! a ' autoload/post-type-default-template.phpnu [ isValidPostType( $post->post_type ) ) {
return $post_content;
}
$template_settings = new Vc_Setting_Post_Type_Default_Template_Field( 'general', 'default_template_post_type' );
$new_post_content = $template_settings->getTemplateByPostType( $post->post_type );
if ( null !== $new_post_content ) {
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;
/**
* Vc_Setting_Post_Type_Default_Template_Field constructor.
* @param $tab
* @param $key
*/
public function __construct( $tab, $key ) {
$this->tab = $tab;
$this->key = $key;
add_action( 'vc_settings_tab-general', array(
$this,
'addField',
) );
}
/**
* @return string
*/
protected function getFieldName() {
return esc_html__( 'Default template for post types', 'js_composer' );
}
/**
* @return string
*/
protected function getFieldKey() {
require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-settings.php' );
return Vc_Settings::getFieldPrefix() . $this->key;
}
/**
* @param $type
* @return bool
*/
protected function isValidPostType( $type ) {
return post_type_exists( $type );
}
/**
* @return array|bool
*/
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;
}
/**
* @return array
*/
protected function getTemplates() {
return $this->getTemplatesEditor()->getAllTemplates();
}
/**
* @return bool|\Vc_Templates_Panel_Editor
*/
protected function getTemplatesEditor() {
return visual_composer()->templatesPanelEditor();
}
/**
* Get settings data for default templates
*
* @return array|mixed
*/
protected function get() {
require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-settings.php' );
$value = Vc_Settings::get( $this->key );
return $value ? $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( (int) $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;
}
/**
* @param $type
* @return string|null
*/
public function getTemplateByPostType( $type ) {
$value = $this->get();
return isset( $value[ $type ] ) ? $this->getTemplate( $value[ $type ] ) : null;
}
/**
* @param $settings
* @return mixed
*/
public function sanitize( $settings ) {
foreach ( $settings as $type => $template ) {
if ( empty( $template ) ) {
unset( $settings[ $type ] );
} elseif ( ! $this->isValidPostType( $type ) || ! $this->getTemplate( $template ) ) {
add_settings_error( $this->getFieldKey(), 1, esc_html__( '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 );
}
PK ! ܦHD D ' autoload/vc-pointers-backend-editor.phpnu [ is_block_editor() ) {
$block = true;
}
}
if ( ! $block || 'add' === $screen->action ) {
$pointers['vc_pointers_backend_editor'] = array(
'name' => 'vcPointerController',
'messages' => array(
array(
'target' => '.composer-switch',
'options' => array(
'content' => sprintf( ' %s %s
', esc_html__( 'Welcome to WPBakery Page Builder', 'js_composer' ), esc_html__( '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( ' %s %s
', esc_html__( 'Add Elements', 'js_composer' ), esc_html__( '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( ' %s %s
', esc_html__( 'Rows and Columns', 'js_composer' ), esc_html__( '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( ' %s %s %s
', esc_html__( 'Control Elements', 'js_composer' ), esc_html__( 'You can edit your element at any time and drag it around your layout.', 'js_composer' ), sprintf( esc_html__( 'P.S. Learn more at our %sKnowledge Base%s.', 'js_composer' ), '', ' ' ) ),
'position' => array(
'edge' => 'left',
'align' => 'center',
),
'buttonsEvent' => 'vcPointersEditorsTourEvents',
),
'showCallback' => 'vcPointersShowOnContentElementControls',
'closeEvent' => 'click #wpb_visual_composer',
),
),
);
}
return $pointers;
}
PK ! x autoload/hook-vc-grid.phpnu [ 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]]
}
/**
* @param array $settings
* @param $post_id
* @param $post
*
* @return array
* @since 4.4.3
*
*/
public function gridSavePostSettingsId( array $settings, $post_id, $post ) {
$pattern = $this->getShortcodeRegexForId();
$content = stripslashes( $post->post_content );
preg_match_all( "/$pattern/", $content, $found ); // fetch only needed shortcodes
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 array $atts */
$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;
}
/**
* @throws \Exception
* @since 4.4
*
* @output/@return string - grid data for ajax request.
*/
public function getGridDataForAjax() {
$tag = str_replace( '.', '', 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 ) && vc_get_shortcode( $tag ) ) {
/** @var WPBakeryShortcode_Vc_Basic_Grid $vc_grid */
$vc_grid = $shortcode_fishbone->shortcodeClass();
if ( method_exists( $vc_grid, 'isObjectPageable' ) && $vc_grid->isObjectPageable() && method_exists( $vc_grid, 'renderAjax' ) ) {
// @codingStandardsIgnoreLine
$renderAjaxResponse = apply_filters( 'vc_get_vc_grid_data_response', $vc_grid->renderAjax( vc_request_param( 'data' ), $tag, $vc_grid ) );
wp_die( $renderAjaxResponse );
}
}
}
}
}
/**
* @since 4.4
* @var Vc_Hooks_Vc_Grid $hook
*/
$hook = new Vc_Hooks_Vc_Grid();
// when WPBakery Page Builder 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',
) );
}
PK ! autoload/params/hidden.phpnu [ ' . '';
$vc_grid_item_templates = Vc_Grid_Item::predefinedTemplates();
if ( is_array( $vc_grid_item_templates ) ) {
foreach ( $vc_grid_item_templates as $key => $data ) {
$output .= '' . esc_html( $data['name'] ) . ' ';
}
}
$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 .= 'ID === $value ? ' selected="true"' : '' ) . '>' . esc_html( $post->post_title ) . ' ';
}
$output .= ' ';
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' );
/**
* @param $target
* @return string
*/
function vc_gitem_post_data_get_link_target_frontend_editor( $target ) {
return ' target="_blank"';
}
/**
* @param $rel
* @return string
*/
function vc_gitem_post_data_get_link_rel_frontend_editor( $rel ) {
return ' rel="' . esc_attr( $rel ) . '"';
}
/**
* @param $atts
* @param string $default_class
* @param string $title
* @return string
*/
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_url( $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 );
}
/**
* @param $atts
* @param $post
* @param string $default_class
* @param string $title
* @return string
*/
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'];
}
$link_css_class = trim( preg_replace( '/\s+/', ' ', $link_css_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_url( $link['url'] ) . '" class="' . esc_attr( $link_css_class ) . '"';
} elseif ( 'post_link' === $atts['link'] ) {
$link = 'a href="' . esc_url( 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="' . esc_url( $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 );
}
/**
* @param $link
* @return string
*/
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' );
}
PK ! E ) autoload/vc-pages/page-design-options.phpnu [ 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 = esc_html__( 'Important notice', 'js_composer' );
if ( is_object( $current_screen ) && isset( $current_screen->id ) && 'visual-composer_page_vc-color' === $current_screen->id ) {
$message = esc_html__( 'You have an outdated version of WPBakery Page Builder Design Options. It is required to review and save it.', 'js_composer' );
echo '' . esc_html( $message_important ) . ' : ' . esc_html( $message ) . '
';
} else {
$message = esc_html__( 'You have an outdated version of WPBakery Page Builder Design Options. It is required to review and save it.', 'js_composer' );
$btnClass = 'button button-primary button-large vc_button-settings-less';
echo '';
}
}
/**
* @param $submitButtonAttributes
* @return mixed
*/
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'] = wp_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, true );
}
add_action( 'vc-settings-render-tab-vc-color', 'vc_page_settings_desing_options_load' );
PK ! W # autoload/vc-pages/settings-tabs.phpnu [ 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' );
}
PK ! *0Q Q % autoload/vc-pages/page-custom-css.phpnu [ $value ) {
$new[ $key ] = $value;
if ( 'vc-general' === $key ) {
$new['vc-roles'] = esc_html__( 'Role Manager', 'js_composer' );
}
}
$tabs = $new;
} else {
$tabs['vc-roles'] = esc_html__( 'Roles Manager', 'js_composer' );
}
return $tabs;
}
if ( ! is_network_admin() ) {
add_filter( 'vc_settings_tabs', 'vc_settings_tabs_vc_roles' );
}
/**
* @return string
*/
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 wp_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' );
}
PK ! =v v $ autoload/vc-pages/welcome-screen.phpnu [ render();
}
}
function vc_page_welcome_add_sub_page() {
// Add submenu page
$page = add_submenu_page( VC_PAGE_MAIN_SLUG, esc_html__( 'About', 'js_composer' ), esc_html__( 'About', 'js_composer' ), 'edit_posts', 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' );
if ( $redirect ) {
wp_safe_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' );
/**
* @return mixed|void
*/
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' => esc_html__( 'What\'s New', 'js_composer' ),
'vc-faq' => esc_html__( 'FAQ', 'js_composer' ),
'vc-resources' => esc_html__( 'Resources', 'js_composer' ),
) );
return $vc_page_welcome_tabs;
}
PK ! icS autoload/vc-pages/pages.phpnu [ 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( esc_html__( 'WPBakery Page Builder', 'js_composer' ), esc_html__( 'WPBakery Page Builder', 'js_composer' ), 'edit_posts', VC_PAGE_MAIN_SLUG, null, vc_asset_url( 'vc/logo/wpb-logo-white_32.svg' ), 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( esc_html__( 'WPBakery Page Builder', 'js_composer' ), esc_html__( 'WPBakery Page Builder', 'js_composer' ), 'exist', VC_PAGE_MAIN_SLUG, null, vc_asset_url( 'vc/logo/wpb-logo-white_32.svg' ), 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' );
PK ! / autoload/vc-pages/automapper.phpnu [ wpAny( 'manage_options' )->part( 'settings' )->can( 'vc-automapper-tab' )->get() ) {
vc_automapper()->addAjaxActions();
}
}
/**
* Returns automapper template.
*
* @return string
* @since 4.5
*/
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() && ( strpos( vc_request_param( 'action' ), 'vc_automapper' ) !== false || 'vc-automapper' === vc_get_param( 'page' ) ) && add_action( 'admin_init', 'vc_automapper_init' );
PK ! `#R R autoload/vc-settings-presets.phpnu [ 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 );
}
/**
* @param $shortcodes
* @return array
* @throws \Exception
*/
function vc_add_new_elements_to_box( $shortcodes ) {
require_once vc_path_dir( 'AUTOLOAD_DIR', 'class-vc-settings-presets.php' );
return Vc_Settings_Preset::addVcPresetsToShortcodes( $shortcodes );
}
/**
* @param $cat
* @return array
*/
function vc_add_new_category_filter( $cat ) {
require_once vc_path_dir( 'AUTOLOAD_DIR', 'class-vc-settings-presets.php' );
return Vc_Settings_Preset::addPresetCategory( $cat );
}
PK ! ~ autoload/ui-vc-pointers.phpnu [ 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, true ) || 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' => esc_html__( 'Finish', 'js_composer' ),
'next' => esc_html__( 'Next', 'js_composer' ),
'prev' => esc_html__( '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' );
PK ! ˋS S $ autoload/vc-shortcode-autoloader.phpnu [ loadConfig();
}
/**
* Include class dependencies
*
* @param string $class Class name
*
* @return string[] Included (if any) files
*/
public static function includeClass( $class ) {
// call the constructor (php 7.4 compat)
self::getInstance();
if ( ! is_array( self::$config ) ) {
self::loadConfig();
}
$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();
// @codingStandardsIgnoreLine
$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();
// @codingStandardsIgnoreLine
$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 ), true ) ) {
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',
), true ) ) {
$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 );
// @codingStandardsIgnoreLine
$code = '';
// @codingStandardsIgnoreLine
return (bool) file_put_contents( $target, $code );
}
protected static function loadConfig() {
$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;
}
}
PK ! 2JR$ R$ autoload/vc-image-filters.phpnu [ esc_html__( 'Antique', 'js_composer' ),
'blackwhite' => esc_html__( 'Black & White', 'js_composer' ),
'boost' => esc_html__( 'Boost', 'js_composer' ),
'concentrate' => esc_html__( 'Concentrate', 'js_composer' ),
'country' => esc_html__( 'Country', 'js_composer' ),
'darken' => esc_html__( 'Darken', 'js_composer' ),
'dream' => esc_html__( 'Dream', 'js_composer' ),
'everglow' => esc_html__( 'Everglow', 'js_composer' ),
'forest' => esc_html__( 'Forest', 'js_composer' ),
'freshblue' => esc_html__( 'Fresh Blue', 'js_composer' ),
'frozen' => esc_html__( 'Frozen', 'js_composer' ),
'hermajesty' => esc_html__( 'Her Majesty', 'js_composer' ),
'light' => esc_html__( 'Light', 'js_composer' ),
'orangepeel' => esc_html__( 'Orange Peel', 'js_composer' ),
'rain' => esc_html__( 'Rain', 'js_composer' ),
'retro' => esc_html__( 'Retro', 'js_composer' ),
'sepia' => esc_html__( 'Sepia', 'js_composer' ),
'summer' => esc_html__( 'Summer', 'js_composer' ),
'tender' => esc_html__( 'Tender', 'js_composer' ),
'vintage' => esc_html__( 'Vintage', 'js_composer' ),
'washed' => esc_html__( 'Washed', 'js_composer' ),
);
}
/**
* Add Image Filter field to media uploader
*
* @param array $form_fields , fields to include in attachment form
* @param object $post , 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 = '' . esc_html__( 'None', 'js_composer' ) . ' ';
foreach ( $options as $value => $title ) {
$html_options .= '' . esc_html( $title ) . ' ';
}
$form_fields['vc-image-filter'] = array(
'label' => '',
'input' => 'html',
'html' => '
' . esc_html__( 'Image filter', 'js_composer' ) . '
' . $html_options . '
',
'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( 'HELPERS_DIR', 'class-vc-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
* @throws \Exception
*/
function vc_media_editor_preview_image() {
vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'upload_files' )->validateDie();
require_once vc_path_dir( 'HELPERS_DIR', 'class-vc-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();
// @codingStandardsIgnoreLine
$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 array $media_meta , meta to include in attachment form
* @param object $post , attachment record in database
*
* @return array|string
*/
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 .= esc_html__( 'Filter:', 'js_composer' ) . ' ' . $filters[ $filter_name ];
return $media_meta;
}
PK ! ͧC
% autoload/hook-vc-iconpicker-param.phpnu [ load();
}
}
PK ! l~H H autoload/vendors/jwplayer.phpnu [ load();
}
}
PK ! |O ! autoload/vendors/qtranslate-x.phpnu [ load();
}
}
PK ! J autoload/vendors/gutenberg.phpnu [ ' ) ) {
$settings->addField( 'general', esc_html__( 'Disable Gutenberg Editor', 'js_composer' ), 'gutenberg_disable', 'vc_gutenberg_sanitize_disable_callback', 'vc_gutenberg_disable_render_callback' );
}
}
/**
* @param $rules
*
* @return mixed
*/
function vc_gutenberg_sanitize_disable_callback( $rules ) {
return (bool) $rules;
}
/**
* Not responsive checkbox callback function
*/
function vc_gutenberg_disable_render_callback() {
$checked = ( $checked = get_option( 'wpb_js_gutenberg_disable' ) ) ? $checked : false;
?>
value="1"
name="">
post_content ) && preg_match( '/\[vc_row/', $post->post_content ) ) {
return true;
}
return false;
}
function vc_gutenberg_map() {
global $wp_version;
if ( function_exists( 'the_gutenberg_project' ) || version_compare( $wp_version, '4.9.8', '>' ) ) {
vc_lean_map( 'vc_gutenberg', null, dirname( __FILE__ ) . '/shortcode-vc-gutenberg.php' );
}
}
add_filter( 'classic_editor_enabled_editors_for_post', 'vc_gutenberg_check_disabled_regular', 10, 2 );
add_filter( 'use_block_editor_for_post_type', 'vc_gutenberg_check_disabled', 10, 2 );
add_filter( 'display_post_states', 'vc_classic_editor_post_states', 11, 2 );
add_action( 'vc_settings_tab-general', 'vc_gutenberg_add_settings' );
add_action( 'init', 'vc_gutenberg_map' );
/** @see include/params/gutenberg/class-vc-gutenberg-param.php */
require_once vc_path_dir( 'PARAMS_DIR', 'gutenberg/class-vc-gutenberg-param.php' );
new Vc_Gutenberg_Param();
PK ! D autoload/vendors/woocommerce.phpnu [ I ! autoload/vendors/rankmath-seo.phpnu [ post_content, '[vc_row' ) !== false ) {
preg_match_all( '/(?:image|images|ids|include)\=\"([^\"]+)\"/', $post->post_content, $matches );
foreach ( $matches[1] as $m ) {
$ids = explode( ',', $m );
foreach ( $ids as $id ) {
if ( (int) $id ) {
$images[] = array(
'src' => wp_get_attachment_url( $id ),
'title' => get_the_title( $id ),
);
}
}
}
}
}
return $images;
}
add_filter( 'rank_math/sitemap/urlimages', 'vc_rank_math_seo_image_filter', 10, 2 );PK ! l/S + autoload/vendors/shortcode-vc-gutenberg.phpnu [ esc_html__( 'Gutenberg Editor', 'js_composer' ),
'icon' => 'vc_icon-vc-gutenberg',
'wrapper_class' => 'clearfix',
'category' => esc_html__( 'Content', 'js_composer' ),
'description' => esc_html__( 'Insert Gutenberg editor in your layout', 'js_composer' ),
'weight' => - 10,
'params' => array(
array(
'type' => 'gutenberg',
'holder' => 'div',
'heading' => esc_html__( 'Text', 'js_composer' ),
'param_name' => 'content',
'value' => 'Hello! This is the Gutenberg block you can edit directly from the WPBakery Page Builder.
',
),
vc_map_add_css_animation(),
array(
'type' => 'el_id',
'heading' => esc_html__( 'Element ID', 'js_composer' ),
'param_name' => 'el_id',
'description' => sprintf( esc_html__( 'Enter element ID (Note: make sure it is unique and valid according to %sw3c specification%s).', 'js_composer' ), '', ' ' ),
),
array(
'type' => 'textfield',
'heading' => esc_html__( 'Extra class name', 'js_composer' ),
'param_name' => 'el_class',
'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
),
array(
'type' => 'css_editor',
'heading' => esc_html__( 'CSS box', 'js_composer' ),
'param_name' => 'css',
'group' => esc_html__( 'Design Options', 'js_composer' ),
),
),
);
PK ! %n " autoload/vendors/gravity_forms.phpnu [ '' );
foreach ( $gravity_forms as $gravity_form ) {
$gravity_forms_array[ $gravity_form->title ] = $gravity_form->id;
}
}
}
vc_map( array(
'name' => esc_html__( 'Gravity Form', 'js_composer' ),
'base' => 'gravityform',
'icon' => 'icon-wpb-vc_gravityform',
'category' => esc_html__( 'Content', 'js_composer' ),
'description' => esc_html__( 'Place Gravity form', 'js_composer' ),
'params' => array(
array(
'type' => 'dropdown',
'heading' => esc_html__( 'Form', 'js_composer' ),
'param_name' => 'id',
'value' => $gravity_forms_array,
'save_always' => true,
'description' => esc_html__( 'Select a form to add it to your post or page.', 'js_composer' ),
'admin_label' => true,
),
array(
'type' => 'dropdown',
'heading' => esc_html__( 'Display Form Title', 'js_composer' ),
'param_name' => 'title',
'value' => array(
esc_html__( 'No', 'js_composer' ) => 'false',
esc_html__( 'Yes', 'js_composer' ) => 'true',
),
'save_always' => true,
'description' => esc_html__( 'Would you like to display the forms title?', 'js_composer' ),
'dependency' => array(
'element' => 'id',
'not_empty' => true,
),
),
array(
'type' => 'dropdown',
'heading' => esc_html__( 'Display Form Description', 'js_composer' ),
'param_name' => 'description',
'value' => array(
esc_html__( 'No', 'js_composer' ) => 'false',
esc_html__( 'Yes', 'js_composer' ) => 'true',
),
'save_always' => true,
'description' => esc_html__( 'Would you like to display the forms description?', 'js_composer' ),
'dependency' => array(
'element' => 'id',
'not_empty' => true,
),
),
array(
'type' => 'dropdown',
'heading' => esc_html__( 'Enable AJAX?', 'js_composer' ),
'param_name' => 'ajax',
'value' => array(
esc_html__( 'No', 'js_composer' ) => 'false',
esc_html__( 'Yes', 'js_composer' ) => 'true',
),
'save_always' => true,
'description' => esc_html__( 'Enable AJAX submission?', 'js_composer' ),
'dependency' => array(
'element' => 'id',
'not_empty' => true,
),
),
array(
'type' => 'textfield',
'heading' => esc_html__( 'Tab Index', 'js_composer' ),
'param_name' => 'tabindex',
'description' => esc_html__( '(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,
),
),
),
) );
}
PK ! QD autoload/vendors/ninja_forms.phpnu [ frontendEditorBuild();
}
}
}
PK ! ! ! autoload/vendors/cf7.phpnu [ checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie();
$image_id = (int) vc_post_param( 'content' );
$params = vc_post_param( 'params' );
$post_id = (int) vc_post_param( 'post_id' );
$img_size = vc_post_param( 'size' );
$img = '';
if ( ! empty( $params['source'] ) ) {
$source = $params['source'];
} else {
$source = 'media_library';
}
switch ( $source ) {
case 'media_library':
case 'featured_image':
if ( 'featured_image' === $source ) {
if ( $post_id && has_post_thumbnail( $post_id ) ) {
$img_id = get_post_thumbnail_id( $post_id );
} else {
$img_id = 0;
}
} else {
$img_id = preg_replace( '/[^\d]/', '', $image_id );
}
if ( ! $img_size ) {
$img_size = 'thumbnail';
}
if ( $img_id ) {
$img = wp_get_attachment_image_src( $img_id, $img_size );
if ( $img ) {
$img = $img[0];
}
}
break;
case 'external_link':
if ( ! empty( $params['custom_src'] ) ) {
$img = $params['custom_src'];
}
break;
}
echo esc_url( $img );
die();
}
PK ! [ $ autoload/class-vc-vendor-presets.phpnu [ $shortcode,
'default' => $default,
'params' => $params,
'title' => $title,
);
// @codingStandardsIgnoreLine
$id = md5( serialize( $preset ) );
self::$presets[ $id ] = $preset;
return true;
}
/**
* Get specific vendor preset
*
* @param string $id
*
* @return mixed array|false
* @since 4.8
*
*/
public function get( $id ) {
if ( isset( self::$presets[ $id ] ) ) {
return self::$presets[ $id ];
}
return false;
}
/**
* Get all vendor presets for specific shortcode
*
* @param string $shortcode
*
* @return array
* @since 4.8
*
*/
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
*
* @return array
* @since 4.8
*
*/
public function getDefaults() {
$list = array();
$added = array();
foreach ( self::$presets as $id => $preset ) {
if ( $preset['default'] && ! in_array( $preset['shortcode'], $added, true ) ) {
$added[] = $preset['shortcode'];
$list[ $id ] = $preset;
}
}
return $list;
}
/**
* Get ID of default preset for specific shortcode
*
* If multiple presets are default, return first
*
* @param string $shortcode
*
* @return string|null
* @since 4.8
*
*/
public function getDefaultId( $shortcode ) {
foreach ( self::$presets as $id => $preset ) {
if ( $shortcode === $preset['shortcode'] && $preset['default'] ) {
return $id;
}
}
return null;
}
}
PK ! J/ / autoload/vc-undoredo.phpnu [ = VC 4.8",
"post-type-default-template.php": "Load default templates",
"bc-multisite-options.php": "BC for multisite options",
"vc-undoredo.php": "Undo Redo logic"
}PK !
l% % autoload/vc-grid-item-editor.phpnu [ 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' );
}
/**
* @param $pointers
* @return mixed
*/
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( ' %s %s
', esc_html__( 'Start Here!', 'js_composer' ), esc_html__( '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( ' %s %s
', esc_html__( 'Use Animations', 'js_composer' ), esc_html__( '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( ' %s %s
', esc_html__( 'Style Design Options', 'js_composer' ), esc_html__( '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( ' %s %s
', esc_html__( 'Extend Element', 'js_composer' ), esc_html__( 'Additional content zone can be added to grid element edges (Note: This zone can not be animated).', 'js_composer' ) ) . '
',
'position' => array(
'edge' => 'right',
'align' => 'center',
),
),
),
array(
'target' => '#wpadminbar',
'options' => array(
'content' => sprintf( ' %s %s', esc_html__( 'Watch Video Tutorial', 'js_composer' ), '' . esc_html__( 'Have a look how easy it is to work with grid element builder.', 'js_composer' ) . '
' . 'VIDEO ' ),
'position' => array(
'edge' => 'top',
'align' => 'center',
),
'pointerClass' => 'vc_gitem-animated-block-pointer-video',
'pointerWidth' => '530',
),
),
),
);
}
return $pointers;
}
/**
* @return array|mixed|void
*/
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 );
}
/**
* @param $content
* @return false|int
*/
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 WPBakery Page Builder 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' );
PK ! $ $ &