Beispiel #1
0
 /**
  * Запуск фреймворка
  *
  * Допускает инициализацию только одного объекта
  *
  * Принимает аргументaми массивы пользовательских настроек.
  * Список настроек доступен в документации 
  *
  * @param array $appConfig
  * @param array $siteConfig
  *
  * @return void
  */
 public static function createApp($appConfig = [], $siteConfig = [])
 {
     if (!empty(self::$abc)) {
         throw new \LogicException('Only one process');
     }
     self::$abc = new self();
     self::$abc->run($appConfig, $siteConfig);
 }
Beispiel #2
0
 public function addParamToUrl($string)
 {
     $get = Abc::GET();
     $addition = $this->router->createGetFrom($string);
     $param = array_merge($get, $addition);
     return $this->createUrl($param, $abs = false);
 }
Beispiel #3
0
/**   
 * Активация ссылок 
 *
 * @param string $return
 * @param string|array $param
 * @param mix $default
 *
 * @return string
 */
function activeLink($query, $default = false)
{
    $get = Abc::GET();
    $current = Abc::getService('Url')->getGet($query);
    if ($get === $current) {
        return 'class="act"';
    }
    if (null === $get['controller'] && $default) {
        return 'class="act"';
    }
    return null;
}
 /**
  * Строит сервис.
  * 
  * @param bool $global
  *
  * @return void
  */
 protected function buildService($global = false)
 {
     $component = '\\ABC\\Abc\\Components\\' . $this->service . '\\' . $this->service;
     $typeService = $global ? 'setGlobal' : 'set';
     $get = Abc::GET();
     $url = Abc::getService('Url');
     $this->locator->{$typeService}($this->service, function () use($component, $get, $url) {
         $obj = new $component();
         $obj->get = $get;
         $obj->url = $url;
         return $obj;
     });
 }
Beispiel #5
0
 /**
  * Строит сервис.
  * 
  * @param bool $global
  *
  * @return void
  */
 protected function buildService($global = false)
 {
     $component = '\\ABC\\Abc\\Components\\' . $this->service . '\\' . $this->service;
     $typeService = $global ? 'setGlobal' : 'set';
     $config = $this->config;
     $router = Abc::getFromStorage('Router');
     $this->locator->{$typeService}($this->service, function () use($component, $config, $router) {
         $obj = new $component();
         $obj->config = $config;
         $obj->router = $router;
         return $obj;
     });
 }
Beispiel #6
0
 public function __construct()
 {
     $var1 = 'cодержимое первого аргумента';
     $var2 = ['первый' => 'cодержимое первого элемента', 'второй' => 'cодержимое второго элемента'];
     //echo $a;
     //Abc::dbg();
     //Abc::dbg($var1);
     //Abc::dbg($var2);
     //Abc::dbg(new \ABC\Abc);
     //Abc::dbg('ABC\Abc');
     //throw new \Exception('Тестовое исключение');
     //trigger_error('Полный пипец!!!');
     $mysqli = Abc::gs('Mysql');
     $mysqli->test = true;
     $mysqli->query("SELECT * FROM `test`");
     //$mysqli->query("sSELECT * FROM `test`");
     //Abc::dbg($mysqli);
     //$pdo = Abc::gs('PDO');
     //Abc::dbg($pdo);
 }
Beispiel #7
0
 /**
  * Возвращает объект шаблонизатора
  *
  * @return string
  */
 public function getTemplate()
 {
     return Abc::getService('Template');
 }
Beispiel #8
0
<?php

require __DIR__ . '/../vendor/Abc/Abc.php';
$local = (require __DIR__ . '/configs/local.php');
\ABC\Abc::startApp($local);