Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder
File: functions.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Core builder functions.
[2] Fix | Delete
*
[3] Fix | Delete
* @package Builder
[4] Fix | Delete
* @since 1.0
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ET_BUILDER_PRODUCT_VERSION' ) ) {
[8] Fix | Delete
// Note, this will be updated automatically during grunt release task.
[9] Fix | Delete
define( 'ET_BUILDER_PRODUCT_VERSION', '4.8.1' );
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
if ( ! defined( 'ET_BUILDER_VERSION' ) ) {
[13] Fix | Delete
define( 'ET_BUILDER_VERSION', 0.7 );
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
if ( ! defined( 'ET_BUILDER_FORCE_CACHE_PURGE' ) ) {
[17] Fix | Delete
define( 'ET_BUILDER_FORCE_CACHE_PURGE', false );
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
if ( ! defined( 'ET_BUILDER_DIR_RESOLVED_PATH' ) ) {
[21] Fix | Delete
define( 'ET_BUILDER_DIR_RESOLVED_PATH', dirname( __FILE__ ) );
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
// When set to true, the builder will use the new loading method.
[25] Fix | Delete
if ( ! defined( 'ET_BUILDER_CACHE_ASSETS' ) ) {
[26] Fix | Delete
define( 'ET_BUILDER_CACHE_ASSETS', ! isset( $_REQUEST['nocache'] ) ); // phpcs:ignore WordPress.Security.NonceVerification -- CSRF ok.
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
if ( ! defined( 'ET_BUILDER_CACHE_MODULES' ) ) {
[30] Fix | Delete
define( 'ET_BUILDER_CACHE_MODULES', apply_filters( 'et_builder_cache_modules', true ) );
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
if ( ! defined( 'ET_BUILDER_JSON_ENCODE_OPTIONS' ) ) {
[34] Fix | Delete
define( 'ET_BUILDER_JSON_ENCODE_OPTIONS', 0 );
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
if ( ! defined( 'ET_BUILDER_KEEP_OLDEST_CACHED_ASSETS' ) ) {
[38] Fix | Delete
define( 'ET_BUILDER_KEEP_OLDEST_CACHED_ASSETS', false );
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
if ( ! defined( 'ET_BUILDER_PURGE_OLD_CACHED_ASSETS' ) ) {
[42] Fix | Delete
define( 'ET_BUILDER_PURGE_OLD_CACHED_ASSETS', true );
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
if ( defined( 'ET_BUILDER_DEFINITION_SORT' ) && ET_BUILDER_DEFINITION_SORT ) {
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* You don't want to know and this isn't the function you're looking for.
[49] Fix | Delete
* Still reading ? Aight, this is only used to debug definitions.
[50] Fix | Delete
*
[51] Fix | Delete
* @param array $definitions Definitions.
[52] Fix | Delete
*/
[53] Fix | Delete
function et_builder_definition_sort( &$definitions ) {
[54] Fix | Delete
if ( ! is_array( $definitions ) ) {
[55] Fix | Delete
return;
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
$fields = array_keys( $definitions );
[59] Fix | Delete
$order = array(
[60] Fix | Delete
'label',
[61] Fix | Delete
'description',
[62] Fix | Delete
'option_category',
[63] Fix | Delete
'type',
[64] Fix | Delete
'data_type',
[65] Fix | Delete
'upload_button_text',
[66] Fix | Delete
);
[67] Fix | Delete
[68] Fix | Delete
foreach ( $fields as $field ) {
[69] Fix | Delete
$definition =& $definitions[ $field ];
[70] Fix | Delete
[71] Fix | Delete
if ( is_array( $definition ) ) {
[72] Fix | Delete
foreach ( $order as $key ) {
[73] Fix | Delete
if ( isset( $definition[ $key ] ) ) {
[74] Fix | Delete
$value = $definition[ $key ];
[75] Fix | Delete
unset( $definition[ $key ] );
[76] Fix | Delete
$definition[ $key ] = $value;
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
et_builder_definition_sort( $definition );
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
$et_fonts_queue = array();
[86] Fix | Delete
[87] Fix | Delete
/**
[88] Fix | Delete
* Exclude predefined layouts from import.
[89] Fix | Delete
*
[90] Fix | Delete
* @param array $posts The imported posts.
[91] Fix | Delete
*
[92] Fix | Delete
* @return array
[93] Fix | Delete
*/
[94] Fix | Delete
function et_remove_predefined_layouts_from_import( $posts ) {
[95] Fix | Delete
$processed_posts = $posts;
[96] Fix | Delete
[97] Fix | Delete
if ( isset( $posts ) && is_array( $posts ) ) {
[98] Fix | Delete
$processed_posts = array();
[99] Fix | Delete
[100] Fix | Delete
foreach ( $posts as $post ) {
[101] Fix | Delete
if ( isset( $post['postmeta'] ) && is_array( $post['postmeta'] ) ) {
[102] Fix | Delete
foreach ( $post['postmeta'] as $meta ) {
[103] Fix | Delete
if ( '_et_pb_predefined_layout' === $meta['key'] && 'on' === $meta['value'] ) {
[104] Fix | Delete
continue 2;
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
$processed_posts[] = $post;
[110] Fix | Delete
}
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
return $processed_posts;
[114] Fix | Delete
}
[115] Fix | Delete
add_filter( 'wp_import_posts', 'et_remove_predefined_layouts_from_import', 5 );
[116] Fix | Delete
[117] Fix | Delete
[118] Fix | Delete
/**
[119] Fix | Delete
* Output all module fields JSON dump.
[120] Fix | Delete
* For dev use only.
[121] Fix | Delete
*
[122] Fix | Delete
* @return void
[123] Fix | Delete
*/
[124] Fix | Delete
// phpcs:disable Squiz.PHP.CommentedOutCode -- This is debug function.
[125] Fix | Delete
// function et_dev_output_all_fields() {
[126] Fix | Delete
// die( json_encode( ET_Builder_Element::get_all_fields('page') ) );
[127] Fix | Delete
// }
[128] Fix | Delete
// add_action('wp', 'et_dev_output_all_fields', 100);.
[129] Fix | Delete
// phpcs:enable
[130] Fix | Delete
/**
[131] Fix | Delete
* Set the layout_type taxonomy to "layout" for layouts imported from old version of Divi.
[132] Fix | Delete
*
[133] Fix | Delete
* @param array $posts Imported posts.
[134] Fix | Delete
*
[135] Fix | Delete
* @return array
[136] Fix | Delete
*/
[137] Fix | Delete
function et_update_old_layouts_taxonomy( $posts ) {
[138] Fix | Delete
$processed_posts = $posts;
[139] Fix | Delete
[140] Fix | Delete
if ( isset( $posts ) && is_array( $posts ) ) {
[141] Fix | Delete
$processed_posts = array();
[142] Fix | Delete
[143] Fix | Delete
foreach ( $posts as $post ) {
[144] Fix | Delete
$update_built_for_post_type = false;
[145] Fix | Delete
[146] Fix | Delete
if ( 'et_pb_layout' === $post['post_type'] ) {
[147] Fix | Delete
if ( ! isset( $post['terms'] ) ) {
[148] Fix | Delete
$post['terms'][] = array(
[149] Fix | Delete
'name' => 'layout',
[150] Fix | Delete
'slug' => 'layout',
[151] Fix | Delete
'domain' => 'layout_type',
[152] Fix | Delete
);
[153] Fix | Delete
$post['terms'][] = array(
[154] Fix | Delete
'name' => 'not_global',
[155] Fix | Delete
'slug' => 'not_global',
[156] Fix | Delete
'domain' => 'scope',
[157] Fix | Delete
);
[158] Fix | Delete
}
[159] Fix | Delete
[160] Fix | Delete
$update_built_for_post_type = true;
[161] Fix | Delete
[162] Fix | Delete
// check whether _et_pb_built_for_post_type custom field exists.
[163] Fix | Delete
if ( ! empty( $post['postmeta'] ) ) {
[164] Fix | Delete
foreach ( $post['postmeta'] as $index => $value ) {
[165] Fix | Delete
if ( '_et_pb_built_for_post_type' === $value['key'] ) {
[166] Fix | Delete
$update_built_for_post_type = false;
[167] Fix | Delete
}
[168] Fix | Delete
}
[169] Fix | Delete
}
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
// set _et_pb_built_for_post_type value to 'page' if not exists.
[173] Fix | Delete
if ( $update_built_for_post_type ) {
[174] Fix | Delete
$post['postmeta'][] = array(
[175] Fix | Delete
'key' => '_et_pb_built_for_post_type',
[176] Fix | Delete
'value' => 'page',
[177] Fix | Delete
);
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
$processed_posts[] = $post;
[181] Fix | Delete
}
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
return $processed_posts;
[185] Fix | Delete
}
[186] Fix | Delete
add_filter( 'wp_import_posts', 'et_update_old_layouts_taxonomy', 10 );
[187] Fix | Delete
[188] Fix | Delete
if ( ! function_exists( 'et_pb_add_layout_filters' ) ) :
[189] Fix | Delete
/**
[190] Fix | Delete
* Add custom filters for posts in the Divi Library.
[191] Fix | Delete
*/
[192] Fix | Delete
function et_pb_add_layout_filters() {
[193] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification -- This function does not change any state, and is therefore not susceptible to CSRF.
[194] Fix | Delete
if ( isset( $_GET['post_type'] ) && 'et_pb_layout' === $_GET['post_type'] ) {
[195] Fix | Delete
$layout_categories = get_terms( 'layout_category' );
[196] Fix | Delete
$filter_category = array();
[197] Fix | Delete
$filter_category[''] = esc_html__( 'All Categories', 'et_builder' );
[198] Fix | Delete
[199] Fix | Delete
if ( is_array( $layout_categories ) && ! empty( $layout_categories ) ) {
[200] Fix | Delete
foreach ( $layout_categories as $category ) {
[201] Fix | Delete
$filter_category[ $category->slug ] = $category->name;
[202] Fix | Delete
}
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
$layout_packs = get_terms( 'layout_pack' );
[206] Fix | Delete
$filter_pack = array();
[207] Fix | Delete
$filter_pack[''] = esc_html_x( 'All Packs', 'Layout Packs', 'et_builder' );
[208] Fix | Delete
[209] Fix | Delete
if ( is_array( $layout_packs ) ) {
[210] Fix | Delete
foreach ( $layout_packs as $pack ) {
[211] Fix | Delete
$filter_pack[ $pack->slug ] = $pack->name;
[212] Fix | Delete
}
[213] Fix | Delete
}
[214] Fix | Delete
[215] Fix | Delete
$filter_layout_type = array(
[216] Fix | Delete
'' => esc_html__( 'All Types', 'et_builder' ),
[217] Fix | Delete
'module' => esc_html__( 'Modules', 'et_builder' ),
[218] Fix | Delete
'row' => esc_html__( 'Rows', 'et_builder' ),
[219] Fix | Delete
'section' => esc_html__( 'Sections', 'et_builder' ),
[220] Fix | Delete
'layout' => esc_html__( 'Layouts', 'et_builder' ),
[221] Fix | Delete
);
[222] Fix | Delete
[223] Fix | Delete
$filter_scope = array(
[224] Fix | Delete
'' => esc_html__( 'All Scopes', 'et_builder' ),
[225] Fix | Delete
'global' => esc_html__( 'Global', 'et_builder' ),
[226] Fix | Delete
'not_global' => esc_html__( 'Not Global', 'et_builder' ),
[227] Fix | Delete
);
[228] Fix | Delete
?>
[229] Fix | Delete
[230] Fix | Delete
<select name="layout_type">
[231] Fix | Delete
<?php
[232] Fix | Delete
$selected = isset( $_GET['layout_type'] ) ? sanitize_text_field( $_GET['layout_type'] ) : '';
[233] Fix | Delete
foreach ( $filter_layout_type as $value => $label ) {
[234] Fix | Delete
printf(
[235] Fix | Delete
'<option value="%1$s"%2$s>%3$s</option>',
[236] Fix | Delete
esc_attr( $value ),
[237] Fix | Delete
selected( $value, $selected ),
[238] Fix | Delete
esc_html( $label )
[239] Fix | Delete
);
[240] Fix | Delete
}
[241] Fix | Delete
?>
[242] Fix | Delete
</select>
[243] Fix | Delete
[244] Fix | Delete
<select name="scope">
[245] Fix | Delete
<?php
[246] Fix | Delete
$selected = isset( $_GET['scope'] ) ? sanitize_text_field( $_GET['scope'] ) : '';
[247] Fix | Delete
foreach ( $filter_scope as $value => $label ) {
[248] Fix | Delete
printf(
[249] Fix | Delete
'<option value="%1$s"%2$s>%3$s</option>',
[250] Fix | Delete
esc_attr( $value ),
[251] Fix | Delete
selected( $value, $selected ),
[252] Fix | Delete
esc_html( $label )
[253] Fix | Delete
);
[254] Fix | Delete
}
[255] Fix | Delete
?>
[256] Fix | Delete
</select>
[257] Fix | Delete
[258] Fix | Delete
<select name="layout_category">
[259] Fix | Delete
<?php
[260] Fix | Delete
$selected = isset( $_GET['layout_category'] ) ? sanitize_text_field( $_GET['layout_category'] ) : '';
[261] Fix | Delete
foreach ( $filter_category as $value => $label ) {
[262] Fix | Delete
printf(
[263] Fix | Delete
'<option value="%1$s"%2$s>%3$s</option>',
[264] Fix | Delete
esc_attr( $value ),
[265] Fix | Delete
selected( $value, $selected ),
[266] Fix | Delete
esc_html( $label )
[267] Fix | Delete
);
[268] Fix | Delete
}
[269] Fix | Delete
?>
[270] Fix | Delete
</select>
[271] Fix | Delete
[272] Fix | Delete
<select name="layout_pack">
[273] Fix | Delete
<?php
[274] Fix | Delete
$selected = isset( $_GET['layout_pack'] ) ? sanitize_text_field( $_GET['layout_pack'] ) : '';
[275] Fix | Delete
foreach ( $filter_pack as $value => $label ) {
[276] Fix | Delete
printf(
[277] Fix | Delete
'<option value="%1$s"%2$s>%3$s</option>',
[278] Fix | Delete
esc_attr( $value ),
[279] Fix | Delete
selected( $value, $selected ),
[280] Fix | Delete
esc_html( $label )
[281] Fix | Delete
);
[282] Fix | Delete
}
[283] Fix | Delete
?>
[284] Fix | Delete
</select>
[285] Fix | Delete
<?php
[286] Fix | Delete
// phpcs:enable
[287] Fix | Delete
}
[288] Fix | Delete
}
[289] Fix | Delete
endif;
[290] Fix | Delete
add_action( 'restrict_manage_posts', 'et_pb_add_layout_filters' );
[291] Fix | Delete
[292] Fix | Delete
if ( ! function_exists( 'et_pb_load_export_section' ) ) :
[293] Fix | Delete
/**
[294] Fix | Delete
* Add "Export Divi Layouts" button to the Divi Library page.
[295] Fix | Delete
*/
[296] Fix | Delete
function et_pb_load_export_section() {
[297] Fix | Delete
$current_screen = get_current_screen();
[298] Fix | Delete
[299] Fix | Delete
if ( 'edit-et_pb_layout' === $current_screen->id ) {
[300] Fix | Delete
// display wp error screen if library is disabled for current user.
[301] Fix | Delete
if ( ! et_pb_is_allowed( 'divi_library' ) || ! et_pb_is_allowed( 'add_library' ) || ! et_pb_is_allowed( 'save_library' ) ) {
[302] Fix | Delete
wp_die( esc_html__( "you don't have sufficient permissions to access this page", 'et_builder' ) );
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
add_action( 'all_admin_notices', 'et_pb_export_layouts_interface' );
[306] Fix | Delete
}
[307] Fix | Delete
}
[308] Fix | Delete
endif;
[309] Fix | Delete
add_action( 'load-edit.php', 'et_pb_load_export_section' );
[310] Fix | Delete
[311] Fix | Delete
if ( ! function_exists( 'et_pb_edit_library_categories' ) ) :
[312] Fix | Delete
/**
[313] Fix | Delete
* Enqueue script on Library Categories editing screen.
[314] Fix | Delete
*/
[315] Fix | Delete
function et_pb_edit_library_categories() {
[316] Fix | Delete
$current_screen = get_current_screen();
[317] Fix | Delete
[318] Fix | Delete
if ( 'edit-layout_category' === $current_screen->id || 'edit-layout_pack' === $current_screen->id ) {
[319] Fix | Delete
// display wp error screen if library is disabled for current user.
[320] Fix | Delete
if ( ! et_pb_is_allowed( 'divi_library' ) || ! et_pb_is_allowed( 'add_library' ) || ! et_pb_is_allowed( 'save_library' ) ) {
[321] Fix | Delete
wp_die( esc_html__( "you don't have sufficient permissions to access this page", 'et_builder' ) );
[322] Fix | Delete
}
[323] Fix | Delete
[324] Fix | Delete
wp_enqueue_script( 'builder-library-category', ET_BUILDER_URI . '/scripts/library_category.js', array( 'jquery' ), ET_BUILDER_VERSION, true );
[325] Fix | Delete
}
[326] Fix | Delete
}
[327] Fix | Delete
endif;
[328] Fix | Delete
add_action( 'load-edit-tags.php', 'et_pb_edit_library_categories' );
[329] Fix | Delete
[330] Fix | Delete
/**
[331] Fix | Delete
* Check whether the library editor page should be displayed or not.
[332] Fix | Delete
*/
[333] Fix | Delete
function et_pb_check_library_permissions() {
[334] Fix | Delete
$current_screen = get_current_screen();
[335] Fix | Delete
[336] Fix | Delete
if ( 'et_pb_layout' === $current_screen->id && ( ! et_pb_is_allowed( 'divi_library' ) || ! et_pb_is_allowed( 'save_library' ) ) ) {
[337] Fix | Delete
// display wp error screen if library is disabled for current user.
[338] Fix | Delete
wp_die( esc_html__( "you don't have sufficient permissions to access this page", 'et_builder' ) );
[339] Fix | Delete
}
[340] Fix | Delete
}
[341] Fix | Delete
add_action( 'load-post.php', 'et_pb_check_library_permissions' );
[342] Fix | Delete
[343] Fix | Delete
if ( ! function_exists( 'exclude_premade_layouts_library' ) ) :
[344] Fix | Delete
/**
[345] Fix | Delete
* Exclude premade layouts from the list of all templates in the library.
[346] Fix | Delete
*
[347] Fix | Delete
* @param WP_Query $query Query.
[348] Fix | Delete
*/
[349] Fix | Delete
function exclude_premade_layouts_library( $query ) {
[350] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification -- This function does not change any state, and is therefore not susceptible to CSRF.
[351] Fix | Delete
global $pagenow;
[352] Fix | Delete
$current_post_type = get_query_var( 'post_type' );
[353] Fix | Delete
[354] Fix | Delete
if ( is_admin() && 'edit.php' === $pagenow && $current_post_type && 'et_pb_layout' === $current_post_type ) {
[355] Fix | Delete
$meta_query = array(
[356] Fix | Delete
array(
[357] Fix | Delete
'key' => '_et_pb_predefined_layout',
[358] Fix | Delete
'value' => 'on',
[359] Fix | Delete
'compare' => 'NOT EXISTS',
[360] Fix | Delete
),
[361] Fix | Delete
);
[362] Fix | Delete
[363] Fix | Delete
$used_built_for_post_types = ET_Builder_Library::built_for_post_types( 'all' );
[364] Fix | Delete
if ( isset( $_GET['built_for'] ) && count( $used_built_for_post_types ) > 1 ) {
[365] Fix | Delete
$built_for_post_type = sanitize_text_field( $_GET['built_for'] );
[366] Fix | Delete
// get array of all standard post types if built_for is one of them.
[367] Fix | Delete
$built_for_post_type_processed = in_array( $built_for_post_type, ET_Builder_Library::built_for_post_types(), true ) ? ET_Builder_Library::built_for_post_types() : $built_for_post_type;
[368] Fix | Delete
[369] Fix | Delete
if ( in_array( $built_for_post_type, $used_built_for_post_types, true ) ) {
[370] Fix | Delete
$meta_query[] = array(
[371] Fix | Delete
'key' => '_et_pb_built_for_post_type',
[372] Fix | Delete
'value' => $built_for_post_type_processed,
[373] Fix | Delete
'compare' => 'IN',
[374] Fix | Delete
);
[375] Fix | Delete
}
[376] Fix | Delete
}
[377] Fix | Delete
[378] Fix | Delete
$query->set( 'meta_query', $meta_query );
[379] Fix | Delete
//phpcs:enable
[380] Fix | Delete
}
[381] Fix | Delete
[382] Fix | Delete
return $query;
[383] Fix | Delete
}
[384] Fix | Delete
endif;
[385] Fix | Delete
add_action( 'pre_get_posts', 'exclude_premade_layouts_library' );
[386] Fix | Delete
[387] Fix | Delete
if ( ! function_exists( 'exclude_premade_layouts_library_count' ) ) :
[388] Fix | Delete
/**
[389] Fix | Delete
* Post count for "mine" in post table relies to fixed value set by WP_Posts_List_Table->user_posts_count
[390] Fix | Delete
* Thus, exclude_premade_layouts_library() action doesn't automatically exclude premade layout and
[391] Fix | Delete
* it has to be late filtered via this exclude_premade_layouts_library_count().
[392] Fix | Delete
*
[393] Fix | Delete
* @see WP_Posts_List_Table->user_posts_count to see how mine post value is retrieved.
[394] Fix | Delete
*
[395] Fix | Delete
* @param array $views All views in post list table.
[396] Fix | Delete
* @return array
[397] Fix | Delete
*/
[398] Fix | Delete
function exclude_premade_layouts_library_count( $views ) {
[399] Fix | Delete
if ( isset( $views['mine'] ) ) {
[400] Fix | Delete
$current_user_id = get_current_user_id();
[401] Fix | Delete
[402] Fix | Delete
if ( isset( $_GET['author'] ) && ( $_GET['author'] === $current_user_id ) ) { // phpcs:ignore WordPress.Security.NonceVerification -- This function does not change any state, and is therefore not susceptible to CSRF.
[403] Fix | Delete
$class = 'current';
[404] Fix | Delete
[405] Fix | Delete
// Reuse current $wp_query global.
[406] Fix | Delete
global $wp_query;
[407] Fix | Delete
[408] Fix | Delete
$mine_posts_count = $wp_query->found_posts;
[409] Fix | Delete
} else {
[410] Fix | Delete
$class = '';
[411] Fix | Delete
[412] Fix | Delete
// Use WP_Query instead of plain MySQL SELECT because the custom field filtering uses
[413] Fix | Delete
// GROUP BY which needs FOUND_ROWS() and this has been automatically handled by WP_Query.
[414] Fix | Delete
$query = new WP_Query(
[415] Fix | Delete
array(
[416] Fix | Delete
'post_type' => 'et_pb_layout',
[417] Fix | Delete
'author' => $current_user_id,
[418] Fix | Delete
'meta_query' => array(
[419] Fix | Delete
'key' => '_et_pb_predefined_layout',
[420] Fix | Delete
'value' => 'on',
[421] Fix | Delete
'compare' => 'NOT EXISTS',
[422] Fix | Delete
),
[423] Fix | Delete
)
[424] Fix | Delete
);
[425] Fix | Delete
[426] Fix | Delete
$mine_posts_count = $query->found_posts;
[427] Fix | Delete
}
[428] Fix | Delete
[429] Fix | Delete
$url = add_query_arg(
[430] Fix | Delete
array(
[431] Fix | Delete
'post_type' => 'et_pb_layout',
[432] Fix | Delete
'author' => $current_user_id,
[433] Fix | Delete
),
[434] Fix | Delete
'edit.php'
[435] Fix | Delete
);
[436] Fix | Delete
[437] Fix | Delete
$views['mine'] = sprintf(
[438] Fix | Delete
'<a href="%1$s" class="%2$s">%3$s <span class="count">(%4$s)</span></a>',
[439] Fix | Delete
esc_url( $url ),
[440] Fix | Delete
esc_attr( $class ),
[441] Fix | Delete
esc_html__( 'Mine', 'et_builder' ),
[442] Fix | Delete
esc_html( intval( $mine_posts_count ) )
[443] Fix | Delete
);
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
return $views;
[447] Fix | Delete
}
[448] Fix | Delete
endif;
[449] Fix | Delete
add_filter( 'views_edit-et_pb_layout', 'exclude_premade_layouts_library_count' );
[450] Fix | Delete
[451] Fix | Delete
[452] Fix | Delete
if ( ! function_exists( 'et_pb_get_standard_post_types' ) ) :
[453] Fix | Delete
/**
[454] Fix | Delete
* Returns the standard '_et_pb_built_for_post_type' post types.
[455] Fix | Delete
*
[456] Fix | Delete
* @deprecated {@see ET_Builder_Post_Type_Layout::get_built_for_post_types()}
[457] Fix | Delete
*
[458] Fix | Delete
* @since 3.1 Deprecated.
[459] Fix | Delete
* @since 1.8
[460] Fix | Delete
*
[461] Fix | Delete
* @return string[]
[462] Fix | Delete
*/
[463] Fix | Delete
function et_pb_get_standard_post_types() {
[464] Fix | Delete
return ET_Builder_Library::built_for_post_types();
[465] Fix | Delete
}
[466] Fix | Delete
endif;
[467] Fix | Delete
[468] Fix | Delete
if ( ! function_exists( 'et_pb_get_used_built_for_post_types' ) ) :
[469] Fix | Delete
/**
[470] Fix | Delete
* Returns all current '_et_pb_built_for_post_type' post types.
[471] Fix | Delete
*
[472] Fix | Delete
* @deprecated {@see ET_Builder_Post_Type_Layout::get_built_for_post_types()}
[473] Fix | Delete
*
[474] Fix | Delete
* @since 3.1 Deprecated.
[475] Fix | Delete
* @since 1.8
[476] Fix | Delete
*
[477] Fix | Delete
* @return string[]
[478] Fix | Delete
*/
[479] Fix | Delete
function et_pb_get_used_built_for_post_types() {
[480] Fix | Delete
return ET_Builder_Library::built_for_post_types( 'all' );
[481] Fix | Delete
}
[482] Fix | Delete
endif;
[483] Fix | Delete
[484] Fix | Delete
if ( ! function_exists( 'et_pb_get_font_icon_symbols' ) ) :
[485] Fix | Delete
/**
[486] Fix | Delete
* Return fon icon symbols.
[487] Fix | Delete
*/
[488] Fix | Delete
function et_pb_get_font_icon_symbols() {
[489] Fix | Delete
$symbols = array( '&amp;#x21;', '&amp;#x22;', '&amp;#x23;', '&amp;#x24;', '&amp;#x25;', '&amp;#x26;', '&amp;#x27;', '&amp;#x28;', '&amp;#x29;', '&amp;#x2a;', '&amp;#x2b;', '&amp;#x2c;', '&amp;#x2d;', '&amp;#x2e;', '&amp;#x2f;', '&amp;#x30;', '&amp;#x31;', '&amp;#x32;', '&amp;#x33;', '&amp;#x34;', '&amp;#x35;', '&amp;#x36;', '&amp;#x37;', '&amp;#x38;', '&amp;#x39;', '&amp;#x3a;', '&amp;#x3b;', '&amp;#x3c;', '&amp;#x3d;', '&amp;#x3e;', '&amp;#x3f;', '&amp;#x40;', '&amp;#x41;', '&amp;#x42;', '&amp;#x43;', '&amp;#x44;', '&amp;#x45;', '&amp;#x46;', '&amp;#x47;', '&amp;#x48;', '&amp;#x49;', '&amp;#x4a;', '&amp;#x4b;', '&amp;#x4c;', '&amp;#x4d;', '&amp;#x4e;', '&amp;#x4f;', '&amp;#x50;', '&amp;#x51;', '&amp;#x52;', '&amp;#x53;', '&amp;#x54;', '&amp;#x55;', '&amp;#x56;', '&amp;#x57;', '&amp;#x58;', '&amp;#x59;', '&amp;#x5a;', '&amp;#x5b;', '&amp;#x5c;', '&amp;#x5d;', '&amp;#x5e;', '&amp;#x5f;', '&amp;#x60;', '&amp;#x61;', '&amp;#x62;', '&amp;#x63;', '&amp;#x64;', '&amp;#x65;', '&amp;#x66;', '&amp;#x67;', '&amp;#x68;', '&amp;#x69;', '&amp;#x6a;', '&amp;#x6b;', '&amp;#x6c;', '&amp;#x6d;', '&amp;#x6e;', '&amp;#x6f;', '&amp;#x70;', '&amp;#x71;', '&amp;#x72;', '&amp;#x73;', '&amp;#x74;', '&amp;#x75;', '&amp;#x76;', '&amp;#x77;', '&amp;#x78;', '&amp;#x79;', '&amp;#x7a;', '&amp;#x7b;', '&amp;#x7c;', '&amp;#x7d;', '&amp;#x7e;', '&amp;#xe000;', '&amp;#xe001;', '&amp;#xe002;', '&amp;#xe003;', '&amp;#xe004;', '&amp;#xe005;', '&amp;#xe006;', '&amp;#xe007;', '&amp;#xe009;', '&amp;#xe00a;', '&amp;#xe00b;', '&amp;#xe00c;', '&amp;#xe00d;', '&amp;#xe00e;', '&amp;#xe00f;', '&amp;#xe010;', '&amp;#xe011;', '&amp;#xe012;', '&amp;#xe013;', '&amp;#xe014;', '&amp;#xe015;', '&amp;#xe016;', '&amp;#xe017;', '&amp;#xe018;', '&amp;#xe019;', '&amp;#xe01a;', '&amp;#xe01b;', '&amp;#xe01c;', '&amp;#xe01d;', '&amp;#xe01e;', '&amp;#xe01f;', '&amp;#xe020;', '&amp;#xe021;', '&amp;#xe022;', '&amp;#xe023;', '&amp;#xe024;', '&amp;#xe025;', '&amp;#xe026;', '&amp;#xe027;', '&amp;#xe028;', '&amp;#xe029;', '&amp;#xe02a;', '&amp;#xe02b;', '&amp;#xe02c;', '&amp;#xe02d;', '&amp;#xe02e;', '&amp;#xe02f;', '&amp;#xe030;', '&amp;#xe103;', '&amp;#xe0ee;', '&amp;#xe0ef;', '&amp;#xe0e8;', '&amp;#xe0ea;', '&amp;#xe101;', '&amp;#xe107;', '&amp;#xe108;', '&amp;#xe102;', '&amp;#xe106;', '&amp;#xe0eb;', '&amp;#xe010;', '&amp;#xe105;', '&amp;#xe0ed;', '&amp;#xe100;', '&amp;#xe104;', '&amp;#xe0e9;', '&amp;#xe109;', '&amp;#xe0ec;', '&amp;#xe0fe;', '&amp;#xe0f6;', '&amp;#xe0fb;', '&amp;#xe0e2;', '&amp;#xe0e3;', '&amp;#xe0f5;', '&amp;#xe0e1;', '&amp;#xe0ff;', '&amp;#xe031;', '&amp;#xe032;', '&amp;#xe033;', '&amp;#xe034;', '&amp;#xe035;', '&amp;#xe036;', '&amp;#xe037;', '&amp;#xe038;', '&amp;#xe039;', '&amp;#xe03a;', '&amp;#xe03b;', '&amp;#xe03c;', '&amp;#xe03d;', '&amp;#xe03e;', '&amp;#xe03f;', '&amp;#xe040;', '&amp;#xe041;', '&amp;#xe042;', '&amp;#xe043;', '&amp;#xe044;', '&amp;#xe045;', '&amp;#xe046;', '&amp;#xe047;', '&amp;#xe048;', '&amp;#xe049;', '&amp;#xe04a;', '&amp;#xe04b;', '&amp;#xe04c;', '&amp;#xe04d;', '&amp;#xe04e;', '&amp;#xe04f;', '&amp;#xe050;', '&amp;#xe051;', '&amp;#xe052;', '&amp;#xe053;', '&amp;#xe054;', '&amp;#xe055;', '&amp;#xe056;', '&amp;#xe057;', '&amp;#xe058;', '&amp;#xe059;', '&amp;#xe05a;', '&amp;#xe05b;', '&amp;#xe05c;', '&amp;#xe05d;', '&amp;#xe05e;', '&amp;#xe05f;', '&amp;#xe060;', '&amp;#xe061;', '&amp;#xe062;', '&amp;#xe063;', '&amp;#xe064;', '&amp;#xe065;', '&amp;#xe066;', '&amp;#xe067;', '&amp;#xe068;', '&amp;#xe069;', '&amp;#xe06a;', '&amp;#xe06b;', '&amp;#xe06c;', '&amp;#xe06d;', '&amp;#xe06e;', '&amp;#xe06f;', '&amp;#xe070;', '&amp;#xe071;', '&amp;#xe072;', '&amp;#xe073;', '&amp;#xe074;', '&amp;#xe075;', '&amp;#xe076;', '&amp;#xe077;', '&amp;#xe078;', '&amp;#xe079;', '&amp;#xe07a;', '&amp;#xe07b;', '&amp;#xe07c;', '&amp;#xe07d;', '&amp;#xe07e;', '&amp;#xe07f;', '&amp;#xe080;', '&amp;#xe081;', '&amp;#xe082;', '&amp;#xe083;', '&amp;#xe084;', '&amp;#xe085;', '&amp;#xe086;', '&amp;#xe087;', '&amp;#xe088;', '&amp;#xe089;', '&amp;#xe08a;', '&amp;#xe08b;', '&amp;#xe08c;', '&amp;#xe08d;', '&amp;#xe08e;', '&amp;#xe08f;', '&amp;#xe090;', '&amp;#xe091;', '&amp;#xe092;', '&amp;#xe0f8;', '&amp;#xe0fa;', '&amp;#xe0e7;', '&amp;#xe0fd;', '&amp;#xe0e4;', '&amp;#xe0e5;', '&amp;#xe0f7;', '&amp;#xe0e0;', '&amp;#xe0fc;', '&amp;#xe0f9;', '&amp;#xe0dd;', '&amp;#xe0f1;', '&amp;#xe0dc;', '&amp;#xe0f3;', '&amp;#xe0d8;', '&amp;#xe0db;', '&amp;#xe0f0;', '&amp;#xe0df;', '&amp;#xe0f2;', '&amp;#xe0f4;', '&amp;#xe0d9;', '&amp;#xe0da;', '&amp;#xe0de;', '&amp;#xe0e6;', '&amp;#xe093;', '&amp;#xe094;', '&amp;#xe095;', '&amp;#xe096;', '&amp;#xe097;', '&amp;#xe098;', '&amp;#xe099;', '&amp;#xe09a;', '&amp;#xe09b;', '&amp;#xe09c;', '&amp;#xe09d;', '&amp;#xe09e;', '&amp;#xe09f;', '&amp;#xe0a0;', '&amp;#xe0a1;', '&amp;#xe0a2;', '&amp;#xe0a3;', '&amp;#xe0a4;', '&amp;#xe0a5;', '&amp;#xe0a6;', '&amp;#xe0a7;', '&amp;#xe0a8;', '&amp;#xe0a9;', '&amp;#xe0aa;', '&amp;#xe0ab;', '&amp;#xe0ac;', '&amp;#xe0ad;', '&amp;#xe0ae;', '&amp;#xe0af;', '&amp;#xe0b0;', '&amp;#xe0b1;', '&amp;#xe0b2;', '&amp;#xe0b3;', '&amp;#xe0b4;', '&amp;#xe0b5;', '&amp;#xe0b6;', '&amp;#xe0b7;', '&amp;#xe0b8;', '&amp;#xe0b9;', '&amp;#xe0ba;', '&amp;#xe0bb;', '&amp;#xe0bc;', '&amp;#xe0bd;', '&amp;#xe0be;', '&amp;#xe0bf;', '&amp;#xe0c0;', '&amp;#xe0c1;', '&amp;#xe0c2;', '&amp;#xe0c3;', '&amp;#xe0c4;', '&amp;#xe0c5;', '&amp;#xe0c6;', '&amp;#xe0c7;', '&amp;#xe0c8;', '&amp;#xe0c9;', '&amp;#xe0ca;', '&amp;#xe0cb;', '&amp;#xe0cc;', '&amp;#xe0cd;', '&amp;#xe0ce;', '&amp;#xe0cf;', '&amp;#xe0d0;', '&amp;#xe0d1;', '&amp;#xe0d2;', '&amp;#xe0d3;', '&amp;#xe0d4;', '&amp;#xe0d5;', '&amp;#xe0d6;', '&amp;#xe0d7;', '&amp;#xe600;', '&amp;#xe601;', '&amp;#xe602;', '&amp;#xe603;', '&amp;#xe604;', '&amp;#xe605;', '&amp;#xe606;', '&amp;#xe607;', '&amp;#xe608;', '&amp;#xe609;', '&amp;#xe60a;', '&amp;#xe60b;', '&amp;#xe60c;', '&amp;#xe60d;', '&amp;#xe60e;', '&amp;#xe60f;', '&amp;#xe610;', '&amp;#xe611;', '&amp;#xe612;', '&amp;#xe008;' );
[490] Fix | Delete
[491] Fix | Delete
$symbols = apply_filters( 'et_pb_font_icon_symbols', $symbols );
[492] Fix | Delete
[493] Fix | Delete
return $symbols;
[494] Fix | Delete
}
[495] Fix | Delete
endif;
[496] Fix | Delete
[497] Fix | Delete
if ( ! function_exists( 'et_pb_get_font_icon_list' ) ) :
[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