From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/ConfEditor.php | 78 ++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 37 deletions(-) (limited to 'includes/ConfEditor.php') diff --git a/includes/ConfEditor.php b/includes/ConfEditor.php index b08b77df..42a7173d 100644 --- a/includes/ConfEditor.php +++ b/includes/ConfEditor.php @@ -1,6 +1,6 @@ 'delete', 'path' => '$foo/bar/baz' ) * is equivalent to the runtime PHP code: * unset( $foo['bar']['baz'] ); * * set - * Sets the value of an array element. If the element doesn't exist, it - * is appended to the array. If it does exist, the value is set, with + * Sets the value of an array element. If the element doesn't exist, it + * is appended to the array. If it does exist, the value is set, with * comments and indenting preserved. * * append * Appends a new element to the end of the array. Adds a trailing comma. * e.g. - * array( 'type' => 'append', 'path', '$foo/bar', + * array( 'type' => 'append', 'path', '$foo/bar', * 'key' => 'baz', 'value' => "'x'" ) * is like the PHP code: * $foo['bar']['baz'] = 'x'; @@ -187,7 +191,7 @@ class ConfEditor { list( $indent, ) = $this->getIndent( $start ); $textToInsert = "$indent$value,"; } else { - list( $indent, $arrowIndent ) = + list( $indent, $arrowIndent ) = $this->getIndent( $start, $key, $lastEltInfo['arrowByte'] ); $textToInsert = "$indent$key$arrowIndent=> $value,"; } @@ -210,7 +214,7 @@ class ConfEditor { list( $indent, ) = $this->getIndent( $start ); $textToInsert = "$indent$value,"; } else { - list( $indent, $arrowIndent ) = + list( $indent, $arrowIndent ) = $this->getIndent( $start, $key, $info['arrowByte'] ); $textToInsert = "$indent$key$arrowIndent=> $value,"; } @@ -239,13 +243,13 @@ class ConfEditor { try { $this->parse(); } catch ( ConfEditorParseError $e ) { - throw new MWException( + throw new MWException( "Sorry, ConfEditor broke the file during editing and it won't parse anymore: " . $e->getMessage() ); } return $out; } - + /** * Get the variables defined in the text * @return array( varname => value ) @@ -266,7 +270,7 @@ class ConfEditor { strlen( $trimmedPath ) - strlen( $name ) ); if( substr( $parentPath, -1 ) == '/' ) $parentPath = substr( $parentPath, 0, -1 ); - + $value = substr( $this->text, $data['valueStartByte'], $data['valueEndByte'] - $data['valueStartByte'] ); @@ -275,7 +279,7 @@ class ConfEditor { } return $vars; } - + /** * Set a value in an array, unless it's set already. For instance, * setVar( $arr, 'foo/bar', 'baz', 3 ); will set @@ -298,7 +302,7 @@ class ConfEditor { if ( !isset( $target[$key] ) ) $target[$key] = $value; } - + /** * Parse a scalar value in PHP * @return mixed Parsed value @@ -306,14 +310,14 @@ class ConfEditor { function parseScalar( $str ) { if ( $str !== '' && $str[0] == '\'' ) // Single-quoted string - // @todo Fixme: trim() call is due to mystery bug where whitespace gets + // @todo FIXME: trim() call is due to mystery bug where whitespace gets // appended to the token; without it we ended up reading in the // extra quote on the end! return strtr( substr( trim( $str ), 1, -1 ), array( '\\\'' => '\'', '\\\\' => '\\' ) ); - if ( $str !== '' && @$str[0] == '"' ) + if ( $str !== '' && $str[0] == '"' ) // Double-quoted string - // @todo Fixme: trim() call is due to mystery bug where whitespace gets + // @todo FIXME: trim() call is due to mystery bug where whitespace gets // appended to the token; without it we ended up reading in the // extra quote on the end! return stripcslashes( substr( trim( $str ), 1, -1 ) ); @@ -364,8 +368,8 @@ class ConfEditor { } /** - * Finds the source byte region which you would want to delete, if $pathName - * was to be deleted. Includes the leading spaces and tabs, the trailing line + * Finds the source byte region which you would want to delete, if $pathName + * was to be deleted. Includes the leading spaces and tabs, the trailing line * break, and any comments in between. */ function findDeletionRegion( $pathName ) { @@ -419,9 +423,9 @@ class ConfEditor { } /** - * Find the byte region in the source corresponding to the value part. - * This includes the quotes, but does not include the trailing comma - * or semicolon. + * Find the byte region in the source corresponding to the value part. + * This includes the quotes, but does not include the trailing comma + * or semicolon. * * The end position is the past-the-end (end + 1) value as per convention. */ @@ -472,7 +476,7 @@ class ConfEditor { return $extraPath; } - /* + /** * Find the path name of first element in the array. * If the array is empty, this will return the \@extra interstitial element. * If the specified path is not found or is not an array, it will return false. @@ -519,7 +523,7 @@ class ConfEditor { } /** - * Run the parser on the text. Throws an exception if the string does not + * Run the parser on the text. Throws an exception if the string does not * match our defined subset of PHP syntax. */ public function parse() { @@ -706,7 +710,7 @@ class ConfEditor { } /** - * Set the parse position. Do not call this except from firstToken() and + * Set the parse position. Do not call this except from firstToken() and * nextToken(), there is more to update than just the position. */ protected function setPos( $pos ) { @@ -800,7 +804,7 @@ class ConfEditor { if ( $this->currentToken && $this->currentToken->type == $type ) { return $this->nextToken(); } else { - $this->error( "expected " . $this->getTypeName( $type ) . + $this->error( "expected " . $this->getTypeName( $type ) . ", got " . $this->getTypeName( $this->currentToken->type ) ); } } @@ -875,7 +879,7 @@ class ConfEditor { } /** - * Go to the next path on the same level. This ends the current path and + * Go to the next path on the same level. This ends the current path and * starts a new one. If $path is \@next, the new path is set to the next * numeric array element. */ @@ -889,7 +893,7 @@ class ConfEditor { } else { $this->pathStack[$i]['name'] = $path; } - $this->pathStack[$i] = + $this->pathStack[$i] = array( 'startByte' => $this->byteNum, 'startToken' => $this->pos, @@ -955,8 +959,8 @@ class ConfEditor { } /** - * Looks ahead to see if the given type is the next token type, starting - * from the current position plus the given offset. Skips any intervening + * Looks ahead to see if the given type is the next token type, starting + * from the current position plus the given offset. Skips any intervening * whitespace. */ function isAhead( $type, $offset = 0 ) { @@ -992,8 +996,8 @@ class ConfEditor { $out = ''; foreach ( $this->tokens as $token ) { $obj = $this->newTokenObj( $token ); - $out .= sprintf( "%-28s %s\n", - $this->getTypeName( $obj->type ), + $out .= sprintf( "%-28s %s\n", + $this->getTypeName( $obj->type ), addcslashes( $obj->text, "\0..\37" ) ); } echo "
" . htmlspecialchars( $out ) . "
"; @@ -1008,7 +1012,7 @@ class ConfEditorParseError extends MWException { function __construct( $editor, $msg ) { $this->lineNum = $editor->lineNum; $this->colNum = $editor->colNum; - parent::__construct( "Parse error on line {$editor->lineNum} " . + parent::__construct( "Parse error on line {$editor->lineNum} " . "col {$editor->colNum}: $msg" ); } @@ -1028,7 +1032,7 @@ class ConfEditorParseError extends MWException { */ class ConfEditorToken { var $type, $text; - + static $scalarTypes = array( T_LNUMBER, T_DNUMBER, T_STRING, T_CONSTANT_ENCAPSED_STRING ); static $skipTypes = array( T_WHITESPACE, T_COMMENT, T_DOC_COMMENT ); -- cgit v1.2.3-54-g00ecf