2020-05-29 16:25:17 +00:00
|
|
|
<?php
|
|
|
|
|
2021-06-08 09:52:11 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-05-29 16:25:17 +00:00
|
|
|
namespace Config;
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2021-04-02 17:20:02 +00:00
|
|
|
use CodeIgniter\Config\AutoloadConfig;
|
2020-05-27 18:46:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* AUTO-LOADER
|
|
|
|
* -------------------------------------------------------------------
|
2021-04-02 17:20:02 +00:00
|
|
|
*
|
2020-05-27 18:46:16 +02:00
|
|
|
* This file defines the namespaces and class maps so the Autoloader
|
|
|
|
* can find the files as needed.
|
2021-04-02 17:20:02 +00:00
|
|
|
*
|
|
|
|
* NOTE: If you use an identical key in $psr4 or $classmap, then
|
|
|
|
* the values in this file will overwrite the framework's values.
|
2023-09-09 10:52:01 +00:00
|
|
|
*
|
|
|
|
* @immutable
|
2020-05-27 18:46:16 +02:00
|
|
|
*/
|
2021-04-02 17:20:02 +00:00
|
|
|
class Autoload extends AutoloadConfig
|
2020-05-27 18:46:16 +02:00
|
|
|
{
|
2021-04-02 17:20:02 +00:00
|
|
|
/**
|
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* Namespaces
|
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* This maps the locations of any namespaces in your application to
|
|
|
|
* their location on the file system. These are used by the autoloader
|
|
|
|
* to locate files the first time they have been instantiated.
|
|
|
|
*
|
2024-04-26 09:26:22 +00:00
|
|
|
* The 'Config' (APPPATH . 'Config') and 'CodeIgniter' (SYSTEMPATH) are
|
|
|
|
* already mapped for you.
|
|
|
|
*
|
|
|
|
* You may change the name of the 'App' namespace if you wish,
|
2021-04-02 17:20:02 +00:00
|
|
|
* but this should be done prior to creating any namespaced classes,
|
|
|
|
* else you will need to modify all of those classes for this to work.
|
|
|
|
*
|
2024-01-01 22:54:59 +00:00
|
|
|
* @var array<string, list<string>|string>
|
2021-04-02 17:20:02 +00:00
|
|
|
*/
|
2020-06-10 15:00:12 +00:00
|
|
|
public $psr4 = [
|
2023-06-12 14:47:38 +00:00
|
|
|
APP_NAMESPACE => APPPATH,
|
|
|
|
'Modules' => ROOTPATH . 'modules/',
|
|
|
|
'Modules\Admin' => ROOTPATH . 'modules/Admin/',
|
|
|
|
'Modules\Analytics' => ROOTPATH . 'modules/Analytics/',
|
2023-06-21 16:17:11 +00:00
|
|
|
'Modules\Api\Rest\V1' => ROOTPATH . 'modules/Api/Rest/V1',
|
|
|
|
'Modules\Auth' => ROOTPATH . 'modules/Auth/',
|
2023-06-12 14:47:38 +00:00
|
|
|
'Modules\Fediverse' => ROOTPATH . 'modules/Fediverse/',
|
2023-06-21 16:17:11 +00:00
|
|
|
'Modules\Install' => ROOTPATH . 'modules/Install/',
|
2023-06-12 14:47:38 +00:00
|
|
|
'Modules\Media' => ROOTPATH . 'modules/Media/',
|
2023-06-21 16:17:11 +00:00
|
|
|
'Modules\MediaClipper' => ROOTPATH . 'modules/MediaClipper/',
|
2024-04-24 14:47:05 +00:00
|
|
|
'Modules\Platforms' => ROOTPATH . 'modules/Platforms/',
|
2024-04-28 17:14:45 +00:00
|
|
|
'Modules\Plugins' => ROOTPATH . 'modules/Plugins/',
|
2023-06-21 16:17:11 +00:00
|
|
|
'Modules\PodcastImport' => ROOTPATH . 'modules/PodcastImport/',
|
2022-09-28 15:02:09 +00:00
|
|
|
'Modules\PremiumPodcasts' => ROOTPATH . 'modules/PremiumPodcasts/',
|
2023-06-21 16:17:11 +00:00
|
|
|
'Modules\Update' => ROOTPATH . 'modules/Update/',
|
|
|
|
'Modules\WebSub' => ROOTPATH . 'modules/WebSub/',
|
|
|
|
'Themes' => ROOTPATH . 'themes',
|
2023-06-12 14:47:38 +00:00
|
|
|
'ViewComponents' => APPPATH . 'Libraries/ViewComponents/',
|
|
|
|
'ViewThemes' => APPPATH . 'Libraries/ViewThemes/',
|
|
|
|
'Vite' => APPPATH . 'Libraries/Vite/',
|
2020-06-10 15:00:12 +00:00
|
|
|
];
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2020-06-10 15:00:12 +00:00
|
|
|
/**
|
2021-04-02 17:20:02 +00:00
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* The class map provides a map of class names and their exact
|
|
|
|
* location on the drive. Classes loaded in this manner will have
|
|
|
|
* slightly faster performance because they will not have to be
|
|
|
|
* searched for within one or more directories as they would if they
|
|
|
|
* were being autoloaded through a namespace.
|
2020-06-10 15:00:12 +00:00
|
|
|
*
|
2021-04-02 17:20:02 +00:00
|
|
|
* Prototype:
|
|
|
|
*
|
|
|
|
* $classmap = [
|
|
|
|
* 'MyClass' => '/path/to/class/file.php'
|
|
|
|
* ];
|
|
|
|
*
|
|
|
|
* @var array<string, string>
|
2020-06-10 15:00:12 +00:00
|
|
|
*/
|
2021-04-02 17:20:02 +00:00
|
|
|
public $classmap = [];
|
2021-05-25 10:40:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* Files
|
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* The files array provides a list of paths to __non-class__ files
|
|
|
|
* that will be autoloaded. This can be useful for bootstrap operations
|
|
|
|
* or for loading functions.
|
|
|
|
*
|
|
|
|
* Prototype:
|
2023-07-06 15:56:05 +00:00
|
|
|
*
|
2021-05-25 10:40:22 +00:00
|
|
|
* $files = [
|
|
|
|
* '/path/to/my/file.php',
|
|
|
|
* ];
|
2023-07-06 15:56:05 +00:00
|
|
|
*
|
2024-01-01 22:54:59 +00:00
|
|
|
* @var list<string>
|
2021-05-25 10:40:22 +00:00
|
|
|
*/
|
2021-08-19 14:00:14 +00:00
|
|
|
public $files = [APPPATH . 'Libraries/ViewComponents/Helpers/view_components_helper.php'];
|
2023-07-06 15:56:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* Helpers
|
|
|
|
* -------------------------------------------------------------------
|
|
|
|
* Prototype:
|
|
|
|
* $helpers = [
|
|
|
|
* 'form',
|
|
|
|
* ];
|
|
|
|
*
|
2024-01-01 22:54:59 +00:00
|
|
|
* @var list<string>
|
2023-07-06 15:56:05 +00:00
|
|
|
*/
|
2024-05-02 15:32:27 +00:00
|
|
|
public $helpers = ['auth', 'setting', 'icons', 'plugins'];
|
2024-05-01 14:48:05 +00:00
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
// load plugins namespaces
|
2024-05-05 13:10:59 +00:00
|
|
|
$pluginsPaths = glob(PLUGINS_PATH . '*/*', GLOB_ONLYDIR | GLOB_NOSORT);
|
2024-05-01 14:48:05 +00:00
|
|
|
|
|
|
|
if (! $pluginsPaths) {
|
|
|
|
$pluginsPaths = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($pluginsPaths as $pluginPath) {
|
2024-05-05 13:10:59 +00:00
|
|
|
$vendor = basename(dirname($pluginPath));
|
|
|
|
$package = basename($pluginPath);
|
|
|
|
|
|
|
|
// validate plugin pattern
|
|
|
|
if (preg_match('~' . PLUGINS_KEY_PATTERN . '~', $vendor . '/' . $package) === false) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$pluginNamespace = 'Plugins\\' . str_replace(
|
|
|
|
' ',
|
|
|
|
'',
|
|
|
|
ucwords(str_replace(['-', '_', '.'], ' ', $vendor . '\\' . $package))
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->psr4[$pluginNamespace] = $pluginPath;
|
2024-05-01 14:48:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
parent::__construct();
|
|
|
|
}
|
2020-05-27 18:46:16 +02:00
|
|
|
}
|