_buttonNames)) { return; } $names = array( 'start_quiz' => __('Start quiz', 'wp-adv-quiz'), 'restart_quiz' => __('Restart quiz', 'wp-adv-quiz'), 'quiz_summary' => __('Quiz-summary', 'wp-adv-quiz'), 'finish_quiz' => __('Finish quiz', 'wp-adv-quiz'), 'quiz_is_loading' => __('Quiz is loading...', 'wp-adv-quiz'), 'lock_box_msg' => __('You have already completed the quiz before. Hence you can not start it again.', 'wp-adv-quiz'), 'only_registered_user_msg' => __('You must sign in or sign up to start the quiz.', 'wp-adv-quiz'), 'prerequisite_msg' => __('You have to finish following quiz, to start this quiz:', 'wp-adv-quiz') ); $this->_buttonNames = ((array)apply_filters('wpAdvQuiz_filter_frontButtonNames', $names, $this)) + $names; } /** * @param $data WpAdvQuiz_Model_AnswerTypes * * @return array */ private function getFreeCorrect($data) { $t = str_replace("\r\n", "\n", strtolower($data->getAnswer())); $t = str_replace("\r", "\n", $t); $t = explode("\n", $t); return array_values(array_filter(array_map('trim', $t), array($this, 'removeEmptyElements'))); } private function removeEmptyElements($v) { return !empty($v) || $v === '0'; } public function show($preview = false) { $this->loadButtonNames(); $question_count = count($this->question); $result = $this->quiz->getResultText(); //$result = preg_replace('#(.*?)#is', '', $result); if (!$this->quiz->isResultGradeEnabled()) { $result = array( 'text' => array($result), 'prozent' => array(0) ); } $resultsProzent = json_encode($result['prozent']); $resultReplace = array(); foreach ($this->forms as $form) { /* @var $form WpAdvQuiz_Model_Form */ $resultReplace['$form{' . $form->getSort() . '}'] = ''; } $allowed_html = wp_kses_allowed_html( 'post' ); foreach ($result['text'] as &$text) { $text = wp_kses($text, $allowed_html); $text = str_replace(array_keys($resultReplace), $resultReplace, $text); } ?>
quiz->isTitleHidden()) { echo '

' . esc_html($this->quiz->getName()) . '

'; } $this->showTimeLimitBox(); $this->showCheckPageBox($question_count); $this->showInfoPageBox(); $this->showStartQuizBox(); $this->showLockBox(); $this->showLoadQuizBox(); $this->showStartOnlyRegisteredUserBox(); $this->showPrerequisiteBox(); $this->showResultBox($result, $question_count); if ($this->quiz->getToplistDataShowIn() == WpAdvQuiz_Model_Quiz::QUIZ_TOPLIST_SHOW_IN_BUTTON) { $this->showToplistInButtonBox(); } $this->showReviewBox($question_count); $this->showQuizAnker(); $quizData = $this->showQuizBox($question_count); ?>
createOption($preview); ?> quiz->isAnswerRandom()) << 0; $bo |= ((int)$this->quiz->isQuestionRandom()) << 1; $bo |= ((int)$this->quiz->isDisabledAnswerMark()) << 2; $bo |= ((int)($this->quiz->isQuizRunOnce() || $this->quiz->isPrerequisite() || $this->quiz->isStartOnlyRegisteredUser())) << 3; $bo |= ((int)$preview) << 4; $bo |= ((int)get_option('wpAdvQuiz_corsActivated')) << 5; $bo |= ((int)$this->quiz->isToplistDataAddAutomatic()) << 6; $bo |= ((int)$this->quiz->isShowReviewQuestion()) << 7; $bo |= ((int)$this->quiz->isQuizSummaryHide()) << 8; $bo |= ((int)(!$this->quiz->isSkipQuestionDisabled() && $this->quiz->isShowReviewQuestion())) << 9; $bo |= ((int)$this->quiz->isAutostart()) << 10; $bo |= ((int)$this->quiz->isForcingQuestionSolve()) << 11; $bo |= ((int)$this->quiz->isHideQuestionPositionOverview()) << 12; $bo |= ((int)$this->quiz->isFormActivated()) << 13; $bo |= ((int)$this->quiz->isShowMaxQuestion()) << 14; $bo |= ((int)$this->quiz->isSortCategories()) << 15; return $bo; } public function showMaxQuestion() { $this->loadButtonNames(); $question_count = count($this->question); $result = $this->quiz->getResultText(); //$result = preg_replace('#(.*?)#is', '', $result); $allowed_html = wp_kses_allowed_html( 'post' ); $result = wp_kses($result, $allowed_html); if (!$this->quiz->isResultGradeEnabled()) { $result = array( 'text' => array($result), 'prozent' => array(0) ); } $resultsProzent = json_encode($result['prozent']); ?>
quiz->isTitleHidden()) { echo '

' . esc_html($this->quiz->getName()) . '

'; } $this->showTimeLimitBox(); $this->showCheckPageBox($question_count); $this->showInfoPageBox(); $this->showStartQuizBox(); $this->showLockBox(); $this->showLoadQuizBox(); $this->showStartOnlyRegisteredUserBox(); $this->showPrerequisiteBox(); $this->showResultBox($result, $question_count); if ($this->quiz->getToplistDataShowIn() == WpAdvQuiz_Model_Quiz::QUIZ_TOPLIST_SHOW_IN_BUTTON) { $this->showToplistInButtonBox(); } $this->showReviewBox($question_count); $this->showQuizAnker(); ?>
createOption(false); ?> loadButtonNames(); $quizData = $this->showQuizBox(count($this->question)); $quizData['content'] = ob_get_contents(); ob_end_clean(); return $quizData; } private function showQuizAnker() { ?> $v) { $text = $v[1]; $points = !empty($v[2]) ? (int)$v[2] : 1; $rowText = $multiTextData = array(); $len = array(); if (preg_match_all('#\[(.*?)\]#im', $text, $multiTextMatches)) { foreach ($multiTextMatches[1] as $multiText) { $x = mb_strtolower(trim(html_entity_decode($multiText, ENT_QUOTES))); $len[] = strlen($x); $multiTextData[] = $x; $rowText[] = $multiText; } } else { $x = mb_strtolower(trim(html_entity_decode($text, ENT_QUOTES))); $len[] = strlen($x); $multiTextData[] = $x; $rowText[] = $text; } $a = ' '; $a .= ''; $data['correct'][] = $multiTextData; $data['points'][] = $points; $data['data'][] = $a; } //$answerText = preg_replace('#(.*?)#is', '', $answerText); $allowed_html = wp_kses_allowed_html( 'post' ); $answerText = wp_kses($answerText, $allowed_html); $data['replace'] = preg_replace('#\{(.*?)(?:\|(\d+))?(?:[\s]+)?\}#im', '@@wpAdvQuizCloze@@', $answer_text); return $data; } private function clozeCallback($t) { $a = array_shift($this->_clozeTemp); return $a === null ? '' : $a; } private function fetchAssessment($answerText, $quizId, $questionId) { preg_match_all('#\{(.*?)\}#im', $answerText, $matches); $this->_assessmetTemp = array(); $data = array(); for ($i = 0, $ci = count($matches[1]); $i < $ci; $i++) { $match = $matches[1][$i]; preg_match_all('#\[([^\|\]]+)(?:\|(\d+))?\]#im', $match, $ms); $a = ''; for ($j = 0, $cj = count($ms[1]); $j < $cj; $j++) { $v = $ms[1][$j]; $a .= ''; } $this->_assessmetTemp[] = $a; } //$answerText = preg_replace('#(.*?)#is', '', $answerText); $allowed_html = wp_kses_allowed_html( 'post' ); $answerText = wp_kses($answerText, $allowed_html); $data['replace'] = preg_replace('#\{(.*?)\}#im', '@@wpAdvQuizAssessment@@', $answerText); return $data; } private function assessmentCallback($t) { $a = array_shift($this->_assessmetTemp); return $a === null ? '' : $a; } private function showFormBox() { $info = '
' . __('You must fill out this field.', 'wp-adv-quiz') . '
'; $validateText = array( WpAdvQuiz_Model_Form::FORM_TYPE_NUMBER => __('You must specify a number.', 'wp-adv-quiz'), WpAdvQuiz_Model_Form::FORM_TYPE_TEXT => __('You must specify a text.', 'wp-adv-quiz'), WpAdvQuiz_Model_Form::FORM_TYPE_EMAIL => __('You must specify an email address.', 'wp-adv-quiz'), WpAdvQuiz_Model_Form::FORM_TYPE_DATE => __('You must specify a date.', 'wp-adv-quiz') ); ?>
forms as $form) { /* @var $form WpAdvQuiz_Model_Form */ $id = 'forms_' . $this->quiz->getId() . '_' . $index++; $name = 'wpAdvQuiz_field_' . $form->getFormId(); ?>
'; echo esc_html($form->getFieldname()); echo esc_attr($form->isRequired()) ? '*' : ''; echo ''; ?> getType()) { case WpAdvQuiz_Model_Form::FORM_TYPE_TEXT: case WpAdvQuiz_Model_Form::FORM_TYPE_EMAIL: case WpAdvQuiz_Model_Form::FORM_TYPE_NUMBER: echo ''; break; case WpAdvQuiz_Model_Form::FORM_TYPE_TEXTAREA: echo ''; break; case WpAdvQuiz_Model_Form::FORM_TYPE_CHECKBOX: echo ''; break; case WpAdvQuiz_Model_Form::FORM_TYPE_DATE: echo '
'; echo WpAdvQuiz_Helper_Until::getDatePicker(get_option('date_format', 'j. F Y'), $name); echo '
'; break; case WpAdvQuiz_Model_Form::FORM_TYPE_RADIO: echo '
'; if ($form->getData() !== null) { foreach ($form->getData() as $data) { echo ' '; } } echo '
'; break; case WpAdvQuiz_Model_Form::FORM_TYPE_SELECT: if ($form->getData() !== null) { echo ''; } break; case WpAdvQuiz_Model_Form::FORM_TYPE_YES_NO: echo '
'; echo ' '; echo ' '; echo '
'; break; } if (isset($validateText[$form->getType()])) { echo '
' . $validateText[$form->getType()] . '
'; } else { echo '
' . __('You must fill out this field.', 'wp-adv-quiz') . '
'; } ?>

quiz->getText(); //$postBoxQuizDescription = sanitize_text_field($postBoxQuizDescription); echo do_shortcode(apply_filters('comment_text', $postBoxQuizDescription)); ?>

quiz->isFormActivated() && $this->quiz->getFormShowPosition() == WpAdvQuiz_Model_Quiz::QUIZ_FORM_POSITION_START) { $this->showFormBox(); } ?>
$globalPoints, 'json' => $json, 'catPoints' => $catPoints); } private function showLoadQuizBox() { ?>