Merge pull request #774 from annando/fork-check
[friendica-addons.git/.git] / twitter / twitter.php
index 3e57016..73114a0 100644 (file)
@@ -65,6 +65,7 @@ use Abraham\TwitterOAuth\TwitterOAuth;
 use Abraham\TwitterOAuth\TwitterOAuthException;
 use Friendica\App;
 use Friendica\Content\OEmbed;
+use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\Plaintext;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
@@ -1308,7 +1309,7 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
        }
 
        // it seems as if the entities aren't always covering all mentions. So the rest will be checked here
-       $tags = Strings::getTags($body);
+       $tags = BBCode::getTags($body);
 
        if (count($tags)) {
                foreach ($tags as $tag) {
@@ -1847,6 +1848,9 @@ function twitter_fetch_own_contact(App $a, $uid)
                // Fetching user data
                // get() may throw TwitterOAuthException, but we will catch it later
                $user = $connection->get('account/verify_credentials');
+               if (empty($user) || empty($user->id_str)) {
+                       return false;
+               }
 
                PConfig::set($uid, 'twitter', 'own_id', $user->id_str);