This commit is contained in:
KhaiNguyen
2020-02-13 10:39:37 +07:00
commit 59401cb805
12867 changed files with 4646216 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
?>
<h2 class="nav-tab-wrapper">
<?php foreach ( $tabs as $slug => $title ) : ?>
<?php $url = 'admin.php?page=' . rawurlencode( $slug ); ?>
<a href="<?php echo esc_attr( is_network_admin() ? network_admin_url( $url ) : admin_url( $url ) ); ?>"
class="nav-tab<?php echo $active_tab === $slug ? esc_attr( ' nav-tab-active' ) : ''; ?>">
<?php echo esc_html( $title ); ?>
</a>
<?php endforeach ?>
</h2>

View File

@@ -0,0 +1,14 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
?>
<h2 class="nav-tab-wrapper">
<?php foreach ( $tabs as $tab_slug => $title ) : ?>
<?php $url = 'admin.php?page=' . rawurlencode( $slug ) . '&tab=' . rawurlencode( $tab_slug ); ?>
<a href="<?php echo esc_attr( is_network_admin() ? network_admin_url( $url ) : admin_url( $url ) ); ?>"
class="nav-tab<?php echo $active_tab === $tab_slug ? esc_attr( ' nav-tab-active' ) : ''; ?>">
<?php echo esc_html( $title ); ?>
</a>
<?php endforeach ?>
</h2>

View File

@@ -0,0 +1,33 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/** @var string $part */
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',
esc_html__( 'Disable Classic editor', 'js_composer' ),
),
),
'options' => array(
array(
true,
esc_html__( 'Enabled', 'js_composer' ),
),
array(
'default',
esc_html__( 'Enabled and default', 'js_composer' ),
),
array(
false,
esc_html__( 'Disabled', 'js_composer' ),
),
),
'main_label' => esc_html__( 'Backend editor', 'js_composer' ),
'custom_label' => esc_html__( 'Backend editor', 'js_composer' ),
) );

View File

@@ -0,0 +1,17 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/** @var string $part */
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, esc_html__( 'Enabled', 'js_composer' ) ),
array( false, esc_html__( 'Disabled', 'js_composer' ) ),
),
'main_label' => esc_html__( 'Drag and Drop', 'js_composer' ),
'description' => esc_html__( 'Control access rights to drag and drop functionality within the editor.', 'js_composer' ),
) );

View File

@@ -0,0 +1,27 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
if ( vc_frontend_editor()->inlineEnabled() ) {
/** @var string $part */
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,
esc_html__( 'Enabled', 'js_composer' ),
),
array(
false,
esc_html__( 'Disabled', 'js_composer' ),
),
),
'main_label' => esc_html__( 'Frontend editor', 'js_composer' ),
'custom_label' => esc_html__( 'Frontend editor', 'js_composer' ),
) );
}

View File

@@ -0,0 +1,24 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/** @var string $part */
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,
esc_html__( 'Enabled', 'js_composer' ),
),
array(
false,
esc_html__( 'Disabled', 'js_composer' ),
),
),
'main_label' => esc_html__( 'Grid Builder', 'js_composer' ),
'custom_label' => esc_html__( 'Grid Builder', 'js_composer' ),
'description' => esc_html__( 'Control user access to Grid Builder and Grid Builder Elements.', 'js_composer' ),
) );

View File

@@ -0,0 +1,159 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
?>
<?php /** @var Vc_Role_Access_Controller $controller */ ?>
<tr>
<th scope="row"><?php echo esc_html( $main_label ); ?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html( $main_label ); ?></span></legend>
<select name="<?php echo esc_attr( $params_prefix . '[_state]' ); ?>"
data-vc-part="<?php echo esc_attr( $part ); ?>"
data-vc-name="<?php echo esc_attr( '_state' ); ?>"
<?php if ( ! empty( $capabilities ) ) : ?>data-vc-roles="part-state"
data-vc-role-part="<?php echo esc_attr( $part . '-' . $role ); ?>"<?php endif; ?>
class="vc_ui-settings-roles-dropdown">
<?php foreach ( $options as $option ) : ?>
<option
value="<?php echo esc_attr( $option[0] ? (string) $option[0] : '0' ); ?>"
<?php echo isset( $option[2] ) ? ' data-vc-custom-selector="' . esc_attr( $option[2] ) . '"' : ''; ?>
<?php echo $controller->getState() === $option[0] ? ' selected' : ''; ?>><?php echo esc_html( $option[1] ); ?></option>
<?php endforeach; ?>
</select>
<?php if ( isset( $description ) && ! empty( $description ) ) : ?>
<p class="description"><?php echo esc_html( $description ); ?></p>
<?php endif; ?>
</fieldset>
</td>
</tr>
<?php if ( ! empty( $capabilities ) ) : ?>
<?php if ( isset( $use_table ) && true === $use_table ) : ?>
<?php
require_once vc_path_dir( 'EDITORS_DIR', 'popups/class-vc-add-element-box.php' );
$add_box = new Vc_Add_Element_Box();
?>
<tr data-vc-role-related-part="<?php echo esc_attr( $part . '-' . $role ); ?>"
data-vc-role-part-state="<?php echo esc_attr( isset( $custom_value ) ? $custom_value : '*' ); ?>"
class="vc_role-custom-settings<?php echo ! isset( $custom_value ) || (string) $controller->getState() === (string) $custom_value ? ' vc_visible' : ''; ?>">
<th scope="row"></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php echo esc_html( $custom_label ); ?></span>
</legend>
<?php if ( isset( $categories ) && ! empty( $categories ) ) : ?>
<?php
vc_include_template( 'editors/partials/add_element_tabs.tpl.php', array(
'categories' => $categories,
) )
?>
<?php endif; ?>
<table class="vc_general vc_wp-form-table fixed" data-vc-roles="table">
<thead>
<tr>
<th><?php echo esc_html( $item_header_name ); ?></th>
<?php foreach ( $cap_types as $type ) : ?>
<th class="column-date">
<label>
<input type="checkbox" name="all" data-vc-related-controls="tfoot [data-vc-roles-select-all-checkbox]" data-vc-roles-select-all-checkbox="<?php echo esc_attr( $type[0] ); ?>"><?php echo esc_html( $type[1] ); ?>
</label>
</th>
<?php endforeach; ?>
</tr>
</thead>
<tfoot<?php echo isset( $global_set ) ? ' style="display: none;"' : ''; ?>>
<tr>
<th><?php echo esc_html( $item_header_name ); ?></th>
<?php foreach ( $cap_types as $type ) : ?>
<th class="column-date">
<label>
<input type="checkbox" name="all" data-vc-related-controls="thead [data-vc-roles-select-all-checkbox]" data-vc-roles-select-all-checkbox="<?php echo esc_attr( $type[0] ); ?>"><?php echo esc_html( $type[1] ); ?>
</label>
</th>
<?php endforeach; ?>
</tr>
</tfoot>
<tbody<?php echo isset( $global_set ) ? ' style="display: none;"' : ''; ?>>
<?php foreach ( $capabilities as $cap ) : ?>
<?php if ( ! isset( $ignore_capabilities ) || ! in_array( $cap['base'], $ignore_capabilities, true ) ) : ?>
<?php
$category_css_classes = '';
if ( isset( $cap['_category_ids'] ) ) {
foreach ( $cap['_category_ids'] as $id ) {
$category_css_classes .= ' js-category-' . $id;
}
}
?>
<tr data-vc-capability="<?php echo esc_attr( $cap['base'] ); ?>"
class="<?php echo esc_attr( trim( $category_css_classes ) ); ?>">
<td title="<?php echo esc_attr( $cap['base'] ); ?>">
<?php
// @codingStandardsIgnoreLine
print $add_box->renderIcon( $cap );
?>
<div>
<?php echo esc_html( $cap['name'] ); ?>
<?php echo ! empty( $cap['description'] ) ? '<span class="vc_element-description">' . esc_html( $cap['description'] ) . '</span>' : ''; ?>
</div>
</td>
<?php foreach ( $cap_types as $type ) : ?>
<td>
<div class="vc_wp-form-checkbox">
<label>
<input type="checkbox" name="<?php echo esc_attr( $params_prefix . '[' . $role . '][' . $part . ']' . '[' . $cap['base'] . '_' . $type[0] . ']' ); ?>" data-vc-part="<?php echo esc_attr( $part ); ?>" data-vc-name="<?php echo esc_attr( $cap['base'] . '_' . $type[0] ); ?>" data-vc-roles="table-checkbox" data-vc-cap="<?php echo esc_attr( $type[0] ); ?>" value="1"<?php echo ! isset( $global_set ) && $controller->can( $cap['base'] . '_' . $type[0], false )->get() ? ' checked' : ''; ?>>
<?php echo esc_html( $type[1] ); ?>
</label>
</div>
</td>
<?php endforeach; ?>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
</fieldset>
</td>
</tr>
<?php else : ?>
<tr data-vc-role-related-part="<?php echo esc_attr( $part . '-' . $role ); ?>" data-vc-role-part-state="<?php echo esc_attr( isset( $custom_value ) ? $custom_value : '*' ); ?>" class="vc_role-custom-settings<?php echo ! isset( $custom_value ) || $controller->getState() === $custom_value ? ' vc_visible' : ''; ?>">
<th scope="row"></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php echo esc_html( $custom_label ); ?></span>
</legend>
<div class="vc_wp-form-row">
<?php foreach ( $capabilities as $cap ) : ?>
<div class="vc_wp-form-col vc_wp-form-checkbox">
<label>
<input type="checkbox" name="<?php echo esc_attr( $params_prefix . '[' . $cap[0] . ']' ); ?>" value="1" class="vc_roles-settings-checkbox"
<?php
// hard coded yes :)
if ( 'administrator' === $role && 'settings' === $part && ( 'vc-roles-tab' === $cap[0] || 'vc-updater-tab' === $cap[0] ) ) {
echo ' disabled checked';
} else {
?>
data-vc-part="<?php echo esc_attr( $part ); ?>"
data-vc-name="<?php echo esc_attr( $cap[0] ); ?>"
data-vc-roles="serialize"
data-vc-roles="checkbox"
<?php
echo $controller->can( $cap[0], false )->get() ? ' checked' : ''
?>
<?php
}
?>
>
<?php echo esc_html( $cap[1] ); ?>
</label>
</div>
<?php endforeach; ?>
</div>
</fieldset>
</td>
</tr>
<?php endif; ?>
<?php endif; ?>

View File

@@ -0,0 +1,16 @@
<?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, esc_html__( 'Enabled', 'js_composer' ) ),
array( false, esc_html__( 'Disabled', 'js_composer' ) ),
),
'main_label' => esc_html__( 'Page settings', 'js_composer' ),
'description' => esc_html__( 'Control access to WPBakery Page Builder page settings. Note: Disable page settings to restrict editing of Custom CSS through page.', 'js_composer' ),
) );

View File

@@ -0,0 +1,21 @@
<?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' => $vc_role->getPostTypes(),
'options' => array(
array( true, esc_html__( 'Pages only', 'js_composer' ) ),
array( 'custom', esc_html__( 'Custom', 'js_composer' ) ),
array( false, esc_html__( 'Disabled', 'js_composer' ) ),
),
'main_label' => esc_html__( 'Post types', 'js_composer' ),
'custom_label' => esc_html__( 'Post types', 'js_composer' ),
'description' => esc_html__( 'Enable WPBakery Page Builder for pages, posts and custom post types. Note: By default WPBakery Page Builder is available for pages only.', 'js_composer' ),
) );

View File

@@ -0,0 +1,17 @@
<?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, esc_html__( 'All', 'js_composer' ) ),
array( 'add', esc_html__( 'Apply presets only', 'js_composer' ) ),
array( false, esc_html__( 'Disabled', 'js_composer' ) ),
),
'main_label' => esc_html__( 'Element Presets', 'js_composer' ),
'description' => esc_html__( 'Control access rights to element presets in element edit form. Note: "Apply presets only" restricts users from saving new presets and deleting existing.', 'js_composer' ),
) );

View File

@@ -0,0 +1,24 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
$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, esc_html__( 'All', 'js_composer' ) ),
array( 'custom', esc_html__( 'Custom', 'js_composer' ) ),
array( false, esc_html__( 'Disabled', 'js_composer' ) ),
),
'main_label' => esc_html__( 'Settings options', 'js_composer' ),
'custom_label' => esc_html__( 'Settings options', 'js_composer' ),
'description' => esc_html__( 'Control access rights to WPBakery Page Builder admin settings tabs (e.g. General Settings, Shortcode Mapper, ...)', 'js_composer' ),
) );

View File

@@ -0,0 +1,39 @@
<?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', esc_html__( 'All', 'js_composer' ) ),
array( 'edit', esc_html__( 'Edit', 'js_composer' ) ),
),
'item_header_name' => esc_html__( 'Element', 'js_composer' ),
'options' => array(
array( true, esc_html__( 'All', 'js_composer' ) ),
array( 'edit', esc_html__( 'Edit only', 'js_composer' ) ),
array( 'custom', esc_html__( 'Custom', 'js_composer' ) ),
),
'main_label' => esc_html__( 'Elements', 'js_composer' ),
'custom_label' => esc_html__( 'Elements', 'js_composer' ),
'description' => esc_html__( 'Control user access to content elements.', 'js_composer' ),
'use_table' => true,
) );

View File

@@ -0,0 +1,17 @@
<?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, esc_html__( 'All', 'js_composer' ) ),
array( 'add', esc_html__( 'Apply templates only', 'js_composer' ) ),
array( false, esc_html__( 'Disabled', 'js_composer' ) ),
),
'main_label' => esc_html__( 'Templates', 'js_composer' ),
'description' => esc_html__( 'Control access rights to templates and predefined templates. Note: "Apply templates only" restricts users from saving new templates and deleting existing.', 'js_composer' ),
) );