Ejemplo n.º 1
0
<?php

use Nbml\AutoLoader\ClassAutoLoader;
use Nbml\AutoLoader\ViewAutoLoader;
use Nbml\Compiler;
require_once __DIR__ . '/AutoLoader/ViewAutoLoader.php';
require_once __DIR__ . '/AutoLoader/ClassAutoLoader.php';
$classAutoLoader = new ClassAutoLoader();
$classAutoLoader->addIncludePath(__DIR__ . '/../')->register();
$viewAutoLoader = new ViewAutoLoader();
$viewAutoLoader->setAlwaysCompile(true)->addIncludePath(getcwd())->register();
$viewCompiler = new Compiler();
$viewCompiler->addTagProcessor('\\Nbml\\MetadataTag\\PublicMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\StateMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\OnDemandMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\OnStateMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\CssMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\JsMetadataTag');
$viewAutoLoader->setViewCompiler($viewCompiler);
return $viewAutoLoader;
Ejemplo n.º 2
0
<?php

use Nbml\AutoLoader\ClassAutoLoader;
use Nbml\Server;
require_once __DIR__ . '/AutoLoader/ClassAutoLoader.php';
$autoLoader = new \Nbml\AutoLoader\ClassAutoLoader();
$autoLoader->addIncludePath(__DIR__ . '/../')->addIncludePath(__DIR__ . '/../tmp')->register();
$server = new \Nbml\Server($_SERVER['REQUEST_URI'], array_merge($_GET, $_POST));
$server->config()->includePath(__DIR__ . '/../')->cacheDir(__DIR__ . '/../tmp')->namespaces()->metadataTags()->add('\\Nbml\\MetadataTag\\InjectMetadataTag')->add('\\Nbml\\MetadataTag\\PublicMetadataTag')->add('\\Nbml\\MetadataTag\\StateMetadataTag')->add('\\Nbml\\MetadataTag\\OnDemandMetadataTag')->add('\\Nbml\\MetadataTag\\OnStateMetadataTag')->add('\\Nbml\\MetadataTag\\CssMetadataTag')->add('\\Nbml\\MetadataTag\\JsMetadataTag');
return $server;
Ejemplo n.º 3
0
<?php

use Nbml\AutoLoader\ClassAutoLoader;
use Nbml\AutoLoader\ViewAutoLoader;
use Nbml\Compiler;
use NetBricks\SimpleCms\Di;
session_start();
if (!defined('LIBRARY_PATH')) {
    define('NBML_LIBRARY_DIR', realpath(__DIR__ . '/../../../library'));
}
require_once NBML_LIBRARY_DIR . '/Nbml/AutoLoader/ViewAutoLoader.php';
require_once NBML_LIBRARY_DIR . '/Nbml/AutoLoader/ClassAutoLoader.php';
initialize_autoloaders:
$classAutoLoader = new ClassAutoLoader();
$classAutoLoader->addIncludePath(NBML_LIBRARY_DIR)->addIncludePath(__DIR__ . '/../src')->register();
$viewAutoLoader = new ViewAutoLoader();
$viewAutoLoader->setCompilerDefaultDestinationDir(__DIR__ . '/../tmp')->setAlwaysCompile(true)->addIncludePath(__DIR__ . '/../src')->register();
$viewCompiler = new Compiler();
$viewCompiler->addTagProcessor('\\Nbml\\MetadataTag\\PublicMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\StateMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\OnDemandMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\OnStateMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\CssMetadataTag')->addTagProcessor('\\Nbml\\MetadataTag\\JsMetadataTag')->addTagProcessor('\\NetBricks\\SimpleCms\\AdminAccessMetadataTag');
$viewAutoLoader->setViewCompiler($viewCompiler);
Di::sqLiteFilePath(realpath(__DIR__ . '/../var/') . '/base.db');
Di::secretFilePath(realpath(__DIR__ . '/../var/') . '/secret');
//Installation:
\NetBricks\SimpleCms\Model\Article::initDb();
echo new NetBricks\SimpleCms\View\Application();