]> git.mxchange.org Git - friendica.git/blobdiff - include/bbcode.php
Throw NotFoundException if results are empty in api_users_lookup
[friendica.git] / include / bbcode.php
index 83ea3fcfa61d9ef9500c87c4de90cf167efe305e..be59c180726860a0292f2e10ef0b9e574afbd56f 100644 (file)
@@ -5,11 +5,11 @@ use Friendica\Content\Smilies;
 use Friendica\Core\Cache;
 use Friendica\Core\System;
 use Friendica\Core\Config;
-use Friendica\Object\Contact;
+use Friendica\Model\Contact;
+use Friendica\Util\Map;
 
 require_once 'include/oembed.php';
 require_once 'include/event.php';
-require_once 'include/map.php';
 require_once 'mod/proxy.php';
 require_once 'include/plaintext.php';
 
@@ -33,11 +33,11 @@ function bb_PictureCache($matches) {
 
 function bb_map_coords($match) {
        // the extra space in the following line is intentional
-       return str_replace($match[0], '<div class="map"  >' . generate_map(str_replace('/', ' ', $match[1])) . '</div>', $match[0]);
+       return str_replace($match[0], '<div class="map"  >' . Map::byCoordinates(str_replace('/', ' ', $match[1])) . '</div>', $match[0]);
 }
 function bb_map_location($match) {
        // the extra space in the following line is intentional
-       return str_replace($match[0], '<div class="map"  >' . generate_named_map($match[1]) . '</div>', $match[0]);
+       return str_replace($match[0], '<div class="map"  >' . Map::byLocation($match[1]) . '</div>', $match[0]);
 }
 
 function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
@@ -52,7 +52,10 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
                $data["title"] = str_replace(array("http://", "https://"), "", $data["title"]);
        }
 
-       if (((strpos($data["text"], "[img=") !== false) || (strpos($data["text"], "[img]") !== false)) && ($data["image"] != "")) {
+       if (((strpos($data["text"], "[img=") !== false)
+               || (strpos($data["text"], "[img]") !== false)
+               || Config::get('system', 'always_show_preview'))
+               && ($data["image"] != "")) {
                $data["preview"] = $data["image"];
                $data["image"] = "";
        }
@@ -373,7 +376,6 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) {
        return $string;
 }
 
-if (! function_exists('bb_extract_images')) {
 function bb_extract_images($body) {
 
        $saved_image = array();
@@ -415,9 +417,8 @@ 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;
@@ -432,7 +433,7 @@ function bb_replace_images($body, $images) {
        }
 
        return $newbody;
-}}
+}
 
 function bb_ShareAttributes($share, $simplehtml) {
        $attributes = $share[2];