You are here

function _pages_restriction_get_rules_by_path in Pages Restriction Access 7

Update page on cache so it can be retrieved later.

Parameters

string $path: String with path to be used in rule validation.

Return value

array Array with all the id pages found in rule validation.

4 calls to _pages_restriction_get_rules_by_path()
pages_restriction_page_alter in ./pages_restriction.module
Implements hook_page_alter().
_pages_restriction_restrict_access in includes/pages_restriction.helpers.inc
Restriction rules feature for Pages Restriction.
_pages_restriction_set_next_page_path in includes/pages_restriction.helpers.inc
Update page on cache so it can be retrieved later.
_pages_restriction_unset_sections_with_path in includes/pages_restriction.helpers.inc
Implements OneTouch Restriction Access.

File

includes/pages_restriction.helpers.inc, line 110
Contains the helpers functions for the Pages Restriction.

Code

function _pages_restriction_get_rules_by_path($path) {
  $ids = array();
  $rules = explode(PHP_EOL, variable_get('pages_restriction_rules'));
  foreach ($rules as $key => $rule) {
    $pages = explode("|", $rule);
    foreach ($pages as $page) {
      if (preg_match('@^' . str_replace('%', '\\w*', trim($page)) . '$@', trim($path))) {
        $ids[$key] = $pages;
        break;
      }
    }
  }
  return $ids;
}