Making WordPress.org

Changeset 6225


Ignore:
Timestamp:
12/03/2017 09:41:48 PM (9 years ago)
Author:
Otto42
Message:

Plugins: Modify how the plugin pages look for closed plugins.

  • Display that the plugin was closed and when (if we have that information)
  • Show plugin author a notification box telling them to contact plugins@ if they didn't get an email why
  • Hide most of the content from the readme
  • Don't display the plugin name, just the slug in its place
  • Hide icons, banners, any content from the plugin author
  • Leave space for reasons of closure for future enhancement

Fixes #2627. props @joostdevalk, @otto42

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r6212 r6225  
    1818
    1919?><article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    20         <?php echo Template::get_plugin_banner( get_post(), 'html' ); ?>
     20    <?php
     21    // Don't show the plugin banner for closed plugins
     22    if ( ! in_array( $status, array( 'closed', 'disabled' ) ) ) {
     23            echo Template::get_plugin_banner( get_post(), 'html' );
     24    }
     25    ?>
    2126
    2227        <header class="plugin-header">
     
    2429                        <div class="plugin-notice notice notice-warning notice-alt">
    2530                                <p><?php _e( 'This plugin <strong>hasn&#146;t been updated in over 2 years</strong>. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.', 'wporg-plugins' ); ?></p>
    26                         </div><!-- .plugin-notice -->
     31                        </div>
    2732                <?php endif; ?>
    2833                <?php if ( 'publish' !== $status ) :
     
    6671                                }
    6772            }
     73
     74                if ( ! in_array( $status, array( 'closed', 'disabled' ) ) ) {
     75                                    // the notice for closed and disabled is shown below the Description header, because we don't output the readme there
    6876                        ?>
     77            <!-- .plugin-notice -->
    6978                        <div class="plugin-notice notice <?php echo esc_attr( $notice_type ); ?> notice-alt">
    7079                                <p><?php echo $message; ?></p>
    71                         </div><!-- .plugin-notice -->
    72 
    73                         <?php if ( in_array( $status, array( 'closed', 'disabled' ) ) && get_current_user_id() == get_post()->post_author ) : ?>
    74                                 <div class="plugin-notice notice notice-info notice-alt">
    75                                         <p><?php
    76                                                 printf(
    77                                                         /* translators: 1: plugins@wordpress.org */
    78                                                         __( 'If you did not request this change, please contact <a href="mailto:%1$s">%1$s</a> for a status. All developers with commit access are contacted when a plugin is closed, with the reasons why, so check your spam email too.', 'wporg-plugins' ),
    79                                                         'plugins@wordpress.org'
    80                                                 );
    81                                         ?></p>
    82                                 </div><!-- .plugin-notice -->
    83                         <?php endif; ?>
     80                        </div>
     81            <!-- .plugin-notice -->
     82        <?php } ?>
    8483                <?php endif; ?>
    8584
    8685                <div class="entry-thumbnail">
    87                         <?php echo Template::get_plugin_icon( get_post(), 'html' ); ?>
     86            <?php
     87            // Don't show the icon for closed plugins
     88            if ( ! in_array( $status, array( 'closed', 'disabled' ) ) ) {
     89                            echo Template::get_plugin_icon( get_post(), 'html' );
     90            }
     91            ?>
    8892                </div>
    8993
     
    124128                        <?php endif; ?>
    125129                </div>
    126 
    127                 <?php the_title( '<h1 class="plugin-title"><a href="' . esc_url( get_permalink() ) . '">', '</a></h1>' ); ?>
     130       
     131                <?php
     132                if ( in_array( $status, array( 'closed', 'disabled' ) ) ) {
     133                        add_filter( 'the_title', function( $title, $id ) {
     134                                $post = get_post( $id );
     135                                return $post->post_name;
     136                        }, 10, 2 );
     137                }
     138        the_title( '<h1 class="plugin-title"><a href="' . esc_url( get_permalink() ) . '">', '</a></h1>' ); ?>
    128139
    129140                <span class="byline"><?php
     
    150161                <li id="tablink-description"><a href='#description'><?php _e( 'Details', 'wporg-plugins' ); ?></a></li>
    151162                <li id="tablink-reviews"><a href='#reviews'><?php _e( 'Reviews', 'wporg-plugins' ); ?></a></li>
    152 <?php if ( isset( $content[ 'installation' ] ) ) { ?>
     163<?php if ( isset( $content[ 'installation' ] ) && ! in_array( $status, array( 'closed', 'disabled' ) ) ) { ?>
    153164                <li id="tablink-installation"><a href='#installation'><?php _e( 'Installation', 'wporg-plugins' ); ?></a></li>
    154165<?php } ?>
     
    169180                                }
    170181
    171                                 $section_content = trim( apply_filters( 'the_content', $content[ $section_slug ], $section_slug ) );
     182                                if ( 'description' === $section_slug && in_array( $status, array( 'closed', 'disabled' ) ) ) {
     183                                // Don't show the description for closed plugins
     184                                        $section_content = '<div class="plugin-notice notice notice-error notice-alt"><p>' . $message . '</p></div>';
     185                            if ( get_current_user_id() == get_post()->post_author ) {
     186                                    $section_content .= '<div class="plugin-notice notice notice-info notice-alt"><p>' .
     187                                                        sprintf(
     188                                                        /* translators: 1: plugins@wordpress.org */
     189                                                                __( 'If you did not request this change, please contact <a href="mailto:%1$s">%1$s</a> for a status. All developers with commit access are contacted when a plugin is closed, with the reasons why, so check your spam email too.', 'wporg-plugins' ),
     190                                                                'plugins@wordpress.org'
     191                                                        ) . '</p></div><!-- .plugin-notice -->';
     192                            }
     193                                }
     194                                else if ( in_array( $section_slug, array( 'screenshots', 'installation', 'faq', 'changelog' ) ) && in_array( $status, array( 'closed', 'disabled' ) ) ) {
     195                                $section_content = '';
     196                                }
     197                                else {
     198                                        $section_content = trim( apply_filters( 'the_content', $content[ $section_slug ], $section_slug ) );
     199                                }
     200
    172201                                if ( empty( $section_content ) ) {
    173202                                        continue;
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php

    r6118 r6225  
    1414
    1515<div id="admin" class="section">
     16    <?php
     17    $status  = get_post_status();
     18    if ( in_array( $status, array( 'closed', 'disabled' ) ) ) {
     19            echo '<div class="plugin-notice notice notice-error notice-alt"><p>' . __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' ) . '</p></div>';
     20            if ( get_current_user_id() == get_post()->post_author ) {
     21                    echo '<div class="plugin-notice notice notice-info notice-alt"><p>' .
     22                                        sprintf(
     23                                        /* translators: 1: plugins@wordpress.org */
     24                                                __( 'If you did not request this change, please contact <a href="mailto:%1$s">%1$s</a> for a status. All developers with commit access are contacted when a plugin is closed, with the reasons why, so check your spam email too.', 'wporg-plugins' ),
     25                                                'plugins@wordpress.org'
     26                                        ) . '</p></div><!-- .plugin-notice -->';
     27            }
     28    }
     29
     30    ?>
    1631        <h2><?php _e( 'Plugin Stats', 'wporg-plugins' ); ?></h2>
    1732
Note: See TracChangeset for help on using the changeset viewer.