Changeset 5867 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-support-reps.php
- Timestamp:
- 09/03/2017 09:43:53 PM (7 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-support-reps.php
r5864 r5867 5 5 6 6 /** 7 * The Plugin Committers admin metabox.7 * The Plugin Support Reps admin metabox. 8 8 * 9 9 * @package WordPressdotorg\Plugin_Directory\Admin\Metabox 10 10 */ 11 class Committers {11 class Support_Reps { 12 12 13 13 /** … … 18 18 */ 19 19 public static function postbox_classes( $classes ) { 20 $classes[] = ' committers-meta-box';20 $classes[] = 'support-reps-meta-box'; 21 21 22 22 return array_filter( $classes ); … … 24 24 25 25 /** 26 * Displays a list of committers for the current plugin.26 * Displays a list of support reps for the current plugin. 27 27 */ 28 28 public static function display() { 29 $list = new List_Table\ Committers();29 $list = new List_Table\Support_Reps(); 30 30 $list->prepare_items(); 31 31 $list->display(); … … 33 33 34 34 /** 35 * Ajax handler for adding a new committer.35 * Ajax handler for adding a new support rep. 36 36 */ 37 public static function add_ committer() {38 $login = isset( $_POST['add_ committer'] ) ? sanitize_user( $_POST['add_committer'] ) : '';37 public static function add_support_rep() { 38 $login = isset( $_POST['add_support_rep'] ) ? sanitize_user( $_POST['add_support_rep'] ) : ''; 39 39 $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; 40 40 41 check_ajax_referer( 'add- committer' );41 check_ajax_referer( 'add-support-rep' ); 42 42 43 if ( ! current_user_can( 'plugin_add_ committer', $post_id ) || 'publish' !== get_post_status( $post_id ) ) {43 if ( ! current_user_can( 'plugin_add_support_rep', $post_id ) || 'publish' !== get_post_status( $post_id ) ) { 44 44 wp_die( -1 ); 45 45 } … … 50 50 $post = get_post( $post_id ); 51 51 52 if ( ! $ committer= get_user_by( 'login', $login ) ) {52 if ( ! $support_rep = get_user_by( 'login', $login ) ) { 53 53 $response->add( array( 54 'what' => ' committer',54 'what' => 'support_rep', 55 55 'data' => new \WP_Error( 'error', sprintf( __( 'The user %s does not exist.', 'wporg-plugins' ), '<code>' . $login . '</code>' ) ), 56 56 ) ); … … 58 58 } 59 59 60 $result = Tools:: grant_plugin_committer( $post->post_name, $committer);60 $result = Tools::add_plugin_support_rep( $post->post_name, $support_rep ); 61 61 62 62 if ( ! $result ) { … … 64 64 65 65 $response->add( array( 66 'what' => ' committer',66 'what' => 'support_rep', 67 67 'data' => new \WP_Error( 'error', $message ), 68 68 ) ); … … 70 70 } 71 71 72 $wp_list_table = new List_Table\ Committers();72 $wp_list_table = new List_Table\Support_Reps(); 73 73 74 74 $response->add( array( 75 'what' => ' committer',76 'id' => $ committer->ID,77 'data' => $wp_list_table->single_row( $ committer),75 'what' => 'support_rep', 76 'id' => $support_rep->ID, 77 'data' => $wp_list_table->single_row( $support_rep ), 78 78 'position' => -1, 79 79 ) ); … … 82 82 83 83 /** 84 * Ajax handler for removing a committer.84 * Ajax handler for removing a support rep. 85 85 */ 86 public static function remove_ committer() {86 public static function remove_support_rep() { 87 87 $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; 88 88 $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; 89 89 90 check_ajax_referer( "remove- committer-$id" );90 check_ajax_referer( "remove-support-rep-$id" ); 91 91 92 if ( ! current_user_can( 'plugin_remove_ committer', $post_id ) || 'publish' !== get_post_status( $post_id ) ) {92 if ( ! current_user_can( 'plugin_remove_support_rep', $post_id ) || 'publish' !== get_post_status( $post_id ) ) { 93 93 wp_die( -1 ); 94 94 } … … 97 97 $plugin_slug = get_post( $post_id )->post_name; 98 98 99 if ( ! $ committer= get_user_by( 'id', $id ) ) {99 if ( ! $support_rep = get_user_by( 'id', $id ) ) { 100 100 $response->add( array( 101 'what' => ' committer',101 'what' => 'support_rep', 102 102 'data' => new \WP_Error( 'error', __( 'The specified user does not exist.', 'wporg-plugins' ) ), 103 103 ) ); … … 105 105 } 106 106 107 $result = Tools::re voke_plugin_committer( $plugin_slug, $committer);107 $result = Tools::remove_plugin_support_rep( $plugin_slug, $support_rep ); 108 108 109 109 wp_die( $result );
Note: See TracChangeset
for help on using the changeset viewer.