admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'aimslms_curriculum' ), ) ); } /* * ======================= * RENDER UI * ======================= */ /** * Render the curriculum builder markup: existing sections/lessons plus the "Add Section" control. * * @param WP_Post $post Course post being edited. */ public static function render( $post ) { global $wpdb; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Custom table, no WP API alternative. $sections = $wpdb->get_results( $wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name is derived from $wpdb->prefix, not user input. "SELECT * FROM {$wpdb->prefix}aimslms_course_sections WHERE course_id = %d ORDER BY sort_order ASC", $post->ID ) ); $sections_count = ! empty( $sections ) ? count( $sections ) : 0; ?>
Details Sections
get_results( $wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name is derived from $wpdb->prefix, not user input. "SELECT * FROM {$wpdb->prefix}aimslms_course_lessons WHERE section_id = %d ORDER BY sort_order ASC", $section->id ) ); $lessons_count = ! empty( $lessons ) ? count( $lessons ) : 0; ?>
lessons
duration ) ) { $parts = explode( ' ', $lesson->duration ); $duration_value = $parts[0] ?? ''; $duration_unit = $parts[1] ?? 'minute'; } $file_url = ! empty( $lesson->upload_file ) ? esc_url( $lesson->upload_file ) : ''; $file_ext = $file_url ? strtolower( pathinfo( $file_url, PATHINFO_EXTENSION ) ) : ''; $is_video = in_array( $file_ext, array( 'mp4', 'webm', 'ogg', 'mov' ), true ); $is_doc = in_array( $file_ext, array( 'pdf', 'txt' ), true ); $is_pdf = ( 'pdf' === $file_ext ); $is_txt = ( 'txt' === $file_ext ); ?>
upload_file ) ) { ?>