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/clone/wp-inclu...
File: rewrite.php
*/
[500] Fix | Delete
$url = apply_filters( 'url_to_postid', $url );
[501] Fix | Delete
[502] Fix | Delete
$url_host = parse_url( $url, PHP_URL_HOST );
[503] Fix | Delete
[504] Fix | Delete
if ( is_string( $url_host ) ) {
[505] Fix | Delete
$url_host = str_replace( 'www.', '', $url_host );
[506] Fix | Delete
} else {
[507] Fix | Delete
$url_host = '';
[508] Fix | Delete
}
[509] Fix | Delete
[510] Fix | Delete
$home_url_host = parse_url( home_url(), PHP_URL_HOST );
[511] Fix | Delete
[512] Fix | Delete
if ( is_string( $home_url_host ) ) {
[513] Fix | Delete
$home_url_host = str_replace( 'www.', '', $home_url_host );
[514] Fix | Delete
} else {
[515] Fix | Delete
$home_url_host = '';
[516] Fix | Delete
}
[517] Fix | Delete
[518] Fix | Delete
// Bail early if the URL does not belong to this site.
[519] Fix | Delete
if ( $url_host && $url_host !== $home_url_host ) {
[520] Fix | Delete
return 0;
[521] Fix | Delete
}
[522] Fix | Delete
[523] Fix | Delete
// First, check to see if there is a 'p=N' or 'page_id=N' to match against.
[524] Fix | Delete
if ( preg_match( '#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values ) ) {
[525] Fix | Delete
$id = absint( $values[2] );
[526] Fix | Delete
if ( $id ) {
[527] Fix | Delete
return $id;
[528] Fix | Delete
}
[529] Fix | Delete
}
[530] Fix | Delete
[531] Fix | Delete
// Get rid of the #anchor.
[532] Fix | Delete
$url_split = explode( '#', $url );
[533] Fix | Delete
$url = $url_split[0];
[534] Fix | Delete
[535] Fix | Delete
// Get rid of URL ?query=string.
[536] Fix | Delete
$url_split = explode( '?', $url );
[537] Fix | Delete
$url = $url_split[0];
[538] Fix | Delete
[539] Fix | Delete
// Set the correct URL scheme.
[540] Fix | Delete
$scheme = parse_url( home_url(), PHP_URL_SCHEME );
[541] Fix | Delete
$url = set_url_scheme( $url, $scheme );
[542] Fix | Delete
[543] Fix | Delete
// Add 'www.' if it is absent and should be there.
[544] Fix | Delete
if ( str_contains( home_url(), '://www.' ) && ! str_contains( $url, '://www.' ) ) {
[545] Fix | Delete
$url = str_replace( '://', '://www.', $url );
[546] Fix | Delete
}
[547] Fix | Delete
[548] Fix | Delete
// Strip 'www.' if it is present and shouldn't be.
[549] Fix | Delete
if ( ! str_contains( home_url(), '://www.' ) ) {
[550] Fix | Delete
$url = str_replace( '://www.', '://', $url );
[551] Fix | Delete
}
[552] Fix | Delete
[553] Fix | Delete
if ( trim( $url, '/' ) === home_url() && 'page' === get_option( 'show_on_front' ) ) {
[554] Fix | Delete
$page_on_front = get_option( 'page_on_front' );
[555] Fix | Delete
[556] Fix | Delete
if ( $page_on_front && get_post( $page_on_front ) instanceof WP_Post ) {
[557] Fix | Delete
return (int) $page_on_front;
[558] Fix | Delete
}
[559] Fix | Delete
}
[560] Fix | Delete
[561] Fix | Delete
// Check to see if we are using rewrite rules.
[562] Fix | Delete
$rewrite = $wp_rewrite->wp_rewrite_rules();
[563] Fix | Delete
[564] Fix | Delete
// Not using rewrite rules, and 'p=N' and 'page_id=N' methods failed, so we're out of options.
[565] Fix | Delete
if ( empty( $rewrite ) ) {
[566] Fix | Delete
return 0;
[567] Fix | Delete
}
[568] Fix | Delete
[569] Fix | Delete
// Strip 'index.php/' if we're not using path info permalinks.
[570] Fix | Delete
if ( ! $wp_rewrite->using_index_permalinks() ) {
[571] Fix | Delete
$url = str_replace( $wp_rewrite->index . '/', '', $url );
[572] Fix | Delete
}
[573] Fix | Delete
[574] Fix | Delete
if ( str_contains( trailingslashit( $url ), home_url( '/' ) ) ) {
[575] Fix | Delete
// Chop off http://domain.com/[path].
[576] Fix | Delete
$url = str_replace( home_url(), '', $url );
[577] Fix | Delete
} else {
[578] Fix | Delete
// Chop off /path/to/blog.
[579] Fix | Delete
$home_path = parse_url( home_url( '/' ) );
[580] Fix | Delete
$home_path = isset( $home_path['path'] ) ? $home_path['path'] : '';
[581] Fix | Delete
$url = preg_replace( sprintf( '#^%s#', preg_quote( $home_path ) ), '', trailingslashit( $url ) );
[582] Fix | Delete
}
[583] Fix | Delete
[584] Fix | Delete
// Trim leading and lagging slashes.
[585] Fix | Delete
$url = trim( $url, '/' );
[586] Fix | Delete
[587] Fix | Delete
$request = $url;
[588] Fix | Delete
$post_type_query_vars = array();
[589] Fix | Delete
[590] Fix | Delete
foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) {
[591] Fix | Delete
if ( ! empty( $t->query_var ) ) {
[592] Fix | Delete
$post_type_query_vars[ $t->query_var ] = $post_type;
[593] Fix | Delete
}
[594] Fix | Delete
}
[595] Fix | Delete
[596] Fix | Delete
// Look for matches.
[597] Fix | Delete
$request_match = $request;
[598] Fix | Delete
foreach ( (array) $rewrite as $match => $query ) {
[599] Fix | Delete
[600] Fix | Delete
/*
[601] Fix | Delete
* If the requesting file is the anchor of the match,
[602] Fix | Delete
* prepend it to the path info.
[603] Fix | Delete
*/
[604] Fix | Delete
if ( ! empty( $url ) && ( $url !== $request ) && str_starts_with( $match, $url ) ) {
[605] Fix | Delete
$request_match = $url . '/' . $request;
[606] Fix | Delete
}
[607] Fix | Delete
[608] Fix | Delete
if ( preg_match( "#^$match#", $request_match, $matches ) ) {
[609] Fix | Delete
[610] Fix | Delete
if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
[611] Fix | Delete
// This is a verbose page match, let's check to be sure about it.
[612] Fix | Delete
$page = get_page_by_path( $matches[ $varmatch[1] ] );
[613] Fix | Delete
if ( ! $page ) {
[614] Fix | Delete
continue;
[615] Fix | Delete
}
[616] Fix | Delete
[617] Fix | Delete
$post_status_obj = get_post_status_object( $page->post_status );
[618] Fix | Delete
if ( ! $post_status_obj->public && ! $post_status_obj->protected
[619] Fix | Delete
&& ! $post_status_obj->private && $post_status_obj->exclude_from_search ) {
[620] Fix | Delete
continue;
[621] Fix | Delete
}
[622] Fix | Delete
}
[623] Fix | Delete
[624] Fix | Delete
/*
[625] Fix | Delete
* Got a match.
[626] Fix | Delete
* Trim the query of everything up to the '?'.
[627] Fix | Delete
*/
[628] Fix | Delete
$query = preg_replace( '!^.+\?!', '', $query );
[629] Fix | Delete
[630] Fix | Delete
// Substitute the substring matches into the query.
[631] Fix | Delete
$query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) );
[632] Fix | Delete
[633] Fix | Delete
// Filter out non-public query vars.
[634] Fix | Delete
global $wp;
[635] Fix | Delete
parse_str( $query, $query_vars );
[636] Fix | Delete
$query = array();
[637] Fix | Delete
foreach ( (array) $query_vars as $key => $value ) {
[638] Fix | Delete
if ( in_array( (string) $key, $wp->public_query_vars, true ) ) {
[639] Fix | Delete
$query[ $key ] = $value;
[640] Fix | Delete
if ( isset( $post_type_query_vars[ $key ] ) ) {
[641] Fix | Delete
$query['post_type'] = $post_type_query_vars[ $key ];
[642] Fix | Delete
$query['name'] = $value;
[643] Fix | Delete
}
[644] Fix | Delete
}
[645] Fix | Delete
}
[646] Fix | Delete
[647] Fix | Delete
// Resolve conflicts between posts with numeric slugs and date archive queries.
[648] Fix | Delete
$query = wp_resolve_numeric_slug_conflicts( $query );
[649] Fix | Delete
[650] Fix | Delete
// Do the query.
[651] Fix | Delete
$query = new WP_Query( $query );
[652] Fix | Delete
if ( ! empty( $query->posts ) && $query->is_singular ) {
[653] Fix | Delete
return $query->post->ID;
[654] Fix | Delete
} else {
[655] Fix | Delete
return 0;
[656] Fix | Delete
}
[657] Fix | Delete
}
[658] Fix | Delete
}
[659] Fix | Delete
return 0;
[660] Fix | Delete
}
[661] Fix | Delete
[662] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function