Merge pull request #4111 from dokuwiki-translate/lang_update_739_1700675130
[dokuwiki.git] / lib / tpl / index.php
blob22a8a8575df6b91b52d4034eca64e9dc0973d6f4
1 <?php
3 /**
4 * This file reads the style.ini of the used template and displays the
5 * replacements defined in it. Color replacements will be displayed
6 * visually. This should help with adjusting and using the styles
7 * specified in the style.ini
9 * @author Andreas Gohr <andi@splitbrain.org>
10 * @author Anika Henke <anika@selfthinker.org>
13 // phpcs:disable PSR1.Files.SideEffects
14 if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../');
15 if (!defined('NOSESSION')) define('NOSESSION', 1);
16 require_once(DOKU_INC . 'inc/init.php');
18 <!DOCTYPE html>
19 <html lang="en" dir="ltr">
20 <head>
21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
22 <title>Template Replacements</title>
23 <style>
24 body {
25 background-color: #fff;
26 color: #000;
28 caption {
29 font-weight: bold;
31 td {
32 margin: 0;
33 padding: 0.5em 2em;
34 font-family: monospace;
35 font-size: 120%;
36 border: 1px solid #fff;
38 tr:hover td {
39 border: 1px solid #ccc;
41 .color {
42 padding: 0.25em 1em;
43 border: 1px #000 solid;
45 </style>
46 </head>
47 <body>
48 <?php
49 // get merged style.ini
50 $styleUtils = new \dokuwiki\StyleUtils($conf['template']);
51 $ini = $styleUtils->cssStyleini();
53 if (!empty($ini)) {
54 echo '<table>';
55 echo "<caption>" . hsc($conf['template']) . "'s style.ini</caption>";
56 foreach ($ini['replacements'] as $key => $val) {
57 echo '<tr>';
58 echo '<td>' . hsc($key) . '</td>';
59 echo '<td>' . hsc($val) . '</td>';
60 echo '<td>';
61 if (preg_match('/^#[0-f]{3,6}$/i', $val)) {
62 echo '<div class="color" style="background-color:' . $val . ';">&#160;</div>';
64 echo '</td>';
65 echo '</tr>';
67 echo '</table>';
68 } else {
69 echo "<p>Non-existent or invalid template or style.ini: <strong>" . hsc($conf['template']) . "</strong></p>";
72 </body>
73 </html>