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


PHP WebRequest::getText方法代码示例

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


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

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

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

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

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

示例5: 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();
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:18,代码来源:SpecialLog.php

示例6: 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 = '';
     }
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:49,代码来源:SpecialUserlogin.php

示例7: 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);
     }
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:23,代码来源:SpecialLog.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: 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

示例10: serve

 public static function serve(WebRequest $request)
 {
     try {
         switch ($request->getText('type')) {
             case 'one':
                 $builder = new AssetsManagerOneBuilder($request);
                 break;
             case 'group':
                 $builder = new AssetsManagerGroupBuilder($request);
                 break;
             case 'groups':
                 $builder = new AssetsManagerGroupsBuilder($request);
                 break;
             case 'sass':
                 $builder = new AssetsManagerSassBuilder($request);
                 break;
             default:
                 Wikia::log(__METHOD__, false, "Unknown type: {$_SERVER['REQUEST_URI']}", true);
                 Wikia::log(__METHOD__, false, AssetsManager::getRequestDetails(), true);
                 throw new Exception('Unknown type.');
         }
     } catch (Exception $e) {
         header('HTTP/1.1 404 Not Found');
         echo $e->getMessage();
         return;
     }
     $headers = array();
     if ($builder->getContentType()) {
         $headers['Content-Type'] = $builder->getContentType();
     }
     // BugId:31327
     $headers['Vary'] = $builder->getVary();
     $cacheDuration = $builder->getCacheDuration();
     if ($cacheDuration > 0) {
         $headers['Expires'] = gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime($cacheDuration . ' seconds'));
         $headers['X-Pass-Cache-Control'] = $builder->getCacheMode() . ', max-age=' . $cacheDuration;
         $headers['Cache-Control'] = $builder->getCacheMode() . ', max-age=' . $cacheDuration;
     }
     $headers['Last-Modified'] = gmdate('D, d M Y H:i:s \\G\\M\\T');
     foreach ($headers as $k => $v) {
         header($k . ': ' . $v);
     }
     echo $builder->getContent();
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:44,代码来源:AssetsManagerServer.class.php

示例11: 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 = '';
     }
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:42,代码来源:SpecialUserlogin.php

示例12: getTargetAndType

 /**
  * Determine the target of the block, and the type of target
  * TODO: should be in Block.php?
  * @param $par String subpage parameter passed to setup, or data value from
  *     the HTMLForm
  * @param $request WebRequest optionally try and get data from a request too
  * @return array( User|string|null, Block::TYPE_ constant|null )
  */
 public static function getTargetAndType($par, WebRequest $request = null)
 {
     $i = 0;
     $target = null;
     while (true) {
         switch ($i++) {
             case 0:
                 # The HTMLForm will check wpTarget first and only if it doesn't get
                 # a value use the default, which will be generated from the options
                 # below; so this has to have a higher precedence here than $par, or
                 # we could end up with different values in $this->target and the HTMLForm!
                 if ($request instanceof WebRequest) {
                     $target = $request->getText('wpTarget', null);
                 }
                 break;
             case 1:
                 $target = $par;
                 break;
             case 2:
                 if ($request instanceof WebRequest) {
                     $target = $request->getText('ip', null);
                 }
                 break;
             case 3:
                 # B/C @since 1.18
                 if ($request instanceof WebRequest) {
                     $target = $request->getText('wpBlockAddress', null);
                 }
                 break;
             case 4:
                 break 2;
         }
         list($target, $type) = Block::parseTarget($target);
         if ($type !== null) {
             return array($target, $type);
         }
     }
     return array(null, null);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:47,代码来源:SpecialBlock.php

示例13: loadDataFromRequest

 /**
  * Get the value that this input has been set to from a posted form,
  * or the input's default value if it has not been set.
  *
  * @param WebRequest $request
  * @return string The value
  */
 function loadDataFromRequest($request)
 {
     if ($request->getCheck($this->mName)) {
         return $request->getText($this->mName);
     } else {
         return $this->getDefault();
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:15,代码来源:HTMLFormField.php

示例14: handlePriorityLanguages

 /**
  * @param WebRequest $request
  * @param TranslatablePage $page
  */
 protected function handlePriorityLanguages(WebRequest $request, TranslatablePage $page)
 {
     // new priority languages
     $npLangs = rtrim(trim($request->getVal('prioritylangs')), ',');
     $npForce = $request->getCheck('forcelimit') ? 'on' : 'off';
     $npReason = trim($request->getText('priorityreason'));
     // Normalize
     $npLangs = array_map('trim', explode(',', $npLangs));
     $npLangs = array_unique($npLangs);
     // Remove invalid language codes.
     $languages = Language::fetchLanguageNames();
     foreach ($npLangs as $index => $language) {
         if (!array_key_exists($language, $languages)) {
             unset($npLangs[$index]);
         }
     }
     $npLangs = implode(',', $npLangs);
     if ($npLangs === '') {
         $npLangs = false;
         $npForce = false;
         $npReason = false;
     }
     $groupId = $page->getMessageGroupId();
     // old priority languages
     $opLangs = TranslateMetadata::get($groupId, 'prioritylangs');
     $opForce = TranslateMetadata::get($groupId, 'priorityforce');
     $opReason = TranslateMetadata::get($groupId, 'priorityreason');
     TranslateMetadata::set($groupId, 'prioritylangs', $npLangs);
     TranslateMetadata::set($groupId, 'priorityforce', $npForce);
     TranslateMetadata::set($groupId, 'priorityreason', $npReason);
     if ($opLangs !== $npLangs || $opForce !== $npForce || $opReason !== $npReason) {
         $params = array('languages' => $npLangs, 'force' => $npForce, 'reason' => $npReason);
         $entry = new ManualLogEntry('pagetranslation', 'prioritylanguages');
         $entry->setPerformer($this->getUser());
         $entry->setTarget($page->getTitle());
         $entry->setParameters($params);
         $entry->setComment($npReason);
         $logid = $entry->insert();
         $entry->publish($logid);
     }
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:45,代码来源:SpecialPageTranslation.php

示例15: printForm

 private function printForm(&$parameters, WebRequest &$request)
 {
     global $wgOut, $sfgFormPrinter;
     // Prepare parameters for SFFormPrinter::formHTML
     // there is no ONE target page
     $targetTitle = null;
     // formDefinition
     $formName = $request->getText('form');
     // if query string did not contain these variables, try the URL
     if ($formName === '') {
         $queryparts = explode('/', $parameters);
         $formName = isset($queryparts[0]) ? $queryparts[0] : null;
         // if the form name wasn't in the URL either, throw an error
         if (is_null($formName) || $formName === '') {
             throw new SPSException(SPSUtils::buildMessage('spserror-noformname'));
         }
     }
     $formTitle = Title::makeTitleSafe(SF_NS_FORM, $formName);
     if (!$formTitle->exists()) {
         throw new SPSException(SPSUtils::buildMessage('spserror-formunknown', $formName));
     }
     $formArticle = new Article($formTitle);
     $formDefinition = StringUtils::delimiterReplace('<noinclude>', '</noinclude>', '', $formArticle->getContent());
     // formSubmitted
     $formSubmitted = false;
     // pageContents
     $pageContents = null;
     // get 'preload' query value, if it exists
     if ($request->getCheck('preload')) {
         $pageContents = SFFormUtils::getPreloadedText($request->getVal('preload'));
     } else {
         // let other extensions preload the page, if they want
         wfRunHooks('sfEditFormPreloadText', array(&$pageContents, $targetTitle, $formTitle));
     }
     // pageIsSource
     $pageIsSource = $pageContents != null;
     // pageNameFormula
     // parse the form to see if it has a 'page name' value set
     $matches;
     if (preg_match('/{{{info.*page name\\s*=\\s*(.*)}}}/m', $formDefinition, $matches)) {
         $pageNameElements = SFUtils::getFormTagComponents($matches[1]);
         $pageNameFormula = $pageNameElements[0];
     } else {
         return 'sf_formedit_badurl';
     }
     // get the iterator parameters
     $iteratorData = $this->buildIteratorParameters($request);
     // Call SFFormPrinter::formHTML
     list($formText, $javascriptText, $dataText, $formPageTitle, $generatedPageName) = $sfgFormPrinter->formHTML($formDefinition, $formSubmitted, $pageIsSource, $formArticle->getID(), $pageContents, '', $pageNameFormula);
     // Set Special page main header;
     // override the default title for this page if a title was specified in the form
     if ($formPageTitle != null) {
         $wgOut->setPageTitle($formPageTitle);
     } else {
         $wgOut->setPageTitle(SPSUtils::buildMessage('sf_formedit_createtitlenotarget', $formTitle->getText()));
     }
     $preFormHtml = '';
     wfRunHooks('sfHTMLBeforeForm', array(&$targetTitle, &$preFormHtml));
     $text = '<form name="createbox" id="sfForm" action="" method="post" class="createbox">' . $preFormHtml . "\n" . SFFormUtils::hiddenFieldHTML('iteratordata', $iteratorData) . $formText;
     SFUtils::addJavascriptAndCSS();
     if (!empty($javascriptText)) {
         $wgOut->addScript('		<script type="text/javascript">' . "\n{$javascriptText}\n" . '</script>' . "\n");
     }
     $wgOut->addHTML($text);
     return null;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:66,代码来源:SPSSpecialSeriesEdit.php


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