Ejemplo n.º 1
0
 public function testBrowserTypes()
 {
     $this->_fakeMozillaFirefox();
     $this->assertTrue(X\THETOOLS::is_browser('desktop'));
     $this->assertTrue(X\THETOOLS::is_browser('no-phone'));
     $this->assertFalse(X\THETOOLS::is_browser('phone'));
     $this->assertFalse(X\THETOOLS::is_browser('mobile'));
     $this->_fakeIPhone();
     $this->assertTrue(X\THETOOLS::is_browser('phone'));
     $this->assertTrue(X\THETOOLS::is_browser('mobile'));
     $this->assertFalse(X\THETOOLS::is_browser('no-phone'));
     $this->assertFalse(X\THETOOLS::is_browser('desktop'));
 }
Ejemplo n.º 2
0
 /**
  * Checks if \Xiphe\THETOOLS exists and appends browser classes. 
  *
  * @param string $before separator.
  *
  * @return string
  */
 public function browserClass($before = '')
 {
     if (class_exists('Xiphe\\THEMASTER\\core\\THEMASTER')) {
         $browser = str_replace(' ', '_', strtolower(\Xiphe\THETOOLS::get_browser()));
         $version = str_replace('.', '-', \Xiphe\THETOOLS::get_browserVersion());
         $engine = strtolower(\Xiphe\THETOOLS::get_layoutEngine());
         if (!empty($engine)) {
             $engine .= ' ';
         }
         if (\Xiphe\THETOOLS::is_browser('mobile')) {
             $mobile = 'mobile no-desktop';
         } else {
             $mobile = 'desktop no-mobile';
         }
         return "{$before}{$engine}{$browser} {$browser}-{$version} {$mobile}";
     }
     return '';
 }