本文整理汇总了PHP中visual_composer函数的典型用法代码示例。如果您正苦于以下问题:PHP visual_composer函数的具体用法?PHP visual_composer怎么用?PHP visual_composer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了visual_composer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Save generated shortcodes, html and visual composer status in posts meta.
*
* @access public
* @since 4.4
*
* @param $post_id - current post id
*
* @return void
*/
public function save($post_id)
{
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
// @todo fix_roles maybe check also for is vc_enabled
if (!vc_user_access()->wpAny(array('edit_post', $post_id))->get()) {
return;
}
$this->setJsStatus($post_id);
if (!(isset($_POST['wp-preview']) && 'dopreview' === $_POST['wp-preview'])) {
$this->setSettings($post_id);
}
/**
* vc_filter: vc_base_save_post_custom_css
* @since 4.4
*/
$post_custom_css = apply_filters('vc_base_save_post_custom_css', vc_post_param('vc_post_custom_css'));
if (null !== $post_custom_css && empty($post_custom_css)) {
delete_post_meta($post_id, '_wpb_post_custom_css');
} elseif (null !== $post_custom_css) {
$post_custom_css = strip_tags($post_custom_css);
update_post_meta($post_id, '_wpb_post_custom_css', $post_custom_css);
}
visual_composer()->buildShortcodesCustomCss($post_id);
}
示例2: jsComposerEditPage
public function jsComposerEditPage()
{
$vc = visual_composer();
$pt_array = $vc->getPostTypes();
foreach ($pt_array as $pt) {
add_meta_box('vc_teaser', __('VC Teaser', "js_composer"), array(&$this, 'outputTeaser'), $pt, 'side');
}
}
示例3: jsComposerEditPage
public function jsComposerEditPage()
{
$vc = visual_composer();
$pt_array = $vc->getPostTypes();
foreach ($pt_array as $pt) {
add_meta_box('vc_teaser', __('VC: Custom Teaser', LANGUAGE_ZONE), array(&$this, 'outputTeaser'), $pt, 'side');
}
add_action('save_post', array(&$this, 'saveTeaserMetaBox'));
}
示例4: build
public function build()
{
$element = vc_post_param('element');
$shortCode = stripslashes(vc_post_param('shortcode'));
visual_composer()->removeShortCode($element);
$settings = WPBMap::getShortCode($element);
new WPBakeryShortCode_Settings($settings);
echo do_shortcode($shortCode);
die;
}
示例5: getHeading
public function getHeading($atts)
{
if (isset($atts['use_custom_heading']) && 'true' === $atts['use_custom_heading']) {
$custom_heading = visual_composer()->getShortCode('vc_custom_heading');
$data = vc_map_integrate_parse_atts($this->shortcode, 'vc_custom_heading', $atts, 'custom_');
$data['text'] = $atts['title'];
return $custom_heading->render(array_filter($data));
} else {
return '<h4>' . esc_html($atts['title']) . '</h4>';
}
}
示例6: render
function render()
{
$output = '<div class="vc-css-editor row vc-row" data-css-editor="true">';
$output .= $this->onionLayout();
$output .= '<div class="col-xs-5 vc_span5 vc-settings">' . ' <label>' . __('Border', 'js_composer') . '</label> ' . ' <div class="color-group"><input type="text" name="border_color" value="" class="vc-color-control"></div>' . ' <div class="vc-border-style"><select name="border_style" class="vc-border-style">' . $this->getBorderStyleOptions() . '</select></div>' . ' <label>' . __('Background', 'js_composer') . '</label>' . ' <div class="color-group"><input type="text" name="background_color" value="" class="vc-color-control"></div>' . ' <div class="vc-background-image">' . $this->getBackgroundImageControl() . '<div class="clearfix"></div></div>' . ' <div class="vc-background-style"><select name="background_style" class="vc-background-style">' . $this->getBackgroundStyleOptions() . '</select></div>' . ' <label>' . __('Box controls', 'js_composer') . '</label>' . ' <label class="vc-checkbox"><input type="checkbox" name="simply" class="vc-simplify" value=""> ' . __('Simplify controls', 'js_composer') . '</label>' . '</div>';
$output .= '<input name="' . $this->setting('param_name') . '" class="wpb_vc_param_value ' . $this->setting('param_name') . ' ' . $this->setting('type') . '_field" type="hidden" value="' . esc_attr($this->value()) . '"/>';
$output .= '</div><div class="clearfix"></div>';
$output .= '<script type="text/html" id="vc-css-editor-image-block">' . '<li class="added">' . ' <div class="inner" style="width: 75px; height: 75px; overflow: hidden;text-align: center;">' . ' <img src="{{ img.url }}?id={{ img.id }}" data-image-id="{{ img.id }}" class="vc-ce-image<# if(!_.isUndefined(img.css_class)) {#> {{ img.css_class }}<# }#>">' . ' </div>' . ' <a href="#" class="icon-remove"></a>' . '</li>' . '</script>';
$output .= '<script type="text/javascript" src="' . visual_composer()->assetUrl('js/params/css_editor.js') . '"></script>';
return apply_filters('vc_css_editor', $output);
}
示例7: setGlobalTtaInfo
public function setGlobalTtaInfo()
{
$sectionClass = visual_composer()->getShortCode('vc_tta_section')->shortcodeClass();
$this->sectionClass = $sectionClass;
/** @var $sectionClass WPBakeryShortCode_VC_Tta_Section */
if (is_object($sectionClass)) {
WPBakeryShortCode_VC_Tta_Section::$tta_base_shortcode = $this;
WPBakeryShortCode_VC_Tta_Section::$self_count = 0;
WPBakeryShortCode_VC_Tta_Section::$section_info = array();
return true;
}
return false;
}
示例8: enqueue
public function enqueue()
{
visual_composer()->frontCss();
visual_composer()->frontJsRegister();
wp_enqueue_script('prettyphoto');
wp_enqueue_style('prettyphoto');
wp_enqueue_style('js_composer_front');
wp_enqueue_script('wpb_composer_front_js');
wp_enqueue_style('js_composer_custom_css');
VcShortcodeAutoloader::getInstance()->includeClass('WPBakeryShortCode_VC_Basic_Grid');
$grid = new WPBakeryShortCode_VC_Basic_Grid(array('base' => 'vc_basic_grid'));
$grid->shortcodeScripts();
$grid->enqueueScripts();
}
示例9: enqueue
public function enqueue()
{
visual_composer()->frontCss();
visual_composer()->frontJsRegister();
wp_enqueue_script('prettyphoto');
wp_enqueue_style('prettyphoto');
wp_enqueue_style('js_composer_front');
wp_enqueue_script('wpb_composer_front_js');
wp_enqueue_style('js_composer_custom_css');
require_once vc_path_dir('SHORTCODES_DIR', 'vc-basic-grid.php');
$grid = new WPBakeryShortCode_VC_Basic_Grid(array('base' => 'vc_basic_grid'));
$grid->shortcodeScripts();
$grid->enqueueScripts();
}
示例10: getVcIcon
public function getVcIcon($atts)
{
if (empty($atts['i_type'])) {
$atts['i_type'] = 'fontawesome';
}
$data = vc_map_integrate_parse_atts($this->shortcode, 'vc_icon', $atts, 'i_');
if ($data) {
$icon = visual_composer()->getShortCode('vc_icon');
if (is_object($icon)) {
return $icon->render(array_filter($data));
}
}
return '';
}
示例11: addHooksSettings
/**
* This method is called by Vc_Manager to register required action hooks for VC backend editor.
*
* @since 4.2
* @access public
*/
public function addHooksSettings()
{
add_action('edit_post', array(&$this, 'save'));
add_action('wp_ajax_wpb_get_element_backend_html', array(&$this, 'elementBackendHtml'));
// load backend editor
if (function_exists('add_theme_support')) {
add_theme_support('post-thumbnails');
}
add_post_type_support('page', 'excerpt');
add_action('admin_init', array(&$this, 'render'), 5);
add_action('admin_print_scripts-post.php', array(&$this, 'printScriptsMessages'));
add_action('admin_print_scripts-post-new.php', array(&$this, 'printScriptsMessages'));
// Load required vendors classes;
visual_composer()->vendorsManager()->load();
}
示例12: vc_add_vendor
/**
* Helper function to add new third-party adaptation class.
*
* @since 4.3
* @param Vc_Vendor_Interface $vendor - instance of class.
*/
function vc_add_vendor(Vc_Vendor_Interface $vendor)
{
visual_composer()->vendorsManager()->add($vendor);
}
示例13: vc_path_dir
$nav_bar->render();
// [/vc_navbar frontend]
?>
<div id="vc_inline-frame-wrapper"></div>
<?php
// [add element popup/box]
require_once vc_path_dir('EDITORS_DIR', 'popups/class-vc-add-element-box.php');
$add_element_box = new Vc_Add_Element_Box($editor);
$add_element_box->render();
// [/add element popup/box]
// [shortcodes edit form panel render]
visual_composer()->editForm()->render();
// [/shortcodes edit form panel render]
// [templates panel editor render]
if (vc_user_access()->part('templates')->can()->get()) {
visual_composer()->templatesPanelEditor()->renderUITemplate();
}
// [/templates panel editor render]
// [post settings panel render]
if (vc_user_access()->part('post_settings')->can()->get()) {
require_once vc_path_dir('EDITORS_DIR', 'popups/class-vc-post-settings.php');
$post_settings = new Vc_Post_Settings($editor);
$post_settings->renderUITemplate();
}
// [/post settings panel render]
// [panel edit layout render]
require_once vc_path_dir('EDITORS_DIR', 'popups/class-vc-edit-layout.php');
$edit_layout = new Vc_Edit_Layout();
$edit_layout->renderUITemplate();
// [/panel edit layout render]
// fe controls
示例14: saveTemplate
/**
* Used to save new template from ajax request in new panel window
* @since 4.4
*
*/
public function saveTemplate()
{
if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
die;
}
$title = vc_post_param('template_name');
$content = vc_post_param('template');
$template_id = $this->create($title, $content);
$template_title = get_the_title($template_id);
if ($this->isNewVcVersion(self::$vcWithTemplatePreview)) {
echo visual_composer()->templatesPanelEditor()->renderTemplateListItem(array('name' => $template_title, 'unique_id' => $template_id, 'type' => self::$template_type));
} else {
echo $this->renderTemplateWindowTemplateraTemplates($template_title, array('unique_id' => $template_id));
}
die;
}
示例15: getGridDataForAjax
/**
* @since 4.4
*
* @output/@return string - grid data for ajax request.
*/
public function getGridDataForAjax()
{
$tag = vc_request_param('tag');
if (vc_verify_public_nonce() && $tag) {
$shorcode_fishbone = visual_composer()->getShortCode($tag);
if (is_object($shorcode_fishbone)) {
/** @var $vc_grid WPBakeryShortcode_Vc_Basic_Grid */
$vc_grid = $shorcode_fishbone->shortcodeClass();
if (method_exists($vc_grid, 'isObjectPageable') && $vc_grid->isObjectPageable() && method_exists($vc_grid, 'renderAjax')) {
die($vc_grid->renderAjax(vc_request_param('data')));
}
}
}
}