From 200cc5671df3a0f0368006da3d07b7fbf6b20692 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Mon, 21 Apr 2025 15:01:09 +0100 Subject: [PATCH] Fix indentation issues in PHP files - Fixed tabs vs spaces indentation issues in PHP files - Updated phpcs.xml configuration --- admin/templates/modal.php | 84 ++++++++++----------- includes/Admin/class-admin.php | 133 +++++++++++++++++---------------- includes/class-core.php | 64 ++++++++-------- includes/class-plugin.php | 84 ++++++++++----------- phpcs.xml | 1 - wp-plugin-starter-template.php | 2 +- 6 files changed, 184 insertions(+), 184 deletions(-) diff --git a/admin/templates/modal.php b/admin/templates/modal.php index 3d75889..ad59744 100644 --- a/admin/templates/modal.php +++ b/admin/templates/modal.php @@ -7,51 +7,51 @@ // Ensure this file is loaded within WordPress. if ( ! defined( 'ABSPATH' ) ) { - die; + die; } ?>
-
-
-

- × -
- -
-

- -
- -
- - - - - - - -
-
- - -
+
+
+

+ × +
+ +
+

+ +
+ +
+ + + + + + + +
+
+ + +
diff --git a/includes/Admin/class-admin.php b/includes/Admin/class-admin.php index a07a54e..d406e1e 100644 --- a/includes/Admin/class-admin.php +++ b/includes/Admin/class-admin.php @@ -14,86 +14,87 @@ use WPALLSTARS\PluginStarterTemplate\Core; */ class Admin { - /** - * Core plugin class instance. - * - * @var Core - */ - private $core; + /** + * Core plugin class instance. + * + * @var Core + */ + private $core; - /** - * Constructor. - * - * @param Core $core Core instance. - */ - public function __construct( Core $core ) { - $this->core = $core; - $this->initialize_hooks(); - } + /** + * Constructor. + * + * @param Core $core Core instance. + */ + public function __construct( Core $core ) { + $this->core = $core; + $this->initialize_hooks(); + } - /** - * Initializes WordPress hooks. - */ - private function initialize_hooks() { - \add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) ); - } + /** + * Initializes WordPress hooks. + */ + private function initialize_hooks() { + \add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) ); + } - /** - * Enqueues admin-specific scripts and styles. - * - * This method is hooked into 'admin_enqueue_scripts'. It checks if the current - * screen is relevant to the plugin before enqueueing assets. + /** + * Enqueues admin-specific scripts and styles. + * + * This method is hooked into 'admin_enqueue_scripts'. It checks if the current + * screen is relevant to the plugin before enqueueing assets. - * + * * @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found - * @param string $hook_suffix The hook suffix of the current admin page. - */ - public function enqueue_admin_assets( string $hook_suffix ): void { + * + * @param string $hook_suffix The hook suffix of the current admin page. + */ + public function enqueue_admin_assets( string $hook_suffix ): void { // @phpcs:disable WordPress.Security.NonceVerification.Recommended // @phpcs:disable WordPress.Security.NonceVerification.Missing - if ( ! isset( $_GET['page'] ) || 'wp_plugin_starter_template_settings' !== $_GET['page'] ) { - return; - } + if ( ! isset( $_GET['page'] ) || 'wp_plugin_starter_template_settings' !== $_GET['page'] ) { + return; + } // @phpcs:enable - // Get the plugin version. - $plugin_version = $this->core->get_plugin_version(); + // Get the plugin version. + $plugin_version = $this->core->get_plugin_version(); - // Enqueue styles. - \wp_enqueue_style( - 'wpst-admin-styles', - \plugin_dir_url( __FILE__ ) . '../../admin/css/admin-styles.css', - array(), // Dependencies. - $plugin_version // Version. - ); + // Enqueue styles. + \wp_enqueue_style( + 'wpst-admin-styles', + \plugin_dir_url( __FILE__ ) . '../../admin/css/admin-styles.css', + array(), // Dependencies. + $plugin_version // Version. + ); - // Enqueue admin scripts. - \wp_enqueue_script( - 'wpst-admin-script', - \plugin_dir_url( __FILE__ ) . '../../admin/js/admin-scripts.js', - array( 'jquery' ), - $plugin_version, // Version. - true - ); + // Enqueue admin scripts. + \wp_enqueue_script( + 'wpst-admin-script', + \plugin_dir_url( __FILE__ ) . '../../admin/js/admin-scripts.js', + array( 'jquery' ), + $plugin_version, // Version. + true + ); - // Prepare data for localization. - $data = array( - 'ajax_url' => \admin_url( 'admin-ajax.php' ), - // @TODO: Fix mocking for wp_create_nonce. Issue #1. - // 'nonce' => \wp_create_nonce( 'wpst_admin_nonce' ), - ); + // Prepare data for localization. + $data = array( + 'ajax_url' => \admin_url( 'admin-ajax.php' ), + // @TODO: Fix mocking for wp_create_nonce. Issue #1. + // 'nonce' => \wp_create_nonce( 'wpst_admin_nonce' ), + ); - // Localize the script with the data. - // @TODO: Fix mocking for wp_localize_script. Issue #1. + // Localize the script with the data. + // @TODO: Fix mocking for wp_localize_script. Issue #1. // @phpcs:ignore Squiz.PHP.CommentedOutCode.Found - /* - \wp_localize_script( - 'wpst-admin-script', - 'wpst_admin_data', - $data - ); - */ - } + /* + \wp_localize_script( + 'wpst-admin-script', + 'wpst_admin_data', + $data + ); + */ + } } diff --git a/includes/class-core.php b/includes/class-core.php index 56d352f..3b4cb75 100644 --- a/includes/class-core.php +++ b/includes/class-core.php @@ -12,39 +12,39 @@ namespace WPALLSTARS\PluginStarterTemplate; */ class Core { - /** - * Plugin version - * - * @var string - */ - private $version; + /** + * Plugin version + * + * @var string + */ + private $version; - /** - * Constructor - * - * @param string $version Plugin version. - */ - public function __construct( $version = '' ) { - // Initialize hooks. - $this->version = $version; - } + /** + * Constructor + * + * @param string $version Plugin version. + */ + public function __construct( $version = '' ) { + // Initialize hooks. + $this->version = $version; + } - /** - * Example method to filter content - * - * @param string $content The content to filter. - * @return string The filtered content. - */ - public function filter_content( $content ) { - return $content; - } + /** + * Example method to filter content + * + * @param string $content The content to filter. + * @return string The filtered content. + */ + public function filter_content( $content ) { + return $content; + } - /** - * Get the plugin version - * - * @return string The plugin version. - */ - public function get_plugin_version() { - return $this->version; - } + /** + * Get the plugin version + * + * @return string The plugin version. + */ + public function get_plugin_version() { + return $this->version; + } } diff --git a/includes/class-plugin.php b/includes/class-plugin.php index a358a60..d523381 100644 --- a/includes/class-plugin.php +++ b/includes/class-plugin.php @@ -14,51 +14,51 @@ use WPALLSTARS\PluginStarterTemplate\Admin\Admin; */ class Plugin { - /** - * Core instance - * - * @var Core - */ - private $core; + /** + * Core instance + * + * @var Core + */ + private $core; - /** - * Admin instance - * - * @var Admin - */ - private $admin; + /** + * Admin instance + * + * @var Admin + */ + private $admin; - /** - * Plugin file - * - * @var string - */ - private $plugin_file; + /** + * Plugin file + * + * @var string + */ + private $plugin_file; - /** - * Plugin version - * - * @var string - */ - private $version; + /** + * Plugin version + * + * @var string + */ + private $version; - /** - * Constructor - * - * @param string $plugin_file Main plugin file path. - * @param string $version Plugin version. - */ - public function __construct( $plugin_file, $version ) { - $this->plugin_file = $plugin_file; - $this->version = $version; - $this->core = new Core( $version ); - $this->admin = new Admin( $this->core ); - } + /** + * Constructor + * + * @param string $plugin_file Main plugin file path. + * @param string $version Plugin version. + */ + public function __construct( $plugin_file, $version ) { + $this->plugin_file = $plugin_file; + $this->version = $version; + $this->core = new Core( $version ); + $this->admin = new Admin( $this->core ); + } - /** - * Initialize the plugin - */ - public function init() { - // Initialization logic goes here. - } + /** + * Initialize the plugin + */ + public function init() { + // Initialization logic goes here. + } } diff --git a/phpcs.xml b/phpcs.xml index 2852384..f04ad33 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -12,7 +12,6 @@ */tests/* libs/ - diff --git a/wp-plugin-starter-template.php b/wp-plugin-starter-template.php index 319f0d3..680cebf 100644 --- a/wp-plugin-starter-template.php +++ b/wp-plugin-starter-template.php @@ -28,7 +28,7 @@ // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { - die; + die; } // Load the main plugin class.