Library classes
Inflector
You can now globally customize the default transliteration map used in Inflector::slug using Inflector::rules.
eg. Inflector::rules('transliteration', array('/å/' => 'aa', '/ø/' => 'oe'))
The Inflector now also internally caches all data passed to it for inflection (except slug method).
Set
Set has a new method Set::apply(), which allows you
to apply callbacks to the
results of Set::extract and do so in either a map or
reduce fashion.
Set::apply('/Movie/rating', $data, 'array_sum');
Set::apply('/Movie/rating', $data, 'array_sum');
Would return the sum of all Movie ratings in
$data.
L10N
All languages in the catalog now have a direction key. This can be used to determine/define the text direction of the locale being used.
File
- File now has a copy() method. It copies the file represented by the file instance, to a new location.
Configure
Configure::load()can now load configuration files from plugins. UseConfigure::load('plugin.file');to load configuration files from plugins. Any configuration files in your application that use.in the name should be updated to used_
App/libs
In addition to app/vendors a new
app/libs directory has been added. This directory can
also be part of plugins, located at $plugin/libs. Libs
directories are intended to contain 1st party libraries that do not
come from 3rd parties or external vendors. This allows you to
separate your organization's internal libraries from vendor
libraries. App::import() has also been updated to
import from libs directories.
App::import('Lib', 'ImageManipulation'); //imports app/libs/image_manipulation.php
App::import('Lib', 'ImageManipulation'); //imports app/libs/image_manipulation.php
You can also import libs files from plugins
App::import('Lib', 'Geocoding.Geocode'); //imports app/plugins/geocoding/libs/geocode.php
App::import('Lib', 'Geocoding.Geocode'); //imports app/plugins/geocoding/libs/geocode.php
The remainder of lib importing syntax is identical to vendor files. So if you know how to import vendor files with unique names, you know how to import libs files with unique names.
Configuration
- The default
Security.levelin 1.3 is medium instead of high - There is a new configuration value
Security.cipherSeedthis value should be customized to ensure more secure encrypted cookies, and a warning will be generated in development mode when the value matches its default value.
i18n
Now you can use locale definition files for the LC_TIME category to retrieve date and time preferences for a specific language. Just use any POSIX compliant locale definition file and store it at app/locale/language/ (do not create a folder for the category LC_TIME, just put the file in there).
For example, if you have access to a machine running debian or ubuntu you can find a french locale file at: /usr/share/i18n/locales/fr_FR. Copy the part corresponding to LC_TIME into app/locale/fr_fr/LC_TIME file. You can then access the time preferences for French language this way:
Configure::write('Config.language','fr-fr'); // set the current language
$monthNames = __c('mon',LC_TIME,true); // returns an array with the month names in French
$dateFormat = __c('d_fmt',LC_TIME,true); // return the preferred dates format for France
Configure::write('Config.language','fr-fr'); // set the current language$monthNames = __c('mon',LC_TIME,true); // returns an array with the month names in French$dateFormat = __c('d_fmt',LC_TIME,true); // return the preferred dates format for France
You can read a complete guide of possible values in LC_TIME definition file in this page


























