function feeds_tamper_explode_callback in Feeds Tamper 6
Same name and namespace in other branches
- 7 plugins/explode.inc \feeds_tamper_explode_callback()
1 string reference to 'feeds_tamper_explode_callback'
- explode.inc in plugins/
explode.inc
File
- plugins/
explode.inc, line 45
Code
function feeds_tamper_explode_callback($source, $item_key, $element_key, &$field, $settings) {
$out = array();
if (!is_array($field)) {
$field = array(
$field,
);
}
foreach ($field as $f) {
if (strpos($f, $settings['real_separator']) === FALSE) {
$out[] = $f;
}
elseif ($settings['limit'] == '') {
$out = array_merge($out, explode($settings['real_separator'], $f));
}
else {
$out = array_merge($out, explode($settings['real_separator'], $f, $settings['limit']));
}
}
$field = $out;
}