<!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>[6006] sites/trunk/wordpress.org/public_html/wp-content/plugins: Translate, Consistency: Support filtering by parent projects and group results by translation.</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 { 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="http://meta.trac.wordpress.org/changeset/6006">6006</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/6006","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>ocean90</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-10-07 13:23:36 +0000 (Sat, 07 Oct 2017)</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'>Translate, Consistency: Support filtering by parent projects and group results by translation.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggpcustomizationstemplatesconsistencyphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/consistency.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggpcustomizationstemplatesstylecss">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/style.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesincroutesclassconsistencyphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggpcustomizationstemplatesconsistencyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/consistency.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/consistency.php 2017-10-07 11:07:55 UTC (rev 6005)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/consistency.php 2017-10-07 13:23:36 UTC (rev 6006)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,25 +10,61 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <p>Analyze translation consistency across projects.</p>
</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">-<form action="" method="get" class="consistency-form">
- <p>
- <input type="text" name="search" required value="<?php echo gp_esc_attr_with_entities( $search ); ?>" class="consistency-form-search" placeholder="Enter original to search for…">
- <?php
- $options = [];
- $options[''] = 'Select a locale';
- $options = array_merge( $options, $sets );
- echo gp_select( 'set', $options, $set, [ 'class' => 'consistency-form-locale', 'required' => 'required' ] );
- ?>
- <button type="submit" class="consistency-form-submit">Search</button>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<form action="/consistency" method="get" class="consistency-form">
+ <p class="consistency-fields">
+ <span class="consistency-field">
+ <label for="original">Original</label>
+ <input id="original" type="text" name="search" required value="<?php echo gp_esc_attr_with_entities( $search ); ?>" class="consistency-form-search" placeholder="Enter original to search for…">
+ </span>
+
+ <span class="consistency-field">
+ <label for="set">Locale</label>
+ <?php
+ $locale_options = [
+ '' => 'Select a locale',
+ ];
+ $locale_options = array_merge( $locale_options, $sets );
+ echo gp_select(
+ 'set',
+ $locale_options,
+ $set,
+ [
+ 'class' => 'consistency-form-locale',
+ 'required' => 'required',
+ ]
+ );
+ ?>
+ </span>
+
+ <span class="consistency-field">
+ <label for="project">Project</label>
+ <?php
+ $project_options = [
+ '' => 'All Projects',
+ ];
+ $project_options = $project_options + $projects;
+ echo gp_select(
+ 'project',
+ $project_options,
+ $project,
+ [
+ 'class' => 'consistency-form-project',
+ ]
+ );
+ ?>
+ </span>
</ins><span class="cx" style="display: block; padding: 0 10px"> </p>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <p class="consistency-form-filters">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p>
</ins><span class="cx" style="display: block; padding: 0 10px"> <label>
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="checkbox" name="search_case_sensitive" value="1"<?php checked( $search_case_sensitive ); ?>>
</span><span class="cx" style="display: block; padding: 0 10px"> Case Sensitive
</span><span class="cx" style="display: block; padding: 0 10px"> </label>
</span><span class="cx" style="display: block; padding: 0 10px"> </p>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p>
+ <button type="submit" class="consistency-form-submit">Analyze</button>
+ </p>
</ins><span class="cx" style="display: block; padding: 0 10px"> </form>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,16 +73,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( $performed_search && $results ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $translations_unique_count = count( $translations_unique );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 1 === $translations_unique_count ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $has_different_translations = $translations_unique_count > 1;
+ if ( ! $has_different_translations ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> echo '<p class="notice">All originals have the same translations</p>';
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '<div class="notice wporg-notice-warning"><p>There are ' . $translations_unique_count . ' different translations. <a id="toggle-translations-unique" href="#show">View</a></p>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo '<div id="translations-overview" class="notice wporg-notice-warning"><p>There are ' . $translations_unique_count . ' different translations. <a id="toggle-translations-unique" href="#show">View</a></p>';
</ins><span class="cx" style="display: block; padding: 0 10px"> echo '<ul class="translations-unique hidden">';
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $translations_unique as $translation ) {
</span><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '<li data-id="%s">%s</li>',
- md5( $translation ),
- str_replace( ' ', '<span class="space"> </span>', esc_translation( $translation ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '<li>%s <a href="#%s">↓</a></li>',
+ str_replace( ' ', '<span class="space"> </span>', esc_translation( $translation ) ),
+ esc_attr( sanitize_title( 't-' . $translation ) )
</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"> echo '</ul>';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -61,6 +98,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </thead>
</span><span class="cx" style="display: block; padding: 0 10px"> <tbody>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $previous_translation = '';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $results as $result ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $project_name = $result->project_name;
</span><span class="cx" style="display: block; padding: 0 10px"> $parent_project_id = $result->project_parent_id;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,6 +117,15 @@
</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">+ if ( $has_different_translations && $previous_translation !== $result->translation ) {
+ $previous_translation = $result->translation;
+ printf(
+ '<tr id="%s" class="new-translation"><td colspan="2"><strong>%s</strong> <a href="#translations-overview">↑</a></td></tr>',
+ esc_attr( sanitize_title( 't-' . $result->translation ) ),
+ esc_translation( $result->translation )
+ );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><span class="cx" style="display: block; padding: 0 10px"> '<tr><td>%s</td><td>%s</td></tr>',
</span><span class="cx" style="display: block; padding: 0 10px"> sprintf(
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggpcustomizationstemplatesstylecss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/style.css 2017-10-07 11:07:55 UTC (rev 6005)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/style.css 2017-10-07 13:23:36 UTC (rev 6006)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1749,11 +1749,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> text-align: center;
</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">-.consistency-form-search,
-.consistency-form-locale {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.consistency-form p {
+ margin-bottom: 1em;
+}
+
+.gp-content .consistency-form-search,
+.consistency-form-locale,
+.consistency-form-project {
</ins><span class="cx" style="display: block; padding: 0 10px"> height: 30px;
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 3px;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- color: #666;
</del><span class="cx" style="display: block; padding: 0 10px"> -webkit-box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> -moz-box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1765,8 +1769,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> background-color: white;
</span><span class="cx" style="display: block; padding: 0 10px"> outline-offset: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 0 3px;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ vertical-align: middle;
</ins><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">+.consistency-form-search:focus,
+.consistency-form-locale:focus,
+.consistency-form-project:focus {
+ outline: 1px solid #5b9dd9;
+ -webkit-box-shadow: 0 0 2px rgba(30,140,190,.8);
+ box-shadow: 0 0 2px rgba(30,128,190,.8);
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .consistency-form-search {
</span><span class="cx" style="display: block; padding: 0 10px"> width: 300px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1775,47 +1788,53 @@
</span><span class="cx" style="display: block; padding: 0 10px"> width: 150px;
</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">+.consistency-form-project {
+ width: 120px;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .consistency-form-submit {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- font-weight: 200;
- font-size: 15px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ background: #0085ba;
+ border-color: #0073aa #006799 #006799;
+ box-shadow: 0 1px 0 #006799;
+ color: #fff;
+ height: 30px;
</ins><span class="cx" style="display: block; padding: 0 10px"> line-height: 1;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- height: 30px;
- background-color: #21759b;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#2a95c5), to(#21759b));
- background-image: -webkit-linear-gradient(top, #2a95c5, #21759b);
- background-image: linear-gradient(to bottom, #2a95c5, #21759b);
- border: 1px solid #21759b;
- border-bottom-color: #1e6a8d;
- -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
- box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
- color: #fff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
- padding: 3px 10px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ padding: 0 16px;
+ vertical-align: top;
+ box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> cursor: pointer;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ display: inline-block;
+ font-size: 15px;
</ins><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">-.consistency-form-submit:hover {
- background-color: #278ab7;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#2e9fd2), to(#21759b));
- background-image: -webkit-linear-gradient(top, #2e9fd2, #21759b);
- background-image: linear-gradient(to bottom, #2e9fd2, #21759b);
- border-color: #1b607f;
- -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
- box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.consistency-form-submit:hover,
+.consistency-form-submit:focus {
+ background: #008ec2;
+ border-color: #006799;
+ box-shadow: 0 1px 0 #006799;
+ color: #fff;
</ins><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">-.consistency-form-filters {
- margin-top: 8px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.consistency-form-submit:focus {
+ box-shadow: 0 1px 0 #0073aa, 0 0 2px 1px #33b3db;
</ins><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">-.consistency-form-filters label {
- border-right: 1px solid #ccc;
- padding: 0 15px 0 10px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.consistency-form-submit:active {
+ background: #0073aa;
+ border-color: #006799;
+ -webkit-box-shadow: inset 0 2px 0 #006799;
+ box-shadow: inset 0 2px 0 #006799;
+}
+
+.consistency-field {
</ins><span class="cx" style="display: block; padding: 0 10px"> display: inline-block;
</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">-.consistency-form-filters label:last-child {
- border: none;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.consistency-field label {
+ display: block;
+ margin: 0 3px;
+ font-size: 13px;
+ text-align: left;
</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"> .consistency-table {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1836,11 +1855,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> border-bottom: 1px solid #eee;
</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">+.consistency-table tr.new-translation {
+ border-bottom-width: 3px;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .consistency-table td {
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 10px 5px 0 0;
</span><span class="cx" style="display: block; padding: 0 10px"> vertical-align: top;
</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">+.consistency-table tr.new-translation td {
+ padding: 40px 0 10px;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .consistency-table .string.rtl {
</span><span class="cx" style="display: block; padding: 0 10px"> direction: rtl;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesincroutesclassconsistencyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php 2017-10-07 11:07:55 UTC (rev 6005)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php 2017-10-07 13:23:36 UTC (rev 6006)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,6 +2,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\GlotPress\Routes\Routes;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use GP;
</ins><span class="cx" style="display: block; padding: 0 10px"> use GP_Locales;
</span><span class="cx" style="display: block; padding: 0 10px"> use GP_Route;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,14 +15,22 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> private $cache_group = 'wporg-translate';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const PROJECTS = [
+ 1 => 'WordPress',
+ 523 => 'Themes',
+ 17 => 'Plugins',
+ 487 => 'Meta',
+ 281 => 'Apps',
+ ];
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Prints a search form and the search results for a consistency view.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_search_form() {
</span><span class="cx" style="display: block; padding: 0 10px"> $sets = $this->get_translation_sets();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $search = $set = '';
- $search_case_sensitive = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $search = $set = $project = '';
+ $search_case_sensitive = false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $_REQUEST['search'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $search = wp_unslash( $_REQUEST['search'] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -34,10 +43,14 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $_REQUEST ) && empty( $_REQUEST['search_case_sensitive'] ) ) {
- $search_case_sensitive = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $_REQUEST['search_case_sensitive'] ) ) {
+ $search_case_sensitive = true;
</ins><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">+ if ( ! empty( $_REQUEST['project'] ) && isset( self::PROJECTS[ $_REQUEST['project'] ] ) ) {
+ $project = $_REQUEST['project'];
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $locale_is_rtl = false;
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $set ) {
</span><span class="cx" style="display: block; padding: 0 10px"> list( $locale, $slug ) = explode( '/', $set );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,12 +65,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'search' => $search,
</span><span class="cx" style="display: block; padding: 0 10px"> 'set' => $set,
</span><span class="cx" style="display: block; padding: 0 10px"> 'case_sensitive' => $search_case_sensitive,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'project' => $project,
</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"> $translations = wp_list_pluck( $results, 'translation', 'translation_id' );
</span><span class="cx" style="display: block; padding: 0 10px"> $translations_unique = array_unique( $translations );
</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">+ $projects = self::PROJECTS;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->tmpl( 'consistency', get_defined_vars() );
</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">@@ -108,6 +124,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $locale = $wpdb->prepare( '%s', $locale );
</span><span class="cx" style="display: block; padding: 0 10px"> $slug = $wpdb->prepare( '%s', $slug );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $project_where = '';
+ if ( $args['project'] ) {
+ $project = GP::$project->get( $args['project'] );
+ $project_where = $wpdb->prepare( 'AND p.path LIKE %s', $wpdb->esc_like( $project->path ) . '/%' );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $results = $wpdb->get_results( "
</span><span class="cx" style="display: block; padding: 0 10px"> SELECT
</span><span class="cx" style="display: block; padding: 0 10px"> p.name AS project_name,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -133,6 +155,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> AND t.status = 'current'
</span><span class="cx" style="display: block; padding: 0 10px"> AND o.status = '+active' AND o.singular {$search}
</span><span class="cx" style="display: block; padding: 0 10px"> AND ts.locale = {$locale} AND ts.slug = {$slug}
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {$project_where}
</ins><span class="cx" style="display: block; padding: 0 10px"> LIMIT 0, 500
</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">@@ -147,6 +170,6 @@
</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"> public function _sort_callback( $a, $b ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return strnatcmp( $a->translation, $b->translation );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return strnatcasecmp( $a->translation, $b->translation );
</ins><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>