コード例 #1
0
 function view()
 {
     // Grab the view to easily assign variables
     $view = $this->getView();
     // Get all warnings from Ajde_Dump::warn()
     if (Ajde_Dump::getWarnings()) {
         $view->assign('warn', Ajde_Dump::getWarnings());
     }
     // Get all dumps from Ajde_Dump::dump() [Aliased as a global function dump()]
     if (Ajde_Dump::getAll()) {
         $view->assign('dump', Ajde_Dump::getAll());
     }
     // Get request parameters
     $view->assign('request', Ajde::app()->getRequest());
     // Get Configuration stage
     $view->assign('configstage', Config::$stage);
     // Get database queries
     if (Ajde_Core_Autoloader::exists('Ajde_Db_PDO')) {
         $view->assign('database', Ajde_Db_PDO::getLog());
     }
     // Get language
     $view->assign('lang', Ajde_Lang::getInstance()->getLang());
     // Get session
     $view->assign('session', $_SESSION);
     // Get ACL
     if (Ajde_Core_Autoloader::exists('Ajde_Acl')) {
         $view->assign('acl', Ajde_Acl::getLog());
     }
     // Get the application timer
     Ajde::app()->endTimer(0);
     Ajde::app()->endTimer(Ajde::app()->getLastTimerKey());
     $view->assign('timers', Ajde::app()->getTimers());
     return $this->render();
 }
コード例 #2
0
 public static function fromType($type)
 {
     $className = __CLASS__ . '_' . ucfirst($type);
     if (!Ajde_Core_Autoloader::exists($className)) {
         throw new Ajde_Exception(sprintf("Compressor for type %s not found", $type), 90017);
     }
     return new $className();
 }
コード例 #3
0
 public static function beautifyHtml($html, $config = array("output-xhtml" => true, "char-encoding" => "utf8", "indent" => true, "indent-spaces" => 4, "wrap" => 0))
 {
     if (!Ajde_Core_Autoloader::exists('Tidy')) {
         throw new Ajde_Exception('Class Tidy not found', 90023);
     }
     $tidy = new Tidy();
     // http://bugs.php.net/bug.php?id=35647
     return $tidy->repairString($html, $config, 'utf8');
 }
コード例 #4
0
 protected function _getResource($className)
 {
     // get resource from request
     $fingerprint = Ajde::app()->getRequest()->getRaw('id');
     if (!Ajde_Core_Autoloader::exists($className)) {
         throw new Ajde_Controller_Exception("Resource type could not be loaded");
     }
     //$resource = call_user_func_array(array($className,"fromHash"), array($hash));
     $resource = call_user_func_array(array($className, "fromFingerprint"), array($this->getFormat(), $fingerprint));
     return $resource->getContents();
 }
コード例 #5
0
 public static function beautifyHtml($html, $config = array("output-xhtml" => true, "char-encoding" => "utf8", "indent" => true, "indent-spaces" => 4, "wrap" => 0))
 {
     if (!Ajde_Core_Autoloader::exists('Tidy')) {
         throw new Ajde_Exception('Class Tidy not found', 90023);
     }
     $tidy = new Tidy();
     // tidy does not produce valid utf8 when the encoding is specified in the config
     // so we provide a third parameter, 'utf8' to fix this
     // @see http://bugs.php.net/bug.php?id=35647
     return $tidy->repairString($html, $config, 'utf8');
 }
コード例 #6
0
 /**
  *
  * @param string $name
  * @param Ajde_Shop_Transaction $transaction
  * @return Ajde_Shop_Transaction_Provider
  * @throws Ajde_Exception 
  */
 public static function getProvider($name, $transaction = null)
 {
     $providerClass = 'Ajde_Shop_Transaction_Provider_' . ucfirst($name);
     if (!Ajde_Core_Autoloader::exists($providerClass)) {
         // TODO:
         throw new Ajde_Exception('Payment provider ' . $name . ' not found');
     }
     $obj = new $providerClass();
     if ($transaction) {
         $obj->setTransaction($transaction);
     }
     return $obj;
 }
コード例 #7
0
 /**
  *
  * @param Ajde_Core_Route $route
  * @return Ajde_Controller
  */
 public static function fromRoute(Ajde_Core_Route $route)
 {
     if ($controller = $route->getController()) {
         $moduleController = ucfirst($route->getModule()) . ucfirst($controller) . 'Controller';
     } else {
         $moduleController = ucfirst($route->getModule()) . 'Controller';
     }
     if (!Ajde_Core_Autoloader::exists($moduleController)) {
         $exception = new Ajde_Exception("Controller {$moduleController} for module {$route->getModule()} not found", 90008);
         Ajde::routingError($exception);
     }
     $controller = new $moduleController($route->getAction(), $route->getFormat());
     $controller->_route = $route;
     foreach ($route->values() as $part => $value) {
         $controller->set($part, $value);
     }
     return $controller;
 }
コード例 #8
0
 public static function registerDocumentProcessor($format, $registerOn = 'layout')
 {
     $documentProcessors = Config::get('documentProcessors');
     if (is_array($documentProcessors) && isset($documentProcessors[$format])) {
         foreach ($documentProcessors[$format] as $processor) {
             $processorClass = 'Ajde_Document_Processor_' . ucfirst($format) . '_' . $processor;
             if (!Ajde_Core_Autoloader::exists($processorClass)) {
                 // TODO:
                 throw new Ajde_Exception('Processor ' . $processorClass . ' not found', 90022);
             }
             if ($registerOn == 'layout') {
                 Ajde_Event::register('Ajde_Layout', 'beforeGetContents', $processorClass . '::preProcess');
                 Ajde_Event::register('Ajde_Layout', 'afterGetContents', $processorClass . '::postProcess');
             } elseif ($registerOn == 'compressor') {
                 Ajde_Event::register('Ajde_Resource_Local_Compressor', 'beforeCompress', $processorClass . '::preCompress');
                 Ajde_Event::register('Ajde_Resource_Local_Compressor', 'afterCompress', $processorClass . '::postCompress');
             } else {
                 // TODO:
                 throw new Ajde_Exception('Document processor must be registered on either \'layout\' or \'compressor\'');
             }
         }
     }
 }
コード例 #9
0
ファイル: Event.php プロジェクト: nabble/updatemybrowser-v1
 protected static function className($object)
 {
     if (is_object($object)) {
         return get_class($object);
     } elseif (is_string($object) && Ajde_Core_Autoloader::exists($object)) {
         return $object;
     }
     throw new Ajde_Exception('No classname or object instance given, or classname is incorrect', 90012);
 }