本文整理汇总了PHP中jUrl类的典型用法代码示例。如果您正苦于以下问题:PHP jUrl类的具体用法?PHP jUrl怎么用?PHP jUrl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了jUrl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create($urlact)
{
$m = $urlact->getParam('module');
$a = $urlact->getParam('action');
$scriptName = $this->getBasePath($urlact->requestType, $m, $a);
$script = $this->getScript($urlact->requestType, $m, $a);
if (isset(jApp::config()->basic_significant_urlengine_entrypoints[$script]) && jApp::config()->basic_significant_urlengine_entrypoints[$script]) {
if (!jApp::config()->urlengine['multiview']) {
$script .= jApp::config()->urlengine['entrypointExtension'];
}
$scriptName .= $script;
}
$url = new jUrl($scriptName, $urlact->params, '');
if (in_array($urlact->requestType, array('xmlrpc', 'jsonrpc', 'soap'))) {
$url->clearParam();
} else {
$pi = '/' . $m . '/';
if ($a != 'default:index') {
list($c, $a) = explode(':', $a);
$pi .= $c . '/';
if ($a != 'index') {
$pi .= $a;
}
}
$url->pathInfo = $pi;
$url->delParam('module');
$url->delParam('action');
}
return $url;
}
示例2: create
public function create($urlact)
{
$m = $urlact->getParam('module');
$a = $urlact->getParam('action');
$scriptName = $this->getBasePath($urlact->requestType, $m, $a);
$scriptName .= $this->getScript($urlact->requestType, $m, $a);
if (!jApp::config()->urlengine['multiview']) {
$scriptName .= jApp::config()->urlengine['entrypointExtension'];
}
$url = new jUrl($scriptName, $urlact->params, '');
if (in_array($urlact->requestType, array('xmlrpc', 'jsonrpc', 'soap'))) {
$url->clearParam();
}
return $url;
}
示例3: onmasteradminGetMenuContent
/**
*
*/
function onmasteradminGetMenuContent($event)
{
$plugin = $GLOBALS['gJCoord']->getPlugin('auth', false);
if ($plugin && $plugin->config['driver'] == 'Db' && jAcl2::check('auth.users.list')) {
$event->add(new masterAdminMenuItem('users', jLocale::get('jauthdb_admin~auth.adminmenu.item.list'), jUrl::get('jauthdb_admin~default:index'), 10, 'system'));
}
}
示例4: read_rss
/**
* display the RSS of the forum
*/
public function read_rss()
{
$ftitle = jUrl::escape($this->param('ftitle'), true);
$id_forum = (int) $this->param('id_forum');
if (!jAcl2::check('hfnu.posts.list', 'forum' . $id_forum)) {
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
if ($id_forum == 0) {
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
$forum = jClasses::getService('havefnubb~hfnuforum')->getForum($id_forum);
if (jUrl::escape($forum->forum_name, true) != $ftitle) {
$rep = $this->getResponse('redirect');
$rep->action = jApp::config()->urlengine['notfoundAct'];
return $rep;
}
jApp::coord()->getPlugin('history')->change('label', htmlentities($forum->forum_name, ENT_COMPAT, 'UTF-8'));
$feed_reader = new jFeedReader();
$feed_reader->setCacheDir(jApp::varPath('feeds'));
$feed_reader->setTimeout(2);
$feed_reader->setUserAgent('HaveFnuBB - http://www.havefnubb.org/');
$feed = $feed_reader->parse($forum->forum_url);
$rep = $this->getResponse('html');
$tpl = new jTpl();
$tpl->assign('feed', $feed);
$tpl->assign('forum', $forum);
$rep->title = $forum->forum_name;
$rep->body->assign('MAIN', $tpl->fetch('havefnubb~forum_rss.view'));
return $rep;
}
示例5: _prepareTpl
protected function _prepareTpl()
{
// Get the project and repository params
$project = $this->param('project');
$repository = $this->param('repository');
$auth_url_return = $this->param('auth_url_return');
if (!$auth_url_return) {
$auth_url_return = jUrl::get('view~map:index', array("repository" => $repository, "project" => $project));
}
// Get lizmapProject class
$assign = array('isConnected' => jAuth::isConnected(), 'user' => jAuth::getUserSession(), 'auth_url_return' => $auth_url_return, "externalSearch" => "", "edition" => false, "measure" => false, "locate" => false, "geolocation" => false, "timemanager" => false, "print" => false, "attributeLayers" => false);
try {
$lproj = lizmap::getProject($repository . '~' . $project);
$configOptions = $lproj->getOptions();
if (property_exists($configOptions, 'externalSearch')) {
$assign['externalSearch'] = $configOptions->externalSearch;
}
} catch (UnknownLizmapProjectException $e) {
jLog::logEx($e, 'error');
}
$this->_tpl->assign($assign);
// Get lizmap services
$services = lizmap::getServices();
if ($services->allowUserAccountRequests) {
$this->_tpl->assign('allowUserAccountRequests', True);
}
}
示例6: jtpl_function_html_formurl
/**
* function plugin : write the url corresponding to the given jelix action
*
* @param jTpl $tpl template engine
* @param string $selector selector action
* @param array $params parameters for the url
*/
function jtpl_function_html_formurl($tpl, $selector, $params = array())
{
$url = jUrl::get($selector, $params, 2);
// retourne le jurl correspondant
echo $url->getPath();
$tpl->_privateVars['_formurl'] = $url;
}
示例7: jtpl_function_html_link_to_remote
/**
* function plugin : Ajax request
*
* it creates a javascript ajax function
* example :
* <pre>
* {link_to_remote
* 'Link', <!-- link label -->
* 'result', <!-- id dom for ajax result -->
* 'test~default:ajax', array('id'=>'34'), <!-- jurl request -->
* array(
* 'position'=>'html', <!-- html or append or prepend (default html) -->
* 'method'=>'GET', <!-- GET or POST (default POST) -->
* 'beforeSend'=>'alert("beforeSend")', <!-- JS script before send (default null) -->
* 'complete'=>'alert("complete")', <!-- JS script after send (default null)-->
* 'error'=>'alert("error")', <!-- JS if error (default null) -->
* )}
* <div id="result"></div>
* </pre>
*/
function jtpl_function_html_link_to_remote($tpl, $label, $element_id, $action_selector, $action_parameters, $option)
{
global $gJCoord, $gJConfig;
static $id_link_to_remote = 0;
if ($gJCoord->response->getFormatType() == 'html') {
// Add js link
$gJCoord->response->addJSLink($gJConfig->urlengine['basePath'] . 'jelix/jquery/jquery.js');
}
$id_link_to_remote++;
$url = jUrl::get($action_selector, $action_parameters);
$position = array_key_exists("position", $option) ? $option['position'] : 'html';
$method = array_key_exists("method", $option) ? $option['method'] : 'GET';
$beforeSend = array_key_exists("beforeSend", $option) ? $option['beforeSend'] : '';
$complete = array_key_exists("complete", $option) ? $option['complete'] : '';
$error = array_key_exists("error", $option) ? $option['error'] : '';
// Link
echo '<a href="#" onclick="link_to_remote_' . $id_link_to_remote . '();">' . $label . "</a>\n";
// Script
echo '
<script>
function link_to_remote_' . $id_link_to_remote . '() {
$.ajax({
type: \'' . $method . "',\n url: '" . $url . "',\n beforeSend: function(){" . $beforeSend . ";},\n complete: function(){" . $complete . ";},\n error: function(){" . $error . ';},
success: function(msg){
$(\'#' . $element_id . "')." . $position . "(msg);\n }\n });\n };\n </script>";
}
示例8: onhfnuGetMenuContent
/**
* Main Menu of the navbar
* @pararm event $event Object of a listener
*/
function onhfnuGetMenuContent($event)
{
$gJConfig = jApp::config();
$event->add(new hfnuMenuItem('home', jLocale::get('havefnubb~main.home'), jUrl::get('havefnubb~default:index'), 1, 'main'));
$event->add(new hfnuMenuItem('members', jLocale::get('havefnubb~main.member.list'), jUrl::get('havefnubb~members:index'), 2, 'main'));
$event->add(new hfnuMenuItem('search', jLocale::get('havefnubb~main.search'), jUrl::get('hfnusearch~default:index'), 3, 'main'));
if ($gJConfig->havefnubb['rules'] != '') {
$event->add(new hfnuMenuItem('rules', jLocale::get('havefnubb~main.rules'), jUrl::get('havefnubb~default:rules'), 4, 'main'));
}
// dynamic menu
$menus = jClasses::getService('havefnubb~hfnumenusbar')->getMenus();
if (!empty($menus)) {
foreach ($menus as $indx => $menu) {
$event->add(new hfnuMenuItem($menu['itemName'], $menu['name'], $menu['url'], 50 + $menu['order'], 'main'));
}
}
if ($event->getParam('admin') === true) {
$url = '';
try {
// let's try to retrieve the url of the admin, if the admin is in
// the same app
$url = jUrl::get('hfnuadmin~default:index');
} catch (Exception $e) {
if (isset($gJConfig->havefnubb["admin_url"])) {
$url = $gJConfig->havefnubb["admin_url"];
}
}
if ($url) {
$event->add(new hfnuMenuItem('admin', jLocale::get('havefnubb~main.admin.panel'), $url, 100, 'main'));
}
}
}
示例9: _prepareTpl
protected function _prepareTpl()
{
jClasses::inc('masterAdminMenuItem');
$menu = array();
$menu['toplinks'] = new masterAdminMenuItem('toplinks', '', '');
$dashboard = new masterAdminMenuItem('dashboard', jLocale::get('gui.menu.item.dashboard'), jUrl::get('default:index'));
$dashboard->icon = $GLOBALS['gJConfig']->urlengine['jelixWWWPath'] . 'design/images/dashboard.png';
$menu['toplinks']->childItems[] = $dashboard;
$menu['system'] = new masterAdminMenuItem('system', jLocale::get('gui.menu.item.system'), '', 100);
$items = jEvent::notify('masteradminGetMenuContent')->getResponse();
foreach ($items as $item) {
if ($item->parentId) {
if (!isset($menu[$item->parentId])) {
$menu[$item->parentId] = new masterAdminMenuItem($item->parentId, '', '');
}
$menu[$item->parentId]->childItems[] = $item;
} else {
if (isset($menu[$item->id])) {
$menu[$item->id]->copyFrom($item);
} else {
$menu[$item->id] = $item;
}
}
}
usort($menu, "masterAdminItemSort");
foreach ($menu as $topitem) {
usort($topitem->childItems, "masterAdminItemSort");
}
$this->_tpl->assign('menuitems', $menu);
$this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', ''));
}
示例10: jtpl_function_html_resurl
/**
* @package jelix
* @subpackage jtpl_plugin
* @author Laurent Jouanneau
* @copyright 2011-2012 Laurent Jouanneau
* @link http://www.jelix.org
* @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
*/
function jtpl_function_html_resurl($tpl, $module, $file, $intheme = false, $escape = true)
{
if ($intheme) {
$file = 'themes/' . jApp::config()->theme . '/' . $file;
}
echo jUrl::get("jelix~www:getfile", array('targetmodule' => $module, 'file' => $file), $escape ? 1 : 0);
}
示例11: index
/**
* Main page
*/
function index()
{
$title = stripslashes(jApp::config()->havefnubb['title']);
$rep = $this->getResponse('html');
$historyPlugin = jApp::coord()->getPlugin('history');
$historyPlugin->change('label', ucfirst(htmlentities($title, ENT_COMPAT, 'UTF-8')));
$historyPlugin->change('title', jLocale::get('havefnubb~main.goto_homepage'));
$forums = jClasses::getService('hfnuforum');
$forumsList = $forums->getFullList();
// generate rss links list
foreach ($forumsList->getLinearIterator() as $f) {
// get the list of forum to build the RSS link
$url = jUrl::get('havefnubb~posts:rss', array('ftitle' => $f->record->forum_name, 'id_forum' => $f->record->id_forum));
$rep->addHeadContent('<link rel="alternate" type="application/rss+xml" title="' . $f->record->forum_name . ' - RSS" href="' . htmlentities($url) . '" />');
$url = jUrl::get('havefnubb~posts:atom', array('ftitle' => $f->record->forum_name, 'id_forum' => $f->record->id_forum));
$rep->addHeadContent('<link rel="alternate" type="application/atom+xml" title="' . $f->record->forum_name . ' - ATOM " href="' . htmlentities($url) . '" />');
}
$tpl = new jTpl();
$tpl->assign('selectedMenuItem', 'community');
$tpl->assign('currentIdForum', 0);
$tpl->assign('action', 'index');
$tpl->assign('forumsList', $forumsList);
$rep->body->assign('MAIN', $tpl->fetch('havefnubb~index'));
return $rep;
}
示例12: jtpl_function_html_breadcrumb
/**
* @package jelix
* @subpackage jtpl_plugin
* @author Lepeltier kévin
* @contributor Dominique Papin
* @copyright 2008 Lepeltier kévin, 2008 Dominique Papin
* @link http://www.jelix.org
* @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
*/
function jtpl_function_html_breadcrumb($tpl, $nb = null, $separator = '')
{
$plugin = jApp::coord()->getPlugin('history', true);
if ($plugin === null) {
return;
}
$config =& $plugin->config;
if (!isset($config['session_name']) || $config['session_name'] == '') {
$config['session_name'] = 'HISTORY';
}
if (!isset($_SESSION[$config['session_name']])) {
return;
}
echo '<ol class="history">';
$leng = count($_SESSION[$config['session_name']]);
$nb = $nb !== null ? count($_SESSION[$config['session_name']]) - $nb : 0;
$nb = $nb < 0 ? 0 : $nb;
for ($i = $nb; $i < $leng; $i++) {
$page = $_SESSION[$config['session_name']][$i];
echo '<li' . ($i == $nb ? ' class="first"' : ($i == $leng - 1 ? ' class="end"' : '')) . '>';
if ($i != $leng - 1) {
echo '<a href="' . jUrl::get($page['action'], $page['params'], jUrl::XMLSTRING) . '" ' . ($page['title'] != '' ? 'title="' . $page['title'] . '"' : '') . '>';
}
echo $_SESSION[$config['session_name']][$i]['label'];
if ($i != $leng - 1) {
echo '</a>';
}
echo ($i == $leng - 1 ? '' : $separator) . '</li>';
}
echo '</ol>';
}
示例13: create
/**
* Create a jurl object with the given action data
* @param jUrlAction $url information about the action
* @return jUrl the url correspondant to the action
*/
public function create($urlact)
{
global $gJConfig;
$m = $urlact->getParam('module');
$a = $urlact->getParam('action');
$scriptName = $this->getBasePath($urlact->requestType, $m, $a);
$script = $this->getScript($urlact->requestType, $m, $a);
if (isset($gJConfig->basic_significant_urlengine_entrypoints[$script]) && $gJConfig->basic_significant_urlengine_entrypoints[$script]) {
if (!$gJConfig->urlengine['multiview']) {
$script .= $gJConfig->urlengine['entrypointExtension'];
}
$scriptName .= $script;
}
$url = new jUrl($scriptName, $urlact->params, '');
// pour certains types de requete, les paramètres ne sont pas dans l'url
// donc on les supprime
// c'est un peu crade de faire ça en dur ici, mais ce serait lourdingue
// de charger la classe request pour savoir si on peut supprimer ou pas
if (in_array($urlact->requestType, array('xmlrpc', 'jsonrpc', 'soap'))) {
$url->clearParam();
} else {
$pi = '/' . $m . '/';
if ($a != 'default:index') {
list($c, $a) = explode(':', $a);
$pi .= $c . '/';
if ($a != 'index') {
$pi .= $a;
}
}
$url->pathInfo = $pi;
$url->delParam('module');
$url->delParam('action');
}
return $url;
}
示例14: onmasteradminGetMenuContent
function onmasteradminGetMenuContent($event)
{
if (jAcl2::check('activeusers.configuration')) {
$item = new masterAdminMenuItem('activeusers', jLocale::get('activeusers_admin~main.masteradmin.menu.item'), jUrl::get('activeusers_admin~default:index'), 120, 'system');
$event->add($item);
}
}
示例15: _prepareTpl
protected function _prepareTpl()
{
$config = new \Jelix\JCommunity\Config();
$this->_tpl->assign('canRegister', $config->isRegistrationEnabled());
$this->_tpl->assign('canResetPassword', $config->isResetPasswordEnabled());
if (jAuth::isConnected()) {
$this->_tpl->assign('login', jAuth::getUserSession()->login);
} else {
$conf = jAuth::loadConfig();
$this->_tpl->assign('persistance_ok', jAuth::isPersistant());
$form = jForms::get("jcommunity~login");
if (!$form) {
$form = jForms::create("jcommunity~login");
}
$this->_tpl->assign('form', $form);
$this->_tpl->assign('url_return', '');
if ($conf['enable_after_login_override']) {
$req = jApp::coord()->request;
if ($req->getParam('auth_url_return')) {
$this->_tpl->assign('url_return', $req->getParam('auth_url_return'));
} else {
if ($this->param('as_main_content')) {
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] && $_SERVER['HTTP_REFERER'] != jUrl::getCurrentUrl(false, true)) {
$this->_tpl->assign('url_return', $_SERVER['HTTP_REFERER']);
}
} else {
if ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') {
$this->_tpl->assign('url_return', jUrl::getCurrentUrl(false, true));
}
}
}
}
}
}