PluginProbe
Tutor LMS – eLearning and online course solution / 2.5.0
Tutor LMS – eLearning and online course solution v2.5.0
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 All 191 releases
← All changes | classes/RestAPI.php +48 -49 4.0.02.5.0 View file →
@@ -165,12 +165,53 @@
165 165 'permission_callback' => array( RestAuth::class, 'process_api_request' ),
166 166 )
167 167 );
168 168
169 + // Courses by terms cat and tag.
170 + register_rest_route(
171 + $this->namespace,
172 + '/course-by-terms',
173 + array(
174 + 'methods' => 'POST',
175 + 'callback' => array(
176 + $this->course_obj,
177 + 'course_by_terms',
178 + ),
179 + 'permission_callback' => array( RestAuth::class, 'process_api_request' ),
180 + )
181 + );
182 +
183 + // Courses by terms cat and tag.
184 + register_rest_route(
185 + $this->namespace,
186 + '/course-sorting-by-price',
187 + array(
188 + 'methods' => 'GET',
189 + 'callback' => array(
190 + $this->course_obj,
191 + 'course_sort_by_price',
192 + ),
193 + 'args' => array(
194 + 'order' => array(
195 + 'required' => true,
196 + 'type' => 'string',
197 + 'validate_callback' => function ( $order ) {
198 + return $this->validate_order( $order );
199 + },
200 + ),
201 + 'page' => array(
202 + 'required' => false,
203 + 'type' => 'number',
204 + ),
205 + ),
206 + 'permission_callback' => array( RestAuth::class, 'process_api_request' ),
207 + )
208 + );
209 +
169 210 // Course details.
170 211 register_rest_route(
171 212 $this->namespace,
172 - '/courses/(?P<id>\d+)',
213 + '/course-detail/(?P<id>\d+)',
173 214 array(
174 215 'methods' => 'GET',
175 216 'callback' => array(
176 217 $this->course_obj,
@@ -189,9 +230,9 @@
189 230
190 231 // Course topic.
191 232 register_rest_route(
192 233 $this->namespace,
193 - '/topics',
234 + '/course-topic/(?P<id>\d+)',
194 235 array(
195 236 'methods' => 'GET',
196 237 'callback' => array(
197 238 $this->topic_obj,
@@ -197,9 +238,9 @@
197 238 $this->topic_obj,
198 239 'course_topic',
199 240 ),
200 241 'args' => array(
201 - 'course_id' => array(
242 + 'id' => array(
202 243 'validate_callback' => function ( $param ) {
203 244 return is_numeric( $param );
204 245 },
205 246 ),
@@ -210,9 +251,9 @@
210 251
211 252 // Lesson by topic.
212 253 register_rest_route(
213 254 $this->namespace,
214 - '/lessons',
255 + '/lesson/(?P<id>\d+)',
215 256 array(
216 257 'methods' => 'GET',
217 258 'callback' => array(
218 259 $this->lesson_obj,
@@ -218,9 +259,9 @@
218 259 $this->lesson_obj,
219 260 'topic_lesson',
220 261 ),
221 262 'args' => array(
222 - 'topic_id' => array(
263 + 'id' => array(
223 264 'validate_callback' => function ( $param ) {
224 265 return is_numeric( $param );
225 266 },
226 267 ),
@@ -236,9 +277,9 @@
236 277 array(
237 278 'methods' => 'GET',
238 279 'callback' => array(
239 280 $this->announcement_obj,
240 - 'course_announcement',
281 + 'course_annoucement',
241 282 ),
242 283 'args' => array(
243 284 'id' => array(
244 285 'validate_callback' => function ( $param ) {
@@ -252,9 +293,9 @@
252 293
253 294 // Quiz by topic id.
254 295 register_rest_route(
255 296 $this->namespace,
256 - '/quizzes',
297 + '/quiz/(?P<id>\d+)',
257 298 array(
258 299 'methods' => 'GET',
259 300 'callback' => array(
260 301 $this->quiz_obj,
@@ -260,29 +301,8 @@
260 301 $this->quiz_obj,
261 302 'quiz_with_settings',
262 303 ),
263 304 'args' => array(
264 - 'topic_id' => array(
265 - 'validate_callback' => function ( $param ) {
266 - return is_numeric( $param );
267 - },
268 - ),
269 - ),
270 - 'permission_callback' => array( RestAuth::class, 'process_api_request' ),
271 - )
272 - );
273 -
274 - // Quiz by quiz id.
275 - register_rest_route(
276 - $this->namespace,
277 - '/quizzes/(?P<id>\d+)',
278 - array(
279 - 'methods' => 'GET',
280 - 'callback' => array(
281 - $this->quiz_obj,
282 - 'get_quiz',
283 - ),
284 - 'args' => array(
285 305 'id' => array(
286 306 'validate_callback' => function ( $param ) {
287 307 return is_numeric( $param );
288 308 },
@@ -363,29 +383,8 @@
363 383 'methods' => 'GET',
364 384 'callback' => array(
365 385 $this->rating_obj,
366 386 'course_rating',
367 - ),
368 - 'args' => array(
369 - 'id' => array(
370 - 'validate_callback' => function ( $param ) {
371 - return is_numeric( $param );
372 - },
373 - ),
374 - ),
375 - 'permission_callback' => array( RestAuth::class, 'process_api_request' ),
376 - )
377 - );
378 -
379 - // Get course content by id.
380 - register_rest_route(
381 - $this->namespace,
382 - '/course-contents/(?P<id>\d+)',
383 - array(
384 - 'methods' => 'GET',
385 - 'callback' => array(
386 - $this->course_obj,
387 - 'course_contents',
388 387 ),
389 388 'args' => array(
390 389 'id' => array(
391 390 'validate_callback' => function ( $param ) {