diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-12-09 12:10:16 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-12-09 12:10:16 +0100 |
commit | ae0693d074a63412e7ab9587520096cb60a48e64 (patch) | |
tree | 269cbfb204858f8a6b47f061abdc0101878de2d8 /app | |
parent | 0cdf3e007ee05880ed290865ecd911bbf508d565 (diff) | |
download | wcms-ae0693d074a63412e7ab9587520096cb60a48e64.tar.gz wcms-ae0693d074a63412e7ab9587520096cb60a48e64.zip |
media parser
Diffstat (limited to 'app')
-rw-r--r-- | app/class/art2.php | 2 | ||||
-rw-r--r-- | app/class/modelhome.php | 2 | ||||
-rw-r--r-- | app/class/modelrender.php | 11 | ||||
-rw-r--r-- | app/view/templates/edit.php | 2 | ||||
-rw-r--r-- | app/view/templates/editleftbar.php | 16 | ||||
-rw-r--r-- | app/view/templates/edittopbar.php | 13 | ||||
-rw-r--r-- | app/view/templates/home.php | 40 | ||||
-rw-r--r-- | app/view/templates/info.php | 21 |
8 files changed, 60 insertions, 47 deletions
diff --git a/app/class/art2.php b/app/class/art2.php index 6a61687..2029895 100644 --- a/app/class/art2.php +++ b/app/class/art2.php @@ -169,6 +169,8 @@ class Art2 return $this->date->format('Y-m-d'); } elseif ($option == 'ptime') { return $this->date->format('H:i'); + } elseif ($option = 'dmy') { + return $this->date->format('d/m/Y'); } diff --git a/app/class/modelhome.php b/app/class/modelhome.php index 5d16062..bb271d6 100644 --- a/app/class/modelhome.php +++ b/app/class/modelhome.php @@ -11,7 +11,7 @@ class Modelhome extends Modeldb { $opt = new Opt(Art2::classvarlist()); - $opt->setcol(['id', 'tag', 'linkfrom', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'secure']); + $opt->setcol(['id', 'tag', 'linkfrom', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'date', 'secure']); $opt->settaglist($table); $opt->submit(); diff --git a/app/class/modelrender.php b/app/class/modelrender.php index d2cdbb4..c36417d 100644 --- a/app/class/modelrender.php +++ b/app/class/modelrender.php @@ -177,8 +177,8 @@ class Modelrender extends Modelart public function parser(string $text) { - $text = str_replace('<a href="~', '<a class="media" target="_blank" href="' . Model::mediapath(), $text); - $text = str_replace('<img src="~', '<img class="local" src="' . Model::mediapath(), $text); + + $text = $this->media($text); $text = $this->headerid($text); @@ -197,6 +197,13 @@ class Modelrender extends Modelart return $text; } + public function media(string $text): string + { + $rend = $this; + $text = preg_replace('%(src|target)="((\/?[\w-_]+)+\.[a-z0-9]{1,5})"%', '$1="'.Model::mediapath() . '$2"', $text); + return $text; + } + public function autourl($text) { diff --git a/app/view/templates/edit.php b/app/view/templates/edit.php index 973317a..4b2fa77 100644 --- a/app/view/templates/edit.php +++ b/app/view/templates/edit.php @@ -10,7 +10,7 @@ <body> <section class="editor"> - <?php $this->insert('navart', ['user' => $user, 'art' => $art, 'artexist' => $artexist]) ?> + <!-- <?php $this->insert('navart', ['user' => $user, 'art' => $art, 'artexist' => $artexist]) ?> --> diff --git a/app/view/templates/editleftbar.php b/app/view/templates/editleftbar.php index 09c13f9..ff08bfc 100644 --- a/app/view/templates/editleftbar.php +++ b/app/view/templates/editleftbar.php @@ -56,20 +56,20 @@ if(!empty($art->templatecss())) { ?> <div class="subtemplate"> - <input type="checkbox" name="ireccursivecss" id="ireccursivecss" <?= $art->template()['cssreccursive'] === true ? 'checked' : '' ?>> - <label for="ireccursivecss">Reccursive template</label> + <input type="checkbox" name="templateoptions['reccursivecss']" id="oreccursivecss" <?= $art->template()['cssreccursive'] === true ? 'checked' : '' ?>> + <label for="oreccursivecss">Reccursive template</label> </div> <div class="subtemplate"> - <input type="checkbox" name="iquickcss" id="iquickcss" <?= $art->template()['cssquickcss'] === true ? 'checked' : '' ?>> - <label for="iquickcss">Quickcss</label> + <input type="checkbox" name="templateoptions['quickcss']" id="oquickcss" <?= $art->template()['cssquickcss'] === true ? 'checked' : '' ?>> + <label for="oquickcss">Quickcss</label> </div> <div class="subtemplate"> - <input type="checkbox" name="iexternalcss" id="iexternalcss" <?= $art->template()['externalcss'] === true ? 'checked' : '' ?>> - <label for="iexternalcss">External CSS</label> + <input type="checkbox" name="templateoptions['externalcss']" id="oexternalcss" <?= $art->template()['externalcss'] === true ? 'checked' : '' ?>> + <label for="pexternalcss">External CSS</label> </div> <div class="subtemplate"> - <input type="checkbox" name="ifavicon" id="ifavicon" <?= $art->template()['cssfavicon'] === true ? 'checked' : '' ?>> - <label for="ifavicon">Favicon</label> + <input type="checkbox" name="templateoptions['favicon']" id="ofavicon" <?= $art->template()['cssfavicon'] === true ? 'checked' : '' ?>> + <label for="ofavicon">Favicon</label> </div> <?php } diff --git a/app/view/templates/edittopbar.php b/app/view/templates/edittopbar.php index a1aba01..5c1e43c 100644 --- a/app/view/templates/edittopbar.php +++ b/app/view/templates/edittopbar.php @@ -14,18 +14,17 @@ <span> - <a href="<?= $this->uart('artconfirmdelete', $art->id()) ?>">✖ delete</a> + <a href="<?= $this->uart('artconfirmdelete', $art->id()) ?>"><span class="symbol">✖</span><span class="text">delete</span></a> </span> <span> <a href="<?= $this->uart('artread/', $art->id()) ?>" target="_blank" class="icon" >👁</a> - <a href="<?= $this->uart('artlog', $art->id()) ?>" target="_blank" class="icon" >⁋</a> </span> <span id="headid"><?= $art->id() ?></span> -<span> +<span id="fontsize"> <label for="fontsize">Font-size</label> <input type="number" name="fontsize" value="<?= Config::fontsize() ?>" id="fontsize"> @@ -33,14 +32,16 @@ -<span id="test"> +<span id="menu"> <?php if($user->iseditor()) { ?> + <a href="<?= $this->url('font') ?>"><span class="symbol">📝</span><span class="text">font</span></a> + <a href="<?= $this->url('media') ?>"><span class="symbol">📁</span><span class="text">media</span></a> + <?php if($user->isadmin()) { ?> - <a href="<?= $this->url('font') ?>">font</a> - <a href="<?= $this->url('admin') ?>">admin</a> + <a href="<?= $this->url('admin') ?>"><span class="symbol">🔑</span><span class="text">admin</span></a> <?php } } diff --git a/app/view/templates/home.php b/app/view/templates/home.php index ac4f158..9aa3d13 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -12,7 +12,7 @@ <?php if($user->iseditor()) { ?> -<section> +<section class="home"> @@ -68,15 +68,16 @@ <th><a href="<?= $opt->getadress('id') ?>">id</a></th> <th>edit</th> <th>see</th> - <th>del</th> - <th>log</th> - <th><a href="<?= $opt->getadress('tag') ?>">tag</a></th> - <th>summary</th> - <th><a href="<?= $opt->getadress('linkto') ?>">link to</a></th> - <th><a href="<?= $opt->getadress('linkfrom') ?>">linkfrom</a></th> - <th><a href="<?= $opt->getadress('datemodif') ?>">last modification</a></th> - <th><a href="<?= $opt->getadress('datecreation') ?>">date of creation</a></th> - <th><a href="<?= $opt->getadress('secure') ?>">privacy</a></th> + <th class="delete">del</th> + <th class="log">log</th> + <th class="tag"><a href="<?= $opt->getadress('tag') ?>">tag</a></th> + <th class="summary">summary</th> + <th class="linkto"><a href="<?= $opt->getadress('linkto') ?>">link to</a></th> + <th class="linkfrom"><a href="<?= $opt->getadress('linkfrom') ?>">linkfrom</a></th> + <th class="datemodif"><a href="<?= $opt->getadress('datemodif') ?>">last modification</a></th> + <th class="datecreation"><a href="<?= $opt->getadress('datecreation') ?>">date of creation</a></th> + <th class="date"><a href="<?= $opt->getadress('date') ?>">date</a></th> + <th class="secure"><a href="<?= $opt->getadress('secure') ?>">privacy</a></th> </tr> <?php foreach ($table2 as $item) { ?> <tr> @@ -84,15 +85,16 @@ <td><label title="<?= $item->title() ?>" for="<?= $item->id() ?>"><?= $item->id() ?></label></td> <td><a href="<?= $this->uart('artedit', $item->id()) ?>">✏</a></td> <td><a href="<?= $this->uart('artread/', $item->id()) ?>" target="_blank">👁</a></td> - <td><a href="<?= $this->uart('artdelete', $item->id()) ?>" >✖</a></td> - <td><a href="<?= $this->uart('artlog', $item->id()) ?>" target="_blank">⁋</a></td> - <td><a title="<?= $item->tag('string') ?>"><?= $item->tag('sort') ?></a></td> - <td><?= $item->description() ?></td> - <td><?= $item->linkto('sort') ?></td> - <td><a title="<?= $item->linkfrom('string') ?>" ><?= $item->linkfrom('sort') ?></a></td> - <td><?= $item->datemodif('hrdi') ?></td> - <td><?= $item->datecreation('hrdi') ?></td> - <td><?= $item->secure('string') ?></td> + <td class="delete"><a href="<?= $this->uart('artdelete', $item->id()) ?>" >✖</a></td> + <td class="log"><a href="<?= $this->uart('artlog', $item->id()) ?>" target="_blank">⁋</a></td> + <td class="tag"><a title="<?= $item->tag('string') ?>"><?= $item->tag('sort') ?></a></td> + <td class="summary"><?= $item->description() ?></td> + <td class="linkto"><?= $item->linkto('sort') ?></td> + <td class="linkfrom"><a title="<?= $item->linkfrom('string') ?>" ><?= $item->linkfrom('sort') ?></a></td> + <td class="datemodif"><?= $item->datemodif('hrdi') ?></td> + <td class="datecreation"><?= $item->datecreation('hrdi') ?></td> + <td class="date"><?= $item->date('dmy') ?></td> + <td class="secure"><?= $item->secure('string') ?></td> </tr> <?php }?> diff --git a/app/view/templates/info.php b/app/view/templates/info.php index 334540b..638e2b5 100644 --- a/app/view/templates/info.php +++ b/app/view/templates/info.php @@ -38,6 +38,7 @@ <nav> +SUMMARY <ul> <li><a href="#startup">Startup</a></li> <ul> @@ -50,8 +51,8 @@ </ul> <li><a href="#editor">Editor</a></li> <ul> - <li><a href="#elementsynthax">Elements synthax</a></li> - <li><a href="#bodysynthax">Body synthax</a></li> + <li><a href="#elementsyntax">Elements syntax</a></li> + <li><a href="#bodysyntax">Body syntax</a></li> </ul> </ul> @@ -141,13 +142,13 @@ You can use any of them, only one or all at the same time, as you prefer. -<h4 id="elementsynthax">Element synthax</h4> +<h4 id="elementsyntax">Element syntax</h4> -<p>In any of the five html element you can use to store content, you can use the following synthax, that is specific to W, extending the Markdown syntax :</p> +<p>In any of the five html element you can use to store content, you can use the following syntax, that is specific to W, extending the Markdown syntax :</p> <h5>quick internal link</h5> -<p>You can create internal link very quickly, only by using the id of yout page. The link text will be remplaced by the title associated with this page.</p> +<p>You can create internal link very quickly, only by using the id of your page. The link text will be remplaced by the title associated with this page.</p> <blockquote> [<i>page_id</i>] @@ -174,7 +175,7 @@ You can use any of them, only one or all at the same time, as you prefer. %DESCRIPTION% </blockquote> -<p>As for the title, this will output the <code>description</code> attribute od the page</p> +<p>As for the title, this will output the <code>description</code> attribute of the page</p> <h5>Date shortcut</h5> @@ -187,13 +188,13 @@ You can use any of them, only one or all at the same time, as you prefer. <h5>Automatic summary</h5> -<p>You can generate summary automaticly, based on the page <code><h*></code> elements</p> +<p>You can automatically generate summary, based on the page <code><h*></code> elements</p> <blockquote> %SUMMARY% </blockquote> -<p>This will generate a classic <code>ul</code> html list.</p> +<p>This will generate a classic <code><ul></code> html list.</p> <h5>Automatic list by tag</h5> @@ -203,7 +204,7 @@ You can use any of them, only one or all at the same time, as you prefer. %%<i>tag</i>%% </blockquote> -<p>Let's suppose we are in page3 and have page2, page3, page5, using this tag, this will output :</p> +<p>Let's suppose we are in page3 and we have page2, page3, page5, using this tag, this will output :</p> <blockquote> <ul id="<i>tag</i>"> @@ -238,7 +239,7 @@ You can use any of them, only one or all at the same time, as you prefer. -<h4 id="bodysynthax">Body synthax</h4> +<h4 id="bodysyntax">Body syntax</h4> |