mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Merge branch '2.0' into 2.1
Conflicts: lib/Cake/Network/CakeRequest.php
This commit is contained in:
commit
83987bee17
5 changed files with 29 additions and 5 deletions
|
@ -211,7 +211,7 @@ class App {
|
|||
*
|
||||
* @param string $type type of path
|
||||
* @param string $plugin name of plugin
|
||||
* @return string array
|
||||
* @return array
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#App::path
|
||||
*/
|
||||
public static function path($type, $plugin = null) {
|
||||
|
@ -386,7 +386,7 @@ class App {
|
|||
* `App::core('Cache/Engine'); will return the full path to the cache engines package`
|
||||
*
|
||||
* @param string $type
|
||||
* @return string full path to package
|
||||
* @return array full path to package
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#App::core
|
||||
*/
|
||||
public static function core($type) {
|
||||
|
@ -598,7 +598,7 @@ class App {
|
|||
* based on Inflector::underscore($name) . ".$ext";
|
||||
* @param array $search paths to search for files, array('path 1', 'path 2', 'path 3');
|
||||
* @param string $file full name of the file to search for including extension
|
||||
* @param boolean $return, return the loaded file, the file must have a return
|
||||
* @param boolean $return Return the loaded file, the file must have a return
|
||||
* statement in it to work: return $variable;
|
||||
* @return boolean true if Class is already in memory or if file is found and loaded, false if not
|
||||
*/
|
||||
|
|
|
@ -369,7 +369,10 @@ class TranslateBehavior extends ModelBehavior {
|
|||
|
||||
/**
|
||||
* Bind translation for fields, optionally with hasMany association for
|
||||
* fake field
|
||||
* fake field.
|
||||
*
|
||||
* *Note* You should avoid binding translations that overlap existing model properties.
|
||||
* This can cause un-expected and un-desirable behavior.
|
||||
*
|
||||
* @param Model $model instance of model
|
||||
* @param string|array $fields string with field or array(field1, field2=>AssocName, field3)
|
||||
|
@ -392,6 +395,11 @@ class TranslateBehavior extends ModelBehavior {
|
|||
$field = $key;
|
||||
$association = $value;
|
||||
}
|
||||
if ($association === 'name') {
|
||||
throw new CakeException(
|
||||
__d('cake_dev', 'You cannot bind a translation named "name".')
|
||||
);
|
||||
}
|
||||
|
||||
if (array_key_exists($field, $this->settings[$model->alias])) {
|
||||
unset($this->settings[$model->alias][$field]);
|
||||
|
|
|
@ -107,7 +107,7 @@ class CakeRequest implements ArrayAccess {
|
|||
'Android', 'AvantGo', 'BlackBerry', 'DoCoMo', 'Fennec', 'iPod', 'iPhone',
|
||||
'J2ME', 'MIDP', 'NetFront', 'Nokia', 'Opera Mini', 'Opera Mobi', 'PalmOS', 'PalmSource',
|
||||
'portalmmm', 'Plucker', 'ReqwirelessWeb', 'SonyEricsson', 'Symbian', 'UP\\.Browser',
|
||||
'webOS', 'Windows CE', 'Xiino'
|
||||
'webOS', 'Windows CE', 'Windows Phone OS', t'Xiino'
|
||||
)),
|
||||
'requested' => array('param' => 'requested', 'value' => 1)
|
||||
);
|
||||
|
|
|
@ -868,4 +868,16 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that an exception is raised when you try to over-write the name attribute.
|
||||
*
|
||||
* @expectedException CakeException
|
||||
* @return void
|
||||
*/
|
||||
public function testExceptionOnNameTranslation() {
|
||||
$this->loadFixtures('Translate', 'TranslatedItem');
|
||||
$TestModel = new TranslatedItem();
|
||||
$TestModel->bindTranslation(array('name' => 'name'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -636,6 +636,10 @@ class CakeRequestTest extends CakeTestCase {
|
|||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 5.1; rv:2.0b6pre) Gecko/20100902 Firefox/4.0b6pre Fennec/2.0b1pre';
|
||||
$this->assertTrue($request->is('mobile'));
|
||||
$this->assertTrue($request->isMobile());
|
||||
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; SAMSUNG; OMNIA7)';
|
||||
$this->assertTrue($request->is('mobile'));
|
||||
$this->assertTrue($request->isMobile());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue