Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder
File: functions.php
foreach ( $images_array as $attachment ) {
[9000] Fix | Delete
$image_src = wp_get_attachment_url( $attachment, 'et-pb-post-main-image-fullwidth' );
[9001] Fix | Delete
$gallery_output .= sprintf(
[9002] Fix | Delete
'<div class="et_pb_slide" style="background: url(%1$s);"></div>',
[9003] Fix | Delete
esc_url( $image_src )
[9004] Fix | Delete
);
[9005] Fix | Delete
}
[9006] Fix | Delete
printf(
[9007] Fix | Delete
'<div class="et_pb_slider et_pb_slider_fullwidth_off et_pb_gallery_post_type">
[9008] Fix | Delete
<div class="et_pb_slides">
[9009] Fix | Delete
%1$s
[9010] Fix | Delete
</div>
[9011] Fix | Delete
</div>',
[9012] Fix | Delete
et_core_esc_previously( $gallery_output )
[9013] Fix | Delete
);
[9014] Fix | Delete
} else {
[9015] Fix | Delete
add_filter( 'et_gallery_layout_enable', 'et_gallery_layout_turn_on' );
[9016] Fix | Delete
printf(
[9017] Fix | Delete
do_shortcode( '%1$s' ),
[9018] Fix | Delete
et_core_intentionally_unescaped( get_post_gallery(), 'html' )
[9019] Fix | Delete
);
[9020] Fix | Delete
remove_filter( 'et_gallery_layout_enable', 'et_gallery_layout_turn_on' );
[9021] Fix | Delete
}
[9022] Fix | Delete
}
[9023] Fix | Delete
endif;
[9024] Fix | Delete
[9025] Fix | Delete
/**
[9026] Fix | Delete
* Used to always use divi gallery on et_pb_gallery_images
[9027] Fix | Delete
*/
[9028] Fix | Delete
function et_gallery_layout_turn_on() {
[9029] Fix | Delete
return true;
[9030] Fix | Delete
}
[9031] Fix | Delete
[9032] Fix | Delete
/**
[9033] Fix | Delete
* Remove Elegant Builder plugin filter, that activates visual mode on each page load in WP-Admin
[9034] Fix | Delete
*/
[9035] Fix | Delete
function et_pb_remove_lb_plugin_force_editor_mode() {
[9036] Fix | Delete
remove_filter( 'wp_default_editor', 'et_force_tmce_editor' );
[9037] Fix | Delete
}
[9038] Fix | Delete
add_action( 'admin_init', 'et_pb_remove_lb_plugin_force_editor_mode' );
[9039] Fix | Delete
[9040] Fix | Delete
/**
[9041] Fix | Delete
*
[9042] Fix | Delete
* Generates array of all Role options
[9043] Fix | Delete
*/
[9044] Fix | Delete
function et_pb_all_role_options() {
[9045] Fix | Delete
// get all the modules and build array of capabilities for them.
[9046] Fix | Delete
$all_modules_array = ET_Builder_Element::get_modules_array();
[9047] Fix | Delete
$custom_user_tabs = ET_Builder_Element::get_tabs();
[9048] Fix | Delete
$options_categories = ET_Builder_Element::get_options_categories();
[9049] Fix | Delete
$module_capabilies = array();
[9050] Fix | Delete
$tabs_array = array(
[9051] Fix | Delete
'general_settings' => array(
[9052] Fix | Delete
'name' => esc_html__( 'Content Settings', 'et_builder' ),
[9053] Fix | Delete
),
[9054] Fix | Delete
'advanced_settings' => array(
[9055] Fix | Delete
'name' => esc_html__( 'Design Settings', 'et_builder' ),
[9056] Fix | Delete
),
[9057] Fix | Delete
'custom_css_settings' => array(
[9058] Fix | Delete
'name' => esc_html__( 'Advanced Settings', 'et_builder' ),
[9059] Fix | Delete
),
[9060] Fix | Delete
);
[9061] Fix | Delete
[9062] Fix | Delete
// add all custom user tabs into list.
[9063] Fix | Delete
if ( ! empty( $custom_user_tabs ) ) {
[9064] Fix | Delete
foreach ( $custom_user_tabs as $module => $tabs_data ) {
[9065] Fix | Delete
if ( ! empty( $tabs_data ) ) {
[9066] Fix | Delete
foreach ( $tabs_data as $tab_slug => $tab_data ) {
[9067] Fix | Delete
$tabs_array[ $tab_slug ] = array(
[9068] Fix | Delete
'name' => $tab_data['name'],
[9069] Fix | Delete
);
[9070] Fix | Delete
}
[9071] Fix | Delete
}
[9072] Fix | Delete
}
[9073] Fix | Delete
}
[9074] Fix | Delete
[9075] Fix | Delete
foreach ( $all_modules_array as $module => $module_details ) {
[9076] Fix | Delete
if ( ! in_array( $module_details['label'], array( 'et_pb_section', 'et_pb_row', 'et_pb_row_inner', 'et_pb_column' ), true ) ) {
[9077] Fix | Delete
$module_capabilies[ $module_details['label'] ] = array(
[9078] Fix | Delete
'name' => sanitize_text_field( $module_details['title'] ),
[9079] Fix | Delete
);
[9080] Fix | Delete
}
[9081] Fix | Delete
}
[9082] Fix | Delete
[9083] Fix | Delete
// we need to display some options only when theme activated.
[9084] Fix | Delete
$theme_only_options = ! et_is_builder_plugin_active()
[9085] Fix | Delete
? array(
[9086] Fix | Delete
'theme_customizer' => array(
[9087] Fix | Delete
'name' => esc_html__( 'Theme Customizer', 'et_builder' ),
[9088] Fix | Delete
'applicability' => array( 'administrator' ),
[9089] Fix | Delete
),
[9090] Fix | Delete
'page_options' => array(
[9091] Fix | Delete
'name' => esc_html__( 'Page Options', 'et_builder' ),
[9092] Fix | Delete
),
[9093] Fix | Delete
)
[9094] Fix | Delete
: array();
[9095] Fix | Delete
[9096] Fix | Delete
$all_role_options = array(
[9097] Fix | Delete
'general_capabilities' => array(
[9098] Fix | Delete
'section_title' => '',
[9099] Fix | Delete
'options' => array(
[9100] Fix | Delete
'theme_options' => array(
[9101] Fix | Delete
'name' => et_is_builder_plugin_active() ? esc_html__( 'Plugin Options', 'et_builder' ) : esc_html__( 'Theme Options', 'et_builder' ),
[9102] Fix | Delete
'applicability' => array( 'administrator' ),
[9103] Fix | Delete
),
[9104] Fix | Delete
'divi_library' => array(
[9105] Fix | Delete
'name' => esc_html__( 'Divi Library', 'et_builder' ),
[9106] Fix | Delete
),
[9107] Fix | Delete
'theme_builder' => array(
[9108] Fix | Delete
'name' => esc_html__( 'Theme Builder', 'et_builder' ),
[9109] Fix | Delete
'applicability' => array( 'administrator', 'editor' ),
[9110] Fix | Delete
),
[9111] Fix | Delete
'ab_testing' => array(
[9112] Fix | Delete
'name' => esc_html__( 'Split Testing', 'et_builder' ),
[9113] Fix | Delete
),
[9114] Fix | Delete
),
[9115] Fix | Delete
),
[9116] Fix | Delete
'builder_capabilities' => array(
[9117] Fix | Delete
'section_title' => esc_html__( 'Builder Interface', 'et_builder' ),
[9118] Fix | Delete
'options' => array(
[9119] Fix | Delete
'add_module' => array(
[9120] Fix | Delete
'name' => esc_html__( 'Add/Delete Item', 'et_builder' ),
[9121] Fix | Delete
),
[9122] Fix | Delete
'edit_module' => array(
[9123] Fix | Delete
'name' => esc_html__( 'Edit Item', 'et_builder' ),
[9124] Fix | Delete
),
[9125] Fix | Delete
'move_module' => array(
[9126] Fix | Delete
'name' => esc_html__( 'Move Item', 'et_builder' ),
[9127] Fix | Delete
),
[9128] Fix | Delete
'disable_module' => array(
[9129] Fix | Delete
'name' => esc_html__( 'Disable Item', 'et_builder' ),
[9130] Fix | Delete
),
[9131] Fix | Delete
'lock_module' => array(
[9132] Fix | Delete
'name' => esc_html__( 'Lock Item', 'et_builder' ),
[9133] Fix | Delete
),
[9134] Fix | Delete
'divi_builder_control' => array(
[9135] Fix | Delete
'name' => esc_html__( 'Toggle Divi Builder', 'et_builder' ),
[9136] Fix | Delete
),
[9137] Fix | Delete
'load_layout' => array(
[9138] Fix | Delete
'name' => esc_html__( 'Load Layout', 'et_builder' ),
[9139] Fix | Delete
),
[9140] Fix | Delete
'use_visual_builder' => array(
[9141] Fix | Delete
'name' => esc_html__( 'Use Visual Builder', 'et_builder' ),
[9142] Fix | Delete
),
[9143] Fix | Delete
'custom_fonts_management' => array(
[9144] Fix | Delete
'name' => esc_html__( 'Upload/Remove Fonts', 'et_builder' ),
[9145] Fix | Delete
),
[9146] Fix | Delete
'read_dynamic_content_custom_fields' => array(
[9147] Fix | Delete
'name' => esc_html__( 'Dynamic Content Custom Fields', 'et_builder' ),
[9148] Fix | Delete
),
[9149] Fix | Delete
),
[9150] Fix | Delete
),
[9151] Fix | Delete
'library_capabilities' => array(
[9152] Fix | Delete
'section_title' => esc_html__( 'Library Settings', 'et_builder' ),
[9153] Fix | Delete
'options' => array(
[9154] Fix | Delete
'save_library' => array(
[9155] Fix | Delete
'name' => esc_html__( 'Save To Library', 'et_builder' ),
[9156] Fix | Delete
),
[9157] Fix | Delete
'add_library' => array(
[9158] Fix | Delete
'name' => esc_html__( 'Add From Library', 'et_builder' ),
[9159] Fix | Delete
),
[9160] Fix | Delete
'edit_global_library' => array(
[9161] Fix | Delete
'name' => esc_html__( 'Edit Global Items', 'et_builder' ),
[9162] Fix | Delete
),
[9163] Fix | Delete
),
[9164] Fix | Delete
),
[9165] Fix | Delete
'module_tabs' => array(
[9166] Fix | Delete
'section_title' => esc_html__( 'Settings Tabs', 'et_builder' ),
[9167] Fix | Delete
'options' => $tabs_array,
[9168] Fix | Delete
),
[9169] Fix | Delete
'general_module_capabilities' => array(
[9170] Fix | Delete
'section_title' => esc_html__( 'Settings Types', 'et_builder' ),
[9171] Fix | Delete
'options' => $options_categories,
[9172] Fix | Delete
),
[9173] Fix | Delete
'module_capabilies' => array(
[9174] Fix | Delete
'section_title' => esc_html__( 'Module Use', 'et_builder' ),
[9175] Fix | Delete
'options' => $module_capabilies,
[9176] Fix | Delete
),
[9177] Fix | Delete
);
[9178] Fix | Delete
[9179] Fix | Delete
$all_role_options = apply_filters( 'add_et_builder_role_options', $all_role_options );
[9180] Fix | Delete
[9181] Fix | Delete
$all_role_options['general_capabilities']['options'] = array_merge( $all_role_options['general_capabilities']['options'], $theme_only_options );
[9182] Fix | Delete
[9183] Fix | Delete
// Set portability capabilities.
[9184] Fix | Delete
$registered_portabilities = et_core_cache_get_group( 'et_core_portability' );
[9185] Fix | Delete
[9186] Fix | Delete
if ( ! empty( $registered_portabilities ) ) {
[9187] Fix | Delete
$all_role_options['general_capabilities']['options']['portability'] = array(
[9188] Fix | Delete
'name' => esc_html__( 'Portability', 'et_builder' ),
[9189] Fix | Delete
);
[9190] Fix | Delete
$all_role_options['portability'] = array(
[9191] Fix | Delete
'section_title' => esc_html__( 'Portability', 'et_builder' ),
[9192] Fix | Delete
'options' => array(),
[9193] Fix | Delete
);
[9194] Fix | Delete
[9195] Fix | Delete
// Dynamically create an option foreach portability.
[9196] Fix | Delete
foreach ( $registered_portabilities as $portability_context => $portability_instance ) {
[9197] Fix | Delete
$all_role_options['portability']['options'][ "{$portability_context}_portability" ] = array(
[9198] Fix | Delete
'name' => esc_html( $portability_instance->name ),
[9199] Fix | Delete
);
[9200] Fix | Delete
}
[9201] Fix | Delete
}
[9202] Fix | Delete
[9203] Fix | Delete
return $all_role_options;
[9204] Fix | Delete
}
[9205] Fix | Delete
[9206] Fix | Delete
/**
[9207] Fix | Delete
*
[9208] Fix | Delete
* Prints the admin page for Role Editor
[9209] Fix | Delete
*/
[9210] Fix | Delete
function et_pb_display_role_editor() {
[9211] Fix | Delete
$all_role_options = et_pb_all_role_options();
[9212] Fix | Delete
$option_tabs = '';
[9213] Fix | Delete
$menu_tabs = '';
[9214] Fix | Delete
$builder_roles_array = et_pb_get_all_roles_list();
[9215] Fix | Delete
[9216] Fix | Delete
foreach ( $builder_roles_array as $role => $role_title ) {
[9217] Fix | Delete
$option_tabs .= et_pb_generate_roles_tab( $all_role_options, $role );
[9218] Fix | Delete
[9219] Fix | Delete
$menu_tabs .= sprintf(
[9220] Fix | Delete
'<a href="#" class="et-pb-layout-buttons%4$s" data-open_tab="et_pb_role-%3$s_options" title="%1$s">
[9221] Fix | Delete
<span>%2$s</span>
[9222] Fix | Delete
</a>',
[9223] Fix | Delete
esc_attr( $role_title ),
[9224] Fix | Delete
esc_html( $role_title ),
[9225] Fix | Delete
esc_attr( $role ),
[9226] Fix | Delete
'administrator' === $role ? ' et_pb_roles_active_menu' : ''
[9227] Fix | Delete
);
[9228] Fix | Delete
}
[9229] Fix | Delete
[9230] Fix | Delete
printf(
[9231] Fix | Delete
'<div class="et_pb_roles_main_container">
[9232] Fix | Delete
<a href="#" id="et_pb_save_roles" class="button button-primary button-large">%3$s</a>
[9233] Fix | Delete
<h3 class="et_pb_roles_title"><span>%2$s</span></h3>
[9234] Fix | Delete
<div id="et_pb_main_container" class="post-type-page">
[9235] Fix | Delete
<div id="et_pb_layout_controls">
[9236] Fix | Delete
%1$s
[9237] Fix | Delete
<a href="#" class="et-pb-layout-buttons et-pb-layout-buttons-reset" title="Reset all settings">
[9238] Fix | Delete
<span class="icon"></span><span class="label">Reset</span>
[9239] Fix | Delete
</a>
[9240] Fix | Delete
%4$s
[9241] Fix | Delete
</div>
[9242] Fix | Delete
</div>
[9243] Fix | Delete
<div class="et_pb_roles_container_all">
[9244] Fix | Delete
%5$s
[9245] Fix | Delete
</div>
[9246] Fix | Delete
</div>',
[9247] Fix | Delete
et_core_esc_previously( $menu_tabs ),
[9248] Fix | Delete
esc_html__( 'Divi Role Editor', 'et_builder' ),
[9249] Fix | Delete
esc_html__( 'Save Divi Roles', 'et_builder' ),
[9250] Fix | Delete
et_core_esc_previously( et_builder_portability_link( 'et_pb_roles', array( 'class' => 'et-pb-layout-buttons et-pb-portability-button' ) ) ),
[9251] Fix | Delete
et_core_esc_previously( $option_tabs )
[9252] Fix | Delete
);
[9253] Fix | Delete
}
[9254] Fix | Delete
[9255] Fix | Delete
/**
[9256] Fix | Delete
* Generates the options tab for specified role.
[9257] Fix | Delete
*
[9258] Fix | Delete
* @param array $all_role_options array of all Role options.
[9259] Fix | Delete
* @param string $role role.
[9260] Fix | Delete
*
[9261] Fix | Delete
* @return string
[9262] Fix | Delete
*/
[9263] Fix | Delete
function et_pb_generate_roles_tab( $all_role_options, $role ) {
[9264] Fix | Delete
$form_sections = '';
[9265] Fix | Delete
[9266] Fix | Delete
// generate all sections of the form for current role.
[9267] Fix | Delete
if ( ! empty( $all_role_options ) ) {
[9268] Fix | Delete
foreach ( $all_role_options as $capability_id => $capability_options ) {
[9269] Fix | Delete
$form_sections .= sprintf(
[9270] Fix | Delete
'<div class="et_pb_roles_section_container">
[9271] Fix | Delete
%1$s
[9272] Fix | Delete
<div class="et_pb_roles_options_internal">
[9273] Fix | Delete
%2$s
[9274] Fix | Delete
</div>
[9275] Fix | Delete
</div>',
[9276] Fix | Delete
! empty( $capability_options['section_title'] )
[9277] Fix | Delete
? sprintf( '<h4 class="et_pb_roles_divider">%1$s <span class="et_pb_toggle_all"></span></h4>', esc_html( $capability_options['section_title'] ) )
[9278] Fix | Delete
: '',
[9279] Fix | Delete
et_pb_generate_capabilities_output( $capability_options['options'], $role )
[9280] Fix | Delete
);
[9281] Fix | Delete
}
[9282] Fix | Delete
}
[9283] Fix | Delete
[9284] Fix | Delete
$output = sprintf(
[9285] Fix | Delete
'<div class="et_pb_roles_options_container et_pb_role-%2$s_options%3$s">
[9286] Fix | Delete
<p class="et_pb_roles_notice">%1$s</p>
[9287] Fix | Delete
<form id="et_pb_%2$s_role" data-role_id="%2$s">
[9288] Fix | Delete
%4$s
[9289] Fix | Delete
</form>
[9290] Fix | Delete
</div>',
[9291] Fix | Delete
esc_html__( 'Using the Divi Role Editor, you can limit the types of actions that can be taken by WordPress users of different roles. This is a great way to limit the functionality available to your customers or guest authors to ensure that they only have the necessary options available to them.', 'et_builder' ),
[9292] Fix | Delete
esc_attr( $role ),
[9293] Fix | Delete
'administrator' === $role ? ' active-container' : '',
[9294] Fix | Delete
$form_sections // #4
[9295] Fix | Delete
);
[9296] Fix | Delete
[9297] Fix | Delete
return $output;
[9298] Fix | Delete
}
[9299] Fix | Delete
[9300] Fix | Delete
/**
[9301] Fix | Delete
* Generates the enable/disable buttons list based on provided capabilities array and role.
[9302] Fix | Delete
*
[9303] Fix | Delete
* @param array $cap_array capabilities.
[9304] Fix | Delete
* @param string $role user role.
[9305] Fix | Delete
*
[9306] Fix | Delete
* @return string
[9307] Fix | Delete
*/
[9308] Fix | Delete
function et_pb_generate_capabilities_output( $cap_array, $role ) {
[9309] Fix | Delete
$output = '';
[9310] Fix | Delete
[9311] Fix | Delete
if ( ! empty( $cap_array ) ) {
[9312] Fix | Delete
foreach ( $cap_array as $capability => $capability_details ) {
[9313] Fix | Delete
if ( empty( $capability_details['applicability'] ) || ( ! empty( $capability_details['applicability'] ) && in_array( $role, $capability_details['applicability'], true ) ) ) {
[9314] Fix | Delete
$output .= sprintf(
[9315] Fix | Delete
'<div class="et_pb_capability_option">
[9316] Fix | Delete
<span class="et_pb_capability_title">%4$s</span>
[9317] Fix | Delete
<div class="et_pb_yes_no_button_wrapper">
[9318] Fix | Delete
<div class="et_pb_yes_no_button et_pb_on_state">
[9319] Fix | Delete
<span class="et_pb_value_text et_pb_on_value">%1$s</span>
[9320] Fix | Delete
<span class="et_pb_button_slider"></span>
[9321] Fix | Delete
<span class="et_pb_value_text et_pb_off_value">%2$s</span>
[9322] Fix | Delete
</div>
[9323] Fix | Delete
<select name="%3$s" id="%3$s" class="et-pb-main-setting regular-text">
[9324] Fix | Delete
<option value="on" %5$s>Yes</option>
[9325] Fix | Delete
<option value="off" %6$s>No</option>
[9326] Fix | Delete
</select>
[9327] Fix | Delete
</div>
[9328] Fix | Delete
</div>',
[9329] Fix | Delete
esc_html__( 'Enabled', 'et_builder' ),
[9330] Fix | Delete
esc_html__( 'Disabled', 'et_builder' ),
[9331] Fix | Delete
esc_attr( $capability ),
[9332] Fix | Delete
esc_html( $capability_details['name'] ),
[9333] Fix | Delete
selected( true, et_pb_is_allowed( $capability, $role ), false ),
[9334] Fix | Delete
selected( false, et_pb_is_allowed( $capability, $role ), false )
[9335] Fix | Delete
);
[9336] Fix | Delete
}
[9337] Fix | Delete
}
[9338] Fix | Delete
}
[9339] Fix | Delete
[9340] Fix | Delete
return $output;
[9341] Fix | Delete
}
[9342] Fix | Delete
[9343] Fix | Delete
/**
[9344] Fix | Delete
* Loads scripts and styles for Role Editor Admin page
[9345] Fix | Delete
*
[9346] Fix | Delete
* @param string $hook hook name.
[9347] Fix | Delete
*/
[9348] Fix | Delete
function et_pb_load_roles_admin( $hook ) {
[9349] Fix | Delete
// load scripts only on role editor page.
[9350] Fix | Delete
[9351] Fix | Delete
if ( apply_filters( 'et_pb_load_roles_admin_hook', 'divi_page_et_divi_role_editor' ) !== $hook ) {
[9352] Fix | Delete
return;
[9353] Fix | Delete
}
[9354] Fix | Delete
[9355] Fix | Delete
et_core_load_main_fonts();
[9356] Fix | Delete
wp_enqueue_style( 'builder-roles-editor-styles', ET_BUILDER_URI . '/styles/roles_style.css', array( 'et-core-admin' ), ET_BUILDER_VERSION );
[9357] Fix | Delete
wp_enqueue_script( 'builder-roles-editor-scripts', ET_BUILDER_URI . '/scripts/roles_admin.js', array( 'jquery' ), ET_BUILDER_VERSION, true );
[9358] Fix | Delete
$pb_roles_options = array(
[9359] Fix | Delete
'ajaxurl' => admin_url( 'admin-ajax.php' ),
[9360] Fix | Delete
'et_roles_nonce' => wp_create_nonce( 'et_roles_nonce' ),
[9361] Fix | Delete
'modal_title' => esc_html__( 'Reset Roles', 'et_builder' ),
[9362] Fix | Delete
'modal_message' => esc_html__( 'All of your current role settings will be set to defaults. Do you wish to proceed?', 'et_builder' ),
[9363] Fix | Delete
'modal_yes' => et_builder_i18n( 'Yes' ),
[9364] Fix | Delete
'modal_no' => et_builder_i18n( 'No' ),
[9365] Fix | Delete
);
[9366] Fix | Delete
wp_localize_script( 'builder-roles-editor-scripts', 'et_pb_roles_options', $pb_roles_options );
[9367] Fix | Delete
}
[9368] Fix | Delete
add_action( 'admin_enqueue_scripts', 'et_pb_load_roles_admin' );
[9369] Fix | Delete
[9370] Fix | Delete
/**
[9371] Fix | Delete
* Generates the array of allowed modules in jQuery Array format.
[9372] Fix | Delete
*
[9373] Fix | Delete
* @param string $role the user role.
[9374] Fix | Delete
*
[9375] Fix | Delete
* @return string
[9376] Fix | Delete
*/
[9377] Fix | Delete
function et_pb_allowed_modules_list( $role = '' ) {
[9378] Fix | Delete
global $typenow;
[9379] Fix | Delete
// always return empty array if user doesn't have the edit_posts capability.
[9380] Fix | Delete
if ( ! current_user_can( 'edit_posts' ) ) {
[9381] Fix | Delete
return '[]';
[9382] Fix | Delete
}
[9383] Fix | Delete
[9384] Fix | Delete
$saved_capabilities = et_pb_get_role_settings();
[9385] Fix | Delete
$role = '' === $role ? et_pb_get_current_user_role() : $role;
[9386] Fix | Delete
[9387] Fix | Delete
$all_modules_array = ET_Builder_Element::get_modules_array( $typenow );
[9388] Fix | Delete
[9389] Fix | Delete
$saved_modules_capabilities = isset( $saved_capabilities[ $role ] ) ? $saved_capabilities[ $role ] : array();
[9390] Fix | Delete
[9391] Fix | Delete
$alowed_modules = '[';
[9392] Fix | Delete
foreach ( $all_modules_array as $module => $module_details ) {
[9393] Fix | Delete
if ( ! in_array( $module_details['label'], array( 'et_pb_section', 'et_pb_row', 'et_pb_row_inner', 'et_pb_column' ), true ) ) {
[9394] Fix | Delete
// Add module into the list if it's not saved or if it's saved not with "off" state.
[9395] Fix | Delete
if ( ! isset( $saved_modules_capabilities[ $module_details['label'] ] ) || ( isset( $saved_modules_capabilities[ $module_details['label'] ] ) && 'off' !== $saved_modules_capabilities[ $module_details['label'] ] ) ) {
[9396] Fix | Delete
$alowed_modules .= "'" . esc_attr( $module_details['label'] ) . "',";
[9397] Fix | Delete
}
[9398] Fix | Delete
}
[9399] Fix | Delete
}
[9400] Fix | Delete
[9401] Fix | Delete
$alowed_modules .= ']';
[9402] Fix | Delete
[9403] Fix | Delete
return $alowed_modules;
[9404] Fix | Delete
}
[9405] Fix | Delete
[9406] Fix | Delete
if ( ! function_exists( 'et_divi_get_post_text_color' ) ) {
[9407] Fix | Delete
/**
[9408] Fix | Delete
* Return text color css class.
[9409] Fix | Delete
*
[9410] Fix | Delete
* @return mixed|string
[9411] Fix | Delete
*/
[9412] Fix | Delete
function et_divi_get_post_text_color() {
[9413] Fix | Delete
$text_color_class = '';
[9414] Fix | Delete
[9415] Fix | Delete
$post_format = et_pb_post_format();
[9416] Fix | Delete
[9417] Fix | Delete
if ( in_array( $post_format, array( 'audio', 'link', 'quote' ), true ) ) {
[9418] Fix | Delete
$text_color = get_post_meta( get_the_ID(), '_et_post_bg_layout', true );
[9419] Fix | Delete
$text_color_class = $text_color ? $text_color : 'light';
[9420] Fix | Delete
$text_color_class = ' et_pb_text_color_' . $text_color_class;
[9421] Fix | Delete
}
[9422] Fix | Delete
[9423] Fix | Delete
return $text_color_class;
[9424] Fix | Delete
}
[9425] Fix | Delete
}
[9426] Fix | Delete
[9427] Fix | Delete
if ( ! function_exists( 'et_divi_get_post_bg_inline_style' ) ) {
[9428] Fix | Delete
/**
[9429] Fix | Delete
* Return css style attribute that ho;d background color inline style.
[9430] Fix | Delete
*
[9431] Fix | Delete
* @return string
[9432] Fix | Delete
*/
[9433] Fix | Delete
function et_divi_get_post_bg_inline_style() {
[9434] Fix | Delete
$inline_style = '';
[9435] Fix | Delete
[9436] Fix | Delete
$post_id = get_the_ID();
[9437] Fix | Delete
[9438] Fix | Delete
$post_use_bg_color = get_post_meta( $post_id, '_et_post_use_bg_color', true ) ? true : false;
[9439] Fix | Delete
[9440] Fix | Delete
$bg_color = get_post_meta( $post_id, '_et_post_bg_color', true );
[9441] Fix | Delete
$post_bg_color = $bg_color && '' !== $bg_color ? $bg_color : '#ffffff';
[9442] Fix | Delete
[9443] Fix | Delete
if ( $post_use_bg_color ) {
[9444] Fix | Delete
$inline_style = sprintf( ' style="background-color: %1$s;"', esc_html( $post_bg_color ) );
[9445] Fix | Delete
}
[9446] Fix | Delete
[9447] Fix | Delete
return $inline_style;
[9448] Fix | Delete
}
[9449] Fix | Delete
}
[9450] Fix | Delete
[9451] Fix | Delete
/**
[9452] Fix | Delete
* Remove the blockquote from post content.
[9453] Fix | Delete
*
[9454] Fix | Delete
* @param string $content post content.
[9455] Fix | Delete
*
[9456] Fix | Delete
* @return string|string[]|null
[9457] Fix | Delete
*/
[9458] Fix | Delete
function et_remove_blockquote_from_content( $content ) {
[9459] Fix | Delete
if ( 'quote' !== et_pb_post_format() ) {
[9460] Fix | Delete
return $content;
[9461] Fix | Delete
}
[9462] Fix | Delete
[9463] Fix | Delete
if ( et_theme_builder_overrides_layout( ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE ) ) {
[9464] Fix | Delete
// Do not remove quotes when TB has taken over.
[9465] Fix | Delete
return $content;
[9466] Fix | Delete
}
[9467] Fix | Delete
[9468] Fix | Delete
$content = preg_replace( '/<blockquote(.+?)<\/blockquote>/is', '', $content, 1 );
[9469] Fix | Delete
[9470] Fix | Delete
return $content;
[9471] Fix | Delete
}
[9472] Fix | Delete
add_filter( 'the_content', 'et_remove_blockquote_from_content' );
[9473] Fix | Delete
[9474] Fix | Delete
/**
[9475] Fix | Delete
* Register rewrite rule and tag for preview page
[9476] Fix | Delete
*
[9477] Fix | Delete
* @return void
[9478] Fix | Delete
*/
[9479] Fix | Delete
function et_pb_register_preview_endpoint() {
[9480] Fix | Delete
add_rewrite_tag( '%et_pb_preview%', 'true' );
[9481] Fix | Delete
}
[9482] Fix | Delete
add_action( 'init', 'et_pb_register_preview_endpoint', 11 );
[9483] Fix | Delete
[9484] Fix | Delete
/**
[9485] Fix | Delete
* Flush rewrite rules to fix the issue "preg_match" issue with 2.5
[9486] Fix | Delete
*
[9487] Fix | Delete
* @return void
[9488] Fix | Delete
*/
[9489] Fix | Delete
function et_pb_maybe_flush_rewrite_rules() {
[9490] Fix | Delete
et_builder_maybe_flush_rewrite_rules( '2_5_flush_rewrite_rules' );
[9491] Fix | Delete
}
[9492] Fix | Delete
add_action( 'init', 'et_pb_maybe_flush_rewrite_rules', 9 );
[9493] Fix | Delete
[9494] Fix | Delete
/**
[9495] Fix | Delete
* Register template for preview page.
[9496] Fix | Delete
*
[9497] Fix | Delete
* @param string $template The path of the template to include.
[9498] Fix | Delete
*
[9499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function