Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/et-pageb...
File: et-pagebuilder.php
<?php
[0] Fix | Delete
[1] Fix | Delete
define( 'ET_BUILDER_THEME', true );
[2] Fix | Delete
function et_setup_builder() {
[3] Fix | Delete
define( 'ET_BUILDER_DIR', get_template_directory() . '/includes/builder/' );
[4] Fix | Delete
define( 'ET_BUILDER_URI', get_template_directory_uri() . '/includes/builder' );
[5] Fix | Delete
define( 'ET_BUILDER_LAYOUT_POST_TYPE', 'et_pb_layout' );
[6] Fix | Delete
[7] Fix | Delete
$theme_version = et_get_theme_version();
[8] Fix | Delete
define( 'ET_BUILDER_VERSION', $theme_version );
[9] Fix | Delete
[10] Fix | Delete
load_theme_textdomain( 'et_builder', ET_BUILDER_DIR . 'languages' );
[11] Fix | Delete
require_once ET_BUILDER_DIR . 'framework.php';
[12] Fix | Delete
[13] Fix | Delete
et_pb_register_posttypes();
[14] Fix | Delete
}
[15] Fix | Delete
add_action( 'init', 'et_setup_builder', 0 );
[16] Fix | Delete
[17] Fix | Delete
if ( ! function_exists( 'et_divi_maybe_adjust_row_advanced_options_config' ) ):
[18] Fix | Delete
function et_divi_maybe_adjust_row_advanced_options_config( $advanced_options ) {
[19] Fix | Delete
// Row in Divi needs to be further wrapped
[20] Fix | Delete
$selector = array(
[21] Fix | Delete
'%%order_class%%',
[22] Fix | Delete
'body #page-container .et-db #et-boc .et-l %%order_class%%.et_pb_row',
[23] Fix | Delete
'body.et_pb_pagebuilder_layout.single #page-container #et-boc .et-l %%order_class%%.et_pb_row',
[24] Fix | Delete
'%%row_selector%%',
[25] Fix | Delete
);
[26] Fix | Delete
[27] Fix | Delete
$selector = implode( ', ', $selector );
[28] Fix | Delete
[29] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.css.width', $selector );
[30] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.css.max_width', $selector );
[31] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.options.max_width.default', et_divi_get_content_width() . 'px' );
[32] Fix | Delete
[33] Fix | Delete
if ( ! et_divi_is_boxed_layout() ) {
[34] Fix | Delete
return $advanced_options;
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
$selector = implode( ', ', array(
[38] Fix | Delete
'%%order_class%%',
[39] Fix | Delete
'body.et_boxed_layout #page-container %%order_class%%.et_pb_row',
[40] Fix | Delete
'body.et_boxed_layout.et_pb_pagebuilder_layout.single #page-container #et-boc .et-l %%order_class%%.et_pb_row',
[41] Fix | Delete
'body.et_boxed_layout.et_pb_pagebuilder_layout.single.et_full_width_page #page-container #et-boc .et-l %%order_class%%.et_pb_row',
[42] Fix | Delete
'body.et_boxed_layout.et_pb_pagebuilder_layout.single.et_full_width_portfolio_page #page-container #et-boc .et-l %%order_class%%.et_pb_row',
[43] Fix | Delete
) );
[44] Fix | Delete
[45] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.css.width', $selector );
[46] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.css.max_width', $selector );
[47] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.options.width.default', '90%' );
[48] Fix | Delete
[49] Fix | Delete
return $advanced_options;
[50] Fix | Delete
}
[51] Fix | Delete
add_filter( 'et_pb_row_advanced_fields', 'et_divi_maybe_adjust_row_advanced_options_config' );
[52] Fix | Delete
endif;
[53] Fix | Delete
[54] Fix | Delete
function et_divi_get_row_advanced_options_selector_replacement() {
[55] Fix | Delete
static $replacement;
[56] Fix | Delete
[57] Fix | Delete
if ( empty( $replacement ) ) {
[58] Fix | Delete
$post_type = get_post_type();
[59] Fix | Delete
[60] Fix | Delete
if ( 'project' !== $post_type ) {
[61] Fix | Delete
// Builder automatically adds `#et-boc` on selector on non official post type; hence
[62] Fix | Delete
// alternative selector wrapper for non official post type
[63] Fix | Delete
if ( et_builder_is_post_type_custom( $post_type ) ) {
[64] Fix | Delete
$replacement = 'body.et_pb_pagebuilder_layout.single.et_full_width_page #page-container %%order_class%%.et_pb_row';
[65] Fix | Delete
} else {
[66] Fix | Delete
$replacement = 'body.et_pb_pagebuilder_layout.single.et_full_width_page #page-container #et-boc .et-l %%order_class%%.et_pb_row';
[67] Fix | Delete
}
[68] Fix | Delete
} else {
[69] Fix | Delete
// `project` post type has its own specific selector
[70] Fix | Delete
$replacement = 'body.et_pb_pagebuilder_layout.single.et_full_width_portfolio_page #page-container #et-boc .et-l %%order_class%%.et_pb_row';
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
return $replacement;
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
function et_divi_maybe_adjust_row_advanced_options_selector( $selector ) {
[78] Fix | Delete
if ( ! is_string( $selector ) ) {
[79] Fix | Delete
return $selector;
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
return str_replace( '%%row_selector%%', et_divi_get_row_advanced_options_selector_replacement(), $selector );
[83] Fix | Delete
}
[84] Fix | Delete
add_filter( 'et_pb_row_css_selector', 'et_divi_maybe_adjust_row_advanced_options_selector' );
[85] Fix | Delete
[86] Fix | Delete
if ( ! function_exists( 'et_divi_maybe_adjust_section_advanced_options_config' ) ):
[87] Fix | Delete
function et_divi_maybe_adjust_section_advanced_options_config( $advanced_options ) {
[88] Fix | Delete
$is_post_type = is_singular( 'post' ) || ( 'et_fb_update_builder_assets' === et_()->array_get( $_POST, 'action' ) && 'post' === et_()->array_get( $_POST, 'et_post_type' ) );
[89] Fix | Delete
[90] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.extra.inner.options.max_width.default', et_divi_get_content_width() . 'px' );
[91] Fix | Delete
[92] Fix | Delete
if ( et_divi_is_boxed_layout() ) {
[93] Fix | Delete
$selector = implode( ', ', array(
[94] Fix | Delete
'%%order_class%% > .et_pb_row',
[95] Fix | Delete
'body.et_boxed_layout #page-container %%order_class%% > .et_pb_row',
[96] Fix | Delete
'body.et_boxed_layout.et_pb_pagebuilder_layout.single #page-container #et-boc .et-l %%order_class%% > .et_pb_row',
[97] Fix | Delete
'body.et_boxed_layout.et_pb_pagebuilder_layout.single.et_full_width_page #page-container #et-boc .et-l %%order_class%% > .et_pb_row',
[98] Fix | Delete
'body.et_boxed_layout.et_pb_pagebuilder_layout.single.et_full_width_portfolio_page #page-container #et-boc .et-l %%order_class%% > .et_pb_row',
[99] Fix | Delete
) );
[100] Fix | Delete
[101] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.extra.inner.options.width.default', '90%' );
[102] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.extra.inner.css.main', $selector );
[103] Fix | Delete
} else if ( $is_post_type ) {
[104] Fix | Delete
$selector = implode( ', ', array(
[105] Fix | Delete
'%%order_class%% > .et_pb_row',
[106] Fix | Delete
'body #page-container .et-db #et-boc .et-l %%order_class%% > .et_pb_row',
[107] Fix | Delete
'body.et_pb_pagebuilder_layout.single #page-container #et-boc .et-l %%order_class%% > .et_pb_row',
[108] Fix | Delete
'body.et_pb_pagebuilder_layout.single.et_full_width_page #page-container #et-boc .et-l %%order_class%% > .et_pb_row',
[109] Fix | Delete
'body.et_pb_pagebuilder_layout.single.et_full_width_portfolio_page #page-container #et-boc .et-l %%order_class%% > .et_pb_row',
[110] Fix | Delete
) );
[111] Fix | Delete
et_()->array_set( $advanced_options, 'max_width.extra.inner.css.main', $selector );
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
et_()->array_set( $advanced_options, 'margin_padding.css.main', '%%order_class%%.et_pb_section' );
[115] Fix | Delete
[116] Fix | Delete
return $advanced_options;
[117] Fix | Delete
}
[118] Fix | Delete
add_filter( 'et_pb_section_advanced_fields', 'et_divi_maybe_adjust_section_advanced_options_config' );
[119] Fix | Delete
endif;
[120] Fix | Delete
[121] Fix | Delete
/**
[122] Fix | Delete
* Modify blog module's advanced options configuration
[123] Fix | Delete
*
[124] Fix | Delete
* @since ??
[125] Fix | Delete
*
[126] Fix | Delete
* @param array $advanced_options
[127] Fix | Delete
*
[128] Fix | Delete
* @return array
[129] Fix | Delete
*/
[130] Fix | Delete
function et_divi_maybe_adjust_blog_advanced_options_config( $advanced_options ) {
[131] Fix | Delete
// Adding more specific selector for post meta
[132] Fix | Delete
$meta_selectors = et_()->array_get( $advanced_options, 'fonts.meta.css' );
[133] Fix | Delete
[134] Fix | Delete
// Main post meta selector
[135] Fix | Delete
if ( isset( $meta_selectors['main'] ) ) {
[136] Fix | Delete
$main_selectors = explode( ', ', $meta_selectors['main'] );
[137] Fix | Delete
[138] Fix | Delete
$main_selectors[] = '#left-area %%order_class%% .et_pb_post .post-meta';
[139] Fix | Delete
$main_selectors[] = '#left-area %%order_class%% .et_pb_post .post-meta a';
[140] Fix | Delete
[141] Fix | Delete
et_()->array_set( $advanced_options, 'fonts.meta.css.main', implode( ', ', $main_selectors ) );
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
// Hover post meta selector
[145] Fix | Delete
if ( isset( $meta_selectors['hover'] ) ) {
[146] Fix | Delete
$hover_selectors = explode( ', ', $meta_selectors['hover'] );
[147] Fix | Delete
[148] Fix | Delete
$hover_selectors[] = '#left-area %%order_class%% .et_pb_post .post-meta:hover';
[149] Fix | Delete
$hover_selectors[] = '#left-area %%order_class%% .et_pb_post .post-meta:hover a';
[150] Fix | Delete
$hover_selectors[] = '#left-area %%order_class%% .et_pb_post .post-meta:hover span';
[151] Fix | Delete
[152] Fix | Delete
et_()->array_set( $advanced_options, 'fonts.meta.css.hover', implode( ', ', $hover_selectors ) );
[153] Fix | Delete
}
[154] Fix | Delete
[155] Fix | Delete
return $advanced_options;
[156] Fix | Delete
}
[157] Fix | Delete
add_filter( 'et_pb_blog_advanced_fields', 'et_divi_maybe_adjust_blog_advanced_options_config' );
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* Added custom data attribute to builder's section
[161] Fix | Delete
* @param array initial custom data-* attributes for builder's section
[162] Fix | Delete
* @param array section attributes
[163] Fix | Delete
* @param int section order of appearances. zero based
[164] Fix | Delete
* @return array modified custom data-* attributes for builder's section
[165] Fix | Delete
*/
[166] Fix | Delete
function et_divi_section_data_attributes( $attributes, $atts, $num ) {
[167] Fix | Delete
$custom_padding = isset( $atts['custom_padding'] ) ? $atts['custom_padding'] : '';
[168] Fix | Delete
$custom_padding_tablet = isset( $atts['custom_padding_tablet'] ) ? $atts['custom_padding_tablet'] : '';
[169] Fix | Delete
$custom_padding_phone = isset( $atts['custom_padding_phone'] ) ? $atts['custom_padding_phone'] : '';
[170] Fix | Delete
$is_first_section = 0 === $num;
[171] Fix | Delete
$is_transparent_nav = et_divi_is_transparent_primary_nav();
[172] Fix | Delete
[173] Fix | Delete
// Custom data-* attributes for transparent primary nav support.
[174] Fix | Delete
// Note: in customizer, the data-* attributes have to be printed for live preview purpose
[175] Fix | Delete
if ( $is_first_section && ( $is_transparent_nav || is_customize_preview() ) ) {
[176] Fix | Delete
if ( '' !== $custom_padding && 4 === count( explode( '|', $custom_padding ) ) ) {
[177] Fix | Delete
$attributes['padding'] = $custom_padding;
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
if ( '' !== $custom_padding_tablet && 4 === count( explode( '|', $custom_padding_tablet ) ) ) {
[181] Fix | Delete
$attributes['padding-tablet'] = $custom_padding_tablet;
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
if ( '' !== $custom_padding_phone && 4 === count( explode( '|', $custom_padding_phone ) ) ) {
[185] Fix | Delete
$attributes['padding-phone'] = $custom_padding_phone;
[186] Fix | Delete
}
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
return $attributes;
[190] Fix | Delete
}
[191] Fix | Delete
add_filter( 'et_pb_section_data_attributes', 'et_divi_section_data_attributes', 10, 3 );
[192] Fix | Delete
[193] Fix | Delete
/**
[194] Fix | Delete
* Switch the translation of Visual Builder interface to current user's language
[195] Fix | Delete
* @return void
[196] Fix | Delete
*/
[197] Fix | Delete
if ( ! function_exists( 'et_fb_set_builder_locale' ) ) :
[198] Fix | Delete
function et_fb_set_builder_locale( $locale ) {
[199] Fix | Delete
// apply translations inside VB only
[200] Fix | Delete
if ( empty( $_GET['et_fb'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
[201] Fix | Delete
return $locale;
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
$user = get_user_locale();
[205] Fix | Delete
[206] Fix | Delete
if ( $user === $locale ) {
[207] Fix | Delete
return $locale;
[208] Fix | Delete
}
[209] Fix | Delete
[210] Fix | Delete
if ( ! function_exists( 'switch_to_locale' ) ) {
[211] Fix | Delete
return $locale;
[212] Fix | Delete
}
[213] Fix | Delete
[214] Fix | Delete
switch_to_locale( $user );
[215] Fix | Delete
[216] Fix | Delete
return $user;
[217] Fix | Delete
}
[218] Fix | Delete
endif;
[219] Fix | Delete
add_filter( 'theme_locale', 'et_fb_set_builder_locale' );
[220] Fix | Delete
[221] Fix | Delete
/**
[222] Fix | Delete
* Added custom post class
[223] Fix | Delete
* @param array $classes array of post classes
[224] Fix | Delete
* @param array $class array of additional post classes
[225] Fix | Delete
* @param int $post_id post ID
[226] Fix | Delete
* @return array modified array of post classes
[227] Fix | Delete
*/
[228] Fix | Delete
function et_pb_post_class( $classes, $class, $post_id ) {
[229] Fix | Delete
global $post;
[230] Fix | Delete
[231] Fix | Delete
// Added specific class name if curent post uses comment module. Use global $post->post_content
[232] Fix | Delete
// instead of get_the_content() to retrieve the post's unparsed shortcode content
[233] Fix | Delete
if ( is_single() && has_shortcode( $post->post_content, 'et_pb_comments' ) ) {
[234] Fix | Delete
$classes[] = 'et_pb_no_comments_section';
[235] Fix | Delete
}
[236] Fix | Delete
[237] Fix | Delete
return $classes;
[238] Fix | Delete
}
[239] Fix | Delete
add_filter( 'post_class', 'et_pb_post_class', 10, 3 );
[240] Fix | Delete
[241] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function