You are here

function lightbox2_exclude_these_paths in Lightbox2 5.2

Same name and namespace in other branches
  1. 8 lightbox2.module \lightbox2_exclude_these_paths()
  2. 5 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()

Return TRUE if current path is disabled for lightbox according to lightbox2_page_list and lightbox2_page_init_action.

1 call to lightbox2_exclude_these_paths()
lightbox2_menu in ./lightbox2.module
Implementation of hook_menu().

File

./lightbox2.module, line 2138
Enables the use of lightbox2 which places images above your current page, not within. This frees you from the constraints of the layout, particularly column widths.

Code

function lightbox2_exclude_these_paths() {
  $action = variable_get('lightbox2_page_init_action', 'page_disable');
  $page_list = variable_get('lightbox2_page_list', '');
  if (!empty($page_list)) {
    $pages = explode("\n", $page_list);
    foreach ($pages as $page) {
      $page = trim($page);
      if (empty($page)) {
        continue;
      }
      if ($page == "<front>") {
        $page = "";
      }
      $alias = drupal_get_path_alias($page);
      if ($alias != $page) {
        $alias = preg_replace(array(
          '/\\\\\\*/',
          '/%/',
        ), '.*?', preg_quote($alias, '/'));
        $pattern = '/^' . $alias . '$/';
        if (preg_match($pattern, $_REQUEST['q'])) {
          return $action == 'page_disable' ? 1 : 0;
        }
      }
      $page = preg_replace(array(
        '/\\\\\\*/',
        '/%/',
      ), '.*?', preg_quote($page, '/'));
      $pattern = '/^' . $page . '$/';
      if (preg_match($pattern, $_REQUEST['q'])) {
        return $action == 'page_disable' ? 1 : 0;
      }
    }
  }
  return $action == 'page_disable' ? 0 : 1;
}