本文整理汇总了PHP中WebRequest类的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest类的具体用法?PHP WebRequest怎么用?PHP WebRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* Finds search suggestions phrases for chosen query
*
* @requestParam string $query search term for suggestions
*
* @responseParam array $items The list of phrases matching the query
*
* @example &query=los
*/
public function getList()
{
wfProfileIn(__METHOD__);
if (!empty($this->wg->EnableLinkSuggestExt)) {
$query = trim($this->request->getVal(self::PARAMETER_QUERY, null));
if (empty($query)) {
throw new MissingParameterApiException(self::PARAMETER_QUERY);
}
$request = new WebRequest();
$request->setVal('format', 'array');
$linkSuggestions = LinkSuggest::getLinkSuggest($request);
if (!empty($linkSuggestions)) {
foreach ($linkSuggestions as $suggestion) {
$searchSuggestions[]['title'] = $suggestion;
}
$this->response->setVal('items', $searchSuggestions);
} else {
throw new NotFoundApiException();
}
$this->response->setCacheValidity(WikiaResponse::CACHE_STANDARD);
} else {
throw new NotFoundApiException('Link Suggest extension not available');
}
wfProfileOut(__METHOD__);
}
开发者ID:yusufchang,项目名称:app,代码行数:34,代码来源:SearchSuggestionsApiController.class.php
示例2: 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);
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:43,代码来源:MiniAjaxUpload.php
示例3: send
public function send($message, $list)
{
$webRequest = new WebRequest();
$params = array("profileId" => $this->profileId, "user" => $this->user, "pwd" => $this->pwd, "senderId" => $this->senderId, "mobileno" => implode(",", $list), "msgtext" => "this is a test message");
$result = $webRequest->get("http://bulksmsindia.mobi/sendurlcomma.aspx?", $params);
return $result;
}
开发者ID:pradeepck,项目名称:vagrant,代码行数:7,代码来源:testsms.php
示例4: onEditPageImportFormData
/**
* Concatenate categories on EditPage POST
*
* @param EditPage $editPage
* @param WebRequest $request
*
* @return Boolean because it's a hook
*/
public static function onEditPageImportFormData($editPage, $request)
{
$app = F::app();
if ($request->wasPosted()) {
$categories = $editPage->safeUnicodeInput($request, 'categories');
$categories = CategoryHelper::changeFormat($categories, 'json', 'array');
// Concatenate categories to article wikitext (if there are any).
if (!empty($categories)) {
if (!empty($app->wg->EnableAnswers)) {
// don't add categories if the page is a redirect
$magicWords = $app->wg->ContLang->getMagicWords();
$redirects = $magicWords['redirect'];
// first element doesn't interest us
array_shift($redirects);
// check for localized versions of #REDIRECT
foreach ($redirects as $alias) {
if (stripos($editPage->textbox1, $alias) === 0) {
return true;
}
}
}
// Extract categories from the article, merge them with those passed in, weed out
// duplicates and finally append them back to the article (BugId:99348).
$data = CategoryHelper::extractCategoriesFromWikitext($editPage->textbox1, true);
$categories = CategoryHelper::getUniqueCategories($data['categories'], $categories);
$categories = CategoryHelper::changeFormat($categories, 'array', 'wikitext');
// Remove trailing whitespace (BugId:11238)
$editPage->textbox1 = $data['wikitext'] . rtrim($categories);
}
}
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:40,代码来源:CategorySelectHooksHelper.class.php
示例5: loadDataFromRequest
/**
* @param WebRequest $request
*
* @return array("<overall message>","<select value>","<text field value>")
*/
function loadDataFromRequest($request)
{
if ($request->getCheck($this->mName)) {
$list = $request->getText($this->mName);
$text = $request->getText($this->mName . '-other');
// Should be built the same as in mediawiki.htmlform.js
if ($list == 'other') {
$final = $text;
} elseif (!in_array($list, $this->mFlatOptions, true)) {
# User has spoofed the select form to give an option which wasn't
# in the original offer. Sulk...
$final = $text;
} elseif ($text == '') {
$final = $list;
} else {
$final = $list . $this->msg('colon-separator')->inContentLanguage()->text() . $text;
}
} else {
$final = $this->getDefault();
$list = 'other';
$text = $final;
foreach ($this->mFlatOptions as $option) {
$match = $option . $this->msg('colon-separator')->inContentLanguage()->text();
if (strpos($text, $match) === 0) {
$list = $option;
$text = substr($text, strlen($match));
break;
}
}
}
return array($final, $list, $text);
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:37,代码来源:HTMLSelectAndOtherField.php
示例6: onAfterInitialize
public static function onAfterInitialize($title, $article, $output, $user, WebRequest $request, $wiki)
{
global $wgPaidAssetDropConfig;
if ($request->getBool(static::PAD_FORCE_PARAMETER, false)) {
$wgPaidAssetDropConfig = true;
}
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:8,代码来源:PaidAssetDropHooks.class.php
示例7: testPageIsTrackable
/**
* @dataProvider pageIsTrackableProvider
* @param $ns int namespace
* @param $action string action=... value
* @param $exists bool does the page exist?
* @param $expectedResult bool expected result
*/
public function testPageIsTrackable($ns, $action, $exists, $expectedResult)
{
$title = $this->mockClassWithMethods('Title', ['getNamespace' => $ns, 'exists' => $exists]);
$request = new WebRequest();
$request->setVal('action', $action);
$this->mockGlobalVariable('wgRequest', $request);
$this->assertEquals($expectedResult, LyricFindHooks::pageIsTrackable($title));
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:LyricFindTrackingTest.php
示例8: initializeFromRequest
/**
* @param WebRequest $request
*/
function initializeFromRequest(&$request)
{
$upload = $request->getUpload('wpUploadFile');
$desiredDestName = $request->getText('wpDestFile');
if (!$desiredDestName) {
$desiredDestName = $upload->getName();
}
$this->initialize($desiredDestName, $upload);
}
开发者ID:mb720,项目名称:mediawiki,代码行数:12,代码来源:UploadFromFile.php
示例9: newFromRequest
/**
* Constructs a page from WebRequest.
* This interface is a big klunky.
* @param $request WebRequest
* @return TranslationEditPage
*/
public static function newFromRequest(WebRequest $request)
{
$title = Title::newFromText($request->getText('page'));
if (!$title) {
return null;
}
$obj = new self($title);
$obj->suggestions = $request->getText('suggestions');
return $obj;
}
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:16,代码来源:TranslationEditPage.php
示例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;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:UserLoginFacebookForm.class.php
示例11: onAfterInitialize
/**
* Handle URL parameters and set proper global variables early enough
*
* @author Sergey Naumov
*/
public static function onAfterInitialize($title, $article, $output, $user, WebRequest $request, $wiki)
{
global $wgAdDriverUseSevenOneMedia, $wgNoExternals, $wgUsePostScribe;
// TODO: we shouldn't have it in AdEngine - ticket for Platform: PLATFORM-1296
$wgNoExternals = $request->getBool('noexternals', $wgNoExternals);
// use PostScribe with 71Media - check scriptwriter.js:35
if ($wgAdDriverUseSevenOneMedia) {
$wgUsePostScribe = true;
}
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:AdEngine2Hooks.class.php
示例12: upload
public function upload()
{
$cfile = new CURLFile('useruploaddata.xls', 'application/vnd.ms-excel', 'useruploaddata.xls');
$webRequest = new WebRequest();
$params = array("action" => 'login', "username" => "admin", "password" => "admin");
$result = $webRequest->post("http://localhost/rozgarmela/admin/", $params);
//echo "tried to login, result is " . $result . "\n";
$params = array("user_group_id" => 'JobSeeker', "import_file" => $cfile, "file_type" => 'xls', "csv_delimiter" => 'semicolon', "encodingFromCharset" => 'UTF-8', "action" => 'Import');
$result = $webRequest->post("http://localhost/rozgarmela/admin/import-users/", $params);
echo "sent data, result is " . $result . "\n";
return $result;
}
开发者ID:pradeepck,项目名称:vagrant,代码行数:12,代码来源:UserUpload.php
示例13: loadDataFromRequest
/**
* @param WebRequest $request
*
* @return string
*/
function loadDataFromRequest($request)
{
if ($request->getCheck($this->mName)) {
$val = $request->getText($this->mName);
if ($val === 'other') {
$val = $request->getText($this->mName . '-other');
}
return $val;
} else {
return $this->getDefault();
}
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:17,代码来源:HTMLSelectOrOtherField.php
示例14: __construct
public function __construct(WebRequest $request)
{
$this->mType = $request->getText('type');
$this->mOid = preg_replace('/\\?.*$/', '', $request->getText('oid'));
parse_str(urldecode($request->getText('params')), $this->mParams);
$this->mCb = $request->getInt('cb');
if (!empty($this->mParams['noexternals'])) {
$this->mNoExternals = true;
}
if (!empty($this->mParams['forceprofile'])) {
$this->mForceProfile = true;
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:13,代码来源:AssetsManagerBaseBuilder.class.php
示例15: 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();
}
}
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:18,代码来源:HTMLCheckField.php
示例16: loadDataFromRequest
/**
* @param WebRequest $request
* @return string|MWRestrictions Restrictions object or original string if invalid
*/
function loadDataFromRequest($request)
{
if (!$request->getCheck($this->mName)) {
return $this->getDefault();
}
$value = rtrim($request->getText($this->mName), "\r\n");
$ips = $value === '' ? [] : explode(PHP_EOL, $value);
try {
return MWRestrictions::newFromArray(['IPAddresses' => $ips]);
} catch (InvalidArgumentException $e) {
return $value;
}
}
开发者ID:paladox,项目名称:mediawiki,代码行数:17,代码来源:HTMLRestrictionsField.php
示例17: __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;
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:34,代码来源:ResourceLoaderContext.php
示例18: __construct
public function __construct(WebRequest $request)
{
parent::__construct($request);
$files = explode(',', $this->mOid);
foreach ($files as $file) {
// fake single SASS file request
$sassRequest = new WebRequest();
$sassRequest->setVal('type', 'sass');
$sassRequest->setVal('oid', $file);
$builder = new AssetsManagerSassBuilder($sassRequest);
$this->mContent .= "\n\n/* {$file} */\n" . $builder->getContent();
}
$this->mContentType = AssetsManager::TYPE_CSS;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:AssetsManagerSassesBuilder.class.php
示例19: 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;
}
}
开发者ID:paladox,项目名称:mediawiki,代码行数:19,代码来源:HTMLSizeFilterField.php
示例20: __construct
public function __construct(WebRequest $request)
{
parent::__construct($request);
$groups = explode(',', $this->mOid);
foreach ($groups as $groupName) {
// fake request to a group
$groupRequest = new WebRequest();
$groupRequest->setVal('type', 'group');
$groupRequest->setVal('oid', $groupName);
$builder = new AssetsManagerGroupBuilder($groupRequest);
$this->mContent .= "\n\n" . $builder->getContent();
$this->mContentType = $builder->getContentType();
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:AssetsManagerGroupsBuilder.class.php
注:本文中的WebRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论