Permalink
Browse files

Merge pull request #429 from cakephp/no-php

Remove the need for <?php everywhere
  • Loading branch information...
lorenzo committed Nov 21, 2012
2 parents 4ce5264 + 55608d1 commit 8340dc0f397f0552430851647829735b61b8bcb8
Showing with 499 additions and 1,512 deletions.
  1. +7 −1 config/all.py
  2. +0 −26 en/appendices/2-0-migration-guide.rst
  3. +0 −2 en/appendices/2-1-migration-guide.rst
  4. +0 −3 en/appendices/2-2-migration-guide.rst
  5. +1 −1 en/appendices/cakephp-development-process.rst
  6. +0 −2 en/appendices/glossary.rst
  7. +5 −26 en/appendices/migrating-from-cakephp-1-2-to-1-3.rst
  8. +15 −60 en/appendices/new-features-in-cakephp-1-3.rst
  9. +6 −24 en/appendices/new-features-in-cakephp-2-0.rst
  10. +5 −12 en/appendices/new-features-in-cakephp-2-1.rst
  11. +1 −2 en/appendices/phpunit-migration-hints.rst
  12. +1 −1 en/cakephp-overview.rst
  13. +1 −1 en/cakephp-overview/understanding-model-view-controller.rst
  14. +1 −1 en/cakephp-overview/where-to-get-help.rst
  15. +0 −30 en/console-and-shells.rst
  16. +1 −1 en/console-and-shells/acl-shell.rst
  17. +1 −1 en/console-and-shells/code-generation-with-bake.rst
  18. +0 −2 en/console-and-shells/schema-management-and-migrations.rst
  19. +1 −1 en/console-and-shells/testsuite-shell.rst
  20. +1 −1 en/contributing.rst
  21. +0 −18 en/contributing/cakephp-coding-conventions.rst
  22. +1 −1 en/contributing/tickets.rst
  23. +0 −30 en/controllers.rst
  24. +0 −10 en/controllers/components.rst
  25. +1 −1 en/controllers/pages-controller.rst
  26. +3 −32 en/controllers/request-response.rst
  27. +1 −6 en/controllers/scaffolding.rst
  28. +1 −10 en/core-libraries/behaviors/acl.rst
  29. +1 −15 en/core-libraries/behaviors/containable.rst
  30. +0 −11 en/core-libraries/behaviors/translate.rst
  31. +0 −19 en/core-libraries/behaviors/tree.rst
  32. +0 −9 en/core-libraries/caching.rst
  33. +0 −12 en/core-libraries/collections.rst
  34. +0 −9 en/core-libraries/components/access-control-lists.rst
  35. +0 −25 en/core-libraries/components/authentication.rst
  36. +0 −8 en/core-libraries/components/cookie.rst
  37. +1 −1 en/core-libraries/components/email.rst
  38. +0 −20 en/core-libraries/components/pagination.rst
  39. +0 −7 en/core-libraries/components/request-handling.rst
  40. +1 −8 en/core-libraries/components/security-component.rst
  41. +1 −14 en/core-libraries/components/sessions.rst
  42. +0 −14 en/core-libraries/events.rst
  43. +1 −2 en/core-libraries/global-constants-and-functions.rst
  44. +4 −6 en/core-libraries/helpers/cache.rst
  45. +162 −142 en/core-libraries/helpers/form.rst
  46. +128 −81 en/core-libraries/helpers/html.rst
  47. +14 −37 en/core-libraries/helpers/js.rst
  48. +1 −1 en/core-libraries/helpers/number.rst
  49. +51 −44 en/core-libraries/helpers/paginator.rst
  50. +0 −7 en/core-libraries/helpers/rss.rst
  51. +6 −7 en/core-libraries/helpers/session.rst
  52. +0 −1 en/core-libraries/helpers/text.rst
  53. +1 −2 en/core-libraries/helpers/time.rst
  54. +0 −9 en/core-libraries/internationalization-and-localization.rst
  55. +0 −13 en/core-libraries/logging.rst
  56. +1 −1 en/core-libraries/toc-behaviors.rst
  57. +1 −1 en/core-libraries/toc-components.rst
  58. +1 −1 en/core-libraries/toc-general-purpose.rst
  59. +1 −1 en/core-libraries/toc-helpers.rst
  60. +1 −1 en/core-libraries/toc-utilities.rst
  61. +0 −18 en/core-utility-libraries/app.rst
  62. +0 −20 en/core-utility-libraries/email.rst
  63. +0 −21 en/core-utility-libraries/hash.rst
  64. +0 −13 en/core-utility-libraries/httpsocket.rst
  65. +1 −1 en/core-utility-libraries/inflector.rst
  66. +0 −13 en/core-utility-libraries/number.rst
  67. +1 −1 en/core-utility-libraries/router.rst
  68. +0 −4 en/core-utility-libraries/sanitize.rst
  69. +0 −6 en/core-utility-libraries/security.rst
  70. +0 −27 en/core-utility-libraries/set.rst
  71. +1 −12 en/core-utility-libraries/string.rst
  72. +0 −14 en/core-utility-libraries/time.rst
  73. +1 −19 en/core-utility-libraries/xml.rst
  74. +1 −1 en/deployment.rst
  75. +0 −19 en/development/configuration.rst
  76. +0 −5 en/development/debugging.rst
  77. +0 −8 en/development/dispatch-filters.rst
  78. +0 −4 en/development/errors.rst
  79. +0 −12 en/development/exceptions.rst
  80. +0 −5 en/development/rest.rst
  81. +0 −47 en/development/routing.rst
  82. +0 −13 en/development/sessions.rst
  83. +0 −39 en/development/testing.rst
  84. +1 −1 en/development/vendor-packages.rst
  85. +0 −1 en/getting-started/cakephp-conventions.rst
  86. +1 −1 en/getting-started/cakephp-folder-structure.rst
  87. +1 −1 en/getting-started/cakephp-structure.rst
  88. +0 −1 en/installation.rst
  89. +0 −1 en/installation/advanced-installation.rst
  90. +0 −3 en/models.rst
  91. +1 −5 en/models/additional-methods-and-properties.rst
  92. +0 −26 en/models/associations-linking-models-together.rst
  93. +0 −17 en/models/behaviors.rst
  94. +1 −6 en/models/callback-methods.rst
  95. +0 −61 en/models/data-validation.rst
  96. +1 −7 en/models/data-validation/validating-data-from-the-controller.rst
  97. +1 −9 en/models/datasources.rst
  98. +1 −3 en/models/deleting-data.rst
  99. +0 −10 en/models/model-attributes.rst
  100. +1 −35 en/models/retrieving-your-data.rst
  101. +0 −29 en/models/saving-your-data.rst
  102. +0 −3 en/models/transactions.rst
  103. +0 −12 en/models/virtual-fields.rst
  104. +1 −16 en/plugins.rst
  105. +1 −1 en/tutorials-and-examples.rst
  106. +0 −11 en/tutorials-and-examples/blog-auth-example/auth.rst
  107. +0 −3 en/tutorials-and-examples/blog/blog.rst
  108. +24 −18 en/tutorials-and-examples/blog/part-two.rst
  109. +1 −9 en/tutorials-and-examples/simple-acl-controlled-application/part-two.rst
  110. +0 −10 en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.rst
  111. +27 −34 en/views.rst
  112. +0 −13 en/views/helpers.rst
  113. +0 −3 en/views/json-and-xml-views.rst
  114. +0 −2 en/views/media-view.rst
  115. +0 −3 en/views/themes.rst
View
@@ -71,7 +71,7 @@
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
-highlight_language = 'php'
+highlight_language = 'phpinline'
# -- Options for HTML output ---------------------------------------------------
@@ -281,3 +281,9 @@
# Languages available.
languages = ['en', 'pt', 'es', 'ja', 'ru', 'fr']
+
+# Hack to render the php source code without the <?php tag
+from sphinx.highlighting import lexers
+from pygments.lexers.web import PhpLexer
+
+lexers['phpinline'] = PhpLexer(startinline=True)
@@ -111,7 +111,6 @@ Internationalization / Localization
If you want to echo the result of the translation, use::
- <?php
echo __('My Message');
This change includes all shortcut translation methods::
@@ -128,7 +127,6 @@ Alongside this, if you pass additional parameters, the translation will call
`sprintf <http://php.net/manual/en/function.sprintf.php>`_ with these
parameters before returning. For example::
- <?php
// Will return something like "Called: MyClass:myMethod"
echo __('Called: %s:%s', $className, $methodName);
@@ -215,7 +213,6 @@ Components
Component is now the required base class for all components. You should update
your components and their constructors, as both have changed::
- <?php
class PrgComponent extends Component {
function __construct(ComponentCollection $collection, $settings = array()) {
parent::__construct($collection, $settings);
@@ -245,7 +242,6 @@ All the deprecated callbacks in Component have not been transferred to
ComponentCollection. Instead you should use the `trigger()` method to interact
with callbacks. If you need to trigger a callback you could do so by calling::
- <?php
$this->Components->trigger('someCallback', array(&$this));
Changes in disabling components
@@ -429,7 +425,6 @@ Although there has been a huge refactoring in how the classes are loaded, in ver
few occasions you will need to change your application code to respect the way you were
used to doing it. The biggest change is the introduction of a new method::
- <?php
App::uses('AuthComponent', 'Controller/Component');
We decided the function name should emulate PHP 5.3's ``use`` keyword, just as a way
@@ -443,7 +438,6 @@ is used for the first time it will be located.
Some examples on using :php:meth:`App::uses()` when migrating from
:php:meth:`App::import()`::
- <?php
App::import('Controller', 'Pages');
// becomes
App::uses('PagesController', 'Controller');
@@ -468,7 +462,6 @@ All classes that were loaded in the past using ``App::import('Core', $class);``
will need to be loaded using ``App::uses()`` referring to the correct package.
See the api to locate the classes in their new folders. Some examples::
- <?php
App::import('Core', 'CakeRoute');
// becomes
App::uses('CakeRoute', 'Routing/Route');
@@ -494,7 +487,6 @@ App::build() and core paths
Examples::
- <?php
App::build(array('controllers' => array('/full/path/to/controllers')));
//becomes
App::build(array('Controller' => array('/full/path/to/Controller')));
@@ -526,7 +518,6 @@ Cache
::
- <?php
Cache::config('something');
Cache::write('key', $value);
@@ -557,14 +548,12 @@ Router
``index`` action is given a short route. If you wish to continue using short
routes, you can add a route like::
- <?php
Router::connect('/users/:action', array('controller' => 'users', 'plugin' => 'users'));
To your routes file for each plugin you need short routes on.
Your app/Config/routes.php file needs to be updated adding this line at the bottom of the file::
- <?php
require CAKE . 'Config' . DS . 'routes.php';
This is needed in order to generate the default routes for your application. If you do not wish to have such routes,
@@ -663,7 +652,6 @@ In order to accommodate View being removed from the ClassRegistry, the signature
of Helper::__construct() was changed. You should update any subclasses to use
the following::
- <?php
function __construct(View $View, $settings = array())
When overriding the constructor you should always call `parent::__construct` as
@@ -803,13 +791,11 @@ this, just change ``$_minimizedAttributeFormat`` in your AppHelper to ``%s``.
To use with Html/Form helpers and others, you can write::
- <?php
$this->Form->checkbox('field', array('checked' => true, 'value' => 'some_value'));
Other facility is that minimized attributes can be passed as item and not as
key. For example::
- <?php
$this->Form->checkbox('field', array('checked', 'value' => 'some_value'));
Note that ``checked`` have a numeric key.
@@ -938,7 +924,6 @@ afterRender it is the view file being rendered. For beforeLayout and afterLayout
it is the layout file being rendered. Your helpers function signatures should
look like::
- <?php
function beforeRender($viewFile) {
}
@@ -1030,20 +1015,17 @@ Models
Model relationships are now lazy loaded. You can run into a situation where
assigning a value to a nonexistent model property will throw errors::
- <?php
$Post->inexistentProperty[] = 'value';
will throw the error "Notice: Indirect modification of overloaded property
$inexistentProperty has no effect". Assigning an initial value to the property
solves the issue::
- <?php
$Post->nonexistentProperty = array();
$Post->nonexistentProperty[] = 'value';
Or just declare the property in the model class::
- <?php
class Post {
public $nonexistentProperty = array();
}
@@ -1087,12 +1069,10 @@ List of Changes
* API for DboSource::execute has changed, it will now take an array of query
values as second parameter::
- <?php
public function execute($sql, $params = array(), $options = array())
became::
- <?php
public function execute($sql, $options = array(), $params = array())
third parameter is meant to receive options for logging, currently it only
@@ -1102,7 +1082,6 @@ List of Changes
* DboSource::fetchAll() now accepts an array as second parameter, to pass values
to be bound to the query, third parameter was dropped. Example::
- <?php
$db->fetchAll('SELECT * from users where username = ? AND password = ?', array('jhon', '12345'));
$db->fetchAll('SELECT * from users where username = :username AND password = :password', array('username' => 'jhon', 'password' => '12345'));
@@ -1145,15 +1124,13 @@ AclBehavior and TreeBehavior
- No longer supports strings as configuration. Example::
- <?php
public $actsAs = array(
'Acl' => 'Controlled',
'Tree' => 'nested'
);
became::
- <?php
public $actsAs = array(
'Acl' => array('type' => 'Controlled'),
'Tree' => array('type' => 'nested')
@@ -1167,14 +1144,12 @@ Plugins no longer magically append their plugin prefix to components, helpers
and models used within them. You must be explicit with the components, models,
and helpers you wish to use. In the past::
- <?php
public $components = array('Session', 'Comments');
Would look in the controller's plugin before checking app/core components. It
will now only look in the app/core components. If you wish to use objects from a
plugin you must put the plugin name::
- <?php
public $components = array('Session', 'Comment.Comments');
This was done to reduce hard to debug issues caused by magic misfiring. It also
@@ -1272,7 +1247,6 @@ the key "driver" is not accepted anymore, only "datasource", in order to make it
more consistent. Also, as the datasources have been moved to packages you will
need to pass the package they are located in. Example::
- <?php
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
@@ -12,7 +12,6 @@ removed from the CakePHP core. If you do not already have these classes, you
can use the following while upgrading::
// app/View/Helper/AppHelper.php
- <?php
App::uses('Helper', 'View');
class AppHelper extends Helper {
}
@@ -262,7 +261,6 @@ View
instead.
- ``$scripts_for_layout`` is deprecated. Use the following instead::
- <?php
echo $this->fetch('meta');
echo $this->fetch('css');
echo $this->fetch('script');
@@ -13,7 +13,6 @@ When upgrading to CakePHP 2.2 its important to add a few new configuration
values to ``app/Config/bootstrap.php``. Adding these will ensure consistent
behavior with 2.1.x::
- <?php
// Enable the Dispatcher filters for plugin assets, and
// CacheHelper.
Configure::write('Dispatcher.filters', array(
@@ -36,7 +35,6 @@ behavior with 2.1.x::
You will also need to modify ``app/Config/core.php``. Change the value of
:php:const:`LOG_ERROR` to :php:const:`LOG_ERR`::
- <?php
define('LOG_ERROR', LOG_ERR);
When using ``Model::validateAssociated()`` or ``Model::saveAssociated()`` and
@@ -274,7 +272,6 @@ It is now possible to tag or label cache keys under groups. This makes it
simpler to mass-delete cache entries associated to the same label. Groups are
declared at configuration time when creating the cache engine::
- <?php
Cache::config(array(
'engine' => 'Redis',
...
@@ -53,4 +53,4 @@ on irc.freenode.net.
.. meta::
:title lang=en: CakePHP Development Process
- :keywords lang=en: maintenance branch,community interaction,community feature,necessary feature,stable release,ticket system,advanced feature,power users,feature set,chat irc,leading edge,router,new features,members,attempt,development branches,branch development
+ :keywords lang=en: maintenance branch,community interaction,community feature,necessary feature,stable release,ticket system,advanced feature,power users,feature set,chat irc,leading edge,router,new features,members,attempt,development branches,branch development
@@ -12,7 +12,6 @@ Glossary
html attributes
An array of key => values that are composed into html attributes. For example::
- <?php
// Given
array('class' => 'my-class', '_target' => 'blank')
@@ -22,7 +21,6 @@ Glossary
If an option can be minimized or accepts it's name as the value, then ``true``
can be used::
- <?php
// Given
array('checked' => true)
@@ -46,7 +46,6 @@ There is a new way to add those paths. As of 1.3 RC1 the
::
- <?php
App::build(array(
'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
'models' => array('/full/path/to/models/', '/next/full/path/to/models/'),
@@ -74,11 +73,8 @@ configs are created **before** bootstrap.php is loaded.
``inflections.php`` has been removed, it was an unnecessary file
hit, and the related features have been refactored into a method to
increase their flexibility. You now use ``Inflector::rules()`` to
-load custom inflections.
+load custom inflections::
-::
-
- <?php
Inflector::rules('singular', array(
'rules' => array('/^(bil)er$/i' => '\1', '/^(inflec|contribu)tors$/i' => '\1ta'),
'uninflected' => array('singulars'),
@@ -223,11 +219,8 @@ automatically included without you asking for them. SessionHelper
and SessionComponent now act like every other component and must be
declared like any other helper/component. You should update
``AppController::$components`` and ``AppController::$helpers`` to
-include these classes to retain existing behavior.
-
-::
+include these classes to retain existing behavior::
- <?php
var $components = array('Session', 'Auth', ...);
var $helpers = array('Session', 'Html', 'Form' ...);
@@ -281,11 +274,8 @@ behavior with other prefix style routes in that it was treated
differently. Instead you should use ``Routing.prefixes``. Prefix
routes in 1.3 do not require additional routes to be declared
manually. All prefix routes will be generated automatically. To
-update simply change your core.php.
-
-::
+update simply change your core.php::
- <?php
//from:
Configure::write('Routing.admin', 'admin');
@@ -295,11 +285,8 @@ update simply change your core.php.
See the New features guide for more information on using prefix
routes. A small change has also been done to routing params. Routed
params should now only consist of alphanumeric chars, - and \_ or
-``/[A-Z0-9-_+]+/``.
+``/[A-Z0-9-_+]+/``::
-::
-
- <?php
Router::connect('/:$%@#param/:action/*', array(...)); // BAD
Router::connect('/:can/:anybody/:see/:m-3/*', array(...)); //Acceptable
@@ -308,11 +295,8 @@ increase performance and reduce code clutter. The side effect of
this is two seldom used features were removed, as they were
problematic and buggy even with the existing code base. First path
segments using full regular expressions was removed. You can no
-longer create routes like
-
-::
+longer create routes like::
- <?php
Router::connect('/([0-9]+)-p-(.*)/', array('controller' => 'products', 'action' => 'show'));
These routes complicated route compilation and impossible to
@@ -321,9 +305,6 @@ you use route parameters with capture patterns. Next mid-route
greedy star support has been removed. It was previously possible to
use a greedy star in the middle of a route.
-::
-
- <?php
Router::connect(
'/pages/*/:event',
array('controller' => 'pages', 'action' => 'display'),
@@ -343,7 +324,6 @@ $this->redirect() calls to reflect this change.
::
- <?php
// old format:
$url = array('controller' => 'posts', 'action' => 'view', 'id' => $id);
// use cases:
@@ -500,7 +480,6 @@ automatically outputs SQL logs. If you want to output SQL logs in
::
- <?php
echo $this->element('sql_dump');
You can place this element anywhere in your layout or view. The
Oops, something went wrong.

0 comments on commit 8340dc0

Please sign in to comment.