From cb2805622384f4ac8da245975d6379554cad6f11 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 17 Aug 2015 23:18:33 +0200 Subject: [PATCH] made highlighting more configurable, added all four themes, there is now a configurable flavour text (notice) --- cfg/conf.ini | 8 +++++++- css/prettify/desert.css | 1 + css/prettify/doxy.css | 1 + css/{ => prettify}/prettify.css | 0 css/{ => prettify}/sons-of-obsidian.css | 0 css/prettify/sunburst.css | 1 + lib/zerobin.php | 2 ++ tst/RainTPL.php | 2 ++ 8 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 css/prettify/desert.css create mode 100644 css/prettify/doxy.css rename css/{ => prettify}/prettify.css (100%) rename css/{ => prettify}/sons-of-obsidian.css (100%) create mode 100644 css/prettify/sunburst.css diff --git a/cfg/conf.ini b/cfg/conf.ini index bd58b6cc..20fcd2f9 100644 --- a/cfg/conf.ini +++ b/cfg/conf.ini @@ -5,7 +5,7 @@ ; @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin ; @copyright 2012 Sébastien SAUVAGE (sebsauvage.net) ; @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License -; @version 0.18 +; @version 0.19 [main] ; enable or disable discussions, defaults to true @@ -14,6 +14,9 @@ opendiscussion = true ; enable or disable syntax highlighting, defaults to true syntaxhighlighting = true +; (optional) set a syntax highlighting theme, as found in css/prettify/ +; syntaxhighlightingtheme = "sons-of-obsidian" + ; preselect the burn-after-reading feature by default, defaults to false burnafterreadingselected = false @@ -23,6 +26,9 @@ sizelimit = 2097152 ; template to include, default is "page" (tpl/page.html) template = "page" +; (optional) notice to display +; notice = "Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service." + ; base64.js library version, defaults to 2.1.9 ; use "1.7" if you are upgrading from a ZeroBin Alpha 0.19 installation base64version = "2.1.9" diff --git a/css/prettify/desert.css b/css/prettify/desert.css new file mode 100644 index 00000000..951cd324 --- /dev/null +++ b/css/prettify/desert.css @@ -0,0 +1 @@ +pre.prettyprint{display:block;background-color:#333}pre .nocode{background-color:none;color:#000}pre .str{color:#ffa0a0}pre .kwd{color:#f0e68c;font-weight:bold}pre .com{color:#87ceeb}pre .typ{color:#98fb98}pre .lit{color:#cd5c5c}pre .pun{color:#fff}pre .pln{color:#fff}pre .tag{color:#f0e68c;font-weight:bold}pre .atn{color:#bdb76b;font-weight:bold}pre .atv{color:#ffa0a0}pre .dec{color:#98fb98}ol.linenums{margin-top:0;margin-bottom:0;color:#aeaeae}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}@media print{pre.prettyprint{background-color:none}pre .str,code .str{color:#060}pre .kwd,code .kwd{color:#006;font-weight:bold}pre .com,code .com{color:#600;font-style:italic}pre .typ,code .typ{color:#404;font-weight:bold}pre .lit,code .lit{color:#044}pre .pun,code .pun{color:#440}pre .pln,code .pln{color:#000}pre .tag,code .tag{color:#006;font-weight:bold}pre .atn,code .atn{color:#404}pre .atv,code .atv{color:#060}} \ No newline at end of file diff --git a/css/prettify/doxy.css b/css/prettify/doxy.css new file mode 100644 index 00000000..6bb72351 --- /dev/null +++ b/css/prettify/doxy.css @@ -0,0 +1 @@ +pre .str,code .str{color:#fec243}pre .kwd,code .kwd{color:#8470ff}pre .com,code .com{color:#32cd32;font-style:italic}pre .typ,code .typ{color:#6ecbcc}pre .lit,code .lit{color:#d06}pre .pun,code .pun{color:#8b8970}pre .pln,code .pln{color:#f0f0f0}pre .tag,code .tag{color:#9c9cff}pre .htm,code .htm{color:#dda0dd}pre .xsl,code .xsl{color:#d0a0d0}pre .atn,code .atn{color:#46eeee;font-weight:normal}pre .atv,code .atv{color:#eeb4b4}pre .dec,code .dec{color:#3387cc}a{text-decoration:none}pre.prettyprint,code.prettyprint{font-family:'Droid Sans Mono','CPMono_v07 Bold','Droid Sans';font-weight:bold;font-size:9pt;background-color:#0f0f0f;-moz-border-radius:8px;-webkit-border-radius:8px;-o-border-radius:8px;-ms-border-radius:8px;-khtml-border-radius:8px;border-radius:8px}pre.prettyprint{width:95%;margin:1em auto;padding:1em;white-space:pre-wrap}pre.prettyprint a,code.prettyprint a{text-decoration:none}ol.linenums{margin-top:0;margin-bottom:0;color:#8b8970}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}@media print{pre.prettyprint,code.prettyprint{background-color:#fff}pre .str,code .str{color:#088}pre .kwd,code .kwd{color:#006;font-weight:bold}pre .com,code .com{color:#oc3;font-style:italic}pre .typ,code .typ{color:#404;font-weight:bold}pre .lit,code .lit{color:#044}pre .pun,code .pun{color:#440}pre .pln,code .pln{color:#000}pre .tag,code .tag{color:#b66ff7;font-weight:bold}pre .htm,code .htm{color:#606;font-weight:bold}pre .xsl,code .xsl{color:#606;font-weight:bold}pre .atn,code .atn{color:#c71585;font-weight:normal}pre .atv,code .atv{color:#088;font-weight:normal}} \ No newline at end of file diff --git a/css/prettify.css b/css/prettify/prettify.css similarity index 100% rename from css/prettify.css rename to css/prettify/prettify.css diff --git a/css/sons-of-obsidian.css b/css/prettify/sons-of-obsidian.css similarity index 100% rename from css/sons-of-obsidian.css rename to css/prettify/sons-of-obsidian.css diff --git a/css/prettify/sunburst.css b/css/prettify/sunburst.css new file mode 100644 index 00000000..54ee9974 --- /dev/null +++ b/css/prettify/sunburst.css @@ -0,0 +1 @@ +pre .str,code .str{color:#65b042}pre .kwd,code .kwd{color:#e28964}pre .com,code .com{color:#aeaeae;font-style:italic}pre .typ,code .typ{color:#89bdff}pre .lit,code .lit{color:#3387cc}pre .pun,code .pun{color:#fff}pre .pln,code .pln{color:#fff}pre .tag,code .tag{color:#89bdff}pre .atn,code .atn{color:#bdb76b}pre .atv,code .atv{color:#65b042}pre .dec,code .dec{color:#3387cc}pre.prettyprint,code.prettyprint{background-color:#000;-moz-border-radius:8px;-webkit-border-radius:8px;-o-border-radius:8px;-ms-border-radius:8px;-khtml-border-radius:8px;border-radius:8px}pre.prettyprint{width:95%;margin:1em auto;padding:1em;white-space:pre-wrap}ol.linenums{margin-top:0;margin-bottom:0;color:#aeaeae}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}@media print{pre .str,code .str{color:#060}pre .kwd,code .kwd{color:#006;font-weight:bold}pre .com,code .com{color:#600;font-style:italic}pre .typ,code .typ{color:#404;font-weight:bold}pre .lit,code .lit{color:#044}pre .pun,code .pun{color:#440}pre .pln,code .pln{color:#000}pre .tag,code .tag{color:#006;font-weight:bold}pre .atn,code .atn{color:#404}pre .atv,code .atv{color:#060}} \ No newline at end of file diff --git a/lib/zerobin.php b/lib/zerobin.php index 19fcb1d3..a1617f5f 100644 --- a/lib/zerobin.php +++ b/lib/zerobin.php @@ -486,6 +486,8 @@ class zerobin $page->assign('VERSION', self::VERSION); $page->assign('OPENDISCUSSION', $this->_getMainConfig('opendiscussion', true)); $page->assign('SYNTAXHIGHLIGHTING', $this->_getMainConfig('syntaxhighlighting', true)); + $page->assign('SYNTAXHIGHLIGHTINGTHEME', $this->_getMainConfig('syntaxhighlightingtheme', '')); + $page->assign('NOTICE', $this->_getMainConfig('notice', '')); $page->assign('BURNAFTERREADINGSELECTED', $this->_getMainConfig('burnafterreadingselected', false)); $page->assign('BASE64JSVERSION', $this->_getMainConfig('base64version', '2.1.9')); $page->assign('EXPIRE', $expire); diff --git a/tst/RainTPL.php b/tst/RainTPL.php index f6409c98..d5250bbf 100644 --- a/tst/RainTPL.php +++ b/tst/RainTPL.php @@ -34,7 +34,9 @@ class RainTPLTest extends PHPUnit_Framework_TestCase $page->assign('BURNAFTERREADINGSELECTED', false); $page->assign('OPENDISCUSSION', false); $page->assign('SYNTAXHIGHLIGHTING', true); + $page->assign('SYNTAXHIGHLIGHTINGTHEME', 'sons-of-obsidian'); $page->assign('BASE64JSVERSION', '2.1.9'); + $page->assign('NOTICE', 'example'); $page->assign('EXPIRE', self::$expire); $page->assign('EXPIREDEFAULT', self::$expire_default); ob_start();