本文整理汇总了PHP中et_pb_is_allowed函数的典型用法代码示例。如果您正苦于以下问题:PHP et_pb_is_allowed函数的具体用法?PHP et_pb_is_allowed怎么用?PHP et_pb_is_allowed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了et_pb_is_allowed函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: et_pb_check_options_access
function et_pb_check_options_access()
{
// display wp error screen if theme customizer disabled for current user
if (!et_pb_is_allowed('theme_options')) {
wp_die(__("you don't have sufficient permissions to access this page", 'extra'));
}
}
示例2: et_core_portability_register
/**
* Register portability.
*
* This function should be called in an 'admin_init' action callback.
*
* @since 1.0.0
*
* @param string $context A unique ID used to register the portability arguments.
*
* @param array $args {
* Array of arguments used to register the portability.
*
* @type string $name The name used in the various text string.
* @type bool $view Whether the assets and content should load or not.
* Example: `isset( $_GET['page'] ) && $_GET['page'] == 'example'`.
* @type string $db The option_name from the wp_option table used to export and import data.
* @type array $include Optional. Array of all the options scritcly included. Options ids must be set
* as the array keys.
* @type array $exclude Optional. Array of excluded options. Options ids must be set as the array keys.
* }
* @return bool.
*/
function et_core_portability_register($context, $args)
{
$defaults = array('context' => $context, 'name' => false, 'view' => false, 'type' => false, 'target' => false, 'include' => array(), 'exclude' => array());
$data = apply_filters("et_core_portability_args_{$context}", (object) array_merge($defaults, (array) $args));
et_core_cache_set($context, $data, 'et_core_portability');
// Stop here if not allowed.
if (function_exists('et_pb_is_allowed') && !et_pb_is_allowed(array('portability', "{$data->context}_portability"))) {
// Set view to false if not allowed.
$data->view = false;
et_core_cache_set($context, $data, 'et_core_portability');
return;
}
if ($data->view) {
et_core_portability_load($context);
}
}
示例3: et_fb_enabled
function et_fb_enabled()
{
if (defined('ET_FB_ENABLED')) {
return ET_FB_ENABLED;
}
if (empty($_GET['et_fb'])) {
return false;
}
if (is_customize_preview()) {
return false;
}
if (!is_single() && !is_page()) {
return false;
}
if (!et_fb_is_user_can_edit()) {
return false;
}
if (!et_pb_is_allowed('use_visual_builder')) {
return false;
}
return true;
}
示例4: et_pb_hide_options_menu
/**
*
* Adds js script which removes the top menu item from Divi menu if it's disabled
*
*/
function et_pb_hide_options_menu()
{
// do nothing if plugin options should be displayed in the menu
if (et_pb_is_allowed('theme_options')) {
return;
}
wp_enqueue_script('et-builder-custom-admin-menu', ET_BUILDER_PLUGIN_URI . '/js/menu_fix.js', array('jquery'), $this->plugin_version, true);
}
示例5: wrap_settings
function wrap_settings($output)
{
$tabs_output = '';
$i = 0;
$tabs = array();
// General Settings Tab should be added to all modules if allowed
if (et_pb_is_allowed('general_settings')) {
$tabs['general'] = isset($this->main_tabs['general']) ? $this->main_tabs['general'] : __('General Settings', 'et_builder');
}
foreach ($this->used_tabs as $tab_slug) {
if ('general' === $tab_slug) {
continue;
}
// Add only tabs allowed for current user
if (et_pb_is_allowed($tab_slug . '_settings')) {
$tabs[$tab_slug] = $this->main_tabs[$tab_slug];
}
}
foreach ($tabs as $tab_slug => $tab_name) {
$i++;
$tabs_output .= sprintf('<li class="%2$s%3$s">
<a href="#">%1$s</a>
</li>', esc_html($tab_name), esc_attr("et_pb_options_tab_{$tab_slug}"), 1 === $i ? ' et-pb-options-tabs-links-active' : '');
}
$tabs_output = sprintf('<ul class="et-pb-options-tabs-links">%1$s</ul>', $tabs_output);
$preview_tabs_output = sprintf('<ul class="et-pb-preview-screensize-switcher">
<li><a href="#" class="et-pb-preview-mobile" data-width="375"><span class="label">%1$s</span></a></li>
<li><a href="#" class="et-pb-preview-tablet" data-width="768"><span class="label">%2$s</span></a></li>
<li><a href="#" class="et-pb-preview-desktop active"><span class="label">%3$s</span></a></li>
</ul>', esc_html__('Mobile', 'et_builder'), esc_html__('Tablet', 'et_builder'), esc_html__('Desktop', 'et_builder'));
$output = sprintf('%2$s
%3$s
<div class="et-pb-options-tabs">
%1$s
</div> <!-- .et-pb-options-tabs -->
<div class="et-pb-preview-tab"></div> <!-- .et-pb-preview-tab -->
', $output, $tabs_output, $preview_tabs_output);
return sprintf('%2$s<div class="et-pb-main-settings">%1$s</div> <!-- .et-pb-main-settings -->%3$s', "\n\t\t" . $output, "\n\t\t", "\n");
}
示例6: et_pb_pagebuilder_meta_box
function et_pb_pagebuilder_meta_box()
{
global $typenow;
do_action('et_pb_before_page_builder');
echo '<div id="et_pb_hidden_editor">';
wp_editor('', 'et_pb_content_new', array('media_buttons' => true));
echo '</div>';
printf('<div id="et_pb_main_container" class="post-type-%1$s%2$s"></div>', esc_attr($typenow), !et_pb_is_allowed('move_module') ? ' et-pb-disable-sort' : '');
$rename_module_menu = sprintf('<%% if ( this.hasOption( "rename" ) ) { %%>
<li><a class="et-pb-right-click-rename" href="#">%1$s</a></li>
<%% } %%>', esc_html__('Rename', 'et_builder'));
$copy_module_menu = sprintf('<%% if ( this.hasOption( "copy" ) ) { %%>
<li><a class="et-pb-right-click-copy" href="#">%1$s</a></li>
<%% } %%>', esc_html__('Copy', 'et_builder'));
$paste_after_menu = sprintf('<%% if ( this.hasOption( "paste-after" ) ) { %%>
<li><a class="et-pb-right-click-paste-after" href="#">%1$s</a></li>
<%% } %%>', esc_html__('Paste After', 'et_builder'));
$paste_menu_item = sprintf('<%% if ( this.hasOption( "paste-column" ) ) { %%>
<li><a class="et-pb-right-click-paste-column" href="#">%1$s</a></li>
<%% } %%>', esc_html__('Paste', 'et_builder'));
$paste_app_menu_item = sprintf('<%% if ( this.hasOption( "paste-app" ) ) { %%>
<li><a class="et-pb-right-click-paste-app" href="#">%1$s</a></li>
<%% } %%>', esc_html__('Paste', 'et_builder'));
$save_to_lib_menu = sprintf('<%% if ( this.hasOption( "save-to-library") ) { %%>
<li><a class="et-pb-right-click-save-to-library" href="#">%1$s</a></li>
<%% } %%>', esc_html__('Save to Library', 'et_builder'));
$lock_unlock_menu = sprintf('<%% if ( this.hasOption( "lock" ) ) { %%>
<li><a class="et-pb-right-click-lock" href="#"><span class="unlock">%1$s</span><span class="lock">%2$s</span></a></li>
<%% } %%>', esc_html__('Unlock', 'et_builder'), esc_html__('Lock', 'et_builder'));
$enable_disable_menu = sprintf('<%% if ( this.hasOption( "disable" ) ) { %%>
<li><a class="et-pb-right-click-disable" href="#"><span class="enable">%1$s</span><span class="disable">%2$s</span></a></li>
<%% } %%>', esc_html__('Enable', 'et_builder'), esc_html__('Disable', 'et_builder'));
// Right click options Template
printf('<script type="text/template" id="et-builder-right-click-controls-template">
<ul class="options">
<%% if ( "module" !== this.options.model.attributes.type || _.contains( %13$s, this.options.model.attributes.module_type ) ) { %%>
%1$s
%8$s
<%% if ( this.hasOption( "undo" ) ) { %%>
<li><a class="et-pb-right-click-undo" href="#">%9$s</a></li>
<%% } %%>
<%% if ( this.hasOption( "redo" ) ) { %%>
<li><a class="et-pb-right-click-redo" href="#">%10$s</a></li>
<%% } %%>
%2$s
%3$s
<%% if ( this.hasOption( "collapse" ) ) { %%>
<li><a class="et-pb-right-click-collapse" href="#"><span class="expand">%4$s</span><span class="collapse">%5$s</span></a></li>
<%% } %%>
%6$s
%7$s
%12$s
%11$s
<%% } %%>
<%% if ( this.hasOption( "preview" ) ) { %%>
<li><a class="et-pb-right-click-preview" href="#">%14$s</a></li>
<%% } %%>
</ul>
</script>', et_pb_is_allowed('edit_module') && (et_pb_is_allowed('general_settings') || et_pb_is_allowed('advanced_settings') || et_pb_is_allowed('custom_css_settings')) ? $rename_module_menu : '', et_pb_is_allowed('disable_module') ? $enable_disable_menu : '', et_pb_is_allowed('lock_module') ? $lock_unlock_menu : '', esc_html__('Expand', 'et_builder'), esc_html__('Collapse', 'et_builder'), et_pb_is_allowed('add_module') ? $copy_module_menu : '', et_pb_is_allowed('add_module') ? $paste_after_menu : '', et_pb_is_allowed('divi_library') && et_pb_is_allowed('save_library') ? $save_to_lib_menu : '', esc_html__('Undo', 'et_builder'), esc_html__('Redo', 'et_builder'), et_pb_is_allowed('add_module') ? $paste_menu_item : '', et_pb_is_allowed('add_module') ? $paste_app_menu_item : '', et_pb_allowed_modules_list(), esc_html__('Preview', 'et_builder'));
// "Rename Module Admin Label" Modal Window Template
printf('<script type="text/template" id="et-builder-prompt-modal-rename_admin_label">
<div class="et_pb_prompt_modal">
<a href="#" class="et_pb_prompt_dont_proceed et-pb-modal-close">
<span>%1$s</span>
</a>
<div class="et_pb_prompt_buttons">
<br/>
<input type="submit" class="et_pb_prompt_proceed" value="%2$s" />
</div>
</div>
</script>', esc_html__('Cancel', 'et_builder'), esc_attr__('Save', 'et_builder'));
// "Rename Module Admin Label" Modal Content Template
printf('<script type="text/template" id="et-builder-prompt-modal-rename_admin_label-text">
<h3>%1$s</h3>
<p>%2$s</p>
<input type="text" value="" id="et_pb_new_admin_label" class="regular-text" />
</script>', esc_html__('Rename', 'et_builder'), esc_html__('Enter a new name for this module', 'et_builder'));
$save_to_lib_button = sprintf('<a href="#" class="et-pb-layout-buttons et-pb-layout-buttons-save" title="%1$s">
<span>%2$s</span>
</a>', esc_attr__('Save to Library', 'et_builder'), esc_html__('Save to Library', 'et_builder'));
$load_from_lib_button = sprintf('<a href="#" class="et-pb-layout-buttons et-pb-layout-buttons-load" title="%1$s">
<span>%2$s</span>
</a>', esc_attr__('Load From Library', 'et_builder'), esc_html__('Load From Library', 'et_builder'));
$clear_layout_button = sprintf('<a href="#" class="et-pb-layout-buttons et-pb-layout-buttons-clear" title="%1$s">
<span>%2$s</span>
</a>', esc_attr__('Clear Layout', 'et_builder'), esc_html__('Clear Layout', 'et_builder'));
// App Template
//.........这里部分代码省略.........
示例7: et_pb_get_builder_settings_configurations
/**
* Returns array of builder settings' configuration
*
* @return array builder settings' configuration
*/
function et_pb_get_builder_settings_configurations()
{
$settings = array();
if (et_pb_is_allowed('ab_testing')) {
$ab_testing_settings = array(array('type' => 'yes_or_no', 'id' => 'et_pb_enable_ab_testing', 'label' => esc_html__('Enable Split Testing', 'et_builder'), 'autoload' => false, 'class' => 'et-pb-visible', 'affects' => array('et_pb_ab_bounce_rate_limit', 'et_pb_ab_refresh_interval', 'et_pb_enable_shortcode_tracking')), array('type' => 'range', 'id' => 'et_pb_ab_bounce_rate_limit', 'label' => esc_html__('Bounce Rate Limit', 'et_builder'), 'default' => 5, 'step' => 1, 'min' => 3, 'max' => 60, 'depends_show_if' => 'on'), array('type' => 'select', 'id' => 'et_pb_ab_refresh_interval', 'label' => esc_html__('Stats refresh interval', 'et_builder'), 'autoload' => false, 'depends_show_if' => 'on', 'values' => array('hourly' => esc_html__('Hourly', 'et_builder'), 'daily' => esc_html__('Daily', 'et_builder'))), array('type' => 'yes_or_no', 'id' => 'et_pb_enable_shortcode_tracking', 'label' => esc_html__('Shortcode Tracking', 'et_builder'), 'depends_show_if' => 'on', 'affects' => array('et_pb_ab_current_shortcode')), array('type' => 'textarea', 'id' => 'et_pb_ab_current_shortcode', 'label' => esc_html__('Shortcode for Tracking:', 'et_builder'), 'autoload' => false, 'readonly' => 'readonly', 'depends_show_if' => 'on'));
$settings = array_merge($settings, $ab_testing_settings);
}
$standard_settings = array(array('type' => 'textarea', 'id' => 'et_pb_custom_css', 'label' => esc_html__('Custom CSS', 'et_builder')), array('type' => 'colorpalette', 'id' => 'et_pb_color_palette', 'label' => esc_html__('Color Picker Color Pallete', 'et_builder'), 'default' => implode('|', et_pb_get_default_color_palette())), array('type' => 'range', 'id' => 'et_pb_gutter_width', 'label' => esc_html__('Gutter Width', 'et_builder'), 'step' => 1, 'min' => 1, 'max' => 4, 'default' => et_get_option('gutter_width', 3)), array('type' => 'colorpicker', 'id' => 'et_pb_light_text_color', 'label' => esc_html__('Light Text Color', 'et_builder'), 'default' => '#FFFFFF'), array('type' => 'colorpicker', 'id' => 'et_pb_dark_text_color', 'label' => esc_html__('Dark Text Color', 'et_builder'), 'default' => '#666666'), array('type' => 'colorpicker', 'id' => 'et_pb_content_area_background_color', 'label' => esc_html__('Content Area Background Color', 'et_builder')), array('type' => 'colorpicker', 'id' => 'et_pb_section_background_color', 'label' => esc_html__('Section Background Color', 'et_builder'), 'default' => '#FFFFFF'));
$settings = array_merge($settings, $standard_settings);
return apply_filters('et_pb_get_builder_settings_configurations', $settings);
}
示例8: wrap_settings
function wrap_settings($output)
{
$tabs_output = '';
$i = 0;
$tabs = array();
// General Settings Tab should be added to all modules if allowed
if (et_pb_is_allowed('general_settings')) {
$tabs['general'] = isset($this->main_tabs['general']) ? $this->main_tabs['general'] : esc_html__('General Settings', 'et_builder');
}
foreach ($this->used_tabs as $tab_slug) {
if ('general' === $tab_slug) {
continue;
}
// Add only tabs allowed for current user
if (et_pb_is_allowed($tab_slug . '_settings')) {
$tabs[$tab_slug] = $this->main_tabs[$tab_slug];
}
}
$tabs_array = array();
$tabs_json = '';
foreach ($tabs as $tab_slug => $tab_name) {
$i++;
$tabs_array[$i] = array('slug' => $tab_slug, 'label' => $tab_name);
$tabs_json = json_encode($tabs_array);
}
$tabs_output = sprintf('<%%= window.et_builder.options_tabs_output(%1$s) %%>', $tabs_json);
$preview_tabs_output = '<%= window.et_builder.preview_tabs_output() %>';
$output = sprintf('%2$s
%3$s
<div class="et-pb-options-tabs">
%1$s
</div> <!-- .et-pb-options-tabs -->
<div class="et-pb-preview-tab"></div> <!-- .et-pb-preview-tab -->
', $output, $tabs_output, $preview_tabs_output);
return sprintf('%2$s<div class="et-pb-main-settings">%1$s</div> <!-- .et-pb-main-settings -->%3$s', "\n\t\t" . $output, "\n\t\t", "\n");
}
示例9: et_fb_is_enabled
function et_fb_is_enabled($post_id = false)
{
if (!$post_id) {
global $post;
$post_id = isset($post->ID) ? $post->ID : false;
}
if (is_admin()) {
return false;
}
if (is_customize_preview()) {
return false;
}
if (!$post_id) {
return false;
}
if (empty($_GET['et_fb'])) {
return false;
}
if (!current_user_can('edit_posts')) {
return false;
}
if (!et_pb_is_pagebuilder_used($post_id)) {
return false;
}
if (!et_pb_is_allowed('use_visual_builder')) {
return false;
}
return true;
}
示例10: et_pb_ab_clear_stats
function et_pb_ab_clear_stats()
{
// Verify nonce
if (isset($_POST['et_pb_ab_nonce']) && !wp_verify_nonce($_POST['et_pb_ab_nonce'], 'ab_testing_builder_nonce')) {
die(-1);
}
// Verify user permission
if (!current_user_can('edit_posts') || !et_pb_is_allowed('ab_testing')) {
die(-1);
}
$test_id = intval($_POST['et_pb_test_id']);
et_pb_ab_remove_stats($test_id);
et_pb_ab_clear_cache_handler($test_id);
die(1);
}
示例11: et_pb_get_saved_templates
function et_pb_get_saved_templates()
{
if (!wp_verify_nonce($_POST['et_admin_load_nonce'], 'et_admin_load_nonce')) {
die(-1);
}
if (!current_user_can('edit_posts')) {
die(-1);
}
$templates_data = array();
$layout_type = !empty($_POST['et_layout_type']) ? sanitize_text_field($_POST['et_layout_type']) : 'layout';
$module_width = !empty($_POST['et_module_width']) && 'module' === $layout_type ? sanitize_text_field($_POST['et_module_width']) : '';
$additional_condition = '' !== $module_width ? array('taxonomy' => 'module_width', 'field' => 'slug', 'terms' => $module_width) : '';
$is_global = !empty($_POST['et_is_global']) ? sanitize_text_field($_POST['et_is_global']) : 'false';
$global_operator = 'global' === $is_global ? 'IN' : 'NOT IN';
$meta_query = array();
$specialty_query = !empty($_POST['et_specialty_columns']) && 'row' === $layout_type ? sanitize_text_field($_POST['et_specialty_columns']) : '0';
if ('0' !== $specialty_query) {
$columns_val = '3' === $specialty_query ? array('4_4', '1_2,1_2', '1_3,1_3,1_3') : array('4_4', '1_2,1_2');
$meta_query[] = array('key' => '_et_pb_row_layout', 'value' => $columns_val, 'compare' => 'IN');
}
$post_type = !empty($_POST['et_post_type']) ? sanitize_text_field($_POST['et_post_type']) : 'post';
$post_type = apply_filters('et_pb_show_all_layouts_built_for_post_type', $post_type, $layout_type);
$meta_query[] = array('key' => '_et_pb_built_for_post_type', 'value' => $post_type, 'compare' => 'IN');
$query = new WP_Query(array('tax_query' => array('relation' => 'AND', array('taxonomy' => 'layout_type', 'field' => 'slug', 'terms' => $layout_type), array('taxonomy' => 'scope', 'field' => 'slug', 'terms' => array('global'), 'operator' => $global_operator), $additional_condition), 'post_type' => ET_BUILDER_LAYOUT_POST_TYPE, 'posts_per_page' => '-1', 'meta_query' => $meta_query));
wp_reset_postdata();
if (!empty($query->posts)) {
foreach ($query->posts as $single_post) {
if ('module' === $layout_type) {
$module_type = get_post_meta($single_post->ID, '_et_pb_module_type', true);
} else {
$module_type = '';
}
// add only modules allowed for current user
if ('' === $module_type || et_pb_is_allowed($module_type)) {
$categories = wp_get_post_terms($single_post->ID, 'layout_category');
$categories_processed = array();
if (!empty($categories)) {
foreach ($categories as $category_data) {
$categories_processed[] = esc_html($category_data->slug);
}
}
$templates_data[] = array('ID' => $single_post->ID, 'title' => esc_html($single_post->post_title), 'shortcode' => $single_post->post_content, 'is_global' => $is_global, 'layout_type' => $layout_type, 'module_type' => $module_type, 'categories' => $categories_processed);
}
}
}
if (empty($templates_data)) {
$templates_data = array('error' => esc_html__('You have not saved any items to your Divi Library yet. Once an item has been saved to your library, it will appear here for easy use.', 'et_builder'));
}
$json_templates = json_encode($templates_data);
die($json_templates);
}
示例12: et_fb_add_admin_bar_link
/**
* Add "Use Visual Builder" link to WP-Admin bar
*
* @return void
*/
function et_fb_add_admin_bar_link()
{
if (!is_singular(et_builder_get_builder_post_types()) || !et_pb_is_allowed('use_visual_builder')) {
return;
}
global $wp_admin_bar, $wp_the_query;
$page_url = get_permalink(get_the_ID());
// Don't add the link, if Frontend Builder has been loaded already
if (et_fb_is_enabled()) {
$wp_admin_bar->add_menu(array('id' => 'et-disable-visual-builder', 'title' => esc_html__('Exit Visual Builder', 'et_builder'), 'href' => esc_url($page_url)));
return;
}
$current_object = $wp_the_query->get_queried_object();
if (!current_user_can('edit_post', $current_object->ID)) {
return;
}
$use_visual_builder_url = et_pb_is_pagebuilder_used(get_the_ID()) ? add_query_arg('et_fb', '1', et_fb_prepare_ssl_link($page_url)) : add_query_arg(array('et_fb_activation_nonce' => wp_create_nonce('et_fb_activation_nonce_' . get_the_ID())), $page_url);
$wp_admin_bar->add_menu(array('id' => 'et-use-visual-builder', 'title' => esc_html__('Enable Visual Builder', 'et_builder'), 'href' => esc_url($use_visual_builder_url)));
}
示例13: extra_add_customizer_admin_menu
function extra_add_customizer_admin_menu()
{
if (!current_user_can('customize')) {
return;
}
global $wp_admin_bar;
$wp_admin_bar->remove_menu('customize');
$current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$current_url = urlencode(esc_url($current_url));
$customize_url = add_query_arg(array('url' => $current_url), wp_customize_url());
// add Theme Customizer admin menu only if it's enabled for current user
if (et_pb_is_allowed('theme_customizer')) {
$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'customize-extra-theme', 'title' => __('Theme Customizer', 'extra'), 'href' => add_query_arg(array('et_customizer_option_set' => 'theme'), $customize_url), 'meta' => array('class' => 'hide-if-no-customize')));
}
// add Module Customizer admin menu only if it's enabled for current user
if (et_pb_is_allowed('module_customizer')) {
$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'customize-extra-module', 'title' => __('Module Customizer', 'extra'), 'href' => add_query_arg(array('et_customizer_option_set' => 'module'), $customize_url), 'meta' => array('class' => 'hide-if-no-customize')));
}
}