aboutsummaryrefslogtreecommitdiff
path: root/app/class
diff options
context:
space:
mode:
Diffstat (limited to 'app/class')
-rw-r--r--app/class/art2.php8
-rw-r--r--app/class/config.php2
-rw-r--r--app/class/controller.php4
-rw-r--r--app/class/routes.php2
4 files changed, 10 insertions, 6 deletions
diff --git a/app/class/art2.php b/app/class/art2.php
index 867b17a..3ba23cb 100644
--- a/app/class/art2.php
+++ b/app/class/art2.php
@@ -44,14 +44,14 @@ class Art2
// _____________________________________________________ F U N ____________________________________________________
- public function __construct($donnees)
+ public function __construct($datas = [])
{
- $this->hydrate($donnees);
+ $this->hydrate($datas);
}
- public function hydrate($donnees)
+ public function hydrate($datas)
{
- foreach ($donnees as $key => $value) {
+ foreach ($datas as $key => $value) {
$method = 'set' . $key;
if (method_exists($this, $method)) {
diff --git a/app/class/config.php b/app/class/config.php
index 495c008..83982de 100644
--- a/app/class/config.php
+++ b/app/class/config.php
@@ -63,7 +63,7 @@ abstract class Config
public static function checkbasepath()
{
- $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . self::basepath() . Model::CONFIG_FILE;
+ $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . self::basepath() . DIRECTORY_SEPARATOR . Model::CONFIG_FILE;
return (file_exists($path));
}
diff --git a/app/class/controller.php b/app/class/controller.php
index c8c620e..afeefb0 100644
--- a/app/class/controller.php
+++ b/app/class/controller.php
@@ -23,7 +23,11 @@ class Controller
public function initplates()
{
+ $router = $this->router;
$this->plates = new League\Plates\Engine(Model::TEMPLATES_DIR);
+ $this->plates->registerFunction('url', function (string $string, array $vars = []) use ($router) {
+ return $router->generate($string, $vars);
+ });
}
public function useriseditor()
diff --git a/app/class/routes.php b/app/class/routes.php
index f24492b..bd9fd71 100644
--- a/app/class/routes.php
+++ b/app/class/routes.php
@@ -9,7 +9,7 @@ class Routes
public function match()
{
$router = new AltoRouter();
- $router->setBasePath(Config::basepath());
+ $router->setBasePath('/' . Config::basepath());
$router->addRoutes([
['GET|POST', '/', 'Backrouter#run', 'backrouter'],
['GET', '/[a:art]/', 'Controllerart#read', 'artread/'],