*/ 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'); class syntax_plugin_pagebox extends DokuWiki_Syntax_Plugin { function getInfo(){ return array( 'author' => 'Luigi micco', 'email' => 'l.micco@tiscali.it', 'date' => '2010-09-06', 'name' => 'Pagebox Plugin (syntax component)', 'desc' => 'Allow to use box like MediaWiki to show table and pages', 'url' => 'http://www.bitlibero.com/dokuwiki/pagebox-06.09.2010.zip', ); } function getType(){ return 'protected'; } function getAllowedTypes() { return array('substition','protected','disabled','formatting'); } function getSort(){ return 315; } function getPType(){ return 'block'; } function connectTo($mode) { $this->Lexer->addSpecialPattern('{{pagebox>.+?}}', $mode, 'plugin_pagebox'); } function handle($match, $state, $pos, &$handler) { $match = substr($match, 2, -2); // strip markup list($match, $flags) = explode('&', $match, 2); // break the pattern up into its constituent parts list($include, $id, $section) = preg_split('/>|#/u', $match, 3); return array($include, $id, explode('&', $flags)); } function render($mode, &$renderer, $data){ list($type, $page_id, $flags) = $data; if ($type == "pagebox") { if(auth_quickaclcheck($page_id) >= AUTH_READ) { if($mode == 'xhtml'){ $align = 'void'; $width = 'auto'; foreach($flags as $value) { if (is_numeric($value)) $width = $value.'px'; if (strtolower($value) == 'right') $align = 'right'; if (strtolower($value) == 'center') $align = 'center'; if (strtolower($value) == 'left') $align = 'left'; } $renderer->doc.= '