aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-10-30 16:56:58 -0700
committerfriendica <info@friendica.com>2013-10-30 16:56:58 -0700
commit6af8fa36eec5000a7c267ff49cc9191b63a1ec16 (patch)
tree06a5e9c180286ba78c6ac34c1c062d4109a2be3e /include
parent1ec35447d31a78051269a7280a9e455e6262e8fd (diff)
parent09d5fa6a64e9cf7d3e0cf182dbdd492546db198b (diff)
downloadvolse-hubzilla-6af8fa36eec5000a7c267ff49cc9191b63a1ec16.tar.gz
volse-hubzilla-6af8fa36eec5000a7c267ff49cc9191b63a1ec16.tar.bz2
volse-hubzilla-6af8fa36eec5000a7c267ff49cc9191b63a1ec16.zip
Merge pull request #188 from zzottel/master
Use only one regex for title matching in rpost tag
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 48e13b06f..9ca8e3f03 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -179,10 +179,10 @@ function bb_ShareAttributesSimple($match) {
}
function rpost_callback($match) {
- if (count($match) == 3) {
- return str_replace($match[0],get_rpost_path(get_app()->get_observer()) . '&title=' . urlencode($match[1]) . '&body=' . urlencode($match[2]),$match[0]);
+ if ($match[2]) {
+ return str_replace($match[0],get_rpost_path(get_app()->get_observer()) . '&title=' . urlencode($match[2]) . '&body=' . urlencode($match[3]),$match[0]);
} else {
- return str_replace($match[0],get_rpost_path(get_app()->get_observer()) . '&body=' . urlencode($match[1]),$match[0]);
+ return str_replace($match[0],get_rpost_path(get_app()->get_observer()) . '&body=' . urlencode($match[3]),$match[0]);
}
}
@@ -233,12 +233,11 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
if ($observer) {
$Text = preg_replace("/\[observer\=1\](.*?)\[\/observer\]/ism", '$1', $Text);
$Text = preg_replace("/\[observer\=0\].*?\[\/observer\]/ism", '', $Text);
- $Text = preg_replace_callback("/\[rpost\](.*?)\[\/rpost\]/ism", 'rpost_callback', $Text);
- $Text = preg_replace_callback("/\[rpost\=(.*?)\](.*?)\[\/rpost\]/ism", 'rpost_callback', $Text);
+ $Text = preg_replace_callback("/\[rpost(=(.*?))?\](.*?)\[\/rpost\]/ism", 'rpost_callback', $Text);
} else {
$Text = preg_replace("/\[observer\=1\].*?\[\/observer\]/ism", '', $Text);
$Text = preg_replace("/\[observer\=0\](.*?)\[\/observer\]/ism", '$1', $Text);
- $Text = preg_replace("/\[rpost\](.*?)\[\/rpost\]/ism", '', $Text);
+ $Text = preg_replace("/\[rpost(=.*?)?\](.*?)\[\/rpost\]/ism", '', $Text);
}
}