Index: trunk/extensions/GoogleNewsSitemap/FeedSMItem.php |
— | — | @@ -11,6 +11,11 @@ |
12 | 12 | private $keywords = array(); |
13 | 13 | |
14 | 14 | /** |
| 15 | + * @var Title |
| 16 | + */ |
| 17 | + private $titleObj; |
| 18 | + |
| 19 | + /** |
15 | 20 | * @param Title $title Title object that this entry is for. |
16 | 21 | * @param String $pubDate Publish date formattable by wfTimestamp. |
17 | 22 | * @param Array $keywords list of (String) keywords |
— | — | @@ -20,7 +25,7 @@ |
21 | 26 | * An integer for the page name of $title in the specific namespace denoted by that integer. |
22 | 27 | */ |
23 | 28 | public function __construct( $title, $pubDate, $keywords = '', $comment = true ) { |
24 | | - if ( !$title ) { |
| 29 | + if ( !$title || !$title instanceof Title ) { |
25 | 30 | // Paranoia |
26 | 31 | throw new MWException( 'Invalid title object passed to FeedSMItem' ); |
27 | 32 | } |
— | — | @@ -37,8 +42,8 @@ |
38 | 43 | } |
39 | 44 | } |
40 | 45 | |
41 | | - $this->title = $title; |
42 | 46 | $this->keywords = $keywords; |
| 47 | + $this->titleObj = $title; |
43 | 48 | |
44 | 49 | parent::__construct( $title->getText(), '' /* Description */, |
45 | 50 | $title->getFullURL(), $pubDate, '' /* Author */, $commentsURL ); |
— | — | @@ -62,7 +67,7 @@ |
63 | 68 | } |
64 | 69 | |
65 | 70 | public function getLastMod() { |
66 | | - return $this->title->getTouched(); |
| 71 | + return $this->titleObj->getTouched(); |
67 | 72 | } |
68 | 73 | |
69 | 74 | public function getKeywords() { |
— | — | @@ -88,12 +93,9 @@ |
89 | 94 | // but not much worse than the rest of this extension. |
90 | 95 | |
91 | 96 | $result = ''; |
92 | | - if ( !$this->title ) { |
93 | | - return $result; |
94 | | - } |
95 | 97 | $req = new FauxRequest( array( |
96 | 98 | 'action' => 'parse', |
97 | | - 'page' => $this->title->getPrefixedDBKey(), |
| 99 | + 'page' => $this->titleObj->getPrefixedDBKey(), |
98 | 100 | 'prop' => 'text', |
99 | 101 | ) ); |
100 | 102 | $main = new ApiMain( $req ); |