@@ -31,7 +31,7 @@ |
||
31 | 31 | * |
32 | 32 | * @param string $name The name of the cookie |
33 | 33 | * @param string $value The value of the cookie |
34 | - * @param int|string|\DateTime $expire The time the cookie expires |
|
34 | + * @param integer $expire The time the cookie expires |
|
35 | 35 | * @param string $path The path on the server in which the cookie will be available on |
36 | 36 | * @param string $domain The domain that the cookie is available to |
37 | 37 | * @param bool $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $this->expire = $expire; |
71 | 71 | $this->path = empty($path) ? '/' : $path; |
72 | 72 | $this->secure = (bool) $secure; |
73 | - $this->httpOnly = (bool) $httpOnly; |
|
73 | + $this->httpOnly = (bool) $httpOnly; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @api |
43 | 43 | */ |
44 | - public function __construct($name, $value = null, $expire = 0, $path = '/', $domain = null, $secure = false, $httpOnly = true) |
|
44 | + public function __construct($name, $value = NULL, $expire = 0, $path = '/', $domain = NULL, $secure = FALSE, $httpOnly = TRUE) |
|
45 | 45 | { |
46 | 46 | // from PHP source code |
47 | 47 | if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } elseif (!is_numeric($expire)) { |
60 | 60 | $expire = strtotime($expire); |
61 | 61 | |
62 | - if (false === $expire || -1 === $expire) { |
|
62 | + if (FALSE === $expire || -1 === $expire) { |
|
63 | 63 | throw new Nette\InvalidArgumentException('The cookie expiration time is not valid.'); |
64 | 64 | } |
65 | 65 | } |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | $str .= '; domain='.$this->getDomain(); |
102 | 102 | } |
103 | 103 | |
104 | - if (true === $this->isSecure()) { |
|
104 | + if (TRUE === $this->isSecure()) { |
|
105 | 105 | $str .= '; secure'; |
106 | 106 | } |
107 | 107 | |
108 | - if (true === $this->isHttpOnly()) { |
|
108 | + if (TRUE === $this->isHttpOnly()) { |
|
109 | 109 | $str .= '; httponly'; |
110 | 110 | } |
111 | 111 |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | // Create magic method name |
171 | - $magicMethodName = 'is' . ucfirst(strtolower((string) $arguments["device"])); |
|
171 | + $magicMethodName = 'is'.ucfirst(strtolower((string) $arguments["device"])); |
|
172 | 172 | |
173 | - return $writer->write('if ($template->getMobileDetectService()->'. $magicMethodName.'()) {'); |
|
173 | + return $writer->write('if ($template->getMobileDetectService()->'.$magicMethodName.'()) {'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | // Create magic method name |
193 | - $magicMethodName = 'is' . ucfirst(strtolower((string) $arguments["os"])); |
|
193 | + $magicMethodName = 'is'.ucfirst(strtolower((string) $arguments["os"])); |
|
194 | 194 | |
195 | - return $writer->write('if ($template->getMobileDetectService()->'. $magicMethodName.'()) {'); |
|
195 | + return $writer->write('if ($template->getMobileDetectService()->'.$magicMethodName.'()) {'); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public static function prepareMacroArguments($macro) |
269 | 269 | { |
270 | - $arguments = array_map(function ($value) { |
|
270 | + $arguments = array_map(function($value) { |
|
271 | 271 | return trim($value); |
272 | 272 | }, explode(",", $macro)); |
273 | 273 | |
274 | - $device = $os = $arguments[0]; |
|
274 | + $device = $os = $arguments[0]; |
|
275 | 275 | |
276 | 276 | return array( |
277 | 277 | "device" => $device, |
@@ -36,7 +36,7 @@ |
||
36 | 36 | */ |
37 | 37 | public function injectMobileDetector(MobileDetect $mobileDetect, Helpers\DeviceView $deviceView) |
38 | 38 | { |
39 | - $this->mobileDetect = $mobileDetect; |
|
40 | - $this->deviceView = $deviceView; |
|
39 | + $this->mobileDetect = $mobileDetect; |
|
40 | + $this->deviceView = $deviceView; |
|
41 | 41 | } |
42 | 42 | } |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | |
21 | 21 | class DeviceView extends Nette\Object |
22 | 22 | { |
23 | - const COOKIE_KEY = 'device_view'; |
|
23 | + const COOKIE_KEY = 'device_view'; |
|
24 | 24 | |
25 | - const SWITCH_PARAM = 'device_view'; |
|
25 | + const SWITCH_PARAM = 'device_view'; |
|
26 | 26 | |
27 | 27 | const VIEW_MOBILE = 'mobile'; |
28 | 28 | const VIEW_PHONE = 'phone'; |
29 | 29 | const VIEW_TABLET = 'tablet'; |
30 | 30 | const VIEW_FULL = 'full'; |
31 | - const VIEW_NOT_MOBILE = 'not_mobile'; |
|
31 | + const VIEW_NOT_MOBILE = 'not_mobile'; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @var Http\IRequest |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function __construct(Http\IRequest $httpRequest, Http\IResponse $httpResponse) |
53 | 53 | { |
54 | - $this->httpRequest = $httpRequest; |
|
55 | - $this->httpResponse = $httpResponse; |
|
54 | + $this->httpRequest = $httpRequest; |
|
55 | + $this->httpResponse = $httpResponse; |
|
56 | 56 | |
57 | 57 | if ($this->httpRequest->getQuery(self::SWITCH_PARAM)) { |
58 | 58 | $this->viewType = $this->httpRequest->getQuery(self::SWITCH_PARAM); |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | 'isEnabled' => FALSE, |
32 | 32 | 'host' => NULL, |
33 | 33 | 'statusCode' => 301, |
34 | - 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
34 | + 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
35 | 35 | ), |
36 | 36 | 'tablet' => array( |
37 | 37 | 'isEnabled' => FALSE, |
38 | 38 | 'host' => NULL, |
39 | 39 | 'statusCode' => 301, |
40 | - 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
40 | + 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
41 | 41 | ), |
42 | 42 | 'detectTabletAsMobile' => FALSE, |
43 | 43 | ), |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | // Register template helpers |
70 | 70 | $builder->addDefinition($this->prefix('helpers')) |
71 | 71 | ->setClass('IPub\MobileDetect\Templating\Helpers') |
72 | - ->setFactory($this->prefix('@mobileDetect') . '::createTemplateHelpers') |
|
72 | + ->setFactory($this->prefix('@mobileDetect').'::createTemplateHelpers') |
|
73 | 73 | ->setInject(FALSE); |
74 | 74 | |
75 | 75 | $application = $builder->getDefinition('application'); |
76 | - $application->addSetup('$service->onRequest[] = ?', array('@' . $this->prefix('onRequestHandler'))); |
|
77 | - $application->addSetup('$service->onResponse[] = ?', array('@' . $this->prefix('onResponseHandler'))); |
|
76 | + $application->addSetup('$service->onRequest[] = ?', array('@'.$this->prefix('onRequestHandler'))); |
|
77 | + $application->addSetup('$service->onResponse[] = ?', array('@'.$this->prefix('onResponseHandler'))); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | public function beforeCompile() |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public static function register(Nette\Configurator $config, $extensionName = 'mobileDetect') |
100 | 100 | { |
101 | - $config->onCompile[] = function (Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) { |
|
101 | + $config->onCompile[] = function(Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) { |
|
102 | 102 | $compiler->addExtension($extensionName, new MobileDetectExtension()); |
103 | 103 | }; |
104 | 104 | } |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | |
25 | 25 | class OnRequestHandler |
26 | 26 | { |
27 | - const REDIRECT = 'redirect'; |
|
28 | - const NO_REDIRECT = 'noRedirect'; |
|
29 | - const REDIRECT_WITHOUT_PATH = 'redirectWithoutPath'; |
|
27 | + const REDIRECT = 'redirect'; |
|
28 | + const NO_REDIRECT = 'noRedirect'; |
|
29 | + const REDIRECT_WITHOUT_PATH = 'redirectWithoutPath'; |
|
30 | 30 | |
31 | 31 | const MOBILE = 'mobile'; |
32 | 32 | const TABLET = 'tablet'; |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | MobileDetect $mobileDetect, |
88 | 88 | DeviceView $deviceView |
89 | 89 | ) { |
90 | - $this->httpRequest = $httpRequest; |
|
91 | - $this->httpResponse = $httpResponse; |
|
90 | + $this->httpRequest = $httpRequest; |
|
91 | + $this->httpResponse = $httpResponse; |
|
92 | 92 | |
93 | 93 | $this->router = $router; |
94 | 94 | |
95 | 95 | $this->onResponseHandler = $onResponseHandler; |
96 | 96 | |
97 | - $this->mobileDetect = $mobileDetect; |
|
98 | - $this->deviceView = $deviceView; |
|
97 | + $this->mobileDetect = $mobileDetect; |
|
98 | + $this->deviceView = $deviceView; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $url->setQueryParameter(DeviceView::SWITCH_PARAM, NULL); |
324 | 324 | |
325 | 325 | // Create full path url |
326 | - $redirectUrl = $this->getCurrentHost() . $url->getRelativeUrl(); |
|
326 | + $redirectUrl = $this->getCurrentHost().$url->getRelativeUrl(); |
|
327 | 327 | |
328 | 328 | // Generate only domain path |
329 | 329 | } else { |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | switch ($routingOption) |
377 | 377 | { |
378 | 378 | case self::REDIRECT: |
379 | - return rtrim($this->redirectConf[$platform]['host'], '/') .'/'. ltrim($this->httpRequest->getUrl()->getRelativeUrl(), '/'); |
|
379 | + return rtrim($this->redirectConf[$platform]['host'], '/').'/'.ltrim($this->httpRequest->getUrl()->getRelativeUrl(), '/'); |
|
380 | 380 | |
381 | 381 | case self::REDIRECT_WITHOUT_PATH: |
382 | 382 | return $this->redirectConf[$platform]['host']; |
@@ -421,6 +421,6 @@ discard block |
||
421 | 421 | */ |
422 | 422 | protected function getCurrentHost() |
423 | 423 | { |
424 | - return $this->httpRequest->getUrl()->getHostUrl() . $this->httpRequest->getUrl()->getScriptPath(); |
|
424 | + return $this->httpRequest->getUrl()->getHostUrl().$this->httpRequest->getUrl()->getScriptPath(); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | \ No newline at end of file |
@@ -411,7 +411,7 @@ |
||
411 | 411 | return $option; |
412 | 412 | } |
413 | 413 | |
414 | - return null; |
|
414 | + return NULL; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -39,13 +39,13 @@ |
||
39 | 39 | MobileDetect\MobileDetect $mobileDetect, |
40 | 40 | MobileDetect\Helpers\DeviceView $deviceView |
41 | 41 | ) { |
42 | - $this->mobileDetect = $mobileDetect; |
|
43 | - $this->deviceView = $deviceView; |
|
42 | + $this->mobileDetect = $mobileDetect; |
|
43 | + $this->deviceView = $deviceView; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function loader($method) |
47 | 47 | { |
48 | - if ( method_exists($this, $method) ) { |
|
48 | + if (method_exists($this, $method)) { |
|
49 | 49 | return callback($this, $method); |
50 | 50 | } |
51 | 51 | } |