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/wp-inclu...
File: functions.php
* @ignore
[7000] Fix | Delete
* @since 3.0.0
[7001] Fix | Delete
*
[7002] Fix | Delete
* @param string $column Database column.
[7003] Fix | Delete
* @return string SQL clause.
[7004] Fix | Delete
*/
[7005] Fix | Delete
function _wp_mysql_week( $column ) {
[7006] Fix | Delete
$start_of_week = (int) get_option( 'start_of_week' );
[7007] Fix | Delete
switch ( $start_of_week ) {
[7008] Fix | Delete
case 1:
[7009] Fix | Delete
return "WEEK( $column, 1 )";
[7010] Fix | Delete
case 2:
[7011] Fix | Delete
case 3:
[7012] Fix | Delete
case 4:
[7013] Fix | Delete
case 5:
[7014] Fix | Delete
case 6:
[7015] Fix | Delete
return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )";
[7016] Fix | Delete
case 0:
[7017] Fix | Delete
default:
[7018] Fix | Delete
return "WEEK( $column, 0 )";
[7019] Fix | Delete
}
[7020] Fix | Delete
}
[7021] Fix | Delete
[7022] Fix | Delete
/**
[7023] Fix | Delete
* Finds hierarchy loops using a callback function that maps object IDs to parent IDs.
[7024] Fix | Delete
*
[7025] Fix | Delete
* @since 3.1.0
[7026] Fix | Delete
* @access private
[7027] Fix | Delete
*
[7028] Fix | Delete
* @param callable $callback Function that accepts ( ID, $callback_args ) and outputs parent_ID.
[7029] Fix | Delete
* @param int $start The ID to start the loop check at.
[7030] Fix | Delete
* @param int $start_parent The parent_ID of $start to use instead of calling $callback( $start ).
[7031] Fix | Delete
* Use null to always use $callback.
[7032] Fix | Delete
* @param array $callback_args Optional. Additional arguments to send to $callback. Default empty array.
[7033] Fix | Delete
* @return array IDs of all members of loop.
[7034] Fix | Delete
*/
[7035] Fix | Delete
function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
[7036] Fix | Delete
$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
[7037] Fix | Delete
[7038] Fix | Delete
$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args );
[7039] Fix | Delete
if ( ! $arbitrary_loop_member ) {
[7040] Fix | Delete
return array();
[7041] Fix | Delete
}
[7042] Fix | Delete
[7043] Fix | Delete
return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
[7044] Fix | Delete
}
[7045] Fix | Delete
[7046] Fix | Delete
/**
[7047] Fix | Delete
* Uses the "The Tortoise and the Hare" algorithm to detect loops.
[7048] Fix | Delete
*
[7049] Fix | Delete
* For every step of the algorithm, the hare takes two steps and the tortoise one.
[7050] Fix | Delete
* If the hare ever laps the tortoise, there must be a loop.
[7051] Fix | Delete
*
[7052] Fix | Delete
* @since 3.1.0
[7053] Fix | Delete
* @access private
[7054] Fix | Delete
*
[7055] Fix | Delete
* @param callable $callback Function that accepts ( ID, callback_arg, ... ) and outputs parent_ID.
[7056] Fix | Delete
* @param int $start The ID to start the loop check at.
[7057] Fix | Delete
* @param array $override Optional. An array of ( ID => parent_ID, ... ) to use instead of $callback.
[7058] Fix | Delete
* Default empty array.
[7059] Fix | Delete
* @param array $callback_args Optional. Additional arguments to send to $callback. Default empty array.
[7060] Fix | Delete
* @param bool $_return_loop Optional. Return loop members or just detect presence of loop? Only set
[7061] Fix | Delete
* to true if you already know the given $start is part of a loop (otherwise
[7062] Fix | Delete
* the returned array might include branches). Default false.
[7063] Fix | Delete
* @return mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if
[7064] Fix | Delete
* $_return_loop
[7065] Fix | Delete
*/
[7066] Fix | Delete
function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) {
[7067] Fix | Delete
$tortoise = $start;
[7068] Fix | Delete
$hare = $start;
[7069] Fix | Delete
$evanescent_hare = $start;
[7070] Fix | Delete
$return = array();
[7071] Fix | Delete
[7072] Fix | Delete
// Set evanescent_hare to one past hare. Increment hare two steps.
[7073] Fix | Delete
while (
[7074] Fix | Delete
$tortoise
[7075] Fix | Delete
&&
[7076] Fix | Delete
( $evanescent_hare = isset( $override[ $hare ] ) ? $override[ $hare ] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) )
[7077] Fix | Delete
&&
[7078] Fix | Delete
( $hare = isset( $override[ $evanescent_hare ] ) ? $override[ $evanescent_hare ] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
[7079] Fix | Delete
) {
[7080] Fix | Delete
if ( $_return_loop ) {
[7081] Fix | Delete
$return[ $tortoise ] = true;
[7082] Fix | Delete
$return[ $evanescent_hare ] = true;
[7083] Fix | Delete
$return[ $hare ] = true;
[7084] Fix | Delete
}
[7085] Fix | Delete
[7086] Fix | Delete
// Tortoise got lapped - must be a loop.
[7087] Fix | Delete
if ( $tortoise === $evanescent_hare || $tortoise === $hare ) {
[7088] Fix | Delete
return $_return_loop ? $return : $tortoise;
[7089] Fix | Delete
}
[7090] Fix | Delete
[7091] Fix | Delete
// Increment tortoise by one step.
[7092] Fix | Delete
$tortoise = isset( $override[ $tortoise ] ) ? $override[ $tortoise ] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
[7093] Fix | Delete
}
[7094] Fix | Delete
[7095] Fix | Delete
return false;
[7096] Fix | Delete
}
[7097] Fix | Delete
[7098] Fix | Delete
/**
[7099] Fix | Delete
* Sends a HTTP header to limit rendering of pages to same origin iframes.
[7100] Fix | Delete
*
[7101] Fix | Delete
* @since 3.1.3
[7102] Fix | Delete
*
[7103] Fix | Delete
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
[7104] Fix | Delete
*/
[7105] Fix | Delete
function send_frame_options_header() {
[7106] Fix | Delete
header( 'X-Frame-Options: SAMEORIGIN' );
[7107] Fix | Delete
}
[7108] Fix | Delete
[7109] Fix | Delete
/**
[7110] Fix | Delete
* Retrieves a list of protocols to allow in HTML attributes.
[7111] Fix | Delete
*
[7112] Fix | Delete
* @since 3.3.0
[7113] Fix | Delete
* @since 4.3.0 Added 'webcal' to the protocols array.
[7114] Fix | Delete
* @since 4.7.0 Added 'urn' to the protocols array.
[7115] Fix | Delete
* @since 5.3.0 Added 'sms' to the protocols array.
[7116] Fix | Delete
* @since 5.6.0 Added 'irc6' and 'ircs' to the protocols array.
[7117] Fix | Delete
*
[7118] Fix | Delete
* @see wp_kses()
[7119] Fix | Delete
* @see esc_url()
[7120] Fix | Delete
*
[7121] Fix | Delete
* @return string[] Array of allowed protocols. Defaults to an array containing 'http', 'https',
[7122] Fix | Delete
* 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed',
[7123] Fix | Delete
* 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', and 'urn'.
[7124] Fix | Delete
* This covers all common link protocols, except for 'javascript' which should not
[7125] Fix | Delete
* be allowed for untrusted users.
[7126] Fix | Delete
*/
[7127] Fix | Delete
function wp_allowed_protocols() {
[7128] Fix | Delete
static $protocols = array();
[7129] Fix | Delete
[7130] Fix | Delete
if ( empty( $protocols ) ) {
[7131] Fix | Delete
$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' );
[7132] Fix | Delete
}
[7133] Fix | Delete
[7134] Fix | Delete
if ( ! did_action( 'wp_loaded' ) ) {
[7135] Fix | Delete
/**
[7136] Fix | Delete
* Filters the list of protocols allowed in HTML attributes.
[7137] Fix | Delete
*
[7138] Fix | Delete
* @since 3.0.0
[7139] Fix | Delete
*
[7140] Fix | Delete
* @param string[] $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
[7141] Fix | Delete
*/
[7142] Fix | Delete
$protocols = array_unique( (array) apply_filters( 'kses_allowed_protocols', $protocols ) );
[7143] Fix | Delete
}
[7144] Fix | Delete
[7145] Fix | Delete
return $protocols;
[7146] Fix | Delete
}
[7147] Fix | Delete
[7148] Fix | Delete
/**
[7149] Fix | Delete
* Returns a comma-separated string or array of functions that have been called to get
[7150] Fix | Delete
* to the current point in code.
[7151] Fix | Delete
*
[7152] Fix | Delete
* @since 3.4.0
[7153] Fix | Delete
*
[7154] Fix | Delete
* @see https://core.trac.wordpress.org/ticket/19589
[7155] Fix | Delete
*
[7156] Fix | Delete
* @param string $ignore_class Optional. A class to ignore all function calls within - useful
[7157] Fix | Delete
* when you want to just give info about the callee. Default null.
[7158] Fix | Delete
* @param int $skip_frames Optional. A number of stack frames to skip - useful for unwinding
[7159] Fix | Delete
* back to the source of the issue. Default 0.
[7160] Fix | Delete
* @param bool $pretty Optional. Whether you want a comma separated string instead of
[7161] Fix | Delete
* the raw array returned. Default true.
[7162] Fix | Delete
* @return string|array Either a string containing a reversed comma separated trace or an array
[7163] Fix | Delete
* of individual calls.
[7164] Fix | Delete
*/
[7165] Fix | Delete
function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
[7166] Fix | Delete
static $truncate_paths;
[7167] Fix | Delete
[7168] Fix | Delete
$trace = debug_backtrace( false );
[7169] Fix | Delete
$caller = array();
[7170] Fix | Delete
$check_class = ! is_null( $ignore_class );
[7171] Fix | Delete
++$skip_frames; // Skip this function.
[7172] Fix | Delete
[7173] Fix | Delete
if ( ! isset( $truncate_paths ) ) {
[7174] Fix | Delete
$truncate_paths = array(
[7175] Fix | Delete
wp_normalize_path( WP_CONTENT_DIR ),
[7176] Fix | Delete
wp_normalize_path( ABSPATH ),
[7177] Fix | Delete
);
[7178] Fix | Delete
}
[7179] Fix | Delete
[7180] Fix | Delete
foreach ( $trace as $call ) {
[7181] Fix | Delete
if ( $skip_frames > 0 ) {
[7182] Fix | Delete
--$skip_frames;
[7183] Fix | Delete
} elseif ( isset( $call['class'] ) ) {
[7184] Fix | Delete
if ( $check_class && $ignore_class === $call['class'] ) {
[7185] Fix | Delete
continue; // Filter out calls.
[7186] Fix | Delete
}
[7187] Fix | Delete
[7188] Fix | Delete
$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
[7189] Fix | Delete
} else {
[7190] Fix | Delete
if ( in_array( $call['function'], array( 'do_action', 'apply_filters', 'do_action_ref_array', 'apply_filters_ref_array' ), true ) ) {
[7191] Fix | Delete
$caller[] = "{$call['function']}('{$call['args'][0]}')";
[7192] Fix | Delete
} elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ), true ) ) {
[7193] Fix | Delete
$filename = isset( $call['args'][0] ) ? $call['args'][0] : '';
[7194] Fix | Delete
$caller[] = $call['function'] . "('" . str_replace( $truncate_paths, '', wp_normalize_path( $filename ) ) . "')";
[7195] Fix | Delete
} else {
[7196] Fix | Delete
$caller[] = $call['function'];
[7197] Fix | Delete
}
[7198] Fix | Delete
}
[7199] Fix | Delete
}
[7200] Fix | Delete
if ( $pretty ) {
[7201] Fix | Delete
return implode( ', ', array_reverse( $caller ) );
[7202] Fix | Delete
} else {
[7203] Fix | Delete
return $caller;
[7204] Fix | Delete
}
[7205] Fix | Delete
}
[7206] Fix | Delete
[7207] Fix | Delete
/**
[7208] Fix | Delete
* Retrieves IDs that are not already present in the cache.
[7209] Fix | Delete
*
[7210] Fix | Delete
* @since 3.4.0
[7211] Fix | Delete
* @since 6.1.0 This function is no longer marked as "private".
[7212] Fix | Delete
*
[7213] Fix | Delete
* @param int[] $object_ids Array of IDs.
[7214] Fix | Delete
* @param string $cache_group The cache group to check against.
[7215] Fix | Delete
* @return int[] Array of IDs not present in the cache.
[7216] Fix | Delete
*/
[7217] Fix | Delete
function _get_non_cached_ids( $object_ids, $cache_group ) {
[7218] Fix | Delete
$object_ids = array_filter( $object_ids, '_validate_cache_id' );
[7219] Fix | Delete
$object_ids = array_unique( array_map( 'intval', $object_ids ), SORT_NUMERIC );
[7220] Fix | Delete
[7221] Fix | Delete
if ( empty( $object_ids ) ) {
[7222] Fix | Delete
return array();
[7223] Fix | Delete
}
[7224] Fix | Delete
[7225] Fix | Delete
$non_cached_ids = array();
[7226] Fix | Delete
$cache_values = wp_cache_get_multiple( $object_ids, $cache_group );
[7227] Fix | Delete
[7228] Fix | Delete
foreach ( $cache_values as $id => $value ) {
[7229] Fix | Delete
if ( false === $value ) {
[7230] Fix | Delete
$non_cached_ids[] = (int) $id;
[7231] Fix | Delete
}
[7232] Fix | Delete
}
[7233] Fix | Delete
[7234] Fix | Delete
return $non_cached_ids;
[7235] Fix | Delete
}
[7236] Fix | Delete
[7237] Fix | Delete
/**
[7238] Fix | Delete
* Checks whether the given cache ID is either an integer or an integer-like string.
[7239] Fix | Delete
*
[7240] Fix | Delete
* Both `16` and `"16"` are considered valid, other numeric types and numeric strings
[7241] Fix | Delete
* (`16.3` and `"16.3"`) are considered invalid.
[7242] Fix | Delete
*
[7243] Fix | Delete
* @since 6.3.0
[7244] Fix | Delete
*
[7245] Fix | Delete
* @param mixed $object_id The cache ID to validate.
[7246] Fix | Delete
* @return bool Whether the given $object_id is a valid cache ID.
[7247] Fix | Delete
*/
[7248] Fix | Delete
function _validate_cache_id( $object_id ) {
[7249] Fix | Delete
/*
[7250] Fix | Delete
* filter_var() could be used here, but the `filter` PHP extension
[7251] Fix | Delete
* is considered optional and may not be available.
[7252] Fix | Delete
*/
[7253] Fix | Delete
if ( is_int( $object_id )
[7254] Fix | Delete
|| ( is_string( $object_id ) && (string) (int) $object_id === $object_id ) ) {
[7255] Fix | Delete
return true;
[7256] Fix | Delete
}
[7257] Fix | Delete
[7258] Fix | Delete
/* translators: %s: The type of the given object ID. */
[7259] Fix | Delete
$message = sprintf( __( 'Object ID must be an integer, %s given.' ), gettype( $object_id ) );
[7260] Fix | Delete
_doing_it_wrong( '_get_non_cached_ids', $message, '6.3.0' );
[7261] Fix | Delete
[7262] Fix | Delete
return false;
[7263] Fix | Delete
}
[7264] Fix | Delete
[7265] Fix | Delete
/**
[7266] Fix | Delete
* Tests if the current device has the capability to upload files.
[7267] Fix | Delete
*
[7268] Fix | Delete
* @since 3.4.0
[7269] Fix | Delete
* @access private
[7270] Fix | Delete
*
[7271] Fix | Delete
* @return bool Whether the device is able to upload files.
[7272] Fix | Delete
*/
[7273] Fix | Delete
function _device_can_upload() {
[7274] Fix | Delete
if ( ! wp_is_mobile() ) {
[7275] Fix | Delete
return true;
[7276] Fix | Delete
}
[7277] Fix | Delete
[7278] Fix | Delete
$ua = $_SERVER['HTTP_USER_AGENT'];
[7279] Fix | Delete
[7280] Fix | Delete
if ( str_contains( $ua, 'iPhone' )
[7281] Fix | Delete
|| str_contains( $ua, 'iPad' )
[7282] Fix | Delete
|| str_contains( $ua, 'iPod' ) ) {
[7283] Fix | Delete
return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
[7284] Fix | Delete
}
[7285] Fix | Delete
[7286] Fix | Delete
return true;
[7287] Fix | Delete
}
[7288] Fix | Delete
[7289] Fix | Delete
/**
[7290] Fix | Delete
* Tests if a given path is a stream URL
[7291] Fix | Delete
*
[7292] Fix | Delete
* @since 3.5.0
[7293] Fix | Delete
*
[7294] Fix | Delete
* @param string $path The resource path or URL.
[7295] Fix | Delete
* @return bool True if the path is a stream URL.
[7296] Fix | Delete
*/
[7297] Fix | Delete
function wp_is_stream( $path ) {
[7298] Fix | Delete
$scheme_separator = strpos( $path, '://' );
[7299] Fix | Delete
[7300] Fix | Delete
if ( false === $scheme_separator ) {
[7301] Fix | Delete
// $path isn't a stream.
[7302] Fix | Delete
return false;
[7303] Fix | Delete
}
[7304] Fix | Delete
[7305] Fix | Delete
$stream = substr( $path, 0, $scheme_separator );
[7306] Fix | Delete
[7307] Fix | Delete
return in_array( $stream, stream_get_wrappers(), true );
[7308] Fix | Delete
}
[7309] Fix | Delete
[7310] Fix | Delete
/**
[7311] Fix | Delete
* Tests if the supplied date is valid for the Gregorian calendar.
[7312] Fix | Delete
*
[7313] Fix | Delete
* @since 3.5.0
[7314] Fix | Delete
*
[7315] Fix | Delete
* @link https://www.php.net/manual/en/function.checkdate.php
[7316] Fix | Delete
*
[7317] Fix | Delete
* @param int $month Month number.
[7318] Fix | Delete
* @param int $day Day number.
[7319] Fix | Delete
* @param int $year Year number.
[7320] Fix | Delete
* @param string $source_date The date to filter.
[7321] Fix | Delete
* @return bool True if valid date, false if not valid date.
[7322] Fix | Delete
*/
[7323] Fix | Delete
function wp_checkdate( $month, $day, $year, $source_date ) {
[7324] Fix | Delete
/**
[7325] Fix | Delete
* Filters whether the given date is valid for the Gregorian calendar.
[7326] Fix | Delete
*
[7327] Fix | Delete
* @since 3.5.0
[7328] Fix | Delete
*
[7329] Fix | Delete
* @param bool $checkdate Whether the given date is valid.
[7330] Fix | Delete
* @param string $source_date Date to check.
[7331] Fix | Delete
*/
[7332] Fix | Delete
return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date );
[7333] Fix | Delete
}
[7334] Fix | Delete
[7335] Fix | Delete
/**
[7336] Fix | Delete
* Loads the auth check for monitoring whether the user is still logged in.
[7337] Fix | Delete
*
[7338] Fix | Delete
* Can be disabled with remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
[7339] Fix | Delete
*
[7340] Fix | Delete
* This is disabled for certain screens where a login screen could cause an
[7341] Fix | Delete
* inconvenient interruption. A filter called {@see 'wp_auth_check_load'} can be used
[7342] Fix | Delete
* for fine-grained control.
[7343] Fix | Delete
*
[7344] Fix | Delete
* @since 3.6.0
[7345] Fix | Delete
*/
[7346] Fix | Delete
function wp_auth_check_load() {
[7347] Fix | Delete
if ( ! is_admin() && ! is_user_logged_in() ) {
[7348] Fix | Delete
return;
[7349] Fix | Delete
}
[7350] Fix | Delete
[7351] Fix | Delete
if ( defined( 'IFRAME_REQUEST' ) ) {
[7352] Fix | Delete
return;
[7353] Fix | Delete
}
[7354] Fix | Delete
[7355] Fix | Delete
$screen = get_current_screen();
[7356] Fix | Delete
$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
[7357] Fix | Delete
$show = ! in_array( $screen->id, $hidden, true );
[7358] Fix | Delete
[7359] Fix | Delete
/**
[7360] Fix | Delete
* Filters whether to load the authentication check.
[7361] Fix | Delete
*
[7362] Fix | Delete
* Returning a falsey value from the filter will effectively short-circuit
[7363] Fix | Delete
* loading the authentication check.
[7364] Fix | Delete
*
[7365] Fix | Delete
* @since 3.6.0
[7366] Fix | Delete
*
[7367] Fix | Delete
* @param bool $show Whether to load the authentication check.
[7368] Fix | Delete
* @param WP_Screen $screen The current screen object.
[7369] Fix | Delete
*/
[7370] Fix | Delete
if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) {
[7371] Fix | Delete
wp_enqueue_style( 'wp-auth-check' );
[7372] Fix | Delete
wp_enqueue_script( 'wp-auth-check' );
[7373] Fix | Delete
[7374] Fix | Delete
add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 );
[7375] Fix | Delete
add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 );
[7376] Fix | Delete
}
[7377] Fix | Delete
}
[7378] Fix | Delete
[7379] Fix | Delete
/**
[7380] Fix | Delete
* Outputs the HTML that shows the wp-login dialog when the user is no longer logged in.
[7381] Fix | Delete
*
[7382] Fix | Delete
* @since 3.6.0
[7383] Fix | Delete
*/
[7384] Fix | Delete
function wp_auth_check_html() {
[7385] Fix | Delete
$login_url = wp_login_url();
[7386] Fix | Delete
$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
[7387] Fix | Delete
$same_domain = str_starts_with( $login_url, $current_domain );
[7388] Fix | Delete
[7389] Fix | Delete
/**
[7390] Fix | Delete
* Filters whether the authentication check originated at the same domain.
[7391] Fix | Delete
*
[7392] Fix | Delete
* @since 3.6.0
[7393] Fix | Delete
*
[7394] Fix | Delete
* @param bool $same_domain Whether the authentication check originated at the same domain.
[7395] Fix | Delete
*/
[7396] Fix | Delete
$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
[7397] Fix | Delete
$wrap_class = $same_domain ? 'hidden' : 'hidden fallback';
[7398] Fix | Delete
[7399] Fix | Delete
?>
[7400] Fix | Delete
<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
[7401] Fix | Delete
<div id="wp-auth-check-bg"></div>
[7402] Fix | Delete
<div id="wp-auth-check">
[7403] Fix | Delete
<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text">
[7404] Fix | Delete
<?php
[7405] Fix | Delete
/* translators: Hidden accessibility text. */
[7406] Fix | Delete
_e( 'Close dialog' );
[7407] Fix | Delete
?>
[7408] Fix | Delete
</span></button>
[7409] Fix | Delete
<?php
[7410] Fix | Delete
[7411] Fix | Delete
if ( $same_domain ) {
[7412] Fix | Delete
$login_src = add_query_arg(
[7413] Fix | Delete
array(
[7414] Fix | Delete
'interim-login' => '1',
[7415] Fix | Delete
'wp_lang' => get_user_locale(),
[7416] Fix | Delete
),
[7417] Fix | Delete
$login_url
[7418] Fix | Delete
);
[7419] Fix | Delete
?>
[7420] Fix | Delete
<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( $login_src ); ?>"></div>
[7421] Fix | Delete
<?php
[7422] Fix | Delete
}
[7423] Fix | Delete
[7424] Fix | Delete
?>
[7425] Fix | Delete
<div class="wp-auth-fallback">
[7426] Fix | Delete
<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e( 'Session expired' ); ?></b></p>
[7427] Fix | Delete
<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e( 'Please log in again.' ); ?></a>
[7428] Fix | Delete
<?php _e( 'The login page will open in a new tab. After logging in you can close it and return to this page.' ); ?></p>
[7429] Fix | Delete
</div>
[7430] Fix | Delete
</div>
[7431] Fix | Delete
</div>
[7432] Fix | Delete
<?php
[7433] Fix | Delete
}
[7434] Fix | Delete
[7435] Fix | Delete
/**
[7436] Fix | Delete
* Checks whether a user is still logged in, for the heartbeat.
[7437] Fix | Delete
*
[7438] Fix | Delete
* Send a result that shows a log-in box if the user is no longer logged in,
[7439] Fix | Delete
* or if their cookie is within the grace period.
[7440] Fix | Delete
*
[7441] Fix | Delete
* @since 3.6.0
[7442] Fix | Delete
*
[7443] Fix | Delete
* @global int $login_grace_period
[7444] Fix | Delete
*
[7445] Fix | Delete
* @param array $response The Heartbeat response.
[7446] Fix | Delete
* @return array The Heartbeat response with 'wp-auth-check' value set.
[7447] Fix | Delete
*/
[7448] Fix | Delete
function wp_auth_check( $response ) {
[7449] Fix | Delete
$response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] );
[7450] Fix | Delete
return $response;
[7451] Fix | Delete
}
[7452] Fix | Delete
[7453] Fix | Delete
/**
[7454] Fix | Delete
* Returns RegEx body to liberally match an opening HTML tag.
[7455] Fix | Delete
*
[7456] Fix | Delete
* Matches an opening HTML tag that:
[7457] Fix | Delete
* 1. Is self-closing or
[7458] Fix | Delete
* 2. Has no body but has a closing tag of the same name or
[7459] Fix | Delete
* 3. Contains a body and a closing tag of the same name
[7460] Fix | Delete
*
[7461] Fix | Delete
* Note: this RegEx does not balance inner tags and does not attempt
[7462] Fix | Delete
* to produce valid HTML
[7463] Fix | Delete
*
[7464] Fix | Delete
* @since 3.6.0
[7465] Fix | Delete
*
[7466] Fix | Delete
* @param string $tag An HTML tag name. Example: 'video'.
[7467] Fix | Delete
* @return string Tag RegEx.
[7468] Fix | Delete
*/
[7469] Fix | Delete
function get_tag_regex( $tag ) {
[7470] Fix | Delete
if ( empty( $tag ) ) {
[7471] Fix | Delete
return '';
[7472] Fix | Delete
}
[7473] Fix | Delete
return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
[7474] Fix | Delete
}
[7475] Fix | Delete
[7476] Fix | Delete
/**
[7477] Fix | Delete
* Indicates if a given slug for a character set represents the UTF-8
[7478] Fix | Delete
* text encoding. If not provided, examines the current blog's charset.
[7479] Fix | Delete
*
[7480] Fix | Delete
* A charset is considered to represent UTF-8 if it is a case-insensitive
[7481] Fix | Delete
* match of "UTF-8" with or without the hyphen.
[7482] Fix | Delete
*
[7483] Fix | Delete
* Example:
[7484] Fix | Delete
*
[7485] Fix | Delete
* true === is_utf8_charset( 'UTF-8' );
[7486] Fix | Delete
* true === is_utf8_charset( 'utf8' );
[7487] Fix | Delete
* false === is_utf8_charset( 'latin1' );
[7488] Fix | Delete
* false === is_utf8_charset( 'UTF 8' );
[7489] Fix | Delete
*
[7490] Fix | Delete
* // Only strings match.
[7491] Fix | Delete
* false === is_utf8_charset( [ 'charset' => 'utf-8' ] );
[7492] Fix | Delete
*
[7493] Fix | Delete
* // Without a given charset, it depends on the site option "blog_charset".
[7494] Fix | Delete
* $is_utf8 = is_utf8_charset();
[7495] Fix | Delete
*
[7496] Fix | Delete
* @since 6.6.0
[7497] Fix | Delete
* @since 6.6.1 A wrapper for _is_utf8_charset
[7498] Fix | Delete
*
[7499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function