Revision 7645753a
Von Sven Schöling vor mehr als 3 Jahren hinzugefügt
SL/Request.pm | ||
---|---|---|
20 | 20 |
use Rose::Object::MakeMethods::Generic |
21 | 21 |
( |
22 | 22 |
scalar => [ qw(applying_database_upgrades post_data) ], |
23 |
'scalar --get_set_init' => [ qw(cgi layout presenter is_ajax type) ], |
|
23 |
'scalar --get_set_init' => [ qw(cgi layout presenter is_ajax is_mobile type) ],
|
|
24 | 24 |
); |
25 | 25 |
|
26 | 26 |
sub init_cgi { |
... | ... | |
39 | 39 |
return ($ENV{HTTP_X_REQUESTED_WITH} || '') eq 'XMLHttpRequest' ? 1 : 0; |
40 | 40 |
} |
41 | 41 |
|
42 |
sub init_is_mobile { |
|
43 |
# mobile clients will change their user agent when the user requests |
|
44 |
# desktop version so user agent is the most reliable way to identify |
|
45 |
return ($ENV{HTTP_USER_AGENT} || '') =~ /Mobi/ ? 1 : 0; |
|
46 |
} |
|
47 |
|
|
42 | 48 |
sub init_type { |
43 | 49 |
return 'html'; |
44 | 50 |
} |
Auch abrufbar als: Unified diff
Request: is_mobile