'http://json-schema.org/draft-04/schema#', 'title' => 'attempt', 'type' => 'object', 'properties' => array( 'ID' => array( 'description' => esc_html__( 'Unique identifier for the lesson.', 'academy' ), 'type' => 'integer', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'lesson_author' => array( 'description' => esc_html__( 'Lesson Author.', 'academy' ), 'type' => array( 'string', 'integer' ), ), 'lesson_date' => array( 'description' => esc_html__( 'Lesson Date.', 'academy' ), 'type' => 'string', ), 'lesson_date_gmt' => array( 'description' => esc_html__( 'Lesson Date GMT.', 'academy' ), 'type' => 'string', ), 'lesson_title' => array( 'description' => esc_html__( 'Lesson Title.', 'academy' ), 'type' => 'string', ), 'lesson_name' => array( 'description' => esc_html__( 'Lesson Name.', 'academy' ), 'type' => 'string', ), 'lesson_content' => array( 'description' => esc_html__( 'Lesson Content.', 'academy' ), 'type' => 'string', ), 'lesson_excerpt' => array( 'description' => esc_html__( 'Lesson Exerpt.', 'academy' ), 'type' => 'string', ), 'lesson_status' => array( 'description' => esc_html__( 'Lesson Status.', 'academy' ), 'type' => 'string', ), 'comment_status' => array( 'description' => esc_html__( 'Lesson Comment Status', 'academy' ), 'type' => 'status', ), 'comment_count' => array( 'description' => esc_html__( 'Lesson Comment Count Number', 'academy' ), 'type' => 'integer', ), 'lesson_modified' => array( 'description' => esc_html__( 'Lesson Modified Date.', 'academy' ), 'type' => 'string', ), 'lesson_modified_gmt' => array( 'description' => esc_html__( 'Lesson Modified Date GMT.', 'academy' ), 'type' => 'string', ), 'meta' => [ 'type' => 'object', 'description' => esc_html__( 'Lesson Meta.', 'academy' ), 'properties' => [ 'featured_media' => [ 'type' => 'integer', ], 'attachment' => [ 'type' => 'integer', ], 'video_duration' => [ 'type' => [ 'object', 'null' ], ], 'video_source' => [ 'type' => [ 'object', 'null' ], ], ] ], ), ); return apply_filters( 'academy/api/lesson/public_item_schema', $schema ); } public function get_item_schema() { $schema = [ 'ID' => [ 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ], 'lesson_author' => [ 'type' => array( 'string', 'integer' ), 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ], 'lesson_date' => [ 'type' => 'string', 'format' => 'date-time', 'sanitize_callback' => 'sanitize_text_field', ], 'lesson_date_gmt' => [ 'type' => 'string', 'format' => 'date-time', 'sanitize_callback' => 'sanitize_text_field', ], 'lesson_title' => [ 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ], 'lesson_name' => [ 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ], 'lesson_content' => [ 'type' => 'string', 'sanitize_callback' => function ( $content ) { $content = ColorConverter::rgb_to_hex( $content ); // Matches core's own content_save_pre gate (wp_filter_post_kses // only runs for users who lack 'unfiltered_html' — Administrators // have it by default on a single site). Without this check, a // lesson author who pastes a full HTML document — a