本文整理汇总了PHP中XenForo_Link::convertUriToAbsoluteUri方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Link::convertUriToAbsoluteUri方法的具体用法?PHP XenForo_Link::convertUriToAbsoluteUri怎么用?PHP XenForo_Link::convertUriToAbsoluteUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Link
的用法示例。
在下文中一共展示了XenForo_Link::convertUriToAbsoluteUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImage
public function getImage(XenForo_Model $model)
{
$photoData = $this->_getPhotoData($model);
$image = $model->getModelFromCache('sonnb_XenGallery_Model_ContentData')->getContentDataLargeThumbnailUrl($photoData);
$image = XenForo_Link::convertUriToAbsoluteUri($image, true);
return $image;
}
示例2: actionAddReply
/**
*
* @see XenForo_ControllerPublic_Thread::actionAddReply()
*/
public function actionAddReply()
{
$response = parent::actionAddReply();
if ($response instanceof XenForo_ControllerResponse_Redirect) {
$xenOptions = XenForo_Application::get('options');
if ($xenOptions->th_moderateReplies_moderateMessage) {
$message = $response->redirectMessage;
if ($message instanceof XenForo_Phrase && $message->getPhraseName() == 'your_message_has_been_posted') {
$target = XenForo_Link::getCanonicalLinkPrefix() . XenForo_Link::convertUriToAbsoluteUri($response->redirectTarget);
$result = $this->parseRouteUrl($target);
if ($result) {
$match = $result['match'];
$controllerName = $match->getControllerName();
if ($controllerName == 'XenForo_ControllerPublic_Thread') {
$response->redirectMessage = new XenForo_Phrase('message_submitted_displayed_pending_approval');
} elseif ($controllerName == 'XenForo_ControllerPublic_Post') {
$post = $this->_getPostModel()->getPostById($result['params']['post_id']);
if ($post['message_state'] == 'moderated') {
$response->redirectMessage = new XenForo_Phrase('message_submitted_displayed_pending_approval');
}
}
}
}
}
}
return $response;
}
示例3: runDailyCleanUp
public static function runDailyCleanUp()
{
$options = XenForo_Application::get('options');
$model = XenForo_Model::create('Dark_TaigaChat_Model_TaigaChat');
if ($options->dark_taigachat_archivethread > 0) {
$messages = array_reverse($model->getMessagesToday());
if (count($messages) > 0) {
$userModel = XenForo_Model::create('XenForo_Model_User');
$post = "";
foreach ($messages as $message) {
$date = XenForo_Locale::dateTime($message['date'], 'absolute');
if ($message['user_id'] > 0) {
$url = XenForo_Link::convertUriToAbsoluteUri(XenForo_Link::buildPublicLink("members/" . $message['user_id']), true);
$user = "[url='{$url}']{$message['username']}[/url]";
} else {
$user = "[b]{$message['username']}[/b]";
}
$post .= "{$date} - {$user}: {$message['message']}\r\n";
}
$username = "TaigaChat";
if ($options->dark_taigachat_archiveuser > 0) {
$user = $userModel->getUserById($options->dark_taigachat_archiveuser);
$username = $user['username'];
}
$writer = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');
$writer->setOption(XenForo_DataWriter_DiscussionMessage::OPTION_IS_AUTOMATED, true);
$writer->set('user_id', $options->dark_taigachat_archiveuser);
$writer->set('username', $username);
$writer->set('message', $post);
$writer->set('thread_id', $options->dark_taigachat_archivethread);
$writer->save();
}
}
$model->deleteOldMessages();
}
示例4: __construct
/**
* Constructor.
*
* @param array $input Array of input (intended to normally be $_REQUEST)
* @param XenForo_Dependencies_Abstract $dependencies
*/
public function __construct(array $input, XenForo_Dependencies_Abstract $dependencies)
{
$this->_dependencies = $dependencies;
$this->_response = new Zend_Controller_Response_Http();
if (!empty($input['image']) && is_scalar($input['image'])) {
$this->_mode = 'image';
$this->_url = trim(strval($input['image']));
}
if (!empty($input['link']) && is_scalar($input['link'])) {
$this->_mode = 'link';
$this->_url = trim(strval($input['link']));
}
if (!empty($input['hash']) && is_scalar($input['hash'])) {
$this->_hash = trim(strval($input['hash']));
}
$this->_json = !empty($input['_xfResponseType']) && $input['_xfResponseType'] === 'json';
if ($this->_json && $this->_mode == 'link' && !empty($input['_xfRequestUri']) && is_scalar($input['_xfRequestUri'])) {
// only use this if we're using JSON output (in a handler that supports it)
$this->_referrer = XenForo_Link::convertUriToAbsoluteUri($input['_xfRequestUri'], true);
}
if (!$this->_referrer && !empty($_SERVER['HTTP_REFERER'])) {
$this->_referrer = $_SERVER['HTTP_REFERER'];
}
if ($this->_referrer && !preg_match('#^https?://#i', $this->_referrer)) {
$this->_referrer = null;
}
}
示例5: helperAvatarUrl
public static function helperAvatarUrl(array $team, $canonical = false)
{
$url = self::getAvatarUrl($team);
if ($canonical) {
$url = XenForo_Link::convertUriToAbsoluteUri($url, true);
}
return htmlspecialchars($url);
}
示例6: listen
public static function listen(array &$extraTabs, $selectedTabId)
{
$options = XenForo_Application::get('options');
$visitor = XenForo_Visitor::getInstance();
if ($options->dark_taigachat_navtab && $visitor->hasPermission("dark_taigachat", "view")) {
$extraTabs['taigachat'] = array('title' => new Xenforo_Phrase("dark_shoutbox"), 'href' => XenForo_Link::convertUriToAbsoluteUri(XenForo_Link::buildPublicLink($options->dark_taigachat_route), true), 'selected' => $selectedTabId == 'taigachat', 'linksTemplate' => 'dark_taigachat_links', 'taigachat' => array("route" => $options->dark_taigachat_route));
}
}
示例7: getImage
public function getImage(XenForo_Model $model)
{
$imageUrl = bdMedal_Model_Medal::getImageUrl($this->_medal);
if (!empty($imageUrl)) {
return XenForo_Link::convertUriToAbsoluteUri($imageUrl, true);
}
return parent::getImage($model);
}
示例8: getData
public function getData(array $entry)
{
$result = array('loc' => XenForo_Link::buildPublicLink('canonical:xengallery/albums', $entry), 'lastmod' => $entry['last_update_date']);
if (isset($entry['mediaCache']['placeholder'])) {
$result['image'] = XenForo_Link::convertUriToAbsoluteUri($entry['mediaCache']['placeholder'], true, $this->getCanonicalPaths());
}
return $result;
}
示例9: getImage
public function getImage(XenForo_Model $model)
{
$resource = $this->_resourceDw->getMergedData();
if (isset(XenForo_Template_Helper_Core::$helperCallbacks['resourceiconurl'])) {
$iconUrl = XenForo_Template_Helper_Core::callHelper('resourceiconurl', array($resource));
return XenForo_Link::convertUriToAbsoluteUri($iconUrl, true);
}
return parent::getImage($model);
}
示例10: getData
public function getData(array $entry)
{
$result = array('loc' => XenForo_Link::buildPublicLink('canonical:xengallery/users/albums', $entry), 'priority' => 0.3);
if ($entry['gravatar'] || $entry['avatar_date']) {
$avatarUrl = htmlspecialchars_decode(XenForo_Template_Helper_Core::callHelper('avatar', array($entry, 'l')));
$avatarUrl = XenForo_Link::convertUriToAbsoluteUri($avatarUrl, true, $this->getCanonicalPaths());
$result['image'] = $avatarUrl;
}
return $result;
}
示例11: getData
public function getData(array $entry)
{
$result = array('loc' => XenForo_Link::buildPublicLink('canonical:xengallery', $entry), 'lastmod' => $entry['last_edit_date']);
if (isset($entry['thumbnailUrl'])) {
if ($entry['media_type'] == 'image_upload') {
$result['image'] = XenForo_Link::buildPublicLink('canonical:xengallery/full', $entry);
} else {
$result['image'] = XenForo_Link::convertUriToAbsoluteUri($entry['thumbnailUrl'], true, $this->getCanonicalPaths());
}
}
return $result;
}
示例12: updateResponseRedirect
public static function updateResponseRedirect(XenForo_Controller $controller, XenForo_ControllerResponse_Redirect $controllerResponse)
{
$action = false;
$userId = 0;
if ($controller instanceof XenForo_ControllerPublic_Login) {
/** @var bdApiConsumer_XenForo_ControllerPublic_Login $controller */
if (XenForo_Visitor::getUserId() > 0 && XenForo_Visitor::getUserId() != $controller->bdApiConsumer_getBeforeLoginVisitorId()) {
// a successful login
$action = 'login';
$userId = XenForo_Visitor::getUserId();
}
} elseif ($controller instanceof XenForo_ControllerPublic_Logout) {
/** @var bdApiConsumer_XenForo_ControllerPublic_Logout $controller */
if (XenForo_Visitor::getUserId() == 0) {
// a successful logout
$action = 'logout';
$userId = $controller->bdApiConsumer_getBeforeLogoutVisitorId();
}
}
if ($action !== false && $userId > 0) {
$redirectTarget = $controllerResponse->redirectTarget;
$originalTarget = $redirectTarget;
/** @var bdApiConsumer_XenForo_Model_UserExternal $userExternalModel */
$userExternalModel = $controller->getModelFromCache('XenForo_Model_UserExternal');
$auths = $userExternalModel->bdApiConsumer_getExternalAuthAssociations($userId);
if (!empty($auths)) {
foreach ($auths as $auth) {
$provider = bdApiConsumer_Option::getProviderByCode($auth['provider']);
if (empty($provider)) {
continue;
}
$accessToken = $userExternalModel->bdApiConsumer_getAccessTokenFromAuth($provider, $auth);
if (empty($accessToken)) {
continue;
}
$ott = bdApiConsumer_Helper_Api::generateOneTimeToken($provider, $auth['provider_key'], $accessToken);
$redirectTarget = XenForo_Link::convertUriToAbsoluteUri($redirectTarget, true);
switch ($action) {
case 'login':
$redirectTarget = bdApiConsumer_Helper_Api::getLoginLink($provider, $ott, $redirectTarget);
break;
case 'logout':
$redirectTarget = bdApiConsumer_Helper_Api::getLogoutLink($provider, $ott, $redirectTarget);
break;
}
}
}
if ($redirectTarget !== $originalTarget) {
$controllerResponse->redirectTarget = $redirectTarget;
}
}
}
示例13: renderRss
public function renderRss()
{
$xenOptions = XenForo_Application::getOptions();
if ($xenOptions->sonnbXG_enableRSS) {
$title = new XenForo_Phrase('sonnb_xengallery');
$title = $title->render();
$description = new XenForo_Phrase('sonnb_xengallery_short_description', array('title' => $xenOptions->boardTitle));
$description = $description->render();
$buggyXmlNamespace = defined('LIBXML_DOTTED_VERSION') && LIBXML_DOTTED_VERSION == '2.6.24';
$feed = new Zend_Feed_Writer_Feed();
$feed->setEncoding('utf-8');
$feed->setTitle($title);
$feed->setDescription($description);
$feed->setLink(XenForo_Link::buildPublicLink('canonical:gallery'));
if (!$buggyXmlNamespace) {
$feed->setFeedLink(XenForo_Link::buildPublicLink('canonical:gallery/index.rss'), 'rss');
}
$feed->setDateModified(XenForo_Application::$time);
$feed->setLastBuildDate(XenForo_Application::$time);
$feed->setGenerator($title);
$formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text', array('view' => $this));
$parser = new XenForo_BbCode_Parser($formatter);
foreach ($this->_params['albums'] as $album) {
$albumDescription = $parser->render($album['description']);
$entry = $feed->createEntry();
if (!empty($album['contents'])) {
$albumDescription .= '<br /><br />';
foreach ($album['contents'] as $content) {
$albumDescription .= '<a href="' . XenForo_Link::buildPublicLink('canonical:gallery/' . $content['content_type'] . 's', $content) . '"><img src="' . XenForo_Link::convertUriToAbsoluteUri($content['thumbnailUrl'], true) . '" /></a>';
}
}
if ($albumDescription) {
$entry->setDescription($albumDescription);
}
$entry->setTitle($album['title'] ? $album['title'] : $album['title'] . ' ');
$entry->setLink(XenForo_Link::buildPublicLink('canonical:gallery/albums', $album));
$entry->setDateCreated(new Zend_Date($album['album_date'], Zend_Date::TIMESTAMP));
$entry->setDateModified(new Zend_Date($album['album_updated_date'], Zend_Date::TIMESTAMP));
if (!$buggyXmlNamespace) {
$entry->addAuthor(array('name' => $album['username'], 'uri' => XenForo_Link::buildPublicLink('canonical:gallery/authors', $album)));
if ($album['comment_count']) {
$entry->setCommentCount($album['comment_count']);
$entry->setCommentLink(XenForo_Link::buildPublicLink('canonical:gallery/albums', $album) . '#album-' . $album['album_id']);
}
}
$feed->addEntry($entry);
}
return $feed->export('rss');
}
}
示例14: save
public function save()
{
$response = parent::save();
if (!empty($this->_newData['xf_post']['thread_id']) && !empty($this->_newData['xf_post']['post_id'])) {
$options = XenForo_Application::get('options');
if ($options->dark_taigachat_activity != 'None') {
$visitor = XenForo_Visitor::getInstance();
$isThread = $this->_newData['xf_post']['position'] == 0;
/** @var XenForo_Model_Thread */
$threadModel = XenForo_Model::create("XenForo_Model_Thread");
$thread = $threadModel->getThreadById($this->_newData['xf_post']['thread_id']);
/** @var XenForo_Model_Node */
$nodeModel = XenForo_Model::create("XenForo_Model_Node");
$node = $nodeModel->getNodeById($thread['node_id']);
$ok = false;
// making the not-too-risky assumption that 1 will be guest group
$permissionCombinationId = 1;
if ($options->dark_taigachat_activity_userid > 0) {
/** @var XenForo_Model_User */
$userModel = XenForo_Model::create("XenForo_Model_User");
$activityUser = $userModel->getUserById($options->dark_taigachat_activity_userid);
$permissionCombinationId = $activityUser['permission_combination_id'];
}
$nodePermissions = $nodeModel->getNodePermissionsForPermissionCombination($permissionCombinationId);
foreach ($nodePermissions as $nodeId => $nodePermission) {
if ($nodeId == $node['node_id'] && XenForo_Permission::hasContentPermission($nodePermission, 'view') && XenForo_Permission::hasContentPermission($nodePermission, 'viewOthers')) {
$ok = true;
}
}
if ($ok) {
if ($isThread) {
$activityMessage = new XenForo_Phrase('dark_posted_new_thread_in_x_x', array('forum' => "[url='" . XenForo_Link::convertUriToAbsoluteUri(XenForo_Link::buildPublicLink("forums", $node), true) . "']" . $node['title'] . "[/url]", 'thread' => "[url='" . XenForo_Link::convertUriToAbsoluteUri(XenForo_Link::buildPublicLink("threads", $thread), true) . "']" . $thread['title'] . "[/url]"), false);
} else {
$activityMessage = new XenForo_Phrase('dark_replied_to_x', array('thread' => "[url='" . XenForo_Link::convertUriToAbsoluteUri(XenForo_Link::buildPublicLink("posts", $this->_newData['xf_post']), true) . "']" . $thread['title'] . "[/url]"), false);
}
if ($isThread || $options->dark_taigachat_activity == 'Both') {
$dw = XenForo_DataWriter::create('Dark_TaigaChat_DataWriter_Message');
$dw->setOption(Dark_TaigaChat_DataWriter_Message::OPTION_IS_AUTOMATED, true);
$dw->set('user_id', $visitor['user_id']);
$dw->set('username', $visitor['user_id'] > 0 ? $visitor['username'] : new XenForo_Phrase('guest'));
$dw->set('message', $activityMessage);
$dw->set('activity', 1);
$dw->save();
}
}
}
}
return $response;
}
示例15: runDailyCleanUp
public static function runDailyCleanUp()
{
$options = XenForo_Application::get('options');
$model = XenForo_Model::create('Dark_TaigaChat_Model_TaigaChat');
if ($options->dark_taigachat_archivethread > 0) {
// swap timezone to default temporarily
$oldTimeZone = XenForo_Locale::getDefaultTimeZone()->getName();
XenForo_Locale::setDefaultTimeZone($options->guestTimeZone);
$messages = array_reverse($model->getMessagesToday());
if (count($messages) > 0) {
$userModel = XenForo_Model::create('XenForo_Model_User');
$post = "";
foreach ($messages as $message) {
$message['message'] = XenForo_Helper_String::autoLinkBbCode($message['message']);
$date = XenForo_Locale::dateTime($message['date'], 'absolute');
if ($message['user_id'] > 0) {
$url = XenForo_Link::convertUriToAbsoluteUri(XenForo_Link::buildPublicLink("members/" . $message['user_id']), true);
$user = "[url='{$url}']{$message['username']}[/url]";
} else {
$user = "[b]{$message['username']}[/b]";
}
$me = substr($message['message'], 0, 3) == '/me';
if ($me) {
$message['message'] = substr($message['message'], 3);
$post .= "{$date} - [i]{$user} {$message['message']}[/i]\r\n";
} else {
$post .= "{$date} - {$user}: {$message['message']}\r\n";
}
}
$username = "TaigaChat";
if ($options->dark_taigachat_archiveuser > 0) {
$user = $userModel->getUserById($options->dark_taigachat_archiveuser);
$username = $user['username'];
}
$writer = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');
$writer->setOption(XenForo_DataWriter_DiscussionMessage::OPTION_IS_AUTOMATED, true);
$writer->set('user_id', $options->dark_taigachat_archiveuser);
$writer->set('username', $username);
$writer->set('message', $post);
$writer->set('thread_id', $options->dark_taigachat_archivethread);
$writer->save();
}
// put timezone back to how it was
XenForo_Locale::setDefaultTimeZone($oldTimeZone);
}
$model->deleteOldMessages();
}