Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions rt-plugin-report.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in rt-plugin-report.php

View workflow job for this annotation

GitHub Actions / WordPress Coding Standards

Class file names should be based on the class name with &quot;class-&quot; prepended. Expected class-rt-plugin-report.php, but found rt-plugin-report.php.

Check failure on line 1 in rt-plugin-report.php

View workflow job for this annotation

GitHub Actions / WordPress Coding Standards

Class file names should be based on the class name with &quot;class-&quot; prepended. Expected class-rt-plugin-report.php, but found rt-plugin-report.php.
/**
* Plugin Name: Plugin Report
* Plugin URI: https://wordpress.org/plugins/plugin-report/
Expand All @@ -25,7 +25,7 @@
/**
* Plugin Report main class.
*/
class RT_Plugin_Report {

Check warning on line 28 in rt-plugin-report.php

View workflow job for this annotation

GitHub Actions / Plugin Check

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound

Classes declared by a theme/plugin should start with the theme/plugin prefix. Found: "RT_Plugin_Report".

Check warning on line 28 in rt-plugin-report.php

View workflow job for this annotation

GitHub Actions / Plugin Check

WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound

Classes declared by a theme/plugin should start with the theme/plugin prefix. Found: "RT_Plugin_Report".

// CSS class constants.
const CSS_CLASS_LOW = 'pr-risk-low';
Expand Down Expand Up @@ -360,9 +360,11 @@
// Add the repo info to the report.
if ( isset( $returned_object ) ) {
if ( ! is_wp_error( $returned_object ) ) {
$report['repo_info'] = $returned_object;
// Cache the report.
set_site_transient( $cache_key, $report, self::CACHE_LIFETIME );
if ( isset( $returned_object->version ) ) {
$report['repo_info'] = $returned_object;
// Cache the report.
set_site_transient( $cache_key, $report, self::CACHE_LIFETIME );
}
} else {
// Store the error code and message in the report.
$report['repo_error_code'] = $returned_object->get_error_code();
Expand Down Expand Up @@ -464,7 +466,7 @@
// Plugin is available on wp.org.
$html .= '<td class="' . esc_attr( self::CSS_CLASS_LOW ) . '">wordpress.org</td>';
}
} else {

Check failure on line 469 in rt-plugin-report.php

View workflow job for this annotation

GitHub Actions / WordPress Coding Standards

If control structure block found as the only statement within an &quot;else&quot; block. Use elseif instead.

Check failure on line 469 in rt-plugin-report.php

View workflow job for this annotation

GitHub Actions / WordPress Coding Standards

If control structure block found as the only statement within an &quot;else&quot; block. Use elseif instead.
if ( $parsed_repo_url && isset( $parsed_repo_url['host'] ) ) { // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found
// Update URI is a valid URL, display the host.
$html .= '<td class="' . esc_attr( self::CSS_CLASS_MED ) . '">' . esc_html( $repo_host ) . '</td>';
Expand Down Expand Up @@ -492,7 +494,7 @@
$html .= '<td class="' . esc_attr( $css_class ) . '">' . absint( $activation_status['active'] ) . '/' . absint( $activation_status['sites'] ) . '</td>';
}
} else {
if ( isset( $report['file_path'] ) ) {
if ( isset( $report['file_path'] ) && isset( $report['repo_info']->version ) ) {
$active = is_plugin_active( $report['file_path'] ) ? __( 'Yes', 'plugin-report' ) : __( 'No', 'plugin-report' );
$css_class = is_plugin_active( $report['file_path'] ) ? self::CSS_CLASS_LOW : self::CSS_CLASS_HIGH;
}
Expand Down Expand Up @@ -531,7 +533,7 @@
// Auto-update.
if ( version_compare( $wp_version, '5.5', '<' ) ) {
$html .= '<td>' . esc_html__( 'Requires WordPress 5.5 or higher', 'plugin-report' ) . '</td>';
} else {

Check failure on line 536 in rt-plugin-report.php

View workflow job for this annotation

GitHub Actions / WordPress Coding Standards

If control structure block found as the only statement within an &quot;else&quot; block. Use elseif instead.

Check failure on line 536 in rt-plugin-report.php

View workflow job for this annotation

GitHub Actions / WordPress Coding Standards

If control structure block found as the only statement within an &quot;else&quot; block. Use elseif instead.
if ( isset( $report['auto-update'] ) && $report['auto-update'] ) { // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found
$html .= '<td class="' . esc_attr( self::CSS_CLASS_LOW ) . '">' . esc_html__( 'Enabled', 'plugin-report' ) . '</td>';
} else {
Expand Down
Loading