summaryrefslogtreecommitdiffstats
path: root/application/libraries/Customautoloader.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-10-03 01:53:27 +0200
committerFlorian Pritz <bluewind@xinu.at>2014-10-03 14:22:34 +0200
commitc3b75b7edba5c56cd4dab24a323167b23814c6bc (patch)
tree7108009090ea773c7024fde57dd6e0be0396a206 /application/libraries/Customautoloader.php
parent9b0b9a0e6082b3375ebdadc651c971671c922ebc (diff)
Rework image manipulation class
This is the first of hopefully more classes using namespaces and proper classes that can be used as objects rather than CI's singleton approach. The namespace is mainly used to gain nice autoloading capabilities and it's not really yet used for separation. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/libraries/Customautoloader.php')
-rw-r--r--application/libraries/Customautoloader.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/application/libraries/Customautoloader.php b/application/libraries/Customautoloader.php
new file mode 100644
index 000000000..1904977d7
--- /dev/null
+++ b/application/libraries/Customautoloader.php
@@ -0,0 +1,26 @@
+<?php
+/*
+ * Copyright 2014 Florian "Bluewind" Pritz <bluewind@server-speed.net>
+ *
+ * Licensed under AGPLv3
+ * (see COPYING for full license text)
+ *
+ */
+
+// Original source: http://stackoverflow.com/a/9526005/953022
+class CustomAutoloader{
+ public function __construct()
+ {
+ spl_autoload_register(array($this, 'loader'));
+ }
+
+ public function loader($className)
+ {
+ $path = APPPATH.str_replace('\\', DIRECTORY_SEPARATOR, $className).'.php';
+ if (file_exists($path)) {
+ require $path;
+ return;
+ }
+ }
+}
+?>