Skip to content
This repository was archived by the owner on Nov 30, 2017. It is now read-only.

Commit ee58b22

Browse files
committed
Built WhichBrowser from commit 7925706 on WhichBrowser/WhichBrowser on branch dev
1 parent 9de313f commit ee58b22

28 files changed

+7294
-6846
lines changed

Diff for: README.md

+32-75
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,13 @@ The server should be able to handle PHP and included is a `.htaccess` file that
4343
How to install it
4444
-----------------
4545

46-
Place the files in a directory on your server. The easiest way to install is to download the files as a <a href="https://github.com/WhichBrowser/WhichBrowser/archive/master.zip">zip archive</a> from Github and place
47-
them in a directory called `whichbrowser` on your server. However, this is not ideal for keeping WhichBrowser up-to-date.
46+
You can install WhichBrowser by using Composer - the standard package manager for PHP. The package is called `whichbrowser/whichbrowser`.
4847

49-
50-
###Using Git
51-
52-
It is recommended to use `git` directly on the server to make sure you get the latest changes and to make it easier to keep WhichBrowser updated.
53-
54-
Go to the root directory of your site and run the following command:
55-
56-
git clone https://github.com/WhichBrowser/WhichBrowser.git whichbrowser
57-
58-
This will create a new directory called `whichbrowser` and install the latest version of WhichBrowser. If you want to update WhichBrowser to the latest version you can simply run the following command from the `whichbrowser` directory:
59-
60-
git pull
61-
62-
Given that WhichBrowser is updated regularly - sometimes even multiple times a day - you should run this command as often as possible. You might even want to consider setting up a cron job for this purpose.
63-
64-
65-
###Using Composer
66-
67-
As an alternative we also offer a Composer package called `whichbrowser/whichbrowser`.
68-
69-
php composer.phar require whichbrowser/whichbrowser dev-master
48+
composer require whichbrowser/whichbrowser
7049

7150
And just like the Git method, you can easily update WhichBrowser by running a simple command.
7251

73-
php composer.phar update
52+
composer update
7453

7554
You should run this command as often as possible. You might even want to consider setting up a cron job for this purpose.
7655

@@ -83,28 +62,6 @@ Or create a `.htaccess` file in the root of your site and add an `Alias` command
8362
Alias /whichbrowser vendor/whichbrowser/whichbrowser
8463

8564

86-
###Using Bower
87-
88-
Finally we also offer a Bower package called `whichbrowser`.
89-
90-
bower install whichbrowser
91-
92-
And just like the Git and Composer method, you can easily update WhichBrowser by running a simple command.
93-
94-
bower update
95-
96-
You should run this command as often as possible. You might even want to consider setting up a cron job for this purpose.
97-
98-
After installing with Bower you may need to create a symlink to the component directory in which WhichBrowser was installed:
99-
100-
ln -s bower_components/whichbrowser whichbrowser
101-
102-
Or create a `.htaccess` file in the root of your site and add an `Alias` command:
103-
104-
Alias /whichbrowser bower_components/whichbrowser
105-
106-
107-
10865

10966
How to use it
11067
-------------
@@ -128,86 +85,86 @@ The second step is to create a new `WhichBrowser` object. This object will conta
12885

12986
For example:
13087

131-
Browsers = new WhichBrowser();
88+
result = new WhichBrowser();
13289

13390

134-
The variable `Browsers` now contains an object which you can query for information. There are various ways to access the information.
91+
The variable `result` now contains an object which you can query for information. There are various ways to access the information.
13592

13693

13794
First of all, you can treat the object as a string to get a human readable identification:
13895

139-
"You are using " + Browsers
96+
"You are using " + result
14097
// You are using Chrome 27 on Mac OS X 10.8.4
14198

14299
If you need to, you can also explicitly typecast the object to a string
143100

144-
String(Browsers)
145-
Browsers.toString()
101+
String(result)
102+
result.toString()
146103

147104

148105
Or you can turn the object into JSON:
149106

150-
JSON.stringify(Browsers)
107+
JSON.stringify(result)
151108
// { "browser": {"name":"Chrome","version":{"value":"27"...
152109

153110

154111
Another possiblity is to query the object:
155112

156-
Browsers.isType('desktop')
113+
result.isType('desktop')
157114
// true
158115

159-
Browsers.isType('mobile', 'tablet', 'media')
116+
result.isType('mobile', 'tablet', 'media')
160117
// false
161118

162-
Browsers.isBrowser('Maxthon', '<', '4.0.5')
119+
result.isBrowser('Maxthon', '<', '4.0.5')
163120
// false
164121

165-
Browsers.isOs('iOS', '>=', '5')
122+
result.isOs('iOS', '>=', '5')
166123
// false
167124

168-
Browsers.isEngine('Blink')
125+
result.isEngine('Blink')
169126
// true
170127

171128

172129
You can also access these properties directly:
173130

174-
Browsers.browser
131+
result.browser
175132
// Chrome 27
176133

177-
Browsers.engine
134+
result.engine
178135
// Blink
179136

180-
Browsers.os
137+
result.os
181138
// Mac OS X 10.8.4
182139

183140

184141
Or access parts of these properties directly:
185142

186-
Browsers.browser.name
143+
result.browser.name
187144
// Chrome
188145

189-
Browsers.browser.name + ' ' + String(Browsers.browser.version)
146+
result.browser.name + ' ' + String(result.browser.version)
190147
// Chrome 27
191148

192-
Browsers.browser.version.major
149+
result.browser.version.major
193150
// 27
194151

195-
Browsers.browser.version.minor
152+
result.browser.version.minor
196153
// 0
197154

198-
Browsers.browser.version.original
155+
result.browser.version.original
199156
// 27.0.1453.110
200157

201-
Browsers.engine.name
158+
result.engine.name
202159
// Blink
203160

204161

205162
Finally you can also query versions directly:
206163

207-
Browsers.browser.version.is('>', 26)
164+
result.browser.version.is('>', 26)
208165
// true
209166

210-
Browsers.os.version.is('<', '10.7.4')
167+
result.os.version.is('<', '10.7.4')
211168
// false
212169

213170

@@ -347,25 +304,25 @@ The `Version` object is used for the `version` property of the `browser`, `engin
347304
`is(version)` or `is(comparison, version)`
348305
Using this function it is easy to compare a version to another version. If you specify only one argument, this function will return if the versions are the same. You can also specify two arguments, in that case the first argument contains the comparison operator, such as `<`, `<=`, `=`, `=>` or `>`. The second argument is the version you want to compare it to. You can use versions like `10`, `10.7` or `'10.7.4'`, but be aware that `10` is not the same as `10.0`. For example if our OS version is `10.7.4`:
349306

350-
Browser.os.version.is('10.7.4')
307+
result.os.version.is('10.7.4')
351308
// true
352309

353-
Browser.os.version.is('10.7')
310+
result.os.version.is('10.7')
354311
// true
355312

356-
Browser.os.version.is('10')
313+
result.os.version.is('10')
357314
// true
358315

359-
Browser.os.version.is('10.0')
316+
result.os.version.is('10.0')
360317
// false
361318

362-
Browser.os.version.is('>', '10')
319+
result.os.version.is('>', '10')
363320
// false
364321

365-
Browser.os.version.is('>', '10.7')
322+
result.os.version.is('>', '10.7')
366323
// false
367324

368-
Browser.os.version.is('>', '10.7.3')
325+
result.os.version.is('>', '10.7.3')
369326
// true
370327

371328

Diff for: bower.json

-18
This file was deleted.

Diff for: data/build-android.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace WhichBrowser;
3+
namespace WhichBrowser\Data;
44

55
BuildIds::$ANDROID_BUILDS = [
66
'CUPCAKE' => '1.5',

Diff for: data/id-android.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

3-
namespace WhichBrowser;
4-
53
/* This file is automatically generated, do not edit manually! */
64

5+
namespace WhichBrowser\Data;
6+
77
BrowserIds::$ANDROID_BROWSERS = array(
88
'com.agilebits.onepassword' => '1Password',
99
'com.browser2345' => '2345 Browser',

Diff for: data/manufacturers.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace WhichBrowser;
3+
namespace WhichBrowser\Data;
44

55
Manufacturers::$TELEVISION = [
66
'BANGOLUFSEN' => 'Bang & Olufsen',

0 commit comments

Comments
 (0)