From c25f1e51b2e334176582c58c7a9b33bc1a15eb50 Mon Sep 17 00:00:00 2001 From: Andrew Shell Date: Tue, 7 Apr 2026 16:56:47 -0500 Subject: [PATCH] fixing all wordpress coding standards issues --- .github/workflows/testing.yml | 19 +++++++++++++++++++ rsscloud/notification-request.php | 6 +++--- rsscloud/rsscloud.php | 2 +- rsscloud/send-post-notifications.php | 6 +++--- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 173e1c5..c7562ee 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -18,6 +18,25 @@ jobs: with: build-dir: "./rsscloud" + phpcs: + name: Coding standards + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + tools: cs2pr + + - name: Install Composer dependencies + run: composer install --no-interaction + + - name: Run PHPCS + run: vendor/bin/phpcs --standard=phpcs.xml.dist -q --report-checkstyle | cs2pr + phpunit: name: Run tests runs-on: ubuntu-latest diff --git a/rsscloud/notification-request.php b/rsscloud/notification-request.php index 72797a0..e61b539 100644 --- a/rsscloud/notification-request.php +++ b/rsscloud/notification-request.php @@ -35,7 +35,7 @@ function rsscloud_hub_process_notification_request() { } $path = str_replace( '@', '', sanitize_text_field( wp_unslash( $_POST['path'] ) ) ); - if ( $path[0] != '/' ) { + if ( '/' !== $path[0] ) { $path = '/' . $path; } @@ -95,7 +95,7 @@ function rsscloud_hub_process_notification_request() { // challenge must match for domain requests if ( ! empty( $_POST['domain'] ) ) { - if ( empty( $result['body'] ) || $result['body'] != $challenge ) { + if ( empty( $result['body'] ) || $result['body'] !== $challenge ) { rsscloud_notify_result( 'false', 'The response body did not match the challenge string' ); } } @@ -107,7 +107,7 @@ function rsscloud_hub_process_notification_request() { } // Only allow requests for the RSS2 posts feed - if ( $feed_url != $rss2_url ) { + if ( $feed_url !== $rss2_url ) { rsscloud_notify_result( 'false', "You can only request updates for {$rss2_url}" ); } diff --git a/rsscloud/rsscloud.php b/rsscloud/rsscloud.php index 21006e1..56fd3ff 100644 --- a/rsscloud/rsscloud.php +++ b/rsscloud/rsscloud.php @@ -51,7 +51,7 @@ function rsscloud_query_vars( $vars ) { add_action( 'parse_request', 'rsscloud_parse_request' ); function rsscloud_parse_request( $wp ) { if ( array_key_exists( 'rsscloud', $wp->query_vars ) ) { - if ( $wp->query_vars['rsscloud'] == 'notify' ) { + if ( 'notify' === $wp->query_vars['rsscloud'] ) { rsscloud_hub_process_notification_request(); } diff --git a/rsscloud/send-post-notifications.php b/rsscloud/send-post-notifications.php index 0ab4866..d8d2611 100644 --- a/rsscloud/send-post-notifications.php +++ b/rsscloud/send-post-notifications.php @@ -4,7 +4,7 @@ } function rsscloud_send_post_notifications( $rss2_url = false ) { - if ( $rss2_url === false ) { + if ( false === $rss2_url ) { $rss2_url = get_bloginfo( 'rss2_url' ); if ( defined( 'RSSCLOUD_FEED_URL' ) ) { $rss2_url = RSSCLOUD_FEED_URL; @@ -20,11 +20,11 @@ function rsscloud_send_post_notifications( $rss2_url = false ) { $need_update = false; foreach ( $notify[ $rss2_url ] as $notify_url => $n ) { - if ( $n['status'] != 'active' ) { + if ( 'active' !== $n['status'] ) { continue; } - if ( $n['protocol'] == 'http-post' ) { + if ( 'http-post' === $n['protocol'] ) { $url = parse_url( $notify_url ); $port = 80; if ( ! empty( $url['port'] ) ) {