return null;
}
-# ----------------------------------------------------------------------------
-# Static functions
-# ----------------------------------------------------------------------------
-
/**
* Get the prefixed DB key associated with an ID
*
return $name;
}
+ /**
+ * Escape a text fragment, say from a link, for a URL
+ *
+ * @param $fragment string containing a URL or link fragment (after the "#")
+ * @return String: escaped string
+ */
+ static function escapeFragmentForURL( $fragment ) {
+ # Note that we don't urlencode the fragment. urlencoded Unicode
+ # fragments appear not to work in IE (at least up to 7) or in at least
+ # one version of Opera 9.x. The W3C validator, for one, doesn't seem
+ # to care if they aren't encoded.
+ return Sanitizer::escapeId( $fragment, 'noninitial' );
+ }
+
/**
* Determine whether the object refers to a page within
* this project.
}
}
+ /**
+ * Is this Title interwiki?
+ *
+ * @return Bool
+ */
+ public function isExternal() {
+ return ( $this->mInterwiki != '' );
+ }
+
+ /**
+ * Get the interwiki prefix (or null string)
+ *
+ * @return String Interwiki prefix
+ */
+ public function getInterwiki() {
+ return $this->mInterwiki;
+ }
+
/**
* Determine whether the object refers to a page within
* this project and is transcludable.
return Interwiki::fetch( $this->mInterwiki )->getWikiID();
}
- /**
- * Escape a text fragment, say from a link, for a URL
- *
- * @param $fragment string containing a URL or link fragment (after the "#")
- * @return String: escaped string
- */
- static function escapeFragmentForURL( $fragment ) {
- # Note that we don't urlencode the fragment. urlencoded Unicode
- # fragments appear not to work in IE (at least up to 7) or in at least
- # one version of Opera 9.x. The W3C validator, for one, doesn't seem
- # to care if they aren't encoded.
- return Sanitizer::escapeId( $fragment, 'noninitial' );
- }
-
-# ----------------------------------------------------------------------------
-# Other stuff
-# ----------------------------------------------------------------------------
-
- /** Simple accessors */
/**
* Get the text form (spaces not underscores) of the main part
*
* @return String Main part of the title
*/
- public function getText() { return $this->mTextform; }
+ public function getText() {
+ return $this->mTextform;
+ }
/**
* Get the URL-encoded form of the main part
*
* @return String Main part of the title, URL-encoded
*/
- public function getPartialURL() { return $this->mUrlform; }
+ public function getPartialURL() {
+ return $this->mUrlform;
+ }
/**
* Get the main part with underscores
*
* @return String: Main part of the title, with underscores
*/
- public function getDBkey() { return $this->mDbkeyform; }
+ public function getDBkey() {
+ return $this->mDbkeyform;
+ }
/**
* Get the namespace index, i.e. one of the NS_xxxx constants.
*
* @return Integer: Namespace index
*/
- public function getNamespace() { return $this->mNamespace; }
+ public function getNamespace() {
+ return $this->mNamespace;
+ }
/**
* Get the namespace text
return( MWNamespace::canTalk( $this->mNamespace ) );
}
- /**
- * Get the interwiki prefix (or null string)
- *
- * @return String Interwiki prefix
- */
- public function getInterwiki() { return $this->mInterwiki; }
-
/**
* Get the Title fragment (i.e.\ the bit after the #) in text form
*
*
* @return Int Default namespace index
*/
- public function getDefaultNamespace() { return $this->mDefaultNamespace; }
+ public function getDefaultNamespace() {
+ return $this->mDefaultNamespace;
+ }
/**
* Get title for search index
return( $parts[count( $parts ) - 1] );
}
+ /**
+ * Get the HTML-escaped displayable text form.
+ * Used for the title field in <a> tags.
+ *
+ * @return String the text, including any prefixes
+ */
+ public function getEscapedText() {
+ return htmlspecialchars( $this->getPrefixedText() );
+ }
+
/**
* Get a URL-encoded form of the subpage text
*
return htmlspecialchars( $this->getFullURL( $query ) );
}
- /**
- * HTML-escaped version of getCanonicalURL()
- * @since 1.18
- */
- public function escapeCanonicalURL( $query = '', $variant = false ) {
- return htmlspecialchars( $this->getCanonicalURL( $query, $variant ) );
- }
-
/**
* Get the URL form for an internal link.
* - Used in various Squid-related code, in case we have a different
return $url;
}
+ /**
+ * HTML-escaped version of getCanonicalURL()
+ * @since 1.18
+ */
+ public function escapeCanonicalURL( $query = '', $variant = false ) {
+ return htmlspecialchars( $this->getCanonicalURL( $query, $variant ) );
+ }
+
/**
* Get the edit URL for this Title
*
return $s;
}
- /**
- * Get the HTML-escaped displayable text form.
- * Used for the title field in <a> tags.
- *
- * @return String the text, including any prefixes
- */
- public function getEscapedText() {
- return htmlspecialchars( $this->getPrefixedText() );
- }
-
- /**
- * Is this Title interwiki?
- *
- * @return Bool
- */
- public function isExternal() {
- return ( $this->mInterwiki != '' );
- }
-
/**
* Is this page "semi-protected" - the *only* protection is autoconfirm?
*