Fix code quality issues and update PHPStan configuration
This commit is contained in:
@@ -60,7 +60,7 @@ class Plugin {
|
|||||||
*/
|
*/
|
||||||
public function init(): void {
|
public function init(): void {
|
||||||
// Register hooks and filters.
|
// Register hooks and filters.
|
||||||
add_action('plugins_loaded', array($this, 'load_textdomain'));
|
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
||||||
|
|
||||||
// Initialize any other plugin functionality.
|
// Initialize any other plugin functionality.
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,25 @@ class Plugin {
|
|||||||
load_plugin_textdomain(
|
load_plugin_textdomain(
|
||||||
'wp-plugin-starter-template',
|
'wp-plugin-starter-template',
|
||||||
false,
|
false,
|
||||||
dirname(plugin_basename($this->pluginFile)) . '/languages/'
|
dirname( plugin_basename( $this->pluginFile ) ) . '/languages/'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plugin version.
|
||||||
|
*
|
||||||
|
* @return string The plugin version.
|
||||||
|
*/
|
||||||
|
public function get_version(): string {
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the admin instance.
|
||||||
|
*
|
||||||
|
* @return Admin The admin instance.
|
||||||
|
*/
|
||||||
|
public function get_admin(): Admin {
|
||||||
|
return $this->admin;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
* Version: 1.0.0
|
* Version: 1.0.0
|
||||||
* Author: WPALLSTARS
|
* Author: WPALLSTARS
|
||||||
* License: GPL-2.0-or-later
|
* License: GPL-2.0-or-later
|
||||||
|
*
|
||||||
|
* @package WPPluginStarterTemplate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Exit if accessed directly.
|
// Exit if accessed directly.
|
||||||
|
|||||||
@@ -5,7 +5,14 @@ parameters:
|
|||||||
- admin
|
- admin
|
||||||
- wp-plugin-starter-template.php
|
- wp-plugin-starter-template.php
|
||||||
excludePaths:
|
excludePaths:
|
||||||
paths:
|
analyse:
|
||||||
|
- vendor
|
||||||
|
- node_modules
|
||||||
|
- tests
|
||||||
|
- bin
|
||||||
|
- build
|
||||||
|
- dist
|
||||||
|
analyseAndScan:
|
||||||
- vendor
|
- vendor
|
||||||
- node_modules
|
- node_modules
|
||||||
- tests
|
- tests
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define plugin constants
|
// Define plugin constants.
|
||||||
define( 'WP_PLUGIN_STARTER_TEMPLATE_FILE', __FILE__ );
|
define( 'WP_PLUGIN_STARTER_TEMPLATE_FILE', __FILE__ );
|
||||||
define( 'WP_PLUGIN_STARTER_TEMPLATE_PATH', plugin_dir_path( __FILE__ ) );
|
define( 'WP_PLUGIN_STARTER_TEMPLATE_PATH', plugin_dir_path( __FILE__ ) );
|
||||||
define( 'WP_PLUGIN_STARTER_TEMPLATE_URL', plugin_dir_url( __FILE__ ) );
|
define( 'WP_PLUGIN_STARTER_TEMPLATE_URL', plugin_dir_url( __FILE__ ) );
|
||||||
@@ -40,8 +40,8 @@ define( 'WP_PLUGIN_STARTER_TEMPLATE_VERSION', '0.1.13' );
|
|||||||
// Load the main plugin class.
|
// Load the main plugin class.
|
||||||
require_once WP_PLUGIN_STARTER_TEMPLATE_PATH . 'includes/class-plugin.php';
|
require_once WP_PLUGIN_STARTER_TEMPLATE_PATH . 'includes/class-plugin.php';
|
||||||
|
|
||||||
// Plugin is multisite compatible - see .wiki/Testing-Framework.md for testing instructions
|
// Plugin is multisite compatible - see .wiki/Testing-Framework.md for testing instructions.
|
||||||
// For multisite-specific functionality, see the includes/Multisite directory
|
// For multisite-specific functionality, see the includes/Multisite directory.
|
||||||
|
|
||||||
// Initialize the plugin and store the instance in a global variable.
|
// Initialize the plugin and store the instance in a global variable.
|
||||||
$wpst_plugin = new WPALLSTARS\PluginStarterTemplate\Plugin( __FILE__, WP_PLUGIN_STARTER_TEMPLATE_VERSION );
|
$wpst_plugin = new WPALLSTARS\PluginStarterTemplate\Plugin( __FILE__, WP_PLUGIN_STARTER_TEMPLATE_VERSION );
|
||||||
|
|||||||
Reference in New Issue
Block a user