/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/core
/vendor
/grdar
/core
/src
/Views
/View.php
$container = Container::getInstance();
return get_object_vars($container);
}
public static function html()
{
isset(self::$vars) ? $this->isArray() : false;
self::getInstance();
ob_start();
echo '
<!doctype html>
<html lang="' . idioma() . '">';
require self::INCLUDES . 'head.php';
echo '<body>';
require self::INCLUDES . 'header.php';
require self::VIEWS . self::$template . '.php';
require self::INCLUDES . 'footer.php';
echo '</body>
</html>';
self::$templateContent = ob_get_clean();
}
public static function view($template, $vars = null)
{
self::$template = $template;
self::$vars = $vars;
self::html();
return self::$templateContent;
}
public function abort404($message)
{
http_response_code(404);
view('404');
exit();
/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/core
/vendor
/grdar
/core
/src
/Views
/View.php
$container = Container::getInstance();
return get_object_vars($container);
}
public static function html()
{
isset(self::$vars) ? $this->isArray() : false;
self::getInstance();
ob_start();
echo '
<!doctype html>
<html lang="' . idioma() . '">';
require self::INCLUDES . 'head.php';
echo '<body>';
require self::INCLUDES . 'header.php';
require self::VIEWS . self::$template . '.php';
require self::INCLUDES . 'footer.php';
echo '</body>
</html>';
self::$templateContent = ob_get_clean();
}
public static function view($template, $vars = null)
{
self::$template = $template;
self::$vars = $vars;
self::html();
return self::$templateContent;
}
public function abort404($message)
{
http_response_code(404);
view('404');
exit();
/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/core
/vendor
/grdar
/core
/src
/Views
/View.php
echo '
<!doctype html>
<html lang="' . idioma() . '">';
require self::INCLUDES . 'head.php';
echo '<body>';
require self::INCLUDES . 'header.php';
require self::VIEWS . self::$template . '.php';
require self::INCLUDES . 'footer.php';
echo '</body>
</html>';
self::$templateContent = ob_get_clean();
}
public static function view($template, $vars = null)
{
self::$template = $template;
self::$vars = $vars;
self::html();
return self::$templateContent;
}
public function abort404($message)
{
http_response_code(404);
view('404');
exit();
}
}
/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/core
/classes
/Controllers
/IndexController.php
<?php
namespace GRDAR\Controllers;
use Grdar\core\Views\View;
class IndexController
{
const IDIOMAS = IDIOMAS;
protected static function checkIdioma($lang)
{
$langs = explode('/', self::IDIOMAS);
if (!in_array($lang, $langs)) {
$_GET['page'] = '404';
$_GET['lang'] = 'es';
header('HTTP/1.1 404 Not Found');
exit(View::view('404'));
}
$_GET['lang'] = $lang;
}
public static function index($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Home-Aucanada';
return View::view('index');
}
public static function cookies($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Cookies-Aucanada';
return View::view('cookies');
}
public static function politica($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Politica-Aucanada';
return View::view('politica');
}
/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/core
/classes
/Controllers
/IndexController.php
class IndexController
{
const IDIOMAS = IDIOMAS;
protected static function checkIdioma($lang)
{
$langs = explode('/', self::IDIOMAS);
if (!in_array($lang, $langs)) {
$_GET['page'] = '404';
$_GET['lang'] = 'es';
header('HTTP/1.1 404 Not Found');
exit(View::view('404'));
}
$_GET['lang'] = $lang;
}
public static function index($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Home-Aucanada';
return View::view('index');
}
public static function cookies($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Cookies-Aucanada';
return View::view('cookies');
}
public static function politica($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Politica-Aucanada';
return View::view('politica');
}
public static function aviso($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Nota-Legal-Aucanada';
return View::view('aviso-legal');
/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/core
/vendor
/grdar
/core
/src
/Routes
/Route.php
{
return $this->parameters;
}
public function checkIfMatch($requestUri)
{
$uriPattern = $this->getUriPattern();
if (preg_match($uriPattern, $requestUri, $matches))
{
$this->resolveParameters($matches);
return true;
}
return false;
}
public function execute()
{
$closure = $this->closure;
$parameters = $this->getParameters();
return call_user_func_array($closure, $parameters);
}
}
/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/core
/vendor
/grdar
/core
/src
/Routes
/Route.php
{
return $this->parameters;
}
public function checkIfMatch($requestUri)
{
$uriPattern = $this->getUriPattern();
if (preg_match($uriPattern, $requestUri, $matches))
{
$this->resolveParameters($matches);
return true;
}
return false;
}
public function execute()
{
$closure = $this->closure;
$parameters = $this->getParameters();
return call_user_func_array($closure, $parameters);
}
}
/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/core
/vendor
/grdar
/core
/src
/Routes
/Router.php
public function getRequestUri()
{
return $this->requestUri;
}
public function add($uri, $closure)
{
$route = new Route($uri, $closure);
array_push($this->routes, $route);
}
public function run()
{
$response = false;
$requestUri = $this->getRequestUri();
foreach ($this->routes as $route)
{
if ($route->checkIfMatch($requestUri))
{
$response = $route->execute();
// break para no seguir dando vueltas
// Ya se encontró la ruta correspondiente
break;
}
}
$this->sendResponse($response);
}
public function sendResponse($response)
{
if (is_string($response))
{
echo $response;
}
else if (is_array($response))
{
echo json_encode($response);
}
else if ($response instanceof Response)
/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/core
/vendor
/grdar
/core
/src
/Facades
/Facade.php
{
return static::$container;
}
public static function getAccessor()
{
throw new Exception('Please define the getAccessor method in your facade');
}
public static function getInstance()
{
return static::getContainer()->make(static::getAccessor());
}
public static function __callStatic($method, $args)
{
$object = static::getInstance();
switch (count($args)) {
case 0:
return $object->$method();
case 1:
return $object->$method($args[0]);
case 2:
return $object->$method($args[0], $args[1]);
case 3:
return $object->$method($args[0], $args[1], $args[2]);
default:
return call_user_func_array(array($object, $method), $args);
}
}
}
/var
/www
/vhosts
/grdar.cloud
/restaurantegolfalcanada.com
/index.php
//TODO Hacerlo automaticon con la tabla seo_paginas
// Rutas aplicación
Rout::add('/:lang/404', 'Index::p404');
Rout::add('/:lang', 'Index::index');
Rout::add('/:lang/' . PATHS_APP['Politica-Aucanada'][$idioma]["url"], 'Index::politica');
Rout::add('/:lang/' . PATHS_APP['Nota-Legal-Aucanada'][$idioma]["url"], 'Index::aviso');
Rout::add('/:lang/' . PATHS_APP['Cookies-Aucanada'][$idioma]["url"], 'Index::cookies');
Rout::add('/:lang/' . PATHS_APP['Condiciones-Aucanada'][$idioma]["url"], 'Index::condiciones');
Rout::add('/:lang/' . PATHS_APP['Ecommerce'][$idioma]["url"], 'Index::carta');
/* Rout::add('/:lang/' . PATHS_APP['Actualidad'][$idioma]["url"], 'Index::blog');
Rout::add('/:lang/' . PATHS_APP['Actualidad'][$idioma]["url"].'/:post', 'Index::post'); */
// Rout::add('/:lang/' . PATHS_APP['Somos-Tirme'][$idioma]["url"], 'Index::somostirme');
Rout::run();
ob_end_flush();