33 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
44 * @author Andreas Gohr <[email protected] > 55 */
6- // must be run within Dokuwiki
7- if (!defined ('DOKU_INC ' )) die ();
8-
9- if (!defined ('DOKU_PLUGIN ' )) define ('DOKU_PLUGIN ' , DOKU_INC . 'lib/plugins/ ' );
10- require_once (DOKU_PLUGIN . 'syntax.php ' );
116
127class syntax_plugin_xref extends DokuWiki_Syntax_Plugin
138{
149
15- var $ dir = '' ;
16- var $ web = '' ;
10+ protected $ dir = '' ;
11+ protected $ web = '' ;
1712
18- function syntax_plugin_xref ()
13+ public function __construct ()
1914 {
2015 $ this ->dir = rtrim ($ this ->getConf ('dir ' ), '/ ' );
2116 $ this ->web = rtrim ($ this ->getConf ('web ' ), '/ ' );
2217 }
2318
24- /**
25- * What kind of syntax are we?
26- */
27- function getType ()
19+ /** @inheritdoc */
20+ public function getType ()
2821 {
2922 return 'substition ' ;
3023 }
3124
32- /**
33- * What about paragraphs?
34- */
35- function getPType ()
25+ /** @inheritdoc */
26+ public function getPType ()
3627 {
3728 return 'normal ' ;
3829 }
3930
40- /**
41- * Where to sort in?
42- */
43- function getSort ()
31+ /** @inheritdoc */
32+ public function getSort ()
4433 {
4534 return 150 ;
4635 }
4736
48- /**
49- * Connect pattern to lexer
50- */
51- function connectTo ($ mode )
37+ /** @inheritdoc */
38+ public function connectTo ($ mode )
5239 {
5340 $ this ->Lexer ->addSpecialPattern ('\[\[xref>.+?\]\] ' , $ mode , 'plugin_xref ' );
5441 }
5542
56- /**
57- * Handle the match
58- */
59- function handle ($ match , $ state , $ pos , Doku_Handler $ handler )
43+ /** @inheritdoc */
44+ public function handle ($ match , $ state , $ pos , Doku_Handler $ handler )
6045 {
6146 $ match = trim (substr ($ match , 7 , -2 ));
6247
@@ -67,15 +52,13 @@ function handle($match, $state, $pos, Doku_Handler $handler)
6752
6853 $ first = 0 ;
6954 if ($ link [0 ] == '$ ' ) $ first = 4 ;
70- $ found = $ this ->_find ($ link , $ first );
55+ $ found = $ this ->find ($ link , $ first );
7156
7257 return array ($ link , $ found , $ name , $ anchor );
7358 }
7459
75- /**
76- * Create output
77- */
78- function render ($ format , Doku_Renderer $ R , $ data )
60+ /** @inheritdoc */
61+ public function render ($ format , Doku_Renderer $ R , $ data )
7962 {
8063 global $ conf ;
8164 if ($ format != 'xhtml ' ) return false ;
@@ -107,7 +90,7 @@ function render($format, Doku_Renderer $R, $data)
10790 *
10891 * @param int $first - defines which type should be searched first for the name
10992 */
110- function _find ($ name , $ first = 0 )
93+ protected function find ($ name , $ first = 0 )
11194 {
11295 $ paths = array (
11396 0 => '_functions ' ,
@@ -140,5 +123,3 @@ function _find($name, $first = 0)
140123 }
141124
142125}
143-
144- //Setup VIM: ex: et ts=4 enc=utf-8 :
0 commit comments