Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • AdminDecorator
  • AdminIndexController
  • BlockController
  • BlockDecorator
  • ConfigBlock
  • ConfigController
  • ConfigOperation
  • Core
  • DeleteBlock
  • DeleteController
  • Document
  • DocumentDecorator
  • EditBlock
  • EditController
  • FormBlock
  • Hooks
  • InterlockBlock
  • Kses
  • ManageBlock
  • Module
  • Modules
  • StatsDecorator

Constants

  • OPERATION_SAVE_MODE
  • OPERATION_SAVE_MODE_CONTINUE
  • OPERATION_SAVE_MODE_DISPLAY
  • OPERATION_SAVE_MODE_LIST
  • OPERATION_SAVE_MODE_NEW

Functions

  • slugize
  • start
  • strip_stopwords
  1 <?php
  2 
  3 /*
  4  * This file is part of the Icybee package.
  5  *
  6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
  7  *
  8  * For the full copyright and license information, please view the LICENSE
  9  * file that was distributed with this source code.
 10  */
 11 
 12 namespace Icybee;
 13 
 14 use ICanBoogie\Debug;
 15 use ICanBoogie\Exception;
 16 use ICanBoogie\HTTP\HTTPError;
 17 use ICanBoogie\Module;
 18 use ICanBoogie\Operation;
 19 use ICanBoogie\Route;
 20 
 21 use Brickrouge\Document;
 22 
 23 /**
 24  * The following properties are injected by the "registry" module.
 25  *
 26  * @property Icybee\Modules\Editor\Collection $editors Editors collection. The getter is
 27  * injected by the "Editors" module.
 28  *
 29  * @property ICanBoogie\ActiveRecord\Model\System\Registry $registry Global registry object.
 30  *
 31  * The following properties are injected by the "sites" module.
 32  *
 33  * @property int $site_id Identifier of the current site.
 34  * @property Icybee\Modules\Sites\Site $site Current site object.
 35  *
 36  * The following properties are injected by the "users" module.
 37  *
 38  * @property Icybee\Modules\Users\User $user Current user object (might be a visitor).
 39  * @property int $user_id Identifier of the current user ("0" for visitors).
 40  */
 41 class Core extends \ICanBoogie\Core
 42 {
 43     /**
 44      * Override the method to provide a nicer exception presentation.
 45      *
 46      * @param \Exception $exception
 47      */
 48     static public function exception_handler(\Exception $exception)
 49     {
 50         global $core;
 51 
 52         $code = $exception->getCode() ?: 500;
 53         $message = $exception->getMessage();
 54         $class = get_class($exception); // The $class variable is required by the template
 55 
 56         if (!headers_sent())
 57         {
 58             $normalized_message = strip_tags($message);
 59             $normalized_message = str_replace(array("\r\n", "\n"), ' ', $normalized_message);
 60             $normalized_message = mb_convert_encoding($normalized_message, \ICanBoogie\CHARSET, 'ASCII');
 61 
 62             if (strlen($normalized_message) > 32)
 63             {
 64                 $normalized_message = mb_substr($normalized_message, 0, 29) . '...';
 65             }
 66 
 67             header('HTTP/1.0 ' . $code . ' ' . $class . ': ' . $normalized_message);
 68             header('X-ICanBoogie-Exception: ' . \ICanBoogie\strip_root($exception->getFile()) . '@' . $exception->getLine());
 69         }
 70 
 71         if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
 72         {
 73             $rc = json_encode(array('rc' => null, 'errors' => array('_base' => $message)));
 74 
 75             header('Content-Type: application/json');
 76             header('Content-Length: ' . strlen($rc));
 77 
 78             exit($rc);
 79         }
 80 
 81         $formated_exception = Debug::format_alert($exception);
 82         $reported = false;
 83 
 84         if (!($exception instanceof HTTPError))
 85         {
 86             Debug::report($formated_exception);
 87 
 88             $reported = true;
 89         }
 90 
 91         if (!headers_sent())
 92         {
 93             $site = isset($core->site) ? $core->site : null;
 94 
 95             if (class_exists('Brickrouge\Document'))
 96             {
 97                 $css = array
 98                 (
 99                     Document::resolve_url(\Brickrouge\ASSETS . 'brickrouge.css'),
100                     Document::resolve_url(ASSETS . 'admin.css'),
101                     Document::resolve_url(ASSETS . 'admin-more.css')
102                 );
103             }
104             else
105             {
106                 $css = array();
107             }
108 
109             $formated_exception = require(__DIR__ . '/exception.tpl.php');
110         }
111 
112         exit($formated_exception);
113     }
114 
115     /**
116      * Override the method to provide our own accessor.
117      */
118     protected function lazy_get_modules()
119     {
120         $config = $this->config;
121 
122         return new Modules($config['module-path'], $config['cache modules'] ? $this->vars : null);
123     }
124 }
Autodoc API documentation generated by ApiGen 2.8.0