[ Index ]
 

Code source de DokuWiki 2006-11-06

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/plugins/ -> syntax.php (sommaire)

Syntax Plugin Prototype

Author: Andreas Gohr <andi@splitbrain.org>
License: GPL 2 (http://www.gnu.org/licenses/gpl.html)
Poids: 270 lignes (9 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 1 fichier
 inc/parser/parser.php

Définit 1 class

DokuWiki_Syntax_Plugin:: (17 méthodes):
  getInfo()
  getType()
  getAllowedTypes()
  getPType()
  handle()
  render()
  accepts()
  getPluginType()
  getPluginName()
  getPluginComponent()
  getLang()
  locale_xhtml()
  localFN()
  setupLocale()
  getConf()
  loadConfig()
  readDefaultSettings()


Classe: DokuWiki_Syntax_Plugin  - X-Ref

All DokuWiki plugins to extend the parser/rendering mechanism
need to inherit from this class

getInfo()   X-Ref
General Info

Needs to return a associative array with the following values:

author - Author of the plugin
email  - Email address to contact the author
date   - Last modified date of the plugin in YYYY-MM-DD format
name   - Name of the plugin
desc   - Short description of the plugin (Text only)
url    - Website with more information on the plugin (eg. syntax description)

getType()   X-Ref
Syntax Type

Needs to return one of the mode types defined in $PARSER_MODES in parser.php

getAllowedTypes()   X-Ref
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

getPType()   X-Ref
Paragraph Type

Defines how this syntax is handled regarding paragraphs. This is important
for correct XHTML nesting. Should return one of the following:

'normal' - The plugin can be used inside paragraphs
'block'  - Open paragraphs need to be closed before plugin output
'stack'  - Special case. Plugin wraps other paragraphs.


handle($match, $state, $pos, &$handler)   X-Ref
Handler to prepare matched data for the rendering process

This function can only pass data to render() via its return value - render()
may be not be run during the object's current life.

Usually you should only need the $match param.

param: $match   string    The text matched by the patterns
param: $state   int       The lexer state for the match
param: $pos     int       The character position of the matched text
param: $handler ref       Reference to the Doku_Handler object
return: array              Return an array with all data you want to use in render

render($format, &$renderer, $data)   X-Ref
Handles the actual output creation.

The function must not assume any other of the classes methods have been run
during the object's current life. The only reliable data it receives are its
parameters.

The function should always check for the given output format and return false
when a format isn't supported.

$renderer contains a reference to the renderer object which is
currently handling the rendering. You need to use it for writing
the output. How this is done depends on the renderer used (specified
by $format

The contents of the $data array depends on what the handler() function above
created

param: $format   string   output format to being Rendered
param: $renderer ref      reference to the current renderer object
param: $data     array    data created by handler()
return: boolean            rendered correctly?

accepts($mode)   X-Ref
There should be no need to override these functions


getPluginType()   X-Ref
Pas de description

getPluginName()   X-Ref
Pas de description

getPluginComponent()   X-Ref
Pas de description

getLang($id)   X-Ref
getLang($id)

use this function to access plugin language strings
to try to minimise unnecessary loading of the strings when the plugin doesn't require them
e.g. when info plugin is querying plugins for information about themselves.

param: $id     id of the string to be retrieved
return: string  string in appropriate language or english if not available

locale_xhtml($id)   X-Ref
locale_xhtml($id)

retrieve a language dependent wiki page and pass to xhtml renderer for display
plugin equivalent of p_locale_xhtml()

param: $id     id of language dependent wiki page
return: string  parsed contents of the wiki page in xhtml format

localFN($id)   X-Ref
localFN($id)
prepends appropriate path for a language dependent filename
plugin equivalent of localFN()


setupLocale()   X-Ref
setupLocale()
reads all the plugins language dependent strings into $this->lang
this function is automatically called by getLang()


getConf($setting)   X-Ref
getConf($setting)

use this function to access plugin configuration variables

loadConfig()   X-Ref
loadConfig()
merges the plugin's default settings with any local settings
this function is automatically called through getConf()


readDefaultSettings()   X-Ref
read the plugin's default configuration settings from conf/default.php
this function is automatically called through getConf()

return: array    setting => value



Généré le : Tue Apr 3 20:47:31 2007 par Balluche grâce à PHPXref 0.7