function _customfilter_get_rules in Custom filter 6.2
Same name and namespace in other branches
- 6 customfilter.module \_customfilter_get_rules()
- 7.2 customfilter.module \_customfilter_get_rules()
- 7 customfilter.module \_customfilter_get_rules()
Retrieve the replacement rules for a specific filter.
Parameters
$fid: The filter ID.
$root: The root rule.
$nocache: If FALSE, the function will get the rules from the cache table, if there are any.
Return value
An array of rules, which include any subrules.
1 call to _customfilter_get_rules()
- customfilter_filter in ./
customfilter.module - Implements hook_filter().
File
- ./
customfilter.module, line 305 - Allow users to define custom filters.
Code
function _customfilter_get_rules($fid, $root = 0, $use_cache = TRUE) {
if ($use_cache && ($cache = cache_get("rules:{$fid}:{$root}", 'cache_customfilter'))) {
$rules = $cache->data;
}
else {
$rules = array();
$result = db_query("SELECT * FROM {customfilter_rule} WHERE fid = %d and prid = %d ORDER BY weight", $fid, $root);
while ($rule = db_fetch_array($result)) {
$rule['sub'] = _customfilter_get_rules($fid, $rule['rid'], FALSE);
$rules[$rule['rid']] = $rule;
}
if ($use_cache) {
cache_set("rules:{$fid}:{$root}", $rules, 'cache_customfilter');
}
}
return $rules;
}