PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.3.9.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.3.9.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 / fields / date.php

date.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.9.1, at inc/admin/views/meta-boxes/fields/date.php

72 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * LP_Meta_Box_Duration_Attribute
5 *
6 * @author tungnx
7 * @version 1.0.0
8 * @since 4.0.0
9 */
10 class LP_Meta_Box_Date_Field extends LP_Meta_Box_Field {
11
12 /**
13 * Constructor.
14 *
15 * @param string $id
16 * @param string $label
17 * @param string $description
18 * @param mixed $default
19 * @param array $extra
20 */
21 public function __construct( $label = '', $description = '', $default = '', $extra = array() ) {
22 parent::__construct( $label, $description, $default, $extra );
23 }
24
25 public function output( $thepostid ) {
26 $date = $this->meta_value( $thepostid );
27 if ( ! empty( $date ) ) {
28 $dateObj = new LP_Datetime( $date );
29 $date = $dateObj->format( 'mysql' );
30 }
31
32 $wrapper_attr = $this->extra['wrapper_attr'] ?? [];
33 $dependency_check = $this->extra['dependency'] ?? [];
34 if ( ! empty( $dependency_check ) ) {
35 if ( $dependency_check['is_disable'] ) {
36 $this->extra['wrapper_class'] .= ' lp-option-disabled';
37 }
38
39 $wrapper_attr[] = 'data-dependency=' . $dependency_check['name'];
40 }
41 ?>
42
43 <div class="lp_sale_dates_fields">
44 <p class="form-field <?php echo esc_attr( $this->extra['wrapper_class'] ); ?>"
45 <?php echo esc_attr( implode( ' ', $wrapper_attr ) ) ?>>
46 <label for="_lp_sale_start"><?php echo wp_kses_post( $this->label ); ?></label>
47 <input type="datetime-local" class="short" name="<?php echo esc_attr( $this->id ); ?>"
48 step=1
49 id="<?php echo esc_attr( $this->id ); ?>"
50 value="<?php echo esc_attr( $date ); ?>"
51 placeholder="<?php echo esc_attr( $this->extra['placeholder'] ); ?>"
52 style="width:320px;"/>
53
54 <?php if ( ! empty( $this->extra['cancel'] ) ) : ?>
55 <a href="#" class="description lp_cancel_sale_schedule">
56 <?php esc_html_e( 'Cancel', 'learnpress' ); ?>
57 </a>
58 <?php endif; ?>
59 </p>
60 </div>
61
62 <?php
63 }
64
65 public function save( $post_id ) {
66 $value = LP_Request::get_param( $this->id, $this->default ?? '' );
67 update_post_meta( $post_id, $this->id, $value );
68
69 return $value;
70 }
71 }
72