aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/plugins/syntax.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/syntax.php')
-rw-r--r--lib/plugins/syntax.php39
1 files changed, 14 insertions, 25 deletions
diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php
index 9e2913d78..b74bb5bf0 100644
--- a/lib/plugins/syntax.php
+++ b/lib/plugins/syntax.php
@@ -2,42 +2,36 @@
/**
* Syntax Plugin Prototype
*
- * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
- * @author Andreas Gohr <andi@splitbrain.org>
- */
-// must be run within Dokuwiki
-if(!defined('DOKU_INC')) die();
-
-/**
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Andreas Gohr <andi@splitbrain.org>
*/
-class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin {
+abstract class DokuWiki_Syntax_Plugin extends \dokuwiki\Parsing\ParserMode\Plugin {
+ use DokuWiki_PluginTrait;
- var $allowedModesSetup = false;
+ protected $allowedModesSetup = false;
/**
* Syntax Type
*
- * Needs to return one of the mode types defined in $PARSER_MODES in parser.php
+ * Needs to return one of the mode types defined in $PARSER_MODES in Parser.php
*
* @return string
*/
- function getType(){
- trigger_error('getType() not implemented in '.get_class($this), E_USER_WARNING);
- return '';
- }
+ abstract public function getType();
/**
* Allowed Mode Types
*
* Defines the mode types for other dokuwiki markup that maybe nested within the
* plugin's own markup. Needs to return an array of one or more of the mode types
- * defined in $PARSER_MODES in parser.php
+ * defined in $PARSER_MODES in Parser.php
*
* @return array
*/
- function getAllowedTypes() {
+ public function getAllowedTypes() {
return array();
}
@@ -55,7 +49,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin {
*
* @return string
*/
- function getPType(){
+ public function getPType(){
return 'normal';
}
@@ -73,9 +67,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin {
* @param Doku_Handler $handler The Doku_Handler object
* @return bool|array Return an array with all data you want to use in render, false don't add an instruction
*/
- function handle($match, $state, $pos, Doku_Handler $handler){
- trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING);
- }
+ abstract public function handle($match, $state, $pos, Doku_Handler $handler);
/**
* Handles the actual output creation.
@@ -100,10 +92,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin {
* @param array $data data created by handler()
* @return boolean rendered correctly? (however, returned value is not used at the moment)
*/
- function render($format, Doku_Renderer $renderer, $data) {
- trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING);
-
- }
+ abstract public function render($format, Doku_Renderer $renderer, $data);
/**
* There should be no need to override this function
@@ -111,7 +100,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin {
* @param string $mode
* @return bool
*/
- function accepts($mode) {
+ public function accepts($mode) {
if (!$this->allowedModesSetup) {
global $PARSER_MODES;