__CLASS__ . '::confirm_order', 'profile' => __CLASS__ . '::profile', 'become_teacher_form' => __CLASS__ . '::become_teacher_form', 'login_form' => __CLASS__ . '::login_form', 'register_form' => __CLASS__ . '::register_form', 'checkout' => __CLASS__ . '::checkout', 'recent_courses' => __CLASS__ . '::recent_courses', 'featured_courses' => __CLASS__ . '::featured_courses', 'popular_courses' => __CLASS__ . '::popular_courses', //'button_enroll' => __CLASS__ . '::button_enroll', //'button_purchase' => __CLASS__ . '::button_purchase', //'button_course' => __CLASS__ . '::button_course', 'course_curriculum' => __CLASS__ . '::course_curriculum', ); foreach ( $shortcodes as $shortcode => $function ) { $shortcode = "learn_press_{$shortcode}"; add_shortcode( apply_filters( "learn-press/shortcode/{$shortcode}/tag", $shortcode ), $function ); } add_action( 'template_include', array( __CLASS__, 'auto_shortcode' ), - 10, 2 ); } /** * Auto add shortcode into some default pages. * * @param $template * * @return mixed */ public static function auto_shortcode( $template ) { global $post; if ( ! $post ) { return $template; } // Option enable auto add shortcode. @since 4.2.3 $enable = apply_filters( 'learn-press/auto-shortcode', true, $post ); if ( ! $enable ) { return $template; } if ( LP_Page_Controller::is_page_checkout() ) { if ( ! preg_match( '/\[learn_press_checkout\s?(.*)/', $post->post_content ) ) { $post->post_content .= '[learn_press_checkout]'; } } elseif ( $post->ID == learn_press_get_page_id( 'become_a_teacher' ) ) { if ( ! preg_match( '/\[learn_press_become_teacher_form\s?(.*)/', $post->post_content ) ) { $post->post_content .= '[learn_press_become_teacher_form]'; } } elseif ( LP_Page_Controller::is_page_profile() ) { if ( ! preg_match( '/\[learn_press_profile\s?(.*)/', $post->post_content ) ) { $post->post_content .= '[learn_press_profile]'; } } elseif ( LP_Page_Controller::is_page_instructor() ) { if ( ! preg_match( '/\[learn_press_single_instructor\s?(.*)/', $post->post_content ) ) { // $post->post_content .= '[learn_press_single_instructor]'; } } elseif ( LP_Page_Controller::is_page_instructors() ) { if ( ! preg_match( '/\[learn_press_instructors\s?(.*)/', $post->post_content ) ) { $post->post_content .= '[learn_press_instructors]'; } } return $template; } /** * Wrap content of a shortcode into wrapper element. * * @param string $content * * @return string */ public static function wrapper_shortcode( $content ) { ob_start(); learn_press_print_messages(); $html = ob_get_clean(); try { $html .= $content->output(); } catch ( Exception $ex ) { $html .= $ex->getMessage(); } return '