/**
  * Visual Composer custom view scripts
  * 
  * @since 1.0.0
  */
 function presscore_vc_inline_editor_scripts()
 {
     if (!function_exists('vc_is_inline') || !vc_is_inline()) {
         return;
     }
     wp_enqueue_script('vc-custom-view-by-dt', get_template_directory_uri() . '/inc/shortcodes/js/vc-custom-view.js', array(), false, true);
 }
 function presscore_remove_puny_effect_for_vc_inline_editor($puny_shortcodes = array())
 {
     if (function_exists('vc_is_inline') && vc_is_inline()) {
         return array();
     }
     return $puny_shortcodes;
 }
 public static function load_admin_static()
 {
     wp_enqueue_style('dt-vc-bridge', PRESSCORE_THEME_URI . '/inc/shortcodes/css/js_composer_bridge.css');
     if (function_exists('vc_is_inline') && vc_is_inline()) {
         wp_enqueue_script('vc-custom-view-by-dt', PRESSCORE_THEME_URI . '/inc/shortcodes/js/vc-custom-view.js', array(), false, true);
     }
 }
 function WT_VCSC_IsEditPagePost($new_edit = null)
 {
     global $pagenow, $typenow;
     if (function_exists('vc_is_inline')) {
         $vc_is_inline = vc_is_inline();
         if (!vc_is_inline() && !is_admin()) {
             return false;
         }
     } else {
         $vc_is_inline = false;
         if (!is_admin()) {
             return false;
         }
     }
     if ($new_edit == "edit") {
         return in_array($pagenow, array('post.php'));
     } else {
         if ($new_edit == "new") {
             return in_array($pagenow, array('post-new.php'));
         } else {
             if ($vc_is_inline == true) {
                 return true;
             } else {
                 return in_array($pagenow, array('post.php', 'post-new.php'));
             }
         }
     }
 }
    public function shortcode($atts, $content = null)
    {
        extract(shortcode_atts(array('featured_images' => 'true', 'round_images' => '', 'images_width' => 60, 'images_height' => 60, 'category' => '', 'order' => '', 'orderby' => '', 'number' => 6, 'columns' => 1), $atts));
        // sanitize attributes
        $featured_images = apply_filters('dt_sanitize_flag', $featured_images);
        $round_images = apply_filters('dt_sanitize_flag', $round_images);
        $order = apply_filters('dt_sanitize_order', $order);
        $orderby = apply_filters('dt_sanitize_orderby', $orderby);
        $number = apply_filters('dt_sanitize_posts_per_page', $number);
        $columns = absint($columns);
        $images_width = absint($images_width);
        $images_height = absint($images_height);
        if ($category) {
            $category = explode(',', $category);
            $category = array_map('trim', $category);
        }
        $related_posts_args = array('exclude_current' => false, 'post_type' => 'post', 'taxonomy' => 'category', 'field' => 'slug', 'args' => array('posts_per_page' => $number, 'orderby' => $orderby, 'order' => $order));
        if (!empty($category)) {
            $related_posts_args['cats'] = $category;
            $related_posts_args['select'] = 'only';
        } else {
            $related_posts_args['select'] = 'all';
        }
        $attachments_data = presscore_get_related_posts($related_posts_args);
        $list_args = array('show_images' => $featured_images, 'image_dimensions' => array('w' => $images_width, 'h' => $images_height));
        $posts_list = presscore_get_posts_small_list($attachments_data, $list_args);
        switch ($columns) {
            case 2:
                $column_class = 'wf-1-2';
                break;
            case 3:
                $column_class = 'wf-1-3';
                break;
            case 1:
            default:
                $column_class = 'wf-1';
        }
        $output = '';
        if ($posts_list) {
            foreach ($posts_list as $p) {
                $output .= sprintf('<div class="wf-cell %s"><div class="borders">%s</div></div>', $column_class, $p);
            }
            $section_class = 'items-grid wf-container';
            if ($featured_images && $round_images) {
                $section_class .= ' round-images';
            }
            $output = '<section class="' . $section_class . '">' . $output . '</section>';
        }
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $category, 'taxonomy' => 'category'));
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-mini_blog" style="height: 250px;">
					<h5>Mini blog</h4>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        }
        return $output;
    }
Example #6
0
/**
 * Some shortcodes triks.
 * From: http://www.viper007bond.com/2009/11/22/wordpress-code-earlier-shortcodes/
 */
function dt_get_puny_shortcodes()
{
    $puny_shortcodes = array('dt_gap' => array(DT_Shortcode_Gap::get_instance(), 'shortcode'), 'dt_divider' => array(DT_Shortcode_Divider::get_instance(), 'shortcode'), 'dt_stripe' => array(DT_Shortcode_Stripe::get_instance(), 'shortcode'), 'dt_box' => array(DT_Shortcode_Box::get_instance(), 'shortcode'), 'dt_cell' => array(DT_Shortcode_Columns::get_instance(), 'shortcode_cell'), 'dt_code' => array(DT_Shortcode_Code::get_instance(), 'shortcode_prepare'), 'dt_toggle' => array(DT_Shortcode_Toggles::get_instance(), 'shortcode'), 'dt_item' => array(DT_Shortcode_Accordion::get_instance(), 'shortcode_item'), 'dt_benefits' => array(DT_Shortcode_Benefits::get_instance(), 'shortcode_benefits'), 'dt_benefit' => array(DT_Shortcode_Benefits::get_instance(), 'shortcode_benefit'), 'dt_progress_bars' => array(DT_Shortcode_ProgressBars::get_instance(), 'shortcode_bars'), 'dt_progress_bar' => array(DT_Shortcode_ProgressBars::get_instance(), 'shortcode_bar'), 'dt_button' => array(DT_Shortcode_Button::get_instance(), 'shortcode'), 'dt_teaser' => array(DT_Shortcode_Teaser::get_instance(), 'shortcode'), 'dt_call_to_action' => array(DT_Shortcode_CallToAction::get_instance(), 'shortcode'), 'dt_fancy_image' => array(DT_Shortcode_FancyImage::get_instance(), 'shortcode'), 'dt_list_item' => array(DT_Shortcode_List::get_instance(), 'shortcode_item'), 'dt_list' => array(DT_Shortcode_List::get_instance(), 'shortcode_list'), 'dt_quote' => array(DT_Shortcode_Quote::get_instance(), 'shortcode'), 'dt_banner' => array(DT_Shortcode_Banner::get_instance(), 'shortcode'), 'dt_accordion' => array(DT_Shortcode_Accordion::get_instance(), 'shortcode_accordion'), 'dt_text' => array(DT_Shortcode_AnimatedText::get_instance(), 'shortcode'), 'dt_social_icons' => array(DT_Shortcode_SocialIcons::get_instance(), 'shortcode_icons_content'), 'dt_social_icon' => array(DT_Shortcode_SocialIcons::get_instance(), 'shortcode_icon'), 'dt_vc_list_item' => array(DT_Shortcode_List_Vc::get_instance(), 'shortcode_item'), 'dt_vc_list' => array(DT_Shortcode_List_Vc::get_instance(), 'shortcode_list'));
    if (function_exists('vc_is_inline') && vc_is_inline()) {
        $puny_shortcodes = array();
    }
    return apply_filters('dt_get_puny_shortcodes', $puny_shortcodes);
}
Example #7
0
 protected function initIfActive()
 {
     vc_is_inline() && !defined('CONCATENATE_SCRIPTS') && define('CONCATENATE_SCRIPTS', false);
     if ($this->get('vceditor') === 'true') {
         $this->addFilter('the_content', 'addContentAnchor');
         do_action('vc_inline_editor_page_view');
         $this->addAction('wp_enqueue_scripts', 'loadIFrameJsCss');
     }
 }
    public function shortcode($atts, $content = null)
    {
        extract(shortcode_atts(array('posts' => '', 'width' => '800', 'height' => '450', 'autoplay' => 'false', 'interval' => '5000'), $atts));
        // sanitize attributes
        $width = absint($width);
        $height = absint($height);
        $interval = absint($interval);
        $autoplay = apply_filters('dt_sanitize_flag', $autoplay);
        $posts = array_map('trim', explode(',', $posts));
        $attachments_id = array();
        $selected_posts_titles = array();
        if ($posts) {
            // get posts by slug
            foreach ($posts as $post_slug) {
                $args = array('no_found_rows' => 1, 'ignore_sticky_posts' => 1, 'posts_per_page' => 1, 'post_type' => 'dt_slideshow', 'post_status' => 'publish', 'name' => $post_slug);
                $dt_query = new WP_Query($args);
                if ($dt_query->have_posts()) {
                    $dt_post = $dt_query->posts[0];
                    $selected_posts_titles[] = get_the_title($dt_post);
                    $slides_id = get_post_meta($dt_post->ID, '_dt_slider_media_items', true);
                    if ($slides_id) {
                        $attachments_id = array_merge($attachments_id, $slides_id);
                    }
                }
            }
            // get fresh one
        } else {
            $args = array('no_found_rows' => 1, 'ignore_sticky_posts' => 1, 'posts_per_page' => 1, 'post_type' => 'dt_slideshow', 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC');
            $dt_query = new WP_Query($args);
            if ($dt_query->have_posts()) {
                $dt_post = $dt_query->posts[0];
                $selected_posts_titles[] = get_the_title($dt_post);
                $slides_id = get_post_meta($dt_post->ID, '_dt_slider_media_items', true);
                if ($slides_id) {
                    $attachments_id = array_merge($attachments_id, $slides_id);
                }
            }
        }
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            if (empty($selected_posts_titles)) {
                $dummy_posts_titles = __('No posts selected', 'the7mk2');
            } else {
                $dummy_posts_titles = esc_html(join(', ', $selected_posts_titles));
            }
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-royal_slider" style="height: 250px;">
					<h5>Royal slider</h4>
					<p class="text-small"><strong>Display slider(s):</strong> ' . $dummy_posts_titles . '</p>
				</div>
			';
        } else {
            $attachments_data = presscore_get_attachment_post_data($attachments_id);
            $output = presscore_get_royal_slider($attachments_data, array('width' => $width, 'height' => $height, 'autoplay' => $autoplay, 'interval' => $interval, 'class' => array('slider-simple', 'shortcode-royal-slider'), 'style' => ' style="width: 100%"'));
        }
        return $output;
    }
Example #9
0
 function wpex_is_front_end_composer()
 {
     if (!function_exists('vc_is_inline')) {
         return false;
     } elseif (vc_is_inline()) {
         return true;
     } else {
         return false;
     }
 }
Example #10
0
function custom_css_classes_for_vc_row_and_vc_column($class_string, $tag)
{
    if ($tag == 'vc_row' || $tag == 'vc_row_inner') {
        $class_string = str_replace('vc_row-fluid', 'wf-container', $class_string);
    }
    if ($tag == 'vc_column' || $tag == 'vc_column_inner') {
        if (!(function_exists('vc_is_inline') && vc_is_inline())) {
            $class_string = preg_replace('/vc_span(\\d{1,2})/', 'wf-cell wf-span-$1', $class_string);
        }
    }
    return $class_string;
}
 function __construct()
 {
     add_action('init', array($this, 'swatch_book_init'));
     add_action("wp_enqueue_scripts", array($this, "register_swatch_assets"), 1);
     if (function_exists('vc_is_inline')) {
         if (!vc_is_inline()) {
             add_shortcode('swatch_container', array($this, 'swatch_container'));
             add_shortcode('swatch_item', array($this, 'swatch_item'));
         }
     } else {
         add_shortcode('swatch_container', array($this, 'swatch_container'));
         add_shortcode('swatch_item', array($this, 'swatch_item'));
     }
 }
 function __construct()
 {
     add_action('admin_init', array($this, 'swatch_book_init'));
     add_action('wp_enqueue_scripts', array($this, 'frontend_scripts'));
     if (function_exists('vc_is_inline')) {
         if (!vc_is_inline()) {
             add_shortcode('swatch_container', array($this, 'swatch_container'));
             add_shortcode('swatch_item', array($this, 'swatch_item'));
         }
     } else {
         add_shortcode('swatch_container', array($this, 'swatch_container'));
         add_shortcode('swatch_item', array($this, 'swatch_item'));
     }
 }
 function __construct()
 {
     $this->connector_animate = '';
     $this->connect_color = '';
     $this->icon_style = '';
     $this->icon_style = '';
     add_action('admin_init', array($this, 'add_info_list'));
     if (function_exists('vc_is_inline')) {
         if (!vc_is_inline()) {
             add_shortcode('info_list', array($this, 'info_list'));
             add_shortcode('info_list_item', array($this, 'info_list_item'));
         }
     } else {
         add_shortcode('info_list', array($this, 'info_list'));
         add_shortcode('info_list_item', array($this, 'info_list_item'));
     }
 }
Example #14
0
function symple_skillbar_shortcode($atts)
{
    // Parse and extract shortcode attributes
    extract(shortcode_atts(array('title' => '', 'percentage' => '100', 'color' => '#6adcfa', 'class' => '', 'show_percent' => 'true'), $atts));
    // Define output var
    $output = '';
    // Enque scripts
    wp_enqueue_script('symple_skillbar');
    // Inline js
    if (function_exists('vc_is_inline') && vc_is_inline()) {
        $output .= '<script>
			jQuery(function($){
				$(document).ready(function(){
					$(".symple-skillbar").each(function(){
						$(this).find(".symple-skillbar-bar").animate({ width: $(this).attr("data-percent") }, 800 );
					});
				});
			});</script>';
    }
    // Open skillbar main wrapper
    $output .= '<div class="symple-skillbar symple-clearfix ' . $class . '" data-percent="' . $percentage . '%">';
    // Display title
    if ($title) {
        $output .= '<div class="symple-skillbar-title" style="background: ' . $color . ';"><span>' . $title . '</span></div>';
    }
    // Display bar
    $output .= '<div class="symple-skillbar-bar" style="background: ' . $color . ';"></div>';
    // Display percentage
    if ($show_percent == 'true') {
        $output .= '<div class="symple-skill-bar-percent">' . $percentage . '%</div>';
    }
    // Close main wrapper
    $output .= '</div>';
    // Return output
    return $output;
}
Example #15
0
    /**
     * Portfolio slider.
     *
     */
    public function portfolio_slider($attributes = array())
    {
        $config = Presscore_Config::get_instance();
        $slider_class = array();
        if ('disabled' == $config->get('sidebar_position')) {
            $slider_class[] = 'full';
        }
        $slider_fields = array();
        if ($attributes['show_title']) {
            $slider_fields[] = 'title';
        }
        if ($attributes['meta_info']) {
            $slider_fields[] = 'meta';
        }
        if ($attributes['show_excerpt']) {
            $slider_fields[] = 'description';
        }
        if ($attributes['show_link']) {
            $slider_fields[] = 'link';
        }
        if ($attributes['show_zoom']) {
            $slider_fields[] = 'zoom';
        }
        if ($attributes['show_details']) {
            $slider_fields[] = 'details';
        }
        $slider_style = array();
        if ($attributes['margin_bottom']) {
            $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom'];
        }
        if ($attributes['margin_top']) {
            $slider_style[] = 'margin-top: ' . $attributes['margin_top'];
        }
        $slider_args = array('mode' => $attributes['appearance'], 'fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'under_image_buttons' => $attributes['under_image_buttons'], 'hover_animation' => $attributes['hover_animation'], 'hover_bg_color' => $attributes['hover_bg_color'], 'hover_content_visibility' => $attributes['hover_content_visibility']);
        if ($attributes['height']) {
            $slider_args['height'] = $attributes['height'];
        }
        if ($attributes['width']) {
            $slider_args['img_width'] = $attributes['width'];
        }
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_portfolio_category'));
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-portfolio_scroller" style="height: ' . $slider_args['height'] . 'px;">
					<h5>Portfolio scroller</h5>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        } else {
            $related_posts_args = array('exclude_current' => false, 'post_type' => 'dt_portfolio', 'taxonomy' => 'dt_portfolio_category', 'field' => 'slug', 'args' => array('posts_per_page' => $attributes['number'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order']));
            $related_posts_args['cats'] = $attributes['category'];
            if (!empty($attributes['category'])) {
                $related_posts_args['select'] = 'only';
            } else {
                $related_posts_args['select'] = 'all';
            }
            $attachments_data = presscore_get_related_posts($related_posts_args);
            $output = presscore_get_fullwidth_slider_two_with_hovers($attachments_data, $slider_args);
        }
        return $output;
    }
Example #16
0
 function presscore_vc_is_inline()
 {
     return function_exists('vc_is_inline') && vc_is_inline();
 }
Example #17
0
 /**
  * safe way to call visual composers function vc_is_inline (if we are in the live editor)
  * @return bool|null
  */
 static function vc_is_inline()
 {
     if (function_exists('vc_is_inline')) {
         return vc_is_inline();
     } else {
         return false;
     }
 }
Example #18
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_inline()) {
        $css_class .= ' vc-cc-placeholder';
    }
    return $css_class;
}
Example #19
0
 public function setUpPlugin()
 {
     if (is_plugin_active_for_network('js_composer/js_composer.php') || is_network_only_plugin('js_composer/js_composer.php')) {
         $this->composer->setAsNetworkPlugin(true);
     }
     global $current_user;
     get_currentuserinfo();
     /** @var $settings - get use group access rules */
     $settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
     parent::setUpPlugin();
     $show = true;
     foreach ($current_user->roles as $role) {
         if (isset($settings[$role]['show']) && $settings[$role]['show'] === 'no') {
             $show = false;
             break;
         }
     }
     if ($show) {
         $this->composer->addAction('edit_post', 'saveMetaBoxes');
         $this->composer->addAction('wp_ajax_wpb_get_element_backend_html', 'elementBackendHtmlJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_get_convert_elements_backend_html', 'Convert2NewVersionJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_get_row_element_backend_html', 'elementRowBackendHtmlJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_shortcodes_to_visualComposer', 'shortCodesVisualComposerJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_single_image_src', 'singleImageSrcJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_gallery_html', 'galleryHTMLJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_get_loop_suggestion', 'getLoopSuggestionJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_remove_settings_notification_element_css_class', 'removeSettingsNotificationJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_image_url', 'getImageUrlByIdJavascript_callback');
         /*
          * Create edit form html
          * @deprecated
          */
         $this->composer->addAction('wp_ajax_wpb_show_edit_form', 'showEditFormJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_get_edit_form', 'getEditFormJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_save_template', 'saveTemplateJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_load_template', 'loadTemplateJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_load_inline_template', 'loadInlineTemplateJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_load_template_shortcodes', 'loadTemplateShortcodesJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_delete_template', 'deleteTemplateJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_get_loop_settings', 'getLoopSettingsJavascript_callback');
         $this->composer->addAction('wp_ajax_wpb_activate_license', 'activateLicense');
         $this->composer->addAction('wp_ajax_wpb_deactivate_license', 'deactivateLicense');
         $this->composer->inlineEditor()->addAction('wp_ajax_vc_load_shortcode', 'loadShortcodes');
         $this->composer->inlineEditor()->addAction('wp_ajax_vc_show_edit_form', 'renderEditForm');
         $this->composer->inlineEditor()->addAction('wp_ajax_vc_update_content', 'savePost');
         $this->composer->inlineEditor()->addAction('wp_ajax_vc_inline_template', 'renderTemplate');
         $this->composer->inlineEditor()->addAction('wp_ajax_vc_show_inline_edit_form', 'buildInlineEditForm');
         $this->addAction('admin_init', 'jsComposerEditPage', 5);
         $this->composer->inlineEditor()->addFilter('page_row_actions', 'renderRowAction');
         $this->composer->inlineEditor()->addFilter('post_row_actions', 'renderRowAction');
     }
     vc_automapper()->addAction('wp_ajax_vc_automapper', 'goAction');
     if (vc_is_inline()) {
         $this->composer->inlineEditor()->addFilter('vc_single_param_edit', 'changeEditFormFieldParams');
         $this->composer->inlineEditor()->addFilter('vc_edit_form_class', 'changeEditFormParams');
     }
     $this->composer->addAction('admin_init', 'renderInlineEditor');
     // Add specific CSS class by filter
     $this->addFilter('body_class', 'jsComposerBodyClass');
     $this->addFilter('get_media_item_args', 'jsForceSend');
     $this->addAction('admin_init', 'composerRedirect');
     $this->addAction('admin_init', 'registerCss');
     $this->addAction('admin_init', 'registerJavascript');
     if ($this->composer->isNetworkPlugin() && is_network_admin()) {
         $this->addAction('network_admin_menu', 'composerSettings');
     }
     $this->addAction('admin_menu', 'composerSettings');
     $this->addAction('admin_print_scripts-post.php', 'editScreen_js');
     $this->addAction('admin_print_scripts-post-new.php', 'editScreen_js');
     // Upgrade message in plugins list.
     if ($this->composer->updaterDisabled()) {
         return $this;
     }
     $plugin_file_name = 'js_composer/js_composer.php';
     new WpbAutoUpdate(WPB_VC_VERSION, 'http://wpbakery.com/version/?' . time(), $plugin_file_name);
     $this->addAction('in_plugin_update_message-' . $plugin_file_name, 'addUpgradeMessageLink');
 }
if ($wpex_query->have_posts()) {
    // Extract attributes
    extract($atts);
    // Load scripts
    $inline_js = array('carousel');
    if ('lightbox' == $thumbnail_link) {
        vcex_enque_style('ilightbox');
        $inline_js[] = 'ilightbox';
    }
    vcex_inline_js($inline_js);
    // Disable auto play if there is only 1 post
    if ('1' == count($wpex_query->posts)) {
        $auto_play = false;
    }
    // Prevent auto play in visual composer
    if (vc_is_inline()) {
        $auto_play = 'false';
    }
    // Item Margin
    if ('no-margins' == $style) {
        $items_margin = '0';
    }
    // Items to scroll fallback for old setting
    if ('page' == $items_scroll) {
        $items_scroll = $items;
    }
    // Main Classes
    $wrap_classes = array('wpex-carousel', 'wpex-carousel-post-type', 'wpex-clr', 'owl-carousel');
    if ($style) {
        $wrap_classes[] = $style;
    }
Example #21
0
 function EssGridCheckVc()
 {
     if (function_exists('vc_is_inline') && vc_is_inline()) {
         require_once EG_PLUGIN_PATH . '/admin/essential-grid-admin.class.php';
         Essential_Grid_Admin::add_to_VC();
     }
 }
 function TS_VCSC_RegisterWithComposer()
 {
     if (function_exists('vc_is_inline')) {
         if (vc_is_inline() == true || is_admin()) {
             $this->TS_VCSC_AddParametersToComposer();
             $this->TS_VCSC_AddElementsToComposer();
         } else {
             if (vc_is_inline() == NULL || vc_is_inline() == '') {
                 if (TS_VCSC_CheckFrontEndEditor() == true) {
                     $this->TS_VCSC_AddParametersToComposer();
                     $this->TS_VCSC_AddElementsToComposer();
                 } else {
                     $this->TS_VCSC_LoadClassElements();
                 }
             } else {
                 $this->TS_VCSC_LoadClassElements();
             }
         }
     } else {
         if (is_admin()) {
             $this->TS_VCSC_AddParametersToComposer();
             $this->TS_VCSC_AddElementsToComposer();
         } else {
             $this->TS_VCSC_LoadClassElements();
         }
     }
 }
Example #23
0
 function TS_VCSC_FancyTabs_Single($atts, $content = null)
 {
     global $VISUAL_COMPOSER_EXTENSIONS;
     ob_start();
     extract(shortcode_atts(array('title' => '', 'icon' => '', 'animation_type' => 'hover', 'animation_class' => '', 'customize' => 'false', 'color_tab' => '#9bd7d5', 'hover_tab' => '#70c5c2', 'color_text' => '#ffffff', 'hover_text' => '#ffffff', 'color_icon' => '#ffffff', 'hover_icon' => '#ffffff', 'watch' => 'false', 'resize' => 'false', 'tab_id' => '', 'el_class' => '', 'css' => ''), $atts));
     // Check for Front End Editor
     if (function_exists('vc_is_inline')) {
         if (vc_is_inline()) {
             $icontabs_frontend = "true";
         } else {
             $icontabs_frontend = "false";
         }
     } else {
         $icontabs_frontend = "false";
     }
     $output = '';
     $el_class = str_replace(".", "", $el_class);
     if (function_exists('vc_shortcode_custom_css_class')) {
         $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $el_class . ' ' . vc_shortcode_custom_css_class($css, ' '), 'TS_VCSC_Fancy_Tabs_Single', $atts);
     } else {
         $css_class = $el_class;
     }
     if (!empty($tab_id)) {
         if ($icontabs_frontend == "false") {
             if ($animation_class != '') {
                 $icon_animation = 'ts-' . $animation_type . '-css-' . $animation_class . '';
             } else {
                 $icon_animation = '';
             }
             $output .= '<div class="' . $css_class . '" data-pws-tab="tab-' . $tab_id . '" data-pws-tab-name="' . $title . '" data-pws-tab-watch="' . $watch . '" data-pws-tab-resize="' . $resize . '" data-pws-tab-icon="' . $icon . '" data-pws-tab-trigger="' . $animation_type . '" data-pws-tab-animation="' . $icon_animation . '">';
             $output .= do_shortcode($content);
             $output .= '</div>';
         } else {
             $output .= '<div id="ts-frontend-editor-' . $tab_id . '" class="ts-frontend-editor-tab-single clearFixMe" style="padding-top: 10px;">';
             $output .= do_shortcode($content);
             $output .= '</div>';
         }
     }
     echo $output;
     $myvariable = ob_get_clean();
     return $myvariable;
 }
 function TS_VCSC_IconWall_Item($atts, $content = null)
 {
     global $VISUAL_COMPOSER_EXTENSIONS;
     ob_start();
     extract(shortcode_atts(array('replace' => 'false', 'icon' => '', 'image' => '', 'title' => '', 'animation_type' => 'none', 'animation_class' => '', 'el_id' => '', 'el_class' => '', 'css' => ''), $atts));
     // Check for Front End Editor
     if (function_exists('vc_is_inline')) {
         if (vc_is_inline()) {
             $wall_frontend = "true";
         } else {
             $wall_frontend = "false";
         }
     } else {
         $wall_frontend = "false";
     }
     $output = '';
     $el_class = str_replace(".", "", $el_class);
     if (function_exists('vc_shortcode_custom_css_class')) {
         $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $el_class . ' ' . vc_shortcode_custom_css_class($css, ' '), 'TS_VCSC_Icon_Wall_Item', $atts);
     } else {
         $css_class = $el_class;
     }
     if ($wall_frontend == "false") {
         $output .= '<div id="" class="ts-icon-wall-items-content-single ' . $css_class . '" data-index="" style="display: none;">';
         if ($title != '') {
             $output .= '<h5 class="ts-icon-wall-items-content-title">' . $title . '</h5>';
         }
         $output .= '<div class="ts-icon-wall-items-content-message">';
         $output .= do_shortcode($content);
         $output .= '</div>';
         $output .= '</div>';
     } else {
         $output .= '<div id="" class="ts-icon-wall-items-content-single-edit" data-index="" style="display: block;">';
         $output .= '<div class="ts-icon-wall-items-icon-single-edit">';
         $output .= '<i class="' . $icon . '"></i>';
         $output .= '</div>';
         if ($title != '') {
             $output .= '<h5 class="ts-icon-wall-items-content-title">' . $title . '</h5>';
         }
         $output .= '<div class="ts-icon-wall-items-content-message">';
         $output .= do_shortcode($content);
         $output .= '</div>';
         $output .= '</div>';
     }
     echo $output;
     $myvariable = ob_get_clean();
     return $myvariable;
 }
Example #25
0
function wpex_is_front_end_composer()
{
    if (function_exists('vc_is_inline')) {
        return vc_is_inline();
    }
}
 /**
  * @return bool
  */
 public function isInline()
 {
     return vc_is_inline();
 }
$margin_bottom = isset($atts['margin_bottom']) ? $atts['margin_bottom'] : '';
$border_color = isset($atts['border_color']) ? $atts['border_color'] : '';
// Get and extract shortcode attributes
$atts = vc_map_get_attributes($this->getShortcode(), $atts);
extract($atts);
// Sanitize data & declare main vars
$url = esc_url($url);
$inline_js = array();
$css_wrap_classes = array('vcex-icon-box-css-wrap');
$clickable_boxes = array('four', 'five', 'six');
$url_wrap = in_array($style, $clickable_boxes) ? 'true' : $url_wrap;
$image = $image ? wp_get_attachment_url($image) : '';
$icon = $image ? '' : vcex_get_icon_class($atts, 'icon');
$heading_type = $heading_type ? $heading_type : 'h2';
// Match Height Inline JS
if (vc_is_inline() && false !== strpos($classes, 'equal-height-content')) {
    $inline_js[] = 'equal_height_content';
}
// Icon functions
if ($icon) {
    // Load icon family CSS
    vcex_enqueue_icon_font($icon_type);
    // Icon Style
    $icon_style = array();
    $icon_style['color'] = $icon_color;
    $icon_style['width'] = $icon_width;
    $icon_style['font_size'] = $icon_size;
    $icon_style['border_radius'] = $icon_border_radius;
    $icon_style['background'] = $icon_background;
    $icon_style['height'] = $icon_height;
    if ($icon_height) {
function WooComposer_Loop_style04($atts, $element)
{
    global $woocommerce;
    $product_style = $display_elements = $quick_view_style = $img_animate = $text_align = $color_heading = $color_categories = $color_price = '';
    $color_rating = $color_rating_bg = $color_quick_bg = $color_quick = $color_cart_bg = $color_cart = $color_product_desc = $advanced_opts = '';
    $color_product_desc_bg = $size_title = $size_cat = $size_price = $color_on_sale = $color_on_sale_bg = $label_on_sale = $product_animation = '';
    $disp_type = $category = $output = $product_style = $border_style = $border_color = $border_size = $border_radius = $lazy_images = $pagination = '';
    $sale_price = $shortcode = $on_sale_alignment = $on_sale_style = $product_img_disp = '';
    extract(shortcode_atts(array("disp_type" => "", "category" => "", "shortcode" => "", "product_style" => "style01", "display_elements" => "", "quick_view_style" => "expandable", "label_on_sale" => "Sale!", "text_align" => "left", "img_animate" => "rotate-clock", "pagination" => "", "color_heading" => "", "color_categories" => "", "color_price" => "", "color_rating" => "", "color_rating_bg" => "", "color_quick_bg" => "", "color_quick" => "", "color_cart_bg" => "", "color_on_sale_bg" => "", "color_on_sale" => "", "color_cart" => "", "color_product_desc" => "", "color_product_desc_bg" => "", "size_title" => "", "size_cat" => "", "size_price" => "", "border_style" => "", "border_color" => "", "border_size" => "", "border_radius" => "", "product_animation" => "", "lazy_images" => "", "advanced_opts" => "", "sale_price" => "", "on_sale_style" => "wcmp-sale-circle", "on_sale_alignment" => "wcmp-sale-right", "product_img_disp" => "single"), $atts));
    $output = $heading_style = $cat_style = $price_style = $cart_style = $cart_bg_style = $view_style = $view_bg_style = $rating_style = '';
    $desc_style = $label_style = $on_sale = $class = $style = $border = $desc_style = $sale_price_size = '';
    $image_size = apply_filters('single_product_large_thumbnail_size', 'shop_single');
    $img_animate = 'wcmp-img-' . $img_animate;
    if ($sale_price !== '') {
        $sale_price_size = 'font-size:' . $sale_price . 'px;';
    }
    if ($border_style !== '') {
        $border .= 'border:' . $border_size . 'px ' . $border_style . ' ' . $border_color . ';';
        $border .= 'border-radius:' . $border_radius . 'px;';
    }
    if ($color_product_desc_bg !== '') {
        $desc_style .= 'background:' . $color_product_desc_bg . ';';
    }
    if ($color_product_desc !== '') {
        $desc_style .= 'color:' . $color_product_desc . ';';
    }
    $columns = 3;
    $display_type = $disp_type;
    if ($color_heading !== "") {
        $heading_style = 'color:' . $color_heading . ';';
    }
    if ($size_title !== "") {
        $heading_style .= 'font-size:' . $size_title . 'px;';
    }
    if ($color_categories !== "") {
        $cat_style = 'color:' . $color_categories . ';';
    }
    if ($size_cat !== "") {
        $cat_style .= 'font-size:' . $size_cat . 'px;';
    }
    if ($color_price !== "") {
        $price_style = 'color:' . $color_price . ';';
    }
    if ($size_price !== "") {
        $price_style .= 'font-size:' . $size_price . 'px;';
    }
    if ($color_rating !== "") {
        $rating_style .= 'color:' . $color_rating . ';';
    }
    if ($color_rating_bg !== "") {
        $rating_style .= 'background:' . $color_rating_bg . ';';
    }
    if ($color_quick_bg !== "") {
        $view_bg_style = 'background:' . $color_quick_bg . ';';
    }
    if ($color_quick !== "") {
        $view_style = 'color:' . $color_quick . ';';
    }
    if ($color_cart_bg !== "") {
        $cart_bg_style = 'background:' . $color_cart_bg . ';';
    }
    if ($color_cart !== "") {
        $cart_style = 'color:' . $color_cart . ';';
    }
    if ($color_on_sale_bg !== "") {
        $label_style = 'background:' . $color_on_sale_bg . ';';
    }
    if ($color_on_sale !== "") {
        $label_style .= 'color:' . $color_on_sale . ';';
    }
    $elemets = explode(",", $display_elements);
    if ($element == "grid") {
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    } else {
        $paged = 1;
    }
    $post_count = '12';
    /* $output .= do_shortcode($content); */
    if ($shortcode !== '') {
        $new_shortcode = rawurldecode(base64_decode(strip_tags($shortcode)));
    }
    $pattern = get_shortcode_regex();
    $shortcode_str = $short_atts = '';
    preg_match_all("/" . $pattern . "/", $new_shortcode, $matches);
    $shortcode_str = str_replace('"', '', str_replace(" ", "&", trim($matches[3][0])));
    $short_atts = parse_str($shortcode_str);
    //explode("&",$shortcode_str);
    if (isset($matches[2][0])) {
        $display_type = $matches[2][0];
    } else {
        $display_type = '';
    }
    if (!isset($columns)) {
        $columns = '4';
    }
    if (isset($per_page)) {
        $post_count = $per_page;
    }
    if (isset($number)) {
        $post_count = $number;
    }
    if (!isset($order)) {
        $order = 'asc';
    }
    if (!isset($orderby)) {
        $orderby = 'date';
    }
    if (!isset($category)) {
        $category = '';
    }
    if (!isset($ids)) {
        $ids = '';
    }
    if ($ids) {
        $ids = explode(',', $ids);
        $ids = array_map('trim', $ids);
    }
    $col = $columns;
    if ($columns == "2") {
        $columns = 6;
    } elseif ($columns == "3") {
        $columns = 4;
    } elseif ($columns == "4") {
        $columns = 3;
    }
    $meta_query = '';
    if ($display_type == "recent_products") {
        $meta_query = WC()->query->get_meta_query();
    }
    if ($display_type == "featured_products") {
        $meta_query = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes'));
    }
    if ($display_type == "top_rated_products") {
        add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
        $meta_query = WC()->query->get_meta_query();
    }
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $post_count, 'orderby' => $orderby, 'order' => $order, 'paged' => $paged, 'meta_query' => $meta_query);
    if ($display_type == "sale_products") {
        $product_ids_on_sale = woocommerce_get_product_ids_on_sale();
        $meta_query = array();
        $meta_query[] = $woocommerce->query->visibility_meta_query();
        $meta_query[] = $woocommerce->query->stock_status_meta_query();
        $args['meta_query'] = $meta_query;
        $args['post__in'] = $product_ids_on_sale;
    }
    if ($display_type == "best_selling_products") {
        $args['meta_key'] = 'total_sales';
        $args['orderby'] = 'meta_value_num';
        $args['meta_query'] = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'));
    }
    if ($display_type == "product_category") {
        $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => array(esc_attr($category)), 'field' => 'slug', 'operator' => 'IN'));
    }
    if ($display_type == "product_categories") {
        $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'terms' => $ids, 'field' => 'term_id', 'operator' => 'IN'));
    }
    $test = '';
    if (vc_is_inline()) {
        $test = "wcmp_vc_inline";
    }
    if ($product_animation == '') {
        $product_animation = 'no-animation';
    } else {
        $style .= 'opacity:1;';
    }
    if ($element == "grid") {
        $class = 'vc_span' . $columns . ' ';
    }
    $output .= '<div class="woocomposer ' . $test . '" data-columns="' . $col . '">';
    $query = new WP_Query($args);
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $product_id = get_the_ID();
            $uid = uniqid();
            $output .= '<div id="product-' . $uid . '" style="' . $style . '" class="' . $class . ' wpb_column column_container wooproduct" data-animation="animated ' . $product_animation . '">';
            if ($element == 'carousel') {
                $output .= '<div class="wcmp-carousel-item">';
            }
            $product_title = get_the_title($product_id);
            $post = get_post($product_id);
            $product_desc = get_post($product_id)->post_excerpt;
            $product_img = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), $image_size);
            $product = new WC_Product($product_id);
            $attachment_ids = $product->get_gallery_attachment_ids();
            $price = $product->get_price_html();
            $rating = $product->get_rating_html();
            $attributes = $product->get_attributes();
            $stock = $product->is_in_stock() ? 'InStock' : 'OutOfStock';
            if ($product->is_on_sale()) {
                $on_sale = apply_filters('woocommerce_sale_flash', $label_on_sale, $post, $product);
            } else {
                $on_sale = '';
            }
            if ($quick_view_style == "expandable") {
                $quick_view_class = 'quick-view-loop';
            } else {
                $quick_view_class = 'quick-view-loop-popup';
            }
            $cat_count = sizeof(get_the_terms($product_id, 'product_cat'));
            $tag_count = sizeof(get_the_terms($product_id, 'product_tag'));
            $categories = $product->get_categories(', ', '<span class="posted_in">' . _n('', '', $cat_count, 'woocommerce') . ' ', '.</span>');
            $tags = $product->get_tags(', ', '<span class="tagged_as">' . _n('', '', $tag_count, 'woocommerce') . ' ', '.</span>');
            $output .= "\n" . '<div class="wcmp-product woocommerce wcmp-' . $product_style . ' ' . $img_animate . '" style="' . $border . ' ' . $desc_style . '">';
            $output .= "\n\t" . '<div class="wcmp-product-image">';
            if (empty($attachment_ids) && count($attachment_ids) > 1 && $product_img_disp == "carousel") {
                $uniqid = uniqid();
                $output .= '<div class="wcmp-single-image-carousel carousel-in-loop">';
                $product_img = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), $image_size);
                if ($lazy_images == "enable") {
                    $src = plugins_url('../assets/img/loader.gif', __FILE__);
                } else {
                    $src = $product_img[0];
                }
                $output .= '<div><div class="wcmp-image"><img class="wcmp-img" src="' . $src . '" data-src="' . $product_img[0] . '"/></div></div>';
                foreach ($attachment_ids as $attachment_id) {
                    $product_img = wp_get_attachment_image_src($attachment_id, $image_size);
                    if ($lazy_images == "enable") {
                        $src = plugins_url('../assets/img/loader.gif', __FILE__);
                    } else {
                        $src = $product_img[0];
                    }
                    $output .= '<div><div class="wcmp-image"><img class="wcmp-img" src="' . $src . '" data-src="' . $product_img[0] . '"/></div></div>';
                }
                $output .= '</div>';
            } else {
                $product_img = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), $image_size);
                if ($lazy_images == "enable") {
                    $src = plugins_url('../assets/img/loader.gif', __FILE__);
                } else {
                    $src = $product_img[0];
                }
                $output .= '<a href="' . get_permalink($product_id) . '"><img class="wcmp-img" src="' . $src . '" data-src="' . $product_img[0] . '"/></a>';
            }
            if ($stock == 'OutOfStock') {
                $output .= "\n" . '<span class="wcmp-out-stock">' . __('Out Of Stock!', 'woocomposer') . '</span>';
            }
            if ($on_sale !== '') {
                $output .= "\n" . '<div class="wcmp-onsale ' . $on_sale_alignment . ' ' . $on_sale_style . '"><span class="onsale" style="' . $label_style . ' ' . $sale_price_size . '">' . $on_sale . '</span></div>';
            }
            $output .= '<div class="wcmp-add-to-cart" style="' . $cart_bg_style . '"><a style="' . $cart_style . '" title="Add to Cart" href="?add-to-cart=' . $product_id . '" rel="nofollow" data-product_id="' . $product_id . '" data-product_sku="" class="add_to_cart_button product_type_simple"><i class="wooicon-cart4"></i></a></div>';
            if (in_array("quick", $elemets)) {
                $output .= '<div class="wcmp-quick-view ' . $quick_view_class . '" style="' . $view_bg_style . '"><a style="' . $view_style . '" title="Quick View" href="' . get_permalink($product_id) . '"><i class="wooicon-plus32"></i></a></div>';
            }
            if (in_array("reviews", $elemets)) {
                $output .= "\n" . '<div class="wcmp-star-ratings" style="' . $rating_style . '">' . $rating . '</div>';
            }
            $output .= '</div>';
            $output .= "\n\t" . '<div class="wcmp-product-desc">';
            $output .= '<a href="' . get_permalink($product_id) . '">';
            $output .= "\n\t\t" . '<h2 style="' . $heading_style . '">' . $product_title . '</h2>';
            $output .= '</a>';
            if (in_array("category", $elemets)) {
                $output .= '<h5 style="' . $cat_style . '">';
                if ($categories !== '') {
                    $output .= $categories;
                    $output .= $tags;
                }
                $output .= '</h5>';
            }
            $output .= "\n\t\t" . '<div class="wcmp-price"><span class="price" style="' . $price_style . '">' . $price . '</span></div>';
            if (in_array("description", $elemets)) {
                $output .= "\n\t\t" . '<div class="wcmp-product-content" style="' . $desc_style . '">' . $product_desc . '</div>';
            }
            $output .= "\n\t" . '</div>';
            $output .= "\n\t" . '</div>';
            if (in_array("quick", $elemets)) {
                $output .= '<div class="wcmp-quick-view-wrapper woocommerce" data-columns="' . $col . '">';
                if ($quick_view_style !== "expandable") {
                    $output .= '<div class="wcmp-quick-view-wrapper woocommerce product">';
                    $output .= '<div class="wcmp-close-single"><i class="wooicon-cross2"></i></div>';
                }
                $product_img = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), $image_size);
                if ($lazy_images == "enable") {
                    $src = plugins_url('../assets/img/loader.gif', __FILE__);
                } else {
                    $src = $product_img[0];
                }
                $output .= '<div class="wcmp-single-image wcmp-quickview-img images"><img class="wcmp-img" src="' . $src . '" data-src="' . $product_img[0] . '"/></div>';
                if ($quick_view_style !== "expandable") {
                    $output .= '<div class="wcmp-product-content-single">';
                } else {
                    $output .= '<div class="wcmp-product-content">';
                }
                ob_start();
                do_action('woocommerce_single_product_summary');
                $output .= ob_get_clean();
                $output .= '</div>';
                $output .= '<div class="clear"></div>';
                if ($quick_view_style !== "expandable") {
                    $output .= '</div>';
                }
                $output .= '</div>';
            }
            $output .= "\n" . '</div>';
            if ($element == 'carousel') {
                $output .= "\n\t" . '</div>';
            }
        }
    }
    if ($pagination == "enable") {
        $output .= '<div class="wcmp-paginate">';
        $output .= woocomposer_pagination($query->max_num_pages);
        $output .= '</div>';
    }
    $output .= '</div>';
    if ($display_type == "top_rated_products") {
        remove_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
    }
    wp_reset_postdata();
    return $output;
}
Example #29
0
 public function addElementsList()
 {
     return '<ul class="wpb-content-layouts-container" style="position: relative;">
             ' . $this->getContentCategoriesLayouts() . (!vc_is_inline() ? '<li><input id="vc_elements_name_filter" type="text" name="vc_content_filter" placeholder="' . __('Search by element name', LANGUAGE_ZONE) . '"/></li>' : '') . $this->getContentLayouts() . '
         </ul>';
 }
Example #30
0
} else {
    $attachments = array_combine($attachments, $attachments);
}
//Output images
if ($attachments) {
    // Load scripts
    $inline_js = array('slider_pro');
    if ('lightbox' == $thumbnail_link) {
        vcex_enque_style('ilightbox', $lightbox_skin);
        $inline_js[] = 'ilightbox';
    }
    vcex_inline_js($inline_js);
    // Sanitize data and declare main vars
    $caption_data = array();
    $wrap_data = array();
    $slideshow = vc_is_inline() ? 'false' : $slideshow;
    // Slider attributes
    if (in_array($animation, array('fade', 'fade_slides'))) {
        $wrap_data[] = 'data-fade="true"';
    }
    if ('true' == $randomize) {
        $wrap_data[] = 'data-shuffle="true"';
    }
    if ('true' == $loop) {
        $wrap_data[] = ' data-loop="true"';
    }
    if ('false' == $slideshow) {
        $wrap_data[] = 'data-auto-play="false"';
    }
    if ($slideshow && $slideshow_speed) {
        $wrap_data[] = 'data-auto-play-delay="' . $slideshow_speed . '"';