Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder
File: functions.php
}
[3000] Fix | Delete
[3001] Fix | Delete
$element_style .= sprintf(
[3002] Fix | Delete
'%3$s-%1$s: %2$s%4$s; ',
[3003] Fix | Delete
esc_attr( $position ),
[3004] Fix | Delete
esc_attr( et_builder_process_range_value( $values[ $i ], $property ) ),
[3005] Fix | Delete
esc_attr( $property ),
[3006] Fix | Delete
( $use_important ? ' !important' : '' )
[3007] Fix | Delete
);
[3008] Fix | Delete
}
[3009] Fix | Delete
[3010] Fix | Delete
$style .= rtrim( $element_style );
[3011] Fix | Delete
}
[3012] Fix | Delete
[3013] Fix | Delete
return $style;
[3014] Fix | Delete
}
[3015] Fix | Delete
endif;
[3016] Fix | Delete
[3017] Fix | Delete
if ( ! function_exists( 'et_builder_enqueue_font' ) ) :
[3018] Fix | Delete
/**
[3019] Fix | Delete
* Enqueue fonts.
[3020] Fix | Delete
*
[3021] Fix | Delete
* @param string $font_name font name.
[3022] Fix | Delete
*/
[3023] Fix | Delete
function et_builder_enqueue_font( $font_name ) {
[3024] Fix | Delete
global $et_fonts_queue, $et_user_fonts_queue;
[3025] Fix | Delete
[3026] Fix | Delete
$fonts = et_builder_get_fonts();
[3027] Fix | Delete
$websafe_fonts = et_builder_get_websafe_fonts();
[3028] Fix | Delete
$user_fonts = et_builder_get_custom_fonts();
[3029] Fix | Delete
$removed_fonts_mapping = et_builder_old_fonts_mapping();
[3030] Fix | Delete
[3031] Fix | Delete
if ( array_key_exists( $font_name, $user_fonts ) ) {
[3032] Fix | Delete
$et_user_fonts_queue[ $font_name ] = $user_fonts[ $font_name ];
[3033] Fix | Delete
return;
[3034] Fix | Delete
}
[3035] Fix | Delete
[3036] Fix | Delete
// Skip enqueueing if font name is not found. Possibly happen if support for particular font need to be dropped.
[3037] Fix | Delete
if ( ! array_key_exists( $font_name, $fonts ) && ! isset( $removed_fonts_mapping[ $font_name ] ) ) {
[3038] Fix | Delete
return;
[3039] Fix | Delete
}
[3040] Fix | Delete
[3041] Fix | Delete
// Skip enqueueing for websafe fonts.
[3042] Fix | Delete
if ( array_key_exists( $font_name, $websafe_fonts ) ) {
[3043] Fix | Delete
return;
[3044] Fix | Delete
}
[3045] Fix | Delete
[3046] Fix | Delete
if ( isset( $removed_fonts_mapping[ $font_name ] ) ) {
[3047] Fix | Delete
$font_name = $removed_fonts_mapping[ $font_name ]['parent_font'];
[3048] Fix | Delete
}
[3049] Fix | Delete
$font_character_set = $fonts[ $font_name ]['character_set'];
[3050] Fix | Delete
[3051] Fix | Delete
global $shortname;
[3052] Fix | Delete
[3053] Fix | Delete
// Force enabled subsets for existing sites once.
[3054] Fix | Delete
if ( ! et_get_option( "{$shortname}_skip_font_subset_force", false ) ) {
[3055] Fix | Delete
et_update_option( "{$shortname}_gf_enable_all_character_sets", 'on' );
[3056] Fix | Delete
et_update_option( "{$shortname}_skip_font_subset_force", true );
[3057] Fix | Delete
}
[3058] Fix | Delete
[3059] Fix | Delete
// By default, only latin and latin-ext subsets are loaded, all available subsets can be enabled in ePanel.
[3060] Fix | Delete
if ( 'false' === et_get_option( "{$shortname}_gf_enable_all_character_sets", 'false' ) ) {
[3061] Fix | Delete
$latin_ext = '';
[3062] Fix | Delete
[3063] Fix | Delete
if ( false !== strpos( $fonts[ $font_name ]['character_set'], 'latin-ext' ) ) {
[3064] Fix | Delete
$latin_ext = ',latin-ext';
[3065] Fix | Delete
}
[3066] Fix | Delete
[3067] Fix | Delete
$font_character_set = "latin{$latin_ext}";
[3068] Fix | Delete
}
[3069] Fix | Delete
[3070] Fix | Delete
$font_name_slug = sprintf(
[3071] Fix | Delete
'et-gf-%1$s',
[3072] Fix | Delete
strtolower( str_replace( ' ', '-', $font_name ) )
[3073] Fix | Delete
);
[3074] Fix | Delete
[3075] Fix | Delete
$queued_font = array(
[3076] Fix | Delete
'font' => sprintf(
[3077] Fix | Delete
'%s:%s',
[3078] Fix | Delete
str_replace( ' ', '+', $font_name ),
[3079] Fix | Delete
apply_filters( 'et_builder_set_styles', $fonts[ $font_name ]['styles'], $font_name )
[3080] Fix | Delete
),
[3081] Fix | Delete
'subset' => apply_filters( 'et_builder_set_character_set', $font_character_set, $font_name ),
[3082] Fix | Delete
);
[3083] Fix | Delete
[3084] Fix | Delete
// Enqueue google fonts.
[3085] Fix | Delete
$et_fonts_queue[ $font_name_slug ] = $queued_font;
[3086] Fix | Delete
}
[3087] Fix | Delete
endif;
[3088] Fix | Delete
[3089] Fix | Delete
if ( ! function_exists( 'et_builder_enqueue_user_fonts' ) ) :
[3090] Fix | Delete
/**
[3091] Fix | Delete
* Load user fonts.
[3092] Fix | Delete
*
[3093] Fix | Delete
* @param array $et_user_fonts User fonts.
[3094] Fix | Delete
*
[3095] Fix | Delete
* @return The @font-face CSS at-rule.
[3096] Fix | Delete
*/
[3097] Fix | Delete
function et_builder_enqueue_user_fonts( $et_user_fonts ) {
[3098] Fix | Delete
$output = '';
[3099] Fix | Delete
// load user fonts.
[3100] Fix | Delete
if ( ! empty( $et_user_fonts ) ) {
[3101] Fix | Delete
foreach ( $et_user_fonts as $font_name => $font_data ) {
[3102] Fix | Delete
if ( is_array( $font_data['font_url'] ) && ! empty( $font_data['font_url'] ) ) {
[3103] Fix | Delete
// generate the @font-face src from the uploaded font files
[3104] Fix | Delete
// all the font formats have to be added in certain order to provide the best browser support.
[3105] Fix | Delete
$uploaded_files = array(
[3106] Fix | Delete
'eot' => array(
[3107] Fix | Delete
'url' => isset( $font_data['font_url']['eot'] ) ? $font_data['font_url']['eot'] : false,
[3108] Fix | Delete
'format' => 'embedded-opentype',
[3109] Fix | Delete
),
[3110] Fix | Delete
'woff2' => array(
[3111] Fix | Delete
'url' => isset( $font_data['font_url']['woff2'] ) ? $font_data['font_url']['woff2'] : false,
[3112] Fix | Delete
'format' => 'woff2',
[3113] Fix | Delete
),
[3114] Fix | Delete
'woff' => array(
[3115] Fix | Delete
'url' => isset( $font_data['font_url']['woff'] ) ? $font_data['font_url']['woff'] : false,
[3116] Fix | Delete
'format' => 'woff',
[3117] Fix | Delete
),
[3118] Fix | Delete
'ttf' => array(
[3119] Fix | Delete
'url' => isset( $font_data['font_url']['ttf'] ) ? $font_data['font_url']['ttf'] : false,
[3120] Fix | Delete
'format' => 'truetype',
[3121] Fix | Delete
),
[3122] Fix | Delete
'otf' => array(
[3123] Fix | Delete
'url' => isset( $font_data['font_url']['otf'] ) ? $font_data['font_url']['otf'] : false,
[3124] Fix | Delete
'format' => 'opentype',
[3125] Fix | Delete
),
[3126] Fix | Delete
);
[3127] Fix | Delete
[3128] Fix | Delete
$font_src = '';
[3129] Fix | Delete
[3130] Fix | Delete
foreach ( $uploaded_files as $ext => $file_data ) {
[3131] Fix | Delete
if ( ! $file_data['url'] ) {
[3132] Fix | Delete
continue;
[3133] Fix | Delete
}
[3134] Fix | Delete
[3135] Fix | Delete
$font_src .= '' === $font_src ? 'src: ' : ', ';
[3136] Fix | Delete
[3137] Fix | Delete
$font_src .= sprintf(
[3138] Fix | Delete
'url("%1$s%2$s") format("%3$s")',
[3139] Fix | Delete
esc_url( $file_data['url'] ),
[3140] Fix | Delete
'eot' === $ext ? '?#iefix' : '',
[3141] Fix | Delete
esc_attr( $file_data['format'] )
[3142] Fix | Delete
);
[3143] Fix | Delete
}
[3144] Fix | Delete
[3145] Fix | Delete
$output .= sprintf(
[3146] Fix | Delete
'@font-face { font-family: "%1$s"; font-display: swap; %2$s %3$s; }',
[3147] Fix | Delete
esc_attr( $font_name ),
[3148] Fix | Delete
isset( $font_data['font_url']['eot'] ) ? sprintf( 'src: url(%1$s);', esc_url( $font_data['font_url']['eot'] ) ) : '',
[3149] Fix | Delete
// Make sure to properly escape each individual piece of $font_src above.
[3150] Fix | Delete
et_core_esc_previously( $font_src )
[3151] Fix | Delete
);
[3152] Fix | Delete
} else {
[3153] Fix | Delete
$output .= sprintf( '@font-face { font-family: "%1$s"; font-display: swap; src: url(%2$s);}', esc_attr( $font_name ), esc_url( $font_data['font_url'] ) );
[3154] Fix | Delete
}
[3155] Fix | Delete
}
[3156] Fix | Delete
}
[3157] Fix | Delete
[3158] Fix | Delete
return $output;
[3159] Fix | Delete
}
[3160] Fix | Delete
endif;
[3161] Fix | Delete
[3162] Fix | Delete
if ( ! function_exists( 'et_font_subset_force_check' ) ) :
[3163] Fix | Delete
/**
[3164] Fix | Delete
* Font subset force check on theme activation.
[3165] Fix | Delete
*/
[3166] Fix | Delete
function et_font_subset_force_check() {
[3167] Fix | Delete
global $shortname;
[3168] Fix | Delete
[3169] Fix | Delete
if ( empty( $shortname ) || ! in_array( $shortname, array( 'divi', 'extra' ), true ) ) {
[3170] Fix | Delete
return;
[3171] Fix | Delete
}
[3172] Fix | Delete
[3173] Fix | Delete
if ( ! et_get_option( "{$shortname}_skip_font_subset_force", false ) ) {
[3174] Fix | Delete
et_update_option( "{$shortname}_skip_font_subset_force", true );
[3175] Fix | Delete
}
[3176] Fix | Delete
}
[3177] Fix | Delete
endif;
[3178] Fix | Delete
add_action( 'after_switch_theme', 'et_font_subset_force_check' );
[3179] Fix | Delete
[3180] Fix | Delete
/**
[3181] Fix | Delete
* Enqueue queued Google Fonts into WordPress' wp_enqueue_style as one request
[3182] Fix | Delete
*
[3183] Fix | Delete
* @return void
[3184] Fix | Delete
*/
[3185] Fix | Delete
function et_builder_print_font() {
[3186] Fix | Delete
global $et_fonts_queue, $et_fonts_cache;
[3187] Fix | Delete
[3188] Fix | Delete
// Bail if no queued google font found.
[3189] Fix | Delete
if ( empty( $et_fonts_queue ) ) {
[3190] Fix | Delete
return;
[3191] Fix | Delete
}
[3192] Fix | Delete
[3193] Fix | Delete
$protocol = is_ssl() ? 'https' : 'http';
[3194] Fix | Delete
$fonts = wp_list_pluck( $et_fonts_queue, 'font' );
[3195] Fix | Delete
$subsets = wp_list_pluck( $et_fonts_queue, 'subset' );
[3196] Fix | Delete
$unique_subsets = array_unique( explode( ',', implode( ',', $subsets ) ) );
[3197] Fix | Delete
[3198] Fix | Delete
// Get the google fonts for the current page that are stored as an option.
[3199] Fix | Delete
$post_fonts_data = array();
[3200] Fix | Delete
[3201] Fix | Delete
$post_id = is_singular() ? get_the_ID() : false;
[3202] Fix | Delete
[3203] Fix | Delete
if ( false !== $post_id ) {
[3204] Fix | Delete
$post_fonts_data = get_post_meta( $post_id, 'et_enqueued_post_fonts', true );
[3205] Fix | Delete
}
[3206] Fix | Delete
[3207] Fix | Delete
if ( ! is_array( $post_fonts_data ) ) {
[3208] Fix | Delete
$post_fonts_data = array();
[3209] Fix | Delete
}
[3210] Fix | Delete
[3211] Fix | Delete
if ( empty( $post_fonts_data ) ) {
[3212] Fix | Delete
$post_fonts_data = array(
[3213] Fix | Delete
'family' => array(),
[3214] Fix | Delete
'subset' => array(),
[3215] Fix | Delete
);
[3216] Fix | Delete
}
[3217] Fix | Delete
[3218] Fix | Delete
// We only need the difference in the fonts since the subsets might be needed
[3219] Fix | Delete
// in cases where a new font is added to the page and it is not yet present
[3220] Fix | Delete
// in the option cache.
[3221] Fix | Delete
$cached_fonts = $post_fonts_data['family'];
[3222] Fix | Delete
[3223] Fix | Delete
$fonts_diff = array_diff( $fonts, $cached_fonts );
[3224] Fix | Delete
[3225] Fix | Delete
if ( ! $fonts_diff ) {
[3226] Fix | Delete
// The `$fonts` variable stores all the fonts used on the page (cache does not matter)
[3227] Fix | Delete
// while the `$cached_fonts` one only stores the fonts that were lastly saved into
[3228] Fix | Delete
// the post meta. When we run `array_diff` we would only get a result if there
[3229] Fix | Delete
// are new fonts present on the page that are not yet cached. However if some
[3230] Fix | Delete
// of the cached fonts are no longer in use this will not be caught by the
[3231] Fix | Delete
// `array_diff`. To fix this if the item count in `$fonts` is different
[3232] Fix | Delete
// than the one in `$cached_fonts` we update the post meta with the
[3233] Fix | Delete
// data from the `$fonts` variable to force unused fonts removal.
[3234] Fix | Delete
if ( count( $fonts ) !== count( $cached_fonts ) ) {
[3235] Fix | Delete
// Update the option for the current page with the new data.
[3236] Fix | Delete
$post_fonts_data = array(
[3237] Fix | Delete
'family' => et_core_sanitized_previously( $fonts ),
[3238] Fix | Delete
'subset' => et_core_sanitized_previously( $unique_subsets ),
[3239] Fix | Delete
);
[3240] Fix | Delete
[3241] Fix | Delete
// Do not update post meta here, save the value to global variable and update it at `shutdown` hook.
[3242] Fix | Delete
// Prevents object cache error on GoDaddy + Woocommerce websites.
[3243] Fix | Delete
$et_fonts_cache = et_core_sanitized_previously( $post_fonts_data );
[3244] Fix | Delete
}
[3245] Fix | Delete
[3246] Fix | Delete
return;
[3247] Fix | Delete
}
[3248] Fix | Delete
[3249] Fix | Delete
if ( et_core_use_google_fonts() ) {
[3250] Fix | Delete
// Append combined subset at the end of the URL as different query string.
[3251] Fix | Delete
$fonts_googleapi_url_args = array(
[3252] Fix | Delete
'family' => implode( '|', $fonts ),
[3253] Fix | Delete
'subset' => implode( ',', $unique_subsets ),
[3254] Fix | Delete
'display' => 'swap',
[3255] Fix | Delete
);
[3256] Fix | Delete
$fonts_googleapi_url = add_query_arg( $fonts_googleapi_url_args, "$protocol://fonts.googleapis.com/css" );
[3257] Fix | Delete
wp_enqueue_style( 'et-builder-googlefonts', esc_url_raw( $fonts_googleapi_url ), array(), null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters -- Google fonts api does not have versions
[3258] Fix | Delete
}
[3259] Fix | Delete
[3260] Fix | Delete
// Create a merge of the existing fonts and subsets in the option and the newly added ones.
[3261] Fix | Delete
$updated_fonts = array_merge( $fonts, $post_fonts_data['family'] );
[3262] Fix | Delete
$updated_subsets = array_merge( $unique_subsets, $post_fonts_data['subset'] );
[3263] Fix | Delete
[3264] Fix | Delete
// Update the option for the current page with the new data.
[3265] Fix | Delete
$post_fonts_data = array(
[3266] Fix | Delete
'family' => array_unique( $updated_fonts ),
[3267] Fix | Delete
'subset' => array_unique( $updated_subsets ),
[3268] Fix | Delete
);
[3269] Fix | Delete
[3270] Fix | Delete
// Do not update post meta here, save the value to global variable and update it at `shutdown` hook.
[3271] Fix | Delete
// Prevents object cache error on GoDaddy + Woocommerce websites.
[3272] Fix | Delete
$et_fonts_cache = et_core_sanitized_previously( $post_fonts_data );
[3273] Fix | Delete
}
[3274] Fix | Delete
add_action( 'wp_footer', 'et_builder_print_font' );
[3275] Fix | Delete
[3276] Fix | Delete
/**
[3277] Fix | Delete
* Update Fonts Cache in post meta
[3278] Fix | Delete
* Run this function on shutdown hook to prevents object cache error on GoDaddy + Woocommerce websites
[3279] Fix | Delete
*
[3280] Fix | Delete
* @return void
[3281] Fix | Delete
*/
[3282] Fix | Delete
function et_builder_update_fonts_cache() {
[3283] Fix | Delete
global $et_fonts_cache;
[3284] Fix | Delete
[3285] Fix | Delete
if ( ! isset( $et_fonts_cache ) || empty( $et_fonts_cache ) ) {
[3286] Fix | Delete
return;
[3287] Fix | Delete
}
[3288] Fix | Delete
[3289] Fix | Delete
$post_id = is_singular() ? get_the_ID() : false;
[3290] Fix | Delete
[3291] Fix | Delete
if ( ! $post_id ) {
[3292] Fix | Delete
return;
[3293] Fix | Delete
}
[3294] Fix | Delete
[3295] Fix | Delete
update_post_meta( $post_id, 'et_enqueued_post_fonts', et_core_sanitized_previously( $et_fonts_cache ) );
[3296] Fix | Delete
}
[3297] Fix | Delete
add_action( 'shutdown', 'et_builder_update_fonts_cache' );
[3298] Fix | Delete
[3299] Fix | Delete
/**
[3300] Fix | Delete
* Enqueue queued Google Fonts into WordPress' wp_enqueue_style as one request (cached version)
[3301] Fix | Delete
*
[3302] Fix | Delete
* @return void
[3303] Fix | Delete
*/
[3304] Fix | Delete
function et_builder_preprint_font() {
[3305] Fix | Delete
// Return if this is not a post or a page.
[3306] Fix | Delete
if ( ! is_singular() || ! et_core_use_google_fonts() ) {
[3307] Fix | Delete
return;
[3308] Fix | Delete
}
[3309] Fix | Delete
[3310] Fix | Delete
$post_id = get_the_ID();
[3311] Fix | Delete
[3312] Fix | Delete
$post_fonts_data = get_post_meta( $post_id, 'et_enqueued_post_fonts', true );
[3313] Fix | Delete
[3314] Fix | Delete
// No need to proceed if the proper data is missing from the cache.
[3315] Fix | Delete
if ( ! is_array( $post_fonts_data ) || ! isset( $post_fonts_data['family'], $post_fonts_data['subset'] ) ) {
[3316] Fix | Delete
return;
[3317] Fix | Delete
}
[3318] Fix | Delete
[3319] Fix | Delete
$fonts = $post_fonts_data['family'];
[3320] Fix | Delete
[3321] Fix | Delete
if ( ! $fonts ) {
[3322] Fix | Delete
return;
[3323] Fix | Delete
}
[3324] Fix | Delete
[3325] Fix | Delete
$unique_subsets = $post_fonts_data['subset'];
[3326] Fix | Delete
$protocol = is_ssl() ? 'https' : 'http';
[3327] Fix | Delete
[3328] Fix | Delete
$googlefonts_cached_url_args = array(
[3329] Fix | Delete
'family' => implode( '|', $fonts ),
[3330] Fix | Delete
'subset' => implode( ',', $unique_subsets ),
[3331] Fix | Delete
'display' => 'swap',
[3332] Fix | Delete
);
[3333] Fix | Delete
$googlefonts_cached_url = add_query_arg( $googlefonts_cached_url_args, "$protocol://fonts.googleapis.com/css" );
[3334] Fix | Delete
[3335] Fix | Delete
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters -- Google fonts api does not have versions.
[3336] Fix | Delete
wp_enqueue_style( 'et-builder-googlefonts-cached', esc_url_raw( $googlefonts_cached_url ), array(), null );
[3337] Fix | Delete
}
[3338] Fix | Delete
add_action( 'wp_enqueue_scripts', 'et_builder_preprint_font' );
[3339] Fix | Delete
[3340] Fix | Delete
if ( ! function_exists( 'et_pb_get_page_custom_css' ) ) :
[3341] Fix | Delete
/**
[3342] Fix | Delete
* Return page custom style.
[3343] Fix | Delete
*
[3344] Fix | Delete
* @param int $post_id post id.
[3345] Fix | Delete
*/
[3346] Fix | Delete
function et_pb_get_page_custom_css( $post_id = 0 ) {
[3347] Fix | Delete
$post_id = $post_id ? $post_id : get_the_ID();
[3348] Fix | Delete
$post_type = get_post_type( $post_id );
[3349] Fix | Delete
$overflow = et_pb_overflow();
[3350] Fix | Delete
$page_id = apply_filters( 'et_pb_page_id_custom_css', $post_id );
[3351] Fix | Delete
$exclude_defaults = true;
[3352] Fix | Delete
$page_settings = ET_Builder_Settings::get_values( 'page', $page_id, $exclude_defaults );
[3353] Fix | Delete
$selector_prefix = '.et-l--post';
[3354] Fix | Delete
[3355] Fix | Delete
switch ( $post_type ) {
[3356] Fix | Delete
case ET_THEME_BUILDER_HEADER_LAYOUT_POST_TYPE:
[3357] Fix | Delete
$selector_prefix = '.et-l--header';
[3358] Fix | Delete
break;
[3359] Fix | Delete
[3360] Fix | Delete
case ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE:
[3361] Fix | Delete
$selector_prefix = '.et-l--body';
[3362] Fix | Delete
break;
[3363] Fix | Delete
[3364] Fix | Delete
case ET_THEME_BUILDER_FOOTER_LAYOUT_POST_TYPE:
[3365] Fix | Delete
$selector_prefix = '.et-l--footer';
[3366] Fix | Delete
break;
[3367] Fix | Delete
}
[3368] Fix | Delete
[3369] Fix | Delete
$wrap_post_id = $page_id;
[3370] Fix | Delete
[3371] Fix | Delete
if ( et_theme_builder_is_layout_post_type( $post_type ) ) {
[3372] Fix | Delete
$main_post_id = ET_Post_Stack::get_main_post_id();
[3373] Fix | Delete
[3374] Fix | Delete
if ( $main_post_id ) {
[3375] Fix | Delete
$wrap_post_id = $main_post_id;
[3376] Fix | Delete
}
[3377] Fix | Delete
}
[3378] Fix | Delete
[3379] Fix | Delete
$wrap_selector = et_pb_is_pagebuilder_used( $wrap_post_id ) && ( et_is_builder_plugin_active() || et_builder_post_is_of_custom_post_type( $wrap_post_id ) );
[3380] Fix | Delete
[3381] Fix | Delete
if ( $wrap_selector ) {
[3382] Fix | Delete
$selector_prefix = ' ' . ET_BUILDER_CSS_PREFIX . $selector_prefix;
[3383] Fix | Delete
}
[3384] Fix | Delete
[3385] Fix | Delete
$output = get_post_meta( $page_id, '_et_pb_custom_css', true );
[3386] Fix | Delete
[3387] Fix | Delete
if ( isset( $page_settings['et_pb_light_text_color'] ) ) {
[3388] Fix | Delete
$output .= sprintf(
[3389] Fix | Delete
'%2$s .et_pb_bg_layout_dark { color: %1$s !important; }',
[3390] Fix | Delete
esc_html( $page_settings['et_pb_light_text_color'] ),
[3391] Fix | Delete
esc_html( $selector_prefix )
[3392] Fix | Delete
);
[3393] Fix | Delete
}
[3394] Fix | Delete
[3395] Fix | Delete
if ( isset( $page_settings['et_pb_dark_text_color'] ) ) {
[3396] Fix | Delete
$output .= sprintf(
[3397] Fix | Delete
'%2$s .et_pb_bg_layout_light { color: %1$s !important; }',
[3398] Fix | Delete
esc_html( $page_settings['et_pb_dark_text_color'] ),
[3399] Fix | Delete
esc_html( $selector_prefix )
[3400] Fix | Delete
);
[3401] Fix | Delete
}
[3402] Fix | Delete
[3403] Fix | Delete
if ( isset( $page_settings['et_pb_content_area_background_color'] ) ) {
[3404] Fix | Delete
$content_area_bg_selector = et_is_builder_plugin_active() ? $selector_prefix : ' .page.et_pb_pagebuilder_layout #main-content';
[3405] Fix | Delete
$output .= sprintf(
[3406] Fix | Delete
'%1$s { background-color: %2$s; }',
[3407] Fix | Delete
esc_html( $content_area_bg_selector ),
[3408] Fix | Delete
esc_html( $page_settings['et_pb_content_area_background_color'] )
[3409] Fix | Delete
);
[3410] Fix | Delete
}
[3411] Fix | Delete
[3412] Fix | Delete
if ( isset( $page_settings['et_pb_section_background_color'] ) ) {
[3413] Fix | Delete
$output .= sprintf(
[3414] Fix | Delete
'%2$s > .et_builder_inner_content > .et_pb_section { background-color: %1$s; }',
[3415] Fix | Delete
esc_html( $page_settings['et_pb_section_background_color'] ),
[3416] Fix | Delete
esc_html( $selector_prefix )
[3417] Fix | Delete
);
[3418] Fix | Delete
}
[3419] Fix | Delete
[3420] Fix | Delete
$overflow_x = $overflow->get_value_x( $page_settings, '', 'et_pb_' );
[3421] Fix | Delete
$overflow_y = $overflow->get_value_y( $page_settings, '', 'et_pb_' );
[3422] Fix | Delete
[3423] Fix | Delete
if ( ! empty( $overflow_x ) ) {
[3424] Fix | Delete
$output .= sprintf(
[3425] Fix | Delete
'%2$s .et_builder_inner_content { overflow-x: %1$s; }',
[3426] Fix | Delete
esc_html( $overflow_x ),
[3427] Fix | Delete
esc_html( $selector_prefix )
[3428] Fix | Delete
);
[3429] Fix | Delete
}
[3430] Fix | Delete
[3431] Fix | Delete
if ( ! empty( $overflow_y ) ) {
[3432] Fix | Delete
$output .= sprintf(
[3433] Fix | Delete
'%2$s .et_builder_inner_content { overflow-y: %1$s; }',
[3434] Fix | Delete
esc_html( $overflow_y ),
[3435] Fix | Delete
esc_html( $selector_prefix )
[3436] Fix | Delete
);
[3437] Fix | Delete
}
[3438] Fix | Delete
[3439] Fix | Delete
if ( isset( $page_settings['et_pb_page_z_index'] ) && '' !== $page_settings['et_pb_page_z_index'] ) {
[3440] Fix | Delete
$output .= sprintf(
[3441] Fix | Delete
'%2$s .et_builder_inner_content { z-index: %1$s; }',
[3442] Fix | Delete
esc_html( $page_settings['et_pb_page_z_index'] ),
[3443] Fix | Delete
esc_html( '.et-db #et-boc .et-l' . $selector_prefix )
[3444] Fix | Delete
);
[3445] Fix | Delete
}
[3446] Fix | Delete
[3447] Fix | Delete
return apply_filters( 'et_pb_page_custom_css', $output );
[3448] Fix | Delete
}
[3449] Fix | Delete
endif;
[3450] Fix | Delete
[3451] Fix | Delete
if ( ! function_exists( 'et_pb_video_oembed_data_parse' ) ) :
[3452] Fix | Delete
/**
[3453] Fix | Delete
* Remove scheme from video url.
[3454] Fix | Delete
*
[3455] Fix | Delete
* @param string $return The returned oEmbed HTML.
[3456] Fix | Delete
* @param object $data A data object result from an oEmbed provider.
[3457] Fix | Delete
* @param string $url The URL of the content to be embedded.
[3458] Fix | Delete
*/
[3459] Fix | Delete
function et_pb_video_oembed_data_parse( $return, $data, $url ) {
[3460] Fix | Delete
if ( isset( $data->thumbnail_url ) ) {
[3461] Fix | Delete
return esc_url( str_replace( array( 'https://', 'http://' ), '//', $data->thumbnail_url ), array( 'http' ) );
[3462] Fix | Delete
} else {
[3463] Fix | Delete
return false;
[3464] Fix | Delete
}
[3465] Fix | Delete
}
[3466] Fix | Delete
endif;
[3467] Fix | Delete
[3468] Fix | Delete
if ( ! function_exists( 'et_pb_check_oembed_provider' ) ) :
[3469] Fix | Delete
/**
[3470] Fix | Delete
* Returns the corresponding oEmbed provider's URL.
[3471] Fix | Delete
*
[3472] Fix | Delete
* @param string $url oembed url.
[3473] Fix | Delete
*
[3474] Fix | Delete
* @reurn string
[3475] Fix | Delete
*/
[3476] Fix | Delete
function et_pb_check_oembed_provider( $url ) {
[3477] Fix | Delete
if ( version_compare( $GLOBALS['wp_version'], '5.3', '<' ) ) {
[3478] Fix | Delete
require_once ABSPATH . WPINC . '/class-oembed.php';
[3479] Fix | Delete
} else {
[3480] Fix | Delete
require_once ABSPATH . WPINC . '/class-wp-oembed.php';
[3481] Fix | Delete
}
[3482] Fix | Delete
[3483] Fix | Delete
$oembed = _wp_oembed_get_object();
[3484] Fix | Delete
[3485] Fix | Delete
return $oembed->get_provider( esc_url( $url ), array( 'discover' => false ) );
[3486] Fix | Delete
}
[3487] Fix | Delete
endif;
[3488] Fix | Delete
[3489] Fix | Delete
if ( ! function_exists( 'et_builder_get_oembed' ) ) :
[3490] Fix | Delete
/**
[3491] Fix | Delete
* Get cached embedded item on page load.
[3492] Fix | Delete
*
[3493] Fix | Delete
* Use the item source as the key, so some modules with the same item can share it.
[3494] Fix | Delete
*
[3495] Fix | Delete
* @since 4.5.2
[3496] Fix | Delete
*
[3497] Fix | Delete
* @param string $url Item URL.
[3498] Fix | Delete
* @param string $group Item group to set different cache for the same key.
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function