Пример #1
0
 public function notFound()
 {
     if (!headers_sent()) {
         header('HTTP/1.0 404 Not Found');
     }
     $this->data['pageType'] = 'not-found';
     $this->data['content'] = '<h1>' . $this->i18n->trans('page_not_found', ['ucf']) . '</h1>';
     $this->view->render('_layout.php', $this->data, true);
 }
Пример #2
0
 /**
  * @param \Darathor\Core\I18n $i18n
  * @return string
  */
 public function getText(\Darathor\Core\I18n $i18n)
 {
     if (isset($this->data['video_info']['duration_millis'])) {
         $args = ['seconds' => (int) ($this->data['video_info']['duration_millis'] / 1000), 'minutes' => 0, 'hours' => 0];
         if ($args['seconds'] > 60) {
             $args['minutes'] = (int) ($args['seconds'] / 60);
             $args['seconds'] %= 60;
         }
         if ($args['minutes'] > 60) {
             $args['hours'] = (int) ($args['minutes'] / 60);
             $args['minutes'] %= 60;
         }
         if ($args['hours']) {
             return $i18n->trans('duration', ['ucf', 'lab']) . ' ' . $i18n->trans('duration_hours', [], $args);
         } elseif ($args['minutes']) {
             return $i18n->trans('duration', ['ucf', 'lab']) . ' ' . $i18n->trans('duration_minutes', [], $args);
         } else {
             return $i18n->trans('duration', ['ucf', 'lab']) . ' ' . $i18n->trans('duration_seconds', [], $args);
         }
     } else {
         return null;
     }
 }
Пример #3
0
 /**
  * Returns the nicely-formatted date of the tweet.
  * @param \Darathor\Core\I18n $i18n
  * @return string
  */
 public function getFormattedRetweetDate(\Darathor\Core\I18n $i18n)
 {
     return $this->retweeted ? $i18n->transDateTime(new \DateTime($this->created_at)) : '';
 }