Example #1
0
<?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']);
}
$detected = new WhichBrowser\Parser($options);
$template = file_get_contents(__DIR__ . '/templates/detect.js');
echo str_replace('/* $detected->toJavaScript() */', $detected->toJavaScript(), $template);
Example #2
0
<?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);
Example #3
0
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']);
}
$detected = new WhichBrowser\Parser($options);
?>
	
var WhichBrowser = (function(){
	
 	var WhichBrowser = function() { this.initialize.apply(this, arguments) };
	WhichBrowser.prototype = {
		initialize: function(options) {
			this.options = {
			};
			
<?php 
$detected->toJavaScript();
?>
		},