+ /**
+ * convert link text to all supported variants
+ *
+ * @param string $text the text to be converted
+ * @return array of string
+ * @public
+ */
+ function convertLinkToAllVariants($text) {
+ if( !$this->mTablesLoaded )
+ $this->loadTables();
+
+ $ret = array();
+ $tarray = explode($this->mMarkup['begin'], $text);
+ $tfirst = array_shift($tarray);
+
+ foreach($this->mVariants as $variant)
+ $ret[$variant] = $this->translate($tfirst,$variant);
+
+ foreach($tarray as $txt) {
+ $marked = explode($this->mMarkup['end'], $txt, 2);
+
+ foreach($this->mVariants as $variant){
+ $ret[$variant] .= $this->mMarkup['begin'].$marked[0].$this->mMarkup['end'];
+ if(array_key_exists(1, $marked))
+ $ret[$variant] .= $this->translate($marked[1],$variant);
+ }
+
+ }
+
+ return $ret;
+ }
+
+
+ /**
+ * Convert text using a parser object for context
+ */
+ function parserConvert( $text, &$parser ) {
+ global $wgDisableLangConversion;
+ /* don't do anything if this is the conversion table */
+ if ( $parser->getTitle()->getNamespace() == NS_MEDIAWIKI &&
+ strpos($parser->mTitle->getText(), "Conversiontable") !== false )
+ {
+ return $text;
+ }
+
+ if($wgDisableLangConversion)
+ return $text;
+
+ $text = $this->convert( $text );
+ $parser->mOutput->setTitleText( $this->mTitleDisplay );
+ return $text;
+ }
+
+ /**
+ * Parse flags with syntax -{FLAG| ... }-
+ *
+ */
+ function parseFlags($marked){
+ $flags = array();
+
+ // process flag only if the flag is valid
+ if(strlen($marked) < 2 || !(in_array($marked[0],$this->mFlags) && $marked[1]=='|' ) )
+ return array($marked,array());
+
+ $tt = explode($this->mMarkup['flagsep'], $marked, 2);
+
+ if(sizeof($tt) == 2) {
+ $f = explode($this->mMarkup['varsep'], $tt[0]);
+ foreach($f as $ff) {
+ $ff = trim($ff);
+ if(array_key_exists($ff, $this->mFlags) &&
+ !array_key_exists($this->mFlags[$ff], $flags))
+ $flags[] = $this->mFlags[$ff];
+ }
+ $rules = $tt[1];
+ }
+ else
+ $rules = $marked;
+
+ if( !in_array('R',$flags) ){
+ //FIXME: may cause trouble here...
+ //strip since it interferes with the parsing, plus,
+ //all spaces should be stripped in this tag anyway.
+ $rules = str_replace(' ', '', $rules);
+ }
+
+ return array($rules,$flags);
+ }
+