本文整理汇总了PHP中JURI类的典型用法代码示例。如果您正苦于以下问题:PHP JURI类的具体用法?PHP JURI怎么用?PHP JURI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JURI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modifyAttrs
function modifyAttrs($lnkAttrs, $imgAttrs, $group, $params)
{
$lnkAttrs['rel'] = 'sexylightbox';
if ($group) {
$lnkAttrs['rel'] .= '[' . $group . ']';
}
$link = $lnkAttrs['href'];
$bgColor = $params->get('lightbox_bgColor');
if ($this->isLink($link)) {
$uri = new JURI($link);
$uri->setVar('TB_iframe', 'true');
$uri->setVar('height', intval($params->get('lightbox_height'), 10));
$uri->setVar('width', intval($params->get('lightbox_width'), 10));
if ($bgColor) {
$uri->setVar('background', $bgColor);
}
$lnkAttrs['href'] = $uri->toString();
} else {
if ($bgColor) {
$uri = new JURI($link);
$uri->setVar('background', $bgColor);
$lnkAttrs['href'] = $uri->toString();
}
}
return parent::modifyAttrs($lnkAttrs, $imgAttrs, $group, $params);
}
示例2: ajaxGetRender
/**
*
* Ajax render to store in session
*/
public function ajaxGetRender()
{
/** load libraries for the system rener **/
JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
/** get url **/
$render_url = JRequest::getVar('render_url', '');
$urlRender = base64_decode($render_url);
$session = JSession::getInstance('files', array('name' => 'jsnpoweradmin'));
if ($render_url == '') {
$urlRender = JSNDatabase::getDefaultPage()->link;
}
$currUri = new JURI($urlRender);
if (!$currUri->hasVar('Itemid')) {
$currUri->setVar('Itemid', JSNDatabase::getDefaultPage()->id);
}
$urlString = $currUri->toString();
$session->set('rawmode_render_url', base64_encode($urlString));
$parts = JString::parse_url($urlString);
if (!empty($parts['query'])) {
parse_str($parts['query'], $params);
} else {
$params = array();
}
$jsntemplate = JSNFactory::getTemplate();
$jsnrawmode = JSNRawmode::getInstance($params);
$jsnrawmode->setParam('positions', $jsntemplate->loadXMLPositions());
$jsnrawmode->renderAll();
$session = JSession::getInstance('files', array('name' => 'jsnajaxgetrender'));
$session->set('component', $jsnrawmode->getHTML('component'));
$session->set('jsondata', $jsnrawmode->getScript('positions', 'JSON'));
jexit('success');
}
示例3: checkLogin
function checkLogin()
{
global $mainframe;
DEFINE('GOTOSTARTPAGE_COOKIE', 'ap_gotostartpage');
DEFINE('LOGINPAGELOCATION_COOKIE', 'ap_loginpagelocation');
DEFINE('STARTPAGE_COOKIE', 'ap_startpage');
$gotostartpage = @$_COOKIE[GOTOSTARTPAGE_COOKIE];
if ($gotostartpage) {
setcookie(GOTOSTARTPAGE_COOKIE, 0);
$uri = JFactory::getURI();
$url = $uri->toString();
$loginpagelocation = @$_COOKIE[LOGINPAGELOCATION_COOKIE];
$loginpagelocationuri = new JURI($loginpagelocation);
$query = $loginpagelocationuri->getQuery();
if ($query && strpos($query, 'com_login') === FALSE) {
if ($loginpagelocation && $url != $loginpagelocation) {
$mainframe->redirect($loginpagelocation);
}
} else {
$startpage = @$_COOKIE[STARTPAGE_COOKIE];
if ($startpage && $url != $startpage) {
$mainframe->redirect($startpage);
}
}
}
}
示例4: getList
/**
* Function for getting the list of languages
*
* @return array Language list
*/
public static function getList()
{
$app = JFactory::getApplication();
$languages = JLanguageHelper::getLanguages();
$db = JFactory::getDbo();
$Itemid = $app->input->getInt('Itemid', 0);
$uri = new JURI(Juri::current());
$uri->delVar('lang');
$uri->delVar('Itemid');
$location = htmlspecialchars($uri->getQuery());
if (!empty($location)) {
$location .= '&';
}
if (!$Itemid) {
$active = $app->getMenu()->getActive();
if ($active) {
$Itemid = $active->id;
}
}
// For every language we load menu items language specific alias and params
foreach ($languages as $i => $language) {
$db->forceLanguageTranslation = $language->lang_code;
RMenu::resetJoomlaMenuItems();
$db->forceLanguageTranslation = false;
$languages[$i]->active = $language->lang_code == JFactory::getLanguage()->getTag();
$languages[$i]->link = RRoute::_('index.php?' . $location . 'lang=' . $language->sef . ($Itemid > 0 ? '&Itemid=' . $Itemid : ''));
}
// After we are done we reset it the way it was
RMenu::resetJoomlaMenuItems();
return $languages;
}
示例5: getUri
public static function getUri($layout = null)
{
$uri = new JURI('index.php?option=com_kunena&view=announcement');
if ($layout) {
$uri->setVar('layout', $layout);
}
return $uri;
}
示例6: updateWeekend
/**
* Update the current walk with passed in form data
*/
public function updateWeekend(array $formData)
{
$this->loadWeekend($formData['id']);
// Update all basic fields
// Fields that can't be saved are just ignored
// Invalid fields throw an exception - display this to the user and continue
foreach ($formData as $name => $value) {
try {
$this->weekend->{$name} = $value;
} catch (UnexpectedValueException $e) {
// TODO: Error message
echo "<p>";
var_dump($name);
var_dump($value);
var_dump($e->getMessage());
echo "</p>";
}
}
// Date fields need to be converted
if (!empty($formData['startdate'])) {
$this->weekend->start = strtotime($formData['startdate']);
} else {
$this->weekend->start = null;
}
if (!empty($formData['enddate'])) {
$this->weekend->endDate = strtotime($formData['enddate']);
} else {
$this->weekend->endDate = null;
}
// Alterations
$this->weekend->alterations->incrementVersion();
$this->weekend->alterations->setDetails(!empty($formData['alterations_details']));
$this->weekend->alterations->setCancelled(!empty($formData['alterations_cancelled']));
$this->weekend->alterations->setOrganiser(!empty($formData['alterations_organiser']));
$this->weekend->alterations->setDate(!empty($formData['alterations_date']));
if ($this->weekend->isValid()) {
$this->weekend->save();
// Redirect to the list page
$itemid = JRequest::getInt('returnPage');
if (empty($itemid)) {
return false;
}
$item = JFactory::getApplication()->getMenu()->getItem($itemid);
$link = new JURI("/" . $item->route);
// Jump to the event?
if (JRequest::getBool('jumpToEvent')) {
$link->setFragment("weekend_" . $this->weekend->id);
}
JFactory::getApplication()->redirect($link, "Weekend saved");
}
}
示例7: updateWI
/**
* Update the current walk with passed in form data
*/
public function updateWI(array $formData)
{
// Load an existing walk instance (if any)
if (!empty($formData['id'])) {
$factory = SWG::walkInstanceFactory();
$this->wi = $factory->getSingle($formData['id']);
} else {
$this->wi = new WalkInstance();
}
// Update all basic fields
// Fields that can't be saved are just ignored
// Invalid fields throw an exception - display this to the user and continue
foreach ($formData as $name => $value) {
try {
$this->wi->{$name} = $value;
} catch (UnexpectedValueException $e) {
echo "<p>";
var_dump($name);
var_dump($value);
var_dump($e->getMessage());
echo "</p>";
}
}
// Now do the fields that have to be done separately
// Date & time
$this->wi->start = strtotime($formData['date'] . " " . $formData['meetTime']);
// Alterations
$this->wi->alterations->incrementVersion();
$this->wi->alterations->setDetails($formData['alterations_details']);
$this->wi->alterations->setCancelled($formData['alterations_cancelled']);
$this->wi->alterations->setPlaceTime($formData['alterations_placeTime']);
$this->wi->alterations->setOrganiser($formData['alterations_organiser']);
$this->wi->alterations->setDate($formData['alterations_date']);
if ($this->wi->isValid()) {
$this->wi->save();
// Redirect to the list page
$itemid = JRequest::getInt('returnPage');
if (empty($itemid)) {
return false;
}
$item = JFactory::getApplication()->getMenu()->getItem($itemid);
$link = new JURI("/" . $item->route);
// Jump to the event?
if (JRequest::getBool('jumpToEvent')) {
$link->setFragment("walk_" . $this->wi->id);
}
JFactory::getApplication()->redirect($link, "Walk scheduled");
} else {
}
}
示例8: fetchHead
public static function fetchHead($params, $module)
{
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$template = $mainframe->getTemplate();
JHTML::_('behavior.framework');
$language = JFactory::getLanguage();
$mapApi = 'http://maps.google.com/maps/api/js?sensor=true&language=' . $language->getTag();
if ($params->get('weather')) {
$mapApi .= '&libraries=weather';
}
$document->addScript($mapApi);
if (file_exists(JPATH_BASE . '/templates/' . $template . '/html/mod_bt_googlemaps/js/default.js')) {
$document->addScript(JURI::root() . 'templates/' . $template . '/html/mod_bt_googlemaps/js/default.js');
} else {
$document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/btbase64.min.js');
if ($params->get('enable-custom-infobox')) {
$document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/infobox.js');
}
$document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/default.js');
}
if (file_exists(JPATH_BASE . '/templates/' . $template . '/html/mod_bt_googlemaps/css/styles.css')) {
$document->addStyleSheet(JURI::root() . 'templates/' . $template . '/html/mod_bt_googlemaps/css/style.css');
} else {
$document->addStyleSheet(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/css/style.css');
}
}
示例9: fetchElement
/**
* fetch Element
*/
function fetchElement($name, $values, &$node, $control_name)
{
$mediaPath = JURI::root() . str_replace(DS, '/', str_replace(JPATH_ROOT, '', dirname(dirname(dirname(__FILE__))))) . '/assets/';
JHTML::stylesheet('form.css', $mediaPath);
$attributes = $node->attributes();
$class = isset($attributes['group']) && trim($attributes['group']) == 'end' ? 'lof-end-group' : 'lof-group';
$title = isset($attributes['title']) ? JText::_($attributes['title']) : 'Group';
$title = isset($attributes['title']) ? JText::_($attributes['title']) : '';
$for = isset($attributes['for']) ? $attributes['for'] : '';
if (isset($attributes['onoff'])) {
// echo $control_name; die;
// echo $name; die;
// echo '<pre>'.print_r($values,1); die;
$string = '<div ' . ($title ? "" : 'style="display:none"') . ' class="' . $class . '" title="' . $for . '">';
$checked = $values ? 'checked="checked"' : "";
// echo $checked; die;
$string .= '<input type="checkbox" class="lof-onoff" id="params' . $for . '" value="" ' . $checked . ' name="' . $control_name . '[' . $for . ']" /><b>' . $title . '</b></div>';
return $string;
} else {
$string = '<div ' . ($title ? "" : 'style="display:none"') . ' class="' . $class . '" title="' . $for . '">' . $title . '</div>';
if (!defined('LOF_ADDED_TIME')) {
$string .= '<input type="hidden" class="text_area" value="' . time() . '" id="paramsmain_lof_added_time" name="params[lof_added_time]">';
define('LOF_ADDED_TIME', 1);
}
}
if (!defined('ADD_MEDIA_CONTROL')) {
define('ADD_MEDIA_CONTROL', 1);
$uri = str_replace(DS, "/", str_replace(JPATH_SITE, JURI::base(), dirname(__FILE__)));
$uri = str_replace("/administrator/", "", $uri);
JHTML::stylesheet('form.css', $uri . "/media/");
JHTML::script('form.js', $uri . "/media/");
}
return $string;
}
示例10: fetchButton
function fetchButton($type = 'Acyactions')
{
$url = JURI::base() . "index.php?option=com_acymailing&ctrl=filter&tmpl=component";
$top = 0;
$left = 0;
$width = 700;
$height = 500;
$text = JText::_('ACTIONS');
if (!ACYMAILING_J30) {
$class = "icon-32-acyaction";
} else {
$class = "icon-14-acyaction";
}
$js = "\r\nfunction getAcyActionUrl() {\r\n\ti = 0;\r\n\tmylink = 'index.php?option=com_acymailing&ctrl=filter&tmpl=component&subid=';\r\n\twhile(window.document.getElementById('cb'+i)){\r\n\t\tif(window.document.getElementById('cb'+i).checked)\r\n\t\t\tmylink += window.document.getElementById('cb'+i).value+',';\r\n\t\ti++;\r\n\t}\r\n\treturn mylink;\r\n}\r\n";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
if (!ACYMAILING_J30) {
JHTML::_('behavior.modal', 'a.modal');
return '<a href="' . $url . '" class="modal" onclick="this.href=getAcyActionUrl();" rel="{handler: \'iframe\', size: {x: ' . $width . ', y: ' . $height . '}}"><span class="' . $class . '" title="' . $text . '"></span>' . $text . '</a>';
}
$html = '<button class="btn btn-small modal" data-toggle="modal" data-target="#modal-' . $type . '"><i class="' . $class . '"></i> ' . $text . '</button>';
$params['title'] = $text;
$params['url'] = '\'+getAcyActionUrl()+\'';
//$url;
$params['height'] = $height;
$params['width'] = $width;
$modalHtml = JHtml::_('bootstrap.renderModal', 'modal-' . $type, $params);
$html .= str_replace(array('id="modal-' . $type . '"'), array('id="modal-' . $type . '" style="width:' . ($width + 20) . 'px;height:' . ($height + 90) . 'px;margin-left:-' . ($width + 20) / 2 . 'px"'), $modalHtml);
$html .= '<script>' . "\r\n" . 'jQuery(document).ready(function(){jQuery("#modal-' . $type . '").appendTo(jQuery(document.body));});' . "\r\n" . '</script>';
return $html;
}
示例11: foreach
function &getItem($translation = null)
{
$table = clone parent::getItem();
// I could pick up the URL here or treat as a special content element field type?
if ($table->type == 'component') {
// Note that to populate the initial value of the urlparams
$conf = JFactory::getConfig();
$elementTable = $conf->get('falang.elementTable', false);
foreach ($elementTable->Fields as $efield) {
if ($efield->Name == "link" && isset($efield->translationContent->value) && $efield->translationContent->value !== "") {
$uri = new JURI($efield->translationContent->value);
if ($uri->getVar("option", false)) {
$table->link = $efield->translationContent->value;
}
}
}
$url = str_replace('index.php?', '', $table->link);
$url = str_replace('&', '&', $url);
$table->linkparts = null;
if (strpos($url, '&') !== false) {
$url = str_replace('&', '&', $url);
}
parse_str($url, $table->linkparts);
$db = $this->getDBO();
if ($component = @$table->linkparts['option']) {
$query = 'SELECT `extension_id`' . ' FROM `#__extensions`' . ' WHERE `element` = "' . $db->escape($component) . '"';
$db->setQuery($query);
$table->componentid = $db->loadResult();
}
}
$item = $table;
return $item;
}
示例12: checkAclViolation
public function checkAclViolation($data)
{
$redirectUrl = XiptRoute::_($this->getRedirectUrl());
$redirectURI = new JURI($redirectUrl);
$redirectVar = $redirectURI->getQuery(true);
foreach ($redirectVar as $key => $value) {
if (array_key_exists($key, $data)) {
if ($value != $data[$key]) {
return true;
}
}
}
return false;
}
示例13: __construct
public function __construct($component, $componentParams, $article, $articleParams, $properties)
{
parent::__construct($component, $componentParams, $article, $articleParams);
$this->print = isset($properties['print']) ? $properties['print'] : '';
$this->pageHeading = $this->_componentParams->get('show_page_heading', 1) ? $this->_componentParams->get('page_heading') : '';
$this->titleLink = $this->_articleParams->get('link_titles') && !empty($this->_article->readmore_link) ? $this->_article->readmore_link : '';
$this->emailIconVisible = $this->emailIconVisible && !$this->print;
$this->editIconVisible = $this->editIconVisible && !$this->print;
$this->categoryLink = $this->_articleParams->get('link_category') && $this->_article->catslug ? JRoute::_(ContentHelperRoute::getCategoryRoute($this->_article->catslug)) : '';
$this->category = $this->_articleParams->get('show_category') ? $this->_article->category_title : '';
$this->categoryLink = $this->_articleParams->get('link_category') && $this->_article->catslug ? JRoute::_(ContentHelperRoute::getCategoryRoute($this->_article->catslug)) : '';
$this->parentCategory = $this->_articleParams->get('show_parent_category') && $this->_article->parent_slug != '1:root' ? $this->_article->parent_title : '';
$this->parentCategoryLink = $this->_articleParams->get('link_parent_category') && $this->_article->parent_slug ? JRoute::_(ContentHelperRoute::getCategoryRoute($this->_article->parent_slug)) : '';
$this->author = $this->_articleParams->get('show_author') && !empty($this->_article->author) ? $this->_article->created_by_alias ? $this->_article->created_by_alias : $this->_article->author : '';
if (strlen($this->author) && $this->_articleParams->get('link_author')) {
$needle = 'index.php?option=com_contact&view=contact&id=' . $this->_article->contactid;
$menu = JFactory::getApplication()->getMenu();
$item = $menu->getItems('link', $needle, true);
$this->authorLink = !empty($item) ? $needle . '&Itemid=' . $item->id : $needle;
} else {
$this->authorLink = '';
}
$this->toc = isset($this->_article->toc) ? $this->_article->toc : '';
$this->text = $this->_articleParams->get('access-view') ? $this->_article->text : '';
$user = JFactory::getUser();
$this->introVisible = !$this->_articleParams->get('access-view') && $this->_articleParams->get('show_noauth') && $user->get('guest');
$this->intro = $this->_article->introtext;
if (!$this->_articleParams->get('access-view') && $this->_articleParams->get('show_noauth') && $user->get('guest') && $this->_articleParams->get('show_readmore') && $this->_article->fulltext != null) {
$attribs = json_decode($this->_article->attribs);
if ($attribs->alternative_readmore == null) {
$this->readmore = JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
} elseif ($this->readmore = $this->_article->alternative_readmore) {
if ($this->_articleParams->get('show_readmore_title', 0) != 0) {
$this->readmore .= JHtml::_('string.truncate', $this->_article->title, $this->_articleParams->get('readmore_limit'));
}
} elseif ($this->_articleParams->get('show_readmore_title', 0) == 0) {
$this->readmore = JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
} else {
$this->readmore = JText::_('COM_CONTENT_READ_MORE') . JHtml::_('string.truncate', $this->_article->title, $this->_articleParams->get('readmore_limit'));
}
$link = new JURI(JRoute::_('index.php?option=com_users&view=login'));
$this->readmoreLink = $link->__toString();
} else {
$this->readmore = '';
$this->readmoreLink = '';
}
$this->paginationPosition = isset($this->_article->pagination) && $this->_article->pagination && isset($this->_article->paginationposition) ? ($this->_article->paginationposition ? 'below' : 'above') . ' ' . ($this->_article->paginationrelative ? 'full article' : 'text') : '';
$this->showLinks = isset($this->_article->urls) && is_string($this->_article->urls) && !empty($this->_article->urls);
}
示例14: parseRoute
/**
* Method to parse the router
*
* @param JRouter $router JRouter instance
* @param JURI $uri Current JURI instance
*
* @return array
*/
public function parseRoute($router, $uri)
{
$path = $uri->getPath();
$segments = explode('/', $path);
$alias = end($segments);
if (preg_match('/^([0-9])\\-/', $alias) == false) {
$alias = preg_replace('/\\-$/', '', $alias);
$slug = $this->getSlugByAlias($alias);
if (!empty($slug)) {
$path = str_replace($alias, $slug, $path);
$uri->setPath($path);
}
}
return array();
}
示例15: getBlogItemLink
function getBlogItemLink($item)
{
if ($item->params->get('access-view')) {
$link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
} 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, $item->language));
$link = new JURI($link1);
$link->setVar('return', base64_encode(urlencode($returnURL)));
}
return $link;
}