Esempio n. 1
0
 /**
  * Return the mobile version of the current URL if the user is on a mobile device
  * and might want to switch over.  Return false when not on a mobile device.
  *
  * @return string
  */
 public function __invoke()
 {
     // Do nothing special if we're not on a mobile device or no mobile theme is
     // enabled:
     if (!Mobile::enabled() || !Mobile::detect()) {
         return false;
     }
     $urlHelper = $this->getView()->plugin('serverurl');
     $currentUrl = rtrim($urlHelper(true), '?');
     $currentUrl .= strstr($currentUrl, '?') ? '&' : '?';
     return $currentUrl .= 'ui=mobile';
 }