Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-inclu...
File: class-wp-http.php
[1000] Fix | Delete
// Build the new path.
[1001] Fix | Delete
$path .= $relative_url_parts['path'];
[1002] Fix | Delete
[1003] Fix | Delete
// Strip all /path/../ out of the path.
[1004] Fix | Delete
while ( strpos( $path, '../' ) > 1 ) {
[1005] Fix | Delete
$path = preg_replace( '![^/]+/\.\./!', '', $path );
[1006] Fix | Delete
}
[1007] Fix | Delete
[1008] Fix | Delete
// Strip any final leading ../ from the path.
[1009] Fix | Delete
$path = preg_replace( '!^/(\.\./)+!', '', $path );
[1010] Fix | Delete
}
[1011] Fix | Delete
[1012] Fix | Delete
// Add the query string.
[1013] Fix | Delete
if ( ! empty( $relative_url_parts['query'] ) ) {
[1014] Fix | Delete
$path .= '?' . $relative_url_parts['query'];
[1015] Fix | Delete
}
[1016] Fix | Delete
[1017] Fix | Delete
// Add the fragment.
[1018] Fix | Delete
if ( ! empty( $relative_url_parts['fragment'] ) ) {
[1019] Fix | Delete
$path .= '#' . $relative_url_parts['fragment'];
[1020] Fix | Delete
}
[1021] Fix | Delete
[1022] Fix | Delete
return $absolute_path . '/' . ltrim( $path, '/' );
[1023] Fix | Delete
}
[1024] Fix | Delete
[1025] Fix | Delete
/**
[1026] Fix | Delete
* Handles an HTTP redirect and follows it if appropriate.
[1027] Fix | Delete
*
[1028] Fix | Delete
* @since 3.7.0
[1029] Fix | Delete
*
[1030] Fix | Delete
* @param string $url The URL which was requested.
[1031] Fix | Delete
* @param array $args The arguments which were used to make the request.
[1032] Fix | Delete
* @param array $response The response of the HTTP request.
[1033] Fix | Delete
* @return array|false|WP_Error An HTTP API response array if the redirect is successfully followed,
[1034] Fix | Delete
* false if no redirect is present, or a WP_Error object if there's an error.
[1035] Fix | Delete
*/
[1036] Fix | Delete
public static function handle_redirects( $url, $args, $response ) {
[1037] Fix | Delete
// If no redirects are present, or, redirects were not requested, perform no action.
[1038] Fix | Delete
if ( ! isset( $response['headers']['location'] ) || 0 === $args['_redirection'] ) {
[1039] Fix | Delete
return false;
[1040] Fix | Delete
}
[1041] Fix | Delete
[1042] Fix | Delete
// Only perform redirections on redirection http codes.
[1043] Fix | Delete
if ( $response['response']['code'] > 399 || $response['response']['code'] < 300 ) {
[1044] Fix | Delete
return false;
[1045] Fix | Delete
}
[1046] Fix | Delete
[1047] Fix | Delete
// Don't redirect if we've run out of redirects.
[1048] Fix | Delete
if ( $args['redirection']-- <= 0 ) {
[1049] Fix | Delete
return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
[1050] Fix | Delete
}
[1051] Fix | Delete
[1052] Fix | Delete
$redirect_location = $response['headers']['location'];
[1053] Fix | Delete
[1054] Fix | Delete
// If there were multiple Location headers, use the last header specified.
[1055] Fix | Delete
if ( is_array( $redirect_location ) ) {
[1056] Fix | Delete
$redirect_location = array_pop( $redirect_location );
[1057] Fix | Delete
}
[1058] Fix | Delete
[1059] Fix | Delete
$redirect_location = WP_Http::make_absolute_url( $redirect_location, $url );
[1060] Fix | Delete
[1061] Fix | Delete
// POST requests should not POST to a redirected location.
[1062] Fix | Delete
if ( 'POST' === $args['method'] ) {
[1063] Fix | Delete
if ( in_array( $response['response']['code'], array( 302, 303 ), true ) ) {
[1064] Fix | Delete
$args['method'] = 'GET';
[1065] Fix | Delete
}
[1066] Fix | Delete
}
[1067] Fix | Delete
[1068] Fix | Delete
// Include valid cookies in the redirect process.
[1069] Fix | Delete
if ( ! empty( $response['cookies'] ) ) {
[1070] Fix | Delete
foreach ( $response['cookies'] as $cookie ) {
[1071] Fix | Delete
if ( $cookie->test( $redirect_location ) ) {
[1072] Fix | Delete
$args['cookies'][] = $cookie;
[1073] Fix | Delete
}
[1074] Fix | Delete
}
[1075] Fix | Delete
}
[1076] Fix | Delete
[1077] Fix | Delete
return wp_remote_request( $redirect_location, $args );
[1078] Fix | Delete
}
[1079] Fix | Delete
[1080] Fix | Delete
/**
[1081] Fix | Delete
* Determines if a specified string represents an IP address or not.
[1082] Fix | Delete
*
[1083] Fix | Delete
* This function also detects the type of the IP address, returning either
[1084] Fix | Delete
* '4' or '6' to represent an IPv4 and IPv6 address respectively.
[1085] Fix | Delete
* This does not verify if the IP is a valid IP, only that it appears to be
[1086] Fix | Delete
* an IP address.
[1087] Fix | Delete
*
[1088] Fix | Delete
* @link http://home.deds.nl/~aeron/regex/ for IPv6 regex.
[1089] Fix | Delete
*
[1090] Fix | Delete
* @since 3.7.0
[1091] Fix | Delete
*
[1092] Fix | Delete
* @param string $maybe_ip A suspected IP address.
[1093] Fix | Delete
* @return int|false Upon success, '4' or '6' to represent an IPv4 or IPv6 address, false upon failure.
[1094] Fix | Delete
*/
[1095] Fix | Delete
public static function is_ip_address( $maybe_ip ) {
[1096] Fix | Delete
if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $maybe_ip ) ) {
[1097] Fix | Delete
return 4;
[1098] Fix | Delete
}
[1099] Fix | Delete
[1100] Fix | Delete
if ( str_contains( $maybe_ip, ':' ) && preg_match( '/^(((?=.*(::))(?!.*\3.+\3))\3?|([\dA-F]{1,4}(\3|:\b|$)|\2))(?4){5}((?4){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i', trim( $maybe_ip, ' []' ) ) ) {
[1101] Fix | Delete
return 6;
[1102] Fix | Delete
}
[1103] Fix | Delete
[1104] Fix | Delete
return false;
[1105] Fix | Delete
}
[1106] Fix | Delete
}
[1107] Fix | Delete
[1108] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function