mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.7
Conflicts: lib/Cake/Utility/String.php
This commit is contained in:
commit
ac9a212d44
59 changed files with 346 additions and 263 deletions
|
@ -34,41 +34,41 @@
|
||||||
* will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be
|
* will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be
|
||||||
* done via a call to Acl->check() with
|
* done via a call to Acl->check() with
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* array('User' => array('username' => 'jeff', 'group_id' => 4, ...))
|
* array('User' => array('username' => 'jeff', 'group_id' => 4, ...))
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* as ARO and
|
* as ARO and
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* '/controllers/invoices/delete'
|
* '/controllers/invoices/delete'
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* as ACO.
|
* as ACO.
|
||||||
*
|
*
|
||||||
* If the configured map looks like
|
* If the configured map looks like
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $config['map'] = array(
|
* $config['map'] = array(
|
||||||
* 'User' => 'User/username',
|
* 'User' => 'User/username',
|
||||||
* 'Role' => 'User/group_id',
|
* 'Role' => 'User/group_id',
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to
|
* then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to
|
||||||
* find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to
|
* find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to
|
||||||
* check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration.
|
* check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration.
|
||||||
* E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like
|
* E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $config['alias'] = array(
|
* $config['alias'] = array(
|
||||||
* 'Role/4' => 'Role/editor',
|
* 'Role/4' => 'Role/editor',
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* In the roles configuration you can define roles on the lhs and inherited roles on the rhs:
|
* In the roles configuration you can define roles on the lhs and inherited roles on the rhs:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $config['roles'] = array(
|
* $config['roles'] = array(
|
||||||
* 'Role/admin' => null,
|
* 'Role/admin' => null,
|
||||||
* 'Role/accountant' => null,
|
* 'Role/accountant' => null,
|
||||||
|
@ -76,12 +76,12 @@
|
||||||
* 'Role/manager' => 'Role/editor, Role/accountant',
|
* 'Role/manager' => 'Role/editor, Role/accountant',
|
||||||
* 'User/jeff' => 'Role/manager',
|
* 'User/jeff' => 'Role/manager',
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role.
|
* In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role.
|
||||||
* Lets define some rules:
|
* Lets define some rules:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $config['rules'] = array(
|
* $config['rules'] = array(
|
||||||
* 'allow' => array(
|
* 'allow' => array(
|
||||||
* '*' => 'Role/admin',
|
* '*' => 'Role/admin',
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
* 'controllers/articles/(delete|publish)' => 'Role/editor',
|
* 'controllers/articles/(delete|publish)' => 'Role/editor',
|
||||||
* ),
|
* ),
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager,
|
* Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager,
|
||||||
* Role/editor, and Role/accountant. However, for jeff, rules for User/jeff are more specific than
|
* Role/editor, and Role/accountant. However, for jeff, rules for User/jeff are more specific than
|
||||||
|
|
|
@ -26,12 +26,12 @@ App::uses('CacheEngine', 'Cache');
|
||||||
* You can configure Cache engines in your application's `bootstrap.php` file. A sample configuration would
|
* You can configure Cache engines in your application's `bootstrap.php` file. A sample configuration would
|
||||||
* be
|
* be
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* Cache::config('shared', array(
|
* Cache::config('shared', array(
|
||||||
* 'engine' => 'Apc',
|
* 'engine' => 'Apc',
|
||||||
* 'prefix' => 'my_app_'
|
* 'prefix' => 'my_app_'
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* This would configure an APC cache engine to the 'shared' alias. You could then read and write
|
* This would configure an APC cache engine to the 'shared' alias. You could then read and write
|
||||||
* to that cache alias by using it for the `$config` parameter in the various Cache methods. In
|
* to that cache alias by using it for the `$config` parameter in the various Cache methods. In
|
||||||
|
@ -178,7 +178,12 @@ class Cache {
|
||||||
}
|
}
|
||||||
self::$_engines[$name] = new $cacheClass();
|
self::$_engines[$name] = new $cacheClass();
|
||||||
if (!self::$_engines[$name]->init($config)) {
|
if (!self::$_engines[$name]->init($config)) {
|
||||||
throw new CacheException(__d('cake_dev', 'Cache engine %s is not properly configured.', $name));
|
$msg = __d(
|
||||||
|
'cake_dev',
|
||||||
|
'Cache engine "%s" is not properly configured. Ensure required extensions are installed, and credentials/permissions are correct',
|
||||||
|
$name
|
||||||
|
);
|
||||||
|
throw new CacheException($msg);
|
||||||
}
|
}
|
||||||
if (self::$_engines[$name]->settings['probability'] && time() % self::$_engines[$name]->settings['probability'] === 0) {
|
if (self::$_engines[$name]->settings['probability'] && time() % self::$_engines[$name]->settings['probability'] === 0) {
|
||||||
self::$_engines[$name]->gc();
|
self::$_engines[$name]->gc();
|
||||||
|
@ -512,7 +517,7 @@ class Cache {
|
||||||
/**
|
/**
|
||||||
* Retrieve group names to config mapping.
|
* Retrieve group names to config mapping.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* Cache::config('daily', array(
|
* Cache::config('daily', array(
|
||||||
* 'duration' => '1 day', 'groups' => array('posts')
|
* 'duration' => '1 day', 'groups' => array('posts')
|
||||||
* ));
|
* ));
|
||||||
|
@ -520,7 +525,7 @@ class Cache {
|
||||||
* 'duration' => '1 week', 'groups' => array('posts', 'archive')
|
* 'duration' => '1 week', 'groups' => array('posts', 'archive')
|
||||||
* ));
|
* ));
|
||||||
* $configs = Cache::groupConfigs('posts');
|
* $configs = Cache::groupConfigs('posts');
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* $config will equal to `array('posts' => array('daily', 'weekly'))`
|
* $config will equal to `array('posts' => array('daily', 'weekly'))`
|
||||||
*
|
*
|
||||||
|
@ -549,12 +554,12 @@ class Cache {
|
||||||
*
|
*
|
||||||
* Using a Closure to provide data, assume $this is a Model:
|
* Using a Closure to provide data, assume $this is a Model:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $model = $this;
|
* $model = $this;
|
||||||
* $results = Cache::remember('all_articles', function() use ($model) {
|
* $results = Cache::remember('all_articles', function() use ($model) {
|
||||||
* return $model->find('all');
|
* return $model->find('all');
|
||||||
* });
|
* });
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $key The cache key to read/store data at.
|
* @param string $key The cache key to read/store data at.
|
||||||
* @param callable $callable The callable that provides data in the case when
|
* @param callable $callable The callable that provides data in the case when
|
||||||
|
|
|
@ -34,10 +34,10 @@ App::uses('CakePlugin', 'Core');
|
||||||
* You can nest properties as deeply as needed using `.`'s. In addition to using `.` you
|
* You can nest properties as deeply as needed using `.`'s. In addition to using `.` you
|
||||||
* can use standard ini section notation to create nested structures:
|
* can use standard ini section notation to create nested structures:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* [section]
|
* [section]
|
||||||
* key = value
|
* key = value
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Once loaded into Configure, the above would be accessed using:
|
* Once loaded into Configure, the above would be accessed using:
|
||||||
*
|
*
|
||||||
|
|
|
@ -175,7 +175,7 @@ class ConsoleOptionParser {
|
||||||
/**
|
/**
|
||||||
* Build a parser from an array. Uses an array like
|
* Build a parser from an array. Uses an array like
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $spec = array(
|
* $spec = array(
|
||||||
* 'description' => 'text',
|
* 'description' => 'text',
|
||||||
* 'epilog' => 'text',
|
* 'epilog' => 'text',
|
||||||
|
@ -189,7 +189,7 @@ class ConsoleOptionParser {
|
||||||
* // list of subcommands to add.
|
* // list of subcommands to add.
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param array $spec The spec to build the OptionParser with.
|
* @param array $spec The spec to build the OptionParser with.
|
||||||
* @return ConsoleOptionParser
|
* @return ConsoleOptionParser
|
||||||
|
|
|
@ -53,13 +53,13 @@ class TaskCollection extends ObjectCollection {
|
||||||
* Loads/constructs a task. Will return the instance in the registry if it already exists.
|
* Loads/constructs a task. Will return the instance in the registry if it already exists.
|
||||||
*
|
*
|
||||||
* You can alias your task as an existing task by setting the 'className' key, i.e.,
|
* You can alias your task as an existing task by setting the 'className' key, i.e.,
|
||||||
* {{{
|
* ```
|
||||||
* public $tasks = array(
|
* public $tasks = array(
|
||||||
* 'DbConfig' => array(
|
* 'DbConfig' => array(
|
||||||
* 'className' => 'Bakeplus.DbConfigure'
|
* 'className' => 'Bakeplus.DbConfigure'
|
||||||
* );
|
* );
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
* All calls to the `DbConfig` task would use `DbConfigure` found in the `Bakeplus` plugin instead.
|
* All calls to the `DbConfig` task would use `DbConfigure` found in the `Bakeplus` plugin instead.
|
||||||
*
|
*
|
||||||
* @param string $task Task name to load
|
* @param string $task Task name to load
|
||||||
|
|
|
@ -29,11 +29,11 @@ App::uses('ClassRegistry', 'Utility');
|
||||||
*
|
*
|
||||||
* Would point to a tree structure like
|
* Would point to a tree structure like
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* controllers
|
* controllers
|
||||||
* Users
|
* Users
|
||||||
* edit
|
* edit
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @package Cake.Controller.Component.Acl
|
* @package Cake.Controller.Component.Acl
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -124,21 +124,21 @@ abstract class BaseAuthorize {
|
||||||
*
|
*
|
||||||
* Create additional mappings for a standard CRUD operation:
|
* Create additional mappings for a standard CRUD operation:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Auth->mapActions(array('create' => array('add', 'register'));
|
* $this->Auth->mapActions(array('create' => array('add', 'register'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Or equivalently:
|
* Or equivalently:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Auth->mapActions(array('register' => 'create', 'add' => 'create'));
|
* $this->Auth->mapActions(array('register' => 'create', 'add' => 'create'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Create mappings for custom CRUD operations:
|
* Create mappings for custom CRUD operations:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Auth->mapActions(array('range' => 'search'));
|
* $this->Auth->mapActions(array('range' => 'search'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* You can use the custom CRUD operations to create additional generic permissions
|
* You can use the custom CRUD operations to create additional generic permissions
|
||||||
* that behave like CRUD operations. Doing this will require additional columns on the
|
* that behave like CRUD operations. Doing this will require additional columns on the
|
||||||
|
|
|
@ -24,13 +24,13 @@ App::uses('BaseAuthenticate', 'Controller/Component/Auth');
|
||||||
* ### Using Basic auth
|
* ### Using Basic auth
|
||||||
*
|
*
|
||||||
* In your controller's components array, add auth + the required settings.
|
* In your controller's components array, add auth + the required settings.
|
||||||
* {{{
|
* ```
|
||||||
* public $components = array(
|
* public $components = array(
|
||||||
* 'Auth' => array(
|
* 'Auth' => array(
|
||||||
* 'authenticate' => array('Basic')
|
* 'authenticate' => array('Basic')
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* You should also set `AuthComponent::$sessionKey = false;` in your AppController's
|
* You should also set `AuthComponent::$sessionKey = false;` in your AppController's
|
||||||
* beforeFilter() to prevent CakePHP from sending a session cookie to the client.
|
* beforeFilter() to prevent CakePHP from sending a session cookie to the client.
|
||||||
|
|
|
@ -18,13 +18,13 @@ App::uses('FormAuthenticate', 'Controller/Component/Auth');
|
||||||
* An authentication adapter for AuthComponent. Provides the ability to authenticate using POST data using Blowfish
|
* An authentication adapter for AuthComponent. Provides the ability to authenticate using POST data using Blowfish
|
||||||
* hashing. Can be used by configuring AuthComponent to use it via the AuthComponent::$authenticate setting.
|
* hashing. Can be used by configuring AuthComponent to use it via the AuthComponent::$authenticate setting.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Auth->authenticate = array(
|
* $this->Auth->authenticate = array(
|
||||||
* 'Blowfish' => array(
|
* 'Blowfish' => array(
|
||||||
* 'scope' => array('User.active' => 1)
|
* 'scope' => array('User.active' => 1)
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* When configuring BlowfishAuthenticate you can pass in settings to which fields, model and additional conditions
|
* When configuring BlowfishAuthenticate you can pass in settings to which fields, model and additional conditions
|
||||||
* are used. See FormAuthenticate::$settings for more information.
|
* are used. See FormAuthenticate::$settings for more information.
|
||||||
|
|
|
@ -18,14 +18,14 @@ App::uses('BaseAuthorize', 'Controller/Component/Auth');
|
||||||
* An authorization adapter for AuthComponent. Provides the ability to authorize using a controller callback.
|
* An authorization adapter for AuthComponent. Provides the ability to authorize using a controller callback.
|
||||||
* Your controller's isAuthorized() method should return a boolean to indicate whether or not the user is authorized.
|
* Your controller's isAuthorized() method should return a boolean to indicate whether or not the user is authorized.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public function isAuthorized($user) {
|
* public function isAuthorized($user) {
|
||||||
* if (!empty($this->request->params['admin'])) {
|
* if (!empty($this->request->params['admin'])) {
|
||||||
* return $user['role'] === 'admin';
|
* return $user['role'] === 'admin';
|
||||||
* }
|
* }
|
||||||
* return !empty($user);
|
* return !empty($user);
|
||||||
* }
|
* }
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* the above is simple implementation that would only authorize users of the 'admin' role to access
|
* the above is simple implementation that would only authorize users of the 'admin' role to access
|
||||||
* admin routing.
|
* admin routing.
|
||||||
|
|
|
@ -28,13 +28,13 @@ App::uses('BasicAuthenticate', 'Controller/Component/Auth');
|
||||||
* ### Using Digest auth
|
* ### Using Digest auth
|
||||||
*
|
*
|
||||||
* In your controller's components array, add auth + the required settings.
|
* In your controller's components array, add auth + the required settings.
|
||||||
* {{{
|
* ```
|
||||||
* public $components = array(
|
* public $components = array(
|
||||||
* 'Auth' => array(
|
* 'Auth' => array(
|
||||||
* 'authenticate' => array('Digest')
|
* 'authenticate' => array('Digest')
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* In your login function just call `$this->Auth->login()` without any checks for POST data. This
|
* In your login function just call `$this->Auth->login()` without any checks for POST data. This
|
||||||
* will send the authentication headers, and trigger the login dialog in the browser/client.
|
* will send the authentication headers, and trigger the login dialog in the browser/client.
|
||||||
|
|
|
@ -18,13 +18,13 @@ App::uses('BaseAuthenticate', 'Controller/Component/Auth');
|
||||||
* An authentication adapter for AuthComponent. Provides the ability to authenticate using POST
|
* An authentication adapter for AuthComponent. Provides the ability to authenticate using POST
|
||||||
* data. Can be used by configuring AuthComponent to use it via the AuthComponent::$authenticate setting.
|
* data. Can be used by configuring AuthComponent to use it via the AuthComponent::$authenticate setting.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Auth->authenticate = array(
|
* $this->Auth->authenticate = array(
|
||||||
* 'Form' => array(
|
* 'Form' => array(
|
||||||
* 'scope' => array('User.active' => 1)
|
* 'scope' => array('User.active' => 1)
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* When configuring FormAuthenticate you can pass in settings to which fields, model and additional conditions
|
* When configuring FormAuthenticate you can pass in settings to which fields, model and additional conditions
|
||||||
* are used. See FormAuthenticate::$settings for more information.
|
* are used. See FormAuthenticate::$settings for more information.
|
||||||
|
|
|
@ -56,19 +56,19 @@ class AuthComponent extends Component {
|
||||||
* An array of authentication objects to use for authenticating users. You can configure
|
* An array of authentication objects to use for authenticating users. You can configure
|
||||||
* multiple adapters and they will be checked sequentially when users are identified.
|
* multiple adapters and they will be checked sequentially when users are identified.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Auth->authenticate = array(
|
* $this->Auth->authenticate = array(
|
||||||
* 'Form' => array(
|
* 'Form' => array(
|
||||||
* 'userModel' => 'Users.User'
|
* 'userModel' => 'Users.User'
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Using the class name without 'Authenticate' as the key, you can pass in an array of settings for each
|
* Using the class name without 'Authenticate' as the key, you can pass in an array of settings for each
|
||||||
* authentication object. Additionally you can define settings that should be set to all authentications objects
|
* authentication object. Additionally you can define settings that should be set to all authentications objects
|
||||||
* using the 'all' key:
|
* using the 'all' key:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Auth->authenticate = array(
|
* $this->Auth->authenticate = array(
|
||||||
* 'all' => array(
|
* 'all' => array(
|
||||||
* 'userModel' => 'Users.User',
|
* 'userModel' => 'Users.User',
|
||||||
|
@ -77,7 +77,7 @@ class AuthComponent extends Component {
|
||||||
* 'Form',
|
* 'Form',
|
||||||
* 'Basic'
|
* 'Basic'
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* You can also use AuthComponent::ALL instead of the string 'all'.
|
* You can also use AuthComponent::ALL instead of the string 'all'.
|
||||||
*
|
*
|
||||||
|
@ -97,19 +97,19 @@ class AuthComponent extends Component {
|
||||||
* An array of authorization objects to use for authorizing users. You can configure
|
* An array of authorization objects to use for authorizing users. You can configure
|
||||||
* multiple adapters and they will be checked sequentially when authorization checks are done.
|
* multiple adapters and they will be checked sequentially when authorization checks are done.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Auth->authorize = array(
|
* $this->Auth->authorize = array(
|
||||||
* 'Crud' => array(
|
* 'Crud' => array(
|
||||||
* 'actionPath' => 'controllers/'
|
* 'actionPath' => 'controllers/'
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Using the class name without 'Authorize' as the key, you can pass in an array of settings for each
|
* Using the class name without 'Authorize' as the key, you can pass in an array of settings for each
|
||||||
* authorization object. Additionally you can define settings that should be set to all authorization objects
|
* authorization object. Additionally you can define settings that should be set to all authorization objects
|
||||||
* using the 'all' key:
|
* using the 'all' key:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Auth->authorize = array(
|
* $this->Auth->authorize = array(
|
||||||
* 'all' => array(
|
* 'all' => array(
|
||||||
* 'actionPath' => 'controllers/'
|
* 'actionPath' => 'controllers/'
|
||||||
|
@ -117,7 +117,7 @@ class AuthComponent extends Component {
|
||||||
* 'Crud',
|
* 'Crud',
|
||||||
* 'CustomAuth'
|
* 'CustomAuth'
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* You can also use AuthComponent::ALL instead of the string 'all'
|
* You can also use AuthComponent::ALL instead of the string 'all'
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,17 +29,17 @@ App::uses('Hash', 'Utility');
|
||||||
* the default pagination behavior in general or for a specific model. General settings are used when there
|
* the default pagination behavior in general or for a specific model. General settings are used when there
|
||||||
* are no specific model configuration, or the model you are paginating does not have specific settings.
|
* are no specific model configuration, or the model you are paginating does not have specific settings.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Paginator->settings = array(
|
* $this->Paginator->settings = array(
|
||||||
* 'limit' => 20,
|
* 'limit' => 20,
|
||||||
* 'maxLimit' => 100
|
* 'maxLimit' => 100
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The above settings will be used to paginate any model. You can configure model specific settings by
|
* The above settings will be used to paginate any model. You can configure model specific settings by
|
||||||
* keying the settings with the model name.
|
* keying the settings with the model name.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Paginator->settings = array(
|
* $this->Paginator->settings = array(
|
||||||
* 'Post' => array(
|
* 'Post' => array(
|
||||||
* 'limit' => 20,
|
* 'limit' => 20,
|
||||||
|
@ -47,7 +47,7 @@ App::uses('Hash', 'Utility');
|
||||||
* ),
|
* ),
|
||||||
* 'Comment' => array( ... )
|
* 'Comment' => array( ... )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* This would allow you to have different pagination settings for `Comment` and `Post` models.
|
* This would allow you to have different pagination settings for `Comment` and `Post` models.
|
||||||
*
|
*
|
||||||
|
@ -55,13 +55,13 @@ App::uses('Hash', 'Utility');
|
||||||
*
|
*
|
||||||
* You can paginate with any find type defined on your model using the `findType` option.
|
* You can paginate with any find type defined on your model using the `findType` option.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Paginator->settings = array(
|
* $this->Paginator->settings = array(
|
||||||
* 'Post' => array(
|
* 'Post' => array(
|
||||||
* 'findType' => 'popular'
|
* 'findType' => 'popular'
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Would paginate using the `find('popular')` method.
|
* Would paginate using the `find('popular')` method.
|
||||||
*
|
*
|
||||||
|
|
|
@ -79,13 +79,13 @@ class ComponentCollection extends ObjectCollection implements CakeEventListener
|
||||||
* Callbacks default to on. Disabled component methods work as normal, only callbacks are disabled.
|
* Callbacks default to on. Disabled component methods work as normal, only callbacks are disabled.
|
||||||
*
|
*
|
||||||
* You can alias your component as an existing component by setting the 'className' key, i.e.,
|
* You can alias your component as an existing component by setting the 'className' key, i.e.,
|
||||||
* {{{
|
* ```
|
||||||
* public $components = array(
|
* public $components = array(
|
||||||
* 'Email' => array(
|
* 'Email' => array(
|
||||||
* 'className' => 'AliasedEmail'
|
* 'className' => 'AliasedEmail'
|
||||||
* );
|
* );
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
* All calls to the `Email` component would use `AliasedEmail` instead.
|
* All calls to the `Email` component would use `AliasedEmail` instead.
|
||||||
*
|
*
|
||||||
* @param string $component Component name to load
|
* @param string $component Component name to load
|
||||||
|
|
|
@ -227,12 +227,12 @@ class Controller extends Object implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $cacheAction = array(
|
* public $cacheAction = array(
|
||||||
* 'view/23/' => 21600,
|
* 'view/23/' => 21600,
|
||||||
* 'recalled/' => 86400
|
* 'recalled/' => 86400
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* $cacheAction can also be set to a strtotime() compatible string. This
|
* $cacheAction can also be set to a strtotime() compatible string. This
|
||||||
* marks all the actions in the controller for view caching.
|
* marks all the actions in the controller for view caching.
|
||||||
|
@ -857,10 +857,10 @@ class Controller extends Object implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* setAction('another_action');
|
* setAction('another_action');
|
||||||
* setAction('action_with_parameters', $parameter1);
|
* setAction('action_with_parameters', $parameter1);
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $action The new action to be 'redirected' to.
|
* @param string $action The new action to be 'redirected' to.
|
||||||
* Any other parameters passed to this method will be passed as parameters to the new action.
|
* Any other parameters passed to this method will be passed as parameters to the new action.
|
||||||
|
|
|
@ -51,12 +51,12 @@ class CakePlugin {
|
||||||
* `CakePlugin::load(array('DebugKit', 'ApiGenerator'))` will load the DebugKit and ApiGenerator plugins
|
* `CakePlugin::load(array('DebugKit', 'ApiGenerator'))` will load the DebugKit and ApiGenerator plugins
|
||||||
* `CakePlugin::load(array('DebugKit', 'ApiGenerator'), array('bootstrap' => true))` will load bootstrap file for both plugins
|
* `CakePlugin::load(array('DebugKit', 'ApiGenerator'), array('bootstrap' => true))` will load bootstrap file for both plugins
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakePlugin::load(array(
|
* CakePlugin::load(array(
|
||||||
* 'DebugKit' => array('routes' => true),
|
* 'DebugKit' => array('routes' => true),
|
||||||
* 'ApiGenerator'
|
* 'ApiGenerator'
|
||||||
* ), array('bootstrap' => true))
|
* ), array('bootstrap' => true))
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Will only load the bootstrap for ApiGenerator and only the routes for DebugKit
|
* Will only load the bootstrap for ApiGenerator and only the routes for DebugKit
|
||||||
*
|
*
|
||||||
|
@ -105,12 +105,12 @@ class CakePlugin {
|
||||||
* If passed an options array, it will be used as a common default for all plugins to be loaded
|
* If passed an options array, it will be used as a common default for all plugins to be loaded
|
||||||
* It is possible to set specific defaults for each plugins in the options array. Examples:
|
* It is possible to set specific defaults for each plugins in the options array. Examples:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakePlugin::loadAll(array(
|
* CakePlugin::loadAll(array(
|
||||||
* array('bootstrap' => true),
|
* array('bootstrap' => true),
|
||||||
* 'DebugKit' => array('routes' => true, 'bootstrap' => false),
|
* 'DebugKit' => array('routes' => true, 'bootstrap' => false),
|
||||||
* ))
|
* ))
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The above example will load the bootstrap file for all plugins, but for DebugKit it will only load
|
* The above example will load the bootstrap file for all plugins, but for DebugKit it will only load
|
||||||
* the routes file and will not look for any bootstrap script.
|
* the routes file and will not look for any bootstrap script.
|
||||||
|
|
|
@ -130,7 +130,7 @@ class Configure {
|
||||||
* Used to store a dynamic variable in Configure.
|
* Used to store a dynamic variable in Configure.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* {{{
|
* ```
|
||||||
* Configure::write('One.key1', 'value of the Configure::One[key1]');
|
* Configure::write('One.key1', 'value of the Configure::One[key1]');
|
||||||
* Configure::write(array('One.key1' => 'value of the Configure::One[key1]'));
|
* Configure::write(array('One.key1' => 'value of the Configure::One[key1]'));
|
||||||
* Configure::write('One', array(
|
* Configure::write('One', array(
|
||||||
|
@ -142,7 +142,7 @@ class Configure {
|
||||||
* 'One.key1' => 'value of the Configure::One[key1]',
|
* 'One.key1' => 'value of the Configure::One[key1]',
|
||||||
* 'One.key2' => 'value of the Configure::One[key2]'
|
* 'One.key2' => 'value of the Configure::One[key2]'
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string|array $config The key to write, can be a dot notation value.
|
* @param string|array $config The key to write, can be a dot notation value.
|
||||||
* Alternatively can be an array containing key(s) and value(s).
|
* Alternatively can be an array containing key(s) and value(s).
|
||||||
|
@ -174,10 +174,10 @@ class Configure {
|
||||||
* possible to store `null` values in Configure.
|
* possible to store `null` values in Configure.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* {{{
|
* ```
|
||||||
* Configure::read('Name'); will return all values for Name
|
* Configure::read('Name'); will return all values for Name
|
||||||
* Configure::read('Name.key'); will return only the value of Configure::Name[key]
|
* Configure::read('Name.key'); will return only the value of Configure::Name[key]
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string|null $var Variable to obtain. Use '.' to access array elements.
|
* @param string|null $var Variable to obtain. Use '.' to access array elements.
|
||||||
* @return mixed value stored in configure, or null.
|
* @return mixed value stored in configure, or null.
|
||||||
|
@ -231,10 +231,10 @@ class Configure {
|
||||||
* Used to delete a variable from Configure.
|
* Used to delete a variable from Configure.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* {{{
|
* ```
|
||||||
* Configure::delete('Name'); will delete the entire Configure::Name
|
* Configure::delete('Name'); will delete the entire Configure::Name
|
||||||
* Configure::delete('Name.key'); will delete only the Configure::Name[key]
|
* Configure::delete('Name.key'); will delete only the Configure::Name[key]
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $var the var to be deleted
|
* @param string $var the var to be deleted
|
||||||
* @return void
|
* @return void
|
||||||
|
|
|
@ -67,10 +67,10 @@ class CakeEvent {
|
||||||
*
|
*
|
||||||
* ## Examples of usage:
|
* ## Examples of usage:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $event = new CakeEvent('Order.afterBuy', $this, array('buyer' => $userData));
|
* $event = new CakeEvent('Order.afterBuy', $this, array('buyer' => $userData));
|
||||||
* $event = new CakeEvent('User.afterRegister', $UserModel);
|
* $event = new CakeEvent('User.afterRegister', $UserModel);
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function __construct($name, $subject = null, $data = null) {
|
public function __construct($name, $subject = null, $data = null) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ interface CakeEventListener {
|
||||||
*
|
*
|
||||||
* ## Example:
|
* ## Example:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public function implementedEvents() {
|
* public function implementedEvents() {
|
||||||
* return array(
|
* return array(
|
||||||
* 'Order.complete' => 'sendEmail',
|
* 'Order.complete' => 'sendEmail',
|
||||||
|
@ -36,7 +36,7 @@ interface CakeEventListener {
|
||||||
* 'User.onRegister' => array('callable' => 'logRegistration', 'priority' => 20, 'passParams' => true)
|
* 'User.onRegister' => array('callable' => 'logRegistration', 'priority' => 20, 'passParams' => true)
|
||||||
* );
|
* );
|
||||||
* }
|
* }
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @return array associative array or event key names pointing to the function
|
* @return array associative array or event key names pointing to the function
|
||||||
* that should be called in the object when the respective event is fired
|
* that should be called in the object when the respective event is fired
|
||||||
|
|
|
@ -93,9 +93,9 @@ class I18n {
|
||||||
* The constants may be used in translation fetching
|
* The constants may be used in translation fetching
|
||||||
* instead of hardcoded integers.
|
* instead of hardcoded integers.
|
||||||
* Example:
|
* Example:
|
||||||
* {{{
|
* ```
|
||||||
* I18n::translate('CakePHP is awesome.', null, null, I18n::LC_MESSAGES)
|
* I18n::translate('CakePHP is awesome.', null, null, I18n::LC_MESSAGES)
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* To keep the code more readable, I18n constants are preferred over
|
* To keep the code more readable, I18n constants are preferred over
|
||||||
* hardcoded integers.
|
* hardcoded integers.
|
||||||
|
|
|
@ -31,9 +31,9 @@ App::uses('LogEngineCollection', 'Log');
|
||||||
* You can configure log adapters in your applications `bootstrap.php` file.
|
* You can configure log adapters in your applications `bootstrap.php` file.
|
||||||
* A sample configuration would look like:
|
* A sample configuration would look like:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakeLog::config('my_log', array('engine' => 'File'));
|
* CakeLog::config('my_log', array('engine' => 'File'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* See the documentation on CakeLog::config() for more detail.
|
* See the documentation on CakeLog::config() for more detail.
|
||||||
*
|
*
|
||||||
|
@ -48,10 +48,10 @@ App::uses('LogEngineCollection', 'Log');
|
||||||
* RFC 5424. When logging messages you can either use the named methods,
|
* RFC 5424. When logging messages you can either use the named methods,
|
||||||
* or the correct constants with `write()`:
|
* or the correct constants with `write()`:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakeLog::error('Something horrible happened');
|
* CakeLog::error('Something horrible happened');
|
||||||
* CakeLog::write(LOG_ERR, 'Something horrible happened');
|
* CakeLog::write(LOG_ERR, 'Something horrible happened');
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* If you require custom logging levels, you can use CakeLog::levels() to
|
* If you require custom logging levels, you can use CakeLog::levels() to
|
||||||
* append additional logging levels.
|
* append additional logging levels.
|
||||||
|
@ -129,12 +129,12 @@ class CakeLog {
|
||||||
*
|
*
|
||||||
* ### Usage:
|
* ### Usage:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakeLog::config('second_file', array(
|
* CakeLog::config('second_file', array(
|
||||||
* 'engine' => 'File',
|
* 'engine' => 'File',
|
||||||
* 'path' => '/var/logs/my_app/'
|
* 'path' => '/var/logs/my_app/'
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Will configure a FileLog instance to use the specified path.
|
* Will configure a FileLog instance to use the specified path.
|
||||||
* All options that are not `engine` are passed onto the logging adapter,
|
* All options that are not `engine` are passed onto the logging adapter,
|
||||||
|
@ -146,13 +146,13 @@ class CakeLog {
|
||||||
* When configuring loggers, you can set which levels a logger will handle.
|
* When configuring loggers, you can set which levels a logger will handle.
|
||||||
* This allows you to disable debug messages in production for example:
|
* This allows you to disable debug messages in production for example:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakeLog::config('default', array(
|
* CakeLog::config('default', array(
|
||||||
* 'engine' => 'File',
|
* 'engine' => 'File',
|
||||||
* 'path' => LOGS,
|
* 'path' => LOGS,
|
||||||
* 'levels' => array('error', 'critical', 'alert', 'emergency')
|
* 'levels' => array('error', 'critical', 'alert', 'emergency')
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The above logger would only log error messages or higher. Any
|
* The above logger would only log error messages or higher. Any
|
||||||
* other log messages would be discarded.
|
* other log messages would be discarded.
|
||||||
|
@ -164,13 +164,13 @@ class CakeLog {
|
||||||
* logger. If you don't define any scopes an adapter will catch
|
* logger. If you don't define any scopes an adapter will catch
|
||||||
* all scopes that match the handled levels.
|
* all scopes that match the handled levels.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakeLog::config('payments', array(
|
* CakeLog::config('payments', array(
|
||||||
* 'engine' => 'File',
|
* 'engine' => 'File',
|
||||||
* 'types' => array('info', 'error', 'warning'),
|
* 'types' => array('info', 'error', 'warning'),
|
||||||
* 'scopes' => array('payment', 'order')
|
* 'scopes' => array('payment', 'order')
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The above logger will only capture log entries made in the
|
* The above logger will only capture log entries made in the
|
||||||
* `payment` and `order` scopes. All other scopes including the
|
* `payment` and `order` scopes. All other scopes including the
|
||||||
|
@ -220,15 +220,15 @@ class CakeLog {
|
||||||
*
|
*
|
||||||
* To append additional level 'user0' and 'user1' to to default log levels:
|
* To append additional level 'user0' and 'user1' to to default log levels:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakeLog::levels(array('user0, 'user1'));
|
* CakeLog::levels(array('user0, 'user1'));
|
||||||
* // or
|
* // or
|
||||||
* CakeLog::levels(array('user0, 'user1'), true);
|
* CakeLog::levels(array('user0, 'user1'), true);
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* will result in:
|
* will result in:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* array(
|
* array(
|
||||||
* 0 => 'emergency',
|
* 0 => 'emergency',
|
||||||
* 1 => 'alert',
|
* 1 => 'alert',
|
||||||
|
@ -236,23 +236,23 @@ class CakeLog {
|
||||||
* 8 => 'user0',
|
* 8 => 'user0',
|
||||||
* 9 => 'user1',
|
* 9 => 'user1',
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* To set/replace existing configuration, pass an array with the second argument
|
* To set/replace existing configuration, pass an array with the second argument
|
||||||
* set to false.
|
* set to false.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakeLog::levels(array('user0, 'user1'), false);
|
* CakeLog::levels(array('user0, 'user1'), false);
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* will result in:
|
* will result in:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* array(
|
* array(
|
||||||
* 0 => 'user0',
|
* 0 => 'user0',
|
||||||
* 1 => 'user1',
|
* 1 => 'user1',
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param array $levels array
|
* @param array $levels array
|
||||||
* @param bool $append true to append, false to replace
|
* @param bool $append true to append, false to replace
|
||||||
|
|
|
@ -40,14 +40,14 @@ class SyslogLog extends BaseLog {
|
||||||
*
|
*
|
||||||
* ## Example:
|
* ## Example:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakeLog::config('error', array(
|
* CakeLog::config('error', array(
|
||||||
* 'engine' => 'Syslog',
|
* 'engine' => 'Syslog',
|
||||||
* 'types' => array('emergency', 'alert', 'critical', 'error'),
|
* 'types' => array('emergency', 'alert', 'critical', 'error'),
|
||||||
* 'format' => "%s: My-App - %s",
|
* 'format' => "%s: My-App - %s",
|
||||||
* 'prefix' => 'Web Server 01'
|
* 'prefix' => 'Web Server 01'
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -75,7 +75,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
*
|
*
|
||||||
* `Model->find('all', array('contain' => array('Model1', 'Model2')));`
|
* `Model->find('all', array('contain' => array('Model1', 'Model2')));`
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* Model->find('all', array('contain' => array(
|
* Model->find('all', array('contain' => array(
|
||||||
* 'Model1' => array('Model11', 'Model12'),
|
* 'Model1' => array('Model11', 'Model12'),
|
||||||
* 'Model2',
|
* 'Model2',
|
||||||
|
@ -84,7 +84,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
* 'Model32',
|
* 'Model32',
|
||||||
* 'Model33' => array('Model331', 'Model332')
|
* 'Model33' => array('Model331', 'Model332')
|
||||||
* )));
|
* )));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param Model $Model Model using the behavior
|
* @param Model $Model Model using the behavior
|
||||||
* @param array $query Query parameters as set by cake
|
* @param array $query Query parameters as set by cake
|
||||||
|
|
|
@ -86,13 +86,13 @@ class BehaviorCollection extends ObjectCollection implements CakeEventListener {
|
||||||
* can still be used as normal.
|
* can still be used as normal.
|
||||||
*
|
*
|
||||||
* You can alias your behavior as an existing behavior by setting the 'className' key, i.e.,
|
* You can alias your behavior as an existing behavior by setting the 'className' key, i.e.,
|
||||||
* {{{
|
* ```
|
||||||
* public $actsAs = array(
|
* public $actsAs = array(
|
||||||
* 'Tree' => array(
|
* 'Tree' => array(
|
||||||
* 'className' => 'AliasedTree'
|
* 'className' => 'AliasedTree'
|
||||||
* );
|
* );
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
* All calls to the `Tree` behavior would use `AliasedTree` instead.
|
* All calls to the `Tree` behavior would use `AliasedTree` instead.
|
||||||
*
|
*
|
||||||
* @param string $behavior CamelCased name of the behavior to load
|
* @param string $behavior CamelCased name of the behavior to load
|
||||||
|
|
|
@ -124,33 +124,33 @@ class Model extends Object implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* ### Validating using regular expressions
|
* ### Validating using regular expressions
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $validate = array(
|
* public $validate = array(
|
||||||
* 'name' => '/^[a-z].+$/i'
|
* 'name' => '/^[a-z].+$/i'
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Validating using methods (no parameters)
|
* ### Validating using methods (no parameters)
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $validate = array(
|
* public $validate = array(
|
||||||
* 'name' => 'notEmpty'
|
* 'name' => 'notEmpty'
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Validating using methods (with parameters)
|
* ### Validating using methods (with parameters)
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $validate = array(
|
* public $validate = array(
|
||||||
* 'length' => array(
|
* 'length' => array(
|
||||||
* 'rule' => array('lengthBetween', 5, 25)
|
* 'rule' => array('lengthBetween', 5, 25)
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Validating using custom method
|
* ### Validating using custom method
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $validate = array(
|
* public $validate = array(
|
||||||
* 'password' => array(
|
* 'password' => array(
|
||||||
* 'rule' => array('customValidation')
|
* 'rule' => array('customValidation')
|
||||||
|
@ -163,24 +163,24 @@ class Model extends Object implements CakeEventListener {
|
||||||
* }
|
* }
|
||||||
* return true;
|
* return true;
|
||||||
* }
|
* }
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Validations with messages
|
* ### Validations with messages
|
||||||
*
|
*
|
||||||
* The messages will be used in Model::$validationErrors and can be used in the FormHelper
|
* The messages will be used in Model::$validationErrors and can be used in the FormHelper
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $validate = array(
|
* public $validate = array(
|
||||||
* 'length' => array(
|
* 'length' => array(
|
||||||
* 'rule' => array('lengthBetween', 5, 15),
|
* 'rule' => array('lengthBetween', 5, 15),
|
||||||
* 'message' => array('Between %d to %d characters')
|
* 'message' => array('Between %d to %d characters')
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Multiple validations to the same field
|
* ### Multiple validations to the same field
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $validate = array(
|
* public $validate = array(
|
||||||
* 'login' => array(
|
* 'login' => array(
|
||||||
* array(
|
* array(
|
||||||
|
@ -194,7 +194,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Valid keys in validations
|
* ### Valid keys in validations
|
||||||
*
|
*
|
||||||
|
@ -280,7 +280,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* ### Detailed configuration
|
* ### Detailed configuration
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $belongsTo = array(
|
* public $belongsTo = array(
|
||||||
* 'Group',
|
* 'Group',
|
||||||
* 'Department' => array(
|
* 'Department' => array(
|
||||||
|
@ -288,7 +288,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* 'foreignKey' => 'department_id'
|
* 'foreignKey' => 'department_id'
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Possible keys in association
|
* ### Possible keys in association
|
||||||
*
|
*
|
||||||
|
@ -327,7 +327,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* ### Detailed configuration
|
* ### Detailed configuration
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $hasOne = array(
|
* public $hasOne = array(
|
||||||
* 'Profile',
|
* 'Profile',
|
||||||
* 'Address' => array(
|
* 'Address' => array(
|
||||||
|
@ -335,7 +335,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* 'foreignKey' => 'user_id'
|
* 'foreignKey' => 'user_id'
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Possible keys in association
|
* ### Possible keys in association
|
||||||
*
|
*
|
||||||
|
@ -370,7 +370,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* ### Detailed configuration
|
* ### Detailed configuration
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $hasMany = array(
|
* public $hasMany = array(
|
||||||
* 'Comment',
|
* 'Comment',
|
||||||
* 'Task' => array(
|
* 'Task' => array(
|
||||||
|
@ -378,7 +378,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* 'foreignKey' => 'user_id'
|
* 'foreignKey' => 'user_id'
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Possible keys in association
|
* ### Possible keys in association
|
||||||
*
|
*
|
||||||
|
@ -419,7 +419,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* ### Detailed configuration
|
* ### Detailed configuration
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $hasAndBelongsToMany = array(
|
* public $hasAndBelongsToMany = array(
|
||||||
* 'Role',
|
* 'Role',
|
||||||
* 'Address' => array(
|
* 'Address' => array(
|
||||||
|
@ -429,7 +429,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* 'joinTable' => 'addresses_users'
|
* 'joinTable' => 'addresses_users'
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Possible keys in association
|
* ### Possible keys in association
|
||||||
*
|
*
|
||||||
|
@ -607,7 +607,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* If true, afterFind will be passed consistent formatted $results in case of $primary is false.
|
* If true, afterFind will be passed consistent formatted $results in case of $primary is false.
|
||||||
* The format will be such as the following.
|
* The format will be such as the following.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $results = array(
|
* $results = array(
|
||||||
* 0 => array(
|
* 0 => array(
|
||||||
* 'ModelName' => array(
|
* 'ModelName' => array(
|
||||||
|
@ -616,7 +616,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
|
@ -683,9 +683,9 @@ class Model extends Object implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* You can dynamically create model instances using the $id array syntax.
|
* You can dynamically create model instances using the $id array syntax.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $Post = new Model(array('table' => 'posts', 'name' => 'Post', 'ds' => 'connection2'));
|
* $Post = new Model(array('table' => 'posts', 'name' => 'Post', 'ds' => 'connection2'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Would create a model attached to the posts table on connection2. Dynamic model creation is useful
|
* Would create a model attached to the posts table on connection2. Dynamic model creation is useful
|
||||||
* when you want a model object that contains no associations or attached behaviors.
|
* when you want a model object that contains no associations or attached behaviors.
|
||||||
|
@ -2233,12 +2233,12 @@ class Model extends Object implements CakeEventListener {
|
||||||
* Should be set to false if database/table does not support transactions.
|
* Should be set to false if database/table does not support transactions.
|
||||||
* - `fieldList`: Equivalent to the $fieldList parameter in Model::save().
|
* - `fieldList`: Equivalent to the $fieldList parameter in Model::save().
|
||||||
* It should be an associate array with model name as key and array of fields as value. Eg.
|
* It should be an associate array with model name as key and array of fields as value. Eg.
|
||||||
* {{{
|
* ```
|
||||||
* array(
|
* array(
|
||||||
* 'SomeModel' => array('field'),
|
* 'SomeModel' => array('field'),
|
||||||
* 'AssociatedModel' => array('field', 'otherfield')
|
* 'AssociatedModel' => array('field', 'otherfield')
|
||||||
* )
|
* )
|
||||||
* }}}
|
* ```
|
||||||
* - `deep`: See saveMany/saveAssociated
|
* - `deep`: See saveMany/saveAssociated
|
||||||
* - `callbacks`: See Model::save()
|
* - `callbacks`: See Model::save()
|
||||||
* - `counterCache`: See Model::save()
|
* - `counterCache`: See Model::save()
|
||||||
|
@ -2406,12 +2406,12 @@ class Model extends Object implements CakeEventListener {
|
||||||
* Should be set to false if database/table does not support transactions.
|
* Should be set to false if database/table does not support transactions.
|
||||||
* - `fieldList`: Equivalent to the $fieldList parameter in Model::save().
|
* - `fieldList`: Equivalent to the $fieldList parameter in Model::save().
|
||||||
* It should be an associate array with model name as key and array of fields as value. Eg.
|
* It should be an associate array with model name as key and array of fields as value. Eg.
|
||||||
* {{{
|
* ```
|
||||||
* array(
|
* array(
|
||||||
* 'SomeModel' => array('field'),
|
* 'SomeModel' => array('field'),
|
||||||
* 'AssociatedModel' => array('field', 'otherfield')
|
* 'AssociatedModel' => array('field', 'otherfield')
|
||||||
* )
|
* )
|
||||||
* }}}
|
* ```
|
||||||
* - `deep`: If set to true, not only directly associated data is saved, but deeper nested associated data as well.
|
* - `deep`: If set to true, not only directly associated data is saved, but deeper nested associated data as well.
|
||||||
* - `callbacks`: See Model::save()
|
* - `callbacks`: See Model::save()
|
||||||
* - `counterCache`: See Model::save()
|
* - `counterCache`: See Model::save()
|
||||||
|
@ -2919,7 +2919,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* 'recursive', 'page', 'fields', 'offset', 'order', 'callbacks')
|
* 'recursive', 'page', 'fields', 'offset', 'order', 'callbacks')
|
||||||
*
|
*
|
||||||
* Eg:
|
* Eg:
|
||||||
* {{{
|
* ```
|
||||||
* $model->find('all', array(
|
* $model->find('all', array(
|
||||||
* 'conditions' => array('name' => 'Thomas Anderson'),
|
* 'conditions' => array('name' => 'Thomas Anderson'),
|
||||||
* 'fields' => array('name', 'email'),
|
* 'fields' => array('name', 'email'),
|
||||||
|
@ -2928,13 +2928,13 @@ class Model extends Object implements CakeEventListener {
|
||||||
* 'group' => 'type',
|
* 'group' => 'type',
|
||||||
* 'callbacks' => false,
|
* 'callbacks' => false,
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* In addition to the standard query keys above, you can provide Datasource, and behavior specific
|
* In addition to the standard query keys above, you can provide Datasource, and behavior specific
|
||||||
* keys. For example, when using a SQL based datasource you can use the joins key to specify additional
|
* keys. For example, when using a SQL based datasource you can use the joins key to specify additional
|
||||||
* joins that should be part of the query.
|
* joins that should be part of the query.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $model->find('all', array(
|
* $model->find('all', array(
|
||||||
* 'conditions' => array('name' => 'Thomas Anderson'),
|
* 'conditions' => array('name' => 'Thomas Anderson'),
|
||||||
* 'joins' => array(
|
* 'joins' => array(
|
||||||
|
@ -2946,7 +2946,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Disabling callbacks
|
* ### Disabling callbacks
|
||||||
*
|
*
|
||||||
|
@ -2996,7 +2996,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* Model::_readDataSource() is used by all find() calls to read from the data source and can be overloaded to allow
|
* Model::_readDataSource() is used by all find() calls to read from the data source and can be overloaded to allow
|
||||||
* caching of datasource calls.
|
* caching of datasource calls.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* protected function _readDataSource($type, $query) {
|
* protected function _readDataSource($type, $query) {
|
||||||
* $cacheName = md5(json_encode($query));
|
* $cacheName = md5(json_encode($query));
|
||||||
* $cache = Cache::read($cacheName, 'cache-config-name');
|
* $cache = Cache::read($cacheName, 'cache-config-name');
|
||||||
|
@ -3008,7 +3008,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* Cache::write($cacheName, $results, 'cache-config-name');
|
* Cache::write($cacheName, $results, 'cache-config-name');
|
||||||
* return $results;
|
* return $results;
|
||||||
* }
|
* }
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $type Type of find operation (all / first / count / neighbors / list / threaded)
|
* @param string $type Type of find operation (all / first / count / neighbors / list / threaded)
|
||||||
* @param array $query Option fields (conditions / fields / joins / limit / offset / order / page / group / callbacks)
|
* @param array $query Option fields (conditions / fields / joins / limit / offset / order / page / group / callbacks)
|
||||||
|
|
|
@ -30,11 +30,11 @@
|
||||||
* Behaviors can provide mixin like features by declaring public methods. These methods should expect
|
* Behaviors can provide mixin like features by declaring public methods. These methods should expect
|
||||||
* the model instance to be shifted onto the parameter list.
|
* the model instance to be shifted onto the parameter list.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* function doSomething(Model $model, $arg1, $arg2) {
|
* function doSomething(Model $model, $arg1, $arg2) {
|
||||||
* //do something
|
* //do something
|
||||||
* }
|
* }
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Would be called like `$this->Model->doSomething($arg1, $arg2);`.
|
* Would be called like `$this->Model->doSomething($arg1, $arg2);`.
|
||||||
*
|
*
|
||||||
|
@ -45,13 +45,13 @@
|
||||||
* be declared in your behaviors `$mapMethods` array. The method signature for a mapped method is slightly different
|
* be declared in your behaviors `$mapMethods` array. The method signature for a mapped method is slightly different
|
||||||
* than a normal behavior mixin method.
|
* than a normal behavior mixin method.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* public $mapMethods = array('/do(\w+)/' => 'doSomething');
|
* public $mapMethods = array('/do(\w+)/' => 'doSomething');
|
||||||
*
|
*
|
||||||
* function doSomething(Model $model, $method, $arg1, $arg2) {
|
* function doSomething(Model $model, $method, $arg1, $arg2) {
|
||||||
* //do something
|
* //do something
|
||||||
* }
|
* }
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The above will map every doXXX() method call to the behavior. As you can see, the model is
|
* The above will map every doXXX() method call to the behavior. As you can see, the model is
|
||||||
* still the first parameter, but the called method name will be the 2nd parameter. This allows
|
* still the first parameter, but the called method name will be the 2nd parameter. This allows
|
||||||
|
|
|
@ -535,7 +535,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
|
||||||
*
|
*
|
||||||
* ## Example:
|
* ## Example:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $validator
|
* $validator
|
||||||
* ->add('title', 'required', array('rule' => 'notEmpty', 'required' => true))
|
* ->add('title', 'required', array('rule' => 'notEmpty', 'required' => true))
|
||||||
* ->add('user_id', 'valid', array('rule' => 'numeric', 'message' => 'Invalid User'))
|
* ->add('user_id', 'valid', array('rule' => 'numeric', 'message' => 'Invalid User'))
|
||||||
|
@ -544,7 +544,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
|
||||||
* 'size' => array('rule' => array('lengthBetween', 8, 20)),
|
* 'size' => array('rule' => array('lengthBetween', 8, 20)),
|
||||||
* 'hasSpecialCharacter' => array('rule' => 'validateSpecialchar', 'message' => 'not valid')
|
* 'hasSpecialCharacter' => array('rule' => 'validateSpecialchar', 'message' => 'not valid')
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $field The name of the field where the rule is to be added
|
* @param string $field The name of the field where the rule is to be added
|
||||||
* @param string|array|CakeValidationSet $name name of the rule to be added or list of rules for the field
|
* @param string|array|CakeValidationSet $name name of the rule to be added or list of rules for the field
|
||||||
|
@ -580,11 +580,11 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
|
||||||
*
|
*
|
||||||
* ## Example:
|
* ## Example:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $validator
|
* $validator
|
||||||
* ->remove('title', 'required')
|
* ->remove('title', 'required')
|
||||||
* ->remove('user_id')
|
* ->remove('user_id')
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $field The name of the field from which the rule will be removed
|
* @param string $field The name of the field from which the rule will be removed
|
||||||
* @param string $rule the name of the rule to be removed
|
* @param string $rule the name of the rule to be removed
|
||||||
|
|
|
@ -183,11 +183,11 @@ class CakeValidationSet implements ArrayAccess, IteratorAggregate, Countable {
|
||||||
*
|
*
|
||||||
* ## Example:
|
* ## Example:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $set
|
* $set
|
||||||
* ->setRule('required', array('rule' => 'notEmpty', 'required' => true))
|
* ->setRule('required', array('rule' => 'notEmpty', 'required' => true))
|
||||||
* ->setRule('between', array('rule' => array('lengthBetween', 4, 10))
|
* ->setRule('between', array('rule' => array('lengthBetween', 4, 10))
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $name The name under which the rule should be set
|
* @param string $name The name under which the rule should be set
|
||||||
* @param CakeValidationRule|array $rule The validation rule to be set
|
* @param CakeValidationRule|array $rule The validation rule to be set
|
||||||
|
@ -206,11 +206,11 @@ class CakeValidationSet implements ArrayAccess, IteratorAggregate, Countable {
|
||||||
*
|
*
|
||||||
* ## Example:
|
* ## Example:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $set
|
* $set
|
||||||
* ->removeRule('required')
|
* ->removeRule('required')
|
||||||
* ->removeRule('inRange')
|
* ->removeRule('inRange')
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $name The name under which the rule should be unset
|
* @param string $name The name under which the rule should be unset
|
||||||
* @return $this
|
* @return $this
|
||||||
|
@ -225,12 +225,12 @@ class CakeValidationSet implements ArrayAccess, IteratorAggregate, Countable {
|
||||||
*
|
*
|
||||||
* ## Example:
|
* ## Example:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $set->setRules(array(
|
* $set->setRules(array(
|
||||||
* 'required' => array('rule' => 'notEmpty', 'required' => true),
|
* 'required' => array('rule' => 'notEmpty', 'required' => true),
|
||||||
* 'inRange' => array('rule' => array('between', 4, 10)
|
* 'inRange' => array('rule' => array('between', 4, 10)
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param array $rules The rules to be set
|
* @param array $rules The rules to be set
|
||||||
* @param bool $mergeVars [optional] If true, merges vars instead of replace. Defaults to true.
|
* @param bool $mergeVars [optional] If true, merges vars instead of replace. Defaults to true.
|
||||||
|
|
|
@ -841,11 +841,11 @@ class CakeRequest implements ArrayAccess {
|
||||||
*
|
*
|
||||||
* Get the list of accepted languages:
|
* Get the list of accepted languages:
|
||||||
*
|
*
|
||||||
* {{{ CakeRequest::acceptLanguage(); }}}
|
* ``` CakeRequest::acceptLanguage(); ```
|
||||||
*
|
*
|
||||||
* Check if a specific language is accepted:
|
* Check if a specific language is accepted:
|
||||||
*
|
*
|
||||||
* {{{ CakeRequest::acceptLanguage('es-es'); }}}
|
* ``` CakeRequest::acceptLanguage('es-es'); ```
|
||||||
*
|
*
|
||||||
* @param string $language The language to test.
|
* @param string $language The language to test.
|
||||||
* @return mixed If a $language is provided, a boolean. Otherwise the array of accepted languages.
|
* @return mixed If a $language is provided, a boolean. Otherwise the array of accepted languages.
|
||||||
|
|
|
@ -513,16 +513,15 @@ class CakeResponse {
|
||||||
/**
|
/**
|
||||||
* Sends a header to the client.
|
* Sends a header to the client.
|
||||||
*
|
*
|
||||||
|
* Will skip sending headers if headers have already been sent.
|
||||||
|
*
|
||||||
* @param string $name the header name
|
* @param string $name the header name
|
||||||
* @param string $value the header value
|
* @param string $value the header value
|
||||||
* @return void
|
* @return void
|
||||||
* @throws CakeException When headers have already been sent
|
|
||||||
*/
|
*/
|
||||||
protected function _sendHeader($name, $value = null) {
|
protected function _sendHeader($name, $value = null) {
|
||||||
if (headers_sent($filename, $linenum)) {
|
if (headers_sent($filename, $linenum)) {
|
||||||
throw new CakeException(
|
return;
|
||||||
__d('cake_dev', 'Headers already sent in %s on line %s', $filename, $linenum)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if ($value === null) {
|
if ($value === null) {
|
||||||
header($name);
|
header($name);
|
||||||
|
|
|
@ -1002,35 +1002,35 @@ class CakeEmail {
|
||||||
*
|
*
|
||||||
* Attach a single file:
|
* Attach a single file:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $email->attachments('path/to/file');
|
* $email->attachments('path/to/file');
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Attach a file with a different filename:
|
* Attach a file with a different filename:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $email->attachments(array('custom_name.txt' => 'path/to/file.txt'));
|
* $email->attachments(array('custom_name.txt' => 'path/to/file.txt'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Attach a file and specify additional properties:
|
* Attach a file and specify additional properties:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $email->attachments(array('custom_name.png' => array(
|
* $email->attachments(array('custom_name.png' => array(
|
||||||
* 'file' => 'path/to/file',
|
* 'file' => 'path/to/file',
|
||||||
* 'mimetype' => 'image/png',
|
* 'mimetype' => 'image/png',
|
||||||
* 'contentId' => 'abc123',
|
* 'contentId' => 'abc123',
|
||||||
* 'contentDisposition' => false
|
* 'contentDisposition' => false
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Attach a file from string and specify additional properties:
|
* Attach a file from string and specify additional properties:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $email->attachments(array('custom_name.png' => array(
|
* $email->attachments(array('custom_name.png' => array(
|
||||||
* 'data' => file_get_contents('path/to/file'),
|
* 'data' => file_get_contents('path/to/file'),
|
||||||
* 'mimetype' => 'image/png'
|
* 'mimetype' => 'image/png'
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The `contentId` key allows you to specify an inline attachment. In your email text, you
|
* The `contentId` key allows you to specify an inline attachment. In your email text, you
|
||||||
* can use `<img src="cid:abc123" />` to display the image inline.
|
* can use `<img src="cid:abc123" />` to display the image inline.
|
||||||
|
|
|
@ -58,7 +58,7 @@ class SmtpTransport extends AbstractTransport {
|
||||||
*
|
*
|
||||||
* A response consists of one or more lines containing a response
|
* A response consists of one or more lines containing a response
|
||||||
* code and an optional response message text:
|
* code and an optional response message text:
|
||||||
* {{{
|
* ```
|
||||||
* array(
|
* array(
|
||||||
* array(
|
* array(
|
||||||
* 'code' => '250',
|
* 'code' => '250',
|
||||||
|
@ -74,7 +74,7 @@ class SmtpTransport extends AbstractTransport {
|
||||||
* ),
|
* ),
|
||||||
* // etc...
|
* // etc...
|
||||||
* )
|
* )
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -139,12 +139,12 @@ class HttpSocket extends CakeSocket {
|
||||||
*
|
*
|
||||||
* Or use an array to configure multiple options:
|
* Or use an array to configure multiple options:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $http = new HttpSocket(array(
|
* $http = new HttpSocket(array(
|
||||||
* 'host' => 'cakephp.org',
|
* 'host' => 'cakephp.org',
|
||||||
* 'timeout' => 20
|
* 'timeout' => 20
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* See HttpSocket::$config for options that can be used.
|
* See HttpSocket::$config for options that can be used.
|
||||||
*
|
*
|
||||||
|
@ -169,21 +169,21 @@ class HttpSocket extends CakeSocket {
|
||||||
* Accepts two forms of parameters. If all you need is a username + password, as with
|
* Accepts two forms of parameters. If all you need is a username + password, as with
|
||||||
* Basic authentication you can do the following:
|
* Basic authentication you can do the following:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $http->configAuth('Basic', 'mark', 'secret');
|
* $http->configAuth('Basic', 'mark', 'secret');
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* If you are using an authentication strategy that requires more inputs, like Digest authentication
|
* If you are using an authentication strategy that requires more inputs, like Digest authentication
|
||||||
* you can call `configAuth()` with an array of user information.
|
* you can call `configAuth()` with an array of user information.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $http->configAuth('Digest', array(
|
* $http->configAuth('Digest', array(
|
||||||
* 'user' => 'mark',
|
* 'user' => 'mark',
|
||||||
* 'pass' => 'secret',
|
* 'pass' => 'secret',
|
||||||
* 'realm' => 'my-realm',
|
* 'realm' => 'my-realm',
|
||||||
* 'nonce' => 1235
|
* 'nonce' => 1235
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* To remove any set authentication strategy, call `configAuth()` with no parameters:
|
* To remove any set authentication strategy, call `configAuth()` with no parameters:
|
||||||
*
|
*
|
||||||
|
@ -439,12 +439,12 @@ class HttpSocket extends CakeSocket {
|
||||||
*
|
*
|
||||||
* You could express the same thing using a uri array and query string parameters:
|
* You could express the same thing using a uri array and query string parameters:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $response = $http->get(
|
* $response = $http->get(
|
||||||
* array('host' => 'google.com', 'path' => '/search'),
|
* array('host' => 'google.com', 'path' => '/search'),
|
||||||
* array('q' => 'cakephp', 'client' => 'safari')
|
* array('q' => 'cakephp', 'client' => 'safari')
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string|array $uri URI to request. Either a string uri, or a uri array, see HttpSocket::_parseUri()
|
* @param string|array $uri URI to request. Either a string uri, or a uri array, see HttpSocket::_parseUri()
|
||||||
* @param array $query Querystring parameters to append to URI
|
* @param array $query Querystring parameters to append to URI
|
||||||
|
@ -497,12 +497,12 @@ class HttpSocket extends CakeSocket {
|
||||||
*
|
*
|
||||||
* `post()` can be used to post simple data arrays to a URL:
|
* `post()` can be used to post simple data arrays to a URL:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $response = $http->post('http://example.com', array(
|
* $response = $http->post('http://example.com', array(
|
||||||
* 'username' => 'batman',
|
* 'username' => 'batman',
|
||||||
* 'password' => 'bruce_w4yne'
|
* 'password' => 'bruce_w4yne'
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string|array $uri URI to request. See HttpSocket::_parseUri()
|
* @param string|array $uri URI to request. See HttpSocket::_parseUri()
|
||||||
* @param array $data Array of request body data keys and values.
|
* @param array $data Array of request body data keys and values.
|
||||||
|
@ -563,10 +563,10 @@ class HttpSocket extends CakeSocket {
|
||||||
* After configuring part of the request parameters, you can use url() to generate
|
* After configuring part of the request parameters, you can use url() to generate
|
||||||
* URLs.
|
* URLs.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $http = new HttpSocket('http://www.cakephp.org');
|
* $http = new HttpSocket('http://www.cakephp.org');
|
||||||
* $url = $http->url('/search?q=bar');
|
* $url = $http->url('/search?q=bar');
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Would return `http://www.cakephp.org/search?q=bar`
|
* Would return `http://www.cakephp.org/search?q=bar`
|
||||||
*
|
*
|
||||||
|
|
|
@ -289,13 +289,13 @@ class Router {
|
||||||
*
|
*
|
||||||
* 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(
|
||||||
* '/:lang/:controller/:action/:id',
|
* '/:lang/:controller/:action/:id',
|
||||||
* array(),
|
* array(),
|
||||||
* array('id' => '[0-9]+', 'lang' => '[a-z]{3}')
|
* array('id' => '[0-9]+', 'lang' => '[a-z]{3}')
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* 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.
|
||||||
|
@ -426,37 +426,37 @@ class Router {
|
||||||
*
|
*
|
||||||
* Do not parse any named parameters:
|
* Do not parse any named parameters:
|
||||||
*
|
*
|
||||||
* {{{ Router::connectNamed(false); }}}
|
* ``` Router::connectNamed(false); ```
|
||||||
*
|
*
|
||||||
* Parse only default parameters used for CakePHP's pagination:
|
* Parse only default parameters used for CakePHP's pagination:
|
||||||
*
|
*
|
||||||
* {{{ Router::connectNamed(false, array('default' => true)); }}}
|
* ``` Router::connectNamed(false, array('default' => true)); ```
|
||||||
*
|
*
|
||||||
* Parse only the page parameter if its value is a number:
|
* Parse only the page parameter if its value is a number:
|
||||||
*
|
*
|
||||||
* {{{ Router::connectNamed(array('page' => '[\d]+'), array('default' => false, 'greedy' => false)); }}}
|
* ``` Router::connectNamed(array('page' => '[\d]+'), array('default' => false, 'greedy' => false)); ```
|
||||||
*
|
*
|
||||||
* Parse only the page parameter no matter what.
|
* Parse only the page parameter no matter what.
|
||||||
*
|
*
|
||||||
* {{{ Router::connectNamed(array('page'), array('default' => false, 'greedy' => false)); }}}
|
* ``` Router::connectNamed(array('page'), array('default' => false, 'greedy' => false)); ```
|
||||||
*
|
*
|
||||||
* Parse only the page parameter if the current action is 'index'.
|
* Parse only the page parameter if the current action is 'index'.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* Router::connectNamed(
|
* Router::connectNamed(
|
||||||
* array('page' => array('action' => 'index')),
|
* array('page' => array('action' => 'index')),
|
||||||
* array('default' => false, 'greedy' => false)
|
* array('default' => false, 'greedy' => false)
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Parse only the page parameter if the current action is 'index' and the controller is 'pages'.
|
* Parse only the page parameter if the current action is 'index' and the controller is 'pages'.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* Router::connectNamed(
|
* Router::connectNamed(
|
||||||
* array('page' => array('action' => 'index', 'controller' => 'pages')),
|
* array('page' => array('action' => 'index', 'controller' => 'pages')),
|
||||||
* array('default' => false, 'greedy' => false)
|
* array('default' => false, 'greedy' => false)
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Options
|
* ### Options
|
||||||
*
|
*
|
||||||
|
|
|
@ -3031,7 +3031,7 @@ SQL;
|
||||||
$this->assertSame($expected, $result);
|
$this->assertSame($expected, $result);
|
||||||
|
|
||||||
$result = $this->Dbo->length(false);
|
$result = $this->Dbo->length(false);
|
||||||
$this->assertTrue($result === null);
|
$this->assertNull($result);
|
||||||
|
|
||||||
$result = $this->Dbo->length('datetime');
|
$result = $this->Dbo->length('datetime');
|
||||||
$expected = null;
|
$expected = null;
|
||||||
|
|
|
@ -382,6 +382,23 @@ TEXT;
|
||||||
$this->assertTextEquals($expected, $result, 'Text not wrapped.');
|
$this->assertTextEquals($expected, $result, 'Text not wrapped.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that wordWrap() properly handle newline characters.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testWordWrapNewlineAware() {
|
||||||
|
$text = 'This is a line that is almost the 55 chars long.
|
||||||
|
This is a new sentence which is manually newlined, but is so long it needs two lines.';
|
||||||
|
$result = String::wordWrap($text, 55);
|
||||||
|
$expected = <<<TEXT
|
||||||
|
This is a line that is almost the 55 chars long.
|
||||||
|
This is a new sentence which is manually newlined, but
|
||||||
|
is so long it needs two lines.
|
||||||
|
TEXT;
|
||||||
|
$this->assertTextEquals($expected, $result, 'Text not wrapped.');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test wrap method.
|
* test wrap method.
|
||||||
*
|
*
|
||||||
|
|
|
@ -597,4 +597,17 @@ class FileTest extends CakeTestCase {
|
||||||
|
|
||||||
$TmpFile->delete();
|
$TmpFile->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that no path is being set for passed file paths that
|
||||||
|
* do not exist.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testNoPartialPathBeingSetForNonExistentPath()
|
||||||
|
{
|
||||||
|
$tmpFile = new File('/non/existent/file');
|
||||||
|
$this->assertNull($tmpFile->pwd());
|
||||||
|
$this->assertNull($tmpFile->path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1338,6 +1338,18 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->Form->radio('Test.test', $options);
|
$this->Form->radio('Test.test', $options);
|
||||||
$expected = array('Test.test');
|
$expected = array('Test.test');
|
||||||
$this->assertEquals($expected, $this->Form->fields);
|
$this->assertEquals($expected, $this->Form->fields);
|
||||||
|
|
||||||
|
$this->Form->radio('Test.all', $options, array(
|
||||||
|
'disabled' => array('option1', 'option2')
|
||||||
|
));
|
||||||
|
$expected = array('Test.test', 'Test.all' => '');
|
||||||
|
$this->assertEquals($expected, $this->Form->fields);
|
||||||
|
|
||||||
|
$this->Form->radio('Test.some', $options, array(
|
||||||
|
'disabled' => array('option1')
|
||||||
|
));
|
||||||
|
$expected = array('Test.test', 'Test.all' => '', 'Test.some');
|
||||||
|
$this->assertEquals($expected, $this->Form->fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1372,9 +1384,11 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Form->checkbox('Model.checkbox', array('disabled' => true));
|
$this->Form->checkbox('Model.checkbox', array('disabled' => true));
|
||||||
$this->Form->text('Model.text', array('disabled' => true));
|
$this->Form->text('Model.text', array('disabled' => true));
|
||||||
$this->Form->password('Model.text', array('disabled' => true));
|
$this->Form->text('Model.text2', array('disabled' => 'disabled'));
|
||||||
|
$this->Form->password('Model.password', array('disabled' => true));
|
||||||
$this->Form->textarea('Model.textarea', array('disabled' => true));
|
$this->Form->textarea('Model.textarea', array('disabled' => true));
|
||||||
$this->Form->select('Model.select', array(1, 2), array('disabled' => true));
|
$this->Form->select('Model.select', array(1, 2), array('disabled' => true));
|
||||||
|
$this->Form->select('Model.select', array(1, 2), array('disabled' => array(1, 2)));
|
||||||
$this->Form->radio('Model.radio', array(1, 2), array('disabled' => array(1, 2)));
|
$this->Form->radio('Model.radio', array(1, 2), array('disabled' => array(1, 2)));
|
||||||
$this->Form->year('Model.year', null, null, array('disabled' => true));
|
$this->Form->year('Model.year', null, null, array('disabled' => true));
|
||||||
$this->Form->month('Model.month', array('disabled' => true));
|
$this->Form->month('Model.month', array('disabled' => true));
|
||||||
|
|
|
@ -341,13 +341,13 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
* Checks for an input tag with a name attribute (contains any non-empty value) and an id
|
* Checks for an input tag with a name attribute (contains any non-empty value) and an id
|
||||||
* attribute that contains 'my-input':
|
* attribute that contains 'my-input':
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* array('input' => array('name', 'id' => 'my-input'))
|
* array('input' => array('name', 'id' => 'my-input'))
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Checks for two p elements with some text in them:
|
* Checks for two p elements with some text in them:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* array(
|
* array(
|
||||||
* array('p' => true),
|
* array('p' => true),
|
||||||
* 'textA',
|
* 'textA',
|
||||||
|
@ -356,17 +356,17 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
* 'textB',
|
* 'textB',
|
||||||
* '/p'
|
* '/p'
|
||||||
* )
|
* )
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* You can also specify a pattern expression as part of the attribute values, or the tag
|
* You can also specify a pattern expression as part of the attribute values, or the tag
|
||||||
* being defined, if you prepend the value with preg: and enclose it with slashes, like so:
|
* being defined, if you prepend the value with preg: and enclose it with slashes, like so:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* array(
|
* array(
|
||||||
* array('input' => array('name', 'id' => 'preg:/FieldName\d+/')),
|
* array('input' => array('name', 'id' => 'preg:/FieldName\d+/')),
|
||||||
* 'preg:/My\s+field/'
|
* 'preg:/My\s+field/'
|
||||||
* )
|
* )
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Important: This function is very forgiving about whitespace and also accepts any
|
* Important: This function is very forgiving about whitespace and also accepts any
|
||||||
* permutation of attribute order. It will also allow whitespace between specified tags.
|
* permutation of attribute order. It will also allow whitespace between specified tags.
|
||||||
|
@ -733,6 +733,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
$availableDs = array_keys(ConnectionManager::enumConnectionObjects());
|
$availableDs = array_keys(ConnectionManager::enumConnectionObjects());
|
||||||
if ($mock->useDbConfig === 'default') {
|
if ($mock->useDbConfig === 'default') {
|
||||||
|
$mock->useDbConfig = null;
|
||||||
$mock->setDataSource('test');
|
$mock->setDataSource('test');
|
||||||
}
|
}
|
||||||
if ($mock->useDbConfig !== 'test' && in_array('test_' . $mock->useDbConfig, $availableDs)) {
|
if ($mock->useDbConfig !== 'test' && in_array('test_' . $mock->useDbConfig, $availableDs)) {
|
||||||
|
|
|
@ -380,11 +380,11 @@ class CakeNumber {
|
||||||
* Add a currency format to the Number helper. Makes reusing
|
* Add a currency format to the Number helper. Makes reusing
|
||||||
* currency formats easier.
|
* currency formats easier.
|
||||||
*
|
*
|
||||||
* {{{ $number->addFormat('NOK', array('before' => 'Kr. ')); }}}
|
* ``` $number->addFormat('NOK', array('before' => 'Kr. ')); ```
|
||||||
*
|
*
|
||||||
* You can now use `NOK` as a shortform when formatting currency amounts.
|
* You can now use `NOK` as a shortform when formatting currency amounts.
|
||||||
*
|
*
|
||||||
* {{{ $number->currency($value, 'NOK'); }}}
|
* ``` $number->currency($value, 'NOK'); ```
|
||||||
*
|
*
|
||||||
* Added formats are merged with the defaults defined in CakeNumber::$_currencyDefaults
|
* Added formats are merged with the defaults defined in CakeNumber::$_currencyDefaults
|
||||||
* See CakeNumber::currency() for more information on the various options and their function.
|
* See CakeNumber::currency() for more information on the various options and their function.
|
||||||
|
|
|
@ -355,6 +355,23 @@ class CakeText {
|
||||||
* @return string Formatted text.
|
* @return string Formatted text.
|
||||||
*/
|
*/
|
||||||
public static function wordWrap($text, $width = 72, $break = "\n", $cut = false) {
|
public static function wordWrap($text, $width = 72, $break = "\n", $cut = false) {
|
||||||
|
$paragraphs = explode($break, $text);
|
||||||
|
foreach ($paragraphs as &$paragraph) {
|
||||||
|
$paragraph = self::_wordWrap($paragraph, $width, $break, $cut);
|
||||||
|
}
|
||||||
|
return implode($break, $paragraphs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method for wordWrap().
|
||||||
|
*
|
||||||
|
* @param string $text The text to format.
|
||||||
|
* @param int $width The width to wrap to. Defaults to 72.
|
||||||
|
* @param string $break The line is broken using the optional break parameter. Defaults to '\n'.
|
||||||
|
* @param bool $cut If the cut is set to true, the string is always wrapped at the specified width.
|
||||||
|
* @return string Formatted text.
|
||||||
|
*/
|
||||||
|
protected static function _wordWrap($text, $width = 72, $break = "\n", $cut = false) {
|
||||||
if ($cut) {
|
if ($cut) {
|
||||||
$parts = array();
|
$parts = array();
|
||||||
while (mb_strlen($text) > 0) {
|
while (mb_strlen($text) > 0) {
|
||||||
|
|
|
@ -1018,12 +1018,12 @@ class CakeTime {
|
||||||
*
|
*
|
||||||
* Create localized & formatted time:
|
* Create localized & formatted time:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* CakeTime::format('2012-02-15', '%m-%d-%Y'); // returns 02-15-2012
|
* CakeTime::format('2012-02-15', '%m-%d-%Y'); // returns 02-15-2012
|
||||||
* CakeTime::format('2012-02-15 23:01:01', '%c'); // returns preferred date and time based on configured locale
|
* CakeTime::format('2012-02-15 23:01:01', '%c'); // returns preferred date and time based on configured locale
|
||||||
* CakeTime::format('0000-00-00', '%d-%m-%Y', 'N/A'); // return N/A becuase an invalid date was passed
|
* CakeTime::format('0000-00-00', '%d-%m-%Y', 'N/A'); // return N/A becuase an invalid date was passed
|
||||||
* CakeTime::format('2012-02-15 23:01:01', '%c', 'N/A', 'America/New_York'); // converts passed date to timezone
|
* CakeTime::format('2012-02-15 23:01:01', '%c', 'N/A', 'America/New_York'); // converts passed date to timezone
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param int|string|DateTime $date UNIX timestamp, strtotime() valid string or DateTime object (or a date format string)
|
* @param int|string|DateTime $date UNIX timestamp, strtotime() valid string or DateTime object (or a date format string)
|
||||||
* @param int|string|DateTime $format date format string (or UNIX timestamp, strtotime() valid string or DateTime object)
|
* @param int|string|DateTime $format date format string (or UNIX timestamp, strtotime() valid string or DateTime object)
|
||||||
|
@ -1138,7 +1138,7 @@ class CakeTime {
|
||||||
if (function_exists('mb_check_encoding')) {
|
if (function_exists('mb_check_encoding')) {
|
||||||
$valid = mb_check_encoding($format, $encoding);
|
$valid = mb_check_encoding($format, $encoding);
|
||||||
} else {
|
} else {
|
||||||
$valid = !Multibyte::checkMultibyte($format);
|
$valid = Multibyte::checkMultibyte($format);
|
||||||
}
|
}
|
||||||
if (!$valid) {
|
if (!$valid) {
|
||||||
$format = utf8_encode($format);
|
$format = utf8_encode($format);
|
||||||
|
|
|
@ -79,13 +79,13 @@ class ClassRegistry {
|
||||||
*
|
*
|
||||||
* When $class is a numeric keyed array, multiple class instances will be stored in the registry,
|
* When $class is a numeric keyed array, multiple class instances will be stored in the registry,
|
||||||
* no instance of the object will be returned
|
* no instance of the object will be returned
|
||||||
* {{{
|
* ```
|
||||||
* array(
|
* array(
|
||||||
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry'),
|
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry'),
|
||||||
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry'),
|
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry'),
|
||||||
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry')
|
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry')
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string|array $class as a string or a single key => value array instance will be created,
|
* @param string|array $class as a string or a single key => value array instance will be created,
|
||||||
* stored in the registry and returned.
|
* stored in the registry and returned.
|
||||||
|
|
|
@ -393,7 +393,10 @@ class File {
|
||||||
*/
|
*/
|
||||||
public function pwd() {
|
public function pwd() {
|
||||||
if ($this->path === null) {
|
if ($this->path === null) {
|
||||||
$this->path = $this->Folder->slashTerm($this->Folder->pwd()) . $this->name;
|
$dir = $this->Folder->pwd();
|
||||||
|
if (is_dir($dir)) {
|
||||||
|
$this->path = $this->Folder->slashTerm($dir) . $this->name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $this->path;
|
return $this->path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,9 +445,9 @@ class Hash {
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $result = Hash::format($users, array('{n}.User.id', '{n}.User.name'), '%s : %s');
|
* $result = Hash::format($users, array('{n}.User.id', '{n}.User.name'), '%s : %s');
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The `$format` string can use any format options that `vsprintf()` and `sprintf()` do.
|
* The `$format` string can use any format options that `vsprintf()` and `sprintf()` do.
|
||||||
*
|
*
|
||||||
|
|
|
@ -78,6 +78,7 @@ class Inflector {
|
||||||
'cookie' => 'cookies',
|
'cookie' => 'cookies',
|
||||||
'corpus' => 'corpuses',
|
'corpus' => 'corpuses',
|
||||||
'cow' => 'cows',
|
'cow' => 'cows',
|
||||||
|
'criterion' => 'criteria',
|
||||||
'ganglion' => 'ganglions',
|
'ganglion' => 'ganglions',
|
||||||
'genie' => 'genies',
|
'genie' => 'genies',
|
||||||
'genus' => 'genera',
|
'genus' => 'genera',
|
||||||
|
@ -304,7 +305,7 @@ class Inflector {
|
||||||
*
|
*
|
||||||
* ### Usage:
|
* ### Usage:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables'));
|
* Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables'));
|
||||||
* Inflector::rules('plural', array(
|
* Inflector::rules('plural', array(
|
||||||
* 'rules' => array('/^(inflect)ors$/i' => '\1ables'),
|
* 'rules' => array('/^(inflect)ors$/i' => '\1ables'),
|
||||||
|
@ -312,7 +313,7 @@ class Inflector {
|
||||||
* 'irregular' => array('red' => 'redlings')
|
* 'irregular' => array('red' => 'redlings')
|
||||||
* ));
|
* ));
|
||||||
* Inflector::rules('transliteration', array('/å/' => 'aa'));
|
* Inflector::rules('transliteration', array('/å/' => 'aa'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $type The type of inflection, either 'plural', 'singular' or 'transliteration'
|
* @param string $type The type of inflection, either 'plural', 'singular' or 'transliteration'
|
||||||
* @param array $rules Array of rules to be added.
|
* @param array $rules Array of rules to be added.
|
||||||
|
|
|
@ -91,9 +91,9 @@ class Security {
|
||||||
*
|
*
|
||||||
* Creating a blowfish/bcrypt hash:
|
* Creating a blowfish/bcrypt hash:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $hash = Security::hash($password, 'blowfish');
|
* $hash = Security::hash($password, 'blowfish');
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $string String to hash
|
* @param string $string String to hash
|
||||||
* @param string $type Method to use (sha1/sha256/md5/blowfish)
|
* @param string $type Method to use (sha1/sha256/md5/blowfish)
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Xml {
|
||||||
*
|
*
|
||||||
* Building from an array:
|
* Building from an array:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $value = array(
|
* $value = array(
|
||||||
* 'tags' => array(
|
* 'tags' => array(
|
||||||
* 'tag' => array(
|
* 'tag' => array(
|
||||||
|
@ -68,7 +68,7 @@ class Xml {
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* $xml = Xml::build($value);
|
* $xml = Xml::build($value);
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* When building XML from an array ensure that there is only one top level element.
|
* When building XML from an array ensure that there is only one top level element.
|
||||||
*
|
*
|
||||||
|
@ -164,7 +164,7 @@ class Xml {
|
||||||
*
|
*
|
||||||
* Using the following data:
|
* Using the following data:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $value = array(
|
* $value = array(
|
||||||
* 'root' => array(
|
* 'root' => array(
|
||||||
* 'tag' => array(
|
* 'tag' => array(
|
||||||
|
@ -174,7 +174,7 @@ class Xml {
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Calling `Xml::fromArray($value, 'tags');` Will generate:
|
* Calling `Xml::fromArray($value, 'tags');` Will generate:
|
||||||
*
|
*
|
||||||
|
|
|
@ -498,7 +498,7 @@ class FormHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* If $options is set a form submit button will be created. Options can be either a string or an array.
|
* If $options is set a form submit button will be created. Options can be either a string or an array.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* array usage:
|
* array usage:
|
||||||
*
|
*
|
||||||
* array('label' => 'save'); value="save"
|
* array('label' => 'save'); value="save"
|
||||||
|
@ -506,7 +506,7 @@ class FormHelper extends AppHelper {
|
||||||
* array('name' => 'Whatever'); value="Submit" name="Whatever"
|
* array('name' => 'Whatever'); value="Submit" name="Whatever"
|
||||||
* array('label' => 'save', 'name' => 'Whatever', 'div' => 'good') <div class="good"> value="save" name="Whatever"
|
* array('label' => 'save', 'name' => 'Whatever', 'div' => 'good') <div class="good"> value="save" name="Whatever"
|
||||||
* array('label' => 'save', 'name' => 'Whatever', 'div' => array('class' => 'good')); <div class="good"> value="save" name="Whatever"
|
* array('label' => 'save', 'name' => 'Whatever', 'div' => array('class' => 'good')); <div class="good"> value="save" name="Whatever"
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* If $secureAttributes is set, these html attributes will be merged into the hidden input tags generated for the
|
* If $secureAttributes is set, these html attributes will be merged into the hidden input tags generated for the
|
||||||
* Security Component. This is especially useful to set HTML5 attributes like 'form'
|
* Security Component. This is especially useful to set HTML5 attributes like 'form'
|
||||||
|
@ -786,33 +786,33 @@ class FormHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* The text and for attribute are generated off of the fieldname
|
* The text and for attribute are generated off of the fieldname
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Form->label('Post.published');
|
* echo $this->Form->label('Post.published');
|
||||||
* <label for="PostPublished">Published</label>
|
* <label for="PostPublished">Published</label>
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Custom text:
|
* Custom text:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Form->label('Post.published', 'Publish');
|
* echo $this->Form->label('Post.published', 'Publish');
|
||||||
* <label for="PostPublished">Publish</label>
|
* <label for="PostPublished">Publish</label>
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Custom class name:
|
* Custom class name:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Form->label('Post.published', 'Publish', 'required');
|
* echo $this->Form->label('Post.published', 'Publish', 'required');
|
||||||
* <label for="PostPublished" class="required">Publish</label>
|
* <label for="PostPublished" class="required">Publish</label>
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Custom attributes:
|
* Custom attributes:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Form->label('Post.published', 'Publish', array(
|
* echo $this->Form->label('Post.published', 'Publish', array(
|
||||||
* 'for' => 'post-publish'
|
* 'for' => 'post-publish'
|
||||||
* ));
|
* ));
|
||||||
* <label for="post-publish">Publish</label>
|
* <label for="post-publish">Publish</label>
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $fieldName This should be "Modelname.fieldname"
|
* @param string $fieldName This should be "Modelname.fieldname"
|
||||||
* @param string $text Text that will appear in the label field. If
|
* @param string $text Text that will appear in the label field. If
|
||||||
|
@ -859,11 +859,11 @@ class FormHelper extends AppHelper {
|
||||||
* will be used.
|
* will be used.
|
||||||
*
|
*
|
||||||
* You can customize individual inputs through `$fields`.
|
* You can customize individual inputs through `$fields`.
|
||||||
* {{{
|
* ```
|
||||||
* $this->Form->inputs(array(
|
* $this->Form->inputs(array(
|
||||||
* 'name' => array('label' => 'custom label')
|
* 'name' => array('label' => 'custom label')
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* In addition to controller fields output, `$fields` can be used to control legend
|
* In addition to controller fields output, `$fields` can be used to control legend
|
||||||
* and fieldset rendering.
|
* and fieldset rendering.
|
||||||
|
@ -1491,7 +1491,9 @@ class FormHelper extends AppHelper {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#options-for-select-checkbox-and-radio-inputs
|
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#options-for-select-checkbox-and-radio-inputs
|
||||||
*/
|
*/
|
||||||
public function radio($fieldName, $options = array(), $attributes = array()) {
|
public function radio($fieldName, $options = array(), $attributes = array()) {
|
||||||
|
$attributes['options'] = $options;
|
||||||
$attributes = $this->_initInputField($fieldName, $attributes);
|
$attributes = $this->_initInputField($fieldName, $attributes);
|
||||||
|
unset($attributes['options']);
|
||||||
|
|
||||||
$showEmpty = $this->_extractOption('empty', $attributes);
|
$showEmpty = $this->_extractOption('empty', $attributes);
|
||||||
if ($showEmpty) {
|
if ($showEmpty) {
|
||||||
|
@ -1986,13 +1988,13 @@ class FormHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* A simple array will create normal options:
|
* A simple array will create normal options:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $options = array(1 => 'one', 2 => 'two);
|
* $options = array(1 => 'one', 2 => 'two);
|
||||||
* $this->Form->select('Model.field', $options));
|
* $this->Form->select('Model.field', $options));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* While a nested options array will create optgroups with options inside them.
|
* While a nested options array will create optgroups with options inside them.
|
||||||
* {{{
|
* ```
|
||||||
* $options = array(
|
* $options = array(
|
||||||
* 1 => 'bill',
|
* 1 => 'bill',
|
||||||
* 'fred' => array(
|
* 'fred' => array(
|
||||||
|
@ -2001,7 +2003,7 @@ class FormHelper extends AppHelper {
|
||||||
* )
|
* )
|
||||||
* );
|
* );
|
||||||
* $this->Form->select('Model.field', $options);
|
* $this->Form->select('Model.field', $options);
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* In the above `2 => 'fred'` will not generate an option element. You should enable the `showParents`
|
* In the above `2 => 'fred'` will not generate an option element. You should enable the `showParents`
|
||||||
* attribute to show the fred option.
|
* attribute to show the fred option.
|
||||||
|
@ -2009,12 +2011,12 @@ class FormHelper extends AppHelper {
|
||||||
* If you have multiple options that need to have the same value attribute, you can
|
* If you have multiple options that need to have the same value attribute, you can
|
||||||
* use an array of arrays to express this:
|
* use an array of arrays to express this:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $options = array(
|
* $options = array(
|
||||||
* array('name' => 'United states', 'value' => 'USA'),
|
* array('name' => 'United states', 'value' => 'USA'),
|
||||||
* array('name' => 'USA', 'value' => 'USA'),
|
* array('name' => 'USA', 'value' => 'USA'),
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $fieldName Name attribute of the SELECT
|
* @param string $fieldName Name attribute of the SELECT
|
||||||
* @param array $options Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the
|
* @param array $options Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the
|
||||||
|
@ -2955,7 +2957,18 @@ class FormHelper extends AppHelper {
|
||||||
$result = $this->addClass($result, 'form-error');
|
$result = $this->addClass($result, 'form-error');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($result['disabled'])) {
|
$isDisabled = false;
|
||||||
|
if (isset($result['disabled'])) {
|
||||||
|
$isDisabled = (
|
||||||
|
$result['disabled'] === true ||
|
||||||
|
$result['disabled'] === 'disabled' ||
|
||||||
|
(is_array($result['disabled']) &&
|
||||||
|
!empty($result['options']) &&
|
||||||
|
array_diff($result['options'], $result['disabled']) === array()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ($isDisabled) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -650,12 +650,12 @@ class HtmlHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* ### Usage:
|
* ### Usage:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Html->style(array('margin' => '10px', 'padding' => '10px'), true);
|
* echo $this->Html->style(array('margin' => '10px', 'padding' => '10px'), true);
|
||||||
*
|
*
|
||||||
* // creates
|
* // creates
|
||||||
* 'margin:10px;padding:10px;'
|
* 'margin:10px;padding:10px;'
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param array $data Style data array, keys will be used as property names, values as property values.
|
* @param array $data Style data array, keys will be used as property names, values as property values.
|
||||||
* @param bool $oneline Whether or not the style block should be displayed on one line.
|
* @param bool $oneline Whether or not the style block should be displayed on one line.
|
||||||
|
@ -1034,21 +1034,21 @@ class HtmlHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* Using multiple video files:
|
* Using multiple video files:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Html->media(
|
* echo $this->Html->media(
|
||||||
* array('video.mp4', array('src' => 'video.ogv', 'type' => "video/ogg; codecs='theora, vorbis'")),
|
* array('video.mp4', array('src' => 'video.ogv', 'type' => "video/ogg; codecs='theora, vorbis'")),
|
||||||
* array('tag' => 'video', 'autoplay')
|
* array('tag' => 'video', 'autoplay')
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* Outputs:
|
* Outputs:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* <video autoplay="autoplay">
|
* <video autoplay="autoplay">
|
||||||
* <source src="/files/video.mp4" type="video/mp4"/>
|
* <source src="/files/video.mp4" type="video/mp4"/>
|
||||||
* <source src="/files/video.ogv" type="video/ogv; codecs='theora, vorbis'"/>
|
* <source src="/files/video.ogv" type="video/ogv; codecs='theora, vorbis'"/>
|
||||||
* </video>
|
* </video>
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* ### Options
|
* ### Options
|
||||||
*
|
*
|
||||||
|
@ -1186,11 +1186,11 @@ class HtmlHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* tags.php could look like:
|
* tags.php could look like:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $tags = array(
|
* $tags = array(
|
||||||
* 'meta' => '<meta %s>'
|
* 'meta' => '<meta %s>'
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* If you wish to store tag definitions in another format you can give an array
|
* If you wish to store tag definitions in another format you can give an array
|
||||||
* containing the file name, and reader class name:
|
* containing the file name, and reader class name:
|
||||||
|
|
|
@ -152,11 +152,11 @@ class NumberHelper extends AppHelper {
|
||||||
* Add a currency format to the Number helper. Makes reusing
|
* Add a currency format to the Number helper. Makes reusing
|
||||||
* currency formats easier.
|
* currency formats easier.
|
||||||
*
|
*
|
||||||
* {{{ $this->Number->addFormat('NOK', array('before' => 'Kr. ')); }}}
|
* ``` $this->Number->addFormat('NOK', array('before' => 'Kr. ')); ```
|
||||||
*
|
*
|
||||||
* You can now use `NOK` as a shortform when formatting currency amounts.
|
* You can now use `NOK` as a shortform when formatting currency amounts.
|
||||||
*
|
*
|
||||||
* {{{ $this->Number->currency($value, 'NOK'); }}}
|
* ``` $this->Number->currency($value, 'NOK'); ```
|
||||||
*
|
*
|
||||||
* Added formats are merged with the defaults defined in Cake\Utility\Number::$_currencyDefaults
|
* 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 Cake\Utility\Number::currency() for more information on the various options and their function.
|
||||||
|
|
|
@ -89,17 +89,17 @@ class SessionHelper extends AppHelper {
|
||||||
* You can pass additional information into the flash message generation. This allows you
|
* You can pass additional information into the flash message generation. This allows you
|
||||||
* to consolidate all the parameters for a given type of flash message into the view.
|
* to consolidate all the parameters for a given type of flash message into the view.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Session->flash('flash', array('params' => array('class' => 'new-flash')));
|
* echo $this->Session->flash('flash', array('params' => array('class' => 'new-flash')));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The above would generate a flash message with a custom class name. Using $attrs['params'] you
|
* The above would generate a flash message with a custom class name. Using $attrs['params'] you
|
||||||
* can pass additional data into the element rendering that will be made available as local variables
|
* can pass additional data into the element rendering that will be made available as local variables
|
||||||
* when the element is rendered:
|
* when the element is rendered:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Session->flash('flash', array('params' => array('name' => $user['User']['name'])));
|
* echo $this->Session->flash('flash', array('params' => array('name' => $user['User']['name'])));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* This would pass the current user's name into the flash message, so you could create personalized
|
* This would pass the current user's name into the flash message, so you could create personalized
|
||||||
* messages without the controller needing access to that data.
|
* messages without the controller needing access to that data.
|
||||||
|
@ -107,19 +107,19 @@ class SessionHelper extends AppHelper {
|
||||||
* Lastly you can choose the element that is rendered when creating the flash message. Using
|
* Lastly you can choose the element that is rendered when creating the flash message. Using
|
||||||
* custom elements allows you to fully customize how flash messages are generated.
|
* custom elements allows you to fully customize how flash messages are generated.
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Session->flash('flash', array('element' => 'my_custom_element'));
|
* echo $this->Session->flash('flash', array('element' => 'my_custom_element'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* If you want to use an element from a plugin for rendering your flash message you can do that using the
|
* If you want to use an element from a plugin for rendering your flash message you can do that using the
|
||||||
* plugin param:
|
* plugin param:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* echo $this->Session->flash('flash', array(
|
* echo $this->Session->flash('flash', array(
|
||||||
* 'element' => 'my_custom_element',
|
* 'element' => 'my_custom_element',
|
||||||
* 'params' => array('plugin' => 'my_plugin')
|
* 'params' => array('plugin' => 'my_plugin')
|
||||||
* ));
|
* ));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $key The [Message.]key you are rendering in the view.
|
* @param string $key The [Message.]key you are rendering in the view.
|
||||||
* @param array $attrs Additional attributes to use for the creation of this flash message.
|
* @param array $attrs Additional attributes to use for the creation of this flash message.
|
||||||
|
|
|
@ -462,12 +462,12 @@ class TimeHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* Create localized & formatted time:
|
* Create localized & formatted time:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->Time->format('2012-02-15', '%m-%d-%Y'); // returns 02-15-2012
|
* $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('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('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
|
* $this->Time->format('2012-02-15 23:01:01', '%c', 'N/A', 'America/New_York'); // converts passed date to timezone
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @param int|string|DateTime $format date format string (or a UNIX timestamp, strtotime() valid string or DateTime object)
|
* @param int|string|DateTime $format date format string (or a UNIX timestamp, strtotime() valid string or DateTime object)
|
||||||
* @param int|string|DateTime $date UNIX timestamp, strtotime() valid string or DateTime object (or a date format string)
|
* @param int|string|DateTime $date UNIX timestamp, strtotime() valid string or DateTime object (or a date format string)
|
||||||
|
|
|
@ -98,13 +98,13 @@ class HelperCollection extends ObjectCollection implements CakeEventListener {
|
||||||
* declaring $helpers arrays you can disable callbacks on helpers.
|
* declaring $helpers arrays you can disable callbacks on helpers.
|
||||||
*
|
*
|
||||||
* You can alias your helper as an existing helper by setting the 'className' key, i.e.,
|
* You can alias your helper as an existing helper by setting the 'className' key, i.e.,
|
||||||
* {{{
|
* ```
|
||||||
* public $helpers = array(
|
* public $helpers = array(
|
||||||
* 'Html' => array(
|
* 'Html' => array(
|
||||||
* 'className' => 'AliasedHtml'
|
* 'className' => 'AliasedHtml'
|
||||||
* );
|
* );
|
||||||
* );
|
* );
|
||||||
* }}}
|
* ```
|
||||||
* All calls to the `Html` helper would use `AliasedHtml` instead.
|
* All calls to the `Html` helper would use `AliasedHtml` instead.
|
||||||
*
|
*
|
||||||
* @param string $helper Helper name to load
|
* @param string $helper Helper name to load
|
||||||
|
|
|
@ -32,10 +32,10 @@ App::uses('View', 'View');
|
||||||
* You can also define `'_serialize'` as an array. This will create a top level object containing
|
* You can also define `'_serialize'` as an array. This will create a top level object containing
|
||||||
* all the named view variables:
|
* all the named view variables:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->set(compact('posts', 'users', 'stuff'));
|
* $this->set(compact('posts', 'users', 'stuff'));
|
||||||
* $this->set('_serialize', array('posts', 'users'));
|
* $this->set('_serialize', array('posts', 'users'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The above would generate a JSON object that looks like:
|
* The above would generate a JSON object that looks like:
|
||||||
*
|
*
|
||||||
|
|
|
@ -36,7 +36,7 @@ App::uses('CakeRequest', 'Network');
|
||||||
*
|
*
|
||||||
* ### Usage
|
* ### Usage
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* class ExampleController extends AppController {
|
* class ExampleController extends AppController {
|
||||||
* public function download() {
|
* public function download() {
|
||||||
* $this->viewClass = 'Media';
|
* $this->viewClass = 'Media';
|
||||||
|
@ -50,7 +50,7 @@ App::uses('CakeRequest', 'Network');
|
||||||
* $this->set($params);
|
* $this->set($params);
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* @package Cake.View
|
* @package Cake.View
|
||||||
* @deprecated 3.0.0 Deprecated since version 2.3, use CakeResponse::file() instead
|
* @deprecated 3.0.0 Deprecated since version 2.3, use CakeResponse::file() instead
|
||||||
|
|
|
@ -36,10 +36,10 @@ App::uses('Hash', 'Utility');
|
||||||
* You can also define `'_serialize'` as an array. This will create an additional
|
* You can also define `'_serialize'` as an array. This will create an additional
|
||||||
* top level element named `<response>` containing all the named view variables:
|
* top level element named `<response>` containing all the named view variables:
|
||||||
*
|
*
|
||||||
* {{{
|
* ```
|
||||||
* $this->set(compact('posts', 'users', 'stuff'));
|
* $this->set(compact('posts', 'users', 'stuff'));
|
||||||
* $this->set('_serialize', array('posts', 'users'));
|
* $this->set('_serialize', array('posts', 'users'));
|
||||||
* }}}
|
* ```
|
||||||
*
|
*
|
||||||
* The above would generate a XML object that looks like:
|
* The above would generate a XML object that looks like:
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue