本文整理汇总了PHP中vc_verify_admin_nonce函数的典型用法代码示例。如果您正苦于以下问题:PHP vc_verify_admin_nonce函数的具体用法?PHP vc_verify_admin_nonce怎么用?PHP vc_verify_admin_nonce使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vc_verify_admin_nonce函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vc_get_autocomplete_suggestion
/**
* @since 4.4
*/
function vc_get_autocomplete_suggestion()
{
if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
die;
}
$query = vc_post_param('query');
$tag = strip_tags(vc_post_param('shortcode'));
$param_name = vc_post_param('param');
vc_render_suggestion($query, $tag, $param_name);
}
示例2: build
/**
* Build edit form fields
*
* @deprecated 4.4
* @use Vc_Shortcode_Edit_Form::renderFields
*/
public function build()
{
if (!vc_verify_admin_nonce(vc_post_param('nonce')) || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
wp_send_json(array('success' => false));
}
$tag = vc_post_param('element');
$shortCode = stripslashes(vc_post_param('shortcode'));
require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php');
$fields = new Vc_Edit_Form_Fields($tag, shortcode_parse_atts($shortCode));
$fields->render();
die;
}
示例3: vc_pointer_reset
/**
* Remove Vc pointers keys to show Tour markers again.
* @sine 4.5
*/
function vc_pointer_reset()
{
global $vc_default_pointers;
if (!vc_verify_admin_nonce() || !current_user_can('manage_options')) {
die;
}
$pointers = (array) apply_filters('vc_pointers_list', $vc_default_pointers);
$prev_meta_value = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true);
$dismissed = explode(',', (string) $prev_meta_value);
if (count($dismissed) > 0 && count($pointers)) {
$meta_value = implode(',', array_diff($dismissed, $pointers));
update_user_meta(get_current_user_id(), 'dismissed_wp_pointers', $meta_value, $prev_meta_value);
}
}
示例4: goAction
/**
*
*/
public function goAction()
{
if (!vc_verify_admin_nonce() || !current_user_can('manage_options')) {
die;
}
$action = vc_post_param('vc_action');
$this->result($this->{$action}());
}
示例5: 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>
示例6: array
<?php
if ('vc_edit_form' === vc_post_param('action') && vc_verify_admin_nonce()) {
$link_category = array(__('All Links', 'js_composer') => '');
$link_cats = get_terms('link_category');
if (is_array($link_cats) && !empty($link_cats)) {
foreach ($link_cats as $link_cat) {
if (is_object($link_cat) && isset($link_cat->name, $link_cat->term_id)) {
$link_category[$link_cat->name] = $link_cat->term_id;
}
}
}
} else {
$link_category = array();
}
return array('name' => 'WP ' . __('Links'), 'base' => 'vc_wp_links', 'icon' => 'icon-wpb-wp', 'category' => __('WordPress Widgets', 'js_composer'), 'class' => 'wpb_vc_wp_widget', 'content_element' => (bool) get_option('link_manager_enabled'), 'weight' => -50, 'description' => __('Your blogroll', 'js_composer'), 'params' => array(array('type' => 'dropdown', 'heading' => __('Link Category', 'js_composer'), 'param_name' => 'category', 'value' => $link_category, 'admin_label' => true), array('type' => 'dropdown', 'heading' => __('Order by', 'js_composer'), 'param_name' => 'orderby', 'value' => array(__('Link title', 'js_composer') => 'name', __('Link rating', 'js_composer') => 'rating', __('Link ID', 'js_composer') => 'id', __('Random', 'js_composer') => 'rand')), array('type' => 'checkbox', 'heading' => __('Options', 'js_composer'), 'param_name' => 'options', 'value' => array(__('Show Link Image', 'js_composer') => 'images', __('Show Link Name', 'js_composer') => 'name', __('Show Link Description', 'js_composer') => 'description', __('Show Link Rating', 'js_composer') => 'rating')), array('type' => 'textfield', 'heading' => __('Number of links to show', 'js_composer'), 'param_name' => 'limit', 'value' => -1), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer'))));
示例7: elementBackendHtml
/**
* Create shortcode's string.
*
* @since 3.0
* @access public
* @deprecated
*/
public function elementBackendHtml()
{
global $current_user;
get_currentuserinfo();
if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
wp_send_json(array('success' => false));
}
$data_element = vc_post_param('data_element');
/** @var $settings - get use group access rules */
$settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
$role = $current_user->roles[0];
if ($data_element === 'vc_column' && vc_post_param('data_width') !== null) {
$output = do_shortcode('[vc_column width="' . vc_post_param('data_width') . '"]');
echo $output;
} elseif ($data_element == 'vc_row' || $data_element == 'vc_row_inner' || $data_element == 'mk_page_section') {
$output = do_shortcode('[' . $data_element . ']');
echo $output;
} elseif (!isset($settings[$role]['shortcodes']) || isset($settings[$role]['shortcodes'][$data_element]) && (int) $settings[$role]['shortcodes'][$data_element] === 1) {
$output = do_shortcode('[' . $data_element . ']');
echo $output;
}
die;
}
示例8: delete
/**
* @since 4.4
*/
public function delete()
{
if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
die;
}
$template_id = vc_post_param('template_id');
if (!isset($template_id) || $template_id === "") {
die('Error: Vc_Templates_Panel_Editor::delete:1');
}
$saved_templates = get_option($this->option_name);
unset($saved_templates[$template_id]);
if (count($saved_templates) > 0) {
update_option($this->option_name, $saved_templates);
} else {
delete_option($this->option_name);
}
die;
}
示例9: vc_get_loop_settings_json
/**
* @since 4.2
*/
function vc_get_loop_settings_json()
{
if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
die;
}
$loop_settings = new VcLoopSettings(vc_post_param('value'), vc_post_param('settings'));
$loop_settings->render();
die;
}
示例10: vc_action_render_settings_preset_title_prompt
/**
* Return rendered title prompt
*
* @since 4.7
*
* @return string
*/
function vc_action_render_settings_preset_title_prompt()
{
if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
wp_send_json(array('success' => false));
}
ob_start();
vc_include_template(apply_filters('vc_render_settings_preset_title_prompt', 'editors/partials/prompt.tpl.php'));
$html = ob_get_clean();
$response = array('success' => true, 'html' => $html);
wp_send_json($response);
}
示例11: deactivate
/**
*
*/
public function deactivate()
{
if (!vc_verify_admin_nonce() || !current_user_can('manage_options')) {
die;
}
$params = array();
$params['dkey'] = $this->deactivation();
$string = 'deactivatelicense?';
$request_url = self::getWpbControlUrl(array($string, http_build_query($params, '', '&')));
$response = wp_remote_get($request_url, array('timeout' => 300));
if (is_wp_error($response)) {
echo json_encode(array('result' => false));
die;
}
$result = json_decode($response['body']);
if ((bool) $result->result) {
$this->setDeactivation('');
}
echo $response['body'];
die;
}
示例12: vc_gitem_set_mapper_check_access
function vc_gitem_set_mapper_check_access()
{
if (vc_verify_admin_nonce() && (current_user_can('edit_posts') || current_user_can('edit_pages')) && 'true' === vc_post_param('vc_grid_item_editor')) {
vc_mapper()->setCheckForAccess(false);
}
}
示例13: galleryHTML
/**
* @todo move it
* @since 4.2
*/
public function galleryHTML()
{
if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
wp_send_json(array('success' => false));
}
$images = vc_post_param('content');
if (!empty($images)) {
echo fieldAttachedImages(explode(',', $images));
}
die;
}
示例14: loadHtml
/**
* Used in templates.js:changeShortcodeParams
* @todo make sure we need this
* Output some template content
* @todo make sure it is secure?
*/
public function loadHtml()
{
if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
die;
}
$id = vc_post_param('id');
$post = get_post((int) $id);
if ($post->post_type == self::$post_type) {
echo $post->post_content;
}
die;
}
示例15: 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';
}
}
}