aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2016-10-17 23:26:48 +0200
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2016-10-18 18:11:41 +0200
commit745515b11f438d3658203aaaaf151c72e30d5e7c (patch)
treeed43b874f5519cf06a05a703e144fd6acad06d4b /boot.php
parent17091bd38c4e4e5d8b1812dd1d9efeffe0046d02 (diff)
downloadvolse-hubzilla-745515b11f438d3658203aaaaf151c72e30d5e7c.tar.gz
volse-hubzilla-745515b11f438d3658203aaaaf151c72e30d5e7c.tar.bz2
volse-hubzilla-745515b11f438d3658203aaaaf151c72e30d5e7c.zip
[FEATURE] Add config and use composer autoloader.
We use composer already to install SabreDAV. Include config composer.(json|lock) to install and manage more dependencies in future. Also provide PSR-4 autoloading for our namespaced classes, e.g. "Zotlabs\". To regenerate autoloader maps use: $ composer install --optimize-autoloader --no-dev We could also remove the whole vendor/ folder from our repository, but that would need changes in deployment and how to install hubs and needs more discussion first.
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php48
1 files changed, 9 insertions, 39 deletions
diff --git a/boot.php b/boot.php
index 6f166fc51..ad7c1936d 100755
--- a/boot.php
+++ b/boot.php
@@ -27,6 +27,9 @@
* documented.
*/
+// composer autoloader for all namespaced Classes
+require_once('vendor/autoload.php');
+
require_once('include/config.php');
require_once('include/network.php');
require_once('include/plugin.php');
@@ -695,44 +698,14 @@ function startup() {
}
-class ZotlabsAutoloader {
- static public function loader($className) {
- $debug = false;
- $filename = str_replace('\\', '/', $className) . ".php";
- if(file_exists($filename)) {
- include($filename);
- if (class_exists($className)) {
- return TRUE;
- }
- }
- $arr = explode('\\',$className);
- if($arr && count($arr) > 1) {
- if(! $arr[0])
- $arr = array_shift($arr);
- $filename = 'addon/' . lcfirst($arr[0]) . '/' . $arr[1] . ((count($arr) === 2) ? '.php' : '/' . $arr[2] . ".php");
- if(file_exists($filename)) {
- include($filename);
- if (class_exists($className)) {
- return TRUE;
- }
- }
- }
-
- return FALSE;
- }
-}
-
-
/**
* class miniApp
*
* this is a transient structure which is needed to convert the $a->config settings
* from older (existing) htconfig files which used a global App ($a) into the updated App structure
- * which is now static (although currently constructed at startup). We are only converting
- * 'system' config settings.
+ * which is now static (although currently constructed at startup). We are only converting
+ * 'system' config settings.
*/
-
-
class miniApp {
public $config = array('system' => array());
@@ -982,24 +955,21 @@ class App {
* register template engines
*/
- spl_autoload_register('ZotlabsAutoloader::loader');
-
self::$meta= new Zotlabs\Web\HttpMeta();
// create an instance of the smarty template engine so we can register it.
$smarty = new Zotlabs\Render\SmartyTemplate();
-
+ /// @todo validate if this is still the desired behavior
+ self::register_template_engine(get_class($smarty));
+/*
$dc = get_declared_classes();
-
foreach ($dc as $k) {
if(in_array('Zotlabs\\Render\\TemplateEngine', class_implements($k))) {
self::register_template_engine($k);
}
}
-
-
-
+*/
}
public static function get_baseurl($ssl = false) {