TeraWurflAdmin
[ class tree: TeraWurflAdmin ] [ index: TeraWurflAdmin ] [ all elements ]

Source for file show_capabilities.php

Documentation is available at show_capabilities.php

  1. <?php
  2. /**
  3.  * Tera_WURFL - PHP MySQL driven WURFL
  4.  * 
  5.  * Tera-WURFL was written by Steve Kamerman, and is based on the
  6.  * Java WURFL Evolution package by Luca Passani and WURFL PHP Tools by Andrea Trassati.
  7.  * This version uses a MySQL database to store the entire WURFL file, multiple patch
  8.  * files, and a persistent caching mechanism to provide extreme performance increases.
  9.  * 
  10.  * @package TeraWurflAdmin
  11.  * @author Steve Kamerman <stevekamerman AT gmail.com>
  12.  * @version Stable 2.1.3 $Date: 2010/09/18 15:43:21
  13.  * @license http://www.mozilla.org/MPL/ MPL Vesion 1.1
  14.  */
  15. require_once realpath(dirname(__FILE__).'/../../TeraWurfl.php');
  16.  
  17. $ua $_GET['ua'];
  18.  
  19. $tw new TeraWurfl();
  20. $db $tw->db;
  21.  
  22. $missing_tables false;
  23. if($db->connected === true){
  24.     $required_tables array(TeraWurflConfig::$TABLE_PREFIX.'Cache');
  25.     $tables $db->getTableList();
  26. // See what tables are in the DB
  27. //die(var_export($tables,true));
  28.     foreach($required_tables as $req_table){
  29.         if(!in_array($req_table,$tables)){
  30.             $missing_tables true;
  31.         }
  32.     }
  33. }
  34. $cap $db->getDeviceFromCache($ua);
  35. $parts explode(',',$cap['tera_wurfl']['fall_back_tree']);
  36. $cap['tera_wurfl']['fall_back_tree'implode(' - ',$parts);
  37. $nicecap '';
  38. $groups array();
  39. foreach($cap as $group => $capability){
  40.     $nicecap .= "<tr><th colspan=\"2\"><a id=\"$group\"/>&nbsp;</th></tr>";
  41.     $groups[$group;
  42.     if(is_array($capability)){
  43.         $nicecap .= "<tr><td class=\"cap_heading\">$group</td><td class=\"cap_value\">"
  44.         $nicecap .= "<table>";
  45.         $i=0;
  46.         foreach($capability as $property => $value){
  47.             $class ($i++ % == 0)'lightrow''darkrow';
  48.             // Primary Group
  49.             $value (is_bool($value|| $value == "true" || $value == "false")WurflSupport::showBool($value)$value;
  50.             if($value == ""){
  51.                 $value "[null]";
  52.             }else{
  53.                 $value htmlspecialchars($value);
  54.             }
  55.             $nicecap .= "<tr><td class=\"cap_title $class\">$property</td><td class=\"cap_value $class\">".htmlspecialchars($value)."</td></tr>\n";
  56.         }
  57.         $nicecap .= "</table>";
  58.         $nicecap .= "</td></tr>\n";
  59.     }else{
  60.         // Top Level attribute
  61.         $capability (is_bool($capability|| $capability == "true" || $capability == "false")WurflSupport::showBool($capability)$capability;
  62.         if($capability == ""){
  63.             $capability "[null]";
  64.         }else{
  65.             $capability htmlspecialchars($capability);
  66.         }
  67.         $nicecap .= "<tr><td class=\"cap_heading\">$group</td><td class=\"cap_value\">$capability</td></tr>\n"
  68.     }
  69.     
  70. }
  71. foreach($groups as $num => $group){
  72.     $groups[$num]="<a href=\"#$group\">$group</a>";
  73. }
  74. $grouplinks implode(' | ',$groups);
  75. ?>
  76. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  77. <html xmlns="http://www.w3.org/1999/xhtml">
  78. <head>
  79. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  80. <title>Tera-WURFL Cache Browser</title>
  81. <link href="../style.css" rel="stylesheet" type="text/css" /></head>
  82. <body>
  83. <div align="center" class="titlediv version">
  84.     <pre style="margin 0px;"><?php echo htmlspecialchars($ua);?></pre>
  85. </div>
  86. <h3><?php echo $grouplinks;?></h3>
  87. <!-- pre><?php echo htmlspecialchars(var_export($cap,true));?></pre> -->
  88. <table>
  89. <?php echo $nicecap;?>
  90. </table>
  91. <table width="800">
  92.     <tr><td>
  93.  
  94. </td></tr></table>
  95. </body>
  96. </html>

Documentation generated on Sun, 19 Sep 2010 00:15:54 +0000 by phpDocumentor 1.4.3