Changeset 2659 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
- Timestamp:
- 03/01/2016 07:59:36 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r2655 r2659 27 27 28 28 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); 29 add_action( 'wp_ajax_save-note', array( $this, 'save_note' ) ); 29 30 } 30 31 … … 55 56 if ( 'post.php' == $hook_suffix && 'plugin' == $post_type ) { 56 57 wp_enqueue_style( 'plugin-admin-edit-css', plugins_url( 'css/edit-form.css', Plugin_Directory\PLUGIN_FILE ), array( 'edit' ), 1 ); 57 wp_enqueue_script( 'plugin-admin-edit-js', plugins_url( 'js/edit-form.js', Plugin_Directory\PLUGIN_FILE ), array( ), 1 );58 wp_enqueue_script( 'plugin-admin-edit-js', plugins_url( 'js/edit-form.js', Plugin_Directory\PLUGIN_FILE ), array( 'wp-util' ), 1 ); 58 59 } 59 60 } … … 75 76 array( __NAMESPACE__ . '\Metabox\Committers', 'display' ), 76 77 'plugin', 'side' 78 ); 79 80 add_meta_box( 81 'plugin-notes', 82 __( 'Internal Notes', 'wporg-plugins' ), 83 array( __NAMESPACE__ . '\Metabox\Notes', 'display' ), 84 'plugin', 'normal', 'high' 77 85 ); 78 86 … … 118 126 } 119 127 128 /** 129 * Saves a plugin note. 130 */ 131 public function save_note() { 132 check_admin_referer( 'save-note', 'notce' ); 133 134 if ( empty( $_POST['id'] ) ) { 135 wp_send_json_error( array( 'errorCode' => 'no_post_specified' ) ); 136 } 137 138 if ( ! current_user_can( 'review_plugin', absint( $_POST['id'] ) ) ) { 139 wp_send_json_error( array( 140 'error' => __( 'You do not have sufficient permissions to edit notes on this site.' ), 141 ) ); 142 } 143 144 update_post_meta( absint( $_POST['id'] ), 'note', wp_kses_post( $_POST['note'] ) ); 145 146 wp_send_json_success( array( 147 'note' => wpautop( wp_kses_post( $_POST['note'] ) ), 148 ) ); 149 } 120 150 }
Note: See TracChangeset
for help on using the changeset viewer.