IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 4105 | 4105 | 'newVersion' => '', |
| 4106 | 4106 | ); |
| 4107 | 4107 | |
| 4108 | | if ( ! current_user_can( 'update_plugins' ) || 0 !== validate_file( $plugin ) ) { |
| 4109 | | $status['errorMessage'] = __( 'Sorry, you are not allowed to update plugins for this site.' ); |
| | 4108 | if ( ! current_user_can( 'update_plugin', $plugin ) || 0 !== validate_file( $plugin ) ) { |
| | 4109 | $status['errorMessage'] = __( 'Sorry, you are not allowed to update this plugin.' ); |
| 4110 | 4110 | wp_send_json_error( $status ); |
| 4111 | 4111 | } |
| 4112 | 4112 | |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 420 | 420 | $status = 'update_available'; |
| 421 | 421 | $update_file = $file; |
| 422 | 422 | $version = $plugin->new_version; |
| 423 | | if ( current_user_can( 'update_plugins' ) ) { |
| | 423 | if ( current_user_can( 'update_plugin', $file ) ) { |
| 424 | 424 | $url = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $update_file ), 'upgrade-plugin_' . $update_file ); |
| 425 | 425 | } |
| 426 | 426 | break; |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 344 | 344 | return $upgrade_plugins; |
| 345 | 345 | } |
| 346 | 346 | |
| | 347 | /** |
| | 348 | * Returns the number of plugins that the current user isn't allowed to update |
| | 349 | * |
| | 350 | * @return int |
| | 351 | */ |
| | 352 | function wp_get_plugin_updates_disallowed_count() { |
| | 353 | |
| | 354 | // The number of plugins that current user cannot update |
| | 355 | $not_allowed_to_update_count = 0; |
| | 356 | |
| | 357 | $all_plugins = get_plugins(); |
| | 358 | foreach ( (array) $all_plugins as $plugin_file => $plugin_data ) { |
| | 359 | if ( ! current_user_can( 'update_plugin', $plugin_file ) ) { |
| | 360 | $not_allowed_to_update_count++; |
| | 361 | } |
| | 362 | } |
| | 363 | |
| | 364 | return $not_allowed_to_update_count; |
| | 365 | } |
| | 366 | |
| 347 | 367 | /** |
| 348 | 368 | * @since 2.9.0 |
| 349 | 369 | */ |
| … |
… |
|
| 403 | 423 | |
| 404 | 424 | echo '<tr class="plugin-update-tr' . $active_class . '" id="' . esc_attr( $response->slug . '-update' ) . '" data-slug="' . esc_attr( $response->slug ) . '" data-plugin="' . esc_attr( $file ) . '"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message notice inline notice-warning notice-alt"><p>'; |
| 405 | 425 | |
| 406 | | if ( ! current_user_can( 'update_plugins' ) ) { |
| | 426 | if ( ! current_user_can( 'update_plugin', $file ) ) { |
| 407 | 427 | /* translators: 1: plugin name, 2: details URL, 3: additional link attributes, 4: version number */ |
| 408 | 428 | printf( |
| 409 | 429 | __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ), |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 18 | 18 | $plugin = isset( $_REQUEST['plugin'] ) ? wp_unslash( sanitize_text_field( $_REQUEST['plugin'] ) ) : ''; |
| 19 | 19 | |
| 20 | 20 | if ( ! current_user_can( 'edit_plugin', $plugin) ) { |
| 21 | | if( empty( $plugin ) ) |
| | 21 | if ( empty( $plugin ) ) |
| 22 | 22 | wp_die( __( 'Sorry, you are not allowed to edit plugins for this site.' ) ); |
| 23 | 23 | else |
| 24 | 24 | wp_die( __( 'Sorry, you are not allowed to edit this plugin.' ) ); |
| … |
… |
|
| 216 | 216 | <?php |
| 217 | 217 | foreach ( $plugins as $plugin_key => $a_plugin ) { |
| 218 | 218 | |
| 219 | | if( ! current_user_can( 'edit_plugin', $plugin_key) ) |
| | 219 | if ( ! current_user_can( 'edit_plugin', $plugin_key) ) |
| 220 | 220 | continue; |
| 221 | 221 | |
| 222 | 222 | $plugin_name = $a_plugin['Name']; |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 233 | 233 | |
| 234 | 234 | require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
| 235 | 235 | $plugins = get_plugin_updates(); |
| 236 | | if ( empty( $plugins ) ) { |
| | 236 | |
| | 237 | // If all plugins are up to date or the only plugins to update cannot be update by the current user |
| | 238 | if ( empty( $plugins ) || count( $plugins ) == wp_get_plugin_updates_disallowed_count()) { |
| 237 | 239 | echo '<h2>' . __( 'Plugins' ) . '</h2>'; |
| 238 | | echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>'; |
| | 240 | echo '<p>' . __( "There isn't any plugin to update." ) . '</p>'; |
| 239 | 241 | return; |
| 240 | 242 | } |
| 241 | 243 | $form_action = 'update-core.php?action=do-plugin-upgrade'; |
| … |
… |
|
| 263 | 265 | <tbody class="plugins"> |
| 264 | 266 | <?php |
| 265 | 267 | foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
| | 268 | |
| | 269 | if ( ! current_user_can( 'update_plugin', $plugin_file) ) |
| | 270 | continue; |
| | 271 | |
| 266 | 272 | $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); |
| 267 | 273 | |
| 268 | 274 | $icon = '<span class="dashicons dashicons-admin-plugins"></span>'; |
| … |
… |
|
| 719 | 725 | } elseif ( 'do-plugin-upgrade' == $action ) { |
| 720 | 726 | |
| 721 | 727 | if ( ! current_user_can( 'update_plugins' ) ) { |
| 722 | | wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
| | 728 | wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
| 723 | 729 | } |
| 724 | 730 | |
| 725 | 731 | check_admin_referer( 'upgrade-core' ); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 35 | 35 | $plugins = array(); |
| 36 | 36 | } |
| 37 | 37 | |
| | 38 | foreach ( $plugins as $plugin_file ) { |
| | 39 | if ( ! current_user_can( 'update_plugin', $plugin_file ) ) { |
| | 40 | if ( ( $key = array_search( $plugin_file, $plugins ) ) !== false ) { |
| | 41 | unset( $plugins[ $key ] ); |
| | 42 | } |
| | 43 | } |
| | 44 | } |
| | 45 | |
| 38 | 46 | $plugins = array_map( 'urldecode', $plugins ); |
| 39 | 47 | |
| 40 | 48 | $url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) ); |
| … |
… |
|
| 49 | 57 | iframe_footer(); |
| 50 | 58 | |
| 51 | 59 | } elseif ( 'upgrade-plugin' == $action ) { |
| 52 | | if ( ! current_user_can( 'update_plugins' ) ) { |
| 53 | | wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
| | 60 | if ( ! current_user_can( 'update_plugin', $plugin ) ) { |
| | 61 | wp_die( __( 'Sorry, you are not allowed to update this plugin.' ) ); |
| 54 | 62 | } |
| 55 | 63 | |
| 56 | 64 | check_admin_referer( 'upgrade-plugin_' . $plugin ); |
| … |
… |
|
| 71 | 79 | include( ABSPATH . 'wp-admin/admin-footer.php' ); |
| 72 | 80 | |
| 73 | 81 | } elseif ( 'activate-plugin' == $action ) { |
| 74 | | if ( ! current_user_can( 'update_plugins' ) ) { |
| 75 | | wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
| | 82 | if ( ! current_user_can( 'update_plugin', $plugin ) ) { |
| | 83 | wp_die( __( 'Sorry, you are not allowed to update this plugin.' ) ); |
| 76 | 84 | } |
| 77 | 85 | |
| 78 | 86 | check_admin_referer( 'activate-plugin_' . $plugin ); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 416 | 416 | } |
| 417 | 417 | break; |
| 418 | 418 | case 'update_plugins': |
| | 419 | case 'update_plugin': |
| 419 | 420 | case 'delete_plugins': |
| 420 | 421 | case 'delete_plugin': |
| 421 | 422 | case 'install_plugins': |
| … |
… |
|
| 436 | 437 | } elseif ( 'upload_plugins' === $cap ) { |
| 437 | 438 | $caps[] = 'install_plugins'; |
| 438 | 439 | } else { |
| 439 | | $caps[] = ( $cap == 'delete_plugin' ) ? 'delete_plugins' : $cap; |
| | 440 | |
| | 441 | if ( $cap == 'delete_plugin' ) |
| | 442 | $caps[] = 'delete_plugins'; |
| | 443 | elseif ( $cap == 'update_plugin' ) |
| | 444 | $caps[] = 'update_plugins'; |
| | 445 | else |
| | 446 | $caps[] = $cap; |
| 440 | 447 | } |
| 441 | 448 | break; |
| 442 | 449 | case 'install_languages': |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 636 | 636 | if ( $plugins = current_user_can( 'update_plugins' ) ) { |
| 637 | 637 | $update_plugins = get_site_transient( 'update_plugins' ); |
| 638 | 638 | if ( ! empty( $update_plugins->response ) ) { |
| 639 | | $counts['plugins'] = count( $update_plugins->response ); |
| | 639 | $counts['plugins'] = count( $update_plugins->response ) - wp_get_plugin_updates_disallowed_count(); |
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | 642 | |