Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPCS Fixes #160

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft

PHPCS Fixes #160

wants to merge 3 commits into from

Conversation

vaurdan
Copy link
Member

@vaurdan vaurdan commented Jul 6, 2021

Initial extensive PHPCS clean-up on the codebase. I tried to address all the WordPress standards where possible and ignored the ones that are valid use cases.

I didn't invest much time in the documentation warnings.

This PR is forked from #159, so it includes the OpenSSL implementation for encryption.

I also added a few TODOs along with the code where we should invest some time to improve (mostly missing nonces and class naming).

(WIP, class-wp-push-syndication-server.php is still untouched, and I need to pull the changes from #157)

*
* @return string|void
*/
function syn_handle_multiple_error_notices( $message, $message_data ) { //phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ignore necessary? Looks like syn was added as an allowed prefix in .phpcs.xml.dist

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I forgot to remove it when I added the prefix to .phpcs.xml.dist. Removed.

includes/class-wp-cli.php Show resolved Hide resolved
@@ -1,18 +1,72 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes here discussed in #159

@@ -492,7 +532,7 @@ public static function display_settings( $site ) {
<label for="feed_url"><?php esc_html_e( 'Enter feed URL', 'push-syndication' ); ?></label>
</p>
<p>
<input type="text" name="feed_url" id="feed_url" size="100" value="<?php esc_attr_e( $feed_url ); ?>" />
<input type="text" name="feed_url" id="feed_url" size="100" value="<?php echo esc_url_raw( $feed_url ); ?>" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should still use esc_attr()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes! I changed it back to esc_attr.


?>

<p>
<label for=site_url><?php echo esc_html__( 'Enter a valid site URL', 'push-syndication' ); ?></label>
</p>
<p>
<input type="text" class="widefat" name="site_url" id="site_url" size="100" value="<?php echo esc_html( $site_url ); ?>" />
<input type="text" class="widefat" name="site_url" id="site_url" size="100" value="<?php echo esc_url_raw( $site_url ); ?>" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd have used esc_attr() here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

@vaurdan vaurdan requested a review from trepmal July 9, 2021 15:01
@vaurdan
Copy link
Member Author

vaurdan commented Jul 9, 2021

Thanks for the feedback, I have applied your suggestions.

I also added the missing PHPCS changes on the class-wp-push-syndication-server.php file, feel free to take a look!

@GaryJones GaryJones changed the base branch from master to develop February 11, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants