' ); self::$block_footer = do_blocks( '' ); ?> > >
'; } /** End the page started by header(). */ public static function footer() { if ( ! wp_is_block_theme() ) { get_footer(); return; } echo ''; echo self::$block_footer; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- the theme's template part, rendered by WordPress. echo '
'; wp_footer(); echo "\n\n\n"; } public static function get_partial( $partial_name, $args = array() ) { if ( ! empty( $args ) ) { // Partials (and theme overrides of them) receive their data as named variables. extract( $args, EXTR_SKIP ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract } $file = locate_template( 'partials/' . $partial_name ); if ( ! $file ) { $file = ACCESSNOW_SLMS_PLUGIN_DIR . 'templates/partials/' . $partial_name; } /** * The file a partial is rendered from: the theme's override (partials/) or the plugin's. * * @since 1.1.0 * * @param string $file Full path. * @param string $partial_name Partial file name, e.g. course-card.php. * @param array $args The variables it receives. */ $file = apply_filters( 'accessnow_slms_locate_partial', $file, $partial_name, $args ); if ( is_string( $file ) && file_exists( $file ) ) { include $file; } } /** * The call to action that replaces "Enroll Now" (or follows "access ended") on a course page, * from accessnow_slms_course_cta; '' when nothing is hooked in. * * @param int $course_id Course ID. * @param int $user_id Current user ID (0 when logged out). * @param object|null $enrollment Their enrolment, or null. * @return string Safe HTML. */ public static function course_cta( $course_id, $user_id, $enrollment ) { /** * A call to action for a course the student can't use now: not enrolled, or access ended. * Shown instead of "Enroll Now" or the enrolment-unavailable message, and after * "Your access ended" (for a renewal). Not shown to logged-out visitors. * * Return null for none, array( 'label' => ..., 'url' => ... ) for a button, or * array( 'html' => ... ) for your own markup (a form may be included). * * @since 1.1.0 * * @param array|null $cta Null. * @param int $course_id Course ID. * @param int $user_id User ID. * @param object|null $enrollment Their enrolment, or null. */ $cta = apply_filters( 'accessnow_slms_course_cta', null, (int) $course_id, (int) $user_id, $enrollment ); if ( ! is_array( $cta ) ) { return ''; } if ( ! empty( $cta['html'] ) ) { $allowed = wp_kses_allowed_html( 'post' ); $allowed['form'] = array( 'action' => true, 'method' => true, 'class' => true, 'id' => true ); $allowed['input'] = array( 'type' => true, 'name' => true, 'value' => true, 'class' => true, 'id' => true, 'aria-label' => true ); $allowed['button'] = array( 'type' => true, 'name' => true, 'value' => true, 'class' => true, 'id' => true, 'aria-label' => true, 'disabled' => true ); return '
' . wp_kses( (string) $cta['html'], $allowed ) . '
'; } if ( empty( $cta['label'] ) || empty( $cta['url'] ) ) { return ''; } return sprintf( '
%s
', esc_url( $cta['url'] ), esc_html( $cta['label'] ) ); } }