本文整理汇总了PHP中vc_request_param函数的典型用法代码示例。如果您正苦于以下问题:PHP vc_request_param函数的具体用法?PHP vc_request_param怎么用?PHP vc_request_param使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vc_request_param函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFields
/**
* Build edit form fields.
*
* @since 4.4
*/
public function renderFields()
{
/* nectar addition */
$tag = vc_post_param('tag');
vc_user_access()->checkAdminNonce()->validateDie(__('Access denied', 'js_composer'))->wpAny(array('edit_post', (int) vc_request_param('post_id')))->validateDie(__('Access denied', 'js_composer'))->check('vc_user_access_check_shortcode_edit', $tag)->validateDie(__('Access denied', 'js_composer'));
function array_htmlspecialchars_decode(&$input)
{
if (is_array($input)) {
foreach ($input as $key => $value) {
if (is_array($value)) {
$input[$key] = array_htmlspecialchars_decode($value);
} else {
$input[$key] = htmlspecialchars_decode($value);
}
}
return $input;
}
return htmlspecialchars_decode($input);
}
$params = array_map('array_htmlspecialchars_decode', (array) stripslashes_deep(vc_post_param('params')));
require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php');
$fields = new Vc_Edit_Form_Fields($tag, $params);
$fields->render();
die;
/* nectar addition end */
}
示例2: renderFields
/**
* Build edit form fields.
*
* @since 4.4
*/
public function renderFields()
{
$tag = vc_post_param('tag');
vc_user_access()->checkAdminNonce()->validateDie(__('Access denied', 'js_composer'))->wpAny(array('edit_post', (int) vc_request_param('post_id')))->validateDie(__('Access denied', 'js_composer'))->check('vc_user_access_check_shortcode_edit', $tag)->validateDie(__('Access denied', 'js_composer'));
$params = array_map('vc_htmlspecialchars_decode_deep', (array) stripslashes_deep(vc_post_param('params')));
require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php');
$fields = new Vc_Edit_Form_Fields($tag, $params);
$fields->render();
die;
}
示例3: vc_roles_settings_save
function vc_roles_settings_save()
{
if (check_admin_referer('vc_settings-roles-action', 'vc_nonce_field') && current_user_can('manage_options')) {
require_once vc_path_dir('SETTINGS_DIR', 'class-vc-roles.php');
$vc_roles = new Vc_Roles();
$data = $vc_roles->save(vc_request_param('vc_roles', array()));
echo json_encode($data);
die;
}
}
示例4: vc_grid_item_editor_init
/**
* Set required objects to render editor for grid item
*
* @since 4.4
*/
function vc_grid_item_editor_init()
{
require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php');
$vc_grid_item_editor = new Vc_Grid_Item_Editor();
if (vc_request_param('vc_grid_item_editor') === 'true') {
require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php');
$grid_item = new Vc_Grid_Item();
$grid_item->mapShortcodes();
}
$vc_grid_item_editor->addMetaBox();
}
示例5: render
public function render()
{
$this->post_id = vc_request_param('post_id');
$this->shortcodes_string = stripslashes(vc_request_param('shortcodes_string', true));
require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php');
$grid_item = new Vc_Grid_Item();
$grid_item->setIsEnd(false);
$grid_item->setGridAttributes(array('element_width' => 4));
$grid_item->setTemplate($this->shortcodes_string, $this->post_id);
$this->enqueue();
vc_include_template('params/vc_grid_item/preview.tpl.php', array('preview' => $this, 'grid_item' => $grid_item, 'shortcodes_string' => $this->shortcodes_string, 'post' => $this->mockingPost(), 'default_width_value' => apply_filters('vc_grid_item_preview_render_default_width_value', 4)));
}
示例6: setItemsIfEmpty
public function setItemsIfEmpty($items)
{
if (empty($items)) {
require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php');
$grid_item = new Vc_Grid_Item();
$grid_item->setGridAttributes($this->atts);
$grid_item->shortcodes();
$item = '[vc_gitem]<img src="' . vc_asset_url('vc/vc_gitem_image.png') . '">[/vc_gitem]';
$grid_item->parseTemplate($item);
$items = str_repeat($grid_item->renderItem(get_post((int) vc_request_param('vc_post_id'))), 3);
}
return $items;
}
示例7: render
/**
* Calls add_meta_box to create Editor block. Block is rendered by WPBakeryVisualComposerLayout.
*
* @see WPBakeryVisualComposerLayout
* @since 4.2
* @access public
*/
public function render()
{
// @todo fix_roles bc for post_types, maybe initialize ajax hooks also when we are inside vc_editor_post_types?
global $pagenow;
if ('post.php' === $pagenow) {
do_action('vc_backend_editor_before_render');
// we editing existing entity
$id = (int) vc_request_param('post');
// @todo add check if vc is enabled for this post_type
$type = get_post_type($id);
$valid = vc_check_post_type($type);
if ($valid) {
add_meta_box('wpb_visual_composer', __('Visual Composer', 'js_composer'), array(&$this, 'renderEditor'), $type, 'normal', 'high');
}
} elseif ('post-new.php' === $pagenow) {
// we creating new entitiy
$type = sanitize_text_field(vc_request_param('post_type'));
$type = empty($type) ? 'post' : $type;
$valid = vc_check_post_type($type);
if ($valid) {
add_meta_box('wpb_visual_composer', __('Visual Composer', 'js_composer'), array(&$this, 'renderEditor'), $type, 'normal', 'high');
}
}
}
示例8: vc_is_inline
/**
* Get is inline or not.
* @since 4.2
* @return bool
*/
function vc_is_inline()
{
global $vc_is_inline;
if (is_null($vc_is_inline)) {
$vc_is_inline = vc_action() === 'vc_inline' || !is_null(vc_request_param('vc_inline')) || vc_request_param('vc_editable') === 'true';
}
return $vc_is_inline;
}
示例9: vc_grid_item_editor_shortcodes
/**
* Check and Map grid element shortcodes if required.
* @since 4.5
*/
function vc_grid_item_editor_shortcodes()
{
require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php');
// TODO: remove this because mapping can be based on post_type
if ('true' === vc_request_param('vc_grid_item_editor') || is_admin() && vc_grid_item_get_post_type() === Vc_Grid_Item_Editor::postType() && vc_user_access()->wpAny('edit_posts', 'edit_pages')->part('grid_builder')->can()->get()) {
global $vc_grid_item_editor;
add_action('vc_user_access_check-shortcode_edit', array(&$vc_grid_item_editor, 'accessCheckShortcodeEdit'), 10, 2);
add_action('vc_user_access_check-shortcode_all', array(&$vc_grid_item_editor, 'accessCheckShortcodeAll'), 10, 2);
vc_grid_item_map_shortcodes();
}
}
示例10: setMode
/**
* Set VC mode.
*
* Mode depends on which page is requested by client from server and request parameters like vc_action.
*
* @since 4.2
* @access protected
*
* @return void
*/
protected function setMode() {
/**
* TODO: Create another system (When ajax rebuild).
* Use vc_action param to define mode.
* 1. admin_frontend_editor - set by editor or request param
* 2. admin_backend_editor - set by editor or request param
* 3. admin_frontend_editor_ajax - set by request param
* 4. admin_backend_editor_ajax - set by request param
* 5. admin_updater - by vc_action
* 6. page_editable - by vc_action
*/
if ( is_admin() ) {
if ( vc_action() === 'vc_inline' && ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) ) {
$this->mode = 'admin_frontend_editor';
} elseif ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && (
vc_action() === 'vc_upgrade' ||
( vc_get_param( 'action' ) === 'update-selected' && vc_get_param( 'plugins' ) === $this->pluginName() )
) ) {
$this->mode = 'admin_updater';
} elseif ( current_user_can( 'manage_options' ) && isset( $_GET['page'] ) && $_GET['page'] === $this->settings()->page() ) {
$this->mode = 'admin_settings_page';
} else {
$this->mode = 'admin_page';
}
} else {
if ( vc_verify_admin_nonce() && current_user_can( 'edit_post', (int) vc_request_param( 'vc_post_id' ) ) && isset( $_GET['vc_editable'] ) && 'true' === $_GET['vc_editable'] ) {
$this->mode = 'page_editable';
} else {
$this->mode = 'page';
}
}
}
示例11: extract
* Shortcode attributes
* @var $atts
* @var $css
* @var $animation
* @var $content - shortcode content
* Shortcode class
* @var $this WPBakeryShortCode_VC_Gitem_Animated_Block
*/
$css = $animation = $animation_attr = '';
extract(shortcode_atts(array('css' => '', 'animation' => ''), $atts));
$css_style = '';
$css_class = 'vc_gitem-animated-block ' . vc_shortcode_custom_css_class($css, ' ');
if (!empty($animation)) {
$css_class .= ' vc_gitem-animate vc_gitem-animate-' . $animation;
$animation_attr .= ' data-vc-animation="' . esc_attr($animation) . '"';
} elseif ('vc_gitem_preview' !== vc_request_param('action') && vc_verify_admin_nonce() && (current_user_can('edit_posts') || current_user_can('edit_pages'))) {
$content = preg_replace('/(?<=\\[)(vc_gitem_zone_b\\b)/', '$1 render="no"', $content);
}
?>
<div class="<?php
echo esc_attr($css_class);
?>
"<?php
echo $animation_attr;
echo empty($css_style) ? '' : ' style="' . esc_attr($css_style) . '"';
?>
><?php
echo do_shortcode($content);
?>
</div>
示例12: getGridDataForAjax
/**
* @since 4.4
*
* @output/@return string - grid data for ajax request.
*/
public function getGridDataForAjax()
{
// if ( vc_request_param( 'action' ) === 'vc_get_vc_grid_data' ) {
if (vc_request_param('tag') === 'vc_masonry_grid') {
$settings = WPBMap::getShortCode('vc_masonry_grid');
require_once vc_path_dir('SHORTCODES_DIR', 'vc-masonry-grid.php');
$vc_grid = new WPBakeryShortcode_VC_Masonry_Grid($settings);
} else {
if (vc_request_param('tag') === 'vc_media_grid') {
$settings = WPBMap::getShortCode('vc_media_grid');
require_once vc_path_dir('SHORTCODES_DIR', 'vc-media-grid.php');
$vc_grid = new WPBakeryShortcode_VC_Media_Grid($settings);
} else {
if (vc_request_param('tag') === 'vc_masonry_media_grid') {
$settings = WPBMap::getShortCode('vc_masonry_media_grid');
require_once vc_path_dir('SHORTCODES_DIR', 'vc-masonry-media-grid.php');
$vc_grid = new WPBakeryShortcode_VC_Masonry_Media_Grid($settings);
} else {
$settings = WPBMap::getShortCode('vc_basic_grid');
require_once vc_path_dir('SHORTCODES_DIR', 'vc-basic-grid.php');
$vc_grid = new WPBakeryShortcode_VC_Basic_Grid($settings);
}
}
}
die($vc_grid->renderAjax(vc_request_param('data')));
// }
}
示例13: setMode
/**
* Set VC mode.
*
* Mode depends on which page is requested by client from server and request parameters like vc_action.
*
* @since 4.2
* @access protected
*
* @return void
*/
protected function setMode()
{
/**
* TODO: Create another system (When ajax rebuild).
* Use vc_action param to define mode.
* 1. admin_frontend_editor - set by editor or request param
* 2. admin_backend_editor - set by editor or request param
* 3. admin_frontend_editor_ajax - set by request param
* 4. admin_backend_editor_ajax - set by request param
* 5. admin_updater - by vc_action
* 6. page_editable - by vc_action
*/
if (is_admin()) {
if ('vc_inline' === vc_action()) {
vc_user_access()->wpAny(array('edit_post', (int) vc_request_param('post_id')))->validateDie()->part('frontend_editor')->can()->validateDie();
$this->mode = 'admin_frontend_editor';
} elseif (vc_user_access()->wpAny('edit_posts', 'edit_pages')->get() && ('vc_upgrade' === vc_action() || 'update-selected' === vc_get_param('action') && $this->pluginName() === vc_get_param('plugins'))) {
$this->mode = 'admin_updater';
} elseif (vc_user_access()->wpAny('manage_options')->get() && isset($_GET['page']) && $_GET['page'] === $this->settings()->page()) {
$this->mode = 'admin_settings_page';
} else {
$this->mode = 'admin_page';
}
} else {
if (isset($_GET['vc_editable']) && 'true' === $_GET['vc_editable']) {
vc_user_access()->checkAdminNonce()->validateDie()->wpAny(array('edit_post', (int) vc_request_param('vc_post_id')))->validateDie()->part('frontend_editor')->can()->validateDie();
$this->mode = 'page_editable';
} else {
$this->mode = 'page';
}
}
}
示例14: vc_gitem_template_attribute_post_image_url_attr_prettyphoto
/**
* Add image url as href with css classes for PrettyPhoto js plugin.
*
* @param $value
* @param $data
*
* @return string
*/
function vc_gitem_template_attribute_post_image_url_attr_prettyphoto($value, $data)
{
$data_default = $data;
/**
* @var Wp_Post $post ;
*/
extract(array_merge(array('post' => null, 'data' => ''), $data));
$href = vc_gitem_template_attribute_post_image_url_href($value, array('post' => $post, 'data' => ''));
$rel = ' rel="' . esc_attr('prettyPhoto[rel-' . md5(vc_request_param('shortcode_id')) . ']') . '"';
return $href . $rel . ' class="' . esc_attr($data . (strlen($href) ? ' prettyphoto' : '')) . '" title="' . esc_attr(apply_filters('vc_gitem_template_attribute_post_title', $post->post_title, $data_default)) . '"';
}
示例15: vc_grid_item_editor_shortcodes
/**
* Check and Map grid element shortcodes if required.
* @since 4.5
*/
function vc_grid_item_editor_shortcodes()
{
require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php');
// @todo remove this because mapping can be based on post_type
if (vc_request_param('vc_grid_item_editor') === 'true' || is_admin() && vc_grid_item_get_post_type() === Vc_Grid_Item_Editor::postType()) {
vc_grid_item_map_shortcodes();
}
}