本文整理汇总了PHP中vc_user_access函数的典型用法代码示例。如果您正苦于以下问题:PHP vc_user_access函数的具体用法?PHP vc_user_access怎么用?PHP vc_user_access使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vc_user_access函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:k2jysy,项目名称:wedev,代码行数:36,代码来源:class-vc-post-admin.php
示例2: wpb_templatera_add_submenu_page
/**
* Add sub page to Visual Composer pages
*
* @since 1.2
*/
function wpb_templatera_add_submenu_page()
{
if (!WPB_VC_NEW_USER_ACCESS_VERSION || WPB_VC_NEW_USER_ACCESS_VERSION && vc_user_access()->part('templates')->checkStateAny(true, null)->get()) {
$labels = VcTemplateManager::getPostTypesLabels();
add_submenu_page(VC_PAGE_MAIN_SLUG, $labels['name'], $labels['name'], 'manage_options', 'edit.php?post_type=' . rawurlencode(VcTemplateManager::postType()), '');
}
}
开发者ID:ksan5835,项目名称:maadithottam,代码行数:12,代码来源:templatera.php
示例3: vc_check_for_custom_css_build
/**
* Function check is system has custom build of css
* and check it version in comparison with current VC version
*
* @since 4.5
*/
function vc_check_for_custom_css_build()
{
$version = vc_settings()->getCustomCssVersion();
if (vc_user_access()->wpAny('manage_options')->part('settings')->can('vc-color-tab')->get() && vc_settings()->useCustomCss() && (!$version || version_compare(WPB_VC_VERSION, $version, '<>'))) {
add_action('admin_notices', 'vc_custom_css_admin_notice');
}
}
开发者ID:k2jysy,项目名称:wedev,代码行数:13,代码来源:page-design-options.php
示例4: vc_get_autocomplete_suggestion
/**
* @since 4.4
*/
function vc_get_autocomplete_suggestion()
{
vc_user_access()->checkAdminNonce()->validateDie()->wpAny('edit_posts', 'edit_pages')->validateDie();
$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);
}
开发者ID:ntngiri,项目名称:Wordpress-dhaba,代码行数:11,代码来源:autocomplete.php
示例5: getColumnControls
/**
* @param $controls
* @param string $extended_css
*
* @return string
*/
public function getColumnControls($controls, $extended_css = '')
{
$output = '<div class="vc_controls vc_control-column vc_controls-visible controls' . (!empty($extended_css) ? " {$extended_css}" : '') . '">';
$controls_end = '</div>';
if (' bottom-controls' === $extended_css) {
$control_title = __('Append to this column', 'js_composer');
} else {
$control_title = __('Prepend to this column', 'js_composer');
}
if (vc_user_access()->part('shortcodes')->checkStateAny(true, 'custom', null)->get()) {
$controls_add = '<a class="vc_control column_add vc_column-add" data-vc-control="add" href="#" title="' . $control_title . '"><i class="vc_icon"></i></a>';
} else {
$controls_add = '';
}
$controls_edit = '<a class="vc_control column_edit vc_column-edit" data-vc-control="edit" href="#" title="' . __('Edit this column', 'js_composer') . '"><i class="vc_icon"></i></a>';
$controls_delete = '<a class="vc_control column_delete vc_column-delete" data-vc-control="delete" href="#" title="' . __('Delete this column', 'js_composer') . '"><i class="vc_icon"></i></a>';
$editAccess = vc_user_access_check_shortcode_edit($this->shortcode);
$allAccess = vc_user_access_check_shortcode_all($this->shortcode);
if (is_array($controls) && !empty($controls)) {
foreach ($controls as $control) {
if ('add' === $control || $editAccess && 'edit' === $control || $allAccess) {
$method_name = vc_camel_case('output-editor-control-' . $control);
if (method_exists($this, $method_name)) {
$output .= $this->{$method_name}();
} else {
$control_var = 'controls_' . $control;
if (isset(${$control_var})) {
$output .= ${$control_var};
}
}
}
}
return $output . $controls_end;
} elseif (is_string($controls) && 'full' === $controls) {
if ($allAccess) {
return $output . $controls_add . $controls_edit . $controls_delete . $controls_end;
} elseif ($editAccess) {
return $output . $controls_add . $controls_edit . $controls_end;
} else {
return $output . $controls_add . $controls_end;
}
return $output . $controls_end;
} elseif (is_string($controls)) {
$control_var = 'controls_' . $controls;
if ('add' === $controls || ($editAccess && 'edit' == $controls || $allAccess) && isset(${$control_var})) {
return $output . ${$control_var} . $controls_end;
}
return $output . $controls_end;
}
if ($allAccess) {
return $output . $controls_add . $controls_edit . $controls_delete . $controls_end;
} elseif ($editAccess) {
return $output . $controls_add . $controls_edit . $controls_end;
} else {
return $output . $controls_add . $controls_end;
}
return $output . $controls_end;
}
开发者ID:hikaram,项目名称:wee,代码行数:64,代码来源:vc-column.php
示例6: vc_welcome_menu_hooks
function vc_welcome_menu_hooks()
{
$settings_tab_enabled = vc_user_access()->wpAny('manage_options')->part('settings')->can('vc-general-tab')->get();
/* nectar addition */
/*add_action( 'vc_menu_page_build', 'vc_page_welcome_add_sub_page',
$settings_tab_enabled ? 11 : 1 );
add_action( 'vc_network_menu_page_build', 'vc_page_welcome_add_sub_page', $settings_tab_enabled && ! is_main_site() ? 11 : 1 );*/
/* nectar addition end */
}
开发者ID:JPodz,项目名称:harlequinnejuice,代码行数:9,代码来源:welcome-screen.php
示例7: vc_network_menu_page_build
function vc_network_menu_page_build()
{
if (vc_user_access()->wpAny('manage_options')->part('settings')->can('vc-general-tab')->get()) {
define('VC_PAGE_MAIN_SLUG', 'vc-general');
} else {
define('VC_PAGE_MAIN_SLUG', 'vc-welcome');
}
add_menu_page(__('Visual Composer', 'js_composer'), __('Visual Composer', 'js_composer'), 'exist', VC_PAGE_MAIN_SLUG, null, vc_asset_url('vc/visual_composer.png'), 76);
do_action('vc_network_menu_page_build');
}
开发者ID:severnrescue,项目名称:web,代码行数:10,代码来源:pages.php
示例8: build
/**
* Build edit form fields
*
* @deprecated 4.4
* @use Vc_Shortcode_Edit_Form::renderFields
*/
public function build()
{
// _deprecated_function( 'Vc_Shortcode_Edit_Form::build', '4.4 (will be removed in 4.10)', 'Vc_Shortcode_Edit_Form::renderFields' );
$tag = vc_post_param('element');
vc_user_access()->checkAdminNonce()->validateDie(__('Access denied', 'js_composer'))->wpAny('edit_posts', 'edit_pages')->validateDie(__('Access denied', 'js_composer'))->check('vc_user_access_check_shortcode_edit', $tag)->validateDie(__('Access denied', 'js_composer'));
$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;
}
开发者ID:k2jysy,项目名称:wedev,代码行数:17,代码来源:class-vc-shortcode-edit-form.php
示例9: vc_pointer_reset
/**
* Remove Vc pointers keys to show Tour markers again.
* @sine 4.5
*/
function vc_pointer_reset()
{
global $vc_default_pointers;
vc_user_access()->checkAdminNonce()->validateDie()->wpAny('manage_options')->validateDie()->part('settings')->can('vc-general-tab')->validateDie();
$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);
}
wp_send_json(array('success' => true));
}
开发者ID:arkev,项目名称:IntelligentMode,代码行数:17,代码来源:ui-vc-pointers.php
示例10: vc_page_settings_build
function vc_page_settings_build()
{
if (!vc_user_access()->wpAny('manage_options')->get()) {
return;
}
$tabs = vc_settings()->getTabs();
foreach ($tabs as $slug => $title) {
if (vc_user_access()->part('settings')->can($slug . '-tab')->get()) {
$page = add_submenu_page(VC_PAGE_MAIN_SLUG, $title, $title, 'manage_options', $slug, 'vc_page_settings_render');
add_action('load-' . $page, array(vc_settings(), 'adminLoad'));
}
}
do_action('vc_page_settings_build');
}
开发者ID:hikaram,项目名称:wee,代码行数:14,代码来源:settings-tabs.php
示例11: 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);
}
}
开发者ID:severnrescue,项目名称:web,代码行数:24,代码来源:class-vc-post-admin.php
示例12: isActive
public function isActive()
{
if (!$this->setMediumAsPost()) {
return false;
}
// check for functions used
if (!function_exists('vc_user_access') || !class_exists('Vc_Shortcodes_Manager') || !method_exists('Vc_Manager', 'backendEditor')) {
return false;
}
// don't show VC if user role is not allowed to use the backend editor
if (!vc_user_access()->part('backend_editor')->can()->get()) {
return false;
}
$this->action();
return true;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:16,代码来源:backend.php
示例13: vc_user_access_check_shortcode_all
function vc_user_access_check_shortcode_all($shortcode)
{
$do_check = apply_filters('vc_user_access_check-shortcode_all', null, $shortcode);
if (is_null($do_check)) {
return vc_user_access()->part('shortcodes')->checkStateAny(true, 'custom', null)->can($shortcode . '_all')->get();
} else {
return $do_check;
}
}
开发者ID:ksan5835,项目名称:maadithottam,代码行数:9,代码来源:helpers_factory.php
示例14: getPartState
public function getPartState()
{
return vc_user_access()->part('shortcodes')->getState();
}
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:4,代码来源:class-vc-add-element-box.php
示例15: render
/**
* Render fields html and output it.
* @since 4.4
* vc_filter: vc_edit_form_class - filter to override editor_css_classes array
*/
public function render()
{
$this->loadDefaultParams();
$output = $el_position = '';
$groups_content = $groups = array();
$params = $this->setting('params');
$editor_css_classes = apply_filters('vc_edit_form_class', array('wpb_edit_form_elements', 'vc_edit_form_elements'), $this->atts, $params);
$deprecated = $this->setting('deprecated');
require_once vc_path_dir('AUTOLOAD_DIR', 'class-vc-settings-presets.php');
$list_vendor_presets = Vc_Settings_Preset::listVendorSettingsPresets($this->tag);
$list_presets = Vc_Settings_Preset::listSettingsPresets($this->tag);
if (vc_user_access()->part('presets')->checkStateAny(true, null)->get() || !empty($list_presets) || !empty($list_vendor_presets)) {
$output .= '<script type="text/javascript">window.vc_presets_show=true;</script>';
} else {
$output .= '<script type="text/javascript">window.vc_presets_show=false;</script>';
}
if (!empty($deprecated)) {
$output .= '<div class="vc_row vc_ui-flex-row vc_shortcode-edit-form-deprecated-message"><div class="vc_col-sm-12 wpb_element_wrapper">' . vc_message_warning(sprintf(__('You are using outdated element, it is deprecated since version %s.', 'js_composer'), $this->setting('deprecated'))) . '</div></div>';
}
$output .= '<div class="' . implode(' ', $editor_css_classes) . '" data-title="' . htmlspecialchars(__('Edit', 'js_composer') . ' ' . __($this->setting('name'), 'js_composer')) . '">';
if (is_array($params)) {
foreach ($params as $param) {
$name = isset($param['param_name']) ? $param['param_name'] : null;
if (!is_null($name)) {
$value = isset($this->atts[$name]) ? $this->atts[$name] : null;
$value = $this->parseShortcodeAttributeValue($param, $value);
$group = isset($param['group']) && '' !== $param['group'] ? $param['group'] : '_general';
if (!isset($groups_content[$group])) {
$groups[] = $group;
$groups_content[$group] = '';
}
$groups_content[$group] .= $this->renderField($param, $value);
}
}
}
$output .= $this->renderGroupedFields($groups, $groups_content);
$output .= '</div>';
$output .= $this->enqueueScripts();
echo $output;
do_action('vc_edit_form_fields_after_render');
}
开发者ID:ksan5835,项目名称:maadithottam,代码行数:46,代码来源:class-vc-edit-form-fields.php
示例16: array
<div class="vc_ui-font-open-sans vc_ui-panel-window vc_media-xs vc_ui-panel"
data-vc-panel=".vc_ui-panel-header-header" data-vc-ui-element="panel-edit-element" id="vc_ui-panel-edit-element">
<div class="vc_ui-panel-window-inner">
<?php
$controls = array('minimize', 'close');
if (vc_user_access()->part('presets')->can()->get()) {
$controls = array(array('template' => 'editors/partials/vc_ui-presets-dropdown.tpl.php'), 'minimize', 'close');
}
vc_include_template('editors/popups/vc_ui-header.tpl.php', array('title' => __('Page settings', 'js_composer'), 'controls' => $controls, 'header_css_class' => 'vc_ui-post-settings-header-container', 'content_template' => ''));
?>
<!-- param window footer-->
<div class="vc_ui-panel-content-container">
<div class="vc_ui-panel-content vc_properties-list vc_edit_form_elements">
<!--/ temp content -->
</div>
</div>
<!-- param window footer-->
<?php
vc_include_template('editors/popups/vc_ui-footer.tpl.php', array('controls' => array(array('name' => 'close', 'label' => __('Close', 'js_composer'), 'css_classes' => 'vc_ui-button-fw'), array('name' => 'save', 'label' => __('Save changes', 'js_composer'), 'css_classes' => 'vc_ui-button-fw', 'style' => 'action'))));
?>
</div>
</div>
开发者ID:ntngiri,项目名称:Wordpress-dhaba,代码行数:24,代码来源:vc_ui-panel-edit-element.tpl.php
示例17: createButtonFrontBack
/**
* Create templates button on navigation bar of the Front/Backend editor.
*
* @param $buttons
*
* @return array
*/
public function createButtonFrontBack($buttons)
{
if ($this->isUserRoleAccessVcVersion() && !vc_user_access()->part('templates')->can()->get()) {
return $buttons;
}
if ($this->getPostType() == "vc_grid_item") {
return $buttons;
}
$new_buttons = array();
foreach ($buttons as $button) {
if ($button[0] != 'templates') {
// disable custom css as well but only in templatera page
if (!$this->isSamePostType() || $this->isSamePostType() && $button[0] != 'custom_css') {
$new_buttons[] = $button;
}
} else {
if ($this->isPanelVcVersion()) {
// @since 4.4 button is available but "Save" Functionality in form is disabled in templatera post.
$new_buttons[] = array('custom_templates', '<li class="vc_navbar-border-right"><a href="#" class="vc_icon-btn vc_templatera_button" id="vc-templatera-editor-button" title="' . __('Templates', 'js_composer') . '"></a></li>');
} else {
if ($this->isSamePostType()) {
// in older version we doesn't need to display templates window in templatera post
} else {
$new_buttons[] = array('custom_templates', '<li class="vc_navbar-border-right"><a href="#" class="vc_icon-btn vc_templatera_button" id="vc-templatera-editor-button" title="' . __('Templates', 'js_composer') . '"></a></li>');
}
}
}
}
return $new_buttons;
}
开发者ID:siiiiilvio,项目名称:kadcnc,代码行数:37,代码来源:vc_template_manager.php
示例18: vc_gitem_set_mapper_check_access
function vc_gitem_set_mapper_check_access()
{
if (vc_user_access()->checkAdminNonce()->wpAny('edit_posts', 'edit_pages')->part('grid_builder')->can()->get() && 'true' === vc_post_param('vc_grid_item_editor')) {
vc_mapper()->setCheckForAccess(false);
}
}
开发者ID:k2jysy,项目名称:wedev,代码行数:6,代码来源:vc-grid-item-editor.php
示例19: _e
?>
</h1>
<div class="about-text">
<?php
_e('Congratulations! You are about to use most powerful time saver for WordPress ever - page builder plugin with Frontend and Backend editors by WPBakery.', 'js_composer');
?>
</div>
<div class="wp-badge vc-page-logo">
<?php
echo sprintf(__('Version %s', 'js_composer'), WPB_VC_VERSION);
?>
</div>
<p class="vc-page-actions">
<?php
if (vc_user_access()->wpAny('manage_options')->part('settings')->can('vc-general-tab')->get() && (!is_multisite() || !is_main_site())) {
?>
<a href="<?php
echo esc_attr(admin_url('admin.php?page=vc-general'));
?>
"
class="button button-primary"><?php
_e('Settings', 'js_composer');
?>
</a><?php
}
?>
<a href="https://twitter.com/share" class="twitter-share-button"
data-text="Take full control over your WordPress site with Visual Composer page builder by @WPBakery"
data-url="http://vc.wpbakery.com" data-size="large">Tweet</a>
<script>! function ( d, s, id ) {
开发者ID:k2jysy,项目名称:wedev,代码行数:31,代码来源:index.php
示例20: __
<?php
if ($templates_total_count > 0 && vc_user_access()->part('templates')->can()->get()) {
?>
<a id="vc_templates-more-layouts"
class="vc_general vc_ui-button vc_ui-button-shape-rounded vc_ui-button-warning" href="#">
<i class="vc_ui-icon-pixel vc_ui-icon-pixel-control-template"></i>
<?php
echo __('Add template', 'js_composer');
?>
</a>
<?php
}
?>
</div>
<?php
if (vc_user_access()->part('shortcodes')->checkStateAny(true, 'custom', null)->get() && vc_user_access_check_shortcode_all('vc_row') && vc_user_access_check_shortcode_all('vc_column')) {
?>
<div class="vc_welcome-visible-ne">
<a id="vc_not-empty-add-element" class="vc_add-element-not-empty-button"
title="<?php
_e('Add Element', 'js_composer');
?>
" data-vc-element="add-element-action">
</a>
</div>
<?php
}
?>
<p class="vc_ui-help-block vc_welcome-visible-e">
<?php
$targetLink = '<a href="http://kb.wpbakery.com" target="_blank">' . __('knowledge base', 'js_composer') . '</a>';
开发者ID:arkev,项目名称:IntelligentMode,代码行数:31,代码来源:vc_welcome_block.tpl.php
注:本文中的vc_user_access函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论