- 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>
112 lines
2.9 KiB
PHP
112 lines
2.9 KiB
PHP
<?php
|
|
/**
|
|
* Plugin core bootstrap class.
|
|
*
|
|
* @package BreznFlow
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
namespace BreznFlow;
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Singleton core class that loads dependencies and registers hooks.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
class Core {
|
|
/**
|
|
* Singleton instance.
|
|
*
|
|
* @var Core|null
|
|
*/
|
|
private static ?Core $instance = null;
|
|
|
|
/**
|
|
* Returns the singleton instance.
|
|
*
|
|
* @since 1.0.0
|
|
* @return self
|
|
*/
|
|
public static function instance(): self {
|
|
if ( null === self::$instance ) {
|
|
self::$instance = new self();
|
|
}
|
|
return self::$instance;
|
|
}
|
|
|
|
/**
|
|
* Initializes the plugin by loading dependencies and hooks.
|
|
*
|
|
* @since 1.0.0
|
|
* @return void
|
|
*/
|
|
public function init(): void {
|
|
$this->load_dependencies();
|
|
$this->register_hooks();
|
|
}
|
|
|
|
/**
|
|
* Loads all required class files.
|
|
*
|
|
* @since 1.0.0
|
|
* @return void
|
|
*/
|
|
private function load_dependencies(): void {
|
|
// Security.
|
|
require_once BREZNFLOW_DIR . 'includes/Security/MaskingRules.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Security/WorkflowValidator.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Security/WorkflowSanitizer.php';
|
|
|
|
// Post type.
|
|
require_once BREZNFLOW_DIR . 'includes/PostType.php';
|
|
|
|
// Features.
|
|
require_once BREZNFLOW_DIR . 'includes/Features/NodeTypeRegistry.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Features/NodeCategorizer.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Features/InfoBoxBuilder.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Features/ViewCounter.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Features/RelatedWorkflows.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Features/ThemeRegistry.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Features/ThemeImporter.php';
|
|
|
|
// Shortcode, download & embed.
|
|
require_once BREZNFLOW_DIR . 'includes/Shortcode.php';
|
|
require_once BREZNFLOW_DIR . 'includes/DownloadHandler.php';
|
|
require_once BREZNFLOW_DIR . 'includes/EmbedHandler.php';
|
|
|
|
// SettingsPage is loaded always because Shortcode::render() calls SettingsPage::get_defaults() on the frontend.
|
|
require_once BREZNFLOW_DIR . 'includes/Admin/SettingsPage.php';
|
|
|
|
// Admin-only classes.
|
|
if ( is_admin() ) {
|
|
require_once BREZNFLOW_DIR . 'includes/Admin/AdminMenu.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Admin/WizardPage.php';
|
|
require_once BREZNFLOW_DIR . 'includes/Admin/WorkflowListTable.php';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Instantiates components and registers their hooks.
|
|
*
|
|
* @since 1.0.0
|
|
* @return void
|
|
*/
|
|
private function register_hooks(): void {
|
|
( new PostType() )->register();
|
|
( new Shortcode() )->register();
|
|
( new DownloadHandler() )->register();
|
|
( new EmbedHandler() )->register();
|
|
( new Features\ViewCounter() )->register();
|
|
( new Features\RelatedWorkflows() )->register();
|
|
|
|
if ( is_admin() ) {
|
|
( new Admin\AdminMenu() )->register();
|
|
( new Admin\SettingsPage() )->register();
|
|
( new Admin\WizardPage() )->register();
|
|
}
|
|
}
|
|
}
|