http://sitio1.com/?id=93023
a
http://otrositio.com/?url=93023
Osea sustituir sitio1.com/?id= a otrositio.com/?url=93023
Alguien que me pueda ayudar? Les agradeceria :)
Código PHP:
<?php
/*
Plugin Name: gorzek's BBCode Filter
Plugin URI: http://www.gorzek.com/dev/wordpress-dev/bbcode-filter
Description: Parses BBCode tags within WordPress posts.
Version: 0.0.4
Author: gorzek [[email protected]]
Author URI: http://www.gorzek.com
*/
add_filter('the_content','bbcode',1,1);
add_filter('comment_text','bbcode',1,1);
add_filter('the_excerpt','bbcode',1,1);
// Remove BBCode from these.
add_filter('comment_text_rss','bbcode_strip',1,1);
add_filter('the_excerpt_rss','bbcode_strip',1,1);
add_filter('the_content_rss','bbcode_strip',1,1);
function bbcode($content)
{
/* Supported codes:
[b]...[/b]
[i]...[/i]
[noparse][url="http..."]...[/url][/noparse]
[noparse][url]http...[/url][/noparse]
[u]...[/u]
[s]...[/s]
[quote]...[/quote]
[code]...[/code]
[size=n]...[/size]
[color=#nnnnnn]...[/color]
[img]http...[/img]
[ol]
[li]...ordered list...
[/ol]
[ul]
[li]...unordered list...
[/ul]
*/
$bbcode = array(
"/\[b\](.*?)\[\/b\]/is" => "<strong>$1</strong>",
"/\[u\](.*?)\[\/u\]/is" => "<u>$1</u>",
"/\[i\](.*?)\[\/i\]/is" => "<em>$1</em>",
"/\[s\](.*?)\[\/s\]/is" => "<s>$1</s>",
"/\[url\](.*?)\[\/url\]/is" => "<a href='$1'>$1</a>",
"/\[url\=(.*?)\](.*?)\[\/url\]/is" => "<a href='$1'>$2</a>",
"/\[quote\](.*?)\[\/quote\]/is" => "<blockquote>$1</blockquote>",
"/\[code\](.*?)\[\/code\]/is" => "<pre>$1</pre>",
"/\[size=(.*?)\](.*?)\[\/size\]/is" => "<font size=$1>$2</font>",
"/\[color=(.*?)\](.*?)\[\/color\]/is" => "<font color=$1>$2</font>",
"/\[img\](.*?)\[\/img\]/is" => "<img src=$1 />",
"/\[ol\]/is" => "<ol>",
"/\[\/ol\]/is" => "</ol>",
"/\[ul\]/is" => "<ul>",
"/\[\/ul\]/is" => "</ul>",
"/\[li\]/is" => "<li>",
"/\[\/li\]/is" => "</li>",
);
$content = preg_replace(array_keys($bbcode), array_values($bbcode), $content);
return $content;
}
function bbcode_strip($content)
{
$bbcode = array(
"/\[b\](.*?)\[\/b\]/is" => "$1",
"/\[u\](.*?)\[\/u\]/is" => "$1",
"/\[i\](.*?)\[\/i\]/is" => "$1",
"/\[s\](.*?)\[\/s\]/is" => "$1",
"/\[url\](.*?)\[\/url\]/is" => "$1",
"/\[url\=(.*?)\](.*?)\[\/url\]/is" => "$2",
"/\[quote\](.*?)\[\/quote\]/is" => "$1",
"/\[code\](.*?)\[\/code\]/is" => "$1",
"/\[size=(.*?)\](.*?)\[\/size\]/is" => "$2",
"/\[color=(.*?)\](.*?)\[\/color\]/is" => "$2",
"/\[img\](.*?)\[\/img\]/is" => "",
"/\[ol\]/is" => "",
"/\[\/ol\]/is" => "",
"/\[ul\]/is" => "",
"/\[\/ul\]/is" => "",
"/\[li\]/is" => "",
"/\[\/li\]/is" => "",
);
$content = preg_replace(array_keys($bbcode), array_values($bbcode), $content);
return $content;
}
?>