PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.7
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.7
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 / lesson / settings.php

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

79 lines 1.8 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_Lesson extends LP_Meta_Box {
3
4 private static $_instance = null;
5
6 public $post_type = LP_LESSON_CPT;
7
8 public function add_meta_box() {
9 add_meta_box( 'lesson_settings', esc_html__( 'Lesson Settings', 'learnpress' ), array( $this, 'output' ), $this->post_type, 'normal', 'high' );
10 }
11
12 public function metabox( $post_id = 0 ) {
13 return apply_filters(
14 'lp/metabox/lesson/lists',
15 array(
16 '_lp_duration' => new LP_Meta_Box_Duration_Field(
17 esc_html__( 'Duration', 'learnpress' ),
18 '',
19 '0',
20 array(
21 'default_time' => 'minute',
22 'custom_attributes' => array(
23 'min' => '0',
24 'step' => '1',
25 ),
26 )
27 ),
28 '_lp_preview' => new LP_Meta_Box_Checkbox_Field(
29 esc_html__( 'Preview', 'learnpress' ),
30 esc_html__( 'Students can view this lesson content without taking the course.', 'learnpress' ),
31 'no'
32 ),
33 )
34 );
35 }
36
37 public function output( $post ) {
38 parent::output( $post );
39 ?>
40
41 <div class="lp-meta-box lp-meta-box--lesson">
42 <div class="lp-meta-box__inner">
43 <?php
44 do_action( 'learnpress/lesson-settings/before' );
45 // Check if add_filter to old version.
46 $is_old = false;
47
48 foreach ( $this->metabox( $post->ID ) as $key => $object ) {
49 if ( is_a( $object, 'LP_Meta_Box_Field' ) ) {
50 $object->id = $key;
51 learn_press_echo_vuejs_write_on_php( $object->output( $post->ID ) );
52 } elseif ( is_array( $object ) ) {
53 $is_old = true;
54 }
55 }
56
57 if ( $is_old ) {
58 lp_meta_box_output( $this->metabox( $post->ID ) );
59 }
60
61 do_action( 'learnpress/lesson-settings/after' );
62 ?>
63 </div>
64 </div>
65
66 <?php
67 }
68
69 public static function instance() {
70 if ( is_null( self::$_instance ) ) {
71 self::$_instance = new self();
72 }
73
74 return self::$_instance;
75 }
76 }
77
78 LP_Meta_Box_Lesson::instance();
79