| Index: trunk/phase3/includes/OutputPage.php |
| — | — | @@ -57,6 +57,7 @@ |
| 58 | 58 | private $mVaryHeader = array( 'Accept-Encoding' => array('list-contains=gzip'), |
| 59 | 59 | 'Cookie' => null ); |
| 60 | 60 | |
| | 61 | + |
| 61 | 62 | /** |
| 62 | 63 | * Constructor |
| 63 | 64 | * Initialise private variables |
| — | — | @@ -66,12 +67,23 @@ |
| 67 | 68 | $this->mAllowUserJs = $wgAllowUserJs; |
| 68 | 69 | } |
| 69 | 70 | |
| | 71 | + /** |
| | 72 | + * Redirect to $url rather than displaying the normal page |
| | 73 | + * |
| | 74 | + * @param $url String: URL |
| | 75 | + * @param $responsecode String: HTTP status code |
| | 76 | + */ |
| 70 | 77 | public function redirect( $url, $responsecode = '302' ) { |
| 71 | 78 | # Strip newlines as a paranoia check for header injection in PHP<5.1.2 |
| 72 | 79 | $this->mRedirect = str_replace( "\n", '', $url ); |
| 73 | 80 | $this->mRedirectCode = $responsecode; |
| 74 | 81 | } |
| 75 | 82 | |
| | 83 | + /** |
| | 84 | + * Get the URL to redirect to, or an empty string if not redirect URL set |
| | 85 | + * |
| | 86 | + * @return String |
| | 87 | + */ |
| 76 | 88 | public function getRedirect() { |
| 77 | 89 | return $this->mRedirect; |
| 78 | 90 | } |
| — | — | @@ -79,11 +91,14 @@ |
| 80 | 92 | /** |
| 81 | 93 | * Set the HTTP status code to send with the output. |
| 82 | 94 | * |
| 83 | | - * @param int $statusCode |
| | 95 | + * @param $statusCode Integer |
| 84 | 96 | * @return nothing |
| 85 | 97 | */ |
| 86 | | - function setStatusCode( $statusCode ) { $this->mStatusCode = $statusCode; } |
| | 98 | + public function setStatusCode( $statusCode ) { |
| | 99 | + $this->mStatusCode = $statusCode; |
| | 100 | + } |
| 87 | 101 | |
| | 102 | + |
| 88 | 103 | /** |
| 89 | 104 | * Add a new <meta> tag |
| 90 | 105 | * To add an http-equiv meta tag, precede the name with "http:" |
| — | — | @@ -95,19 +110,56 @@ |
| 96 | 111 | array_push( $this->mMetatags, array( $name, $val ) ); |
| 97 | 112 | } |
| 98 | 113 | |
| | 114 | + /** |
| | 115 | + * Add a keyword or a list of keywords in the page header |
| | 116 | + * |
| | 117 | + * @param $text String or array of strings |
| | 118 | + */ |
| 99 | 119 | function addKeyword( $text ) { |
| 100 | | - if( is_array( $text )) { |
| | 120 | + if( is_array( $text ) ) { |
| 101 | 121 | $this->mKeywords = array_merge( $this->mKeywords, $text ); |
| 102 | 122 | } else { |
| 103 | 123 | array_push( $this->mKeywords, $text ); |
| 104 | 124 | } |
| 105 | 125 | } |
| | 126 | + |
| | 127 | + /** |
| | 128 | + * Add a new \<link\> tag to the page header |
| | 129 | + * |
| | 130 | + * @param $linkarr Array: associative array of attributes. |
| | 131 | + */ |
| | 132 | + function addLink( $linkarr ) { |
| | 133 | + array_push( $this->mLinktags, $linkarr ); |
| | 134 | + } |
| | 135 | + |
| | 136 | + /** |
| | 137 | + * Add a new \<link\> with "rel" attribute set to "meta" |
| | 138 | + * |
| | 139 | + * @param $linkarr Array: associative array mapping attribute names to their |
| | 140 | + * values, both keys and values will be escaped, and the |
| | 141 | + * "rel" attribute will be automatically added |
| | 142 | + */ |
| | 143 | + function addMetadataLink( $linkarr ) { |
| | 144 | + # note: buggy CC software only reads first "meta" link |
| | 145 | + static $haveMeta = false; |
| | 146 | + $linkarr['rel'] = $haveMeta ? 'alternate meta' : 'meta'; |
| | 147 | + $this->addLink( $linkarr ); |
| | 148 | + $haveMeta = true; |
| | 149 | + } |
| | 150 | + |
| | 151 | + |
| | 152 | + /** |
| | 153 | + * Add raw HTML to the list of scripts (including \<script\> tag, etc.) |
| | 154 | + * |
| | 155 | + * @param $script String: raw HTML |
| | 156 | + */ |
| 106 | 157 | function addScript( $script ) { |
| 107 | 158 | $this->mScripts .= $script . "\n"; |
| 108 | 159 | } |
| 109 | 160 | |
| 110 | 161 | /** |
| 111 | 162 | * Register and add a stylesheet from an extension directory. |
| | 163 | + * |
| 112 | 164 | * @param $url String path to sheet. Provide either a full url (beginning |
| 113 | 165 | * with 'http', etc) or a relative path from the document root |
| 114 | 166 | * (beginning with '/'). Otherwise it behaves identically to |
| — | — | @@ -118,10 +170,21 @@ |
| 119 | 171 | } |
| 120 | 172 | |
| 121 | 173 | /** |
| | 174 | + * Get all links added by extensions |
| | 175 | + * |
| | 176 | + * @return Array |
| | 177 | + */ |
| | 178 | + function getExtStyle() { |
| | 179 | + return $this->mExtStyles; |
| | 180 | + } |
| | 181 | + |
| | 182 | + /** |
| 122 | 183 | * Add a JavaScript file out of skins/common, or a given relative path. |
| 123 | | - * @param string $file filename in skins/common or complete on-server path (/foo/bar.js) |
| | 184 | + * |
| | 185 | + * @param $file String: filename in skins/common or complete on-server path |
| | 186 | + * (/foo/bar.js) |
| 124 | 187 | */ |
| 125 | | - function addScriptFile( $file ) { |
| | 188 | + public function addScriptFile( $file ) { |
| 126 | 189 | global $wgStylePath, $wgStyleVersion; |
| 127 | 190 | if( substr( $file, 0, 1 ) == '/' ) { |
| 128 | 191 | $path = $file; |
| — | — | @@ -133,19 +196,27 @@ |
| 134 | 197 | |
| 135 | 198 | /** |
| 136 | 199 | * Add a self-contained script tag with the given contents |
| 137 | | - * @param string $script JavaScript text, no <script> tags |
| | 200 | + * |
| | 201 | + * @param $script String: JavaScript text, no <script> tags |
| 138 | 202 | */ |
| 139 | | - function addInlineScript( $script ) { |
| | 203 | + public function addInlineScript( $script ) { |
| 140 | 204 | $this->mScripts .= Html::inlineScript( "\n$script\n" ) . "\n"; |
| 141 | 205 | } |
| 142 | 206 | |
| 143 | 207 | /** |
| 144 | 208 | * Get all registered JS and CSS tags for the header. |
| | 209 | + * |
| | 210 | + * @return String |
| 145 | 211 | */ |
| 146 | 212 | function getScript() { |
| 147 | 213 | return $this->mScripts . $this->getHeadItems(); |
| 148 | 214 | } |
| 149 | 215 | |
| | 216 | + /** |
| | 217 | + * Get all header items in a string |
| | 218 | + * |
| | 219 | + * @return String |
| | 220 | + */ |
| 150 | 221 | function getHeadItems() { |
| 151 | 222 | $s = ''; |
| 152 | 223 | foreach ( $this->mHeadItems as $item ) { |
| — | — | @@ -154,36 +225,56 @@ |
| 155 | 226 | return $s; |
| 156 | 227 | } |
| 157 | 228 | |
| 158 | | - function addHeadItem( $name, $value ) { |
| | 229 | + /** |
| | 230 | + * Add or replace an header item to the output |
| | 231 | + * |
| | 232 | + * @param $name String: item name |
| | 233 | + * @param $value String: raw HTML |
| | 234 | + */ |
| | 235 | + public function addHeadItem( $name, $value ) { |
| 159 | 236 | $this->mHeadItems[$name] = $value; |
| 160 | 237 | } |
| 161 | 238 | |
| 162 | | - function hasHeadItem( $name ) { |
| | 239 | + /** |
| | 240 | + * Check if the header item $name is already set |
| | 241 | + * |
| | 242 | + * @param $name String: item name |
| | 243 | + * @return Boolean |
| | 244 | + */ |
| | 245 | + public function hasHeadItem( $name ) { |
| 163 | 246 | return isset( $this->mHeadItems[$name] ); |
| 164 | 247 | } |
| 165 | 248 | |
| 166 | | - function setETag($tag) { $this->mETag = $tag; } |
| 167 | | - function setArticleBodyOnly($only) { $this->mArticleBodyOnly = $only; } |
| 168 | | - function getArticleBodyOnly() { return $this->mArticleBodyOnly; } |
| 169 | | - |
| 170 | | - function addLink( $linkarr ) { |
| 171 | | - # $linkarr should be an associative array of attributes. We'll escape on output. |
| 172 | | - array_push( $this->mLinktags, $linkarr ); |
| | 249 | + /** |
| | 250 | + * Set the value of the ETag HTTP header, only used if $wgUseETag is true |
| | 251 | + * |
| | 252 | + * @param $tag String: value of "ETag" header |
| | 253 | + */ |
| | 254 | + function setETag( $tag ) { |
| | 255 | + $this->mETag = $tag; |
| 173 | 256 | } |
| 174 | 257 | |
| 175 | | - # Get all links added by extensions |
| 176 | | - function getExtStyle() { |
| 177 | | - return $this->mExtStyles; |
| | 258 | + /** |
| | 259 | + * Set whether the output should only contain the body of the article, |
| | 260 | + * without any skin, sidebar, etc. |
| | 261 | + * Used e.g. when calling with "action=raw". |
| | 262 | + * |
| | 263 | + * @param $only Boolean: whether to output only the body of the article |
| | 264 | + */ |
| | 265 | + public function setArticleBodyOnly( $only ) { |
| | 266 | + $this->mArticleBodyOnly = $only; |
| 178 | 267 | } |
| 179 | 268 | |
| 180 | | - function addMetadataLink( $linkarr ) { |
| 181 | | - # note: buggy CC software only reads first "meta" link |
| 182 | | - static $haveMeta = false; |
| 183 | | - $linkarr['rel'] = ($haveMeta) ? 'alternate meta' : 'meta'; |
| 184 | | - $this->addLink( $linkarr ); |
| 185 | | - $haveMeta = true; |
| | 269 | + /** |
| | 270 | + * Return whether the output will contain only the body of the article |
| | 271 | + * |
| | 272 | + * @return Boolean |
| | 273 | + */ |
| | 274 | + public function getArticleBodyOnly() { |
| | 275 | + return $this->mArticleBodyOnly; |
| 186 | 276 | } |
| 187 | 277 | |
| | 278 | + |
| 188 | 279 | /** |
| 189 | 280 | * checkLastModified tells the client to use the client-cached page if |
| 190 | 281 | * possible. If sucessful, the OutputPage is disabled so that |
| — | — | @@ -191,9 +282,9 @@ |
| 192 | 283 | * |
| 193 | 284 | * Side effect: sets mLastModified for Last-Modified header |
| 194 | 285 | * |
| 195 | | - * @return bool True iff cache-ok headers was sent. |
| | 286 | + * @return Boolean: true iff cache-ok headers was sent. |
| 196 | 287 | */ |
| 197 | | - function checkLastModified( $timestamp ) { |
| | 288 | + public function checkLastModified( $timestamp ) { |
| 198 | 289 | global $wgCachePages, $wgCacheEpoch, $wgUser, $wgRequest; |
| 199 | 290 | |
| 200 | 291 | if ( !$timestamp || $timestamp == '19700101000000' ) { |
| — | — | @@ -273,20 +364,11 @@ |
| 274 | 365 | return true; |
| 275 | 366 | } |
| 276 | 367 | |
| 277 | | - function setPageTitleActionText( $text ) { |
| 278 | | - $this->mPageTitleActionText = $text; |
| 279 | | - } |
| 280 | 368 | |
| 281 | | - function getPageTitleActionText () { |
| 282 | | - if ( isset( $this->mPageTitleActionText ) ) { |
| 283 | | - return $this->mPageTitleActionText; |
| 284 | | - } |
| 285 | | - } |
| 286 | | - |
| 287 | 369 | /** |
| 288 | 370 | * Set the robot policy for the page: <http://www.robotstxt.org/meta.html> |
| 289 | 371 | * |
| 290 | | - * @param $policy string The literal string to output as the contents of |
| | 372 | + * @param $policy String: the literal string to output as the contents of |
| 291 | 373 | * the meta tag. Will be parsed according to the spec and output in |
| 292 | 374 | * standardized form. |
| 293 | 375 | * @return null |
| — | — | @@ -296,10 +378,10 @@ |
| 297 | 379 | |
| 298 | 380 | if( isset( $policy['index'] ) ){ |
| 299 | 381 | $this->setIndexPolicy( $policy['index'] ); |
| 300 | | - } |
| | 382 | + } |
| 301 | 383 | if( isset( $policy['follow'] ) ){ |
| 302 | 384 | $this->setFollowPolicy( $policy['follow'] ); |
| 303 | | - } |
| | 385 | + } |
| 304 | 386 | } |
| 305 | 387 | |
| 306 | 388 | /** |
| — | — | @@ -320,7 +402,7 @@ |
| 321 | 403 | * Set the follow policy for the page, but leave the index policy un- |
| 322 | 404 | * touched. |
| 323 | 405 | * |
| 324 | | - * @param $policy string Either 'follow' or 'nofollow'. |
| | 406 | + * @param $policy String: either 'follow' or 'nofollow'. |
| 325 | 407 | * @return null |
| 326 | 408 | */ |
| 327 | 409 | public function setFollowPolicy( $policy ) { |
| — | — | @@ -330,7 +412,29 @@ |
| 331 | 413 | } |
| 332 | 414 | } |
| 333 | 415 | |
| | 416 | + |
| 334 | 417 | /** |
| | 418 | + * Set the new value of the "action text", this will be added to the |
| | 419 | + * "HTML title", separated from it with " - ". |
| | 420 | + * |
| | 421 | + * @param $text String: new value of the "action text" |
| | 422 | + */ |
| | 423 | + public function setPageTitleActionText( $text ) { |
| | 424 | + $this->mPageTitleActionText = $text; |
| | 425 | + } |
| | 426 | + |
| | 427 | + /** |
| | 428 | + * Get the value of the "action text" |
| | 429 | + * |
| | 430 | + * @return String |
| | 431 | + */ |
| | 432 | + public function getPageTitleActionText() { |
| | 433 | + if ( isset( $this->mPageTitleActionText ) ) { |
| | 434 | + return $this->mPageTitleActionText; |
| | 435 | + } |
| | 436 | + } |
| | 437 | + |
| | 438 | + /** |
| 335 | 439 | * "HTML title" means the contents of <title>. It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file. |
| 336 | 440 | */ |
| 337 | 441 | public function setHTMLTitle( $name ) { |
| — | — | @@ -338,6 +442,15 @@ |
| 339 | 443 | } |
| 340 | 444 | |
| 341 | 445 | /** |
| | 446 | + * Return the "HTML title", i.e. the content of the <title> tag. |
| | 447 | + * |
| | 448 | + * @return String |
| | 449 | + */ |
| | 450 | + public function getHTMLTitle() { |
| | 451 | + return $this->mHTMLtitle; |
| | 452 | + } |
| | 453 | + |
| | 454 | + /** |
| 342 | 455 | * "Page title" means the contents of <h1>. It is stored as a valid HTML fragment. |
| 343 | 456 | * This function allows good tags like <sup> in the <h1> tag, but not bad tags like <script>. |
| 344 | 457 | * This function automatically sets <title> to the same content as <h1> but with all tags removed. |
| — | — | @@ -358,33 +471,103 @@ |
| 359 | 472 | $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) ); |
| 360 | 473 | } |
| 361 | 474 | |
| | 475 | + /** |
| | 476 | + * Return the "page title", i.e. the content of the <h1> tag. |
| | 477 | + * |
| | 478 | + * @return String |
| | 479 | + */ |
| | 480 | + public function getPageTitle() { |
| | 481 | + return $this->mPagetitle; |
| | 482 | + } |
| | 483 | + |
| | 484 | + /** |
| | 485 | + * Set the Title object to use |
| | 486 | + * |
| | 487 | + * @param $t Title object |
| | 488 | + */ |
| 362 | 489 | public function setTitle( $t ) { |
| 363 | 490 | $this->mTitle = $t; |
| 364 | 491 | } |
| 365 | 492 | |
| | 493 | + /** |
| | 494 | + * Get the Title object used in this instance |
| | 495 | + * |
| | 496 | + * @return Title |
| | 497 | + */ |
| 366 | 498 | public function getTitle() { |
| 367 | 499 | if ( $this->mTitle instanceof Title ) { |
| 368 | 500 | return $this->mTitle; |
| 369 | | - } |
| 370 | | - else { |
| | 501 | + } else { |
| 371 | 502 | wfDebug( __METHOD__ . ' called and $mTitle is null. Return $wgTitle for sanity' ); |
| 372 | 503 | global $wgTitle; |
| 373 | 504 | return $wgTitle; |
| 374 | 505 | } |
| 375 | 506 | } |
| 376 | 507 | |
| 377 | | - public function getHTMLTitle() { return $this->mHTMLtitle; } |
| 378 | | - public function getPageTitle() { return $this->mPagetitle; } |
| 379 | | - public function setSubtitle( $str ) { $this->mSubtitle = /*$this->parse(*/$str/*)*/; } // @bug 2514 |
| 380 | | - public function appendSubtitle( $str ) { $this->mSubtitle .= /*$this->parse(*/$str/*)*/; } // @bug 2514 |
| 381 | | - public function getSubtitle() { return $this->mSubtitle; } |
| 382 | | - public function isArticle() { return $this->mIsarticle; } |
| 383 | | - public function setPrintable() { $this->mPrintable = true; } |
| 384 | | - public function isPrintable() { return $this->mPrintable; } |
| 385 | | - public function disable() { $this->mDoNothing = true; } |
| 386 | | - public function isDisabled() { return $this->mDoNothing; } |
| | 508 | + /** |
| | 509 | + * Replace the subtile with $str |
| | 510 | + * |
| | 511 | + * @param $str String: new value of the subtitle |
| | 512 | + */ |
| | 513 | + public function setSubtitle( $str ) { |
| | 514 | + $this->mSubtitle = /*$this->parse(*/ $str /*)*/; // @bug 2514 |
| | 515 | + } |
| 387 | 516 | |
| 388 | 517 | /** |
| | 518 | + * Add $str to the subtitle |
| | 519 | + * |
| | 520 | + * @param $str String to add to the subtitle |
| | 521 | + */ |
| | 522 | + public function appendSubtitle( $str ) { |
| | 523 | + $this->mSubtitle .= /*$this->parse(*/ $str /*)*/; // @bug 2514 |
| | 524 | + } |
| | 525 | + |
| | 526 | + /** |
| | 527 | + * Get the subtitle |
| | 528 | + * |
| | 529 | + * @return String |
| | 530 | + */ |
| | 531 | + public function getSubtitle() { |
| | 532 | + return $this->mSubtitle; |
| | 533 | + } |
| | 534 | + |
| | 535 | + |
| | 536 | + /** |
| | 537 | + * Set the page as printable, i.e. it'll be displayed with with all |
| | 538 | + * print styles included |
| | 539 | + */ |
| | 540 | + public function setPrintable() { |
| | 541 | + $this->mPrintable = true; |
| | 542 | + } |
| | 543 | + |
| | 544 | + /** |
| | 545 | + * Return whether the page is "printable" |
| | 546 | + * |
| | 547 | + * @return Boolean |
| | 548 | + */ |
| | 549 | + public function isPrintable() { |
| | 550 | + return $this->mPrintable; |
| | 551 | + } |
| | 552 | + |
| | 553 | + |
| | 554 | + /** |
| | 555 | + * Disable output completely, i.e. calling output() will have no effect |
| | 556 | + */ |
| | 557 | + public function disable() { |
| | 558 | + $this->mDoNothing = true; |
| | 559 | + } |
| | 560 | + |
| | 561 | + /** |
| | 562 | + * Return whether the output will be completely disabled |
| | 563 | + * |
| | 564 | + * @return Boolean |
| | 565 | + */ |
| | 566 | + public function isDisabled() { |
| | 567 | + return $this->mDoNothing; |
| | 568 | + } |
| | 569 | + |
| | 570 | + |
| | 571 | + /** |
| 389 | 572 | * Add or remove feed links in the page header |
| 390 | 573 | * This is mainly kept for backward compatibility, see OutputPage::addFeedLink() |
| 391 | 574 | * for the new version |
| — | — | @@ -437,43 +620,100 @@ |
| 438 | 621 | * Should we output feed links for this page? |
| 439 | 622 | * @return Boolean |
| 440 | 623 | */ |
| 441 | | - public function isSyndicated() { return count($this->mFeedLinks) > 0; } |
| | 624 | + public function isSyndicated() { |
| | 625 | + return count( $this->mFeedLinks ) > 0; |
| | 626 | + } |
| 442 | 627 | |
| 443 | | - public function getFeedAppendQuery() { return $this->mFeedLinksAppendQuery; } |
| | 628 | + /** |
| | 629 | + * Will currently always return null |
| | 630 | + * |
| | 631 | + * @return null |
| | 632 | + */ |
| | 633 | + public function getFeedAppendQuery() { |
| | 634 | + return $this->mFeedLinksAppendQuery; |
| | 635 | + } |
| 444 | 636 | |
| | 637 | + /** |
| | 638 | + * Set whether the displayed content is related to the source of the |
| | 639 | + * corresponding article on the wiki |
| | 640 | + * Setting true will cause the change "article related" toggle to true |
| | 641 | + * |
| | 642 | + * @param $v Boolean |
| | 643 | + */ |
| | 644 | + public function setArticleFlag( $v ) { |
| | 645 | + $this->mIsarticle = $v; |
| | 646 | + if ( $v ) { |
| | 647 | + $this->mIsArticleRelated = $v; |
| | 648 | + } |
| | 649 | + } |
| | 650 | + |
| | 651 | + /** |
| | 652 | + * Return whether the content displayed page is related to the source of |
| | 653 | + * the corresponding article on the wiki |
| | 654 | + * |
| | 655 | + * @return Boolean |
| | 656 | + */ |
| | 657 | + public function isArticle() { |
| | 658 | + return $this->mIsarticle; |
| | 659 | + } |
| | 660 | + |
| | 661 | + /** |
| | 662 | + * Set whether this page is related an article on the wiki |
| | 663 | + * Setting false will cause the change of "article flag" toggle to false |
| | 664 | + * |
| | 665 | + * @param $v Boolean |
| | 666 | + */ |
| 445 | 667 | public function setArticleRelated( $v ) { |
| 446 | 668 | $this->mIsArticleRelated = $v; |
| 447 | 669 | if ( !$v ) { |
| 448 | 670 | $this->mIsarticle = false; |
| 449 | 671 | } |
| 450 | 672 | } |
| 451 | | - public function setArticleFlag( $v ) { |
| 452 | | - $this->mIsarticle = $v; |
| 453 | | - if ( $v ) { |
| 454 | | - $this->mIsArticleRelated = $v; |
| 455 | | - } |
| | 673 | + |
| | 674 | + /** |
| | 675 | + * Return whether this page is related an article on the wiki |
| | 676 | + * |
| | 677 | + * @return Boolean |
| | 678 | + */ |
| | 679 | + public function isArticleRelated() { |
| | 680 | + return $this->mIsArticleRelated; |
| 456 | 681 | } |
| 457 | 682 | |
| 458 | | - public function isArticleRelated() { return $this->mIsArticleRelated; } |
| 459 | 683 | |
| 460 | | - public function getLanguageLinks() { return $this->mLanguageLinks; } |
| 461 | | - public function addLanguageLinks($newLinkArray) { |
| | 684 | + /** |
| | 685 | + * Add new language links |
| | 686 | + * |
| | 687 | + * @param $newLinkArray Associative array mapping language code to the page |
| | 688 | + * name |
| | 689 | + */ |
| | 690 | + public function addLanguageLinks( $newLinkArray ) { |
| 462 | 691 | $this->mLanguageLinks += $newLinkArray; |
| 463 | 692 | } |
| 464 | | - public function setLanguageLinks($newLinkArray) { |
| | 693 | + |
| | 694 | + /** |
| | 695 | + * Reset the language links and add new language links |
| | 696 | + * |
| | 697 | + * @param $newLinkArray Associative array mapping language code to the page |
| | 698 | + * name |
| | 699 | + */ |
| | 700 | + public function setLanguageLinks( $newLinkArray ) { |
| 465 | 701 | $this->mLanguageLinks = $newLinkArray; |
| 466 | 702 | } |
| 467 | 703 | |
| 468 | | - public function getCategoryLinks() { |
| 469 | | - return $this->mCategoryLinks; |
| | 704 | + /** |
| | 705 | + * Get the list of language links |
| | 706 | + * |
| | 707 | + * @return Associative array mapping language code to the page name |
| | 708 | + */ |
| | 709 | + public function getLanguageLinks() { |
| | 710 | + return $this->mLanguageLinks; |
| 470 | 711 | } |
| 471 | 712 | |
| 472 | | - public function getCategories() { |
| 473 | | - return $this->mCategories; |
| 474 | | - } |
| 475 | 713 | |
| 476 | 714 | /** |
| 477 | 715 | * Add an array of categories, with names in the keys |
| | 716 | + * |
| | 717 | + * @param $categories Associative array mapping category name to its sort key |
| 478 | 718 | */ |
| 479 | 719 | public function addCategoryLinks( $categories ) { |
| 480 | 720 | global $wgUser, $wgContLang; |
| — | — | @@ -527,11 +767,37 @@ |
| 528 | 768 | } |
| 529 | 769 | } |
| 530 | 770 | |
| 531 | | - public function setCategoryLinks($categories) { |
| | 771 | + /** |
| | 772 | + * Reset the category links (but not the category list) and add $categories |
| | 773 | + * |
| | 774 | + * @param $categories Associative array mapping category name to its sort key |
| | 775 | + */ |
| | 776 | + public function setCategoryLinks( $categories ) { |
| 532 | 777 | $this->mCategoryLinks = array(); |
| 533 | | - $this->addCategoryLinks($categories); |
| | 778 | + $this->addCategoryLinks( $categories ); |
| 534 | 779 | } |
| 535 | 780 | |
| | 781 | + /** |
| | 782 | + * Get the list of category links, in a 2-D array with the following format: |
| | 783 | + * $arr[$type][] = $link, where $type is either "normal" or "hidden" (for |
| | 784 | + * hidden categories) and $link a HTML fragment with a link to the category |
| | 785 | + * page |
| | 786 | + * |
| | 787 | + * @return Array |
| | 788 | + */ |
| | 789 | + public function getCategoryLinks() { |
| | 790 | + return $this->mCategoryLinks; |
| | 791 | + } |
| | 792 | + |
| | 793 | + /** |
| | 794 | + * Get the list of category names this page belongs to |
| | 795 | + * |
| | 796 | + * @return Array of strings |
| | 797 | + */ |
| | 798 | + public function getCategories() { |
| | 799 | + return $this->mCategories; |
| | 800 | + } |
| | 801 | + |
| 536 | 802 | public function suppressQuickbar() { $this->mSuppressQuickbar = true; } |
| 537 | 803 | public function isQuickbarSuppressed() { return $this->mSuppressQuickbar; } |
| 538 | 804 | |