-
-
Notifications
You must be signed in to change notification settings - Fork 21
Code Quality Fixes #71
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
base: master
Are you sure you want to change the base?
Conversation
…to action and return value is not used
…hp and template-functions.php
…owance in composer.json
removed unused globals fixed code style fixed phpdoc
…ng in widgets.php
… in entry-share.php
… in entry-share.php
apermo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Questions.
| <?php printf( __( '%1$s', 'autonomie' ), $categories_list ); ?> | ||
| <?php | ||
| // translators: %1$s Category list in HTML. | ||
| printf( __( '%1$s', 'autonomie' ), $categories_list ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pfefferle Why did you use the translation here in the first place?
| <?php printf( __( '%1$s', 'autonomie' ), $tags_list ); ?> | ||
| <?php | ||
| // translators: %1$s Tag list in HTML. | ||
| printf( __( '%1$s', 'autonomie' ), $tags_list ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
| ?> | ||
| <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> | ||
| <article id="comment-<?php comment_ID(); ?>" class="comment <?php $comment->comment_type; ?>" itemprop="comment" itemscope itemtype="https://schema.org/Comment"> | ||
| <article id="comment-<?php comment_ID(); ?>" class="comment <?php echo $comment->comment_type; ?>" itemprop="comment" itemscope itemtype="https://schema.org/Comment"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pfefferle Review here, this echo was missing before, please verify that this has no sideeffects, alternatively we can remove the output.
| /* translators: | ||
| %1$s: number of comments, mind to add this if your language uses singular for more than just n=1 | ||
| %2$s: post title | ||
| */ | ||
| _n( | ||
| 'One thought on “%2$s”', // phpcs:ignore WordPress.WP.I18n.MissingSingularPlaceholder -- Translator instructions added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phpcs: WordPress.WP.I18n.MissingSingularPlaceholder: Missing singular placeholder, needed for some languages. See https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals
The phpcs error here noted that the placeholder must be added, since slavic and some other languages have multiple singulars, I assume by adding a more precise translators comment, this should be covered.
|
@pfefferle I'm ready with the code style fixes and review. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR standardizes code formatting across WordPress theme template files according to PHP coding standards, specifically implementing consistent indentation, spacing, and style patterns while maintaining the same functional output.
Key changes include:
- Converting single-line PHP function calls to multi-line format with proper indentation
- Adding missing PHP opening tags and proper formatting for closing statements
- Standardizing comment formatting and adding translator comments for internationalization
- Updating version requirements and coding standard compliance
Reviewed Changes
Copilot reviewed 42 out of 45 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/*.php | Reformatted wp_link_pages() function calls to multi-line format with consistent indentation |
| template-parts/*.php | Added translator comments for internationalization and improved PHP formatting |
| *.php (root files) | Standardized PHP opening/closing tags and while loop formatting |
| includes/*.php | Enhanced PHPDoc comments, improved code structure, and fixed coding standard violations |
| integrations/*.php | Updated PHPDoc formatting and improved function documentation |
| composer.json | Updated PHP version requirements and added plugin configuration |
| readme.md | Updated WordPress and PHP compatibility versions |
| <p> | ||
| <label for="entry-summary"><?php _e( 'HTML', 'autonomie' ); ?></label> | ||
| <textarea id="entry-summary" class="code" type="text" rows="5" cols="70"><cite class="h-cite"><a class="u-url p-name" href="<?php echo get_permalink(); ?>"><?php echo get_the_title(); ?></a> (<span class="p-author h-card" title="<?php echo get_the_author(); ?>"><?php echo get_the_author(); ?></span> <time class="dt-published" datetime="<?php echo get_the_date( 'c' ); ?>"><?php echo get_the_date(); ?></time>)</cite></textarea> | ||
| <textarea id="entry-summary" class="code" rows="5" cols="70"><cite class="h-cite"><a class="u-url p-name" href="<?php echo get_permalink(); ?>"><?php echo get_the_title(); ?></a> (<span class="p-author h-card" title="<?php echo get_the_author(); ?>"><?php echo get_the_author(); ?></span> <time class="dt-published" datetime="<?php echo get_the_date( 'c' ); ?>"><?php echo get_the_date(); ?></time>)</cite></textarea> |
Copilot
AI
Aug 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type="text" attribute was removed from the textarea element, but this doesn't address the underlying security concern. The content includes unescaped output from get_permalink(), get_the_title(), and get_the_author() functions which should be escaped with esc_url(), esc_html(), and esc_html() respectively to prevent XSS vulnerabilities.
| <p> | ||
| <label for="entry-blockquote"><?php _e( 'HTML', 'autonomie' ); ?></label> | ||
| <textarea id="entry-blockquote" class="code" type="text" rows="5" cols="70"><blockquote><p><?php echo get_the_excerpt(); ?></p><small>— by <a href="<?php echo get_permalink(); ?>" class="h-card" title="<?php echo get_the_author(); ?>"><?php echo get_the_author(); ?></a></small></blockquote></textarea> | ||
| <textarea id="entry-blockquote" class="code" rows="5" cols="70"><blockquote><p><?php echo get_the_excerpt(); ?></p><small>— by <a href="<?php echo get_permalink(); ?>" class="h-card" title="<?php echo get_the_author(); ?>"><?php echo get_the_author(); ?></a></small></blockquote></textarea> |
Copilot
AI
Aug 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the previous textarea, this content includes unescaped output from get_the_excerpt(), get_permalink(), and get_the_author() functions. These should be properly escaped with esc_html() for text content and esc_url() for URLs to prevent XSS vulnerabilities.
| ?> | ||
| <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> | ||
| <article id="comment-<?php comment_ID(); ?>" class="comment <?php $comment->comment_type; ?>" itemprop="comment" itemscope itemtype="https://schema.org/Comment"> | ||
| <article id="comment-<?php comment_ID(); ?>" class="comment <?php echo $comment->comment_type; ?>" itemprop="comment" itemscope itemtype="https://schema.org/Comment"> |
Copilot
AI
Aug 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The $comment->comment_type output should be escaped with esc_attr() since it's being used in a class attribute to prevent potential XSS vulnerabilities.
| <article id="comment-<?php comment_ID(); ?>" class="comment <?php echo $comment->comment_type; ?>" itemprop="comment" itemscope itemtype="https://schema.org/Comment"> | |
| <article id="comment-<?php comment_ID(); ?>" class="comment <?php echo esc_attr( $comment->comment_type ); ?>" itemprop="comment" itemscope itemtype="https://schema.org/Comment"> |
| <div class="entry-actions"> | ||
| <?php if ( comments_open() || ( '0' !== get_comments_number() && ! comments_open() ) ) : ?> | ||
| <indie-action do="reply" width="<?php the_permalink(); ?>"><div class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'autonomie' ), __( '1 Comment', 'autonomie' ), __( '% Comments', 'autonomie' ) ); ?></div></indie-action> | ||
| <indie-action do="reply" with="<?php the_permalink(); ?>"><div class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'autonomie' ), __( '1 Comment', 'autonomie' ), __( '% Comments', 'autonomie' ) ); ?></div></indie-action> |
Copilot
AI
Aug 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The the_permalink() function output should be escaped with esc_url() since it's being used in an HTML attribute to prevent potential XSS vulnerabilities.
| <?php if ( comments_open() || ( '0' !== get_comments_number() && ! comments_open() ) ) : ?> | ||
| <div class="entry-actions"> | ||
| <indie-action do="reply" width="<?php the_permalink(); ?>"><div class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'autonomie' ), __( '1 Comment', 'autonomie' ), __( '% Comments', 'autonomie' ) ); ?></div></indie-action> | ||
| <indie-action do="reply" with="<?php the_permalink(); ?>"><div class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'autonomie' ), __( '1 Comment', 'autonomie' ), __( '% Comments', 'autonomie' ) ); ?></div></indie-action> |
Copilot
AI
Aug 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The the_permalink() function output should be escaped with esc_url() since it's being used in an HTML attribute to prevent potential XSS vulnerabilities.
|
|
||
| if ( ! $classes ) { | ||
| return; | ||
| return ''; |
Copilot
AI
Aug 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function autonomie_get_the_semantics() is documented to return a string but was previously returning null (via return;) when $classes is empty. The change to return ''; is correct and consistent with the function's purpose of building attribute strings.
|
|
||
| if ( empty( $terms ) ) { | ||
| return false; | ||
| return array(); |
Copilot
AI
Aug 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function autonomie_term_links_tag() was previously returning false when no terms are found, but now returns an empty array. This change improves consistency since the function is documented to return an array and other parts of the code likely expect an array return type.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
keep! |
This PR includes Code Style, PHPdoc and other code quality fixes.
Pushes with just phpcbf are marked as such.
Besides a few marked places not output should be altered.