{"id":47803,"date":"2015-02-08T10:31:32","date_gmt":"2015-02-08T09:31:32","guid":{"rendered":"https:\/\/pl.wordpress.org\/support\/topic\/blad-wtyczki-i-problem-logowania-do-kokpitu\/"},"modified":"2016-08-05T22:10:52","modified_gmt":"2016-08-05T22:10:52","slug":"blad-wtyczki-i-problem-logowania-do-kokpitu","status":"closed","type":"topic","link":"https:\/\/pl.wordpress.org\/support\/topic\/blad-wtyczki-i-problem-logowania-do-kokpitu\/","title":{"rendered":"Blad wtyczki i problem logowania do kokpitu"},"content":{"rendered":"<p>Po sciagnieciu wtyczki wystapil chyba jaki\u015b blad i kiedy chce si\u0119 zalogowac do KOKPITU wyswietla mi si\u0119 blad<br \/>\nContinue reading at<br \/>\nWarning: Cannot modify header information &#8211; headers already sent by (output started at \/autoinstalator\/wordpress\/wp-includes\/l10n.php:204) in \/autoinstalator\/wordpress\/wp-includes\/pluggable.php on line 1178<\/p>\n<p>przez FTP odnalaz\u0142am miejsce problemu ale nie mam poj\u0119cia &#8230;szukam wsz\u0119dzie info na ten temat i nic \ud83d\ude41<\/p>\n<pre><code>&lt;?php\n\/**\n * These functions can be replaced via plugins. If plugins do not redefine these\n * functions, then these will be used instead.\n *\n * @package WordPress\n *\/\n\nif ( !function_exists(&#039;wp_set_current_user&#039;) ) :\n\/**\n * Changes the current user by ID or name.\n *\n * Set $id to null and specify a name if you do not know a user&#039;s ID.\n *\n * Some WordPress functionality is based on the current user and not based on\n * the signed in user. Therefore, it opens the ability to edit and perform\n * actions on users who aren&#039;t signed in.\n *\n * @since 2.0.3\n * @global object $current_user The current user object which holds the user data.\n *\n * @param int $id User ID\n * @param string $name User&#039;s username\n * @return WP_User Current user User object\n *\/\nfunction wp_set_current_user($id, $name = &#039;&#039;) {\n\tglobal $current_user;\n\n\tif ( isset( $current_user ) &amp;&amp; ( $current_user instanceof WP_User ) &amp;&amp; ( $id == $current_user-&gt;ID ) )\n\t\treturn $current_user;\n\n\t$current_user = new WP_User( $id, $name );\n\n\tsetup_userdata( $current_user-&gt;ID );\n\n\t\/**\n\t * Fires after the current user is set.\n\t *\n\t * @since 2.0.1\n\t *\/\n\tdo_action( &#039;set_current_user&#039; );\n\n\treturn $current_user;\n}\nendif;\n\nif ( !function_exists(&#039;wp_get_current_user&#039;) ) :\n\/**\n * Retrieve the current user object.\n *\n * @since 2.0.3\n *\n * @return WP_User Current user WP_User object\n *\/\nfunction wp_get_current_user() {\n\tglobal $current_user;\n\n\tget_currentuserinfo();\n\n\treturn $current_user;\n}\nendif;\n\nif ( !function_exists(&#039;get_currentuserinfo&#039;) ) :\n\/**\n * Populate global variables with information about the currently logged in user.\n *\n * Will set the current user, if the current user is not set. The current user\n * will be set to the logged-in person. If no user is logged-in, then it will\n * set the current user to 0, which is invalid and won&#039;t have any permissions.\n *\n * @since 0.71\n *\n * @uses $current_user Checks if the current user is set\n *\n * @return null|false False on XML-RPC Request and invalid auth cookie. Null when current user set.\n *\/\nfunction get_currentuserinfo() {\n\tglobal $current_user;\n\n\tif ( ! empty( $current_user ) ) {\n\t\tif ( $current_user instanceof WP_User )\n\t\t\treturn;\n\n\t\t\/\/ Upgrade stdClass to WP_User\n\t\tif ( is_object( $current_user ) &amp;&amp; isset( $current_user-&gt;ID ) ) {\n\t\t\t$cur_id = $current_user-&gt;ID;\n\t\t\t$current_user = null;\n\t\t\twp_set_current_user( $cur_id );\n\t\t\treturn;\n\t\t}\n\n\t\t\/\/ $current_user has a junk value. Force to WP_User with ID 0.\n\t\t$current_user = null;\n\t\twp_set_current_user( 0 );\n\t\treturn false;\n\t}\n\n\tif ( defined(&#039;XMLRPC_REQUEST&#039;) &amp;&amp; XMLRPC_REQUEST ) {\n\t\twp_set_current_user( 0 );\n\t\treturn false;\n\t}\n\n\t\/**\n\t * Filter the current user.\n\t *\n\t * The default filters use this to determine the current user from the\n\t * request&#039;s cookies, if available.\n\t *\n\t * Returning a value of false will effectively short-circuit setting\n\t * the current user.\n\t *\n\t * @since 3.9.0\n\t *\n\t * @param int|bool $user_id User ID if one has been determined, false otherwise.\n\t *\/\n\t$user_id = apply_filters( &#039;determine_current_user&#039;, false );\n\tif ( ! $user_id ) {\n\t\twp_set_current_user( 0 );\n\t\treturn false;\n\t}\n\n\twp_set_current_user( $user_id );\n}\nendif;\n\nif ( !function_exists(&#039;get_userdata&#039;) ) :\n\/**\n * Retrieve user info by user ID.\n *\n * @since 0.71\n *\n * @param int $user_id User ID\n * @return WP_User|bool WP_User object on success, false on failure.\n *\/\nfunction get_userdata( $user_id ) {\n\treturn get_user_by( &#039;id&#039;, $user_id );\n}\nendif;\n\nif ( !function_exists(&#039;get_user_by&#039;) ) :\n\/**\n * Retrieve user info by a given field\n *\n * @since 2.8.0\n *\n * @param string $field The field to retrieve the user with. id | slug | email | login\n * @param int|string $value A value for $field. A user ID, slug, email address, or login name.\n * @return WP_User|bool WP_User object on success, false on failure.\n *\/\nfunction get_user_by( $field, $value ) {\n\t$userdata = WP_User::get_data_by( $field, $value );\n\n\tif ( !$userdata )\n\t\treturn false;\n\n\t$user = new WP_User;\n\t$user-&gt;init( $userdata );\n\n\treturn $user;\n}\nendif;\n\nif ( !function_exists(&#039;cache_users&#039;) ) :\n\/**\n * Retrieve info for user lists to prevent multiple queries by get_userdata()\n *\n * @since 3.0.0\n *\n * @param array $user_ids User ID numbers list\n *\/\nfunction cache_users( $user_ids ) {\n\tglobal $wpdb;\n\n\t$clean = _get_non_cached_ids( $user_ids, &#039;users&#039; );\n\n\tif ( empty( $clean ) )\n\t\treturn;\n\n\t$list = implode( &#039;,&#039;, $clean );\n\n\t$users = $wpdb-&gt;get_results( &quot;SELECT * FROM $wpdb-&gt;users WHERE ID IN ($list)&quot; );\n\n\t$ids = array();\n\tforeach ( $users as $user ) {\n\t\tupdate_user_caches( $user );\n\t\t$ids[] = $user-&gt;ID;\n\t}\n\tupdate_meta_cache( &#039;user&#039;, $ids );\n}\nendif;\n\nif ( !function_exists( &#039;wp_mail&#039; ) ) :\n\/**\n * Send mail, similar to PHP&#039;s mail\n *\n * A true return value does not automatically mean that the user received the\n * email successfully. It just only means that the method used was able to\n * process the request without any errors.\n *\n * Using the two &#039;wp_mail_from&#039; and &#039;wp_mail_from_name&#039; hooks allow from\n * creating a from address like &#039;Name &lt;email@address.com&gt;&#039; when both are set. If\n * just &#039;wp_mail_from&#039; is set, then just the email address will be used with no\n * name.\n *\n * The default content type is &#039;text\/plain&#039; which does not allow using HTML.\n * However, you can set the content type of the email by using the\n * &#039;wp_mail_content_type&#039; filter.\n *\n * The default charset is based on the charset used on the blog. The charset can\n * be set using the &#039;wp_mail_charset&#039; filter.\n *\n * @since 1.2.1\n *\n * @uses PHPMailer\n *\n * @param string|array $to Array or comma-separated list of email addresses to send message.\n * @param string $subject Email subject\n * @param string $message Message contents\n * @param string|array $headers Optional. Additional headers.\n * @param string|array $attachments Optional. Files to attach.\n * @return bool Whether the email contents were sent successfully.\n *\/\nfunction wp_mail( $to, $subject, $message, $headers = &#039;&#039;, $attachments = array() ) {\n\t\/\/ Compact the input, apply the filters, and extract them back out\n\n\t\/**\n\t * Filter the wp_mail() arguments.\n\t *\n\t * @since 2.2.0\n\t *\n\t * @param array $args A compacted array of wp_mail() arguments, including the &quot;to&quot; email,\n\t *                    subject, message, headers, and attachments values.\n\t *\/\n\t$atts = apply_filters( &#039;wp_mail&#039;, compact( &#039;to&#039;, &#039;subject&#039;, &#039;message&#039;, &#039;headers&#039;, &#039;attachments&#039; ) );\n\n\tif ( isset( $atts[&#039;to&#039;] ) ) {\n\t\t$to = $atts[&#039;to&#039;];\n\t}\n\n\tif ( isset( $atts[&#039;subject&#039;] ) ) {\n\t\t$subject = $atts[&#039;subject&#039;];\n\t}\n\n\tif ( isset( $atts[&#039;message&#039;] ) ) {\n\t\t$message = $atts[&#039;message&#039;];\n\t}\n\n\tif ( isset( $atts[&#039;headers&#039;] ) ) {\n\t\t$headers = $atts[&#039;headers&#039;];\n\t}\n\n\tif ( isset( $atts[&#039;attachments&#039;] ) ) {\n\t\t$attachments = $atts[&#039;attachments&#039;];\n\t}\n\n\tif ( ! is_array( $attachments ) ) {\n\t\t$attachments = explode( &quot;\\n&quot;, str_replace( &quot;\\r\\n&quot;, &quot;\\n&quot;, $attachments ) );\n\t}\n\tglobal $phpmailer;\n\n\t\/\/ (Re)create it, if it&#039;s gone missing\n\tif ( ! ( $phpmailer instanceof PHPMailer ) ) {\n\t\trequire_once ABSPATH . WPINC . &#039;\/class-phpmailer.php&#039;;\n\t\trequire_once ABSPATH . WPINC . &#039;\/class-smtp.php&#039;;\n\t\t$phpmailer = new PHPMailer( true );\n\t}\n\n\t\/\/ Headers\n\tif ( empty( $headers ) ) {\n\t\t$headers = array();\n\t} else {\n\t\tif ( !is_array( $headers ) ) {\n\t\t\t\/\/ Explode the headers out, so this function can take both\n\t\t\t\/\/ string headers and an array of headers.\n\t\t\t$tempheaders = explode( &quot;\\n&quot;, str_replace( &quot;\\r\\n&quot;, &quot;\\n&quot;, $headers ) );\n\t\t} else {\n\t\t\t$tempheaders = $headers;\n\t\t}\n\t\t$headers = array();\n\t\t$cc = array();\n\t\t$bcc = array();\n\n\t\t\/\/ If it&#039;s actually got contents\n\t\tif ( !empty( $tempheaders ) ) {\n\t\t\t\/\/ Iterate through the raw headers\n\t\t\tforeach ( (array) $tempheaders as $header ) {\n\t\t\t\tif ( strpos($header, &#039;:&#039;) === false ) {\n\t\t\t\t\tif ( false !== stripos( $header, &#039;boundary=&#039; ) ) {\n\t\t\t\t\t\t$parts = preg_split(&#039;\/boundary=\/i&#039;, trim( $header ) );\n\t\t\t\t\t\t$boundary = trim( str_replace( array( &quot;&#039;&quot;, &#039;&quot;&#039; ), &#039;&#039;, $parts[1] ) );\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\/\/ Explode them out\n\t\t\t\tlist( $name, $content ) = explode( &#039;:&#039;, trim( $header ), 2 );\n\n\t\t\t\t\/\/ Cleanup crew\n\t\t\t\t$name    = trim( $name    );\n\t\t\t\t$content = trim( $content );\n\n\t\t\t\tswitch ( strtolower( $name ) ) {\n\t\t\t\t\t\/\/ Mainly for legacy -- process a From: header if it&#039;s there\n\t\t\t\t\tcase &#039;from&#039;:\n\t\t\t\t\t\tif ( strpos($content, &#039;&lt;&#039; ) !== false ) {\n\t\t\t\t\t\t\t\/\/ So... making my life hard again?\n\t\t\t\t\t\t\t$from_name = substr( $content, 0, strpos( $content, &#039;&lt;&#039; ) - 1 );\n\t\t\t\t\t\t\t$from_name = str_replace( &#039;&quot;&#039;, &#039;&#039;, $from_name );\n\t\t\t\t\t\t\t$from_name = trim( $from_name );\n\n\t\t\t\t\t\t\t$from_email = substr( $content, strpos( $content, &#039;&lt;&#039; ) + 1 );\n\t\t\t\t\t\t\t$from_email = str_replace( &#039;&gt;&#039;, &#039;&#039;, $from_email );\n\t\t\t\t\t\t\t$from_email = trim( $from_email );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$from_email = trim( $content );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase &#039;content-type&#039;:\n\t\t\t\t\t\tif ( strpos( $content, &#039;;&#039; ) !== false ) {\n\t\t\t\t\t\t\tlist( $type, $charset ) = explode( &#039;;&#039;, $content );\n\t\t\t\t\t\t\t$content_type = trim( $type );\n\t\t\t\t\t\t\tif ( false !== stripos( $charset, &#039;charset=&#039; ) ) {\n\t\t\t\t\t\t\t\t$charset = trim( str_replace( array( &#039;charset=&#039;, &#039;&quot;&#039; ), &#039;&#039;, $charset ) );\n\t\t\t\t\t\t\t} elseif ( false !== stripos( $charset, &#039;boundary=&#039; ) ) {\n\t\t\t\t\t\t\t\t$boundary = trim( str_replace( array( &#039;BOUNDARY=&#039;, &#039;boundary=&#039;, &#039;&quot;&#039; ), &#039;&#039;, $charset ) );\n\t\t\t\t\t\t\t\t$charset = &#039;&#039;;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$content_type = trim( $content );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase &#039;cc&#039;:\n\t\t\t\t\t\t$cc = array_merge( (array) $cc, explode( &#039;,&#039;, $content ) );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase &#039;bcc&#039;:\n\t\t\t\t\t\t$bcc = array_merge( (array) $bcc, explode( &#039;,&#039;, $content ) );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t\/\/ Add it to our grand headers array\n\t\t\t\t\t\t$headers[trim( $name )] = trim( $content );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t\/\/ Empty out the values that may be set\n\t$phpmailer-&gt;ClearAllRecipients();\n\t$phpmailer-&gt;ClearAttachments();\n\t$phpmailer-&gt;ClearCustomHeaders();\n\t$phpmailer-&gt;ClearReplyTos();\n\n\t\/\/ From email and name\n\t\/\/ If we don&#039;t have a name from the input headers\n\tif ( !isset( $from_name ) )\n\t\t$from_name = &#039;WordPress&#039;;\n\n\t\/* If we don&#039;t have an email from the input headers default to wordpress@$sitename\n\t * Some hosts will block outgoing mail from this address if it doesn&#039;t exist but\n\t * there&#039;s no easy alternative. Defaulting to admin_email might appear to be another\n\t * option but some hosts may refuse to relay mail from an unknown domain. See\n\t * https:\/\/core.trac.wordpress.org\/ticket\/5007.\n\t *\/\n\n\tif ( !isset( $from_email ) ) {\n\t\t\/\/ Get the site domain and get rid of www.\n\t\t$sitename = strtolower( $_SERVER[&#039;SERVER_NAME&#039;] );\n\t\tif ( substr( $sitename, 0, 4 ) == &#039;www.&#039; ) {\n\t\t\t$sitename = substr( $sitename, 4 );\n\t\t}\n\n\t\t$from_email = &#039;wordpress@&#039; . $sitename;\n\t}\n\n\t\/**\n\t * Filter the email address to send from.\n\t *\n\t * @since 2.2.0\n\t *\n\t * @param string $from_email Email address to send from.\n\t *\/\n\t$phpmailer-&gt;From = apply_filters( &#039;wp_mail_from&#039;, $from_email );\n\n\t\/**\n\t * Filter the name to associate with the &quot;from&quot; email address.\n\t *\n\t * @since 2.3.0\n\t *\n\t * @param string $from_name Name associated with the &quot;from&quot; email address.\n\t *\/\n\t$phpmailer-&gt;FromName = apply_filters( &#039;wp_mail_from_name&#039;, $from_name );\n\n\t\/\/ Set destination addresses\n\tif ( !is_array( $to ) )\n\t\t$to = explode( &#039;,&#039;, $to );\n\n\tforeach ( (array) $to as $recipient ) {\n\t\ttry {\n\t\t\t\/\/ Break $recipient into name and address parts if in the format &quot;Foo &lt;bar@baz.com&gt;&quot;\n\t\t\t$recipient_name = &#039;&#039;;\n\t\t\tif( preg_match( &#039;\/(.*)&lt;(.+)&gt;\/&#039;, $recipient, $matches ) ) {\n\t\t\t\tif ( count( $matches ) == 3 ) {\n\t\t\t\t\t$recipient_name = $matches[1];\n\t\t\t\t\t$recipient = $matches[2];\n\t\t\t\t}\n\t\t\t}\n\t\t\t$phpmailer-&gt;AddAddress( $recipient, $recipient_name);\n\t\t} catch ( phpmailerException $e ) {\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\t\/\/ Set mail&#039;s subject and body\n\t$phpmailer-&gt;Subject = $subject;\n\t$phpmailer-&gt;Body    = $message;\n\n\t\/\/ Add any CC and BCC recipients\n\tif ( !empty( $cc ) ) {\n\t\tforeach ( (array) $cc as $recipient ) {\n\t\t\ttry {\n\t\t\t\t\/\/ Break $recipient into name and address parts if in the format &quot;Foo &lt;bar@baz.com&gt;&quot;\n\t\t\t\t$recipient_name = &#039;&#039;;\n\t\t\t\tif( preg_match( &#039;\/(.*)&lt;(.+)&gt;\/&#039;, $recipient, $matches ) ) {\n\t\t\t\t\tif ( count( $matches ) == 3 ) {\n\t\t\t\t\t\t$recipient_name = $matches[1];\n\t\t\t\t\t\t$recipient = $matches[2];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$phpmailer-&gt;AddCc( $recipient, $recipient_name );\n\t\t\t} catch ( phpmailerException $e ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( !empty( $bcc ) ) {\n\t\tforeach ( (array) $bcc as $recipient) {\n\t\t\ttry {\n\t\t\t\t\/\/ Break $recipient into name and address parts if in the format &quot;Foo &lt;bar@baz.com&gt;&quot;\n\t\t\t\t$recipient_name = &#039;&#039;;\n\t\t\t\tif( preg_match( &#039;\/(.*)&lt;(.+)&gt;\/&#039;, $recipient, $matches ) ) {\n\t\t\t\t\tif ( count( $matches ) == 3 ) {\n\t\t\t\t\t\t$recipient_name = $matches[1];\n\t\t\t\t\t\t$recipient = $matches[2];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$phpmailer-&gt;AddBcc( $recipient, $recipient_name );\n\t\t\t} catch ( phpmailerException $e ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t}\n\n\t\/\/ Set to use PHP&#039;s mail()\n\t$phpmailer-&gt;IsMail();\n\n\t\/\/ Set Content-Type and charset\n\t\/\/ If we don&#039;t have a content-type from the input headers\n\tif ( !isset( $content_type ) )\n\t\t$content_type = &#039;text\/plain&#039;;\n\n\t\/**\n\t * Filter the wp_mail() content type.\n\t *\n\t * @since 2.3.0\n\t *\n\t * @param string $content_type Default wp_mail() content type.\n\t *\/\n\t$content_type = apply_filters( &#039;wp_mail_content_type&#039;, $content_type );\n\n\t$phpmailer-&gt;ContentType = $content_type;\n\n\t\/\/ Set whether it&#039;s plaintext, depending on $content_type\n\tif ( &#039;text\/html&#039; == $content_type )\n\t\t$phpmailer-&gt;IsHTML( true );\n\n\t\/\/ If we don&#039;t have a charset from the input headers\n\tif ( !isset( $charset ) )\n\t\t$charset = get_bloginfo( &#039;charset&#039; );\n\n\t\/\/ Set the content-type and charset\n\n\t\/**\n\t * Filter the default wp_mail() charset.\n\t *\n\t * @since 2.3.0\n\t *\n\t * @param string $charset Default email charset.\n\t *\/\n\t$phpmailer-&gt;CharSet = apply_filters( &#039;wp_mail_charset&#039;, $charset );\n\n\t\/\/ Set custom headers\n\tif ( !empty( $headers ) ) {\n\t\tforeach( (array) $headers as $name =&gt; $content ) {\n\t\t\t$phpmailer-&gt;AddCustomHeader( sprintf( &#039;%1$s: %2$s&#039;, $name, $content ) );\n\t\t}\n\n\t\tif ( false !== stripos( $content_type, &#039;multipart&#039; ) &amp;&amp; ! empty($boundary) )\n\t\t\t$phpmailer-&gt;AddCustomHeader( sprintf( &quot;Content-Type: %s;\\n\\t boundary=\\&quot;%s\\&quot;&quot;, $content_type, $boundary ) );\n\t}\n\n\tif ( !empty( $attachments ) ) {\n\t\tforeach ( $attachments as $attachment ) {\n\t\t\ttry {\n\t\t\t\t$phpmailer-&gt;AddAttachment($attachment);\n\t\t\t} catch ( phpmailerException $e ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t}\n\n\t\/**\n\t * Fires after PHPMailer is initialized.\n\t *\n\t * @since 2.2.0\n\t *\n\t * @param PHPMailer &amp;$phpmailer The PHPMailer instance, passed by reference.\n\t *\/\n\tdo_action_ref_array( &#039;phpmailer_init&#039;, array( &amp;$phpmailer ) );\n\n\t\/\/ Send!\n\ttry {\n\t\treturn $phpmailer-&gt;Send();\n\t} catch ( phpmailerException $e ) {\n\t\treturn false;\n\t}\n}\nendif;\n\nif ( !function_exists(&#039;wp_authenticate&#039;) ) :\n\/**\n * Checks a user&#039;s login information and logs them in if it checks out.\n *\n * @since 2.5.0\n *\n * @param string $username User&#039;s username\n * @param string $password User&#039;s password\n * @return WP_User|WP_Error WP_User object if login successful, otherwise WP_Error object.\n *\/\nfunction wp_authenticate($username, $password) {\n\t$username = sanitize_user($username);\n\t$password = trim($password);\n\n\t\/**\n\t * Filter the user to authenticate.\n\t *\n\t * If a non-null value is passed, the filter will effectively short-circuit\n\t * authentication, returning an error instead.\n\t *\n\t * @since 2.8.0\n\t *\n\t * @param null|WP_User $user     User to authenticate.\n\t * @param string       $username User login.\n\t * @param string       $password User password\n\t *\/\n\t$user = apply_filters( &#039;authenticate&#039;, null, $username, $password );\n\n\tif ( $user == null ) {\n\t\t\/\/ TODO what should the error message be? (Or would these even happen?)\n\t\t\/\/ Only needed if all authentication handlers fail to return anything.\n\t\t$user = new WP_Error(&#039;authentication_failed&#039;, __(&#039;&lt;strong&gt;ERROR&lt;\/strong&gt;: Invalid username or incorrect password.&#039;));\n\t}\n\n\t$ignore_codes = array(&#039;empty_username&#039;, &#039;empty_password&#039;);\n\n\tif (is_wp_error($user) &amp;&amp; !in_array($user-&gt;get_error_code(), $ignore_codes) ) {\n\t\t\/**\n\t\t * Fires after a user login has failed.\n\t\t *\n\t\t * @since 2.5.0\n\t\t *\n\t\t * @param string $username User login.\n\t\t *\/\n\t\tdo_action( &#039;wp_login_failed&#039;, $username );\n\t}\n\n\treturn $user;\n}\nendif;\n\nif ( !function_exists(&#039;wp_logout&#039;) ) :\n\/**\n * Log the current user out.\n *\n * @since 2.5.0\n *\/\nfunction wp_logout() {\n\twp_destroy_current_session();\n\twp_clear_auth_cookie();\n\n\t\/**\n\t * Fires after a user is logged-out.\n\t *\n\t * @since 1.5.0\n\t *\/\n\tdo_action( &#039;wp_logout&#039; );\n}\nendif;\n\nif ( !function_exists(&#039;wp_validate_auth_cookie&#039;) ) :\n\/**\n * Validates authentication cookie.\n *\n * The checks include making sure that the authentication cookie is set and\n * pulling in the contents (if $cookie is not used).\n *\n * Makes sure the cookie is not expired. Verifies the hash in cookie is what is\n * should be and compares the two.\n *\n * @since 2.5.0\n *\n * @param string $cookie Optional. If used, will validate contents instead of cookie&#039;s\n * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in\n * @return bool|int False if invalid cookie, User ID if valid.\n *\/\nfunction wp_validate_auth_cookie($cookie = &#039;&#039;, $scheme = &#039;&#039;) {\n\tif ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme) ) {\n\t\t\/**\n\t\t * Fires if an authentication cookie is malformed.\n\t\t *\n\t\t * @since 2.7.0\n\t\t *\n\t\t * @param string $cookie Malformed auth cookie.\n\t\t * @param string $scheme Authentication scheme. Values include &#039;auth&#039;, &#039;secure_auth&#039;,\n\t\t *                       or &#039;logged_in&#039;.\n\t\t *\/\n\t\tdo_action( &#039;auth_cookie_malformed&#039;, $cookie, $scheme );\n\t\treturn false;\n\t}\n\n\t$scheme = $cookie_elements[&#039;scheme&#039;];\n\t$username = $cookie_elements[&#039;username&#039;];\n\t$hmac = $cookie_elements[&#039;hmac&#039;];\n\t$token = $cookie_elements[&#039;token&#039;];\n\t$expired = $expiration = $cookie_elements[&#039;expiration&#039;];\n\n\t\/\/ Allow a grace period for POST and AJAX requests\n\tif ( defined(&#039;DOING_AJAX&#039;) || &#039;POST&#039; == $_SERVER[&#039;REQUEST_METHOD&#039;] ) {\n\t\t$expired += HOUR_IN_SECONDS;\n\t}\n\n\t\/\/ Quick check to see if an honest cookie has expired\n\tif ( $expired &lt; time() ) {\n\t\t\/**\n\t\t * Fires once an authentication cookie has expired.\n\t\t *\n\t\t * @since 2.7.0\n\t\t *\n\t\t * @param array $cookie_elements An array of data for the authentication cookie.\n\t\t *\/\n\t\tdo_action( &#039;auth_cookie_expired&#039;, $cookie_elements );\n\t\treturn false;\n\t}\n\n\t$user = get_user_by(&#039;login&#039;, $username);\n\tif ( ! $user ) {\n\t\t\/**\n\t\t * Fires if a bad username is entered in the user authentication process.\n\t\t *\n\t\t * @since 2.7.0\n\t\t *\n\t\t * @param array $cookie_elements An array of data for the authentication cookie.\n\t\t *\/\n\t\tdo_action( &#039;auth_cookie_bad_username&#039;, $cookie_elements );\n\t\treturn false;\n\t}\n\n\t$pass_frag = substr($user-&gt;user_pass, 8, 4);\n\n\t$key = wp_hash( $username . &#039;|&#039; . $pass_frag . &#039;|&#039; . $expiration . &#039;|&#039; . $token, $scheme );\n\n\t\/\/ If ext\/hash is not present, compat.php&#039;s hash_hmac() does not support sha256.\n\t$algo = function_exists( &#039;hash&#039; ) ? &#039;sha256&#039; : &#039;sha1&#039;;\n\t$hash = hash_hmac( $algo, $username . &#039;|&#039; . $expiration . &#039;|&#039; . $token, $key );\n\n\tif ( ! hash_equals( $hash, $hmac ) ) {\n\t\t\/**\n\t\t * Fires if a bad authentication cookie hash is encountered.\n\t\t *\n\t\t * @since 2.7.0\n\t\t *\n\t\t * @param array $cookie_elements An array of data for the authentication cookie.\n\t\t *\/\n\t\tdo_action( &#039;auth_cookie_bad_hash&#039;, $cookie_elements );\n\t\treturn false;\n\t}\n\n\t$manager = WP_Session_Tokens::get_instance( $user-&gt;ID );\n\tif ( ! $manager-&gt;verify( $token ) ) {\n\t\tdo_action( &#039;auth_cookie_bad_session_token&#039;, $cookie_elements );\n\t\treturn false;\n\t}\n\n\t\/\/ AJAX\/POST grace period set above\n\tif ( $expiration &lt; time() ) {\n\t\t$GLOBALS[&#039;login_grace_period&#039;] = 1;\n\t}\n\n\t\/**\n\t * Fires once an authentication cookie has been validated.\n\t *\n\t * @since 2.7.0\n\t *\n\t * @param array   $cookie_elements An array of data for the authentication cookie.\n\t * @param WP_User $user            User object.\n\t *\/\n\tdo_action( &#039;auth_cookie_valid&#039;, $cookie_elements, $user );\n\n\treturn $user-&gt;ID;\n}\nendif;\n\nif ( !function_exists(&#039;wp_generate_auth_cookie&#039;) ) :\n\/**\n * Generate authentication cookie contents.\n *\n * @since 2.5.0\n *\n * @param int $user_id User ID\n * @param int $expiration Cookie expiration in seconds\n * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in\n * @param string $token User&#039;s session token to use for this cookie\n * @return string Authentication cookie contents. Empty string if user does not exist.\n *\/\nfunction wp_generate_auth_cookie( $user_id, $expiration, $scheme = &#039;auth&#039;, $token = &#039;&#039; ) {\n\t$user = get_userdata($user_id);\n\tif ( ! $user ) {\n\t\treturn &#039;&#039;;\n\t}\n\n\tif ( ! $token ) {\n\t\t$manager = WP_Session_Tokens::get_instance( $user_id );\n\t\t$token = $manager-&gt;create( $expiration );\n\t}\n\n\t$pass_frag = substr($user-&gt;user_pass, 8, 4);\n\n\t$key = wp_hash( $user-&gt;user_login . &#039;|&#039; . $pass_frag . &#039;|&#039; . $expiration . &#039;|&#039; . $token, $scheme );\n\n\t\/\/ If ext\/hash is not present, compat.php&#039;s hash_hmac() does not support sha256.\n\t$algo = function_exists( &#039;hash&#039; ) ? &#039;sha256&#039; : &#039;sha1&#039;;\n\t$hash = hash_hmac( $algo, $user-&gt;user_login . &#039;|&#039; . $expiration . &#039;|&#039; . $token, $key );\n\n\t$cookie = $user-&gt;user_login . &#039;|&#039; . $expiration . &#039;|&#039; . $token . &#039;|&#039; . $hash;\n\n\t\/**\n\t * Filter the authentication cookie.\n\t *\n\t * @since 2.5.0\n\t *\n\t * @param string $cookie     Authentication cookie.\n\t * @param int    $user_id    User ID.\n\t * @param int    $expiration Authentication cookie expiration in seconds.\n\t * @param string $scheme     Cookie scheme used. Accepts &#039;auth&#039;, &#039;secure_auth&#039;, or &#039;logged_in&#039;.\n\t * @param string $token      User&#039;s session token used.\n\t *\/\n\treturn apply_filters( &#039;auth_cookie&#039;, $cookie, $user_id, $expiration, $scheme, $token );\n}\nendif;\n\nif ( !function_exists(&#039;wp_parse_auth_cookie&#039;) ) :\n\/**\n * Parse a cookie into its components\n *\n * @since 2.7.0\n *\n * @param string $cookie\n * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in\n * @return array Authentication cookie components\n *\/\nfunction wp_parse_auth_cookie($cookie = &#039;&#039;, $scheme = &#039;&#039;) {\n\tif ( empty($cookie) ) {\n\t\tswitch ($scheme){\n\t\t\tcase &#039;auth&#039;:\n\t\t\t\t$cookie_name = AUTH_COOKIE;\n\t\t\t\tbreak;\n\t\t\tcase &#039;secure_auth&#039;:\n\t\t\t\t$cookie_name = SECURE_AUTH_COOKIE;\n\t\t\t\tbreak;\n\t\t\tcase &quot;logged_in&quot;:\n\t\t\t\t$cookie_name = LOGGED_IN_COOKIE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif ( is_ssl() ) {\n\t\t\t\t\t$cookie_name = SECURE_AUTH_COOKIE;\n\t\t\t\t\t$scheme = &#039;secure_auth&#039;;\n\t\t\t\t} else {\n\t\t\t\t\t$cookie_name = AUTH_COOKIE;\n\t\t\t\t\t$scheme = &#039;auth&#039;;\n\t\t\t\t}\n\t    }\n\n\t\tif ( empty($_COOKIE[$cookie_name]) )\n\t\t\treturn false;\n\t\t$cookie = $_COOKIE[$cookie_name];\n\t}\n\n\t$cookie_elements = explode(&#039;|&#039;, $cookie);\n\tif ( count( $cookie_elements ) !== 4 ) {\n\t\treturn false;\n\t}\n\n\tlist( $username, $expiration, $token, $hmac ) = $cookie_elements;\n\n\treturn compact( &#039;username&#039;, &#039;expiration&#039;, &#039;token&#039;, &#039;hmac&#039;, &#039;scheme&#039; );\n}\nendif;\n\nif ( !function_exists(&#039;wp_set_auth_cookie&#039;) ) :\n\/**\n * Sets the authentication cookies based on user ID.\n *\n * The $remember parameter increases the time that the cookie will be kept. The\n * default the cookie is kept without remembering is two days. When $remember is\n * set, the cookies will be kept for 14 days or two weeks.\n *\n * @since 2.5.0\n *\n * @param int $user_id User ID\n * @param bool $remember Whether to remember the user\n * @param mixed $secure  Whether the admin cookies should only be sent over HTTPS.\n *                       Default is_ssl().\n *\/\nfunction wp_set_auth_cookie($user_id, $remember = false, $secure = &#039;&#039;) {\n\tif ( $remember ) {\n\t\t\/**\n\t\t * Filter the duration of the authentication cookie expiration period.\n\t\t *\n\t\t * @since 2.8.0\n\t\t *\n\t\t * @param int  $length   Duration of the expiration period in seconds.\n\t\t * @param int  $user_id  User ID.\n\t\t * @param bool $remember Whether to remember the user login. Default false.\n\t\t *\/\n\t\t$expiration = time() + apply_filters( &#039;auth_cookie_expiration&#039;, 14 * DAY_IN_SECONDS, $user_id, $remember );\n\n\t\t\/*\n\t\t * Ensure the browser will continue to send the cookie after the expiration time is reached.\n\t\t * Needed for the login grace period in wp_validate_auth_cookie().\n\t\t *\/\n\t\t$expire = $expiration + ( 12 * HOUR_IN_SECONDS );\n\t} else {\n\t\t\/** This filter is documented in wp-includes\/pluggable.php *\/\n\t\t$expiration = time() + apply_filters( &#039;auth_cookie_expiration&#039;, 2 * DAY_IN_SECONDS, $user_id, $remember );\n\t\t$expire = 0;\n\t}\n\n\tif ( &#039;&#039; === $secure ) {\n\t\t$secure = is_ssl();\n\t}\n\n\t\/\/ Frontend cookie is secure when the auth cookie is secure and the site&#039;s home URL is forced HTTPS.\n\t$secure_logged_in_cookie = $secure &amp;&amp; &#039;https&#039; === parse_url( get_option( &#039;home&#039; ), PHP_URL_SCHEME );\n\n\t\/**\n\t * Filter whether the connection is secure.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param bool $secure  Whether the connection is secure.\n\t * @param int  $user_id User ID.\n\t *\/\n\t$secure = apply_filters( &#039;secure_auth_cookie&#039;, $secure, $user_id );\n\n\t\/**\n\t * Filter whether to use a secure cookie when logged-in.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param bool $secure_logged_in_cookie Whether to use a secure cookie when logged-in.\n\t * @param int  $user_id                 User ID.\n\t * @param bool $secure                  Whether the connection is secure.\n\t *\/\n\t$secure_logged_in_cookie = apply_filters( &#039;secure_logged_in_cookie&#039;, $secure_logged_in_cookie, $user_id, $secure );\n\n\tif ( $secure ) {\n\t\t$auth_cookie_name = SECURE_AUTH_COOKIE;\n\t\t$scheme = &#039;secure_auth&#039;;\n\t} else {\n\t\t$auth_cookie_name = AUTH_COOKIE;\n\t\t$scheme = &#039;auth&#039;;\n\t}\n\n\t$manager = WP_Session_Tokens::get_instance( $user_id );\n\t$token = $manager-&gt;create( $expiration );\n\n\t$auth_cookie = wp_generate_auth_cookie( $user_id, $expiration, $scheme, $token );\n\t$logged_in_cookie = wp_generate_auth_cookie( $user_id, $expiration, &#039;logged_in&#039;, $token );\n\n\t\/**\n\t * Fires immediately before the authentication cookie is set.\n\t *\n\t * @since 2.5.0\n\t *\n\t * @param string $auth_cookie Authentication cookie.\n\t * @param int    $expire      Login grace period in seconds. Default 43,200 seconds, or 12 hours.\n\t * @param int    $expiration  Duration in seconds the authentication cookie should be valid.\n\t *                            Default 1,209,600 seconds, or 14 days.\n\t * @param int    $user_id     User ID.\n\t * @param string $scheme      Authentication scheme. Values include &#039;auth&#039;, &#039;secure_auth&#039;, or &#039;logged_in&#039;.\n\t *\/\n\tdo_action( &#039;set_auth_cookie&#039;, $auth_cookie, $expire, $expiration, $user_id, $scheme );\n\n\t\/**\n\t * Fires immediately before the secure authentication cookie is set.\n\t *\n\t * @since 2.6.0\n\t *\n\t * @param string $logged_in_cookie The logged-in cookie.\n\t * @param int    $expire           Login grace period in seconds. Default 43,200 seconds, or 12 hours.\n\t * @param int    $expiration       Duration in seconds the authentication cookie should be valid.\n\t *                                 Default 1,209,600 seconds, or 14 days.\n\t * @param int    $user_id          User ID.\n\t * @param string $scheme           Authentication scheme. Default &#039;logged_in&#039;.\n\t *\/\n\tdo_action( &#039;set_logged_in_cookie&#039;, $logged_in_cookie, $expire, $expiration, $user_id, &#039;logged_in&#039; );\n\n\tsetcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);\n\tsetcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);\n\tsetcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);\n\tif ( COOKIEPATH != SITECOOKIEPATH )\n\t\tsetcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);\n}\nendif;\n\nif ( !function_exists(&#039;wp_clear_auth_cookie&#039;) ) :\n\/**\n * Removes all of the cookies associated with authentication.\n *\n * @since 2.5.0\n *\/\nfunction wp_clear_auth_cookie() {\n\t\/**\n\t * Fires just before the authentication cookies are cleared.\n\t *\n\t * @since 2.7.0\n\t *\/\n\tdo_action( &#039;clear_auth_cookie&#039; );\n\n\tsetcookie( AUTH_COOKIE,        &#039; &#039;, time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );\n\tsetcookie( SECURE_AUTH_COOKIE, &#039; &#039;, time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );\n\tsetcookie( AUTH_COOKIE,        &#039; &#039;, time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );\n\tsetcookie( SECURE_AUTH_COOKIE, &#039; &#039;, time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );\n\tsetcookie( LOGGED_IN_COOKIE,   &#039; &#039;, time() - YEAR_IN_SECONDS, COOKIEPATH,          COOKIE_DOMAIN );\n\tsetcookie( LOGGED_IN_COOKIE,   &#039; &#039;, time() - YEAR_IN_SECONDS, SITECOOKIEPATH,      COOKIE_DOMAIN );\n\n\t\/\/ Old cookies\n\tsetcookie( AUTH_COOKIE,        &#039; &#039;, time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );\n\tsetcookie( AUTH_COOKIE,        &#039; &#039;, time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );\n\tsetcookie( SECURE_AUTH_COOKIE, &#039; &#039;, time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );\n\tsetcookie( SECURE_AUTH_COOKIE, &#039; &#039;, time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );\n\n\t\/\/ Even older cookies\n\tsetcookie( USER_COOKIE, &#039; &#039;, time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );\n\tsetcookie( PASS_COOKIE, &#039; &#039;, time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );\n\tsetcookie( USER_COOKIE, &#039; &#039;, time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );\n\tsetcookie( PASS_COOKIE, &#039; &#039;, time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );\n}\nendif;\n\nif ( !function_exists(&#039;is_user_logged_in&#039;) ) :\n\/**\n * Checks if the current visitor is a logged in user.\n *\n * @since 2.0.0\n *\n * @return bool True if user is logged in, false if not logged in.\n *\/\nfunction is_user_logged_in() {\n\t$user = wp_get_current_user();\n\n\tif ( ! $user-&gt;exists() )\n\t\treturn false;\n\n\treturn true;\n}\nendif;\n\nif ( !function_exists(&#039;auth_redirect&#039;) ) :\n\/**\n * Checks if a user is logged in, if not it redirects them to the login page.\n *\n * @since 1.5.0\n *\/\nfunction auth_redirect() {\n\t\/\/ Checks if a user is logged in, if not redirects them to the login page\n\n\t$secure = ( is_ssl() || force_ssl_admin() );\n\n\t\/**\n\t * Filter whether to use a secure authentication redirect.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param bool $secure Whether to use a secure authentication redirect. Default false.\n\t *\/\n\t$secure = apply_filters( &#039;secure_auth_redirect&#039;, $secure );\n\n\t\/\/ If https is required and request is http, redirect\n\tif ( $secure &amp;&amp; !is_ssl() &amp;&amp; false !== strpos($_SERVER[&#039;REQUEST_URI&#039;], &#039;wp-admin&#039;) ) {\n\t\tif ( 0 === strpos( $_SERVER[&#039;REQUEST_URI&#039;], &#039;http&#039; ) ) {\n\t\t\twp_redirect( set_url_scheme( $_SERVER[&#039;REQUEST_URI&#039;], &#039;https&#039; ) );\n\t\t\texit();\n\t\t} else {\n\t\t\twp_redirect( &#039;https:\/\/&#039; . $_SERVER[&#039;HTTP_HOST&#039;] . $_SERVER[&#039;REQUEST_URI&#039;] );\n\t\t\texit();\n\t\t}\n\t}\n\n\tif ( is_user_admin() ) {\n\t\t$scheme = &#039;logged_in&#039;;\n\t} else {\n\t\t\/**\n\t\t * Filter the authentication redirect scheme.\n\t\t *\n\t\t * @since 2.9.0\n\t\t *\n\t\t * @param string $scheme Authentication redirect scheme. Default empty.\n\t\t *\/\n\t\t$scheme = apply_filters( &#039;auth_redirect_scheme&#039;, &#039;&#039; );\n\t}\n\n\tif ( $user_id = wp_validate_auth_cookie( &#039;&#039;,  $scheme) ) {\n\t\t\/**\n\t\t * Fires before the authentication redirect.\n\t\t *\n\t\t * @since 2.8.0\n\t\t *\n\t\t * @param int $user_id User ID.\n\t\t *\/\n\t\tdo_action( &#039;auth_redirect&#039;, $user_id );\n\n\t\t\/\/ If the user wants ssl but the session is not ssl, redirect.\n\t\tif ( !$secure &amp;&amp; get_user_option(&#039;use_ssl&#039;, $user_id) &amp;&amp; false !== strpos($_SERVER[&#039;REQUEST_URI&#039;], &#039;wp-admin&#039;) ) {\n\t\t\tif ( 0 === strpos( $_SERVER[&#039;REQUEST_URI&#039;], &#039;http&#039; ) ) {\n\t\t\t\twp_redirect( set_url_scheme( $_SERVER[&#039;REQUEST_URI&#039;], &#039;https&#039; ) );\n\t\t\t\texit();\n\t\t\t} else {\n\t\t\t\twp_redirect( &#039;https:\/\/&#039; . $_SERVER[&#039;HTTP_HOST&#039;] . $_SERVER[&#039;REQUEST_URI&#039;] );\n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\n\t\treturn;  \/\/ The cookie is good so we&#039;re done\n\t}\n\n\t\/\/ The cookie is no good so force login\n\tnocache_headers();\n\n\t$redirect = ( strpos( $_SERVER[&#039;REQUEST_URI&#039;], &#039;\/options.php&#039; ) &amp;&amp; wp_get_referer() ) ? wp_get_referer() : set_url_scheme( &#039;http:\/\/&#039; . $_SERVER[&#039;HTTP_HOST&#039;] . $_SERVER[&#039;REQUEST_URI&#039;] );\n\n\t$login_url = wp_login_url($redirect, true);\n\n\twp_redirect($login_url);\n\texit();\n}\nendif;\n\nif ( !function_exists(&#039;check_admin_referer&#039;) ) :\n\/**\n * Makes sure that a user was referred from another admin page.\n *\n * To avoid security exploits.\n *\n * @since 1.2.0\n *\n * @param int|string $action    Action nonce\n * @param string     $query_arg Where to look for nonce in $_REQUEST (since 2.5)\n *\/\nfunction check_admin_referer($action = -1, $query_arg = &#039;_wpnonce&#039;) {\n\tif ( -1 == $action )\n\t\t_doing_it_wrong( __FUNCTION__, __( &#039;You should specify a nonce action to be verified by using the first parameter.&#039; ), &#039;3.2&#039; );\n\n\t$adminurl = strtolower(admin_url());\n\t$referer = strtolower(wp_get_referer());\n\t$result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false;\n\tif ( !$result &amp;&amp; !(-1 == $action &amp;&amp; strpos($referer, $adminurl) === 0) ) {\n\t\twp_nonce_ays($action);\n\t\tdie();\n\t}\n\n\t\/**\n\t * Fires once the admin request has been validated or not.\n\t *\n\t * @since 1.5.1\n\t *\n\t * @param string $action The nonce action.\n\t * @param bool   $result Whether the admin request nonce was validated.\n\t *\/\n\tdo_action( &#039;check_admin_referer&#039;, $action, $result );\n\treturn $result;\n}\nendif;\n\nif ( !function_exists(&#039;check_ajax_referer&#039;) ) :\n\/**\n * Verifies the AJAX request to prevent processing requests external of the blog.\n *\n * @since 2.0.3\n *\n * @param int|string $action    Action nonce\n * @param string     $query_arg Where to look for nonce in $_REQUEST (since 2.5)\n *\/\nfunction check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {\n\t$nonce = &#039;&#039;;\n\n\tif ( $query_arg &amp;&amp; isset( $_REQUEST[ $query_arg ] ) )\n\t\t$nonce = $_REQUEST[ $query_arg ];\n\telseif ( isset( $_REQUEST[&#039;_ajax_nonce&#039;] ) )\n\t\t$nonce = $_REQUEST[&#039;_ajax_nonce&#039;];\n\telseif ( isset( $_REQUEST[&#039;_wpnonce&#039;] ) )\n\t\t$nonce = $_REQUEST[&#039;_wpnonce&#039;];\n\n\t$result = wp_verify_nonce( $nonce, $action );\n\n\tif ( $die &amp;&amp; false == $result ) {\n\t\tif ( defined( &#039;DOING_AJAX&#039; ) &amp;&amp; DOING_AJAX )\n\t\t\twp_die( -1 );\n\t\telse\n\t\t\tdie( &#039;-1&#039; );\n\t}\n\n\t\/**\n\t * Fires once the AJAX request has been validated or not.\n\t *\n\t * @since 2.1.0\n\t *\n\t * @param string $action The AJAX nonce action.\n\t * @param bool   $result Whether the AJAX request nonce was validated.\n\t *\/\n\tdo_action( &#039;check_ajax_referer&#039;, $action, $result );\n\n\treturn $result;\n}\nendif;\n\nif ( !function_exists(&#039;wp_redirect&#039;) ) :\n\/**\n * Redirects to another page.\n *\n * @since 1.5.1\n *\n * @param string $location The path to redirect to.\n * @param int $status Status code to use.\n * @return bool False if $location is not provided, true otherwise.\n *\/\nfunction wp_redirect($location, $status = 302) {\n\tglobal $is_IIS;\n\n\t\/**\n\t * Filter the redirect location.\n\t *\n\t * @since 2.1.0\n\t *\n\t * @param string $location The path to redirect to.\n\t * @param int    $status   Status code to use.\n\t *\/\n\t$location = apply_filters( &#039;wp_redirect&#039;, $location, $status );\n\n\t\/**\n\t * Filter the redirect status code.\n\t *\n\t * @since 2.3.0\n\t *\n\t * @param int    $status   Status code to use.\n\t * @param string $location The path to redirect to.\n\t *\/\n\t$status = apply_filters( &#039;wp_redirect_status&#039;, $status, $location );\n\n\tif ( ! $location )\n\t\treturn false;\n\n\t$location = wp_sanitize_redirect($location);\n\n\tif ( !$is_IIS &amp;&amp; PHP_SAPI != &#039;cgi-fcgi&#039; )\n\t\tstatus_header($status); \/\/ This causes problems on IIS and some FastCGI setups\n\n\theader(&quot;Location: $location&quot;, true, $status);\n\n\treturn true;\n}\nendif;\n\nif ( !function_exists(&#039;wp_sanitize_redirect&#039;) ) :\n\/**\n * Sanitizes a URL for use in a redirect.\n *\n * @since 2.3.0\n *\n * @return string redirect-sanitized URL\n **\/\nfunction wp_sanitize_redirect($location) {\n\t$location = preg_replace(&#039;|[^a-z0-9-~+_.?#=&amp;;,\/:%!*\\[\\]()]|i&#039;, &#039;&#039;, $location);\n\t$location = wp_kses_no_null($location);\n\n\t\/\/ remove %0d and %0a from location\n\t$strip = array(&#039;%0d&#039;, &#039;%0a&#039;, &#039;%0D&#039;, &#039;%0A&#039;);\n\t$location = _deep_replace($strip, $location);\n\treturn $location;\n}\nendif;\n\nif ( !function_exists(&#039;wp_safe_redirect&#039;) ) :\n\/**\n * Performs a safe (local) redirect, using wp_redirect().\n *\n * Checks whether the $location is using an allowed host, if it has an absolute\n * path. A plugin can therefore set or remove allowed host(s) to or from the\n * list.\n *\n * If the host is not allowed, then the redirect is to wp-admin on the siteurl\n * instead. This prevents malicious redirects which redirect to another host,\n * but only used in a few places.\n *\n * @since 2.3.0\n *\n * @return void Does not return anything\n **\/\nfunction wp_safe_redirect($location, $status = 302) {\n\n\t\/\/ Need to look at the URL the way it will end up in wp_redirect()\n\t$location = wp_sanitize_redirect($location);\n\n\t$location = wp_validate_redirect($location, admin_url());\n\n\twp_redirect($location, $status);\n}\nendif;\n\nif ( !function_exists(&#039;wp_validate_redirect&#039;) ) :\n\/**\n * Validates a URL for use in a redirect.\n *\n * Checks whether the $location is using an allowed host, if it has an absolute\n * path. A plugin can therefore set or remove allowed host(s) to or from the\n * list.\n *\n * If the host is not allowed, then the redirect is to $default supplied\n *\n * @since 2.8.1\n *\n * @param string $location The redirect to validate\n * @param string $default The value to return if $location is not allowed\n * @return string redirect-sanitized URL\n **\/\nfunction wp_validate_redirect($location, $default = &#039;&#039;) {\n\t$location = trim( $location );\n\t\/\/ browsers will assume &#039;http&#039; is your protocol, and will obey a redirect to a URL starting with &#039;\/\/&#039;\n\tif ( substr($location, 0, 2) == &#039;\/\/&#039; )\n\t\t$location = &#039;http:&#039; . $location;\n\n\t\/\/ In php 5 parse_url may fail if the URL query part contains http:\/\/, bug #38143\n\t$test = ( $cut = strpos($location, &#039;?&#039;) ) ? substr( $location, 0, $cut ) : $location;\n\n\t$lp  = parse_url($test);\n\n\t\/\/ Give up if malformed URL\n\tif ( false === $lp )\n\t\treturn $default;\n\n\t\/\/ Allow only http and https schemes. No data:, etc.\n\tif ( isset($lp[&#039;scheme&#039;]) &amp;&amp; !(&#039;http&#039; == $lp[&#039;scheme&#039;] || &#039;https&#039; == $lp[&#039;scheme&#039;]) )\n\t\treturn $default;\n\n\t\/\/ Reject if scheme is set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.\n\tif ( isset($lp[&#039;scheme&#039;])  &amp;&amp; !isset($lp[&#039;host&#039;]) )\n\t\treturn $default;\n\n\t$wpp = parse_url(home_url());\n\n\t\/**\n\t * Filter the whitelist of hosts to redirect to.\n\t *\n\t * @since 2.3.0\n\t *\n\t * @param array       $hosts An array of allowed hosts.\n\t * @param bool|string $host  The parsed host; empty if not isset.\n\t *\/\n\t$allowed_hosts = (array) apply_filters( &#039;allowed_redirect_hosts&#039;, array($wpp[&#039;host&#039;]), isset($lp[&#039;host&#039;]) ? $lp[&#039;host&#039;] : &#039;&#039; );\n\n\tif ( isset($lp[&#039;host&#039;]) &amp;&amp; ( !in_array($lp[&#039;host&#039;], $allowed_hosts) &amp;&amp; $lp[&#039;host&#039;] != strtolower($wpp[&#039;host&#039;])) )\n\t\t$location = $default;\n\n\treturn $location;\n}\nendif;\n\nif ( ! function_exists(&#039;wp_notify_postauthor&#039;) ) :\n\/**\n * Notify an author (and\/or others) of a comment\/trackback\/pingback on a post.\n *\n * @since 1.0.0\n *\n * @param int $comment_id Comment ID\n * @param string $deprecated Not used\n * @return bool True on completion. False if no email addresses were specified.\n *\/\nfunction wp_notify_postauthor( $comment_id, $deprecated = null ) {\n\tif ( null !== $deprecated ) {\n\t\t_deprecated_argument( __FUNCTION__, &#039;3.8&#039; );\n\t}\n\n\t$comment = get_comment( $comment_id );\n\tif ( empty( $comment ) )\n\t\treturn false;\n\n\t$post    = get_post( $comment-&gt;comment_post_ID );\n\t$author  = get_userdata( $post-&gt;post_author );\n\n\t\/\/ Who to notify? By default, just the post author, but others can be added.\n\t$emails = array();\n\tif ( $author ) {\n\t\t$emails[] = $author-&gt;user_email;\n\t}\n\n\t\/**\n\t * Filter the list of email addresses to receive a comment notification.\n\t *\n\t * By default, only post authors are notified of comments. This filter allows\n\t * others to be added.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @param array $emails     An array of email addresses to receive a comment notification.\n\t * @param int   $comment_id The comment ID.\n\t *\/\n\t$emails = apply_filters( &#039;comment_notification_recipients&#039;, $emails, $comment_id );\n\t$emails = array_filter( $emails );\n\n\t\/\/ If there are no addresses to send the comment to, bail.\n\tif ( ! count( $emails ) ) {\n\t\treturn false;\n\t}\n\n\t\/\/ Facilitate unsetting below without knowing the keys.\n\t$emails = array_flip( $emails );\n\n\t\/**\n\t * Filter whether to notify comment authors of their comments on their own posts.\n\t *\n\t * By default, comment authors aren&#039;t notified of their comments on their own\n\t * posts. This filter allows you to override that.\n\t *\n\t * @since 3.8.0\n\t *\n\t * @param bool $notify     Whether to notify the post author of their own comment.\n\t *                         Default false.\n\t * @param int  $comment_id The comment ID.\n\t *\/\n\t$notify_author = apply_filters( &#039;comment_notification_notify_author&#039;, false, $comment_id );\n\n\t\/\/ The comment was left by the author\n\tif ( $author &amp;&amp; ! $notify_author &amp;&amp; $comment-&gt;user_id == $post-&gt;post_author ) {\n\t\tunset( $emails[ $author-&gt;user_email ] );\n\t}\n\n\t\/\/ The author moderated a comment on their own post\n\tif ( $author &amp;&amp; ! $notify_author &amp;&amp; $post-&gt;post_author == get_current_user_id() ) {\n\t\tunset( $emails[ $author-&gt;user_email ] );\n\t}\n\n\t\/\/ The post author is no longer a member of the blog\n\tif ( $author &amp;&amp; ! $notify_author &amp;&amp; ! user_can( $post-&gt;post_author, &#039;read_post&#039;, $post-&gt;ID ) ) {\n\t\tunset( $emails[ $author-&gt;user_email ] );\n\t}\n\n\t\/\/ If there&#039;s no email to send the comment to, bail, otherwise flip array back around for use below\n\tif ( ! count( $emails ) ) {\n\t\treturn false;\n\t} else {\n\t\t$emails = array_flip( $emails );\n\t}\n\n\t$comment_author_domain = @gethostbyaddr($comment-&gt;comment_author_IP);\n\n\t\/\/ The blogname option is escaped with esc_html on the way into the database in sanitize_option\n\t\/\/ we want to reverse this for the plain text arena of emails.\n\t$blogname = wp_specialchars_decode(get_option(&#039;blogname&#039;), ENT_QUOTES);\n\n\tswitch ( $comment-&gt;comment_type ) {\n\t\tcase &#039;trackback&#039;:\n\t\t\t$notify_message  = sprintf( __( &#039;New trackback on your post &quot;%s&quot;&#039; ), $post-&gt;post_title ) . &quot;\\r\\n&quot;;\n\t\t\t\/* translators: 1: website name, 2: author IP, 3: author domain *\/\n\t\t\t$notify_message .= sprintf( __(&#039;Website: %1$s (IP: %2$s, %3$s)&#039;), $comment-&gt;comment_author, $comment-&gt;comment_author_IP, $comment_author_domain ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;URL: %s&#039; ), $comment-&gt;comment_author_url ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;Comment: %s&#039; ), $comment-&gt;comment_content ) . &quot;\\r\\n\\r\\n&quot;;\n\t\t\t$notify_message .= __( &#039;You can see all trackbacks on this post here:&#039; ) . &quot;\\r\\n&quot;;\n\t\t\t\/* translators: 1: blog name, 2: post title *\/\n\t\t\t$subject = sprintf( __(&#039;[%1$s] Trackback: &quot;%2$s&quot;&#039;), $blogname, $post-&gt;post_title );\n\t\t\tbreak;\n\t\tcase &#039;pingback&#039;:\n\t\t\t$notify_message  = sprintf( __( &#039;New pingback on your post &quot;%s&quot;&#039; ), $post-&gt;post_title ) . &quot;\\r\\n&quot;;\n\t\t\t\/* translators: 1: comment author, 2: author IP, 3: author domain *\/\n\t\t\t$notify_message .= sprintf( __(&#039;Website: %1$s (IP: %2$s, %3$s)&#039;), $comment-&gt;comment_author, $comment-&gt;comment_author_IP, $comment_author_domain ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;URL: %s&#039; ), $comment-&gt;comment_author_url ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;Comment: %s&#039; ), $comment-&gt;comment_content ) . &quot;\\r\\n\\r\\n&quot;;\n\t\t\t$notify_message .= __( &#039;You can see all pingbacks on this post here:&#039; ) . &quot;\\r\\n&quot;;\n\t\t\t\/* translators: 1: blog name, 2: post title *\/\n\t\t\t$subject = sprintf( __(&#039;[%1$s] Pingback: &quot;%2$s&quot;&#039;), $blogname, $post-&gt;post_title );\n\t\t\tbreak;\n\t\tdefault: \/\/ Comments\n\t\t\t$notify_message  = sprintf( __( &#039;New comment on your post &quot;%s&quot;&#039; ), $post-&gt;post_title ) . &quot;\\r\\n&quot;;\n\t\t\t\/* translators: 1: comment author, 2: author IP, 3: author domain *\/\n\t\t\t$notify_message .= sprintf( __( &#039;Author: %1$s (IP: %2$s, %3$s)&#039; ), $comment-&gt;comment_author, $comment-&gt;comment_author_IP, $comment_author_domain ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;E-mail: %s&#039; ), $comment-&gt;comment_author_email ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;URL: %s&#039; ), $comment-&gt;comment_author_url ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;Whois: %s&#039; ), &quot;http:\/\/whois.arin.net\/rest\/ip\/{$comment-&gt;comment_author_IP}&quot; ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __(&#039;Comment: %s&#039; ), $comment-&gt;comment_content ) . &quot;\\r\\n\\r\\n&quot;;\n\t\t\t$notify_message .= __( &#039;You can see all comments on this post here:&#039; ) . &quot;\\r\\n&quot;;\n\t\t\t\/* translators: 1: blog name, 2: post title *\/\n\t\t\t$subject = sprintf( __(&#039;[%1$s] Comment: &quot;%2$s&quot;&#039;), $blogname, $post-&gt;post_title );\n\t\t\tbreak;\n\t}\n\t$notify_message .= get_permalink($comment-&gt;comment_post_ID) . &quot;#comments\\r\\n\\r\\n&quot;;\n\t$notify_message .= sprintf( __(&#039;Permalink: %s&#039;), get_comment_link( $comment_id ) ) . &quot;\\r\\n&quot;;\n\n\tif ( user_can( $post-&gt;post_author, &#039;edit_comment&#039;, $comment_id ) ) {\n\t\tif ( EMPTY_TRASH_DAYS )\n\t\t\t$notify_message .= sprintf( __(&#039;Trash it: %s&#039;), admin_url(&quot;comment.php?action=trash&amp;c=$comment_id&quot;) ) . &quot;\\r\\n&quot;;\n\t\telse\n\t\t\t$notify_message .= sprintf( __(&#039;Delete it: %s&#039;), admin_url(&quot;comment.php?action=delete&amp;c=$comment_id&quot;) ) . &quot;\\r\\n&quot;;\n\t\t$notify_message .= sprintf( __(&#039;Spam it: %s&#039;), admin_url(&quot;comment.php?action=spam&amp;c=$comment_id&quot;) ) . &quot;\\r\\n&quot;;\n\t}\n\n\t$wp_email = &#039;wordpress@&#039; . preg_replace(&#039;#^www\\.#&#039;, &#039;&#039;, strtolower($_SERVER[&#039;SERVER_NAME&#039;]));\n\n\tif ( &#039;&#039; == $comment-&gt;comment_author ) {\n\t\t$from = &quot;From: \\&quot;$blogname\\&quot; &lt;$wp_email&gt;&quot;;\n\t\tif ( &#039;&#039; != $comment-&gt;comment_author_email )\n\t\t\t$reply_to = &quot;Reply-To: $comment-&gt;comment_author_email&quot;;\n\t} else {\n\t\t$from = &quot;From: \\&quot;$comment-&gt;comment_author\\&quot; &lt;$wp_email&gt;&quot;;\n\t\tif ( &#039;&#039; != $comment-&gt;comment_author_email )\n\t\t\t$reply_to = &quot;Reply-To: \\&quot;$comment-&gt;comment_author_email\\&quot; &lt;$comment-&gt;comment_author_email&gt;&quot;;\n\t}\n\n\t$message_headers = &quot;$from\\n&quot;\n\t\t. &quot;Content-Type: text\/plain; charset=\\&quot;&quot; . get_option(&#039;blog_charset&#039;) . &quot;\\&quot;\\n&quot;;\n\n\tif ( isset($reply_to) )\n\t\t$message_headers .= $reply_to . &quot;\\n&quot;;\n\n\t\/**\n\t * Filter the comment notification email text.\n\t *\n\t * @since 1.5.2\n\t *\n\t * @param string $notify_message The comment notification email text.\n\t * @param int    $comment_id     Comment ID.\n\t *\/\n\t$notify_message = apply_filters( &#039;comment_notification_text&#039;, $notify_message, $comment_id );\n\n\t\/**\n\t * Filter the comment notification email subject.\n\t *\n\t * @since 1.5.2\n\t *\n\t * @param string $subject    The comment notification email subject.\n\t * @param int    $comment_id Comment ID.\n\t *\/\n\t$subject = apply_filters( &#039;comment_notification_subject&#039;, $subject, $comment_id );\n\n\t\/**\n\t * Filter the comment notification email headers.\n\t *\n\t * @since 1.5.2\n\t *\n\t * @param string $message_headers Headers for the comment notification email.\n\t * @param int    $comment_id      Comment ID.\n\t *\/\n\t$message_headers = apply_filters( &#039;comment_notification_headers&#039;, $message_headers, $comment_id );\n\n\tforeach ( $emails as $email ) {\n\t\t@wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );\n\t}\n\n\treturn true;\n}\nendif;\n\nif ( !function_exists(&#039;wp_notify_moderator&#039;) ) :\n\/**\n * Notifies the moderator of the blog about a new comment that is awaiting approval.\n *\n * @since 1.0.0\n *\n * @global wpdb $wpdb WordPress database abstraction object.\n *\n * @param int $comment_id Comment ID\n * @return bool Always returns true\n *\/\nfunction wp_notify_moderator($comment_id) {\n\tglobal $wpdb;\n\n\tif ( 0 == get_option( &#039;moderation_notify&#039; ) )\n\t\treturn true;\n\n\t$comment = get_comment($comment_id);\n\t$post = get_post($comment-&gt;comment_post_ID);\n\t$user = get_userdata( $post-&gt;post_author );\n\t\/\/ Send to the administration and to the post author if the author can modify the comment.\n\t$emails = array( get_option( &#039;admin_email&#039; ) );\n\tif ( user_can( $user-&gt;ID, &#039;edit_comment&#039;, $comment_id ) &amp;&amp; ! empty( $user-&gt;user_email ) ) {\n\t\tif ( 0 !== strcasecmp( $user-&gt;user_email, get_option( &#039;admin_email&#039; ) ) )\n\t\t\t$emails[] = $user-&gt;user_email;\n\t}\n\n\t$comment_author_domain = @gethostbyaddr($comment-&gt;comment_author_IP);\n\t$comments_waiting = $wpdb-&gt;get_var(&quot;SELECT count(comment_ID) FROM $wpdb-&gt;comments WHERE comment_approved = &#039;0&#039;&quot;);\n\n\t\/\/ The blogname option is escaped with esc_html on the way into the database in sanitize_option\n\t\/\/ we want to reverse this for the plain text arena of emails.\n\t$blogname = wp_specialchars_decode(get_option(&#039;blogname&#039;), ENT_QUOTES);\n\n\tswitch ( $comment-&gt;comment_type ) {\n\t\tcase &#039;trackback&#039;:\n\t\t\t$notify_message  = sprintf( __(&#039;A new trackback on the post &quot;%s&quot; is waiting for your approval&#039;), $post-&gt;post_title ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= get_permalink($comment-&gt;comment_post_ID) . &quot;\\r\\n\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;Website: %1$s (IP: %2$s, %3$s)&#039; ), $comment-&gt;comment_author, $comment-&gt;comment_author_IP, $comment_author_domain ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;URL: %s&#039; ), $comment-&gt;comment_author_url ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= __(&#039;Trackback excerpt: &#039;) . &quot;\\r\\n&quot; . $comment-&gt;comment_content . &quot;\\r\\n\\r\\n&quot;;\n\t\t\tbreak;\n\t\tcase &#039;pingback&#039;:\n\t\t\t$notify_message  = sprintf( __(&#039;A new pingback on the post &quot;%s&quot; is waiting for your approval&#039;), $post-&gt;post_title ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= get_permalink($comment-&gt;comment_post_ID) . &quot;\\r\\n\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;Website: %1$s (IP: %2$s, %3$s)&#039; ), $comment-&gt;comment_author, $comment-&gt;comment_author_IP, $comment_author_domain ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;URL: %s&#039; ), $comment-&gt;comment_author_url ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= __(&#039;Pingback excerpt: &#039;) . &quot;\\r\\n&quot; . $comment-&gt;comment_content . &quot;\\r\\n\\r\\n&quot;;\n\t\t\tbreak;\n\t\tdefault: \/\/ Comments\n\t\t\t$notify_message  = sprintf( __(&#039;A new comment on the post &quot;%s&quot; is waiting for your approval&#039;), $post-&gt;post_title ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= get_permalink($comment-&gt;comment_post_ID) . &quot;\\r\\n\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;Author: %1$s (IP: %2$s, %3$s)&#039; ), $comment-&gt;comment_author, $comment-&gt;comment_author_IP, $comment_author_domain ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;E-mail: %s&#039; ), $comment-&gt;comment_author_email ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;URL: %s&#039; ), $comment-&gt;comment_author_url ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;Whois: %s&#039; ), &quot;http:\/\/whois.arin.net\/rest\/ip\/{$comment-&gt;comment_author_IP}&quot; ) . &quot;\\r\\n&quot;;\n\t\t\t$notify_message .= sprintf( __( &#039;Comment: %s&#039; ), $comment-&gt;comment_content ) . &quot;\\r\\n\\r\\n&quot;;\n\t\t\tbreak;\n\t}\n\n\t$notify_message .= sprintf( __(&#039;Approve it: %s&#039;),  admin_url(&quot;comment.php?action=approve&amp;c=$comment_id&quot;) ) . &quot;\\r\\n&quot;;\n\tif ( EMPTY_TRASH_DAYS )\n\t\t$notify_message .= sprintf( __(&#039;Trash it: %s&#039;), admin_url(&quot;comment.php?action=trash&amp;c=$comment_id&quot;) ) . &quot;\\r\\n&quot;;\n\telse\n\t\t$notify_message .= sprintf( __(&#039;Delete it: %s&#039;), admin_url(&quot;comment.php?action=delete&amp;c=$comment_id&quot;) ) . &quot;\\r\\n&quot;;\n\t$notify_message .= sprintf( __(&#039;Spam it: %s&#039;), admin_url(&quot;comment.php?action=spam&amp;c=$comment_id&quot;) ) . &quot;\\r\\n&quot;;\n\n\t$notify_message .= sprintf( _n(&#039;Currently %s comment is waiting for approval. Please visit the moderation panel:&#039;,\n \t\t&#039;Currently %s comments are waiting for approval. Please visit the moderation panel:&#039;, $comments_waiting), number_format_i18n($comments_waiting) ) . &quot;\\r\\n&quot;;\n\t$notify_message .= admin_url(&quot;edit-comments.php?comment_status=moderated&quot;) . &quot;\\r\\n&quot;;\n\n\t$subject = sprintf( __(&#039;[%1$s] Please moderate: &quot;%2$s&quot;&#039;), $blogname, $post-&gt;post_title );\n\t$message_headers = &#039;&#039;;\n\n\t\/**\n\t * Filter the list of recipients for comment moderation emails.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @param array $emails     List of email addresses to notify for comment moderation.\n\t * @param int   $comment_id Comment ID.\n\t *\/\n\t$emails = apply_filters( &#039;comment_moderation_recipients&#039;, $emails, $comment_id );\n\n\t\/**\n\t * Filter the comment moderation email text.\n\t *\n\t * @since 1.5.2\n\t *\n\t * @param string $notify_message Text of the comment moderation email.\n\t * @param int    $comment_id     Comment ID.\n\t *\/\n\t$notify_message = apply_filters( &#039;comment_moderation_text&#039;, $notify_message, $comment_id );\n\n\t\/**\n\t * Filter the comment moderation email subject.\n\t *\n\t * @since 1.5.2\n\t *\n\t * @param string $subject    Subject of the comment moderation email.\n\t * @param int    $comment_id Comment ID.\n\t *\/\n\t$subject = apply_filters( &#039;comment_moderation_subject&#039;, $subject, $comment_id );\n\n\t\/**\n\t * Filter the comment moderation email headers.\n\t *\n\t * @since 2.8.0\n\t *\n\t * @param string $message_headers Headers for the comment moderation email.\n\t * @param int    $comment_id      Comment ID.\n\t *\/\n\t$message_headers = apply_filters( &#039;comment_moderation_headers&#039;, $message_headers, $comment_id );\n\n\tforeach ( $emails as $email ) {\n\t\t@wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );\n\t}\n\n\treturn true;\n}\nendif;\n\nif ( !function_exists(&#039;wp_password_change_notification&#039;) ) :\n\/**\n * Notify the blog admin of a user changing password, normally via email.\n *\n * @since 2.7.0\n *\n * @param object $user User Object\n *\/\nfunction wp_password_change_notification(&amp;$user) {\n\t\/\/ send a copy of password change notification to the admin\n\t\/\/ but check to see if it&#039;s the admin whose password we&#039;re changing, and skip this\n\tif ( 0 !== strcasecmp( $user-&gt;user_email, get_option( &#039;admin_email&#039; ) ) ) {\n\t\t$message = sprintf(__(&#039;Password Lost and Changed for user: %s&#039;), $user-&gt;user_login) . &quot;\\r\\n&quot;;\n\t\t\/\/ The blogname option is escaped with esc_html on the way into the database in sanitize_option\n\t\t\/\/ we want to reverse this for the plain text arena of emails.\n\t\t$blogname = wp_specialchars_decode(get_option(&#039;blogname&#039;), ENT_QUOTES);\n\t\twp_mail(get_option(&#039;admin_email&#039;), sprintf(__(&#039;[%s] Password Lost\/Changed&#039;), $blogname), $message);\n\t}\n}\nendif;\n\nif ( !function_exists(&#039;wp_new_user_notification&#039;) ) :\n\/**\n * Email login credentials to a newly-registered user.\n *\n * A new user registration notification is also sent to admin email.\n *\n * @since 2.0.0\n *\n * @param int    $user_id        User ID.\n * @param string $plaintext_pass Optional. The user&#039;s plaintext password. Default empty.\n *\/\nfunction wp_new_user_notification($user_id, $plaintext_pass = &#039;&#039;) {\n\t$user = get_userdata( $user_id );\n\n\t\/\/ The blogname option is escaped with esc_html on the way into the database in sanitize_option\n\t\/\/ we want to reverse this for the plain text arena of emails.\n\t$blogname = wp_specialchars_decode(get_option(&#039;blogname&#039;), ENT_QUOTES);\n\n\t$message  = sprintf(__(&#039;New user registration on your site %s:&#039;), $blogname) . &quot;\\r\\n\\r\\n&quot;;\n\t$message .= sprintf(__(&#039;Username: %s&#039;), $user-&gt;user_login) . &quot;\\r\\n\\r\\n&quot;;\n\t$message .= sprintf(__(&#039;E-mail: %s&#039;), $user-&gt;user_email) . &quot;\\r\\n&quot;;\n\n\t@wp_mail(get_option(&#039;admin_email&#039;), sprintf(__(&#039;[%s] New User Registration&#039;), $blogname), $message);\n\n\tif ( empty($plaintext_pass) )\n\t\treturn;\n\n\t$message  = sprintf(__(&#039;Username: %s&#039;), $user-&gt;user_login) . &quot;\\r\\n&quot;;\n\t$message .= sprintf(__(&#039;Password: %s&#039;), $plaintext_pass) . &quot;\\r\\n&quot;;\n\t$message .= wp_login_url() . &quot;\\r\\n&quot;;\n\n\twp_mail($user-&gt;user_email, sprintf(__(&#039;[%s] Your username and password&#039;), $blogname), $message);\n\n}\nendif;\n\nif ( !function_exists(&#039;wp_nonce_tick&#039;) ) :\n\/**\n * Get the time-dependent variable for nonce creation.\n *\n * A nonce has a lifespan of two ticks. Nonces in their second tick may be\n * updated, e.g. by autosave.\n *\n * @since 2.5.0\n *\n * @return float Float value rounded up to the next highest integer.\n *\/\nfunction wp_nonce_tick() {\n\t\/**\n\t * Filter the lifespan of nonces in seconds.\n\t *\n\t * @since 2.5.0\n\t *\n\t * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day.\n\t *\/\n\t$nonce_life = apply_filters( &#039;nonce_life&#039;, DAY_IN_SECONDS );\n\n\treturn ceil(time() \/ ( $nonce_life \/ 2 ));\n}\nendif;\n\nif ( !function_exists(&#039;wp_verify_nonce&#039;) ) :\n\/**\n * Verify that correct nonce was used with time limit.\n *\n * The user is given an amount of time to use the token, so therefore, since the\n * UID and $action remain the same, the independent variable is the time.\n *\n * @since 2.0.3\n *\n * @param string     $nonce  Nonce that was used in the form to verify\n * @param string|int $action Should give context to what is taking place and be the same when nonce was created.\n * @return bool Whether the nonce check passed or failed.\n *\/\nfunction wp_verify_nonce( $nonce, $action = -1 ) {\n\t$nonce = (string) $nonce;\n\t$user = wp_get_current_user();\n\t$uid = (int) $user-&gt;ID;\n\tif ( ! $uid ) {\n\t\t\/**\n\t\t * Filter whether the user who generated the nonce is logged out.\n\t\t *\n\t\t * @since 3.5.0\n\t\t *\n\t\t * @param int    $uid    ID of the nonce-owning user.\n\t\t * @param string $action The nonce action.\n\t\t *\/\n\t\t$uid = apply_filters( &#039;nonce_user_logged_out&#039;, $uid, $action );\n\t}\n\n\tif ( empty( $nonce ) ) {\n\t\treturn false;\n\t}\n\n\t$token = wp_get_session_token();\n\t$i = wp_nonce_tick();\n\n\t\/\/ Nonce generated 0-12 hours ago\n\t$expected = substr( wp_hash( $i . &#039;|&#039; . $action . &#039;|&#039; . $uid . &#039;|&#039; . $token, &#039;nonce&#039;), -12, 10 );\n\tif ( hash_equals( $expected, $nonce ) ) {\n\t\treturn 1;\n\t}\n\n\t\/\/ Nonce generated 12-24 hours ago\n\t$expected = substr( wp_hash( ( $i - 1 ) . &#039;|&#039; . $action . &#039;|&#039; . $uid . &#039;|&#039; . $token, &#039;nonce&#039; ), -12, 10 );\n\tif ( hash_equals( $expected, $nonce ) ) {\n\t\treturn 2;\n\t}\n\n\t\/\/ Invalid nonce\n\treturn false;\n}\nendif;\n\nif ( !function_exists(&#039;wp_create_nonce&#039;) ) :\n\/**\n * Creates a cryptographic token tied to a specific action, user, and window of time.\n *\n * @since 2.0.3\n *\n * @param string|int $action Scalar value to add context to the nonce.\n * @return string The token.\n *\/\nfunction wp_create_nonce($action = -1) {\n\t$user = wp_get_current_user();\n\t$uid = (int) $user-&gt;ID;\n\tif ( ! $uid ) {\n\t\t\/** This filter is documented in wp-includes\/pluggable.php *\/\n\t\t$uid = apply_filters( &#039;nonce_user_logged_out&#039;, $uid, $action );\n\t}\n\n\t$token = wp_get_session_token();\n\t$i = wp_nonce_tick();\n\n\treturn substr( wp_hash( $i . &#039;|&#039; . $action . &#039;|&#039; . $uid . &#039;|&#039; . $token, &#039;nonce&#039; ), -12, 10 );\n}\nendif;\n\nif ( !function_exists(&#039;wp_salt&#039;) ) :\n\/**\n * Get salt to add to hashes.\n *\n * Salts are created using secret keys. Secret keys are located in two places:\n * in the database and in the wp-config.php file. The secret key in the database\n * is randomly generated and will be appended to the secret keys in wp-config.php.\n *\n * The secret keys in wp-config.php should be updated to strong, random keys to maximize\n * security. Below is an example of how the secret key constants are defined.\n * Do not paste this example directly into wp-config.php. Instead, have a\n * {@link https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/ secret key created} just\n * for you.\n *\n *     define(&#039;AUTH_KEY&#039;,         &#039; Xakm&lt;o xQy rw4EMsLKM-?!T+,PFF})H4lzcW57AF0U@N@&lt; &gt;M%G4Yt&gt;f<\/code><\/pre>\n<p>z]MON&#8217;);<br \/>\n *     define(&#8217;SECURE_AUTH_KEY&#8217;,  'LzJ}op]mr|6+![P}Ak:uNdJCJZd&gt;(Hx.-Mh#Tz)pCIU#uGEnfFz|f ;;eU%\/U^O~&#8217;);<br \/>\n *     define(&#8217;LOGGED_IN_KEY&#8217;,    '|i|Ux`9&lt;p-h$aFf(qnT:sDO:D1P^wZ$$\/Ra@miTJi9G;ddp_&lt;q}6H1)o|a +&amp;JCM&#8217;);<br \/>\n *     define(&#8217;NONCE_KEY&#8217;,        '%:R{[P|,s.KuMltH5}cI;\/k&lt;Gx~j!f0I)m_sIyu+&amp;NJZ)-iO&gt;z7X&gt;QYR0Z_XnZ@|&#8217;);<br \/>\n *     define(&#8217;AUTH_SALT&#8217;,        'eZyT)-Naw]F8CwA*VaW#q*|.)g@o}||wf~@C-YSt}(dh_r6EbI#A,y|nU2{B#JBW&#8217;);<br \/>\n *     define(&#8217;SECURE_AUTH_SALT&#8217;, &#8217;!=oLUTXh,QW=H <code>}<\/code>L|9\/^4-3 STz},T(w}W&lt;I`.JjPi)&lt;Bmf1v,HpGe}T1:Xt7n&#8217;);<br \/>\n *     define(&#8217;LOGGED_IN_SALT&#8217;,   '+XSqHc;@Q*K_b|Z?NC[3H!!EONbh.n&lt;+=uKR:&gt;*c(u`g~EJBf#8u#R{mUEZrozmm&#8217;);<br \/>\n *     define(&#8217;NONCE_SALT&#8217;,       'h<code>GXHhD&gt;SLWVfg1(1(N{;.V!MoE(SfbA_ksP@&amp;<\/code>+AycHcAV$+?@3q+rxV{%^VyKT&#8217;);<br \/>\n *<br \/>\n * Salting passwords helps against tools which has stored hashed values of<br \/>\n * common dictionary strings. The added values makes it harder to crack.<br \/>\n *<br \/>\n * @since 2.5.0<br \/>\n *<br \/>\n * @link https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/ Create secrets for wp-config.php<br \/>\n *<br \/>\n * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)<br \/>\n * @return string Salt value<br \/>\n *\/<br \/>\nfunction wp_salt( $scheme = 'auth&#8217; ) {<br \/>\n\tstatic $cached_salts = array();<br \/>\n\tif ( isset( $cached_salts[ $scheme ] ) ) {<br \/>\n\t\t\/**<br \/>\n\t\t * Filter the WordPress salt.<br \/>\n\t\t *<br \/>\n\t\t * @since 2.5.0<br \/>\n\t\t *<br \/>\n\t\t * @param string $cache<\/p>\n","protected":false},"template":"","class_list":["post-47803","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/47803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/47803\/revisions"}],"wp:attachment":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=47803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}