about summary refs log tree commit diff stats
path: root/wiki/lib/tpl/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'wiki/lib/tpl/index.php')
-rw-r--r--wiki/lib/tpl/index.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/wiki/lib/tpl/index.php b/wiki/lib/tpl/index.php
new file mode 100644
index 0000000..d6f0034
--- /dev/null
+++ b/wiki/lib/tpl/index.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * This file reads the style.ini of the used template and displays the
+ * replacements defined in it. Color replacements will be displayed
+ * visually. This should help with adjusting and using the styles
+ * specified in the style.ini
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @author Anika Henke <anika@selfthinker.org>
+ */
+if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
+if(!defined('NOSESSION')) define('NOSESSION',1);
+require_once(DOKU_INC.'inc/init.php');
+?>
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Template Replacements</title>
+    <style type="text/css">
+        body {
+            background-color: #fff;
+            color: #000;
+        }
+        caption {
+            font-weight: bold;
+        }
+        td {
+            margin: 0;
+            padding: 0.5em 2em;
+            font-family: monospace;
+            font-size: 120%;
+            border: 1px solid #fff;
+        }
+        tr:hover td {
+            border: 1px solid #ccc;
+        }
+        .color {
+            padding: 0.25em 1em;
+            border: 1px #000 solid;
+        }
+    </style>
+</head>
+<body>
+<?php
+// get merged style.ini
+define('SIMPLE_TEST', true); // hack to prevent css output and headers
+require_once(DOKU_INC.'lib/exe/css.php');
+$styleUtils = new \dokuwiki\StyleUtils();
+$ini = $styleUtils->cssStyleini($conf['template']);
+
+if ($ini) {
+    echo '<table>';
+    echo "<caption>".hsc($conf['template'])."'s style.ini</caption>";
+    foreach($ini['replacements'] as $key => $val){
+        echo '<tr>';
+        echo '<td>'.hsc($key).'</td>';
+        echo '<td>'.hsc($val).'</td>';
+        echo '<td>';
+        if(preg_match('/^#[0-f]{3,6}$/i',$val)){
+            echo '<div class="color" style="background-color:'.$val.';">&#160;</div>';
+        }
+        echo '</td>';
+        echo '</tr>';
+    }
+    echo '</table>';
+} else {
+    echo "<p>Non-existent or invalid template or style.ini: <strong>".hsc($conf['template'])."</strong></p>";
+}
+?>
+</body>
+</html>