Ejemplo n.º 1
0
 private function startAutoLoader()
 {
     require_once 'AutoLoader.php';
     $auto_loader = new AutoLoader();
     $auto_loader->addNamespace('sweb', $this->sWebPath);
     $auto_loader->addNamespace($this->pageNS, $this->pagePath);
     $auto_loader->register();
 }
Ejemplo n.º 2
0
 /**
  *  make sure autoload registers and unregisters correctly
  */
 public function testRegisterUnregister()
 {
     $al_orig_count = count(spl_autoload_functions());
     $al = new AutoLoader();
     $al->register();
     $al_count = count(spl_autoload_functions());
     $this->assertSame($al_orig_count + 1, $al_count);
     $al->unregister();
     $al_count = count(spl_autoload_functions());
     $this->assertSame($al_orig_count, $al_count);
     $al->register();
     $al_count = count(spl_autoload_functions());
     $this->assertSame($al_orig_count + 1, $al_count);
     $al_map = array();
     $al_map[0] = $al;
     $al_map[0]->unregister();
     $al_count = count(spl_autoload_functions());
     $this->assertSame($al_orig_count, $al_count);
     ///\out::e(spl_autoload_functions());
 }
Ejemplo n.º 3
0
 /**
  * Register autoloader.
  * @return void
  */
 public function register()
 {
     $cache = $this->getCache();
     $key = $this->getKey();
     if (isset($cache[$key])) {
         $this->list = $cache[$key];
     } else {
         $this->rebuild();
     }
     if (isset($this->list[strtolower(__CLASS__)]) && class_exists('NetteLoader', FALSE)) {
         NetteLoader::getInstance()->unregister();
     }
     parent::register();
 }
Ejemplo n.º 4
0
 /**
  * Register autoloader.
  * @return void
  */
 public function register()
 {
     $cache = $this->getCache();
     $data = $cache['data'];
     if ($data['opt'] === array($this->scanDirs, $this->ignoreDirs, $this->acceptFiles)) {
         $this->list = $data['list'];
     } else {
         $this->rebuild();
     }
     if (isset($this->list[strtolower(__CLASS__)]) && class_exists('NetteLoader', FALSE)) {
         NetteLoader::getInstance()->unregister();
     }
     parent::register();
 }
 public final function _initialize()
 {
     $this->loader = new AutoLoader();
     $this->loader->register();
     // Register core namespace
     $this->loader->addNamespace('\\XDaRk', dirname(__FILE__));
     $this->core = Core::getInstance($this);
     Core::$instanceNamespace = $GLOBALS[$this->name]['root_ns'];
     Core::$instanceBaseDir = $GLOBALS[$this->name]['dir'];
     Core::$instanceRootNSDir = $GLOBALS[$this->name]['dir'] . DIRECTORY_SEPARATOR . strtolower(Core::$instanceNamespace);
     // Register instance namespace, this is a necessary step
     $this->loader->addNamespace('\\' . Core::$instanceNamespace, Core::$instanceRootNSDir);
     Core::$instanceClasses = File::phpClassesInDir(Core::$instanceRootNSDir);
     Core::$classes = File::phpClassesInDir(dirname(__FILE__));
     // Extenders
     $this->xdRegisterNameSpaces();
     Hooks::registerHooks($this, $this->Hooks);
 }
Ejemplo n.º 6
0
 public function __construct($paths = array(), $configFile = null)
 {
     if ($configFile !== null) {
         $this->setConfigFile($configFile);
     }
     // Load helpers
     require_once __DIR__ . DIRECTORY_SEPARATOR . 'Helper.php';
     $this->loadConfig();
     $this->setAppPaths($paths);
     if ($this->useAutoloader) {
         // Configure autoloader
         require_once __DIR__ . DIRECTORY_SEPARATOR . 'AutoLoader.php';
         AutoLoader::register();
     }
     // Define error handler
     set_exception_handler(array('\\Suricate\\Error', 'handleException'));
     set_error_handler(array('\\Suricate\\Error', 'handleError'));
     register_shutdown_function(array('\\Suricate\\Error', 'handleShutdownError'));
     self::$servicesRepository = new Container();
     $this->initServices();
 }
Ejemplo n.º 7
0
        echo '<h1>Wolf CMS automatically disabled!</h1>';
        echo '<p>Wolf CMS has been disabled as a security precaution.</p>';
        echo '<p><strong>Reason:</strong> the configuration file was found to be writable.</p>';
        echo '<p>The broadest rights Wolf CMS allows for config.php are: -rwxr-xr-x</p>';
        echo '</body></html>';
        exit;
    }
}
//  Init  --------------------------------------------------------------------
define('SESSION_LIFETIME', 3600);
define('REMEMBER_LOGIN_LIFETIME', 1209600);
// two weeks
define('DEFAULT_CONTROLLER', 'page');
define('DEFAULT_ACTION', 'index');
require CORE_ROOT . DS . 'Framework.php';
AutoLoader::register();
AutoLoader::addFolder(array(APP_PATH . DIRECTORY_SEPARATOR . 'models', APP_PATH . DIRECTORY_SEPARATOR . 'controllers'));
try {
    $__CMS_CONN__ = new PDO(DB_DSN, DB_USER, DB_PASS);
} catch (PDOException $error) {
    die('DB Connection failed: ' . $error->getMessage());
}
$driver = $__CMS_CONN__->getAttribute(PDO::ATTR_DRIVER_NAME);
if ($driver === 'mysql') {
    $__CMS_CONN__->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
}
if ($driver === 'sqlite') {
    // Adding date_format function to SQLite 3 'mysql date_format function'
    if (!function_exists('mysql_date_format_function')) {
        function mysql_function_date_format($date, $format)
        {
Ejemplo n.º 8
0
<?php

/**
 * This bootstraps the websocket server
 *
 * PHP version 5.4
 *
 * @category   WebSocketServer
 * @author     Pieter Hordijk <*****@*****.**>
 * @copyright  Copyright (c) 2013 Pieter Hordijk
 * @license    http://www.opensource.org/licenses/mit-license.html  MIT License
 * @version    1.0.0
 */
namespace WebSocketServer;

use WebSocketServer\Core\Autoloader;
require_once __DIR__ . '/Core/Autoloader.php';
$autoloader = new AutoLoader(__NAMESPACE__, dirname(__DIR__));
$autoloader->register();
Ejemplo n.º 9
0
 /**
  * Register autoloader.
  * @return RobotLoader  provides a fluent interface
  */
 public function register()
 {
     $this->classes = $this->getCache()->load($this->getKey(), new Callback($this, '_rebuildCallback'));
     parent::register();
     return $this;
 }
Ejemplo n.º 10
0
<?php

define('ROOT', dirname(__DIR__));
define('INC', ROOT . '/src');
require_once ROOT . '/vendor/autoload.php';
require_once INC . '/AutoLoader.class.php';
AutoLoader::register(array(INC));
Ejemplo n.º 11
0
<?php

define('INC', dirname(__DIR__));
require_once INC . '/vendor/autoload.php';
require_once INC . '/vendor/anneks/rightaboutnow/src/AutoLoader.class.php';
AutoLoader::register(array(INC . '/lib', INC . '/controllers', INC . '/views'));
$config = new BabyTrackerConfig();