static function getFormat($requestPath) { $method = AkMimeType::getMethod(); $format = AkMimeType::lookupMimeType('default'); if (!empty($format) && preg_match('/^([^\\.]+)\\.([a-zA-z0-9\\.]+)$/', $requestPath, $matches)) { $format = isset($matches[2]) ? strtolower($matches[2]) : null; $orgformat = $format; if ($format == 'htm') { $format = 'html'; } $requestPath = preg_replace('/^(.*)\\.' . $orgformat . '$/', '\\1', $requestPath); } else { if ($method == 'get' || $method == 'delete') { $format = AkMimeType::bestMimeType(); } else { if ($method == 'post' || $method == 'put') { $format = AkMimeType::lookupMimeType(AkMimeType::getContentType()); } } } if (empty($format)) { $format = AkMimeType::lookupMimeType('default'); } return array($format, $requestPath); }