Changeset 4224
- Timestamp:
- 10/12/2016 01:03:26 PM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r4214 r4224 46 46 add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ) ); 47 47 add_action( 'template_redirect', array( $this, 'prevent_canonical_for_plugins' ), 9 ); 48 add_action( 'template_redirect', array( $this, ' redirect_old_plugin_urls' ) );48 add_action( 'template_redirect', array( $this, 'custom_redirects' ) ); 49 49 add_filter( 'query_vars', array( $this, 'filter_query_vars' ) ); 50 50 add_filter( 'single_term_title', array( $this, 'filter_single_term_title' ) ); … … 293 293 add_rewrite_rule( '^browse/favorites/([^/]+)$', 'index.php?browse=favorites&favorites_user=$matches[1]', 'top' ); 294 294 295 // Handle plugin admin requests 296 add_rewrite_rule( '^([^/]+)/admin/?$', 'index.php?name=$matches[1]&plugin_admin=1', 'top' ); 297 295 298 // Add duplicate search rule which will be hit before the following old-plugin tab rules 296 299 add_rewrite_rule( '^search/([^/]+)/?$', 'index.php?s=$matches[1]', 'top' ); … … 588 591 } 589 592 593 // TODO: Switch this to the capabilities systems 590 594 $restricted_access_statii = array_diff( $wp_query->query_vars['post_status'], array( 'publish' ) ); 591 595 foreach ( $posts as $i => $post ) { … … 777 781 $vars[] = 'favorites_user'; 778 782 $vars[] = 'redirect_plugin_tab'; 783 $vars[] = 'plugin_admin'; 779 784 780 785 return $vars; … … 828 833 829 834 /** 830 * Handles a redirect for the old /$plugin/$tab_name/ URLs and search.php831 */ 832 function redirect_old_plugin_urls() {835 * Handles all the custom redirects needed in the Plugin Directory. 836 */ 837 function custom_redirects() { 833 838 834 839 // Handle a redirect for /$plugin/$tab_name/ to /$plugin/#$tab_name. … … 880 885 wp_safe_redirect( site_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' ) ); 881 886 die(); 887 } 888 889 // TODO: Switch this to the capabilities systems, check if post_author should access 890 // Filter access to the plugin administration area. Only certain users are allowed access. 891 if ( get_query_var( 'plugin_admin' ) && ! current_user_can( 'plugin_review' ) ) { 892 $post = Plugin_Directory::get_plugin_post( get_query_var( 'name' ) ); 893 if ( 894 // Logged out users can't access plugin admin 895 ! is_user_logged_in() || 896 // Allow access to Committers OR Contributors. 897 ! ( 898 // Committers can access plugin admin 899 in_array( wp_get_current_user()->user_login, (array) Tools::get_plugin_committers( $post->post_name ), true ) || 900 // Contributors can access plugin admin (but will have a more limited access) 901 in_array( wp_get_current_user()->user_nicename, (array) wp_list_pluck( get_the_terms( $post, 'plugin_contributors' ), 'slug' ), true ) 902 ) 903 ) { 904 wp_safe_redirect( get_permalink( $post ) ); 905 die(); 906 } 882 907 } 883 908 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/plugin/favorite-button/style.scss
r4223 r4224 38 38 39 39 .plugin-favorite { 40 display: inline-block;41 40 height: 36px; 42 41 text-align: center; 42 vertical-align: top; 43 43 width: 36px; 44 44 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/plugin/style.scss
r4223 r4224 13 13 .plugin-actions { 14 14 float: right; 15 16 div { 17 display: inline-block; 18 text-align: center; 19 } 15 20 } 16 21 … … 20 25 font-weight: 400; 21 26 margin: 0; 27 28 a { 29 color: inherit; 30 text-decoration: none; 31 } 22 32 } 23 33 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style-rtl.css
r4223 r4224 2033 2033 2034 2034 .plugin-favorite { 2035 display: inline-block;2036 2035 height: 36px; 2037 2036 text-align: center; 2037 vertical-align: top; 2038 2038 width: 36px; 2039 2039 } … … 2554 2554 } 2555 2555 2556 .type-plugin .plugin-header .plugin-actions div { 2557 display: inline-block; 2558 text-align: center; 2559 } 2560 2556 2561 .type-plugin .plugin-header .plugin-title { 2557 2562 clear: none; … … 2560 2565 font-weight: 400; 2561 2566 margin: 0; 2567 } 2568 2569 .type-plugin .plugin-header .plugin-title a { 2570 color: inherit; 2571 text-decoration: none; 2562 2572 } 2563 2573 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style.css
r4223 r4224 2033 2033 2034 2034 .plugin-favorite { 2035 display: inline-block;2036 2035 height: 36px; 2037 2036 text-align: center; 2037 vertical-align: top; 2038 2038 width: 36px; 2039 2039 } … … 2554 2554 } 2555 2555 2556 .type-plugin .plugin-header .plugin-actions div { 2557 display: inline-block; 2558 text-align: center; 2559 } 2560 2556 2561 .type-plugin .plugin-header .plugin-title { 2557 2562 clear: none; … … 2560 2565 font-weight: 400; 2561 2566 margin: 0; 2567 } 2568 2569 .type-plugin .plugin-header .plugin-title a { 2570 color: inherit; 2571 text-decoration: none; 2562 2572 } 2563 2573 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php
r4223 r4224 87 87 </div> 88 88 <?php endif; ?> 89 <div> 90 <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>" itemprop="downloadUrl"><?php _e( 'Download', 'wporg-plugins' ); ?></a> 91 <?php if ( true /* TODO: Logic on when to show the edit link */ ) : ?> 92 <br> 93 <a class="plugin-edit" href="<?php echo esc_url( get_permalink() . 'admin/' ); ?>"><?php _e( 'Edit Plugin', 'wporg-plugins' ); ?></a> 94 <?php endif; ?> 95 </div> 89 96 90 <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>" itemprop="downloadUrl"><?php _e( 'Download', 'wporg-plugins' ); ?></a>91 97 <meta itemprop="softwareVersion" content="<?php echo esc_attr( get_post_meta( get_the_ID(), 'version', true ) ); ?>"> 92 98 <meta itemprop="fileFormat" content="application/zip"> 93 99 </div> 94 100 95 <?php the_title( '<h1 class="plugin-title"> ', '</h1>' ); ?>101 <?php the_title( '<h1 class="plugin-title"><a href="' . esc_url( get_permalink() ) . '">', '</a></h1>' ); ?> 96 102 97 103 <span class="byline"><?php … … 102 108 _x( 'By %s', 'post author', 'wporg-plugins' ), 103 109 '<span class="author vcard">' . 104 ( $url ? '<a class="url fn n" href="' . esc_url( $url ) . '">' : '' ) .110 ( $url ? '<a class="url fn n" rel="nofollow" href="' . esc_url( $url ) . '">' : '' ) . 105 111 esc_html( Template::encode( $author ) ) . 106 112 ( $url ? '</a>' : '' ) . … … 112 118 <div class="entry-content"> 113 119 <?php 120 if ( get_query_var( 'plugin_admin' ) ) : 121 get_template_part( 'template-parts/section', 'admin' ); 122 else: 114 123 $plugin_sections = Template::get_plugin_sections(); 115 124 … … 129 138 get_template_part( 'template-parts/section', $section_slug ); 130 139 endforeach; 140 endif; // plugin_admin 131 141 ?> 132 142 </div><!-- .entry-content -->
Note: See TracChangeset
for help on using the changeset viewer.