forked from renekreijveld/UserAgentDetector
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuadetector.xml
executable file
·43 lines (43 loc) · 2.66 KB
/
uadetector.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="system" method="upgrade">
<name>System - User Agent Detector</name>
<author>Rene Kreijveld</author>
<creationDate>Februari 2013</creationDate>
<copyright>Copyright (C) 2013 ReneKreijveld.nl. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.renekreijveld.nl</authorUrl>
<version>1.0.8</version>
<description><![CDATA[
<h1 style="margin-left:0;text-align:left;">User Agent Detector</h1>
<p style="font-family:arial,helvetica,sans-serif;font-size:12px;text-align:left;">This plugin detects the user agent and sets a session variable accordingly.<br>
Based on the user agent, the plugin detects if the site is running on a desktop pc, tablet or smartphone. It can also detect if the visitor is a spider bot (search engine).<br><br>
Session variable that is set: <strong>ualayout</strong>.<br>
Possible values: <strong>desktop</strong>, <strong>tablet</strong>, <strong>mobile</strong>, <strong>bot</strong>.<br><br>
Example code to check the value of ualayout:</p>
<pre style="font-size:13px;text-align:left"><?php
$session = JFactory::getSession();
$ualayout = $session->get('ualayout');
?>
<link rel="stylesheet" href="/templates/mytemplates/css/template.css" type="text/css" />
<?php if($ualayout == "desktop") {?>
<link rel="stylesheet" href="/templates/mytemplates/css/desktop.css" type="text/css" />
<?php } ?>
<?php if($ualayout == "tablet") {?>
<link rel="stylesheet" href="/templates/mytemplates/css/tablet.css" type="text/css" />
<?php } ?>
<?php if($ualayout == "mobile") {?>
<link rel="stylesheet" href="/templates/mytemplates/css/mobile.css" type="text/css" />
<?php } ?></pre>
<p style="font-family:arial,helvetica,sans-serif;font-size:12px;text-align:left;">Written by <strong><a href="http://www.renekreijveld.nl" target="_blank">René Kreijveld</a></strong>. View on <strong><a href="https://github.com/renekreijveld/UserAgentDetector" target="_blank">github</a></strong>.<br>
Makes use of <strong><a href="https://github.com/serbanghita/Mobile-Detect" target="_blank">mobiledetect</a></strong>, a lightweight PHP class for detecting mobile devices.</p>
]]></description>
<files>
<filename plugin="uadetector">uadetector.php</filename>
<filename>README.md</filename>
<folder>lib</folder>
</files>
<updateservers>
<server type="extension" priority="1" name="Plugin User Agent Detector">http://www.rkrweb.nl/update/plg_system_useragentdetector/extension.xml</server>
</updateservers>
</extension>