ソースを参照

late static binding

euromark 11 年 前
コミット
0721239d7e

+ 3 - 3
Console/Command/CopyShell.php

@@ -120,11 +120,11 @@ class CopyShell extends AppShell {
 
 		// change type if param given
 		if (!empty($this->params['cake'])) { # cake core
-			$this->type = self::TYPE_CAKE;
+			$this->type = static::TYPE_CAKE;
 		} elseif (!empty($this->params['vendors'])) {
-			$this->type = self::TYPE_VENDOR;
+			$this->type = static::TYPE_VENDOR;
 		} elseif (!empty($this->params['plugins'])) {
-			$this->type = self::TYPE_PLUGIN;
+			$this->type = static::TYPE_PLUGIN;
 		}
 		$this->out($this->types[$this->type]);
 

+ 1 - 1
Console/Command/HashShell.php

@@ -28,7 +28,7 @@ class HashShell extends AppShell {
 			$this->out(($key + 1) . ': ' . $t . (in_array($t, $this->active) ? ' (!)' : ''));
 		}
 		while (!isset($type) || !in_array($type - 1, $types)) {
-			$type = $this->in(__('Select hashType - or [q] to quit'), null, self::DEFAULT_HASH_ALG);
+			$type = $this->in(__('Select hashType - or [q] to quit'), null, static::DEFAULT_HASH_ALG);
 			if ($type === 'q') {
 				return $this->error('Aborted!');
 			}

+ 1 - 1
Controller/Component/AuthExtComponent.php

@@ -138,7 +138,7 @@ class AuthExtComponent extends AuthComponent {
 			}
 
 			$this->Session->renew();
-			$this->Session->write(self::$sessionKey, $user);
+			$this->Session->write(static::$sessionKey, $user);
 		}
 		return $this->loggedIn();
 	}

+ 3 - 3
Lib/Auth.php

@@ -89,7 +89,7 @@ class Auth {
 		if ($providedRoles !== null) {
 			$roles = $providedRoles;
 		} else {
-			$roles = self::roles();
+			$roles = static::roles();
 		}
 		if (is_array($roles)) {
 			if (in_array($ownRole, $roles)) {
@@ -118,7 +118,7 @@ class Auth {
 		if ($providedRoles !== null) {
 			$roles = $providedRoles;
 		} else {
-			$roles = self::roles();
+			$roles = static::roles();
 		}
 		$ownRoles = (array)$ownRoles;
 		if (empty($ownRoles)) {
@@ -126,7 +126,7 @@ class Auth {
 		}
 		$count = 0;
 		foreach ($ownRoles as $role) {
-			if (self::hasRole($role, $roles)) {
+			if (static::hasRole($role, $roles)) {
 				if ($oneRoleIsEnough) {
 					return true;
 				}

+ 2 - 2
Lib/CurrencyLib.php

@@ -162,7 +162,7 @@ class CurrencyLib {
 			return $historyList;
 		}
 
-		$currencies = $this->_loadXml(self::URL_HISTORY);
+		$currencies = $this->_loadXml(static::URL_HISTORY);
 
 		// Filter down to just the rates
 		$dates = $currencies['Envelope']['Cube']['Cube'];
@@ -192,7 +192,7 @@ class CurrencyLib {
 		}
 
 		// Retrieve rates as an XML object
-		$currencies = $this->_loadXml(self::URL);
+		$currencies = $this->_loadXml(static::URL);
 
 		//Filter down to just the rates
 		$currencies = $currencies['Envelope']['Cube']['Cube']['Cube'];

+ 5 - 5
Lib/Error/MyErrorHandler.php

@@ -18,7 +18,7 @@ class MyErrorHandler extends ErrorHandler {
 				get_class($exception),
 				$exception->getMessage(),
 				$exception->getTraceAsString(),
-				self::traceDetails()
+				static::traceDetails()
 			);
 			$log = LOG_ERR;
 			if (in_array(get_class($exception), array('MissingControllerException', 'MissingActionException', 'PrivateActionException', 'NotFoundException'))) {
@@ -41,7 +41,7 @@ class MyErrorHandler extends ErrorHandler {
 				get_class($e),
 				$e->getMessage(),
 				$e->getTraceAsString(),
-				self::traceDetails()
+				static::traceDetails()
 			);
 			trigger_error($message, E_USER_ERROR);
 		}
@@ -57,9 +57,9 @@ class MyErrorHandler extends ErrorHandler {
 			return false;
 		}
 		$errorConfig = Configure::read('Error');
-		list($error, $log) = self::mapErrorCode($code);
+		list($error, $log) = static::mapErrorCode($code);
 		if ($log === LOG_ERR) {
-			return self::handleFatalError($code, $description, $file, $line);
+			return static::handleFatalError($code, $description, $file, $line);
 		}
 
 		$debug = Configure::read('debug');
@@ -81,7 +81,7 @@ class MyErrorHandler extends ErrorHandler {
 			if (!empty($errorConfig['trace'])) {
 				$trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
 				$message .= "\nTrace:\n" . $trace . "\n";
-				$message .= self::traceDetails();
+				$message .= static::traceDetails();
 			}
 			return CakeLog::write($log, $message);
 		}

+ 13 - 13
Lib/GeocodeLib.php

@@ -117,7 +117,7 @@ class GeocodeLib {
 
 		$this->setOptions($options);
 		if (empty($this->options['host'])) {
-			$this->options['host'] = self::DEFAULT_HOST;
+			$this->options['host'] = static::DEFAULT_HOST;
 		}
 	}
 
@@ -188,7 +188,7 @@ class GeocodeLib {
 		$params = array(
 			'host' => $this->options['host']
 		);
-		$url = String::insert(self::BASE_URL, $params, array('before' => '{', 'after' => '}', 'clean' => true));
+		$url = String::insert(static::BASE_URL, $params, array('before' => '{', 'after' => '}', 'clean' => true));
 		return $url;
 	}
 
@@ -264,7 +264,7 @@ class GeocodeLib {
 
 			$status = $result['status'];
 
-			if ($status == self::STATUS_SUCCESS) {
+			if ($status == static::STATUS_SUCCESS) {
 				if (!$this->_process($result)) {
 					return false;
 				}
@@ -275,7 +275,7 @@ class GeocodeLib {
 				}
 				break;
 
-			} elseif ($status == self::STATUS_TOO_MANY_QUERIES) {
+			} elseif ($status == static::STATUS_TOO_MANY_QUERIES) {
 				// sent geocodes too fast, delay +0.1 seconds
 				if ($this->options['log']) {
 					CakeLog::write('geocode', __('Delay necessary for address \'%s\'', $address));
@@ -347,7 +347,7 @@ class GeocodeLib {
 
 			$status = $result['status'];
 
-			if ($status == self::STATUS_SUCCESS) {
+			if ($status == static::STATUS_SUCCESS) {
 				if (!$this->_process($result)) {
 					return false;
 				}
@@ -358,7 +358,7 @@ class GeocodeLib {
 				}
 				break;
 
-			} elseif ($status == self::STATUS_TOO_MANY_QUERIES) {
+			} elseif ($status == static::STATUS_TOO_MANY_QUERIES) {
 				// sent geocodes too fast, delay +0.1 seconds
 				if ($this->options['log']) {
 					CakeLog::write('geocode', __('Delay necessary for \'%s\'', $latlng));
@@ -862,13 +862,13 @@ class GeocodeLib {
 	 */
 	public function errorMessage($code) {
 		$codes = array(
-			self::CODE_SUCCESS => 'Success',
-			self::CODE_BAD_REQUEST => 'Bad Request',
-			self::CODE_MISSING_ADDRESS => 'Bad Address',
-			self::CODE_UNKNOWN_ADDRESS => 'Unknown Address',
-			self::CODE_UNAVAILABLE_ADDRESS => 'Unavailable Address',
-			self::CODE_BAD_KEY => 'Bad Key',
-			self::CODE_TOO_MANY_QUERIES => 'Too Many Queries',
+			static::CODE_SUCCESS => 'Success',
+			static::CODE_BAD_REQUEST => 'Bad Request',
+			static::CODE_MISSING_ADDRESS => 'Bad Address',
+			static::CODE_UNKNOWN_ADDRESS => 'Unknown Address',
+			static::CODE_UNAVAILABLE_ADDRESS => 'Unavailable Address',
+			static::CODE_BAD_KEY => 'Bad Key',
+			static::CODE_TOO_MANY_QUERIES => 'Too Many Queries',
 		);
 		if (isset($codes[$code])) {
 			return __($codes[$code]);

+ 1 - 1
Lib/HazardLib.php

@@ -65,7 +65,7 @@ class HazardLib {
 		}
 		if (empty($texts)) {
 			$texts = array();
-			$contents = self::_parseXml(self::URL);
+			$contents = static::_parseXml(static::URL);
 			foreach ($contents as $content) {
 				if ($content['code'] === 'See Below') {
 					continue;

+ 34 - 34
Lib/ImapLib.php

@@ -73,50 +73,50 @@ class ImapLib {
 	public function buildConnector($data = array()) {
 		$data = array_merge($this->settings, $data);
 		$string = '{';
-		$string .= $data[self::S_SERVER];
-		if ($data[self::S_PORT]) {
-			$string .= ':' . $data[self::S_PORT];
+		$string .= $data[static::S_SERVER];
+		if ($data[static::S_PORT]) {
+			$string .= ':' . $data[static::S_PORT];
 		}
-		if ($data[self::S_SERVICE]) {
-			$string .= '/service=' . $data[self::S_SERVICE];
+		if ($data[static::S_SERVICE]) {
+			$string .= '/service=' . $data[static::S_SERVICE];
 		}
-		if ($data[self::S_USER]) {
-			$string .= '/user=' . $data[self::S_USER];
+		if ($data[static::S_USER]) {
+			$string .= '/user=' . $data[static::S_USER];
 		} else {
 			$string .= '/anonymous';
 		}
-		if ($data[self::S_AUTHUSER]) {
-			$string .= '/authuser=' . $data[self::S_AUTHUSER];
+		if ($data[static::S_AUTHUSER]) {
+			$string .= '/authuser=' . $data[static::S_AUTHUSER];
 		}
-		if ($data[self::S_DEBUG]) {
+		if ($data[static::S_DEBUG]) {
 			$string .= '/debug';
 		}
-		if ($data[self::S_SECURE]) {
+		if ($data[static::S_SECURE]) {
 			$string .= '/secure';
 		}
-		if ($data[self::S_NORSH]) {
+		if ($data[static::S_NORSH]) {
 			$string .= '/norsh';
 		}
-		if ($data[self::S_SSL]) {
+		if ($data[static::S_SSL]) {
 			$string .= '/ssl';
 		}
-		if ($data[self::S_VALIDATECERT]) {
+		if ($data[static::S_VALIDATECERT]) {
 			$string .= '/validate-cert';
 		} else {
 			$string .= '/novalidate-cert';
 		}
-		if ($data[self::S_TLS]) {
+		if ($data[static::S_TLS]) {
 			$string .= '/tls';
 		}
-		if ($data[self::S_NOTLS]) {
+		if ($data[static::S_NOTLS]) {
 			$string .= '/notls';
 		}
-		if ($data[self::S_READONLY]) {
+		if ($data[static::S_READONLY]) {
 			$string .= '/readonly';
 		}
 		$string .= '}';
 
-		$string .= $data[self::S_MAILBOX];
+		$string .= $data[static::S_MAILBOX];
 
 		$this->currentRef = $string;
 		$this->currentSettings = $data;
@@ -147,12 +147,12 @@ class ImapLib {
 	 * @return bool Success
 	 */
 	public function connect($user, $pass, $server, $port = null) {
-		$this->settings[self::S_SERVER] = $server;
-		if ($port || !$port && $this->settings[self::S_SERVICE] === 'imap') {
-			$this->settings[self::S_PORT] = $port;
+		$this->settings[static::S_SERVER] = $server;
+		if ($port || !$port && $this->settings[static::S_SERVICE] === 'imap') {
+			$this->settings[static::S_PORT] = $port;
 		}
-		$this->settings[self::S_USER] = $user;
-		$this->settings[self::S_PASSWORD] = $pass;
+		$this->settings[static::S_USER] = $user;
+		$this->settings[static::S_PASSWORD] = $pass;
 		$connector = $this->buildConnector();
 
 		//$options = OP_DEBUG;
@@ -696,9 +696,9 @@ class ImapMessageInfoLib {
 			return $this->seen;
 		}
 		if ($set) {
-			return $this->flag(self::BS . 'Seen');
+			return $this->flag(static::BS . 'Seen');
 		}
-		return $this->unFlag(self::BS . 'Seen');
+		return $this->unFlag(static::BS . 'Seen');
 	}
 
 	public function answered($set = null) {
@@ -706,9 +706,9 @@ class ImapMessageInfoLib {
 			return $this->answered;
 		}
 		if ($set) {
-			return $this->flag(self::BS . 'Answered');
+			return $this->flag(static::BS . 'Answered');
 		}
-		return $this->unFlag(self::BS . 'Answered');
+		return $this->unFlag(static::BS . 'Answered');
 	}
 
 	public function flagged($set = null) {
@@ -716,9 +716,9 @@ class ImapMessageInfoLib {
 			return $this->flagged;
 		}
 		if ($set) {
-			return $this->flag(self::BS . 'Flagged');
+			return $this->flag(static::BS . 'Flagged');
 		}
-		return $this->unFlag(self::BS . 'Flagged');
+		return $this->unFlag(static::BS . 'Flagged');
 	}
 
 	public function deleted($set = null) {
@@ -726,9 +726,9 @@ class ImapMessageInfoLib {
 			return $this->deleted;
 		}
 		if ($set) {
-			return $this->flag(self::BS . 'Deleted');
+			return $this->flag(static::BS . 'Deleted');
 		}
-		return $this->unFlag(self::BS . 'Deleted');
+		return $this->unFlag(static::BS . 'Deleted');
 	}
 
 	public function draft($set = null) {
@@ -736,9 +736,9 @@ class ImapMessageInfoLib {
 			return $this->draft;
 		}
 		if ($set) {
-			return $this->flag(self::BS . 'Draft');
+			return $this->flag(static::BS . 'Draft');
 		}
-		return $this->unFlag(self::BS . 'Draft');
+		return $this->unFlag(static::BS . 'Draft');
 	}
 
 }
@@ -871,7 +871,7 @@ class ImapFolderLib {
 				$value = null;
 			}
 			switch ($key) {
-				case self::S_FROM:
+				case static::S_FROM:
 					$param = '"' . $value . '" ';
 					break;
 				default:

+ 37 - 37
Lib/Misc/ZodiacLib.php

@@ -33,40 +33,40 @@ class ZodiacLib {
 	public function getRange($sign) {
 		$range = null;
 		switch ($sign) {
-			case self::SIGN_AQUARIUS:
+			case static::SIGN_AQUARIUS:
 				$range = array(array(1, 21), array(2, 19));
 				break;
-			case self::SIGN_PISCES:
+			case static::SIGN_PISCES:
 				$range = array(array(2, 20), array(3, 20));
 				break;
-			case self::SIGN_ARIES:
+			case static::SIGN_ARIES:
 				$range = array(array(3, 21), array(4, 20));
 				break;
-			case self::SIGN_TAURUS:
+			case static::SIGN_TAURUS:
 				$range = array(array(4, 21), array(5, 21));
 				break;
-			case self::SIGN_GEMINI:
+			case static::SIGN_GEMINI:
 				$range = array(array(5, 22), array(6, 21));
 				break;
-			case self::SIGN_CANCER:
+			case static::SIGN_CANCER:
 				$range = array(array(6, 22), array(7, 23));
 				break;
-			case self::SIGN_LEO:
+			case static::SIGN_LEO:
 				$range = array(array(7, 24), array(8, 23));
 				break;
-			case self::SIGN_VIRGO:
+			case static::SIGN_VIRGO:
 				$range = array(array(8, 24), array(9, 23));
 				break;
-			case self::SIGN_LIBRA:
+			case static::SIGN_LIBRA:
 				$range = array(array(9, 24), array(10, 23));
 				break;
-			case self::SIGN_SCORPIO:
+			case static::SIGN_SCORPIO:
 				$range = array(array(10, 24), array(11, 22));
 				break;
-			case self::SIGN_SAGITTARIUS:
+			case static::SIGN_SAGITTARIUS:
 				$range = array(array(11, 23), array(12, 21));
 				break;
-			case self::SIGN_CAPRICORN:
+			case static::SIGN_CAPRICORN:
 				$range = array(array(12, 22), array(1, 20));
 				break;
 		}
@@ -85,40 +85,40 @@ class ZodiacLib {
 	public function getSign($month, $day) {
 		switch ($month) {
 			case 1:
-				$zodiac = ($day <= 20) ? self::SIGN_CAPRICORN : self::SIGN_AQUARIUS;
+				$zodiac = ($day <= 20) ? static::SIGN_CAPRICORN : static::SIGN_AQUARIUS;
 				break;
 			case 2:
-				$zodiac = ($day <= 19) ? self::SIGN_AQUARIUS : self::SIGN_PISCES;
+				$zodiac = ($day <= 19) ? static::SIGN_AQUARIUS : static::SIGN_PISCES;
 				break;
 			case 3:
-				$zodiac = ($day <= 20) ? self::SIGN_PISCES : self::SIGN_ARIES;
+				$zodiac = ($day <= 20) ? static::SIGN_PISCES : static::SIGN_ARIES;
 				break;
 			case 4:
-				$zodiac = ($day <= 20) ? self::SIGN_ARIES : self::SIGN_TAURUS;
+				$zodiac = ($day <= 20) ? static::SIGN_ARIES : static::SIGN_TAURUS;
 				break;
 			case 5 :
-				$zodiac = ($day <= 21) ? self::SIGN_TAURUS : self::SIGN_GEMINI;
+				$zodiac = ($day <= 21) ? static::SIGN_TAURUS : static::SIGN_GEMINI;
 				break;
 			case 6 :
-				$zodiac = ($day <= 21) ? self::SIGN_GEMINI : self::SIGN_CANCER;
+				$zodiac = ($day <= 21) ? static::SIGN_GEMINI : static::SIGN_CANCER;
 				break;
 			case 7 :
-				$zodiac = ($day <= 23) ? self::SIGN_CANCER : self::SIGN_LEO;
+				$zodiac = ($day <= 23) ? static::SIGN_CANCER : static::SIGN_LEO;
 				break;
 			case 8 :
-				$zodiac = ($day <= 23) ? self::SIGN_LEO : self::SIGN_VIRGO;
+				$zodiac = ($day <= 23) ? static::SIGN_LEO : static::SIGN_VIRGO;
 				break;
 			case 9 :
-				$zodiac = ($day <= 23) ? self::SIGN_VIRGO : self::SIGN_LIBRA;
+				$zodiac = ($day <= 23) ? static::SIGN_VIRGO : static::SIGN_LIBRA;
 				break;
 			case 10 :
-				$zodiac = ($day <= 23) ? self::SIGN_LIBRA : self::SIGN_SCORPIO;
+				$zodiac = ($day <= 23) ? static::SIGN_LIBRA : static::SIGN_SCORPIO;
 				break;
 			case 11 :
-				$zodiac = ($day <= 22) ? self::SIGN_SCORPIO : self::SIGN_SAGITTARIUS;
+				$zodiac = ($day <= 22) ? static::SIGN_SCORPIO : static::SIGN_SAGITTARIUS;
 				break;
 			case 12 :
-				$zodiac = ($day <= 21) ? self::SIGN_SAGITTARIUS : self::SIGN_CAPRICORN;
+				$zodiac = ($day <= 21) ? static::SIGN_SAGITTARIUS : static::SIGN_CAPRICORN;
 				break;
 		}
 		return $zodiac;
@@ -154,18 +154,18 @@ class ZodiacLib {
 	 */
 	public static function signs($value = null) {
 		$res = array(
-			self::SIGN_AQUARIUS	=> __('zodiacAquarius'),
-			self::SIGN_PISCES	=> __('zodiacPisces'),
-			self::SIGN_ARIES	=> __('zodiacAries'),
-			self::SIGN_TAURUS	=> __('zodiacTaurus'),
-			self::SIGN_GEMINI	=> __('zodiacGemini'),
-			self::SIGN_CANCER	=> __('zodiacCancer'),
-			self::SIGN_LEO	=> __('zodiacLeo'),
-			self::SIGN_VIRGO	=> __('zodiacVirgo'),
-			self::SIGN_LIBRA	=> __('zodiacLibra'),
-			self::SIGN_SCORPIO	=> __('zodiacScorpio'),
-			self::SIGN_SAGITTARIUS	=> __('zodiacSagittarius'),
-			self::SIGN_CAPRICORN	=> __('zodiacCapricorn'),
+			static::SIGN_AQUARIUS	=> __('zodiacAquarius'),
+			static::SIGN_PISCES	=> __('zodiacPisces'),
+			static::SIGN_ARIES	=> __('zodiacAries'),
+			static::SIGN_TAURUS	=> __('zodiacTaurus'),
+			static::SIGN_GEMINI	=> __('zodiacGemini'),
+			static::SIGN_CANCER	=> __('zodiacCancer'),
+			static::SIGN_LEO	=> __('zodiacLeo'),
+			static::SIGN_VIRGO	=> __('zodiacVirgo'),
+			static::SIGN_LIBRA	=> __('zodiacLibra'),
+			static::SIGN_SCORPIO	=> __('zodiacScorpio'),
+			static::SIGN_SAGITTARIUS	=> __('zodiacSagittarius'),
+			static::SIGN_CAPRICORN	=> __('zodiacCapricorn'),
 		);
 		if ($value === null) {
 			return $res;
@@ -180,7 +180,7 @@ class ZodiacLib {
 	 * @return string
 	 */
 	public static function image($sign) {
-		return self::$res[$sign];
+		return static::$res[$sign];
 	}
 
 	const SIGN_AQUARIUS = 1; # from 20.01. to 18.02.

+ 9 - 9
Lib/RandomLib.php

@@ -39,12 +39,12 @@ class RandomLib {
 		}
 		if ($integerKeys) {
 			$max = count($array) - 1;
-			return $array[self::int(0, $max)];
+			return $array[static::int(0, $max)];
 		}
 		$keys = array_keys($array);
 		$values = array_values($array);
 		$max = count($keys) - 1;
-		return $values[self::int(0, $max)];
+		return $values[static::int(0, $max)];
 	}
 
 	public static function arrayValues($array, $minAmount = null, $maxAmount = null) {
@@ -60,7 +60,7 @@ class RandomLib {
 	elseif ($min > 0 && $max === null)
 		$res = $min;
 	elseif ($min > 0 && $max > 0)
-		$res = self::int($min, $max);
+		$res = static::int($min, $max);
 	else
 		$res = time();
 
@@ -99,9 +99,9 @@ class RandomLib {
 	 * @return (string) $dob a db (ISO) format datetime string
 	 */
 	public static function dob($min = 18, $max = 100) {
-		$dobYear = date('Y') - (self::int($min, $max));
+		$dobYear = date('Y') - (static::int($min, $max));
 
-		$dobMonth = self::int(1, 12);
+		$dobMonth = static::int(1, 12);
 
 		if ($dobMonth == 2) {
 			// leap year?
@@ -114,7 +114,7 @@ class RandomLib {
 		else
 			$maxDays = 31;
 
-		$dobDay = self::int(1, $maxDays);
+		$dobDay = static::int(1, $maxDays);
 
 		$dob = sprintf("%4d-%02d-%02d", $dobYear, $dobMonth, $dobDay);
 		return $dob;
@@ -148,10 +148,10 @@ class RandomLib {
 	 */
 	public static function pwd($type = null, $length = null) {
 		if (!empty($type) && $type === 'user') {
-			return self::generatePassword(6);
+			return static::generatePassword(6);
 		}
 		if (!empty($length)) {
-			return self::generatePassword($length);
+			return static::generatePassword($length);
 		}
 		return '';
 	}
@@ -165,7 +165,7 @@ class RandomLib {
 	 * @deprecated Use pwd() instead
 	 */
 	public static function randomPwd($type = null, $length = null) {
-		return self::pwd($type, $length);
+		return static::pwd($type, $length);
 	}
 
 	/**

+ 22 - 22
Lib/Routing/UrlCacheManager.php

@@ -75,22 +75,22 @@ class UrlCacheManager {
 				}
 				$cachePageKey = '_' . $path;
 			}
-			self::$cachePageKey = self::$cacheKey . $cachePageKey;
-			self::$cachePage = Cache::read(self::$cachePageKey, '_cake_core_');
+			static::$cachePageKey = static::$cacheKey . $cachePageKey;
+			static::$cachePage = Cache::read(static::$cachePageKey, '_cake_core_');
 		}
-		self::$cache = Cache::read(self::$cacheKey, '_cake_core_');
+		static::$cache = Cache::read(static::$cacheKey, '_cake_core_');
 
 		// still old "prefix true/false" syntax?
 		if (Configure::read('UrlCache.verbosePrefixes')) {
-			unset(self::$paramFields[3]);
-			self::$paramFields = array_merge(self::$paramFields, (array)Configure::read('Routing.prefixes'));
+			unset(static::$paramFields[3]);
+			static::$paramFields = array_merge(static::$paramFields, (array)Configure::read('Routing.prefixes'));
 		}
-		self::$extras = array_intersect_key($params, array_combine(self::$paramFields, self::$paramFields));
+		static::$extras = array_intersect_key($params, array_combine(static::$paramFields, static::$paramFields));
 		$defaults = array();
-		foreach (self::$paramFields as $field) {
+		foreach (static::$paramFields as $field) {
 			$defaults[$field] = '';
 		}
-		self::$extras = array_merge($defaults, self::$extras);
+		static::$extras = array_merge($defaults, static::$extras);
 	}
 
 	/**
@@ -98,9 +98,9 @@ class UrlCacheManager {
 	 *
 	 */
 	public static function finalize() {
-		Cache::write(self::$cacheKey, self::$cache, '_cake_core_');
-		if (Configure::read('UrlCache.pageFiles') && !empty(self::$cachePage)) {
-			Cache::write(self::$cachePageKey, self::$cachePage, '_cake_core_');
+		Cache::write(static::$cacheKey, static::$cache, '_cake_core_');
+		if (Configure::read('UrlCache.pageFiles') && !empty(static::$cachePage)) {
+			Cache::write(static::$cachePageKey, static::$cachePage, '_cake_core_');
 		}
 	}
 
@@ -113,7 +113,7 @@ class UrlCacheManager {
 	public static function get($url, $full) {
 		$keyUrl = $url;
 		if (is_array($keyUrl)) {
-			$keyUrl += self::$extras;
+			$keyUrl += static::$extras;
 			// prevent different hashs on different orders
 			ksort($keyUrl, SORT_STRING);
 			// prevent different hashs on different types (int/string/bool)
@@ -121,21 +121,21 @@ class UrlCacheManager {
 				$keyUrl[$key] = (string) $val;
 			}
 		}
-		self::$key = md5(serialize($keyUrl) . $full);
+		static::$key = md5(serialize($keyUrl) . $full);
 
 		if (Configure::read('UrlCache.pageFiles')) {
-			self::$type = 'cachePage';
+			static::$type = 'cachePage';
 			if (is_array($keyUrl)) {
-				$res = array_diff_key($keyUrl, self::$extras);
+				$res = array_diff_key($keyUrl, static::$extras);
 				if (empty($res)) {
-					self::$type = 'cache';
+					static::$type = 'cache';
 				}
 			}
-			if (self::$type === 'cachePage') {
-				return isset(self::$cachePage[self::$key]) ? self::$cachePage[self::$key] : false;
+			if (static::$type === 'cachePage') {
+				return isset(static::$cachePage[static::$key]) ? static::$cachePage[static::$key] : false;
 			}
 		}
-		return isset(self::$cache[self::$key]) ? self::$cache[self::$key] : false;
+		return isset(static::$cache[static::$key]) ? static::$cache[static::$key] : false;
 	}
 
 	/**
@@ -146,10 +146,10 @@ class UrlCacheManager {
 	 * @return void
 	 */
 	public static function set($data) {
-		if (Configure::read('UrlCache.pageFiles') && self::$type === 'cachePage') {
-			self::$cachePage[self::$key] = $data;
+		if (Configure::read('UrlCache.pageFiles') && static::$type === 'cachePage') {
+			static::$cachePage[static::$key] = $data;
 		} else {
-			self::$cache[self::$key] = $data;
+			static::$cache[static::$key] = $data;
 		}
 	}
 

+ 16 - 16
Lib/Utility/NumberLib.php

@@ -29,10 +29,10 @@ class NumberLib extends CakeNumber {
 		$config = $options + (array)Configure::read('Localization');
 		foreach ($config as $key => $value) {
 			$key = '_' . $key;
-			if (!isset(self::${$key})) {
+			if (!isset(static::${$key})) {
 				continue;
 			}
-			self::${$key} = $value;
+			static::${$key} = $value;
 		}
 	}
 
@@ -60,7 +60,7 @@ class NumberLib extends CakeNumber {
 			}
 			$val = max(0, $price);
 		}
-		return self::money($val, $formatOptions);
+		return static::money($val, $formatOptions);
 	}
 
 	/**
@@ -71,7 +71,7 @@ class NumberLib extends CakeNumber {
 	 * @return string
 	 */
 	public static function money($amount, $formatOptions = array()) {
-		return self::currency($amount, null, $formatOptions);
+		return static::currency($amount, null, $formatOptions);
 	}
 
 	/**
@@ -96,14 +96,14 @@ class NumberLib extends CakeNumber {
 		} elseif (!is_array($formatOptions)) {
 			$formatOptions = array('places' => $formatOptions);
 		}
-		$options = array('before' => '', 'after' => '', 'places' => 2, 'thousands' => self::$_thousands, 'decimals' => self::$_decimals, 'escape' => false);
+		$options = array('before' => '', 'after' => '', 'places' => 2, 'thousands' => static::$_thousands, 'decimals' => static::$_decimals, 'escape' => false);
 		$options = $formatOptions + $options;
 
 		if (!empty($options['currency'])) {
-			if (!empty(self::$_symbolRight)) {
-				$options['after'] = ' ' . self::$_symbolRight;
-			} elseif (!empty(self::$_symbolLeft)) {
-				$options['before'] = self::$_symbolLeft . ' ';
+			if (!empty(static::$_symbolRight)) {
+				$options['after'] = ' ' . static::$_symbolRight;
+			} elseif (!empty(static::$_symbolLeft)) {
+				$options['before'] = static::$_symbolLeft . ' ';
 			}
 		}
 
@@ -142,11 +142,11 @@ class NumberLib extends CakeNumber {
 	 */
 	public static function currency($number, $currency = null, $formatOptions = array()) {
 		if ($currency === null) {
-			$currency = self::$_currency;
+			$currency = static::$_currency;
 		}
 		$defaults = array();
-		if ($currency !== 'EUR' && isset(self::$_currencies[$currency])) {
-			$defaults = self::$_currencies[$currency];
+		if ($currency !== 'EUR' && isset(static::$_currencies[$currency])) {
+			$defaults = static::$_currencies[$currency];
 		} elseif ($currency !== 'EUR' && is_string($currency)) {
 			$defaults['wholeSymbol'] = $currency;
 			$defaults['wholePosition'] = 'before';
@@ -228,7 +228,7 @@ class NumberLib extends CakeNumber {
 		if ($options['multiply']) {
 			$number *= 100;
 		}
-		return self::precision($number, $precision, $options['decimals']) . '%';
+		return static::precision($number, $precision, $options['decimals']) . '%';
 	}
 
 	/**
@@ -253,7 +253,7 @@ class NumberLib extends CakeNumber {
 	 * @return float result
 	 */
 	public static function roundTo($number, $increments = 1.0) {
-		$precision = self::getDecimalPlaces($increments);
+		$precision = static::getDecimalPlaces($increments);
 		$res = round($number, $precision);
 		if ($precision <= 0) {
 			$res = (int)$res;
@@ -348,10 +348,10 @@ class NumberLib extends CakeNumber {
 	 * @return array currencySettings or null on failure
 	 */
 	public static function getFormat($formatName) {
-		if (!isset(self::$_currencies[$formatName])) {
+		if (!isset(static::$_currencies[$formatName])) {
 			return null;
 		}
-		return self::$_currencies[$formatName];
+		return static::$_currencies[$formatName];
 	}
 
 }

+ 11 - 11
Lib/Utility/NumberTextLib.php

@@ -29,10 +29,10 @@ class NumberTextLib {
 		if (!$lang) {
 			$lang = 'en_US';
 		}
-		if (!self::$_dir) {
-			self::$_dir = CakePlugin::path('Tools') . 'Vendor' . DS . 'Soros' . DS;
+		if (!static::$_dir) {
+			static::$_dir = CakePlugin::path('Tools') . 'Vendor' . DS . 'Soros' . DS;
 		}
-		if (!file_exists(self::$_dir . "$lang.sor")) {
+		if (!file_exists(static::$_dir . "$lang.sor")) {
 			throw new CakeException(__d('dev', 'Language file %s.sor not found', $lang));
 		}
 		return $lang;
@@ -47,9 +47,9 @@ class NumberTextLib {
 	 * @return string
 	 */
 	public static function numberText($input = '', $lang = '') {
-		$s = self::getLangModule($lang);
+		$s = static::getLangModule($lang);
 		if ($s === null) {
-			$s = self::load($lang);
+			$s = static::load($lang);
 		}
 		if ($s === null) {
 			return null;
@@ -67,20 +67,20 @@ class NumberTextLib {
 	 * @return string
 	 */
 	public static function moneyText($input = '', $money = '', $lang = '') {
-		return self::numbertext($money . " " . $input, $lang);
+		return static::numbertext($money . " " . $input, $lang);
 	}
 
 	protected static function load($lang) {
-		$lang = self::setLang($lang);
+		$lang = static::setLang($lang);
 
-		$file = self::$_dir . "$lang.sor";
+		$file = static::$_dir . "$lang.sor";
 		$st = file_get_contents($file);
 		if ($st === false) {
 			return null;
 		}
 		$s = new Soros($st);
 		if ($lang != null) {
-			self::addModule(array($lang, $s));
+			static::addModule(array($lang, $s));
 		}
 		return $s;
 	}
@@ -94,7 +94,7 @@ class NumberTextLib {
 	}
 
 	protected static function getLangModule($lang) {
-		$modules = self::getModules();
+		$modules = static::getModules();
 		if (isset($modules[$lang])) {
 			return $modules[$lang];
 		}
@@ -102,7 +102,7 @@ class NumberTextLib {
 	}
 
 	protected static function addModule($m) {
-		self::getModules($m);
+		static::getModules($m);
 	}
 
 }

+ 41 - 41
Lib/Utility/TimeLib.php

@@ -15,7 +15,7 @@ class TimeLib extends CakeTime {
 	 * @return bool
 	 */
 	public static function hasDaylightSavingTime($timezone = null) {
-		$timezone = self::timezone($timezone);
+		$timezone = static::timezone($timezone);
 		// a date outside of DST
 		$offset = $timezone->getOffset(new DateTime('@' . mktime(0, 0, 0, 2, 1, date('Y'))));
 		$offset = $offset / HOUR;
@@ -34,7 +34,7 @@ class TimeLib extends CakeTime {
 	 * @return int Offset in hours
 	 */
 	public static function getGmtOffset($timezone = null) {
-		$timezone = self::timezone($timezone);
+		$timezone = static::timezone($timezone);
 		$offset = $timezone->getOffset(new DateTime('@' . time()));
 		$offset = $offset / HOUR;
 		return $offset;
@@ -54,10 +54,10 @@ class TimeLib extends CakeTime {
 			$timezone = new DateTimeZone($identifier);
 			$location = $timezone->getLocation();
 			$point = array('lat' => $location['latitude'], 'lng' => $location['longitude']);
-	 		$distance = (int)GeocodeLib::calculateDistance(compact('lat', 'lng'), $point);
-	 		if (!$current['distance'] || $distance < $current['distance']) {
-	 			$current = array('timezone' => $identifier, 'distance' => $distance);
-	 		}
+			$distance = (int)GeocodeLib::calculateDistance(compact('lat', 'lng'), $point);
+			if (!$current['distance'] || $distance < $current['distance']) {
+				$current = array('timezone' => $identifier, 'distance' => $distance);
+			}
 		}
 		return $current['timezone'];
 	}
@@ -124,19 +124,19 @@ class TimeLib extends CakeTime {
 	 */
 	public static function ageByYear($year, $month = null) {
 		if ($month === null) {
-			$maxAge = self::age(mktime(0, 0, 0, 1, 1, $year));
-			$minAge = self::age(mktime(23, 59, 59, 12, 31, $year));
+			$maxAge = static::age(mktime(0, 0, 0, 1, 1, $year));
+			$minAge = static::age(mktime(23, 59, 59, 12, 31, $year));
 			$ages = array_unique(array($minAge, $maxAge));
 			return implode('/', $ages);
 		}
 		if (date('n') == $month) {
-			$maxAge = self::age(mktime(0, 0, 0, $month, 1, $year));
-			$minAge = self::age(mktime(23, 59, 59, $month, self::daysInMonth($year, $month), $year));
+			$maxAge = static::age(mktime(0, 0, 0, $month, 1, $year));
+			$minAge = static::age(mktime(23, 59, 59, $month, static::daysInMonth($year, $month), $year));
 
 			$ages = array_unique(array($minAge, $maxAge));
 			return implode('/', $ages);
 		}
-		return self::age(mktime(0, 0, 0, $month, 1, $year));
+		return static::age(mktime(0, 0, 0, $month, 1, $year));
 	}
 
 	/**
@@ -261,7 +261,7 @@ class TimeLib extends CakeTime {
 	 * @deprecated Not needed, use localDate!
 	 */
 	public static function cWeekDay($cweek, $year, $day) {
-		$cweekBeginning = self::cweekBeginning($year, $cweek);
+		$cweekBeginning = static::cweekBeginning($year, $cweek);
 		return $cweekBeginning + $day * DAY;
 	}
 
@@ -286,7 +286,7 @@ class TimeLib extends CakeTime {
 	 * @return int Timestamp
 	 */
 	public static function cWeekBeginning($year, $cweek = 0) {
-		if ($cweek <= 1 || $cweek > self::cweeks($year)) {
+		if ($cweek <= 1 || $cweek > static::cweeks($year)) {
 			$first = mktime(0, 0, 0, 1, 1, $year);
 			$wtag = date('w', $first);
 
@@ -301,7 +301,7 @@ class TimeLib extends CakeTime {
 			}
 			return $firstmonday;
 		}
-		$monday = strtotime($year . 'W' . self::pad($cweek) . '1');
+		$monday = strtotime($year . 'W' . static::pad($cweek) . '1');
 		return $monday;
 	}
 
@@ -314,10 +314,10 @@ class TimeLib extends CakeTime {
 	 * @return int Timestamp
 	 */
 	public static function cWeekEnding($year, $cweek = 0) {
-		if ($cweek < 1 || $cweek >= self::cweeks($year)) {
-			return self::cweekBeginning($year + 1) - 1;
+		if ($cweek < 1 || $cweek >= static::cweeks($year)) {
+			return static::cweekBeginning($year + 1) - 1;
 		}
-		return self::cweekBeginning($year, $cweek + 1) - 1;
+		return static::cweekBeginning($year, $cweek + 1) - 1;
 	}
 
 	/**
@@ -363,7 +363,7 @@ class TimeLib extends CakeTime {
 	public static function incrementDate($startDate, $years = 0, $months = 0, $days = 0, $timezone = null) {
 		if (!is_object($startDate)) {
 			$startDate = new DateTime($startDate);
-			$startDate->setTimezone($timezone ? new DateTimeZone($timezone) : self::timezone());
+			$startDate->setTimezone($timezone ? new DateTimeZone($timezone) : static::timezone());
 		}
 		$startingTimeStamp = $startDate->getTimestamp();
 		// Get the month value of the given date:
@@ -415,7 +415,7 @@ class TimeLib extends CakeTime {
 	 */
 	public static function isInRange($dateString, $seconds) {
 		$newDate = time();
-		return self::difference($dateString, $newDate) <= $seconds;
+		return static::difference($dateString, $newDate) <= $seconds;
 	}
 
 	/**
@@ -441,7 +441,7 @@ class TimeLib extends CakeTime {
 		if ($dateString === null) {
 			$dateString = time();
 		}
-		$date = self::fromString($dateString, $options['timezone']);
+		$date = static::fromString($dateString, $options['timezone']);
 
 		if ($date === null || $date === false || $date <= 0) {
 			return $options['default'];
@@ -494,7 +494,7 @@ class TimeLib extends CakeTime {
 		if ($dateString === null) {
 			$dateString = time();
 		}
-		$date = self::fromString($dateString, $options['timezone']);
+		$date = static::fromString($dateString, $options['timezone']);
 
 		if ($date === null || $date === false || $date <= 0) {
 			return $options['default'];
@@ -644,7 +644,7 @@ class TimeLib extends CakeTime {
 		$res = array();
 		$abbr = isset($options['abbr']) ? $options['abbr'] : false;
 		foreach ($monthKeys as $key) {
-			$res[self::pad($key)] = self::month($key, $abbr, $options);
+			$res[static::pad($key)] = static::month($key, $abbr, $options);
 		}
 		return $res;
 	}
@@ -662,7 +662,7 @@ class TimeLib extends CakeTime {
 		$abbr = isset($options['abbr']) ? $options['abbr'] : false;
 		$offset = isset($options['offset']) ? $options['offset'] : 0;
 		foreach ($dayKeys as $key) {
-			$res[$key] = self::day($key, $abbr, $offset);
+			$res[$key] = static::day($key, $abbr, $offset);
 		}
 		return $res;
 	}
@@ -683,7 +683,7 @@ class TimeLib extends CakeTime {
 		// Determine the difference in seconds
 		$offset = abs(time() - $timestamp);
 
-		return self::fuzzyFromOffset($offset, $timestamp <= time());
+		return static::fuzzyFromOffset($offset, $timestamp <= time());
 	}
 
 	/**
@@ -877,7 +877,7 @@ class TimeLib extends CakeTime {
 	public static function relLengthOfTime($dateString, $format = null, $options = array()) {
 		if ($dateString !== null) {
 			$timezone = null;
-			$sec = time() - self::fromString($dateString, $timezone);
+			$sec = time() - static::fromString($dateString, $timezone);
 			$type = ($sec > 0) ? -1 : (($sec < 0) ? 1 : 0);
 			$sec = abs($sec);
 		} else {
@@ -890,7 +890,7 @@ class TimeLib extends CakeTime {
 			'future' => __('In %s'), 'past' => __('%s ago'), 'default' => '');
 		$options += $defaults;
 
-		$ret = self::lengthOfTime($sec, $format, $options);
+		$ret = static::lengthOfTime($sec, $format, $options);
 
 		if ($type == 1) {
 			if ($options['future'] !== false) {
@@ -931,7 +931,7 @@ class TimeLib extends CakeTime {
 	 * @return bool True if datetime string was day before yesterday
 	 */
 	public static function wasDayBeforeYesterday($dateString, $timezone = null) {
-		$date = self::fromString($dateString, $timezone);
+		$date = static::fromString($dateString, $timezone);
 		return date(FORMAT_DB_DATE, $date) == date(FORMAT_DB_DATE, time() - 2 * DAY);
 	}
 
@@ -943,7 +943,7 @@ class TimeLib extends CakeTime {
 	 * @return bool True if datetime string is day after tomorrow
 	 */
 	public static function isDayAfterTomorrow($dateString, $timezone = null) {
-		$date = self::fromString($dateString, $timezone);
+		$date = static::fromString($dateString, $timezone);
 		return date(FORMAT_DB_DATE, $date) == date(FORMAT_DB_DATE, time() + 2 * DAY);
 	}
 
@@ -955,7 +955,7 @@ class TimeLib extends CakeTime {
 	 * @return bool True if datetime is not today AND is in the future
 	 */
 	public static function isNotTodayAndInTheFuture($dateString, $timezone = null) {
-		$date = self::fromString($dateString, $timezone);
+		$date = static::fromString($dateString, $timezone);
 		return date(FORMAT_DB_DATE, $date) > date(FORMAT_DB_DATE, time());
 	}
 
@@ -967,7 +967,7 @@ class TimeLib extends CakeTime {
 	 * @return bool True if datetime is not today AND is in the future
 	 */
 	public static function isInTheFuture($dateString, $timezone = null) {
-		$date = self::fromString($dateString, $timezone);
+		$date = static::fromString($dateString, $timezone);
 		return date(FORMAT_DB_DATETIME, $date) > date(FORMAT_DB_DATETIME, time());
 	}
 
@@ -1015,15 +1015,15 @@ class TimeLib extends CakeTime {
 		}
 		if ($explode) {
 			for ($i = 0; $i < count($explode); $i++) {
-				$explode[$i] = self::pad($explode[$i]);
+				$explode[$i] = static::pad($explode[$i]);
 			}
-			$explode[0] = self::pad($explode[0], 4, '20');
+			$explode[0] = static::pad($explode[0], 4, '20');
 
 			if (count($explode) === 3) {
 				return implode('-', $explode) . ' ' . ($type === 'end' ? '23:59:59' : '00:00:00');
 			}
 			if (count($explode) === 2) {
-				return implode('-', $explode) . '-' . ($type === 'end' ? self::daysInMonth($explode[0], $explode[1]) : '01') . ' ' . ($type === 'end' ? '23:59:59' : '00:00:00');
+				return implode('-', $explode) . '-' . ($type === 'end' ? static::daysInMonth($explode[0], $explode[1]) : '01') . ' ' . ($type === 'end' ? '23:59:59' : '00:00:00');
 			}
 			return $explode[0] . '-' . ($type === 'end' ? '12' : '01') . '-' . ($type === 'end' ? '31' : '01') . ' ' . ($type === 'end' ? '23:59:59' : '00:00:00');
 		}
@@ -1050,8 +1050,8 @@ class TimeLib extends CakeTime {
 		$min = $filters[0];
 		$max = $filters[1];
 
-		$min = self::parseLocalizedDate($min);
-		$max = self::parseLocalizedDate($max, null, 'end');
+		$min = static::parseLocalizedDate($min);
+		$max = static::parseLocalizedDate($max, null, 'end');
 
 		return array($min, $max);
 	}
@@ -1065,8 +1065,8 @@ class TimeLib extends CakeTime {
 	 * @return string query SQL Query
 	 */
 	public static function periodAsSql($string, $fieldName, $options = array()) {
-		$period = self::period($string, $options);
-		return self::daysAsSql($period[0], $period[1], $fieldName);
+		$period = static::period($string, $options);
+		return static::daysAsSql($period[0], $period[1], $fieldName);
 	}
 
 	/**
@@ -1127,10 +1127,10 @@ class TimeLib extends CakeTime {
 		$duration = array_pop($parts);
 
 		if (strpos($duration, '.') !== false && in_array('.', $allowed)) {
-			$duration = self::decimalToStandardTime($duration, 2, ':');
+			$duration = static::decimalToStandardTime($duration, 2, ':');
 		} elseif (strpos($duration, ',') !== false && in_array(',', $allowed)) {
 			$duration = str_replace(',', '.', $duration);
-			$duration = self::decimalToStandardTime($duration, 2, ':');
+			$duration = static::decimalToStandardTime($duration, 2, ':');
 		}
 
 		// now there is only the time schema left...
@@ -1200,7 +1200,7 @@ class TimeLib extends CakeTime {
 
 		$minutes = $duration % HOUR;
 		$hours = ($duration - $minutes) / HOUR;
-		$res = (int)$hours . ':' . self::pad(intval($minutes / MINUTE));
+		$res = (int)$hours . ':' . static::pad(intval($minutes / MINUTE));
 		if (strpos($mode, 'SS') !== false) {
 			//TODO
 		}
@@ -1222,7 +1222,7 @@ class TimeLib extends CakeTime {
 		$hours = $duration / HOUR;
 
 		$seconds = $minutes % MINUTE;
-		return self::pad($hours) . ':' . self::pad($minutes / MINUTE) . ':' . self::pad($seconds / SECOND);
+		return static::pad($hours) . ':' . static::pad($minutes / MINUTE) . ':' . static::pad($seconds / SECOND);
 	}
 
 	/**

+ 12 - 12
Lib/Utility/Utility.php

@@ -185,11 +185,11 @@ class Utility {
 		if ($url === '' || $url === 'http://' || $url === 'http://www' || $url === 'http://www.') {
 			$url = '';
 		} else {
-			$url = self::autoPrefixUrl($url, 'http://');
+			$url = static::autoPrefixUrl($url, 'http://');
 		}
 
 		if ($headerRedirect && !empty($url)) {
-			$headers = self::getHeaderFromUrl($url);
+			$headers = static::getHeaderFromUrl($url);
 			if ($headers !== false) {
 				$headerString = implode("\n", $headers);
 
@@ -224,7 +224,7 @@ class Utility {
 		if (!preg_match($pattern, $file)) {
 			return file_exists($file);
 		}
-		return self::urlExists($file);
+		return static::urlExists($file);
 	}
 
 	/**
@@ -518,13 +518,13 @@ class Utility {
 			$depth = array($count);
 			if (is_array($array) && reset($array) !== false) {
 				foreach ($array as $value) {
-					$depth[] = self::countDim($value, true, $count + 1);
+					$depth[] = static::countDim($value, true, $count + 1);
 				}
 			}
 			$return = max($depth);
 		} else {
 			if (is_array(reset($array))) {
-				$return = self::countDim(reset($array)) + 1;
+				$return = static::countDim(reset($array)) + 1;
 			} else {
 				$return = 1;
 			}
@@ -633,7 +633,7 @@ class Utility {
 	 */
 	public static function arrayFlatten($array, $preserveKeys = false) {
 		if ($preserveKeys) {
-			return self::_arrayFlatten($array);
+			return static::_arrayFlatten($array);
 		}
 		if (!$array) {
 			return array();
@@ -641,7 +641,7 @@ class Utility {
 		$result = array();
 		foreach ($array as $key => $value) {
 			if (is_array($value)) {
-				$result = array_merge($result, self::arrayFlatten($value));
+				$result = array_merge($result, static::arrayFlatten($value));
 			} else {
 				$result[$key] = $value;
 			}
@@ -667,7 +667,7 @@ class Utility {
 		}
 		foreach ($a as $k => $v) {
 			if (is_array($v)) {
-				$f = self::_arrayFlatten($v, $f);
+				$f = static::_arrayFlatten($v, $f);
 			} else {
 				$f[$k] = $v;
 			}
@@ -706,7 +706,7 @@ class Utility {
 	 * @return void
 	 */
 	public static function startClock() {
-		self::$_counterStartTime = self::microtime();
+		static::$_counterStartTime = static::microtime();
 	}
 
 	/**
@@ -715,11 +715,11 @@ class Utility {
 	 * @return float
 	 */
 	public static function returnElapsedTime($precision = 8, $restartClock = false) {
-		$startTime = self::$_counterStartTime;
+		$startTime = static::$_counterStartTime;
 		if ($restartClock) {
-			self::startClock();
+			static::startClock();
 		}
-		return self::calcElapsedTime($startTime, self::microtime(), $precision);
+		return static::calcElapsedTime($startTime, static::microtime(), $precision);
 	}
 
 	/**

+ 1 - 1
Lib/WeatherLib.php

@@ -142,7 +142,7 @@ class WeatherLib {
 			$params[] = $key . '=' . $option;
 		}
 		$params = (!empty($params) ? '?' : '') . implode('&', $params);
-		$domain = $this->settings['free'] ? self::API_URL_FREE : self::API_URL;
+		$domain = $this->settings['free'] ? static::API_URL_FREE : static::API_URL;
 		return $domain . $url . $params;
 	}
 

+ 1 - 1
Test/Case/Controller/Component/Auth/DirectAuthenticateTest.php

@@ -167,7 +167,7 @@ class DirectAuthenticateTest extends CakeTestCase {
 			'username' => 'gwoo',
 			'created' => '2007-03-17 01:16:23'
 		);
-		$this->assertEquals(self::date(), $result['updated']);
+		$this->assertEquals(static::date(), $result['updated']);
 		unset($result['updated']);
 		$this->assertEquals($expected, $result);
 		CakePlugin::unload();

+ 4 - 4
Test/Case/Model/Behavior/BitmaskedBehaviorTest.php

@@ -188,10 +188,10 @@ class BitmaskedComment extends CakeTestModel {
 
 	public static function statuses($value = null) {
 		$options = array(
-			self::STATUS_ACTIVE => __('Active'),
-			self::STATUS_PUBLISHED => __('Published'),
-			self::STATUS_APPROVED => __('Approved'),
-			self::STATUS_FLAGGED => __('Flagged'),
+			static::STATUS_ACTIVE => __('Active'),
+			static::STATUS_PUBLISHED => __('Published'),
+			static::STATUS_APPROVED => __('Approved'),
+			static::STATUS_FLAGGED => __('Flagged'),
 		);
 
 		return MyModel::enum($value, $options);

+ 3 - 3
Test/Case/Model/Behavior/SluggedBehaviorTest.php

@@ -714,7 +714,7 @@ class SluggedBehaviorTest extends CakeTestCase {
 		$this->Model->Behaviors->unload('Slugged');
 		$this->Model->Behaviors->load('Tools.Slugged', array('mode' => 'ascii'));
 
-		foreach (self::$maps as $language => $map) {
+		foreach (static::$maps as $language => $map) {
 			foreach ($map as $from => $to) {
 				$result = $this->Model->slug($from, false);
 				$this->assertEquals($to, $result, $from . ' (' . $language . ') should become ' . $to . ' - but became ' . $result);
@@ -730,7 +730,7 @@ class SluggedBehaviorTest extends CakeTestCase {
 	 */
 	public function testCustomCharsAdditional() {
 		$rules = array();
-		foreach (self::$customMaps as $language => $map) {
+		foreach (static::$customMaps as $language => $map) {
 			foreach ($map as $from => $to) {
 				$rules['/' . $from . '/'] = $to;
 			}
@@ -741,7 +741,7 @@ class SluggedBehaviorTest extends CakeTestCase {
 		$this->Model->Behaviors->unload('Slugged');
 		$this->Model->Behaviors->load('Tools.Slugged', array('mode' => 'ascii'));
 
-		foreach (self::$customMaps as $language => $map) {
+		foreach (static::$customMaps as $language => $map) {
 			foreach ($map as $from => $to) {
 				$result = $this->Model->slug($from, false);
 				$this->assertEquals($to, $result, $from . ' (' . $language . ') should become ' . $to . ' - but became ' . $result);

+ 6 - 6
TestSuite/MyCakeTestCase.php

@@ -14,7 +14,7 @@ abstract class MyCakeTestCase extends CakeTestCase {
 	protected static function assertNotWithinMargin($result, $expected, $margin, $message = '') {
 		$upper = $result + $margin;
 		$lower = $result - $margin;
-		return self::assertFalse((($expected <= $upper) && ($expected >= $lower)), $message);
+		return static::assertFalse((($expected <= $upper) && ($expected >= $lower)), $message);
 	}
 
 /*** Helper Functions **/
@@ -102,13 +102,13 @@ abstract class MyCakeTestCase extends CakeTestCase {
 	}
 
 	protected function _startClock($precision = 8) {
-		self::$_startTime = self::_microtime();
+		static::$_startTime = static::_microtime();
 	}
 
 	protected function _elapsedTime($precision = 8, $restart = false) {
-		$elapsed = self::_microtime() - self::$_startTime;
+		$elapsed = static::_microtime() - static::$_startTime;
 		if ($restart) {
-			self::_startClock();
+			static::_startClock();
 		}
 		return round($elapsed, $precision);
 	}
@@ -120,7 +120,7 @@ abstract class MyCakeTestCase extends CakeTestCase {
 	 */
 	protected function _printElapsedTime($time = null, $precision = 8, $secs = false) {
 		if ($time === null) {
-			$time = self::_elapsedTime($precision);
+			$time = static::_elapsedTime($precision);
 		}
 		if ($secs) {
 			$unit = 's';
@@ -147,7 +147,7 @@ abstract class MyCakeTestCase extends CakeTestCase {
 		if (empty($_SERVER['HTTP_HOST']) || !isset($_GET['show_passes']) || !$_GET['show_passes']) {
 			return false;
 		}
-		echo self::_title($expectation, $title);
+		echo static::_title($expectation, $title);
 	}
 
 	protected function _printResults($expected, $is, $pre = null, $status = false) {

+ 2 - 2
View/Helper/FlattrHelper.php

@@ -69,7 +69,7 @@ class FlattrHelper extends AppHelper {
 	var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
 	s.type = 'text/javascript';
 	s.async = true;
-	s.src = '" . self::API_URL . "js/0.6/load.js?mode=" . $mode . "';
+	s.src = '" . static::API_URL . "js/0.6/load.js?mode=" . $mode . "';
 	t.parentNode.insertBefore(s, t);
 })();";
 		$code = $this->Html->link('', $this->Html->url($url, true), $linkOptions);
@@ -128,7 +128,7 @@ class FlattrHelper extends AppHelper {
 			$vars .= "var flattr_btn = 'compact';\r\n";
 		}
 		$code = $this->Html->scriptBlock($vars, array('inline' => true));
-		$code .= $this->Html->script(self::API_URL . 'button/load.js', array('inline' => true));
+		$code .= $this->Html->script(static::API_URL . 'button/load.js', array('inline' => true));
 		return $code;
 	}
 

+ 3 - 3
View/Helper/FormatHelper.php

@@ -185,9 +185,9 @@ class FormatHelper extends TextHelper {
 	 */
 	public function genderIcon($value = null) {
 		$value = (int)$value;
-		if ($value == self::GENDER_FEMALE) {
+		if ($value == static::GENDER_FEMALE) {
 			$icon =	$this->icon('genderFemale', null, null, null, array('class' => 'gender'));
-		} elseif ($value == self::GENDER_MALE) {
+		} elseif ($value == static::GENDER_MALE) {
 			$icon =	$this->icon('genderMale', null, null, null, array('class' => 'gender'));
 		} else {
 			$icon =	$this->icon('genderUnknown', null, null, null, array('class' => 'gender'));
@@ -1273,7 +1273,7 @@ class FormatHelper extends TextHelper {
 
 				if ($options['recursive'] && is_array($cell) && !empty($cell)) {
 					// Recursive mode
-					$table .= "\n" . self::array2table($cell, $options) . "\n";
+					$table .= "\n" . static::array2table($cell, $options) . "\n";
 				} else {
 					$table .= (!is_array($cell) && strlen($cell) > 0) ? ($options['escape'] ? h($cell) : $cell) : $options['null'];
 				}

+ 47 - 47
View/Helper/GoogleMapV3Helper.php

@@ -271,7 +271,7 @@ class GoogleMapV3Helper extends AppHelper {
 	 * @return string Full URL
 	 */
 	public function apiUrl($sensor = false, $api = null, $language = null, $append = null) {
-		$url = $this->_protocol() . self::API;
+		$url = $this->_protocol() . static::API;
 
 		$url .= 'sensor=' . ($sensor ? 'true' : 'false');
 		if (!empty($language)) {
@@ -303,7 +303,7 @@ class GoogleMapV3Helper extends AppHelper {
 	 * @return string currentMapObject
 	 */
 	public function name() {
-		return 'map' . self::$mapCount;
+		return 'map' . static::$mapCount;
 	}
 
 	/**
@@ -320,7 +320,7 @@ class GoogleMapV3Helper extends AppHelper {
 	 * @return void
 	 */
 	public function reset($full = true) {
-		self::$markerCount = self::$infoWindowCount = 0;
+		static::$markerCount = static::$infoWindowCount = 0;
 		$this->markers = $this->infoWindows = array();
 		if ($full) {
 			$this->settings = $this->_defaultOptions;
@@ -403,9 +403,9 @@ class GoogleMapV3Helper extends AppHelper {
 			var myOptions = " . $this->_mapOptions() . ";
 
 			// deprecated
-			gMarkers" . self::$mapCount . " = new Array();
-			gInfoWindows" . self::$mapCount . " = new Array();
-			gWindowContents" . self::$mapCount . " = new Array();
+			gMarkers" . static::$mapCount . " = new Array();
+			gInfoWindows" . static::$mapCount . " = new Array();
+			gWindowContents" . static::$mapCount . " = new Array();
 		";
 
 		#rename "map_canvas" to "map_canvas1", ... if multiple maps on one page
@@ -481,7 +481,7 @@ class GoogleMapV3Helper extends AppHelper {
 		if (isset($options['icon'])) {
 			$params['icon'] = $options['icon'];
 			if (is_int($params['icon'])) {
-				$params['icon'] = 'gIcons' . self::$mapCount . '[' . $params['icon'] . ']';
+				$params['icon'] = 'gIcons' . static::$mapCount . '[' . $params['icon'] . ']';
 			} else {
 				$params['icon'] = json_encode($params['icon']);
 			}
@@ -489,7 +489,7 @@ class GoogleMapV3Helper extends AppHelper {
 		if (isset($options['shadow'])) {
 			$params['shadow'] = $options['shadow'];
 			if (is_int($params['shadow'])) {
-				$params['shadow'] = 'gIcons' . self::$mapCount . '[' . $params['shadow'] . ']';
+				$params['shadow'] = 'gIcons' . static::$mapCount . '[' . $params['shadow'] . ']';
 			} else {
 				$params['shadow'] = json_encode($params['shadow']);
 			}
@@ -513,12 +513,12 @@ function geocodeAddress(address) {
 	geocoder.geocode({'address': address}, function(results, status) {
 		if (status == google.maps.GeocoderStatus.OK) {
 
-			x" . self::$markerCount . " = new google.maps.Marker({
+			x" . static::$markerCount . " = new google.maps.Marker({
 				position: results[0].geometry.location,
 				" . $this->_toObjectParams($params, false, false) . "
 			});
-			gMarkers" . self::$mapCount . " .push(
-				x" . self::$markerCount . "
+			gMarkers" . static::$mapCount . " .push(
+				x" . static::$markerCount . "
 			);
 			return results[0].geometry.location;
 		} else {
@@ -536,12 +536,12 @@ function geocodeAddress(address) {
 		}
 
 		$marker = "
-			var x" . self::$markerCount . " = new google.maps.Marker({
+			var x" . static::$markerCount . " = new google.maps.Marker({
 				position: " . $position . ",
 				" . $this->_toObjectParams($params, false, false) . "
 			});
-			gMarkers" . self::$mapCount . " .push(
-				x" . self::$markerCount . "
+			gMarkers" . static::$mapCount . " .push(
+				x" . static::$markerCount . "
 			);
 		";
 		$this->map .= $marker;
@@ -553,7 +553,7 @@ function geocodeAddress(address) {
 		// Fill popup windows
 		if (!empty($options['content']) && $this->settings['infoWindow']['useMultiple']) {
 			$x = $this->addInfoWindow(array('content' => $options['content']));
-			$this->addEvent(self::$markerCount, $x, $options['open']);
+			$this->addEvent(static::$markerCount, $x, $options['open']);
 
 		} elseif (!empty($options['content'])) {
 			if (!isset($this->settings['marker']['infoWindow'])) {
@@ -562,10 +562,10 @@ function geocodeAddress(address) {
 
 			$x = $this->addInfoContent($options['content']);
 			$event = "
-			gInfoWindows" . self::$mapCount . "[" . $this->settings['marker']['infoWindow'] . "]. setContent(gWindowContents" . self::$mapCount . "[" . $x . "]);
-			gInfoWindows" . self::$mapCount . "[" . $this->settings['marker']['infoWindow'] . "].open(" . $this->name() . ", gMarkers" . self::$mapCount . "[" . $x . "]);
+			gInfoWindows" . static::$mapCount . "[" . $this->settings['marker']['infoWindow'] . "]. setContent(gWindowContents" . static::$mapCount . "[" . $x . "]);
+			gInfoWindows" . static::$mapCount . "[" . $this->settings['marker']['infoWindow'] . "].open(" . $this->name() . ", gMarkers" . static::$mapCount . "[" . $x . "]);
 			";
-			$this->addCustomEvent(self::$markerCount, $event);
+			$this->addCustomEvent(static::$markerCount, $event);
 
 			if (!empty($options['open'])) {
 				$this->addCustom($event);
@@ -574,10 +574,10 @@ function geocodeAddress(address) {
 
 		// Custom matching event?
 		if (isset($options['id'])) {
-			$this->matching[$options['id']] = self::$markerCount;
+			$this->matching[$options['id']] = static::$markerCount;
 		}
 
-		return self::$markerCount++;
+		return static::$markerCount++;
 	}
 
 	/**
@@ -632,14 +632,14 @@ function geocodeAddress(address) {
 	 * @return int Current marker counter
 	 */
 	public function addInfoContent($content) {
-		$this->infoContents[self::$markerCount] = $this->escapeString($content);
+		$this->infoContents[static::$markerCount] = $this->escapeString($content);
 		$event = "
-			gWindowContents" . self::$mapCount . ".push(" . $this->escapeString($content) . ");
+			gWindowContents" . static::$mapCount . ".push(" . $this->escapeString($content) . ");
 			";
 		$this->addCustom($event);
 
 		//TODO: own count?
-		return self::$markerCount;
+		return static::$markerCount;
 	}
 
 	public $setIcons = array(
@@ -782,9 +782,9 @@ var iconShape = {
 	new google.maps.Point(' . $options['origin']['width'] . ', ' . $options['origin']['height'] . '),
 	new google.maps.Point(' . $options['anchor']['width'] . ', ' . $options['anchor']['height'] . ')
 )';
-		$this->icons[self::$iconCount] = $icon;
-		$this->_iconRemember[self::$iconCount] = array('url' => $url, 'options' => $options, 'id' => self::$iconCount);
-		return self::$iconCount++;
+		$this->icons[static::$iconCount] = $icon;
+		$this->_iconRemember[static::$iconCount] = array('url' => $url, 'options' => $options, 'id' => static::$iconCount);
+		return static::$iconCount++;
 	}
 
 	/**
@@ -805,7 +805,7 @@ var iconShape = {
 		}
 
 		$windows = "
-			gInfoWindows" . self::$mapCount . ".push(new google.maps.InfoWindow({
+			gInfoWindows" . static::$mapCount . ".push(new google.maps.InfoWindow({
 					position: {$position},
 					content: " . $this->escapeString($options['content']) . ",
 					maxWidth: {$options['maxWidth']},
@@ -814,7 +814,7 @@ var iconShape = {
 			}));
 			";
 		$this->map .= $windows;
-		return self::$infoWindowCount++;
+		return static::$infoWindowCount++;
 	}
 
 	/**
@@ -827,13 +827,13 @@ var iconShape = {
 	 */
 	public function addEvent($marker, $infoWindow, $open = false) {
 		$this->map .= "
-			google.maps.event.addListener(gMarkers" . self::$mapCount . "[{$marker}], 'click', function() {
-				gInfoWindows" . self::$mapCount . "[$infoWindow].open(" . $this->name() . ", this);
+			google.maps.event.addListener(gMarkers" . static::$mapCount . "[{$marker}], 'click', function() {
+				gInfoWindows" . static::$mapCount . "[$infoWindow].open(" . $this->name() . ", this);
 			});
 		";
 		if ($open) {
-			$event = 'gInfoWindows' . self::$mapCount . "[$infoWindow].open(" . $this->name() .
-				", gMarkers" . self::$mapCount . "[" . $marker . "]);";
+			$event = 'gInfoWindows' . static::$mapCount . "[$infoWindow].open(" . $this->name() .
+				", gMarkers" . static::$mapCount . "[" . $marker . "]);";
 			$this->addCustom($event);
 		}
 	}
@@ -847,7 +847,7 @@ var iconShape = {
 	 */
 	public function addCustomEvent($marker, $event) {
 		$this->map .= "
-			google.maps.event.addListener(gMarkers" . self::$mapCount . "[{$marker}], 'click', function() {
+			google.maps.event.addListener(gMarkers" . static::$mapCount . "[{$marker}], 'click', function() {
 				$event
 			});
 		";
@@ -883,7 +883,7 @@ var iconShape = {
 	 * @return void
 	 */
 	public function addDirections($from, $to, $options = array()) {
-		$id = 'd' . self::$markerCount++;
+		$id = 'd' . static::$markerCount++;
 		$defaults = $this->settings['directions'];
 		$options += $defaults;
 		$travelMode = $this->travelModes[$options['travelMode']];
@@ -957,7 +957,7 @@ var iconShape = {
 		$defaults = $this->settings['polyline'];
 		$options += $defaults;
 
-		$id = 'p' . self::$markerCount++;
+		$id = 'p' . static::$markerCount++;
 
 		$polyline = "var start = $from;";
 		$polyline .= "var end = $to;";
@@ -984,7 +984,7 @@ var iconShape = {
 	 */
 	public function setContentInfoWindow($con, $index) {
 		$this->map .= "
-			gInfoWindows" . self::$mapCount . "[$index]. setContent(" . $this->escapeString($con) . ");";
+			gInfoWindows" . static::$mapCount . "[$index]. setContent(" . $this->escapeString($con) . ");";
 	}
 
 	/**
@@ -1020,7 +1020,7 @@ var iconShape = {
 	 */
 	public function finalize($return = false) {
 		$script = $this->_arrayToObject('matching', $this->matching, false, true) . '
-		' . $this->_arrayToObject('gIcons' . self::$mapCount, $this->icons, false, false) . '
+		' . $this->_arrayToObject('gIcons' . static::$mapCount, $this->icons, false, false) . '
 
 	jQuery(document).ready(function() {
 		';
@@ -1040,7 +1040,7 @@ var iconShape = {
 		$script .= '
 
 	});';
-		self::$mapCount++;
+		static::$mapCount++;
 		if ($return) {
 			return $script;
 		}
@@ -1125,7 +1125,7 @@ var iconShape = {
 	protected function _autoCenter() {
 		return '
 		var bounds = new google.maps.LatLngBounds();
-		$.each(gMarkers' . self::$mapCount . ',function (index, marker) { bounds.extend(marker.position);});
+		$.each(gMarkers' . static::$mapCount . ',function (index, marker) { bounds.extend(marker.position);});
 		' . $this->name() . ' .fitBounds(bounds);
 		';
 	}
@@ -1294,7 +1294,7 @@ var iconShape = {
 	 * @return string urlOfImage: http://...
 	 */
 	public function staticMapUrl($options = array()) {
-		$map = $this->_protocol() . self::STATIC_API;
+		$map = $this->_protocol() . static::STATIC_API;
 		/*
 		$params = array(
 			'sensor' => 'false',
@@ -1600,12 +1600,12 @@ http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/
 	 */
 	public function setManager() {
 		$js .= '
-		var mgr' . self::$mapCount . ' = new MarkerManager(' . $this->name() . ');
+		var mgr' . static::$mapCount . ' = new MarkerManager(' . $this->name() . ');
 		';
 	}
 
 	public function addManagerMarker($marker, $options) {
-		$js = 'mgr' . self::$mapCount . ' .addMarker(' . $marker . ');';
+		$js = 'mgr' . static::$mapCount . ' .addMarker(' . $marker . ');';
 	}
 
 	/**
@@ -1617,23 +1617,23 @@ http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/
 	 * @return void
 	 */
 	public function setCluster($options) {
-		$js = self::$flusterScript;
+		$js = static::$flusterScript;
 		$js .= '
-		var fluster' . self::$mapCount . ' = new Fluster2(' . $this->name() . ');
+		var fluster' . static::$mapCount . ' = new Fluster2(' . $this->name() . ');
 		';
 
 		// styles
-		'fluster' . self::$mapCount . '.styles = {}';
+		'fluster' . static::$mapCount . '.styles = {}';
 
 		$this->map .= $js;
 	}
 
 	public function addClusterMarker($marker, $options) {
-		$js = 'fluster' . self::$mapCount . '.addMarker(' . $marker . ');';
+		$js = 'fluster' . static::$mapCount . '.addMarker(' . $marker . ');';
 	}
 
 	public function initCluster() {
-		$this->map .= 'fluster' . self::$mapCount . '.initialize();';
+		$this->map .= 'fluster' . static::$mapCount . '.initialize();';
 	}
 
 	public static $flusterScript = '

+ 2 - 2
View/Helper/QrCodeHelper.php

@@ -248,7 +248,7 @@ class QrCodeHelper extends AppHelper {
 			//TODO
 		}
 		$value = (int)$value;
-		if ($value >= self::MIN_SIZE && $value <= self::MAX_SIZE) {
+		if ($value >= static::MIN_SIZE && $value <= static::MAX_SIZE) {
 			$this->options['chs'] = $value . 'x' . $value;
 			return true;
 		}
@@ -281,7 +281,7 @@ class QrCodeHelper extends AppHelper {
 	 * @return void
 	 */
 	public function reset() {
-		$this->setSize(self::DEFAULT_SIZE);
+		$this->setSize(static::DEFAULT_SIZE);
 		//$this->setLevel(QS_CODE_DEFAULT_LEVEL);
 		$this->options['chld'] = '';
 		$this->options['choe'] = Configure::read('App.encoding');

+ 1 - 1
View/Helper/TextExtHelper.php

@@ -267,7 +267,7 @@ class TextExtHelper extends TextHelper {
 	public static function prepareLinkName($link, $options = array()) {
 		// strip protocol if desired (default)
 		if (!isset($options['stripProtocol']) || $options['stripProtocol'] !== false) {
-			$link = self::stripProtocol($link);
+			$link = static::stripProtocol($link);
 		}
 		if (!isset($options['maxLength'])) {
 			$options['maxLength'] = 50; # should be long enough for most cases