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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder
File: core.php
'target' => 'et_pb_role_settings',
[4000] Fix | Delete
'view' => ( isset( $_GET['page'] ) && $_GET['page'] === "et_{$_shortname}_role_editor" ), // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
[4001] Fix | Delete
) );
[4002] Fix | Delete
[4003] Fix | Delete
// Register the Builder Layouts Post Type portability.
[4004] Fix | Delete
et_core_portability_register( 'et_builder_layouts', array(
[4005] Fix | Delete
'name' => esc_html__( 'Divi Builder Layouts', 'et_builder' ),
[4006] Fix | Delete
'type' => 'post_type',
[4007] Fix | Delete
'target' => ET_BUILDER_LAYOUT_POST_TYPE,
[4008] Fix | Delete
'view' => ( isset( $_GET['post_type'] ) && $_GET['post_type'] === ET_BUILDER_LAYOUT_POST_TYPE ), // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
[4009] Fix | Delete
) );
[4010] Fix | Delete
}
[4011] Fix | Delete
[4012] Fix | Delete
if ( current_user_can( 'edit_posts' ) ) {
[4013] Fix | Delete
// Register the Builder individual layouts portability.
[4014] Fix | Delete
et_core_portability_register( 'et_builder', array(
[4015] Fix | Delete
'name' => esc_html__( 'Divi Builder Layout', 'et_builder' ),
[4016] Fix | Delete
'type' => 'post',
[4017] Fix | Delete
'view' => ( function_exists( 'et_builder_should_load_framework' ) && et_builder_should_load_framework() ),
[4018] Fix | Delete
) );
[4019] Fix | Delete
}
[4020] Fix | Delete
}
[4021] Fix | Delete
add_action( 'admin_init', 'et_pb_register_builder_portabilities' );
[4022] Fix | Delete
[4023] Fix | Delete
/**
[4024] Fix | Delete
* Modify the portability export WP query.
[4025] Fix | Delete
*
[4026] Fix | Delete
* @since To define
[4027] Fix | Delete
*
[4028] Fix | Delete
* @return string New query.
[4029] Fix | Delete
*/
[4030] Fix | Delete
function et_pb_modify_portability_export_wp_query( $query ) {
[4031] Fix | Delete
// Exclude predefined layout from export.
[4032] Fix | Delete
return array_merge( $query, array(
[4033] Fix | Delete
'meta_query' => array(
[4034] Fix | Delete
'relation' => 'OR',
[4035] Fix | Delete
array(
[4036] Fix | Delete
'key' => '_et_pb_predefined_layout',
[4037] Fix | Delete
'compare' => 'NOT EXISTS',
[4038] Fix | Delete
),
[4039] Fix | Delete
array(
[4040] Fix | Delete
'key' => '_et_pb_predefined_layout',
[4041] Fix | Delete
'value' => 'on',
[4042] Fix | Delete
'compare' => 'NOT LIKE',
[4043] Fix | Delete
),
[4044] Fix | Delete
),
[4045] Fix | Delete
) );
[4046] Fix | Delete
}
[4047] Fix | Delete
add_filter( 'et_core_portability_export_wp_query_et_builder_layouts', 'et_pb_modify_portability_export_wp_query' );
[4048] Fix | Delete
[4049] Fix | Delete
/**
[4050] Fix | Delete
* Check whether current page is pagebuilder preview page
[4051] Fix | Delete
* @return bool
[4052] Fix | Delete
*/
[4053] Fix | Delete
function is_et_pb_preview() {
[4054] Fix | Delete
global $wp_query;
[4055] Fix | Delete
return ( 'true' === $wp_query->get( 'et_pb_preview' ) && isset( $_GET['et_pb_preview_nonce'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
[4056] Fix | Delete
}
[4057] Fix | Delete
[4058] Fix | Delete
if ( ! function_exists( 'et_pb_is_pagebuilder_used' ) ) :
[4059] Fix | Delete
[4060] Fix | Delete
function et_pb_is_pagebuilder_used( $page_id = 0 ) {
[4061] Fix | Delete
if ( 0 === $page_id ) {
[4062] Fix | Delete
$page_id = et_core_page_resource_get_the_ID();
[4063] Fix | Delete
}
[4064] Fix | Delete
[4065] Fix | Delete
return (
[4066] Fix | Delete
'on' === get_post_meta( $page_id, '_et_pb_use_builder', true ) ||
[4067] Fix | Delete
// Divi layout post type always use the builder
[4068] Fix | Delete
'et_pb_layout' === get_post_type( $page_id ) ||
[4069] Fix | Delete
// Extra Category post type always use the builder
[4070] Fix | Delete
'layout' === get_post_type( $page_id )
[4071] Fix | Delete
);
[4072] Fix | Delete
}
[4073] Fix | Delete
endif;
[4074] Fix | Delete
[4075] Fix | Delete
if ( ! function_exists( 'et_fb_is_enabled' ) ) :
[4076] Fix | Delete
/**
[4077] Fix | Delete
* @internal NOTE: Don't use this from outside builder code! {@see et_core_is_fb_enabled()}.
[4078] Fix | Delete
*
[4079] Fix | Delete
* @return bool
[4080] Fix | Delete
*/
[4081] Fix | Delete
function et_fb_is_enabled( $post_id = false ) {
[4082] Fix | Delete
// Cache results since the function could end up being called thousands of times.
[4083] Fix | Delete
static $cache = array();
[4084] Fix | Delete
[4085] Fix | Delete
if ( ! $post_id ) {
[4086] Fix | Delete
global $post;
[4087] Fix | Delete
[4088] Fix | Delete
$post_id = isset( $post->ID ) ? $post->ID : false;
[4089] Fix | Delete
}
[4090] Fix | Delete
[4091] Fix | Delete
$check = apply_filters( 'et_fb_is_enabled', null, $post_id );
[4092] Fix | Delete
[4093] Fix | Delete
if ( null !== $check ) {
[4094] Fix | Delete
return $check;
[4095] Fix | Delete
}
[4096] Fix | Delete
[4097] Fix | Delete
if ( ! $post_id ) {
[4098] Fix | Delete
return false;
[4099] Fix | Delete
}
[4100] Fix | Delete
[4101] Fix | Delete
if ( isset( $cache[ $post_id ] ) ) {
[4102] Fix | Delete
return $cache[ $post_id ];
[4103] Fix | Delete
}
[4104] Fix | Delete
[4105] Fix | Delete
$cache[ $post_id ] = false;
[4106] Fix | Delete
[4107] Fix | Delete
if ( ! is_singular() ) {
[4108] Fix | Delete
return false;
[4109] Fix | Delete
}
[4110] Fix | Delete
[4111] Fix | Delete
if ( is_admin() ) {
[4112] Fix | Delete
return false;
[4113] Fix | Delete
}
[4114] Fix | Delete
[4115] Fix | Delete
if ( is_customize_preview() ) {
[4116] Fix | Delete
return false;
[4117] Fix | Delete
}
[4118] Fix | Delete
[4119] Fix | Delete
if ( empty( $_GET['et_fb'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
[4120] Fix | Delete
return false;
[4121] Fix | Delete
}
[4122] Fix | Delete
[4123] Fix | Delete
if ( ! current_user_can( 'edit_posts' ) ) {
[4124] Fix | Delete
return false;
[4125] Fix | Delete
}
[4126] Fix | Delete
[4127] Fix | Delete
if ( ! et_pb_is_pagebuilder_used( $post_id ) ) {
[4128] Fix | Delete
return false;
[4129] Fix | Delete
}
[4130] Fix | Delete
[4131] Fix | Delete
if ( ! et_pb_is_allowed( 'use_visual_builder' ) ) {
[4132] Fix | Delete
return false;
[4133] Fix | Delete
}
[4134] Fix | Delete
[4135] Fix | Delete
$cache[ $post_id ] = true;
[4136] Fix | Delete
[4137] Fix | Delete
return true;
[4138] Fix | Delete
}
[4139] Fix | Delete
endif;
[4140] Fix | Delete
[4141] Fix | Delete
if ( ! function_exists( 'et_fb_is_builder_ajax' ) ) :
[4142] Fix | Delete
/**
[4143] Fix | Delete
* Returns whether current request is a builder AJAX call.
[4144] Fix | Delete
*
[4145] Fix | Delete
* @return bool
[4146] Fix | Delete
*/
[4147] Fix | Delete
function et_fb_is_builder_ajax() {
[4148] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
[4149] Fix | Delete
if ( ! wp_doing_ajax() || empty( $_REQUEST['action'] ) ) {
[4150] Fix | Delete
return false;
[4151] Fix | Delete
}
[4152] Fix | Delete
// phpcs:enable
[4153] Fix | Delete
[4154] Fix | Delete
return in_array(
[4155] Fix | Delete
$_REQUEST['action'],
[4156] Fix | Delete
array(
[4157] Fix | Delete
'et_fb_update_builder_assets',
[4158] Fix | Delete
'et_fb_retrieve_builder_data',
[4159] Fix | Delete
)
[4160] Fix | Delete
);
[4161] Fix | Delete
}
[4162] Fix | Delete
endif;
[4163] Fix | Delete
[4164] Fix | Delete
if ( ! function_exists( 'et_fb_is_computed_callback_ajax' ) ) :
[4165] Fix | Delete
/**
[4166] Fix | Delete
* Returns whether current request is computed callback AJAX call
[4167] Fix | Delete
*
[4168] Fix | Delete
* @return bool
[4169] Fix | Delete
*/
[4170] Fix | Delete
function et_fb_is_computed_callback_ajax() {
[4171] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
[4172] Fix | Delete
if ( ! wp_doing_ajax() || empty( $_REQUEST['action'] ) ) {
[4173] Fix | Delete
return false;
[4174] Fix | Delete
}
[4175] Fix | Delete
// phpcs:enable
[4176] Fix | Delete
[4177] Fix | Delete
return 'et_pb_process_computed_property' === $_REQUEST['action'];
[4178] Fix | Delete
}
[4179] Fix | Delete
endif;
[4180] Fix | Delete
[4181] Fix | Delete
if ( ! function_exists( 'et_fb_is_resolve_post_content_callback_ajax' ) ) :
[4182] Fix | Delete
/**
[4183] Fix | Delete
* Returns whether current request is resolve post content callback AJAX call
[4184] Fix | Delete
*
[4185] Fix | Delete
* @return bool
[4186] Fix | Delete
*/
[4187] Fix | Delete
function et_fb_is_resolve_post_content_callback_ajax() {
[4188] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
[4189] Fix | Delete
if ( ! wp_doing_ajax() || empty( $_REQUEST['action'] ) ) {
[4190] Fix | Delete
return false;
[4191] Fix | Delete
}
[4192] Fix | Delete
// phpcs:enable
[4193] Fix | Delete
[4194] Fix | Delete
return 'et_builder_resolve_post_content' === $_REQUEST['action'];
[4195] Fix | Delete
}
[4196] Fix | Delete
endif;
[4197] Fix | Delete
[4198] Fix | Delete
[4199] Fix | Delete
if ( ! function_exists( 'et_fb_auto_activate_builder' ) ) :
[4200] Fix | Delete
function et_fb_auto_activate_builder() {
[4201] Fix | Delete
$post_id = get_the_ID();
[4202] Fix | Delete
[4203] Fix | Delete
if (
[4204] Fix | Delete
! is_admin() &&
[4205] Fix | Delete
$post_id &&
[4206] Fix | Delete
current_user_can( 'edit_post', $post_id ) &&
[4207] Fix | Delete
isset( $_GET['et_fb_activation_nonce'] ) &&
[4208] Fix | Delete
wp_verify_nonce( $_GET['et_fb_activation_nonce' ], 'et_fb_activation_nonce_' . get_the_ID() )
[4209] Fix | Delete
) {
[4210] Fix | Delete
$set_content = et_builder_set_content_activation( $post_id );
[4211] Fix | Delete
$post_url = get_permalink( $post_id );
[4212] Fix | Delete
$redirect_url = $set_content ? et_fb_get_vb_url( $post_url ) : $post_url;
[4213] Fix | Delete
[4214] Fix | Delete
wp_redirect( $redirect_url );
[4215] Fix | Delete
exit();
[4216] Fix | Delete
}
[4217] Fix | Delete
}
[4218] Fix | Delete
endif;
[4219] Fix | Delete
add_action( 'template_redirect', 'et_fb_auto_activate_builder' );
[4220] Fix | Delete
[4221] Fix | Delete
/**
[4222] Fix | Delete
* Enable the VB for a post.
[4223] Fix | Delete
*
[4224] Fix | Delete
* @since 4.0
[4225] Fix | Delete
*
[4226] Fix | Delete
* @param integer $post_id
[4227] Fix | Delete
* @param bool $show_page_creation
[4228] Fix | Delete
*
[4229] Fix | Delete
* @return bool Success.
[4230] Fix | Delete
*/
[4231] Fix | Delete
function et_builder_enable_for_post( $post_id, $show_page_creation = true ) {
[4232] Fix | Delete
$_post = get_post( $post_id );
[4233] Fix | Delete
[4234] Fix | Delete
if ( ! $post_id || ! $_post || ! is_object( $_post ) ) {
[4235] Fix | Delete
return false;
[4236] Fix | Delete
}
[4237] Fix | Delete
[4238] Fix | Delete
$activate_builder = update_post_meta( $post_id, '_et_pb_use_builder', 'on' );
[4239] Fix | Delete
[4240] Fix | Delete
if ( false === $activate_builder ) {
[4241] Fix | Delete
return false;
[4242] Fix | Delete
}
[4243] Fix | Delete
[4244] Fix | Delete
update_post_meta( $post_id, '_et_pb_show_page_creation', $show_page_creation ? 'on' : 'off' );
[4245] Fix | Delete
[4246] Fix | Delete
return true;
[4247] Fix | Delete
}
[4248] Fix | Delete
[4249] Fix | Delete
function et_builder_set_content_activation( $post_id = false ) {
[4250] Fix | Delete
$_post = get_post( $post_id );
[4251] Fix | Delete
[4252] Fix | Delete
if ( ! $post_id || ! $_post || ! is_object( $_post ) ) {
[4253] Fix | Delete
return false;
[4254] Fix | Delete
}
[4255] Fix | Delete
[4256] Fix | Delete
$activate_builder = et_builder_enable_for_post( $post_id );
[4257] Fix | Delete
[4258] Fix | Delete
if ( false === $activate_builder ) {
[4259] Fix | Delete
return false;
[4260] Fix | Delete
}
[4261] Fix | Delete
[4262] Fix | Delete
// If content already has a section (not as divi/layout block attribute), it means builder is
[4263] Fix | Delete
// active and activation has to be skipped to avoid nested and unwanted builder structure
[4264] Fix | Delete
if ( ! has_block( 'divi/layout', $post_id ) && has_shortcode( $_post->post_content, 'et_pb_section' ) ) {
[4265] Fix | Delete
return true;
[4266] Fix | Delete
}
[4267] Fix | Delete
[4268] Fix | Delete
// `update_post_meta()`'s saved value is run through `stripslashes()` which makes encoded
[4269] Fix | Delete
// shortcode on layout block's `layoutContent` attributes looses its slashes when being saved.
[4270] Fix | Delete
// To fix this, If saved content has layout block, add one more slash using `wp_slash()`.
[4271] Fix | Delete
// NOTE:`$new_old_content` parameter is meant to be used as `update_post_meta()` parameter only
[4272] Fix | Delete
// {@see https://codex.wordpress.org/Function_Reference/update_post_meta#Character_Escaping}
[4273] Fix | Delete
$content_has_layout_block = has_block( 'divi/layout', $_post->post_content );
[4274] Fix | Delete
$new_old_content = $_post->post_content;
[4275] Fix | Delete
[4276] Fix | Delete
// Save old content
[4277] Fix | Delete
$saved_old_content = get_post_meta( $post_id, '_et_pb_old_content', true );
[4278] Fix | Delete
$save_old_content = update_post_meta( $post_id, '_et_pb_old_content', $new_old_content );
[4279] Fix | Delete
[4280] Fix | Delete
/**
[4281] Fix | Delete
* Filters the flag that sets default Content during Builder activation.
[4282] Fix | Delete
*
[4283] Fix | Delete
* @since 3.29
[4284] Fix | Delete
*
[4285] Fix | Delete
*
[4286] Fix | Delete
* @param bool $is_skip_content_activation TRUE skips the content activation.
[4287] Fix | Delete
* @param WP_Post $_post The Post.
[4288] Fix | Delete
*
[4289] Fix | Delete
* @used-by et_builder_wc_init()
[4290] Fix | Delete
*/
[4291] Fix | Delete
if ( apply_filters( 'et_builder_skip_content_activation', false, $_post ) ) {
[4292] Fix | Delete
return true;
[4293] Fix | Delete
}
[4294] Fix | Delete
[4295] Fix | Delete
if ( false === $save_old_content && $saved_old_content !== $_post->post_content && '' !== $_post->post_content ) {
[4296] Fix | Delete
return false;
[4297] Fix | Delete
}
[4298] Fix | Delete
[4299] Fix | Delete
$text_module = '' !== $_post->post_content ? '[et_pb_text admin_label="Text"]'. $_post->post_content .'[/et_pb_text]' : '';
[4300] Fix | Delete
[4301] Fix | Delete
if ( has_block( 'divi/layout', $post_id ) ) {
[4302] Fix | Delete
$updated_content = et_builder_convert_block_to_shortcode( $_post->post_content );
[4303] Fix | Delete
} else {
[4304] Fix | Delete
// Re-format content
[4305] Fix | Delete
$updated_content = '[et_pb_section admin_label="section"]
[4306] Fix | Delete
[et_pb_row admin_label="row"]
[4307] Fix | Delete
[et_pb_column type="4_4"]'. $text_module .'[/et_pb_column]
[4308] Fix | Delete
[/et_pb_row]
[4309] Fix | Delete
[/et_pb_section]';
[4310] Fix | Delete
}
[4311] Fix | Delete
[4312] Fix | Delete
// Update post_content
[4313] Fix | Delete
$_post->post_content = $updated_content;
[4314] Fix | Delete
[4315] Fix | Delete
// Update post
[4316] Fix | Delete
$update_post = wp_update_post( $_post );
[4317] Fix | Delete
[4318] Fix | Delete
if ( 0 < $update_post ) {
[4319] Fix | Delete
setup_postdata( $_post );
[4320] Fix | Delete
}
[4321] Fix | Delete
[4322] Fix | Delete
return 0 < $update_post;
[4323] Fix | Delete
}
[4324] Fix | Delete
[4325] Fix | Delete
if ( ! function_exists( 'et_builder_get_font_family' ) ) :
[4326] Fix | Delete
function et_builder_get_font_family( $font_name, $use_important = false ) {
[4327] Fix | Delete
$user_fonts = et_builder_get_custom_fonts();
[4328] Fix | Delete
$fonts = isset( $user_fonts[ $font_name ] ) ? $user_fonts : et_builder_get_fonts();
[4329] Fix | Delete
$removed_fonts_mapping = et_builder_old_fonts_mapping();
[4330] Fix | Delete
[4331] Fix | Delete
$font_style = $font_weight = '';
[4332] Fix | Delete
[4333] Fix | Delete
$font_name_ms = isset( $fonts[ $font_name ] ) && isset( $fonts[ $font_name ]['add_ms_version'] ) ? "'{$font_name} MS', " : "";
[4334] Fix | Delete
[4335] Fix | Delete
if ( isset( $removed_fonts_mapping[ $font_name ] ) && isset( $removed_fonts_mapping[ $font_name ]['parent_font'] ) ) {
[4336] Fix | Delete
$font_style = $removed_fonts_mapping[ $font_name ]['styles'];
[4337] Fix | Delete
$font_name = $removed_fonts_mapping[ $font_name ]['parent_font'];
[4338] Fix | Delete
}
[4339] Fix | Delete
[4340] Fix | Delete
if ( '' !== $font_style ) {
[4341] Fix | Delete
$font_weight = sprintf( ' font-weight: %1$s;', esc_html( $font_style ) );
[4342] Fix | Delete
}
[4343] Fix | Delete
[4344] Fix | Delete
$style = sprintf( 'font-family: \'%1$s\', %5$s%2$s%3$s;%4$s',
[4345] Fix | Delete
esc_html( $font_name ),
[4346] Fix | Delete
isset( $fonts[ $font_name ] ) ? et_builder_get_websafe_font_stack( $fonts[ $font_name ]['type'] ) : 'sans-serif',
[4347] Fix | Delete
( $use_important ? ' !important' : '' ),
[4348] Fix | Delete
$font_weight,
[4349] Fix | Delete
$font_name_ms
[4350] Fix | Delete
);
[4351] Fix | Delete
[4352] Fix | Delete
return $style;
[4353] Fix | Delete
}
[4354] Fix | Delete
endif;
[4355] Fix | Delete
[4356] Fix | Delete
if ( ! function_exists( 'et_builder_get_fonts' ) ) :
[4357] Fix | Delete
function et_builder_get_fonts( $settings = array() ) {
[4358] Fix | Delete
// Only return websafe fonts if google fonts disabled
[4359] Fix | Delete
if ( ! et_core_use_google_fonts() ) {
[4360] Fix | Delete
return et_builder_get_websafe_fonts();
[4361] Fix | Delete
}
[4362] Fix | Delete
[4363] Fix | Delete
$defaults = array(
[4364] Fix | Delete
'prepend_standard_fonts' => true,
[4365] Fix | Delete
);
[4366] Fix | Delete
[4367] Fix | Delete
$settings = wp_parse_args( $settings, $defaults );
[4368] Fix | Delete
[4369] Fix | Delete
$fonts = $settings['prepend_standard_fonts']
[4370] Fix | Delete
? array_merge( et_builder_get_websafe_fonts(), et_builder_get_google_fonts() )
[4371] Fix | Delete
: array_merge( et_builder_get_google_fonts(), et_builder_get_websafe_fonts() );
[4372] Fix | Delete
[4373] Fix | Delete
ksort( $fonts );
[4374] Fix | Delete
[4375] Fix | Delete
return $fonts;
[4376] Fix | Delete
}
[4377] Fix | Delete
endif;
[4378] Fix | Delete
[4379] Fix | Delete
if ( ! function_exists( 'et_builder_get_websafe_font_stack' ) ) :
[4380] Fix | Delete
function et_builder_get_websafe_font_stack( $type = 'sans-serif' ) {
[4381] Fix | Delete
$font_stack = $type;
[4382] Fix | Delete
[4383] Fix | Delete
switch ( $type ) {
[4384] Fix | Delete
case 'sans-serif':
[4385] Fix | Delete
$font_stack = 'Helvetica, Arial, Lucida, sans-serif';
[4386] Fix | Delete
break;
[4387] Fix | Delete
case 'serif':
[4388] Fix | Delete
$font_stack = 'Georgia, "Times New Roman", serif';
[4389] Fix | Delete
break;
[4390] Fix | Delete
case 'cursive':
[4391] Fix | Delete
$font_stack = 'cursive';
[4392] Fix | Delete
break;
[4393] Fix | Delete
}
[4394] Fix | Delete
[4395] Fix | Delete
return $font_stack;
[4396] Fix | Delete
}
[4397] Fix | Delete
endif;
[4398] Fix | Delete
[4399] Fix | Delete
if ( ! function_exists( 'et_builder_get_websafe_fonts' ) ) :
[4400] Fix | Delete
function et_builder_get_websafe_fonts() {
[4401] Fix | Delete
return et_core_get_websafe_fonts();
[4402] Fix | Delete
}
[4403] Fix | Delete
endif;
[4404] Fix | Delete
[4405] Fix | Delete
if ( ! function_exists( 'et_builder_get_font_weight_list' ) ) :
[4406] Fix | Delete
function et_builder_get_font_weight_list() {
[4407] Fix | Delete
$default_font_weights_list = array(
[4408] Fix | Delete
'100' => esc_html__( 'Thin', 'et_builder' ),
[4409] Fix | Delete
'200' => esc_html__( 'Ultra Light', 'et_builder' ),
[4410] Fix | Delete
'300' => et_builder_i18n( 'Light' ),
[4411] Fix | Delete
'400' => esc_html__( 'Regular', 'et_builder' ),
[4412] Fix | Delete
'500' => esc_html__( 'Medium', 'et_builder' ),
[4413] Fix | Delete
'600' => esc_html__( 'Semi Bold', 'et_builder' ),
[4414] Fix | Delete
'700' => esc_html__( 'Bold', 'et_builder' ),
[4415] Fix | Delete
'800' => esc_html__( 'Ultra Bold', 'et_builder' ),
[4416] Fix | Delete
'900' => esc_html__( 'Heavy', 'et_builder' ),
[4417] Fix | Delete
);
[4418] Fix | Delete
[4419] Fix | Delete
return apply_filters( 'et_builder_all_font_weights', $default_font_weights_list );
[4420] Fix | Delete
}
[4421] Fix | Delete
endif;
[4422] Fix | Delete
[4423] Fix | Delete
/**
[4424] Fix | Delete
* Retrieve list of uploaded user fonts stored in `et_uploaded_fonts` option.
[4425] Fix | Delete
*
[4426] Fix | Delete
* @since 3.0
[4427] Fix | Delete
*
[4428] Fix | Delete
* @return array fonts list
[4429] Fix | Delete
*/
[4430] Fix | Delete
if ( ! function_exists( 'et_builder_get_custom_fonts' ) ) :
[4431] Fix | Delete
function et_builder_get_custom_fonts() {
[4432] Fix | Delete
$all_custom_fonts = get_option( 'et_uploaded_fonts', array() );
[4433] Fix | Delete
[4434] Fix | Delete
// Convert any falsey value to empty array to avoid PHP errors.
[4435] Fix | Delete
if ( ! is_array( $all_custom_fonts ) ) {
[4436] Fix | Delete
$all_custom_fonts = array();
[4437] Fix | Delete
}
[4438] Fix | Delete
[4439] Fix | Delete
return ( array ) apply_filters( 'et_builder_custom_fonts', $all_custom_fonts );
[4440] Fix | Delete
}
[4441] Fix | Delete
endif;
[4442] Fix | Delete
[4443] Fix | Delete
function et_builder_old_fonts_mapping() {
[4444] Fix | Delete
return array(
[4445] Fix | Delete
'Raleway Light' => array(
[4446] Fix | Delete
'parent_font' => 'Raleway',
[4447] Fix | Delete
'styles' => '300',
[4448] Fix | Delete
),
[4449] Fix | Delete
'Roboto Light' => array(
[4450] Fix | Delete
'parent_font' => 'Roboto',
[4451] Fix | Delete
'styles' => '100',
[4452] Fix | Delete
),
[4453] Fix | Delete
'Source Sans Pro Light' => array(
[4454] Fix | Delete
'parent_font' => 'Source Sans Pro',
[4455] Fix | Delete
'styles' => '300',
[4456] Fix | Delete
),
[4457] Fix | Delete
'Lato Light' => array(
[4458] Fix | Delete
'parent_font' => 'Lato',
[4459] Fix | Delete
'styles' => '300',
[4460] Fix | Delete
),
[4461] Fix | Delete
'Open Sans Light' => array(
[4462] Fix | Delete
'parent_font' => 'Open Sans',
[4463] Fix | Delete
'styles' => '300',
[4464] Fix | Delete
),
[4465] Fix | Delete
);
[4466] Fix | Delete
}
[4467] Fix | Delete
[4468] Fix | Delete
if ( ! function_exists( 'et_builder_google_fonts_sync' ) ) :
[4469] Fix | Delete
function et_builder_google_fonts_sync() {
[4470] Fix | Delete
$google_api_key = et_pb_get_google_api_key();
[4471] Fix | Delete
[4472] Fix | Delete
if ( '' === $google_api_key || ! et_core_use_google_fonts() ) {
[4473] Fix | Delete
return;
[4474] Fix | Delete
}
[4475] Fix | Delete
[4476] Fix | Delete
$google_fonts_api_url = sprintf( 'https://www.googleapis.com/webfonts/v1/webfonts?key=%1$s', $google_api_key );
[4477] Fix | Delete
$google_fonts_response = wp_remote_get( esc_url_raw( $google_fonts_api_url ) );
[4478] Fix | Delete
[4479] Fix | Delete
$google_fonts = is_array( $google_fonts_response ) ? et_core_parse_google_fonts_json( wp_remote_retrieve_body( $google_fonts_response ) ) : array();
[4480] Fix | Delete
[4481] Fix | Delete
if ( ! empty( $google_fonts ) ) {
[4482] Fix | Delete
// save google fonts
[4483] Fix | Delete
update_option( 'et_google_fonts_cache', $google_fonts );
[4484] Fix | Delete
// save google fonts cache status
[4485] Fix | Delete
set_transient( 'fonts_cache_status', 'valid', 12 * HOUR_IN_SECONDS );
[4486] Fix | Delete
}
[4487] Fix | Delete
}
[4488] Fix | Delete
endif;
[4489] Fix | Delete
[4490] Fix | Delete
if ( ! function_exists( 'et_builder_get_google_fonts' ) ) :
[4491] Fix | Delete
function et_builder_get_google_fonts() {
[4492] Fix | Delete
// Google Fonts disabled
[4493] Fix | Delete
if ( ! et_core_use_google_fonts() ) {
[4494] Fix | Delete
return array();
[4495] Fix | Delete
}
[4496] Fix | Delete
[4497] Fix | Delete
// Update fonts cache daily.
[4498] Fix | Delete
if ( 'valid' !== get_transient( 'fonts_cache_status' ) ) {
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function