Source of file WikiFormatter.php
Size: 1,007 Bytes - Last Modified: 2021-12-23T10:07:55+00:00
/var/www/docs.ssmods.com/process/src/code/formatters/WikiFormatter.php
123456789101112131415161718192021222324252627282930313233343536373839404142 | <?php /** * Wiki style formatter * * @author Marcus Nyeholt <marcus@silverstripe.com.au> * @license BSD License (http://silverstripe.org/BSD-License) */ class WikiFormatter extends SimpleWikiFormatter { public function getFormatterName() { return "Wiki"; } public function getEditingField(DataObject $wikiPage) { return new MarkItUpField('Content', '', 'wiki', 30, 20); } public function formatRaw($string) { include_once SIMPLEWIKI_DIR . '/thirdparty/wikiparser-1.0/class_WikiParser.php'; $parser = new WikiParser(); $parser->emphasis = array(); $parser->preformat = false; // need to change [] urls before parsing the text otherwise // the wiki parser breaks... $string = preg_replace('/\[sitetree_link id=(\d+)\]/', '|sitetree_link id=\\1|', $string); $string = $parser->parse($string, ''); $string = preg_replace('/\|sitetree_link id=(\d+)\|/', '[sitetree_link id=\\1]', $string); return $string; } public function getHelpUrl() { return null; } } ?> |