Inheritance: extends common\Locale
Esempio n. 1
0
 /**
  * @param string $locale
  * @param AbstractPlatform $platform
  *
  * @return Locale
  */
 public function convertToPHPValue($locale, AbstractPlatform $platform)
 {
     if (APPLICATION === 'frontend') {
         return FrontendLocale::fromString($locale);
     }
     return BackendLocale::fromString($locale);
 }
Esempio n. 2
0
 /**
  * Execute the extra
  */
 public function execute()
 {
     parent::execute();
     $contentBlock = $this->get('content_blocks.repository.content_block')->findOneByIdAndLocale((int) $this->data['id'], Locale::frontendLanguage());
     // if the content block is not found or if it is hidden, just return an array with empty text
     // @deprecated fix this for version 5, we just shouldn't assign this instead of this hack, but we need it for BC
     if (!$contentBlock instanceof ContentBlock || $contentBlock->isHidden()) {
         $contentBlock = ['text' => ''];
     }
     $this->tpl->assign('widgetContentBlocks', $contentBlock);
     // That's all folks!
 }
Esempio n. 3
0
 /**
  * Formats a timestamp as a string that indicates the time ago
  *    syntax: {{ $string|timeago }}.
  *
  * @param string $string A UNIX-timestamp that will be formatted as a time-ago-string.
  *
  * @return string
  */
 public static function timeAgo($string = null)
 {
     $string = (int) $string;
     // invalid timestamp
     if ($string == 0) {
         return '';
     }
     // return
     return '<abbr title="' . \SpoonDate::getDate(FrontendModel::get('fork.settings')->get('Core', 'date_format_long') . ', ' . FrontendModel::get('fork.settings')->get('Core', 'time_format'), $string, Locale::frontendLanguage()) . '">' . \SpoonDate::getTimeAgo($string, Locale::frontendLanguage()) . '</abbr>';
 }