Making WordPress.org


Ignore:
Timestamp:
03/15/2016 08:02:51 PM (10 years ago)
Author:
obenland
Message:

Plugin Directory: Allow plugin committers to be added and removed.

Still needs cap checks.
Uses wpList to seemlessly add/remove committers. Works similar to the
category meta box.

See #1571.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php

    r2737 r2752  
    3030
    3131                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
     32
    3233                add_action( 'wp_ajax_replyto-comment', array( $this, 'save_custom_comment' ), 0 );
    33 
    34                 add_filter( 'postbox_classes_plugin_internal-notes', array( $this, 'postbox_classes' ) );
    3534                add_filter( 'comment_row_actions', array( $this, 'custom_comment_row_actions' ), 10, 2 );
     35
     36                add_filter( 'postbox_classes_plugin_internal-notes',    array( __NAMESPACE__ . '\Metabox\Internal_Notes', 'postbox_classes' ) );
     37                add_filter( 'postbox_classes_plugin_plugin-committers', array( __NAMESPACE__ . '\Metabox\Committers',     'postbox_classes' ) );
     38                add_filter( 'wp_ajax_add-committer',    array( __NAMESPACE__ . '\Metabox\Committers', 'add_committer'    ) );
     39                add_filter( 'wp_ajax_delete-committer', array( __NAMESPACE__ . '\Metabox\Committers', 'remove_committer' ) );
    3640        }
    3741
     
    6165                global $post_type;
    6266
    63                 if ( 'post.php' == $hook_suffix && 'plugin' == $post_type ) {
     67                if ( 'post.php' === $hook_suffix && 'plugin' === $post_type ) {
    6468                        wp_enqueue_style( 'plugin-admin-edit-css', plugins_url( 'css/edit-form.css', Plugin_Directory\PLUGIN_FILE ), array( 'edit' ), 1 );
    65                         wp_enqueue_script( 'plugin-admin-edit-js', plugins_url( 'js/edit-form.js', Plugin_Directory\PLUGIN_FILE ), array( 'wp-util' ), 1 );
     69                        wp_enqueue_script( 'plugin-admin-edit-js', plugins_url( 'js/edit-form.js', Plugin_Directory\PLUGIN_FILE ), array( 'wp-util', 'wp-lists' ), 1 );
     70                        wp_localize_script( 'plugin-admin-edit-js', 'pluginDirectory', array(
     71                                'removeCommitterAYS' => __( 'Are you sure you want to remove this committer?', 'wporg-plugins' ),
     72                        ) );
    6673                }
    6774        }
     
    133140                        update_post_meta( $post_id, 'tested', wp_slash( wp_unslash( $_POST['tested_with'] ) ) );
    134141                }
    135         }
    136 
    137         /**
    138          * Filters the postbox classes for custom comment meta boxes.
    139          *
    140          * @param array $classes An array of postbox classes.
    141          * @return array
    142          */
    143         public function postbox_classes( $classes ) {
    144                 $classes[] = 'comments-meta-box';
    145 
    146                 return array_filter( $classes );
    147142        }
    148143
     
    160155         */
    161156        public function custom_comment_row_actions( $actions, $comment ) {
    162                 if ( 'internal-note' === $comment->comment_type ) {
     157                if ( 'internal-note' === $comment->comment_type && isset( $_REQUEST['mode'] ) && 'single' === $_REQUEST['mode'] ) {
    163158                        $allowed_actions = array( 'reply' => true );
    164159
Note: See TracChangeset for help on using the changeset viewer.