| @@ -1,5 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Class LP_Meta_Box_Quiz. | |
| 5 | + * | |
| 6 | + * Meta box for quiz settings. | |
| 7 | + */ | |
| 2 | 8 | class LP_Meta_Box_Quiz extends LP_Meta_Box { |
| 3 | 9 | |
| 4 | 10 | private static $_instance = null; |
| 5 | 11 | |
| @@ -14,9 +20,9 @@ | ||
| 14 | 20 | 'lp/metabox/quiz/lists', |
| 15 | 21 | array( |
| 16 | 22 | '_lp_duration' => new LP_Meta_Box_Duration_Field( |
| 17 | 23 | esc_html__( 'Duration', 'learnpress' ), |
| 18 | - esc_html__( 'Set 0 for no limit, larger than 0 for limit', 'learnpress' ), | |
| 24 | + esc_html__( 'Set to 0 for no limit, greater than 0 for a limit.', 'learnpress' ), | |
| 19 | 25 | '0', |
| 20 | 26 | array( |
| 21 | 27 | 'default_time' => 'minute', |
| 22 | 28 | 'custom_attributes' => array( |
| @@ -26,9 +32,9 @@ | ||
| 26 | 32 | ) |
| 27 | 33 | ), |
| 28 | 34 | '_lp_passing_grade' => new LP_Meta_Box_Text_Field( |
| 29 | 35 | esc_html__( 'Passing Grade(%)', 'learnpress' ), |
| 30 | - esc_html__( 'The condition that must be achieved in order to be passed the quiz.', 'learnpress' ), | |
| 36 | + esc_html__( 'The conditions that must be achieved in order to pass the quiz.', 'learnpress' ), | |
| 31 | 37 | '80', |
| 32 | 38 | array( |
| 33 | 39 | 'type_input' => 'number', |
| 34 | 40 | 'custom_attributes' => array( |
| @@ -45,19 +51,19 @@ | ||
| 45 | 51 | 'no' |
| 46 | 52 | ), |
| 47 | 53 | '_lp_negative_marking' => new LP_Meta_Box_Checkbox_Field( |
| 48 | 54 | esc_html__( 'Negative Marking', 'learnpress' ), |
| 49 | - esc_html__( 'For each question which students answer wrongly, the total point is deducted exactly the question\'s point', 'learnpress' ), | |
| 55 | + esc_html__( 'For each question that students answer wrongly, the total point is deducted exactly from the question\'s point.', 'learnpress' ), | |
| 50 | 56 | 'no' |
| 51 | 57 | ), |
| 52 | 58 | '_lp_minus_skip_questions' => new LP_Meta_Box_Checkbox_Field( |
| 53 | 59 | esc_html__( 'Minus for skip', 'learnpress' ), |
| 54 | - esc_html__( 'For each question which students answer skip, the total point is deducted exactly the question\'s point', 'learnpress' ), | |
| 60 | + esc_html__( 'For each question that students answer skip, the total point is deducted exactly from the question\'s point.', 'learnpress' ), | |
| 55 | 61 | 'no' |
| 56 | 62 | ), |
| 57 | 63 | '_lp_retake_count' => new LP_Meta_Box_Text_Field( |
| 58 | 64 | esc_html__( 'Retake', 'learnpress' ), |
| 59 | - esc_html__( 'How many times the user can re-take this quiz. Set 0 to disable. Set -1 to infinite.', 'learnpress' ), | |
| 65 | + esc_html__( 'How many times can the user re-take this quiz? Set 0 to disable. Set -1 to infinite.', 'learnpress' ), | |
| 60 | 66 | '', |
| 61 | 67 | array( |
| 62 | 68 | 'type_input' => 'number', |
| 63 | 69 | 'custom_attributes' => array( |
| @@ -68,9 +74,9 @@ | ||
| 68 | 74 | ) |
| 69 | 75 | ), |
| 70 | 76 | '_lp_pagination' => new LP_Meta_Box_Text_Field( |
| 71 | 77 | esc_html__( 'Pagination', 'learnpress' ), |
| 72 | - esc_html__( 'The number of questions displayed on each page.', 'learnpress' ), | |
| 78 | + esc_html__( 'The number of displayed questions on each page.', 'learnpress' ), | |
| 73 | 79 | '1', |
| 74 | 80 | array( |
| 75 | 81 | 'type_input' => 'number', |
| 76 | 82 | 'custom_attributes' => array( |
| @@ -86,10 +92,10 @@ | ||
| 86 | 92 | esc_html__( 'Allow students to review this quiz after they finish the quiz.', 'learnpress' ), |
| 87 | 93 | 'yes' |
| 88 | 94 | ), |
| 89 | 95 | '_lp_show_correct_review' => new LP_Meta_Box_Checkbox_Field( |
| 90 | - esc_html__( 'Show correct answer', 'learnpress' ), | |
| 91 | - esc_html__( 'Allow students view correct answer question in review this quiz.', 'learnpress' ), | |
| 96 | + esc_html__( 'Show the correct answer', 'learnpress' ), | |
| 97 | + esc_html__( 'Allow students to view the correct answer to the question in reviewing this quiz.', 'learnpress' ), | |
| 92 | 98 | 'yes' |
| 93 | 99 | ), |
| 94 | 100 | ), |
| 95 | 101 | $post_id |
| @@ -109,9 +115,12 @@ | ||
| 109 | 115 | |
| 110 | 116 | foreach ( $this->metabox( $post->ID ) as $key => $object ) { |
| 111 | 117 | if ( is_a( $object, 'LP_Meta_Box_Field' ) ) { |
| 112 | 118 | $object->id = $key; |
| 113 | - echo wp_kses_post( $object->output( $post->ID ) ); | |
| 119 | + $output = $object->output( $post->ID ); | |
| 120 | + if ( ! empty( $output ) ) { | |
| 121 | + echo wp_kses_post( $object->output( $post->ID ) ); | |
| 122 | + } | |
| 114 | 123 | } elseif ( is_array( $object ) ) { |
| 115 | 124 | $is_old = true; |
| 116 | 125 | } |
| 117 | 126 | } |