PluginProbe
Extendify / 3.1.0
Extendify v3.1.0
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 / Shared / Controllers / SiteProfileController.php

SiteProfileController.php in Extendify 3.1.0, at app/Shared/Controllers/SiteProfileController.php

44 lines 980 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Controls Site Profile options
5 */
6
7 namespace Extendify\Shared\Controllers;
8
9 defined('ABSPATH') || die('No direct access.');
10
11 use Extendify\Shared\Services\Sanitizer;
12
13 /**
14 * The controller for persisting site data
15 */
16
17 class SiteProfileController
18 {
19 /**
20 * Persist single data
21 *
22 * @param \WP_REST_Request $request - The request.
23 * @return \WP_REST_Response
24 */
25 public static function store($request)
26 {
27 $value = $request->get_param('siteProfile');
28 \update_option('extendify_site_profile', Sanitizer::sanitizeUnknown($value));
29 $siteProfile = is_string($value) ? json_decode($value, true) : $value;
30 return new \WP_REST_Response($siteProfile);
31 }
32
33 /**
34 * Get option data by name.
35 *
36 * @return \WP_REST_Response
37 */
38 public static function get()
39 {
40 $siteProfile = \get_option('extendify_site_profile', []);
41 return new \WP_REST_Response($siteProfile);
42 }
43 }
44