Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
eec0192
refactor: remove return values, as `autonomie_save_post` is hooked in…
apermo Apr 5, 2025
ba9cf2f
refactor: simplify unset calls for query variables in compat.php
apermo Apr 5, 2025
3aeee73
refactor: fix phpdoc return types for post format functions in feed.p…
apermo Apr 5, 2025
976f1cb
refactor: reorder condition for post format feed discovery in feed.php
apermo Apr 5, 2025
5daf2a4
refactor: update comments for clarity in customizer.php and featured-…
apermo Apr 5, 2025
6bf8f11
refactor: update phpdoc for parameters and return types in compat.php
apermo Apr 5, 2025
8b49e3c
refactor: improve code clarity and consistency in semantics.php
apermo Apr 5, 2025
fbe89be
refactor: improve comment clarity in featured-image.php
apermo Apr 5, 2025
c8b735e
chore: update PHP version requirement to 7.4 and configure plugin all…
apermo Apr 5, 2025
979168a
refactor: enhance code clarity and consistency in template-functions.php
apermo Apr 5, 2025
2306e22
refactor: improve phpdoc clarity for parameters and return type in we…
apermo Apr 5, 2025
459456e
refactor: streamline require statements and improve function formatti…
apermo Apr 5, 2025
bfb4ce5
refactor: improve phpdoc clarity and consistency in activitypub.php
apermo Apr 5, 2025
d079ed4
refactor: improve phpdoc clarity and consistency in post-kinds.php
apermo Apr 5, 2025
70cf320
refactor: improve code formatting and consistency in syndication-link…
apermo Apr 5, 2025
9fd738f
refactor: fix attribute name from 'width' to 'with' in indie-action e…
apermo Apr 5, 2025
7c23915
refactor: improve code formatting and readability in entry-header.php
apermo Apr 5, 2025
c7b2805
refactor: improve code formatting and consistency in entry-nav.php
apermo Apr 5, 2025
0c457dd
refactor: Removed unsupported attribute `type="text"` from `textarea`…
apermo Apr 5, 2025
4b52d98
refactor: Removed unsupported attribute `type="text"` from `textarea`…
apermo Apr 5, 2025
d5cc65d
refactor: fix indentation in page-banner.php
apermo Apr 5, 2025
7af6a78
chore: phpcbf changes in /templates/
apermo Apr 5, 2025
b5d0bbd
refactor: phpcbf, improve code formatting and consistency in multiple…
apermo Apr 5, 2025
cbce161
refactor: improve translator comments for clarity in comments.php
apermo Apr 5, 2025
0eb808a
chore: update tested version and PHP requirements in readme.md
apermo Apr 5, 2025
534a4e0
refactor: phpcbf - improve code readability and formatting in multipl…
apermo Apr 5, 2025
0fc955d
fix: update profile links to use HTTPS for improved security
apermo Apr 5, 2025
167b835
refactor: phpcbf and added missing `echo` to functions.php
apermo Apr 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/node_modules/
/vendor/
.DS_Store
.idea
_build
composer.lock
package-lock.json
15 changes: 13 additions & 2 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@
<div class="widget">
<h2 class="widgettitle"><?php _e( 'Most Used Categories', 'autonomie' ); ?></h2>
<ul>
<?php wp_list_categories( array( 'orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10 ) ); ?>
<?php
wp_list_categories(
array(
'orderby' => 'count',
'order' => 'DESC',
'show_count' => 1,
'title_li' => '',
'number' => 10,
)
);
?>
</ul>
</div>

Expand All @@ -42,4 +52,5 @@

</main><!-- #content -->

<?php get_footer(); ?>
<?php
get_footer();
3 changes: 2 additions & 1 deletion 500.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@

</main><!-- #content -->

<?php get_footer(); ?>
<?php
get_footer();
3 changes: 2 additions & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@

</main><!-- #content -->

<?php get_footer(); ?>
<?php
get_footer();
18 changes: 16 additions & 2 deletions comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@
<h2 id="comments-title">
<?php
printf(
_n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'autonomie' ),
/* 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.
Comment on lines +34 to +39
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.

'%1$s thoughts on &ldquo;%2$s&rdquo;',
get_comments_number(),
'autonomie'
),
number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>'
);
Expand All @@ -54,7 +63,12 @@
* define autonomie_comment() and that will be used instead.
* See autonomie_comment() in autonomie/functions.php for more.
*/
wp_list_comments( array( 'callback' => 'autonomie_comment', 'format' => '' ) );
wp_list_comments(
array(
'callback' => 'autonomie_comment',
'format' => '',
)
);
?>
</ol>

Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pfefferle/wordpress-autonomie",
"description": "Pure Zen",
"require": {
"php": ">=5.6.0",
"php": ">=7.4.0",
"composer/installers": "~2.2"
},
"type": "wordpress-theme",
Expand All @@ -15,5 +15,10 @@
],
"extra": {
"installer-name": "autonomie"
},
"config": {
"allow-plugins": {
"composer/installers": true
}
}
}
9 changes: 8 additions & 1 deletion footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@

<div id="site-generator">
<?php do_action( 'autonomie_credits' ); ?>
<?php printf( __( 'This site is powered by %1$s and styled with the %2$s theme', 'autonomie' ), '<a href="https://wordpress.org/" rel="generator">WordPress</a>', '<a href="https://notiz.blog/projects/autonomie/">Autonomie</a>' ); ?>
<?php
printf(
// translators: %1$s: Link to WordPress, %2$s: Link to Autonomie theme.
__( 'This site is powered by %1$s and styled with the %2$s theme', 'autonomie' ),
'<a href="https://wordpress.org/" rel="generator">WordPress</a>',
'<a href="https://notiz.blog/projects/autonomie/">Autonomie</a>'
);
?>
</div>
</footer><!-- #colophon -->
</div><!-- #page -->
Expand Down
24 changes: 12 additions & 12 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ function autonomie_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
?>
<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.

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="edit-link"><?php edit_comment_link( __( 'Edit', 'autonomie' ), ' ' ); ?></div>
<footer class="comment-meta commentmetadata">
<address class="comment-author p-author author vcard hcard h-card" itemprop="creator" itemscope itemtype="https://schema.org/Person">
Expand Down Expand Up @@ -513,42 +513,42 @@ function autonomie_comment( $comment, $args, $depth ) {
/**
* All template functions
*/
require( get_template_directory() . '/includes/template-functions.php' );
require get_template_directory() . '/includes/template-functions.php';

/**
* Widget handling
*/
require( get_template_directory() . '/includes/widgets.php' );
require get_template_directory() . '/includes/widgets.php';

/**
* Adds the featured image functionality
*/
require( get_template_directory() . '/includes/featured-image.php' );
require get_template_directory() . '/includes/featured-image.php';

/**
* All customizer functions
*/
require( get_template_directory() . '/includes/customizer.php' );
require get_template_directory() . '/includes/customizer.php';

/**
* Adds some awesome websemantics like microformats(2) and microdata
*/
require( get_template_directory() . '/includes/semantics.php' );
require get_template_directory() . '/includes/semantics.php';

/**
* Add Webactions support
*/
require( get_template_directory() . '/includes/webactions.php' );
require get_template_directory() . '/includes/webactions.php';

/**
* Adds back compat handling for older WP versions
*/
require( get_template_directory() . '/includes/compat.php' );
require get_template_directory() . '/includes/compat.php';

/**
* Feed extensions
*/
require( get_template_directory() . '/includes/feed.php' );
require get_template_directory() . '/includes/feed.php';

/**
* Compatibility with other plugins, mostly IndieWeb related
Expand All @@ -559,15 +559,15 @@ function autonomie_comment( $comment, $args, $depth ) {
* Adds Indieweb Syndcation Links
* if github.com/dshanske/syndication-links is activated
*/
require( get_template_directory() . '/integrations/syndication-links.php' );
require get_template_directory() . '/integrations/syndication-links.php';
}

if ( class_exists( 'Post_Kinds_Plugin' ) ) {
require( get_template_directory() . '/integrations/post-kinds.php' );
require get_template_directory() . '/integrations/post-kinds.php';
}

if ( class_exists( '\Activitypub\Activitypub' ) ) {
require( get_template_directory() . '/integrations/activitypub.php' );
require get_template_directory() . '/integrations/activitypub.php';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="profile" href="http://microformats.org/profile/specs" />
<link rel="profile" href="http://microformats.org/profile/hatom" />
<link rel="profile" href="https://microformats.org/profile/specs" />
<link rel="profile" href="https://microformats.org/profile/hatom" />

<?php wp_head(); ?>
</head>
Expand Down
42 changes: 33 additions & 9 deletions image.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

<main id="primary" <?php autonomie_main_class(); ?><?php autonomie_semantics( 'main' ); ?>>

<?php while ( have_posts() ) : the_post(); ?>
<?php
while ( have_posts() ) :
the_post();
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>itemscope itemtype="https://schema.org/ImageObject">
<?php get_template_part( 'template-parts/entry-header' ); ?>
Expand All @@ -24,13 +27,24 @@
* Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
* or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
*/
$attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
$attachments = array_values(
get_children(
array(
'post_parent' => $post->post_parent,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID',
)
)
);
foreach ( $attachments as $k => $attachment ) {
if ( $attachment->ID == $post->ID ) {
break;
}
}
$k++;
++$k;
// If there is more than 1 attachment in a gallery
if ( count( $attachments ) > 1 ) {
if ( isset( $attachments[ $k ] ) ) {
Expand All @@ -46,10 +60,12 @@
}
?>

<a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
$attachment_size = apply_filters( 'autonomie_attachment_size', 1200 );
echo wp_get_attachment_image( $post->ID, array( $attachment_size, $attachment_size ), null, array( 'itemprop' => 'image contentURL' ) ); // filterable image width with, essentially, no limit for image height.
?></a>
<a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment">
<?php
$attachment_size = apply_filters( 'autonomie_attachment_size', 1200 );
echo wp_get_attachment_image( $post->ID, array( $attachment_size, $attachment_size ), null, array( 'itemprop' => 'image contentURL' ) ); // filterable image width with, essentially, no limit for image height.
?>
</a>

<?php if ( ! empty( $post->post_excerpt ) ) : ?>
<figcaption class="entry-caption">
Expand All @@ -60,7 +76,14 @@
</div><!-- .entry-attachment -->

<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'autonomie' ), 'after' => '</div>' ) ); ?>
<?php
wp_link_pages(
array(
'before' => '<div class="page-link">' . __( 'Pages:', 'autonomie' ),
'after' => '</div>',
)
);
?>
</div><!-- .entry-content -->

<?php get_template_part( 'template-parts/entry-footer' ); ?>
Expand All @@ -72,4 +95,5 @@

</main><!-- #content -->

<?php get_footer(); ?>
<?php
get_footer();
14 changes: 8 additions & 6 deletions includes/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
/**
* Adds the new input types to the comment-form
*
* @param string $form
* @return string
* @param array $fields The comment form fields.
* @return array
*/
function autonomie_comment_autocomplete( $fields ) {
$fields['author'] = preg_replace( '/<input/', '<input autocomplete="nickname name" enterkeyhint="next" ', $fields['author'] );
Expand Down Expand Up @@ -64,9 +64,11 @@ function autonomie_query_format_standard( $query ) {
}
$query->is_tax = null;

unset( $query->query_vars['post_format'] );
unset( $query->query_vars['taxonomy'] );
unset( $query->query_vars['term'] );
unset(
$query->query_vars['post_format'],
$query->query_vars['taxonomy'],
$query->query_vars['term']
);

$query->set(
'tax_query',
Expand Down Expand Up @@ -103,7 +105,7 @@ function autonomie_add_lazy_loading( $content ) {

add_filter(
'wp_lazy_loading_enabled',
function( $default, $tag_name, $context ) {
function ( $default, $tag_name, $context ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound
if ( 'the_content' === $context ) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function autonomie_customize_register( $wp_customize ) {
'autonomie_settings_section',
array(
'title' => __( 'Advanced Settings', 'autonomie' ),
'description' => __( 'Enable/Disable some advanced Autonomie features.', 'autonomie' ), //Descriptive tooltip
'description' => __( 'Enable/Disable some advanced Autonomie features.', 'autonomie' ), //Descriptive tooltip.
'priority' => 35,
)
);
Expand Down
16 changes: 9 additions & 7 deletions includes/featured-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,29 +104,31 @@ function autonomie_featured_image_meta( $content, $post_id ) {
* Safe the Post Covers
*
* @param int $post_id The ID of the post being saved.
*
* @return void
*/
function autonomie_save_post( $post_id ) {
// if this is an autosave, our form has not been submitted, so we don't want to do anything.
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return $post_id;
return;
}

if ( ! array_key_exists( 'full_width_featured_image', $_POST ) ) {
return $post_id;
return;
}

if ( ! array_key_exists( 'post_type', $_POST ) ) {
return $post_id;
return;
}

// check the user's permissions.
if ( 'page' === $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_id ) ) {
return $post_id;
return;
}
} else {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return $post_id;
return;
}
}

Expand All @@ -148,14 +150,14 @@ function autonomie_save_post( $post_id ) {
* or none of the above conditions are true.
*/
function autonomie_has_full_width_featured_image() {
// If this isn't a Single post type or we don't have a Featured Image set
// If this isn't a Single post type, or we don't have a Featured Image set.
if ( ! ( is_single() || is_page() ) || ! has_post_thumbnail() ) {
return false;
}

$full_width_featured_image = get_post_meta( get_the_ID(), 'full_width_featured_image', true );

// If Use featured image as Post Cover has been checked in the Featured Image meta box, return true.
// If "Use featured image as Post Cover" has been checked in the Featured Image meta box, return true.
if ( '1' === $full_width_featured_image ) {
return true;
}
Expand Down
Loading