_atts = shortcode_atts( array( 'id' => 0, 'enroll_text' => '', 'purchase_text' => '', ), $this->_atts ); } /** * Output form. * * @return string */ public function output() { ob_start(); $atts = $this->_atts; if ( 'current' === $atts['id'] ) { $course_id = learn_press_is_course() ? get_the_ID() : 0; } else { $course_id = $atts['id']; } $course = learn_press_get_course( $course_id ); if ( $course_id && $course ) { LP_Global::set_course( $course ); global $post; $post = get_post( $course_id ); setup_postdata( $post ); do_action( 'learn-press/course-buttons' ); wp_reset_postdata(); LP_Global::reset(); } return ob_get_clean(); } /** * @param string $text * * @return string */ public function purchase_button_text( $text ) { if ( $this->_atts['purchase_text'] ) { $text = $this->_atts['purchase_text']; } return $text; } /** * @param string $text * * @return string */ public function enroll_button_text( $text ) { if ( $this->_atts['enroll_text'] ) { $text = $this->_atts['enroll_text']; } return $text; } } }