PluginProbe
404 Solution / 4.3.0
404 Solution v4.3.0
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / admin / actions / DeleteRedirectActionHandler.php

DeleteRedirectActionHandler.php in 404 Solution 4.3.0, at includes/admin/actions/DeleteRedirectActionHandler.php

38 lines 958 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 /**
8 * Handles the legacy remove-link action for redirect rows.
9 */
10 class ABJ_404_Solution_DeleteRedirectActionHandler {
11
12 /** @var ABJ_404_Solution_PluginLogicAdminActions */
13 private $parent;
14
15 public function __construct(ABJ_404_Solution_PluginLogicAdminActions $parent) {
16 $this->parent = $parent;
17 }
18
19 /** @return string */
20 public function handle(): string {
21 if (!array_key_exists('remove', $_GET) || $_GET['remove'] != 1) {
22 return '';
23 }
24
25 if (!is_admin() || !$this->parent->verifyLinkNonce('abj404_removeRedirect')) {
26 return '';
27 }
28
29 $id = $_GET['id'] ?? '';
30 if ($this->parent->getFunctions()->regexMatch('[0-9]+', $id)) {
31 $this->parent->getRedirectsRepo()->deleteRedirect(absint($id));
32 return __('Redirect Removed Successfully!', '404-solution');
33 }
34
35 return '';
36 }
37 }
38