PluginProbe
GetResponse Forms by Optin Cat / 1.3.4
GetResponse Forms by Optin Cat v1.3.4
1.3.4 1.3.5 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 2.0.0 All 36 releases
getresponse / includes / classes / Mobile-Detect / export / exportToJSON.php

exportToJSON.php in GetResponse Forms by Optin Cat 1.3.4, at includes/classes/Mobile-Detect/export/exportToJSON.php

70 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Mobile Detect Library
4 * - export -
5 * =====================
6 *
7 * Use the resulting JSON export file in other languages
8 * other than PHP. Always check for 'version' key because
9 * new major versions can modify the structure of the JSON file.
10 *
11 * The result of running this script is the export.json file.
12 *
13 * @license Code and contributions have 'MIT License'
14 * More details: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
15 *
16 */
17
18 // Included nicejson function to beautify the result JSON file.
19 // This library is not mandatory.
20 if( file_exists(dirname(__FILE__).'/nicejson/nicejson.php') ) {
21 include_once dirname(__FILE__).'/nicejson/nicejson.php';
22 }
23
24 // Include Mobile Detect.
25 require_once dirname(__FILE__).'/../Mobile_Detect.php';
26 $detect = new Mobile_Detect;
27
28 $json = array(
29 // The current version of Mobile Detect class that
30 // is being exported.
31 'version' => $detect->getScriptVersion(),
32
33 // All headers that trigger 'isMobile' to be 'true',
34 // before reaching the User-Agent match detection.
35 'headerMatch' => $detect->getMobileHeaders(),
36
37 // All possible User-Agent headers.
38 'uaHttpHeaders' => $detect->getUaHttpHeaders(),
39
40 // All the regexes that trigger 'isMobile' or 'isTablet'
41 // to be true.
42 'uaMatch' => array(
43 // If match is found, triggers 'isMobile' to be true.
44 'phones' => $detect->getPhoneDevices(),
45 // Triggers 'isTablet' to be true.
46 'tablets' => $detect->getTabletDevices(),
47 // If match is found, triggers 'isMobile' to be true.
48 'browsers' => $detect->getBrowsers(),
49 // If match is found, triggers 'isMobile' to be true.
50 'os' => $detect->getOperatingSystems(),
51 // Various utilities. To be further discussed.
52 'utilities' => $detect->getUtilities()
53 )
54
55 );
56
57 $jsonString = function_exists('json_format') ? json_format($json) : json_encode($json);
58
59 // Write the JSON file to disk.
60 // You can import this file in your app.
61 $fileName = dirname(__FILE__).'/../Mobile_Detect.json';
62 $handle = fopen($fileName, 'w');
63 $fwrite = fwrite($handle, $jsonString);
64 fclose($handle);
65
66 if($fwrite){
67 echo 'Done. Check '.realpath($fileName).' file.';
68 } else {
69 echo 'Failed to write '.realpath($fileName).' to disk.';
70 }