*
* @param $rc Mixed: change identifier or RecentChange object
* @param $auto Boolean: was this patrol event automatic?
+ *
+ * @return bool
*/
public static function record( $rc, $auto = false ) {
if( !( $rc instanceof RecentChange ) ) {
/**
* Constructor from a page id
* @param $id Int article ID to load
+ *
+ * @return WikiCategoryPage
*/
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
* Don't return a 404 for categories in use.
* In use defined as: either the actual page exists
* or the category currently has members.
+ *
+ * @return bool
*/
public function hasViewableContent() {
if ( parent::hasViewableContent() ) {
# split up and insert constructed headlines
$blocks = preg_split( '/<H[1-6].*?' . '>.*?<\/H[1-6]>/i', $text );
$i = 0;
-
+
// build an array of document sections
$sections = array();
- foreach ( $blocks as $block ) {
+ foreach ( $blocks as $block ) {
// $head is zero-based, sections aren't.
if ( empty( $head[$i - 1] ) ) {
$sections[$i] = $block;
* $showEditLinks : boolean describing whether this section has an edit link
*/
wfRunHooks( 'ParserSectionCreate', array( $this, $i, &$sections[$i], $showEditLink ) );
-
+
$i++;
}
// Top anchor now in skin
$sections[0] = $sections[0] . $toc . "\n";
}
-
+
$full .= join( '', $sections );
-
+
if ( $this->mForceTocPosition ) {
return str_replace( '<!--MWTOC-->', $toc, $full );
} else {
*
* Transparent tag hooks are like regular XML-style tag hooks, except they
* operate late in the transformation sequence, on HTML instead of wikitext.
+ *
+ * @param $text string
+ *
+ * @return string
*/
function replaceTransparentTags( $text ) {
$matches = array();
* Try to guess the section anchor name based on a wikitext fragment
* presumably extracted from a heading, for example "Header" from
* "== Header ==".
+ *
+ * @param $text string
+ *
+ * @return string
*/
public function guessSectionNameFromWikiText( $text ) {
# Strip out wikitext links(they break the anchor)
/**
* Get an instance of this object
+ *
+ * @return ParserCache
*/
public static function singleton() {
static $instance;
if ( $found === 'angle' ) {
$matches = false;
// Handle </onlyinclude>
- if ( $enableOnlyinclude
- && substr( $text, $i, strlen( '</onlyinclude>' ) ) === '</onlyinclude>' )
+ if ( $enableOnlyinclude
+ && substr( $text, $i, strlen( '</onlyinclude>' ) ) === '</onlyinclude>' )
{
$findOnlyinclude = true;
continue;
}
$tagStartPos = $i;
- $inner = $close = '';
+ $close = '';
if ( $text[$tagEndPos-1] === '/' ) {
// Short end tag
$attrEnd = $tagEndPos - 1;
static $skin = null, $infinity = null;
if( is_null( $skin ) ){
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
$infinity = wfGetDB( DB_SLAVE )->getInfinity();
}
* user is allowed, pass on permissions checking to the parent.
*
* @param $user User
+ *
+ * @return bool
*/
public static function isAllowed( $user ) {
- if ( !$user->isAllowed( 'upload_by_url' ) )
+ if ( !$user->isAllowed( 'upload_by_url' ) ) {
return 'upload_by_url';
+ }
return parent::isAllowed( $user );
}
<?php
-/*
+/*
* Unit tests for wfExpandUrl()
*/
/**
* Provider of URL examples for testing wfExpandUrl()
+ *
+ * @return array
*/
public function provideExpandableUrls() {
global $wgServer;
17 => 4,
18 => 4 ) ) );
foreach ( $vals as $row ) {
- extract( $row );
+ $tests = $row['tests'];
+ $height = $row['height'];
+ $width = $row['width'];
foreach ( $tests as $max => $expected ) {
$y = round( $expected * $height / $width );
$result = wfFitBoxWidth( $width, $height, $max );