本文整理汇总了PHP中FRoute::raw方法的典型用法代码示例。如果您正苦于以下问题:PHP FRoute::raw方法的具体用法?PHP FRoute::raw怎么用?PHP FRoute::raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FRoute
的用法示例。
在下文中一共展示了FRoute::raw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPreviewURI
/**
* Returns the php version of the source item.
*
* @since 1.0
* @access public
* @param null
* @return string The absolute URI for previewing an item.
*/
public function getPreviewURI()
{
if ($this->storage != 'joomla') {
$storage = FD::storage($this->storage);
$path = $this->getStoragePath(true);
$path = $path . '/' . $this->hash;
return $storage->getPermalink($path);
}
// We need to fix the path for groups!
$type = $this->type;
if ($type == 'group') {
$type = 'groups';
}
if ($type == 'event') {
$type = 'events';
}
$uri = FRoute::raw('index.php?option=com_easysocial&view=' . $type . '&layout=preview&fileid=' . $this->id . '&tmpl=component');
return $uri;
}
示例2: oauth
/**
* Displays the first step of user signing up with oauth
*
* @since 1.0
* @access public
*/
public function oauth()
{
// If user is already logged in here, they shouldn't be allowed on this page.
if (!$this->my->guest) {
$this->setMessage(JText::_('COM_EASYSOCIAL_OAUTH_YOU_ARE_ALREADY_LOGGED_IN'), SOCIAL_MSG_ERROR);
FD::info()->set($this->getMessage());
$this->redirect(FRoute::dashboard(array(), false));
}
// Get allowed clients
$allowedClients = array_keys((array) $this->config->get('oauth'));
// Get the current client.
$oauthClient = $this->input->get('client', '', 'word');
if (!in_array($oauthClient, $allowedClients)) {
FD::info()->set(false, JText::sprintf('COM_EASYSOCIAL_OAUTH_INVALID_OAUTH_CLIENT_PROVIDED', $oauthClient), SOCIAL_MSG_ERROR);
return $this->redirect(FRoute::login(array(), false));
}
// Get the oauth client object.
$client = FD::oauth($oauthClient);
// Add page title
$title = JText::sprintf('COM_EASYSOCIAL_OAUTH_PAGE_TITLE', ucfirst($oauthClient));
$this->page->title($title);
// Add breadcrumbs
$this->page->breadcrumb($title);
// Check configuration if the registration mode is set to simplified or normal.
$registrationType = $this->config->get('oauth.' . $oauthClient . '.registration.type');
if ($registrationType == 'simplified') {
$createUrl = FRoute::raw('index.php?option=com_easysocial&controller=registration&task=oauthSignup&client=' . $oauthClient);
} else {
$createUrl = FRoute::registration(array('layout' => 'oauthSelectProfile', 'client' => $oauthClient));
}
// Check if import avatar option is enabled
$importAvatar = $this->config->get('oauth.' . $oauthClient . '.registration.avatar');
// Check if import cover option is enabled
$importCover = $this->config->get('oauth.' . $oauthClient . '.registration.cover');
// Get user's meta
try {
$meta = $client->getUserMeta();
} catch (Exception $e) {
$app = JFactory::getApplication();
// Use dashboard here instead of login because api error calls might come from after user have successfully logged in
$url = FRoute::dashboard(array(), false);
$message = (object) array('message' => JText::sprintf('COM_EASYSOCIAL_OAUTH_FACEBOOK_ERROR_MESSAGE', $e->getMessage()), 'type' => SOCIAL_MSG_ERROR);
FD::info()->set($message);
$app->redirect($url);
$app->close();
}
$this->set('meta', $meta);
$this->set('createUrl', $createUrl);
$this->set('clientType', $oauthClient);
$this->set('importAvatar', $importAvatar);
$this->set('importCover', $importCover);
parent::display('site/registration/oauth');
}