function custom_breadcrumbs_taxonomy_terms_parse_string in Custom Breadcrumbs 7.2
Parses a comma or plus separated string of term IDs.
Parameters
string $str_tids: A string of term IDs, separated by plus or comma. comma (,) means AND plus (+) means OR.
Return value
array an associative array with an operator key (either 'and' or 'or') and a tid key containing an array of the term ids.
1 call to custom_breadcrumbs_taxonomy_terms_parse_string()
- _custom_breadcrumbs_views_parse_args in ./
custom_breadcrumbs_common.inc - Returns the appropriate type and value of each view argument.
File
- ./
custom_breadcrumbs_common.inc, line 206 - Common helper functions used by custom breadcrumbs submodules.
Code
function custom_breadcrumbs_taxonomy_terms_parse_string($str_tids) {
$terms = array(
'operator' => '',
'tids' => array(),
);
if (preg_match('/^([0-9]+[+ ])+[0-9]+$/', $str_tids)) {
$terms['operator'] = 'or';
// The '+' character in a query string may be parsed as ' '.
$terms['tids'] = preg_split('/[+ ]/', $str_tids);
}
elseif (preg_match('/^([0-9]+,)*[0-9]+$/', $str_tids)) {
$terms['operator'] = 'and';
$terms['tids'] = explode(',', $str_tids);
}
return $terms;
}