Changeset 38168 for trunk/src/wp-admin/includes/ajax-actions.php
- Timestamp:
- 07/27/2016 05:42:01 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r38167 r38168 3654 3654 } 3655 3655 3656 $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) ); 3657 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); 3656 $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) ); 3658 3657 3659 3658 $status = array( 3660 3659 'update' => 'plugin', 3661 'plugin' => $plugin,3662 3660 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), 3663 'pluginName' => $plugin_data['Name'],3664 3661 'oldVersion' => '', 3665 3662 'newVersion' => '', 3666 3663 ); 3667 3664 3665 if ( ! current_user_can( 'update_plugins' ) || 0 !== validate_file( $plugin ) ) { 3666 $status['errorMessage'] = __( 'Sorry, you are not allowed to update plugins for this site.' ); 3667 wp_send_json_error( $status ); 3668 } 3669 3670 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); 3671 $status['plugin'] = $plugin; 3672 $status['pluginName'] = $plugin_data['Name']; 3673 3668 3674 if ( $plugin_data['Version'] ) { 3669 3675 /* translators: %s: Plugin version */ 3670 3676 $status['oldVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); 3671 }3672 3673 if ( ! current_user_can( 'update_plugins' ) ) {3674 $status['errorMessage'] = __( 'Sorry, you are not allowed to update plugins for this site.' );3675 wp_send_json_error( $status );3676 3677 } 3677 3678 … … 3749 3750 3750 3751 if ( empty( $_POST['slug'] ) || empty( $_POST['plugin'] ) ) { 3751 wp_send_json_error( array( 'errorCode' => 'no_plugin_specified' ) ); 3752 } 3753 3754 $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) ); 3755 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); 3752 wp_send_json_error( array( 3753 'slug' => '', 3754 'errorCode' => 'no_plugin_specified', 3755 'errorMessage' => __( 'No plugin specified.' ), 3756 ) ); 3757 } 3758 3759 $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) ); 3756 3760 3757 3761 $status = array( 3758 'delete' => 'plugin', 3759 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), 3760 'plugin' => $plugin, 3761 'pluginName' => $plugin_data['Name'], 3762 'delete' => 'plugin', 3763 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), 3762 3764 ); 3763 3765 3764 if ( ! current_user_can( 'delete_plugins' ) ) {3766 if ( ! current_user_can( 'delete_plugins' ) || 0 !== validate_file( $plugin ) ) { 3765 3767 $status['errorMessage'] = __( 'Sorry, you are not allowed to delete plugins for this site.' ); 3766 3768 wp_send_json_error( $status ); 3767 3769 } 3770 3771 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); 3772 $status['plugin'] = $plugin; 3773 $status['pluginName'] = $plugin_data['Name']; 3768 3774 3769 3775 if ( is_plugin_active( $plugin ) ) {
Note: See TracChangeset
for help on using the changeset viewer.