/var
/www
/vhosts
/grdar.cloud
/fotokamal.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
/fotokamal.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
/fotokamal.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
/fotokamal.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';
return View::view('index');
}
public static function sechome($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Second-Home';
return View::view('index2');
}
public static function estudio($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Estudio';
return View::view('estudio');
/var
/www
/vhosts
/grdar.cloud
/fotokamal.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';
return View::view('index');
}
public static function sechome($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Second-Home';
return View::view('index2');
}
public static function estudio($lang)
{
self::checkIdioma($lang);
$_GET['page'] = 'Estudio';
return View::view('estudio');
}
/* public static function proyectos($lang, $categoria = null)
{
self::checkIdioma($lang);
/var
/www
/vhosts
/grdar.cloud
/fotokamal.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
/fotokamal.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
/fotokamal.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
/fotokamal.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
/fotokamal.com
/index.php
Rout::add('/:lang/' . PATHS_APP['Blog'][$idioma]["url"].'/'. PATHS_APP['Categoria'][$idioma]["url"] . '/:category', 'Index::blog');
/* Rout::add('/:lang/' . PATHS_APP['Blog'][$idioma]["url"].'/'. PATHS_APP['Buscar'][$idioma]["url"] . '/:buscar', 'Index::novedadesb'); */
Rout::add('/:lang/' . PATHS_APP['Nota-Legal'][$idioma]["url"], 'Index::notaLegal');
Rout::add('/:lang/' . PATHS_APP['Politica'][$idioma]["url"], 'Index::politica');
Rout::add('/:lang/' . PATHS_APP['Cookies'][$idioma]["url"], 'Index::cookies');
Rout::add('/:lang/' . PATHS_APP['Condiciones-Uso'][$idioma]["url"], 'Index::condicionesUso');
Rout::add('/:lang/' . PATHS_APP['Family-Wedding'][$idioma]["url"], 'Index::familywedding');
Rout::add('/:lang/' . PATHS_APP['Family-Wedding-Blog'][$idioma]["url"], 'Index::familyweddingblog');
Rout::add('/:lang/' . PATHS_APP['Family-Wedding-Blog'][$idioma]["url"]. '/:categoria', 'Index::familyweddingblog');
Rout::add('/:lang/' . PATHS_APP['Family-Wedding-Post'][$idioma]["url"]. '/:post', 'Index::familyweddingpost');
Rout::run();
ob_end_flush();