aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorMichael Meer <michael@meer.name>2014-01-30 10:21:21 +0100
committerMichael Meer <michael@meer.name>2014-01-30 10:21:21 +0100
commite5d1e20ff50f49909e7df6fe7efe0d7488e58eaa (patch)
treea3e0b7d7e1f9a4a8a2af39d5c8fad8d62f0411a3 /include/bbcode.php
parentef97a454bbccbd9f7e0e63180c365ed3227fe42c (diff)
parent6c6a9b963a925d33b2cc436d877a4edc5f0d59b1 (diff)
downloadvolse-hubzilla-e5d1e20ff50f49909e7df6fe7efe0d7488e58eaa.tar.gz
volse-hubzilla-e5d1e20ff50f49909e7df6fe7efe0d7488e58eaa.tar.bz2
volse-hubzilla-e5d1e20ff50f49909e7df6fe7efe0d7488e58eaa.zip
Merge branch 'master' of https://github.com/friendica/red
to be in sync with master repro
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php49
1 files changed, 39 insertions, 10 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index fec8750e9..2e2faddd6 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -531,23 +531,52 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
"<br /><strong class=".'"author"'.">" . $t_wrote . "</strong><blockquote>$2</blockquote>",
$Text);
- // [img=widthxheight]image source[/img]
- //$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '<img src="$3" style="height: $2px; width: $1px;" >', $Text);
- if (strpos($Text,'[/img]') !== false) {
- $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '<img src="$3" style="width: $1px;" >', $Text);
- }
- if (strpos($Text,'[/zmg]') !== false) {
- $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$3" style="width: $1px;" >', $Text);
- }
// Images
// [img]pathtoimage[/img]
- if (strpos($Text,'[/img]') !== false) {
+ if (strpos($Text,'[/img]') !== false) {
$Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . t('Image/photo') . '" />', $Text);
}
- if (strpos($Text,'[/zmg]') !== false) {
+ if (strpos($Text,'[/zmg]') !== false) {
$Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$1" alt="' . t('Image/photo') . '" />', $Text);
}
+ // [img float={left, right}]pathtoimage[/img]
+ if (strpos($Text,'[/img]') !== false) {
+ $Text = preg_replace("/\[img float=left\](.*?)\[\/img\]/ism", '<img src="$1" style="float: left;" alt="' . t('Image/photo') . '" />', $Text);
+ }
+ if (strpos($Text,'[/img]') !== false) {
+ $Text = preg_replace("/\[img float=right\](.*?)\[\/img\]/ism", '<img src="$1" style="float: right;" alt="' . t('Image/photo') . '" />', $Text);
+ }
+ if (strpos($Text,'[/zmg]') !== false) {
+ $Text = preg_replace("/\[zmg float=left\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$1" style="float: left;" alt="' . t('Image/photo') . '" />', $Text);
+ }
+ if (strpos($Text,'[/zmg]') !== false) {
+ $Text = preg_replace("/\[zmg float=right\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$1" style="float: right;" alt="' . t('Image/photo') . '" />', $Text);
+ }
+
+ // [img=widthxheight]pathtoimage[/img]
+ if (strpos($Text,'[/img]') !== false) {
+ $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '<img src="$3" style="width: $1px;" alt="' . t('Image/photo') . '" >', $Text);
+ }
+ if (strpos($Text,'[/zmg]') !== false) {
+ $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$3" style="width: $1px;" alt="' . t('Image/photo') . '" >', $Text);
+ }
+
+ // [img=widthxheight float={left, right}]pathtoimage[/img]
+ if (strpos($Text,'[/img]') !== false) {
+ $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*) float=left\](.*?)\[\/img\]/ism", '<img src="$3" style="width: $1px; float: left;" alt="' . t('Image/photo') . '" >', $Text);
+ }
+ if (strpos($Text,'[/img]') !== false) {
+ $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*) float=right\](.*?)\[\/img\]/ism", '<img src="$3" style="width: $1px; float: right;" alt="' . t('Image/photo') . '" >', $Text);
+ }
+ if (strpos($Text,'[/zmg]') !== false) {
+ $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*) float=left\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$3" style="width: $1px; float: left;" alt="' . t('Image/photo') . '" >', $Text);
+ }
+ if (strpos($Text,'[/zmg]') !== false) {
+ $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*) float=right\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$3" style="width: $1px; float: right;" alt="' . t('Image/photo') . '" >', $Text);
+ }
+
+ // crypt
if (strpos($Text,'[/crypt]') !== false) {
$x = random_string();
$Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism",'<br/><div id="' . $x . '"><img src="' .$a->get_baseurl() . '/images/lock_icon.gif" onclick="red_decrypt(\'rot13\',\'\',\'$1\',\'#' . $x . '\');" alt="' . t('Encrypted content') . '" title="' . t('Encrypted content') . '" /><br /></div>', $Text);