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


PHP Date::parse方法代码示例

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


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

示例1: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     $arrJumpTo = array();
     $arrNewsletter = array();
     $strRequest = ampersand(\Environment::get('request'), true);
     $objNewsletter = \NewsletterModel::findSentByPids($this->nl_channels);
     if ($objNewsletter !== null) {
         while ($objNewsletter->next()) {
             /** @var NewsletterChannelModel $objTarget */
             if (!($objTarget = $objNewsletter->getRelated('pid')) instanceof NewsletterChannelModel) {
                 continue;
             }
             $jumpTo = intval($objTarget->jumpTo);
             // A jumpTo page is not mandatory for newsletter channels (see #6521) but required for the list module
             if ($jumpTo < 1) {
                 throw new \Exception("Newsletter channels without redirect page cannot be used in a newsletter list");
             }
             $strUrl = $strRequest;
             if (!isset($arrJumpTo[$objTarget->jumpTo])) {
                 if (($objJumpTo = $objTarget->getRelated('jumpTo')) instanceof PageModel) {
                     /** @var PageModel $objJumpTo */
                     $arrJumpTo[$objTarget->jumpTo] = $objJumpTo->getFrontendUrl(\Config::get('useAutoItem') ? '/%s' : '/items/%s');
                 } else {
                     $arrJumpTo[$objTarget->jumpTo] = $strUrl;
                 }
             }
             $strUrl = $arrJumpTo[$objTarget->jumpTo];
             $strAlias = $objNewsletter->alias ?: $objNewsletter->id;
             $arrNewsletter[] = array('subject' => $objNewsletter->subject, 'title' => \StringUtil::stripInsertTags($objNewsletter->subject), 'href' => sprintf($strUrl, $strAlias), 'date' => \Date::parse($objPage->dateFormat, $objNewsletter->date), 'datim' => \Date::parse($objPage->datimFormat, $objNewsletter->date), 'time' => \Date::parse($objPage->timeFormat, $objNewsletter->date), 'channel' => $objNewsletter->pid);
         }
     }
     $this->Template->newsletters = $arrNewsletter;
 }
开发者ID:contao,项目名称:newsletter-bundle,代码行数:38,代码来源:ModuleNewsletterList.php

示例2: addTypeIcon

 public function addTypeIcon($row, $label, DataContainer $dc, $args = null)
 {
     $args[0] = \Image::getHtml(\Image::get('system/modules/mail_to/assets/mail-open-image.png', 16, 16));
     $objFile = FilesModel::findByUuid($row['folder']);
     $args[2] = $objFile !== null ? $objFile->path : '-';
     $args[5] = Date::parse(Date::getFormatFromRgxp('datim'), $row['lastrun']);
     return $args;
 }
开发者ID:kozi,项目名称:contao-mail_to,代码行数:8,代码来源:tl_mailto.php

示例3: formatOptions

 /**
  * @inheritdoc
  *
  * @param CalendarEventsModel   $current
  * @param CalendarEventsModel[] $models
  */
 protected function formatOptions(Model $current, Model\Collection $models)
 {
     $options = [];
     foreach ($models as $model) {
         $options[$model->id] = sprintf('%s [%s]', $model->title, Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $model->startTime));
     }
     return $options;
 }
开发者ID:terminal42,项目名称:contao-changelanguage,代码行数:14,代码来源:CalendarEventsListener.php

示例4: formatOptions

 /**
  * @inheritdoc
  *
  * @param NewsModel   $current
  * @param NewsModel[] $models
  */
 protected function formatOptions(Model $current, Model\Collection $models)
 {
     $sameDay = $GLOBALS['TL_LANG']['tl_product']['sameDay'];
     $otherDay = $GLOBALS['TL_LANG']['tl_product']['otherDay'];
     $dayBegin = strtotime('0:00', $current->date);
     $options = [$sameDay => [], $otherDay => []];
     foreach ($models as $model) {
         $group = strtotime('0:00', $model->date) === $dayBegin ? $sameDay : $otherDay;
         $options[$group][$model->id] = sprintf('%s (%s) [%s]', $model->title, $model->code, Date::parse($GLOBALS['TL_CONFIG']['dateFormat'], $model->date));
     }
     return $options;
 }
开发者ID:respinar,项目名称:contao-product,代码行数:18,代码来源:ProductListener.php

示例5: getSeparatedNumericDateTimeInterval

 public static function getSeparatedNumericDateTimeInterval($intStartDate = null, $intEndDate = null, $intStartTime = null, $intEndTime = null, $strIntervalDelimiter = ' &ndash; ', $strDelimiter = ', ')
 {
     $strStartDate = \Contao\Date::parse(\Contao\Date::getNumericDateFormat(), $intStartDate);
     $strEndDate = \Contao\Date::parse(\Contao\Date::getNumericDateFormat(), $intEndDate);
     $strStartTime = \Contao\Date::parse(\Contao\Date::getNumericTimeFormat(), $intStartTime);
     $strEndTime = \Contao\Date::parse(\Contao\Date::getNumericTimeFormat(), $intEndTime);
     $strResult = $strStartDate;
     if ($intEndDate > 0 && $intEndDate > $intStartDate && $strStartDate != $strEndDate) {
         $strResult .= $strIntervalDelimiter . $strEndDate;
     }
     if ($intStartTime > 0) {
         if ($intEndTime > $intStartTime && $strStartTime != $strEndTime) {
             $strResult .= $strDelimiter . $strStartTime . $strIntervalDelimiter . $strEndTime;
         } else {
             $strResult .= $strDelimiter . $strStartTime;
         }
     }
     return $strResult;
 }
开发者ID:heimrichhannot,项目名称:contao-haste_plus,代码行数:19,代码来源:DateUtil.php

示例6: importExampleWebsite

 /**
  * Import the example website
  */
 protected function importExampleWebsite()
 {
     /** @var \SplFileInfo[] $objFiles */
     $objFiles = new \RecursiveIteratorIterator(new \Filter\SqlFiles(new \RecursiveDirectoryIterator(TL_ROOT . '/templates', \FilesystemIterator::UNIX_PATHS | \FilesystemIterator::FOLLOW_SYMLINKS | \FilesystemIterator::SKIP_DOTS)));
     $arrTemplates = array();
     // Add the relative paths
     foreach ($objFiles as $objFile) {
         $arrTemplates[] = str_replace(TL_ROOT . '/templates/', '', $objFile->getPathname());
     }
     $strTemplates = '<option value="">-</option>';
     // Build the select options
     foreach ($arrTemplates as $strTemplate) {
         $strTemplates .= sprintf('<option value="%s">%s</option>', $strTemplate, specialchars($strTemplate));
     }
     $this->Template->templates = $strTemplates;
     // Process the request after the select menu has been generated
     // so the options show up even if the import throws an Exception
     if (\Input::post('FORM_SUBMIT') == 'tl_tutorial') {
         $this->Template->emptySelection = true;
         $strTemplate = \Input::post('template');
         // Template selected
         if ($strTemplate != '' && in_array($strTemplate, $arrTemplates)) {
             $tables = preg_grep('/^tl_/i', $this->Database->listTables());
             // Truncate tables
             if (!isset($_POST['preserve'])) {
                 foreach ($tables as $table) {
                     // Preserve the repository tables (see #6037)
                     if (isset($_POST['override']) || $table != 'tl_repository_installs' && $table != 'tl_repository_instfiles') {
                         $this->Database->execute("TRUNCATE TABLE " . $table);
                     }
                 }
             }
             // Import data
             $file = file(TL_ROOT . '/templates/' . $strTemplate);
             $sql = preg_grep('/^INSERT /', $file);
             foreach ($sql as $query) {
                 // Skip the repository tables (see #6037)
                 if (isset($_POST['override']) || strpos($query, '`tl_repository_installs`') === false && strpos($query, '`tl_repository_instfiles`') === false) {
                     $this->Database->execute($query);
                 }
             }
             \Config::persist('exampleWebsite', time());
             $this->reload();
         }
     }
     $this->Template->dateImported = \Date::parse(\Config::get('datimFormat'), \Config::get('exampleWebsite'));
 }
开发者ID:eakcantey,项目名称:core-bundle,代码行数:50,代码来源:BackendInstall.php

示例7: renderParameterValue

 /**
  * @param $strTable
  * @param $strLanguage
  * @param $strName
  * @param $varValue
  * @return string
  */
 protected function renderParameterValue($strTable, $strLanguage, $strName, $varValue)
 {
     if ($varValue == '') {
         return '';
     }
     $this->loadLanguageFile('default', $strLanguage, true);
     $this->loadLanguageFile($strTable, $strLanguage, true);
     $this->loadDataContainer($strTable);
     if ($GLOBALS['TL_DCA'][$strTable]['fields'][$strName]['inputType'] == 'password') {
         return '';
     }
     $varValue = deserialize($varValue);
     $rgxp = $GLOBALS['TL_DCA'][$strTable]['fields'][$strName]['eval']['rgxp'];
     $opts = $GLOBALS['TL_DCA'][$strTable]['fields'][$strName]['options'];
     $rfrc = $GLOBALS['TL_DCA'][$strTable]['fields'][$strName]['reference'];
     if ($rgxp == 'date') {
         $varValue = Date::parse($GLOBALS['TL_CONFIG']['dateFormat'], $varValue);
     } elseif ($rgxp == 'time') {
         $varValue = Date::parse($GLOBALS['TL_CONFIG']['timeFormat'], $varValue);
     } elseif ($rgxp == 'datim') {
         $varValue = Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $varValue);
     } elseif (is_array($varValue)) {
         $varValue = implode(', ', $varValue);
     } elseif (is_array($opts) && array_is_assoc($opts)) {
         $varValue = isset($opts[$varValue]) ? $opts[$varValue] : $varValue;
     } elseif (is_array($rfrc)) {
         $varValue = isset($rfrc[$varValue]) ? is_array($rfrc[$varValue]) ? $rfrc[$varValue][0] : $rfrc[$varValue] : $varValue;
     }
     $varValue = specialchars($varValue);
     return (string) $varValue;
 }
开发者ID:craffft,项目名称:accountmail-bundle,代码行数:38,代码来源:Account.php

示例8: renderDropdown

    /**
     * Render the versions dropdown menu
     *
     * @return string
     */
    public function renderDropdown()
    {
        $objVersion = $this->Database->prepare("SELECT tstamp, version, username, active FROM tl_version WHERE fromTable=? AND pid=? ORDER BY version DESC")->execute($this->strTable, $this->intPid);
        if ($objVersion->numRows < 2) {
            return '';
        }
        $versions = '';
        while ($objVersion->next()) {
            $versions .= '
  <option value="' . $objVersion->version . '"' . ($objVersion->active ? ' selected="selected"' : '') . '>' . $GLOBALS['TL_LANG']['MSC']['version'] . ' ' . $objVersion->version . ' (' . \Date::parse(\Config::get('datimFormat'), $objVersion->tstamp) . ') ' . $objVersion->username . '</option>';
        }
        return '
<div class="tl_version_panel">

<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_version" class="tl_form" method="post">
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="tl_version">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<select name="version" class="tl_select">' . $versions . '
</select>
<button type="submit" name="showVersion" id="showVersion" class="tl_submit">' . $GLOBALS['TL_LANG']['MSC']['restore'] . '</button>
<a href="' . \Backend::addToUrl('versions=1&amp;popup=1') . '" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['showDifferences']) . '" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'' . \StringUtil::specialchars(str_replace("'", "\\'", sprintf($GLOBALS['TL_LANG']['MSC']['recordOfTable'], $this->intPid, $this->strTable))) . '\',\'url\':this.href});return false">' . \Image::getHtml('diff.svg') . '</a>
</div>
</form>

</div>
';
    }
开发者ID:bytehead,项目名称:core-bundle,代码行数:33,代码来源:Versions.php

示例9: formatValue

 /**
  * Format a value
  *
  * @param string  $k
  * @param mixed   $value
  * @param boolean $blnListSingle
  *
  * @return mixed
  */
 protected function formatValue($k, $value, $blnListSingle = false)
 {
     $value = \StringUtil::deserialize($value);
     // Return if empty
     if (empty($value)) {
         return '';
     }
     /** @var PageModel $objPage */
     global $objPage;
     // Array
     if (is_array($value)) {
         $value = implode(', ', $value);
     } elseif ($GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['eval']['rgxp'] == 'date') {
         $value = \Date::parse($objPage->dateFormat, $value);
     } elseif ($GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['eval']['rgxp'] == 'time') {
         $value = \Date::parse($objPage->timeFormat, $value);
     } elseif ($GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['eval']['rgxp'] == 'datim') {
         $value = \Date::parse($objPage->datimFormat, $value);
     } elseif ($GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['eval']['rgxp'] == 'url' && preg_match('@^(https?://|ftp://)@i', $value)) {
         $value = \Idna::decode($value);
         // see #5946
         $value = '<a href="' . $value . '" target="_blank">' . $value . '</a>';
     } elseif ($GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['eval']['rgxp'] == 'email') {
         $value = \StringUtil::encodeEmail(\Idna::decode($value));
         // see #5946
         $value = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;' . $value . '">' . $value . '</a>';
     } elseif (is_array($GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['reference'])) {
         $value = $GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['reference'][$value];
     } elseif ($GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['eval']['isAssociative'] || array_is_assoc($GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['options'])) {
         if ($blnListSingle) {
             $value = $GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['options'][$value];
         } else {
             $value = '<span class="value">[' . $value . ']</span> ' . $GLOBALS['TL_DCA'][$this->list_table]['fields'][$k]['options'][$value];
         }
     }
     return $value;
 }
开发者ID:contao,项目名称:listing-bundle,代码行数:46,代码来源:ModuleListing.php

示例10: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     $limit = null;
     $offset = 0;
     $intBegin = 0;
     $intEnd = 0;
     $intYear = \Input::get('year');
     $intMonth = \Input::get('month');
     $intDay = \Input::get('day');
     // Jump to the current period
     if (!isset($_GET['year']) && !isset($_GET['month']) && !isset($_GET['day']) && $this->news_jumpToCurrent != 'all_items') {
         switch ($this->news_format) {
             case 'news_year':
                 $intYear = date('Y');
                 break;
             default:
             case 'news_month':
                 $intMonth = date('Ym');
                 break;
             case 'news_day':
                 $intDay = date('Ymd');
                 break;
         }
     }
     // Create the date object
     try {
         if ($intYear) {
             $strDate = $intYear;
             $objDate = new \Date($strDate, 'Y');
             $intBegin = $objDate->yearBegin;
             $intEnd = $objDate->yearEnd;
             $this->headline .= ' ' . date('Y', $objDate->tstamp);
         } elseif ($intMonth) {
             $strDate = $intMonth;
             $objDate = new \Date($strDate, 'Ym');
             $intBegin = $objDate->monthBegin;
             $intEnd = $objDate->monthEnd;
             $this->headline .= ' ' . \Date::parse('F Y', $objDate->tstamp);
         } elseif ($intDay) {
             $strDate = $intDay;
             $objDate = new \Date($strDate, 'Ymd');
             $intBegin = $objDate->dayBegin;
             $intEnd = $objDate->dayEnd;
             $this->headline .= ' ' . \Date::parse($objPage->dateFormat, $objDate->tstamp);
         } elseif ($this->news_jumpToCurrent == 'all_items') {
             $intBegin = 0;
             $intEnd = time();
         }
     } catch (\OutOfBoundsException $e) {
         throw new PageNotFoundException('Page not found: ' . \Environment::get('uri'));
     }
     $this->Template->articles = array();
     // Split the result
     if ($this->perPage > 0) {
         // Get the total number of items
         $intTotal = \NewsModel::countPublishedFromToByPids($intBegin, $intEnd, $this->news_archives);
         if ($intTotal > 0) {
             $total = $intTotal;
             // Get the current page
             $id = 'page_a' . $this->id;
             $page = \Input::get($id) !== null ? \Input::get($id) : 1;
             // Do not index or cache the page if the page number is outside the range
             if ($page < 1 || $page > max(ceil($total / $this->perPage), 1)) {
                 throw new PageNotFoundException('Page not found: ' . \Environment::get('uri'));
             }
             // Set limit and offset
             $limit = $this->perPage;
             $offset = (max($page, 1) - 1) * $this->perPage;
             // Add the pagination menu
             $objPagination = new \Pagination($total, $this->perPage, \Config::get('maxPaginationLinks'), $id);
             $this->Template->pagination = $objPagination->generate("\n  ");
         }
     }
     // Get the news items
     if (isset($limit)) {
         $objArticles = \NewsModel::findPublishedFromToByPids($intBegin, $intEnd, $this->news_archives, $limit, $offset);
     } else {
         $objArticles = \NewsModel::findPublishedFromToByPids($intBegin, $intEnd, $this->news_archives);
     }
     // Add the articles
     if ($objArticles !== null) {
         $this->Template->articles = $this->parseArticles($objArticles);
     }
     $this->Template->headline = trim($this->headline);
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     $this->Template->empty = $GLOBALS['TL_LANG']['MSC']['empty'];
 }
开发者ID:contao,项目名称:news-bundle,代码行数:92,代码来源:ModuleNewsArchive.php

示例11: sendAdminNotification

 /**
  * Send an admin notification e-mail
  *
  * @param integer $intId
  * @param array   $arrData
  */
 protected function sendAdminNotification($intId, $arrData)
 {
     $objEmail = new \Email();
     $objEmail->from = $GLOBALS['TL_ADMIN_EMAIL'];
     $objEmail->fromName = $GLOBALS['TL_ADMIN_NAME'];
     $objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['adminSubject'], \Idna::decode(\Environment::get('host')));
     $strData = "\n\n";
     // Add user details
     foreach ($arrData as $k => $v) {
         if ($k == 'password' || $k == 'tstamp' || $k == 'activation' || $k == 'dateAdded') {
             continue;
         }
         $v = \StringUtil::deserialize($v);
         if ($k == 'dateOfBirth' && strlen($v)) {
             $v = \Date::parse(\Config::get('dateFormat'), $v);
         }
         $strData .= $GLOBALS['TL_LANG']['tl_member'][$k][0] . ': ' . (is_array($v) ? implode(', ', $v) : $v) . "\n";
     }
     $objEmail->text = sprintf($GLOBALS['TL_LANG']['MSC']['adminText'], $intId, $strData . "\n") . "\n";
     $objEmail->sendTo($GLOBALS['TL_ADMIN_EMAIL']);
     $this->log('A new user (ID ' . $intId . ') has registered on the website', __METHOD__, TL_ACCESS);
 }
开发者ID:contao,项目名称:core-bundle,代码行数:28,代码来源:ModuleRegistration.php

示例12: parseDate

 /**
  * Parse a date format string and translate textual representations
  *
  * @param string  $strFormat The date format string
  * @param integer $intTstamp An optional timestamp
  *
  * @return string The textual representation of the date
  *
  * @deprecated Deprecated since Contao 4.0, to be removed in Contao 5.0.
  *             Use Date::parse() instead.
  */
 public static function parseDate($strFormat, $intTstamp = null)
 {
     @trigger_error('Using System::parseDate() has been deprecated and will no longer work in Contao 5.0. Use Date::parse() instead.', E_USER_DEPRECATED);
     return \Date::parse($strFormat, $intTstamp);
 }
开发者ID:contao,项目名称:core-bundle,代码行数:16,代码来源:System.php

示例13: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     $this->Template->referer = 'javascript:history.go(-1)';
     $objFaq = \FaqModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->faq_categories);
     if (null === $objFaq) {
         throw new PageNotFoundException('Page not found');
     }
     // Overwrite the page title and description (see #2853 and #4955)
     if ($objFaq->question != '') {
         $objPage->pageTitle = strip_tags(strip_insert_tags($objFaq->question));
         $objPage->description = $this->prepareMetaDescription($objFaq->question);
     }
     $this->Template->question = $objFaq->question;
     // Clean the RTE output
     $objFaq->answer = \StringUtil::toHtml5($objFaq->answer);
     $this->Template->answer = \StringUtil::encodeEmail($objFaq->answer);
     $this->Template->addImage = false;
     // Add image
     if ($objFaq->addImage && $objFaq->singleSRC != '') {
         $objModel = \FilesModel::findByUuid($objFaq->singleSRC);
         if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
             // Do not override the field now that we have a model registry (see #6303)
             $arrFaq = $objFaq->row();
             $arrFaq['singleSRC'] = $objModel->path;
             $this->addImageToTemplate($this->Template, $arrFaq);
         }
     }
     $this->Template->enclosure = array();
     // Add enclosure
     if ($objFaq->addEnclosure) {
         $this->addEnclosuresToTemplate($this->Template, $objFaq->row());
     }
     $strAuthor = '';
     // Add the author
     if (($objAuthor = $objFaq->getRelated('author')) !== null) {
         $strAuthor = $objAuthor->name;
     }
     $this->Template->info = sprintf($GLOBALS['TL_LANG']['MSC']['faqCreatedBy'], \Date::parse($objPage->dateFormat, $objFaq->tstamp), $strAuthor);
     $bundles = \System::getContainer()->getParameter('kernel.bundles');
     // HOOK: comments extension required
     if ($objFaq->noComments || !isset($bundles['ContaoCommentsBundle'])) {
         $this->Template->allowComments = false;
         return;
     }
     /** @var FaqCategoryModel $objCategory */
     $objCategory = $objFaq->getRelated('pid');
     $this->Template->allowComments = $objCategory->allowComments;
     // Comments are not allowed
     if (!$objCategory->allowComments) {
         return;
     }
     // Adjust the comments headline level
     $intHl = min(intval(str_replace('h', '', $this->hl)), 5);
     $this->Template->hlc = 'h' . ($intHl + 1);
     $this->import('Comments');
     $arrNotifies = array();
     // Notify the system administrator
     if ($objCategory->notify != 'notify_author') {
         $arrNotifies[] = $GLOBALS['TL_ADMIN_EMAIL'];
     }
     // Notify the author
     if ($objCategory->notify != 'notify_admin') {
         /** @var UserModel $objAuthor */
         if (($objAuthor = $objFaq->getRelated('author')) !== null && $objAuthor->email != '') {
             $arrNotifies[] = $objAuthor->email;
         }
     }
     $objConfig = new \stdClass();
     $objConfig->perPage = $objCategory->perPage;
     $objConfig->order = $objCategory->sortOrder;
     $objConfig->template = $this->com_template;
     $objConfig->requireLogin = $objCategory->requireLogin;
     $objConfig->disableCaptcha = $objCategory->disableCaptcha;
     $objConfig->bbcode = $objCategory->bbcode;
     $objConfig->moderate = $objCategory->moderate;
     $this->Comments->addCommentsToTemplate($this->Template, $objConfig, 'tl_faq', $objFaq->id, $arrNotifies);
 }
开发者ID:burguin,项目名称:test02,代码行数:83,代码来源:ModuleFaqReader.php

示例14: generateStats

 /**
  * Generate the stats data
  *
  * @return array|null
  */
 public static function generateStats()
 {
     if (!Stats::hasData()) {
         return null;
     }
     $totalLimit = Stats::get(Stats::TOTAL_LIMIT);
     $resetTime = Stats::get(Stats::LIMIT_RESET_TIME);
     $limitReset = $resetTime < time();
     $currentLimit = $limitReset ? $totalLimit : Stats::get(Stats::CURRENT_LIMIT);
     return ['totalLimit' => $totalLimit, 'currentLimit' => $currentLimit, 'limitReset' => $limitReset ? '' : Date::parse(Config::get('datimFormat'), $resetTime), 'canRun' => $currentLimit > 0 || $limitReset];
 }
开发者ID:derhaeuptling,项目名称:contao-vimeo-api,代码行数:16,代码来源:Rebuilder.php

示例15: getMetaFields

 /**
  * Return the meta fields of a news article as array.
  *
  * @param NewsModel $objArticle The model.
  *
  * @return array
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  */
 protected function getMetaFields($objArticle)
 {
     $meta = deserialize($this->news_metaFields);
     if (!is_array($meta)) {
         return array();
     }
     $return = array();
     foreach ($meta as $field) {
         switch ($field) {
             case 'date':
                 $return['date'] = Date::parse($GLOBALS['objPage']->datimFormat, $objArticle->date);
                 break;
             case 'author':
                 if (($objAuthor = $objArticle->getRelated('author')) !== null) {
                     if ($objAuthor->google != '') {
                         $return['author'] = $GLOBALS['TL_LANG']['MSC']['by'] . ' <a href="https://plus.google.com/' . $objAuthor->google . '" rel="author" target="_blank">' . $objAuthor->name . '</a>';
                     } else {
                         $return['author'] = $GLOBALS['TL_LANG']['MSC']['by'] . ' ' . $objAuthor->name;
                     }
                 }
                 break;
             case 'comments':
                 if ($objArticle->noComments || $objArticle->source != 'default') {
                     break;
                 }
                 $intTotal = CommentsModel::countPublishedBySourceAndParent('tl_news', $objArticle->id);
                 $return['ccount'] = $intTotal;
                 $return['comments'] = sprintf($GLOBALS['TL_LANG']['MSC']['commentCount'], $intTotal);
                 break;
             default:
         }
     }
     return $return;
 }
开发者ID:contao-community-alliance,项目名称:events-contao-bindings,代码行数:45,代码来源:NewsSubscriber.php


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