function freelinking_parse_target in Freelinking 6.3
Parse target for secondary link arguments. This is raw user input and needs to be checked by the HTML Filter.
1 call to freelinking_parse_target()
- freelinking_filter in ./
freelinking.module - Implementation of hook_filter().
File
- ./
freelinking.module, line 284
Code
function freelinking_parse_target($target, $plugin = NULL, $separator = NULL) {
if (!$separator) {
$separator = '|';
}
$args = array();
$args['target'] = $target;
$items = explode($separator, $target);
// first three unnamed args are dest, text, tooltip
$index = 0;
foreach ($items as $key => $item) {
if (strpos($item, '=')) {
list($name, $value) = explode('=', $item);
$args[$name] = $value;
}
elseif ($index < 3) {
switch ($index) {
case '0':
$args['dest'] = $item;
break;
case '1':
$args['text'] = $item;
break;
case '2':
$args['tooltip'] = $item;
break;
}
$index++;
}
else {
$args['other'][] = $item;
}
}
// Convert URL-encoded text into something readable for link text & tooltip.
$args['text'] = isset($args['text']) ? urldecode($args['text']) : '';
$args['tooltip'] = isset($args['tooltip']) ? urldecode($args['tooltip']) : '';
return $args;
}