function atag($aoptions, $text) { $href = getoptionvalue('href', $aoptions); if (substr($href, 0, 7) == 'mailto:') { $tag = 'email'; $href = substr($href, 7); } else { $tag = 'url'; if (!preg_match("/^[a-z0-9]+:/i", $href)) { $href = absoluteurl($href); } } return "[{$tag}={$href}]" . trim(recursion('a', $text, 'atag')) . "[/{$tag}]"; }
function imgtag($attributes) { $value = array('src' => '', 'width' => '', 'height' => ''); preg_match_all("/(src|width|height)=([\"|\\']?)([^\"']+)(\\2)/is", dstripslashes($attributes), $matches); if (is_array($matches[1])) { foreach ($matches[1] as $key => $attribute) { $value[strtolower($attribute)] = $matches[3][$key]; } } @extract($value); if (!preg_match("/^http:\\/\\//i", $src)) { $src = absoluteurl($src); } return $src ? $width && $height ? '[img=' . $width . ',' . $height . ']' . $src . '[/img]' : '[img]' . $src . '[/img]' : ''; }