DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:wow

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:wow [2009-09-05 00:38] 90.2.178.187plugin:wow [2018-06-06 09:08] (current) – [Download and Installation] Klap-in
Line 2: Line 2:
  
 ---- plugin ---- ---- plugin ----
-description: Allow to automatic link or name extract from Wowhead with an ID+description: Allow to automatic link and name extract from Wowhead with an ID
 author     : Sardem FF7 author     : Sardem FF7
 email      : sardemff7.pub@gmail.com email      : sardemff7.pub@gmail.com
 type       : Syntax type       : Syntax
-lastupdate : 2009-09-04 +lastupdate : 2010-03-08 
-tags       : WoW, french+tags       : embed 
 + 
 +downloadurl: http://sardemff7.free.fr/dokuwiki/wow.tar.gz
 ---- ----
  
 ===== Download and Installation ===== ===== Download and Installation =====
  
-Refer to [[:Plugins]] on how to install plugins manually.+Download and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
 +  * http://sardemff7.free.fr/dokuwiki/wow.tar.gz
  
-The code for french name extract.+===== Features and Changelog =====
  
-<code php wow/syntax.php> +  * [2010-03-08] Fix: the regular expression used to get names work only for French. (hope Russian work) 
-<?php +  * [2010-03-08] Fix: little typo error (Wowead => Wowhead). 
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +  * [2009-09-22] Add a permanent cacheWill add a cache-clean option later
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +  * [2009-09-11] Search name of a spell, a NPCa zone or a quest by ID, from Wowhead
-require_once(DOKU_PLUGIN.'syntax.php');+  * [2009-09-11] Can use all different Wowhead languages : French, English, German, Spanish and Russian.
  
-class syntax_plugin_wow extends DokuWiki_Syntax_Plugin +===== Syntax Samples =====
-+
- function getInfo() +
-+
- return array( +
- 'author' => 'Sardem FF7', +
- 'email' => 'sardemff7.pub@gmail.com', +
- 'date' => '2009-09-04', +
- 'name' => 'WoW Plugin', +
- 'desc' => 'Allow to automatic link or name extract from Wowhead with an ID', +
- 'url' => 'http://www.dokuwiki.org/plugin:wow', +
- ); +
-+
-  +
- function getType() +
-+
- return 'substition'; +
-+
-  +
- /* Optionnel +
- function getAllowedTypes() +
-+
- return array(); +
-+
- */ +
-  +
- /* Optionnel +
- function getPType() +
-+
- return 'normal'; +
-+
- */ +
-  +
- function getSort() +
-+
- return 400; +
-+
-  +
- function connectTo($mode) +
-+
- $this->Lexer->addSpecialPattern("~~WoW [qisn]:\d+~~", $mode, "plugin_wow"); +
-/* $this->Lexer->addEntryPattern("<WoW [qisn]:\d+(:[hj])?>(?=.*</WoW>)", $mode, "plugin_wow"); */ +
-+
-  +
- /* +
- function postConnect() +
-+
- $this->Lexer->addExitPattern("</WoW>","plugin_wow"); +
-+
- */ +
-  +
- function handle($match, $state, $pos, &$handler) +
-+
- preg_match("#~~WoW ([qisn]):(\d+)~~#", $match, $matches); +
- return array($matches[1], $matches[2], $matches[3]); +
-+
-  +
- function render($mode, &$renderer, $data) +
-+
- if( $mode == "xhtml"+
-+
- list($type, $id) $data; +
- $link "http://fr.wowhead.com/?"; +
- switch ( $type ) +
-+
- case "q"+
- $link .= "quest"; +
- break; +
- case "i"+
- $link .= "item"; +
- break; +
- case "s"+
- $link .= "spell"; +
- break; +
- case "n"+
- $link .= "npc"; +
- break; +
-+
- $link .= "=" . $id; +
- $page = http_get($link); +
-  +
- preg_match('#<title>(.+) - (?:Sort|Quête|PNJ|Objet) - World of Warcraft</title>#', $page, $matches); +
- //~ preg_match('#<title>([^<]+)</title>#', $pageText, $matches); +
- $name = $matches[1]; +
-  +
- preg_match("#^(.+/)(?:[^/]+).(?:php|html?)$#", preg_quote($_SERVER["SCRIPT_NAME"]), $matches); +
-  +
- $renderer->doc .= '<a href="' . $link . '"><img src="' . $matches[1] . 'lib/images/smileys/wowhead.png" alt="Wowead" />' . $name . '</a>'; +
- return true; +
-+
- return false; +
-+
-+
-?> +
-</code>+
  
 +The syntax to use this plugin is very simple:
 +  ~~WoW type:number~~
 +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 (''zones='' in Wowhead url)
 +  * //number//: the ID of the target on Wowhead (so after the ''item='' or ''quest='' or other)
plugin/wow.1252103914.txt.gz · Last modified: 2009-09-05 00:38 by 90.2.178.187

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki