AZILS commited on
Commit
4d28998
·
verified ·
1 Parent(s): ef62867

Upload 16 files

Browse files
Files changed (16) hide show
  1. README.md +5 -7
  2. readme.html +97 -0
  3. start.sh +6 -0
  4. wp-activate.php +218 -0
  5. wp-blog-header.php +21 -0
  6. wp-comments-post.php +81 -0
  7. wp-config.php +96 -0
  8. wp-cron.php +205 -0
  9. wp-links-opml.php +98 -0
  10. wp-load.php +105 -0
  11. wp-login.php +1644 -0
  12. wp-mail.php +268 -0
  13. wp-settings.php +722 -0
  14. wp-signup.php +1046 -0
  15. wp-trackback.php +171 -0
  16. xmlrpc.php +108 -0
README.md CHANGED
@@ -1,10 +1,8 @@
1
  ---
2
- title: Word
3
- emoji: 🏢
4
- colorFrom: blue
5
- colorTo: indigo
6
  sdk: docker
7
  pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: WordPress Testing
3
+ emoji: 🌐
4
+ colorFrom: purple
5
+ colorTo: blue
6
  sdk: docker
7
  pinned: false
8
+ ---
 
 
readme.html ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta name="viewport" content="width=device-width" />
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>WordPress &#8250; ReadMe</title>
7
+ <link rel="stylesheet" href="wp-admin/css/install.css?ver=20100228" type="text/css" />
8
+ </head>
9
+ <body>
10
+ <h1 id="logo">
11
+ <a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
12
+ </h1>
13
+ <p style="text-align: center">Semantic Personal Publishing Platform</p>
14
+
15
+ <h2>First Things First</h2>
16
+ <p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I am proud to be a part of. Thousands of hours have gone into WordPress, and we are dedicated to making it better every day. Thank you for making it part of your world.</p>
17
+ <p style="text-align: right">&#8212; Matt Mullenweg</p>
18
+
19
+ <h2>Installation: Famous 5-minute install</h2>
20
+ <ol>
21
+ <li>Unzip the package in an empty directory and upload everything.</li>
22
+ <li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser. It will take you through the process to set up a <code>wp-config.php</code> file with your database connection details.
23
+ <ol>
24
+ <li>If for some reason this does not work, do not worry. It may not work on all web hosts. Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
25
+ <li>Save the file as <code>wp-config.php</code> and upload it.</li>
26
+ <li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser.</li>
27
+ </ol>
28
+ </li>
29
+ <li>Once the configuration file is set up, the installer will set up the tables needed for your site. If there is an error, double check your <code>wp-config.php</code> file, and try again. If it fails again, please go to the <a href="https://wordpress.org/support/forums/">WordPress support forums</a> with as much data as you can gather.</li>
30
+ <li><strong>If you did not enter a password, note the password given to you.</strong> If you did not provide a username, it will be <code>admin</code>.</li>
31
+ <li>The installer should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username and password you chose during the installation. If a password was generated for you, you can then click on &#8220;Profile&#8221; to change the password.</li>
32
+ </ol>
33
+
34
+ <h2>Updating</h2>
35
+ <h3>Using the Automatic Updater</h3>
36
+ <ol>
37
+ <li>Open <span class="file"><a href="wp-admin/update-core.php">wp-admin/update-core.php</a></span> in your browser and follow the instructions.</li>
38
+ <li>You wanted more, perhaps? That&#8217;s it!</li>
39
+ </ol>
40
+
41
+ <h3>Updating Manually</h3>
42
+ <ol>
43
+ <li>Before you update anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</li>
44
+ <li>Delete your old WordPress files, saving ones you&#8217;ve modified.</li>
45
+ <li>Upload the new files.</li>
46
+ <li>Point your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a>.</span></li>
47
+ </ol>
48
+
49
+ <h2>Migrating from other systems</h2>
50
+ <p>WordPress can <a href="https://developer.wordpress.org/advanced-administration/wordpress/import/">import from a number of systems</a>. First you need to get WordPress installed and working as described above, before using <a href="wp-admin/import.php">our import tools</a>.</p>
51
+
52
+ <h2>System Requirements</h2>
53
+ <ul>
54
+ <li><a href="https://www.php.net/">PHP</a> version <strong>7.2.24</strong> or greater.</li>
55
+ <li><a href="https://www.mysql.com/">MySQL</a> version <strong>5.5.5</strong> or greater.</li>
56
+ </ul>
57
+
58
+ <h3>Recommendations</h3>
59
+ <ul>
60
+ <li><a href="https://www.php.net/">PHP</a> version <strong>7.4</strong> or greater.</li>
61
+ <li><a href="https://www.mysql.com/">MySQL</a> version <strong>8.0</strong> or greater OR <a href="https://mariadb.org/">MariaDB</a> version <strong>10.5</strong> or greater.</li>
62
+ <li>The <a href="https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite</a> Apache module.</li>
63
+ <li><a href="https://wordpress.org/news/2016/12/moving-toward-ssl/">HTTPS</a> support.</li>
64
+ <li>A link to <a href="https://wordpress.org/">wordpress.org</a> on your site.</li>
65
+ </ul>
66
+
67
+ <h2>Online Resources</h2>
68
+ <p>If you have any questions that are not addressed in this document, please take advantage of WordPress&#8217; numerous online resources:</p>
69
+ <dl>
70
+ <dt><a href="https://wordpress.org/documentation/">HelpHub</a></dt>
71
+ <dd>HelpHub is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.</dd>
72
+ <dt><a href="https://wordpress.org/news/">The WordPress Blog</a></dt>
73
+ <dd>This is where you&#8217;ll find the latest updates and news related to WordPress. Recent WordPress news appears in your administrative dashboard by default.</dd>
74
+ <dt><a href="https://planet.wordpress.org/">WordPress Planet</a></dt>
75
+ <dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.</dd>
76
+ <dt><a href="https://wordpress.org/support/forums/">WordPress Support Forums</a></dt>
77
+ <dd>If you&#8217;ve looked everywhere and still cannot find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
78
+ <dt><a href="https://make.wordpress.org/support/handbook/appendix/other-support-locations/introduction-to-irc/">WordPress <abbr>IRC</abbr> (Internet Relay Chat) Channel</a></dt>
79
+ <dd>There is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="https://web.libera.chat/#wordpress">irc.libera.chat #wordpress</a>)</dd>
80
+ </dl>
81
+
82
+ <h2>Final Notes</h2>
83
+ <ul>
84
+ <li>If you have any suggestions, ideas, or comments, or if you (gasp!) found a bug, join us in the <a href="https://wordpress.org/support/forums/">Support Forums</a>.</li>
85
+ <li>WordPress has a robust plugin <abbr>API</abbr> (Application Programming Interface) that makes extending the code easy. If you are a developer interested in utilizing this, see the <a href="https://developer.wordpress.org/plugins/">Plugin Developer Handbook</a>. You shouldn&#8217;t modify any of the core code.</li>
86
+ </ul>
87
+
88
+ <h2>Share the Love</h2>
89
+ <p>WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better&#8212;you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgeable than yourself, or writing the author of a media article that overlooks us.</p>
90
+
91
+ <p>WordPress is the official continuation of <a href="https://cafelog.com/">b2/caf&#233;log</a>, which came from Michel V. The work has been continued by the <a href="https://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="https://wordpress.org/donate/">donating</a>.</p>
92
+
93
+ <h2>License</h2>
94
+ <p>WordPress is free software, and is released under the terms of the <abbr>GPL</abbr> (GNU General Public License) version 2 or (at your option) any later version. See <a href="license.txt">license.txt</a>.</p>
95
+
96
+ </body>
97
+ </html>
start.sh ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ php-fpm &
4
+
5
+ exec nginx -g 'daemon off;'
6
+
wp-activate.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Confirms that the activation key that is sent in an email after a user signs
4
+ * up for a new site matches the key for that user and then displays confirmation.
5
+ *
6
+ * @package WordPress
7
+ */
8
+
9
+ define( 'WP_INSTALLING', true );
10
+
11
+ /** Sets up the WordPress Environment. */
12
+ require __DIR__ . '/wp-load.php';
13
+
14
+ require __DIR__ . '/wp-blog-header.php';
15
+
16
+ if ( ! is_multisite() ) {
17
+ wp_redirect( wp_registration_url() );
18
+ die();
19
+ }
20
+
21
+ $valid_error_codes = array( 'already_active', 'blog_taken' );
22
+
23
+ list( $activate_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
24
+ $activate_cookie = 'wp-activate-' . COOKIEHASH;
25
+
26
+ $key = '';
27
+ $result = null;
28
+
29
+ if ( isset( $_GET['key'] ) && isset( $_POST['key'] ) && $_GET['key'] !== $_POST['key'] ) {
30
+ wp_die( __( 'A key value mismatch has been detected. Please follow the link provided in your activation email.' ), __( 'An error occurred during the activation' ), 400 );
31
+ } elseif ( ! empty( $_GET['key'] ) ) {
32
+ $key = $_GET['key'];
33
+ } elseif ( ! empty( $_POST['key'] ) ) {
34
+ $key = $_POST['key'];
35
+ }
36
+
37
+ if ( $key ) {
38
+ $redirect_url = remove_query_arg( 'key' );
39
+
40
+ if ( remove_query_arg( false ) !== $redirect_url ) {
41
+ setcookie( $activate_cookie, $key, 0, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
42
+ wp_safe_redirect( $redirect_url );
43
+ exit;
44
+ } else {
45
+ $result = wpmu_activate_signup( $key );
46
+ }
47
+ }
48
+
49
+ if ( null === $result && isset( $_COOKIE[ $activate_cookie ] ) ) {
50
+ $key = $_COOKIE[ $activate_cookie ];
51
+ $result = wpmu_activate_signup( $key );
52
+ setcookie( $activate_cookie, ' ', time() - YEAR_IN_SECONDS, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
53
+ }
54
+
55
+ if ( null === $result || ( is_wp_error( $result ) && 'invalid_key' === $result->get_error_code() ) ) {
56
+ status_header( 404 );
57
+ } elseif ( is_wp_error( $result ) ) {
58
+ $error_code = $result->get_error_code();
59
+
60
+ if ( ! in_array( $error_code, $valid_error_codes, true ) ) {
61
+ status_header( 400 );
62
+ }
63
+ }
64
+
65
+ nocache_headers();
66
+
67
+ if ( is_object( $wp_object_cache ) ) {
68
+ $wp_object_cache->cache_enabled = false;
69
+ }
70
+
71
+ // Fix for page title.
72
+ $wp_query->is_404 = false;
73
+
74
+ /**
75
+ * Fires before the Site Activation page is loaded.
76
+ *
77
+ * @since 3.0.0
78
+ */
79
+ do_action( 'activate_header' );
80
+
81
+ /**
82
+ * Adds an action hook specific to this page.
83
+ *
84
+ * Fires on {@see 'wp_head'}.
85
+ *
86
+ * @since MU (3.0.0)
87
+ */
88
+ function do_activate_header() {
89
+ /**
90
+ * Fires within the `<head>` section of the Site Activation page.
91
+ *
92
+ * Fires on the {@see 'wp_head'} action.
93
+ *
94
+ * @since 3.0.0
95
+ */
96
+ do_action( 'activate_wp_head' );
97
+ }
98
+ add_action( 'wp_head', 'do_activate_header' );
99
+
100
+ /**
101
+ * Loads styles specific to this page.
102
+ *
103
+ * @since MU (3.0.0)
104
+ */
105
+ function wpmu_activate_stylesheet() {
106
+ ?>
107
+ <style type="text/css">
108
+ .wp-activate-container { width: 90%; margin: 0 auto; }
109
+ .wp-activate-container form { margin-top: 2em; }
110
+ #submit, #key { width: 100%; font-size: 24px; box-sizing: border-box; }
111
+ #language { margin-top: 0.5em; }
112
+ .wp-activate-container .error { background: #f66; color: #333; }
113
+ span.h3 { padding: 0 8px; font-size: 1.3em; font-weight: 600; }
114
+ </style>
115
+ <?php
116
+ }
117
+ add_action( 'wp_head', 'wpmu_activate_stylesheet' );
118
+ add_action( 'wp_head', 'wp_strict_cross_origin_referrer' );
119
+ add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
120
+
121
+ get_header( 'wp-activate' );
122
+
123
+ $blog_details = get_site();
124
+ ?>
125
+
126
+ <div id="signup-content" class="widecolumn">
127
+ <div class="wp-activate-container">
128
+ <?php if ( ! $key ) { ?>
129
+
130
+ <h2><?php _e( 'Activation Key Required' ); ?></h2>
131
+ <form name="activateform" id="activateform" method="post" action="<?php echo esc_url( network_site_url( $blog_details->path . 'wp-activate.php' ) ); ?>">
132
+ <p>
133
+ <label for="key"><?php _e( 'Activation Key:' ); ?></label>
134
+ <br /><input type="text" name="key" id="key" value="" size="50" autofocus="autofocus" />
135
+ </p>
136
+ <p class="submit">
137
+ <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e( 'Activate' ); ?>" />
138
+ </p>
139
+ </form>
140
+
141
+ <?php
142
+ } else {
143
+ if ( is_wp_error( $result ) && in_array( $result->get_error_code(), $valid_error_codes, true ) ) {
144
+ $signup = $result->get_error_data();
145
+ ?>
146
+ <h2><?php _e( 'Your account is now active!' ); ?></h2>
147
+ <?php
148
+ echo '<p class="lead-in">';
149
+ if ( '' === $signup->domain . $signup->path ) {
150
+ printf(
151
+ /* translators: 1: Login URL, 2: Username, 3: User email address, 4: Lost password URL. */
152
+ __( 'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ),
153
+ esc_url( network_site_url( $blog_details->path . 'wp-login.php', 'login' ) ),
154
+ esc_html( $signup->user_login ),
155
+ esc_html( $signup->user_email ),
156
+ esc_url( wp_lostpassword_url() )
157
+ );
158
+ } else {
159
+ printf(
160
+ /* translators: 1: Site URL, 2: Username, 3: User email address, 4: Lost password URL. */
161
+ __( 'Your site at %1$s is active. You may now log in to your site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ),
162
+ sprintf( '<a href="http://%1$s">%1$s</a>', esc_url( $signup->domain . $blog_details->path ) ),
163
+ esc_html( $signup->user_login ),
164
+ esc_html( $signup->user_email ),
165
+ esc_url( wp_lostpassword_url() )
166
+ );
167
+ }
168
+ echo '</p>';
169
+ } elseif ( null === $result || is_wp_error( $result ) ) {
170
+ ?>
171
+ <h2><?php _e( 'An error occurred during the activation' ); ?></h2>
172
+ <?php if ( is_wp_error( $result ) ) : ?>
173
+ <p><?php echo esc_html( $result->get_error_message() ); ?></p>
174
+ <?php endif; ?>
175
+ <?php
176
+ } else {
177
+ $url = isset( $result['blog_id'] ) ? esc_url( get_home_url( (int) $result['blog_id'] ) ) : '';
178
+ $user = get_userdata( (int) $result['user_id'] );
179
+ ?>
180
+ <h2><?php _e( 'Your account is now active!' ); ?></h2>
181
+
182
+ <div id="signup-welcome">
183
+ <p><span class="h3"><?php _e( 'Username:' ); ?></span> <?php echo esc_html( $user->user_login ); ?></p>
184
+ <p><span class="h3"><?php _e( 'Password:' ); ?></span> <?php echo esc_html( $result['password'] ); ?></p>
185
+ </div>
186
+
187
+ <?php
188
+ if ( $url && network_home_url( '', 'http' ) !== $url ) :
189
+ switch_to_blog( (int) $result['blog_id'] );
190
+ $login_url = wp_login_url();
191
+ restore_current_blog();
192
+ ?>
193
+ <p class="view">
194
+ <?php
195
+ /* translators: 1: Site URL, 2: Login URL. */
196
+ printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' ), esc_url( $url ), esc_url( $login_url ) );
197
+ ?>
198
+ </p>
199
+ <?php else : ?>
200
+ <p class="view">
201
+ <?php
202
+ printf(
203
+ /* translators: 1: Login URL, 2: Network home URL. */
204
+ __( 'Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ),
205
+ esc_url( network_site_url( $blog_details->path . 'wp-login.php', 'login' ) ),
206
+ esc_url( network_home_url( $blog_details->path ) )
207
+ );
208
+ ?>
209
+ </p>
210
+ <?php
211
+ endif;
212
+ }
213
+ }
214
+ ?>
215
+ </div>
216
+ </div>
217
+ <?php
218
+ get_footer( 'wp-activate' );
wp-blog-header.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loads the WordPress environment and template.
4
+ *
5
+ * @package WordPress
6
+ */
7
+
8
+ if ( ! isset( $wp_did_header ) ) {
9
+
10
+ $wp_did_header = true;
11
+
12
+ // Load the WordPress library.
13
+ require_once __DIR__ . '/wp-load.php';
14
+
15
+ // Set up the WordPress query.
16
+ wp();
17
+
18
+ // Load the theme template.
19
+ require_once ABSPATH . WPINC . '/template-loader.php';
20
+
21
+ }
wp-comments-post.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handles Comment Post to WordPress and prevents duplicate comment posting.
4
+ *
5
+ * @package WordPress
6
+ */
7
+
8
+ if ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
9
+ $protocol = $_SERVER['SERVER_PROTOCOL'];
10
+ if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
11
+ $protocol = 'HTTP/1.0';
12
+ }
13
+
14
+ header( 'Allow: POST' );
15
+ header( "$protocol 405 Method Not Allowed" );
16
+ header( 'Content-Type: text/plain' );
17
+ exit;
18
+ }
19
+
20
+ /** Sets up the WordPress Environment. */
21
+ require __DIR__ . '/wp-load.php';
22
+
23
+ nocache_headers();
24
+
25
+ $comment = wp_handle_comment_submission( wp_unslash( $_POST ) );
26
+ if ( is_wp_error( $comment ) ) {
27
+ $data = (int) $comment->get_error_data();
28
+ if ( ! empty( $data ) ) {
29
+ wp_die(
30
+ '<p>' . $comment->get_error_message() . '</p>',
31
+ __( 'Comment Submission Failure' ),
32
+ array(
33
+ 'response' => $data,
34
+ 'back_link' => true,
35
+ )
36
+ );
37
+ } else {
38
+ exit;
39
+ }
40
+ }
41
+
42
+ $user = wp_get_current_user();
43
+ $cookies_consent = ( isset( $_POST['wp-comment-cookies-consent'] ) );
44
+
45
+ /**
46
+ * Fires after comment cookies are set.
47
+ *
48
+ * @since 3.4.0
49
+ * @since 4.9.6 The `$cookies_consent` parameter was added.
50
+ *
51
+ * @param WP_Comment $comment Comment object.
52
+ * @param WP_User $user Comment author's user object. The user may not exist.
53
+ * @param bool $cookies_consent Comment author's consent to store cookies.
54
+ */
55
+ do_action( 'set_comment_cookies', $comment, $user, $cookies_consent );
56
+
57
+ $location = empty( $_POST['redirect_to'] ) ? get_comment_link( $comment ) : $_POST['redirect_to'] . '#comment-' . $comment->comment_ID;
58
+
59
+ // If user didn't consent to cookies, add specific query arguments to display the awaiting moderation message.
60
+ if ( ! $cookies_consent && 'unapproved' === wp_get_comment_status( $comment ) && ! empty( $comment->comment_author_email ) ) {
61
+ $location = add_query_arg(
62
+ array(
63
+ 'unapproved' => $comment->comment_ID,
64
+ 'moderation-hash' => wp_hash( $comment->comment_date_gmt ),
65
+ ),
66
+ $location
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Filters the location URI to send the commenter after posting.
72
+ *
73
+ * @since 2.0.5
74
+ *
75
+ * @param string $location The 'redirect_to' URI sent via $_POST.
76
+ * @param WP_Comment $comment Comment object.
77
+ */
78
+ $location = apply_filters( 'comment_post_redirect', $location, $comment );
79
+
80
+ wp_safe_redirect( $location );
81
+ exit;
wp-config.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The base configuration for WordPress
4
+ *
5
+ * The wp-config.php creation script uses this file during the installation.
6
+ * You don't have to use the website, you can copy this file to "wp-config.php"
7
+ * and fill in the values.
8
+ *
9
+ * This file contains the following configurations:
10
+ *
11
+ * * Database settings
12
+ * * Secret keys
13
+ * * Database table prefix
14
+ * * ABSPATH
15
+ *
16
+ * @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/
17
+ *
18
+ * @package WordPress
19
+ */
20
+
21
+ // ** Database settings - You can get this info from your web host ** //
22
+ /** The name of the database for WordPress */
23
+ define( 'DB_NAME', getenv('DB_NAME'));
24
+
25
+ /** Database username */
26
+ define( 'DB_USER', getenv('DB_USER'));
27
+
28
+ /** Database password */
29
+ define( 'DB_PASSWORD', getenv('DB_PASSWORD'));
30
+
31
+ /** Database hostname */
32
+ define( 'DB_HOST', getenv('DB_HOST'));
33
+
34
+ /** Database charset to use in creating database tables. */
35
+ define( 'DB_CHARSET', 'utf8mb4' );
36
+
37
+ /** The database collate type. Don't change this if in doubt. */
38
+ define( 'DB_COLLATE', '' );
39
+
40
+ /**#@+
41
+ * Authentication unique keys and salts.
42
+ *
43
+ * Change these to different unique phrases! You can generate these using
44
+ * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
45
+ *
46
+ * You can change these at any point in time to invalidate all existing cookies.
47
+ * This will force all users to have to log in again.
48
+ *
49
+ * @since 2.6.0
50
+ */
51
+ define( 'AUTH_KEY', getenv('AUTH_KEY'));
52
+ define( 'SECURE_AUTH_KEY', getenv('SECURE_AUTH_KEY'));
53
+ define( 'LOGGED_IN_KEY', getenv('LOGGED_IN_KEY'));
54
+ define( 'NONCE_KEY', getenv('NONCE_KEY'));
55
+ define( 'AUTH_SALT', getenv('AUTH_SALT'));
56
+ define( 'SECURE_AUTH_SALT', getenv('SECURE_AUTH_SALT'));
57
+ define( 'LOGGED_IN_SALT', getenv('LOGGED_IN_SALT'));
58
+ define( 'NONCE_SALT', getenv('NONCE_SALT'));
59
+
60
+ /**#@-*/
61
+
62
+ /**
63
+ * WordPress database table prefix.
64
+ *
65
+ * You can have multiple installations in one database if you give each
66
+ * a unique prefix. Only numbers, letters, and underscores please!
67
+ */
68
+ $table_prefix = 'wp_';
69
+
70
+ /**
71
+ * For developers: WordPress debugging mode.
72
+ *
73
+ * Change this to true to enable the display of notices during development.
74
+ * It is strongly recommended that plugin and theme developers use WP_DEBUG
75
+ * in their development environments.
76
+ *
77
+ * For information on other constants that can be used for debugging,
78
+ * visit the documentation.
79
+ *
80
+ * @link https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/
81
+ */
82
+ define( 'WP_DEBUG', false );
83
+
84
+ /* Add any custom values between this line and the "stop editing" line. */
85
+
86
+
87
+
88
+ /* That's all, stop editing! Happy publishing. */
89
+
90
+ /** Absolute path to the WordPress directory. */
91
+ if ( ! defined( 'ABSPATH' ) ) {
92
+ define( 'ABSPATH', __DIR__ . '/' );
93
+ }
94
+
95
+ /** Sets up WordPress vars and included files. */
96
+ require_once ABSPATH . 'wp-settings.php';
wp-cron.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * A pseudo-cron daemon for scheduling WordPress tasks.
4
+ *
5
+ * WP-Cron is triggered when the site receives a visit. In the scenario
6
+ * where a site may not receive enough visits to execute scheduled tasks
7
+ * in a timely manner, this file can be called directly or via a server
8
+ * cron daemon for X number of times.
9
+ *
10
+ * Defining DISABLE_WP_CRON as true and calling this file directly are
11
+ * mutually exclusive and the latter does not rely on the former to work.
12
+ *
13
+ * The HTTP request to this file will not slow down the visitor who happens to
14
+ * visit when a scheduled cron event runs.
15
+ *
16
+ * @package WordPress
17
+ */
18
+
19
+ ignore_user_abort( true );
20
+
21
+ if ( ! headers_sent() ) {
22
+ header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
23
+ header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
24
+ }
25
+
26
+ // Don't run cron until the request finishes, if possible.
27
+ if ( PHP_VERSION_ID >= 70016 && function_exists( 'fastcgi_finish_request' ) ) {
28
+ fastcgi_finish_request();
29
+ } elseif ( function_exists( 'litespeed_finish_request' ) ) {
30
+ litespeed_finish_request();
31
+ }
32
+
33
+ if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
34
+ die();
35
+ }
36
+
37
+ /**
38
+ * Tell WordPress the cron task is running.
39
+ *
40
+ * @var bool
41
+ */
42
+ define( 'DOING_CRON', true );
43
+
44
+ if ( ! defined( 'ABSPATH' ) ) {
45
+ /** Set up WordPress environment */
46
+ require_once __DIR__ . '/wp-load.php';
47
+ }
48
+
49
+ // Attempt to raise the PHP memory limit for cron event processing.
50
+ wp_raise_memory_limit( 'cron' );
51
+
52
+ /**
53
+ * Retrieves the cron lock.
54
+ *
55
+ * Returns the uncached `doing_cron` transient.
56
+ *
57
+ * @ignore
58
+ * @since 3.3.0
59
+ *
60
+ * @global wpdb $wpdb WordPress database abstraction object.
61
+ *
62
+ * @return string|int|false Value of the `doing_cron` transient, 0|false otherwise.
63
+ */
64
+ function _get_cron_lock() {
65
+ global $wpdb;
66
+
67
+ $value = 0;
68
+ if ( wp_using_ext_object_cache() ) {
69
+ /*
70
+ * Skip local cache and force re-fetch of doing_cron transient
71
+ * in case another process updated the cache.
72
+ */
73
+ $value = wp_cache_get( 'doing_cron', 'transient', true );
74
+ } else {
75
+ $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) );
76
+ if ( is_object( $row ) ) {
77
+ $value = $row->option_value;
78
+ }
79
+ }
80
+
81
+ return $value;
82
+ }
83
+
84
+ $crons = wp_get_ready_cron_jobs();
85
+ if ( empty( $crons ) ) {
86
+ die();
87
+ }
88
+
89
+ $gmt_time = microtime( true );
90
+
91
+ // The cron lock: a unix timestamp from when the cron was spawned.
92
+ $doing_cron_transient = get_transient( 'doing_cron' );
93
+
94
+ // Use global $doing_wp_cron lock, otherwise use the GET lock. If no lock, try to grab a new lock.
95
+ if ( empty( $doing_wp_cron ) ) {
96
+ if ( empty( $_GET['doing_wp_cron'] ) ) {
97
+ // Called from external script/job. Try setting a lock.
98
+ if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) {
99
+ return;
100
+ }
101
+ $doing_wp_cron = sprintf( '%.22F', microtime( true ) );
102
+ $doing_cron_transient = $doing_wp_cron;
103
+ set_transient( 'doing_cron', $doing_wp_cron );
104
+ } else {
105
+ $doing_wp_cron = $_GET['doing_wp_cron'];
106
+ }
107
+ }
108
+
109
+ /*
110
+ * The cron lock (a unix timestamp set when the cron was spawned),
111
+ * must match $doing_wp_cron (the "key").
112
+ */
113
+ if ( $doing_cron_transient !== $doing_wp_cron ) {
114
+ return;
115
+ }
116
+
117
+ foreach ( $crons as $timestamp => $cronhooks ) {
118
+ if ( $timestamp > $gmt_time ) {
119
+ break;
120
+ }
121
+
122
+ foreach ( $cronhooks as $hook => $keys ) {
123
+
124
+ foreach ( $keys as $k => $v ) {
125
+
126
+ $schedule = $v['schedule'];
127
+
128
+ if ( $schedule ) {
129
+ $result = wp_reschedule_event( $timestamp, $schedule, $hook, $v['args'], true );
130
+
131
+ if ( is_wp_error( $result ) ) {
132
+ error_log(
133
+ sprintf(
134
+ /* translators: 1: Hook name, 2: Error code, 3: Error message, 4: Event data. */
135
+ __( 'Cron reschedule event error for hook: %1$s, Error code: %2$s, Error message: %3$s, Data: %4$s' ),
136
+ $hook,
137
+ $result->get_error_code(),
138
+ $result->get_error_message(),
139
+ wp_json_encode( $v )
140
+ )
141
+ );
142
+
143
+ /**
144
+ * Fires when an error happens rescheduling a cron event.
145
+ *
146
+ * @since 6.1.0
147
+ *
148
+ * @param WP_Error $result The WP_Error object.
149
+ * @param string $hook Action hook to execute when the event is run.
150
+ * @param array $v Event data.
151
+ */
152
+ do_action( 'cron_reschedule_event_error', $result, $hook, $v );
153
+ }
154
+ }
155
+
156
+ $result = wp_unschedule_event( $timestamp, $hook, $v['args'], true );
157
+
158
+ if ( is_wp_error( $result ) ) {
159
+ error_log(
160
+ sprintf(
161
+ /* translators: 1: Hook name, 2: Error code, 3: Error message, 4: Event data. */
162
+ __( 'Cron unschedule event error for hook: %1$s, Error code: %2$s, Error message: %3$s, Data: %4$s' ),
163
+ $hook,
164
+ $result->get_error_code(),
165
+ $result->get_error_message(),
166
+ wp_json_encode( $v )
167
+ )
168
+ );
169
+
170
+ /**
171
+ * Fires when an error happens unscheduling a cron event.
172
+ *
173
+ * @since 6.1.0
174
+ *
175
+ * @param WP_Error $result The WP_Error object.
176
+ * @param string $hook Action hook to execute when the event is run.
177
+ * @param array $v Event data.
178
+ */
179
+ do_action( 'cron_unschedule_event_error', $result, $hook, $v );
180
+ }
181
+
182
+ /**
183
+ * Fires scheduled events.
184
+ *
185
+ * @ignore
186
+ * @since 2.1.0
187
+ *
188
+ * @param string $hook Name of the hook that was scheduled to be fired.
189
+ * @param array $args The arguments to be passed to the hook.
190
+ */
191
+ do_action_ref_array( $hook, $v['args'] );
192
+
193
+ // If the hook ran too long and another cron process stole the lock, quit.
194
+ if ( _get_cron_lock() !== $doing_wp_cron ) {
195
+ return;
196
+ }
197
+ }
198
+ }
199
+ }
200
+
201
+ if ( _get_cron_lock() === $doing_wp_cron ) {
202
+ delete_transient( 'doing_cron' );
203
+ }
204
+
205
+ die();
wp-links-opml.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Outputs the OPML XML format for getting the links defined in the link
4
+ * administration. This can be used to export links from one blog over to
5
+ * another. Links aren't exported by the WordPress export, so this file handles
6
+ * that.
7
+ *
8
+ * This file is not added by default to WordPress theme pages when outputting
9
+ * feed links. It will have to be added manually for browsers and users to pick
10
+ * up that this file exists.
11
+ *
12
+ * @package WordPress
13
+ */
14
+
15
+ require_once __DIR__ . '/wp-load.php';
16
+
17
+ header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
18
+ $link_cat = '';
19
+ if ( ! empty( $_GET['link_cat'] ) ) {
20
+ $link_cat = $_GET['link_cat'];
21
+ if ( ! in_array( $link_cat, array( 'all', '0' ), true ) ) {
22
+ $link_cat = absint( (string) urldecode( $link_cat ) );
23
+ }
24
+ }
25
+
26
+ echo '<?xml version="1.0"?' . ">\n";
27
+ ?>
28
+ <opml version="1.0">
29
+ <head>
30
+ <title>
31
+ <?php
32
+ /* translators: %s: Site title. */
33
+ printf( __( 'Links for %s' ), esc_attr( get_bloginfo( 'name', 'display' ) ) );
34
+ ?>
35
+ </title>
36
+ <dateCreated><?php echo gmdate( 'D, d M Y H:i:s' ); ?> GMT</dateCreated>
37
+ <?php
38
+ /**
39
+ * Fires in the OPML header.
40
+ *
41
+ * @since 3.0.0
42
+ */
43
+ do_action( 'opml_head' );
44
+ ?>
45
+ </head>
46
+ <body>
47
+ <?php
48
+ if ( empty( $link_cat ) ) {
49
+ $cats = get_categories(
50
+ array(
51
+ 'taxonomy' => 'link_category',
52
+ 'hierarchical' => 0,
53
+ )
54
+ );
55
+ } else {
56
+ $cats = get_categories(
57
+ array(
58
+ 'taxonomy' => 'link_category',
59
+ 'hierarchical' => 0,
60
+ 'include' => $link_cat,
61
+ )
62
+ );
63
+ }
64
+
65
+ foreach ( (array) $cats as $cat ) :
66
+ /** This filter is documented in wp-includes/bookmark-template.php */
67
+ $catname = apply_filters( 'link_category', $cat->name );
68
+
69
+ ?>
70
+ <outline type="category" title="<?php echo esc_attr( $catname ); ?>">
71
+ <?php
72
+ $bookmarks = get_bookmarks( array( 'category' => $cat->term_id ) );
73
+ foreach ( (array) $bookmarks as $bookmark ) :
74
+ /**
75
+ * Filters the OPML outline link title text.
76
+ *
77
+ * @since 2.2.0
78
+ *
79
+ * @param string $title The OPML outline title text.
80
+ */
81
+ $title = apply_filters( 'link_title', $bookmark->link_name );
82
+ ?>
83
+ <outline text="<?php echo esc_attr( $title ); ?>" type="link" xmlUrl="<?php echo esc_url( $bookmark->link_rss ); ?>" htmlUrl="<?php echo esc_url( $bookmark->link_url ); ?>" updated="
84
+ <?php
85
+ if ( '0000-00-00 00:00:00' !== $bookmark->link_updated ) {
86
+ echo $bookmark->link_updated;
87
+ }
88
+ ?>
89
+ " />
90
+ <?php
91
+ endforeach; // $bookmarks
92
+ ?>
93
+ </outline>
94
+ <?php
95
+ endforeach; // $cats
96
+ ?>
97
+ </body>
98
+ </opml>
wp-load.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Bootstrap file for setting the ABSPATH constant
4
+ * and loading the wp-config.php file. The wp-config.php
5
+ * file will then load the wp-settings.php file, which
6
+ * will then set up the WordPress environment.
7
+ *
8
+ * If the wp-config.php file is not found then an error
9
+ * will be displayed asking the visitor to set up the
10
+ * wp-config.php file.
11
+ *
12
+ * Will also search for wp-config.php in WordPress' parent
13
+ * directory to allow the WordPress directory to remain
14
+ * untouched.
15
+ *
16
+ * @package WordPress
17
+ */
18
+
19
+ /** Define ABSPATH as this file's directory */
20
+ if ( ! defined( 'ABSPATH' ) ) {
21
+ define( 'ABSPATH', __DIR__ . '/' );
22
+ }
23
+
24
+ /*
25
+ * The error_reporting() function can be disabled in php.ini. On systems where that is the case,
26
+ * it's best to add a dummy function to the wp-config.php file, but as this call to the function
27
+ * is run prior to wp-config.php loading, it is wrapped in a function_exists() check.
28
+ */
29
+ if ( function_exists( 'error_reporting' ) ) {
30
+ /*
31
+ * Initialize error reporting to a known set of levels.
32
+ *
33
+ * This will be adapted in wp_debug_mode() located in wp-includes/load.php based on WP_DEBUG.
34
+ * @see https://www.php.net/manual/en/errorfunc.constants.php List of known error levels.
35
+ */
36
+ error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
37
+ }
38
+
39
+ /*
40
+ * If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
41
+ * doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
42
+ * of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)
43
+ * and /blog/ is WordPress(b).
44
+ *
45
+ * If neither set of conditions is true, initiate loading the setup process.
46
+ */
47
+ if ( file_exists( ABSPATH . 'wp-config.php' ) ) {
48
+
49
+ /** The config file resides in ABSPATH */
50
+ require_once ABSPATH . 'wp-config.php';
51
+
52
+ } elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
53
+
54
+ /** The config file resides one level above ABSPATH but is not part of another installation */
55
+ require_once dirname( ABSPATH ) . '/wp-config.php';
56
+
57
+ } else {
58
+
59
+ // A config file doesn't exist.
60
+
61
+ define( 'WPINC', 'wp-includes' );
62
+ require_once ABSPATH . WPINC . '/version.php';
63
+ require_once ABSPATH . WPINC . '/compat.php';
64
+ require_once ABSPATH . WPINC . '/load.php';
65
+
66
+ // Check for the required PHP version and for the MySQL extension or a database drop-in.
67
+ wp_check_php_mysql_versions();
68
+
69
+ // Standardize $_SERVER variables across setups.
70
+ wp_fix_server_vars();
71
+
72
+ define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
73
+ require_once ABSPATH . WPINC . '/functions.php';
74
+
75
+ $path = wp_guess_url() . '/wp-admin/setup-config.php';
76
+
77
+ // Redirect to setup-config.php.
78
+ if ( ! str_contains( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
79
+ header( 'Location: ' . $path );
80
+ exit;
81
+ }
82
+
83
+ wp_load_translations_early();
84
+
85
+ // Die with an error message.
86
+ $die = '<p>' . sprintf(
87
+ /* translators: %s: wp-config.php */
88
+ __( "There doesn't seem to be a %s file. It is needed before the installation can continue." ),
89
+ '<code>wp-config.php</code>'
90
+ ) . '</p>';
91
+ $die .= '<p>' . sprintf(
92
+ /* translators: 1: Documentation URL, 2: wp-config.php */
93
+ __( 'Need more help? <a href="%1$s">Read the support article on %2$s</a>.' ),
94
+ __( 'https://developer.wordpress.org/advanced-administration/wordpress/wp-config/' ),
95
+ '<code>wp-config.php</code>'
96
+ ) . '</p>';
97
+ $die .= '<p>' . sprintf(
98
+ /* translators: %s: wp-config.php */
99
+ __( "You can create a %s file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ),
100
+ '<code>wp-config.php</code>'
101
+ ) . '</p>';
102
+ $die .= '<p><a href="' . $path . '" class="button button-large">' . __( 'Create a Configuration File' ) . '</a></p>';
103
+
104
+ wp_die( $die, __( 'WordPress &rsaquo; Error' ) );
105
+ }
wp-login.php ADDED
@@ -0,0 +1,1644 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WordPress User Page
4
+ *
5
+ * Handles authentication, registering, resetting passwords, forgot password,
6
+ * and other user handling.
7
+ *
8
+ * @package WordPress
9
+ */
10
+
11
+ /** Make sure that the WordPress bootstrap has run before continuing. */
12
+ require __DIR__ . '/wp-load.php';
13
+
14
+ // Redirect to HTTPS login if forced to use SSL.
15
+ if ( force_ssl_admin() && ! is_ssl() ) {
16
+ if ( str_starts_with( $_SERVER['REQUEST_URI'], 'http' ) ) {
17
+ wp_safe_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
18
+ exit;
19
+ } else {
20
+ wp_safe_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
21
+ exit;
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Outputs the login page header.
27
+ *
28
+ * @since 2.1.0
29
+ *
30
+ * @global string $error Login error message set by deprecated pluggable wp_login() function
31
+ * or plugins replacing it.
32
+ * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success'
33
+ * upon successful login.
34
+ * @global string $action The action that brought the visitor to the login page.
35
+ *
36
+ * @param string|null $title Optional. WordPress login page title to display in the `<title>` element.
37
+ * Defaults to 'Log In'.
38
+ * @param string $message Optional. Message to display in header. Default empty.
39
+ * @param WP_Error|null $wp_error Optional. The error to pass. Defaults to a WP_Error instance.
40
+ */
41
+ function login_header( $title = null, $message = '', $wp_error = null ) {
42
+ global $error, $interim_login, $action;
43
+
44
+ if ( null === $title ) {
45
+ $title = __( 'Log In' );
46
+ }
47
+
48
+ // Don't index any of these forms.
49
+ add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
50
+ add_action( 'login_head', 'wp_strict_cross_origin_referrer' );
51
+
52
+ add_action( 'login_head', 'wp_login_viewport_meta' );
53
+
54
+ if ( ! is_wp_error( $wp_error ) ) {
55
+ $wp_error = new WP_Error();
56
+ }
57
+
58
+ // Shake it!
59
+ $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password', 'retrieve_password_email_failure' );
60
+ /**
61
+ * Filters the error codes array for shaking the login form.
62
+ *
63
+ * @since 3.0.0
64
+ *
65
+ * @param string[] $shake_error_codes Error codes that shake the login form.
66
+ */
67
+ $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
68
+
69
+ if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes, true ) ) {
70
+ add_action( 'login_footer', 'wp_shake_js', 12 );
71
+ }
72
+
73
+ $login_title = get_bloginfo( 'name', 'display' );
74
+
75
+ /* translators: Login screen title. 1: Login screen name, 2: Network or site name. */
76
+ $login_title = sprintf( __( '%1$s &lsaquo; %2$s &#8212; WordPress' ), $title, $login_title );
77
+
78
+ if ( wp_is_recovery_mode() ) {
79
+ /* translators: %s: Login screen title. */
80
+ $login_title = sprintf( __( 'Recovery Mode &#8212; %s' ), $login_title );
81
+ }
82
+
83
+ /**
84
+ * Filters the title tag content for login page.
85
+ *
86
+ * @since 4.9.0
87
+ *
88
+ * @param string $login_title The page title, with extra context added.
89
+ * @param string $title The original page title.
90
+ */
91
+ $login_title = apply_filters( 'login_title', $login_title, $title );
92
+
93
+ ?><!DOCTYPE html>
94
+ <html <?php language_attributes(); ?>>
95
+ <head>
96
+ <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" />
97
+ <title><?php echo $login_title; ?></title>
98
+ <?php
99
+
100
+ wp_enqueue_style( 'login' );
101
+
102
+ /*
103
+ * Remove all stored post data on logging out.
104
+ * This could be added by add_action('login_head'...) like wp_shake_js(),
105
+ * but maybe better if it's not removable by plugins.
106
+ */
107
+ if ( 'loggedout' === $wp_error->get_error_code() ) {
108
+ ob_start();
109
+ ?>
110
+ <script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script>
111
+ <?php
112
+ wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
113
+ }
114
+
115
+ /**
116
+ * Enqueues scripts and styles for the login page.
117
+ *
118
+ * @since 3.1.0
119
+ */
120
+ do_action( 'login_enqueue_scripts' );
121
+
122
+ /**
123
+ * Fires in the login page header after scripts are enqueued.
124
+ *
125
+ * @since 2.1.0
126
+ */
127
+ do_action( 'login_head' );
128
+
129
+ $login_header_url = __( 'https://wordpress.org/' );
130
+
131
+ /**
132
+ * Filters link URL of the header logo above login form.
133
+ *
134
+ * @since 2.1.0
135
+ *
136
+ * @param string $login_header_url Login header logo URL.
137
+ */
138
+ $login_header_url = apply_filters( 'login_headerurl', $login_header_url );
139
+
140
+ $login_header_title = '';
141
+
142
+ /**
143
+ * Filters the title attribute of the header logo above login form.
144
+ *
145
+ * @since 2.1.0
146
+ * @deprecated 5.2.0 Use {@see 'login_headertext'} instead.
147
+ *
148
+ * @param string $login_header_title Login header logo title attribute.
149
+ */
150
+ $login_header_title = apply_filters_deprecated(
151
+ 'login_headertitle',
152
+ array( $login_header_title ),
153
+ '5.2.0',
154
+ 'login_headertext',
155
+ __( 'Usage of the title attribute on the login logo is not recommended for accessibility reasons. Use the link text instead.' )
156
+ );
157
+
158
+ $login_header_text = empty( $login_header_title ) ? __( 'Powered by WordPress' ) : $login_header_title;
159
+
160
+ /**
161
+ * Filters the link text of the header logo above the login form.
162
+ *
163
+ * @since 5.2.0
164
+ *
165
+ * @param string $login_header_text The login header logo link text.
166
+ */
167
+ $login_header_text = apply_filters( 'login_headertext', $login_header_text );
168
+
169
+ $classes = array( 'login-action-' . $action, 'wp-core-ui' );
170
+
171
+ if ( is_rtl() ) {
172
+ $classes[] = 'rtl';
173
+ }
174
+
175
+ if ( $interim_login ) {
176
+ $classes[] = 'interim-login';
177
+
178
+ ?>
179
+ <style type="text/css">html{background-color: transparent;}</style>
180
+ <?php
181
+
182
+ if ( 'success' === $interim_login ) {
183
+ $classes[] = 'interim-login-success';
184
+ }
185
+ }
186
+
187
+ $classes[] = ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
188
+
189
+ /**
190
+ * Filters the login page body classes.
191
+ *
192
+ * @since 3.5.0
193
+ *
194
+ * @param string[] $classes An array of body classes.
195
+ * @param string $action The action that brought the visitor to the login page.
196
+ */
197
+ $classes = apply_filters( 'login_body_class', $classes, $action );
198
+
199
+ ?>
200
+ </head>
201
+ <body class="login no-js <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
202
+ <?php
203
+ wp_print_inline_script_tag( "document.body.className = document.body.className.replace('no-js','js');" );
204
+ ?>
205
+
206
+ <?php
207
+ /**
208
+ * Fires in the login page header after the body tag is opened.
209
+ *
210
+ * @since 4.6.0
211
+ */
212
+ do_action( 'login_header' );
213
+
214
+ ?>
215
+ <div id="login">
216
+ <h1><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1>
217
+ <?php
218
+ /**
219
+ * Filters the message to display above the login form.
220
+ *
221
+ * @since 2.1.0
222
+ *
223
+ * @param string $message Login message text.
224
+ */
225
+ $message = apply_filters( 'login_message', $message );
226
+
227
+ if ( ! empty( $message ) ) {
228
+ echo $message . "\n";
229
+ }
230
+
231
+ // In case a plugin uses $error rather than the $wp_errors object.
232
+ if ( ! empty( $error ) ) {
233
+ $wp_error->add( 'error', $error );
234
+ unset( $error );
235
+ }
236
+
237
+ if ( $wp_error->has_errors() ) {
238
+ $error_list = array();
239
+ $messages = '';
240
+
241
+ foreach ( $wp_error->get_error_codes() as $code ) {
242
+ $severity = $wp_error->get_error_data( $code );
243
+ foreach ( $wp_error->get_error_messages( $code ) as $error_message ) {
244
+ if ( 'message' === $severity ) {
245
+ $messages .= '<p>' . $error_message . '</p>';
246
+ } else {
247
+ $error_list[] = $error_message;
248
+ }
249
+ }
250
+ }
251
+
252
+ if ( ! empty( $error_list ) ) {
253
+ $errors = '';
254
+
255
+ if ( count( $error_list ) > 1 ) {
256
+ $errors .= '<ul class="login-error-list">';
257
+
258
+ foreach ( $error_list as $item ) {
259
+ $errors .= '<li>' . $item . '</li>';
260
+ }
261
+
262
+ $errors .= '</ul>';
263
+ } else {
264
+ $errors .= '<p>' . $error_list[0] . '</p>';
265
+ }
266
+
267
+ /**
268
+ * Filters the error messages displayed above the login form.
269
+ *
270
+ * @since 2.1.0
271
+ *
272
+ * @param string $errors Login error messages.
273
+ */
274
+ $errors = apply_filters( 'login_errors', $errors );
275
+
276
+ wp_admin_notice(
277
+ $errors,
278
+ array(
279
+ 'type' => 'error',
280
+ 'id' => 'login_error',
281
+ 'paragraph_wrap' => false,
282
+ )
283
+ );
284
+ }
285
+
286
+ if ( ! empty( $messages ) ) {
287
+ /**
288
+ * Filters instructional messages displayed above the login form.
289
+ *
290
+ * @since 2.5.0
291
+ *
292
+ * @param string $messages Login messages.
293
+ */
294
+ $messages = apply_filters( 'login_messages', $messages );
295
+
296
+ wp_admin_notice(
297
+ $messages,
298
+ array(
299
+ 'type' => 'info',
300
+ 'id' => 'login-message',
301
+ 'additional_classes' => array( 'message' ),
302
+ 'paragraph_wrap' => false,
303
+ )
304
+ );
305
+ }
306
+ }
307
+ } // End of login_header().
308
+
309
+ /**
310
+ * Outputs the footer for the login page.
311
+ *
312
+ * @since 3.1.0
313
+ *
314
+ * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success'
315
+ * upon successful login.
316
+ *
317
+ * @param string $input_id Which input to auto-focus.
318
+ */
319
+ function login_footer( $input_id = '' ) {
320
+ global $interim_login;
321
+
322
+ // Don't allow interim logins to navigate away from the page.
323
+ if ( ! $interim_login ) {
324
+ ?>
325
+ <p id="backtoblog">
326
+ <?php
327
+ $html_link = sprintf(
328
+ '<a href="%s">%s</a>',
329
+ esc_url( home_url( '/' ) ),
330
+ sprintf(
331
+ /* translators: %s: Site title. */
332
+ _x( '&larr; Go to %s', 'site' ),
333
+ get_bloginfo( 'title', 'display' )
334
+ )
335
+ );
336
+ /**
337
+ * Filters the "Go to site" link displayed in the login page footer.
338
+ *
339
+ * @since 5.7.0
340
+ *
341
+ * @param string $link HTML link to the home URL of the current site.
342
+ */
343
+ echo apply_filters( 'login_site_html_link', $html_link );
344
+ ?>
345
+ </p>
346
+ <?php
347
+
348
+ the_privacy_policy_link( '<div class="privacy-policy-page-link">', '</div>' );
349
+ }
350
+
351
+ ?>
352
+ </div><?php // End of <div id="login">. ?>
353
+
354
+ <?php
355
+ if (
356
+ ! $interim_login &&
357
+ /**
358
+ * Filters whether to display the Language selector on the login screen.
359
+ *
360
+ * @since 5.9.0
361
+ *
362
+ * @param bool $display Whether to display the Language selector on the login screen.
363
+ */
364
+ apply_filters( 'login_display_language_dropdown', true )
365
+ ) {
366
+ $languages = get_available_languages();
367
+
368
+ if ( ! empty( $languages ) ) {
369
+ ?>
370
+ <div class="language-switcher">
371
+ <form id="language-switcher" method="get">
372
+
373
+ <label for="language-switcher-locales">
374
+ <span class="dashicons dashicons-translation" aria-hidden="true"></span>
375
+ <span class="screen-reader-text">
376
+ <?php
377
+ /* translators: Hidden accessibility text. */
378
+ _e( 'Language' );
379
+ ?>
380
+ </span>
381
+ </label>
382
+
383
+ <?php
384
+ $args = array(
385
+ 'id' => 'language-switcher-locales',
386
+ 'name' => 'wp_lang',
387
+ 'selected' => determine_locale(),
388
+ 'show_available_translations' => false,
389
+ 'explicit_option_en_us' => true,
390
+ 'languages' => $languages,
391
+ );
392
+
393
+ /**
394
+ * Filters default arguments for the Languages select input on the login screen.
395
+ *
396
+ * The arguments get passed to the wp_dropdown_languages() function.
397
+ *
398
+ * @since 5.9.0
399
+ *
400
+ * @param array $args Arguments for the Languages select input on the login screen.
401
+ */
402
+ wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) );
403
+ ?>
404
+
405
+ <?php if ( $interim_login ) { ?>
406
+ <input type="hidden" name="interim-login" value="1" />
407
+ <?php } ?>
408
+
409
+ <?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?>
410
+ <input type="hidden" name="redirect_to" value="<?php echo sanitize_url( $_GET['redirect_to'] ); ?>" />
411
+ <?php } ?>
412
+
413
+ <?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?>
414
+ <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action'] ); ?>" />
415
+ <?php } ?>
416
+
417
+ <input type="submit" class="button" value="<?php esc_attr_e( 'Change' ); ?>">
418
+
419
+ </form>
420
+ </div>
421
+ <?php } ?>
422
+ <?php } ?>
423
+ <?php
424
+
425
+ if ( ! empty( $input_id ) ) {
426
+ ob_start();
427
+ ?>
428
+ <script>
429
+ try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
430
+ if(typeof wpOnload==='function')wpOnload();
431
+ </script>
432
+ <?php
433
+ wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
434
+ }
435
+
436
+ /**
437
+ * Fires in the login page footer.
438
+ *
439
+ * @since 3.1.0
440
+ */
441
+ do_action( 'login_footer' );
442
+
443
+ ?>
444
+ </body>
445
+ </html>
446
+ <?php
447
+ }
448
+
449
+ /**
450
+ * Outputs the JavaScript to handle the form shaking on the login page.
451
+ *
452
+ * @since 3.0.0
453
+ */
454
+ function wp_shake_js() {
455
+ wp_print_inline_script_tag( "document.querySelector('form').classList.add('shake');" );
456
+ }
457
+
458
+ /**
459
+ * Outputs the viewport meta tag for the login page.
460
+ *
461
+ * @since 3.7.0
462
+ */
463
+ function wp_login_viewport_meta() {
464
+ ?>
465
+ <meta name="viewport" content="width=device-width" />
466
+ <?php
467
+ }
468
+
469
+ /*
470
+ * Main part.
471
+ *
472
+ * Check the request and redirect or display a form based on the current action.
473
+ */
474
+
475
+ $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login';
476
+ $errors = new WP_Error();
477
+
478
+ if ( isset( $_GET['key'] ) ) {
479
+ $action = 'resetpass';
480
+ }
481
+
482
+ if ( isset( $_GET['checkemail'] ) ) {
483
+ $action = 'checkemail';
484
+ }
485
+
486
+ $default_actions = array(
487
+ 'confirm_admin_email',
488
+ 'postpass',
489
+ 'logout',
490
+ 'lostpassword',
491
+ 'retrievepassword',
492
+ 'resetpass',
493
+ 'rp',
494
+ 'register',
495
+ 'checkemail',
496
+ 'confirmaction',
497
+ 'login',
498
+ WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED,
499
+ );
500
+
501
+ // Validate action so as to default to the login screen.
502
+ if ( ! in_array( $action, $default_actions, true ) && false === has_filter( 'login_form_' . $action ) ) {
503
+ $action = 'login';
504
+ }
505
+
506
+ nocache_headers();
507
+
508
+ header( 'Content-Type: ' . get_bloginfo( 'html_type' ) . '; charset=' . get_bloginfo( 'charset' ) );
509
+
510
+ if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set.
511
+ if ( isset( $_SERVER['PATH_INFO'] ) && ( $_SERVER['PATH_INFO'] !== $_SERVER['PHP_SELF'] ) ) {
512
+ $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
513
+ }
514
+
515
+ $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
516
+
517
+ if ( get_option( 'siteurl' ) !== $url ) {
518
+ update_option( 'siteurl', $url );
519
+ }
520
+ }
521
+
522
+ // Set a cookie now to see if they are supported by the browser.
523
+ $secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) );
524
+ setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
525
+
526
+ if ( SITECOOKIEPATH !== COOKIEPATH ) {
527
+ setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
528
+ }
529
+
530
+ if ( isset( $_GET['wp_lang'] ) ) {
531
+ setcookie( 'wp_lang', sanitize_text_field( $_GET['wp_lang'] ), 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
532
+ }
533
+
534
+ /**
535
+ * Fires when the login form is initialized.
536
+ *
537
+ * @since 3.2.0
538
+ */
539
+ do_action( 'login_init' );
540
+
541
+ /**
542
+ * Fires before a specified login form action.
543
+ *
544
+ * The dynamic portion of the hook name, `$action`, refers to the action
545
+ * that brought the visitor to the login form.
546
+ *
547
+ * Possible hook names include:
548
+ *
549
+ * - `login_form_checkemail`
550
+ * - `login_form_confirm_admin_email`
551
+ * - `login_form_confirmaction`
552
+ * - `login_form_entered_recovery_mode`
553
+ * - `login_form_login`
554
+ * - `login_form_logout`
555
+ * - `login_form_lostpassword`
556
+ * - `login_form_postpass`
557
+ * - `login_form_register`
558
+ * - `login_form_resetpass`
559
+ * - `login_form_retrievepassword`
560
+ * - `login_form_rp`
561
+ *
562
+ * @since 2.8.0
563
+ */
564
+ do_action( "login_form_{$action}" );
565
+
566
+ $http_post = ( 'POST' === $_SERVER['REQUEST_METHOD'] );
567
+ $interim_login = isset( $_REQUEST['interim-login'] );
568
+
569
+ /**
570
+ * Filters the separator used between login form navigation links.
571
+ *
572
+ * @since 4.9.0
573
+ *
574
+ * @param string $login_link_separator The separator used between login form navigation links.
575
+ */
576
+ $login_link_separator = apply_filters( 'login_link_separator', ' | ' );
577
+
578
+ switch ( $action ) {
579
+
580
+ case 'confirm_admin_email':
581
+ /*
582
+ * Note that `is_user_logged_in()` will return false immediately after logging in
583
+ * as the current user is not set, see wp-includes/pluggable.php.
584
+ * However this action runs on a redirect after logging in.
585
+ */
586
+ if ( ! is_user_logged_in() ) {
587
+ wp_safe_redirect( wp_login_url() );
588
+ exit;
589
+ }
590
+
591
+ if ( ! empty( $_REQUEST['redirect_to'] ) ) {
592
+ $redirect_to = $_REQUEST['redirect_to'];
593
+ } else {
594
+ $redirect_to = admin_url();
595
+ }
596
+
597
+ if ( current_user_can( 'manage_options' ) ) {
598
+ $admin_email = get_option( 'admin_email' );
599
+ } else {
600
+ wp_safe_redirect( $redirect_to );
601
+ exit;
602
+ }
603
+
604
+ /**
605
+ * Filters the interval for dismissing the admin email confirmation screen.
606
+ *
607
+ * If `0` (zero) is returned, the "Remind me later" link will not be displayed.
608
+ *
609
+ * @since 5.3.1
610
+ *
611
+ * @param int $interval Interval time (in seconds). Default is 3 days.
612
+ */
613
+ $remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS );
614
+
615
+ if ( ! empty( $_GET['remind_me_later'] ) ) {
616
+ if ( ! wp_verify_nonce( $_GET['remind_me_later'], 'remind_me_later_nonce' ) ) {
617
+ wp_safe_redirect( wp_login_url() );
618
+ exit;
619
+ }
620
+
621
+ if ( $remind_interval > 0 ) {
622
+ update_option( 'admin_email_lifespan', time() + $remind_interval );
623
+ }
624
+
625
+ $redirect_to = add_query_arg( 'admin_email_remind_later', 1, $redirect_to );
626
+ wp_safe_redirect( $redirect_to );
627
+ exit;
628
+ }
629
+
630
+ if ( ! empty( $_POST['correct-admin-email'] ) ) {
631
+ if ( ! check_admin_referer( 'confirm_admin_email', 'confirm_admin_email_nonce' ) ) {
632
+ wp_safe_redirect( wp_login_url() );
633
+ exit;
634
+ }
635
+
636
+ /**
637
+ * Filters the interval for redirecting the user to the admin email confirmation screen.
638
+ *
639
+ * If `0` (zero) is returned, the user will not be redirected.
640
+ *
641
+ * @since 5.3.0
642
+ *
643
+ * @param int $interval Interval time (in seconds). Default is 6 months.
644
+ */
645
+ $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS );
646
+
647
+ if ( $admin_email_check_interval > 0 ) {
648
+ update_option( 'admin_email_lifespan', time() + $admin_email_check_interval );
649
+ }
650
+
651
+ wp_safe_redirect( $redirect_to );
652
+ exit;
653
+ }
654
+
655
+ login_header( __( 'Confirm your administration email' ), '', $errors );
656
+
657
+ /**
658
+ * Fires before the admin email confirm form.
659
+ *
660
+ * @since 5.3.0
661
+ *
662
+ * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid
663
+ * credentials. Note that the error object may not contain any errors.
664
+ */
665
+ do_action( 'admin_email_confirm', $errors );
666
+
667
+ ?>
668
+
669
+ <form class="admin-email-confirm-form" name="admin-email-confirm-form" action="<?php echo esc_url( site_url( 'wp-login.php?action=confirm_admin_email', 'login_post' ) ); ?>" method="post">
670
+ <?php
671
+ /**
672
+ * Fires inside the admin-email-confirm-form form tags, before the hidden fields.
673
+ *
674
+ * @since 5.3.0
675
+ */
676
+ do_action( 'admin_email_confirm_form' );
677
+
678
+ wp_nonce_field( 'confirm_admin_email', 'confirm_admin_email_nonce' );
679
+
680
+ ?>
681
+ <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
682
+
683
+ <h1 class="admin-email__heading">
684
+ <?php _e( 'Administration email verification' ); ?>
685
+ </h1>
686
+ <p class="admin-email__details">
687
+ <?php _e( 'Please verify that the <strong>administration email</strong> for this website is still correct.' ); ?>
688
+ <?php
689
+
690
+ /* translators: URL to the WordPress help section about admin email. */
691
+ $admin_email_help_url = __( 'https://wordpress.org/documentation/article/settings-general-screen/#email-address' );
692
+
693
+ $accessibility_text = sprintf(
694
+ '<span class="screen-reader-text"> %s</span>',
695
+ /* translators: Hidden accessibility text. */
696
+ __( '(opens in a new tab)' )
697
+ );
698
+
699
+ printf(
700
+ '<a href="%s" rel="noopener" target="_blank">%s%s</a>',
701
+ esc_url( $admin_email_help_url ),
702
+ __( 'Why is this important?' ),
703
+ $accessibility_text
704
+ );
705
+
706
+ ?>
707
+ </p>
708
+ <p class="admin-email__details">
709
+ <?php
710
+
711
+ printf(
712
+ /* translators: %s: Admin email address. */
713
+ __( 'Current administration email: %s' ),
714
+ '<strong>' . esc_html( $admin_email ) . '</strong>'
715
+ );
716
+
717
+ ?>
718
+ </p>
719
+ <p class="admin-email__details">
720
+ <?php _e( 'This email may be different from your personal email address.' ); ?>
721
+ </p>
722
+
723
+ <div class="admin-email__actions">
724
+ <div class="admin-email__actions-primary">
725
+ <?php
726
+
727
+ $change_link = admin_url( 'options-general.php' );
728
+ $change_link = add_query_arg( 'highlight', 'confirm_admin_email', $change_link );
729
+
730
+ ?>
731
+ <a class="button button-large" href="<?php echo esc_url( $change_link ); ?>"><?php _e( 'Update' ); ?></a>
732
+ <input type="submit" name="correct-admin-email" id="correct-admin-email" class="button button-primary button-large" value="<?php esc_attr_e( 'The email is correct' ); ?>" />
733
+ </div>
734
+ <?php if ( $remind_interval > 0 ) : ?>
735
+ <div class="admin-email__actions-secondary">
736
+ <?php
737
+
738
+ $remind_me_link = wp_login_url( $redirect_to );
739
+ $remind_me_link = add_query_arg(
740
+ array(
741
+ 'action' => 'confirm_admin_email',
742
+ 'remind_me_later' => wp_create_nonce( 'remind_me_later_nonce' ),
743
+ ),
744
+ $remind_me_link
745
+ );
746
+
747
+ ?>
748
+ <a href="<?php echo esc_url( $remind_me_link ); ?>"><?php _e( 'Remind me later' ); ?></a>
749
+ </div>
750
+ <?php endif; ?>
751
+ </div>
752
+ </form>
753
+
754
+ <?php
755
+
756
+ login_footer();
757
+ break;
758
+
759
+ case 'postpass':
760
+ if ( ! isset( $_POST['post_password'] ) || ! is_string( $_POST['post_password'] ) ) {
761
+ wp_safe_redirect( wp_get_referer() );
762
+ exit;
763
+ }
764
+
765
+ require_once ABSPATH . WPINC . '/class-phpass.php';
766
+ $hasher = new PasswordHash( 8, true );
767
+
768
+ /**
769
+ * Filters the life span of the post password cookie.
770
+ *
771
+ * By default, the cookie expires 10 days from creation. To turn this
772
+ * into a session cookie, return 0.
773
+ *
774
+ * @since 3.7.0
775
+ *
776
+ * @param int $expires The expiry time, as passed to setcookie().
777
+ */
778
+ $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
779
+ $referer = wp_get_referer();
780
+
781
+ if ( $referer ) {
782
+ $secure = ( 'https' === parse_url( $referer, PHP_URL_SCHEME ) );
783
+ } else {
784
+ $secure = false;
785
+ }
786
+
787
+ setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
788
+
789
+ wp_safe_redirect( wp_get_referer() );
790
+ exit;
791
+
792
+ case 'logout':
793
+ check_admin_referer( 'log-out' );
794
+
795
+ $user = wp_get_current_user();
796
+
797
+ wp_logout();
798
+
799
+ if ( ! empty( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ) {
800
+ $redirect_to = $_REQUEST['redirect_to'];
801
+ $requested_redirect_to = $redirect_to;
802
+ } else {
803
+ $redirect_to = add_query_arg(
804
+ array(
805
+ 'loggedout' => 'true',
806
+ 'wp_lang' => get_user_locale( $user ),
807
+ ),
808
+ wp_login_url()
809
+ );
810
+
811
+ $requested_redirect_to = '';
812
+ }
813
+
814
+ /**
815
+ * Filters the log out redirect URL.
816
+ *
817
+ * @since 4.2.0
818
+ *
819
+ * @param string $redirect_to The redirect destination URL.
820
+ * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.
821
+ * @param WP_User $user The WP_User object for the user that's logging out.
822
+ */
823
+ $redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user );
824
+
825
+ wp_safe_redirect( $redirect_to );
826
+ exit;
827
+
828
+ case 'lostpassword':
829
+ case 'retrievepassword':
830
+ if ( $http_post ) {
831
+ $errors = retrieve_password();
832
+
833
+ if ( ! is_wp_error( $errors ) ) {
834
+ $redirect_to = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
835
+ wp_safe_redirect( $redirect_to );
836
+ exit;
837
+ }
838
+ }
839
+
840
+ if ( isset( $_GET['error'] ) ) {
841
+ if ( 'invalidkey' === $_GET['error'] ) {
842
+ $errors->add( 'invalidkey', __( '<strong>Error:</strong> Your password reset link appears to be invalid. Please request a new link below.' ) );
843
+ } elseif ( 'expiredkey' === $_GET['error'] ) {
844
+ $errors->add( 'expiredkey', __( '<strong>Error:</strong> Your password reset link has expired. Please request a new link below.' ) );
845
+ }
846
+ }
847
+
848
+ $lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
849
+ /**
850
+ * Filters the URL redirected to after submitting the lostpassword/retrievepassword form.
851
+ *
852
+ * @since 3.0.0
853
+ *
854
+ * @param string $lostpassword_redirect The redirect destination URL.
855
+ */
856
+ $redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect );
857
+
858
+ /**
859
+ * Fires before the lost password form.
860
+ *
861
+ * @since 1.5.1
862
+ * @since 5.1.0 Added the `$errors` parameter.
863
+ *
864
+ * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid
865
+ * credentials. Note that the error object may not contain any errors.
866
+ */
867
+ do_action( 'lost_password', $errors );
868
+
869
+ login_header(
870
+ __( 'Lost Password' ),
871
+ wp_get_admin_notice(
872
+ __( 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.' ),
873
+ array(
874
+ 'type' => 'info',
875
+ 'additional_classes' => array( 'message' ),
876
+ )
877
+ ),
878
+ $errors
879
+ );
880
+
881
+ $user_login = '';
882
+
883
+ if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) {
884
+ $user_login = wp_unslash( $_POST['user_login'] );
885
+ }
886
+
887
+ ?>
888
+
889
+ <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
890
+ <p>
891
+ <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label>
892
+ <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" />
893
+ </p>
894
+ <?php
895
+
896
+ /**
897
+ * Fires inside the lostpassword form tags, before the hidden fields.
898
+ *
899
+ * @since 2.1.0
900
+ */
901
+ do_action( 'lostpassword_form' );
902
+
903
+ ?>
904
+ <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
905
+ <p class="submit">
906
+ <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Get New Password' ); ?>" />
907
+ </p>
908
+ </form>
909
+
910
+ <p id="nav">
911
+ <a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
912
+ <?php
913
+
914
+ if ( get_option( 'users_can_register' ) ) {
915
+ $registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
916
+
917
+ echo esc_html( $login_link_separator );
918
+
919
+ /** This filter is documented in wp-includes/general-template.php */
920
+ echo apply_filters( 'register', $registration_url );
921
+ }
922
+
923
+ ?>
924
+ </p>
925
+ <?php
926
+
927
+ login_footer( 'user_login' );
928
+ break;
929
+
930
+ case 'resetpass':
931
+ case 'rp':
932
+ list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
933
+ $rp_cookie = 'wp-resetpass-' . COOKIEHASH;
934
+
935
+ if ( isset( $_GET['key'] ) && isset( $_GET['login'] ) ) {
936
+ $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) );
937
+ setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
938
+
939
+ wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) );
940
+ exit;
941
+ }
942
+
943
+ if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
944
+ list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
945
+
946
+ $user = check_password_reset_key( $rp_key, $rp_login );
947
+
948
+ if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) {
949
+ $user = false;
950
+ }
951
+ } else {
952
+ $user = false;
953
+ }
954
+
955
+ if ( ! $user || is_wp_error( $user ) ) {
956
+ setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
957
+
958
+ if ( $user && $user->get_error_code() === 'expired_key' ) {
959
+ wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) );
960
+ } else {
961
+ wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) );
962
+ }
963
+
964
+ exit;
965
+ }
966
+
967
+ $errors = new WP_Error();
968
+
969
+ // Check if password is one or all empty spaces.
970
+ if ( ! empty( $_POST['pass1'] ) ) {
971
+ $_POST['pass1'] = trim( $_POST['pass1'] );
972
+
973
+ if ( empty( $_POST['pass1'] ) ) {
974
+ $errors->add( 'password_reset_empty_space', __( 'The password cannot be a space or all spaces.' ) );
975
+ }
976
+ }
977
+
978
+ // Check if password fields do not match.
979
+ if ( ! empty( $_POST['pass1'] ) && trim( $_POST['pass2'] ) !== $_POST['pass1'] ) {
980
+ $errors->add( 'password_reset_mismatch', __( '<strong>Error:</strong> The passwords do not match.' ) );
981
+ }
982
+
983
+ /**
984
+ * Fires before the password reset procedure is validated.
985
+ *
986
+ * @since 3.5.0
987
+ *
988
+ * @param WP_Error $errors WP Error object.
989
+ * @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise.
990
+ */
991
+ do_action( 'validate_password_reset', $errors, $user );
992
+
993
+ if ( ( ! $errors->has_errors() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) {
994
+ reset_password( $user, $_POST['pass1'] );
995
+ setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
996
+ login_header(
997
+ __( 'Password Reset' ),
998
+ wp_get_admin_notice(
999
+ __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a>',
1000
+ array(
1001
+ 'type' => 'info',
1002
+ 'additional_classes' => array( 'message', 'reset-pass' ),
1003
+ )
1004
+ )
1005
+ );
1006
+ login_footer();
1007
+ exit;
1008
+ }
1009
+
1010
+ wp_enqueue_script( 'utils' );
1011
+ wp_enqueue_script( 'user-profile' );
1012
+
1013
+ login_header(
1014
+ __( 'Reset Password' ),
1015
+ wp_get_admin_notice(
1016
+ __( 'Enter your new password below or generate one.' ),
1017
+ array(
1018
+ 'type' => 'info',
1019
+ 'additional_classes' => array( 'message', 'reset-pass' ),
1020
+ )
1021
+ ),
1022
+ $errors
1023
+ );
1024
+
1025
+ ?>
1026
+ <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
1027
+ <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />
1028
+
1029
+ <div class="user-pass1-wrap">
1030
+ <p>
1031
+ <label for="pass1"><?php _e( 'New password' ); ?></label>
1032
+ </p>
1033
+
1034
+ <div class="wp-pwd">
1035
+ <input type="password" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="new-password" spellcheck="false" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" aria-describedby="pass-strength-result" />
1036
+
1037
+ <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
1038
+ <span class="dashicons dashicons-hidden" aria-hidden="true"></span>
1039
+ </button>
1040
+ <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div>
1041
+ </div>
1042
+ <div class="pw-weak">
1043
+ <input type="checkbox" name="pw_weak" id="pw-weak" class="pw-checkbox" />
1044
+ <label for="pw-weak"><?php _e( 'Confirm use of weak password' ); ?></label>
1045
+ </div>
1046
+ </div>
1047
+
1048
+ <p class="user-pass2-wrap">
1049
+ <label for="pass2"><?php _e( 'Confirm new password' ); ?></label>
1050
+ <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="new-password" spellcheck="false" />
1051
+ </p>
1052
+
1053
+ <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
1054
+
1055
+ <?php
1056
+
1057
+ /**
1058
+ * Fires following the 'Strength indicator' meter in the user password reset form.
1059
+ *
1060
+ * @since 3.9.0
1061
+ *
1062
+ * @param WP_User $user User object of the user whose password is being reset.
1063
+ */
1064
+ do_action( 'resetpass_form', $user );
1065
+
1066
+ ?>
1067
+ <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" />
1068
+ <p class="submit reset-pass-submit">
1069
+ <button type="button" class="button wp-generate-pw hide-if-no-js skip-aria-expanded"><?php _e( 'Generate Password' ); ?></button>
1070
+ <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" />
1071
+ </p>
1072
+ </form>
1073
+
1074
+ <p id="nav">
1075
+ <a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
1076
+ <?php
1077
+
1078
+ if ( get_option( 'users_can_register' ) ) {
1079
+ $registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
1080
+
1081
+ echo esc_html( $login_link_separator );
1082
+
1083
+ /** This filter is documented in wp-includes/general-template.php */
1084
+ echo apply_filters( 'register', $registration_url );
1085
+ }
1086
+
1087
+ ?>
1088
+ </p>
1089
+ <?php
1090
+
1091
+ login_footer( 'pass1' );
1092
+ break;
1093
+
1094
+ case 'register':
1095
+ if ( is_multisite() ) {
1096
+ /**
1097
+ * Filters the Multisite sign up URL.
1098
+ *
1099
+ * @since 3.0.0
1100
+ *
1101
+ * @param string $sign_up_url The sign up URL.
1102
+ */
1103
+ wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) );
1104
+ exit;
1105
+ }
1106
+
1107
+ if ( ! get_option( 'users_can_register' ) ) {
1108
+ wp_redirect( site_url( 'wp-login.php?registration=disabled' ) );
1109
+ exit;
1110
+ }
1111
+
1112
+ $user_login = '';
1113
+ $user_email = '';
1114
+
1115
+ if ( $http_post ) {
1116
+ if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) {
1117
+ $user_login = wp_unslash( $_POST['user_login'] );
1118
+ }
1119
+
1120
+ if ( isset( $_POST['user_email'] ) && is_string( $_POST['user_email'] ) ) {
1121
+ $user_email = wp_unslash( $_POST['user_email'] );
1122
+ }
1123
+
1124
+ $errors = register_new_user( $user_login, $user_email );
1125
+
1126
+ if ( ! is_wp_error( $errors ) ) {
1127
+ $redirect_to = ! empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
1128
+ wp_safe_redirect( $redirect_to );
1129
+ exit;
1130
+ }
1131
+ }
1132
+
1133
+ $registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
1134
+
1135
+ /**
1136
+ * Filters the registration redirect URL.
1137
+ *
1138
+ * @since 3.0.0
1139
+ * @since 5.9.0 Added the `$errors` parameter.
1140
+ *
1141
+ * @param string $registration_redirect The redirect destination URL.
1142
+ * @param int|WP_Error $errors User id if registration was successful,
1143
+ * WP_Error object otherwise.
1144
+ */
1145
+ $redirect_to = apply_filters( 'registration_redirect', $registration_redirect, $errors );
1146
+
1147
+ login_header(
1148
+ __( 'Registration Form' ),
1149
+ wp_get_admin_notice(
1150
+ __( 'Register For This Site' ),
1151
+ array(
1152
+ 'type' => 'info',
1153
+ 'additional_classes' => array( 'message', 'register' ),
1154
+ )
1155
+ ),
1156
+ $errors
1157
+ );
1158
+
1159
+ ?>
1160
+ <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate">
1161
+ <p>
1162
+ <label for="user_login"><?php _e( 'Username' ); ?></label>
1163
+ <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" />
1164
+ </p>
1165
+ <p>
1166
+ <label for="user_email"><?php _e( 'Email' ); ?></label>
1167
+ <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" autocomplete="email" required="required" />
1168
+ </p>
1169
+ <?php
1170
+
1171
+ /**
1172
+ * Fires following the 'Email' field in the user registration form.
1173
+ *
1174
+ * @since 2.1.0
1175
+ */
1176
+ do_action( 'register_form' );
1177
+
1178
+ ?>
1179
+ <p id="reg_passmail">
1180
+ <?php _e( 'Registration confirmation will be emailed to you.' ); ?>
1181
+ </p>
1182
+ <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
1183
+ <p class="submit">
1184
+ <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" />
1185
+ </p>
1186
+ </form>
1187
+
1188
+ <p id="nav">
1189
+ <a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
1190
+ <?php
1191
+
1192
+ echo esc_html( $login_link_separator );
1193
+
1194
+ $html_link = sprintf( '<a class="wp-login-lost-password" href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) );
1195
+
1196
+ /** This filter is documented in wp-login.php */
1197
+ echo apply_filters( 'lost_password_html_link', $html_link );
1198
+
1199
+ ?>
1200
+ </p>
1201
+ <?php
1202
+
1203
+ login_footer( 'user_login' );
1204
+ break;
1205
+
1206
+ case 'checkemail':
1207
+ $redirect_to = admin_url();
1208
+ $errors = new WP_Error();
1209
+
1210
+ if ( 'confirm' === $_GET['checkemail'] ) {
1211
+ $errors->add(
1212
+ 'confirm',
1213
+ sprintf(
1214
+ /* translators: %s: Link to the login page. */
1215
+ __( 'Check your email for the confirmation link, then visit the <a href="%s">login page</a>.' ),
1216
+ wp_login_url()
1217
+ ),
1218
+ 'message'
1219
+ );
1220
+ } elseif ( 'registered' === $_GET['checkemail'] ) {
1221
+ $errors->add(
1222
+ 'registered',
1223
+ sprintf(
1224
+ /* translators: %s: Link to the login page. */
1225
+ __( 'Registration complete. Please check your email, then visit the <a href="%s">login page</a>.' ),
1226
+ wp_login_url()
1227
+ ),
1228
+ 'message'
1229
+ );
1230
+ }
1231
+
1232
+ /** This action is documented in wp-login.php */
1233
+ $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
1234
+
1235
+ login_header( __( 'Check your email' ), '', $errors );
1236
+ login_footer();
1237
+ break;
1238
+
1239
+ case 'confirmaction':
1240
+ if ( ! isset( $_GET['request_id'] ) ) {
1241
+ wp_die( __( 'Missing request ID.' ) );
1242
+ }
1243
+
1244
+ if ( ! isset( $_GET['confirm_key'] ) ) {
1245
+ wp_die( __( 'Missing confirm key.' ) );
1246
+ }
1247
+
1248
+ $request_id = (int) $_GET['request_id'];
1249
+ $key = sanitize_text_field( wp_unslash( $_GET['confirm_key'] ) );
1250
+ $result = wp_validate_user_request_key( $request_id, $key );
1251
+
1252
+ if ( is_wp_error( $result ) ) {
1253
+ wp_die( $result );
1254
+ }
1255
+
1256
+ /**
1257
+ * Fires an action hook when the account action has been confirmed by the user.
1258
+ *
1259
+ * Using this you can assume the user has agreed to perform the action by
1260
+ * clicking on the link in the confirmation email.
1261
+ *
1262
+ * After firing this action hook the page will redirect to wp-login a callback
1263
+ * redirects or exits first.
1264
+ *
1265
+ * @since 4.9.6
1266
+ *
1267
+ * @param int $request_id Request ID.
1268
+ */
1269
+ do_action( 'user_request_action_confirmed', $request_id );
1270
+
1271
+ $message = _wp_privacy_account_request_confirmed_message( $request_id );
1272
+
1273
+ login_header( __( 'User action confirmed.' ), $message );
1274
+ login_footer();
1275
+ exit;
1276
+
1277
+ case 'login':
1278
+ default:
1279
+ $secure_cookie = '';
1280
+ $customize_login = isset( $_REQUEST['customize-login'] );
1281
+
1282
+ if ( $customize_login ) {
1283
+ wp_enqueue_script( 'customize-base' );
1284
+ }
1285
+
1286
+ // If the user wants SSL but the session is not SSL, force a secure cookie.
1287
+ if ( ! empty( $_POST['log'] ) && ! force_ssl_admin() ) {
1288
+ $user_name = sanitize_user( wp_unslash( $_POST['log'] ) );
1289
+ $user = get_user_by( 'login', $user_name );
1290
+
1291
+ if ( ! $user && strpos( $user_name, '@' ) ) {
1292
+ $user = get_user_by( 'email', $user_name );
1293
+ }
1294
+
1295
+ if ( $user ) {
1296
+ if ( get_user_option( 'use_ssl', $user->ID ) ) {
1297
+ $secure_cookie = true;
1298
+ force_ssl_admin( true );
1299
+ }
1300
+ }
1301
+ }
1302
+
1303
+ if ( isset( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ) {
1304
+ $redirect_to = $_REQUEST['redirect_to'];
1305
+ // Redirect to HTTPS if user wants SSL.
1306
+ if ( $secure_cookie && str_contains( $redirect_to, 'wp-admin' ) ) {
1307
+ $redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
1308
+ }
1309
+ } else {
1310
+ $redirect_to = admin_url();
1311
+ }
1312
+
1313
+ $reauth = empty( $_REQUEST['reauth'] ) ? false : true;
1314
+
1315
+ $user = wp_signon( array(), $secure_cookie );
1316
+
1317
+ if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
1318
+ if ( headers_sent() ) {
1319
+ $user = new WP_Error(
1320
+ 'test_cookie',
1321
+ sprintf(
1322
+ /* translators: 1: Browser cookie documentation URL, 2: Support forums URL. */
1323
+ __( '<strong>Error:</strong> Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ),
1324
+ __( 'https://developer.wordpress.org/advanced-administration/wordpress/cookies/' ),
1325
+ __( 'https://wordpress.org/support/forums/' )
1326
+ )
1327
+ );
1328
+ } elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
1329
+ // If cookies are disabled, the user can't log in even with a valid username and password.
1330
+ $user = new WP_Error(
1331
+ 'test_cookie',
1332
+ sprintf(
1333
+ /* translators: %s: Browser cookie documentation URL. */
1334
+ __( '<strong>Error:</strong> Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ),
1335
+ __( 'https://developer.wordpress.org/advanced-administration/wordpress/cookies/#enable-cookies-in-your-browser' )
1336
+ )
1337
+ );
1338
+ }
1339
+ }
1340
+
1341
+ $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
1342
+
1343
+ /**
1344
+ * Filters the login redirect URL.
1345
+ *
1346
+ * @since 3.0.0
1347
+ *
1348
+ * @param string $redirect_to The redirect destination URL.
1349
+ * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.
1350
+ * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
1351
+ */
1352
+ $redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
1353
+
1354
+ if ( ! is_wp_error( $user ) && ! $reauth ) {
1355
+ if ( $interim_login ) {
1356
+ $message = '<p class="message">' . __( 'You have logged in successfully.' ) . '</p>';
1357
+ $interim_login = 'success';
1358
+ login_header( '', $message );
1359
+
1360
+ ?>
1361
+ </div>
1362
+ <?php
1363
+
1364
+ /** This action is documented in wp-login.php */
1365
+ do_action( 'login_footer' );
1366
+
1367
+ if ( $customize_login ) {
1368
+ ob_start();
1369
+ ?>
1370
+ <script>setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script>
1371
+ <?php
1372
+ wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
1373
+ }
1374
+
1375
+ ?>
1376
+ </body></html>
1377
+ <?php
1378
+
1379
+ exit;
1380
+ }
1381
+
1382
+ // Check if it is time to add a redirect to the admin email confirmation screen.
1383
+ if ( $user instanceof WP_User && $user->exists() && $user->has_cap( 'manage_options' ) ) {
1384
+ $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' );
1385
+
1386
+ /*
1387
+ * If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected
1388
+ * to the admin email confirmation screen.
1389
+ */
1390
+ /** This filter is documented in wp-login.php */
1391
+ $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS );
1392
+
1393
+ if ( $admin_email_check_interval > 0 && time() > $admin_email_lifespan ) {
1394
+ $redirect_to = add_query_arg(
1395
+ array(
1396
+ 'action' => 'confirm_admin_email',
1397
+ 'wp_lang' => get_user_locale( $user ),
1398
+ ),
1399
+ wp_login_url( $redirect_to )
1400
+ );
1401
+ }
1402
+ }
1403
+
1404
+ if ( ( empty( $redirect_to ) || 'wp-admin/' === $redirect_to || admin_url() === $redirect_to ) ) {
1405
+ // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
1406
+ if ( is_multisite() && ! get_active_blog_for_user( $user->ID ) && ! is_super_admin( $user->ID ) ) {
1407
+ $redirect_to = user_admin_url();
1408
+ } elseif ( is_multisite() && ! $user->has_cap( 'read' ) ) {
1409
+ $redirect_to = get_dashboard_url( $user->ID );
1410
+ } elseif ( ! $user->has_cap( 'edit_posts' ) ) {
1411
+ $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url();
1412
+ }
1413
+
1414
+ wp_redirect( $redirect_to );
1415
+ exit;
1416
+ }
1417
+
1418
+ wp_safe_redirect( $redirect_to );
1419
+ exit;
1420
+ }
1421
+
1422
+ $errors = $user;
1423
+ // Clear errors if loggedout is set.
1424
+ if ( ! empty( $_GET['loggedout'] ) || $reauth ) {
1425
+ $errors = new WP_Error();
1426
+ }
1427
+
1428
+ if ( empty( $_POST ) && $errors->get_error_codes() === array( 'empty_username', 'empty_password' ) ) {
1429
+ $errors = new WP_Error( '', '' );
1430
+ }
1431
+
1432
+ if ( $interim_login ) {
1433
+ if ( ! $errors->has_errors() ) {
1434
+ $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' );
1435
+ }
1436
+ } else {
1437
+ // Some parts of this script use the main login form to display a message.
1438
+ if ( isset( $_GET['loggedout'] ) && $_GET['loggedout'] ) {
1439
+ $errors->add( 'loggedout', __( 'You are now logged out.' ), 'message' );
1440
+ } elseif ( isset( $_GET['registration'] ) && 'disabled' === $_GET['registration'] ) {
1441
+ $errors->add( 'registerdisabled', __( '<strong>Error:</strong> User registration is currently not allowed.' ) );
1442
+ } elseif ( str_contains( $redirect_to, 'about.php?updated' ) ) {
1443
+ $errors->add( 'updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.' ), 'message' );
1444
+ } elseif ( WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED === $action ) {
1445
+ $errors->add( 'enter_recovery_mode', __( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' );
1446
+ } elseif ( isset( $_GET['redirect_to'] ) && is_string( $_GET['redirect_to'] )
1447
+ && str_contains( $_GET['redirect_to'], 'wp-admin/authorize-application.php' )
1448
+ ) {
1449
+ $query_component = wp_parse_url( $_GET['redirect_to'], PHP_URL_QUERY );
1450
+ $query = array();
1451
+ if ( $query_component ) {
1452
+ parse_str( $query_component, $query );
1453
+ }
1454
+
1455
+ if ( ! empty( $query['app_name'] ) ) {
1456
+ /* translators: 1: Website name, 2: Application name. */
1457
+ $message = sprintf( 'Please log in to %1$s to authorize %2$s to connect to your account.', get_bloginfo( 'name', 'display' ), '<strong>' . esc_html( $query['app_name'] ) . '</strong>' );
1458
+ } else {
1459
+ /* translators: %s: Website name. */
1460
+ $message = sprintf( 'Please log in to %s to proceed with authorization.', get_bloginfo( 'name', 'display' ) );
1461
+ }
1462
+
1463
+ $errors->add( 'authorize_application', $message, 'message' );
1464
+ }
1465
+ }
1466
+
1467
+ /**
1468
+ * Filters the login page errors.
1469
+ *
1470
+ * @since 3.6.0
1471
+ *
1472
+ * @param WP_Error $errors WP Error object.
1473
+ * @param string $redirect_to Redirect destination URL.
1474
+ */
1475
+ $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
1476
+
1477
+ // Clear any stale cookies.
1478
+ if ( $reauth ) {
1479
+ wp_clear_auth_cookie();
1480
+ }
1481
+
1482
+ login_header( __( 'Log In' ), '', $errors );
1483
+
1484
+ if ( isset( $_POST['log'] ) ) {
1485
+ $user_login = ( 'incorrect_password' === $errors->get_error_code() || 'empty_password' === $errors->get_error_code() ) ? esc_attr( wp_unslash( $_POST['log'] ) ) : '';
1486
+ }
1487
+
1488
+ $rememberme = ! empty( $_POST['rememberme'] );
1489
+
1490
+ $aria_describedby = '';
1491
+ $has_errors = $errors->has_errors();
1492
+
1493
+ if ( $has_errors ) {
1494
+ $aria_describedby = ' aria-describedby="login_error"';
1495
+ }
1496
+
1497
+ if ( $has_errors && 'message' === $errors->get_error_data() ) {
1498
+ $aria_describedby = ' aria-describedby="login-message"';
1499
+ }
1500
+
1501
+ wp_enqueue_script( 'user-profile' );
1502
+ ?>
1503
+
1504
+ <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
1505
+ <p>
1506
+ <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label>
1507
+ <input type="text" name="log" id="user_login"<?php echo $aria_describedby; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" />
1508
+ </p>
1509
+
1510
+ <div class="user-pass-wrap">
1511
+ <label for="user_pass"><?php _e( 'Password' ); ?></label>
1512
+ <div class="wp-pwd">
1513
+ <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby; ?> class="input password-input" value="" size="20" autocomplete="current-password" spellcheck="false" required="required" />
1514
+ <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Show password' ); ?>">
1515
+ <span class="dashicons dashicons-visibility" aria-hidden="true"></span>
1516
+ </button>
1517
+ </div>
1518
+ </div>
1519
+ <?php
1520
+
1521
+ /**
1522
+ * Fires following the 'Password' field in the login form.
1523
+ *
1524
+ * @since 2.1.0
1525
+ */
1526
+ do_action( 'login_form' );
1527
+
1528
+ ?>
1529
+ <p class="forgetmenot"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <label for="rememberme"><?php esc_html_e( 'Remember Me' ); ?></label></p>
1530
+ <p class="submit">
1531
+ <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In' ); ?>" />
1532
+ <?php
1533
+
1534
+ if ( $interim_login ) {
1535
+ ?>
1536
+ <input type="hidden" name="interim-login" value="1" />
1537
+ <?php
1538
+ } else {
1539
+ ?>
1540
+ <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
1541
+ <?php
1542
+ }
1543
+
1544
+ if ( $customize_login ) {
1545
+ ?>
1546
+ <input type="hidden" name="customize-login" value="1" />
1547
+ <?php
1548
+ }
1549
+
1550
+ ?>
1551
+ <input type="hidden" name="testcookie" value="1" />
1552
+ </p>
1553
+ </form>
1554
+
1555
+ <?php
1556
+
1557
+ if ( ! $interim_login ) {
1558
+ ?>
1559
+ <p id="nav">
1560
+ <?php
1561
+
1562
+ if ( get_option( 'users_can_register' ) ) {
1563
+ $registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
1564
+
1565
+ /** This filter is documented in wp-includes/general-template.php */
1566
+ echo apply_filters( 'register', $registration_url );
1567
+
1568
+ echo esc_html( $login_link_separator );
1569
+ }
1570
+
1571
+ $html_link = sprintf( '<a class="wp-login-lost-password" href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) );
1572
+
1573
+ /**
1574
+ * Filters the link that allows the user to reset the lost password.
1575
+ *
1576
+ * @since 6.1.0
1577
+ *
1578
+ * @param string $html_link HTML link to the lost password form.
1579
+ */
1580
+ echo apply_filters( 'lost_password_html_link', $html_link );
1581
+
1582
+ ?>
1583
+ </p>
1584
+ <?php
1585
+ }
1586
+
1587
+ $login_script = 'function wp_attempt_focus() {';
1588
+ $login_script .= 'setTimeout( function() {';
1589
+ $login_script .= 'try {';
1590
+
1591
+ if ( $user_login ) {
1592
+ $login_script .= 'd = document.getElementById( "user_pass" ); d.value = "";';
1593
+ } else {
1594
+ $login_script .= 'd = document.getElementById( "user_login" );';
1595
+
1596
+ if ( $errors->get_error_code() === 'invalid_username' ) {
1597
+ $login_script .= 'd.value = "";';
1598
+ }
1599
+ }
1600
+
1601
+ $login_script .= 'd.focus(); d.select();';
1602
+ $login_script .= '} catch( er ) {}';
1603
+ $login_script .= '}, 200);';
1604
+ $login_script .= "}\n"; // End of wp_attempt_focus().
1605
+
1606
+ /**
1607
+ * Filters whether to print the call to `wp_attempt_focus()` on the login screen.
1608
+ *
1609
+ * @since 4.8.0
1610
+ *
1611
+ * @param bool $print Whether to print the function call. Default true.
1612
+ */
1613
+ if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) {
1614
+ $login_script .= "wp_attempt_focus();\n";
1615
+ }
1616
+
1617
+ // Run `wpOnload()` if defined.
1618
+ $login_script .= "if ( typeof wpOnload === 'function' ) { wpOnload() }";
1619
+
1620
+ wp_print_inline_script_tag( $login_script );
1621
+
1622
+ if ( $interim_login ) {
1623
+ ob_start();
1624
+ ?>
1625
+ <script>
1626
+ ( function() {
1627
+ try {
1628
+ var i, links = document.getElementsByTagName( 'a' );
1629
+ for ( i in links ) {
1630
+ if ( links[i].href ) {
1631
+ links[i].target = '_blank';
1632
+ links[i].rel = 'noopener';
1633
+ }
1634
+ }
1635
+ } catch( er ) {}
1636
+ }());
1637
+ </script>
1638
+ <?php
1639
+ wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
1640
+ }
1641
+
1642
+ login_footer();
1643
+ break;
1644
+ } // End action switch.
wp-mail.php ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Gets the email message from the user's mailbox to add as
4
+ * a WordPress post. Mailbox connection information must be
5
+ * configured under Settings > Writing
6
+ *
7
+ * @package WordPress
8
+ */
9
+
10
+ /** Make sure that the WordPress bootstrap has run before continuing. */
11
+ require __DIR__ . '/wp-load.php';
12
+
13
+ /** This filter is documented in wp-admin/options.php */
14
+ if ( ! apply_filters( 'enable_post_by_email_configuration', true ) ) {
15
+ wp_die( __( 'This action has been disabled by the administrator.' ), 403 );
16
+ }
17
+
18
+ $mailserver_url = get_option( 'mailserver_url' );
19
+
20
+ if ( 'mail.example.com' === $mailserver_url || empty( $mailserver_url ) ) {
21
+ wp_die( __( 'This action has been disabled by the administrator.' ), 403 );
22
+ }
23
+
24
+ /**
25
+ * Fires to allow a plugin to do a complete takeover of Post by Email.
26
+ *
27
+ * @since 2.9.0
28
+ */
29
+ do_action( 'wp-mail.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
30
+
31
+ /** Get the POP3 class with which to access the mailbox. */
32
+ require_once ABSPATH . WPINC . '/class-pop3.php';
33
+
34
+ /** Only check at this interval for new messages. */
35
+ if ( ! defined( 'WP_MAIL_INTERVAL' ) ) {
36
+ define( 'WP_MAIL_INTERVAL', 5 * MINUTE_IN_SECONDS );
37
+ }
38
+
39
+ $last_checked = get_transient( 'mailserver_last_checked' );
40
+
41
+ if ( $last_checked ) {
42
+ wp_die( __( 'Slow down cowboy, no need to check for new mails so often!' ) );
43
+ }
44
+
45
+ set_transient( 'mailserver_last_checked', true, WP_MAIL_INTERVAL );
46
+
47
+ $time_difference = get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
48
+
49
+ $phone_delim = '::';
50
+
51
+ $pop3 = new POP3();
52
+
53
+ if ( ! $pop3->connect( get_option( 'mailserver_url' ), get_option( 'mailserver_port' ) ) || ! $pop3->user( get_option( 'mailserver_login' ) ) ) {
54
+ wp_die( esc_html( $pop3->ERROR ) );
55
+ }
56
+
57
+ $count = $pop3->pass( get_option( 'mailserver_pass' ) );
58
+
59
+ if ( false === $count ) {
60
+ wp_die( esc_html( $pop3->ERROR ) );
61
+ }
62
+
63
+ if ( 0 === $count ) {
64
+ $pop3->quit();
65
+ wp_die( __( 'There does not seem to be any new mail.' ) );
66
+ }
67
+
68
+ // Always run as an unauthenticated user.
69
+ wp_set_current_user( 0 );
70
+
71
+ for ( $i = 1; $i <= $count; $i++ ) {
72
+
73
+ $message = $pop3->get( $i );
74
+
75
+ $bodysignal = false;
76
+ $boundary = '';
77
+ $charset = '';
78
+ $content = '';
79
+ $content_type = '';
80
+ $content_transfer_encoding = '';
81
+ $post_author = 1;
82
+ $author_found = false;
83
+ $post_date = null;
84
+ $post_date_gmt = null;
85
+
86
+ foreach ( $message as $line ) {
87
+ // Body signal.
88
+ if ( strlen( $line ) < 3 ) {
89
+ $bodysignal = true;
90
+ }
91
+ if ( $bodysignal ) {
92
+ $content .= $line;
93
+ } else {
94
+ if ( preg_match( '/Content-Type: /i', $line ) ) {
95
+ $content_type = trim( $line );
96
+ $content_type = substr( $content_type, 14, strlen( $content_type ) - 14 );
97
+ $content_type = explode( ';', $content_type );
98
+ if ( ! empty( $content_type[1] ) ) {
99
+ $charset = explode( '=', $content_type[1] );
100
+ $charset = ( ! empty( $charset[1] ) ) ? trim( $charset[1] ) : '';
101
+ }
102
+ $content_type = $content_type[0];
103
+ }
104
+ if ( preg_match( '/Content-Transfer-Encoding: /i', $line ) ) {
105
+ $content_transfer_encoding = trim( $line );
106
+ $content_transfer_encoding = substr( $content_transfer_encoding, 27, strlen( $content_transfer_encoding ) - 27 );
107
+ $content_transfer_encoding = explode( ';', $content_transfer_encoding );
108
+ $content_transfer_encoding = $content_transfer_encoding[0];
109
+ }
110
+ if ( 'multipart/alternative' === $content_type && str_contains( $line, 'boundary="' ) && '' === $boundary ) {
111
+ $boundary = trim( $line );
112
+ $boundary = explode( '"', $boundary );
113
+ $boundary = $boundary[1];
114
+ }
115
+ if ( preg_match( '/Subject: /i', $line ) ) {
116
+ $subject = trim( $line );
117
+ $subject = substr( $subject, 9, strlen( $subject ) - 9 );
118
+ // Captures any text in the subject before $phone_delim as the subject.
119
+ if ( function_exists( 'iconv_mime_decode' ) ) {
120
+ $subject = iconv_mime_decode( $subject, 2, get_option( 'blog_charset' ) );
121
+ } else {
122
+ $subject = wp_iso_descrambler( $subject );
123
+ }
124
+ $subject = explode( $phone_delim, $subject );
125
+ $subject = $subject[0];
126
+ }
127
+
128
+ /*
129
+ * Set the author using the email address (From or Reply-To, the last used)
130
+ * otherwise use the site admin.
131
+ */
132
+ if ( ! $author_found && preg_match( '/^(From|Reply-To): /', $line ) ) {
133
+ if ( preg_match( '|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches ) ) {
134
+ $author = $matches[0];
135
+ } else {
136
+ $author = trim( $line );
137
+ }
138
+ $author = sanitize_email( $author );
139
+ if ( is_email( $author ) ) {
140
+ $userdata = get_user_by( 'email', $author );
141
+ if ( ! empty( $userdata ) ) {
142
+ $post_author = $userdata->ID;
143
+ $author_found = true;
144
+ }
145
+ }
146
+ }
147
+
148
+ if ( preg_match( '/Date: /i', $line ) ) { // Of the form '20 Mar 2002 20:32:37 +0100'.
149
+ $ddate = str_replace( 'Date: ', '', trim( $line ) );
150
+ // Remove parenthesized timezone string if it exists, as this confuses strtotime().
151
+ $ddate = preg_replace( '!\s*\(.+\)\s*$!', '', $ddate );
152
+ $ddate_timestamp = strtotime( $ddate );
153
+ $post_date = gmdate( 'Y-m-d H:i:s', $ddate_timestamp + $time_difference );
154
+ $post_date_gmt = gmdate( 'Y-m-d H:i:s', $ddate_timestamp );
155
+ }
156
+ }
157
+ }
158
+
159
+ // Set $post_status based on $author_found and on author's publish_posts capability.
160
+ if ( $author_found ) {
161
+ $user = new WP_User( $post_author );
162
+ $post_status = ( $user->has_cap( 'publish_posts' ) ) ? 'publish' : 'pending';
163
+ } else {
164
+ // Author not found in DB, set status to pending. Author already set to admin.
165
+ $post_status = 'pending';
166
+ }
167
+
168
+ $subject = trim( $subject );
169
+
170
+ if ( 'multipart/alternative' === $content_type ) {
171
+ $content = explode( '--' . $boundary, $content );
172
+ $content = $content[2];
173
+
174
+ // Match case-insensitive Content-Transfer-Encoding.
175
+ if ( preg_match( '/Content-Transfer-Encoding: quoted-printable/i', $content, $delim ) ) {
176
+ $content = explode( $delim[0], $content );
177
+ $content = $content[1];
178
+ }
179
+ $content = strip_tags( $content, '<img><p><br><i><b><u><em><strong><strike><font><span><div>' );
180
+ }
181
+ $content = trim( $content );
182
+
183
+ /**
184
+ * Filters the original content of the email.
185
+ *
186
+ * Give Post-By-Email extending plugins full access to the content, either
187
+ * the raw content, or the content of the last quoted-printable section.
188
+ *
189
+ * @since 2.8.0
190
+ *
191
+ * @param string $content The original email content.
192
+ */
193
+ $content = apply_filters( 'wp_mail_original_content', $content );
194
+
195
+ if ( false !== stripos( $content_transfer_encoding, 'quoted-printable' ) ) {
196
+ $content = quoted_printable_decode( $content );
197
+ }
198
+
199
+ if ( function_exists( 'iconv' ) && ! empty( $charset ) ) {
200
+ $content = iconv( $charset, get_option( 'blog_charset' ), $content );
201
+ }
202
+
203
+ // Captures any text in the body after $phone_delim as the body.
204
+ $content = explode( $phone_delim, $content );
205
+ $content = empty( $content[1] ) ? $content[0] : $content[1];
206
+
207
+ $content = trim( $content );
208
+
209
+ /**
210
+ * Filters the content of the post submitted by email before saving.
211
+ *
212
+ * @since 1.2.0
213
+ *
214
+ * @param string $content The email content.
215
+ */
216
+ $post_content = apply_filters( 'phone_content', $content );
217
+
218
+ $post_title = xmlrpc_getposttitle( $content );
219
+
220
+ if ( '' === trim( $post_title ) ) {
221
+ $post_title = $subject;
222
+ }
223
+
224
+ $post_category = array( get_option( 'default_email_category' ) );
225
+
226
+ $post_data = compact( 'post_content', 'post_title', 'post_date', 'post_date_gmt', 'post_author', 'post_category', 'post_status' );
227
+ $post_data = wp_slash( $post_data );
228
+
229
+ $post_ID = wp_insert_post( $post_data );
230
+ if ( is_wp_error( $post_ID ) ) {
231
+ echo "\n" . $post_ID->get_error_message();
232
+ }
233
+
234
+ // The post wasn't inserted or updated, for whatever reason. Better move forward to the next email.
235
+ if ( empty( $post_ID ) ) {
236
+ continue;
237
+ }
238
+
239
+ /**
240
+ * Fires after a post submitted by email is published.
241
+ *
242
+ * @since 1.2.0
243
+ *
244
+ * @param int $post_ID The post ID.
245
+ */
246
+ do_action( 'publish_phone', $post_ID );
247
+
248
+ echo "\n<p><strong>" . __( 'Author:' ) . '</strong> ' . esc_html( $post_author ) . '</p>';
249
+ echo "\n<p><strong>" . __( 'Posted title:' ) . '</strong> ' . esc_html( $post_title ) . '</p>';
250
+
251
+ if ( ! $pop3->delete( $i ) ) {
252
+ echo '<p>' . sprintf(
253
+ /* translators: %s: POP3 error. */
254
+ __( 'Oops: %s' ),
255
+ esc_html( $pop3->ERROR )
256
+ ) . '</p>';
257
+ $pop3->reset();
258
+ exit;
259
+ } else {
260
+ echo '<p>' . sprintf(
261
+ /* translators: %s: The message ID. */
262
+ __( 'Mission complete. Message %s deleted.' ),
263
+ '<strong>' . $i . '</strong>'
264
+ ) . '</p>';
265
+ }
266
+ }
267
+
268
+ $pop3->quit();
wp-settings.php ADDED
@@ -0,0 +1,722 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Used to set up and fix common variables and include
4
+ * the WordPress procedural and class library.
5
+ *
6
+ * Allows for some configuration in wp-config.php (see default-constants.php)
7
+ *
8
+ * @package WordPress
9
+ */
10
+
11
+ /**
12
+ * Stores the location of the WordPress directory of functions, classes, and core content.
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ define( 'WPINC', 'wp-includes' );
17
+
18
+ /**
19
+ * Version information for the current WordPress release.
20
+ *
21
+ * These can't be directly globalized in version.php. When updating,
22
+ * include version.php from another installation and don't override
23
+ * these values if already set.
24
+ *
25
+ * @global string $wp_version The WordPress version string.
26
+ * @global int $wp_db_version WordPress database version.
27
+ * @global string $tinymce_version TinyMCE version.
28
+ * @global string $required_php_version The required PHP version string.
29
+ * @global string $required_mysql_version The required MySQL version string.
30
+ * @global string $wp_local_package Locale code of the package.
31
+ */
32
+ global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version, $wp_local_package;
33
+ require ABSPATH . WPINC . '/version.php';
34
+ require ABSPATH . WPINC . '/compat.php';
35
+ require ABSPATH . WPINC . '/load.php';
36
+
37
+ // Check for the required PHP version and for the MySQL extension or a database drop-in.
38
+ wp_check_php_mysql_versions();
39
+
40
+ // Include files required for initialization.
41
+ require ABSPATH . WPINC . '/class-wp-paused-extensions-storage.php';
42
+ require ABSPATH . WPINC . '/class-wp-fatal-error-handler.php';
43
+ require ABSPATH . WPINC . '/class-wp-recovery-mode-cookie-service.php';
44
+ require ABSPATH . WPINC . '/class-wp-recovery-mode-key-service.php';
45
+ require ABSPATH . WPINC . '/class-wp-recovery-mode-link-service.php';
46
+ require ABSPATH . WPINC . '/class-wp-recovery-mode-email-service.php';
47
+ require ABSPATH . WPINC . '/class-wp-recovery-mode.php';
48
+ require ABSPATH . WPINC . '/error-protection.php';
49
+ require ABSPATH . WPINC . '/default-constants.php';
50
+ require_once ABSPATH . WPINC . '/plugin.php';
51
+
52
+ /**
53
+ * If not already configured, `$blog_id` will default to 1 in a single site
54
+ * configuration. In multisite, it will be overridden by default in ms-settings.php.
55
+ *
56
+ * @since 2.0.0
57
+ *
58
+ * @global int $blog_id
59
+ */
60
+ global $blog_id;
61
+
62
+ // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE.
63
+ wp_initial_constants();
64
+
65
+ // Register the shutdown handler for fatal errors as soon as possible.
66
+ wp_register_fatal_error_handler();
67
+
68
+ // WordPress calculates offsets from UTC.
69
+ // phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
70
+ date_default_timezone_set( 'UTC' );
71
+
72
+ // Standardize $_SERVER variables across setups.
73
+ wp_fix_server_vars();
74
+
75
+ // Check if the site is in maintenance mode.
76
+ wp_maintenance();
77
+
78
+ // Start loading timer.
79
+ timer_start();
80
+
81
+ // Check if WP_DEBUG mode is enabled.
82
+ wp_debug_mode();
83
+
84
+ /**
85
+ * Filters whether to enable loading of the advanced-cache.php drop-in.
86
+ *
87
+ * This filter runs before it can be used by plugins. It is designed for non-web
88
+ * run-times. If false is returned, advanced-cache.php will never be loaded.
89
+ *
90
+ * @since 4.6.0
91
+ *
92
+ * @param bool $enable_advanced_cache Whether to enable loading advanced-cache.php (if present).
93
+ * Default true.
94
+ */
95
+ if ( WP_CACHE && apply_filters( 'enable_loading_advanced_cache_dropin', true ) && file_exists( WP_CONTENT_DIR . '/advanced-cache.php' ) ) {
96
+ // For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
97
+ include WP_CONTENT_DIR . '/advanced-cache.php';
98
+
99
+ // Re-initialize any hooks added manually by advanced-cache.php.
100
+ if ( $wp_filter ) {
101
+ $wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
102
+ }
103
+ }
104
+
105
+ // Define WP_LANG_DIR if not set.
106
+ wp_set_lang_dir();
107
+
108
+ // Load early WordPress files.
109
+ require ABSPATH . WPINC . '/class-wp-list-util.php';
110
+ require ABSPATH . WPINC . '/class-wp-token-map.php';
111
+ require ABSPATH . WPINC . '/formatting.php';
112
+ require ABSPATH . WPINC . '/meta.php';
113
+ require ABSPATH . WPINC . '/functions.php';
114
+ require ABSPATH . WPINC . '/class-wp-meta-query.php';
115
+ require ABSPATH . WPINC . '/class-wp-matchesmapregex.php';
116
+ require ABSPATH . WPINC . '/class-wp.php';
117
+ require ABSPATH . WPINC . '/class-wp-error.php';
118
+ require ABSPATH . WPINC . '/pomo/mo.php';
119
+ require ABSPATH . WPINC . '/l10n/class-wp-translation-controller.php';
120
+ require ABSPATH . WPINC . '/l10n/class-wp-translations.php';
121
+ require ABSPATH . WPINC . '/l10n/class-wp-translation-file.php';
122
+ require ABSPATH . WPINC . '/l10n/class-wp-translation-file-mo.php';
123
+ require ABSPATH . WPINC . '/l10n/class-wp-translation-file-php.php';
124
+
125
+ /**
126
+ * @since 0.71
127
+ *
128
+ * @global wpdb $wpdb WordPress database abstraction object.
129
+ */
130
+ global $wpdb;
131
+ // Include the wpdb class and, if present, a db.php database drop-in.
132
+ require_wp_db();
133
+
134
+ /**
135
+ * @since 3.3.0
136
+ *
137
+ * @global string $table_prefix The database table prefix.
138
+ */
139
+ $GLOBALS['table_prefix'] = $table_prefix;
140
+
141
+ // Set the database table prefix and the format specifiers for database table columns.
142
+ wp_set_wpdb_vars();
143
+
144
+ // Start the WordPress object cache, or an external object cache if the drop-in is present.
145
+ wp_start_object_cache();
146
+
147
+ // Attach the default filters.
148
+ require ABSPATH . WPINC . '/default-filters.php';
149
+
150
+ // Initialize multisite if enabled.
151
+ if ( is_multisite() ) {
152
+ require ABSPATH . WPINC . '/class-wp-site-query.php';
153
+ require ABSPATH . WPINC . '/class-wp-network-query.php';
154
+ require ABSPATH . WPINC . '/ms-blogs.php';
155
+ require ABSPATH . WPINC . '/ms-settings.php';
156
+ } elseif ( ! defined( 'MULTISITE' ) ) {
157
+ define( 'MULTISITE', false );
158
+ }
159
+
160
+ register_shutdown_function( 'shutdown_action_hook' );
161
+
162
+ // Stop most of WordPress from being loaded if SHORTINIT is enabled.
163
+ if ( SHORTINIT ) {
164
+ return false;
165
+ }
166
+
167
+ // Load the L10n library.
168
+ require_once ABSPATH . WPINC . '/l10n.php';
169
+ require_once ABSPATH . WPINC . '/class-wp-textdomain-registry.php';
170
+ require_once ABSPATH . WPINC . '/class-wp-locale.php';
171
+ require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
172
+
173
+ // Run the installer if WordPress is not installed.
174
+ wp_not_installed();
175
+
176
+ // Load most of WordPress.
177
+ require ABSPATH . WPINC . '/class-wp-walker.php';
178
+ require ABSPATH . WPINC . '/class-wp-ajax-response.php';
179
+ require ABSPATH . WPINC . '/capabilities.php';
180
+ require ABSPATH . WPINC . '/class-wp-roles.php';
181
+ require ABSPATH . WPINC . '/class-wp-role.php';
182
+ require ABSPATH . WPINC . '/class-wp-user.php';
183
+ require ABSPATH . WPINC . '/class-wp-query.php';
184
+ require ABSPATH . WPINC . '/query.php';
185
+ require ABSPATH . WPINC . '/class-wp-date-query.php';
186
+ require ABSPATH . WPINC . '/theme.php';
187
+ require ABSPATH . WPINC . '/class-wp-theme.php';
188
+ require ABSPATH . WPINC . '/class-wp-theme-json-schema.php';
189
+ require ABSPATH . WPINC . '/class-wp-theme-json-data.php';
190
+ require ABSPATH . WPINC . '/class-wp-theme-json.php';
191
+ require ABSPATH . WPINC . '/class-wp-theme-json-resolver.php';
192
+ require ABSPATH . WPINC . '/class-wp-duotone.php';
193
+ require ABSPATH . WPINC . '/global-styles-and-settings.php';
194
+ require ABSPATH . WPINC . '/class-wp-block-template.php';
195
+ require ABSPATH . WPINC . '/block-template-utils.php';
196
+ require ABSPATH . WPINC . '/block-template.php';
197
+ require ABSPATH . WPINC . '/theme-templates.php';
198
+ require ABSPATH . WPINC . '/theme-previews.php';
199
+ require ABSPATH . WPINC . '/template.php';
200
+ require ABSPATH . WPINC . '/https-detection.php';
201
+ require ABSPATH . WPINC . '/https-migration.php';
202
+ require ABSPATH . WPINC . '/class-wp-user-request.php';
203
+ require ABSPATH . WPINC . '/user.php';
204
+ require ABSPATH . WPINC . '/class-wp-user-query.php';
205
+ require ABSPATH . WPINC . '/class-wp-session-tokens.php';
206
+ require ABSPATH . WPINC . '/class-wp-user-meta-session-tokens.php';
207
+ require ABSPATH . WPINC . '/general-template.php';
208
+ require ABSPATH . WPINC . '/link-template.php';
209
+ require ABSPATH . WPINC . '/author-template.php';
210
+ require ABSPATH . WPINC . '/robots-template.php';
211
+ require ABSPATH . WPINC . '/post.php';
212
+ require ABSPATH . WPINC . '/class-walker-page.php';
213
+ require ABSPATH . WPINC . '/class-walker-page-dropdown.php';
214
+ require ABSPATH . WPINC . '/class-wp-post-type.php';
215
+ require ABSPATH . WPINC . '/class-wp-post.php';
216
+ require ABSPATH . WPINC . '/post-template.php';
217
+ require ABSPATH . WPINC . '/revision.php';
218
+ require ABSPATH . WPINC . '/post-formats.php';
219
+ require ABSPATH . WPINC . '/post-thumbnail-template.php';
220
+ require ABSPATH . WPINC . '/category.php';
221
+ require ABSPATH . WPINC . '/class-walker-category.php';
222
+ require ABSPATH . WPINC . '/class-walker-category-dropdown.php';
223
+ require ABSPATH . WPINC . '/category-template.php';
224
+ require ABSPATH . WPINC . '/comment.php';
225
+ require ABSPATH . WPINC . '/class-wp-comment.php';
226
+ require ABSPATH . WPINC . '/class-wp-comment-query.php';
227
+ require ABSPATH . WPINC . '/class-walker-comment.php';
228
+ require ABSPATH . WPINC . '/comment-template.php';
229
+ require ABSPATH . WPINC . '/rewrite.php';
230
+ require ABSPATH . WPINC . '/class-wp-rewrite.php';
231
+ require ABSPATH . WPINC . '/feed.php';
232
+ require ABSPATH . WPINC . '/bookmark.php';
233
+ require ABSPATH . WPINC . '/bookmark-template.php';
234
+ require ABSPATH . WPINC . '/kses.php';
235
+ require ABSPATH . WPINC . '/cron.php';
236
+ require ABSPATH . WPINC . '/deprecated.php';
237
+ require ABSPATH . WPINC . '/script-loader.php';
238
+ require ABSPATH . WPINC . '/taxonomy.php';
239
+ require ABSPATH . WPINC . '/class-wp-taxonomy.php';
240
+ require ABSPATH . WPINC . '/class-wp-term.php';
241
+ require ABSPATH . WPINC . '/class-wp-term-query.php';
242
+ require ABSPATH . WPINC . '/class-wp-tax-query.php';
243
+ require ABSPATH . WPINC . '/update.php';
244
+ require ABSPATH . WPINC . '/canonical.php';
245
+ require ABSPATH . WPINC . '/shortcodes.php';
246
+ require ABSPATH . WPINC . '/embed.php';
247
+ require ABSPATH . WPINC . '/class-wp-embed.php';
248
+ require ABSPATH . WPINC . '/class-wp-oembed.php';
249
+ require ABSPATH . WPINC . '/class-wp-oembed-controller.php';
250
+ require ABSPATH . WPINC . '/media.php';
251
+ require ABSPATH . WPINC . '/http.php';
252
+ require ABSPATH . WPINC . '/html-api/html5-named-character-references.php';
253
+ require ABSPATH . WPINC . '/html-api/class-wp-html-attribute-token.php';
254
+ require ABSPATH . WPINC . '/html-api/class-wp-html-span.php';
255
+ require ABSPATH . WPINC . '/html-api/class-wp-html-text-replacement.php';
256
+ require ABSPATH . WPINC . '/html-api/class-wp-html-decoder.php';
257
+ require ABSPATH . WPINC . '/html-api/class-wp-html-tag-processor.php';
258
+ require ABSPATH . WPINC . '/html-api/class-wp-html-unsupported-exception.php';
259
+ require ABSPATH . WPINC . '/html-api/class-wp-html-active-formatting-elements.php';
260
+ require ABSPATH . WPINC . '/html-api/class-wp-html-open-elements.php';
261
+ require ABSPATH . WPINC . '/html-api/class-wp-html-token.php';
262
+ require ABSPATH . WPINC . '/html-api/class-wp-html-stack-event.php';
263
+ require ABSPATH . WPINC . '/html-api/class-wp-html-processor-state.php';
264
+ require ABSPATH . WPINC . '/html-api/class-wp-html-processor.php';
265
+ require ABSPATH . WPINC . '/class-wp-http.php';
266
+ require ABSPATH . WPINC . '/class-wp-http-streams.php';
267
+ require ABSPATH . WPINC . '/class-wp-http-curl.php';
268
+ require ABSPATH . WPINC . '/class-wp-http-proxy.php';
269
+ require ABSPATH . WPINC . '/class-wp-http-cookie.php';
270
+ require ABSPATH . WPINC . '/class-wp-http-encoding.php';
271
+ require ABSPATH . WPINC . '/class-wp-http-response.php';
272
+ require ABSPATH . WPINC . '/class-wp-http-requests-response.php';
273
+ require ABSPATH . WPINC . '/class-wp-http-requests-hooks.php';
274
+ require ABSPATH . WPINC . '/widgets.php';
275
+ require ABSPATH . WPINC . '/class-wp-widget.php';
276
+ require ABSPATH . WPINC . '/class-wp-widget-factory.php';
277
+ require ABSPATH . WPINC . '/nav-menu-template.php';
278
+ require ABSPATH . WPINC . '/nav-menu.php';
279
+ require ABSPATH . WPINC . '/admin-bar.php';
280
+ require ABSPATH . WPINC . '/class-wp-application-passwords.php';
281
+ require ABSPATH . WPINC . '/rest-api.php';
282
+ require ABSPATH . WPINC . '/rest-api/class-wp-rest-server.php';
283
+ require ABSPATH . WPINC . '/rest-api/class-wp-rest-response.php';
284
+ require ABSPATH . WPINC . '/rest-api/class-wp-rest-request.php';
285
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-controller.php';
286
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-posts-controller.php';
287
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-attachments-controller.php';
288
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-global-styles-controller.php';
289
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-types-controller.php';
290
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-statuses-controller.php';
291
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-revisions-controller.php';
292
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php';
293
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-template-revisions-controller.php';
294
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-autosaves-controller.php';
295
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-template-autosaves-controller.php';
296
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-taxonomies-controller.php';
297
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-terms-controller.php';
298
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-menu-items-controller.php';
299
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-menus-controller.php';
300
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-menu-locations-controller.php';
301
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-users-controller.php';
302
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-comments-controller.php';
303
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-search-controller.php';
304
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-blocks-controller.php';
305
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-types-controller.php';
306
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-renderer-controller.php';
307
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-settings-controller.php';
308
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-themes-controller.php';
309
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-plugins-controller.php';
310
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-directory-controller.php';
311
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php';
312
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php';
313
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-patterns-controller.php';
314
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php';
315
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-application-passwords-controller.php';
316
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-site-health-controller.php';
317
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-sidebars-controller.php';
318
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-widget-types-controller.php';
319
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-widgets-controller.php';
320
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-templates-controller.php';
321
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-url-details-controller.php';
322
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-navigation-fallback-controller.php';
323
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-font-families-controller.php';
324
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-font-faces-controller.php';
325
+ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-font-collections-controller.php';
326
+ require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-meta-fields.php';
327
+ require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-comment-meta-fields.php';
328
+ require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-post-meta-fields.php';
329
+ require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-term-meta-fields.php';
330
+ require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-user-meta-fields.php';
331
+ require ABSPATH . WPINC . '/rest-api/search/class-wp-rest-search-handler.php';
332
+ require ABSPATH . WPINC . '/rest-api/search/class-wp-rest-post-search-handler.php';
333
+ require ABSPATH . WPINC . '/rest-api/search/class-wp-rest-term-search-handler.php';
334
+ require ABSPATH . WPINC . '/rest-api/search/class-wp-rest-post-format-search-handler.php';
335
+ require ABSPATH . WPINC . '/sitemaps.php';
336
+ require ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps.php';
337
+ require ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-index.php';
338
+ require ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-provider.php';
339
+ require ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-registry.php';
340
+ require ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-renderer.php';
341
+ require ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-stylesheet.php';
342
+ require ABSPATH . WPINC . '/sitemaps/providers/class-wp-sitemaps-posts.php';
343
+ require ABSPATH . WPINC . '/sitemaps/providers/class-wp-sitemaps-taxonomies.php';
344
+ require ABSPATH . WPINC . '/sitemaps/providers/class-wp-sitemaps-users.php';
345
+ require ABSPATH . WPINC . '/class-wp-block-bindings-source.php';
346
+ require ABSPATH . WPINC . '/class-wp-block-bindings-registry.php';
347
+ require ABSPATH . WPINC . '/class-wp-block-editor-context.php';
348
+ require ABSPATH . WPINC . '/class-wp-block-type.php';
349
+ require ABSPATH . WPINC . '/class-wp-block-pattern-categories-registry.php';
350
+ require ABSPATH . WPINC . '/class-wp-block-patterns-registry.php';
351
+ require ABSPATH . WPINC . '/class-wp-block-styles-registry.php';
352
+ require ABSPATH . WPINC . '/class-wp-block-type-registry.php';
353
+ require ABSPATH . WPINC . '/class-wp-block.php';
354
+ require ABSPATH . WPINC . '/class-wp-block-list.php';
355
+ require ABSPATH . WPINC . '/class-wp-block-parser-block.php';
356
+ require ABSPATH . WPINC . '/class-wp-block-parser-frame.php';
357
+ require ABSPATH . WPINC . '/class-wp-block-parser.php';
358
+ require ABSPATH . WPINC . '/class-wp-classic-to-block-menu-converter.php';
359
+ require ABSPATH . WPINC . '/class-wp-navigation-fallback.php';
360
+ require ABSPATH . WPINC . '/block-bindings.php';
361
+ require ABSPATH . WPINC . '/block-bindings/pattern-overrides.php';
362
+ require ABSPATH . WPINC . '/block-bindings/post-meta.php';
363
+ require ABSPATH . WPINC . '/blocks.php';
364
+ require ABSPATH . WPINC . '/blocks/index.php';
365
+ require ABSPATH . WPINC . '/block-editor.php';
366
+ require ABSPATH . WPINC . '/block-patterns.php';
367
+ require ABSPATH . WPINC . '/class-wp-block-supports.php';
368
+ require ABSPATH . WPINC . '/block-supports/utils.php';
369
+ require ABSPATH . WPINC . '/block-supports/align.php';
370
+ require ABSPATH . WPINC . '/block-supports/custom-classname.php';
371
+ require ABSPATH . WPINC . '/block-supports/generated-classname.php';
372
+ require ABSPATH . WPINC . '/block-supports/settings.php';
373
+ require ABSPATH . WPINC . '/block-supports/elements.php';
374
+ require ABSPATH . WPINC . '/block-supports/colors.php';
375
+ require ABSPATH . WPINC . '/block-supports/typography.php';
376
+ require ABSPATH . WPINC . '/block-supports/border.php';
377
+ require ABSPATH . WPINC . '/block-supports/layout.php';
378
+ require ABSPATH . WPINC . '/block-supports/position.php';
379
+ require ABSPATH . WPINC . '/block-supports/spacing.php';
380
+ require ABSPATH . WPINC . '/block-supports/dimensions.php';
381
+ require ABSPATH . WPINC . '/block-supports/duotone.php';
382
+ require ABSPATH . WPINC . '/block-supports/shadow.php';
383
+ require ABSPATH . WPINC . '/block-supports/background.php';
384
+ require ABSPATH . WPINC . '/block-supports/block-style-variations.php';
385
+ require ABSPATH . WPINC . '/style-engine.php';
386
+ require ABSPATH . WPINC . '/style-engine/class-wp-style-engine.php';
387
+ require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-declarations.php';
388
+ require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-rule.php';
389
+ require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-rules-store.php';
390
+ require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-processor.php';
391
+ require ABSPATH . WPINC . '/fonts/class-wp-font-face-resolver.php';
392
+ require ABSPATH . WPINC . '/fonts/class-wp-font-collection.php';
393
+ require ABSPATH . WPINC . '/fonts/class-wp-font-face.php';
394
+ require ABSPATH . WPINC . '/fonts/class-wp-font-library.php';
395
+ require ABSPATH . WPINC . '/fonts/class-wp-font-utils.php';
396
+ require ABSPATH . WPINC . '/fonts.php';
397
+ require ABSPATH . WPINC . '/class-wp-script-modules.php';
398
+ require ABSPATH . WPINC . '/script-modules.php';
399
+ require ABSPATH . WPINC . '/interactivity-api/class-wp-interactivity-api.php';
400
+ require ABSPATH . WPINC . '/interactivity-api/class-wp-interactivity-api-directives-processor.php';
401
+ require ABSPATH . WPINC . '/interactivity-api/interactivity-api.php';
402
+ require ABSPATH . WPINC . '/class-wp-plugin-dependencies.php';
403
+
404
+ add_action( 'after_setup_theme', array( wp_script_modules(), 'add_hooks' ) );
405
+ add_action( 'after_setup_theme', array( wp_interactivity(), 'add_hooks' ) );
406
+
407
+ /**
408
+ * @since 3.3.0
409
+ *
410
+ * @global WP_Embed $wp_embed WordPress Embed object.
411
+ */
412
+ $GLOBALS['wp_embed'] = new WP_Embed();
413
+
414
+ /**
415
+ * WordPress Textdomain Registry object.
416
+ *
417
+ * Used to support just-in-time translations for manually loaded text domains.
418
+ *
419
+ * @since 6.1.0
420
+ *
421
+ * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
422
+ */
423
+ $GLOBALS['wp_textdomain_registry'] = new WP_Textdomain_Registry();
424
+ $GLOBALS['wp_textdomain_registry']->init();
425
+
426
+ // Load multisite-specific files.
427
+ if ( is_multisite() ) {
428
+ require ABSPATH . WPINC . '/ms-functions.php';
429
+ require ABSPATH . WPINC . '/ms-default-filters.php';
430
+ require ABSPATH . WPINC . '/ms-deprecated.php';
431
+ }
432
+
433
+ // Define constants that rely on the API to obtain the default value.
434
+ // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
435
+ wp_plugin_directory_constants();
436
+
437
+ /**
438
+ * @since 3.9.0
439
+ *
440
+ * @global array $wp_plugin_paths
441
+ */
442
+ $GLOBALS['wp_plugin_paths'] = array();
443
+
444
+ // Load must-use plugins.
445
+ foreach ( wp_get_mu_plugins() as $mu_plugin ) {
446
+ $_wp_plugin_file = $mu_plugin;
447
+ include_once $mu_plugin;
448
+ $mu_plugin = $_wp_plugin_file; // Avoid stomping of the $mu_plugin variable in a plugin.
449
+
450
+ /**
451
+ * Fires once a single must-use plugin has loaded.
452
+ *
453
+ * @since 5.1.0
454
+ *
455
+ * @param string $mu_plugin Full path to the plugin's main file.
456
+ */
457
+ do_action( 'mu_plugin_loaded', $mu_plugin );
458
+ }
459
+ unset( $mu_plugin, $_wp_plugin_file );
460
+
461
+ // Load network activated plugins.
462
+ if ( is_multisite() ) {
463
+ foreach ( wp_get_active_network_plugins() as $network_plugin ) {
464
+ wp_register_plugin_realpath( $network_plugin );
465
+
466
+ $_wp_plugin_file = $network_plugin;
467
+ include_once $network_plugin;
468
+ $network_plugin = $_wp_plugin_file; // Avoid stomping of the $network_plugin variable in a plugin.
469
+
470
+ /**
471
+ * Fires once a single network-activated plugin has loaded.
472
+ *
473
+ * @since 5.1.0
474
+ *
475
+ * @param string $network_plugin Full path to the plugin's main file.
476
+ */
477
+ do_action( 'network_plugin_loaded', $network_plugin );
478
+ }
479
+ unset( $network_plugin, $_wp_plugin_file );
480
+ }
481
+
482
+ /**
483
+ * Fires once all must-use and network-activated plugins have loaded.
484
+ *
485
+ * @since 2.8.0
486
+ */
487
+ do_action( 'muplugins_loaded' );
488
+
489
+ if ( is_multisite() ) {
490
+ ms_cookie_constants();
491
+ }
492
+
493
+ // Define constants after multisite is loaded.
494
+ wp_cookie_constants();
495
+
496
+ // Define and enforce our SSL constants.
497
+ wp_ssl_constants();
498
+
499
+ // Create common globals.
500
+ require ABSPATH . WPINC . '/vars.php';
501
+
502
+ // Make taxonomies and posts available to plugins and themes.
503
+ // @plugin authors: warning: these get registered again on the init hook.
504
+ create_initial_taxonomies();
505
+ create_initial_post_types();
506
+
507
+ wp_start_scraping_edited_file_errors();
508
+
509
+ // Register the default theme directory root.
510
+ register_theme_directory( get_theme_root() );
511
+
512
+ if ( ! is_multisite() && wp_is_fatal_error_handler_enabled() ) {
513
+ // Handle users requesting a recovery mode link and initiating recovery mode.
514
+ wp_recovery_mode()->initialize();
515
+ }
516
+
517
+ // Load active plugins.
518
+ foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
519
+ wp_register_plugin_realpath( $plugin );
520
+
521
+ $_wp_plugin_file = $plugin;
522
+ include_once $plugin;
523
+ $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin.
524
+
525
+ /**
526
+ * Fires once a single activated plugin has loaded.
527
+ *
528
+ * @since 5.1.0
529
+ *
530
+ * @param string $plugin Full path to the plugin's main file.
531
+ */
532
+ do_action( 'plugin_loaded', $plugin );
533
+ }
534
+ unset( $plugin, $_wp_plugin_file );
535
+
536
+ // Load pluggable functions.
537
+ require ABSPATH . WPINC . '/pluggable.php';
538
+ require ABSPATH . WPINC . '/pluggable-deprecated.php';
539
+
540
+ // Set internal encoding.
541
+ wp_set_internal_encoding();
542
+
543
+ // Run wp_cache_postload() if object cache is enabled and the function exists.
544
+ if ( WP_CACHE && function_exists( 'wp_cache_postload' ) ) {
545
+ wp_cache_postload();
546
+ }
547
+
548
+ /**
549
+ * Fires once activated plugins have loaded.
550
+ *
551
+ * Pluggable functions are also available at this point in the loading order.
552
+ *
553
+ * @since 1.5.0
554
+ */
555
+ do_action( 'plugins_loaded' );
556
+
557
+ // Define constants which affect functionality if not already defined.
558
+ wp_functionality_constants();
559
+
560
+ // Add magic quotes and set up $_REQUEST ( $_GET + $_POST ).
561
+ wp_magic_quotes();
562
+
563
+ /**
564
+ * Fires when comment cookies are sanitized.
565
+ *
566
+ * @since 2.0.11
567
+ */
568
+ do_action( 'sanitize_comment_cookies' );
569
+
570
+ /**
571
+ * WordPress Query object
572
+ *
573
+ * @since 2.0.0
574
+ *
575
+ * @global WP_Query $wp_the_query WordPress Query object.
576
+ */
577
+ $GLOBALS['wp_the_query'] = new WP_Query();
578
+
579
+ /**
580
+ * Holds the reference to {@see $wp_the_query}.
581
+ * Use this global for WordPress queries
582
+ *
583
+ * @since 1.5.0
584
+ *
585
+ * @global WP_Query $wp_query WordPress Query object.
586
+ */
587
+ $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
588
+
589
+ /**
590
+ * Holds the WordPress Rewrite object for creating pretty URLs
591
+ *
592
+ * @since 1.5.0
593
+ *
594
+ * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
595
+ */
596
+ $GLOBALS['wp_rewrite'] = new WP_Rewrite();
597
+
598
+ /**
599
+ * WordPress Object
600
+ *
601
+ * @since 2.0.0
602
+ *
603
+ * @global WP $wp Current WordPress environment instance.
604
+ */
605
+ $GLOBALS['wp'] = new WP();
606
+
607
+ /**
608
+ * WordPress Widget Factory Object
609
+ *
610
+ * @since 2.8.0
611
+ *
612
+ * @global WP_Widget_Factory $wp_widget_factory
613
+ */
614
+ $GLOBALS['wp_widget_factory'] = new WP_Widget_Factory();
615
+
616
+ /**
617
+ * WordPress User Roles
618
+ *
619
+ * @since 2.0.0
620
+ *
621
+ * @global WP_Roles $wp_roles WordPress role management object.
622
+ */
623
+ $GLOBALS['wp_roles'] = new WP_Roles();
624
+
625
+ /**
626
+ * Fires before the theme is loaded.
627
+ *
628
+ * @since 2.6.0
629
+ */
630
+ do_action( 'setup_theme' );
631
+
632
+ // Define the template related constants and globals.
633
+ wp_templating_constants();
634
+ wp_set_template_globals();
635
+
636
+ // Load the default text localization domain.
637
+ load_default_textdomain();
638
+
639
+ $locale = get_locale();
640
+ $locale_file = WP_LANG_DIR . "/$locale.php";
641
+ if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) ) {
642
+ require $locale_file;
643
+ }
644
+ unset( $locale_file );
645
+
646
+ /**
647
+ * WordPress Locale object for loading locale domain date and various strings.
648
+ *
649
+ * @since 2.1.0
650
+ *
651
+ * @global WP_Locale $wp_locale WordPress date and time locale object.
652
+ */
653
+ $GLOBALS['wp_locale'] = new WP_Locale();
654
+
655
+ /**
656
+ * WordPress Locale Switcher object for switching locales.
657
+ *
658
+ * @since 4.7.0
659
+ *
660
+ * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object.
661
+ */
662
+ $GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher();
663
+ $GLOBALS['wp_locale_switcher']->init();
664
+
665
+ // Load the functions for the active theme, for both parent and child theme if applicable.
666
+ foreach ( wp_get_active_and_valid_themes() as $theme ) {
667
+ if ( file_exists( $theme . '/functions.php' ) ) {
668
+ include $theme . '/functions.php';
669
+ }
670
+ }
671
+ unset( $theme );
672
+
673
+ /**
674
+ * Fires after the theme is loaded.
675
+ *
676
+ * @since 3.0.0
677
+ */
678
+ do_action( 'after_setup_theme' );
679
+
680
+ // Create an instance of WP_Site_Health so that Cron events may fire.
681
+ if ( ! class_exists( 'WP_Site_Health' ) ) {
682
+ require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
683
+ }
684
+ WP_Site_Health::get_instance();
685
+
686
+ // Set up current user.
687
+ $GLOBALS['wp']->init();
688
+
689
+ /**
690
+ * Fires after WordPress has finished loading but before any headers are sent.
691
+ *
692
+ * Most of WP is loaded at this stage, and the user is authenticated. WP continues
693
+ * to load on the {@see 'init'} hook that follows (e.g. widgets), and many plugins instantiate
694
+ * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.).
695
+ *
696
+ * If you wish to plug an action once WP is loaded, use the {@see 'wp_loaded'} hook below.
697
+ *
698
+ * @since 1.5.0
699
+ */
700
+ do_action( 'init' );
701
+
702
+ // Check site status.
703
+ if ( is_multisite() ) {
704
+ $file = ms_site_check();
705
+ if ( true !== $file ) {
706
+ require $file;
707
+ die();
708
+ }
709
+ unset( $file );
710
+ }
711
+
712
+ /**
713
+ * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
714
+ *
715
+ * Ajax requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for
716
+ * users not logged in.
717
+ *
718
+ * @link https://developer.wordpress.org/plugins/javascript/ajax
719
+ *
720
+ * @since 3.0.0
721
+ */
722
+ do_action( 'wp_loaded' );
wp-signup.php ADDED
@@ -0,0 +1,1046 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** Sets up the WordPress Environment. */
4
+ require __DIR__ . '/wp-load.php';
5
+
6
+ add_filter( 'wp_robots', 'wp_robots_no_robots' );
7
+
8
+ require __DIR__ . '/wp-blog-header.php';
9
+
10
+ nocache_headers();
11
+
12
+ if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ), true ) ) {
13
+ wp_redirect( network_home_url() );
14
+ die();
15
+ }
16
+
17
+ /**
18
+ * Prints signup_header via wp_head.
19
+ *
20
+ * @since MU (3.0.0)
21
+ */
22
+ function do_signup_header() {
23
+ /**
24
+ * Fires within the head section of the site sign-up screen.
25
+ *
26
+ * @since 3.0.0
27
+ */
28
+ do_action( 'signup_header' );
29
+ }
30
+ add_action( 'wp_head', 'do_signup_header' );
31
+
32
+ if ( ! is_multisite() ) {
33
+ wp_redirect( wp_registration_url() );
34
+ die();
35
+ }
36
+
37
+ if ( ! is_main_site() ) {
38
+ wp_redirect( network_site_url( 'wp-signup.php' ) );
39
+ die();
40
+ }
41
+
42
+ // Fix for page title.
43
+ $wp_query->is_404 = false;
44
+
45
+ /**
46
+ * Fires before the Site Sign-up page is loaded.
47
+ *
48
+ * @since 4.4.0
49
+ */
50
+ do_action( 'before_signup_header' );
51
+
52
+ /**
53
+ * Prints styles for front-end Multisite Sign-up pages.
54
+ *
55
+ * @since MU (3.0.0)
56
+ */
57
+ function wpmu_signup_stylesheet() {
58
+ ?>
59
+ <style type="text/css">
60
+ .mu_register { width: 90%; margin: 0 auto; }
61
+ .mu_register form { margin-top: 2em; }
62
+ .mu_register fieldset,
63
+ .mu_register legend { margin: 0; padding: 0; border: none; }
64
+ .mu_register .error { font-weight: 600; padding: 10px; color: #333; background: #ffebe8; border: 1px solid #c00; }
65
+ .mu_register input[type="submit"],
66
+ .mu_register #blog_title,
67
+ .mu_register #user_email,
68
+ .mu_register #blogname,
69
+ .mu_register #user_name { width: 100%; font-size: 24px; margin: 5px 0; box-sizing: border-box; }
70
+ .mu_register #site-language { display: block; }
71
+ .mu_register .prefix_address,
72
+ .mu_register .suffix_address { font-size: 18px; display: inline-block; direction: ltr; }
73
+ .mu_register label,
74
+ .mu_register legend,
75
+ .mu_register .label-heading { font-weight: 600; font-size: 15px; display: block; margin: 10px 0; }
76
+ .mu_register legend + p,
77
+ .mu_register input + p { margin-top: 0; }
78
+ .mu_register label.checkbox { display: inline; }
79
+ .mu_register .mu_alert { font-weight: 600; padding: 10px; color: #333; background: #ffffe0; border: 1px solid #e6db55; }
80
+ .mu_register .mu_alert a { color: inherit; text-decoration: underline; }
81
+ .mu_register .signup-options .wp-signup-radio-button { display: block; }
82
+ .mu_register .privacy-intro .wp-signup-radio-button { margin-right: 0.5em; }
83
+ .rtl .mu_register .wp-signup-blogname { direction: ltr; text-align: right; }
84
+ </style>
85
+ <?php
86
+ }
87
+ add_action( 'wp_head', 'wpmu_signup_stylesheet' );
88
+
89
+ get_header( 'wp-signup' );
90
+
91
+ /**
92
+ * Fires before the site Sign-up form.
93
+ *
94
+ * @since 3.0.0
95
+ */
96
+ do_action( 'before_signup_form' );
97
+ ?>
98
+ <div id="signup-content" class="widecolumn">
99
+ <div class="mu_register wp-signup-container" role="main">
100
+ <?php
101
+ /**
102
+ * Generates and displays the Sign-up and Create Site forms.
103
+ *
104
+ * @since MU (3.0.0)
105
+ *
106
+ * @param string $blogname The new site name.
107
+ * @param string $blog_title The new site title.
108
+ * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
109
+ */
110
+ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
111
+ if ( ! is_wp_error( $errors ) ) {
112
+ $errors = new WP_Error();
113
+ }
114
+
115
+ $current_network = get_network();
116
+ // Site name.
117
+ if ( ! is_subdomain_install() ) {
118
+ echo '<label for="blogname">' . __( 'Site Name (subdirectory only):' ) . '</label>';
119
+ } else {
120
+ echo '<label for="blogname">' . __( 'Site Domain (subdomain only):' ) . '</label>';
121
+ }
122
+
123
+ $errmsg_blogname = $errors->get_error_message( 'blogname' );
124
+ $errmsg_blogname_aria = '';
125
+ if ( $errmsg_blogname ) {
126
+ $errmsg_blogname_aria = 'wp-signup-blogname-error ';
127
+ echo '<p class="error" id="wp-signup-blogname-error">' . $errmsg_blogname . '</p>';
128
+ }
129
+
130
+ if ( ! is_subdomain_install() ) {
131
+ echo '<div class="wp-signup-blogname"><span class="prefix_address" id="prefix-address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" autocomplete="off" required="required" aria-describedby="' . $errmsg_blogname_aria . 'prefix-address" /></div>';
132
+ } else {
133
+ $site_domain = preg_replace( '|^www\.|', '', $current_network->domain );
134
+ echo '<div class="wp-signup-blogname"><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" autocomplete="off" required="required" aria-describedby="' . $errmsg_blogname_aria . 'suffix-address" /><span class="suffix_address" id="suffix-address">.' . esc_html( $site_domain ) . '</span></div>';
135
+ }
136
+
137
+ if ( ! is_user_logged_in() ) {
138
+ if ( ! is_subdomain_install() ) {
139
+ $site = $current_network->domain . $current_network->path . __( 'sitename' );
140
+ } else {
141
+ $site = __( 'domain' ) . '.' . $site_domain . $current_network->path;
142
+ }
143
+
144
+ printf(
145
+ '<p>(<strong>%s</strong>) %s</p>',
146
+ /* translators: %s: Site address. */
147
+ sprintf( __( 'Your address will be %s.' ), $site ),
148
+ __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' )
149
+ );
150
+ }
151
+
152
+ // Site Title.
153
+ ?>
154
+ <label for="blog_title"><?php _e( 'Site Title:' ); ?></label>
155
+ <?php
156
+ $errmsg_blog_title = $errors->get_error_message( 'blog_title' );
157
+ $errmsg_blog_title_aria = '';
158
+ if ( $errmsg_blog_title ) {
159
+ $errmsg_blog_title_aria = ' aria-describedby="wp-signup-blog-title-error"';
160
+ echo '<p class="error" id="wp-signup-blog-title-error">' . $errmsg_blog_title . '</p>';
161
+ }
162
+ echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr( $blog_title ) . '" required="required" autocomplete="off"' . $errmsg_blog_title_aria . ' />';
163
+ ?>
164
+
165
+ <?php
166
+ // Site Language.
167
+ $languages = signup_get_available_languages();
168
+
169
+ if ( ! empty( $languages ) ) :
170
+ ?>
171
+ <p>
172
+ <label for="site-language"><?php _e( 'Site Language:' ); ?></label>
173
+ <?php
174
+ // Network default.
175
+ $lang = get_site_option( 'WPLANG' );
176
+
177
+ if ( isset( $_POST['WPLANG'] ) ) {
178
+ $lang = $_POST['WPLANG'];
179
+ }
180
+
181
+ // Use US English if the default isn't available.
182
+ if ( ! in_array( $lang, $languages, true ) ) {
183
+ $lang = '';
184
+ }
185
+
186
+ wp_dropdown_languages(
187
+ array(
188
+ 'name' => 'WPLANG',
189
+ 'id' => 'site-language',
190
+ 'selected' => $lang,
191
+ 'languages' => $languages,
192
+ 'show_available_translations' => false,
193
+ )
194
+ );
195
+ ?>
196
+ </p>
197
+ <?php
198
+ endif; // Languages.
199
+
200
+ $blog_public_on_checked = '';
201
+ $blog_public_off_checked = '';
202
+ if ( isset( $_POST['blog_public'] ) && '0' === $_POST['blog_public'] ) {
203
+ $blog_public_off_checked = 'checked="checked"';
204
+ } else {
205
+ $blog_public_on_checked = 'checked="checked"';
206
+ }
207
+ ?>
208
+
209
+ <div id="privacy">
210
+ <fieldset class="privacy-intro">
211
+ <legend>
212
+ <span class="label-heading"><?php _e( 'Privacy:' ); ?></span>
213
+ <?php _e( 'Allow search engines to index this site.' ); ?>
214
+ </legend>
215
+ <p class="wp-signup-radio-buttons">
216
+ <span class="wp-signup-radio-button">
217
+ <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php echo $blog_public_on_checked; ?> />
218
+ <label class="checkbox" for="blog_public_on"><?php _e( 'Yes' ); ?></label>
219
+ </span>
220
+ <span class="wp-signup-radio-button">
221
+ <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php echo $blog_public_off_checked; ?> />
222
+ <label class="checkbox" for="blog_public_off"><?php _e( 'No' ); ?></label>
223
+ </span>
224
+ </p>
225
+ </fieldset>
226
+ </div>
227
+
228
+ <?php
229
+ /**
230
+ * Fires after the site sign-up form.
231
+ *
232
+ * @since 3.0.0
233
+ *
234
+ * @param WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors.
235
+ */
236
+ do_action( 'signup_blogform', $errors );
237
+ }
238
+
239
+ /**
240
+ * Validates the new site sign-up.
241
+ *
242
+ * @since MU (3.0.0)
243
+ *
244
+ * @return array Contains the new site data and error messages.
245
+ * See wpmu_validate_blog_signup() for details.
246
+ */
247
+ function validate_blog_form() {
248
+ $user = '';
249
+ if ( is_user_logged_in() ) {
250
+ $user = wp_get_current_user();
251
+ }
252
+
253
+ return wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'], $user );
254
+ }
255
+
256
+ /**
257
+ * Displays the fields for the new user account registration form.
258
+ *
259
+ * @since MU (3.0.0)
260
+ *
261
+ * @param string $user_name The entered username.
262
+ * @param string $user_email The entered email address.
263
+ * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
264
+ */
265
+ function show_user_form( $user_name = '', $user_email = '', $errors = '' ) {
266
+ if ( ! is_wp_error( $errors ) ) {
267
+ $errors = new WP_Error();
268
+ }
269
+
270
+ // Username.
271
+ echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
272
+ $errmsg_username = $errors->get_error_message( 'user_name' );
273
+ $errmsg_username_aria = '';
274
+ if ( $errmsg_username ) {
275
+ $errmsg_username_aria = 'wp-signup-username-error ';
276
+ echo '<p class="error" id="wp-signup-username-error">' . $errmsg_username . '</p>';
277
+ }
278
+ ?>
279
+ <input name="user_name" type="text" id="user_name" value="<?php echo esc_attr( $user_name ); ?>" autocapitalize="none" autocorrect="off" maxlength="60" autocomplete="username" required="required" aria-describedby="<?php echo $errmsg_username_aria; ?>wp-signup-username-description" />
280
+ <p id="wp-signup-username-description"><?php _e( '(Must be at least 4 characters, lowercase letters and numbers only.)' ); ?></p>
281
+
282
+ <?php
283
+ // Email address.
284
+ echo '<label for="user_email">' . __( 'Email&nbsp;Address:' ) . '</label>';
285
+ $errmsg_email = $errors->get_error_message( 'user_email' );
286
+ $errmsg_email_aria = '';
287
+ if ( $errmsg_email ) {
288
+ $errmsg_email_aria = 'wp-signup-email-error ';
289
+ echo '<p class="error" id="wp-signup-email-error">' . $errmsg_email . '</p>';
290
+ }
291
+ ?>
292
+ <input name="user_email" type="email" id="user_email" value="<?php echo esc_attr( $user_email ); ?>" maxlength="200" autocomplete="email" required="required" aria-describedby="<?php echo $errmsg_email_aria; ?>wp-signup-email-description" />
293
+ <p id="wp-signup-email-description"><?php _e( 'Your registration email is sent to this address. (Double-check your email address before continuing.)' ); ?></p>
294
+
295
+ <?php
296
+ // Extra fields.
297
+ $errmsg_generic = $errors->get_error_message( 'generic' );
298
+ if ( $errmsg_generic ) {
299
+ echo '<p class="error" id="wp-signup-generic-error">' . $errmsg_generic . '</p>';
300
+ }
301
+ /**
302
+ * Fires at the end of the new user account registration form.
303
+ *
304
+ * @since 3.0.0
305
+ *
306
+ * @param WP_Error $errors A WP_Error object containing 'user_name' or 'user_email' errors.
307
+ */
308
+ do_action( 'signup_extra_fields', $errors );
309
+ }
310
+
311
+ /**
312
+ * Validates user sign-up name and email.
313
+ *
314
+ * @since MU (3.0.0)
315
+ *
316
+ * @return array Contains username, email, and error messages.
317
+ * See wpmu_validate_user_signup() for details.
318
+ */
319
+ function validate_user_form() {
320
+ return wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
321
+ }
322
+
323
+ /**
324
+ * Shows a form for returning users to sign up for another site.
325
+ *
326
+ * @since MU (3.0.0)
327
+ *
328
+ * @param string $blogname The new site name
329
+ * @param string $blog_title The new site title.
330
+ * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
331
+ */
332
+ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
333
+ $current_user = wp_get_current_user();
334
+
335
+ if ( ! is_wp_error( $errors ) ) {
336
+ $errors = new WP_Error();
337
+ }
338
+
339
+ $signup_defaults = array(
340
+ 'blogname' => $blogname,
341
+ 'blog_title' => $blog_title,
342
+ 'errors' => $errors,
343
+ );
344
+
345
+ /**
346
+ * Filters the default site sign-up variables.
347
+ *
348
+ * @since 3.0.0
349
+ *
350
+ * @param array $signup_defaults {
351
+ * An array of default site sign-up variables.
352
+ *
353
+ * @type string $blogname The site blogname.
354
+ * @type string $blog_title The site title.
355
+ * @type WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors.
356
+ * }
357
+ */
358
+ $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
359
+
360
+ $blogname = $filtered_results['blogname'];
361
+ $blog_title = $filtered_results['blog_title'];
362
+ $errors = $filtered_results['errors'];
363
+
364
+ /* translators: %s: Network title. */
365
+ echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>';
366
+
367
+ if ( $errors->has_errors() ) {
368
+ echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
369
+ }
370
+ ?>
371
+ <p>
372
+ <?php
373
+ printf(
374
+ /* translators: %s: Current user's display name. */
375
+ __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ),
376
+ $current_user->display_name
377
+ );
378
+ ?>
379
+ </p>
380
+
381
+ <?php
382
+ $blogs = get_blogs_of_user( $current_user->ID );
383
+ if ( ! empty( $blogs ) ) {
384
+ ?>
385
+
386
+ <p><?php _e( 'Sites you are already a member of:' ); ?></p>
387
+ <ul>
388
+ <?php
389
+ foreach ( $blogs as $blog ) {
390
+ $home_url = get_home_url( $blog->userblog_id );
391
+ echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';
392
+ }
393
+ ?>
394
+ </ul>
395
+ <?php } ?>
396
+
397
+ <p><?php _e( 'If you are not going to use a great site domain, leave it for a new user. Now have at it!' ); ?></p>
398
+ <form id="setupform" method="post" action="wp-signup.php">
399
+ <input type="hidden" name="stage" value="gimmeanotherblog" />
400
+ <?php
401
+ /**
402
+ * Fires when hidden sign-up form fields output when creating another site or user.
403
+ *
404
+ * @since MU (3.0.0)
405
+ *
406
+ * @param string $context A string describing the steps of the sign-up process. The value can be
407
+ * 'create-another-site', 'validate-user', or 'validate-site'.
408
+ */
409
+ do_action( 'signup_hidden_fields', 'create-another-site' );
410
+ ?>
411
+ <?php show_blog_form( $blogname, $blog_title, $errors ); ?>
412
+ <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ); ?>" /></p>
413
+ </form>
414
+ <?php
415
+ }
416
+
417
+ /**
418
+ * Validates a new site sign-up for an existing user.
419
+ *
420
+ * @since MU (3.0.0)
421
+ *
422
+ * @global string $blogname The new site's subdomain or directory name.
423
+ * @global string $blog_title The new site's title.
424
+ * @global WP_Error $errors Existing errors in the global scope.
425
+ * @global string $domain The new site's domain.
426
+ * @global string $path The new site's path.
427
+ *
428
+ * @return null|bool True if site signup was validated, false on error.
429
+ * The function halts all execution if the user is not logged in.
430
+ */
431
+ function validate_another_blog_signup() {
432
+ global $blogname, $blog_title, $errors, $domain, $path;
433
+ $current_user = wp_get_current_user();
434
+ if ( ! is_user_logged_in() ) {
435
+ die();
436
+ }
437
+
438
+ $result = validate_blog_form();
439
+
440
+ // Extracted values set/overwrite globals.
441
+ $domain = $result['domain'];
442
+ $path = $result['path'];
443
+ $blogname = $result['blogname'];
444
+ $blog_title = $result['blog_title'];
445
+ $errors = $result['errors'];
446
+
447
+ if ( $errors->has_errors() ) {
448
+ signup_another_blog( $blogname, $blog_title, $errors );
449
+ return false;
450
+ }
451
+
452
+ $public = (int) $_POST['blog_public'];
453
+
454
+ $blog_meta_defaults = array(
455
+ 'lang_id' => 1,
456
+ 'public' => $public,
457
+ );
458
+
459
+ // Handle the language setting for the new site.
460
+ if ( ! empty( $_POST['WPLANG'] ) ) {
461
+
462
+ $languages = signup_get_available_languages();
463
+
464
+ if ( in_array( $_POST['WPLANG'], $languages, true ) ) {
465
+ $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
466
+
467
+ if ( $language ) {
468
+ $blog_meta_defaults['WPLANG'] = $language;
469
+ }
470
+ }
471
+ }
472
+
473
+ /**
474
+ * Filters the new site meta variables.
475
+ *
476
+ * Use the {@see 'add_signup_meta'} filter instead.
477
+ *
478
+ * @since MU (3.0.0)
479
+ * @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead.
480
+ *
481
+ * @param array $blog_meta_defaults An array of default blog meta variables.
482
+ */
483
+ $meta_defaults = apply_filters_deprecated( 'signup_create_blog_meta', array( $blog_meta_defaults ), '3.0.0', 'add_signup_meta' );
484
+
485
+ /**
486
+ * Filters the new default site meta variables.
487
+ *
488
+ * @since 3.0.0
489
+ *
490
+ * @param array $meta {
491
+ * An array of default site meta variables.
492
+ *
493
+ * @type int $lang_id The language ID.
494
+ * @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
495
+ * }
496
+ */
497
+ $meta = apply_filters( 'add_signup_meta', $meta_defaults );
498
+
499
+ $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, get_current_network_id() );
500
+
501
+ if ( is_wp_error( $blog_id ) ) {
502
+ return false;
503
+ }
504
+
505
+ confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
506
+ return true;
507
+ }
508
+
509
+ /**
510
+ * Shows a message confirming that the new site has been created.
511
+ *
512
+ * @since MU (3.0.0)
513
+ * @since 4.4.0 Added the `$blog_id` parameter.
514
+ *
515
+ * @param string $domain The domain URL.
516
+ * @param string $path The site root path.
517
+ * @param string $blog_title The site title.
518
+ * @param string $user_name The username.
519
+ * @param string $user_email The user's email address.
520
+ * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup().
521
+ * @param int $blog_id The site ID.
522
+ */
523
+ function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0 ) {
524
+
525
+ if ( $blog_id ) {
526
+ switch_to_blog( $blog_id );
527
+ $home_url = home_url( '/' );
528
+ $login_url = wp_login_url();
529
+ restore_current_blog();
530
+ } else {
531
+ $home_url = 'http://' . $domain . $path;
532
+ $login_url = 'http://' . $domain . $path . 'wp-login.php';
533
+ }
534
+
535
+ $site = sprintf(
536
+ '<a href="%1$s">%2$s</a>',
537
+ esc_url( $home_url ),
538
+ $blog_title
539
+ );
540
+
541
+ ?>
542
+ <h2>
543
+ <?php
544
+ /* translators: %s: Site title. */
545
+ printf( __( 'The site %s is yours.' ), $site );
546
+ ?>
547
+ </h2>
548
+ <p>
549
+ <?php
550
+ printf(
551
+ /* translators: 1: Link to new site, 2: Login URL, 3: Username. */
552
+ __( '%1$s is your new site. <a href="%2$s">Log in</a> as &#8220;%3$s&#8221; using your existing password.' ),
553
+ sprintf(
554
+ '<a href="%s">%s</a>',
555
+ esc_url( $home_url ),
556
+ untrailingslashit( $domain . $path )
557
+ ),
558
+ esc_url( $login_url ),
559
+ $user_name
560
+ );
561
+ ?>
562
+ </p>
563
+ <?php
564
+ /**
565
+ * Fires when the site or user sign-up process is complete.
566
+ *
567
+ * @since 3.0.0
568
+ */
569
+ do_action( 'signup_finished' );
570
+ }
571
+
572
+ /**
573
+ * Shows a form for a visitor to sign up for a new user account.
574
+ *
575
+ * @since MU (3.0.0)
576
+ *
577
+ * @global string $active_signup String that returns registration type. The value can be
578
+ * 'all', 'none', 'blog', or 'user'.
579
+ *
580
+ * @param string $user_name The username.
581
+ * @param string $user_email The user's email.
582
+ * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
583
+ */
584
+ function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
585
+ global $active_signup;
586
+
587
+ if ( ! is_wp_error( $errors ) ) {
588
+ $errors = new WP_Error();
589
+ }
590
+
591
+ $signup_for = isset( $_POST['signup_for'] ) ? esc_html( $_POST['signup_for'] ) : 'blog';
592
+
593
+ $signup_user_defaults = array(
594
+ 'user_name' => $user_name,
595
+ 'user_email' => $user_email,
596
+ 'errors' => $errors,
597
+ );
598
+
599
+ /**
600
+ * Filters the default user variables used on the user sign-up form.
601
+ *
602
+ * @since 3.0.0
603
+ *
604
+ * @param array $signup_user_defaults {
605
+ * An array of default user variables.
606
+ *
607
+ * @type string $user_name The user username.
608
+ * @type string $user_email The user email address.
609
+ * @type WP_Error $errors A WP_Error object with possible errors relevant to the sign-up user.
610
+ * }
611
+ */
612
+ $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults );
613
+ $user_name = $filtered_results['user_name'];
614
+ $user_email = $filtered_results['user_email'];
615
+ $errors = $filtered_results['errors'];
616
+
617
+ ?>
618
+
619
+ <h2>
620
+ <?php
621
+ /* translators: %s: Name of the network. */
622
+ printf( __( 'Get your own %s account in seconds' ), get_network()->site_name );
623
+ ?>
624
+ </h2>
625
+ <form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate">
626
+ <input type="hidden" name="stage" value="validate-user-signup" />
627
+ <?php
628
+ /** This action is documented in wp-signup.php */
629
+ do_action( 'signup_hidden_fields', 'validate-user' );
630
+ ?>
631
+ <?php show_user_form( $user_name, $user_email, $errors ); ?>
632
+
633
+ <?php if ( 'blog' === $active_signup ) : ?>
634
+ <input id="signupblog" type="hidden" name="signup_for" value="blog" />
635
+ <?php elseif ( 'user' === $active_signup ) : ?>
636
+ <input id="signupblog" type="hidden" name="signup_for" value="user" />
637
+ <?php else : ?>
638
+ <fieldset class="signup-options">
639
+ <legend><?php _e( 'Create a site or only a username:' ); ?></legend>
640
+ <p class="wp-signup-radio-buttons">
641
+ <span class="wp-signup-radio-button">
642
+ <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
643
+ <label class="checkbox" for="signupblog"><?php _e( 'Gimme a site!' ); ?></label>
644
+ </span>
645
+ <span class="wp-signup-radio-button">
646
+ <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
647
+ <label class="checkbox" for="signupuser"><?php _e( 'Just a username, please.' ); ?></label>
648
+ </span>
649
+ </p>
650
+ </fieldset>
651
+ <?php endif; ?>
652
+
653
+ <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Next' ); ?>" /></p>
654
+ </form>
655
+ <?php
656
+ }
657
+
658
+ /**
659
+ * Validates the new user sign-up.
660
+ *
661
+ * @since MU (3.0.0)
662
+ *
663
+ * @return bool True if new user sign-up was validated, false on error.
664
+ */
665
+ function validate_user_signup() {
666
+ $result = validate_user_form();
667
+ $user_name = $result['user_name'];
668
+ $user_email = $result['user_email'];
669
+ $errors = $result['errors'];
670
+
671
+ if ( $errors->has_errors() ) {
672
+ signup_user( $user_name, $user_email, $errors );
673
+ return false;
674
+ }
675
+
676
+ if ( 'blog' === $_POST['signup_for'] ) {
677
+ signup_blog( $user_name, $user_email );
678
+ return false;
679
+ }
680
+
681
+ /** This filter is documented in wp-signup.php */
682
+ wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
683
+
684
+ confirm_user_signup( $user_name, $user_email );
685
+ return true;
686
+ }
687
+
688
+ /**
689
+ * Shows a message confirming that the new user has been registered and is awaiting activation.
690
+ *
691
+ * @since MU (3.0.0)
692
+ *
693
+ * @param string $user_name The username.
694
+ * @param string $user_email The user's email address.
695
+ */
696
+ function confirm_user_signup( $user_name, $user_email ) {
697
+ ?>
698
+ <h2>
699
+ <?php
700
+ /* translators: %s: Username. */
701
+ printf( __( '%s is your new username' ), $user_name )
702
+ ?>
703
+ </h2>
704
+ <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ); ?></p>
705
+ <p>
706
+ <?php
707
+ /* translators: %s: The user email address. */
708
+ printf( __( 'Check your inbox at %s and click on the given link.' ), '<strong>' . $user_email . '</strong>' );
709
+ ?>
710
+ </p>
711
+ <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
712
+ <?php
713
+ /** This action is documented in wp-signup.php */
714
+ do_action( 'signup_finished' );
715
+ }
716
+
717
+ /**
718
+ * Shows a form for a user or visitor to sign up for a new site.
719
+ *
720
+ * @since MU (3.0.0)
721
+ *
722
+ * @param string $user_name The username.
723
+ * @param string $user_email The user's email address.
724
+ * @param string $blogname The site name.
725
+ * @param string $blog_title The site title.
726
+ * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
727
+ */
728
+ function signup_blog( $user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '' ) {
729
+ if ( ! is_wp_error( $errors ) ) {
730
+ $errors = new WP_Error();
731
+ }
732
+
733
+ $signup_blog_defaults = array(
734
+ 'user_name' => $user_name,
735
+ 'user_email' => $user_email,
736
+ 'blogname' => $blogname,
737
+ 'blog_title' => $blog_title,
738
+ 'errors' => $errors,
739
+ );
740
+
741
+ /**
742
+ * Filters the default site creation variables for the site sign-up form.
743
+ *
744
+ * @since 3.0.0
745
+ *
746
+ * @param array $signup_blog_defaults {
747
+ * An array of default site creation variables.
748
+ *
749
+ * @type string $user_name The user username.
750
+ * @type string $user_email The user email address.
751
+ * @type string $blogname The blogname.
752
+ * @type string $blog_title The title of the site.
753
+ * @type WP_Error $errors A WP_Error object with possible errors relevant to new site creation variables.
754
+ * }
755
+ */
756
+ $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults );
757
+
758
+ $user_name = $filtered_results['user_name'];
759
+ $user_email = $filtered_results['user_email'];
760
+ $blogname = $filtered_results['blogname'];
761
+ $blog_title = $filtered_results['blog_title'];
762
+ $errors = $filtered_results['errors'];
763
+
764
+ if ( empty( $blogname ) ) {
765
+ $blogname = $user_name;
766
+ }
767
+ ?>
768
+ <form id="setupform" method="post" action="wp-signup.php">
769
+ <input type="hidden" name="stage" value="validate-blog-signup" />
770
+ <input type="hidden" name="user_name" value="<?php echo esc_attr( $user_name ); ?>" />
771
+ <input type="hidden" name="user_email" value="<?php echo esc_attr( $user_email ); ?>" />
772
+ <?php
773
+ /** This action is documented in wp-signup.php */
774
+ do_action( 'signup_hidden_fields', 'validate-site' );
775
+ ?>
776
+ <?php show_blog_form( $blogname, $blog_title, $errors ); ?>
777
+ <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Sign up' ); ?>" /></p>
778
+ </form>
779
+ <?php
780
+ }
781
+
782
+ /**
783
+ * Validates new site signup.
784
+ *
785
+ * @since MU (3.0.0)
786
+ *
787
+ * @return bool True if the site sign-up was validated, false on error.
788
+ */
789
+ function validate_blog_signup() {
790
+ // Re-validate user info.
791
+ $user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
792
+ $user_name = $user_result['user_name'];
793
+ $user_email = $user_result['user_email'];
794
+ $user_errors = $user_result['errors'];
795
+
796
+ if ( $user_errors->has_errors() ) {
797
+ signup_user( $user_name, $user_email, $user_errors );
798
+ return false;
799
+ }
800
+
801
+ $result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] );
802
+ $domain = $result['domain'];
803
+ $path = $result['path'];
804
+ $blogname = $result['blogname'];
805
+ $blog_title = $result['blog_title'];
806
+ $errors = $result['errors'];
807
+
808
+ if ( $errors->has_errors() ) {
809
+ signup_blog( $user_name, $user_email, $blogname, $blog_title, $errors );
810
+ return false;
811
+ }
812
+
813
+ $public = (int) $_POST['blog_public'];
814
+ $signup_meta = array(
815
+ 'lang_id' => 1,
816
+ 'public' => $public,
817
+ );
818
+
819
+ // Handle the language setting for the new site.
820
+ if ( ! empty( $_POST['WPLANG'] ) ) {
821
+
822
+ $languages = signup_get_available_languages();
823
+
824
+ if ( in_array( $_POST['WPLANG'], $languages, true ) ) {
825
+ $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
826
+
827
+ if ( $language ) {
828
+ $signup_meta['WPLANG'] = $language;
829
+ }
830
+ }
831
+ }
832
+
833
+ /** This filter is documented in wp-signup.php */
834
+ $meta = apply_filters( 'add_signup_meta', $signup_meta );
835
+
836
+ wpmu_signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta );
837
+ confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email, $meta );
838
+ return true;
839
+ }
840
+
841
+ /**
842
+ * Shows a message confirming that the new site has been registered and is awaiting activation.
843
+ *
844
+ * @since MU (3.0.0)
845
+ *
846
+ * @param string $domain The domain or subdomain of the site.
847
+ * @param string $path The path of the site.
848
+ * @param string $blog_title The title of the new site.
849
+ * @param string $user_name The user's username.
850
+ * @param string $user_email The user's email address.
851
+ * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup().
852
+ */
853
+ function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
854
+ ?>
855
+ <h2>
856
+ <?php
857
+ /* translators: %s: Site address. */
858
+ printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" )
859
+ ?>
860
+ </h2>
861
+
862
+ <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ); ?></p>
863
+ <p>
864
+ <?php
865
+ /* translators: %s: The user email address. */
866
+ printf( __( 'Check your inbox at %s and click on the given link.' ), '<strong>' . $user_email . '</strong>' );
867
+ ?>
868
+ </p>
869
+ <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
870
+ <h2><?php _e( 'Still waiting for your email?' ); ?></h2>
871
+ <p><?php _e( 'If you have not received your email yet, there are a number of things you can do:' ); ?></p>
872
+ <ul id="noemail-tips">
873
+ <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ); ?></strong></p></li>
874
+ <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ); ?></p></li>
875
+ <li>
876
+ <?php
877
+ /* translators: %s: Email address. */
878
+ printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email );
879
+ ?>
880
+ </li>
881
+ </ul>
882
+ <?php
883
+ /** This action is documented in wp-signup.php */
884
+ do_action( 'signup_finished' );
885
+ }
886
+
887
+ /**
888
+ * Retrieves languages available during the site/user sign-up process.
889
+ *
890
+ * @since 4.4.0
891
+ *
892
+ * @see get_available_languages()
893
+ *
894
+ * @return string[] Array of available language codes. Language codes are formed by
895
+ * stripping the .mo extension from the language file names.
896
+ */
897
+ function signup_get_available_languages() {
898
+ /**
899
+ * Filters the list of available languages for front-end site sign-ups.
900
+ *
901
+ * Passing an empty array to this hook will disable output of the setting on the
902
+ * sign-up form, and the default language will be used when creating the site.
903
+ *
904
+ * Languages not already installed will be stripped.
905
+ *
906
+ * @since 4.4.0
907
+ *
908
+ * @param string[] $languages Array of available language codes. Language codes are formed by
909
+ * stripping the .mo extension from the language file names.
910
+ */
911
+ $languages = (array) apply_filters( 'signup_get_available_languages', get_available_languages() );
912
+
913
+ /*
914
+ * Strip any non-installed languages and return.
915
+ *
916
+ * Re-call get_available_languages() here in case a language pack was installed
917
+ * in a callback hooked to the 'signup_get_available_languages' filter before this point.
918
+ */
919
+ return array_intersect_assoc( $languages, get_available_languages() );
920
+ }
921
+
922
+ // Main.
923
+ $active_signup = get_site_option( 'registration', 'none' );
924
+
925
+ /**
926
+ * Filters the type of site sign-up.
927
+ *
928
+ * @since 3.0.0
929
+ *
930
+ * @param string $active_signup String that returns registration type. The value can be
931
+ * 'all', 'none', 'blog', or 'user'.
932
+ */
933
+ $active_signup = apply_filters( 'wpmu_active_signup', $active_signup );
934
+
935
+ if ( current_user_can( 'manage_network' ) ) {
936
+ echo '<div class="mu_alert">';
937
+ _e( 'Greetings Network Administrator!' );
938
+ echo ' ';
939
+
940
+ switch ( $active_signup ) {
941
+ case 'none':
942
+ _e( 'The network currently disallows registrations.' );
943
+ break;
944
+ case 'blog':
945
+ _e( 'The network currently allows site registrations.' );
946
+ break;
947
+ case 'user':
948
+ _e( 'The network currently allows user registrations.' );
949
+ break;
950
+ default:
951
+ _e( 'The network currently allows both site and user registrations.' );
952
+ break;
953
+ }
954
+
955
+ echo ' ';
956
+
957
+ /* translators: %s: URL to Network Settings screen. */
958
+ printf( __( 'To change or disable registration go to your <a href="%s">Options page</a>.' ), esc_url( network_admin_url( 'settings.php' ) ) );
959
+ echo '</div>';
960
+ }
961
+
962
+ $newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null;
963
+
964
+ $current_user = wp_get_current_user();
965
+ if ( 'none' === $active_signup ) {
966
+ _e( 'Registration has been disabled.' );
967
+ } elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) {
968
+ $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
969
+ /* translators: %s: Login URL. */
970
+ printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
971
+ } else {
972
+ $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
973
+ switch ( $stage ) {
974
+ case 'validate-user-signup':
975
+ if ( 'all' === $active_signup
976
+ || ( 'blog' === $_POST['signup_for'] && 'blog' === $active_signup )
977
+ || ( 'user' === $_POST['signup_for'] && 'user' === $active_signup )
978
+ ) {
979
+ validate_user_signup();
980
+ } else {
981
+ _e( 'User registration has been disabled.' );
982
+ }
983
+ break;
984
+ case 'validate-blog-signup':
985
+ if ( 'all' === $active_signup || 'blog' === $active_signup ) {
986
+ validate_blog_signup();
987
+ } else {
988
+ _e( 'Site registration has been disabled.' );
989
+ }
990
+ break;
991
+ case 'gimmeanotherblog':
992
+ validate_another_blog_signup();
993
+ break;
994
+ case 'default':
995
+ default:
996
+ $user_email = isset( $_POST['user_email'] ) ? $_POST['user_email'] : '';
997
+ /**
998
+ * Fires when the site sign-up form is sent.
999
+ *
1000
+ * @since 3.0.0
1001
+ */
1002
+ do_action( 'preprocess_signup_form' );
1003
+ if ( is_user_logged_in() && ( 'all' === $active_signup || 'blog' === $active_signup ) ) {
1004
+ signup_another_blog( $newblogname );
1005
+ } elseif ( ! is_user_logged_in() && ( 'all' === $active_signup || 'user' === $active_signup ) ) {
1006
+ signup_user( $newblogname, $user_email );
1007
+ } elseif ( ! is_user_logged_in() && ( 'blog' === $active_signup ) ) {
1008
+ _e( 'Sorry, new registrations are not allowed at this time.' );
1009
+ } else {
1010
+ _e( 'You are logged in already. No need to register again!' );
1011
+ }
1012
+
1013
+ if ( $newblogname ) {
1014
+ $newblog = get_blogaddress_by_name( $newblogname );
1015
+
1016
+ if ( 'blog' === $active_signup || 'all' === $active_signup ) {
1017
+ printf(
1018
+ /* translators: %s: Site address. */
1019
+ '<p>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</p>',
1020
+ '<strong>' . $newblog . '</strong>'
1021
+ );
1022
+ } else {
1023
+ printf(
1024
+ /* translators: %s: Site address. */
1025
+ '<p>' . __( 'The site you were looking for, %s, does not exist.' ) . '</p>',
1026
+ '<strong>' . $newblog . '</strong>'
1027
+ );
1028
+ }
1029
+ }
1030
+ break;
1031
+ }
1032
+ }
1033
+ ?>
1034
+ </div>
1035
+ </div>
1036
+ <?php
1037
+ /**
1038
+ * Fires after the sign-up forms, before wp_footer.
1039
+ *
1040
+ * @since 3.0.0
1041
+ */
1042
+ do_action( 'after_signup_form' );
1043
+ ?>
1044
+
1045
+ <?php
1046
+ get_footer( 'wp-signup' );
wp-trackback.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handle Trackbacks and Pingbacks Sent to WordPress
4
+ *
5
+ * @since 0.71
6
+ *
7
+ * @package WordPress
8
+ * @subpackage Trackbacks
9
+ */
10
+
11
+ if ( empty( $wp ) ) {
12
+ require_once __DIR__ . '/wp-load.php';
13
+ wp( array( 'tb' => '1' ) );
14
+ }
15
+
16
+ // Always run as an unauthenticated user.
17
+ wp_set_current_user( 0 );
18
+
19
+ /**
20
+ * Response to a trackback.
21
+ *
22
+ * Responds with an error or success XML message.
23
+ *
24
+ * @since 0.71
25
+ *
26
+ * @param int|bool $error Whether there was an error.
27
+ * Default '0'. Accepts '0' or '1', true or false.
28
+ * @param string $error_message Error message if an error occurred. Default empty string.
29
+ */
30
+ function trackback_response( $error = 0, $error_message = '' ) {
31
+ header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
32
+
33
+ if ( $error ) {
34
+ echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
35
+ echo "<response>\n";
36
+ echo "<error>1</error>\n";
37
+ echo "<message>$error_message</message>\n";
38
+ echo '</response>';
39
+ die();
40
+ } else {
41
+ echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
42
+ echo "<response>\n";
43
+ echo "<error>0</error>\n";
44
+ echo '</response>';
45
+ }
46
+ }
47
+
48
+ if ( ! isset( $_GET['tb_id'] ) || ! $_GET['tb_id'] ) {
49
+ $post_id = explode( '/', $_SERVER['REQUEST_URI'] );
50
+ $post_id = (int) $post_id[ count( $post_id ) - 1 ];
51
+ }
52
+
53
+ $trackback_url = isset( $_POST['url'] ) ? $_POST['url'] : '';
54
+ $charset = isset( $_POST['charset'] ) ? $_POST['charset'] : '';
55
+
56
+ // These three are stripslashed here so they can be properly escaped after mb_convert_encoding().
57
+ $title = isset( $_POST['title'] ) ? wp_unslash( $_POST['title'] ) : '';
58
+ $excerpt = isset( $_POST['excerpt'] ) ? wp_unslash( $_POST['excerpt'] ) : '';
59
+ $blog_name = isset( $_POST['blog_name'] ) ? wp_unslash( $_POST['blog_name'] ) : '';
60
+
61
+ if ( $charset ) {
62
+ $charset = str_replace( array( ',', ' ' ), '', strtoupper( trim( $charset ) ) );
63
+ } else {
64
+ $charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS';
65
+ }
66
+
67
+ // No valid uses for UTF-7.
68
+ if ( str_contains( $charset, 'UTF-7' ) ) {
69
+ die;
70
+ }
71
+
72
+ // For international trackbacks.
73
+ if ( function_exists( 'mb_convert_encoding' ) ) {
74
+ $title = mb_convert_encoding( $title, get_option( 'blog_charset' ), $charset );
75
+ $excerpt = mb_convert_encoding( $excerpt, get_option( 'blog_charset' ), $charset );
76
+ $blog_name = mb_convert_encoding( $blog_name, get_option( 'blog_charset' ), $charset );
77
+ }
78
+
79
+ // Escape values to use in the trackback.
80
+ $title = wp_slash( $title );
81
+ $excerpt = wp_slash( $excerpt );
82
+ $blog_name = wp_slash( $blog_name );
83
+
84
+ if ( is_single() || is_page() ) {
85
+ $post_id = $posts[0]->ID;
86
+ }
87
+
88
+ if ( ! isset( $post_id ) || ! (int) $post_id ) {
89
+ trackback_response( 1, __( 'I really need an ID for this to work.' ) );
90
+ }
91
+
92
+ if ( empty( $title ) && empty( $trackback_url ) && empty( $blog_name ) ) {
93
+ // If it doesn't look like a trackback at all.
94
+ wp_redirect( get_permalink( $post_id ) );
95
+ exit;
96
+ }
97
+
98
+ if ( ! empty( $trackback_url ) && ! empty( $title ) ) {
99
+ /**
100
+ * Fires before the trackback is added to a post.
101
+ *
102
+ * @since 4.7.0
103
+ *
104
+ * @param int $post_id Post ID related to the trackback.
105
+ * @param string $trackback_url Trackback URL.
106
+ * @param string $charset Character set.
107
+ * @param string $title Trackback title.
108
+ * @param string $excerpt Trackback excerpt.
109
+ * @param string $blog_name Site name.
110
+ */
111
+ do_action( 'pre_trackback_post', $post_id, $trackback_url, $charset, $title, $excerpt, $blog_name );
112
+
113
+ header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
114
+
115
+ if ( ! pings_open( $post_id ) ) {
116
+ trackback_response( 1, __( 'Sorry, trackbacks are closed for this item.' ) );
117
+ }
118
+
119
+ $title = wp_html_excerpt( $title, 250, '&#8230;' );
120
+ $excerpt = wp_html_excerpt( $excerpt, 252, '&#8230;' );
121
+
122
+ $comment_post_id = (int) $post_id;
123
+ $comment_author = $blog_name;
124
+ $comment_author_email = '';
125
+ $comment_author_url = $trackback_url;
126
+ $comment_content = "<strong>$title</strong>\n\n$excerpt";
127
+ $comment_type = 'trackback';
128
+
129
+ $dupe = $wpdb->get_results(
130
+ $wpdb->prepare(
131
+ "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s",
132
+ $comment_post_id,
133
+ $comment_author_url
134
+ )
135
+ );
136
+
137
+ if ( $dupe ) {
138
+ trackback_response( 1, __( 'There is already a ping from that URL for this post.' ) );
139
+ }
140
+
141
+ $commentdata = array(
142
+ 'comment_post_ID' => $comment_post_id,
143
+ );
144
+
145
+ $commentdata += compact(
146
+ 'comment_author',
147
+ 'comment_author_email',
148
+ 'comment_author_url',
149
+ 'comment_content',
150
+ 'comment_type'
151
+ );
152
+
153
+ $result = wp_new_comment( $commentdata );
154
+
155
+ if ( is_wp_error( $result ) ) {
156
+ trackback_response( 1, $result->get_error_message() );
157
+ }
158
+
159
+ $trackback_id = $wpdb->insert_id;
160
+
161
+ /**
162
+ * Fires after a trackback is added to a post.
163
+ *
164
+ * @since 1.2.0
165
+ *
166
+ * @param int $trackback_id Trackback ID.
167
+ */
168
+ do_action( 'trackback_post', $trackback_id );
169
+
170
+ trackback_response( 0 );
171
+ }
xmlrpc.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * XML-RPC protocol support for WordPress
4
+ *
5
+ * @package WordPress
6
+ */
7
+
8
+ /**
9
+ * Whether this is an XML-RPC Request.
10
+ *
11
+ * @var bool
12
+ */
13
+ define( 'XMLRPC_REQUEST', true );
14
+
15
+ // Discard unneeded cookies sent by some browser-embedded clients.
16
+ $_COOKIE = array();
17
+
18
+ // $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0.
19
+ // phpcs:disable PHPCompatibility.Variables.RemovedPredefinedGlobalVariables.http_raw_post_dataDeprecatedRemoved
20
+ if ( ! isset( $HTTP_RAW_POST_DATA ) ) {
21
+ $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
22
+ }
23
+
24
+ // Fix for mozBlog and other cases where '<?xml' isn't on the very first line.
25
+ if ( isset( $HTTP_RAW_POST_DATA ) ) {
26
+ $HTTP_RAW_POST_DATA = trim( $HTTP_RAW_POST_DATA );
27
+ }
28
+ // phpcs:enable
29
+
30
+ /** Include the bootstrap for setting up WordPress environment */
31
+ require_once __DIR__ . '/wp-load.php';
32
+
33
+ if ( isset( $_GET['rsd'] ) ) { // https://cyber.harvard.edu/blogs/gems/tech/rsd.html
34
+ header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
35
+ echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
36
+ ?>
37
+ <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
38
+ <service>
39
+ <engineName>WordPress</engineName>
40
+ <engineLink>https://wordpress.org/</engineLink>
41
+ <homePageLink><?php bloginfo_rss( 'url' ); ?></homePageLink>
42
+ <apis>
43
+ <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
44
+ <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
45
+ <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
46
+ <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
47
+ <?php
48
+ /**
49
+ * Fires when adding APIs to the Really Simple Discovery (RSD) endpoint.
50
+ *
51
+ * @link https://cyber.harvard.edu/blogs/gems/tech/rsd.html
52
+ *
53
+ * @since 3.5.0
54
+ */
55
+ do_action( 'xmlrpc_rsd_apis' );
56
+ ?>
57
+ </apis>
58
+ </service>
59
+ </rsd>
60
+ <?php
61
+ exit;
62
+ }
63
+
64
+ require_once ABSPATH . 'wp-admin/includes/admin.php';
65
+ require_once ABSPATH . WPINC . '/class-IXR.php';
66
+ require_once ABSPATH . WPINC . '/class-wp-xmlrpc-server.php';
67
+
68
+ /**
69
+ * Posts submitted via the XML-RPC interface get that title
70
+ *
71
+ * @name post_default_title
72
+ * @var string
73
+ */
74
+ $post_default_title = '';
75
+
76
+ /**
77
+ * Filters the class used for handling XML-RPC requests.
78
+ *
79
+ * @since 3.1.0
80
+ *
81
+ * @param string $class The name of the XML-RPC server class.
82
+ */
83
+ $wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' );
84
+ $wp_xmlrpc_server = new $wp_xmlrpc_server_class();
85
+
86
+ // Fire off the request.
87
+ $wp_xmlrpc_server->serve_request();
88
+
89
+ exit;
90
+
91
+ /**
92
+ * logIO() - Writes logging info to a file.
93
+ *
94
+ * @since 1.2.0
95
+ * @deprecated 3.4.0 Use error_log()
96
+ * @see error_log()
97
+ *
98
+ * @global int|bool $xmlrpc_logging Whether to enable XML-RPC logging.
99
+ *
100
+ * @param string $io Whether input or output.
101
+ * @param string $msg Information describing logging reason.
102
+ */
103
+ function logIO( $io, $msg ) {
104
+ _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
105
+ if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) {
106
+ error_log( $io . ' - ' . $msg );
107
+ }
108
+ }