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/class-lp-shortcodes.php +29 -21 4.1.7.14.4.8 View file →
@@ -28,11 +28,11 @@
28 28 'checkout' => __CLASS__ . '::checkout',
29 29 'recent_courses' => __CLASS__ . '::recent_courses',
30 30 'featured_courses' => __CLASS__ . '::featured_courses',
31 31 'popular_courses' => __CLASS__ . '::popular_courses',
32 - 'button_enroll' => __CLASS__ . '::button_enroll',
33 - 'button_purchase' => __CLASS__ . '::button_purchase',
34 - 'button_course' => __CLASS__ . '::button_course',
32 + //'button_enroll' => __CLASS__ . '::button_enroll',
33 + //'button_purchase' => __CLASS__ . '::button_purchase',
34 + //'button_course' => __CLASS__ . '::button_course',
35 35 'course_curriculum' => __CLASS__ . '::course_curriculum',
36 36 );
37 37
38 38 foreach ( $shortcodes as $shortcode => $function ) {
@@ -56,16 +56,34 @@
56 56 if ( ! $post ) {
57 57 return $template;
58 58 }
59 59
60 - if ( $post->ID == learn_press_get_page_id( 'checkout' ) ) {
61 - if ( ! preg_match( '/\[learn_press_checkout\s?(.*)\]/', $post->post_content ) ) {
60 + // Option enable auto add shortcode. @since 4.2.3
61 + $enable = apply_filters( 'learn-press/auto-shortcode', true, $post );
62 + if ( ! $enable ) {
63 + return $template;
64 + }
65 +
66 + if ( LP_Page_Controller::is_page_checkout() ) {
67 + if ( ! preg_match( '/\[learn_press_checkout\s?(.*)/', $post->post_content ) ) {
62 68 $post->post_content .= '[learn_press_checkout]';
63 69 }
64 70 } elseif ( $post->ID == learn_press_get_page_id( 'become_a_teacher' ) ) {
65 - if ( ! preg_match( '/\[learn_press_become_teacher_form\s?(.*)\]/', $post->post_content ) ) {
71 + if ( ! preg_match( '/\[learn_press_become_teacher_form\s?(.*)/', $post->post_content ) ) {
66 72 $post->post_content .= '[learn_press_become_teacher_form]';
67 73 }
74 + } elseif ( LP_Page_Controller::is_page_profile() ) {
75 + if ( ! preg_match( '/\[learn_press_profile\s?(.*)/', $post->post_content ) ) {
76 + $post->post_content .= '[learn_press_profile]';
77 + }
78 + } elseif ( LP_Page_Controller::is_page_instructor() ) {
79 + if ( ! preg_match( '/\[learn_press_single_instructor\s?(.*)/', $post->post_content ) ) {
80 + // $post->post_content .= '[learn_press_single_instructor]';
81 + }
82 + } elseif ( LP_Page_Controller::is_page_instructors() ) {
83 + if ( ! preg_match( '/\[learn_press_instructors\s?(.*)/', $post->post_content ) ) {
84 + $post->post_content .= '[learn_press_instructors]';
85 + }
68 86 }
69 87
70 88 return $template;
71 89 }
@@ -216,9 +234,9 @@
216 234 ?>
217 235 <p>
218 236 <a href="<?php echo wp_lostpassword_url(); ?>"><?php esc_html_e( 'Forgot password?', 'learnpress' ); ?></a>
219 237 &nbsp;|&nbsp;
220 - <a href="<?php echo wp_registration_url(); ?>"><?php esc_html_e( 'Create new account', 'learnpress' ); ?></a>
238 + <a href="<?php echo wp_registration_url(); ?>"><?php esc_html_e( 'Create a new account', 'learnpress' ); ?></a>
221 239 </p>
222 240 <?php
223 241 $html .= ob_get_clean();
224 242
@@ -228,23 +246,13 @@
228 246 /**
229 247 * @param $atts
230 248 * @param string $content
231 249 *
232 - * @return LP_Shortcode_Button_Enroll
233 - */
234 - public static function button_enroll( $atts, $content = '' ) {
235 - return new LP_Shortcode_Button_Enroll( $atts );
236 - }
237 -
238 - /**
239 - * @param $atts
240 - * @param string $content
241 - *
242 250 * @return LP_Shortcode_Button_Purchase
243 251 */
244 - public static function button_purchase( $atts, $content = '' ) {
252 + /*public static function button_purchase( $atts, $content = '' ) {
245 253 return new LP_Shortcode_Button_Purchase( $atts );
246 - }
254 + }*/
247 255
248 256 /**
249 257 * @param $atts
250 258 * @param string $content
@@ -250,11 +258,11 @@
250 258 * @param string $content
251 259 *
252 260 * @return LP_Shortcode_Button_Course
253 261 */
254 - public static function button_course( $atts, $content = '' ) {
262 + /*public static function button_course( $atts, $content = '' ) {
255 263 return new LP_Shortcode_Button_Course( $atts );
256 - }
264 + }*/
257 265
258 266 /**
259 267 * @param array $atts
260 268 * @param string $content