From fbe5d2beb2bcc7035edc19eb0343f0ee662ba5af Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 13 Dec 2018 00:43:47 +0100 Subject: templateoptions --- app/class/art2.php | 32 ++++++----- app/class/config.php | 2 +- app/class/controllerart.php | 2 +- app/class/model.php | 2 +- app/class/modelart.php | 2 +- app/class/modelrender.php | 13 ++++- app/class/w.article.php | 8 +-- app/class/w.home.php | 4 +- app/class/w.menu.php | 12 ++-- app/view/templates/admin.php | 4 +- app/view/templates/edit.php | 4 +- app/view/templates/edithelp.php | 2 +- app/view/templates/editleftbar.php | 111 +++++++++++++++++++++++++++---------- app/view/templates/font.php | 4 +- app/view/templates/home.php | 4 +- app/view/templates/info.php | 16 +++--- app/view/templates/media.php | 8 +-- 17 files changed, 149 insertions(+), 81 deletions(-) (limited to 'app') diff --git a/app/class/art2.php b/app/class/art2.php index 4e81532..8bf2729 100644 --- a/app/class/art2.php +++ b/app/class/art2.php @@ -15,7 +15,7 @@ class Art2 protected $javascript; protected $body; protected $header; - protected $section; + protected $main; protected $nav; protected $aside; protected $footer; @@ -45,7 +45,7 @@ class Art2 const LENCOULEUR = 7; const DEBUT = '(?id='; const FIN = ')'; - const TABS = ['section', 'css', 'header', 'body', 'nav', 'aside', 'footer', 'javascript']; + const TABS = ['main', 'css', 'header', 'body', 'nav', 'aside', 'footer', 'javascript']; const VAR_DATE = ['date', 'datecreation', 'datemodif', 'daterender']; @@ -87,7 +87,7 @@ class Art2 $this->setjavascript(''); $this->setbody(''); $this->setheader(''); - $this->setsection(''); + $this->setmain(''); $this->setnav(''); $this->setaside(''); $this->setfooter(''); @@ -98,13 +98,13 @@ class Art2 $this->setsecure(3); $this->setinvitepassword('invitepassword'); $this->setinvitepassword('readpassword'); - $this->setinterface('section'); + $this->setinterface('main'); $this->setlinkfrom([]); $this->setlinkto([]); $this->settemplatebody(''); $this->settemplatecss(''); $this->settemplatejavascript(''); - $this->settemplateoptions(['externalcss', 'externaljavascript', 'favicon', 'reccursive', 'quickcss']); + $this->settemplateoptions(['externalcss', 'externaljavascript', 'favicon', 'reccursivecss', 'quickcss']); $this->setfavicon(''); $this->setthumbnail(''); $this->setaffcount(0); @@ -250,9 +250,9 @@ class Art2 return $this->header; } - public function section($type = 'string') + public function main($type = 'string') { - return $this->section; + return $this->main; } public function nav($type = "string") @@ -536,10 +536,10 @@ class Art2 } } - public function setsection($section) + public function setmain($main) { - if (strlen($section) < self::LENTEXT and is_string($section)) { - $this->section = $section; + if (strlen($main) < self::LENTEXT and is_string($main)) { + $this->main = $main; } } @@ -557,14 +557,18 @@ class Art2 } } - public function setexternalcss(array $externalcss) + public function setexternalcss($externalcss) { - $this->externalcss = $externalcss; + if(is_array($externalcss)) { + $this->externalcss = array_values(array_filter($externalcss)); + } } public function setexternalscript(array $externalscript) { - $this->externalscript = $externalscript; + if(is_array($externalscript)) { + $this->externalscript = array_values(array_filter($externalscript)); + } } public function setfooter($footer) @@ -664,7 +668,7 @@ class Art2 public function settemplateoptions($templateoptions) { if(is_array($templateoptions)) { - $this->templateoptions = $templateoptions; + $this->templateoptions = array_filter($templateoptions); } } diff --git a/app/class/config.php b/app/class/config.php index 7d2320e..b778d83 100644 --- a/app/class/config.php +++ b/app/class/config.php @@ -15,7 +15,7 @@ abstract class Config protected static $basepath = ''; protected static $route404; protected static $existnot = 'This page does not exist yet'; - protected static $defaultbody = '%HEADER%'. PHP_EOL .PHP_EOL . '%NAV%'. PHP_EOL .PHP_EOL . '%ASIDE%'. PHP_EOL .PHP_EOL . '%SECTION%'. PHP_EOL .PHP_EOL . '%FOOTER%'; + 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 $defaultart = ''; protected static $defaultfavicon = ''; protected static $showeditmenu = true; diff --git a/app/class/controllerart.php b/app/class/controllerart.php index 3ada9d1..ee99b6a 100644 --- a/app/class/controllerart.php +++ b/app/class/controllerart.php @@ -118,7 +118,7 @@ class Controllerart extends Controller if ($this->importart() && $this->canedit()) { - $tablist = ['section' => $this->art->section(), 'css' => $this->art->css(), 'header' => $this->art->header(), 'nav' => $this->art->nav(), 'aside' => $this->art->aside(), 'footer' => $this->art->footer(), 'body' => $this->art->body(), 'javascript' => $this->art->javascript()]; + $tablist = ['main' => $this->art->main(), 'css' => $this->art->css(), 'header' => $this->art->header(), 'nav' => $this->art->nav(), 'aside' => $this->art->aside(), 'footer' => $this->art->footer(), 'body' => $this->art->body(), 'javascript' => $this->art->javascript()]; $faviconlist = $this->mediamanager->listfavicon(); $idlist = $this->artmanager->list(); diff --git a/app/class/model.php b/app/class/model.php index 78abbfa..ee8de26 100644 --- a/app/class/model.php +++ b/app/class/model.php @@ -14,7 +14,7 @@ abstract class Model const MEDIA_EXTENSIONS = array('jpeg', 'jpg', 'JPG', 'png', 'gif', 'mp3', 'mp4', 'mov', 'wav', 'flac', 'pdf'); const MEDIA_TYPES = ['image', 'video', 'sound', 'other']; - const TEXT_ELEMENTS = ['header', 'nav', 'section', 'aside', 'footer']; + const TEXT_ELEMENTS = ['header', 'nav', 'main', 'aside', 'footer']; const EDIT_SYMBOLS = ['pen', 'tool', 'none']; public static function dirtopath($dir) diff --git a/app/class/modelart.php b/app/class/modelart.php index 03163e3..e8203e1 100644 --- a/app/class/modelart.php +++ b/app/class/modelart.php @@ -2,7 +2,7 @@ class Modelart extends Modeldb { - const SELECT = ['title', 'id', 'description', 'tag', 'date', 'datecreation', 'datemodif', 'daterender', 'css', 'quickcss', 'javascript', 'body', 'header', 'section', 'nav', 'aside', 'footer', 'render', 'secure', 'invitepassword', 'interface', 'linkfrom', 'linkto', 'template', 'affcount', 'editcount']; + const SELECT = ['title', 'id', 'description', 'tag', 'date', 'datecreation', 'datemodif', 'daterender', 'css', 'quickcss', 'javascript', 'body', 'header', 'main', 'nav', 'aside', 'footer', 'render', 'secure', 'invitepassword', 'interface', 'linkfrom', 'linkto', 'template', 'affcount', 'editcount']; const BY = ['datecreation', 'title', 'id', 'description', 'datemodif', 'secure']; const ORDER = ['DESC', 'ASC']; diff --git a/app/class/modelrender.php b/app/class/modelrender.php index c76fa69..dba363b 100644 --- a/app/class/modelrender.php +++ b/app/class/modelrender.php @@ -50,7 +50,7 @@ class Modelrender extends Modelart $templateid = $this->art->templatebody(); $templateart = $this->get($templateid); if(self::REMPLACE_SELF_ELEMENT) { - $templatebody = preg_replace_callback('~\%(SECTION|ASIDE|NAV|HEADER|FOOTER)!\%~', function ($match) use ($templateid) { + $templatebody = preg_replace_callback('~\%(MAIN|ASIDE|NAV|HEADER|FOOTER)!\%~', function ($match) use ($templateid) { return '%'. $match[1] . '.' . $templateid . '%'; }, $templateart->body()); } else { @@ -69,7 +69,7 @@ class Modelrender extends Modelart public function getbody(string $body) { $rend = $this; - $body = preg_replace_callback('~\%(SECTION|ASIDE|NAV|HEADER|FOOTER)((:[a-z0-9-_]+|!)(\+([a-z0-9-_]+|!))*)?\%~', function ($match) use ($rend) { + $body = preg_replace_callback('~\%(MAIN|ASIDE|NAV|HEADER|FOOTER)((:[a-z0-9-_]+|!)(\+([a-z0-9-_]+|!))*)?\%~', function ($match) use ($rend) { $element = strtolower($match[1]); $getelement = ''; if (isset($match[2]) && !empty($match[2])) { @@ -147,6 +147,15 @@ class Modelrender extends Modelart } $head .= '' . PHP_EOL; $head .= '' . PHP_EOL; + + foreach ($this->art->externalcss() as $externalcss) { + $head .= '' . PHP_EOL; + } + + foreach ($this->art->externalscript() as $externalscript) { + $head .= '' . PHP_EOL; + } + $head .= '' . PHP_EOL; $head .= '' . PHP_EOL; diff --git a/app/class/w.article.php b/app/class/w.article.php index 2476353..6c504f8 100644 --- a/app/class/w.article.php +++ b/app/class/w.article.php @@ -5,19 +5,19 @@ if ($app->exist($_GET['id'])) { $art = $app->get($_GET['id']); if (isset($_GET['edit']) and $_GET['edit'] == 1 and $app->session() >= $app::EDITOR) { - echo '
'; + echo '
'; $aff->edit($art, $app, $app->getlister(['id', 'title']), $config->fontsize(), $app->getlistermedia($app::MEDIA_DIR, 'image')); $aff->aside($app); - echo '
'; + echo ''; } else { - echo '
'; + echo '
'; $art->autotaglistupdate($app->taglist($app->getlister(['id', 'title', 'description', 'tag']), $art->autotaglist())); $aff->lecture($art, $app); - echo '
'; + echo ''; } } else { diff --git a/app/class/w.home.php b/app/class/w.home.php index 8ba8b44..a23c60f 100644 --- a/app/class/w.home.php +++ b/app/class/w.home.php @@ -3,7 +3,7 @@ $aff->header(); -echo '
'; +echo '
'; if ($app->session() >= $app::EDITOR) { @@ -80,6 +80,6 @@ if ($app->session() >= $app::EDITOR) { -echo '
'; +echo ''; ?> \ No newline at end of file diff --git a/app/class/w.menu.php b/app/class/w.menu.php index 8e89ed1..ecce576 100644 --- a/app/class/w.menu.php +++ b/app/class/w.menu.php @@ -4,7 +4,7 @@ if ($app->session() >= $app::EDITOR) { if ($_GET['aff'] == 'admin' && $app->session() >= $app::ADMIN) { - echo '
'; + echo '
'; echo '

Admin

'; $aff->admincss($config, $app); @@ -18,25 +18,25 @@ if ($app->session() >= $app::EDITOR) { $aff->admintable($config, $status, $app->tablelist($config->dbname())); $aff->admindisplay($config->color4()); - echo '
'; + echo ''; } elseif ($_GET['aff'] == 'media') { echo '

Media

'; - echo '
'; + echo '
'; echo '
'; $aff->addmedia($app); $aff->medialist($app->getlistermedia($app::MEDIA_DIR), $app::MEDIA_DIR); echo '
'; - echo '
'; + echo ''; } elseif ($_GET['aff'] == 'record') { echo '

Record

'; - echo '
'; + echo '
'; $aff->recordlist($app); - echo '
'; + echo ''; } elseif ($_GET['aff'] == 'info') { diff --git a/app/view/templates/admin.php b/app/view/templates/admin.php index 8de9bb1..66c7a33 100644 --- a/app/view/templates/admin.php +++ b/app/view/templates/admin.php @@ -8,7 +8,7 @@ insert('backtopbar', ['user' => $user, 'tab' => 'admin']) ?> -
+

Administration

@@ -94,7 +94,7 @@ -
+ stop('page') ?> \ No newline at end of file diff --git a/app/view/templates/edit.php b/app/view/templates/edit.php index 4b2fa77..32de517 100644 --- a/app/view/templates/edit.php +++ b/app/view/templates/edit.php @@ -8,7 +8,7 @@ -
+
@@ -26,7 +26,7 @@ -
+ stop('page') ?> \ No newline at end of file diff --git a/app/view/templates/edithelp.php b/app/view/templates/edithelp.php index fee94c7..d01f3aa 100644 --- a/app/view/templates/edithelp.php +++ b/app/view/templates/edithelp.php @@ -5,7 +5,7 @@
ALT + X : update
ALT + C : display

Markdown

-

The html section use Markdown encoding. Actualy, W is using Michel Fortin's Markdown Extra.

+

The html main use Markdown encoding. Actualy, W is using Michel Fortin's Markdown Extra.

Links

[text](=article_id)

where article_id is the article's id you want to point to.

diff --git a/app/view/templates/editleftbar.php b/app/view/templates/editleftbar.php index ff08bfc..fd39ba7 100644 --- a/app/view/templates/editleftbar.php +++ b/app/view/templates/editleftbar.php @@ -22,9 +22,38 @@ + + + + + + + -
+ + + + + + + +
templatebody()) || !empty($art->templatecss()) || !empty($art->templatejavascript()) ? 'open' : '' ?>> Tempalte
@@ -35,7 +64,7 @@ ?> @@ -55,25 +84,32 @@ templatecss())) { ?> +
- template()['cssreccursive'] === true ? 'checked' : '' ?>> + templateoptions()) ? 'checked' : '' ?>>
- template()['cssquickcss'] === true ? 'checked' : '' ?>> + templateoptions()) ? 'checked' : '' ?>>
- template()['externalcss'] === true ? 'checked' : '' ?>> - + templateoptions()) ? 'checked' : '' ?>> +
- template()['cssfavicon'] === true ? 'checked' : '' ?>> + templateoptions()) ? 'checked' : '' ?>>
templateoptions() as $option) { + if($option != 'externalsavascript') { + echo ''; + } + } } - + ?> @@ -88,41 +124,60 @@ } ?> + + + templatejavascript())) { + ?>
- - + templateoptions()) ? 'checked' : '' ?>> +
+ templateoptions())) { + echo ''; + } + + } ?> +
-
+
externalcss()) || !empty($art->externalscript()) ? 'open' : '' ?>> Advanced -
- + + + externalcss() as $css) { + ?> +
+ + +
+ - - templatecss()) && $art->template()['cssfavicon']) { - ?> - - --no favicon--'; - foreach ($faviconlist as $favicon) { - ?> - - externalscript() as $script) { + ?> +
+ + +
+ - -
+
diff --git a/app/view/templates/font.php b/app/view/templates/font.php index 90614a9..3de0dce 100644 --- a/app/view/templates/font.php +++ b/app/view/templates/font.php @@ -8,7 +8,7 @@ insert('backtopbar', ['user' => $user, 'tab' => 'font']) ?> -
+

Fonts

@@ -55,7 +55,7 @@ foreach ($fontlist as $font ) { ?> -
+ stop('page') ?> \ No newline at end of file diff --git a/app/view/templates/home.php b/app/view/templates/home.php index 9aa3d13..a69882d 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -12,7 +12,7 @@ iseditor()) { ?> -
+
@@ -102,7 +102,7 @@ -
+ diff --git a/app/view/templates/info.php b/app/view/templates/info.php index 4634995..4da3819 100644 --- a/app/view/templates/info.php +++ b/app/view/templates/info.php @@ -8,7 +8,7 @@ insert('backtopbar', ['user' => $user, 'tab' => 'info']) ?> -
+

Info

@@ -138,7 +138,7 @@
  • header
  • nav
  • aside
  • -
  • section
  • +
  • main
  • footer
  • @@ -267,7 +267,7 @@ You can use any of them, only one or all at the same time, as you prefer.

    As it is too long adding all media of a folder one by one, you can just print the content of an entire folder using this method.

    -%MEDIA:__repository__ +%MEDIA:__directory__

    Just point to the good directory inside the media folder. This will output html list, creating image elements, audio players, video players, or just basic link, depending on the media type.

    @@ -295,7 +295,7 @@ You can use any of them, only one or all at the same time, as you prefer. %ASIDE%

    -%SECTION% +%MAIN%

    Will output :

    @@ -309,12 +309,12 @@ __the content of your aside__ </aside>

    -<section class="page_id"> +<main class="page_id">
    -__the content of your section__ +__the content of your main__
    -</section> +</main> @@ -357,7 +357,7 @@ __content of this page html element__ -
    + stop('page') ?> \ No newline at end of file diff --git a/app/view/templates/media.php b/app/view/templates/media.php index 2078d79..706a160 100644 --- a/app/view/templates/media.php +++ b/app/view/templates/media.php @@ -8,7 +8,7 @@ insert('backtopbar', ['user' => $user, 'tab' => 'media']) ?> -
    +
    @@ -28,7 +28,7 @@ function treecount(array $dir, string $dirname, int $deepness, string $path, str $folder = '├─📁' . $dirname; } echo ''; - echo '' . str_repeat(' ‎ ‎', $deepness) . $folder . ''; + echo '' . str_repeat('  ', $deepness) . $folder . ''; echo '' . $dir['dirfilecount'] . ''; echo ''; foreach ($dir as $key => $value) { @@ -78,7 +78,7 @@ foreach ($medialist as $media) { id() ?> extension() ?> - type() == 'image' ? 'image 👁' : $media->type() ?> + type() == 'image' ? 'image 👁' : $media->type() ?> size()) ?> width() ?> height() ?> @@ -110,7 +110,7 @@ foreach ($medialist as $media) {
    -
    + stop('page') ?> \ No newline at end of file -- cgit v1.2.3