@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | * @return void |
24 | 24 | */ |
25 | 25 | function give_get_actions() { |
26 | - if ( isset( $_GET['give_action'] ) ) { |
|
27 | - do_action( 'give_' . $_GET['give_action'], $_GET ); |
|
26 | + if (isset($_GET['give_action'])) { |
|
27 | + do_action('give_'.$_GET['give_action'], $_GET); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'init', 'give_get_actions' ); |
|
31 | +add_action('init', 'give_get_actions'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Hooks Give actions, when present in the $_POST superglobal. Every give_action |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @return void |
40 | 40 | */ |
41 | 41 | function give_post_actions() { |
42 | - if ( isset( $_POST['give_action'] ) ) { |
|
43 | - do_action( 'give_' . $_POST['give_action'], $_POST ); |
|
42 | + if (isset($_POST['give_action'])) { |
|
43 | + do_action('give_'.$_POST['give_action'], $_POST); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | -add_action( 'init', 'give_post_actions' ); |
|
48 | 47 | \ No newline at end of file |
48 | +add_action('init', 'give_post_actions'); |
|
49 | 49 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | * @return void |
23 | 23 | */ |
24 | 24 | function give_process_actions() { |
25 | - if ( isset( $_POST['give-action'] ) ) { |
|
26 | - do_action( 'give_' . $_POST['give-action'], $_POST ); |
|
25 | + if (isset($_POST['give-action'])) { |
|
26 | + do_action('give_'.$_POST['give-action'], $_POST); |
|
27 | 27 | } |
28 | 28 | |
29 | - if ( isset( $_GET['give-action'] ) ) { |
|
30 | - do_action( 'give_' . $_GET['give-action'], $_GET ); |
|
29 | + if (isset($_GET['give-action'])) { |
|
30 | + do_action('give_'.$_GET['give-action'], $_GET); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | -add_action( 'admin_init', 'give_process_actions' ); |
|
35 | 34 | \ No newline at end of file |
35 | +add_action('admin_init', 'give_process_actions'); |
|
36 | 36 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -34,31 +34,31 @@ discard block |
||
34 | 34 | // $give_campaigns_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_campaigns->labels->menu_name, $give_campaigns->labels->add_new, 'edit_' . $give_campaigns->capability_type . 's', 'post-new.php?post_type=give_campaigns', null ); |
35 | 35 | |
36 | 36 | //Payments |
37 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
38 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
37 | + $give_payment = get_post_type_object('give_payment'); |
|
38 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
39 | 39 | |
40 | 40 | //Donors |
41 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donors', 'give' ), __( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' ); |
|
41 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', __('Donors', 'give'), __('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page'); |
|
42 | 42 | |
43 | 43 | //Reports |
44 | - $give_reports_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donation Reports', 'give' ), __( 'Reports', 'give' ), 'view_give_reports', 'give-reports', 'give_reports_page' ); |
|
44 | + $give_reports_page = add_submenu_page('edit.php?post_type=give_forms', __('Donation Reports', 'give'), __('Reports', 'give'), 'view_give_reports', 'give-reports', 'give_reports_page'); |
|
45 | 45 | |
46 | 46 | //Settings |
47 | - $give_settings_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Settings', 'give' ), __( 'Settings', 'give' ), 'manage_give_settings', 'give-settings', array( |
|
47 | + $give_settings_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Settings', 'give'), __('Settings', 'give'), 'manage_give_settings', 'give-settings', array( |
|
48 | 48 | Give()->give_settings, |
49 | 49 | 'admin_page_display' |
50 | - ) ); |
|
50 | + )); |
|
51 | 51 | |
52 | 52 | //Add-ons |
53 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Add-ons', 'give' ), __( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
53 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Add-ons', 'give'), __('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
54 | 54 | |
55 | 55 | //Upgrades |
56 | - $give_upgrades_screen = add_submenu_page( null, __( 'Give Upgrades', 'give' ), __( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
56 | + $give_upgrades_screen = add_submenu_page(null, __('Give Upgrades', 'give'), __('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | } |
60 | 60 | |
61 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
61 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Determines whether the current admin page is a Give admin page. |
@@ -73,224 +73,224 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return bool True if Give admin page. |
75 | 75 | */ |
76 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
76 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
77 | 77 | |
78 | 78 | global $pagenow, $typenow; |
79 | 79 | |
80 | 80 | $found = false; |
81 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
82 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
83 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
84 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
85 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
86 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
81 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
82 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
83 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
84 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
85 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
86 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
87 | 87 | |
88 | - switch ( $passed_page ) { |
|
88 | + switch ($passed_page) { |
|
89 | 89 | case 'give_forms': |
90 | - switch ( $passed_view ) { |
|
90 | + switch ($passed_view) { |
|
91 | 91 | case 'list-table': |
92 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
92 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
93 | 93 | $found = true; |
94 | 94 | } |
95 | 95 | break; |
96 | 96 | case 'edit': |
97 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
97 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
98 | 98 | $found = true; |
99 | 99 | } |
100 | 100 | break; |
101 | 101 | case 'new': |
102 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
102 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
103 | 103 | $found = true; |
104 | 104 | } |
105 | 105 | break; |
106 | 106 | default: |
107 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
107 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
108 | 108 | $found = true; |
109 | 109 | } |
110 | 110 | break; |
111 | 111 | } |
112 | 112 | break; |
113 | 113 | case 'categories': |
114 | - switch ( $passed_view ) { |
|
114 | + switch ($passed_view) { |
|
115 | 115 | case 'list-table': |
116 | 116 | case 'new': |
117 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
117 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
118 | 118 | $found = true; |
119 | 119 | } |
120 | 120 | break; |
121 | 121 | case 'edit': |
122 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
122 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
123 | 123 | $found = true; |
124 | 124 | } |
125 | 125 | break; |
126 | 126 | default: |
127 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
127 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
128 | 128 | $found = true; |
129 | 129 | } |
130 | 130 | break; |
131 | 131 | } |
132 | 132 | break; |
133 | 133 | case 'tags': |
134 | - switch ( $passed_view ) { |
|
134 | + switch ($passed_view) { |
|
135 | 135 | case 'list-table': |
136 | 136 | case 'new': |
137 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
137 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
138 | 138 | $found = true; |
139 | 139 | } |
140 | 140 | break; |
141 | 141 | case 'edit': |
142 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
142 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
143 | 143 | $found = true; |
144 | 144 | } |
145 | 145 | break; |
146 | 146 | default: |
147 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
147 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
148 | 148 | $found = true; |
149 | 149 | } |
150 | 150 | break; |
151 | 151 | } |
152 | 152 | break; |
153 | 153 | case 'payments': |
154 | - switch ( $passed_view ) { |
|
154 | + switch ($passed_view) { |
|
155 | 155 | case 'list-table': |
156 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
156 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
157 | 157 | $found = true; |
158 | 158 | } |
159 | 159 | break; |
160 | 160 | case 'edit': |
161 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) { |
|
161 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) { |
|
162 | 162 | $found = true; |
163 | 163 | } |
164 | 164 | break; |
165 | 165 | default: |
166 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
166 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
167 | 167 | $found = true; |
168 | 168 | } |
169 | 169 | break; |
170 | 170 | } |
171 | 171 | break; |
172 | 172 | case 'reports': |
173 | - switch ( $passed_view ) { |
|
173 | + switch ($passed_view) { |
|
174 | 174 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
175 | 175 | case 'earnings': |
176 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
176 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
177 | 177 | $found = true; |
178 | 178 | } |
179 | 179 | break; |
180 | 180 | case 'donors': |
181 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
181 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
182 | 182 | $found = true; |
183 | 183 | } |
184 | 184 | break; |
185 | 185 | case 'gateways': |
186 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
186 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
187 | 187 | $found = true; |
188 | 188 | } |
189 | 189 | break; |
190 | 190 | case 'export': |
191 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
191 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
192 | 192 | $found = true; |
193 | 193 | } |
194 | 194 | break; |
195 | 195 | case 'logs': |
196 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
196 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
197 | 197 | $found = true; |
198 | 198 | } |
199 | 199 | break; |
200 | 200 | default: |
201 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
201 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
202 | 202 | $found = true; |
203 | 203 | } |
204 | 204 | break; |
205 | 205 | } |
206 | 206 | break; |
207 | 207 | case 'settings': |
208 | - switch ( $passed_view ) { |
|
208 | + switch ($passed_view) { |
|
209 | 209 | case 'general': |
210 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
210 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
211 | 211 | $found = true; |
212 | 212 | } |
213 | 213 | break; |
214 | 214 | case 'gateways': |
215 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
215 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
216 | 216 | $found = true; |
217 | 217 | } |
218 | 218 | break; |
219 | 219 | case 'emails': |
220 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
220 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
221 | 221 | $found = true; |
222 | 222 | } |
223 | 223 | break; |
224 | 224 | case 'display': |
225 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
225 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
226 | 226 | $found = true; |
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'licenses': |
230 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
230 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
231 | 231 | $found = true; |
232 | 232 | } |
233 | 233 | break; |
234 | 234 | case 'api': |
235 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
235 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
236 | 236 | $found = true; |
237 | 237 | } |
238 | 238 | break; |
239 | 239 | case 'advanced': |
240 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
240 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
241 | 241 | $found = true; |
242 | 242 | } |
243 | 243 | break; |
244 | 244 | case 'system_info': |
245 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
245 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
246 | 246 | $found = true; |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | default: |
250 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
250 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
251 | 251 | $found = true; |
252 | 252 | } |
253 | 253 | break; |
254 | 254 | } |
255 | 255 | break; |
256 | 256 | case 'addons': |
257 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
257 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
258 | 258 | $found = true; |
259 | 259 | } |
260 | 260 | break; |
261 | 261 | case 'donors': |
262 | - switch ( $passed_view ) { |
|
262 | + switch ($passed_view) { |
|
263 | 263 | case 'list-table': |
264 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
264 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
265 | 265 | $found = true; |
266 | 266 | } |
267 | 267 | break; |
268 | 268 | case 'overview': |
269 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
269 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
270 | 270 | $found = true; |
271 | 271 | } |
272 | 272 | break; |
273 | 273 | case 'notes': |
274 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
274 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
275 | 275 | $found = true; |
276 | 276 | } |
277 | 277 | break; |
278 | 278 | default: |
279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
280 | 280 | $found = true; |
281 | 281 | } |
282 | 282 | break; |
283 | 283 | } |
284 | 284 | break; |
285 | 285 | case 'reports': |
286 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
286 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
287 | 287 | $found = true; |
288 | 288 | } |
289 | 289 | break; |
290 | 290 | default: |
291 | 291 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page; |
292 | 292 | |
293 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
293 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
294 | 294 | $give_payments_page, |
295 | 295 | $give_settings_page, |
296 | 296 | $give_reports_page, |
@@ -299,18 +299,18 @@ discard block |
||
299 | 299 | $give_upgrades_screen, |
300 | 300 | $give_settings_export, |
301 | 301 | $give_customers_page |
302 | - ) ); |
|
303 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
302 | + )); |
|
303 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
304 | 304 | $found = true; |
305 | - if ( 'give-upgrades' === $page ) { |
|
305 | + if ('give-upgrades' === $page) { |
|
306 | 306 | $found = false; |
307 | 307 | } |
308 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
308 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
309 | 309 | $found = true; |
310 | 310 | } |
311 | 311 | break; |
312 | 312 | } |
313 | 313 | |
314 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
314 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
315 | 315 | |
316 | 316 | } |
317 | 317 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The altered list of views |
25 | 25 | */ |
26 | -function give_register_default_customer_views( $views ) { |
|
26 | +function give_register_default_customer_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_customers_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_customer_notes_view' |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 ); |
|
38 | +add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single customer view |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_customer_tabs( $tabs ) { |
|
49 | +function give_register_default_customer_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | - 'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => __( 'Donor Profile', 'give' ) ), |
|
53 | - 'notes' => array( 'dashicon' => 'dashicons-admin-comments', 'title' => __( 'Donor Notes', 'give' ) ) |
|
52 | + 'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => __('Donor Profile', 'give')), |
|
53 | + 'notes' => array('dashicon' => 'dashicons-admin-comments', 'title' => __('Donor Notes', 'give')) |
|
54 | 54 | ); |
55 | 55 | |
56 | - return array_merge( $tabs, $default_tabs ); |
|
56 | + return array_merge($tabs, $default_tabs); |
|
57 | 57 | } |
58 | 58 | |
59 | -add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 ); |
|
59 | +add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Register the Delete icon as late as possible so it's at the bottom |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return array The altered list of tabs, with 'delete' at the bottom |
69 | 69 | */ |
70 | -function give_register_delete_customer_tab( $tabs ) { |
|
70 | +function give_register_delete_customer_tab($tabs) { |
|
71 | 71 | |
72 | - $tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => __( 'Delete Donor', 'give' ) ); |
|
72 | + $tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => __('Delete Donor', 'give')); |
|
73 | 73 | |
74 | 74 | return $tabs; |
75 | 75 | } |
76 | 76 | |
77 | -add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 ); |
|
77 | +add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined('ABSPATH')) exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Payment History Page |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | function give_payment_history_page() { |
25 | 25 | global $give_options; |
26 | 26 | |
27 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
27 | + $give_payment = get_post_type_object('give_payment'); |
|
28 | 28 | |
29 | - if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) { |
|
30 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php'; |
|
29 | + if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) { |
|
30 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php'; |
|
31 | 31 | } else { |
32 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
32 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
33 | 33 | $payments_table = new Give_Payment_History_Table(); |
34 | 34 | $payments_table->prepare_items(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap"> |
37 | 37 | <h2><?php echo $give_payment->labels->menu_name ?></h2> |
38 | - <?php do_action( 'give_payments_page_top' ); ?> |
|
39 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
38 | + <?php do_action('give_payments_page_top'); ?> |
|
39 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
40 | 40 | <input type="hidden" name="post_type" value="give_forms" /> |
41 | 41 | <input type="hidden" name="page" value="give-payment-history" /> |
42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | <?php $payments_table->display() ?> |
48 | 48 | </form> |
49 | - <?php do_action( 'give_payments_page_bottom' ); ?> |
|
49 | + <?php do_action('give_payments_page_bottom'); ?> |
|
50 | 50 | </div> |
51 | 51 | <?php |
52 | 52 | } |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | * @param $title |
62 | 62 | * @return string |
63 | 63 | */ |
64 | -function give_view_order_details_title( $admin_title, $title ) { |
|
64 | +function give_view_order_details_title($admin_title, $title) { |
|
65 | 65 | |
66 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
66 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) |
|
67 | 67 | return $admin_title; |
68 | 68 | |
69 | - if( ! isset( $_GET['give-action'] ) ) |
|
69 | + if ( ! isset($_GET['give-action'])) |
|
70 | 70 | return $admin_title; |
71 | 71 | |
72 | - switch( $_GET['give-action'] ) : |
|
72 | + switch ($_GET['give-action']) : |
|
73 | 73 | |
74 | 74 | case 'view-order-details' : |
75 | - $title = __( 'View Donation Details', 'give' ) . ' - ' . $admin_title; |
|
75 | + $title = __('View Donation Details', 'give').' - '.$admin_title; |
|
76 | 76 | break; |
77 | 77 | case 'edit-payment' : |
78 | - $title = __( 'Edit Payment', 'give' ) . ' - ' . $admin_title; |
|
78 | + $title = __('Edit Payment', 'give').' - '.$admin_title; |
|
79 | 79 | break; |
80 | 80 | default: |
81 | 81 | $title = $admin_title; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | return $title; |
86 | 86 | } |
87 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
87 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | * @param $context |
97 | 97 | * @return string |
98 | 98 | */ |
99 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
99 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
100 | 100 | |
101 | - $post = get_post( $post_id ); |
|
102 | - if( ! $post ) |
|
101 | + $post = get_post($post_id); |
|
102 | + if ( ! $post) |
|
103 | 103 | return $url; |
104 | 104 | |
105 | - if( 'give_payment' != $post->post_type ) |
|
105 | + if ('give_payment' != $post->post_type) |
|
106 | 106 | return $url; |
107 | 107 | |
108 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
|
108 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id); |
|
109 | 109 | |
110 | 110 | return $url; |
111 | 111 | } |
112 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
112 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | global $status, $page; |
63 | 63 | |
64 | 64 | // Set parent defaults |
65 | - parent::__construct( array( |
|
66 | - 'singular' => __( 'Donor', 'give' ), // Singular name of the listed records |
|
67 | - 'plural' => __( 'Donors', 'give' ), // Plural name of the listed records |
|
65 | + parent::__construct(array( |
|
66 | + 'singular' => __('Donor', 'give'), // Singular name of the listed records |
|
67 | + 'plural' => __('Donors', 'give'), // Plural name of the listed records |
|
68 | 68 | 'ajax' => false // Does this table support ajax? |
69 | - ) ); |
|
69 | + )); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return false |
85 | 85 | */ |
86 | - public function search_box( $text, $input_id ) { |
|
86 | + public function search_box($text, $input_id) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
@@ -98,20 +98,20 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - public function give_search_box( $text, $input_id ) { |
|
102 | - $input_id = $input_id . '-search-input'; |
|
101 | + public function give_search_box($text, $input_id) { |
|
102 | + $input_id = $input_id.'-search-input'; |
|
103 | 103 | |
104 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
105 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
104 | + if ( ! empty($_REQUEST['orderby'])) { |
|
105 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
106 | 106 | } |
107 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
108 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
107 | + if ( ! empty($_REQUEST['order'])) { |
|
108 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
109 | 109 | } |
110 | 110 | ?> |
111 | 111 | <p class="search-box donor-search"> |
112 | 112 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
113 | 113 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
114 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
114 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
115 | 115 | </p> |
116 | 116 | <?php |
117 | 117 | } |
@@ -124,29 +124,29 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $which |
126 | 126 | */ |
127 | - protected function display_tablenav( $which ) { |
|
127 | + protected function display_tablenav($which) { |
|
128 | 128 | |
129 | - if ( 'top' == $which ) { |
|
130 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
129 | + if ('top' == $which) { |
|
130 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
131 | 131 | } |
132 | 132 | ?> |
133 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
133 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
134 | 134 | |
135 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Donors Report', 'give' ); ?></span></h3> |
|
135 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Donors Report', 'give'); ?></span></h3> |
|
136 | 136 | |
137 | 137 | <div class="alignright tablenav-right"> |
138 | 138 | <div class="actions bulkactions"> |
139 | 139 | <?php |
140 | - if ( 'top' == $which ) { |
|
141 | - $this->give_search_box( __( 'Search Donors', 'give' ), 'give-donors-report-search' ); |
|
140 | + if ('top' == $which) { |
|
141 | + $this->give_search_box(__('Search Donors', 'give'), 'give-donors-report-search'); |
|
142 | 142 | } |
143 | 143 | |
144 | - $this->bulk_actions( $which ); ?> |
|
144 | + $this->bulk_actions($which); ?> |
|
145 | 145 | |
146 | 146 | </div> |
147 | 147 | <?php |
148 | - $this->extra_tablenav( $which ); |
|
149 | - $this->pagination( $which ); |
|
148 | + $this->extra_tablenav($which); |
|
149 | + $this->pagination($which); |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | |
@@ -168,25 +168,25 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @return string Column Name |
170 | 170 | */ |
171 | - public function column_default( $item, $column_name ) { |
|
172 | - switch ( $column_name ) { |
|
171 | + public function column_default($item, $column_name) { |
|
172 | + switch ($column_name) { |
|
173 | 173 | |
174 | 174 | case 'num_purchases' : |
175 | - $value = '<a href="' . |
|
176 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
177 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
175 | + $value = '<a href="'. |
|
176 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
177 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
178 | 178 | break; |
179 | 179 | |
180 | 180 | case 'amount_spent' : |
181 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
181 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
182 | 182 | break; |
183 | 183 | |
184 | 184 | default: |
185 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
185 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
186 | 186 | break; |
187 | 187 | } |
188 | 188 | |
189 | - return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] ); |
|
189 | + return apply_filters('give_report_column_'.$column_name, $value, $item['id']); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function get_columns() { |
200 | 200 | $columns = array( |
201 | - 'name' => __( 'Name', 'give' ), |
|
202 | - 'id' => __( 'ID', 'give' ), |
|
203 | - 'email' => __( 'Email', 'give' ), |
|
204 | - 'num_purchases' => __( 'Purchases', 'give' ), |
|
205 | - 'amount_spent' => __( 'Total Spent', 'give' ) |
|
201 | + 'name' => __('Name', 'give'), |
|
202 | + 'id' => __('ID', 'give'), |
|
203 | + 'email' => __('Email', 'give'), |
|
204 | + 'num_purchases' => __('Purchases', 'give'), |
|
205 | + 'amount_spent' => __('Total Spent', 'give') |
|
206 | 206 | ); |
207 | 207 | |
208 | - return apply_filters( 'give_report_donor_columns', $columns ); |
|
208 | + return apply_filters('give_report_donor_columns', $columns); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function get_sortable_columns() { |
220 | 220 | return array( |
221 | - 'id' => array( 'id', true ), |
|
222 | - 'name' => array( 'name', true ), |
|
223 | - 'num_purchases' => array( 'purchase_count', false ), |
|
224 | - 'amount_spent' => array( 'purchase_value', false ), |
|
221 | + 'id' => array('id', true), |
|
222 | + 'name' => array('name', true), |
|
223 | + 'num_purchases' => array('purchase_count', false), |
|
224 | + 'amount_spent' => array('purchase_value', false), |
|
225 | 225 | ); |
226 | 226 | } |
227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @since 1.0 |
233 | 233 | * @return void |
234 | 234 | */ |
235 | - public function bulk_actions( $which = '' ) { |
|
235 | + public function bulk_actions($which = '') { |
|
236 | 236 | // These aren't really bulk actions but this outputs the markup in the right place |
237 | 237 | give_report_views(); |
238 | 238 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return int Current page number |
246 | 246 | */ |
247 | 247 | public function get_paged() { |
248 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
248 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return mixed string If search is present, false otherwise |
257 | 257 | */ |
258 | 258 | public function get_search() { |
259 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
259 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | |
274 | 274 | $data = array(); |
275 | 275 | $paged = $this->get_paged(); |
276 | - $offset = $this->per_page * ( $paged - 1 ); |
|
276 | + $offset = $this->per_page * ($paged - 1); |
|
277 | 277 | $search = $this->get_search(); |
278 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
279 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
278 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
279 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
280 | 280 | |
281 | 281 | $args = array( |
282 | 282 | 'number' => $this->per_page, |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | 'orderby' => $orderby |
286 | 286 | ); |
287 | 287 | |
288 | - if ( is_email( $search ) ) { |
|
288 | + if (is_email($search)) { |
|
289 | 289 | $args['email'] = $search; |
290 | - } elseif ( is_numeric( $search ) ) { |
|
290 | + } elseif (is_numeric($search)) { |
|
291 | 291 | $args['id'] = $search; |
292 | 292 | } |
293 | 293 | |
294 | - $donors = Give()->customers->get_customers( $args ); |
|
294 | + $donors = Give()->customers->get_customers($args); |
|
295 | 295 | |
296 | - if ( $donors ) { |
|
296 | + if ($donors) { |
|
297 | 297 | |
298 | - $this->count = count( $donors ); |
|
298 | + $this->count = count($donors); |
|
299 | 299 | |
300 | - foreach ( $donors as $donor ) { |
|
300 | + foreach ($donors as $donor) { |
|
301 | 301 | |
302 | - $user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0; |
|
302 | + $user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0; |
|
303 | 303 | |
304 | 304 | $data[] = array( |
305 | 305 | 'id' => $donor->id, |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | $hidden = array(); // No hidden columns |
333 | 333 | $sortable = $this->get_sortable_columns(); |
334 | 334 | |
335 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
335 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
336 | 336 | |
337 | 337 | $this->items = $this->reports_data(); |
338 | 338 | |
339 | 339 | $this->total = give_count_total_customers(); |
340 | 340 | |
341 | - $this->set_pagination_args( array( |
|
341 | + $this->set_pagination_args(array( |
|
342 | 342 | 'total_items' => $this->total, |
343 | 343 | 'per_page' => $this->per_page, |
344 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
345 | - ) ); |
|
344 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
345 | + )); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return bool Whether we can export or not |
38 | 38 | */ |
39 | 39 | public function can_export() { |
40 | - return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) ); |
|
40 | + return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | public function headers() { |
51 | - ignore_user_abort( true ); |
|
51 | + ignore_user_abort(true); |
|
52 | 52 | |
53 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
54 | - set_time_limit( 0 ); |
|
53 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
54 | + set_time_limit(0); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | nocache_headers(); |
58 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
59 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
60 | - header( "Expires: 0" ); |
|
58 | + header('Content-Type: text/csv; charset=utf-8'); |
|
59 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
60 | + header("Expires: 0"); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function csv_cols() { |
71 | 71 | $cols = array( |
72 | - 'id' => __( 'ID', 'give' ), |
|
73 | - 'date' => __( 'Date', 'give' ) |
|
72 | + 'id' => __('ID', 'give'), |
|
73 | + 'date' => __('Date', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | return $cols; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function get_csv_cols() { |
87 | 87 | $cols = $this->csv_cols(); |
88 | 88 | |
89 | - return apply_filters( 'give_export_csv_cols_' . $this->export_type, $cols ); |
|
89 | + return apply_filters('give_export_csv_cols_'.$this->export_type, $cols); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | public function csv_cols_out() { |
101 | 101 | $cols = $this->get_csv_cols(); |
102 | 102 | $i = 1; |
103 | - foreach ( $cols as $col_id => $column ) { |
|
104 | - echo '"' . addslashes( $column ) . '"'; |
|
105 | - echo $i == count( $cols ) ? '' : ','; |
|
106 | - $i ++; |
|
103 | + foreach ($cols as $col_id => $column) { |
|
104 | + echo '"'.addslashes($column).'"'; |
|
105 | + echo $i == count($cols) ? '' : ','; |
|
106 | + $i++; |
|
107 | 107 | } |
108 | 108 | echo "\r\n"; |
109 | 109 | } |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | $data = array( |
121 | 121 | 0 => array( |
122 | 122 | 'id' => '', |
123 | - 'data' => date( 'F j, Y' ) |
|
123 | + 'data' => date('F j, Y') |
|
124 | 124 | ), |
125 | 125 | 1 => array( |
126 | 126 | 'id' => '', |
127 | - 'data' => date( 'F j, Y' ) |
|
127 | + 'data' => date('F j, Y') |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | |
131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
132 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
131 | + $data = apply_filters('give_export_get_data', $data); |
|
132 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
133 | 133 | |
134 | 134 | return $data; |
135 | 135 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | $cols = $this->get_csv_cols(); |
148 | 148 | |
149 | 149 | // Output each row |
150 | - foreach ( $data as $row ) { |
|
150 | + foreach ($data as $row) { |
|
151 | 151 | $i = 1; |
152 | - foreach ( $row as $col_id => $column ) { |
|
152 | + foreach ($row as $col_id => $column) { |
|
153 | 153 | // Make sure the column is valid |
154 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
155 | - echo '"' . addslashes( $column ) . '"'; |
|
156 | - echo $i == count( $cols ) ? '' : ','; |
|
157 | - $i ++; |
|
154 | + if (array_key_exists($col_id, $cols)) { |
|
155 | + echo '"'.addslashes($column).'"'; |
|
156 | + echo $i == count($cols) ? '' : ','; |
|
157 | + $i++; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | echo "\r\n"; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function export() { |
176 | - if ( ! $this->can_export() ) { |
|
177 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
176 | + if ( ! $this->can_export()) { |
|
177 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // Set headers |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @since 1.0 |
80 | 80 | */ |
81 | - public function __construct( $_data ) { |
|
81 | + public function __construct($_data) { |
|
82 | 82 | |
83 | 83 | $this->data = $_data; |
84 | 84 | |
85 | 85 | // Generate unique ID |
86 | - $this->id = md5( rand() ); |
|
86 | + $this->id = md5(rand()); |
|
87 | 87 | |
88 | 88 | // Setup default options; |
89 | - $this->options = apply_filters( 'give_graph_args', array( |
|
89 | + $this->options = apply_filters('give_graph_args', array( |
|
90 | 90 | 'y_mode' => null, |
91 | 91 | 'x_mode' => null, |
92 | 92 | 'y_decimals' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'bars' => true, |
104 | 104 | 'lines' => false, |
105 | 105 | 'points' => true |
106 | - ) ); |
|
106 | + )); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @since 1.0 |
117 | 117 | */ |
118 | - public function set( $key, $value ) { |
|
119 | - $this->options[ $key ] = $value; |
|
118 | + public function set($key, $value) { |
|
119 | + $this->options[$key] = $value; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | - public function get( $key ) { |
|
130 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
129 | + public function get($key) { |
|
130 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @since 1.0 |
137 | 137 | */ |
138 | 138 | public function get_data() { |
139 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
139 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function load_scripts() { |
148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off |
149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
149 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
150 | 150 | |
151 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
152 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
151 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
152 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
153 | 153 | |
154 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
155 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
154 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
155 | + wp_enqueue_script('jquery-flot-time'); |
|
156 | 156 | |
157 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
158 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
157 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
158 | + wp_enqueue_script('jquery-flot-resize'); |
|
159 | 159 | |
160 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
161 | - wp_enqueue_script( 'jquery-flot' ); |
|
160 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
161 | + wp_enqueue_script('jquery-flot'); |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | [ |
186 | 186 | <?php |
187 | 187 | $order = 0; |
188 | - foreach( $this->get_data() as $label => $data ) : |
|
188 | + foreach ($this->get_data() as $label => $data) : |
|
189 | 189 | ?> |
190 | 190 | { |
191 | - label : "<?php echo esc_attr( $label ); ?>", |
|
192 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
191 | + label : "<?php echo esc_attr($label); ?>", |
|
192 | + id : "<?php echo sanitize_key($label); ?>", |
|
193 | 193 | // data format is: [ point on x, value on y ] |
194 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
194 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
195 | 195 | points: { |
196 | 196 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
197 | 197 | }, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | fill : true, |
207 | 207 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
208 | 208 | }, |
209 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
209 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
210 | 210 | yaxis : <?php echo $yaxis_count; ?> |
211 | 211 | <?php endif; ?> |
212 | 212 | |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | grid: { |
221 | 221 | show : true, |
222 | 222 | aboveData : false, |
223 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
224 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
225 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
226 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
223 | + color : "<?php echo $this->options['color']; ?>", |
|
224 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
225 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
226 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
227 | 227 | clickable : false, |
228 | 228 | hoverable : true |
229 | 229 | }, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | mode : "<?php echo $this->options['x_mode']; ?>", |
235 | 235 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
236 | 236 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
237 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
237 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
238 | 238 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
239 | 239 | <?php endif; ?> |
240 | 240 | }, |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | min : 0, |
244 | 244 | mode : "<?php echo $this->options['y_mode']; ?>", |
245 | 245 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
246 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
246 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
247 | 247 | tickDecimals: <?php echo $this->options['y_decimals']; ?> |
248 | 248 | <?php endif; ?> |
249 | 249 | } |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | * @since 1.0 |
304 | 304 | */ |
305 | 305 | public function display() { |
306 | - do_action( 'give_before_graph', $this ); |
|
306 | + do_action('give_before_graph', $this); |
|
307 | 307 | echo $this->build_graph(); |
308 | - do_action( 'give_after_graph', $this ); |
|
308 | + do_action('give_after_graph', $this); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 1.3.0 |
12 | 12 | */ |
13 | 13 | |
14 | -defined( 'ABSPATH' ) or exit; |
|
14 | +defined('ABSPATH') or exit; |
|
15 | 15 | |
16 | 16 | final class Give_Shortcode_Button { |
17 | 17 | |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | |
30 | - if ( is_admin() ) { |
|
31 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); |
|
30 | + if (is_admin()) { |
|
31 | + add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); |
|
32 | 32 | |
33 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); |
|
34 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); |
|
35 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); |
|
33 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); |
|
34 | + add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); |
|
35 | + add_action('media_buttons', array($this, 'shortcode_button')); |
|
36 | 36 | } |
37 | 37 | |
38 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
39 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
38 | + add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); |
|
39 | + add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @since 1.0 |
50 | 50 | */ |
51 | - public function mce_external_plugins( $plugin_array ) { |
|
51 | + public function mce_external_plugins($plugin_array) { |
|
52 | 52 | |
53 | - if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) { |
|
53 | + if (current_user_can('edit_posts') && current_user_can('edit_pages')) { |
|
54 | 54 | |
55 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
55 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
56 | 56 | |
57 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js'; |
|
57 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $plugin_array; |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function admin_enqueue_assets() { |
71 | 71 | |
72 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
72 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
73 | 73 | |
74 | 74 | wp_enqueue_script( |
75 | 75 | 'give_shortcode', |
76 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js', |
|
77 | - array( 'jquery' ), |
|
76 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js', |
|
77 | + array('jquery'), |
|
78 | 78 | GIVE_VERSION, |
79 | 79 | true |
80 | 80 | ); |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function admin_localize_scripts() { |
91 | 91 | |
92 | - if ( ! empty( self::$shortcodes ) ) { |
|
92 | + if ( ! empty(self::$shortcodes)) { |
|
93 | 93 | |
94 | 94 | $variables = array(); |
95 | 95 | |
96 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
97 | - if ( ! empty( $values['required'] ) ) { |
|
98 | - $variables[ $shortcode ] = $values['required']; |
|
96 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
97 | + if ( ! empty($values['required'])) { |
|
98 | + $variables[$shortcode] = $values['required']; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); |
|
102 | + wp_localize_script('give_shortcode', 'scShortcodes', $variables); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -114,24 +114,24 @@ discard block |
||
114 | 114 | |
115 | 115 | global $pagenow, $wp_version; |
116 | 116 | |
117 | - $shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ); |
|
117 | + $shortcode_button_pages = array('post.php', 'page.php', 'post-new.php', 'post-edit.php'); |
|
118 | 118 | // Only run in admin post/page creation and edit screens |
119 | - if ( in_array( $pagenow, $shortcode_button_pages ) |
|
120 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
121 | - && ! empty( self::$shortcodes ) |
|
119 | + if (in_array($pagenow, $shortcode_button_pages) |
|
120 | + && apply_filters('give_shortcode_button_condition', true) |
|
121 | + && ! empty(self::$shortcodes) |
|
122 | 122 | ) { |
123 | 123 | |
124 | 124 | $shortcodes = array(); |
125 | 125 | |
126 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
126 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
127 | 127 | /** |
128 | 128 | * Filters the condition for including the current shortcode |
129 | 129 | * |
130 | 130 | * @since 1.0 |
131 | 131 | */ |
132 | - if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { |
|
132 | + if (apply_filters(sanitize_title($shortcode).'_condition', true)) { |
|
133 | 133 | |
134 | - $shortcodes[ $shortcode ] = sprintf( |
|
134 | + $shortcodes[$shortcode] = sprintf( |
|
135 | 135 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>', |
136 | 136 | $shortcode, |
137 | 137 | $values['label'], |
@@ -140,37 +140,37 @@ discard block |
||
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | - if ( ! empty( $shortcodes ) ) { |
|
143 | + if ( ! empty($shortcodes)) { |
|
144 | 144 | |
145 | 145 | // check current WP version |
146 | - $img = ( version_compare( $wp_version, '3.5', '<' ) ) |
|
147 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />' |
|
148 | - : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; |
|
146 | + $img = (version_compare($wp_version, '3.5', '<')) |
|
147 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />' |
|
148 | + : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; |
|
149 | 149 | |
150 | - reset( $shortcodes ); |
|
150 | + reset($shortcodes); |
|
151 | 151 | |
152 | - if ( count( $shortcodes ) == 1 ) { |
|
152 | + if (count($shortcodes) == 1) { |
|
153 | 153 | |
154 | - $shortcode = key( $shortcodes ); |
|
154 | + $shortcode = key($shortcodes); |
|
155 | 155 | |
156 | 156 | printf( |
157 | 157 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>', |
158 | 158 | $shortcode, |
159 | - sprintf( '%s %s %s', |
|
159 | + sprintf('%s %s %s', |
|
160 | 160 | $img, |
161 | - __( 'Insert', 'give' ), |
|
162 | - self::$shortcodes[ $shortcode ]['label'] |
|
161 | + __('Insert', 'give'), |
|
162 | + self::$shortcodes[$shortcode]['label'] |
|
163 | 163 | ) |
164 | 164 | ); |
165 | 165 | } else { |
166 | 166 | printf( |
167 | - '<div class="sc-wrap">' . |
|
168 | - '<button class="button sc-button">%s %s</button>' . |
|
169 | - '<div class="sc-menu mce-menu">%s</div>' . |
|
167 | + '<div class="sc-wrap">'. |
|
168 | + '<button class="button sc-button">%s %s</button>'. |
|
169 | + '<div class="sc-menu mce-menu">%s</div>'. |
|
170 | 170 | '</div>', |
171 | 171 | $img, |
172 | - __( 'Give Shortcodes', 'give' ), |
|
173 | - implode( '', array_values( $shortcodes ) ) |
|
172 | + __('Give Shortcodes', 'give'), |
|
173 | + implode('', array_values($shortcodes)) |
|
174 | 174 | ); |
175 | 175 | } |
176 | 176 | } |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function shortcode_ajax() { |
188 | 188 | |
189 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; |
|
189 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; |
|
190 | 190 | $response = false; |
191 | 191 | |
192 | - if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { |
|
192 | + if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { |
|
193 | 193 | |
194 | - $data = self::$shortcodes[ $shortcode ]; |
|
194 | + $data = self::$shortcodes[$shortcode]; |
|
195 | 195 | |
196 | - if ( ! empty( $data['errors'] ) ) { |
|
197 | - $data['btn_okay'] = array( __( 'Okay', 'give' ) ); |
|
196 | + if ( ! empty($data['errors'])) { |
|
197 | + $data['btn_okay'] = array(__('Okay', 'give')); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $response = array( |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | ); |
207 | 207 | } else { |
208 | 208 | // todo: handle error |
209 | - error_log( print_r( 'AJAX error!', 1 ) ); |
|
209 | + error_log(print_r('AJAX error!', 1)); |
|
210 | 210 | } |
211 | 211 | |
212 | - wp_send_json( $response ); |
|
212 | + wp_send_json($response); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 |