Exemplo n.º 1
0
/**
 * List of shortcodes that triggers error if being used in admin
 *
 * @return array shortcode tag
 */
function et_pb_admin_excluded_shortcodes()
{
    $shortcodes = array();
    // Triggers issue if Sensei and YOAST SEO are activated
    if (et_is_yoast_seo_plugin_active() && function_exists('Sensei')) {
        $shortcodes[] = 'usercourses';
    }
    return apply_filters('et_pb_admin_excluded_shortcodes', $shortcodes);
}
Exemplo n.º 2
0
 function et_pb_add_builder_page_js_css()
 {
     global $typenow, $post;
     if (et_is_yoast_seo_plugin_active()) {
         // save the original content of $post variable
         $post_original = $post;
         // get the content for yoast
         $post_content_processed = do_shortcode($post->post_content);
         // set the $post to the original content to make sure it wasn't changed by do_shortcode()
         $post = $post_original;
     }
     // we need some post data when editing saved templates.
     if ('et_pb_layout' === $typenow) {
         $template_scope = wp_get_object_terms(get_the_ID(), 'scope');
         $is_global_template = !empty($template_scope[0]) ? $template_scope[0]->slug : 'regular';
         $post_id = get_the_ID();
         // Check whether it's a Global item's page and display wp error if Global items disabled for current user
         if (!et_pb_is_allowed('edit_global_library') && 'global' === $is_global_template) {
             wp_die(__("you don't have sufficient permissions to access this page", 'et_builder'));
         }
         $built_for_post_type = get_post_meta(get_the_ID(), '_et_pb_built_for_post_type', true);
         $post_type = apply_filters('et_pb_built_for_post_type', $built_for_post_type, get_the_ID());
     } else {
         $is_global_template = '';
         $post_id = '';
         $post_type = $typenow;
     }
     // we need this data to create the filter when adding saved modules
     $layout_categories = get_terms('layout_category');
     $layout_cat_data = array();
     $layout_cat_data_json = '';
     if (is_array($layout_categories) && !empty($layout_categories)) {
         foreach ($layout_categories as $category) {
             $layout_cat_data[] = array('slug' => $category->slug, 'name' => $category->name);
         }
     }
     if (!empty($layout_cat_data)) {
         $layout_cat_data_json = json_encode($layout_cat_data);
     }
     // Set fixed protocol for preview URL to prevent cross origin issue
     $preview_scheme = is_ssl() ? 'https' : 'http';
     $page_permalink = get_permalink($post->ID);
     if ('https' === $preview_scheme && !strpos($page_permalink, 'https://')) {
         $page_permalink = str_replace('http://', 'https://', $page_permalink);
     }
     wp_enqueue_script('jquery-ui-core');
     wp_enqueue_script('underscore');
     wp_enqueue_script('backbone');
     wp_enqueue_script('google-maps-api', esc_url(add_query_arg(array('v' => 3, 'sensor' => 'false'), is_ssl() ? 'https://maps-api-ssl.google.com/maps/api/js' : 'http://maps.google.com/maps/api/js')), array(), '3', true);
     wp_enqueue_script('wp-color-picker');
     wp_enqueue_style('wp-color-picker');
     wp_enqueue_script('wp-color-picker-alpha', ET_BUILDER_URI . '/scripts/ext/wp-color-picker-alpha.min.js', array('jquery', 'wp-color-picker'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('et_pb_admin_date_js', ET_BUILDER_URI . '/scripts/ext/jquery-ui-1.10.4.custom.min.js', array('jquery'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('et_pb_admin_date_addon_js', ET_BUILDER_URI . '/scripts/ext/jquery-ui-timepicker-addon.js', array('et_pb_admin_date_js'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('validation', ET_BUILDER_URI . '/scripts/ext/jquery.validate.js', array('jquery'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('minicolors', ET_BUILDER_URI . '/scripts/ext/jquery.minicolors.js', array('jquery'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('et_pb_admin_js', ET_BUILDER_URI . '/scripts/builder.js', array('jquery', 'jquery-ui-core', 'underscore', 'backbone'), ET_BUILDER_VERSION, true);
     wp_localize_script('et_pb_admin_js', 'et_pb_options', apply_filters('et_pb_options_builder', array('debug' => true, 'ajaxurl' => admin_url('admin-ajax.php'), 'home_url' => home_url(), 'preview_url' => add_query_arg('et_pb_preview', 'true', $page_permalink), 'et_load_nonce' => wp_create_nonce('et_load_nonce'), 'images_uri' => ET_BUILDER_URI . '/images', 'post_type' => $post_type, 'et_builder_module_parent_shortcodes' => ET_Builder_Element::get_parent_shortcodes($post_type), 'et_builder_module_child_shortcodes' => ET_Builder_Element::get_child_shortcodes($post_type), 'et_builder_module_raw_content_shortcodes' => ET_Builder_Element::get_raw_content_shortcodes($post_type), 'et_builder_modules' => ET_Builder_Element::get_modules_js_array($post_type), 'default_initial_column_type' => apply_filters('et_builder_default_initial_column_type', '4_4'), 'default_initial_text_module' => apply_filters('et_builder_default_initial_text_module', 'et_pb_text'), 'section_only_row_dragged_away' => __('The section should have at least one row.', 'et_builder'), 'fullwidth_module_dragged_away' => __('Fullwidth module can\'t be used outside of the Fullwidth Section.', 'et_builder'), 'stop_dropping_3_col_row' => __('3 column row can\'t be used in this column.', 'et_builder'), 'preview_image' => __('Preview', 'et_builder'), 'empty_admin_label' => __('Module', 'et_builder'), 'video_module_image_error' => __('Still images cannot be generated from this video service and/or this video format', 'et_builder'), 'geocode_error' => __('Geocode was not successful for the following reason', 'et_builder'), 'geocode_error_2' => __('Geocoder failed due to', 'et_builder'), 'no_results' => __('No results found', 'et_builder'), 'all_tab_options_hidden' => __('No available options for this configuration.', 'et_builder'), 'update_global_module' => __('You\'re about to update global module. This change will be applied to all pages where you use this module. Press OK if you want to update this module', 'et_builder'), 'global_row_alert' => __('You cannot add global rows into global sections', 'et_builder'), 'global_module_alert' => __('You cannot add global modules into global sections or rows', 'et_builder'), 'all_cat_text' => __('All Categories', 'et_builder'), 'is_global_template' => $is_global_template, 'template_post_id' => $post_id, 'layout_categories' => $layout_cat_data_json, 'map_pin_address_error' => __('Map Pin Address cannot be empty', 'et_builder'), 'map_pin_address_invalid' => __('Invalid Pin and address data. Please try again.', 'et_builder'), 'locked_section_permission_alert' => __('You do not have permission to unlock this section.', 'et_builder'), 'locked_row_permission_alert' => __('You do not have permission to unlock this row.', 'et_builder'), 'locked_module_permission_alert' => __('You do not have permission to unlock this module.', 'et_builder'), 'locked_item_permission_alert' => __('You do not have permission to perform this task.', 'et_builder'), 'localstorage_unavailability_alert' => __('Unable to perform copy/paste process due to inavailability of localStorage feature in your browser. Please use latest modern browser (Chrome, Firefox, or Safari) to perform copy/paste process', 'et_builder'), 'verb' => array('did' => __('Did', 'et_builder'), 'added' => __('Added', 'et_builder'), 'edited' => __('Edited', 'et_builder'), 'removed' => __('Removed', 'et_builder'), 'moved' => __('Moved', 'et_builder'), 'expanded' => __('Expanded', 'et_builder'), 'collapsed' => __('Collapsed', 'et_builder'), 'locked' => __('Locked', 'et_builder'), 'unlocked' => __('Unlocked', 'et_builder'), 'cloned' => __('Cloned', 'et_builder'), 'cleared' => __('Cleared', 'et_builder'), 'enabled' => __('Enabled', 'et_builder'), 'disabled' => __('Disabled', 'et_builder'), 'copied' => __('Copied', 'et_builder'), 'renamed' => __('Renamed', 'et_builder'), 'loaded' => __('Loaded', 'et_builder')), 'noun' => array('section' => __('Section', 'et_builder'), 'saved_section' => __('Saved Section', 'et_builder'), 'fullwidth_section' => __('Fullwidth Section', 'et_builder'), 'specialty_section' => __('Specialty Section', 'et_builder'), 'column' => __('Column', 'et_builder'), 'row' => __('Row', 'et_builder'), 'saved_row' => __('Saved Row', 'et_builder'), 'module' => __('Module', 'et_builder'), 'saved_module' => __('Saved Module', 'et_builder'), 'page' => __('Page', 'et_builder'), 'layout' => __('Layout', 'et_builder')), 'invalid_color' => __('Invalid Color', 'et_builder'), 'et_pb_preview_nonce' => wp_create_nonce('et_pb_preview_nonce'), 'is_divi_library' => 'et_pb_layout' === $typenow ? 1 : 0, 'layout_type' => 'et_pb_layout' === $typenow ? et_pb_get_layout_type(get_the_ID()) : 0, 'is_plugin_used' => et_is_builder_plugin_active(), 'yoast_content' => et_is_yoast_seo_plugin_active() ? $post_content_processed : '')));
     wp_enqueue_style('et_pb_admin_css', ET_BUILDER_URI . '/styles/style.css', array(), ET_BUILDER_VERSION);
     wp_enqueue_style('et_pb_admin_date_css', ET_BUILDER_URI . '/styles/jquery-ui-1.10.4.custom.css', array(), ET_BUILDER_VERSION);
 }