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]);
 }
Example #3
0
 private function _getFromArticle(Article $article)
 {
     $img = StrHelper::getImgSrcFromHtml($article->description);
     return ['link' => $article->link, 'pubDate' => Date::parse($article->pubDate)->ago(), 'title' => $article->title, 'description' => StrHelper::wordWrap($article->description), 'img' => $img];
 }
Example #4
0
 public function testRemoveEmoji()
 {
     $text = 'πŸ’™πŸ‘†πŸΌπŸ€—β˜ΊοΈ';
     $result = StrHelper::removeEmoji($text);
     var_dump($result);
 }