/** * Auto-link hashtags, URLs, usernames and lists, with JSON entities. * * @param string The tweet to be converted * @param mixed The entities info * @return string that auto-link HTML added * @since 1.1.0 */ public function autoLinkWithJson($tweet = null, $json) { // concatenate entities $entities = array(); if (is_object($json)) { $json = $this->object2array($json); } if (is_array($json)) { foreach ($json as $key => $vals) { $entities = array_merge($entities, $json[$key]); } } // map JSON entity to twitter-text entity foreach ($entities as $idx => $entity) { if (!empty($entity['text'])) { $entities[$idx]['hashtag'] = $entity['text']; } } $entities = $this->extractor->removeOverlappingEntities($entities); return $this->autoLinkEntities($tweet, $entities); }