public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/import.php
/**
		 * Extracts the data for the custom feedback directly from the quiz XML data.
		 */
Extracts the data for the custom feedback directly from the quiz XML data.
Extracts the data for the custom feedback directly from the quiz XML data .
private function loadQuizData_customFeedback( $singleFeedbackMsg ) {
			global $fieldsToProcess_quiz_custom_feedback;
			$dbdata = array();
			foreach ( $fieldsToProcess_quiz_custom_feedback as $fieldName ) {
				$dbdata[ $fieldName ] = ( isset( $singleFeedbackMsg->$fieldName ) ? (string) $singleFeedbackMsg->$fieldName : '' );
				$dbdata[ $fieldName ] = html_entity_decode( $dbdata[ $fieldName ], ENT_QUOTES );
			}
			$tagNameForMsg              = trim( $dbdata['qfeedback_tag_name'] );
			$tagAuthorId                = ( isset( $dbdata['qfeedback_tag_author'] ) ) ? trim( $dbdata['qfeedback_tag_author'] ) : get_current_user_id();
			$dbdata['qfeedback_tag_id'] = 0; 
			if ( $tagNameForMsg ) {
				$tagDetails = WPCW_questions_tags_getTagDetails_byName( $tagNameForMsg );
				if ( $tagDetails ) {
					$dbdata['qfeedback_tag_id'] = $tagDetails->question_tag_id;
				} 
				else {
					$wpdb->query( $wpdb->prepare( "
					INSERT INTO $wpcwdb->question_tags
					(question_tag_name, question_tag_usage, question_tag_author) VALUES (%s, 1, %d)
					", $tagNameForMsg, $tagAuthorId ) );
					$dbdata['qfeedback_tag_id'] = $wpdb->insert_id;
				}
			}
			unset( $dbdata['qfeedback_tag_name'] );
			return $dbdata;
		}
private function loadQuizData_customFeedback ( $ singleFeedbackMsg ) { global $ fieldsToProcess_quiz_custom_feedback ; $ dbdata = array ( ) ; foreach ( $ fieldsToProcess_quiz_custom_feedback as $ fieldName ) { $ dbdata [ $ fieldName ] = ( isset ( $ singleFeedbackMsg -> $ fieldName ) ? ( string ) $ singleFeedbackMsg -> $ fieldName : '' ) ; $ dbdata [ $ fieldName ] = html_entity_decode ( $ dbdata [ $ fieldName ] , ENT_QUOTES ) ; } $ tagNameForMsg = trim ( $ dbdata [ 'qfeedback_tag_name' ] ) ; $ tagAuthorId = ( isset ( $ dbdata [ 'qfeedback_tag_author' ] ) ) ? trim ( $ dbdata [ 'qfeedback_tag_author' ] ) : get_current_user_id ( ) ; $ dbdata [ 'qfeedback_tag_id' ] = 0 ; if ( $ tagNameForMsg ) { $ tagDetails = WPCW_questions_tags_getTagDetails_byName ( $ tagNameForMsg ) ; if ( $ tagDetails ) { $ dbdata [ 'qfeedback_tag_id' ] = $ tagDetails -> question_tag_id ; } else { $ wpdb -> query ( $ wpdb -> prepare ( " 
					INSERT INTO  $ wpcwdb -> question_tags 
					(question_tag_name, question_tag_usage, question_tag_author) VALUES (%s, 1, %d)
					 " , $ tagNameForMsg , $ tagAuthorId ) ) ; $ dbdata [ 'qfeedback_tag_id' ] = $ wpdb -> insert_id ; } } unset ( $ dbdata [ 'qfeedback_tag_name' ] ) ; return $ dbdata ; }
Extracts the data for the custom feedback directly from the quiz XML data.
Extracts the data for the custom feedback directly from the quiz XML data .
// ### 1 - Extract fields we want // Put data into database, but assume data is blank if not set in XML. // Use html_entity_decode to remove HTML entities. // ### 2 Convert the tag name to a tag ID and remove the name // Default of 0 just in case. // ID for tag // May have a tag that hasn't been added with questions, so add it. // Need to remove the name, as we can't use that for the insert.