Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/core/componen...
File: init.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if ( ! function_exists( 'et_core_init' ) ):
[2] Fix | Delete
/**
[3] Fix | Delete
* {@see 'plugins_loaded' (9999999) Must run after cache plugins have been loaded.}
[4] Fix | Delete
*/
[5] Fix | Delete
function et_core_init() {
[6] Fix | Delete
ET_Core_API_Spam_Providers::instance();
[7] Fix | Delete
ET_Core_Cache_Directory::instance();
[8] Fix | Delete
ET_Core_PageResource::startup();
[9] Fix | Delete
ET_Core_CompatibilityWarning::instance();
[10] Fix | Delete
[11] Fix | Delete
if ( defined( 'ET_CORE_UPDATED' ) ) {
[12] Fix | Delete
global $wp_rewrite;
[13] Fix | Delete
add_action( 'shutdown', array( $wp_rewrite, 'flush_rules' ) );
[14] Fix | Delete
[15] Fix | Delete
update_option( 'et_core_page_resource_remove_all', true );
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
$cache_dir = ET_Core_PageResource::get_cache_directory();
[19] Fix | Delete
[20] Fix | Delete
if ( file_exists( $cache_dir . '/DONOTCACHEPAGE' ) ) {
[21] Fix | Delete
! defined( 'DONOTCACHEPAGE' ) ? define( 'DONOTCACHEPAGE', true ) : '';
[22] Fix | Delete
@unlink( $cache_dir . '/DONOTCACHEPAGE' );
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
if ( get_option( 'et_core_page_resource_remove_all' ) ) {
[26] Fix | Delete
ET_Core_PageResource::remove_static_resources( 'all', 'all', true );
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
if ( ! wp_next_scheduled( 'et_core_page_resource_auto_clear' ) ) {
[30] Fix | Delete
wp_schedule_event( time() + MONTH_IN_SECONDS, 'monthly', 'et_core_page_resource_auto_clear' );
[31] Fix | Delete
}
[32] Fix | Delete
}
[33] Fix | Delete
endif;
[34] Fix | Delete
[35] Fix | Delete
if ( ! function_exists( 'et_core_site_has_builder' ) ):
[36] Fix | Delete
/**
[37] Fix | Delete
* Check is `et_core_site_has_builder` allowed.
[38] Fix | Delete
* We can clear cache managed by 3rd party plugins only
[39] Fix | Delete
* if Divi, Extra, or the Divi Builder plugin
[40] Fix | Delete
* is active when the core was called.
[41] Fix | Delete
*
[42] Fix | Delete
* @return boolean
[43] Fix | Delete
*/
[44] Fix | Delete
function et_core_site_has_builder() {
[45] Fix | Delete
global $shortname;
[46] Fix | Delete
$core_path = get_transient( 'et_core_path' );
[47] Fix | Delete
$is_divi_builder_plugin_active = false;
[48] Fix | Delete
if ( ! empty( $core_path ) && false !== strpos( $core_path, '/divi-builder/' ) && function_exists('is_plugin_active') ) {
[49] Fix | Delete
$is_divi_builder_plugin_active = is_plugin_active( 'divi-builder/divi-builder.php' );
[50] Fix | Delete
}
[51] Fix | Delete
if( $is_divi_builder_plugin_active || in_array( $shortname, array( 'divi', 'extra' ) ) ) {
[52] Fix | Delete
return true;
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
return false;
[56] Fix | Delete
}
[57] Fix | Delete
endif;
[58] Fix | Delete
[59] Fix | Delete
if ( ! function_exists( 'et_core_clear_wp_cache' ) ):
[60] Fix | Delete
function et_core_clear_wp_cache( $post_id = '' ) {
[61] Fix | Delete
if ( ( ! wp_doing_cron() && ! et_core_security_check_passed( 'edit_posts' ) ) || ! et_core_site_has_builder() ) {
[62] Fix | Delete
return;
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
try {
[66] Fix | Delete
// Cache Plugins
[67] Fix | Delete
// Comet Cache
[68] Fix | Delete
if ( is_callable( 'comet_cache::clear' ) ) {
[69] Fix | Delete
comet_cache::clear();
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
// WP Rocket
[73] Fix | Delete
if ( function_exists( 'rocket_clean_post' ) ) {
[74] Fix | Delete
if ( '' !== $post_id ) {
[75] Fix | Delete
rocket_clean_post( $post_id );
[76] Fix | Delete
} else if ( function_exists( 'rocket_clean_domain' ) ) {
[77] Fix | Delete
rocket_clean_domain();
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
// W3 Total Cache
[82] Fix | Delete
if ( has_action( 'w3tc_flush_post' ) ) {
[83] Fix | Delete
'' !== $post_id ? do_action( 'w3tc_flush_post', $post_id ) : do_action( 'w3tc_flush_posts' );
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
// WP Super Cache
[87] Fix | Delete
if ( function_exists( 'wp_cache_debug' ) && defined( 'WPCACHEHOME' ) ) {
[88] Fix | Delete
include_once WPCACHEHOME . 'wp-cache-phase1.php';
[89] Fix | Delete
include_once WPCACHEHOME . 'wp-cache-phase2.php';
[90] Fix | Delete
[91] Fix | Delete
if ( '' !== $post_id && function_exists( 'clear_post_supercache' ) ) {
[92] Fix | Delete
clear_post_supercache( $post_id );
[93] Fix | Delete
} else if ( '' === $post_id && function_exists( 'wp_cache_clear_cache_on_menu' ) ) {
[94] Fix | Delete
wp_cache_clear_cache_on_menu();
[95] Fix | Delete
}
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
// WP Fastest Cache
[99] Fix | Delete
if ( isset( $GLOBALS['wp_fastest_cache'] ) ) {
[100] Fix | Delete
if ( '' !== $post_id && method_exists( $GLOBALS['wp_fastest_cache'], 'singleDeleteCache' ) ) {
[101] Fix | Delete
$GLOBALS['wp_fastest_cache']->singleDeleteCache( $post_id );
[102] Fix | Delete
} else if ( '' === $post_id && method_exists( $GLOBALS['wp_fastest_cache'], 'deleteCache' ) ) {
[103] Fix | Delete
$GLOBALS['wp_fastest_cache']->deleteCache();
[104] Fix | Delete
}
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
// Hummingbird
[108] Fix | Delete
if ( has_action( 'wphb_clear_page_cache' ) ) {
[109] Fix | Delete
'' !== $post_id ? do_action( 'wphb_clear_page_cache', $post_id ) : do_action( 'wphb_clear_page_cache' );
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
// WordPress Cache Enabler
[113] Fix | Delete
if ( has_action( 'ce_clear_cache' ) ) {
[114] Fix | Delete
'' !== $post_id ? do_action( 'ce_clear_post_cache', $post_id ) : do_action( 'ce_clear_cache' );
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
// LiteSpeed Cache
[118] Fix | Delete
if ( is_callable( 'LiteSpeed_Cache::get_instance' ) ) {
[119] Fix | Delete
$litespeed = LiteSpeed_Cache::get_instance();
[120] Fix | Delete
[121] Fix | Delete
if ( '' !== $post_id && method_exists( $litespeed, 'purge_post' ) ) {
[122] Fix | Delete
$litespeed->purge_post( $post_id );
[123] Fix | Delete
} else if ( '' === $post_id && method_exists( $litespeed, 'purge_all' ) ) {
[124] Fix | Delete
$litespeed->purge_all();
[125] Fix | Delete
}
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
// LiteSpeed Cache v1.1.3+
[129] Fix | Delete
if ( '' !== $post_id && function_exists( 'litespeed_purge_single_post' ) ) {
[130] Fix | Delete
litespeed_purge_single_post( $post_id );
[131] Fix | Delete
} else if ( '' === $post_id && is_callable( 'LiteSpeed_Cache_API::purge_all' ) ) {
[132] Fix | Delete
LiteSpeed_Cache_API::purge_all();
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
// Hyper Cache
[136] Fix | Delete
if ( class_exists( 'HyperCache' ) && isset( HyperCache::$instance ) ) {
[137] Fix | Delete
if ( '' !== $post_id && method_exists( HyperCache::$instance, 'clean_post' ) ) {
[138] Fix | Delete
HyperCache::$instance->clean_post( $post_id );
[139] Fix | Delete
} else if ( '' === $post_id && method_exists( HyperCache::$instance, 'clean' ) ) {
[140] Fix | Delete
HyperCache::$instance->clean_post( $post_id );
[141] Fix | Delete
}
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
// Hosting Provider Caching
[145] Fix | Delete
// Pantheon Advanced Page Cache
[146] Fix | Delete
$pantheon_clear = 'pantheon_wp_clear_edge_keys';
[147] Fix | Delete
$pantheon_clear_all = 'pantheon_wp_clear_edge_all';
[148] Fix | Delete
if ( function_exists( $pantheon_clear ) || function_exists( $pantheon_clear_all ) ) {
[149] Fix | Delete
if ( '' !== $post_id && function_exists( $pantheon_clear ) ) {
[150] Fix | Delete
pantheon_wp_clear_edge_keys( array( "post-{$post_id}" ) );
[151] Fix | Delete
} else if ( '' === $post_id && function_exists( $pantheon_clear_all ) ) {
[152] Fix | Delete
pantheon_wp_clear_edge_all();
[153] Fix | Delete
}
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
// Siteground
[157] Fix | Delete
if ( isset( $GLOBALS['sg_cachepress_supercacher'] ) ) {
[158] Fix | Delete
global $sg_cachepress_supercacher;
[159] Fix | Delete
[160] Fix | Delete
if ( is_object( $sg_cachepress_supercacher ) && method_exists( $sg_cachepress_supercacher, 'purge_cache' ) ) {
[161] Fix | Delete
$sg_cachepress_supercacher->purge_cache( true );
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
} else if ( function_exists( 'sg_cachepress_purge_cache' ) ) {
[165] Fix | Delete
sg_cachepress_purge_cache();
[166] Fix | Delete
}
[167] Fix | Delete
[168] Fix | Delete
// WP Engine
[169] Fix | Delete
if ( class_exists( 'WpeCommon' ) ) {
[170] Fix | Delete
is_callable( 'WpeCommon::purge_memcached' ) ? WpeCommon::purge_memcached() : '';
[171] Fix | Delete
is_callable( 'WpeCommon::clear_maxcdn_cache' ) ? WpeCommon::clear_maxcdn_cache() : '';
[172] Fix | Delete
is_callable( 'WpeCommon::purge_varnish_cache' ) ? WpeCommon::purge_varnish_cache() : '';
[173] Fix | Delete
[174] Fix | Delete
if ( is_callable( 'WpeCommon::instance' ) && $instance = WpeCommon::instance() ) {
[175] Fix | Delete
method_exists( $instance, 'purge_object_cache' ) ? $instance->purge_object_cache() : '';
[176] Fix | Delete
}
[177] Fix | Delete
}
[178] Fix | Delete
[179] Fix | Delete
// Bluehost
[180] Fix | Delete
if ( class_exists( 'Endurance_Page_Cache' ) ) {
[181] Fix | Delete
wp_doing_ajax() ? ET_Core_LIB_BluehostCache::get_instance()->clear( $post_id ) : do_action( 'epc_purge' );
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
// Pressable.
[185] Fix | Delete
if ( isset( $GLOBALS['batcache'] ) && is_object( $GLOBALS['batcache'] ) ) {
[186] Fix | Delete
wp_cache_flush();
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
// Cloudways - Breeze.
[190] Fix | Delete
if ( class_exists( 'Breeze_Admin' ) ) {
[191] Fix | Delete
$breeze_admin = new Breeze_Admin();
[192] Fix | Delete
$breeze_admin->breeze_clear_all_cache();
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
// Kinsta.
[196] Fix | Delete
if ( class_exists( '\Kinsta\Cache' ) && isset( $GLOBALS['kinsta_cache'] ) && is_object( $GLOBALS['kinsta_cache'] ) ) {
[197] Fix | Delete
global $kinsta_cache;
[198] Fix | Delete
[199] Fix | Delete
if ( isset( $kinsta_cache->kinsta_cache_purge ) && method_exists( $kinsta_cache->kinsta_cache_purge, 'purge_complete_caches' ) ) {
[200] Fix | Delete
$kinsta_cache->kinsta_cache_purge->purge_complete_caches();
[201] Fix | Delete
}
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
// GoDaddy.
[205] Fix | Delete
if ( class_exists( '\WPaaS\Cache' ) ) {
[206] Fix | Delete
if ( ! \WPaaS\Cache::has_ban() ) {
[207] Fix | Delete
remove_action( 'shutdown', array( '\WPaaS\Cache', 'purge' ), PHP_INT_MAX );
[208] Fix | Delete
add_action( 'shutdown', array( '\WPaaS\Cache', 'ban' ), PHP_INT_MAX );
[209] Fix | Delete
}
[210] Fix | Delete
}
[211] Fix | Delete
[212] Fix | Delete
// Complimentary Performance Plugins
[213] Fix | Delete
// Autoptimize
[214] Fix | Delete
if ( is_callable( 'autoptimizeCache::clearall' ) ) {
[215] Fix | Delete
autoptimizeCache::clearall();
[216] Fix | Delete
}
[217] Fix | Delete
[218] Fix | Delete
// WP Optimize.
[219] Fix | Delete
if ( class_exists( 'WP_Optimize' ) && defined( 'WPO_PLUGIN_MAIN_PATH' ) ) {
[220] Fix | Delete
if ( '' !== $post_id && is_callable( 'WPO_Page_Cache::delete_single_post_cache' ) ) {
[221] Fix | Delete
WPO_Page_Cache::delete_single_post_cache( $post_id );
[222] Fix | Delete
} elseif ( is_callable( array( 'WP_Optimize', 'get_page_cache' ) ) && is_callable( array( WP_Optimize()->get_page_cache(), 'purge' ) ) ) {
[223] Fix | Delete
WP_Optimize()->get_page_cache()->purge();
[224] Fix | Delete
}
[225] Fix | Delete
}
[226] Fix | Delete
} catch( Exception $err ) {
[227] Fix | Delete
ET_Core_Logger::error( 'An exception occurred while attempting to clear site cache.' );
[228] Fix | Delete
}
[229] Fix | Delete
}
[230] Fix | Delete
endif;
[231] Fix | Delete
[232] Fix | Delete
[233] Fix | Delete
if ( ! function_exists( 'et_core_get_nonces' ) ):
[234] Fix | Delete
/**
[235] Fix | Delete
* Returns the nonces for this component group.
[236] Fix | Delete
*
[237] Fix | Delete
* @return string[]
[238] Fix | Delete
*/
[239] Fix | Delete
function et_core_get_nonces() {
[240] Fix | Delete
static $nonces = null;
[241] Fix | Delete
[242] Fix | Delete
return $nonces ? $nonces : $nonces = array(
[243] Fix | Delete
'clear_page_resources_nonce' => wp_create_nonce( 'clear_page_resources' ),
[244] Fix | Delete
);
[245] Fix | Delete
}
[246] Fix | Delete
endif;
[247] Fix | Delete
[248] Fix | Delete
[249] Fix | Delete
if ( ! function_exists( 'et_core_page_resource_auto_clear' ) ):
[250] Fix | Delete
function et_core_page_resource_auto_clear() {
[251] Fix | Delete
ET_Core_PageResource::remove_static_resources( 'all', 'all' );
[252] Fix | Delete
}
[253] Fix | Delete
add_action( 'switch_theme', 'et_core_page_resource_auto_clear' );
[254] Fix | Delete
add_action( 'activated_plugin', 'et_core_page_resource_auto_clear', 10, 0 );
[255] Fix | Delete
add_action( 'deactivated_plugin', 'et_core_page_resource_auto_clear', 10, 0 );
[256] Fix | Delete
add_action( 'et_core_page_resource_auto_clear', 'et_core_page_resource_auto_clear' );
[257] Fix | Delete
endif;
[258] Fix | Delete
[259] Fix | Delete
[260] Fix | Delete
if ( ! function_exists( 'et_core_page_resource_clear' ) ):
[261] Fix | Delete
/**
[262] Fix | Delete
* Ajax handler for clearing cached page resources.
[263] Fix | Delete
*/
[264] Fix | Delete
function et_core_page_resource_clear() {
[265] Fix | Delete
et_core_security_check( 'manage_options', 'clear_page_resources' );
[266] Fix | Delete
[267] Fix | Delete
if ( empty( $_POST['et_post_id'] ) ) {
[268] Fix | Delete
et_core_die();
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
$post_id = sanitize_key( $_POST['et_post_id'] );
[272] Fix | Delete
$owner = sanitize_key( $_POST['et_owner'] );
[273] Fix | Delete
[274] Fix | Delete
ET_Core_PageResource::remove_static_resources( $post_id, $owner );
[275] Fix | Delete
}
[276] Fix | Delete
add_action( 'wp_ajax_et_core_page_resource_clear', 'et_core_page_resource_clear' );
[277] Fix | Delete
endif;
[278] Fix | Delete
[279] Fix | Delete
[280] Fix | Delete
if ( ! function_exists( 'et_core_page_resource_fallback' ) ):
[281] Fix | Delete
/**
[282] Fix | Delete
* Handles page resource fallback requests.
[283] Fix | Delete
*/
[284] Fix | Delete
function et_core_page_resource_fallback() {
[285] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
[286] Fix | Delete
if ( ! isset( $_GET['et_core_page_resource'] ) ) {
[287] Fix | Delete
return;
[288] Fix | Delete
}
[289] Fix | Delete
[290] Fix | Delete
if ( is_admin() && ! is_customize_preview() ) {
[291] Fix | Delete
return;
[292] Fix | Delete
}
[293] Fix | Delete
[294] Fix | Delete
/** @see ET_Core_SupportCenter::toggle_safe_mode */
[295] Fix | Delete
if ( et_core_is_safe_mode_active() ) {
[296] Fix | Delete
return;
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
$resource_id = sanitize_text_field( $_GET['et_core_page_resource'] );
[300] Fix | Delete
$pattern = '/et-(\w+)-([\w-]+)-cached-inline-(?>styles|scripts)(global|\d+)/';
[301] Fix | Delete
$has_matches = preg_match( $pattern, $resource_id, $matches );
[302] Fix | Delete
[303] Fix | Delete
if ( $has_matches ) {
[304] Fix | Delete
$resource = et_core_page_resource_get( $matches[1], $matches[2], $matches[3] );
[305] Fix | Delete
[306] Fix | Delete
if ( $resource->has_file() ) {
[307] Fix | Delete
wp_redirect( $resource->URL );
[308] Fix | Delete
die();
[309] Fix | Delete
}
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
status_header( 404 );
[313] Fix | Delete
nocache_headers();
[314] Fix | Delete
die();
[315] Fix | Delete
// phpcs:enable
[316] Fix | Delete
}
[317] Fix | Delete
add_action( 'init', 'et_core_page_resource_fallback', 0 );
[318] Fix | Delete
endif;
[319] Fix | Delete
[320] Fix | Delete
[321] Fix | Delete
if ( ! function_exists( 'et_core_page_resource_get' ) ):
[322] Fix | Delete
/**
[323] Fix | Delete
* Get a page resource instance.
[324] Fix | Delete
*
[325] Fix | Delete
* @param string $owner The owner of the instance (core|divi|builder|bloom|monarch|custom).
[326] Fix | Delete
* @param string $slug A string that uniquely identifies the resource.
[327] Fix | Delete
* @param string|int $post_id The post id that the resource is associated with or `global`.
[328] Fix | Delete
* If `null`, the return value of {@link get_the_ID()} will be used.
[329] Fix | Delete
* @param string $type The resource type (style|script). Default: `style`.
[330] Fix | Delete
* @param string $location Where the resource should be output (head|footer). Default: `head-late`.
[331] Fix | Delete
*
[332] Fix | Delete
* @return ET_Core_PageResource
[333] Fix | Delete
*/
[334] Fix | Delete
function et_core_page_resource_get( $owner, $slug, $post_id = null, $priority = 10, $location = 'head-late', $type = 'style' ) {
[335] Fix | Delete
$post_id = $post_id ? $post_id : et_core_page_resource_get_the_ID();
[336] Fix | Delete
$_slug = "et-{$owner}-{$slug}-{$post_id}-cached-inline-{$type}s";
[337] Fix | Delete
[338] Fix | Delete
$all_resources = ET_Core_PageResource::get_resources();
[339] Fix | Delete
[340] Fix | Delete
return isset( $all_resources[ $_slug ] )
[341] Fix | Delete
? $all_resources[ $_slug ]
[342] Fix | Delete
: new ET_Core_PageResource( $owner, $slug, $post_id, $priority, $location, $type );
[343] Fix | Delete
}
[344] Fix | Delete
endif;
[345] Fix | Delete
[346] Fix | Delete
[347] Fix | Delete
if ( ! function_exists( 'et_core_page_resource_maybe_output_fallback_script' ) ):
[348] Fix | Delete
function et_core_page_resource_maybe_output_fallback_script() {
[349] Fix | Delete
if ( is_admin() && ! is_customize_preview() ) {
[350] Fix | Delete
return;
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
if ( function_exists( 'et_get_option' ) && 'off' === et_get_option( 'et_pb_static_css_file', 'on' ) ) {
[354] Fix | Delete
return;
[355] Fix | Delete
}
[356] Fix | Delete
[357] Fix | Delete
/** @see ET_Core_SupportCenter::toggle_safe_mode */
[358] Fix | Delete
if ( et_core_is_safe_mode_active() ) {
[359] Fix | Delete
return;
[360] Fix | Delete
}
[361] Fix | Delete
[362] Fix | Delete
$IS_SINGULAR = et_core_page_resource_is_singular();
[363] Fix | Delete
$POST_ID = $IS_SINGULAR ? et_core_page_resource_get_the_ID() : 'global';
[364] Fix | Delete
[365] Fix | Delete
if ( $IS_SINGULAR && 'off' === get_post_meta( $POST_ID, '_et_pb_static_css_file', true ) ) {
[366] Fix | Delete
return;
[367] Fix | Delete
}
[368] Fix | Delete
[369] Fix | Delete
$SITE_URL = get_site_url();
[370] Fix | Delete
$SCRIPT = et_()->WPFS()->get_contents( ET_CORE_PATH . 'admin/js/page-resource-fallback.min.js' );
[371] Fix | Delete
[372] Fix | Delete
printf( "<script>var et_site_url='%s';var et_post_id='%d';%s</script>",
[373] Fix | Delete
et_core_esc_previously( $SITE_URL ),
[374] Fix | Delete
et_core_esc_previously( $POST_ID ),
[375] Fix | Delete
et_core_esc_previously( $SCRIPT )
[376] Fix | Delete
);
[377] Fix | Delete
}
[378] Fix | Delete
add_action( 'wp_head', 'et_core_page_resource_maybe_output_fallback_script', 0 );
[379] Fix | Delete
endif;
[380] Fix | Delete
[381] Fix | Delete
[382] Fix | Delete
if ( ! function_exists( 'et_core_page_resource_get_the_ID' ) ):
[383] Fix | Delete
function et_core_page_resource_get_the_ID() {
[384] Fix | Delete
static $post_id = null;
[385] Fix | Delete
[386] Fix | Delete
if ( is_int( $post_id ) ) {
[387] Fix | Delete
return $post_id;
[388] Fix | Delete
}
[389] Fix | Delete
[390] Fix | Delete
return $post_id = apply_filters( 'et_core_page_resource_current_post_id', get_the_ID() );
[391] Fix | Delete
}
[392] Fix | Delete
endif;
[393] Fix | Delete
[394] Fix | Delete
[395] Fix | Delete
if ( ! function_exists( 'et_core_page_resource_is_singular' ) ):
[396] Fix | Delete
function et_core_page_resource_is_singular() {
[397] Fix | Delete
return apply_filters( 'et_core_page_resource_is_singular', is_singular() );
[398] Fix | Delete
}
[399] Fix | Delete
endif;
[400] Fix | Delete
[401] Fix | Delete
[402] Fix | Delete
if ( ! function_exists( 'et_core_page_resource_register_fallback_query' ) ):
[403] Fix | Delete
function et_core_page_resource_register_fallback_query() {
[404] Fix | Delete
add_rewrite_tag( '%et_core_page_resource%', '([\w\d-]+)' );
[405] Fix | Delete
}
[406] Fix | Delete
add_action( 'init', 'et_core_page_resource_register_fallback_query', 11 );
[407] Fix | Delete
endif;
[408] Fix | Delete
[409] Fix | Delete
[410] Fix | Delete
if ( ! function_exists( 'et_debug' ) ):
[411] Fix | Delete
function et_debug( $msg, $bt_index = 4, $log_ajax = true ) {
[412] Fix | Delete
ET_Core_Logger::debug( $msg, $bt_index, $log_ajax );
[413] Fix | Delete
}
[414] Fix | Delete
endif;
[415] Fix | Delete
[416] Fix | Delete
[417] Fix | Delete
if ( ! function_exists( 'et_wrong' ) ):
[418] Fix | Delete
function et_wrong( $msg, $error = false ) {
[419] Fix | Delete
$msg = "You're Doing It Wrong! {$msg}";
[420] Fix | Delete
[421] Fix | Delete
if ( $error ) {
[422] Fix | Delete
et_error( $msg );
[423] Fix | Delete
} else {
[424] Fix | Delete
et_debug( $msg );
[425] Fix | Delete
}
[426] Fix | Delete
}
[427] Fix | Delete
endif;
[428] Fix | Delete
[429] Fix | Delete
[430] Fix | Delete
if ( ! function_exists( 'et_error' ) ):
[431] Fix | Delete
function et_error( $msg, $bt_index = 4 ) {
[432] Fix | Delete
ET_Core_Logger::error( "[ERROR]: {$msg}", $bt_index );
[433] Fix | Delete
}
[434] Fix | Delete
endif;
[435] Fix | Delete
[436] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function