コード例 #1
0
ファイル: Labels.php プロジェクト: laiello/xerxes-portal
 public function init($language)
 {
     $parent = Xerxes_Framework_FrontController::parentDirectory();
     $this->xml = new DOMDocument();
     $this->xml->load("{$parent}/lib/xsl/labels/eng.xsl");
     if (file_exists("xsl/labels/eng.xsl")) {
         $local_xml = new DOMDocument();
         $local_xml->load("xsl/labels/eng.xsl");
         $import = $this->xml->importNode($local_xml->documentElement, true);
         $this->xml->documentElement->appendChild($import);
     }
     // if language is set to something other than english
     // then include that file to override the english labels
     if ($language != "") {
         $language_xml = new DOMDocument();
         $language_xml->load("{$parent}/lib/xsl/labels/{$language}.xsl");
         $import = $this->xml->importNode($language_xml->documentElement, true);
         $this->xml->documentElement->appendChild($import);
         if (file_exists("xsl/labels/{$language}.xsl")) {
             $local_xml = new DOMDocument();
             $local_xml->load("xsl/labels/{$language}.xsl");
             $import = $this->xml->importNode($local_xml->documentElement, true);
             $this->xml->documentElement->appendChild($import);
         }
     }
     $labels = $this->xml->getElementsByTagName("variable");
     // last ones takes precedence
     foreach ($labels as $label) {
         $this->labels[(string) $label->getAttribute("name")] = $label->nodeValue;
     }
 }
コード例 #2
0
 /**
  * Simple function to detect if the user has a mobile device
  */
 public function isMobileDevice()
 {
     require_once Xerxes_Framework_FrontController::parentDirectory() . '/lib/mobile/mobile_device_detect.php';
     $is_mobile = @mobile_device_detect(true, false);
     // supress errors because this library is goofy
     return $is_mobile[0];
 }