NAVIGATION
This shows you the differences between two versions of the page.
|
deutsch:andere-erweiterungen:tools:user-agent [2012/11/08 12:17] Knut Heermann (flip-flop) |
deutsch:andere-erweiterungen:tools:user-agent [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 106: | Line 106: | ||
| === Tablets: === | === Tablets: === | ||
| - | **Seit der Version 1.5 (R452) wird "mobile" bei der Verwendung von Tablets nicht mehr ausgegeben.** | + | **Seit der Version 1.5 (R452) wird tablet nicht mehr als "mobile" ausgegeben.** |
| {{ :deutsch:andere-erweiterungen:tools:uag_android-tablet_1.gif|}} | {{ :deutsch:andere-erweiterungen:tools:uag_android-tablet_1.gif|}} | ||
| Line 302: | Line 302: | ||
| \\ | \\ | ||
| - | ===== Extrahieren der OS Version von iOS ===== | + | \\ |
| + | |||
| + | ====== Extrahieren der OS Version von iOS ====== | ||
| + | |||
| + | ==== Version 1.0 ==== | ||
| Verwendung innerhalb des CMS z.B.: | Verwendung innerhalb des CMS z.B.: | ||
| Line 352: | Line 357: | ||
| \\ | \\ | ||
| An die Ausgabe der Plattform wird einfach die iOS-Version angehängt, bei einem Smartphone oder Tablet unter iOS 5 wird z.B. aus **iOS** -> **iOS_V5**. | An die Ausgabe der Plattform wird einfach die iOS-Version angehängt, bei einem Smartphone oder Tablet unter iOS 5 wird z.B. aus **iOS** -> **iOS_V5**. | ||
| + | |||
| + | Bitte prüfen beim iPod und älteren iOS-Versionen. | ||
| + | |||
| + | \\ | ||
| + | |||
| + | ==== Version 1.1 ==== | ||
| + | |||
| + | Es wird gegen iOS-Versionen größer 5 geprüft. | ||
| + | |||
| + | Verwendung innerhalb des CMS z.B.: | ||
| + | |||
| + | <!--if:platform:iOS-->iOS Version x - 5<!--/if--> | ||
| + | <!--if:platform:iOS_V6-->iOS Version6<!--/if--> | ||
| + | |||
| + | \\ | ||
| + | **Einfaches Script:** abgeleitet von -> [[http://stackoverflow.com/questions/7768324/detect-ios-version-with-php|Detect iOS version with PHP]] | ||
| + | |||
| + | **Datei:** template/inc_script/**frontend_init**/rt_iOS_OS_user_agent.php | ||
| + | |||
| + | <code php |h rt_iOS_OS_user_agent.php |h> | ||
| + | <?php | ||
| + | /* | ||
| + | ******************************************************************* | ||
| + | * 08.11.2012 KH: Extract the OS from the User-Agent for iOS devices | ||
| + | * V1.1 | ||
| + | * This solution can be queried with the built in if statements. -> iOS, iOS_V6 | ||
| + | *Enhanced V1.1: Only if iOS V6 is used, the if statement is extended. | ||
| + | * | ||
| + | * | ||
| + | * In CMS e.g.: | ||
| + | * <!--if:platform:iOS-->iOS Version x - 5<!--/if--> | ||
| + | * <!--if:platform:iOS_V6-->iOS Version6<!--/if--> | ||
| + | * | ||
| + | * File: template/inc_script/frontend_init/rt_iOS_OS_user_agent.php | ||
| + | * | ||
| + | ********************************************************************/ | ||
| + | |||
| + | // ------------------------------------------------------------------------------------------- | ||
| + | // obligate check for phpwcms constants | ||
| + | if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");} | ||
| + | // ------------------------------------------------------------------------------------------- | ||
| + | |||
| + | // Example USER-AGENT iOS | ||
| + | // -------------------------------------------------------- | ||
| + | // Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5 | ||
| + | // Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5 | ||
| + | // -------------------------------------------------------- | ||
| + | |||
| + | if ($GLOBALS['phpwcms']['USER_AGENT']['platform'] == 'iOS') { | ||
| + | |||
| + | $os_vers = preg_replace("/(.*) OS ([0-9]*)_(.*)/","$2", $_SERVER['HTTP_USER_AGENT']); | ||
| + | |||
| + | if (((int) $os_vers) == $os_vers) // Integer ? | ||
| + | if ($os_vers > 5) | ||
| + | $GLOBALS['phpwcms']['USER_AGENT']['platform'] .= '_V6'; | ||
| + | } | ||
| + | |||
| + | ?> | ||
| + | |||
| + | </code> | ||
| + | \\ | ||
| + | An die Ausgabe der Plattform wird bei Verwendung von iOS6 einfach _V6 angehängt (**iOS** -> **iOS_V6**). Alle tieferen iOS-Versionen haben keinen Einfluss. | ||
| Bitte prüfen beim iPod und älteren iOS-Versionen. | Bitte prüfen beim iPod und älteren iOS-Versionen. | ||