Edit File by line
/home/barbar84/www/wp-inclu...
File: functions.php
return true;
[6500] Fix | Delete
}
[6501] Fix | Delete
[6502] Fix | Delete
$ua = $_SERVER['HTTP_USER_AGENT'];
[6503] Fix | Delete
[6504] Fix | Delete
if ( strpos( $ua, 'iPhone' ) !== false
[6505] Fix | Delete
|| strpos( $ua, 'iPad' ) !== false
[6506] Fix | Delete
|| strpos( $ua, 'iPod' ) !== false ) {
[6507] Fix | Delete
return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
[6508] Fix | Delete
}
[6509] Fix | Delete
[6510] Fix | Delete
return true;
[6511] Fix | Delete
}
[6512] Fix | Delete
[6513] Fix | Delete
/**
[6514] Fix | Delete
* Test if a given path is a stream URL
[6515] Fix | Delete
*
[6516] Fix | Delete
* @since 3.5.0
[6517] Fix | Delete
*
[6518] Fix | Delete
* @param string $path The resource path or URL.
[6519] Fix | Delete
* @return bool True if the path is a stream URL.
[6520] Fix | Delete
*/
[6521] Fix | Delete
function wp_is_stream( $path ) {
[6522] Fix | Delete
$scheme_separator = strpos( $path, '://' );
[6523] Fix | Delete
[6524] Fix | Delete
if ( false === $scheme_separator ) {
[6525] Fix | Delete
// $path isn't a stream.
[6526] Fix | Delete
return false;
[6527] Fix | Delete
}
[6528] Fix | Delete
[6529] Fix | Delete
$stream = substr( $path, 0, $scheme_separator );
[6530] Fix | Delete
[6531] Fix | Delete
return in_array( $stream, stream_get_wrappers(), true );
[6532] Fix | Delete
}
[6533] Fix | Delete
[6534] Fix | Delete
/**
[6535] Fix | Delete
* Test if the supplied date is valid for the Gregorian calendar.
[6536] Fix | Delete
*
[6537] Fix | Delete
* @since 3.5.0
[6538] Fix | Delete
*
[6539] Fix | Delete
* @link https://www.php.net/manual/en/function.checkdate.php
[6540] Fix | Delete
*
[6541] Fix | Delete
* @param int $month Month number.
[6542] Fix | Delete
* @param int $day Day number.
[6543] Fix | Delete
* @param int $year Year number.
[6544] Fix | Delete
* @param string $source_date The date to filter.
[6545] Fix | Delete
* @return bool True if valid date, false if not valid date.
[6546] Fix | Delete
*/
[6547] Fix | Delete
function wp_checkdate( $month, $day, $year, $source_date ) {
[6548] Fix | Delete
/**
[6549] Fix | Delete
* Filters whether the given date is valid for the Gregorian calendar.
[6550] Fix | Delete
*
[6551] Fix | Delete
* @since 3.5.0
[6552] Fix | Delete
*
[6553] Fix | Delete
* @param bool $checkdate Whether the given date is valid.
[6554] Fix | Delete
* @param string $source_date Date to check.
[6555] Fix | Delete
*/
[6556] Fix | Delete
return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date );
[6557] Fix | Delete
}
[6558] Fix | Delete
[6559] Fix | Delete
/**
[6560] Fix | Delete
* Load the auth check for monitoring whether the user is still logged in.
[6561] Fix | Delete
*
[6562] Fix | Delete
* Can be disabled with remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
[6563] Fix | Delete
*
[6564] Fix | Delete
* This is disabled for certain screens where a login screen could cause an
[6565] Fix | Delete
* inconvenient interruption. A filter called {@see 'wp_auth_check_load'} can be used
[6566] Fix | Delete
* for fine-grained control.
[6567] Fix | Delete
*
[6568] Fix | Delete
* @since 3.6.0
[6569] Fix | Delete
*/
[6570] Fix | Delete
function wp_auth_check_load() {
[6571] Fix | Delete
if ( ! is_admin() && ! is_user_logged_in() ) {
[6572] Fix | Delete
return;
[6573] Fix | Delete
}
[6574] Fix | Delete
[6575] Fix | Delete
if ( defined( 'IFRAME_REQUEST' ) ) {
[6576] Fix | Delete
return;
[6577] Fix | Delete
}
[6578] Fix | Delete
[6579] Fix | Delete
$screen = get_current_screen();
[6580] Fix | Delete
$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
[6581] Fix | Delete
$show = ! in_array( $screen->id, $hidden, true );
[6582] Fix | Delete
[6583] Fix | Delete
/**
[6584] Fix | Delete
* Filters whether to load the authentication check.
[6585] Fix | Delete
*
[6586] Fix | Delete
* Returning a falsey value from the filter will effectively short-circuit
[6587] Fix | Delete
* loading the authentication check.
[6588] Fix | Delete
*
[6589] Fix | Delete
* @since 3.6.0
[6590] Fix | Delete
*
[6591] Fix | Delete
* @param bool $show Whether to load the authentication check.
[6592] Fix | Delete
* @param WP_Screen $screen The current screen object.
[6593] Fix | Delete
*/
[6594] Fix | Delete
if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) {
[6595] Fix | Delete
wp_enqueue_style( 'wp-auth-check' );
[6596] Fix | Delete
wp_enqueue_script( 'wp-auth-check' );
[6597] Fix | Delete
[6598] Fix | Delete
add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 );
[6599] Fix | Delete
add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 );
[6600] Fix | Delete
}
[6601] Fix | Delete
}
[6602] Fix | Delete
[6603] Fix | Delete
/**
[6604] Fix | Delete
* Output the HTML that shows the wp-login dialog when the user is no longer logged in.
[6605] Fix | Delete
*
[6606] Fix | Delete
* @since 3.6.0
[6607] Fix | Delete
*/
[6608] Fix | Delete
function wp_auth_check_html() {
[6609] Fix | Delete
$login_url = wp_login_url();
[6610] Fix | Delete
$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
[6611] Fix | Delete
$same_domain = ( strpos( $login_url, $current_domain ) === 0 );
[6612] Fix | Delete
[6613] Fix | Delete
/**
[6614] Fix | Delete
* Filters whether the authentication check originated at the same domain.
[6615] Fix | Delete
*
[6616] Fix | Delete
* @since 3.6.0
[6617] Fix | Delete
*
[6618] Fix | Delete
* @param bool $same_domain Whether the authentication check originated at the same domain.
[6619] Fix | Delete
*/
[6620] Fix | Delete
$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
[6621] Fix | Delete
$wrap_class = $same_domain ? 'hidden' : 'hidden fallback';
[6622] Fix | Delete
[6623] Fix | Delete
?>
[6624] Fix | Delete
<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
[6625] Fix | Delete
<div id="wp-auth-check-bg"></div>
[6626] Fix | Delete
<div id="wp-auth-check">
[6627] Fix | Delete
<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></button>
[6628] Fix | Delete
<?php
[6629] Fix | Delete
[6630] Fix | Delete
if ( $same_domain ) {
[6631] Fix | Delete
$login_src = add_query_arg(
[6632] Fix | Delete
array(
[6633] Fix | Delete
'interim-login' => '1',
[6634] Fix | Delete
'wp_lang' => get_user_locale(),
[6635] Fix | Delete
),
[6636] Fix | Delete
$login_url
[6637] Fix | Delete
);
[6638] Fix | Delete
?>
[6639] Fix | Delete
<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( $login_src ); ?>"></div>
[6640] Fix | Delete
<?php
[6641] Fix | Delete
}
[6642] Fix | Delete
[6643] Fix | Delete
?>
[6644] Fix | Delete
<div class="wp-auth-fallback">
[6645] Fix | Delete
<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e( 'Session expired' ); ?></b></p>
[6646] Fix | Delete
<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e( 'Please log in again.' ); ?></a>
[6647] 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>
[6648] Fix | Delete
</div>
[6649] Fix | Delete
</div>
[6650] Fix | Delete
</div>
[6651] Fix | Delete
<?php
[6652] Fix | Delete
}
[6653] Fix | Delete
[6654] Fix | Delete
/**
[6655] Fix | Delete
* Check whether a user is still logged in, for the heartbeat.
[6656] Fix | Delete
*
[6657] Fix | Delete
* Send a result that shows a log-in box if the user is no longer logged in,
[6658] Fix | Delete
* or if their cookie is within the grace period.
[6659] Fix | Delete
*
[6660] Fix | Delete
* @since 3.6.0
[6661] Fix | Delete
*
[6662] Fix | Delete
* @global int $login_grace_period
[6663] Fix | Delete
*
[6664] Fix | Delete
* @param array $response The Heartbeat response.
[6665] Fix | Delete
* @return array The Heartbeat response with 'wp-auth-check' value set.
[6666] Fix | Delete
*/
[6667] Fix | Delete
function wp_auth_check( $response ) {
[6668] Fix | Delete
$response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] );
[6669] Fix | Delete
return $response;
[6670] Fix | Delete
}
[6671] Fix | Delete
[6672] Fix | Delete
/**
[6673] Fix | Delete
* Return RegEx body to liberally match an opening HTML tag.
[6674] Fix | Delete
*
[6675] Fix | Delete
* Matches an opening HTML tag that:
[6676] Fix | Delete
* 1. Is self-closing or
[6677] Fix | Delete
* 2. Has no body but has a closing tag of the same name or
[6678] Fix | Delete
* 3. Contains a body and a closing tag of the same name
[6679] Fix | Delete
*
[6680] Fix | Delete
* Note: this RegEx does not balance inner tags and does not attempt
[6681] Fix | Delete
* to produce valid HTML
[6682] Fix | Delete
*
[6683] Fix | Delete
* @since 3.6.0
[6684] Fix | Delete
*
[6685] Fix | Delete
* @param string $tag An HTML tag name. Example: 'video'.
[6686] Fix | Delete
* @return string Tag RegEx.
[6687] Fix | Delete
*/
[6688] Fix | Delete
function get_tag_regex( $tag ) {
[6689] Fix | Delete
if ( empty( $tag ) ) {
[6690] Fix | Delete
return '';
[6691] Fix | Delete
}
[6692] Fix | Delete
return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
[6693] Fix | Delete
}
[6694] Fix | Delete
[6695] Fix | Delete
/**
[6696] Fix | Delete
* Retrieve a canonical form of the provided charset appropriate for passing to PHP
[6697] Fix | Delete
* functions such as htmlspecialchars() and charset HTML attributes.
[6698] Fix | Delete
*
[6699] Fix | Delete
* @since 3.6.0
[6700] Fix | Delete
* @access private
[6701] Fix | Delete
*
[6702] Fix | Delete
* @see https://core.trac.wordpress.org/ticket/23688
[6703] Fix | Delete
*
[6704] Fix | Delete
* @param string $charset A charset name.
[6705] Fix | Delete
* @return string The canonical form of the charset.
[6706] Fix | Delete
*/
[6707] Fix | Delete
function _canonical_charset( $charset ) {
[6708] Fix | Delete
if ( 'utf-8' === strtolower( $charset ) || 'utf8' === strtolower( $charset ) ) {
[6709] Fix | Delete
[6710] Fix | Delete
return 'UTF-8';
[6711] Fix | Delete
}
[6712] Fix | Delete
[6713] Fix | Delete
if ( 'iso-8859-1' === strtolower( $charset ) || 'iso8859-1' === strtolower( $charset ) ) {
[6714] Fix | Delete
[6715] Fix | Delete
return 'ISO-8859-1';
[6716] Fix | Delete
}
[6717] Fix | Delete
[6718] Fix | Delete
return $charset;
[6719] Fix | Delete
}
[6720] Fix | Delete
[6721] Fix | Delete
/**
[6722] Fix | Delete
* Set the mbstring internal encoding to a binary safe encoding when func_overload
[6723] Fix | Delete
* is enabled.
[6724] Fix | Delete
*
[6725] Fix | Delete
* When mbstring.func_overload is in use for multi-byte encodings, the results from
[6726] Fix | Delete
* strlen() and similar functions respect the utf8 characters, causing binary data
[6727] Fix | Delete
* to return incorrect lengths.
[6728] Fix | Delete
*
[6729] Fix | Delete
* This function overrides the mbstring encoding to a binary-safe encoding, and
[6730] Fix | Delete
* resets it to the users expected encoding afterwards through the
[6731] Fix | Delete
* `reset_mbstring_encoding` function.
[6732] Fix | Delete
*
[6733] Fix | Delete
* It is safe to recursively call this function, however each
[6734] Fix | Delete
* `mbstring_binary_safe_encoding()` call must be followed up with an equal number
[6735] Fix | Delete
* of `reset_mbstring_encoding()` calls.
[6736] Fix | Delete
*
[6737] Fix | Delete
* @since 3.7.0
[6738] Fix | Delete
*
[6739] Fix | Delete
* @see reset_mbstring_encoding()
[6740] Fix | Delete
*
[6741] Fix | Delete
* @param bool $reset Optional. Whether to reset the encoding back to a previously-set encoding.
[6742] Fix | Delete
* Default false.
[6743] Fix | Delete
*/
[6744] Fix | Delete
function mbstring_binary_safe_encoding( $reset = false ) {
[6745] Fix | Delete
static $encodings = array();
[6746] Fix | Delete
static $overloaded = null;
[6747] Fix | Delete
[6748] Fix | Delete
if ( is_null( $overloaded ) ) {
[6749] Fix | Delete
$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 ); // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
[6750] Fix | Delete
}
[6751] Fix | Delete
[6752] Fix | Delete
if ( false === $overloaded ) {
[6753] Fix | Delete
return;
[6754] Fix | Delete
}
[6755] Fix | Delete
[6756] Fix | Delete
if ( ! $reset ) {
[6757] Fix | Delete
$encoding = mb_internal_encoding();
[6758] Fix | Delete
array_push( $encodings, $encoding );
[6759] Fix | Delete
mb_internal_encoding( 'ISO-8859-1' );
[6760] Fix | Delete
}
[6761] Fix | Delete
[6762] Fix | Delete
if ( $reset && $encodings ) {
[6763] Fix | Delete
$encoding = array_pop( $encodings );
[6764] Fix | Delete
mb_internal_encoding( $encoding );
[6765] Fix | Delete
}
[6766] Fix | Delete
}
[6767] Fix | Delete
[6768] Fix | Delete
/**
[6769] Fix | Delete
* Reset the mbstring internal encoding to a users previously set encoding.
[6770] Fix | Delete
*
[6771] Fix | Delete
* @see mbstring_binary_safe_encoding()
[6772] Fix | Delete
*
[6773] Fix | Delete
* @since 3.7.0
[6774] Fix | Delete
*/
[6775] Fix | Delete
function reset_mbstring_encoding() {
[6776] Fix | Delete
mbstring_binary_safe_encoding( true );
[6777] Fix | Delete
}
[6778] Fix | Delete
[6779] Fix | Delete
/**
[6780] Fix | Delete
* Filter/validate a variable as a boolean.
[6781] Fix | Delete
*
[6782] Fix | Delete
* Alternative to `filter_var( $var, FILTER_VALIDATE_BOOLEAN )`.
[6783] Fix | Delete
*
[6784] Fix | Delete
* @since 4.0.0
[6785] Fix | Delete
*
[6786] Fix | Delete
* @param mixed $var Boolean value to validate.
[6787] Fix | Delete
* @return bool Whether the value is validated.
[6788] Fix | Delete
*/
[6789] Fix | Delete
function wp_validate_boolean( $var ) {
[6790] Fix | Delete
if ( is_bool( $var ) ) {
[6791] Fix | Delete
return $var;
[6792] Fix | Delete
}
[6793] Fix | Delete
[6794] Fix | Delete
if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
[6795] Fix | Delete
return false;
[6796] Fix | Delete
}
[6797] Fix | Delete
[6798] Fix | Delete
return (bool) $var;
[6799] Fix | Delete
}
[6800] Fix | Delete
[6801] Fix | Delete
/**
[6802] Fix | Delete
* Delete a file
[6803] Fix | Delete
*
[6804] Fix | Delete
* @since 4.2.0
[6805] Fix | Delete
*
[6806] Fix | Delete
* @param string $file The path to the file to delete.
[6807] Fix | Delete
*/
[6808] Fix | Delete
function wp_delete_file( $file ) {
[6809] Fix | Delete
/**
[6810] Fix | Delete
* Filters the path of the file to delete.
[6811] Fix | Delete
*
[6812] Fix | Delete
* @since 2.1.0
[6813] Fix | Delete
*
[6814] Fix | Delete
* @param string $file Path to the file to delete.
[6815] Fix | Delete
*/
[6816] Fix | Delete
$delete = apply_filters( 'wp_delete_file', $file );
[6817] Fix | Delete
if ( ! empty( $delete ) ) {
[6818] Fix | Delete
@unlink( $delete );
[6819] Fix | Delete
}
[6820] Fix | Delete
}
[6821] Fix | Delete
[6822] Fix | Delete
/**
[6823] Fix | Delete
* Deletes a file if its path is within the given directory.
[6824] Fix | Delete
*
[6825] Fix | Delete
* @since 4.9.7
[6826] Fix | Delete
*
[6827] Fix | Delete
* @param string $file Absolute path to the file to delete.
[6828] Fix | Delete
* @param string $directory Absolute path to a directory.
[6829] Fix | Delete
* @return bool True on success, false on failure.
[6830] Fix | Delete
*/
[6831] Fix | Delete
function wp_delete_file_from_directory( $file, $directory ) {
[6832] Fix | Delete
if ( wp_is_stream( $file ) ) {
[6833] Fix | Delete
$real_file = $file;
[6834] Fix | Delete
$real_directory = $directory;
[6835] Fix | Delete
} else {
[6836] Fix | Delete
$real_file = realpath( wp_normalize_path( $file ) );
[6837] Fix | Delete
$real_directory = realpath( wp_normalize_path( $directory ) );
[6838] Fix | Delete
}
[6839] Fix | Delete
[6840] Fix | Delete
if ( false !== $real_file ) {
[6841] Fix | Delete
$real_file = wp_normalize_path( $real_file );
[6842] Fix | Delete
}
[6843] Fix | Delete
[6844] Fix | Delete
if ( false !== $real_directory ) {
[6845] Fix | Delete
$real_directory = wp_normalize_path( $real_directory );
[6846] Fix | Delete
}
[6847] Fix | Delete
[6848] Fix | Delete
if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0 ) {
[6849] Fix | Delete
return false;
[6850] Fix | Delete
}
[6851] Fix | Delete
[6852] Fix | Delete
wp_delete_file( $file );
[6853] Fix | Delete
[6854] Fix | Delete
return true;
[6855] Fix | Delete
}
[6856] Fix | Delete
[6857] Fix | Delete
/**
[6858] Fix | Delete
* Outputs a small JS snippet on preview tabs/windows to remove `window.name` on unload.
[6859] Fix | Delete
*
[6860] Fix | Delete
* This prevents reusing the same tab for a preview when the user has navigated away.
[6861] Fix | Delete
*
[6862] Fix | Delete
* @since 4.3.0
[6863] Fix | Delete
*
[6864] Fix | Delete
* @global WP_Post $post Global post object.
[6865] Fix | Delete
*/
[6866] Fix | Delete
function wp_post_preview_js() {
[6867] Fix | Delete
global $post;
[6868] Fix | Delete
[6869] Fix | Delete
if ( ! is_preview() || empty( $post ) ) {
[6870] Fix | Delete
return;
[6871] Fix | Delete
}
[6872] Fix | Delete
[6873] Fix | Delete
// Has to match the window name used in post_submit_meta_box().
[6874] Fix | Delete
$name = 'wp-preview-' . (int) $post->ID;
[6875] Fix | Delete
[6876] Fix | Delete
?>
[6877] Fix | Delete
<script>
[6878] Fix | Delete
( function() {
[6879] Fix | Delete
var query = document.location.search;
[6880] Fix | Delete
[6881] Fix | Delete
if ( query && query.indexOf( 'preview=true' ) !== -1 ) {
[6882] Fix | Delete
window.name = '<?php echo $name; ?>';
[6883] Fix | Delete
}
[6884] Fix | Delete
[6885] Fix | Delete
if ( window.addEventListener ) {
[6886] Fix | Delete
window.addEventListener( 'unload', function() { window.name = ''; }, false );
[6887] Fix | Delete
}
[6888] Fix | Delete
}());
[6889] Fix | Delete
</script>
[6890] Fix | Delete
<?php
[6891] Fix | Delete
}
[6892] Fix | Delete
[6893] Fix | Delete
/**
[6894] Fix | Delete
* Parses and formats a MySQL datetime (Y-m-d H:i:s) for ISO8601 (Y-m-d\TH:i:s).
[6895] Fix | Delete
*
[6896] Fix | Delete
* Explicitly strips timezones, as datetimes are not saved with any timezone
[6897] Fix | Delete
* information. Including any information on the offset could be misleading.
[6898] Fix | Delete
*
[6899] Fix | Delete
* Despite historical function name, the output does not conform to RFC3339 format,
[6900] Fix | Delete
* which must contain timezone.
[6901] Fix | Delete
*
[6902] Fix | Delete
* @since 4.4.0
[6903] Fix | Delete
*
[6904] Fix | Delete
* @param string $date_string Date string to parse and format.
[6905] Fix | Delete
* @return string Date formatted for ISO8601 without time zone.
[6906] Fix | Delete
*/
[6907] Fix | Delete
function mysql_to_rfc3339( $date_string ) {
[6908] Fix | Delete
return mysql2date( 'Y-m-d\TH:i:s', $date_string, false );
[6909] Fix | Delete
}
[6910] Fix | Delete
[6911] Fix | Delete
/**
[6912] Fix | Delete
* Attempts to raise the PHP memory limit for memory intensive processes.
[6913] Fix | Delete
*
[6914] Fix | Delete
* Only allows raising the existing limit and prevents lowering it.
[6915] Fix | Delete
*
[6916] Fix | Delete
* @since 4.6.0
[6917] Fix | Delete
*
[6918] Fix | Delete
* @param string $context Optional. Context in which the function is called. Accepts either 'admin',
[6919] Fix | Delete
* 'image', or an arbitrary other context. If an arbitrary context is passed,
[6920] Fix | Delete
* the similarly arbitrary {@see '$context_memory_limit'} filter will be
[6921] Fix | Delete
* invoked. Default 'admin'.
[6922] Fix | Delete
* @return int|string|false The limit that was set or false on failure.
[6923] Fix | Delete
*/
[6924] Fix | Delete
function wp_raise_memory_limit( $context = 'admin' ) {
[6925] Fix | Delete
// Exit early if the limit cannot be changed.
[6926] Fix | Delete
if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
[6927] Fix | Delete
return false;
[6928] Fix | Delete
}
[6929] Fix | Delete
[6930] Fix | Delete
$current_limit = ini_get( 'memory_limit' );
[6931] Fix | Delete
$current_limit_int = wp_convert_hr_to_bytes( $current_limit );
[6932] Fix | Delete
[6933] Fix | Delete
if ( -1 === $current_limit_int ) {
[6934] Fix | Delete
return false;
[6935] Fix | Delete
}
[6936] Fix | Delete
[6937] Fix | Delete
$wp_max_limit = WP_MAX_MEMORY_LIMIT;
[6938] Fix | Delete
$wp_max_limit_int = wp_convert_hr_to_bytes( $wp_max_limit );
[6939] Fix | Delete
$filtered_limit = $wp_max_limit;
[6940] Fix | Delete
[6941] Fix | Delete
switch ( $context ) {
[6942] Fix | Delete
case 'admin':
[6943] Fix | Delete
/**
[6944] Fix | Delete
* Filters the maximum memory limit available for administration screens.
[6945] Fix | Delete
*
[6946] Fix | Delete
* This only applies to administrators, who may require more memory for tasks
[6947] Fix | Delete
* like updates. Memory limits when processing images (uploaded or edited by
[6948] Fix | Delete
* users of any role) are handled separately.
[6949] Fix | Delete
*
[6950] Fix | Delete
* The `WP_MAX_MEMORY_LIMIT` constant specifically defines the maximum memory
[6951] Fix | Delete
* limit available when in the administration back end. The default is 256M
[6952] Fix | Delete
* (256 megabytes of memory) or the original `memory_limit` php.ini value if
[6953] Fix | Delete
* this is higher.
[6954] Fix | Delete
*
[6955] Fix | Delete
* @since 3.0.0
[6956] Fix | Delete
* @since 4.6.0 The default now takes the original `memory_limit` into account.
[6957] Fix | Delete
*
[6958] Fix | Delete
* @param int|string $filtered_limit The maximum WordPress memory limit. Accepts an integer
[6959] Fix | Delete
* (bytes), or a shorthand string notation, such as '256M'.
[6960] Fix | Delete
*/
[6961] Fix | Delete
$filtered_limit = apply_filters( 'admin_memory_limit', $filtered_limit );
[6962] Fix | Delete
break;
[6963] Fix | Delete
[6964] Fix | Delete
case 'image':
[6965] Fix | Delete
/**
[6966] Fix | Delete
* Filters the memory limit allocated for image manipulation.
[6967] Fix | Delete
*
[6968] Fix | Delete
* @since 3.5.0
[6969] Fix | Delete
* @since 4.6.0 The default now takes the original `memory_limit` into account.
[6970] Fix | Delete
*
[6971] Fix | Delete
* @param int|string $filtered_limit Maximum memory limit to allocate for images.
[6972] Fix | Delete
* Default `WP_MAX_MEMORY_LIMIT` or the original
[6973] Fix | Delete
* php.ini `memory_limit`, whichever is higher.
[6974] Fix | Delete
* Accepts an integer (bytes), or a shorthand string
[6975] Fix | Delete
* notation, such as '256M'.
[6976] Fix | Delete
*/
[6977] Fix | Delete
$filtered_limit = apply_filters( 'image_memory_limit', $filtered_limit );
[6978] Fix | Delete
break;
[6979] Fix | Delete
[6980] Fix | Delete
default:
[6981] Fix | Delete
/**
[6982] Fix | Delete
* Filters the memory limit allocated for arbitrary contexts.
[6983] Fix | Delete
*
[6984] Fix | Delete
* The dynamic portion of the hook name, `$context`, refers to an arbitrary
[6985] Fix | Delete
* context passed on calling the function. This allows for plugins to define
[6986] Fix | Delete
* their own contexts for raising the memory limit.
[6987] Fix | Delete
*
[6988] Fix | Delete
* @since 4.6.0
[6989] Fix | Delete
*
[6990] Fix | Delete
* @param int|string $filtered_limit Maximum memory limit to allocate for images.
[6991] Fix | Delete
* Default '256M' or the original php.ini `memory_limit`,
[6992] Fix | Delete
* whichever is higher. Accepts an integer (bytes), or a
[6993] Fix | Delete
* shorthand string notation, such as '256M'.
[6994] Fix | Delete
*/
[6995] Fix | Delete
$filtered_limit = apply_filters( "{$context}_memory_limit", $filtered_limit );
[6996] Fix | Delete
break;
[6997] Fix | Delete
}
[6998] Fix | Delete
[6999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function