当前位置: 首页>>代码示例>>PHP>>正文


PHP WebRequest::setVal方法代码示例

本文整理汇总了PHP中WebRequest::setVal方法的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest::setVal方法的具体用法?PHP WebRequest::setVal怎么用?PHP WebRequest::setVal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebRequest的用法示例。


在下文中一共展示了WebRequest::setVal方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:

 function __construct(WebRequest $request)
 {
     // put the username and password field in the expected place for validation MAIN-1283
     $request->setVal('userloginext01', $request->getVal('username'));
     $request->setVal('userloginext02', $request->getVal('password'));
     $request->setVal('email', $this->getUserEmail($request));
     $request->setVal('type', 'signup');
     parent::__construct($request);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:9,代码来源:UserLoginFacebookForm.class.php

示例3: 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);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:13,代码来源:UserLoginFacebookForm.class.php

示例4: __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

示例5: __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

示例6: 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];
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:54,代码来源:MultiUpload.body.php

示例7: testResourceLoaderModifyMaxAge

 /**
  * @group Slow
  * @slowExecutionTime 0.01651 ms
  * @dataProvider resourceLoaderModifyMaxAgeDataProvider
  *
  * @param $timestamp int timestamp in URL
  * @param $ttl int expected caching period
  */
 public function testResourceLoaderModifyMaxAge($version, $ttl)
 {
     global $wgHooks;
     $resourceLoader = new ResourceLoader();
     $resourceLoader->register('WikiaTestModule', array('class' => 'TestResourceLoaderModule'));
     $request = new WebRequest();
     $request->setVal('modules', 'WikiaTestModule');
     $request->setVal('version', join('-', $version));
     // set up hooks
     $wgHooks['ResourceLoaderCacheControlHeaders'][] = 'ResourceLoaderTest::onResourceLoaderCacheControlHeaders';
     ob_start();
     $resourceLoader->respond(new ResourceLoaderContext($resourceLoader, $request));
     ob_end_clean();
     // hook ResourceLoaderHooks::onResourceLoaderModifyMaxAge was called
     // check modified caching period with expected one
     $this->assertEquals($ttl, self::$ttl, 'TTL should match expected value');
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:ResourceLoaderTest.php

示例8: 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

示例9: testSassBuilder

 /**
  * @group Slow
  * @slowExecutionTime 0.85936 ms
  */
 public function testSassBuilder()
 {
     // disable memcache layer in this test
     $mock_memc = $this->getMock('stdClass', array('get', 'set'));
     $mock_memc->expects($this->any())->method('get')->will($this->returnValue(false));
     $mock_memc->expects($this->any())->method('set')->will($this->returnValue(true));
     $this->mockGlobalVariable('wgMemc', $mock_memc);
     $request = new WebRequest();
     $request->setVal('oid', self::SASS_FILE);
     $request->setVal('cb', $this->cb);
     $builder = new AssetsManagerSassBuilder($request);
     $this->assertContains('#foo', $builder->getContent());
     // test URLs rewriting
     $this->assertContains('sprite.png', $builder->getContent());
     $this->assertContains("{$this->cdn}/skins/shared/images/sprite.png", $builder->getContent());
     $this->assertNotContains('/* $wgCdnStylePath */', $builder->getContent());
     // test base64 encoding
     $this->assertNotContains('blank.gif', $builder->getContent());
     $this->assertContains('data:image/gif;base64,', $builder->getContent());
     $this->assertNotContains('/* base64 */', $builder->getContent());
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:AssetsManagerSassBuilderTest.php

示例10: onBeforeInitialize

 /**
  * If the user has specified that they want to edit the page with VE, suppress any redirect.
  * @param Title $title Title being used for request
  * @param Article|null $article
  * @param OutputPage $output
  * @param User $user
  * @param WebRequest $request
  * @param MediaWiki $mediaWiki
  * @return bool Always true
  */
 public static function onBeforeInitialize(Title $title, $article, OutputPage $output, User $user, WebRequest $request, MediaWiki $mediaWiki)
 {
     if ($request->getVal('veaction') === 'edit') {
         $request->setVal('redirect', 'no');
     }
     return true;
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:17,代码来源:VisualEditor.hooks.php

示例11: getBuilder

 /**
  * Returns instance of AssetsManager builder handling given type of assets
  *
  * @param string $type assets type ('one', 'group', 'groups', 'sass')
  * @param string $oid assets / group name
  * @return AssetsManagerBaseBuilder instance of builder
  */
 private function getBuilder($type, $oid)
 {
     $type = ucfirst($type);
     // TODO: add a factory method to AssetsManager
     $className = "AssetsManager{$type}Builder";
     if (class_exists($className)) {
         $request = new WebRequest();
         $request->setVal('oid', $oid);
         $builder = new $className($request);
         return $builder;
     } else {
         return null;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:21,代码来源:AssetsManagerController.class.php

示例12: setUpRequest

 protected function setUpRequest($params = array())
 {
     $wgRequest = new WebRequest();
     foreach ($params as $key => $value) {
         $wgRequest->setVal($key, $value);
     }
     $this->mockGlobalVariable('wgRequest', $wgRequest);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:8,代码来源:UserLoginBaseTest.php


注:本文中的WebRequest::setVal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。