r61690 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61689‎ | r61690 | r61691 >
Date:21:32, 29 January 2010
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Step two in fixing OutputPage's documentation, more or less the same as r61647
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -568,6 +568,25 @@
569569
570570
571571 /**
 572+ * Show an "add new section" link?
 573+ *
 574+ * @return Boolean
 575+ */
 576+ public function showNewSectionLink() {
 577+ return $this->mNewSectionLink;
 578+ }
 579+
 580+ /**
 581+ * Forcibly hide the new section link?
 582+ *
 583+ * @return Boolean
 584+ */
 585+ public function forceHideNewSectionLink() {
 586+ return $this->mHideNewSectionLink;
 587+ }
 588+
 589+
 590+ /**
572591 * Add or remove feed links in the page header
573592 * This is mainly kept for backward compatibility, see OutputPage::addFeedLink()
574593 * for the new version
@@ -625,6 +644,14 @@
626645 }
627646
628647 /**
 648+ * Return URLs for each supported syndication format for this page.
 649+ * @return array associating format keys with URLs
 650+ */
 651+ public function getSyndicationLinks() {
 652+ return $this->mFeedLinks;
 653+ }
 654+
 655+ /**
629656 * Will currently always return null
630657 *
631658 * @return null
@@ -798,24 +825,102 @@
799826 return $this->mCategories;
800827 }
801828
802 - public function suppressQuickbar() { $this->mSuppressQuickbar = true; }
803 - public function isQuickbarSuppressed() { return $this->mSuppressQuickbar; }
804829
805 - public function disallowUserJs() { $this->mAllowUserJs = false; }
806 - public function isUserJsAllowed() { return $this->mAllowUserJs; }
 830+ /**
 831+ * Suppress the quickbar from the output, only for skin supporting
 832+ * the quickbar
 833+ */
 834+ public function suppressQuickbar() {
 835+ $this->mSuppressQuickbar = true;
 836+ }
807837
808 - public function prependHTML( $text ) { $this->mBodytext = $text . $this->mBodytext; }
809 - public function addHTML( $text ) { $this->mBodytext .= $text; }
810 - public function clearHTML() { $this->mBodytext = ''; }
811 - public function getHTML() { return $this->mBodytext; }
812 - public function debug( $text ) { $this->mDebugtext .= $text; }
 838+ /**
 839+ * Return whether the quickbar should be suppressed from the output
 840+ *
 841+ * @return Boolean
 842+ */
 843+ public function isQuickbarSuppressed() {
 844+ return $this->mSuppressQuickbar;
 845+ }
813846
814 - /* @deprecated */
 847+
 848+ /**
 849+ * Remove user JavaScript from scripts to load
 850+ */
 851+ public function disallowUserJs() {
 852+ $this->mAllowUserJs = false;
 853+ }
 854+
 855+ /**
 856+ * Return whether user JavaScript is allowed for this page
 857+ *
 858+ * @return Boolean
 859+ */
 860+ public function isUserJsAllowed() {
 861+ return $this->mAllowUserJs;
 862+ }
 863+
 864+
 865+ /**
 866+ * Prepend $text to the body HTML
 867+ *
 868+ * @param $text String: HTML
 869+ */
 870+ public function prependHTML( $text ) {
 871+ $this->mBodytext = $text . $this->mBodytext;
 872+ }
 873+
 874+ /**
 875+ * Append $text to the body HTML
 876+ *
 877+ * @param $text String: HTML
 878+ */
 879+ public function addHTML( $text ) {
 880+ $this->mBodytext .= $text;
 881+ }
 882+
 883+ /**
 884+ * Clear the body HTML
 885+ */
 886+ public function clearHTML() {
 887+ $this->mBodytext = '';
 888+ }
 889+
 890+ /**
 891+ * Get the body HTML
 892+ *
 893+ * @return String: HTML
 894+ */
 895+ public function getHTML() {
 896+ return $this->mBodytext;
 897+ }
 898+
 899+
 900+ /**
 901+ * Add $text to the debug output
 902+ *
 903+ * @param $text String: debug text
 904+ */
 905+ public function debug( $text ) {
 906+ $this->mDebugtext .= $text;
 907+ }
 908+
 909+
 910+ /**
 911+ * @deprecated use parserOptions() instead
 912+ */
815913 public function setParserOptions( $options ) {
816914 wfDeprecated( __METHOD__ );
817915 return $this->parserOptions( $options );
818916 }
819917
 918+ /**
 919+ * Get/set the ParserOptions object to use for wikitext parsing
 920+ *
 921+ * @param $options either the ParserOption to use or null to only get the
 922+ * current ParserOption object
 923+ * @return current ParserOption object
 924+ */
820925 public function parserOptions( $options = null ) {
821926 if ( !$this->mParserOptions ) {
822927 $this->mParserOptions = new ParserOptions;
@@ -826,40 +931,78 @@
827932 /**
828933 * Set the revision ID which will be seen by the wiki text parser
829934 * for things such as embedded {{REVISIONID}} variable use.
830 - * @param mixed $revid an integer, or NULL
831 - * @return mixed previous value
 935+ *
 936+ * @param $revid Mixed: an positive integer, or null
 937+ * @return Mixed: previous value
832938 */
833939 public function setRevisionId( $revid ) {
834940 $val = is_null( $revid ) ? null : intval( $revid );
835941 return wfSetVar( $this->mRevisionId, $val );
836942 }
837943
 944+ /**
 945+ * Get the current revision ID
 946+ *
 947+ * @return Integer
 948+ */
838949 public function getRevisionId() {
839950 return $this->mRevisionId;
840951 }
841952
842953 /**
843954 * Convert wikitext to HTML and add it to the buffer
844 - * Default assumes that the current page title will
845 - * be used.
 955+ * Default assumes that the current page title will be used.
846956 *
847 - * @param string $text
848 - * @param bool $linestart
 957+ * @param $text String
 958+ * @param $linestart Boolean: is this the start of a line?
849959 */
850960 public function addWikiText( $text, $linestart = true ) {
851961 $title = $this->getTitle(); // Work arround E_STRICT
852962 $this->addWikiTextTitle( $text, $title, $linestart );
853963 }
854964
855 - public function addWikiTextWithTitle($text, &$title, $linestart = true) {
856 - $this->addWikiTextTitle($text, $title, $linestart);
 965+ /**
 966+ * Add wikitext with a custom Title object
 967+ *
 968+ * @param $text String: wikitext
 969+ * @param $title Title object
 970+ * @param $linestart Boolean: is this the start of a line?
 971+ */
 972+ public function addWikiTextWithTitle( $text, &$title, $linestart = true ) {
 973+ $this->addWikiTextTitle( $text, $title, $linestart );
857974 }
858975
859 - function addWikiTextTitleTidy($text, &$title, $linestart = true) {
 976+ /**
 977+ * Add wikitext with a custom Title object and
 978+ *
 979+ * @param $text String: wikitext
 980+ * @param $title Title object
 981+ * @param $linestart Boolean: is this the start of a line?
 982+ */
 983+ function addWikiTextTitleTidy( $text, &$title, $linestart = true ) {
860984 $this->addWikiTextTitle( $text, $title, $linestart, true );
861985 }
862986
863 - public function addWikiTextTitle($text, &$title, $linestart, $tidy = false) {
 987+ /**
 988+ * Add wikitext with tidy enabled
 989+ *
 990+ * @param $text String: wikitext
 991+ * @param $linestart Boolean: is this the start of a line?
 992+ */
 993+ public function addWikiTextTidy( $text, $linestart = true ) {
 994+ $title = $this->getTitle();
 995+ $this->addWikiTextTitleTidy($text, $title, $linestart);
 996+ }
 997+
 998+ /**
 999+ * Add wikitext with a custom Title object
 1000+ *
 1001+ * @param $text String: wikitext
 1002+ * @param $title Title object
 1003+ * @param $linestart Boolean: is this the start of a line?
 1004+ * @param $tidy Boolean: whether to use tidy
 1005+ */
 1006+ public function addWikiTextTitle( $text, &$title, $linestart, $tidy = false ) {
8641007 global $wgParser;
8651008
8661009 wfProfileIn( __METHOD__ );
@@ -880,9 +1023,46 @@
8811024 }
8821025
8831026 /**
884 - * @todo document
885 - * @param ParserOutput object &$parserOutput
 1027+ * Add wikitext to the buffer, assuming that this is the primary text for a page view
 1028+ * Saves the text into the parser cache if possible.
 1029+ *
 1030+ * @param $text String: wikitext
 1031+ * @param $article Article object
 1032+ * @param $cache Boolean
 1033+ * @deprecated Use Article::outputWikitext
8861034 */
 1035+ public function addPrimaryWikiText( $text, $article, $cache = true ) {
 1036+ global $wgParser;
 1037+
 1038+ wfDeprecated( __METHOD__ );
 1039+
 1040+ $popts = $this->parserOptions();
 1041+ $popts->setTidy(true);
 1042+ $parserOutput = $wgParser->parse( $text, $article->mTitle,
 1043+ $popts, true, true, $this->mRevisionId );
 1044+ $popts->setTidy(false);
 1045+ if ( $cache && $article && $parserOutput->getCacheTime() != -1 ) {
 1046+ $parserCache = ParserCache::singleton();
 1047+ $parserCache->save( $parserOutput, $article, $popts);
 1048+ }
 1049+
 1050+ $this->addParserOutput( $parserOutput );
 1051+ }
 1052+
 1053+ /**
 1054+ * @deprecated use addWikiTextTidy()
 1055+ */
 1056+ public function addSecondaryWikiText( $text, $linestart = true ) {
 1057+ wfDeprecated( __METHOD__ );
 1058+ $this->addWikiTextTitleTidy($text, $this->getTitle(), $linestart);
 1059+ }
 1060+
 1061+
 1062+ /**
 1063+ * Add a ParserOutput object, but without Html
 1064+ *
 1065+ * @param $parserOutput ParserOutput object
 1066+ */
8871067 public function addParserOutputNoText( &$parserOutput ) {
8881068 global $wgExemptFromUserRobotsControl, $wgContentNamespaces;
8891069
@@ -924,8 +1104,9 @@
9251105 }
9261106
9271107 /**
928 - * @todo document
929 - * @param ParserOutput &$parserOutput
 1108+ * Add a ParserOutput object
 1109+ *
 1110+ * @param $parserOutput ParserOutput
9301111 */
9311112 function addParserOutput( &$parserOutput ) {
9321113 $this->addParserOutputNoText( $parserOutput );
@@ -934,54 +1115,11 @@
9351116 $this->addHTML( $text );
9361117 }
9371118
938 - /**
939 - * Add wikitext to the buffer, assuming that this is the primary text for a page view
940 - * Saves the text into the parser cache if possible.
941 - *
942 - * @param string $text
943 - * @param Article $article
944 - * @param bool $cache
945 - * @deprecated Use Article::outputWikitext
946 - */
947 - public function addPrimaryWikiText( $text, $article, $cache = true ) {
948 - global $wgParser;
9491119
950 - wfDeprecated( __METHOD__ );
951 -
952 - $popts = $this->parserOptions();
953 - $popts->setTidy(true);
954 - $parserOutput = $wgParser->parse( $text, $article->mTitle,
955 - $popts, true, true, $this->mRevisionId );
956 - $popts->setTidy(false);
957 - if ( $cache && $article && $parserOutput->getCacheTime() != -1 ) {
958 - $parserCache = ParserCache::singleton();
959 - $parserCache->save( $parserOutput, $article, $popts);
960 - }
961 -
962 - $this->addParserOutput( $parserOutput );
963 - }
964 -
9651120 /**
966 - * @deprecated use addWikiTextTidy()
967 - */
968 - public function addSecondaryWikiText( $text, $linestart = true ) {
969 - wfDeprecated( __METHOD__ );
970 - $this->addWikiTextTitleTidy($text, $this->getTitle(), $linestart);
971 - }
972 -
973 - /**
974 - * Add wikitext with tidy enabled
975 - */
976 - public function addWikiTextTidy( $text, $linestart = true ) {
977 - $title = $this->getTitle();
978 - $this->addWikiTextTitleTidy($text, $title, $linestart);
979 - }
980 -
981 -
982 - /**
9831121 * Add the output of a QuickTemplate to the output buffer
9841122 *
985 - * @param QuickTemplate $template
 1123+ * @param $template QuickTemplate
9861124 */
9871125 public function addTemplate( &$template ) {
9881126 ob_start();
@@ -993,9 +1131,10 @@
9941132 /**
9951133 * Parse wikitext and return the HTML.
9961134 *
997 - * @param string $text
998 - * @param bool $linestart Is this the start of a line?
999 - * @param bool $interface ??
 1135+ * @param $text String
 1136+ * @param $linestart Boolean: is this the start of a line?
 1137+ * @param $interface Boolean: ??
 1138+ * @return String: HTML
10001139 */
10011140 public function parse( $text, $linestart = true, $interface = false ) {
10021141 global $wgParser;
@@ -1010,7 +1149,14 @@
10111150 return $parserOutput->getText();
10121151 }
10131152
1014 - /** Parse wikitext, strip paragraphs, and return the HTML. */
 1153+ /**
 1154+ * Parse wikitext, strip paragraphs, and return the HTML.
 1155+ *
 1156+ * @param $text String
 1157+ * @param $linestart Boolean: is this the start of a line?
 1158+ * @param $interface Boolean: ??
 1159+ * @return String: HTML
 1160+ */
10151161 public function parseInline( $text, $linestart = true, $interface = false ) {
10161162 $parsed = $this->parse( $text, $linestart, $interface );
10171163
@@ -1023,12 +1169,10 @@
10241170 }
10251171
10261172 /**
1027 - * @param Article $article
1028 - * @param User $user
1029 - *
10301173 * @deprecated
10311174 *
1032 - * @return bool True if successful, else false.
 1175+ * @param $article Article
 1176+ * @return Boolean: true if successful, else false.
10331177 */
10341178 public function tryParserCache( &$article ) {
10351179 wfDeprecated( __METHOD__ );
@@ -1043,7 +1187,9 @@
10441188 }
10451189
10461190 /**
1047 - * @param int $maxage Maximum cache time on the Squid, in seconds.
 1191+ * Set the value of the "s-maxage" part of the "Cache-control" HTTP header
 1192+ *
 1193+ * @param $maxage Integer: maximum cache time on the Squid, in seconds.
10481194 */
10491195 public function setSquidMaxage( $maxage ) {
10501196 $this->mSquidMaxage = $maxage;
@@ -1051,12 +1197,18 @@
10521198
10531199 /**
10541200 * Use enableClientCache(false) to force it to send nocache headers
 1201+ *
10551202 * @param $state ??
10561203 */
10571204 public function enableClientCache( $state ) {
10581205 return wfSetVar( $this->mEnableClientCache, $state );
10591206 }
10601207
 1208+ /**
 1209+ * Get the list of cookies that will influence on the cache
 1210+ *
 1211+ * @return Array
 1212+ */
10611213 function getCacheVaryCookies() {
10621214 global $wgCookiePrefix, $wgCacheVaryCookies;
10631215 static $cookies;
@@ -1074,15 +1226,23 @@
10751227 return $cookies;
10761228 }
10771229
 1230+ /**
 1231+ * Return whether this page is not cacheable because "useskin" or "uselang"
 1232+ * url parameters were passed
 1233+ *
 1234+ * @return Boolean
 1235+ */
10781236 function uncacheableBecauseRequestVars() {
10791237 global $wgRequest;
1080 - return $wgRequest->getText('useskin', false) === false
 1238+ return $wgRequest->getText('useskin', false) === false
10811239 && $wgRequest->getText('uselang', false) === false;
10821240 }
10831241
10841242 /**
10851243 * Check if the request has a cache-varying cookie header
10861244 * If it does, it's very important that we don't allow public caching
 1245+ *
 1246+ * @return Boolean
10871247 */
10881248 function haveCacheVaryCookies() {
10891249 global $wgRequest;
@@ -1102,6 +1262,12 @@
11031263 return false;
11041264 }
11051265
 1266+ /**
 1267+ * Add an HTTP header that will influence on the cache
 1268+ *
 1269+ * @param $header String: header name
 1270+ * @param $option either an Array or null
 1271+ */
11061272 public function addVaryHeader( $header, $option = null ) {
11071273 if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
11081274 $this->mVaryHeader[$header] = $option;
@@ -1117,7 +1283,11 @@
11181284 $this->mVaryHeader[$header] = array_unique( $this->mVaryHeader[$header] );
11191285 }
11201286
1121 - /** Get a complete X-Vary-Options header */
 1287+ /**
 1288+ * Get a complete X-Vary-Options header
 1289+ *
 1290+ * @return String
 1291+ */
11221292 public function getXVO() {
11231293 $cvCookies = $this->getCacheVaryCookies();
11241294
@@ -1139,14 +1309,16 @@
11401310 return $xvo;
11411311 }
11421312
1143 - /** bug 21672: Add Accept-Language to Vary and XVO headers
1144 - if there's no 'variant' parameter existed in GET.
1145 -
1146 - For example:
1147 - /w/index.php?title=Main_page should always be served; but
1148 - /w/index.php?title=Main_page&variant=zh-cn should never be served.
1149 -
1150 - patched by Liangent and Philip */
 1313+ /**
 1314+ * bug 21672: Add Accept-Language to Vary and XVO headers
 1315+ *if there's no 'variant' parameter existed in GET.
 1316+ *
 1317+ * For example:
 1318+ * /w/index.php?title=Main_page should always be served; but
 1319+ * /w/index.php?title=Main_page&variant=zh-cn should never be served.
 1320+ *
 1321+ * patched by Liangent and Philip
 1322+ */
11511323 function addAcceptLanguage() {
11521324 global $wgRequest, $wgContLang;
11531325 if( !$wgRequest->getCheck('variant') && $wgContLang->hasVariants() ) {
@@ -1162,6 +1334,9 @@
11631335 }
11641336 }
11651337
 1338+ /**
 1339+ * Send cache control HTTP headers
 1340+ */
11661341 public function sendCacheControl() {
11671342 global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgRequest, $wgUseXVO;
11681343
@@ -1394,7 +1569,8 @@
13951570 /**
13961571 * Actually output something with print(). Performs an iconv to the
13971572 * output encoding, if needed.
1398 - * @param string $ins The string to output
 1573+ *
 1574+ * @param $ins String: the string to output
13991575 */
14001576 public function out( $ins ) {
14011577 global $wgInputEncoding, $wgOutputEncoding, $wgContLang;
@@ -1424,9 +1600,9 @@
14251601 }
14261602
14271603 /**
1428 - * Deprecated, use wfReportTime() instead.
1429 - * @return string
1430 - * @deprecated
 1604+ * @deprecated use wfReportTime() instead.
 1605+ *
 1606+ * @return String
14311607 */
14321608 public function reportTime() {
14331609 wfDeprecated( __METHOD__ );
@@ -1437,7 +1613,7 @@
14381614 /**
14391615 * Produce a "user is blocked" page.
14401616 *
1441 - * @param bool $return Whether to have a "return to $wgTitle" message or not.
 1617+ * @param $return Boolean: whether to have a "return to $wgTitle" message or not.
14421618 * @return nothing
14431619 */
14441620 function blockedPage( $return = true ) {
@@ -1499,9 +1675,9 @@
15001676 /**
15011677 * Output a standard error page
15021678 *
1503 - * @param string $title Message key for page title
1504 - * @param string $msg Message key for page text
1505 - * @param array $params Message parameters
 1679+ * @param $title String: message key for page title
 1680+ * @param $msg String: message key for page text
 1681+ * @param $params Array: message parameters
15061682 */
15071683 public function showErrorPage( $title, $msg, $params = array() ) {
15081684 if ( $this->getTitle() ) {
@@ -1525,10 +1701,10 @@
15261702 /**
15271703 * Output a standard permission error page
15281704 *
1529 - * @param array $errors Error message keys
 1705+ * @param $errors Array: error message keys
 1706+ * @param $action String: action that was denied or null if unknown
15301707 */
1531 - public function showPermissionsErrorPage( $errors, $action = null )
1532 - {
 1708+ public function showPermissionsErrorPage( $errors, $action = null ) {
15331709 $this->mDebugtext .= 'Original title: ' .
15341710 $this->getTitle()->getPrefixedText() . "\n";
15351711 $this->setPageTitle( wfMsg( 'permissionserrors' ) );
@@ -1541,17 +1717,11 @@
15421718 $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
15431719 }
15441720
1545 - /** @deprecated */
1546 - public function errorpage( $title, $msg ) {
1547 - wfDeprecated( __METHOD__ );
1548 - throw new ErrorPageError( $title, $msg );
1549 - }
1550 -
15511721 /**
15521722 * Display an error page indicating that a given version of MediaWiki is
15531723 * required to use it
15541724 *
1555 - * @param mixed $version The version of MediaWiki needed to use the page
 1725+ * @param $version Mixed: the version of MediaWiki needed to use the page
15561726 */
15571727 public function versionRequired( $version ) {
15581728 $this->setPageTitle( wfMsg( 'versionrequired', $version ) );
@@ -1567,7 +1737,7 @@
15681738 /**
15691739 * Display an error page noting that a given permission bit is required.
15701740 *
1571 - * @param string $permission key required
 1741+ * @param $permission String: key required
15721742 */
15731743 public function permissionRequired( $permission ) {
15741744 global $wgLang;
@@ -1591,16 +1761,14 @@
15921762 }
15931763
15941764 /**
1595 - * Use permissionRequired.
1596 - * @deprecated
 1765+ * @deprecated use permissionRequired()
15971766 */
15981767 public function sysopRequired() {
15991768 throw new MWException( "Call to deprecated OutputPage::sysopRequired() method\n" );
16001769 }
16011770
16021771 /**
1603 - * Use permissionRequired.
1604 - * @deprecated
 1772+ * @deprecated use permissionRequired()
16051773 */
16061774 public function developerRequired() {
16071775 throw new MWException( "Call to deprecated OutputPage::developerRequired() method\n" );
@@ -1642,14 +1810,12 @@
16431811 $this->returnToMain( null, $mainPage );
16441812 }
16451813
1646 - /** @deprecated */
1647 - public function databaseError( $fname, $sql, $error, $errno ) {
1648 - throw new MWException( "OutputPage::databaseError is obsolete\n" );
1649 - }
1650 -
16511814 /**
1652 - * @param array $errors An array of arrays returned by Title::getUserPermissionsErrors
1653 - * @return string The wikitext error-messages, formatted into a list.
 1815+ * Format a list of error messages
 1816+ *
 1817+ * @param $errors An array of arrays returned by Title::getUserPermissionsErrors
 1818+ * @param $action String: action that was denied or null if unknown
 1819+ * @return String: the wikitext error-messages, formatted into a list.
16541820 */
16551821 public function formatPermissionsErrorMessage( $errors, $action = null ) {
16561822 if ($action == null) {
@@ -1692,9 +1858,10 @@
16931859 *
16941860 * @todo Needs to be split into multiple functions.
16951861 *
1696 - * @param string $source Source code to show (or null).
1697 - * @param bool $protected Is this a permissions error?
1698 - * @param array $reasons List of reasons for this error, as returned by Title::getUserPermissionsErrors().
 1862+ * @param $source String: source code to show (or null).
 1863+ * @param $protected Boolean: is this a permissions error?
 1864+ * @param $reasons Array: list of reasons for this error, as returned by Title::getUserPermissionsErrors().
 1865+ * @param $action String: action that was denied or null if unknown
16991866 */
17001867 public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
17011868 global $wgUser;
@@ -1767,6 +1934,17 @@
17681935 }
17691936
17701937 /** @deprecated */
 1938+ public function errorpage( $title, $msg ) {
 1939+ wfDeprecated( __METHOD__ );
 1940+ throw new ErrorPageError( $title, $msg );
 1941+ }
 1942+
 1943+ /** @deprecated */
 1944+ public function databaseError( $fname, $sql, $error, $errno ) {
 1945+ throw new MWException( "OutputPage::databaseError is obsolete\n" );
 1946+ }
 1947+
 1948+ /** @deprecated */
17711949 public function fatalError( $message ) {
17721950 wfDeprecated( __METHOD__ );
17731951 throw new FatalError( $message );
@@ -1881,9 +2059,9 @@
18822060 }
18832061
18842062 /**
1885 - * @return string The doctype, opening <html>, and head element.
1886 - *
18872063 * @param $sk Skin The given Skin
 2064+ * @param $includeStyle Unused (?)
 2065+ * @return String: The doctype, opening <html>, and head element.
18882066 */
18892067 public function headElement( Skin $sk, $includeStyle = true ) {
18902068 global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
@@ -1986,11 +2164,13 @@
19872165 return $ret;
19882166 }
19892167
1990 - /*
1991 - * gets the global variables and mScripts
 2168+ /**
 2169+ * Gets the global variables and mScripts; also adds userjs to the end if
 2170+ * enabled
19922171 *
1993 - * also adds userjs to the end if enabled:
1994 - */
 2172+ * @param $sk Skin object to use
 2173+ * @return String: HTML fragment
 2174+ */
19952175 function getHeadScripts( Skin $sk ) {
19962176 global $wgUser, $wgRequest, $wgJsMimeType, $wgUseSiteJs;
19972177 global $wgStylePath, $wgStyleVersion;
@@ -2031,6 +2211,9 @@
20322212 return $scripts;
20332213 }
20342214
 2215+ /**
 2216+ * Add default \<meta\> tags
 2217+ */
20352218 protected function addDefaultMeta() {
20362219 global $wgVersion, $wgHtml5;
20372220
@@ -2135,16 +2318,13 @@
21362319 }
21372320
21382321 /**
2139 - * Return URLs for each supported syndication format for this page.
2140 - * @return array associating format keys with URLs
 2322+ * Generate a <link rel/> for a feed.
 2323+ *
 2324+ * @param $type String: feed type
 2325+ * @param $url String: URL to the feed
 2326+ * @param $text String: value of the "title" attribute
 2327+ * @return String: HTML fragment
21412328 */
2142 - public function getSyndicationLinks() {
2143 - return $this->mFeedLinks;
2144 - }
2145 -
2146 - /**
2147 - * Generate a <link rel/> for an RSS feed.
2148 - */
21492329 private function feedLink( $type, $url, $text ) {
21502330 return Html::element( 'link', array(
21512331 'rel' => 'alternate',
@@ -2157,9 +2337,10 @@
21582338 * Add a local or specified stylesheet, with the given media options.
21592339 * Meant primarily for internal use...
21602340 *
2161 - * @param $media -- to specify a media type, 'screen', 'printable', 'handheld' or any.
2162 - * @param $conditional -- for IE conditional comments, specifying an IE version
2163 - * @param $dir -- set to 'rtl' or 'ltr' for direction-specific sheets
 2341+ * @param $style String: URL to the file
 2342+ * @param $media String: to specify a media type, 'screen', 'printable', 'handheld' or any.
 2343+ * @param $condition String: for IE conditional comments, specifying an IE version
 2344+ * @param $dir String: set to 'rtl' or 'ltr' for direction-specific sheets
21642345 */
21652346 public function addStyle( $style, $media='', $condition='', $dir='' ) {
21662347 $options = array();
@@ -2197,6 +2378,14 @@
21982379 return implode( "\n", $links );
21992380 }
22002381
 2382+ /**
 2383+ * Generate \<link\> tags for stylesheets
 2384+ *
 2385+ * @param $style String: URL to the file
 2386+ * @param $options Array: option, can contain 'condition', 'dir', 'media'
 2387+ * keys
 2388+ * @return String: HTML fragment
 2389+ */
22012390 protected function styleLink( $style, $options ) {
22022391 global $wgRequest;
22032392
@@ -2234,6 +2423,12 @@
22352424 return $link;
22362425 }
22372426
 2427+ /**
 2428+ * Transform "media" attribute based on request parameters
 2429+ *
 2430+ * @param $media String: current value of the "media" attribute
 2431+ * @return String: modified value of the "media" attribute
 2432+ */
22382433 function transformCssMedia( $media ) {
22392434 global $wgRequest, $wgHandheldForIPhone;
22402435
@@ -2272,7 +2467,6 @@
22732468 * for when rate limiting has triggered.
22742469 */
22752470 public function rateLimited() {
2276 -
22772471 $this->setPageTitle(wfMsg('actionthrottled'));
22782472 $this->setRobotPolicy( 'noindex,follow' );
22792473 $this->setArticleRelated( false );
@@ -2286,31 +2480,13 @@
22872481 }
22882482
22892483 /**
2290 - * Show an "add new section" link?
2291 - *
2292 - * @return bool
2293 - */
2294 - public function showNewSectionLink() {
2295 - return $this->mNewSectionLink;
2296 - }
2297 -
2298 - /**
2299 - * Forcibly hide the new section link?
2300 - *
2301 - * @return bool
2302 - */
2303 - public function forceHideNewSectionLink() {
2304 - return $this->mHideNewSectionLink;
2305 - }
2306 -
2307 - /**
23082484 * Show a warning about slave lag
23092485 *
23102486 * If the lag is higher than $wgSlaveLagCritical seconds,
23112487 * then the warning is a bit more obvious. If the lag is
23122488 * lower than $wgSlaveLagWarning, then no warning is shown.
23132489 *
2314 - * @param int $lag Slave lag
 2490+ * @param $lag Integer: slave lag
23152491 */
23162492 public function showLagWarning( $lag ) {
23172493 global $wgSlaveLagWarning, $wgSlaveLagCritical, $wgLang;
@@ -2368,7 +2544,7 @@
23692545 *
23702546 * Is equivalent to:
23712547 *
2372 - * $wgOut->addWikiText( "<div class='error'>\n" . wfMsgNoTrans( 'some-error' ) . '</div>' );
 2548+ * $wgOut->addWikiText( "<div class='error'>\n" . wfMsgNoTrans( 'some-error' ) . "</div>" );
23732549 *
23742550 * The newline after opening div is needed in some wikitext. See bug 19226.
23752551 */
@@ -2399,9 +2575,8 @@
24002576 * Include jQuery core. Use this to avoid loading it multiple times
24012577 * before we get a usable script loader.
24022578 *
2403 - * @param array $modules List of jQuery modules which should be loaded
2404 - *
2405 - * Returns the list of modules which were not loaded.
 2579+ * @param $modules Array: list of jQuery modules which should be loaded
 2580+ * @return Array: the list of modules which were not loaded.
24062581 */
24072582 public function includeJQuery( $modules = array() ) {
24082583 global $wgScriptPath, $wgStyleVersion, $wgJsMimeType;

Follow-up revisions

RevisionCommit summaryAuthorDate
r61722Per Nikerabbit, follow-up to r61690: document $interface parameterialex17:40, 30 January 2010
r98374New OutputPage::addJsConfigVars() method (bug 31233)...krinkle22:08, 28 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61647Step one in fixing OutputPage's documentation:...ialex21:58, 28 January 2010

Comments

#Comment by Nikerabbit (talk | contribs)   09:14, 30 January 2010

Gosh this class is huge. But anyway: + * @param $interface Boolean: ?? Use interface language (wgLang instead of wgContLang) while parsing language sensitive magic words like GRAMMAR and PLURAL

Status & tagging log