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


PHP XenForo_Locale::getFormattedDate方法代码示例

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


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

示例1: calculateAge

 /**
  * Calculates the age of the person with the specified birth date.
  *
  * @param integer $year
  * @param integer $month
  * @param integer $day
  *
  * @return integer
  */
 public function calculateAge($year, $month, $day)
 {
     list($cYear, $cMonth, $cDay) = explode('-', XenForo_Locale::getFormattedDate(XenForo_Application::$time, 'Y-m-d'));
     $age = $cYear - $year;
     if ($cMonth < $month || $cMonth == $month && $cDay < $day) {
         $age--;
     }
     return max(0, $age);
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:18,代码来源:UserProfile.php

示例2: _render

 protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     $core = WidgetFramework_Core::getInstance();
     /** @var XenForo_Model_User $userModel */
     $userModel = $core->getModelFromCache('XenForo_Model_User');
     /** @var XenForo_Model_UserProfile $userProfileModel */
     $userProfileModel = $core->getModelFromCache('XenForo_Model_UserProfile');
     $todayStart = XenForo_Locale::getDayStartTimestamps();
     $todayStart = $todayStart['today'];
     $day = XenForo_Locale::getFormattedDate($todayStart, 'd');
     $month = XenForo_Locale::getFormattedDate($todayStart, 'm');
     $conditions = array(WidgetFramework_XenForo_Model_User::CONDITIONS_DOB => array('d' => $day, 'm' => $month), 'user_state' => 'valid', 'is_banned' => false);
     $fetchOptions = array('order' => 'username', 'join' => XenForo_Model_User::FETCH_USER_PROFILE + XenForo_Model_User::FETCH_USER_OPTION);
     if (!empty($widget['options']['limit'])) {
         $fetchOptions['limit'] = $widget['options']['limit'];
     }
     if (!empty($widget['options']['avatar_only'])) {
         $conditions[WidgetFramework_XenForo_Model_User::CONDITIONS_HAS_AVATAR] = true;
     }
     $users = $userModel->getUsers($conditions, $fetchOptions);
     foreach (array_keys($users) as $userId) {
         $user =& $users[$userId];
         if (!empty($widget['options']['whitelist_user_groups'])) {
             // check for whitelist user groups
             if (!$userModel->isMemberOfUserGroup($user, $widget['options']['whitelist_user_groups'])) {
                 unset($users[$userId]);
                 continue;
             }
         }
         if (!empty($widget['options']['blacklist_user_groups'])) {
             // check for blacklist user groups
             if ($userModel->isMemberOfUserGroup($user, $widget['options']['blacklist_user_groups'])) {
                 unset($users[$userId]);
                 continue;
             }
         }
         // we can call XenForo_Model_User::prepareUserCard instead
         $user['age'] = $userProfileModel->getUserAge($user);
     }
     $renderTemplateObject->setParam('users', array_values($users));
     return $renderTemplateObject->render();
 }
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:42,代码来源:Birthday.php

示例3: getLanguageFormatExamples

 /**
  * Generates the date and time format examples based on the
  * current time.
  *
  * @return array [0] => date formats, [1] => time formats; keyed by format string
  */
 public function getLanguageFormatExamples()
 {
     $dateFormatsRaw = array('M j, Y', 'F j, Y', 'j M Y', 'j F Y', 'j/n/y', 'n/j/y');
     $dateFormats = array();
     foreach ($dateFormatsRaw as $dateFormat) {
         $dateFormats[$dateFormat] = XenForo_Locale::getFormattedDate(XenForo_Application::$time, $dateFormat);
     }
     $timeFormatsRaw = array('g:i A', 'H:i');
     $timeFormats = array();
     foreach ($timeFormatsRaw as $timeFormat) {
         $timeFormats[$timeFormat] = XenForo_Locale::getFormattedDate(XenForo_Application::$time, $timeFormat);
     }
     return array($dateFormats, $timeFormats);
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:20,代码来源:Language.php


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