Compare commits

..
2 Commits
Author SHA1 Message Date
marcus 40ebbce1cc Improve code quality to move from B to A grade
Release - Build and publish plugin releases / Build and Release (push) Canceled after 0s
- Added proper type declarations to all properties and methods
- Fixed inconsistent variable naming (camelCase to snake_case)
- Improved path handling in admin class
- Added textdomain loading functionality
- Removed unused phpcs:ignore comment
- Implemented proper return type declarations
2025-04-21 16:52:56 +01:00
marcus af11f827c4 Update README.md and .ai-assistant.md with latest version info
Release - Build and publish plugin releases / Build and Release (push) Canceled after 0s
- Added 0.1.11 and 0.1.12 changelog entries to README.md
- Updated version number in .ai-assistant.md
2025-04-21 16:48:09 +01:00
5 changed files with 50 additions and 17 deletions

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ This workspace may contain multiple repository folders. Always focus ONLY on the
* **Plugin Slug**: wp-plugin-starter-template
* **Text Domain**: wp-plugin-starter-template
* **Namespace**: WPALLSTARS\PluginStarterTemplate
* **Version**: 0.1.10
* **Version**: 0.1.12
* **Requires WordPress**: 5.0+
* **Requires PHP**: 7.0+
* **License**: GPL-2.0+
+18
View File
@@ -478,6 +478,24 @@ For more information on Git Updater integration, see the [Git Updater Required H
## Changelog
### 0.1.12
* Fixed: WordPress mocking in unit tests
* Added: Proper mocking for WordPress functions in tests
* Improved: Code quality tool configurations
* Added: Detailed code quality checks workflow documentation
* Updated: Documentation for better workflow efficiency
### 0.1.11
* Improved: Code quality with comprehensive fixes
* Fixed: Indentation issues in PHP files
* Updated: CSS formatting with modern notation
* Fixed: JavaScript issues with proper global variables
* Improved: Security by using filter_input() instead of direct superglobal access
* Standardized: Naming conventions across the codebase
* Fixed: Documentation and comments for better clarity
### 0.1.10
* Fixed: Formatting issues in markdown files for better code quality
+6 -7
View File
@@ -19,7 +19,7 @@ class Admin {
*
* @var Core
*/
private $core;
private Core $core;
/**
* Constructor.
@@ -46,7 +46,6 @@ class Admin {
*
* @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
*/
public function enqueue_admin_assets(): void {
@@ -71,22 +70,22 @@ class Admin {
// @phpcs:enable
// Get the plugin version.
$pluginVersion = $this->core->get_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',
plugin_dir_url( dirname( __DIR__ ) ) . 'admin/css/admin-styles.css',
array(), // Dependencies.
$pluginVersion // Version.
$plugin_version // Version.
);
// Enqueue admin scripts.
\wp_enqueue_script(
'wpst-admin-script',
\plugin_dir_url( __FILE__ ) . '../../admin/js/admin-scripts.js',
plugin_dir_url( dirname( __DIR__ ) ) . 'admin/js/admin-scripts.js',
array( 'jquery' ),
$pluginVersion, // Version.
$plugin_version, // Version.
true
);
+4 -4
View File
@@ -17,14 +17,14 @@ class Core {
*
* @var string
*/
private $version;
private string $version;
/**
* Constructor
*
* @param string $version Plugin version.
*/
public function __construct( $version = '' ) {
public function __construct( string $version = '' ) {
// Initialize hooks.
$this->version = $version;
}
@@ -35,7 +35,7 @@ class Core {
* @param string $content The content to filter.
* @return string The filtered content.
*/
public function filter_content( $content ) {
public function filter_content( string $content ): string {
return $content;
}
@@ -44,7 +44,7 @@ class Core {
*
* @return string The plugin version.
*/
public function get_plugin_version() {
public function get_plugin_version(): string {
return $this->version;
}
}
+21 -5
View File
@@ -19,14 +19,14 @@ class Plugin {
*
* @var Core
*/
private $core;
private Core $core;
/**
* Admin instance
*
* @var Admin
*/
private $admin;
private Admin $admin;
/**
* Plugin file path
@@ -40,7 +40,7 @@ class Plugin {
*
* @var string
*/
private $version;
private string $version;
/**
* Constructor
@@ -58,7 +58,23 @@ class Plugin {
/**
* Initialize the plugin
*/
public function init() {
// Initialization logic goes here.
public function init(): void {
// Register hooks and filters.
add_action('plugins_loaded', array($this, 'load_textdomain'));
// Initialize any other plugin functionality.
}
/**
* Load plugin textdomain.
*
* @return void
*/
public function load_textdomain(): void {
load_plugin_textdomain(
'wp-plugin-starter-template',
false,
dirname(plugin_basename($this->pluginFile)) . '/languages/'
);
}
}