コード例 #1
0
 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]);
     }
 }
コード例 #2
0
 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]);
 }
コード例 #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];
 }
コード例 #4
0
ファイル: StrHelperTest.php プロジェクト: petun/ipad-slider
 public function testRemoveEmoji()
 {
     $text = '💙👆🏼🤗☺️';
     $result = StrHelper::removeEmoji($text);
     var_dump($result);
 }