| @@ -17,9 +17,9 @@ | ||
| 17 | 17 | * LP_User_Item_CURD constructor. |
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | 20 | $this->_error_messages = array( |
| 21 | - 'QUIZ_NOT_EXISTS' => __( 'Quiz does not exists.', 'learnpress' ), | |
| 21 | + 'QUIZ_NOT_EXISTS' => __( 'The quiz does not exist.', 'learnpress' ), | |
| 22 | 22 | ); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
| @@ -34,18 +34,13 @@ | ||
| 34 | 34 | if ( ! $the_id || LP_QUIZ_CPT !== learn_press_get_post_type( $the_id ) ) { |
| 35 | 35 | throw new Exception( __( 'Invalid quiz.', 'learnpress' ) ); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $quiz->set_data_via_methods( | |
| 39 | - array( | |
| 40 | - 'retake_count' => get_post_meta( $quiz->get_id(), '_lp_retake_count', true ), | |
| 41 | - 'show_result' => get_post_meta( $quiz->get_id(), '_lp_show_result', true ), | |
| 42 | - 'passing_grade_type' => get_post_meta( $quiz->get_id(), '_lp_passing_grade_type', true ), | |
| 43 | - 'passing_grade' => get_post_meta( $quiz->get_id(), '_lp_passing_grade', true ), | |
| 44 | - 'instant_check' => get_post_meta( $quiz->get_id(), '_lp_instant_check', true ), | |
| 45 | - 'review_questions' => get_post_meta( $quiz->get_id(), '_lp_review', true ), | |
| 46 | - ) | |
| 47 | - ); | |
| 38 | + $quiz->set_retake_count( get_post_meta( $quiz->get_id(), '_lp_retake_count', true ) ); | |
| 39 | + $quiz->set_passing_grade_type( get_post_meta( $quiz->get_id(), '_lp_passing_grade_type', true ) ); | |
| 40 | + $quiz->set_passing_grade( get_post_meta( $quiz->get_id(), '_lp_passing_grade', true ) ); | |
| 41 | + $quiz->set_instant_check( get_post_meta( $quiz->get_id(), '_lp_instant_check', true ) ); | |
| 42 | + $quiz->set_review_questions( get_post_meta( $quiz->get_id(), '_lp_review', true ) ); | |
| 48 | 43 | |
| 49 | 44 | $this->_load_questions( $quiz ); |
| 50 | 45 | // $this->_update_meta_cache( $quiz ); |
| 51 | 46 | |
| @@ -73,9 +68,9 @@ | ||
| 73 | 68 | */ |
| 74 | 69 | protected function _load_questions( &$quiz ) { |
| 75 | 70 | $id = $quiz->get_id(); |
| 76 | 71 | $questions = LP_Object_Cache::get( 'questions-' . $id, 'learn-press/quizzes' ); |
| 77 | - if ( false === $questions || $quiz->get_no_cache() ) { | |
| 72 | + if ( false === $questions ) { | |
| 78 | 73 | global $wpdb; |
| 79 | 74 | $questions = array(); |
| 80 | 75 | $query = $wpdb->prepare( |
| 81 | 76 | " |
| @@ -107,9 +102,9 @@ | ||
| 107 | 102 | |
| 108 | 103 | /** |
| 109 | 104 | * @param LP_Quiz $quiz |
| 110 | 105 | * |
| 111 | - * @depecated 4.1.6.4 | |
| 106 | + * @deprecated 4.1.6.4 | |
| 112 | 107 | */ |
| 113 | 108 | protected function _update_meta_cache( &$quiz ) { |
| 114 | 109 | _deprecated_function( __FUNCTION__, '4.1.6.4' ); |
| 115 | 110 | $meta_ids = LP_Object_Cache::get( 'questions-' . $quiz->get_id(), 'learn-press/quizzes' ); |
| @@ -467,10 +462,12 @@ | ||
| 467 | 462 | * @param string $value |
| 468 | 463 | * |
| 469 | 464 | * @return mixed |
| 470 | 465 | * @since 3.1.0 |
| 466 | + * @deprecated 4.2.5 | |
| 471 | 467 | */ |
| 472 | 468 | public function get_item_by( $field, $value = '' ) { |
| 469 | + _deprecated_function( __METHOD__, '4.2.5' ); | |
| 473 | 470 | if ( $rows = $this->get_items_by( $field, $value ) ) { |
| 474 | 471 | return $rows[0]; |
| 475 | 472 | } |
| 476 | 473 | |
| @@ -484,10 +481,12 @@ | ||
| 484 | 481 | * @param string $value |
| 485 | 482 | * |
| 486 | 483 | * @return array |
| 487 | 484 | * @since 3.1.0 |
| 485 | + * @deprecated 4.2.5 | |
| 488 | 486 | */ |
| 489 | 487 | public function get_items_by( $field, $value = '' ) { |
| 488 | + _deprecated_function( __METHOD__, '4.2.5' ); | |
| 490 | 489 | global $wpdb; |
| 491 | 490 | |
| 492 | 491 | $where = ''; |
| 493 | 492 | $order = 'ORDER BY user_item_id DESC'; |