Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions includes/abstract/feedzy-rss-feeds-admin-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ public function get_short_code_attributes( $atts ) {
// comma separated feeds url.
'feeds' => '',
// number of feeds items (0 for unlimited).
'max' => '5',
'max' => '10',
// display feed title yes/no.
Comment on lines 613 to 617
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

This PR changes the shortcode default/fallback for max to 10, but there’s no unit test asserting the default behavior when max is omitted/empty/invalid. Since the repo already has PHPUnit coverage for the admin abstract, add a test that get_short_code_attributes([]) defaults max to 10 and that sanitize_attr() falls back to 10 for empty/non-numeric values (while preserving explicit numeric values like 5).

Copilot uses AI. Check for mistakes.
'feed_title' => 'yes',
// _blank, _self
Expand Down Expand Up @@ -1144,7 +1144,7 @@ public function sanitize_attr( $sc, $feed_url ) {
if ( '0' == $sc['max'] ) {
$sc['max'] = '999';
} elseif ( empty( $sc['max'] ) || ! is_numeric( $sc['max'] ) ) {
$sc['max'] = '5';
$sc['max'] = '10';
}

if ( empty( $sc['offset'] ) || ! is_numeric( $sc['offset'] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/feedzy-rss-feeds-ui-lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static function get_form_elements() {
'max' => array(
'label' => __( 'Number of items to display.', 'feedzy-rss-feeds' ),
// translators: %s is the list of examples.
'placeholder' => '(' . sprintf( __( 'eg: %s', 'feedzy-rss-feeds' ), '5' ) . ')',
'placeholder' => '(' . sprintf( __( 'eg: %s', 'feedzy-rss-feeds' ), '10' ) . ')',
'type' => 'text',
'value' => '',
),
Expand Down
2 changes: 1 addition & 1 deletion includes/gutenberg/feedzy-rss-feeds-gutenberg-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function feedzy_register_block_type() {
),
'max' => array(
'type' => 'number',
'default' => '5',
'default' => 10,
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

The Gutenberg block’s JS attribute schema still defaults max to 5 (see js/FeedzyBlock/attributes.js), while the PHP register_block_type() schema now defaults to 10. This mismatch can cause newly inserted blocks in the editor to still start at 5 items and may also trigger block validation/serialization inconsistencies. Update the editor-side attributes default (and rebuilt assets, if applicable) to keep the JS and PHP schemas in sync.

Suggested change
'default' => 10,
'default' => 5,

Copilot uses AI. Check for mistakes.
),
Comment on lines 104 to 107
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

max is registered with 'type' => 'number' but its default is set as a string ('10'). Using a numeric literal for the default keeps the attribute schema consistent and avoids subtle type/coercion differences during block parsing/serialization.

Copilot uses AI. Check for mistakes.
'offset' => array(
'type' => 'number',
Expand Down
Loading