-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathdetect.php
25 lines (18 loc) · 894 Bytes
/
detect.php
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
<?php
header("Content-Type: text/javascript");
header("Cache-Control: no-cache, no-store, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: 0");
include_once 'bootstrap.php';
$options = array('headers' => getallheaders());
if (isset($_REQUEST['ua'])) $options['useragent'] = $_REQUEST['ua'];
if (isset($_REQUEST['e'])) $options['engine'] = intval($_REQUEST['e']);
if (isset($_REQUEST['f'])) $options['features'] = intval($_REQUEST['f']);
if (isset($_REQUEST['w'])) $options['width'] = intval($_REQUEST['w']);
if (isset($_REQUEST['h'])) $options['height'] = intval($_REQUEST['h']);
$parser = new WhichBrowser\Parser();
include('hooks/cache.php');
$parser->analyse($options);
include('hooks/log.php');
$template = file_get_contents(__DIR__ . '/templates/dist/bundle.js');
echo preg_replace('/\_\=[\'"][\'"].*\_\=[\'"][\'"]/s', $parser->toJavaScript(), $template);