really-simple-ssl
Last commit date
assets
1 month ago
core
1 month ago
languages
1 month ago
lets-encrypt
1 month ago
lib
1 month ago
mailer
1 month ago
modal
1 month ago
placeholders
1 month ago
progress
1 month ago
security
1 month ago
settings
1 month ago
testssl
1 month ago
upgrade
1 month ago
.wp-env.json
1 month ago
SECURITY.md
1 month ago
class-admin.php
1 month ago
class-cache.php
1 month ago
class-certificate.php
1 month ago
class-front-end.php
1 month ago
class-installer.php
1 month ago
class-mixed-content-fixer.php
1 month ago
class-multisite.php
1 month ago
class-server.php
1 month ago
class-site-health.php
1 month ago
class-wp-cli.php
1 month ago
compatibility.php
1 month ago
force-deactivate.txt
1 month ago
functions.php
1 month ago
index.php
1 month ago
readme.txt
1 month ago
rector.php
1 month ago
rlrsssl-really-simple-ssl.php
1 month ago
rsssl-auto-loader.php
1 month ago
sbom.json.gz
1 month ago
ssl-test-page.php
1 month ago
system-status.php
1 month ago
uninstall.php
1 month ago
upgrade.php
1 month ago
rsssl-auto-loader.php
56 lines
| 1 | <?php |
| 2 | /** |
| 3 | * This file manages to autoload of the classes in the pro folder. |
| 4 | * |
| 5 | * @package REALLY_SIMPLE_SSL |
| 6 | */ |
| 7 | spl_autoload_register( |
| 8 | static function ($the_class) { |
| 9 | // project-specific namespace prefix. |
| 10 | $prefix = 'RSSSL\\'; |
| 11 | |
| 12 | // base directory for the namespace prefix. |
| 13 | $base_dir = rsssl_path; |
| 14 | |
| 15 | // does the class use the namespace prefix? |
| 16 | $len = strlen($prefix); |
| 17 | if (0 !== strncmp($prefix, $the_class, $len)) { |
| 18 | return; |
| 19 | } |
| 20 | // get the relative class name. |
| 21 | $relative_class = substr($the_class, $len); |
| 22 | $relative_class = strtolower($relative_class); |
| 23 | // converting backslashes to slashes, underscores to hyphens. |
| 24 | $relative_class = str_replace(array('\\', '_', 'dynamictables'), array( |
| 25 | '/', |
| 26 | '-', |
| 27 | 'dynamic-tables' |
| 28 | ), $relative_class); // New Line: handle the case of 'dynamic tables' to 'dynamic-tables' This is placeholder fix for now. |
| 29 | |
| 30 | $file = $base_dir . $relative_class; // old way to form filename. |
| 31 | // $file = preg_replace('{/([^/]+)$}', '/class-$1.php', $file); // new way to form filename. |
| 32 | |
| 33 | if (strpos($relative_class, 'trait') !== false) { |
| 34 | $file = preg_replace('{/([^/]+)$}', '/trait-$1.php', $file); |
| 35 | } elseif (strpos($relative_class, 'interface') !== false) { |
| 36 | $file = preg_replace('{/([^/]+)$}', '/interface-$1.php', $file); |
| 37 | } else { |
| 38 | $file = preg_replace('{/([^/]+)$}', '/class-$1.php', $file); |
| 39 | } |
| 40 | |
| 41 | // if(str_contains(strtolower($the_class), 'trait')) { |
| 42 | // var_dump(file_exists($file)); |
| 43 | // var_dump($file); |
| 44 | // die('now'); |
| 45 | // } |
| 46 | if (class_exists($the_class)) { |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | // if the file exists, require it. |
| 51 | if (file_exists($file)) { |
| 52 | require_once $file; |
| 53 | } |
| 54 | } |
| 55 | ); |
| 56 |