xref: /dokuwiki/lib/tpl/index.php (revision b5b0d7949c3ee36aa30680deb465f29320c4e98d)
1<?php
2/**
3 * This file reads the style.ini of the used template and displays the
4 * replacements defined in it. Color replacements will be displayed
5 * visually. This should help with adjusting and using the styles
6 * specified in the style.ini
7 *
8 * @author Andreas Gohr <andi@splitbrain.org>
9 * @author Anika Henke <anika@selfthinker.org>
10 */
11?>
12<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
13 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
14<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
15<head>
16    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
17    <title>Template Replacements</title>
18    <style type="text/css">
19        body {
20            background-color: #fff;
21            color: #000;
22        }
23        caption {
24            font-weight: bold;
25        }
26        td {
27            margin: 0;
28            padding: 0.5em 2em;
29            font-family: monospace;
30            font-size: 120%;
31            border: 1px solid #fff;
32        }
33        tr:hover td {
34            border: 1px solid #ccc;
35        }
36        .color {
37            padding: 0.25em 1em;
38            border: 1px #000 solid;
39        }
40    </style>
41</head>
42<body>
43<?php
44if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
45require_once(DOKU_INC.'inc/init.php');
46
47$ini = @parse_ini_file($conf['template'].'/style.ini',true);
48if ($ini) {
49    echo '<table>';
50    echo "<caption>".htmlspecialchars($conf['template'])."'s style.ini</caption>";
51    foreach($ini['replacements'] as $key => $val){
52        echo '<tr>';
53        echo '<td>'.htmlspecialchars($key).'</td>';
54        echo '<td>'.htmlspecialchars($val).'</td>';
55        echo '<td>';
56        if(preg_match('/^#[0-f]{3,6}$/i',$val)){
57            echo '<div class="color" style="background-color:'.$val.';">&nbsp;</div>';
58        }
59        echo '</td>';
60        echo '</tr>';
61    }
62    echo '</table>';
63} else {
64    echo "<p>Non-existent template: <strong>".htmlspecialchars($conf['template'])."</strong></p>";
65}
66?>
67</body>
68</html>
69