]> git.mxchange.org Git - friendica.git/commitdiff
Fall back to normal twitter share if rich OEmbed is disabled
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 7 Jan 2018 02:57:58 +0000 (21:57 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sun, 7 Jan 2018 02:57:58 +0000 (21:57 -0500)
- Fix typo

include/bbcode.php
src/Content/OEmbed.php

index 3e82f90a165d8347ddeaeeb0f76c7852229f2ee9..ab599e7c919f6aff122806c2101b996d655653a5 100644 (file)
@@ -586,8 +586,8 @@ function bb_ShareAttributes($share, $simplehtml)
                        }
                        break;
                default:
-                       // Transforms quoted tweets in rich attachments to avoid nested tweetsx
-                       if (stripos(normalise_link($link), 'http://twitter.com/') === 0) {
+                       // Transforms quoted tweets in rich attachments to avoid nested tweets
+                       if (stripos(normalise_link($link), 'http://twitter.com/') === 0 && OEmbed::isAllowedURL($link)) {
                                $bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $link, $preshare), $link, $preshare);
                                $text = $preshare . tryoembed($bookmark);
                        } else {
index 0095d2b3cb33db58d50220322a3f5b63a34996ee..4aaae4d5dca37effc185eeee2c6cb5b0117e7d92 100644 (file)
@@ -284,6 +284,27 @@ class OEmbed
                }\r
        }\r
 \r
+       /**\r
+        * Determines if rich content OEmbed is allowed for the provided URL\r
+        *\r
+        * @brief Determines if rich content OEmbed is allowed for the provided URL\r
+        * @param string $url\r
+        * @return boolean\r
+        */\r
+       public static function isAllowedURL($url)\r
+       {\r
+               if (!Config::get('system', 'no_oembed_rich_content')) {\r
+                       return true;\r
+               }\r
+\r
+               $domain = parse_url($url, PHP_URL_HOST);\r
+\r
+               $str_allowed = Config::get('system', 'allowed_oembed', '');\r
+               $allowed = explode(',', $str_allowed);\r
+\r
+               return allowed_domain($domain, $allowed, true);\r
+       }\r
+\r
        /**\r
         * @brief Generates the iframe HTML for an oembed attachment.\r
         *\r
@@ -352,24 +373,4 @@ class OEmbed
                return $innerHTML;\r
        }\r
 \r
-       /**\r
-        * Determines if rich content OEmbed is allowed for the provided URL\r
-        *\r
-        * @brief Determines if rich content OEmbed is allowed for the provided URL\r
-        * @param string $url\r
-        * @return boolean\r
-        */\r
-       private static function isAllowedURL($url)\r
-       {\r
-               if (!Config::get('system', 'no_oembed_rich_content')) {\r
-                       return true;\r
-               }\r
-\r
-               $domain = parse_url($url, PHP_URL_HOST);\r
-\r
-               $str_allowed = Config::get('system', 'allowed_oembed', '');\r
-               $allowed = explode(',', $str_allowed);\r
-\r
-               return allowed_domain($domain, $allowed, true);\r
-       }\r
 }\r