Skip to content

Commit c25f1e5

Browse files
committed
fixing all wordpress coding standards issues
1 parent 295f60c commit c25f1e5

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

.github/workflows/testing.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,25 @@ jobs:
1818
with:
1919
build-dir: "./rsscloud"
2020

21+
phpcs:
22+
name: Coding standards
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Check out source code
26+
uses: actions/checkout@v4
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: '8.2'
32+
tools: cs2pr
33+
34+
- name: Install Composer dependencies
35+
run: composer install --no-interaction
36+
37+
- name: Run PHPCS
38+
run: vendor/bin/phpcs --standard=phpcs.xml.dist -q --report-checkstyle | cs2pr
39+
2140
phpunit:
2241
name: Run tests
2342
runs-on: ubuntu-latest

rsscloud/notification-request.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function rsscloud_hub_process_notification_request() {
3535
}
3636

3737
$path = str_replace( '@', '', sanitize_text_field( wp_unslash( $_POST['path'] ) ) );
38-
if ( $path[0] != '/' ) {
38+
if ( '/' !== $path[0] ) {
3939
$path = '/' . $path;
4040
}
4141

@@ -95,7 +95,7 @@ function rsscloud_hub_process_notification_request() {
9595

9696
// challenge must match for domain requests
9797
if ( ! empty( $_POST['domain'] ) ) {
98-
if ( empty( $result['body'] ) || $result['body'] != $challenge ) {
98+
if ( empty( $result['body'] ) || $result['body'] !== $challenge ) {
9999
rsscloud_notify_result( 'false', 'The response body did not match the challenge string' );
100100
}
101101
}
@@ -107,7 +107,7 @@ function rsscloud_hub_process_notification_request() {
107107
}
108108

109109
// Only allow requests for the RSS2 posts feed
110-
if ( $feed_url != $rss2_url ) {
110+
if ( $feed_url !== $rss2_url ) {
111111
rsscloud_notify_result( 'false', "You can only request updates for {$rss2_url}" );
112112
}
113113

rsscloud/rsscloud.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function rsscloud_query_vars( $vars ) {
5151
add_action( 'parse_request', 'rsscloud_parse_request' );
5252
function rsscloud_parse_request( $wp ) {
5353
if ( array_key_exists( 'rsscloud', $wp->query_vars ) ) {
54-
if ( $wp->query_vars['rsscloud'] == 'notify' ) {
54+
if ( 'notify' === $wp->query_vars['rsscloud'] ) {
5555
rsscloud_hub_process_notification_request();
5656
}
5757

rsscloud/send-post-notifications.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
}
55

66
function rsscloud_send_post_notifications( $rss2_url = false ) {
7-
if ( $rss2_url === false ) {
7+
if ( false === $rss2_url ) {
88
$rss2_url = get_bloginfo( 'rss2_url' );
99
if ( defined( 'RSSCLOUD_FEED_URL' ) ) {
1010
$rss2_url = RSSCLOUD_FEED_URL;
@@ -20,11 +20,11 @@ function rsscloud_send_post_notifications( $rss2_url = false ) {
2020

2121
$need_update = false;
2222
foreach ( $notify[ $rss2_url ] as $notify_url => $n ) {
23-
if ( $n['status'] != 'active' ) {
23+
if ( 'active' !== $n['status'] ) {
2424
continue;
2525
}
2626

27-
if ( $n['protocol'] == 'http-post' ) {
27+
if ( 'http-post' === $n['protocol'] ) {
2828
$url = parse_url( $notify_url );
2929
$port = 80;
3030
if ( ! empty( $url['port'] ) ) {

0 commit comments

Comments
 (0)