aboutsummaryrefslogtreecommitdiff
path: root/app/class
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-01-10 22:44:39 +0100
committervincent-peugnet <v.peugnet@free.fr>2019-01-10 22:44:39 +0100
commitcc7ad5299f1bd14155d4c01af3a4ece28f85c20c (patch)
tree0aea5a3253e98525286ace4240c449372f12e3ef /app/class
parent6f0f6c3f8ff7a2e17ecff410b5f0e974e4dad4cb (diff)
downloadwcms-cc7ad5299f1bd14155d4c01af3a4ece28f85c20c.tar.gz
wcms-cc7ad5299f1bd14155d4c01af3a4ece28f85c20c.zip
bug fixies
Diffstat (limited to 'app/class')
-rw-r--r--app/class/art2.php10
-rw-r--r--app/class/controller.php3
-rw-r--r--app/class/modelrender.php2
3 files changed, 11 insertions, 4 deletions
diff --git a/app/class/art2.php b/app/class/art2.php
index cb4949d..a378bd4 100644
--- a/app/class/art2.php
+++ b/app/class/art2.php
@@ -152,7 +152,11 @@ class Art2
public function description($type = 'string')
{
- return $this->description;
+ if($type == 'short' && strlen($this->description) > 15 ) {
+ return substr($this->description, 0, 15) . '.';
+ } else {
+ return $this->description;
+ }
}
public function tag($option = 'array')
@@ -441,7 +445,7 @@ class Art2
public function setid($id)
{
- if (strlen($id) < Model::MAX_ID_LENGTH and is_string($id)) {
+ if (strlen($id) <= Model::MAX_ID_LENGTH and is_string($id)) {
$this->id = strip_tags(strtolower(str_replace(" ", "", $id)));
}
}
@@ -687,7 +691,7 @@ class Art2
public function settemplateoptions($templateoptions)
{
if(is_array($templateoptions)) {
- $this->templateoptions = array_filter($templateoptions);
+ $this->templateoptions = array_values(array_filter($templateoptions));
}
}
diff --git a/app/class/controller.php b/app/class/controller.php
index eef6967..65d61c3 100644
--- a/app/class/controller.php
+++ b/app/class/controller.php
@@ -6,6 +6,9 @@ class Controller
* @var User
*/
protected $user;
+ /**
+ * @var Routes
+ */
protected $router;
/**
* @var Modeluser
diff --git a/app/class/modelrender.php b/app/class/modelrender.php
index d1a924c..413b8de 100644
--- a/app/class/modelrender.php
+++ b/app/class/modelrender.php
@@ -255,7 +255,7 @@ class Modelrender extends Modelart
public function media(string $text) : string
{
- $text = preg_replace('%(src|href)="(\/?[\w-_]+\.[a-z0-9]{1,5})"%', '$1="' . Model::mediapath() . '$2" target="_blank" class="media"', $text);
+ $text = preg_replace('%(src|href)="([\w-_]+(\/([\w-_])+)*\.[a-z0-9]{1,5})"%', '$1="' . Model::mediapath() . '$2" target="_blank" class="media"', $text);
if (!is_string($text)) {
throw new Exception('Rendering error -> media module');
}