From dabf55785f82ee7e8f3f4316db5a25917b653eac Mon Sep 17 00:00:00 2001 From: euromark Date: Sun, 4 Jan 2015 02:30:11 +0100 Subject: [PATCH 01/12] Simplify test assert. --- lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index bd2c7ed16..994ad75e1 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -3031,7 +3031,7 @@ SQL; $this->assertSame($expected, $result); $result = $this->Dbo->length(false); - $this->assertTrue($result === null); + $this->assertNull($result); $result = $this->Dbo->length('datetime'); $expected = null; From bf3ff8e2ad3ead4b4f98c2e3e1590ffb9ea0f4a2 Mon Sep 17 00:00:00 2001 From: Gerd Katzenbeisser Date: Sun, 4 Jan 2015 16:53:00 +0100 Subject: [PATCH 02/12] Avoid connection to default for mocked models Fixes #5565 --- lib/Cake/TestSuite/CakeTestCase.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index 6e76049da..01e0b1e1e 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -733,6 +733,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { $availableDs = array_keys(ConnectionManager::enumConnectionObjects()); if ($mock->useDbConfig === 'default') { + $mock->useDbConfig = null; $mock->setDataSource('test'); } if ($mock->useDbConfig !== 'test' && in_array('test_' . $mock->useDbConfig, $availableDs)) { From d7bc73b1e3c3ac28bd24089754d810d9dba249e4 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 4 Jan 2015 19:54:58 -0500 Subject: [PATCH 03/12] Improve error used when a cache configuation fails to start. Refs #5570 --- lib/Cake/Cache/Cache.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index c8436f72a..612cbed25 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -178,7 +178,12 @@ class Cache { } self::$_engines[$name] = new $cacheClass(); 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) { self::$_engines[$name]->gc(); From 389f745d169df0e421bd24bdad8f6d4995ffcb27 Mon Sep 17 00:00:00 2001 From: euromark Date: Tue, 6 Jan 2015 13:13:33 +0100 Subject: [PATCH 04/12] Stop goofy formatting when newlines are present already. --- lib/Cake/Test/Case/Utility/StringTest.php | 17 +++++++++++++++++ lib/Cake/Utility/String.php | 19 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Utility/StringTest.php b/lib/Cake/Test/Case/Utility/StringTest.php index 775f02832..52af3ca2c 100644 --- a/lib/Cake/Test/Case/Utility/StringTest.php +++ b/lib/Cake/Test/Case/Utility/StringTest.php @@ -377,6 +377,23 @@ TEXT; $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 = <<assertTextEquals($expected, $result, 'Text not wrapped.'); + } + /** * test wrap method. * diff --git a/lib/Cake/Utility/String.php b/lib/Cake/Utility/String.php index 4e0130b58..42b8aab6d 100644 --- a/lib/Cake/Utility/String.php +++ b/lib/Cake/Utility/String.php @@ -346,7 +346,7 @@ class String { } /** - * Unicode aware version of wordwrap. + * Unicode and newline aware version of wordwrap. * * @param string $text The text to format. * @param int $width The width to wrap to. Defaults to 72. @@ -355,6 +355,23 @@ class String { * @return string Formatted text. */ public static function wordWrap($text, $width = 72, $break = "\n", $cut = false) { + $paragraphs = explode($break, $text); + foreach ($paragraphs as &$paragraph) { + $paragraph = String::_wordWrap($paragraph, $width, $break, $cut); + } + return implode($break, $paragraphs); + } + +/** + * Unicode aware version of wordwrap as helper method. + * + * @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) { $parts = array(); while (mb_strlen($text) > 0) { From 66a0e6226d55f8ae33347b9cffb939f470f3655b Mon Sep 17 00:00:00 2001 From: Bryan Crowe Date: Tue, 6 Jan 2015 23:03:53 -0500 Subject: [PATCH 05/12] Correct criterion inflection --- lib/Cake/Utility/Inflector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index a8ca02dfd..3e99149c0 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -78,6 +78,7 @@ class Inflector { 'cookie' => 'cookies', 'corpus' => 'corpuses', 'cow' => 'cows', + 'criterion' => 'criteria', 'ganglion' => 'ganglions', 'genie' => 'genies', 'genus' => 'genera', From eb414bdda1fe56debebc24a0039b3d2000b8c0a3 Mon Sep 17 00:00:00 2001 From: dmromanov Date: Fri, 9 Jan 2015 00:03:49 +0300 Subject: [PATCH 06/12] Fix double encoding time strings (CakeTime) Fix time strings being double encoded when mb_string is not installed. --- lib/Cake/Utility/CakeTime.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Utility/CakeTime.php b/lib/Cake/Utility/CakeTime.php index af2a06a6f..465b6d1b7 100644 --- a/lib/Cake/Utility/CakeTime.php +++ b/lib/Cake/Utility/CakeTime.php @@ -1138,7 +1138,7 @@ class CakeTime { if (function_exists('mb_check_encoding')) { $valid = mb_check_encoding($format, $encoding); } else { - $valid = !Multibyte::checkMultibyte($format); + $valid = Multibyte::checkMultibyte($format); } if (!$valid) { $format = utf8_encode($format); From a7aaa931315d35e4a04b7403277586b22162365a Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 8 Jan 2015 21:47:13 -0500 Subject: [PATCH 07/12] Convert header_sent exception into a notice error. Throwing an exception here, causes an infinite loop when handling fatal errors, as the shutdown function sends headers automatically. Refs #5595 --- lib/Cake/Network/CakeResponse.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index d5e10c657..e610bf2f7 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -520,9 +520,11 @@ class CakeResponse { */ protected function _sendHeader($name, $value = null) { if (headers_sent($filename, $linenum)) { - throw new CakeException( - __d('cake_dev', 'Headers already sent in %s on line %s', $filename, $linenum) + trigger_error( + __d('cake_dev', 'Headers already sent in %s on line %s', $filename, $linenum), + E_USER_NOTICE ); + return; } if ($value === null) { header($name); From 98909fb4659b12a9bfd5abaf4aba3167c17af4a3 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 8 Jan 2015 23:20:30 -0500 Subject: [PATCH 08/12] Fix radio buttons not being added to security hash. When some but not all inputs were disabled radio buttons were omitted from the security hash. This caused blackhole failures as the input was unexpected. Refs #5603 --- .../Test/Case/View/Helper/FormHelperTest.php | 16 +++++++++++++++- lib/Cake/View/Helper/FormHelper.php | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 92aa51c4a..51b2261e2 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -1338,6 +1338,18 @@ class FormHelperTest extends CakeTestCase { $this->Form->radio('Test.test', $options); $expected = array('Test.test'); $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->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->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->year('Model.year', null, null, array('disabled' => true)); $this->Form->month('Model.month', array('disabled' => true)); diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 849a76d1e..94bca721f 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -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 */ public function radio($fieldName, $options = array(), $attributes = array()) { + $attributes['options'] = $options; $attributes = $this->_initInputField($fieldName, $attributes); + unset($attributes['options']); $showEmpty = $this->_extractOption('empty', $attributes); if ($showEmpty) { @@ -2955,7 +2957,18 @@ class FormHelper extends AppHelper { $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; } From c2f298a8b7b461584dfdbe6a1c3feb81ba47e525 Mon Sep 17 00:00:00 2001 From: antograssiot Date: Fri, 9 Jan 2015 13:47:25 +0100 Subject: [PATCH 09/12] Replace our custom code fence with markdown standard fence --- app/Config/acl.php | 24 +++---- lib/Cake/Cache/Cache.php | 12 ++-- lib/Cake/Configure/IniReader.php | 4 +- lib/Cake/Console/ConsoleOptionParser.php | 4 +- lib/Cake/Console/TaskCollection.php | 4 +- lib/Cake/Controller/Component/Acl/DbAcl.php | 4 +- .../Component/Auth/BaseAuthorize.php | 12 ++-- .../Component/Auth/BasicAuthenticate.php | 4 +- .../Component/Auth/BlowfishAuthenticate.php | 4 +- .../Component/Auth/ControllerAuthorize.php | 4 +- .../Component/Auth/DigestAuthenticate.php | 4 +- .../Component/Auth/FormAuthenticate.php | 4 +- .../Controller/Component/AuthComponent.php | 16 ++--- .../Component/PaginatorComponent.php | 12 ++-- lib/Cake/Controller/ComponentCollection.php | 4 +- lib/Cake/Controller/Controller.php | 8 +-- lib/Cake/Core/CakePlugin.php | 8 +-- lib/Cake/Core/Configure.php | 12 ++-- lib/Cake/Event/CakeEvent.php | 4 +- lib/Cake/Event/CakeEventListener.php | 4 +- lib/Cake/I18n/I18n.php | 4 +- lib/Cake/Log/CakeLog.php | 36 +++++----- lib/Cake/Log/Engine/SyslogLog.php | 4 +- .../Model/Behavior/ContainableBehavior.php | 4 +- lib/Cake/Model/BehaviorCollection.php | 4 +- lib/Cake/Model/Model.php | 68 +++++++++---------- lib/Cake/Model/ModelBehavior.php | 8 +-- lib/Cake/Model/ModelValidator.php | 8 +-- .../Model/Validator/CakeValidationSet.php | 12 ++-- lib/Cake/Network/CakeRequest.php | 4 +- lib/Cake/Network/Email/CakeEmail.php | 16 ++--- lib/Cake/Network/Email/SmtpTransport.php | 4 +- lib/Cake/Network/Http/HttpSocket.php | 24 +++---- lib/Cake/Routing/Router.php | 20 +++--- lib/Cake/TestSuite/CakeTestCase.php | 12 ++-- lib/Cake/Utility/CakeNumber.php | 4 +- lib/Cake/Utility/CakeTime.php | 4 +- lib/Cake/Utility/ClassRegistry.php | 4 +- lib/Cake/Utility/Hash.php | 4 +- lib/Cake/Utility/Inflector.php | 4 +- lib/Cake/Utility/Security.php | 4 +- lib/Cake/Utility/Xml.php | 8 +-- lib/Cake/View/Helper/FormHelper.php | 36 +++++----- lib/Cake/View/Helper/HtmlHelper.php | 16 ++--- lib/Cake/View/Helper/NumberHelper.php | 4 +- lib/Cake/View/Helper/SessionHelper.php | 16 ++--- lib/Cake/View/Helper/TimeHelper.php | 4 +- lib/Cake/View/HelperCollection.php | 4 +- lib/Cake/View/JsonView.php | 4 +- lib/Cake/View/MediaView.php | 4 +- lib/Cake/View/XmlView.php | 4 +- 51 files changed, 252 insertions(+), 252 deletions(-) diff --git a/app/Config/acl.php b/app/Config/acl.php index c056b6c32..bfdce6f5e 100644 --- a/app/Config/acl.php +++ b/app/Config/acl.php @@ -34,41 +34,41 @@ * 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 * - * {{{ + * ``` * array('User' => array('username' => 'jeff', 'group_id' => 4, ...)) - * }}} + * ``` * * as ARO and * - * {{{ + * ``` * '/controllers/invoices/delete' - * }}} + * ``` * * as ACO. * * If the configured map looks like * - * {{{ + * ``` * $config['map'] = array( * 'User' => 'User/username', * '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 * 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. * 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( * 'Role/4' => 'Role/editor', * ); - * }}} + * ``` * * In the roles configuration you can define roles on the lhs and inherited roles on the rhs: * - * {{{ + * ``` * $config['roles'] = array( * 'Role/admin' => null, * 'Role/accountant' => null, @@ -76,12 +76,12 @@ * 'Role/manager' => 'Role/editor, Role/accountant', * 'User/jeff' => 'Role/manager', * ); - * }}} + * ``` * * In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role. * Lets define some rules: * - * {{{ + * ``` * $config['rules'] = array( * 'allow' => array( * '*' => 'Role/admin', @@ -96,7 +96,7 @@ * '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, * Role/editor, and Role/accountant. However, for jeff, rules for User/jeff are more specific than diff --git a/lib/Cake/Cache/Cache.php b/lib/Cake/Cache/Cache.php index 612cbed25..cc8be6fce 100644 --- a/lib/Cake/Cache/Cache.php +++ b/lib/Cake/Cache/Cache.php @@ -26,12 +26,12 @@ App::uses('CacheEngine', 'Cache'); * You can configure Cache engines in your application's `bootstrap.php` file. A sample configuration would * be * - * {{{ + * ``` * Cache::config('shared', array( * 'engine' => 'Apc', * 'prefix' => 'my_app_' * )); - * }}} + * ``` * * 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 @@ -517,7 +517,7 @@ class Cache { /** * Retrieve group names to config mapping. * - * {{{ + * ``` * Cache::config('daily', array( * 'duration' => '1 day', 'groups' => array('posts') * )); @@ -525,7 +525,7 @@ class Cache { * 'duration' => '1 week', 'groups' => array('posts', 'archive') * )); * $configs = Cache::groupConfigs('posts'); - * }}} + * ``` * * $config will equal to `array('posts' => array('daily', 'weekly'))` * @@ -554,12 +554,12 @@ class Cache { * * Using a Closure to provide data, assume $this is a Model: * - * {{{ + * ``` * $model = $this; * $results = Cache::remember('all_articles', function() use ($model) { * return $model->find('all'); * }); - * }}} + * ``` * * @param string $key The cache key to read/store data at. * @param callable $callable The callable that provides data in the case when diff --git a/lib/Cake/Configure/IniReader.php b/lib/Cake/Configure/IniReader.php index 378389811..8380ffe70 100644 --- a/lib/Cake/Configure/IniReader.php +++ b/lib/Cake/Configure/IniReader.php @@ -34,10 +34,10 @@ App::uses('CakePlugin', 'Core'); * 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: * - * {{{ + * ``` * [section] * key = value - * }}} + * ``` * * Once loaded into Configure, the above would be accessed using: * diff --git a/lib/Cake/Console/ConsoleOptionParser.php b/lib/Cake/Console/ConsoleOptionParser.php index ae3be34cc..b4de238e6 100644 --- a/lib/Cake/Console/ConsoleOptionParser.php +++ b/lib/Cake/Console/ConsoleOptionParser.php @@ -175,7 +175,7 @@ class ConsoleOptionParser { /** * Build a parser from an array. Uses an array like * - * {{{ + * ``` * $spec = array( * 'description' => 'text', * 'epilog' => 'text', @@ -189,7 +189,7 @@ class ConsoleOptionParser { * // list of subcommands to add. * ) * ); - * }}} + * ``` * * @param array $spec The spec to build the OptionParser with. * @return ConsoleOptionParser diff --git a/lib/Cake/Console/TaskCollection.php b/lib/Cake/Console/TaskCollection.php index 5516a0b6f..3fafddd13 100644 --- a/lib/Cake/Console/TaskCollection.php +++ b/lib/Cake/Console/TaskCollection.php @@ -53,13 +53,13 @@ class TaskCollection extends ObjectCollection { * 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., - * {{{ + * ``` * public $tasks = array( * 'DbConfig' => array( * 'className' => 'Bakeplus.DbConfigure' * ); * ); - * }}} + * ``` * All calls to the `DbConfig` task would use `DbConfigure` found in the `Bakeplus` plugin instead. * * @param string $task Task name to load diff --git a/lib/Cake/Controller/Component/Acl/DbAcl.php b/lib/Cake/Controller/Component/Acl/DbAcl.php index 5d49d070b..33dfd3e4f 100644 --- a/lib/Cake/Controller/Component/Acl/DbAcl.php +++ b/lib/Cake/Controller/Component/Acl/DbAcl.php @@ -29,11 +29,11 @@ App::uses('ClassRegistry', 'Utility'); * * Would point to a tree structure like * - * {{{ + * ``` * controllers * Users * edit - * }}} + * ``` * * @package Cake.Controller.Component.Acl */ diff --git a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php index b47ae7782..efb470032 100644 --- a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php @@ -124,21 +124,21 @@ abstract class BaseAuthorize { * * Create additional mappings for a standard CRUD operation: * - * {{{ + * ``` * $this->Auth->mapActions(array('create' => array('add', 'register')); - * }}} + * ``` * * Or equivalently: * - * {{{ + * ``` * $this->Auth->mapActions(array('register' => 'create', 'add' => 'create')); - * }}} + * ``` * * Create mappings for custom CRUD operations: * - * {{{ + * ``` * $this->Auth->mapActions(array('range' => 'search')); - * }}} + * ``` * * 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 diff --git a/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php b/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php index bcd55f1e2..02144b171 100644 --- a/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php @@ -24,13 +24,13 @@ App::uses('BaseAuthenticate', 'Controller/Component/Auth'); * ### Using Basic auth * * In your controller's components array, add auth + the required settings. - * {{{ + * ``` * public $components = array( * 'Auth' => array( * 'authenticate' => array('Basic') * ) * ); - * }}} + * ``` * * You should also set `AuthComponent::$sessionKey = false;` in your AppController's * beforeFilter() to prevent CakePHP from sending a session cookie to the client. diff --git a/lib/Cake/Controller/Component/Auth/BlowfishAuthenticate.php b/lib/Cake/Controller/Component/Auth/BlowfishAuthenticate.php index b46828547..a25305656 100644 --- a/lib/Cake/Controller/Component/Auth/BlowfishAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/BlowfishAuthenticate.php @@ -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 * hashing. Can be used by configuring AuthComponent to use it via the AuthComponent::$authenticate setting. * - * {{{ + * ``` * $this->Auth->authenticate = array( * 'Blowfish' => array( * 'scope' => array('User.active' => 1) * ) * ) - * }}} + * ``` * * When configuring BlowfishAuthenticate you can pass in settings to which fields, model and additional conditions * are used. See FormAuthenticate::$settings for more information. diff --git a/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php b/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php index 3e007e3c0..79ad66579 100644 --- a/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php @@ -18,14 +18,14 @@ App::uses('BaseAuthorize', 'Controller/Component/Auth'); * 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. * - * {{{ + * ``` * public function isAuthorized($user) { * if (!empty($this->request->params['admin'])) { * return $user['role'] === 'admin'; * } * return !empty($user); * } - * }}} + * ``` * * the above is simple implementation that would only authorize users of the 'admin' role to access * admin routing. diff --git a/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php b/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php index 8dafb16e9..93862919e 100644 --- a/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php @@ -28,13 +28,13 @@ App::uses('BasicAuthenticate', 'Controller/Component/Auth'); * ### Using Digest auth * * In your controller's components array, add auth + the required settings. - * {{{ + * ``` * public $components = array( * 'Auth' => array( * 'authenticate' => array('Digest') * ) * ); - * }}} + * ``` * * 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. diff --git a/lib/Cake/Controller/Component/Auth/FormAuthenticate.php b/lib/Cake/Controller/Component/Auth/FormAuthenticate.php index 13b985690..151c92bdd 100644 --- a/lib/Cake/Controller/Component/Auth/FormAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/FormAuthenticate.php @@ -18,13 +18,13 @@ App::uses('BaseAuthenticate', 'Controller/Component/Auth'); * 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. * - * {{{ + * ``` * $this->Auth->authenticate = array( * 'Form' => array( * 'scope' => array('User.active' => 1) * ) * ) - * }}} + * ``` * * When configuring FormAuthenticate you can pass in settings to which fields, model and additional conditions * are used. See FormAuthenticate::$settings for more information. diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index 7d8ab61a9..3d2169b47 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -56,19 +56,19 @@ class AuthComponent extends Component { * 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. * - * {{{ + * ``` * $this->Auth->authenticate = array( * 'Form' => array( * 'userModel' => 'Users.User' * ) * ); - * }}} + * ``` * * 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 * using the 'all' key: * - * {{{ + * ``` * $this->Auth->authenticate = array( * 'all' => array( * 'userModel' => 'Users.User', @@ -77,7 +77,7 @@ class AuthComponent extends Component { * 'Form', * 'Basic' * ); - * }}} + * ``` * * 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 * multiple adapters and they will be checked sequentially when authorization checks are done. * - * {{{ + * ``` * $this->Auth->authorize = array( * 'Crud' => array( * 'actionPath' => 'controllers/' * ) * ); - * }}} + * ``` * * 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 * using the 'all' key: * - * {{{ + * ``` * $this->Auth->authorize = array( * 'all' => array( * 'actionPath' => 'controllers/' @@ -117,7 +117,7 @@ class AuthComponent extends Component { * 'Crud', * 'CustomAuth' * ); - * }}} + * ``` * * You can also use AuthComponent::ALL instead of the string 'all' * diff --git a/lib/Cake/Controller/Component/PaginatorComponent.php b/lib/Cake/Controller/Component/PaginatorComponent.php index 1b0d1c43a..94a606552 100644 --- a/lib/Cake/Controller/Component/PaginatorComponent.php +++ b/lib/Cake/Controller/Component/PaginatorComponent.php @@ -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 * are no specific model configuration, or the model you are paginating does not have specific settings. * - * {{{ + * ``` * $this->Paginator->settings = array( * 'limit' => 20, * 'maxLimit' => 100 * ); - * }}} + * ``` * * The above settings will be used to paginate any model. You can configure model specific settings by * keying the settings with the model name. * - * {{{ + * ``` * $this->Paginator->settings = array( * 'Post' => array( * 'limit' => 20, @@ -47,7 +47,7 @@ App::uses('Hash', 'Utility'); * ), * 'Comment' => array( ... ) * ); - * }}} + * ``` * * 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. * - * {{{ + * ``` * $this->Paginator->settings = array( * 'Post' => array( * 'findType' => 'popular' * ) * ); - * }}} + * ``` * * Would paginate using the `find('popular')` method. * diff --git a/lib/Cake/Controller/ComponentCollection.php b/lib/Cake/Controller/ComponentCollection.php index 8d92ff657..14a957f83 100644 --- a/lib/Cake/Controller/ComponentCollection.php +++ b/lib/Cake/Controller/ComponentCollection.php @@ -79,13 +79,13 @@ class ComponentCollection extends ObjectCollection implements CakeEventListener * 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., - * {{{ + * ``` * public $components = array( * 'Email' => array( * 'className' => 'AliasedEmail' * ); * ); - * }}} + * ``` * All calls to the `Email` component would use `AliasedEmail` instead. * * @param string $component Component name to load diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index ab6e98180..6005a1dc2 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -227,12 +227,12 @@ class Controller extends Object implements CakeEventListener { * * Example: * - * {{{ + * ``` * public $cacheAction = array( * 'view/23/' => 21600, * 'recalled/' => 86400 * ); - * }}} + * ``` * * $cacheAction can also be set to a strtotime() compatible string. This * marks all the actions in the controller for view caching. @@ -857,10 +857,10 @@ class Controller extends Object implements CakeEventListener { * * Examples: * - * {{{ + * ``` * setAction('another_action'); * setAction('action_with_parameters', $parameter1); - * }}} + * ``` * * @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. diff --git a/lib/Cake/Core/CakePlugin.php b/lib/Cake/Core/CakePlugin.php index cd4611fe3..96ce894fd 100644 --- a/lib/Cake/Core/CakePlugin.php +++ b/lib/Cake/Core/CakePlugin.php @@ -51,12 +51,12 @@ class CakePlugin { * `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' => array('routes' => true), * 'ApiGenerator' * ), array('bootstrap' => true)) - * }}} + * ``` * * 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 * It is possible to set specific defaults for each plugins in the options array. Examples: * - * {{{ + * ``` * CakePlugin::loadAll(array( * array('bootstrap' => true), * '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 routes file and will not look for any bootstrap script. diff --git a/lib/Cake/Core/Configure.php b/lib/Cake/Core/Configure.php index 18c85589d..5872b0161 100644 --- a/lib/Cake/Core/Configure.php +++ b/lib/Cake/Core/Configure.php @@ -130,7 +130,7 @@ class Configure { * Used to store a dynamic variable in Configure. * * Usage: - * {{{ + * ``` * Configure::write('One.key1', 'value of the Configure::One[key1]'); * Configure::write(array('One.key1' => 'value of the Configure::One[key1]')); * Configure::write('One', array( @@ -142,7 +142,7 @@ class Configure { * 'One.key1' => 'value of the Configure::One[key1]', * 'One.key2' => 'value of the Configure::One[key2]' * )); - * }}} + * ``` * * @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). @@ -174,10 +174,10 @@ class Configure { * possible to store `null` values in Configure. * * Usage: - * {{{ + * ``` * Configure::read('Name'); will return all values for Name * Configure::read('Name.key'); will return only the value of Configure::Name[key] - * }}} + * ``` * * @param string $var Variable to obtain. Use '.' to access array elements. * @return mixed value stored in configure, or null. @@ -207,10 +207,10 @@ class Configure { * Used to delete a variable from Configure. * * Usage: - * {{{ + * ``` * Configure::delete('Name'); will delete the entire Configure::Name * Configure::delete('Name.key'); will delete only the Configure::Name[key] - * }}} + * ``` * * @param string $var the var to be deleted * @return void diff --git a/lib/Cake/Event/CakeEvent.php b/lib/Cake/Event/CakeEvent.php index 743f2a47c..869609283 100644 --- a/lib/Cake/Event/CakeEvent.php +++ b/lib/Cake/Event/CakeEvent.php @@ -67,10 +67,10 @@ class CakeEvent { * * ## Examples of usage: * - * {{{ + * ``` * $event = new CakeEvent('Order.afterBuy', $this, array('buyer' => $userData)); * $event = new CakeEvent('User.afterRegister', $UserModel); - * }}} + * ``` * */ public function __construct($name, $subject = null, $data = null) { diff --git a/lib/Cake/Event/CakeEventListener.php b/lib/Cake/Event/CakeEventListener.php index e29c63a6e..bba20bd6e 100644 --- a/lib/Cake/Event/CakeEventListener.php +++ b/lib/Cake/Event/CakeEventListener.php @@ -28,7 +28,7 @@ interface CakeEventListener { * * ## Example: * - * {{{ + * ``` * public function implementedEvents() { * return array( * 'Order.complete' => 'sendEmail', @@ -36,7 +36,7 @@ interface CakeEventListener { * 'User.onRegister' => array('callable' => 'logRegistration', 'priority' => 20, 'passParams' => true) * ); * } - * }}} + * ``` * * @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 diff --git a/lib/Cake/I18n/I18n.php b/lib/Cake/I18n/I18n.php index 96ccdbe70..907adc5f4 100644 --- a/lib/Cake/I18n/I18n.php +++ b/lib/Cake/I18n/I18n.php @@ -93,9 +93,9 @@ class I18n { * The constants may be used in translation fetching * instead of hardcoded integers. * Example: - * {{{ + * ``` * I18n::translate('CakePHP is awesome.', null, null, I18n::LC_MESSAGES) - * }}} + * ``` * * To keep the code more readable, I18n constants are preferred over * hardcoded integers. diff --git a/lib/Cake/Log/CakeLog.php b/lib/Cake/Log/CakeLog.php index 8772db7a6..b8e4ed058 100644 --- a/lib/Cake/Log/CakeLog.php +++ b/lib/Cake/Log/CakeLog.php @@ -31,9 +31,9 @@ App::uses('LogEngineCollection', 'Log'); * You can configure log adapters in your applications `bootstrap.php` file. * A sample configuration would look like: * - * {{{ + * ``` * CakeLog::config('my_log', array('engine' => 'File')); - * }}} + * ``` * * 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, * or the correct constants with `write()`: * - * {{{ + * ``` * CakeLog::error('Something horrible happened'); * CakeLog::write(LOG_ERR, 'Something horrible happened'); - * }}} + * ``` * * If you require custom logging levels, you can use CakeLog::levels() to * append additional logging levels. @@ -129,12 +129,12 @@ class CakeLog { * * ### Usage: * - * {{{ + * ``` * CakeLog::config('second_file', array( * 'engine' => 'File', * 'path' => '/var/logs/my_app/' * )); - * }}} + * ``` * * Will configure a FileLog instance to use the specified path. * 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. * This allows you to disable debug messages in production for example: * - * {{{ + * ``` * CakeLog::config('default', array( * 'engine' => 'File', * 'path' => LOGS, * 'levels' => array('error', 'critical', 'alert', 'emergency') * )); - * }}} + * ``` * * The above logger would only log error messages or higher. Any * other log messages would be discarded. @@ -164,13 +164,13 @@ class CakeLog { * logger. If you don't define any scopes an adapter will catch * all scopes that match the handled levels. * - * {{{ + * ``` * CakeLog::config('payments', array( * 'engine' => 'File', * 'types' => array('info', 'error', 'warning'), * 'scopes' => array('payment', 'order') * )); - * }}} + * ``` * * The above logger will only capture log entries made in 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: * - * {{{ + * ``` * CakeLog::levels(array('user0, 'user1')); * // or * CakeLog::levels(array('user0, 'user1'), true); - * }}} + * ``` * * will result in: * - * {{{ + * ``` * array( * 0 => 'emergency', * 1 => 'alert', @@ -236,23 +236,23 @@ class CakeLog { * 8 => 'user0', * 9 => 'user1', * ); - * }}} + * ``` * * To set/replace existing configuration, pass an array with the second argument * set to false. * - * {{{ + * ``` * CakeLog::levels(array('user0, 'user1'), false); - * }}} + * ``` * * will result in: * - * {{{ + * ``` * array( * 0 => 'user0', * 1 => 'user1', * ); - * }}} + * ``` * * @param array $levels array * @param bool $append true to append, false to replace diff --git a/lib/Cake/Log/Engine/SyslogLog.php b/lib/Cake/Log/Engine/SyslogLog.php index 95abb205c..21b45c6e0 100644 --- a/lib/Cake/Log/Engine/SyslogLog.php +++ b/lib/Cake/Log/Engine/SyslogLog.php @@ -40,14 +40,14 @@ class SyslogLog extends BaseLog { * * ## Example: * - * {{{ + * ``` * CakeLog::config('error', array( * 'engine' => 'Syslog', * 'types' => array('emergency', 'alert', 'critical', 'error'), * 'format' => "%s: My-App - %s", * 'prefix' => 'Web Server 01' * )); - * }}} + * ``` * * @var array */ diff --git a/lib/Cake/Model/Behavior/ContainableBehavior.php b/lib/Cake/Model/Behavior/ContainableBehavior.php index c71f8f752..985c4fc6c 100644 --- a/lib/Cake/Model/Behavior/ContainableBehavior.php +++ b/lib/Cake/Model/Behavior/ContainableBehavior.php @@ -75,7 +75,7 @@ class ContainableBehavior extends ModelBehavior { * * `Model->find('all', array('contain' => array('Model1', 'Model2')));` * - * {{{ + * ``` * Model->find('all', array('contain' => array( * 'Model1' => array('Model11', 'Model12'), * 'Model2', @@ -84,7 +84,7 @@ class ContainableBehavior extends ModelBehavior { * 'Model32', * 'Model33' => array('Model331', 'Model332') * ))); - * }}} + * ``` * * @param Model $Model Model using the behavior * @param array $query Query parameters as set by cake diff --git a/lib/Cake/Model/BehaviorCollection.php b/lib/Cake/Model/BehaviorCollection.php index 272a21271..f90e6fabd 100644 --- a/lib/Cake/Model/BehaviorCollection.php +++ b/lib/Cake/Model/BehaviorCollection.php @@ -86,13 +86,13 @@ class BehaviorCollection extends ObjectCollection implements CakeEventListener { * can still be used as normal. * * You can alias your behavior as an existing behavior by setting the 'className' key, i.e., - * {{{ + * ``` * public $actsAs = array( * 'Tree' => array( * 'className' => 'AliasedTree' * ); * ); - * }}} + * ``` * All calls to the `Tree` behavior would use `AliasedTree` instead. * * @param string $behavior CamelCased name of the behavior to load diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index dee55cffd..6a794b09a 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -124,33 +124,33 @@ class Model extends Object implements CakeEventListener { * * ### Validating using regular expressions * - * {{{ + * ``` * public $validate = array( * 'name' => '/^[a-z].+$/i' * ); - * }}} + * ``` * * ### Validating using methods (no parameters) * - * {{{ + * ``` * public $validate = array( * 'name' => 'notEmpty' * ); - * }}} + * ``` * * ### Validating using methods (with parameters) * - * {{{ + * ``` * public $validate = array( * 'length' => array( * 'rule' => array('lengthBetween', 5, 25) * ) * ); - * }}} + * ``` * * ### Validating using custom method * - * {{{ + * ``` * public $validate = array( * 'password' => array( * 'rule' => array('customValidation') @@ -163,24 +163,24 @@ class Model extends Object implements CakeEventListener { * } * return true; * } - * }}} + * ``` * * ### Validations with messages * * The messages will be used in Model::$validationErrors and can be used in the FormHelper * - * {{{ + * ``` * public $validate = array( * 'length' => array( * 'rule' => array('lengthBetween', 5, 15), * 'message' => array('Between %d to %d characters') * ) * ); - * }}} + * ``` * * ### Multiple validations to the same field * - * {{{ + * ``` * public $validate = array( * 'login' => array( * array( @@ -194,7 +194,7 @@ class Model extends Object implements CakeEventListener { * ) * ) * ); - * }}} + * ``` * * ### Valid keys in validations * @@ -280,7 +280,7 @@ class Model extends Object implements CakeEventListener { * * ### Detailed configuration * - * {{{ + * ``` * public $belongsTo = array( * 'Group', * 'Department' => array( @@ -288,7 +288,7 @@ class Model extends Object implements CakeEventListener { * 'foreignKey' => 'department_id' * ) * ); - * }}} + * ``` * * ### Possible keys in association * @@ -327,7 +327,7 @@ class Model extends Object implements CakeEventListener { * * ### Detailed configuration * - * {{{ + * ``` * public $hasOne = array( * 'Profile', * 'Address' => array( @@ -335,7 +335,7 @@ class Model extends Object implements CakeEventListener { * 'foreignKey' => 'user_id' * ) * ); - * }}} + * ``` * * ### Possible keys in association * @@ -370,7 +370,7 @@ class Model extends Object implements CakeEventListener { * * ### Detailed configuration * - * {{{ + * ``` * public $hasMany = array( * 'Comment', * 'Task' => array( @@ -378,7 +378,7 @@ class Model extends Object implements CakeEventListener { * 'foreignKey' => 'user_id' * ) * ); - * }}} + * ``` * * ### Possible keys in association * @@ -419,7 +419,7 @@ class Model extends Object implements CakeEventListener { * * ### Detailed configuration * - * {{{ + * ``` * public $hasAndBelongsToMany = array( * 'Role', * 'Address' => array( @@ -429,7 +429,7 @@ class Model extends Object implements CakeEventListener { * 'joinTable' => 'addresses_users' * ) * ); - * }}} + * ``` * * ### 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. * The format will be such as the following. * - * {{{ + * ``` * $results = array( * 0 => array( * 'ModelName' => array( @@ -616,7 +616,7 @@ class Model extends Object implements CakeEventListener { * ) * ) * ); - * }}} + * ``` * * @var bool */ @@ -683,9 +683,9 @@ class Model extends Object implements CakeEventListener { * * You can dynamically create model instances using the $id array syntax. * - * {{{ + * ``` * $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 * 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. * - `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. - * {{{ + * ``` * array( * 'SomeModel' => array('field'), * 'AssociatedModel' => array('field', 'otherfield') * ) - * }}} + * ``` * - `deep`: See saveMany/saveAssociated * - `callbacks`: 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. * - `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. - * {{{ + * ``` * array( * 'SomeModel' => array('field'), * 'AssociatedModel' => array('field', 'otherfield') * ) - * }}} + * ``` * - `deep`: If set to true, not only directly associated data is saved, but deeper nested associated data as well. * - `callbacks`: See Model::save() * - `counterCache`: See Model::save() @@ -2919,7 +2919,7 @@ class Model extends Object implements CakeEventListener { * 'recursive', 'page', 'fields', 'offset', 'order', 'callbacks') * * Eg: - * {{{ + * ``` * $model->find('all', array( * 'conditions' => array('name' => 'Thomas Anderson'), * 'fields' => array('name', 'email'), @@ -2928,13 +2928,13 @@ class Model extends Object implements CakeEventListener { * 'group' => 'type', * 'callbacks' => false, * )); - * }}} + * ``` * * 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 * joins that should be part of the query. * - * {{{ + * ``` * $model->find('all', array( * 'conditions' => array('name' => 'Thomas Anderson'), * 'joins' => array( @@ -2946,7 +2946,7 @@ class Model extends Object implements CakeEventListener { * ) * ) * )); - * }}} + * ``` * * ### 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 * caching of datasource calls. * - * {{{ + * ``` * protected function _readDataSource($type, $query) { * $cacheName = md5(json_encode($query)); * $cache = Cache::read($cacheName, 'cache-config-name'); @@ -3008,7 +3008,7 @@ class Model extends Object implements CakeEventListener { * Cache::write($cacheName, $results, 'cache-config-name'); * return $results; * } - * }}} + * ``` * * @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) diff --git a/lib/Cake/Model/ModelBehavior.php b/lib/Cake/Model/ModelBehavior.php index fad752443..4ec08cdeb 100644 --- a/lib/Cake/Model/ModelBehavior.php +++ b/lib/Cake/Model/ModelBehavior.php @@ -30,11 +30,11 @@ * Behaviors can provide mixin like features by declaring public methods. These methods should expect * the model instance to be shifted onto the parameter list. * - * {{{ + * ``` * function doSomething(Model $model, $arg1, $arg2) { * //do something * } - * }}} + * ``` * * 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 * than a normal behavior mixin method. * - * {{{ + * ``` * public $mapMethods = array('/do(\w+)/' => 'doSomething'); * * function doSomething(Model $model, $method, $arg1, $arg2) { * //do something * } - * }}} + * ``` * * 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 diff --git a/lib/Cake/Model/ModelValidator.php b/lib/Cake/Model/ModelValidator.php index 1980ea01c..474e24bb1 100644 --- a/lib/Cake/Model/ModelValidator.php +++ b/lib/Cake/Model/ModelValidator.php @@ -535,7 +535,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable { * * ## Example: * - * {{{ + * ``` * $validator * ->add('title', 'required', array('rule' => 'notEmpty', 'required' => true)) * ->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)), * 'hasSpecialCharacter' => array('rule' => 'validateSpecialchar', 'message' => 'not valid') * )); - * }}} + * ``` * * @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 @@ -580,11 +580,11 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable { * * ## Example: * - * {{{ + * ``` * $validator * ->remove('title', 'required') * ->remove('user_id') - * }}} + * ``` * * @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 diff --git a/lib/Cake/Model/Validator/CakeValidationSet.php b/lib/Cake/Model/Validator/CakeValidationSet.php index 9017f1a70..7a8457c7e 100644 --- a/lib/Cake/Model/Validator/CakeValidationSet.php +++ b/lib/Cake/Model/Validator/CakeValidationSet.php @@ -183,11 +183,11 @@ class CakeValidationSet implements ArrayAccess, IteratorAggregate, Countable { * * ## Example: * - * {{{ + * ``` * $set * ->setRule('required', array('rule' => 'notEmpty', 'required' => true)) * ->setRule('between', array('rule' => array('lengthBetween', 4, 10)) - * }}} + * ``` * * @param string $name The name under which the rule should be set * @param CakeValidationRule|array $rule The validation rule to be set @@ -206,11 +206,11 @@ class CakeValidationSet implements ArrayAccess, IteratorAggregate, Countable { * * ## Example: * - * {{{ + * ``` * $set * ->removeRule('required') * ->removeRule('inRange') - * }}} + * ``` * * @param string $name The name under which the rule should be unset * @return $this @@ -225,12 +225,12 @@ class CakeValidationSet implements ArrayAccess, IteratorAggregate, Countable { * * ## Example: * - * {{{ + * ``` * $set->setRules(array( * 'required' => array('rule' => 'notEmpty', 'required' => true), * 'inRange' => array('rule' => array('between', 4, 10) * )); - * }}} + * ``` * * @param array $rules The rules to be set * @param bool $mergeVars [optional] If true, merges vars instead of replace. Defaults to true. diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index 5ce0d359c..5e9932069 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -758,11 +758,11 @@ class CakeRequest implements ArrayAccess { * * Get the list of accepted languages: * - * {{{ CakeRequest::acceptLanguage(); }}} + * ``` CakeRequest::acceptLanguage(); ``` * * Check if a specific language is accepted: * - * {{{ CakeRequest::acceptLanguage('es-es'); }}} + * ``` CakeRequest::acceptLanguage('es-es'); ``` * * @param string $language The language to test. * @return mixed If a $language is provided, a boolean. Otherwise the array of accepted languages. diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index ca7f8a97c..4cae10499 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -1002,35 +1002,35 @@ class CakeEmail { * * Attach a single file: * - * {{{ + * ``` * $email->attachments('path/to/file'); - * }}} + * ``` * * Attach a file with a different filename: * - * {{{ + * ``` * $email->attachments(array('custom_name.txt' => 'path/to/file.txt')); - * }}} + * ``` * * Attach a file and specify additional properties: * - * {{{ + * ``` * $email->attachments(array('custom_name.png' => array( * 'file' => 'path/to/file', * 'mimetype' => 'image/png', * 'contentId' => 'abc123', * 'contentDisposition' => false * )); - * }}} + * ``` * * Attach a file from string and specify additional properties: * - * {{{ + * ``` * $email->attachments(array('custom_name.png' => array( * 'data' => file_get_contents('path/to/file'), * 'mimetype' => 'image/png' * )); - * }}} + * ``` * * The `contentId` key allows you to specify an inline attachment. In your email text, you * can use `` to display the image inline. diff --git a/lib/Cake/Network/Email/SmtpTransport.php b/lib/Cake/Network/Email/SmtpTransport.php index c2009b475..73af32b46 100644 --- a/lib/Cake/Network/Email/SmtpTransport.php +++ b/lib/Cake/Network/Email/SmtpTransport.php @@ -58,7 +58,7 @@ class SmtpTransport extends AbstractTransport { * * A response consists of one or more lines containing a response * code and an optional response message text: - * {{{ + * ``` * array( * array( * 'code' => '250', @@ -74,7 +74,7 @@ class SmtpTransport extends AbstractTransport { * ), * // etc... * ) - * }}} + * ``` * * @return array */ diff --git a/lib/Cake/Network/Http/HttpSocket.php b/lib/Cake/Network/Http/HttpSocket.php index 3b4882989..16fc0edcf 100644 --- a/lib/Cake/Network/Http/HttpSocket.php +++ b/lib/Cake/Network/Http/HttpSocket.php @@ -139,12 +139,12 @@ class HttpSocket extends CakeSocket { * * Or use an array to configure multiple options: * - * {{{ + * ``` * $http = new HttpSocket(array( * 'host' => 'cakephp.org', * 'timeout' => 20 * )); - * }}} + * ``` * * 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 * Basic authentication you can do the following: * - * {{{ + * ``` * $http->configAuth('Basic', 'mark', 'secret'); - * }}} + * ``` * * If you are using an authentication strategy that requires more inputs, like Digest authentication * you can call `configAuth()` with an array of user information. * - * {{{ + * ``` * $http->configAuth('Digest', array( * 'user' => 'mark', * 'pass' => 'secret', * 'realm' => 'my-realm', * 'nonce' => 1235 * )); - * }}} + * ``` * * 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: * - * {{{ + * ``` * $response = $http->get( * array('host' => 'google.com', 'path' => '/search'), * array('q' => 'cakephp', 'client' => 'safari') * ); - * }}} + * ``` * * @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 @@ -497,12 +497,12 @@ class HttpSocket extends CakeSocket { * * `post()` can be used to post simple data arrays to a URL: * - * {{{ + * ``` * $response = $http->post('http://example.com', array( * 'username' => 'batman', * 'password' => 'bruce_w4yne' * )); - * }}} + * ``` * * @param string|array $uri URI to request. See HttpSocket::_parseUri() * @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 * URLs. * - * {{{ + * ``` * $http = new HttpSocket('http://www.cakephp.org'); * $url = $http->url('/search?q=bar'); - * }}} + * ``` * * Would return `http://www.cakephp.org/search?q=bar` * diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php index 6766f9895..595192f97 100644 --- a/lib/Cake/Routing/Router.php +++ b/lib/Cake/Routing/Router.php @@ -289,13 +289,13 @@ class Router { * * The above shows the use of route parameter defaults, and providing routing parameters for a static route. * - * {{{ + * ``` * Router::connect( * '/:lang/:controller/:action/:id', * array(), * array('id' => '[0-9]+', 'lang' => '[a-z]{3}') * ); - * }}} + * ``` * * 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. @@ -426,37 +426,37 @@ class Router { * * Do not parse any named parameters: * - * {{{ Router::connectNamed(false); }}} + * ``` Router::connectNamed(false); ``` * * 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: * - * {{{ 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. * - * {{{ 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'. * - * {{{ + * ``` * Router::connectNamed( * array('page' => array('action' => 'index')), * array('default' => false, 'greedy' => false) * ); - * }}} + * ``` * * Parse only the page parameter if the current action is 'index' and the controller is 'pages'. * - * {{{ + * ``` * Router::connectNamed( * array('page' => array('action' => 'index', 'controller' => 'pages')), * array('default' => false, 'greedy' => false) * ); - * }}} + * ``` * * ### Options * diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index 01e0b1e1e..e457a033b 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -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 * attribute that contains 'my-input': * - * {{{ + * ``` * array('input' => array('name', 'id' => 'my-input')) - * }}} + * ``` * * Checks for two p elements with some text in them: * - * {{{ + * ``` * array( * array('p' => true), * 'textA', @@ -356,17 +356,17 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * 'textB', * '/p' * ) - * }}} + * ``` * * 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: * - * {{{ + * ``` * array( * array('input' => array('name', 'id' => 'preg:/FieldName\d+/')), * 'preg:/My\s+field/' * ) - * }}} + * ``` * * Important: This function is very forgiving about whitespace and also accepts any * permutation of attribute order. It will also allow whitespace between specified tags. diff --git a/lib/Cake/Utility/CakeNumber.php b/lib/Cake/Utility/CakeNumber.php index 35db8c283..61a3daf59 100644 --- a/lib/Cake/Utility/CakeNumber.php +++ b/lib/Cake/Utility/CakeNumber.php @@ -380,11 +380,11 @@ class CakeNumber { * Add a currency format to the Number helper. Makes reusing * 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. * - * {{{ $number->currency($value, 'NOK'); }}} + * ``` $number->currency($value, 'NOK'); ``` * * Added formats are merged with the defaults defined in CakeNumber::$_currencyDefaults * See CakeNumber::currency() for more information on the various options and their function. diff --git a/lib/Cake/Utility/CakeTime.php b/lib/Cake/Utility/CakeTime.php index 465b6d1b7..38c22196a 100644 --- a/lib/Cake/Utility/CakeTime.php +++ b/lib/Cake/Utility/CakeTime.php @@ -1018,12 +1018,12 @@ class CakeTime { * * Create localized & formatted time: * - * {{{ + * ``` * 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('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 - * }}} + * ``` * * @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) diff --git a/lib/Cake/Utility/ClassRegistry.php b/lib/Cake/Utility/ClassRegistry.php index 8a29d03df..144a0318f 100644 --- a/lib/Cake/Utility/ClassRegistry.php +++ b/lib/Cake/Utility/ClassRegistry.php @@ -79,13 +79,13 @@ class ClassRegistry { * * When $class is a numeric keyed array, multiple class instances will be stored in the registry, * no instance of the object will be returned - * {{{ + * ``` * array( * 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, * stored in the registry and returned. diff --git a/lib/Cake/Utility/Hash.php b/lib/Cake/Utility/Hash.php index c46391263..70485195b 100644 --- a/lib/Cake/Utility/Hash.php +++ b/lib/Cake/Utility/Hash.php @@ -445,9 +445,9 @@ class Hash { * * Usage: * - * {{{ + * ``` * $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. * diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 3e99149c0..6e7b4d493 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -305,7 +305,7 @@ class Inflector { * * ### Usage: * - * {{{ + * ``` * Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables')); * Inflector::rules('plural', array( * 'rules' => array('/^(inflect)ors$/i' => '\1ables'), @@ -313,7 +313,7 @@ class Inflector { * 'irregular' => array('red' => 'redlings') * )); * Inflector::rules('transliteration', array('/å/' => 'aa')); - * }}} + * ``` * * @param string $type The type of inflection, either 'plural', 'singular' or 'transliteration' * @param array $rules Array of rules to be added. diff --git a/lib/Cake/Utility/Security.php b/lib/Cake/Utility/Security.php index c2d210664..7d3afa8f4 100644 --- a/lib/Cake/Utility/Security.php +++ b/lib/Cake/Utility/Security.php @@ -91,9 +91,9 @@ class Security { * * Creating a blowfish/bcrypt hash: * - * {{{ + * ``` * $hash = Security::hash($password, 'blowfish'); - * }}} + * ``` * * @param string $string String to hash * @param string $type Method to use (sha1/sha256/md5/blowfish) diff --git a/lib/Cake/Utility/Xml.php b/lib/Cake/Utility/Xml.php index ad4aa424b..e3bb4282d 100644 --- a/lib/Cake/Utility/Xml.php +++ b/lib/Cake/Utility/Xml.php @@ -52,7 +52,7 @@ class Xml { * * Building from an array: * - * {{{ + * ``` * $value = array( * 'tags' => array( * 'tag' => array( @@ -68,7 +68,7 @@ class Xml { * ) * ); * $xml = Xml::build($value); - * }}} + * ``` * * 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: * - * {{{ + * ``` * $value = array( * 'root' => array( * 'tag' => array( @@ -174,7 +174,7 @@ class Xml { * ) * ) * ); - * }}} + * ``` * * Calling `Xml::fromArray($value, 'tags');` Will generate: * diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 849a76d1e..70175d88d 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -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. * - * {{{ + * ``` * array usage: * * array('label' => 'save'); value="save" @@ -506,7 +506,7 @@ class FormHelper extends AppHelper { * array('name' => 'Whatever'); value="Submit" name="Whatever" * array('label' => 'save', 'name' => 'Whatever', 'div' => 'good')
value="save" name="Whatever" * array('label' => 'save', 'name' => 'Whatever', 'div' => array('class' => 'good'));
value="save" name="Whatever" - * }}} + * ``` * * 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' @@ -786,33 +786,33 @@ class FormHelper extends AppHelper { * * The text and for attribute are generated off of the fieldname * - * {{{ + * ``` * echo $this->Form->label('Post.published'); * - * }}} + * ``` * * Custom text: * - * {{{ + * ``` * echo $this->Form->label('Post.published', 'Publish'); * - * }}} + * ``` * * Custom class name: * - * {{{ + * ``` * echo $this->Form->label('Post.published', 'Publish', 'required'); * - * }}} + * ``` * * Custom attributes: * - * {{{ + * ``` * echo $this->Form->label('Post.published', 'Publish', array( * 'for' => 'post-publish' * )); * - * }}} + * ``` * * @param string $fieldName This should be "Modelname.fieldname" * @param string $text Text that will appear in the label field. If @@ -859,11 +859,11 @@ class FormHelper extends AppHelper { * will be used. * * You can customize individual inputs through `$fields`. - * {{{ + * ``` * $this->Form->inputs(array( * 'name' => array('label' => 'custom label') * )); - * }}} + * ``` * * In addition to controller fields output, `$fields` can be used to control legend * and fieldset rendering. @@ -1986,13 +1986,13 @@ class FormHelper extends AppHelper { * * A simple array will create normal options: * - * {{{ + * ``` * $options = array(1 => 'one', 2 => 'two); * $this->Form->select('Model.field', $options)); - * }}} + * ``` * * While a nested options array will create optgroups with options inside them. - * {{{ + * ``` * $options = array( * 1 => 'bill', * 'fred' => array( @@ -2001,7 +2001,7 @@ class FormHelper extends AppHelper { * ) * ); * $this->Form->select('Model.field', $options); - * }}} + * ``` * * In the above `2 => 'fred'` will not generate an option element. You should enable the `showParents` * attribute to show the fred option. @@ -2009,12 +2009,12 @@ class FormHelper extends AppHelper { * If you have multiple options that need to have the same value attribute, you can * use an array of arrays to express this: * - * {{{ + * ``` * $options = array( * array('name' => 'United states', 'value' => 'USA'), * array('name' => 'USA', 'value' => 'USA'), * ); - * }}} + * ``` * * @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 diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 6dfed4068..adb6220d5 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -650,12 +650,12 @@ class HtmlHelper extends AppHelper { * * ### Usage: * - * {{{ + * ``` * echo $this->Html->style(array('margin' => '10px', 'padding' => '10px'), true); * * // creates * 'margin:10px;padding:10px;' - * }}} + * ``` * * @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. @@ -1034,21 +1034,21 @@ class HtmlHelper extends AppHelper { * * Using multiple video files: * - * {{{ + * ``` * echo $this->Html->media( * array('video.mp4', array('src' => 'video.ogv', 'type' => "video/ogg; codecs='theora, vorbis'")), * array('tag' => 'video', 'autoplay') * ); - * }}} + * ``` * * Outputs: * - * {{{ + * ``` * - * }}} + * ``` * * ### Options * @@ -1186,11 +1186,11 @@ class HtmlHelper extends AppHelper { * * tags.php could look like: * - * {{{ + * ``` * $tags = array( * 'meta' => '' * ); - * }}} + * ``` * * If you wish to store tag definitions in another format you can give an array * containing the file name, and reader class name: diff --git a/lib/Cake/View/Helper/NumberHelper.php b/lib/Cake/View/Helper/NumberHelper.php index 81b708aef..ce15ad217 100644 --- a/lib/Cake/View/Helper/NumberHelper.php +++ b/lib/Cake/View/Helper/NumberHelper.php @@ -152,11 +152,11 @@ class NumberHelper extends AppHelper { * Add a currency format to the Number helper. Makes reusing * 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. * - * {{{ $this->Number->currency($value, 'NOK'); }}} + * ``` $this->Number->currency($value, 'NOK'); ``` * * Added formats are merged with the defaults defined in Cake\Utility\Number::$_currencyDefaults * See Cake\Utility\Number::currency() for more information on the various options and their function. diff --git a/lib/Cake/View/Helper/SessionHelper.php b/lib/Cake/View/Helper/SessionHelper.php index 9ea5e65f9..d45e6b4ce 100644 --- a/lib/Cake/View/Helper/SessionHelper.php +++ b/lib/Cake/View/Helper/SessionHelper.php @@ -77,17 +77,17 @@ class SessionHelper extends AppHelper { * 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. * - * {{{ + * ``` * 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 * can pass additional data into the element rendering that will be made available as local variables * when the element is rendered: * - * {{{ + * ``` * 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 * messages without the controller needing access to that data. @@ -95,19 +95,19 @@ class SessionHelper extends AppHelper { * 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. * - * {{{ + * ``` * 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 * plugin param: * - * {{{ + * ``` * echo $this->Session->flash('flash', array( * 'element' => 'my_custom_element', * 'params' => array('plugin' => 'my_plugin') * )); - * }}} + * ``` * * @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. diff --git a/lib/Cake/View/Helper/TimeHelper.php b/lib/Cake/View/Helper/TimeHelper.php index e29e14bbc..45ce699bd 100644 --- a/lib/Cake/View/Helper/TimeHelper.php +++ b/lib/Cake/View/Helper/TimeHelper.php @@ -462,12 +462,12 @@ class TimeHelper extends AppHelper { * * Create localized & formatted time: * - * {{{ + * ``` * $this->Time->format('2012-02-15', '%m-%d-%Y'); // returns 02-15-2012 * $this->Time->format('2012-02-15 23:01:01', '%c'); // returns preferred date and time based on configured locale * $this->Time->format('0000-00-00', '%d-%m-%Y', 'N/A'); // return N/A becuase an invalid date was passed * $this->Time->format('2012-02-15 23:01:01', '%c', 'N/A', 'America/New_York'); // converts passed date to timezone - * }}} + * ``` * * @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) diff --git a/lib/Cake/View/HelperCollection.php b/lib/Cake/View/HelperCollection.php index b90faf651..d30e84062 100644 --- a/lib/Cake/View/HelperCollection.php +++ b/lib/Cake/View/HelperCollection.php @@ -98,13 +98,13 @@ class HelperCollection extends ObjectCollection implements CakeEventListener { * 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., - * {{{ + * ``` * public $helpers = array( * 'Html' => array( * 'className' => 'AliasedHtml' * ); * ); - * }}} + * ``` * All calls to the `Html` helper would use `AliasedHtml` instead. * * @param string $helper Helper name to load diff --git a/lib/Cake/View/JsonView.php b/lib/Cake/View/JsonView.php index c8e46671e..2f184139d 100644 --- a/lib/Cake/View/JsonView.php +++ b/lib/Cake/View/JsonView.php @@ -32,10 +32,10 @@ App::uses('View', 'View'); * You can also define `'_serialize'` as an array. This will create a top level object containing * all the named view variables: * - * {{{ + * ``` * $this->set(compact('posts', 'users', 'stuff')); * $this->set('_serialize', array('posts', 'users')); - * }}} + * ``` * * The above would generate a JSON object that looks like: * diff --git a/lib/Cake/View/MediaView.php b/lib/Cake/View/MediaView.php index a03888a39..77ba3c363 100644 --- a/lib/Cake/View/MediaView.php +++ b/lib/Cake/View/MediaView.php @@ -36,7 +36,7 @@ App::uses('CakeRequest', 'Network'); * * ### Usage * - * {{{ + * ``` * class ExampleController extends AppController { * public function download() { * $this->viewClass = 'Media'; @@ -50,7 +50,7 @@ App::uses('CakeRequest', 'Network'); * $this->set($params); * } * } - * }}} + * ``` * * @package Cake.View * @deprecated 3.0.0 Deprecated since version 2.3, use CakeResponse::file() instead diff --git a/lib/Cake/View/XmlView.php b/lib/Cake/View/XmlView.php index 0c010f9aa..385543373 100644 --- a/lib/Cake/View/XmlView.php +++ b/lib/Cake/View/XmlView.php @@ -36,10 +36,10 @@ App::uses('Hash', 'Utility'); * You can also define `'_serialize'` as an array. This will create an additional * top level element named `` containing all the named view variables: * - * {{{ + * ``` * $this->set(compact('posts', 'users', 'stuff')); * $this->set('_serialize', array('posts', 'users')); - * }}} + * ``` * * The above would generate a XML object that looks like: * From 18f02bf5b33f5bce78008d3c2d0860cc25b17bf0 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 9 Jan 2015 15:16:14 -0500 Subject: [PATCH 10/12] Don't emit errors or trigger exceptions when headers have been sent. After discussing it a bit, we've come to consensus that emitting errors or throwing exceptions are both pretty disruptive and annoying to deal with. Instead we'll revert to the previous 2.x behavior of doing nothing. --- lib/Cake/Network/CakeResponse.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index e610bf2f7..9902fe632 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -513,17 +513,14 @@ class CakeResponse { /** * Sends a header to the client. * + * Will skip sending headers if headers have already been sent. + * * @param string $name the header name * @param string $value the header value * @return void - * @throws CakeException When headers have already been sent */ protected function _sendHeader($name, $value = null) { if (headers_sent($filename, $linenum)) { - trigger_error( - __d('cake_dev', 'Headers already sent in %s on line %s', $filename, $linenum), - E_USER_NOTICE - ); return; } if ($value === null) { From 03d8c40d99258bc59d1f414fde22e7d17625820c Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 9 Jan 2015 15:32:33 -0500 Subject: [PATCH 11/12] Fix PHPCS error. --- lib/Cake/Test/Case/View/Helper/FormHelperTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 51b2261e2..3f9a765cb 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -1348,7 +1348,7 @@ class FormHelperTest extends CakeTestCase { $this->Form->radio('Test.some', $options, array( 'disabled' => array('option1') )); - $expected = array('Test.test', 'Test.all' => '', 'Test.some'); + $expected = array('Test.test', 'Test.all' => '', 'Test.some'); $this->assertEquals($expected, $this->Form->fields); } From cd58fa0b618da437ba712b102fad66fad22915a3 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 11 Jan 2015 15:20:34 -0500 Subject: [PATCH 12/12] Backport changes from #5635 to 2.x In case the path passed to the File class doesn't exists, this will cause File::$path to be set to a partial path, that is the filename of the passed path with a slash prepended, ex with $file = new File('/non/existent/file'); calling $file->pwd() will return/set /file, possibly causing that file in the root to be accessed. --- lib/Cake/Test/Case/Utility/FileTest.php | 13 +++++++++++++ lib/Cake/Utility/File.php | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Utility/FileTest.php b/lib/Cake/Test/Case/Utility/FileTest.php index 501ff7047..b3e1182ee 100644 --- a/lib/Cake/Test/Case/Utility/FileTest.php +++ b/lib/Cake/Test/Case/Utility/FileTest.php @@ -597,4 +597,17 @@ class FileTest extends CakeTestCase { $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); + } } diff --git a/lib/Cake/Utility/File.php b/lib/Cake/Utility/File.php index ea2f7d705..e1d62c912 100644 --- a/lib/Cake/Utility/File.php +++ b/lib/Cake/Utility/File.php @@ -393,7 +393,10 @@ class File { */ public function pwd() { 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; }