/**
  * Obtains the singleton instance of xBoilerplate, creating if necessary.
  *
  * Your index.php should handle the post-instantiation initialisation by calling pageStart().
  *
  * @static
  * @return an instantiated instance of xBoilerplate
  */
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new xBoilerplate();
     }
     return self::$_instance;
 }
Beispiel #2
0
 * @copyright Copyright (c) 2007-2012 Xodoa (http://xodoa.com)
 * @author   Nicolas Ruflin <*****@*****.**>
 */
ini_set('error_log', dirname(__DIR__) . '/tmp/error.log');
error_reporting(E_ALL | E_STRICT);
// adds elasticsearch to the include path
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../lib'));
include '../autoload.php';
$content = '';
try {
    if ($_SERVER['REDIRECT_URL']) {
        $uri = parse_url($_SERVER['REDIRECT_URL']);
    } else {
        $uri = parse_url($_SERVER['REQUEST_URI']);
    }
    $xBoilerplate = xBoilerplate::getInstance()->pageStart($uri['path'], $_GET, __DIR__);
    if (substr($uri['path'], 1, 3) == 'css') {
        // Load css
        header('Content-Type: text/css');
        $cssContent = $xBoilerplate->loadCss(substr($uri['path'], 5));
        $less = new lessc();
        $content = $less->parse($cssContent);
    } else {
        if (substr($uri['path'], 1, 2) == 'js') {
            // load js
            header('Content-Type: text/javascript');
            $content = $xBoilerplate->loadJs(substr($uri['path'], 4));
        } else {
            $content = $xBoilerplate->render();
        }
    }
 public function testLoadMenu()
 {
     $menu = 'Gargle Blaster';
     $xBoilerplate = xBoilerplate::getInstance()->pagestart('/');
     $this->assertEquals($menu, $xBoilerplate->loadMenu('test'));
 }
Beispiel #4
0
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../lib'));
function xodoa_autoload($class)
{
    $file = str_replace('_', '/', $class) . '.php';
    require_once $file;
}
spl_autoload_register('xodoa_autoload');
$content = '';
try {
    if ($_SERVER['REDIRECT_URL']) {
        $uri = parse_url($_SERVER['REDIRECT_URL']);
    } else {
        $uri = parse_url($_SERVER['REQUEST_URI']);
    }
    $pageParams = array_merge_recursive($_GET, $_POST);
    $xBoilerplate = new xBoilerplate($uri['path'], $pageParams);
    if (substr($uri['path'], 1, 3) == 'css') {
        // Load css
        header('Content-Type: text/css');
        $cssContent = $xBoilerplate->loadCss(substr($uri['path'], 5));
        $less = new lessc();
        $content = $less->parse($cssContent);
    } else {
        if (substr($uri['path'], 1, 2) == 'js') {
            // load js
            header('Content-Type: text/javascript');
            $content = $xBoilerplate->loadJs(substr($uri['path'], 4));
        } else {
            $content = $xBoilerplate->render();
        }
    }
Beispiel #5
0
 protected function __construct()
 {
     $config = $this->loadConfig(xBoilerplate::getInstance());
     $this->openConnection($config);
 }
 /**
  * Triggers the overriding of the standard xBoilerplate singleton with this version.
  * @static
  *
  */
 public static function overrideStandardXBoilerplate()
 {
     xBoilerplate::$_instance = new PvtTestXBoilerplate();
 }