Changeset 9702
- Timestamp:
- 04/06/2020 06:55:34 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/class-base.php
r9672 r9702 33 33 new Routes\Plugin_Support_Reps(); 34 34 new Routes\Plugin_Self_Close(); 35 new Routes\Plugin_Self_Transfer(); 35 36 } 36 37 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-self-close.php
r9682 r9702 7 7 8 8 /** 9 * An API endpoint for favoriting a particular plugin.9 * An API endpoint for closing a particular plugin. 10 10 * 11 11 * @package WordPressdotorg_Plugin_Directory … … 75 75 // Add an audit-log entry as to why this has happened. 76 76 Tools::audit_log( 77 $plugin,78 sprintf( 'Plugin closed. Reason: Author Self-close Request from %s', $_SERVER['REMOTE_ADDR'] )77 sprintf( 'Plugin closed. Reason: Author Self-close Request from %s', $_SERVER['REMOTE_ADDR'] ), 78 $plugin 79 79 ); 80 80 … … 92 92 The WordPress Plugin Directory Team 93 93 https://make.wordpress.org/plugins', 'wporg-plugins' ), 94 $user->display_name,94 wp_get_current_user()->display_name, 95 95 gmdate( 'Y-m-d H:i:s \G\M\T' ), 96 96 $plugin->post_title, -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r9699 r9702 826 826 827 827 /** 828 * Generates a link to self-transfer a plugin.. 829 * 830 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 831 * @return string URL to toggle status. 832 */ 833 public static function get_self_transfer_link( $post = null ) { 834 $post = get_post( $post ); 835 836 return add_query_arg( 837 array( '_wpnonce' => wp_create_nonce( 'wp_rest' ) ), 838 home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/self-transfer' ) 839 ); 840 } 841 842 /** 828 843 * Returns the reasons for closing or disabling a plugin. 829 844 * -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php
r9698 r9702 338 338 } 339 339 340 /** 341 * Display a form to allow a plugin owner to transfer the ownership of a plugin to someone else. 342 * This does NOT remove their commit ability. 343 */ 344 function the_plugin_self_transfer_form() { 345 $post = get_post(); 346 347 if ( 348 ! current_user_can( 'plugin_admin_edit', $post ) || 349 'publish' != $post->post_status 350 ) { 351 return; 352 } 353 354 echo '<h4>' . esc_html__( 'Transfer This Plugin', 'wporg-plugins' ) . '</h4>'; 355 356 if ( get_current_user_id() != $post->post_author ) { 357 $owner = get_user_by( 'id', $post->post_author ); 358 /* translators: %s: Name of plugin owner */ 359 echo '<p>' . esc_html( sprintf( 360 __( 'This plugin is currently owned by %s, they can choose to transfer ownership rights of the plugin to you.', 'wporg-plugins' ), 361 $owner->display_name 362 ) ) . '</p>'; 363 return; 364 } 365 366 echo '<p>' . esc_html__( 'You are the current owner of this plugin, but you can transfer those rights to another person at any time. The new owner must be added as a committer first.', 'wporg-plugins' ) . '</p>'; 367 368 echo '<div class="plugin-notice notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> Transferring a plugin is intended to be <em>permanent</em>. There is no way to get plugin ownership back unless it has been done maliciously.', 'wporg-plugins' ) . '</p></div>'; 369 370 $users = []; 371 foreach ( Tools::get_plugin_committers( $post->post_name ) as $user_login ) { 372 $user = get_user_by( 'login', $user_login ); 373 if ( $user->ID != get_current_user_id() ) { 374 $users[] = $user; 375 } 376 } 377 if ( ! $users ) { 378 echo '<div class="plugin-notice notice notice-error notice-alt"><p>' . __( 'To transfer a plugin, you must first add the new owner as a committer.', 'wporg-plugins' ) . '</p></div>'; 379 return; 380 } 381 382 echo '<form method="POST" action="' . esc_url( Template::get_self_transfer_link() ) . '">'; 383 echo '<p><label for="new_owner">' . esc_html__( 'New Owner', 'wporg-plugins' ) . '</label><br>'; 384 echo '<select name="new_owner">'; 385 foreach ( $users as $user ) { 386 printf( 387 '<option value="%d">%s</option>' . "\n", 388 esc_attr( $user->ID ), 389 esc_html( $user->display_name . ' (' . $user->user_login . ')' ) 390 ); 391 } 392 echo '</select></p>'; 393 // Translators: %s is the plugin name, as defined by the plugin itself. 394 echo '<p><input class="button" type="submit" value="' . esc_attr( sprintf( __( 'Please transfer %s.', 'wporg-plugins' ), get_the_title() ) ) . '" /></p>'; 395 echo '</form>'; 396 397 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php
r9698 r9702 50 50 <div class="plugin-notice notice notice-error notice-alt"><p><?php esc_html_e( 'These features often cannot be undone without intervention. Please do not attempt to use them unless you are absolutely certain. When in doubt, contact the plugins team for assistance.', 'wporg-plugins' ); ?></p></div> 51 51 52 <?php the_plugin_self_transfer_form(); ?> 53 52 54 <?php the_plugin_self_close_button(); ?> 55 53 56 </div>
Note: See TracChangeset
for help on using the changeset viewer.