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,44 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
?>
<fieldset>
<legend class="screen-reader-text">
<span><?php echo esc_html( $title ); ?></span>
</legend>
<table class="vc_general vc_wp-form-table fixed">
<thead>
<tr>
<th><?php esc_html_e( 'Post type', 'js_composer' ); ?></th>
<th><?php esc_html_e( 'Template', 'js_composer' ); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ( $post_types as $post_type ) : ?>
<?php $post_type_object = get_post_type_object( $post_type[0] ); ?>
<tr>
<td title="<?php echo esc_attr( $post_type[0] ); ?>">
<?php echo esc_html( $post_type_object ? $post_type_object->labels->name : $post_type[0] ); ?>
</td>
<td>
<select name="<?php echo esc_attr( $field_key ); ?>[<?php echo esc_attr( $post_type[0] ); ?>]">
<option value=""><?php esc_html_e( 'None', 'js_composer' ); ?></option>
<?php foreach ( $templates as $templates_category ) : ?>
<optgroup label="<?php echo esc_attr( $templates_category['category_name'] ); ?>">
<?php foreach ( $templates_category['templates'] as $template ) : ?>
<?php
$key = $template['type'] . '::' . esc_attr( $template['unique_id'] );
?>
<option value="<?php echo esc_attr( $key ); ?>"<?php echo isset( $value[ $post_type[0] ] ) && $value[ $post_type[0] ] === $key ? ' selected="true"' : ''; ?>><?php echo esc_html( $template['name'] ); ?></option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</fieldset>

View File

@@ -0,0 +1,17 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
?>
<div class="wrap vc_settings" id="wpb-js-composer-settings">
<h2><?php esc_html_e( 'WPBakery Page Builder Settings', 'js_composer' ); ?></h2>
<?php settings_errors(); ?>
<?php
vc_include_template( '/pages/partials/_settings_tabs.php',
array(
'active_tab' => $active_page->getSlug(),
'tabs' => $pages,
) );
?>
<?php $active_page->render(); ?>
</div>

View File

@@ -0,0 +1,89 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
$tab = esc_attr( preg_replace( '/^vc\-/', '', $page->getSlug() ) );
$editable_roles = get_editable_roles();
require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-roles.php' );
$vc_role = new Vc_Roles();
?>
<form action="<?php echo esc_attr( admin_url( 'admin-ajax.php' ) ); ?>" method="post"
id="vc_settings-<?php echo esc_attr( $tab ); ?>"
class="vc_settings-tab-content vc_settings-tab-content-active"
data-vc-roles="form">
<div class="tab_intro">
<p><?php esc_html_e( 'Control user group role access to the features and options of WPBakery Page Builder - manage WordPress default and custom roles.', 'js_composer' ); ?></p>
</div>
<!-- Settings template start -->
<div class="vc_wp-settings">
<div class="vc_wp-accordion" data-vc-action="collapseAll">
<?php
foreach ( $editable_roles as $role => $details ) :
$name = translate_user_role( $details['name'] );
$unique_id = 'vc_role-' . $role;
$valid_roles = array();
foreach ( $vc_role->getParts() as $part ) {
if ( $vc_role->hasRoleCapability( $role, $vc_role->getPartCapability( $part ) ) ) {
$valid_roles[] = $part;
}
}
if ( count( $valid_roles ) > 0 ) :
?>
<div
class="vc_wp-accordion-panel vc_ui-settings-roles-role<?php echo ! isset( $next ) ? ' vc_active' : ''; ?>"
data-vc-unique-id="<?php echo esc_attr( $unique_id ); ?>"
data-vc-content=".vc_wp-accordion-panel-body"
data-vc-role="<?php echo esc_attr( $role ); ?>">
<div class="widget" data-vc-accordion=""
data-vc-container=".vc_wp-accordion"
data-vc-target="[data-vc-unique-id=<?php echo esc_attr( $unique_id ); ?>]">
<div class="widget-top">
<div class="widget-title-action">
<button type="button" class="widget-action hide-if-no-js" aria-expanded="true">
<span class="screen-reader-text">Edit widget: Search</span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
</div>
<div class="widget-title">
<h4>
<?php echo esc_html( $name ); ?>
<span class="in-widget-title"></span>
</h4>
</div>
</div>
</div>
<div class="vc_wp-accordion-panel-body">
<table class="form-table">
<tbody>
<?php
$next = true;
foreach ( $valid_roles as $part ) {
vc_include_template( 'pages/partials/vc-roles-parts/_' . $part . '.tpl.php', array(
'part' => $part,
'role' => $role,
'vc_role' => $vc_role,
) );
}
?>
</tbody>
</table>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<span class="vc_settings-spinner vc_ui-wp-spinner" style="display: none;" id="vc_wp-spinner"></span>
<!-- Settings template end -->
<?php
wp_nonce_field( 'vc_settings-' . $tab . '-action', 'vc_nonce_field' );
$submit_button_attributes = array();
$submit_button_attributes = apply_filters( 'vc_settings-tab-submit-button-attributes', $submit_button_attributes, $tab );
$submit_button_attributes = apply_filters( 'vc_settings-tab-submit-button-attributes-' . $tab, $submit_button_attributes, $tab );
submit_button( esc_html__( 'Save Changes', 'js_composer' ), 'primary', 'submit_btn', true, $submit_button_attributes );
?>
<input type="hidden" name="action" value="vc_roles_settings_save"
id="vc_settings-<?php echo esc_attr( $tab ); ?>-action"/>
</form>

View File

@@ -0,0 +1,126 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
$tab = esc_attr( preg_replace( '/^vc\-/', '', $page->getSlug() ) );
$use_custom = get_option( vc_settings()->getFieldPrefix() . 'use_custom' );
$css = ( ( 'color' === $tab ) && $use_custom ) ? ' color_enabled' : '';
$dev_environment = vc_license()->isDevEnvironment();
$license_key = vc_license()->getLicenseKey();
$classes = 'vc_settings-tab-content vc_settings-tab-content-active ' . esc_attr( $css );
$custom_tag = 'script';
?>
<<?php echo esc_attr( $custom_tag ); ?>>
window.vcAdminNonce = '<?php echo esc_js( vc_generate_nonce( 'vc-admin-nonce' ) ); ?>';
</<?php echo esc_attr( $custom_tag ); ?>>
<?php if ( 'updater' === $tab && $dev_environment && ! vc_license()->isActivated() ) : ?>
<br/>
<div class="updated vc_updater-result-message">
<p>
<strong>
<?php esc_html_e( 'It is optional to activate license on localhost development environment. You can still activate license on localhost to receive plugin updates and get access to template library.', 'js_composer' ); ?>
</strong>
</p>
</div>
<?php endif ?>
<form action="options.php"
method="post"
id="vc_settings-<?php echo esc_attr( $tab ); ?>"
data-vc-ui-element="settings-tab-<?php echo esc_attr( $tab ); ?>"
class="<?php echo esc_attr( $classes ); ?>"
<?php echo apply_filters( 'vc_setting-tab-form-' . esc_attr( $tab ), '' ); ?>
>
<?php settings_fields( vc_settings()->getOptionGroup() . '_' . $tab ); ?>
<?php do_settings_sections( vc_settings()->page() . '_' . $tab ); ?>
<?php if ( 'general' === $tab && vc_pointers_is_dismissed() ) : ?>
<table class="form-table">
<tr>
<th scope="row"><?php esc_html_e( 'Guide tours', 'js_composer' ); ?></th>
<td>
<a href="#" class="button vc_pointers-reset-button"
id="vc_settings-vc-pointers-reset"
data-vc-done-txt="<?php esc_attr_e( 'Done', 'js_composer' ); ?>"><?php esc_html_e( 'Reset', 'js_composer' ); ?></a>
<p
class="description indicator-hint"><?php esc_html_e( 'Guide tours are shown in VC editors to help you to start working with editors. You can see them again by clicking button above.', 'js_composer' ); ?></p>
</td>
</tr>
</table>
<?php endif ?>
<?php
$submit_button_attributes = array();
$submit_button_attributes = apply_filters( 'vc_settings-tab-submit-button-attributes', $submit_button_attributes, $tab );
$submit_button_attributes = apply_filters( 'vc_settings-tab-submit-button-attributes-' . $tab, $submit_button_attributes, $tab );
?>
<?php if ( 'updater' !== $tab ) : ?>
<?php submit_button( esc_html__( 'Save Changes', 'js_composer' ), 'primary', 'submit_btn', true, $submit_button_attributes ); ?>
<?php endif ?>
<input type="hidden" name="vc_action" value="vc_action-<?php echo esc_attr( $tab ); ?>"
id="vc_settings-<?php echo esc_attr( $tab ); ?>-action"/>
<?php if ( 'color' === $tab ) : ?>
<a href="#" class="button vc_restore-button" id="vc_settings-color-restore-default">
<?php echo esc_html__( 'Restore Default', 'js_composer' ); ?>
</a>
<?php endif ?>
<?php if ( 'updater' === $tab ) : ?>
<div class="vc_settings-activation-deactivation">
<?php if ( vc_license()->isActivated() ) : ?>
<p>
<?php echo esc_html__( 'You have activated WPBakery Page Builder version which allows you to access all the customer benefits. Thank you for choosing WPBakery Page Builder as your page builder. If you do not wish to use WPBakery Page Builder on this WordPress site you can deactivate your license below.', 'js_composer' ); ?>
</p>
<br/>
<p>
<button
class="button button-primary button-hero button-updater"
data-vc-action="deactivation"
type="button"
id="vc_settings-updater-button">
<?php echo esc_html__( 'Deactivate WPBakery Page Builder', 'js_composer' ); ?>
</button>
<img src="<?php echo esc_url( get_admin_url() ); ?>/images/wpspin_light.gif" class="vc_updater-spinner"
id="vc_updater-spinner" width="16" height="16" alt="spinner"/>
</p>
<?php else : ?>
<p>
<?php echo sprintf( esc_html__( 'In order to receive all benefits of WPBakery Page Builder, you need to activate your copy of the plugin. By activating WPBakery Page Builder license you will unlock premium options - %1$sdirect plugin updates%2$s, access to %1$stemplate library%2$s and %1$sofficial support.%2$s', 'js_composer' ), '<strong>', '</strong>' ); ?>
</p>
<br/>
<p>
<button
class="button button-primary button-hero button-updater"
data-vc-action="activation"
type="button"
id="vc_settings-updater-button">
<?php echo esc_html__( 'Activate WPBakery Page Builder', 'js_composer' ); ?>
</button>
<img src="<?php echo esc_url( get_admin_url() ); ?>/images/wpspin_light.gif" class="vc_updater-spinner"
id="vc_updater-spinner" width="16" height="16" alt="spinner"/>
</p>
<p class="description">
<?php printf( esc_html__( 'Don\'t have direct license yet? %sPurchase WPBakery Page Builder license%s.', 'js_composer' ), '<a href="' . esc_url( 'https://go.wpbakery.com/wpb-buy' ) . '" target="_blank">', '</a>' ); ?>
</p>
<?php endif ?>
</div>
<?php endif ?>
</form>

View File

@@ -0,0 +1,14 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
$custom_tag = 'script';
?>
<<?php echo esc_attr( $custom_tag ); ?>>
window.vcAdminNonce = '<?php echo esc_js( vc_generate_nonce( 'vc-admin-nonce' ) ); ?>';
</<?php echo esc_attr( $custom_tag ); ?>>
<form action="options.php" method="post" id="vc_settings-automapper"
class="vc_settings-tab-content vc_settings-tab-content-active"
>
<?php vc_automapper()->renderHtml(); ?>
</form>