Submit
Path:
~
/
home
/
getwphos
/
public_html
/
seasons-newtheme
/
wp-content
/
plugins
/
learnpress
/
inc
/
File Content:
class-lp-shortcodes.php
<?php /** * Base class of LearnPress shortcodes and helper functions. * * @author ThimPress * @category Shortcode * @package Learnpress/Shortcodes * @version 3.0.0 */ defined( 'ABSPATH' ) || exit(); if ( ! class_exists( 'LP_Shortcodes' ) ) { /** * LP_Shortcodes class */ class LP_Shortcodes { /** * Init shortcodes */ public static function init() { $shortcodes = array( 'confirm_order' => __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 '<div class="learnpress">' . $html . '</div>'; } /** * Displaying recently courses added. * * @param mixed $atts * * @return string */ public static function recent_courses( $atts ) { return self::wrapper_shortcode( new LP_Shortcode_Recent_Courses( $atts ) ); } /** * Displaying courses are set as featured. * * @param array $atts * * @return string */ public static function featured_courses( $atts ) { return self::wrapper_shortcode( new LP_Shortcode_Featured_Courses( $atts ) ); } /** * Displaying popular courses. * * @param array $atts * * @return string */ public static function popular_courses( $atts ) { return self::wrapper_shortcode( new LP_Shortcode_Popular_Courses( $atts ) ); } /** * Displaying checkout form. * * @param mixed $atts * * @return string */ public static function checkout( $atts ) { return self::wrapper_shortcode( new LP_Shortcode_Checkout( $atts ) ); } /** * Display content of user profile. * * @param mixed $atts * * @return string */ public static function profile( $atts ) { return self::wrapper_shortcode( new LP_Shortcode_Profile( $atts ) ); } /** * Display a form let the user can be join as a teacher. * * @param array|null * * @return string */ public static function become_teacher_form( $atts ) { return self::wrapper_shortcode( new LP_Shortcode_Become_A_Teacher( $atts ) ); } /** * Display a register user form. * * @param array|null * * @return string */ public static function register_form( $atts ) { return self::wrapper_shortcode( new LP_Shortcode_Register_Form( $atts ) ); } /** * Shortcode content for "Confirm Order" page * * @param array $atts * * @return string */ public static function confirm_order( $atts = null ) { $atts = shortcode_atts( array( 'order_id' => ! empty( $_REQUEST['order_id'] ) ? intval( $_REQUEST['order_id'] ) : 0, ), $atts ); $order_id = null; extract( $atts ); // phpcs:ignore ob_start(); $order = learn_press_get_order( $order_id ); if ( $order ) { learn_press_get_template( 'order/confirm.php', array( 'order' => $order ) ); } return self::wrapper_shortcode( ob_get_clean() ); } public static function login_form( $atts, $content = '' ) { $atts = shortcode_atts( array( 'redirect' => '', ), $atts ); add_filter( 'login_form_bottom', array( __CLASS__, 'login_form_bottom' ), 10, 2 ); return self::wrapper_shortcode( new LP_Shortcode_Login_Form( $atts ) ); } public static function login_form_bottom( $html, $args ) { ob_start(); ?> <p> <a href="<?php echo wp_lostpassword_url(); ?>"><?php esc_html_e( 'Forgot password?', 'learnpress' ); ?></a> | <a href="<?php echo wp_registration_url(); ?>"><?php esc_html_e( 'Create a new account', 'learnpress' ); ?></a> </p> <?php $html .= ob_get_clean(); return $html; } /** * @param $atts * @param string $content * * @return LP_Shortcode_Button_Purchase */ public static function button_purchase( $atts, $content = '' ) { return new LP_Shortcode_Button_Purchase( $atts ); } /** * @param $atts * @param string $content * * @return LP_Shortcode_Button_Course */ public static function button_course( $atts, $content = '' ) { return new LP_Shortcode_Button_Course( $atts ); } /** * @param array $atts * @param string $content * * @return LP_Shortcode_Course_Curriculum */ public static function course_curriculum( $atts, $content = '' ) { return new LP_Shortcode_Course_Curriculum( $atts ); } } } add_action( 'init', array( 'LP_Shortcodes', 'init' ) );
Submit
FILE
FOLDER
Name
Size
Permission
Action
Ajax
---
0755
Databases
---
0755
ExternalPlugin
---
0755
Filters
---
0755
Helpers
---
0755
MetaBox
---
0755
Models
---
0755
Shortcodes
---
0755
TemplateHooks
---
0755
Widgets
---
0755
abstracts
---
0755
admin
---
0755
background-process
---
0755
block-template
---
0755
cache
---
0755
cart
---
0755
course
---
0755
curds
---
0755
custom-post-types
---
0755
emails
---
0755
gateways
---
0755
handle-steps
---
0755
interfaces
---
0755
jwt
---
0755
lesson
---
0755
libraries
---
0755
order
---
0755
question
---
0755
quiz
---
0755
rest-api
---
0755
settings
---
0755
templates
---
0755
updates
---
0755
user
---
0755
user-item
---
0755
abstract-settings.php
5132 bytes
0644
cache.php
14474 bytes
0644
class-lp-ajax.php
8184 bytes
0644
class-lp-asset-key.php
1965 bytes
0644
class-lp-assets.php
14992 bytes
0644
class-lp-autoloader.php
2589 bytes
0644
class-lp-breadcrumb.php
10259 bytes
0644
class-lp-checkout.php
15740 bytes
0644
class-lp-course-query.php
3498 bytes
0644
class-lp-datetime.php
9095 bytes
0644
class-lp-debug.php
2683 bytes
0644
class-lp-duration.php
3677 bytes
0644
class-lp-emails.php
6138 bytes
0644
class-lp-file-system.php
7258 bytes
0644
class-lp-forms-handler.php
16138 bytes
0644
class-lp-global.php
6526 bytes
0644
class-lp-helper.php
15158 bytes
0644
class-lp-install.php
7769 bytes
0644
class-lp-manager-addons.php
8444 bytes
0644
class-lp-page-controller.php
34571 bytes
0644
class-lp-query-list-table.php
4395 bytes
0644
class-lp-query.php
9694 bytes
0644
class-lp-request-handler.php
11768 bytes
0644
class-lp-session-handler.php
10119 bytes
0644
class-lp-settings.php
12006 bytes
0644
class-lp-shortcodes.php
7207 bytes
0644
class-lp-strings.php
1907 bytes
0644
class-lp-template.php
1542 bytes
0644
class-lp-thumbnail-helper.php
1222 bytes
0644
class-lp-widget.php
12938 bytes
0644
index.php
28 bytes
0644
lp-constants.php
4290 bytes
0644
lp-core-functions.php
69852 bytes
0644
lp-custom-hooks.php
1025 bytes
0644
lp-deprecated.php
29619 bytes
0644
lp-template-functions.php
45987 bytes
0644
lp-template-hooks.php
18193 bytes
0644
lp-webhooks.php
3015 bytes
0644
lp-widget-functions.php
1585 bytes
0644
N4ST4R_ID | Naxtarrr