You are here

function environment_indicator_match_path in Environment Indicator 8.2

Helper function to match the path based on the regular expression.

Parameters

string $regexurl: The regular expression to match against.

Return value

int Indicating if the environment was a match.

1 call to environment_indicator_match_path()
environment_indicator_get_active in ./environment_indicator.module
Helper function to get the active indicator.

File

./environment_indicator.module, line 254
Module implementation file.

Code

function environment_indicator_match_path($regexurl) {

  // If the URL includes a non-scaped slash then an error will be thrown.
  $regexurl = preg_replace("/([^\\/])\\//", "\$1\\/", $regexurl);
  return preg_match("/{$regexurl}/", $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
}