Changeset 6118
- Timestamp:
- 11/14/2017 05:01:46 AM (7 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r6034 r6118 268 268 269 269 case 'closed': 270 $message = __( 'This plugin is closed and no longer available for use.', 'wporg-plugins' );270 $message = __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' ); 271 271 $type = 'notice-error'; 272 272 break; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r5867 r6118 45 45 add_filter( 'the_content', array( $this, 'filter_rel_nofollow' ) ); 46 46 add_action( 'wp_head', array( Template::class, 'json_ld_schema' ), 1 ); 47 add_action( 'wp_head', array( Template::class, ' meta_description' ), 1 );47 add_action( 'wp_head', array( Template::class, 'output_meta' ), 1 ); 48 48 add_action( 'wp_head', array( Template::class, 'hreflang_link_attributes' ), 2 ); 49 49 … … 318 318 register_post_status( 'disabled', array( 319 319 'label' => _x( 'Disabled', 'plugin status', 'wporg-plugins' ), 320 'public' => false,320 'public' => true, 321 321 'show_in_admin_status_list' => current_user_can( 'plugin_disable' ), 322 322 'label_count' => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'wporg-plugins' ), … … 330 330 register_post_status( 'closed', array( 331 331 'label' => _x( 'Closed', 'plugin status', 'wporg-plugins' ), 332 'public' => false,332 'public' => true, 333 333 'show_in_admin_status_list' => current_user_can( 'plugin_close' ), 334 334 'label_count' => _n_noop( 'Closed <span class="count">(%s)</span>', 'Closed <span class="count">(%s)</span>', 'wporg-plugins' ), … … 789 789 790 790 // For singular requests, or self-author profile requests allow restricted post_status items to show on the front-end. 791 if ( $wp_query->is_main_query() && ( $viewing_own_author_archive || is_user_logged_in() && ! empty( $wp_query->query_vars['name'] ) ) ) {791 if ( $wp_query->is_main_query() && ( $viewing_own_author_archive || is_user_logged_in() && ! empty( $wp_query->query_vars['name'] ) ) ) { 792 792 793 793 $wp_query->query_vars['post_status'] = array( 'approved', 'publish', 'closed', 'disabled' ); … … 817 817 return $posts; 818 818 }, 10, 2 ); 819 } 820 821 // Allow anyone to view a closed plugin directly from its page. It won't show in search results or lists. 822 if ( $wp_query->is_main_query() && ! empty( $wp_query->query_vars['name'] ) ) { 823 $wp_query->query_vars['post_status'] = (array) $wp_query->query_vars['post_status']; 824 $wp_query->query_vars['post_status'][] = 'closed'; 825 $wp_query->query_vars['post_status'][] = 'disabled'; 826 $wp_query->query_vars['post_status'] = array_unique( $wp_query->query_vars['post_status'] ); 819 827 } 820 828 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r6027 r6118 46 46 47 47 // Schema for plugin pages. 48 if ( is_singular( 'plugin' ) ) : 49 $plugin = get_queried_object(); 50 51 $rating = get_post_meta( $plugin->ID, 'rating', true ) ?: 0; 52 $ratings = get_post_meta( $plugin->ID, 'ratings', true ) ?: []; 53 $num_ratings = array_sum( $ratings ); 54 55 echo PHP_EOL; 56 ?> 48 if ( is_singular( 'plugin' ) && 'publish' === get_post_status( get_queried_object_id() ) ) { 49 self::plugin_json_jd_schema( get_queried_object() ); 50 } 51 } 52 53 /** 54 * Prints JSON LD schema for a specific plugin. 55 * 56 * @static 57 * 58 * @param \WP_Post $plugin Plugin to output JSON LD Schema for. 59 */ 60 protected static function plugin_json_jd_schema( $plugin ) { 61 $rating = get_post_meta( $plugin->ID, 'rating', true ) ?: 0; 62 $ratings = get_post_meta( $plugin->ID, 'ratings', true ) ?: []; 63 $num_ratings = array_sum( $ratings ); 64 65 echo PHP_EOL; 66 ?> 57 67 <script type="application/ld+json"> 58 68 [ … … 115 125 ] 116 126 </script> 117 <?php 118 endif; 119 } 120 121 /** 122 * Prints meta description in the head of a page. 123 * 124 * @static 125 */ 126 public static function meta_description() { 127 <?php 128 } 129 130 /** 131 * Prints meta tags in the head of a page. 132 * 133 * @static 134 */ 135 public static function output_meta() { 136 $metas = []; 137 127 138 if ( is_singular( 'plugin' ) ) { 128 printf( '<meta name="description" value="%s"/>',129 esc_attr( get_the_excerpt( get_queried_object()) )139 $metas[] = sprintf( '<meta name="description" value="%s" />', 140 esc_attr( get_the_excerpt() ) 130 141 ); 131 } 142 143 // Add noindex on disabled plugin page. 144 if ( 'publish' !== get_post_status() ) { 145 $metas[] = '<meta name="robots" content="noindex" />'; 146 } 147 } 148 149 echo implode( "\n", $metas ); 132 150 } 133 151 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php
r5457 r6118 15 15 16 16 $content = Plugin_Directory::instance()->split_post_content_into_pages( get_the_content() ); 17 $status = get_post_status(); 17 18 18 19 ?><article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> … … 25 26 </div><!-- .plugin-notice --> 26 27 <?php endif; ?> 27 <?php if ( 'publish' != get_post()->post_status ) :28 <?php if ( 'publish' !== $status ) : 28 29 $notice_type = 'notice-error'; 29 switch ( get_post()->post_status ) {30 switch ( $status ) { 30 31 case 'draft': 31 32 case 'pending': … … 40 41 41 42 case 'rejected': 42 $message = __( 'This plugin isrejected and is not visible to the public.', 'wporg-plugins' );43 $message = __( 'This plugin has been rejected and is not visible to the public.', 'wporg-plugins' ); 43 44 break; 44 45 45 46 case 'disabled': 46 47 if ( current_user_can( 'plugin_approve' ) ) { 47 $message = __( 'This plugin is disabled (closed, but actively serving updates) and is not visible to the public.', 'wporg-plugins' ); 48 $message = __( 'This plugin is disabled (closed, but actively serving updates).', 'wporg-plugins' ); 49 break; 50 } else { 51 $message = __( 'This plugin has been closed for new installs.', 'wporg-plugins' ); 48 52 break; 49 53 } … … 51 55 default: 52 56 case 'closed': 53 $message = __( 'This plugin is closed and is not visible to the public.', 'wporg-plugins' );57 $message = __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' ); 54 58 break; 55 59 } … … 58 62 <p><?php echo $message; ?></p> 59 63 </div><!-- .plugin-notice --> 64 65 <?php if ( in_array( $status, array( 'closed', 'disabled' ) ) && get_current_user_id() == get_post()->post_author ) : ?> 66 <div class="plugin-notice notice notice-info notice-alt"> 67 <p><?php 68 printf( 69 /* translators: 1: plugins@wordpress.org */ 70 __( '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' ), 71 'plugins@wordpress.org' 72 ); 73 ?></p> 74 </div><!-- .plugin-notice --> 75 <?php endif; ?> 60 76 <?php endif; ?> 61 77 … … 96 112 <?php endif; ?> 97 113 98 <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>"><?php _e( 'Download', 'wporg-plugins' ); ?></a> 114 <?php if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', get_post() ) ) : ?> 115 <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>"><?php _e( 'Download', 'wporg-plugins' ); ?></a> 116 <?php endif; ?> 99 117 </div> 100 118 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php
r5255 r6118 41 41 $tags = array_reverse( $tags ); 42 42 43 if ( $tags ) {43 if ( $tags && 'publish' === get_post_status() ) { 44 44 echo '<h5>' . __( 'Previous Versions', 'wporg-plugins' ) . '</h5>'; 45 45
Note: See TracChangeset
for help on using the changeset viewer.