Get Twitter hashtag
@return object Feed data
421725
public function getTwitterHashtag()
    {
        $access_token = $this->getTwitterAccessToken();

        if (isset($access_token->errors[0])) {
            return $access_token->errors[0];
        }

        $endpoint = 'https://api.twitter.com/1.1/search/tweets.json';
        $data = array(
            'access_token'     => $access_token,
            'q'                => urlencode('#' . $this->args['query']),
            'count'            => $this->args['length'],
            'exclude_replies'  => true,
            'include_rts '     => false,
            'result_type'      => 'recent',
            'lang'             => 'sv'
        );

        // Request headers
        $headers = array(
            "GET /1.1/search/tweets.json" . http_build_query($data) . " HTTP/1.1",
            "Host: api.twitter.com",
            "User-Agent: jonhurlock Twitter Application-only OAuth App v.1",
            "Authorization: Bearer " . $access_token
        );

        // Curl
        $curl = new \Modularity\Helper\Curl();
        $tweets = $curl->request('GET', $endpoint, $data, 'JSON', $headers);

        return json_decode($tweets)->statuses;
    }
153889
public function get_content() {
        if (isset($this->content)) {
            return $this->content;
        }

        $sort = get_user_preferences('block_timeline_user_sort_preference');
        $filter = get_user_preferences('block_timeline_user_filter_preference');
        $limit = get_user_preferences('block_timeline_user_limit_preference');

        $renderable = new \block_timeline\output\main($sort, $filter, $limit);
        $renderer = $this->page->get_renderer('block_timeline');

        $this->content = (object) [
            'text' => $renderer->render($renderable),
            'footer' => ''
        ];

        return $this->content;
    }
327003
public static function TweetHandler($arguments)
    {
        if (!isset($arguments['id'])) {
            return null;
        }
        if (substr($arguments['id'], 0, 4) === 'http') {
            list($unneeded, $id) = explode('/status/', $arguments['id']);
        } else {
            $id = $arguments['id'];
        }
        $data = json_decode(file_get_contents('https://api.twitter.com/1/statuses/oembed.json?id=' . $id . '&omit_script=true&lang=en'), 1);

        return $data['html'];
    }
878644
public function getFollowers(){

        $followers = array();
        $sections = $this->getSections();

        if($sections != null){
            foreach($sections as $section){

                $users = $section->getUsers();
                if($users != null){
                    foreach($users as $user){
                        $followers[] = $user;
                    }
                }

            }
        }

        return $followers;

    }
769581
public function getCurrentTag()
    {
        /**
         * @var Blog $dataRecord
         */
        $dataRecord = $this->dataRecord;
        $tag = $this->request->param('Tag');
        if ($tag) {
            $filter = URLSegmentFilter::create();
            // url encode unless it's multibyte (already pre-encoded in the database)
            // see https://github.com/silverstripe/silverstripe-cms/pull/2384
            if (!$filter->getAllowMultibyte()) {
                $tag = rawurlencode($tag);
            }

            return $dataRecord->Tags()
                ->filter('URLSegment', $tag)
                ->first();
        }
        return null;
    }
406068
public function getUserDetails()
    {
        $accessToken = $this->getAccessToken();
        $tc = new TokenCredentials();
        $tc->setIdentifier($accessToken['oauth_token']);
        $tc->setSecret($accessToken['oauth_token_secret']);

        $user = $this->instance->getUserDetails($tc);

        $twUserObj = new TwitterOAuthUser($user->nickname);
        $twUserObj->setAvatarUrl($user->imageUrl);
        $twUserObj->setName($user->name);
        $twUserObj->setLocation($user->location);
        $twUserObj->setProfileUrl('https://twitter.com/' . $user->screen_name);
        $twUserObj->setWebsite($user->urls['url']);
        $twUserObj->setDescription($user->description);
        $twUserObj->setProfileId($user->uid);

        return $twUserObj;
    }
370701
public function parse()
    {

        // TODO - Use feed names with alias style like FBL
        // TODO - Use both DATE fields
        // TODO - Try YAML parser?

        $this->feedName = 'default';

        if ($this->isKnownFeed() && $this->isEnabledFeed() && $this->hasArfMail()) {
            // As this is a generic FBL parser we need to see which was the source and add the name
            // to the report, so its origin is clearly shown.
            $source = $this->parsedMail->getHeader('from');
            foreach (config("{$this->configBase}.parser.aliases") as $from => $alias) {
                if (preg_match($from, $source)) {
                    // If there is an alias, prefer that name instead of the from address
                    $source = $alias;

                    // If there is an more specific feed configuration prefer that config over the default
                    if (!empty(config("{$this->configBase}.feeds.{$source}"))) {
                        $this->feedName = $source;
                    }

                }
            }

            if (preg_match_all('/([\w\-]+): (.*)[ ]*\r?\n/', $this->arfMail['report'] . PHP_EOL, $regs)) {
                $report = array_combine($regs[1], $regs[2]);

                if (empty($report['Received-Date'])) {
                    if (!empty($report['Arrival-Date'])) {
                        $report['Received-Date'] = $report['Arrival-Date'];
                        unset($report['Arrival-Date']);
                    }
                }

                if ($this->hasRequiredFields($report) === true) {
                    // incident has all requirements met, filter and add!
                    if ($report['Feedback-Type'] != 'abuse') {
                        return $this->failed(
                            "Unabled to detect the report type from this notifier"
                        );
                    }

                    $report = $this->applyFilters($report);

                    $report['evidence'] = $this->arfMail['evidence'];

                    $incident = new Incident();
                    $incident->source      = $source;
                    $incident->source_id   = false;
                    $incident->ip          = $report['Source-IP'];
                    $incident->domain      = false;
                    $incident->class       = config("{$this->configBase}.feeds.{$this->feedName}.class");
                    $incident->type        = config("{$this->configBase}.feeds.{$this->feedName}.type");
                    $incident->timestamp   = strtotime($report['Received-Date']);
                    $incident->information = json_encode($report);

                    $this->incidents[] = $incident;

                }
            } else {
                $this->warningCount++;
            }
        }

        return $this->success();
    }
711573
public function getTags()
    {
        return \is_string($value = $this->getContentValue('tags', null))
            ? array_unique(array_filter(explode(',', $value)))
            : null;
    }
1301827
public function read(): array
    {
        while (!$this->streamBody->eof()) {
            $tweet = json_decode(
                $this->readStreamLine($this->streamBody),
                true
            );

            if (null !== $tweet) {
                return $tweet;
            }
        }
    }
1033684
public function serialized(): string
    {
        return serialize(
            new self(
                $this->id,
                $this->text,
                $this->lang,
                $this->createdAt,
                $this->timestampMs,
                $this->geo,
                $this->coordinates,
                $this->places,
                $this->retweetCount,
                $this->favoriteCount,
                $this->entities,
                $this->extendedEntities,
                $this->user,
                $this->retweetedStatus
            )
        );
    }
1135552
protected function getTagsFromSphinx()
    {
        if (is_array($this->searchResults) && count($this->searchResults)) {
            return array_map(
                function ($row) {
                    return $row['tags'];
                },
                $this->searchResults
            );
        } else {
            return array();
        }
    }
940335
public function getTagList()
    {
        $string = '';
        foreach ($this->PublicTags() as $t) {
            $string .= Convert::raw2url($t->Name) . ' ';
        }
        return trim($string);
    }
873069
public function getData()
    {
        $tasksToShow = $this->numItems;

        $tasks = $this->taskManager->findByAssignedToAndStatus(
            $this->tokenStorage->getToken()->getUser()->getId(),
            [],
            [],
            $tasksToShow
        );

        $data = [];

        foreach ($tasks as $task) {
            $createUser = $this->userManager->find($task->getCreateUserId());
            $type = $this->types->get($task->getType());

            $data[] = [
                'id' => $task->getId(),
                'text' => $type->getText($task),
                'type' => $task->getType(),
                'status' => $task->getFiniteState(),
                'comment' => '', //$latestStatus->getComment(), TODO: fix
                'create_user' => $createUser->getDisplayName(),
                'create_uid' => $task->getCreateUserId(),
                'create_date' => $task->getCreatedAt()->format('Y-m-d H:i:s'),
            ];
        }

        return $data;
    }
327350
public function getAvatar(){
		//Get User picture
		$params = array(/*'access_token'=>$this->access_token,*/'height'=>512,'width'=>512,'redirect'=>0,'type'=>'square');
		$userPicture = $this->get('https://graph.facebook.com/'.$this->userInfo['id'].'/picture', $params);
		if(!isset($userPicture['data'])) {
			BLog::addToLog('[Social.FB] User photo is not set!',LL_ERROR);
			return false;
			}
		$result=$userPicture['data']['url'];
		return $result;
		}
162138
public function buildTwitter()
    {
        $twitterProvider = new TwitterProvider(array(
            'showUsername' => $this->configResolver->getParameter('twitter.show_username', 'ez_share_buttons'),
            'largeButton' => $this->configResolver->getParameter('twitter.large_button', 'ez_share_buttons'),
            'language' => $this->configResolver->getParameter('twitter.language', 'ez_share_buttons'),
        ));

        return $twitterProvider;
    }
277280
public function get($keyword)
        {
            $response = [];

            if (!empty($this->twitterProvider))
            {
                $results = $this->twitterProvider->getByKeyword($keyword);

                $response = array_merge($response, $results);
            }

            return $response;
        }
710381
public function twitterCardType()
    {
        $context = $this->contextObject();

        $type = null;

        if ($context instanceof HasTwitterCardInterface) {
            $type = $context['twitter_card_type'];
        }

        if (!$type) {
            $type = HasTwitterCardInterface::DEFAULT_TWITTER_CARD_TYPE;
        }

        return $type;
    }