You are here

function _popup_breadcrumb_arguments in Popup 6.x

1 call to _popup_breadcrumb_arguments()
popup_breadcrumb_preprocess_page in modules/popup_breadcrumb/popup_breadcrumb.module
Implementation of hook_preprocess_page

File

modules/popup_breadcrumb/includes/popup_breadcrumb.admin.inc, line 381

Code

function _popup_breadcrumb_arguments($settings) {
  $argument_template = $settings['argument-template'];
  $path = $settings['argument-alias'] ? drupal_get_path_alias($_GET['q']) : $_GET['q'];
  $parts = explode('%', $argument_template);
  $regex_fragment = '';
  $regexes = array();
  foreach ($parts as $part) {
    $regex_fragment .= $part . '([0-9a-zA-Z\\-\\_\\.]*)';
    $regexes[] = $regex_fragment;
  }
  $regexes = array_reverse($regexes);
  $regex = '/(?:' . preg_replace(array(
    '/\\//',
  ), array(
    '\\/',
  ), implode(')|(?:', $regexes)) . ')/';
  preg_match($regex, $path, $arguments);
  $arguments = array_values(array_filter($arguments));
  array_shift($arguments);
  return $arguments;
}