/**
  * 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 = vc_manager()->getShortcodesTemplateDir($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');
     }
 }
Exemple #2
0
    /**
     * Themes Content types checkboxes list callback function
     * @deprecated 4.8
     */
    public function theme_content_types_field_callback()
    {
        // _deprecated_function( '\Vc_Settings::theme_content_types_field_callback', '4.8 (will be removed in 4.11)' );
        $pt_array = ($pt_array = get_option('wpb_js_theme_content_types')) ? $pt_array : vc_manager()->editorPostTypes();
        foreach ($this->getPostTypes() as $pt) {
            if (!in_array($pt, $this->getExcluded())) {
                $checked = in_array($pt, $pt_array) ? ' checked' : '';
                ?>
				<label>
					<input type="checkbox"<?php 
                echo $checked;
                ?>
 value="<?php 
                echo $pt;
                ?>
"
					       id="wpb_js_post_types_<?php 
                echo $pt;
                ?>
"
					       name="<?php 
                echo self::$field_prefix . 'theme_content_types';
                ?>
[]">
					<?php 
                echo $pt;
                ?>
				</label><br>
			<?php 
            }
        }
        ?>
		<p
			class="description indicator-hint"><?php 
        _e('Select content types available to Visual Composer.', 'js_composer');
        ?>
</p>
	<?php 
    }
/**
 * Get access manager for current user.
 * HowTo: vc_user_access()->->with('editor')->can('frontend_editor');
 * @since 4.8
 * @return Vc_Current_User_Access;
 */
function vc_user_access()
{
    return vc_manager()->getCurrentUserAccess();
}
Exemple #4
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 = vc_shortcodes_theme_templates_dir( $template_path );

		if ( is_file( $user_template ) ) {
			return $user_template;
		}
		// Check default place
		$default_dir = vc_manager()->getDefaultShortcodesTemplatesDir() . '/';
		if ( is_file( $default_dir . $template_path ) ) {
			return $default_dir . $template_path;
		}
		return $template_path;
	}
/**
 * Plugin name for VC.
 *
 * @since 4.2
 * @return string
 */
function vc_plugin_name()
{
    return vc_manager()->pluginName();
}
    /**
     * Themes Content types checkboxes list callback function
     */
    public function theme_content_types_field_callback()
    {
        $pt_array = ($pt_array = get_option('wpb_js_theme_content_types')) ? $pt_array : vc_manager()->editorPostTypes();
        foreach ($this->getPostTypes() as $pt) {
            if (!in_array($pt, $this->getExcluded())) {
                $checked = in_array($pt, $pt_array) ? ' checked="checked"' : '';
                ?>
			<label>
				<input type="checkbox"<?php 
                echo $checked;
                ?>
 value="<?php 
                echo $pt;
                ?>
"
					   id="wpb_js_post_types_<?php 
                echo $pt;
                ?>
"
					   name="<?php 
                echo self::$field_prefix . 'theme_content_types';
                ?>
[]">
				<?php 
                echo $pt;
                ?>
			</label><br>
			<?php 
            }
        }
        ?>
	<p
	  class="description indicator-hint"><?php 
        _e("Select for which content types Visual Composer should be available during post creation/editing.", LANGUAGE_ZONE);
        ?>
</p>
	<?php 
    }
 /**
  * @param $template
  *
  * @deprecated
  * @return string
  */
 public static function getUserTemplate($template)
 {
     return vc_manager()->getShortcodesTemplateDir($template);
 }
Exemple #8
0
            }
        } else {
            $img_id = preg_replace('/[^\\d]/', '', $image);
        }
        // set rectangular
        if (preg_match('/_circle_2$/', $style)) {
            $style = preg_replace('/_circle_2$/', '_circle', $style);
            $img_size = $this->getImageSquareSize($img_id, $img_size);
        }
        if (!$img_size) {
            $img_size = 'medium';
        }
        $img = wpb_getImageBySize(array('attach_id' => $img_id, 'thumb_size' => $img_size, 'class' => 'vc_single_image-img'));
        // don't show placeholder in public version if post doesn't have featured image
        if ('featured_image' === $source) {
            if (!$img && 'page' === vc_manager()->mode()) {
                return;
            }
        }
        break;
    case 'external_link':
        $dimensions = vcExtractDimensions($external_img_size);
        $hwstring = $dimensions ? image_hwstring($dimensions[0], $dimensions[1]) : '';
        $custom_src = $custom_src ? esc_attr($custom_src) : $default_src;
        $img = array('thumbnail' => '<img class="vc_single_image-img" ' . $hwstring . ' src="' . $custom_src . '" />');
        break;
    default:
        $img = false;
}
if (!$img) {
    $img['thumbnail'] = '<img class="vc_img-placeholder vc_single_image-img" src="' . $default_src . '" />';
Exemple #9
0
 /**
  * @param $template
  *
  * @todo remove this (comment added on 4.8) also remove helpers
  * @deprecated 4.3
  * @return string
  */
 public static function getUserTemplate($template)
 {
     _deprecated_function('WPBakeryVisualComposer getUserTemplate', '4.3', 'Vc_Base getShortcodesTemplateDir');
     return vc_manager()->getShortcodesTemplateDir($template);
 }
Exemple #10
0
<?php

if (us_is_vc_fe()) {
    $default_dir = vc_manager()->getDefaultShortcodesTemplatesDir() . '/';
    if (is_file($default_dir . 'vc_tabs.php')) {
        include $default_dir . 'vc_tabs.php';
        return;
    }
}
$attributes = shortcode_atts(array('timeline' => '', 'type' => '', 'el_class' => ''), $atts);
global $first_tab, $first_tab_title, $auto_open, $is_timeline;
$auto_open = TRUE;
$first_tab_title = TRUE;
$first_tab = TRUE;
if ($attributes['el_class'] != '') {
    $attributes['el_class'] = ' ' . $attributes['el_class'];
}
//$type_class = ($attributes['type'] != '')?' type_'.$attributes['type']:' type_1';
if ($attributes['timeline'] == 'yes') {
    $is_timeline = TRUE;
    $content_titles = str_replace('[vc_tab', '[timepoint_title', $content);
    $content_titles = str_replace('[/vc_tab', '[/timepoint_title', $content_titles);
    $output = '<div class="w-timeline' . $attributes['el_class'] . '"><div class="w-timeline-list">' . do_shortcode($content_titles) . '</div><div class="w-timeline-sections">' . do_shortcode($content) . '</div></div>';
} else {
    $is_timeline = FALSE;
    $tabs_id = 'tabs_' . rand(99999, 999999);
    $tabs_id_string = ' id="' . $tabs_id . '"';
    $content_titles = str_replace('[vc_tab', '[item_title', $content);
    $content_titles = str_replace('[/vc_tab', '[/item_title', $content_titles);
    $output = '<div class="w-tabs' . $attributes['el_class'] . '"' . $tabs_id_string . '><div class="w-tabs-list">' . do_shortcode($content_titles) . '</div>' . do_shortcode($content) . '</div>';
}
Exemple #11
0
 /**
  * Get custom theme template path
  * @since 4.2
  *
  * @param $template - filename for template
  *
  * @return string
  */
 function vc_shortcodes_theme_templates_dir($template)
 {
     return vc_manager()->getShortcodesTemplateDir($template);
 }
 /**
  * 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 = vc_shortcodes_theme_templates_dir($this->getFilename() . '.php');
     $parent_user_template = vc_shortcodes_theme_parent_templates_dir($this->getFilename() . '.php');
     //echo $user_template;
     if (is_file($user_template)) {
         return $this->setTemplate($user_template);
     } else {
         if (is_file($parent_user_template)) {
             return $this->setTemplate($parent_user_template);
         }
     }
     // Check default place
     $default_dir = vc_manager()->getDefaultShortcodesTemplatesDir() . '/';
     if (is_file($default_dir . $this->getFilename() . '.php')) {
         return $this->setTemplate($default_dir . $this->getFilename() . '.php');
     }
 }
 function x_visual_composer_is_front_end_editor()
 {
     return function_exists('vc_manager') && vc_manager()->mode() == 'page_editable';
 }
Exemple #14
0
function disable_updater()
{
    vc_manager()->disableUpdater();
}