PluginProbe
Extendify / 3.1.5
Extendify v3.1.5
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 0.7.0 All 126 releases
extendify / app / Shared / Controllers / AutoUpdateController.php

AutoUpdateController.php in Extendify 3.1.5, at app/Shared/Controllers/AutoUpdateController.php

36 lines 899 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Controller for enabling plugin auto-updates.
5 */
6
7 namespace Extendify\Shared\Controllers;
8
9 defined('ABSPATH') || die('No direct access.');
10
11 use Extendify\Shared\Services\AutoUpdate\AutoUpdate;
12
13 /**
14 * Opts a plugin we installed into WordPress auto-updates.
15 */
16
17 class AutoUpdateController
18 {
19 /**
20 * Enable auto-updates for a plugin we just installed.
21 *
22 * @param \WP_REST_Request $request - The request.
23 * @return \WP_REST_Response
24 */
25 public static function enable($request)
26 {
27 $plugin = sanitize_text_field((string) $request->get_param('plugin'));
28 if (AutoUpdate::isEnabled() && $plugin) {
29 // The WP install response gives the plugin file without its ".php".
30 AutoUpdate::enableAutoUpdateForPlugin(plugin_basename($plugin . '.php'));
31 }
32
33 return new \WP_REST_Response(['success' => true]);
34 }
35 }
36