本文整理汇总了PHP中JURI::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JURI::getInstance方法的具体用法?PHP JURI::getInstance怎么用?PHP JURI::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JURI
的用法示例。
在下文中一共展示了JURI::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findOption
/**
* Return the application option string [main component].
*
* @return string Option.
* @since 1.5
*/
public static function findOption()
{
$option = strtolower(JRequest::getCmd('option'));
$user = JFactory::getUser();
if ($user->get('guest') || !$user->authorise('core.login.admin')) {
$option = 'com_login';
JRequest::setVar('tmpl', 'login');
}
if (empty($option)) {
$menu = JTable::getInstance('Menu', 'JTable');
$menu->load(array('home' => '1', 'client_id' => '1'));
$uri = JURI::getInstance();
$uri->parse($menu->link);
$vars = $uri->getQuery(true);
foreach ($vars as $var => $key) {
JRequest::setVar($var, $key);
if ($var == 'option') {
$option = $key;
}
}
if ($option == '') {
$option = 'com_cpanel';
JRequest::setVar('option', $option);
}
}
return $option;
}
示例2: display
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
// Get the current URI to redirect to.
$uri = JURI::getInstance();
$redirect = base64_encode($uri);
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
if (file_exists(JPATH_CONFIGURATION . '/configuration.php') && filesize(JPATH_CONFIGURATION . '/configuration.php') > 10 && file_exists(JPATH_INSTALLATION . '/index.php')) {
$default_view = 'remove';
} else {
$default_view = 'language';
}
$vName = JRequest::getWord('view', $default_view);
$vFormat = $document->getType();
$lName = JRequest::getWord('layout', 'default');
if (strcmp($vName, $default_view) == 0) {
JRequest::setVar('view', $default_view);
}
if ($view = $this->getView($vName, $vFormat)) {
switch ($vName) {
default:
$model = $this->getModel('Setup', 'JInstallationModel', array('dbo' => null));
break;
}
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->document = $document;
$view->display();
}
return $this;
}
示例3: 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;
}
示例4: js
/**
* Get Page JavaScript from either session or cached .js file
*
* @return string
*/
public static function js()
{
$config = JFactory::getConfig();
if ($config->get('caching') == 0) {
$script = self::buildJs();
} else {
$uri = JURI::getInstance();
$session = JFactory::getSession();
$uri = $uri->toString(array('path', 'query'));
$file = md5($uri) . '.js';
$folder = JPATH_SITE . '/cache/com_fabrik/js/';
if (!JFolder::exists($folder)) {
JFolder::create($folder);
}
$cacheFile = $folder . $file;
// Check for cached version
if (!JFile::exists($cacheFile)) {
$script = self::buildJs();
file_put_contents($cacheFile, $script);
} else {
$script = JFile::read($cacheFile);
}
}
self::clearJs();
return $script;
}
示例5: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
$app = JFactory::getApplication('site');
// Load state from the request.
$pk = $app->input->getInt('id');
$this->setState('onlinepayment.id', $pk);
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
$this->MID = $params->get('zarinpal_merchant_id', NULL);
$this->Amount = $params->get('diet_price', NULL);
$user = JFactory::getUser();
if (!$user->guest && $user->username == 'mohammadnaji') {
// When we ourselves want to pay, should pay 100 toomans instea.
$this->Amount = 1000;
}
$this->RedirectURL = JURI::getInstance();
if (!$this->MID) {
$this->setError(JText::_('COM_SIBDIET_ONLINE_PAYMENT_MID_NOT_SET'));
} elseif ($Status = $app->input->get('Status', NULL, 'STRING')) {
$ResNum = $app->input->get('Authority', NULL, 'STRING');
if ($this->checkTransaction($Status, $ResNum)) {
$app->redirect(JRoute::_('index.php?option=com_sibdiet&view=requests', false), JText::_('COM_SIBDIET_REQUEST_SAVED'));
}
}
}
示例6: onAfterInitialise
/**
* Routes URLs
*
* @access public
*/
function onAfterInitialise()
{
$mainframe =& JFactory::getApplication();
$uri =& JURI::getInstance();
$router =& $mainframe->getRouter();
$router->attachParseRule('parseJumiRouter');
}
示例7: getExternalURL
/**
* Method to wrap around getting the correct links within the email
*
* @return string $url
* @param string $url
* @param boolean $xhtml
*/
static function getExternalURL( $url , $xhtml = false )
{
$uri = JURI::getInstance();
$base = $uri->toString( array('scheme', 'host', 'port'));
return $base . TRoute::_( $url , $xhtml );
}
示例8: display
function display($tpl = null)
{
$this->context = 'com_solidres.reservation.process';
$this->config = JComponentHelper::getParams('com_solidres');
$this->showPoweredByLink = $this->config->get('show_solidres_copyright', '1');
if ($this->_layout == 'default') {
$model = $this->getModel();
$modelName = $model->getName();
$this->reservation = $model->getItem();
$this->app = JFactory::getApplication();
$this->checkin = $model->getState($modelName . '.checkin');
$this->checkout = $model->getState($modelName . '.checkout');
$this->totalReservedRoom = $model->getState($modelName . '.totalReservedRoom');
$this->countries = SolidresHelper::getCountryOptions();
$this->geoStates = SolidresHelper::getGeoStateOptions($model->getState($modelName . '.countryId'));
$this->userState = $this->app->getUserState($this->context);
$this->raid = $model->getState($modelName . '.reservationAssetId');
$this->uri = JURI::getInstance()->__toString();
$this->roomTypeObj = SRFactory::get('solidres.roomtype.roomtype');
$this->numberOfNights = $this->roomTypeObj->calculateDateDiff($this->checkin, $this->checkout);
JHtml::_('jquery.framework');
}
JHtml::stylesheet('com_solidres/assets/main.css', false, true, false);
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
parent::display($tpl);
}
示例9: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
// We only use this feature in the front-end
if (F0FPlatform::getInstance()->isBackend())
{
return false;
}
// The feature must be enabled
if ($this->cparams->getValue('httpsizer', 0) != 1)
{
return false;
}
// Make sure we're accessed over SSL (HTTPS)
$uri = JURI::getInstance();
$protocol = $uri->toString(array('scheme'));
if ($protocol != 'https://')
{
return false;
}
return true;
}
示例10: display
function display($tpl = null)
{
$app =& JFactory::getApplication();
$today =& JFactory::getDate();
$uri =& JURI::getInstance();
$this->uri = $uri->getScheme() . '://' . $uri->getHost() . $uri->getPath();
$itemid = JRequest::getInt('Itemid');
$this->step = isset($this->step) ? $this->step : 0;
$this->assignRef('today', $today);
if ($this->step != 1 && $this->step > 0) {
$this->assignRef('av_date', $today);
}
$_format = JRequest::getString('tmpl', '');
$this->is_modal = $_format == 'component' ? true : false;
$this->_addScripts($this->step, $this->is_modal);
$user =& JFactory::getUser();
$this->assignRef('user', $user);
$this->setstate = JobBoardHelper::renderJobBoard();
$this->day_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%d' : 'd';
$this->month_long_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%B' : 'F';
$this->month_short_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%b' : 'M';
$this->year_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%Y' : 'Y';
$this->user_entry_point = 'com_users';
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$this->user_entry_point = 'com_users';
} elseif (version_compare(JVERSION, '1.5.0', 'ge')) {
$this->user_entry_point = 'com_user';
}
parent::display($tpl);
}
示例11: getLimitBox
function getLimitBox()
{
$url = $this->getStatURI();
$url = JRoute::_($url);
$myURI = JURI::getInstance($url);
//if(!empty($itemId))$myURI->setVar('Itemid', $itemId);
if ($myURI->getQuery()) {
$wildcard = '&';
} else {
$wildcard = '?';
}
$url .= $wildcard;
$limits = array();
//$url='index.php?virtuemart_category_id[0]=3&virtuemart_category_id[1]=4&view=products&limit=5&option=com_customfilters&limit=';
//var_dump(JRoute::_($url.'limit=5'));
// Make the option list.
//mod fazan 04-12-2012
//for ($i = 12; $i <= 96; $i += 12) {
for ($i = 30; $i <= 90; $i += 30) {
$limits[] = JHtml::_('select.option', 'limit=' . $i, $i);
}
$js = 'onchange="window.top.location=\'' . $url . '\'+this.options[this.selectedIndex].value"';
$selected = 'limit=' . $this->limit;
$html = JHtml::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1"' . $js, 'value', 'text', $selected);
return $html;
}
示例12: save_myApiConnect
function save_myApiConnect() {
$post = JRequest::get('post');
$u =& JURI::getInstance(JURI::root());
$port = ($u->getPort() == '') ? '' : ":".$u->getPort();
$host = (substr($u->getHost(),0,4) == 'www.') ? substr($u->getHost(),4) : $u->getHost();
$connectURL = $u->getScheme().'://'.$host.$port.$u->getPath();
$baseDomain = $host;
$data['base_domain'] = $baseDomain;
$data['uninstall_url'] = JURI::root().'index.php?option=com_myapi&task=deauthorizeCallback';
$data['connect_url'] = $connectURL;
try{
require_once JPATH_SITE.DS.'plugins'.DS.'system'.DS.'myApiConnectFacebook.php';
$facebook = new myApiFacebook(array(
'appId' => $post['params']['appId'],
'secret' => $post['params']['secret']
));
$app_update = $facebook->api(array('method' => 'admin.setAppProperties','access_token' => $post['params']['appId'].'|'.$post['params']['secret'],'properties'=> json_encode($data)));
$model = $this->getModel('realtime');
$model->addSubscriptions();
$this->setRedirect( 'index.php?option=com_myapi&view=plugin&plugin=myApiConnect',JText::_('APP_SAVED'));
}catch (FacebookApiException $e) {
$this->setRedirect( 'index.php?option=com_myapi&view=plugin&plugin=myApiConnect',JText::_('APP_SAVED_ERROR').$e);
}
}
示例13: display
function display($tpl = null)
{
$app = JFactory::getApplication();
// get parameters
$params = clone $app->getParams('com_rsmembership');
$pathway = $app->getPathway();
$pathway->addItem(JText::_('COM_RSMEMBERSHIP_RENEW'), '');
// get the logged user
$this->user = JFactory::getUser();
// get the current layout
$layout = $this->getLayout();
if ($layout == 'default') {
$this->payments = RSMembership::getPlugins();
// get the encoded return url
$this->return = base64_encode(JURI::getInstance());
$this->data = $this->get('data');
// get the membership
$this->membership = $this->get('membership');
$this->membershipterms = $this->get('membershipterms');
$this->fields = RSMembershipHelper::getFields(true);
$this->fields_validation = RSMembershipHelper::getFieldsValidation($this->membership->id);
$this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id, true, $this->user->id, true, $this->membership->last_transaction_id);
} elseif ($layout == 'payment') {
$this->html = $this->get('html');
}
// get the extras
$this->extras = $this->get('extras');
$this->cid = $this->get('cid');
$this->config = $this->get('config');
$this->params = $params;
$this->token = JHTML::_('form.token');
$this->currency = RSMembershipHelper::getConfig('currency');
parent::display();
}
示例14: cssPath
/**
*
* Check and convert to css real path
* @var url
*/
public static function cssPath($url = '')
{
$url = preg_replace('#[?\\#]+.*$#', '', $url);
$base = JURI::base();
$root = JURI::root(true);
$path = false;
$ret = false;
if (substr($url, 0, 2) === '//') {
//check and append if url is omit http
$url = JURI::getInstance()->getScheme() . ':' . $url;
}
//check for css file extensions
foreach (self::$cssexts as $ext) {
if (substr_compare($url, $ext, -strlen($ext), strlen($ext)) === 0) {
$ret = true;
break;
}
}
if ($ret) {
if (preg_match('/^https?\\:/', $url)) {
//is full link
if (strpos($url, $base) === false) {
// external css
return false;
}
$path = JPath::clean(JPATH_ROOT . '/' . substr($url, strlen($base)));
} else {
$path = JPath::clean(JPATH_ROOT . '/' . ($root && strpos($url, $root) === 0 ? substr($url, strlen($root)) : $url));
}
return is_file($path) ? $path : false;
}
return false;
}
示例15: display
/**
* Method to display a view.
*
* @return void
* @since 1.0
*/
public function display()
{
// Get the current URI to redirect to.
$uri =& JURI::getInstance();
$redirect = $uri->toString();
$redirect = base64_encode($redirect);
// Get the document object.
$document =& JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = JRequest::getWord('view', 'language');
$vFormat = $document->getType();
$lName = JRequest::getWord('layout', 'default');
if ($view =& $this->getView($vName, $vFormat)) {
switch ($vName) {
default:
$model =& $this->getModel('Setup', 'JInstallationModel', array('dbo' => null));
break;
}
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->assignRef('document', $document);
$view->display();
}
}