本文整理汇总了PHP中vc_role_access函数的典型用法代码示例。如果您正苦于以下问题:PHP vc_role_access函数的具体用法?PHP vc_role_access怎么用?PHP vc_role_access使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vc_role_access函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save
public function save($params = array())
{
$data = array('message' => '');
$roles = $this->getWpRoles();
$editable_roles = get_editable_roles();
foreach ($params as $role => $parts) {
if (is_string($parts)) {
$parts = json_decode(stripslashes($parts), true);
}
if (isset($editable_roles[$role])) {
foreach ($parts as $part => $settings) {
$part_key = vc_role_access()->who($role)->part($part)->getStateKey();
$stateValue = '0';
$roles->use_db = false;
// Disable saving in DB on every cap change
foreach ($settings as $key => $value) {
if ('_state' === $key) {
$stateValue = in_array($value, array('0', '1')) ? (bool) $value : $value;
} else {
if (empty($value)) {
$roles->remove_cap($role, $part_key . '/' . $key);
} else {
$roles->add_cap($role, $part_key . '/' . $key, true);
}
}
}
$roles->use_db = true;
// Enable for the lat change in cap of role to store data in DB
$roles->add_cap($role, $part_key, $stateValue);
}
}
}
$data['message'] = __('Roles settings successfully saved.', 'js_composer');
return $data;
}
开发者ID:severnrescue,项目名称:web,代码行数:35,代码来源:class-vc-roles.php
示例2: setEditorPostTypes
/**
* Set post types where VC editors are enabled.
*
* @since 4.4
* @access public
*
* @param array $post_types
*/
public function setEditorPostTypes(array $post_types)
{
$this->editor_post_types = !empty($post_types) ? $post_types : $this->editorDefaultPostTypes();
require_once ABSPATH . 'wp-admin/includes/user.php';
$editable_roles = get_editable_roles();
foreach ($editable_roles as $role => $settings) {
$part = vc_role_access()->who($role)->part('post_types');
$all_post_types = $part->getAllCaps();
foreach ($all_post_types as $post_type => $value) {
$part->getRole()->remove_cap($part->getStateKey() . '/' . $post_type);
}
$part->setState('custom');
foreach ($this->editor_post_types as $post_type) {
$part->setCapRule($post_type);
}
}
}
开发者ID:pivotlearning,项目名称:wpsite,代码行数:25,代码来源:js_composer.php
示例3: vc_include_template
<?php
if (vc_frontend_editor()->inlineEnabled()) {
vc_include_template('pages/partials/vc-roles-parts/_part.tpl.php', array('part' => $part, 'role' => $role, 'params_prefix' => 'vc_roles[' . $role . '][' . $part . ']', 'controller' => vc_role_access()->who($role)->part($part), 'custom_value' => 'custom', 'options' => array(array(true, __('Enabled', 'js_composer')), array(false, __('Disabled', 'js_composer'))), 'main_label' => __('Frontend editor', 'js_composer'), 'custom_label' => __('Frontend editor', 'js_composer')));
}
开发者ID:ntngiri,项目名称:Wordpress-dhaba,代码行数:5,代码来源:_frontend_editor.tpl.php
示例4: die
<?php
if (!defined('ABSPATH')) {
die('-1');
}
vc_include_template('pages/partials/vc-roles-parts/_part.tpl.php', array('part' => $part, 'role' => $role, 'params_prefix' => 'vc_roles[' . $role . '][' . $part . ']', 'controller' => vc_role_access()->who($role)->part($part), 'custom_value' => 'custom', 'capabilities' => WPBMap::getSortedAllShortCodes(), 'ignore_capabilities' => array('vc_gitem', 'vc_gitem_animated_block', 'vc_gitem_zone', 'vc_gitem_zone_a', 'vc_gitem_zone_b', 'vc_gitem_zone_c', 'vc_column', 'vc_row_inner', 'vc_column_inner', 'vc_posts_grid'), 'categories' => WPBMap::getCategories(), 'cap_types' => array(array('all', __('All', 'js_composer')), array('edit', __('Edit', 'js_composer'))), 'item_header_name' => __('Element', 'js_composer'), 'options' => array(array(true, __('All', 'js_composer')), array('edit', __('Edit only', 'js_composer')), array('custom', __('Custom', 'js_composer'))), 'main_label' => __('Elements', 'js_composer'), 'custom_label' => __('Elements', 'js_composer'), 'description' => __('Control user access to content elements.', 'js_composer'), 'use_table' => true));
开发者ID:arkev,项目名称:IntelligentMode,代码行数:6,代码来源:_shortcodes.tpl.php
示例5: array
<?php
$tabs = array();
foreach (vc_settings()->getTabs() as $tab => $title) {
$tabs[] = array($tab . '-tab', $title);
}
vc_include_template('pages/partials/vc-roles-parts/_part.tpl.php', array('part' => $part, 'role' => $role, 'params_prefix' => 'vc_roles[' . $role . '][' . $part . ']', 'controller' => vc_role_access()->who($role)->part($part), 'custom_value' => 'custom', 'capabilities' => $tabs, 'options' => array(array(true, __('All', 'js_composer')), array('custom', __('Custom', 'js_composer')), array(false, __('Disabled', 'js_composer'))), 'main_label' => __('Settings options', 'js_composer'), 'custom_label' => __('Settings options', 'js_composer'), 'description' => __('Control access rights to Visual Composer admin settings tabs (e.g. General Settings, Shortcode Mapper, ...)', 'js_composer')));
开发者ID:severnrescue,项目名称:web,代码行数:7,代码来源:_settings.tpl.php
示例6: vc_include_template
<?php
vc_include_template('pages/partials/vc-roles-parts/_part.tpl.php', array('part' => $part, 'role' => $role, 'params_prefix' => 'vc_roles[' . $role . '][' . $part . ']', 'controller' => vc_role_access()->who($role)->part($part), 'options' => array(array(true, __('All', 'js_composer')), array('add', __('Apply presets only', 'js_composer')), array(false, __('Disabled', 'js_composer'))), 'main_label' => __('Element Presets', 'js_composer'), 'description' => __('Control access rights to element presets in element edit form. Note: "Apply presets only" restricts users from saving new presets, deleting existing and setting defaults.', 'js_composer')));
开发者ID:hikaram,项目名称:wee,代码行数:3,代码来源:_presets.tpl.php
示例7: vc_include_template
<?php
vc_include_template('pages/partials/vc-roles-parts/_part.tpl.php', array('part' => $part, 'role' => $role, 'params_prefix' => 'vc_roles[' . $role . '][' . $part . ']', 'controller' => vc_role_access()->who($role)->part($part), 'options' => array(array(true, __('Enabled', 'js_composer')), array(false, __('Disabled', 'js_composer'))), 'main_label' => __('Grid Builder', 'js_composer'), 'custom_label' => __('Grid Builder', 'js_composer'), 'description' => __('Control user access to Grid Builder and Grid Builder Elements.', 'js_composer')));
开发者ID:severnrescue,项目名称:web,代码行数:3,代码来源:_grid_builder.tpl.php
示例8: vc_bc_access_rule_48_backend_editor_add_cap_disabled_ce_editor
function vc_bc_access_rule_48_backend_editor_add_cap_disabled_ce_editor($role)
{
if (!$role) {
return $role;
}
$part = vc_role_access()->who($role->name)->part('backend_editor');
if (!isset($part->getRole()->capabilities[$part->getStateKey()])) {
$group_access_settings = vc_settings()->get('groups_access_rules');
if (isset($group_access_settings[$role->name]['show']) && 'only' === $group_access_settings[$role->name]['show']) {
$role->capabilities[$part->getStateKey() . '/disabled_ce_editor'] = true;
}
}
return $role;
}
开发者ID:severnrescue,项目名称:web,代码行数:14,代码来源:bc-access-rules-4.8.php
示例9: die
<?php
if (!defined('ABSPATH')) {
die('-1');
}
vc_include_template('pages/partials/vc-roles-parts/_part.tpl.php', array('part' => $part, 'role' => $role, 'params_prefix' => 'vc_roles[' . $role . '][' . $part . ']', 'controller' => vc_role_access()->who($role)->part($part), 'options' => array(array(true, __('Enabled', 'js_composer')), array(false, __('Disabled', 'js_composer'))), 'main_label' => __('Page settings', 'js_composer'), 'description' => __('Control access to Visual Composer page settings. Note: Disable page settings to restrict editing of Custom CSS through page.', 'js_composer')));
开发者ID:arkev,项目名称:IntelligentMode,代码行数:6,代码来源:_post_settings.tpl.php
示例10: vc_include_template
<?php
vc_include_template('pages/partials/vc-roles-parts/_part.tpl.php', array('part' => $part, 'role' => $role, 'params_prefix' => 'vc_roles[' . $role . '][' . $part . ']', 'controller' => vc_role_access()->who($role)->part($part), 'custom_value' => 'custom', 'capabilities' => $vc_role->getPostTypes(), 'options' => array(array(true, __('Pages only', 'js_composer')), array('custom', __('Custom', 'js_composer')), array(false, __('Disabled', 'js_composer'))), 'main_label' => __('Post types', 'js_composer'), 'custom_label' => __('Post types', 'js_composer'), 'description' => __('Enable Visual Composer for pages, posts and custom post types. Note: By default Visual Composer is available for pages only.', 'js_composer')));
开发者ID:ntngiri,项目名称:Wordpress-dhaba,代码行数:3,代码来源:_post_types.tpl.php
示例11: vc_include_template
<?php
vc_include_template('pages/partials/vc-roles-parts/_part.tpl.php', array('part' => $part, 'role' => $role, 'params_prefix' => 'vc_roles[' . $role . '][' . $part . ']', 'controller' => vc_role_access()->who($role)->part($part), 'capabilities' => array(array('disabled_ce_editor', __('Disable Classic editor', 'js_composer'))), 'options' => array(array(true, __('Enabled', 'js_composer')), array('default', __('Enabled and default', 'js_composer')), array(false, __('Disabled', 'js_composer'))), 'main_label' => __('Backend editor', 'js_composer'), 'custom_label' => __('Backend editor', 'js_composer')));
开发者ID:hikaram,项目名称:wee,代码行数:3,代码来源:_backend_editor.tpl.php
注:本文中的vc_role_access函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论