diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-10-12 11:36:05 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-10-12 11:36:05 +0200 |
commit | 65796d4a2349e71ca05f5f298d6f94ff792d88b2 (patch) | |
tree | ef73e39b4b54ccd36b61b783c438036761d17811 /class | |
parent | 74ccedd6544daac0845a044b5e6d71d577578c69 (diff) | |
download | wcms-65796d4a2349e71ca05f5f298d6f94ff792d88b2.tar.gz wcms-65796d4a2349e71ca05f5f298d6f94ff792d88b2.zip |
2.91 folder moves + auto summary
Diffstat (limited to 'class')
-rw-r--r-- | class/class.w.aff.php | 26 | ||||
-rw-r--r-- | class/class.w.app.php | 8 | ||||
-rw-r--r-- | class/class.w.art.php | 28 |
3 files changed, 41 insertions, 21 deletions
diff --git a/class/class.w.aff.php b/class/class.w.aff.php index 14b653e..e716630 100644 --- a/class/class.w.aff.php +++ b/class/class.w.aff.php @@ -325,16 +325,16 @@ public function head($title, $tool, $color4) <head> <meta charset="utf8" /> <meta name="viewport" content="width=device-width" /> - <link rel="shortcut icon" href="../media/logo.png" type="image/x-icon"> - <link href="/css/stylebase.css" rel="stylesheet" /> - <link href="/css/style<?= $tool ?>.css" rel="stylesheet" /> + <link rel="shortcut icon" href="./media/logo.png" type="image/x-icon"> + <link href="./css/stylebase.css" rel="stylesheet" /> + <link href="./css/style<?= $tool ?>.css" rel="stylesheet" /> <style> :root { --color4: <?= $color4 ?>; } </style> <title><?= $title ?></title> - <script src="../rsc/js/app.js"></script> + <script src="./rsc/js/app.js"></script> </head> <?php @@ -347,11 +347,11 @@ public function arthead(Art $art, $cssdir, $cssread = '', $edit = 0) <meta charset="utf8" /> <meta name="description" content="<?= $art->intro() ?>" /> <meta name="viewport" content="width=device-width" /> - <link rel="shortcut icon" href="../media/logo.png" type="image/x-icon"> - <link href="/css/stylebase.css" rel="stylesheet" /> - <?= $edit == 0 ? '<link href="' . $cssdir . $cssread . '" rel="stylesheet" />' : '<link href="/css/styleedit.css" rel="stylesheet" />' ?> + <link rel="shortcut icon" href="./media/logo.png" type="image/x-icon"> + <link href="./css/stylebase.css" rel="stylesheet" /> + <?= $edit == 0 ? '<link href="' . $cssdir . $cssread . '" rel="stylesheet" />' : '<link href="./css/styleedit.css" rel="stylesheet" />' ?> <title><?= $edit == 1 ? '✏' : '' ?> <?= $art->titre() ?></title> - <script src="../rsc/js/app.js"></script> + <script src="./rsc/js/app.js"></script> </head> <?php @@ -364,11 +364,11 @@ public function noarthead($id, $cssdir, $cssread = '') <meta charset="utf8" /> <meta name="description" content="This article does not exist yet." /> <meta name="viewport" content="width=device-width" /> - <link rel="shortcut icon" href="../media/logo.png" type="image/x-icon"> - <link href="/css/stylebase.css" rel="stylesheet" /> + <link rel="shortcut icon" href="./media/logo.png" type="image/x-icon"> + <link href="./css/stylebase.css" rel="stylesheet" /> <link href="<?= $cssdir . $cssread ?>" rel="stylesheet" /> <title>❓ <?= $id ?></title> - <script src="../rsc/js/app.js"></script> + <script src="./rsc/js/app.js"></script> </head> <?php @@ -648,7 +648,7 @@ public function mermaid(string $map) ?> - <script src="../rsc/js/mermaid.min.js"></script> + <script src="./rsc/js/mermaid.min.js"></script> <script> mermaid.initialize({ @@ -1013,7 +1013,7 @@ public function nav($app) <details> <summary>Admin</summary> - <p>Edit your own admin password. You can find it in the config.json file, in the root of your website folder.</p> + <p>Edit your own admin password. You can find it in the config.w.json file, in the root of your website folder.</p> <form action="./" method="post"> <input type="hidden" name="action" value="editconfig"> diff --git a/class/class.w.app.php b/class/class.w.app.php index 0c9d6a3..91d0a41 100644 --- a/class/class.w.app.php +++ b/class/class.w.app.php @@ -6,10 +6,10 @@ class App private $arttable; - const CONFIG_FILE = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config.json'; - const CSS_READ_DIR = '..' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'read' . DIRECTORY_SEPARATOR; - const SQL_READ_DIR = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR; - const MEDIA_DIR = '..' . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR; + const CONFIG_FILE = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config.w.json'; + const CSS_READ_DIR = '.' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'read' . DIRECTORY_SEPARATOR; + const SQL_READ_DIR = '.' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR; + const MEDIA_DIR = '.' . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR; const MEDIA_EXTENSIONS = array('jpeg', 'jpg', 'JPG', 'png', 'gif', 'mp3', 'mp4', 'mov', 'wav', 'flac', 'pdf'); const MEDIA_TYPES = ['image', 'video', 'sound', 'other']; diff --git a/class/class.w.art.php b/class/class.w.art.php index 4c88987..001b29d 100644 --- a/class/class.w.art.php +++ b/class/class.w.art.php @@ -197,6 +197,11 @@ class Art return $this->css; } + public function cssprint() + { + return $cssprint; + } + public function csstemplate(App $app) { $data = []; @@ -210,7 +215,8 @@ class Art } } - return $temp . $this->css; + $cssprint = str_replace('url(/', 'url('.$app::MEDIA_DIR , $temp . $this->css); + return $cssprint; } public function md($expand = false) @@ -226,16 +232,23 @@ class Art public function html(App $app) { + // %%%% TITLE & DESCIPTION $html = str_replace('%TITLE%', $this->titre(), $this->html); $html = str_replace('%DESCRIPTION%', $this->intro(), $html); $parser = new MarkdownExtra; + + // id in headers $parser->header_id_func = function ($header) { - return preg_replace('/[^a-z0-9]/', '', strtolower($header)); + return preg_replace('/[^\w]/', '', strtolower($header)); }; $html = $parser->transform($html); + + // replace = > ?id= $html = str_replace('href="=', 'href="?id=', $html); + + // infobulles tooltip foreach ($this->lien('array') as $id) { $title = "Cet article n'existe pas encore"; foreach ($app->getlister(['id', 'intro']) as $item) { @@ -248,10 +261,17 @@ class Art $html = str_replace($lien, $titlelien, $html); } + if(!empty(strstr($html, '%SUMMARY%'))) { + + + + $html = str_replace('%SUMMARY%', sumparser($html), $html); + } + - $html = str_replace('href="../media/', ' class="file" target="_blank" href="../media/', $html); + $html = str_replace('href="./media/', ' class="file" target="_blank" href="./media/', $html); $html = str_replace('href="http', ' class="external" target="_blank" href="http', $html); - $html = str_replace('<img src="/', '<img src="../media/', $html); + $html = str_replace('<img src="/', '<img src="./media/', $html); $html = str_replace('<iframe', '<div class="iframe"><div class="container"><iframe class="video" ', $html); $html = str_replace('</iframe>', '</iframe></div></div>', $html); return $html; |