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


PHP WebRequest::getArray方法代码示例

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


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

示例1: loadDataFromRequest

 /**
  * @param WebRequest $request
  *
  * @return string
  */
 function loadDataFromRequest($request)
 {
     if ($this->mParent->getMethod() == 'post') {
         if ($request->wasPosted()) {
             # Checkboxes are just not added to the request arrays if they're not checked,
             # so it's perfectly possible for there not to be an entry at all
             return $request->getArray($this->mName, array());
         } else {
             # That's ok, the user has not yet submitted the form, so show the defaults
             return $this->getDefault();
         }
     } else {
         # This is the impossible case: if we look at $_GET and see no data for our
         # field, is it because the user has not yet submitted the form, or that they
         # have submitted it with all the options unchecked? We will have to assume the
         # latter, which basically means that you can't specify 'positive' defaults
         # for GET forms.
         # @todo FIXME...
         return $request->getArray($this->mName, array());
     }
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:26,代码来源:HTMLMultiSelectField.php

示例2: parseCreateEditQuizArticleRequest

 private static function parseCreateEditQuizArticleRequest(WebRequest $request, WikiaQuizElement $quizElement, &$error)
 {
     if (!empty($quizElement)) {
         $title = $quizElement->getTitle();
         $quiz = $quizElement->getQuizTitle();
         $order = $quizElement->getOrder();
     } else {
         $order = '';
         $title = trim($request->getVal('question'));
         $quiz = trim($request->getVal('quiz'));
     }
     $image = trim($request->getVal('image'));
     $explanation = trim($request->getVal('explanation'));
     $video = trim($request->getVal('video'));
     $answers = $request->getArray('answer');
     // array
     $correctAnswer = trim($request->getVal('correct'));
     $answerImages = $request->getArray('answer-image');
     // array
     $content = "";
     $content .= WikiaQuizElement::TITLE_MARKER . $title . "\n";
     if ($image) {
         if (!self::isValidImage($image)) {
             $error = wfMsg('wikiaquiz-error-invalid-image', $image);
             return;
         }
         $content .= WikiaQuizElement::IMAGE_MARKER . $image . "\n";
     }
     if ($video) {
         if (!self::isValidVideo($video)) {
             $error = wfMsg('wikiaquiz-error-invalid-video', $video);
             return;
         }
         $content .= WikiaQuizElement::VIDEO_MARKER . $video . "\n";
     }
     if ($explanation) {
         $content .= WikiaQuizElement::EXPLANATION_MARKER . $explanation . "\n";
     }
     if ($quiz) {
         $content .= self::getCategoryText($quiz, $order);
     } else {
         $error = wfMsg('wikiaquiz-error-invalid-quiz');
         return;
     }
     $answerExists = false;
     $correctAnswerExists = false;
     foreach ($answers as $index => $answer) {
         $answer = trim($answer);
         if ($answer) {
             $answerExists = true;
             $correctAnswerContent = "";
             if ($index == $correctAnswer) {
                 if ($correctAnswerExists) {
                     $error = wfMsg('wikiaquiz-error-invalid-correct-answer');
                     return;
                 } else {
                     $correctAnswerExists = true;
                 }
                 $correctAnswerContent .= WikiaQuizElement::CORRECT_ANSWER_MARKER . ' ';
             }
             $answerImageContent = "";
             $answerImage = trim($answerImages[$index]);
             if ($answerImage) {
                 if (!self::isValidImage($answerImage)) {
                     $error = wfMsg('wikiaquiz-error-invalid-image', $answerImage);
                     return;
                 }
                 $answerImageContent .= WikiaQuizElement::ANSWER_IMAGE_MARKER . $answerImages[$index];
             }
             $content .= WikiaQuizElement::ANSWER_MARKER . "{$correctAnswerContent}{$answer}{$answerImageContent}\n";
         }
     }
     if (!$answerExists) {
         $error = wfMsg('wikiaquiz-error-missing-answers');
         return;
     }
     if (!$correctAnswerExists) {
         $error = wfMsg('wikiaquiz-error-invalid-correct-answer');
         return;
     }
     return $content;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:82,代码来源:WikiaQuizAjax.class.php

示例3: 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;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:24,代码来源:SMW_QueryUI.php


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