PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
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
← All changes | inc/admin/views/meta-boxes/fields/date.php +30 -10 4.1.74.4.8 View file →
@@ -14,10 +14,10 @@
14 14 *
15 15 * @param string $id
16 16 * @param string $label
17 17 * @param string $description
18 - * @param mixed $default
19 - * @param array $extra
18 + * @param mixed $default
19 + * @param array $extra
20 20 */
21 21 public function __construct( $label = '', $description = '', $default = '', $extra = array() ) {
22 22 parent::__construct( $label, $description, $default, $extra );
23 23 }
@@ -23,21 +23,39 @@
23 23 }
24 24
25 25 public function output( $thepostid ) {
26 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 + }
27 41 ?>
28 42
29 43 <div class="lp_sale_dates_fields">
30 - <p class="form-field <?php echo esc_attr( $this->extra['wrapper_class'] ); ?>">
44 + <p class="form-field <?php echo esc_attr( $this->extra['wrapper_class'] ); ?>"
45 + <?php echo esc_attr( implode( ' ', $wrapper_attr ) ) ?>>
31 46 <label for="_lp_sale_start"><?php echo wp_kses_post( $this->label ); ?></label>
32 - <input type="text" class="short" name="<?php echo esc_attr( $this->id ); ?>"
33 - id="<?php echo esc_attr( $this->id ); ?>"
34 - value="<?php echo esc_attr( $date ); ?>"
35 - placeholder="<?php echo esc_attr( $this->extra['placeholder'] ); ?>"
36 - style="width:320px;" />
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;"/>
37 53
38 54 <?php if ( ! empty( $this->extra['cancel'] ) ) : ?>
39 - <a href="#" class="description lp_cancel_sale_schedule"><?php esc_html_e( 'Cancel', 'learnpress' ); ?></a>
55 + <a href="#" class="description lp_cancel_sale_schedule">
56 + <?php esc_html_e( 'Cancel', 'learnpress' ); ?>
57 + </a>
40 58 <?php endif; ?>
41 59 </p>
42 60 </div>
43 61
@@ -44,8 +62,10 @@
44 62 <?php
45 63 }
46 64
47 65 public function save( $post_id ) {
48 - $value = LP_Helper::sanitize_params_submitted( $_POST[ $this->id ] ?? '' );
66 + $value = LP_Request::get_param( $this->id, $this->default ?? '' );
49 67 update_post_meta( $post_id, $this->id, $value );
68 +
69 + return $value;
50 70 }
51 71 }