Provides support for managing Phonegap apps.
More...
Provides support for managing Phonegap apps.
- Author
- andy
Definition at line 19 of file phonegap_manager.inc.
◆ addScript()
static PhonegapManager::addScript |
( |
|
$script | ) |
|
|
static |
Definition at line 119 of file phonegap_manager.inc.
122 global $phonegap_csp;
142 $phonegap =
"<script type='text/javascript' src='{$app}'></script>\n".$phonegap;
147 $phonegap_csp =
"gap: cdvfile:";
148 $phonegap =
"<script type='text/javascript' src='cdvfile://localhost/bundle/www/cordova.js'></script>".$phonegap;
152 $phonegap_csp =
"gap:";
153 $phonegap =
"<script type='text/javascript' src='{$file}'></script>\n".$phonegap;
157 $phonegap .=
"<script type='text/javascript' src='{$supportScript}'></script>\n";
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
static getOS()
Retrieve the current client device's OS (assuming it is running in Phonegap / Cordova)
static getPhonegapFile($platform, $version)
static getPhonegapAppScript($platform, $version)
static getValue($component, $name)
Retrieve the value of the specified Setting.
global $phonegap
Provides a central management class for event handlers and common functionality for the phonegap comp...
◆ defaultSupportScripts()
static PhonegapManager::defaultSupportScripts |
( |
| ) |
|
|
static |
◆ detectPhonegap()
static PhonegapManager::detectPhonegap |
( |
| ) |
|
|
static |
Detects whether a phonegap / cordova app is being used to access the current page.
Definition at line 42 of file phonegap_manager.inc.
46 trace(
"Detecting PhoneGap", 4);
56 trace(
"Phonegap flag without OS or version detected in session for {$_SERVER["REMOTE_ADDR
"]} - resetting", 2);
62 if (preg_match(
"/PhoneGap\\/Cordova (\\w+) (\\d+\\.\\d+\\.\\d+)/i", $_SERVER[
'HTTP_USER_AGENT'], $matches))
66 $_SESSION[
"phonegap_version"] = $matches[2];
68 trace(
"PhoneGap {$_SESSION["phonegap_version
"]} for {$_SESSION["phonegap_os
"]} enabled for {$_SERVER["REMOTE_ADDR
"]} via User Agent", 2);
70 else if (
$_POST[
"phonegap"] &&
$_POST[
"phonegap_version"] !=
"" &&
$_POST[
"phonegap_os"] !=
"")
76 trace(
"PhoneGap {$_SESSION["phonegap_version
"]} for {$_SESSION["phonegap_os
"]} enabled for {$_SERVER["REMOTE_ADDR
"]} via POST", 2);
78 else if (
Settings::getValue(
"phonegap",
"enable_phonegap_debugging") && $_GET[
"phonegap"])
84 trace(
"PhoneGap {$_SESSION["phonegap_version
"]} for {$_SESSION["phonegap_os
"]} enabled for {$_SERVER["REMOTE_ADDR
"]} in debugging mode", 2);
◆ getOS()
static PhonegapManager::getOS |
( |
| ) |
|
|
static |
Retrieve the current client device's OS (assuming it is running in Phonegap / Cordova)
- Returns
- string the device OS
Definition at line 112 of file phonegap_manager.inc.
115 if ($os ==
"droid") $os =
"android";
◆ getPhonegapAppScript()
static PhonegapManager::getPhonegapAppScript |
( |
|
$platform, |
|
|
|
$version |
|
) |
| |
|
static |
Definition at line 194 of file phonegap_manager.inc.
196 $key =
"{$platform}-{$version}";
202 $key =
"*-{$version}";
◆ getPhonegapFile()
static PhonegapManager::getPhonegapFile |
( |
|
$platform, |
|
|
|
$version |
|
) |
| |
|
static |
Definition at line 175 of file phonegap_manager.inc.
177 $key =
"{$platform}-{$version}";
185 return "/components/phonegap/js/{$platform}/cordova-{$version}.js";
◆ hasPhonegap()
static PhonegapManager::hasPhonegap |
( |
| ) |
|
|
static |
◆ PhonegapManager()
PhonegapManager::PhonegapManager |
( |
| ) |
|
◆ registerPhonegapAppScript()
static PhonegapManager::registerPhonegapAppScript |
( |
|
$platform, |
|
|
|
$version, |
|
|
|
$file |
|
) |
| |
|
static |
Definition at line 188 of file phonegap_manager.inc.
190 trace(
"Registering Phonegap App Script for $platform $version: $file", 3);
◆ registerPhonegapFile()
static PhonegapManager::registerPhonegapFile |
( |
|
$platform, |
|
|
|
$version, |
|
|
|
$file |
|
) |
| |
|
static |
Definition at line 168 of file phonegap_manager.inc.
170 trace(
"Registering Phonegap file for $platform $version: $file", 3);
◆ registerPhonegapSupportScript()
static PhonegapManager::registerPhonegapSupportScript |
( |
|
$s | ) |
|
|
static |
◆ setDefaults()
static PhonegapManager::setDefaults |
( |
| ) |
|
|
static |
Definition at line 30 of file phonegap_manager.inc.
32 Settings::setDefaultValue(
"phonegap",
"enable_phonegap",
true, Boolean,
"Enables support for Phonegap/Cordova applications");
33 Settings::setDefaultValue(
"phonegap",
"enable_phonegap_debugging",
false, Boolean,
"Enables PhoneGap debugging mode - append phonegap=1 to any URL in your desktop browser to turn on PhoneGap mode");
34 Settings::setDefaultValue(
"phonegap",
"phonegap_debug_version",
"2.4.0", String,
"The version of Phonegap that is assumed in debugging mode");
35 Settings::setDefaultValue(
"phonegap",
"phonegap_debug_os",
"android", String,
"The OS of Phonegap that is assumed in debugging mode");
36 Settings::setDefaultValue(
"phonegap",
"use_local_phonegap_files",
false, Boolean,
"Check this box to pull the local cordova files in the packaged app, instead of pulling them from the server (EXPERIMENTAL)");
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
◆ showVersion()
static PhonegapManager::showVersion |
( |
| ) |
|
|
static |
Definition at line 96 of file phonegap_manager.inc.
100 echo
"<p>Using Phonegap version ".$_SESSION[
"phonegap_version"].
" on ".
$_SESSION[
"phonegap_os"].
"</p>";
104 echo
"<p>Not using Phonegap</p>";
◆ $appScripts
PhonegapManager::$appScripts = array() |
|
static |
◆ $phonegapFiles
PhonegapManager::$phonegapFiles = array() |
|
static |
◆ $supportScripts
PhonegapManager::$supportScripts = array() |
|
static |
The documentation for this class was generated from the following file: