<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[44966] trunk: Privacy: Introduce Privacy Policy page helpers:</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/44966">44966</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/44966","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-03-21 19:47:29 +0000 (Thu, 21 Mar 2019)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Privacy: Introduce Privacy Policy page helpers:

* `is_privacy_policy()` template tag
* `privacy-policy.php` template
* `.privacy-policy` body class
* `.menu-item-privacy-policy` menu item class

Props garrett-eclipse, birgire, xkon, Clorith.
Fixes <a href="https://core.trac.wordpress.org/ticket/44005">#44005</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesfilephp">trunk/src/wp-admin/includes/file.php</a></li>
<li><a href="#trunksrcwpincludesclasswpqueryphp">trunk/src/wp-includes/class-wp-query.php</a></li>
<li><a href="#trunksrcwpincludesnavmenutemplatephp">trunk/src/wp-includes/nav-menu-template.php</a></li>
<li><a href="#trunksrcwpincludesposttemplatephp">trunk/src/wp-includes/post-template.php</a></li>
<li><a href="#trunksrcwpincludesqueryphp">trunk/src/wp-includes/query.php</a></li>
<li><a href="#trunksrcwpincludestemplateloaderphp">trunk/src/wp-includes/template-loader.php</a></li>
<li><a href="#trunksrcwpincludestemplatephp">trunk/src/wp-includes/template.php</a></li>
<li><a href="#trunktestsphpunitincludesabstracttestcasephp">trunk/tests/phpunit/includes/abstract-testcase.php</a></li>
<li><a href="#trunktestsphpunittestspostgetBodyClassphp">trunk/tests/phpunit/tests/post/getBodyClass.php</a></li>
<li><a href="#trunktestsphpunittestspostnavmenuphp">trunk/tests/phpunit/tests/post/nav-menu.php</a></li>
<li><a href="#trunktestsphpunittestsqueryconditionalsphp">trunk/tests/phpunit/tests/query/conditionals.php</a></li>
<li><a href="#trunktestsphpunitteststemplatephp">trunk/tests/phpunit/tests/template.php</a></li>
<li><a href="#trunktestsphpunitteststhemephp">trunk/tests/phpunit/tests/theme.php</a></li>
<li><a href="#trunktestsphpunittestsurlgetPrivacyPolicyUrlphp">trunk/tests/phpunit/tests/url/getPrivacyPolicyUrl.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesfilephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/file.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/file.php      2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/src/wp-admin/includes/file.php        2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,6 +36,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        'single.php'            => __( 'Single Post' ),
</span><span class="cx" style="display: block; padding: 0 10px">        'page.php'              => __( 'Single Page' ),
</span><span class="cx" style="display: block; padding: 0 10px">        'front-page.php'        => __( 'Homepage' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        'privacy-policy.php'    => __( 'Privacy Policy Page' ),
</ins><span class="cx" style="display: block; padding: 0 10px">         // Attachments
</span><span class="cx" style="display: block; padding: 0 10px">        'attachment.php'        => __( 'Attachment Template' ),
</span><span class="cx" style="display: block; padding: 0 10px">        'image.php'             => __( 'Image Attachment Template' ),
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-query.php  2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/src/wp-includes/class-wp-query.php    2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -326,6 +326,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public $is_home = false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Signifies whether the current query is for the Privacy Policy page.
+        *
+        * @since 5.2.0
+        * @var bool
+        */
+       public $is_privacy_policy = false;
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Signifies whether the current query couldn't find anything.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 1.5.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -463,6 +471,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->is_comment_feed      = false;
</span><span class="cx" style="display: block; padding: 0 10px">                $this->is_trackback         = false;
</span><span class="cx" style="display: block; padding: 0 10px">                $this->is_home              = false;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->is_privacy_policy    = false;
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->is_404               = false;
</span><span class="cx" style="display: block; padding: 0 10px">                $this->is_paged             = false;
</span><span class="cx" style="display: block; padding: 0 10px">                $this->is_admin             = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -998,6 +1007,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->is_home       = true;
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->is_posts_page = true;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       if ( isset( $this->queried_object_id ) && $this->queried_object_id == get_option( 'wp_page_for_privacy_policy' ) ) {
+                               $this->is_privacy_policy = true;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( $qv['page_id'] ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1006,6 +1019,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->is_home       = true;
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->is_posts_page = true;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       if ( $qv['page_id'] == get_option( 'wp_page_for_privacy_policy' ) ) {
+                               $this->is_privacy_policy = true;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! empty( $qv['post_type'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3878,6 +3895,27 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Is the query for the Privacy Policy page?
+        *
+        * This is the page which shows the Privacy Policy content of your site.
+        *
+        * Depends on the site's "Change your Privacy Policy page" Privacy Settings 'wp_page_for_privacy_policy'.
+        *
+        * This function will return true only on the page you set as the "Privacy Policy page".
+        *
+        * @since 5.2.0
+        *
+        * @return bool True, if Privacy Policy page.
+        */
+       public function is_privacy_policy() {
+               if ( get_option( 'wp_page_for_privacy_policy' ) && $this->is_page( get_option( 'wp_page_for_privacy_policy' ) ) ) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Is the query for an existing month archive?
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 3.1.0
</span></span></pre></div>
<a id="trunksrcwpincludesnavmenutemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/nav-menu-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/nav-menu-template.php       2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/src/wp-includes/nav-menu-template.php 2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -361,8 +361,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $possible_object_parents = array_filter( $possible_object_parents );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $front_page_url = home_url();
-       $front_page_id  = (int) get_option( 'page_on_front' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $front_page_url         = home_url();
+       $front_page_id          = (int) get_option( 'page_on_front' );
+       $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        foreach ( (array) $menu_items as $key => $menu_item ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -378,6 +379,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $classes[] = 'menu-item-home';
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // This menu item is set as the 'Privacy Policy Page'.
+               if ( 'post_type' === $menu_item->type && $privacy_policy_page_id === (int) $menu_item->object_id ) {
+                       $classes[] = 'menu-item-privacy-policy';
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 // if the menu item corresponds to a taxonomy term for the currently-queried non-hierarchical post object
</span><span class="cx" style="display: block; padding: 0 10px">                if ( $wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array( $menu_item->object_id, $possible_object_parents ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $active_parent_object_ids[] = (int) $menu_item->object_id;
</span></span></pre></div>
<a id="trunksrcwpincludesposttemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/post-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/post-template.php   2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/src/wp-includes/post-template.php     2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -621,6 +621,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">        if ( is_home() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $classes[] = 'blog';
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        if ( is_privacy_policy() ) {
+               $classes[] = 'privacy-policy';
+       }
</ins><span class="cx" style="display: block; padding: 0 10px">         if ( is_archive() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $classes[] = 'archive';
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre></div>
<a id="trunksrcwpincludesqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/query.php   2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/src/wp-includes/query.php     2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -490,6 +490,36 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Determines whether the query is for the Privacy Policy page.
+ *
+ * The Privacy Policy page is the page that shows the Privacy Policy content of the site.
+ *
+ * is_privacy_policy() is dependent on the site's "Change your Privacy Policy page" Privacy Settings 'wp_page_for_privacy_policy'.
+ *
+ * This function will return true only on the page you set as the "Privacy Policy page".
+ *
+ * For more information on this and similar theme functions, check out
+ * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
+ * Conditional Tags} article in the Theme Developer Handbook.
+ *
+ * @since 5.2.0
+ *
+ * @global WP_Query $wp_query Global WP_Query instance.
+ *
+ * @return bool
+ */
+function is_privacy_policy() {
+       global $wp_query;
+
+       if ( ! isset( $wp_query ) ) {
+               _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
+               return false;
+       }
+
+       return $wp_query->is_privacy_policy();
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Determines whether the query is for an existing month archive.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * For more information on this and similar theme functions, check out
</span></span></pre></div>
<a id="trunksrcwpincludestemplateloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/template-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/template-loader.php 2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/src/wp-includes/template-loader.php   2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,6 +51,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        elseif ( is_search() && $template = get_search_template() ) :
</span><span class="cx" style="display: block; padding: 0 10px">        elseif ( is_front_page() && $template = get_front_page_template() ) :
</span><span class="cx" style="display: block; padding: 0 10px">        elseif ( is_home() && $template = get_home_template() ) :
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        elseif ( is_privacy_policy() && $template = get_privacy_policy_template() ) :
</ins><span class="cx" style="display: block; padding: 0 10px">         elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
</span><span class="cx" style="display: block; padding: 0 10px">        elseif ( is_tax() && $template = get_taxonomy_template() ) :
</span><span class="cx" style="display: block; padding: 0 10px">        elseif ( is_attachment() && $template = get_attachment_template() ) :
</span></span></pre></div>
<a id="trunksrcwpincludestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/template.php        2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/src/wp-includes/template.php  2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,7 +33,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * The last element in the array should always be the fallback template for this query type.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * 'embed', 'home', 'frontpage', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * 'embed', 'home', 'frontpage', 'privacypolicy', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.7.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,7 +51,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * This hook also applies to various types of files loaded as part of the Template Hierarchy.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * 'embed', 'home', 'frontpage', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * 'embed', 'home', 'frontpage', 'privacypolicy', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 1.5.0
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.8.0 The `$type` and `$templates` parameters were added.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -377,6 +377,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieve path of Privacy Policy page template in current or parent template.
+ *
+ * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
+ * and {@see '$type_template'} dynamic hooks, where `$type` is 'privacypolicy'.
+ *
+ * @since 5.2.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to front page template file.
+ */
+function get_privacy_policy_template() {
+       $templates = array( 'privacy-policy.php' );
+
+       return get_query_template( 'privacy_policy', $templates );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Retrieve path of page template in current or parent template.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * The hierarchy for this template looks like:
</span></span></pre></div>
<a id="trunktestsphpunitincludesabstracttestcasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/abstract-testcase.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/abstract-testcase.php        2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/tests/phpunit/includes/abstract-testcase.php  2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -926,6 +926,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'is_feed',
</span><span class="cx" style="display: block; padding: 0 10px">                        'is_front_page',
</span><span class="cx" style="display: block; padding: 0 10px">                        'is_home',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        'is_privacy_policy',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'is_month',
</span><span class="cx" style="display: block; padding: 0 10px">                        'is_page',
</span><span class="cx" style="display: block; padding: 0 10px">                        'is_paged',
</span></span></pre></div>
<a id="trunktestsphpunittestspostgetBodyClassphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/post/getBodyClass.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/post/getBodyClass.php   2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/tests/phpunit/tests/post/getBodyClass.php     2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -202,4 +202,28 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertContains( "attachmentid-{$attachment_id}", $class );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertContains( 'attachment-jpeg', $class );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * @ticket 44005
+        * @group privacy
+        */
+       public function test_privacy_policy_body_class() {
+               $page_id = self::factory()->post->create(
+                       array(
+                               'post_type'  => 'page',
+                               'post_title' => 'Privacy Policy',
+                       )
+               );
+               update_option( 'wp_page_for_privacy_policy', $page_id );
+
+               $this->go_to( get_permalink( $page_id ) );
+
+               $class = get_body_class();
+
+               $this->assertContains( 'privacy-policy', $class );
+               $this->assertContains( 'page-template-default', $class );
+               $this->assertContains( 'page', $class );
+               $this->assertContains( "page-id-{$page_id}", $class );
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestspostnavmenuphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/post/nav-menu.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/post/nav-menu.php       2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/tests/phpunit/tests/post/nav-menu.php 2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -861,4 +861,69 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * @ticket 44005
+        * @group privacy
+        */
+       function test_no_privacy_policy_class_applied() {
+               $page_id = self::factory()->post->create(
+                       array(
+                               'post_type'  => 'page',
+                               'post_title' => 'Privacy Policy Page',
+                       )
+               );
+
+               wp_update_nav_menu_item(
+                       $this->menu_id,
+                       0,
+                       array(
+                               'menu-item-type'      => 'post_type',
+                               'menu-item-object'    => 'page',
+                               'menu-item-object-id' => $page_id,
+                               'menu-item-status'    => 'publish',
+                       )
+               );
+
+               $menu_items = wp_get_nav_menu_items( $this->menu_id );
+               _wp_menu_item_classes_by_context( $menu_items );
+
+               $classes = $menu_items[0]->classes;
+
+               $this->assertNotContains( 'menu-item-privacy-policy', $classes );
+       }
+
+       /**
+        * @ticket 44005
+        * @group privacy
+        */
+       function test_class_applied_to_privacy_policy_page_item() {
+               $page_id = self::factory()->post->create(
+                       array(
+                               'post_type'  => 'page',
+                               'post_title' => 'Privacy Policy Page',
+                       )
+               );
+               update_option( 'wp_page_for_privacy_policy', $page_id );
+
+               wp_update_nav_menu_item(
+                       $this->menu_id,
+                       0,
+                       array(
+                               'menu-item-type'      => 'post_type',
+                               'menu-item-object'    => 'page',
+                               'menu-item-object-id' => $page_id,
+                               'menu-item-status'    => 'publish',
+                       )
+               );
+
+               $menu_items = wp_get_nav_menu_items( $this->menu_id );
+               _wp_menu_item_classes_by_context( $menu_items );
+
+               $classes = $menu_items[0]->classes;
+
+               delete_option( 'wp_page_for_privacy_policy' );
+
+               $this->assertContains( 'menu-item-privacy-policy', $classes );
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsqueryconditionalsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/query/conditionals.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/query/conditionals.php  2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/tests/phpunit/tests/query/conditionals.php    2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1590,4 +1590,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertTrue( is_single( $p2 ) );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertFalse( is_single( $p1 ) );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        
+       /**
+        * @ticket 44005
+        * @group privacy
+        */
+       public function test_is_privacy_policy() {
+               $page_id = self::factory()->post->create(
+                       array(
+                               'post_type'  => 'page',
+                               'post_title' => 'Privacy Policy',
+                       )
+               );
+
+               update_option( 'wp_page_for_privacy_policy', $page_id );
+
+               $this->go_to( get_permalink( $page_id ) );
+
+               $this->assertQueryTrue( 'is_page', 'is_singular', 'is_privacy_policy' );
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunitteststemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/template.php    2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/tests/phpunit/tests/template.php      2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,6 +13,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $page;
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $post;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Page For Privacy Policy.
+        *
+        * @since 5.2.0
+        *
+        * @var WP_Post $page_for_privacy_policy
+        */
+       protected static $page_for_privacy_policy;
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
</span><span class="cx" style="display: block; padding: 0 10px">                self::$page_on_front = $factory->post->create_and_get(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,6 +54,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                set_post_format( self::$post, 'quote' );
</span><span class="cx" style="display: block; padding: 0 10px">                add_post_meta( self::$post->ID, '_wp_page_template', 'templates/post.php' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               self::$page_for_privacy_policy = $factory->post->create_and_get(
+                       array(
+                               'post_type'  => 'page',
+                               'post_title' => 'Privacy Policy',
+                       )
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function setUp() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -273,6 +289,25 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 44005
+        * @group privacy
+        */
+       public function test_privacy_template_hierarchy() {
+               update_option( 'wp_page_for_privacy_policy', self::$page_for_privacy_policy->ID );
+
+               $this->assertTemplateHierarchy(
+                       get_permalink( self::$page_for_privacy_policy->ID ),
+                       array(
+                               'privacy-policy.php',
+                               'page-privacy-policy.php',
+                               'page-' . self::$page_for_privacy_policy->ID . '.php',
+                               'page.php',
+                               'singular.php',
+                       )
+               );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * @ticket 18375
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_single_template_hierarchy_for_post() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -436,6 +471,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'search'            => 'is_search',
</span><span class="cx" style="display: block; padding: 0 10px">                        'front_page'        => 'is_front_page',
</span><span class="cx" style="display: block; padding: 0 10px">                        'home'              => 'is_home',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        'privacy_policy'    => 'is_privacy_policy',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'post_type_archive' => 'is_post_type_archive',
</span><span class="cx" style="display: block; padding: 0 10px">                        'taxonomy'          => 'is_tax',
</span><span class="cx" style="display: block; padding: 0 10px">                        'attachment'        => 'is_attachment',
</span></span></pre></div>
<a id="trunktestsphpunitteststhemephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/theme.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/theme.php       2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/tests/phpunit/tests/theme.php 2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -288,6 +288,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->assertEquals( get_category_template(), get_query_template( 'category' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->assertEquals( get_date_template(), get_query_template( 'date' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->assertEquals( get_home_template(), get_query_template( 'home', array( 'home.php', 'index.php' ) ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $this->assertEquals( get_privacy_policy_template(), get_query_template( 'privacy_policy', array( 'privacy-policy.php' ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $this->assertEquals( get_page_template(), get_query_template( 'page' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->assertEquals( get_search_template(), get_query_template( 'search' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->assertEquals( get_single_template(), get_query_template( 'single' ) );
</span></span></pre></div>
<a id="trunktestsphpunittestsurlgetPrivacyPolicyUrlphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/url/getPrivacyPolicyUrl.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/url/getPrivacyPolicyUrl.php     2019-03-21 18:58:50 UTC (rev 44965)
+++ trunk/tests/phpunit/tests/url/getPrivacyPolicyUrl.php       2019-03-21 19:47:29 UTC (rev 44966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,8 +45,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'post_title' => WP_TESTS_DOMAIN . ' Privacy Policy',
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-               self::$privacy_policy_url = get_permalink( self::$privacy_policy_page_id );
</del><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,9 +58,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * The function should return the privacy policy URL when `wp_page_for_privacy_policy` is set.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_get_privacy_policy_url_should_return_valid_url_when_policy_page_set() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $privacy_policy_url = get_permalink( self::$privacy_policy_page_id );
</ins><span class="cx" style="display: block; padding: 0 10px">                 update_option( 'wp_page_for_privacy_policy', self::$privacy_policy_page_id );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame( self::$privacy_policy_url, get_privacy_policy_url() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSame( $privacy_policy_url, get_privacy_policy_url() );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span></span></pre>
</div>
</div>

</body>
</html>