rendered paste body<?phpfunction linkicons_filter($op, $delta = 0, $format = -1, $text = '') { switch ($op) { case 'list': return array(0 => t('Link Icons filter')); case 'description': return t('Bla bla'); case "process": return preg_replace_callback('!<(a[^>]+)>!i', 'linkicons_callback', $text); default: return $text; }}function linkicons_callback($matches) { if (preg_match('/href=([\'"][^\'"]+[\'"]|[^ ]+)[ >]/i', $matches[0], $href) && strstr($href[1], '.')) { list($extension) = array_reverse(explode('.', $href[1])); $extension = strtolower(preg_replace('![^A-Za-z0-9]!', '', $extension)); if ($extension != '') { if (preg_match('/class=/i', $matches[0])) { return preg_replace('!class=["\']?!', '\0url-'. $extension .' ', $matches[0]); } else { return '<'. $matches[1] . ' class="url-'. $extension .'">'; } } } return $matches[0];}$text = <<<DOC<a>test</a><a href="test">test</a><a href="test.xml">test.xml</a><a href="foo.test.xml">test.foo.xml</a><a href="test.ppt" class="foo bar">test.ppt class</a><a href=test.pph class="foooo bar">fooo bar</a>DOC;print nl2br(linkicons_filter('process', 0, -1, $text));?>