You are here

function lightbox2_exclude_these_paths in Lightbox2 5

Same name and namespace in other branches
  1. 8 lightbox2.module \lightbox2_exclude_these_paths()
  2. 5.2 lightbox2.module \lightbox2_exclude_these_paths()
  3. 6 lightbox2.module \lightbox2_exclude_these_paths()
  4. 7.2 lightbox2.module \lightbox2_exclude_these_paths()
  5. 7 lightbox2.module \lightbox2_exclude_these_paths()
2 calls to lightbox2_exclude_these_paths()
lightbox2_field_formatter in ./lightbox2.module
Implementation of hook_field_formatter().
lightbox2_nodeapi in ./lightbox2.module
Implementation of hook_nodeapi().

File

./lightbox2.module, line 338

Code

function lightbox2_exclude_these_paths() {

  // Use lightbox if this url is not excluded
  $disabled_urls = variable_get('lightbox2_disable_these_urls', '');
  if (!empty($disabled_urls)) {
    $urls = explode("\n", $disabled_urls);
    foreach ($urls as $url) {
      $url = rtrim($url);
      $url = preg_replace('/%/', '.*?', preg_quote($url, '/'));
      $pattern = '/^' . $url . '$/';
      if (preg_match($pattern, $_REQUEST['q'])) {
        return 1;
      }
    }
  }
  return 0;
}