| @@ -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.9 | |
| 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 |
| @@ -19,11 +19,8 @@ | ||
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | if ( is_admin() && ! class_exists( 'RT_Plugin_Report' ) ) { |
| 22 | 22 | |
| 23 | - /** | |
| 24 | - * Plugin Report main class. | |
| 25 | - */ | |
| 26 | 23 | class RT_Plugin_Report { |
| 27 | 24 | |
| 28 | 25 | // CSS class constants. |
| 29 | 26 | const CSS_CLASS_LOW = 'pr-risk-low'; |
| @@ -30,10 +27,10 @@ | ||
| 30 | 27 | const CSS_CLASS_MED = 'pr-risk-medium'; |
| 31 | 28 | const CSS_CLASS_HIGH = 'pr-risk-high'; |
| 32 | 29 | |
| 33 | 30 | // Other class constants. |
| 34 | - const PLUGIN_VERSION = '1.9'; | |
| 35 | - const COLS_PER_ROW = 8; | |
| 31 | + const PLUGIN_VERSION = '1.7'; | |
| 32 | + const COLS_PER_ROW = 7; | |
| 36 | 33 | const CACHE_LIFETIME = DAY_IN_SECONDS; |
| 37 | 34 | const CACHE_LIFETIME_NOREPO = WEEK_IN_SECONDS; |
| 38 | 35 | |
| 39 | 36 | /** |
| @@ -130,13 +127,12 @@ | ||
| 130 | 127 | // The report's main table. |
| 131 | 128 | echo '<table id="plugin-report-table" class="wp-list-table widefat fixed striped">'; |
| 132 | 129 | echo '<thead>'; |
| 133 | 130 | echo '<tr>'; |
| 134 | - echo '<th data-sort-default>' . esc_html__( 'Name', 'plugin-report' ) . '</th>'; | |
| 131 | + echo '<th>' . esc_html__( 'Name', 'plugin-report' ) . '</th>'; | |
| 135 | 132 | echo '<th>' . esc_html__( 'Author', 'plugin-report' ) . '</th>'; |
| 136 | 133 | echo '<th>' . esc_html__( 'Activated', 'plugin-report' ) . '</th>'; |
| 137 | 134 | echo '<th data-sort-method="none" class="no-sort">' . esc_html__( 'Installed version', 'plugin-report' ) . '</th>'; |
| 138 | - echo '<th>' . esc_html__( 'Auto-update', 'plugin-report' ) . '</th>'; | |
| 139 | 135 | echo '<th>' . esc_html__( 'Last update', 'plugin-report' ) . '</th>'; |
| 140 | 136 | echo '<th data-sort-method="dotsep">' . esc_html__( 'Tested up to WP version', 'plugin-report' ) . '</th>'; |
| 141 | 137 | echo '<th data-sort-method="number">' . esc_html__( 'Rating', 'plugin-report' ) . '</th>'; |
| 142 | 138 | echo '</tr>'; |
| @@ -168,10 +164,8 @@ | ||
| 168 | 164 | |
| 169 | 165 | |
| 170 | 166 | /** |
| 171 | 167 | * Enqueue admin javascript |
| 172 | - * | |
| 173 | - * @param string $hook Screen hook. | |
| 174 | 168 | */ |
| 175 | 169 | public function enqueue_assets( $hook ) { |
| 176 | 170 | // Check if we're on the right screen. |
| 177 | 171 | if ( 'plugins_page_plugin_report' !== $hook ) { |
| @@ -178,11 +172,11 @@ | ||
| 178 | 172 | return; |
| 179 | 173 | } |
| 180 | 174 | // Register the plugin's admin js, and require jquery. |
| 181 | 175 | wp_enqueue_script( 'plugin-report-js', plugins_url( '/js/plugin-report.js', __FILE__ ), array( 'jquery', 'plugin-report-tablesort-js' ), self::PLUGIN_VERSION ); |
| 182 | - wp_enqueue_script( 'plugin-report-tablesort-js', plugins_url( '/js/tablesort.min.js', __FILE__ ), array( 'jquery' ), '5.2.1' ); | |
| 183 | - wp_enqueue_script( 'plugin-report-tablesort-number-js', plugins_url( '/js/tablesort.number.min.js', __FILE__ ), array( 'plugin-report-tablesort-js' ), '5.2.1' ); | |
| 184 | - wp_enqueue_script( 'plugin-report-tablesort-dotsep-js', plugins_url( '/js/tablesort.dotsep.min.js', __FILE__ ), array( 'plugin-report-tablesort-js' ), '5.2.1' ); | |
| 176 | + wp_enqueue_script( 'plugin-report-tablesort-js', plugins_url( '/js/tablesort.min.js', __FILE__ ), array( 'jquery' ), '5.1.0' ); | |
| 177 | + wp_enqueue_script( 'plugin-report-tablesort-number-js', plugins_url( '/js/tablesort.number.min.js', __FILE__ ), array( 'plugin-report-tablesort-js' ), '5.1.0' ); | |
| 178 | + wp_enqueue_script( 'plugin-report-tablesort-dotsep-js', plugins_url( '/js/tablesort.dotsep.min.js', __FILE__ ), array( 'plugin-report-tablesort-js' ), '5.1.0' ); | |
| 185 | 179 | // Add some variables to the page, to be used by the javascript. |
| 186 | 180 | $slugs = $this->get_plugin_slugs(); |
| 187 | 181 | $slugs_str = implode( ',', $slugs ); |
| 188 | 182 | $vars = array( |
| @@ -211,11 +205,9 @@ | ||
| 211 | 205 | } |
| 212 | 206 | |
| 213 | 207 | |
| 214 | 208 | /** |
| 215 | - * Convert a plugin's file path into its slug. | |
| 216 | - * | |
| 217 | - * @param string $file Plugin file path. | |
| 209 | + * Convert a plugin's file path into its slug | |
| 218 | 210 | */ |
| 219 | 211 | private function get_plugin_slug( $file ) { |
| 220 | 212 | if ( strpos( $file, '/' ) !== false ) { |
| 221 | 213 | $parts = explode( '/', $file ); |
| @@ -270,19 +262,16 @@ | ||
| 270 | 262 | |
| 271 | 263 | |
| 272 | 264 | /** |
| 273 | 265 | * Gather all the info we can get about a plugin. |
| 274 | - * Uses transient caching to avoid doing repo API calls on every page visit. | |
| 275 | - * | |
| 276 | - * @param string $slug Plugin slug. | |
| 266 | + * Uses transient caching to avoid doing repo API calls on every page visit | |
| 277 | 267 | */ |
| 278 | 268 | private function assemble_plugin_report( $slug ) { |
| 279 | 269 | if ( ! empty( $slug ) ) { |
| 280 | - $report = array(); | |
| 281 | - $cache_key = $this->create_cache_key( $slug ); | |
| 282 | - $cache = get_site_transient( $cache_key ); | |
| 283 | - $plugins = get_plugins(); | |
| 284 | - $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(); | |
| 285 | 274 | |
| 286 | 275 | if ( empty( $cache ) ) { |
| 287 | 276 | |
| 288 | 277 | // Add the plugin's slug to the report. |
| @@ -287,39 +276,13 @@ | ||
| 287 | 276 | |
| 288 | 277 | // Add the plugin's slug to the report. |
| 289 | 278 | $report['slug'] = $slug; |
| 290 | 279 | |
| 291 | - // Get the locally available info, and add it to the report. | |
| 280 | + // Get the locally available info, and add it to the report. | |
| 292 | 281 | foreach ( $plugins as $key => $plugin ) { |
| 293 | - if ( $this->get_plugin_slug( $key ) === $slug ) { | |
| 294 | - | |
| 295 | - // Translate plugin data. | |
| 296 | - $textdomain = $plugin['TextDomain']; | |
| 297 | - if ( $textdomain ) { | |
| 298 | - if ( ! is_textdomain_loaded( $textdomain ) ) { | |
| 299 | - if ( $plugin['DomainPath'] ) { | |
| 300 | - load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin['DomainPath'] ); | |
| 301 | - } else { | |
| 302 | - load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) ); | |
| 303 | - } | |
| 304 | - } | |
| 305 | - } elseif ( 'hello.php' === basename( $plugin_file ) ) { | |
| 306 | - $textdomain = 'default'; | |
| 307 | - } | |
| 308 | - if ( $textdomain ) { | |
| 309 | - foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) { | |
| 310 | - // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain | |
| 311 | - $plugin[ $field ] = __( $plugin[ $field ], $textdomain ); | |
| 312 | - } | |
| 313 | - } | |
| 314 | - | |
| 315 | - $report['local_info'] = $plugin; | |
| 316 | - $report['file_path'] = $key; | |
| 317 | - $report['auto-update'] = in_array( $key, $auto_updates ); | |
| 318 | - | |
| 319 | - // Change any whitespace to default space. | |
| 320 | - $report['local_info']['Name'] = preg_replace( '/\s+/u', ' ', $report['local_info']['Name'] ); | |
| 321 | - | |
| 282 | + if ( $this->get_plugin_slug( $key ) == $slug ) { | |
| 283 | + $report['local_info'] = $plugin; | |
| 284 | + $report['file_path'] = $key; | |
| 322 | 285 | break; |
| 323 | 286 | } |
| 324 | 287 | } |
| 325 | 288 | |
| @@ -337,9 +300,8 @@ | ||
| 337 | 300 | 'compatibility' => true, |
| 338 | 301 | 'author' => true, |
| 339 | 302 | ), |
| 340 | 303 | ); |
| 341 | - | |
| 342 | 304 | $returned_object = plugins_api( 'plugin_information', $args ); |
| 343 | 305 | |
| 344 | 306 | // Add the repo info to the report. |
| 345 | 307 | if ( ! is_wp_error( $returned_object ) ) { |
| @@ -347,9 +309,9 @@ | ||
| 347 | 309 | // Cache the report. |
| 348 | 310 | set_site_transient( $cache_key, $report, self::CACHE_LIFETIME ); |
| 349 | 311 | } else { |
| 350 | 312 | // Store the error code and message in the report. |
| 351 | - $report['repo_error_code'] = $returned_object->get_error_code(); | |
| 313 | + $report['repo_error_code'] = $returned_object->get_error_code(); | |
| 352 | 314 | $report['repo_error_message'] = $returned_object->get_error_message(); |
| 353 | 315 | // Cache for an extra long time when the plugin is not in the repo. |
| 354 | 316 | set_site_transient( $cache_key, $report, self::CACHE_LIFETIME_NOREPO ); |
| 355 | 317 | } |
| @@ -366,19 +328,15 @@ | ||
| 366 | 328 | } |
| 367 | 329 | |
| 368 | 330 | |
| 369 | 331 | /** |
| 370 | - * From a report, generate an HTML table row with relevant data for the plugin. | |
| 371 | - * | |
| 372 | - * @param array $report Report of plugin. | |
| 332 | + * From a report, generate an HTML table row with relevant data for the plugin | |
| 373 | 333 | */ |
| 374 | 334 | private function render_table_row( $report ) { |
| 375 | - // Get the current WP version number. | |
| 376 | - global $wp_version; | |
| 377 | 335 | // Get the latest WP release version number. |
| 378 | 336 | $wp_latest = $this->check_core_updates(); |
| 379 | 337 | // Check if the report is valid. |
| 380 | - if ( null === $report ) { | |
| 338 | + if ( $report == null ) { | |
| 381 | 339 | $html = $this->render_error_row( esc_html__( 'No plugin data available.', 'plugin-report' ) ); |
| 382 | 340 | } else { |
| 383 | 341 | // Start the new table row. |
| 384 | 342 | $html = '<tr class="plugin-report-row-' . $report['slug'] . '">'; |
| @@ -394,18 +352,18 @@ | ||
| 394 | 352 | } else { |
| 395 | 353 | $html .= '<td>' . $report['local_info']['Author'] . '</td>'; |
| 396 | 354 | } |
| 397 | 355 | // Activated. |
| 398 | - $active = __( 'Please clear cache to update', 'plugin-report' ); | |
| 356 | + $active = __( 'Please clear cache to update', 'plugin-report' ); | |
| 399 | 357 | $css_class = self::CSS_CLASS_MED; |
| 400 | 358 | if ( is_multisite() ) { |
| 401 | 359 | $activation_status = $this->get_multisite_activation( $report['file_path'] ); |
| 402 | 360 | if ( true === $activation_status['network'] ) { |
| 403 | 361 | $css_class = self::CSS_CLASS_LOW; |
| 404 | - $html .= '<td class="' . $css_class . '">' . __( 'Network activated', 'plugin-report' ) . '</td>'; | |
| 362 | + $html .= '<td class="' . $css_class . '">' . __( 'Network activated', 'plugin-report' ) . '</td>'; | |
| 405 | 363 | } else { |
| 406 | 364 | $css_class = ( $activation_status['active'] > 0 ) ? self::CSS_CLASS_LOW : self::CSS_CLASS_HIGH; |
| 407 | - $html .= '<td class="' . $css_class . '">' . $activation_status['active'] . '/' . $activation_status['sites'] . '</td>'; | |
| 365 | + $html .= '<td class="' . $css_class . '">' . $activation_status['active'] . '/' . $activation_status['sites'] . '</td>'; | |
| 408 | 366 | } |
| 409 | 367 | } else { |
| 410 | 368 | if ( isset( $report['file_path'] ) ) { |
| 411 | 369 | $active = is_plugin_active( $report['file_path'] ) ? __( 'Yes', 'plugin-report' ) : __( 'No', 'plugin-report' ); |
| @@ -415,27 +373,28 @@ | ||
| 415 | 373 | } |
| 416 | 374 | // Installed / available version. |
| 417 | 375 | if ( isset( $report['repo_info'] ) ) { |
| 418 | 376 | $css_class = $this->get_version_risk_classname( $report['local_info']['Version'], $report['repo_info']->version ); |
| 419 | - $html .= '<td class="' . $css_class . '">'; | |
| 420 | - $html .= $report['local_info']['Version']; | |
| 421 | - if ( $report['local_info']['Version'] !== $report['repo_info']->version ) { | |
| 377 | + $html .= '<td class="' . $css_class . '">'; | |
| 378 | + $html .= $report['local_info']['Version']; | |
| 379 | + if ( $report['local_info']['Version'] != $report['repo_info']->version ) { | |
| 422 | 380 | // Any platform upgrades needed? |
| 381 | + global $wp_version; | |
| 423 | 382 | $needs_php_upgrade = isset( $report['repo_info']->requires_php ) ? version_compare( phpversion(), $report['repo_info']->requires_php, '<' ) : false; |
| 424 | 383 | $needs_wp_upgrade = isset( $report['repo_info']->requires ) ? version_compare( $wp_version, $report['repo_info']->requires, '<' ) : false; |
| 425 | 384 | // Create the additional message. |
| 426 | 385 | if ( $needs_wp_upgrade && $needs_php_upgrade ) { |
| 427 | 386 | /* translators: %1$s: Plugin version number, %2$s: WP version number, %3$s: PHP version number */ |
| 428 | - $html .= ' <span class="pr-additional-info">' . sprintf( esc_html__( '(%1$s available, requires WP %2$s and PHP %3$s)', 'plugin-report' ), $report['repo_info']->version, $report['repo_info']->requires, $report['repo_info']->requires_php ) . '</span>'; | |
| 387 | + $html .= ' <span class="pr-additional-info">' . sprintf( esc_html__( '(%1$s available, requires WP %2$s and PHP %3$s)', 'plugin-report'), $report['repo_info']->version, $report['repo_info']->requires, $report['repo_info']->requires_php ) . '</span>'; | |
| 429 | 388 | } elseif ( $needs_wp_upgrade ) { |
| 430 | 389 | /* translators: %1$s: Plugin version number, %2$s: WP version number. */ |
| 431 | - $html .= ' <span class="pr-additional-info">' . sprintf( esc_html__( '(%1$s available, requires WP %2$s)', 'plugin-report' ), $report['repo_info']->version, $report['repo_info']->requires ) . '</span>'; | |
| 390 | + $html .= ' <span class="pr-additional-info">' . sprintf( esc_html__( '(%1$s available, requires WP %2$s)', 'plugin-report'), $report['repo_info']->version, $report['repo_info']->requires ) . '</span>'; | |
| 432 | 391 | } elseif ( $needs_php_upgrade ) { |
| 433 | 392 | /* translators: %1$s: Plugin version number, %2$s: PHP version number. */ |
| 434 | - $html .= ' <span class="pr-additional-info">' . sprintf( esc_html__( '(%1$s available, requires PHP %2$s)', 'plugin-report' ), $report['repo_info']->version, $report['repo_info']->requires_php ) . '</span>'; | |
| 393 | + $html .= ' <span class="pr-additional-info">' . sprintf( esc_html__( '(%1$s available, requires PHP %2$s)', 'plugin-report'), $report['repo_info']->version, $report['repo_info']->requires_php ) . '</span>'; | |
| 435 | 394 | } else { |
| 436 | 395 | /* translators: %s: Plugin version number. */ |
| 437 | - $html .= ' <span class="pr-additional-info">' . sprintf( esc_html__( '(%s available)', 'plugin-report' ), $report['repo_info']->version ) . '</span>'; | |
| 396 | + $html .= ' <span class="pr-additional-info">' . sprintf( esc_html__( '(%s available)', 'plugin-report'), $report['repo_info']->version ) . '</span>'; | |
| 438 | 397 | } |
| 439 | 398 | } |
| 440 | 399 | $html .= '</td>'; |
| 441 | 400 | } else { |
| @@ -440,18 +399,8 @@ | ||
| 440 | 399 | $html .= '</td>'; |
| 441 | 400 | } else { |
| 442 | 401 | $html .= '<td>' . $report['local_info']['Version'] . '</td>'; |
| 443 | 402 | } |
| 444 | - // Auto-update. | |
| 445 | - if ( version_compare( $wp_version, '5.5', '<' ) ) { | |
| 446 | - $html .= '<td>' . __( 'Requires WordPress 5.5 or higher', 'plugin-report' ) . '</td>'; | |
| 447 | - } else { | |
| 448 | - if ( isset( $report['auto-update'] ) && $report['auto-update'] ) { | |
| 449 | - $html .= '<td class="' . self::CSS_CLASS_LOW . '">' . __( 'Enabled', 'plugin-report' ) . '</td>'; | |
| 450 | - } else { | |
| 451 | - $html .= '<td>' . __( 'Not enabled', 'plugin-report' ) . '</td>'; | |
| 452 | - } | |
| 453 | - } | |
| 454 | 403 | // Last updates. |
| 455 | 404 | if ( isset( $report['repo_info'] ) ) { |
| 456 | 405 | $time_update = new DateTime( $report['repo_info']->last_updated ); |
| 457 | 406 | $time_diff = human_time_diff( $time_update->getTimestamp(), current_time( 'timestamp' ) ); |
| @@ -461,10 +410,10 @@ | ||
| 461 | 410 | $html .= $this->render_error_cell(); |
| 462 | 411 | } |
| 463 | 412 | // Tested up to. |
| 464 | 413 | if ( isset( $report['repo_info'] ) ) { |
| 465 | - $css_class = $this->get_version_risk_classname( $report['repo_info']->tested, $wp_latest, true ); | |
| 466 | - $html .= '<td class="' . $css_class . '">' . $report['repo_info']->tested . '</td>'; | |
| 414 | + $css_class = $this->get_version_risk_classname( $report['repo_info']->tested, $wp_latest ); | |
| 415 | + $html .= '<td class="' . $css_class . '">' . $report['repo_info']->tested . '</td>'; | |
| 467 | 416 | } else { |
| 468 | 417 | $html .= $this->render_error_cell(); |
| 469 | 418 | } |
| 470 | 419 | // Overall user rating. |
| @@ -482,11 +431,9 @@ | ||
| 482 | 431 | } |
| 483 | 432 | |
| 484 | 433 | |
| 485 | 434 | /** |
| 486 | - * Format an error message as a table row, so we can return it to javascript. | |
| 487 | - * | |
| 488 | - * @param string $message Message to be shown. | |
| 435 | + * Format an error message as a table row, so we can return it to javascript | |
| 489 | 436 | */ |
| 490 | 437 | private function render_error_row( $message ) { |
| 491 | 438 | return '<tr class="pluginreport-row-error"><td colspan="' . self::COLS_PER_ROW . '">' . $message . '</td></tr>'; |
| 492 | 439 | } |
| @@ -492,11 +439,9 @@ | ||
| 492 | 439 | } |
| 493 | 440 | |
| 494 | 441 | |
| 495 | 442 | /** |
| 496 | - * Format an error message as a table cell, so we can return it to javascript. | |
| 497 | - * | |
| 498 | - * @param string $message Message to be shown. | |
| 443 | + * Format an error message as a table cell, so we can return it to javascript | |
| 499 | 444 | */ |
| 500 | 445 | private function render_error_cell( $message = null ) { |
| 501 | 446 | if ( ! $message ) { |
| 502 | 447 | $message = esc_html__( 'No data available', 'plugin-report' ); |
| @@ -505,33 +450,11 @@ | ||
| 505 | 450 | } |
| 506 | 451 | |
| 507 | 452 | |
| 508 | 453 | /** |
| 509 | - * Return the version string with all elements beyond the second removed ("5.5.1" -> "5.5"). | |
| 510 | - * | |
| 511 | - * @param string $version_string Complete version number. | |
| 454 | + * Figure out what CSS class to use based on current and optimal version numbers | |
| 512 | 455 | */ |
| 513 | - private function get_major_version( $version_string ) { | |
| 514 | - $parts = explode( '.', $version_string ); | |
| 515 | - array_splice( $parts, 2 ); | |
| 516 | - return implode( '.', $parts ); | |
| 517 | - } | |
| 518 | - | |
| 519 | - | |
| 520 | - /** | |
| 521 | - * Figure out what CSS class to use based on current and optimal version numbers. | |
| 522 | - * | |
| 523 | - * @param string $available Available version. | |
| 524 | - * @param string $optimal Optimal version. | |
| 525 | - * @param bool $major_only True to compare only major versions, false otherwise. | |
| 526 | - */ | |
| 527 | - private function get_version_risk_classname( $available, $optimal, $major_only = false ) { | |
| 528 | - // Use only the first two elements of the version number if $major_only is set to true. | |
| 529 | - // This is used for WP version numbers, where point releases are not considered a risk. | |
| 530 | - if ( $major_only ) { | |
| 531 | - $available = $this->get_major_version( $available ); | |
| 532 | - $optimal = $this->get_major_version( $optimal ); | |
| 533 | - } | |
| 456 | + private function get_version_risk_classname( $available, $optimal ) { | |
| 534 | 457 | // If the version is equal or higher, indicate low risk. |
| 535 | 458 | if ( version_compare( $available, $optimal, '>=' ) ) { |
| 536 | 459 | return self::CSS_CLASS_LOW; |
| 537 | 460 | } |
| @@ -540,11 +463,9 @@ | ||
| 540 | 463 | } |
| 541 | 464 | |
| 542 | 465 | |
| 543 | 466 | /** |
| 544 | - * Assess the risk associated with low ratings or poor compatibility feedback, return corresponding CSS class. | |
| 545 | - * | |
| 546 | - * @param int $perc Rating percentage. | |
| 467 | + * Assess the risk associated with low ratings or poor compatibility feedback, return corresponding CSS class | |
| 547 | 468 | */ |
| 548 | 469 | private function get_percentage_risk_classname( $perc ) { |
| 549 | 470 | if ( $perc < 70 ) { |
| 550 | 471 | return self::CSS_CLASS_HIGH; |
| @@ -556,11 +477,9 @@ | ||
| 556 | 477 | } |
| 557 | 478 | |
| 558 | 479 | |
| 559 | 480 | /** |
| 560 | - * Assess the risk associated with low ratings or poor compatibility feedback, return corresponding CSS class. | |
| 561 | - * | |
| 562 | - * @param string $time_diff Time difference. | |
| 481 | + * Assess the risk associated with low ratings or poor compatibility feedback, return corresponding CSS class | |
| 563 | 482 | */ |
| 564 | 483 | private function get_timediff_risk_classname( $time_diff ) { |
| 565 | 484 | $days = $time_diff / ( DAY_IN_SECONDS ); |
| 566 | 485 | if ( $days > 365 ) { |
| @@ -580,13 +499,13 @@ | ||
| 580 | 499 | private function check_core_updates() { |
| 581 | 500 | global $wp_version; |
| 582 | 501 | $update = get_preferred_from_update_core(); |
| 583 | 502 | // Bail out of no valid response, or false. |
| 584 | - if ( ! $update || false === $update ) { | |
| 503 | + if ( ! $update || $update == false ) { | |
| 585 | 504 | return $wp_version; |
| 586 | 505 | } |
| 587 | 506 | // If latest, return current version number. |
| 588 | - if ( 'latest' === $update->response ) { | |
| 507 | + if ( $update->response == 'latest' ) { | |
| 589 | 508 | return $wp_version; |
| 590 | 509 | } |
| 591 | 510 | // Return the preferred update's version number. |
| 592 | 511 | return $update->version; |
| @@ -593,11 +512,9 @@ | ||
| 593 | 512 | } |
| 594 | 513 | |
| 595 | 514 | |
| 596 | 515 | /** |
| 597 | - * Gather statistics about a plugin's activation on a multisite install. | |
| 598 | - * | |
| 599 | - * @param string $path Plugin path. | |
| 516 | + * Gather statistics about a plugin's activation on a multisite install | |
| 600 | 517 | */ |
| 601 | 518 | private function get_multisite_activation( $path ) { |
| 602 | 519 | // Create an array to contain the return values. |
| 603 | 520 | $activation_status = array( |
| @@ -610,9 +527,9 @@ | ||
| 610 | 527 | if ( array_key_exists( $path, $network_plugins ) ) { |
| 611 | 528 | $activation_status['network'] = true; |
| 612 | 529 | } else { |
| 613 | 530 | // Get a list of all sites in the multisite install. |
| 614 | - $args = array( | |
| 531 | + $args = array( | |
| 615 | 532 | 'number' => 9999, |
| 616 | 533 | 'fields' => 'ids', |
| 617 | 534 | ); |
| 618 | 535 | $sites = get_sites( $args ); |
| @@ -636,10 +553,8 @@ | ||
| 636 | 553 | |
| 637 | 554 | |
| 638 | 555 | /** |
| 639 | 556 | * Create a cache key that is unique to the provided plugin slug. |
| 640 | - * | |
| 641 | - * @param string $slug Plugin slug. | |
| 642 | 557 | */ |
| 643 | 558 | private function create_cache_key( $slug ) { |
| 644 | 559 | // Create a hash for the plugin slug. |
| 645 | 560 | $slug_hash = hash( 'sha256', $slug ); |
| @@ -664,11 +579,9 @@ | ||
| 664 | 579 | } |
| 665 | 580 | |
| 666 | 581 | |
| 667 | 582 | /** |
| 668 | - * Remove the cache item for a single plugin. | |
| 669 | - * | |
| 670 | - * @param string $slug Plugin slug. | |
| 583 | + * Remove the cache item for a single plugin | |
| 671 | 584 | */ |
| 672 | 585 | private function clear_cache_item( $slug ) { |
| 673 | 586 | if ( isset( $slug ) ) { |
| 674 | 587 | $cache_key = $this->create_cache_key( $slug ); |