PluginProbe
WP Coder – Insert & Manage Code Snippets / 4.3
WP Coder – Insert & Manage Code Snippets v4.3
4.5.1 1.1 2.3.1 2.3.2 2.4.1 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 3.2 3.2.1 3.3 3.4 3.5 3.5.1 All 39 releases
← All changes | classes/Dashboard/Link.php +55 -32 3.04.3 View file →
@@ -3,41 +3,41 @@
3 3 namespace WPCoder\Dashboard;
4 4
5 5 defined( 'ABSPATH' ) || exit;
6 6
7 -use WPCoder\WOW_Plugin;
7 +use WPCoder\WPCoder;
8 8
9 9 class Link {
10 10
11 - public static function create($arg = []): string {
11 + public static function create( $arg = [] ): string {
12 12 return add_query_arg( $arg, self::link() );
13 13 }
14 14
15 - public static function activate_mode($id = 0): string {
16 - return wp_nonce_url (add_query_arg( [
15 + public static function activate_mode( $id = 0 ): string {
16 + return wp_nonce_url( add_query_arg( [
17 17 'id' => $id,
18 - ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_activate_mode');
18 + ], self::link() ), WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_activate_mode' );
19 19 }
20 20
21 - public static function deactivate_mode($id = 0) {
22 - return wp_nonce_url (add_query_arg( [
21 + public static function deactivate_mode( $id = 0 ) {
22 + return wp_nonce_url( add_query_arg( [
23 23 'id' => $id,
24 - ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_deactivate_mode');
24 + ], self::link() ), WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_deactivate_mode' );
25 25 }
26 26
27 27
28 - public static function activate_url($id = 0) {
29 - return wp_nonce_url (add_query_arg( [
30 - 'id' => $id,
28 + public static function activate_url( $id = 0 ) {
29 + return wp_nonce_url( add_query_arg( [
30 + 'id' => $id,
31 31 'action' => 'activate',
32 - ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_activate_item');
32 + ], self::link() ), WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_activate_item' );
33 33 }
34 34
35 - public static function deactivate_url($id = 0) {
36 - return wp_nonce_url (add_query_arg( [
37 - 'id' => $id,
35 + public static function deactivate_url( $id = 0 ) {
36 + return wp_nonce_url( add_query_arg( [
37 + 'id' => $id,
38 38 'action' => 'deactivate',
39 - ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_deactivate_item');
39 + ], self::link() ), WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_deactivate_item' );
40 40 }
41 41
42 42 public static function remove_item() {
43 43 return add_query_arg( [
@@ -42,27 +42,35 @@
42 42 public static function remove_item() {
43 43 return add_query_arg( [
44 44 'notice' => 'remove_item',
45 45 ], self::link() );
46 -
47 46 }
48 47
49 48 public static function save_item( $id ) {
50 - return add_query_arg( [
51 - 'tab' => 'settings',
49 +
50 + $paged = $_GET['wpcoder-page'] ?? '';
51 +
52 + $arg = [
53 + 'page' => WPCoder::SLUG . '-settings',
52 54 'action' => 'update',
53 55 'id' => $id,
54 56 'notice' => 'save_item',
55 - ], self::link() );
57 + ];
58 +
59 + if(!empty($paged)) {
60 + $arg['wpcoder-page'] = absint($paged);
61 + }
62 +
63 + return add_query_arg( $arg, admin_url( 'admin.php' ) );
56 64 }
57 65
58 66 public static function menu( $page, $action, $id ): string {
59 67 if ( ! empty( $id ) && $action === 'update' ) {
60 68 return add_query_arg( [
61 - 'tab' => $page,
69 + 'page' => WPCoder::SLUG . '-settings',
62 70 'action' => 'update',
63 71 'id' => $id,
64 - ], self::link() );
72 + ], admin_url( 'admin.php' ) );
65 73 }
66 74
67 75 return add_query_arg( [
68 76 'tab' => $page,
@@ -72,14 +80,29 @@
72 80 public static function edit( $id ) {
73 81 if ( ! $id ) {
74 82 return false;
75 83 }
84 + $paged = $_GET['paged'] ?? '';
85 + return add_query_arg( [
86 + 'page' => WPCoder::SLUG . '-settings',
87 + 'action' => 'update',
88 + 'id' => $id,
89 + 'wpcoder-page' => absint( $paged ),
90 + ], admin_url( 'admin.php' ) );
91 + }
76 92
77 - return add_query_arg( [
78 - 'action' => 'update',
79 - 'tab' => 'settings',
80 - 'id' => $id
81 - ], self::link() );
93 + public static function all_codes() {
94 + $paged = $_GET['wpcoder-page'] ?? '';
95 +
96 + $arg = [
97 + 'page' => WPCoder::SLUG ,
98 + ];
99 +
100 + if(!empty($paged)) {
101 + $arg['paged'] = absint($paged);
102 + }
103 +
104 + return add_query_arg( $arg, admin_url( 'admin.php' ) );
82 105 }
83 106
84 107 public static function duplicate( $id ) {
85 108 if ( ! $id ) {
@@ -86,12 +109,12 @@
86 109 return false;
87 110 }
88 111
89 112 return add_query_arg( [
113 + 'page' => WPCoder::SLUG . '-settings',
90 114 'action' => 'duplicate',
91 - 'tab' => 'settings',
92 115 'id' => $id
93 - ], self::link() );
116 + ], admin_url( 'admin.php' ) );
94 117 }
95 118
96 119 public static function export( $id ) {
97 120 if ( ! $id ) {
@@ -100,9 +123,9 @@
100 123
101 124 return wp_nonce_url( add_query_arg( [
102 125 'action' => 'export',
103 126 'id' => $id
104 - ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_export_item' );
127 + ], self::link() ), WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_export_item' );
105 128 }
106 129
107 130 public static function remove( $id ) {
108 131 if ( ! $id ) {
@@ -111,12 +134,12 @@
111 134
112 135 return wp_nonce_url( add_query_arg( [
113 136 'action' => 'delete',
114 137 'id' => $id
115 - ], self::link() ), WOW_Plugin::PREFIX . '_nonce', WOW_Plugin::PREFIX . '_remove_item' );
138 + ], self::link() ), WPCoder::PREFIX . '_nonce', WPCoder::PREFIX . '_remove_item' );
116 139 }
117 140
118 141 private static function link(): string {
119 - return add_query_arg( [ 'page' => WOW_Plugin::SLUG ], admin_url( 'admin.php' ) );
142 + return add_query_arg( [ 'page' => WPCoder::SLUG ], admin_url( 'admin.php' ) );
120 143 }
121 144
122 145 }