| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
Plugin Name: Unique Headers |
| 5 |
Plugin URI: https://geek.hellyer.kiwi/plugins/unique-headers/ |
| 6 |
Description: Unique Headers |
| 7 |
Version: 2.1.1 |
| 8 |
Author: Ryan Hellyer |
| 9 |
Author URI: https://geek.hellyer.kiwi/ |
| 10 |
License: GPLv2 or later |
| 11 |
|
| 12 |
------------------------------------------------------------------------ |
| 13 |
Copyright Ryan Hellyer |
| 14 |
|
| 15 |
This program is free software; you can redistribute it and/or modify |
| 16 |
it under the terms of the GNU General Public License as published by |
| 17 |
the Free Software Foundation; either version 2 of the License, or |
| 18 |
(at your option) any later version. |
| 19 |
|
| 20 |
This program is distributed in the hope that it will be useful, |
| 21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
GNU General Public License for more details. |
| 24 |
|
| 25 |
You should have received a copy of the GNU General Public License |
| 26 |
along with this program; if not, write to the Free Software |
| 27 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 28 |
|
| 29 |
*/ |
| 30 |
|
| 31 |
declare(strict_types=1); |
| 32 |
|
| 33 |
use RyanHellyer\UniqueHeaders\Vendor\Inpsyde\Modularity\Package; |
| 34 |
use RyanHellyer\UniqueHeaders\Vendor\Inpsyde\Modularity\Properties\PluginProperties; |
| 35 |
use RyanHellyer\UniqueHeaders\AdminModule; |
| 36 |
use RyanHellyer\UniqueHeaders\AttachmentHelper; |
| 37 |
use RyanHellyer\UniqueHeaders\DisplayModule; |
| 38 |
|
| 39 |
$autoloader = __DIR__ . '/vendor/autoload.php'; |
| 40 |
if (! file_exists($autoloader)) { |
| 41 |
return; |
| 42 |
} |
| 43 |
require_once $autoloader; |
| 44 |
|
| 45 |
// Fallback: if the Composer autoload runtime is missing (e.g. stripped from |
| 46 |
// a production zip), register PSR-4 mappings for scoped dependencies directly. |
| 47 |
if (! interface_exists('RyanHellyer\\UniqueHeaders\\Vendor\\Inpsyde\\Modularity\\Module\\Module')) { |
| 48 |
spl_autoload_register(static function (string $class): void { |
| 49 |
$prefixes = [ |
| 50 |
'RyanHellyer\\UniqueHeaders\\Vendor\\Psr\\Container\\' |
| 51 |
=> __DIR__ . '/vendor/psr/container/src/', |
| 52 |
'RyanHellyer\\UniqueHeaders\\Vendor\\Inpsyde\\Modularity\\' |
| 53 |
=> __DIR__ . '/vendor/inpsyde/modularity/src/', |
| 54 |
'RyanHellyer\\UniqueHeaders\\' |
| 55 |
=> __DIR__ . '/src/', |
| 56 |
]; |
| 57 |
foreach ($prefixes as $prefix => $baseDir) { |
| 58 |
$len = strlen($prefix); |
| 59 |
if (strncmp($prefix, $class, $len) !== 0) { |
| 60 |
continue; |
| 61 |
} |
| 62 |
$file = $baseDir . str_replace('\\', '/', substr($class, $len)) . '.php'; |
| 63 |
if (file_exists($file)) { |
| 64 |
require $file; |
| 65 |
return; |
| 66 |
} |
| 67 |
} |
| 68 |
}); |
| 69 |
} |
| 70 |
|
| 71 |
$helper = new AttachmentHelper(); |
| 72 |
|
| 73 |
$properties = PluginProperties::new(__FILE__); |
| 74 |
$package = Package::new($properties); |
| 75 |
$package->addModule(new AdminModule($helper)); |
| 76 |
$package->addModule(new DisplayModule($helper)); |
| 77 |
$package->boot(); |
| 78 |
|