Ejemplo n.º 1
0
 /**
  * Returns the name of the current module from a Ventus URL
  * @param string $url The URL to parse. Defaults to the current page URL
  * @return string
  */
 public static function getModuleNameFromURL($url = null)
 {
     if ($url === null) {
         $url = URI::getCurrentURL();
     }
     $url_components = parse_url($url);
     if ($url_components['host'] !== URL_INTRANET || mb_strpos($url_components['path'], URL_INTRANET_VENTUS) !== 0) {
         throw new \InvalidArgumentException('Not a Ventus URL');
     }
     $url_components['path'] = str_replace(URL_INTRANET_VENTUS . '/', '', $url_components['path']);
     $pathParts = explode('/', $url_components['path']);
     return $pathParts[0];
 }