khaihihi
This commit is contained in:
@@ -0,0 +1,537 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Vc_ParamAnimation
|
||||
*
|
||||
* For working with animations
|
||||
* array(
|
||||
* 'type' => 'animation_style',
|
||||
* 'heading' => esc_html__( 'Animation', 'js_composer' ),
|
||||
* 'param_name' => 'animation',
|
||||
* ),
|
||||
* Preview in https://daneden.github.io/animate.css/
|
||||
* @since 4.4
|
||||
*/
|
||||
class Vc_ParamAnimation {
|
||||
/**
|
||||
* @since 4.4
|
||||
* @var array $settings parameter settings from vc_map
|
||||
*/
|
||||
protected $settings;
|
||||
/**
|
||||
* @since 4.4
|
||||
* @var string $value parameter value
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* Define available animation effects
|
||||
* @return array
|
||||
* @since 4.4
|
||||
* vc_filter: vc_param_animation_style_list - to override animation styles
|
||||
* array
|
||||
*/
|
||||
protected function animationStyles() {
|
||||
$styles = array(
|
||||
array(
|
||||
'values' => array(
|
||||
esc_html__( 'None', 'js_composer' ) => 'none',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Attention Seekers', 'js_composer' ),
|
||||
'values' => array(
|
||||
// text to display => value
|
||||
esc_html__( 'bounce', 'js_composer' ) => array(
|
||||
'value' => 'bounce',
|
||||
'type' => 'other',
|
||||
),
|
||||
esc_html__( 'flash', 'js_composer' ) => array(
|
||||
'value' => 'flash',
|
||||
'type' => 'other',
|
||||
),
|
||||
esc_html__( 'pulse', 'js_composer' ) => array(
|
||||
'value' => 'pulse',
|
||||
'type' => 'other',
|
||||
),
|
||||
esc_html__( 'rubberBand', 'js_composer' ) => array(
|
||||
'value' => 'rubberBand',
|
||||
'type' => 'other',
|
||||
),
|
||||
esc_html__( 'shake', 'js_composer' ) => array(
|
||||
'value' => 'shake',
|
||||
'type' => 'other',
|
||||
),
|
||||
esc_html__( 'swing', 'js_composer' ) => array(
|
||||
'value' => 'swing',
|
||||
'type' => 'other',
|
||||
),
|
||||
esc_html__( 'tada', 'js_composer' ) => array(
|
||||
'value' => 'tada',
|
||||
'type' => 'other',
|
||||
),
|
||||
esc_html__( 'wobble', 'js_composer' ) => array(
|
||||
'value' => 'wobble',
|
||||
'type' => 'other',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Bouncing Entrances', 'js_composer' ),
|
||||
'values' => array(
|
||||
// text to display => value
|
||||
esc_html__( 'bounceIn', 'js_composer' ) => array(
|
||||
'value' => 'bounceIn',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'bounceInDown', 'js_composer' ) => array(
|
||||
'value' => 'bounceInDown',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'bounceInLeft', 'js_composer' ) => array(
|
||||
'value' => 'bounceInLeft',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'bounceInRight', 'js_composer' ) => array(
|
||||
'value' => 'bounceInRight',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'bounceInUp', 'js_composer' ) => array(
|
||||
'value' => 'bounceInUp',
|
||||
'type' => 'in',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Bouncing Exits', 'js_composer' ),
|
||||
'values' => array(
|
||||
// text to display => value
|
||||
esc_html__( 'bounceOut', 'js_composer' ) => array(
|
||||
'value' => 'bounceOut',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'bounceOutDown', 'js_composer' ) => array(
|
||||
'value' => 'bounceOutDown',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'bounceOutLeft', 'js_composer' ) => array(
|
||||
'value' => 'bounceOutLeft',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'bounceOutRight', 'js_composer' ) => array(
|
||||
'value' => 'bounceOutRight',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'bounceOutUp', 'js_composer' ) => array(
|
||||
'value' => 'bounceOutUp',
|
||||
'type' => 'out',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Fading Entrances', 'js_composer' ),
|
||||
'values' => array(
|
||||
// text to display => value
|
||||
esc_html__( 'fadeIn', 'js_composer' ) => array(
|
||||
'value' => 'fadeIn',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'fadeInDown', 'js_composer' ) => array(
|
||||
'value' => 'fadeInDown',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'fadeInDownBig', 'js_composer' ) => array(
|
||||
'value' => 'fadeInDownBig',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'fadeInLeft', 'js_composer' ) => array(
|
||||
'value' => 'fadeInLeft',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'fadeInLeftBig', 'js_composer' ) => array(
|
||||
'value' => 'fadeInLeftBig',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'fadeInRight', 'js_composer' ) => array(
|
||||
'value' => 'fadeInRight',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'fadeInRightBig', 'js_composer' ) => array(
|
||||
'value' => 'fadeInRightBig',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'fadeInUp', 'js_composer' ) => array(
|
||||
'value' => 'fadeInUp',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'fadeInUpBig', 'js_composer' ) => array(
|
||||
'value' => 'fadeInUpBig',
|
||||
'type' => 'in',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Fading Exits', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'fadeOut', 'js_composer' ) => array(
|
||||
'value' => 'fadeOut',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'fadeOutDown', 'js_composer' ) => array(
|
||||
'value' => 'fadeOutDown',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'fadeOutDownBig', 'js_composer' ) => array(
|
||||
'value' => 'fadeOutDownBig',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'fadeOutLeft', 'js_composer' ) => array(
|
||||
'value' => 'fadeOutLeft',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'fadeOutLeftBig', 'js_composer' ) => array(
|
||||
'value' => 'fadeOutLeftBig',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'fadeOutRight', 'js_composer' ) => array(
|
||||
'value' => 'fadeOutRight',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'fadeOutRightBig', 'js_composer' ) => array(
|
||||
'value' => 'fadeOutRightBig',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'fadeOutUp', 'js_composer' ) => array(
|
||||
'value' => 'fadeOutUp',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'fadeOutUpBig', 'js_composer' ) => array(
|
||||
'value' => 'fadeOutUpBig',
|
||||
'type' => 'out',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Flippers', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'flip', 'js_composer' ) => array(
|
||||
'value' => 'flip',
|
||||
'type' => 'other',
|
||||
),
|
||||
esc_html__( 'flipInX', 'js_composer' ) => array(
|
||||
'value' => 'flipInX',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'flipInY', 'js_composer' ) => array(
|
||||
'value' => 'flipInY',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'flipOutX', 'js_composer' ) => array(
|
||||
'value' => 'flipOutX',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'flipOutY', 'js_composer' ) => array(
|
||||
'value' => 'flipOutY',
|
||||
'type' => 'out',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Lightspeed', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'lightSpeedIn', 'js_composer' ) => array(
|
||||
'value' => 'lightSpeedIn',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'lightSpeedOut', 'js_composer' ) => array(
|
||||
'value' => 'lightSpeedOut',
|
||||
'type' => 'out',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Rotating Entrances', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'rotateIn', 'js_composer' ) => array(
|
||||
'value' => 'rotateIn',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'rotateInDownLeft', 'js_composer' ) => array(
|
||||
'value' => 'rotateInDownLeft',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'rotateInDownRight', 'js_composer' ) => array(
|
||||
'value' => 'rotateInDownRight',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'rotateInUpLeft', 'js_composer' ) => array(
|
||||
'value' => 'rotateInUpLeft',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'rotateInUpRight', 'js_composer' ) => array(
|
||||
'value' => 'rotateInUpRight',
|
||||
'type' => 'in',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Rotating Exits', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'rotateOut', 'js_composer' ) => array(
|
||||
'value' => 'rotateOut',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'rotateOutDownLeft', 'js_composer' ) => array(
|
||||
'value' => 'rotateOutDownLeft',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'rotateOutDownRight', 'js_composer' ) => array(
|
||||
'value' => 'rotateOutDownRight',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'rotateOutUpLeft', 'js_composer' ) => array(
|
||||
'value' => 'rotateOutUpLeft',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'rotateOutUpRight', 'js_composer' ) => array(
|
||||
'value' => 'rotateOutUpRight',
|
||||
'type' => 'out',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Specials', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'hinge', 'js_composer' ) => array(
|
||||
'value' => 'hinge',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'rollIn', 'js_composer' ) => array(
|
||||
'value' => 'rollIn',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'rollOut', 'js_composer' ) => array(
|
||||
'value' => 'rollOut',
|
||||
'type' => 'out',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Zoom Entrances', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'zoomIn', 'js_composer' ) => array(
|
||||
'value' => 'zoomIn',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'zoomInDown', 'js_composer' ) => array(
|
||||
'value' => 'zoomInDown',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'zoomInLeft', 'js_composer' ) => array(
|
||||
'value' => 'zoomInLeft',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'zoomInRight', 'js_composer' ) => array(
|
||||
'value' => 'zoomInRight',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'zoomInUp', 'js_composer' ) => array(
|
||||
'value' => 'zoomInUp',
|
||||
'type' => 'in',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Zoom Exits', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'zoomOut', 'js_composer' ) => array(
|
||||
'value' => 'zoomOut',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'zoomOutDown', 'js_composer' ) => array(
|
||||
'value' => 'zoomOutDown',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'zoomOutLeft', 'js_composer' ) => array(
|
||||
'value' => 'zoomOutLeft',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'zoomOutRight', 'js_composer' ) => array(
|
||||
'value' => 'zoomOutRight',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'zoomOutUp', 'js_composer' ) => array(
|
||||
'value' => 'zoomOutUp',
|
||||
'type' => 'out',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Slide Entrances', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'slideInDown', 'js_composer' ) => array(
|
||||
'value' => 'slideInDown',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'slideInLeft', 'js_composer' ) => array(
|
||||
'value' => 'slideInLeft',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'slideInRight', 'js_composer' ) => array(
|
||||
'value' => 'slideInRight',
|
||||
'type' => 'in',
|
||||
),
|
||||
esc_html__( 'slideInUp', 'js_composer' ) => array(
|
||||
'value' => 'slideInUp',
|
||||
'type' => 'in',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Slide Exits', 'js_composer' ),
|
||||
'values' => array(
|
||||
esc_html__( 'slideOutDown', 'js_composer' ) => array(
|
||||
'value' => 'slideOutDown',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'slideOutLeft', 'js_composer' ) => array(
|
||||
'value' => 'slideOutLeft',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'slideOutRight', 'js_composer' ) => array(
|
||||
'value' => 'slideOutRight',
|
||||
'type' => 'out',
|
||||
),
|
||||
esc_html__( 'slideOutUp', 'js_composer' ) => array(
|
||||
'value' => 'slideOutUp',
|
||||
'type' => 'out',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Used to override animation style list
|
||||
* @since 4.4
|
||||
*/
|
||||
|
||||
return apply_filters( 'vc_param_animation_style_list', $styles );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $styles - array of styles to group
|
||||
* @param string|array $type - what type to return
|
||||
*
|
||||
* @return array
|
||||
* @since 4.4
|
||||
*/
|
||||
public function groupStyleByType( $styles, $type ) {
|
||||
$grouped = array();
|
||||
foreach ( $styles as $group ) {
|
||||
$inner_group = array( 'values' => array() );
|
||||
if ( isset( $group['label'] ) ) {
|
||||
$inner_group['label'] = $group['label'];
|
||||
}
|
||||
foreach ( $group['values'] as $key => $value ) {
|
||||
if ( ( is_array( $value ) && isset( $value['type'] ) && ( ( is_string( $type ) && $value['type'] === $type ) || is_array( $type ) && in_array( $value['type'], $type, true ) ) ) || ! is_array( $value ) || ! isset( $value['type'] ) ) {
|
||||
$inner_group['values'][ $key ] = $value;
|
||||
}
|
||||
}
|
||||
if ( ! empty( $inner_group['values'] ) ) {
|
||||
$grouped[] = $inner_group;
|
||||
}
|
||||
}
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set variables and register animate-css asset
|
||||
* @param $settings
|
||||
* @param $value
|
||||
* @since 4.4
|
||||
*
|
||||
*/
|
||||
public function __construct( $settings, $value ) {
|
||||
$this->settings = $settings;
|
||||
$this->value = $value;
|
||||
wp_register_style( 'vc_animate-css', vc_asset_url( 'lib/bower/animate-css/animate.min.css' ), array(), WPB_VC_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render edit form output
|
||||
* @return string
|
||||
* @since 4.4
|
||||
*/
|
||||
public function render() {
|
||||
$output = '<div class="vc_row">';
|
||||
wp_enqueue_style( 'vc_animate-css' );
|
||||
|
||||
$styles = $this->animationStyles();
|
||||
if ( isset( $this->settings['settings']['type'] ) ) {
|
||||
$styles = $this->groupStyleByType( $styles, $this->settings['settings']['type'] );
|
||||
}
|
||||
if ( isset( $this->settings['settings']['custom'] ) && is_array( $this->settings['settings']['custom'] ) ) {
|
||||
$styles = array_merge( $styles, $this->settings['settings']['custom'] );
|
||||
}
|
||||
|
||||
if ( is_array( $styles ) && ! empty( $styles ) ) {
|
||||
$left_side = '<div class="vc_col-sm-6">';
|
||||
$build_style_select = '<select class="vc_param-animation-style">';
|
||||
foreach ( $styles as $style ) {
|
||||
$build_style_select .= '<optgroup ' . ( isset( $style['label'] ) ? 'label="' . esc_attr( $style['label'] ) . '"' : '' ) . '>';
|
||||
if ( is_array( $style['values'] ) && ! empty( $style['values'] ) ) {
|
||||
foreach ( $style['values'] as $key => $value ) {
|
||||
$build_style_select .= '<option value="' . ( is_array( $value ) ? $value['value'] : $value ) . '">' . esc_html( $key ) . '</option>';
|
||||
}
|
||||
}
|
||||
$build_style_select .= '</optgroup>';
|
||||
}
|
||||
$build_style_select .= '</select>';
|
||||
$left_side .= $build_style_select;
|
||||
$left_side .= '</div>';
|
||||
$output .= $left_side;
|
||||
|
||||
$right_side = '<div class="vc_col-sm-6">';
|
||||
$right_side .= '<div class="vc_param-animation-style-preview"><button class="vc_btn vc_btn-grey vc_btn-sm vc_param-animation-style-trigger">' . esc_html__( 'Animate it', 'js_composer' ) . '</button></div>';
|
||||
$right_side .= '</div>';
|
||||
$output .= $right_side;
|
||||
}
|
||||
|
||||
$output .= '</div>'; // Close Row
|
||||
$output .= sprintf( '<input name="%s" class="wpb_vc_param_value %s %s_field" type="hidden" value="%s" />', esc_attr( $this->settings['param_name'] ), esc_attr( $this->settings['param_name'] ), esc_attr( $this->settings['type'] ), $this->value );
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for rendering param in edit form (add element)
|
||||
* Parse settings from vc_map and entered 'values'.
|
||||
*
|
||||
* @param array $settings - parameter settings in vc_map
|
||||
* @param string $value - parameter value
|
||||
* @param string $tag - shortcode tag
|
||||
*
|
||||
* vc_filter: vc_animation_style_render_filter - filter to override editor form
|
||||
* field output
|
||||
*
|
||||
* @return mixed rendered template for params in edit form
|
||||
*
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_animation_style_form_field( $settings, $value, $tag ) {
|
||||
|
||||
$field = new Vc_ParamAnimation( $settings, $value );
|
||||
|
||||
/**
|
||||
* Filter used to override full output of edit form field animation style
|
||||
* @since 4.4
|
||||
*/
|
||||
|
||||
return apply_filters( 'vc_animation_style_render_filter', $field->render(), $settings, $value, $tag );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Vc_AutoComplete
|
||||
* Param type 'autocomplete'
|
||||
* Used to create input field with predefined or ajax values suggestions.
|
||||
* See usage example in bottom of this file.
|
||||
* @since 4.4
|
||||
*/
|
||||
class Vc_AutoComplete {
|
||||
/**
|
||||
* @since 4.4
|
||||
* @var array $settings - param settings
|
||||
*/
|
||||
protected $settings;
|
||||
/**
|
||||
* @since 4.4
|
||||
* @var string $value - current param value (if multiple it is splitted by ',' comma to make array)
|
||||
*/
|
||||
protected $value;
|
||||
/**
|
||||
* @since 4.4
|
||||
* @var string $tag - shortcode name(base)
|
||||
*/
|
||||
protected $tag;
|
||||
|
||||
/**
|
||||
* @param array $settings - param settings (from vc_map)
|
||||
* @param string $value - current param value
|
||||
* @param string $tag - shortcode name(base)
|
||||
*
|
||||
* @since 4.4
|
||||
*/
|
||||
public function __construct( $settings, $value, $tag ) {
|
||||
$this->tag = $tag;
|
||||
$this->settings = $settings;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @since 4.4
|
||||
* vc_filter: vc_autocomplete_{shortcode_tag}_{param_name}_render - hook to define output for autocomplete item
|
||||
*/
|
||||
public function render() {
|
||||
$output = sprintf( '<div class="vc_autocomplete-field"><ul class="vc_autocomplete%s">', ( isset( $this->settings['settings'], $this->settings['settings']['display_inline'] ) && true === $this->settings['settings']['display_inline'] ) ? ' vc_autocomplete-inline' : '' );
|
||||
|
||||
if ( isset( $this->value ) && strlen( $this->value ) > 0 ) {
|
||||
$values = explode( ',', $this->value );
|
||||
foreach ( $values as $key => $val ) {
|
||||
$value = array(
|
||||
'value' => trim( $val ),
|
||||
'label' => trim( $val ),
|
||||
);
|
||||
if ( isset( $this->settings['settings'], $this->settings['settings']['values'] ) && ! empty( $this->settings['settings']['values'] ) ) {
|
||||
foreach ( $this->settings['settings']['values'] as $data ) {
|
||||
if ( trim( $data['value'] ) === trim( $val ) ) {
|
||||
$value['label'] = $data['label'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Magic is here. this filter is used to render value correctly ( must return array with 'value', 'label' keys )
|
||||
$value = apply_filters( 'vc_autocomplete_' . $this->tag . '_' . $this->settings['param_name'] . '_render', $value, $this->settings, $this->tag );
|
||||
}
|
||||
|
||||
if ( is_array( $value ) && isset( $value['value'], $value['label'] ) ) {
|
||||
$output .= '<li data-value="' . $value['value'] . '" data-label="' . $value['label'] . '" data-index="' . $key . '" class="vc_autocomplete-label vc_data"><span class="vc_autocomplete-label">' . $value['label'] . '</span> <a class="vc_autocomplete-remove">×</a></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$output .= sprintf( '<li class="vc_autocomplete-input"><span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span><input class="vc_auto_complete_param" type="text" placeholder="%s" value="%s" autocomplete="off"></li><li class="vc_autocomplete-clear"></li></ul>', esc_attr__( 'Click here and start typing...', 'js_composer' ), $this->value );
|
||||
|
||||
$output .= sprintf( '<input name="%s" class="wpb_vc_param_value %s %s_field" type="hidden" value="%s" %s /></div>', $this->settings['param_name'], $this->settings['param_name'], $this->settings['type'], $this->value, ( isset( $this->settings['settings'] ) && ! empty( $this->settings['settings'] ) ) ? ' data-settings="' . htmlentities( wp_json_encode( $this->settings['settings'] ), ENT_QUOTES, 'utf-8' ) . '" ' : '' );
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @action wp_ajax_vc_get_autocomplete_suggestion - since 4.4 used to hook ajax requests for autocomplete suggestions
|
||||
*/
|
||||
add_action( 'wp_ajax_vc_get_autocomplete_suggestion', 'vc_get_autocomplete_suggestion' );
|
||||
/**
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_get_autocomplete_suggestion() {
|
||||
vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie();
|
||||
|
||||
$query = vc_post_param( 'query' );
|
||||
$tag = wp_strip_all_tags( vc_post_param( 'shortcode' ) );
|
||||
$param_name = vc_post_param( 'param' );
|
||||
vc_render_suggestion( $query, $tag, $param_name );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @param $tag
|
||||
* @param $param_name
|
||||
*
|
||||
* vc_filter: vc_autocomplete_{tag}_{param_name}_callback - hook to get suggestions from ajax. (here you need to hook).
|
||||
* @since 4.4
|
||||
*
|
||||
*/
|
||||
function vc_render_suggestion( $query, $tag, $param_name ) {
|
||||
$suggestions = apply_filters( 'vc_autocomplete_' . stripslashes( $tag ) . '_' . stripslashes( $param_name ) . '_callback', $query, $tag, $param_name );
|
||||
if ( is_array( $suggestions ) && ! empty( $suggestions ) ) {
|
||||
die( wp_json_encode( $suggestions ) );
|
||||
}
|
||||
die( '' ); // if nothing found..
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for rendering param in edit form (add element)
|
||||
* Parse settings from vc_map and entered values.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
* @param $tag
|
||||
*
|
||||
* @return mixed rendered template for params in edit form
|
||||
* @since 4.4
|
||||
* vc_filter: vc_autocomplete_render_filter - hook to override output of edit for field "autocomplete"
|
||||
*/
|
||||
function vc_autocomplete_form_field( $settings, $value, $tag ) {
|
||||
|
||||
$auto_complete = new Vc_AutoComplete( $settings, $value, $tag );
|
||||
|
||||
return apply_filters( 'vc_autocomplete_render_filter', $auto_complete->render() );
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Param 'colorpicker' field
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_colorpicker_form_field( $settings, $value ) {
|
||||
return sprintf( '<div class="color-group"><input name="%s" class="wpb_vc_param_value wpb-textinput %s %s_field vc_color-control" type="text" value="%s"/></div>', $settings['param_name'], $settings['param_name'], $settings['type'], $value );
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @property mixed data
|
||||
*/
|
||||
class Vc_Column_Offset {
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $settings = array();
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $value = '';
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $size_types = array(
|
||||
'lg' => 'Large',
|
||||
'md' => 'Medium',
|
||||
'sm' => 'Small',
|
||||
'xs' => 'Extra small',
|
||||
);
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $column_width_list = array();
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*/
|
||||
public function __construct( $settings, $value ) {
|
||||
$this->settings = $settings;
|
||||
$this->value = $value;
|
||||
|
||||
$this->column_width_list = array(
|
||||
esc_html__( '1 column - 1/12', 'js_composer' ) => '1',
|
||||
esc_html__( '2 columns - 1/6', 'js_composer' ) => '2',
|
||||
esc_html__( '3 columns - 1/4', 'js_composer' ) => '3',
|
||||
esc_html__( '4 columns - 1/3', 'js_composer' ) => '4',
|
||||
esc_html__( '5 columns - 5/12', 'js_composer' ) => '5',
|
||||
esc_html__( '6 columns - 1/2', 'js_composer' ) => '6',
|
||||
esc_html__( '7 columns - 7/12', 'js_composer' ) => '7',
|
||||
esc_html__( '8 columns - 2/3', 'js_composer' ) => '8',
|
||||
esc_html__( '9 columns - 3/4', 'js_composer' ) => '9',
|
||||
esc_html__( '10 columns - 5/6', 'js_composer' ) => '10',
|
||||
esc_html__( '11 columns - 11/12', 'js_composer' ) => '11',
|
||||
esc_html__( '12 columns - 1/1', 'js_composer' ) => '12',
|
||||
esc_html__( '20% - 1/5', 'js_composer' ) => '1/5',
|
||||
esc_html__( '40% - 2/5', 'js_composer' ) => '2/5',
|
||||
esc_html__( '60% - 3/5', 'js_composer' ) => '3/5',
|
||||
esc_html__( '80% - 4/5', 'js_composer' ) => '4/5',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render() {
|
||||
ob_start();
|
||||
vc_include_template( 'params/column_offset/template.tpl.php', array(
|
||||
'settings' => $this->settings,
|
||||
'value' => $this->value,
|
||||
'data' => $this->valueData(),
|
||||
'sizes' => $this->size_types,
|
||||
'param' => $this,
|
||||
) );
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function valueData() {
|
||||
if ( ! isset( $this->data ) ) {
|
||||
$this->data = preg_split( '/\s+/', $this->value );
|
||||
}
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function sizeControl( $size ) {
|
||||
if ( 'sm' === $size ) {
|
||||
return '<span class="vc_description">' . esc_html__( 'Default value from width attribute', 'js_composer' ) . '</span>';
|
||||
}
|
||||
$empty_label = 'xs' === $size ? '' : esc_html__( 'Inherit from smaller', 'js_composer' );
|
||||
$output = sprintf( '<select name="vc_col_%s_size" class="vc_column_offset_field" data-type="size-%s"><option value="" style="color: #ccc;">%s</option>', $size, $size, $empty_label );
|
||||
foreach ( $this->column_width_list as $label => $index ) {
|
||||
$value = 'vc_col-' . $size . '-' . $index;
|
||||
$output .= sprintf( '<option value="%s" %s>%s</option>', $value, in_array( $value, $this->data, true ) ? 'selected="true"' : '', $label );
|
||||
}
|
||||
$output .= '</select>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function offsetControl( $size ) {
|
||||
$prefix = 'vc_col-' . $size . '-offset-';
|
||||
$empty_label = 'xs' === $size ? esc_html__( 'No offset', 'js_composer' ) : esc_html__( 'Inherit from smaller', 'js_composer' );
|
||||
$output = sprintf( '<select name="vc_%s_offset_size" class="vc_column_offset_field" data-type="offset-%s"><option value="" style="color: #ccc;">%s</option>', $size, $size, $empty_label );
|
||||
|
||||
if ( 'xs' !== $size ) {
|
||||
$output .= sprintf( '<option value="%s0" style="color: #ccc;"%s>%s</option>', $prefix, in_array( $prefix . '0', $this->data, true ) ? ' selected="true"' : '', esc_html__( 'No offset', 'js_composer' ) );
|
||||
}
|
||||
|
||||
foreach ( $this->column_width_list as $label => $index ) {
|
||||
$value = $prefix . $index;
|
||||
$output .= sprintf( '<option value="%s"%s>%s</option>', $value, in_array( $value, $this->data, true ) ? ' selected="true"' : '', $label );
|
||||
}
|
||||
$output .= '</select>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function vc_column_offset_form_field( $settings, $value ) {
|
||||
$column_offset = new Vc_Column_Offset( $settings, $value );
|
||||
|
||||
return $column_offset->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $column_offset
|
||||
* @param $width
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
function vc_column_offset_class_merge( $column_offset, $width ) {
|
||||
// Remove offset settings if
|
||||
if ( '1' === vc_settings()->get( 'not_responsive_css' ) ) {
|
||||
$column_offset = preg_replace( '/vc_col\-(lg|md|xs)[^\s]*/', '', $column_offset );
|
||||
}
|
||||
if ( preg_match( '/vc_col\-sm\-\d+/', $column_offset ) ) {
|
||||
return $column_offset;
|
||||
}
|
||||
|
||||
return $width . ( empty( $column_offset ) ? '' : ' ' . $column_offset );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function vc_load_column_offset_param() {
|
||||
vc_add_shortcode_param( 'column_offset', 'vc_column_offset_form_field' );
|
||||
}
|
||||
|
||||
add_action( 'vc_load_default_params', 'vc_load_column_offset_param' );
|
||||
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'WPBakeryVisualComposerCssEditor' ) ) {
|
||||
/**
|
||||
* Class WPBakeryVisualComposerCssEditor
|
||||
*/
|
||||
class WPBakeryVisualComposerCssEditor {
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $settings = array();
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $value = '';
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $positions = array(
|
||||
'top',
|
||||
'right',
|
||||
'bottom',
|
||||
'left',
|
||||
);
|
||||
public $params = array();
|
||||
|
||||
/**
|
||||
* Setters/Getters {{
|
||||
*
|
||||
* @param null $settings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function settings( $settings = null ) {
|
||||
if ( is_array( $settings ) ) {
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
return $this->settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function setting( $key ) {
|
||||
return isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function value( $value = null ) {
|
||||
if ( is_string( $value ) ) {
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function params( $values = null ) {
|
||||
if ( is_array( $values ) ) {
|
||||
$this->params = $values;
|
||||
}
|
||||
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
// }}
|
||||
|
||||
/**
|
||||
* vc_filter: vc_css_editor - hook to override output of this method
|
||||
* @return mixed
|
||||
*/
|
||||
public function render() {
|
||||
$output = '<div class="vc_css-editor vc_row vc_ui-flex-row" data-css-editor="true">';
|
||||
$output .= $this->onionLayout();
|
||||
$output .= sprintf( '<div class="vc_col-xs-5 vc_settings"><label>%s</label><div class="color-group"><input type="text" name="border_color" value="" class="vc_color-control"></div><label>%s</label><div class="vc_border-style"><select name="border_style" class="vc_border-style">%s</select></div><label>%s</label><div class="vc_border-radius"><select name="border_radius" class="vc_border-radius">%s</select></div><label>%s</label><div class="color-group"><input type="text" name="background_color" value="" class="vc_color-control"></div><div class="vc_background-image">%s<div class="vc_clearfix"></div></div><div class="vc_background-style"><select name="background_style" class="vc_background-style">%s</select></div><label>%s</label><label class="vc_checkbox"><input type="checkbox" name="simply" class="vc_simplify" value=""> %s</label></div>', esc_html__( 'Border color', 'js_composer' ), esc_html__( 'Border style', 'js_composer' ), $this->getBorderStyleOptions(), esc_html__( 'Border radius', 'js_composer' ), $this->getBorderRadiusOptions(), esc_html__( 'Background', 'js_composer' ), $this->getBackgroundImageControl(), $this->getBackgroundStyleOptions(), esc_html__( 'Box controls', 'js_composer' ), esc_html__( 'Simplify controls', 'js_composer' ) );
|
||||
|
||||
$output .= sprintf( '<input name="%s" class="wpb_vc_param_value %s %s_field" type="hidden" value="%s"/>', esc_attr( $this->setting( 'param_name' ) ), esc_attr( $this->setting( 'param_name' ) ), esc_attr( $this->setting( 'type' ) ), esc_attr( $this->value() ) );
|
||||
|
||||
$output .= '</div><div class="vc_clearfix"></div>';
|
||||
$custom_tag = 'script';
|
||||
$output .= '<' . $custom_tag . ' type="text/html" id="vc_css-editor-image-block"><li class="added"><div class="inner" style="width: 80px; height: 80px; overflow: hidden;text-align: center;"><img src="{{ img.url }}?id={{ img.id }}" data-image-id="{{ img.id }}" class="vc_ce-image<# if (!_.isUndefined(img.css_class)) {#> {{ img.css_class }}<# }#>"> </div><a href="#" class="vc_icon-remove"><i class="vc-composer-icon vc-c-icon-close"></i></a></li></' . $custom_tag . '>';
|
||||
|
||||
return apply_filters( 'vc_css_editor', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBackgroundImageControl() {
|
||||
$value = sprintf( '<ul class="vc_image"></ul><a href="#" class="vc_add-image"><i class="vc-composer-icon vc-c-icon-add"></i>%s</a>', esc_html__( 'Add image', 'js_composer' ) );
|
||||
|
||||
return apply_filters( 'vc_css_editor_background_image_control', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBorderRadiusOptions() {
|
||||
$radiuses = apply_filters( 'vc_css_editor_border_radius_options_data', array(
|
||||
'' => esc_html__( 'None', 'js_composer' ),
|
||||
'1px' => '1px',
|
||||
'2px' => '2px',
|
||||
'3px' => '3px',
|
||||
'4px' => '4px',
|
||||
'5px' => '5px',
|
||||
'10px' => '10px',
|
||||
'15px' => '15px',
|
||||
'20px' => '20px',
|
||||
'25px' => '25px',
|
||||
'30px' => '30px',
|
||||
'35px' => '35px',
|
||||
) );
|
||||
|
||||
$output = '';
|
||||
foreach ( $radiuses as $radius => $title ) {
|
||||
$output .= '<option value="' . $radius . '">' . $title . '</option>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBorderStyleOptions() {
|
||||
$output = '<option value="">' . esc_html__( 'Theme defaults', 'js_composer' ) . '</option>';
|
||||
$styles = apply_filters( 'vc_css_editor_border_style_options_data', array(
|
||||
esc_html__( 'solid', 'js_composer' ),
|
||||
esc_html__( 'dotted', 'js_composer' ),
|
||||
esc_html__( 'dashed', 'js_composer' ),
|
||||
esc_html__( 'none', 'js_composer' ),
|
||||
esc_html__( 'hidden', 'js_composer' ),
|
||||
esc_html__( 'double', 'js_composer' ),
|
||||
esc_html__( 'groove', 'js_composer' ),
|
||||
esc_html__( 'ridge', 'js_composer' ),
|
||||
esc_html__( 'inset', 'js_composer' ),
|
||||
esc_html__( 'outset', 'js_composer' ),
|
||||
esc_html__( 'initial', 'js_composer' ),
|
||||
esc_html__( 'inherit', 'js_composer' ),
|
||||
) );
|
||||
foreach ( $styles as $style ) {
|
||||
$output .= '<option value="' . $style . '">' . ucfirst( $style ) . '</option>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBackgroundStyleOptions() {
|
||||
$output = '<option value="">' . esc_html__( 'Theme defaults', 'js_composer' ) . '</option>';
|
||||
$styles = apply_filters( 'vc_css_editor_background_style_options_data', array(
|
||||
esc_html__( 'Cover', 'js_composer' ) => 'cover',
|
||||
esc_html__( 'Contain', 'js_composer' ) => 'contain',
|
||||
esc_html__( 'No Repeat', 'js_composer' ) => 'no-repeat',
|
||||
esc_html__( 'Repeat', 'js_composer' ) => 'repeat',
|
||||
) );
|
||||
foreach ( $styles as $name => $style ) {
|
||||
$output .= '<option value="' . $style . '">' . $name . '</option>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function onionLayout() {
|
||||
$output = sprintf( '<div class="vc_layout-onion vc_col-xs-7"><div class="vc_margin">%s<div class="vc_border">%s<div class="vc_padding">%s<div class="vc_content"><i></i></div></div></div></div></div>', $this->layerControls( 'margin' ), $this->layerControls( 'border', 'width' ), $this->layerControls( 'padding' ) );
|
||||
|
||||
return apply_filters( 'vc_css_editor_onion_layout', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param string $prefix
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function layerControls( $name, $prefix = '' ) {
|
||||
$output = '<label>' . esc_html( $name ) . '</label>';
|
||||
foreach ( $this->positions as $pos ) {
|
||||
$output .= sprintf( '<input type="text" name="%s_%s%s" data-name="%s%s-%s" class="vc_%s" placeholder="-" data-attribute="%s" value="">', esc_attr( $name ), esc_attr( $pos ), '' !== $prefix ? '_' . esc_attr( $prefix ) : '', esc_attr( $name ), '' !== $prefix ? '-' . esc_attr( $prefix ) : '', esc_attr( $pos ), esc_attr( $pos ), esc_attr( $name ) );
|
||||
}
|
||||
|
||||
return apply_filters( 'vc_css_editor_layer_controls', $output );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function vc_css_editor_form_field( $settings, $value ) {
|
||||
$css_editor = new WPBakeryVisualComposerCssEditor();
|
||||
$css_editor->settings( $settings );
|
||||
$css_editor->value( $value );
|
||||
|
||||
return $css_editor->render();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for rendering param in edit form (add element)
|
||||
* Parse settings from vc_map and entered values.
|
||||
* @since 4.4
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
* @param $tag
|
||||
*
|
||||
* vc_filter: vc_custom_markup_render_filter - hook to override custom markup for field
|
||||
*
|
||||
* @return mixed rendered template for params in edit form
|
||||
*
|
||||
*/
|
||||
function vc_custom_markup_form_field( $settings, $value, $tag ) {
|
||||
return apply_filters( 'vc_custom_markup_render_filter', $value, $settings, $tag );
|
||||
}
|
||||
321
wp-content/plugins/js_composer/include/params/default_params.php
Normal file
321
wp-content/plugins/js_composer/include/params/default_params.php
Normal file
@@ -0,0 +1,321 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcode default attributes functions for rendering.
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
* @since 4.4
|
||||
*/
|
||||
/**
|
||||
* Textfield shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_textfield_form_field( $settings, $value ) {
|
||||
$value = htmlspecialchars( $value );
|
||||
|
||||
return '<input name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textinput ' . $settings['param_name'] . ' ' . $settings['type'] . '" type="text" value="' . $value . '"/>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Dropdown(select with options) shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_dropdown_form_field( $settings, $value ) {
|
||||
$output = '';
|
||||
$css_option = str_replace( '#', 'hash-', vc_get_dropdown_option( $settings, $value ) );
|
||||
$output .= '<select name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-input wpb-select ' . $settings['param_name'] . ' ' . $settings['type'] . ' ' . $css_option . '" data-option="' . $css_option . '">';
|
||||
if ( is_array( $value ) ) {
|
||||
$value = isset( $value['value'] ) ? $value['value'] : array_shift( $value );
|
||||
}
|
||||
if ( ! empty( $settings['value'] ) ) {
|
||||
foreach ( $settings['value'] as $index => $data ) {
|
||||
if ( is_numeric( $index ) && ( is_string( $data ) || is_numeric( $data ) ) ) {
|
||||
$option_label = $data;
|
||||
$option_value = $data;
|
||||
} elseif ( is_numeric( $index ) && is_array( $data ) ) {
|
||||
$option_label = isset( $data['label'] ) ? $data['label'] : array_pop( $data );
|
||||
$option_value = isset( $data['value'] ) ? $data['value'] : array_pop( $data );
|
||||
} else {
|
||||
$option_value = $data;
|
||||
$option_label = $index;
|
||||
}
|
||||
$selected = '';
|
||||
$option_value_string = (string) $option_value;
|
||||
$value_string = (string) $value;
|
||||
if ( '' !== $value && $option_value_string === $value_string ) {
|
||||
$selected = 'selected="selected"';
|
||||
}
|
||||
$option_class = str_replace( '#', 'hash-', $option_value );
|
||||
$output .= '<option class="' . esc_attr( $option_class ) . '" value="' . esc_attr( $option_value ) . '" ' . $selected . '>' . htmlspecialchars( $option_label ) . '</option>';
|
||||
}
|
||||
}
|
||||
$output .= '</select>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checkbox shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param string $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_checkbox_form_field( $settings, $value ) {
|
||||
$output = '';
|
||||
if ( is_array( $value ) ) {
|
||||
$value = ''; // fix #1239
|
||||
}
|
||||
$current_value = strlen( $value ) > 0 ? explode( ',', $value ) : array();
|
||||
$values = isset( $settings['value'] ) && is_array( $settings['value'] ) ? $settings['value'] : array( esc_html__( 'Yes', 'js_composer' ) => 'true' );
|
||||
if ( ! empty( $values ) ) {
|
||||
foreach ( $values as $label => $v ) {
|
||||
// NOTE!! Don't use strict compare here for BC!
|
||||
// @codingStandardsIgnoreLine
|
||||
$checked = in_array( $v, $current_value ) ? 'checked' : '';
|
||||
$output .= ' <label class="vc_checkbox-label"><input id="' . $settings['param_name'] . '-' . $v . '" value="' . $v . '" class="wpb_vc_param_value ' . $settings['param_name'] . ' ' . $settings['type'] . '" type="checkbox" name="' . $settings['param_name'] . '" ' . $checked . '>' . $label . '</label>';
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
add_filter( 'vc_map_get_param_defaults', 'vc_checkbox_param_defaults', 10, 2 );
|
||||
/**
|
||||
* @param $value
|
||||
* @param $param
|
||||
* @return mixed|string
|
||||
*/
|
||||
function vc_checkbox_param_defaults( $value, $param ) {
|
||||
if ( 'checkbox' === $param['type'] ) {
|
||||
$value = '';
|
||||
if ( isset( $param['std'] ) ) {
|
||||
$value = $param['std'];
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checkbox shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_posttypes_form_field( $settings, $value ) {
|
||||
$output = '';
|
||||
$args = array(
|
||||
'public' => true,
|
||||
);
|
||||
$post_types = get_post_types( $args );
|
||||
foreach ( $post_types as $post_type ) {
|
||||
$checked = '';
|
||||
if ( 'attachment' !== $post_type ) {
|
||||
if ( in_array( $post_type, explode( ',', $value ), true ) ) {
|
||||
$checked = 'checked="checked"';
|
||||
}
|
||||
$output .= '<label class="vc_checkbox-label"><input id="' . $settings['param_name'] . '-' . $post_type . '" value="' . $post_type . '" class="wpb_vc_param_value ' . $settings['param_name'] . ' ' . $settings['type'] . '" type="checkbox" name="' . $settings['param_name'] . '" ' . $checked . '> ' . $post_type . '</label>';
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Taxonomies shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_taxonomies_form_field( $settings, $value ) {
|
||||
$output = '';
|
||||
$post_types = get_post_types( array(
|
||||
'public' => false,
|
||||
'name' => 'attachment',
|
||||
), 'names', 'NOT' );
|
||||
foreach ( $post_types as $type ) {
|
||||
$taxonomies = get_object_taxonomies( $type, '' );
|
||||
foreach ( $taxonomies as $tax ) {
|
||||
$checked = '';
|
||||
if ( in_array( $tax->name, explode( ',', $value ), true ) ) {
|
||||
$checked = 'checked';
|
||||
}
|
||||
$output .= ' <label class="vc_checkbox-label" data-post-type="' . $type . '"><input id="' . $settings['param_name'] . '-' . $tax->name . '" value="' . $tax->name . '" data-post-type="' . $type . '" class="wpb_vc_param_value ' . $settings['param_name'] . ' ' . $settings['type'] . '" type="checkbox" name="' . $settings['param_name'] . '" ' . $checked . '> ' . $tax->label . '</label>';
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exploded textarea shortcode attribute type generator.
|
||||
*
|
||||
* Data saved and coma-separated values are merged with line breaks and returned in a textarea.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_exploded_textarea_form_field( $settings, $value ) {
|
||||
$value = str_replace( ',', "\n", $value );
|
||||
|
||||
return '<textarea name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textarea ' . $settings['param_name'] . ' ' . $settings['type'] . '">' . $value . '</textarea>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Safe Textarea shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.8.2
|
||||
*/
|
||||
function vc_exploded_textarea_safe_form_field( $settings, $value ) {
|
||||
$value = vc_value_from_safe( $value, true );
|
||||
$value = str_replace( ',', "\n", $value );
|
||||
|
||||
return '<textarea name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textarea ' . $settings['param_name'] . ' ' . $settings['type'] . '">' . $value . '</textarea>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Textarea raw html shortcode attribute type generator.
|
||||
*
|
||||
* This attribute type allows safely add custom html to your post/page.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_textarea_raw_html_form_field( $settings, $value ) {
|
||||
// @codingStandardsIgnoreLine
|
||||
return sprintf( '<textarea name="%s" class="wpb_vc_param_value wpb-textarea_raw_html %s %s" rows="16">%s</textarea>', $settings['param_name'], $settings['param_name'], $settings['type'], htmlentities( rawurldecode( base64_decode( $value ) ), ENT_COMPAT, 'UTF-8' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Safe Textarea shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_textarea_safe_form_field( $settings, $value ) {
|
||||
return '<textarea name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textarea_raw_html ' . $settings['param_name'] . ' ' . $settings['type'] . '">' . vc_value_from_safe( $value, true ) . '</textarea>';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Textarea shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_textarea_form_field( $settings, $value ) {
|
||||
return '<textarea name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textarea ' . $settings['param_name'] . ' ' . $settings['type'] . '">' . $value . '</textarea>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach images shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @param $tag
|
||||
* @param bool $single
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*
|
||||
*/
|
||||
function vc_attach_images_form_field( $settings, $value, $tag, $single = false ) {
|
||||
$output = '';
|
||||
$param_value = wpb_removeNotExistingImgIDs( $value );
|
||||
$output .= '<input type="hidden" class="wpb_vc_param_value gallery_widget_attached_images_ids ' . esc_attr( $settings['param_name'] ) . ' ' . esc_attr( $settings['type'] ) . '" name="' . esc_attr( $settings['param_name'] ) . '" value="' . $value . '"/>';
|
||||
$output .= '<div class="gallery_widget_attached_images">';
|
||||
$output .= '<ul class="gallery_widget_attached_images_list">';
|
||||
$output .= ( '' !== $param_value ) ? vc_field_attached_images( explode( ',', $value ) ) : '';
|
||||
$output .= '</ul>';
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="gallery_widget_site_images">';
|
||||
$output .= '</div>';
|
||||
if ( true === $single ) {
|
||||
$output .= '<a class="gallery_widget_add_images" href="javascript:;" use-single="true" title="' . esc_attr__( 'Add image', 'js_composer' ) . '"><i class="vc-composer-icon vc-c-icon-add"></i>' . esc_html__( 'Add image', 'js_composer' ) . '</a>';
|
||||
} else {
|
||||
$output .= '<a class="gallery_widget_add_images" href="javascript:;" title="' . esc_attr__( 'Add images', 'js_composer' ) . '"><i class="vc-composer-icon vc-c-icon-add"></i>' . esc_html__( 'Add images', 'js_composer' ) . '</a>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach image shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @param $tag
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_attach_image_form_field( $settings, $value, $tag ) {
|
||||
return vc_attach_images_form_field( $settings, $value, $tag, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Widgetised sidebars shortcode attribute type generator.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_widgetised_sidebars_form_field( $settings, $value ) {
|
||||
$output = '';
|
||||
$sidebars = $GLOBALS['wp_registered_sidebars'];
|
||||
|
||||
$output .= '<select name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value dropdown wpb-input wpb-select ' . $settings['param_name'] . ' ' . $settings['type'] . '">';
|
||||
foreach ( $sidebars as $sidebar ) {
|
||||
$selected = '';
|
||||
if ( $sidebar['id'] === $value ) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
$sidebar_name = $sidebar['name'];
|
||||
$output .= '<option value="' . esc_attr( $sidebar['id'] ) . '" ' . $selected . '>' . $sidebar_name . '</option>';
|
||||
}
|
||||
$output .= '</select>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.5
|
||||
*/
|
||||
function vc_el_id_form_field( $settings, $value ) {
|
||||
$value_output = sprintf( '<div class="vc-param-el_id"><input name="%s" class="wpb_vc_param_value wpb-textinput %s_field" type="text" value="%s" /></div>', esc_attr( $settings['param_name'] ), esc_attr( $settings['param_name'] . ' ' . $settings['type'] ), $value );
|
||||
|
||||
return apply_filters( 'vc_el_id_render_filter', $value_output );
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Vc_Font_Container
|
||||
* @since 4.3
|
||||
* vc_map examples:
|
||||
* array(
|
||||
* 'type' => 'font_container',
|
||||
* 'param_name' => 'font_container',
|
||||
* 'value'=>'',
|
||||
* 'settings'=>array(
|
||||
* 'fields'=>array(
|
||||
* 'tag'=>'h2',
|
||||
* 'text_align',
|
||||
* 'font_size',
|
||||
* 'line_height',
|
||||
* 'color',
|
||||
*
|
||||
* 'tag_description' => esc_html__('Select element tag.','js_composer'),
|
||||
* 'text_align_description' => esc_html__('Select text alignment.','js_composer'),
|
||||
* 'font_size_description' => esc_html__('Enter font size.','js_composer'),
|
||||
* 'line_height_description' => esc_html__('Enter line height.','js_composer'),
|
||||
* 'color_description' => esc_html__('Select color for your element.','js_composer'),
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* Ordering of fields, font_family, tag, text_align and etc. will be Same as ordering in array!
|
||||
* To provide default value to field use 'key' => 'value'
|
||||
*/
|
||||
class Vc_Font_Container {
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render( $settings, $value ) {
|
||||
$fields = array();
|
||||
$values = array();
|
||||
extract( $this->_vc_font_container_parse_attributes( $settings['settings']['fields'], $value ) );
|
||||
|
||||
$data = array();
|
||||
$output = '';
|
||||
if ( ! empty( $fields ) ) {
|
||||
if ( isset( $fields['tag'] ) ) {
|
||||
$data['tag'] = '
|
||||
<div class="vc_row-fluid vc_column">
|
||||
<div class="wpb_element_label">' . esc_html__( 'Element tag', 'js_composer' ) . '</div>
|
||||
<div class="vc_font_container_form_field-tag-container">
|
||||
<select class="vc_font_container_form_field-tag-select">';
|
||||
$tags = $this->_vc_font_container_get_allowed_tags();
|
||||
foreach ( $tags as $tag ) {
|
||||
$data['tag'] .= '<option value="' . $tag . '" class="' . $tag . '" ' . ( $values['tag'] === $tag ? 'selected' : '' ) . '>' . $tag . '</option>';
|
||||
}
|
||||
$data['tag'] .= '
|
||||
</select>
|
||||
</div>';
|
||||
if ( isset( $fields['tag_description'] ) && strlen( $fields['tag_description'] ) > 0 ) {
|
||||
$data['tag'] .= '
|
||||
<span class="vc_description clear">' . $fields['tag_description'] . '</span>
|
||||
';
|
||||
}
|
||||
|
||||
$data['tag'] .= '</div>';
|
||||
}
|
||||
if ( isset( $fields['font_size'] ) ) {
|
||||
$data['font_size'] = '
|
||||
<div class="vc_row-fluid vc_column">
|
||||
<div class="wpb_element_label">' . esc_html__( 'Font size', 'js_composer' ) . '</div>
|
||||
<div class="vc_font_container_form_field-font_size-container">
|
||||
<input class="vc_font_container_form_field-font_size-input" type="text" value="' . $values['font_size'] . '" />
|
||||
</div>';
|
||||
|
||||
if ( isset( $fields['font_size_description'] ) && strlen( $fields['font_size_description'] ) > 0 ) {
|
||||
$data['font_size'] .= '
|
||||
<span class="vc_description clear">' . $fields['font_size_description'] . '</span>
|
||||
';
|
||||
}
|
||||
$data['font_size'] .= '</div>';
|
||||
}
|
||||
if ( isset( $fields['text_align'] ) ) {
|
||||
$data['text_align'] = '
|
||||
<div class="vc_row-fluid vc_column">
|
||||
<div class="wpb_element_label">' . esc_html__( 'Text align', 'js_composer' ) . '</div>
|
||||
<div class="vc_font_container_form_field-text_align-container">
|
||||
<select class="vc_font_container_form_field-text_align-select">
|
||||
<option value="left" class="left" ' . ( 'left' === $values['text_align'] ? 'selected="selected"' : '' ) . '>' . esc_html__( 'left', 'js_composer' ) . '</option>
|
||||
<option value="right" class="right" ' . ( 'right' === $values['text_align'] ? 'selected="selected"' : '' ) . '>' . esc_html__( 'right', 'js_composer' ) . '</option>
|
||||
<option value="center" class="center" ' . ( 'center' === $values['text_align'] ? 'selected="selected"' : '' ) . '>' . esc_html__( 'center', 'js_composer' ) . '</option>
|
||||
<option value="justify" class="justify" ' . ( 'justify' === $values['text_align'] ? 'selected="selected"' : '' ) . '>' . esc_html__( 'justify', 'js_composer' ) . '</option>
|
||||
</select>
|
||||
</div>';
|
||||
if ( isset( $fields['text_align_description'] ) && strlen( $fields['text_align_description'] ) > 0 ) {
|
||||
$data['text_align'] .= '
|
||||
<span class="vc_description clear">' . $fields['text_align_description'] . '</span>
|
||||
';
|
||||
}
|
||||
$data['text_align'] .= '</div>';
|
||||
}
|
||||
if ( isset( $fields['line_height'] ) ) {
|
||||
$data['line_height'] = '
|
||||
<div class="vc_row-fluid vc_column">
|
||||
<div class="wpb_element_label">' . esc_html__( 'Line height', 'js_composer' ) . '</div>
|
||||
<div class="vc_font_container_form_field-line_height-container">
|
||||
<input class="vc_font_container_form_field-line_height-input" type="text" value="' . $values['line_height'] . '" />
|
||||
</div>';
|
||||
if ( isset( $fields['line_height_description'] ) && strlen( $fields['line_height_description'] ) > 0 ) {
|
||||
$data['line_height'] .= '
|
||||
<span class="vc_description clear">' . $fields['line_height_description'] . '</span>
|
||||
';
|
||||
}
|
||||
$data['line_height'] .= '</div>';
|
||||
}
|
||||
if ( isset( $fields['color'] ) ) {
|
||||
$data['color'] = '
|
||||
<div class="vc_row-fluid vc_column">
|
||||
<div class="wpb_element_label">' . esc_html__( 'Text color', 'js_composer' ) . '</div>
|
||||
<div class="vc_font_container_form_field-color-container">
|
||||
<div class="color-group">
|
||||
<input type="text" value="' . $values['color'] . '" class="vc_font_container_form_field-color-input vc_color-control" />
|
||||
</div>
|
||||
</div>';
|
||||
if ( isset( $fields['color_description'] ) && strlen( $fields['color_description'] ) > 0 ) {
|
||||
$data['color'] .= '
|
||||
<span class="vc_description clear">' . $fields['color_description'] . '</span>
|
||||
';
|
||||
}
|
||||
$data['color'] .= '</div>';
|
||||
}
|
||||
if ( isset( $fields['font_family'] ) ) {
|
||||
$data['font_family'] = '
|
||||
<div class="vc_row-fluid vc_column">
|
||||
<div class="wpb_element_label">' . esc_html__( 'Font Family', 'js_composer' ) . '</div>
|
||||
<div class="vc_font_container_form_field-font_family-container">
|
||||
<select class="vc_font_container_form_field-font_family-select">';
|
||||
$fonts = $this->_vc_font_container_get_web_safe_fonts();
|
||||
foreach ( $fonts as $font_name => $font_data ) {
|
||||
$data['font_family'] .= '<option value="' . $font_name . '" class="' . vc_build_safe_css_class( $font_name ) . '" ' . ( strtolower( $values['font_family'] ) === strtolower( $font_name ) ? 'selected' : '' ) . ' data[font_family]="' . rawurlencode( $font_data ) . '">' . $font_name . '</option>';
|
||||
}
|
||||
$data['font_family'] .= '
|
||||
</select>
|
||||
</div>';
|
||||
if ( isset( $fields['font_family_description'] ) && strlen( $fields['font_family_description'] ) > 0 ) {
|
||||
$data['font_family'] .= '
|
||||
<span class="vc_description clear">' . $fields['font_family_description'] . '</span>
|
||||
';
|
||||
}
|
||||
$data['font_family'] .= '</div>';
|
||||
}
|
||||
if ( isset( $fields['font_style'] ) ) {
|
||||
$data['font_style'] = '
|
||||
<div class="vc_row-fluid vc_column">
|
||||
<div class="wpb_element_label">' . esc_html__( 'Font style', 'js_composer' ) . '</div>
|
||||
<div class="vc_font_container_form_field-font_style-container">
|
||||
<label>
|
||||
<input type="checkbox" class="vc_font_container_form_field-font_style-checkbox italic" value="italic" ' . ( '1' === $values['font_style_italic'] ? 'checked' : '' ) . '><span class="vc_font_container_form_field-font_style-label italic">' . esc_html__( 'italic', 'js_composer' ) . '</span>
|
||||
</label>
|
||||
<br />
|
||||
<label>
|
||||
<input type="checkbox" class="vc_font_container_form_field-font_style-checkbox bold" value="bold" ' . ( '1' === $values['font_style_bold'] ? 'checked' : '' ) . '><span class="vc_font_container_form_field-font_style-label bold">' . esc_html__( 'bold', 'js_composer' ) . '</span>
|
||||
</label>
|
||||
</div>';
|
||||
if ( isset( $fields['font_style_description'] ) && strlen( $fields['font_style_description'] ) > 0 ) {
|
||||
$data['font_style'] .= '
|
||||
<span class="vc_description clear">' . $fields['font_style_description'] . '</span>
|
||||
';
|
||||
}
|
||||
$data['font_style'] .= '</div>';
|
||||
}
|
||||
$data = apply_filters( 'vc_font_container_output_data', $data, $fields, $values, $settings );
|
||||
// combine all in output, make sure you follow ordering
|
||||
foreach ( $fields as $key => $field ) {
|
||||
if ( isset( $data[ $key ] ) ) {
|
||||
$output .= $data[ $key ];
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '<input name="' . $settings['param_name'] . '" class="wpb_vc_param_value ' . $settings['param_name'] . ' ' . $settings['type'] . '_field" type="hidden" value="' . $value . '" />';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* If field 'font_family' is used this is list of fonts available
|
||||
* To modify this list, you should use add_filter('vc_font_container_get_fonts_filter','your_custom_function');
|
||||
* vc_filter: vc_font_container_get_fonts_filter - to modify list of fonts
|
||||
* @return array list of fonts
|
||||
*/
|
||||
public function _vc_font_container_get_web_safe_fonts() {
|
||||
// this is "Web Safe FONTS" from w3c: http://www.w3schools.com/cssref/css_websafe_fonts.asp
|
||||
$web_fonts = array(
|
||||
'Georgia' => 'Georgia, serif',
|
||||
'Palatino Linotype' => '"Palatino Linotype", "Book Antiqua", Palatino, serif',
|
||||
'Book Antiqua' => '"Book Antiqua", Palatino, serif',
|
||||
'Palatino' => 'Palatino, serif',
|
||||
'Times New Roman' => '"Times New Roman", Times, serif',
|
||||
'Arial' => 'Arial, Helvetica, sans-serif',
|
||||
'Arial Black' => '"Arial Black", Gadget, sans-serif',
|
||||
'Helvetica' => 'Helvetica, sans-serif',
|
||||
'Comic Sans MS' => '"Comic Sans MS", cursive, sans-serif',
|
||||
'Impact' => 'Impact, Charcoal, sans-serif',
|
||||
'Charcoal' => 'Charcoal, sans-serif',
|
||||
'Lucida Sans Unicode' => '"Lucida Sans Unicode", "Lucida Grande", sans-serif',
|
||||
'Lucida Grande' => '"Lucida Grande", sans-serif',
|
||||
'Tahoma' => 'Tahoma, Geneva, sans-serif',
|
||||
'Geneva' => 'Geneva, sans-serif',
|
||||
'Trebuchet MS' => '"Trebuchet MS", Helvetica, sans-serif',
|
||||
'Verdana' => '"Trebuchet MS", Helvetica, sans-serif',
|
||||
'Courier New' => '"Courier New", Courier, monospace',
|
||||
'Lucida Console' => '"Lucida Console", Monaco, monospace',
|
||||
'Monaco' => 'Monaco, monospace',
|
||||
);
|
||||
|
||||
return apply_filters( 'vc_font_container_get_fonts_filter', $web_fonts );
|
||||
}
|
||||
|
||||
/**
|
||||
* If 'tag' field used this is list of allowed tags
|
||||
* To modify this list, you should use add_filter('vc_font_container_get_allowed_tags','your_custom_function');
|
||||
* vc_filter: vc_font_container_get_allowed_tags - to modify list of allowed tags by default
|
||||
* @return array list of allowed tags
|
||||
*/
|
||||
public function _vc_font_container_get_allowed_tags() {
|
||||
$allowed_tags = array(
|
||||
'h1',
|
||||
'h2',
|
||||
'h3',
|
||||
'h4',
|
||||
'h5',
|
||||
'h6',
|
||||
'p',
|
||||
'div',
|
||||
);
|
||||
|
||||
return apply_filters( 'vc_font_container_get_allowed_tags', $allowed_tags );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $attr
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _vc_font_container_parse_attributes( $attr, $value ) {
|
||||
$fields = array();
|
||||
if ( isset( $attr ) ) {
|
||||
foreach ( $attr as $key => $val ) {
|
||||
if ( is_numeric( $key ) ) {
|
||||
$fields[ $val ] = '';
|
||||
} else {
|
||||
$fields[ $key ] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$values = vc_parse_multi_attribute( $value, array(
|
||||
'tag' => isset( $fields['tag'] ) ? $fields['tag'] : 'h2',
|
||||
'font_size' => isset( $fields['font_size'] ) ? $fields['font_size'] : '',
|
||||
'font_style_italic' => isset( $fields['font_style_italic'] ) ? $fields['font_style_italic'] : '',
|
||||
'font_style_bold' => isset( $fields['font_style_bold'] ) ? $fields['font_style_bold'] : '',
|
||||
'font_family' => isset( $fields['font_family'] ) ? $fields['font_family'] : '',
|
||||
'color' => isset( $fields['color'] ) ? $fields['color'] : '',
|
||||
'line_height' => isset( $fields['line_height'] ) ? $fields['line_height'] : '',
|
||||
'text_align' => isset( $fields['text_align'] ) ? $fields['text_align'] : 'left',
|
||||
'tag_description' => isset( $fields['tag_description'] ) ? $fields['tag_description'] : '',
|
||||
'font_size_description' => isset( $fields['font_size_description'] ) ? $fields['font_size_description'] : '',
|
||||
'font_style_description' => isset( $fields['font_style_description'] ) ? $fields['font_style_description'] : '',
|
||||
'font_family_description' => isset( $fields['font_family_description'] ) ? $fields['font_family_description'] : '',
|
||||
'color_description' => isset( $fields['color_description'] ) ? $fields['color_description'] : 'left',
|
||||
'line_height_description' => isset( $fields['line_height_description'] ) ? $fields['line_height_description'] : '',
|
||||
'text_align_description' => isset( $fields['text_align_description'] ) ? $fields['text_align_description'] : '',
|
||||
) );
|
||||
|
||||
return array(
|
||||
'fields' => $fields,
|
||||
'values' => $values,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function vc_font_container_form_field( $settings, $value ) {
|
||||
$font_container = new Vc_Font_Container();
|
||||
|
||||
return apply_filters( 'vc_font_container_render_filter', $font_container->render( $settings, $value ) );
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Vc_Gutenberg_Param
|
||||
*/
|
||||
class Vc_Gutenberg_Param {
|
||||
protected $postTypeSlug = 'wpb_gutenberg_param';
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'init', array(
|
||||
$this,
|
||||
'initialize',
|
||||
) );
|
||||
}
|
||||
|
||||
public function initialize() {
|
||||
global $pagenow, $wp_version;
|
||||
if ( version_compare( $wp_version, '4.9.8', '>' ) && 'post-new.php' === $pagenow && vc_user_access()->wpAll( 'edit_posts' )
|
||||
->get() && vc_request_param( 'post_type' ) === $this->postTypeSlug ) {
|
||||
$this->registerGutenbergAttributeType();
|
||||
/** @see \Vc_Gutenberg_Param::removeAdminUi */
|
||||
add_action( 'admin_enqueue_scripts', array(
|
||||
$this,
|
||||
'removeAdminUI',
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
public function removeAdminUi() {
|
||||
$style = '
|
||||
#adminmenumain, #wpadminbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html.wp-toolbar {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.wp-toolbar #wpcontent {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.wp-toolbar #wpbody {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.gutenberg .gutenberg__editor .edit-post-layout .edit-post-header, html .block-editor-page .edit-post-header {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.gutenberg .gutenberg__editor .edit-post-layout.is-sidebar-opened .edit-post-layout__content, html .block-editor-page .edit-post-layout.is-sidebar-opened .edit-post-layout__content {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.gutenberg .gutenberg__editor .edit-post-layout .editor-post-publish-panel, html .block-editor-page .edit-post-layout .editor-post-publish-panel, html .block-editor-page .edit-post-header__settings {
|
||||
display: none;
|
||||
}
|
||||
.editor-post-title {
|
||||
display: none !important;
|
||||
}
|
||||
';
|
||||
wp_add_inline_style( 'wp-edit-blocks', $style );
|
||||
}
|
||||
|
||||
protected function registerGutenbergAttributeType() {
|
||||
$labels = array(
|
||||
'name' => _x( 'Gutenberg attrs', 'Post type general name', 'js_composer' ),
|
||||
'singular_name' => _x( 'Gutenberg attr', 'Post type singular name', 'js_composer' ),
|
||||
'menu_name' => _x( 'Gutenberg attrs', 'Admin Menu text', 'js_composer' ),
|
||||
'name_admin_bar' => _x( 'Gutenberg attr', 'Add New on Toolbar', 'js_composer' ),
|
||||
'add_new' => esc_html__( 'Add New', 'js_composer' ),
|
||||
'add_new_item' => esc_html__( 'Add New Gutenberg attr', 'js_composer' ),
|
||||
'new_item' => esc_html__( 'New Gutenberg attr', 'js_composer' ),
|
||||
'edit_item' => esc_html__( 'Edit Gutenberg attr', 'js_composer' ),
|
||||
'view_item' => esc_html__( 'View Gutenberg attr', 'js_composer' ),
|
||||
'all_items' => esc_html__( 'All Gutenberg attrs', 'js_composer' ),
|
||||
'search_items' => esc_html__( 'Search Gutenberg attrs', 'js_composer' ),
|
||||
'parent_item_colon' => esc_html__( 'Parent Gutenberg attrs:', 'js_composer' ),
|
||||
'not_found' => esc_html__( 'No Gutenberg attrs found.', 'js_composer' ),
|
||||
'not_found_in_trash' => esc_html__( 'No Gutenberg attrs found in Trash.', 'js_composer' ),
|
||||
'featured_image' => _x( 'Gutenberg attr Cover Image', 'Overrides the “Featured Image” phrase for this post type. Added in 4.3', 'js_composer' ),
|
||||
'set_featured_image' => _x( 'Set cover image', 'Overrides the “Set featured image” phrase for this post type. Added in 4.3', 'js_composer' ),
|
||||
'remove_featured_image' => _x( 'Remove cover image', 'Overrides the “Remove featured image” phrase for this post type. Added in 4.3', 'js_composer' ),
|
||||
'use_featured_image' => _x( 'Use as cover image', 'Overrides the “Use as featured image” phrase for this post type. Added in 4.3', 'js_composer' ),
|
||||
'archives' => _x( 'Gutenberg attr archives', 'The post type archive label used in nav menus. Default “Post Archives”. Added in 4.4', 'js_composer' ),
|
||||
'insert_into_item' => _x( 'Add into Gutenberg attr', 'Overrides the “Insert into post”/”Insert into page” phrase (used when inserting media into a post). Added in 4.4', 'js_composer' ),
|
||||
'uploaded_to_this_item' => _x( 'Uploaded to this Gutenberg attr', 'Overrides the “Uploaded to this post”/”Uploaded to this page” phrase (used when viewing media attached to a post). Added in 4.4', 'js_composer' ),
|
||||
'filter_items_list' => _x( 'Filter Gutenberg attrs list', 'Screen reader text for the filter links heading on the post type listing screen. Default “Filter posts list”/”Filter pages list”. Added in 4.4', 'js_composer' ),
|
||||
'items_list_navigation' => _x( 'Gutenberg attrs list navigation', 'Screen reader text for the pagination heading on the post type listing screen. Default “Posts list navigation”/”Pages list navigation”. Added in 4.4', 'js_composer' ),
|
||||
'items_list' => _x( 'Gutenberg attrs list', 'Screen reader text for the items list heading on the post type listing screen. Default “Posts list”/”Pages list”. Added in 4.4', 'js_composer' ),
|
||||
);
|
||||
$args = array(
|
||||
'labels' => $labels,
|
||||
'public' => true,
|
||||
'publicly_queryable' => true,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => false,
|
||||
'query_var' => false,
|
||||
'capability_type' => 'page',
|
||||
'has_archive' => false,
|
||||
'hierarchical' => false,
|
||||
'menu_position' => null,
|
||||
'show_in_rest' => true,
|
||||
'supports' => array( 'editor' ),
|
||||
);
|
||||
register_post_type( $this->postTypeSlug, $args );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gutenberg field param.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
*/
|
||||
function vc_gutenberg_form_field( $settings, $value ) {
|
||||
$value = htmlspecialchars( $value );
|
||||
|
||||
return '<div class="vc_gutenberg-field-wrapper"><button class="vc_btn vc_btn-grey vc_btn-sm" data-vc-action="open">Open Editor</button><div class="vc_gutenberg-modal-wrapper"></div><input name="' . $settings['param_name'] . '" class="wpb_vc_param_value vc_gutenberg-field vc_param-name-' . $settings['param_name'] . ' ' . $settings['type'] . '" type="hidden" value="' . $value . '"/></div>';
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hidden field param.
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @since 4.5
|
||||
* @return string - html string.
|
||||
*/
|
||||
function vc_hidden_form_field( $settings, $value ) {
|
||||
$value = htmlspecialchars( $value );
|
||||
|
||||
return '<input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value vc_hidden-field vc_param-name-' . esc_attr( $settings['param_name'] ) . ' ' . esc_attr( $settings['type'] ) . '" type="hidden" value="' . esc_attr( $value ) . '"/>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove content before hidden field type input.
|
||||
*
|
||||
* @param $output
|
||||
*
|
||||
* @since 4.5
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function vc_edit_form_fields_render_field_hidden_before() {
|
||||
return '<div class="vc_column vc_edit-form-hidden-field-wrapper">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove content after hidden field type input.
|
||||
*
|
||||
* @param $output
|
||||
*
|
||||
* @since 4.5
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function vc_edit_form_fields_render_field_hidden_after() {
|
||||
return '</div>';
|
||||
}
|
||||
19
wp-content/plugins/js_composer/include/params/href/href.php
Normal file
19
wp-content/plugins/js_composer/include/params/href/href.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_href_form_field( $settings, $value ) {
|
||||
if ( ! is_string( $value ) || strlen( $value ) === 0 ) {
|
||||
$value = 'http://';
|
||||
}
|
||||
|
||||
return sprintf( '<div class="vc_href-form-field"><input name="%s" class="wpb_vc_param_value wpb-textinput %s %s_field" type="text" value="%s"/></div>', esc_attr( $settings['param_name'] ), esc_attr( $settings['param_name'] ), esc_attr( $settings['type'] ), $value );
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
75
wp-content/plugins/js_composer/include/params/load.php
Normal file
75
wp-content/plugins/js_composer/include/params/load.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcode attributes fields loader
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/default_params.php' );
|
||||
|
||||
/**
|
||||
* Loads attributes hooks.
|
||||
*/
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/textarea_html/textarea_html.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/colorpicker/colorpicker.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/loop/loop.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/vc_link/vc_link.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/options/options.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/sorted_list/sorted_list.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/css_editor/css_editor.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/tab_id/tab_id.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/href/href.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/font_container/font_container.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/google_fonts/google_fonts.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/column_offset/column_offset.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/autocomplete/autocomplete.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/params_preset/params_preset.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/param_group/param_group.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/custom_markup/custom_markup.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/animation_style/animation_style.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/iconpicker/iconpicker.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/el_id/el_id.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', '/gutenberg/gutenberg.php' );
|
||||
|
||||
global $vc_params_list;
|
||||
$vc_params_list = array(
|
||||
// Default
|
||||
'textfield',
|
||||
'dropdown',
|
||||
'textarea_html',
|
||||
'checkbox',
|
||||
'posttypes',
|
||||
'taxonomies',
|
||||
'taxomonies',
|
||||
'exploded_textarea',
|
||||
'exploded_textarea_safe',
|
||||
'textarea_raw_html',
|
||||
'textarea_safe',
|
||||
'textarea',
|
||||
'attach_images',
|
||||
'attach_image',
|
||||
'widgetised_sidebars',
|
||||
// Advanced
|
||||
'colorpicker',
|
||||
'loop',
|
||||
'vc_link',
|
||||
'options',
|
||||
'sorted_list',
|
||||
'css_editor',
|
||||
'font_container',
|
||||
'google_fonts',
|
||||
'autocomplete',
|
||||
'tab_id',
|
||||
'href',
|
||||
'params_preset',
|
||||
'param_group',
|
||||
'custom_markup',
|
||||
'animation_style',
|
||||
'iconpicker',
|
||||
'el_id',
|
||||
'gutenberg',
|
||||
);
|
||||
968
wp-content/plugins/js_composer/include/params/loop/loop.php
Normal file
968
wp-content/plugins/js_composer/include/params/loop/loop.php
Normal file
@@ -0,0 +1,968 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_loop_form_field( $settings, $value ) {
|
||||
$query_builder = new VcLoopSettings( $value );
|
||||
$params = $query_builder->getContent();
|
||||
$loop_info = '';
|
||||
$parsed_value = array();
|
||||
if ( is_array( $params ) ) {
|
||||
foreach ( $params as $key => $param ) {
|
||||
$param_value_render = vc_loop_get_value( $param );
|
||||
if ( ! empty( $param_value_render ) ) {
|
||||
$parsed_value[] = $key . ':' . ( is_array( $param['value'] ) ? implode( ',', $param['value'] ) : $param['value'] );
|
||||
$loop_info .= ' <b>' . $query_builder->getLabel( $key ) . '</b>: ' . $param_value_render . ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! isset( $settings['settings'] ) ) {
|
||||
$settings['settings'] = array();
|
||||
}
|
||||
|
||||
return '<div class="vc_loop">' . '<input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value ' . esc_attr( $settings['param_name'] . ' ' . $settings['type'] ) . '_field" type="hidden" value="' . esc_attr( join( '|', $parsed_value ) ) . '"/>' . '<a href="javascript:;" class="button vc_loop-build ' . esc_attr( $settings['param_name'] ) . '_button" data-settings="' . rawurlencode( wp_json_encode( $settings['settings'] ) ) . '">' . esc_html__( 'Build query', 'js_composer' ) . '</a>' . '<div class="vc_loop-info">' . $loop_info . '</div>' . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $param
|
||||
*
|
||||
* @return string
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_loop_get_value( $param ) {
|
||||
$value = array();
|
||||
$selected_values = (array) $param['value'];
|
||||
if ( isset( $param['options'] ) && is_array( $param['options'] ) ) {
|
||||
foreach ( $param['options'] as $option ) {
|
||||
if ( is_array( $option ) && isset( $option['value'] ) ) {
|
||||
if ( in_array( ( ( '-' === $option['action'] ? '-' : '' ) . $option['value'] ), $selected_values, true ) ) {
|
||||
$value[] = $option['action'] . $option['name'];
|
||||
}
|
||||
} elseif ( is_array( $option ) && isset( $option[0] ) ) {
|
||||
if ( in_array( $option[0], $selected_values, true ) ) {
|
||||
$value[] = $option[1];
|
||||
}
|
||||
} elseif ( in_array( $option, $selected_values, true ) ) {
|
||||
$value[] = $option;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$value[] = $param['value'];
|
||||
}
|
||||
|
||||
return implode( ', ', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses loop settings and creates WP_Query according to manual
|
||||
* @since 4.2
|
||||
* @link http://codex.wordpress.org/Class_Reference/WP_Query
|
||||
*/
|
||||
class VcLoopQueryBuilder {
|
||||
/**
|
||||
* @since 4.2
|
||||
* @var array
|
||||
*/
|
||||
protected $args = array(
|
||||
'post_status' => 'publish',
|
||||
// show only published posts #1098
|
||||
);
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
public function __construct( $data ) {
|
||||
foreach ( $data as $key => $value ) {
|
||||
$method = 'parse_' . $key;
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
$this->$method( $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pages count
|
||||
* @param $value
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function parse_size( $value ) {
|
||||
$this->args['posts_per_page'] = 'All' === $value ? - 1 : (int) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorting field
|
||||
* @param $value
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function parse_order_by( $value ) {
|
||||
$this->args['orderby'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorting order
|
||||
* @param $value
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function parse_order( $value ) {
|
||||
$this->args['order'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* By post types
|
||||
* @param $value
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function parse_post_type( $value ) {
|
||||
$this->args['post_type'] = $this->stringToArray( $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* By author
|
||||
* @param $value
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function parse_authors( $value ) {
|
||||
$this->args['author'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* By categories
|
||||
* @param $value
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function parse_categories( $value ) {
|
||||
$this->args['cat'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* By taxonomies
|
||||
* @param $value
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function parse_tax_query( $value ) {
|
||||
$terms = $this->stringToArray( $value );
|
||||
if ( empty( $this->args['tax_query'] ) ) {
|
||||
$this->args['tax_query'] = array( 'relation' => 'AND' );
|
||||
}
|
||||
$negative_term_list = array();
|
||||
foreach ( $terms as $term ) {
|
||||
if ( (int) $term < 0 ) {
|
||||
$negative_term_list[] = abs( $term );
|
||||
}
|
||||
}
|
||||
|
||||
$not_in = array();
|
||||
$in = array();
|
||||
|
||||
$terms = get_terms( VcLoopSettings::getTaxonomies(), array( 'include' => array_map( 'abs', $terms ) ) );
|
||||
foreach ( $terms as $t ) {
|
||||
if ( in_array( (int) $t->term_id, $negative_term_list, true ) ) {
|
||||
$not_in[ $t->taxonomy ][] = $t->term_id;
|
||||
} else {
|
||||
$in[ $t->taxonomy ][] = $t->term_id;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $in as $taxonomy => $terms ) {
|
||||
$this->args['tax_query'][] = array(
|
||||
'field' => 'term_id',
|
||||
'taxonomy' => $taxonomy,
|
||||
'terms' => $terms,
|
||||
'operator' => 'IN',
|
||||
);
|
||||
}
|
||||
foreach ( $not_in as $taxonomy => $terms ) {
|
||||
$this->args['tax_query'][] = array(
|
||||
'field' => 'term_id',
|
||||
'taxonomy' => $taxonomy,
|
||||
'terms' => $terms,
|
||||
'operator' => 'NOT IN',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* By tags ids
|
||||
* @param $value
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function parse_tags( $value ) {
|
||||
$in = $not_in = array();
|
||||
$tags_ids = $this->stringToArray( $value );
|
||||
foreach ( $tags_ids as $tag ) {
|
||||
$tag = (int) $tag;
|
||||
if ( $tag < 0 ) {
|
||||
$not_in[] = abs( $tag );
|
||||
} else {
|
||||
$in[] = $tag;
|
||||
}
|
||||
}
|
||||
$this->args['tag__in'] = $in;
|
||||
$this->args['tag__not_in'] = $not_in;
|
||||
}
|
||||
|
||||
/**
|
||||
* By posts ids
|
||||
* @param $value
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function parse_by_id( $value ) {
|
||||
$in = $not_in = array();
|
||||
$ids = $this->stringToArray( $value );
|
||||
foreach ( $ids as $id ) {
|
||||
$id = (int) $id;
|
||||
if ( $id < 0 ) {
|
||||
$not_in[] = abs( $id );
|
||||
} else {
|
||||
$in[] = $id;
|
||||
}
|
||||
}
|
||||
$this->args['post__in'] = $in;
|
||||
$this->args['post__not_in'] = $not_in;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
public function excludeId( $id ) {
|
||||
if ( ! isset( $this->args['post__not_in'] ) ) {
|
||||
$this->args['post__not_in'] = array();
|
||||
}
|
||||
if ( is_array( $id ) ) {
|
||||
$this->args['post__not_in'] = array_merge( $this->args['post__not_in'], $id );
|
||||
} else {
|
||||
$this->args['post__not_in'][] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts string to array. Filters empty arrays values
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
protected function stringToArray( $value ) {
|
||||
$valid_values = array();
|
||||
$list = preg_split( '/\,[\s]*/', $value );
|
||||
foreach ( $list as $v ) {
|
||||
if ( strlen( $v ) > 0 ) {
|
||||
$valid_values[] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
return $valid_values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function build() {
|
||||
return array(
|
||||
$this->args,
|
||||
new WP_Query( $this->args ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class VcLoopSettings
|
||||
* @since 4.2
|
||||
*/
|
||||
class VcLoopSettings {
|
||||
// Available parts of loop for WP_Query object.
|
||||
/**
|
||||
* @since 4.2
|
||||
* @var array
|
||||
*/
|
||||
protected $content = array();
|
||||
/**
|
||||
* @since 4.2
|
||||
* @var array
|
||||
*/
|
||||
protected $parts;
|
||||
/**
|
||||
* @since 4.2
|
||||
* @var array
|
||||
*/
|
||||
protected $query_parts = array(
|
||||
'size',
|
||||
'order_by',
|
||||
'order',
|
||||
'post_type',
|
||||
'authors',
|
||||
'categories',
|
||||
'tags',
|
||||
'tax_query',
|
||||
'by_id',
|
||||
);
|
||||
public $settings = array();
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param array $settings
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
public function __construct( $value, $settings = array() ) {
|
||||
$this->parts = array(
|
||||
'size' => esc_html__( 'Post count', 'js_composer' ),
|
||||
'order_by' => esc_html__( 'Order by', 'js_composer' ),
|
||||
'order' => esc_html__( 'Sort order', 'js_composer' ),
|
||||
'post_type' => esc_html__( 'Post types', 'js_composer' ),
|
||||
'authors' => esc_html__( 'Author', 'js_composer' ),
|
||||
'categories' => esc_html__( 'Categories', 'js_composer' ),
|
||||
'tags' => esc_html__( 'Tags', 'js_composer' ),
|
||||
'tax_query' => esc_html__( 'Taxonomies', 'js_composer' ),
|
||||
'by_id' => esc_html__( 'Individual posts/pages', 'js_composer' ),
|
||||
);
|
||||
$this->settings = $settings;
|
||||
// Parse loop string
|
||||
$data = $this->parseData( $value );
|
||||
foreach ( $this->query_parts as $part ) {
|
||||
$value = isset( $data[ $part ] ) ? $data[ $part ] : '';
|
||||
$locked = 'true' === $this->getSettings( $part, 'locked' );
|
||||
// Predefined value check.
|
||||
if ( ! is_null( $this->getSettings( $part, 'value' ) ) && $this->replaceLockedValue( $part ) && ( true === $locked || 0 === strlen( (string) $value ) ) ) {
|
||||
$value = $this->settings[ $part ]['value'];
|
||||
} elseif ( ! is_null( $this->getSettings( $part, 'value' ) ) && ! $this->replaceLockedValue( $part ) && ( true === $locked || 0 === strlen( (string) $value ) ) ) {
|
||||
$value = implode( ',', array_unique( explode( ',', $value . ',' . $this->settings[ $part ]['value'] ) ) );
|
||||
}
|
||||
// Find custom method for parsing
|
||||
if ( method_exists( $this, 'parse_' . $part ) ) {
|
||||
$method = 'parse_' . $part;
|
||||
$this->content[ $part ] = $this->$method( $value );
|
||||
} else {
|
||||
$this->content[ $part ] = $this->parseString( $value );
|
||||
}
|
||||
// Set locked if value is locked by settings
|
||||
if ( $locked ) {
|
||||
$this->content[ $part ]['locked'] = true;
|
||||
}
|
||||
if ( 'true' === $this->getSettings( $part, 'hidden' ) ) {
|
||||
$this->content[ $part ]['hidden'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $part
|
||||
*
|
||||
* @return bool
|
||||
* @since 4.2
|
||||
*/
|
||||
protected function replaceLockedValue( $part ) {
|
||||
return in_array( $part, array(
|
||||
'size',
|
||||
'order_by',
|
||||
'order',
|
||||
), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 4.2
|
||||
*/
|
||||
public function getLabel( $key ) {
|
||||
return isset( $this->parts[ $key ] ) ? $this->parts[ $key ] : $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $part
|
||||
* @param $name
|
||||
*
|
||||
* @return null
|
||||
* @since 4.2
|
||||
*/
|
||||
public function getSettings( $part, $name ) {
|
||||
$settings_exists = isset( $this->settings[ $part ] ) && is_array( $this->settings[ $part ] );
|
||||
|
||||
return $settings_exists && isset( $this->settings[ $part ][ $name ] ) ? $this->settings[ $part ][ $name ] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function parseString( $value ) {
|
||||
return array( 'value' => $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
protected function parseDropDown( $value, $options = array() ) {
|
||||
return array(
|
||||
'value' => $value,
|
||||
'options' => $options,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
protected function parseMultiSelect( $value, $options = array() ) {
|
||||
return array(
|
||||
'value' => explode( ',', trim( $value, ',' ) ),
|
||||
'options' => $options,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function parse_order_by( $value ) {
|
||||
return $this->parseDropDown( $value, array(
|
||||
array(
|
||||
'date',
|
||||
esc_html__( 'Date', 'js_composer' ),
|
||||
),
|
||||
'ID',
|
||||
array(
|
||||
'author',
|
||||
esc_html__( 'Author', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'title',
|
||||
esc_html__( 'Title', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'modified',
|
||||
esc_html__( 'Modified', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'rand',
|
||||
esc_html__( 'Random', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'comment_count',
|
||||
esc_html__( 'Comment count', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'menu_order',
|
||||
esc_html__( 'Menu order', 'js_composer' ),
|
||||
),
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function parse_order( $value ) {
|
||||
return $this->parseDropDown( $value, array(
|
||||
array(
|
||||
'ASC',
|
||||
esc_html__( 'Ascending', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'DESC',
|
||||
esc_html__( 'Descending', 'js_composer' ),
|
||||
),
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function parse_post_type( $value ) {
|
||||
$options = array();
|
||||
$args = array(
|
||||
'public' => true,
|
||||
);
|
||||
$post_types = get_post_types( $args );
|
||||
foreach ( $post_types as $post_type ) {
|
||||
if ( 'attachment' !== $post_type ) {
|
||||
$options[] = $post_type;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function parse_authors( $value ) {
|
||||
$options = $not_in = array();
|
||||
if ( empty( $value ) ) {
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
$list = explode( ',', $value );
|
||||
foreach ( $list as $id ) {
|
||||
if ( (int) $id < 0 ) {
|
||||
$not_in[] = abs( $id );
|
||||
}
|
||||
}
|
||||
$users = get_users( array( 'include' => array_map( 'abs', $list ) ) );
|
||||
foreach ( $users as $user ) {
|
||||
$options[] = array(
|
||||
'value' => (string) $user->ID,
|
||||
'name' => $user->data->user_nicename,
|
||||
'action' => in_array( (int) $user->ID, $not_in, true ) ? '-' : '+',
|
||||
);
|
||||
}
|
||||
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function parse_categories( $value ) {
|
||||
$options = $not_in = array();
|
||||
if ( empty( $value ) ) {
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
$list = explode( ',', $value );
|
||||
foreach ( $list as $id ) {
|
||||
if ( (int) $id < 0 ) {
|
||||
$not_in[] = abs( $id );
|
||||
}
|
||||
}
|
||||
$list = get_categories( array( 'include' => array_map( 'abs', $list ) ) );
|
||||
foreach ( $list as $obj ) {
|
||||
$options[] = array(
|
||||
'value' => (string) $obj->cat_ID,
|
||||
'name' => $obj->cat_name,
|
||||
'action' => in_array( (int) $obj->cat_ID, $not_in, true ) ? '-' : '+',
|
||||
);
|
||||
}
|
||||
if ( empty( $list ) ) {
|
||||
$value = '';
|
||||
}
|
||||
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function parse_tags( $value ) {
|
||||
$options = $not_in = array();
|
||||
if ( empty( $value ) ) {
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
$list = explode( ',', $value );
|
||||
foreach ( $list as $id ) {
|
||||
if ( (int) $id < 0 ) {
|
||||
$not_in[] = abs( $id );
|
||||
}
|
||||
}
|
||||
$list = get_tags( array( 'include' => array_map( 'abs', $list ) ) );
|
||||
foreach ( $list as $obj ) {
|
||||
$options[] = array(
|
||||
'value' => (string) $obj->term_id,
|
||||
'name' => $obj->name,
|
||||
'action' => in_array( (int) $obj->term_id, $not_in, true ) ? '-' : '+',
|
||||
);
|
||||
}
|
||||
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function parse_tax_query( $value ) {
|
||||
$options = $not_in = array();
|
||||
if ( empty( $value ) ) {
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
$list = explode( ',', $value );
|
||||
foreach ( $list as $id ) {
|
||||
if ( (int) $id < 0 ) {
|
||||
$not_in[] = abs( $id );
|
||||
}
|
||||
}
|
||||
$list = get_terms( self::getTaxonomies(), array( 'include' => array_map( 'abs', $list ) ) );
|
||||
foreach ( $list as $obj ) {
|
||||
$options[] = array(
|
||||
'value' => (string) $obj->term_id,
|
||||
'name' => $obj->name,
|
||||
'action' => in_array( (int) $obj->term_id, $not_in, true ) ? '-' : '+',
|
||||
);
|
||||
}
|
||||
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function parse_by_id( $value ) {
|
||||
$options = $not_in = array();
|
||||
if ( empty( $value ) ) {
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
$list = explode( ',', $value );
|
||||
foreach ( $list as $id ) {
|
||||
if ( (int) $id < 0 ) {
|
||||
$not_in[] = abs( $id );
|
||||
}
|
||||
}
|
||||
$list = get_posts( array(
|
||||
'post_type' => 'any',
|
||||
'include' => array_map( 'abs', $list ),
|
||||
) );
|
||||
|
||||
foreach ( $list as $obj ) {
|
||||
$options[] = array(
|
||||
'value' => (string) $obj->ID,
|
||||
'name' => $obj->post_title,
|
||||
'action' => in_array( (int) $obj->ID, $not_in, true ) ? '-' : '+',
|
||||
);
|
||||
}
|
||||
|
||||
return $this->parseMultiSelect( $value, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
public function render() {
|
||||
echo wp_json_encode( $this->content );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public function getContent() {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* get list of taxonomies which has no tags and categories items.
|
||||
* @return array
|
||||
* @since 4.2
|
||||
* @static
|
||||
*/
|
||||
public static function getTaxonomies() {
|
||||
$taxonomy_exclude = (array) apply_filters( 'get_categories_taxonomy', 'category' );
|
||||
$taxonomy_exclude[] = 'post_tag';
|
||||
$taxonomies = array();
|
||||
foreach ( get_taxonomies() as $taxonomy ) {
|
||||
if ( ! in_array( $taxonomy, $taxonomy_exclude, true ) ) {
|
||||
$taxonomies[] = $taxonomy;
|
||||
}
|
||||
}
|
||||
|
||||
return $taxonomies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
*
|
||||
* @return string
|
||||
* @since 4.2
|
||||
*/
|
||||
public static function buildDefault( $settings ) {
|
||||
if ( ! isset( $settings['settings'] ) || ! is_array( $settings['settings'] ) ) {
|
||||
return '';
|
||||
}
|
||||
$value = '';
|
||||
foreach ( $settings['settings'] as $key => $val ) {
|
||||
if ( isset( $val['value'] ) ) {
|
||||
$value .= ( empty( $value ) ? '' : '|' ) . $key . ':' . $val['value'];
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
* @param bool $exclude_id
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public static function buildWpQuery( $query, $exclude_id = false ) {
|
||||
$data = self::parseData( $query );
|
||||
$query_builder = new VcLoopQueryBuilder( $data );
|
||||
if ( $exclude_id ) {
|
||||
$query_builder->excludeId( $exclude_id );
|
||||
}
|
||||
|
||||
return $query_builder->build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
public static function parseData( $value ) {
|
||||
$data = array();
|
||||
$values_pairs = preg_split( '/\|/', $value );
|
||||
foreach ( $values_pairs as $pair ) {
|
||||
if ( ! empty( $pair ) ) {
|
||||
list( $key, $value ) = preg_split( '/\:/', $pair );
|
||||
$data[ $key ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Suggestion list for wp_query field
|
||||
* Class VcLoopSuggestions
|
||||
* @since 4.2
|
||||
*/
|
||||
class VcLoopSuggestions {
|
||||
/**
|
||||
* @since 4.2
|
||||
* @var array
|
||||
*/
|
||||
protected $content = array();
|
||||
/**
|
||||
* @since 4.2
|
||||
* @var array
|
||||
*/
|
||||
protected $exclude = array();
|
||||
/**
|
||||
* @since 4.2
|
||||
* @var
|
||||
*/
|
||||
protected $field;
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $query
|
||||
* @param $exclude
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public function __construct( $field, $query, $exclude ) {
|
||||
$this->exclude = explode( ',', $exclude );
|
||||
$method_name = 'get_' . preg_replace( '/_out$/', '', $field );
|
||||
if ( method_exists( $this, $method_name ) ) {
|
||||
$this->$method_name( $query );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public function get_authors( $query ) {
|
||||
$args = ! empty( $query ) ? array(
|
||||
'search' => '*' . $query . '*',
|
||||
'search_columns' => array( 'user_nicename' ),
|
||||
) : array();
|
||||
if ( ! empty( $this->exclude ) ) {
|
||||
$args['exclude'] = $this->exclude;
|
||||
}
|
||||
$users = get_users( $args );
|
||||
foreach ( $users as $user ) {
|
||||
$this->content[] = array(
|
||||
'value' => (string) $user->ID,
|
||||
'name' => (string) $user->data->user_nicename,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public function get_categories( $query ) {
|
||||
$args = ! empty( $query ) ? array( 'search' => $query ) : array();
|
||||
if ( ! empty( $this->exclude ) ) {
|
||||
$args['exclude'] = $this->exclude;
|
||||
}
|
||||
$categories = get_categories( $args );
|
||||
|
||||
foreach ( $categories as $cat ) {
|
||||
$this->content[] = array(
|
||||
'value' => (string) $cat->cat_ID,
|
||||
'name' => $cat->cat_name,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public function get_tags( $query ) {
|
||||
$args = ! empty( $query ) ? array( 'search' => $query ) : array();
|
||||
if ( ! empty( $this->exclude ) ) {
|
||||
$args['exclude'] = $this->exclude;
|
||||
}
|
||||
$tags = get_tags( $args );
|
||||
foreach ( $tags as $tag ) {
|
||||
$this->content[] = array(
|
||||
'value' => (string) $tag->term_id,
|
||||
'name' => $tag->name,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public function get_tax_query( $query ) {
|
||||
$args = ! empty( $query ) ? array( 'search' => $query ) : array();
|
||||
if ( ! empty( $this->exclude ) ) {
|
||||
$args['exclude'] = $this->exclude;
|
||||
}
|
||||
$tags = get_terms( VcLoopSettings::getTaxonomies(), $args );
|
||||
foreach ( $tags as $tag ) {
|
||||
$this->content[] = array(
|
||||
'value' => $tag->term_id,
|
||||
'name' => $tag->name . ' (' . $tag->taxonomy . ')',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public function get_by_id( $query ) {
|
||||
$args = ! empty( $query ) ? array(
|
||||
's' => $query,
|
||||
'post_type' => 'any',
|
||||
'no_found_rows' => true,
|
||||
'orderby' => 'relevance',
|
||||
) : array(
|
||||
'post_type' => 'any',
|
||||
'no_found_rows' => true,
|
||||
'orderby' => 'relevance',
|
||||
);
|
||||
if ( ! empty( $this->exclude ) ) {
|
||||
$args['exclude'] = $this->exclude;
|
||||
}
|
||||
$args['ignore_sticky_posts'] = true;
|
||||
$posts = get_posts( $args );
|
||||
foreach ( $posts as $post ) {
|
||||
$this->content[] = array(
|
||||
'value' => $post->ID,
|
||||
'name' => $post->post_title,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
public function render() {
|
||||
echo wp_json_encode( $this->content );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build WP_Query object from query string.
|
||||
* String created by loop controllers
|
||||
*
|
||||
* @param $query
|
||||
* @param bool $exclude_id
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_build_loop_query( $query, $exclude_id = false ) {
|
||||
return VcLoopSettings::buildWpQuery( $query, $exclude_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_get_loop_suggestion() {
|
||||
vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie();
|
||||
|
||||
$loop_suggestions = new VcLoopSuggestions( vc_post_param( 'field' ), vc_post_param( 'query' ), vc_post_param( 'exclude' ) );
|
||||
$loop_suggestions->render();
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_get_loop_settings_json() {
|
||||
vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie();
|
||||
|
||||
$loop_settings = new VcLoopSettings( vc_post_param( 'value' ), vc_post_param( 'settings' ) );
|
||||
$loop_settings->render();
|
||||
die();
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_wpb_get_loop_suggestion', 'vc_get_loop_suggestion' );
|
||||
add_action( 'wp_ajax_wpb_get_loop_settings', 'vc_get_loop_settings_json' );
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_loop_include_templates() {
|
||||
require_once vc_path_dir( 'TEMPLATES_DIR', 'params/loop/templates.html' );
|
||||
}
|
||||
|
||||
add_action( 'admin_footer', 'vc_loop_include_templates' );
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_options_form_field( $settings, $value ) {
|
||||
return sprintf( '<div class="vc_options"><input name="%s" class="wpb_vc_param_value %s_field" type="hidden" value="%s"/><a href="#" class="button vc_options-edit %s_button">%s</a></div><div class="vc_options-fields" data-settings="%s"><a href="#" class="button vc_close-button">%s</a></div>', esc_attr( $settings['param_name'] ), esc_attr( $settings['param_name'] . ' ' . $settings['type'] ), $value, esc_attr( $settings['param_name'] ), esc_html__( 'Manage options', 'js_composer' ), htmlspecialchars( wp_json_encode( $settings['options'] ) ), esc_html__( 'Close', 'js_composer' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_options_include_templates() {
|
||||
require_once vc_path_dir( 'TEMPLATES_DIR', 'params/options/templates.html' );
|
||||
}
|
||||
|
||||
add_action( 'admin_footer', 'vc_options_include_templates' );
|
||||
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'EDITORS_DIR', 'class-vc-edit-form-fields.php' );
|
||||
|
||||
/**
|
||||
* Class Vc_ParamGroup_Edit_Form_Fields
|
||||
* @since 4.4
|
||||
*/
|
||||
class Vc_ParamGroup_Edit_Form_Fields extends Vc_Edit_Form_Fields {
|
||||
/** @noinspection PhpMissingParentConstructorInspection */
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @since 4.4
|
||||
*
|
||||
*/
|
||||
public function __construct( $settings ) {
|
||||
$this->setSettings( $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get shortcode attribute value wrapper for params group.
|
||||
*
|
||||
* This function checks if value isn't set then it uses std or value fields in param settings.
|
||||
* @param $params_settings
|
||||
* @param null $value
|
||||
*
|
||||
* @return mixed;
|
||||
* @since 5.2.1
|
||||
*
|
||||
*/
|
||||
public function getParamGroupAttributeValue( $params_settings, $value = null ) {
|
||||
return $this->parseShortcodeAttributeValue( $params_settings, $value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Vc_ParamGroup
|
||||
* @since 4.4
|
||||
*/
|
||||
class Vc_ParamGroup {
|
||||
/**
|
||||
* @since 4.4
|
||||
* @var
|
||||
*/
|
||||
protected $settings;
|
||||
/**
|
||||
* @since 4.4
|
||||
* @var array|mixed
|
||||
*/
|
||||
protected $value;
|
||||
/**
|
||||
* @since 4.4
|
||||
* @var
|
||||
*/
|
||||
protected $map;
|
||||
/**
|
||||
* @since 4.4
|
||||
* @var
|
||||
*/
|
||||
protected $atts;
|
||||
public $unparsed_value;
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
* @param $tag
|
||||
*
|
||||
* @since 4.4
|
||||
*/
|
||||
public function __construct( $settings, $value, $tag ) {
|
||||
$this->settings = $settings;
|
||||
$this->settings['base'] = $tag;
|
||||
$this->value = vc_param_group_parse_atts( $value );
|
||||
$this->unparsed_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $param_name
|
||||
* @param $arr
|
||||
*
|
||||
* @return array
|
||||
* @since 4.4
|
||||
*/
|
||||
public function params_to_arr( $param_name, $arr ) {
|
||||
$data = array();
|
||||
foreach ( $arr as $param ) {
|
||||
$data[ $param_name . '_' . $param['param_name'] ] = $param['type'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|string
|
||||
* @since 4.4
|
||||
*/
|
||||
public function render() {
|
||||
$output = '';
|
||||
$edit_form = new Vc_ParamGroup_Edit_Form_Fields( $this->settings );
|
||||
|
||||
$settings = $this->settings;
|
||||
$output .= '<ul class="vc_param_group-list vc_settings" data-settings="' . htmlentities( wp_json_encode( $settings ), ENT_QUOTES, 'utf-8' ) . '">';
|
||||
|
||||
$template = vc_include_template( 'params/param_group/content.tpl.php' );
|
||||
|
||||
// Parsing values
|
||||
if ( ! empty( $this->value ) ) {
|
||||
foreach ( $this->value as $values ) {
|
||||
$output .= $template;
|
||||
$value_block = "<div class='vc_param_group-wrapper vc_clearfix'>";
|
||||
$data = $values;
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
$param_value = isset( $data[ $param['param_name'] ] ) ? $data[ $param['param_name'] ] : ( isset( $param['value'] ) ? $param['value'] : null );
|
||||
$param['param_name'] = $this->settings['param_name'] . '_' . $param['param_name'];
|
||||
$value = $edit_form->getParamGroupAttributeValue( $param, $param_value );
|
||||
$value_block .= $edit_form->renderField( $param, $value );
|
||||
}
|
||||
$value_block .= '</div>';
|
||||
$output = str_replace( '%content%', $value_block, $output );
|
||||
}
|
||||
} else {
|
||||
$output .= $template;
|
||||
|
||||
}
|
||||
|
||||
// Empty fields wrapper and Add new fields wrapper
|
||||
$content = "<div class='vc_param_group-wrapper vc_clearfix'>";
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
$param['param_name'] = $this->settings['param_name'] . '_' . $param['param_name'];
|
||||
$value = $edit_form->getParamGroupAttributeValue( $param );
|
||||
$content .= $edit_form->renderField( $param, $value );
|
||||
}
|
||||
$content .= '</div>';
|
||||
$output = str_replace( '%content%', $content, $output );
|
||||
|
||||
// And button on bottom
|
||||
$output .= '<li class="wpb_column_container vc_container_for_children vc_param_group-add_content vc_empty-container"></li></ul>';
|
||||
|
||||
$add_template = vc_include_template( 'params/param_group/add.tpl.php' );
|
||||
$add_template = str_replace( '%content%', $content, $add_template );
|
||||
|
||||
$custom_tag = 'script';
|
||||
$output .= '<' . $custom_tag . ' type="text/html" class="vc_param_group-template">' . wp_json_encode( $add_template ) . '</' . $custom_tag . '>';
|
||||
$output .= '<input name="' . $this->settings['param_name'] . '" class="wpb_vc_param_value ' . $this->settings['param_name'] . ' ' . $this->settings['type'] . '_field" type="hidden" value="' . $this->unparsed_value . '" />';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for rendering param in edit form (add element)
|
||||
* Parse settings from vc_map and entered values.
|
||||
*
|
||||
* @param $param_settings
|
||||
* @param $param_value
|
||||
* @param $tag
|
||||
*
|
||||
* @return mixed rendered template for params in edit form
|
||||
* @since 4.4
|
||||
*
|
||||
* vc_filter: vc_param_group_render_filter
|
||||
*
|
||||
*/
|
||||
function vc_param_group_form_field( $param_settings, $param_value, $tag ) {
|
||||
$param_group = new Vc_ParamGroup( $param_settings, $param_value, $tag );
|
||||
|
||||
return apply_filters( 'vc_param_group_render_filter', $param_group->render() );
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_vc_param_group_clone', 'vc_param_group_clone' );
|
||||
|
||||
/**
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_param_group_clone() {
|
||||
vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie();
|
||||
|
||||
$param = vc_post_param( 'param' );
|
||||
$value = vc_post_param( 'value' );
|
||||
$tag = vc_post_param( 'shortcode' );
|
||||
wp_send_json_success( vc_param_group_clone_by_data( $tag, json_decode( rawurldecode( $param ), true ), json_decode( rawurldecode( $value ), true ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $tag
|
||||
* @param $params
|
||||
* @param $data
|
||||
*
|
||||
* @return mixed|string
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_param_group_clone_by_data( $tag, $params, $data ) {
|
||||
$output = '';
|
||||
$params['base'] = $tag;
|
||||
$edit_form = new Vc_ParamGroup_Edit_Form_Fields( $params );
|
||||
$edit_form->loadDefaultParams();
|
||||
|
||||
$template = vc_include_template( 'params/param_group/content.tpl.php' );
|
||||
$output .= $template;
|
||||
$value_block = "<div class='vc_param_group-wrapper vc_clearfix'>";
|
||||
|
||||
$data = $data[0];
|
||||
if ( isset( $params['params'] ) && is_array( $params['params'] ) ) {
|
||||
foreach ( $params['params'] as $param ) {
|
||||
$param_data = isset( $data[ $param['param_name'] ] ) ? $data[ $param['param_name'] ] : ( isset( $param['value'] ) ? $param['value'] : '' );
|
||||
$param['param_name'] = $params['param_name'] . '_' . $param['param_name'];
|
||||
$value_block .= $edit_form->renderField( $param, $param_data );
|
||||
}
|
||||
}
|
||||
$value_block .= '</div>';
|
||||
$output = str_replace( '%content%', $value_block, $output );
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts_string
|
||||
*
|
||||
* @return array|mixed
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_param_group_parse_atts( $atts_string ) {
|
||||
$array = json_decode( urldecode( $atts_string ), true );
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
add_filter( 'vc_map_get_param_defaults', 'vc_param_group_param_defaults', 10, 2 );
|
||||
/**
|
||||
* @param $value
|
||||
* @param $param
|
||||
* @return string
|
||||
*/
|
||||
function vc_param_group_param_defaults( $value, $param ) {
|
||||
if ( 'param_group' === $param['type'] && isset( $param['params'] ) && empty( $value ) ) {
|
||||
$defaults = vc_map_get_params_defaults( $param['params'] );
|
||||
$value = rawurlencode( wp_json_encode( array( $defaults ) ) );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
112
wp-content/plugins/js_composer/include/params/params.php
Normal file
112
wp-content/plugins/js_composer/include/params/params.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes attributes class.
|
||||
*
|
||||
* This class and functions represents ability which will allow you to create attributes settings fields to
|
||||
* control new attributes.
|
||||
* New attributes can be added to shortcode settings by using param array in wp_map function
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Shortcode params class allows to create new params types.
|
||||
* class WpbakeryShortcodeParams
|
||||
* @since 4.2
|
||||
*/
|
||||
class WpbakeryShortcodeParams {
|
||||
/**
|
||||
* @since 4.2
|
||||
* @var array - store shortcode attributes types
|
||||
*/
|
||||
protected static $params = array();
|
||||
/**
|
||||
* @since 4.2
|
||||
* @var array - store shortcode javascript files urls
|
||||
*/
|
||||
protected static $scripts = array();
|
||||
/**
|
||||
* @since 4.7
|
||||
* @var array - store params not required to init
|
||||
*/
|
||||
protected static $optional_init_params = array();
|
||||
|
||||
/**
|
||||
* Get list of params that need to be initialized
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getRequiredInitParams() {
|
||||
$all_params = array_keys( self::$params );
|
||||
$optional_params = apply_filters( 'vc_edit_form_fields_optional_params', self::$optional_init_params );
|
||||
$required_params = array_diff( $all_params, $optional_params );
|
||||
|
||||
return $required_params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new attribute type
|
||||
*
|
||||
* @static
|
||||
* @param $name - attribute name
|
||||
* @param $form_field_callback - hook, will be called when settings form is shown and attribute added to shortcode
|
||||
* param list
|
||||
* @param $script_url - javascript file url which will be attached at the end of settings form.
|
||||
*
|
||||
* @return bool - return true if attribute type created
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
public static function addField( $name, $form_field_callback, $script_url = null ) {
|
||||
$result = false;
|
||||
if ( ! empty( $name ) && ! empty( $form_field_callback ) ) {
|
||||
self::$params[ $name ] = array(
|
||||
'callbacks' => array(
|
||||
'form' => $form_field_callback,
|
||||
),
|
||||
);
|
||||
$result = true;
|
||||
|
||||
if ( is_string( $script_url ) && ! in_array( $script_url, self::$scripts, true ) ) {
|
||||
self::$scripts[] = $script_url;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls hook for attribute type
|
||||
* @param $name - attribute name
|
||||
* @param $param_settings - attribute settings from shortcode
|
||||
* @param $param_value - attribute value
|
||||
* @param $tag - attribute tag
|
||||
*
|
||||
* @return mixed|string - returns html which will be render in hook
|
||||
* @since 4.2
|
||||
* @static
|
||||
*
|
||||
*/
|
||||
public static function renderSettingsField( $name, $param_settings, $param_value, $tag ) {
|
||||
if ( isset( self::$params[ $name ]['callbacks']['form'] ) ) {
|
||||
return call_user_func( self::$params[ $name ]['callbacks']['form'], $param_settings, $param_value, $tag );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* List of javascript files urls for shortcode attributes.
|
||||
* @return array - list of js scripts
|
||||
* @since 4.2
|
||||
* @static
|
||||
*/
|
||||
public static function getScripts() {
|
||||
return self::$scripts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Params preset shortcode attribute type generator.
|
||||
*
|
||||
* Allows to set list of attributes which will be
|
||||
*
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string - html string.
|
||||
* @since 4.4
|
||||
*/
|
||||
function vc_params_preset_form_field( $settings, $value ) {
|
||||
$output = '';
|
||||
$output .= '<select name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value vc_params-preset-select ' . esc_attr( $settings['param_name'] . ' ' . $settings['type'] ) . '">';
|
||||
foreach ( $settings['options'] as $option ) {
|
||||
$selected = '';
|
||||
if ( isset( $option['value'] ) ) {
|
||||
$option_value_string = (string) $option['value'];
|
||||
$value_string = (string) $value;
|
||||
if ( '' !== $value && $option_value_string === $value_string ) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
$output .= '<option class="vc_params-preset-' . esc_attr( $option['value'] ) . '" value="' . esc_attr( $option['value'] ) . '" ' . $selected . ' data-params="' . esc_attr( wp_json_encode( $option['params'] ) ) . '">' . esc_html( isset( $option['label'] ) ? $option['label'] : $option['value'] ) . '</option>';
|
||||
}
|
||||
}
|
||||
$output .= '</select>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_sorted_list_form_field( $settings, $value ) {
|
||||
return sprintf( '<div class="vc_sorted-list"><input name="%s" class="wpb_vc_param_value %s %s_field" type="hidden" value="%s" /><div class="vc_sorted-list-toolbar">%s</div><ul class="vc_sorted-list-container"></ul></div>', $settings['param_name'], $settings['param_name'], $settings['type'], $value, vc_sorted_list_parts_list( $settings['options'] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $list
|
||||
*
|
||||
* @return string
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_sorted_list_parts_list( $list ) {
|
||||
$output = '';
|
||||
foreach ( $list as $control ) {
|
||||
$output .= sprintf( '<div class="vc_sorted-list-checkbox"><label><input type="checkbox" name="vc_sorted_list_element" value="%s" data-element="%s" data-subcontrol="%s"> <span>%s</span></label></div>', $control[0], $control[0], count( $control ) > 1 ? htmlspecialchars( wp_json_encode( array_slice( $control, 2 ) ) ) : '', htmlspecialchars( $control[1] ) );
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_sorted_list_parse_value( $value ) {
|
||||
$data = array();
|
||||
$split = preg_split( '/\,/', $value );
|
||||
foreach ( $split as $v ) {
|
||||
$v_split = array_map( 'rawurldecode', preg_split( '/\|/', $v ) );
|
||||
$count = count( $v_split );
|
||||
if ( $count > 0 ) {
|
||||
$data[] = array(
|
||||
$v_split[0],
|
||||
$count > 1 ? array_slice( $v_split, 1 ) : array(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_tab_id_form_field( $settings, $value ) {
|
||||
$output = sprintf( '<div class="my_param_block"><input name="%s" class="wpb_vc_param_value wpb-textinput %s_field" type="hidden" value="%s" /><label>%s</label></div>', esc_attr( $settings['param_name'] ), esc_attr( $settings['param_name'] . ' ' . $settings['type'] ), $value, $value );
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
global $vc_html_editor_already_is_use;
|
||||
$vc_html_editor_already_is_use = false;
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_textarea_html_form_field( $settings, $value ) {
|
||||
global $vc_html_editor_already_is_use;
|
||||
$output = '';
|
||||
if ( false !== $vc_html_editor_already_is_use ) {
|
||||
$output .= '<textarea name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-textarea ' . esc_attr( $settings['param_name'] ) . ' textarea">' . $value . '</textarea>';
|
||||
$output .= '<div class="updated"><p>' . sprintf( esc_html__( 'Field type is changed from "textarea_html" to "textarea", because it is already used by %s field. Textarea_html field\'s type can be used only once per shortcode.', 'js_composer' ), $vc_html_editor_already_is_use ) . '</p></div>';
|
||||
} elseif ( function_exists( 'wp_editor' ) ) {
|
||||
$default_content = $value;
|
||||
// WP 3.3+
|
||||
ob_start();
|
||||
wp_editor( '', 'wpb_tinymce_' . esc_attr( $settings['param_name'] ), array(
|
||||
'editor_class' => 'wpb-textarea visual_composer_tinymce ' . esc_attr( $settings['param_name'] . ' ' . $settings['type'] ),
|
||||
'media_buttons' => true,
|
||||
'wpautop' => false,
|
||||
) );
|
||||
$output_value = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$output .= $output_value . '<input type="hidden" name="' . esc_attr( $settings['param_name'] ) . '" class="vc_textarea_html_content wpb_vc_param_value ' . esc_attr( $settings['param_name'] ) . '" value="' . htmlspecialchars( $default_content ) . '"/>';
|
||||
$vc_html_editor_already_is_use = $settings['param_name'];
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Vc_Grid_Element
|
||||
*/
|
||||
class Vc_Grid_Element {
|
||||
protected $template = '';
|
||||
protected $html_template = false;
|
||||
protected $post = false;
|
||||
protected $attributes = array();
|
||||
protected $grid_atts = array();
|
||||
protected $is_end = false;
|
||||
protected static $templates_added = false;
|
||||
protected $shortcodes = array(
|
||||
'vc_gitem_row',
|
||||
'vc_gitem_col',
|
||||
'vc_gitem_post_title',
|
||||
'vc_gitem_icon',
|
||||
);
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function shortcodes() {
|
||||
return $this->shortcodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $template
|
||||
*/
|
||||
public function setTemplate( $template ) {
|
||||
$this->template = $template;
|
||||
$this->parseTemplate( $template );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function template() {
|
||||
return $this->template;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $template
|
||||
*/
|
||||
public function parseTemplate( $template ) {
|
||||
$this->setShortcodes();
|
||||
$this->html_template = do_shortcode( $template );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WP_Post $post
|
||||
* @return string
|
||||
*/
|
||||
public function renderItem( WP_Post $post ) {
|
||||
$attributes = $this->attributes();
|
||||
$pattern = array();
|
||||
$replacement = array();
|
||||
foreach ( $attributes as $attr ) {
|
||||
$pattern[] = '/\{\{' . preg_quote( $attr, '' ) . '\}\}/';
|
||||
$replacement[] = $this->attribute( $attr, $post );
|
||||
}
|
||||
$css_class_items = 'vc_grid-item ' . ( $this->isEnd() ? ' vc_grid-last-item ' : '' ) . ' vc_grid-thumb vc_theme-thumb-full-overlay vc_animation-slide-left vc_col-sm-' . $this->gridAttribute( 'element_width', 12 );
|
||||
foreach ( $post->filter_terms as $t ) {
|
||||
$css_class_items .= ' vc_grid-term-' . $t;
|
||||
}
|
||||
|
||||
return '<div class="' . $css_class_items . '">' . "\n" . preg_replace( $pattern, $replacement, $this->html_template ) . "\n" . '</div>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function renderParam() {
|
||||
$output = '<div class="vc_grid-element-constructor" data-vc-grid-element="builder"></div>' . '<a href="#" data-vc-control="add-row">' . esc_html__( 'Add row', 'js_composer' ) . '</a>';
|
||||
if ( false === self::$templates_added ) {
|
||||
foreach ( $this->shortcodes as $tag ) {
|
||||
$method = vc_camel_case( $tag . '_template' );
|
||||
if ( method_exists( $this, $method ) ) {
|
||||
$content = $this->$method();
|
||||
} else {
|
||||
$content = $this->vcDefaultTemplate( $tag );
|
||||
}
|
||||
$custom_tag = 'script';
|
||||
$output .= '<' . $custom_tag . ' type="text/template" data-vc-grid-element-template="' . esc_attr( $tag ) . '">' . $content . '</' . $custom_tag . '>';
|
||||
$output .= '<' . $custom_tag . ' type="text/template" data-vc-grid-element-template="modal">' . '<div class="vc_grid-element-modal-title"><# title #></div>' . '<div class="vc_grid-element-modal-controls"><# controls #></div>' . '<div class="vc_grid-element-modal-body"><# body #></div>' . '</' . $custom_tag . '>';
|
||||
}
|
||||
self::$templates_added = true;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $grid_atts
|
||||
*/
|
||||
public function setGridAttributes( $grid_atts ) {
|
||||
$this->grid_atts = $grid_atts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param string $default
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function gridAttribute( $name, $default = '' ) {
|
||||
return isset( $this->grid_atts[ $name ] ) ? $this->grid_atts[ $name ] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*/
|
||||
public function setAttribute( $name ) {
|
||||
$this->attributes[] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function attributes() {
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $post
|
||||
* @return string
|
||||
*/
|
||||
public function attribute( $name, $post ) {
|
||||
if ( method_exists( $this, 'attribute' . ucfirst( $name ) ) ) {
|
||||
$method_name = 'attribute' . ucfirst( $name );
|
||||
|
||||
return $this->$method_name( $post );
|
||||
}
|
||||
if ( isset( $post->$name ) ) {
|
||||
return $post->$name;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $is_end
|
||||
*/
|
||||
public function setIsEnd( $is_end = true ) {
|
||||
$this->is_end = $is_end;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnd() {
|
||||
return $this->is_end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set elements templates.
|
||||
*/
|
||||
protected function setShortcodes() {
|
||||
foreach ( $this->shortcodes as $tag ) {
|
||||
add_shortcode( $tag, array(
|
||||
$this,
|
||||
vc_camel_case( $tag . '_shortcode' ),
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
public function vcGitemRowShortcode( $atts, $content = '' ) {
|
||||
return '<div class="vc_row vc_gitem-row' . $this->gridAttribute( 'element_width' ) . '">' . "\n" . do_shortcode( $content ) . "\n" . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function vcGitemRowTemplate() {
|
||||
$output = '<div class="vc_gitem-wrapper">';
|
||||
$output .= '<div class="vc_t-grid-controls vc_t-grid-controls-row" data-vc-element-shortcode="controls">';
|
||||
// Move control
|
||||
$output .= '<a class="vc_t-grid-control vc_t-grid-control-move" href="#" title="' . esc_html__( 'Drag row to reorder', 'js_composer' ) . '" data-vc-element-control="move"><i class="vc_t-grid-icon vc_t-grid-icon-move"></i></a>';
|
||||
// Layout control
|
||||
$output .= '<span class="vc_t-grid-control vc_t-grid-control-layouts" style="display: none;">' // vc_col-sm-12
|
||||
. '<a class="vc_t-grid-control vc_t-grid-control-layout" data-cells="12" title="' . '1/1' . '" data-vc-element-control="layouts">' . '<i class="vc_t-grid-icon vc_t-grid-icon-layout-12"></i></a>' // vc_col-sm-6 + vc_col-sm-6
|
||||
. '<a class="vc_t-grid-control vc_t-grid-control-layout" data-cells="6_6" title="' . '1/2 + 1/2' . '" data-vc-element-control="layouts">' . '<i class="vc_t-grid-icon vc_t-grid-icon-layout-6-6"></i></a>' // vc_col-sm-4 + vc_col-sm-4 + vc_col-sm-4
|
||||
. '<a class="vc_t-grid-control vc_t-grid-control-layout" data-cells="4_4_4" title="' . '1/3 + 1/3 + 1/3' . '" data-vc-element-control="layouts">' . '<i class="vc_t-grid-icon vc_t-grid-icon-layout-4-4-4"></i></a>' . '</span>' . '<span class="vc_pull-right">' // Destroy control
|
||||
. '<a class="vc_t-grid-control vc_t-grid-control-destroy" href="#" title="' . esc_attr__( 'Delete this row', 'js_composer' ) . '" data-vc-element-control="destroy">' . '<i class="vc_t-grid-icon vc_t-grid-icon-destroy"></i>' . '</a>' . '</span>';
|
||||
$output .= '</div>';
|
||||
$output .= '<div data-vc-element-shortcode="content" class="vc_row vc_gitem-content"></div>';
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
public function vcGitemColShortcode( $atts, $content = '' ) {
|
||||
$width = '12';
|
||||
$atts = shortcode_atts( array(
|
||||
'width' => '12',
|
||||
), $atts );
|
||||
extract( $atts );
|
||||
|
||||
return '<div class="vc_col-sm-' . $width . ' vc_gitem-col">' . "\n" . do_shortcode( $content ) . "\n" . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function vcGitemColTemplate() {
|
||||
$output = '<div class="vc_gitem-wrapper">';
|
||||
// Controls
|
||||
// Control "Add"
|
||||
$controls = '<a class="vc_t-grid-control vc_t-grid-control-add" href="#" title="' . esc_attr__( 'Prepend to this column', 'js_composer' ) . '" data-vc-element-control="add">' . '<i class="vc_t-grid-icon vc_t-grid-icon-add"></i>' . '</a>';
|
||||
$output .= '<div class="vc_t-grid-controls vc_t-grid-controls-col" data-vc-element-shortcode="controls">' . $controls . '</div>';
|
||||
// Content
|
||||
$output .= '<div data-vc-element-shortcode="content" class="vc_gitem-content">' . '</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
public function vcGitemPostTitleShortcode( $atts, $content = '' ) {
|
||||
$atts = shortcode_atts( array(), $atts );
|
||||
extract( $atts );
|
||||
$this->setAttribute( 'post_title' );
|
||||
|
||||
return '<h3 data-vc-element-shortcode="content" class="vc_ptitle">{{post_title}}</h3>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $tag
|
||||
* @return string
|
||||
*/
|
||||
public function vcDefaultTemplate( $tag ) {
|
||||
$name = preg_replace( '/^vc_gitem_/', '', $tag );
|
||||
$title = ucfirst( preg_replace( '/\_/', ' ', $name ) );
|
||||
|
||||
return '<div class="vc_gitem-wrapper">' . $this->elementControls( $title, preg_match( '/^post/', $name ) ? 'orange' : 'green' ) . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $title
|
||||
* @param null $theme
|
||||
* @return string
|
||||
*/
|
||||
protected function elementControls( $title, $theme = null ) {
|
||||
return '<div class="vc_t-grid-controls vc_t-grid-controls-element' . ( is_string( $theme ) ? ' vc_th-controls-element-' . $theme : '' ) . '" data-vc-element-shortcode="controls">' // Move control
|
||||
. '<a class="vc_t-grid-control vc_t-grid-control-move" href="#" title="' . esc_attr__( 'Drag to reorder', 'js_composer' ) . '" data-vc-element-control="move">' . '<i class="vc_t-grid-icon vc_t-grid-icon-move"></i>' . '</a>' // Label
|
||||
. '<span class="vc_t-grid-control vc_t-grid-control-name" data-vc-element-control="name">
|
||||
' . $title . '</span>' // Edit control
|
||||
. '<a class="vc_t-grid-control vc_t-grid-control-edit" data-vc-element-control="edit">' . '<i class="vc_t-grid-icon vc_t-grid-icon-edit"></i>' . '</a>' // Delete control
|
||||
. '<a class="vc_t-grid-control vc_t-grid-control-destroy" data-vc-element-control="destroy">' . '<i class="vc_t-grid-icon vc_t-grid-icon-destroy"></i>' . '</a>' . '</div>';
|
||||
}
|
||||
// }}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
* @return string
|
||||
*/
|
||||
function vc_vc_grid_element_form_field( $settings, $value ) {
|
||||
$grid_element = new Vc_Grid_Element();
|
||||
|
||||
return '<div data-vc-grid-element="container" data-vc-grid-tags-list="' . esc_attr( wp_json_encode( $grid_element->shortcodes() ) ) . '">' . '<input data-vc-grid-element="value" type="hidden" name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textinput ' . $settings['param_name'] . ' ' . $settings['type'] . '_field" ' . ' value="' . esc_attr( $value ) . '">' . $grid_element->renderParam() . '</div>';
|
||||
}
|
||||
|
||||
function vc_load_vc_grid_element_param() {
|
||||
vc_add_shortcode_param( 'vc_grid_element', 'vc_vc_grid_element_form_field' );
|
||||
}
|
||||
|
||||
add_action( 'vc_load_default_params', 'vc_load_vc_grid_element_param' );
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.4.3
|
||||
*/
|
||||
function vc_vc_grid_id_form_field( $settings, $value ) {
|
||||
return sprintf( '<div class="vc_param-vc-grid-id"><input name="%s" class="wpb_vc_param_value wpb-textinput %s_field" type="hidden" value="%s" /></div>', esc_attr( $settings['param_name'] ), esc_attr( $settings['param_name'] . ' ' . $settings['type'] ), $value );
|
||||
}
|
||||
@@ -0,0 +1,460 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build css classes from terms of the post.
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
*
|
||||
* @return string
|
||||
* @since 4.4
|
||||
*
|
||||
*/
|
||||
function vc_gitem_template_attribute_filter_terms_css_classes( $value, $data ) {
|
||||
$output = '';
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
), $data ) );
|
||||
if ( isset( $post->filter_terms ) && is_array( $post->filter_terms ) ) {
|
||||
foreach ( $post->filter_terms as $t ) {
|
||||
$output .= ' vc_grid-term-' . $t; // @todo fix #106154391786878 $t is array
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image for post
|
||||
*
|
||||
* @param $data
|
||||
* @return mixed|string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_image( $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
if ( 'attachment' === $post->post_type ) {
|
||||
return wp_get_attachment_image( $post->ID, 'large' );
|
||||
}
|
||||
$html = get_the_post_thumbnail( $post->ID );
|
||||
|
||||
return apply_filters( 'vc_gitem_template_attribute_post_image_html', $html );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
*/
|
||||
function vc_gitem_template_attribute_featured_image( $value, $data ) {
|
||||
/**
|
||||
* @var Wp_Post $post
|
||||
* @var string $data
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
|
||||
return vc_include_template( 'params/vc_grid_item/attributes/featured_image.php', array(
|
||||
'post' => $post,
|
||||
'data' => $data,
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new btn
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
*
|
||||
* @return mixed
|
||||
* @since 4.5
|
||||
*
|
||||
*/
|
||||
function vc_gitem_template_attribute_vc_btn( $value, $data ) {
|
||||
/**
|
||||
* @var Wp_Post $post
|
||||
* @var string $data
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
|
||||
return vc_include_template( 'params/vc_grid_item/attributes/vc_btn.php', array(
|
||||
'post' => $post,
|
||||
'data' => $data,
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post image url
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_image_url( $value, $data ) {
|
||||
$output = '';
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
$extraImageMeta = explode( ':', $data );
|
||||
$size = 'large'; // default size
|
||||
if ( isset( $extraImageMeta[1] ) ) {
|
||||
$size = $extraImageMeta[1];
|
||||
}
|
||||
if ( 'attachment' === $post->post_type ) {
|
||||
$src = vc_get_image_by_size( $post->ID, $size );
|
||||
} else {
|
||||
$attachment_id = get_post_thumbnail_id( $post->ID );
|
||||
$src = vc_get_image_by_size( $attachment_id, $size );
|
||||
}
|
||||
|
||||
if ( ! empty( $src ) ) {
|
||||
$output = is_array( $src ) ? $src[0] : $src;
|
||||
} else {
|
||||
$output = vc_asset_url( 'vc/vc_gitem_image.png' );
|
||||
}
|
||||
|
||||
return apply_filters( 'vc_gitem_template_attribute_post_image_url_value', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post image url with href for a dom element
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_image_url_href( $value, $data ) {
|
||||
$link = vc_gitem_template_attribute_post_image_url( $value, $data );
|
||||
|
||||
return strlen( $link ) ? ' href="' . esc_url( $link ) . '"' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add image url as href with css classes for PrettyPhoto js plugin.
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_image_url_attr_prettyphoto( $value, $data ) {
|
||||
$data_default = $data;
|
||||
/**
|
||||
* @var Wp_Post $post ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
$href = vc_gitem_template_attribute_post_image_url_href( $value, array(
|
||||
'post' => $post,
|
||||
'data' => '',
|
||||
) );
|
||||
$rel = ' data-rel="' . esc_attr( 'prettyPhoto[rel-' . md5( vc_request_param( 'shortcode_id' ) ) . ']' ) . '"';
|
||||
|
||||
return $href . $rel . ' class="' . esc_attr( $data . ( strlen( $href ) ? ' prettyphoto' : '' ) ) . '" title="' . esc_attr( apply_filters( 'vc_gitem_template_attribute_post_title', $post->post_title, $data_default ) ) . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post image alt
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_image_alt( $value, $data ) {
|
||||
if ( empty( $data['post']->ID ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( 'attachment' === $data['post']->post_type ) {
|
||||
$attachment_id = $data['post']->ID;
|
||||
} else {
|
||||
$attachment_id = get_post_thumbnail_id( $data['post']->ID );
|
||||
}
|
||||
|
||||
if ( ! $attachment_id ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$alt = trim( wp_strip_all_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) );
|
||||
|
||||
return apply_filters( 'vc_gitem_template_attribute_post_image_url_value', $alt );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post image url
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_image_background_image_css( $value, $data ) {
|
||||
$output = '';
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
$size = 'large'; // default size
|
||||
if ( ! empty( $data ) ) {
|
||||
$size = $data;
|
||||
}
|
||||
if ( 'attachment' === $post->post_type ) {
|
||||
$src = vc_get_image_by_size( $post->ID, $size );
|
||||
} else {
|
||||
$attachment_id = get_post_thumbnail_id( $post->ID );
|
||||
$src = vc_get_image_by_size( $attachment_id, $size );
|
||||
}
|
||||
if ( ! empty( $src ) ) {
|
||||
$output = 'background-image: url(\'' . ( is_array( $src ) ? $src[0] : $src ) . '\') !important;';
|
||||
} else {
|
||||
$output = 'background-image: url(\'' . vc_asset_url( 'vc/vc_gitem_image.png' ) . '\') !important;';
|
||||
}
|
||||
|
||||
return apply_filters( 'vc_gitem_template_attribute_post_image_background_image_css_value', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post link
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return bool|string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_link_url( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
), $data ) );
|
||||
|
||||
return get_permalink( $post->ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post date
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return bool|int|string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_date( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
), $data ) );
|
||||
|
||||
return get_the_date( '', $post->ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post date time
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return bool|int|string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_datetime( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
), $data ) );
|
||||
|
||||
return get_the_time( 'F j, Y g:i', $post->ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom fields.
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed|string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_meta_value( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
* @var string $data ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
|
||||
return strlen( $data ) > 0 ? get_post_meta( $post->ID, $data, true ) : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post data. Used as wrapper for others post data attributes.
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed|string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_data( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
* @var string $data ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
|
||||
return strlen( $data ) > 0 ? apply_filters( 'vc_gitem_template_attribute_' . $data, ( isset( $post->$data ) ? $post->$data : '' ), array(
|
||||
'post' => $post,
|
||||
'data' => '',
|
||||
) ) : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post excerpt. Used as wrapper for others post data attributes.
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed|string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_excerpt( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
* @var string $data ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
|
||||
return apply_filters( 'the_excerpt', apply_filters( 'get_the_excerpt', $value ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post excerpt. Used as wrapper for others post data attributes.
|
||||
*
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed|string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_title( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
* @var string $data ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
|
||||
return the_title( '', '', false );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|null
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_author( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
* @var string $data ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
|
||||
return get_the_author();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_author_href( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
* @var string $data ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
|
||||
return get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
*/
|
||||
function vc_gitem_template_attribute_post_categories( $value, $data ) {
|
||||
/**
|
||||
* @var null|Wp_Post $post ;
|
||||
* @var string $data ;
|
||||
*/
|
||||
extract( array_merge( array(
|
||||
'post' => null,
|
||||
'data' => '',
|
||||
), $data ) );
|
||||
$atts_extended = array();
|
||||
parse_str( $data, $atts_extended );
|
||||
|
||||
return vc_include_template( 'params/vc_grid_item/attributes/post_categories.php', array(
|
||||
'post' => $post,
|
||||
'atts' => $atts_extended['atts'],
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding filters to parse grid template.
|
||||
*/
|
||||
add_filter( 'vc_gitem_template_attribute_filter_terms_css_classes', 'vc_gitem_template_attribute_filter_terms_css_classes', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_image', 'vc_gitem_template_attribute_post_image', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_image_url', 'vc_gitem_template_attribute_post_image_url', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_image_url_href', 'vc_gitem_template_attribute_post_image_url_href', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_image_url_attr_prettyphoto', 'vc_gitem_template_attribute_post_image_url_attr_prettyphoto', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_image_alt', 'vc_gitem_template_attribute_post_image_alt', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_link_url', 'vc_gitem_template_attribute_post_link_url', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_date', 'vc_gitem_template_attribute_post_date', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_datetime', 'vc_gitem_template_attribute_post_datetime', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_meta_value', 'vc_gitem_template_attribute_post_meta_value', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_data', 'vc_gitem_template_attribute_post_data', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_image_background_image_css', 'vc_gitem_template_attribute_post_image_background_image_css', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_excerpt', 'vc_gitem_template_attribute_post_excerpt', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_title', 'vc_gitem_template_attribute_post_title', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_author', 'vc_gitem_template_attribute_post_author', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_author_href', 'vc_gitem_template_attribute_post_author_href', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_post_categories', 'vc_gitem_template_attribute_post_categories', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_featured_image', 'vc_gitem_template_attribute_featured_image', 10, 2 );
|
||||
add_filter( 'vc_gitem_template_attribute_vc_btn', 'vc_gitem_template_attribute_vc_btn', 10, 2 );
|
||||
@@ -0,0 +1,389 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Vc_Grid_Item to build grid item.
|
||||
*/
|
||||
class Vc_Grid_Item {
|
||||
protected $template = '';
|
||||
protected $html_template = false;
|
||||
protected $post = false;
|
||||
protected $grid_atts = array();
|
||||
protected $is_end = false;
|
||||
protected $shortcodes = false;
|
||||
protected $found_variables = false;
|
||||
protected static $predefined_templates = false;
|
||||
protected $template_id = false;
|
||||
|
||||
/**
|
||||
* Get shortcodes to build vc grid item templates.
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public function shortcodes() {
|
||||
if ( false === $this->shortcodes ) {
|
||||
$this->shortcodes = include vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/shortcodes.php' );
|
||||
$this->shortcodes = apply_filters( 'vc_grid_item_shortcodes', $this->shortcodes );
|
||||
}
|
||||
add_filter( 'vc_shortcode_set_template_vc_icon', array(
|
||||
$this,
|
||||
'addVcIconShortcodesTemplates',
|
||||
) );
|
||||
add_filter( 'vc_shortcode_set_template_vc_button2', array(
|
||||
$this,
|
||||
'addVcButton2ShortcodesTemplates',
|
||||
) );
|
||||
add_filter( 'vc_shortcode_set_template_vc_single_image', array(
|
||||
$this,
|
||||
'addVcSingleImageShortcodesTemplates',
|
||||
) );
|
||||
add_filter( 'vc_shortcode_set_template_vc_custom_heading', array(
|
||||
$this,
|
||||
'addVcCustomHeadingShortcodesTemplates',
|
||||
) );
|
||||
add_filter( 'vc_shortcode_set_template_vc_btn', array(
|
||||
$this,
|
||||
'addVcBtnShortcodesTemplates',
|
||||
) );
|
||||
|
||||
return $this->shortcodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by filter vc_shortcode_set_template_vc_icon to set custom template for vc_icon shortcode.
|
||||
*
|
||||
* @param $template
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function addVcIconShortcodesTemplates( $template ) {
|
||||
if ( Vc_Grid_Item_Editor::postType() === WPBMap::getScope() ) {
|
||||
$file = vc_path_dir( 'TEMPLATES_DIR', 'params/vc_grid_item/shortcodes/vc_icon.php' );
|
||||
if ( is_file( $file ) ) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by filter vc_shortcode_set_template_vc_button2 to set custom template for vc_button2 shortcode.
|
||||
*
|
||||
* @param $template
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function addVcButton2ShortcodesTemplates( $template ) {
|
||||
if ( Vc_Grid_Item_Editor::postType() === WPBMap::getScope() ) {
|
||||
$file = vc_path_dir( 'TEMPLATES_DIR', 'params/vc_grid_item/shortcodes/vc_button2.php' );
|
||||
if ( is_file( $file ) ) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by filter vc_shortcode_set_template_vc_single_image to set custom template for vc_single_image shortcode.
|
||||
*
|
||||
* @param $template
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function addVcSingleImageShortcodesTemplates( $template ) {
|
||||
if ( Vc_Grid_Item_Editor::postType() === WPBMap::getScope() ) {
|
||||
$file = vc_path_dir( 'TEMPLATES_DIR', 'params/vc_grid_item/shortcodes/vc_single_image.php' );
|
||||
if ( is_file( $file ) ) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by filter vc_shortcode_set_template_vc_custom_heading to set custom template for vc_custom_heading
|
||||
* shortcode.
|
||||
*
|
||||
* @param $template
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function addVcCustomHeadingShortcodesTemplates( $template ) {
|
||||
if ( Vc_Grid_Item_Editor::postType() === WPBMap::getScope() ) {
|
||||
$file = vc_path_dir( 'TEMPLATES_DIR', 'params/vc_grid_item/shortcodes/vc_custom_heading.php' );
|
||||
if ( is_file( $file ) ) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by filter vc_shortcode_set_template_vc_button2 to set custom template for vc_button2 shortcode.
|
||||
*
|
||||
* @param $template
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function addVcBtnShortcodesTemplates( $template ) {
|
||||
if ( Vc_Grid_Item_Editor::postType() === WPBMap::getScope() ) {
|
||||
$file = vc_path_dir( 'TEMPLATES_DIR', 'params/vc_grid_item/shortcodes/vc_btn.php' );
|
||||
if ( is_file( $file ) ) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map shortcodes for vc_grid_item param type.
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function mapShortcodes() {
|
||||
// @kludge
|
||||
// TODO: refactor with with new way of roles for shortcodes.
|
||||
// NEW ROLES like post_type for shortcode and access policies.
|
||||
$shortcodes = $this->shortcodes();
|
||||
foreach ( $shortcodes as $shortcode_settings ) {
|
||||
vc_map( $shortcode_settings );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of predefined templates.
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public static function predefinedTemplates() {
|
||||
if ( false === self::$predefined_templates ) {
|
||||
self::$predefined_templates = apply_filters( 'vc_grid_item_predefined_templates', include vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/templates.php' ) );
|
||||
}
|
||||
|
||||
return self::$predefined_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id - Predefined templates id
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function predefinedTemplate( $id ) {
|
||||
$predefined_templates = self::predefinedTemplates();
|
||||
if ( isset( $predefined_templates[ $id ]['template'] ) ) {
|
||||
return $predefined_templates[ $id ];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set template which should grid used when vc_grid_item param value is rendered.
|
||||
*
|
||||
* @param $id
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setTemplateById( $id ) {
|
||||
require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/templates.php' );
|
||||
if ( 0 === strlen( $id ) ) {
|
||||
return false;
|
||||
}
|
||||
if ( preg_match( '/^\d+$/', $id ) ) {
|
||||
$post = get_post( (int) $id );
|
||||
if ( $post ) {
|
||||
$this->setTemplate( $post->post_content, $post->ID );
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
$predefined_template = $this->predefinedTemplate( $id );
|
||||
if ( $predefined_template ) {
|
||||
$this->setTemplate( $predefined_template['template'], $id );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for template attribute.
|
||||
*
|
||||
* @param $template
|
||||
* @param $template_id
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setTemplate( $template, $template_id ) {
|
||||
$this->template = $template;
|
||||
$this->template_id = $template_id;
|
||||
$this->parseTemplate( $template );
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for template attribute.
|
||||
* @return string
|
||||
*/
|
||||
public function template() {
|
||||
return $this->template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom css from shortcodes that were mapped for vc grid item.
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function addShortcodesCustomCss() {
|
||||
$output = $shortcodes_custom_css = '';
|
||||
$id = $this->template_id;
|
||||
if ( preg_match( '/^\d+$/', $id ) ) {
|
||||
$shortcodes_custom_css = get_post_meta( $id, '_wpb_shortcodes_custom_css', true );
|
||||
} else {
|
||||
$predefined_template = $this->predefinedTemplate( $id );
|
||||
if ( $predefined_template ) {
|
||||
$shortcodes_custom_css = visual_composer()->parseShortcodesCustomCss( $predefined_template['template'] );
|
||||
}
|
||||
}
|
||||
if ( ! empty( $shortcodes_custom_css ) ) {
|
||||
$shortcodes_custom_css = wp_strip_all_tags( $shortcodes_custom_css );
|
||||
$first_tag = 'style';
|
||||
$output .= '<' . $first_tag . ' data-type="vc_shortcodes-custom-css">';
|
||||
$output .= $shortcodes_custom_css;
|
||||
$output .= '</' . $first_tag . '>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates html with template's variables for rendering new project.
|
||||
*
|
||||
* @param $template
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function parseTemplate( $template ) {
|
||||
$this->mapShortcodes();
|
||||
WPBMap::addAllMappedShortcodes();
|
||||
$attr = ' width="' . $this->gridAttribute( 'element_width', 12 ) . '"' . ' is_end="' . ( 'true' === $this->isEnd() ? 'true' : '' ) . '"';
|
||||
$template = preg_replace( '/(\[(\[?)vc_gitem\b)/', '$1' . $attr, $template );
|
||||
$template = str_replace( array(
|
||||
'<p>[vc_gitem',
|
||||
'[/vc_gitem]</p>',
|
||||
), array(
|
||||
'[vc_gitem',
|
||||
'[/vc_gitem]',
|
||||
), $template );
|
||||
$this->html_template .= do_shortcode( trim( $template ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Regexp for variables.
|
||||
* @return string
|
||||
*/
|
||||
public function templateVariablesRegex() {
|
||||
return '/\{\{' . '\{?' . '\s*' . '([^\}\:]+)(\:([^\}]+))?' . '\s*' . '\}\}' . '\}?/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default variables.
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getTemplateVariables() {
|
||||
if ( ! is_array( $this->found_variables ) ) {
|
||||
preg_match_all( $this->templateVariablesRegex(), $this->html_template, $this->found_variables, PREG_SET_ORDER );
|
||||
}
|
||||
|
||||
return $this->found_variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render item by replacing template variables for exact post.
|
||||
*
|
||||
* @param WP_Post $post
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function renderItem( WP_Post $post ) {
|
||||
$pattern = array();
|
||||
$replacement = array();
|
||||
$this->addAttributesFilters();
|
||||
foreach ( $this->getTemplateVariables() as $var ) {
|
||||
$pattern[] = '/' . preg_quote( $var[0], '/' ) . '/';
|
||||
$replacement[] = preg_replace( '/\\$/', '\\\$', $this->attribute( $var[1], $post, isset( $var[3] ) ? trim( $var[3] ) : '' ) );
|
||||
}
|
||||
|
||||
return preg_replace( $pattern, $replacement, do_shortcode( $this->html_template ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds filters to build templates variables values.
|
||||
*/
|
||||
public function addAttributesFilters() {
|
||||
require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/attributes.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for Grid shortcode attributes.
|
||||
*
|
||||
* @param $grid_atts
|
||||
*/
|
||||
public function setGridAttributes( $grid_atts ) {
|
||||
$this->grid_atts = $grid_atts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for Grid shortcode attributes.
|
||||
*
|
||||
* @param $name
|
||||
* @param string $default
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function gridAttribute( $name, $default = '' ) {
|
||||
return isset( $this->grid_atts[ $name ] ) ? $this->grid_atts[ $name ] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attribute value for WP_post object.
|
||||
*
|
||||
* @param $name
|
||||
* @param $post
|
||||
* @param string $data
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function attribute( $name, $post, $data = '' ) {
|
||||
$data = html_entity_decode( $data );
|
||||
|
||||
return apply_filters( 'vc_gitem_template_attribute_' . trim( $name ), ( isset( $post->$name ) ? $post->$name : '' ), array(
|
||||
'post' => $post,
|
||||
'data' => $data,
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set that this is last items in the grid. Used for load more button and lazy loading.
|
||||
*
|
||||
* @param bool $is_end
|
||||
*/
|
||||
public function setIsEnd( $is_end = true ) {
|
||||
$this->is_end = $is_end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks is the end.
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnd() {
|
||||
return $this->is_end;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class WpbMap_Grid_Item
|
||||
*/
|
||||
class WpbMap_Grid_Item extends WPBMap {
|
||||
protected static $gitem_user_sc = false;
|
||||
protected static $gitem_user_categories = false;
|
||||
protected static $gitem_user_sorted_sc = false;
|
||||
|
||||
/**
|
||||
* Generates list of shortcodes only for Grid element.
|
||||
*
|
||||
* This method parses the list of mapped shortcodes and creates categories list for users.
|
||||
* Also it checks is 'is_grid_item_element' attribute true.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param bool $force - force data generation even data already generated.
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected static function generateGitemUserData( $force = false ) {
|
||||
if ( ! $force && false !== self::$gitem_user_sc && false !== self::$gitem_user_categories ) {
|
||||
return;
|
||||
}
|
||||
self::$gitem_user_sc = self::$gitem_user_categories = self::$gitem_user_sorted_sc = array();
|
||||
$deprecated = 'deprecated';
|
||||
$add_deprecated = false;
|
||||
if ( is_array( self::$sc ) && ! empty( self::$sc ) ) {
|
||||
foreach ( self::$sc as $name => $values ) {
|
||||
if ( isset( $values['post_type'] ) && Vc_Grid_Item_Editor::postType() === $values['post_type'] && vc_user_access_check_shortcode_all( $name ) ) {
|
||||
if ( ! isset( $values['content_element'] ) || true === $values['content_element'] ) {
|
||||
$categories = isset( $values['category'] ) ? $values['category'] : '_other_category_';
|
||||
$values['_category_ids'] = array();
|
||||
if ( isset( $values['deprecated'] ) && false !== $values['deprecated'] ) {
|
||||
$add_deprecated = true;
|
||||
$values['_category_ids'][] = $deprecated;
|
||||
} else {
|
||||
if ( is_array( $categories ) && ! empty( $categories ) ) {
|
||||
foreach ( $categories as $c ) {
|
||||
if ( false === array_search( $c, self::$gitem_user_categories, true ) ) {
|
||||
self::$gitem_user_categories[] = $c;
|
||||
}
|
||||
$values['_category_ids'][] = md5( $c );
|
||||
}
|
||||
} else {
|
||||
if ( false === array_search( $categories, self::$gitem_user_categories, true ) ) {
|
||||
self::$gitem_user_categories[] = $categories;
|
||||
}
|
||||
$values['_category_ids'][] = md5( $categories );
|
||||
}
|
||||
}
|
||||
}
|
||||
self::$gitem_user_sc[ $name ] = $values;
|
||||
self::$gitem_user_sorted_sc[] = $values;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $add_deprecated ) {
|
||||
self::$gitem_user_categories[] = $deprecated;
|
||||
}
|
||||
|
||||
$sort = new Vc_Sort( self::$gitem_user_sorted_sc );
|
||||
self::$gitem_user_sorted_sc = $sort->sortByKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sorted list of mapped shortcode settings grid element
|
||||
*
|
||||
* Sorting depends on the weight attribute and mapping order.
|
||||
*
|
||||
* @static
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getSortedGitemUserShortCodes() {
|
||||
self::generateGitemUserData();
|
||||
|
||||
return self::$gitem_user_sorted_sc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of mapped shortcode settings for current user.
|
||||
* @static
|
||||
* @return bool - associated array of shortcodes settings with tag as the key.
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getGitemUserShortCodes() {
|
||||
self::generateGitemUserData();
|
||||
|
||||
return self::$gitem_user_sc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all categories for current user.
|
||||
*
|
||||
* Category is added to the list when at least one shortcode of this category is allowed for current user
|
||||
* by Vc access rules.
|
||||
*
|
||||
* @static
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getGitemUserCategories() {
|
||||
self::generateGitemUserData();
|
||||
|
||||
return self::$gitem_user_categories;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Manger for new post type for single grid item design with constructor
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
* @since 4.4
|
||||
*/
|
||||
require_once vc_path_dir( 'EDITORS_DIR', 'class-vc-backend-editor.php' );
|
||||
|
||||
/**
|
||||
* Class Vc_Grid_Item_Editor
|
||||
*/
|
||||
class Vc_Grid_Item_Editor extends Vc_Backend_Editor {
|
||||
protected static $post_type = 'vc_grid_item';
|
||||
protected $templates_editor = false;
|
||||
|
||||
/**
|
||||
* This method is called to add hooks.
|
||||
*
|
||||
* @since 4.8
|
||||
* @access public
|
||||
*/
|
||||
public function addHooksSettings() {
|
||||
add_action( 'add_meta_boxes', array(
|
||||
$this,
|
||||
'render',
|
||||
) );
|
||||
add_action( 'vc_templates_render_backend_template', array(
|
||||
$this,
|
||||
'loadTemplate',
|
||||
), 10, 2 );
|
||||
}
|
||||
|
||||
public function addScripts() {
|
||||
$this->render( get_post_type() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $post_type
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function render( $post_type ) {
|
||||
if ( $this->isValidPostType( $post_type ) ) {
|
||||
$this->registerBackendJavascript();
|
||||
$this->registerBackendCss();
|
||||
// B.C:
|
||||
visual_composer()->registerAdminCss();
|
||||
visual_composer()->registerAdminJavascript();
|
||||
add_action( 'admin_print_scripts-post.php', array(
|
||||
$this,
|
||||
'printScriptsMessages',
|
||||
), 300 );
|
||||
add_action( 'admin_print_scripts-post-new.php', array(
|
||||
$this,
|
||||
'printScriptsMessages',
|
||||
), 300 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function editorEnabled() {
|
||||
return vc_user_access()->part( 'grid_builder' )->can()->get();
|
||||
}
|
||||
|
||||
public function replaceTemplatesPanelEditorJsAction() {
|
||||
wp_dequeue_script( 'vc-template-preview-script' );
|
||||
$this->templatesEditor()->addScriptsToTemplatePreview();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create post type and new item in the admin menu.
|
||||
* @return void
|
||||
*/
|
||||
public static function createPostType() {
|
||||
register_post_type( self::$post_type, array(
|
||||
'labels' => self::getPostTypesLabels(),
|
||||
'public' => false,
|
||||
'has_archive' => false,
|
||||
'show_in_nav_menus' => false,
|
||||
'exclude_from_search' => true,
|
||||
'publicly_queryable' => false,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => false,
|
||||
'query_var' => true,
|
||||
'capability_type' => 'post',
|
||||
'hierarchical' => false,
|
||||
'menu_position' => null,
|
||||
'supports' => array(
|
||||
'title',
|
||||
'editor',
|
||||
),
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function getPostTypesLabels() {
|
||||
return array(
|
||||
'add_new_item' => esc_html__( 'Add Grid template', 'js_composer' ),
|
||||
'name' => esc_html__( 'Grid Builder', 'js_composer' ),
|
||||
'singular_name' => esc_html__( 'Grid template', 'js_composer' ),
|
||||
'edit_item' => esc_html__( 'Edit Grid template', 'js_composer' ),
|
||||
'view_item' => esc_html__( 'View Grid template', 'js_composer' ),
|
||||
'search_items' => esc_html__( 'Search Grid templates', 'js_composer' ),
|
||||
'not_found' => esc_html__( 'No Grid templates found', 'js_composer' ),
|
||||
'not_found_in_trash' => esc_html__( 'No Grid templates found in Trash', 'js_composer' ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewrites validation for correct post_type of th post.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function isValidPostType( $type = '' ) {
|
||||
$type = ! empty( $type ) ? $type : get_post_type();
|
||||
|
||||
return $this->editorEnabled() && $this->postType() === $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post type for Vc grid element editor.
|
||||
*
|
||||
* @static
|
||||
* @return string
|
||||
*/
|
||||
public static function postType() {
|
||||
return self::$post_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls add_meta_box to create Editor block.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function addMetaBox() {
|
||||
add_meta_box( 'wpb_visual_composer', esc_html__( 'Grid Builder', 'js_composer' ), array(
|
||||
$this,
|
||||
'renderEditor',
|
||||
), $this->postType(), 'normal', 'high' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Change order of the controls for shortcodes admin block.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function shortcodesControls() {
|
||||
return array(
|
||||
'delete',
|
||||
'edit',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output html for backend editor meta box.
|
||||
*
|
||||
* @param null|int $post
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function renderEditor( $post = null ) {
|
||||
if ( ! vc_user_access()->part( 'grid_builder' )->can()->get() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' );
|
||||
$this->post = $post;
|
||||
vc_include_template( 'params/vc_grid_item/editor/vc_grid_item_editor.tpl.php', array(
|
||||
'editor' => $this,
|
||||
'post' => $this->post,
|
||||
) );
|
||||
add_action( 'admin_footer', array(
|
||||
$this,
|
||||
'renderEditorFooter',
|
||||
) );
|
||||
do_action( 'vc_backend_editor_render' );
|
||||
do_action( 'vc_vc_grid_item_editor_render' );
|
||||
add_action( 'vc_user_access_check-shortcode_edit', array(
|
||||
$this,
|
||||
'accessCheckShortcodeEdit',
|
||||
), 10, 2 );
|
||||
add_action( 'vc_user_access_check-shortcode_all', array(
|
||||
$this,
|
||||
'accessCheckShortcodeAll',
|
||||
), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $null
|
||||
* @param $shortcode
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function accessCheckShortcodeEdit( $null, $shortcode ) {
|
||||
return vc_user_access()->part( 'grid_builder' )->can()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $null
|
||||
* @param $shortcode
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function accessCheckShortcodeAll( $null, $shortcode ) {
|
||||
return vc_user_access()->part( 'grid_builder' )->can()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Output required html and js content for VC editor.
|
||||
*
|
||||
* Here comes panels, modals and js objects with data for mapped shortcodes.
|
||||
*/
|
||||
public function renderEditorFooter() {
|
||||
vc_include_template( 'params/vc_grid_item/editor/partials/vc_grid_item_editor_footer.tpl.php', array(
|
||||
'editor' => $this,
|
||||
'post' => $this->post,
|
||||
) );
|
||||
do_action( 'vc_backend_editor_footer_render' );
|
||||
}
|
||||
|
||||
public function registerBackendJavascript() {
|
||||
parent::registerBackendJavascript();
|
||||
wp_register_script( 'vc_grid_item_editor', vc_asset_url( 'js/dist/grid-builder.min.js' ), array( 'vc-backend-min-js' ), WPB_VC_VERSION, true );
|
||||
wp_localize_script( 'vc_grid_item_editor', 'i18nLocaleGItem', array(
|
||||
'preview' => esc_html__( 'Preview', 'js_composer' ),
|
||||
'builder' => esc_html__( 'Builder', 'js_composer' ),
|
||||
'add_template_message' => esc_html__( 'If you add this template, all your current changes will be removed. Are you sure you want to add template?', 'js_composer' ),
|
||||
) );
|
||||
}
|
||||
|
||||
public function enqueueJs() {
|
||||
parent::enqueueJs();
|
||||
wp_enqueue_script( 'vc_grid_item_editor' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|\Vc_Templates_Editor_Grid_Item
|
||||
*/
|
||||
public function templatesEditor() {
|
||||
if ( false === $this->templates_editor ) {
|
||||
require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/editor/popups/class-vc-templates-editor-grid-item.php' );
|
||||
$this->templates_editor = new Vc_Templates_Editor_Grid_Item();
|
||||
}
|
||||
|
||||
return $this->templates_editor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $template_id
|
||||
* @param $template_type
|
||||
* @return false|string
|
||||
*/
|
||||
public function loadPredefinedTemplate( $template_id, $template_type ) {
|
||||
ob_start();
|
||||
$this->templatesEditor()->load( $template_id );
|
||||
|
||||
return ob_get_clean();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $template_id
|
||||
* @param $template_type
|
||||
* @return false|string
|
||||
*/
|
||||
public function loadTemplate( $template_id, $template_type ) {
|
||||
if ( 'grid_templates' === $template_type ) {
|
||||
return $this->loadPredefinedTemplate( $template_id, $template_type );
|
||||
} elseif ( 'grid_templates_custom' === $template_type ) {
|
||||
return $this->templatesEditor()->loadCustomTemplate( $template_id );
|
||||
}
|
||||
|
||||
return $template_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
public function templatePreviewPath( $path ) {
|
||||
return 'params/vc_grid_item/editor/vc_ui-template-preview.tpl.php';
|
||||
}
|
||||
|
||||
public function renderTemplatePreview() {
|
||||
vc_user_access()->checkAdminNonce()->validateDie()->wpAny( 'edit_posts', 'edit_pages' )->validateDie()->part( 'grid_builder' )->can()->validateDie();
|
||||
|
||||
add_action( 'vc_templates_render_backend_template_preview', array(
|
||||
$this,
|
||||
'loadTemplate',
|
||||
), 10, 2 );
|
||||
add_filter( 'vc_render_template_preview_include_template', array(
|
||||
$this,
|
||||
'templatePreviewPath',
|
||||
) );
|
||||
visual_composer()->templatesPanelEditor()->renderTemplatePreview();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Vc_Grid_Item_Preview
|
||||
*/
|
||||
class Vc_Grid_Item_Preview {
|
||||
protected $shortcodes_string = '';
|
||||
protected $post_id = false;
|
||||
|
||||
public function render() {
|
||||
$this->post_id = (int) vc_request_param( 'post_id' );
|
||||
$this->shortcodes_string = stripslashes( vc_request_param( 'shortcodes_string', true ) );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' );
|
||||
$grid_item = new Vc_Grid_Item();
|
||||
$grid_item->setIsEnd( false );
|
||||
$grid_item->setGridAttributes( array( 'element_width' => 4 ) );
|
||||
$grid_item->setTemplate( $this->shortcodes_string, $this->post_id );
|
||||
$this->enqueue();
|
||||
vc_include_template( 'params/vc_grid_item/preview.tpl.php', array(
|
||||
'preview' => $this,
|
||||
'grid_item' => $grid_item,
|
||||
'shortcodes_string' => $this->shortcodes_string,
|
||||
'post' => $this->mockingPost(),
|
||||
'default_width_value' => apply_filters( 'vc_grid_item_preview_render_default_width_value', 4 ),
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $css
|
||||
* @return string
|
||||
*/
|
||||
public function addCssBackgroundImage( $css ) {
|
||||
if ( empty( $css ) ) {
|
||||
$css = 'background-image: url(' . vc_asset_url( 'vc/vc_gitem_image.png' ) . ') !important';
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $url
|
||||
* @return string
|
||||
*/
|
||||
public function addImageUrl( $url ) {
|
||||
if ( empty( $url ) ) {
|
||||
$url = vc_asset_url( 'vc/vc_gitem_image.png' );
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $img
|
||||
* @return string
|
||||
*/
|
||||
public function addImage( $img ) {
|
||||
if ( empty( $img ) ) {
|
||||
$img = '<img src="' . esc_url( vc_asset_url( 'vc/vc_gitem_image.png' ) ) . '" alt="">';
|
||||
}
|
||||
|
||||
return $img;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $link
|
||||
*
|
||||
* @param $atts
|
||||
* @param $css_class
|
||||
* @return string
|
||||
* @since 4.5
|
||||
*
|
||||
*/
|
||||
public function disableContentLink( $link, $atts, $css_class ) {
|
||||
return 'a' . ( strlen( $css_class ) > 0 ? ' class="' . esc_attr( $css_class ) . '"' : '' );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $link
|
||||
*
|
||||
* @param $atts
|
||||
* @param $post
|
||||
* @param $css_class
|
||||
* @return string
|
||||
* @since 4.5
|
||||
*
|
||||
*/
|
||||
public function disableRealContentLink( $link, $atts, $post, $css_class ) {
|
||||
return 'a' . ( strlen( $css_class ) > 0 ? ' class="' . esc_attr( $css_class ) . '"' : '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for filter: vc_gitem_zone_image_block_link
|
||||
* @param $link
|
||||
*
|
||||
* @return string
|
||||
* @since 4.5
|
||||
*
|
||||
*/
|
||||
public function disableGitemZoneLink( $link ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function enqueue() {
|
||||
visual_composer()->frontCss();
|
||||
visual_composer()->frontJsRegister();
|
||||
wp_enqueue_script( 'prettyphoto' );
|
||||
wp_enqueue_style( 'prettyphoto' );
|
||||
wp_enqueue_style( 'js_composer_front' );
|
||||
wp_enqueue_script( 'wpb_composer_front_js' );
|
||||
wp_enqueue_style( 'js_composer_custom_css' );
|
||||
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_Vc_Basic_Grid' );
|
||||
|
||||
$grid = new WPBakeryShortCode_Vc_Basic_Grid( array( 'base' => 'vc_basic_grid' ) );
|
||||
$grid->shortcodeScripts();
|
||||
$grid->enqueueScripts();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|\WP_Post|null
|
||||
*/
|
||||
public function mockingPost() {
|
||||
$post = get_post( $this->post_id );
|
||||
setup_postdata( $post );
|
||||
$post->post_title = esc_html__( 'Post title', 'js_composer' );
|
||||
$post->post_content = esc_html__( 'The WordPress Excerpt is an optional summary or description of a post; in short, a post summary.', 'js_composer' );
|
||||
$post->post_excerpt = esc_html__( 'The WordPress Excerpt is an optional summary or description of a post; in short, a post summary.', 'js_composer' );
|
||||
add_filter( 'get_the_categories', array(
|
||||
$this,
|
||||
'getTheCategories',
|
||||
), 10, 2 );
|
||||
$GLOBALS['post'] = $post;
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $categories
|
||||
* @param $post_id
|
||||
* @return array
|
||||
*/
|
||||
public function getTheCategories( $categories, $post_id ) {
|
||||
$ret = $categories;
|
||||
if ( ! $post_id || ( $post_id && $post_id === $this->post_id ) ) {
|
||||
$cat = get_categories( 'number=5' );
|
||||
if ( empty( $ret ) && ! empty( $cat ) ) {
|
||||
$ret += $cat;
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $img
|
||||
* @return array
|
||||
*/
|
||||
public function addPlaceholderImage( $img ) {
|
||||
if ( null === $img || false === $img ) {
|
||||
$img = array(
|
||||
'thumbnail' => '<img class="vc_img-placeholder vc_single_image-img" src="' . esc_url( vc_asset_url( 'vc/vc_gitem_image.png' ) ) . '" />',
|
||||
);
|
||||
}
|
||||
|
||||
return $img;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* @noinspection PhpMissingParentCallCommonInspection
|
||||
* @package WPBakery
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'EDITORS_DIR', 'navbar/class-vc-navbar.php' );
|
||||
|
||||
/**
|
||||
* Renders navigation bar for Editors.
|
||||
*/
|
||||
class Vc_Navbar_Grid_Item extends Vc_Navbar {
|
||||
protected $controls = array(
|
||||
'templates',
|
||||
'save_backend',
|
||||
'preview_template',
|
||||
'animation_list',
|
||||
'preview_item_width',
|
||||
'edit',
|
||||
);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getControlTemplates() {
|
||||
return '<li><a href="javascript:;" class="vc_icon-btn vc_templates-button" id="vc_templates-editor-button" title="' . esc_attr__( 'Templates', 'js_composer' ) . '"><i class="vc-composer-icon vc-c-icon-add_template"></i></a></li>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getControlPreviewTemplate() {
|
||||
return '<li class="vc_pull-right">' . '<a href="#" class="vc_btn vc_btn-grey vc_btn-sm vc_navbar-btn" data-vc-navbar-control="preview">' . esc_html__( 'Preview', 'js_composer' ) . '</a>' . '</li>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getControlEdit() {
|
||||
return '<li class="vc_pull-right">' . '<a data-vc-navbar-control="edit" class="vc_icon-btn vc_post-settings" title="' . esc_attr__( 'Grid element settings', 'js_composer' ) . '"><i class="vc-composer-icon vc-c-icon-cog"></i>' . '</a>' . '</li>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getControlSaveBackend() {
|
||||
return '<li class="vc_pull-right vc_save-backend">' . '<a class="vc_btn vc_btn-sm vc_navbar-btn vc_btn-primary vc_control-save" id="wpb-save-post">' . esc_html__( 'Update', 'js_composer' ) . '</a>' . '</li>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getControlPreviewItemWidth() {
|
||||
$output = '<li class="vc_pull-right vc_gitem-navbar-dropdown vc_gitem-navbar-preview-width" data-vc-grid-item="navbar_preview_width"><select data-vc-navbar-control="preview_width">';
|
||||
for ( $i = 1; $i <= 12; $i ++ ) {
|
||||
$output .= '<option value="' . esc_attr( $i ) . '">' . sprintf( esc_html__( '%s/12 width', 'js_composer' ), $i ) . '</option>';
|
||||
}
|
||||
$output .= '</select></li>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getControlAnimationList() {
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_Vc_Gitem_Animated_Block' );
|
||||
|
||||
$output = '';
|
||||
|
||||
$animations = WPBakeryShortCode_Vc_Gitem_Animated_Block::animations();
|
||||
if ( is_array( $animations ) ) {
|
||||
$output .= '<li class="vc_pull-right vc_gitem-navbar-dropdown"><select data-vc-navbar-control="animation">';
|
||||
foreach ( $animations as $value => $key ) {
|
||||
$output .= '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>';
|
||||
}
|
||||
$output .= '</select></li>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @noinspection PhpMissingParentCallCommonInspection
|
||||
* @package WPBakery
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'EDITORS_DIR', 'popups/class-vc-add-element-box.php' );
|
||||
|
||||
/**
|
||||
* Add element for VC editors with a list of mapped shortcodes for gri item constructor.
|
||||
*
|
||||
* @since 4.4
|
||||
*/
|
||||
class Vc_Add_Element_Box_Grid_Item extends Vc_Add_Element_Box {
|
||||
/**
|
||||
* Get shortcodes from param type vc_grid_item
|
||||
* @return array|bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function shortcodes() {
|
||||
return WpbMap_Grid_Item::getSortedGitemUserShortCodes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get categories list from mapping data.
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
* @since 4.5
|
||||
*/
|
||||
public function getCategories() {
|
||||
return WpbMap_Grid_Item::getGitemUserCategories();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getPartState() {
|
||||
return vc_user_access()->part( 'grid_builder' )->getState();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'EDITORS_DIR', 'popups/class-vc-templates-panel-editor.php' );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' );
|
||||
|
||||
/**
|
||||
* Class Vc_Templates_Editor_Grid_Item
|
||||
*/
|
||||
class Vc_Templates_Editor_Grid_Item extends Vc_Templates_Panel_Editor {
|
||||
protected $default_templates = array(); // this prevents for loading default templates
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'vc_templates_render_category', array(
|
||||
$this,
|
||||
'renderTemplateBlock',
|
||||
), 10, 2 );
|
||||
add_filter( 'vc_templates_render_template', array(
|
||||
$this,
|
||||
'renderTemplateWindowGrid',
|
||||
), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $category
|
||||
* @return mixed
|
||||
*/
|
||||
public function renderTemplateBlock( $category ) {
|
||||
if ( 'grid_templates' === $category['category'] || 'grid_templates_custom' === $category['category'] ) {
|
||||
$category['output'] = '<div class="vc_col-md-12">';
|
||||
if ( isset( $category['category_name'] ) ) {
|
||||
$category['output'] .= '<h3>' . esc_html( $category['category_name'] ) . '</h3>';
|
||||
}
|
||||
if ( isset( $category['category_description'] ) ) {
|
||||
$category['output'] .= '<p class="vc_description">' . esc_html( $category['category_description'] ) . '</p>';
|
||||
}
|
||||
$category['output'] .= '</div>';
|
||||
|
||||
$category['output'] .= '
|
||||
<div class="vc_column vc_col-sm-12">
|
||||
<div class="vc_ui-template-list vc_templates-list-my_templates vc_ui-list-bar" data-vc-action="collapseAll">';
|
||||
if ( ! empty( $category['templates'] ) ) {
|
||||
foreach ( $category['templates'] as $template ) {
|
||||
$category['output'] .= $this->renderTemplateListItem( $template );
|
||||
}
|
||||
}
|
||||
$category['output'] .= '
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
/** Output rendered template in modal dialog
|
||||
* @param $template_name
|
||||
* @param $template_data
|
||||
*
|
||||
* @return string
|
||||
* @since 4.4
|
||||
*
|
||||
*/
|
||||
public function renderTemplateWindowGrid( $template_name, $template_data ) {
|
||||
if ( 'grid_templates' === $template_data['type'] || 'grid_templates_custom' === $template_data['type'] ) {
|
||||
return $this->renderTemplateWindowGridTemplate( $template_name, $template_data );
|
||||
}
|
||||
|
||||
return $template_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $template_name
|
||||
* @param $template_data
|
||||
*
|
||||
* @return string
|
||||
* @since 4.4
|
||||
*
|
||||
*/
|
||||
protected function renderTemplateWindowGridTemplate( $template_name, $template_data ) {
|
||||
|
||||
ob_start();
|
||||
|
||||
$template_id = esc_attr( $template_data['unique_id'] );
|
||||
$template_name = esc_html( $template_name );
|
||||
$preview_template_title = esc_attr__( 'Preview template', 'js_composer' );
|
||||
$add_template_title = esc_attr__( 'Preview template', 'js_composer' );
|
||||
|
||||
echo sprintf( '<button type="button" class="vc_ui-list-bar-item-trigger" title="%s"
|
||||
data-template-handler=""
|
||||
data-vc-ui-element="template-title">%s</button>
|
||||
<div class="vc_ui-list-bar-item-actions">
|
||||
<button type="button" class="vc_general vc_ui-control-button" title="%s"
|
||||
data-template-handler=""
|
||||
data-vc-ui-element="template-title">
|
||||
<i class="vc-composer-icon vc-c-icon-add"></i>
|
||||
</button>
|
||||
<button type="button" class="vc_general vc_ui-control-button" title="%s"
|
||||
data-vc-preview-handler data-vc-container=".vc_ui-list-bar" data-vc-target="[data-template_id=%s]">
|
||||
<i class="vc-composer-icon vc-c-icon-arrow_drop_down"></i>
|
||||
</button>
|
||||
</div>', esc_attr( $add_template_title ), esc_html( $template_name ), esc_attr( $add_template_title ), esc_attr( $preview_template_title ), esc_attr( $template_id ) );
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $template_id
|
||||
*/
|
||||
public function load( $template_id = false ) {
|
||||
if ( ! $template_id ) {
|
||||
$template_id = vc_post_param( 'template_unique_id' );
|
||||
}
|
||||
if ( ! isset( $template_id ) || '' === $template_id ) {
|
||||
echo 'Error: TPL-02';
|
||||
die;
|
||||
}
|
||||
$predefined_template = Vc_Grid_Item::predefinedTemplate( $template_id );
|
||||
if ( $predefined_template ) {
|
||||
echo esc_html( trim( $predefined_template['template'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $template_id
|
||||
* @return string
|
||||
*/
|
||||
public function loadCustomTemplate( $template_id = false ) {
|
||||
if ( ! $template_id ) {
|
||||
$template_id = vc_post_param( 'template_unique_id' );
|
||||
}
|
||||
if ( ! isset( $template_id ) || '' === $template_id ) {
|
||||
echo 'Error: TPL-02';
|
||||
die();
|
||||
}
|
||||
|
||||
$post = get_post( $template_id );
|
||||
|
||||
if ( $post && Vc_Grid_Item_Editor::postType() === $post->post_type ) {
|
||||
return $post->post_content;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|mixed|void
|
||||
*/
|
||||
public function getAllTemplates() {
|
||||
$data = array();
|
||||
$grid_templates = $this->getGridTemplates();
|
||||
// this has only 'name' and 'template' key and index 'key' is template id.
|
||||
if ( ! empty( $grid_templates ) ) {
|
||||
$arr_category = array(
|
||||
'category' => 'grid_templates',
|
||||
'category_name' => esc_html__( 'Grid Templates', 'js_composer' ),
|
||||
'category_weight' => 10,
|
||||
);
|
||||
$category_templates = array();
|
||||
foreach ( $grid_templates as $template_id => $template_data ) {
|
||||
$category_templates[] = array(
|
||||
'unique_id' => $template_id,
|
||||
'name' => $template_data['name'],
|
||||
'type' => 'grid_templates',
|
||||
// for rendering in backend/frontend with ajax
|
||||
);
|
||||
}
|
||||
$arr_category['templates'] = $category_templates;
|
||||
$data[] = $arr_category;
|
||||
}
|
||||
$custom_grid_templates = $this->getCustomTemplateList();
|
||||
if ( ! empty( $custom_grid_templates ) ) {
|
||||
$arr_category = array(
|
||||
'category' => 'grid_templates_custom',
|
||||
'category_name' => esc_html__( 'Custom Grid Templates', 'js_composer' ),
|
||||
'category_weight' => 10,
|
||||
);
|
||||
$category_templates = array();
|
||||
foreach ( $custom_grid_templates as $template_name => $template_id ) {
|
||||
$category_templates[] = array(
|
||||
'unique_id' => $template_id,
|
||||
'name' => $template_name,
|
||||
'type' => 'grid_templates_custom',
|
||||
// for rendering in backend/frontend with ajax);
|
||||
);
|
||||
}
|
||||
$arr_category['templates'] = $category_templates;
|
||||
$data[] = $arr_category;
|
||||
}
|
||||
|
||||
// To get any other 3rd "Custom template" - do this by hook filter 'vc_get_all_templates'
|
||||
return apply_filters( 'vc_grid_get_all_templates', $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getCustomTemplateList() {
|
||||
$list = array();
|
||||
$templates = get_posts( array(
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
'numberposts' => - 1,
|
||||
) );
|
||||
foreach ( $templates as $template ) {
|
||||
$id = $template->ID;
|
||||
$list[ $template->post_title ] = $id;
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public function getGridTemplates() {
|
||||
$list = Vc_Grid_Item::predefinedTemplates();
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,917 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_Vc_Gitem_Animated_Block' );
|
||||
|
||||
global $vc_gitem_add_link_param;
|
||||
$vc_gitem_add_link_param = apply_filters( 'vc_gitem_add_link_param', array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Add link', 'js_composer' ),
|
||||
'param_name' => 'link',
|
||||
'value' => array(
|
||||
esc_html__( 'None', 'js_composer' ) => 'none',
|
||||
esc_html__( 'Post link', 'js_composer' ) => 'post_link',
|
||||
esc_html__( 'Post author', 'js_composer' ) => 'post_author',
|
||||
esc_html__( 'Large image', 'js_composer' ) => 'image',
|
||||
esc_html__( 'Large image (prettyPhoto)', 'js_composer' ) => 'image_lightbox',
|
||||
esc_html__( 'Custom', 'js_composer' ) => 'custom',
|
||||
),
|
||||
'description' => esc_html__( 'Select link option.', 'js_composer' ),
|
||||
) );
|
||||
$zone_params = array(
|
||||
$vc_gitem_add_link_param,
|
||||
array(
|
||||
'type' => 'vc_link',
|
||||
'heading' => esc_html__( 'URL (Link)', 'js_composer' ),
|
||||
'param_name' => 'url',
|
||||
'dependency' => array(
|
||||
'element' => 'link',
|
||||
'value' => array( 'custom' ),
|
||||
),
|
||||
'description' => esc_html__( 'Add custom link.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'heading' => esc_html__( 'Use featured image on background?', 'js_composer' ),
|
||||
'param_name' => 'featured_image',
|
||||
'value' => array( esc_html__( 'Yes', 'js_composer' ) => 'yes' ),
|
||||
'description' => esc_html__( 'Note: Featured image overwrites background image and color from "Design Options".', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'heading' => esc_html__( 'Image size', 'js_composer' ),
|
||||
'param_name' => 'img_size',
|
||||
'value' => 'large',
|
||||
'description' => esc_html__( 'Enter image size (Example: "thumbnail", "medium", "large", "full" or other sizes defined by theme). Alternatively enter size in pixels (Example: 200x100 (Width x Height)).', 'js_composer' ),
|
||||
'dependency' => array(
|
||||
'element' => 'featured_image',
|
||||
'not_empty' => true,
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'css_editor',
|
||||
'heading' => esc_html__( 'CSS box', 'js_composer' ),
|
||||
'param_name' => 'css',
|
||||
'group' => esc_html__( 'Design Options', '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' ),
|
||||
),
|
||||
);
|
||||
$post_data_params = array(
|
||||
$vc_gitem_add_link_param,
|
||||
array(
|
||||
'type' => 'vc_link',
|
||||
'heading' => esc_html__( 'URL (Link)', 'js_composer' ),
|
||||
'param_name' => 'url',
|
||||
'dependency' => array(
|
||||
'element' => 'link',
|
||||
'value' => array( 'custom' ),
|
||||
),
|
||||
'description' => esc_html__( 'Add custom link.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'css_editor',
|
||||
'heading' => esc_html__( 'CSS box', 'js_composer' ),
|
||||
'param_name' => 'css',
|
||||
'group' => esc_html__( 'Design Options', 'js_composer' ),
|
||||
),
|
||||
);
|
||||
$custom_fonts_params = array(
|
||||
array(
|
||||
'type' => 'font_container',
|
||||
'param_name' => 'font_container',
|
||||
'value' => '',
|
||||
'settings' => array(
|
||||
'fields' => array(
|
||||
'tag' => 'div',
|
||||
// default value h2
|
||||
'text_align',
|
||||
'tag_description' => esc_html__( 'Select element tag.', 'js_composer' ),
|
||||
'text_align_description' => esc_html__( 'Select text alignment.', 'js_composer' ),
|
||||
'font_size_description' => esc_html__( 'Enter font size.', 'js_composer' ),
|
||||
'line_height_description' => esc_html__( 'Enter line height.', 'js_composer' ),
|
||||
'color_description' => esc_html__( 'Select color for your element.', 'js_composer' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'heading' => esc_html__( 'Use custom fonts?', 'js_composer' ),
|
||||
'param_name' => 'use_custom_fonts',
|
||||
'value' => array( esc_html__( 'Yes', 'js_composer' ) => 'yes' ),
|
||||
'description' => esc_html__( 'Enable Google fonts.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'font_container',
|
||||
'param_name' => 'block_container',
|
||||
'value' => '',
|
||||
'settings' => array(
|
||||
'fields' => array(
|
||||
'font_size',
|
||||
'line_height',
|
||||
'color',
|
||||
'tag_description' => esc_html__( 'Select element tag.', 'js_composer' ),
|
||||
'text_align_description' => esc_html__( 'Select text alignment.', 'js_composer' ),
|
||||
'font_size_description' => esc_html__( 'Enter font size.', 'js_composer' ),
|
||||
'line_height_description' => esc_html__( 'Enter line height.', 'js_composer' ),
|
||||
'color_description' => esc_html__( 'Select color for your element.', 'js_composer' ),
|
||||
),
|
||||
),
|
||||
'group' => esc_html__( 'Custom fonts', 'js_composer' ),
|
||||
'dependency' => array(
|
||||
'element' => 'use_custom_fonts',
|
||||
'value' => array( 'yes' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'heading' => esc_html__( 'Yes theme default font family?', 'js_composer' ),
|
||||
'param_name' => 'use_theme_fonts',
|
||||
'value' => array( esc_html__( 'Yes', 'js_composer' ) => 'yes' ),
|
||||
'description' => esc_html__( 'Yes font family from the theme.', 'js_composer' ),
|
||||
'group' => esc_html__( 'Custom fonts', 'js_composer' ),
|
||||
'dependency' => array(
|
||||
'element' => 'use_custom_fonts',
|
||||
'value' => array( 'yes' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'google_fonts',
|
||||
'param_name' => 'google_fonts',
|
||||
'value' => '',
|
||||
// Not recommended, this will override 'settings'. 'font_family:'.rawurlencode('Exo:100,100italic,200,200italic,300,300italic,regular,italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic').'|font_style:'.rawurlencode('900 bold italic:900:italic'),
|
||||
'settings' => array(
|
||||
'fields' => array(
|
||||
// Default font style. Name:weight:style, example: "800 bold regular:800:normal"
|
||||
'font_family_description' => esc_html__( 'Select font family.', 'js_composer' ),
|
||||
'font_style_description' => esc_html__( 'Select font styling.', 'js_composer' ),
|
||||
),
|
||||
),
|
||||
'group' => esc_html__( 'Custom fonts', 'js_composer' ),
|
||||
'dependency' => array(
|
||||
'element' => 'use_theme_fonts',
|
||||
'value_not_equal_to' => 'yes',
|
||||
),
|
||||
),
|
||||
);
|
||||
$list = array(
|
||||
'vc_gitem' => array(
|
||||
'name' => esc_html__( 'Grid Item', 'js_composer' ),
|
||||
'base' => 'vc_gitem',
|
||||
'is_container' => true,
|
||||
'icon' => 'icon-wpb-gitem',
|
||||
'content_element' => false,
|
||||
'show_settings_on_create' => false,
|
||||
'category' => esc_html__( 'Content', 'js_composer' ),
|
||||
'description' => esc_html__( 'Main grid item', 'js_composer' ),
|
||||
'params' => array(
|
||||
array(
|
||||
'type' => 'css_editor',
|
||||
'heading' => esc_html__( 'CSS box', 'js_composer' ),
|
||||
'param_name' => 'css',
|
||||
),
|
||||
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' ),
|
||||
),
|
||||
),
|
||||
'js_view' => 'VcGitemView',
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_animated_block' => array(
|
||||
'base' => 'vc_gitem_animated_block',
|
||||
'name' => esc_html__( 'A/B block', 'js_composer' ),
|
||||
'content_element' => false,
|
||||
'is_container' => true,
|
||||
'show_settings_on_create' => false,
|
||||
'icon' => 'icon-wpb-gitem-block',
|
||||
'category' => esc_html__( 'Content', 'js_composer' ),
|
||||
'controls' => array(),
|
||||
'as_parent' => array(
|
||||
'only' => array(
|
||||
'vc_gitem_zone_a',
|
||||
'vc_gitem_zone_b',
|
||||
),
|
||||
),
|
||||
'params' => array(
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Animation', 'js_composer' ),
|
||||
'param_name' => 'animation',
|
||||
'value' => WPBakeryShortCode_Vc_Gitem_Animated_Block::animations(),
|
||||
),
|
||||
),
|
||||
'js_view' => 'VcGitemAnimatedBlockView',
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_zone' => array(
|
||||
'name' => esc_html__( 'Zone', 'js_composer' ),
|
||||
'base' => 'vc_gitem_zone',
|
||||
'content_element' => false,
|
||||
'is_container' => true,
|
||||
'show_settings_on_create' => false,
|
||||
'icon' => 'icon-wpb-gitem-zone',
|
||||
'category' => esc_html__( 'Content', 'js_composer' ),
|
||||
'controls' => array( 'edit' ),
|
||||
'as_parent' => array( 'only' => 'vc_gitem_row' ),
|
||||
'js_view' => 'VcGitemZoneView',
|
||||
'params' => $zone_params,
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_zone_a' => array(
|
||||
'name' => esc_html__( 'Normal', 'js_composer' ),
|
||||
'base' => 'vc_gitem_zone_a',
|
||||
'content_element' => false,
|
||||
'is_container' => true,
|
||||
'show_settings_on_create' => false,
|
||||
'icon' => 'icon-wpb-gitem-zone',
|
||||
'category' => esc_html__( 'Content', 'js_composer' ),
|
||||
'controls' => array( 'edit' ),
|
||||
'as_parent' => array( 'only' => 'vc_gitem_row' ),
|
||||
'js_view' => 'VcGitemZoneView',
|
||||
'params' => array_merge( array(
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Height mode', 'js_composer' ),
|
||||
'param_name' => 'height_mode',
|
||||
'value' => array(
|
||||
'1:1' => '1-1',
|
||||
esc_html__( 'Original', 'js_composer' ) => 'original',
|
||||
'4:3' => '4-3',
|
||||
'3:4' => '3-4',
|
||||
'16:9' => '16-9',
|
||||
'9:16' => '9-16',
|
||||
esc_html__( 'Custom', 'js_composer' ) => 'custom',
|
||||
),
|
||||
'description' => esc_html__( 'Sizing proportions for height and width. Select "Original" to scale image without cropping.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'heading' => esc_html__( 'Height', 'js_composer' ),
|
||||
'param_name' => 'height',
|
||||
'dependency' => array(
|
||||
'element' => 'height_mode',
|
||||
'value' => array( 'custom' ),
|
||||
),
|
||||
'description' => esc_html__( 'Enter custom height.', 'js_composer' ),
|
||||
),
|
||||
), $zone_params ),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_zone_b' => array(
|
||||
'name' => esc_html__( 'Hover', 'js_composer' ),
|
||||
'base' => 'vc_gitem_zone_b',
|
||||
'content_element' => false,
|
||||
'is_container' => true,
|
||||
'show_settings_on_create' => false,
|
||||
'icon' => 'icon-wpb-gitem-zone',
|
||||
'category' => esc_html__( 'Content', 'js_composer' ),
|
||||
'controls' => array( 'edit' ),
|
||||
'as_parent' => array( 'only' => 'vc_gitem_row' ),
|
||||
'js_view' => 'VcGitemZoneView',
|
||||
'params' => $zone_params,
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_zone_c' => array(
|
||||
'name' => esc_html__( 'Additional', 'js_composer' ),
|
||||
'base' => 'vc_gitem_zone_c',
|
||||
'content_element' => false,
|
||||
'is_container' => true,
|
||||
'show_settings_on_create' => false,
|
||||
'icon' => 'icon-wpb-gitem-zone',
|
||||
'category' => esc_html__( 'Content', 'js_composer' ),
|
||||
'controls' => array(
|
||||
'move',
|
||||
'delete',
|
||||
'edit',
|
||||
),
|
||||
'as_parent' => array( 'only' => 'vc_gitem_row' ),
|
||||
'js_view' => 'VcGitemZoneCView',
|
||||
'params' => array(
|
||||
array(
|
||||
'type' => 'css_editor',
|
||||
'heading' => esc_html__( 'CSS box', 'js_composer' ),
|
||||
'param_name' => 'css',
|
||||
),
|
||||
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' ),
|
||||
),
|
||||
),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_row' => array(
|
||||
'name' => esc_html__( 'Row', 'js_composer' ),
|
||||
'base' => 'vc_gitem_row',
|
||||
'content_element' => false,
|
||||
'is_container' => true,
|
||||
'icon' => 'icon-wpb-row',
|
||||
'weight' => 1000,
|
||||
'show_settings_on_create' => false,
|
||||
'controls' => array(
|
||||
'layout',
|
||||
'delete',
|
||||
),
|
||||
'allowed_container_element' => 'vc_gitem_col',
|
||||
'category' => esc_html__( 'Content', 'js_composer' ),
|
||||
'description' => esc_html__( 'Place content elements inside the row', 'js_composer' ),
|
||||
'params' => array(
|
||||
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' ),
|
||||
),
|
||||
),
|
||||
'js_view' => 'VcGitemRowView',
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_col' => array(
|
||||
'name' => esc_html__( 'Column', 'js_composer' ),
|
||||
'base' => 'vc_gitem_col',
|
||||
'icon' => 'icon-wpb-row',
|
||||
'weight' => 1000,
|
||||
'is_container' => true,
|
||||
'allowed_container_element' => false,
|
||||
'content_element' => false,
|
||||
'controls' => array( 'edit' ),
|
||||
'description' => esc_html__( 'Place content elements inside the column', 'js_composer' ),
|
||||
'params' => array(
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Width', 'js_composer' ),
|
||||
'param_name' => 'width',
|
||||
'value' => array(
|
||||
esc_html__( '1 column - 1/12', 'js_composer' ) => '1/12',
|
||||
esc_html__( '2 columns - 1/6', 'js_composer' ) => '1/6',
|
||||
esc_html__( '3 columns - 1/4', 'js_composer' ) => '1/4',
|
||||
esc_html__( '4 columns - 1/3', 'js_composer' ) => '1/3',
|
||||
esc_html__( '5 columns - 5/12', 'js_composer' ) => '5/12',
|
||||
esc_html__( '6 columns - 1/2', 'js_composer' ) => '1/2',
|
||||
esc_html__( '7 columns - 7/12', 'js_composer' ) => '7/12',
|
||||
esc_html__( '8 columns - 2/3', 'js_composer' ) => '2/3',
|
||||
esc_html__( '9 columns - 3/4', 'js_composer' ) => '3/4',
|
||||
esc_html__( '10 columns - 5/6', 'js_composer' ) => '5/6',
|
||||
esc_html__( '11 columns - 11/12', 'js_composer' ) => '11/12',
|
||||
esc_html__( '12 columns - 1/1', 'js_composer' ) => '1/1',
|
||||
),
|
||||
'description' => esc_html__( 'Select column width.', 'js_composer' ),
|
||||
'std' => '1/1',
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'heading' => esc_html__( 'Use featured image on background?', 'js_composer' ),
|
||||
'param_name' => 'featured_image',
|
||||
'value' => array( esc_html__( 'Yes', 'js_composer' ) => 'yes' ),
|
||||
'description' => esc_html__( 'Note: Featured image overwrites background image and color from "Design Options".', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'heading' => esc_html__( 'Image size', 'js_composer' ),
|
||||
'param_name' => 'img_size',
|
||||
'value' => 'large',
|
||||
'description' => esc_html__( 'Enter image size (Example: "thumbnail", "medium", "large", "full" or other sizes defined by theme). Alternatively enter size in pixels (Example: 200x100 (Width x Height)).', 'js_composer' ),
|
||||
'dependency' => array(
|
||||
'element' => 'featured_image',
|
||||
'not_empty' => true,
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'css_editor',
|
||||
'heading' => esc_html__( 'CSS box', 'js_composer' ),
|
||||
'param_name' => 'css',
|
||||
'group' => esc_html__( 'Design Options', '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' ),
|
||||
),
|
||||
),
|
||||
'js_view' => 'VcGitemColView',
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_post_title' => array(
|
||||
'name' => esc_html__( 'Post Title', 'js_composer' ),
|
||||
'base' => 'vc_gitem_post_title',
|
||||
'icon' => 'vc_icon-vc-gitem-post-title',
|
||||
'category' => esc_html__( 'Post', 'js_composer' ),
|
||||
'description' => esc_html__( 'Title of current post', 'js_composer' ),
|
||||
'params' => array_merge( $post_data_params, $custom_fonts_params, array(
|
||||
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' ),
|
||||
),
|
||||
) ),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_post_excerpt' => array(
|
||||
'name' => esc_html__( 'Post Excerpt', 'js_composer' ),
|
||||
'base' => 'vc_gitem_post_excerpt',
|
||||
'icon' => 'vc_icon-vc-gitem-post-excerpt',
|
||||
'category' => esc_html__( 'Post', 'js_composer' ),
|
||||
'description' => esc_html__( 'Excerpt or manual excerpt', 'js_composer' ),
|
||||
'params' => array_merge( $post_data_params, $custom_fonts_params, array(
|
||||
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' ),
|
||||
),
|
||||
) ),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_post_author' => array(
|
||||
'name' => esc_html__( 'Post Author', 'js_composer' ),
|
||||
'base' => 'vc_gitem_post_author',
|
||||
'icon' => 'vc_icon-vc-gitem-post-author',
|
||||
// @todo change icon ?
|
||||
'category' => esc_html__( 'Post', 'js_composer' ),
|
||||
'description' => esc_html__( 'Author of current post', 'js_composer' ),
|
||||
'params' => array_merge( array(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'heading' => esc_html__( 'Add link', 'js_composer' ),
|
||||
'param_name' => 'link',
|
||||
'value' => '',
|
||||
'description' => esc_html__( 'Add link to author?', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'css_editor',
|
||||
'heading' => esc_html__( 'CSS box', 'js_composer' ),
|
||||
'param_name' => 'css',
|
||||
'group' => esc_html__( 'Design Options', 'js_composer' ),
|
||||
),
|
||||
), $custom_fonts_params, array(
|
||||
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' ),
|
||||
),
|
||||
) ),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_post_categories' => array(
|
||||
'name' => esc_html__( 'Post Categories', 'js_composer' ),
|
||||
'base' => 'vc_gitem_post_categories',
|
||||
'icon' => 'vc_icon-vc-gitem-post-categories',
|
||||
// @todo change icon ?
|
||||
'category' => esc_html__( 'Post', 'js_composer' ),
|
||||
'description' => esc_html__( 'Categories of current post', 'js_composer' ),
|
||||
'params' => array(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'heading' => esc_html__( 'Add link', 'js_composer' ),
|
||||
'param_name' => 'link',
|
||||
'value' => '',
|
||||
'description' => esc_html__( 'Add link to category?', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Style', 'js_composer' ),
|
||||
'param_name' => 'category_style',
|
||||
'value' => array(
|
||||
esc_html__( 'None', 'js_composer' ) => ' ',
|
||||
esc_html__( 'Comma', 'js_composer' ) => ', ',
|
||||
esc_html__( 'Rounded', 'js_composer' ) => 'filled vc_grid-filter-filled-round-all',
|
||||
esc_html__( 'Less Rounded', 'js_composer' ) => 'filled vc_grid-filter-filled-rounded-all',
|
||||
esc_html__( 'Border', 'js_composer' ) => 'bordered',
|
||||
esc_html__( 'Rounded Border', 'js_composer' ) => 'bordered-rounded vc_grid-filter-filled-round-all',
|
||||
esc_html__( 'Less Rounded Border', 'js_composer' ) => 'bordered-rounded-less vc_grid-filter-filled-rounded-all',
|
||||
),
|
||||
'description' => esc_html__( 'Select category display style.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Color', 'js_composer' ),
|
||||
'param_name' => 'category_color',
|
||||
'value' => vc_get_shared( 'colors' ),
|
||||
'std' => 'grey',
|
||||
'param_holder_class' => 'vc_colored-dropdown',
|
||||
'dependency' => array(
|
||||
'element' => 'category_style',
|
||||
'value_not_equal_to' => array(
|
||||
' ',
|
||||
', ',
|
||||
),
|
||||
),
|
||||
'description' => esc_html__( 'Select category color.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Category size', 'js_composer' ),
|
||||
'param_name' => 'category_size',
|
||||
'value' => vc_get_shared( 'sizes' ),
|
||||
'std' => 'md',
|
||||
'description' => esc_html__( 'Select category size.', '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' ),
|
||||
),
|
||||
),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_image' => array(
|
||||
'name' => esc_html__( 'Post Image', 'js_composer' ),
|
||||
'base' => 'vc_gitem_image',
|
||||
'icon' => 'vc_icon-vc-gitem-image',
|
||||
'category' => esc_html__( 'Post', 'js_composer' ),
|
||||
'description' => esc_html__( 'Featured image', 'js_composer' ),
|
||||
'params' => array(
|
||||
$vc_gitem_add_link_param,
|
||||
array(
|
||||
'type' => 'vc_link',
|
||||
'heading' => esc_html__( 'URL (Link)', 'js_composer' ),
|
||||
'param_name' => 'url',
|
||||
'dependency' => array(
|
||||
'element' => 'link',
|
||||
'value' => array( 'custom' ),
|
||||
),
|
||||
'description' => esc_html__( 'Add custom link.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'heading' => esc_html__( 'Image size', 'js_composer' ),
|
||||
'param_name' => 'img_size',
|
||||
'description' => esc_html__( 'Enter image size (Example: "thumbnail", "medium", "large", "full" or other sizes defined by theme). Alternatively enter size in pixels (Example: 200x100 (Width x Height)). Leave parameter empty to use "thumbnail" by default.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Image alignment', 'js_composer' ),
|
||||
'param_name' => 'alignment',
|
||||
'value' => array(
|
||||
esc_html__( 'Left', 'js_composer' ) => '',
|
||||
esc_html__( 'Right', 'js_composer' ) => 'right',
|
||||
esc_html__( 'Center', 'js_composer' ) => 'center',
|
||||
),
|
||||
'description' => esc_html__( 'Select image alignment.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Image style', 'js_composer' ),
|
||||
'param_name' => 'style',
|
||||
'value' => vc_get_shared( 'single image styles' ),
|
||||
'description' => esc_html__( 'Select image display style.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Border color', 'js_composer' ),
|
||||
'param_name' => 'border_color',
|
||||
'value' => vc_get_shared( 'colors' ),
|
||||
'std' => 'grey',
|
||||
'dependency' => array(
|
||||
'element' => 'style',
|
||||
'value' => array(
|
||||
'vc_box_border',
|
||||
'vc_box_border_circle',
|
||||
'vc_box_outline',
|
||||
'vc_box_outline_circle',
|
||||
),
|
||||
),
|
||||
'description' => esc_html__( 'Border color.', 'js_composer' ),
|
||||
'param_holder_class' => 'vc_colored-dropdown',
|
||||
),
|
||||
vc_map_add_css_animation(),
|
||||
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' ),
|
||||
),
|
||||
),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_post_date' => array(
|
||||
'name' => esc_html__( 'Post Date', 'js_composer' ),
|
||||
'base' => 'vc_gitem_post_date',
|
||||
'icon' => 'vc_icon-vc-gitem-post-date',
|
||||
'category' => esc_html__( 'Post', 'js_composer' ),
|
||||
'description' => esc_html__( 'Post publish date', 'js_composer' ),
|
||||
'params' => array_merge( $post_data_params, $custom_fonts_params, array(
|
||||
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' ),
|
||||
),
|
||||
) ),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
'vc_gitem_post_meta' => array(
|
||||
'name' => esc_html__( 'Custom Field', 'js_composer' ),
|
||||
'base' => 'vc_gitem_post_meta',
|
||||
'icon' => 'vc_icon-vc-gitem-post-meta',
|
||||
'category' => array(
|
||||
esc_html__( 'Elements', 'js_composer' ),
|
||||
),
|
||||
'description' => esc_html__( 'Custom fields data from meta values of the post.', 'js_composer' ),
|
||||
'params' => array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'heading' => esc_html__( 'Field key name', 'js_composer' ),
|
||||
'param_name' => 'key',
|
||||
'description' => esc_html__( 'Enter custom field name to retrieve meta data value.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'heading' => esc_html__( 'Label', 'js_composer' ),
|
||||
'param_name' => 'label',
|
||||
'description' => esc_html__( 'Enter label to display before key value.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Alignment', 'js_composer' ),
|
||||
'param_name' => 'align',
|
||||
'value' => array(
|
||||
esc_html__( 'Left', 'js_composer' ) => 'left',
|
||||
esc_html__( 'Right', 'js_composer' ) => 'right',
|
||||
esc_html__( 'Center', 'js_composer' ) => 'center',
|
||||
esc_html__( 'Justify', 'js_composer' ) => 'justify',
|
||||
),
|
||||
'description' => esc_html__( 'Select alignment.', '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' ),
|
||||
),
|
||||
),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
),
|
||||
);
|
||||
$shortcode_vc_column_text = WPBMap::getShortCode( 'vc_column_text' );
|
||||
if ( is_array( $shortcode_vc_column_text ) && isset( $shortcode_vc_column_text['base'] ) ) {
|
||||
$list['vc_column_text'] = $shortcode_vc_column_text;
|
||||
$list['vc_column_text']['post_type'] = Vc_Grid_Item_Editor::postType();
|
||||
$remove = array( 'el_id' );
|
||||
foreach ( $list['vc_column_text']['params'] as $k => $v ) {
|
||||
if ( in_array( $v['param_name'], $remove, true ) ) {
|
||||
unset( $list['vc_column_text']['params'][ $k ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
$shortcode_vc_separator = WPBMap::getShortCode( 'vc_separator' );
|
||||
if ( is_array( $shortcode_vc_separator ) && isset( $shortcode_vc_separator['base'] ) ) {
|
||||
$list['vc_separator'] = $shortcode_vc_separator;
|
||||
$list['vc_separator']['post_type'] = Vc_Grid_Item_Editor::postType();
|
||||
$remove = array( 'el_id' );
|
||||
foreach ( $list['vc_separator']['params'] as $k => $v ) {
|
||||
if ( in_array( $v['param_name'], $remove, true ) ) {
|
||||
unset( $list['vc_separator']['params'][ $k ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
$shortcode_vc_text_separator = WPBMap::getShortCode( 'vc_text_separator' );
|
||||
if ( is_array( $shortcode_vc_text_separator ) && isset( $shortcode_vc_text_separator['base'] ) ) {
|
||||
$list['vc_text_separator'] = $shortcode_vc_text_separator;
|
||||
$list['vc_text_separator']['post_type'] = Vc_Grid_Item_Editor::postType();
|
||||
|
||||
$remove = array( 'el_id' );
|
||||
foreach ( $list['vc_text_separator']['params'] as $k => $v ) {
|
||||
if ( in_array( $v['param_name'], $remove, true ) ) {
|
||||
unset( $list['vc_text_separator']['params'][ $k ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
$shortcode_vc_icon = WPBMap::getShortCode( 'vc_icon' );
|
||||
if ( is_array( $shortcode_vc_icon ) && isset( $shortcode_vc_icon['base'] ) ) {
|
||||
$list['vc_icon'] = $shortcode_vc_icon;
|
||||
$list['vc_icon']['post_type'] = Vc_Grid_Item_Editor::postType();
|
||||
$list['vc_icon']['params'] = vc_map_integrate_shortcode( 'vc_icon', '', '', array(
|
||||
'exclude' => array(
|
||||
'link',
|
||||
'el_id',
|
||||
),
|
||||
) );
|
||||
}
|
||||
$list['vc_single_image'] = array(
|
||||
'name' => esc_html__( 'Single Image', 'js_composer' ),
|
||||
'base' => 'vc_single_image',
|
||||
'icon' => 'icon-wpb-single-image',
|
||||
'category' => esc_html__( 'Content', 'js_composer' ),
|
||||
'description' => esc_html__( 'Simple image with CSS animation', 'js_composer' ),
|
||||
'params' => array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'heading' => esc_html__( 'Widget title', 'js_composer' ),
|
||||
'param_name' => 'title',
|
||||
'description' => esc_html__( 'Enter text used as widget title (Note: located above content element).', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Image source', 'js_composer' ),
|
||||
'param_name' => 'source',
|
||||
'value' => array(
|
||||
esc_html__( 'Media library', 'js_composer' ) => 'media_library',
|
||||
esc_html__( 'External link', 'js_composer' ) => 'external_link',
|
||||
),
|
||||
'std' => 'media_library',
|
||||
'description' => esc_html__( 'Select image source.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'attach_image',
|
||||
'heading' => esc_html__( 'Image', 'js_composer' ),
|
||||
'param_name' => 'image',
|
||||
'value' => '',
|
||||
'description' => esc_html__( 'Select image from media library.', 'js_composer' ),
|
||||
'dependency' => array(
|
||||
'element' => 'source',
|
||||
'value' => 'media_library',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'heading' => esc_html__( 'External link', 'js_composer' ),
|
||||
'param_name' => 'custom_src',
|
||||
'description' => esc_html__( 'Select external link.', 'js_composer' ),
|
||||
'dependency' => array(
|
||||
'element' => 'source',
|
||||
'value' => 'external_link',
|
||||
),
|
||||
),
|
||||
vc_map_add_css_animation(),
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'heading' => esc_html__( 'Image size', 'js_composer' ),
|
||||
'param_name' => 'img_size',
|
||||
'description' => esc_html__( 'Enter image size (Example: "thumbnail", "medium", "large", "full" or other sizes defined by theme). Alternatively enter size in pixels (Example: 200x100 (Width x Height)). Leave parameter empty to use "thumbnail" by default.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Image alignment', 'js_composer' ),
|
||||
'param_name' => 'alignment',
|
||||
'value' => array(
|
||||
esc_html__( 'Left', 'js_composer' ) => '',
|
||||
esc_html__( 'Right', 'js_composer' ) => 'right',
|
||||
esc_html__( 'Center', 'js_composer' ) => 'center',
|
||||
),
|
||||
'description' => esc_html__( 'Select image alignment.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Image style', 'js_composer' ),
|
||||
'param_name' => 'style',
|
||||
'value' => vc_get_shared( 'single image styles' ),
|
||||
'description' => esc_html__( 'Select image display style.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => esc_html__( 'Border color', 'js_composer' ),
|
||||
'param_name' => 'border_color',
|
||||
'value' => vc_get_shared( 'colors' ),
|
||||
'std' => 'grey',
|
||||
'dependency' => array(
|
||||
'element' => 'style',
|
||||
'value' => array(
|
||||
'vc_box_border',
|
||||
'vc_box_border_circle',
|
||||
'vc_box_outline',
|
||||
'vc_box_outline_circle',
|
||||
),
|
||||
),
|
||||
'description' => esc_html__( 'Border color.', 'js_composer' ),
|
||||
'param_holder_class' => 'vc_colored-dropdown',
|
||||
),
|
||||
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' ),
|
||||
),
|
||||
),
|
||||
'post_type' => Vc_Grid_Item_Editor::postType(),
|
||||
);
|
||||
$shortcode_vc_button2 = WPBMap::getShortCode( 'vc_button2' );
|
||||
if ( is_array( $shortcode_vc_button2 ) && isset( $shortcode_vc_button2['base'] ) ) {
|
||||
$list['vc_button2'] = $shortcode_vc_button2;
|
||||
$list['vc_button2']['post_type'] = Vc_Grid_Item_Editor::postType();
|
||||
}
|
||||
|
||||
$shortcode_vc_btn = WPBMap::getShortCode( 'vc_btn' );
|
||||
if ( is_array( $shortcode_vc_btn ) && isset( $shortcode_vc_btn['base'] ) ) {
|
||||
$list['vc_btn'] = $shortcode_vc_btn;
|
||||
$list['vc_btn']['post_type'] = Vc_Grid_Item_Editor::postType();
|
||||
unset( $list['vc_btn']['params'][1] );
|
||||
$remove = array( 'el_id' );
|
||||
foreach ( $list['vc_btn']['params'] as $k => $v ) {
|
||||
if ( in_array( $v['param_name'], $remove, true ) ) {
|
||||
unset( $list['vc_btn']['params'][ $k ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
$shortcode_vc_custom_heading = WPBMap::getShortCode( 'vc_custom_heading' );
|
||||
if ( is_array( $shortcode_vc_custom_heading ) && isset( $shortcode_vc_custom_heading['base'] ) ) {
|
||||
$list['vc_custom_heading'] = $shortcode_vc_custom_heading;
|
||||
$list['vc_custom_heading']['post_type'] = Vc_Grid_Item_Editor::postType();
|
||||
|
||||
$remove = array(
|
||||
'link',
|
||||
'source',
|
||||
'el_id',
|
||||
);
|
||||
foreach ( $list['vc_custom_heading']['params'] as $k => $v ) {
|
||||
if ( in_array( $v['param_name'], $remove, true ) ) {
|
||||
unset( $list['vc_custom_heading']['params'][ $k ] );
|
||||
}
|
||||
|
||||
// text depends on source. remove dependency so text is always saved
|
||||
if ( 'text' === $v['param_name'] ) {
|
||||
unset( $list['vc_custom_heading']['params'][ $k ]['dependency'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
$shortcode_vc_empty_space = WPBMap::getShortCode( 'vc_empty_space' );
|
||||
if ( is_array( $shortcode_vc_empty_space ) && isset( $shortcode_vc_empty_space['base'] ) ) {
|
||||
$list['vc_empty_space'] = $shortcode_vc_empty_space;
|
||||
$list['vc_empty_space']['post_type'] = Vc_Grid_Item_Editor::postType();
|
||||
$remove = array( 'el_id' );
|
||||
foreach ( $list['vc_empty_space']['params'] as $k => $v ) {
|
||||
if ( in_array( $v['param_name'], $remove, true ) ) {
|
||||
unset( $list['vc_empty_space']['params'][ $k ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (
|
||||
array(
|
||||
'vc_icon',
|
||||
'vc_button2',
|
||||
'vc_btn',
|
||||
'vc_custom_heading',
|
||||
'vc_single_image',
|
||||
) as $key
|
||||
) {
|
||||
if ( isset( $list[ $key ] ) ) {
|
||||
if ( ! isset( $list[ $key ]['params'] ) ) {
|
||||
$list[ $key ]['params'] = array();
|
||||
}
|
||||
if ( 'vc_button2' === $key ) {
|
||||
// change settings for vc_link in dropdown. Add dependency.
|
||||
$list[ $key ]['params'][0] = array(
|
||||
'type' => 'vc_link',
|
||||
'heading' => esc_html__( 'URL (Link)', 'js_composer' ),
|
||||
'param_name' => 'url',
|
||||
'dependency' => array(
|
||||
'element' => 'link',
|
||||
'value' => array( 'custom' ),
|
||||
),
|
||||
'description' => esc_html__( 'Add custom link.', 'js_composer' ),
|
||||
);
|
||||
} else {
|
||||
array_unshift( $list[ $key ]['params'], array(
|
||||
'type' => 'vc_link',
|
||||
'heading' => esc_html__( 'URL (Link)', 'js_composer' ),
|
||||
'param_name' => 'url',
|
||||
'dependency' => array(
|
||||
'element' => 'link',
|
||||
'value' => array( 'custom' ),
|
||||
),
|
||||
'description' => esc_html__( 'Add custom link.', 'js_composer' ),
|
||||
) );
|
||||
}
|
||||
// Add link dropdown
|
||||
array_unshift( $list[ $key ]['params'], $vc_gitem_add_link_param );
|
||||
}
|
||||
}
|
||||
foreach ( $list as $key => $value ) {
|
||||
if ( isset( $list[ $key ]['params'] ) ) {
|
||||
$list[ $key ]['params'] = array_values( $list[ $key ]['params'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
return array(
|
||||
'none' => array(
|
||||
'name' => esc_html__( 'Basic grid: Default', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="bottom"][vc_gitem_animated_block][vc_gitem_zone_a height_mode="1-1" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1419240516480{background-color: #f9f9f9 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'Read more', 'js_composer' ) . '" style="flat" shape="rounded" color="juicy-pink" size="md" align="left"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'basicGrid_ScaleInWithRotation' => array(
|
||||
'name' => esc_html__( 'Basic grid: Scale in with rotation', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="bottom"][vc_gitem_animated_block animation="scaleRotateIn"][vc_gitem_zone_a height_mode="1-1" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419240793832{background-color: rgba(0,0,0,0.3) !important;*background-color: rgb(0,0,0) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1419240595465{background-color: #f9f9f9 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'Read more', 'js_composer' ) . '" style="flat" shape="rounded" color="juicy-pink" size="md" align="left"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'basicGrid_FadeInWithSideContent' => array(
|
||||
'name' => esc_html__( 'Basic grid: Fade with side content', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="right" css=".vc_custom_1420541757398{background-color: #f9f9f9 !important;}"][vc_gitem_animated_block animation="fadeIn"][vc_gitem_zone_a height_mode="3-4" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419242201096{background-color: rgba(255,255,255,0.2) !important;*background-color: rgb(255,255,255) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1419242120132{background-color: #f9f9f9 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_date link="none" font_container="tag:div|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'Read more', 'js_composer' ) . '" style="flat" shape="rounded" color="juicy-pink" size="md" align="left"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'basicGrid_SlideBottomWithIcon' => array(
|
||||
'name' => esc_html__( 'Basic grid: Slide bottom with icon', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="bottom"][vc_gitem_animated_block animation="slideBottom"][vc_gitem_zone_a height_mode="1-1" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419251931135{background-color: rgba(0,0,0,0.3) !important;*background-color: rgb(0,0,0) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_icon type="fontawesome" icon_fontawesome="fa fa-search" icon_openiconic="vc-oi vc-oi-dial" icon_typicons="typcn typcn-zoom" icon_entypo="entypo-icon entypo-icon-note" icon_linecons="vc_li vc_li-heart" color="white" background_color="white" size="md" align="center"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1419251874438{background-color: #f9f9f9 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:h4|text_align:center" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:center" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'Read more', 'js_composer' ) . '" style="flat" shape="rounded" color="juicy-pink" size="md" align="center"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'basicGrid_VerticalFlip' => array(
|
||||
'name' => esc_html__( 'Basic grid: Vertical flip', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="" position=""][vc_gitem_animated_block animation="flipFadeIn"][vc_gitem_zone_a height_mode="3-4" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419250758402{background-color: #353535 !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1" featured_image="" css=".vc_custom_1419250916067{padding-right: 15px !important;padding-left: 15px !important;}"][vc_gitem_post_title link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:500%20bold%20regular%3A500%3Anormal" block_container="font_size:22|color:%23ffffff|line_height:1.2"][vc_separator color="white" align="align_center" el_width="50"][vc_gitem_post_excerpt link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:300%20light%20regular%3A300%3Anormal" block_container="font_size:14|color:%23ffffff|line_height:1.3"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'basicGrid_NoAnimation' => array(
|
||||
'name' => esc_html__( 'Basic grid: No animation', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="none"][vc_gitem_zone_a height_mode="1-1" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419253765784{background-color: rgba(0,0,0,0.3) !important;*background-color: rgb(0,0,0) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_date link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:12|color:%23e5e5e5" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_title link="none" font_container="tag:h3|text_align:center" use_custom_fonts="yes" block_container="font_size:24|color:%23ffffff" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'basicGrid_GoTopSlideout' => array(
|
||||
'name' => esc_html__( 'Basic grid: Go top slideout', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="goTop20"][vc_gitem_zone_a height_mode="3-4" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image=""][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1" featured_image="" css=".vc_custom_1419254486087{background-color: #f2f2f2 !important;}"][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'basicGrid_TextFirst' => array(
|
||||
'name' => esc_html__( 'Basic grid: Text first', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="flipHorizontalFadeIn"][vc_gitem_zone_a height_mode="1-1" link="post_link" featured_image="" css=".vc_custom_1419260513295{padding-right: 15px !important;padding-left: 15px !important;background-color: #2d2d2d !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_gitem_post_title link="none" font_container="tag:div|text_align:left" use_custom_fonts="yes" block_container="font_size:24|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:300%20light%20regular%3A300%3Anormal"][vc_separator color="white" align="align_left" border_width="2" el_width="50"][vc_gitem_post_excerpt link="none" font_container="tag:div|text_align:left" use_custom_fonts="yes" block_container="font_size:14|color:%23e2e2e2|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'basicGrid_SlideFromLeft' => array(
|
||||
'name' => esc_html__( 'Basic grid: Slide from left', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="" position=""][vc_gitem_animated_block animation="slideInRight"][vc_gitem_zone_a height_mode="4-3" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image=""][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2" featured_image="" css=".vc_custom_1419258058654{padding-left: 15px !important;background-color: #282828 !important;}"][vc_gitem_post_date link="none" font_container="tag:div|text_align:left" use_custom_fonts="yes" block_container="font_size:12|color:%23efefef" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_title link="none" font_container="tag:h3|text_align:left" use_custom_fonts="yes" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:300%20light%20regular%3A300%3Anormal" block_container="font_size:20|color:%23ffffff"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'basicGrid_SlideFromTop' => array(
|
||||
'name' => esc_html__( 'Basic grid: Slide from top', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="slideTop"][vc_gitem_zone_a height_mode="1-1" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="none" featured_image="" css=".vc_custom_1419260990461{padding-right: 15px !important;padding-left: 15px !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:div|text_align:left" use_custom_fonts="yes" block_container="font_size:24|color:%23ffffff|line_height:1.2" google_fonts="font_family:Montserrat%3Aregular%2C700|font_style:700%20bold%20regular%3A700%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:div|text_align:left" use_custom_fonts="yes" block_container="font_size:14|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'READ MORE', 'js_composer' ) . '" style="outline" shape="square" color="white" size="md" align="left"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_Default' => array(
|
||||
'name' => esc_html__( 'Masonry grid: Default', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="bottom"][vc_gitem_animated_block][vc_gitem_zone_a height_mode="original" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1419328663991{background-color: #f4f4f4 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'Read more', 'js_composer' ) . '" style="flat" shape="rounded" color="juicy-pink" size="md" align="left"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_FadeIn' => array(
|
||||
'name' => esc_html__( 'Masonry grid: Fade in', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="bottom"][vc_gitem_animated_block animation="fadeIn"][vc_gitem_zone_a height_mode="original" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419328603590{background-color: rgba(255,255,255,0.2) !important;*background-color: rgb(255,255,255) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1419328565352{background-color: #f4f4f4 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'Read more', 'js_composer' ) . '" style="flat" shape="rounded" color="juicy-pink" size="md" align="left"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_IconSlideOut' => array(
|
||||
'name' => esc_html__( 'Masonry grid: Icon slide out', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="bottom"][vc_gitem_animated_block animation="slideBottom"][vc_gitem_zone_a height_mode="original" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419328999899{background-color: rgba(0,0,0,0.5) !important;*background-color: rgb(0,0,0) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_icon type="fontawesome" icon_fontawesome="fa fa-search" icon_openiconic="vc-oi vc-oi-dial" icon_typicons="typcn typcn-adjust-brightness" icon_entypo="entypo-icon entypo-icon-note" icon_linecons="vc_li vc_li-heart" color="white" background_color="blue" size="md" align="center"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1419328781574{background-color: #f4f4f4 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'Read more', 'js_composer' ) . '" style="flat" shape="rounded" color="juicy-pink" size="md" align="left"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_SlideFromLeft' => array(
|
||||
'name' => esc_html__( 'Masonry grid: Slide from left', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="slideInRight"][vc_gitem_zone_a height_mode="original" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419328927507{background-color: #f4f4f4 !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_separator color="black" align="align_left" border_width="2" el_width="50"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_GoTop' => array(
|
||||
'name' => esc_html__( 'Masonry grid: Go top', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="goTop20"][vc_gitem_zone_a height_mode="original" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image=""][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1" featured_image="" css=".vc_custom_1419329081651{background-color: #2b2b2b !important;}"][vc_gitem_post_title link="none" font_container="tag:div|text_align:left" use_custom_fonts="yes" block_container="font_size:20|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:500%20bold%20regular%3A500%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:div|text_align:left" use_custom_fonts="yes" block_container="font_size:14|color:%23efefef|line_height:1.2" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_OverlayWithRotation' => array(
|
||||
'name' => esc_html__( 'Masonry grid: Overlay with rotation', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="scaleRotateIn"][vc_gitem_zone_a height_mode="original" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419329305433{background-color: rgba(0,0,0,0.5) !important;*background-color: rgb(0,0,0) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_gitem_post_date link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:12|color:%23dbdbdb" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:300%20light%20regular%3A300%3Anormal"][vc_gitem_post_title link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:24|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_BlurOut' => array(
|
||||
'name' => esc_html__( 'Masonry grid: Blur out', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="blurOut"][vc_gitem_zone_a height_mode="original" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419329691977{background-color: rgba(0,0,0,0.5) !important;*background-color: rgb(0,0,0) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:24|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:300%20light%20regular%3A300%3Anormal"][vc_separator color="grey" align="align_center" el_width="50"][vc_gitem_post_excerpt link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:14|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_ScaleWithRotation' => array(
|
||||
'name' => esc_html__( 'Masonry grid: Scale with rotation', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="bottom" position=""][vc_gitem_animated_block animation="scaleRotateIn"][vc_gitem_zone_a height_mode="original" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419333125675{background-color: rgba(255,255,255,0.2) !important;*background-color: rgb(255,255,255) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1419333453605{background-color: #f4f4f4 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'Read more', 'js_composer' ) . '" style="flat" shape="rounded" color="juicy-pink" size="md" align="left"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_SlideoOutFromRight' => array(
|
||||
'name' => esc_html__( 'Masonry grid: Slideo out from right', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="slideInLeft"][vc_gitem_zone_a height_mode="original" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image=""][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2" featured_image=""][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2" featured_image="" css=".vc_custom_1419333716781{margin-bottom: 25px !important;padding-top: 20px !important;padding-left: 20px !important;background-color: #282828 !important;}"][vc_gitem_post_title link="none" font_container="tag:div|text_align:left" use_custom_fonts="yes" block_container="font_size:24|color:%23ffffff|line_height:1.3" google_fonts="font_family:Montserrat%3Aregular%2C700|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryGrid_WithSideContent' => array(
|
||||
'name' => esc_html__( 'Masonry grid: With side content', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="right" css=".vc_custom_1419334531994{background-color: #f4f4f4 !important;}"][vc_gitem_animated_block animation="blurScaleOut"][vc_gitem_zone_a height_mode="original" link="post_link" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="post_link" featured_image="" css=".vc_custom_1419334566318{background-color: rgba(255,255,255,0.2) !important;*background-color: rgb(255,255,255) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_date link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_btn link="post_link" title="' . esc_attr__( 'Read more', 'js_composer' ) . '" style="flat" shape="rounded" color="juicy-pink" size="md" align="left"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_Default' => array(
|
||||
'name' => esc_html__( 'Media grid: Default', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block][vc_gitem_zone_a height_mode="1-1" link="image_lightbox" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_SimpleOverlay' => array(
|
||||
'name' => esc_html__( 'Media grid: Simple overlay', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="none"][vc_gitem_zone_a height_mode="1-1" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="yes" css=".vc_custom_1419000810062{margin: -15px !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_FadeInWithIcon' => array(
|
||||
'name' => esc_html__( 'Media grid: Fade in with icon', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="fadeIn"][vc_gitem_zone_a height_mode="4-3" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1419001011185{background-color: rgba(40,40,40,0.5) !important;*background-color: rgb(40,40,40) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_icon type="entypo" icon_fontawesome="fa fa-adjust" icon_openiconic="vc-oi vc-oi-eye" icon_typicons="typcn typcn-adjust-brightness" icon_entypo="entypo-icon entypo-icon-plus" icon_linecons="vc_li vc_li-heart" color="white" background_color="blue" size="lg" align="center"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_BorderedScaleWithTitle' => array(
|
||||
'name' => esc_html__( 'Media grid: Bordered scale with title', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="scaleRotateIn"][vc_gitem_zone_a height_mode="3-4" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1419001608026{margin-top: 5px !important;margin-right: 5px !important;margin-bottom: 5px !important;margin-left: 5px !important;border-top-width: 5px !important;border-right-width: 5px !important;border-bottom-width: 5px !important;border-left-width: 5px !important;border-left-color: #ffffff !important;border-left-style: solid !important;border-right-color: #ffffff !important;border-right-style: solid !important;border-top-color: #ffffff !important;border-top-style: solid !important;border-bottom-color: #ffffff !important;border-bottom-style: solid !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1" featured_image="" css=".vc_custom_1419001517455{padding-right: 15px !important;padding-left: 15px !important;}"][vc_gitem_post_title link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:24|color:%23ffffff|line_height:1.3" google_fonts="font_family:Open%20Sans%3A300%2C300italic%2Cregular%2Citalic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_ScaleWithRotation' => array(
|
||||
'name' => esc_html__( 'Media grid: Scale with rotation', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="scaleRotateIn"][vc_gitem_zone_a height_mode="1-1" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1419001365234{background-color: rgba(0,0,0,0.3) !important;*background-color: rgb(0,0,0) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_SlideOutCaption' => array(
|
||||
'name' => esc_html__( 'Media grid: Slide out caption', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="slideBottom"][vc_gitem_zone_a height_mode="1-1" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1419002217534{padding-right: 20px !important;padding-left: 20px !important;background-color: #4f4f4f !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_gitem_post_title link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:30|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:100%20light%20regular%3A100%3Anormal"][vc_separator color="white" align="align_center" border_width="2" el_width="50"][vc_gitem_post_excerpt link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:14|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_HorizontalFlipWithFade' => array(
|
||||
'name' => esc_html__( 'Media grid: Horizontal flip with fade', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="flipHorizontalFadeIn"][vc_gitem_zone_a height_mode="1-1" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1419002089906{background-color: #4f4f4f !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1" featured_image="" css=".vc_custom_1419002184955{padding-right: 15px !important;padding-left: 15px !important;}"][vc_gitem_post_date link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:12|color:%23e0e0e0|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_title link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:30|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:100%20light%20regular%3A100%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_BlurWithContentBlock' => array(
|
||||
'name' => esc_html__( 'Media grid: Blur with content block', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="bottom"][vc_gitem_animated_block animation="blurScaleOut"][vc_gitem_zone_a height_mode="1-1" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1419002895369{background-color: rgba(255,255,255,0.15) !important;*background-color: rgb(255,255,255) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1419240502350{background-color: #f9f9f9 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_SlideInTitle' => array(
|
||||
'name' => esc_html__( 'Media grid: Slide in title', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="slideTop"][vc_gitem_zone_a height_mode="4-3" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1" featured_image="" css=".vc_custom_1419003984488{padding-right: 15px !important;padding-left: 15px !important;}"][vc_gitem_post_title link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:18|color:%23ffffff|line_height:1.3" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:500%20bold%20regular%3A500%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/2" featured_image=""][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'mediaGrid_ScaleInWithIcon' => array(
|
||||
'name' => esc_html__( 'Media grid: Scale in with icon', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="scaleIn"][vc_gitem_zone_a height_mode="1-1" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_icon type="fontawesome" icon_fontawesome="fa fa-search" icon_openiconic="vc-oi vc-oi-dial" icon_typicons="typcn typcn-adjust-brightness" icon_entypo="entypo-icon entypo-icon-note" icon_linecons="vc_li vc_li-heart" color="white" background_color="white" size="lg" align="center"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryMedia_Default' => array(
|
||||
'name' => esc_html__( 'Masonry media: Default', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block][vc_gitem_zone_a height_mode="original" link="image_lightbox" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryMedia_BorderedScale' => array(
|
||||
'name' => esc_html__( 'Masonry media: Bordered scale', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="scaleIn"][vc_gitem_zone_a height_mode="original" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1418993682046{border: 10px solid #e8e8e8 !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryMedia_SolidBlurOut' => array(
|
||||
'name' => esc_html__( 'Masonry media: Solid blur out', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="blurOut"][vc_gitem_zone_a height_mode="original" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1418993823084{background-color: rgba(0,0,0,0.4) !important;*background-color: rgb(0,0,0) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_icon type="typicons" icon_fontawesome="fa fa-adjust" icon_openiconic="vc-oi vc-oi-resize-full-alt" icon_typicons="typcn typcn-zoom-outline" icon_entypo="entypo-icon entypo-icon-note" icon_linecons="vc_li vc_li-heart" color="white" background_color="white" size="lg" align="center"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryMedia_ScaleWithRotationLight' => array(
|
||||
'name' => esc_html__( 'Masonry media: Scale with rotation light', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="scaleRotateIn"][vc_gitem_zone_a height_mode="original" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1418994252440{background-color: rgba(255,255,255,0.2) !important;*background-color: rgb(255,255,255) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryMedia_SlideWithTitleAndCaption' => array(
|
||||
'name' => esc_html__( 'Masonry media: Slide with title and caption', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="" position=""][vc_gitem_animated_block animation="slideBottom"][vc_gitem_zone_a height_mode="original" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image=""][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1" featured_image="" css=".vc_custom_1418995080777{padding-top: 15px !important;padding-right: 15px !important;padding-bottom: 15px !important;padding-left: 15px !important;background-color: rgba(45,45,45,0.8) !important;*background-color: rgb(45,45,45) !important;}"][vc_gitem_post_title link="none" font_container="tag:div|text_align:left" use_custom_fonts="yes" block_container="font_size:18|color:%23ffffff|line_height:1.2" google_fonts="font_family:Montserrat%3Aregular%2C700|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="yes" google_fonts="font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:400%20regular%3A400%3Anormal" block_container="font_size:14|color:%23ffffff|line_height:1.3"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryMedia_ScaleWithContentBlock' => array(
|
||||
'name' => esc_html__( 'Masonry media: Scale with content block', 'js_composer' ),
|
||||
'template' => '[vc_gitem c_zone_position="bottom"][vc_gitem_animated_block animation="scaleRotateIn"][vc_gitem_zone_a height_mode="original" link="image_lightbox" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="none" featured_image=""][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][vc_gitem_zone_c css=".vc_custom_1418995850605{padding-top: 5px !important;padding-right: 15px !important;padding-bottom: 5px !important;padding-left: 15px !important;background-color: #f9f9f9 !important;}"][vc_gitem_row][vc_gitem_col width="1/1" featured_image=""][vc_gitem_post_title link="none" font_container="tag:h4|text_align:left" use_custom_fonts="" block_container="font_size:18|line_height:1.2" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][vc_gitem_post_excerpt link="none" font_container="tag:p|text_align:left" use_custom_fonts="" google_fonts="font_family:Abril%20Fatface%3Aregular|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_c][/vc_gitem]',
|
||||
),
|
||||
'masonryMedia_SimpleOverlay' => array(
|
||||
'name' => esc_html__( 'Masonry media: Simple overlay', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="none"][vc_gitem_zone_a height_mode="original" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1419337784115{background-color: #262626 !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_gitem_post_title link="none" font_container="tag:div|text_align:center" use_custom_fonts="yes" block_container="font_size:24|color:%23ffffff|line_height:1.3" google_fonts="font_family:Montserrat%3Aregular%2C700|font_style:400%20regular%3A400%3Anormal"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryMedia_SlideTop' => array(
|
||||
'name' => esc_html__( 'Masonry media: Slide top', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="slideTop"][vc_gitem_zone_a height_mode="original" link="none" featured_image="yes"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="image_lightbox" featured_image="" css=".vc_custom_1419337643064{background-color: rgba(10,10,10,0.5) !important;*background-color: rgb(10,10,10) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/1"][vc_icon type="fontawesome" icon_fontawesome="fa fa-search" icon_openiconic="vc-oi vc-oi-dial" icon_typicons="typcn typcn-adjust-brightness" icon_entypo="entypo-icon entypo-icon-note" icon_linecons="vc_li vc_li-heart" color="white" background_color="blue" size="md" align="center"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
'masonryMedia_SimpleBlurWithScale' => array(
|
||||
'name' => esc_html__( 'Masonry media: Simple blur with scale', 'js_composer' ),
|
||||
'template' => '[vc_gitem][vc_gitem_animated_block animation="blurScaleOut"][vc_gitem_zone_a height_mode="original" link="image_lightbox" featured_image="yes" css=".vc_custom_1419338012126{background-color: rgba(10,10,10,0.7) !important;*background-color: rgb(10,10,10) !important;}"][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_a][vc_gitem_zone_b link="none" featured_image=""][vc_gitem_row position="top"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="middle"][vc_gitem_col width="1/2"][/vc_gitem_col][vc_gitem_col width="1/2"][/vc_gitem_col][/vc_gitem_row][vc_gitem_row position="bottom"][vc_gitem_col width="1/1"][/vc_gitem_col][/vc_gitem_row][/vc_gitem_zone_b][/vc_gitem_animated_block][/vc_gitem]',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_vc_link_form_field( $settings, $value ) {
|
||||
$link = vc_build_link( $value );
|
||||
|
||||
return sprintf( '<div class="vc_link"><input name="%s" class="wpb_vc_param_value %s_field" type="hidden" value="%s" data-json="%s" /><a href="#" class="button vc_link-build %s_button">%s</a> <span class="vc_link_label_title vc_link_label">%s:</span> <span class="title-label">%s</span> <span class="vc_link_label">%s:</span> <span class="url-label">%s %s</span></div>', esc_attr( $settings['param_name'] ), esc_attr( $settings['param_name'] . ' ' . $settings['type'] ), htmlentities( $value, ENT_QUOTES, 'utf-8' ), htmlentities( wp_json_encode( $link ), ENT_QUOTES, 'utf-8' ), esc_attr( $settings['param_name'] ), esc_html__( 'Select URL', 'js_composer' ), esc_html__( 'Title', 'js_composer' ), $link['title'], esc_html__( 'URL', 'js_composer' ), $link['url'], $link['target'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
* @since 4.2
|
||||
*/
|
||||
function vc_build_link( $value ) {
|
||||
return vc_parse_multi_attribute( $value, array(
|
||||
'url' => '',
|
||||
'title' => '',
|
||||
'target' => '',
|
||||
'rel' => '',
|
||||
) );
|
||||
}
|
||||
Reference in New Issue
Block a user