mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-05-13 12:31:35 +08:00
* Initial refactor commit
* ✅ Added build and tests CI/CD
* update: add src for admin settings
* update: incorrect constant names
* update: namespace
* add: accessibility settings
* update: webpack to output files inside a folder
* update: build output folders
* update: removed commented code
* update: npm scripts
* add: webpack config
* add: hooks
* update: move admin setting to the module folder
* update: assets loading logic
* update: add rule to move jsx props to multiline imporving readability
* add: connect modal
* update: hooks import for better readability
* update: replace functions with hooks
* add: connect module
* add: settings and get settings route
* add: hooks and contexts to get settings
* add: hooks
* add: notification component
* add: data api
* add: settings provider and connect settings
* add: husky
* fix: formatting and text-domain
* update: filter names
* fix: hook import
* add: set function for settings
* add: prop-types package
* update: refactor notification component and context
* update: remove filter for authorize url
* update: imports and exports of hooks
* update: plugin settings context filename and relevant imports
---------
Co-authored-by: Ohad <ohad@elementor.com>
59 lines
1.1 KiB
PHP
59 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace EA11y;
|
|
|
|
use EA11y\Classes\Module_Base;
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly
|
|
}
|
|
|
|
final class Manager {
|
|
/**
|
|
* @var Module_Base[]
|
|
*/
|
|
private array $modules = [];
|
|
|
|
public static function get_module_list(): array {
|
|
return [
|
|
'Legacy',
|
|
'Connect',
|
|
'Settings',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @codeCoverageIgnore
|
|
*/
|
|
public function __construct() {
|
|
$modules = self::get_module_list();
|
|
|
|
foreach ( $modules as $module_name ) {
|
|
$class_name = str_replace( '-', ' ', $module_name );
|
|
$class_name = str_replace( ' ', '', ucwords( $class_name ) );
|
|
$class_name = __NAMESPACE__ . '\\Modules\\' . $class_name . '\Module';
|
|
|
|
/** @var Module_Base $class_name */
|
|
if ( $class_name::is_active() ) {
|
|
$this->modules[ $module_name ] = $class_name::instance();
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param string $module_name
|
|
*
|
|
* @return Module_Base|Module_Base[]
|
|
*/
|
|
public function get_modules( string $module_name ) {
|
|
if ( $module_name ) {
|
|
if ( isset( $this->modules[ $module_name ] ) ) {
|
|
return $this->modules[ $module_name ];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
return $this->modules;
|
|
}
|
|
}
|