euromark 12 年 前
コミット
bb6e609eaa

+ 6 - 0
Console/Command/CopyShell.php

@@ -64,6 +64,7 @@ class CopyShell extends AppShell {
 		self::TYPE_PLUGIN => 'plugin',
 		self::TYPE_CUSTOM => 'custom'
 	);
+
 	public $matches = array(
 		self::TYPE_CAKE => 'lib/Cake',
 		self::TYPE_VENDOR => 'vendors', # in root dir
@@ -83,6 +84,11 @@ class CopyShell extends AppShell {
 	public $localFolder = APP;
 	public $remoteFolder = null;
 
+	/**
+	 * CopyShell::startup()
+	 *
+	 * @return void
+	 */
 	public function startup() {
 		$this->scriptFolder = dirname(__FILE__) . DS;
 		$this->sitecopyFolder = $this->scriptFolder . $this->sitecopyFolderName . DS;

+ 5 - 5
Controller/Component/CommonComponent.php

@@ -1045,19 +1045,19 @@ class CommonComponent extends Component {
 	 * @return array: chars with content
 	 * PROTECTED NAMES (content cannot contain those): undefined
 	 */
-	public function assignToChar($content_array, $char_array = null) {
+	public function assignToChar($contentArray, $charArray = null) {
 		$res = array();
 		$res['undefined'] = array();
 
-		if (empty($char_array)) {
-			$char_array = $this->alphaFilterSymbols();
+		if (empty($charArray)) {
+			$charArray = $this->alphaFilterSymbols();
 		}
 
-		foreach ($content_array as $content) {
+		foreach ($contentArray as $content) {
 			$done = false;
 
 			# loop them trough
-			foreach ($char_array as $char) {
+			foreach ($charArray as $char) {
 				if (empty($res[$char])) { // throws warnings otherwise
 					$res[$char] = array();
 				}

+ 14 - 14
Lib/Bootstrap/MyBootstrap.php

@@ -543,36 +543,36 @@ function prettyJson($json, $ind = "\t") {
 
 	$indent = 0;
 	$result = '';
-	$quotemarks_counter = 0;
-	$next_token_use_prefix = true;
+	$quotemarksCounter = 0;
+	$nextTokenUsePrefix = true;
 
 	foreach ($tokens as $token) {
-		$quotemarks_counter = $quotemarks_counter + (count(explode('"', $token)) - 1);
+		$quotemarksCounter = $quotemarksCounter + (count(explode('"', $token)) - 1);
 
 		if ($token === '') {
 			continue;
 		}
 
-		if ($next_token_use_prefix) {
+		if ($nextTokenUsePrefix) {
 			$prefix = str_repeat($ind, $indent);
 		} else {
 			$prefix = null;
 		}
 
 		// Determine if the quote marks are open or closed
-		if ($quotemarks_counter & 1) {
+		if ($quotemarksCounter & 1) {
 			// odd - thus quotemarks open
-			$next_token_use_prefix = false;
-			$new_line = null;
+			$nextTokenUsePrefix = false;
+			$newLine = null;
 		} else {
 			// even - thus quotemarks closed
-			$next_token_use_prefix = true;
-			$new_line = "\n";
+			$nextTokenUsePrefix = true;
+			$newLine = "\n";
 		}
 
 		if ($token === "{" || $token === "[") {
 			$indent++;
-			$result .= $token . $new_line;
+			$result .= $token . $newLine;
 		} elseif ($token === "}" || $token === "]") {
 			$indent--;
 
@@ -580,13 +580,13 @@ function prettyJson($json, $ind = "\t") {
 				$prefix = str_repeat($ind, $indent);
 			}
 
-			if ($next_token_use_prefix) {
-				$result .= $new_line . $prefix . $token;
+			if ($nextTokenUsePrefix) {
+				$result .= $newLine . $prefix . $token;
 			} else {
-				$result .= $new_line . $token;
+				$result .= $newLine . $token;
 			}
 		} elseif ($token === ",") {
-			$result .= $token . $new_line;
+			$result .= $token . $newLine;
 		} else {
 			$result .= $prefix . $token;
 		}

+ 2 - 2
Lib/DiffLib.php

@@ -163,8 +163,8 @@ class DiffLib {
 	 */
 	protected function _explode($text) {
 		if (is_array($this->explode_on)) {
-			foreach ($this->explode_on as $explode_on) {
-				$text = explode($explode_on, $text);
+			foreach ($this->explode_on as $explodeOn) {
+				$text = explode($explodeOn, $text);
 			}
 			return $text;
 		}

+ 4 - 4
Lib/GeocodeLib.php

@@ -247,9 +247,9 @@ class GeocodeLib {
 		$this->setParams(array_merge($settings, array('latlng' => $latlng)));
 
 		$count = 0;
-		$request_url = $this->url();
+		$requestUrl = $this->url();
 		while (true) {
-			$result = $this->_fetch($request_url);
+			$result = $this->_fetch($requestUrl);
 			if ($result === false || $result === null) {
 				$this->setError('Could not retrieve url');
 				CakeLog::write('geocode', __('Could not retrieve url with \'%s\'', $latlng));
@@ -358,10 +358,10 @@ class GeocodeLib {
 		}
 
 		$count = 0;
-		$request_url = $this->url();
+		$requestUrl = $this->url();
 
 		while (true) {
-			$result = $this->_fetch($request_url);
+			$result = $this->_fetch($requestUrl);
 			if ($result === false || $result === null) {
 				$this->setError('Could not retrieve url');
 				CakeLog::write('geocode', 'Geocoder could not retrieve url with \'' . $address . '\'');

+ 19 - 19
Lib/ImapLib.php

@@ -190,10 +190,10 @@ class ImapLib {
 	 * - body, structure, attachments
 	 * @return array
 	 */
-	public function msgList($msg_list = array()) {
+	public function msgList($msgList = array()) {
 		$return = array();
 
-		if (empty($msg_list)) {
+		if (empty($msgList)) {
 			$count = $this->msgCount();
 			for ($i = 1; $i <= $count; $i++) {
 				$header = imap_headerinfo($this->stream, $i);
@@ -205,7 +205,7 @@ class ImapLib {
 					if (!is_array($value)) {
 						$return[$msgNo][$id] = imap_utf8($value);
 					} else {
-						foreach ($value as $newid => $array_value) {
+						foreach ($value as $newid => $arrayValue) {
 							foreach ($value[0] as $key => $aValue) {
 								$return[$msgNo][$id][$key] = quoted_printable_decode($aValue);
 							}
@@ -230,14 +230,14 @@ class ImapLib {
 		}
 		// We want to search a specific array of messages
 		else {
-			foreach ($msg_list as $i) {
+			foreach ($msgList as $i) {
 				$header = imap_headerinfo($this->stream, $i);
 				foreach ($header as $id => $value) {
 					// Simple array
 					if (!is_array($value)) {
 						$return[$header->Msgno][$id] = $value;
 					} else {
-						foreach ($value as $newid => $array_value) {
+						foreach ($value as $newid => $arrayValue) {
 							foreach ($value[0] as $key => $aValue) {
 								$return[$header->Msgno][$id][$key] = quoted_printable_decode($aValue);
 							}
@@ -359,19 +359,19 @@ class ImapLib {
 	public function search($params) {
 		if ($this->stream) {
 			if (is_array($params)) {
-				$search_string = '';
+				$searchString = '';
 				foreach ($params as $field => $value) {
 					if (is_numeric($field)) {
 						// Make sure the value is uppercase
-						$search_string .= strtoupper($value) . ' ';
+						$searchString .= strtoupper($value) . ' ';
 					} else {
-						$search_string .= strtoupper($field) . ' "' . $value . '" ';
+						$searchString .= strtoupper($field) . ' "' . $value . '" ';
 					}
 				}
 
 				// Perform the search
 				#echo "'$search_string'";
-				return imap_search($this->stream, $search_string);
+				return imap_search($this->stream, $searchString);
 			}
 			return imap_last_error();
 		}
@@ -410,30 +410,30 @@ class ImapLib {
 
 		// Let's delete multiple emails
 		if (count($emails) > 0) {
-			$delete_string = '';
-			$email_error = array();
+			$deleteString = '';
+			$emailError = array();
 			foreach ($emails as $email) {
 				if ($delete) {
 					if (!imap_delete($this->stream, $email)) {
-						$email_error[] = $email;
+						$emailError[] = $email;
 					}
 				}
 			}
 			if (!$delete) {
 				// Need to take the last comma out!
-				$delete_string = implode(',', $emails);
-				echo $delete_string;
-				imap_mail_move($this->stream, $delete_string, "Inbox/Trash");
+				$deleteString = implode(',', $emails);
+				echo $deleteString;
+				imap_mail_move($this->stream, $deleteString, "Inbox/Trash");
 				//imap_expunge($this->stream);
 			} else {
 				// NONE of the emails were deleted
 				//imap_expunge($this->stream);
 
-				if (count($email_error) === count($emails)) {
+				if (count($emailError) === count($emails)) {
 					return imap_last_error();
 				}
 				$return['status'] = false;
-				$return['not_deleted'] = $email_error;
+				$return['not_deleted'] = $emailError;
 				return $return;
 			}
 		}
@@ -487,8 +487,8 @@ class ImapLib {
 			$info = imap_mailboxmsginfo($this->stream);
 			if ($info) {
 				if ($type === 'array') {
-					$info_array = get_object_vars($info);
-					return $info_array;
+					$infoArray = get_object_vars($info);
+					return $infoArray;
 				}
 				return $info;
 			}

+ 27 - 27
Lib/InlineCssLib.php

@@ -141,7 +141,7 @@ class InlineCssLib {
 		$DOM->loadHTML($html);
 
 		// DOM removal queue
-		$remove_doms = array();
+		$removeDoms = array();
 
 		// catch <link> style sheet content
 		$links = $DOM->getElementsByTagName('link');
@@ -151,15 +151,15 @@ class InlineCssLib {
 
 				// find the css file and load contents
 				if ($link->hasAttribute('media')) {
-					foreach ($this->media_types as $css_link_media) {
-						if (strstr($link->getAttribute('media'), $css_link_media)) {
+					foreach ($this->media_types as $cssLinkMedia) {
+						if (strstr($link->getAttribute('media'), $cssLinkMedia)) {
 							$css .= $this->_findAndLoadCssFile($link->getAttribute('href')) . "\n\n";
-							$remove_doms[] = $link;
+							$removeDoms[] = $link;
 						}
 					}
 				} else {
 					$css .= $this->_findAndLoadCssFile($link->getAttribute('href')) . "\n\n";
-					$remove_doms[] = $link;
+					$removeDoms[] = $link;
 				}
 			}
 		}
@@ -170,23 +170,23 @@ class InlineCssLib {
 		// Style
 		foreach ($styles as $style) {
 			if ($style->hasAttribute('media')) {
-				foreach ($this->media_types as $css_link_media) {
-					if (strstr($style->getAttribute('media'), $css_link_media)) {
+				foreach ($this->media_types as $cssLinkMedia) {
+					if (strstr($style->getAttribute('media'), $cssLinkMedia)) {
 						$css .= $this->_parseInlineCssAndLoadImports($style->nodeValue);
-						$remove_doms[] = $style;
+						$removeDoms[] = $style;
 					}
 				}
 			} else {
 				$css .= $this->_parseInlineCssAndLoadImports($style->nodeValue);
-				$remove_doms[] = $style;
+				$removeDoms[] = $style;
 			}
 		}
 
 		// Remove
 		if ($this->settings['removeCss']) {
-			foreach ($remove_doms as $remove_dom) {
+			foreach ($removeDoms as $removeDom) {
 				try {
-					$remove_dom->parentNode->removeChild($remove_dom);
+					$removeDom->parentNode->removeChild($removeDom);
 				} catch (DOMException $e) {}
 			}
 			$html = $DOM->saveHTML();
@@ -202,37 +202,37 @@ class InlineCssLib {
 	 * @return string Content
 	 */
 	protected function _findAndLoadCssFile($cssHref) {
-		$css_filenames = array_merge($this->_globRecursive(CSS . '*.Css'), $this->_globRecursive(CSS . '*.CSS'), $this->_globRecursive(CSS . '*.css'));
+		$cssFilenames = array_merge($this->_globRecursive(CSS . '*.Css'), $this->_globRecursive(CSS . '*.CSS'), $this->_globRecursive(CSS . '*.css'));
 
 		// Build an array of the ever more path specific $cssHref location
 		$cssHrefs = split(DS, $cssHref);
-		$cssHref_paths = array();
+		$cssHrefPaths = array();
 		for ($i = count($cssHrefs) - 1; $i > 0; $i--) {
-			if (isset($cssHref_paths[count($cssHref_paths) - 1])) {
-				$cssHref_paths[] = $cssHrefs[$i] . DS . $cssHref_paths[count($cssHref_paths) - 1];
+			if (isset($cssHrefPaths[count($cssHrefPaths) - 1])) {
+				$cssHrefPaths[] = $cssHrefs[$i] . DS . $cssHrefPaths[count($cssHrefPaths) - 1];
 			} else {
-				$cssHref_paths[] = $cssHrefs[$i];
+				$cssHrefPaths[] = $cssHrefs[$i];
 			}
 		}
 
 		// the longest string match will be the match we are looking for
-		$best_css_filename = null;
-		$best_css_match_length = 0;
-		foreach ($css_filenames as $css_filename) {
-			foreach ($cssHref_paths as $cssHref_path) {
-				$regex = '/' . str_replace('/', '\/', str_replace('.', '\.', $cssHref_path)) . '/';
-				if (preg_match($regex, $css_filename, $match)) {
-					if (strlen($match[0]) > $best_css_match_length) {
-						$best_css_match_length = strlen($match[0]);
-						$best_css_filename = $css_filename;
+		$bestCssFilename = null;
+		$bestCssMatchLength = 0;
+		foreach ($cssFilenames as $cssFilename) {
+			foreach ($cssHrefPaths as $cssHrefPath) {
+				$regex = '/' . str_replace('/', '\/', str_replace('.', '\.', $cssHrefPath)) . '/';
+				if (preg_match($regex, $cssFilename, $match)) {
+					if (strlen($match[0]) > $bestCssMatchLength) {
+						$bestCssMatchLength = strlen($match[0]);
+						$bestCssFilename = $cssFilename;
 					}
 				}
 			}
 		}
 
 		$css = null;
-		if (!empty($best_css_filename) && is_file($best_css_filename)) {
-			$css = file_get_contents($best_css_filename);
+		if (!empty($bestCssFilename) && is_file($bestCssFilename)) {
+			$css = file_get_contents($bestCssFilename);
 		}
 
 		return $css;

+ 11 - 11
Lib/RandomLib.php

@@ -99,24 +99,24 @@ class RandomLib {
 	 * @return (string) $dob a db (ISO) format datetime string
 	 */
 	public static function dob($min = 18, $max = 100) {
-		$dob_year = date('Y') - (self::int($min, $max));
+		$dobYear = date('Y') - (self::int($min, $max));
 
-		$dob_month = self::int(1, 12);
+		$dobMonth = self::int(1, 12);
 
-		if ($dob_month == 2) {
+		if ($dobMonth == 2) {
 			// leap year?
-			if ($age_years % 4 || $age_years % 400)
-				$max_days = 29;
+			if ($ageYears % 4 || $ageYears % 400)
+				$maxDays = 29;
 			else
-				$max_days = 28;
-		} elseif (in_array($dob_month, array(4, 6, 9, 11)))
-			$max_days = 30;
+				$maxDays = 28;
+		} elseif (in_array($dobMonth, array(4, 6, 9, 11)))
+			$maxDays = 30;
 		else
-			$max_days = 31;
+			$maxDays = 31;
 
-		$dob_day = self::int(1, $max_days);
+		$dobDay = self::int(1, $maxDays);
 
-		$dob = sprintf("%4d-%02d-%02d", $dob_year, $dob_month, $dob_day);
+		$dob = sprintf("%4d-%02d-%02d", $dobYear, $dobMonth, $dobDay);
 		return $dob;
 	}
 

+ 2 - 2
Lib/Utility/TextAnalysisLib.php

@@ -197,9 +197,9 @@ class TextAnalysisLib extends TextLib {
 
 	public function getLetter() {
 		if (!$this->letter) {
-			$l_text = mb_strtolower($this->text);
+			$lText = mb_strtolower($this->text);
 			for ($i = 0; $i < $this->lenght; $i++)
-				if (mb_strpos("abcdefghijklmnopqrstuvwxyzäöü", $l_text[$i]) != false) $this->
+				if (mb_strpos("abcdefghijklmnopqrstuvwxyzäöü", $lText[$i]) != false) $this->
 						letter++;
 		}
 		return $this->letter;

+ 5 - 5
Lib/Utility/TextLib.php

@@ -133,10 +133,10 @@ class TextLib extends String {
 		// this, "somecompany, llc", "and ""this"" w,o.rks", foo bar
 		$regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x';
 		preg_match_all($regexp, $tags, $matches);
-		$typed_tags = array_unique($matches[1]);
+		$typedTags = array_unique($matches[1]);
 
 		$tags = array();
-		foreach ($typed_tags as $tag) {
+		foreach ($typedTags as $tag) {
 		// If a user has escaped a term (to demonstrate that it is a group,
 		// or includes a comma or quote character), we remove the escape
 		// formatting so to save the term into the database as the user intends.
@@ -153,16 +153,16 @@ class TextLib extends String {
 	 * Implode an array of tags into a string.
 	 */
 	public function implodeTags($tags) {
-		$encoded_tags = array();
+		$encodedTags = array();
 		foreach ($tags as $tag) {
 		// Commas and quotes in tag names are special cases, so encode them.
 		if (strpos($tag, ',') !== false || strpos($tag, '"') !== false) {
 			$tag = '"' . str_replace('"', '""', $tag) . '"';
 		}
 
-		$encoded_tags[] = $tag;
+		$encodedTags[] = $tag;
 		}
-		return implode(', ', $encoded_tags);
+		return implode(', ', $encodedTags);
 	}
 
 	/**

+ 11 - 11
Lib/Utility/TimeLib.php

@@ -127,18 +127,18 @@ class TimeLib extends CakeTime {
 		//$age = intval(($endDate - $startDate) / (3600 * 24 * 365));
 		//$age = self::timef($endDate-$startDate, 'Y'); # !!! timef function
 
-		$n_tag = $dayE;
-		$n_monat = $monthE;
-		$n_jahr = $yearE;
-		$g_tag = $dayS;
-		$g_monat = $monthS;
-		$g_jahr = $yearS;
-		$g_date = mktime(0, 0, 0, $g_tag, $g_monat, $g_jahr);
-
-		if (($n_monat > $g_monat)||(($n_monat == $g_monat)&&($n_tag > $g_tag))||(($n_monat == $g_monat)&&($n_tag == $g_tag))) {
-			$age = $n_jahr - $g_jahr; // is correct if one already had his birthday this year
+		$nTag = $dayE;
+		$nMonat = $monthE;
+		$nJahr = $yearE;
+		$gTag = $dayS;
+		$gMonat = $monthS;
+		$gJahr = $yearS;
+		$gDate = mktime(0, 0, 0, $gTag, $gMonat, $gJahr);
+
+		if (($nMonat > $gMonat)||(($nMonat == $gMonat)&&($nTag > $gTag))||(($nMonat == $gMonat)&&($nTag == $gTag))) {
+			$age = $nJahr - $gJahr; // is correct if one already had his birthday this year
 		} else {
-			$age = $n_jahr - $g_jahr - 1; // is correct if one didnt have his birthday yet in this year
+			$age = $nJahr - $gJahr - 1; // is correct if one didnt have his birthday yet in this year
 		}
 		return $age;
 

+ 0 - 1
Lib/Utility/Utility.php

@@ -86,7 +86,6 @@ class Utility {
 			return false;
 		}
 		$result = array();
-		$space_key = null;
 		$c = mb_strlen($str);
 		for ($i = 0; $i < $c; $i += $length) {
 			$result[] = mb_substr($str, $i, $length);

+ 3 - 3
Lib/ZipLib.php

@@ -53,7 +53,7 @@ class ZipLib {
 		}
 
 		$size = 0;
-		while ($dir_resource = zip_read($this->Zip)) {
+		while ($dirResource = zip_read($this->Zip)) {
 			$size++;
 		}
 		return $size;
@@ -70,8 +70,8 @@ class ZipLib {
 		}
 
 		$size = 0;
-		while ($dir_resource = zip_read($this->Zip)) {
-			$size += zip_entry_filesize($dir_resource);
+		while ($dirResource = zip_read($this->Zip)) {
+			$size += zip_entry_filesize($dirResource);
 		}
 		return $size;
 	}

+ 1 - 1
Model/Behavior/CustomFindsBehavior.php

@@ -64,7 +64,7 @@ class CustomFindsBehavior extends ModelBehavior {
 			}
 			foreach ($remove as $subKey => $subRemove) {
 				if (is_string($subKey) && isset($query[$remove][$subKey])) {
-					return $this__remove($query[$remove][$subKey], $subRemove);
+					return $this->_remove($query[$remove][$subKey], $subRemove);
 				}
 
 				if (is_string($subRemove)) {

+ 13 - 13
Model/Behavior/LogableBehavior.php

@@ -197,17 +197,17 @@ class LogableBehavior extends ModelBehavior {
 	 * @param array $params
 	 * @return array
 	 */
-	public function findUserActions(Model $Model, $user_id, $params = array()) {
+	public function findUserActions(Model $Model, $userId, $params = array()) {
 		if (!$this->UserModel) {
 			return null;
 		}
 		// if logged in user is asking for her own log, use the data we allready have
-		if (isset($this->user) && isset($this->user[$this->UserModel->alias][$this->UserModel->primaryKey]) && $user_id == $this->user[$this->
+		if (isset($this->user) && isset($this->user[$this->UserModel->alias][$this->UserModel->primaryKey]) && $userId == $this->user[$this->
 			UserModel->alias][$this->UserModel->primaryKey] && isset($this->user[$this->UserModel->alias][$this->UserModel->displayField])) {
 			$username = $this->user[$this->UserModel->alias][$this->UserModel->displayField];
 		} else {
 			$this->UserModel->recursive = -1;
-			$user = $this->UserModel->find('first', array('conditions' => array($this->UserModel->primaryKey => $user_id)));
+			$user = $this->UserModel->find('first', array('conditions' => array($this->UserModel->primaryKey => $userId)));
 			$username = $user[$this->UserModel->alias][$this->UserModel->displayField];
 		}
 		$fields = array();
@@ -218,7 +218,7 @@ class LogableBehavior extends ModelBehavior {
 				$fields = array($params['fields']);
 			}
 		}
-		$conditions = array($this->settings[$Model->alias]['userKey'] => $user_id);
+		$conditions = array($this->settings[$Model->alias]['userKey'] => $userId);
 		if (isset($params[$this->settings[$Model->alias]['classField']])) {
 			$conditions[$this->settings[$Model->alias]['classField']] = $params[$this->settings[$Model->alias]['classField']];
 		}
@@ -448,32 +448,32 @@ class LogableBehavior extends ModelBehavior {
 		}
 		if ($this->Log->hasField('change')) {
 			$logData[$this->Log->alias]['change'] = '';
-			$db_fields = array_keys($Model->schema());
-			$changed_fields = array();
+			$dbFields = array_keys($Model->schema());
+			$changedFields = array();
 			foreach ($Model->data[$Model->alias] as $key => $value) {
 				if (isset($Model->data[$Model->alias][$Model->primaryKey]) && !empty($this->old) && isset($this->old[$Model->alias][$key])) {
 					$old = $this->old[$Model->alias][$key];
 				} else {
 					$old = '';
 				}
-				if ($key !== 'modified' && !in_array($key, $this->settings[$Model->alias]['ignore']) && $value != $old && in_array($key, $db_fields)) {
+				if ($key !== 'modified' && !in_array($key, $this->settings[$Model->alias]['ignore']) && $value != $old && in_array($key, $dbFields)) {
 					if ($this->settings[$Model->alias]['change'] === 'full') {
-						$changed_fields[] = $key . ' (' . $old . ') => (' . $value . ')';
+						$changedFields[] = $key . ' (' . $old . ') => (' . $value . ')';
 					} elseif ($this->settings[$Model->alias]['change'] === 'serialize') {
-							$changed_fields[$key] = array('old' => $old, 'value' => $value);
+							$changedFields[$key] = array('old' => $old, 'value' => $value);
 						} else {
-							$changed_fields[] = $key;
+							$changedFields[] = $key;
 						}
 				}
 			}
-			$changes = count($changed_fields);
+			$changes = count($changedFields);
 			if (!$changes) {
 				return true;
 			}
 			if ($this->settings[$Model->alias]['change'] === 'serialize') {
-				$logData[$this->Log->alias]['change'] = serialize($changed_fields);
+				$logData[$this->Log->alias]['change'] = serialize($changedFields);
 			} else {
-				$logData[$this->Log->alias]['change'] = implode(', ', $changed_fields);
+				$logData[$this->Log->alias]['change'] = implode(', ', $changedFields);
 			}
 			$logData[$this->Log->alias]['changes'] = $changes;
 		}

+ 32 - 32
Model/Behavior/RevisionBehavior.php

@@ -169,8 +169,8 @@ class RevisionBehavior extends ModelBehavior {
 			return false;
 		}
 		$habtm = array();
-		$all_habtm = $Model->getAssociated('hasAndBelongsToMany');
-		foreach ($all_habtm as $assocAlias) {
+		$allHabtm = $Model->getAssociated('hasAndBelongsToMany');
+		foreach ($allHabtm as $assocAlias) {
 			if (isset($Model->ShadowModel->_schema[$assocAlias])) {
 				$habtm[] = $assocAlias;
 			}
@@ -180,8 +180,8 @@ class RevisionBehavior extends ModelBehavior {
 		$Model->ShadowModel->create($data);
 		$Model->ShadowModel->set('version_created', date('Y-m-d H:i:s'));
 		foreach ($habtm as $assocAlias) {
-			$foreign_keys = Set::extract($data, '/' . $assocAlias . '/' . $Model->{$assocAlias}->primaryKey);
-			$Model->ShadowModel->set($assocAlias, implode(',', $foreign_keys));
+			$foreignKeys = Set::extract($data, '/' . $assocAlias . '/' . $Model->{$assocAlias}->primaryKey);
+			$Model->ShadowModel->set($assocAlias, implode(',', $foreignKeys));
 		}
 		return (bool)$Model->ShadowModel->save();
 	}
@@ -307,8 +307,8 @@ class RevisionBehavior extends ModelBehavior {
 	 */
 	protected function init(Model $Model, $page, $limit) {
 		$habtm = array();
-		$all_habtm = $Model->getAssociated('hasAndBelongsToMany');
-		foreach ($all_habtm as $assocAlias) {
+		$allHabtm = $Model->getAssociated('hasAndBelongsToMany');
+		foreach ($allHabtm as $assocAlias) {
 			if (isset($Model->ShadowModel->_schema[$assocAlias])) {
 				$habtm[] = $assocAlias;
 			}
@@ -317,10 +317,10 @@ class RevisionBehavior extends ModelBehavior {
 			'limit' => $limit,
 			'page' => $page,
 			'contain' => $habtm));
-		$version_created = date('Y-m-d H:i:s');
+		$versionCreated = date('Y-m-d H:i:s');
 		foreach ($all as $data) {
 			$Model->ShadowModel->create($data);
-			$Model->ShadowModel->set('version_created', $version_created);
+			$Model->ShadowModel->set('version_created', $versionCreated);
 			$Model->ShadowModel->save();
 		}
 	}
@@ -440,25 +440,25 @@ class RevisionBehavior extends ModelBehavior {
 
 		$cond = $options['conditions'];
 		$cond['version_created <'] = $options['date'];
-		$created_before_date = $Model->ShadowModel->find('all', array(
+		$createdBeforeDate = $Model->ShadowModel->find('all', array(
 			'order' => $Model->primaryKey,
 			'conditions' => $cond,
 			'fields' => array('version_id', $Model->primaryKey)));
-		$created_before_dateIds = Set::extract($created_before_date, '/' . $Model->alias . '/' . $Model->primaryKey);
+		$createdBeforeDateIds = Set::extract($createdBeforeDate, '/' . $Model->alias . '/' . $Model->primaryKey);
 
-		$deleteIds = array_diff($allIds, $created_before_dateIds);
+		$deleteIds = array_diff($allIds, $createdBeforeDateIds);
 
 		// delete all Model rows where there are only version_created later than date
 		$Model->deleteAll(array($Model->alias . '.' . $Model->primaryKey => $deleteIds), false, true);
 
 		unset($cond['version_created <']);
 		$cond['version_created >='] = $options['date'];
-		$created_after_date = $Model->ShadowModel->find('all', array(
+		$createdAfterDate = $Model->ShadowModel->find('all', array(
 			'order' => $Model->primaryKey,
 			'conditions' => $cond,
 			'fields' => array('version_id', $Model->primaryKey)));
-		$created_after_dateIds = Set::extract($created_after_date, '/' . $Model->alias . '/' . $Model->primaryKey);
-		$updateIds = array_diff($created_after_dateIds, $deleteIds);
+		$createdAfterDateIds = Set::extract($createdAfterDate, '/' . $Model->alias . '/' . $Model->primaryKey);
+		$updateIds = array_diff($createdAfterDateIds, $deleteIds);
 
 		$revertSuccess = true;
 		// update model rows that have version_created earlier than date to latest before date
@@ -514,7 +514,7 @@ class RevisionBehavior extends ModelBehavior {
 	 * @param boolean $force_delete
 	 * @return boolean Success
 	 */
-	public function revertToDate(Model $Model, $datetime, $cascade = false, $force_delete = false) {
+	public function revertToDate(Model $Model, $datetime, $cascade = false, $forceDelete = false) {
 		if (!$Model->id) {
 			trigger_error('RevisionBehavior: Model::id must be set', E_USER_WARNING);
 			return null;
@@ -547,18 +547,18 @@ class RevisionBehavior extends ModelBehavior {
 				}
 
 				/* Query shadow table for deleted children */
-				$revision_children = $Model->$assoc->ShadowModel->find('all', array(
+				$revisionChildren = $Model->$assoc->ShadowModel->find('all', array(
 					'fields' => array('DISTINCT ' . $Model->primaryKey),
 					'conditions' => array($data['foreignKey'] => $Model->id, 'NOT' => array($Model->primaryKey => $ids)),
 					));
-				if (!empty($revision_children)) {
-					$ids = array_merge($ids, Set::extract($revision_children, '/' . $assoc . '/' . $Model->$assoc->primaryKey));
+				if (!empty($revisionChildren)) {
+					$ids = array_merge($ids, Set::extract($revisionChildren, '/' . $assoc . '/' . $Model->$assoc->primaryKey));
 				}
 
 				/* Revert all children */
 				foreach ($ids as $id) {
 					$Model->$assoc->id = $id;
-					$Model->$assoc->revertToDate($datetime, $cascade, $force_delete);
+					$Model->$assoc->revertToDate($datetime, $cascade, $forceDelete);
 				}
 			}
 		}
@@ -569,7 +569,7 @@ class RevisionBehavior extends ModelBehavior {
 					'version_created <=' => $datetime), 'order' => 'version_created ASC, version_id ASC'));
 		/* If no previous version was found and revertToDate() was called with force_delete, then delete the live data, else leave it alone */
 		if (!$data) {
-			if ($force_delete) {
+			if ($forceDelete) {
 				$Model->logableAction['Revision'] = 'revertToDate(' . $datetime . ') delete';
 				return $Model->delete($Model->id);
 			}
@@ -693,21 +693,21 @@ class RevisionBehavior extends ModelBehavior {
 		if (!$beforeUndeleteSuccess) {
 			return false;
 		}
-		$model_id = $data[$Model->alias][$Model->primaryKey];
+		$modelId = $data[$Model->alias][$Model->primaryKey];
 		unset($data[$Model->alias][$Model->ShadowModel->primaryKey]);
 		$Model->create($data, true);
-		$auto_setting = $this->settings[$Model->alias]['auto'];
+		$autoSetting = $this->settings[$Model->alias]['auto'];
 		$this->settings[$Model->alias]['auto'] = false;
-		$save_success = $Model->save();
-		$this->settings[$Model->alias]['auto'] = $auto_setting;
-		if (!$save_success) {
+		$saveSuccess = $Model->save();
+		$this->settings[$Model->alias]['auto'] = $autoSetting;
+		if (!$saveSuccess) {
 			return false;
 		}
 		$Model->updateAll(
-			array($Model->primaryKey => $model_id),
+			array($Model->primaryKey => $modelId),
 			array($Model->primaryKey => $Model->id)
 		);
-		$Model->id = $model_id;
+		$Model->id = $modelId;
 		$Model->createRevision();
 		$afterUndeleteSuccess = true;
 		if (method_exists($Model, 'afterUndelete')) {
@@ -808,10 +808,10 @@ class RevisionBehavior extends ModelBehavior {
 			$Model->ShadowModel->create($Model->data, true);
 			$Model->ShadowModel->set($Model->primaryKey, $Model->id);
 			$Model->ShadowModel->set('version_created', date('Y-m-d H:i:s'));
-			foreach ($Model->data as $alias => $alias_data) {
+			foreach ($Model->data as $alias => $aliasData) {
 				if (isset($Model->ShadowModel->_schema[$alias])) {
-					if (isset($alias_data[$alias]) && !empty($alias_data[$alias])) {
-						$Model->ShadowModel->set($alias, implode(',', $alias_data[$alias]));
+					if (isset($aliasData[$alias]) && !empty($aliasData[$alias])) {
+						$Model->ShadowModel->set($alias, implode(',', $aliasData[$alias]));
 					}
 				}
 			}
@@ -854,8 +854,8 @@ class RevisionBehavior extends ModelBehavior {
 					continue;
 				}
 				$currentIds = Set::extract($data, $assocAlias . '.{n}.id');
-				$id_changes = array_diff($currentIds, $oldIds);
-				if (!empty($id_changes)) {
+				$idChanges = array_diff($currentIds, $oldIds);
+				if (!empty($idChanges)) {
 					$Model->ShadowModel->set($assocAlias, implode(',', $currentIds));
 					$changeDetected = true;
 				} else {

+ 14 - 14
Model/Datasource/ImapSource.php

@@ -917,19 +917,19 @@ class ImapSource extends DataSource {
 		}
 		$text = imap_qprint($decoded->text);
 
-		$app_encoding = Configure::read('App.encoding');
-		$mail_encoding = $decoded->charset;
+		$appEncoding = Configure::read('App.encoding');
+		$mailEncoding = $decoded->charset;
 		$encodings = mb_list_encodings();
 		$valid = true;
-		if ($app_encoding !== $mail_encoding || !($valid = mb_check_encoding($text, $mail_encoding))) {
-			if (!in_array($mail_encoding, $encodings) || !$valid) {
-				$mail_encoding = mb_detect_encoding($text);
+		if ($appEncoding !== $mailEncoding || !($valid = mb_check_encoding($text, $mailEncoding))) {
+			if (!in_array($mailEncoding, $encodings) || !$valid) {
+				$mailEncoding = mb_detect_encoding($text);
 			}
-			if (!in_array($app_encoding, $encodings)) {
-				$app_encoding = 'UTF-8';
+			if (!in_array($appEncoding, $encodings)) {
+				$appEncoding = 'UTF-8';
 			}
 
-			$text = mb_convert_encoding($text, $app_encoding, $mail_encoding);
+			$text = mb_convert_encoding($text, $appEncoding, $mailEncoding);
 		}
 
 		return $text;
@@ -943,16 +943,16 @@ class ImapSource extends DataSource {
 	 */
 	protected function _getFormattedMail(Model $Model, $uid, $fetchAttachments = false) {
 		// Translate uid to msg_no. Has no decent fail
-		$msg_number = imap_msgno($this->Stream, $uid);
+		$msgNumber = imap_msgno($this->Stream, $uid);
 
 		// A hack to detect if imap_msgno failed, and we're in fact looking at the wrong mail
-		if ($uid != ($mailuid = imap_uid($this->Stream, $msg_number))) {
+		if ($uid != ($mailuid = imap_uid($this->Stream, $msgNumber))) {
 			//pr(compact('Mail'));
 			return $this->err($Model, 'Mail id mismatch. parameter id: %s vs mail id: %s', $uid, $mailuid);
 		}
 
 		// Get Mail with a property: 'date' or fail
-		if (!($Mail = imap_headerinfo($this->Stream, $msg_number)) || !property_exists($Mail, 'date')) {
+		if (!($Mail = imap_headerinfo($this->Stream, $msgNumber)) || !property_exists($Mail, 'date')) {
 			//pr(compact('Mail'));
 			return $this->err($Model, 'Unable to find mail date property in Mail corresponding with uid: %s. Something must be wrong', $uid);
 		}
@@ -1095,9 +1095,9 @@ class ImapSource extends DataSource {
 		if (!empty($Structure->parts)) {
 			foreach ($Structure->parts as $n => $Part) {
 				if ($n >= 1) {
-					$arr_decimas = explode('.', $partnr);
-					$arr_decimas[count($arr_decimas) - 1] += 1;
-					$partnr = join('.', $arr_decimas);
+					$arrDecimas = explode('.', $partnr);
+					$arrDecimas[count($arrDecimas) - 1] += 1;
+					$partnr = join('.', $arrDecimas);
 				}
 				$Part->path = $partnr;
 

+ 0 - 1
Model/MyModel.php

@@ -355,7 +355,6 @@ class MyModel extends Model {
 	 * @return integer next auto increment value or False on failure
 	 */
 	public function getNextAutoIncrement() {
-		$next_increment = 0;
 		$query = "SHOW TABLE STATUS WHERE name = '" . $this->tablePrefix . $this->table . "'";
 		$result = $this->query($query);
 		if (!isset($result[0]['TABLES']['Auto_increment'])) {

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

@@ -559,10 +559,10 @@ class LogableBehaviorTest extends CakeTestCase {
 	}
 
 	public function testIgnoreSetup() {
-		$log_rows_before = $this->Log->find('count', array('conditions' => array('model' => 'LogableUser', 'foreign_id' => 301)));
+		$logRowsBefore = $this->Log->find('count', array('conditions' => array('model' => 'LogableUser', 'foreign_id' => 301)));
 		$this->LogableUser->save(array('id' => 301, 'counter' => 3));
-		$log_rows_after = $this->Log->find('count', array('conditions' => array('model' => 'LogableUser', 'foreign_id' => 301)));
-		$this->assertEquals($log_rows_after, $log_rows_before);
+		$logRowsAfter = $this->Log->find('count', array('conditions' => array('model' => 'LogableUser', 'foreign_id' => 301)));
+		$this->assertEquals($logRowsAfter, $logRowsBefore);
 
 		$this->LogableUser->save(array('id' => 301, 'name' => 'Steven Segal', 'counter' => 77));
 

+ 30 - 30
Test/Case/Model/Behavior/RevisionBehaviorTest.php

@@ -112,7 +112,7 @@ class RevisionBehaviorTest extends CakeTestCase {
 
 		$Post->create(array('Post' => array('title' => 'Non Used Post', 'content' => 'Whatever')));
 		$Post->save();
-		$post_id = $Post->id;
+		$postId = $Post->id;
 
 		$Post->create(array('Post' => array('title' => 'New Post 1', 'content' => 'nada')));
 		$Post->save();
@@ -133,7 +133,7 @@ class RevisionBehaviorTest extends CakeTestCase {
 				'content' => 'nada'));
 		$this->assertEquals($expected, $result);
 
-		$Post->id = $post_id;
+		$Post->id = $postId;
 		$result = $Post->newest();
 		$this->assertEquals($result['Post']['title'], 'Non Used Post');
 		$this->assertEquals($result['Post']['version_id'], 4);
@@ -404,8 +404,8 @@ class RevisionBehaviorTest extends CakeTestCase {
 		$result = $Post->previous();
 		$this->assertEquals($result['Post']['title'], 'Edited Post 2');
 
-		$version_id = $result['Post']['version_id'];
-		$result = $Post->revertTo($version_id);
+		$versionId = $result['Post']['version_id'];
+		$result = $Post->revertTo($versionId);
 		$this->assertTrue((bool)$result);
 
 		$result = $Post->find('first', array('fields' => array(
@@ -593,7 +593,7 @@ class RevisionBehaviorTest extends CakeTestCase {
 
 		$Comment = new RevisionComment();
 
-		$original_comments = $Comment->find('all');
+		$originalComments = $Comment->find('all');
 
 		$data = array('Vote' => array(
 				'id' => 3,
@@ -622,9 +622,9 @@ class RevisionBehaviorTest extends CakeTestCase {
 
 		$this->assertTrue((bool)$Comment->revertToDate('2008-12-09'));
 
-		$reverted_comments = $Comment->find('all');
+		$revertedComments = $Comment->find('all');
 
-		$this->assertEquals($original_comments, $reverted_comments);
+		$this->assertEquals($originalComments, $revertedComments);
 	}
 
 	public function testCreateRevision() {
@@ -1010,12 +1010,12 @@ class RevisionBehaviorTest extends CakeTestCase {
 		$Comment->bindModel(array('hasAndBelongsToMany' => array('Tag' => array('className' => 'RevisionTag'))), false);
 
 		$Comment->id = 1;
-		$original_result = $Comment->newest();
+		$originalResult = $Comment->newest();
 
 		$Comment->save(array('Comment' => array('id' => 1), 'Tag' => array('Tag' => array(2, 4))));
 
 		$result = $Comment->newest();
-		$this->assertEquals($original_result, $result);
+		$this->assertEquals($originalResult, $result);
 	}
 
 	public function testHabtmRevUndo() {
@@ -1088,48 +1088,48 @@ class RevisionBehaviorTest extends CakeTestCase {
 
 		$Comment->bindModel(array('hasAndBelongsToMany' => array('Tag' => array('className' => 'RevisionTag'))), false);
 
-		$comment_one = $Comment->find('first', array('conditions' => array('Comment.id' => 1), 'contain' => 'Tag'));
-		$this->assertEquals($comment_one['Comment']['title'], 'Comment 1');
-		$this->assertEquals(Set::extract($comment_one, 'Tag.{n}.id'), array(
+		$commentOne = $Comment->find('first', array('conditions' => array('Comment.id' => 1), 'contain' => 'Tag'));
+		$this->assertEquals($commentOne['Comment']['title'], 'Comment 1');
+		$this->assertEquals(Set::extract($commentOne, 'Tag.{n}.id'), array(
 			1,
 			2,
 			3));
 		$Comment->id = 1;
-		$rev_one = $Comment->newest();
-		$this->assertEquals($rev_one['Comment']['title'], 'Comment 1');
-		$this->assertEquals($rev_one['Comment']['Tag'], '1,2,3');
-		$version_id = $rev_one['Comment']['version_id'];
+		$revOne = $Comment->newest();
+		$this->assertEquals($revOne['Comment']['title'], 'Comment 1');
+		$this->assertEquals($revOne['Comment']['Tag'], '1,2,3');
+		$versionId = $revOne['Comment']['version_id'];
 
 		$Comment->create(array('Comment' => array('id' => 1, 'title' => 'Edited')));
 		$Comment->save();
 
-		$comment_one = $Comment->find('first', array('conditions' => array('Comment.id' => 1), 'contain' => 'Tag'));
-		$this->assertEquals($comment_one['Comment']['title'], 'Edited');
-		$result = Set::extract($comment_one, 'Tag.{n}.id');
+		$commentOne = $Comment->find('first', array('conditions' => array('Comment.id' => 1), 'contain' => 'Tag'));
+		$this->assertEquals($commentOne['Comment']['title'], 'Edited');
+		$result = Set::extract($commentOne, 'Tag.{n}.id');
 		$expected = array(
 			1,
 			2,
 			3);
 		$this->assertEquals($expected, $result);
 		$Comment->id = 1;
-		$rev_one = $Comment->newest();
-		$this->assertEquals($rev_one['Comment']['title'], 'Edited');
-		$this->assertEquals($rev_one['Comment']['Tag'], '1,2,3');
+		$revOne = $Comment->newest();
+		$this->assertEquals($revOne['Comment']['title'], 'Edited');
+		$this->assertEquals($revOne['Comment']['Tag'], '1,2,3');
 
 		$Comment->revertTo(1);
 
-		$comment_one = $Comment->find('first', array('conditions' => array('Comment.id' => 1), 'contain' => 'Tag'));
-		$this->assertEquals($comment_one['Comment']['title'], 'Comment 1');
-		$result = Set::extract($comment_one, 'Tag.{n}.id');
+		$commentOne = $Comment->find('first', array('conditions' => array('Comment.id' => 1), 'contain' => 'Tag'));
+		$this->assertEquals($commentOne['Comment']['title'], 'Comment 1');
+		$result = Set::extract($commentOne, 'Tag.{n}.id');
 		//TODO: assert
 		$this->assertEquals($result, array(
 			3,
 			2,
 			1));
 		$Comment->id = 1;
-		$rev_one = $Comment->newest();
-		$this->assertEquals($rev_one['Comment']['title'], 'Comment 1');
-		$this->assertEquals($rev_one['Comment']['Tag'], '1,2,3');
+		$revOne = $Comment->newest();
+		$this->assertEquals($revOne['Comment']['title'], 'Comment 1');
+		$this->assertEquals($revOne['Comment']['Tag'], '1,2,3');
 	}
 
 	public function testHabtmRevRevertToDate() {
@@ -1377,11 +1377,11 @@ class RevisionArticle extends RevisionTestModel {
 	 * of a deleted node.
 	 */
 	public function afterUndelete() {
-		$former_children = $this->ShadowModel->find('list', array(
+		$formerChildren = $this->ShadowModel->find('list', array(
 			'conditions' => array('parent_id' => $this->id),
 			'distinct' => true,
 			'order' => 'version_created DESC, version_id DESC'));
-		foreach (array_keys($former_children) as $cid) {
+		foreach (array_keys($formerChildren) as $cid) {
 			$this->id = $cid;
 			$this->undelete();
 		}

+ 2 - 2
View/Helper/DatetimeHelper.php

@@ -35,14 +35,14 @@ class DatetimeHelper extends TimeHelper {
 	 * @param
 	 * @return integer offset
 	 */
-	public function tzOffset($gmtoffset, $is_dst) {
+	public function tzOffset($gmtoffset, $isDst) {
 		//global $gmtoffset, $is_dst;
 
 		extract(getdate());
 		$serveroffset = gmmktime(0, 0, 0, $mon, $mday, $year) - mktime(0, 0, 0, $mon, $mday, $year);
 		$offset = $gmtoffset - $serveroffset;
 
-		return $offset + ($is_dst ? 3600 : 0);
+		return $offset + ($isDst ? 3600 : 0);
 	}
 
 	/**

+ 22 - 22
View/Helper/FormatHelper.php

@@ -380,11 +380,11 @@ class FormatHelper extends TextHelper {
 			$alt = '';
 		}
 
-		$default_options = array('title' => $title, 'alt' => $alt, 'class' => 'icon');
+		$defaultOptions = array('title' => $title, 'alt' => $alt, 'class' => 'icon');
 		//$new_options['onclick']=$options['onclick'];
-		$new_options = array_merge($default_options, $options);
+		$newOptions = array_merge($defaultOptions, $options);
 
-		$html .= $this->Html->image('icons/' . $pic, $new_options);
+		$html .= $this->Html->image('icons/' . $pic, $newOptions);
 
 		return $html;
 	}
@@ -506,7 +506,7 @@ class FormatHelper extends TextHelper {
 			'it' => array('title' => 'Italiano'),
 		);
 
-		$language_change = __('Language') . ': ';
+		$languageChange = __('Language') . ': ';
 
 		$languages = array();
 		foreach ($langs as $lang) {
@@ -521,14 +521,14 @@ class FormatHelper extends TextHelper {
 		echo '<span class="country">';
 		foreach ($languages as $code => $la) {
 			if ($lang == $code) {
-				$language_change .= $this->Html->image('language_flags/' . $code . '.gif', array('alt' => $code, 'title' => $la['title'] . ' (' . __('active') . ')', 'class' => 'country_flag active')) . '';
+				$languageChange .= $this->Html->image('language_flags/' . $code . '.gif', array('alt' => $code, 'title' => $la['title'] . ' (' . __('active') . ')', 'class' => 'country_flag active')) . '';
 			} else {
-				$language_change .= $this->Html->link($this->Html->image('language_flags/' . $code . '.gif', array('alt' => $code, 'title' => $la['title'], 'class' => 'country_flag')), '/lang/' . $code, array('escape' => false)) . '';
+				$languageChange .= $this->Html->link($this->Html->image('language_flags/' . $code . '.gif', array('alt' => $code, 'title' => $la['title'], 'class' => 'country_flag')), '/lang/' . $code, array('escape' => false)) . '';
 			}
 		}
 
-		$language_change .= '</span>'; //.__('(Translation not complete yet)');
-		return $language_change;
+		$languageChange .= '</span>'; //.__('(Translation not complete yet)');
+		return $languageChange;
 	}
 
 	/**
@@ -1222,7 +1222,7 @@ class FormatHelper extends TextHelper {
 		#Options
 		$strict = false;
 		$ending = CHAR_HELLIP; //'...';
-		$remain_lf = false; // not implemented: choose if LF transformed to ' '
+		$remainLf = false; // not implemented: choose if LF transformed to ' '
 		$class = 'help';
 		$escape = true;
 		$title = '';
@@ -1232,7 +1232,7 @@ class FormatHelper extends TextHelper {
 				$strict = $options['strict'];
 			}
 			if (!empty($options['remain_lf']) && ($options['remain_lf'] === true || $options['remain_lf'] === false)) {
-				$remain_lf = $options['remain_lf'];
+				$remainLf = $options['remain_lf'];
 			}
 
 			if (isset($options['title'])) {
@@ -1304,35 +1304,35 @@ class FormatHelper extends TextHelper {
 	public function tab2space($text, $spaces = 4) {
 		$spaces = str_repeat(" ", $spaces);
 		$text = preg_split("/\r\n|\r|\n/", trim($text));
-		$word_lengths = array();
-		$w_array = array();
+		$wordLengths = array();
+		$wArray = array();
 
 		// Store word lengths
 		foreach ($text as $line) {
 			$words = preg_split("/(\t+)/", $line, -1, PREG_SPLIT_DELIM_CAPTURE);
 			foreach (array_keys($words) as $i) {
 				$strlen = strlen($words[$i]);
-				$add = isset($word_lengths[$i]) && ($word_lengths[$i] < $strlen);
-				if ($add || !isset($word_lengths[$i])) {
-					$word_lengths[$i] = $strlen;
+				$add = isset($wordLengths[$i]) && ($wordLengths[$i] < $strlen);
+				if ($add || !isset($wordLengths[$i])) {
+					$wordLengths[$i] = $strlen;
 				}
 			}
-			$w_array[] = $words;
+			$wArray[] = $words;
 		}
 
 		// Clear $text
 		$text = '';
 
 		// Apply padding when appropriate and rebuild the string
-		foreach (array_keys($w_array) as $i) {
-			foreach (array_keys($w_array[$i]) as $ii) {
-				if (preg_match("/^\t+$/", $w_array[$i][$ii])) {
-					$w_array[$i][$ii] = str_pad($w_array[$i][$ii], $word_lengths[$ii], "\t");
+		foreach (array_keys($wArray) as $i) {
+			foreach (array_keys($wArray[$i]) as $ii) {
+				if (preg_match("/^\t+$/", $wArray[$i][$ii])) {
+					$wArray[$i][$ii] = str_pad($wArray[$i][$ii], $wordLengths[$ii], "\t");
 				} else {
-					$w_array[$i][$ii] = str_pad($w_array[$i][$ii], $word_lengths[$ii]);
+					$wArray[$i][$ii] = str_pad($wArray[$i][$ii], $wordLengths[$ii]);
 				}
 			}
-			$text .= str_replace("\t", $spaces, implode("", $w_array[$i])) . "\n";
+			$text .= str_replace("\t", $spaces, implode("", $wArray[$i])) . "\n";
 		}
 
 		// Finished

+ 50 - 50
View/Helper/GoogleMapV3Helper.php

@@ -2,7 +2,7 @@
 /**
  * PHP5 / CakePHP 2.x
  */
- App::uses('AppHelper', 'View/Helper');
+App::uses('AppHelper', 'View/Helper');
 
 /**
  * This is a CakePHP helper that helps users to integrate GoogleMap v3
@@ -37,15 +37,15 @@
  */
 class GoogleMapV3Helper extends AppHelper {
 
-	public static $MAP_COUNT = 0;
+	public static $mapCount = 0;
 
-	public static $MARKER_COUNT = 0;
+	public static $markerCount = 0;
 
-	public static $ICON_COUNT = 0;
+	public static $iconCount = 0;
 
-	public static $INFO_WINDOW_COUNT = 0;
+	public static $infoWindowCount = 0;
 
-	public static $INFO_CONTENT_COUNT = 0;
+	public static $infoContentCount = 0;
 
 	const API = 'maps.google.com/maps/api/js?';
 
@@ -316,7 +316,7 @@ class GoogleMapV3Helper extends AppHelper {
 	 * @return string currentMapObject
 	 */
 	public function name() {
-		return 'map' . self::$MAP_COUNT;
+		return 'map' . self::$mapCount;
 	}
 
 	/**
@@ -334,7 +334,7 @@ class GoogleMapV3Helper extends AppHelper {
 	 */
 	public function reset($full = true) {
 		//self::$MAP_COUNT
-		self::$MARKER_COUNT = self::$INFO_WINDOW_COUNT = 0;
+		self::$markerCount = self::$infoWindowCount = 0;
 		$this->markers = $this->infoWindows = array();
 		if ($full) {
 			$this->_currentOptions = $this->_defaultOptions;
@@ -432,9 +432,9 @@ class GoogleMapV3Helper extends AppHelper {
 			var myOptions = " . $this->_mapOptions() . ";
 
 			// deprecated
-			gMarkers" . self::$MAP_COUNT . " = new Array();
-			gInfoWindows" . self::$MAP_COUNT . " = new Array();
-			gWindowContents" . self::$MAP_COUNT . " = new Array();
+			gMarkers" . self::$mapCount . " = new Array();
+			gInfoWindows" . self::$mapCount . " = new Array();
+			gWindowContents" . self::$mapCount . " = new Array();
 		";
 
 		#rename "map_canvas" to "map_canvas1", ... if multiple maps on one page
@@ -508,7 +508,7 @@ class GoogleMapV3Helper extends AppHelper {
 		if (isset($options['icon'])) {
 			$params['icon'] = $options['icon'];
 			if (is_int($params['icon'])) {
-				$params['icon'] = 'gIcons' . self::$MAP_COUNT . '[' . $params['icon'] . ']';
+				$params['icon'] = 'gIcons' . self::$mapCount . '[' . $params['icon'] . ']';
 			} else {
 				$params['icon'] = json_encode($params['icon']);
 			}
@@ -516,7 +516,7 @@ class GoogleMapV3Helper extends AppHelper {
 		if (isset($options['shadow'])) {
 			$params['shadow'] = $options['shadow'];
 			if (is_int($params['shadow'])) {
-				$params['shadow'] = 'gIcons' . self::$MAP_COUNT . '[' . $params['shadow'] . ']';
+				$params['shadow'] = 'gIcons' . self::$mapCount . '[' . $params['shadow'] . ']';
 			} else {
 				$params['shadow'] = json_encode($params['shadow']);
 			}
@@ -540,12 +540,12 @@ function geocodeAddress(address) {
 	geocoder.geocode({'address': address}, function(results, status) {
 		if (status == google.maps.GeocoderStatus.OK) {
 
-			x" . self::$MARKER_COUNT . " = new google.maps.Marker({
+			x" . self::$markerCount . " = new google.maps.Marker({
 				position: results[0].geometry.location,
 				" . $this->_toObjectParams($params, false, false) . "
 			});
-			gMarkers" . self::$MAP_COUNT . " .push(
-				x" . self::$MARKER_COUNT . "
+			gMarkers" . self::$mapCount . " .push(
+				x" . self::$markerCount . "
 			);
 			return results[0].geometry.location;
 		} else {
@@ -563,12 +563,12 @@ function geocodeAddress(address) {
 		}
 
 		$marker = "
-			var x" . self::$MARKER_COUNT . " = new google.maps.Marker({
+			var x" . self::$markerCount . " = new google.maps.Marker({
 				position: " . $position . ",
 				" . $this->_toObjectParams($params, false, false) . "
 			});
-			gMarkers" . self::$MAP_COUNT . " .push(
-				x" . self::$MARKER_COUNT . "
+			gMarkers" . self::$mapCount . " .push(
+				x" . self::$markerCount . "
 			);
 		";
 		$this->map .= $marker;
@@ -580,7 +580,7 @@ function geocodeAddress(address) {
 		// Fill popup windows
 		if (!empty($options['content']) && $this->_currentOptions['infoWindow']['useMultiple']) {
 			$x = $this->addInfoWindow(array('content' => $options['content']));
-			$this->addEvent(self::$MARKER_COUNT, $x, $options['open']);
+			$this->addEvent(self::$markerCount, $x, $options['open']);
 
 		} elseif (!empty($options['content'])) {
 			if (!isset($this->_currentOptions['marker']['infoWindow'])) {
@@ -589,10 +589,10 @@ function geocodeAddress(address) {
 
 			$x = $this->addInfoContent($options['content']);
 			$event = "
-			gInfoWindows" . self::$MAP_COUNT . "[" . $this->_currentOptions['marker']['infoWindow'] . "]. setContent(gWindowContents" . self::$MAP_COUNT . "[" . $x . "]);
-			gInfoWindows" . self::$MAP_COUNT . "[" . $this->_currentOptions['marker']['infoWindow'] . "].open(" . $this->name() . ", gMarkers" . self::$MAP_COUNT . "[" . $x . "]);
+			gInfoWindows" . self::$mapCount . "[" . $this->_currentOptions['marker']['infoWindow'] . "]. setContent(gWindowContents" . self::$mapCount . "[" . $x . "]);
+			gInfoWindows" . self::$mapCount . "[" . $this->_currentOptions['marker']['infoWindow'] . "].open(" . $this->name() . ", gMarkers" . self::$mapCount . "[" . $x . "]);
 			";
-			$this->addCustomEvent(self::$MARKER_COUNT, $event);
+			$this->addCustomEvent(self::$markerCount, $event);
 
 			if (!empty($options['open'])) {
 				$this->addCustom($event);
@@ -601,10 +601,10 @@ function geocodeAddress(address) {
 
 		// Custom matching event?
 		if (isset($options['id'])) {
-			$this->matching[$options['id']] = self::$MARKER_COUNT;
+			$this->matching[$options['id']] = self::$markerCount;
 		}
 
-		return self::$MARKER_COUNT++;
+		return self::$markerCount++;
 	}
 
 	/**
@@ -659,14 +659,14 @@ function geocodeAddress(address) {
 	 * @return integer Current marker counter
 	 */
 	public function addInfoContent($content) {
-		$this->infoContents[self::$MARKER_COUNT] = $this->escapeString($content);
+		$this->infoContents[self::$markerCount] = $this->escapeString($content);
 		$event = "
-			gWindowContents" . self::$MAP_COUNT . " .push(" . $this->escapeString($content) . ");
+			gWindowContents" . self::$mapCount . " .push(" . $this->escapeString($content) . ");
 			";
 		$this->addCustom($event);
 
 		//TODO: own count?
-		return self::$MARKER_COUNT;
+		return self::$markerCount;
 	}
 
 	public $setIcons = array(
@@ -809,9 +809,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::$ICON_COUNT] = $icon;
-		$this->_iconRemember[self::$ICON_COUNT] = array('url' => $url, 'options' => $options, 'id' => self::$ICON_COUNT);
-		return self::$ICON_COUNT++;
+		$this->icons[self::$iconCount] = $icon;
+		$this->_iconRemember[self::$iconCount] = array('url' => $url, 'options' => $options, 'id' => self::$iconCount);
+		return self::$iconCount++;
 	}
 
 	/**
@@ -832,7 +832,7 @@ var iconShape = {
 		}
 
 		$windows = "
-			gInfoWindows" . self::$MAP_COUNT . " .push( new google.maps.InfoWindow({
+			gInfoWindows" . self::$mapCount . " .push( new google.maps.InfoWindow({
 					position: {$position},
 					content: " . $this->escapeString($options['content']) . ",
 					maxWidth: {$options['maxWidth']},
@@ -841,7 +841,7 @@ var iconShape = {
 			}));
 			";
 		$this->map .= $windows;
-		return self::$INFO_WINDOW_COUNT++;
+		return self::$infoWindowCount++;
 	}
 
 	/**
@@ -854,13 +854,13 @@ var iconShape = {
 	 */
 	public function addEvent($marker, $infoWindow, $open = false) {
 		$this->map .= "
-			google.maps.event.addListener(gMarkers" . self::$MAP_COUNT . "[{$marker}], 'click', function() {
-				gInfoWindows" . self::$MAP_COUNT . "[$infoWindow].open(" . $this->name() . ", this);
+			google.maps.event.addListener(gMarkers" . self::$mapCount . "[{$marker}], 'click', function() {
+				gInfoWindows" . self::$mapCount . "[$infoWindow].open(" . $this->name() . ", this);
 			});
 		";
 		if ($open) {
-			$event = "gInfoWindows" . self::$MAP_COUNT . "[$infoWindow].open(" . $this->name() .
-				", gMarkers" . self::$MAP_COUNT . "[" . $marker . "]);";
+			$event = "gInfoWindows" . self::$mapCount . "[$infoWindow].open(" . $this->name() .
+				", gMarkers" . self::$mapCount . "[" . $marker . "]);";
 			$this->addCustom($event);
 		}
 	}
@@ -874,7 +874,7 @@ var iconShape = {
 	 */
 	public function addCustomEvent($marker, $event) {
 		$this->map .= "
-			google.maps.event.addListener(gMarkers" . self::$MAP_COUNT . "[{$marker}], 'click', function() {
+			google.maps.event.addListener(gMarkers" . self::$mapCount . "[{$marker}], 'click', function() {
 				$event
 			});
 		";
@@ -910,7 +910,7 @@ var iconShape = {
 	 * @return void
 	 */
 	public function addDirections($from, $to, $options = array()) {
-		$id = 'd' . self::$MARKER_COUNT++;
+		$id = 'd' . self::$markerCount++;
 		$defaults = $this->_currentOptions['directions'];
 		$options += $defaults;
 		$travelMode = $this->travelModes[$options['travelMode']];
@@ -984,7 +984,7 @@ var iconShape = {
 		$defaults = $this->_currentOptions['polyline'];
 		$options += $defaults;
 
-		$id = 'p' . self::$MARKER_COUNT++;
+		$id = 'p' . self::$markerCount++;
 
 		$polyline = "var start = $from;";
 		$polyline .= "var end = $to;";
@@ -1011,7 +1011,7 @@ var iconShape = {
 	 */
 	public function setContentInfoWindow($con, $index) {
 		$this->map .= "
-			gInfoWindows" . self::$MAP_COUNT . "[$index]. setContent(" . $this->escapeString($con) . ");";
+			gInfoWindows" . self::$mapCount . "[$index]. setContent(" . $this->escapeString($con) . ");";
 	}
 
 	/**
@@ -1047,7 +1047,7 @@ var iconShape = {
 	 */
 	public function finalize($return = false) {
 		$script = $this->_arrayToObject('matching', $this->matching, false, true) . '
-		' . $this->_arrayToObject('gIcons' . self::$MAP_COUNT, $this->icons, false, false) . '
+		' . $this->_arrayToObject('gIcons' . self::$mapCount, $this->icons, false, false) . '
 
 	jQuery(document).ready(function() {
 		';
@@ -1067,7 +1067,7 @@ var iconShape = {
 		$script .= '
 
 	});';
-		self::$MAP_COUNT++;
+		self::$mapCount++;
 		if ($return) {
 			return $script;
 		}
@@ -1152,7 +1152,7 @@ var iconShape = {
 	protected function _autoCenter() {
 		return '
 		var bounds = new google.maps.LatLngBounds();
-		$.each(gMarkers' . self::$MAP_COUNT . ',function (index, marker) { bounds.extend(marker.position);});
+		$.each(gMarkers' . self::$mapCount . ',function (index, marker) { bounds.extend(marker.position);});
 		' . $this->name() . ' .fitBounds(bounds);
 		';
 	}
@@ -1627,12 +1627,12 @@ http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/
 	 */
 	public function setManager() {
 		$js .= '
-		var mgr' . self::$MAP_COUNT . ' = new MarkerManager(' . $this->name() . ');
+		var mgr' . self::$mapCount . ' = new MarkerManager(' . $this->name() . ');
 		';
 	}
 
 	public function addManagerMarker($marker, $options) {
-		$js = 'mgr' . self::$MAP_COUNT . ' .addMarker(' . $marker . ');';
+		$js = 'mgr' . self::$mapCount . ' .addMarker(' . $marker . ');';
 	}
 
 	/**
@@ -1646,21 +1646,21 @@ http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/
 	public function setCluster($options) {
 		$js = self::$flusterScript;
 		$js .= '
-		var fluster' . self::$MAP_COUNT . ' = new Fluster2(' . $this->name() . ');
+		var fluster' . self::$mapCount . ' = new Fluster2(' . $this->name() . ');
 		';
 
 		# styles
-		'fluster' . self::$MAP_COUNT . '.styles = {}';
+		'fluster' . self::$mapCount . '.styles = {}';
 
 		$this->map .= $js;
 	}
 
 	public function addClusterMarker($marker, $options) {
-		$js = 'fluster' . self::$MAP_COUNT . '.addMarker(' . $marker . ');';
+		$js = 'fluster' . self::$mapCount . '.addMarker(' . $marker . ');';
 	}
 
 	public function initCluster() {
-		$this->map .= 'fluster' . self::$MAP_COUNT . '.initialize();';
+		$this->map .= 'fluster' . self::$mapCount . '.initialize();';
 	}
 
 	public static $flusterScript = '

+ 38 - 38
View/Helper/PhpThumbHelper.php

@@ -20,38 +20,38 @@ class PhpThumbHelper extends AppHelper {
 	protected function init($options = array()) {
 		$this->options = $options;
 		$this->set_file_extension();
-		$this->thumb_data = array();
+		$this->thumbData = array();
 		$this->error = 0;
 	}
 
 	protected function set_file_extension() {
-		$this->file_extension = mb_substr($this->options['src'], mb_strrpos($this->options['src'], '.'), mb_strlen($this->options['src']));
+		$this->fileExtension = mb_substr($this->options['src'], mb_strrpos($this->options['src'], '.'), mb_strlen($this->options['src']));
 	}
 
 	protected function set_cache_filename() {
 		ksort($this->options);
-		$filename_parts = array();
-		$cacheable_properties = array('src', 'new', 'w', 'h', 'wp', 'hp', 'wl', 'hl', 'ws', 'hs', 'f', 'q', 'sx', 'sy', 'sw', 'sh', 'zc', 'bc', 'bg', 'fltr');
+		$filenameParts = array();
+		$cacheableProperties = array('src', 'new', 'w', 'h', 'wp', 'hp', 'wl', 'hl', 'ws', 'hs', 'f', 'q', 'sx', 'sy', 'sw', 'sh', 'zc', 'bc', 'bg', 'fltr');
 
 		foreach ($this->options as $key => $value) {
-			if (in_array($key, $cacheable_properties)) {
-				$filename_parts[$key] = $value;
+			if (in_array($key, $cacheableProperties)) {
+				$filenameParts[$key] = $value;
 			}
 		}
 
-		$this->cache_filename = '';
+		$this->cacheFilename = '';
 
-		foreach ($filename_parts as $key => $value) {
-			$this->cache_filename .= $key . $value;
+		foreach ($filenameParts as $key => $value) {
+			$this->cacheFilename .= $key . $value;
 		}
 
-		$last_modified = ''; //date("F d Y H:i:s.", filectime($this->options['src']));
+		$lastModified = ''; //date("F d Y H:i:s.", filectime($this->options['src']));
 
-		$this->cache_filename = $this->options['save_path'] . DS . md5($this->cache_filename . $last_modified) . $this->file_extension;
+		$this->cacheFilename = $this->options['save_path'] . DS . md5($this->cacheFilename . $lastModified) . $this->fileExtension;
 	}
 
 	protected function image_is_cached() {
-		if (is_file($this->cache_filename)) {
+		if (is_file($this->cacheFilename)) {
 			return true;
 		}
 		return false;
@@ -66,20 +66,20 @@ class PhpThumbHelper extends AppHelper {
 
 		//TODO: make it cleaner
 		# addon
-		$PHPTHUMB_CONFIG = array();
-		$PHPTHUMB_CONFIG['allow_src_above_docroot'] = true;
-		$PHPTHUMB_CONFIG['cache_disable_warning'] = true;
-		$PHPTHUMB_CONFIG['max_source_pixels'] = 1920000;
-		$PHPTHUMB_CONFIG['error_message_image_default'] = 'Image not found';
-		$PHPTHUMB_CONFIG['error_die_on_source_failure'] = true;
+		$phpthumbConfig = array();
+		$phpthumbConfig['allow_src_above_docroot'] = true;
+		$phpthumbConfig['cache_disable_warning'] = true;
+		$phpthumbConfig['max_source_pixels'] = 1920000;
+		$phpthumbConfig['error_message_image_default'] = 'Image not found';
+		$phpthumbConfig['error_die_on_source_failure'] = true;
 
 		if ((int)Configure::read('debug') > 0) {
-			$PHPTHUMB_CONFIG['cache_disable_warning'] = false;
-			$PHPTHUMB_CONFIG['error_die_on_source_failure'] = false;
+			$phpthumbConfig['cache_disable_warning'] = false;
+			$phpthumbConfig['error_die_on_source_failure'] = false;
 		}
 
-			if (!empty($PHPTHUMB_CONFIG)) {
-				foreach ($PHPTHUMB_CONFIG as $key => $value) {
+			if (!empty($phpthumbConfig)) {
+				foreach ($phpthumbConfig as $key => $value) {
 					$keyname = 'config_' . $key;
 					$this->PhpThumb->setParameter($keyname, $value);
 				}
@@ -93,46 +93,46 @@ class PhpThumbHelper extends AppHelper {
 		}
 
 		if ($this->PhpThumb->GenerateThumbnail()) {
-			$this->PhpThumb->RenderToFile($this->cache_filename);
+			$this->PhpThumb->RenderToFile($this->cacheFilename);
 		} else {
 			$this->error = 1;
-			$this->error_detail = ereg_replace("[^A-Za-z0-9\/: .]", "", $this->PhpThumb->fatalerror);
+			$this->errorDetail = ereg_replace("[^A-Za-z0-9\/: .]", "", $this->PhpThumb->fatalerror);
 		}
 	}
 
 	protected function get_thumb_data() {
-		$this->thumb_data['error'] = $this->error;
+		$this->thumbData['error'] = $this->error;
 
 		if ($this->error) {
-			$this->thumb_data['error_detail'] = $this->error_detail;
-			$this->thumb_data['src'] = $this->options['error_image_path'];
+			$this->thumbData['error_detail'] = $this->errorDetail;
+			$this->thumbData['src'] = $this->options['error_image_path'];
 		} else {
-			$this->thumb_data['src'] = $this->options['display_path'] . '/' . mb_substr($this->cache_filename, mb_strrpos($this->cache_filename, DS) + 1, mb_strlen($this->cache_filename));
+			$this->thumbData['src'] = $this->options['display_path'] . '/' . mb_substr($this->cacheFilename, mb_strrpos($this->cacheFilename, DS) + 1, mb_strlen($this->cacheFilename));
 		}
 
 		if (isset($this->options['w'])) {
-			$this->thumb_data['w'] = $this->options['w'];
+			$this->thumbData['w'] = $this->options['w'];
 		}
 
 		if (isset($this->options['h'])) {
-			 $this->thumb_data['h'] = $this->options['h'];
+			 $this->thumbData['h'] = $this->options['h'];
 		}
 
-		return $this->thumb_data;
+		return $this->thumbData;
 	}
 
 	protected function validate() {
 		if (!is_file($this->options['src'])) {
 			$this->error = 1;
-			$this->error_detail = 'File ' . $this->options['src'] . ' does not exist';
+			$this->errorDetail = 'File ' . $this->options['src'] . ' does not exist';
 			return;
 		}
 
-		$valid_extensions = array('.gif', '.jpg', '.jpeg', '.png');
+		$validExtensions = array('.gif', '.jpg', '.jpeg', '.png');
 
-		if (!in_array($this->file_extension, $valid_extensions)) {
+		if (!in_array($this->fileExtension, $validExtensions)) {
 			$this->error = 1;
-			$this->error_detail = 'File ' . $this->options['src'] . ' is not a supported image type';
+			$this->errorDetail = 'File ' . $this->options['src'] . ' is not a supported image type';
 			return;
 		}
 	}
@@ -156,7 +156,7 @@ class PhpThumbHelper extends AppHelper {
 	 * @return string error
 	 */
 	public function error() {
-		return (string)$this->error_detail;
+		return (string)$this->errorDetail;
 	}
 
 /** NOT IN USE YET **/
@@ -164,8 +164,8 @@ class PhpThumbHelper extends AppHelper {
 	/**
 	 * Image tag
 	 */
-	public function show($options = array(), $tag_options = array()) {
-		$this->init($options, $tag_options);
+	public function show($options = array(), $tagOptions = array()) {
+		$this->init($options, $tagOptions);
 		if ($this->image_is_cached()) {
 			return $this->show_image_tag();
 		} else {

+ 2 - 2
View/Helper/TextExtHelper.php

@@ -151,8 +151,8 @@ class TextExtHelper extends TextHelper {
 	 * @return string html with js generated link around email (and non js fallback)
 	 */
 	public function encodeEmailUrl($mail, $text=null, $params=array(), $attr = array()) {
-		if (empty($class)) { 
-			$class = 'email'; 
+		if (empty($class)) {
+			$class = 'email';
 		}
 
 		$defaults = array(

+ 24 - 24
View/Helper/TypographyHelper.php

@@ -29,23 +29,23 @@ App::uses('AppHelper', 'View/Helper');
 class TypographyHelper extends AppHelper {
 
 	// Block level elements that should not be wrapped inside <p> tags
-	public $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul';
+	public $blockElements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul';
 
 	// Elements that should not have <p> and <br /> tags within them.
-	public $skip_elements = 'p|pre|ol|ul|dl|object|table|h\d';
+	public $skipElements = 'p|pre|ol|ul|dl|object|table|h\d';
 
 	// Tags we want the parser to completely ignore when splitting the string.
-	public $inline_elements =
+	public $inlineElements =
 		'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var';
 
 	// array of block level elements that require inner content to be within another block level element
-	public $inner_block_required = array('blockquote');
+	public $innerBlockRequired = array('blockquote');
 
 	// the last block element parsed
-	public $last_block_element = '';
+	public $lastBlockElement = '';
 
 	// whether or not to protect quotes within { curly braces }
-	public $protect_braced_quotes = false;
+	public $protectBracedQuotes = false;
 
 	public $matching = array(
 		'deu' => 'low', // except for Switzerland
@@ -89,11 +89,11 @@ class TypographyHelper extends AppHelper {
 		}
 
 		// HTML comment tags don't conform to patterns of normal tags, so pull them out separately, only if needed
-		$html_comments = array();
+		$htmlComments = array();
 		if (strpos($str, '<!--') !== false) {
 			if (preg_match_all("#(<!\-\-.*?\-\->)#s", $str, $matches)) {
 				for ($i = 0, $total = count($matches[0]); $i < $total; $i++) {
-					$html_comments[] = $matches[0][$i];
+					$htmlComments[] = $matches[0][$i];
 					$str = str_replace($matches[0][$i], '{@HC' . $i . '}', $str);
 				}
 			}
@@ -109,14 +109,14 @@ class TypographyHelper extends AppHelper {
 		$str = preg_replace_callback("#<.+?>#si", array($this, '_protectCharacters'), $str);
 
 		// Do the same with braces if necessary
-		if ($this->protect_braced_quotes === true) {
+		if ($this->protectBracedQuotes === true) {
 			$str = preg_replace_callback("#\{.+?\}#si", array($this, '_protectCharacters'), $str);
 		}
 
 		// Convert "ignore" tags to temporary marker. The parser splits out the string at every tag
 		// it encounters. Certain inline tags, like image tags, links, span tags, etc. will be
 		// adversely affected if they are split out so we'll convert the opening bracket < temporarily to: {@TAG}
-		$str = preg_replace("#<(/*)(" . $this->inline_elements . ")([ >])#i", "{@TAG}\\1\\2\\3", $str);
+		$str = preg_replace("#<(/*)(" . $this->inlineElements . ")([ >])#i", "{@TAG}\\1\\2\\3", $str);
 
 		// Split the string at every tag. This expression creates an array with this prototype:
 		//
@@ -133,21 +133,21 @@ class TypographyHelper extends AppHelper {
 		$str = '';
 		$process = true;
 		$paragraph = false;
-		$current_chunk = 0;
-		$total_chunks = count($chunks);
+		$currentChunk = 0;
+		$totalChunks = count($chunks);
 
 		foreach ($chunks as $chunk) {
-			$current_chunk++;
+			$currentChunk++;
 
 			// Are we dealing with a tag? If so, we'll skip the processing for this cycle.
 			// Well also set the "process" flag which allows us to skip <pre> tags and a few other things.
-			if (preg_match("#<(/*)(" . $this->block_elements . ").*?>#", $chunk, $match)) {
-				if (preg_match("#" . $this->skip_elements . "#", $match[2])) {
+			if (preg_match("#<(/*)(" . $this->blockElements . ").*?>#", $chunk, $match)) {
+				if (preg_match("#" . $this->skipElements . "#", $match[2])) {
 					$process = ($match[1] === '/') ? true : false;
 				}
 
 				if ($match[1] === '') {
-					$this->last_block_element = $match[2];
+					$this->lastBlockElement = $match[2];
 				}
 
 				$str .= $chunk;
@@ -160,7 +160,7 @@ class TypographyHelper extends AppHelper {
 			}
 
 			// Force a newline to make sure end tags get processed by _formatNewlines()
-			if ($current_chunk == $total_chunks) {
+			if ($currentChunk == $totalChunks) {
 				$chunk .= "\n";
 			}
 
@@ -169,19 +169,19 @@ class TypographyHelper extends AppHelper {
 		}
 
 		// No opening block level tag? Add it if needed.
-		if (!preg_match("/^\s*<(?:" . $this->block_elements . ")/i", $str)) {
-			$str = preg_replace("/^(.*?)<(" . $this->block_elements . ")/i", '<p>$1</p><$2', $str);
+		if (!preg_match("/^\s*<(?:" . $this->blockElements . ")/i", $str)) {
+			$str = preg_replace("/^(.*?)<(" . $this->blockElements . ")/i", '<p>$1</p><$2', $str);
 		}
 
 		// Convert quotes, elipsis, em-dashes, non-breaking spaces, and ampersands
 		$str = $this->formatCharacters($str);
 
 		// restore HTML comments
-		for ($i = 0, $total = count($html_comments); $i < $total; $i++) {
+		for ($i = 0, $total = count($htmlComments); $i < $total; $i++) {
 			// remove surrounding paragraph tags, but only if there's an opening paragraph tag
 			// otherwise HTML comments at the ends of paragraphs will have the closing tag removed
 			// if '<p>{@HC1}' then replace <p>{@HC1}</p> with the comment, else replace only {@HC1} with the comment
-			$str = preg_replace('#(?(?=<p>\{@HC' . $i . '\})<p>\{@HC' . $i . '\}(\s*</p>)|\{@HC' . $i . '\})#s', $html_comments[$i], $str);
+			$str = preg_replace('#(?(?=<p>\{@HC' . $i . '\})<p>\{@HC' . $i . '\}(\s*</p>)|\{@HC' . $i . '\})#s', $htmlComments[$i], $str);
 		}
 
 		// Final clean up
@@ -195,10 +195,10 @@ class TypographyHelper extends AppHelper {
 			'/(<p>\W*<p>)+/'	=> '<p>',
 
 			// Clean up stray paragraph tags that appear before block level elements
-			'#<p></p><(' . $this->block_elements . ')#'	=> '<$1',
+			'#<p></p><(' . $this->blockElements . ')#'	=> '<$1',
 
 			// Clean up stray non-breaking spaces preceeding block elements
-			'#(&nbsp;\s*)+<(' . $this->block_elements . ')#'	=> '  <$2',
+			'#(&nbsp;\s*)+<(' . $this->blockElements . ')#'	=> '  <$2',
 
 			// Replace the temporary markers we added earlier
 			'/\{@TAG\}/'		=> '<',
@@ -341,7 +341,7 @@ class TypographyHelper extends AppHelper {
 			return $str;
 		}
 
-		if (strpos($str, "\n") === false && !in_array($this->last_block_element, $this->inner_block_required)) {
+		if (strpos($str, "\n") === false && !in_array($this->lastBlockElement, $this->innerBlockRequired)) {
 			return $str;
 		}