浏览代码

cleanup and doc block corrections

euromark 12 年之前
父节点
当前提交
2a6cbda3b1

+ 13 - 13
Controller/Component/CommonComponent.php

@@ -316,7 +316,7 @@ class CommonComponent extends Component {
 	 * Return current url (with all missing params automatically added).
 	 * Necessary for Router::url() and comparison of urls to work.
 	 *
-	 * @param bool $asString: defaults to false = array
+	 * @param boolean $asString: defaults to false = array
 	 * @return mixed Url
 	 * 2009-12-26 ms
 	 */
@@ -424,8 +424,8 @@ class CommonComponent extends Component {
 	 * otherwise it will use the default url
 	 *
 	 * @param mixed $url
-	 * @param bool $allowSelf if redirect to the same controller/action (url) is allowed
-	 * @param int $status
+	 * @param boolean $allowSelf if redirect to the same controller/action (url) is allowed
+	 * @param integer $status
 	 * returns nothing and automatically redirects
 	 * 2010-11-06 ms
 	 */
@@ -441,7 +441,7 @@ class CommonComponent extends Component {
 	 * Note: Many pre-HTTP/1.1 user agents do not understand the 303 status. When interoperability with such clients is a concern, the 302 status code may be used instead, since most user agents react to a 302 response as described here for 303.
 	 * @see http://en.wikipedia.org/wiki/Post/Redirect/Get
 	 * @param mixed $url
-	 * @param int $status
+	 * @param integer $status
 	 * TODO: change to 303 with backwardscompatability for older browsers...
 	 * 2011-06-14 ms
 	 */
@@ -453,8 +453,8 @@ class CommonComponent extends Component {
 	 * combine auto with post
 	 * also allows whitelisting certain actions for autoRedirect (use Controller::$autoRedirectActions)
 	 * @param mixed $url
-	 * @param bool $conditionalAutoRedirect false to skip whitelisting
-	 * @param int $status
+	 * @param boolean $conditionalAutoRedirect false to skip whitelisting
+	 * @param integer $status
 	 * 2012-03-17 ms
 	 */
 	public function autoPostRedirect($whereTo, $conditionalAutoRedirect = true, $status = 302) {
@@ -580,7 +580,7 @@ class CommonComponent extends Component {
 	 * Opposite of Controller::disableCache()
 	 * TODO: set response class header instead
 	 *
-	 * @param int $seconds
+	 * @param integer $seconds
 	 * @return void
 	 * 2009-12-26 ms
 	 */
@@ -665,7 +665,7 @@ class CommonComponent extends Component {
 	/**
 	 * quick sql debug from controller dynamically
 	 * or statically from just about any other place in the script
-	 * @param bool $die: TRUE to output and die, FALSE to log to file and continue
+	 * @param boolean $die: TRUE to output and die, FALSE to log to file and continue
 	 * 2011-06-30 ms
 	 */
 	public function sql($die = true) {
@@ -1004,7 +1004,7 @@ class CommonComponent extends Component {
 
 	/**
 	 * get the current ip address
-	 * @param bool $safe
+	 * @param boolean $safe
 	 * @return string $ip
 	 * 2011-11-02 ms
 	 */
@@ -1015,7 +1015,7 @@ class CommonComponent extends Component {
 
 	/**
 	 * get the current referer
-	 * @param bool $full (defaults to false and leaves the url untouched)
+	 * @param boolean $full (defaults to false and leaves the url untouched)
 	 * @return string $referer (local or foreign)
 	 * 2011-11-02 ms
 	 */
@@ -1259,7 +1259,7 @@ class CommonComponent extends Component {
 	/**
 	 * returns auto-generated password
 	 * @param string $type: user, ...
-	 * @param int $length (if no type is submitted)
+	 * @param integer $length (if no type is submitted)
 	 * @return pwd on success, empty string otherwise
 	 * @deprecated - use RandomLib
 	 * 2009-12-26 ms
@@ -1332,7 +1332,7 @@ class CommonComponent extends Component {
 	/**
 	 * Get the Corresponding Message to an HTTP Error Code
 	 *
-	 * @param int $code: 100...505
+	 * @param integer $code: 100...505
 	 * @return array $codes if code is NULL, otherwise string $code (empty string on failure)
 	 * 2009-07-21 ms
 	 */
@@ -1405,7 +1405,7 @@ class CommonComponent extends Component {
 
 	/**
 	 * Get the Corresponding Message to an HTTP Error Code
-	 * @param int $code: 4xx...5xx
+	 * @param integer $code: 4xx...5xx
 	 * 2010-06-08 ms
 	 */
 	public function smtpResponseCodes($code = null, $autoTranslate = false) {

+ 1 - 1
Controller/MyController.php

@@ -82,7 +82,7 @@ class MyController extends Controller {
 	 * Additionally encode string to match the htaccess files processing it.
 	 *
 	 * @param mixed Url piece
-	 * @param int $run How many times does the value have to be escaped
+	 * @param integer $run How many times does the value have to be escaped
 	 * @return mixed Escaped piece
 	 */
 	protected function _encodeUrlPiece($value, $run) {

+ 1 - 1
Lib/Auth.php

@@ -116,7 +116,7 @@ class Auth {
 	 * Check if the current session has oen of these roles.
 	 *
 	 * @param mixed $roles
-	 * @param bool $oneRoleIsEnough (if all $roles have to match instead of just one)
+	 * @param boolean $oneRoleIsEnough (if all $roles have to match instead of just one)
 	 * @param mixed $providedRoles
 	 * @return bool Success
 	 */

+ 1 - 1
Lib/Bootstrap/MyBootstrap.php

@@ -403,7 +403,7 @@ function extractPathInfo($type = null, $filename) {
  * Shows pr() messages, even with debug=0
  *
  * @param mixed $content
- * @param bool $collapsedAndExpandable
+ * @param boolean $collapsedAndExpandable
  * @param array $options
  * - class, showHtml, showFrom, jquery, returns, debug
  * 2011-01-19 ms

+ 2 - 2
Lib/EmailLib.php

@@ -543,7 +543,7 @@ class EmailLib extends CakeEmail {
 	/**
 	 * Set/Get wrapLength
 	 *
-	 * @param int $length Must not be more than CakeEmail::LINE_LENGTH_MUST
+	 * @param integer $length Must not be more than CakeEmail::LINE_LENGTH_MUST
 	 * @return int|CakeEmail
 	 */
 	public function wrapLength($length = null) {
@@ -557,7 +557,7 @@ class EmailLib extends CakeEmail {
 	/**
 	 * Set/Get priority
 	 *
-	 * @param int $priority 1 (highest) to 5 (lowest)
+	 * @param integer $priority 1 (highest) to 5 (lowest)
 	 * @return int|CakeEmail
 	 */
 	public function priority($priority = null) {

+ 2 - 2
Lib/GeocodeLib.php

@@ -169,7 +169,7 @@ class GeocodeLib {
 	}
 
 	/**
-	 * @param bool $full
+	 * @param boolean $full
 	 * @return void
 	 */
 	public function reset($full = true) {
@@ -340,7 +340,7 @@ class GeocodeLib {
 
 	/**
 	 * trying to avoid "TOO_MANY_QUERIES" error
-	 * @param bool $raise If the pause length should be raised
+	 * @param boolean $raise If the pause length should be raised
 	 * 2010-06-29 ms
 	 */
 	public function pause($raise = false) {

+ 1 - 1
Lib/IcalLib.php

@@ -36,7 +36,7 @@ class IcalLib {
 	 * - class to upper
 	 *
 	 * @param array $data
-	 * @param bool $addStartAndEnd
+	 * @param boolean $addStartAndEnd
 	 * @return string $icalContent (single vevent)
 	 * 2011-10-10 ms
 	 */

+ 1 - 1
Lib/InlineCssLib.php

@@ -244,7 +244,7 @@ class InlineCssLib {
 	 * _globRecursive
 	 *
 	 * @param string $pattern
-	 * @param int $flags
+	 * @param integer $flags
 	 * @return array
 	 */
 	protected function _globRecursive($pattern, $flags = 0) {

+ 1 - 1
Lib/MimeLib.php

@@ -820,7 +820,7 @@ class MimeLib extends CakeResponse {
 	* @return String $ext The file extension
 	*/
 	protected function _getExtension($file = NULL) {
-		if (!is_null($file)) {
+		if ($file !== null) {
 			$pieces = explode('.', $file);
 			$ext = strtolower(array_pop($pieces));
 			return $ext;

+ 1 - 1
Lib/Misc/ZodiacLib.php

@@ -28,7 +28,7 @@ class ZodiacLib {
 	}
 
 	/**
-	 * @param int $sign
+	 * @param integer $sign
 	 * @return array(array(m, d), array(m, d)) (first is min, second is max)
 	 * 2011-07-13
 	 */

+ 5 - 5
Lib/RandomLib.php

@@ -10,8 +10,8 @@
 class RandomLib {
 
 	/**
-	 * @param int $min
-	 * @param int $max
+	 * @param integer $min
+	 * @param integer $max
 	 * @return random int value
 	 */
 	public static function int($min = 0, $max = 999) {
@@ -127,7 +127,7 @@ class RandomLib {
 	/**
 	 * Generates a password
 	 *
-	 * @param int $length Password length
+	 * @param integer $length Password length
 	 * @return string
 	 * @link https://github.com/CakeDC/users/blob/master/models/user.php#L498
 	 */
@@ -154,7 +154,7 @@ class RandomLib {
 	 * returns auto-generated password
 	 *
 	 * @param string $type: user, ...
-	 * @param int $length (if no type is submitted)
+	 * @param integer $length (if no type is submitted)
 	 * @return pwd on success, empty string otherwise
 	 * 2009-12-26 ms
 	 */
@@ -172,7 +172,7 @@ class RandomLib {
 	 * //TODO: move to password lib?
 	 * Generate random passwords
 	 *
-	 * @param int $lenght (necessary!)
+	 * @param integer $lenght (necessary!)
 	 * @return string Password
 	 * 2009-12-26 ms
 	 */

+ 3 - 3
Lib/Utility/ChmodLib.php

@@ -127,9 +127,9 @@ class ChmodLib {
 	/**
 	 * ChmodLib::setMode()
 	 *
-	 * @param int $r
-	 * @param int $w
-	 * @param int $e
+	 * @param integer $r
+	 * @param integer $w
+	 * @param integer $e
 	 * @return int
 	 */
 	protected function setMode($r, $w, $e) {

+ 1 - 1
Lib/Utility/FileLib.php

@@ -43,7 +43,7 @@ class FileLib extends File {
 	/**
 	 * A better csv reader which handles encoding as well as removes completely empty lines
 	 *
-	 * @param int $length (0 = no limit)
+	 * @param integer $length (0 = no limit)
 	 * @param string $delimiter (null defaults to ,)
 	 * @param string $enclosure (null defaults to " - do not pass empty string)
 	 * @param string $mode

+ 4 - 4
Lib/Utility/NumberLib.php

@@ -80,7 +80,7 @@ class NumberLib extends CakeNumber {
 	 * should not be used for currencies
 	 *
 	 * @param float $number
-	 * @param int $places (0 = int, 1..x places after dec, -1..-x places before dec)
+	 * @param integer $places (0 = int, 1..x places after dec, -1..-x places before dec)
 	 * @param array $option : currency=true/false, ... (leave empty for no special treatment)
 	 * //TODO: automize per localeconv() ?
 	 * 2009-04-03 ms
@@ -223,7 +223,7 @@ class NumberLib extends CakeNumber {
 	/**
 	 * get the rounded average
 	 * @param array $values: int or float values
-	 * @param int $precision
+	 * @param integer $precision
 	 * @return int $average
 	 * 2009-09-05 ms
 	 */
@@ -253,7 +253,7 @@ class NumberLib extends CakeNumber {
 	 * Round value up
 	 *
 	 * @param float $number
-	 * @param int $increment
+	 * @param integer $increment
 	 * @return float $result
 	 * 2011-04-14 lb
 	 */
@@ -265,7 +265,7 @@ class NumberLib extends CakeNumber {
 	 * Round value down
 	 *
 	 * @param float $number
-	 * @param int $increment
+	 * @param integer $increment
 	 * @return float $result
 	 * 2011-04-14 lb
 	 */

+ 2 - 2
Lib/Utility/NumberTextLib.php

@@ -48,10 +48,10 @@ class NumberTextLib {
 	 */
 	public static function numberText($input = '', $lang = '') {
 		$s = self::getLangModule($lang);
-		if (is_null($s)) {
+		if ($s === null) {
 			$s = self::load($lang);
 		}
-		if (is_null($s)) {
+		if ($s === null) {
 			return null;
 		}
 		return $s->run($input);

+ 15 - 15
Lib/Utility/Str.php

@@ -38,7 +38,7 @@ final class Str {
 	 *
 	 * @param mixed $needle
 	 * @param string $haystack
-	 * @param bool $beforeNeedle (defaults to false)
+	 * @param boolean $beforeNeedle (defaults to false)
 	 * @return mixed
 	 */
 	final public static function str($needle, $haystack, $beforeNeedle = false) {
@@ -50,7 +50,7 @@ final class Str {
 	 *
 	 * @param mixed $needle
 	 * @param string $haystack
-	 * @param bool $beforeNeedle (defaults to false)
+	 * @param boolean $beforeNeedle (defaults to false)
 	 * @return mixed
 	 */
 	final public static function iStr($needle, $haystack, $beforeNeedle = false) {
@@ -62,7 +62,7 @@ final class Str {
 	 *
 	 * @param mixed $needle
 	 * @param string $haystack
-	 * @param bool $beforeNeedle (defaults to false)
+	 * @param boolean $beforeNeedle (defaults to false)
 	 * @return mixed
 	 */
 	final public static function chr($needle, $haystack, $beforeNeedle = false) {
@@ -90,7 +90,7 @@ final class Str {
 	 * @param mixed $search
 	 * @param mixed $replace
 	 * @param mixed $subject
-	 * @param int $count Reference to store count in
+	 * @param integer $count Reference to store count in
 	 * @return mixed
 	 */
 	final public static function replace($search, $replace, $subject, &$count = null) {
@@ -103,7 +103,7 @@ final class Str {
 	 * @param mixed $search
 	 * @param mixed $replace
 	 * @param mixed $subject
-	 * @param int $count Reference to store count in
+	 * @param integer $count Reference to store count in
 	 * @return mixed
 	 */
 	final public static function iReplace($search, $replace, $subject, &$count = null) {
@@ -126,8 +126,8 @@ final class Str {
 	 *
 	 * @param string $needle
 	 * @param string $haystack
-	 * @param int $offset
-	 * @param int $length
+	 * @param integer $offset
+	 * @param integer $length
 	 * @return int
 	 */
 	final public static function count($needle, $haystack, $offset = 0, $length = null) {
@@ -143,8 +143,8 @@ final class Str {
 	 *
 	 * @param string $mainStr
 	 * @param string $str
-	 * @param int $offset
-	 * @param int $length
+	 * @param integer $offset
+	 * @param integer $length
 	 * @return mixed
 	 */
 	final public static function compare($mainStr, $str, $offset = 0, $length = null) {
@@ -156,8 +156,8 @@ final class Str {
 	 *
 	 * @param string $mainStr
 	 * @param string $str
-	 * @param int $offset
-	 * @param int $length
+	 * @param integer $offset
+	 * @param integer $length
 	 * @return mixed
 	 */
 	final public static function iCompare($mainStr, $str, $offset = 0, $length = null) {
@@ -170,7 +170,7 @@ final class Str {
 	 *
 	 * @param string $needle
 	 * @param string $haystack
-	 * @param int $offset
+	 * @param integer $offset
 	 * @return mixed
 	 */
 	final public static function pos($needle, $haystack, $offset = 0) {
@@ -182,7 +182,7 @@ final class Str {
 	 *
 	 * @param string $needle
 	 * @param string $haystack
-	 * @param int $offset
+	 * @param integer $offset
 	 * @return mixed
 	 */
 	final public static function iPos($needle, $haystack, $offset = 0) {
@@ -195,7 +195,7 @@ final class Str {
 	 *
 	 * @param string $needle
 	 * @param string $haystack
-	 * @param int $offset
+	 * @param integer $offset
 	 * @return mixed
 	 */
 	final public static function lastPos($needle, $haystack, $offset = 0) {
@@ -207,7 +207,7 @@ final class Str {
 	 *
 	 * @param string $needle
 	 * @param string $haystack
-	 * @param int $offset
+	 * @param integer $offset
 	 * @return mixed
 	 */
 	final public static function iLastPos($needle, $haystack, $offset = 0) {

+ 18 - 18
Lib/Utility/TimeLib.php

@@ -150,8 +150,8 @@ class TimeLib extends CakeTime {
 	/**
 	 * try to return the age only with the year available
 	 * can be e.g. 22/23
-	 * @param int $year
-	 * @param int $month (optional)
+	 * @param integer $year
+	 * @param integer $month (optional)
 	 * 2011-03-11 ms
 	 */
 	public static function ageByYear($year, $month = null) {
@@ -231,8 +231,8 @@ class TimeLib extends CakeTime {
 
 	/**
 	 * return the days of a given month
-	 * @param int $year
-	 * @param int $month
+	 * @param integer $year
+	 * @param integer $month
 	 * 2011-11-03 ms
 	 */
 	public static function daysInMonth($year, $month) {
@@ -290,7 +290,7 @@ class TimeLib extends CakeTime {
 	 * @FIXME ???
 	 * Get number of days since the start of the week.
 	 * 1 = monday, 7 = sunday ? should be 0=sunday to 7=saturday (default)
-	 * @param int $num Number of day.
+	 * @param integer $num Number of day.
 	 * @return int Days since the start of the week.
 	 */
 	public static function cweekMod($num, $offset = 0) {
@@ -375,8 +375,8 @@ class TimeLib extends CakeTime {
 	 * Handles month/year increment calculations in a safe way, avoiding the pitfall of "fuzzy" month units.
 	 *
 	 * @param mixed $startDate Either a date string or a DateTime object
-	 * @param int $years Years to increment/decrement
-	 * @param int $months Months to increment/decrement
+	 * @param integer $years Years to increment/decrement
+	 * @param integer $months Months to increment/decrement
 	 * @param string|DateTimeZone $timezone Timezone string or DateTimeZone object
 	 * @return object DateTime with incremented/decremented month/year values.
 	 */
@@ -527,9 +527,9 @@ class TimeLib extends CakeTime {
 
 	/**
 	 * return the translation to a specific week day
-	 * @param int $day:
+	 * @param integer $day:
 	 * 0=sunday to 7=saturday (default numbers)
-	 * @param bool $abbr (if abbreviation should be returned)
+	 * @param boolean $abbr (if abbreviation should be returned)
 	 * @param offset: 0-6 (defaults to 0) [1 => 1=monday to 7=sunday]
 	 * @return string $translatedText
 	 * 2011-12-07 ms
@@ -569,9 +569,9 @@ class TimeLib extends CakeTime {
 
 	/**
 	 * return the translation to a specific week day
-	 * @param int $month:
+	 * @param integer $month:
 	 * 1..12
-	 * @param bool $abbr (if abbreviation should be returned)
+	 * @param boolean $abbr (if abbreviation should be returned)
 	 * @param array $options
 	 * - appendDot (only for 3 letter abbr; defaults to false)
 	 * @return string $translatedText
@@ -778,7 +778,7 @@ class TimeLib extends CakeTime {
 	}
 
 	/**
-	 * @param int $offset in seconds
+	 * @param integer $offset in seconds
 	 * @param boolean $past (defaults to null: return plain text)
 	 * - new: if not boolean but a string use this as translating text
 	 * @return string $text (i18n!)
@@ -844,7 +844,7 @@ class TimeLib extends CakeTime {
 
 	/**
 	 * time length to human readable format
-	 * @param int $seconds
+	 * @param integer $seconds
 	 * @param string format: format
 	 * @param options
 	 * - boolean v: verbose
@@ -1002,7 +1002,7 @@ class TimeLib extends CakeTime {
 	 *
 	 * @param string
 	 * @param string
-	 * @param int $timezone User's timezone
+	 * @param integer $timezone User's timezone
 	 * @return string Formatted date
 	 */
 	public static function convertDate($oldDateString, $newDateFormatString, $timezone = null) {
@@ -1014,7 +1014,7 @@ class TimeLib extends CakeTime {
  * Returns true if given datetime string was day before yesterday.
  *
  * @param string $dateString Datetime string or Unix timestamp
- * @param int $timezone User's timezone
+ * @param integer $timezone User's timezone
  * @return boolean True if datetime string was day before yesterday
  */
 	public static function wasDayBeforeYesterday($dateString, $timezone = null) {
@@ -1026,7 +1026,7 @@ class TimeLib extends CakeTime {
  * Returns true if given datetime string is the day after tomorrow.
  *
  * @param string $dateString Datetime string or Unix timestamp
- * @param int $timezone User's timezone
+ * @param integer $timezone User's timezone
  * @return boolean True if datetime string is day after tomorrow
  */
 	public static function isDayAfterTomorrow($dateString, $timezone = null) {
@@ -1038,7 +1038,7 @@ class TimeLib extends CakeTime {
  * Returns true if given datetime string is not today AND is in the future.
  *
  * @param string $dateString Datetime string or Unix timestamp
- * @param int $timezone User's timezone
+ * @param integer $timezone User's timezone
  * @return boolean True if datetime is not today AND is in the future
  */
 	public static function isNotTodayAndInTheFuture($dateString, $timezone = null) {
@@ -1051,7 +1051,7 @@ class TimeLib extends CakeTime {
  * Returns true if given datetime string is not now AND is in the future.
  *
  * @param string $dateString Datetime string or Unix timestamp
- * @param int $timezone User's timezone
+ * @param integer $timezone User's timezone
  * @return boolean True if datetime is not today AND is in the future
  */
 	public static function isInTheFuture($dateString, $timezone = null) {

+ 7 - 7
Lib/Utility/Utility.php

@@ -41,8 +41,8 @@ class Utility {
 	 *
 	 * @param string $pattern The pattern to use.
 	 * @param string $subject The string to match.
-	 * @param int $flags
-	 * @param int $offset
+	 * @param integer $flags
+	 * @param integer $offset
 	 * @return array Result
 	 */
 	public static function pregMatchAll($pattern, $subject, $flags = PREG_SET_ORDER, $offset = null) {
@@ -64,8 +64,8 @@ class Utility {
 	 *
 	 * @param string $pattern The pattern to use.
 	 * @param string $subject The string to match.
-	 * @param int $flags
-	 * @param int $offset
+	 * @param integer $flags
+	 * @param integer $offset
 	 * @return array Result
 	 */
 	public static function pregMatch($pattern, $subject, $flags = null, $offset = null) {
@@ -79,7 +79,7 @@ class Utility {
 	 * By default this works properly with UTF8 strings.
 	 *
 	 * @param string $text
-	 * @param int $length
+	 * @param integer $length
 	 * @return array Result
 	 */
 	public static function strSplit($str, $length = 1) {
@@ -98,7 +98,7 @@ class Utility {
 	/**
 	 * Get the current IP address.
 	 *
-	 * @param bool $safe
+	 * @param boolean $safe
 	 * @return string IP address
 	 * 2011-11-02 ms
 	 */
@@ -126,7 +126,7 @@ class Utility {
 	/**
 	 * Get the current referrer if available.
 	 *
-	 * @param bool $full (defaults to false and leaves the url untouched)
+	 * @param boolean $full (defaults to false and leaves the url untouched)
 	 * @return string $referer (local or foreign)
 	 * 2011-11-02 ms
 	 */

+ 1 - 1
Model/Behavior/BitmaskedBehavior.php

@@ -118,7 +118,7 @@ class BitmaskedBehavior extends ModelBehavior {
 	}
 
 	/**
-	 * @param int $bitmask
+	 * @param integer $bitmask
 	 * @return array $bitmaskArray
 	 * from DB to APP
 	 */

+ 1 - 1
Model/Behavior/GeocoderBehavior.php

@@ -353,7 +353,7 @@ class GeocoderBehavior extends ModelBehavior {
 	/**
 	 * Get the current unit factor
 	 *
-	 * @param int $unit Unit constant
+	 * @param integer $unit Unit constant
 	 * @return float Value
 	 */
 	protected function _calculationValue($unit) {

+ 1 - 1
Model/Behavior/HazardableBehavior.php

@@ -92,7 +92,7 @@ class HazardableBehavior extends ModelBehavior {
 	}
 
 	/**
-	 * @param int $maxLength The lenght of the field if applicable to return a suitable snippet
+	 * @param integer $maxLength The lenght of the field if applicable to return a suitable snippet
 	 * @return string Hazardous string
 	 */
 	protected function _snippet($maxLength = 0) {

+ 1 - 1
Model/Behavior/LinkableBehavior.php

@@ -61,7 +61,7 @@ class LinkableBehavior extends ModelBehavior {
 				}
 				$iterations = Set::normalize($iterator);
 				foreach ($iterations as $alias => $options) {
-					if (is_null($options)) {
+					if ($options === null) {
 						$options = array();
 					}
 					$options = array_merge($defaults, compact('alias'), $options);

+ 2 - 2
Model/Behavior/LogableBehavior.php

@@ -194,7 +194,7 @@ class LogableBehavior extends ModelBehavior {
 	 * @example $this->Model->findUserActions(301, array('events' => true));
 	 * @example $this->Model->findUserActions(301, array('fields' => array('id','model'),'model' => 'BookTest');
 	 * @param Object $Model
-	 * @param int $user_id
+	 * @param integer $user_id
 	 * @param array $params
 	 * @return array
 	 */
@@ -309,7 +309,7 @@ class LogableBehavior extends ModelBehavior {
 	 * @example $this->Boat->customLog('ship', 66, array('title' => 'Titanic heads out'));
 	 * @param Object $Model
 	 * @param string $action name of action that is taking place (dont use the crud ones)
-	 * @param int $id id of the logged item (ie foreign_id in logs table)
+	 * @param integer $id id of the logged item (ie foreign_id in logs table)
 	 * @param array $values optional other values for your logs table
 	 */
 	public function customLog(Model $Model, $action, $id = null, $values = array()) {

+ 1 - 1
Model/Behavior/ResetBehavior.php

@@ -63,7 +63,7 @@ class ResetBehavior extends ModelBehavior {
 	 *
 	 * @param Model $Model
 	 * @param array $conditions
-	 * @param int $recursive
+	 * @param integer $recursive
 	 * @return bool true on success false otherwise
 	 */
 	public function resetRecords(Model $Model, $params = array()) {

+ 7 - 7
Model/Behavior/RevisionBehavior.php

@@ -191,8 +191,8 @@ class RevisionBehavior extends ModelBehavior {
 	 * @example $this->Post->id = 4; $my_changes = $this->Post->diff(null,nul, array('conditions'=>array('user_id'=>4)));
 	 * @example $this->Post->id = 4; $difference = $this->Post->diff(45,192);
 	 * @param Object $Model
-	 * @param int $from_version_id
-	 * @param int $to_version_id
+	 * @param integer $from_version_id
+	 * @param integer $to_version_id
 	 * @param array $options
 	 * @return array
 	 */
@@ -262,7 +262,7 @@ class RevisionBehavior extends ModelBehavior {
 	 *
 	 * @example $this->Post->initializeRevisions();
 	 * @param object $Model
-	 * @param int $limit number of rows to initialize in one go
+	 * @param integer $limit number of rows to initialize in one go
 	 * @return boolean
 	 */
 	public function initializeRevisions(Model $Model, $limit = 100) {
@@ -299,8 +299,8 @@ class RevisionBehavior extends ModelBehavior {
 	 * saves revisions for rows matching page and limit given
 	 *
 	 * @param object $Model
-	 * @param int $page
-	 * @param int $limit
+	 * @param integer $page
+	 * @param integer $limit
 	 */
 	protected function init(Model $Model, $page, $limit) {
 		$habtm = array();
@@ -474,7 +474,7 @@ class RevisionBehavior extends ModelBehavior {
 	 *
 	 * @example $this->Post->id = 3; $this->Post->revertTo(12);
 	 * @param object $Model
-	 * @param int $version_id
+	 * @param integer $version_id
 	 * @return boolean
 	 */
 	public function revertTo(Model $Model, $version_id) {
@@ -940,7 +940,7 @@ class RevisionBehavior extends ModelBehavior {
 	 * @return boolean
 	 */
 	protected function createShadowModel(Model $Model) {
-		if (is_null($this->settings[$Model->alias]['useDbConfig'])) {
+		if ($this->settings[$Model->alias]['useDbConfig'] === null) {
 			$dbConfig = $Model->useDbConfig;
 		} else {
 			$dbConfig = $this->settings[$Model->alias]['useDbConfig'];

+ 2 - 2
Model/Behavior/SluggedBehavior.php

@@ -358,7 +358,7 @@ class SluggedBehavior extends ModelBehavior {
 	 *
 	 * @param Model $Model
 	 * @param mixed $string
-	 * @param bool $tidy
+	 * @param boolean $tidy
 	 * @return string a slug
 	 */
 	public function slug(Model $Model, $string, $tidy = true) {
@@ -448,7 +448,7 @@ class SluggedBehavior extends ModelBehavior {
 	 *
 	 * @param AppModel $Model
 	 * @param array $conditions
-	 * @param int $recursive
+	 * @param integer $recursive
 	 * @return boolean True on success, false otherwise
 	 */
 	public function resetSlugs(Model $Model, $params = array()) {

+ 1 - 1
Model/Behavior/SoftDeleteBehavior.php

@@ -204,7 +204,7 @@ class SoftDeleteBehavior extends ModelBehavior {
 	 * @return mixed if $active is null, then current setting/null, or boolean if runtime setting for model was changed
 	 */
 	public function softDelete(Model $model, $active) {
-		if (is_null($active)) {
+		if ($active === null) {
 			return !empty($this->runtime[$model->alias]) ? $this->runtime[$model->alias] : null;
 		}
 

+ 70 - 57
Model/MyModel.php

@@ -15,9 +15,14 @@ class MyModel extends Model {
 
 	public $actsAs = array('Containable');
 
-
-/** Specific Stuff **/
-
+	/**
+	 * MyModel::__construct()
+	 *
+	 * @param integer $id
+	 * @param string $table
+	 * @param string $ds
+	 * @return void
+	 */
 	public function __construct($id = false, $table = null, $ds = null) {
 		parent::__construct($id, $table, $ds);
 
@@ -34,6 +39,9 @@ class MyModel extends Model {
 				'duration'	=> '+1 day'
 			));
 		}
+		if (!Configure::read('Model.disablePrefixing')) {
+			$this->prefixOrderProperty();
+		}
 
 		# get a notice if there is an AppModel instances instead of real Models (in those cases usually a dev error!)
 		if (defined('HTTP_HOST') && HTTP_HOST && !is_a($this, $this->name) && $this->displayField !== 'id' && $this->useDbConfig !== 'test' && !Configure::read('Core.disableModelInstanceNotice')) {
@@ -41,14 +49,50 @@ class MyModel extends Model {
 		}
 	}
 
-/**
- * Deconstructs a complex data type (array or object) into a single field value.
- * BUGFIXED VERSION - autodetects type and allows manual override
- *
- * @param string $field The name of the field to be deconstructed
- * @param array|object $data An array or object to be deconstructed into a field
- * @return mixed The resulting data that should be assigned to a field
- */
+	/**
+	 * Prefixes the order property with the actual alias if its a string or array.
+	 *
+	 * The core fails on using the proper prefix when building the query with two
+	 * different tables.
+	 *
+	 * @return void
+	 */
+	public function prefixOrderProperty() {
+		if (is_string($this->order)) {
+			$this->order = $this->prefixAlias($this->order);
+		}
+		if (is_array($this->order)) {
+			foreach ($this->order as $key => $value) {
+				if (is_numeric($key)) {
+					$this->order[$key] = $this->prefixAlias($value);
+				} else {
+					$this->order[$this->prefixAlias($key)] = $value;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Checks if a string of a field name contains a dot if not it will add it and add the alias prefix.
+	 *
+	 * @param string
+	 * @return string
+	 */
+	public function prefixAlias($string) {
+		if (strpos($string, '.') === false) {
+			return $this->alias . '.' . $string;
+		}
+		return $string;
+	}
+
+	/**
+	 * Deconstructs a complex data type (array or object) into a single field value.
+	 * BUGFIXED VERSION - autodetects type and allows manual override
+	 *
+	 * @param string $field The name of the field to be deconstructed
+	 * @param array|object $data An array or object to be deconstructed into a field
+	 * @return mixed The resulting data that should be assigned to a field
+	 */
 	public function deconstruct($field, $data, $type = null) {
 		if (!is_array($data)) {
 			return $data;
@@ -243,7 +287,6 @@ class MyModel extends Model {
 		return $res;
 	}
 
-
 	/**
 	 * HIGHLY EXPERIMENTAL
 	 * manually escape value for updateAll() etc
@@ -334,7 +377,7 @@ class MyModel extends Model {
 	 * workaround for a cake bug which sets empty fields to NULL in Model::set()
 	 * we cannot use if (isset() && empty()) statements without this fix
 	 * @param array $fields (which are supposed to be present in $this->data[$this->alias])
-	 * @param bool $force (if init should be forced, otherwise only if array_key exists)
+	 * @param boolean $force (if init should be forced, otherwise only if array_key exists)
 	 * 2011-03-06 ms
 	 */
 	public function init($fields = array(), $force = false) {
@@ -384,7 +427,6 @@ class MyModel extends Model {
 		return parent::beforeValidate($options);
 	}
 
-
 	/**
 	 * @param params
 	 * - key: functioName or other key used
@@ -415,7 +457,7 @@ class MyModel extends Model {
 	 * @param string $type The type of the query ('count'/'all'/'first' - first only works with some mysql versions)
 	 * @param array $options The options array
 	 * @param string $alias You can use this intead of $options['alias'] if you want
-	 * @param bool $parenthesise Add parenthesis before and after
+	 * @param boolean $parenthesise Add parenthesis before and after
 	 * @return string $result sql snippet of the query to run
 	 * @modified Mark Scherer (cake2.x ready and improvements)
 	 * @link http://bakery.cakephp.org/articles/lucaswxp/2011/02/11/easy_and_simple_subquery_cakephp
@@ -497,7 +539,6 @@ class MyModel extends Model {
 			}
 		}
 
-
 		# having and group clauses enhancement
 		if (is_array($query) && !empty($query['having']) && !empty($query['group'])) {
 			if (!is_array($query['group'])) {
@@ -562,7 +603,6 @@ class MyModel extends Model {
 	}
 	*/
 
-
 	/**
 	 * This code will add formatted list functionallity to find you can easy replace the $this->Model->find('list'); with $this->Model->find('formattedlist', array('fields' => array('Model.id', 'Model.field1', 'Model.field2', 'Model.field3'), 'format' => '%s-%s %s')); and get option tag output of: Model.field1-Model.field2 Model.field3. Even better part is being able to setup your own format for the output!
 	 * @see http://bakery.cakephp.org/articles/view/add-formatted-lists-to-your-appmodel
@@ -571,7 +611,7 @@ class MyModel extends Model {
 	 * 2009-12-27 ms
 	 */
 	protected function _find($type, $options = array()) {
-		$res = false; // $this->_getCachedResults($type, $options);
+		$res = false;
 		if ($res === false) {
 			if (isset($options['cache'])) {
 				unset($options['cache']);
@@ -659,6 +699,7 @@ class MyModel extends Model {
 		}
 		return $res;
 	}
+
 	/*
 	USAGE of formattetlist:
 	$this->Model->find('formattedlist',
@@ -676,35 +717,6 @@ class MyModel extends Model {
 	);
 	*/
 
-	/**
-	 * @deprecated
-	 */
-	public function _getCachedResults($type, $options) {
-		$this->useCache = true;
-		if (!is_array($options) || empty($options['cache']) || Configure::read('debug') > 0 && !(Configure::read('Debug.override'))) {
-			$this->useCache = false;
-			return false;
-		}
-
-		if ($options['cache'] === true) {
-			$this->cacheName = $this->alias . '_' . sha1($type . serialize($options));
-		} else {
-			/*
-			if (!isset($options['cache']['name'])) {
-			return false;
-			}
-			*/
-			$this->cacheName = $this->alias . '_' . sha1($type . serialize($options));
-			$this->cacheConfig = $options['cache'];
-			//$this->cacheName = $this->alias . '_' . $type . '_' . $options['cache'];
-			//$this->cacheConfig = isset($options['cache']['config']) ? $options['cache']['config'] : 'default';
-		}
-
-		$results = Cache::read($this->cacheName, $this->cacheConfig);
-		return $results;
-	}
-
-
 	/*
 	neighbor find problem:
 	This means it will sort the results on Model.created ASC and DESC.
@@ -733,8 +745,10 @@ class MyModel extends Model {
 	)
 	*/
 	/**
-	 * core-fix for multiple sort orders
+	 * Core-fix for multiple sort orders
+	 *
 	 * @param addiotional 'scope'=>array(field,order) - value is retrieved by (submitted) primary key
+	 * @return mixed
 	 * TODO: fix it
 	 * 2009-07-25 ms
 	 */
@@ -855,7 +869,7 @@ class MyModel extends Model {
 	}
 
 	/**
-	 * validates a primary or foreign key depending on the current schema data for this field
+	 * Validates a primary or foreign key depending on the current schema data for this field
 	 * recognizes uuid (char36) and aiid (int10 unsigned) - not yet mixed (varchar36)
 	 * more useful than using numeric or notEmpty which are type specific
 	 *
@@ -893,7 +907,7 @@ class MyModel extends Model {
 	}
 
 	/**
-	 * checks if the passed enum value is valid
+	 * Checks if the passed enum value is valid
 	 *
 	 * @return bool Success
 	 * 2010-02-09 ms
@@ -923,7 +937,7 @@ class MyModel extends Model {
 
 
 	/**
-	 * checks if the content of 2 fields are equal
+	 * Checks if the content of 2 fields are equal
 	 * Does not check on empty fields! Return TRUE even if both are empty (secure against empty in another rule)!
 	 *
 	 * @return bool Success
@@ -948,7 +962,7 @@ class MyModel extends Model {
 
 
 	/**
-	 * checks a record, if it is unique - depending on other fields in this table (transfered as array)
+	 * Checks a record, if it is unique - depending on other fields in this table (transfered as array)
 	 * example in model: 'rule' => array ('validateUnique', array('belongs_to_table_id','some_id','user_id')),
 	 * if all keys (of the array transferred) match a record, return false, otherwise true
 	 *
@@ -1010,6 +1024,8 @@ class MyModel extends Model {
 	}
 
 	/**
+	 * Alterative for validating unique fields.
+	 *
 	 * @param array $data
 	 * @param array $options
 	 * - scope (array of other fields as scope - isUnique dependent on other fields of the table)
@@ -1273,8 +1289,6 @@ class MyModel extends Model {
 		return false;
 	}
 
-
-	//TODO
 	/**
 	 * Validation of Date Fields (>= minDate && <= maxDate)
 	 * @param options
@@ -1296,7 +1310,6 @@ class MyModel extends Model {
 
 	}
 
-
 	/**
 	 * model validation rule for email addresses
 	 *
@@ -1451,7 +1464,7 @@ class MyModel extends Model {
 	 * (they must only be present - can still be empty, though!)
 	 *
 	 * @param array $fieldList
-	 * @param bool $allowEmpty (or NULL to not touch already set elements)
+	 * @param boolean $allowEmpty (or NULL to not touch already set elements)
 	 * @return void
 	 * 2012-02-20 ms
 	 */
@@ -1595,7 +1608,7 @@ class MyModel extends Model {
 
 	/**
 	 * Update a row with certain fields (dont use "Model" as super-key)
-	 * @param int $id
+	 * @param integer $id
 	 * @param array $data
 	 * @return bool|array Success
 	 * 2012-11-20 ms

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

@@ -307,10 +307,10 @@ class SluggedBehaviorTest extends CakeTestCase {
 /**
  * buildTest method
  *
- * @param int $hex1Limit
- * @param int $hex2Limit
- * @param int $hex1Start
- * @param int $hex2Start
+ * @param integer $hex1Limit
+ * @param integer $hex2Limit
+ * @param integer $hex1Start
+ * @param integer $hex2Start
  * @return void
  * @access protected
  */
@@ -402,10 +402,10 @@ class SluggedBehaviorTest extends CakeTestCase {
  * consuming.
  *
  * @param mixed $mode
- * @param int $hex1Limit
- * @param int $hex2Limit
- * @param int $hex1Start
- * @param int $hex2Start
+ * @param integer $hex1Limit
+ * @param integer $hex2Limit
+ * @param integer $hex1Start
+ * @param integer $hex2Start
  * @return void
  * @access protected
  */

+ 3 - 3
TestSuite/MyCakeTestCase.php

@@ -72,7 +72,7 @@ abstract class MyCakeTestCase extends CakeTestCase {
 	 * since PHPUnit>=3.6 swallowes all output by default
 	 * this is a convenience output handler since debug() or pr() have no effect
 	 * @param mixed $data
-	 * @param bool $force Should the output be flushed (forced)
+	 * @param boolean $force Should the output be flushed (forced)
 	 * @return void
 	 * 2011-12-04 ms
 	 */
@@ -92,7 +92,7 @@ abstract class MyCakeTestCase extends CakeTestCase {
 	 * since PHPUnit>=3.6 swallowes all output by default
 	 * this is a convenience output handler
 	 * @param mixed $data
-	 * @param bool $force Should the output be flushed (forced)
+	 * @param boolean $force Should the output be flushed (forced)
 	 * @return void
 	 * 2011-12-04 ms
 	 */
@@ -146,7 +146,7 @@ abstract class MyCakeTestCase extends CakeTestCase {
 	/**
 	 * @param float $time
 	 * @param int precision
-	 * @param bool $secs: usually in milliseconds (for long times set it to 'true')
+	 * @param boolean $secs: usually in milliseconds (for long times set it to 'true')
 	 * 2009-07-20 ms
 	 */
 	protected function _printElapsedTime($time = null, $precision = 8, $secs = false) {

+ 1 - 1
View/Helper/CaptchaHelper.php

@@ -52,7 +52,7 @@ class CaptchaHelper extends AppHelper {
 	 * //TODO: move to Lib
 	 * shows the statusText of Relations
 	 *
-	 * @param int $difficulty: not build in yet
+	 * @param integer $difficulty: not build in yet
 	 * @return array
 	 * 2008-12-12 ms
 	 */

+ 3 - 3
View/Helper/CommonHelper.php

@@ -76,7 +76,7 @@ class CommonHelper extends AppHelper {
 	 *
 	 * @param string|array $keywords
 	 * @param string $language (iso2: de, en-us, ...)
-	 * @param bool $escape
+	 * @param boolean $escape
 	 * @return string $htmlMarkup
 	 */
 	public function metaKeywords($keywords = null, $language = null, $escape = true) {
@@ -350,7 +350,7 @@ class CommonHelper extends AppHelper {
 	 * //TODO: move to lib or bootstrap
 	 *
 	 * @param string $singular The string to be pl.
-	 * @param int $count
+	 * @param integer $count
 	 * @return string "member" or "members" OR "Mitglied"/"Mitglieder" if autoTranslate TRUE
 	 * 2009-07-23 ms
 	 */
@@ -369,7 +369,7 @@ class CommonHelper extends AppHelper {
 	 *
 	 * @param string $singular
 	 * @param string $plural
-	 * @param int $count
+	 * @param integer $count
 	 * @return string $result
 	 * 2009-07-23 ms
 	 */

+ 4 - 4
View/Helper/FormatHelper.php

@@ -836,7 +836,7 @@ class FormatHelper extends TextHelper {
 	/**
 	 * fixes utf8 problems of native php str_pad function
 	 * @param string $input
-	 * @param int $padLength
+	 * @param integer $padLength
 	 * @param string $padString
 	 * @param mixed $padType
 	 * @return string $input
@@ -1000,7 +1000,7 @@ class FormatHelper extends TextHelper {
 	/**
 	 * @param mixed $uid
 	 * @param string $username
-	 * @param bool $full
+	 * @param boolean $full
 	 * @param array $options
 	 * - hash (string)
 	 * @return string $url
@@ -1166,7 +1166,7 @@ class FormatHelper extends TextHelper {
 	/**
 	 * returns green on ok, red otherwise
 	 * @param mixed $currentValue
-	 * @param bool $ok: true/false (defaults to false)
+	 * @param boolean $ok: true/false (defaults to false)
 	 * //@param string $comparizonType
 	 * //@param mixed $okValue
 	 * @return string $newValue nicely formatted/colored
@@ -1376,7 +1376,7 @@ class FormatHelper extends TextHelper {
 	 * @version 1.3.2
 	 * @link http://aidanlister.com/2004/04/converting-arrays-to-human-readable-tables/
 	 * @param array $array The result (numericaly keyed, associative inner) array.
-	 * @param bool $recursive Recursively generate tables for multi-dimensional arrays
+	 * @param boolean $recursive Recursively generate tables for multi-dimensional arrays
 	 * @param string $null String to output for blank cells
 	 */
 	public function array2table($array, $options = array()) {

+ 5 - 5
View/Helper/GoogleMapV3Helper.php

@@ -270,7 +270,7 @@ class GoogleMapV3Helper extends AppHelper {
 	 * http://maps.google.com/maps/api/js?sensor=true
 	 * Adds Key - more variables could be added after it with "&key=value&..."
 	 * - region
-	 * @param bool $sensor
+	 * @param boolean $sensor
 	 * @param string $language (iso2: en, de, ja, ...)
 	 * @param string $append (more key-value-pairs to append)
 	 * @return string $fullUrl
@@ -838,8 +838,8 @@ var iconShape = {
 	}
 
 	/**
-	 * @param int $marker
-	 * @param int $infoWindow
+	 * @param integer $marker
+	 * @param integer $infoWindow
 	 * @return void
 	 * 2010-12-18 ms
 	 */
@@ -852,7 +852,7 @@ var iconShape = {
 	}
 
 	/**
-	 * @param int $marker
+	 * @param integer $marker
 	 * @param string $event (js)
 	 * @return void
 	 * 2010-12-18 ms
@@ -1003,7 +1003,7 @@ var iconShape = {
 
 	/**
 	 * @param string $content (html/text)
-	 * @param int $infoWindowCount
+	 * @param integer $infoWindowCount
 	 * @return void
 	 * 2010-12-18 ms
 	 */

+ 16 - 5
View/Helper/MyHelper.php

@@ -1,5 +1,6 @@
 <?php
 App::uses('Helper', 'View');
+App::uses('Router', 'Routing');
 App::uses('UrlCacheManager', 'Tools.Routing');
 
 /**
@@ -21,7 +22,7 @@ class MyHelper extends Helper {
 	/**
 	 * Manually load helpers
 	 * @param array $helpers (either strings, or [string => array(config...)])
-	 * @param bool $callbacks - trigger missed callbacks
+	 * @param boolean $callbacks - trigger missed callbacks
 	 * @return void
 	 */
 	public function loadHelpers($helpers = array(), $callbacks = false) {
@@ -270,18 +271,28 @@ class MyHelper extends Helper {
 	 * Intercepts the parent url function to first look if the cache was already generated for the same params
 	 *
 	 * @param mixed $url url to generate using cakephp array syntax
-	 * @param boolean $full wheter to generate a full url or not (http scheme)
+	 * @param boolean|array $full whether to generate a full url or not (http scheme). As array: full, escape.
 	 * @return string
 	 * @see Helper::url()
 	 */
-	public function url($url = null, $full = false, $escape = true) {
+	public function url($url = null, $full = false) {
+		if (is_array($full)) {
+			$escape = isset($full['ecape']) ? $full['escape'] : true;
+			$full = isset($full['full']) ? $full['full'] : false;
+		} else {
+			$escape = true;
+		}
+
 		if (Configure::read('UrlCache.active')) {
 			if ($cachedUrl = UrlCacheManager::get($url, $full)) {
 				return $cachedUrl;
 			}
 		}
-
-		$routerUrl = parent::url($url, $full, $escape);
+		if (!$escape) {
+			$routerUrl = Router::url($url, $full);
+		} else {
+			$routerUrl = parent::url($url, $full);
+		}
 		if (Configure::read('UrlCache.active')) {
 			UrlCacheManager::set($routerUrl);
 		}

+ 1 - 1
View/Helper/QrCodeHelper.php

@@ -309,7 +309,7 @@ class QrCodeHelper extends AppHelper {
 	 * 25 => 21x21 (L)
 	 * ...
 	 * 4000 => 547x547 (L)
-	 * @param int $length
+	 * @param integer $length
 	 * @return int $size
 	 * 2011-06-06 ms
 	 */

+ 3 - 3
View/Helper/TextExtHelper.php

@@ -321,7 +321,7 @@ class TextExtHelper extends TextHelper {
 	 * minimizes the given url to a maximum length
 	 *
 	 * @param string $url the url
-	 * @param int $max the maximum length
+	 * @param integer $max the maximum length
 	 * @param array $options
 	 * - placeholder
 	 * @return string the manipulated url (+ eventuell ...)
@@ -385,7 +385,7 @@ class TextExtHelper extends TextHelper {
 	/**
 	 * syntax highlighting using php internal highlighting
 	 * @param string $filename
-	 * @param bool $return (else echo directly)
+	 * @param boolean $return (else echo directly)
 	 * 2009-07-26 ms
 	 */
 	public static function highlightFile($file, $return = true) {
@@ -395,7 +395,7 @@ class TextExtHelper extends TextHelper {
 	/**
 	 * syntax highlighting using php internal highlighting
 	 * @param string $contentstring
-	 * @param bool $return (else echo directly)
+	 * @param boolean $return (else echo directly)
 	 * 2009-07-26 ms
 	 */
 	public static function highlightString($string, $return = true) {

+ 42 - 29
View/Helper/TreeHelper.php

@@ -21,6 +21,35 @@ App::uses('AppHelper', 'View/Helper');
 class TreeHelper extends AppHelper {
 
 	/**
+	 * Default settings
+	 *
+	 * @var array
+	 */
+	protected $_defaults = array(
+		'model' => null,
+		'alias' => 'name',
+		'type' => 'ul',
+		'itemType' => 'li',
+		'id' => false,
+		'class' => false,
+		'element' => false,
+		'callback' => false,
+		'autoPath' => false,
+		'hideUnrelated' => false,
+		'treePath' => array(),
+		'left' => 'lft',
+		'right' => 'rght',
+		'depth' => 0,
+		'maxDepth' => 999,
+		'firstChild' => true,
+		'indent' => null,
+		'splitDepth' => false,
+		'splitCount' => null,
+		'totalNodes' => null,
+		'fullSettings' => false,
+	);
+
+	/**
 	 * Settings property
 	 *
 	 * @var array
@@ -96,28 +125,7 @@ class TreeHelper extends AppHelper {
 			return '';
 		}
 
-		$this->_settings = array_merge(array(
-			'model' => null,
-			'alias' => 'name',
-			'type' => 'ul',
-			'itemType' => 'li',
-			'id' => false,
-			'class' => false,
-			'element' => false,
-			'callback' => false,
-			'autoPath' => false,
-			'hideUnrelated' => false,
-			'treePath' => array(),
-			'left' => 'lft',
-			'right' => 'rght',
-			'depth' => 0,
-			'maxDepth' => 999,
-			'firstChild' => true,
-			'indent' => null,
-			'splitDepth' => false,
-			'splitCount' => null,
-			'totalNodes' => null
-		), (array)$settings);
+		$this->_settings = array_merge($this->_defaults, (array)$settings);
 		if ($this->_settings['autoPath'] && !isset($this->_settings['autoPath'][2])) {
 			$this->_settings['autoPath'][2] = 'active';
 		}
@@ -150,7 +158,7 @@ class TreeHelper extends AppHelper {
 			}
 		}
 		$return = '';
-		$_addType = true;
+		$addType = true;
 		$this->_settings['totalNodes'] = count($data);
 		$keys = array_keys($data);
 
@@ -184,6 +192,7 @@ class TreeHelper extends AppHelper {
 					$return .= '</' . $itemType . '>';
 				}
 			}
+
 			/* Some useful vars */
 			$hasChildren = $firstChild = $lastChild = $hasVisibleChildren = false;
 			$numberOfDirectChildren = $numberOfTotalChildren = null;
@@ -241,6 +250,10 @@ class TreeHelper extends AppHelper {
 				'activePathElement' => $activePathElement,
 			);
 			$this->_settings = array_merge($this->_settings, $elementData);
+			if ($this->_settings['fullSettings']) {
+				$elementData = $this->_settings;
+			}
+
 			/* Main Content */
 			if ($element) {
 				$content = $this->_View->element($element, $elementData);
@@ -257,7 +270,7 @@ class TreeHelper extends AppHelper {
 				$content = str_replace("\r\n", "\n" . $whiteSpace . "\t", $content);
 			}
 			/* Prefix */
-			if ($_addType) {
+			if ($addType) {
 				if ($indent) {
 					$return .= "\r\n" . $whiteSpace;
 				}
@@ -275,7 +288,7 @@ class TreeHelper extends AppHelper {
 			}
 			$return .= $content;
 			/* Suffix */
-			$_addType = false;
+			$addType = false;
 			if ($hasVisibleChildren) {
 				if ($numberOfDirectChildren) {
 					$settings['depth'] = $depth + 1;
@@ -288,7 +301,7 @@ class TreeHelper extends AppHelper {
 						$return .= '</' . $itemType . '>';
 					}
 				} elseif ($numberOfTotalChildren) {
-					$_addType = true;
+					$addType = true;
 					$stack[] = $row[$right];
 				}
 			} else {
@@ -340,7 +353,7 @@ class TreeHelper extends AppHelper {
 	 * @return void
 	 */
 	public function addItemAttribute($id = '', $key = '', $value = null) {
-		if (!is_null($value)) {
+		if ($value !== null) {
 			$this->_itemAttributes[$id][$key] = $value;
 		} elseif (!(isset($this->_itemAttributes[$id]) && in_array($key, $this->_itemAttributes[$id]))) {
 			$this->_itemAttributes[$id][] = $key;
@@ -380,7 +393,7 @@ class TreeHelper extends AppHelper {
 		if ($previousOrNext === 'next' && $firstChild) {
 			$var = '_typeAttributesNext';
 		}
-		if (!is_null($value)) {
+		if ($value !== null) {
 			$this->{$var}[$id][$key] = $value;
 		} elseif (!(isset($this->{$var}[$id]) && in_array($key, $this->{$var}[$id]))) {
 			$this->{$var}[$id][] = $key;
@@ -497,7 +510,7 @@ class TreeHelper extends AppHelper {
 	 *
 	 * @param array $tree
 	 * @param array $treePath
-	 * @param int $level
+	 * @param integer $level
 	 * @return void
 	 */
 	protected function _markUnrelatedAsHidden(&$tree, $path, $level = 0) {