public static function singleton() { if (!isset(self::$instance)) { $className = __CLASS__; self::$instance = new $className(); } return self::$instance; }
public static function includeAllLibs() { foreach (self::getAll() as $name) { $dir = dir::addon($name, 'vendor'); if (file_exists($dir)) { autoload::addDir($dir); } $dir = dir::addon($name, 'lib'); if (file_exists($dir)) { autoload::addDir($dir); } } }
static function get_file_name($split_name) { list($prefix, $sub_path, $exec_file) = self::ifile_splice($split_name); $prefix_file = null; $file_addr = parent::get_file_name($split_name); if (!preg_grep("/^{$prefix}\$/", self::$core_prefix)) { if (!$file_addr) { $prefix_file = \lib\router::get_repository(); $prefix_file = preg_replace("#\\/[^\\/]+\\/?\$#", '', $prefix_file); if (file_exists(addons . $prefix . '/' . $sub_path . $exec_file)) { $file_addr = addons . $prefix . '/' . $sub_path . $exec_file; } } } return $file_addr; }
ob_implicit_flush(0); mb_internal_encoding('UTF-8'); session_start(); if (version_compare(PHP_VERSION, 5.4) < 0) { echo 'PHP version 5.4 or higher needed!'; exit; } include 'lib' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'dir.php'; if (isset($DYN['root'])) { new dir($DYN['root']); } else { new dir(); } include dir::classes('autoload.php'); autoload::register(); autoload::addDir(dir::classes('utils')); new dyn(); if (dyn::get('setup') == true) { header('Location: install/'); exit; } if (isset($DYN['backend'])) { dyn::add('backend', $DYN['backend']); } else { dyn::add('backend', true); } unset($DYN); include dir::functions('html_stuff.php'); include dir::functions('url_stuff.php'); lang::setDefault(); lang::setLang(dyn::get('lang'));
ob_implicit_flush(0); mb_internal_encoding('UTF-8'); session_start(); if (version_compare(PHP_VERSION, 5.4) < 0) { echo 'PHP 5.4 or higher needed!'; exit; } set_include_path(get_include_path() . PATH_SEPARATOR . 'lib/vendor/phpseclib'); include_once 'Net/SSH2.php'; include_once 'Net/SFTP.php'; define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX); include 'lib/classes/dir.php'; new dir(); include dir::classes('autoload.php'); autoload::register(); autoload::addDir(dir::classes('helper')); new rp(); if (rp::get('setup') == true) { header('Location: install/'); exit; } include dir::functions('html.php'); include dir::functions('convert.php'); lang::setDefault(); lang::setLang(rp::get('lang')); $DB = rp::get('DB'); sql::connect($DB['host'], $DB['user'], $DB['password'], $DB['database']); unset($DB); date_default_timezone_set(rp::get('timezone', 'Europe/Berlin')); new userLogin(); rp::add('user', new user(userLogin::getUser()));
define('SERVER_ROOT', dirname(__FILE__)); define('APP_PATH', SERVER_ROOT . '/app'); define('CONTROLLER_PATH', APP_PATH . '/controllers'); define('MODEL_PATH', APP_PATH . '/models'); define('PLUGIN_PATH', APP_PATH . '/plugins'); define('TEST_PATH', APP_PATH . '/tests'); define('VIEW_PATH', APP_PATH . '/views'); define('PARTIAL_PATH', VIEW_PATH . '/partials'); define('LAYOUT_PATH', VIEW_PATH . '/layouts'); define('SCRIPT_PATH', VIEW_PATH . '/scripts'); define('PUBLIC_PATH', SERVER_ROOT . '/public'); define('VENDOR_PATH', SERVER_ROOT . '/vendor'); define('SYSTEM_PATH', VENDOR_PATH . '/puffin'); define('MUSTACHE_EXT', '.html'); define('ERROR_REPORTING', true); ############################################ require VENDOR_PATH . '/autoload.php'; ############################################ if (ERROR_REPORTING) { ini_set("display_errors", "1"); error_reporting(E_ERROR); } ############################################ session::start(); autoload::init(); view::init('mustache'); $app = app::init_router(); require 'app/app.php'; app::route(); echo app::render(); exit;
<?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 1); include '..' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'dir.php'; new dir(); include_once dir::classes('autoload.php'); autoload::register(); autoload::addDir(dir::classes('utils')); autoload::addDir('lib' . DIRECTORY_SEPARATOR . 'classes'); include dir::functions('html_stuff.php'); include dir::functions('url_stuff.php'); new dyn(); lang::setDefault(); lang::setLang(dyn::get('lang')); lang::loadLang('lib' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . lang::getLang() . '.json'); $page = type::super('page', 'string', 'licence'); ob_start(); include "layout/index.php"; $out = ob_get_contents(); ob_get_clean(); echo $out;
/** * Einen ganzen Ordner durchscannen und alle Klassen includen * * @param string $dir Der Ordner */ public static function addDir($dir) { if (!is_dir($dir)) { //throw new Exception; } // Schon eingescannt if (in_array($dir, self::$dirs)) { return; } self::$dirs[] = $dir; $files = scandir($dir); foreach ($files as $file) { if (in_array($file, ['.', '..'])) { continue; } if (strrchr($file, '.') != '.php') { continue; } // Ausgedachter Klassennamen self::addClass($dir . '_' . $file, $dir . DIRECTORY_SEPARATOR . $file); self::$isNewCache = true; } }
<?php namespace lib; include_once $_SERVER['DATING_ROOT'] . '/lib/log.php'; set_error_handler(array('\\lib\\log', 'error_handler')); include_once $_SERVER['DATING_ROOT'] . '/lib/autoload.php'; autoload::register(); session::init(); session_start();
<?php namespace egl\website; //TODO: Should this file and autoload.php be here? $loader = new autoload(); $loader->register(); $loader->addNamespace('egl\\website', '/var/egl/'); $loader->addNamespace('egl\\website', '/var/egl/src/'); $loader->addNamespace('egl\\website\\test', '/var/egl/test'); $loader->addNamespace('', '/var/egl/lib');