From 49481cdbbe0f874d3e76ff4edbd6316f1f9e0aa3 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 19 Jun 2026 14:34:30 +0000 Subject: [PATCH] fix: resolve WordPress Plugin Check errors and warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix text domain mismatch in class-classes.php (slashed-bricks → slashed) - Remove deprecated load_plugin_textdomain() calls (auto-loaded since WP 4.6) - Add phpcs:ignore for manual CSS sanitization (wp_kses corrupts valid CSS selectors) - Add phpcs:ignore for direct DB query in reBEMer REST (caching incorrect for scan) - Add phpcs:ignore for dynamic hook names in class-inventory.php (prefixed via filter_slug()) --- SLASHED-for-WP/includes/class-inventory.php | 4 ++-- SLASHED-for-WP/includes/class-manual-css-page.php | 1 + .../integrations/bricks/includes/class-classes.php | 4 ++-- .../integrations/bricks/includes/class-rebemer-rest.php | 1 + SLASHED-for-WP/integrations/bricks/slashed-bricks.php | 9 --------- .../integrations/gutenberg/slashed-gutenberg.php | 9 --------- SLASHED-for-WP/slashed.php | 7 ------- 7 files changed, 6 insertions(+), 29 deletions(-) diff --git a/SLASHED-for-WP/includes/class-inventory.php b/SLASHED-for-WP/includes/class-inventory.php index 1e5b4078..072efdc5 100644 --- a/SLASHED-for-WP/includes/class-inventory.php +++ b/SLASHED-for-WP/includes/class-inventory.php @@ -165,7 +165,7 @@ public static function get() { * @param array $inventory ['variables', 'sf_classes', 'is_classes']. */ self::$cache[ static::class ] = self::sanitize_inventory( - apply_filters( static::filter_slug() . '/inventory', self::$cache[ static::class ] ) + apply_filters( static::filter_slug() . '/inventory', self::$cache[ static::class ] ) // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- hook name is prefixed via filter_slug() which returns the integration-specific prefix (e.g. slashed_bricks). ); return self::$cache[ static::class ]; @@ -666,7 +666,7 @@ private static function resolve() { * @return string Absolute path, or '' when no local copy is available. */ private static function find_local_bundle_path() { - $override = apply_filters( static::filter_slug() . '/inventory_local_path', null ); + $override = apply_filters( static::filter_slug() . '/inventory_local_path', null ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- hook name is prefixed via filter_slug(). if ( false === $override ) { return ''; diff --git a/SLASHED-for-WP/includes/class-manual-css-page.php b/SLASHED-for-WP/includes/class-manual-css-page.php index e2a4f13f..648d8eb1 100644 --- a/SLASHED-for-WP/includes/class-manual-css-page.php +++ b/SLASHED-for-WP/includes/class-manual-css-page.php @@ -61,6 +61,7 @@ public function handle_save() { if ( 'clear' === $action ) { update_option( self::OPTION_KEY, '' ); } else { + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- CSS cannot be sanitized via wp_kses without corrupting valid rules (e.g. `>`, `[attr~="val"]`). The value is validated below and stored raw; output is escaped at render time. $raw_css = isset( $_POST['slashed_manual_css'] ) ? wp_unslash( $_POST['slashed_manual_css'] ) : ''; diff --git a/SLASHED-for-WP/integrations/bricks/includes/class-classes.php b/SLASHED-for-WP/integrations/bricks/includes/class-classes.php index c91ed522..f90664fa 100644 --- a/SLASHED-for-WP/integrations/bricks/includes/class-classes.php +++ b/SLASHED-for-WP/integrations/bricks/includes/class-classes.php @@ -225,11 +225,11 @@ public function build_categories() { return array( array( 'id' => self::CATEGORY_LAYOUT, - 'name' => __( 'SLASHED Layout', 'slashed-bricks' ), + 'name' => __( 'SLASHED Layout', 'slashed' ), ), array( 'id' => self::CATEGORY_STATE, - 'name' => __( 'SLASHED State', 'slashed-bricks' ), + 'name' => __( 'SLASHED State', 'slashed' ), ), ); } diff --git a/SLASHED-for-WP/integrations/bricks/includes/class-rebemer-rest.php b/SLASHED-for-WP/integrations/bricks/includes/class-rebemer-rest.php index 22957fb7..4c7d983e 100644 --- a/SLASHED-for-WP/integrations/bricks/includes/class-rebemer-rest.php +++ b/SLASHED-for-WP/integrations/bricks/includes/class-rebemer-rest.php @@ -217,6 +217,7 @@ private function count_class_references( $classes ) { // are always the same, so the `truncated: true` flag is paired // with reproducible content rather than whatever order MySQL // happened to return rows in. + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- one-off scan for reBEMer; result set varies per call so caching would be incorrect. $rows = $wpdb->get_col( // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $placeholders is a list of literal %s built from a constant key list; the values are bound through prepare(). $wpdb->prepare( diff --git a/SLASHED-for-WP/integrations/bricks/slashed-bricks.php b/SLASHED-for-WP/integrations/bricks/slashed-bricks.php index 418d0124..042b9207 100644 --- a/SLASHED-for-WP/integrations/bricks/slashed-bricks.php +++ b/SLASHED-for-WP/integrations/bricks/slashed-bricks.php @@ -37,15 +37,6 @@ * is included. In standalone mode (this plugin activated directly), load * everything from the shared includes directory two levels up. */ -if ( ! defined( 'SLASHED_VERSION' ) ) { - add_action( - 'init', - function () { - load_plugin_textdomain( 'slashed-bricks', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); - } - ); -} - if ( ! class_exists( 'Slashed_Token_Store' ) ) { $slashed_shared = SLASHED_BRICKS_PATH . '../../includes/'; require_once $slashed_shared . 'class-settings.php'; diff --git a/SLASHED-for-WP/integrations/gutenberg/slashed-gutenberg.php b/SLASHED-for-WP/integrations/gutenberg/slashed-gutenberg.php index 26aecd7a..42bda0d0 100644 --- a/SLASHED-for-WP/integrations/gutenberg/slashed-gutenberg.php +++ b/SLASHED-for-WP/integrations/gutenberg/slashed-gutenberg.php @@ -122,15 +122,6 @@ function slashed_gutenberg_get_css_url() { return apply_filters( 'slashed_gutenberg/css_bundle_url', $default_url ); } -if ( ! defined( 'SLASHED_VERSION' ) ) { - add_action( - 'init', - function () { - load_plugin_textdomain( 'slashed-gutenberg', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); - } - ); -} - /** * Standalone token pipeline bootstrap. * diff --git a/SLASHED-for-WP/slashed.php b/SLASHED-for-WP/slashed.php index e795e6cf..4e7e107d 100644 --- a/SLASHED-for-WP/slashed.php +++ b/SLASHED-for-WP/slashed.php @@ -32,13 +32,6 @@ */ define( 'SLASHED_CSS_REF', 'v0.5.46' ); -add_action( - 'init', - function () { - load_plugin_textdomain( 'slashed', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); - } -); - // ─── Shared infrastructure ──────────────────────────────────────────── require_once SLASHED_PATH . 'includes/class-settings.php';