PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / Onboarding / Setup / Handlers / TopLevelMenuRedirect.php

TopLevelMenuRedirect.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Onboarding/Setup/Handlers/TopLevelMenuRedirect.php

53 lines 990 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Onboarding\Setup\Handlers;
4
5 defined('ABSPATH') || exit;
6
7 /**
8 * Redirect the top level "Donations" menu to the Setup submenu.
9 * This normalizes the Setup Page URL so that assets load correctly.
10 */
11 class TopLevelMenuRedirect implements RequestHandler
12 {
13
14 /**
15 * @inheritdoc
16 *
17 * @since 2.8.0
18 */
19 public function maybeHandle()
20 {
21 if (isset($_GET['page']) && 'give-setup' == $_GET['page'] && ! isset($_GET['post_type'])) {
22 $this->handle();
23 }
24 }
25
26 /**
27 * @inheritdoc
28 *
29 * @since 2.8.0
30 */
31 public function handle()
32 {
33 wp_redirect(
34 $this->getRedirectUrl()
35 );
36 exit;
37 }
38
39 /**
40 * @since 2.8.0
41 */
42 protected function getRedirectUrl()
43 {
44 return add_query_arg(
45 [
46 'post_type' => 'give_forms',
47 'page' => 'give-setup',
48 ],
49 admin_url('edit.php')
50 );
51 }
52 }
53