You are here

protected function crumbs_RuleWeightKeeper::_buildPrefixedWeightKeeper in Crumbs, the Breadcrumbs suite 6.2

Same name and namespace in other branches
  1. 7 lib/RuleWeightKeeper.php \crumbs_RuleWeightKeeper::_buildPrefixedWeightKeeper()
1 call to crumbs_RuleWeightKeeper::_buildPrefixedWeightKeeper()
crumbs_RuleWeightKeeper::prefixedWeightKeeper in ./crumbs.plugin_engine.inc

File

./crumbs.plugin_engine.inc, line 253

Class

crumbs_RuleWeightKeeper

Code

protected function _buildPrefixedWeightKeeper($prefix) {
  $weights = array();
  $k = strlen($prefix);
  $weights[''] = $weights['*'] = $this
    ->_findWildcardWeight($prefix);
  if (isset($this->_rule_weights[$prefix])) {
    $weights[''] = $this->_rule_weights[$prefix];
  }
  if (isset($this->_rule_weights[$prefix . '.*'])) {
    $weights['*'] = $this->_rule_weights[$prefix . '.*'];
  }
  foreach ($this->_rule_weights as $key => $weight) {
    if (strlen($key) > $k && substr($key, 0, $k + 1) === $prefix . '.') {
      $weights[substr($key, $k + 1)] = $weight;
    }
  }
  return new crumbs_RuleWeightKeeper($weights);
}