From 8a9ba77275935bf0e5ab90ed4370f9416d787a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Tue, 16 Oct 2007 14:10:33 +0000 Subject: #183690 by Wim Leers: (developer improvement) abstract path matching to drupal_match_path() from block listing, so this gets reusable when path based matching is required --- modules/block/block.module | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/block/block.module b/modules/block/block.module index 5c8f354ce..1b4557b93 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -410,11 +410,10 @@ function block_list($region) { if ($block->pages) { if ($block->visibility < 2) { $path = drupal_get_path_alias($_GET['q']); - $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($block->pages, '/')) .')$/'; // Compare with the internal and path alias (if any). - $page_match = preg_match($regexp, $path); + $page_match = drupal_match_path($path, $block->pages); if ($path != $_GET['q']) { - $page_match = $page_match || preg_match($regexp, $_GET['q']); + $page_match = $page_match || drupal_match_path($_GET['q'], $block->pages); } // When $block->visibility has a value of 0, the block is displayed on // all pages except those listed in $block->pages. When set to 1, it -- cgit v1.2.3