Edit File by line
/home/barbar84/www/wp-inclu...
File: functions.php
[3000] Fix | Delete
// The mime type must be allowed.
[3001] Fix | Delete
if ( $type ) {
[3002] Fix | Delete
$allowed = get_allowed_mime_types();
[3003] Fix | Delete
[3004] Fix | Delete
if ( ! in_array( $type, $allowed, true ) ) {
[3005] Fix | Delete
$type = false;
[3006] Fix | Delete
$ext = false;
[3007] Fix | Delete
}
[3008] Fix | Delete
}
[3009] Fix | Delete
[3010] Fix | Delete
/**
[3011] Fix | Delete
* Filters the "real" file type of the given file.
[3012] Fix | Delete
*
[3013] Fix | Delete
* @since 3.0.0
[3014] Fix | Delete
* @since 5.1.0 The $real_mime parameter was added.
[3015] Fix | Delete
*
[3016] Fix | Delete
* @param array $wp_check_filetype_and_ext {
[3017] Fix | Delete
* Values for the extension, mime type, and corrected filename.
[3018] Fix | Delete
*
[3019] Fix | Delete
* @type string|false $ext File extension, or false if the file doesn't match a mime type.
[3020] Fix | Delete
* @type string|false $type File mime type, or false if the file doesn't match a mime type.
[3021] Fix | Delete
* @type string|false $proper_filename File name with its correct extension, or false if it cannot be determined.
[3022] Fix | Delete
* }
[3023] Fix | Delete
* @param string $file Full path to the file.
[3024] Fix | Delete
* @param string $filename The name of the file (may differ from $file due to
[3025] Fix | Delete
* $file being in a tmp directory).
[3026] Fix | Delete
* @param string[] $mimes Array of mime types keyed by their file extension regex.
[3027] Fix | Delete
* @param string|false $real_mime The actual mime type or false if the type cannot be determined.
[3028] Fix | Delete
*/
[3029] Fix | Delete
return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes, $real_mime );
[3030] Fix | Delete
}
[3031] Fix | Delete
[3032] Fix | Delete
/**
[3033] Fix | Delete
* Returns the real mime type of an image file.
[3034] Fix | Delete
*
[3035] Fix | Delete
* This depends on exif_imagetype() or getimagesize() to determine real mime types.
[3036] Fix | Delete
*
[3037] Fix | Delete
* @since 4.7.1
[3038] Fix | Delete
*
[3039] Fix | Delete
* @param string $file Full path to the file.
[3040] Fix | Delete
* @return string|false The actual mime type or false if the type cannot be determined.
[3041] Fix | Delete
*/
[3042] Fix | Delete
function wp_get_image_mime( $file ) {
[3043] Fix | Delete
/*
[3044] Fix | Delete
* Use exif_imagetype() to check the mimetype if available or fall back to
[3045] Fix | Delete
* getimagesize() if exif isn't avaialbe. If either function throws an Exception
[3046] Fix | Delete
* we assume the file could not be validated.
[3047] Fix | Delete
*/
[3048] Fix | Delete
try {
[3049] Fix | Delete
if ( is_callable( 'exif_imagetype' ) ) {
[3050] Fix | Delete
$imagetype = exif_imagetype( $file );
[3051] Fix | Delete
$mime = ( $imagetype ) ? image_type_to_mime_type( $imagetype ) : false;
[3052] Fix | Delete
} elseif ( function_exists( 'getimagesize' ) ) {
[3053] Fix | Delete
$imagesize = wp_getimagesize( $file );
[3054] Fix | Delete
$mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false;
[3055] Fix | Delete
} else {
[3056] Fix | Delete
$mime = false;
[3057] Fix | Delete
}
[3058] Fix | Delete
} catch ( Exception $e ) {
[3059] Fix | Delete
$mime = false;
[3060] Fix | Delete
}
[3061] Fix | Delete
[3062] Fix | Delete
return $mime;
[3063] Fix | Delete
}
[3064] Fix | Delete
[3065] Fix | Delete
/**
[3066] Fix | Delete
* Retrieve list of mime types and file extensions.
[3067] Fix | Delete
*
[3068] Fix | Delete
* @since 3.5.0
[3069] Fix | Delete
* @since 4.2.0 Support was added for GIMP (.xcf) files.
[3070] Fix | Delete
* @since 4.9.2 Support was added for Flac (.flac) files.
[3071] Fix | Delete
* @since 4.9.6 Support was added for AAC (.aac) files.
[3072] Fix | Delete
*
[3073] Fix | Delete
* @return string[] Array of mime types keyed by the file extension regex corresponding to those types.
[3074] Fix | Delete
*/
[3075] Fix | Delete
function wp_get_mime_types() {
[3076] Fix | Delete
/**
[3077] Fix | Delete
* Filters the list of mime types and file extensions.
[3078] Fix | Delete
*
[3079] Fix | Delete
* This filter should be used to add, not remove, mime types. To remove
[3080] Fix | Delete
* mime types, use the {@see 'upload_mimes'} filter.
[3081] Fix | Delete
*
[3082] Fix | Delete
* @since 3.5.0
[3083] Fix | Delete
*
[3084] Fix | Delete
* @param string[] $wp_get_mime_types Mime types keyed by the file extension regex
[3085] Fix | Delete
* corresponding to those types.
[3086] Fix | Delete
*/
[3087] Fix | Delete
return apply_filters(
[3088] Fix | Delete
'mime_types',
[3089] Fix | Delete
array(
[3090] Fix | Delete
// Image formats.
[3091] Fix | Delete
'jpg|jpeg|jpe' => 'image/jpeg',
[3092] Fix | Delete
'gif' => 'image/gif',
[3093] Fix | Delete
'png' => 'image/png',
[3094] Fix | Delete
'bmp' => 'image/bmp',
[3095] Fix | Delete
'tiff|tif' => 'image/tiff',
[3096] Fix | Delete
'ico' => 'image/x-icon',
[3097] Fix | Delete
'heic' => 'image/heic',
[3098] Fix | Delete
// Video formats.
[3099] Fix | Delete
'asf|asx' => 'video/x-ms-asf',
[3100] Fix | Delete
'wmv' => 'video/x-ms-wmv',
[3101] Fix | Delete
'wmx' => 'video/x-ms-wmx',
[3102] Fix | Delete
'wm' => 'video/x-ms-wm',
[3103] Fix | Delete
'avi' => 'video/avi',
[3104] Fix | Delete
'divx' => 'video/divx',
[3105] Fix | Delete
'flv' => 'video/x-flv',
[3106] Fix | Delete
'mov|qt' => 'video/quicktime',
[3107] Fix | Delete
'mpeg|mpg|mpe' => 'video/mpeg',
[3108] Fix | Delete
'mp4|m4v' => 'video/mp4',
[3109] Fix | Delete
'ogv' => 'video/ogg',
[3110] Fix | Delete
'webm' => 'video/webm',
[3111] Fix | Delete
'mkv' => 'video/x-matroska',
[3112] Fix | Delete
'3gp|3gpp' => 'video/3gpp', // Can also be audio.
[3113] Fix | Delete
'3g2|3gp2' => 'video/3gpp2', // Can also be audio.
[3114] Fix | Delete
// Text formats.
[3115] Fix | Delete
'txt|asc|c|cc|h|srt' => 'text/plain',
[3116] Fix | Delete
'csv' => 'text/csv',
[3117] Fix | Delete
'tsv' => 'text/tab-separated-values',
[3118] Fix | Delete
'ics' => 'text/calendar',
[3119] Fix | Delete
'rtx' => 'text/richtext',
[3120] Fix | Delete
'css' => 'text/css',
[3121] Fix | Delete
'htm|html' => 'text/html',
[3122] Fix | Delete
'vtt' => 'text/vtt',
[3123] Fix | Delete
'dfxp' => 'application/ttaf+xml',
[3124] Fix | Delete
// Audio formats.
[3125] Fix | Delete
'mp3|m4a|m4b' => 'audio/mpeg',
[3126] Fix | Delete
'aac' => 'audio/aac',
[3127] Fix | Delete
'ra|ram' => 'audio/x-realaudio',
[3128] Fix | Delete
'wav' => 'audio/wav',
[3129] Fix | Delete
'ogg|oga' => 'audio/ogg',
[3130] Fix | Delete
'flac' => 'audio/flac',
[3131] Fix | Delete
'mid|midi' => 'audio/midi',
[3132] Fix | Delete
'wma' => 'audio/x-ms-wma',
[3133] Fix | Delete
'wax' => 'audio/x-ms-wax',
[3134] Fix | Delete
'mka' => 'audio/x-matroska',
[3135] Fix | Delete
// Misc application formats.
[3136] Fix | Delete
'rtf' => 'application/rtf',
[3137] Fix | Delete
'js' => 'application/javascript',
[3138] Fix | Delete
'pdf' => 'application/pdf',
[3139] Fix | Delete
'swf' => 'application/x-shockwave-flash',
[3140] Fix | Delete
'class' => 'application/java',
[3141] Fix | Delete
'tar' => 'application/x-tar',
[3142] Fix | Delete
'zip' => 'application/zip',
[3143] Fix | Delete
'gz|gzip' => 'application/x-gzip',
[3144] Fix | Delete
'rar' => 'application/rar',
[3145] Fix | Delete
'7z' => 'application/x-7z-compressed',
[3146] Fix | Delete
'exe' => 'application/x-msdownload',
[3147] Fix | Delete
'psd' => 'application/octet-stream',
[3148] Fix | Delete
'xcf' => 'application/octet-stream',
[3149] Fix | Delete
// MS Office formats.
[3150] Fix | Delete
'doc' => 'application/msword',
[3151] Fix | Delete
'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
[3152] Fix | Delete
'wri' => 'application/vnd.ms-write',
[3153] Fix | Delete
'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
[3154] Fix | Delete
'mdb' => 'application/vnd.ms-access',
[3155] Fix | Delete
'mpp' => 'application/vnd.ms-project',
[3156] Fix | Delete
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
[3157] Fix | Delete
'docm' => 'application/vnd.ms-word.document.macroEnabled.12',
[3158] Fix | Delete
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
[3159] Fix | Delete
'dotm' => 'application/vnd.ms-word.template.macroEnabled.12',
[3160] Fix | Delete
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
[3161] Fix | Delete
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
[3162] Fix | Delete
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
[3163] Fix | Delete
'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
[3164] Fix | Delete
'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12',
[3165] Fix | Delete
'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
[3166] Fix | Delete
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
[3167] Fix | Delete
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
[3168] Fix | Delete
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
[3169] Fix | Delete
'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
[3170] Fix | Delete
'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
[3171] Fix | Delete
'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12',
[3172] Fix | Delete
'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12',
[3173] Fix | Delete
'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
[3174] Fix | Delete
'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12',
[3175] Fix | Delete
'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
[3176] Fix | Delete
'oxps' => 'application/oxps',
[3177] Fix | Delete
'xps' => 'application/vnd.ms-xpsdocument',
[3178] Fix | Delete
// OpenOffice formats.
[3179] Fix | Delete
'odt' => 'application/vnd.oasis.opendocument.text',
[3180] Fix | Delete
'odp' => 'application/vnd.oasis.opendocument.presentation',
[3181] Fix | Delete
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
[3182] Fix | Delete
'odg' => 'application/vnd.oasis.opendocument.graphics',
[3183] Fix | Delete
'odc' => 'application/vnd.oasis.opendocument.chart',
[3184] Fix | Delete
'odb' => 'application/vnd.oasis.opendocument.database',
[3185] Fix | Delete
'odf' => 'application/vnd.oasis.opendocument.formula',
[3186] Fix | Delete
// WordPerfect formats.
[3187] Fix | Delete
'wp|wpd' => 'application/wordperfect',
[3188] Fix | Delete
// iWork formats.
[3189] Fix | Delete
'key' => 'application/vnd.apple.keynote',
[3190] Fix | Delete
'numbers' => 'application/vnd.apple.numbers',
[3191] Fix | Delete
'pages' => 'application/vnd.apple.pages',
[3192] Fix | Delete
)
[3193] Fix | Delete
);
[3194] Fix | Delete
}
[3195] Fix | Delete
[3196] Fix | Delete
/**
[3197] Fix | Delete
* Retrieves the list of common file extensions and their types.
[3198] Fix | Delete
*
[3199] Fix | Delete
* @since 4.6.0
[3200] Fix | Delete
*
[3201] Fix | Delete
* @return array[] Multi-dimensional array of file extensions types keyed by the type of file.
[3202] Fix | Delete
*/
[3203] Fix | Delete
function wp_get_ext_types() {
[3204] Fix | Delete
[3205] Fix | Delete
/**
[3206] Fix | Delete
* Filters file type based on the extension name.
[3207] Fix | Delete
*
[3208] Fix | Delete
* @since 2.5.0
[3209] Fix | Delete
*
[3210] Fix | Delete
* @see wp_ext2type()
[3211] Fix | Delete
*
[3212] Fix | Delete
* @param array[] $ext2type Multi-dimensional array of file extensions types keyed by the type of file.
[3213] Fix | Delete
*/
[3214] Fix | Delete
return apply_filters(
[3215] Fix | Delete
'ext2type',
[3216] Fix | Delete
array(
[3217] Fix | Delete
'image' => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'heic' ),
[3218] Fix | Delete
'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'flac', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
[3219] Fix | Delete
'video' => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ),
[3220] Fix | Delete
'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf' ),
[3221] Fix | Delete
'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ),
[3222] Fix | Delete
'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
[3223] Fix | Delete
'text' => array( 'asc', 'csv', 'tsv', 'txt' ),
[3224] Fix | Delete
'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ),
[3225] Fix | Delete
'code' => array( 'css', 'htm', 'html', 'php', 'js' ),
[3226] Fix | Delete
)
[3227] Fix | Delete
);
[3228] Fix | Delete
}
[3229] Fix | Delete
[3230] Fix | Delete
/**
[3231] Fix | Delete
* Retrieve list of allowed mime types and file extensions.
[3232] Fix | Delete
*
[3233] Fix | Delete
* @since 2.8.6
[3234] Fix | Delete
*
[3235] Fix | Delete
* @param int|WP_User $user Optional. User to check. Defaults to current user.
[3236] Fix | Delete
* @return string[] Array of mime types keyed by the file extension regex corresponding
[3237] Fix | Delete
* to those types.
[3238] Fix | Delete
*/
[3239] Fix | Delete
function get_allowed_mime_types( $user = null ) {
[3240] Fix | Delete
$t = wp_get_mime_types();
[3241] Fix | Delete
[3242] Fix | Delete
unset( $t['swf'], $t['exe'] );
[3243] Fix | Delete
if ( function_exists( 'current_user_can' ) ) {
[3244] Fix | Delete
$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
[3245] Fix | Delete
}
[3246] Fix | Delete
[3247] Fix | Delete
if ( empty( $unfiltered ) ) {
[3248] Fix | Delete
unset( $t['htm|html'], $t['js'] );
[3249] Fix | Delete
}
[3250] Fix | Delete
[3251] Fix | Delete
/**
[3252] Fix | Delete
* Filters list of allowed mime types and file extensions.
[3253] Fix | Delete
*
[3254] Fix | Delete
* @since 2.0.0
[3255] Fix | Delete
*
[3256] Fix | Delete
* @param array $t Mime types keyed by the file extension regex corresponding to those types.
[3257] Fix | Delete
* @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
[3258] Fix | Delete
*/
[3259] Fix | Delete
return apply_filters( 'upload_mimes', $t, $user );
[3260] Fix | Delete
}
[3261] Fix | Delete
[3262] Fix | Delete
/**
[3263] Fix | Delete
* Display "Are You Sure" message to confirm the action being taken.
[3264] Fix | Delete
*
[3265] Fix | Delete
* If the action has the nonce explain message, then it will be displayed
[3266] Fix | Delete
* along with the "Are you sure?" message.
[3267] Fix | Delete
*
[3268] Fix | Delete
* @since 2.0.4
[3269] Fix | Delete
*
[3270] Fix | Delete
* @param string $action The nonce action.
[3271] Fix | Delete
*/
[3272] Fix | Delete
function wp_nonce_ays( $action ) {
[3273] Fix | Delete
if ( 'log-out' === $action ) {
[3274] Fix | Delete
$html = sprintf(
[3275] Fix | Delete
/* translators: %s: Site title. */
[3276] Fix | Delete
__( 'You are attempting to log out of %s' ),
[3277] Fix | Delete
get_bloginfo( 'name' )
[3278] Fix | Delete
);
[3279] Fix | Delete
$html .= '</p><p>';
[3280] Fix | Delete
$redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
[3281] Fix | Delete
$html .= sprintf(
[3282] Fix | Delete
/* translators: %s: Logout URL. */
[3283] Fix | Delete
__( 'Do you really want to <a href="%s">log out</a>?' ),
[3284] Fix | Delete
wp_logout_url( $redirect_to )
[3285] Fix | Delete
);
[3286] Fix | Delete
} else {
[3287] Fix | Delete
$html = __( 'The link you followed has expired.' );
[3288] Fix | Delete
if ( wp_get_referer() ) {
[3289] Fix | Delete
$wp_http_referer = remove_query_arg( 'updated', wp_get_referer() );
[3290] Fix | Delete
$wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) );
[3291] Fix | Delete
$html .= '</p><p>';
[3292] Fix | Delete
$html .= sprintf(
[3293] Fix | Delete
'<a href="%s">%s</a>',
[3294] Fix | Delete
esc_url( $wp_http_referer ),
[3295] Fix | Delete
__( 'Please try again.' )
[3296] Fix | Delete
);
[3297] Fix | Delete
}
[3298] Fix | Delete
}
[3299] Fix | Delete
[3300] Fix | Delete
wp_die( $html, __( 'Something went wrong.' ), 403 );
[3301] Fix | Delete
}
[3302] Fix | Delete
[3303] Fix | Delete
/**
[3304] Fix | Delete
* Kills WordPress execution and displays HTML page with an error message.
[3305] Fix | Delete
*
[3306] Fix | Delete
* This function complements the `die()` PHP function. The difference is that
[3307] Fix | Delete
* HTML will be displayed to the user. It is recommended to use this function
[3308] Fix | Delete
* only when the execution should not continue any further. It is not recommended
[3309] Fix | Delete
* to call this function very often, and try to handle as many errors as possible
[3310] Fix | Delete
* silently or more gracefully.
[3311] Fix | Delete
*
[3312] Fix | Delete
* As a shorthand, the desired HTTP response code may be passed as an integer to
[3313] Fix | Delete
* the `$title` parameter (the default title would apply) or the `$args` parameter.
[3314] Fix | Delete
*
[3315] Fix | Delete
* @since 2.0.4
[3316] Fix | Delete
* @since 4.1.0 The `$title` and `$args` parameters were changed to optionally accept
[3317] Fix | Delete
* an integer to be used as the response code.
[3318] Fix | Delete
* @since 5.1.0 The `$link_url`, `$link_text`, and `$exit` arguments were added.
[3319] Fix | Delete
* @since 5.3.0 The `$charset` argument was added.
[3320] Fix | Delete
* @since 5.5.0 The `$text_direction` argument has a priority over get_language_attributes()
[3321] Fix | Delete
* in the default handler.
[3322] Fix | Delete
*
[3323] Fix | Delete
* @global WP_Query $wp_query WordPress Query object.
[3324] Fix | Delete
*
[3325] Fix | Delete
* @param string|WP_Error $message Optional. Error message. If this is a WP_Error object,
[3326] Fix | Delete
* and not an Ajax or XML-RPC request, the error's messages are used.
[3327] Fix | Delete
* Default empty.
[3328] Fix | Delete
* @param string|int $title Optional. Error title. If `$message` is a `WP_Error` object,
[3329] Fix | Delete
* error data with the key 'title' may be used to specify the title.
[3330] Fix | Delete
* If `$title` is an integer, then it is treated as the response
[3331] Fix | Delete
* code. Default empty.
[3332] Fix | Delete
* @param string|array|int $args {
[3333] Fix | Delete
* Optional. Arguments to control behavior. If `$args` is an integer, then it is treated
[3334] Fix | Delete
* as the response code. Default empty array.
[3335] Fix | Delete
*
[3336] Fix | Delete
* @type int $response The HTTP response code. Default 200 for Ajax requests, 500 otherwise.
[3337] Fix | Delete
* @type string $link_url A URL to include a link to. Only works in combination with $link_text.
[3338] Fix | Delete
* Default empty string.
[3339] Fix | Delete
* @type string $link_text A label for the link to include. Only works in combination with $link_url.
[3340] Fix | Delete
* Default empty string.
[3341] Fix | Delete
* @type bool $back_link Whether to include a link to go back. Default false.
[3342] Fix | Delete
* @type string $text_direction The text direction. This is only useful internally, when WordPress is still
[3343] Fix | Delete
* loading and the site's locale is not set up yet. Accepts 'rtl' and 'ltr'.
[3344] Fix | Delete
* Default is the value of is_rtl().
[3345] Fix | Delete
* @type string $charset Character set of the HTML output. Default 'utf-8'.
[3346] Fix | Delete
* @type string $code Error code to use. Default is 'wp_die', or the main error code if $message
[3347] Fix | Delete
* is a WP_Error.
[3348] Fix | Delete
* @type bool $exit Whether to exit the process after completion. Default true.
[3349] Fix | Delete
* }
[3350] Fix | Delete
*/
[3351] Fix | Delete
function wp_die( $message = '', $title = '', $args = array() ) {
[3352] Fix | Delete
global $wp_query;
[3353] Fix | Delete
[3354] Fix | Delete
if ( is_int( $args ) ) {
[3355] Fix | Delete
$args = array( 'response' => $args );
[3356] Fix | Delete
} elseif ( is_int( $title ) ) {
[3357] Fix | Delete
$args = array( 'response' => $title );
[3358] Fix | Delete
$title = '';
[3359] Fix | Delete
}
[3360] Fix | Delete
[3361] Fix | Delete
if ( wp_doing_ajax() ) {
[3362] Fix | Delete
/**
[3363] Fix | Delete
* Filters the callback for killing WordPress execution for Ajax requests.
[3364] Fix | Delete
*
[3365] Fix | Delete
* @since 3.4.0
[3366] Fix | Delete
*
[3367] Fix | Delete
* @param callable $function Callback function name.
[3368] Fix | Delete
*/
[3369] Fix | Delete
$function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
[3370] Fix | Delete
} elseif ( wp_is_json_request() ) {
[3371] Fix | Delete
/**
[3372] Fix | Delete
* Filters the callback for killing WordPress execution for JSON requests.
[3373] Fix | Delete
*
[3374] Fix | Delete
* @since 5.1.0
[3375] Fix | Delete
*
[3376] Fix | Delete
* @param callable $function Callback function name.
[3377] Fix | Delete
*/
[3378] Fix | Delete
$function = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' );
[3379] Fix | Delete
} elseif ( defined( 'REST_REQUEST' ) && REST_REQUEST && wp_is_jsonp_request() ) {
[3380] Fix | Delete
/**
[3381] Fix | Delete
* Filters the callback for killing WordPress execution for JSONP REST requests.
[3382] Fix | Delete
*
[3383] Fix | Delete
* @since 5.2.0
[3384] Fix | Delete
*
[3385] Fix | Delete
* @param callable $function Callback function name.
[3386] Fix | Delete
*/
[3387] Fix | Delete
$function = apply_filters( 'wp_die_jsonp_handler', '_jsonp_wp_die_handler' );
[3388] Fix | Delete
} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
[3389] Fix | Delete
/**
[3390] Fix | Delete
* Filters the callback for killing WordPress execution for XML-RPC requests.
[3391] Fix | Delete
*
[3392] Fix | Delete
* @since 3.4.0
[3393] Fix | Delete
*
[3394] Fix | Delete
* @param callable $function Callback function name.
[3395] Fix | Delete
*/
[3396] Fix | Delete
$function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
[3397] Fix | Delete
} elseif ( wp_is_xml_request()
[3398] Fix | Delete
|| isset( $wp_query ) &&
[3399] Fix | Delete
( function_exists( 'is_feed' ) && is_feed()
[3400] Fix | Delete
|| function_exists( 'is_comment_feed' ) && is_comment_feed()
[3401] Fix | Delete
|| function_exists( 'is_trackback' ) && is_trackback() ) ) {
[3402] Fix | Delete
/**
[3403] Fix | Delete
* Filters the callback for killing WordPress execution for XML requests.
[3404] Fix | Delete
*
[3405] Fix | Delete
* @since 5.2.0
[3406] Fix | Delete
*
[3407] Fix | Delete
* @param callable $function Callback function name.
[3408] Fix | Delete
*/
[3409] Fix | Delete
$function = apply_filters( 'wp_die_xml_handler', '_xml_wp_die_handler' );
[3410] Fix | Delete
} else {
[3411] Fix | Delete
/**
[3412] Fix | Delete
* Filters the callback for killing WordPress execution for all non-Ajax, non-JSON, non-XML requests.
[3413] Fix | Delete
*
[3414] Fix | Delete
* @since 3.0.0
[3415] Fix | Delete
*
[3416] Fix | Delete
* @param callable $function Callback function name.
[3417] Fix | Delete
*/
[3418] Fix | Delete
$function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' );
[3419] Fix | Delete
}
[3420] Fix | Delete
[3421] Fix | Delete
call_user_func( $function, $message, $title, $args );
[3422] Fix | Delete
}
[3423] Fix | Delete
[3424] Fix | Delete
/**
[3425] Fix | Delete
* Kills WordPress execution and displays HTML page with an error message.
[3426] Fix | Delete
*
[3427] Fix | Delete
* This is the default handler for wp_die(). If you want a custom one,
[3428] Fix | Delete
* you can override this using the {@see 'wp_die_handler'} filter in wp_die().
[3429] Fix | Delete
*
[3430] Fix | Delete
* @since 3.0.0
[3431] Fix | Delete
* @access private
[3432] Fix | Delete
*
[3433] Fix | Delete
* @param string|WP_Error $message Error message or WP_Error object.
[3434] Fix | Delete
* @param string $title Optional. Error title. Default empty.
[3435] Fix | Delete
* @param string|array $args Optional. Arguments to control behavior. Default empty array.
[3436] Fix | Delete
*/
[3437] Fix | Delete
function _default_wp_die_handler( $message, $title = '', $args = array() ) {
[3438] Fix | Delete
list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
[3439] Fix | Delete
[3440] Fix | Delete
if ( is_string( $message ) ) {
[3441] Fix | Delete
if ( ! empty( $parsed_args['additional_errors'] ) ) {
[3442] Fix | Delete
$message = array_merge(
[3443] Fix | Delete
array( $message ),
[3444] Fix | Delete
wp_list_pluck( $parsed_args['additional_errors'], 'message' )
[3445] Fix | Delete
);
[3446] Fix | Delete
$message = "<ul>\n\t\t<li>" . implode( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
[3447] Fix | Delete
}
[3448] Fix | Delete
[3449] Fix | Delete
$message = sprintf(
[3450] Fix | Delete
'<div class="wp-die-message">%s</div>',
[3451] Fix | Delete
$message
[3452] Fix | Delete
);
[3453] Fix | Delete
}
[3454] Fix | Delete
[3455] Fix | Delete
$have_gettext = function_exists( '__' );
[3456] Fix | Delete
[3457] Fix | Delete
if ( ! empty( $parsed_args['link_url'] ) && ! empty( $parsed_args['link_text'] ) ) {
[3458] Fix | Delete
$link_url = $parsed_args['link_url'];
[3459] Fix | Delete
if ( function_exists( 'esc_url' ) ) {
[3460] Fix | Delete
$link_url = esc_url( $link_url );
[3461] Fix | Delete
}
[3462] Fix | Delete
$link_text = $parsed_args['link_text'];
[3463] Fix | Delete
$message .= "\n<p><a href='{$link_url}'>{$link_text}</a></p>";
[3464] Fix | Delete
}
[3465] Fix | Delete
[3466] Fix | Delete
if ( isset( $parsed_args['back_link'] ) && $parsed_args['back_link'] ) {
[3467] Fix | Delete
$back_text = $have_gettext ? __( '&laquo; Back' ) : '&laquo; Back';
[3468] Fix | Delete
$message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>";
[3469] Fix | Delete
}
[3470] Fix | Delete
[3471] Fix | Delete
if ( ! did_action( 'admin_head' ) ) :
[3472] Fix | Delete
if ( ! headers_sent() ) {
[3473] Fix | Delete
header( "Content-Type: text/html; charset={$parsed_args['charset']}" );
[3474] Fix | Delete
status_header( $parsed_args['response'] );
[3475] Fix | Delete
nocache_headers();
[3476] Fix | Delete
}
[3477] Fix | Delete
[3478] Fix | Delete
$text_direction = $parsed_args['text_direction'];
[3479] Fix | Delete
$dir_attr = "dir='$text_direction'";
[3480] Fix | Delete
[3481] Fix | Delete
// If `text_direction` was not explicitly passed,
[3482] Fix | Delete
// use get_language_attributes() if available.
[3483] Fix | Delete
if ( empty( $args['text_direction'] )
[3484] Fix | Delete
&& function_exists( 'language_attributes' ) && function_exists( 'is_rtl' )
[3485] Fix | Delete
) {
[3486] Fix | Delete
$dir_attr = get_language_attributes();
[3487] Fix | Delete
}
[3488] Fix | Delete
?>
[3489] Fix | Delete
<!DOCTYPE html>
[3490] Fix | Delete
<html <?php echo $dir_attr; ?>>
[3491] Fix | Delete
<head>
[3492] Fix | Delete
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $parsed_args['charset']; ?>" />
[3493] Fix | Delete
<meta name="viewport" content="width=device-width">
[3494] Fix | Delete
<?php
[3495] Fix | Delete
if ( function_exists( 'wp_robots' ) && function_exists( 'wp_robots_no_robots' ) && function_exists( 'add_filter' ) ) {
[3496] Fix | Delete
add_filter( 'wp_robots', 'wp_robots_no_robots' );
[3497] Fix | Delete
wp_robots();
[3498] Fix | Delete
}
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function