Example #1
0
 function init()
 {
     $result = parent::init();
     $this->registerContentTypes();
     \Bonita\Main::additionalPath(dirname($this->getFilename()));
     return $result;
 }
Example #2
0
 /**
  * On construction, detect the template type
  */
 function __construct($template = false)
 {
     if (!$template instanceof Template) {
         $this->detectTemplateType();
     }
     assert('\\Idno\\Core\\site()->config()->site_secret /* Site secret not set */');
     \Bonita\Main::siteSecret(\Idno\Core\site()->config()->site_secret);
     return parent::__construct($template);
 }
Example #3
0
 /**
  * On initialization, the theme management class loads the current theme and sets it as
  * a template directory
  */
 public function init()
 {
     if (!empty(site()->config()->theme)) {
         $this->theme = site()->config()->theme;
         if (defined('KNOWN_MULTITENANT_HOST')) {
             $host = KNOWN_MULTITENANT_HOST;
             if (file_exists(\Idno\Core\Idno::site()->config()->path . '/hosts/' . $host . '/Themes/' . $this->theme)) {
                 \Bonita\Main::additionalPath(site()->config()->path . '/hosts/' . $host . '/Themes/' . $this->theme);
                 $config = parse_ini_file(\Idno\Core\Idno::site()->config()->path . '/hosts/' . $host . '/Themes/' . $this->theme . '/theme.ini', true);
             } else {
                 if (file_exists(\Idno\Core\Idno::site()->config()->path . '/Themes/' . $this->theme . '/theme.ini')) {
                     \Bonita\Main::additionalPath(site()->config()->path . '/Themes/' . $this->theme);
                     $config = parse_ini_file(\Idno\Core\Idno::site()->config()->path . '/Themes/' . $this->theme . '/theme.ini', true);
                 }
             }
         }
         if (!empty($config)) {
             if (!empty($config['extensions'])) {
                 $extensions = $config['extensions'];
             } else {
                 if (!empty($config['Extensions'])) {
                     $extensions = $config['Extensions'];
                 }
             }
             if (!empty($extensions)) {
                 foreach ($extensions as $template => $extension) {
                     site()->template()->extendTemplate($template, $extension);
                 }
             }
             if (!empty($config['prepend extensions'])) {
                 $prep_extensions = $config['prepend extensions'];
             } else {
                 if (!empty($config['Prepend Extensions'])) {
                     $prep_extensions = $config['Prepend Extensions'];
                 }
             }
             if (!empty($prep_extensions)) {
                 foreach ($prep_extensions as $template => $extension) {
                     //site()->template()->extendTemplate($template, $extension, true);
                     site()->template()->prependTemplate($template, $extension, true);
                 }
             }
             if (is_subclass_of("Themes\\{$this->theme}\\Controller", 'Idno\\Common\\Theme')) {
                 $class = "Themes\\{$this->theme}\\Controller";
                 $this->themes[$this->theme] = new $class();
             }
         }
     }
 }
Example #4
0
    $known_loader->registerNamespace('Themes', array(dirname(dirname(__FILE__)), dirname(dirname(__FILE__)) . '/hosts/' . $host));
}
// Shims
include 'shims.php';
// Register our external namespaces (PSR-0 compliant modules that we love, trust and need)
// Bonita is being used for templating
$known_loader->registerNamespace('Bonita', dirname(dirname(__FILE__)) . '/external/bonita/includes');
// Symfony is used for routing, observer design pattern support, and a bunch of other fun stuff
$known_loader->registerNamespace('Symfony\\Component', dirname(dirname(__FILE__)) . '/external');
// Using Toro for URL routing
require_once dirname(dirname(__FILE__)) . '/external/torophp/src/Toro.php';
// Using mf2 for microformats parsing, and webignition components to support it
$known_loader->registerNamespace('webignition\\Url', dirname(dirname(__FILE__)) . '/external/webignition/url/src');
$known_loader->registerNamespace('webignition\\AbsoluteUrlDeriver', dirname(dirname(__FILE__)) . '/external/webignition/absolute-url-deriver/src');
$known_loader->registerNamespace('webignition\\NormalisedUrl', dirname(dirname(__FILE__)) . '/external/webignition/url/src');
$known_loader->registerNamespace('Mf2', dirname(dirname(__FILE__)) . '/external/mf2');
// Using Simplepie for RSS and Atom parsing
include dirname(dirname(__FILE__)) . '/external/simplepie/autoloader.php';
// Using HTMLPurifier for HTML sanitization
include dirname(dirname(__FILE__)) . '/external/htmlpurifier-lite/library/HTMLPurifier.auto.php';
// Register the autoloader
$known_loader->register();
// Register the idno-templates folder as the place to look for templates in Bonita
\Bonita\Main::additionalPath(dirname(dirname(__FILE__)));
// Init main system classes
$idno = new Idno\Core\Idno();
$account = new Idno\Core\Account();
$admin = new Idno\Core\Admin();
$webfinger = new Idno\Core\Webfinger();
$webmention = new Idno\Core\Webmention();
$pubsubhubbub = new Idno\Core\PubSubHubbub();
Example #5
0
 /**
  *    Generate a token based on a given action and UNIX timestamp.
  *
  * @param string $targetURL The URL of the form action we're using.
  * @param int $time The current timestamp.
  *
  * @return true|false
  */
 public static function token($action, $time)
 {
     return sha1($action . $time . \Bonita\Main::getSiteSecret());
 }
Example #6
0
 /**
  * Detects templates based on the given browser string
  * (defaults, of course, to "default")
  */
 function detectTemplateType()
 {
     $device = \Bonita\Main::detectDevice();
     return $this->setTemplateType($device);
 }