Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder
File: core.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Render a builder layout to string.
[3] Fix | Delete
*
[4] Fix | Delete
* @since 4.0.8
[5] Fix | Delete
*
[6] Fix | Delete
* @param string $content
[7] Fix | Delete
*
[8] Fix | Delete
* @return string
[9] Fix | Delete
*/
[10] Fix | Delete
function et_builder_render_layout( $content ) {
[11] Fix | Delete
/**
[12] Fix | Delete
* Filters layout content when it's being rendered.
[13] Fix | Delete
*
[14] Fix | Delete
* @since 4.0.8
[15] Fix | Delete
*
[16] Fix | Delete
* @param string $content
[17] Fix | Delete
*/
[18] Fix | Delete
return apply_filters( 'et_builder_render_layout', $content );
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
// Add all core filters that are applied to the_content() without do_blocks().
[22] Fix | Delete
add_filter( 'et_builder_render_layout', 'capital_P_dangit', 11 );
[23] Fix | Delete
add_filter( 'et_builder_render_layout', 'wptexturize' );
[24] Fix | Delete
add_filter( 'et_builder_render_layout', 'convert_smilies', 20 );
[25] Fix | Delete
add_filter( 'et_builder_render_layout', 'wpautop' );
[26] Fix | Delete
add_filter( 'et_builder_render_layout', 'shortcode_unautop' );
[27] Fix | Delete
add_filter( 'et_builder_render_layout', 'prepend_attachment' );
[28] Fix | Delete
add_filter( 'et_builder_render_layout', 'et_builder_filter_content_image_tags' );
[29] Fix | Delete
add_filter( 'et_builder_render_layout', 'do_shortcode', 11 ); // AFTER wpautop()
[30] Fix | Delete
[31] Fix | Delete
if ( ! function_exists( 'et_builder_filter_content_image_tags' ) ) {
[32] Fix | Delete
/**
[33] Fix | Delete
* Whether filter image tags on post content with different functions.
[34] Fix | Delete
*
[35] Fix | Delete
* @since 4.5.2
[36] Fix | Delete
*
[37] Fix | Delete
* @param string $content The HTML content to be filtered.
[38] Fix | Delete
*
[39] Fix | Delete
* @return string Converted content with images modified.
[40] Fix | Delete
*/
[41] Fix | Delete
function et_builder_filter_content_image_tags( $content ) {
[42] Fix | Delete
if ( function_exists( 'wp_filter_content_tags' ) ) {
[43] Fix | Delete
// Function wp_filter_content_tags() is introduced on WP 5.5 forward.
[44] Fix | Delete
$content = wp_filter_content_tags( $content );
[45] Fix | Delete
} else {
[46] Fix | Delete
// Function wp_make_content_images_responsive() is used by WP 5.4 below.
[47] Fix | Delete
$content = wp_make_content_images_responsive( $content );
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
return $content;
[51] Fix | Delete
}
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
if ( ! function_exists( 'et_builder_add_filters' ) ):
[55] Fix | Delete
/**
[56] Fix | Delete
* Add common filters depending on what builder is being used.
[57] Fix | Delete
* These hooks are not used in DBP as it has its own implementations for them.
[58] Fix | Delete
*
[59] Fix | Delete
* @return void
[60] Fix | Delete
*/
[61] Fix | Delete
function et_builder_add_filters() {
[62] Fix | Delete
if ( et_is_builder_plugin_active() ) {
[63] Fix | Delete
return;
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
add_filter( 'et_builder_bfb_enabled', 'et_builder_filter_bfb_enabled' );
[67] Fix | Delete
add_filter( 'et_builder_is_fresh_install', 'et_builder_filter_is_fresh_install' );
[68] Fix | Delete
add_action( 'et_builder_toggle_bfb', 'et_builder_action_toggle_bfb' );
[69] Fix | Delete
}
[70] Fix | Delete
endif;
[71] Fix | Delete
add_action( 'init', 'et_builder_add_filters' );
[72] Fix | Delete
[73] Fix | Delete
if ( ! function_exists( 'et_builder_should_load_framework' ) ):
[74] Fix | Delete
function et_builder_should_load_framework() {
[75] Fix | Delete
global $pagenow;
[76] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
[77] Fix | Delete
[78] Fix | Delete
static $should_load = null;
[79] Fix | Delete
[80] Fix | Delete
if ( null !== $should_load ) {
[81] Fix | Delete
return $should_load;
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
if ( defined( 'WP_CLI' ) && WP_CLI ) {
[85] Fix | Delete
return $should_load = true;
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
if ( ET_Core_Portability::doing_import() ) {
[89] Fix | Delete
return $should_load = true;
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
$is_admin = is_admin();
[93] Fix | Delete
$required_admin_pages = array( 'edit.php', 'post.php', 'post-new.php', 'admin.php', 'customize.php', 'edit-tags.php', 'admin-ajax.php', 'export.php', 'options-permalink.php', 'themes.php', 'revision.php' ); // list of admin pages where we need to load builder files
[94] Fix | Delete
$specific_filter_pages = array( 'edit.php', 'post.php', 'post-new.php', 'admin.php', 'edit-tags.php' ); // list of admin pages where we need more specific filtering
[95] Fix | Delete
$post_id = (int) et_()->array_get( $_GET, 'post', 0 );
[96] Fix | Delete
[97] Fix | Delete
$bfb_settings = get_option( 'et_bfb_settings' );
[98] Fix | Delete
$is_bfb = et_pb_is_allowed( 'use_visual_builder' ) && isset( $bfb_settings['enable_bfb'] ) && 'on' === $bfb_settings['enable_bfb'];
[99] Fix | Delete
$is_bfb_used = 'on' === get_post_meta( $post_id, '_et_pb_use_builder', true ) && $is_bfb;
[100] Fix | Delete
[101] Fix | Delete
$is_edit_library_page = in_array( $pagenow, array( 'edit.php', 'post.php', 'post-new.php' ) ) && ( ( isset( $_GET['post_type'] ) && 'et_pb_layout' === $_GET['post_type'] ) || ( $post_id && 'et_pb_layout' === get_post_type( $post_id ) ) );
[102] Fix | Delete
$is_extra_builder = $post_id && 'layout' === get_post_type( $post_id );
[103] Fix | Delete
$is_edit_page_not_bfb = in_array( $pagenow, array( 'post-new.php', 'post.php' ) ) && !$is_bfb_used;
[104] Fix | Delete
$is_role_editor_page = 'admin.php' === $pagenow && isset( $_GET['page'] ) && apply_filters( 'et_divi_role_editor_page', 'et_divi_role_editor' ) === $_GET['page'];
[105] Fix | Delete
$is_import_page = 'admin.php' === $pagenow && isset( $_GET['import'] ) && 'wordpress' === $_GET['import']; // Page Builder files should be loaded on import page as well to register the et_pb_layout post type properly
[106] Fix | Delete
$is_wpml_page = 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'sitepress-multilingual-cms/menu/languages.php' === $_GET['page']; // Page Builder files should be loaded on WPML clone page as well to register the custom taxonomies properly
[107] Fix | Delete
$is_edit_layout_category_page = 'edit-tags.php' === $pagenow && isset( $_GET['taxonomy'] ) && ( 'layout_category' === $_GET['taxonomy'] || 'layout_pack' === $_GET['taxonomy'] );
[108] Fix | Delete
[109] Fix | Delete
if ( ! $is_admin || ( $is_admin && in_array( $pagenow, $required_admin_pages ) && ( ! in_array( $pagenow, $specific_filter_pages ) || $is_edit_library_page || $is_role_editor_page || $is_edit_layout_category_page || $is_import_page || $is_wpml_page || $is_edit_page_not_bfb || $is_extra_builder ) ) ) {
[110] Fix | Delete
$should_load = true;
[111] Fix | Delete
} else {
[112] Fix | Delete
$should_load = false;
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
/**
[116] Fix | Delete
* Filters whether or not the Divi Builder codebase should be loaded for the current request.
[117] Fix | Delete
*
[118] Fix | Delete
* @since 3.0.99
[119] Fix | Delete
*
[120] Fix | Delete
* @param bool $should_load
[121] Fix | Delete
*/
[122] Fix | Delete
$should_load = apply_filters( 'et_builder_should_load_framework', $should_load );
[123] Fix | Delete
[124] Fix | Delete
return $should_load;
[125] Fix | Delete
// phpcs:enable
[126] Fix | Delete
}
[127] Fix | Delete
endif;
[128] Fix | Delete
[129] Fix | Delete
if ( et_builder_should_load_framework() ) {
[130] Fix | Delete
// Initialize the Divi Library
[131] Fix | Delete
require_once ET_BUILDER_DIR . 'feature/Library.php';
[132] Fix | Delete
}
[133] Fix | Delete
[134] Fix | Delete
if ( ! function_exists( 'et_builder_maybe_enable_inline_styles' ) ):
[135] Fix | Delete
function et_builder_maybe_enable_inline_styles() {
[136] Fix | Delete
et_update_option( 'static_css_custom_css_safety_check_done', true );
[137] Fix | Delete
[138] Fix | Delete
if ( ! wp_get_custom_css() ) {
[139] Fix | Delete
return;
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
// This site has Custom CSS that existed prior to v3.0.54 which could contain syntax
[143] Fix | Delete
// errors that the user is unaware of. Such errors would cause problems in a unified
[144] Fix | Delete
// static CSS file so let's enable inline styles for the builder's design styles.
[145] Fix | Delete
et_update_option( 'et_pb_css_in_footer', 'on' );
[146] Fix | Delete
}
[147] Fix | Delete
endif;
[148] Fix | Delete
[149] Fix | Delete
if ( defined( 'ET_CORE_UPDATED' ) && ! et_get_option( 'static_css_custom_css_safety_check_done', false ) ) {
[150] Fix | Delete
et_builder_maybe_enable_inline_styles();
[151] Fix | Delete
}
[152] Fix | Delete
[153] Fix | Delete
function et_pb_video_get_oembed_thumbnail() {
[154] Fix | Delete
if ( ! wp_verify_nonce( $_POST['et_admin_load_nonce'], 'et_admin_load_nonce' ) ) {
[155] Fix | Delete
die( -1 );
[156] Fix | Delete
}
[157] Fix | Delete
[158] Fix | Delete
if ( ! current_user_can( 'edit_posts' ) ) {
[159] Fix | Delete
die( -1 );
[160] Fix | Delete
}
[161] Fix | Delete
[162] Fix | Delete
$video_url = esc_url( $_POST['et_video_url'] );
[163] Fix | Delete
if ( false !== wp_oembed_get( $video_url ) ) {
[164] Fix | Delete
// Get image thumbnail
[165] Fix | Delete
add_filter( 'oembed_dataparse', 'et_pb_video_oembed_data_parse', 10, 3 );
[166] Fix | Delete
// Save thumbnail
[167] Fix | Delete
$image_src = wp_oembed_get( $video_url );
[168] Fix | Delete
// Set back to normal
[169] Fix | Delete
remove_filter( 'oembed_dataparse', 'et_pb_video_oembed_data_parse', 10, 3 );
[170] Fix | Delete
if ( '' === $image_src ) {
[171] Fix | Delete
die( -1 );
[172] Fix | Delete
}
[173] Fix | Delete
echo esc_url( $image_src );
[174] Fix | Delete
} else {
[175] Fix | Delete
die( -1 );
[176] Fix | Delete
}
[177] Fix | Delete
die();
[178] Fix | Delete
}
[179] Fix | Delete
add_action( 'wp_ajax_et_pb_video_get_oembed_thumbnail', 'et_pb_video_get_oembed_thumbnail' );
[180] Fix | Delete
[181] Fix | Delete
if ( ! function_exists( 'et_pb_video_oembed_data_parse' ) ) :
[182] Fix | Delete
function et_pb_video_oembed_data_parse( $return, $data, $url ) {
[183] Fix | Delete
if ( isset( $data->thumbnail_url ) ) {
[184] Fix | Delete
return esc_url( str_replace( array('https://', 'http://'), '//', $data->thumbnail_url ), array('http') );
[185] Fix | Delete
} else {
[186] Fix | Delete
return false;
[187] Fix | Delete
}
[188] Fix | Delete
}
[189] Fix | Delete
endif;
[190] Fix | Delete
[191] Fix | Delete
function et_pb_add_widget_area(){
[192] Fix | Delete
if ( ! wp_verify_nonce( $_POST['et_admin_load_nonce'], 'et_admin_load_nonce' ) ) {
[193] Fix | Delete
die( -1 );
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[197] Fix | Delete
die( -1 );
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
$et_pb_widgets = get_theme_mod( 'et_pb_widgets' );
[201] Fix | Delete
[202] Fix | Delete
$number = $et_pb_widgets ? intval( $et_pb_widgets['number'] ) + 1 : 1;
[203] Fix | Delete
[204] Fix | Delete
$et_widget_area_name = sanitize_text_field( $_POST['et_widget_area_name'] );
[205] Fix | Delete
$et_pb_widgets['areas']['et_pb_widget_area_' . $number] = $et_widget_area_name;
[206] Fix | Delete
$et_pb_widgets['number'] = $number;
[207] Fix | Delete
[208] Fix | Delete
set_theme_mod( 'et_pb_widgets', $et_pb_widgets );
[209] Fix | Delete
[210] Fix | Delete
et_pb_force_regenerate_templates();
[211] Fix | Delete
[212] Fix | Delete
printf( et_get_safe_localization( __( '<strong>%1$s</strong> widget area has been created. You can create more areas, once you finish update the page to see all the areas.', 'et_builder' ) ),
[213] Fix | Delete
esc_html( $et_widget_area_name )
[214] Fix | Delete
);
[215] Fix | Delete
[216] Fix | Delete
die();
[217] Fix | Delete
}
[218] Fix | Delete
add_action( 'wp_ajax_et_pb_add_widget_area', 'et_pb_add_widget_area' );
[219] Fix | Delete
[220] Fix | Delete
function et_pb_remove_widget_area(){
[221] Fix | Delete
if ( ! wp_verify_nonce( $_POST['et_admin_load_nonce'], 'et_admin_load_nonce' ) ) {
[222] Fix | Delete
die( -1 );
[223] Fix | Delete
}
[224] Fix | Delete
[225] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[226] Fix | Delete
die( -1 );
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
$et_pb_widgets = get_theme_mod( 'et_pb_widgets' );
[230] Fix | Delete
[231] Fix | Delete
$et_widget_area_name = sanitize_text_field( $_POST['et_widget_area_name'] );
[232] Fix | Delete
unset( $et_pb_widgets['areas'][ $et_widget_area_name ] );
[233] Fix | Delete
[234] Fix | Delete
set_theme_mod( 'et_pb_widgets', $et_pb_widgets );
[235] Fix | Delete
[236] Fix | Delete
et_pb_force_regenerate_templates();
[237] Fix | Delete
[238] Fix | Delete
die( esc_html( $et_widget_area_name ) );
[239] Fix | Delete
}
[240] Fix | Delete
add_action( 'wp_ajax_et_pb_remove_widget_area', 'et_pb_remove_widget_area' );
[241] Fix | Delete
[242] Fix | Delete
function et_pb_current_user_can_lock() {
[243] Fix | Delete
if ( ! wp_verify_nonce( $_POST['et_admin_load_nonce'], 'et_admin_load_nonce' ) ) {
[244] Fix | Delete
die( -1 );
[245] Fix | Delete
}
[246] Fix | Delete
[247] Fix | Delete
if ( ! current_user_can( 'edit_posts' ) ) {
[248] Fix | Delete
die( -1 );
[249] Fix | Delete
}
[250] Fix | Delete
[251] Fix | Delete
$permission = et_pb_is_allowed( 'lock_module' );
[252] Fix | Delete
$permission = wp_json_encode( (bool) $permission );
[253] Fix | Delete
[254] Fix | Delete
die( et_core_esc_previously( $permission ) );
[255] Fix | Delete
}
[256] Fix | Delete
add_action( 'wp_ajax_et_pb_current_user_can_lock', 'et_pb_current_user_can_lock' );
[257] Fix | Delete
[258] Fix | Delete
/**
[259] Fix | Delete
* Get the supported post types by default.
[260] Fix | Delete
*
[261] Fix | Delete
* @since 3.10
[262] Fix | Delete
*
[263] Fix | Delete
* @return string[]
[264] Fix | Delete
*/
[265] Fix | Delete
function et_builder_get_default_post_types() {
[266] Fix | Delete
/**
[267] Fix | Delete
* Filter default post types that are powered by the builder.
[268] Fix | Delete
*
[269] Fix | Delete
* @since 4.0
[270] Fix | Delete
*
[271] Fix | Delete
* @param string[]
[272] Fix | Delete
*/
[273] Fix | Delete
return apply_filters( 'et_builder_default_post_types', array(
[274] Fix | Delete
// WordPress:
[275] Fix | Delete
'page',
[276] Fix | Delete
'post',
[277] Fix | Delete
[278] Fix | Delete
// Divi/Extra/DBP:
[279] Fix | Delete
'project',
[280] Fix | Delete
'et_pb_layout',
[281] Fix | Delete
) );
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
/**
[285] Fix | Delete
* Get the supported third party post types.
[286] Fix | Delete
*
[287] Fix | Delete
* @since 3.10
[288] Fix | Delete
*
[289] Fix | Delete
* @return string[]
[290] Fix | Delete
*/
[291] Fix | Delete
function et_builder_get_third_party_post_types() {
[292] Fix | Delete
$third_party_post_types = array();
[293] Fix | Delete
[294] Fix | Delete
// WooCommerce (https://wordpress.org/plugins/woocommerce/):
[295] Fix | Delete
if ( class_exists( 'WooCommerce' ) ) {
[296] Fix | Delete
$third_party_post_types[] = 'product';
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
// The Events Calendar (https://wordpress.org/plugins/the-events-calendar/):
[300] Fix | Delete
if ( class_exists( 'Tribe__Events__Main' ) ) {
[301] Fix | Delete
$third_party_post_types[] = 'tribe_events';
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
// Popup Maker (https://wordpress.org/plugins/popup-maker/):
[305] Fix | Delete
if ( class_exists( 'Popup_Maker' ) ) {
[306] Fix | Delete
$third_party_post_types[] = 'popup';
[307] Fix | Delete
}
[308] Fix | Delete
[309] Fix | Delete
// All-in-One Event Calendar (https://wordpress.org/plugins/all-in-one-event-calendar/):
[310] Fix | Delete
if ( function_exists( 'ai1ec_initiate_constants' ) ) {
[311] Fix | Delete
$third_party_post_types[] = 'ai1ec_event';
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
// Events Manager (https://wordpress.org/plugins/events-manager/):
[315] Fix | Delete
if ( function_exists( 'em_plugins_loaded' ) ) {
[316] Fix | Delete
$third_party_post_types[] = 'event';
[317] Fix | Delete
$third_party_post_types[] = 'location';
[318] Fix | Delete
}
[319] Fix | Delete
[320] Fix | Delete
// Portfolio Post Type (https://wordpress.org/plugins/portfolio-post-type/):
[321] Fix | Delete
if ( function_exists( 'portfolio_post_type_init' ) ) {
[322] Fix | Delete
$third_party_post_types[] = 'portfolio';
[323] Fix | Delete
}
[324] Fix | Delete
[325] Fix | Delete
// LifterLMS (https://wordpress.org/plugins/lifterlms/):
[326] Fix | Delete
if ( class_exists( 'LifterLMS' ) ) {
[327] Fix | Delete
$third_party_post_types[] = 'course';
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
// LearnDash (https://www.learndash.com/wordpress-course-plugin-features/):
[331] Fix | Delete
if ( class_exists( 'Semper_Fi_Module' ) ) {
[332] Fix | Delete
$third_party_post_types[] = 'sfwd-courses';
[333] Fix | Delete
$third_party_post_types[] = 'sfwd-lessons';
[334] Fix | Delete
}
[335] Fix | Delete
[336] Fix | Delete
/**
[337] Fix | Delete
* Array of third-party registered post types that should have support enabled by default.
[338] Fix | Delete
*
[339] Fix | Delete
* @since 3.10
[340] Fix | Delete
*
[341] Fix | Delete
* @param string[]
[342] Fix | Delete
*/
[343] Fix | Delete
return apply_filters( 'et_builder_third_party_post_types', $third_party_post_types );
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
/**
[347] Fix | Delete
* Look for builder's registered third party post type that isn't publicly queryable
[348] Fix | Delete
*
[349] Fix | Delete
* @since 3.19.9
[350] Fix | Delete
*
[351] Fix | Delete
* @return array
[352] Fix | Delete
*/
[353] Fix | Delete
function et_builder_get_third_party_unqueryable_post_types() {
[354] Fix | Delete
// Save the value in static variable so if post type's publicly_queryable is modified due to current
[355] Fix | Delete
// request is BFB request, this function still return correct value
[356] Fix | Delete
static $unqueryable_post_types = array();
[357] Fix | Delete
[358] Fix | Delete
if ( empty( $unqueryable_post_types ) ) {
[359] Fix | Delete
// Get third party's unqueryable post types only as default post types have been handled properly
[360] Fix | Delete
$valid_third_party_post_types = array_diff(
[361] Fix | Delete
et_builder_get_builder_post_types(),
[362] Fix | Delete
et_builder_get_default_post_types()
[363] Fix | Delete
);
[364] Fix | Delete
[365] Fix | Delete
$unqueryable_post_types = array_intersect(
[366] Fix | Delete
$valid_third_party_post_types,
[367] Fix | Delete
get_post_types( array('publicly_queryable' => false ) )
[368] Fix | Delete
);
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
return apply_filters( 'et_builder_get_third_party_unqueryable_post_types', $unqueryable_post_types );
[372] Fix | Delete
}
[373] Fix | Delete
[374] Fix | Delete
/**
[375] Fix | Delete
* Get the list of registered Post Types options.
[376] Fix | Delete
*
[377] Fix | Delete
* @since 3.18
[378] Fix | Delete
* @since 4.0.7 Added the $require_editor parameter.
[379] Fix | Delete
*
[380] Fix | Delete
* @param boolean|callable $usort
[381] Fix | Delete
* @param boolean $require_editor
[382] Fix | Delete
*
[383] Fix | Delete
* @return array
[384] Fix | Delete
*/
[385] Fix | Delete
function et_get_registered_post_type_options( $usort = false, $require_editor = true ) {
[386] Fix | Delete
$require_editor_key = $require_editor ? '1' : '0';
[387] Fix | Delete
$key = "et_get_registered_post_type_options:{$require_editor_key}";
[388] Fix | Delete
[389] Fix | Delete
if ( ET_Core_Cache::has( $key ) ) {
[390] Fix | Delete
return ET_Core_Cache::get( $key );
[391] Fix | Delete
}
[392] Fix | Delete
[393] Fix | Delete
$blocklist = et_builder_get_blocklisted_post_types();
[394] Fix | Delete
$allowlist = et_builder_get_third_party_post_types();
[395] Fix | Delete
[396] Fix | Delete
// Extra and Library layouts shouldn't appear in Theme Options as configurable post types.
[397] Fix | Delete
/**
[398] Fix | Delete
* Get array of post types to prevent from appearing as options for builder usage.
[399] Fix | Delete
*
[400] Fix | Delete
* @since 4.0
[401] Fix | Delete
*
[402] Fix | Delete
* @param string[] $blocklist Post types to blocklist.
[403] Fix | Delete
*/
[404] Fix | Delete
$blocklist = apply_filters( 'et_builder_post_type_options_blocklist', array_merge( $blocklist, array(
[405] Fix | Delete
'et_pb_layout',
[406] Fix | Delete
'layout',
[407] Fix | Delete
) ) );
[408] Fix | Delete
$raw_post_types = get_post_types( array(
[409] Fix | Delete
'show_ui' => true,
[410] Fix | Delete
), 'objects' );
[411] Fix | Delete
$post_types = array();
[412] Fix | Delete
[413] Fix | Delete
foreach ( $raw_post_types as $post_type ) {
[414] Fix | Delete
$is_allowlisted = in_array( $post_type->name, $allowlist );
[415] Fix | Delete
$is_blocklisted = in_array( $post_type->name, $blocklist );
[416] Fix | Delete
$supports_editor = $require_editor ? post_type_supports( $post_type->name, 'editor' ) : true;
[417] Fix | Delete
$is_public = et_builder_is_post_type_public( $post_type->name );
[418] Fix | Delete
[419] Fix | Delete
if ( ! $is_allowlisted && ( $is_blocklisted || ! $supports_editor || ! $is_public ) ) {
[420] Fix | Delete
continue;
[421] Fix | Delete
}
[422] Fix | Delete
[423] Fix | Delete
$post_types[] = $post_type;
[424] Fix | Delete
}
[425] Fix | Delete
[426] Fix | Delete
if ( $usort && is_callable( $usort ) ) {
[427] Fix | Delete
usort( $post_types, $usort );
[428] Fix | Delete
}
[429] Fix | Delete
[430] Fix | Delete
$post_type_options = array_combine(
[431] Fix | Delete
wp_list_pluck( $post_types, 'name' ),
[432] Fix | Delete
wp_list_pluck( $post_types, 'label' )
[433] Fix | Delete
);
[434] Fix | Delete
[435] Fix | Delete
// did_action() actually checks if the action has started, not ended so we
[436] Fix | Delete
// need to check that we are not currently doing the action as well.
[437] Fix | Delete
if ( did_action( 'init' ) && ! doing_action( 'init' ) ) {
[438] Fix | Delete
// Only cache the value after init is done when we are sure all
[439] Fix | Delete
// plugins have registered their post types.
[440] Fix | Delete
ET_Core_Cache::add( $key, $post_type_options );
[441] Fix | Delete
}
[442] Fix | Delete
[443] Fix | Delete
return $post_type_options;
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
/**
[447] Fix | Delete
* Clear post type options cache whenever a custom post type is registered.
[448] Fix | Delete
*
[449] Fix | Delete
* @since 3.21.2
[450] Fix | Delete
*
[451] Fix | Delete
* @return void
[452] Fix | Delete
*/
[453] Fix | Delete
function et_clear_registered_post_type_options_cache() {
[454] Fix | Delete
ET_Core_Cache::delete( 'et_get_registered_post_type_options' );
[455] Fix | Delete
}
[456] Fix | Delete
[457] Fix | Delete
add_action( 'registered_post_type', 'et_clear_registered_post_type_options_cache');
[458] Fix | Delete
[459] Fix | Delete
/**
[460] Fix | Delete
* Get the list of unsupported Post Types.
[461] Fix | Delete
*
[462] Fix | Delete
* @since 4.5.1
[463] Fix | Delete
*
[464] Fix | Delete
* @return array
[465] Fix | Delete
*/
[466] Fix | Delete
function et_builder_get_blocklisted_post_types() {
[467] Fix | Delete
return apply_filters( 'et_builder_post_type_blocklist', array(
[468] Fix | Delete
// LearnDash
[469] Fix | Delete
'sfwd-essays',
[470] Fix | Delete
[471] Fix | Delete
// bbPress:
[472] Fix | Delete
'forum',
[473] Fix | Delete
'topic',
[474] Fix | Delete
'reply',
[475] Fix | Delete
) );
[476] Fix | Delete
}
[477] Fix | Delete
[478] Fix | Delete
/**
[479] Fix | Delete
* Get the list of unsupported Post Types.
[480] Fix | Delete
*
[481] Fix | Delete
* @deprecated ?? No longer used by internal code; use `et_builder_get_blocklisted_post_types` instead.
[482] Fix | Delete
*
[483] Fix | Delete
* @since 3.10
[484] Fix | Delete
* @since 4.5.1 Aliased to `et_builder_get_blocklisted_post_types`.
[485] Fix | Delete
*
[486] Fix | Delete
* @return array
[487] Fix | Delete
*/
[488] Fix | Delete
function et_builder_get_blacklisted_post_types() {
[489] Fix | Delete
return et_builder_get_blocklisted_post_types();
[490] Fix | Delete
}
[491] Fix | Delete
[492] Fix | Delete
/**
[493] Fix | Delete
* Check whether the supplied post type is a custom post type as far as the builder is concerned.
[494] Fix | Delete
*
[495] Fix | Delete
* @since 3.10
[496] Fix | Delete
*
[497] Fix | Delete
* @param string $post_type
[498] Fix | Delete
*
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function