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: framework.php
* Get list of concatenated & minified styles (sans style.css)
[500] Fix | Delete
* @return array
[501] Fix | Delete
*/
[502] Fix | Delete
function et_builder_get_minified_styles() {
[503] Fix | Delete
$minified_styles = array(
[504] Fix | Delete
'et-shortcodes-css',
[505] Fix | Delete
'et-shortcodes-responsive-css',
[506] Fix | Delete
'et-animations',
[507] Fix | Delete
'magnific-popup',
[508] Fix | Delete
);
[509] Fix | Delete
[510] Fix | Delete
return apply_filters( 'et_builder_get_minified_styles', $minified_styles );
[511] Fix | Delete
}
[512] Fix | Delete
[513] Fix | Delete
/**
[514] Fix | Delete
* Re-enqueue listed concatenated & minified scripts (and their possible alternative name) used empty string
[515] Fix | Delete
* to keep its dependency in order but avoiding WordPress to print the script to avoid the same file printed twice
[516] Fix | Delete
* Case in point: salvattore that is being called via builder module's render() method
[517] Fix | Delete
* @return void
[518] Fix | Delete
*/
[519] Fix | Delete
function et_builder_dequeue_minified_scripts() {
[520] Fix | Delete
if ( ! et_load_unminified_scripts() && ! is_admin() ) {
[521] Fix | Delete
[522] Fix | Delete
/**
[523] Fix | Delete
* Builder script handle name
[524] Fix | Delete
*
[525] Fix | Delete
* @since 3.??
[526] Fix | Delete
*
[527] Fix | Delete
* @param string
[528] Fix | Delete
*/
[529] Fix | Delete
$builder_script_handle = apply_filters( 'et_builder_modules_script_handle', 'et-builder-modules-script' );
[530] Fix | Delete
[531] Fix | Delete
foreach ( et_builder_get_minified_scripts() as $script ) {
[532] Fix | Delete
// Get script's localized data before the script is dequeued
[533] Fix | Delete
$script_data = wp_scripts()->get_data( $script, 'data' );
[534] Fix | Delete
[535] Fix | Delete
// If to-be dequeued script has localized data, get builder script's data and concatenated both to ensure compatibility
[536] Fix | Delete
// Concatenating is needed because script's localize data is saved as string (encoded array concatenated into variable name)
[537] Fix | Delete
if ( $script_data && '' !== trim( $script_data ) ) {
[538] Fix | Delete
[539] Fix | Delete
// If builder script handle localized data returns false/empty, $script_data still need to be added
[540] Fix | Delete
$concatenated_scripts_data = implode( ' ', array_filter( array(
[541] Fix | Delete
wp_scripts()->get_data( $builder_script_handle, 'data' ),
[542] Fix | Delete
$script_data,
[543] Fix | Delete
) ) );
[544] Fix | Delete
[545] Fix | Delete
// Add concatenated localized data to builder script handle
[546] Fix | Delete
wp_scripts()->add_data( $builder_script_handle, 'data', $concatenated_scripts_data );
[547] Fix | Delete
}
[548] Fix | Delete
[549] Fix | Delete
// If dequeued script has inline script, get it then re-add it to builder script handle using appropriate position
[550] Fix | Delete
$inline_script_positions = array( 'before', 'after' );
[551] Fix | Delete
foreach ( $inline_script_positions as $inline_script_position ) {
[552] Fix | Delete
$inline_script = wp_scripts()->get_data( $script, $inline_script_position );
[553] Fix | Delete
[554] Fix | Delete
// Inline script is saved as array. add_inline_script() method will handle it appending process
[555] Fix | Delete
if ( is_array( $inline_script ) && ! empty( $inline_script ) ) {
[556] Fix | Delete
wp_scripts()->add_inline_script( $builder_script_handle, implode( ' ', $inline_script ), $inline_script_position );
[557] Fix | Delete
}
[558] Fix | Delete
}
[559] Fix | Delete
[560] Fix | Delete
wp_dequeue_script( $script );
[561] Fix | Delete
wp_deregister_script( $script );
[562] Fix | Delete
wp_register_script( $script, '', array(), ET_BUILDER_VERSION, true );
[563] Fix | Delete
}
[564] Fix | Delete
}
[565] Fix | Delete
}
[566] Fix | Delete
add_action( 'wp_print_scripts', 'et_builder_dequeue_minified_scripts', 99999999 ); // <head>
[567] Fix | Delete
add_action( 'wp_print_footer_scripts', 'et_builder_dequeue_minified_scripts', 9 ); // <footer>
[568] Fix | Delete
[569] Fix | Delete
function et_builder_dequeue_minifieds_styles() {
[570] Fix | Delete
if ( ! et_load_unminified_styles() && ! is_admin() ) {
[571] Fix | Delete
// Get builder minified + combined style handle
[572] Fix | Delete
$builder_optimized_style_name = apply_filters( 'et_builder_optimized_style_handle', '' );
[573] Fix | Delete
[574] Fix | Delete
foreach ( et_builder_get_minified_styles() as $style ) {
[575] Fix | Delete
// If dequeued style has inline style, get it then re-add it to minified + combiled style handle
[576] Fix | Delete
// Inline style only has 'after' position
[577] Fix | Delete
$inline_style = wp_styles()->get_data( $style, 'after' );
[578] Fix | Delete
[579] Fix | Delete
// Inline style is saved as array. add_inline_style() method will handle it appending process
[580] Fix | Delete
if ( is_array( $inline_style ) && ! empty( $inline_style ) ) {
[581] Fix | Delete
wp_styles()->add_inline_style( $builder_optimized_style_name, implode( ' ', $inline_style ), 'after' );
[582] Fix | Delete
}
[583] Fix | Delete
[584] Fix | Delete
wp_dequeue_style( $style );
[585] Fix | Delete
wp_deregister_style( $style );
[586] Fix | Delete
wp_register_style( $style, '', array(), ET_BUILDER_VERSION );
[587] Fix | Delete
}
[588] Fix | Delete
} else {
[589] Fix | Delete
// Child theme might manually enqueues parent themes' style.css. When combine + minify CSS file is enabled, this isn't an issue.
[590] Fix | Delete
// However, when combine + minify CSS is disabled, child theme should load style.dev.css (source) instead of style.css (minified).
[591] Fix | Delete
// Child theme might not considering this, which causes minified file + other source files are printed. To fix it, deregister any
[592] Fix | Delete
// style handle that contains parent theme's style.css URL, then re-queue new one with the same name handle + URL to parent theme's style.dev.css
[593] Fix | Delete
// This should be done in theme only. Divi-Builder plugin doesn't need this.
[594] Fix | Delete
if ( ! et_is_builder_plugin_active() && is_child_theme() ) {
[595] Fix | Delete
$template_directory_uri = preg_quote( get_template_directory_uri(), '/' );
[596] Fix | Delete
$optimized_style_src = '/^(' . $template_directory_uri . '\/style)(-cpt)?(\.css)$/';
[597] Fix | Delete
$unoptimized_style_src = '$1$2.dev$3';
[598] Fix | Delete
[599] Fix | Delete
et_core_replace_enqueued_style( $optimized_style_src, $unoptimized_style_src, true );
[600] Fix | Delete
}
[601] Fix | Delete
}
[602] Fix | Delete
}
[603] Fix | Delete
add_action( 'wp_print_styles', 'et_builder_dequeue_minifieds_styles', 99999999 ); // <head>
[604] Fix | Delete
[605] Fix | Delete
/**
[606] Fix | Delete
* Determine whether current theme supports Waypoints or not
[607] Fix | Delete
* @return bool
[608] Fix | Delete
*/
[609] Fix | Delete
function et_is_ignore_waypoints() {
[610] Fix | Delete
// WPBakery Visual Composer plugin conflicts with waypoints
[611] Fix | Delete
if ( class_exists( 'Vc_Manager' ) ) {
[612] Fix | Delete
return true;
[613] Fix | Delete
}
[614] Fix | Delete
[615] Fix | Delete
// always return false if not in divi plugin
[616] Fix | Delete
if ( ! et_is_builder_plugin_active() ) {
[617] Fix | Delete
return false;
[618] Fix | Delete
}
[619] Fix | Delete
[620] Fix | Delete
$theme_data = wp_get_theme();
[621] Fix | Delete
[622] Fix | Delete
if ( empty( $theme_data ) ) {
[623] Fix | Delete
return false;
[624] Fix | Delete
}
[625] Fix | Delete
[626] Fix | Delete
// list of themes without Waypoints support
[627] Fix | Delete
$no_waypoints_themes = apply_filters( 'et_pb_no_waypoints_themes', array(
[628] Fix | Delete
'Avada'
[629] Fix | Delete
) );
[630] Fix | Delete
[631] Fix | Delete
// return true if current theme doesn't support Waypoints
[632] Fix | Delete
if ( in_array( $theme_data->Name, $no_waypoints_themes, true ) ) {
[633] Fix | Delete
return true;
[634] Fix | Delete
}
[635] Fix | Delete
[636] Fix | Delete
return false;
[637] Fix | Delete
}
[638] Fix | Delete
[639] Fix | Delete
/**
[640] Fix | Delete
* Determine whether current page has enqueued theme's style.css or not
[641] Fix | Delete
* This is mainly used on preview screen to decide to enqueue theme's style nor not
[642] Fix | Delete
* @return bool
[643] Fix | Delete
*/
[644] Fix | Delete
function et_builder_has_theme_style_enqueued() {
[645] Fix | Delete
global $wp_styles;
[646] Fix | Delete
[647] Fix | Delete
if ( ! empty( $wp_styles->queue ) ) {
[648] Fix | Delete
$theme_style_uri = get_stylesheet_uri();
[649] Fix | Delete
[650] Fix | Delete
foreach ( $wp_styles->queue as $handle) {
[651] Fix | Delete
if ( isset( $wp_styles->registered[$handle]->src ) && $theme_style_uri === $wp_styles->registered[$handle]->src ) {
[652] Fix | Delete
return true;
[653] Fix | Delete
}
[654] Fix | Delete
}
[655] Fix | Delete
}
[656] Fix | Delete
[657] Fix | Delete
return false;
[658] Fix | Delete
}
[659] Fix | Delete
[660] Fix | Delete
/**
[661] Fix | Delete
* Added specific body classes for builder related situation
[662] Fix | Delete
* This enables theme to adjust its case independently
[663] Fix | Delete
* @return array
[664] Fix | Delete
*/
[665] Fix | Delete
function et_builder_body_classes( $classes ) {
[666] Fix | Delete
if ( is_et_pb_preview() ) {
[667] Fix | Delete
$classes[] = 'et-pb-preview';
[668] Fix | Delete
}
[669] Fix | Delete
[670] Fix | Delete
// Minified JS identifier class name
[671] Fix | Delete
if ( ! et_load_unminified_scripts() ) {
[672] Fix | Delete
$classes[] = 'et_minified_js';
[673] Fix | Delete
}
[674] Fix | Delete
[675] Fix | Delete
// Minified CSS identifier class name
[676] Fix | Delete
if ( ! et_load_unminified_styles() ) {
[677] Fix | Delete
$classes[] = 'et_minified_css';
[678] Fix | Delete
}
[679] Fix | Delete
[680] Fix | Delete
$post_id = et_core_page_resource_get_the_ID();
[681] Fix | Delete
$post_type = get_post_type( $post_id );
[682] Fix | Delete
[683] Fix | Delete
// Add layout classes when on library page
[684] Fix | Delete
if ( et_core_is_fb_enabled() && 'et_pb_layout' === $post_type ) {
[685] Fix | Delete
$layout_type = et_fb_get_layout_type( $post_id );
[686] Fix | Delete
$layout_scope = et_fb_get_layout_term_slug( $post_id, 'scope' );
[687] Fix | Delete
[688] Fix | Delete
$classes[] = "et_pb_library_page-${layout_type}";
[689] Fix | Delete
$classes[] = "et_pb_library_page-${layout_scope}";
[690] Fix | Delete
}
[691] Fix | Delete
[692] Fix | Delete
return $classes;
[693] Fix | Delete
}
[694] Fix | Delete
add_filter( 'body_class', 'et_builder_body_classes' );
[695] Fix | Delete
[696] Fix | Delete
if ( ! function_exists( 'et_builder_add_main_elements' ) ) :
[697] Fix | Delete
function et_builder_add_main_elements() {
[698] Fix | Delete
if ( ET_BUILDER_CACHE_MODULES ) {
[699] Fix | Delete
ET_Builder_Element::init_cache();
[700] Fix | Delete
}
[701] Fix | Delete
require_once ET_BUILDER_DIR . 'main-structure-elements.php';
[702] Fix | Delete
require_once ET_BUILDER_DIR . 'main-modules.php';
[703] Fix | Delete
do_action( 'et_builder_ready' );
[704] Fix | Delete
}
[705] Fix | Delete
endif;
[706] Fix | Delete
[707] Fix | Delete
if ( ! function_exists( 'et_builder_load_framework' ) ) :
[708] Fix | Delete
function et_builder_load_framework() {
[709] Fix | Delete
[710] Fix | Delete
require_once ET_BUILDER_DIR . 'functions.php';
[711] Fix | Delete
require_once ET_BUILDER_DIR . 'compat/woocommerce.php';
[712] Fix | Delete
require_once ET_BUILDER_DIR . 'class-et-global-settings.php';
[713] Fix | Delete
require_once ET_BUILDER_DIR . 'feature/BlockEditorIntegration.php';
[714] Fix | Delete
[715] Fix | Delete
if ( is_admin() ) {
[716] Fix | Delete
global $pagenow, $et_current_memory_limit;
[717] Fix | Delete
[718] Fix | Delete
if ( ! empty( $pagenow ) && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
[719] Fix | Delete
$et_current_memory_limit = et_core_get_memory_limit();
[720] Fix | Delete
}
[721] Fix | Delete
}
[722] Fix | Delete
[723] Fix | Delete
/**
[724] Fix | Delete
* Filters builder modules loading hook. Load builder files on front-end and on specific admin pages only by default.
[725] Fix | Delete
*
[726] Fix | Delete
* @since 3.1
[727] Fix | Delete
*
[728] Fix | Delete
* @param string Hook name.
[729] Fix | Delete
*/
[730] Fix | Delete
$action_hook = apply_filters( 'et_builder_modules_load_hook', is_admin() ? 'wp_loaded' : 'wp' );
[731] Fix | Delete
[732] Fix | Delete
if ( et_builder_should_load_framework() ) {
[733] Fix | Delete
require_once ET_BUILDER_DIR . 'class-et-builder-value.php';
[734] Fix | Delete
require_once ET_BUILDER_DIR . 'class-et-builder-element.php';
[735] Fix | Delete
require_once ET_BUILDER_DIR . 'class-et-builder-plugin-compat-base.php';
[736] Fix | Delete
require_once ET_BUILDER_DIR . 'class-et-builder-plugin-compat-loader.php';
[737] Fix | Delete
require_once ET_BUILDER_DIR . 'ab-testing.php';
[738] Fix | Delete
require_once ET_BUILDER_DIR . 'class-et-builder-settings.php';
[739] Fix | Delete
[740] Fix | Delete
$builder_settings_loaded = true;
[741] Fix | Delete
[742] Fix | Delete
do_action( 'et_builder_framework_loaded' );
[743] Fix | Delete
[744] Fix | Delete
add_action( $action_hook, 'et_builder_init_global_settings', apply_filters( 'et_pb_load_global_settings_priority', 9 ) );
[745] Fix | Delete
add_action( $action_hook, 'et_builder_add_main_elements', apply_filters( 'et_pb_load_main_elements_priority', 10 ) );
[746] Fix | Delete
} else if ( is_admin() ) {
[747] Fix | Delete
require_once ET_BUILDER_DIR . 'class-et-builder-plugin-compat-base.php';
[748] Fix | Delete
require_once ET_BUILDER_DIR . 'class-et-builder-plugin-compat-loader.php';
[749] Fix | Delete
require_once ET_BUILDER_DIR . 'class-et-builder-settings.php';
[750] Fix | Delete
$builder_settings_loaded = true;
[751] Fix | Delete
}
[752] Fix | Delete
[753] Fix | Delete
if ( isset( $builder_settings_loaded ) ) {
[754] Fix | Delete
add_action( 'init', 'et_builder_settings_init', 100 );
[755] Fix | Delete
}
[756] Fix | Delete
[757] Fix | Delete
add_action( $action_hook, 'et_builder_load_frontend_builder' );
[758] Fix | Delete
[759] Fix | Delete
if ( isset( $_GET['et_bfb'] ) && is_user_logged_in() ) {
[760] Fix | Delete
add_filter( 'wpe_heartbeat_allowed_pages', 'et_bfb_wpe_heartbeat_allowed_pages' );
[761] Fix | Delete
}
[762] Fix | Delete
}
[763] Fix | Delete
endif;
[764] Fix | Delete
[765] Fix | Delete
/**
[766] Fix | Delete
* Checking whether current page is BFB page based on its query string only; Suitable for basic
[767] Fix | Delete
* early check BEFORE $wp_query global is generated in case builder need to alter query
[768] Fix | Delete
* configuration. This is needed because BFB layout is basically loaded in front-end
[769] Fix | Delete
*
[770] Fix | Delete
* @since 3.19.9
[771] Fix | Delete
*
[772] Fix | Delete
* @return bool
[773] Fix | Delete
*/
[774] Fix | Delete
function et_bfb_maybe_bfb_url() {
[775] Fix | Delete
$has_bfb_query_string = ! empty( $_GET['et_fb'] ) && ! empty( $_GET['et_bfb'] );
[776] Fix | Delete
$has_vb_permission = et_pb_is_allowed( 'use_visual_builder' );
[777] Fix | Delete
[778] Fix | Delete
// This check assumes that $wp_query isn't ready (to be used before query is parsed) so any
[779] Fix | Delete
// query based check such as is_single(), etc don't exist yet. Thus BFB URL might valid if:
[780] Fix | Delete
// 1. not admin page
[781] Fix | Delete
// 2. user has logged in
[782] Fix | Delete
// 3. has `et_fb` & `et_bfb` query string
[783] Fix | Delete
// 4. has visual builder permission
[784] Fix | Delete
return ! is_admin() && is_user_logged_in() && $has_bfb_query_string && $has_vb_permission;
[785] Fix | Delete
}
[786] Fix | Delete
[787] Fix | Delete
/**
[788] Fix | Delete
* Get verified query string value for et_bfb_make_post_type_queryable()
[789] Fix | Delete
*
[790] Fix | Delete
* @since 3.19.9
[791] Fix | Delete
*
[792] Fix | Delete
* @param string $param_name
[793] Fix | Delete
*
[794] Fix | Delete
* @return string|number|bool
[795] Fix | Delete
*/
[796] Fix | Delete
function et_bfb_get_make_queryable_param( $param_name ) {
[797] Fix | Delete
$param = isset( $_GET[ "et_{$param_name}" ] ) ? $_GET[ "et_{$param_name}" ] : false;
[798] Fix | Delete
$param_nonce = isset( $_GET[ "et_{$param_name}_nonce" ] ) ? $_GET[ "et_{$param_name}_nonce"] : false;
[799] Fix | Delete
$verified_param = $param && $param_nonce && wp_verify_nonce(
[800] Fix | Delete
$param_nonce,
[801] Fix | Delete
"et_{$param_name}_{$param}"
[802] Fix | Delete
);
[803] Fix | Delete
[804] Fix | Delete
return $verified_param ? $param : false;
[805] Fix | Delete
}
[806] Fix | Delete
[807] Fix | Delete
/**
[808] Fix | Delete
* Set builder's registered post type's publicly_queryable property to true (if needed) so publicly
[809] Fix | Delete
* hidden post type can render BFB page on backend edit screen
[810] Fix | Delete
*
[811] Fix | Delete
* @see WP->parse_request() on how request is parsed
[812] Fix | Delete
*
[813] Fix | Delete
* @since 3.19.9
[814] Fix | Delete
*
[815] Fix | Delete
* @return void
[816] Fix | Delete
*/
[817] Fix | Delete
function et_bfb_make_post_type_queryable() {
[818] Fix | Delete
// Valid query isn't available at this point so builder will guess whether current request is
[819] Fix | Delete
// BFB based on available value; Stop if this might not be BFB url
[820] Fix | Delete
if ( ! et_bfb_maybe_bfb_url() ) {
[821] Fix | Delete
return;
[822] Fix | Delete
}
[823] Fix | Delete
[824] Fix | Delete
$get_post_id = absint( et_bfb_get_make_queryable_param( 'post_id' ) );
[825] Fix | Delete
$get_post_type = sanitize_text_field( et_bfb_get_make_queryable_param( 'post_type' ) );
[826] Fix | Delete
[827] Fix | Delete
// Stop if no valid post id / post type for make queryable found on query string
[828] Fix | Delete
if ( ! $get_post_id || ! $get_post_type ) {
[829] Fix | Delete
return;
[830] Fix | Delete
}
[831] Fix | Delete
[832] Fix | Delete
$post_type_object = get_post_type_object( $get_post_type );
[833] Fix | Delete
[834] Fix | Delete
// Stop if requested post type doesn't exist
[835] Fix | Delete
if ( is_null( $post_type_object ) ) {
[836] Fix | Delete
return;
[837] Fix | Delete
}
[838] Fix | Delete
[839] Fix | Delete
$unqueryable_post_type = et_builder_get_third_party_unqueryable_post_types();
[840] Fix | Delete
$is_post_type_unqueryable = in_array( $get_post_type, $unqueryable_post_type );
[841] Fix | Delete
[842] Fix | Delete
// CPT's version of edit_post is always available on cap->edit_post regardless CPT's meta_map_cap
[843] Fix | Delete
// or capability_type setting are set or not. If meta_map_cap is set to true, WordPress
[844] Fix | Delete
// automatically translates it into edit_post. Otherwise, CPT version of edit_post is sent as
[845] Fix | Delete
// it is and it is plugin / post type registrant's responsibility to add the capability to role
[846] Fix | Delete
// and map it into primitive capabilities on map_meta_cap()
[847] Fix | Delete
$capability = isset( $post_type_object->cap->edit_post ) ? $post_type_object->cap->edit_post : 'edit_post';
[848] Fix | Delete
$can_edit_this_post = current_user_can( $capability, $get_post_id );
[849] Fix | Delete
[850] Fix | Delete
// Flip publicly_queryable of current request so BFB layout page can be rendered.
[851] Fix | Delete
// Note: post_type existence have been verified on is_null( $post_type_object ) check above
[852] Fix | Delete
if ( $is_post_type_unqueryable && $can_edit_this_post ) {
[853] Fix | Delete
global $wp_post_types;
[854] Fix | Delete
[855] Fix | Delete
$wp_post_types[ $get_post_type ]->publicly_queryable = true;
[856] Fix | Delete
}
[857] Fix | Delete
}
[858] Fix | Delete
add_action( 'init', 'et_bfb_make_post_type_queryable' );
[859] Fix | Delete
[860] Fix | Delete
/**
[861] Fix | Delete
* Modify rewrite rule's redirect of current BFB request if its post type's `publicly_queryable`
[862] Fix | Delete
* is set to false and its `query_var` is NOT set to `false`. When this situation happens, current
[863] Fix | Delete
* BFB page cannot be rendered because rewrite rule's redirect value doesn't have `post_type`
[864] Fix | Delete
* param which makes page query gets incorrect page value
[865] Fix | Delete
*
[866] Fix | Delete
* @since 3.19.9
[867] Fix | Delete
*
[868] Fix | Delete
* @return void
[869] Fix | Delete
*/
[870] Fix | Delete
function et_bfb_make_cpt_rewrite_rule_queryable( $value ) {
[871] Fix | Delete
// Get verified make queryable post_type param from query string
[872] Fix | Delete
$unqueryable_post_type = et_bfb_get_make_queryable_param( 'post_type' );
[873] Fix | Delete
[874] Fix | Delete
// Make sure that value is array, current request might be BFB, and verified post_type from
[875] Fix | Delete
// query string exist. Note: need to use early return otherwise the rest need multiple stack
[876] Fix | Delete
// if/else condition
[877] Fix | Delete
if ( ! is_array( $value ) || ! et_bfb_maybe_bfb_url() || ! $unqueryable_post_type ) {
[878] Fix | Delete
return $value;
[879] Fix | Delete
}
[880] Fix | Delete
[881] Fix | Delete
$rewrite_regex = $unqueryable_post_type . '/([^/]+)(?:/([0-9]+))?/?$';
[882] Fix | Delete
$rewrite_redirect = isset( $value[ $rewrite_regex ] ) ? $value[ $rewrite_regex ] : false;
[883] Fix | Delete
$has_post_type_substr = $rewrite_redirect && strpos( $rewrite_redirect, '?post_type=' ) !== false;
[884] Fix | Delete
$post_type_object = get_post_type_object( $unqueryable_post_type );
[885] Fix | Delete
[886] Fix | Delete
// If current page's post type object `query_var` isn't falsey and no `post_type=` substring is
[887] Fix | Delete
// found on current page's post type rewrite rule redirect value, modify the rewrite rule
[888] Fix | Delete
// redirect value so it can picks up current post type when query is parsed
[889] Fix | Delete
if ( $post_type_object->query_var && ! $has_post_type_substr ) {
[890] Fix | Delete
$value[ $rewrite_regex ] = 'index.php?post_type=' . $unqueryable_post_type . '&name=$matches[1]&page=$matches[2]';
[891] Fix | Delete
}
[892] Fix | Delete
[893] Fix | Delete
return $value;
[894] Fix | Delete
}
[895] Fix | Delete
add_filter( 'option_rewrite_rules', 'et_bfb_make_cpt_rewrite_rule_queryable' );
[896] Fix | Delete
[897] Fix | Delete
if ( ! function_exists( 'et_bfb_wpe_heartbeat_allowed_pages' ) ):
[898] Fix | Delete
function et_bfb_wpe_heartbeat_allowed_pages( $pages ) {
[899] Fix | Delete
global $pagenow;
[900] Fix | Delete
[901] Fix | Delete
$pages[] = $pagenow;
[902] Fix | Delete
[903] Fix | Delete
return $pages;
[904] Fix | Delete
}
[905] Fix | Delete
endif;
[906] Fix | Delete
[907] Fix | Delete
function et_builder_load_frontend_builder() {
[908] Fix | Delete
global $et_current_memory_limit;
[909] Fix | Delete
[910] Fix | Delete
$et_current_memory_limit = et_core_get_memory_limit();
[911] Fix | Delete
[912] Fix | Delete
if ( $et_current_memory_limit < 256 ) {
[913] Fix | Delete
@ini_set( 'memory_limit', '256M' );
[914] Fix | Delete
}
[915] Fix | Delete
[916] Fix | Delete
require_once ET_BUILDER_DIR . 'frontend-builder/init.php';
[917] Fix | Delete
}
[918] Fix | Delete
[919] Fix | Delete
if ( ! function_exists( 'et_pb_get_google_api_key' ) ) :
[920] Fix | Delete
function et_pb_get_google_api_key() {
[921] Fix | Delete
$google_api_option = get_option( 'et_google_api_settings' );
[922] Fix | Delete
$google_api_key = isset( $google_api_option['api_key'] ) ? $google_api_option['api_key'] : '';
[923] Fix | Delete
[924] Fix | Delete
return $google_api_key;
[925] Fix | Delete
}
[926] Fix | Delete
endif;
[927] Fix | Delete
[928] Fix | Delete
if ( ! function_exists( 'et_pb_enqueue_google_maps_script' ) ) :
[929] Fix | Delete
function et_pb_enqueue_google_maps_script() {
[930] Fix | Delete
$google_api_option = get_option( 'et_google_api_settings' );
[931] Fix | Delete
$google_maps_script_enqueue = !$google_api_option || !isset( $google_api_option['enqueue_google_maps_script'] ) || (isset( $google_api_option['enqueue_google_maps_script'] ) && 'on' === $google_api_option['enqueue_google_maps_script']) ? true : false;
[932] Fix | Delete
[933] Fix | Delete
return apply_filters(
[934] Fix | Delete
'et_pb_enqueue_google_maps_script',
[935] Fix | Delete
$google_maps_script_enqueue
[936] Fix | Delete
);
[937] Fix | Delete
}
[938] Fix | Delete
endif;
[939] Fix | Delete
[940] Fix | Delete
/**
[941] Fix | Delete
* Add pseudo-action via the_content to hook filter/action at the end of main content
[942] Fix | Delete
* @param string content string
[943] Fix | Delete
* @return string content string
[944] Fix | Delete
*/
[945] Fix | Delete
function et_pb_content_main_query( $content ) {
[946] Fix | Delete
global $post, $et_pb_comments_print;
[947] Fix | Delete
[948] Fix | Delete
// Perform filter on main query + if builder is used only
[949] Fix | Delete
if ( is_main_query() && et_pb_is_pagebuilder_used( get_the_ID() ) ) {
[950] Fix | Delete
add_filter( 'comment_class', 'et_pb_add_non_builder_comment_class', 10, 5 );
[951] Fix | Delete
[952] Fix | Delete
// Actual front-end only adjustment. has_shortcode() can't use passed $content since
[953] Fix | Delete
// Its shortcode has been parsed
[954] Fix | Delete
if ( false === $et_pb_comments_print && ! et_fb_is_enabled() && has_shortcode( $post->post_content, 'et_pb_comments' ) ) {
[955] Fix | Delete
add_filter( 'get_comments_number', '__return_zero' );
[956] Fix | Delete
add_filter( 'comments_open', '__return_false' );
[957] Fix | Delete
add_filter( 'comments_array', '__return_empty_array' );
[958] Fix | Delete
}
[959] Fix | Delete
}
[960] Fix | Delete
[961] Fix | Delete
return $content;
[962] Fix | Delete
}
[963] Fix | Delete
add_filter( 'the_content', 'et_pb_content_main_query', 1500 );
[964] Fix | Delete
add_filter( 'et_builder_render_layout', 'et_pb_content_main_query', 1500 );
[965] Fix | Delete
[966] Fix | Delete
/**
[967] Fix | Delete
* Added special class name for comment items that are placed outside builder
[968] Fix | Delete
*
[969] Fix | Delete
* See {@see 'comment_class'}.
[970] Fix | Delete
*
[971] Fix | Delete
* @param array $classes classname
[972] Fix | Delete
* @param string $comment comma separated list of additional classes
[973] Fix | Delete
* @param int $comment_ID comment ID
[974] Fix | Delete
* @param WP_Comment $comment comment object
[975] Fix | Delete
* @param int|WP_Post $post_id post ID or WP_Post object
[976] Fix | Delete
*
[977] Fix | Delete
* @return array modified classname
[978] Fix | Delete
*/
[979] Fix | Delete
function et_pb_add_non_builder_comment_class( $classes, $class, $comment_ID, $comment, $post_id ) {
[980] Fix | Delete
[981] Fix | Delete
$classes[] = 'et-pb-non-builder-comment';
[982] Fix | Delete
[983] Fix | Delete
return $classes;
[984] Fix | Delete
}
[985] Fix | Delete
[986] Fix | Delete
/**
[987] Fix | Delete
* Enqueue Open Sans for the builder UI.
[988] Fix | Delete
*
[989] Fix | Delete
* @since 4.0
[990] Fix | Delete
*
[991] Fix | Delete
* @return void
[992] Fix | Delete
*/
[993] Fix | Delete
function et_builder_enqueue_open_sans() {
[994] Fix | Delete
$protocol = is_ssl() ? 'https' : 'http';
[995] Fix | Delete
$query_args = array(
[996] Fix | Delete
'family' => 'Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800',
[997] Fix | Delete
'subset' => 'latin,latin-ext',
[998] Fix | Delete
);
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function