本文整理汇总了PHP中XenForo_Locale::getDayStartTimestamps方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Locale::getDayStartTimestamps方法的具体用法?PHP XenForo_Locale::getDayStartTimestamps怎么用?PHP XenForo_Locale::getDayStartTimestamps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Locale
的用法示例。
在下文中一共展示了XenForo_Locale::getDayStartTimestamps方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderContainer
/**
* Renders the container.
* @see XenForo_ViewRenderer_Abstract::renderContainer()
*
* @param string
* @param array
*
* @return string
*/
public function renderContainer($contents, array $params = array())
{
$params['contentTemplate'] = $this->_contentTemplate;
$params['debugMode'] = XenForo_Application::debugMode();
$params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps();
if (!empty($params['extraTabs'])) {
foreach ($params['extraTabs'] as &$group) {
foreach ($group as &$extraTab) {
if (!empty($extraTab['linksTemplate'])) {
$extraTab['linksTemplate'] = $this->createTemplateObject($extraTab['linksTemplate'], $extraTab + $params);
}
}
}
}
$templateName = !empty($params['containerTemplate']) ? $params['containerTemplate'] : 'PAGE_CONTAINER';
$template = $this->createTemplateObject($templateName, $params);
if ($contents instanceof XenForo_Template_Abstract) {
$contents = $contents->render();
}
$containerData = $this->_dependencies->getExtraContainerData();
$containerData['notices'] = $this->_getNoticesContainerParams($template, $containerData);
$template->setParams($containerData);
$template->setParam('contents', $contents);
$template->setParam('noH1', isset($containerData['h1']) && $containerData['h1'] === '');
if ($params['debugMode']) {
$template->setParams(XenForo_Debug::getDebugTemplateParams());
}
$rendered = $template->render();
$rendered = $this->replaceRequiredExternalPlaceholders($template, $rendered);
$language = XenForo_Visitor::getInstance()->getLanguage();
if (isset($language['text_direction']) && $language['text_direction'] == 'RTL') {
$rendered = XenForo_Template_Helper_RightToLeft::replaceRtlEntities($rendered);
}
return $rendered;
}
示例2: renderContainer
/**
* Renders the container.
* @see XenForo_ViewRenderer_Abstract::renderContainer()
*
* @param string
* @param array
*
* @return string
*/
public function renderContainer($contents, array $params = array(), array $newParams = array())
{
$params['contentTemplate'] = $this->_contentTemplate;
$params['debugMode'] = XenForo_Application::debugMode();
$params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps();
if (!empty($params['extraTabs'])) {
foreach ($params['extraTabs'] as &$group) {
foreach ($group as &$extraTab) {
if (!empty($extraTab['linksTemplate'])) {
$extraTab['linksTemplate'] = $this->createTemplateObject($extraTab['linksTemplate'], $extraTab);
}
}
}
}
$params = array_replace_recursive($params, $newParams);
$templateName = !empty($params['containerTemplate']) ? $params['containerTemplate'] : 'PAGE_CONTAINER';
$template = $this->createTemplateObject($templateName, $params);
//if ($contents instanceof XenForo_Template_Abstract)
//{
// $contents = $contents->render();
//}
$containerData = $this->_dependencies->getExtraContainerData();
$template->setParams($containerData);
$template->setParam('contents', $contents);
$template->setParam('noH1', isset($containerData['h1']) && $containerData['h1'] === '');
if ($params['debugMode']) {
$template->setParams(XenForo_Debug::getDebugTemplateParams());
}
$rendered = $template->render();
return $this->replaceRequiredExternalPlaceholders($template, $rendered);
}
示例3: renderHtml
public function renderHtml()
{
$options = XenForo_Application::get('options');
$template = $this->createTemplateObject($this->_templateName, $this->_params);
// Mini page bootstrapper :3
$dep = new XenForo_Dependencies_Public();
$this->_params = $dep->getEffectiveContainerParams($this->_params, $this->_params['request']);
$this->_params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps();
$template->setParams($this->_params);
echo $template->render();
exit;
}
示例4: _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();
}
示例5: renderContainer
/**
* Renders the container.
* @see XenForo_ViewRenderer_Abstract::renderContainer()
*
* @param string
* @param array
*
* @return string
*/
public function renderContainer($contents, array $params = array())
{
$options = XenForo_Application::get('options');
$params['debugMode'] = XenForo_Application::debugMode();
$params['debugFormBackground'] = $options->debugFormBackground;
if (!empty($params['adminNavigation']['sideLinks'])) {
$params['sideNav'] = $this->_renderSideNav($params['adminNavigation']['sideLinksRoot'], $params['adminNavigation']['sideLinks']);
} else {
$params['sideNav'] = array();
}
$params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps();
$templateName = !empty($params['containerTemplate']) ? $params['containerTemplate'] : 'PAGE_CONTAINER';
$template = $this->createTemplateObject($templateName, $params);
if ($contents instanceof XenForo_Template_Abstract) {
$contents = $contents->render();
}
$template->setParams($this->_dependencies->getExtraContainerData());
$template->setParam('contents', $contents);
if ($params['debugMode']) {
$template->setParams(XenForo_Debug::getDebugTemplateParams());
}
$rendered = $template->render();
return $this->replaceRequiredExternalPlaceholders($template, $rendered);
}
示例6: renderContainer
/**
* Renders the container.
* @see XenForo_ViewRenderer_Abstract::renderContainer()
*
* @param string
* @param array
*
* @return string
*/
public function renderContainer($contents, array $params = array())
{
$options = XenForo_Application::get('options');
$params['debugMode'] = XenForo_Application::debugMode();
$params['debugFormBackground'] = $options->debugFormBackground;
if (!empty($params['adminNavigation']['sideLinks'])) {
$params['sideNav'] = $this->_renderSideNav($params['adminNavigation']['sideLinksRoot'], $params['adminNavigation']['sideLinks']);
} else {
$params['sideNav'] = array();
}
$params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps();
$params['publicUrl'] = $options->useFriendlyUrls ? './' : 'index.php';
if (!isset($params['allowManualDeferredRun'])) {
$params['allowManualDeferredRun'] = true;
}
$params['hasManualDeferred'] = XenForo_ViewRenderer_Abstract::hasManualDeferredToRun($params['allowManualDeferredRun']) || !empty($params['hasManualDeferred']);
$templateName = !empty($params['containerTemplate']) ? $params['containerTemplate'] : 'PAGE_CONTAINER';
$template = $this->createTemplateObject($templateName, $params);
if ($contents instanceof XenForo_Template_Abstract) {
$contents = $contents->render();
}
$template->setParams($this->_dependencies->getExtraContainerData());
$template->setParam('contents', $contents);
if ($params['debugMode']) {
$template->setParams(XenForo_Debug::getDebugTemplateParams());
}
$rendered = $template->render();
$rendered = $this->replaceRequiredExternalPlaceholders($template, $rendered);
$language = XenForo_Visitor::getInstance()->getLanguage();
if (isset($language['text_direction']) && $language['text_direction'] == 'RTL') {
$rendered = XenForo_Template_Helper_RightToLeft::replaceRtlEntities($rendered);
}
return $rendered;
}
示例7: prepareLogConditions
public function prepareLogConditions(array $conditions, array &$fetchOptions)
{
$sqlConditions = array();
$db = $this->_getDb();
if (!empty($conditions['user_id'])) {
if (is_array($conditions['user_id'])) {
$sqlConditions[] = 'log.user_id IN (' . $db->quote($conditions['user_id']) . ')';
} else {
$sqlConditions[] = 'log.user_id = ' . $db->quote($conditions['user_id']);
}
}
if (!empty($conditions['thread_id'])) {
if (is_array($conditions['thread_id'])) {
$sqlConditions[] = 'log.thread_id IN (' . $db->quote($conditions['thread_id']) . ')';
} else {
$sqlConditions[] = 'log.thread_id = ' . $db->quote($conditions['thread_id']);
}
}
if (!empty($conditions['node_id'])) {
if (is_array($conditions['node_id'])) {
$sqlConditions[] = 'log.node_id IN (' . $db->quote($conditions['node_id']) . ')';
} else {
$sqlConditions[] = 'log.node_id = ' . $db->quote($conditions['node_id']);
}
}
if (!empty($conditions['id'])) {
if (is_array($conditions['id'])) {
$sqlConditions[] = 'log.id IN (' . $db->quote($conditions['id']) . ')';
} else {
$sqlConditions[] = 'log.id = ' . $db->quote($conditions['id']);
}
}
if (!empty($conditions['up_source'])) {
if (is_array($conditions['up_source'])) {
$sqlConditions[] = 'log.up_source IN (' . $db->quote($conditions['up_source']) . ')';
} else {
$sqlConditions[] = 'log.up_source = ' . $db->quote($conditions['up_source']);
}
}
if (!empty($conditions['up_time']) && is_array($conditions['up_time'])) {
list($operator, $cutOff) = $conditions['up_time'];
$this->assertValidCutOffOperator($operator);
$sqlConditions[] = "log.up_time {$operator} " . $db->quote($cutOff);
}
if (isset($conditions['count_type'])) {
switch ($conditions['count_type']) {
case self::DAILY_COUNT:
$dayStartTimestamps = XenForo_Locale::getDayStartTimestamps();
$today_start = $dayStartTimestamps['today'];
$today_end = $today_start + 24 * 3600;
$sqlConditions[] = "log.up_time BETWEEN '{$today_start}' AND '{$today_end}'";
break;
case self::WEEKLY_COUNT:
$date = new DateTime(mktime(0, 0, 0, date('n'), date('j'), date('Y')) - (date('N') - 1) * 3600 * 24);
$date->setTimezone(XenForo_Locale::getDefaultTimeZone() ? XenForo_Locale::getDefaultTimeZone() : new DateTimeZone('UTC'));
$this_week_start = $date->format('U');
$this_week_end = XenForo_Application::$time;
$sqlConditions[] = "log.up_time BETWEEN '{$this_week_start}' AND '{$this_week_end}'";
break;
case self::MONTHLY_COUNT:
$date = new DateTime(mktime(0, 0, 0, date('m'), 1, date('Y')));
$date->setTimezone(XenForo_Locale::getDefaultTimeZone() ? XenForo_Locale::getDefaultTimeZone() : new DateTimeZone('UTC'));
$this_month_start = $date->format('U');
$this_month_end = XenForo_Application::$time;
$sqlConditions[] = "log.up_time BETWEEN '{$this_month_start}' AND '{$this_month_end}'";
break;
default:
break;
}
}
return $this->getConditionsForClause($sqlConditions);
}
示例8: renderSectionUserPrepare
public static function renderSectionUserPrepare($controller, $type)
{
if ($controller instanceof XenForo_Controller) {
$input = $controller->getInput()->filter(self::_getInputFilter());
} else {
$input = $controller['pseudoInput'];
}
// start setting up important params
$childTemplate = false;
$fetchOptions = array();
$conditions = array();
$tran = false;
switch ($type) {
case 'users_new':
$childTemplate = 'VietxfAdvStats_users_new';
$fetchOptions = array('order' => 'register_date', 'direction' => 'desc');
break;
case 'users_top_posters':
$childTemplate = 'VietxfAdvStats_users_top_posters';
$fetchOptions = array('order' => 'message_count', 'direction' => 'desc');
break;
case 'users_top_trophy_points':
$childTemplate = 'VietxfAdvStats_users_top_trophy_points';
$fetchOptions = array('order' => 'trophy_points', 'direction' => 'desc');
break;
case 'users_top_liked':
$childTemplate = 'VietxfAdvStats_users_top_liked';
$fetchOptions = array('order' => 'like_count', 'direction' => 'desc');
break;
case 'users_top_richest':
$childTemplate = 'VietxfAdvStats_users_top_richest';
$fetchOptions = array('order' => 'credits', 'direction' => 'desc');
break;
case 'users_top_poorest':
$childTemplate = 'VietxfAdvStats_users_top_poorest';
$fetchOptions = array('order' => 'credits', 'direction' => 'asc');
break;
case 'users_top_earned_in_day':
$childTemplate = 'VietxfAdvStats_users_top_earned_in_day';
$tran = true;
break;
case 'users_top_spent_in_day':
$childTemplate = 'VietxfAdvStats_users_top_spent_in_day';
$tran = true;
break;
}
// finished important params
// prepare various fetch options
$fetchOptions['limit'] = VietXfAdvStats_Option::get('itemLimit', $input);
// start getting users data
$userModel = self::getModelFromCache('XenForo_Model_User');
$fetchOptions['validOnly'] = true;
$users = $userModel->getAllUsers($fetchOptions);
if ($tran && XenForo_Model::create('XenForo_Model_AddOn')->getAddOnVersion('Brivium_Credits')) {
$transactionModel = self::getModelFromCache('Brivium_Credits_Model_Transaction');
// top transaction in day user
$dayStartTimestamps = XenForo_Locale::getDayStartTimestamps();
$conditions = array('start' => $dayStartTimestamps['today']);
if ($type == 'users_top_earned_in_day') {
$topTranInDay = $transactionModel->getTopEarnedTransactions($conditions, array('limit' => VietXfAdvStats_Option::get('itemLimit', $input)));
} else {
$topTranInDay = $transactionModel->getTopSpentTransactions($conditions, array('limit' => VietXfAdvStats_Option::get('itemLimit', $input)));
}
$users = array();
if (is_array($topTranInDay) && !empty($topTranInDay)) {
foreach ($topTranInDay as $userId => $tranInfo) {
$users[$userId] = $userModel->getUserById($userId);
$users[$userId]['credits'] = $tranInfo['credits'];
}
}
}
$viewParams = array('users' => $users, 'childTemplate' => $childTemplate, 'requested' => self::_getControllerRequestedData($controller, $input, $type));
$templateName = 'VietXfAdvStats_users';
return array($templateName, $viewParams);
}
示例9: _getStartTime
protected function _getStartTime()
{
$todayStart = XenForo_Locale::getDayStartTimestamps();
return $todayStart['today'];
}