File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ function rsscloud_query_vars( $vars ) {
5151add_action ( 'parse_request ' , 'rsscloud_parse_request ' );
5252function 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
Original file line number Diff line number Diff line change 44}
55
66function 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 ' ] ) ) {
You can’t perform that action at this time.
0 commit comments