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 +48 -25 3.44.3 View file →
@@ -7,37 +7,37 @@
7 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() ), WPCoder::PREFIX . '_nonce', WPCoder::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() ), WPCoder::PREFIX . '_nonce', WPCoder::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() ), WPCoder::PREFIX . '_nonce', WPCoder::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() ), WPCoder::PREFIX . '_nonce', WPCoder::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,24 +42,32 @@
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 - 'page' => WPCoder::SLUG . '-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 - ], admin_url( 'admin.php' ) );
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 - 'page' => WPCoder::SLUG . '-settings',
69 + 'page' => WPCoder::SLUG . '-settings',
62 70 'action' => 'update',
63 71 'id' => $id,
64 72 ], admin_url( 'admin.php' ) );
65 73 }
@@ -72,16 +80,31 @@
72 80 public static function edit( $id ) {
73 81 if ( ! $id ) {
74 82 return false;
75 83 }
76 -
84 + $paged = $_GET['paged'] ?? '';
77 85 return add_query_arg( [
78 - 'page' => WPCoder::SLUG . '-settings',
79 - 'action' => 'update',
80 - 'id' => $id
86 + 'page' => WPCoder::SLUG . '-settings',
87 + 'action' => 'update',
88 + 'id' => $id,
89 + 'wpcoder-page' => absint( $paged ),
81 90 ], admin_url( 'admin.php' ) );
82 91 }
83 92
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' ) );
105 + }
106 +
84 107 public static function duplicate( $id ) {
85 108 if ( ! $id ) {
86 109 return false;
87 110 }
@@ -86,9 +109,9 @@
86 109 return false;
87 110 }
88 111
89 112 return add_query_arg( [
90 - 'page' => WPCoder::SLUG . '-settings',
113 + 'page' => WPCoder::SLUG . '-settings',
91 114 'action' => 'duplicate',
92 115 'id' => $id
93 116 ], admin_url( 'admin.php' ) );
94 117 }