: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
<div class="et_pb_roles_container_all">
et_core_esc_previously( $menu_tabs ),
esc_html__( 'Divi Role Editor', 'et_builder' ),
esc_html__( 'Save Divi Roles', 'et_builder' ),
et_core_esc_previously( et_builder_portability_link( 'et_pb_roles', array( 'class' => 'et-pb-layout-buttons et-pb-portability-button' ) ) ),
et_core_esc_previously( $option_tabs )
* Generates the options tab for specified role.
function et_pb_generate_roles_tab( $all_role_options, $role ) {
// generate all sections of the form for current role.
if ( ! empty( $all_role_options ) ) {
foreach( $all_role_options as $capability_id => $capability_options ) {
$form_sections .= sprintf(
'<div class="et_pb_roles_section_container">
<div class="et_pb_roles_options_internal">
! empty( $capability_options['section_title'] )
? sprintf( '<h4 class="et_pb_roles_divider">%1$s <span class="et_pb_toggle_all"></span></h4>', esc_html( $capability_options['section_title'] ) )
et_pb_generate_capabilities_output( $capability_options['options'], $role )
'<div class="et_pb_roles_options_container et_pb_role-%2$s_options%3$s">
<p class="et_pb_roles_notice">%1$s</p>
<form id="et_pb_%2$s_role" data-role_id="%2$s">
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' ),
'administrator' === $role ? ' active-container' : '',
* Generates the enable/disable buttons list based on provided capabilities array and role
function et_pb_generate_capabilities_output( $cap_array, $role ) {
if ( ! empty( $cap_array ) ) {
foreach ( $cap_array as $capability => $capability_details ) {
if ( empty( $capability_details['applicability'] ) || ( ! empty( $capability_details['applicability'] ) && in_array( $role, $capability_details['applicability'] ) ) ) {
'<div class="et_pb_capability_option">
<span class="et_pb_capability_title">%4$s</span>
<div class="et_pb_yes_no_button_wrapper">
<div class="et_pb_yes_no_button et_pb_on_state">
<span class="et_pb_value_text et_pb_on_value">%1$s</span>
<span class="et_pb_button_slider"></span>
<span class="et_pb_value_text et_pb_off_value">%2$s</span>
<select name="%3$s" id="%3$s" class="et-pb-main-setting regular-text">
<option value="on" %5$s>Yes</option>
<option value="off" %6$s>No</option>
esc_html__( 'Enabled', 'et_builder' ),
esc_html__( 'Disabled', 'et_builder' ),
esc_html( $capability_details['name'] ),
selected( true, et_pb_is_allowed( $capability, $role ), false ),
selected( false, et_pb_is_allowed( $capability, $role ), false )
* Loads scripts and styles for Role Editor Admin page
function et_pb_load_roles_admin( $hook ) {
// load scripts only on role editor page
if ( apply_filters( 'et_pb_load_roles_admin_hook', 'divi_page_et_divi_role_editor' ) !== $hook ) {
et_core_load_main_fonts();
wp_enqueue_style( 'builder-roles-editor-styles', ET_BUILDER_URI . '/styles/roles_style.css', array( 'et-core-admin' ), ET_BUILDER_VERSION );
wp_enqueue_script( 'builder-roles-editor-scripts', ET_BUILDER_URI . '/scripts/roles_admin.js', array( 'jquery' ), ET_BUILDER_VERSION, true );
wp_localize_script( 'builder-roles-editor-scripts', 'et_pb_roles_options', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'et_roles_nonce' => wp_create_nonce( 'et_roles_nonce' ),
'modal_title' => esc_html__( 'Reset Roles', 'et_builder' ),
'modal_message' => esc_html__( 'All of your current role settings will be set to defaults. Do you wish to proceed?', 'et_builder' ),
'modal_yes' => et_builder_i18n( 'Yes' ),
'modal_no' => et_builder_i18n( 'No' ),
add_action( 'admin_enqueue_scripts', 'et_pb_load_roles_admin' );
* Generates the array of allowed modules in jQuery Array format
function et_pb_allowed_modules_list( $role = '' ) {
// always return empty array if user doesn't have the edit_posts capability
if ( ! current_user_can( 'edit_posts' ) ) {
$saved_capabilities = et_pb_get_role_settings();
$role = '' === $role ? et_pb_get_current_user_role() : $role;
$all_modules_array = ET_Builder_Element::get_modules_array( $typenow );
$saved_modules_capabilities = isset( $saved_capabilities[ $role ] ) ? $saved_capabilities[ $role ] : array();
foreach ( $all_modules_array as $module => $module_details ) {
if ( ! in_array( $module_details['label'], array( 'et_pb_section', 'et_pb_row', 'et_pb_row_inner', 'et_pb_column' ) ) ) {
// Add module into the list if it's not saved or if it's saved not with "off" state
if ( ! isset( $saved_modules_capabilities[ $module_details['label'] ] ) || ( isset( $saved_modules_capabilities[ $module_details['label'] ] ) && 'off' !== $saved_modules_capabilities[ $module_details['label'] ] ) ) {
$alowed_modules .= "'" . esc_attr( $module_details['label'] ) . "',";
if ( ! function_exists( 'et_divi_get_post_text_color' ) ) {
function et_divi_get_post_text_color() {
$post_format = et_pb_post_format();
if ( in_array( $post_format, array( 'audio', 'link', 'quote' ) ) ) {
$text_color_class = ( $text_color = get_post_meta( get_the_ID(), '_et_post_bg_layout', true ) ) ? $text_color : 'light';
$text_color_class = ' et_pb_text_color_' . $text_color_class;
return $text_color_class;
if ( ! function_exists( 'et_divi_get_post_bg_inline_style' ) ) {
function et_divi_get_post_bg_inline_style() {
$post_use_bg_color = get_post_meta( $post_id, '_et_post_use_bg_color', true )
$post_bg_color = ( $bg_color = get_post_meta( $post_id, '_et_post_bg_color', true ) ) && '' !== $bg_color
if ( $post_use_bg_color ) {
$inline_style = sprintf( ' style="background-color: %1$s;"', esc_html( $post_bg_color ) );
function et_remove_blockquote_from_content( $content ) {
if ( 'quote' !== et_pb_post_format() ) {
if ( et_theme_builder_overrides_layout( ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE ) ) {
// Do not remove quotes when TB has taken over.
$content = preg_replace( '/<blockquote(.+?)<\/blockquote>/is', '', $content, 1 );
add_filter( 'the_content', 'et_remove_blockquote_from_content' );
* Register rewrite rule and tag for preview page
function et_pb_register_preview_endpoint() {
add_rewrite_tag( '%et_pb_preview%', 'true' );
add_action( 'init', 'et_pb_register_preview_endpoint', 11 );
* Flush rewrite rules to fix the issue "preg_match" issue with 2.5
function et_pb_maybe_flush_rewrite_rules() {
et_builder_maybe_flush_rewrite_rules( '2_5_flush_rewrite_rules' );
add_action( 'init', 'et_pb_maybe_flush_rewrite_rules', 9 );
* Register template for preview page
* @return string path to template file
function et_pb_register_preview_page( $template ) {
if ( 'true' === $wp_query->get( 'et_pb_preview' ) && isset( $_GET['et_pb_preview_nonce'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
return ET_BUILDER_DIR . 'template-preview.php';
add_action( 'template_include', 'et_pb_register_preview_page' );
* do_shortcode() replaces square brackers with html entities,
* convert them back to make sure js code works ok
if ( ! function_exists( 'et_builder_replace_code_content_entities' ) ) :
function et_builder_replace_code_content_entities( $content ) {
$content = str_replace( '[', '[', $content );
$content = str_replace( ']', ']', $content );
$content = str_replace( '×', 'x', $content );
* we use placeholders to preserve the line-breaks,
* convert them back to \n
if ( ! function_exists( 'et_builder_convert_line_breaks' ) ) :
function et_builder_convert_line_breaks( $content, $line_breaks_format = "\n" ) {
// before we swap out the placeholders,
// remove all the <p> tags and \n that wpautop added!
$content = preg_replace( '/\n/smi', '', $content );
$content = preg_replace( '/<p>/smi', '', $content );
$content = preg_replace( '/<\/p>/smi', '', $content );
$content = str_replace( array( '<!– [et_pb_line_break_holder] –>', '<!-- [et_pb_line_break_holder] -->', '||et_pb_line_break_holder||' ), $line_breaks_format, $content );
$content = str_replace( '<!–- [et_pb_br_holder] -–>', '<br />', $content );
// convert the <pee tags back to <p
// see et_pb_prep_code_module_for_wpautop()
$content = str_replace( '<pee', '<p', $content );
$content = str_replace( '</pee>', '</p> ', $content );
// adjust the number of all layouts displayed on library page to exclude predefined layouts
function et_pb_fix_count_library_items( $counts ) {
// do nothing if get_current_screen function doesn't exists at this point to avoid php errors in some plugins.
if ( ! function_exists( 'get_current_screen' ) ) {
$current_screen = get_current_screen();
if ( isset( $current_screen->id ) && 'edit-et_pb_layout' === $current_screen->id && isset( $counts->publish ) ) {
// perform query to get all the not predefined layouts
$query = new WP_Query( array(
'key' => '_et_pb_predefined_layout',
'compare' => 'NOT EXISTS',
'post_type' => ET_BUILDER_LAYOUT_POST_TYPE,
'posts_per_page' => '-1',
// set the $counts->publish = amount of non predefined layouts
$counts->publish = isset( $query->post_count ) ? (int) $query->post_count : 0;
add_filter( 'wp_count_posts', 'et_pb_fix_count_library_items' );
function et_pb_generate_mobile_settings_tabs() {
$mobile_settings_tabs = '<%= window.et_builder.mobile_tabs_output() %>';
return $mobile_settings_tabs;
* Generates the css code for responsive options.
* Uses array of values for each device as input parameter and css_selector with property to
* @deprecated See ET_Builder_Module_Helper_ResponsiveOptions::instance()->generate_responsive_css().
* @since 3.23 Deprecated.
* @param array $values_array All device values.
* @param mixed $css_selector CSS selector.
* @param string $css_property CSS property.
* @param string $function_name Module slug.
* @param string $additional_css Additional CSS.
function et_pb_generate_responsive_css( $values_array, $css_selector, $css_property, $function_name, $additional_css = '' ) {
if ( ! empty( $values_array ) ) {
foreach( $values_array as $device => $current_value ) {
if ( '' === $current_value ) {
// value can be provided as a string or array in following format - array( 'property_1' => 'value_1', 'property_2' => 'property_2', ... , 'property_n' => 'value_n' )
if ( is_array( $current_value ) && ! empty( $current_value ) ) {
foreach( $current_value as $this_property => $this_value ) {
if ( '' === $this_value ) {
esc_html( et_builder_process_range_value( $this_value, $this_property ) ),
'' !== $additional_css ? $additional_css : ';'
esc_html( et_builder_process_range_value( $current_value, $css_property ) ),
'' !== $additional_css ? $additional_css : ';'
if ( '' === $declaration ) {
'selector' => $css_selector,
'declaration' => $declaration,
if ( 'desktop_only' === $device ) {
$style['media_query'] = ET_Builder_Element::get_media_query( 'min_width_981' );
} elseif ( 'desktop' !== $device ) {
$current_media_query = 'tablet' === $device ? 'max_width_980' : 'max_width_767';
$style['media_query'] = ET_Builder_Element::get_media_query( $current_media_query );
ET_Builder_Element::set_style( $function_name, $style );
function et_pb_custom_search( $query = false ) {
if ( is_admin() || ! is_a( $query, 'WP_Query' ) || ! $query->is_search ) {
$utils = ET_Core_Data_Utils::instance();
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
if ( isset( $_GET['et_pb_searchform_submit'] ) ) {
if ( ! isset($_GET['et_pb_include_posts'] ) && ! isset( $_GET['et_pb_include_pages'] ) ) $postTypes = array( 'post' );
if ( isset( $_GET['et_pb_include_pages'] ) ) $postTypes = array( 'page' );
if ( isset( $_GET['et_pb_include_posts'] ) ) $postTypes[] = 'post';
// $postTypes is allowlisted values only
$query->set( 'post_type', $postTypes );
if ( ! empty( $_GET['et_pb_search_cat'] ) ) {
$categories_array = explode( ',', $_GET['et_pb_search_cat'] );
$categories_array = $utils->sanitize_text_fields( $categories_array );
$query->set( 'category__not_in', $categories_array );
if ( isset( $_GET['et-posts-count'] ) ) {
$query->set( 'posts_per_page', (int) $_GET['et-posts-count'] );
add_action( 'pre_get_posts', 'et_pb_custom_search' );
if ( ! function_exists( 'et_custom_comments_display' ) ) :
function et_custom_comments_display( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
$default_avatar = get_option( 'avatar_default' ) ? get_option( 'avatar_default' ) : 'mystery'; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<article id="comment-<?php comment_ID(); ?>" class="comment-body clearfix">
<div class="comment_avatar">
<?php echo get_avatar( $comment, $size = '80', esc_attr( $default_avatar ), esc_attr( get_comment_author() ) ); ?>
<div class="comment_postinfo">
<?php printf( '<span class="fn">%s</span>', get_comment_author_link() ); ?>
<span class="comment_date">
/* translators: 1: date, 2: time */
printf( esc_html__( 'on %1$s at %2$s', 'et_builder' ), esc_html( get_comment_date() ), esc_html( get_comment_time() ) );
<?php edit_comment_link( esc_html__( '(Edit)', 'et_builder' ), ' ' ); ?>
$et_comment_reply_link = get_comment_reply_link( array_merge( $args, array(
'reply_text' => esc_html__( 'Reply', 'et_builder' ),
'max_depth' => (int) $args['max_depth'],
</div> <!-- .comment_postinfo -->
<div class="comment_area">
<?php if ( '0' === $comment->comment_approved ) : ?>
<em class="moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'et_builder' ) ?></em>
<div class="comment-content clearfix">
if ( $et_comment_reply_link ) echo '<span class="reply-container">' . et_core_esc_previously( $et_comment_reply_link ) . '</span>';
</div> <!-- end comment-content-->
</div> <!-- end comment_area-->
</article> <!-- .comment-body -->
/* Exclude library related taxonomies from Yoast SEO Sitemap */
function et_wpseo_sitemap_exclude_taxonomy( $value, $taxonomy ) {
$excluded = array( 'scope', 'module_width', 'layout_type', 'layout_category', 'layout', 'layout_pack' );
if ( in_array( $taxonomy, $excluded ) ) {
add_filter( 'wpseo_sitemap_exclude_taxonomy', 'et_wpseo_sitemap_exclude_taxonomy', 10, 2 );
* Is WP Job Manager plugin active?
* @return bool True - if the plugin is active
if ( ! function_exists( 'et_is_wp_job_manager_plugin_active' ) ) :
function et_is_wp_job_manager_plugin_active() {
return class_exists( 'WP_Job_Manager' );
* @deprecated See {@see et_core_is_gutenberg_active()}
* @since 3.19.2 Renamed and moved to core.
* @return bool True - if the plugin is active
if ( ! function_exists( 'et_is_gutenberg_active' ) ) :
function et_is_gutenberg_active() {
return et_core_is_gutenberg_active();