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/autocomplete.php +7 -5 4.1.74.4.8 View file →
@@ -18,8 +18,11 @@
18 18 parent::__construct( $label, $description, $default, $extra );
19 19 }
20 20
21 21 public function output( $thepostid ) {
22 + // Enqueue scripts here for future use everywhere called.
23 + wp_enqueue_script( 'lp-admin-learnpress' );
24 +
22 25 if ( empty( $this->id ) ) {
23 26 return;
24 27 }
25 28
@@ -62,9 +65,10 @@
62 65 'nonce' => wp_create_nonce( 'wp_rest' ),
63 66 'rest_url' => rest_url(),
64 67 );
65 68 ?>
66 - <p class="form-field lp_autocomplete_metabox_field <?php echo esc_attr( $field['id'] . '_field ' . $wrapper_class ); ?>" data-atts="<?php echo esc_attr( wp_json_encode( $data_atts ) ); ?>">
69 + <p class="form-field lp_autocomplete_metabox_field <?php echo esc_attr( $field['id'] . '_field ' . $wrapper_class ); ?>"
70 + data-atts="<?php echo esc_attr( wp_json_encode( $data_atts ) ); ?>">
67 71 <label for="<?php echo esc_attr( $field['id'] ); ?>">
68 72 <?php echo wp_kses_post( $field['label'] ); ?>
69 73 </label>
70 74
@@ -111,13 +115,11 @@
111 115 <?php
112 116 }
113 117
114 118 public function save( $post_id ) {
115 - $raw_value = isset( $_POST[ $this->id ] ) ? (array) wp_unslash( $_POST[ $this->id ] ) : array();
116 - $value = array_map( 'absint', $raw_value );
117 - $value = apply_filters( 'learn-press/admin/metabox/autocomplete/' . $this->id . '/save', $value, $raw_value, $post_id );
119 + $value = LP_Request::get_param( $this->id, $this->default ?? [] );
118 120
119 121 update_post_meta( $post_id, $this->id, $value );
120 122
121 - do_action( 'lp/metabox/field/autocomplete/save/after', $post_id, $this->id, $value );
123 + return $value;
122 124 }
123 125 }