Edit File by line
/home/barbar84/www/wp-inclu...
File: load.php
*/
[1500] Fix | Delete
function wp_doing_cron() {
[1501] Fix | Delete
/**
[1502] Fix | Delete
* Filters whether the current request is a WordPress cron request.
[1503] Fix | Delete
*
[1504] Fix | Delete
* @since 4.8.0
[1505] Fix | Delete
*
[1506] Fix | Delete
* @param bool $wp_doing_cron Whether the current request is a WordPress cron request.
[1507] Fix | Delete
*/
[1508] Fix | Delete
return apply_filters( 'wp_doing_cron', defined( 'DOING_CRON' ) && DOING_CRON );
[1509] Fix | Delete
}
[1510] Fix | Delete
[1511] Fix | Delete
/**
[1512] Fix | Delete
* Checks whether the given variable is a WordPress Error.
[1513] Fix | Delete
*
[1514] Fix | Delete
* Returns whether `$thing` is an instance of the `WP_Error` class.
[1515] Fix | Delete
*
[1516] Fix | Delete
* @since 2.1.0
[1517] Fix | Delete
*
[1518] Fix | Delete
* @param mixed $thing The variable to check.
[1519] Fix | Delete
* @return bool Whether the variable is an instance of WP_Error.
[1520] Fix | Delete
*/
[1521] Fix | Delete
function is_wp_error( $thing ) {
[1522] Fix | Delete
$is_wp_error = ( $thing instanceof WP_Error );
[1523] Fix | Delete
[1524] Fix | Delete
if ( $is_wp_error ) {
[1525] Fix | Delete
/**
[1526] Fix | Delete
* Fires when `is_wp_error()` is called and its parameter is an instance of `WP_Error`.
[1527] Fix | Delete
*
[1528] Fix | Delete
* @since 5.6.0
[1529] Fix | Delete
*
[1530] Fix | Delete
* @param WP_Error $thing The error object passed to `is_wp_error()`.
[1531] Fix | Delete
*/
[1532] Fix | Delete
do_action( 'is_wp_error_instance', $thing );
[1533] Fix | Delete
}
[1534] Fix | Delete
[1535] Fix | Delete
return $is_wp_error;
[1536] Fix | Delete
}
[1537] Fix | Delete
[1538] Fix | Delete
/**
[1539] Fix | Delete
* Determines whether file modifications are allowed.
[1540] Fix | Delete
*
[1541] Fix | Delete
* @since 4.8.0
[1542] Fix | Delete
*
[1543] Fix | Delete
* @param string $context The usage context.
[1544] Fix | Delete
* @return bool True if file modification is allowed, false otherwise.
[1545] Fix | Delete
*/
[1546] Fix | Delete
function wp_is_file_mod_allowed( $context ) {
[1547] Fix | Delete
/**
[1548] Fix | Delete
* Filters whether file modifications are allowed.
[1549] Fix | Delete
*
[1550] Fix | Delete
* @since 4.8.0
[1551] Fix | Delete
*
[1552] Fix | Delete
* @param bool $file_mod_allowed Whether file modifications are allowed.
[1553] Fix | Delete
* @param string $context The usage context.
[1554] Fix | Delete
*/
[1555] Fix | Delete
return apply_filters( 'file_mod_allowed', ! defined( 'DISALLOW_FILE_MODS' ) || ! DISALLOW_FILE_MODS, $context );
[1556] Fix | Delete
}
[1557] Fix | Delete
[1558] Fix | Delete
/**
[1559] Fix | Delete
* Start scraping edited file errors.
[1560] Fix | Delete
*
[1561] Fix | Delete
* @since 4.9.0
[1562] Fix | Delete
*/
[1563] Fix | Delete
function wp_start_scraping_edited_file_errors() {
[1564] Fix | Delete
if ( ! isset( $_REQUEST['wp_scrape_key'] ) || ! isset( $_REQUEST['wp_scrape_nonce'] ) ) {
[1565] Fix | Delete
return;
[1566] Fix | Delete
}
[1567] Fix | Delete
$key = substr( sanitize_key( wp_unslash( $_REQUEST['wp_scrape_key'] ) ), 0, 32 );
[1568] Fix | Delete
$nonce = wp_unslash( $_REQUEST['wp_scrape_nonce'] );
[1569] Fix | Delete
[1570] Fix | Delete
if ( get_transient( 'scrape_key_' . $key ) !== $nonce ) {
[1571] Fix | Delete
echo "###### wp_scraping_result_start:$key ######";
[1572] Fix | Delete
echo wp_json_encode(
[1573] Fix | Delete
array(
[1574] Fix | Delete
'code' => 'scrape_nonce_failure',
[1575] Fix | Delete
'message' => __( 'Scrape nonce check failed. Please try again.' ),
[1576] Fix | Delete
)
[1577] Fix | Delete
);
[1578] Fix | Delete
echo "###### wp_scraping_result_end:$key ######";
[1579] Fix | Delete
die();
[1580] Fix | Delete
}
[1581] Fix | Delete
if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) {
[1582] Fix | Delete
define( 'WP_SANDBOX_SCRAPING', true );
[1583] Fix | Delete
}
[1584] Fix | Delete
register_shutdown_function( 'wp_finalize_scraping_edited_file_errors', $key );
[1585] Fix | Delete
}
[1586] Fix | Delete
[1587] Fix | Delete
/**
[1588] Fix | Delete
* Finalize scraping for edited file errors.
[1589] Fix | Delete
*
[1590] Fix | Delete
* @since 4.9.0
[1591] Fix | Delete
*
[1592] Fix | Delete
* @param string $scrape_key Scrape key.
[1593] Fix | Delete
*/
[1594] Fix | Delete
function wp_finalize_scraping_edited_file_errors( $scrape_key ) {
[1595] Fix | Delete
$error = error_get_last();
[1596] Fix | Delete
echo "\n###### wp_scraping_result_start:$scrape_key ######\n";
[1597] Fix | Delete
if ( ! empty( $error ) && in_array( $error['type'], array( E_CORE_ERROR, E_COMPILE_ERROR, E_ERROR, E_PARSE, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) {
[1598] Fix | Delete
$error = str_replace( ABSPATH, '', $error );
[1599] Fix | Delete
echo wp_json_encode( $error );
[1600] Fix | Delete
} else {
[1601] Fix | Delete
echo wp_json_encode( true );
[1602] Fix | Delete
}
[1603] Fix | Delete
echo "\n###### wp_scraping_result_end:$scrape_key ######\n";
[1604] Fix | Delete
}
[1605] Fix | Delete
[1606] Fix | Delete
/**
[1607] Fix | Delete
* Checks whether current request is a JSON request, or is expecting a JSON response.
[1608] Fix | Delete
*
[1609] Fix | Delete
* @since 5.0.0
[1610] Fix | Delete
*
[1611] Fix | Delete
* @return bool True if `Accepts` or `Content-Type` headers contain `application/json`.
[1612] Fix | Delete
* False otherwise.
[1613] Fix | Delete
*/
[1614] Fix | Delete
function wp_is_json_request() {
[1615] Fix | Delete
[1616] Fix | Delete
if ( isset( $_SERVER['HTTP_ACCEPT'] ) && wp_is_json_media_type( $_SERVER['HTTP_ACCEPT'] ) ) {
[1617] Fix | Delete
return true;
[1618] Fix | Delete
}
[1619] Fix | Delete
[1620] Fix | Delete
if ( isset( $_SERVER['CONTENT_TYPE'] ) && wp_is_json_media_type( $_SERVER['CONTENT_TYPE'] ) ) {
[1621] Fix | Delete
return true;
[1622] Fix | Delete
}
[1623] Fix | Delete
[1624] Fix | Delete
return false;
[1625] Fix | Delete
[1626] Fix | Delete
}
[1627] Fix | Delete
[1628] Fix | Delete
/**
[1629] Fix | Delete
* Checks whether current request is a JSONP request, or is expecting a JSONP response.
[1630] Fix | Delete
*
[1631] Fix | Delete
* @since 5.2.0
[1632] Fix | Delete
*
[1633] Fix | Delete
* @return bool True if JSONP request, false otherwise.
[1634] Fix | Delete
*/
[1635] Fix | Delete
function wp_is_jsonp_request() {
[1636] Fix | Delete
if ( ! isset( $_GET['_jsonp'] ) ) {
[1637] Fix | Delete
return false;
[1638] Fix | Delete
}
[1639] Fix | Delete
[1640] Fix | Delete
if ( ! function_exists( 'wp_check_jsonp_callback' ) ) {
[1641] Fix | Delete
require_once ABSPATH . WPINC . '/functions.php';
[1642] Fix | Delete
}
[1643] Fix | Delete
[1644] Fix | Delete
$jsonp_callback = $_GET['_jsonp'];
[1645] Fix | Delete
if ( ! wp_check_jsonp_callback( $jsonp_callback ) ) {
[1646] Fix | Delete
return false;
[1647] Fix | Delete
}
[1648] Fix | Delete
[1649] Fix | Delete
/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
[1650] Fix | Delete
$jsonp_enabled = apply_filters( 'rest_jsonp_enabled', true );
[1651] Fix | Delete
[1652] Fix | Delete
return $jsonp_enabled;
[1653] Fix | Delete
[1654] Fix | Delete
}
[1655] Fix | Delete
[1656] Fix | Delete
/**
[1657] Fix | Delete
* Checks whether a string is a valid JSON Media Type.
[1658] Fix | Delete
*
[1659] Fix | Delete
* @since 5.6.0
[1660] Fix | Delete
*
[1661] Fix | Delete
* @param string $media_type A Media Type string to check.
[1662] Fix | Delete
* @return bool True if string is a valid JSON Media Type.
[1663] Fix | Delete
*/
[1664] Fix | Delete
function wp_is_json_media_type( $media_type ) {
[1665] Fix | Delete
static $cache = array();
[1666] Fix | Delete
[1667] Fix | Delete
if ( ! isset( $cache[ $media_type ] ) ) {
[1668] Fix | Delete
$cache[ $media_type ] = (bool) preg_match( '/(^|\s|,)application\/([\w!#\$&-\^\.\+]+\+)?json(\+oembed)?($|\s|;|,)/i', $media_type );
[1669] Fix | Delete
}
[1670] Fix | Delete
[1671] Fix | Delete
return $cache[ $media_type ];
[1672] Fix | Delete
}
[1673] Fix | Delete
[1674] Fix | Delete
/**
[1675] Fix | Delete
* Checks whether current request is an XML request, or is expecting an XML response.
[1676] Fix | Delete
*
[1677] Fix | Delete
* @since 5.2.0
[1678] Fix | Delete
*
[1679] Fix | Delete
* @return bool True if `Accepts` or `Content-Type` headers contain `text/xml`
[1680] Fix | Delete
* or one of the related MIME types. False otherwise.
[1681] Fix | Delete
*/
[1682] Fix | Delete
function wp_is_xml_request() {
[1683] Fix | Delete
$accepted = array(
[1684] Fix | Delete
'text/xml',
[1685] Fix | Delete
'application/rss+xml',
[1686] Fix | Delete
'application/atom+xml',
[1687] Fix | Delete
'application/rdf+xml',
[1688] Fix | Delete
'text/xml+oembed',
[1689] Fix | Delete
'application/xml+oembed',
[1690] Fix | Delete
);
[1691] Fix | Delete
[1692] Fix | Delete
if ( isset( $_SERVER['HTTP_ACCEPT'] ) ) {
[1693] Fix | Delete
foreach ( $accepted as $type ) {
[1694] Fix | Delete
if ( false !== strpos( $_SERVER['HTTP_ACCEPT'], $type ) ) {
[1695] Fix | Delete
return true;
[1696] Fix | Delete
}
[1697] Fix | Delete
}
[1698] Fix | Delete
}
[1699] Fix | Delete
[1700] Fix | Delete
if ( isset( $_SERVER['CONTENT_TYPE'] ) && in_array( $_SERVER['CONTENT_TYPE'], $accepted, true ) ) {
[1701] Fix | Delete
return true;
[1702] Fix | Delete
}
[1703] Fix | Delete
[1704] Fix | Delete
return false;
[1705] Fix | Delete
}
[1706] Fix | Delete
[1707] Fix | Delete
/**
[1708] Fix | Delete
* Checks if this site is protected by HTTP Basic Auth.
[1709] Fix | Delete
*
[1710] Fix | Delete
* At the moment, this merely checks for the present of Basic Auth credentials. Therefore, calling
[1711] Fix | Delete
* this function with a context different from the current context may give inaccurate results.
[1712] Fix | Delete
* In a future release, this evaluation may be made more robust.
[1713] Fix | Delete
*
[1714] Fix | Delete
* Currently, this is only used by Application Passwords to prevent a conflict since it also utilizes
[1715] Fix | Delete
* Basic Auth.
[1716] Fix | Delete
*
[1717] Fix | Delete
* @since 5.6.1
[1718] Fix | Delete
*
[1719] Fix | Delete
* @global string $pagenow The current page.
[1720] Fix | Delete
*
[1721] Fix | Delete
* @param string $context The context to check for protection. Accepts 'login', 'admin', and 'front'.
[1722] Fix | Delete
* Defaults to the current context.
[1723] Fix | Delete
* @return bool Whether the site is protected by Basic Auth.
[1724] Fix | Delete
*/
[1725] Fix | Delete
function wp_is_site_protected_by_basic_auth( $context = '' ) {
[1726] Fix | Delete
global $pagenow;
[1727] Fix | Delete
[1728] Fix | Delete
if ( ! $context ) {
[1729] Fix | Delete
if ( 'wp-login.php' === $pagenow ) {
[1730] Fix | Delete
$context = 'login';
[1731] Fix | Delete
} elseif ( is_admin() ) {
[1732] Fix | Delete
$context = 'admin';
[1733] Fix | Delete
} else {
[1734] Fix | Delete
$context = 'front';
[1735] Fix | Delete
}
[1736] Fix | Delete
}
[1737] Fix | Delete
[1738] Fix | Delete
$is_protected = ! empty( $_SERVER['PHP_AUTH_USER'] ) || ! empty( $_SERVER['PHP_AUTH_PW'] );
[1739] Fix | Delete
[1740] Fix | Delete
/**
[1741] Fix | Delete
* Filters whether a site is protected by HTTP Basic Auth.
[1742] Fix | Delete
*
[1743] Fix | Delete
* @since 5.6.1
[1744] Fix | Delete
*
[1745] Fix | Delete
* @param bool $is_protected Whether the site is protected by Basic Auth.
[1746] Fix | Delete
* @param string $context The context to check for protection. One of 'login', 'admin', or 'front'.
[1747] Fix | Delete
*/
[1748] Fix | Delete
return apply_filters( 'wp_is_site_protected_by_basic_auth', $is_protected, $context );
[1749] Fix | Delete
}
[1750] Fix | Delete
[1751] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function