Code Duplication    Length = 18-22 lines in 2 locations

includes/class-sensei-lesson.php 2 locations

@@ 2067-2088 (lines=22) @@
2064
		die('');
2065
	}
2066
2067
	public function lesson_update_grade_type() {
2068
		//Add nonce security to the request
2069
		if ( isset($_POST['lesson_update_grade_type_nonce']) ) {
2070
2071
			$nonce = esc_html( $_POST['lesson_update_grade_type_nonce'] );
2072
2073
		} // End If Statement
2074
2075
		if ( ! wp_verify_nonce( $nonce, 'lesson_update_grade_type_nonce' )
2076
        || ! current_user_can( 'edit_lessons' ) ) {
2077
2078
			die('');
2079
2080
		} // End If Statement
2081
2082
		// Parse POST data
2083
		$data = $_POST['data'];
2084
		$quiz_data = array();
2085
		parse_str($data, $quiz_data);
2086
		update_post_meta( $quiz_data['quiz_id'], '_quiz_grade_type', $quiz_data['quiz_grade_type'] );
2087
		die();
2088
	}
2089
2090
	public function lesson_update_question_order() {
2091
		// Add nonce security to the request
@@ 2117-2134 (lines=18) @@
2114
		die();
2115
	}
2116
2117
	public function lesson_update_question_order_random() {
2118
		//Add nonce security to the request
2119
		if ( isset($_POST['lesson_update_question_order_random_nonce']) ) {
2120
			$nonce = esc_html( $_POST['lesson_update_question_order_random_nonce'] );
2121
		} // End If Statement
2122
		if ( ! wp_verify_nonce( $nonce, 'lesson_update_question_order_random_nonce' )
2123
            || ! current_user_can( 'edit_lessons' ) ) {
2124
2125
			die('');
2126
2127
		} // End If Statement
2128
		// Parse POST data
2129
		$data = $_POST['data'];
2130
		$quiz_data = array();
2131
		parse_str($data, $quiz_data);
2132
		update_post_meta( $quiz_data['quiz_id'], '_random_question_order', $quiz_data['random_question_order'] );
2133
		die();
2134
	}
2135
2136
	/**
2137
	 * lesson_save_course function.