protected function initTeraWurfl() { if (!$this->wurflObj) { $mode = self::trackerGetSetting('TeraWurflMode'); switch ($mode) { case 'TeraWurflRemoteClient': case 'TeraWurflEnterpriseRemoteClient': require_once PIWIK_INCLUDE_PATH . '/plugins/MobileAnalytics/TeraWurflRemoteClient.php'; $this->wurflObj = new $mode(self::trackerGetSetting('TeraWurflURL')); @$this->wurflObj->getDeviceCapabilitiesFromAgent(null, self::$requiredCapabilities); break; case 'TeraWurfl': case 'TeraWurflEnterprise': require_once self::trackerGetSetting('TeraWurflPath'); $this->wurflObj = new $mode(); $this->wurflObj->getDeviceCapabilitiesFromAgent(null); break; } } }
function Wall($ua = false) { global $_GET, $_SERVER; if (!$ua) { $this->ua = isset($_GET['UA']) ? $_GET['UA'] : getenv('HTTP_USER_AGENT'); } else { $this->ua = $ua; } if (defined('WALL_USE_TERA_WURFL') && WALL_USE_TERA_WURFL) { switch (TERA_WURFL_VERSION) { case 1: require_once WURFL_CLASS_FILE; $this->wurfl = new tera_wurfl(); $this->wurfl->getDeviceCapabilitiesFromAgent($this->ua); break; case 2: // The class file was loaded in wall_prepend.php $this->wurfl = new TeraWurfl(); if (!$ua) { $this->ua = WurflSupport::getUserAgent(); } $this->wurfl->getDeviceCapabilitiesFromAgent($this->ua); break; case 'webservice': $this->wurfl = new TeraWurflRemoteClient(TERA_WURFL_WEBSERVICE_URL, TeraWurflRemoteClient::$FORMAT_JSON); if (!$ua) { $this->ua = TeraWurflRemoteClient::getUserAgent(); } $this->wurfl->getCapabilitiesFromAgent($this->ua, $GLOBALS['WALLWurflCapabilities']); break; } } else { $this->wurfl = new wurfl_class(); $this->wurfl->getDeviceCapabilitiesFromAgent($this->ua); } ob_start(array($this, '_obCallBack')); register_shutdown_function(array($this, '_obEndFlush')); }
* section_title string the name of the current section. either name of the course, administration, my start page, etc. * page_title string the title of the current page. * path array(array('url', 'title')) the path to the current page. * back_to_page array('url', 'title') the link back to the part of the current page, if needed. * current_top_level_page string full url to the current top level page in "top_leve_pages" * current_sub_level_page string full url to the current sub level page in the "sub_level_pages" * sub_level_pages array(array('url', 'title')) the sub level pages. * is_mobile_device true or false the request is from a mobile device or a desktop device * mobile_device_type One of the constants: IPOD_DEVICE, BLACKBERRY_DEVICE, ANDROID_DEVICE, UNKNOWN_DEVICE (@see include/lib/constants.inc.php) */ // will have to be moved to the header.inc.php global $system_courses, $_custom_css, $db, $_base_path, $contentManager; // 1. any click on the page closes the content menu but the link "content_link" itself // 2. the click on link "content_link" opens the content menu require 'TeraWurflRemoteClient.php'; $wurflObj = new TeraWurflRemoteClient('http://wurfl.thesedays.com/webservice.php'); $capabilities = array("product_info"); $data_format = TeraWurflRemoteClient::$FORMAT_JSON; $wurflObj->getCapabilitiesFromAgent(null, $capabilities, $data_format); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo $this->lang_code; ?> "> <head> <title><?php echo SITE_NAME; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Remote Tera-WURFL Remote Client Example</title> </head> <body> <?php $start = microtime(true); require_once realpath(dirname(__FILE__) . '/../../TeraWurflRemoteClient.php'); $wurflObj = new TeraWurflRemoteClient('http://localhost/Tera-Wurfl/webservice.php'); $capabilities = array("product_info", "fake_capability"); // NOTE: You must use $FORMAT_XML to communicate with Tera-WURFL 2.1.1 and earlier! $data_format = TeraWurflRemoteClient::$FORMAT_JSON; $wurflObj->getCapabilitiesFromAgent(null, $capabilities, $data_format); $time = round(microtime(true) - $start, 6); echo "<h3>Response from Tera-WURFL " . $wurflObj->getAPIVersion() . "</h3>"; echo "<pre>" . var_export($wurflObj->capabilities, true) . "</pre>"; if ($wurflObj->errors) { foreach ($wurflObj->errors as $name => $error) { echo "{$name}: {$error}<br/>"; } } echo "<hr/>Total Time: {$time}"; ?> </body> </html>