function vc_page_editable_enqueue_pointer_scripts()
{
    if (vc_is_page_editable()) {
        wp_enqueue_style('wp-pointer');
        wp_enqueue_script('wp-pointer');
    }
}
 public function addContentTabPageEditable($tabs)
 {
     if (vc_is_page_editable()) {
         // Description tab - shows product content
         $tabs['description'] = array('title' => __('Description', 'woocommerce'), 'priority' => 10, 'callback' => 'woocommerce_product_description_tab');
     }
     return $tabs;
 }
function vc_page_editable_enqueue_pointer_scripts()
{
    if (vc_is_page_editable()) {
        wp_enqueue_style('wp-pointer');
        wp_enqueue_script('wp-pointer');
        // Add pointers script to queue. Add custom script.
        wp_enqueue_script('vc_pointer-message', vc_asset_url('js/lib/vc-pointers/vc-pointer-message.js'), array('jquery', 'underscore', 'wp-pointer'), WPB_VC_VERSION, true);
    }
}
 /**
  * Get shortcode hash by it content and attributes
  *
  * @param $atts
  * @param $content
  *
  * @return string
  */
 public function getHash($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)));
     }
     /** 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 = '{failed_to_get_id:"' . esc_attr($id_value) . '"}';
     if (!empty($id_matches)) {
         $id_to_save = $id_matches[1];
     }
     return $id_to_save;
 }
 public function load()
 {
     add_filter('vc_object_id', array($this, 'filterMediaId'));
     add_filter('vc_basic_grid_filter_query_suppress_filters', '__return_false');
     add_filter('vc_frontend_editor_iframe_url', array($this, 'appendLangToUrl'));
     add_filter('vc_grid_request_url', array($this, 'appendLangToUrl'));
     add_filter('vc_admin_url', array($this, 'appendLangToUrl'));
     if (!vc_is_frontend_editor()) {
         add_filter('vc_get_inline_url', array($this, 'appendLangToUrl'));
     }
     global $sitepress;
     $action = vc_post_param('action');
     if (vc_is_page_editable() && 'vc_frontend_load_template' === $action) {
         // Fix Issue with loading template #135512264670405
         remove_action('wp_loaded', array($sitepress, 'maybe_set_this_lang'));
     }
 }
Exemple #7
0
    /**
     * 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;
    }
 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">' . esc_html($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;
 }
 /**
  * @param $settings
  */
 public function __construct($settings)
 {
     $this->settings = $settings;
     $this->shortcode = $this->settings['base'];
     $this->addAction('admin_init', 'enqueueAssets');
     if (vc_is_page_editable()) {
         // fix for page editable
         $this->addAction('wp_head', 'printIconStyles');
     }
     $this->addAction('admin_head', 'printIconStyles');
     // fe+be
     $this->addAction('admin_print_scripts-post.php', 'enqueueAssets');
     $this->addAction('admin_print_scripts-post-new.php', 'enqueueAssets');
     if (!shortcode_exists($this->shortcode)) {
         add_shortcode($this->shortcode, array(&$this, 'render'));
     }
 }
Exemple #10
0
 /**
  * @param $atts
  * @param $content
  *
  * @return string
  */
 public function getParamTabsList($atts, $content)
 {
     $isPageEditabe = vc_is_page_editable();
     $sectionClass = $this->sectionClass;
     $html = array();
     $html[] = '<div class="vc_tta-tabs-container">';
     $html[] = '<ul class="vc_tta-tabs-list">';
     if (!$isPageEditabe) {
         $strict_bounds = 'vc_tta_tabs' === $this->shortcode;
         $active_section = $this->getActiveSection($atts, $strict_bounds);
         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('', $html);
 }
Exemple #11
0
 public function output($atts, $content = null, $base = '')
 {
     $this->atts = $this->prepareAtts($atts);
     $output = '';
     $content = empty($content) && !empty($atts['content']) ? $atts['content'] : $content;
     if (($this->isInline() || vc_is_page_editable()) && method_exists($this, 'contentInline')) {
         $output .= $this->contentInline($this->atts, $content);
     } elseif ($this->isAdmin()) {
         $output .= $this->contentAdmin($this->atts, $content);
     }
     if (empty($output)) {
         $custom_output = VC_SHORTCODE_CUSTOMIZE_PREFIX . $this->shortcode;
         $custom_output_before = VC_SHORTCODE_BEFORE_CUSTOMIZE_PREFIX . $this->shortcode;
         // before shortcode function hook
         $custom_output_after = VC_SHORTCODE_AFTER_CUSTOMIZE_PREFIX . $this->shortcode;
         // after shortcode function hook
         // Before shortcode
         if (function_exists($custom_output_before)) {
             $output .= $custom_output_before($this->atts, $content);
         } else {
             $output .= $this->beforeShortcode($this->atts, $content);
         }
         // Shortcode content
         if (function_exists($custom_output)) {
             $output .= $custom_output($this->atts, $content);
         } else {
             $output .= $this->content($this->atts, $content);
         }
         // After shortcode
         if (function_exists($custom_output_after)) {
             $output .= $custom_output_after($this->atts, $content);
         } else {
             $output .= $this->afterShortcode($this->atts, $content);
         }
         // Filter for overriding outputs
         $output = apply_filters('vc_shortcode_output', $output, $this);
     }
     return $output;
 }
Exemple #12
0
 public function hookAdmin()
 {
     $this->enqueueAssets();
     $this->addAction('admin_init', 'enqueueAssets');
     if (vc_is_page_editable()) {
         // fix for page editable
         $this->addAction('wp_head', 'printIconStyles');
     }
     $this->addAction('admin_head', 'printIconStyles');
     // fe+be
     $this->addAction('admin_print_scripts-post.php', 'enqueueAssets');
     $this->addAction('admin_print_scripts-post-new.php', 'enqueueAssets');
 }
 /**
  *
  */
 function loadShortcodes()
 {
     if (vc_is_page_editable() && vc_enabled_frontend()) {
         $action = vc_post_param('action');
         if ('vc_load_shortcode' === $action) {
             !defined('CONCATENATE_SCRIPTS') && define('CONCATENATE_SCRIPTS', false);
             ob_start();
             $this->setPost();
             $shortcodes = (array) vc_post_param('shortcodes');
             do_action('vc_load_shortcode', $shortcodes);
             $this->renderShortcodes($shortcodes);
             echo '<div data-type="files">';
             _print_styles();
             print_head_scripts();
             print_late_styles();
             print_footer_scripts();
             do_action('wp_print_footer_scripts');
             echo '</div>';
             $output = ob_get_clean();
             die(apply_filters('vc_frontend_editor_load_shortcode_ajax_output', $output));
         } elseif ('vc_frontend_load_template' === $action) {
             $this->setPost();
             visual_composer()->templatesPanelEditor()->renderFrontendTemplate();
         } else {
             if ('' !== $action) {
                 do_action('vc_front_load_page_' . esc_attr(vc_post_param('action')));
             }
         }
     }
 }
Exemple #14
0
 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');
     }
 }
Exemple #15
0
vc_lean_map('vc_masonry_media_grid', null, $vc_config_path . '/grids/shortcode-vc-masonry-media-grid.php');
vc_lean_map('vc_tabs', null, $vc_config_path . '/deprecated/shortcode-vc-tabs.php');
vc_lean_map('vc_tour', null, $vc_config_path . '/deprecated/shortcode-vc-tour.php');
vc_lean_map('vc_tab', null, $vc_config_path . '/deprecated/shortcode-vc-tab.php');
vc_lean_map('vc_accordion', null, $vc_config_path . '/deprecated/shortcode-vc-accordion.php');
vc_lean_map('vc_accordion_tab', null, $vc_config_path . '/deprecated/shortcode-vc-accordion-tab.php');
vc_lean_map('vc_posts_grid', null, $vc_config_path . '/deprecated/shortcode-vc-posts-grid.php');
vc_lean_map('vc_carousel', null, $vc_config_path . '/deprecated/shortcode-vc-carousel.php');
vc_lean_map('vc_button', null, $vc_config_path . '/deprecated/shortcode-vc-button.php');
vc_lean_map('vc_button2', null, $vc_config_path . '/deprecated/shortcode-vc-button2.php');
vc_lean_map('vc_cta_button', null, $vc_config_path . '/deprecated/shortcode-vc-cta-button.php');
vc_lean_map('vc_cta_button2', null, $vc_config_path . '/deprecated/shortcode-vc-cta-button2.php');
if (is_admin()) {
    add_action('admin_print_scripts-post.php', array(Vc_Shortcodes_Manager::getInstance(), 'buildShortcodesAssets'), 1);
    add_action('admin_print_scripts-post-new.php', array(Vc_Shortcodes_Manager::getInstance(), 'buildShortcodesAssets'), 1);
} elseif (vc_is_page_editable()) {
    add_action('wp_head', array(Vc_Shortcodes_Manager::getInstance(), 'buildShortcodesAssetsForEditable'));
    // @todo where these icons are used in iframe?
}
// @todo define custom
function vc_add_css_animation()
{
    return array('type' => 'dropdown', 'heading' => __('CSS Animation', 'js_composer'), 'param_name' => 'css_animation', 'admin_label' => true, 'value' => array(__('No', 'js_composer') => '', __('Top to bottom', 'js_composer') => 'top-to-bottom', __('Bottom to top', 'js_composer') => 'bottom-to-top', __('Left to right', 'js_composer') => 'left-to-right', __('Right to left', 'js_composer') => 'right-to-left', __('Appear from center', 'js_composer') => 'appear'), 'description' => __('Select type of animation for element to be animated when it "enters" the browsers viewport (Note: works only in modern browsers).', 'js_composer'));
}
function vc_target_param_list()
{
    return array(__('Same window', 'js_composer') => '_self', __('New window', 'js_composer') => '_blank');
}
function vc_layout_sub_controls()
{
    return array(array('link_post', __('Link to post', 'js_composer')), array('no_link', __('No link', 'js_composer')), array('link_image', __('Link to bigger image', 'js_composer')));
Exemple #16
0
 /**
  * @param $settings
  */
 public function __construct($settings)
 {
     $this->settings = $settings;
     $this->shortcode = $this->settings['base'];
     $this->addAction('admin_init', 'enqueueAssets');
     //die(print_r(array($this->isAdmin(),vc_mode()),true));
     if (vc_is_page_editable()) {
         // fix for page editable
         $this->addAction('wp_head', 'printIconStyles');
     }
     $this->addAction('admin_head', 'printIconStyles');
     // fe+be
     $this->addAction('admin_print_scripts-post.php', 'enqueueAssets');
     $this->addAction('admin_print_scripts-post-new.php', 'enqueueAssets');
     if ($this->isAdmin()) {
         $this->removeShortCode($this->shortcode);
     }
     // if($this->isAdmin() || !shortcode_exists($this->shortcode)) $this->addShortCode($this->shortcode, Array($this, 'output'));
     if ($this->isAdmin() || !shortcode_exists($this->shortcode)) {
         $this->addShortCode($this->shortcode, array(&$this, 'render'));
     }
 }
<?php

if (!defined('ABSPATH')) {
    die('-1');
}
/**
 * Shortcode attributes
 * @var $atts
 * @var $content - shortcode content
 * @var $this WPBakeryShortCode_VC_Tta_Section
 */
$atts = vc_map_get_attributes($this->getShortcode(), $atts);
$this->resetVariables($atts, $content);
WPBakeryShortCode_VC_Tta_Section::$self_count++;
WPBakeryShortCode_VC_Tta_Section::$section_info[] = $atts;
$isPageEditable = vc_is_page_editable();
$output = '';
$output .= '<div class="' . esc_attr($this->getElementClasses()) . '"';
$output .= ' id="' . esc_attr($this->getTemplateVariable('tab_id')) . '"';
$output .= ' data-vc-content=".vc_tta-panel-body">';
$output .= '<div class="vc_tta-panel-heading">';
$output .= $this->getTemplateVariable('heading');
$output .= '</div>';
$output .= '<div class="vc_tta-panel-body">';
if ($isPageEditable) {
    $output .= '<div data-js-panel-body>';
    // fix for fe - shortcodes container, not required in b.e.
}
$output .= $this->getTemplateVariable('content');
if ($isPageEditable) {
    $output .= '</div>';
 public function enqueueTtaScript()
 {
     wp_enqueue_script('vc_accordion_script');
     if (!vc_is_page_editable()) {
         wp_enqueue_script('vc_tta_autoplay_script');
     }
 }
Exemple #19
0
function vc_shortcode_custom_css_class($param_value, $prefix = '')
{
    $css_class = preg_match('/\\s*\\.([^\\{]+)\\s*\\{\\s*([^\\}]+)\\s*\\}\\s*/', $param_value) ? $prefix . preg_replace('/\\s*\\.([^\\{]+)\\s*\\{\\s*([^\\}]+)\\s*\\}\\s*/', '$1', $param_value) : '';
    if (vc_is_page_editable()) {
        $css_class .= ' vc-cc-placeholder';
    }
    return $css_class;
}