aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-29 18:13:14 -0800
committerfriendica <info@friendica.com>2015-01-29 18:13:14 -0800
commit219fe3a8e7f805eb0898c1931de304c602315eae (patch)
tree6dc26acb726f56368402a3b5a27e45fbca3ba2d3 /include/bbcode.php
parent43f5fbddc6db09adb54148fb6d44c4375b5f8b7a (diff)
downloadvolse-hubzilla-219fe3a8e7f805eb0898c1931de304c602315eae.tar.gz
volse-hubzilla-219fe3a8e7f805eb0898c1931de304c602315eae.tar.bz2
volse-hubzilla-219fe3a8e7f805eb0898c1931de304c602315eae.zip
bring back inline images
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 5504dce7a..7067fcd39 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -57,7 +57,7 @@ function bb_unspacefy_and_trim($st) {
return $unspacefied;
}
-if(! function_exists('bb_extract_images')) {
+
function bb_extract_images($body) {
$saved_image = array();
@@ -97,24 +97,27 @@ function bb_extract_images($body) {
$new_body = $new_body . $orig_body;
return array('body' => $new_body, 'images' => $saved_image);
-}}
+}
+
-if(! function_exists('bb_replace_images')) {
function bb_replace_images($body, $images) {
$newbody = $body;
$cnt = 0;
+ if(! $images)
+ return $newbody;
+
foreach($images as $image) {
// We're depending on the property of 'foreach' (specified on the PHP website) that
// it loops over the array starting from the first element and going sequentially
// to the last element
- $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img class="zrl" src="' . $image .'" alt="' . t('Image/photo') . '" />', $newbody);
+ $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . $image .'" alt="' . t('Image/photo') . '" />', $newbody);
$cnt++;
}
-
+// logger('replace_images: ' . $newbody);
return $newbody;
-}}
+}
@@ -404,6 +407,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
}
+ $x = bb_extract_images($Text);
+ $Text = $x['body'];
+ $saved_images = $x['images'];
+
$Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text);
@@ -853,6 +860,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = preg_replace("/\<(.*?)(src|href)=\"[^hfm#](.*?)\>/ism",'<$1$2="">',$Text);
+ $Text = bb_replace_images($Text,$saved_images);
+
call_hooks('bbcode',$Text);
return $Text;