Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Class: Text_Wiki_Parse_Wikilink

Source Location: /Text_Wiki_Mediawiki-0.2.0/Text/Wiki/Parse/Mediawiki/Wikilink.php

Class Overview

Text_Wiki_Parse
   |
   --Text_Wiki_Parse_Wikilink

Wikilink, Interwiki and Image rules parser class for Mediawiki.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2005 bertrand Gugger

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 41]
Wikilink, Interwiki and Image rules parser class for Mediawiki.

This class implements a Text_Wiki_Parse to find links marked in source by text surrounded by 2 opening/closing brackets as [[Wiki page name#Section|Alternate text]] On parsing, the link is replaced with a token.



[ Top ]


Class Variables

$conf = array(
        'spaceUnderscore' => true,
        'project' => array('demo', 'd'),'url'=>'http://example.com/en/page=%s','langage'=>'en')

[line 49]

Configuration for this rule (Wikilink)
  • Access: public

Type:   array


[ Top ]

$imageConf = array(
        'prefix' => array('Image', 'image'))

[line 62]

Configuration for the Image rule
  • Access: public

Type:   array


[ Top ]

$interwikiConf = array(
        'sites' => array(
            'manual' => 'http://www.php.net/manual/en/%s',
            'pear'   => 'http://pear.php.net/package/%s',
            'bugs'   => 'http://pear.php.net/package/%s/bugs'
        ),'interlangage'=>array('en','de','fr'))

[line 72]

Configuration for the Interwiki rule
  • Access: public

Type:   array


[ Top ]

$regex =  '/(?<!\[)\[\[(?!\[)\s*(:?)((?:[^:]+:)+)?([^:]+)(?:#(.*))?\s*(?:\|(((?R))|.*))?]]/msU'

[line 89]

The regular expression used to parse the source text and find matches conforming to this rule. Used by the parse() method.
  • See: Text_Wiki_Parse::parse()
  • Access: public

Type:   string


[ Top ]



Method Detail

Text_Wiki_Parse_Wikilink (Constructor)   [line 99]

The Text_Wiki_Parse_Wikilink( object &$obj)

Constructor.

We override the constructor to get Image and Interwiki config

  • Return: parser object
  • Access: public

Parameters:

object   &$obj   —  the base conversion handler

[ Top ]

image   [line 247]

string image( $name, $text, $interlang, $colon, array &$matches)

Generates an image token. Token options are:

  • 'src' => the name of the image file
  • 'attr' => an array of attributes for the image:
| - 'alt' => the optional alternate image text | - 'align' => 'left', 'center' or 'right' | - 'width' => 'NNNpx' | - 'height' => 'NNNpx'

  • Return: token to be used as replacement
  • Access: public

Parameters:

array   &$matches   —  The array of matches from parse().
   $name   — 
   $text   — 
   $interlang   — 
   $colon   — 

[ Top ]

interwiki   [line 294]

string interwiki( $site, $interwiki, $page, $text, $interlang, $colon, array &$matches)

Generates an interwiki token. Token options are:

  • 'page' => the name of the target wiki page
  • 'site' => the key for external site
  • 'url' => the full target url
  • 'text' => the optional alternate link text

  • Return: token to be used as replacement
  • Access: public

Parameters:

array   &$matches   —  The array of matches from parse().
   $site   — 
   $interwiki   — 
   $page   — 
   $text   — 
   $interlang   — 
   $colon   — 

[ Top ]

process   [line 151]

string process( array &$matches)

Generates a replacement for the matched text. Token options are:

  • 'page' => the name of the target wiki page
  • 'anchor' => the optional section in it
  • 'text' => the optional alternate link text

  • Return: token to be used as replacement
  • Access: public

Parameters:

array   &$matches   —  The array of matches from parse().

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:32:43 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.