WURFL XML INFO

User Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)

Query WURFL by providing the user agent:

User Agent:

http://fotistudio.ch/ redirects mobile clients according WURFL database to different sites. At the moment four sites are realized: The current client would be redirected to: getVirtualCapability('is_mobile') == 'true' && $requestingDevice->getVirtualCapability('is_robot') == 'false') { if ($requestingDevice->getCapability('xhtml_support_level') >= 4) { echo 'http://m.fotistudio.ch/'; } else { if (substr($requestingDevice->getCapability('preferred_markup'), 0, 4) == 'wml_') { echo 'http://w.fotistudio.ch/'; } else { echo 'http://s.fotistudio.ch/'; } } } else { echo 'http://fotistudio.ch/'; } ?>

To fullfill AGPL I have to publish my glue code added to the DokuWiki template. The following lines are at the beginning of lib/tpl/*/main.php:

/* Switch to mobile site when using mobile device, but not when
   - user is navigating inside
   - user is switching from HTTPS
   - user is coming from mobile
*/
if (substr(getenv('HTTP_REFERER'), 0, 21) != 'http://fotistudio.ch/' &&
    substr(getenv('HTTP_REFERER'), 0, 22) != 'https://fotistudio.ch/' &&
    substr(getenv('HTTP_REFERER'), 0, 23) != 'http://m.fotistudio.ch/' &&
    substr(getenv('HTTP_REFERER'), 0, 23) != 'http://s.fotistudio.ch/' &&
    substr(getenv('HTTP_REFERER'), 0, 23) != 'http://w.fotistudio.ch/' &&
    substr(getenv('HTTP_REFERER'), 0, 23) != 'gopher://fotistudio.ch/' &&
    getenv('HTTPS') != 'on') {

  // Setup WURFL
  $wurflDir = $_SERVER['DOCUMENT_ROOT'] . '/wurfl/WURFL';
  $resourcesDir = $_SERVER['DOCUMENT_ROOT'] . '/wurfl/resources';
  $persistenceDir = $resourcesDir.'/storage/persistence';
  $cacheDir = $resourcesDir.'/storage/cache';
  require_once $wurflDir.'/Application.php';
  $wurflConfig = new WURFL_Configuration_InMemoryConfig();
  $wurflConfig->wurflFile($resourcesDir.'/wurfl.zip');
  $wurflConfig->wurflPatch($resourcesDir.'/wurfl_patch.xml');
  $wurflConfig->matchMode('performance');
  $wurflConfig->allowReload(true);
  $wurflConfig->capabilityFilter(array(
    'preferred_markup',
    'is_wireless_device',
    'xhtml_support_level'
  ));
  $wurflConfig->persistence('file', array('dir' => $persistenceDir));
  $wurflConfig->cache('file', array('dir' => $cacheDir, 'expiration' => 36000));
  $wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
  $wurflManager = $wurflManagerFactory->create();
  $wurflInfo = $wurflManager->getWURFLInfo();

  // Decide which page to show
  $requestingDevice = $wurflManager->getDeviceForHttpRequest($_SERVER);
  if ($requestingDevice->getVirtualCapability('is_mobile') == 'true'
   && $requestingDevice->getVirtualCapability('is_robot') == 'false') {
    if ($requestingDevice->getCapability('xhtml_support_level') >= 4) {
      header('Location: http://m.fotistudio.ch' . getenv('REQUEST_URI'));
      exit;
    } else {
      if (substr($requestingDevice->getCapability('preferred_markup'), 0, 4) == 'wml_') {
        header('Location: http://w.fotistudio.ch' . getenv('REQUEST_URI'));
        exit;
      } else {
        header('Location: http://s.fotistudio.ch' . getenv('REQUEST_URI'));
        exit;
      }
    }
  }
}

Feel free to copy & paste this code following the license rules of WURFL (AGPL v3) and DokuWiki (GPL v2).

Beat Rubischon <beat@0x1b.ch>