summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/classes/autoload.inc.php
diff options
context:
space:
mode:
authorDoug Wollison <doug@wollison.net>2015-11-21 12:51:32 -0500
committerStephen Beaver <sbeaver@netgate.com>2015-11-23 07:54:20 -0500
commit02cc81eff934bd57edd809b14fae445e5c73cc65 (patch)
treefe1827df45c5f6958e00242a14e72e58b959199e /src/usr/local/www/classes/autoload.inc.php
parentf4001737d1b0afe09e9a7f806f5a9d81855fe105 (diff)
downloadpfsense-02cc81eff934bd57edd809b14fae445e5c73cc65.zip
pfsense-02cc81eff934bd57edd809b14fae445e5c73cc65.tar.gz
Added use of class autoloading (GUI stuff only)
Any GUI script that loads the guiconfig.inc file will have access to the autoloader.
Diffstat (limited to 'src/usr/local/www/classes/autoload.inc.php')
-rw-r--r--src/usr/local/www/classes/autoload.inc.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/usr/local/www/classes/autoload.inc.php b/src/usr/local/www/classes/autoload.inc.php
new file mode 100644
index 0000000..b036eb4
--- /dev/null
+++ b/src/usr/local/www/classes/autoload.inc.php
@@ -0,0 +1,12 @@
+<?php
+function pfsense_www_class_autoloader($classname) {
+ // Convert classname to match filename conventions
+ $filename = str_replace('_', '/', $classname);
+
+ // Build the full path, load it if it exists
+ $filepath = "classes/$filename.class.php";
+ if (file_exists($filepath)) {
+ require_once($filepath);
+ }
+}
+spl_autoload_register('pfsense_www_class_autoloader'); \ No newline at end of file
OpenPOWER on IntegriCloud