public function renderHtml() { if ($this->_response) { $data = []; foreach ($this->_response as $tweet) { $data[] = ['userImage' => $tweet->user->profile_image_url, 'userName' => $tweet->user->name, 'created' => Date::parse($tweet->created_at)->ago(), 'text' => StrHelper::removeEmoji($tweet->text), 'source' => $tweet->source]; } return Application::getInstance()->jadeEngine()->render(Application::getInstance()->getBasePath() . '/frontend/src/jade/resource/twitter.jade', ['data' => $data]); } }
public function renderHtml() { $media = $this->_currentUser->getFeed(); $data = []; foreach ($media as $photo) { /** @var \Instagram\Media $photo */ $data[] = ['image' => $photo->getLowResImage()->url, 'user' => $photo->getUser()->getUserName(), 'location' => $photo->getLocation() ? $photo->getLocation()->getName() : '', 'date' => Date::createFromTimestamp($photo->getCreatedTime())->ago(), 'caption' => $photo->getCaption() ? StrHelper::removeEmoji($photo->getCaption()->getText()) : '']; } if ($this->limit) { $data = array_chunk($data, $this->limit)[0]; } $template = $this->style ? 'instagram_' . $this->style : 'instagram'; return Application::getInstance()->jadeEngine()->render(__DIR__ . '/../../frontend/src/jade/resource/' . $template . '.jade', ['data' => $data]); }
public function testRemoveEmoji() { $text = '💙👆🏼🤗☺️'; $result = StrHelper::removeEmoji($text); var_dump($result); }