return $url;
}
- /**
- * Get a real URL referring to this title in some of the variant
- *
- * @param string $variant variant name
- * @return string the URL
- * @access public
- */
- function getFullVariantURL( $variant = '' ) {
- global $wgServer, $wgRequest;
-
- $url=''; // this function should not be called for interwiki
-
- if ( '' == $this->mInterwiki ) {
- $url = $this->getLocalVariantURL( $variant );
-
- if ($wgRequest->getVal('action') != 'render') {
- $url = $wgServer . $url;
- }
- }
-
- # Finally, add the fragment.
- if ( '' != $this->mFragment ) {
- $url .= '#' . $this->mFragment;
- }
-
- return $url;
- }
-
-
/**
* Get a URL with no fragment or server name. If this page is generated
* with action=render, $wgServer is prepended.
return $url;
}
- /**
- * Similar to getLocalURL, except it uses $wgVariantArticlePath
- * and gets the URL with no fragment or server name, but in a
- * certain language variant (relevant only to languages with variants)
- * @param string $variant caption of variant
- * @return string the URL
- * @access public
- */
- function getLocalVariantURL( $variant='' ) {
- global $wgVariantArticlePath,$wgScript;
- if($variant=='') return $this->getLocalURL();
-
- if($wgVariantArticlePath==false)
- $wgVariantArticlePath = "$wgScript?title=$1&variant=$2";
-
- $dbkey = wfUrlencode( $this->getPrefixedDBkey() );
- $url = str_replace( '$1', $dbkey, $wgVariantArticlePath );
- $code = urlencode( $variant );
- $url = str_replace( '$2', $code, $url );
-
- return $url;
-
- }
-
/**
* Get an HTML-escaped version of the URL form, suitable for
* using in a link, without a server name or fragment
return $req;
}
- // check the syntax /code/ArticleTitle
- $script = $_SERVER['SCRIPT_NAME'];
- $variants = implode('|',$this->mVariants);
- if(preg_match("/($variants)$/",$script,$matches)){
- $this->mPreferredVariant = $matches[1];
- return $this->mPreferredVariant;
- }
-
// get language variant preference from logged in users
// Don't call this on stub objects because that causes infinite
// recursion during initialisation
$entry = $this->fileEntry( $title->getFullURL(), $date, $this->priority( $namespace ) );
$length += strlen( $entry );
$this->write( $this->file, $entry );
- // generate pages for language variants
- if($wgContLang->hasVariants()){
- $variants = $wgContLang->getVariants();
- foreach($variants as $vCode){
- if($vCode==$wgContLang->getCode()) continue; // we don't want default variant
- $entry = $this->fileEntry( $title->getFullVariantURL($vCode), $date, $this->priority( $namespace ) );
- $length += strlen( $entry );
- $this->write( $this->file, $entry );
- }
- }
}
if ( $this->file ) {
$this->write( $this->file, $this->closeFile() );