本文整理汇总了PHP中WebRequest::getVal方法的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest::getVal方法的具体用法?PHP WebRequest::getVal怎么用?PHP WebRequest::getVal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebRequest
的用法示例。
在下文中一共展示了WebRequest::getVal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadRequest
/**
* Initialize instance variables from request and create an Upload handler
*
* What was changed here: $this->mIgnoreWarning is now unconditionally true
* and we use our own handler for $this->mUpload instead of UploadBase
*
* @param WebRequest $request The request to extract variables from
*/
protected function loadRequest($request)
{
global $wgUser;
$this->mRequest = $request;
$this->mSourceType = $request->getVal('wpSourceType', 'file');
$this->mUpload = FanBoxUpload::createFromRequest($request);
$this->mUploadClicked = $request->wasPosted() && ($request->getCheck('wpUpload') || $request->getCheck('wpUploadIgnoreWarning'));
// Guess the desired name from the filename if not provided
$this->mDesiredDestName = $request->getText('wpDestFile');
if (!$this->mDesiredDestName && $request->getFileName('wpUploadFile') !== null) {
$this->mDesiredDestName = $request->getFileName('wpUploadFile');
}
$this->mComment = $request->getText('wpUploadDescription');
$this->mLicense = $request->getText('wpLicense');
$this->mDestWarningAck = $request->getText('wpDestFileWarningAck');
$this->mIgnoreWarning = true;
//$request->getCheck( 'wpIgnoreWarning' ) || $request->getCheck( 'wpUploadIgnoreWarning' );
$this->mWatchthis = $request->getBool('wpWatchthis') && $wgUser->isLoggedIn();
$this->mCopyrightStatus = $request->getText('wpUploadCopyStatus');
$this->mCopyrightSource = $request->getText('wpUploadSource');
$this->mForReUpload = $request->getBool('wpForReUpload');
// updating a file
$this->mCancelUpload = $request->getCheck('wpCancelUpload') || $request->getCheck('wpReUpload');
// b/w compat
// If it was posted check for the token (no remote POST'ing with user credentials)
$token = $request->getVal('wpEditToken');
if ($this->mSourceType == 'file' && $token == null) {
// Skip token check for file uploads as that can't be faked via JS...
// Some client-side tools don't expect to need to send wpEditToken
// with their submissions, as that's new in 1.16.
$this->mTokenOk = true;
} else {
$this->mTokenOk = $wgUser->matchEditToken($token);
}
}
示例2: __construct
/**
* @param $resourceLoader ResourceLoader
* @param $request WebRequest
*/
public function __construct($resourceLoader, WebRequest $request)
{
global $wgDefaultSkin, $wgResourceLoaderDebug;
$this->resourceLoader = $resourceLoader;
$this->request = $request;
// Interpret request
// List of modules
$modules = $request->getVal('modules');
$this->modules = $modules ? self::expandModuleNames($modules) : array();
// Various parameters
$this->skin = $request->getVal('skin');
$this->user = $request->getVal('user');
$this->debug = $request->getFuzzyBool('debug', $wgResourceLoaderDebug);
$this->only = $request->getVal('only');
$this->version = $request->getVal('version');
// Wikia - change begin - @author: wladek
$this->sassParams = array();
foreach ($request->getValues() as $key => $value) {
if (startsWith($key, 'sass_')) {
$this->sassParams[substr($key, strlen('sass_'))] = $value;
}
}
ksort($this->sassParams);
// Wikia - change end
$skinnames = Skin::getSkinNames();
// If no skin is specified, or we don't recognize the skin, use the default skin
if (!$this->skin || !isset($skinnames[$this->skin])) {
$this->skin = $wgDefaultSkin;
}
}
示例3: setupQuery
/**
* Basic setup and applies the limiting factors from the WebRequest object.
* @param WebRequest $request
* @private
*/
function setupQuery($request)
{
$page = $this->db->tableName('page');
$user = $this->db->tableName('user');
$this->joinClauses = array("LEFT OUTER JOIN {$page} ON log_namespace=page_namespace AND log_title=page_title");
$this->whereClauses = array('user_id=log_user');
$this->limitType($request->getVal('type'));
$this->limitUser($request->getText('user'));
$this->limitTitle($request->getText('page'));
$this->limitTime($request->getVal('from'), '>=');
$this->limitTime($request->getVal('until'), '<=');
list($this->limit, $this->offset) = $request->getLimitOffset();
}
示例4: explode
function __construct(WebRequest $request)
{
$this->fbUserId = $request->getVal('fbuserid');
$this->fbFeedOptions = explode(',', $request->getVal('fbfeedoptions', ''));
// get an email from Facebook API
$resp = F::app()->sendRequest('FacebookSignup', 'getFacebookData', array('fbUserId' => $this->fbUserId));
// add an email to the request and pass it to the underlying class
$request->setVal('email', $resp->getVal('email', false));
if ($request->getVal('type', '') == '') {
$request->setVal('type', 'signup');
}
parent::__construct($request);
}
示例5: __construct
/**
* @param ResourceLoader $resourceLoader
* @param WebRequest $request
*/
public function __construct(ResourceLoader $resourceLoader, WebRequest $request)
{
$this->resourceLoader = $resourceLoader;
$this->request = $request;
// Interpret request
// List of modules
$modules = $request->getVal('modules');
$this->modules = $modules ? self::expandModuleNames($modules) : array();
// Various parameters
$this->skin = $request->getVal('skin');
$this->user = $request->getVal('user');
$this->debug = $request->getFuzzyBool('debug', $resourceLoader->getConfig()->get('ResourceLoaderDebug'));
$this->only = $request->getVal('only');
$this->version = $request->getVal('version');
$this->raw = $request->getFuzzyBool('raw');
// Image requests
$this->image = $request->getVal('image');
$this->variant = $request->getVal('variant');
$this->format = $request->getVal('format');
$skinnames = Skin::getSkinNames();
// If no skin is specified, or we don't recognize the skin, use the default skin
if (!$this->skin || !isset($skinnames[$this->skin])) {
$this->skin = $resourceLoader->getConfig()->get('DefaultSkin');
}
}
示例6: getMustShowThreads
function getMustShowThreads($threads = array())
{
if ($this->request->getCheck('lqt_operand')) {
$operands = explode(',', $this->request->getVal('lqt_operand'));
$threads = array_merge($threads, $operands);
}
if ($this->request->getCheck('lqt_mustshow')) {
// Check for must-show in the request
$specifiedMustShow = $this->request->getVal('lqt_mustshow');
$specifiedMustShow = explode(',', $specifiedMustShow);
$threads = array_merge($threads, $specifiedMustShow);
}
foreach ($threads as $walk_thread) {
do {
if (!is_object($walk_thread)) {
$walk_thread = Threads::withId($walk_thread);
}
if (!is_object($walk_thread)) {
continue;
}
$threads[$walk_thread->id()] = $walk_thread;
$walk_thread = $walk_thread->superthread();
} while ($walk_thread);
}
return $threads;
}
示例7: LoginForm
/**
* Constructor
* @param WebRequest $request A WebRequest object passed by reference
*/
function LoginForm(&$request, $par = '')
{
global $wgLang, $wgAllowRealName, $wgEnableEmail;
global $wgAuth;
$this->mType = $par == 'signup' ? $par : $request->getText('type');
# Check for [[Special:Userlogin/signup]]
$this->mName = $request->getText('wpName');
$this->mPassword = $request->getText('wpPassword');
$this->mRetype = $request->getText('wpRetype');
$this->mRetypeEmail = $request->getText('wpRetypeEmail');
$this->mDomain = $request->getText('wpDomain');
$this->mReturnTo = $request->getVal('returnto');
$this->mAutoRedirect = $request->getVal('autoredirect');
$this->mFromSite = $request->getVal('sitelogin');
$this->mCookieCheck = $request->getVal('wpCookieCheck');
$this->mPosted = $request->wasPosted();
$this->mCreateaccount = $request->getCheck('wpCreateaccount');
$this->mCreateaccountMail = $request->getCheck('wpCreateaccountMail') && $wgEnableEmail;
$this->mMailmypassword = $request->getCheck('wpMailmypassword') && $wgEnableEmail;
$this->mLoginattempt = $request->getCheck('wpLoginattempt');
$this->mAction = $request->getVal('action');
$this->mRemember = $request->getCheck('wpRemember');
$this->mLanguage = $request->getText('uselang');
if ($wgEnableEmail) {
$this->mEmail = $request->getText('wpEmail');
} else {
$this->mEmail = '';
}
if ($wgAllowRealName && $request->getText('wpUseRealNameAsDisplay') == "on") {
$this->mRealName = @strip_tags($request->getText('wpRealName'));
} else {
$this->mRealName = '';
}
if (!$wgAuth->validDomain($this->mDomain)) {
$this->mDomain = 'invaliddomain';
}
$wgAuth->setDomain($this->mDomain);
# When switching accounts, it sucks to get automatically logged out
if ($this->mReturnTo == $wgLang->specialPage('Userlogout')) {
$this->mReturnTo = '';
}
if ($this->mAutoRedirect == $wgLang->specialPage('Userlogout')) {
$this->mAutoRedirect = '';
}
}
示例8: setupQuery
/**
* Basic setup and applies the limiting factors from the WebRequest object.
* @param WebRequest $request
* @private
*/
function setupQuery($request)
{
$page = $this->db->tableName('page');
$user = $this->db->tableName('user');
$this->joinClauses = array("LEFT OUTER JOIN {$page} ON log_namespace=page_namespace AND log_title=page_title", "INNER JOIN {$user} ON user_id=log_user");
$this->whereClauses = array();
$this->limitType($request->getVal('type'));
$this->limitUser($request->getText('user'));
$this->limitTitle($request->getText('page'), $request->getBool('pattern'));
$this->limitTime($request->getVal('from'), '>=');
$this->limitTime($request->getVal('until'), '<=');
list($this->limit, $this->offset) = $request->getLimitOffset();
// XXX This all needs to use Pager, ugly hack for now.
global $wgMiserMode;
if ($wgMiserMode) {
$this->offset = min($this->offset, 10000);
}
}
示例9: __construct
public function __construct(ResourceLoader $resourceLoader, WebRequest $request)
{
global $wgDefaultSkin, $wgResourceLoaderDebug;
$this->resourceLoader = $resourceLoader;
$this->request = $request;
// Interpret request
// List of modules
$modules = $request->getVal('modules');
$this->modules = $modules ? self::expandModuleNames($modules) : array();
// Various parameters
$this->skin = $request->getVal('skin');
$this->user = $request->getVal('user');
$this->debug = $request->getFuzzyBool('debug', $wgResourceLoaderDebug);
$this->only = $request->getVal('only');
$this->version = $request->getVal('version');
if (!$this->skin) {
$this->skin = $wgDefaultSkin;
}
}
示例10: getUserEmail
/**
* Try and get an email for the user from Facebook. If Facebook has an email for the user
* we don't have to confirm it, Facebook has done that for us. If Facebook doesn't have one,
* try and pull one from the form and make note that we'll have to confirm the user.
* @param WebRequest $request
* @return String
*/
private function getUserEmail(WebRequest $request)
{
$userInfo = FacebookClient::getInstance()->getUserInfo();
$userEmail = $userInfo->getProperty('email');
if (empty($userEmail)) {
// Email didn't come from facebook, we have to confirm it ourselves
$this->hasConfirmedEmail = false;
$userEmail = $request->getVal('email', '');
}
return $userEmail;
}
示例11: __construct
/**
* @param $resourceLoader ResourceLoader
* @param $request WebRequest
*/
public function __construct($resourceLoader, WebRequest $request)
{
global $wgDefaultSkin, $wgResourceLoaderDebug;
$this->resourceLoader = $resourceLoader;
$this->request = $request;
// Interpret request
// List of modules
$modules = $request->getVal('modules');
$this->modules = $modules ? self::expandModuleNames($modules) : array();
// Various parameters
$this->skin = $request->getVal('skin');
$this->user = $request->getVal('user');
$this->debug = $request->getFuzzyBool('debug', $wgResourceLoaderDebug);
$this->only = $request->getVal('only');
$this->version = $request->getVal('version');
$skinnames = Skin::getSkinNames();
// If no skin is specified, or we don't recognize the skin, use the default skin
if (!$this->skin || !isset($skinnames[$this->skin])) {
$this->skin = $wgDefaultSkin;
}
}
示例12: loadDataFromRequest
/**
* @param WebRequest $request
*
* @return string
*/
function loadDataFromRequest($request)
{
$invert = isset($this->mParams['invert']) && $this->mParams['invert'];
// GetCheck won't work like we want for checks.
// Fetch the value in either one of the two following case:
// - we have a valid token (form got posted or GET forged by the user)
// - checkbox name has a value (false or true), ie is not null
if ($request->getCheck('wpEditToken') || $request->getVal($this->mName) !== null) {
return $invert ? !$request->getBool($this->mName) : $request->getBool($this->mName);
} else {
return $this->getDefault();
}
}
示例13: LoginForm
/**
* Constructor
* @param WebRequest $request A WebRequest object passed by reference
*/
function LoginForm(&$request)
{
global $wgLang, $wgAllowRealName, $wgEnableEmail;
global $wgAuth;
$this->mType = $request->getText('type');
$this->mName = $request->getText('wpName');
$this->mPassword = $request->getText('wpPassword');
$this->mRetype = $request->getText('wpRetype');
$this->mDomain = $request->getText('wpDomain');
$this->mReturnTo = $request->getVal('returnto');
$this->mCookieCheck = $request->getVal('wpCookieCheck');
$this->mPosted = $request->wasPosted();
$this->mCreateaccount = $request->getCheck('wpCreateaccount');
$this->mCreateaccountMail = $request->getCheck('wpCreateaccountMail') && $wgEnableEmail;
$this->mMailmypassword = $request->getCheck('wpMailmypassword') && $wgEnableEmail;
$this->mLoginattempt = $request->getCheck('wpLoginattempt');
$this->mAction = $request->getVal('action');
$this->mRemember = $request->getCheck('wpRemember');
$this->mLanguage = $request->getText('uselang');
if ($wgEnableEmail) {
$this->mEmail = $request->getText('wpEmail');
} else {
$this->mEmail = '';
}
if ($wgAllowRealName) {
$this->mRealName = $request->getText('wpRealName');
} else {
$this->mRealName = '';
}
if (!$wgAuth->validDomain($this->mDomain)) {
$this->mDomain = 'invaliddomain';
}
$wgAuth->setDomain($this->mDomain);
# When switching accounts, it sucks to get automatically logged out
if ($this->mReturnTo == $wgLang->specialPage('Userlogout')) {
$this->mReturnTo = '';
}
}
示例14: loadDataFromRequest
/**
* @param WebRequest $request
*
* @return string
*/
function loadDataFromRequest($request)
{
$size = $request->getInt($this->mName);
if (!$size) {
return $this->getDefault();
}
$size = abs($size);
// negative numbers represent "max", positive numbers represent "min"
if ($request->getVal($this->mName . '-mode') === 'max') {
return -$size;
} else {
return $size;
}
}
示例15: loadRequest
/**
* Initialize instance variables from request and create an Upload handler
*
* @param WebRequest $request The request to extract variables from
*/
protected function loadRequest($request)
{
global $wgUser, $wgMaxUploadFiles;
// let's make the parent happy
wfSuppressWarnings();
$_FILES['wpUploadFile'] = $_FILES['wpUploadFile0'];
wfRestoreWarnings();
// Guess the desired name from the filename if not provided
$this->mDesiredDestNames = array();
$this->mUploads = array();
// deal with session keys, if we have some pick the first one, for now
$vals = $request->getValues();
$fromsession = false;
foreach ($vals as $k => $v) {
if (preg_match("@^wpSessionKey@", $k)) {
$request->setVal('wpSessionKey', $v);
$fromsession = true;
$filenum = preg_replace("@wpSessionKey@", '', $k);
$request->setVal('wpDestFile', $request->getVal('wpDestFile' . $filenum));
$up = UploadBase::createFromRequest($request);
$this->mUploads[] = $up;
$this->mDesiredDestNames[] = $request->getVal('wpDestFile' . $filenum);
}
}
parent::loadRequest($request);
$this->mUploadClicked = $request->wasPosted() && ($request->getCheck('wpUpload') || $request->getCheck('wpUploadIgnoreWarning'));
if (!$fromsession) {
for ($i = 0; $i < $wgMaxUploadFiles; $i++) {
$this->mDesiredDestNames[$i] = $request->getText('wpDestFile' . $i);
if (!$this->mDesiredDestNames[$i] && $request->getFileName('wpUploadFile' . $i) !== null) {
$this->mDesiredDestNames[$i] = $request->getFileName('wpUploadFile' . $i);
}
wfSuppressWarnings();
$request->setVal('wpUploadFile', $_FILES['wpUploadFile' . $i]);
wfRestoreWarnings();
$request->setVal('wpDestFile', $request->getVal('wpDestFile' . $i));
move_uploaded_file('wpUploadFile' . $i, 'wpUploadFile');
wfSuppressWarnings();
$_FILES['wpUploadFile'] = $_FILES['wpUploadFile' . $i];
wfRestoreWarnings();
$up = UploadBase::createFromRequest($request);
if ($up) {
$this->mUploads[] = $up;
}
}
}
$this->mDesiredDestName = $this->mDesiredDestNames[0];
$this->mUpload = $this->mUploads[0];
}