Пример #1
0
 /**
  * Мастер создания ссылок
  * @return string
  */
 public function href()
 {
     if (!($href = func_get_args())) {
         return Reg()->host;
     } else {
         if (is_array($href[0])) {
             $href = $href[0];
         }
         if ($href[0] == 'THIS') {
             $templ = Reg()->GET;
             unset($href[0]);
             if ((int) @$href[1]) {
                 $temp = $templ;
                 unset($templ);
                 for ($x = 0; $x < $href[1]; $x++) {
                     @($templ[] = $temp[$x]);
                 }
                 unset($href[1]);
             }
             $href = array_merge($templ, $href);
         }
         $divider = !empty(Env()->basis->divider) ? Env()->basis->divider : Reg()->divider;
         return Reg()->host . (!empty(Env()->basis->rewrite) ? implode($divider, $href) : '?' . $this->http_build_query($href));
     }
 }
Пример #2
0
 /**
  * Получить окружение
  * @param string $name Имя окружения
  * @return array Окружение
  */
 public function getEnv($name)
 {
     if (!isset($this->environs[$name])) {
         $this->environs[$name] = $this->loadEnviron(Reg()->folderEnviron . $name . '.php');
     }
     return $this->environs[$name];
 }
Пример #3
0
 /**
  * Получить приложение
  * @param string $app Имя приложения
  * @param string $typeApp Тип приожения
  * @param $arg Парметр для конструктора приложения
  * @return object
  */
 public function getApp($app, $typeApp = 'frontend', $arg = null)
 {
     $nameClass = $app . '_' . $typeApp;
     if (!empty($this->appendices[$nameClass])) {
         return $this->appendices[$nameClass]->object;
     } else {
         $folderAppendices = Reg()->folderAppendicesSite;
         $folderAppendix = $folderAppendices . $app;
         if (!Core::loadFile($folderAppendix . '/' . $typeApp . '.php')) {
             $folderAppendices = Reg()->folderAppendicesCore;
             $folderAppendix = $folderAppendices . $app;
             if (!Core::loadFile($folderAppendix . '/' . $typeApp . '.php')) {
                 return false;
             }
         }
         if (!class_exists($nameClass)) {
             return false;
         }
         $this->appendices[$nameClass] = new stdClass();
         $this->appendices[$nameClass]->path = $folderAppendices;
         $this->appendices[$nameClass]->type = $typeApp;
         $this->appendices[$nameClass]->name = $app;
         $this->appendices[$nameClass]->object =& $object;
         return $object = new $nameClass($arg);
     }
 }
Пример #4
0
 public function getEnv($name)
 {
     if (!($environ = $this->loadEnviron(Reg()->folderEnvironSite . $name . '.php'))) {
         $environ = $this->loadEnviron(Reg()->folderEnvironCore . $name . '.php');
     }
     return @(object) $environ;
 }
Пример #5
0
 /**
  *
  * @param string $name Название интерфейса
  * @param string $type Тип интерфейса
  */
 public function loadInterface($name, $type = 'html')
 {
     if (!$this->loadFile($path = Reg()->folderViewSite . 'interface/' . $name . '.' . $type)) {
         if (!$this->loadFile($path = Reg()->folderViewCore . 'interface/' . $name . '.' . $type)) {
             echo 'Интерфейс "' . $path . '" не найден.';
         }
     }
 }
Пример #6
0
 /**
  * Получить библиотеку
  * @param string $name Название библитеки
  * @return object
  */
 public function getLib($name, $arg = null)
 {
     if (isset($this->libraries[$name])) {
         return $this->libraries[$name]->object;
     } else {
         $nameAdapter = $name . '_adapter';
         $forlderLibraries = Reg()->folderLibraries;
         $forlderLibrary = $forlderLibraries . $name;
         if (!Core::includeFile($forlderLibrary . '.php')) {
             Core::fatal('Библиотека "' . $name . '" не найдена!');
         }
         if (!class_exists($nameAdapter)) {
             Core::fatal('Класс "' . $nameAdapter . '" не найден.');
         }
         $this->libraries[$name]->path = $forlderLibrary;
         $this->libraries[$name]->folder = $forlderLibraries;
         $this->libraries[$name]->object =& $library;
         return $library = new $nameAdapter($arg);
     }
 }
Пример #7
0
<?php

@ini_set('display_errors', 1);
@ini_set('html_errors', 0);
@ini_set('magic_quotes_runtime', 0);
@ini_set('magic_quotes_sybase', 0);
error_reporting(E_ALL);
set_time_limit(30);
mb_internal_encoding('UTF-8');
header('Content-Type: text/html; charset=utf-8');
session_start();
define('GLISS_DIR', defined('ENTRY_POINT') ? get_include_path() : dirname(__FILE__) . '/');
@define('ENTRY_POINT', true);
include_once GLISS_DIR . 'core/Core.class.php';
Core::start();
// Временный мини роутер
if (!App()->getApp(@$_GET[0])) {
    $GET = $_GET;
    $_GET = array_merge(@array(Env()->basis->appendix), $_GET);
    if (!App()->getApp(@Env()->basis->appendix)) {
        if (!App()->getApp(Reg()->appendix)) {
            $_GET = $GET;
            $_GET = array_merge(array(Reg()->appendix), $_GET);
            Core::exception('Приложение "' . Reg()->appendix . '" не найдено.');
        }
    }
}
View()->display();
Пример #8
0
 /**
  * Инструмент создания ссылок
  * @return string
  */
 public function url()
 {
     if (!($href = func_get_args())) {
         return $this->host . $this->basename;
     } else {
         if (is_array($href[0])) {
             $href = $href[0];
         }
         return $this->host . (!empty(Reg()->rewrite) ? implode(Reg()->divider, $href) : $this->basename . '?' . $this->query($href));
     }
 }