Ejemplo n.º 1
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);
Ejemplo n.º 2
0
<?php

namespace infrajs\crumb;

use infrajs\controller\Controller;
use infrajs\controller\Each;
use infrajs\path\Path;
use infrajs\event\Event;
use infrajs\sequence\Sequence;
use infrajs\template\Template;
use infrajs\controller\External;
Path::reqif('*controller/infra.php');
Event::handler('oninit', function () {
    $root = Crumb::getInstance();
    Sequence::set(Template::$scope, Sequence::right('infra.Crumb.query'), $root->query);
    Sequence::set(Template::$scope, Sequence::right('infra.Crumb.params'), Crumb::$params);
    Sequence::set(Template::$scope, Sequence::right('infra.Crumb.get'), Crumb::$get);
    $cl = function ($mix = null) {
        return ext\Crumb::getInstance($mix);
    };
    Sequence::set(Template::$scope, Sequence::right('infra.Crumb.getInstance'), $cl);
    External::add('child', 'layers');
    External::add('childs', function (&$now, &$ext) {
        //Если уже есть значения этого свойства то дополняем
        if (!$now) {
            $now = array();
        }
        Each::forx($ext, function (&$n, $key) use(&$now) {
            if (@$now[$key]) {
                return;
            }