Edit File by line
/home/barbar84/www/wp-inclu...
File: functions.php
13.75,
[6000] Fix | Delete
14,
[6001] Fix | Delete
);
[6002] Fix | Delete
foreach ( $offset_range as $offset ) {
[6003] Fix | Delete
if ( 0 <= $offset ) {
[6004] Fix | Delete
$offset_name = '+' . $offset;
[6005] Fix | Delete
} else {
[6006] Fix | Delete
$offset_name = (string) $offset;
[6007] Fix | Delete
}
[6008] Fix | Delete
[6009] Fix | Delete
$offset_value = $offset_name;
[6010] Fix | Delete
$offset_name = str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), $offset_name );
[6011] Fix | Delete
$offset_name = 'UTC' . $offset_name;
[6012] Fix | Delete
$offset_value = 'UTC' . $offset_value;
[6013] Fix | Delete
$selected = '';
[6014] Fix | Delete
if ( $offset_value === $selected_zone ) {
[6015] Fix | Delete
$selected = 'selected="selected" ';
[6016] Fix | Delete
}
[6017] Fix | Delete
$structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . '</option>';
[6018] Fix | Delete
[6019] Fix | Delete
}
[6020] Fix | Delete
$structure[] = '</optgroup>';
[6021] Fix | Delete
[6022] Fix | Delete
return implode( "\n", $structure );
[6023] Fix | Delete
}
[6024] Fix | Delete
[6025] Fix | Delete
/**
[6026] Fix | Delete
* Strip close comment and close php tags from file headers used by WP.
[6027] Fix | Delete
*
[6028] Fix | Delete
* @since 2.8.0
[6029] Fix | Delete
* @access private
[6030] Fix | Delete
*
[6031] Fix | Delete
* @see https://core.trac.wordpress.org/ticket/8497
[6032] Fix | Delete
*
[6033] Fix | Delete
* @param string $str Header comment to clean up.
[6034] Fix | Delete
* @return string
[6035] Fix | Delete
*/
[6036] Fix | Delete
function _cleanup_header_comment( $str ) {
[6037] Fix | Delete
return trim( preg_replace( '/\s*(?:\*\/|\?>).*/', '', $str ) );
[6038] Fix | Delete
}
[6039] Fix | Delete
[6040] Fix | Delete
/**
[6041] Fix | Delete
* Permanently delete comments or posts of any type that have held a status
[6042] Fix | Delete
* of 'trash' for the number of days defined in EMPTY_TRASH_DAYS.
[6043] Fix | Delete
*
[6044] Fix | Delete
* The default value of `EMPTY_TRASH_DAYS` is 30 (days).
[6045] Fix | Delete
*
[6046] Fix | Delete
* @since 2.9.0
[6047] Fix | Delete
*
[6048] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[6049] Fix | Delete
*/
[6050] Fix | Delete
function wp_scheduled_delete() {
[6051] Fix | Delete
global $wpdb;
[6052] Fix | Delete
[6053] Fix | Delete
$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
[6054] Fix | Delete
[6055] Fix | Delete
$posts_to_delete = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < %d", $delete_timestamp ), ARRAY_A );
[6056] Fix | Delete
[6057] Fix | Delete
foreach ( (array) $posts_to_delete as $post ) {
[6058] Fix | Delete
$post_id = (int) $post['post_id'];
[6059] Fix | Delete
if ( ! $post_id ) {
[6060] Fix | Delete
continue;
[6061] Fix | Delete
}
[6062] Fix | Delete
[6063] Fix | Delete
$del_post = get_post( $post_id );
[6064] Fix | Delete
[6065] Fix | Delete
if ( ! $del_post || 'trash' !== $del_post->post_status ) {
[6066] Fix | Delete
delete_post_meta( $post_id, '_wp_trash_meta_status' );
[6067] Fix | Delete
delete_post_meta( $post_id, '_wp_trash_meta_time' );
[6068] Fix | Delete
} else {
[6069] Fix | Delete
wp_delete_post( $post_id );
[6070] Fix | Delete
}
[6071] Fix | Delete
}
[6072] Fix | Delete
[6073] Fix | Delete
$comments_to_delete = $wpdb->get_results( $wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < %d", $delete_timestamp ), ARRAY_A );
[6074] Fix | Delete
[6075] Fix | Delete
foreach ( (array) $comments_to_delete as $comment ) {
[6076] Fix | Delete
$comment_id = (int) $comment['comment_id'];
[6077] Fix | Delete
if ( ! $comment_id ) {
[6078] Fix | Delete
continue;
[6079] Fix | Delete
}
[6080] Fix | Delete
[6081] Fix | Delete
$del_comment = get_comment( $comment_id );
[6082] Fix | Delete
[6083] Fix | Delete
if ( ! $del_comment || 'trash' !== $del_comment->comment_approved ) {
[6084] Fix | Delete
delete_comment_meta( $comment_id, '_wp_trash_meta_time' );
[6085] Fix | Delete
delete_comment_meta( $comment_id, '_wp_trash_meta_status' );
[6086] Fix | Delete
} else {
[6087] Fix | Delete
wp_delete_comment( $del_comment );
[6088] Fix | Delete
}
[6089] Fix | Delete
}
[6090] Fix | Delete
}
[6091] Fix | Delete
[6092] Fix | Delete
/**
[6093] Fix | Delete
* Retrieve metadata from a file.
[6094] Fix | Delete
*
[6095] Fix | Delete
* Searches for metadata in the first 8 KB of a file, such as a plugin or theme.
[6096] Fix | Delete
* Each piece of metadata must be on its own line. Fields can not span multiple
[6097] Fix | Delete
* lines, the value will get cut at the end of the first line.
[6098] Fix | Delete
*
[6099] Fix | Delete
* If the file data is not within that first 8 KB, then the author should correct
[6100] Fix | Delete
* their plugin file and move the data headers to the top.
[6101] Fix | Delete
*
[6102] Fix | Delete
* @link https://codex.wordpress.org/File_Header
[6103] Fix | Delete
*
[6104] Fix | Delete
* @since 2.9.0
[6105] Fix | Delete
*
[6106] Fix | Delete
* @param string $file Absolute path to the file.
[6107] Fix | Delete
* @param array $default_headers List of headers, in the format `array( 'HeaderKey' => 'Header Name' )`.
[6108] Fix | Delete
* @param string $context Optional. If specified adds filter hook {@see 'extra_$context_headers'}.
[6109] Fix | Delete
* Default empty.
[6110] Fix | Delete
* @return string[] Array of file header values keyed by header name.
[6111] Fix | Delete
*/
[6112] Fix | Delete
function get_file_data( $file, $default_headers, $context = '' ) {
[6113] Fix | Delete
// We don't need to write to the file, so just open for reading.
[6114] Fix | Delete
$fp = fopen( $file, 'r' );
[6115] Fix | Delete
[6116] Fix | Delete
if ( $fp ) {
[6117] Fix | Delete
// Pull only the first 8 KB of the file in.
[6118] Fix | Delete
$file_data = fread( $fp, 8 * KB_IN_BYTES );
[6119] Fix | Delete
[6120] Fix | Delete
// PHP will close file handle, but we are good citizens.
[6121] Fix | Delete
fclose( $fp );
[6122] Fix | Delete
} else {
[6123] Fix | Delete
$file_data = '';
[6124] Fix | Delete
}
[6125] Fix | Delete
[6126] Fix | Delete
// Make sure we catch CR-only line endings.
[6127] Fix | Delete
$file_data = str_replace( "\r", "\n", $file_data );
[6128] Fix | Delete
[6129] Fix | Delete
/**
[6130] Fix | Delete
* Filters extra file headers by context.
[6131] Fix | Delete
*
[6132] Fix | Delete
* The dynamic portion of the hook name, `$context`, refers to
[6133] Fix | Delete
* the context where extra headers might be loaded.
[6134] Fix | Delete
*
[6135] Fix | Delete
* @since 2.9.0
[6136] Fix | Delete
*
[6137] Fix | Delete
* @param array $extra_context_headers Empty array by default.
[6138] Fix | Delete
*/
[6139] Fix | Delete
$extra_headers = $context ? apply_filters( "extra_{$context}_headers", array() ) : array();
[6140] Fix | Delete
if ( $extra_headers ) {
[6141] Fix | Delete
$extra_headers = array_combine( $extra_headers, $extra_headers ); // Keys equal values.
[6142] Fix | Delete
$all_headers = array_merge( $extra_headers, (array) $default_headers );
[6143] Fix | Delete
} else {
[6144] Fix | Delete
$all_headers = $default_headers;
[6145] Fix | Delete
}
[6146] Fix | Delete
[6147] Fix | Delete
foreach ( $all_headers as $field => $regex ) {
[6148] Fix | Delete
if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
[6149] Fix | Delete
$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
[6150] Fix | Delete
} else {
[6151] Fix | Delete
$all_headers[ $field ] = '';
[6152] Fix | Delete
}
[6153] Fix | Delete
}
[6154] Fix | Delete
[6155] Fix | Delete
return $all_headers;
[6156] Fix | Delete
}
[6157] Fix | Delete
[6158] Fix | Delete
/**
[6159] Fix | Delete
* Returns true.
[6160] Fix | Delete
*
[6161] Fix | Delete
* Useful for returning true to filters easily.
[6162] Fix | Delete
*
[6163] Fix | Delete
* @since 3.0.0
[6164] Fix | Delete
*
[6165] Fix | Delete
* @see __return_false()
[6166] Fix | Delete
*
[6167] Fix | Delete
* @return true True.
[6168] Fix | Delete
*/
[6169] Fix | Delete
function __return_true() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
[6170] Fix | Delete
return true;
[6171] Fix | Delete
}
[6172] Fix | Delete
[6173] Fix | Delete
/**
[6174] Fix | Delete
* Returns false.
[6175] Fix | Delete
*
[6176] Fix | Delete
* Useful for returning false to filters easily.
[6177] Fix | Delete
*
[6178] Fix | Delete
* @since 3.0.0
[6179] Fix | Delete
*
[6180] Fix | Delete
* @see __return_true()
[6181] Fix | Delete
*
[6182] Fix | Delete
* @return false False.
[6183] Fix | Delete
*/
[6184] Fix | Delete
function __return_false() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
[6185] Fix | Delete
return false;
[6186] Fix | Delete
}
[6187] Fix | Delete
[6188] Fix | Delete
/**
[6189] Fix | Delete
* Returns 0.
[6190] Fix | Delete
*
[6191] Fix | Delete
* Useful for returning 0 to filters easily.
[6192] Fix | Delete
*
[6193] Fix | Delete
* @since 3.0.0
[6194] Fix | Delete
*
[6195] Fix | Delete
* @return int 0.
[6196] Fix | Delete
*/
[6197] Fix | Delete
function __return_zero() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
[6198] Fix | Delete
return 0;
[6199] Fix | Delete
}
[6200] Fix | Delete
[6201] Fix | Delete
/**
[6202] Fix | Delete
* Returns an empty array.
[6203] Fix | Delete
*
[6204] Fix | Delete
* Useful for returning an empty array to filters easily.
[6205] Fix | Delete
*
[6206] Fix | Delete
* @since 3.0.0
[6207] Fix | Delete
*
[6208] Fix | Delete
* @return array Empty array.
[6209] Fix | Delete
*/
[6210] Fix | Delete
function __return_empty_array() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
[6211] Fix | Delete
return array();
[6212] Fix | Delete
}
[6213] Fix | Delete
[6214] Fix | Delete
/**
[6215] Fix | Delete
* Returns null.
[6216] Fix | Delete
*
[6217] Fix | Delete
* Useful for returning null to filters easily.
[6218] Fix | Delete
*
[6219] Fix | Delete
* @since 3.4.0
[6220] Fix | Delete
*
[6221] Fix | Delete
* @return null Null value.
[6222] Fix | Delete
*/
[6223] Fix | Delete
function __return_null() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
[6224] Fix | Delete
return null;
[6225] Fix | Delete
}
[6226] Fix | Delete
[6227] Fix | Delete
/**
[6228] Fix | Delete
* Returns an empty string.
[6229] Fix | Delete
*
[6230] Fix | Delete
* Useful for returning an empty string to filters easily.
[6231] Fix | Delete
*
[6232] Fix | Delete
* @since 3.7.0
[6233] Fix | Delete
*
[6234] Fix | Delete
* @see __return_null()
[6235] Fix | Delete
*
[6236] Fix | Delete
* @return string Empty string.
[6237] Fix | Delete
*/
[6238] Fix | Delete
function __return_empty_string() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
[6239] Fix | Delete
return '';
[6240] Fix | Delete
}
[6241] Fix | Delete
[6242] Fix | Delete
/**
[6243] Fix | Delete
* Send a HTTP header to disable content type sniffing in browsers which support it.
[6244] Fix | Delete
*
[6245] Fix | Delete
* @since 3.0.0
[6246] Fix | Delete
*
[6247] Fix | Delete
* @see https://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
[6248] Fix | Delete
* @see https://src.chromium.org/viewvc/chrome?view=rev&revision=6985
[6249] Fix | Delete
*/
[6250] Fix | Delete
function send_nosniff_header() {
[6251] Fix | Delete
header( 'X-Content-Type-Options: nosniff' );
[6252] Fix | Delete
}
[6253] Fix | Delete
[6254] Fix | Delete
/**
[6255] Fix | Delete
* Return a MySQL expression for selecting the week number based on the start_of_week option.
[6256] Fix | Delete
*
[6257] Fix | Delete
* @ignore
[6258] Fix | Delete
* @since 3.0.0
[6259] Fix | Delete
*
[6260] Fix | Delete
* @param string $column Database column.
[6261] Fix | Delete
* @return string SQL clause.
[6262] Fix | Delete
*/
[6263] Fix | Delete
function _wp_mysql_week( $column ) {
[6264] Fix | Delete
$start_of_week = (int) get_option( 'start_of_week' );
[6265] Fix | Delete
switch ( $start_of_week ) {
[6266] Fix | Delete
case 1:
[6267] Fix | Delete
return "WEEK( $column, 1 )";
[6268] Fix | Delete
case 2:
[6269] Fix | Delete
case 3:
[6270] Fix | Delete
case 4:
[6271] Fix | Delete
case 5:
[6272] Fix | Delete
case 6:
[6273] Fix | Delete
return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )";
[6274] Fix | Delete
case 0:
[6275] Fix | Delete
default:
[6276] Fix | Delete
return "WEEK( $column, 0 )";
[6277] Fix | Delete
}
[6278] Fix | Delete
}
[6279] Fix | Delete
[6280] Fix | Delete
/**
[6281] Fix | Delete
* Find hierarchy loops using a callback function that maps object IDs to parent IDs.
[6282] Fix | Delete
*
[6283] Fix | Delete
* @since 3.1.0
[6284] Fix | Delete
* @access private
[6285] Fix | Delete
*
[6286] Fix | Delete
* @param callable $callback Function that accepts ( ID, $callback_args ) and outputs parent_ID.
[6287] Fix | Delete
* @param int $start The ID to start the loop check at.
[6288] Fix | Delete
* @param int $start_parent The parent_ID of $start to use instead of calling $callback( $start ).
[6289] Fix | Delete
* Use null to always use $callback
[6290] Fix | Delete
* @param array $callback_args Optional. Additional arguments to send to $callback.
[6291] Fix | Delete
* @return array IDs of all members of loop.
[6292] Fix | Delete
*/
[6293] Fix | Delete
function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
[6294] Fix | Delete
$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
[6295] Fix | Delete
[6296] Fix | Delete
$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args );
[6297] Fix | Delete
if ( ! $arbitrary_loop_member ) {
[6298] Fix | Delete
return array();
[6299] Fix | Delete
}
[6300] Fix | Delete
[6301] Fix | Delete
return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
[6302] Fix | Delete
}
[6303] Fix | Delete
[6304] Fix | Delete
/**
[6305] Fix | Delete
* Use the "The Tortoise and the Hare" algorithm to detect loops.
[6306] Fix | Delete
*
[6307] Fix | Delete
* For every step of the algorithm, the hare takes two steps and the tortoise one.
[6308] Fix | Delete
* If the hare ever laps the tortoise, there must be a loop.
[6309] Fix | Delete
*
[6310] Fix | Delete
* @since 3.1.0
[6311] Fix | Delete
* @access private
[6312] Fix | Delete
*
[6313] Fix | Delete
* @param callable $callback Function that accepts ( ID, callback_arg, ... ) and outputs parent_ID.
[6314] Fix | Delete
* @param int $start The ID to start the loop check at.
[6315] Fix | Delete
* @param array $override Optional. An array of ( ID => parent_ID, ... ) to use instead of $callback.
[6316] Fix | Delete
* Default empty array.
[6317] Fix | Delete
* @param array $callback_args Optional. Additional arguments to send to $callback. Default empty array.
[6318] Fix | Delete
* @param bool $_return_loop Optional. Return loop members or just detect presence of loop? Only set
[6319] Fix | Delete
* to true if you already know the given $start is part of a loop (otherwise
[6320] Fix | Delete
* the returned array might include branches). Default false.
[6321] Fix | Delete
* @return mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if
[6322] Fix | Delete
* $_return_loop
[6323] Fix | Delete
*/
[6324] Fix | Delete
function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) {
[6325] Fix | Delete
$tortoise = $start;
[6326] Fix | Delete
$hare = $start;
[6327] Fix | Delete
$evanescent_hare = $start;
[6328] Fix | Delete
$return = array();
[6329] Fix | Delete
[6330] Fix | Delete
// Set evanescent_hare to one past hare.
[6331] Fix | Delete
// Increment hare two steps.
[6332] Fix | Delete
while (
[6333] Fix | Delete
$tortoise
[6334] Fix | Delete
&&
[6335] Fix | Delete
( $evanescent_hare = isset( $override[ $hare ] ) ? $override[ $hare ] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) )
[6336] Fix | Delete
&&
[6337] Fix | Delete
( $hare = isset( $override[ $evanescent_hare ] ) ? $override[ $evanescent_hare ] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
[6338] Fix | Delete
) {
[6339] Fix | Delete
if ( $_return_loop ) {
[6340] Fix | Delete
$return[ $tortoise ] = true;
[6341] Fix | Delete
$return[ $evanescent_hare ] = true;
[6342] Fix | Delete
$return[ $hare ] = true;
[6343] Fix | Delete
}
[6344] Fix | Delete
[6345] Fix | Delete
// Tortoise got lapped - must be a loop.
[6346] Fix | Delete
if ( $tortoise == $evanescent_hare || $tortoise == $hare ) {
[6347] Fix | Delete
return $_return_loop ? $return : $tortoise;
[6348] Fix | Delete
}
[6349] Fix | Delete
[6350] Fix | Delete
// Increment tortoise by one step.
[6351] Fix | Delete
$tortoise = isset( $override[ $tortoise ] ) ? $override[ $tortoise ] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
[6352] Fix | Delete
}
[6353] Fix | Delete
[6354] Fix | Delete
return false;
[6355] Fix | Delete
}
[6356] Fix | Delete
[6357] Fix | Delete
/**
[6358] Fix | Delete
* Send a HTTP header to limit rendering of pages to same origin iframes.
[6359] Fix | Delete
*
[6360] Fix | Delete
* @since 3.1.3
[6361] Fix | Delete
*
[6362] Fix | Delete
* @see https://developer.mozilla.org/en/the_x-frame-options_response_header
[6363] Fix | Delete
*/
[6364] Fix | Delete
function send_frame_options_header() {
[6365] Fix | Delete
header( 'X-Frame-Options: SAMEORIGIN' );
[6366] Fix | Delete
}
[6367] Fix | Delete
[6368] Fix | Delete
/**
[6369] Fix | Delete
* Retrieve a list of protocols to allow in HTML attributes.
[6370] Fix | Delete
*
[6371] Fix | Delete
* @since 3.3.0
[6372] Fix | Delete
* @since 4.3.0 Added 'webcal' to the protocols array.
[6373] Fix | Delete
* @since 4.7.0 Added 'urn' to the protocols array.
[6374] Fix | Delete
* @since 5.3.0 Added 'sms' to the protocols array.
[6375] Fix | Delete
* @since 5.6.0 Added 'irc6' and 'ircs' to the protocols array.
[6376] Fix | Delete
*
[6377] Fix | Delete
* @see wp_kses()
[6378] Fix | Delete
* @see esc_url()
[6379] Fix | Delete
*
[6380] Fix | Delete
* @return string[] Array of allowed protocols. Defaults to an array containing 'http', 'https',
[6381] Fix | Delete
* 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed',
[6382] Fix | Delete
* 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', and 'urn'.
[6383] Fix | Delete
* This covers all common link protocols, except for 'javascript' which should not
[6384] Fix | Delete
* be allowed for untrusted users.
[6385] Fix | Delete
*/
[6386] Fix | Delete
function wp_allowed_protocols() {
[6387] Fix | Delete
static $protocols = array();
[6388] Fix | Delete
[6389] Fix | Delete
if ( empty( $protocols ) ) {
[6390] 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' );
[6391] Fix | Delete
}
[6392] Fix | Delete
[6393] Fix | Delete
if ( ! did_action( 'wp_loaded' ) ) {
[6394] Fix | Delete
/**
[6395] Fix | Delete
* Filters the list of protocols allowed in HTML attributes.
[6396] Fix | Delete
*
[6397] Fix | Delete
* @since 3.0.0
[6398] Fix | Delete
*
[6399] Fix | Delete
* @param string[] $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
[6400] Fix | Delete
*/
[6401] Fix | Delete
$protocols = array_unique( (array) apply_filters( 'kses_allowed_protocols', $protocols ) );
[6402] Fix | Delete
}
[6403] Fix | Delete
[6404] Fix | Delete
return $protocols;
[6405] Fix | Delete
}
[6406] Fix | Delete
[6407] Fix | Delete
/**
[6408] Fix | Delete
* Return a comma-separated string of functions that have been called to get
[6409] Fix | Delete
* to the current point in code.
[6410] Fix | Delete
*
[6411] Fix | Delete
* @since 3.4.0
[6412] Fix | Delete
*
[6413] Fix | Delete
* @see https://core.trac.wordpress.org/ticket/19589
[6414] Fix | Delete
*
[6415] Fix | Delete
* @param string $ignore_class Optional. A class to ignore all function calls within - useful
[6416] Fix | Delete
* when you want to just give info about the callee. Default null.
[6417] Fix | Delete
* @param int $skip_frames Optional. A number of stack frames to skip - useful for unwinding
[6418] Fix | Delete
* back to the source of the issue. Default 0.
[6419] Fix | Delete
* @param bool $pretty Optional. Whether or not you want a comma separated string or raw
[6420] Fix | Delete
* array returned. Default true.
[6421] Fix | Delete
* @return string|array Either a string containing a reversed comma separated trace or an array
[6422] Fix | Delete
* of individual calls.
[6423] Fix | Delete
*/
[6424] Fix | Delete
function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
[6425] Fix | Delete
static $truncate_paths;
[6426] Fix | Delete
[6427] Fix | Delete
$trace = debug_backtrace( false );
[6428] Fix | Delete
$caller = array();
[6429] Fix | Delete
$check_class = ! is_null( $ignore_class );
[6430] Fix | Delete
$skip_frames++; // Skip this function.
[6431] Fix | Delete
[6432] Fix | Delete
if ( ! isset( $truncate_paths ) ) {
[6433] Fix | Delete
$truncate_paths = array(
[6434] Fix | Delete
wp_normalize_path( WP_CONTENT_DIR ),
[6435] Fix | Delete
wp_normalize_path( ABSPATH ),
[6436] Fix | Delete
);
[6437] Fix | Delete
}
[6438] Fix | Delete
[6439] Fix | Delete
foreach ( $trace as $call ) {
[6440] Fix | Delete
if ( $skip_frames > 0 ) {
[6441] Fix | Delete
$skip_frames--;
[6442] Fix | Delete
} elseif ( isset( $call['class'] ) ) {
[6443] Fix | Delete
if ( $check_class && $ignore_class == $call['class'] ) {
[6444] Fix | Delete
continue; // Filter out calls.
[6445] Fix | Delete
}
[6446] Fix | Delete
[6447] Fix | Delete
$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
[6448] Fix | Delete
} else {
[6449] Fix | Delete
if ( in_array( $call['function'], array( 'do_action', 'apply_filters', 'do_action_ref_array', 'apply_filters_ref_array' ), true ) ) {
[6450] Fix | Delete
$caller[] = "{$call['function']}('{$call['args'][0]}')";
[6451] Fix | Delete
} elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ), true ) ) {
[6452] Fix | Delete
$filename = isset( $call['args'][0] ) ? $call['args'][0] : '';
[6453] Fix | Delete
$caller[] = $call['function'] . "('" . str_replace( $truncate_paths, '', wp_normalize_path( $filename ) ) . "')";
[6454] Fix | Delete
} else {
[6455] Fix | Delete
$caller[] = $call['function'];
[6456] Fix | Delete
}
[6457] Fix | Delete
}
[6458] Fix | Delete
}
[6459] Fix | Delete
if ( $pretty ) {
[6460] Fix | Delete
return implode( ', ', array_reverse( $caller ) );
[6461] Fix | Delete
} else {
[6462] Fix | Delete
return $caller;
[6463] Fix | Delete
}
[6464] Fix | Delete
}
[6465] Fix | Delete
[6466] Fix | Delete
/**
[6467] Fix | Delete
* Retrieve IDs that are not already present in the cache.
[6468] Fix | Delete
*
[6469] Fix | Delete
* @since 3.4.0
[6470] Fix | Delete
* @access private
[6471] Fix | Delete
*
[6472] Fix | Delete
* @param int[] $object_ids Array of IDs.
[6473] Fix | Delete
* @param string $cache_key The cache bucket to check against.
[6474] Fix | Delete
* @return int[] Array of IDs not present in the cache.
[6475] Fix | Delete
*/
[6476] Fix | Delete
function _get_non_cached_ids( $object_ids, $cache_key ) {
[6477] Fix | Delete
$non_cached_ids = array();
[6478] Fix | Delete
$cache_values = wp_cache_get_multiple( $object_ids, $cache_key );
[6479] Fix | Delete
[6480] Fix | Delete
foreach ( $cache_values as $id => $value ) {
[6481] Fix | Delete
if ( ! $value ) {
[6482] Fix | Delete
$non_cached_ids[] = (int) $id;
[6483] Fix | Delete
}
[6484] Fix | Delete
}
[6485] Fix | Delete
[6486] Fix | Delete
return $non_cached_ids;
[6487] Fix | Delete
}
[6488] Fix | Delete
[6489] Fix | Delete
/**
[6490] Fix | Delete
* Test if the current device has the capability to upload files.
[6491] Fix | Delete
*
[6492] Fix | Delete
* @since 3.4.0
[6493] Fix | Delete
* @access private
[6494] Fix | Delete
*
[6495] Fix | Delete
* @return bool Whether the device is able to upload files.
[6496] Fix | Delete
*/
[6497] Fix | Delete
function _device_can_upload() {
[6498] Fix | Delete
if ( ! wp_is_mobile() ) {
[6499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function