Get HTTP_REFERER as Drupal normal path without language prefix

Public

</> CopyGet raw version
php
  1. /**
  2.  * Get HTTP_REFERER as Drupal normal path without language prefix.
  3.  */
  4. function referer_path() {
  5. if (!empty($_SERVER['HTTP_REFERER'])) {
  6. $url = parse_url($_SERVER['HTTP_REFERER']);
  7. if ($url['path'][0] == '/') {
  8. $url['path'] = substr($url['path'], 1);
  9. }
  10. list(, $path) = language_url_split_prefix($url['path'], language_list());
  11. return $path;
  12. }
  13. }

Comments

Thomas's picture

good job !