Ejemplo n.º 1
0
 /**
  * Set template paths, config vars, etc
  * @param string $routepath The prefix that should be added to all route paths.
  * @return void
  */
 public function initialize($routepath)
 {
     // Set path
     $this->routepath = $routepath;
     // Add templates
     Template::addPath(__DIR__ . '/../templates/', 'CatLab/OAuth2/');
     Application::getInstance()->on('dispatch:before', array($this, 'setRequestUser'));
     // Add locales
     Text::getInstance()->addPath('catlab.oauth2', __DIR__ . '/locales/');
     $this->setErrorResponder(new JSON());
 }
Ejemplo n.º 2
0
 /**
  * Set template paths, config vars, etc
  * @param string $routepath The prefix that should be added to all route paths.
  * @return void
  */
 public function initialize($routepath)
 {
     // Set path
     $this->routepath = $routepath;
     // Add templates
     Template::addPath(__DIR__ . '/templates/', 'CatLab/Accounts/');
     // Add locales
     Text::getInstance()->addPath('catlab.accounts', __DIR__ . '/locales/');
     // Set session variable
     Application::getInstance()->on('dispatch:before', array($this, 'setRequestUser'));
     // Set the global user mapper, unless one is set already
     Application::getInstance()->on('dispatch:first', array($this, 'setUserMapper'));
     // Add helper methods
     $helper = new LoginForm($this);
     Template::addHelper('CatLab.Accounts.LoginForm', $helper);
 }
Ejemplo n.º 3
0
 private function ngettext($message1, $message2 = null, $n = null)
 {
     return \Neuron\Tools\Text::getInstance()->getText($message1, $message2, $n);
 }
Ejemplo n.º 4
0
<?php

error_reporting(E_ALL);
$loader = (require_once '../../vendor/autoload.php');
// Autoload the example app
$loader->add('Example\\', __DIR__ . '/../app/');
// Start the app
$app = \Neuron\Application::getInstance();
// Load the router
$app->setRouter(include 'router.php');
// Set config folder
\Neuron\Config::folder(__DIR__ . '/../config/');
// Optionally, set an environment
$hostname = trim(file_get_contents('/etc/hostname'));
switch ($hostname) {
    case 'my-computer':
    case 'thijs-home-i7':
        \Neuron\Config::environment('development');
        break;
}
// Set the template folder
\Neuron\Core\Template::addPath(__DIR__ . '/../templates/');
// Set the locale
$app->setLocale('nl_BE.utf8');
// Set our own domain
\Neuron\Tools\Text::getInstance()->addPath('example', __DIR__ . '/../locales/');
// Return app
return $app;