本文整理汇总了PHP中WPBakeryVisualComposer类的典型用法代码示例。如果您正苦于以下问题:PHP WPBakeryVisualComposer类的具体用法?PHP WPBakeryVisualComposer怎么用?PHP WPBakeryVisualComposer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WPBakeryVisualComposer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: singleParamHtmlHolder
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;
}
示例2: jsCssScripts
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'));
}
示例3: singleParamHtmlHolder
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;
}
示例4: vc_set_as_theme
/**
* 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();
}
}
示例5: init
public function init($settings)
{
parent::init($settings);
$this->composer = WPBakeryVisualComposer::getInstance();
$this->composer->createColumnShortCode();
// Refactored
$this->addAction('init', 'setUp');
}
示例6: __construct
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();
}
示例7: jsCssScripts
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/
}
示例8: init
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');
}
示例9: findShortcodeTemplate
/**
* 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');
}
}
示例10: singleParamHtmlHolder
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;
}
示例11: getTemplatePath
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));
}
}
示例12: singleParamHtmlHolder
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;
}
示例13: output
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';
}
示例14: uploadURL
public static function uploadURL()
{
$upload_dir = wp_upload_dir();
return $upload_dir['baseurl'] . WPBakeryVisualComposer::uploadDir();
}
示例15: visual_composer
/**
* WPBakery Visual Composer helpers functions
*
* @package WPBakeryVisualComposer
*
*/
function visual_composer()
{
return WPBakeryVisualComposer::getInstance();
}