PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.7.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.7.1
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / inc / admin / views / meta-boxes / question / settings.php

settings.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.1.7.1, at inc/admin/views/meta-boxes/question/settings.php

85 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class LP_Meta_Box_Question extends LP_Meta_Box {
3
4 private static $_instance = null;
5
6 public $post_type = LP_QUESTION_CPT;
7
8 public function add_meta_box() {
9 add_meta_box( 'question_settings', esc_html__( 'Question Settings', 'learnpress' ), array( $this, 'output' ), $this->post_type, 'normal', 'high' );
10 }
11
12 public function metabox( $post_id ) {
13 return apply_filters(
14 'lp/metabox/question/lists',
15 array(
16 '_lp_mark' => new LP_Meta_Box_Text_Field(
17 esc_html__( 'Points', 'learnpress' ),
18 esc_html__( 'Points for choosing the correct answer.', 'learnpress' ),
19 '1',
20 array(
21 'type_input' => 'number',
22 'custom_attributes' => array(
23 'min' => '1',
24 'step' => '1',
25 ),
26 'style' => 'width: 60px;',
27 )
28 ),
29 '_lp_hint' => new LP_Meta_Box_Textarea_Field(
30 esc_html__( 'Hint', 'learnpress' ),
31 esc_html__( 'Instruction for user to select the right answer. The text will be shown when users click the \'Hint\' button.', 'learnpress' ),
32 ''
33 ),
34 '_lp_explanation' => new LP_Meta_Box_Textarea_Field(
35 esc_html__( 'Explanation', 'learnpress' ),
36 esc_html__( 'Explanation will be displayed when students click button "Check Answer".', 'learnpress' ),
37 ''
38 ),
39 )
40 );
41 }
42
43 public function output( $post ) {
44 parent::output( $post );
45 ?>
46
47 <div class="lp-meta-box lp-meta-box--question">
48 <div class="lp-meta-box__inner">
49 <?php
50 do_action( 'learnpress/question-settings/before' );
51 // Check if add_filter to old version.
52 $is_old = false;
53
54 foreach ( $this->metabox( $post->ID ) as $key => $object ) {
55 if ( is_a( $object, 'LP_Meta_Box_Field' ) ) {
56 $object->id = $key;
57 echo wp_kses_post( $object->output( $post->ID ) );
58 } elseif ( is_array( $object ) ) {
59 $is_old = true;
60 }
61 }
62
63 if ( $is_old ) {
64 lp_meta_box_output( $this->metabox( $post->ID ) );
65 }
66
67 do_action( 'learnpress/question-settings/after' );
68 ?>
69 </div>
70 </div>
71
72 <?php
73 }
74
75 public static function instance() {
76 if ( is_null( self::$_instance ) ) {
77 self::$_instance = new self();
78 }
79
80 return self::$_instance;
81 }
82 }
83
84 LP_Meta_Box_Question::instance();
85