Commit: 91769f6a037b2679aa036189aacc09a54340f5c1
Author: Christoph M. Becker <[email protected]> Wed, 8 Apr 2015
23:10:30 +0200
Parents: 9494b1430c4ff43b7db62c9717f3dad4ddcd09b4
Branches: master
Link:
http://git.php.net/?p=web/wiki.git;a=commitdiff;h=91769f6a037b2679aa036189aacc09a54340f5c1
Log:
merged phpbugid and phpml plugins into phplinks plugin
Changed paths:
D dokuwiki/lib/plugins/phpbugid/plugin.info.txt
D dokuwiki/lib/plugins/phpbugid/syntax.php
A dokuwiki/lib/plugins/phplinks/plugin.info.txt
A dokuwiki/lib/plugins/phplinks/syntax.php
D dokuwiki/lib/plugins/phpml/plugin.info.txt
D dokuwiki/lib/plugins/phpml/syntax.php
diff --git a/dokuwiki/lib/plugins/phpbugid/plugin.info.txt
b/dokuwiki/lib/plugins/phpbugid/plugin.info.txt
deleted file mode 100644
index 658911d..0000000
--- a/dokuwiki/lib/plugins/phpbugid/plugin.info.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-base phpbugid
-author Lukas Kahwe Smith
-email <[email protected]>
-date 2008-06-20
-name PHP Bug id
-desc Add a short syntax to link to php bugs
-url https://wiki.php.net/wiki/phpbugid
diff --git a/dokuwiki/lib/plugins/phpbugid/syntax.php
b/dokuwiki/lib/plugins/phpbugid/syntax.php
deleted file mode 100644
index ee15c91..0000000
--- a/dokuwiki/lib/plugins/phpbugid/syntax.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * Plugin link to a php bug id
- *
- * @license LGPL 3 (http://www.gnu.org/licenses/lgpl.html)
- * @author Lukas Kahwe Smith <[email protected]>
- */
-
-if(!defined('DOKU_INC'))
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_PLUGIN.'syntax.php');
-
-/**
- * All DokuWiki plugins to extend the parser/rendering mechanism
- * need to inherit from this class
- */
-class syntax_plugin_phpbugid extends DokuWiki_Syntax_Plugin {
-
-
- /**
- * What kind of syntax are we?
- */
- function getType(){
- return 'substition';
- }
-
- // Just before build in links
- function getSort(){ return 299; }
-
- function connectTo($mode) {
-
$this->Lexer->addSpecialPattern('\[\[bugid\@\d+[^\]]*\]\]',$mode,'plugin_phpbugid');
- }
-
-
- /**
- * Handle the match
- */
- function handle($match, $state, $pos, &$handler){
- $match = substr($match,8,-2); //strip [[bugid@ from start and ]] from
end
- $match = explode("|",$match);
- return $match;
- }
-
- /**
- * Create output
- */
- function render($mode, &$renderer, $data) {
- if($mode == 'xhtml'){
- $text=$this->_buglink($renderer, $data[0], $data[1]);
- $renderer->doc .= $text;
- return true;
- }
- return false;
- }
-
-
- function _buglink(&$renderer, $bugid, $name = NULL) {
- global $conf;
- if (!isset($name)) {
- $name = 'bug #'.$bugid;
- }
-
- $url = 'http://bugs.php.net/bug.php?id='.$bugid;
-
-// $name = $renderer->_xmlEntities($renderer->_getLinkTitle($name,
$url, $isImage));
- $name = $renderer->_getLinkTitle($name, $url, $isImage);
-
- $class='urlextern';
- $link['target'] = $conf['target']['wiki'];
- $link['style'] = '';
- $link['pre'] = '';
- $link['suf'] = '';
- $link['more'] = '';
- $link['class'] = $class;
- $link['url'] = $url;
- $link['name'] = $name;
- $link['title'] = $renderer->_xmlEntities($name);
-
- //output formatted
- return $renderer->_formatLink($link);
- }
-
-}
-?>
diff --git a/dokuwiki/lib/plugins/phplinks/plugin.info.txt
b/dokuwiki/lib/plugins/phplinks/plugin.info.txt
new file mode 100644
index 0000000..1a1faa5
--- /dev/null
+++ b/dokuwiki/lib/plugins/phplinks/plugin.info.txt
@@ -0,0 +1,7 @@
+base phplinks
+author The PHP Group
+email [email protected]
+date 2015-04-08
+name PHP Links
+desc Shortcut syntax for links to PHP mailing lists and bug tracker; based
on phpbugid and phpml by Lukas Kahwe Smith
+url https://wiki.php.net/wiki/phplinks
diff --git a/dokuwiki/lib/plugins/phplinks/syntax.php
b/dokuwiki/lib/plugins/phplinks/syntax.php
new file mode 100644
index 0000000..7e9009f
--- /dev/null
+++ b/dokuwiki/lib/plugins/phplinks/syntax.php
@@ -0,0 +1,127 @@
+<?php
+
+/**
+ * Shortcut syntax for links to PHP mailing lists and bug tracker
+ *
+ * @license LGPL 3 (http://www.gnu.org/licenses/lgpl.html)
+ * @author Lukas Kahwe Smith <[email protected]>
+ * @author Christoph Michael Becker <[email protected]>
+ */
+
+// 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.
+ */
+class syntax_plugin_phplinks extends DokuWiki_Syntax_Plugin
+{
+ /**
+ * Returns the type of syntax this plugin defines.
+ *
+ * @return string
+ */
+ function getType()
+ {
+ return 'substition';
+ }
+
+ /**
+ * Returns a number used to determine in which order modes are added.
+ *
+ * @return int
+ *
+ * @link https://www.dokuwiki.org/devel:parser:getsort_list
+ */
+ function getSort()
+ {
+ return 299;
+ }
+
+ /**
+ * Registers the regular expressions needed to match the special syntax.
+ *
+ * @param string $mode
+ *
+ * @return void
+ */
+ function connectTo($mode)
+ {
+ $this->Lexer->addSpecialPattern(
+ '\[\[[-a-z]+\@\d+[^\]]*\]\]', $mode, 'plugin_phplinks'
+ );
+ }
+
+ /**
+ * Prepares the matched syntax for use in the renderer.
+ *
+ * @param string $match
+ * @param int $state
+ * @param int $pos
+ * @param Doku_Handler $handler
+ *
+ * @return void
+ */
+ function handle($match, $state, $pos, Doku_Handler $handler)
+ {
+ preg_match('/\[\[([-a-z]+)\@(\d+)\|?([^\]]*)\]\]/', $match, $matches);
+ if ($matches[1] == 'bugid') {
+ $name = $matches[3] ? $matches[3] : 'bug #' . $matches[2];
+ $url = 'http://bugs.php.net/bug.php?id=' . $matches[1];
+ } else {
+ $name = $matches[3] ? $matches[3] : 'ml#' . $matches[2];
+ $url = 'http://marc.info/?l=' . $matches[1] . '&m=' . $matches[2];
+ }
+ return array($name, $url);
+ }
+
+ /**
+ * Renders the content.
+ *
+ * @param string $mode
+ * @param Doku_Renderer $renderer
+ * @param mixed $data
+ *
+ * @return void
+ */
+ function render($mode, Doku_Renderer $renderer, $data)
+ {
+ if ($mode == 'xhtml') {
+ $renderer->doc .= $this->_renderLink($renderer, $data[0],
$data[1]);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Renders a link.
+ *
+ * @param Doku_Renderer $renderer
+ * @param string $name
+ * @param string $url
+ *
+ * @return string
+ *
+ * @global array $conf
+ */
+ private function _renderLink(Doku_Renderer $renderer, $name, $url)
+ {
+ global $conf;
+
+ $link = array(
+ 'target' => $conf['target']['wiki'],
+ 'style' => '',
+ 'pre' => '',
+ 'suf' => '',
+ 'more' => '',
+ 'class' => 'urlextern',
+ 'url' => $url,
+ 'name' => $name,
+ 'title' => $renderer->_xmlEntities($name)
+ );
+ return $renderer->_formatLink($link);
+ }
+}
+
+?>
diff --git a/dokuwiki/lib/plugins/phpml/plugin.info.txt
b/dokuwiki/lib/plugins/phpml/plugin.info.txt
deleted file mode 100644
index de86aa2..0000000
--- a/dokuwiki/lib/plugins/phpml/plugin.info.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-base phpml
-author Lukas Kahwe Smith
-email <[email protected]>
-date 2008-06-20
-name PHP ML
-desc Add a short syntax to link to php mailinglists
-url https://wiki.php.net/wiki/phpml
diff --git a/dokuwiki/lib/plugins/phpml/syntax.php
b/dokuwiki/lib/plugins/phpml/syntax.php
deleted file mode 100644
index 2a88949..0000000
--- a/dokuwiki/lib/plugins/phpml/syntax.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * Plugin link to a php mailinglist
- *
- * @license LGPL 3 (http://www.gnu.org/licenses/lgpl.html)
- * @author Lukas Kahwe Smith <[email protected]>
- */
-
-if(!defined('DOKU_INC'))
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_PLUGIN.'syntax.php');
-
-/**
- * All DokuWiki plugins to extend the parser/rendering mechanism
- * need to inherit from this class
- */
-class syntax_plugin_phpml extends DokuWiki_Syntax_Plugin {
-
-
- /**
- * What kind of syntax are we?
- */
- function getType(){
- return 'substition';
- }
-
- // Just before build in links
- function getSort(){ return 299; }
-
- function connectTo($mode) {
-
$this->Lexer->addSpecialPattern('\[\[[-a-z]+\@\d+[^\]]*\]\]',$mode,'plugin_phpml');
- }
-
-
- /**
- * Handle the match
- */
- function handle($match, $state, $pos, &$handler){
- if (preg_match('/\[\[([-a-z]+)\@(\d+)\|?([^\]]*)\]\]/', $match,
$matches)) {
- array_shift($matches);
- if (count($matches) < 2) {
- $matches[1] = null;
- }
- if (count($matches) < 3) {
- $matches[2] = null;
- }
- } else {
- $matches - array(null, null, null);
- }
-
- return $matches;
- }
-
- /**
- * Create output
- */
- function render($mode, &$renderer, $data) {
- if($mode == 'xhtml'){
- $text=$this->_mllink($renderer, $data[0], $data[1], $data[2]);
- $renderer->doc .= $text;
- return true;
- }
- return false;
- }
-
-
- function _mllink(&$renderer, $ml, $msgid, $name = NULL) {
- global $conf;
- if (!isset($name) || $name === '') {
- $name = 'ml#'.$msgid;
- }
-
- $url = 'http://marc.info/?l='.$ml.'&m='.$msgid;
-
-// $name = $renderer->_xmlEntities($renderer->_getLinkTitle($name,
$url, $isImage));
- $name = $renderer->_getLinkTitle($name, $url, $isImage);
-
- $class='urlextern';
- $link['target'] = $conf['target']['wiki'];
- $link['style'] = '';
- $link['pre'] = '';
- $link['suf'] = '';
- $link['more'] = '';
- $link['class'] = $class;
- $link['url'] = $url;
- $link['name'] = $name;
- $link['title'] = $renderer->_xmlEntities($name);
-
- //output formatted
- return $renderer->_formatLink($link);
- }
-
-}
-?>--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php