dispatch_shortcode(); } /** * Tags of the shortcodes registered by Academy LMS itself. * * @var string[] */ protected static $own_tags = array(); public function dispatch_shortcode() { global $shortcode_tags; $before = array_keys( (array) $shortcode_tags ); new Shortcode\AcademyDashboard(); new Shortcode\AcademyCourses(); new Shortcode\AcademyRegistration(); new Shortcode\AcademyPDF(); new Shortcode\AcademyLogin(); new Shortcode\AcademySearch(); new Shortcode\AcademyCourseFilters(); new Shortcode\AcademyEnrollForm(); new Shortcode\AcademyPasswordReset(); new Shortcode\AcademyCourseCurriculum(); new Shortcode\AcademyCourseLearnpage(); new Shortcode\AcademyTabs(); new Shortcode\AcademyCourseEnrollWidget(); new Shortcode\AcademySingleCourse(); new Shortcode\AcademyCourseInstructors(); new Shortcode\AcademyEnrolledCourses(); self::$own_tags = array_values( array_diff( array_keys( (array) $shortcode_tags ), $before ) ); add_filter( 'do_shortcode_tag', array( __CLASS__, 'escape_output' ), 10, 2 ); } /** * Escape the HTML returned by every Academy LMS shortcode with * Helper::kses_rendered() (post HTML plus forms, media, SVG icons and * data-/aria- attributes; never script or style), so no shortcode callback * returns unfiltered markup. * * @param string $output Shortcode output. * @param string $tag Shortcode tag. * @return string */ public static function escape_output( $output, $tag ) { if ( ! is_string( $output ) || '' === $output || ! in_array( $tag, self::$own_tags, true ) ) { return $output; } return Helper::kses_rendered( $output ); } }