本文整理汇总了PHP中JUri类的典型用法代码示例。如果您正苦于以下问题:PHP JUri类的具体用法?PHP JUri怎么用?PHP JUri使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JUri类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTree
/**
* @param XmapDisplayerInterface $xmap
* @param stdClass $parent
* @param array $params
*/
public static function getTree($xmap, stdClass $parent, array &$params)
{
$uri = new JUri($parent->link);
if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
return;
}
$params['include_entries'] = JArrayHelper::getValue($params, 'include_entries', 1);
$params['include_entries'] = $params['include_entries'] == 1 || $params['include_entries'] == 2 && $xmap->view == 'xml' || $params['include_entries'] == 3 && $xmap->view == 'html';
$params['include_expired_entries'] = JArrayHelper::getValue($params, 'include_expired_entries', 0);
$params['include_expired_entries'] = $params['include_expired_entries'] == 1 || $params['include_expired_entries'] == 2 && $xmap->view == 'xml' || $params['include_expired_entries'] == 3 && $xmap->view == 'html';
$params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
$params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
if ($params['category_priority'] == -1) {
$params['category_priority'] = $parent->priority;
}
if ($params['category_changefreq'] == -1) {
$params['category_changefreq'] = $parent->changefreq;
}
$params['entry_priority'] = JArrayHelper::getValue($params, 'entry_priority', $parent->priority);
$params['entry_changefreq'] = JArrayHelper::getValue($params, 'entry_changefreq', $parent->changefreq);
if ($params['entry_priority'] == -1) {
$params['entry_priority'] = $parent->priority;
}
if ($params['entry_changefreq'] == -1) {
$params['entry_changefreq'] = $parent->changefreq;
}
switch ($uri->getVar('view')) {
case 'front':
self::getCategoryTree($xmap, $parent, $params, 0);
break;
case 'list':
self::getEntries($xmap, $parent, $params, $uri->getVar('catid'));
break;
}
}
示例2: getTree
/**
* @param XmapDisplayerInterface $xmap
* @param stdClass $parent
* @param array $params
*/
public static function getTree($xmap, stdClass $parent, array &$params)
{
$uri = new JUri($parent->link);
if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
return;
}
$params['groups'] = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
$params['include_events'] = JArrayHelper::getValue($params, 'include_events', 1);
$params['include_events'] = $params['include_events'] == 1 || $params['include_events'] == 2 && $xmap->view == 'xml' || $params['include_events'] == 3 && $xmap->view == 'html';
$params['show_unauth'] = JArrayHelper::getValue($params, 'show_unauth', 0);
$params['show_unauth'] = $params['show_unauth'] == 1 || $params['show_unauth'] == 2 && $xmap->view == 'xml' || $params['show_unauth'] == 3 && $xmap->view == 'html';
$params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
$params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
if ($params['category_priority'] == -1) {
$params['category_priority'] = $parent->priority;
}
if ($params['category_changefreq'] == -1) {
$params['category_changefreq'] = $parent->changefreq;
}
$params['event_priority'] = JArrayHelper::getValue($params, 'event_priority', $parent->priority);
$params['event_changefreq'] = JArrayHelper::getValue($params, 'event_changefreq', $parent->changefreq);
if ($params['event_priority'] == -1) {
$params['event_priority'] = $parent->priority;
}
if ($params['event_changefreq'] == -1) {
$params['event_changefreq'] = $parent->changefreq;
}
self::getEvents($xmap, $parent, $params, $uri->getVar('catid'));
}
示例3: getTree
/**
* @param XmapDisplayerInterface $xmap
* @param stdClass $parent
* @param array $params
*/
public static function getTree($xmap, stdClass $parent, array &$params)
{
$uri = new JUri($parent->link);
if ($xmap->isNews || !self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
return;
}
$params['include_topics'] = JArrayHelper::getValue($params, 'include_topics', 1);
$params['include_topics'] = $params['include_topics'] == 1 || $params['include_topics'] == 2 && $xmap->view == 'xml' || $params['include_topics'] == 3 && $xmap->view == 'html';
$params['include_pagination'] = JArrayHelper::getValue($params, 'include_pagination', 0);
$params['include_pagination'] = $params['include_pagination'] == 1 || $params['include_pagination'] == 2 && $xmap->view == 'xml' || $params['include_pagination'] == 3 && $xmap->view == 'html';
$params['cat_priority'] = JArrayHelper::getValue($params, 'cat_priority', $parent->priority);
$params['cat_priority'] = $params['cat_priority'] == -1 ? $parent->priority : $params['cat_priority'];
$params['cat_changefreq'] = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq);
$params['cat_changefreq'] = $params['cat_changefreq'] == -1 ? $parent->changefreq : $params['cat_changefreq'];
$params['topic_priority'] = JArrayHelper::getValue($params, 'topic_priority', $parent->changefreq);
$params['topic_priority'] = $params['topic_priority'] == -1 ? $parent->priority : $params['topic_priority'];
$params['topic_changefreq'] = JArrayHelper::getValue($params, 'topic_changefreq', $parent->changefreq);
$params['topic_changefreq'] = $params['topic_changefreq'] == -1 ? $parent->changefreq : $params['topic_changefreq'];
if ($params['include_topics']) {
if ((int) ($limit = JArrayHelper::getValue($params, 'max_topics', 0))) {
$params['limit'] = $limit;
} else {
$params['limit'] = 0;
}
if ((int) ($days = JArrayHelper::getValue($params, 'max_age', 0))) {
$params['days'] = JFactory::getDate()->toUnix() - intval($days) * 86400;
} else {
$params['days'] = '';
}
}
self::getCategoryTree($xmap, $parent, $params, $uri->getVar('catid', 0));
}
示例4: quickRouting
/**
* route
*
* @return void
*
* @throws \Exception
*/
public static function quickRouting()
{
$app = \JFactory::getApplication();
$input = $app->input;
if ($app->isSite()) {
$closure = function (\JRouterSite $router, \JUri $uri) use($input, $app) {
$route = $uri->getPath();
$route = trim($route, '/');
// Admin
if ($route == 'admin') {
$uri = \JUri::getInstance();
$target = new \JUri(\JUri::root() . 'administrator');
$target->setQuery($uri->getQuery());
$app->redirect($target);
}
return array();
};
$router = $app::getRouter();
$router->attachParseRule($closure, JVERSION >= 3.4 ? $router::PROCESS_BEFORE : null);
} else {
if ($input->get('goezset') !== null) {
$plugin = \JTable::getInstance('Extension');
if ($plugin->load(array('name' => 'plg_system_ezset'))) {
$extId = $plugin->extension_id;
$app->redirect(\JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $extId, false));
exit;
}
}
}
}
示例5: authenticate
/**
* Get the access token or redict to the authentication URL.
*
* @return string The access token
*
* @since 12.3
*/
public function authenticate()
{
if ($data['code'] = $this->input->get('code', false, 'raw')) {
$data['grant_type'] = 'authorization_code';
$data['redirect_uri'] = $this->getOption('redirecturi');
$data['client_id'] = $this->getOption('clientid');
$data['client_secret'] = $this->getOption('clientsecret');
if ($this->provider->systemName == 'linkedin') {
$data['redirect_uri'] = urlencode($this->getOption('redirecturi'));
$uri = new JUri($this->getOption('tokenurl'));
$uri->setQuery($data);
$response = $this->transport->request('POST', $uri, null, array());
} else {
$response = $this->http->post($this->getOption('tokenurl'), $data);
}
if ($response->code >= 200 && $response->code < 400) {
if (strpos($response->headers['Content-Type'], 'application/json') !== false) {
$token = array_merge(json_decode($response->body, true), array('created' => time()));
} else {
parse_str($response->body, $token);
$token = array_merge($token, array('created' => time()));
}
$this->setToken($token);
return $token;
} else {
throw new RuntimeException('Error code ' . $response->code . ' received requesting access token: ' . $response->body . '.');
}
}
if ($this->getOption('sendheaders')) {
$this->application->redirect($this->createUrl());
}
return false;
}
示例6: getUri
/**
* @param string $layout
*
* @return JUri
*/
public static function getUri($layout = null)
{
$uri = new JUri('index.php?option=com_kunena&view=announcement');
if ($layout) {
$uri->setVar('layout', $layout);
}
return $uri;
}
示例7: getBattleNetUrl
public function getBattleNetUrl()
{
$uri = new JUri();
$uri->setScheme($this->params->get('scheme', 'http'));
$uri->setHost($this->params->get('region') . '.battle.net');
$uri->setPath('/wow/' . $this->params->get('locale') . '/guild/' . rawurlencode($this->params->get('realm')) . '/' . rawurlencode($this->params->get('guild')) . '/');
return $uri->toString();
}
示例8: fetchUrl
/**
* Method to build and return a full request URL for the request.
*
* @param string $path URL to inflect
*
* @return string The request URL.
*
* @since 12.3
*/
protected function fetchUrl($path)
{
// Append the path with output format
$path .= '&format=xml';
$uri = new JUri($this->options->get('api.url') . '/api.php' . $path);
if ($this->options->get('api.username', false)) {
$uri->setUser($this->options->get('api.username'));
}
if ($this->options->get('api.password', false)) {
$uri->setPass($this->options->get('api.password'));
}
return (string) $uri;
}
示例9: getBlogItemLink
function getBlogItemLink($item)
{
if ($item->params->get('access-view')) {
$link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid));
} else {
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid));
$link = new JUri($link1);
$link->setVar('return', base64_encode($returnURL));
}
return $link;
}
示例10: search
public function search()
{
$model = $this->getModel('user');
$uri = new JUri('index.php?option=com_kunena&view=user&layout=list');
$state = $model->getState();
$search = $state->get('list.search');
$limitstart = $state->get('list.start');
if ($search) {
$uri->setVar('search', $search);
}
if ($limitstart) {
$uri->setVar('limitstart', $search);
}
$this->setRedirect(KunenaRoute::_($uri, false));
}
示例11: _
/**
* Build by resource.
*
* @param string $resource The resource key to find our route.
* @param array $data The url query data.
* @param boolean $xhtml Replace & by & for XML compilance.
* @param integer $ssl Secure state for the resolved URI.
* 1: Make URI secure using global secure site URI.
* 2: Make URI unsecure using the global unsecure site URI.
*
* @return string Route url.
*/
public static function _($resource, $data = array(), $xhtml = true, $ssl = null)
{
$resource = explode('.', $resource, 2);
if (count($resource) == 2) {
$data['option'] = $resource[0];
$data['_resource'] = $resource[1];
} elseif (count($resource) == 1) {
$data['option'] = $resource[0];
$data['_resource'] = null;
}
$url = new \JUri();
$url->setQuery($data);
$url->setPath('index.php');
return \JRoute::_((string) $url, $xhtml, $ssl);
}
示例12: loadConfiguration
/**
* Loads the configuration from the Joomla! global configuration itself. The component's options are loaded into
* the options key. For example, an option called foobar is accessible as $config->get('options.foobar');
*
* @param string $filePath Ignored
* @param Phpfunc $phpfunc Ignored
*
* @return void
*/
public function loadConfiguration($filePath = null, Phpfunc $phpfunc = null)
{
// Get the Joomla! configuration object
$jConfig = \JFactory::getConfig();
// Create the basic configuration data
$data = array('timezone' => $jConfig->get('offset', 'UTC'), 'fs' => array('driver' => 'file'), 'dateformat' => \JText::_('DATE_FORMAT_LC2'), 'base_url' => \JUri::base() . '/index.php?option=com_' . strtolower($this->container->application_name), 'live_site' => \JUri::base() . '/index.php?option=com_' . strtolower($this->container->application_name), 'cms_url' => \JUri::base(), 'options' => array());
// Get the Joomla! FTP layer options
if (!class_exists('JClientHelper')) {
\JLoader::import('joomla.client.helper');
}
$ftpOptions = \JClientHelper::getCredentials('ftp');
// If the FTP layer is enabled, enable the Hybrid filesystem engine
if ($ftpOptions['enabled'] == 1) {
$data['fs'] = array('driver' => 'hybrid', 'host' => $ftpOptions['host'], 'port' => empty($ftpOptions['port']) ? '21' : $ftpOptions['port'], 'directory' => rtrim($ftpOptions['root'], '/\\'), 'ssl' => false, 'passive' => true, 'username' => $ftpOptions['user'], 'password' => $ftpOptions['pass']);
}
// Populate the options key with the component configuration
$db = $this->container->db;
$sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('element') . " = " . $db->q('com_' . strtolower($this->container->application_name)));
try {
$configJson = $db->setQuery($sql)->loadResult();
} catch (\Exception $e) {
$configJson = null;
}
if (!empty($configJson)) {
$data['options'] = json_decode($configJson, true);
}
// Finally, load the data to the registry class
$this->data = new \stdClass();
$this->loadArray($data);
}
示例13: __construct
/**
* Class constructor
*
* @param array $options Associative array of options
*
* @since 11.1
*/
public function __construct($options = array())
{
parent::__construct($options);
// Set document type
$this->_type = 'opensearch';
// Set mime type
$this->_mime = 'application/opensearchdescription+xml';
// Add the URL for self updating
$update = new JOpenSearchUrl();
$update->type = 'application/opensearchdescription+xml';
$update->rel = 'self';
$update->template = JRoute::_(JUri::getInstance());
$this->addUrl($update);
// Add the favicon as the default image
// Try to find a favicon by checking the template and root folder
$app = JFactory::getApplication();
$dirs = array(JPATH_THEMES . '/' . $app->getTemplate(), JPATH_BASE);
foreach ($dirs as $dir) {
if (file_exists($dir . '/favicon.ico')) {
$path = str_replace(JPATH_BASE . '/', '', $dir);
$path = str_replace('\\', '/', $path);
$favicon = new JOpenSearchImage();
$favicon->data = JUri::base() . $path . '/favicon.ico';
$favicon->height = '16';
$favicon->width = '16';
$favicon->type = 'image/vnd.microsoft.icon';
$this->addImage($favicon);
break;
}
}
}
示例14: image_compareYTShortcode
function image_compareYTShortcode($atts = null, $content = null)
{
$atts = ytshortcode_atts(array('before_image' => '', 'after_image' => '', 'orientation' => '', 'before_text' => 'Original', 'after_text' => 'Modified', 'class' => ''), $atts, 'image_compare');
// Unique Id
$id = uniqid("ytic") . rand() . time();
if (yt_image_media($atts['before_image']) && yt_image_media($atts['after_image'])) {
$orientation = $atts['orientation'] == 'horizontal' ? 'data-orientation="horizontal"' : '';
$css = '#' . $id . ' .twentytwenty-before-label:before {content: "' . $atts['before_text'] . '"}';
$css .= '#' . $id . ' .twentytwenty-after-label:before {content: "' . $atts['after_text'] . '"}';
// Css Adding in Head
JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/image_compare/css/image_compare.css", 'text/css');
// JavaScipt additon in Head
JHtml::_('jquery.framework');
JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.twentytwenty.js");
JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.event.move.js");
// OUtput Structure in here
$return = '
<div id="' . $id . '" class="twentytwenty-container' . trim($atts['class']) . '" data-orientation="horizontal">
<img src="' . yt_image_media($atts['before_image']) . '" alt="' . $atts['before_text'] . '">
<img src="' . yt_image_media($atts['after_image']) . '" alt="' . $atts['before_text'] . '">
</div>';
$js = 'jQuery(window).load(function(){
jQuery("#' . $id . '").twentytwenty({orientation: \'' . $atts['orientation'] . '\'});
});';
$doc = JFactory::getDocument();
$doc->addStyleDeclaration($css);
$doc->addScriptDeclaration($js);
} else {
$return = yt_alert_box('You can compare two images by using this shortcode', 'warning');
}
return $return;
}
示例15: blockquoteYTShortcode
function blockquoteYTShortcode($atts, $content = null)
{
extract(ytshortcode_atts(array("title" => '', "align" => 'none', 'border' => '#666', 'color' => '#fff', 'width' => 'auto'), $atts));
JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/blockquote/css/blockquote.css");
$source_title = $title != '' ? "<small>" . $title . "</small>" : '';
return '<blockquote class="yt-clearfix yt-boxquote pull-' . $align . '" style="width:' . $width . '%;border-color:' . $border . ';color:' . $color . '">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . $source_title . '</blockquote>';
}