本文整理汇总了PHP中html_date函数的典型用法代码示例。如果您正苦于以下问题:PHP html_date函数的具体用法?PHP html_date怎么用?PHP html_date使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_date函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: grid_comments_list
function grid_comments_list($controller)
{
$options = array('is_sortable' => true, 'is_filter' => true, 'is_pagination' => true, 'is_draggable' => false, 'order_by' => 'date_pub', 'order_to' => 'desc', 'show_id' => true);
$columns = array('id' => array('title' => 'id', 'width' => 30), 'date_pub' => array('title' => LANG_DATE, 'width' => 110, 'handler' => function ($value, $item) {
return html_date($value, true);
}, 'filter' => 'date'), 'target_id' => array('title' => LANG_COMMENTS_TEXT, 'handler' => function ($value, $row) use($controller) {
return '<a title="' . LANG_COMMENTS_EDIT_TEXT . '" class="ajax-modal comment_text_edit" href="' . href_to($controller->root_url, 'text_edit', array($row['id'])) . '">' . string_short($row['content_html'], 350) . '</a>';
}), 'user_id' => array('title' => LANG_AUTHOR, 'width' => 180, 'handler' => function ($value, $row) {
if ($row['user_id']) {
$v = '<a target="_blank" href="' . href_to('users', $row['user_id']) . '">' . $row['user_nickname'] . '</a>';
} else {
$v = '<span class="guest_name">' . $row['author_name'] . '</span>';
if (!empty($row['author_email'])) {
$v .= '<span>, ' . $row['author_email'] . '</span>';
}
}
return $v;
}), 'author_url' => array('title' => LANG_COMMENTS_IP, 'width' => 120, 'filter' => 'like', 'handler' => function ($value) {
if ($value) {
return '<a href="#" class="ajaxlink filter_ip tooltip" title="' . LANG_CP_USER_FIND_BYIP . '">' . $value . '</a> <a class="view_target tooltip" href="https://apps.db.ripe.net/search/query.html?searchtext=' . $value . '#resultsAnchor" target="_blank" title="' . LANG_CP_USER_RIPE_SEARCH . '"></a>';
}
return '';
}), 'rating' => array('title' => LANG_RATING, 'width' => 50, 'handler' => function ($value, $row) {
return '<span class="' . html_signed_class($value) . '">' . html_signed_num($value) . '</span>';
}, 'filter' => 'exact'), 'is_deleted' => array('title' => LANG_COMMENTS_IS_DELETED, 'flag' => 'flag_lock', 'flag_toggle' => href_to($controller->root_url, 'toggle_item', array('{id}', 'comments', 'is_deleted')), 'width' => 50, 'filter' => 'exact'), 'is_approved' => array('title' => LANG_MODERATION, 'flag' => true, 'width' => 50, 'filter' => 'exact', 'handler' => function ($value, $item) {
if (!$item['is_approved']) {
return '<div class="flag_trigger flag_off"><span><a class="approve_comment" title="' . LANG_COMMENTS_APPROVE . '" href="#" data-approve-url="' . href_to('comments', 'approve') . '?id=' . $item['id'] . '"></a></span></div>';
}
return '<div class="flag_trigger flag_on"></div>';
}), 'is_private' => array('title' => LANG_COMMENTS_IS_PRIVATE, 'flag' => true, 'width' => 50, 'filter' => 'exact'));
$actions = array(array('title' => LANG_COMMENTS_VIEW, 'class' => 'view tooltip', 'href' => href_to('{target_url}', '#comment_{id}')), array('title' => LANG_DELETE, 'class' => 'delete', 'href' => href_to($controller->root_url, 'comments_delete', array('{id}')), 'confirm' => LANG_COMMENTS_DELETE_CONFIRM));
return array('options' => $options, 'columns' => $columns, 'actions' => $actions);
}
示例2: run
public function run()
{
if (cmsUser::isLogged()) {
$this->redirectToHome();
}
$users_model = cmsCore::getModel('users');
$form = $this->getForm('restore');
$data = array();
$is_submitted = $this->request->has('submit');
if ($is_submitted) {
$data = $form->parse($this->request, $is_submitted);
$errors = $form->validate($this, $data);
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
if (!$errors) {
$user = $users_model->getUserByEmail($data['email']);
if (!$user) {
cmsUser::addSessionMessage(LANG_EMAIL_NOT_FOUND, 'error');
} else {
$pass_token = string_random(32, $user['email']);
$users_model->updateUserPassToken($user['id'], $pass_token);
$messenger = cmsCore::getController('messages');
$to = array('email' => $user['email'], 'name' => $user['nickname']);
$letter = array('name' => 'reg_restore');
$messenger->sendEmail($to, $letter, array('nickname' => $user['nickname'], 'page_url' => href_to_abs('auth', 'reset', $pass_token), 'valid_until' => html_date(date('d.m.Y H:i', time() + 24 * 3600), true)));
cmsUser::addSessionMessage(LANG_TOKEN_SENDED, 'success');
}
}
}
return cmsTemplate::getInstance()->render('restore', array('data' => $data, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
}
示例3: grid_content_items
function grid_content_items($controller, $ctype_name = false)
{
$options = array('is_auto_init' => false, 'is_sortable' => true, 'is_filter' => true, 'is_pagination' => true, 'is_draggable' => false, 'is_selectable' => true, 'order_by' => 'id', 'order_to' => 'desc', 'show_id' => true);
$columns = array('id' => array('title' => 'id', 'width' => 30, 'filter' => 'exact'), 'title' => array('title' => LANG_TITLE, 'href' => href_to($ctype_name, 'edit', '{id}') . '?back=' . href_to($controller->name, 'content'), 'filter' => 'like'), 'date_pub' => array('title' => LANG_DATE, 'width' => 80, 'handler' => function ($value, $item) {
return html_date($value);
}), 'is_pub' => array('title' => LANG_ON, 'width' => 40, 'flag' => true, 'flag_toggle' => href_to($controller->name, 'content', array('item_toggle', $ctype_name, '{id}'))), 'user_nickname' => array('title' => LANG_AUTHOR, 'href' => href_to('users', '{user_id}'), 'order_by' => 'u.nickname'));
$actions = array(array('title' => LANG_VIEW, 'class' => 'view', 'href' => href_to($ctype_name, '{slug}.html')), array('title' => LANG_EDIT, 'class' => 'edit', 'href' => href_to($ctype_name, 'edit', '{id}') . '?back=' . href_to($controller->name, 'content')), array('title' => LANG_DELETE, 'class' => 'delete', 'href' => href_to($ctype_name, 'delete', '{id}') . '?back=' . href_to($controller->name, 'content'), 'confirm' => LANG_CP_CONTENT_ITEM_DELETE_CONFIRM));
return array('options' => $options, 'columns' => $columns, 'actions' => $actions);
}
示例4: grid_users
function grid_users($controller)
{
$options = array('is_auto_init' => false, 'is_sortable' => true, 'is_filter' => true, 'is_pagination' => true, 'is_draggable' => false, 'order_by' => 'id', 'order_to' => 'asc', 'show_id' => true);
$columns = array('id' => array('title' => 'id', 'width' => 30, 'filter' => 'exact'), 'nickname' => array('title' => LANG_NICKNAME, 'href' => href_to($controller->name, 'users', array('edit', '{id}')), 'filter' => 'like', 'handler' => function ($nickname, $user) {
if ($user['is_admin']) {
$nickname = '<b class="tooltip" title="' . LANG_USER_IS_ADMIN . '">' . $nickname . '</b>';
}
return $nickname;
}), 'email' => array('title' => LANG_EMAIL, 'width' => 200, 'filter' => 'like'), 'ip' => array('title' => LANG_USERS_PROFILE_LAST_IP, 'width' => 120, 'filter' => 'like', 'handler' => function ($value) {
return '<a href="#" class="ajaxlink filter_ip tooltip" title="' . LANG_CP_USER_FIND_BYIP . '">' . $value . '</a> <a class="view_target tooltip" href="https://apps.db.ripe.net/search/query.html?searchtext=' . $value . '#resultsAnchor" target="_blank" title="' . LANG_CP_USER_RIPE_SEARCH . '"></a>';
}), 'date_reg' => array('title' => LANG_REGISTRATION, 'width' => 80, 'filter' => 'like', 'handler' => function ($date, $user) {
$ld = $user['is_online'] ? LANG_ONLINE : LANG_USERS_PROFILE_LOGDATE . ' ' . string_date_age_max($user['date_log'], true);
return '<span class="tooltip" title="' . $ld . '">' . html_date($date) . '</span>';
}), 'karma' => array('title' => LANG_KARMA, 'width' => 60, 'filter' => 'exact', 'handler' => function ($value) {
return '<span class="' . html_signed_class($value) . '">' . html_signed_num($value) . '</span>';
}), 'rating' => array('title' => LANG_RATING, 'width' => 60, 'filter' => 'exact'), 'is_locked' => array('title' => LANG_CP_USER_LOCKED, 'flag' => 'flag_lock', 'width' => 24, 'handler' => function ($value, $user) {
$title = $user['is_locked'] ? $user['lock_reason'] ? $user['lock_reason'] : LANG_TO . ' ' . strip_tags(html_date($user['lock_until'])) : '';
return '<div class="tooltip" title="' . $title . '">' . $value . '</div>';
}));
$actions = array(array('title' => LANG_PROFILE, 'class' => 'view tooltip', 'href' => href_to('users', '{id}')), array('title' => LANG_EDIT, 'class' => 'edit tooltip', 'href' => href_to($controller->name, 'users', array('edit', '{id}'))), array('title' => LANG_DELETE, 'class' => 'delete tooltip', 'href' => href_to($controller->name, 'users', array('delete', '{id}')), 'confirm' => LANG_CP_USER_DELETE_CONFIRM));
return array('options' => $options, 'columns' => $columns, 'actions' => $actions);
}
示例5: parse
public function parse($value)
{
return $value ? html_date($value, $this->getOption('show_time')) : null;
}
示例6: logoutLockedUser
public function logoutLockedUser($user)
{
$now = time();
$lock_until = !empty($user['lock_until']) ? strtotime($user['lock_until']) : false;
if ($lock_until && $lock_until <= $now) {
$this->model->unlockUser($user['id']);
return;
}
$notice_text = array();
$notice_text[] = sprintf(LANG_USERS_LOCKED_NOTICE);
if ($user['lock_until']) {
$notice_text[] = sprintf(LANG_USERS_LOCKED_NOTICE_UNTIL, html_date($user['lock_until']));
}
if ($user['lock_reason']) {
$notice_text[] = sprintf(LANG_USERS_LOCKED_NOTICE_REASON, $user['lock_reason']);
}
$notice_text = implode('<br>', $notice_text);
cmsUser::addSessionMessage($notice_text, 'error');
cmsUser::logout();
return;
}
示例7: html_date_time
function html_date_time($date = false)
{
return html_date($date, true);
}
示例8: sendEmail
public function sendEmail($to, $letter, $data = array())
{
if (is_array($to)) {
if (empty($to['email'])) {
return false;
}
if (empty($to['name'])) {
$to['name'] = false;
}
} else {
if (empty($to)) {
return false;
}
$to = array('email' => $to, 'name' => false);
}
if (is_array($letter)) {
if (empty($letter['text'])) {
$letter['text'] = cmsCore::getLanguageTextFile("letters/{$letter['name']}");
}
} else {
$letter = array('text' => cmsCore::getLanguageTextFile("letters/{$letter}"));
}
if (!$letter['text']) {
return false;
}
$config = cmsConfig::getInstance();
$data = array_merge(array('site' => $config->sitename, 'date' => html_date(time()), 'time' => html_time(time())), $data);
$letter['text'] = string_replace_keys_values($letter['text'], $data);
$mailer = new cmsMailer();
$mailer->addTo($to['email'], $to['name']);
$letter['text'] = $mailer->parseSubject($letter['text']);
$letter['text'] = $mailer->parseAttachments($letter['text']);
$mailer->setBodyHTML(nl2br($letter['text']));
$result = $mailer->send();
$mailer->clearTo()->clearAttachments();
return $result;
}
示例9: getItemForm
//.........这里部分代码省略.........
$form->addField($fieldset_id, new fieldString('slug', array('prefix' => '/' . $ctype['name'] . '/', 'suffix' => '.html', 'rules' => $slug_field_rules)));
}
// Если разрешено управление видимостью, то добавляем поле
if (cmsUser::isAllowed($ctype['name'], 'privacy')) {
$fieldset_id = $form->addFieldset(LANG_PRIVACY);
$form->addField($fieldset_id, new fieldList('is_private', array('items' => array(0 => LANG_PRIVACY_PUBLIC, 1 => LANG_PRIVACY_PRIVATE), 'rules' => array(array('number')))));
}
// если разрешено отключать комментарии к записи
if (cmsUser::isAllowed($ctype['name'], 'disable_comments') && $ctype['is_comments']) {
$fieldset_id = $form->addFieldset(LANG_RULE_CONTENT_COMMENT, 'is_comment');
$form->addField($fieldset_id, new fieldList('is_comments_on', array('default' => 1, 'items' => array(1 => LANG_YES, 0 => LANG_NO))));
}
//
// Если ручной ввод ключевых слов или описания, то добавляем поля для этого
//
if (!empty($ctype['options']['is_manual_title']) || !$ctype['is_auto_keys'] || !$ctype['is_auto_desc']) {
$fieldset_id = $form->addFieldset(LANG_SEO);
if ($ctype['options']['is_manual_title']) {
$form->addField($fieldset_id, new fieldString('seo_title', array('title' => LANG_SEO_TITLE, 'rules' => array(array('max_length', 256)))));
}
if (!$ctype['is_auto_keys']) {
$form->addField($fieldset_id, new fieldString('seo_keys', array('title' => LANG_SEO_KEYS, 'hint' => LANG_SEO_KEYS_HINT, 'rules' => array(array('max_length', 256)))));
}
if (!$ctype['is_auto_desc']) {
$form->addField($fieldset_id, new fieldText('seo_desc', array('title' => LANG_SEO_DESC, 'hint' => LANG_SEO_DESC_HINT, 'rules' => array(array('max_length', 256)))));
}
}
//
// Если включен выбор даты публикации, то добавляем поля
//
$pub_fieldset_id = false;
$is_dates = $ctype['is_date_range'];
$is_pub_start_date = cmsUser::isAllowed($ctype['name'], 'pub_late');
$is_pub_end_date = cmsUser::isAllowed($ctype['name'], 'pub_long', 'any');
$is_pub_end_days = cmsUser::isAllowed($ctype['name'], 'pub_long', 'days');
$is_pub_control = cmsUser::isAllowed($ctype['name'], 'pub_on');
$is_pub_ext = cmsUser::isAllowed($ctype['name'], 'pub_max_ext');
$pub_max_days = intval(cmsUser::getPermissionValue($ctype['name'], 'pub_max_days'));
if ($user->is_admin) {
$is_pub_end_days = false;
}
if ($is_pub_control) {
$pub_fieldset_id = $pub_fieldset_id ? $pub_fieldset_id : $form->addFieldset(LANG_CONTENT_PUB);
$form->addField($pub_fieldset_id, new fieldList('is_pub', array('title' => sprintf(LANG_CONTENT_IS_PUB, $ctype['labels']['create']), 'default' => 1, 'items' => array(1 => LANG_YES, 0 => LANG_NO))));
}
if ($is_dates) {
if ($is_pub_start_date) {
$pub_fieldset_id = $pub_fieldset_id ? $pub_fieldset_id : $form->addFieldset(LANG_CONTENT_PUB);
$m = date('i');
$form->addField($pub_fieldset_id, new fieldDate('date_pub', array('title' => LANG_CONTENT_DATE_PUB, 'default' => date('Y-m-d H:') . ($m - $m % 5), 'options' => array('show_time' => true), 'rules' => array(array('required')))));
}
if ($is_pub_end_date) {
$pub_fieldset_id = $pub_fieldset_id ? $pub_fieldset_id : $form->addFieldset(LANG_CONTENT_PUB);
$form->addField($pub_fieldset_id, new fieldDate('date_pub_end', array('title' => LANG_CONTENT_DATE_PUB_END, 'hint' => LANG_CONTENT_DATE_PUB_END_HINT)));
}
if ($action == 'add' && $is_pub_end_days || $action == 'edit' && $is_pub_ext && $is_pub_end_days) {
$pub_fieldset_id = $pub_fieldset_id ? $pub_fieldset_id : $form->addFieldset(LANG_CONTENT_PUB);
$title = $action == 'add' ? LANG_CONTENT_PUB_LONG : LANG_CONTENT_PUB_LONG_EXT;
$hint = $action == 'add' ? false : sprintf(LANG_CONTENT_PUB_LONG_NOW, html_date($item['date_pub_end']));
if ($pub_max_days) {
$days = array();
$rules = array();
if ($action == 'add') {
$rules[] = array('required');
$min = 1;
}
if ($action == 'edit') {
$min = 0;
}
$rules[] = array('number');
$rules[] = array('min', $min);
$rules[] = array('max', $pub_max_days);
if ($action == 'add') {
$rules[] = array('required');
$min = 1;
}
if ($action == 'edit') {
$min = 0;
}
for ($d = $min; $d <= $pub_max_days; $d++) {
$days[$d] = $d;
}
$form->addField($pub_fieldset_id, new fieldList('pub_days', array('title' => $title, 'hint' => $hint, 'items' => $days, 'rules' => $rules)));
} else {
$rules = array();
if ($action == 'add') {
$rules[] = array('required');
$min = 1;
}
if ($action == 'edit') {
$min = 0;
}
$rules[] = array('min', $min);
$rules[] = array('max', 65535);
$form->addField($pub_fieldset_id, new fieldNumber('pub_days', array('title' => $title, 'default' => 10, 'rules' => $rules)));
}
}
}
return $form;
}
示例10: html_host_report
<?php
echo html_host_report($host_ip, $host_data['name']);
?>
</td>
<?php
html_set_values($host_ip, 'host', $host_data["max_{$ac}"], $host_data["max_{$ac}_date"], $host_data["current_{$ac}"], $host_data["threshold_{$ac}"], $ac);
?>
<td nowrap><?php
echo html_rrd();
?>
<?php
echo html_incident();
?>
</td>
<td nowrap><?php
echo html_date();
?>
</td>
<?php
echo html_max();
?>
<?php
echo html_current();
?>
</tr>
<?php
}
?>
<?php
}
?>
示例11: run
//.........这里部分代码省略.........
$user['groups'] = array();
if (!empty($this->options['def_groups'])) {
$user['groups'] = $this->options['def_groups'];
}
if (isset($user['group_id'])) {
if (!in_array($user['group_id'], $user['groups'])) {
$user['groups'][] = $user['group_id'];
}
}
//
// убираем поля которые не относятся к выбранной пользователем группе
//
foreach ($fieldsets as $fieldset) {
foreach ($fieldset['fields'] as $field) {
if (!$field['groups_edit']) {
continue;
}
if (in_array(0, $field['groups_edit'])) {
continue;
}
if (!in_array($user['group_id'], $field['groups_edit'])) {
$form->disableField($field['name']);
unset($user[$field['name']]);
}
}
}
$errors = $form->validate($this, $user);
}
if (!$errors) {
//
// проверяем код приглашения
//
if ($this->options['is_reg_invites']) {
$invite = $this->model->getInviteByCode($user['inv']);
if (!$invite) {
$errors['inv'] = LANG_REG_WRONG_INVITE_CODE;
} else {
if ($this->options['is_invites_strict'] && $invite['email'] != $user['email']) {
$errors['inv'] = LANG_REG_WRONG_INVITE_CODE_EMAIL;
} else {
$user['inviter_id'] = $invite['user_id'];
}
}
}
//
// проверяем допустимость e-mail, имени и IP
//
if (!$this->isEmailAllowed($user['email'])) {
$errors['email'] = sprintf(LANG_AUTH_RESTRICTED_EMAIL, $user['email']);
}
if (!$this->isNameAllowed($user['nickname'])) {
$errors['nickname'] = sprintf(LANG_AUTH_RESTRICTED_NAME, $user['nickname']);
}
if (!$this->isIPAllowed(cmsUser::get('ip'))) {
cmsUser::addSessionMessage(sprintf(LANG_AUTH_RESTRICTED_IP, cmsUser::get('ip')), 'error');
$errors = true;
}
}
if (!$errors) {
unset($user['inv']);
//
// Блокируем пользователя, если включена верификация e-mail
//
if ($this->options['verify_email']) {
$user = array_merge($user, array('is_locked' => true, 'lock_reason' => LANG_REG_CFG_VERIFY_LOCK_REASON, 'pass_token' => string_random(32, $user['email']), 'date_token' => ''));
}
$result = $users_model->addUser($user);
if ($result['success']) {
$user['id'] = $result['id'];
cmsUser::addSessionMessage(LANG_REG_SUCCESS, 'success');
// отправляем письмо верификации e-mail
if ($this->options['verify_email']) {
$messenger = cmsCore::getController('messages');
$to = array('email' => $user['email'], 'name' => $user['nickname']);
$letter = array('name' => 'reg_verify');
$messenger->sendEmail($to, $letter, array('nickname' => $user['nickname'], 'page_url' => href_to_abs('auth', 'verify', $user['pass_token']), 'valid_until' => html_date(date('d.m.Y H:i', time() + $this->options['verify_exp'] * 3600), true)));
cmsUser::addSessionMessage(sprintf(LANG_REG_SUCCESS_NEED_VERIFY, $user['email']), 'info');
} else {
cmsEventsManager::hook('user_registered', $user);
}
$back_url = cmsUser::sessionGet('auth_back_url') ? cmsUser::sessionGet('auth_back_url', true) : false;
if ($back_url) {
$this->redirect($back_url);
} else {
$this->redirectToHome();
}
} else {
$errors = $result['errors'];
}
}
if ($errors && $is_captcha_valid) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
// Капча
if ($this->options['reg_captcha']) {
$captcha_html = cmsEventsManager::hook('captcha_html');
}
return cmsTemplate::getInstance()->render('registration', array('user' => $user, 'form' => $form, 'captcha_html' => isset($captcha_html) ? $captcha_html : false, 'errors' => isset($errors) ? $errors : false));
}
示例12: html_date
?>
<span class="rate_value rating" title="<?php
echo LANG_RATING;
?>
"><?php
echo $group['rating'];
?>
</span>
<?php
} else {
?>
<?php
echo html_date($group['date_pub']);
?>
<?php
}
?>
</div>
</div>
<?php
$index++;
?>
<?php
示例13: printf
}
?>
<?php
if (!empty($update['version'])) {
?>
<h2><?php
printf(LANG_CP_UPDATE_AVAILABLE, $update['version']);
?>
</h2>
<h3><?php
echo LANG_CP_UPDATE_DATE;
?>
: <?php
echo html_date($update['date']);
?>
</h3>
<?php
if (!function_exists('curl_init')) {
?>
<p>
<?php
echo LANG_CP_UPDATE_MANUAL_1;
?>
<br>
<?php
echo LANG_CP_UPDATE_MANUAL_2;
?>
示例14: html_avatar_image
<td width="32">
<?php
echo html_avatar_image($moderator['user_avatar'], 'micro');
?>
</td>
<td>
<a href="<?php
echo href_to('users', $moderator['user_id']);
?>
"><?php
html($moderator['user_nickname']);
?>
</a>
</td>
<td class="center"><?php
echo html_date($moderator['date_assigned']);
?>
</td>
<td class="center"><?php
echo $moderator['count_approved'];
?>
</td>
<td class="center"><?php
echo $moderator['count_deleted'];
?>
</td>
<td class="center"><?php
echo $moderator['count_idle'];
?>
</td>
<td>