| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Plugin Report |
| 4 | 4 | * Plugin URI: https://roytanck.com/?p=277 |
| 5 | 5 | * Description: Provides detailed information about currently installed plugins |
| 6 | - * Version: 1.8 | |
| 6 | + * Version: 1.7 | |
| 7 | 7 | * Requires at least: 4.6 |
| 8 | 8 | * Requires PHP: 5.6 |
| 9 | 9 | * Author: Roy Tanck |
| 10 | 10 | * Author URI: https://roytanck.com |
| @@ -27,10 +27,10 @@ | ||
| 27 | 27 | const CSS_CLASS_MED = 'pr-risk-medium'; |
| 28 | 28 | const CSS_CLASS_HIGH = 'pr-risk-high'; |
| 29 | 29 | |
| 30 | 30 | // Other class constants. |
| 31 | - const PLUGIN_VERSION = '1.8'; | |
| 32 | - const COLS_PER_ROW = 8; | |
| 31 | + const PLUGIN_VERSION = '1.7'; | |
| 32 | + const COLS_PER_ROW = 7; | |
| 33 | 33 | const CACHE_LIFETIME = DAY_IN_SECONDS; |
| 34 | 34 | const CACHE_LIFETIME_NOREPO = WEEK_IN_SECONDS; |
| 35 | 35 | |
| 36 | 36 | /** |
| @@ -131,9 +131,8 @@ | ||
| 131 | 131 | echo '<th>' . esc_html__( 'Name', 'plugin-report' ) . '</th>'; |
| 132 | 132 | echo '<th>' . esc_html__( 'Author', 'plugin-report' ) . '</th>'; |
| 133 | 133 | echo '<th>' . esc_html__( 'Activated', 'plugin-report' ) . '</th>'; |
| 134 | 134 | echo '<th data-sort-method="none" class="no-sort">' . esc_html__( 'Installed version', 'plugin-report' ) . '</th>'; |
| 135 | - echo '<th>' . esc_html__( 'Auto-update' ) . '</th>'; | |
| 136 | 135 | echo '<th>' . esc_html__( 'Last update', 'plugin-report' ) . '</th>'; |
| 137 | 136 | echo '<th data-sort-method="dotsep">' . esc_html__( 'Tested up to WP version', 'plugin-report' ) . '</th>'; |
| 138 | 137 | echo '<th data-sort-method="number">' . esc_html__( 'Rating', 'plugin-report' ) . '</th>'; |
| 139 | 138 | echo '</tr>'; |
| @@ -267,13 +266,12 @@ | ||
| 267 | 266 | * Uses transient caching to avoid doing repo API calls on every page visit |
| 268 | 267 | */ |
| 269 | 268 | private function assemble_plugin_report( $slug ) { |
| 270 | 269 | if ( ! empty( $slug ) ) { |
| 271 | - $report = array(); | |
| 272 | - $cache_key = $this->create_cache_key( $slug ); | |
| 273 | - $cache = get_site_transient( $cache_key ); | |
| 274 | - $plugins = get_plugins(); | |
| 275 | - $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); | |
| 270 | + $report = array(); | |
| 271 | + $cache_key = $this->create_cache_key( $slug ); | |
| 272 | + $cache = get_site_transient( $cache_key ); | |
| 273 | + $plugins = get_plugins(); | |
| 276 | 274 | |
| 277 | 275 | if ( empty( $cache ) ) { |
| 278 | 276 | |
| 279 | 277 | // Add the plugin's slug to the report. |
| @@ -281,11 +279,10 @@ | ||
| 281 | 279 | |
| 282 | 280 | // Get the locally available info, and add it to the report. |
| 283 | 281 | foreach ( $plugins as $key => $plugin ) { |
| 284 | 282 | if ( $this->get_plugin_slug( $key ) == $slug ) { |
| 285 | - $report['local_info'] = $plugin; | |
| 286 | - $report['file_path'] = $key; | |
| 287 | - $report['auto-update'] = in_array( $key, $auto_updates ); | |
| 283 | + $report['local_info'] = $plugin; | |
| 284 | + $report['file_path'] = $key; | |
| 288 | 285 | break; |
| 289 | 286 | } |
| 290 | 287 | } |
| 291 | 288 | |
| @@ -334,10 +331,8 @@ | ||
| 334 | 331 | /** |
| 335 | 332 | * From a report, generate an HTML table row with relevant data for the plugin |
| 336 | 333 | */ |
| 337 | 334 | private function render_table_row( $report ) { |
| 338 | - // Get the current WP version number. | |
| 339 | - global $wp_version; | |
| 340 | 335 | // Get the latest WP release version number. |
| 341 | 336 | $wp_latest = $this->check_core_updates(); |
| 342 | 337 | // Check if the report is valid. |
| 343 | 338 | if ( $report == null ) { |
| @@ -382,8 +377,9 @@ | ||
| 382 | 377 | $html .= '<td class="' . $css_class . '">'; |
| 383 | 378 | $html .= $report['local_info']['Version']; |
| 384 | 379 | if ( $report['local_info']['Version'] != $report['repo_info']->version ) { |
| 385 | 380 | // Any platform upgrades needed? |
| 381 | + global $wp_version; | |
| 386 | 382 | $needs_php_upgrade = isset( $report['repo_info']->requires_php ) ? version_compare( phpversion(), $report['repo_info']->requires_php, '<' ) : false; |
| 387 | 383 | $needs_wp_upgrade = isset( $report['repo_info']->requires ) ? version_compare( $wp_version, $report['repo_info']->requires, '<' ) : false; |
| 388 | 384 | // Create the additional message. |
| 389 | 385 | if ( $needs_wp_upgrade && $needs_php_upgrade ) { |
| @@ -402,18 +398,8 @@ | ||
| 402 | 398 | } |
| 403 | 399 | $html .= '</td>'; |
| 404 | 400 | } else { |
| 405 | 401 | $html .= '<td>' . $report['local_info']['Version'] . '</td>'; |
| 406 | - } | |
| 407 | - // Auto-update | |
| 408 | - if ( version_compare( $wp_version, '5.5', '<' ) ) { | |
| 409 | - $html .= '<td>' . __( 'Requires WordPress 5.5 or higher', 'plugin-report' ) . '</td>'; | |
| 410 | - } else { | |
| 411 | - if ( isset( $report['auto-update'] ) && $report['auto-update'] == 1 ) { | |
| 412 | - $html .= '<td class="' . self::CSS_CLASS_LOW . '">' . __( 'Enabled', 'plugin-report' ) . '</td>'; | |
| 413 | - } else { | |
| 414 | - $html .= '<td>' . __( 'Not enabled', 'plugin-report' ) . '</td>'; | |
| 415 | - } | |
| 416 | 402 | } |
| 417 | 403 | // Last updates. |
| 418 | 404 | if ( isset( $report['repo_info'] ) ) { |
| 419 | 405 | $time_update = new DateTime( $report['repo_info']->last_updated ); |