PluginProbe
Extendify / 0.10.2
Extendify v0.10.2
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / app / Assist / Controllers / TasksController.php

TasksController.php in Extendify 0.10.2, at app/Assist/Controllers/TasksController.php

58 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Controls Tasks
4 */
5
6 namespace Extendify\Assist\Controllers;
7
8 use Extendify\Http;
9
10 if (!defined('ABSPATH')) {
11 die('No direct access.');
12 }
13
14 /**
15 * The controller for plugin dependency checking, etc
16 */
17 class TasksController
18 {
19
20 /**
21 * Return tasks from either database or source.
22 *
23 * @return \WP_REST_Response
24 */
25 public static function fetchTasks()
26 {
27 $response = Http::get('/tasks');
28 return new \WP_REST_Response(
29 $response,
30 wp_remote_retrieve_response_code($response)
31 );
32 }
33
34 /**
35 * Return the data
36 *
37 * @return \WP_REST_Response
38 */
39 public static function get()
40 {
41 $data = get_option('extendify_assist_tasks', []);
42 return new \WP_REST_Response($data);
43 }
44
45 /**
46 * Persist the data
47 *
48 * @param \WP_REST_Request $request - The request.
49 * @return \WP_REST_Response
50 */
51 public static function store($request)
52 {
53 $data = json_decode($request->get_param('data'), true);
54 update_option('extendify_assist_tasks', $data);
55 return new \WP_REST_Response($data);
56 }
57 }
58