Example #1
0
 public static function init()
 {
     $query = urldecode($_SERVER['REQUEST_URI']);
     header('Infrajs-Cache: true');
     $html = Access::cache(__FILE__ . ':init', function ($query) {
         header('Infrajs-Cache: false');
         Config::get();
         $conf = Config::get('controller');
         return Controller::check($conf['index']);
     }, array($query));
     echo $html;
     exit;
 }
Example #2
0
<?php

namespace infrajs\controller;

use infrajs\ans\Ans;
use infrajs\path\Path;
use infrajs\view\View;
use infrajs\load\Load;
use infrajs\router\Router;
if (!is_file('vendor/autoload.php')) {
    chdir('../../../../');
    require_once 'vendor/autoload.php';
    Router::init();
}
$query = Crumb::$href;
$ans = array('title' => 'Проверки контроллера');
$composer = Load::loadJSON('-infrajs/composer.json');
$require = $composer['require'];
foreach ($require as $path => $ver) {
    $p = explode('/', $path);
    $r = Path::reqif('-' . $p[1] . '/infra.php');
}
$layer = array('data' => 1, 'tpl' => array('qewr{data}'));
Crumb::change('');
$html = Controller::check($layer);
if ($html != 'qewr1') {
    return Ans::err($ans, 'Результат неожиданный ' . $html);
}
Crumb::change($query);
View::html('', true);
return Ans::ret($ans);
namespace infrajs\controller;

use infrajs\config\Config;
use infrajs\path\Path;
use infrajs\view\View;
use infrajs\load\Load;
use infrajs\ans\Ans;
if (!is_file('vendor/autoload.php')) {
    chdir('../../../../');
    require_once 'vendor/autoload.php';
}
$ans = array();
$ans['title'] = 'check4';
$query = Crumb::$query;
Config::get('controller');
View::html('<div id="main1"></div><div id="main2"></div>', true);
$layers = Load::loadJSON('-test-akiyatkin/resources/check4.json');
Crumb::change('test');
Controller::check($layers);
$html = View::html();
preg_match_all('/x/', $html, $matches);
$count = sizeof($matches[0]);
$countneed = 2;
Crumb::change($query);
Layer::$start_id = 1;
Layer::$ids = array();
View::html('', true);
if ($count != $countneed) {
    return Ans::err($ans);
}
return Ans::ret($ans);