* @param $methodName string
* @param $args array
*
+ * @return mixed
*/
static function callStaticMethod( $className, $methodName, $args ) {
$r = new ReflectionMethod( $className, $methodName );
*
* @param $class String: the contents of the class attribute; if an empty
* string is passed, which is the default value, defaults to 'external'.
+ * @return string
* @deprecated since 1.18 Just pass the external class directly to something using Html::expandAttributes
*/
static function getExternalLinkAttributes( $class = 'external' ) {
* @param $unused String: unused
* @param $class String: the contents of the class attribute; if an empty
* string is passed, which is the default value, defaults to 'external'.
+ * @return string
*/
static function getInterwikiLinkAttributes( $title, $unused = null, $class = 'external' ) {
global $wgContLang;
* not HTML-escaped
* @param $unused String: unused
* @param $class String: the contents of the class attribute, default none
+ * @return string
*/
static function getInternalLinkAttributes( $title, $unused = null, $class = '' ) {
$title = urldecode( $title );
* @param $class String: the contents of the class attribute, default none
* @param $title Mixed: optional (unescaped) string to use in the title
* attribute; if false, default to the name of the page we're linking to
+ * @return string
*/
static function getInternalLinkAttributesObj( $nt, $unused = null, $class = '', $title = false ) {
if ( $title === false ) {
/**
* Identical to link(), except $options defaults to 'known'.
+ * @return string
*/
public static function linkKnown(
$target, $html = null, $customAttribs = array(),
* @param $target Title
* @param $query Array: query parameters
* @param $options Array
+ * @return String
*/
private static function linkUrl( $target, $query, $options ) {
wfProfileIn( __METHOD__ );
* @param $params Array
* @param $framed Boolean
* @param $manualthumb String
+ * @return mixed
*/
public static function makeThumbLinkObj( Title $title, $file, $label = '', $alt,
$align = 'right', $params = array(), $framed = false , $manualthumb = "" )
* @param $escape Boolean: do we escape the link text?
* @param $linktype String: type of external link. Gets added to the classes
* @param $attribs Array of extra attributes to <a>
+ * @return string
*/
public static function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) {
$class = "external";
* @param $userId Integer: user identifier
* @param $userText String: user name or IP address
* @param $edits Integer: user edit count (optional, for performance)
+ * @return String
*/
public static function userToolLinksRedContribs( $userId, $userText, $edits = null ) {
return self::userToolLinks( $userId, $userText, true, 0, $edits );
* @param $comment String
* @param $title Mixed: Title object (to generate link to the section in autocomment) or null
* @param $local Boolean: whether section links should refer to local page
+ * @return mixed|String
*/
public static function formatComment( $comment, $title = null, $local = false ) {
wfProfileIn( __METHOD__ );
* End a Table Of Contents line.
* tocUnindent() will be used instead if we're ending a line below
* the new level.
+ * @return string
*/
public static function tocLineEnd() {
return "</li>\n";
/**
* Split a link trail, return the "inside" portion and the remainder of the trail
* as a two-element array
+ * @return array
*/
static function splitTrail( $trail ) {
global $wgContLang;
* other users.
*
* @param $rev Revision object
+ * @return string
*/
public static function generateRollback( $rev ) {
return '<span class="mw-rollback-link">['
* @param $trail String: Optional trail. Alphabetic characters at the start of this string will
* be included in the link text. Other characters will be appended after
* the end of the link.
+ * @return string
*/
static function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) {
wfDeprecated( __METHOD__, '1.16' );
* be included in the link text. Other characters will be appended after
* the end of the link.
* @param $prefix String: optional prefix. As trail, only before instead of after.
+ * @return string
*/
static function makeLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
# wfDeprecated( __METHOD__, '1.16' ); // See r105985 and it's revert. Somewhere still used.
* be included in the link text. Other characters will be appended after
* the end of the link.
* @param $prefix String: Optional prefix
+ * @return string
*/
static function makeBrokenLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' ) {
wfDeprecated( __METHOD__, '1.16' );
* be included in the link text. Other characters will be appended after
* the end of the link.
* @param $prefix String: Optional prefix
+ * @return string
*/
static function makeColouredLinkObj( $nt, $colour, $text = '', $query = '', $trail = '', $prefix = '' ) {
wfDeprecated( __METHOD__, '1.16' );
/**
* Returns the attributes for the tooltip and access key.
+ * @return array
*/
public static function tooltipAndAccesskeyAttribs( $name ) {
# @todo FIXME: If Sanitizer::expandAttributes() treated "false" as "output
/**
* Returns raw bits of HTML, use titleAttrib()
+ * @return null|string
*/
public static function tooltip( $name, $options = null ) {
# @todo FIXME: If Sanitizer::expandAttributes() treated "false" as "output
*
* @param $fname String Name of called method
* @param $args Array Arguments to the method
+ * @return mixed
*/
public function __call( $fname, $args ) {
return call_user_func_array( array( 'Linker', $fname ), $args );
/**
* Returns true if the cache identified by $code is missing or expired.
+ * @return bool
*/
public function isExpired( $code ) {
if ( $this->forceRecache && !isset( $this->recachedLangs[$code] ) ) {
*
* @param string $file
* @param mixed $ext
+ * @return bool|string
*/
private function doGuessMimeType( $file, $ext ) { // TODO: remove $ext param
// Read a chunk of the file
*
* This funktion relies on the mapping defined by $this->mMediaTypes
* @access private
+ * @return int|string
*/
function findMediaType( $extMime ) {
if ( strpos( $extMime, '.' ) === 0 ) {
* @param $fileName String: the file name (unused at present)
* @param $chunk String: the first 256 bytes of the file
* @param $proposed String: the MIME type proposed by the server
+ * @return Array
*/
public function getIEMimeTypes( $fileName, $chunk, $proposed ) {
$ca = $this->getIEContentAnalyzer();
/**
* @see self::isSubject
* @deprecated Please use the more consistently named isSubject (since 1.19)
+ * @return bool
*/
public static function isMain( $index ) {
wfDeprecated( __METHOD__, '1.19' );
/**
* JS stuff to put at the bottom of the <body>
+ * @return string
*/
function getBottomScripts() {
global $wgResourceLoaderExperimentalAsyncLoading;
/**
* Do something with the error, like showing it to the user.
+ * @return bool
*/
function error( $status ) {
return false;
* $this->parent can be assumed to be a WebInstaller.
* If the DB type has no settings beyond those already configured with
* getConnectForm(), this should return false.
+ * @return bool
*/
public function getSettingsForm() {
return false;
/**
* Override this to provide DBMS-specific schema variables, to be
* substituted into tables.sql and other schema files.
+ * @return array
*/
public function getSchemaVars() {
return array();
/**
* Get an array of MW configuration globals that will be configured by this class.
+ * @return array
*/
public function getGlobalNames() {
return $this->globalNames;
/**
* Get the internationalised name for this DBMS.
+ * @return String
*/
public function getReadableName() {
return wfMsg( 'config-type-' . $this->getName() );
/**
* Get a name=>value map of MW configuration globals that overrides.
* DefaultSettings.php
+ * @return array
*/
public function getGlobalDefaults() {
return array();
/**
* Get a name=>value map of internal variables used during installation.
+ * @return array
*/
public function getInternalDefaults() {
return $this->internalDefaults;
* values: List of allowed values (required)
* itemAttribs Array of attribute arrays, outer key is the value name (optional)
*
+ * @return string
*/
public function getRadioSet( $params ) {
$params['controlName'] = $this->getName() . '_' . $params['var'];
* Assumes that variables containing "password" in the name are (potentially
* fake) passwords.
* @param $varNames Array
+ * @return array
*/
public function setVarsFromRequest( $varNames ) {
return $this->parent->setVarsFromRequest( $varNames, $this->getName() . '_' );
/**
* Submit a standard install user fieldset.
+ * @return Status
*/
public function submitInstallUserBox() {
$this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword' ) );
/**
* Some versions of libxml+PHP break < and > encoding horribly
+ * @return bool
*/
protected function envCheckBrokenXML() {
$test = new PhpXmlBugTester();
/**
* Test PHP (probably 5.3.1, but it could regress again) to make sure that
* reference parameters to __call() are not converted to null
+ * @return bool
*/
protected function envCheckPHP531() {
$test = new PhpRefCallBugTester;
/**
* Environment check for magic_quotes_runtime.
+ * @return bool
*/
protected function envCheckMagicQuotes() {
if( wfIniGetBool( "magic_quotes_runtime" ) ) {
/**
* Environment check for magic_quotes_sybase.
+ * @return bool
*/
protected function envCheckMagicSybase() {
if ( wfIniGetBool( 'magic_quotes_sybase' ) ) {
/**
* Environment check for mbstring.func_overload.
+ * @return bool
*/
protected function envCheckMbstring() {
if ( wfIniGetBool( 'mbstring.func_overload' ) ) {
/**
* Environment check for zend.ze1_compatibility_mode.
+ * @return bool
*/
protected function envCheckZE1() {
if ( wfIniGetBool( 'zend.ze1_compatibility_mode' ) ) {
/**
* Environment check for the XML module.
+ * @return bool
*/
protected function envCheckXML() {
if ( !function_exists( "utf8_encode" ) ) {
/**
* Environment check for the PCRE module.
+ * @return bool
*/
protected function envCheckPCRE() {
if ( !function_exists( 'preg_match' ) ) {
/**
* Environment check for available memory.
+ * @return bool
*/
protected function envCheckMemory() {
$limit = ini_get( 'memory_limit' );
/**
* Environment check for ImageMagick and GD.
+ * @return bool
*/
protected function envCheckGraphics() {
$names = array( wfIsWindows() ? 'convert.exe' : 'convert' );
/**
* TODO: document
+ * @return bool
*/
protected function envCheckUploadsDirectory() {
global $IP;
*
* If $versionInfo is not false, only executables with a version
* matching $versionInfo[1] will be returned.
+ * @return bool|string
*/
public static function locateExecutable( $path, $names, $versionInfo = false ) {
if ( !is_array( $names ) ) {
* Checks if scripts located in the given directory can be executed via the given URL.
*
* Used only by environment checks.
+ * @return bool|int|string
*/
public function dirIsExecutable( $dir, $url ) {
$scriptTypes = array(
/**
* Overload: after this action field info table has to be rebuilt
+ * @return Status
*/
public function createTables() {
$this->setupSchemaVars();
/**
* Returns true if the install user is able to create objects owned
* by the web user, false otherwise.
+ * @return bool
*/
protected function canCreateObjectsForWebUser() {
if ( $this->isSuperUser() ) {
/**
* @todo FIXME: Postgres should use sequential updates like Mysql, Sqlite
* and everybody else. It never got refactored like it should've.
+ * @return array
*/
protected function getCoreUpdateList() {
return array(
*
* @param $name String
* @param $default
+ * @return null
*/
public function getSession( $name, $default = null ) {
if ( !isset( $this->session[$name] ) ) {
* Is this a slow-running page in the installer? If so, WebInstaller will
* set_time_limit(0) before calling execute(). Right now this only applies
* to Install and Upgrade pages
+ * @return bool
*/
public function isSlow() {
return false;
/**
* @todo Ultimately, this should just call PEAR::isError()
+ * @return bool
*/
function isError($data, $code = null)
{
/**
* Whether the parameters for this log are stored in new or
* old format.
+ * @return bool
*/
public function isLegacy() {
return false;
* Provides the name of the user who performed the log action.
* Used as part of log action message or standalone, depending
* which parts of the log entry has been hidden.
+ * @return String
*/
public function getPerformerElement() {
if ( $this->canView( LogPage::DELETED_USER ) ) {
* Set the log reader to return only entries by the given user.
*
* @param $name String: (In)valid user name
+ * @return bool
*/
private function limitPerformer( $name ) {
if( $name == '' ) {
*
* @param $page String or Title object: Title name
* @param $pattern String
+ * @return bool
*/
private function limitTitle( $page, $pattern ) {
global $wgMiserMode;
/**
* Escape a string for ImageMagick's property input (e.g. -set -comment)
* See InterpretImageProperties() in magick/property.c
+ * @return mixed|string
*/
function escapeMagickProperty( $s ) {
// Double the backslashes
*
* @param $path string The file path
* @param $scene string The scene specification, or false if there is none
+ * @return string
*/
function escapeMagickInput( $path, $scene = false ) {
# Die on initial metacharacters (caller should prepend path)
/**
* Escape a string for ImageMagick's output filename. See
* InterpretImageFilename() in magick/image.c.
+ * @return string
*/
function escapeMagickOutput( $path, $scene = false ) {
$path = str_replace( '%', '%%', $path );
*
* @param $path string The file path
* @param $scene string The scene specification, or false if there is none
+ * @return string
*/
protected function escapeMagickPath( $path, $scene = false ) {
# Die on format specifiers (other than drive letters). The regex is
* Cache a document tree for the DjVu XML metadata
* @param $image File
* @param $gettext Boolean: DOCUMENT (Default: false)
+ * @return bool
*/
function getMetaTree( $image , $gettext = false ) {
if ( isset( $image->dejaMetaTree ) ) {
/**
* Hack to temporarily work around djvutoxml bug
+ * @return bool|string
*/
function convertDumpToXML( $dump ) {
if ( strval( $dump ) == '' ) {
*/
/**
* Get $this->mRawExifData
+ * @return array
*/
function getData() {
return $this->mRawExifData;
* MediaHandler::METADATA_GOOD for if the metadata is a-ok,
* MediaHanlder::METADATA_COMPATIBLE if metadata is old but backwards
* compatible (which may or may not trigger a metadata reload).
+ * @return bool
*/
function isMetadataValid( $image, $metadata ) {
return self::METADATA_GOOD;
* Used when the repository has a thumbnailScriptUrl option configured.
*
* Return false to fall back to the regular getTransform().
+ * @return bool
*/
function getScriptedTransform( $image, $script, $params ) {
return false;
* @param $dstPath String: filesystem destination path
* @param $dstUrl String: Destination URL to use in output HTML
* @param $params Array: Arbitrary set of parameters validated by $this->validateParam()
+ * @return \MediaTransformOutput
*/
final function getTransform( $image, $dstPath, $dstUrl, $params ) {
return $this->doTransform( $image, $dstPath, $dstUrl, $params, self::TRANSFORM_LATER );
/**
* True if the handled types can be transformed
+ * @return bool
*/
function canRender( $file ) { return true; }
/**
* True if handled types cannot be displayed directly in a browser
* but can be rendered
+ * @return bool
*/
function mustRender( $file ) { return false; }
/**
* True if the type has multi-page capabilities
+ * @return bool
*/
function isMultiPage( $file ) { return false; }
/**
* Page count for a multi-page document, false if unsupported or unknown
+ * @return bool
*/
function pageCount( $file ) { return false; }
/**
* The material is vectorized and thus scaling is lossless
+ * @return bool
*/
function isVectorized( $file ) { return false; }
/**
* False if the handler is disabled for all files
+ * @return bool
*/
function isEnabled() { return true; }
* Returns false if unknown or if the document is not multi-page.
*
* @param $image File
+ * @return array
*/
function getPageDimensions( $image, $page ) {
$gis = $this->getImageSize( $image, $image->getLocalRefPath() );
/**
* Generic getter for text layer.
* Currently overloaded by PDF and DjVu handlers
+ * @return bool
*/
function getPageText( $image, $page ) {
return false;
* all the formatting according to some standard. That makes it possible
* to do things like visual indication of grouped and chained streams
* in ogg container files.
+ * @return bool
*/
function formatMetadata( $image ) {
return false;
/**
* This will be overridden to return true in error classes
+ * @return bool
*/
public function isError() {
return false;
/**
* Read the SVG
+ * @return bool
*/
public function read() {
$keepReading = $this->reader->read();
* Returns true if the string is _definitely_ in NFC.
* Returns false if not or uncertain.
* @param $string String: a UTF-8 string, altered on output to be valid UTF-8 safe for XML.
+ * @return bool
*/
static function quickIsNFCVerify( &$string ) {
# Screen out some characters that eg won't be allowed in XML
} else {
/**
* @ignore
+ * @return string
*/
function pretty( $string ) {
return trim( preg_replace( '/(.)/use',
* following functions to force pure PHP usage. I decided not to
* commit that code since might produce a slowdown in the UTF
* normalization code just for the sake of these tests. -- hexmode
+ * @return string
*/
function normalize_form_c_php($c) { return UtfNormal::toNFC($c, "php"); }
function normalize_form_d_php($c) { return UtfNormal::toNFD($c, "php"); }
/**
* Convert an optionally relative time to an absolute time
+ * @return int
*/
protected function convertExpiry( $exptime ) {
if ( ( $exptime != 0 ) && ( $exptime < 86400 * 3650 /* 10 years */ ) ) {
* @param $sock Resource: socket to read from
* @param $ret Array: returned values
*
+ * @return bool|int
* @access private
*/
function _load_items( $sock, &$ret ) {
/**
* Original behaviour
+ * @return int
*/
function _safe_fwrite( $f, $buf, $len = false ) {
if ( $len === false ) {
* the other control characters for compatibility with libmemcached
* verify_key. We leave other punctuation alone, to maximise backwards
* compatibility.
+ * @return string
*/
public function encodeKey( $key ) {
return preg_replace_callback( '/[\x00-\x20\x25\x7f]+/',
* Delete objects expiring before a certain date.
*
* Succeed if any of the child caches succeed.
+ * @return bool
*/
public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) {
$ret = false;
/**
* Get the table name for a given key
+ * @return string
*/
protected function getTableByKey( $key ) {
if ( $this->shards > 1 ) {
/**
* Get the table name for a given shard index
+ * @return string
*/
protected function getTableByShard( $index ) {
if ( $this->shards > 1 ) {
/**
* Delete objects from the database which expire before a certain date.
+ * @return bool
*/
public function deleteObjectsExpiringBefore( $timestamp, $progressCallback = false ) {
$db = $this->getDB();
* @param $parser Parser object
* @param $s String: The text to encode.
* @param $arg String (optional): The type of encoding.
+ * @return string
*/
static function urlencode( $parser, $s = '', $arg = null ) {
static $magicWords = null;
* corresponding magic word
* Note: function name changed to "mwnamespace" rather than "namespace"
* to not break PHP 5.3
+ * @return mixed|string
*/
static function mwnamespace( $parser, $title = null ) {
$t = Title::newFromText( $title );
/**
* Functions to get and normalize pagenames, corresponding to the magic words
* of the same names
+ * @return String
*/
static function pagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
* Return the number of pages in the given category, or 0 if it's nonexis-
* tent. This is an expensive parser function and can't be called too many
* times per page.
+ * @return string
*/
static function pagesincategory( $parser, $name = '', $raw = null ) {
static $cache = array();
* @param $parser Parser
* @param $page String TODO DOCUMENT (Default: empty string)
* @param $raw TODO DOCUMENT (Default: null)
+ * @return string
*/
static function pagesize( $parser, $page = '', $raw = null ) {
static $cache = array();
/**
* Returns the requested protection level for the current page
- */
+ * @return string
+ */
static function protectionlevel( $parser, $type = '' ) {
$restrictions = $parser->mTitle->getRestrictions( strtolower( $type ) );
# Title::getRestrictions returns an array, its possible it may have
/**
* Unicode-safe str_pad with the restriction that $length is forced to be <= 500
+ * @return string
*/
static function pad( $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) {
$lengthOfPadding = mb_strlen( $padding );
/**
* Parser function to extension tag adaptor
+ * @return string
*/
public static function tagObj( $parser, $frame, $args ) {
if ( !count( $args ) ) {
* @param $preference String: User preference
* @param $text String: Text to reformat
* @param $options Array: can contain 'linked' and/or 'match-whole'
+ * @return mixed|String
*/
function reformat( $preference, $text, $options = array('linked') ) {
/**
* @param $matches
+ * @return string
*/
function replace( $matches ) {
# Extract information from $matches
/**
* @todo document
+ * @return string
*/
function getMonthRegex() {
global $wgContLang;
/**
* @todo document
+ * @return int|string
*/
function makeNormalYear( $iso ) {
if ( $iso[0] == '-' ) {
* serializing at present.
*
* Compact the titles, only serialize the text form.
- */
+ * @return array
+ */
function __sleep() {
foreach ( $this->internals as &$nsLinks ) {
foreach ( $nsLinks as &$entry ) {
/**
* Get a subset of the current LinkHolderArray which is sufficient to
* interpret the given text.
+ * @return \LinkHolderArray
*/
function getSubArray( $text ) {
$sub = new LinkHolderArray( $this->parent );
/**
* Returns true if the memory requirements of this object are getting large
+ * @return bool
*/
function isBig() {
global $wgLinkHolderBatchSize;
* article length checks (for stub links) to be bundled into a single query.
*
* @param $nt Title
+ * @return string
*/
function makeHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
wfProfileIn( __METHOD__ );
/**
* Expand templates and variables in the text, producing valid, static wikitext.
* Also removes comments.
+ * @return mixed|string
*/
function preprocess( $text, Title $title, ParserOptions $options, $revid = null ) {
wfProfileIn( __METHOD__ );
* parse the wiki syntax used to render tables
*
* @private
+ * @return string
*/
function doTableStuff( $text ) {
wfProfileIn( __METHOD__ );
* @param $text String
* @param $origText String: original, untouched wikitext
* @param $isMain Boolean
+ * @return mixed|string
* @private
*/
function formatHeadings( $text, $origText, $isMain=true ) {
* Create a tag function, e.g. <test>some stuff</test>.
* Unlike tag hooks, tag functions are parsed at preprocessor level.
* Unlike parser functions, their content is not preprocessed.
+ * @return null
*/
function setFunctionTagHook( $tag, $callback, $flags ) {
$tag = strtolower( $tag );
*
* @param $article Article
* @param $popts ParserOptions
+ * @return string
*/
function getETag( $article, $popts ) {
return 'W/"' . $this->getParserOutputKey( $article,
*
* @param $article Article
* @param $popts ParserOptions
+ * @return bool|mixed|string
*/
public function getKey( $article, $popts, $useOutdated = true ) {
global $wgCacheEpoch;
* Returns the full array of options that would have been used by
* in 1.16.
* Used to get the old parser cache entries when available.
+ * @return array
*/
public static function legacyOptions() {
global $wgUseDynamicDates;
* The value returned by getCacheExpiry is smaller or equal to the smallest number
* that was provided to a call of updateCacheExpiry(), and smaller or equal to the
* value of $wgParserCacheExpireTime.
+ * @return int|mixed|null
*/
function getCacheExpiry() {
global $wgParserCacheExpireTime;
/**
* callback used by getText to replace editsection tokens
* @private
+ * @return mixed
*/
function replaceEditSectionLinksCallback( $m ) {
global $wgOut, $wgLang;
/**
* Virtual implode with brackets
+ * @return array
*/
function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
$args = array_slice( func_get_args(), 3 );
/**
* Split a <h> node
+ * @return array
*/
function splitHeading() {
if ( $this->getName() !== 'h' ) {
/**
* Returns a tree of function call instead of a list of functions
+ * @return string
*/
function getCallTree() {
return implode( '', array_map( array( &$this, 'getCallTreeLine' ), $this->remapCallTree( $this->mStack ) ) );
* Recursive function the format the current profiling array into a tree
*
* @param $stack array profiling array
+ * @return array
*/
function remapCallTree( $stack ) {
if( count( $stack ) < 2 ){
/**
* Callback to get a formatted line for the call tree
+ * @return string
*/
function getCallTreeLine( $entry ) {
list( $fname, $level, $start, /* $x */, $end) = $entry;
/**
* Get the function name of the current profiling section
+ * @return
*/
function getCurrentSection() {
$elt = end( $this->mWorkStack );