/**
  * Load a class
  * Return true if class loaded successfully or is already loaded
  *
  * @param string $className
  * @todo Odd Classes
  * @return bool
  */
 static function loadClass($className)
 {
     if (class_exists($className, false)) {
         return true;
     }
     $pos = strpos($className, "_");
     if ($pos !== false) {
         $module = substr($className, 0, $pos);
         if (isset(CHOQ_Module::$instances[$module])) {
             foreach (self::$classFolders as $folder) {
                 $classPath = CHOQ_Module::$instances[$module]->directory . DS . $folder . DS . str_replace(array("\\/", "/", "_"), DS, substr($className, $pos + 1)) . ".class.php";
                 if (file_exists($classPath)) {
                     if (CHOQ::isMode(CHOQ::MODE_DEV)) {
                         foreach (self::$classFolders as $subFolder) {
                             if ($subFolder == $folder) {
                                 continue;
                             }
                             $path = str_replace(DS . $folder . DS, DS . $subFolder . DS, $classPath);
                             if (file_exists($path)) {
                                 error("Duplicate classes found in {$classPath} and {$path}");
                             }
                         }
                     }
                     require $classPath;
                     if (method_exists($className, "onAutoload")) {
                         $className::onAutoload();
                     }
                     return true;
                 }
             }
         }
     }
     $path = CHOQ_ROOT_DIRECTORY . DS . "modules" . DS . $className . DS . $className . ".class.php";
     if (file_exists($path)) {
         require $path;
         return true;
     }
     return false;
 }
Example #2
0
 /**
  * Set error header
  *
  * @param mixed $code
  * @param string $message
  */
 public static function setHeader($code, $message)
 {
     if (!headers_sent()) {
         header("HTTP/1.1 {$code} Aliens disrupting");
         if (CHOQ::isMode(CHOQ::MODE_DEV)) {
             header("X-ERROR: " . str_replace(array("\n", "\r", "\t"), "", $message));
         }
     }
 }
Example #3
0
 /**
  * Set the mode
  *
  * @param int $mode
  */
 static function setMode($mode)
 {
     self::$mode = $mode;
 }
Example #4
0
<?php

/**
 * This file is part of Choqled PHP Framework and/or part of a BFLDEV Software Product.
 * This file is licensed under "GNU General Public License" Version 3 (GPL v3).
 * If you find a bug or you want to contribute some code snippets, let me know at http://bfldev.com/nreeda
 * Suggestions and ideas are also always helpful.

 * @author Roland Eigelsreiter (BrainFooLong)
 * @product nReeda - Web-based Open Source RSS/XML/Atom Feed Reader
 * @link http://bfldev.com/nreeda
**/
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
    die("You must have at least PHP 5.3.0 installed, your version is " . PHP_VERSION);
}
if (!function_exists("mb_strlen")) {
    die("You must enable the 'mbstring' extension in your PHP config");
}
try {
    define("CHOQ_ACTIVE_MODULE", "RDR");
    require __DIR__ . "/modules/CHOQ/class/Core.class.php";
    CHOQ_Core::initialise();
    CHOQ::get(CHOQ_ACTIVE_MODULE);
    CHOQ_View::loadViewForCurrentUri();
} catch (Exeption $e) {
    CHOQ_Exception::exceptionHandler($e);
}