/**
  * Initialize the Titanium core framework and autoloader
  *
  * @access public
  * @return void
  */
 public static function init()
 {
     // Register the framework autoloader
     spl_autoload_register(array('Titanium', 'auto_loader'));
     // Set the timezone for the date() functions
     date_default_timezone_set('America/Chicago');
     // Set internal locale
     setlocale(LC_ALL, 'en_US.utf-8');
     // Set internet encoding to utf8
     ini_set('default_charset', 'UTF-8');
     // Register the script shurdown handler
     register_shutdown_function(array('Titanium', 'handle_shutdown'));
     /*
     set_exception_handler(
     	array('Titanium', 'exception_handler')
     );
     
     set_error_handler(
     	array('Titanium', 'error_handler')
     );
     */
     if (function_exists('mb_internal_encoding')) {
         mb_internal_encoding('UTF-8');
     }
     self::$is_cli = PHP_SAPI === 'cli';
     self::$is_windows = DIRECTORY_SEPARATOR === '\\';
     self::load_functions();
 }
 /**
  * Load a class from the vendors directory
  *
  * @access public
  * @param  string $filename
  * @return void
  */
 public static function load($filename)
 {
     if (!$filename) {
         throw new Exception('A valid file name is required to load from.');
         exit;
     }
     $file = TITANIUM_ROOT . 'vendors/' . $filename;
     if (file_exists($file)) {
         require_once $file;
         Titanium::add_loaded_class($file);
     }
 }
Exemple #3
0
function exec_cmd($q, $params = NULL)
{
    $match = false;
    foreach (Titanium::function_patterns() as $regex => $funct) {
        if (preg_match($regex, $q, $matches) > 0) {
            if (file_exists('functions/' . $funct . '.php')) {
                require_once 'functions/' . $funct . '.php';
                $match = true;
                call_user_func(str_replace('.', '_', $funct), $q, $matches, $params);
                print_ticker();
            }
        }
    }
    if (!$match) {
        Output::write(Template::render('errors/invalid-command.tpl.php'), 'red', TRUE);
        print_ticker();
    }
}
/**
 * Display a list of the base class includes
 *
 * @param string $q
 * @param array $matches
 * @param array $params
 */
function fn_listincludes($q, $matches, $params)
{
    Logger::write("Running: " . __FUNCTION__);
    $data = array('includes' => Titanium::loaded_classes());
    Output::write(Template::render('functions/listincludes.tpl.php', $data), false, true);
}