Skip to content
Merged
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions rsscloud/notification-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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' );
}
}
Expand All @@ -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}" );
}

Expand Down
2 changes: 1 addition & 1 deletion rsscloud/rsscloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
6 changes: 3 additions & 3 deletions rsscloud/send-post-notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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'] ) ) {
Expand Down
Loading