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: functions.php
$wrap_post_id = $main_post_id;
[3000] Fix | Delete
}
[3001] Fix | Delete
}
[3002] Fix | Delete
[3003] 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 ) );
[3004] Fix | Delete
[3005] Fix | Delete
if ( $wrap_selector ) {
[3006] Fix | Delete
$selector_prefix = ' ' . ET_BUILDER_CSS_PREFIX . $selector_prefix;
[3007] Fix | Delete
}
[3008] Fix | Delete
[3009] Fix | Delete
$output = get_post_meta( $page_id, '_et_pb_custom_css', true );
[3010] Fix | Delete
[3011] Fix | Delete
if ( isset( $page_settings['et_pb_light_text_color'] ) ) {
[3012] Fix | Delete
$output .= sprintf(
[3013] Fix | Delete
'%2$s .et_pb_bg_layout_dark { color: %1$s !important; }',
[3014] Fix | Delete
esc_html( $page_settings['et_pb_light_text_color'] ),
[3015] Fix | Delete
esc_html( $selector_prefix )
[3016] Fix | Delete
);
[3017] Fix | Delete
}
[3018] Fix | Delete
[3019] Fix | Delete
if ( isset( $page_settings['et_pb_dark_text_color'] ) ) {
[3020] Fix | Delete
$output .= sprintf(
[3021] Fix | Delete
'%2$s .et_pb_bg_layout_light { color: %1$s !important; }',
[3022] Fix | Delete
esc_html( $page_settings['et_pb_dark_text_color'] ),
[3023] Fix | Delete
esc_html( $selector_prefix )
[3024] Fix | Delete
);
[3025] Fix | Delete
}
[3026] Fix | Delete
[3027] Fix | Delete
if ( isset( $page_settings['et_pb_content_area_background_color'] ) ) {
[3028] Fix | Delete
$content_area_bg_selector = et_is_builder_plugin_active() ? $selector_prefix : ' .page.et_pb_pagebuilder_layout #main-content';
[3029] Fix | Delete
$output .= sprintf(
[3030] Fix | Delete
'%1$s { background-color: %2$s; }',
[3031] Fix | Delete
esc_html( $content_area_bg_selector ),
[3032] Fix | Delete
esc_html( $page_settings['et_pb_content_area_background_color'] )
[3033] Fix | Delete
);
[3034] Fix | Delete
}
[3035] Fix | Delete
[3036] Fix | Delete
if ( isset( $page_settings['et_pb_section_background_color'] ) ) {
[3037] Fix | Delete
$output .= sprintf(
[3038] Fix | Delete
'%2$s > .et_builder_inner_content > .et_pb_section { background-color: %1$s; }',
[3039] Fix | Delete
esc_html( $page_settings['et_pb_section_background_color'] ),
[3040] Fix | Delete
esc_html( $selector_prefix )
[3041] Fix | Delete
);
[3042] Fix | Delete
}
[3043] Fix | Delete
[3044] Fix | Delete
$overflow_x = $overflow->get_value_x( $page_settings, '', 'et_pb_' );
[3045] Fix | Delete
$overflow_y = $overflow->get_value_y( $page_settings, '', 'et_pb_' );
[3046] Fix | Delete
[3047] Fix | Delete
if ( ! empty( $overflow_x ) ) {
[3048] Fix | Delete
$output .= sprintf(
[3049] Fix | Delete
'%2$s .et_builder_inner_content { overflow-x: %1$s; }',
[3050] Fix | Delete
esc_html( $overflow_x ),
[3051] Fix | Delete
esc_html( $selector_prefix )
[3052] Fix | Delete
);
[3053] Fix | Delete
}
[3054] Fix | Delete
[3055] Fix | Delete
if ( ! empty( $overflow_y ) ) {
[3056] Fix | Delete
$output .= sprintf(
[3057] Fix | Delete
'%2$s .et_builder_inner_content { overflow-y: %1$s; }',
[3058] Fix | Delete
esc_html( $overflow_y ),
[3059] Fix | Delete
esc_html( $selector_prefix )
[3060] Fix | Delete
);
[3061] Fix | Delete
}
[3062] Fix | Delete
[3063] Fix | Delete
if ( isset( $page_settings['et_pb_page_z_index'] ) && '' !== $page_settings['et_pb_page_z_index'] ) {
[3064] Fix | Delete
$output .= sprintf(
[3065] Fix | Delete
'%2$s .et_builder_inner_content { z-index: %1$s; }',
[3066] Fix | Delete
esc_html( $page_settings['et_pb_page_z_index'] ),
[3067] Fix | Delete
esc_html( '.et-db #et-boc .et-l' . $selector_prefix )
[3068] Fix | Delete
);
[3069] Fix | Delete
}
[3070] Fix | Delete
[3071] Fix | Delete
return apply_filters( 'et_pb_page_custom_css', $output );
[3072] Fix | Delete
}
[3073] Fix | Delete
endif;
[3074] Fix | Delete
[3075] Fix | Delete
if ( ! function_exists( 'et_pb_video_oembed_data_parse' ) ) :
[3076] Fix | Delete
function et_pb_video_oembed_data_parse( $return, $data, $url ) {
[3077] Fix | Delete
if ( isset( $data->thumbnail_url ) ) {
[3078] Fix | Delete
return esc_url( str_replace( array('https://', 'http://'), '//', $data->thumbnail_url ), array('http') );
[3079] Fix | Delete
} else {
[3080] Fix | Delete
return false;
[3081] Fix | Delete
}
[3082] Fix | Delete
}
[3083] Fix | Delete
endif;
[3084] Fix | Delete
[3085] Fix | Delete
if ( ! function_exists( 'et_pb_check_oembed_provider' ) ):
[3086] Fix | Delete
function et_pb_check_oembed_provider( $url ) {
[3087] Fix | Delete
if ( version_compare( $GLOBALS['wp_version'], '5.3', '<' ) ) {
[3088] Fix | Delete
require_once( ABSPATH . WPINC . '/class-oembed.php' );
[3089] Fix | Delete
} else {
[3090] Fix | Delete
require_once( ABSPATH . WPINC . '/class-wp-oembed.php' );
[3091] Fix | Delete
}
[3092] Fix | Delete
[3093] Fix | Delete
$oembed = _wp_oembed_get_object();
[3094] Fix | Delete
[3095] Fix | Delete
return $oembed->get_provider( esc_url( $url ), array( 'discover' => false ) );
[3096] Fix | Delete
}
[3097] Fix | Delete
endif;
[3098] Fix | Delete
[3099] Fix | Delete
/**
[3100] Fix | Delete
* Get cached embedded item on page load.
[3101] Fix | Delete
*
[3102] Fix | Delete
* Use the item source as the key, so some modules with the same item can share it.
[3103] Fix | Delete
*
[3104] Fix | Delete
* @since 4.5.2
[3105] Fix | Delete
*
[3106] Fix | Delete
* @param string $url Item URL
[3107] Fix | Delete
* @param string $group Item group to set different cache for the same key
[3108] Fix | Delete
* @param boolean $is_cache Whether to use WordPress Object Cache or not
[3109] Fix | Delete
* @return string
[3110] Fix | Delete
*/
[3111] Fix | Delete
if ( ! function_exists( 'et_builder_get_oembed' ) ) :
[3112] Fix | Delete
function et_builder_get_oembed( $url, $group = 'video', $is_cache = true ) {
[3113] Fix | Delete
$item_src = esc_url( $url );
[3114] Fix | Delete
[3115] Fix | Delete
// Temporarily save embedded item on page load only. Use the item source as the
[3116] Fix | Delete
// key, so some modules with the same item can share it.
[3117] Fix | Delete
$item_embed = $is_cache ? wp_cache_get( $item_src, $group ) : false;
[3118] Fix | Delete
[3119] Fix | Delete
if ( ! $item_embed ) {
[3120] Fix | Delete
$item_embed = wp_oembed_get( $item_src );
[3121] Fix | Delete
[3122] Fix | Delete
if ( $is_cache ) {
[3123] Fix | Delete
wp_cache_set( $item_src, $item_embed, $group );
[3124] Fix | Delete
}
[3125] Fix | Delete
}
[3126] Fix | Delete
[3127] Fix | Delete
return apply_filters( 'et_builder_get_oembed', $item_embed, $url, $group, $is_cache );
[3128] Fix | Delete
}
[3129] Fix | Delete
endif;
[3130] Fix | Delete
[3131] Fix | Delete
if ( ! function_exists( 'et_pb_set_video_oembed_thumbnail_resolution' ) ) :
[3132] Fix | Delete
function et_pb_set_video_oembed_thumbnail_resolution( $image_src, $resolution = 'default' ) {
[3133] Fix | Delete
// Replace YouTube video thumbnails to high resolution if the high resolution image exists.
[3134] Fix | Delete
if ( 'high' === $resolution && false !== strpos( $image_src, 'hqdefault.jpg' ) ) {
[3135] Fix | Delete
$high_res_image_src = str_replace( 'hqdefault.jpg', 'maxresdefault.jpg', $image_src );
[3136] Fix | Delete
$protocol = is_ssl() ? 'https://' : 'http://';
[3137] Fix | Delete
$processed_image_url = esc_url( str_replace( '//', $protocol, $high_res_image_src ), array('http', 'https') );
[3138] Fix | Delete
$response = wp_remote_get( $processed_image_url, array( 'timeout' => 30 ) );
[3139] Fix | Delete
[3140] Fix | Delete
// Youtube doesn't guarantee that high res image exists for any video, so we need to check whether it exists and fallback to default image in case of error
[3141] Fix | Delete
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
[3142] Fix | Delete
return $image_src;
[3143] Fix | Delete
}
[3144] Fix | Delete
[3145] Fix | Delete
return $high_res_image_src;
[3146] Fix | Delete
}
[3147] Fix | Delete
[3148] Fix | Delete
return $image_src;
[3149] Fix | Delete
}
[3150] Fix | Delete
endif;
[3151] Fix | Delete
[3152] Fix | Delete
function et_builder_get_widget_areas_list() {
[3153] Fix | Delete
global $wp_registered_sidebars;
[3154] Fix | Delete
[3155] Fix | Delete
$widget_areas = array();
[3156] Fix | Delete
[3157] Fix | Delete
foreach ( $wp_registered_sidebars as $sidebar_key => $sidebar ) {
[3158] Fix | Delete
$widget_areas[ $sidebar_key ] = array(
[3159] Fix | Delete
'name' => $sidebar[ 'name' ]
[3160] Fix | Delete
);
[3161] Fix | Delete
}
[3162] Fix | Delete
[3163] Fix | Delete
return apply_filters( 'et_builder_get_widget_areas_list', $widget_areas );
[3164] Fix | Delete
}
[3165] Fix | Delete
[3166] Fix | Delete
if ( ! function_exists( 'et_builder_get_widget_areas' ) ) :
[3167] Fix | Delete
function et_builder_get_widget_areas() {
[3168] Fix | Delete
$wp_registered_sidebars = et_builder_get_widget_areas_list();
[3169] Fix | Delete
$et_pb_widgets = get_theme_mod( 'et_pb_widgets' );
[3170] Fix | Delete
[3171] Fix | Delete
$output = '<select name="et_pb_area" id="et_pb_area">';
[3172] Fix | Delete
[3173] Fix | Delete
foreach ( $wp_registered_sidebars as $id => $options ) {
[3174] Fix | Delete
$selected = sprintf(
[3175] Fix | Delete
'<%%= typeof( et_pb_area ) !== "undefined" && "%1$s" === et_pb_area ? " selected=\'selected\'" : "" %%>',
[3176] Fix | Delete
esc_html( $id )
[3177] Fix | Delete
);
[3178] Fix | Delete
[3179] Fix | Delete
$output .= sprintf(
[3180] Fix | Delete
'<option value="%1$s"%2$s>%3$s</option>',
[3181] Fix | Delete
esc_attr( $id ),
[3182] Fix | Delete
$selected,
[3183] Fix | Delete
esc_html( $options['name'] )
[3184] Fix | Delete
);
[3185] Fix | Delete
}
[3186] Fix | Delete
[3187] Fix | Delete
$output .= '</select>';
[3188] Fix | Delete
[3189] Fix | Delete
return $output;
[3190] Fix | Delete
}
[3191] Fix | Delete
endif;
[3192] Fix | Delete
[3193] Fix | Delete
if ( ! function_exists( 'et_pb_export_layouts_interface' ) ) :
[3194] Fix | Delete
function et_pb_export_layouts_interface() {
[3195] Fix | Delete
if ( ! current_user_can( 'export' ) )
[3196] Fix | Delete
wp_die( esc_html__( 'You do not have sufficient permissions to export the content of this site.', 'et_builder' ) );
[3197] Fix | Delete
[3198] Fix | Delete
?>
[3199] Fix | Delete
<a href="<?php echo et_core_esc_wp( admin_url( 'edit-tags.php?taxonomy=layout_category' ) ); ?>" id="et_load_category_page"><?php esc_html_e( 'Manage Categories', 'et_builder' ); ?></a>
[3200] Fix | Delete
<?php
[3201] Fix | Delete
echo et_core_esc_previously( et_builder_portability_link( 'et_builder_layouts', array( 'class' => 'et-pb-portability-button' ) ) );
[3202] Fix | Delete
}
[3203] Fix | Delete
endif;
[3204] Fix | Delete
[3205] Fix | Delete
add_action( 'export_wp', 'et_pb_edit_export_query' );
[3206] Fix | Delete
function et_pb_edit_export_query() {
[3207] Fix | Delete
add_filter( 'query', 'et_pb_edit_export_query_filter' );
[3208] Fix | Delete
}
[3209] Fix | Delete
[3210] Fix | Delete
function et_pb_edit_export_query_filter( $query ) {
[3211] Fix | Delete
// Apply filter only once
[3212] Fix | Delete
remove_filter( 'query', 'et_pb_edit_export_query_filter') ;
[3213] Fix | Delete
[3214] Fix | Delete
et_core_nonce_verified_previously();
[3215] Fix | Delete
[3216] Fix | Delete
// ensure user can export
[3217] Fix | Delete
if ( ! current_user_can( 'export' ) ) {
[3218] Fix | Delete
return $query;
[3219] Fix | Delete
}
[3220] Fix | Delete
[3221] Fix | Delete
global $wpdb;
[3222] Fix | Delete
[3223] Fix | Delete
$content = ! empty( $_GET['content'] ) ? sanitize_text_field( $_GET['content'] ) : '';
[3224] Fix | Delete
[3225] Fix | Delete
if ( ET_BUILDER_LAYOUT_POST_TYPE !== $content ) {
[3226] Fix | Delete
return $query;
[3227] Fix | Delete
}
[3228] Fix | Delete
[3229] Fix | Delete
$sql = '';
[3230] Fix | Delete
$i = 0;
[3231] Fix | Delete
$possible_types = array(
[3232] Fix | Delete
'layout',
[3233] Fix | Delete
'section',
[3234] Fix | Delete
'row',
[3235] Fix | Delete
'module',
[3236] Fix | Delete
'fullwidth_section',
[3237] Fix | Delete
'specialty_section',
[3238] Fix | Delete
'fullwidth_module',
[3239] Fix | Delete
);
[3240] Fix | Delete
[3241] Fix | Delete
foreach ( $possible_types as $template_type ) {
[3242] Fix | Delete
$selected_type = 'et_pb_template_' . $template_type;
[3243] Fix | Delete
[3244] Fix | Delete
if ( isset( $_GET[ $selected_type ] ) ) {
[3245] Fix | Delete
if ( 0 === $i ) {
[3246] Fix | Delete
$sql = " AND ( `{$wpdb->term_relationships}`.term_taxonomy_id = %d";
[3247] Fix | Delete
} else {
[3248] Fix | Delete
$sql .= " OR `{$wpdb->term_relationships}`.term_taxonomy_id = %d";
[3249] Fix | Delete
}
[3250] Fix | Delete
[3251] Fix | Delete
$sql_args[] = (int) $_GET[ $selected_type ];
[3252] Fix | Delete
[3253] Fix | Delete
$i++;
[3254] Fix | Delete
}
[3255] Fix | Delete
}
[3256] Fix | Delete
[3257] Fix | Delete
if ( '' !== $sql ) {
[3258] Fix | Delete
$sql .= ' )';
[3259] Fix | Delete
$sql = sprintf(
[3260] Fix | Delete
'SELECT ID FROM %4$s
[3261] Fix | Delete
INNER JOIN %3$s ON ( %4$s.ID = %3$s.object_id )
[3262] Fix | Delete
WHERE %4$s.post_type = "%1$s"
[3263] Fix | Delete
AND %4$s.post_status != "auto-draft"
[3264] Fix | Delete
%2$s',
[3265] Fix | Delete
ET_BUILDER_LAYOUT_POST_TYPE,
[3266] Fix | Delete
$sql,
[3267] Fix | Delete
$wpdb->term_relationships,
[3268] Fix | Delete
$wpdb->posts
[3269] Fix | Delete
);
[3270] Fix | Delete
$query = $wpdb->prepare( $sql, $sql_args ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- value of $sql was safely prepared above.
[3271] Fix | Delete
}
[3272] Fix | Delete
[3273] Fix | Delete
return $query;
[3274] Fix | Delete
}
[3275] Fix | Delete
[3276] Fix | Delete
function et_pb_setup_theme(){
[3277] Fix | Delete
add_action( 'add_meta_boxes', 'et_pb_add_custom_box', 10, 2 );
[3278] Fix | Delete
add_action( 'add_meta_boxes', 'et_builder_prioritize_meta_box', 999999 );
[3279] Fix | Delete
add_filter( 'hidden_meta_boxes', 'et_pb_hidden_meta_boxes');
[3280] Fix | Delete
}
[3281] Fix | Delete
add_action( 'init', 'et_pb_setup_theme', 11 );
[3282] Fix | Delete
[3283] Fix | Delete
/**
[3284] Fix | Delete
* Override metaboxes order to ensure Divi Builder metabox has top position.
[3285] Fix | Delete
*
[3286] Fix | Delete
* @since 3.17.3
[3287] Fix | Delete
*
[3288] Fix | Delete
* @param string $value Custom value.
[3289] Fix | Delete
*
[3290] Fix | Delete
* @return string
[3291] Fix | Delete
*/
[3292] Fix | Delete
function et_builder_override_meta_boxes_order( $value ) {
[3293] Fix | Delete
static $custom = false;
[3294] Fix | Delete
[3295] Fix | Delete
// Store the value on the first call;
[3296] Fix | Delete
$custom = false === $custom ? $value : $custom;
[3297] Fix | Delete
[3298] Fix | Delete
return $custom;
[3299] Fix | Delete
}
[3300] Fix | Delete
[3301] Fix | Delete
/**
[3302] Fix | Delete
* Forcefully prioritize the Divi Builder metabox to be at the top.
[3303] Fix | Delete
* User drag&drop metabox order customizations are still supported.
[3304] Fix | Delete
* Required since not all plugins properly register their metaboxes in the add_meta_boxes hook.
[3305] Fix | Delete
*
[3306] Fix | Delete
* @since 3.17.2
[3307] Fix | Delete
*
[3308] Fix | Delete
* @return void
[3309] Fix | Delete
*/
[3310] Fix | Delete
function et_builder_prioritize_meta_box() {
[3311] Fix | Delete
global $wp_meta_boxes;
[3312] Fix | Delete
[3313] Fix | Delete
$screen = get_current_screen();
[3314] Fix | Delete
[3315] Fix | Delete
// Only prioritize Divi Builder metabox if current post type has Divi Builder enabled
[3316] Fix | Delete
if ( ! in_array( $screen->post_type, et_builder_get_enabled_builder_post_types() ) ) {
[3317] Fix | Delete
return;
[3318] Fix | Delete
}
[3319] Fix | Delete
[3320] Fix | Delete
// Get custom order
[3321] Fix | Delete
$page = $screen->id;
[3322] Fix | Delete
$option_name = "meta-box-order_$page";
[3323] Fix | Delete
$custom = get_user_option( $option_name );
[3324] Fix | Delete
[3325] Fix | Delete
foreach ( $wp_meta_boxes as $page => $contexts ) {
[3326] Fix | Delete
foreach ( $contexts as $context => $priorities ) {
[3327] Fix | Delete
foreach ( $priorities as $priority => $boxes ) {
[3328] Fix | Delete
if ( ! isset( $boxes[ ET_BUILDER_LAYOUT_POST_TYPE ] ) ) {
[3329] Fix | Delete
continue;
[3330] Fix | Delete
}
[3331] Fix | Delete
[3332] Fix | Delete
$divi = $boxes[ ET_BUILDER_LAYOUT_POST_TYPE ];
[3333] Fix | Delete
[3334] Fix | Delete
unset( $boxes[ ET_BUILDER_LAYOUT_POST_TYPE ] );
[3335] Fix | Delete
[3336] Fix | Delete
$wp_meta_boxes[ $page ][ $context ][ $priority ] = array_merge( array( ET_BUILDER_LAYOUT_POST_TYPE => $divi ), $boxes );
[3337] Fix | Delete
[3338] Fix | Delete
// If our mbox is the first one in custom ordering
[3339] Fix | Delete
if ( is_array( $custom ) && 0 === strpos( $custom[ $context ], ET_BUILDER_LAYOUT_POST_TYPE ) ) {
[3340] Fix | Delete
// Find all metaboxes that are not included in custom order
[3341] Fix | Delete
$sorted = explode( ',', $custom[ $context ] );
[3342] Fix | Delete
$add = array_diff( array_keys( $boxes ), $sorted );
[3343] Fix | Delete
[3344] Fix | Delete
if ( $add ) {
[3345] Fix | Delete
// Add them after Divi
[3346] Fix | Delete
$custom[ $context ] = implode( ',', array_merge( array( ET_BUILDER_LAYOUT_POST_TYPE ), $add, array_slice( $sorted, 1 ) ) );
[3347] Fix | Delete
[3348] Fix | Delete
// Store the custom value
[3349] Fix | Delete
et_builder_override_meta_boxes_order( $custom );
[3350] Fix | Delete
// and override `get_user_option` so WP will use it.
[3351] Fix | Delete
add_filter( "get_user_option_{$option_name}", 'et_builder_override_meta_boxes_order' );
[3352] Fix | Delete
}
[3353] Fix | Delete
}
[3354] Fix | Delete
}
[3355] Fix | Delete
}
[3356] Fix | Delete
}
[3357] Fix | Delete
}
[3358] Fix | Delete
[3359] Fix | Delete
/**
[3360] Fix | Delete
* The page builders require the WP Heartbeat script in order to function. We ensure the heartbeat
[3361] Fix | Delete
* is loaded with the page builders by scheduling this callback to run right before scripts
[3362] Fix | Delete
* are output to the footer. {@see 'admin_enqueue_scripts', 'wp_footer'}
[3363] Fix | Delete
*/
[3364] Fix | Delete
function et_builder_maybe_ensure_heartbeat_script() {
[3365] Fix | Delete
// Don't perform any actions on 'wp_footer' if VB is not active
[3366] Fix | Delete
if ( 'wp_footer' === current_filter() && empty( $_GET['et_fb'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
[3367] Fix | Delete
return;
[3368] Fix | Delete
}
[3369] Fix | Delete
[3370] Fix | Delete
// We have to check both 'registered' AND 'enqueued' to cover cases where heartbeat has been
[3371] Fix | Delete
// de-registered because 'enqueued' will return `true` for a de-registered script at this stage.
[3372] Fix | Delete
$heartbeat_okay = wp_script_is( 'heartbeat', 'registered' ) && wp_script_is( 'heartbeat', 'enqueued' );
[3373] Fix | Delete
$autosave_okay = wp_script_is( 'autosave', 'registered' ) && wp_script_is( 'autosave', 'enqueued' );
[3374] Fix | Delete
[3375] Fix | Delete
if ( '1' === et_()->array_get( $_GET, 'et_bfb', '0' ) ) {
[3376] Fix | Delete
// Do not enqueue WP autosave in the BFB iframe because it doesn't include #content / #excerpt / #title
[3377] Fix | Delete
// and will result in empty (browser) backups (note: still included in top window)
[3378] Fix | Delete
$autosave_okay = true;
[3379] Fix | Delete
[3380] Fix | Delete
wp_dequeue_script( 'autosave' );
[3381] Fix | Delete
}
[3382] Fix | Delete
[3383] Fix | Delete
if ( $heartbeat_okay && $autosave_okay ) {
[3384] Fix | Delete
return;
[3385] Fix | Delete
}
[3386] Fix | Delete
[3387] Fix | Delete
$suffix = SCRIPT_DEBUG ? '' : '.min';
[3388] Fix | Delete
[3389] Fix | Delete
if ( ! $heartbeat_okay ) {
[3390] Fix | Delete
$heartbeat_src = "/wp-includes/js/heartbeat{$suffix}.js";
[3391] Fix | Delete
// wp-hooks was introduced in WP 5.0
[3392] Fix | Delete
$deps = wp_script_is( 'wp-hooks', 'registered' ) ? array( 'jquery', 'wp-hooks' ) : array( 'jquery' );
[3393] Fix | Delete
wp_enqueue_script( 'heartbeat', $heartbeat_src, $deps, false, true );
[3394] Fix | Delete
wp_localize_script( 'heartbeat', 'heartbeatSettings', apply_filters( 'heartbeat_settings', array() ) );
[3395] Fix | Delete
}
[3396] Fix | Delete
[3397] Fix | Delete
if ( ! $autosave_okay ) {
[3398] Fix | Delete
$autosave_src = "/wp-includes/js/autosave{$suffix}.js";
[3399] Fix | Delete
wp_enqueue_script( 'autosave', $autosave_src, array( 'heartbeat' ), false, true );
[3400] Fix | Delete
}
[3401] Fix | Delete
}
[3402] Fix | Delete
[3403] Fix | Delete
// Enqueue dashicons in front-end if they are not enqueued (that happens when not logged in as admin)
[3404] Fix | Delete
function et_builder_maybe_enqueue_dashicons() {
[3405] Fix | Delete
if ( wp_style_is( 'dashicons' ) ) {
[3406] Fix | Delete
return;
[3407] Fix | Delete
}
[3408] Fix | Delete
[3409] Fix | Delete
wp_enqueue_style( 'dashicons' );
[3410] Fix | Delete
}
[3411] Fix | Delete
add_action( 'admin_print_scripts-post-new.php', 'et_builder_maybe_ensure_heartbeat_script', 9 );
[3412] Fix | Delete
add_action( 'admin_print_scripts-post.php', 'et_builder_maybe_ensure_heartbeat_script', 9 );
[3413] Fix | Delete
add_action( 'wp_enqueue_scripts', 'et_builder_maybe_enqueue_dashicons', 19 );
[3414] Fix | Delete
add_action( 'wp_footer', 'et_builder_maybe_ensure_heartbeat_script', 19 );
[3415] Fix | Delete
[3416] Fix | Delete
function et_builder_set_post_type( $post_type = '' ) {
[3417] Fix | Delete
global $et_builder_post_type, $post;
[3418] Fix | Delete
[3419] Fix | Delete
$et_builder_post_type = ! empty( $post_type ) ? $post_type : $post->post_type;
[3420] Fix | Delete
}
[3421] Fix | Delete
[3422] Fix | Delete
/**
[3423] Fix | Delete
* Saves Metabox settings.
[3424] Fix | Delete
*
[3425] Fix | Delete
* @since 3.29.2 Included check to verify if constant exists before use.
[3426] Fix | Delete
* Throws error otherwise from PHP7.2.x
[3427] Fix | Delete
*
[3428] Fix | Delete
* @param int $post_id
[3429] Fix | Delete
* @param WP_Post $post
[3430] Fix | Delete
*/
[3431] Fix | Delete
function et_pb_metabox_settings_save_details( $post_id, $post ){
[3432] Fix | Delete
global $pagenow;
[3433] Fix | Delete
[3434] Fix | Delete
if ( 'post.php' !== $pagenow ) return $post_id;
[3435] Fix | Delete
[3436] Fix | Delete
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
[3437] Fix | Delete
return $post_id;
[3438] Fix | Delete
}
[3439] Fix | Delete
[3440] Fix | Delete
// do not update builder post meta when Preview is loading.
[3441] Fix | Delete
if ( isset( $_POST['wp-preview'] ) && 'dopreview' === $_POST['wp-preview'] ) {
[3442] Fix | Delete
return $post_id;
[3443] Fix | Delete
}
[3444] Fix | Delete
[3445] Fix | Delete
$post_type = get_post_type_object( $post->post_type );
[3446] Fix | Delete
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) )
[3447] Fix | Delete
return $post_id;
[3448] Fix | Delete
[3449] Fix | Delete
if ( ! isset( $_POST['et_pb_settings_nonce'] ) || ! wp_verify_nonce( $_POST['et_pb_settings_nonce'], basename( __FILE__ ) ) )
[3450] Fix | Delete
return $post_id;
[3451] Fix | Delete
[3452] Fix | Delete
[3453] Fix | Delete
if ( isset( $_POST['et_pb_use_builder'] ) ) {
[3454] Fix | Delete
$et_pb_use_builder_input = sanitize_text_field( $_POST['et_pb_use_builder'] );
[3455] Fix | Delete
[3456] Fix | Delete
update_post_meta( $post_id, '_et_pb_use_builder', $et_pb_use_builder_input );
[3457] Fix | Delete
[3458] Fix | Delete
if ( ! empty( $_POST['et_builder_version'] ) ) {
[3459] Fix | Delete
update_post_meta( $post_id, '_et_builder_version', sanitize_text_field( $_POST['et_builder_version'] ) );
[3460] Fix | Delete
}
[3461] Fix | Delete
[3462] Fix | Delete
$et_pb_show_page_creation_input = isset( $_POST['et_pb_show_page_creation'] ) ? sanitize_text_field( $_POST['et_pb_show_page_creation'] ) : false;
[3463] Fix | Delete
[3464] Fix | Delete
if ( 'on' === $et_pb_show_page_creation_input ) {
[3465] Fix | Delete
// Set page creation flow to on.
[3466] Fix | Delete
update_post_meta( $post_id, '_et_pb_show_page_creation', 'on' );
[3467] Fix | Delete
} elseif ( 'off' === $et_pb_show_page_creation_input ) {
[3468] Fix | Delete
// Delete page creation flow.
[3469] Fix | Delete
delete_post_meta( $post_id, '_et_pb_show_page_creation' );
[3470] Fix | Delete
} elseif ( false === $et_pb_show_page_creation_input && 'on' === $et_pb_use_builder_input ) {
[3471] Fix | Delete
$et_pb_show_page_creation_meta = get_post_meta( $post_id, '_et_pb_show_page_creation', true );
[3472] Fix | Delete
[3473] Fix | Delete
// Strip non-printable characters.
[3474] Fix | Delete
$post_content_cleaned = preg_replace('/[\x00-\x1F\x7F]/u', '', $post->post_content);
[3475] Fix | Delete
[3476] Fix | Delete
preg_match_all( '/\[et_pb_section(.*?)?\]\[et_pb_row(.*?)?\]\[et_pb_column(.*?)?\](.+?)\[\/et_pb_column\]\[\/et_pb_row\]\[\/et_pb_section\]/m', $post_content_cleaned, $matches );
[3477] Fix | Delete
if ( isset( $matches[4] ) && ! empty( $matches[4] ) ) {
[3478] Fix | Delete
if ( 'on' === $et_pb_show_page_creation_meta ) {
[3479] Fix | Delete
// Set page creation flow to on.
[3480] Fix | Delete
update_post_meta( $post_id, '_et_pb_show_page_creation', 'off' );
[3481] Fix | Delete
}
[3482] Fix | Delete
} else {
[3483] Fix | Delete
delete_post_meta( $post_id, '_et_pb_show_page_creation' );
[3484] Fix | Delete
}
[3485] Fix | Delete
}
[3486] Fix | Delete
[3487] Fix | Delete
if ( 'on' !== $et_pb_use_builder_input ) {
[3488] Fix | Delete
if ( defined( 'ET_BUILDER_WC_PRODUCT_PAGE_CONTENT_STATUS_META_KEY' ) ) {
[3489] Fix | Delete
delete_post_meta( $post_id, ET_BUILDER_WC_PRODUCT_PAGE_CONTENT_STATUS_META_KEY );
[3490] Fix | Delete
}
[3491] Fix | Delete
}
[3492] Fix | Delete
} else {
[3493] Fix | Delete
delete_post_meta( $post_id, '_et_pb_use_builder' );
[3494] Fix | Delete
delete_post_meta( $post_id, '_et_builder_version' );
[3495] Fix | Delete
if ( defined( 'ET_BUILDER_WC_PRODUCT_PAGE_CONTENT_STATUS_META_KEY' ) ) {
[3496] Fix | Delete
delete_post_meta( $post_id, ET_BUILDER_WC_PRODUCT_PAGE_CONTENT_STATUS_META_KEY );
[3497] Fix | Delete
}
[3498] Fix | Delete
}
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function