public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/quiz/multi.php
/**
		 * Extract the correct answer for a Multiple Choice question, using the specified answer key to check $_POST.
		 *
		 * @param String $correctAnswerKey The key to use to extract a correct answer.
		 * @param Array The list of questions to check that the correct answer falls into.
		 *
		 * @return String The correct answer, if it was found.
		 */
Extract the correct answer for a Multiple Choice question, using the specified answer key to check $_POST.
@param String $correctAnswerKey The key to use to extract a correct answer.
@param Array The list of questions to check that the correct answer falls into.

@return String The correct answer, if it was found.
Extract the correct answer for a Multiple Choice question using the specified answer key to check $_POST . @param String $correctAnswerKey The key to use to extract a correct answer . @param Array The list of questions to check that the correct answer falls into . @return String The correct answer if it was found .
public static function editSave_extractCorrectAnswer( $qAns, $correctAnswerKey ) {
			$qAnsCor = array();
			if ( isset( $_POST[ $correctAnswerKey ] ) ) {
				foreach ( $_POST[ $correctAnswerKey ] as $key => $value ) {
					if ( isset( $_POST[ $correctAnswerKey ] ) && preg_match( '/^([0-9]+)$/', $value, $matches ) ) {
						$qAnsCor[] = $matches[1];
					}
				}
			}
			if ( count( $qAnsCor ) <= 0 ) {
				$qAnsCor = false;
			}
			return $qAnsCor;
		}
public static function editSave_extractCorrectAnswer ( $ qAns , $ correctAnswerKey ) { $ qAnsCor = array ( ) ; if ( isset ( $ _POST [ $ correctAnswerKey ] ) ) { foreach ( $ _POST [ $ correctAnswerKey ] as $ key => $ value ) { if ( isset ( $ _POST [ $ correctAnswerKey ] ) && preg_match ( '/^([0-9]+)$/' , $ value , $ matches ) ) { $ qAnsCor [ ] = $ matches [ 1 ] ; } } } if ( count ( $ qAnsCor ) <= 0 ) { $ qAnsCor = false ; } return $ qAnsCor ; }
Extract the correct answer for a Multiple Choice question, using the specified answer key to check $_POST.
Extract the correct answer for a Multiple Choice question using the specified answer key to check $_POST .
/*
			 * To store the  correct answers into the array of correct answers.
			 * @var array
			 */ // ### See if we have a correct answer, and it matches one of the items in the list. //No correct answer if no answers is specified. // No correct answer if no answers, or specified answer is not in list of potential // answers. // if (empty($qAnsCor) || !$qAns || !isset($qAns[$qAnsCor])) { //     $qAnsCor = false; // }