PluginProbe
Floating Button – Easily Create Sticky, Fixed & Floating Buttons / trunk
Floating Button – Easily Create Sticky, Fixed & Floating Buttons vtrunk
trunk 2.0.2 3.0 4.0 4.1.2 4.3 5.0 5.0.1 5.1 5.1.1 5.2 5.3 5.3.1 6.0 6.0.1 6.0.10 6.0.11 6.0.12 6.0.13 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 All 31 releases
floating-button / classes / Dashboard / Link.php

Link.php in Floating Button – Easily Create Sticky, Fixed & Floating Buttons trunk, at classes/Dashboard/Link.php

122 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FloatingButton\Dashboard;
4
5 defined( 'ABSPATH' ) || exit;
6
7 use FloatingButton\WOW_Plugin;
8
9 class Link {
10
11 public static function create($arg = []): string {
12 return add_query_arg( $arg, self::link() );
13 }
14
15 public static function activate_mode($id = 0): string {
16 return wp_nonce_url (add_query_arg( [
17 'id' => $id,
18 ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_activate_mode');
19 }
20
21 public static function deactivate_mode($id = 0) {
22 return wp_nonce_url (add_query_arg( [
23 'id' => $id,
24 ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_deactivate_mode');
25 }
26
27
28 public static function activate_url($id = 0) {
29 return wp_nonce_url (add_query_arg( [
30 'id' => $id,
31 'action' => 'activate',
32 ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_activate_item');
33 }
34
35 public static function deactivate_url($id = 0) {
36 return wp_nonce_url (add_query_arg( [
37 'id' => $id,
38 'action' => 'deactivate',
39 ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_deactivate_item');
40 }
41
42 public static function remove_item() {
43 return add_query_arg( [
44 'notice' => 'remove_item',
45 ], self::link() );
46
47 }
48
49 public static function save_item( $id ) {
50 return add_query_arg( [
51 'tab' => 'settings',
52 'action' => 'update',
53 'id' => $id,
54 'notice' => 'save_item',
55 ], self::link() );
56 }
57
58 public static function menu( $page, $action, $id ): string {
59 if ( ! empty( $id ) && $action === 'update' ) {
60 return add_query_arg( [
61 'tab' => $page,
62 'action' => 'update',
63 'id' => $id,
64 ], self::link() );
65 }
66
67 return add_query_arg( [
68 'tab' => $page,
69 ], self::link() );
70 }
71
72 public static function edit( $id ) {
73 if ( ! $id ) {
74 return false;
75 }
76
77 return add_query_arg( [
78 'action' => 'update',
79 'tab' => 'settings',
80 'id' => $id
81 ], self::link() );
82 }
83
84 public static function duplicate( $id ) {
85 if ( ! $id ) {
86 return false;
87 }
88
89 return add_query_arg( [
90 'action' => 'duplicate',
91 'tab' => 'settings',
92 'id' => $id
93 ], self::link() );
94 }
95
96 public static function export( $id ) {
97 if ( ! $id ) {
98 return false;
99 }
100
101 return wp_nonce_url( add_query_arg( [
102 'action' => 'export',
103 'id' => $id
104 ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_export_item' );
105 }
106
107 public static function remove( $id ) {
108 if ( ! $id ) {
109 return false;
110 }
111
112 return wp_nonce_url( add_query_arg( [
113 'action' => 'delete',
114 'id' => $id
115 ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_remove_item' );
116 }
117
118 private static function link(): string {
119 return add_query_arg( [ 'page' => WOW_Plugin::SLUG ], admin_url( 'admin.php' ) );
120 }
121
122 }