diff options
author | friendica <info@friendica.com> | 2014-01-07 20:36:16 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-01-07 20:36:16 -0800 |
commit | 8b93881ce7ab4e0a8b0c8426da1ddfeed19c2309 (patch) | |
tree | 52d4b15d798933c068a8eb12374ac192db8fbb42 /include/bbcode.php | |
parent | 401183780540812929e35a59348b7f2e347d4b8f (diff) | |
download | volse-hubzilla-8b93881ce7ab4e0a8b0c8426da1ddfeed19c2309.tar.gz volse-hubzilla-8b93881ce7ab4e0a8b0c8426da1ddfeed19c2309.tar.bz2 volse-hubzilla-8b93881ce7ab4e0a8b0c8426da1ddfeed19c2309.zip |
qr code support
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 01d5df9e3..35ce2b918 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -132,6 +132,9 @@ function bb_parse_crypt($match) { } +function bb_qr($match) { + return '<img class="zrl" src="' . z_root() . '/photo/qr?f=&qr=' . urlencode($match[1]) . '" alt="' . t('QR code') . '" />'; +} function bb_ShareAttributes($match) { @@ -277,6 +280,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { } $Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text); + // Replace any html brackets with HTML Entities to prevent executing HTML or script // Don't use strip_tags here because it breaks [url] search by replacing & with amp @@ -330,6 +334,12 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { if (strpos($Text,'http') !== false) { $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/$urlchars+)/ism", '$1<a href="$2" >$2</a>', $Text); } + + if (strpos($Text,'[/qr]') !== false) { + $Text = preg_replace_callback("/\[qr\](.*?)\[\/qr\]/ism","bb_qr",$Text); + } + + if (strpos($Text,'[/share]') !== false) { $Text = preg_replace_callback("/\[share(.*?)\](.*?)\[\/share\]/ism","bb_ShareAttributes",$Text); } |