This commit is contained in:
KhaiNguyen
2020-02-13 10:39:37 +07:00
commit 59401cb805
12867 changed files with 4646216 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?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 class-vc-wxr-parser-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',
) );
}
}

View File

@@ -0,0 +1,22 @@
<?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 class-vc-wxr-parser-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
}

View File

@@ -0,0 +1,106 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/**
* @since 4.4 vendors initialization moved to hooks in autoload/vendors.
*
* Used to add gravity forms shortcode into WPBakery Page Builder
*/
add_action( 'plugins_loaded', 'vc_init_vendor_gravity_forms' );
function vc_init_vendor_gravity_forms() {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require class-vc-wxr-parser-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[ esc_html__( 'No Gravity forms found.', 'js_composer' ) ] = '';
if ( class_exists( 'RGFormsModel' ) ) {
/** @noinspection PhpUndefinedClassInspection */
$gravity_forms = RGFormsModel::get_forms( 1, 'title' );
if ( $gravity_forms ) {
$gravity_forms_array = array( esc_html__( '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' => 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,
),
),
),
) );
}

View File

@@ -0,0 +1,89 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/**
* @param $post
* @return bool
*/
function vcv_disable_gutenberg_for_classic_editor( $post ) {
return false;
}
/**
* @param \Vc_Settings $settings
*/
function vc_gutenberg_add_settings( $settings ) {
global $wp_version;
if ( function_exists( 'the_gutenberg_project' ) || version_compare( $wp_version, '4.9.8', '>' ) ) {
$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;
?>
<label>
<input type="checkbox"<?php echo esc_attr( $checked ) ? ' checked' : ''; ?> value="1"
name="<?php echo 'wpb_js_gutenberg_disable' ?>">
<?php esc_html_e( 'Disable', 'js_composer' ) ?>
</label><br/>
<p
class="description indicator-hint"><?php esc_html_e( 'Disable Gutenberg Editor.', 'js_composer' ); ?></p>
<?php
}
/**
* @param $result
* @param $postType
* @return bool
*/
function vc_gutenberg_check_disabled( $result, $postType ) {
if ( 'wpb_gutenberg_param' === $postType ) {
return true;
}
if ( ! isset( $_GET['vcv-gutenberg-editor'] ) && ( get_option( 'wpb_js_gutenberg_disable' ) || vc_is_wpb_content() || isset( $_GET['classic-editor'] ) ) ) {
return false;
}
return $result;
}
/**
* @return bool
*/
function vc_is_wpb_content() {
$post = get_post();
if ( ! empty( $post ) && isset( $post->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( 'use_block_editor_for_post_type', 'vc_gutenberg_check_disabled', 10, 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();

View File

@@ -0,0 +1,18 @@
<?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();
}
}

View File

@@ -0,0 +1,19 @@
<?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 class-vc-wxr-parser-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();
}
}

View File

@@ -0,0 +1,22 @@
<?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 class-vc-wxr-parser-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',
) );
}
}

View File

@@ -0,0 +1,22 @@
<?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 class-vc-wxr-parser-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',
) );
}
}

View File

@@ -0,0 +1,21 @@
<?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',
) );
}
}

View File

@@ -0,0 +1,22 @@
<?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 class-vc-wxr-parser-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',
) );
}
}

View File

@@ -0,0 +1,19 @@
<?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 class-vc-wxr-parser-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();
}
}

View File

@@ -0,0 +1,41 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
return array(
'name' => 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' => '<!-- wp:paragraph --><p>Hello! This is the Gutenberg block you can edit directly from the WPBakery Page Builder.</p><!-- /wp:paragraph -->',
),
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' ), '<a href="https://www.w3schools.com/tags/att_global_id.asp" target="_blank">', '</a>' ),
),
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' ),
),
),
);

View File

@@ -0,0 +1,41 @@
<?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 class-vc-wxr-parser-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' );
}
}

View File

@@ -0,0 +1,16 @@
<?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',
) );
}
}

View File

@@ -0,0 +1,27 @@
<?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 );
function vc_init_vendor_yoast() {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Require class-vc-wxr-parser-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() ) {
$vendor->frontendEditorBuild();
}
}
}