本文整理汇总了PHP中JUri::current方法的典型用法代码示例。如果您正苦于以下问题:PHP JUri::current方法的具体用法?PHP JUri::current怎么用?PHP JUri::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUri
的用法示例。
在下文中一共展示了JUri::current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(JForm $form = null)
{
parent::__construct($form);
static $resources = true;
if ($resources) {
$resources = false;
$name = basename(realpath(dirname(__FILE__) . "/../.."));
$document = JFactory::getDocument();
// $this->element is not ready on the constructor
//$type = (string)$this->element["type"];
$type = strtolower($this->type);
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $type . "&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
}
$scope = JFactory::getApplication()->scope;
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $scope . ".js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $scope . "&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $scope . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $scope . ".css");
}
}
}
示例2: display
public function display($tpl = null)
{
$this->_prepareDocument();
//
$user = JFactory::getUser();
if ($user->guest) {
$app = JFactory::getApplication();
$return = base64_encode(JUri::current());
$app->redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $return));
return false;
}
$this->providerList = $this->get('UnconnectedProviders');
/*
$layout = JRequest::getVar('layout');
switch($layout){
case 'edit':
$this->form = $this->get('Form');
break;
default:
$this->data = $this->get('UserData');
break;
}
*/
//$this->data = $this->get('UserData');
parent::display($tpl);
}
示例3: getFilePath
/**
* Retrieve path to file in hard disk based from file URL
*
* @param string $file URL to the file
* @return string
*/
public static function getFilePath($file)
{
// Located file from root
if (strpos($file, '/') === 0) {
if (file_exists($tmp = realpath(str_replace(JUri::root(true), JPATH_ROOT, $file)))) {
return $tmp;
} elseif (file_exists($tmp = realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $file))) {
return $tmp;
} elseif (file_exists($tmp = realpath(JPATH_ROOT . '/' . $file))) {
return $tmp;
}
}
if (strpos($file, '://') !== false && JURI::isInternal($file)) {
$path = parse_url($file, PHP_URL_PATH);
if (file_exists($tmp = realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $path))) {
return $tmp;
} elseif (file_exists($tmp = realpath(JPATH_ROOT . '/' . $path))) {
return $tmp;
}
}
$rootURL = JUri::root();
$currentURL = JUri::current();
$currentPath = JPATH_ROOT . '/' . substr($currentURL, strlen($rootURL));
$currentPath = str_replace(DIRECTORY_SEPARATOR, '/', $currentPath);
$currentPath = dirname($currentPath);
return JPath::clean($currentPath . '/' . $file);
}
示例4: onAfterDispatch
/**
* This event is triggered after the framework has loaded and the application initialise method has been called.
*
* @return void
*/
public function onAfterDispatch()
{
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$input = $app->input;
// Check to make sure we are loading an HTML view and there is a main component area
if ($document->getType() !== 'html' || $input->get('tmpl', '', 'cmd') === 'component' || $app->isAdmin()) {
return true;
}
// Get additional data to send
$attrs = array();
$attrs['title'] = $document->title;
$attrs['language'] = $document->language;
$attrs['referrer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : JUri::current();
$attrs['url'] = JURI::getInstance()->toString();
$user = JFactory::getUser();
// Get info about the user if logged in
if (!$user->guest) {
$attrs['email'] = $user->email;
$name = explode(' ', $user->name);
if (isset($name[0])) {
$attrs['firstname'] = $name[0];
}
if (isset($name[count($name) - 1])) {
$attrs['lastname'] = $name[count($name) - 1];
}
}
$encodedAttrs = urlencode(base64_encode(serialize($attrs)));
$buffer = $document->getBuffer('component');
$image = '<img style="display:none" src="' . trim($this->params->get('base_url'), ' \\t\\n\\r\\0\\x0B/') . '/mtracking.gif?d=' . $encodedAttrs . '" />';
$buffer .= $image;
$document->setBuffer($buffer, 'component');
return true;
}
示例5: onAfterRoute
/**
* Check for oAuth authentication/authorization requests and fire
* appropriate oAuth events.
*
* @return void
*/
public function onAfterRoute()
{
if (JFactory::getApplication()->getName() == 'site') {
$app = JFactory::getApplication();
$session = JFactory::getSession();
$uri = clone JUri::getInstance();
$task = JArrayHelper::getValue($uri->getQuery(true), 'task');
$task = $session->get('oauth.task', $task);
$session->clear('oauth.task');
$plugin = $session->get('oauth.plugin', $app->input->get('plugin'));
$session->clear('oauth.plugin');
if ($task) {
JPluginHelper::importPlugin('authentication', $plugin);
$dispatcher = JEventDispatcher::getInstance();
if ($task == 'oauth.authenticate') {
$data = $app->getUserState('users.login.form.data', array());
$data['return'] = $app->input->get('return', null);
$app->setUserState('users.login.form.data', $data);
// update the current task and pass the plugin to the session.
$session->set('oauth.task', 'oauth.authorize');
$session->set('oauth.plugin', $plugin);
$dispatcher->trigger('onOauthAuthenticate', array());
} else {
if ($task == 'oauth.authorize') {
$array = $dispatcher->trigger('onOauthAuthorize', array());
// redirect user to appropriate area of site.
if ($array[0] === true) {
$data = $app->getUserState('users.login.form.data', array());
$app->setUserState('users.login.form.data', array());
$user = JFactory::getUser();
if ($this->params->get('review_profile', false) && !(bool) $user->getParam("profile.reviewed", false)) {
$item = JFactory::getApplication()->getMenu('site')->getItems(array('link'), array('index.php?option=com_users&view=profile&layout=edit'), true);
if ($item) {
$redirect = 'index.php?Itemid=' . $item->id;
} else {
$redirect = 'index.php?option=com_users&view=profile&layout=edit';
}
if ($return) {
$redirect .= '&return=' . $return;
}
$user->setParam('profile.reviewed', (int) true);
$user->save();
} else {
if ($return = JArrayHelper::getValue($data, 'return')) {
$redirect = base64_decode($return);
} else {
$redirect = JUri::current();
}
}
$app->redirect(JRoute::_($redirect, false));
} else {
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
}
}
}
}
}
}
示例6: contact
/**
* Submit contact form
*/
function contact()
{
$model = $this->getModel('Item');
if ($model->contact()) {
$this->setRedirect(JUri::current(), JText::_('COM_JKIT_ITEM_CONTACT_OK'));
} else {
$this->setRedirect(JUri::current(), $model->getError(), 'error');
}
}
示例7: onOauthAuthenticate
/**
* Authenticate the user via the oAuth login and authorize access to the
* appropriate REST API end-points.
*/
public function onOauthAuthenticate()
{
$oauth = new JTwitterOAuth();
$oauth->setOption('callback', JUri::current());
$oauth->setOption('consumer_key', $this->params->get('clientid'));
$oauth->setOption('consumer_secret', $this->params->get('clientsecret'));
$oauth->setOption('sendheaders', true);
$oauth->authenticate();
}
示例8: __construct
/**
* Constructor
*
* @param object &$subject The object to observe
* @param array $config An array that holds the plugin configuration
*
* @access protected
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// Save this page's URL
$uri = JFactory::getURI();
$return = '&return=' . urlencode(base64_encode(JUri::current() . '?' . $uri->getQuery()));
$app = JFactory::getApplication();
$app->setUserState('com_attachments.current_url', $return);
$this->loadLanguage();
}
示例9: plgSystemCCK
function plgSystemCCK(&$subject, $config)
{
$app = JFactory::getApplication();
if ($app->isAdmin()) {
JFactory::getLanguage()->load('lib_cck', JPATH_SITE);
if (file_exists(JPATH_SITE . '/plugins/cck_storage_location/joomla_user_note/joomla_user_note.php')) {
$this->content_objects['joomla_user_note'] = 1;
}
}
jimport('joomla.filesystem.file');
jimport('cck.base.cck');
// deprecated
// Content
jimport('cck.content.article');
//jimport( 'cck.content.category' );
jimport('cck.content.content');
jimport('cck.content.user');
// Development
jimport('cck.development.database');
// deprecated
$this->multisite = JCck::_setMultisite();
if ($this->multisite === true) {
$this->site = null;
$this->site_cfg = new JRegistry();
if (JCck::isSite()) {
$this->site = JCck::getSite();
$this->site_cfg->loadString($this->site->configuration);
if ($app->isSite() && $this->site) {
// --- Redirect to Homepage
$homepage = $this->site_cfg->get('homepage', 0);
if ($homepage > 0) {
$current = JUri::current(true);
$len = strlen($current);
if ($current[$len - 1] == '/') {
$current = substr($current, 0, -1);
}
$current = str_replace(array('http://', 'https://'), '', $current);
if ($current == $this->site->host) {
$redirect_url = JRoute::_('index.php?Itemid=' . $homepage);
if ($redirect_url != JUri::root(true) . '/') {
JFactory::getApplication()->redirect($redirect_url);
}
}
}
// ---
$tag = $this->site_cfg->get('language');
if ($tag) {
JFactory::getConfig()->set('language', $tag);
JFactory::getLanguage()->setLanguage($tag);
}
}
}
}
parent::__construct($subject, $config);
}
示例10: __construct
public function __construct(JForm $form = null)
{
parent::__construct($form);
static $resources = true;
if ($resources) {
$resources = false;
$name = basename(realpath(dirname(__FILE__) . "/../.."));
$document = JFactory::getDocument();
$type = strtolower($this->type);
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $type . "&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
}
$scope = JFactory::getApplication()->scope;
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $scope . ".js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $scope . "&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $scope . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $scope . ".css");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/glDatePicker.js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=glDatePicker&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/glDatePicker.css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/glDatePicker.css");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/style.css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/style.css");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/script.js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=script&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/jquery.mjs.nestedSortable.js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=jquery.mjs.nestedSortable&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/nestedSortable.css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/nestedSortable.css");
}
$GLOBALS["com_name"] = basename(realpath(dirname(__FILE__) . "/../.."));
$module = JFactory::getApplication()->input->get("option") == "com_modules";
$language = JFactory::getLanguage();
$enGB = $language->get("tag") == $language->getDefault();
if (!$enGB || $module) {
$language->load($GLOBALS["com_name"], JPATH_ADMINISTRATOR, $language->getDefault(), true);
$language->load($GLOBALS["com_name"], JPATH_ADMINISTRATOR, null, true);
}
}
}
示例11: getInput
protected function getInput()
{
$name = basename(realpath(dirname(__FILE__) . "/../.."));
static $resources = true;
$i18n = array('public' => JText::_("COM_OZIOGALLERY3_ALBUM_PUBLIC"), 'private' => JText::_("COM_OZIOGALLERY3_ALBUM_PRIVATE"), 'protected' => JText::_("COM_OZIOGALLERY3_ALBUM_PROTECTED"), 'topublic' => JText::_("COM_OZIOGALLERY3_ALBUM_TOPUBLIC"), 'toprivate' => JText::_("COM_OZIOGALLERY3_ALBUM_TOPRIVATE"), 'toprotected' => JText::_("COM_OZIOGALLERY3_ALBUM_TOPROTECTED"));
if ($resources) {
$resources = false;
JHtml::_('behavior.framework', true);
$document = JFactory::getDocument();
$prefix = JUri::current() . "?option=" . $name . "&view=loader";
// pwi
$document->addScript(JUri::root(true) . "/media/" . $name . "/js/jquery-pwi.js");
// Alternative code: $type = strtolower($this->type);
$type = (string) $this->element["type"];
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
$document->addScript($prefix . "&type=js&filename=" . $type);
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
}
// per la compatibilità con Internet Explorer
$document->addScript(JURI::root(true) . "/media/" . $name . "/js/jQuery.XDomainRequest.js");
$document->addScript(JUri::base(true) . "/components/com_oziogallery3/js/get_id.js");
$document->addScriptDeclaration("var g_ozio_admin_buttons=" . json_encode($i18n) . ";");
$document->addStyleSheet(JUri::base(true) . "/components/com_oziogallery3/models/fields/fields.css");
}
$buttons = '';
$buttons .= '<div class="ozio-buttons-frame">';
$buttons .= '<iframe style="margin:0;padding:0;border:0;width:30px;height:22px;overflow:hidden;" src="https://www.opensourcesolutions.es/album_publish_v2.html"></iframe>';
$buttons .= '</div>';
$html = array();
$html[] = '<div id="oziogallery-modal" class="modal hide fade" >';
$html[] = '';
$html[] = ' <div class="modal-header">';
$html[] = ' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>';
$html[] = ' <h3>Ozio Gallery</h3>';
$html[] = ' </div>';
$html[] = ' <div class="modal-body" style="overflow-y:auto;">';
$html[] = ' <div class="alert alert-info"><button type="button" class="close" data-dismiss="alert">×</button> ';
$html[] = ' <p><strong>' . JText::_("COM_OZIOGALLERY3_WAIT_GDATA_MSG") . '</strong></p></div> ';
$html[] = ' <table class="table table-striped">';
$html[] = ' </table>';
$html[] = ' </div>';
$html[] = ' <div class="modal-footer">';
$html[] = ' <button class="btn" data-dismiss="modal" aria-hidden="true">OK</button>';
$html[] = ' </div>';
$html[] = '</div>';
$buttons .= implode(" ", $html);
return '<div id="album_selection">' . parent::getInput() . $buttons . '<img id="jform_params_' . (string) $this->element["name"] . '_loader" style="display:none;" src="' . JUri::root(true) . '/media/' . $name . '/views/00fuerte/img/progress.gif">' . '<span id="jform_params_' . (string) $this->element["name"] . '_warning" style="display:none;">' . JText::_("COM_OZIOGALLERY3_ERR_INVALID_USER") . '</span>' . '<span id="jform_params_' . (string) $this->element["name"] . '_selected" style="display:none;">' . $this->value . '</span>' . '</div>';
}
示例12: __construct
public function __construct(JForm $form = null)
{
parent::__construct($form);
/*
(include_once JPATH_ROOT . "/components/com_foxcontact/helpers/flogger.php") or die(JText::sprintf("JLIB_FILESYSTEM_ERROR_READ_UNABLE_TO_OPEN_FILE", "flogger.php"));
$log = new FLogger($this->type, "debug");
$log->Write($this->element["name"] . " getLabel()");
*/
static $resources = true;
if ($resources) {
$resources = false;
$name = basename(realpath(dirname(__FILE__) . "/../.."));
$document = JFactory::getDocument();
// $this->element is not ready on the constructor
//$type = (string)$this->element["type"];
$type = strtolower($this->type);
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $type . "&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
}
$scope = JFactory::getApplication()->scope;
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $scope . ".js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $scope . "&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $scope . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $scope . ".css");
}
$GLOBALS["com_name"] = basename(realpath(dirname(__FILE__) . "/../.."));
// If we are in module manager always load the language, since the default module admin language is empty
$option = JFactory::getApplication()->input->get("option");
// $option != "com_menus" includes "com_modules", "com_advancedmodules" and similar module manager
$module = $option != "com_menus";
$language = JFactory::getLanguage();
$enGB = $language->get("tag") == $language->getDefault();
// If we are within the component, don't waste our time reloading the same English language two more times.
// Using less CPU power reduces the world carbon dioxide emissions.
if (!$enGB || $module) {
// The current language is already been loaded, so it is important for the following workaround to work, that the parameter $reload is set to true
// Reload the default language (en-GB)
$language->load($GLOBALS["com_name"], JPATH_ADMINISTRATOR, $language->getDefault(), true);
// Reload current language, overwriting nearly all the strings, but keeping the english version for untranslated strings
$language->load($GLOBALS["com_name"], JPATH_ADMINISTRATOR, null, true);
}
}
}
示例13: onAfterRoute
/**
* Add the canonical uri to the head
*
* @return void
*
* @since 3.0
*/
public function onAfterRoute()
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
if ($app->getName() != 'site' || $doc->getType() !== 'html') {
return true;
}
$uri = JUri::getInstance();
$domain = $this->params->get('domain');
$current = JUri::current();
if ($domain === null || $domain === '') {
$domain = $uri->toString(array('scheme', 'host', 'port'));
}
$link = 'index.php' . $uri->toString(array('query', 'fragment'));
$link = $domain . JRoute::_($link);
if ($current !== $link) {
$doc->addHeadLink($link, 'canonical');
}
}
示例14: getInput
protected function getInput()
{
$name = basename(realpath(dirname(__FILE__) . "/../.."));
static $resources = true;
if ($resources) {
$resources = false;
$document = JFactory::getDocument();
$prefix = JUri::current() . "?option=" . $name . "&view=loader";
// pwi
$document->addScript(JUri::root(true) . "/components/" . $name . "/js/jquery-pwi.js");
// Alternative code: $type = strtolower($this->type);
$type = (string) $this->element["type"];
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
$document->addScript($prefix . "&type=js&filename=" . $type);
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
}
// per la compatibilità con Internet Explorer
$document->addScript(JURI::root(true) . "/components/" . $name . "/js/jQuery.XDomainRequest.js");
}
return '<div id="album_selection">' . parent::getInput() . '<img id="jform_params_' . (string) $this->element["name"] . '_loader" style="display:none;" src="' . JUri::root(true) . '/components/' . $name . '/views/00fuerte/img/progress.gif">' . '<span id="jform_params_' . (string) $this->element["name"] . '_warning" style="display:none;">' . JText::_("COM_OZIOGALLERY3_ERR_INVALID_USER") . '</span>' . '<span id="jform_params_' . (string) $this->element["name"] . '_selected" style="display:none;">' . $this->value . '</span>' . '</div>';
}
示例15: getCalendarLink
function getCalendarLink($month, $year)
{
$getquery = JRequest::get('GET');
//get the GET query
$calendarLink = JUri::current() . '?';
//get the current url, without the GET query; and add "?", to set the GET vars
foreach ($getquery as $key => $value) {
/*this bucle goes through every GET variable that was in the url*/
if ($key != 'month' and $key != 'year' and $key != 'day' and $value) {
/*the month,year, and day Variables must be diferent of the current ones, because this is a link for a diferent month */
$calendarLink .= $key . '=' . $value . '&';
}
}
$calendarLink .= 'month=' . $month . '&year=' . $year;
//add the month and the year that was passed to the function to the GET string
return $calendarLink;
}