diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index 76a74767a..313167e18 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -20,7 +20,7 @@
*/build/*
- /wp-content/themes/(?!pattern-directory)
+ /wp-content/themes/(?!*pattern-directory*)
/wp-content/plugins/(?!pattern-)
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/functions.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/functions.php
index 93d69b841..db5770925 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/functions.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/functions.php
@@ -87,7 +87,7 @@ function do_pattern_actions() {
// Reload the page with an error flag.
$url = add_query_arg(
array(
- 'status' => 'draft-failed'
+ 'status' => 'draft-failed',
),
get_the_permalink()
);
@@ -109,16 +109,16 @@ function do_pattern_actions() {
);
if ( $success ) {
$args = array(
- 'status' => 'reported'
+ 'status' => 'reported',
);
} else {
$args = array(
- 'status' => 'report-failed'
+ 'status' => 'report-failed',
);
}
} else {
$args = array(
- 'status' => 'logged-out'
+ 'status' => 'logged-out',
);
}
@@ -387,6 +387,7 @@ function get_patterns_count() {
AND {$wpdb->postmeta}.meta_key = 'wpop_locale'
AND {$wpdb->postmeta}.meta_value = '%s'";
+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$count = $wpdb->get_var( $wpdb->prepare( $sql, $locale ) );
set_transient( $cache_key, $count, $ttl );
}
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/inc/block-config.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/inc/block-config.php
index 81a4333ba..c519a5857 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/inc/block-config.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/inc/block-config.php
@@ -20,6 +20,12 @@
add_filter( 'wporg_block_site_breadcrumbs', __NAMESPACE__ . '\update_site_breadcrumbs' );
add_filter( 'render_block_data', __NAMESPACE__ . '\modify_pattern_include' );
+/**
+ * Register block bindings.
+ *
+ * This registers some sources which can be used to dynamically inject content
+ * into block text or attributes.
+ */
function register_block_bindings() {
register_block_bindings_source(
'wporg-pattern/edit-label',
@@ -33,7 +39,7 @@ function register_block_bindings() {
__( 'Edit "%s" ', 'wporg-patterns' ),
get_the_title( $post_id )
);
- }
+ },
)
);
@@ -45,7 +51,7 @@ function register_block_bindings() {
'get_value_callback' => function( $args, $block ) {
$post_id = $block->context['postId'];
return site_url( "pattern/$post_id/edit/" );
- }
+ },
)
);
}
@@ -108,10 +114,10 @@ function update_query_total_label( $label, $found_posts ) {
$count = get_patterns_count();
/* translators: %s: the result count. */
- return sprintf( _n( '%s pattern', '%s patterns', $count, 'wporg' ), number_format_i18n( $count ) );
+ return sprintf( _n( '%s pattern', '%s patterns', $count, 'wporg-patterns' ), number_format_i18n( $count ) );
}
/* translators: %s: the result count. */
- return _n( '%s pattern', '%s patterns', $found_posts, 'wporg' );
+ return _n( '%s pattern', '%s patterns', $found_posts, 'wporg-patterns' );
}
/**
@@ -124,34 +130,34 @@ function get_curation_options( $options ) {
global $wp_query;
$current = strtolower( $wp_query->get( 'curation' ) );
- $label = __( 'Filter by', 'wporg' );
+ $label = __( 'Filter by', 'wporg-patterns' );
switch ( $current ) {
case 'community':
- $label = __( 'Community', 'wporg' );
+ $label = _x( 'Community', 'filter option label', 'wporg-patterns' );
break;
case 'core':
- $label = __( 'Curated', 'wporg' );
+ $label = _x( 'Curated', 'filter option label', 'wporg-patterns' );
break;
default:
- $label = __( 'All', 'wporg' );
+ $label = _x( 'All', 'filter option label', 'wporg-patterns' );
break;
}
// Show the correct filters on the front page.
if ( is_front_page() ) {
$current = 'core';
- $label = __( 'Curated', 'wporg' );
+ $label = _x( 'Curated', 'filter option label', 'wporg-patterns' );
}
return array(
'label' => $label,
- 'title' => __( 'Filter', 'wporg' ),
+ 'title' => __( 'Filter', 'wporg-patterns' ),
'key' => 'curation',
'action' => get_filter_action_url(),
'options' => array(
- '' => __( 'All', 'wporg' ),
- 'community' => __( 'Community', 'wporg' ),
- 'core' => __( 'Curated', 'wporg' ),
+ '' => _x( 'All', 'filter option label', 'wporg-patterns' ),
+ 'community' => _x( 'Community', 'filter option label', 'wporg-patterns' ),
+ 'core' => _x( 'Curated', 'filter option label', 'wporg-patterns' ),
),
'selected' => [ $current ],
);
@@ -174,38 +180,43 @@ function get_sort_options( $options ) {
$sort = 'favorite_count_desc';
}
- $label = __( 'Sort', 'wporg' );
+ $label = __( 'Sort', 'wporg-patterns' );
switch ( $sort ) {
case 'date_desc':
- $label = __( 'Newest', 'wporg' );
+ $label = __( 'Newest', 'wporg-patterns' );
break;
case 'date_asc':
- $label = __( 'Oldest', 'wporg' );
+ $label = __( 'Oldest', 'wporg-patterns' );
break;
case 'favorite_count_desc':
- $label = __( 'Popular', 'wporg' );
+ $label = __( 'Popular', 'wporg-patterns' );
break;
}
// Show the correct filters on the front page.
if ( is_front_page() ) {
$sort = 'favorite_count_desc';
- $label = __( 'Popular', 'wporg' );
+ $label = __( 'Popular', 'wporg-patterns' );
}
$options = array(
- 'date_desc' => __( 'Newest', 'wporg' ),
- 'date_asc' => __( 'Oldest', 'wporg' ),
+ 'date_desc' => __( 'Newest', 'wporg-patterns' ),
+ 'date_asc' => __( 'Oldest', 'wporg-patterns' ),
);
// These pages don't support sorting by favorite count.
if ( ! is_page( [ 'my-patterns', 'favorites' ] ) ) {
- $options = array_merge( [ 'favorite_count_desc' => __( 'Popular', 'wporg' ) ], $options );
+ $options = array_merge(
+ array(
+ 'favorite_count_desc' => __( 'Popular', 'wporg-patterns' ),
+ ),
+ $options
+ );
}
return array(
'label' => $label,
- 'title' => __( 'Sort', 'wporg' ),
+ 'title' => $label,
'key' => 'orderby',
'action' => get_filter_action_url(),
'options' => $options,
@@ -241,10 +252,10 @@ function inject_other_filters( $key ) {
}
if ( is_front_page() ) {
- if ( $key !== 'curation' ) {
+ if ( 'curation' !== $key ) {
printf( ' ' );
}
- if ( $key !== 'orderby' ) {
+ if ( 'orderby' !== $key ) {
printf( ' ' );
}
}
@@ -304,17 +315,17 @@ function add_site_navigation_menus( $menus ) {
$current_status = isset( $wp_query->query['status'] ) ? $wp_query->query['status'] : false;
$statuses = array(
array(
- 'label' => __( 'Draft', 'wporg' ),
+ 'label' => __( 'Draft', 'wporg-patterns' ),
'url' => add_query_arg( 'status', 'draft', get_permalink() ),
'className' => 'draft' === $current_status ? 'current-menu-item' : '',
),
array(
- 'label' => __( 'Pending Review', 'wporg' ),
+ 'label' => __( 'Pending Review', 'wporg-patterns' ),
'url' => add_query_arg( 'status', 'pending', get_permalink() ),
'className' => 'pending' === $current_status ? 'current-menu-item' : '',
),
array(
- 'label' => __( 'Published', 'wporg' ),
+ 'label' => __( 'Published', 'wporg-patterns' ),
'url' => add_query_arg( 'status', 'publish', get_permalink() ),
'className' => 'publish' === $current_status ? 'current-menu-item' : '',
),
@@ -327,7 +338,7 @@ function add_site_navigation_menus( $menus ) {
'slug' => array(
// `query` is "Posts".
'featured', 'query', 'text', 'gallery', 'call-to-action',
- 'banner', 'header', 'footer', 'wireframe'
+ 'banner', 'header', 'footer', 'wireframe',
),
'orderby' => 'slug__in',
)
@@ -378,13 +389,13 @@ function update_archive_title( $block_content, $block, $instance ) {
if ( ! empty( $term_names ) ) {
$term_names = wp_list_pluck( $term_names, 'name' );
// translators: %s list of terms used for filtering.
- $title = sprintf( __( 'Patterns: %s', 'wporg' ), implode( ', ', $term_names ) );
+ $title = sprintf( __( 'Patterns: %s', 'wporg-patterns' ), implode( ', ', $term_names ) );
} else {
$author = isset( $wp_query->query['author_name'] ) ? get_user_by( 'slug', $wp_query->query['author_name'] ) : false;
if ( $author ) {
- $title = sprintf( __( 'Author: %s', 'wporg' ), $author->display_name );
+ $title = sprintf( __( 'Author: %s', 'wporg-patterns' ), $author->display_name );
} else {
- $title = __( 'All patterns', 'wporg' );
+ $title = __( 'All patterns', 'wporg-patterns' );
}
}
@@ -410,7 +421,7 @@ function update_archive_title( $block_content, $block, $instance ) {
/**
* Update the archive title for all filter views.
*
- * @param string $block_content The block content.
+ * @param string $block_content The block content.
*/
function update_site_title( $block_content, $block, $instance ) {
return str_replace(
@@ -432,7 +443,7 @@ function update_site_breadcrumbs( $breadcrumbs ) {
$breadcrumbs = array(
array(
'url' => home_url(),
- 'title' => __( 'Home', 'wporg' ),
+ 'title' => __( 'Home', 'wporg-patterns' ),
),
);
@@ -453,7 +464,7 @@ function update_site_breadcrumbs( $breadcrumbs ) {
if ( isset( $wp_query->query['status'] ) ) {
$breadcrumbs[] = array(
'url' => false,
- 'title' => get_post_status_object( $wp_query->query['status'] )->label
+ 'title' => get_post_status_object( $wp_query->query['status'] )->label,
);
}
return $breadcrumbs;
@@ -462,11 +473,11 @@ function update_site_breadcrumbs( $breadcrumbs ) {
if ( is_search() ) {
$breadcrumbs[] = array(
'url' => home_url( '/archives/' ),
- 'title' => __( 'All patterns', 'wporg' ),
+ 'title' => __( 'All patterns', 'wporg-patterns' ),
);
$breadcrumbs[] = array(
'url' => false,
- 'title' => __( 'Search results', 'wporg' ),
+ 'title' => __( 'Search results', 'wporg-patterns' ),
);
return $breadcrumbs;
}
@@ -478,13 +489,13 @@ function update_site_breadcrumbs( $breadcrumbs ) {
$breadcrumbs[] = array(
'url' => home_url( '/archives/' ),
- 'title' => __( 'All patterns', 'wporg' ),
+ 'title' => __( 'All patterns', 'wporg-patterns' ),
);
if ( $author ) {
$breadcrumbs[] = array(
'url' => get_author_posts_url( $author->ID ),
- 'title' => sprintf( __( 'Author: %s', 'wporg' ), $author->display_name ),
+ 'title' => sprintf( __( 'Author: %s', 'wporg-patterns' ), $author->display_name ),
);
}
@@ -499,7 +510,7 @@ function update_site_breadcrumbs( $breadcrumbs ) {
}
// Last item should be "current", no URL.
- $breadcrumbs[count($breadcrumbs) - 1]['url'] = false;
+ $breadcrumbs[ count( $breadcrumbs ) - 1 ]['url'] = false;
return $breadcrumbs;
}
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_footer.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_footer.php
index 2cbf01d62..bf5934971 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_footer.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_footer.php
@@ -1,4 +1,5 @@
-
+
-
+
@@ -31,17 +32,17 @@
-
+
-
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_grid-favorites.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_grid-favorites.php
index 406324bc2..a6e6be4c1 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_grid-favorites.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_grid-favorites.php
@@ -1,4 +1,5 @@
-
+
@@ -54,7 +55,7 @@
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_grid-mine.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_grid-mine.php
index cc2e0cc2e..919ca2078 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_grid-mine.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_grid-mine.php
@@ -1,4 +1,5 @@
-
+
@@ -50,23 +51,23 @@
-
+
-
+
-
+
all patterns or try a different search. ', 'wporg' ) ),
+ wp_kses_post( __( 'View all patterns or try a different search. ', 'wporg-patterns' ) ),
esc_url( home_url( '/archives/' ) )
); ?>
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_logged-out-favorites.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_logged-out-favorites.php
index 5bd4436c5..b56bd32d4 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_logged-out-favorites.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_logged-out-favorites.php
@@ -1,9 +1,10 @@
-
\ No newline at end of file
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_logged-out-patterns.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_logged-out-patterns.php
index 09750f4cf..0e4c65977 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_logged-out-patterns.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/_logged-out-patterns.php
@@ -1,9 +1,10 @@
-
\ No newline at end of file
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/front-page-header.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/front-page-header.php
index 4752b4ee7..4c62b8a22 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/front-page-header.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/front-page-header.php
@@ -23,7 +23,7 @@
-
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/single-my-pattern.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/single-my-pattern.php
index 78f438d9d..23f7315ea 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/single-my-pattern.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/single-my-pattern.php
@@ -5,10 +5,10 @@
* Inserter: no
*/
-$status = isset( $_GET['status'] ) ? $_GET['status'] : false;
+$action_status = isset( $_GET['status'] ) ? $_GET['status'] : false;
$notice = '';
$notice_type = 'warning';
-if ( 'draft-failed' === $status ) {
+if ( 'draft-failed' === $action_status ) {
$notice = __( 'Your pattern could not be updated, please try again.', 'wporg-patterns' );
}
@@ -16,11 +16,11 @@
-
-
+
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/single-pattern.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/single-pattern.php
index cd358d65a..5b5abe9a0 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/single-pattern.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/patterns/single-pattern.php
@@ -5,15 +5,15 @@
* Inserter: no
*/
-$status = isset( $_GET['status'] ) ? $_GET['status'] : false;
+$action_status = isset( $_GET['status'] ) ? $_GET['status'] : false;
$notice = '';
$notice_type = 'warning';
-if ( 'report-failed' === $status ) {
+if ( 'report-failed' === $action_status ) {
$notice = __( 'Your pattern report could not be saved. Please try again.', 'wporg-patterns' );
-} else if ( 'logged-out' === $status ) {
+} else if ( 'logged-out' === $action_status ) {
$notice = __( 'You must be logged in to report a pattern.', 'wporg-patterns' );
-} else if ( 'reported' === $status ) {
+} else if ( 'reported' === $action_status ) {
$notice_type = 'info';
$notice = __( 'Your report has been submitted.', 'wporg-patterns' );
}
@@ -22,11 +22,11 @@
-
-
+
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/copy-button/index.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/copy-button/index.php
index 0275cb5d3..630704569 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/copy-button/index.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/copy-button/index.php
@@ -10,6 +10,9 @@
add_action( 'init', __NAMESPACE__ . '\init' );
+/**
+ * Register the block.
+ */
function init() {
register_block_type( __DIR__ . '/../../../build/blocks/copy-button' );
}
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/copy-button/render.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/copy-button/render.php
index f9d2f895c..362ce720a 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/copy-button/render.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/copy-button/render.php
@@ -1,9 +1,9 @@
context['postId'];
-if ( ! $post_id ) {
+$current_post_id = $block->context['postId'];
+if ( ! $current_post_id ) {
return '';
}
@@ -16,7 +16,7 @@
$classes[] = 'is-style-outline';
}
-$post = get_post( $post_id );
+$current_post = get_post( $current_post_id );
?>
implode( ' ', $classes ) ] ); // phpcs:ignore ?>>
-
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/delete-button/index.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/delete-button/index.php
index 3bc319614..ed7b45873 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/delete-button/index.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/delete-button/index.php
@@ -10,6 +10,9 @@
add_action( 'init', __NAMESPACE__ . '\init' );
+/**
+ * Register the block.
+ */
function init() {
register_block_type( __DIR__ . '/../../../build/blocks/delete-button' );
}
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/delete-button/render.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/delete-button/render.php
index 5a6cc5101..a0de635e8 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/delete-button/render.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/delete-button/render.php
@@ -1,12 +1,12 @@
context['postId'];
-if ( ! $post_id ) {
+$current_post_id = $block->context['postId'];
+if ( ! $current_post_id ) {
return;
}
// Check if the user has permissions.
-if ( ! current_user_can( 'edit_post', $post_id ) ) {
+if ( ! current_user_can( 'edit_post', $current_post_id ) ) {
return;
}
@@ -15,7 +15,7 @@
// Initial state to pass to Interactivity API.
$init_state = [
- 'postId' => $post_id,
+ 'postId' => $current_post_id,
'message' => __( 'Are you sure you want to delete this pattern?', 'wporg-patterns' ),
'redirectUrl' => home_url( '/my-patterns/' ),
];
@@ -37,9 +37,11 @@ class="wp-block-button__link wp-element-button"
"%s"', 'wporg-patterns' ),
- get_the_title( $post_id )
+ echo wp_kses_post(
+ printf(
+ __( 'Delete
"%s" ', 'wporg-patterns' ),
+ get_the_title( $current_post_id )
+ )
);
?>
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/favorite-button/index.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/favorite-button/index.php
index ece9c601e..11a961372 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/favorite-button/index.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/favorite-button/index.php
@@ -10,6 +10,9 @@
add_action( 'init', __NAMESPACE__ . '\init' );
+/**
+ * Register the block.
+ */
function init() {
register_block_type( __DIR__ . '/../../../build/blocks/favorite-button' );
}
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/favorite-button/render.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/favorite-button/render.php
index e87564688..93e26275c 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/favorite-button/render.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/favorite-button/render.php
@@ -2,10 +2,10 @@
use function WordPressdotorg\Pattern_Directory\Favorite\{get_favorite_count, is_favorite};
-$variant = $attributes[ 'variant' ] ?? 'default';
+$variant = $attributes['variant'] ?? 'default';
-$post_id = $block->context['postId'];
-if ( ! $post_id ) {
+$current_post_id = $block->context['postId'];
+if ( ! $current_post_id ) {
return '';
}
@@ -18,15 +18,15 @@
// Manually enqueue this script, so that it's available for the interactivity view script.
wp_enqueue_script( 'wp-api-fetch' );
-$is_favorite = is_favorite( $post_id, $user_id );
+$is_favorite = is_favorite( $current_post_id, $user_id );
$classes = [ 'is-small' ];
if ( 'small' === $variant ) {
$classes[] = 'is-variant-small';
}
-$classes = implode( ' ', $classes );
+$classes = implode( ' ', $classes );
$tag_name = ! $user_id ? 'span' : 'button';
-$favorite_count = get_favorite_count( $post_id );
+$favorite_count = get_favorite_count( $current_post_id );
$add_label = __( 'Add to favorites', 'wporg-patterns' );
$remove_label = __( 'Remove from favorites', 'wporg-patterns' );
@@ -42,14 +42,14 @@
// Initial state to pass to Interactivity API.
$init_state = [
- 'postId' => $post_id,
+ 'postId' => $current_post_id,
'isFavorite' => $is_favorite,
'count' => $favorite_count,
'label' => [
'add' => $add_label,
'remove' => $remove_label,
'screenReader' => __( 'Favorited %s times', 'wporg-patterns' ),
- ]
+ ],
];
$encoded_state = wp_json_encode( $init_state );
@@ -60,7 +60,7 @@
data-wp-context=""
data-wp-class--is-favorite="context.isFavorite"
>
- <
+ <
class="wporg-favorite-button__button"
disabled="disabled"
data-wp-bind--disabled="!context.postId"
@@ -76,10 +76,10 @@ class="wporg-favorite-button__button"
-
+
-
+
- >
-
\ No newline at end of file
+ >
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/controls/render.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/controls/render.php
index dddc2de21..f147a6fd2 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/controls/render.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/controls/render.php
@@ -39,7 +39,7 @@ class="wp-block-button__link wp-element-button"
data-width="1200"
>
-
+
-
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/frame/render.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/frame/render.php
index 4d7c3e009..4fb759503 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/frame/render.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/frame/render.php
@@ -33,7 +33,7 @@
>
-
\ No newline at end of file
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/index.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/index.php
index 2991d445a..23195fc11 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/index.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-preview/index.php
@@ -10,6 +10,9 @@
add_action( 'init', __NAMESPACE__ . '\init' );
+/**
+ * Register the blocks.
+ */
function init() {
register_block_type( __DIR__ . '/../../../build/blocks/pattern-preview/controls' );
register_block_type( __DIR__ . '/../../../build/blocks/pattern-preview/frame' );
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-thumbnail/render.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-thumbnail/render.php
index c031d9856..a379fe10e 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-thumbnail/render.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/pattern-thumbnail/render.php
@@ -5,13 +5,13 @@
if ( ! isset( $block->context['postId'] ) ) {
return '';
}
-$post_id = $block->context['postId'];
+$current_post_id = $block->context['postId'];
-$view_url = get_pattern_preview_url( $post_id );
+$view_url = get_pattern_preview_url( $current_post_id );
$has_link = isset( $attributes['isLink'] ) && true == $attributes['isLink'];
$is_lazyload = isset( $attributes['lazyLoad'] ) && true === $attributes['lazyLoad'];
-$viewport_width = get_post_meta( $post_id, 'wpop_viewport_width', true );
+$viewport_width = get_post_meta( $current_post_id, 'wpop_viewport_width', true );
if ( ! $viewport_width ) {
$viewport_width = 1200;
@@ -57,7 +57,7 @@
tabIndex="-1"
>
-
+
-
\ No newline at end of file
+
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/post-status/index.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/post-status/index.php
index 6b16b4325..f74af5f07 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/post-status/index.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/post-status/index.php
@@ -10,6 +10,9 @@
add_action( 'init', __NAMESPACE__ . '\init' );
+/**
+ * Register the block.
+ */
function init() {
register_block_type(
__DIR__ . '/../../../build/blocks/post-status',
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/report-pattern/index.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/report-pattern/index.php
index a01874b37..e22743c36 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/report-pattern/index.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/report-pattern/index.php
@@ -10,6 +10,9 @@
add_action( 'init', __NAMESPACE__ . '\init' );
+/**
+ * Register the block.
+ */
function init() {
register_block_type( __DIR__ . '/../../../build/blocks/report-pattern' );
}
diff --git a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/report-pattern/render.php b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/report-pattern/render.php
index 9fd8ca873..6d42d6343 100644
--- a/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/report-pattern/render.php
+++ b/public_html/wp-content/themes/wporg-pattern-directory-2024/src/blocks/report-pattern/render.php
@@ -10,8 +10,8 @@
wp_script_add_data( $block->block_type->view_script, 'group', 1 );
}
-$post_id = $block->context['postId'];
-if ( ! $post_id ) {
+$current_post_id = $block->context['postId'];
+if ( ! $current_post_id ) {
return;
}
@@ -23,13 +23,17 @@
if ( user_has_flagged_pattern() ) {
printf(
'%s
',
- get_block_wrapper_attributes(),
- __( 'You’ve reported this pattern.', 'wporg-patterns' )
+ get_block_wrapper_attributes(), // phpcs:ignore
+ esc_html__( 'You’ve reported this pattern.', 'wporg-patterns' )
);
return;
}
-$reasons = get_terms( [ 'taxonomy' => FLAG_REASON, 'hide_empty' => false, 'orderby' => 'slug' ] );
+$reasons = get_terms( [
+ 'taxonomy' => FLAG_REASON,
+ 'hide_empty' => false,
+ 'orderby' => 'slug',
+] );
?>
>
@@ -57,7 +61,7 @@ class="wporg-report-pattern__dialog-container"
-