splitbrain /
dokuwiki
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 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 <[email protected]> |
||
| 9 | * @author Anika Henke <[email protected]> |
||
| 10 | */ |
||
| 11 | if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../'); |
||
| 12 | if(!defined('NOSESSION')) define('NOSESSION',1); |
||
| 13 | require_once(DOKU_INC.'inc/init.php'); |
||
| 14 | ?> |
||
| 15 | <!DOCTYPE html> |
||
| 16 | <html lang="en" dir="ltr"> |
||
| 17 | <head> |
||
| 18 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
||
| 19 | <title>Template Replacements</title> |
||
| 20 | <style type="text/css"> |
||
| 21 | body { |
||
| 22 | background-color: #fff; |
||
| 23 | color: #000; |
||
| 24 | } |
||
| 25 | caption { |
||
| 26 | font-weight: bold; |
||
| 27 | } |
||
| 28 | td { |
||
| 29 | margin: 0; |
||
| 30 | padding: 0.5em 2em; |
||
| 31 | font-family: monospace; |
||
| 32 | font-size: 120%; |
||
| 33 | border: 1px solid #fff; |
||
| 34 | } |
||
| 35 | tr:hover td { |
||
| 36 | border: 1px solid #ccc; |
||
| 37 | } |
||
| 38 | .color { |
||
| 39 | padding: 0.25em 1em; |
||
| 40 | border: 1px #000 solid; |
||
| 41 | } |
||
| 42 | </style> |
||
| 43 | </head> |
||
| 44 | <body> |
||
| 45 | <?php |
||
| 46 | // get merged style.ini |
||
| 47 | define('SIMPLE_TEST', true); // hack to prevent css output and headers |
||
| 48 | require_once(DOKU_INC.'lib/exe/css.php'); |
||
| 49 | $styleUtils = new \dokuwiki\StyleUtils(); |
||
| 50 | $ini = $styleUtils->cssStyleini($conf['template']); |
||
| 51 | |||
| 52 | if ($ini) { |
||
|
0 ignored issues
–
show
|
|||
| 53 | echo '<table>'; |
||
| 54 | echo "<caption>".hsc($conf['template'])."'s style.ini</caption>"; |
||
| 55 | foreach($ini['replacements'] as $key => $val){ |
||
| 56 | echo '<tr>'; |
||
| 57 | echo '<td>'.hsc($key).'</td>'; |
||
| 58 | echo '<td>'.hsc($val).'</td>'; |
||
| 59 | echo '<td>'; |
||
| 60 | if(preg_match('/^#[0-f]{3,6}$/i',$val)){ |
||
| 61 | echo '<div class="color" style="background-color:'.$val.';"> </div>'; |
||
| 62 | } |
||
| 63 | echo '</td>'; |
||
| 64 | echo '</tr>'; |
||
| 65 | } |
||
| 66 | echo '</table>'; |
||
| 67 | } else { |
||
| 68 | echo "<p>Non-existent or invalid template or style.ini: <strong>".hsc($conf['template'])."</strong></p>"; |
||
| 69 | } |
||
| 70 | ?> |
||
| 71 | </body> |
||
| 72 | </html> |
||
| 73 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.