Edit File by line
/home/barbar84/www/wp-inclu...
File: functions.php
$filtered_limit_int = wp_convert_hr_to_bytes( $filtered_limit );
[7000] Fix | Delete
[7001] Fix | Delete
if ( -1 === $filtered_limit_int || ( $filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) {
[7002] Fix | Delete
if ( false !== ini_set( 'memory_limit', $filtered_limit ) ) {
[7003] Fix | Delete
return $filtered_limit;
[7004] Fix | Delete
} else {
[7005] Fix | Delete
return false;
[7006] Fix | Delete
}
[7007] Fix | Delete
} elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) {
[7008] Fix | Delete
if ( false !== ini_set( 'memory_limit', $wp_max_limit ) ) {
[7009] Fix | Delete
return $wp_max_limit;
[7010] Fix | Delete
} else {
[7011] Fix | Delete
return false;
[7012] Fix | Delete
}
[7013] Fix | Delete
}
[7014] Fix | Delete
[7015] Fix | Delete
return false;
[7016] Fix | Delete
}
[7017] Fix | Delete
[7018] Fix | Delete
/**
[7019] Fix | Delete
* Generate a random UUID (version 4).
[7020] Fix | Delete
*
[7021] Fix | Delete
* @since 4.7.0
[7022] Fix | Delete
*
[7023] Fix | Delete
* @return string UUID.
[7024] Fix | Delete
*/
[7025] Fix | Delete
function wp_generate_uuid4() {
[7026] Fix | Delete
return sprintf(
[7027] Fix | Delete
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
[7028] Fix | Delete
mt_rand( 0, 0xffff ),
[7029] Fix | Delete
mt_rand( 0, 0xffff ),
[7030] Fix | Delete
mt_rand( 0, 0xffff ),
[7031] Fix | Delete
mt_rand( 0, 0x0fff ) | 0x4000,
[7032] Fix | Delete
mt_rand( 0, 0x3fff ) | 0x8000,
[7033] Fix | Delete
mt_rand( 0, 0xffff ),
[7034] Fix | Delete
mt_rand( 0, 0xffff ),
[7035] Fix | Delete
mt_rand( 0, 0xffff )
[7036] Fix | Delete
);
[7037] Fix | Delete
}
[7038] Fix | Delete
[7039] Fix | Delete
/**
[7040] Fix | Delete
* Validates that a UUID is valid.
[7041] Fix | Delete
*
[7042] Fix | Delete
* @since 4.9.0
[7043] Fix | Delete
*
[7044] Fix | Delete
* @param mixed $uuid UUID to check.
[7045] Fix | Delete
* @param int $version Specify which version of UUID to check against. Default is none,
[7046] Fix | Delete
* to accept any UUID version. Otherwise, only version allowed is `4`.
[7047] Fix | Delete
* @return bool The string is a valid UUID or false on failure.
[7048] Fix | Delete
*/
[7049] Fix | Delete
function wp_is_uuid( $uuid, $version = null ) {
[7050] Fix | Delete
[7051] Fix | Delete
if ( ! is_string( $uuid ) ) {
[7052] Fix | Delete
return false;
[7053] Fix | Delete
}
[7054] Fix | Delete
[7055] Fix | Delete
if ( is_numeric( $version ) ) {
[7056] Fix | Delete
if ( 4 !== (int) $version ) {
[7057] Fix | Delete
_doing_it_wrong( __FUNCTION__, __( 'Only UUID V4 is supported at this time.' ), '4.9.0' );
[7058] Fix | Delete
return false;
[7059] Fix | Delete
}
[7060] Fix | Delete
$regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/';
[7061] Fix | Delete
} else {
[7062] Fix | Delete
$regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/';
[7063] Fix | Delete
}
[7064] Fix | Delete
[7065] Fix | Delete
return (bool) preg_match( $regex, $uuid );
[7066] Fix | Delete
}
[7067] Fix | Delete
[7068] Fix | Delete
/**
[7069] Fix | Delete
* Gets unique ID.
[7070] Fix | Delete
*
[7071] Fix | Delete
* This is a PHP implementation of Underscore's uniqueId method. A static variable
[7072] Fix | Delete
* contains an integer that is incremented with each call. This number is returned
[7073] Fix | Delete
* with the optional prefix. As such the returned value is not universally unique,
[7074] Fix | Delete
* but it is unique across the life of the PHP process.
[7075] Fix | Delete
*
[7076] Fix | Delete
* @since 5.0.3
[7077] Fix | Delete
*
[7078] Fix | Delete
* @param string $prefix Prefix for the returned ID.
[7079] Fix | Delete
* @return string Unique ID.
[7080] Fix | Delete
*/
[7081] Fix | Delete
function wp_unique_id( $prefix = '' ) {
[7082] Fix | Delete
static $id_counter = 0;
[7083] Fix | Delete
return $prefix . (string) ++$id_counter;
[7084] Fix | Delete
}
[7085] Fix | Delete
[7086] Fix | Delete
/**
[7087] Fix | Delete
* Gets last changed date for the specified cache group.
[7088] Fix | Delete
*
[7089] Fix | Delete
* @since 4.7.0
[7090] Fix | Delete
*
[7091] Fix | Delete
* @param string $group Where the cache contents are grouped.
[7092] Fix | Delete
* @return string UNIX timestamp with microseconds representing when the group was last changed.
[7093] Fix | Delete
*/
[7094] Fix | Delete
function wp_cache_get_last_changed( $group ) {
[7095] Fix | Delete
$last_changed = wp_cache_get( 'last_changed', $group );
[7096] Fix | Delete
[7097] Fix | Delete
if ( ! $last_changed ) {
[7098] Fix | Delete
$last_changed = microtime();
[7099] Fix | Delete
wp_cache_set( 'last_changed', $last_changed, $group );
[7100] Fix | Delete
}
[7101] Fix | Delete
[7102] Fix | Delete
return $last_changed;
[7103] Fix | Delete
}
[7104] Fix | Delete
[7105] Fix | Delete
/**
[7106] Fix | Delete
* Send an email to the old site admin email address when the site admin email address changes.
[7107] Fix | Delete
*
[7108] Fix | Delete
* @since 4.9.0
[7109] Fix | Delete
*
[7110] Fix | Delete
* @param string $old_email The old site admin email address.
[7111] Fix | Delete
* @param string $new_email The new site admin email address.
[7112] Fix | Delete
* @param string $option_name The relevant database option name.
[7113] Fix | Delete
*/
[7114] Fix | Delete
function wp_site_admin_email_change_notification( $old_email, $new_email, $option_name ) {
[7115] Fix | Delete
$send = true;
[7116] Fix | Delete
[7117] Fix | Delete
// Don't send the notification to the default 'admin_email' value.
[7118] Fix | Delete
if ( 'you@example.com' === $old_email ) {
[7119] Fix | Delete
$send = false;
[7120] Fix | Delete
}
[7121] Fix | Delete
[7122] Fix | Delete
/**
[7123] Fix | Delete
* Filters whether to send the site admin email change notification email.
[7124] Fix | Delete
*
[7125] Fix | Delete
* @since 4.9.0
[7126] Fix | Delete
*
[7127] Fix | Delete
* @param bool $send Whether to send the email notification.
[7128] Fix | Delete
* @param string $old_email The old site admin email address.
[7129] Fix | Delete
* @param string $new_email The new site admin email address.
[7130] Fix | Delete
*/
[7131] Fix | Delete
$send = apply_filters( 'send_site_admin_email_change_email', $send, $old_email, $new_email );
[7132] Fix | Delete
[7133] Fix | Delete
if ( ! $send ) {
[7134] Fix | Delete
return;
[7135] Fix | Delete
}
[7136] Fix | Delete
[7137] Fix | Delete
/* translators: Do not translate OLD_EMAIL, NEW_EMAIL, SITENAME, SITEURL: those are placeholders. */
[7138] Fix | Delete
$email_change_text = __(
[7139] Fix | Delete
'Hi,
[7140] Fix | Delete
[7141] Fix | Delete
This notice confirms that the admin email address was changed on ###SITENAME###.
[7142] Fix | Delete
[7143] Fix | Delete
The new admin email address is ###NEW_EMAIL###.
[7144] Fix | Delete
[7145] Fix | Delete
This email has been sent to ###OLD_EMAIL###
[7146] Fix | Delete
[7147] Fix | Delete
Regards,
[7148] Fix | Delete
All at ###SITENAME###
[7149] Fix | Delete
###SITEURL###'
[7150] Fix | Delete
);
[7151] Fix | Delete
[7152] Fix | Delete
$email_change_email = array(
[7153] Fix | Delete
'to' => $old_email,
[7154] Fix | Delete
/* translators: Site admin email change notification email subject. %s: Site title. */
[7155] Fix | Delete
'subject' => __( '[%s] Admin Email Changed' ),
[7156] Fix | Delete
'message' => $email_change_text,
[7157] Fix | Delete
'headers' => '',
[7158] Fix | Delete
);
[7159] Fix | Delete
[7160] Fix | Delete
// Get site name.
[7161] Fix | Delete
$site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
[7162] Fix | Delete
[7163] Fix | Delete
/**
[7164] Fix | Delete
* Filters the contents of the email notification sent when the site admin email address is changed.
[7165] Fix | Delete
*
[7166] Fix | Delete
* @since 4.9.0
[7167] Fix | Delete
*
[7168] Fix | Delete
* @param array $email_change_email {
[7169] Fix | Delete
* Used to build wp_mail().
[7170] Fix | Delete
*
[7171] Fix | Delete
* @type string $to The intended recipient.
[7172] Fix | Delete
* @type string $subject The subject of the email.
[7173] Fix | Delete
* @type string $message The content of the email.
[7174] Fix | Delete
* The following strings have a special meaning and will get replaced dynamically:
[7175] Fix | Delete
* - ###OLD_EMAIL### The old site admin email address.
[7176] Fix | Delete
* - ###NEW_EMAIL### The new site admin email address.
[7177] Fix | Delete
* - ###SITENAME### The name of the site.
[7178] Fix | Delete
* - ###SITEURL### The URL to the site.
[7179] Fix | Delete
* @type string $headers Headers.
[7180] Fix | Delete
* }
[7181] Fix | Delete
* @param string $old_email The old site admin email address.
[7182] Fix | Delete
* @param string $new_email The new site admin email address.
[7183] Fix | Delete
*/
[7184] Fix | Delete
$email_change_email = apply_filters( 'site_admin_email_change_email', $email_change_email, $old_email, $new_email );
[7185] Fix | Delete
[7186] Fix | Delete
$email_change_email['message'] = str_replace( '###OLD_EMAIL###', $old_email, $email_change_email['message'] );
[7187] Fix | Delete
$email_change_email['message'] = str_replace( '###NEW_EMAIL###', $new_email, $email_change_email['message'] );
[7188] Fix | Delete
$email_change_email['message'] = str_replace( '###SITENAME###', $site_name, $email_change_email['message'] );
[7189] Fix | Delete
$email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] );
[7190] Fix | Delete
[7191] Fix | Delete
wp_mail(
[7192] Fix | Delete
$email_change_email['to'],
[7193] Fix | Delete
sprintf(
[7194] Fix | Delete
$email_change_email['subject'],
[7195] Fix | Delete
$site_name
[7196] Fix | Delete
),
[7197] Fix | Delete
$email_change_email['message'],
[7198] Fix | Delete
$email_change_email['headers']
[7199] Fix | Delete
);
[7200] Fix | Delete
}
[7201] Fix | Delete
[7202] Fix | Delete
/**
[7203] Fix | Delete
* Return an anonymized IPv4 or IPv6 address.
[7204] Fix | Delete
*
[7205] Fix | Delete
* @since 4.9.6 Abstracted from `WP_Community_Events::get_unsafe_client_ip()`.
[7206] Fix | Delete
*
[7207] Fix | Delete
* @param string $ip_addr The IPv4 or IPv6 address to be anonymized.
[7208] Fix | Delete
* @param bool $ipv6_fallback Optional. Whether to return the original IPv6 address if the needed functions
[7209] Fix | Delete
* to anonymize it are not present. Default false, return `::` (unspecified address).
[7210] Fix | Delete
* @return string The anonymized IP address.
[7211] Fix | Delete
*/
[7212] Fix | Delete
function wp_privacy_anonymize_ip( $ip_addr, $ipv6_fallback = false ) {
[7213] Fix | Delete
// Detect what kind of IP address this is.
[7214] Fix | Delete
$ip_prefix = '';
[7215] Fix | Delete
$is_ipv6 = substr_count( $ip_addr, ':' ) > 1;
[7216] Fix | Delete
$is_ipv4 = ( 3 === substr_count( $ip_addr, '.' ) );
[7217] Fix | Delete
[7218] Fix | Delete
if ( $is_ipv6 && $is_ipv4 ) {
[7219] Fix | Delete
// IPv6 compatibility mode, temporarily strip the IPv6 part, and treat it like IPv4.
[7220] Fix | Delete
$ip_prefix = '::ffff:';
[7221] Fix | Delete
$ip_addr = preg_replace( '/^\[?[0-9a-f:]*:/i', '', $ip_addr );
[7222] Fix | Delete
$ip_addr = str_replace( ']', '', $ip_addr );
[7223] Fix | Delete
$is_ipv6 = false;
[7224] Fix | Delete
}
[7225] Fix | Delete
[7226] Fix | Delete
if ( $is_ipv6 ) {
[7227] Fix | Delete
// IPv6 addresses will always be enclosed in [] if there's a port.
[7228] Fix | Delete
$left_bracket = strpos( $ip_addr, '[' );
[7229] Fix | Delete
$right_bracket = strpos( $ip_addr, ']' );
[7230] Fix | Delete
$percent = strpos( $ip_addr, '%' );
[7231] Fix | Delete
$netmask = 'ffff:ffff:ffff:ffff:0000:0000:0000:0000';
[7232] Fix | Delete
[7233] Fix | Delete
// Strip the port (and [] from IPv6 addresses), if they exist.
[7234] Fix | Delete
if ( false !== $left_bracket && false !== $right_bracket ) {
[7235] Fix | Delete
$ip_addr = substr( $ip_addr, $left_bracket + 1, $right_bracket - $left_bracket - 1 );
[7236] Fix | Delete
} elseif ( false !== $left_bracket || false !== $right_bracket ) {
[7237] Fix | Delete
// The IP has one bracket, but not both, so it's malformed.
[7238] Fix | Delete
return '::';
[7239] Fix | Delete
}
[7240] Fix | Delete
[7241] Fix | Delete
// Strip the reachability scope.
[7242] Fix | Delete
if ( false !== $percent ) {
[7243] Fix | Delete
$ip_addr = substr( $ip_addr, 0, $percent );
[7244] Fix | Delete
}
[7245] Fix | Delete
[7246] Fix | Delete
// No invalid characters should be left.
[7247] Fix | Delete
if ( preg_match( '/[^0-9a-f:]/i', $ip_addr ) ) {
[7248] Fix | Delete
return '::';
[7249] Fix | Delete
}
[7250] Fix | Delete
[7251] Fix | Delete
// Partially anonymize the IP by reducing it to the corresponding network ID.
[7252] Fix | Delete
if ( function_exists( 'inet_pton' ) && function_exists( 'inet_ntop' ) ) {
[7253] Fix | Delete
$ip_addr = inet_ntop( inet_pton( $ip_addr ) & inet_pton( $netmask ) );
[7254] Fix | Delete
if ( false === $ip_addr ) {
[7255] Fix | Delete
return '::';
[7256] Fix | Delete
}
[7257] Fix | Delete
} elseif ( ! $ipv6_fallback ) {
[7258] Fix | Delete
return '::';
[7259] Fix | Delete
}
[7260] Fix | Delete
} elseif ( $is_ipv4 ) {
[7261] Fix | Delete
// Strip any port and partially anonymize the IP.
[7262] Fix | Delete
$last_octet_position = strrpos( $ip_addr, '.' );
[7263] Fix | Delete
$ip_addr = substr( $ip_addr, 0, $last_octet_position ) . '.0';
[7264] Fix | Delete
} else {
[7265] Fix | Delete
return '0.0.0.0';
[7266] Fix | Delete
}
[7267] Fix | Delete
[7268] Fix | Delete
// Restore the IPv6 prefix to compatibility mode addresses.
[7269] Fix | Delete
return $ip_prefix . $ip_addr;
[7270] Fix | Delete
}
[7271] Fix | Delete
[7272] Fix | Delete
/**
[7273] Fix | Delete
* Return uniform "anonymous" data by type.
[7274] Fix | Delete
*
[7275] Fix | Delete
* @since 4.9.6
[7276] Fix | Delete
*
[7277] Fix | Delete
* @param string $type The type of data to be anonymized.
[7278] Fix | Delete
* @param string $data Optional The data to be anonymized.
[7279] Fix | Delete
* @return string The anonymous data for the requested type.
[7280] Fix | Delete
*/
[7281] Fix | Delete
function wp_privacy_anonymize_data( $type, $data = '' ) {
[7282] Fix | Delete
[7283] Fix | Delete
switch ( $type ) {
[7284] Fix | Delete
case 'email':
[7285] Fix | Delete
$anonymous = 'deleted@site.invalid';
[7286] Fix | Delete
break;
[7287] Fix | Delete
case 'url':
[7288] Fix | Delete
$anonymous = 'https://site.invalid';
[7289] Fix | Delete
break;
[7290] Fix | Delete
case 'ip':
[7291] Fix | Delete
$anonymous = wp_privacy_anonymize_ip( $data );
[7292] Fix | Delete
break;
[7293] Fix | Delete
case 'date':
[7294] Fix | Delete
$anonymous = '0000-00-00 00:00:00';
[7295] Fix | Delete
break;
[7296] Fix | Delete
case 'text':
[7297] Fix | Delete
/* translators: Deleted text. */
[7298] Fix | Delete
$anonymous = __( '[deleted]' );
[7299] Fix | Delete
break;
[7300] Fix | Delete
case 'longtext':
[7301] Fix | Delete
/* translators: Deleted long text. */
[7302] Fix | Delete
$anonymous = __( 'This content was deleted by the author.' );
[7303] Fix | Delete
break;
[7304] Fix | Delete
default:
[7305] Fix | Delete
$anonymous = '';
[7306] Fix | Delete
break;
[7307] Fix | Delete
}
[7308] Fix | Delete
[7309] Fix | Delete
/**
[7310] Fix | Delete
* Filters the anonymous data for each type.
[7311] Fix | Delete
*
[7312] Fix | Delete
* @since 4.9.6
[7313] Fix | Delete
*
[7314] Fix | Delete
* @param string $anonymous Anonymized data.
[7315] Fix | Delete
* @param string $type Type of the data.
[7316] Fix | Delete
* @param string $data Original data.
[7317] Fix | Delete
*/
[7318] Fix | Delete
return apply_filters( 'wp_privacy_anonymize_data', $anonymous, $type, $data );
[7319] Fix | Delete
}
[7320] Fix | Delete
[7321] Fix | Delete
/**
[7322] Fix | Delete
* Returns the directory used to store personal data export files.
[7323] Fix | Delete
*
[7324] Fix | Delete
* @since 4.9.6
[7325] Fix | Delete
*
[7326] Fix | Delete
* @see wp_privacy_exports_url
[7327] Fix | Delete
*
[7328] Fix | Delete
* @return string Exports directory.
[7329] Fix | Delete
*/
[7330] Fix | Delete
function wp_privacy_exports_dir() {
[7331] Fix | Delete
$upload_dir = wp_upload_dir();
[7332] Fix | Delete
$exports_dir = trailingslashit( $upload_dir['basedir'] ) . 'wp-personal-data-exports/';
[7333] Fix | Delete
[7334] Fix | Delete
/**
[7335] Fix | Delete
* Filters the directory used to store personal data export files.
[7336] Fix | Delete
*
[7337] Fix | Delete
* @since 4.9.6
[7338] Fix | Delete
* @since 5.5.0 Exports now use relative paths, so changes to the directory
[7339] Fix | Delete
* via this filter should be reflected on the server.
[7340] Fix | Delete
*
[7341] Fix | Delete
* @param string $exports_dir Exports directory.
[7342] Fix | Delete
*/
[7343] Fix | Delete
return apply_filters( 'wp_privacy_exports_dir', $exports_dir );
[7344] Fix | Delete
}
[7345] Fix | Delete
[7346] Fix | Delete
/**
[7347] Fix | Delete
* Returns the URL of the directory used to store personal data export files.
[7348] Fix | Delete
*
[7349] Fix | Delete
* @since 4.9.6
[7350] Fix | Delete
*
[7351] Fix | Delete
* @see wp_privacy_exports_dir
[7352] Fix | Delete
*
[7353] Fix | Delete
* @return string Exports directory URL.
[7354] Fix | Delete
*/
[7355] Fix | Delete
function wp_privacy_exports_url() {
[7356] Fix | Delete
$upload_dir = wp_upload_dir();
[7357] Fix | Delete
$exports_url = trailingslashit( $upload_dir['baseurl'] ) . 'wp-personal-data-exports/';
[7358] Fix | Delete
[7359] Fix | Delete
/**
[7360] Fix | Delete
* Filters the URL of the directory used to store personal data export files.
[7361] Fix | Delete
*
[7362] Fix | Delete
* @since 4.9.6
[7363] Fix | Delete
* @since 5.5.0 Exports now use relative paths, so changes to the directory URL
[7364] Fix | Delete
* via this filter should be reflected on the server.
[7365] Fix | Delete
*
[7366] Fix | Delete
* @param string $exports_url Exports directory URL.
[7367] Fix | Delete
*/
[7368] Fix | Delete
return apply_filters( 'wp_privacy_exports_url', $exports_url );
[7369] Fix | Delete
}
[7370] Fix | Delete
[7371] Fix | Delete
/**
[7372] Fix | Delete
* Schedule a `WP_Cron` job to delete expired export files.
[7373] Fix | Delete
*
[7374] Fix | Delete
* @since 4.9.6
[7375] Fix | Delete
*/
[7376] Fix | Delete
function wp_schedule_delete_old_privacy_export_files() {
[7377] Fix | Delete
if ( wp_installing() ) {
[7378] Fix | Delete
return;
[7379] Fix | Delete
}
[7380] Fix | Delete
[7381] Fix | Delete
if ( ! wp_next_scheduled( 'wp_privacy_delete_old_export_files' ) ) {
[7382] Fix | Delete
wp_schedule_event( time(), 'hourly', 'wp_privacy_delete_old_export_files' );
[7383] Fix | Delete
}
[7384] Fix | Delete
}
[7385] Fix | Delete
[7386] Fix | Delete
/**
[7387] Fix | Delete
* Cleans up export files older than three days old.
[7388] Fix | Delete
*
[7389] Fix | Delete
* The export files are stored in `wp-content/uploads`, and are therefore publicly
[7390] Fix | Delete
* accessible. A CSPRN is appended to the filename to mitigate the risk of an
[7391] Fix | Delete
* unauthorized person downloading the file, but it is still possible. Deleting
[7392] Fix | Delete
* the file after the data subject has had a chance to delete it adds an additional
[7393] Fix | Delete
* layer of protection.
[7394] Fix | Delete
*
[7395] Fix | Delete
* @since 4.9.6
[7396] Fix | Delete
*/
[7397] Fix | Delete
function wp_privacy_delete_old_export_files() {
[7398] Fix | Delete
$exports_dir = wp_privacy_exports_dir();
[7399] Fix | Delete
if ( ! is_dir( $exports_dir ) ) {
[7400] Fix | Delete
return;
[7401] Fix | Delete
}
[7402] Fix | Delete
[7403] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/file.php';
[7404] Fix | Delete
$export_files = list_files( $exports_dir, 100, array( 'index.php' ) );
[7405] Fix | Delete
[7406] Fix | Delete
/**
[7407] Fix | Delete
* Filters the lifetime, in seconds, of a personal data export file.
[7408] Fix | Delete
*
[7409] Fix | Delete
* By default, the lifetime is 3 days. Once the file reaches that age, it will automatically
[7410] Fix | Delete
* be deleted by a cron job.
[7411] Fix | Delete
*
[7412] Fix | Delete
* @since 4.9.6
[7413] Fix | Delete
*
[7414] Fix | Delete
* @param int $expiration The expiration age of the export, in seconds.
[7415] Fix | Delete
*/
[7416] Fix | Delete
$expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
[7417] Fix | Delete
[7418] Fix | Delete
foreach ( (array) $export_files as $export_file ) {
[7419] Fix | Delete
$file_age_in_seconds = time() - filemtime( $export_file );
[7420] Fix | Delete
[7421] Fix | Delete
if ( $expiration < $file_age_in_seconds ) {
[7422] Fix | Delete
unlink( $export_file );
[7423] Fix | Delete
}
[7424] Fix | Delete
}
[7425] Fix | Delete
}
[7426] Fix | Delete
[7427] Fix | Delete
/**
[7428] Fix | Delete
* Gets the URL to learn more about updating the PHP version the site is running on.
[7429] Fix | Delete
*
[7430] Fix | Delete
* This URL can be overridden by specifying an environment variable `WP_UPDATE_PHP_URL` or by using the
[7431] Fix | Delete
* {@see 'wp_update_php_url'} filter. Providing an empty string is not allowed and will result in the
[7432] Fix | Delete
* default URL being used. Furthermore the page the URL links to should preferably be localized in the
[7433] Fix | Delete
* site language.
[7434] Fix | Delete
*
[7435] Fix | Delete
* @since 5.1.0
[7436] Fix | Delete
*
[7437] Fix | Delete
* @return string URL to learn more about updating PHP.
[7438] Fix | Delete
*/
[7439] Fix | Delete
function wp_get_update_php_url() {
[7440] Fix | Delete
$default_url = wp_get_default_update_php_url();
[7441] Fix | Delete
[7442] Fix | Delete
$update_url = $default_url;
[7443] Fix | Delete
if ( false !== getenv( 'WP_UPDATE_PHP_URL' ) ) {
[7444] Fix | Delete
$update_url = getenv( 'WP_UPDATE_PHP_URL' );
[7445] Fix | Delete
}
[7446] Fix | Delete
[7447] Fix | Delete
/**
[7448] Fix | Delete
* Filters the URL to learn more about updating the PHP version the site is running on.
[7449] Fix | Delete
*
[7450] Fix | Delete
* Providing an empty string is not allowed and will result in the default URL being used. Furthermore
[7451] Fix | Delete
* the page the URL links to should preferably be localized in the site language.
[7452] Fix | Delete
*
[7453] Fix | Delete
* @since 5.1.0
[7454] Fix | Delete
*
[7455] Fix | Delete
* @param string $update_url URL to learn more about updating PHP.
[7456] Fix | Delete
*/
[7457] Fix | Delete
$update_url = apply_filters( 'wp_update_php_url', $update_url );
[7458] Fix | Delete
[7459] Fix | Delete
if ( empty( $update_url ) ) {
[7460] Fix | Delete
$update_url = $default_url;
[7461] Fix | Delete
}
[7462] Fix | Delete
[7463] Fix | Delete
return $update_url;
[7464] Fix | Delete
}
[7465] Fix | Delete
[7466] Fix | Delete
/**
[7467] Fix | Delete
* Gets the default URL to learn more about updating the PHP version the site is running on.
[7468] Fix | Delete
*
[7469] Fix | Delete
* Do not use this function to retrieve this URL. Instead, use {@see wp_get_update_php_url()} when relying on the URL.
[7470] Fix | Delete
* This function does not allow modifying the returned URL, and is only used to compare the actually used URL with the
[7471] Fix | Delete
* default one.
[7472] Fix | Delete
*
[7473] Fix | Delete
* @since 5.1.0
[7474] Fix | Delete
* @access private
[7475] Fix | Delete
*
[7476] Fix | Delete
* @return string Default URL to learn more about updating PHP.
[7477] Fix | Delete
*/
[7478] Fix | Delete
function wp_get_default_update_php_url() {
[7479] Fix | Delete
return _x( 'https://wordpress.org/support/update-php/', 'localized PHP upgrade information page' );
[7480] Fix | Delete
}
[7481] Fix | Delete
[7482] Fix | Delete
/**
[7483] Fix | Delete
* Prints the default annotation for the web host altering the "Update PHP" page URL.
[7484] Fix | Delete
*
[7485] Fix | Delete
* This function is to be used after {@see wp_get_update_php_url()} to display a consistent
[7486] Fix | Delete
* annotation if the web host has altered the default "Update PHP" page URL.
[7487] Fix | Delete
*
[7488] Fix | Delete
* @since 5.1.0
[7489] Fix | Delete
* @since 5.2.0 Added the `$before` and `$after` parameters.
[7490] Fix | Delete
*
[7491] Fix | Delete
* @param string $before Markup to output before the annotation. Default `<p class="description">`.
[7492] Fix | Delete
* @param string $after Markup to output after the annotation. Default `</p>`.
[7493] Fix | Delete
*/
[7494] Fix | Delete
function wp_update_php_annotation( $before = '<p class="description">', $after = '</p>' ) {
[7495] Fix | Delete
$annotation = wp_get_update_php_annotation();
[7496] Fix | Delete
[7497] Fix | Delete
if ( $annotation ) {
[7498] Fix | Delete
echo $before . $annotation . $after;
[7499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function