From: Aryeh Gregor Date: Tue, 9 Jan 2007 02:45:09 +0000 (+0000) Subject: Two new functions for Title: isRedirect (maybe should be left Article-only?) and... X-Git-Tag: 1.31.0-rc.0~54566 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=0bcc2bb2e20fd6e651aa09c0e00bf15cb5e09c8c;p=lhc%2Fweb%2Fwiklou.git Two new functions for Title: isRedirect (maybe should be left Article-only?) and getArticle --- diff --git a/includes/Title.php b/includes/Title.php index 171c8b1080..fab065473e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -280,8 +280,6 @@ class Title { * @param string $text the redirect title text * @return Title the new object, or NULL if the text is not a * valid redirect - * @static - * @access public */ public static function newFromRedirect( $text ) { $mwRedir = MagicWord::get( 'redirect' ); @@ -513,6 +511,16 @@ class Title { return (bool)(Title::$interwikiCache[$k]->iw_trans); } + /** + * Determine whether a Title is a redirect + * + * @return bool + */ + public function isRedirect() { + $article = new Article( $this ); + return $article->isRedirect(); + } + /** * Update the page_touched field for an array of title objects * @todo Inefficient unless the IDs are already loaded into the @@ -1386,9 +1394,8 @@ class Title { * @param int $flags a bit field; may be GAID_FOR_UPDATE to select * for update * @return int the ID - * @access public */ - function getArticleID( $flags = 0 ) { + public function getArticleID( $flags = 0 ) { $linkCache =& LinkCache::singleton(); if ( $flags & GAID_FOR_UPDATE ) { $oldUpdate = $linkCache->forUpdate( true ); @@ -1402,6 +1409,15 @@ class Title { return $this->mArticleID; } + /** + * Return the associated Article object. + * + * @return Article + */ + public function getArticle() { + return new Article( $this ); + } + function getLatestRevID() { if ($this->mLatestID !== false) return $this->mLatestID;