本文整理汇总了PHP中UrlUtil::addParam方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlUtil::addParam方法的具体用法?PHP UrlUtil::addParam怎么用?PHP UrlUtil::addParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UrlUtil
的用法示例。
在下文中一共展示了UrlUtil::addParam方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupProxyUrl
private static function setupProxyUrl($url)
{
$unique_id = uniqid();
$ignoredParams = array('module', 'action', 'widget_load', 'widget_popup_request', 'af_referer');
$url = UrlUtil::addParam($url, 'uid', $unique_id);
$request = sfContext::getInstance()->getRequest();
foreach ($request->getParameterHolder()->getAll() as $key => $value) {
if (!StringUtil::startsWith($key, '_') && !in_array($key, $ignoredParams, true)) {
$url = UrlUtil::addParam($url, $key, $value);
}
}
return $url;
}
示例2: dirname
<?php
include dirname(__FILE__) . '/../bootstrap/dbunit.php';
$t = new lime_test(9, new lime_output_color());
$t->is(UrlUtil::addParam('http://hello', 'token', '1234'), 'http://hello?token=1234');
$t->is(UrlUtil::addParam('http://hello?good=1', 'token', '1234'), 'http://hello?good=1&token=1234');
$t->is(UrlUtil::addParam('http://hello?good=1&time=now', 'token', '1234'), 'http://hello?good=1&time=now&token=1234');
$t->is(UrlUtil::addParam('/', 'values', array(1, 2, 3)), '/?values%5B0%5D=1&values%5B1%5D=2&values%5B2%5D=3');
$t->is(UrlUtil::addParam('/', 'map', array('me' => 1, 'you' => 2)), '/?map%5Bme%5D=1&map%5Byou%5D=2');
$t->is(UrlUtil::addParams('http://hello', array('token' => '1234', 'escape' => 'with&and=value')), 'http://hello?token=1234&escape=with%26and%3Dvalue');
$t->is(UrlUtil::getPathPart('http://example.com/server/listServer?id=1'), '/server/listServer');
$t->is(UrlUtil::getPathPart('http://example.com'), '');
$t->is(UrlUtil::getPathPart('https://example.com/hello#world'), '/hello');
示例3: __construct
public function __construct($containerObject, $attributes = array(), $submitContainerObject = false)
{
$this->afExtjs = afExtjs::getInstance();
$this->afExtjs->setAddons(array('js' => array($this->afExtjs->getPluginsDir() . 'submit/RobustSubmitAction.js')));
$pe = isset($attributes['preExecute']) ? $attributes['preExecute'] : '';
if (isset($attributes['label'])) {
$this->attributes['text'] = $attributes['label'];
unset($attributes['label']);
}
if (isset($attributes['action'])) {
$this->attributes['url'] = $attributes['action'];
$attributes['action'] = UrlUtil::addParam($attributes['action'], '_csrf_token', sfContext::getInstance()->getRequest()->getAttribute('_csrf_token'));
if (!isset($attributes['method'])) {
$attributes['method'] = 'post';
}
$submitContainerObject = $submitContainerObject ? $submitContainerObject : $containerObject;
if (isset($submitContainerObject->attributes['classic']) && $submitContainerObject->attributes['classic']) {
$source = 'Ext.getCmp("' . $submitContainerObject->attributes['id'] . '").submit(' . $this->afExtjs->asAnonymousClass(array('url' => $attributes['action'], 'method' => $attributes['method'])) . ');';
if (isset($attributes['preExecute']) && $attributes['preExecute']) {
$pe_file = isset($attributes['preExecute']) ? $attributes['preExecute'] : '';
$source = $this->preExecuteSource($pe_file, $source);
}
$this->attributes['handler'] = $this->afExtjs->asMethod(array('parameters' => '', 'source' => $source));
} else {
if (!isset($attributes['params'])) {
$attributes['params'] = array();
}
$submitUrl = $attributes['action'];
if (!StringUtil::startsWith($submitUrl, 'http')) {
$submitUrl = sfContext::getInstance()->getRequest()->getUriPrefix() . sfContext::getInstance()->getRequest()->getRelativeUrlRoot() . $submitUrl;
}
if (method_exists($submitContainerObject, 'getValidators')) {
$attributes['params']['af_formcfg'] = afEditJsonRenderer::buildFormcfg($submitUrl, $submitContainerObject->getValidators(), $submitContainerObject->getFieldTypes(), ArrayUtil::get($attributes, 'wizard', false));
}
unset($attributes['wizard']);
/**
* timeout, sets the submit timeout action in milisecs, default to 300000ms(300s)
*/
if (!isset($attributes['timeout'])) {
$attributes['timeout'] = '300000';
}
$source = 'Ext.getCmp("' . $submitContainerObject->attributes['id'] . '").getForm().doAction("robustsubmit", ' . $this->afExtjs->asAnonymousClass(array('url' => $submitUrl, 'waitMsg' => 'loading...', 'params' => $attributes['params'], 'timeout' => $attributes['timeout'], 'failure' => $this->afExtjs->asMethod(array('parameters' => 'form,action', 'source' => 'var onclose=function(){if(action.result && action.result.redirect){var load=action.result.load || "center";afApp.load(action.result.redirect,load);}}; if(action.result){ if(action.result.message){Ext.Msg.alert("Failure", action.result.message, onclose);}}else{Ext.Msg.alert("Failure", "Some error appeared!", onclose);}')), 'success' => $this->afExtjs->asMethod(array('parameters' => 'form,action', 'source' => '
/**
* Test for popuped window
*/
var _form = Ext.getCmp("' . $submitContainerObject->attributes['id'] . '");
var _win = null;
if(_form){
_win = _form.findParentByType("window");
}
/*************************************************************/
var showInstantNotification = function(){
if(message){
if(showInWindow){
var w = new Ext.Window({
html:message,
title:"Success",
bodyStyle:"padding:10px",
autoScroll:true,
frame:true,
resizable:true,
maximizable:true
}).show();
if(w.getBox().width > 600) w.setWidth(600);
if(w.getBox().height > 400){ w.setHeight(400);w.setWidth(w.getWidth()+20)}
w.center();
}else{
afApp.notify("Success",message);
}
}
if(_win){
if(winProp.hidePopup === false) return;
if(!afApp.hasDesktop()) { // destroy method cousing error on desktop layout
//destroy the popup because content most probably have been changed, see ticket #891 for more info
_win.destroy();
}
_win.close();
return false;
}
}
/*reload load_widgets store*/
var load_widgets=action.result.load_widgets ||action.options.params.load_widgets;
if(load_widgets && load_widgets.length>0)
afApp.reloadGridsData(load_widgets);
/*executeAfter - can execute a js code after submit, the js code comes from json response*/
var executeAfter=action.result.executeAfter || false;
if(executeAfter)eval(executeAfter);
var confirm=action.result.confirm ||action.options.params.confirm;
var ajax=action.result.ajax ||action.options.params.ajax;
var message=action.result.message ||action.options.params.message;
var redirect=action.result.redirect ||action.options.params.redirect;
var target=action.result.target ||action.options.params.target;
var winProp=action.result.winProp ||action.options.params.winProp;
var load=action.result.load || "center";
//.........这里部分代码省略.........