mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 15:39:53 +00:00
adding support for passing model name to model task, updated isMobile check in requestHandler
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5377 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
bd673fbaf4
commit
9cd8a79ad9
2 changed files with 14 additions and 1 deletions
|
@ -43,6 +43,15 @@ class ModelTask extends Shell {
|
||||||
if (empty($this->args)) {
|
if (empty($this->args)) {
|
||||||
$this->__interactive();
|
$this->__interactive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!empty($this->args[0])) {
|
||||||
|
$model = $this->args[0];
|
||||||
|
if ($this->__bake($model)) {
|
||||||
|
if ($this->_checkUnitTest()) {
|
||||||
|
$this->__bakeTest($model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Handles interactive baking
|
* Handles interactive baking
|
||||||
|
|
|
@ -256,7 +256,11 @@ class RequestHandlerComponent extends Object {
|
||||||
* @return bool True if user agent is a mobile web browser
|
* @return bool True if user agent is a mobile web browser
|
||||||
*/
|
*/
|
||||||
function isMobile() {
|
function isMobile() {
|
||||||
return (preg_match('/' . REQUEST_MOBILE_UA . '/i', env('HTTP_USER_AGENT')) > 0 || $this->accepts('wap'));
|
preg_match('/' . REQUEST_MOBILE_UA . '/i', env('HTTP_USER_AGENT'), $match);
|
||||||
|
if(!empty($match) || $this->accepts('wap')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns true if the client accepts WAP content
|
* Returns true if the client accepts WAP content
|
||||||
|
|
Loading…
Add table
Reference in a new issue