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
learnpress / inc / admin / views / meta-boxes / fields / wysiwyg.php

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

77 lines 1.8 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_WP_Editor_Field
5 *
6 * @author Nhamdv
7 * @version 1.0.0
8 * @since 4.1.3
9 */
10 class LP_Meta_Box_WP_Editor_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 wp_enqueue_editor();
27
28 if ( empty( $this->id ) ) {
29 return;
30 }
31
32 $extra = $this->extra;
33 $wrapper_class = ! empty( $extra['wrapper_class'] ) ? esc_attr( $extra['wrapper_class'] ) : '';
34
35 $meta = $this->meta_value( $thepostid );
36 $value = ! $meta && ! empty( $this->default ) ? $this->default : $meta;
37 $value = $extra['value'] ?? $value;
38 $desc_tip = $extra['desc_tip'] ?? '';
39
40 printf(
41 '<div class="lp-meta-box__wp-editor form-field %s"><label for="%s">%s</label>',
42 esc_attr( $this->id . '_field ' . $wrapper_class ),
43 esc_attr( $this->id ),
44 wp_kses_post( $this->label )
45 );
46
47 wp_editor(
48 $value,
49 sanitize_key( $this->id ),
50 array(
51 'textarea_rows' => 10,
52 'editor_class' => 'lp-meta-box__wp-editor__textarea',
53 'textarea_name' => $this->id,
54 )
55 );
56
57 if ( ! empty( $this->description ) ) {
58 echo '<p class="description">';
59 echo '<span>' . wp_kses_post( $this->description ) . '</span>';
60
61 if ( ! empty( $desc_tip ) ) {
62 learn_press_quick_tip( $desc_tip );
63 }
64 echo '</p>';
65 }
66 echo '</div>';
67 }
68
69 public function save( $post_id ) {
70 $meta_value = LP_Request::get_param( $this->id, $this->default ?? '', 'html' );
71
72 update_post_meta( $post_id, $this->id, $meta_value );
73
74 return $meta_value;
75 }
76 }
77