Skip to content

Conversation

@apermo
Copy link

@apermo apermo commented Apr 5, 2025

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.

apermo added 20 commits April 5, 2025 08:23
removed unused globals
fixed code style
fixed phpdoc
Copy link
Author

@apermo apermo left a 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 );
Copy link
Author

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 );
Copy link
Author

Choose a reason for hiding this comment

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

Same as above.

@apermo apermo marked this pull request as ready for review April 5, 2025 08:04
?>
<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">
Copy link
Author

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.

Comment on lines +34 to +39
/* 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 &ldquo;%2$s&rdquo;', // phpcs:ignore WordPress.WP.I18n.MissingSingularPlaceholder -- Translator instructions added.
Copy link
Author

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.

@apermo
Copy link
Author

apermo commented Apr 5, 2025

@pfefferle I'm ready with the code style fixes and review.

@stale
Copy link

stale bot commented Aug 3, 2025

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.

@stale stale bot added the wontfix label Aug 3, 2025
@pfefferle
Copy link
Owner

Keep

@stale stale bot removed the wontfix label Aug 3, 2025
@pfefferle pfefferle self-assigned this Aug 3, 2025
@pfefferle pfefferle requested review from Copilot and pfefferle August 3, 2025 17:31
Copy link

Copilot AI left a 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">&lt;cite class=&quot;h-cite&quot;&gt;&lt;a class=&quot;u-url p-name&quot; href=&quot;<?php echo get_permalink(); ?>&quot;&gt;<?php echo get_the_title(); ?>&lt;/a&gt; (&lt;span class=&quot;p-author h-card&quot; title=&quot;<?php echo get_the_author(); ?>&quot;&gt;<?php echo get_the_author(); ?>&lt;/span&gt; &lt;time class=&quot;dt-published&quot; datetime=&quot;<?php echo get_the_date( 'c' ); ?>&quot;&gt;<?php echo get_the_date(); ?>&lt;/time&gt;)&lt;/cite&gt;</textarea>
<textarea id="entry-summary" class="code" rows="5" cols="70">&lt;cite class=&quot;h-cite&quot;&gt;&lt;a class=&quot;u-url p-name&quot; href=&quot;<?php echo get_permalink(); ?>&quot;&gt;<?php echo get_the_title(); ?>&lt;/a&gt; (&lt;span class=&quot;p-author h-card&quot; title=&quot;<?php echo get_the_author(); ?>&quot;&gt;<?php echo get_the_author(); ?>&lt;/span&gt; &lt;time class=&quot;dt-published&quot; datetime=&quot;<?php echo get_the_date( 'c' ); ?>&quot;&gt;<?php echo get_the_date(); ?>&lt;/time&gt;)&lt;/cite&gt;</textarea>
Copy link

Copilot AI Aug 3, 2025

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.

Copilot uses AI. Check for mistakes.
<p>
<label for="entry-blockquote"><?php _e( 'HTML', 'autonomie' ); ?></label>
<textarea id="entry-blockquote" class="code" type="text" rows="5" cols="70">&lt;blockquote&gt;&lt;p&gt;<?php echo get_the_excerpt(); ?>&lt;/p&gt;&lt;small&gt;—&nbsp;by &lt;a href=&quot;<?php echo get_permalink(); ?>&quot; class=&quot;h-card&quot; title=&quot;<?php echo get_the_author(); ?>&quot;&gt;<?php echo get_the_author(); ?>&lt;/a&gt;&lt;/small&gt;&lt;/blockquote&gt;</textarea>
<textarea id="entry-blockquote" class="code" rows="5" cols="70">&lt;blockquote&gt;&lt;p&gt;<?php echo get_the_excerpt(); ?>&lt;/p&gt;&lt;small&gt;—&nbsp;by &lt;a href=&quot;<?php echo get_permalink(); ?>&quot; class=&quot;h-card&quot; title=&quot;<?php echo get_the_author(); ?>&quot;&gt;<?php echo get_the_author(); ?>&lt;/a&gt;&lt;/small&gt;&lt;/blockquote&gt;</textarea>
Copy link

Copilot AI Aug 3, 2025

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.

Copilot uses AI. Check for mistakes.
?>
<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">
Copy link

Copilot AI Aug 3, 2025

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.

Suggested change
<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">

Copilot uses AI. Check for mistakes.
<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>
Copy link

Copilot AI Aug 3, 2025

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.

Copilot uses AI. Check for mistakes.
<?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>
Copy link

Copilot AI Aug 3, 2025

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.

Copilot uses AI. Check for mistakes.

if ( ! $classes ) {
return;
return '';
Copy link

Copilot AI Aug 3, 2025

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.

Copilot uses AI. Check for mistakes.

if ( empty( $terms ) ) {
return false;
return array();
Copy link

Copilot AI Aug 3, 2025

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.

Copilot uses AI. Check for mistakes.
@stale
Copy link

stale bot commented Dec 1, 2025

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.

@stale stale bot added the wontfix label Dec 1, 2025
@pfefferle
Copy link
Owner

keep!

@stale stale bot removed the wontfix label Dec 2, 2025
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