euromark 12 years ago
parent
commit
c1f5f12d45
51 changed files with 204 additions and 180 deletions
  1. 4 4
      Config/bootstrap.php
  2. 4 4
      Console/Command/CcShell.php
  3. 1 1
      Console/Command/CodeShell.php
  4. 23 23
      Console/Command/CopyShell.php
  5. 4 4
      Console/Command/IndentShell.php
  6. 3 3
      Console/Command/IndexShell.php
  7. 2 2
      Console/Command/PhpTagShell.php
  8. 2 2
      Console/Command/WhitespaceShell.php
  9. 2 2
      Controller/Component/Auth/TinyAuthorize.php
  10. 7 7
      Controller/Component/AuthExtComponent.php
  11. 1 1
      Controller/Component/AutoLoginComponent.php
  12. 1 1
      Controller/Component/CalendarComponent.php
  13. 2 2
      Lib/CaptchaLib.php
  14. 2 2
      Lib/CurrencyBitcoinLib.php
  15. 1 1
      Lib/DiffLib.php
  16. 13 13
      Lib/GeocodeLib.php
  17. 1 1
      Lib/GooglLib.php
  18. 1 1
      Lib/HttpSocketLib.php
  19. 1 1
      Lib/ImapLib.php
  20. 3 3
      Lib/Routing/UrlCacheManager.php
  21. 1 1
      Lib/Utility/FileLib.php
  22. 1 1
      Lib/Utility/TextLib.php
  23. 7 7
      Lib/Utility/TimeLib.php
  24. 34 10
      Model/Behavior/CaptchaBehavior.php
  25. 3 3
      Test/Case/Controller/Component/CommonComponentTest.php
  26. 4 4
      Test/Case/Lib/EmailLibTest.php
  27. 3 3
      Test/Case/Lib/GeocodeLibTest.php
  28. 1 1
      Test/Case/Lib/HazardLibTest.php
  29. 3 3
      Test/Case/Lib/Misc/ZodiacLibTest.php
  30. 1 1
      Test/Case/Lib/RandomLibTest.php
  31. 1 1
      Test/Case/Lib/Utility/StrTest.php
  32. 11 11
      Test/Case/Lib/Utility/TimeLibTest.php
  33. 5 5
      Test/Case/Model/Behavior/BitmaskedBehaviorTest.php
  34. 2 2
      Test/Case/Model/Behavior/DecimalInputBehaviorTest.php
  35. 1 1
      Test/Case/Model/Behavior/GeocoderBehaviorTest.php
  36. 1 1
      Test/Case/Model/Behavior/JsonableBehaviorTest.php
  37. 2 2
      Test/Case/Model/Behavior/NumberFormatBehaviorTest.php
  38. 1 1
      Test/Case/Model/MyModelTest.php
  39. 2 2
      Test/Case/View/Helper/DatetimeHelperTest.php
  40. 1 1
      Test/Case/View/Helper/FormatHelperTest.php
  41. 2 2
      Test/Case/View/Helper/TextExtHelperTest.php
  42. 2 2
      Vendor/ical/ical.php
  43. 12 12
      View/Helper/CaptchaHelper.php
  44. 1 1
      View/Helper/CommonHelper.php
  45. 3 3
      View/Helper/DatetimeHelper.php
  46. 2 2
      View/Helper/FlattrHelper.php
  47. 2 2
      View/Helper/FormExtHelper.php
  48. 10 10
      View/Helper/FormatHelper.php
  49. 1 1
      View/Helper/MyHelper.php
  50. 2 2
      View/Helper/PhpThumbHelper.php
  51. 4 4
      View/Helper/TextExtHelper.php

+ 4 - 4
Config/bootstrap.php

@@ -124,7 +124,7 @@ if (!defined('FORMAT_NICE_YMDHMS')) {
 	define('FORMAT_NICE_HM', 'H:i');
 	define('FORMAT_NICE_HMS', 'H:i:s');
 
-	# localDate strings
+	// localDate strings
 	define('FORMAT_LOCAL_WA_YMDHMS', '%a, %d.%m.%Y, %H:%M:%S');
 	define('FORMAT_LOCAL_WF_YMDHMS', '%A, %d.%m.%Y, %H:%M:%S');
 	define('FORMAT_LOCAL_WA_YMDHM', '%a, %d.%m.%Y, %H:%M');
@@ -192,7 +192,7 @@ function slug($string, $separator = null, $low = true) {
 		'/¹/' => 1,
 		'/²/' => 2,
 		'/³/' => 3,
-		# new utf8 char "capitel ß" still missing here! '/.../' => 'SS', (TODO in 2009)
+		// new utf8 char "capitel ß" still missing here! '/.../' => 'SS', (TODO in 2009)
 		'/@/' => 'at',
 		'/æ/' => 'ae',
 		'/©/' => 'C',
@@ -200,7 +200,7 @@ function slug($string, $separator = null, $low = true) {
 		'/Ð/' => 'D',
 		'/€/' => 'EUR',
 		'/™/' => 'TM',
-		# more missing?
+		// more missing?
 	);
 
 	if ($separator === null) {
@@ -440,7 +440,7 @@ function pre($var, $collapsedAndExpandable = false, $options = array()) {
 		if ($options['jquery'] === true) {
 			$js = $jsJquery;
 		} elseif ($options['jquery'] !== false) {
-			# auto
+			// auto
 			$js = 'if (typeof jQuery == \'undefined\') {' . $js . '} else {' . $jsJquery . '}';
 		}
 		$res .= '<span onclick="' . $js . '" style="cursor: pointer; font-weight: bold">Debug</span>';

+ 4 - 4
Console/Command/CcShell.php

@@ -34,7 +34,7 @@ class CcShell extends AppShell {
 
 		$this->filename = APP . 'CodeCompletion.php';
 
-		# get classes
+		// get classes
 		$this->models();
 		$this->behaviors();
 
@@ -42,7 +42,7 @@ class CcShell extends AppShell {
 		$this->helpers();
 		$this->appFiles();
 
-		# write to file
+		// write to file
 		$this->_dump();
 
 		$this->out('...done');
@@ -289,7 +289,7 @@ class CcShell extends AppShell {
 	 * @return string
 	 */
 	protected function _prepHelpers($files) {
-		# new ones
+		// new ones
 		$res = '';
 
 		foreach ($files as $name) {
@@ -378,7 +378,7 @@ class CcShell extends AppShell {
 		}
 		$files = array_unique($files);
 
-		# no test/tmp files etc (helper.test.php or helper.OLD.php)
+		// no test/tmp files etc (helper.test.php or helper.OLD.php)
 		foreach ($files as $key => $file) {
 			if (strpos($file, '.') !== false || !preg_match('/^[\da-zA-Z_]+$/', $file)) {
 				unset($files[$key]);

+ 1 - 1
Console/Command/CodeShell.php

@@ -103,7 +103,7 @@ class CodeShell extends AppShell {
 			}
 		}
 
-		# try to find the best position to insert app uses statements
+		// try to find the best position to insert app uses statements
 		foreach ($fileContent as $row => $rowValue) {
 			preg_match('/^App\:\:uses\(/', $rowValue, $matches);
 			if ($matches) {

+ 23 - 23
Console/Command/CopyShell.php

@@ -74,7 +74,7 @@ class CopyShell extends AppShell {
 	public $type = self::TYPE_APP;
 
 	public $configName = null; # like "test" in "app_test" or "123" in "custom_123"
-	# both typeName and configName form the "site" name: typeName_configName
+	// both typeName and configName form the "site" name: typeName_configName
 
 	public $configCustom = array(); # configFile Content
 	public $configGlobal = array(); # configFile Content
@@ -118,7 +118,7 @@ class CopyShell extends AppShell {
 	public function run() {
 		$configContent = $this->getConfigs();
 
-		# change type if param given
+		// change type if param given
 		if (!empty($this->params['cake'])) { # cake core
 			$this->type = self::TYPE_CAKE;
 		} elseif (!empty($this->params['vendors'])) {
@@ -128,7 +128,7 @@ class CopyShell extends AppShell {
 		}
 		$this->out($this->types[$this->type]);
 
-		# find all mathing configs to this type
+		// find all mathing configs to this type
 		$configs = array();
 		if (!empty($configContent)) {
 			$configs = $this->getConfigNames($configContent);
@@ -184,7 +184,7 @@ class CopyShell extends AppShell {
 			}
 		}
 
-		# allow c, v and p only with app configs -> set params (by splitting app_configName into app and configName)
+		// allow c, v and p only with app configs -> set params (by splitting app_configName into app and configName)
 		if ($this->type > 3 || $this->type > 0 && $configName[0] !== 'app') {
 			return $this->error('"-c" (-cake), "-v" (-vendor) and "-p" (-plugin) only possible with app configs (not with custom ones)');
 		}
@@ -196,7 +196,7 @@ class CopyShell extends AppShell {
 
 		$hasLocalPath = false;
 		$this->out('');
-		# display global content (if available)
+		// display global content (if available)
 		if (!empty($this->configGlobal)) {
 			//$this->out('GLOBAL CONFIG:');
 			foreach ($this->configGlobal as $c) {
@@ -209,7 +209,7 @@ class CopyShell extends AppShell {
 			}
 		}
 
-		# display custom content
+		// display custom content
 		//$this->out('CUSTOM CONFIG (may override global config):');
 		$this->credentials = array();
 
@@ -224,7 +224,7 @@ class CopyShell extends AppShell {
 			}
 		}
 
-		# "vendor" or "cake"? -> change both localFolder and remoteFolder and add them to to the config array
+		// "vendor" or "cake"? -> change both localFolder and remoteFolder and add them to to the config array
 		if ($this->type > 0) {
 			$configuration = $this->getConfig($this->types[$this->type], $configContent);
 			//pr($configuration);
@@ -233,7 +233,7 @@ class CopyShell extends AppShell {
 				$folder = $this->matches[$this->type];
 			}
 
-			# working with different OS - best to always use / slash
+			// working with different OS - best to always use / slash
 			$this->localFolder = dirname($this->localFolder) . DS . $folder;
 			$this->localFolder = str_replace(DS, '/', $this->localFolder);
 
@@ -248,7 +248,7 @@ class CopyShell extends AppShell {
 		}
 		/*
 		if (!$hasLocalPath) {
-			# add the automatically found app folder as local path (default if no specific local path was given)
+			// add the automatically found app folder as local path (default if no specific local path was given)
 			$localPath = 'local '.TB.TB.$this->localFolder;
 			$this->out($localPath);
 			$configuration[] = $localPath;
@@ -259,11 +259,11 @@ class CopyShell extends AppShell {
 
 		$this->logFile = 'log_' . $this->types[$this->type] . '_' . $this->configName . '.txt';
 
-		# create tmp config file (adding the current APP path, of no local path was given inside the config file)
+		// create tmp config file (adding the current APP path, of no local path was given inside the config file)
 		$File = new File($this->tmpFolder . $this->tmpFile, true, 0770);
 		//$File->open();
 		$configTotal = array();
-		# extract "side xyz" from config, add global and then the rest of custom
+		// extract "side xyz" from config, add global and then the rest of custom
 		$configTotal[] = 'site ' . $this->types[$this->type] . '_' . $this->configName;//$configuration[0];
 		unset($configuration[0]);
 		foreach ($this->configGlobal as $c) {
@@ -302,7 +302,7 @@ class CopyShell extends AppShell {
 				return $this->error('Aborted!');
 			}
 			if (in_array($action, $allowedActions)) {
-				# synch can destroy local information that might not have been saved yet, so confirm
+				// synch can destroy local information that might not have been saved yet, so confirm
 				if ($action === 's') {
 					$continue = $this->in(__('Local files might be overridden... Continue?'), array('y', 'n'), 'n');
 					if (strtolower($continue) !== 'y' && strtolower($continue) !== 'yes') {
@@ -356,7 +356,7 @@ class CopyShell extends AppShell {
 
 		$this->_exec(false, $options);
 
-		# "Job Done"-Sound for the time comsuming actions (could be other sounds as well?)
+		// "Job Done"-Sound for the time comsuming actions (could be other sounds as well?)
 		if ($action === 'f' || $action === 'u') {
 			$this->_beep();
 		}
@@ -420,11 +420,11 @@ class CopyShell extends AppShell {
 		if ($this->params['silent']) {
 			return;
 		}
-		# seems to work only on windows systems - advantage: sound does not need to be on
+		// seems to work only on windows systems - advantage: sound does not need to be on
 		$File = new File($this->scriptFolder . 'files' . DS . 'beep.bat');
 		$sound = $File->read();
 		system($sound);
-		# seems to work on only on windows xp systems + where sound is on
+		// seems to work on only on windows xp systems + where sound is on
 		//$sound = 'sndrec32 /play /close "'.$this->scriptFolder.'files'.DS.'notify.wav';
 		//system($sound);
 		if (WINDOWS) {
@@ -438,7 +438,7 @@ class CopyShell extends AppShell {
 	 * @return boolean Success
 	 */
 	protected function _exec($silent = true, $options = array()) {
-		# make sure, folder exists
+		// make sure, folder exists
 		$Folder = new Folder($this->tmpFolder, true, 0770);
 
 		$f = (WINDOWS ? $this->sitecopyFolder : '') . 'sitecopy ';
@@ -480,7 +480,7 @@ class CopyShell extends AppShell {
 
 		$continue = $this->in(__('Show script help, too?'), array('y', 'n'), 'y');
 		if (strtolower($continue) === 'y' || strtolower($continue) === 'yes') {
-			# somehow does not work yet (inside cake console anyway...)
+			// somehow does not work yet (inside cake console anyway...)
 			$this->_exec(false, array('--help'));
 			$this->out('');
 			$this->_exec(false, array('--version'));
@@ -492,7 +492,7 @@ class CopyShell extends AppShell {
 	 * Read out config file and parse it to an array
 	 */
 	protected function getConfigs() {
-		# global file (may be present)
+		// global file (may be present)
 		$File = new File($this->localFolder . 'config' . DS . $this->configGlobalFile);
 		if ($File->exists()) {
 			$File->open('r');
@@ -511,7 +511,7 @@ class CopyShell extends AppShell {
 			}
 		}
 
-		# custom file (must be present)
+		// custom file (must be present)
 		$File = new File($this->localFolder . 'config' . DS . $this->configCustomFile);
 
 		if (!$File->exists()) {
@@ -519,7 +519,7 @@ class CopyShell extends AppShell {
 		}
 		$File->open('r');
 
-		# Read out configs
+		// Read out configs
 		$content = $File->read();
 		if (empty($content)) {
 			return array();
@@ -613,9 +613,9 @@ class CopyShell extends AppShell {
 			if (mb_strlen($c) > 6 && substr($c, 0, 5) === 'site ') {
 				$currentConfig = trim(str_replace('site ', '', $c));
 				if (!empty($currentConfig) && $currentConfig == $config) {
-					# start
+					// start
 					if (!$started) {
-						# prevent problems with 2 configs with the same alias (but shouldnt happen anyway)
+						// prevent problems with 2 configs with the same alias (but shouldnt happen anyway)
 						$currentConfig = null;
 					}
 					$started = true;
@@ -623,7 +623,7 @@ class CopyShell extends AppShell {
 			}
 
 			if ($started && !empty($currentConfig)) {
-				# done
+				// done
 				break;
 			}
 

+ 4 - 4
Console/Command/IndentShell.php

@@ -249,7 +249,7 @@ class IndentShell extends AppShell {
 				$newPiece = trim($newPiece, NL);
 				//$debug .= ''.stripos($newPiece, TB);
 
-				# detect tabs and whitespaces at the beginning
+				// detect tabs and whitespaces at the beginning
 				//while (($pieceOfString = mb_substr($newPiece, 0, 1)) === ' ' || ($pieceOfString = mb_substr($newPiece, 0, 1)) == TB) {
 				while ((stripos($newPiece, ' ')) === 0 || (stripos($newPiece, TB)) === 0) {
 					$pieceOfString = mb_substr($newPiece, 0, 1);
@@ -269,13 +269,13 @@ class IndentShell extends AppShell {
 				if ($pos >= 1) {
 					$changes = true;
 
-					# if only spaces and tabs, we might as well trim the line
+					// if only spaces and tabs, we might as well trim the line
 					//should be done
 
-					# now correct
+					// now correct
 					//$newPiece = mb_substr($piece, $pos + 1);
 
-					# clear single spaces
+					// clear single spaces
 					/*
 					if (mb_substr($newPiece, 0, 1) === ' ' && mb_substr($newPiece, 1, 1) !== '*') {
 						$newPiece = mb_substr($newPiece, 1);

+ 3 - 3
Console/Command/IndexShell.php

@@ -139,7 +139,7 @@ class IndexShell extends AppShell {
 				if ($details['type'] !== 'integer' && ($details['type'] !== 'string' || $details['length'] !== 36)) {
 					continue;
 				}
-				# right now ONLY for uuids
+				// right now ONLY for uuids
 				if ($details['type'] !== 'string') {
 					continue;
 				}
@@ -147,11 +147,11 @@ class IndexShell extends AppShell {
 				foreach ($indexInfo as $info) {
 					$column = $info['STATISTICS']['Column_name'];
 					$key = $info['STATISTICS']['Key_name'];
-					# dont override primary keys
+					// dont override primary keys
 					if ($column == $field && $key === 'PRIMARY') {
 						continue 2;
 					}
-					# already exists
+					// already exists
 					if ($column == $field && $key == $field) {
 						continue 2;
 					}

+ 2 - 2
Console/Command/PhpTagShell.php

@@ -14,7 +14,7 @@ class PhpTagShell extends AppShell {
 
 	public $autoCorrectAll = false;
 
-	# each report: [0] => found, [1] => corrected
+	// each report: [0] => found, [1] => corrected
 	public $report = array(
 		'leading' => array(0, 0),
 		'trailing' => array(0, 0)
@@ -111,7 +111,7 @@ class PhpTagShell extends AppShell {
 			}
 		}
 
-		# report
+		// report
 		$this->out('--------');
 		$this->out('found ' . $this->report['leading'][0] . ' leading, ' . $this->report['trailing'][0] . ' trailing ws / php tag');
 		$this->out('fixed ' . $this->report['leading'][1] . ' leading, ' . $this->report['trailing'][1] . ' trailing ws / php tag');

+ 2 - 2
Console/Command/WhitespaceShell.php

@@ -6,7 +6,7 @@ class WhitespaceShell extends AppShell {
 
 	public $autoCorrectAll = false;
 
-	# each report: [0] => found, [1] => corrected
+	// each report: [0] => found, [1] => corrected
 	public $report = array('leading' => array(0, 0), 'trailing' => array(0, 0));
 
 	/**
@@ -138,7 +138,7 @@ class WhitespaceShell extends AppShell {
 				$newline = "\n";
 			}
 
-			# add one new line at the end
+			// add one new line at the end
 			$content = trim($content) . $newline;
 			if ($content !== $store) {
 				file_put_contents($file, $content);

+ 2 - 2
Controller/Component/Auth/TinyAuthorize.php

@@ -100,13 +100,13 @@ class TinyAuthorize extends BaseAuthorize {
 		$plugin = Inflector::underscore($plugin);
 
 		if (!empty($this->settings['allowUser'])) {
-			# all user actions are accessable for logged in users
+			// all user actions are accessable for logged in users
 			if (mb_strpos($action, $this->settings['adminPrefix']) !== 0) {
 				return true;
 			}
 		}
 		if (!empty($this->settings['allowAdmin']) && !empty($this->settings['adminRole'])) {
-			# all admin actions are accessable for logged in admins
+			// all admin actions are accessable for logged in admins
 			if (mb_strpos($action, $this->settings['adminPrefix']) === 0) {
 				if (in_array((string)$this->settings['adminRole'], $roles)) {
 					return true;

+ 7 - 7
Controller/Component/AuthExtComponent.php

@@ -45,7 +45,7 @@ class AuthExtComponent extends AuthComponent {
 		'userModel' => CLASS_USER //TODO: allow plugin syntax
 	);
 
-	# field name in DB , if none is specified there will be no floodProtection
+	// field name in DB , if none is specified there will be no floodProtection
 	public $floodProtection = null;
 
 	/**
@@ -87,7 +87,7 @@ class AuthExtComponent extends AuthComponent {
 			return false;
 		}
 
-		# custom checks
+		// custom checks
 		if (isset($user['active'])) {
 			if (empty($user['active'])) {
 				$this->loginError = __('Account not active yet');
@@ -134,7 +134,7 @@ class AuthExtComponent extends AuthComponent {
 		}
 
 		if ($user) {
-			# update login counter
+			// update login counter
 			if (isset($user['logins'])) {
 				$user['logins'] = $user['logins'] + 1;
 				if (method_exists($Model, 'loginUpdate')) {
@@ -176,13 +176,13 @@ class AuthExtComponent extends AuthComponent {
 			return $user;
 		}
 
-		# roles
+		// roles
 		if (!empty($with)) {
 			list($plugin, $withModel) = pluginSplit($with);
 			if (!isset($this->{$withModel})) {
 				$this->{$withModel} = ClassRegistry::init($with);
 			}
-			# only for multi
+			// only for multi
 			if ($this->settings['multi'] || !isset($userArray['role_id'])) {
 				$parentModelAlias = $this->settings['parentModelAlias'];
 				$userArray[$parentModelAlias] = array(); # default: no roles!
@@ -191,7 +191,7 @@ class AuthExtComponent extends AuthComponent {
 					//$primaryRole = $this->user($this->fieldKey);
 					// retrieve associated role that are not the primary one
 
-					# MAYBE USEFUL FOR GUEST!!!
+					// MAYBE USEFUL FOR GUEST!!!
 					//$roles = set::extract('/'.$with.'['.$this->fieldKey.'!='.$primaryRole.']/'.$this->fieldKey, $roles);
 
 					// add the suplemental roles id under the Auth session key
@@ -223,7 +223,7 @@ class AuthExtComponent extends AuthComponent {
 		}
 
 		$methods = array_flip(array_map('strtolower', $controller->methods));
-		# fix: reverse camelCase first
+		// fix: reverse camelCase first
 		$action = strtolower(Inflector::underscore($controller->request->params['action']));
 
 		$isMissingAction = (

+ 1 - 1
Controller/Component/AutoLoginComponent.php

@@ -76,7 +76,7 @@ class AutoLoginComponent extends Component {
 		$defaultSettings = array_merge($this->_defaults, (array)Configure::read('AutoLogin'));
 		$settings = array_merge($defaultSettings, $settings);
 
-		# make sure an upgrade does reset all cookies stored to avoid conflicts
+		// make sure an upgrade does reset all cookies stored to avoid conflicts
 		$settings['cookieName'] = $settings['cookieName'] . str_replace('.', '', $this->version);
 		$this->settings = $settings;
 		parent::__construct($collection, $settings);

+ 1 - 1
Controller/Component/CalendarComponent.php

@@ -117,7 +117,7 @@ class CalendarComponent extends Component {
 			return 0;
 		}
 
-		# check on month days!
+		// check on month days!
 		return $string;
 
 		return 0;

+ 2 - 2
Lib/CaptchaLib.php

@@ -20,10 +20,10 @@ class CaptchaLib {
 		'salt' => '',
 	);
 
-	# what type of captcha
+	// what type of captcha
 	public static $types = array('passive', 'active', 'both');
 
-	# what method to use
+	// what method to use
 	public static $methods = array('hash', 'db', 'session');
 
 	/**

+ 2 - 2
Lib/CurrencyBitcoinLib.php

@@ -71,10 +71,10 @@ class CurrencyBitcoinLib {
 		$res = $this->{$options['api']}($options);
 
 		if ($res && isset($res['sell'])) {
-			# bitmarket
+			// bitmarket
 			$current = $res['sell'];
 		} elseif ($res && isset($res['ask'])) {
-			# bitcoincharts
+			// bitcoincharts
 			$current = $res['ask'];
 		}
 		if (isset($current)) {

+ 1 - 1
Lib/DiffLib.php

@@ -25,7 +25,7 @@ class DiffLib {
 	 */
 	public $engine = 'auto';
 
-	# xdiff needs external libs
+	// xdiff needs external libs
 	public $engines = array('auto', 'native', 'shell', 'xdiff');
 
 	/**

+ 13 - 13
Lib/GeocodeLib.php

@@ -40,7 +40,7 @@ class GeocodeLib {
 	const UNIT_INCHES = 'I';
 	const UNIT_MILES = 'M';
 
-	# First tries with curl, then cake, then php
+	// First tries with curl, then cake, then php
 	public $use = array(
 		'curl' => true,
 		'cake' => true,
@@ -69,7 +69,7 @@ class GeocodeLib {
 		'min_accuracy' => self::ACC_COUNTRY,
 		'allow_inconclusive' => true,
 		'expect' => array(), # see accuracyTypes for details
-		# static url params
+		// static url params
 		'output' => 'xml',
 		'host' => null, # results in maps.google.com - use if you wish to obtain the closest address
 	);
@@ -275,7 +275,7 @@ class GeocodeLib {
 
 			if ($status == self::CODE_SUCCESS) {
 
-				# validate
+				// validate
 				if (isset($xmlArray['result'][0]) && !$this->options['allow_inconclusive']) {
 					$this->setError(__('Inconclusive result (total of %s)', count($xmlArray['result'])));
 					$this->result = $xmlArray['result'];
@@ -297,7 +297,7 @@ class GeocodeLib {
 					return false;
 				}
 
-				# save Result
+				// save Result
 				if ($this->options['log']) {
 					CakeLog::write('geocode', __('Address \'%s\' has been geocoded', $latlng));
 				}
@@ -311,7 +311,7 @@ class GeocodeLib {
 				$count++;
 
 			} else {
-				# something went wrong
+				// something went wrong
 				$this->setError('Error ' . $status . (isset($this->statusCodes[$status]) ? ' (' . $this->statusCodes[$status] . ')' : ''));
 
 				if ($this->options['log']) {
@@ -354,7 +354,7 @@ class GeocodeLib {
 		$this->reset(false);
 		$this->setParams(array_merge($params, array('address' => $address)));
 		if ($this->options['allow_inconclusive']) {
-			# only host working with this setting?
+			// only host working with this setting?
 			//$this->options['host'] = self::DEFAULT_HOST;
 		}
 
@@ -413,7 +413,7 @@ class GeocodeLib {
 			$status = $xmlArray['status'];
 
 			if ($status == self::CODE_SUCCESS) {
-				# validate
+				// validate
 				if (isset($xmlArray['result'][0]) && !$this->options['allow_inconclusive']) {
 					$this->setError(__('Inconclusive result (total of %s)', count($xmlArray['result'])));
 					$this->result = $xmlArray['result'];
@@ -452,7 +452,7 @@ class GeocodeLib {
 					}
 				}
 
-				# save Result
+				// save Result
 				if ($this->options['log']) {
 					CakeLog::write('geocode', __('Address \'%s\' has been geocoded', $address));
 				}
@@ -466,7 +466,7 @@ class GeocodeLib {
 				$count++;
 			} else {
 
-				# something went wrong
+				// something went wrong
 				$this->setError('Error ' . $status . (isset($this->statusCodes[$status]) ? ' (' . $this->statusCodes[$status] . ')' : ''));
 
 				if ($this->options['log']) {
@@ -576,7 +576,7 @@ class GeocodeLib {
 			} elseif (isset($c['type'])) {
 				$type = $c['type'];
 			} else {
-				# error?
+				// error?
 				continue;
 			}
 			if (array_key_exists($type, $components)) {
@@ -644,7 +644,7 @@ class GeocodeLib {
 			$res['bounds'] = array('sw' => $record['geometry']['bounds']['southwest'], 'ne' => $record['geometry']['bounds']['northeast']);
 		}
 
-		# manuell corrections
+		// manuell corrections
 		$array = array(
 			'Berlin' => 'BE',
 		);
@@ -708,7 +708,7 @@ class GeocodeLib {
 		$res = 6371.04 * acos(sin($pointY['lat'])*sin($pointX['lat'])+cos($pointY['lat'])*cos($pointX['lat'])*cos($pointY['lng'] - $pointX['lng']));
 		*/
 
-		# seems to be the only working one (although slightly incorrect...)
+		// seems to be the only working one (although slightly incorrect...)
 		$res = 69.09 * rad2deg(acos(sin(deg2rad($pointX['lat'])) * sin(deg2rad($pointY['lat'])) + cos(deg2rad($pointX['lat'])) * cos(deg2rad($pointY['lat'])) * cos(deg2rad($pointX['lng'] - $pointY['lng']))));
 		if (isset($this->units[$unit])) {
 			$res *= $this->units[$unit];
@@ -781,7 +781,7 @@ class GeocodeLib {
 		//$scrambleVal *= (mt_rand(0,1) === 0 ? 1 : 2);
 		//$scrambleVal *= (float)(2^$level);
 
-		# TODO: + - by chance!!!
+		// TODO: + - by chance!!!
 		return $coord + $scrambleVal;
 	}
 

+ 1 - 1
Lib/GooglLib.php

@@ -90,7 +90,7 @@ class GooglLib {
 		curl_close($ch);
 		$array = json_decode($result, true);
 		if (empty($array['id'])) {
-			# throw error?
+			// throw error?
 			CakeLog::write('googl', $longURL . ' - ' . print_r($array, true));
 			return false;
 		}

+ 1 - 1
Lib/HttpSocketLib.php

@@ -94,7 +94,7 @@ class HttpSocketLib {
 		);
 		$options = array_merge($defaults, $options);
 
-		# cached?
+		// cached?
 		if ($options['cache']) {
 			$cacheName = md5($url);
 			$cacheConfig = $options['cache'] === true ? null : $options['cache'];

+ 1 - 1
Lib/ImapLib.php

@@ -232,7 +232,7 @@ class ImapLib {
 				$header = imap_headerinfo($this->stream, $i);
 				$msgNo = trim($header->Msgno);
 				foreach ($header as $id => $value) {
-					# fix to remove whitespaces
+					// fix to remove whitespaces
 
 					// Simple array
 					if (!is_array($value)) {

+ 3 - 3
Lib/Routing/UrlCacheManager.php

@@ -80,7 +80,7 @@ class UrlCacheManager {
 		}
 		self::$cache = Cache::read(self::$cacheKey, '_cake_core_');
 
-		# still old "prefix true/false" syntax?
+		// 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'));
@@ -114,9 +114,9 @@ class UrlCacheManager {
 		$keyUrl = $url;
 		if (is_array($keyUrl)) {
 			$keyUrl += self::$extras;
-			# prevent different hashs on different orders
+			// prevent different hashs on different orders
 			ksort($keyUrl, SORT_STRING);
-			# prevent different hashs on different types (int/string/bool)
+			// prevent different hashs on different types (int/string/bool)
 			foreach ($keyUrl as $key => $val) {
 				$keyUrl[$key] = (string) $val;
 			}

+ 1 - 1
Lib/Utility/FileLib.php

@@ -58,7 +58,7 @@ class FileLib extends File {
 			return false;
 		}
 
-		# php cannot handle delimiters with more than a single char
+		// php cannot handle delimiters with more than a single char
 		if (mb_strlen($delimiter) > 1) {
 			$count = 0;
 			while (!feof($this->handle)) {

+ 1 - 1
Lib/Utility/TextLib.php

@@ -224,7 +224,7 @@ class TextLib extends String {
 			$pieces = explode(' ', $text);
 			$pieces = array_unique($pieces);
 
-			# strip chars like . or ,
+			// strip chars like . or ,
 			foreach ($pieces as $key => $piece) {
 				if (empty($options['case_sensitive'])) {
 					$piece = mb_strtolower($piece);

+ 7 - 7
Lib/Utility/TimeLib.php

@@ -16,11 +16,11 @@ class TimeLib extends CakeTime {
 	 */
 	public static function hasDaylightSavingTime($timezone = null) {
 		$timezone = self::timezone($timezone);
-		# a date outside of DST
+		// a date outside of DST
 		$offset = $timezone->getOffset(new DateTime('@' . mktime(0, 0, 0, 2, 1, date('Y'))));
 		$offset = $offset / HOUR;
 
-		# a date inside of DST
+		// a date inside of DST
 		$offset2 = $timezone->getOffset(new DateTime('@' . mktime(0, 0, 0, 8, 1, date('Y'))));
 		$offset2 = $offset2 / HOUR;
 
@@ -374,7 +374,7 @@ class TimeLib extends CakeTime {
 			return true;
 		}
 		if ($year > 1582 && $year % 100 == 0) {
-			# if gregorian calendar (>1582), century not-divisible by 400 is not leap
+			// if gregorian calendar (>1582), century not-divisible by 400 is not leap
 			return false;
 		}
 		return true;
@@ -672,9 +672,9 @@ class TimeLib extends CakeTime {
 	 * @return mixed
 	 */
 	public static function convertTime($int, $from, $to, $options = array()) {
-		$accuracy = 0;	# 0 = only the "to"-element, 1..n = higher accurancy
-		$showZero = false;	# show only the non-zero elements
-		$returnArray = false;	# return as array instead of as string
+		$accuracy = 0;	// 0 = only the "to"-element, 1..n = higher accurancy
+		$showZero = false;	// show only the non-zero elements
+		$returnArray = false;	// return as array instead of as string
 		if (!empty($options)) {
 			if (isset($options['acc'])) {
 				$accuracy = (int)$options['acc'];
@@ -1251,7 +1251,7 @@ class TimeLib extends CakeTime {
 			$duration = self::decimalToStandardTime($duration, 2, ':');
 		}
 
-		# now there is only the time schema left...
+		// now there is only the time schema left...
 		$pieces = explode(':', $duration, 3);
 		$res = 0;
 		$hours = abs((int)$pieces[0]) * HOUR;

+ 34 - 10
Model/Behavior/CaptchaBehavior.php

@@ -1,7 +1,7 @@
 <?php
 
-define('CAPTCHA_MIN_TIME', 3); # seconds the form will need to be filled in by a human
-define('CAPTCHA_MAX_TIME', HOUR);	// seconds the form will need to be submitted in
+define('CAPTCHA_MIN_TIME', 3); // Seconds the form will need to be filled in by a human
+define('CAPTCHA_MAX_TIME', HOUR);	// Seconds the form will need to be submitted in
 
 App::uses('ModelBehavior', 'Model');
 App::uses('CaptchaLib', 'Tools.Lib');
@@ -19,7 +19,7 @@ class CaptchaBehavior extends ModelBehavior {
 	protected $defaults = array(
 		'minTime' => CAPTCHA_MIN_TIME,
 		'maxTime' => CAPTCHA_MAX_TIME,
-		'log' => false, # log errors
+		'log' => false, // Log errors
 		'hashType' => null,
 	);
 
@@ -27,18 +27,25 @@ class CaptchaBehavior extends ModelBehavior {
 
 	protected $internalError = '';
 
+	/**
+	 * CaptchaBehavior::setup()
+	 *
+	 * @param Model $Model
+	 * @param array $settings
+	 * @return void
+	 */
 	public function setup(Model $Model, $settings = array()) {
 		$defaults = array_merge(CaptchaLib::$defaults, $this->defaults);
 		$this->Model = $Model;
 
-		// bootstrap configs
+		// Bootstrap configs
 		$this->settings[$Model->alias] = $defaults;
 		$this->settings[$Model->alias] = array_merge($this->settings[$Model->alias], (array)Configure::read('Captcha'));
 		if (!empty($settings)) {
 			$this->settings[$Model->alias] = array_merge($this->settings[$Model->alias], $settings);
 		}
 
-		// local configs in specific action
+		// Local configs in specific action
 		if (!empty($settings['minTime'])) {
 			$this->settings[$Model->alias]['minTime'] = (int)$settings['minTime'];
 		}
@@ -50,6 +57,13 @@ class CaptchaBehavior extends ModelBehavior {
 		}
 	}
 
+	/**
+	 * CaptchaBehavior::beforeValidate()
+	 *
+	 * @param Model $Model
+	 * @param array $options
+	 * @return boolean Success
+	 */
 	public function beforeValidate(Model $Model, $options = array()) {
 		parent::beforeValidate($Model, $options);
 		if (!empty($this->Model->whitelist)) {
@@ -79,7 +93,9 @@ class CaptchaBehavior extends ModelBehavior {
 	}
 
 	/**
-	 * Return the current used field names to be passed in whitelist etc
+	 * Returns the current used field names to be passed in whitelist etc
+	 *
+	 * @return array
 	 */
 	public function fields() {
 		$list = array('captcha', 'captcha_hash', 'captcha_time');
@@ -93,7 +109,7 @@ class CaptchaBehavior extends ModelBehavior {
 	 * CaptchaBehavior::_validateDummyField()
 	 *
 	 * @param mixed $data
-	 * @return
+	 * @return boolean Success
 	 */
 	protected function _validateDummyField($data) {
 		$dummyField = $this->settings[$this->Model->alias]['dummyField'];
@@ -101,7 +117,7 @@ class CaptchaBehavior extends ModelBehavior {
 			return $this->_setError(__('Illegal call'));
 		}
 		if (!empty($data[$dummyField])) {
-			// dummy field not empty - SPAM!
+			// Dummy field not empty - SPAM!
 			return $this->_setError(__('Illegal content'), 'DummyField = \'' . $data[$dummyField] . '\'');
 		}
 		return true;
@@ -110,6 +126,8 @@ class CaptchaBehavior extends ModelBehavior {
 	/**
 	 * Flood protection by time
 	 * TODO: SESSION based one as alternative
+	 *
+	 * @return boolean Success
 	 */
 	protected function _validateCaptchaMinTime($data) {
 		if ($this->settings[$this->Model->alias]['minTime'] <= 0) {
@@ -127,7 +145,7 @@ class CaptchaBehavior extends ModelBehavior {
 	 * Validates maximum time
 	 *
 	 * @param array $data
-	 * @return boolean
+	 * @return boolean Success
 	 */
 	protected function _validateCaptchaMaxTime($data) {
 		if ($this->settings[$this->Model->alias]['maxTime'] <= 0) {
@@ -146,6 +164,8 @@ class CaptchaBehavior extends ModelBehavior {
 	 * Flood protection by false fields and math code
 	 * TODO: build in floodProtection (max Trials etc)
 	 * TODO: SESSION based one as alternative
+	 *
+	 * @return boolean Success
 	 */
 	protected function _validateCaptcha($data) {
 		if (!isset($data['captcha'])) {
@@ -173,6 +193,8 @@ class CaptchaBehavior extends ModelBehavior {
 
 	/**
 	 * Only necessary if there is more than one request per model
+	 *
+	 * @return void
 	 */
 	public function reset() {
 		$this->error = '';
@@ -180,6 +202,9 @@ class CaptchaBehavior extends ModelBehavior {
 
 	/**
 	 * Build and log error message
+	 * TODO: dont return boolean false
+	 *
+	 * @return boolean false
 	 */
 	protected function _setError($msg = null, $internalMsg = null) {
 		if (!empty($msg)) {
@@ -190,7 +215,6 @@ class CaptchaBehavior extends ModelBehavior {
 		}
 
 		$this->_logAttempt();
-		return false;
 	}
 
 	/**

+ 3 - 3
Test/Case/Controller/Component/CommonComponentTest.php

@@ -48,13 +48,13 @@ class CommonComponentTest extends CakeTestCase {
 		$this->Controller->Common->loadComponent('Test');
 		$this->assertTrue(isset($this->Controller->Test));
 
-		# with plugin
+		// with plugin
 		$this->Controller->Calendar = null;
 		$this->assertTrue(!isset($this->Controller->Calendar));
 		$this->Controller->Common->loadComponent('Tools.Calendar');
 		$this->assertTrue(isset($this->Controller->Calendar));
 
-		# with options
+		// with options
 		$this->Controller->Test = null;
 		$this->assertTrue(!isset($this->Controller->Test));
 		$this->Controller->Common->loadComponent(array('RequestHandler', 'Test' => array('x' => 'y')));
@@ -76,7 +76,7 @@ class CommonComponentTest extends CakeTestCase {
 		$res = $this->Controller->RandomLib->pwd(null, 10);
 		$this->assertTrue(!empty($res));
 
-		# with options
+		// with options
 		$this->assertTrue(!isset($this->Controller->TestLib));
 		$this->Controller->Common->loadLib(array('Tools.RandomLib', 'TestLib' => array('x' => 'y')));
 		$this->assertTrue(isset($this->Controller->TestLib));

+ 4 - 4
Test/Case/Lib/EmailLibTest.php

@@ -34,12 +34,12 @@ class EmailLibTest extends MyCakeTestCase {
 	 * @return void
 	 */
 	public function testSendDefault() {
-		# start
+		// start
 		$this->Email->to(Configure::read('Config.admin_email'), Configure::read('Config.admin_emailname'));
 		$this->Email->subject('Test Subject');
 
 		$res = $this->Email->send('xyz xyz');
-		# end
+		// end
 		if ($error = $this->Email->getError()) {
 			$this->out($error);
 		}
@@ -47,7 +47,7 @@ class EmailLibTest extends MyCakeTestCase {
 		$this->assertTrue($res);
 
 		$this->Email->resetAndSet();
-		# start
+		// start
 		$this->Email->to(Configure::read('Config.admin_email'), Configure::read('Config.admin_emailname'));
 		$this->Email->subject('Test Subject 2');
 		$this->Email->template('default', 'internal');
@@ -55,7 +55,7 @@ class EmailLibTest extends MyCakeTestCase {
 		$this->Email->addAttachments(array(APP . 'webroot' . DS . 'img' . DS . 'icons' . DS . 'edit.gif'));
 
 		$res = $this->Email->send('xyz');
-		# end
+		// end
 		if ($error = $this->Email->getError()) {
 			$this->out($error);
 		}

+ 3 - 3
Test/Case/Lib/GeocodeLibTest.php

@@ -110,12 +110,12 @@ class GeocodeLibTest extends MyCakeTestCase {
 	}
 
 	public function testSetOptions() {
-		# should be the default
+		// should be the default
 		$res = $this->Geocode->url();
 		$this->assertTextContains('maps.googleapis.com', $res);
 
 		$this->Geocode->setOptions(array('host' => 'maps.google.it'));
-		# should now be ".it"
+		// should now be ".it"
 		$res = $this->Geocode->url();
 		$this->assertTextContains('maps.google.it', $res);
 	}
@@ -201,7 +201,7 @@ class GeocodeLibTest extends MyCakeTestCase {
 		$address = 'Neustadt';
 		//echo '<h2>'.$address.'</h2>';
 
-		# allow_inconclusive = TRUE
+		// allow_inconclusive = TRUE
 		$this->Geocode->setOptions(array('allow_inconclusive' => true, 'min_accuracy' => GeocodeLib::ACC_LOC));
 		$is = $this->Geocode->geocode($address);
 		//echo 'debug:';

+ 1 - 1
Test/Case/Lib/HazardLibTest.php

@@ -28,7 +28,7 @@ class HazardLibTest extends CakeTestCase {
 		//pr(h($is));
 		$this->assertTrue(!empty($is));
 
-		# cached
+		// cached
 		Cache::delete('security_lib_texts');
 
 		$is = $this->HazardLib->xssStrings();

+ 3 - 3
Test/Case/Lib/Misc/ZodiacLibTest.php

@@ -33,7 +33,7 @@ class ZodiacLibTest extends MyCakeTestCase {
 		$this->debug($is);
 		$this->assertEquals($is, __('zodiacAries'));
 
-		# january
+		// january
 		$is = $this->Zodiac->getSign(1, 20);
 		$this->debug($is);
 		$this->assertSame($is, ZodiacLib::SIGN_CAPRICORN);
@@ -195,7 +195,7 @@ class ZodiacLibTest extends MyCakeTestCase {
 			$is = $this->Zodiac->getSign($range[1][0], $range[1][1]);
 			$this->assertSame($is, $i);
 
-			# min-1
+			// min-1
 			$month = $range[0][0];
 			$day = $range[0][1] - 1;
 			$is = $this->Zodiac->getSign($month, $day);
@@ -205,7 +205,7 @@ class ZodiacLibTest extends MyCakeTestCase {
 			}
 			$this->assertSame($is, $ii - 1);
 
-			# max+1
+			// max+1
 			$month = $range[1][0];
 			$day = $range[1][1] + 1;
 			$ii = $i;

+ 1 - 1
Test/Case/Lib/RandomLibTest.php

@@ -20,7 +20,7 @@ class RandomLibTest extends CakeTestCase {
 		//pr($is);
 		$this->assertTrue(in_array($is, $array));
 
-		# non-numerical indexes
+		// non-numerical indexes
 		$array = array(
 			'e' => 'x',
 			'f' => 'y',

+ 1 - 1
Test/Case/Lib/Utility/StrTest.php

@@ -291,7 +291,7 @@ class StrTest extends MyCakeTestCase {
 		$expected = 'some text';
 		$this->assertSame($expected, $res);
 
-		# WTF?
+		// WTF?
 		$res = Str::lastChr('some', 'more som text');
 		$expected = 'som text';
 		$this->assertSame($expected, $res);

+ 11 - 11
Test/Case/Lib/Utility/TimeLibTest.php

@@ -158,7 +158,7 @@ class TimeLibTest extends MyCakeTestCase {
 		//$this->debug($ret);
 		$this->assertEquals('2009-02-15 00:00:00', $ret);
 
-		# problem when not passing months or days as well - no way of knowing how exact the date was
+		// problem when not passing months or days as well - no way of knowing how exact the date was
 		$ret = TimeLib::parseLocalizedDate('2009', 'Y', 'start');
 		//pr($ret);
 		//$this->assertEquals($ret, '2009-01-01 00:00:00');
@@ -202,7 +202,7 @@ class TimeLibTest extends MyCakeTestCase {
 			array('2010-02-23', array('2010-02-23 00:00:00', '2010-02-23 23:59:59')),
 			array('2010-02-23 bis 2010-02-26', array('2010-02-23 00:00:00', '2010-02-26 23:59:59')),
 			//array('2010-02-23 11:11:11 bis 2010-02-23 11:12:01', array('2010-02-23 11:11:11', '2010-02-23 11:12:01')),
-			# localized
+			// localized
 			array('23.02.2011', array('2011-02-23 00:00:00', '2011-02-23 23:59:59')),
 			array('23.2.2010 bis 26.2.2011', array('2010-02-23 00:00:00', '2011-02-26 23:59:59')),
 		);
@@ -289,7 +289,7 @@ class TimeLibTest extends MyCakeTestCase {
 	public function testAgeByYear() {
 		$this->out($this->_header(__FUNCTION__), true);
 
-		# year only
+		// year only
 		$is = TimeLib::ageByYear(2000);
 		$this->out($is);
 		$this->assertEquals((date('Y') - 2001) . '/' . (date('Y') - 2000), $is);
@@ -297,7 +297,7 @@ class TimeLibTest extends MyCakeTestCase {
 		$is = TimeLib::ageByYear(1985);
 		$this->assertEquals((date('Y') - 1986) . '/' . (date('Y') - 1985), $is);
 
-		# with month
+		// with month
 		if (($month = date('n') + 1) <= 12) {
 			$is = TimeLib::ageByYear(2000, $month);
 			$this->out($is);
@@ -428,7 +428,7 @@ class TimeLibTest extends MyCakeTestCase {
 		$ret = TimeLib::lengthOfTime(60);
 		//pr($ret);
 
-		# FIX ME! Doesn't work!
+		// FIX ME! Doesn't work!
 		$ret = TimeLib::lengthOfTime(-60);
 		//pr($ret);
 
@@ -456,7 +456,7 @@ class TimeLibTest extends MyCakeTestCase {
 		$ret = TimeLib::fuzzyFromOffset(DAY + 2 * MINUTE);
 		//pr($ret);
 
-		# FIX ME! Doesn't work!
+		// FIX ME! Doesn't work!
 		$ret = TimeLib::fuzzyFromOffset(-DAY);
 		//pr($ret);
 	}
@@ -478,7 +478,7 @@ class TimeLibTest extends MyCakeTestCase {
 	public function testCweekDay() {
 		$this->out($this->_header(__FUNCTION__), true);
 
-		# wednesday
+		// wednesday
 		$ret = TimeLib::cweekDay(51, 2011, 2);
 		$this->out('51, 2011, 2');
 		$this->out(date(FORMAT_DB_DATETIME, $ret));
@@ -676,7 +676,7 @@ class TimeLibTest extends MyCakeTestCase {
 			'2011-11-12 10:10:10' => 10 * HOUR + 10 * MINUTE + 10 * SECOND,
 		);
 
-		# positive
+		// positive
 		foreach ($tests as $was => $expected) {
 			$is = TimeLib::parseTime($was);
 			//pr($is);
@@ -684,7 +684,7 @@ class TimeLibTest extends MyCakeTestCase {
 		}
 
 		unset($tests['2011-11-12 10:10:10']);
-		# negative
+		// negative
 		foreach ($tests as $was => $expected) {
 			$is = TimeLib::parseTime('-' . $was);
 			//pr($is);
@@ -706,14 +706,14 @@ class TimeLibTest extends MyCakeTestCase {
 			3660 => '1:01',
 		);
 
-		# positive
+		// positive
 		foreach ($tests as $was => $expected) {
 			$is = TimeLib::buildTime($was);
 			//pr($is);
 			$this->assertEquals($expected, $is);
 		}
 
-		# negative
+		// negative
 		foreach ($tests as $was => $expected) {
 			$is = TimeLib::buildTime(-$was);
 			//pr($is);

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

@@ -66,7 +66,7 @@ class BitmaskedBehaviorTest extends MyCakeTestCase {
 		$is = $this->Comment->data['BitmaskedComment']['status'];
 		$this->assertSame(BitmaskedComment::STATUS_PUBLISHED | BitmaskedComment::STATUS_APPROVED, $is);
 
-		# save + find
+		// save + find
 
 		$this->Comment->create();
 		$res = $this->Comment->save($data);
@@ -80,11 +80,11 @@ class BitmaskedBehaviorTest extends MyCakeTestCase {
 
 		$this->assertEquals($expected, $res['BitmaskedComment']['statuses']);
 
-		# model.field syntax
+		// model.field syntax
 		$res = $this->Comment->find('first', array('conditions' => array('BitmaskedComment.statuses' => $data['statuses'])));
 		$this->assertTrue(!empty($res));
 
-		# explitit
+		// explitit
 		$activeApprovedAndPublished = BitmaskedComment::STATUS_ACTIVE | BitmaskedComment::STATUS_APPROVED | BitmaskedComment::STATUS_PUBLISHED;
 		$data = array(
 			'comment' => 'another post comment',
@@ -142,7 +142,7 @@ class BitmaskedBehaviorTest extends MyCakeTestCase {
 		$res = $this->Comment->find('all', array('conditions' => $conditions));
 		$this->assertTrue(!empty($res) && count($res) === 3);
 
-		# multiple (AND)
+		// multiple (AND)
 		$res = $this->Comment->containsBit(array(BitmaskedComment::STATUS_PUBLISHED, BitmaskedComment::STATUS_ACTIVE));
 
 		$expected = array('(BitmaskedComment.status & ? = ?)' => array(3, 3));
@@ -162,7 +162,7 @@ class BitmaskedBehaviorTest extends MyCakeTestCase {
 		$res = $this->Comment->find('all', array('conditions' => $conditions));
 		$this->assertTrue(!empty($res) && count($res) === 4);
 
-		# multiple (AND)
+		// multiple (AND)
 		$res = $this->Comment->containsNotBit(array(BitmaskedComment::STATUS_PUBLISHED, BitmaskedComment::STATUS_ACTIVE));
 
 		$expected = array('(BitmaskedComment.status & ? != ?)' => array(3, 3));

+ 2 - 2
Test/Case/Model/Behavior/DecimalInputBehaviorTest.php

@@ -71,13 +71,13 @@ class DecimalInputBehaviorTest extends MyCakeTestCase {
 		$res = $this->Model->save($data);
 		$this->assertTrue((bool)$res);
 
-		# find all
+		// find all
 		$res = $this->Model->find('all', array('order' => array('created' => 'DESC')));
 		$this->assertTrue(!empty($res));
 		$this->assertSame(substr($res[0][$this->Model->alias]['set_rate'], 0, 4), '0,10');
 		$this->assertSame(substr($res[0][$this->Model->alias]['rel_rate'], 0, 5), '-0,02');
 
-		# find first
+		// find first
 		$res = $this->Model->find('first', array('order' => array('created' => 'DESC')));
 		$this->assertTrue(!empty($res));
 		$this->assertSame($res[$this->Model->alias]['set_rate'], '0,10');

+ 1 - 1
Test/Case/Model/Behavior/GeocoderBehaviorTest.php

@@ -122,7 +122,7 @@ class GeocoderBehaviorTest extends CakeTestCase {
 		$this->assertTrue(!empty($res['Comment']['lat']) && !empty($res['Comment']['lng']) && round($res['Comment']['lat']) === 49.0 && round($res['Comment']['lng']) === 10.0);
 		// accuracy = 4
 
-		# inconclusive
+		// inconclusive
 		$data = array(
 			//'street' => 'Leopoldstraße',
 			'city' => 'München'

+ 1 - 1
Test/Case/Model/Behavior/JsonableBehaviorTest.php

@@ -52,7 +52,7 @@ class JsonableBehaviorTest extends MyCakeTestCase {
 
 		$this->assertSame('["z","y","x"]', $res['JsonableComment']['details']);
 
-		# with sort and unique
+		// with sort and unique
 		$data = array(
 			'comment' => 'blabla',
 			'url' => 'www.dereuromark.de',

+ 2 - 2
Test/Case/Model/Behavior/NumberFormatBehaviorTest.php

@@ -71,13 +71,13 @@ class NumberFormatBehaviorTest extends MyCakeTestCase {
 		$res = $this->Model->save($data);
 		$this->assertTrue((bool)$res);
 
-		# find all
+		// find all
 		$res = $this->Model->find('all', array('order' => array('created' => 'DESC')));
 		$this->assertTrue(!empty($res));
 		$this->assertSame(substr($res[0][$this->Model->alias]['set_rate'], 0, 4), '0,10');
 		$this->assertSame(substr($res[0][$this->Model->alias]['rel_rate'], 0, 5), '-0,02');
 
-		# find first
+		// find first
 		$res = $this->Model->find('first', array('order' => array('created' => 'DESC')));
 		$this->assertTrue(!empty($res));
 		$this->assertSame($res[$this->Model->alias]['set_rate'], '0,10');

+ 1 - 1
Test/Case/Model/MyModelTest.php

@@ -112,7 +112,7 @@ class MyModelTest extends MyCakeTestCase {
 		$res = $this->User->escapeValue(null);
 		$this->assertSame(null, $res);
 
-		# comparison to cakes escapeField here (which use ` to escape)
+		// comparison to cakes escapeField here (which use ` to escape)
 		$res = $this->User->escapeField('dob');
 		$this->assertSame('`User`.`dob`', $res);
 	}

+ 2 - 2
Test/Case/View/Helper/DatetimeHelperTest.php

@@ -143,7 +143,7 @@ class DatetimeHelperTest extends MyCakeTestCase {
 		list($year, $month, $day) = explode('-', date('Y-m-d', strtotime('-10 years -1 day')));
 		$this->assertEquals('10', $this->Datetime->age($year . '-' . $month . '-' . $day, null));
 
-		# jahresübertritt
+		// jahresübertritt
 		list($year, $month, $day) = explode('-', '2005-12-01');
 		list($yearE, $monthE, $dayE) = explode('-', '2008-02-29');
 		$this->assertEquals('2', $this->Datetime->age($year . '-' . $month . '-' . $day, $yearE . '-' . $monthE . '-' . $dayE));
@@ -152,7 +152,7 @@ class DatetimeHelperTest extends MyCakeTestCase {
 		list($yearE, $monthE, $dayE) = explode('-', '2008-12-02');
 		$this->assertEquals('6', $this->Datetime->age($year . '-' . $month . '-' . $day, $yearE . '-' . $monthE . '-' . $dayE));
 
-		# schaltjahr
+		// schaltjahr
 		list($year, $month, $day) = explode('-', '2005-02-29');
 		list($yearE, $monthE, $dayE) = explode('-', '2008-03-01');
 		$this->assertEquals('3', $this->Datetime->age($year . '-' . $month . '-' . $day, $yearE . '-' . $monthE . '-' . $dayE));

+ 1 - 1
Test/Case/View/Helper/FormatHelperTest.php

@@ -236,7 +236,7 @@ class FormatHelperTest extends MyCakeTestCase {
 		//echo $is;
 		//$this->assertEquals($expected, $is);
 
-		# recursive?
+		// recursive?
 		$array = array(
 			array('a' => array('2'), 'b' => array('2'), 'c' => array('2')),
 			array(array('2'), array('2'), array('2')),

+ 2 - 2
Test/Case/View/Helper/TextExtHelperTest.php

@@ -97,7 +97,7 @@ class TextExtHelperTest extends MyCakeTestCase {
 		$result = $this->Text->autoLinkUrls($text, array('maxLength' => 20), array('escape' => false));
 		$this->assertEquals($expected, $result);
 
-		# not yet working
+		// not yet working
 		/*
 		$text = 'Text with a url www.cot.ag/cuIb2Q/eruierieriu-erjekrwerweuwrweir-werwer and more';
 		$expected = 'Text with a url <a href="http://www.cot.ag/cuIb2Q/eruierieriu-erjekrwerweuwrweir-werwer">www.cot.ag/cuIb2Q/er&hellip;</a> and more';
@@ -213,7 +213,7 @@ class TextExtHelperTest extends MyCakeTestCase {
 		$url = 'http://www.testpage.de';
 		$this->assertEquals('ww...ge.de', $this->Text->minimizeUrl($url, 10, array('placeholder' => '...')));
 
-		# without full http://
+		// without full http://
 		$url = 'www.testpage.de';
 		$this->assertEquals($url, $this->Text->minimizeUrl($url, 15));
 

+ 2 - 2
Vendor/ical/ical.php

@@ -82,7 +82,7 @@ class ical
 
 	// because Mozilla Calendar save values wrong, like this -->
 	#SUMMARY
-	# :Text of sumary
+	// :Text of sumary
 	// good way is, for example in SunnyBird. SunnyBird save iCal like this example -->
 	#SUMMARY:Text of sumary
 	}
@@ -263,7 +263,7 @@ class ical
 
 	if (empty($temp[1])) // neni TZID
 	{
-			# 2011-06-02 ms fix
+			// 2011-06-02 ms fix
 		$value = str_replace('T', '', $value);
 		return array ($key, $value);
 	}

+ 12 - 12
View/Helper/CaptchaHelper.php

@@ -33,10 +33,10 @@ class CaptchaHelper extends AppHelper {
 	public function __construct($View = null, $settings = array()) {
 		parent::__construct($View, $settings);
 
-		# First of all we are going to set up an array with the text equivalents of all the numbers we will be using.
+		// First of all we are going to set up an array with the text equivalents of all the numbers we will be using.
 		$this->numberConvert = array(0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten');
 
-		# Set up an array with the operators that we want to use. With difficulty=1 it is only subtraction and addition.
+		// Set up an array with the operators that we want to use. With difficulty=1 it is only subtraction and addition.
 		$this->operatorConvert = array(0 => array('+', __('calcPlus')), 1 => array('-', __('calcMinus')), 2 => '*', __('calcTimes'));
 
 		$this->settings = array_merge(CaptchaLib::$defaults, $this->_defaults);
@@ -54,18 +54,18 @@ class CaptchaHelper extends AppHelper {
 	 * @return array
 	 */
 	protected function _generate($difficulty = null) {
-		# Choose the first number randomly between 6 and 10. This is to stop the answer being negative.
+		// Choose the first number randomly between 6 and 10. This is to stop the answer being negative.
 		$numberOne = mt_rand(6, 10);
-		# Choose the second number randomly between 0 and 5.
+		// Choose the second number randomly between 0 and 5.
 		$numberTwo = mt_rand(0, 5);
-		# Choose the operator randomly from the array.
+		// Choose the operator randomly from the array.
 		$captchaOperatorSelection = $this->operatorConvert[mt_rand(0, 1)];
 		$captchaOperator = $captchaOperatorSelection[mt_rand(0, 1)];
 
-		# Get the equation in textual form to show to the user.
+		// Get the equation in textual form to show to the user.
 		$code = (mt_rand(0, 1) == 1 ? __($this->numberConvert[$numberOne]) : $numberOne) . ' ' . $captchaOperator . ' ' . (mt_rand(0, 1) == 1 ? __($this->numberConvert[$numberTwo]) : $numberTwo);
 
-		# Evaluate the equation and get the result.
+		// Evaluate the equation and get the result.
 		eval('$result = ' . $numberOne . ' ' . $captchaOperatorSelection[0] . ' ' . $numberTwo . ';');
 
 		return array('code' => $code, 'result' => $result);
@@ -82,28 +82,28 @@ class CaptchaHelper extends AppHelper {
 	public function captcha($modelName = null) {
 		$captchaCode = $this->_generate();
 
-		# Session-Way (only one form at a time) - must be a component then
+		// Session-Way (only one form at a time) - must be a component then
 	//$this->Session->write('Captcha.result', $result);
 
-	# DB-Way (several forms possible, high security via IP-Based max limits)
+	// DB-Way (several forms possible, high security via IP-Based max limits)
 	// the following should be done in a component and passed to the view/helper
 	// $Captcha = ClassRegistry::init('Captcha');
 	// $this->Captcha->new(); $this->Captcha->update(); etc
 
-		# Timestamp-SessionID-Hash-Way (several forms possible, not as secure)
+		// Timestamp-SessionID-Hash-Way (several forms possible, not as secure)
 		$hash = $this->_buildHash($captchaCode);
 
 		$return = '';
 
 		if (in_array($this->settings['type'], array('active', 'both'))) {
-			# //todo obscure html here?
+			// //todo obscure html here?
 			$fill = ''; //'<span></span>';
 			$return .= '<span id="captchaCode">' . $fill . '' . $captchaCode['code'] . '</span>';
 		}
 
 		$field = $this->_fieldName($modelName);
 
-		# add passive part on active forms as well
+		// add passive part on active forms as well
 		$return .= '<div style="display:none">' .
 			$this->Form->input($field . '_hash', array('value' => $hash)) .
 			$this->Form->input($field . '_time', array('value' => time())) .

+ 1 - 1
View/Helper/CommonHelper.php

@@ -481,7 +481,7 @@ class CommonHelper extends AppHelper {
 		if (!isset($options['escape']) || $options['escape'] !== false) {
 			//$text = str_replace(' ', '&nbsp;', h($text));
 			$text = h($text);
-			# try to fix indends made out of spaces
+			// try to fix indends made out of spaces
 			$text = explode(NL, $text);
 			foreach ($text as $key => $t) {
 				$i = 0;

+ 3 - 3
View/Helper/DatetimeHelper.php

@@ -84,8 +84,8 @@ class DatetimeHelper extends TimeHelper {
 
 			$format = (!empty($options['format']) ? $options['format'] : FORMAT_NICE_YMD);
 
-			# Hack
-			# //TODO: get this to work with datetime - somehow cleaner
+			// Hack
+			// //TODO: get this to work with datetime - somehow cleaner
 			$timeAttachment = '';
 			if (isset($options['niceDateTime'])) {
 				$timeAttachment = ', ' . $this->niceDate($date, $options['niceDateTime']);
@@ -102,7 +102,7 @@ class DatetimeHelper extends TimeHelper {
 				$when = -1;
 				$niceDate = __('Yesterday') . $timeAttachment;
 			} else {
-				# before or after?
+				// before or after?
 				if ($this->isNotTodayAndInTheFuture($date)) {
 					$when = 1;
 				} else {

+ 2 - 2
View/Helper/FlattrHelper.php

@@ -76,9 +76,9 @@ class FlattrHelper extends AppHelper {
 
 		//&uid=gargamel&language=sv_SE&category=text
 
-		# compact: <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;"href="X"></a>
+		// compact: <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;"href="X"></a>
 
-		# static: <a href="http://flattr.com/thing/X" target="_blank"><img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a>
+		// static: <a href="http://flattr.com/thing/X" target="_blank"><img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a>
 
 		$code .= $this->Html->scriptBlock($js, array('inline' => true));
 		return $code;

+ 2 - 2
View/Helper/FormExtHelper.php

@@ -811,7 +811,7 @@ class FormExtHelper extends FormHelper {
 	 * @return string Generated set of select boxes for the date and time formats chosen.
 	 */
 	public function dateTime($field, $options = array(), $timeFormat = 24, $attributes = array()) {
-		# temp fix
+		// temp fix
 		if (!is_array($options)) {
 			return parent::dateTime($field, $options, $timeFormat, $attributes);
 		}
@@ -1056,7 +1056,7 @@ jQuery(\'' . $selector . '\').maxlength(' . $this->Js->object($settings, array('
 
 		$res = $this->input($field, $options);
 		if (is_array($jquery)) {
-			# custom one
+			// custom one
 			$res .= $this->_autoCompleteJs($options['id'], $jquery);
 		}
 		return $res;

+ 10 - 10
View/Helper/FormatHelper.php

@@ -314,7 +314,7 @@ class FormatHelper extends TextHelper {
 	public function icon($type, $t = null, $a = null, $translate = null, $options = array()) {
 		$html = '';
 
-		# title
+		// title
 		if (isset($t) && $t === false) {
 			$title = '';
 		} elseif (empty($t)) {
@@ -814,7 +814,7 @@ class FormatHelper extends TextHelper {
 		$htmlOptions = array_merge($htmlDefaults, $htmlOptions);
 		//return $this->Html->image('/files/progress_bar/index.php'.$params, $htmlOptions);
 
-		# bug in Html::webroot() ??? ommits ?...
+		// bug in Html::webroot() ??? ommits ?...
 		return '<img src="' . $this->Html->url('/files') . '/progress_bar/index.php' . $params . '" title="' . $htmlOptions['title'] . '" class="' .
 			$htmlOptions['class'] . '" alt="' . $htmlOptions['title'] . '" />';
 	}
@@ -1056,10 +1056,10 @@ class FormatHelper extends TextHelper {
 	 * @return string
 	 */
 	public function onlineIcon($modified = null, $options = array()) {
-		# from low (off) to high (on)
+		// from low (off) to high (on)
 		$icons = array('healthbar0.gif', 'healthbar1.gif', 'healthbar1b.gif', 'healthbar2.gif', 'healthbar3.gif', 'healthbar4.gif', 'healthbar5.gif');
 
-		# default = offline
+		// default = offline
 		$res = $icons[0]; // inaktiv
 
 		$time = strtotime($modified);
@@ -1179,27 +1179,27 @@ class FormatHelper extends TextHelper {
 
 		$textstring = trim($textstring);
 
-		# cut only between whole words
+		// cut only between whole words
 		if ($strict !== true) {
 			$completeWordText = $textstring . ' ';
-			# transform line breaks to whitespaces (for textarea content etc.)
+			// transform line breaks to whitespaces (for textarea content etc.)
 			$completeWordTextLf = str_replace(LF, ' ', $completeWordText);
 			$completeWordText = $completeWordTextLf;
 			$completeWordText = substr($completeWordTextLf, 0, $chars);
-			# round the text to the previous entire word instead of cutting off part way through a word
+			// round the text to the previous entire word instead of cutting off part way through a word
 			$completeWordText = substr($completeWordText, 0, strrpos($completeWordText, ' '));
 		}
 
 		$textEnding = '';
 		if ($strict !== true && strlen($completeWordText) > 1) {
 			$text = trim($completeWordText);
-			# add ending only if result is shorter then original
+			// add ending only if result is shorter then original
 			if (strlen($text) < strlen(trim($completeWordTextLf))) {
 				$textEnding = ' ' . $ending; # additional whitespace as there is a new word added
 			}
 		} else {
 			$text = trim(substr($textstring, 0, $chars));
-			# add ending only if result is shorter then original
+			// add ending only if result is shorter then original
 			if (strlen($text) < strlen($textstring)) {
 				$textEnding = $ending;
 			}
@@ -1419,7 +1419,7 @@ class FormatHelper extends TextHelper {
 			'pic' => ICON_NO,
 			'title' => 'No',
 		),
-		# deprecated from here down
+		// deprecated from here down
 		'close' => array(
 			'pic' => ICON_CLOCK,
 			'title' => 'Close',

+ 1 - 1
View/Helper/MyHelper.php

@@ -52,7 +52,7 @@ class MyHelper extends Helper {
 			return;
 		}
 
-		# todo: maybe lazy load with HtmlHelper::url()?
+		// todo: maybe lazy load with HtmlHelper::url()?
 		UrlCacheManager::init($this->_View);
 		Configure::write('UrlCache.runtime.beforeRender', true);
 	}

+ 2 - 2
View/Helper/PhpThumbHelper.php

@@ -71,7 +71,7 @@ class PhpThumbHelper extends AppHelper {
 		set_time_limit(30);
 
 		//TODO: make it cleaner
-		# addon
+		// addon
 		$phpthumbConfig = array();
 		$phpthumbConfig['allow_src_above_docroot'] = true;
 		$phpthumbConfig['cache_disable_warning'] = true;
@@ -90,7 +90,7 @@ class PhpThumbHelper extends AppHelper {
 					$this->PhpThumb->setParameter($keyname, $value);
 				}
 			}
-			# addon end
+			// addon end
 
 		foreach ($this->PhpThumb as $var => $value) {
 			if (isset($this->options[$var])) {

+ 4 - 4
View/Helper/TextExtHelper.php

@@ -267,17 +267,17 @@ class TextExtHelper extends TextHelper {
 	 * @return string html/$plain
 	 */
 	public static function prepareLinkName($link, $options = array()) {
-		# strip protocol if desired (default)
+		// strip protocol if desired (default)
 		if (!isset($options['stripProtocol']) || $options['stripProtocol'] !== false) {
 			$link = self::stripProtocol($link);
 		}
 		if (!isset($options['maxLength'])) {
 			$options['maxLength'] = 50; # should be long enough for most cases
 		}
-		# shorten display name if desired (default)
+		// shorten display name if desired (default)
 		if (!empty($options['maxLength']) && mb_strlen($link) > $options['maxLength']) {
 			$link = mb_substr($link, 0, $options['maxLength']);
-			# problematic with autoLink()
+			// problematic with autoLink()
 			if (!empty($options['html']) && isset($options['escape']) && $options['escape'] === false) {
 				$link .= '&hellip;'; # only possible with escape => false!
 			} else {
@@ -328,7 +328,7 @@ class TextExtHelper extends TextHelper {
 			return $url;
 		}
 		// otherwise cut a part in the middle (but only if long enough!!!)
-		# TODO: more dynamically
+		// TODO: more dynamically
 		$placeholder = CHAR_HELLIP;
 		if (!empty($options['placeholder'])) {
 			$placeholder = $options['placeholder'];