====== Password Plugin ====== ---- plugin ---- description: Hides passwords from plain view author : Roland Eckert email : roland.eckert@gmail.com type : syntax lastupdate : 2007-09-26 compatible : 2006-03-09 depends : conflicts : similar : tags : password, hide downloadurl: http://rolandeckert.com/_media/projects/plugin-password.tgz ---- ===== Description ===== This password syntax plugin screens text from view. It may be used for storing clear-text passwords which otherwise would be stored fully visible. Only users with write access to the page can view the wiki source. This may be just enough security for non-important passwords or group access in an internal wiki. ===== Security notice ===== **Use at your own risk!** Usage of [[ACL]] is recommended. Don't put anything really important in a wiki. Valuable passwords need to be properly encrypted when stored at all. **Passwords are still visible in page diffs and in search results!** ===== Usage ===== Format the text to hide with the following markup: Password: Mew3obrIt4 shows Password: [see wiki source] ===== Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. * http://rolandeckert.com/_media/projects/plugin-password.tgz * * @license GPL2 (http://www.gnu.org/licenses/gpl.html) * @author Roland Eckert */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); /** * All DokuWiki plugins to extend the parser/rendering mechanism * need to inherit from this class */ class syntax_plugin_password extends DokuWiki_Syntax_Plugin { /** * return some info */ function getInfo(){ return array( 'author' => 'Roland Eckert', 'email' => 'roland.eckert@gmail.com', 'date' => '2007-09-26', 'name' => 'Password Plugin', 'desc' => 'This plugin hides passwords from plain view', 'url' => 'http://www.dokuwiki.org/plugin:password', ); } /** * What kind of syntax are we? */ function getType(){ return 'protected'; } /** * Where to sort in? */ function getSort(){ return 201; } /** * Connect pattern to lexer */ function connectTo($mode) { $this->Lexer->addEntryPattern('(?=.*?)',$mode,'plugin_password'); } function postConnect() { $this->Lexer->addExitPattern('','plugin_password'); } /** * Handle the match */ function handle($match, $state, $pos, &$handler){ switch ($state) { case DOKU_LEXER_ENTER : return array($state, ''); break; case DOKU_LEXER_UNMATCHED : return array($state, $match); break; case DOKU_LEXER_EXIT : return array($state, ''); break; } return array(); } /** * Create output */ function render($mode, &$renderer, $data) { if($mode == 'xhtml'){ list($state, $match) = $data; switch ($state) { case DOKU_LEXER_ENTER : list($color, $background) = $match; $renderer->doc.= ''; break; case DOKU_LEXER_UNMATCHED : $renderer->doc.= 'see wiki source'; break; case DOKU_LEXER_EXIT : $renderer->doc .= ""; break; } return true; } return false; } } ?>