Fix Plugin Check warnings: remove load_plugin_textdomain, prefix global variables

- Remove deprecated load_plugin_textdomain() call (auto-loaded since WP 4.6)
- Prefix all global variables in themes.php with breznflow_ for WPCS compliance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael 2026-03-30 15:12:59 +00:00
parent fd83e4810b
commit c891e68b16
2 changed files with 16 additions and 17 deletions

View file

@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
use BreznFlow\Features\ThemeImporter; use BreznFlow\Features\ThemeImporter;
use BreznFlow\Features\ThemeRegistry; use BreznFlow\Features\ThemeRegistry;
$custom_themes = ThemeImporter::get_all(); $breznflow_custom_themes = ThemeImporter::get_all();
?> ?>
<div class="wrap breznflow-admin-wrap"> <div class="wrap breznflow-admin-wrap">
<h1><?php esc_html_e( 'BreznFlow — Themes', 'breznflow' ); ?></h1> <h1><?php esc_html_e( 'BreznFlow — Themes', 'breznflow' ); ?></h1>
@ -32,8 +32,8 @@ $custom_themes = ThemeImporter::get_all();
<?php if ( isset( $_GET['error'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> <?php if ( isset( $_GET['error'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>
<?php <?php
$error_code = sanitize_key( $_GET['error'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $breznflow_error_code = sanitize_key( $_GET['error'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$messages = array( $breznflow_messages = array(
'invalid_file' => __( 'Invalid file type. Please upload a .breznflow.json file.', 'breznflow' ), 'invalid_file' => __( 'Invalid file type. Please upload a .breznflow.json file.', 'breznflow' ),
'upload_failed' => __( 'File upload failed. Please try again.', 'breznflow' ), 'upload_failed' => __( 'File upload failed. Please try again.', 'breznflow' ),
'read_failed' => __( 'Could not read the uploaded file.', 'breznflow' ), 'read_failed' => __( 'Could not read the uploaded file.', 'breznflow' ),
@ -42,10 +42,10 @@ $custom_themes = ThemeImporter::get_all();
? urldecode( sanitize_text_field( wp_unslash( $_GET['message'] ) ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended ? urldecode( sanitize_text_field( wp_unslash( $_GET['message'] ) ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
: __( 'Theme validation failed.', 'breznflow' ), : __( 'Theme validation failed.', 'breznflow' ),
); );
$msg = $messages[ $error_code ] ?? __( 'An error occurred.', 'breznflow' ); $breznflow_msg = $breznflow_messages[ $breznflow_error_code ] ?? __( 'An error occurred.', 'breznflow' );
?> ?>
<div class="notice notice-error is-dismissible"> <div class="notice notice-error is-dismissible">
<p><?php echo esc_html( $msg ); ?></p> <p><?php echo esc_html( $breznflow_msg ); ?></p>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -81,10 +81,10 @@ $custom_themes = ThemeImporter::get_all();
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ( ThemeRegistry::BUILTIN as $bf_theme_id => $bf_theme_name ) : ?> <?php foreach ( ThemeRegistry::BUILTIN as $breznflow_theme_id => $breznflow_theme_name ) : ?>
<tr> <tr>
<td><?php echo esc_html( $bf_theme_name ); ?></td> <td><?php echo esc_html( $breznflow_theme_name ); ?></td>
<td><code><?php echo esc_html( $bf_theme_id ); ?></code></td> <td><code><?php echo esc_html( $breznflow_theme_id ); ?></code></td>
<td><?php esc_html_e( 'Built-in', 'breznflow' ); ?></td> <td><?php esc_html_e( 'Built-in', 'breznflow' ); ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
@ -98,7 +98,7 @@ $custom_themes = ThemeImporter::get_all();
<!-- Custom Themes --> <!-- Custom Themes -->
<div class="breznflow-card"> <div class="breznflow-card">
<h2><?php esc_html_e( 'Custom Themes', 'breznflow' ); ?></h2> <h2><?php esc_html_e( 'Custom Themes', 'breznflow' ); ?></h2>
<?php if ( empty( $custom_themes ) ) : ?> <?php if ( empty( $breznflow_custom_themes ) ) : ?>
<p class="description"><?php esc_html_e( 'No custom themes imported yet.', 'breznflow' ); ?></p> <p class="description"><?php esc_html_e( 'No custom themes imported yet.', 'breznflow' ); ?></p>
<?php else : ?> <?php else : ?>
<table class="wp-list-table widefat striped"> <table class="wp-list-table widefat striped">
@ -111,11 +111,11 @@ $custom_themes = ThemeImporter::get_all();
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ( $custom_themes as $theme ) : ?> <?php foreach ( $breznflow_custom_themes as $breznflow_theme ) : ?>
<tr> <tr>
<td><?php echo esc_html( $theme['name'] ); ?></td> <td><?php echo esc_html( $breznflow_theme['name'] ); ?></td>
<td><code><?php echo esc_html( $theme['id'] ); ?></code></td> <td><code><?php echo esc_html( $breznflow_theme['id'] ); ?></code></td>
<td><?php echo esc_html( (string) $theme['version'] ); ?></td> <td><?php echo esc_html( (string) $breznflow_theme['version'] ); ?></td>
<td> <td>
<a href=" <a href="
<?php <?php
@ -125,11 +125,11 @@ $custom_themes = ThemeImporter::get_all();
array( array(
'page' => 'breznflow-themes', 'page' => 'breznflow-themes',
'action' => 'delete_theme', 'action' => 'delete_theme',
'theme_id' => $theme['id'], 'theme_id' => $breznflow_theme['id'],
), ),
admin_url( 'admin.php' ) admin_url( 'admin.php' )
), ),
'breznflow_theme_delete_' . $theme['id'] 'breznflow_theme_delete_' . $breznflow_theme['id']
) )
); );
?> ?>

View file

@ -39,13 +39,12 @@ class Core {
} }
/** /**
* Initializes the plugin by loading text domain, dependencies, and hooks. * Initializes the plugin by loading dependencies and hooks.
* *
* @since 1.0.0 * @since 1.0.0
* @return void * @return void
*/ */
public function init(): void { public function init(): void {
load_plugin_textdomain( 'breznflow', false, dirname( plugin_basename( BREZNFLOW_FILE ) ) . '/languages' );
$this->load_dependencies(); $this->load_dependencies();
$this->register_hooks(); $this->register_hooks();
} }