本文整理汇总了PHP中href_to_abs函数的典型用法代码示例。如果您正苦于以下问题:PHP href_to_abs函数的具体用法?PHP href_to_abs怎么用?PHP href_to_abs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了href_to_abs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: sendInvites
private function sendInvites($profile, $emails_list)
{
$results = array('success' => array(), 'failed' => array());
$emails = string_explode_list($emails_list);
$auth_controller = cmsCore::getController('auth');
$auth_model = cmsCore::getModel('auth');
$messenger = cmsCore::getController('messages');
foreach ($emails as $email) {
if ($this->validate_email($email) !== true) {
$results['failed'][$email] = ERR_VALIDATE_EMAIL;
continue;
}
if ($this->model->getUserByEmail($email)) {
$results['failed'][$email] = LANG_REG_EMAIL_EXISTS;
continue;
}
if (!$auth_controller->isEmailAllowed($email)) {
$results['failed'][$email] = LANG_AUTH_RESTRICTED_EMAILS;
continue;
}
$invite = $auth_model->getNextInvite($this->cms_user->id);
$to = array('email' => $email, 'name' => $email);
$letter = array('name' => 'users_invite');
$messenger->sendEmail($to, $letter, array('nickname' => $this->cms_user->nickname, 'code' => $invite['code'], 'page_url' => href_to_abs('auth', 'register') . "?inv={$invite['code']}"));
$results['success'][$email] = true;
$auth_model->markInviteSended($invite['id'], $this->cms_user->id, $email);
if (sizeof($results['success']) + sizeof($results['failed']) >= $profile['invites_count']) {
break;
}
}
return $results;
}
示例3: notifyProfileOwner
private function notifyProfileOwner($profile_id, $entry)
{
if ($entry['user_id'] == $profile_id) {
return;
}
$messenger = cmsCore::getController('messages');
$messenger->addRecipient($profile_id);
$messenger->sendNoticeEmail('wall_reply', array('profile_url' => href_to_abs('users', $profile_id) . "?wid={$entry['id']}&reply=1", 'author_url' => href_to_abs('users', $entry['user_id']), 'author_nickname' => $entry['user_nickname'], 'content' => $entry['content_html']));
}
示例4: notifyAuthor
public function notifyAuthor($ctype_name, $item)
{
$users_model = cmsCore::getModel('users');
$author = $users_model->getUser($item['user_id']);
$messenger = cmsCore::getController('messages');
$to = array('email' => $author['email'], 'name' => $author['nickname']);
$letter = array('name' => 'moderation_approved');
$messenger->sendEmail($to, $letter, array('nickname' => $author['nickname'], 'page_title' => $item['title'], 'page_url' => href_to_abs($ctype_name, $item['slug'] . ".html"), 'date' => html_date_time()));
}
示例5: run
public function run($data)
{
list($ctype, $profile) = $data;
if (!empty($ctype['options']['is_rss'])) {
$title = $profile['nickname'] . ' - ' . $ctype['title'];
$feed_title = sprintf(LANG_RSS_FEED_TITLE_FORMAT, $title, cmsConfig::get('sitename'));
$feed_url = href_to_abs($this->name, 'feed', $ctype['name']) . '?user=' . $profile['id'];
$link_tag = '<link title="' . $feed_title . '" type="application/rss+xml" rel="alternate" href="' . $feed_url . '">';
cmsTemplate::getInstance()->addHead($link_tag);
}
return array($ctype, $profile);
}
示例6: run
public function run($type)
{
$urls = array();
if ($type != 'profiles') {
return $urls;
}
$groups = $this->model->limit(false)->getGroupsIds();
if ($groups) {
foreach ($groups as $group) {
$url = href_to_abs($this->name, $group['id']);
$date_last_modified = false;
$urls[$url] = $date_last_modified;
}
}
return $urls;
}
示例7: run
public function run($type)
{
$urls = array();
if ($type != 'profiles') {
return $urls;
}
$users = $this->model->filterIsNull('is_locked')->limit(false)->getUsersIds();
if ($users) {
foreach ($users as $user) {
$url = href_to_abs($this->name, $user['id']);
$date_last_modified = false;
$urls[$url] = $date_last_modified;
}
}
return $urls;
}
示例8: sendNoticeRequest
public function sendNoticeRequest($friend)
{
$user = cmsUser::getInstance();
$messenger = cmsCore::getController('messages');
$messenger->addRecipient($friend['id']);
//
// Личное сообщение
//
$sender_link = '<a href="' . href_to($this->name, $user->id) . '">' . $user->nickname . '</a>';
$notice = array('content' => sprintf(LANG_USERS_FRIENDS_NOTICE, $sender_link), 'options' => array('is_closeable' => false), 'actions' => array('accept' => array('title' => LANG_ACCEPT, 'controller' => $this->name, 'action' => 'friend_add', 'params' => array($user->id)), 'decline' => array('title' => LANG_DECLINE, 'controller' => $this->name, 'action' => 'friend_delete', 'params' => array($user->id))));
// личное сообщение посылаем всегда, независимо от настроек уведомлений пользователя
$messenger->ignoreNotifyOptions()->sendNoticePM($notice, 'users_friend_add');
//
// E-mail
//
$messenger->sendNoticeEmail('users_friend_add', array('friend_nickname' => $user->nickname, 'friend_url' => href_to_abs('users', $user->id)));
}
示例9: sendNoticeDeleted
public function sendNoticeDeleted($friend, $is_declined = false)
{
$user = cmsUser::getInstance();
$messenger = cmsCore::getController('messages');
$messenger->addRecipient($friend['id']);
$sender_link = '<a href="' . href_to($this->name, $user->id) . '">' . $user->nickname . '</a>';
$content = $is_declined ? sprintf(LANG_USERS_FRIENDS_DECLINED, $sender_link) : sprintf(LANG_USERS_FRIENDS_UNDONE, $sender_link);
$notice = array('content' => $content);
$messenger->sendNoticePM($notice, 'users_friend_delete');
//
// E-mail
//
if (!$is_declined) {
$messenger->sendNoticeEmail('users_friend_delete', array('friend_nickname' => $user->nickname, 'friend_url' => href_to_abs('users', $user->id)));
}
return true;
}
示例10: run
public function run($data)
{
list($ctype, $category) = $data;
if (!empty($ctype['options']['is_rss'])) {
$title = $ctype['title'];
if ($category['id'] > 1) {
$title = $title . ' / ' . $category['title'];
}
$feed_title = sprintf(LANG_RSS_FEED_TITLE_FORMAT, $title, cmsConfig::get('sitename'));
$feed_url = href_to_abs($this->name, 'feed', $ctype['name']);
if ($category['id'] > 1) {
$feed_url .= '?category=' . $category['id'];
}
$link_tag = '<link title="' . htmlspecialchars($feed_title) . '" type="application/rss+xml" rel="alternate" href="' . $feed_url . '">';
cmsTemplate::getInstance()->addHead($link_tag);
}
return array($ctype, $category);
}
示例11: run
public function run($ctype_name)
{
$urls = array();
if (empty($ctype_name)) {
return $urls;
}
$is_ctype_exists = $this->model->getContentTypeByName($ctype_name);
if (!$is_ctype_exists) {
return false;
}
$items = $this->model->filterNotEqual('is_private', 1)->filterNotEqual('is_approved', 0)->limit(false)->getContentItems($ctype_name);
if ($items) {
foreach ($items as $item) {
$url = href_to_abs($ctype_name, $item['slug'] . '.html');
$date_last_modified = $item['date_last_modified'];
$urls[$url] = $date_last_modified;
}
}
return $urls;
}
示例12: notifyParent
public function notifyParent($comment, $parent_comment)
{
if ($comment['user_id'] && $comment['user_id'] == $parent_comment['user_id']) {
return;
}
$messenger = cmsCore::getController('messages');
$is_guest_parent = !$parent_comment['user_id'] && $parent_comment['author_email'];
$is_guest_comment = !$comment['user_id'];
$page_url = href_to_abs($comment['target_url']) . "#comment_{$comment['id']}";
$letter_data = array('page_url' => $page_url, 'page_title' => $comment['target_title'], 'author_url' => $is_guest_comment ? $page_url : href_to_abs('users', $comment['user_id']), 'author_nickname' => $is_guest_comment ? $comment['author_name'] : $comment['user_nickname'], 'comment' => $comment['content'], 'original' => $parent_comment['content']);
if (!$is_guest_parent) {
$messenger->addRecipient($parent_comment['user_id']);
$messenger->sendNoticeEmail('comments_reply', $letter_data);
}
if ($is_guest_parent) {
$letter_data['nickname'] = $parent_comment['author_name'];
$to = array('name' => $parent_comment['author_name'], 'email' => $parent_comment['author_email']);
$letter = array('name' => 'comments_reply');
$messenger->sendEmail($to, $letter, $letter_data);
}
}
示例13: sendInvite
public function sendInvite($invited_users_list, $group_id)
{
$user = cmsUser::getInstance();
$group = $this->model->getGroup($group_id);
if (!$group) {
cmsCore::error404();
}
if (!is_array($invited_users_list)) {
$invited_users_list = array($invited_users_list);
}
$messenger = cmsCore::getController('messages');
foreach ($invited_users_list as $invited_id) {
$messenger->addRecipient($invited_id);
//
// Личное сообщение
//
$sender_link = '<a href="' . href_to('users', $user->id) . '">' . $user->nickname . '</a>';
$group_link = '<a href="' . href_to('groups', $group['id']) . '">' . $group['title'] . '</a>';
$notice = array('content' => sprintf(LANG_GROUPS_INVITE_NOTICE, $sender_link, $group_link), 'options' => array('is_closeable' => true), 'actions' => array('accept' => array('title' => LANG_ACCEPT, 'href' => href_to('groups', $group['id'], 'join')), 'decline' => array('title' => LANG_DECLINE, 'controller' => $this->name, 'action' => 'invite_delete', 'params' => array($group['id'], $invited_id))));
$messenger->sendNoticePM($notice, 'groups_invite');
//
// E-mail
//
$messenger->sendNoticeEmail('groups_invite', array('user_nickname' => $user->nickname, 'user_url' => href_to_abs('users', $user->id), 'group_title' => $group['title'], 'group_url' => href_to_abs('groups', $group['id'])));
$messenger->clearRecipients();
$this->model->addInvite(array('group_id' => $group['id'], 'user_id' => $user->id, 'invited_id' => $invited_id));
}
cmsUser::addSessionMessage(LANG_GROUPS_INVITE_SENT, 'success');
$this->redirectBack();
}
示例14: html
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName><?php
html(sprintf(LANG_SEARCH_ON, $site_config->sitename));
?>
</ShortName>
<Description><?php
html(sprintf(LANG_SEARCH_ON, $site_config->sitename));
?>
</Description>
<InputEncoding>utf-8</InputEncoding>
<Image width="166" height="23" type="image/png"><?php
echo $site_config->host . '/templates/' . $this->name . '/images/logo.png';
?>
</Image>
<Url type="text/html" template="<?php
echo href_to_abs('search') . '?q={searchTerms}';
?>
"/>
</OpenSearchDescription>
示例15: requestModeration
public function requestModeration($ctype_name, $item, $is_new_item = true)
{
$moderator_id = $this->model->getNextModeratorId($ctype_name);
$users_model = cmsCore::getModel('users');
$moderator = $users_model->getUser($moderator_id);
$author = $users_model->getUser($item['user_id']);
// добавляем задачу модератору
$this->model->addModeratorTask($ctype_name, $moderator_id, $is_new_item, $item);
// отправляем письмо модератору
$messenger = cmsCore::getController('messages');
$to = array('email' => $moderator['email'], 'name' => $moderator['nickname']);
$letter = array('name' => 'moderation');
$messenger->sendEmail($to, $letter, array('moderator' => $moderator['nickname'], 'author' => $author['nickname'], 'author_url' => href_to_abs('users', $author['id']), 'page_title' => $item['title'], 'page_url' => href_to_abs($ctype_name, $item['slug'] . ".html"), 'date' => html_date_time()));
cmsUser::addSessionMessage(sprintf(LANG_MODERATION_IDLE, $moderator['nickname']), 'info');
}