Merge branch 'master' into 2.5

Conflicts:
	lib/Cake/Model/Permission.php
This commit is contained in:
ADmad 2014-02-11 18:17:59 +05:30
commit 9de3418079
25 changed files with 218 additions and 31 deletions

View file

@ -26,11 +26,15 @@ class ServerShell extends AppShell {
/** /**
* Default ServerHost * Default ServerHost
*
* @var string
*/ */
const DEFAULT_HOST = 'localhost'; const DEFAULT_HOST = 'localhost';
/** /**
* Default ListenPort * Default ListenPort
*
* @var integer
*/ */
const DEFAULT_PORT = 80; const DEFAULT_PORT = 80;

View file

@ -184,6 +184,10 @@ class ControllerTask extends BakeTask {
$wannaUseSession = $this->in( $wannaUseSession = $this->in(
__d('cake_console', "Would you like to use Session flash messages?"), array('y', 'n'), 'y' __d('cake_console', "Would you like to use Session flash messages?"), array('y', 'n'), 'y'
); );
if (strtolower($wannaUseSession) === 'y') {
array_push($components, 'Session');
}
} }
} else { } else {
list($wannaBakeCrud, $wannaBakeAdminCrud) = $this->_askAboutMethods(); list($wannaBakeCrud, $wannaBakeAdminCrud) = $this->_askAboutMethods();

View file

@ -504,6 +504,7 @@ class ExtractTask extends AppShell {
* @param array $rules the set of validation rules for the field * @param array $rules the set of validation rules for the field
* @param string $file the file name where this validation rule was found * @param string $file the file name where this validation rule was found
* @param string $domain default domain to bind the validations to * @param string $domain default domain to bind the validations to
* @param string $category the translation category
* @return void * @return void
*/ */
protected function _processValidationRules($field, $rules, $file, $domain, $category = 'LC_MESSAGES') { protected function _processValidationRules($field, $rules, $file, $domain, $category = 'LC_MESSAGES') {

View file

@ -46,21 +46,29 @@ class ConsoleOutput {
/** /**
* Raw output constant - no modification of output text. * Raw output constant - no modification of output text.
*
* @var integer
*/ */
const RAW = 0; const RAW = 0;
/** /**
* Plain output - tags will be stripped. * Plain output - tags will be stripped.
*
* @var integer
*/ */
const PLAIN = 1; const PLAIN = 1;
/** /**
* Color output - Convert known tags in to ANSI color escape codes. * Color output - Convert known tags in to ANSI color escape codes.
*
* @var integer
*/ */
const COLOR = 2; const COLOR = 2;
/** /**
* Constant for a newline. * Constant for a newline.
*
* @var string
*/ */
const LF = PHP_EOL; const LF = PHP_EOL;

View file

@ -33,16 +33,22 @@ class Shell extends Object {
/** /**
* Output constant making verbose shells. * Output constant making verbose shells.
*
* @var integer
*/ */
const VERBOSE = 2; const VERBOSE = 2;
/** /**
* Output constant for making normal shells. * Output constant for making normal shells.
*
* @var integer
*/ */
const NORMAL = 1; const NORMAL = 1;
/** /**
* Output constants for making quiet shells. * Output constants for making quiet shells.
*
* @var integer
*/ */
const QUIET = 0; const QUIET = 0;

View file

@ -26,11 +26,15 @@ class PhpAcl extends Object implements AclInterface {
/** /**
* Constant for deny * Constant for deny
*
* @var boolean
*/ */
const DENY = false; const DENY = false;
/** /**
* Constant for allow * Constant for allow
*
* @var boolean
*/ */
const ALLOW = true; const ALLOW = true;
@ -364,6 +368,8 @@ class PhpAro {
/** /**
* role to resolve to when a provided ARO is not listed in * role to resolve to when a provided ARO is not listed in
* the internal tree * the internal tree
*
* @var string
*/ */
const DEFAULT_ROLE = 'Role/default'; const DEFAULT_ROLE = 'Role/default';

View file

@ -39,6 +39,8 @@ class AuthComponent extends Component {
/** /**
* Constant for 'all' * Constant for 'all'
*
* @var string
*/ */
const ALL = 'all'; const ALL = 'all';

View file

@ -66,28 +66,28 @@ class App {
/** /**
* Append paths * Append paths
* *
* @constant APPEND * @var string
*/ */
const APPEND = 'append'; const APPEND = 'append';
/** /**
* Prepend paths * Prepend paths
* *
* @constant PREPEND * @var string
*/ */
const PREPEND = 'prepend'; const PREPEND = 'prepend';
/** /**
* Register package * Register package
* *
* @constant REGISTER * @var string
*/ */
const REGISTER = 'register'; const REGISTER = 'register';
/** /**
* Reset paths instead of merging * Reset paths instead of merging
* *
* @constant RESET * @var boolean
*/ */
const RESET = true; const RESET = true;

View file

@ -152,6 +152,8 @@ class Object {
* *
* @param string $msg Log message * @param string $msg Log message
* @param integer $type Error type constant. Defined in app/Config/core.php. * @param integer $type Error type constant. Defined in app/Config/core.php.
* @param null|string|array $scope The scope(s) a log message is being created in.
* See CakeLog::config() for more information on logging scopes.
* @return boolean Success of log write * @return boolean Success of log write
*/ */
public function log($msg, $type = LOG_ERR, $scope = null) { public function log($msg, $type = LOG_ERR, $scope = null) {

View file

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Error handler * ErrorHandler class
* *
* Provides Error Capturing for Framework errors. * Provides Error Capturing for Framework errors.
* *

View file

@ -107,6 +107,8 @@ class Sqlserver extends DboSource {
/** /**
* Magic column name used to provide pagination support for SQLServer 2008 * Magic column name used to provide pagination support for SQLServer 2008
* which lacks proper limit/offset support. * which lacks proper limit/offset support.
*
* @var string
*/ */
const ROW_COUNTER = '_cake_page_rownum_'; const ROW_COUNTER = '_cake_page_rownum_';

View file

@ -82,9 +82,9 @@ class Permission extends AppModel {
$aroPath = $this->Aro->node($aro); $aroPath = $this->Aro->node($aro);
$acoPath = $this->Aco->node($aco); $acoPath = $this->Aco->node($aco);
if (!$aroPath || !$acoPath) { if (!$aroPath) {
$this->log(__d('cake_dev', $this->log(__d('cake_dev',
"%s - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s", "%s - Failed ARO node lookup in permissions check. Node references:\nAro: %s\nAco: %s",
'DbAcl::check()', 'DbAcl::check()',
print_r($aro, true), print_r($aro, true),
print_r($aco, true)), print_r($aco, true)),

View file

@ -35,35 +35,35 @@ class CakeEmail {
/** /**
* Default X-Mailer * Default X-Mailer
* *
* @constant EMAIL_CLIENT * @var string
*/ */
const EMAIL_CLIENT = 'CakePHP Email'; const EMAIL_CLIENT = 'CakePHP Email';
/** /**
* Line length - no should more - RFC 2822 - 2.1.1 * Line length - no should more - RFC 2822 - 2.1.1
* *
* @constant LINE_LENGTH_SHOULD * @var integer
*/ */
const LINE_LENGTH_SHOULD = 78; const LINE_LENGTH_SHOULD = 78;
/** /**
* Line length - no must more - RFC 2822 - 2.1.1 * Line length - no must more - RFC 2822 - 2.1.1
* *
* @constant LINE_LENGTH_MUST * @var integer
*/ */
const LINE_LENGTH_MUST = 998; const LINE_LENGTH_MUST = 998;
/** /**
* Type of message - HTML * Type of message - HTML
* *
* @constant MESSAGE_HTML * @var string
*/ */
const MESSAGE_HTML = 'html'; const MESSAGE_HTML = 'html';
/** /**
* Type of message - TEXT * Type of message - TEXT
* *
* @constant MESSAGE_TEXT * @var string
*/ */
const MESSAGE_TEXT = 'text'; const MESSAGE_TEXT = 'text';
@ -1315,6 +1315,7 @@ class CakeEmail {
* Wrap the message to follow the RFC 2822 - 2.1.1 * Wrap the message to follow the RFC 2822 - 2.1.1
* *
* @param string $message Message to wrap * @param string $message Message to wrap
* @param integer $wrapLength The line length
* @return array Wrapped message * @return array Wrapped message
*/ */
protected function _wrap($message, $wrapLength = CakeEmail::LINE_LENGTH_MUST) { protected function _wrap($message, $wrapLength = CakeEmail::LINE_LENGTH_MUST) {

View file

@ -490,7 +490,7 @@ class CakeRoute {
$prefixed = $params['prefix'] . '_'; $prefixed = $params['prefix'] . '_';
} }
if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) { if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) {
$params['action'] = substr($params['action'], strlen($prefixed) * -1); $params['action'] = substr($params['action'], strlen($prefixed));
unset($params['prefix']); unset($params['prefix']);
} }

View file

@ -85,14 +85,45 @@ class Router {
protected static $_validExtensions = array(); protected static $_validExtensions = array();
/** /**
* 'Constant' regular expression definitions for named route elements * Regular expression for action names
* *
* @var string
*/ */
const ACTION = 'index|show|add|create|edit|update|remove|del|delete|view|item'; const ACTION = 'index|show|add|create|edit|update|remove|del|delete|view|item';
/**
* Regular expression for years
*
* @var string
*/
const YEAR = '[12][0-9]{3}'; const YEAR = '[12][0-9]{3}';
/**
* Regular expression for months
*
* @var string
*/
const MONTH = '0[1-9]|1[012]'; const MONTH = '0[1-9]|1[012]';
/**
* Regular expression for days
*
* @var string
*/
const DAY = '0[1-9]|[12][0-9]|3[01]'; const DAY = '0[1-9]|[12][0-9]|3[01]';
/**
* Regular expression for auto increment IDs
*
* @var string
*/
const ID = '[0-9]+'; const ID = '[0-9]+';
/**
* Regular expression for UUIDs
*
* @var string
*/
const UUID = '[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}'; const UUID = '[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}';
/** /**
@ -245,19 +276,19 @@ class Router {
* Connects a new Route in the router. * Connects a new Route in the router.
* *
* Routes are a way of connecting request URLs to objects in your application. At their core routes * Routes are a way of connecting request URLs to objects in your application. At their core routes
* are a set or regular expressions that are used to match requests to destinations. * are a set of regular expressions that are used to match requests to destinations.
* *
* Examples: * Examples:
* *
* `Router::connect('/:controller/:action/*');` * `Router::connect('/:controller/:action/*');`
* *
* The first parameter will be used as a controller name while the second is used as the action name. * The first token ':controller' will be used as a controller name while the second is used as the action name.
* the '/*' syntax makes this route greedy in that it will match requests like `/posts/index` as well as requests * the '/*' syntax makes this route greedy in that it will match requests like `/posts/index` as well as requests
* like `/posts/edit/1/foo/bar`. * like `/posts/edit/1/foo/bar`.
* *
* `Router::connect('/home-page', array('controller' => 'pages', 'action' => 'display', 'home'));` * `Router::connect('/home-page', array('controller' => 'pages', 'action' => 'display', 'home'));`
* *
* The above shows the use of route parameter defaults. And providing routing parameters for a static route. * The above shows the use of route parameter defaults, and providing routing parameters for a static route.
* *
* {{{ * {{{
* Router::connect( * Router::connect(
@ -270,6 +301,9 @@ class Router {
* Shows connecting a route with custom route parameters as well as providing patterns for those parameters. * Shows connecting a route with custom route parameters as well as providing patterns for those parameters.
* Patterns for routing parameters do not need capturing groups, as one will be added for each route params. * Patterns for routing parameters do not need capturing groups, as one will be added for each route params.
* *
* $defaults is merged with the results of parsing the request URL to form the final routing destination and its
* parameters. This destination is expressed as an associative array by Router. See the output of {@link parse()}.
*
* $options offers four 'special' keys. `pass`, `named`, `persist` and `routeClass` * $options offers four 'special' keys. `pass`, `named`, `persist` and `routeClass`
* have special meaning in the $options array. * have special meaning in the $options array.
* *
@ -304,6 +338,7 @@ class Router {
* shifted into the passed arguments, supplying patterns for routing parameters and supplying the name of a * shifted into the passed arguments, supplying patterns for routing parameters and supplying the name of a
* custom routing class. * custom routing class.
* @see routes * @see routes
* @see parse().
* @return array Array of routes * @return array Array of routes
* @throws RouterException * @throws RouterException
*/ */

View file

@ -308,6 +308,11 @@ class CakeRouteTest extends CakeTestCase {
$result = $route->match($url); $result = $route->match($url);
$expected = '/admin/subscriptions/edit_admin_e/1'; $expected = '/admin/subscriptions/edit_admin_e/1';
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
$url = array('controller' => 'subscribe', 'admin' => true, 'action' => 'admin_edit', 1);
$result = $route->match($url);
$expected = '/admin/subscriptions/edit/1';
$this->assertEquals($expected, $result);
} }
/** /**

View file

@ -80,8 +80,7 @@ class MediaViewTest extends CakeTestCase {
$this->MediaView->response->expects($this->once()) $this->MediaView->response->expects($this->once())
->method('send'); ->method('send');
$result = $this->MediaView->render(); $this->MediaView->render();
$this->assertTrue($result);
} }
/** /**
@ -119,8 +118,7 @@ class MediaViewTest extends CakeTestCase {
$this->MediaView->response->expects($this->once()) $this->MediaView->response->expects($this->once())
->method('send'); ->method('send');
$result = $this->MediaView->render(); $this->MediaView->render();
$this->assertTrue($result);
} }
/** /**

View file

@ -1024,7 +1024,7 @@ class ViewTest extends CakeTestCase {
$this->assertRegExp("/<title>yo what up<\/title>/", $result); $this->assertRegExp("/<title>yo what up<\/title>/", $result);
$this->assertRegExp("/<p><a href=\"flash\">yo what up<\/a><\/p>/", $result); $this->assertRegExp("/<p><a href=\"flash\">yo what up<\/a><\/p>/", $result);
$this->assertTrue($View->render(false, 'flash')); $this->assertNull($View->render(false, 'flash'));
$this->PostsController->helpers = array('Session', 'Cache', 'Html'); $this->PostsController->helpers = array('Session', 'Cache', 'Html');
$this->PostsController->constructClasses(); $this->PostsController->constructClasses();

View file

@ -26,7 +26,7 @@ class Folder {
* Default scheme for Folder::copy * Default scheme for Folder::copy
* Recursively merges subfolders with the same name * Recursively merges subfolders with the same name
* *
* @constant MERGE * @var string
*/ */
const MERGE = 'merge'; const MERGE = 'merge';
@ -34,7 +34,7 @@ class Folder {
* Overwrite scheme for Folder::copy * Overwrite scheme for Folder::copy
* subfolders with the same name will be replaced * subfolders with the same name will be replaced
* *
* @constant OVERWRITE * @var string
*/ */
const OVERWRITE = 'overwrite'; const OVERWRITE = 'overwrite';
@ -42,7 +42,7 @@ class Folder {
* Skip scheme for Folder::copy * Skip scheme for Folder::copy
* if a subfolder with the same name exists it will be skipped * if a subfolder with the same name exists it will be skipped
* *
* @constant SKIP * @var string
*/ */
const SKIP = 'skip'; const SKIP = 'skip';

View file

@ -73,6 +73,8 @@ class NumberHelper extends AppHelper {
} }
/** /**
* Formats a number with a level of precision.
*
* @see CakeNumber::precision() * @see CakeNumber::precision()
* *
* @param float $number A floating point number. * @param float $number A floating point number.
@ -85,6 +87,8 @@ class NumberHelper extends AppHelper {
} }
/** /**
* Returns a formatted-for-humans file size.
*
* @see CakeNumber::toReadableSize() * @see CakeNumber::toReadableSize()
* *
* @param integer $size Size in bytes * @param integer $size Size in bytes
@ -96,6 +100,8 @@ class NumberHelper extends AppHelper {
} }
/** /**
* - `multiply`: Multiply the input value by 100 for decimal percentages.
*
* @see CakeNumber::toPercentage() * @see CakeNumber::toPercentage()
* *
* @param float $number A floating point number * @param float $number A floating point number
@ -109,6 +115,8 @@ class NumberHelper extends AppHelper {
} }
/** /**
* Formats a number into a currency format.
*
* @see CakeNumber::format() * @see CakeNumber::format()
* *
* @param float $number A floating point number * @param float $number A floating point number
@ -122,6 +130,8 @@ class NumberHelper extends AppHelper {
} }
/** /**
* Formats a number into a currency format.
*
* @see CakeNumber::currency() * @see CakeNumber::currency()
* *
* @param float $number * @param float $number
@ -137,6 +147,18 @@ class NumberHelper extends AppHelper {
} }
/** /**
* Add a currency format to the Number helper. Makes reusing
* currency formats easier.
*
* {{{ $this->Number->addFormat('NOK', array('before' => 'Kr. ')); }}}
*
* You can now use `NOK` as a shortform when formatting currency amounts.
*
* {{{ $this->Number->currency($value, 'NOK'); }}}
*
* Added formats are merged with the defaults defined in Cake\Utility\Number::$_currencyDefaults
* See Cake\Utility\Number::currency() for more information on the various options and their function.
*
* @see CakeNumber::addFormat() * @see CakeNumber::addFormat()
* *
* @param string $formatName The format name to be used in the future. * @param string $formatName The format name to be used in the future.
@ -150,6 +172,8 @@ class NumberHelper extends AppHelper {
} }
/** /**
* Getter/setter for default currency
*
* @see CakeNumber::defaultCurrency() * @see CakeNumber::defaultCurrency()
* *
* @param string $currency The currency to be used in the future. * @param string $currency The currency to be used in the future.

View file

@ -215,6 +215,9 @@ class TextHelper extends AppHelper {
} }
/** /**
* Highlights a given phrase in a text. You can specify any expression in highlighter that
* may include the \1 expression to include the $phrase found.
*
* @see String::highlight() * @see String::highlight()
* *
* @param string $text Text to search the phrase in * @param string $text Text to search the phrase in
@ -251,6 +254,8 @@ class TextHelper extends AppHelper {
} }
/** /**
* Strips given text of all links (<a href=....)
*
* @see String::stripLinks() * @see String::stripLinks()
* *
* @param string $text Text * @param string $text Text
@ -262,6 +267,16 @@ class TextHelper extends AppHelper {
} }
/** /**
* Truncates text starting from the end.
*
* Cuts a string to the length of $length and replaces the first characters
* with the ellipsis if the text is longer than length.
*
* ### Options:
*
* - `ellipsis` Will be used as Beginning and prepended to the trimmed string
* - `exact` If false, $text will not be cut mid-word
*
* @see String::truncate() * @see String::truncate()
* *
* @param string $text String to truncate. * @param string $text String to truncate.
@ -275,6 +290,9 @@ class TextHelper extends AppHelper {
} }
/** /**
* Extracts an excerpt from the text surrounding the phrase with a number of characters on each side
* determined by radius.
*
* @see String::excerpt() * @see String::excerpt()
* *
* @param string $text String to search the phrase in * @param string $text String to search the phrase in
@ -289,6 +307,8 @@ class TextHelper extends AppHelper {
} }
/** /**
* Creates a comma separated list where the last two items are joined with 'and', forming natural English
*
* @see String::toList() * @see String::toList()
* *
* @param array $list The list to be joined * @param array $list The list to be joined

View file

@ -122,6 +122,9 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Converts a string representing the format for the function strftime and returns a
* windows safe and i18n aware format.
*
* @see CakeTime::convertSpecifiers() * @see CakeTime::convertSpecifiers()
* *
* @param string $format Format with specifiers for strftime function. * @param string $format Format with specifiers for strftime function.
@ -135,6 +138,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Converts given time (in server's time zone) to user's local time, given his/her timezone.
*
* @see CakeTime::convert() * @see CakeTime::convert()
* *
* @param string $serverTime UNIX timestamp * @param string $serverTime UNIX timestamp
@ -147,6 +152,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns server's offset
*
* @see CakeTime::serverOffset() * @see CakeTime::serverOffset()
* *
* @return integer Offset * @return integer Offset
@ -157,6 +164,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns a UNIX timestamp, given either a UNIX timestamp or a valid strtotime() date string.
*
* @see CakeTime::fromString() * @see CakeTime::fromString()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -169,6 +178,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns a nicely formatted date string for given Datetime string.
*
* @see CakeTime::nice() * @see CakeTime::nice()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -182,6 +193,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns a formatted descriptive date string for given datetime string.
*
* @see CakeTime::niceShort() * @see CakeTime::niceShort()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime objectp * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime objectp
@ -194,6 +207,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns a partial SQL string to search for all records between two dates.
*
* @see CakeTime::daysAsSql() * @see CakeTime::daysAsSql()
* *
* @param integer|string|DateTime $begin UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $begin UNIX timestamp, strtotime() valid string or DateTime object
@ -208,6 +223,9 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns a partial SQL string to search for all records between two times
* occurring on the same day.
*
* @see CakeTime::dayAsSql() * @see CakeTime::dayAsSql()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -221,6 +239,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns true if given datetime string is today.
*
* @see CakeTime::isToday() * @see CakeTime::isToday()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -233,6 +253,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns true if given datetime string is within this week.
*
* @see CakeTime::isThisWeek() * @see CakeTime::isThisWeek()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -245,6 +267,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns true if given datetime string is within this month
*
* @see CakeTime::isThisMonth() * @see CakeTime::isThisMonth()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -257,6 +281,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns true if given datetime string is within current year.
*
* @see CakeTime::isThisYear() * @see CakeTime::isThisYear()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -269,6 +295,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns true if given datetime string was yesterday.
*
* @see CakeTime::wasYesterday() * @see CakeTime::wasYesterday()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -282,6 +310,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns true if given datetime string is tomorrow.
*
* @see CakeTime::isTomorrow() * @see CakeTime::isTomorrow()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -294,6 +324,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns the quarter
*
* @see CakeTime::toQuarter() * @see CakeTime::toQuarter()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -306,6 +338,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns a UNIX timestamp from a textual datetime description. Wrapper for PHP function strtotime().
*
* @see CakeTime::toUnix() * @see CakeTime::toUnix()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -318,6 +352,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns a date formatted for Atom RSS feeds.
*
* @see CakeTime::toAtom() * @see CakeTime::toAtom()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -330,6 +366,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Formats date for RSS feeds
*
* @see CakeTime::toRSS() * @see CakeTime::toRSS()
* *
* @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@ -342,6 +380,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Formats date for RSS feeds
*
* @see CakeTime::timeAgoInWords() * @see CakeTime::timeAgoInWords()
* *
* ## Addition options * ## Addition options
@ -389,6 +429,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns true if specified datetime was within the interval specified, else false.
*
* @see CakeTime::wasWithinLast() * @see CakeTime::wasWithinLast()
* *
* @param string|integer $timeInterval the numeric value with space then time type. * @param string|integer $timeInterval the numeric value with space then time type.
@ -403,6 +445,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns true if specified datetime is within the interval specified, else false.
*
* @see CakeTime::isWithinLast() * @see CakeTime::isWithinLast()
* *
* @param string|integer $timeInterval the numeric value with space then time type. * @param string|integer $timeInterval the numeric value with space then time type.
@ -417,6 +461,8 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns gmt as a UNIX timestamp.
*
* @see CakeTime::gmt() * @see CakeTime::gmt()
* *
* @param integer|string|DateTime $string UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $string UNIX timestamp, strtotime() valid string or DateTime object
@ -428,6 +474,21 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns a formatted date string, given either a UNIX timestamp or a valid strtotime() date string.
* This function also accepts a time string and a format string as first and second parameters.
* In that case this function behaves as a wrapper for TimeHelper::i18nFormat()
*
* ## Examples
*
* Create localized & formatted time:
*
* {{{
* $this->Time->format('2012-02-15', '%m-%d-%Y'); // returns 02-15-2012
* $this->Time->format('2012-02-15 23:01:01', '%c'); // returns preferred date and time based on configured locale
* $this->Time->format('0000-00-00', '%d-%m-%Y', 'N/A'); // return N/A becuase an invalid date was passed
* $this->Time->format('2012-02-15 23:01:01', '%c', 'N/A', 'America/New_York'); // converts passed date to timezone
* }}}
*
* @see CakeTime::format() * @see CakeTime::format()
* *
* @param integer|string|DateTime $format date format string (or a UNIX timestamp, strtotime() valid string or DateTime object) * @param integer|string|DateTime $format date format string (or a UNIX timestamp, strtotime() valid string or DateTime object)
@ -442,6 +503,9 @@ class TimeHelper extends AppHelper {
} }
/** /**
* Returns a formatted date string, given either a UNIX timestamp or a valid strtotime() date string.
* It takes into account the default date format for the current language if a LC_TIME file is used.
*
* @see CakeTime::i18nFormat() * @see CakeTime::i18nFormat()
* *
* @param integer|string|DateTime $date UNIX timestamp, strtotime() valid string or DateTime object * @param integer|string|DateTime $date UNIX timestamp, strtotime() valid string or DateTime object

View file

@ -62,7 +62,7 @@ class MediaView extends View {
* *
* @param string $view Not used * @param string $view Not used
* @param string $layout Not used * @param string $layout Not used
* @return boolean * @return void
*/ */
public function render($view = null, $layout = null) { public function render($view = null, $layout = null) {
$name = $download = $id = $modified = $path = $cache = $mimeType = $compress = null; $name = $download = $id = $modified = $path = $cache = $mimeType = $compress = null;
@ -94,7 +94,6 @@ class MediaView extends View {
$this->response->compress(); $this->response->compress();
} }
$this->response->send(); $this->response->send();
return true;
} }
} }

View file

@ -299,16 +299,22 @@ class View extends Object {
/** /**
* Constant for view file type 'view' * Constant for view file type 'view'
*
* @var string
*/ */
const TYPE_VIEW = 'view'; const TYPE_VIEW = 'view';
/** /**
* Constant for view file type 'element' * Constant for view file type 'element'
*
* @var string
*/ */
const TYPE_ELEMENT = 'element'; const TYPE_ELEMENT = 'element';
/** /**
* Constant for view file type 'layout' * Constant for view file type 'layout'
*
* @var string
*/ */
const TYPE_LAYOUT = 'layout'; const TYPE_LAYOUT = 'layout';
@ -445,12 +451,12 @@ class View extends Object {
* *
* @param string $view Name of view file to use * @param string $view Name of view file to use
* @param string $layout Layout to use. * @param string $layout Layout to use.
* @return string Rendered Element * @return string|null Rendered content or null if content already rendered and returned earlier.
* @throws CakeException If there is an error in the view. * @throws CakeException If there is an error in the view.
*/ */
public function render($view = null, $layout = null) { public function render($view = null, $layout = null) {
if ($this->hasRendered) { if ($this->hasRendered) {
return true; return;
} }
if ($view !== false && $viewFileName = $this->_getViewFileName($view)) { if ($view !== false && $viewFileName = $this->_getViewFileName($view)) {

View file

@ -28,14 +28,14 @@ class ViewBlock {
/** /**
* Append content * Append content
* *
* @constant APPEND * @var string
*/ */
const APPEND = 'append'; const APPEND = 'append';
/** /**
* Prepend content * Prepend content
* *
* @constant PREPEND * @var string
*/ */
const PREPEND = 'prepend'; const PREPEND = 'prepend';