Пример #1
0
 protected function getViewPath($view)
 {
     $basePath = Service::getConfig('basePath');
     $name = Service::getConfig('name');
     //{
     $currentNamespace = explode('\\', get_class($this));
     $controllerName = str_replace('Controller', '', array_pop($currentNamespace));
     $appName = array_shift($currentNamespace);
     $path = $basePath . '\\src\\' . $appName . '\\views\\' . $controllerName . '\\' . $view . '.php';
     //}Разбор работает хорошо, если структура приложения меняться не будет!!
     //$path = $basePath.'\\src\\'.str_replace(['Controller', '\\\\'], ['', '/'], get_class($this)).'\\'.$view.'.php';
     return str_replace('\\', '/', $path);
 }
Пример #2
0
 public function getRouteClosure()
 {
     return function ($name) {
         $routes = Service::getConfig('routes');
         foreach ($routes as $routeName => $rContent) {
             if ($name == $routeName) {
                 $result = Request::getHost() . $rContent['pattern'];
                 return $result;
             }
         }
         return '';
     };
 }
Пример #3
0
 public function send()
 {
     $charset = Service::getConfig('charset');
     header($this->htProtocol . ' ' . $this->code . ' ' . $this->responseMessage);
     header('Content-Type: ' . $this->type . '; charset=' . $charset);
     header('Pragma: no-cache');
     if (!empty($this->headers)) {
         foreach ($this->headers as $header) {
             header($header);
         }
     }
     echo json_encode($this->content);
 }
Пример #4
0
<?php

$activeIfRoute = function ($item) use(&$route) {
    return $route['name'] === $item ? 'class="active"' : '';
};
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="<?php 
echo \Framework\DI\Service::getConfig('charset');
?>
">
    <title> <?php 
echo $title;
?>
</title>

    <link href="/css/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/css/bootstrap-theme.min.css" rel="stylesheet">

    <link href="/css/my.css" rel="stylesheet">
    <script type="text/javascript" src="/js/animate.js" defer></script>
</head>

<body >
<div id="particles-js" class="main">
    <div id="animate-nav-bar" class="nav-bar">
        <div><a href="/">Portfolio</a></div>
        <div><a href="#">Services</a></div>
Пример #5
0
 private function _initComponents()
 {
     $components = Service::getConfig('components');
     foreach ($components as $component) {
         \Loader::addNamespacePath($component['namespace'], $component['path']);
         if (isset($component['bootstrap']) && $component['bootstrap'] === 'on') {
             $class = $component['class'];
             Service::set($component['name'], new $class());
         }
     }
 }
Пример #6
0
 public function __construct()
 {
     $this->session = Service::get('session');
     $this->loginRoute = Service::getConfig('security')['login_route'];
 }