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/meta-box/fields/email-content.php +143 -143 4.3.84.4.8 View file →
@@ -1,143 +1,143 @@
1 -<?php
2 -wp_enqueue_script( 'learn-press-email-content-field', LearnPress::instance()->plugin_url( 'inc/admin/meta-box/assets/email-content.js' ) );
3 -wp_enqueue_style( 'learn-press-email-content-field', LearnPress::instance()->plugin_url( 'inc/admin/meta-box/assets/email-content.css' ) );
4 -
5 -if ( ! isset( $value ) ) {
6 - return;
7 -}
8 -
9 -$meta = wp_parse_args(
10 - $value['value'],
11 - array(
12 - 'format' => 'html',
13 - 'html' => '',
14 - 'plain' => '',
15 - )
16 -);
17 -
18 -$field = wp_parse_args(
19 - $value,
20 - array(
21 - 'template_base' => '',
22 - 'template_path' => '',
23 - 'template_html' => '',
24 - 'template_plain' => '',
25 - 'template_html_local' => '',
26 - 'template_plain_local' => '',
27 - 'support_variables' => array(),
28 - )
29 -);
30 -
31 -$email_format = $meta['format'];
32 -?>
33 -
34 -<tr valign="top">
35 - <th scope="row" class="titledesc">
36 - <label><?php echo wp_kses_post( $value['title'] ); ?> <?php echo wp_kses_post( $tooltip_html ?? '' ); ?></label>
37 - </th>
38 - <td class="forminp lp-metabox-field__email-content forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">&lrm;
39 - <?php
40 - /*learn_press_email_formats_dropdown(
41 - array(
42 - 'name' => $value['id'] . '[format]',
43 - 'class' => 'lp-email-format',
44 - 'selected' => $email_format,
45 - 'option_none' => array( '' => esc_html__( 'General Settings', 'learnpress' ) ),
46 - )
47 - );*/
48 - ?>
49 - <div class="lp-email-templates">
50 - <?php
51 - $templates = learn_press_email_formats();
52 -
53 - foreach ( $templates as $template_type => $title ) :
54 - $template = ! empty( $field[ "template_{$template_type}" ] ) ? $field[ "template_{$template_type}" ] : null;
55 -
56 - if ( empty( $template ) ) {
57 - continue;
58 - }
59 -
60 - $local_file = ! empty( $field[ "template_{$template_type}_local" ] ) ? $field[ "template_{$template_type}_local" ] : null;
61 - $template_file = $field['template_base'] . $template;
62 - $template_dir = $field['template_path'];
63 - $classes = array( 'learn-press-email-template' );
64 -
65 - if ( $template_type == 'html' ) {
66 - $classes[] = $template_type . ' multipart';
67 - } else {
68 - $classes[] = 'plain_text';
69 - }
70 -
71 - if ( $template_type == $email_format || ( ( $email_format == 'plain_text' || ! $email_format ) && $template_type == 'plain' ) ) {
72 - } else {
73 - $classes[] = 'hide-if-js';
74 - }
75 -
76 - $content_html = $meta['html'] ? stripslashes( $meta['html'] ) : LP_WP_Filesystem::instance()->file_get_contents( $template_file );
77 - $content_plain = $meta['plain'] ? stripslashes( $meta['plain'] ) : LP_WP_Filesystem::instance()->file_get_contents( $template_file );
78 -
79 - $has_local_file = file_exists( $local_file );
80 -
81 - $theme_dir = get_template_directory();
82 - $stylesheet_dir = get_stylesheet_directory();
83 -
84 - if ( $theme_dir != $stylesheet_dir ) {
85 - $theme_dir = $stylesheet_dir;
86 - }
87 -
88 - $theme_folder = basename( $theme_dir );
89 - ?>
90 -
91 - <div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
92 - <?php if ( $has_local_file ) : ?>
93 - <textarea rows="10" style="width: 90%;" readonly="readonly"><?php echo stripslashes( LP_WP_Filesystem::instance()->file_get_contents( $local_file ) ); ?></textarea>
94 - <p class="description">
95 - <?php printf( __( 'This template has been overridden by your theme and can be found in: <code>%s</code>. <br />Please open the file in an editor program to edit', 'learnpress' ), $theme_folder . '/' . $template_dir . '/' . $template ); ?>
96 - </p>
97 - <?php endif; ?>
98 -
99 - <div class="<?php echo esc_attr( $has_local_file ? 'hide-if-js' : '' ); ?>">
100 - <?php if ( $template_type == 'html' ) : ?>
101 - <?php
102 - wp_editor(
103 - $content_html,
104 - sanitize_key( $field['id'] . '-' . $template_type ),
105 - array(
106 - 'textarea_rows' => 20,
107 - 'wpautop' => false,
108 - 'textarea_name' => $field['id'] . '[html]',
109 - )
110 - );
111 - ?>
112 - <?php else : ?>
113 - <div class="editor">
114 - <textarea
115 - id="<?php echo esc_attr( sanitize_key( $field['id'] . '-' . $template_type ) ); ?>"
116 - name="<?php echo esc_attr( $field['id'] . '[plain]' ); ?>"
117 - class="code" cols="25" rows="20"
118 - style="width: 97%;"><?php echo wp_kses_post( $content_plain ); ?>
119 - </textarea>
120 - </div>
121 - <?php endif; ?>
122 - </div>
123 -
124 - <?php if ( ! $has_local_file ) : ?>
125 - <?php if ( $field['support_variables'] ) : ?>
126 - <ol class="learn-press-email-variables<?php echo esc_html( $template_type == 'html' ? ' has-editor' : '' ); ?>"
127 - data-target="<?php echo esc_attr( sanitize_key( $field['id'] . '-' . $template_type ) ); ?>">
128 - <?php foreach ( $field['support_variables'] as $variable ) : ?>
129 - <li data-variable="<?php echo esc_attr( $variable ); ?>">
130 - <code><?php echo esc_html( $variable ); ?></code></li>
131 - <?php endforeach; ?>
132 - </ol>
133 -
134 - <p class="description">
135 - <?php esc_html_e( 'Click on any variables above to insert them into the email.', 'learnpress' ); ?>
136 - </p>
137 - <?php endif; ?>
138 - <?php endif; ?>
139 - </div>
140 - <?php endforeach; ?>
141 - </div>
142 - </td>
143 -</tr>
1 +<?php
2 +wp_enqueue_script( 'learn-press-email-content-field', LearnPress::instance()->plugin_url( 'inc/admin/meta-box/assets/email-content.js' ) );
3 +wp_enqueue_style( 'learn-press-email-content-field', LearnPress::instance()->plugin_url( 'inc/admin/meta-box/assets/email-content.css' ) );
4 +
5 +if ( ! isset( $value ) ) {
6 + return;
7 +}
8 +
9 +$meta = wp_parse_args(
10 + $value['value'],
11 + array(
12 + 'format' => 'html',
13 + 'html' => '',
14 + 'plain' => '',
15 + )
16 +);
17 +
18 +$field = wp_parse_args(
19 + $value,
20 + array(
21 + 'template_base' => '',
22 + 'template_path' => '',
23 + 'template_html' => '',
24 + 'template_plain' => '',
25 + 'template_html_local' => '',
26 + 'template_plain_local' => '',
27 + 'support_variables' => array(),
28 + )
29 +);
30 +
31 +$email_format = $meta['format'];
32 +?>
33 +
34 +<tr valign="top">
35 + <th scope="row" class="titledesc">
36 + <label><?php echo wp_kses_post( $value['title'] ); ?> <?php echo wp_kses_post( $tooltip_html ?? '' ); ?></label>
37 + </th>
38 + <td class="forminp lp-metabox-field__email-content forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">&lrm;
39 + <?php
40 + /*learn_press_email_formats_dropdown(
41 + array(
42 + 'name' => $value['id'] . '[format]',
43 + 'class' => 'lp-email-format',
44 + 'selected' => $email_format,
45 + 'option_none' => array( '' => esc_html__( 'General Settings', 'learnpress' ) ),
46 + )
47 + );*/
48 + ?>
49 + <div class="lp-email-templates">
50 + <?php
51 + $templates = learn_press_email_formats();
52 +
53 + foreach ( $templates as $template_type => $title ) :
54 + $template = ! empty( $field[ "template_{$template_type}" ] ) ? $field[ "template_{$template_type}" ] : null;
55 +
56 + if ( empty( $template ) ) {
57 + continue;
58 + }
59 +
60 + $local_file = ! empty( $field[ "template_{$template_type}_local" ] ) ? $field[ "template_{$template_type}_local" ] : null;
61 + $template_file = $field['template_base'] . $template;
62 + $template_dir = $field['template_path'];
63 + $classes = array( 'learn-press-email-template' );
64 +
65 + if ( $template_type == 'html' ) {
66 + $classes[] = $template_type . ' multipart';
67 + } else {
68 + $classes[] = 'plain_text';
69 + }
70 +
71 + if ( $template_type == $email_format || ( ( $email_format == 'plain_text' || ! $email_format ) && $template_type == 'plain' ) ) {
72 + } else {
73 + $classes[] = 'hide-if-js';
74 + }
75 +
76 + $content_html = $meta['html'] ? stripslashes( $meta['html'] ) : LP_WP_Filesystem::instance()->file_get_contents( $template_file );
77 + $content_plain = $meta['plain'] ? stripslashes( $meta['plain'] ) : LP_WP_Filesystem::instance()->file_get_contents( $template_file );
78 +
79 + $has_local_file = file_exists( $local_file );
80 +
81 + $theme_dir = get_template_directory();
82 + $stylesheet_dir = get_stylesheet_directory();
83 +
84 + if ( $theme_dir != $stylesheet_dir ) {
85 + $theme_dir = $stylesheet_dir;
86 + }
87 +
88 + $theme_folder = basename( $theme_dir );
89 + ?>
90 +
91 + <div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
92 + <?php if ( $has_local_file ) : ?>
93 + <textarea rows="10" style="width: 90%;" readonly="readonly"><?php echo stripslashes( LP_WP_Filesystem::instance()->file_get_contents( $local_file ) ); ?></textarea>
94 + <p class="description">
95 + <?php printf( __( 'This template has been overridden by your theme and can be found in: <code>%s</code>. <br />Please open the file in an editor program to edit', 'learnpress' ), $theme_folder . '/' . $template_dir . '/' . $template ); ?>
96 + </p>
97 + <?php endif; ?>
98 +
99 + <div class="<?php echo esc_attr( $has_local_file ? 'hide-if-js' : '' ); ?>">
100 + <?php if ( $template_type == 'html' ) : ?>
101 + <?php
102 + wp_editor(
103 + $content_html,
104 + sanitize_key( $field['id'] . '-' . $template_type ),
105 + array(
106 + 'textarea_rows' => 20,
107 + 'wpautop' => false,
108 + 'textarea_name' => $field['id'] . '[html]',
109 + )
110 + );
111 + ?>
112 + <?php else : ?>
113 + <div class="editor">
114 + <textarea
115 + id="<?php echo esc_attr( sanitize_key( $field['id'] . '-' . $template_type ) ); ?>"
116 + name="<?php echo esc_attr( $field['id'] . '[plain]' ); ?>"
117 + class="code" cols="25" rows="20"
118 + style="width: 97%;"><?php echo wp_kses_post( $content_plain ); ?>
119 + </textarea>
120 + </div>
121 + <?php endif; ?>
122 + </div>
123 +
124 + <?php if ( ! $has_local_file ) : ?>
125 + <?php if ( $field['support_variables'] ) : ?>
126 + <ol class="learn-press-email-variables<?php echo esc_html( $template_type == 'html' ? ' has-editor' : '' ); ?>"
127 + data-target="<?php echo esc_attr( sanitize_key( $field['id'] . '-' . $template_type ) ); ?>">
128 + <?php foreach ( $field['support_variables'] as $variable ) : ?>
129 + <li data-variable="<?php echo esc_attr( $variable ); ?>">
130 + <code><?php echo esc_html( $variable ); ?></code></li>
131 + <?php endforeach; ?>
132 + </ol>
133 +
134 + <p class="description">
135 + <?php esc_html_e( 'Click on any variables above to insert them into the email.', 'learnpress' ); ?>
136 + </p>
137 + <?php endif; ?>
138 + <?php endif; ?>
139 + </div>
140 + <?php endforeach; ?>
141 + </div>
142 + </td>
143 +</tr>