WordPress.org

Making WordPress.org


Ignore:
Timestamp:
03/30/2017 09:44:49 PM (3 years ago)
Author:
obenland
Message:

Plugin Directory: Update developers section.

Replaces lists with full sentences and adds locale details.

See #1824.
Fixes #2629.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-developers.php

    r5214 r5218  
    11<?php
    22namespace WordPressdotorg\Plugin_Directory\Shortcodes;
    3 use WordPressdotorg\Plugin_Directory\Template;
     3use WordPressdotorg\Plugin_Directory\Plugin_I18n;
    44use WordPressdotorg\Plugin_Directory\Tools;
    55
     
    1616    static function display() {
    1717        $post   = get_post();
    18         $output = '<p>' . sprintf( __( '%s is open source software. The following people have contributed to this plugin.', 'wporg-plugins' ), get_the_title( $post ) ) . '</p>';
     18        $slug   = $post->post_name;
     19        $title  = get_the_title( $post );
     20        $output = '<p>' . sprintf( __( '%s is open source software. The following people have contributed to this plugin.', 'wporg-plugins' ), $title ) . '</p>';
    1921
    2022        ob_start();
     
    2830        $output .= ob_get_clean();
    2931
     32        $locales = Plugin_I18n::instance()->get_locales();
     33        $output .= '<p>';
     34
     35        if ( ! empty( $locales ) ) {
     36            $locales_list = implode( ', ', array_map( function( $locale ) use ( $slug ) {
     37                return sprintf( '<a href="%1$s">%2$s</a>', esc_url( "{$locale->locale}.wordpress.org/plugins/{$slug}/" ), $locale->name );
     38            }, $locales ) );
     39            /* Translators: 1: Plugin name; 2: Number of locales; 3: List of locales; */
     40            $output .= sprintf( '%1$s has been translated into these %2$d locales: %3$s.', $title, count( $locales ), $locales_list ) . ' ';
     41            $output .= sprintf(
     42                /* Translators: URL to translator view; */
     43                __( 'Thank you to <a href="%s">the translators</a> for their contributions.', 'wporg-plugins' ),
     44                esc_url( "https://translate.wordpress.org/projects/wp-plugins/{$slug}/contributors" )
     45            );
     46            $output .= '<br />';
     47        }
     48
     49        /* Translators: 1: GlotPress URL; 2: Plugin name; */
     50        $output .= sprintf( __( '<a href="%1$s">Translate %2$s into your language.</a>', 'wporg-plugins' ), esc_url( 'https://translate.wordpress.org/projects/wp-plugins/' . $slug ), $title );
     51        $output .= '</p>';
     52
     53        $output   .= '<h3>' . __( 'Interested in development?', 'wporg-plugins' ) . '</h3>';
     54        /* Translators: 1: Trac URL; 2: Development log URL; 3: RSS URL; */
     55        $format    = __( '<a href="%1$s">Browse the code</a> or subscribe to the <a href="%2$s">development log</a> by <a href="%3$s">RSS</a>.' );
     56        $email_url = '';
     57
    3058        if ( is_user_logged_in() ) {
     59            /* Translators: 1: Trac URL; 2: Development log URL; 3: RSS URL; 4: Email subscription URL; */
     60            $format     = __( '<a href="%1$s">Browse the code</a> or subscribe to the <a href="%2$s">development log</a> by <a href="%4$s">email</a> or <a href="%3$s">RSS</a>.' );
    3161            $subscribed = Tools::subscribed_to_plugin_commits( $post, get_current_user_id() );
    32 
    33             $subscribe_change_url = esc_url( add_query_arg( array(
     62            $email_url  = esc_url( add_query_arg( array(
    3463                '_wpnonce' => wp_create_nonce( 'wp_rest' ),
    3564                ( $subscribed ? 'unsubscribe' : 'subscribe' ) => '1',
    36             ), home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/commit-subscription' ) ) );
     65            ), home_url( "wp-json/plugins/v1/plugin/{$slug}/commit-subscription" ) ) );
    3766        }
    3867
    39         return $output .
    40             '<h3>' . __( 'Browse the code', 'wporg-plugins' ) . '</h3>' .
    41             '<ul>' .
    42                 '<li>' .
    43                     '<a href="' . esc_url( "https://plugins.trac.wordpress.org/log/{$post->post_name}/" ) . '" rel="nofollow">' . __( 'Development Log', 'wporg-plugins' ) . '</a>' . "\n" .
    44                     '<a href="' . esc_url( "https://plugins.trac.wordpress.org/log/{$post->post_name}/?limit=100&mode=stop_on_copy&format=rss" ) . '" rel="nofollow"><img src="https://s.w.org/style/images/feedicon.png" /></a>' .
    45                 '</li>' .
    46                 '<li><a href="' . esc_url( "https://plugins.svn.wordpress.org/{$post->post_name}/" ) . '" rel="nofollow">' . __( 'Subversion Repository', 'wporg-plugins' ) . '</a></li>' .
    47                 '<li><a href="' . esc_url( "https://plugins.trac.wordpress.org/browser/{$post->post_name}/" ) . '" rel="nofollow">' . __( 'Browse in Trac', 'wporg-plugins' ) . '</a></li>' .
    48                 '<li><a href="' . esc_url( "https://translate.wordpress.org/projects/wp-plugins/{$post->post_name}/" ) . '" rel="nofollow">' . __( 'Translation Contributors', 'wporg-plugins' ) . '</a></li>' .
    49                  ( !is_user_logged_in() ? '' : (
    50                     $subscribed ?
    51                     "<li><a href='$subscribe_change_url'>" . __( 'Unsubscribe from plugin commits', 'wporg-plugins' ) . '</a></li>' :
    52                     "<li><a href='$subscribe_change_url'>" . __( 'Subscribe to plugin commits via email', 'wporg-plugins' ) . '</a></li>'
    53                  ) ) .
    54             '</ul>';
     68        $output .= '<p>' . sprintf(
     69            $format,
     70            esc_url( "https://plugins.trac.wordpress.org/browser/{$slug}/" ),
     71            esc_url( "https://plugins.trac.wordpress.org/log/{$slug}/" ),
     72            esc_url( "https://plugins.trac.wordpress.org/log/{$slug}/?limit=100&mode=stop_on_copy&format=rss" ),
     73            $email_url
     74        ) . '</p>';
     75
     76        return $output;
    5577    }
    5678}
Note: See TracChangeset for help on using the changeset viewer.