Support bbcode size tag - I may regret this...

This commit is contained in:
Friendika 2011-02-08 21:26:28 -08:00
parent 6b8bbef6c7
commit 5899ae9017
4 changed files with 7 additions and 5 deletions

View file

@ -305,9 +305,9 @@ class App {
$this->scheme = $parsed['scheme']; $this->scheme = $parsed['scheme'];
$this->hostname = $parsed['host']; $this->hostname = $parsed['host'];
if($parsed['port']) if(x($parsed,'port'))
$this->hostname .= ':' . $parsed['port']; $this->hostname .= ':' . $parsed['port'];
if($parsed['path']) if(x($parsed,'path'))
$this->path = trim($parsed['path'],'\\/'); $this->path = trim($parsed['path'],'\\/');
} }

View file

@ -49,10 +49,10 @@ function bbcode($Text) {
$Text = preg_replace("(\[o\](.+?)\[\/o\])is",'<span class="overline">$1</span>',$Text); $Text = preg_replace("(\[o\](.+?)\[\/o\])is",'<span class="overline">$1</span>',$Text);
// Check for colored text // Check for colored text
$Text = preg_replace("(\[color=(.+?)\](.+?)\[\/color\])is","<span style=\"color: $1\">$2</span>",$Text); $Text = preg_replace("(\[color=(.+?)\](.+?)\[\/color\])is","<span style=\"color: $1;\">$2</span>",$Text);
// Check for sized text // Check for sized text
$Text = preg_replace("(\[size=(.+?)\](.+?)\[\/size\])is","<span style=\"font-size: $1px\">$2</span>",$Text); $Text = preg_replace("(\[size=(.+?)\](.+?)\[\/size\])is","<span style=\"font-size: $1;\">$2</span>",$Text);
// Check for list text // Check for list text
$Text = preg_replace("/\[list\](.+?)\[\/list\]/is", '<ul class="listbullet">$1</ul>' ,$Text); $Text = preg_replace("/\[list\](.+?)\[\/list\]/is", '<ul class="listbullet">$1</ul>' ,$Text);

View file

@ -26,6 +26,7 @@ function html2bbcode($s) {
'/\<a (.*?)href=\"(.*?)\"(.*?)\>(.*?)\<\/a\>/is', '/\<a (.*?)href=\"(.*?)\"(.*?)\>(.*?)\<\/a\>/is',
'/\<code\>(.*?)\<\/code\>/is', '/\<code\>(.*?)\<\/code\>/is',
'/\<span style=\"color:(.*?)\"\>(.*?)\<\/span\>/is', '/\<span style=\"color:(.*?)\"\>(.*?)\<\/span\>/is',
'/\<span style=\"font-size:(.*?)\"\>(.*?)\<\/span\>/is',
'/\<blockquote\>(.*?)\<\/blockquote\>/is', '/\<blockquote\>(.*?)\<\/blockquote\>/is',
'/\<video(.*?) src=\"(.*?)\" (.*?)\>(.*?)\<\/video\>/is', '/\<video(.*?) src=\"(.*?)\" (.*?)\>(.*?)\<\/video\>/is',
'/\<audio(.*?) src=\"(.*?)\" (.*?)\>(.*?)\<\/audio\>/is', '/\<audio(.*?) src=\"(.*?)\" (.*?)\>(.*?)\<\/audio\>/is',
@ -51,6 +52,7 @@ function html2bbcode($s) {
'[url=$2]$4[/url]', '[url=$2]$4[/url]',
'[code]$1[/code]', '[code]$1[/code]',
'[color="$1"]$2[/color]', '[color="$1"]$2[/color]',
'[size=$1]$2[/size]',
'[quote]$1[/quote]', '[quote]$1[/quote]',
'[video]$1[/video]', '[video]$1[/video]',
'[audio]$1[/audio]', '[audio]$1[/audio]',

View file

@ -103,7 +103,7 @@
rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"<img width=\"$1\" height=\"$2\" src=\"$3\" />"); rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"<img width=\"$1\" height=\"$2\" src=\"$3\" />");
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />"); rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<span style=\"color: $1;\">$2</span>"); rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<span style=\"color: $1;\">$2</span>");
// rep(/\[\/code\]\s*\[code\]/gi,"<br />"); // fold multiline code rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"<span style=\"font-size: $1;\">$2</span>");
rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>"); rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>"); rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");