本文整理汇总了PHP中WebRequest::getCheck方法的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest::getCheck方法的具体用法?PHP WebRequest::getCheck怎么用?PHP WebRequest::getCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebRequest
的用法示例。
在下文中一共展示了WebRequest::getCheck方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: 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 = '';
}
}
示例4: 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();
}
}
示例5: 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();
}
}
示例6: 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;
}
}
示例7: 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 = '';
}
}
示例8: loadDataFromRequest
/**
* @param WebRequest $request
*
* @return string
*/
function loadDataFromRequest($request)
{
$invert = false;
if (isset($this->mParams['invert']) && $this->mParams['invert']) {
$invert = true;
}
// 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) {
// XOR has the following truth table, which is what we want
// INVERT VALUE | OUTPUT
// true true | false
// false true | true
// false false | false
// true false | true
return $request->getBool($this->mName) xor $invert;
} else {
return $this->getDefault();
}
}
示例9: extractBitfield
/**
* Put together a rev_deleted bitfield from the submitted checkboxes
* @param WebRequest $request
* @return int
*/
private function extractBitfield($request)
{
$bitfield = 0;
foreach ($this->checks as $item) {
list(, $name, $field) = $item;
if ($request->getCheck($name)) {
$bitfield |= $field;
}
}
return $bitfield;
}
示例10: powerSearch
/**
* Extract "power search" namespace settings from the request object,
* returning a list of index numbers to search.
*
* @param WebRequest $request
* @return array
*/
protected function powerSearch(&$request)
{
$arr = array();
foreach (SearchEngine::searchableNamespaces() as $ns => $name) {
if ($request->getCheck('ns' . $ns)) {
$arr[] = $ns;
}
}
return $arr;
}
示例11: 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();
}
}
示例12: 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;
}
示例13: powerSearch
/**
* Extract "power search" namespace settings from the request object,
* returning a list of index numbers to search.
*
* @param WebRequest $request
* @return array
*/
protected function powerSearch(&$request)
{
$arr = [];
foreach ($this->searchConfig->searchableNamespaces() as $ns => $name) {
if ($request->getCheck('ns' . $ns)) {
$arr[] = $ns;
}
}
return $arr;
}
示例14: parseCreateEditQuizRequest
private static function parseCreateEditQuizRequest(WebRequest $request, $quiz, &$error)
{
$wgUser = F::app()->getGlobal('wgUser');
$wgLang = F::app()->getGlobal('wgContLang');
// parse quiz fields
$quizContent = '';
// title
if (!empty($quiz)) {
$title = $quiz->getTitle();
} else {
$title = trim($request->getVal('title'));
}
// title screen text
$titleScreenText = trim($request->getVal('titlescreentext'));
if ($titleScreenText) {
$quizContent .= WikiaQuiz::TITLESCREENTEXT_MARKER . $titleScreenText . "\n";
}
// facebook recommendation description
$fbRecommendationText = trim($request->getVal('fbrecommendationtext'));
if ($fbRecommendationText) {
$quizContent .= WikiaQuiz::FBRECOMMENDATIONTEXT_MARKER . $fbRecommendationText . "\n";
}
// title screen images
$titleScreenImages = $request->getArray('titlescreenimage');
foreach ($titleScreenImages as $image) {
if ($image) {
if (!self::isValidImage($image)) {
$error = wfMsg('wikiaquiz-error-invalid-image', $image);
return;
}
$quizContent .= WikiaQuiz::IMAGE_MARKER . $image . "\n";
}
}
// More Info heading
$moreInfoHeading = trim($request->getVal('moreinfoheading'));
if ($moreInfoHeading) {
$quizContent .= WikiaQuiz::MOREINFOHEADING_MARKER . $moreInfoHeading . "\n";
}
// Are emails required?
if ($request->getCheck('requireemail')) {
$quizContent .= WikiaQuiz::REQUIRE_EMAIL_MARKER . "true\n";
}
// More Info links
$moreInfoArticles = $request->getArray('moreinfoarticle');
$moreInfoLinkTexts = $request->getArray('moreinfolinktext');
foreach ($moreInfoArticles as $index => $articleName) {
if ($articleName) {
$moreInfoLinkText = isset($moreInfoLinkTexts[$index]) ? $moreInfoLinkTexts[$index] : '';
if (Http::isValidURI($articleName)) {
$quizContent .= WikiaQuiz::MOREINFOLINK_MARKER . $articleName . WikiaQuiz::MOREINFOLINK_TEXT_MARKER . $moreInfoLinkText . "\n";
} else {
$title_object = F::build('Title', array($articleName), 'newFromText');
if (is_object($title_object) && $title_object->exists()) {
$quizContent .= WikiaQuiz::MOREINFOLINK_MARKER . $articleName . WikiaQuiz::MOREINFOLINK_TEXT_MARKER . $moreInfoLinkText . "\n";
} else {
$error = wfMsg('wikiaquiz-error-invalid-article-with-details', $articleName);
return;
}
}
}
}
$patternCategory = "/\\[\\[" . $wgLang->getNsText(NS_CATEGORY) . "\\:" . WikiaQuiz::QUIZ_CATEGORY_PREFIX . $title . "(\\|(.+))*\\]\\]/";
//process questions (quizelements)
$questions = $request->getArray('question');
foreach ($questions as $index => $question) {
$question = trim($question);
if (!$question) {
continue;
}
$title_object = F::build('Title', array($question, NS_WIKIA_QUIZARTICLE), 'newFromText');
if (is_object($title_object) && $title_object->exists()) {
// update category tag
$article = F::build('Article', array($title_object));
$content = $article->getContent();
$newContent = null;
$matches = null;
preg_match($patternCategory, $content, $matches);
if (isset($matches[2])) {
if ($matches[2] != $index) {
$replace = "[[" . $wgLang->getNsText(NS_CATEGORY) . ":" . WikiaQuiz::QUIZ_CATEGORY_PREFIX . $title . "|" . $index . "]]";
$newContent = preg_replace($patternCategory, $replace, $content);
}
} else {
// this category is new for this article. append to contents.
$newContent .= self::getCategoryText($title, $index);
}
if ($newContent) {
$status = $article->doEdit($newContent, 'Quiz Question and Answers Updated', EDIT_UPDATE, false, $wgUser);
}
} else {
if ($title_object == null) {
$error = wfMsg('wikiaquiz-error-invalid-question');
return;
} else {
// create question
$content = self::getCategoryText($title, $index);
$article = F::build('Article', array($title_object));
$status = $article->doEdit($content, 'Quiz Article Created', EDIT_NEW, false, $wgUser);
//@todo check status
}
//.........这里部分代码省略.........
示例15: processFormatOptions
/**
* Generates form elements for a (web)requested format.
*
* Required by getFormatSelectBox() to recieve form elements from the
* Web. UIs may need to overload processFormatOptions(),
* processFormatSelectBox() and getFormatSelectBox() to change behavior.
*
* @param WebRequest $wgRequest
* @return boolean true if format options were requested and returned, else false
*/
protected function processFormatOptions($wgRequest)
{
global $wgOut;
if ($wgRequest->getCheck('showformatoptions')) {
// handle Ajax action
$format = $wgRequest->getVal('showformatoptions');
$params = $wgRequest->getArray('params');
$wgOut->disable();
echo $this->showFormatOptions($format, $params);
return true;
} else {
return false;
}
}