Import legacy nurinda.co.id website
This commit is contained in:
1 parent
3f59bb9038
commit
6e21646ac4
13389 files changed
+3246690
No files matched your search
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* An example of how to write WPBakery WPBakery Page Builder custom shortcode
|
||||
*
|
||||
* To create shortcodes for WPBakery Page Builder you need to complete 2 steps.
|
||||
*
|
||||
* 1. Create new class which extends WPBakeryShortCode.
|
||||
* If you are not familiar with OOP in php, don't worry follow this instruction and we will guide you how to
|
||||
* create valid shortcode for WPBakery Page Builder without learning OOP.
|
||||
*
|
||||
* 2. Need to create configurations by using wpb_map function.
|
||||
*
|
||||
* Shortcode class.
|
||||
* Shortcode class extends WPBakeryShortCode abstract class.
|
||||
* Correct name for shortcode class should look like WPBakeryShortCode_YOUR_SHORTCODE_HERE.
|
||||
* YOUR_SHORTCODE_HERE must contain only latin letters, numbers and symbol "_".
|
||||
*/
|
||||
|
||||
/**
|
||||
* Shortcode class example "Hello World"
|
||||
*
|
||||
* Lets pretend that we want to create shortcode with this structure: [my_hello_world foo="bar"]Shortcode content
|
||||
* here[/my_hello_world]
|
||||
*/
|
||||
class WPBakeryShortCode_my_hello_world extends WPBakeryShortCode {
|
||||
|
||||
/*
|
||||
* Thi methods returns HTML code for frontend representation of your shortcode.
|
||||
* You can use your own html markup.
|
||||
*
|
||||
* @param $atts - shortcode attributes
|
||||
* @param @content - shortcode content
|
||||
*
|
||||
* @access protected
|
||||
* vc_filter: VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG vc_shortcodes_css_class - hook to edit element class
|
||||
* @return string
|
||||
*/
|
||||
protected function content( $atts, $content = null ) {
|
||||
|
||||
extract( shortcode_atts( array(
|
||||
'width' => '1/2',
|
||||
'el_position' => '',
|
||||
'foo' => '',
|
||||
'my_dropdown' => '',
|
||||
), $atts ) );
|
||||
|
||||
$width_class = '';
|
||||
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $width_class, $this->settings['base'], $atts );
|
||||
$output = '<div class="' . $css_class . '">';
|
||||
$output .= '<h3>' . $foo . '</h3>';
|
||||
$output .= wpb_js_remove_wpautop( $content, true );
|
||||
$output .= '<p> Dropdown: ' . $my_dropdown . '</p>';
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Settings array to setup shortcode "Hello world"
|
||||
* base param is required.
|
||||
*
|
||||
* Mapping examples: $PLUGIN_DIR/config/map.php
|
||||
*
|
||||
* name - used in content elements menu and shortcode edit screen.
|
||||
* base - shortcode base. Example my_hello_world
|
||||
* class - helper class to target your shortcode in css in WPBakery Page Builder edit mode
|
||||
* icon - in order to add icon for your shortcode in dropdown menu, add class name here and style it in
|
||||
* your own css file. Note: bootstrap icons supported.
|
||||
* controls - in WPBakery Page Builder mode shortcodes can have different controls (popup_delete, edit_popup_delete, size_delete, popup_delete, full).
|
||||
Default is full.
|
||||
* params - array which holds your shortcode params. This params will be editable in shortcode settings page.
|
||||
*
|
||||
* Available param types:
|
||||
*
|
||||
* textarea_html (only one html textarea is permitted per shortcode)
|
||||
* textfield - simple input field,
|
||||
* dropdown - dropdown element with set of available options,
|
||||
* attach_image - single image selection,
|
||||
* attach_images - multiple images selection,
|
||||
* exploded_textarea - textarea, where each line will be imploded with comma (,),
|
||||
* posttypes - checkboxes with available post types,
|
||||
* widgetised_sidebars - dropdown element with set of available widget regions,
|
||||
* textarea - simple textarea,
|
||||
* textarea_raw_html - textarea, it's content will be codede into base64 (this allows you to store raw js or raw html code).
|
||||
*
|
||||
*/
|
||||
|
||||
vc_map( array(
|
||||
'base' => 'my_hello_world',
|
||||
'name' => __( 'Hello World', 'js_composer' ),
|
||||
'class' => '',
|
||||
'icon' => 'icon-heart',
|
||||
'params' => array(
|
||||
array(
|
||||
'type' => 'textfield',
|
||||
'holder' => 'h3',
|
||||
'class' => '',
|
||||
'heading' => __( 'Foo attribute', 'js_composer' ),
|
||||
'param_name' => 'foo',
|
||||
'value' => __( "I'm foo attribute", 'js_composer' ),
|
||||
'description' => __( 'Enter foo value.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea_html',
|
||||
'holder' => 'div',
|
||||
'class' => '',
|
||||
'heading' => __( 'Text', 'js_composer' ),
|
||||
'param_name' => 'content',
|
||||
'value' => __( "I'm hello world", 'js_composer' ),
|
||||
'description' => __( 'Enter your content.', 'js_composer' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'dropdown',
|
||||
'heading' => __( 'Drop down example', 'js_composer' ),
|
||||
'param_name' => 'my_dropdown',
|
||||
'value' => array( 1, 2, 'three' ),
|
||||
'description' => __( 'One, two or three?', 'js_composer' ),
|
||||
),
|
||||
),
|
||||
) );
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_Layerslider_Vc extends WPBakeryShortCode {
|
||||
|
||||
}
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Vc_Pageable
|
||||
*/
|
||||
abstract class WPBakeryShortCode_Vc_Pageable extends WPBakeryShortCode {
|
||||
/**
|
||||
* @param $settings
|
||||
*/
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->shortcodeScripts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register scripts and styles for pager
|
||||
*/
|
||||
public function shortcodeScripts() {
|
||||
wp_register_script( 'vc_pageable_owl-carousel', vc_asset_url( 'lib/owl-carousel2-dist/owl.carousel.min.js' ), array(
|
||||
'jquery',
|
||||
), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'waypoints', vc_asset_url( 'lib/waypoints/waypoints.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
|
||||
|
||||
wp_register_style( 'vc_pageable_owl-carousel-css', vc_asset_url( 'lib/owl-carousel2-dist/assets/owl.min.css' ), array(), WPB_VC_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $grid_style
|
||||
* @param $settings
|
||||
* @param $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function contentAll( $grid_style, $settings, $content ) {
|
||||
return '<div class="vc_pageable-slide-wrapper vc_clearfix" data-vc-grid-content="true">' . $content . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $grid_style
|
||||
* @param $settings
|
||||
* @param $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function contentLoadMore( $grid_style, $settings, $content ) {
|
||||
if ( ! isset( $settings['btn_data'] ) && isset( $settings['button_style'] ) && isset( $settings['button_size'] ) && isset( $settings['button_color'] ) ) {
|
||||
// BC: for those who overrided
|
||||
return '<div class="vc_pageable-slide-wrapper vc_clearfix" data-vc-grid-content="true">'
|
||||
. $content
|
||||
. '</div>'
|
||||
. '<div class="vc_pageable-load-more-btn" data-vc-grid-load-more-btn="true">'
|
||||
. do_shortcode( '[vc_button2 size="' . $settings['button_size'] . '" title="' . __( 'Load more', 'js_composer' ) . '" style="' . $settings['button_style'] . '" color="' . $settings['button_color'] . '" el_class="vc_grid-btn-load_more"]' )
|
||||
. '</div>';
|
||||
} elseif ( isset( $settings['btn_data'] ) ) {
|
||||
$data = $settings['btn_data'];
|
||||
$data['el_class'] = 'vc_grid-btn-load_more';
|
||||
$data['link'] = 'load-more-grid';
|
||||
$button3 = new WPBakeryShortCode_VC_Btn( array( 'base' => 'vc_btn' ) );
|
||||
|
||||
return '<div class="vc_pageable-slide-wrapper vc_clearfix" data-vc-grid-content="true">'
|
||||
. $content
|
||||
. '</div>'
|
||||
. '<div class="vc_pageable-load-more-btn" data-vc-grid-load-more-btn="true">'
|
||||
. apply_filters( 'vc_gitem_template_attribute_' . 'vc_btn', '', array(
|
||||
'post' => new stdClass(),
|
||||
'data' => str_replace( array( '{{ vc_btn:', '}}' ), '', $button3->output( $data ) ),
|
||||
) )
|
||||
. '</div>';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $grid_style
|
||||
* @param $settings
|
||||
* @param $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function contentLazy( $grid_style, $settings, $content ) {
|
||||
return '<div class="vc_pageable-slide-wrapper vc_clearfix" data-vc-grid-content="true">'
|
||||
. $content
|
||||
. '</div><div data-lazy-loading-btn="true" style="display: none;"><a href="' . get_permalink( $settings['page_id'] ) . '"></a></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $grid_style
|
||||
* @param $settings
|
||||
* @param string $content
|
||||
*
|
||||
* @param string $css_class
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderPagination( $grid_style, $settings, $content = '', $css_class = '' ) {
|
||||
$css_class .= empty( $css_class ) ? '' : ' ' . 'vc_pageable-wrapper vc_hook_hover';
|
||||
$content_method = vc_camel_case( 'content-' . $grid_style );
|
||||
$content = method_exists( $this, $content_method ) ? $this->$content_method( $grid_style, $settings, $content ) : $content;
|
||||
|
||||
$output = '<div class="' . esc_attr( $css_class ) . '" data-vc-pageable-content="true">'
|
||||
. $content . '</div>';
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
public function enqueueScripts() {
|
||||
wp_enqueue_script( 'vc_pageable_owl-carousel' );
|
||||
wp_enqueue_style( 'vc_pageable_owl-carousel-css' );
|
||||
wp_enqueue_style( 'animate-css' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pager data for ajax, must be overwritten
|
||||
*
|
||||
* @param array $vc_request_param request param [data]
|
||||
*
|
||||
* @return string - rendered content for ajax
|
||||
*/
|
||||
abstract function renderAjax( $vc_request_param );
|
||||
|
||||
/**
|
||||
* Check is pageable
|
||||
* @since 4.7.4
|
||||
* @return bool
|
||||
*/
|
||||
public function isObjectPageable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check can user manage post.
|
||||
*
|
||||
* @param int $page_id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function currentUserCanManage( $page_id ) {
|
||||
return vc_user_access()
|
||||
->wpAny( array( 'edit_post', (int) $page_id ) )
|
||||
->get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_Rev_Slider_Vc extends WPBakeryShortCode {
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-tab.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Accordion_tab extends WPBakeryShortCode_VC_Tab {
|
||||
protected $controls_css_settings = 'tc vc_control-container';
|
||||
protected $controls_list = array( 'add', 'edit', 'clone', 'delete' );
|
||||
protected $predefined_atts = array(
|
||||
'el_class' => '',
|
||||
'width' => '',
|
||||
'title' => '',
|
||||
);
|
||||
|
||||
public $nonDraggableClass = 'vc-non-draggable-container';
|
||||
|
||||
public function contentAdmin( $atts, $content = null ) {
|
||||
$width = $el_class = $title = '';
|
||||
extract( shortcode_atts( $this->predefined_atts, $atts ) );
|
||||
$output = '';
|
||||
|
||||
$column_controls = $this->getColumnControls( $this->settings( 'controls' ) );
|
||||
$column_controls_bottom = $this->getColumnControls( 'add', 'bottom-controls' );
|
||||
|
||||
if ( 'column_14' === $width || '1/4' === $width ) {
|
||||
$width = array( 'vc_col-sm-3' );
|
||||
} elseif ( 'column_14-14-14-14' === $width ) {
|
||||
$width = array(
|
||||
'vc_col-sm-3',
|
||||
'vc_col-sm-3',
|
||||
'vc_col-sm-3',
|
||||
'vc_col-sm-3',
|
||||
);
|
||||
} elseif ( 'column_13' === $width || '1/3' === $width ) {
|
||||
$width = array( 'vc_col-sm-4' );
|
||||
} elseif ( 'column_13-23' === $width ) {
|
||||
$width = array( 'vc_col-sm-4', 'vc_col-sm-8' );
|
||||
} elseif ( 'column_13-13-13' === $width ) {
|
||||
$width = array( 'vc_col-sm-4', 'vc_col-sm-4', 'vc_col-sm-4' );
|
||||
} elseif ( 'column_12' === $width || '1/2' === $width ) {
|
||||
$width = array( 'vc_col-sm-6' );
|
||||
} elseif ( 'column_12-12' === $width ) {
|
||||
$width = array( 'vc_col-sm-6', 'vc_col-sm-6' );
|
||||
} elseif ( 'column_23' === $width || '2/3' === $width ) {
|
||||
$width = array( 'vc_col-sm-8' );
|
||||
} elseif ( 'column_34' === $width || '3/4' === $width ) {
|
||||
$width = array( 'vc_col-sm-9' );
|
||||
} elseif ( 'column_16' === $width || '1/6' === $width ) {
|
||||
$width = array( 'vc_col-sm-2' );
|
||||
} else {
|
||||
$width = array( '' );
|
||||
}
|
||||
$sortable = ( vc_user_access_check_shortcode_all( $this->shortcode ) ? 'wpb_sortable' : $this->nonDraggableClass );
|
||||
|
||||
for ( $i = 0; $i < count( $width ); $i ++ ) {
|
||||
$output .= '<div class="group ' . $sortable . '">';
|
||||
$output .= '<h3><span class="tab-label"><%= params.title %></span></h3>';
|
||||
$output .= '<div ' . $this->mainHtmlBlockParams( $width, $i ) . '>';
|
||||
$output .= str_replace( '%column_size%', wpb_translateColumnWidthToFractional( $width[ $i ] ), $column_controls );
|
||||
$output .= '<div class="wpb_element_wrapper">';
|
||||
$output .= '<div ' . $this->containerHtmlBlockParams( $width, $i ) . '>';
|
||||
$output .= do_shortcode( shortcode_unautop( $content ) );
|
||||
$output .= '</div>';
|
||||
if ( isset( $this->settings['params'] ) ) {
|
||||
$inner = '';
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
$param_value = isset( ${$param['param_name']} ) ? ${$param['param_name']} : '';
|
||||
if ( is_array( $param_value ) ) {
|
||||
// Get first element from the array
|
||||
reset( $param_value );
|
||||
$first_key = key( $param_value );
|
||||
$param_value = $param_value[ $first_key ];
|
||||
}
|
||||
$inner .= $this->singleParamHtmlHolder( $param, $param_value );
|
||||
}
|
||||
$output .= $inner;
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= str_replace( '%column_size%', wpb_translateColumnWidthToFractional( $width[ $i ] ), $column_controls_bottom );
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function mainHtmlBlockParams( $width, $i ) {
|
||||
return 'data-element_type="' . $this->settings['base'] . '" class=" wpb_' . $this->settings['base'] . '"' . $this->customAdminBlockParams();
|
||||
}
|
||||
|
||||
public function containerHtmlBlockParams( $width, $i ) {
|
||||
return 'class="wpb_column_container vc_container_for_children"';
|
||||
}
|
||||
|
||||
public function contentAdmin_old( $atts, $content = null ) {
|
||||
$width = $el_class = $title = '';
|
||||
extract( shortcode_atts( $this->predefined_atts, $atts ) );
|
||||
$output = '';
|
||||
$column_controls = $this->getColumnControls( $this->settings( 'controls' ) );
|
||||
for ( $i = 0; $i < count( $width ); $i ++ ) {
|
||||
$output .= '<div class="group wpb_sortable">';
|
||||
$output .= '<div class="wpb_element_wrapper">';
|
||||
$output .= '<div class="vc_row-fluid wpb_row_container">';
|
||||
$output .= '<h3><a href="#">' . $title . '</a></h3>';
|
||||
$output .= '<div data-element_type="' . $this->settings['base'] . '" class=" wpb_' . $this->settings['base'] . ' wpb_sortable">';
|
||||
$output .= '<div class="wpb_element_wrapper">';
|
||||
$output .= '<div class="vc_row-fluid wpb_row_container">';
|
||||
$output .= do_shortcode( shortcode_unautop( $content ) );
|
||||
$output .= '</div>';
|
||||
if ( isset( $this->settings['params'] ) ) {
|
||||
$inner = '';
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
$param_value = isset( ${$param['param_name']} ) ? ${$param['param_name']} : '';
|
||||
if ( is_array( $param_value ) ) {
|
||||
// Get first element from the array
|
||||
reset( $param_value );
|
||||
$first_key = key( $param_value );
|
||||
$param_value = $param_value[ $first_key ];
|
||||
}
|
||||
$inner .= $this->singleParamHtmlHolder( $param, $param_value );
|
||||
}
|
||||
$output .= $inner;
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
protected function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function customAdminBlockParams() {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Accordion extends WPBakeryShortCode {
|
||||
protected $controls_css_settings = 'out-tc vc_controls-content-widget';
|
||||
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
}
|
||||
|
||||
public function contentAdmin( $atts, $content = null ) {
|
||||
$width = $custom_markup = '';
|
||||
$shortcode_attributes = array( 'width' => '1/1' );
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
if ( 'content' !== $param['param_name'] ) {
|
||||
$shortcode_attributes[ $param['param_name'] ] = isset( $param['value'] ) ? $param['value'] : null;
|
||||
} elseif ( 'content' === $param['param_name'] && null === $content ) {
|
||||
$content = $param['value'];
|
||||
}
|
||||
}
|
||||
extract( shortcode_atts( $shortcode_attributes, $atts ) );
|
||||
|
||||
$elem = $this->getElementHolder( $width );
|
||||
|
||||
$inner = '';
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
$param_value = isset( ${$param['param_name']} ) ? ${$param['param_name']} : '';
|
||||
if ( is_array( $param_value ) ) {
|
||||
// Get first element from the array
|
||||
reset( $param_value );
|
||||
$first_key = key( $param_value );
|
||||
$param_value = $param_value[ $first_key ];
|
||||
}
|
||||
$inner .= $this->singleParamHtmlHolder( $param, $param_value );
|
||||
}
|
||||
|
||||
$tmp = '';
|
||||
|
||||
if ( isset( $this->settings['custom_markup'] ) && '' !== $this->settings['custom_markup'] ) {
|
||||
if ( '' !== $content ) {
|
||||
$custom_markup = str_ireplace( '%content%', $tmp . $content, $this->settings['custom_markup'] );
|
||||
} elseif ( '' === $content && isset( $this->settings['default_content_in_template'] ) && '' !== $this->settings['default_content_in_template'] ) {
|
||||
$custom_markup = str_ireplace( '%content%', $this->settings['default_content_in_template'], $this->settings['custom_markup'] );
|
||||
} else {
|
||||
$custom_markup = str_ireplace( '%content%', '', $this->settings['custom_markup'] );
|
||||
}
|
||||
$inner .= do_shortcode( $custom_markup );
|
||||
}
|
||||
$output = str_ireplace( '%wpb_element_content%', $inner, $elem );
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,598 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'paginator/class-vc-pageable.php' );
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-btn.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Basic_Grid extends WPBakeryShortCode_Vc_Pageable {
|
||||
public $pagable_type = 'grid';
|
||||
public $items = array();
|
||||
public static $excluded_ids = array();
|
||||
protected $element_template = '';
|
||||
protected static $default_max_items = 1000;
|
||||
public $post_id = false;
|
||||
/** @var \Vc_Grid_Item $grid_item */
|
||||
public $grid_item = false;
|
||||
protected $filter_terms;
|
||||
public $attributes_defaults = array(
|
||||
'initial_loading_animation' => 'zoomIn',
|
||||
'full_width' => '',
|
||||
'layout' => '',
|
||||
'element_width' => '4',
|
||||
'items_per_page' => '5',
|
||||
'gap' => '',
|
||||
'style' => 'all',
|
||||
'show_filter' => '',
|
||||
'filter_default_title' => 'all',
|
||||
'exclude_filter' => '',
|
||||
'filter_style' => '',
|
||||
'filter_size' => 'md',
|
||||
'filter_align' => '',
|
||||
'filter_color' => '',
|
||||
'arrows_design' => '',
|
||||
'arrows_position' => '',
|
||||
'arrows_color' => '',
|
||||
'paging_design' => '',
|
||||
'paging_color' => '',
|
||||
'paging_animation_in' => '',
|
||||
'paging_animation_out' => '',
|
||||
'loop' => '',
|
||||
'autoplay' => '',
|
||||
'post_type' => 'post',
|
||||
'filter_source' => 'category',
|
||||
'orderby' => '',
|
||||
'order' => 'DESC',
|
||||
'meta_key' => '',
|
||||
'max_items' => '10',
|
||||
'offset' => '0',
|
||||
'taxonomies' => '',
|
||||
'custom_query' => '',
|
||||
'data_type' => 'query',
|
||||
'include' => '',
|
||||
'exclude' => '',
|
||||
'item' => 'none',
|
||||
'grid_id' => '',
|
||||
// disabled, needed for-BC:
|
||||
'button_style' => '',
|
||||
'button_color' => '',
|
||||
'button_size' => '',
|
||||
// New button3:
|
||||
'btn_title' => '',
|
||||
'btn_style' => 'modern',
|
||||
'btn_el_id' => '',
|
||||
'btn_custom_background' => '#ededed',
|
||||
'btn_custom_text' => '#666',
|
||||
'btn_outline_custom_color' => '#666',
|
||||
'btn_outline_custom_hover_background' => '#666',
|
||||
'btn_outline_custom_hover_text' => '#fff',
|
||||
'btn_shape' => 'rounded',
|
||||
'btn_color' => 'blue',
|
||||
'btn_size' => 'md',
|
||||
'btn_align' => 'inline',
|
||||
'btn_button_block' => '',
|
||||
'btn_add_icon' => '',
|
||||
'btn_i_align' => 'left',
|
||||
'btn_i_type' => 'fontawesome',
|
||||
'btn_i_icon_fontawesome' => 'fa fa-adjust',
|
||||
'btn_i_icon_openiconic' => 'vc-oi vc-oi-dial',
|
||||
'btn_i_icon_typicons' => 'typcn typcn-adjust-brightness',
|
||||
'btn_i_icon_entypo' => 'entypo-icon entypo-icon-note',
|
||||
'btn_i_icon_linecons' => 'vc_li vc_li-heart',
|
||||
'btn_i_icon_pixelicons' => 'vc_pixel_icon vc_pixel_icon-alert',
|
||||
'btn_custom_onclick' => '',
|
||||
'btn_custom_onclick_code' => '',
|
||||
// fix template
|
||||
'page_id' => '',
|
||||
);
|
||||
protected $grid_settings = array();
|
||||
protected $grid_id_unique_name = 'vc_gid'; // if you change this also change in hook-vc-grid.php
|
||||
|
||||
/**
|
||||
* @var \WP_Query
|
||||
*/
|
||||
protected $query;
|
||||
|
||||
function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->attributes_defaults['btn_title'] = __( 'Load more', 'js_composer' );
|
||||
$this->shortcodeScripts();
|
||||
}
|
||||
|
||||
public function shortcodeScripts() {
|
||||
parent::shortcodeScripts();
|
||||
|
||||
wp_register_script( 'vc_grid-js-imagesloaded', vc_asset_url( 'lib/bower/imagesloaded/imagesloaded.pkgd.min.js' ) );
|
||||
wp_register_script( 'vc_grid', vc_asset_url( 'js/dist/vc_grid.min.js' ), array(
|
||||
'jquery',
|
||||
'underscore',
|
||||
'vc_pageable_owl-carousel',
|
||||
'waypoints',
|
||||
//'isotope',
|
||||
'vc_grid-js-imagesloaded',
|
||||
), WPB_VC_VERSION, true );
|
||||
}
|
||||
|
||||
public function enqueueScripts() {
|
||||
parent::enqueueScripts();
|
||||
wp_enqueue_script( 'vc_grid-js-imagesloaded' );
|
||||
wp_enqueue_script( 'vc_grid' );
|
||||
}
|
||||
|
||||
public static function addExcludedId( $id ) {
|
||||
self::$excluded_ids[] = $id;
|
||||
}
|
||||
|
||||
public static function excludedIds() {
|
||||
return self::$excluded_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get shortcode hash by it content and attributes
|
||||
*
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @deprecated 4.4.3
|
||||
* @return string
|
||||
*/
|
||||
public function getHash( $atts, $content ) {
|
||||
if ( vc_is_page_editable() || is_preview() ) {
|
||||
_deprecated_function( 'WPBakeryShortCode_VC_Basic_Grid::getHash', '4.4.3 (will be removed in 4.10)', 'getId resave your grid' );
|
||||
|
||||
/* We are in Frontend editor
|
||||
* We need to send RAW shortcode data, so hash is just json_encode of atts and content
|
||||
*/
|
||||
|
||||
return urlencode( json_encode( array(
|
||||
'tag' => $this->shortcode,
|
||||
'atts' => $atts,
|
||||
'content' => $content,
|
||||
) ) );
|
||||
}
|
||||
|
||||
/** Else
|
||||
* We are in preview mode (viewing page).
|
||||
* So hash is shortcode atts and content hash
|
||||
*/
|
||||
|
||||
return sha1( serialize( array(
|
||||
'tag' => $this->shortcode,
|
||||
'atts' => $atts,
|
||||
'content' => $content,
|
||||
) ) );
|
||||
|
||||
}
|
||||
|
||||
public function getId( $atts, $content ) {
|
||||
if ( vc_is_page_editable() || is_preview() ) {
|
||||
/* We are in Frontend editor
|
||||
* We need to send RAW shortcode data, so hash is just json_encode of atts and content
|
||||
*/
|
||||
return urlencode( json_encode( array(
|
||||
'tag' => $this->shortcode,
|
||||
'atts' => $atts,
|
||||
'content' => $content,
|
||||
) ) );
|
||||
}
|
||||
|
||||
$id_pattern = '/' . $this->grid_id_unique_name . '\:([\w\-_]+)/';
|
||||
|
||||
$id_value = isset( $atts['grid_id'] ) ? $atts['grid_id'] : '';
|
||||
|
||||
preg_match( $id_pattern, $id_value, $id_matches );
|
||||
$id_to_save = json_encode( array( 'failed_to_get_id' => esc_attr( $id_value ) ) );
|
||||
|
||||
if ( ! empty( $id_matches ) ) {
|
||||
$id_to_save = $id_matches[1];
|
||||
}
|
||||
|
||||
return $id_to_save;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search in post meta vc_post_settings value
|
||||
* For shortcode data by hash
|
||||
*
|
||||
* @param $page_id
|
||||
* @param $hash
|
||||
*
|
||||
* @deprecated 4.4.3
|
||||
* @return bool|array
|
||||
*/
|
||||
public function findPostShortcodeByHash( $page_id, $hash ) {
|
||||
_deprecated_function( 'WPBakeryShortCode_VC_Basic_Grid::findPostShortcodeByHash', '4.4.3 (will be removed in 5.3)', 'findPostShortcodeById resave your grid to renew' );
|
||||
|
||||
if ( $hash ) {
|
||||
if ( $this->currentUserCanManage( $page_id ) && preg_match( '/\"tag\"\:/', urldecode( $hash ) ) ) {
|
||||
return json_decode( urldecode( $hash ), true ); // if frontend, no hash exists - just RAW data
|
||||
}
|
||||
$post_meta = get_post_meta( (int) $page_id, '_vc_post_settings' );
|
||||
if ( is_array( $post_meta ) ) {
|
||||
foreach ( $post_meta as $meta ) {
|
||||
if ( isset( $meta['vc_grid'] ) && ! empty( $meta['vc_grid']['shortcodes'] ) && isset( $meta['vc_grid']['shortcodes'][ $hash ] ) ) {
|
||||
return $meta['vc_grid']['shortcodes'][ $hash ];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function findPostShortcodeById( $page_id, $grid_id ) {
|
||||
if ( $this->currentUserCanManage( $page_id ) && preg_match( '/\"tag\"\:/', urldecode( $grid_id ) ) ) {
|
||||
return json_decode( urldecode( $grid_id ), true ); // if frontend, no hash exists - just RAW data
|
||||
}
|
||||
$post_meta = get_post_meta( (int) $page_id, '_vc_post_settings' );
|
||||
$shortcode = false;
|
||||
if ( is_array( $post_meta ) ) {
|
||||
foreach ( $post_meta as $meta ) {
|
||||
if ( isset( $meta['vc_grid_id'] ) && ! empty( $meta['vc_grid_id']['shortcodes'] ) && isset( $meta['vc_grid_id']['shortcodes'][ $grid_id ] ) ) {
|
||||
$shortcode = $meta['vc_grid_id']['shortcodes'][ $grid_id ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'vc_basic_grid_find_post_shortcode', $shortcode, $page_id, $grid_id );
|
||||
}
|
||||
|
||||
public function renderItems() {
|
||||
$output = $items = '';
|
||||
$this->buildGridSettings();
|
||||
$atts = $this->atts;
|
||||
$settings = $this->grid_settings;
|
||||
$filter_terms = $this->filter_terms;
|
||||
$is_end = isset( $this->is_end ) && $this->is_end;
|
||||
$css_classes = 'vc_grid vc_row' . esc_attr( $atts['gap'] > 0 ? ' vc_grid-gutter-' . (int) $atts['gap'] . 'px' : '' );
|
||||
$currentScope = WPBMap::getScope();
|
||||
if ( is_array( $this->items ) && ! empty( $this->items ) ) {
|
||||
// Adding before vc_map
|
||||
WPBMap::setScope( Vc_Grid_Item_Editor::postType() );
|
||||
require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' );
|
||||
$this->grid_item = new Vc_Grid_Item();
|
||||
$this->grid_item->setGridAttributes( $atts );
|
||||
$this->grid_item->setIsEnd( $is_end );
|
||||
$this->grid_item->setTemplateById( $atts['item'] );
|
||||
$output .= $this->grid_item->addShortcodesCustomCss();
|
||||
ob_start();
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
||||
wp_print_styles();
|
||||
}
|
||||
$output .= ob_get_clean();
|
||||
$attributes = array(
|
||||
'filter_terms' => $filter_terms,
|
||||
'atts' => $atts,
|
||||
'grid_item',
|
||||
$this->grid_item,
|
||||
);
|
||||
$output .= apply_filters( 'vc_basic_grid_template_filter', vc_get_template( 'shortcodes/vc_basic_grid_filter.php', $attributes ), $attributes );
|
||||
global $post;
|
||||
foreach ( $this->items as $postItem ) {
|
||||
$this->query->setup_postdata( $postItem );
|
||||
$post = $postItem;
|
||||
$items .= $this->grid_item->renderItem( $postItem );
|
||||
}
|
||||
wp_reset_postdata();
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
$items = apply_filters( $this->shortcode . '_items_list', $items );
|
||||
$output .= $this->renderPagination( $atts['style'], $settings, $items, $css_classes );
|
||||
WPBMap::setScope( $currentScope );
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function setContentLimits() {
|
||||
$atts = $this->atts;
|
||||
if ( 'ids' === $this->atts['post_type'] ) {
|
||||
$this->atts['max_items'] = 0;
|
||||
$this->atts['offset'] = 0;
|
||||
$this->atts['items_per_page'] = apply_filters( 'vc_basic_grid_max_items', self::$default_max_items );
|
||||
} else {
|
||||
$this->atts['offset'] = $offset = isset( $atts['offset'] ) ? (int) $atts['offset'] : $this->attributes_defaults['offset'];
|
||||
$this->atts['max_items'] = isset( $atts['max_items'] ) ? (int) $atts['max_items'] : (int) $this->attributes_defaults['max_items'];
|
||||
$this->atts['items_per_page'] = ! isset( $atts['items_per_page'] ) ? (int) $this->attributes_defaults['items_per_page'] : (int) $atts['items_per_page'];
|
||||
if ( $this->atts['max_items'] < 1 ) {
|
||||
$this->atts['max_items'] = apply_filters( 'vc_basic_grid_max_items', self::$default_max_items );
|
||||
}
|
||||
}
|
||||
$this->setPagingAll( $this->atts['max_items'] );
|
||||
}
|
||||
|
||||
protected function setPagingAll( $max_items ) {
|
||||
$atts = $this->atts;
|
||||
$this->atts['items_per_page'] = $this->atts['query_items_per_page'] = $max_items > 0 ? $max_items : apply_filters( 'vc_basic_grid_items_per_page_all_max_items', self::$default_max_items );
|
||||
$this->atts['query_offset'] = isset( $atts['offset'] ) ? (int) $atts['offset'] : $this->attributes_defaults['offset'];
|
||||
}
|
||||
|
||||
public function renderAjax( $vc_request_param ) {
|
||||
$this->items = array(); // clear this items array (if used more than once);
|
||||
$id = isset( $vc_request_param['shortcode_id'] ) ? $vc_request_param['shortcode_id'] : false;
|
||||
if ( ! isset( $vc_request_param['page_id'] ) ) {
|
||||
return json_encode( array( 'status' => 'Nothing found' ) );
|
||||
}
|
||||
if ( $id ) {
|
||||
$shortcode = $this->findPostShortcodeById( $vc_request_param['page_id'], $id );
|
||||
} else {
|
||||
/**
|
||||
* @deprecated since 4.4.3 due to invalid logic in hash algorithm
|
||||
*/
|
||||
$hash = isset( $vc_request_param['shortcode_hash'] ) ? $vc_request_param['shortcode_hash'] : false;
|
||||
$shortcode = $this->findPostShortcodeByHash( $vc_request_param['page_id'], $hash );
|
||||
}
|
||||
if ( ! is_array( $shortcode ) ) {
|
||||
return json_encode( array( 'status' => 'Nothing found' ) );
|
||||
}
|
||||
visual_composer()->registerAdminCss();
|
||||
visual_composer()->registerAdminJavascript();
|
||||
// Set post id
|
||||
$this->post_id = (int) $vc_request_param['page_id'];
|
||||
|
||||
$shortcode_atts = $shortcode['atts'];
|
||||
$this->shortcode_content = $shortcode['content'];
|
||||
$this->buildAtts( $shortcode_atts, $shortcode['content'] );
|
||||
|
||||
$this->buildItems();
|
||||
|
||||
return $this->renderItems();
|
||||
}
|
||||
|
||||
public function postID() {
|
||||
if ( false == $this->post_id ) {
|
||||
$this->post_id = get_the_ID();
|
||||
}
|
||||
|
||||
return $this->post_id;
|
||||
}
|
||||
|
||||
public function buildAtts( $atts, $content ) {
|
||||
$this->post_id = false;
|
||||
$this->grid_settings = array();
|
||||
$this->filter_terms = null;
|
||||
$this->items = array();
|
||||
$arr_keys = array_keys( $atts );
|
||||
for ( $i = 0; $i < count( $atts ); $i ++ ) {
|
||||
$atts[ $arr_keys[ $i ] ] = html_entity_decode( $atts[ $arr_keys[ $i ] ], ENT_QUOTES, 'utf-8' );
|
||||
}
|
||||
if ( isset( $atts['grid_id'] ) && ! empty( $atts['grid_id'] ) ) {
|
||||
$id_to_save = $this->getId( $atts, $content );
|
||||
} else {
|
||||
$hash = $this->getHash( $atts, $content );
|
||||
}
|
||||
|
||||
$atts = $this->convertButton2ToButton3( $atts );
|
||||
$atts = shortcode_atts( $this->attributes_defaults, vc_map_get_attributes( $this->getShortcode(), $atts ) );
|
||||
$this->atts = $atts;
|
||||
if ( isset( $id_to_save ) ) {
|
||||
$this->atts['shortcode_id'] = $id_to_save;
|
||||
} else if ( isset( $hash ) ) {
|
||||
$this->atts['shortcode_hash'] = $hash;
|
||||
}
|
||||
$this->atts['page_id'] = $this->postID();
|
||||
|
||||
$this->element_template = $content;
|
||||
// @since 4.4.3
|
||||
if ( 'custom' === $this->attr( 'post_type' ) ) {
|
||||
$this->atts['style'] = 'all';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter attribute.
|
||||
*
|
||||
* @param $key
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function attr( $key ) {
|
||||
return isset( $this->atts[ $key ] ) ? $this->atts[ $key ] : null;
|
||||
}
|
||||
|
||||
public function buildGridSettings() {
|
||||
$this->grid_settings = array(
|
||||
'page_id' => $this->atts['page_id'],
|
||||
// used in basic grid for initialization
|
||||
'style' => $this->atts['style'],
|
||||
'action' => 'vc_get_vc_grid_data',
|
||||
);
|
||||
// used in ajax request for items
|
||||
if ( isset( $this->atts['shortcode_id'] ) && ! empty( $this->atts['shortcode_id'] ) ) {
|
||||
$this->grid_settings['shortcode_id'] = $this->atts['shortcode_id'];
|
||||
} elseif ( isset( $this->atts['shortcode_hash'] ) && ! empty( $this->atts['shortcode_hash'] ) ) {
|
||||
// @deprecated since 4.4.3
|
||||
$this->grid_settings['shortcode_hash'] = $this->atts['shortcode_hash'];
|
||||
}
|
||||
if ( 'load-more' === $this->atts['style'] ) {
|
||||
$this->grid_settings = array_merge( $this->grid_settings, array(
|
||||
// used in dispaly style load more button, lazy, pagination
|
||||
'items_per_page' => $this->atts['items_per_page'],
|
||||
'btn_data' => vc_map_integrate_parse_atts( $this->shortcode, 'vc_btn', $this->atts, 'btn' . '_' ),
|
||||
) );
|
||||
} elseif ( 'lazy' === $this->atts['style'] ) {
|
||||
$this->grid_settings = array_merge( $this->grid_settings, array(
|
||||
'items_per_page' => $this->atts['items_per_page'],
|
||||
) );
|
||||
} elseif ( 'pagination' === $this->atts['style'] ) {
|
||||
$this->grid_settings = array_merge( $this->grid_settings, array(
|
||||
'items_per_page' => $this->atts['items_per_page'],
|
||||
// used in pagination style
|
||||
'auto_play' => $this->atts['autoplay'] > 0 ? true : false,
|
||||
'gap' => (int) $this->atts['gap'],
|
||||
// not used yet, but can be used in isotope..
|
||||
'speed' => (int) $this->atts['autoplay'] * 1000,
|
||||
'loop' => $this->atts['loop'],
|
||||
'animation_in' => $this->atts['paging_animation_in'],
|
||||
'animation_out' => $this->atts['paging_animation_out'],
|
||||
'arrows_design' => $this->atts['arrows_design'],
|
||||
'arrows_color' => $this->atts['arrows_color'],
|
||||
'arrows_position' => $this->atts['arrows_position'],
|
||||
'paging_design' => $this->atts['paging_design'],
|
||||
'paging_color' => $this->atts['paging_color'],
|
||||
) );
|
||||
}
|
||||
$this->grid_settings['tag'] = $this->shortcode;
|
||||
}
|
||||
|
||||
// TODO: setter & getter to attributes
|
||||
public function buildQuery( $atts ) {
|
||||
// Set include & exclude
|
||||
if ( 'ids' !== $atts['post_type'] && ! empty( $atts['exclude'] ) ) {
|
||||
$atts['exclude'] .= ',' . implode( ',', $this->excludedIds() );
|
||||
} else {
|
||||
$atts['exclude'] = implode( ',', $this->excludedIds() );
|
||||
}
|
||||
if ( 'ids' !== $atts['post_type'] ) {
|
||||
$settings = array(
|
||||
'posts_per_page' => $atts['query_items_per_page'],
|
||||
'offset' => $atts['query_offset'],
|
||||
'orderby' => $atts['orderby'],
|
||||
'order' => $atts['order'],
|
||||
'meta_key' => in_array( $atts['orderby'], array(
|
||||
'meta_value',
|
||||
'meta_value_num',
|
||||
) ) ? $atts['meta_key'] : '',
|
||||
'post_type' => $atts['post_type'],
|
||||
'exclude' => $atts['exclude'],
|
||||
);
|
||||
if ( ! empty( $atts['taxonomies'] ) ) {
|
||||
$vc_taxonomies_types = get_taxonomies( array( 'public' => true ) );
|
||||
$terms = get_terms( array_keys( $vc_taxonomies_types ), array(
|
||||
'hide_empty' => false,
|
||||
'include' => $atts['taxonomies'],
|
||||
) );
|
||||
$settings['tax_query'] = array();
|
||||
$tax_queries = array(); // List of taxnonimes
|
||||
foreach ( $terms as $t ) {
|
||||
if ( ! isset( $tax_queries[ $t->taxonomy ] ) ) {
|
||||
$tax_queries[ $t->taxonomy ] = array(
|
||||
'taxonomy' => $t->taxonomy,
|
||||
'field' => 'id',
|
||||
'terms' => array( $t->term_id ),
|
||||
'relation' => 'IN',
|
||||
);
|
||||
} else {
|
||||
$tax_queries[ $t->taxonomy ]['terms'][] = $t->term_id;
|
||||
}
|
||||
}
|
||||
$settings['tax_query'] = array_values( $tax_queries );
|
||||
$settings['tax_query']['relation'] = 'OR';
|
||||
}
|
||||
} else {
|
||||
if ( empty( $atts['include'] ) ) {
|
||||
$atts['include'] = - 1;
|
||||
} elseif ( ! empty( $atts['exclude'] ) ) {
|
||||
$include = array_map( 'trim', explode( ',', $atts['include'] ) );
|
||||
$exclude = array_map( 'trim', explode( ',', $atts['exclude'] ) );
|
||||
$diff = array_diff( $include, $exclude );
|
||||
$atts['include'] = implode( ', ', $diff );
|
||||
}
|
||||
$settings = array(
|
||||
'include' => $atts['include'],
|
||||
'posts_per_page' => $atts['query_items_per_page'],
|
||||
'offset' => $atts['query_offset'],
|
||||
'post_type' => 'any',
|
||||
'orderby' => 'post__in',
|
||||
);
|
||||
$this->atts['items_per_page'] = - 1;
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
public function buildItems() {
|
||||
$this->filter_terms = $this->items = array();
|
||||
|
||||
$this->query = new WP_Query();
|
||||
|
||||
$this->setContentLimits();
|
||||
|
||||
$this->addExcludedId( $this->postID() );
|
||||
if ( 'custom' === $this->atts['post_type'] && ! empty( $this->atts['custom_query'] ) ) {
|
||||
$query = html_entity_decode( vc_value_from_safe( $this->atts['custom_query'] ), ENT_QUOTES, 'utf-8' );
|
||||
$query = apply_filters( 'vc_basic_grid_filter_query_filters', $query, $this->atts, $this->shortcode );
|
||||
$post_data = $this->query->query( $query );
|
||||
$this->atts['items_per_page'] = - 1;
|
||||
} elseif ( false !== $this->atts['query_items_per_page'] ) {
|
||||
$settings = $this->filterQuerySettings( $this->buildQuery( $this->atts ) );
|
||||
$post_data = $this->query->query( $settings );
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if ( $this->atts['items_per_page'] > 0 && count( $post_data ) > $this->atts['items_per_page'] ) {
|
||||
$post_data = array_slice( $post_data, 0, $this->atts['items_per_page'] );
|
||||
}
|
||||
foreach ( $post_data as $post ) {
|
||||
$post->filter_terms = wp_get_object_terms( $post->ID, $this->atts['filter_source'], array( 'fields' => 'ids' ) );
|
||||
$this->filter_terms = wp_parse_args( $this->filter_terms, $post->filter_terms );
|
||||
$this->items[] = $post;
|
||||
}
|
||||
}
|
||||
|
||||
public function filterQuerySettings( $args ) {
|
||||
$defaults = array(
|
||||
'numberposts' => 5,
|
||||
'offset' => 0,
|
||||
'category' => 0,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'include' => array(),
|
||||
'exclude' => array(),
|
||||
'meta_key' => '',
|
||||
'meta_value' => '',
|
||||
'post_type' => 'post',
|
||||
'suppress_filters' => apply_filters( 'vc_basic_grid_filter_query_suppress_filters', true ),
|
||||
'public' => true,
|
||||
);
|
||||
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
if ( empty( $r['post_status'] ) ) {
|
||||
$r['post_status'] = ( 'attachment' === $r['post_type'] ) ? 'inherit' : 'publish';
|
||||
}
|
||||
if ( ! empty( $r['numberposts'] ) && empty( $r['posts_per_page'] ) ) {
|
||||
$r['posts_per_page'] = $r['numberposts'];
|
||||
}
|
||||
if ( ! empty( $r['category'] ) ) {
|
||||
$r['cat'] = $r['category'];
|
||||
}
|
||||
if ( ! empty( $r['include'] ) ) {
|
||||
$incposts = wp_parse_id_list( $r['include'] );
|
||||
$r['posts_per_page'] = count( $incposts ); // only the number of posts included
|
||||
$r['post__in'] = $incposts;
|
||||
} elseif ( ! empty( $r['exclude'] ) ) {
|
||||
$r['post__not_in'] = wp_parse_id_list( $r['exclude'] );
|
||||
}
|
||||
|
||||
$r['ignore_sticky_posts'] = true;
|
||||
$r['no_found_rows'] = true;
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
public static function convertButton2ToButton3( $atts ) {
|
||||
if ( isset( $atts['button_style'] ) || isset( $atts['button_size'] ) || isset( $atts['button_color'] ) ) {
|
||||
// we use old button 2 attributes:
|
||||
$style = isset( $atts['button_style'] ) ? $atts['button_style'] : 'rounded';
|
||||
$size = isset( $atts['button_size'] ) ? $atts['button_size'] : 'md';
|
||||
$color = isset( $atts['button_color'] ) ? $atts['button_color'] : 'blue';
|
||||
$oldData = array(
|
||||
'style' => $style,
|
||||
'size' => $size,
|
||||
'color' => str_replace( '_', '-', $color ),
|
||||
);
|
||||
// remove attributes on save
|
||||
$atts['button_style'] = '';
|
||||
$atts['button_size'] = '';
|
||||
$atts['button_color'] = '';
|
||||
$newData = WPBakeryShortCode_VC_Btn::convertAttributesToButton3( $oldData );
|
||||
foreach ( $newData as $key => $value ) {
|
||||
$atts[ 'btn_' . $key ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class WPBakeryShortCode_VC_Btn
|
||||
* @since 4.5
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Btn extends WPBakeryShortCode {
|
||||
|
||||
public static function convertAttributesToButton3( $atts ) {
|
||||
//size btn1 to size btn2
|
||||
$btn1_sizes = array( 'wpb_regularsize', 'btn-large', 'btn-small', 'btn-mini' );
|
||||
if ( isset( $atts['size'] ) && in_array( $atts['size'], $btn1_sizes ) ) {
|
||||
$atts['size'] = str_replace( $btn1_sizes, array( 'md', 'lg', 'sm', 'xs' ), $atts['size'] );
|
||||
}
|
||||
|
||||
// Convert Btn1 href+target attributes to Btn2 `link` attribute
|
||||
if ( ! isset( $atts['link'] ) && isset( $atts['href'] ) && strlen( $atts['href'] ) > 0 ) {
|
||||
$link = $atts['href'];
|
||||
$target = isset( $atts['target'] ) ? $atts['target'] : ''; // if empty => same as `_self`
|
||||
$title = isset( $atts['title'] ) ? $atts['title'] : $link;
|
||||
$atts['link'] = 'url:' . rawurlencode( $link ) . '|title:' . $title . ( strlen( $target ) > 0 ? '|target:' . rawurlencode( $target ) : '' );
|
||||
}
|
||||
/*
|
||||
__( 'Classic Grey', 'js_composer' ) => 'wpb_button',
|
||||
__( 'Classic Blue', 'js_composer' ) => 'btn-primary',
|
||||
__( 'Classic Turquoise', 'js_composer' ) => 'btn-info',
|
||||
__( 'Classic Green', 'js_composer' ) => 'btn-success',
|
||||
__( 'Classic Orange', 'js_composer' ) => 'btn-warning',
|
||||
__( 'Classic Red', 'js_composer' ) => 'btn-danger',
|
||||
__( 'Classic Black', 'js_composer' ) => "btn-inverse"
|
||||
*/
|
||||
|
||||
if ( ( ! isset( $atts['add_icon'] ) || 'true' != $atts['add_icon'] ) && isset( $atts['icon'] ) && strlen( $atts['icon'] ) > 0 && 'none' != $atts['icon'] ) {
|
||||
// old icon from btn1 is set, let's convert it to new btn
|
||||
$atts['add_icon'] = 'true';
|
||||
$atts['icon_type'] = 'pixelicons';
|
||||
$atts['icon_align'] = 'right';
|
||||
$atts['icon_pixelicons'] = 'vc_pixel_icon vc_pixel_icon-' . str_replace( 'wpb_', '', $atts['icon'] );
|
||||
}
|
||||
if ( isset( $atts['style'] ) && in_array( $atts['style'], array(
|
||||
'rounded',
|
||||
'square',
|
||||
'round',
|
||||
'outlined',
|
||||
'square_outlined',
|
||||
) )
|
||||
) {
|
||||
switch ( $atts['style'] ) {
|
||||
case 'rounded':
|
||||
$atts['style'] = 'flat';
|
||||
$atts['shape'] = 'rounded';
|
||||
break;
|
||||
case 'square':
|
||||
$atts['style'] = 'flat';
|
||||
$atts['shape'] = 'square';
|
||||
break;
|
||||
case 'round':
|
||||
$atts['style'] = 'flat';
|
||||
$atts['shape'] = 'round';
|
||||
break;
|
||||
case 'outlined':
|
||||
$atts['style'] = 'outline';
|
||||
break;
|
||||
case 'square_outlined':
|
||||
$atts['style'] = 'outline';
|
||||
$atts['shape'] = 'square';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $title
|
||||
*
|
||||
* @since 4.5
|
||||
* @return string
|
||||
*/
|
||||
protected function outputTitle( $title ) {
|
||||
$icon = $this->settings( 'icon' );
|
||||
|
||||
return '<h4 class="wpb_element_title"><span class="vc_general vc_element-icon vc_btn3-icon' . ( ! empty( $icon ) ? ' ' . $icon : '' ) . '"></span></h4>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Button extends WPBakeryShortCode {
|
||||
protected function outputTitle( $title ) {
|
||||
$icon = $this->settings( 'icon' );
|
||||
|
||||
return '<h4 class="wpb_element_title"><span class="vc_general vc_element-icon' . ( ! empty( $icon ) ? ' ' . $icon : '' ) . '"></span></h4>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Button2 extends WPBakeryShortCode {
|
||||
protected function outputTitle( $title ) {
|
||||
$icon = $this->settings( 'icon' );
|
||||
|
||||
return '<h4 class="wpb_element_title"><span class="vc_general vc_element-icon' . ( ! empty( $icon ) ? ' ' . $icon : '' ) . '"></span></h4>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-posts-grid.php' );
|
||||
|
||||
class WPBakeryShortCode_Vc_Carousel extends WPBakeryShortCode_VC_Posts_Grid {
|
||||
protected static $carousel_index = 1;
|
||||
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->jsCssScripts();
|
||||
}
|
||||
|
||||
public function jsCssScripts() {
|
||||
wp_register_script( 'vc_transition_bootstrap_js', vc_asset_url( 'lib/vc_carousel/js/transition.min.js' ), array(), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'vc_carousel_js', vc_asset_url( 'lib/vc_carousel/js/vc_carousel.min.js' ), array( 'vc_transition_bootstrap_js' ), WPB_VC_VERSION, true );
|
||||
wp_register_style( 'vc_carousel_css', vc_asset_url( 'lib/vc_carousel/css/vc_carousel.min.css' ), array(), WPB_VC_VERSION );
|
||||
}
|
||||
|
||||
public static function getCarouselIndex() {
|
||||
return self::$carousel_index ++ . '-' . time();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-column.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Column_Inner extends WPBakeryShortCode_VC_Column {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Column_text extends WPBakeryShortCode {
|
||||
protected function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Column extends WPBakeryShortCode {
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $predefined_atts = array(
|
||||
'font_color' => '',
|
||||
'el_class' => '',
|
||||
'el_position' => '',
|
||||
'width' => '1/1',
|
||||
);
|
||||
|
||||
public $nonDraggableClass = 'vc-non-draggable-column';
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
*/
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->shortcodeScripts();
|
||||
}
|
||||
|
||||
protected function shortcodeScripts() {
|
||||
wp_register_script( 'vc_jquery_skrollr_js', vc_asset_url( 'lib/bower/skrollr/dist/skrollr.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'vc_youtube_iframe_api_js', 'https://www.youtube.com/iframe_api', array(), WPB_VC_VERSION, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $controls
|
||||
* @param string $extended_css
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColumnControls( $controls, $extended_css = '' ) {
|
||||
$output = '<div class="vc_controls vc_control-column vc_controls-visible' . ( ! empty( $extended_css ) ? " {$extended_css}" : '' ) . '">';
|
||||
$controls_end = '</div>';
|
||||
|
||||
if ( ' bottom-controls' === $extended_css ) {
|
||||
$control_title = __( 'Append to this column', 'js_composer' );
|
||||
} else {
|
||||
$control_title = __( 'Prepend to this column', 'js_composer' );
|
||||
}
|
||||
if ( vc_user_access()->part( 'shortcodes' )->checkStateAny( true, 'custom', null )->get() ) {
|
||||
$controls_add = '<a class="vc_control column_add vc_column-add" data-vc-control="add" href="#" title="' . $control_title . '"><i class="vc-composer-icon vc-c-icon-add"></i></a>';
|
||||
} else {
|
||||
$controls_add = '';
|
||||
}
|
||||
$controls_edit = '<a class="vc_control column_edit vc_column-edit" data-vc-control="edit" href="#" title="' . __( 'Edit this column', 'js_composer' ) . '"><i class="vc-composer-icon vc-c-icon-mode_edit"></i></a>';
|
||||
$controls_delete = '<a class="vc_control column_delete vc_column-delete" data-vc-control="delete" href="#" title="' . __( 'Delete this column', 'js_composer' ) . '"><i class="vc-composer-icon vc-c-icon-delete_empty"></i></a>';
|
||||
$editAccess = vc_user_access_check_shortcode_edit( $this->shortcode );
|
||||
$allAccess = vc_user_access_check_shortcode_all( $this->shortcode );
|
||||
if ( is_array( $controls ) && ! empty( $controls ) ) {
|
||||
foreach ( $controls as $control ) {
|
||||
if ( 'add' === $control || ( $editAccess && 'edit' === $control ) || $allAccess ) {
|
||||
$method_name = vc_camel_case( 'output-editor-control-' . $control );
|
||||
if ( method_exists( $this, $method_name ) ) {
|
||||
$output .= $this->$method_name();
|
||||
} else {
|
||||
$control_var = 'controls_' . $control;
|
||||
if ( isset( ${$control_var} ) ) {
|
||||
$output .= ${$control_var};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $output . $controls_end;
|
||||
} elseif ( is_string( $controls ) && 'full' === $controls ) {
|
||||
if ( $allAccess ) {
|
||||
return $output . $controls_add . $controls_edit . $controls_delete . $controls_end;
|
||||
} elseif ( $editAccess ) {
|
||||
return $output . $controls_add . $controls_edit . $controls_end;
|
||||
}
|
||||
|
||||
return $output . $controls_add . $controls_end;
|
||||
} elseif ( is_string( $controls ) ) {
|
||||
$control_var = 'controls_' . $controls;
|
||||
if ( 'add' === $controls || ( $editAccess && 'edit' == $controls || $allAccess ) && isset( ${$control_var} ) ) {
|
||||
return $output . ${$control_var} . $controls_end;
|
||||
}
|
||||
|
||||
return $output . $controls_end;
|
||||
}
|
||||
if ( $allAccess ) {
|
||||
return $output . $controls_add . $controls_edit . $controls_delete . $controls_end;
|
||||
} elseif ( $editAccess ) {
|
||||
return $output . $controls_add . $controls_edit . $controls_end;
|
||||
}
|
||||
|
||||
return $output . $controls_add . $controls_end;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $param
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function singleParamHtmlHolder( $param, $value ) {
|
||||
$output = '';
|
||||
// Compatibility fixes.
|
||||
$old_names = array(
|
||||
'yellow_message',
|
||||
'blue_message',
|
||||
'green_message',
|
||||
'button_green',
|
||||
'button_grey',
|
||||
'button_yellow',
|
||||
'button_blue',
|
||||
'button_red',
|
||||
'button_orange',
|
||||
);
|
||||
$new_names = array(
|
||||
'alert-block',
|
||||
'alert-info',
|
||||
'alert-success',
|
||||
'btn-success',
|
||||
'btn',
|
||||
'btn-info',
|
||||
'btn-primary',
|
||||
'btn-danger',
|
||||
'btn-warning',
|
||||
);
|
||||
$value = str_ireplace( $old_names, $new_names, $value );
|
||||
$param_name = isset( $param['param_name'] ) ? $param['param_name'] : '';
|
||||
$type = isset( $param['type'] ) ? $param['type'] : '';
|
||||
$class = isset( $param['class'] ) ? $param['class'] : '';
|
||||
|
||||
if ( isset( $param['holder'] ) && 'hidden' !== $param['holder'] ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param null $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function contentAdmin( $atts, $content = null ) {
|
||||
$width = $el_class = '';
|
||||
extract( shortcode_atts( $this->predefined_atts, $atts ) );
|
||||
$output = '';
|
||||
|
||||
$column_controls = $this->getColumnControls( $this->settings( 'controls' ) );
|
||||
$column_controls_bottom = $this->getColumnControls( 'add', 'bottom-controls' );
|
||||
|
||||
if ( ' column_14' === $width || ' 1/4' === $width ) {
|
||||
$width = array( 'vc_col-sm-3' );
|
||||
} elseif ( ' column_14===$width-14-14-14' ) {
|
||||
$width = array(
|
||||
'vc_col-sm-3',
|
||||
'vc_col-sm-3',
|
||||
'vc_col-sm-3',
|
||||
'vc_col-sm-3',
|
||||
);
|
||||
} elseif ( ' column_13' === $width || ' 1/3' === $width ) {
|
||||
$width = array( 'vc_col-sm-4' );
|
||||
} elseif ( ' column_13===$width-23' ) {
|
||||
$width = array(
|
||||
'vc_col-sm-4',
|
||||
'vc_col-sm-8',
|
||||
);
|
||||
} elseif ( ' column_13===$width-13-13' ) {
|
||||
$width = array(
|
||||
'vc_col-sm-4',
|
||||
'vc_col-sm-4',
|
||||
'vc_col-sm-4',
|
||||
);
|
||||
} elseif ( ' column_12' === $width || ' 1/2' === $width ) {
|
||||
$width = array( 'vc_col-sm-6' );
|
||||
} elseif ( ' column_12===$width-12' ) {
|
||||
$width = array(
|
||||
'vc_col-sm-6',
|
||||
'vc_col-sm-6',
|
||||
);
|
||||
} elseif ( ' column_23' === $width || ' 2/3' === $width ) {
|
||||
$width = array( 'vc_col-sm-8' );
|
||||
} elseif ( ' column_34' === $width || ' 3/4' === $width ) {
|
||||
$width = array( 'vc_col-sm-9' );
|
||||
} elseif ( ' column_16' === $width || ' 1/6' === $width ) {
|
||||
$width = array( 'vc_col-sm-2' );
|
||||
} elseif ( ' column_56' === $width || ' 5/6' === $width ) {
|
||||
$width = array( 'vc_col-sm-10' );
|
||||
} else {
|
||||
$width = array( '' );
|
||||
}
|
||||
for ( $i = 0; $i < count( $width ); $i ++ ) {
|
||||
$output .= '<div ' . $this->mainHtmlBlockParams( $width, $i ) . '>';
|
||||
$output .= str_replace( '%column_size%', wpb_translateColumnWidthToFractional( $width[ $i ] ), $column_controls );
|
||||
$output .= '<div class="wpb_element_wrapper">';
|
||||
$output .= '<div ' . $this->containerHtmlBlockParams( $width, $i ) . '>';
|
||||
$output .= do_shortcode( shortcode_unautop( $content ) );
|
||||
$output .= '</div>';
|
||||
if ( isset( $this->settings['params'] ) ) {
|
||||
$inner = '';
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
$param_value = isset( ${$param['param_name']} ) ? ${$param['param_name']} : '';
|
||||
if ( is_array( $param_value ) ) {
|
||||
// Get first element from the array
|
||||
reset( $param_value );
|
||||
$first_key = key( $param_value );
|
||||
$param_value = $param_value[ $first_key ];
|
||||
}
|
||||
$inner .= $this->singleParamHtmlHolder( $param, $param_value );
|
||||
}
|
||||
$output .= $inner;
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= str_replace( '%column_size%', wpb_translateColumnWidthToFractional( $width[ $i ] ), $column_controls_bottom );
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function customAdminBlockParams() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $width
|
||||
* @param $i
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function mainHtmlBlockParams( $width, $i ) {
|
||||
$sortable = ( vc_user_access_check_shortcode_all( $this->shortcode ) ? 'wpb_sortable' : $this->nonDraggableClass );
|
||||
|
||||
return 'data-element_type="' . $this->settings['base'] . '" data-vc-column-width="' . wpb_vc_get_column_width_indent( $width[ $i ] ) . '" class="wpb_' . $this->settings['base'] . ' ' . $sortable . '' . ( ! empty( $this->settings['class'] ) ? ' ' . $this->settings['class'] : '' ) . ' ' . $this->templateWidth() . ' wpb_content_holder"' . $this->customAdminBlockParams();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $width
|
||||
* @param $i
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function containerHtmlBlockParams( $width, $i ) {
|
||||
return 'class="wpb_column_container vc_container_for_children"';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function template( $content = '' ) {
|
||||
return $this->contentAdmin( $this->atts );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function templateWidth() {
|
||||
return '<%= window.vc_convert_column_size(params.width) %>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $font_color
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function buildStyle( $font_color = '' ) {
|
||||
$style = '';
|
||||
if ( ! empty( $font_color ) ) {
|
||||
$style .= vc_get_css_color( 'color', $font_color );
|
||||
}
|
||||
|
||||
return empty( $style ) ? $style : ' style="' . esc_attr( $style ) . '"';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Cta_button extends WPBakeryShortCode {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Cta_button2 extends WPBakeryShortCode {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
* @since 4.5
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 4.5
|
||||
* Class WPBakeryShortCode_VC_Cta
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Cta extends WPBakeryShortCode {
|
||||
protected $template_vars = array();
|
||||
|
||||
public function buildTemplate( $atts, $content ) {
|
||||
$output = array();
|
||||
$inline_css = array();
|
||||
|
||||
$main_wrapper_classes = array( 'vc_cta3' );
|
||||
$container_classes = array();
|
||||
if ( ! empty( $atts['el_class'] ) ) {
|
||||
$main_wrapper_classes[] = $atts['el_class'];
|
||||
}
|
||||
if ( ! empty( $atts['style'] ) ) {
|
||||
$main_wrapper_classes[] = 'vc_cta3-style-' . $atts['style'];
|
||||
}
|
||||
if ( ! empty( $atts['shape'] ) ) {
|
||||
$main_wrapper_classes[] = 'vc_cta3-shape-' . $atts['shape'];
|
||||
}
|
||||
if ( ! empty( $atts['txt_align'] ) ) {
|
||||
$main_wrapper_classes[] = 'vc_cta3-align-' . $atts['txt_align'];
|
||||
}
|
||||
if ( ! empty( $atts['color'] ) && ! ( isset( $atts['style'] ) && 'custom' === $atts['style'] ) ) {
|
||||
$main_wrapper_classes[] = 'vc_cta3-color-' . $atts['color'];
|
||||
}
|
||||
if ( isset( $atts['style'] ) && 'custom' === $atts['style'] ) {
|
||||
if ( ! empty( $atts['custom_background'] ) ) {
|
||||
$inline_css[] = vc_get_css_color( 'background-color', $atts['custom_background'] );
|
||||
}
|
||||
}
|
||||
if ( ! empty( $atts['i_on_border'] ) ) {
|
||||
$main_wrapper_classes[] = 'vc_cta3-icons-on-border';
|
||||
}
|
||||
if ( ! empty( $atts['i_size'] ) ) {
|
||||
$main_wrapper_classes[] = 'vc_cta3-icon-size-' . $atts['i_size'];
|
||||
}
|
||||
if ( ! empty( $atts['i_background_style'] ) ) {
|
||||
$main_wrapper_classes[] = 'vc_cta3-icons-in-box';
|
||||
}
|
||||
|
||||
if ( ! empty( $atts['el_width'] ) ) {
|
||||
$container_classes[] = 'vc_cta3-size-' . $atts['el_width'];
|
||||
}
|
||||
|
||||
if ( ! empty( $atts['add_icon'] ) ) {
|
||||
$output[ 'icons-' . $atts['add_icon'] ] = $this->getVcIcon( $atts );
|
||||
$main_wrapper_classes[] = 'vc_cta3-icons-' . $atts['add_icon'];
|
||||
}
|
||||
|
||||
if ( ! empty( $atts['add_button'] ) ) {
|
||||
$output[ 'actions-' . $atts['add_button'] ] = $this->getButton( $atts );
|
||||
$main_wrapper_classes[] = 'vc_cta3-actions-' . $atts['add_button'];
|
||||
}
|
||||
|
||||
if ( ! empty( $atts['css_animation'] ) ) {
|
||||
$main_wrapper_classes[] = $this->getCSSAnimation( $atts['css_animation'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $atts['css'] ) ) {
|
||||
$main_wrapper_classes[] = vc_shortcode_custom_css_class( $atts['css'] );
|
||||
}
|
||||
|
||||
$output['content'] = wpb_js_remove_wpautop( $content, true );
|
||||
$output['heading1'] = $this->getHeading( 'h2', $atts );
|
||||
$output['heading2'] = $this->getHeading( 'h4', $atts );
|
||||
$output['css-class'] = $main_wrapper_classes;
|
||||
$output['container-class'] = $container_classes;
|
||||
$output['inline-css'] = $inline_css;
|
||||
$this->template_vars = $output;
|
||||
}
|
||||
|
||||
public function getHeading( $tag, $atts ) {
|
||||
if ( isset( $atts[ $tag ] ) && '' !== trim( $atts[ $tag ] ) ) {
|
||||
if ( isset( $atts[ 'use_custom_fonts_' . $tag ] ) && 'true' === $atts[ 'use_custom_fonts_' . $tag ] ) {
|
||||
$custom_heading = visual_composer()->getShortCode( 'vc_custom_heading' );
|
||||
$data = vc_map_integrate_parse_atts( $this->shortcode, 'vc_custom_heading', $atts, $tag . '_' );
|
||||
$data['font_container'] = implode( '|', array_filter( array(
|
||||
'tag:' . $tag,
|
||||
$data['font_container'],
|
||||
) ) );
|
||||
$data['text'] = $atts[ $tag ]; // provide text to shortcode
|
||||
|
||||
return $custom_heading->render( array_filter( $data ) );
|
||||
} else {
|
||||
$inline_css = array();
|
||||
$inline_css_string = '';
|
||||
if ( isset( $atts['style'] ) && 'custom' === $atts['style'] ) {
|
||||
if ( ! empty( $atts['custom_text'] ) ) {
|
||||
$inline_css[] = vc_get_css_color( 'color', $atts['custom_text'] );
|
||||
}
|
||||
}
|
||||
if ( ! empty( $inline_css ) ) {
|
||||
$inline_css_string = ' style="' . implode( '', $inline_css ) . '"';
|
||||
}
|
||||
|
||||
return '<' . $tag . $inline_css_string . '>' . $atts[ $tag ] . '</' . $tag . '>';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getButton( $atts ) {
|
||||
$data = vc_map_integrate_parse_atts( $this->shortcode, 'vc_btn', $atts, 'btn_' );
|
||||
if ( $data ) {
|
||||
$btn = visual_composer()->getShortCode( 'vc_btn' );
|
||||
if ( is_object( $btn ) ) {
|
||||
return '<div class="vc_cta3-actions">' . $btn->render( array_filter( $data ) ) . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getVcIcon( $atts ) {
|
||||
|
||||
if ( empty( $atts['i_type'] ) ) {
|
||||
$atts['i_type'] = 'fontawesome';
|
||||
}
|
||||
$data = vc_map_integrate_parse_atts( $this->shortcode, 'vc_icon', $atts, 'i_' );
|
||||
if ( $data ) {
|
||||
$icon = visual_composer()->getShortCode( 'vc_icon' );
|
||||
if ( is_object( $icon ) ) {
|
||||
return '<div class="vc_cta3-icons">' . $icon->render( array_filter( $data ) ) . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getTemplateVariable( $string ) {
|
||||
if ( is_array( $this->template_vars ) && isset( $this->template_vars[ $string ] ) ) {
|
||||
|
||||
return $this->template_vars[ $string ];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Custom_Field extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class WPBakeryShortCode_VC_Custom_heading
|
||||
* @since 4.3
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Custom_heading extends WPBakeryShortCode {
|
||||
/**
|
||||
* Defines fields names for google_fonts, font_container and etc
|
||||
* @since 4.4
|
||||
* @var array
|
||||
*/
|
||||
protected $fields = array(
|
||||
'google_fonts' => 'google_fonts',
|
||||
'font_container' => 'font_container',
|
||||
'el_class' => 'el_class',
|
||||
'css' => 'css',
|
||||
'text' => 'text',
|
||||
);
|
||||
|
||||
/**
|
||||
* Used to get field name in vc_map function for google_fonts, font_container and etc..
|
||||
*
|
||||
* @param $key
|
||||
*
|
||||
* @since 4.4
|
||||
* @return bool
|
||||
*/
|
||||
protected function getField( $key ) {
|
||||
return isset( $this->fields[ $key ] ) ? $this->fields[ $key ] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get param value by providing key
|
||||
*
|
||||
* @param $key
|
||||
*
|
||||
* @since 4.4
|
||||
* @return array|bool
|
||||
*/
|
||||
protected function getParamData( $key ) {
|
||||
return WPBMap::getParam( $this->shortcode, $this->getField( $key ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses shortcode attributes and set defaults based on vc_map function relative to shortcode and fields names
|
||||
*
|
||||
* @param $atts
|
||||
*
|
||||
* @since 4.3
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes( $atts ) {
|
||||
/**
|
||||
* Shortcode attributes
|
||||
* @var $text
|
||||
* @var $google_fonts
|
||||
* @var $font_container
|
||||
* @var $el_class
|
||||
* @var $link
|
||||
* @var $css
|
||||
*/
|
||||
$atts = vc_map_get_attributes( $this->getShortcode(), $atts );
|
||||
extract( $atts );
|
||||
|
||||
/**
|
||||
* Get default values from VC_MAP.
|
||||
**/
|
||||
$google_fonts_field = $this->getParamData( 'google_fonts' );
|
||||
$font_container_field = $this->getParamData( 'font_container' );
|
||||
|
||||
$el_class = $this->getExtraClass( $el_class );
|
||||
$font_container_obj = new Vc_Font_Container();
|
||||
$google_fonts_obj = new Vc_Google_Fonts();
|
||||
$font_container_field_settings = isset( $font_container_field['settings'], $font_container_field['settings']['fields'] ) ? $font_container_field['settings']['fields'] : array();
|
||||
$google_fonts_field_settings = isset( $google_fonts_field['settings'], $google_fonts_field['settings']['fields'] ) ? $google_fonts_field['settings']['fields'] : array();
|
||||
$font_container_data = $font_container_obj->_vc_font_container_parse_attributes( $font_container_field_settings, $font_container );
|
||||
$google_fonts_data = strlen( $google_fonts ) > 0 ? $google_fonts_obj->_vc_google_fonts_parse_attributes( $google_fonts_field_settings, $google_fonts ) : '';
|
||||
|
||||
return array(
|
||||
'text' => isset( $text ) ? $text : '',
|
||||
'google_fonts' => $google_fonts,
|
||||
'font_container' => $font_container,
|
||||
'el_class' => $el_class,
|
||||
'css' => isset( $css ) ? $css : '',
|
||||
'link' => ( 0 === strpos( $link, '|' ) ) ? false : $link,
|
||||
'font_container_data' => $font_container_data,
|
||||
'google_fonts_data' => $google_fonts_data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses google_fonts_data and font_container_data to get needed css styles to markup
|
||||
*
|
||||
* @param $el_class
|
||||
* @param $css
|
||||
* @param $google_fonts_data
|
||||
* @param $font_container_data
|
||||
* @param $atts
|
||||
*
|
||||
* @since 4.3
|
||||
* @return array
|
||||
*/
|
||||
public function getStyles( $el_class, $css, $google_fonts_data, $font_container_data, $atts ) {
|
||||
$styles = array();
|
||||
if ( ! empty( $font_container_data ) && isset( $font_container_data['values'] ) ) {
|
||||
foreach ( $font_container_data['values'] as $key => $value ) {
|
||||
if ( 'tag' !== $key && strlen( $value ) ) {
|
||||
if ( preg_match( '/description/', $key ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( 'font_size' === $key || 'line_height' === $key ) {
|
||||
$value = preg_replace( '/\s+/', '', $value );
|
||||
}
|
||||
if ( 'font_size' === $key ) {
|
||||
$pattern = '/^(\d*(?:\.\d+)?)\s*(px|\%|in|cm|mm|em|rem|ex|pt|pc|vw|vh|vmin|vmax)?$/';
|
||||
// allowed metrics: http://www.w3schools.com/cssref/css_units.asp
|
||||
$regexr = preg_match( $pattern, $value, $matches );
|
||||
$value = isset( $matches[1] ) ? (float) $matches[1] : (float) $value;
|
||||
$unit = isset( $matches[2] ) ? $matches[2] : 'px';
|
||||
$value = $value . $unit;
|
||||
}
|
||||
if ( strlen( $value ) > 0 ) {
|
||||
$styles[] = str_replace( '_', '-', $key ) . ': ' . $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ( ! isset( $atts['use_theme_fonts'] ) || 'yes' !== $atts['use_theme_fonts'] ) && ! empty( $google_fonts_data ) && isset( $google_fonts_data['values'], $google_fonts_data['values']['font_family'], $google_fonts_data['values']['font_style'] ) ) {
|
||||
$google_fonts_family = explode( ':', $google_fonts_data['values']['font_family'] );
|
||||
$styles[] = 'font-family:' . $google_fonts_family[0];
|
||||
$google_fonts_styles = explode( ':', $google_fonts_data['values']['font_style'] );
|
||||
$styles[] = 'font-weight:' . $google_fonts_styles[1];
|
||||
$styles[] = 'font-style:' . $google_fonts_styles[2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter 'VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG' to change vc_custom_heading class
|
||||
*
|
||||
* @param string - filter_name
|
||||
* @param string - element_class
|
||||
* @param string - shortcode_name
|
||||
* @param array - shortcode_attributes
|
||||
*
|
||||
* @since 4.3
|
||||
*/
|
||||
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'vc_custom_heading ' . $el_class . vc_shortcode_custom_css_class( $css, ' ' ), $this->settings['base'], $atts );
|
||||
|
||||
return array(
|
||||
'css_class' => trim( preg_replace( '/\s+/', ' ', $css_class ) ),
|
||||
'styles' => $styles,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Empty_space extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Facebook extends WPBakeryShortCode {
|
||||
protected function contentInline( $atts, $content = null ) {
|
||||
/**
|
||||
* Shortcode attributes
|
||||
* @var $atts
|
||||
* @var $type
|
||||
* @var $el_class
|
||||
* @var $css
|
||||
* @var $css_animation
|
||||
* Shortcode class
|
||||
* @var $this WPBakeryShortCode_VC_Facebook
|
||||
*/
|
||||
$type = $css = $el_class = '';
|
||||
$atts = vc_map_get_attributes( $this->getShortcode(), $atts );
|
||||
extract( $atts );
|
||||
|
||||
$url = get_permalink();
|
||||
|
||||
$css = isset( $atts['css'] ) ? $atts['css'] : '';
|
||||
$el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
|
||||
|
||||
$class_to_filter = 'wpb_googleplus vc_social-placeholder wpb_content_element vc_socialtype-' . $type;
|
||||
$class_to_filter .= vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
|
||||
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
|
||||
|
||||
return '<a href="' . $url . '" class="' . esc_attr( $css_class ) . '"></a>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_flickr extends WPBakeryShortCode {
|
||||
protected function contentInline( $atts, $content = null ) {
|
||||
|
||||
/**
|
||||
* Shortcode attributes
|
||||
* @var $atts
|
||||
* @var $el_class
|
||||
* @var $title
|
||||
* @var $flickr_id
|
||||
* @var $count
|
||||
* @var $type
|
||||
* @var $display
|
||||
* @var $css
|
||||
* @var $css_animation
|
||||
* Shortcode class
|
||||
* @var $this WPBakeryShortCode_VC_flickr
|
||||
*/
|
||||
$el_class = $title = $flickr_id = $css = $css_animation = $count = $type = $display = '';
|
||||
$output = '';
|
||||
$atts = vc_map_get_attributes( $this->getShortcode(), $atts );
|
||||
extract( $atts );
|
||||
|
||||
$css = isset( $atts['css'] ) ? $atts['css'] : '';
|
||||
$el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
|
||||
|
||||
$class_to_filter = 'wpb_flickr_widget wpb_content_element';
|
||||
$class_to_filter .= vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
|
||||
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
|
||||
|
||||
$output = '
|
||||
<div class="' . $css_class . '">
|
||||
<div class="wpb_wrapper">
|
||||
' . wpb_widget_title( array(
|
||||
'title' => $title,
|
||||
'extraclass' => 'wpb_flickr_heading',
|
||||
) ) . '
|
||||
<div class="vc_flickr-inline-placeholder" data-link="http://www.flickr.com/badge_code_v2.gne?count=' . $count . '&display=' . $display . '&size=s&layout=x&source=' . $type . '&' . $type . '=' . $flickr_id . '"></div>
|
||||
<p class="flickr_stream_wrap"><a class="wpb_follow_btn wpb_flickr_stream" href="http://www.flickr.com/photos/' . $flickr_id . '">' . __( 'View stream on flickr', 'js_composer' ) . '</a></p>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_gallery extends WPBakeryShortCode {
|
||||
|
||||
function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
|
||||
$this->shortcodeScripts();
|
||||
}
|
||||
|
||||
public function shortcodeScripts() {
|
||||
wp_register_script( 'vc_grid-js-imagesloaded',
|
||||
vc_asset_url( 'lib/bower/imagesloaded/imagesloaded.pkgd.min.js' )
|
||||
);
|
||||
}
|
||||
|
||||
public function singleParamHtmlHolder( $param, $value ) {
|
||||
$output = '';
|
||||
// Compatibility fixes
|
||||
$old_names = array(
|
||||
'yellow_message',
|
||||
'blue_message',
|
||||
'green_message',
|
||||
'button_green',
|
||||
'button_grey',
|
||||
'button_yellow',
|
||||
'button_blue',
|
||||
'button_red',
|
||||
'button_orange',
|
||||
);
|
||||
$new_names = array(
|
||||
'alert-block',
|
||||
'alert-info',
|
||||
'alert-success',
|
||||
'btn-success',
|
||||
'btn',
|
||||
'btn-info',
|
||||
'btn-primary',
|
||||
'btn-danger',
|
||||
'btn-warning',
|
||||
);
|
||||
$value = str_ireplace( $old_names, $new_names, $value );
|
||||
$param_name = isset( $param['param_name'] ) ? $param['param_name'] : '';
|
||||
$type = isset( $param['type'] ) ? $param['type'] : '';
|
||||
$class = isset( $param['class'] ) ? $param['class'] : '';
|
||||
|
||||
if ( isset( $param['holder'] ) && 'hidden' !== $param['holder'] ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
|
||||
}
|
||||
if ( 'images' === $param_name ) {
|
||||
$images_ids = empty( $value ) ? array() : explode( ',', trim( $value ) );
|
||||
$output .= '<ul class="attachment-thumbnails' . ( empty( $images_ids ) ? ' image-exists' : '' ) . '" data-name="' . $param_name . '">';
|
||||
foreach ( $images_ids as $image ) {
|
||||
$img = wpb_getImageBySize( array( 'attach_id' => (int) $image, 'thumb_size' => 'thumbnail' ) );
|
||||
$output .= ( $img ? '<li>' . $img['thumbnail'] . '</li>' : '<li><img width="150" height="150" test="' . $image . '" src="' . vc_asset_url( 'vc/blank.gif' ) . '" class="attachment-thumbnail" alt="" title="" /></li>' );
|
||||
}
|
||||
$output .= '</ul>';
|
||||
$output .= '<a href="#" class="column_edit_trigger' . ( ! empty( $images_ids ) ? ' image-exists' : '' ) . '">' . __( 'Add images', 'js_composer' ) . '</a>';
|
||||
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gitem.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Animated_Block extends WPBakeryShortCode_VC_Gitem {
|
||||
protected static $animations = array();
|
||||
|
||||
public function itemGrid() {
|
||||
$output = '';
|
||||
$output .= '<div class="vc_gitem-animated-block-content-controls">'
|
||||
. '<ul class="vc_gitem-tabs vc_clearfix" data-vc-gitem-animated-block="tabs">'
|
||||
. '</ul>'
|
||||
. '</div>';
|
||||
$output .= ''
|
||||
. '<div class="vc_gitem-zone-tab vc_clearfix" data-vc-gitem-animated-block="add-a"></div>'
|
||||
. '<div class="vc_gitem-zone-tab vc_clearfix" data-vc-gitem-animated-block="add-b"></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function containerHtmlBlockParams( $width, $i ) {
|
||||
return 'class="vc_gitem-animated-block-content"';
|
||||
}
|
||||
|
||||
public static function animations() {
|
||||
return array(
|
||||
__( 'Single block (no animation)', 'js_composer' ) => '',
|
||||
__( 'Double block (no animation)', 'js_composer' ) => 'none',
|
||||
__( 'Fade in', 'js_composer' ) => 'fadeIn',
|
||||
__( 'Scale in', 'js_composer' ) => 'scaleIn',
|
||||
__( 'Scale in with rotation', 'js_composer' ) => 'scaleRotateIn',
|
||||
__( 'Blur out', 'js_composer' ) => 'blurOut',
|
||||
__( 'Blur scale out', 'js_composer' ) => 'blurScaleOut',
|
||||
__( 'Slide in from left', 'js_composer' ) => 'slideInRight',
|
||||
__( 'Slide in from right', 'js_composer' ) => 'slideInLeft',
|
||||
__( 'Slide bottom', 'js_composer' ) => 'slideBottom',
|
||||
__( 'Slide top', 'js_composer' ) => 'slideTop',
|
||||
__( 'Vertical flip in with fade', 'js_composer' ) => 'flipFadeIn',
|
||||
__( 'Horizontal flip in with fade', 'js_composer' ) => 'flipHorizontalFadeIn',
|
||||
__( 'Go top', 'js_composer' ) => 'goTop20',
|
||||
__( 'Go bottom', 'js_composer' ) => 'goBottom20',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-column.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Col extends WPBakeryShortCode_VC_Column {
|
||||
public $nonDraggableClass = 'vc-non-draggable-column';
|
||||
public function mainHtmlBlockParams( $width, $i ) {
|
||||
$sortable = ( vc_user_access_check_shortcode_all( $this->shortcode ) ? ' wpb_sortable ' : ' '. $this->nonDraggableClass . ' ' );
|
||||
|
||||
return 'data-element_type="' . $this->settings['base'] . '" data-vc-column-width="'
|
||||
. wpb_vc_get_column_width_indent( $width[ $i ] )
|
||||
. '" class="wpb_vc_column wpb_' . $this->settings['base'] . $sortable
|
||||
. $this->templateWidth() . ' wpb_content_holder"'
|
||||
. $this->customAdminBlockParams();
|
||||
}
|
||||
|
||||
public function outputEditorControlAlign() {
|
||||
$alignment = array(
|
||||
array( 'name' => 'left', 'label' => __( 'Left', 'js_composer' ) ),
|
||||
array( 'name' => 'center', 'label' => __( 'Center', 'js_composer' ) ),
|
||||
array( 'name' => 'right', 'label' => __( 'Right', 'js_composer' ) ),
|
||||
);
|
||||
$output = '<span class="vc_control vc_control-align"><span class="vc_control-wrap">';
|
||||
foreach ( $alignment as $data ) {
|
||||
$attr = esc_attr( $data['name'] );
|
||||
$output .= '<a href="#" data-vc-control-btn="align" data-vc-align="' . $attr . '" class="vc_control'
|
||||
. ' vc_control-align-' . $attr . '" title="' . esc_html( $data['label'] )
|
||||
. '"><i class="vc_icon vc_icon-align-' . $attr . '"></i></a>';
|
||||
}
|
||||
|
||||
return $output . '</span></span>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-custom-heading.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Image extends WPBakeryShortCode_VC_Gitem_Post_Data {
|
||||
/**
|
||||
* Get data_source attribute value
|
||||
*
|
||||
* @param array $atts - list of shortcode attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDataSource( array $atts ) {
|
||||
return 'post_image';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gitem-post-data.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Post_Author extends WPBakeryShortCode_VC_Gitem_Post_Data {
|
||||
protected function getFileName() {
|
||||
return 'vc_gitem_post_author';
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gitem-post-data.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Post_Categories extends WPBakeryShortCode_VC_Gitem_Post_Data {
|
||||
protected function getFileName() {
|
||||
return 'vc_gitem_post_categories';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-custom-heading.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Post_Data extends WPBakeryShortCode_VC_Custom_heading {
|
||||
/**
|
||||
* Get data_source attribute value
|
||||
*
|
||||
* @param array $atts - list of shortcode attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDataSource( array $atts ) {
|
||||
return isset( $atts['data_source'] ) ? $atts['data_source'] : 'post_title';
|
||||
}
|
||||
|
||||
public function getAttributes( $atts ) {
|
||||
$atts = vc_map_get_attributes( $this->getShortcode(), $atts );
|
||||
if ( isset( $atts['block_container'] ) && strlen( $atts['block_container'] ) > 0 ) {
|
||||
if ( ! isset( $atts['font_container'] ) ) {
|
||||
$atts['font_container'] = $atts['block_container'];
|
||||
} else {
|
||||
// merging two params into font_container
|
||||
$atts['font_container'] .= '|' . $atts['block_container'];
|
||||
}
|
||||
}
|
||||
$atts = parent::getAttributes( $atts );
|
||||
if ( ! isset( $this->atts['use_custom_fonts'] ) || 'yes' !== $this->atts['use_custom_fonts'] ) {
|
||||
$atts['google_fonts_data'] = array();
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gitem-post-data.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Post_Date extends WPBakeryShortCode_VC_Gitem_Post_Data {
|
||||
protected function getFileName() {
|
||||
return 'vc_gitem_post_data';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data_source attribute value
|
||||
*
|
||||
* @param array $atts - list of shortcode attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDataSource( array $atts ) {
|
||||
return isset( $atts['time'] ) && 'yes' === $atts['time'] ? 'post_datetime' : 'post_date';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gitem-post-data.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Post_Excerpt extends WPBakeryShortCode_VC_Gitem_Post_Data {
|
||||
protected function getFileName() {
|
||||
return 'vc_gitem_post_data';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data_source attribute value
|
||||
*
|
||||
* @param array $atts - list of shortcode attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDataSource( array $atts ) {
|
||||
return 'post_excerpt';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Post_Meta extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gitem-post-data.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Post_title extends WPBakeryShortCode_VC_Gitem_Post_Data {
|
||||
protected function getFileName() {
|
||||
return 'vc_gitem_post_data';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data_source attribute value
|
||||
*
|
||||
* @param array $atts - list of shortcode attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDataSource( array $atts ) {
|
||||
return 'post_title';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-row.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Row extends WPBakeryShortCode_VC_Row {
|
||||
public function getLayoutsControl() {
|
||||
global $vc_row_layouts;
|
||||
$controls_layout = '<span class="vc_row_layouts vc_control">';
|
||||
foreach ( array_slice( $vc_row_layouts, 0, 4 ) as $layout ) {
|
||||
$controls_layout .= '<a class="vc_control-set-column set_columns" data-cells="' . $layout['cells'] . '" data-cells-mask="' . $layout['mask'] . '" title="' . $layout['title'] . '"><i class="vc-composer-icon vc-c-icon-' . $layout['icon_class'] . '"></i></a> ';
|
||||
}
|
||||
$controls_layout .= '</span>';
|
||||
|
||||
return $controls_layout;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gitem-zone.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Zone_A extends WPBakeryShortCode_VC_Gitem_Zone {
|
||||
public $zone_name = 'a';
|
||||
|
||||
protected function getFileName() {
|
||||
return 'vc_gitem_zone';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gitem-zone.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Zone_B extends WPBakeryShortCode_VC_Gitem_Zone {
|
||||
public $zone_name = 'b';
|
||||
|
||||
protected function getFileName() {
|
||||
return 'vc_gitem_zone';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gitem-zone.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Zone_C extends WPBakeryShortCode_VC_Gitem_Zone {
|
||||
public $zone_name = 'c';
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem_Zone extends WPBakeryShortCodesContainer {
|
||||
public $zone_name = '';
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Gitem extends WPBakeryShortCodesContainer {
|
||||
public function contentAdmin( $atts, $content = null ) {
|
||||
/**
|
||||
* @var string @el_class - comes
|
||||
*/
|
||||
extract( shortcode_atts( $this->predefined_atts, $atts ) );
|
||||
$output = '';
|
||||
|
||||
$column_controls = $this->getControls( $this->settings( 'controls' ) );
|
||||
$output .= '<div ' . $this->mainHtmlBlockParams( '12', '' ) . '>';
|
||||
$output .= $column_controls;
|
||||
$output .= '<div ' . $this->containerHtmlBlockParams( '12', '' ) . '>';
|
||||
$output .= $this->itemGrid();
|
||||
$output .= do_shortcode( shortcode_unautop( $content ) );
|
||||
$output .= '</div>';
|
||||
if ( isset( $this->settings['params'] ) ) {
|
||||
$inner = '';
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
$param_value = isset( ${$param['param_name']} ) ? ${$param['param_name']} : '';
|
||||
if ( is_array( $param_value ) ) {
|
||||
// Get first element from the array
|
||||
reset( $param_value );
|
||||
$first_key = key( $param_value );
|
||||
$param_value = $param_value[ $first_key ];
|
||||
}
|
||||
$inner .= $this->singleParamHtmlHolder( $param, $param_value );
|
||||
}
|
||||
$output .= $inner;
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function mainHtmlBlockParams( $width, $i ) {
|
||||
$sortable = ( vc_user_access_check_shortcode_all( $this->shortcode ) ? 'wpb_sortable' : $this->nonDraggableClass );
|
||||
|
||||
return 'data-element_type="' . $this->settings['base'] . '" class="' . $this->settings['base'] . '-shortcode ' . $sortable . ' wpb_content_holder vc_shortcodes_container"' . $this->customAdminBlockParams();
|
||||
}
|
||||
|
||||
public function itemGrid() {
|
||||
$output = '<div class="vc_row">'
|
||||
. '<div class="vc_col-xs-4 vc_col-xs-offset-4"><div class="vc_gitem-add-c-col" data-vc-gitem="add-c" data-vc-position="top"></div></div>'
|
||||
. '</div>'
|
||||
. '<div class="vc_row">'
|
||||
. '<div class="vc_col-xs-4 vc_gitem-add-c-left"><div class="vc_gitem-add-c-col" data-vc-gitem="add-c" data-vc-position="left"></div></div>'
|
||||
. '<div class="vc_col-xs-4 vc_gitem-ab-zone" data-vc-gitem="add-ab"></div>'
|
||||
. '<div class="vc_col-xs-4 vc_gitem-add-c-right"><div class="vc_gitem-add-c-col" data-vc-gitem="add-c" data-vc-position="right"></div></div>'
|
||||
. '</div>'
|
||||
. '<div class="vc_row">'
|
||||
. '<div class="vc_col-xs-4 vc_col-xs-offset-4 vc_gitem-add-c-bottom"><div class="vc_gitem-add-c-col" data-vc-gitem="add-c" data-vc-position="bottom"></div></div>'
|
||||
. '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function containerHtmlBlockParams( $width, $i ) {
|
||||
return 'class="vc_gitem-content"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rendered controls
|
||||
*
|
||||
* @param array $controls
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getControls( $controls ) {
|
||||
if ( ! is_array( $controls ) || empty( $controls ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$buttons = array();
|
||||
$editAccess = vc_user_access_check_shortcode_edit( $this->shortcode );
|
||||
$allAccess = vc_user_access_check_shortcode_all( $this->shortcode );
|
||||
foreach ( $controls as $control ) {
|
||||
switch ( $control ) {
|
||||
case 'add':
|
||||
if ( $allAccess ) {
|
||||
$buttons[] = '<a class="vc_control-btn vc_control-btn-add" href="#" title="' . __( 'Add to this grid item', 'js_composer' ) . '" data-vc-control="add"><i class="vc_icon"></i></a>';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
if ( $editAccess ) {
|
||||
$buttons[] = '<a class="vc_control-btn vc_control-btn-edit" href="#" title="' . __( 'Edit this grid item', 'js_composer' ) . '" data-vc-control="edit"><i class="vc_icon"></i></a>';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
if ( $allAccess ) {
|
||||
$buttons[] = '<a class="vc_control-btn vc_control-btn-delete" href="#" title="' . __( 'Delete this grid item ', 'js_composer' ) . '" data-vc-control="delete"><i class="vc_icon"></i></a>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$html = '<div class="vc_controls vc_controls-dark vc_controls-visible">' . implode( ' ', $buttons ) . '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Gmaps extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_GooglePlus extends WPBakeryShortCode {
|
||||
protected function contentInline( $atts, $content = null ) {
|
||||
/**
|
||||
* Shortcode attributes
|
||||
* @var $atts
|
||||
* @var $type
|
||||
* @var $annotation
|
||||
* @var $widget_width
|
||||
* @var $css
|
||||
* @var $css_animation
|
||||
* Shortcode class
|
||||
* @var $this WPBakeryShortCode_VC_GooglePlus
|
||||
*/
|
||||
$type = $annotation = $widget_width = $css = $css_animation = '';
|
||||
$atts = vc_map_get_attributes( $this->getShortcode(), $atts );
|
||||
extract( $atts );
|
||||
if ( strlen( $type ) === 0 ) {
|
||||
$type = 'standard';
|
||||
}
|
||||
if ( strlen( $annotation ) === 0 ) {
|
||||
$annotation = 'bubble';
|
||||
}
|
||||
|
||||
$css = isset( $atts['css'] ) ? $atts['css'] : '';
|
||||
$el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
|
||||
|
||||
$class_to_filter = 'wpb_googleplus vc_social-placeholder wpb_content_element vc_socialtype-' . $type;
|
||||
$class_to_filter .= vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
|
||||
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
|
||||
|
||||
return '<div class="' . esc_attr( $css_class ) . '"></div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Gutenberg extends WPBakeryShortCode {
|
||||
protected function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Hoverbox extends WPBakeryShortCode {
|
||||
|
||||
public function getHeading( $tag, $atts, $align ) {
|
||||
if ( isset( $atts[ $tag ] ) && '' !== trim( $atts[ $tag ] ) ) {
|
||||
if ( isset( $atts[ 'use_custom_fonts_' . $tag ] ) && 'true' === $atts[ 'use_custom_fonts_' . $tag ] ) {
|
||||
$custom_heading = visual_composer()->getShortCode( 'vc_custom_heading' );
|
||||
$data = vc_map_integrate_parse_atts( $this->shortcode, 'vc_custom_heading', $atts, $tag . '_' );
|
||||
$data['font_container'] = implode( '|', array_filter( array(
|
||||
'tag:' . 'h2',
|
||||
'text_align:' . esc_attr( $align ),
|
||||
$data['font_container'],
|
||||
) ) );
|
||||
$data['text'] = $atts[ $tag ]; // provide text to shortcode
|
||||
|
||||
return $custom_heading->render( array_filter( $data ) );
|
||||
} else {
|
||||
$inline_css = array();
|
||||
$inline_css_string = '';
|
||||
if ( isset( $atts['style'] ) && 'custom' === $atts['style'] ) {
|
||||
if ( ! empty( $atts['custom_text'] ) ) {
|
||||
$inline_css[] = vc_get_css_color( 'color', $atts['custom_text'] );
|
||||
}
|
||||
}
|
||||
if ( $align ) {
|
||||
$inline_css[] = 'text-align:' . esc_attr( $align );
|
||||
}
|
||||
if ( ! empty( $inline_css ) ) {
|
||||
$inline_css_string = ' style="' . implode( '', $inline_css ) . '"';
|
||||
}
|
||||
|
||||
return '<h2' . $inline_css_string . '>' . $atts[ $tag ] . '</h2>';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function renderButton( $atts ) {
|
||||
$button_atts = vc_map_integrate_parse_atts( $this->shortcode, 'vc_btn', $atts, 'hover_btn_' );
|
||||
$button = visual_composer()->getShortCode( 'vc_btn' );
|
||||
|
||||
return $button->render( array_filter( $button_atts ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class WPBakeryShortCode_VC_Icon
|
||||
* @since 4.4
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Icon extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-gallery.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_images_carousel extends WPBakeryShortCode_VC_gallery {
|
||||
protected static $carousel_index = 1;
|
||||
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->jsCssScripts();
|
||||
}
|
||||
|
||||
public function jsCssScripts() {
|
||||
wp_register_script( 'vc_transition_bootstrap_js', vc_asset_url( 'lib/vc_carousel/js/transition.min.js' ), array(), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'vc_carousel_js', vc_asset_url( 'lib/vc_carousel/js/vc_carousel.min.js' ), array( 'vc_transition_bootstrap_js' ), WPB_VC_VERSION, true );
|
||||
wp_register_style( 'vc_carousel_css', vc_asset_url( 'lib/vc_carousel/css/vc_carousel.min.css' ), array(), WPB_VC_VERSION );
|
||||
}
|
||||
|
||||
public static function getCarouselIndex() {
|
||||
return self::$carousel_index ++ . '-' . time();
|
||||
}
|
||||
|
||||
protected function getSliderWidth( $size ) {
|
||||
global $_wp_additional_image_sizes;
|
||||
$width = '100%';
|
||||
if ( in_array( $size, get_intermediate_image_sizes() ) ) {
|
||||
if ( in_array( $size, array( 'thumbnail', 'medium', 'large' ) ) ) {
|
||||
$width = get_option( $size . '_size_w' ) . 'px';
|
||||
} else {
|
||||
if ( isset( $_wp_additional_image_sizes ) && isset( $_wp_additional_image_sizes[ $size ] ) ) {
|
||||
$width = $_wp_additional_image_sizes[ $size ]['width'] . 'px';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
preg_match_all( '/\d+/', $size, $matches );
|
||||
if ( count( $matches[0] ) > 1 ) {
|
||||
$width = $matches[0][0] . 'px';
|
||||
}
|
||||
}
|
||||
|
||||
return $width;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_Vc_Line_Chart extends WPBakeryShortCode {
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->jsScripts();
|
||||
}
|
||||
|
||||
public function jsScripts() {
|
||||
wp_register_script( 'waypoints', vc_asset_url( 'lib/waypoints/waypoints.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'ChartJS', vc_asset_url( 'lib/bower/chartjs/Chart.min.js' ), array(), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'vc_line_chart', vc_asset_url( 'lib/vc_line_chart/vc_line_chart.min.js' ), array(
|
||||
'jquery',
|
||||
'waypoints',
|
||||
'ChartJS',
|
||||
), WPB_VC_VERSION, true );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-basic-grid.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Masonry_Grid extends WPBakeryShortCode_VC_Basic_Grid {
|
||||
protected function getFileName() {
|
||||
return 'vc_basic_grid';
|
||||
}
|
||||
|
||||
public function shortcodeScripts() {
|
||||
parent::shortcodeScripts();
|
||||
wp_register_script( 'vc_masonry', vc_asset_url( 'lib/bower/masonry/dist/masonry.pkgd.min.js' ), array(), WPB_VC_VERSION, true );
|
||||
}
|
||||
|
||||
public function enqueueScripts() {
|
||||
wp_enqueue_script( 'vc_masonry' );
|
||||
parent::enqueueScripts();
|
||||
}
|
||||
|
||||
public function buildGridSettings() {
|
||||
parent::buildGridSettings();
|
||||
$this->grid_settings['style'] .= '-masonry';
|
||||
}
|
||||
|
||||
protected function contentAllMasonry( $grid_style, $settings, $content ) {
|
||||
return parent::contentAll( $grid_style, $settings, $content );
|
||||
}
|
||||
|
||||
protected function contentLazyMasonry( $grid_style, $settings, $content ) {
|
||||
return parent::contentLazy( $grid_style, $settings, $content );
|
||||
}
|
||||
|
||||
protected function contentLoadMoreMasonry( $grid_style, $settings, $content ) {
|
||||
return parent::contentLoadMore( $grid_style, $settings, $content );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-media-grid.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Masonry_Media_Grid extends WPBakeryShortCode_VC_Media_Grid {
|
||||
|
||||
public function shortcodeScripts() {
|
||||
parent::shortcodeScripts();
|
||||
wp_register_script( 'vc_masonry', vc_asset_url( 'lib/bower/masonry/dist/masonry.pkgd.min.js' ),
|
||||
array(), WPB_VC_VERSION, true
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function enqueueScripts() {
|
||||
wp_enqueue_script( 'vc_masonry' );
|
||||
parent::enqueueScripts();
|
||||
}
|
||||
|
||||
public function buildGridSettings() {
|
||||
parent::buildGridSettings();
|
||||
$this->grid_settings['style'] .= '-masonry';
|
||||
}
|
||||
|
||||
protected function contentAllMasonry( $grid_style, $settings, $content ) {
|
||||
return parent::contentAll( $grid_style, $settings, $content );
|
||||
}
|
||||
|
||||
protected function contentLazyMasonry( $grid_style, $settings, $content ) {
|
||||
return parent::contentLazy( $grid_style, $settings, $content );
|
||||
}
|
||||
|
||||
protected function contentLoadMoreMasonry( $grid_style, $settings, $content ) {
|
||||
return parent::contentLoadMore( $grid_style, $settings, $content );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-basic-grid.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Media_Grid extends WPBakeryShortCode_VC_Basic_Grid {
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
add_filter( $this->shortcode . '_items_list', array( $this, 'setItemsIfEmpty' ) );
|
||||
}
|
||||
|
||||
protected function getFileName() {
|
||||
return 'vc_basic_grid';
|
||||
}
|
||||
|
||||
protected function setPagingAll( $max_items ) {
|
||||
$this->atts['items_per_page'] = $this->atts['query_items_per_page']
|
||||
= apply_filters( 'vc_basic_grid_items_per_page_all_max_items', self::$default_max_items );
|
||||
}
|
||||
|
||||
public function buildQuery( $atts ) {
|
||||
if ( empty( $atts['include'] ) ) {
|
||||
$atts['include'] = - 1;
|
||||
}
|
||||
$settings = array(
|
||||
'include' => $atts['include'],
|
||||
'posts_per_page' => apply_filters( 'vc_basic_grid_max_items', self::$default_max_items ),
|
||||
'offset' => 0,
|
||||
'post_type' => 'attachment',
|
||||
'orderby' => 'post__in',
|
||||
);
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
public function setItemsIfEmpty( $items ) {
|
||||
|
||||
if ( empty( $items ) ) {
|
||||
require_once vc_path_dir( 'PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php' );
|
||||
$grid_item = new Vc_Grid_Item();
|
||||
$grid_item->setGridAttributes( $this->atts );
|
||||
$grid_item->shortcodes();
|
||||
$item = '[vc_gitem]<img src="' . vc_asset_url( 'vc/vc_gitem_image.png' ) . '">[/vc_gitem]';
|
||||
$grid_item->parseTemplate( $item );
|
||||
$items = str_repeat( $grid_item->renderItem( get_post( (int) vc_request_param( 'vc_post_id' ) ) ), 3 );
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public function singleParamHtmlHolder( $param, $value ) {
|
||||
$output = '';
|
||||
// Compatibility fixes
|
||||
// TODO: check $old_names & &new_names. Leftover from copypasting?
|
||||
$old_names = array(
|
||||
'yellow_message',
|
||||
'blue_message',
|
||||
'green_message',
|
||||
'button_green',
|
||||
'button_grey',
|
||||
'button_yellow',
|
||||
'button_blue',
|
||||
'button_red',
|
||||
'button_orange',
|
||||
);
|
||||
$new_names = array(
|
||||
'alert-block',
|
||||
'alert-info',
|
||||
'alert-success',
|
||||
'btn-success',
|
||||
'btn',
|
||||
'btn-info',
|
||||
'btn-primary',
|
||||
'btn-danger',
|
||||
'btn-warning',
|
||||
);
|
||||
$value = str_ireplace( $old_names, $new_names, $value );
|
||||
$param_name = isset( $param['param_name'] ) ? $param['param_name'] : '';
|
||||
$type = isset( $param['type'] ) ? $param['type'] : '';
|
||||
$class = isset( $param['class'] ) ? $param['class'] : '';
|
||||
|
||||
if ( isset( $param['holder'] ) && 'hidden' !== $param['holder'] ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
|
||||
}
|
||||
|
||||
if ( 'include' === $param_name ) {
|
||||
$images_ids = empty( $value ) ? array() : explode( ',', trim( $value ) );
|
||||
$output .= '<ul class="attachment-thumbnails' . ( empty( $images_ids ) ? ' image-exists' : '' ) . '" data-name="' . $param_name . '">';
|
||||
foreach ( $images_ids as $image ) {
|
||||
$img = wpb_getImageBySize( array( 'attach_id' => (int) $image, 'thumb_size' => 'thumbnail' ) );
|
||||
$output .= ( $img ? '<li>' . $img['thumbnail'] . '</li>' : '<li><img width="150" height="150" test="' . $image . '" src="' . vc_asset_url( 'vc/blank.gif' ) . '" class="attachment-thumbnail" alt="" title="" /></li>' );
|
||||
}
|
||||
$output .= '</ul>';
|
||||
$output .= '<a href="#" class="column_edit_trigger' . ( ! empty( $images_ids ) ? ' image-exists' : '' ) . '">' . __( 'Add images', 'js_composer' ) . '</a>';
|
||||
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Message extends WPBakeryShortCode {
|
||||
|
||||
public static function convertAttributesToMessageBox2( $atts ) {
|
||||
if ( isset( $atts['style'] ) ) {
|
||||
if ( '3d' === $atts['style'] ) {
|
||||
$atts['message_box_style'] = '3d';
|
||||
$atts['style'] = 'rounded';
|
||||
} elseif ( 'outlined' === $atts['style'] ) {
|
||||
$atts['message_box_style'] = 'outline';
|
||||
$atts['style'] = 'rounded';
|
||||
} elseif ( 'square_outlined' === $atts['style'] ) {
|
||||
$atts['message_box_style'] = 'outline';
|
||||
$atts['style'] = 'square';
|
||||
}
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
|
||||
public function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_Vc_Pie extends WPBakeryShortCode {
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->jsScripts();
|
||||
}
|
||||
|
||||
public function jsScripts() {
|
||||
wp_register_script( 'waypoints', vc_asset_url( 'lib/waypoints/waypoints.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'progressCircle', vc_asset_url( 'lib/bower/progress-circle/ProgressCircle.min.js' ), array(), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'vc_pie', vc_asset_url( 'lib/vc_chart/jquery.vc_chart.min.js' ), array(
|
||||
'jquery',
|
||||
'waypoints',
|
||||
'progressCircle',
|
||||
), WPB_VC_VERSION, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert old color names to new ones for BC
|
||||
*
|
||||
* @param array $atts
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function convertOldColorsToNew( $atts ) {
|
||||
$map = array(
|
||||
'btn-primary' => '#0088cc',
|
||||
'btn-success' => '#6ab165',
|
||||
'btn-warning' => '#ff9900',
|
||||
'btn-inverse' => '#555555',
|
||||
'btn-danger' => '#ff675b',
|
||||
'btn-info' => '#58b9da',
|
||||
'primary' => '#0088cc',
|
||||
'success' => '#6ab165',
|
||||
'warning' => '#ff9900',
|
||||
'inverse' => '#555555',
|
||||
'danger' => '#ff675b',
|
||||
'info' => '#58b9da',
|
||||
'default' => '#f7f7f7',
|
||||
);
|
||||
|
||||
if ( isset( $atts['color'] ) && isset( $map[ $atts['color'] ] ) ) {
|
||||
$atts['custom_color'] = $map[ $atts['color'] ];
|
||||
$atts['color'] = 'custom';
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Pinterest extends WPBakeryShortCode {
|
||||
protected function contentInline( $atts, $content = null ) {
|
||||
/**
|
||||
* Shortcode attributes
|
||||
* @var $atts
|
||||
* @var $type
|
||||
* @var $annotation // TODO: check why annotation doesn't set before
|
||||
* @var $css
|
||||
* @var $css_animation
|
||||
* Shortcode class
|
||||
* @var $this WPBakeryShortCode_VC_Pinterest
|
||||
*/
|
||||
$type = $annotation = $css = $css_animation = '';
|
||||
global $post;
|
||||
$atts = vc_map_get_attributes( $this->getShortcode(), $atts );
|
||||
extract( $atts );
|
||||
|
||||
$css = isset( $atts['css'] ) ? $atts['css'] : '';
|
||||
$el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
|
||||
|
||||
$class_to_filter = 'wpb_googleplus vc_social-placeholder wpb_content_element vc_socialtype-' . $type;
|
||||
$class_to_filter .= vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
|
||||
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
|
||||
|
||||
return '<div class="' . esc_attr( $css_class ) . '"></div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Posts_Grid extends WPBakeryShortCode {
|
||||
public $pretty_rel_random;
|
||||
protected $filter_categories = array();
|
||||
protected $query = false;
|
||||
protected $loop_args = array();
|
||||
protected $taxonomies = false;
|
||||
protected $partial_paths = array();
|
||||
protected static $pretty_photo_loaded = false;
|
||||
protected $teaser_data = false;
|
||||
public $link_target;
|
||||
protected $block_template_dir_name = 'post_block';
|
||||
protected $block_template_filename = '_item.php';
|
||||
protected static $meta_data_name = 'vc_teaser';
|
||||
|
||||
function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get teaser box data from database.
|
||||
*
|
||||
* @param $name
|
||||
* @param bool $id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTeaserData( $name, $id = false ) {
|
||||
if ( false === $id ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
$this->teaser_data = get_post_meta( $id, self::$meta_data_name, true );
|
||||
|
||||
return isset( $this->teaser_data[ $name ] ) ? $this->teaser_data[ $name ] : '';
|
||||
}
|
||||
|
||||
protected function getCategoriesCss( $post_id ) {
|
||||
$categories_css = '';
|
||||
$post_categories = wp_get_object_terms( $post_id, $this->getTaxonomies() );
|
||||
foreach ( $post_categories as $cat ) {
|
||||
if ( ! in_array( $cat->term_id, $this->filter_categories ) ) {
|
||||
$this->filter_categories[] = $cat->term_id;
|
||||
}
|
||||
$categories_css .= ' grid-cat-' . $cat->term_id;
|
||||
}
|
||||
|
||||
return $categories_css;
|
||||
}
|
||||
|
||||
protected function resetTaxonomies() {
|
||||
$this->taxonomies = false;
|
||||
}
|
||||
|
||||
protected function getTaxonomies() {
|
||||
if ( false === $this->taxonomies ) {
|
||||
$this->taxonomies = get_object_taxonomies( ! empty( $this->loop_args['post_type'] ) ? $this->loop_args['post_type'] : get_post_types( array(
|
||||
'public' => false,
|
||||
'name' => 'attachment',
|
||||
), 'names', 'NOT' ) );
|
||||
}
|
||||
|
||||
return $this->taxonomies;
|
||||
}
|
||||
|
||||
protected function getLoop( $loop ) {
|
||||
global $vc_posts_grid_exclude_id;
|
||||
$vc_posts_grid_exclude_id[] = get_the_ID();
|
||||
require_once vc_path_dir( 'PARAMS_DIR', 'loop/loop.php' );
|
||||
list( $this->loop_args, $this->query ) = vc_build_loop_query( $loop, $vc_posts_grid_exclude_id );
|
||||
}
|
||||
|
||||
protected function spanClass( $grid_columns_count ) {
|
||||
$teaser_width = '';
|
||||
switch ( $grid_columns_count ) {
|
||||
case '1' :
|
||||
$teaser_width = 'vc_col-sm-12';
|
||||
break;
|
||||
case '2' :
|
||||
$teaser_width = 'vc_col-sm-6';
|
||||
break;
|
||||
case '3' :
|
||||
$teaser_width = 'vc_col-sm-4';
|
||||
break;
|
||||
case '4' :
|
||||
$teaser_width = 'vc_col-sm-3';
|
||||
break;
|
||||
case '5':
|
||||
$teaser_width = 'vc_col-sm-10';
|
||||
break;
|
||||
case '6' :
|
||||
$teaser_width = 'vc_col-sm-2';
|
||||
break;
|
||||
}
|
||||
|
||||
return $teaser_width;
|
||||
}
|
||||
|
||||
protected function getMainCssClass( $filter ) {
|
||||
return 'wpb_' . ( 'yes' === $filter ? 'filtered_' : '' ) . 'grid';
|
||||
}
|
||||
|
||||
protected function getFilterCategories() {
|
||||
return get_terms( $this->getTaxonomies(), array(
|
||||
'orderby' => 'name',
|
||||
'include' => implode( ',', $this->filter_categories ),
|
||||
) );
|
||||
}
|
||||
|
||||
protected function getPostThumbnail( $post_id, $grid_thumb_size ) {
|
||||
return wpb_getImageBySize( array( 'post_id' => $post_id, 'thumb_size' => $grid_thumb_size ) );
|
||||
}
|
||||
|
||||
protected function getPostContent() {
|
||||
remove_filter( 'the_content', 'wpautop' );
|
||||
$content = str_replace( ']]>', ']]>', apply_filters( 'the_content', get_the_content() ) );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
protected function getPostExcerpt() {
|
||||
remove_filter( 'the_excerpt', 'wpautop' );
|
||||
$content = apply_filters( 'the_excerpt', get_the_excerpt() );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
protected function getLinked( $post, $content, $type, $css_class ) {
|
||||
$output = '';
|
||||
if ( 'link_post' === $type || empty( $type ) ) {
|
||||
$url = get_permalink( $post->id );
|
||||
$title = sprintf( esc_attr__( 'Permalink to %s', 'js_composer' ), $post->title_attribute );
|
||||
$output .= '<a href="' . $url . '" class="' . $css_class . '"' . $this->link_target . ' title="' . $title . '">' . $content . '</a>';
|
||||
} elseif ( 'link_image' === $type && isset( $post->image_link ) && ! empty( $post->image_link ) ) {
|
||||
$this->loadPrettyPhoto();
|
||||
// actually fixes relations if more prettyphoto added on page
|
||||
if ( ! $this->pretty_rel_random ) {
|
||||
$this->pretty_rel_random = ' data-rel="prettyPhoto[rel-' . get_the_ID() . '-' . rand() . ']"';
|
||||
}
|
||||
$output .= '<a href="' . $post->image_link . '" class="' . $css_class . ' prettyphoto"' . $this->pretty_rel_random . ' ' . $this->link_target . ' title="' . $post->title_attribute . '">' . $content . '</a>';
|
||||
} else {
|
||||
$output .= $content;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
protected function loadPrettyPhoto() {
|
||||
if ( true !== self::$pretty_photo_loaded ) {
|
||||
wp_enqueue_script( 'prettyphoto' );
|
||||
wp_enqueue_style( 'prettyphoto' );
|
||||
self::$pretty_photo_loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected function setLinkTarget( $grid_link_target = '' ) {
|
||||
$this->link_target = '_blank' === $grid_link_target ? ' target="_blank"' : '';
|
||||
}
|
||||
|
||||
protected function findBlockTemplate() {
|
||||
$template_path = $this->block_template_dir_name . '/' . $this->block_template_filename;
|
||||
// Check template path in shortcode's mapping settings
|
||||
if ( ! empty( $this->settings['html_template'] ) && is_file( $this->settings( 'html_template' ) . $template_path ) ) {
|
||||
return $this->settings['html_template'] . $template_path;
|
||||
}
|
||||
// Check template in theme directory
|
||||
$user_template = vc_shortcodes_theme_templates_dir( $template_path );
|
||||
|
||||
if ( is_file( $user_template ) ) {
|
||||
return $user_template;
|
||||
}
|
||||
// Check default place
|
||||
$default_dir = vc_manager()->getDefaultShortcodesTemplatesDir() . '/';
|
||||
if ( is_file( $default_dir . $template_path ) ) {
|
||||
return $default_dir . $template_path;
|
||||
}
|
||||
|
||||
return $template_path;
|
||||
}
|
||||
|
||||
protected function getBlockTemplate() {
|
||||
if ( ! isset( $this->block_template_path ) ) {
|
||||
$this->block_template_path = $this->findBlockTemplate();
|
||||
}
|
||||
|
||||
return $this->block_template_path;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Posts_slider extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/* Skills (Bar)
|
||||
---------------------------------------------------------- */
|
||||
|
||||
class WPBakeryShortCode_VC_Progress_Bar extends WPBakeryShortCode {
|
||||
public static function convertAttributesToNewProgressBar( $atts ) {
|
||||
if ( isset( $atts['values'] ) && strlen( $atts['values'] ) > 0 ) {
|
||||
$values = vc_param_group_parse_atts( $atts['values'] );
|
||||
if ( ! is_array( $values ) ) {
|
||||
$temp = explode( ',', $atts['values'] );
|
||||
$paramValues = array();
|
||||
foreach ( $temp as $value ) {
|
||||
$data = explode( '|', $value );
|
||||
$colorIndex = 2;
|
||||
$newLine = array();
|
||||
$newLine['value'] = isset( $data[0] ) ? $data[0] : 0;
|
||||
$newLine['label'] = isset( $data[1] ) ? $data[1] : '';
|
||||
if ( isset( $data[1] ) && preg_match( '/^\d{1,3}\%$/', $data[1] ) ) {
|
||||
$colorIndex += 1;
|
||||
$newLine['value'] = (float) str_replace( '%', '', $data[1] );
|
||||
$newLine['label'] = isset( $data[2] ) ? $data[2] : '';
|
||||
}
|
||||
if ( isset( $data[ $colorIndex ] ) ) {
|
||||
$newLine['customcolor'] = $data[ $colorIndex ];
|
||||
}
|
||||
$paramValues[] = $newLine;
|
||||
}
|
||||
$atts['values'] = urlencode( json_encode( $paramValues ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Raw_html extends WPBakeryShortCode {
|
||||
|
||||
public function singleParamHtmlHolder( $param, $value ) {
|
||||
$output = '';
|
||||
// Compatibility fixes
|
||||
// TODO: check $old_names & &new_names. Leftover from copypasting?
|
||||
$old_names = array(
|
||||
'yellow_message',
|
||||
'blue_message',
|
||||
'green_message',
|
||||
'button_green',
|
||||
'button_grey',
|
||||
'button_yellow',
|
||||
'button_blue',
|
||||
'button_red',
|
||||
'button_orange',
|
||||
);
|
||||
$new_names = array(
|
||||
'alert-block',
|
||||
'alert-info',
|
||||
'alert-success',
|
||||
'btn-success',
|
||||
'btn',
|
||||
'btn-info',
|
||||
'btn-primary',
|
||||
'btn-danger',
|
||||
'btn-warning',
|
||||
);
|
||||
$value = str_ireplace( $old_names, $new_names, $value );
|
||||
|
||||
$param_name = isset( $param['param_name'] ) ? $param['param_name'] : '';
|
||||
$type = isset( $param['type'] ) ? $param['type'] : '';
|
||||
$class = isset( $param['class'] ) ? $param['class'] : '';
|
||||
|
||||
if ( isset( $param['holder'] ) && 'hidden' !== $param['holder'] ) {
|
||||
if ( 'textarea_raw_html' === $param['type'] ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . htmlentities( rawurldecode( base64_decode( strip_tags( $value ) ) ), ENT_COMPAT, 'UTF-8' ) . '</' . $param['holder'] . '><input type="hidden" name="' . $param_name . '_code" class="' . $param_name . '_code" value="' . strip_tags( $value ) . '" />';
|
||||
} else {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-raw-html.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Raw_js extends WPBakeryShortCode_VC_Raw_html {
|
||||
protected function getFileName() {
|
||||
return 'vc_raw_html';
|
||||
}
|
||||
|
||||
protected function contentInline( $atts, $content = null ) {
|
||||
$el_class = $width = $el_position = '';
|
||||
extract( shortcode_atts( array(
|
||||
'el_class' => '',
|
||||
'el_position' => '',
|
||||
'width' => '1/2',
|
||||
), $atts ) );
|
||||
|
||||
$el_class = $this->getExtraClass( $el_class );
|
||||
$el_class .= ' wpb_raw_js';
|
||||
$content = rawurldecode( base64_decode( strip_tags( $content ) ) );
|
||||
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'wpb_raw_code' . $el_class, $this->settings['base'], $atts );
|
||||
|
||||
$output = '
|
||||
<div class="' . $css_class . '">
|
||||
<div class="wpb_wrapper">
|
||||
<textarea style="display: none;" class="vc_js_inline_holder">' . esc_attr( $content ) . '</textarea>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_Vc_Round_Chart extends WPBakeryShortCode {
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->jsScripts();
|
||||
}
|
||||
|
||||
public function jsScripts() {
|
||||
wp_register_script( 'waypoints', vc_asset_url( 'lib/waypoints/waypoints.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'ChartJS', vc_asset_url( 'lib/bower/chartjs/Chart.min.js' ), array(), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'vc_round_chart', vc_asset_url( 'lib/vc_round_chart/vc_round_chart.min.js' ), array(
|
||||
'jquery',
|
||||
'waypoints',
|
||||
'ChartJS',
|
||||
), WPB_VC_VERSION, true );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-row.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Row_Inner extends WPBakeryShortCode_VC_Row {
|
||||
|
||||
public function template( $content = '' ) {
|
||||
return $this->contentAdmin( $this->atts );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder row
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Row extends WPBakeryShortCode {
|
||||
protected $predefined_atts = array(
|
||||
'el_class' => '',
|
||||
);
|
||||
|
||||
public $nonDraggableClass = 'vc-non-draggable-row';
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
*/
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->shortcodeScripts();
|
||||
}
|
||||
|
||||
protected function shortcodeScripts() {
|
||||
wp_register_script( 'vc_jquery_skrollr_js', vc_asset_url( 'lib/bower/skrollr/dist/skrollr.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'vc_youtube_iframe_api_js', 'https://www.youtube.com/iframe_api', array(), WPB_VC_VERSION, true );
|
||||
}
|
||||
|
||||
protected function content( $atts, $content = null ) {
|
||||
$prefix = '';
|
||||
|
||||
return $prefix . $this->loadTemplate( $atts, $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* This returs block controls
|
||||
*/
|
||||
public function getLayoutsControl() {
|
||||
global $vc_row_layouts;
|
||||
$controls_layout = '<span class="vc_row_layouts vc_control">';
|
||||
foreach ( $vc_row_layouts as $layout ) {
|
||||
$controls_layout .= '<a class="vc_control-set-column set_columns" data-cells="' . $layout['cells'] . '" data-cells-mask="' . $layout['mask'] . '" title="' . $layout['title'] . '"><i class="vc-composer-icon vc-c-icon-' . $layout['icon_class'] . '"></i></a> ';
|
||||
}
|
||||
$controls_layout .= '<br/><a class="vc_control-set-column set_columns custom_columns" data-cells="custom" data-cells-mask="custom" title="' . __( 'Custom layout', 'js_composer' ) . '">' . __( 'Custom', 'js_composer' ) . '</a> ';
|
||||
$controls_layout .= '</span>';
|
||||
|
||||
return $controls_layout;
|
||||
}
|
||||
|
||||
public function getColumnControls( $controls, $extended_css = '' ) {
|
||||
$output = '<div class="vc_controls vc_controls-row controls_row vc_clearfix">';
|
||||
$controls_end = '</div>';
|
||||
//Create columns
|
||||
$controls_layout = $this->getLayoutsControl();
|
||||
|
||||
$controls_move = ' <a class="vc_control column_move vc_column-move" href="#" title="' . __( 'Drag row to reorder', 'js_composer' ) . '" data-vc-control="move"><i class="vc-composer-icon vc-c-icon-dragndrop"></i></a>';
|
||||
$moveAccess = vc_user_access()->part( 'dragndrop' )->checkStateAny( true, null )->get();
|
||||
if ( ! $moveAccess ) {
|
||||
$controls_move = '';
|
||||
}
|
||||
$controls_add = ' <a class="vc_control column_add vc_column-add" href="#" title="' . __( 'Add column', 'js_composer' ) . '" data-vc-control="add"><i class="vc-composer-icon vc-c-icon-add"></i></a>';
|
||||
$controls_delete = '<a class="vc_control column_delete vc_column-delete" href="#" title="' . __( 'Delete this row', 'js_composer' ) . '" data-vc-control="delete"><i class="vc-composer-icon vc-c-icon-delete_empty"></i></a>';
|
||||
$controls_edit = ' <a class="vc_control column_edit vc_column-edit" href="#" title="' . __( 'Edit this row', 'js_composer' ) . '" data-vc-control="edit"><i class="vc-composer-icon vc-c-icon-mode_edit"></i></a>';
|
||||
$controls_clone = ' <a class="vc_control column_clone vc_column-clone" href="#" title="' . __( 'Clone this row', 'js_composer' ) . '" data-vc-control="clone"><i class="vc-composer-icon vc-c-icon-content_copy"></i></a>';
|
||||
$controls_toggle = ' <a class="vc_control column_toggle vc_column-toggle" href="#" title="' . __( 'Toggle row', 'js_composer' ) . '" data-vc-control="toggle"><i class="vc-composer-icon vc-c-icon-arrow_drop_down"></i></a>';
|
||||
$editAccess = vc_user_access_check_shortcode_edit( $this->shortcode );
|
||||
$allAccess = vc_user_access_check_shortcode_all( $this->shortcode );
|
||||
|
||||
if ( is_array( $controls ) && ! empty( $controls ) ) {
|
||||
foreach ( $controls as $control ) {
|
||||
$control_var = 'controls_' . $control;
|
||||
if ( ( $editAccess && 'edit' == $control ) || $allAccess ) {
|
||||
if ( isset( ${$control_var} ) ) {
|
||||
$output .= ${$control_var};
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= $controls_end;
|
||||
} elseif ( is_string( $controls ) ) {
|
||||
$control_var = 'controls_' . $controls;
|
||||
if ( ( $editAccess && 'edit' === $controls ) || $allAccess ) {
|
||||
if ( isset( ${$control_var} ) ) {
|
||||
$output .= ${$control_var} . $controls_end;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$row_edit_clone_delete = '<span class="vc_row_edit_clone_delete">';
|
||||
if ( $allAccess ) {
|
||||
$row_edit_clone_delete .= $controls_delete . $controls_clone . $controls_edit;
|
||||
} elseif ( $editAccess ) {
|
||||
$row_edit_clone_delete .= $controls_edit;
|
||||
}
|
||||
$row_edit_clone_delete .= $controls_toggle;
|
||||
$row_edit_clone_delete .= '</span>';
|
||||
|
||||
if ( $allAccess ) {
|
||||
$output .= $controls_move . $controls_layout . $controls_add . $row_edit_clone_delete . $controls_end;
|
||||
} elseif ( $editAccess ) {
|
||||
$output .= $row_edit_clone_delete . $controls_end;
|
||||
} else {
|
||||
$output .= $row_edit_clone_delete . $controls_end;
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function contentAdmin( $atts, $content = null ) {
|
||||
$atts = shortcode_atts( $this->predefined_atts, $atts );
|
||||
|
||||
$output = '';
|
||||
|
||||
$column_controls = $this->getColumnControls( $this->settings( 'controls' ) );
|
||||
|
||||
$output .= '<div data-element_type="' . $this->settings['base'] . '" class="' . $this->cssAdminClass() . '">';
|
||||
$output .= str_replace( '%column_size%', 1, $column_controls );
|
||||
$output .= '<div class="wpb_element_wrapper">';
|
||||
$output .= '<div class="vc_row vc_row-fluid wpb_row_container vc_container_for_children">';
|
||||
if ( '' === $content && ! empty( $this->settings['default_content_in_template'] ) ) {
|
||||
$output .= do_shortcode( shortcode_unautop( $this->settings['default_content_in_template'] ) );
|
||||
} else {
|
||||
$output .= do_shortcode( shortcode_unautop( $content ) );
|
||||
|
||||
}
|
||||
$output .= '</div>';
|
||||
if ( isset( $this->settings['params'] ) ) {
|
||||
$inner = '';
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
if ( ! isset( $param['param_name'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$param_value = isset( $atts[ $param['param_name'] ] ) ? $atts[ $param['param_name'] ] : '';
|
||||
if ( is_array( $param_value ) ) {
|
||||
// Get first element from the array
|
||||
reset( $param_value );
|
||||
$first_key = key( $param_value );
|
||||
$param_value = $param_value[ $first_key ];
|
||||
}
|
||||
$inner .= $this->singleParamHtmlHolder( $param, $param_value );
|
||||
}
|
||||
$output .= $inner;
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function cssAdminClass() {
|
||||
$sortable = ( vc_user_access_check_shortcode_all( $this->shortcode ) ? ' wpb_sortable' : ' ' . $this->nonDraggableClass );
|
||||
|
||||
return 'wpb_' . $this->settings['base'] . $sortable . '' . ( ! empty( $this->settings['class'] ) ? ' ' . $this->settings['class'] : '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated - due to it is not used anywhere? 4.5
|
||||
* @typo Bock - Block
|
||||
* @return string
|
||||
*/
|
||||
public function customAdminBockParams() {
|
||||
// _deprecated_function( 'WPBakeryShortCode_VC_Row::customAdminBockParams', '4.5 (will be removed in 4.10)' );
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 4.5
|
||||
*
|
||||
* @param string $bg_image
|
||||
* @param string $bg_color
|
||||
* @param string $bg_image_repeat
|
||||
* @param string $font_color
|
||||
* @param string $padding
|
||||
* @param string $margin_bottom
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function buildStyle( $bg_image = '', $bg_color = '', $bg_image_repeat = '', $font_color = '', $padding = '', $margin_bottom = '' ) {
|
||||
// _deprecated_function( 'WPBakeryShortCode_VC_Row::buildStyle', '4.5 (will be removed in 4.10)' );
|
||||
|
||||
$has_image = false;
|
||||
$style = '';
|
||||
if ( (int) $bg_image > 0 && false !== ( $image_url = wp_get_attachment_url( $bg_image ) ) ) {
|
||||
$has_image = true;
|
||||
$style .= 'background-image: url(' . $image_url . ');';
|
||||
}
|
||||
if ( ! empty( $bg_color ) ) {
|
||||
$style .= vc_get_css_color( 'background-color', $bg_color );
|
||||
}
|
||||
if ( ! empty( $bg_image_repeat ) && $has_image ) {
|
||||
if ( 'cover' === $bg_image_repeat ) {
|
||||
$style .= 'background-repeat:no-repeat;background-size: cover;';
|
||||
} elseif ( 'contain' === $bg_image_repeat ) {
|
||||
$style .= 'background-repeat:no-repeat;background-size: contain;';
|
||||
} elseif ( 'no-repeat' === $bg_image_repeat ) {
|
||||
$style .= 'background-repeat: no-repeat;';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $font_color ) ) {
|
||||
$style .= vc_get_css_color( 'color', $font_color );
|
||||
}
|
||||
if ( '' !== $padding ) {
|
||||
$style .= 'padding: ' . ( preg_match( '/(px|em|\%|pt|cm)$/', $padding ) ? $padding : $padding . 'px' ) . ';';
|
||||
}
|
||||
if ( '' !== $margin_bottom ) {
|
||||
$style .= 'margin-bottom: ' . ( preg_match( '/(px|em|\%|pt|cm)$/', $margin_bottom ) ? $margin_bottom : $margin_bottom . 'px' ) . ';';
|
||||
}
|
||||
|
||||
return empty( $style ) ? '' : ' style="' . esc_attr( $style ) . '"';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder section
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Section extends WPBakeryShortCodesContainer {
|
||||
public function containerHtmlBlockParams( $width, $i ) {
|
||||
return 'class="vc_section_container vc_container_for_children"';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
*/
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
$this->shortcodeScripts();
|
||||
}
|
||||
|
||||
protected function shortcodeScripts() {
|
||||
wp_register_script( 'vc_jquery_skrollr_js', vc_asset_url( 'lib/bower/skrollr/dist/skrollr.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'vc_youtube_iframe_api_js', 'https://www.youtube.com/iframe_api', array(), WPB_VC_VERSION, true );
|
||||
}
|
||||
|
||||
public function cssAdminClass() {
|
||||
$sortable = ( vc_user_access_check_shortcode_all( $this->shortcode ) ? ' wpb_sortable' : ' ' . $this->nonDraggableClass );
|
||||
|
||||
return 'wpb_' . $this->settings['base'] . $sortable . '' . ( ! empty( $this->settings['class'] ) ? ' ' . $this->settings['class'] : '' );
|
||||
}
|
||||
|
||||
public function getColumnControls( $controls = 'full', $extended_css = '' ) {
|
||||
$controls_start = '<div class="vc_controls vc_controls-visible controls_column' . ( ! empty( $extended_css ) ? " {$extended_css}" : '' ) . '">';
|
||||
|
||||
$output = '<div class="vc_controls vc_controls-row controls_row vc_clearfix">';
|
||||
$controls_end = '</div>';
|
||||
//Create columns
|
||||
$controls_move = ' <a class="vc_control column_move vc_column-move" href="#" title="' . __( 'Drag row to reorder', 'js_composer' ) . '" data-vc-control="move"><i class="vc-composer-icon vc-c-icon-dragndrop"></i></a>';
|
||||
$moveAccess = vc_user_access()->part( 'dragndrop' )->checkStateAny( true, null )->get();
|
||||
if ( ! $moveAccess ) {
|
||||
$controls_move = '';
|
||||
}
|
||||
$controls_add = ' <a class="vc_control column_add vc_column-add" href="#" title="' . __( 'Add column', 'js_composer' ) . '" data-vc-control="add"><i class="vc-composer-icon vc-c-icon-add"></i></a>';
|
||||
$controls_delete = '<a class="vc_control column_delete vc_column-delete" href="#" title="' . __( 'Delete this row', 'js_composer' ) . '" data-vc-control="delete"><i class="vc-composer-icon vc-c-icon-delete_empty"></i></a>';
|
||||
$controls_edit = ' <a class="vc_control column_edit vc_column-edit" href="#" title="' . __( 'Edit this row', 'js_composer' ) . '" data-vc-control="edit"><i class="vc-composer-icon vc-c-icon-mode_edit"></i></a>';
|
||||
$controls_clone = ' <a class="vc_control column_clone vc_column-clone" href="#" title="' . __( 'Clone this row', 'js_composer' ) . '" data-vc-control="clone"><i class="vc-composer-icon vc-c-icon-content_copy"></i></a>';
|
||||
$editAccess = vc_user_access_check_shortcode_edit( $this->shortcode );
|
||||
$allAccess = vc_user_access_check_shortcode_all( $this->shortcode );
|
||||
$row_edit_clone_delete = '<span class="vc_row_edit_clone_delete">';
|
||||
|
||||
if ( 'add' === $controls ) {
|
||||
return $controls_start . $controls_add . $controls_end;
|
||||
}
|
||||
if ( $allAccess ) {
|
||||
$row_edit_clone_delete .= $controls_delete . $controls_clone . $controls_edit;
|
||||
} elseif ( $editAccess ) {
|
||||
$row_edit_clone_delete .= $controls_edit;
|
||||
}
|
||||
$row_edit_clone_delete .= '</span>';
|
||||
|
||||
if ( $allAccess ) {
|
||||
$output .= $controls_move . $controls_add . $row_edit_clone_delete . $controls_end;
|
||||
} elseif ( $editAccess ) {
|
||||
$output .= $row_edit_clone_delete . $controls_end;
|
||||
} else {
|
||||
$output .= $row_edit_clone_delete . $controls_end;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function contentAdmin( $atts, $content = null ) {
|
||||
$width = '';
|
||||
$atts = shortcode_atts( $this->predefined_atts, $atts );
|
||||
|
||||
$output = '';
|
||||
|
||||
$column_controls = $this->getColumnControls();
|
||||
|
||||
$output .= '<div data-element_type="' . $this->settings['base'] . '" class="' . $this->cssAdminClass() . '">';
|
||||
$output .= str_replace( '%column_size%', 1, $column_controls );
|
||||
$output .= '<div class="wpb_element_wrapper">';
|
||||
if ( isset( $this->settings['custom_markup'] ) && '' !== $this->settings['custom_markup'] ) {
|
||||
$markup = $this->settings['custom_markup'];
|
||||
$output .= $this->customMarkup( $markup );
|
||||
} else {
|
||||
// $output .= $this->outputTitle( $this->settings['name'] );
|
||||
$output .= '<div ' . $this->containerHtmlBlockParams( $width, 1 ) . '>';
|
||||
$output .= do_shortcode( shortcode_unautop( $content ) );
|
||||
$output .= '</div>';
|
||||
// $output .= $this->paramsHtmlHolders( $atts );
|
||||
}
|
||||
if ( isset( $this->settings['params'] ) ) {
|
||||
$inner = '';
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
if ( ! isset( $param['param_name'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$param_value = isset( $atts[ $param['param_name'] ] ) ? $atts[ $param['param_name'] ] : '';
|
||||
if ( is_array( $param_value ) ) {
|
||||
// Get first element from the array
|
||||
reset( $param_value );
|
||||
$first_key = key( $param_value );
|
||||
$param_value = $param_value[ $first_key ];
|
||||
}
|
||||
$inner .= $this->singleParamHtmlHolder( $param, $param_value );
|
||||
}
|
||||
$output .= $inner;
|
||||
}
|
||||
$output .= '</div>';
|
||||
if ( $this->backened_editor_prepend_controls ) {
|
||||
$output .= $this->getColumnControls( 'add', 'vc_section-bottom-controls bottom-controls' );
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Separator extends WPBakeryShortCode {
|
||||
|
||||
public function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Single_image extends WPBakeryShortCode {
|
||||
|
||||
function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
|
||||
$this->jsScripts();
|
||||
}
|
||||
|
||||
public function jsScripts() {
|
||||
wp_register_script( 'zoom', vc_asset_url( 'lib/bower/zoom/jquery.zoom.min.js' ), array(), WPB_VC_VERSION );
|
||||
|
||||
wp_register_script( 'vc_image_zoom', vc_asset_url( 'lib/vc_image_zoom/vc_image_zoom.min.js' ), array(
|
||||
'jquery',
|
||||
'zoom',
|
||||
), WPB_VC_VERSION, true );
|
||||
}
|
||||
|
||||
public function singleParamHtmlHolder( $param, $value ) {
|
||||
$output = '';
|
||||
// Compatibility fixes
|
||||
$old_names = array(
|
||||
'yellow_message',
|
||||
'blue_message',
|
||||
'green_message',
|
||||
'button_green',
|
||||
'button_grey',
|
||||
'button_yellow',
|
||||
'button_blue',
|
||||
'button_red',
|
||||
'button_orange',
|
||||
);
|
||||
$new_names = array(
|
||||
'alert-block',
|
||||
'alert-info',
|
||||
'alert-success',
|
||||
'btn-success',
|
||||
'btn',
|
||||
'btn-info',
|
||||
'btn-primary',
|
||||
'btn-danger',
|
||||
'btn-warning',
|
||||
);
|
||||
$value = str_ireplace( $old_names, $new_names, $value );
|
||||
|
||||
$param_name = isset( $param['param_name'] ) ? $param['param_name'] : '';
|
||||
$type = isset( $param['type'] ) ? $param['type'] : '';
|
||||
$class = isset( $param['class'] ) ? $param['class'] : '';
|
||||
|
||||
if ( 'attach_image' === $param['type'] && 'image' === $param_name ) {
|
||||
$output .= '<input type="hidden" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '" />';
|
||||
$element_icon = $this->settings( 'icon' );
|
||||
$img = wpb_getImageBySize( array(
|
||||
'attach_id' => (int) preg_replace( '/[^\d]/', '', $value ),
|
||||
'thumb_size' => 'thumbnail',
|
||||
) );
|
||||
$this->setSettings( 'logo', ( $img ? $img['thumbnail'] : '<img width="150" height="150" src="' . vc_asset_url( 'vc/blank.gif' ) . '" class="attachment-thumbnail vc_general vc_element-icon" data-name="' . $param_name . '" alt="" title="" style="display: none;" />' ) . '<span class="no_image_image vc_element-icon' . ( ! empty( $element_icon ) ? ' ' . $element_icon : '' ) . ( $img && ! empty( $img['p_img_large'][0] ) ? ' image-exists' : '' ) . '" /><a href="#" class="column_edit_trigger' . ( $img && ! empty( $img['p_img_large'][0] ) ? ' image-exists' : '' ) . '">' . __( 'Add image', 'js_composer' ) . '</a>' );
|
||||
$output .= $this->outputTitleTrue( $this->settings['name'] );
|
||||
} elseif ( ! empty( $param['holder'] ) ) {
|
||||
if ( 'input' === $param['holder'] ) {
|
||||
$output .= '<' . $param['holder'] . ' readonly="true" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '">';
|
||||
} elseif ( in_array( $param['holder'], array( 'img', 'iframe' ) ) ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" src="' . $value . '">';
|
||||
} elseif ( 'hidden' !== $param['holder'] ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $param['admin_label'] ) && true === $param['admin_label'] ) {
|
||||
$output .= '<span class="vc_admin_label admin_label_' . $param['param_name'] . ( empty( $value ) ? ' hidden-label' : '' ) . '"><label>' . $param['heading'] . '</label>: ' . $value . '</span>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function getImageSquareSize( $img_id, $img_size ) {
|
||||
if ( preg_match_all( '/(\d+)x(\d+)/', $img_size, $sizes ) ) {
|
||||
$exact_size = array(
|
||||
'width' => isset( $sizes[1][0] ) ? $sizes[1][0] : '0',
|
||||
'height' => isset( $sizes[2][0] ) ? $sizes[2][0] : '0',
|
||||
);
|
||||
} else {
|
||||
$image_downsize = image_downsize( $img_id, $img_size );
|
||||
$exact_size = array(
|
||||
'width' => $image_downsize[1],
|
||||
'height' => $image_downsize[2],
|
||||
);
|
||||
}
|
||||
$exact_size_int_w = (int) $exact_size['width'];
|
||||
$exact_size_int_h = (int) $exact_size['height'];
|
||||
if ( isset( $exact_size['width'] ) && $exact_size_int_w !== $exact_size_int_h ) {
|
||||
$img_size = $exact_size_int_w > $exact_size_int_h
|
||||
? $exact_size['height'] . 'x' . $exact_size['height']
|
||||
: $exact_size['width'] . 'x' . $exact_size['width'];
|
||||
}
|
||||
|
||||
return $img_size;
|
||||
}
|
||||
|
||||
protected function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function outputTitleTrue( $title ) {
|
||||
return '<h4 class="wpb_element_title">' . $title . ' ' . $this->settings( 'logo' ) . '</h4>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
define( 'TAB_TITLE', __( 'Tab', 'js_composer' ) );
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-column.php' );
|
||||
|
||||
class WPBakeryShortCode_VC_Tab extends WPBakeryShortCode_VC_Column {
|
||||
protected $controls_css_settings = 'tc vc_control-container';
|
||||
protected $controls_list = array( 'add', 'edit', 'clone', 'delete' );
|
||||
protected $predefined_atts = array(
|
||||
'tab_id' => '',
|
||||
'title' => '',
|
||||
);
|
||||
protected $controls_template_file = 'editors/partials/backend_controls_tab.tpl.php';
|
||||
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
}
|
||||
|
||||
public function customAdminBlockParams() {
|
||||
return ' id="tab-' . $this->atts['tab_id'] . '"';
|
||||
}
|
||||
|
||||
public function mainHtmlBlockParams( $width, $i ) {
|
||||
$sortable = ( vc_user_access_check_shortcode_all( $this->shortcode ) ? 'wpb_sortable' : $this->nonDraggableClass );
|
||||
|
||||
return 'data-element_type="' . $this->settings['base'] . '" class="wpb_' . $this->settings['base'] . ' ' . $sortable . ' wpb_content_holder"' . $this->customAdminBlockParams();
|
||||
}
|
||||
|
||||
public function containerHtmlBlockParams( $width, $i ) {
|
||||
return 'class="wpb_column_container vc_container_for_children"';
|
||||
}
|
||||
|
||||
public function getColumnControls( $controls, $extended_css = '' ) {
|
||||
return $this->getColumnControlsModular( $extended_css );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
* @param $value
|
||||
*
|
||||
* @since 4.4
|
||||
* @return string
|
||||
*/
|
||||
function vc_tab_id_settings_field( $settings, $value ) {
|
||||
return '<div class="my_param_block">'
|
||||
. '<input name="' . $settings['param_name']
|
||||
. '" class="wpb_vc_param_value wpb-textinput '
|
||||
. $settings['param_name'] . ' ' . $settings['type'] . '_field" type="hidden" value="'
|
||||
. $value . '" />'
|
||||
. '<label>' . $value . '</label>'
|
||||
. '</div>';
|
||||
// TODO: Add data-js-function to documentation
|
||||
}
|
||||
|
||||
vc_add_shortcode_param( 'tab_id', 'vc_tab_id_settings_field' );
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Tabs extends WPBakeryShortCode {
|
||||
static $filter_added = false;
|
||||
protected $controls_css_settings = 'out-tc vc_controls-content-widget';
|
||||
protected $controls_list = array( 'edit', 'clone', 'delete' );
|
||||
|
||||
public function __construct( $settings ) {
|
||||
parent::__construct( $settings );
|
||||
if ( ! self::$filter_added ) {
|
||||
$this->addFilter( 'vc_inline_template_content', 'setCustomTabId' );
|
||||
self::$filter_added = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function contentAdmin( $atts, $content = null ) {
|
||||
$width = $custom_markup = '';
|
||||
$shortcode_attributes = array( 'width' => '1/1' );
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
if ( 'content' !== $param['param_name'] ) {
|
||||
$shortcode_attributes[ $param['param_name'] ] = isset( $param['value'] ) ? $param['value'] : null;
|
||||
} elseif ( 'content' === $param['param_name'] && null === $content ) {
|
||||
$content = $param['value'];
|
||||
}
|
||||
}
|
||||
extract( shortcode_atts( $shortcode_attributes, $atts ) );
|
||||
|
||||
// Extract tab titles
|
||||
|
||||
preg_match_all( '/vc_tab title="([^\"]+)"(\stab_id\=\"([^\"]+)\"){0,1}/i', $content, $matches, PREG_OFFSET_CAPTURE );
|
||||
|
||||
$output = '';
|
||||
$tab_titles = array();
|
||||
|
||||
if ( isset( $matches[0] ) ) {
|
||||
$tab_titles = $matches[0];
|
||||
}
|
||||
$tmp = '';
|
||||
if ( count( $tab_titles ) ) {
|
||||
$tmp .= '<ul class="clearfix tabs_controls">';
|
||||
foreach ( $tab_titles as $tab ) {
|
||||
preg_match( '/title="([^\"]+)"(\stab_id\=\"([^\"]+)\"){0,1}/i', $tab[0], $tab_matches, PREG_OFFSET_CAPTURE );
|
||||
if ( isset( $tab_matches[1][0] ) ) {
|
||||
$tmp .= '<li><a href="#tab-' . ( isset( $tab_matches[3][0] ) ? $tab_matches[3][0] : sanitize_title( $tab_matches[1][0] ) ) . '">' . $tab_matches[1][0] . '</a></li>';
|
||||
|
||||
}
|
||||
}
|
||||
$tmp .= '</ul>' . "\n";
|
||||
} else {
|
||||
$output .= do_shortcode( $content );
|
||||
}
|
||||
|
||||
$elem = $this->getElementHolder( $width );
|
||||
|
||||
$iner = '';
|
||||
foreach ( $this->settings['params'] as $param ) {
|
||||
$param_value = isset( ${$param['param_name']} ) ? ${$param['param_name']} : '';
|
||||
if ( is_array( $param_value ) ) {
|
||||
// Get first element from the array
|
||||
reset( $param_value );
|
||||
$first_key = key( $param_value );
|
||||
$param_value = $param_value[ $first_key ];
|
||||
}
|
||||
$iner .= $this->singleParamHtmlHolder( $param, $param_value );
|
||||
}
|
||||
|
||||
if ( isset( $this->settings['custom_markup'] ) && '' !== $this->settings['custom_markup'] ) {
|
||||
if ( '' !== $content ) {
|
||||
$custom_markup = str_ireplace( '%content%', $tmp . $content, $this->settings['custom_markup'] );
|
||||
} elseif ( '' === $content && isset( $this->settings['default_content_in_template'] ) && '' !== $this->settings['default_content_in_template'] ) {
|
||||
$custom_markup = str_ireplace( '%content%', $this->settings['default_content_in_template'], $this->settings['custom_markup'] );
|
||||
} else {
|
||||
$custom_markup = str_ireplace( '%content%', '', $this->settings['custom_markup'] );
|
||||
}
|
||||
$iner .= do_shortcode( $custom_markup );
|
||||
}
|
||||
$elem = str_ireplace( '%wpb_element_content%', $iner, $elem );
|
||||
$output = $elem;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function getTabTemplate() {
|
||||
return '<div class="wpb_template">' . do_shortcode( '[vc_tab title="Tab" tab_id=""][/vc_tab]' ) . '</div>';
|
||||
}
|
||||
|
||||
public function setCustomTabId( $content ) {
|
||||
return preg_replace( '/tab\_id\=\"([^\"]+)\"/', 'tab_id="$1-' . time() . '"', $content );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Text_separator extends WPBakeryShortCode {
|
||||
|
||||
public function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getVcIcon( $atts ) {
|
||||
|
||||
if ( empty( $atts['i_type'] ) ) {
|
||||
$atts['i_type'] = 'fontawesome';
|
||||
}
|
||||
$data = vc_map_integrate_parse_atts( $this->shortcode, 'vc_icon', $atts, 'i_' );
|
||||
if ( $data ) {
|
||||
$icon = visual_composer()->getShortCode( 'vc_icon' );
|
||||
if ( is_object( $icon ) ) {
|
||||
return $icon->render( array_filter( $data ) );
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Toggle extends WPBakeryShortCode {
|
||||
public function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getHeading( $atts ) {
|
||||
if ( isset( $atts['use_custom_heading'] ) && 'true' === $atts['use_custom_heading'] ) {
|
||||
$custom_heading = visual_composer()->getShortCode( 'vc_custom_heading' );
|
||||
|
||||
$data = vc_map_integrate_parse_atts( $this->shortcode, 'vc_custom_heading', $atts, 'custom_' );
|
||||
$data['text'] = $atts['title'];
|
||||
|
||||
return $custom_heading->render( array_filter( $data ) );
|
||||
} else {
|
||||
return '<h4>' . esc_html( $atts['title'] ) . '</h4>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-tabs.php' );
|
||||
|
||||
define( 'SLIDE_TITLE', __( 'Slide', 'js_composer' ) );
|
||||
|
||||
class WPBakeryShortCode_VC_Tour extends WPBakeryShortCode_VC_Tabs {
|
||||
protected $predefined_atts = array(
|
||||
'tab_id' => SLIDE_TITLE,
|
||||
'title' => '',
|
||||
);
|
||||
|
||||
protected function getFileName() {
|
||||
return 'vc_tabs';
|
||||
}
|
||||
|
||||
public function getTabTemplate() {
|
||||
return '<div class="wpb_template">' . do_shortcode( '[vc_tab title="' . SLIDE_TITLE . '" tab_id=""][/vc_tab]' ) . '</div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Tta_Accordion extends WPBakeryShortCodesContainer {
|
||||
protected $controls_css_settings = 'out-tc vc_controls-content-widget';
|
||||
protected $controls_list = array(
|
||||
'add',
|
||||
'edit',
|
||||
'clone',
|
||||
'delete',
|
||||
);
|
||||
protected $template_vars = array();
|
||||
|
||||
public $layout = 'accordion';
|
||||
protected $content;
|
||||
|
||||
public $activeClass = 'vc_active';
|
||||
/**
|
||||
* @var WPBakeryShortCode_VC_Tta_Section
|
||||
*/
|
||||
protected $sectionClass;
|
||||
|
||||
public $nonDraggableClass = 'vc-non-draggable-container';
|
||||
|
||||
public function getFileName() {
|
||||
return 'vc_tta_global';
|
||||
}
|
||||
|
||||
public function containerContentClass() {
|
||||
return 'vc_container_for_children vc_clearfix';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
*/
|
||||
public function resetVariables( $atts, $content ) {
|
||||
$this->atts = $atts;
|
||||
$this->content = $content;
|
||||
$this->template_vars = array();
|
||||
}
|
||||
|
||||
public function setGlobalTtaInfo() {
|
||||
$sectionClass = visual_composer()->getShortCode( 'vc_tta_section' )->shortcodeClass();
|
||||
$this->sectionClass = $sectionClass;
|
||||
|
||||
/** @var $sectionClass WPBakeryShortCode_VC_Tta_Section */
|
||||
if ( is_object( $sectionClass ) ) {
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Tta_Section' );
|
||||
WPBakeryShortCode_VC_Tta_Section::$tta_base_shortcode = $this;
|
||||
WPBakeryShortCode_VC_Tta_Section::$self_count = 0;
|
||||
WPBakeryShortCode_VC_Tta_Section::$section_info = array();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override default getColumnControls to make it "simple"(blue), as single element has
|
||||
*
|
||||
* @param string $controls
|
||||
* @param string $extended_css
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColumnControls( $controls = 'full', $extended_css = '' ) {
|
||||
// we don't need containers bottom-controls for tabs
|
||||
if ( 'bottom-controls' === $extended_css ) {
|
||||
return '';
|
||||
}
|
||||
$column_controls = $this->getColumnControlsModular();
|
||||
|
||||
return $output = $column_controls;
|
||||
}
|
||||
|
||||
public function getTtaContainerClasses() {
|
||||
$classes = array();
|
||||
$classes[] = 'vc_tta-container';
|
||||
|
||||
return implode( ' ', apply_filters( 'vc_tta_container_classes', array_filter( $classes ), $this->getAtts() ) );
|
||||
}
|
||||
|
||||
public function getTtaGeneralClasses() {
|
||||
$classes = array();
|
||||
$classes[] = 'vc_general';
|
||||
$classes[] = 'vc_tta';
|
||||
$classes[] = 'vc_tta-' . $this->layout;
|
||||
$classes[] = $this->getTemplateVariable( 'color' );
|
||||
$classes[] = $this->getTemplateVariable( 'style' );
|
||||
$classes[] = $this->getTemplateVariable( 'shape' );
|
||||
$classes[] = $this->getTemplateVariable( 'spacing' );
|
||||
$classes[] = $this->getTemplateVariable( 'gap' );
|
||||
$classes[] = $this->getTemplateVariable( 'c_align' );
|
||||
$classes[] = $this->getTemplateVariable( 'no_fill' );
|
||||
if ( isset( $this->atts['collapsible_all'] ) && 'true' === $this->atts['collapsible_all'] ) {
|
||||
$classes[] = 'vc_tta-o-all-clickable';
|
||||
}
|
||||
|
||||
$pagination = isset( $this->atts['pagination_style'] ) ? trim( $this->atts['pagination_style'] ) : false;
|
||||
if ( $pagination && 'none' !== $pagination && strlen( $pagination ) > 0 ) {
|
||||
$classes[] = 'vc_tta-has-pagination';
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.6.2
|
||||
*/
|
||||
if ( isset( $this->atts['el_class'] ) ) {
|
||||
$classes[] = $this->getExtraClass( $this->atts['el_class'] );
|
||||
}
|
||||
|
||||
return implode( ' ', apply_filters( 'vc_tta_accordion_general_classes', array_filter( $classes ), $this->getAtts() ) );
|
||||
}
|
||||
|
||||
public function getTtaPaginationClasses() {
|
||||
$classes = array();
|
||||
$classes[] = 'vc_general';
|
||||
$classes[] = 'vc_pagination';
|
||||
|
||||
if ( isset( $this->atts['pagination_style'] ) && strlen( $this->atts['pagination_style'] ) > 0 ) {
|
||||
$chunks = explode( '-', $this->atts['pagination_style'] );
|
||||
$classes[] = 'vc_pagination-style-' . $chunks[0];
|
||||
$classes[] = 'vc_pagination-shape-' . $chunks[1];
|
||||
}
|
||||
|
||||
if ( isset( $this->atts['pagination_color'] ) && strlen( $this->atts['pagination_color'] ) > 0 ) {
|
||||
$classes[] = 'vc_pagination-color-' . $this->atts['pagination_color'];
|
||||
}
|
||||
|
||||
return implode( ' ', $classes );
|
||||
}
|
||||
|
||||
public function getWrapperAttributes() {
|
||||
$attributes = array();
|
||||
$attributes[] = 'class="' . esc_attr( $this->getTtaContainerClasses() ) . '"';
|
||||
$attributes[] = 'data-vc-action="' . ( 'true' === $this->atts['collapsible_all'] ? 'collapseAll' : 'collapse' ) . '"';
|
||||
|
||||
$autoplay = isset( $this->atts['autoplay'] ) ? trim( $this->atts['autoplay'] ) : false;
|
||||
if ( $autoplay && 'none' !== $autoplay && intval( $autoplay ) > 0 ) {
|
||||
$attributes[] = 'data-vc-tta-autoplay="' . esc_attr( json_encode( array(
|
||||
'delay' => intval( $autoplay ) * 1000,
|
||||
) ) ) . '"';
|
||||
}
|
||||
if ( ! empty( $this->atts['el_id'] ) ) {
|
||||
$attributes[] = 'id="' . esc_attr( $this->atts['el_id'] ) . '"';
|
||||
}
|
||||
|
||||
return implode( ' ', $attributes );
|
||||
}
|
||||
|
||||
public function getTemplateVariable( $string ) {
|
||||
if ( isset( $this->template_vars[ $string ] ) ) {
|
||||
return $this->template_vars[ $string ];
|
||||
} elseif ( method_exists( $this, 'getParam' . vc_studly( $string ) ) ) {
|
||||
$this->template_vars[ $string ] = $this->{'getParam' . vc_studly( $string )}( $this->atts, $this->content );
|
||||
|
||||
return $this->template_vars[ $string ];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamColor( $atts, $content ) {
|
||||
if ( isset( $atts['color'] ) && strlen( $atts['color'] ) > 0 ) {
|
||||
return 'vc_tta-color-' . $atts['color'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamStyle( $atts, $content ) {
|
||||
if ( isset( $atts['style'] ) && strlen( $atts['style'] ) > 0 ) {
|
||||
return 'vc_tta-style-' . $atts['style'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamTitle( $atts, $content ) {
|
||||
if ( isset( $atts['title'] ) && strlen( $atts['title'] ) > 0 ) {
|
||||
return '<h2>' . $atts['title'] . '</h2>';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamContent( $atts, $content ) {
|
||||
$panelsContent = wpb_js_remove_wpautop( $content );
|
||||
if ( isset( $atts['c_icon'] ) && strlen( $atts['c_icon'] ) > 0 ) {
|
||||
$isPageEditable = vc_is_page_editable();
|
||||
if ( ! $isPageEditable ) {
|
||||
$panelsContent = str_replace( '{{{ control-icon }}}', '<i class="vc_tta-controls-icon vc_tta-controls-icon-' . $atts['c_icon'] . '"></i>', $panelsContent );
|
||||
} else {
|
||||
$panelsContent = str_replace( '{{{ control-icon }}}', '<i class="vc_tta-controls-icon" data-vc-tta-controls-icon="' . $atts['c_icon'] . '"></i>', $panelsContent );
|
||||
}
|
||||
} else {
|
||||
$panelsContent = str_replace( '{{{ control-icon }}}', '', $panelsContent );
|
||||
}
|
||||
|
||||
return $panelsContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamShape( $atts, $content ) {
|
||||
if ( isset( $atts['shape'] ) && strlen( $atts['shape'] ) > 0 ) {
|
||||
return 'vc_tta-shape-' . $atts['shape'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getParamSpacing( $atts, $content ) {
|
||||
if ( isset( $atts['spacing'] ) && strlen( $atts['spacing'] ) > 0 ) {
|
||||
return 'vc_tta-spacing-' . $atts['spacing'];
|
||||
}
|
||||
|
||||
// In case if no spacing set we need to append extra class
|
||||
return 'vc_tta-o-shape-group';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamGap( $atts, $content ) {
|
||||
if ( isset( $atts['gap'] ) && strlen( $atts['gap'] ) > 0 ) {
|
||||
return 'vc_tta-gap-' . $atts['gap'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamNoFill( $atts, $content ) {
|
||||
if ( isset( $atts['no_fill'] ) && 'true' === $atts['no_fill'] ) {
|
||||
return 'vc_tta-o-no-fill';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamCAlign( $atts, $content ) {
|
||||
if ( isset( $atts['c_align'] ) && strlen( $atts['c_align'] ) > 0 ) {
|
||||
return 'vc_tta-controls-align-' . $atts['c_align'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accordion doesn't have pagination
|
||||
*
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function getParamPaginationTop( $atts, $content ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accordion doesn't have pagination
|
||||
*
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function getParamPaginationBottom( $atts, $content ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get currently active section (from $atts)
|
||||
*
|
||||
* @param $atts
|
||||
* @param bool $strict_bounds If true, check for min/max bounds
|
||||
*
|
||||
* @return int nth position (one-based) of active section
|
||||
*/
|
||||
function getActiveSection( $atts, $strict_bounds = false ) {
|
||||
$active_section = intval( $atts['active_section'] );
|
||||
|
||||
if ( $strict_bounds ) {
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Tta_Section' );
|
||||
if ( $active_section < 1 ) {
|
||||
$active_section = 1;
|
||||
} elseif ( $active_section > WPBakeryShortCode_VC_Tta_Section::$self_count ) {
|
||||
$active_section = WPBakeryShortCode_VC_Tta_Section::$self_count;
|
||||
}
|
||||
}
|
||||
|
||||
return $active_section;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getParamPaginationList( $atts, $content ) {
|
||||
if ( empty( $atts['pagination_style'] ) ) {
|
||||
return null;
|
||||
}
|
||||
$isPageEditabe = vc_is_page_editable();
|
||||
|
||||
$sectionClass = $this->sectionClass;
|
||||
|
||||
$html = array();
|
||||
$html[] = '<ul class="' . $this->getTtaPaginationClasses() . '">';
|
||||
|
||||
if ( ! $isPageEditabe ) {
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Tta_Section' );
|
||||
foreach ( WPBakeryShortCode_VC_Tta_Section::$section_info as $nth => $section ) {
|
||||
$active_section = $this->getActiveSection( $atts, false );
|
||||
|
||||
$classes = array( 'vc_pagination-item' );
|
||||
if ( ( $nth + 1 ) === $active_section ) {
|
||||
$classes[] = $this->activeClass;
|
||||
}
|
||||
|
||||
$a_html = '<a href="#' . $section['tab_id'] . '" class="vc_pagination-trigger" data-vc-tabs data-vc-container=".vc_tta"></a>';
|
||||
$html[] = '<li class="' . implode( ' ', $classes ) . '" data-vc-tab>' . $a_html . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$html[] = '</ul>';
|
||||
|
||||
return implode( '', $html );
|
||||
}
|
||||
|
||||
public function enqueueTtaStyles() {
|
||||
wp_register_style( 'vc_tta_style', vc_asset_url( 'css/js_composer_tta.min.css' ), false, WPB_VC_VERSION );
|
||||
wp_enqueue_style( 'vc_tta_style' );
|
||||
}
|
||||
|
||||
public function enqueueTtaScript() {
|
||||
wp_register_script( 'vc_accordion_script', vc_asset_url( 'lib/vc_accordion/vc-accordion.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
|
||||
wp_register_script( 'vc_tta_autoplay_script', vc_asset_url( 'lib/vc-tta-autoplay/vc-tta-autoplay.min.js' ), array( 'vc_accordion_script' ), WPB_VC_VERSION, true );
|
||||
|
||||
wp_enqueue_script( 'vc_accordion_script' );
|
||||
if ( ! vc_is_page_editable() ) {
|
||||
wp_enqueue_script( 'vc_tta_autoplay_script' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override default outputTitle (also Icon). To remove anything, also Icon.
|
||||
*
|
||||
* @param $title - just for strict standards
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is allowed to add another element inside current element.
|
||||
*
|
||||
* @since 4.8
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getAddAllowed() {
|
||||
return vc_user_access_check_shortcode_all( 'vc_tta_section' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Tta_Tabs' );
|
||||
|
||||
class WPBakeryShortCode_VC_Tta_Pageable extends WPBakeryShortCode_VC_Tta_Tabs {
|
||||
|
||||
public $layout = 'tabs';
|
||||
|
||||
public function getTtaContainerClasses() {
|
||||
$classes = parent::getTtaContainerClasses();
|
||||
|
||||
$classes .= ' vc_tta-o-non-responsive';
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
public function getTtaGeneralClasses() {
|
||||
$classes = parent::getTtaGeneralClasses();
|
||||
|
||||
$classes .= ' vc_tta-pageable';
|
||||
|
||||
// tabs have pagination on opposite side of tabs. pageable should behave normally
|
||||
if ( false !== strpos( $classes, 'vc_tta-tabs-position-top' ) ) {
|
||||
$classes = str_replace( 'vc_tta-tabs-position-top', 'vc_tta-tabs-position-bottom', $classes );
|
||||
} else {
|
||||
$classes = str_replace( 'vc_tta-tabs-position-bottom', 'vc_tta-tabs-position-top', $classes );
|
||||
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable all tabs
|
||||
*
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getParamTabsList( $atts, $content ) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Tta_Accordion' );
|
||||
|
||||
class WPBakeryShortCode_VC_Tta_Section extends WPBakeryShortCode_VC_Tta_Accordion {
|
||||
protected $controls_css_settings = 'tc vc_control-container';
|
||||
protected $controls_list = array( 'add', 'edit', 'clone', 'delete' );
|
||||
protected $backened_editor_prepend_controls = false;
|
||||
/**
|
||||
* @var WPBakeryShortCode_VC_Tta_Accordion
|
||||
*/
|
||||
public static $tta_base_shortcode;
|
||||
public static $self_count = 0;
|
||||
public static $section_info = array();
|
||||
|
||||
public function getFileName() {
|
||||
if ( isset( self::$tta_base_shortcode ) && 'vc_tta_pageable' === self::$tta_base_shortcode->getShortcode() ) {
|
||||
return 'vc_tta_pageable_section';
|
||||
} else {
|
||||
return 'vc_tta_section';
|
||||
}
|
||||
}
|
||||
|
||||
public function containerContentClass() {
|
||||
return 'wpb_column_container vc_container_for_children vc_clearfix';
|
||||
}
|
||||
|
||||
public function getElementClasses() {
|
||||
$classes = array();
|
||||
$classes[] = 'vc_tta-panel';
|
||||
$isActive = ! vc_is_page_editable() && $this->getTemplateVariable( 'section-is-active' );
|
||||
|
||||
if ( $isActive ) {
|
||||
$classes[] = $this->activeClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.6.2
|
||||
*/
|
||||
if ( isset( $this->atts['el_class'] ) ) {
|
||||
$classes[] = $this->atts['el_class'];
|
||||
}
|
||||
|
||||
return implode( ' ', array_filter( $classes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getParamContent( $atts, $content ) {
|
||||
return wpb_js_remove_wpautop( $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamTabId( $atts, $content ) {
|
||||
if ( isset( $atts['tab_id'] ) && strlen( $atts['tab_id'] ) > 0 ) {
|
||||
return $atts['tab_id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamTitle( $atts, $content ) {
|
||||
if ( isset( $atts['title'] ) && strlen( $atts['title'] ) > 0 ) {
|
||||
return $atts['title'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamIcon( $atts, $content ) {
|
||||
if ( ! empty( $atts['add_icon'] ) && 'true' === $atts['add_icon'] ) {
|
||||
$iconClass = '';
|
||||
if ( isset( $atts[ 'i_icon_' . $atts['i_type'] ] ) ) {
|
||||
$iconClass = $atts[ 'i_icon_' . $atts['i_type'] ];
|
||||
}
|
||||
vc_icon_element_fonts_enqueue( $atts['i_type'] );
|
||||
|
||||
return '<i class="vc_tta-icon ' . esc_attr( $iconClass ) . '"></i>';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamIconLeft( $atts, $content ) {
|
||||
if ( 'left' === $atts['i_position'] ) {
|
||||
return $this->getParamIcon( $atts, $content );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamIconRight( $atts, $content ) {
|
||||
if ( 'right' === $atts['i_position'] ) {
|
||||
return $this->getParamIcon( $atts, $content );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Section param active
|
||||
* @param $atts
|
||||
* @param $content
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getParamSectionIsActive( $atts, $content ) {
|
||||
if ( is_object( self::$tta_base_shortcode ) ) {
|
||||
if ( isset( self::$tta_base_shortcode->atts['active_section'] ) && strlen( self::$tta_base_shortcode->atts['active_section'] ) > 0 ) {
|
||||
$active = (int) self::$tta_base_shortcode->atts['active_section'];
|
||||
if ( $active === self::$self_count ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getParamControlIconPosition( $atts, $content ) {
|
||||
if ( is_object( self::$tta_base_shortcode ) ) {
|
||||
if (
|
||||
isset( self::$tta_base_shortcode->atts['c_icon'] ) && strlen( self::$tta_base_shortcode->atts['c_icon'] ) > 0 &&
|
||||
isset( self::$tta_base_shortcode->atts['c_position'] ) && strlen( self::$tta_base_shortcode->atts['c_position'] ) > 0
|
||||
) {
|
||||
$c_position = self::$tta_base_shortcode->atts['c_position'];
|
||||
|
||||
return 'vc_tta-controls-icon-position-' . $c_position;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getParamControlIcon( $atts, $content ) {
|
||||
if ( is_object( self::$tta_base_shortcode ) ) {
|
||||
if ( isset( self::$tta_base_shortcode->atts['c_icon'] ) && strlen( self::$tta_base_shortcode->atts['c_icon'] ) > 0 ) {
|
||||
$c_icon = self::$tta_base_shortcode->atts['c_icon'];
|
||||
|
||||
return '<i class="vc_tta-controls-icon vc_tta-controls-icon-' . $c_icon . '"></i>';
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getParamHeading( $atts, $content ) {
|
||||
$isPageEditable = vc_is_page_editable();
|
||||
|
||||
$h4attributes = array();
|
||||
$h4classes = array(
|
||||
'vc_tta-panel-title',
|
||||
);
|
||||
if ( $isPageEditable ) {
|
||||
$h4attributes[] = 'data-vc-tta-controls-icon-position=""';
|
||||
} else {
|
||||
$controlIconPosition = $this->getTemplateVariable( 'control-icon-position' );
|
||||
if ( $controlIconPosition ) {
|
||||
$h4classes[] = $controlIconPosition;
|
||||
}
|
||||
}
|
||||
$h4attributes[] = 'class="' . implode( ' ', $h4classes ) . '"';
|
||||
|
||||
$output = '<h4 ' . implode( ' ', $h4attributes ) . '>'; // close h4
|
||||
|
||||
if ( $isPageEditable ) {
|
||||
$output .= '<a href="javascript:;" data-vc-target=""';
|
||||
$output .= ' data-vc-tta-controls-icon-wrapper';
|
||||
$output .= ' data-vc-use-cache="false"';
|
||||
} else {
|
||||
$output .= '<a href="#' . esc_attr( $this->getTemplateVariable( 'tab_id' ) ) . '"';
|
||||
}
|
||||
|
||||
$output .= ' data-vc-accordion';
|
||||
|
||||
$output .= ' data-vc-container=".vc_tta-container">';
|
||||
$output .= $this->getTemplateVariable( 'icon-left' );
|
||||
$output .= '<span class="vc_tta-title-text">'
|
||||
. $this->getTemplateVariable( 'title' )
|
||||
. '</span>';
|
||||
$output .= $this->getTemplateVariable( 'icon-right' );
|
||||
if ( ! $isPageEditable ) {
|
||||
$output .= $this->getTemplateVariable( 'control-icon' );
|
||||
}
|
||||
|
||||
$output .= '</a>';
|
||||
$output .= '</h4>'; // close h4 fix #2229
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get basic heading
|
||||
*
|
||||
* These are used in Pageable element inside content and are hidden from view
|
||||
*
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getParamBasicHeading( $atts, $content ) {
|
||||
$isPageEditable = vc_is_page_editable();
|
||||
|
||||
if ( $isPageEditable ) {
|
||||
$attributes = array(
|
||||
'href' => 'javascript:;',
|
||||
'data-vc-container' => '.vc_tta-container',
|
||||
'data-vc-accordion' => '',
|
||||
'data-vc-target' => '',
|
||||
'data-vc-tta-controls-icon-wrapper' => '',
|
||||
'data-vc-use-cache' => 'false',
|
||||
);
|
||||
} else {
|
||||
$attributes = array(
|
||||
'data-vc-container' => '.vc_tta-container',
|
||||
'data-vc-accordion' => '',
|
||||
'data-vc-target' => esc_attr( '#' . $this->getTemplateVariable( 'tab_id' ) ),
|
||||
);
|
||||
}
|
||||
|
||||
$output = '
|
||||
<span class="vc_tta-panel-title">
|
||||
<a ' . vc_convert_atts_to_string( $attributes ) . '></a>
|
||||
</span>
|
||||
';
|
||||
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* Check is allowed to add another element inside current element.
|
||||
*
|
||||
* @since 4.8
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getAddAllowed() {
|
||||
return vc_user_access()
|
||||
->part( 'shortcodes' )
|
||||
->checkStateAny( true, 'custom', null )->get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Tta_Accordion' );
|
||||
|
||||
class WPBakeryShortCode_VC_Tta_Tabs extends WPBakeryShortCode_VC_Tta_Accordion {
|
||||
|
||||
public $layout = 'tabs';
|
||||
|
||||
public function enqueueTtaScript() {
|
||||
wp_register_script( 'vc_tabs_script', vc_asset_url( 'lib/vc_tabs/vc-tabs.min.js' ), array( 'vc_accordion_script' ), WPB_VC_VERSION, true );
|
||||
parent::enqueueTtaScript();
|
||||
wp_enqueue_script( 'vc_tabs_script' );
|
||||
}
|
||||
|
||||
public function getWrapperAttributes() {
|
||||
$attributes = array();
|
||||
$attributes[] = 'class="' . esc_attr( $this->getTtaContainerClasses() ) . '"';
|
||||
$attributes[] = 'data-vc-action="collapse"';
|
||||
|
||||
$autoplay = $this->atts['autoplay'];
|
||||
if ( $autoplay && 'none' !== $autoplay && intval( $autoplay ) > 0 ) {
|
||||
$attributes[] = 'data-vc-tta-autoplay="' . esc_attr( json_encode( array(
|
||||
'delay' => intval( $autoplay ) * 1000,
|
||||
) ) ) . '"';
|
||||
}
|
||||
if ( ! empty( $this->atts['el_id'] ) ) {
|
||||
$attributes[] = 'id="' . esc_attr( $this->atts['el_id'] ) . '"';
|
||||
}
|
||||
|
||||
return implode( ' ', $attributes );
|
||||
}
|
||||
|
||||
public function getTtaGeneralClasses() {
|
||||
$classes = parent::getTtaGeneralClasses();
|
||||
|
||||
if ( ! empty( $this->atts['no_fill_content_area'] ) ) {
|
||||
$classes .= ' vc_tta-o-no-fill';
|
||||
}
|
||||
|
||||
if ( isset( $this->atts['tab_position'] ) ) {
|
||||
$classes .= ' ' . $this->getTemplateVariable( 'tab_position' );
|
||||
}
|
||||
|
||||
$classes .= ' ' . $this->getParamAlignment( $this->atts, $this->content );
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamTabPosition( $atts, $content ) {
|
||||
if ( isset( $atts['tab_position'] ) && strlen( $atts['tab_position'] ) > 0 ) {
|
||||
return 'vc_tta-tabs-position-' . $atts['tab_position'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamTabsListTop( $atts, $content ) {
|
||||
if ( empty( $atts['tab_position'] ) || 'top' !== $atts['tab_position'] ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->getParamTabsList( $atts, $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamTabsListBottom( $atts, $content ) {
|
||||
if ( empty( $atts['tab_position'] ) || 'bottom' !== $atts['tab_position'] ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->getParamTabsList( $atts, $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Pagination is on top only if tabs are at bottom
|
||||
*
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamPaginationTop( $atts, $content ) {
|
||||
if ( empty( $atts['tab_position'] ) || 'bottom' !== $atts['tab_position'] ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->getParamPaginationList( $atts, $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Pagination is at bottom only if tabs are on top
|
||||
*
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamPaginationBottom( $atts, $content ) {
|
||||
if ( empty( $atts['tab_position'] ) || 'top' !== $atts['tab_position'] ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->getParamPaginationList( $atts, $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function constructIcon( $atts ) {
|
||||
vc_icon_element_fonts_enqueue( $atts['i_type'] );
|
||||
|
||||
$class = 'vc_tta-icon';
|
||||
|
||||
if ( isset( $atts[ 'i_icon_' . $atts['i_type'] ] ) ) {
|
||||
$class .= ' ' . $atts[ 'i_icon_' . $atts['i_type'] ];
|
||||
} else {
|
||||
$class .= ' fa fa-adjust';
|
||||
}
|
||||
|
||||
return '<i class="' . $class . '"></i>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getParamTabsList( $atts, $content ) {
|
||||
$isPageEditabe = vc_is_page_editable();
|
||||
$html = array();
|
||||
$html[] = '<div class="vc_tta-tabs-container">';
|
||||
$html[] = '<ul class="vc_tta-tabs-list">';
|
||||
if ( ! $isPageEditabe ) {
|
||||
$active_section = $this->getActiveSection( $atts, false );
|
||||
|
||||
foreach ( WPBakeryShortCode_VC_Tta_Section::$section_info as $nth => $section ) {
|
||||
$classes = array( 'vc_tta-tab' );
|
||||
if ( ( $nth + 1 ) === $active_section ) {
|
||||
$classes[] = $this->activeClass;
|
||||
}
|
||||
|
||||
$title = '<span class="vc_tta-title-text">' . $section['title'] . '</span>';
|
||||
if ( 'true' === $section['add_icon'] ) {
|
||||
$icon_html = $this->constructIcon( $section );
|
||||
if ( 'left' === $section['i_position'] ) {
|
||||
$title = $icon_html . $title;
|
||||
} else {
|
||||
$title = $title . $icon_html;
|
||||
}
|
||||
}
|
||||
$a_html = '<a href="#' . $section['tab_id'] . '" data-vc-tabs data-vc-container=".vc_tta">' . $title . '</a>';
|
||||
$html[] = '<li class="' . implode( ' ', $classes ) . '" data-vc-tab>' . $a_html . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$html[] = '</ul>';
|
||||
$html[] = '</div>';
|
||||
|
||||
return implode( '', apply_filters( 'vc-tta-get-params-tabs-list', $html, $atts, $content, $this ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamAlignment( $atts, $content ) {
|
||||
if ( isset( $atts['alignment'] ) && strlen( $atts['alignment'] ) > 0 ) {
|
||||
return 'vc_tta-controls-align-' . $atts['alignment'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
VcShortcodeAutoloader::getInstance()->includeClass( 'WPBakeryShortCode_VC_Tta_Accordion' );
|
||||
|
||||
class WPBakeryShortCode_VC_Tta_Tour extends WPBakeryShortCode_VC_Tta_Tabs {
|
||||
|
||||
public $layout = 'tabs';
|
||||
|
||||
public function getTtaGeneralClasses() {
|
||||
$classes = parent::getTtaGeneralClasses();
|
||||
|
||||
if ( isset( $this->atts['controls_size'] ) ) {
|
||||
$classes .= ' ' . $this->getTemplateVariable( 'controls_size' );
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamControlsSize( $atts, $content ) {
|
||||
if ( isset( $atts['controls_size'] ) && strlen( $atts['controls_size'] ) > 0 ) {
|
||||
return 'vc_tta-controls-size-' . $atts['controls_size'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamTabsListLeft( $atts, $content ) {
|
||||
if ( empty( $atts['tab_position'] ) || 'left' !== $atts['tab_position'] ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->getParamTabsList( $atts, $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamTabsListRight( $atts, $content ) {
|
||||
if ( empty( $atts['tab_position'] ) || 'right' !== $atts['tab_position'] ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->getParamTabsList( $atts, $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Never on top
|
||||
*
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamPaginationTop( $atts, $content ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Always on bottom
|
||||
*
|
||||
* @param $atts
|
||||
* @param $content
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParamPaginationBottom( $atts, $content ) {
|
||||
return $this->getParamPaginationList( $atts, $content );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_TweetMeMe extends WPBakeryShortCode {
|
||||
protected function contentInline( $atts, $content = null ) {
|
||||
/**
|
||||
* Shortcode attributes
|
||||
* @var $atts
|
||||
* Shortcode class
|
||||
* @var $this WPBakeryShortCode_VC_TweetMeMe
|
||||
*/
|
||||
$atts = vc_map_get_attributes( $this->getShortcode(), $atts );
|
||||
$css = isset( $atts['css'] ) ? $atts['css'] : '';
|
||||
$el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
|
||||
|
||||
$class_to_filter = 'wpb_googleplus vc_social-placeholder wpb_content_element';
|
||||
$class_to_filter .= vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $atts['css_animation'] );
|
||||
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
|
||||
|
||||
return '<div class="' . esc_attr( $css_class ) . '"></div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Twitter extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Video extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Widget_sidebar extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Zigzag extends WPBakeryShortCode {
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
/**
|
||||
* WPBakery WPBakery Page Builder shortcodes
|
||||
*
|
||||
* @package WPBakeryPageBuilder
|
||||
*
|
||||
*/
|
||||
class WPBakeryShortCode_VC_Wp_Search extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Meta extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Recentcomments extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Calendar extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Pages extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Tagcloud extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Custommenu extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Text extends WPBakeryShortCode {
|
||||
/**
|
||||
* This actually fixes #1537 by converting 'text' to 'content'
|
||||
* @since 4.4
|
||||
*
|
||||
* @param $atts
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function convertTextAttributeToContent( $atts ) {
|
||||
if ( isset( $atts['text'] ) ) {
|
||||
if ( ! isset( $atts['content'] ) || empty( $atts['content'] ) ) {
|
||||
$atts['content'] = $atts['text'];
|
||||
}
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Posts extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Links extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Categories extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Archives extends WPBakeryShortCode {
|
||||
}
|
||||
|
||||
class WPBakeryShortCode_VC_Wp_Rss extends WPBakeryShortCode {
|
||||
}
|
||||
Reference in new issue
Block a user