summaryrefslogtreecommitdiff
path: root/includes/libs
diff options
context:
space:
mode:
Diffstat (limited to 'includes/libs')
-rw-r--r--includes/libs/CSSJanus.php15
-rw-r--r--includes/libs/CSSMin.php14
-rw-r--r--includes/libs/GenericArrayObject.php15
-rw-r--r--includes/libs/IEContentAnalyzer.php13
-rw-r--r--includes/libs/IEUrlExtension.php12
-rw-r--r--includes/libs/JavaScriptMinifier.php20
-rw-r--r--includes/libs/jsminplus.php6
7 files changed, 46 insertions, 49 deletions
diff --git a/includes/libs/CSSJanus.php b/includes/libs/CSSJanus.php
index 4ebbc497..fb1e9a4c 100644
--- a/includes/libs/CSSJanus.php
+++ b/includes/libs/CSSJanus.php
@@ -57,6 +57,7 @@ class CSSJanus {
'lookahead_not_open_brace' => null,
'lookahead_not_closing_paren' => null,
'lookahead_for_closing_paren' => null,
+ 'lookahead_not_letter' => '(?![a-zA-Z])',
'lookbehind_not_letter' => '(?<![a-zA-Z])',
'chars_within_selector' => '[^\}]*?',
'noflip_annotation' => '\/\*\s*@noflip\s*\*\/',
@@ -104,8 +105,8 @@ class CSSJanus {
$patterns['noflip_class'] = "/({$patterns['noflip_annotation']}{$patterns['chars_within_selector']}})/i";
$patterns['direction_ltr'] = "/({$patterns['direction']})ltr/i";
$patterns['direction_rtl'] = "/({$patterns['direction']})rtl/i";
- $patterns['left'] = "/{$patterns['lookbehind_not_letter']}(left){$patterns['lookahead_not_closing_paren']}{$patterns['lookahead_not_open_brace']}/i";
- $patterns['right'] = "/{$patterns['lookbehind_not_letter']}(right){$patterns['lookahead_not_closing_paren']}{$patterns['lookahead_not_open_brace']}/i";
+ $patterns['left'] = "/{$patterns['lookbehind_not_letter']}(left){$patterns['lookahead_not_letter']}{$patterns['lookahead_not_closing_paren']}{$patterns['lookahead_not_open_brace']}/i";
+ $patterns['right'] = "/{$patterns['lookbehind_not_letter']}(right){$patterns['lookahead_not_letter']}{$patterns['lookahead_not_closing_paren']}{$patterns['lookahead_not_open_brace']}/i";
$patterns['left_in_url'] = "/{$patterns['lookbehind_not_letter']}(left){$patterns['lookahead_for_closing_paren']}/i";
$patterns['right_in_url'] = "/{$patterns['lookbehind_not_letter']}(right){$patterns['lookahead_for_closing_paren']}/i";
$patterns['ltr_in_url'] = "/{$patterns['lookbehind_not_letter']}(ltr){$patterns['lookahead_for_closing_paren']}/i";
@@ -122,7 +123,7 @@ class CSSJanus {
/**
* Transform an LTR stylesheet to RTL
- * @param $css String: stylesheet to transform
+ * @param string $css stylesheet to transform
* @param $swapLtrRtlInURL Boolean: If true, swap 'ltr' and 'rtl' in URLs
* @param $swapLeftRightInURL Boolean: If true, swap 'left' and 'right' in URLs
* @return string Transformed stylesheet
@@ -304,8 +305,8 @@ class CSSJanus_Tokenizer {
/**
* Constructor
- * @param $regex string Regular expression whose matches to replace by a token.
- * @param $token string Token
+ * @param string $regex Regular expression whose matches to replace by a token.
+ * @param string $token Token
*/
public function __construct( $regex, $token ) {
$this->regex = $regex;
@@ -316,7 +317,7 @@ class CSSJanus_Tokenizer {
/**
* Replace all occurrences of $regex in $str with a token and remember
* the original strings.
- * @param $str String to tokenize
+ * @param string $str to tokenize
* @return string Tokenized string
*/
public function tokenize( $str ) {
@@ -335,7 +336,7 @@ class CSSJanus_Tokenizer {
/**
* Replace tokens with their originals. If multiple strings were tokenized, it's important they be
* detokenized in exactly the SAME ORDER.
- * @param $str String: previously run through tokenize()
+ * @param string $str previously run through tokenize()
* @return string Original string
*/
public function detokenize( $str ) {
diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php
index fc75cdcc..8b0e2873 100644
--- a/includes/libs/CSSMin.php
+++ b/includes/libs/CSSMin.php
@@ -59,8 +59,8 @@ class CSSMin {
/**
* Gets a list of local file paths which are referenced in a CSS style sheet
*
- * @param $source string CSS data to remap
- * @param $path string File path where the source was read from (optional)
+ * @param string $source CSS data to remap
+ * @param string $path File path where the source was read from (optional)
* @return array List of local file references
*/
public static function getLocalFileReferences( $source, $path = null ) {
@@ -115,10 +115,10 @@ class CSSMin {
* Remaps CSS URL paths and automatically embeds data URIs for URL rules
* preceded by an /* @embed * / comment
*
- * @param $source string CSS data to remap
- * @param $local string File path where the source was read from
- * @param $remote string URL path to the file
- * @param $embedData bool If false, never do any data URI embedding, even if / * @embed * / is found
+ * @param string $source CSS data to remap
+ * @param string $local File path where the source was read from
+ * @param string $remote URL path to the file
+ * @param bool $embedData If false, never do any data URI embedding, even if / * @embed * / is found
* @return string Remapped CSS data
*/
public static function remap( $source, $local, $remote, $embedData = true ) {
@@ -219,7 +219,7 @@ class CSSMin {
/**
* Removes whitespace from CSS data
*
- * @param $css string CSS data to minify
+ * @param string $css CSS data to minify
* @return string Minified CSS data
*/
public static function minify( $css ) {
diff --git a/includes/libs/GenericArrayObject.php b/includes/libs/GenericArrayObject.php
index b4b9d610..d77d8ad6 100644
--- a/includes/libs/GenericArrayObject.php
+++ b/includes/libs/GenericArrayObject.php
@@ -28,9 +28,8 @@
* @since 1.20
*
* @file
- * @ingroup Diff
*
- * @licence GNU GPL v2+
+ * @license GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
abstract class GenericArrayObject extends ArrayObject {
@@ -42,7 +41,7 @@ abstract class GenericArrayObject extends ArrayObject {
*
* @return string
*/
- public abstract function getObjectType();
+ abstract public function getObjectType();
/**
* @see SiteList::getNewOffset()
@@ -61,13 +60,11 @@ abstract class GenericArrayObject extends ArrayObject {
* @return integer
*/
protected function getNewOffset() {
- while ( true ) {
- if ( !$this->offsetExists( $this->indexOffset ) ) {
- return $this->indexOffset;
- }
-
+ while ( $this->offsetExists( $this->indexOffset ) ) {
$this->indexOffset++;
}
+
+ return $this->indexOffset;
}
/**
@@ -194,7 +191,7 @@ abstract class GenericArrayObject extends ArrayObject {
/**
* Returns an array holding all the data that should go into serialization calls.
* This is intended to allow overloading without having to reimplement the
- * behaviour of this base class.
+ * behavior of this base class.
*
* @since 1.20
*
diff --git a/includes/libs/IEContentAnalyzer.php b/includes/libs/IEContentAnalyzer.php
index cfc7f536..7f461a03 100644
--- a/includes/libs/IEContentAnalyzer.php
+++ b/includes/libs/IEContentAnalyzer.php
@@ -329,9 +329,9 @@ class IEContentAnalyzer {
* Get the MIME types from getMimesFromData(), but convert the result from IE's
* idiosyncratic private types into something other apps will understand.
*
- * @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
+ * @param string $fileName the file name (unused at present)
+ * @param string $chunk the first 256 bytes of the file
+ * @param string $proposed the MIME type proposed by the server
*
* @return Array: map of IE version to detected mime type
*/
@@ -367,9 +367,9 @@ class IEContentAnalyzer {
/**
* Get the untranslated MIME types for all known versions
*
- * @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
+ * @param string $fileName the file name (unused at present)
+ * @param string $chunk the first 256 bytes of the file
+ * @param string $proposed the MIME type proposed by the server
*
* @return Array: map of IE version to detected mime type
*/
@@ -848,4 +848,3 @@ class IEContentAnalyzer {
return 'unknown';
}
}
-
diff --git a/includes/libs/IEUrlExtension.php b/includes/libs/IEUrlExtension.php
index e9cfa997..79387e63 100644
--- a/includes/libs/IEUrlExtension.php
+++ b/includes/libs/IEUrlExtension.php
@@ -55,8 +55,8 @@ class IEUrlExtension {
*
* If the a variable is unset in $_SERVER, it should be unset in $vars.
*
- * @param $vars array A subset of $_SERVER.
- * @param $extWhitelist array Extensions which are allowed, assumed harmless.
+ * @param array $vars A subset of $_SERVER.
+ * @param array $extWhitelist Extensions which are allowed, assumed harmless.
* @return bool
*/
public static function areServerVarsBad( $vars, $extWhitelist = array() ) {
@@ -92,8 +92,8 @@ class IEUrlExtension {
* Given a right-hand portion of a URL, determine whether IE would detect
* a potentially harmful file extension.
*
- * @param $urlPart string The right-hand portion of a URL
- * @param $extWhitelist array An array of file extensions which may occur in this
+ * @param string $urlPart The right-hand portion of a URL
+ * @param array $extWhitelist An array of file extensions which may occur in this
* URL, and which should be allowed.
* @return bool
*/
@@ -187,7 +187,7 @@ class IEUrlExtension {
* - if we find a possible extension followed by a dot or another illegal
* character, we ignore it and continue searching
*
- * @param $url string URL
+ * @param string $url URL
* @return mixed Detected extension (string), or false if none found
*/
public static function findIE6Extension( $url ) {
@@ -245,7 +245,7 @@ class IEUrlExtension {
* whether the script filename has been obscured.
*
* The function returns false if the server is not known to have this
- * behaviour. Microsoft IIS in particular is known to decode escaped script
+ * behavior. Microsoft IIS in particular is known to decode escaped script
* filenames.
*
* SERVER_SOFTWARE typically contains either a plain string such as "Zeus",
diff --git a/includes/libs/JavaScriptMinifier.php b/includes/libs/JavaScriptMinifier.php
index 0b4be9ae..998805ae 100644
--- a/includes/libs/JavaScriptMinifier.php
+++ b/includes/libs/JavaScriptMinifier.php
@@ -59,7 +59,7 @@ class JavaScriptMinifier {
const TYPE_DO = 15; // keywords: case, var, finally, else, do, try
const TYPE_FUNC = 16; // keywords: function
const TYPE_LITERAL = 17; // all literals, identifiers and unrecognised tokens
-
+
// Sanity limit to avoid excessive memory usage
const STACK_LIMIT = 1000;
@@ -72,9 +72,9 @@ class JavaScriptMinifier {
* literals (e.g. quoted strings) longer than $maxLineLength are encountered
* or when required to guard against semicolon insertion.
*
- * @param $s String JavaScript code to minify
- * @param $statementsOnOwnLine Bool Whether to put each statement on its own line
- * @param $maxLineLength Int Maximum length of a single line, or -1 for no maximum.
+ * @param string $s JavaScript code to minify
+ * @param bool $statementsOnOwnLine Whether to put each statement on its own line
+ * @param int $maxLineLength Maximum length of a single line, or -1 for no maximum.
* @return String Minified code
*/
public static function minify( $s, $statementsOnOwnLine = false, $maxLineLength = 1000 ) {
@@ -385,7 +385,7 @@ class JavaScriptMinifier {
self::TYPE_LITERAL => true
)
);
-
+
// Rules for when newlines should be inserted if
// $statementsOnOwnLine is enabled.
// $newlineBefore is checked before switching state,
@@ -514,7 +514,7 @@ class JavaScriptMinifier {
return self::parseError($s, $end, 'Number with several E' );
}
$end++;
-
+
// + sign is optional; - sign is required.
$end += strspn( $s, '-+', $end );
$len = strspn( $s, '0123456789', $end );
@@ -564,13 +564,13 @@ class JavaScriptMinifier {
$out .= ' ';
$lineLength++;
}
-
+
$out .= $token;
$lineLength += $end - $pos; // += strlen( $token )
$last = $s[$end - 1];
$pos = $end;
$newlineFound = false;
-
+
// Output a newline after the token if required
// This is checked before AND after switching state
$newlineAdded = false;
@@ -589,7 +589,7 @@ class JavaScriptMinifier {
} elseif( isset( $goto[$state][$type] ) ) {
$state = $goto[$state][$type];
}
-
+
// Check for newline insertion again
if ( $statementsOnOwnLine && !$newlineAdded && isset( $newlineAfter[$state][$type] ) ) {
$out .= "\n";
@@ -598,7 +598,7 @@ class JavaScriptMinifier {
}
return $out;
}
-
+
static function parseError($fullJavascript, $position, $errorMsg) {
// TODO: Handle the error: trigger_error, throw exception, return false...
return false;
diff --git a/includes/libs/jsminplus.php b/includes/libs/jsminplus.php
index 7c4e32bd..f250217f 100644
--- a/includes/libs/jsminplus.php
+++ b/includes/libs/jsminplus.php
@@ -256,7 +256,7 @@ class JSMinPlus
}
elseif ($type == KEYWORD_VAR && $type == $lastType)
{
- // mutiple var-statements can go into one
+ // multiple var-statements can go into one
$t = ',' . substr($t, 4);
}
else
@@ -298,7 +298,7 @@ class JSMinPlus
if ($elsePart)
{
- // be carefull and always make a block out of the thenPart; could be more optimized but is a lot of trouble
+ // be careful and always make a block out of the thenPart; could be more optimized but is a lot of trouble
if ($thenPart != ';' && $thenPart[0] != '{')
$thenPart = '{' . $thenPart . '}';
@@ -521,7 +521,7 @@ class JSMinPlus
break;
case TOKEN_STRING:
- //combine concatted strings with same quotestyle
+ //combine concatenated strings with same quote style
if ($n->type == OP_PLUS && substr($left, -1) == $right[0])
{
$s = substr($left, 0, -1) . substr($right, 1);