diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/class/Application.php | 29 | ||||
-rw-r--r-- | app/class/Colors.php | 4 | ||||
-rw-r--r-- | app/class/Config.php | 2 | ||||
-rw-r--r-- | app/class/Controllermedia.php | 6 | ||||
-rw-r--r-- | app/class/Element.php | 2 | ||||
-rw-r--r-- | app/class/Event.php | 16 | ||||
-rw-r--r-- | app/class/Media.php | 9 | ||||
-rw-r--r-- | app/class/Medialist.php | 16 | ||||
-rw-r--r-- | app/class/Modelfont.php | 5 | ||||
-rw-r--r-- | app/class/Modelmedia.php | 38 | ||||
-rw-r--r-- | app/class/Modelrender.php | 88 | ||||
-rw-r--r-- | app/class/Opt.php | 24 | ||||
-rw-r--r-- | app/class/Optlist.php | 11 | ||||
-rw-r--r-- | app/class/Quickcss.php | 35 | ||||
-rw-r--r-- | app/fn/fn.php | 5 |
15 files changed, 201 insertions, 89 deletions
diff --git a/app/class/Application.php b/app/class/Application.php index 0f69064..ab745a9 100644 --- a/app/class/Application.php +++ b/app/class/Application.php @@ -102,7 +102,10 @@ class Application <label for="basepath">Path to W-CMS</label> </h2> <input type="text" name="configinit[basepath]" value="<?= Config::basepath() ?>" id="basepath"> - <p><i>Leave it empty if W-CMS is in your root folder, otherwise, indicate the subfolder(s) in witch you installed the CMS</i></p> + <p><i> + Leave it empty if W-CMS is in your root folder, otherwise, + indicate the subfolder(s) in witch you installed the CMS + </i></p> </div> <div> <h2> @@ -115,8 +118,19 @@ class Application <h2> <label for="secretkey">Secret Key</label> </h2> - <input type="text" name="configinit[secretkey]" value="<?= bin2hex(random_bytes(10)) ?>" id="secretkey" minlength="16" maxlength="128" required> - <p><i>The secret key is used to secure cookies. There are no need to remind it. (16 to 128 characters)</i></p> + <input + type="text" + name="configinit[secretkey]" + value="<?= bin2hex(random_bytes(10)) ?>" + id="secretkey" + minlength="<?= Config::SECRET_KEY_MIN ?>" + maxlength="<?= Config::SECRET_KEY_MAX ?>" + required + > + <p><i> + The secret key is used to secure cookies. There are no need to remind it. + (16 to 128 characters) + </i></p> </div> <input type="submit" value="set"> </form> @@ -140,7 +154,14 @@ class Application <h2> <label for="password">Your password</label> </h2> - <input type="password" name="userinit[password]" id="password" minlength="<?= Model::PASSWORD_MIN_LENGTH ?>" maxlength="<?= Model::PASSWORD_MAX_LENGTH ?>" required> + <input + type="password" + name="userinit[password]" + id="password" + minlength="<?= Model::PASSWORD_MIN_LENGTH ?>" + maxlength="<?= Model::PASSWORD_MAX_LENGTH ?>" + required + > <p><i>Your user passworder as first administrator.</i></p> </div> <input type="submit" value="set"> diff --git a/app/class/Colors.php b/app/class/Colors.php index 06875b5..234adb2 100644 --- a/app/class/Colors.php +++ b/app/class/Colors.php @@ -88,7 +88,9 @@ class Colors extends Item { $html = '<ul>'; foreach ($this->tagcolor as $tag => $color) { - $html .= PHP_EOL . '<li><input type="color" name="tagcolor[' . $tag . ']" value="' . $color . '" id="color_' . $tag . '"><label for="color_' . $tag . '" >' . $tag . '</label></li>'; + $i = '<input type="color" name="tagcolor[' . $tag . ']" value="' . $color . '" id="color_' . $tag . '">'; + $l = '<label for="color_' . $tag . '" >' . $tag . '</label>'; + $html .= '\n<li>' . $i . $l . '</li>'; } $html .= PHP_EOL . '</ul>'; return $html; diff --git a/app/class/Config.php b/app/class/Config.php index 74f2757..3c9afd9 100644 --- a/app/class/Config.php +++ b/app/class/Config.php @@ -21,7 +21,7 @@ abstract class Config protected static $privatepass = false; protected static $notpublishedpass = false; protected static $alertcss = false; - protected static $defaultbody = '%HEADER%' . PHP_EOL . PHP_EOL . '%NAV%' . PHP_EOL . PHP_EOL . '%ASIDE%' . PHP_EOL . PHP_EOL . '%MAIN%' . PHP_EOL . PHP_EOL . '%FOOTER%'; + protected static $defaultbody = '%HEADER%\n\n%NAV%\n\n%ASIDE%\n\n%MAIN%\n\n%FOOTER%'; protected static $defaultfavicon = ''; protected static $defaultthumbnail = ''; protected static $analytics = ''; diff --git a/app/class/Controllermedia.php b/app/class/Controllermedia.php index 11a27d3..06885b3 100644 --- a/app/class/Controllermedia.php +++ b/app/class/Controllermedia.php @@ -102,7 +102,11 @@ class Controllermedia extends Controller { if ($this->user->issupereditor() && isset($_POST['action']) && isset($_POST['id'])) { if ($_POST['action'] == 'delete') { - $this->mediamanager->multifiledelete($_POST['id']); + if ($this->mediamanager->multifiledelete($_POST['id'])) { + Model::sendflashmessage('Files deletion successfull', 'success'); + } else { + Model::sendflashmessage('Error while deleting files', 'error'); + } } elseif ($_POST['action'] == 'move' && isset($_POST['dir'])) { $this->mediamanager->multimovefile($_POST['id'], $_POST['dir']); } diff --git a/app/class/Element.php b/app/class/Element.php index 3160986..638d624 100644 --- a/app/class/Element.php +++ b/app/class/Element.php @@ -46,7 +46,7 @@ class Element extends Item public function addtags() { - $this->content = PHP_EOL . '<' . $this->type() . '>' . PHP_EOL . $this->content() . PHP_EOL . '</' . $this->type() . '>' . PHP_EOL; + $this->content = '\n<' . $this->type() . '>\n' . $this->content() . '\n</' . $this->type() . '>\n'; } diff --git a/app/class/Event.php b/app/class/Event.php index c14b0e8..3317a1b 100644 --- a/app/class/Event.php +++ b/app/class/Event.php @@ -16,7 +16,15 @@ class Event extends Dbitem protected $message; protected $clap = 0; - public const EVENT_TYPES = ['message', 'page_add', 'page_edit', 'page_delete', 'media_add', 'media_delete', 'font_add']; + public const EVENT_TYPES = [ + 'message', + 'page_add', + 'page_edit', + 'page_delete', + 'media_add', + 'media_delete', + 'font_add' + ]; public const EVENT_BASE = ['message']; public const EVENT_ART = ['page_add', 'page_edit', 'page_delete']; public const EVENT_MEDIA = ['media_add', 'media_delete']; @@ -112,7 +120,11 @@ class Event extends Dbitem if ($date instanceof DateTimeImmutable) { $this->date = $date; } elseif (is_string($date)) { - $this->date = DateTimeImmutable::createFromFormat(DateTime::ISO8601, $date, new DateTimeZone('Europe/Paris')); + $this->date = DateTimeImmutable::createFromFormat( + DateTime::ISO8601, + $date, + new DateTimeZone('Europe/Paris') + ); } } diff --git a/app/class/Media.php b/app/class/Media.php index def4645..9df2fef 100644 --- a/app/class/Media.php +++ b/app/class/Media.php @@ -100,7 +100,10 @@ class Media extends Item break; case 'video': - $code = '<video controls=""><source src="' . $this->getincludepath() . '" type="video/' . $this->extension . '"></video>'; + $src = $this->getincludepath(); + $ext = $this->extension; + $code = '<video controls="">'; + $code .= '<source src="' . $src . '" type="video/' . $ext . '"></video>'; break; default: @@ -267,14 +270,14 @@ class Media extends Item public function setwidth($width) { if (is_int($width)) { - $this->width = strip_tags(strtolower($width)); + $this->width = $width; } } public function setheight($height) { if (is_int($height)) { - $this->height = strip_tags(strtolower($height)); + $this->height = $height; } } diff --git a/app/class/Medialist.php b/app/class/Medialist.php index 35ea991..c597505 100644 --- a/app/class/Medialist.php +++ b/app/class/Medialist.php @@ -28,7 +28,7 @@ class Medialist extends Item /** @var int display download links*/ protected $links = 0; - /** @var string display the file name of the file */ + /** @var int display the file name of the file */ protected $filename = 0; public const TYPES = ['image', 'sound', 'video', 'other']; @@ -56,7 +56,6 @@ class Medialist extends Item $mediamanager = new Modelmedia(); $medialist = $mediamanager->getlistermedia($this->dir(), $this->type); if (!$medialist) { - $this->content = '<strong>RENDERING ERROR :</strong> path : <code>' . Model::MEDIA_DIR . $this->path . '/</code> does not exist'; return false; } else { $mediamanager->medialistsort($medialist, $this->sortby, $this->order); @@ -67,14 +66,19 @@ class Medialist extends Item foreach ($medialist as $media) { $div .= '<div class="content ' . $media->type() . '">'; + $id = 'id="media_' . $media->id() . '"'; + $path = $media->getincludepath(); + $ext = $media->extension(); if ($media->type() == 'image') { - $div .= '<img alt="' . $media->id() . '" id="' . $media->id() . '" src="' . $media->getincludepath() . '" >'; + $div .= '<img alt="' . $media->id() . '" ' . $id . ' src="' . $path . '" >'; } elseif ($media->type() == 'sound') { - $div .= '<audio id="' . $media->id() . '" controls src="' . $media->getincludepath() . '" </audio>'; + $div .= '<audio ' . $id . ' controls src="' . $path . '" </audio>'; } elseif ($media->type() == 'video') { - $div .= '<video controls><source src="' . $media->getincludepath() . '" type="video/' . $media->extension() . '"></video>'; + $source = '<source src="' . $path . '" type="video/' . $ext . '" ' . $id . '>'; + $div .= '<video controls>' . $source . '</video>'; } else { - $div .= '<a href="' . $media->getincludepath() . '" target="_blank" class="media" >' . $media->id() . '.' . $media->extension() . '</a>'; + $name = $media->id() . '.' . $ext; + $div .= '<a href="' . $path . '" target="_blank" class="media" ' . $id . '>' . $name . '</a>'; } $div .= '</div>' . PHP_EOL; } diff --git a/app/class/Modelfont.php b/app/class/Modelfont.php index 4353b1c..be8de81 100644 --- a/app/class/Modelfont.php +++ b/app/class/Modelfont.php @@ -69,7 +69,10 @@ class Modelfont extends Model { $fontface = ''; foreach ($fontlist as $font) { - $fontface .= '@font-face {' . PHP_EOL . 'font-family: ' . $font['id'] . ';' . PHP_EOL . ' src: url( ' . Model::fontpath() . $font['id'] . '.' . $font['ext'] . ');' . PHP_EOL . '}' . PHP_EOL . PHP_EOL; + $fontface .= '@font-face {\n + font-family: ' . $font['id'] . ';\n + src: url( ' . Model::fontpath() . $font['id'] . '.' . $font['ext'] . '); + }\n\n'; } return $fontface; } diff --git a/app/class/Modelmedia.php b/app/class/Modelmedia.php index fc8a727..ceb9bc7 100644 --- a/app/class/Modelmedia.php +++ b/app/class/Modelmedia.php @@ -2,6 +2,8 @@ namespace Wcms; +use phpDocumentor\Reflection\Types\Mixed_; + class Modelmedia extends Model { @@ -38,36 +40,33 @@ class Modelmedia extends Model } /** - * Display a list of media + * get a list of media of selected types * - * @param string $path + * @param string $dir Media directory ot look at * @param array $type * - * @return array of Media objects + * @return Media[]|bool of Media objects */ public function getlistermedia($dir, $type = []) { - if (is_dir($dir)) { - if ($handle = opendir($dir)) { - $list = []; - while (false !== ($entry = readdir($handle))) { - if ($entry != "." && $entry != "..") { - $media = $this->getmedia($entry, $dir); - - if ($media != false) { - $media->analyse(); - - if (empty($type) || in_array($media->type(), $type)) { - $list[] = $media; - } + if (is_dir($dir) && $handle = opendir($dir)) { + $list = []; + while (false !== ($entry = readdir($handle))) { + if ($entry != "." && $entry != "..") { + $media = $this->getmedia($entry, $dir); + + if ($media != false) { + $media->analyse(); + + if (empty($type) || in_array($media->type(), $type)) { + $list[] = $media; } } } - return $list; } - } else { - return false; + return $list; } + return false; } @@ -313,7 +312,6 @@ class Modelmedia extends Model $success[] = $this->deletefile($filedir); } } - Model::sendflashmessage(count(array_filter($success)) . ' / ' . count($filelist) . ' files have been deleted', 'success'); if (in_array(false, $success)) { return false; } else { diff --git a/app/class/Modelrender.php b/app/class/Modelrender.php index a683d65..553857b 100644 --- a/app/class/Modelrender.php +++ b/app/class/Modelrender.php @@ -84,7 +84,7 @@ class Modelrender extends Modelpage $body = $this->getbody($this->readbody()); $parsebody = $this->bodyparser($body); - $html = '<!DOCTYPE html>' . PHP_EOL . '<html>' . PHP_EOL . '<head>' . PHP_EOL . $head . PHP_EOL . '</head>' . PHP_EOL . $parsebody . PHP_EOL . '</html>'; + $html = '<!DOCTYPE html>\n<html>\n<head>\n' . $head . '\n</head>\n' . $parsebody . '\N</html>'; return $html; } @@ -158,10 +158,12 @@ class Modelrender extends Modelpage $subcontent = $this->getpageelement($source, $type); if ($subcontent !== false) { if (empty($subcontent && self::RENDER_VERBOSE > 0)) { - $subcontent = PHP_EOL . '<!-- The ' . strtoupper($type) . ' from page "' . $source . '" is currently empty ! -->' . PHP_EOL; + $message = 'The ' . strtoupper($type) . ' from page "' . $source . '" is currently empty !'; + $subcontent = '\n<!-- ' . $message . ' -->\n'; } } else { - $read = '<h2>Rendering error :</h2><p>The page <strong><code>' . $source . '</code></strong>, does not exist yet.</p>'; + $read = '<h2>Rendering error :</h2>'; + $read .= '<p>The page <strong><code>' . $source . '</code></strong>, does not exist yet.</p>'; //throw new Exception($read); } } else { @@ -227,38 +229,42 @@ class Modelrender extends Modelpage $head = ''; - $head .= '<meta charset="utf-8" />' . PHP_EOL; - $head .= '<title>' . $this->page->title() . '</title>' . PHP_EOL; + $head .= '<meta charset="utf-8" />\n'; + $head .= '<title>' . $this->page->title() . '</title>\n'; if (!empty($this->page->favicon())) { - $head .= '<link rel="shortcut icon" href="' . Model::faviconpath() . $this->page->favicon() . '" type="image/x-icon">'; + $href = Model::faviconpath() . $this->page->favicon(); + $head .= '<link rel="shortcut icon" href="' . $href . '" type="image/x-icon">'; } elseif (!empty(Config::defaultfavicon())) { - $head .= '<link rel="shortcut icon" href="' . Model::faviconpath() . Config::defaultfavicon() . '" type="image/x-icon">'; + $href = Model::faviconpath() . Config::defaultfavicon(); + $head .= '<link rel="shortcut icon" href="' . $href . '" type="image/x-icon">'; } - $head .= '<meta name="description" content="' . $this->page->description() . '" />' . PHP_EOL; - $head .= '<meta name="viewport" content="width=device-width" />' . PHP_EOL; + $head .= '<meta name="description" content="' . $this->page->description() . '" />\n'; + $head .= '<meta name="viewport" content="width=device-width" />\n'; - $head .= '<meta property="og:title" content="' . $this->page->title() . '">' . PHP_EOL; - $head .= '<meta property="og:description" content="' . $this->page->description() . '">' . PHP_EOL; + $head .= '<meta property="og:title" content="' . $this->page->title() . '">\n'; + $head .= '<meta property="og:description" content="' . $this->page->description() . '">\n'; if (!empty($this->page->thumbnail())) { - $head .= '<meta property="og:image" content="' . Config::domain() . self::thumbnailpath() . $this->page->thumbnail() . '">' . PHP_EOL; + $content = Config::domain() . self::thumbnailpath() . $this->page->thumbnail(); + $head .= '<meta property="og:image" content="' . $content . '">\n'; } elseif (!empty(Config::defaultthumbnail())) { - $head .= '<meta property="og:image" content="' . Config::domain() . self::thumbnailpath() . Config::defaultthumbnail() . '">' . PHP_EOL; + $content = Config::domain() . self::thumbnailpath() . Config::defaultthumbnail(); + $head .= '<meta property="og:image" content="' . $content . '">\n'; } - $head .= '<meta property="og:url" content="' . Config::url() . $this->page->id() . '/">' . PHP_EOL; + $head .= '<meta property="og:url" content="' . Config::url() . $this->page->id() . '/">\n'; foreach ($this->page->externalcss() as $externalcss) { - $head .= '<link href="' . $externalcss . '" rel="stylesheet" />' . PHP_EOL; + $head .= '<link href="' . $externalcss . '" rel="stylesheet" />\n'; } if (!empty($this->page->templatecss() && in_array('externalcss', $this->page->templateoptions()))) { $templatecss = $this->get($this->page->templatecss()); if ($templatecss !== false) { foreach ($templatecss->externalcss() as $externalcss) { - $head .= '<link href="' . $externalcss . '" rel="stylesheet" />' . PHP_EOL; + $head .= '<link href="' . $externalcss . '" rel="stylesheet" />\n'; } } } @@ -266,25 +272,25 @@ class Modelrender extends Modelpage $head .= PHP_EOL . $this->page->customhead() . PHP_EOL; - $head .= '<link href="' . Model::globalpath() . 'fonts.css" rel="stylesheet" />' . PHP_EOL; - $head .= '<link href="' . Model::globalpath() . 'global.css" rel="stylesheet" />' . PHP_EOL; + $head .= '<link href="' . Model::globalpath() . 'fonts.css" rel="stylesheet" />\n'; + $head .= '<link href="' . Model::globalpath() . 'global.css" rel="stylesheet" />\n'; if (!empty($this->page->templatecss())) { $tempaltecsspage = $this->page->templatecss(); - $head .= '<link href="' . Model::renderpath() . $tempaltecsspage . '.css" rel="stylesheet" />' . PHP_EOL; + $head .= '<link href="' . Model::renderpath() . $tempaltecsspage . '.css" rel="stylesheet" />\n'; } - $head .= '<link href="' . Model::renderpath() . $this->page->id() . '.css" rel="stylesheet" />' . PHP_EOL; + $head .= '<link href="' . Model::renderpath() . $this->page->id() . '.css" rel="stylesheet" />\n'; if (!empty($this->page->templatejavascript())) { $templatejspage = $this->page->templatejavascript(); - $head .= '<script src="' . Model::renderpath() . $templatejspage . '.js" async/></script>' . PHP_EOL; + $head .= '<script src="' . Model::renderpath() . $templatejspage . '.js" async/></script>\n'; } if (!empty($this->page->javascript())) { - $head .= '<script src="' . Model::renderpath() . $this->page->id() . '.js" async/></script>' . PHP_EOL; + $head .= '<script src="' . Model::renderpath() . $this->page->id() . '.js" async/></script>\n'; } if (!empty(Config::analytics())) { - $head .= PHP_EOL . ' + $head .= '\n <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=' . Config::analytics() . '"></script> <script> @@ -294,16 +300,16 @@ class Modelrender extends Modelpage gtag(\'config\', \'' . Config::analytics() . '\'); </script> - ' . PHP_EOL; + \n'; } if (!empty($this->page->redirection())) { if (preg_match('%https?:\/\/\S*%', $this->page->redirection(), $out)) { $url = $out[0]; - $head .= PHP_EOL . '<meta http-equiv="refresh" content="' . $this->page->refresh() . '; URL=' . $url . '" />'; + $head .= '\n<meta http-equiv="refresh" content="' . $this->page->refresh() . '; URL=' . $url . '" />'; } elseif (key_exists($this->page->redirection(), $this->pagelist())) { $url = $this->upage($this->page->redirection()); - $head .= PHP_EOL . '<meta http-equiv="refresh" content="' . $this->page->refresh() . '; URL=' . $url . '" />'; + $head .= '\n<meta http-equiv="refresh" content="' . $this->page->refresh() . '; URL=' . $url . '" />'; } } @@ -343,7 +349,8 @@ class Modelrender extends Modelpage public function media(string $text): string { - $text = preg_replace('%(src|href)="([\w-_]+(\/([\w-_])+)*\.[a-z0-9]{1,5})"%', '$1="' . Model::mediapath() . '$2" target="_blank" class="media"', $text); + $regex = '%(src|href)="([\w-_]+(\/([\w-_])+)*\.[a-z0-9]{1,5})"%'; + $text = preg_replace($regex, '$1="' . Model::mediapath() . '$2" target="_blank" class="media"', $text); if (!is_string($text)) { //throw new Exception('Rendering error -> media module'); } @@ -381,11 +388,16 @@ class Modelrender extends Modelpage function ($matches) use ($rend, &$linkto) { $matchpage = $rend->get($matches[1]); if (!$matchpage) { - $link = 'href="' . $rend->upage($matches[1]) . '"" title="' . Config::existnot() . '" class="internal existnot"' . $this->internallinkblank; + $href = $rend->upage($matches[1]); + $t = Config::existnot(); + $c = 'internal existnot"' . $this->internallinkblank; } else { + $href = $rend->upage($matches[1]) . $matches[2]; + $t = $matchpage->description(); + $c = 'internal exist ' . $matchpage->secure('string'); $linkto[] = $matchpage->id(); - $link = 'href="' . $rend->upage($matches[1]) . $matches[2] . '" title="' . $matchpage->description() . '" class="internal exist ' . $matchpage->secure('string') . '"' . $this->internallinkblank; } + $link = 'href="' . $href . '" title="' . $t . '" class="' . $c . '"' . $this->internallinkblank; return $link; }, $text @@ -403,11 +415,19 @@ class Modelrender extends Modelpage function ($matches) use ($rend, &$linkto) { $matchpage = $rend->get($matches[1]); if (!$matchpage) { - return '<a href="' . $rend->upage($matches[1]) . '"" title="' . Config::existnot() . '" class="internal existnot" ' . $this->internallinkblank . ' >' . $matches[1] . '</a>'; + $href = $rend->upage($matches[1]); + $t = Config::existnot(); + $c = 'internal existnot" ' . $this->internallinkblank; + $a = $matches[1]; } else { + $href = $rend->upage($matches[1]) . $matches[2]; + $t = $matchpage->description(); + $c = 'internal exist ' . $matchpage->secure('string'); + $a = $matchpage->title(); $linkto[] = $matchpage->id(); - return '<a href="' . $rend->upage($matches[1]) . $matches[2] . '" title="' . $matchpage->description() . '" class="internal exist ' . $matchpage->secure('string') . '" ' . $this->internallinkblank . ' >' . $matchpage->title() . '</a>'; } + $i = $this->internallinkblank; + return '<a href="' . $href . '" title="' . $t . '" class="' . $c . '" ' . $i . ' >' . $a . '</a>'; }, $text ); @@ -478,7 +498,7 @@ class Modelrender extends Modelpage } else { $id = ' '; } - return '<article ' . $id . ' markdown="1" >' . PHP_EOL . PHP_EOL . $matches[3] . PHP_EOL . PHP_EOL . '</article>' . PHP_EOL . PHP_EOL; + return '<article ' . $id . ' markdown="1" >\n\n' . $matches[3] . '\n\n</article>\n\n'; }, $text); $text = preg_replace('/\R\R[=]{3,}([\w-]*)\R/', '', $text); return $text; @@ -591,7 +611,9 @@ class Modelrender extends Modelpage */ public function thumbnail(string $text): string { - $img = '<img class="thumbnail" src="' . Model::thumbnailpath() . $this->page->thumbnail() . '" alt="' . $this->page->title() . '">'; + $src = Model::thumbnailpath() . $this->page->thumbnail(); + $alt = $this->page->title(); + $img = '<img class="thumbnail" src="' . $src . '" alt="' . $alt . '">'; $img = PHP_EOL . $img . PHP_EOL; $text = str_replace('%THUMBNAIL%', $img, $text); diff --git a/app/class/Opt.php b/app/class/Opt.php index 0dc99cf..df3cb50 100644 --- a/app/class/Opt.php +++ b/app/class/Opt.php @@ -148,7 +148,8 @@ class Opt extends Item { $tagstring = ""; foreach ($taglist as $tag) { - $tagstring .= '<a class="tag tag_' . $tag . '" href="?' . $this->getfilteradress(['tagfilter' => [$tag]]) . '" >' . $tag . '</a>' . PHP_EOL; + $href = $this->getfilteradress(['tagfilter' => [$tag]]); + $tagstring .= '<a class="tag tag_' . $tag . '" href="?' . $href . '" >' . $tag . '</a>' . PHP_EOL; } return $tagstring; } @@ -163,21 +164,24 @@ class Opt extends Item { $authorstring = ""; foreach ($authorlist as $author) { - $authorstring .= '<a class="author author_' . $author . '" href="?' . $this->getfilteradress(['authorfilter' => [$author]]) . '" >' . $author . '</a>' . PHP_EOL; + $href = $this->getfilteradress(['authorfilter' => [$author]]); + $authorstring .= '<a class="author author_' . $author . '" href="?' . $href . '" >' . $author . '</a>\n'; } return $authorstring; } public function securelink(int $level, string $secure) { - return '<a class="secure ' . $secure . '" href="?' . $this->getfilteradress(['secure' => $level]) . '">' . $secure . '</a>' . PHP_EOL; + $href = $this->getfilteradress(['secure' => $level]); + return '<a class="secure ' . $secure . '" href="?' . $href . '">' . $secure . '</a>\n'; } public function linktolink(array $linktolist) { $linktostring = ""; foreach ($linktolist as $linkto) { - $linktostring .= '<a class="linkto" href="?' . $this->getfilteradress(['linkto' => $linkto]) . '" >' . $linkto . '</a>' . PHP_EOL; + $href = $this->getfilteradress(['linkto' => $linkto]); + $linktostring .= '<a class="linkto" href="?' . $href . '" >' . $linkto . '</a>\n'; } return $linktostring; } @@ -185,7 +189,17 @@ class Opt extends Item public function getfilteradress(array $vars = []) { - $varlist = ['sortby', 'order', 'secure', 'tagfilter', 'tagcompare', 'authorfilter', 'authorcompare', 'linkto', 'invert', 'limit']; + $varlist = [ + 'sortby', + 'order', + 'secure', + 'tagfilter', + 'tagcompare', + 'authorfilter', + 'authorcompare', + 'linkto', 'invert', + 'limit' + ]; // array_filter($vars, function ()) $object = $this->drylist($varlist); $object = array_merge($object, $vars); diff --git a/app/class/Optlist.php b/app/class/Optlist.php index 63536ee..32107d7 100644 --- a/app/class/Optlist.php +++ b/app/class/Optlist.php @@ -56,16 +56,17 @@ class Optlist extends Opt $content .= '<span class="description">' . $page->description() . '</span>'; } if ($this->date()) { - $content .= '<time datetime="' . $page->date('pdate') . '">' . $page->date('pdate') . '</time>' . PHP_EOL; + $content .= '<time datetime="' . $page->date('pdate') . '">' . $page->date('pdate') . '</time>\n'; } if ($this->time()) { - $content .= '<time datetime="' . $page->date('ptime') . '">' . $page->date('ptime') . '</time>' . PHP_EOL; + $content .= '<time datetime="' . $page->date('ptime') . '">' . $page->date('ptime') . '</time>\n'; } if ($this->author()) { $content .= $page->authors('string') . PHP_EOL; } if ($this->thumbnail) { - $content .= '<img class="thumbnail" src="' . Model::thumbnailpath() . $page->thumbnail() . '" alt="' . $page->title() . '">'; + $src = Model::thumbnailpath() . $page->thumbnail(); + $content .= '<img class="thumbnail" src="' . $src . '" alt="' . $page->title() . '">'; } @@ -93,12 +94,12 @@ class Optlist extends Opt public function li(string $content, string $id) { - return '<li id="' . $id . '">' . PHP_EOL . $content . PHP_EOL . '</li>' . PHP_EOL; + return '<li id="' . $id . '">' . PHP_EOL . $content . PHP_EOL . '</li>\n'; } public function a(string $content, string $class, string $id) { - return '<a ' . $class . ' href="' . $this->render->upage($id) . '">' . $content . '</a>' . PHP_EOL; + return '<a ' . $class . ' href="' . $this->render->upage($id) . '">' . $content . '</a>\n'; } public function spandescription(Page $page) diff --git a/app/class/Quickcss.php b/app/class/Quickcss.php index bddea66..e2ee9f4 100644 --- a/app/class/Quickcss.php +++ b/app/class/Quickcss.php @@ -199,14 +199,23 @@ class Quickcss extends Item echo '<h3>' . $element . '</h3>'; foreach ($css as $param => $value) { echo '<div class="quicklabel">'; - echo '<input type="checkbox" name="active[' . $element . '][' . $param . ']" id="active[' . $element . '][' . $param . ']" checked>'; + echo '<input + type="checkbox" + name="active[' . $element . '][' . $param . ']" + id="active[' . $element . '][' . $param . ']" + checked>'; echo '<label for="active[' . $element . '][' . $param . ']">' . $param . '</label>'; echo '</div>'; echo '<div class="quickinput">'; if (in_array($param, self::COLOR)) { - echo '<input type="color" name="values[' . $element . '][' . $param . ']" value="' . $quickcss[$element][$param] . '" id="values[' . $element . '][' . $param . ']">'; + echo '<input + type="color" + name="values[' . $element . '][' . $param . ']" + value="' . $quickcss[$element][$param] . '" + id="values[' . $element . '][' . $param . ']" + >'; } if (in_array($param, self::SIZE)) { @@ -238,7 +247,12 @@ class Quickcss extends Item public function sizeinput($element, $param, $value) { - echo '<input type="number" name="values[' . $element . '][' . $param . ']" value="' . intval($value) . '" id="values[' . $element . '][' . $param . ']">'; + echo '<input + type="number" + name="values[' . $element . '][' . $param . ']" + value="' . intval($value) . '" + id="values[' . $element . '][' . $param . ']" + >'; $unit = preg_replace('/\d/', '', $value); ?> @@ -251,7 +265,12 @@ class Quickcss extends Item public function fontsizeinput($element, $param, $value) { - echo '<input type="number" name="values[' . $element . '][' . $param . ']" value="' . intval($value) . '" id="values[' . $element . '][' . $param . ']">'; + echo '<input + type="number" + name="values[' . $element . '][' . $param . ']" + value="' . intval($value) . '" + id="values[' . $element . '][' . $param . ']" + >'; $unit = preg_replace('/\d/', '', $value); ?> @@ -264,7 +283,13 @@ class Quickcss extends Item public function opacityinput($element, $param, $value) { - echo '<input type="number" name="values[' . $element . '][' . $param . ']" value="' . $value . '" id="values[' . $element . '][' . $param . ']" step="0.1" min="0" max="1">'; + echo '<input + type="number" + name="values[' . $element . '][' . $param . ']" + value="' . $value . '" + id="values[' . $element . '][' . $param . ']" + step="0.1" min="0" max="1" + >'; } public function selectinput($element, $param, $value) diff --git a/app/fn/fn.php b/app/fn/fn.php index 2d17a3f..243e056 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -253,7 +253,9 @@ function treecount( $folder = '├─📁' . $dirname; } echo '<tr>'; - echo '<td><a href="' . $mediaopt->getpathadress($path) . '">' . str_repeat(' ', $deepness) . $folder . '</a></td>'; + $href = $mediaopt->getpathadress($path); + $foldername = str_repeat(' ', $deepness) . $folder; + echo '<td><a href="' . $href . '">' . $foldername . '</a></td>'; echo '<td>' . $dirlist['dirfilecount'] . '</td>'; echo '</tr>'; foreach ($dirlist as $key => $value) { @@ -279,6 +281,7 @@ function basictree(array $dirlist, string $dirname, int $deepness, string $path, } if ($deepness === 1) { + // phpcs:ignore Generic.Files.LineLength.TooLong $radio = '<input type="radio" name="pagetable" value="' . $dirname . '" id="db_' . $path . '" ' . $checked . '>'; } else { $radio = ''; |