plugin:wow
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:wow [2009-09-04 11:40] – removed requirement for PECL andi | plugin:wow [2018-06-06 09:08] (current) – [Download and Installation] Klap-in | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
email : sardemff7.pub@gmail.com | email : sardemff7.pub@gmail.com | ||
type : Syntax | type : Syntax | ||
- | lastupdate : 2009-09-04 | + | lastupdate : 2010-03-08 |
- | tags : | + | tags : |
+ | |||
+ | downloadurl: | ||
---- | ---- | ||
===== Download and Installation ===== | ===== Download and Installation ===== | ||
- | Refer to [[: | + | Download and install the plugin using the [[plugin: |
- | + | ||
- | + | ||
- | The code for french name extract. | + | |
- | + | ||
- | <code php wow/ | + | |
- | <?php | + | |
- | if(!defined(' | + | |
- | if(!defined(' | + | |
- | require_once(DOKU_PLUGIN.' | + | |
- | class syntax_plugin_wow extends DokuWiki_Syntax_Plugin | + | |
- | { | + | |
- | /** | + | |
- | * Get an associative array with plugin info. | + | |
- | * | + | |
- | * <p> | + | |
- | * The returned array holds the following fields: | + | |
- | * < | + | |
- | * < | + | |
- | * < | + | |
- | * < | + | |
- | * < | + | |
- | * < | + | |
- | * < | + | |
- | * < | + | |
- | * (eg. syntax description)</ | + | |
- | * </ | + | |
- | * @param none | + | |
- | * @return Array Information about this plugin class. | + | |
- | * @public | + | |
- | * @static | + | |
- | */ | + | |
- | function getInfo() | + | |
- | { | + | |
- | return array( | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ); | + | |
- | } | + | |
- | /** | + | |
- | * Get the type of syntax this plugin defines. | + | |
- | * | + | |
- | * @param none | + | |
- | * @return String < | + | |
- | * @public | + | |
- | * @static | + | |
- | */ | + | |
- | function getType() | + | |
- | { | + | |
- | return ' | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * What kind of syntax do we allow (optional) | + | |
- | */ | + | |
- | /* Optionnel | + | |
- | function getAllowedTypes() | + | |
- | { | + | |
- | return array(); | + | |
- | } | + | |
- | */ | + | |
- | + | ||
- | /** | + | |
- | * Define how this plugin is handled regarding paragraphs. | + | |
- | * | + | |
- | * <p> | + | |
- | * This method is important for correct XHTML nesting. It returns | + | |
- | * one of the following values: | + | |
- | * </ | + | |
- | * < | + | |
- | * < | + | |
- | * < | + | |
- | * plugin output.</ | + | |
- | * < | + | |
- | * </ | + | |
- | * @param none | + | |
- | * @return String < | + | |
- | * @public | + | |
- | * @static | + | |
- | */ | + | |
- | /* Optionnel | + | |
- | function getPType() | + | |
- | { | + | |
- | return ' | + | |
- | } | + | |
- | */ | + | |
- | /** | + | ===== Features and Changelog ===== |
- | * Where to sort in? | + | |
- | * | + | |
- | * @param none | + | |
- | * @return Integer < | + | |
- | * @public | + | |
- | * @static | + | |
- | */ | + | |
- | function getSort() | + | |
- | { | + | |
- | return 400; | + | |
- | } | + | |
- | + | ||
- | + | ||
- | /** | + | |
- | * Connect lookup pattern to lexer. | + | |
- | * | + | |
- | * @param $aMode String The desired rendermode. | + | |
- | * @return none | + | |
- | * @public | + | |
- | * @see render() | + | |
- | */ | + | |
- | function connectTo($mode) | + | |
- | { | + | |
- | $this-> | + | |
- | / | + | |
- | } | + | |
- | /* | + | |
- | function postConnect() | + | * [2010-03-08] Fix: little typo error (Wowead => Wowhead). |
- | { | + | * [2009-09-22] Add a permanent cache. Will add a cache-clean option later. |
- | $this->Lexer-> | + | * [2009-09-11] Search name of a spell, a NPC, a zone or a quest by ID, from Wowhead. |
- | } | + | * [2009-09-11] Can use all different Wowhead languages : French, English, German, Spanish and Russian. |
- | */ | + | |
- | /** | + | ===== Syntax |
- | * Handler to prepare matched data for the rendering process. | + | |
- | * | + | |
- | * <p> | + | |
- | * The < | + | |
- | * which triggered the call to this method: | + | |
- | * </ | + | |
- | * < | + | |
- | * < | + | |
- | * <dd>a pattern set by < | + | |
- | * < | + | |
- | * <dd>a pattern set by < | + | |
- | * < | + | |
- | * <dd> a pattern set by < | + | |
- | * < | + | |
- | * <dd>a pattern set by < | + | |
- | * < | + | |
- | * < | + | |
- | * which doesn' | + | |
- | * </ | + | |
- | * @param $aMatch String The text matched by the patterns. | + | |
- | * @param $aState Integer The lexer state for the match. | + | |
- | * @param $aPos Integer The character position of the matched text. | + | |
- | * @param $aHandler Object Reference to the Doku_Handler object. | + | |
- | * @return Integer The current lexer state for the match. | + | |
- | * @public | + | |
- | * @see render() | + | |
- | * @static | + | |
- | */ | + | |
- | function handle($match, | + | |
- | { | + | |
- | preg_match("/ | + | |
- | return array($state, | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * Handle the actual output creation. | + | |
- | * | + | |
- | * <p> | + | |
- | * The method checks for the given < | + | |
- | * < | + | |
- | * contains a reference to the renderer object which is currently | + | |
- | * handling the rendering. The contents of < | + | |
- | * return value of the < | + | |
- | * </ | + | |
- | * @param $aFormat String The output format to generate. | + | |
- | * @param $aRenderer Object A reference to the renderer object. | + | |
- | * @param $aData Array The data created by the < | + | |
- | * method. | + | |
- | * @return Boolean < | + | |
- | * < | + | |
- | * @public | + | |
- | * @see handle() | + | |
- | */ | + | |
- | function render($mode, | + | |
- | if( $mode == " | + | |
- | { | + | |
- | list($type, | + | |
- | $name | + | |
- | } | + | |
- | return false; | + | |
- | } | + | |
- | + | ||
- | function getName($type, | + | |
- | { | + | |
- | $page = "http://"; | + | |
- | switch ( $site ) | + | |
- | { | + | |
- | case " | + | |
- | $page .= " | + | |
- | switch ( $type ) | + | |
- | { | + | |
- | case " | + | |
- | $page .= " | + | |
- | break; | + | |
- | case " | + | |
- | $page .= " | + | |
- | break; | + | |
- | case " | + | |
- | $page .= " | + | |
- | break; | + | |
- | case " | + | |
- | $page .= " | + | |
- | break; | + | |
- | } | + | |
- | $page .= "& | + | |
- | break; | + | |
- | default : | + | |
- | $page .= " | + | |
- | switch ( $type ) | + | |
- | { | + | |
- | case " | + | |
- | $page .= " | + | |
- | break; | + | |
- | case " | + | |
- | $page .= " | + | |
- | break; | + | |
- | case " | + | |
- | $page .= " | + | |
- | break; | + | |
- | case " | + | |
- | $page .= " | + | |
- | break; | + | |
- | } | + | |
- | $page .= " | + | |
- | } | + | |
- | $page .= $id; | + | |
- | + | ||
- | require_once(DOKU_INC.'/ | + | |
- | $http = new DokuHTTPClient(); | + | |
- | $pageText = http-> | + | |
- | + | ||
- | switch ( $site ) | + | |
- | { | + | |
- | case " | + | |
- | preg_match('#< | + | |
- | $name = $matches[1]; | + | |
- | break; | + | |
- | default : | + | |
- | preg_match('#< | + | |
- | $name = $matches[1]; | + | |
- | } | + | |
- | + | ||
- | return $name; | + | |
- | } | + | |
- | } | + | |
- | ?> | + | |
- | </ | + | |
+ | The syntax to use this plugin is very simple: | ||
+ | ~~WoW type: | ||
+ | With: | ||
+ | * //type//: | ||
+ | * **q** for a quest | ||
+ | * **i** for an item | ||
+ | * **s** for a spell | ||
+ | * **n** for a NPC | ||
+ | * **z** for a zone | ||
+ | * **r** for a group of zone ('' | ||
+ | * //number//: the ID of the target on Wowhead (so after the '' |
plugin/wow.1252057231.txt.gz · Last modified: 2009-09-04 11:40 by andi