当前位置: 首页>>代码示例>>PHP>>正文


PHP LocaleUtil::localizeDate方法代码示例

本文整理汇总了PHP中LocaleUtil::localizeDate方法的典型用法代码示例。如果您正苦于以下问题:PHP LocaleUtil::localizeDate方法的具体用法?PHP LocaleUtil::localizeDate怎么用?PHP LocaleUtil::localizeDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LocaleUtil的用法示例。


在下文中一共展示了LocaleUtil::localizeDate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLastSentLocalized

 public function getLastSentLocalized($sFormat = 'x')
 {
     if ($this->getLastSent() != null) {
         return LocaleUtil::localizeDate($this->getLastSent(), null, $sFormat);
     }
     return null;
 }
开发者ID:rapila,项目名称:plugin-newsletter,代码行数:7,代码来源:Newsletter.php

示例2: getCreatedAtLocalized

 public function getCreatedAtLocalized($sFormat = ' %e. %B %Y')
 {
     if (Session::language() === 'en') {
         $sFormat = ' %e %B %Y';
     }
     return LocaleUtil::localizeDate($this->created_at, null, $sFormat);
 }
开发者ID:rapila,项目名称:plugin-journal,代码行数:7,代码来源:JournalComment.php

示例3: send

 /** send()
  * Description:
  * • This method is called when NewsletterMailer is instanciated
  * • All newsletter, sender and recipient info are ready
  *
  * @return boolean has_invalid email addresses
  */
 public function send()
 {
     // Get newsletter email main template and template body and css by template name
     $oEmailTemplate = new Template('main', array(DIRNAME_TEMPLATES, 'newsletter'));
     $oEmailTemplate->replaceIdentifier('newsletter_template_css', new Template("{$this->oNewsletter->getTemplateName()}.css", array(DIRNAME_TEMPLATES, 'newsletter')));
     // Parse links differently in text
     RichtextUtil::$USE_ABSOLUTE_LINKS = LinkUtil::isSSL();
     $oEMailContent = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($this->oNewsletter->getNewsletterBody()));
     RichtextUtil::$USE_ABSOLUTE_LINKS = null;
     // Replace add surrounding (body.tmpl) before content if exists. Template needs to contain a newsletter_content identifier
     if (ResourceFinder::findResource(array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME, "{$this->oNewsletter->getTemplateName()}.body.tmpl")) !== null) {
         $oEmailTemplate->replaceIdentifier('newsletter_content', new Template("{$this->oNewsletter->getTemplateName()}.body", array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME)), null, Template::LEAVE_IDENTIFIERS);
     }
     $oEmailTemplate->replaceIdentifier('newsletter_content', $oEMailContent, null, Template::LEAVE_IDENTIFIERS);
     $oEmailTemplate->replaceIdentifier('subject', $this->oNewsletter->getSubject());
     $oEmailTemplate->replaceIdentifier('language', $this->oNewsletter->getLanguageId());
     $oEmailTemplate->replaceIdentifier('newsletter_link', LinkUtil::absoluteLink($this->oNewsletter->getDisplayLink()));
     $oEmailTemplate->replaceIdentifier('newsletter_date', LocaleUtil::localizeDate(null, $this->oNewsletter->getLanguageId()));
     $oEmailTemplate->replaceIdentifier('newsletter_timestamp', time());
     // Process templates with each recipient, depending on whether recipient is object and object of Subscriber or string
     foreach ($this->aRecipients as $mRecipient) {
         $this->sendNewsletter($mRecipient, clone $oEmailTemplate);
     }
     return count($this->aInvalidEmails) === 0;
 }
开发者ID:rapila,项目名称:plugin-newsletter,代码行数:32,代码来源:NewsletterMailer.php

示例4: getPublishAtFormatted

 public function getPublishAtFormatted($sLanguageId = null, $sFormatString = 'x')
 {
     if ($this->publish_at === null) {
         return null;
     }
     return LocaleUtil::localizeDate($this->publish_at, $sLanguageId, $sFormatString);
 }
开发者ID:rapila,项目名称:plugin-journal,代码行数:7,代码来源:JournalEntry.php

示例5: getDateSentFormatted

 public function getDateSentFormatted($sAddTimeFormat = null)
 {
     $sTime = LocaleUtil::localizeDate($this->date_sent);
     if ($sAddTimeFormat) {
         $sTime .= ' ' . $this->getDateSent($sAddTimeFormat);
     }
     return $sTime;
 }
开发者ID:rapila,项目名称:plugin-newsletter,代码行数:8,代码来源:NewsletterMailing.php

示例6: testParseBackLongDateAsInGems

 public function testParseBackLongDateAsInGems()
 {
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = "en-gb,en;q=0.8,de-de;q=0.5,de-ch;q=0.3";
     $sDate = "10.03.2008";
     $iTimestamp = LocaleUtil::parseLocalizedDate($sDate, "de");
     $this->assertSame(1205107200, $iTimestamp);
     $this->assertSame($sDate, LocaleUtil::localizeDate($iTimestamp, "de"));
 }
开发者ID:rapila,项目名称:cms-base,代码行数:8,代码来源:UtilDateFunctionTests.php

示例7: renderFile

 /**
  * renderFile()
  * @return string xhtml output
  */
 public function renderFile()
 {
     $oOutput = new XHTMLOutput(XHTMLOutput::SETTING_HTML_4_TRANSITIONAL, true, null, $this->oNewsletter->getLanguageId());
     $oOutput->render();
     $oNewsletterTemplate = new Template('main_display', array(DIRNAME_TEMPLATES, 'newsletter'), false, true);
     $oNewsletterTemplate->replaceIdentifier('newsletter_template_css', new Template("{$this->oNewsletter->getTemplateName()}.css", array(DIRNAME_TEMPLATES, 'newsletter')));
     $oNewsletterContent = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($this->oNewsletter->getNewsletterBody()));
     if (ResourceFinder::findResource(array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME, "{$this->oNewsletter->getTemplateName()}.body.tmpl")) !== null) {
         $oNewsletterTemplate->replaceIdentifier('newsletter_content', new Template("{$this->oNewsletter->getTemplateName()}.body", array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME)), null, Template::LEAVE_IDENTIFIERS);
     }
     $oNewsletterTemplate->replaceIdentifier('newsletter_content', $oNewsletterContent, null, Template::LEAVE_IDENTIFIERS);
     $oNewsletterTemplate->replaceIdentifier('language', $this->oNewsletter->getLanguageId());
     if ($this->oMailing !== null) {
         $oNewsletterTemplate->replaceIdentifier('newsletter_date', LocaleUtil::localizeDate($this->oMailing->getDateSent(null)->getTimestamp(), $this->oNewsletter->getLanguageId()));
         $oNewsletterTemplate->replaceIdentifier('newsletter_timestamp', $this->oMailing->getDateSent(null)->getTimestamp());
     } else {
         $oNewsletterTemplate->replaceIdentifier('newsletter_date', LocaleUtil::localizeDate($this->oNewsletter->getCreatedAt(null)->getTimestamp(), $this->oNewsletter->getLanguageId()));
         $oNewsletterTemplate->replaceIdentifier('newsletter_timestamp', $this->oNewsletter->getCreatedAt(null)->getTimestamp());
     }
     $oNewsletterTemplate->replaceIdentifier('recipient', TranslationPeer::getString('wns.newsletter.recipient', $this->oNewsletter->getLanguageId()));
     $oNewsletterTemplate->replaceIdentifier('subject', $this->oNewsletter->getSubject());
     $oNewsletterTemplate->render();
 }
开发者ID:rapila,项目名称:plugin-newsletter,代码行数:27,代码来源:DisplayNewsletterFileModule.php

示例8: writeDate

 public function writeDate($oTemplateIdentifier)
 {
     $iTimestamp = false;
     if ($oTemplateIdentifier->hasParameter('timestamp')) {
         $iTimestamp = (int) $oTemplateIdentifier->getParameter('timestamp');
     } else {
         if ($oTemplateIdentifier->hasParameter('format')) {
             $iTimestamp = DateTime::createFromFormat($oTemplateIdentifier->getParameter('format'), $oTemplateIdentifier->getParameter('date'));
         }
     }
     $sLocaleId = null;
     if ($oTemplateIdentifier->hasParameter('locale')) {
         $sLocaleId = $oTemplateIdentifier->getParameter('locale');
     }
     return LocaleUtil::localizeDate($iTimestamp, $sLocaleId, $oTemplateIdentifier->getValue());
 }
开发者ID:rapila,项目名称:cms-base,代码行数:16,代码来源:SpecialTemplateIdentifierActions.php

示例9: renderCollapsibleDateTreeWidget

 /**
  * renderCollapsibleDateTreeWidget()
  *
  * description: display collapsible date tree without link on year
  * include javascript file web/js/journal-collapsible-date-tree.js
  * @return Template object
  */
 private function renderCollapsibleDateTreeWidget()
 {
     $iTreeWidgetLevels = Settings::getSetting('journal', 'display_journal_collapsible_tree_levels', 2);
     $oTemplate = $this->constructTemplate('widget_collapsible_date_tree');
     if ($this->archiveIsActive()) {
         $sHref = LinkUtil::link($this->oPage->getLinkArray());
         $oTemplate->replaceIdentifier('reset_archive_href', $sHref, null, Template::NO_HTML_ESCAPE);
     }
     $oItemPrototype = $this->constructTemplate('widget_collapsible_date_tree_item');
     $sPreviousYear = null;
     $sPreviousMonth = null;
     $aStack = array($oTemplate);
     $cReduceToLevel = function ($iLevel) use(&$aStack) {
         while (count($aStack) > $iLevel) {
             $oPreviousTemplate = array_pop($aStack);
             $oCurrentTemplate = $aStack[count($aStack) - 1];
             $oCurrentTemplate->replaceIdentifierMultiple('items', $oPreviousTemplate, null, Template::NO_NEW_CONTEXT);
         }
     };
     $oPage = $this->oPage;
     $cOutput = function ($aDate, $sFormat, $bIsActive) use(&$aStack, $oItemPrototype, $oPage) {
         $oTemplate = clone $oItemPrototype;
         array_push($aStack, $oTemplate);
         foreach ($aDate as $sPeriod => $sValue) {
             $oTemplate->replaceIdentifier(strtolower($sPeriod), $sValue);
         }
         $oDate = new DateTime();
         $oDate->setDate($aDate['Year'], @$aDate['Month'] ? $aDate['Month'] : 1, @$aDate['Day'] ? $aDate['Day'] : 1);
         $oTemplate->replaceIdentifier('full_name', LocaleUtil::localizeDate($oDate, null, $sFormat));
         $aKeys = array_keys($aDate);
         $oTemplate->replaceIdentifier('name', $aDate[$aKeys[count($aKeys) - 1]]);
         $oTemplate->replaceIdentifier('level', count($aKeys));
         $oTemplate->replaceIdentifier('link', LinkUtil::link($oPage->getFullPathArray(array_values($aDate))));
         if ($bIsActive) {
             $oTemplate->replaceIdentifier('class_is_active', 'is_active');
         }
     };
     foreach ($this->createQuery()->filterByJournalId($this->aJournalIds)->findDistinctDates() as $aDate) {
         $oCurrentTemplate = null;
         // Make year template whenever the year changes and add it to main template
         if ($aDate['Year'] !== $sPreviousYear) {
             $cReduceToLevel(1);
             $sPreviousYear = $aDate['Year'];
             $cOutput(array('Year' => $aDate['Year']), 'Y', $this->iYear === $aDate['Year']);
         }
         // Render 2nd level months
         if ($iTreeWidgetLevels === 1) {
             continue;
         }
         // Make month template whenever month changes (or year, because it can happen that two months are the same when a year changes)
         // Add it to year template
         if ($aDate['Year'] !== $sPreviousYear || $aDate['Month'] !== $sPreviousMonth) {
             $cReduceToLevel(2);
             $sPreviousMonth = $aDate['Month'];
             $cOutput(array('Year' => $aDate['Year'], 'Month' => $aDate['Month']), 'B', $this->iMonth === $aDate['Month']);
         }
         // Render 3rd level days
         if ($iTreeWidgetLevels === 2) {
             continue;
         }
         $cReduceToLevel(3);
         $cOutput(array('Year' => $aDate['Year'], 'Month' => $aDate['Month'], 'Day' => $aDate['Day']), 'x', $this->iDay === $aDate['Day']);
     }
     $cReduceToLevel(1);
     return $oTemplate;
 }
开发者ID:rapila,项目名称:plugin-journal,代码行数:73,代码来源:JournalPageTypeModule.php


注:本文中的LocaleUtil::localizeDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。