From 6ea007c9f8c6830ea4f21ad880e91279e2f4bf10 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 16 May 2015 18:40:21 +0200 Subject: a first very basic implementation of the preview mechanism --- lib/plugins/styler/admin.php | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lib/plugins/styler/admin.php (limited to 'lib/plugins/styler/admin.php') diff --git a/lib/plugins/styler/admin.php b/lib/plugins/styler/admin.php new file mode 100644 index 000000000..8ecbd22a0 --- /dev/null +++ b/lib/plugins/styler/admin.php @@ -0,0 +1,74 @@ + + */ + +// must be run within Dokuwiki +if(!defined('DOKU_INC')) die(); + +class admin_plugin_styler extends DokuWiki_Admin_Plugin { + + /** + * @return int sort number in admin menu + */ + public function getMenuSort() { + return 1000; + } + + /** + * @return bool true if only access for superuser, false is for superusers and moderators + */ + public function forAdminOnly() { + return true; + } + + /** + * Should carry out any processing required by the plugin. + */ + public function handle() { + set_doku_pref('styler_plugin', 1); + } + + /** + * Render HTML output, e.g. helpful text and a form + */ + public function html() { + global $conf; + $tpl = $conf['template']; + define('SIMPLE_TEST',1); // hack, ideally certain functions should be moved out of css.php + require_once(DOKU_INC.'lib/exe/css.php'); + $styleini = css_styleini($conf['template'], true); + $replacements = $styleini['replacements']; + + ptln('

'.$this->getLang('menu').'

'); + + if (empty($replacements)) { + echo '

Sorry, this template does not support this functionality.

'; + } else { + echo '

Intro blah... for the currently active template ("'.$tpl.'")... not all variables preview...

'; + + echo '
'; + echo '

Template variables

'; + echo ''; + foreach($replacements as $key => $value){ + echo ''; + echo ''; + echo ''; + } + echo '
'.$key.''; + echo '
'; + echo ''; + echo '
'; + } + + + + } + + +} + +// vim:ts=4:sw=4:et: \ No newline at end of file -- cgit v1.2.3