plugin:phpwikify:source
Plugin PHP Wikify Old Source Code
The following code runs on DokuWiki 2017-02-19e Frusterick Manners :
- syntax.php
<?php /** * PHP-Wikify plugin: lets the parser wikify output of php scripts * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Kasper Sandberg <redeeman@metanurb.dk> * @author Schplurtz le Déboulonné <Schplurtz@laposte.net> */ // must be run within Dokuwiki if (!defined('DOKU_INC')) die(); class syntax_plugin_phpwikify extends DokuWiki_Syntax_Plugin { function getInfo(){ return array( 'author' => 'Kasper Sandberg', 'email' => 'redeeman@metanurb.dk', 'date' => '2017-12-26', 'name' => 'PHP-Wikify Plugin', 'desc' => 'Enables php to be processed by renderer', 'url' => 'http://wiki.kaspersandberg.com/doku.php?projects:dokuwiki:phpwikify', ); } function getType(){ return "protected"; } function getPType(){ return "normal"; } function getSort(){ return 0; } function connectTo( $mode ) { $this->Lexer->addEntryPattern("<phpwikify>(?=.*?</phpwikify>)",$mode,"plugin_phpwikify"); } function postConnect() { $this->Lexer->addExitPattern( "</phpwikify>","plugin_phpwikify"); } function handle( $match, $state, $pos, Doku_Handler $handler ){ return array($state,$match); } function render( $mode, Doku_Renderer $renderer, $data ) { if($mode == 'xhtml'){ list($state, $data) = $data; if ($state === DOKU_LEXER_UNMATCHED) { ob_start(); eval( $data ); $renderer->doc .= p_render( "xhtml", p_get_instructions( ob_get_contents() ), $info ); ob_end_clean(); } return true; } return false; } }
Old source code :
This is a copy of the plugin displayed at http://wiki.kaspersandberg.com/doku.php?id=projects:dokuwiki:phpwikify 2010-04-03, please check original site for latest version.
- syntax.php
<?php /** * PHP-Wikify plugin: lets the parser wikify output of php scripts * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Kasper Sandberg <redeeman@metanurb.dk> */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'inc/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); class syntax_plugin_phpwikify extends DokuWiki_Syntax_Plugin { function syntax_plugin_phpwikify(){ global $PARSER_MODES; $this->allowedModes = $PARSER_MODES['formatting']; } function getInfo(){ return array( 'author' => 'Kasper Sandberg', 'email' => 'redeeman@metanurb.dk', 'date' => '2005-07-22', 'name' => 'PHP-Wikify Plugin', 'desc' => 'Enables php to be processed by renderer', 'url' => 'http://wiki.kaspersandberg.com/doku.php?projects:dokuwiki:phpwikify', ); } function getType(){ return "protected"; } function getPType(){ return "normal"; } function getSort(){ return 0; } function connectTo( $mode ) { $this->Lexer->addEntryPattern("<phpwikify>",$mode,"plugin_phpwikify"); } function postConnect() { $this->Lexer->addExitPattern( "</phpwikify>","plugin_phpwikify"); } function handle( $match, $state, $pos, &$handler ){ $match = ereg_replace( "<phpwikify>", "", $match ); $match = ereg_replace( "</phpwikify>", "", $match ); return $match; } function render( $mode, &$renderer, $data ) { if($mode == 'xhtml'){ ob_start(); eval( $data ); $renderer->doc .= p_render( "xhtml", p_get_instructions( ob_get_contents() ), $info ); ob_end_clean(); return true; } return false; } } ?>
← Back to Plugin PHP Wikify
plugin/phpwikify/source.txt · Last modified: 2020-06-05 23:40 by trailjeep