<!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>[5344] sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams: WP i18n teams: Add locale managers to detail pages.</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/5344">5344</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/5344","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-04-15 22:14:58 +0000 (Sat, 15 Apr 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'>WP i18n teams: Add locale managers to detail pages.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamscssi18nteamscss">sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/css/i18n-teams.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamsviewslocaledetailsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/locale-details.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamswpi18nteamsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamscssi18nteamscss"></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/wp-i18n-teams/css/i18n-teams.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/wp-i18n-teams/css/i18n-teams.css 2017-04-15 22:12:12 UTC (rev 5343)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/css/i18n-teams.css 2017-04-15 22:14:58 UTC (rev 5344)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -245,6 +245,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> padding-right: 1em;
</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">+article.page .translators-info table td:first-of-type {
+ width: auto;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> @media (max-width: 768px) {
</span><span class="cx" style="display: block; padding: 0 10px"> .show-all table tbody tr,
</span><span class="cx" style="display: block; padding: 0 10px"> .translators-info.show-latest table tbody tr.latest,
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamsviewslocaledetailsphp"></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/wp-i18n-teams/views/locale-details.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/wp-i18n-teams/views/locale-details.php 2017-04-15 22:12:12 UTC (rev 5343)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/locale-details.php 2017-04-15 22:14:58 UTC (rev 5344)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,36 +10,22 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <ul id="locale-details">
</span><span class="cx" style="display: block; padding: 0 10px"> <li>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <strong><?php _e( 'Locale site:', 'wporg' ); ?></strong>
- <?php if ( $locale_data['rosetta_site_url'] ) : ?>
- <a href="<?php echo esc_url( $locale_data['rosetta_site_url'] ); ?>"><?php echo parse_url( $locale_data['rosetta_site_url'], PHP_URL_HOST ); ?></a>
- <?php else : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <strong><?php _e( 'Sites:', 'wporg' ); ?></strong>
+ <?php
+ if ( $locale_data['sites'] ) :
+ echo implode( ', ', array_map( function( $site ) {
+ return sprintf(
+ '<a href="%s">%s (%s)</a>',
+ esc_url( $site->home ),
+ esc_html( $site->blogname ),
+ esc_html( $site->domain . $site->path )
+ );
+ }, $locale_data['sites'] ) );
+ else : ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> —
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </li>
</span><span class="cx" style="display: block; padding: 0 10px"> <li>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <strong><?php _e( 'Team site:', 'wporg' ); ?></strong>
- <?php if ( $locale_data['team_url'] ) : ?>
- <a href="<?php echo esc_url( $locale_data['team_url'] ); ?>"><?php
- $url = parse_url( $locale_data['team_url'] );
- printf( '%s%s', $url['host'], $url['path'] );
- ?></a>
- <?php else : ?>
- —
- <?php endif; ?>
- </li>
- <li>
- <strong><?php _e( 'Forums:', 'wporg' ); ?></strong>
- <?php if ( $locale_data['forums_url'] ) : ?>
- <a href="<?php echo esc_url( $locale_data['forums_url'] ); ?>"><?php
- $url = parse_url( $locale_data['forums_url'] );
- printf( '%s%s', $url['host'], $url['path'] );
- ?></a>
- <?php else : ?>
- —
- <?php endif; ?>
- </li>
- <li>
</del><span class="cx" style="display: block; padding: 0 10px"> <strong><?php _e( 'Latest release:', 'wporg' ); ?></strong>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php echo $locale_data['latest_release'] ? $locale_data['latest_release'] : '—'; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </li>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,15 +65,30 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php if ( ! empty( $locale_data['locale_managers'] ) ) : ?>
+ <h2><?php printf( __( 'Locale Managers (%s)', 'wporg' ), number_format_i18n( count( $locale_data['locale_managers'] ) ) ); ?></h2>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<h2><?php printf( __( 'General Translation Editors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['validators'] ) ) ); ?></h2>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <ul class="validators">
+ <?php foreach ( $locale_data['locale_managers'] as $locale_manager ) :
+ ?>
+ <li>
+ <a class="profile" href="https://profiles.wordpress.org/<?php echo esc_attr( $locale_manager['nice_name'] ); ?>"><?php
+ echo get_avatar( $locale_manager['email'], 60 );
+ echo esc_html( $locale_manager['display_name'] );
+ ?></a>
+ <?php
+ if ( $locale_manager['slack'] ) {
+ printf( '<span class="user-slack">@%s on <a href="%s">Slack</a></span>', $locale_manager['slack'], 'https://make.wordpress.org/chat/' );
+ }
+ ?>
+ </li>
+ <?php endforeach; ?>
+ </ul>
+<?php endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php if ( empty( $locale_data['validators'] ) ) : ?>
- <p><?php
- /* translators: %s: language name in English */
- printf( __( '%s does not have General or Project translation editors yet.', 'wporg' ), $locale->english_name );
- ?></p>
-<?php else : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php if ( ! empty( $locale_data['validators'] ) ) : ?>
+ <h2><?php printf( __( 'General Translation Editors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['validators'] ) ) ); ?></h2>
+
</ins><span class="cx" style="display: block; padding: 0 10px"> <ul class="validators">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php foreach ( $locale_data['validators'] as $validator ) :
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -106,7 +107,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </ul>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> <?php if ( ! empty( $locale_data['project_validators'] ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <h2><?php printf( __( 'Project Translation Editors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['project_validators'] ) ) ); ?></h2>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -128,11 +128,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </ul>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<h2><?php printf( __( 'All Translation Contributors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['translators'] ) ) ); ?></h2>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php if ( ! empty( $locale_data['translators'] ) ) : ?>
+ <h2><?php printf( __( 'All Translation Contributors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['translators'] ) ) ); ?></h2>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php if ( empty( $locale_data['translators'] ) ) : ?>
- <p><?php printf( __( '%s does not have any translators yet.', 'wporg' ), $locale->english_name ); ?></p>
-<?php else :?>
</del><span class="cx" style="display: block; padding: 0 10px"> <p>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> $translators = array();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -148,9 +146,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </p>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</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="alert alert-info" role="alert">
- <a href="https://translate.wordpress.org/locale/<?php echo esc_attr( $locale->slug ); ?>"><?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+$notice = sprintf(
+ '%s <a href="https://translate.wordpress.org/locale/%s">%s</a>',
+ __( 'Is this a language that you speak?', 'wporg' ),
+ esc_attr( $locale->slug ),
+ sprintf(
</ins><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: language name in English */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- printf( __( 'Is this a language that you speak? Join the WordPress translation team for %s!', 'wporg' ), $locale->english_name );
- ?></a>
-</p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ __( 'Join the WordPress translation team for %s!', 'wporg' ),
+ esc_html( $locale->english_name )
+ )
+);
+echo do_shortcode( "[info]{$notice}[/info]" );
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamswpi18nteamsphp"></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/wp-i18n-teams/wp-i18n-teams.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/wp-i18n-teams/wp-i18n-teams.php 2017-04-15 22:12:12 UTC (rev 5343)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php 2017-04-15 22:14:58 UTC (rev 5344)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -201,36 +201,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $statuses[ $language_pack_status ]++;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $forums_url = $team_url = '';
- if ( $subdomain ) {
- $result = get_sites( array(
- 'domain' => $subdomain . '.wordpress.org',
- 'path__in' => array( '/support/', '/forums/' ),
- 'number' => 1,
- ) );
- $site = array_shift( $result );
- if ( $site ) {
- $forums_url = get_home_url( $site->id, '/' );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $sites = get_sites( [
+ 'locale' => $locale->wp_locale,
+ 'network_id' => WPORG_GLOBAL_NETWORK_ID,
+ 'orderby' => 'path_length',
+ 'number' => '',
+ ] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $result = get_sites( array(
- 'domain' => $subdomain . '.wordpress.org',
- 'path__in' => array( '/team/' ),
- 'number' => 1,
- ) );
- $site = array_shift( $result );
- if ( $site ) {
- $team_url = get_home_url( $site->id, '/' );
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $locale_data[ $locale->wp_locale ] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'release_status' => $release_status,
</span><span class="cx" style="display: block; padding: 0 10px"> 'translation_status' => $translation_status,
</span><span class="cx" style="display: block; padding: 0 10px"> 'language_pack_status' => $language_pack_status,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'rosetta_site_url' => $subdomain ? 'https://' . $subdomain . '.wordpress.org' : false,
- 'forums_url' => $forums_url ? $forums_url : false,
- 'team_url' => $team_url ? $team_url : false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'sites' => $sites,
+ 'subdomain' => $subdomain,
+ 'rosetta_site_url' => "https://$subdomain.wordpress.org/",
</ins><span class="cx" style="display: block; padding: 0 10px"> 'latest_release' => $latest_release ? $latest_release : false,
</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">@@ -271,7 +255,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $latest_release = $locale_data['latest_release'];
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $latest_release ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $locale_data['localized_core_url'] = sprintf( '%s/wordpress-%s-%s.zip', $locale_data['rosetta_site_url'], $latest_release, $locale->wp_locale );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $locale_data['localized_core_url'] = sprintf( 'https://%s.wordpress.org/wordpress-%s-%s.zip', $locale_data['subdomain'], $latest_release, $locale->wp_locale );
</ins><span class="cx" style="display: block; padding: 0 10px"> $language_packs_data = $this->get_language_packs_data();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( version_compare( $latest_release, '4.0', '>=' ) && ! empty( $language_packs_data[ $locale->wp_locale ] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -293,6 +277,7 @@
</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"> $contributors = $this->get_contributors( $locale );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $locale_data['locale_managers'] = $contributors['locale_managers'];
</ins><span class="cx" style="display: block; padding: 0 10px"> $locale_data['validators'] = $contributors['validators'];
</span><span class="cx" style="display: block; padding: 0 10px"> $locale_data['project_validators'] = $contributors['project_validators'];
</span><span class="cx" style="display: block; padding: 0 10px"> $locale_data['translators'] = $contributors['translators'];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -312,7 +297,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $cache;
</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">- $contributors = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $contributors = [];
+ $contributors['locale_managers'] = $this->get_locale_managers( $locale );
</ins><span class="cx" style="display: block; padding: 0 10px"> $contributors['validators'] = $this->get_general_translation_editors( $locale );
</span><span class="cx" style="display: block; padding: 0 10px"> $contributors['project_validators'] = $this->get_project_translation_editors( $locale );
</span><span class="cx" style="display: block; padding: 0 10px"> $contributors['translators'] = $this->get_translation_contributors( $locale );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -354,45 +340,73 @@
</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">+ * Get the locale managers for the given locale.
+ *
+ * @param GP_Locale $locale
+ * @return array
+ */
+ private function get_locale_managers( $locale ) {
+ $locale_managers = [];
+
+ $result = get_sites( [
+ 'locale' => $locale->wp_locale,
+ 'network_id' => WPORG_GLOBAL_NETWORK_ID,
+ 'path' => '/',
+ 'fields' => 'ids',
+ 'number' => '1',
+ ] );
+ $site_id = array_shift( $result );
+ if ( ! $site_id ) {
+ return $locale_managers;
+ }
+
+ $users = get_users( [
+ 'blog_id' => $site_id,
+ 'role' => 'locale_manager',
+ 'count_total' => false,
+ ] );
+
+ foreach ( $users as $user ) {
+ $locale_managers[ $user->user_nicename ] = $this->prepare_user( $user );
+ }
+
+ uasort( $locale_managers, [ $this, '_sort_display_name_callback' ] );
+
+ return $locale_managers;
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Get the general translation editors for the given locale.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param GP_Locale $locale
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function get_general_translation_editors( $locale ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- global $wpdb;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $editors = [];
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $editors = array();
-
- $users = $wpdb->get_col( $wpdb->prepare( "
- SELECT `user_id` FROM `translate_translation_editors`
- WHERE `project_id` = '0' AND `locale` = %s
- ", $locale->slug ) );
-
- if ( ! $users ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result = get_sites( [
+ 'locale' => $locale->wp_locale,
+ 'network_id' => WPORG_GLOBAL_NETWORK_ID,
+ 'path' => '/',
+ 'fields' => 'ids',
+ 'number' => '1',
+ ] );
+ $site_id = array_shift( $result );
+ if ( ! $site_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $editors;
</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">- $user_data = $wpdb->get_results( "SELECT ID, user_nicename, display_name, user_email FROM $wpdb->users WHERE ID IN (" . implode( ',', $users ) . ")" );
- foreach ( $user_data as $user ) {
- if ( $user->display_name && $user->display_name !== $user->user_nicename ) {
- $editors[ $user->user_nicename ] = array(
- 'display_name' => $user->display_name,
- 'email' => $user->user_email,
- 'nice_name' => $user->user_nicename,
- 'slack' => self::get_slack_username( $user->ID ),
- );
- } else {
- $editors[ $user->user_nicename ] = array(
- 'display_name' => $user->user_nicename,
- 'email' => $user->user_email,
- 'nice_name' => $user->user_nicename,
- 'slack' => self::get_slack_username( $user->ID ),
- );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $users = get_users( [
+ 'blog_id' => $site_id,
+ 'role' => 'general_translation_editor',
+ 'count_total' => false,
+ ] );
+
+ foreach ( $users as $user ) {
+ $editors[ $user->user_nicename ] = $this->prepare_user( $user );
</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">- uasort( $editors, array( $this, '_sort_display_name_callback' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ uasort( $editors, [ $this, '_sort_display_name_callback' ] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $editors;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -404,44 +418,60 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function get_project_translation_editors( $locale ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- global $wpdb;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $editors = [];
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $editors = array();
-
- $users = $wpdb->get_col( $wpdb->prepare( "
- SELECT `user_id` FROM `translate_translation_editors`
- WHERE `project_id` <> '0' AND `locale` = %s
- ", $locale->slug ) );
-
- if ( ! $users ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result = get_sites( [
+ 'locale' => $locale->wp_locale,
+ 'network_id' => WPORG_GLOBAL_NETWORK_ID,
+ 'path' => '/',
+ 'fields' => 'ids',
+ 'number' => '1',
+ ] );
+ $site_id = array_shift( $result );
+ if ( ! $site_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $editors;
</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">- $user_data = $wpdb->get_results( "SELECT ID, user_nicename, display_name, user_email FROM $wpdb->users WHERE ID IN (" . implode( ',', $users ) . ")" );
- foreach ( $user_data as $user ) {
- if ( $user->display_name && $user->display_name !== $user->user_nicename ) {
- $editors[ $user->user_nicename ] = array(
- 'display_name' => $user->display_name,
- 'email' => $user->user_email,
- 'nice_name' => $user->user_nicename,
- 'slack' => self::get_slack_username( $user->ID ),
- );
- } else {
- $editors[ $user->user_nicename ] = array(
- 'display_name' => $user->user_nicename,
- 'email' => $user->user_email,
- 'nice_name' => $user->user_nicename,
- 'slack' => self::get_slack_username( $user->ID ),
- );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $users = get_users( [
+ 'blog_id' => $site_id,
+ 'role' => 'translation_editor',
+ 'count_total' => false,
+ ] );
+
+ foreach ( $users as $user ) {
+ $editors[ $user->user_nicename ] = $this->prepare_user( $user );
</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">- uasort( $editors, array( $this, '_sort_display_name_callback' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ uasort( $editors, [ $this, '_sort_display_name_callback' ] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $editors;
</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">+ * Prepares user objects for output.
+ *
+ * @param \WP_User $user The user.
+ * @return array List of user data.
+ */
+ private function prepare_user( $user ) {
+ if ( $user->display_name && $user->display_name !== $user->user_nicename ) {
+ return [
+ 'display_name' => $user->display_name,
+ 'email' => $user->user_email,
+ 'nice_name' => $user->user_nicename,
+ 'slack' => self::get_slack_username( $user->ID ),
+ ];
+ } else {
+ return [
+ 'display_name' => $user->user_nicename,
+ 'email' => $user->user_email,
+ 'nice_name' => $user->user_nicename,
+ 'slack' => self::get_slack_username( $user->ID ),
+ ];
+ }
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Get the translation contributors for the given locale.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param GP_Locale $locale
</span></span></pre>
</div>
</div>
</body>
</html>