Example #1
0
 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);
     //$value = __($value, "js_composer");
     //
     $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']) == false || $param['holder'] == 'hidden') {
         $output .= '<input type="hidden" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '" />';
         if ($param['type'] == 'attach_image') {
             $img = wpb_getImageBySize(array('attach_id' => (int) preg_replace('/[^\\d]/', '', $value), 'thumb_size' => 'thumbnail'));
             $output .= ($img ? $img['thumbnail'] : '<img width="150" height="150" src="' . WPBakeryVisualComposer::getInstance()->assetURL('vc/blank.gif') . '" class="attachment-thumbnail"  data-name="' . $param_name . '" alt="" title="" style="display: none;" />') . '<img src="' . WPBakeryVisualComposer::getInstance()->assetURL('vc/elements_icons/single_image.png') . '" class="no_image_image' . ($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>';
         } else {
             if ($param['type'] == 'attach_video') {
                 $img = wpb_getImageBySize(array('attach_id' => (int) preg_replace('/[^\\d]/', '', $value), 'thumb_size' => 'thumbnail'));
                 $output .= ($img ? $img['thumbnail'] : '<img width="150" height="150" src="' . WPBakeryVisualComposer::getInstance()->assetURL('vc/blank.gif') . '" class="attachment-thumbnail"  data-name="' . $param_name . '" alt="" title="" style="display: none;" />') . '<img src="' . WPBakeryVisualComposer::getInstance()->assetURL('vc/elements_icons/single_image.png') . '" class="no_image_image' . ($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>';
             }
         }
     } else {
         $output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
     }
     return $output;
 }
Example #2
0
 public function jsCssScripts()
 {
     // wp_register_script('vc_bxslider', WPBakeryVisualComposer::getInstance()->assetURL('lib/bxslider-4/jquery.bxslider.min.js'));
     // wp_register_style('vc_bxslider_css', WPBakeryVisualComposer::getInstance()->assetURL('lib/bxslider-4/jquery.bxslider.css'));
     wp_register_script('vc_swiper', WPBakeryVisualComposer::getInstance()->assetURL('lib/swiper/dist/idangerous.swiper-2.2.js'), array(), time());
     wp_register_style('vc_swiper_css', WPBakeryVisualComposer::getInstance()->assetURL('lib/swiper/dist/idangerous.swiper.css'));
 }
Example #3
0
 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);
     //$value = __($value, LANGUAGE_ZONE);
     //
     $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']) == true && $param['holder'] !== 'hidden') {
         $output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
     }
     if ($param_name == 'images') {
         $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="' . WPBakeryVisualComposer::getInstance()->assetURL('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', LANGUAGE_ZONE) . '</a>';
     }
     return $output;
 }
Example #4
0
/**
 * Sets plugin as theme plugin.
 * @param bool $disable_updater - If value is true disables auto updater options.
 */
function vc_set_as_theme($disable_updater = false)
{
    $composer = WPBakeryVisualComposer::getInstance();
    $composer->setSettingsAsTheme();
    if ($disable_updater) {
        $composer->disableUpdater();
    }
}
Example #5
0
 public function init($settings)
 {
     parent::init($settings);
     $this->composer = WPBakeryVisualComposer::getInstance();
     $this->composer->createColumnShortCode();
     // Refactored
     $this->addAction('init', 'setUp');
 }
Example #6
0
 function __construct($dir)
 {
     $this->dir = $dir;
     $this->base_url = plugin_basename($this->dir);
     $this->composer = WPBakeryVisualComposer::getInstance();
     $this->addAction('admin_bar_menu', "adminBarEditLink", 1000);
     $this->setPost();
     $this->initIfActive();
 }
Example #7
0
 public function jsCssScripts()
 {
     // wp_register_script('vc_bxslider', WPBakeryVisualComposer::getInstance()->assetURL('lib/bxslider-4/jquery.bxslider.min.js'));
     // wp_register_style('vc_bxslider_css', WPBakeryVisualComposer::getInstance()->assetURL('lib/bxslider-4/jquery.bxslider.css'));
     // wp_register_script('vc_swiper', WPBakeryVisualComposer::getInstance()->assetURL('lib/swiper/dist/idangerous.swiper-2.2.js'), array(), time());
     // wp_register_style('vc_swiper_css', WPBakeryVisualComposer::getInstance()->assetURL('lib/swiper/dist/idangerous.swiper.css'));
     wp_register_script('vc_transition_bootstrap_js', WPBakeryVisualComposer::getInstance()->assetURL('lib/vc_carousel/js/transition.js'), array(), time());
     wp_register_script('vc_carousel_js', WPBakeryVisualComposer::getInstance()->assetURL('lib/vc_carousel/js/vc_carousel.js'), array('vc_transition_bootstrap_js'), time());
     wp_register_style('vc_carousel_css', WPBakeryVisualComposer::getInstance()->assetURL('lib/vc_carousel/css/vc_carousel.css'));
     // try bootstap http://jsfiddle.net/HHsxc/2/
 }
Example #8
0
 public function init($settings)
 {
     parent::init($settings);
     $this->composer = WPBakeryVisualComposer::getInstance();
     $this->composer->createColumnShortCode();
     // Refactored
     $this->composer->setTheme();
     $this->setUpTheme();
     if (function_exists('add_theme_support')) {
         add_theme_support('post-thumbnails', array('page'));
     }
     load_plugin_textdomain('js_composer', false, self::$config['APP_ROOT'] . '/locale/');
     add_post_type_support('page', 'excerpt');
 }
 /**
  * Find html template for shortcode output.
  */
 protected function findShortcodeTemplate()
 {
     // Check template path in shortcode's mapping settings
     if (!empty($this->settings['html_template']) && is_file($this->settings('html_template'))) {
         return $this->setTemplate($this->settings['html_template']);
     }
     // Check template in theme directory
     $user_template = WPBakeryVisualComposer::getUserTemplate($this->getFilename() . '.php');
     if (is_file($user_template)) {
         return $this->setTemplate($user_template);
     }
     // Check default place
     $default_dir = $this->getVcTableDefaultDir();
     if (is_file($default_dir . $this->getFilename() . '.php')) {
         return $this->setTemplate($default_dir . $this->getFilename() . '.php');
     }
 }
 public function singleParamHtmlHolder($param, $value, $settings = array(), $atts = array())
 {
     $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);
     //$value 		= __($value, "ts_visual_composer_extend");
     //
     $param_name = isset($param['param_name']) ? $param['param_name'] : '';
     $heading = isset($param['heading']) ? $param['heading'] : '';
     $type = isset($param['type']) ? $param['type'] : '';
     $class = isset($param['class']) ? $param['class'] : '';
     if (isset($param['holder']) === true && in_array($param['holder'], array('div', 'span', 'p', 'pre', 'code'))) {
         $output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
     } else {
         if (isset($param['holder']) === true && $param['holder'] == 'input') {
             $output .= '<' . $param['holder'] . ' readonly="true" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '">';
         } else {
             if (isset($param['holder']) === true && in_array($param['holder'], array('img', 'iframe'))) {
                 if (!empty($value)) {
                     $output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" src="' . $value . '">';
                 }
             } else {
                 if (isset($param['holder']) === true && $param['holder'] == 'imagelist') {
                     $images_ids = empty($value) ? array() : explode(',', trim($value));
                     $output .= '<ul style="margin-top: 5px;" 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="' . WPBakeryVisualComposer::getInstance()->assetURL('vc/blank.gif') . '" class="attachment-thumbnail" alt="" title="" /></li>';
                     }
                     $output .= '</ul>';
                     $output .= '<a style="max-width: 100%; display: block;" href="#" class="column_edit_trigger' . (!empty($images_ids) ? ' image-exists' : '') . '" style="margin-bottom: 10px;">' . __('Add or Remove Image(s)', "ts_visual_composer_extend") . '</a>';
                 }
             }
         }
     }
     if (isset($param['admin_label']) && $param['admin_label'] === true) {
         $output .= '<span style="max-width: 100%; display: block;" class="vc_admin_label admin_label_' . $param['param_name'] . (empty($value) ? ' hidden-label' : '') . '"><label>' . $param['heading'] . '</label>: ' . $value . '</span>';
     }
     return $output;
 }
Example #11
0
 public function getTemplatePath($key)
 {
     $template = isset($this->templates[$key]) ? $this->templates[$key] : false;
     if (!$template) {
         return false;
     }
     // Check template path in shortcode's mapping settings
     if (is_array($template) && isset($template['path']) && !empty($template['path'])) {
         return $template['path'];
     }
     // Check template in theme directory
     $user_template = WPBakeryVisualComposer::getUserTemplate($this->getFileName($key));
     if (is_file($user_template)) {
         return $this->setTemplate($key, $user_template);
     }
     // Check default place
     $default_dir = WPBakeryVisualComposer::defaultTemplatesDIR();
     if (is_file($default_dir . $this->getFilename($key))) {
         return $this->setTemplate($key, $default_dir . $this->getFileName($key));
     }
 }
 public function singleParamHtmlHolder($param, $value, $settings = array(), $atts = array())
 {
     $output = '';
     $param_name = isset($param['param_name']) ? $param['param_name'] : '';
     $heading = isset($param['heading']) ? $param['heading'] : '';
     $type = isset($param['type']) ? $param['type'] : '';
     $class = isset($param['class']) ? $param['class'] : '';
     if (isset($param['holder']) === true && in_array($param['holder'], array('div', 'span', 'p', 'pre', 'code'))) {
         $output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
     } else {
         if (isset($param['holder']) === true && $param['holder'] == 'input') {
             $output .= '<' . $param['holder'] . ' readonly="true" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '">';
         } else {
             if (isset($param['holder']) === true && $param['holder'] == 'img') {
                 $img = wpb_getImageBySize(array('attach_id' => (int) preg_replace('/[^\\d]/', '', $value), 'thumb_size' => 'thumbnail'));
                 $output .= $img ? $img['thumbnail'] : '<img width="150" height="150" src="' . vc_asset_url('vc/blank.gif') . '" class="attachment-thumbnail ts_vcsc_holder_image"  data-name="' . $param_name . '" alt="" title="" style="display: none;" />';
             } else {
                 if (isset($param['holder']) === true && $param['holder'] == 'imagelist') {
                     $images_ids = empty($value) ? array() : explode(',', trim($value));
                     $output .= '<ul style="margin-top: 5px;" 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="' . WPBakeryVisualComposer::getInstance()->assetURL('vc/blank.gif') . '" class="attachment-thumbnail" alt="" title="" /></li>';
                     }
                     $output .= '</ul>';
                 }
             }
         }
     }
     if (isset($param['admin_label']) && $param['admin_label'] === true) {
         $output .= '<span style="max-width: 100%; display: block;" class="vc_admin_label admin_label_' . $param['param_name'] . (empty($value) ? ' hidden-label' : '') . '"><label>' . $param['heading'] . '</label>: ' . $value . '</span>';
     }
     if ('dropdown' === $param['type'] && 'type' === $param_name) {
         $output .= '<a style="max-width: 100%; display: block;" href="#" class="column_edit_trigger" style="margin-bottom: 10px;">' . __('Add, Change or Remove Image(s)', "ts_visual_composer_extend") . '</a>';
     }
     return $output;
 }
Example #13
0
    public function output($post = null)
    {
        $output = $this->getNavBar()->getElementsModal();
        $output .= $this->getNavBar()->output();
        $output .= '
        <div class="metabox-composer-content">
					<div id="wpb-convert-message">
					   <div class="messagebox_text"><p>' . __('Your page layout was created with previous Visual Composer version. Before converting your layout to the new version, make sure to <a target="_blank" href="http://kb.wpbakery.com/index.php?title=Update_Visual_Composer_from_3.4_to_3.5">read this page</a>.', LANGUAGE_ZONE) . '</p>
					     <div class="wpb-convert-buttons">
					       <a class="wpb_convert button" id="wpb-convert"><i class="icon"></i>' . __('Convert to new version', LANGUAGE_ZONE) . '</a>
					     </div>
					 </div>
				</div>
				
				<div class="vc_loading_block" style="display: none;">
				  <img src="' . get_site_url() . '/wp-admin/images/wpspin_light.gif" /> ' . __("Loading, please wait...", LANGUAGE_ZONE) . '
				</div>
				
				<div id="visual_composer_content" class="wpb_main_sortable main_wrapper"></div>
					<div id="wpb-empty-blocks">
					 <h2>' . __("No content yet! You should add some...", LANGUAGE_ZONE) . '</h2>
					 <table class="helper-block">
					   <tr>
					     <td><span>1</span></td>
					     <td><p> ' . __("This is a visual preview of your page. Currently, you don't have any content elements. Click or drag the button <a href='#' class='add-element-to-layout'><i class='icon'></i> Add element</a> on the top to add content elements on your page. Alternatively add <a href='#' class='add-text-block-to-content' parent-container='#visual_composer_content'><i class='icon'></i> Text block</a> with single click.", LANGUAGE_ZONE) . '</p></td>
					   </tr>
					 </table>
					 <table class="helper-block">
					   <tr>
					     <td><span>2</span></td><td><p class="one-line"> ' . __("Click the pencil icon on the content elements to change their properties.", LANGUAGE_ZONE) . '</p></td>
					   </tr>
					   <tr>
					     <td colspan="2">
					       <div class="edit-picture"></div>
					     </td>
					   </tr>
					 </table>
				  </div>
				</div>
				<div id="container-helper-block" style="display: none;">' . $this->getContainerHelper() . '</div>';
        ?>
        <script type="text/javascript">
            var vc_user_mapper = <?php 
        echo json_encode(WPBMap::getUserShortCodes());
        ?>
,
                vc_mapper = <?php 
        echo json_encode(WPBMap::getShortCodes());
        ?>
;
        </script>
        <?php 
        $wpb_vc_status = get_post_meta($post->ID, '_wpb_vc_js_status', true);
        $wpb_post_custom_css = get_post_meta($post->ID, '_wpb_post_custom_css', true);
        if ($wpb_vc_status == "" || !isset($wpb_vc_status)) {
            $wpb_vc_status = 'false';
        }
        $output .= '<input type="hidden" id="wpb_custom_post_css_field" name="wpb_vc_post_custom_css" value="' . htmlspecialchars($wpb_post_custom_css) . '" />';
        $output .= '<input type="hidden" id="wpb_vc_js_status" name="wpb_vc_js_status" value="' . $wpb_vc_status . '" />';
        $output .= '<input type="hidden" id="wpb_vc_loading" name="wpb_vc_loading" value="' . __("Loading, please wait...", LANGUAGE_ZONE) . '" />';
        $output .= '<input type="hidden" id="wpb_vc_loading_row" name="wpb_vc_loading_row" value="' . __("Crunching...", LANGUAGE_ZONE) . '" />';
        $output .= '<input type="hidden" id="wpb_vc_js_interface_version" name="wpb_vc_js_interface_version" value="' . vc_get_initerface_version() . '" />';
        echo $output;
        require_once WPBakeryVisualComposer::config('COMPOSER') . 'templates/media_editor.php';
        require_once WPBakeryVisualComposer::config('COMPOSER') . 'lib/params/loop/templates.html';
        require_once WPBakeryVisualComposer::config('COMPOSER') . 'lib/params/options/templates.html';
    }
 public static function uploadURL()
 {
     $upload_dir = wp_upload_dir();
     return $upload_dir['baseurl'] . WPBakeryVisualComposer::uploadDir();
 }
Example #15
0
/**
 * WPBakery Visual Composer helpers functions
 *
 * @package WPBakeryVisualComposer
 *
 */
function visual_composer()
{
    return WPBakeryVisualComposer::getInstance();
}
Example #16
0
 public static function dropShortcode($name)
 {
     unset(self::$sc[$name]);
     WPBakeryVisualComposer::getInstance()->removeShortCode($name);
 }
Example #17
0
 public function contentAdmin($atts, $content = null)
 {
     $width = '';
     extract(shortcode_atts(array('width' => 'column_12'), $atts));
     $output = '';
     $column_controls = $this->getColumnControls('size_delete');
     if ($width == 'column_14' || $width == '1/4') {
         $width = array('span3');
     } else {
         if ($width == 'column_14-14-14-14') {
             $width = array('span3', 'span3', 'span3', 'span3');
         } else {
             if ($width == 'column_14-12-14') {
                 $width = array('span3', 'span6', 'span3');
             } else {
                 if ($width == 'column_12-14-14') {
                     $width = array('span6', 'span3', 'span3');
                 } else {
                     if ($width == 'column_14-14-12') {
                         $width = array('span3', 'span3', 'span6');
                     } else {
                         if ($width == 'column_13' || $width == '1/3') {
                             $width = array('span4');
                         } else {
                             if ($width == 'column_13-23') {
                                 $width = array('span4', 'span8');
                             } else {
                                 if ($width == 'column_23-13') {
                                     $width = array('span8', 'span4');
                                 } else {
                                     if ($width == 'column_13-13-13') {
                                         $width = array('span4', 'span4', 'span4');
                                     } else {
                                         if ($width == 'column_12' || $width == '1/2') {
                                             $width = array('span6');
                                         } else {
                                             if ($width == 'column_12-12') {
                                                 $width = array('span6', 'span6');
                                             } else {
                                                 if ($width == 'column_23' || $width == '2/3') {
                                                     $width = array('span8');
                                                 } else {
                                                     if ($width == 'column_34' || $width == '3/4') {
                                                         $width = array('span9');
                                                     } else {
                                                         $width = array('span12');
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     for ($i = 0; $i < count($width); $i++) {
         $output .= '<div class="wpb_vc_column wpb_sortable wpb_droppable ' . $width[$i] . ' not-column-inherit">';
         $output .= '<input type="hidden" class="wpb_vc_sc_base" name="" value="vc_column" />';
         $output .= str_replace("%column_size%", wpb_translateColumnWidthToFractional($width[$i]), $column_controls);
         $output .= '<div class="wpb_element_wrapper">';
         $output .= '<div class="row-fluid wpb_column_container wpb_sortable_container not-column-inherit">';
         $output .= do_shortcode(shortcode_unautop($content));
         $output .= WPBakeryVisualComposer::getInstance()->getLayout()->getContainerHelper();
         $output .= '</div>';
         $output .= '</div>';
         $output .= '</div>';
     }
     return $output;
 }
Example #18
0
 public static function setUserTemplate($dir)
 {
     self::$user_template_dir = preg_replace('/\\/$/', '', $dir);
     self::$use_custom_user_template_dir = true;
 }
function td_vc_init()
{
    // Force Visual Composer to initialize as "built into the theme". This will hide certain tabs under the Settings->Visual Composer page
    if (function_exists('vc_set_as_theme')) {
        vc_set_as_theme(true);
    }
    if (function_exists('wpb_map')) {
        //map all of our blocks in page builder
        td_global_blocks::wpb_map_all();
    }
    if (function_exists('vc_disable_frontend')) {
        vc_disable_frontend();
    }
    // @todo - this may not be requiered anynmore
    if (class_exists('WPBakeryVisualComposer')) {
        //disable visual composer updater
        $td_composer = WPBakeryVisualComposer::getInstance();
        $td_composer->disableUpdater();
    }
}
Example #20
0
 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 ($width == 'column_14' || $width == '1/4') {
         $width = array('span3');
     } else {
         if ($width == 'column_14-14-14-14') {
             $width = array('span3', 'span3', 'span3', 'span3');
         } else {
             if ($width == 'column_13' || $width == '1/3') {
                 $width = array('span4');
             } else {
                 if ($width == 'column_13-23') {
                     $width = array('span4', 'span8');
                 } else {
                     if ($width == 'column_13-13-13') {
                         $width = array('span4', 'span4', 'span4');
                     } else {
                         if ($width == 'column_12' || $width == '1/2') {
                             $width = array('span6');
                         } else {
                             if ($width == 'column_12-12') {
                                 $width = array('span6', 'span6');
                             } else {
                                 if ($width == 'column_23' || $width == '2/3') {
                                     $width = array('span8');
                                 } else {
                                     if ($width == 'column_34' || $width == '3/4') {
                                         $width = array('span9');
                                     } else {
                                         if ($width == 'column_16' || $width == '1/6') {
                                             $width = array('span2');
                                         } else {
                                             $width = array('');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     for ($i = 0; $i < count($width); $i++) {
         $output .= '<div class="group wpb_sortable">';
         $output .= '<h3><span class="tab-label"><%= params.title %></span></h3>';
         $output .= '<div ' . $this->mainHtmlBlockParams($width, 0) . '>';
         $output .= str_replace("%column_size%", wpb_translateColumnWidthToFractional($width[0]), $column_controls);
         $output .= '<div class="wpb_element_wrapper">';
         $output .= '<div ' . $this->containerHtmlBlockParams($width, 0) . '>';
         $output .= '<%= params.text %>';
         $output .= do_shortcode(shortcode_unautop($content));
         $output .= WPBakeryVisualComposer::getInstance()->getLayout()->getContainerHelper();
         $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 __construct($settings)
 {
     parent::__construct($settings);
     WPBakeryVisualComposer::getInstance()->addShortCode(array('base' => 'vc_accordion_tab'));
 }
/**
 * Force Visual Composer to initialize as "built into the theme". This will hide certain tabs under the Settings->Visual Composer page
 */
if (function_exists('vc_set_as_theme')) {
    vc_set_as_theme();
}
if (function_exists('wpb_map')) {
    //map all of our blocks in page builder
    td_global_blocks::wpb_map_all();
}
if (function_exists('vc_disable_frontend')) {
    vc_disable_frontend();
}
if (class_exists('WPBakeryVisualComposer')) {
    //disable visual composer updater
    $td_composer = WPBakeryVisualComposer::getInstance();
    $td_composer->disableUpdater();
}
/*
to enable all the visual composer features from a child theme, declare an empty td_disable_visual_composer_features function like so in the child's functions.php:

function td_disable_visual_composer_features() {
}
*/
if (!function_exists('td_disable_visual_composer_features')) {
    function td_disable_visual_composer_features()
    {
        //if you want to enable all the features from visual composer delete this code
        if (function_exists('vc_remove_element')) {
            //remove unused composer elements;
            vc_remove_element("vc_separator");
Example #23
0
 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 ($width == 'column_14' || $width == '1/4') {
         $width = array('span3');
     } else {
         if ($width == 'column_14-14-14-14') {
             $width = array('span3', 'span3', 'span3', 'span3');
         } else {
             if ($width == 'column_13' || $width == '1/3') {
                 $width = array('span4');
             } else {
                 if ($width == 'column_13-23') {
                     $width = array('span4', 'span8');
                 } else {
                     if ($width == 'column_13-13-13') {
                         $width = array('span4', 'span4', 'span4');
                     } else {
                         if ($width == 'column_12' || $width == '1/2') {
                             $width = array('span6');
                         } else {
                             if ($width == 'column_12-12') {
                                 $width = array('span6', 'span6');
                             } else {
                                 if ($width == 'column_23' || $width == '2/3') {
                                     $width = array('span8');
                                 } else {
                                     if ($width == 'column_34' || $width == '3/4') {
                                         $width = array('span9');
                                     } else {
                                         if ($width == 'column_16' || $width == '1/6') {
                                             $width = array('span2');
                                         } else {
                                             $width = array('');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     for ($i = 0; $i < count($width); $i++) {
         $output .= '<div class="group wpb_sortable">';
         $output .= '<div class="wpb_element_wrapper">';
         $output .= '<div class="row-fluid wpb_row_container not-row-inherit">';
         $output .= '<h3 class="accordion_header"><a href="#">' . $title . '</a></h3>';
         $output .= '<div ' . $this->mainHtmlBlockParams($width, $i) . '>';
         $output .= '<input type="hidden" class="wpb_vc_sc_base" name="" value="' . $this->settings['base'] . '" />';
         $output .= str_replace("%column_size%", wpb_translateColumnWidthToFractional($width[$i]), $column_controls);
         $output .= '<div class="wpb_element_wrapper">';
         $output .= '<div class="row-fluid wpb_column_container wpb_sortable_container wpb_' . $this->settings['base'] . '_container wpb_container_block wpb_no_content_element_inside wpb_nested_accordion_inside wpb_nested_tabs_inside">';
         $output .= do_shortcode(shortcode_unautop($content));
         $output .= WPBakeryVisualComposer::getInstance()->getLayout()->getContainerHelper();
         $output .= '</div>';
         if (isset($this->settings['params'])) {
             $inner = '';
             foreach ($this->settings['params'] as $param) {
                 $param_value = ${$param}['param_name'];
                 //var_dump($param_value);
                 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>';
         $output .= '</div>';
         $output .= '</div>';
     }
     return $output;
 }
Example #24
0
 public static function getUserTemplate($template)
 {
     if (empty(self::$user_template_dir)) {
         $dir_name = isset(WPBakeryVisualComposer::$config['USER_DIR_NAME']) ? WPBakeryVisualComposer::$config['USER_DIR_NAME'] : 'vc_templates';
         self::$user_template_dir = get_template_directory() . '/' . $dir_name . '/';
     }
     return self::$user_template_dir . $template;
 }
Example #25
0
 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 = WPBakeryVisualComposer::getUserTemplate($template_path);
     if (is_file($user_template)) {
         return $user_template;
     }
     // Check default place
     $default_dir = WPBakeryVisualComposer::defaultTemplatesDIR();
     if (is_file($default_dir . $template_path)) {
         return $default_dir . $template_path;
     }
     return $template_path;
 }
Example #26
0
 public function jsScripts()
 {
     wp_register_script('progressCircle', WPBakeryVisualComposer::getInstance()->assetURL('lib/progress-circle/ProgressCircle.js'));
     wp_register_script('vc_pie', WPBakeryVisualComposer::getInstance()->assetURL('js/jquery.vc_chart.js'), array('jquery', 'progressCircle'));
     //wp_enqueue_script('vc_pie');
 }
Example #27
0
 public function registerJavascript()
 {
     wp_register_script('isotope', $this->composer->assetURL('lib/isotope/jquery.isotope.min.js'), array('jquery'), WPB_VC_VERSION, true);
     wp_register_script('wpb_bootstrap_modals_js', $this->composer->assetURL('lib/bootstrap_modals/js/bootstrap.min.js'), array('jquery'), WPB_VC_VERSION, true);
     wp_register_script('wpb_scrollTo_js', $this->composer->assetURL('lib/scrollTo/jquery.scrollTo.min.js'), array('jquery'), WPB_VC_VERSION, true);
     wp_register_script('wpb_php_js', $this->composer->assetURL('lib/php.default/php.default.min.js'), array('jquery'), WPB_VC_VERSION, true);
     wp_register_script('wpb_json-js', $this->composer->assetURL('lib/json-js/json2.js'), false, WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_tools', $this->composer->assetURL('js/backend/composer-tools.js'), array('jquery', 'backbone', 'wpb_json-js'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_atts', $this->composer->assetURL('js/backend/composer-atts.js'), array('wpb_js_composer_js_tools'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_storage', $this->composer->assetURL('js/backend/composer-storage.js'), array('wpb_js_composer_js_atts'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_models', $this->composer->assetURL('js/backend/composer-models.js'), array('wpb_js_composer_js_storage'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_view', $this->composer->assetURL('js/backend/composer-view.js'), array('wpb_js_composer_js_models'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_custom_views', $this->composer->assetURL('js/backend/composer-custom-views.js'), array('wpb_js_composer_js_view'), WPB_VC_VERSION, true);
     wp_register_script('wpb_jscomposer_media_editor_js', $this->composer->assetURL('js/backend/media-editor.js'), array('wpb_js_composer_js_view'), WPB_VC_VERSION, true);
     wp_register_script('wpb_jscomposer_autosuggest_js', $this->composer->assetURL('lib/autosuggest/jquery.autoSuggest.js'), array('wpb_js_composer_js_view'), WPB_VC_VERSION, true);
     wp_register_script('wpb_jscomposer_teaser_js', WPBakeryVisualComposer::getInstance()->assetURL('js/backend/composer-teaser.js'), array(), WPB_VC_VERSION, true);
     wp_localize_script('wpb_js_composer_js_view', 'i18nLocale', array('add_remove_picture' => __('Add/remove picture', 'js_composer'), 'finish_adding_text' => __('Finish Adding Images', 'js_composer'), 'add_image' => __('Add Image', 'js_composer'), 'add_images' => __('Add Images', 'js_composer'), 'client' => __('Client', 'js_composer'), 'column' => __('Column', 'js_composer'), 'item' => __('Item', 'js_composer'), 'main_button_title' => __('Visual Composer', 'js_composer'), 'main_button_title_revert' => __('Classic editor', 'js_composer'), 'please_enter_templates_name' => __('Please enter templates name', 'js_composer'), 'confirm_deleting_template' => __('Confirm deleting "{template_name}" template, press Cancel to leave. This action cannot be undone.', 'js_composer'), 'press_ok_to_delete_section' => __('Press OK to delete section, Cancel to leave', 'js_composer'), 'drag_drop_me_in_column' => __('Drag and drop me in the column', 'js_composer'), 'press_ok_to_delete_tab' => __('Press OK to delete "{tab_name}" tab, Cancel to leave', 'js_composer'), 'slide' => __('Slide', 'js_composer'), 'tab' => __('Tab', 'js_composer'), 'testimonial' => __('Testimonial', 'js_composer'), 'section' => __('Section', 'js_composer'), 'please_enter_new_tab_title' => __('Please enter new tab title', 'js_composer'), 'press_ok_delete_section' => __('Press OK to delete "{tab_name}" section, Cancel to leave', 'js_composer'), 'section_default_title' => __('Section', 'js_composer'), 'please_enter_section_title' => __('Please enter new section title', 'js_composer'), 'error_please_try_again' => __('Error. Please try again.', 'js_composer'), 'if_close_data_lost' => __('If you close this window all shortcode settings will be lost. Close this window?', 'js_composer'), 'header_select_element_type' => __('Select element type', 'js_composer'), 'header_media_gallery' => __('Media gallery', 'js_composer'), 'header_element_settings' => __('Element settings', 'js_composer'), 'add_tab' => __('Add tab', 'js_composer'), 'are_you_sure_convert_to_new_version' => __('Are you sure you want to convert to new version?', 'js_composer'), 'loading' => __('Loading...', 'js_composer'), 'set_image' => __('Set Image', 'js_composer'), 'are_you_sure_reset_css_classes' => __('Are you sure taht you want to remove all your data?', 'js_composer'), 'loop_frame_title' => __('Loop settings'), 'enter_custom_layout' => __('Enter custom layout for your row:', 'js_composer'), 'wrong_cells_layout' => __('Wrong row layout format! Example: 1/2 + 1/2 or span6 + span6.', 'js_composer'), 'row_background_color' => __('Row background color', 'js_composer'), 'row_background_image' => __('Row background image', 'js_composer')));
     wp_register_script('wpb_js_theme_admin', $this->composer->assetURL('js/theme_admin.js'), array('jquery'), WPB_VC_VERSION, true);
 }
Example #28
0
 public function registerJavascript()
 {
     wp_register_script('isotope', $this->composer->assetURL('lib/isotope/jquery.isotope.min.js'), array('jquery'), WPB_VC_VERSION, true);
     wp_register_script('wpb_bootstrap_modals_js', $this->composer->assetURL('lib/bootstrap_modals/js/bootstrap.min.js'), array('jquery'), WPB_VC_VERSION, true);
     wp_register_script('wpb_scrollTo_js', $this->composer->assetURL('lib/scrollTo/jquery.scrollTo.min.js'), array('jquery'), WPB_VC_VERSION, true);
     wp_register_script('wpb_php_js', $this->composer->assetURL('lib/php.default/php.default.min.js'), array('jquery'), WPB_VC_VERSION, true);
     wp_register_script('wpb_json-js', $this->composer->assetURL('lib/json-js/json2.js'), false, WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_tools', $this->composer->assetURL('js/backend/composer-tools.js'), array('jquery', 'backbone', 'wpb_json-js'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_atts', $this->composer->assetURL('js/backend/composer-atts.js'), array('wpb_js_composer_js_tools'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_storage', $this->composer->assetURL('js/backend/composer-storage.js'), array('wpb_js_composer_js_atts'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_models', $this->composer->assetURL('js/backend/composer-models.js'), array('wpb_js_composer_js_storage'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_view', $this->composer->assetURL('js/backend/composer-view.js'), array('wpb_js_composer_js_models'), WPB_VC_VERSION, true);
     wp_register_script('wpb_js_composer_js_custom_views', $this->composer->assetURL('js/backend/composer-custom-views.js'), array('wpb_js_composer_js_view'), WPB_VC_VERSION, true);
     wp_register_script('wpb_jscomposer_media_editor_js', $this->composer->assetURL('js/backend/media-editor.js'), array('media-views', 'media-editor', 'mce-view', 'wpb_js_composer_js_view'), WPB_VC_VERSION, true);
     wp_register_script('wpb_jscomposer_autosuggest_js', $this->composer->assetURL('lib/autosuggest/jquery.autoSuggest.js'), array('wpb_js_composer_js_view'), WPB_VC_VERSION, true);
     wp_register_script('wpb_jscomposer_teaser_js', WPBakeryVisualComposer::getInstance()->assetURL('js/backend/composer-teaser.js'), array(), WPB_VC_VERSION, true);
     wp_localize_script('wpb_js_composer_js_view', 'i18nLocale', array('add_remove_picture' => __('Add/remove picture', 'js_composer'), 'finish_adding_text' => __('Finish Adding Images', 'js_composer'), 'add_image' => __('Add Image', 'js_composer'), 'add_images' => __('Add Images', 'js_composer'), 'main_button_title' => __('Visual Composer', 'js_composer'), 'main_button_title_backend_editor' => __('BACKEND EDITOR', 'js_composer'), 'main_button_title_frontend_editor' => __('FRONTEND EDITOR', 'js_composer'), 'main_button_title_revert' => __('CLASSIC MODE', 'js_composer'), 'please_enter_templates_name' => __('Please enter template name', 'js_composer'), 'confirm_deleting_template' => __('Confirm deleting "{template_name}" template, press Cancel to leave. This action cannot be undone.', 'js_composer'), 'press_ok_to_delete_section' => __('Press OK to delete section, Cancel to leave', 'js_composer'), 'drag_drop_me_in_column' => __('Drag and drop me in the column', 'js_composer'), 'press_ok_to_delete_tab' => __('Press OK to delete "{tab_name}" tab, Cancel to leave', 'js_composer'), 'slide' => __('Slide', 'js_composer'), 'tab' => __('Tab', 'js_composer'), 'section' => __('Section', 'js_composer'), 'please_enter_new_tab_title' => __('Please enter new tab title', 'js_composer'), 'press_ok_delete_section' => __('Press OK to delete "{tab_name}" section, Cancel to leave', 'js_composer'), 'section_default_title' => __('Section', 'js_composer'), 'please_enter_section_title' => __('Please enter new section title', 'js_composer'), 'error_please_try_again' => __('Error. Please try again.', 'js_composer'), 'if_close_data_lost' => __('If you close this window all shortcode settings will be lost. Close this window?', 'js_composer'), 'header_select_element_type' => __('Select element type', 'js_composer'), 'header_media_gallery' => __('Media gallery', 'js_composer'), 'header_element_settings' => __('Element settings', 'js_composer'), 'add_tab' => __('Add tab', 'js_composer'), 'are_you_sure_convert_to_new_version' => __('Are you sure you want to convert to new version?', 'js_composer'), 'loading' => __('Loading...', 'js_composer'), 'set_image' => __('Set Image', 'js_composer'), 'are_you_sure_reset_css_classes' => __('Are you sure taht you want to remove all your data?', 'js_composer'), 'loop_frame_title' => __('Loop settings'), 'enter_custom_layout' => __('Enter custom layout for your row:', 'js_composer'), 'wrong_cells_layout' => __('Wrong row layout format! Example: 1/2 + 1/2 or span6 + span6.', 'js_composer'), 'row_background_color' => __('Row background color', 'js_composer'), 'row_background_image' => __('Row background image', 'js_composer'), 'guides_on' => __('Guides ON', 'js_composer'), 'guides_off' => __('Guides OFF', 'js_composer'), 'template_save' => __('New template successfully saved!', 'js_composer'), 'template_added' => __('Template added to the page.', 'js_composer'), 'template_is_empty' => __('Nothing to save. Template is empty.', 'js_composer'), 'css_updated' => __('Page settings updated!', 'js_composer'), 'update_all' => __('Update all', 'js_composer'), 'confirm_to_leave' => __('The changes you made will be lost if you navigate away from this page.', 'js_composer'), 'inline_element_saved' => __('%s saved!', 'js_composer'), 'inline_element_deleted' => __('%s deleted!', 'js_composer'), 'inline_element_cloned' => __('%s cloned. <a href="#" class="vc-edit-cloned" data-model-id="%s">Edit now?</a>', 'js_composer')));
     wp_register_script('wpb_js_theme_admin', $this->composer->assetURL('js/theme_admin.js'), array('jquery'), WPB_VC_VERSION, true);
 }
Example #29
0
/**
 * Sets directory where Visual Composer should look for template files for content elements
 * @param string full directory path to new template directory with trailing slash
 */
function vc_set_template_dir($dir)
{
    WPBakeryVisualComposer::setUserTemplate($dir);
}
Example #30
0
 public function loadDefaultParams()
 {
     global $vc_params_list;
     if (empty($vc_params_list)) {
         return false;
     }
     $script_url = WPBakeryVisualComposer::getInstance()->assetURL('js/params/all.js');
     foreach ($vc_params_list as $param) {
         add_shortcode_param($param, 'vc_' . $param . '_form_field', $script_url);
     }
 }