| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
function technotag($text) { |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
$image = get_settings('siteurl') . '/wp-content/plugins/technobubble.gif'; |
|---|
| 19 |
|
|---|
| 20 |
$link = "http://www.technorati.com/tag/"; |
|---|
| 21 |
$text = preg_replace('/<ttag word="(.*?)">(.*?)<\/ttag>/i','<a href="' . $link . '$1" rel="tag">$2<img border="0" src="' . $image . '" /></a>',$text); |
|---|
| 22 |
$text = preg_replace('/<ttag>(.*?)<\/ttag>/i','<a href="' . $link . '$1" rel="tag">$1<img border="0" alt="Technorati Tag" src="' . $image . '" /></a>',$text); |
|---|
| 23 |
|
|---|
| 24 |
$taglist = get_post_custom_values('taglist'); |
|---|
| 25 |
|
|---|
| 26 |
$ttags = preg_split("/[\s,]+/", $taglist[0]); |
|---|
| 27 |
|
|---|
| 28 |
$ttagvals = get_post_custom_values('ttag'); |
|---|
| 29 |
|
|---|
| 30 |
$ttags = array_merge($ttags, $ttagvals); |
|---|
| 31 |
|
|---|
| 32 |
$ttags_list = ''; |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
if(!empty($ttags)) { |
|---|
| 36 |
|
|---|
| 37 |
$ttags_list = '<span class="ttag">'; |
|---|
| 38 |
$ttags_list = $ttags_list . '<img src=' . $image . ' alt="Technorati Tags" /> '; |
|---|
| 39 |
|
|---|
| 40 |
foreach ($ttags as $ttag) { |
|---|
| 41 |
$ttags_list = $ttags_list . '<a href="' . $link . $ttag . '" rel="tag">'.$ttag.'</a>'; |
|---|
| 42 |
$ttags_list = $ttags_list . '  '; |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
$ttags_list = $ttags_list . '</span>'; |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
$text = $text . $ttags_list; |
|---|
| 49 |
|
|---|
| 50 |
return $text; |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
add_filter('the_content', 'technotag'); |
|---|
| 54 |
add_filter('comment_text', 'technotag'); |
|---|
| 55 |
|
|---|
| 56 |
?> |
|---|
| 57 |
|
|---|