Resolved conflicts: - package.json: Use version 0.1.15 from main - wp-plugin-starter-template.php: Use version 0.1.15, keep Plugin class usage - AGENTS.md: Merge both versions, keep CI/CD content - .wiki/Architecture-Overview.md: Use .agents/ directory structure - wiki/* files: Delete (moved to .wiki/) - .agents/error-checking-feedback-loops.md: Keep from feature branch Also includes: - Renamed .ai-workflows/ to .agents/ - Renamed .ai-assistant.md to AGENTS.md - Updated version to 0.1.15
81 lines
2.7 KiB
PHP
81 lines
2.7 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: WordPress Plugin Starter Template
|
|
* Plugin URI: https://www.wpallstars.com
|
|
* Description: A comprehensive starter template for WordPress plugins with best practices for AI-assisted development.
|
|
* Version: 0.1.15
|
|
* Author: Your Name & The WPALLSTARS Team
|
|
* Author URI: https://www.wpallstars.com
|
|
* License: GPL-2.0+
|
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
|
* Text Domain: wp-plugin-starter-template
|
|
* Domain Path: /languages
|
|
* GitHub Plugin URI: wpallstars/wp-plugin-starter-template-for-ai-coding
|
|
* GitHub Branch: main
|
|
* Primary Branch: main
|
|
* Release Branch: main
|
|
* Release Asset: true
|
|
* Requires at least: 5.0
|
|
* Requires PHP: 7.4
|
|
* Update URI: https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding
|
|
*
|
|
* Gitea Plugin URI: https://gitea.wpallstars.com/wpallstars/wp-plugin-starter-template-for-ai-coding
|
|
* Gitea Branch: main
|
|
* Gitea Languages: languages
|
|
*
|
|
* @package WPALLSTARS\PluginStarterTemplate
|
|
*/
|
|
|
|
// If this file is called directly, abort.
|
|
if ( ! defined( 'WPINC' ) ) {
|
|
die;
|
|
}
|
|
|
|
// Define plugin constants.
|
|
define( 'WP_PLUGIN_STARTER_TEMPLATE_FILE', __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_VERSION', '0.1.15' );
|
|
|
|
// Use namespace imports instead of require_once.
|
|
use WPALLSTARS\PluginStarterTemplate\Plugin;
|
|
|
|
// Register autoloader for plugin classes.
|
|
spl_autoload_register(
|
|
function ( $className ) {
|
|
// Plugin namespace prefix.
|
|
$prefix = 'WPALLSTARS\\PluginStarterTemplate\\';
|
|
|
|
// Check if the class uses our namespace.
|
|
$len = strlen( $prefix );
|
|
if ( strncmp( $prefix, $className, $len ) !== 0 ) {
|
|
return;
|
|
}
|
|
|
|
// Get the relative class name.
|
|
$relative_class = substr( $className, $len );
|
|
|
|
// Convert namespace to path.
|
|
$file = WP_PLUGIN_STARTER_TEMPLATE_PATH . 'includes/' . str_replace( '\\', '/', $relative_class ) . '.php';
|
|
|
|
// Convert class name format to file name format.
|
|
$file = str_replace( 'class-', '', $file );
|
|
$file = preg_replace( '/([a-z])([A-Z])/', '$1-$2', $file );
|
|
$file = strtolower( $file );
|
|
|
|
// If the file exists, require it.
|
|
if ( file_exists( $file ) ) {
|
|
require_once $file;
|
|
}
|
|
}
|
|
);
|
|
|
|
// Plugin is multisite compatible - see .wiki/Testing-Framework.md for testing instructions.
|
|
// For multisite-specific functionality, see the includes/Multisite directory.
|
|
|
|
// Initialize the plugin and store the instance in a global variable.
|
|
$wpst_plugin = new Plugin( __FILE__, WP_PLUGIN_STARTER_TEMPLATE_VERSION );
|
|
|
|
// Initialize the plugin.
|
|
$wpst_plugin->init();
|