@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Donors' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Donors')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Donors. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'donors'; |
46 | - $this->label = esc_html__( 'Donors', 'give' ); |
|
46 | + $this->label = esc_html__('Donors', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_report_donors', array( $this, 'render_report_donors_field' ), 10, 2 ); |
|
48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_report_donors', array($this, 'render_report_donors_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | // Do not use main donor for this tab. |
53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $pages Lst of pages. |
64 | 64 | * @return array |
65 | 65 | */ |
66 | - public function add_settings_page( $pages ) { |
|
67 | - $pages[ $this->id ] = $this->label; |
|
66 | + public function add_settings_page($pages) { |
|
67 | + $pages[$this->id] = $this->label; |
|
68 | 68 | |
69 | 69 | return $pages; |
70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $settings |
87 | 87 | */ |
88 | 88 | $settings = apply_filters( |
89 | - 'give_get_settings_' . $this->id, |
|
89 | + 'give_get_settings_'.$this->id, |
|
90 | 90 | array( |
91 | 91 | array( |
92 | 92 | 'id' => 'give_reports_donors', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'donors', |
98 | - 'name' => esc_html__( 'Donors', 'give' ), |
|
98 | + 'name' => esc_html__('Donors', 'give'), |
|
99 | 99 | 'type' => 'report_donors', |
100 | 100 | ), |
101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function output() { |
120 | 120 | $settings = $this->get_settings(); |
121 | 121 | |
122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param $field |
132 | 132 | * @param $option_value |
133 | 133 | */ |
134 | - public function render_report_donors_field( $field, $option_value ) { |
|
135 | - do_action( 'give_reports_view_donors'); |
|
134 | + public function render_report_donors_field($field, $option_value) { |
|
135 | + do_action('give_reports_view_donors'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Forms' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Forms')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Forms. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'forms'; |
46 | - $this->label = esc_html__( 'Forms', 'give' ); |
|
46 | + $this->label = esc_html__('Forms', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_report_forms', array( $this, 'render_report_forms_field' ), 10, 2 ); |
|
48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_report_forms', array($this, 'render_report_forms_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $pages Lst of pages. |
64 | 64 | * @return array |
65 | 65 | */ |
66 | - public function add_settings_page( $pages ) { |
|
67 | - $pages[ $this->id ] = $this->label; |
|
66 | + public function add_settings_page($pages) { |
|
67 | + $pages[$this->id] = $this->label; |
|
68 | 68 | |
69 | 69 | return $pages; |
70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $settings |
87 | 87 | */ |
88 | 88 | $settings = apply_filters( |
89 | - 'give_get_settings_' . $this->id, |
|
89 | + 'give_get_settings_'.$this->id, |
|
90 | 90 | array( |
91 | 91 | array( |
92 | 92 | 'id' => 'give_reports_forms', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'forms', |
98 | - 'name' => esc_html__( 'Forms', 'give' ), |
|
98 | + 'name' => esc_html__('Forms', 'give'), |
|
99 | 99 | 'type' => 'report_forms', |
100 | 100 | ), |
101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function output() { |
120 | 120 | $settings = $this->get_settings(); |
121 | 121 | |
122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param $field |
132 | 132 | * @param $option_value |
133 | 133 | */ |
134 | - public function render_report_forms_field( $field, $option_value ) { |
|
135 | - do_action( 'give_reports_view_forms'); |
|
134 | + public function render_report_forms_field($field, $option_value) { |
|
135 | + do_action('give_reports_view_forms'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -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 | |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | * @param $_step int The step to process |
107 | 107 | * @since 1.5 |
108 | 108 | */ |
109 | - public function __construct( $_step = 1 ) { |
|
109 | + public function __construct($_step = 1) { |
|
110 | 110 | |
111 | 111 | $upload_dir = wp_upload_dir(); |
112 | 112 | $this->filetype = '.csv'; |
113 | - $this->filename = 'give-' . $this->export_type . $this->filetype; |
|
114 | - $this->file = trailingslashit( $upload_dir['basedir'] ) . $this->filename; |
|
113 | + $this->filename = 'give-'.$this->export_type.$this->filetype; |
|
114 | + $this->file = trailingslashit($upload_dir['basedir']).$this->filename; |
|
115 | 115 | |
116 | - if ( ! is_writeable( $upload_dir['basedir'] ) ) { |
|
116 | + if ( ! is_writeable($upload_dir['basedir'])) { |
|
117 | 117 | $this->is_writable = false; |
118 | 118 | } |
119 | 119 | |
@@ -129,20 +129,20 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function process_step() { |
131 | 131 | |
132 | - if ( ! $this->can_export() ) { |
|
133 | - wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
132 | + if ( ! $this->can_export()) { |
|
133 | + wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
134 | 134 | } |
135 | 135 | |
136 | - if( $this->step < 2 ) { |
|
136 | + if ($this->step < 2) { |
|
137 | 137 | |
138 | 138 | // Make sure we start with a fresh file on step 1 |
139 | - @unlink( $this->file ); |
|
139 | + @unlink($this->file); |
|
140 | 140 | $this->print_csv_cols(); |
141 | 141 | } |
142 | 142 | |
143 | 143 | $rows = $this->print_csv_rows(); |
144 | 144 | |
145 | - if( $rows ) { |
|
145 | + if ($rows) { |
|
146 | 146 | return true; |
147 | 147 | } else { |
148 | 148 | return false; |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | $col_data = ''; |
163 | 163 | $cols = $this->get_csv_cols(); |
164 | 164 | $i = 1; |
165 | - foreach( $cols as $col_id => $column ) { |
|
166 | - $col_data .= '"' . addslashes( $column ) . '"'; |
|
167 | - $col_data .= $i == count( $cols ) ? '' : ','; |
|
165 | + foreach ($cols as $col_id => $column) { |
|
166 | + $col_data .= '"'.addslashes($column).'"'; |
|
167 | + $col_data .= $i == count($cols) ? '' : ','; |
|
168 | 168 | $i++; |
169 | 169 | } |
170 | 170 | $col_data .= "\r\n"; |
171 | 171 | |
172 | - $this->stash_step_data( $col_data ); |
|
172 | + $this->stash_step_data($col_data); |
|
173 | 173 | |
174 | 174 | return $col_data; |
175 | 175 | |
@@ -188,23 +188,23 @@ discard block |
||
188 | 188 | $data = $this->get_data(); |
189 | 189 | $cols = $this->get_csv_cols(); |
190 | 190 | |
191 | - if( $data ) { |
|
191 | + if ($data) { |
|
192 | 192 | |
193 | 193 | // Output each row |
194 | - foreach ( $data as $row ) { |
|
194 | + foreach ($data as $row) { |
|
195 | 195 | $i = 1; |
196 | - foreach ( $row as $col_id => $column ) { |
|
196 | + foreach ($row as $col_id => $column) { |
|
197 | 197 | // Make sure the column is valid |
198 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
199 | - $row_data .= '"' . addslashes( preg_replace( "/\"/","'", $column ) ) . '"'; |
|
200 | - $row_data .= $i == count( $cols ) ? '' : ','; |
|
198 | + if (array_key_exists($col_id, $cols)) { |
|
199 | + $row_data .= '"'.addslashes(preg_replace("/\"/", "'", $column)).'"'; |
|
200 | + $row_data .= $i == count($cols) ? '' : ','; |
|
201 | 201 | $i++; |
202 | 202 | } |
203 | 203 | } |
204 | 204 | $row_data .= "\r\n"; |
205 | 205 | } |
206 | 206 | |
207 | - $this->stash_step_data( $row_data ); |
|
207 | + $this->stash_step_data($row_data); |
|
208 | 208 | |
209 | 209 | return $row_data; |
210 | 210 | } |
@@ -232,18 +232,18 @@ discard block |
||
232 | 232 | |
233 | 233 | $file = ''; |
234 | 234 | |
235 | - if ( @file_exists( $this->file ) ) { |
|
235 | + if (@file_exists($this->file)) { |
|
236 | 236 | |
237 | - if ( ! is_writeable( $this->file ) ) { |
|
237 | + if ( ! is_writeable($this->file)) { |
|
238 | 238 | $this->is_writable = false; |
239 | 239 | } |
240 | 240 | |
241 | - $file = @file_get_contents( $this->file ); |
|
241 | + $file = @file_get_contents($this->file); |
|
242 | 242 | |
243 | 243 | } else { |
244 | 244 | |
245 | - @file_put_contents( $this->file, '' ); |
|
246 | - @chmod( $this->file, 0664 ); |
|
245 | + @file_put_contents($this->file, ''); |
|
246 | + @chmod($this->file, 0664); |
|
247 | 247 | |
248 | 248 | } |
249 | 249 | |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | * @param $data string The data to add to the file |
258 | 258 | * @return void |
259 | 259 | */ |
260 | - protected function stash_step_data( $data = '' ) { |
|
260 | + protected function stash_step_data($data = '') { |
|
261 | 261 | |
262 | 262 | $file = $this->get_file(); |
263 | 263 | $file .= $data; |
264 | - @file_put_contents( $this->file, $file ); |
|
264 | + @file_put_contents($this->file, $file); |
|
265 | 265 | |
266 | 266 | // If we have no rows after this step, mark it as an empty export |
267 | - $file_rows = file( $this->file, FILE_SKIP_EMPTY_LINES); |
|
267 | + $file_rows = file($this->file, FILE_SKIP_EMPTY_LINES); |
|
268 | 268 | $default_cols = $this->get_csv_cols(); |
269 | - $default_cols = empty( $default_cols ) ? 0 : 1; |
|
269 | + $default_cols = empty($default_cols) ? 0 : 1; |
|
270 | 270 | |
271 | - $this->is_empty = count( $file_rows ) == $default_cols ? true : false; |
|
271 | + $this->is_empty = count($file_rows) == $default_cols ? true : false; |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | $file = $this->get_file(); |
288 | 288 | |
289 | - @unlink( $this->file ); |
|
289 | + @unlink($this->file); |
|
290 | 290 | |
291 | 291 | echo $file; |
292 | 292 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @since 1.8 |
297 | 297 | */ |
298 | - do_action( 'give_file_export_complete', $_REQUEST ); |
|
298 | + do_action('give_file_export_complete', $_REQUEST); |
|
299 | 299 | |
300 | 300 | give_die(); |
301 | 301 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @since 1.5 |
307 | 307 | * @param array $request The Form Data passed into the batch processing |
308 | 308 | */ |
309 | - public function set_properties( $request ) {} |
|
309 | + public function set_properties($request) {} |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Allow for prefetching of data for the remainder of the exporter |
@@ -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 | |
@@ -62,26 +62,26 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param array $request The Form Data passed into the batch processing |
64 | 64 | */ |
65 | - public function set_properties( $request ) { |
|
65 | + public function set_properties($request) { |
|
66 | 66 | |
67 | 67 | // Set data from form submission |
68 | - if ( isset( $_POST['form'] ) ) { |
|
69 | - parse_str( $_POST['form'], $this->data ); |
|
68 | + if (isset($_POST['form'])) { |
|
69 | + parse_str($_POST['form'], $this->data); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $this->form = $this->data['forms']; |
73 | 73 | |
74 | 74 | // Setup donor ids cache. |
75 | - if( ! empty( $this->form ) ) { |
|
75 | + if ( ! empty($this->form)) { |
|
76 | 76 | // Cache donor ids to output unique list of donor. |
77 | - $this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] ); |
|
78 | - if( ! ( $this->donor_ids = get_transient( $this->query_id ) ) ) { |
|
77 | + $this->query_id = give_clean($_REQUEST['give_export_option']['query_id']); |
|
78 | + if ( ! ($this->donor_ids = get_transient($this->query_id))) { |
|
79 | 79 | $this->donor_ids = array(); |
80 | - set_transient( $this->query_id, $this->donor_ids, HOUR_IN_SECONDS ); |
|
80 | + set_transient($this->query_id, $this->donor_ids, HOUR_IN_SECONDS); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - $this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
84 | + $this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | |
97 | 97 | $cols = array(); |
98 | 98 | |
99 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
99 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
100 | 100 | |
101 | 101 | // We need columns. |
102 | - if ( empty( $columns ) ) { |
|
102 | + if (empty($columns)) { |
|
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | |
106 | - $cols = $this->get_cols( $columns ); |
|
106 | + $cols = $this->get_cols($columns); |
|
107 | 107 | |
108 | 108 | return $cols; |
109 | 109 | } |
@@ -115,38 +115,38 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return array |
117 | 117 | */ |
118 | - private function get_cols( $columns ) { |
|
118 | + private function get_cols($columns) { |
|
119 | 119 | |
120 | 120 | $cols = array(); |
121 | 121 | |
122 | - foreach ( $columns as $key => $value ) { |
|
122 | + foreach ($columns as $key => $value) { |
|
123 | 123 | |
124 | - switch ( $key ) { |
|
124 | + switch ($key) { |
|
125 | 125 | case 'full_name' : |
126 | - $cols['full_name'] = esc_html__( 'Full Name', 'give' ); |
|
126 | + $cols['full_name'] = esc_html__('Full Name', 'give'); |
|
127 | 127 | break; |
128 | 128 | case 'email' : |
129 | - $cols['email'] = esc_html__( 'Email Address', 'give' ); |
|
129 | + $cols['email'] = esc_html__('Email Address', 'give'); |
|
130 | 130 | break; |
131 | 131 | case 'address' : |
132 | - $cols['address_line1'] = esc_html__( 'Address', 'give' ); |
|
133 | - $cols['address_line2'] = esc_html__( 'Address 2', 'give' ); |
|
134 | - $cols['address_city'] = esc_html__( 'City', 'give' ); |
|
135 | - $cols['address_state'] = esc_html__( 'State', 'give' ); |
|
136 | - $cols['address_zip'] = esc_html__( 'Zip', 'give' ); |
|
137 | - $cols['address_country'] = esc_html__( 'Country', 'give' ); |
|
132 | + $cols['address_line1'] = esc_html__('Address', 'give'); |
|
133 | + $cols['address_line2'] = esc_html__('Address 2', 'give'); |
|
134 | + $cols['address_city'] = esc_html__('City', 'give'); |
|
135 | + $cols['address_state'] = esc_html__('State', 'give'); |
|
136 | + $cols['address_zip'] = esc_html__('Zip', 'give'); |
|
137 | + $cols['address_country'] = esc_html__('Country', 'give'); |
|
138 | 138 | break; |
139 | 139 | case 'userid' : |
140 | - $cols['userid'] = esc_html__( 'User ID', 'give' ); |
|
140 | + $cols['userid'] = esc_html__('User ID', 'give'); |
|
141 | 141 | break; |
142 | 142 | case 'date_first_donated' : |
143 | - $cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' ); |
|
143 | + $cols['date_first_donated'] = esc_html__('First Donation Date', 'give'); |
|
144 | 144 | break; |
145 | 145 | case 'donations' : |
146 | - $cols['donations'] = esc_html__( 'Number of Donations', 'give' ); |
|
146 | + $cols['donations'] = esc_html__('Number of Donations', 'give'); |
|
147 | 147 | break; |
148 | 148 | case 'donation_sum' : |
149 | - $cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' ); |
|
149 | + $cols['donation_sum'] = esc_html__('Sum of Donations', 'give'); |
|
150 | 150 | break; |
151 | 151 | } |
152 | 152 | } |
@@ -169,20 +169,20 @@ discard block |
||
169 | 169 | |
170 | 170 | $i = 0; |
171 | 171 | |
172 | - if ( ! empty( $this->form ) ) { |
|
172 | + if ( ! empty($this->form)) { |
|
173 | 173 | |
174 | 174 | // Export donors of a specific product |
175 | 175 | global $give_logs; |
176 | 176 | |
177 | 177 | $args = array( |
178 | - 'post_parent' => absint( $this->form ), |
|
178 | + 'post_parent' => absint($this->form), |
|
179 | 179 | 'log_type' => 'sale', |
180 | 180 | 'posts_per_page' => 30, |
181 | 181 | 'paged' => $this->step, |
182 | 182 | ); |
183 | 183 | |
184 | 184 | // Check for price option |
185 | - if ( null !== $this->price_id ) { |
|
185 | + if (null !== $this->price_id) { |
|
186 | 186 | $args['meta_query'] = array( |
187 | 187 | array( |
188 | 188 | 'key' => '_give_log_price_id', |
@@ -191,44 +191,44 @@ discard block |
||
191 | 191 | ); |
192 | 192 | } |
193 | 193 | |
194 | - $logs = $give_logs->get_connected_logs( $args ); |
|
194 | + $logs = $give_logs->get_connected_logs($args); |
|
195 | 195 | |
196 | - if ( $logs ) { |
|
197 | - foreach ( $logs as $log ) { |
|
198 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
199 | - $payment = new Give_Payment( $payment_id ); |
|
196 | + if ($logs) { |
|
197 | + foreach ($logs as $log) { |
|
198 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
199 | + $payment = new Give_Payment($payment_id); |
|
200 | 200 | |
201 | 201 | // Continue if donor already included. |
202 | - if( in_array( $payment->customer_id , $this->donor_ids ) ) { |
|
202 | + if (in_array($payment->customer_id, $this->donor_ids)) { |
|
203 | 203 | continue; |
204 | 204 | } |
205 | 205 | |
206 | 206 | $this->donor_ids[] = $payment->customer_id; |
207 | 207 | |
208 | - $donor = Give()->customers->get_customer_by( 'id', $payment->customer_id ); |
|
209 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
210 | - $i ++; |
|
208 | + $donor = Give()->customers->get_customer_by('id', $payment->customer_id); |
|
209 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
210 | + $i++; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | // Cache donor ids only if admin export donor for specific form. |
214 | - set_transient( $this->query_id, array_unique( $this->donor_ids ), HOUR_IN_SECONDS ); |
|
214 | + set_transient($this->query_id, array_unique($this->donor_ids), HOUR_IN_SECONDS); |
|
215 | 215 | } |
216 | 216 | } else { |
217 | 217 | |
218 | 218 | // Export all customers |
219 | - $offset = 30 * ( $this->step - 1 ); |
|
220 | - $donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
219 | + $offset = 30 * ($this->step - 1); |
|
220 | + $donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
221 | 221 | |
222 | - foreach ( $donors as $donor ) { |
|
222 | + foreach ($donors as $donor) { |
|
223 | 223 | |
224 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
225 | - $i ++; |
|
224 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
225 | + $i++; |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | 229 | |
230 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
231 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
230 | + $data = apply_filters('give_export_get_data', $data); |
|
231 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
232 | 232 | |
233 | 233 | return $data; |
234 | 234 | } |
@@ -244,18 +244,18 @@ discard block |
||
244 | 244 | $percentage = 0; |
245 | 245 | |
246 | 246 | // We can't count the number when getting them for a specific form |
247 | - if ( empty( $this->form ) ) { |
|
247 | + if (empty($this->form)) { |
|
248 | 248 | |
249 | 249 | $total = Give()->customers->count(); |
250 | 250 | |
251 | - if ( $total > 0 ) { |
|
251 | + if ($total > 0) { |
|
252 | 252 | |
253 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
253 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
254 | 254 | |
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | - if ( $percentage > 100 ) { |
|
258 | + if ($percentage > 100) { |
|
259 | 259 | $percentage = 100; |
260 | 260 | } |
261 | 261 | |
@@ -271,46 +271,46 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return mixed |
273 | 273 | */ |
274 | - private function set_donor_data( $i, $data, $donor ) { |
|
274 | + private function set_donor_data($i, $data, $donor) { |
|
275 | 275 | |
276 | 276 | $columns = $this->csv_cols(); |
277 | 277 | |
278 | 278 | // Set address variable |
279 | 279 | $address = ''; |
280 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
281 | - $address = give_get_donor_address( $donor->user_id ); |
|
280 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
281 | + $address = give_get_donor_address($donor->user_id); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // Set columns |
285 | - if ( ! empty( $columns['full_name'] ) ) { |
|
286 | - $data[ $i ]['full_name'] = $donor->name; |
|
285 | + if ( ! empty($columns['full_name'])) { |
|
286 | + $data[$i]['full_name'] = $donor->name; |
|
287 | 287 | } |
288 | - if ( ! empty( $columns['email'] ) ) { |
|
289 | - $data[ $i ]['email'] = $donor->email; |
|
288 | + if ( ! empty($columns['email'])) { |
|
289 | + $data[$i]['email'] = $donor->email; |
|
290 | 290 | } |
291 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
292 | - |
|
293 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
294 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
295 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
296 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
297 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
298 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
291 | + if ( ! empty($columns['address_line1'])) { |
|
292 | + |
|
293 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
294 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
295 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
296 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
297 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
298 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
299 | 299 | } |
300 | - if ( ! empty( $columns['userid'] ) ) { |
|
301 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
300 | + if ( ! empty($columns['userid'])) { |
|
301 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
302 | 302 | } |
303 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
304 | - $data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) ); |
|
303 | + if ( ! empty($columns['date_first_donated'])) { |
|
304 | + $data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created)); |
|
305 | 305 | } |
306 | - if ( ! empty( $columns['donations'] ) ) { |
|
307 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
306 | + if ( ! empty($columns['donations'])) { |
|
307 | + $data[$i]['donations'] = $donor->purchase_count; |
|
308 | 308 | } |
309 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
310 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
309 | + if ( ! empty($columns['donation_sum'])) { |
|
310 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
311 | 311 | } |
312 | 312 | |
313 | - return $data[ $i ]; |
|
313 | + return $data[$i]; |
|
314 | 314 | |
315 | 315 | } |
316 | 316 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
27 | 27 | } |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Fires before batch export. |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string $class Export class. |
37 | 37 | */ |
38 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
38 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
39 | 39 | |
40 | 40 | $export = new $_REQUEST['class']; |
41 | 41 | $export->export(); |
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
45 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Exports earnings for a specified time period |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | * @return void |
54 | 54 | */ |
55 | 55 | function give_export_earnings() { |
56 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php'; |
|
56 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php'; |
|
57 | 57 | |
58 | 58 | $earnings_export = new Give_Earnings_Export(); |
59 | 59 | |
60 | 60 | $earnings_export->export(); |
61 | 61 | } |
62 | 62 | |
63 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
63 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
64 | 64 | |
65 | 65 | |
66 | 66 | /** |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * @return void |
74 | 74 | */ |
75 | 75 | function give_export_all_customers() { |
76 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php'; |
|
76 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php'; |
|
77 | 77 | |
78 | 78 | $customer_export = new Give_Donors_Export(); |
79 | 79 | |
80 | 80 | $customer_export->export(); |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'give_email_export', 'give_export_all_customers' ); |
|
83 | +add_action('give_email_export', 'give_export_all_customers'); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Add a hook allowing extensions to register a hook on the batch export process |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return void |
90 | 90 | */ |
91 | 91 | function give_register_batch_exporters() { |
92 | - if ( is_admin() ) { |
|
92 | + if (is_admin()) { |
|
93 | 93 | /** |
94 | 94 | * Fires in the admin, while plugins loaded. |
95 | 95 | * |
@@ -99,21 +99,21 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @param string $class Export class. |
101 | 101 | */ |
102 | - do_action( 'give_register_batch_exporter' ); |
|
102 | + do_action('give_register_batch_exporter'); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
106 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Register the payments batch exporter |
110 | 110 | * @since 1.5 |
111 | 111 | */ |
112 | 112 | function give_register_payments_batch_export() { |
113 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
113 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
116 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Loads the payments batch process if needed |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return void |
126 | 126 | */ |
127 | -function give_include_payments_batch_processor( $class ) { |
|
127 | +function give_include_payments_batch_processor($class) { |
|
128 | 128 | |
129 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
130 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
129 | + if ('Give_Batch_Payments_Export' === $class) { |
|
130 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | } |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | * @since 1.5.2 |
138 | 138 | */ |
139 | 139 | function give_register_customers_batch_export() { |
140 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 ); |
|
140 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1); |
|
141 | 141 | } |
142 | 142 | |
143 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
143 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Loads the customers batch process if needed |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return void |
153 | 153 | */ |
154 | -function give_include_customers_batch_processor( $class ) { |
|
154 | +function give_include_customers_batch_processor($class) { |
|
155 | 155 | |
156 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
157 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
156 | + if ('Give_Batch_Customers_Export' === $class) { |
|
157 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | * @since 1.5 |
166 | 166 | */ |
167 | 167 | function give_register_forms_batch_export() { |
168 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
168 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
169 | 169 | } |
170 | 170 | |
171 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
171 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
172 | 172 | |
173 | 173 | /** |
174 | 174 | * Loads the file downloads batch process if needed |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return void |
181 | 181 | */ |
182 | -function give_include_forms_batch_processor( $class ) { |
|
182 | +function give_include_forms_batch_processor($class) { |
|
183 | 183 | |
184 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
185 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
184 | + if ('Give_Batch_Forms_Export' === $class) { |
|
185 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | } |
189 | 189 | \ No newline at end of file |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Earnings' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Earnings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Earnings. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'earnings'; |
46 | - $this->label = esc_html__( 'Income', 'give' ); |
|
46 | + $this->label = esc_html__('Income', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_report_earnings', array( $this, 'render_report_earnings_field' ), 10, 2 ); |
|
48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_report_earnings', array($this, 'render_report_earnings_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $pages Lst of pages. |
64 | 64 | * @return array |
65 | 65 | */ |
66 | - public function add_settings_page( $pages ) { |
|
67 | - $pages[ $this->id ] = $this->label; |
|
66 | + public function add_settings_page($pages) { |
|
67 | + $pages[$this->id] = $this->label; |
|
68 | 68 | |
69 | 69 | return $pages; |
70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $settings |
87 | 87 | */ |
88 | 88 | $settings = apply_filters( |
89 | - 'give_get_settings_' . $this->id, |
|
89 | + 'give_get_settings_'.$this->id, |
|
90 | 90 | array( |
91 | 91 | array( |
92 | 92 | 'id' => 'give_tools_earnings', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'earnings', |
98 | - 'name' => esc_html__( 'Income', 'give' ), |
|
98 | + 'name' => esc_html__('Income', 'give'), |
|
99 | 99 | 'type' => 'report_earnings', |
100 | 100 | ), |
101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function output() { |
120 | 120 | $settings = $this->get_settings(); |
121 | 121 | |
122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param $field |
132 | 132 | * @param $option_value |
133 | 133 | */ |
134 | - public function render_report_earnings_field( $field, $option_value ) { |
|
135 | - do_action( 'give_reports_view_earnings' ); |
|
134 | + public function render_report_earnings_field($field, $option_value) { |
|
135 | + do_action('give_reports_view_earnings'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Admin View: Settings |
4 | 4 | */ |
5 | -if ( ! defined( 'ABSPATH' ) ) { |
|
5 | +if ( ! defined('ABSPATH')) { |
|
6 | 6 | exit; |
7 | 7 | } |
8 | 8 | |
9 | 9 | |
10 | 10 | // Bailout: Do not output anything if setting tab is not defined. |
11 | -if( ! empty( $tabs ) && array_key_exists( give_get_current_setting_tab(), $tabs ) ) : |
|
11 | +if ( ! empty($tabs) && array_key_exists(give_get_current_setting_tab(), $tabs)) : |
|
12 | 12 | /** |
13 | 13 | * Filter the form action. |
14 | 14 | * |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.8 |
20 | 20 | */ |
21 | - $form_method = apply_filters( self::$setting_filter_prefix . '_form_method_tab_' . $current_tab, 'post' ); |
|
21 | + $form_method = apply_filters(self::$setting_filter_prefix.'_form_method_tab_'.$current_tab, 'post'); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Filter the main form tab. |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @since 1.8 |
32 | 32 | */ |
33 | - $form_open_tag = apply_filters( self::$setting_filter_prefix . '_open_form', '<form method="' . $form_method . '" id="give-mainform" action="" enctype="multipart/form-data">' ); |
|
34 | - $form_close_tag = apply_filters( self::$setting_filter_prefix . '_close_form', '</form>' ); |
|
33 | + $form_open_tag = apply_filters(self::$setting_filter_prefix.'_open_form', '<form method="'.$form_method.'" id="give-mainform" action="" enctype="multipart/form-data">'); |
|
34 | + $form_close_tag = apply_filters(self::$setting_filter_prefix.'_close_form', '</form>'); |
|
35 | 35 | ?> |
36 | - <div class="wrap give-settings-page <?php echo self::$setting_filter_prefix . '-setting-page'; ?>"> |
|
36 | + <div class="wrap give-settings-page <?php echo self::$setting_filter_prefix.'-setting-page'; ?>"> |
|
37 | 37 | <?php echo $form_open_tag; ?> |
38 | 38 | <h2 class="nav-tab-wrapper give-nav-tab-wrapper"> |
39 | 39 | <?php |
40 | - foreach ( $tabs as $name => $label ) { |
|
41 | - echo '<a href="' . admin_url( "edit.php?post_type=give_forms&page=" . self::$setting_filter_prefix . "&tab={$name}" ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
40 | + foreach ($tabs as $name => $label) { |
|
41 | + echo '<a href="'.admin_url("edit.php?post_type=give_forms&page=".self::$setting_filter_prefix."&tab={$name}").'" class="nav-tab '.($current_tab == $name ? 'nav-tab-active' : '').'">'.$label.'</a>'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @since 1.8 |
52 | 52 | */ |
53 | - do_action( self::$setting_filter_prefix . '_tabs' ); |
|
53 | + do_action(self::$setting_filter_prefix.'_tabs'); |
|
54 | 54 | ?> |
55 | 55 | </h2> |
56 | 56 | <div class="give-sub-nav-tab-wrapper"> |
57 | - <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e( 'View remaining setting tabs', 'give' ); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span></a> |
|
57 | + <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e('View remaining setting tabs', 'give'); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span></a> |
|
58 | 58 | <nav class="give-sub-nav-tab give-hidden"></nav> |
59 | 59 | </div> |
60 | - <h1 class="screen-reader-text"><?php echo esc_html( $tabs[ $current_tab ] ); ?></h1> |
|
60 | + <h1 class="screen-reader-text"><?php echo esc_html($tabs[$current_tab]); ?></h1> |
|
61 | 61 | <?php |
62 | 62 | |
63 | 63 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @since 1.8 |
71 | 71 | */ |
72 | - do_action( self::$setting_filter_prefix . "_sections_{$current_tab}_page" ); |
|
72 | + do_action(self::$setting_filter_prefix."_sections_{$current_tab}_page"); |
|
73 | 73 | |
74 | 74 | |
75 | 75 | // Show messages. |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @since 1.8 |
87 | 87 | */ |
88 | - do_action( self::$setting_filter_prefix . "_settings_{$current_tab}_page" ); |
|
88 | + do_action(self::$setting_filter_prefix."_settings_{$current_tab}_page"); |
|
89 | 89 | |
90 | - if ( empty( $GLOBALS['give_hide_save_button'] ) ) : ?> |
|
90 | + if (empty($GLOBALS['give_hide_save_button'])) : ?> |
|
91 | 91 | <div class="give-submit-wrap"> |
92 | - <?php wp_nonce_field( 'give-save-settings', '_give-save-settings' ); ?> |
|
93 | - <input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e( 'Save changes', 'give' ); ?>" /> |
|
92 | + <?php wp_nonce_field('give-save-settings', '_give-save-settings'); ?> |
|
93 | + <input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e('Save changes', 'give'); ?>" /> |
|
94 | 94 | </div> |
95 | 95 | <?php endif; ?> |
96 | 96 | <?php echo $form_close_tag; ?> |
97 | 97 | </div> |
98 | - <?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?> |
|
98 | + <?php else : echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; ?> |
|
99 | 99 | <?php endif; ?> |
100 | 100 | \ No newline at end of file |
@@ -95,5 +95,8 @@ |
||
95 | 95 | <?php endif; ?> |
96 | 96 | <?php echo $form_close_tag; ?> |
97 | 97 | </div> |
98 | - <?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?> |
|
98 | + <?php else { |
|
99 | + : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
100 | +} |
|
101 | +?> |
|
99 | 102 | <?php endif; ?> |
100 | 103 | \ 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 | |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page, $give_tools_page; |
34 | 34 | |
35 | 35 | //Payments |
36 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
37 | - $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' ); |
|
36 | + $give_payment = get_post_type_object('give_payment'); |
|
37 | + $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'); |
|
38 | 38 | |
39 | 39 | //Donors |
40 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' ); |
|
40 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page'); |
|
41 | 41 | |
42 | 42 | //Reports` |
43 | 43 | $give_reports_page = add_submenu_page( |
44 | 44 | 'edit.php?post_type=give_forms', |
45 | - esc_html__( 'Donation Reports', 'give' ), |
|
46 | - esc_html__( 'Reports', 'give' ), |
|
45 | + esc_html__('Donation Reports', 'give'), |
|
46 | + esc_html__('Reports', 'give'), |
|
47 | 47 | 'view_give_reports', |
48 | 48 | 'give-reports', |
49 | 49 | array( |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | //Settings |
56 | 56 | $give_settings_page = add_submenu_page( |
57 | 57 | 'edit.php?post_type=give_forms', |
58 | - esc_html__( 'Give Settings', 'give' ), |
|
59 | - esc_html__( 'Settings', 'give' ), |
|
58 | + esc_html__('Give Settings', 'give'), |
|
59 | + esc_html__('Settings', 'give'), |
|
60 | 60 | 'manage_give_settings', |
61 | 61 | 'give-settings', |
62 | 62 | array( |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | ); |
67 | 67 | |
68 | 68 | //Tools. |
69 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
69 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
70 | 70 | Give()->give_settings, |
71 | 71 | 'output' |
72 | - ) ); |
|
72 | + )); |
|
73 | 73 | |
74 | 74 | //Add-ons |
75 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
75 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
76 | 76 | |
77 | 77 | //Upgrades |
78 | - $give_upgrades_screen = add_submenu_page( null, esc_html__( 'Give Upgrades', 'give' ), esc_html__( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
78 | + $give_upgrades_screen = add_submenu_page(null, esc_html__('Give Upgrades', 'give'), esc_html__('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
79 | 79 | |
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
83 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Determines whether the current admin page is a Give admin page. |
@@ -95,224 +95,224 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return bool True if Give admin page. |
97 | 97 | */ |
98 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
98 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
99 | 99 | |
100 | 100 | global $pagenow, $typenow; |
101 | 101 | |
102 | 102 | $found = false; |
103 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
104 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
105 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
106 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
107 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
108 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
109 | - |
|
110 | - switch ( $passed_page ) { |
|
103 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
104 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
105 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
106 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
107 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
108 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
109 | + |
|
110 | + switch ($passed_page) { |
|
111 | 111 | case 'give_forms': |
112 | - switch ( $passed_view ) { |
|
112 | + switch ($passed_view) { |
|
113 | 113 | case 'list-table': |
114 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
114 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
115 | 115 | $found = true; |
116 | 116 | } |
117 | 117 | break; |
118 | 118 | case 'edit': |
119 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
119 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
120 | 120 | $found = true; |
121 | 121 | } |
122 | 122 | break; |
123 | 123 | case 'new': |
124 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
124 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
125 | 125 | $found = true; |
126 | 126 | } |
127 | 127 | break; |
128 | 128 | default: |
129 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
129 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
130 | 130 | $found = true; |
131 | 131 | } |
132 | 132 | break; |
133 | 133 | } |
134 | 134 | break; |
135 | 135 | case 'categories': |
136 | - switch ( $passed_view ) { |
|
136 | + switch ($passed_view) { |
|
137 | 137 | case 'list-table': |
138 | 138 | case 'new': |
139 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
139 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
140 | 140 | $found = true; |
141 | 141 | } |
142 | 142 | break; |
143 | 143 | case 'edit': |
144 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
144 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
145 | 145 | $found = true; |
146 | 146 | } |
147 | 147 | break; |
148 | 148 | default: |
149 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
149 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
150 | 150 | $found = true; |
151 | 151 | } |
152 | 152 | break; |
153 | 153 | } |
154 | 154 | break; |
155 | 155 | case 'tags': |
156 | - switch ( $passed_view ) { |
|
156 | + switch ($passed_view) { |
|
157 | 157 | case 'list-table': |
158 | 158 | case 'new': |
159 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
159 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
160 | 160 | $found = true; |
161 | 161 | } |
162 | 162 | break; |
163 | 163 | case 'edit': |
164 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
164 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
165 | 165 | $found = true; |
166 | 166 | } |
167 | 167 | break; |
168 | 168 | default: |
169 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
169 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
170 | 170 | $found = true; |
171 | 171 | } |
172 | 172 | break; |
173 | 173 | } |
174 | 174 | break; |
175 | 175 | case 'payments': |
176 | - switch ( $passed_view ) { |
|
176 | + switch ($passed_view) { |
|
177 | 177 | case 'list-table': |
178 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
178 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
179 | 179 | $found = true; |
180 | 180 | } |
181 | 181 | break; |
182 | 182 | case 'edit': |
183 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) { |
|
183 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) { |
|
184 | 184 | $found = true; |
185 | 185 | } |
186 | 186 | break; |
187 | 187 | default: |
188 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
188 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
189 | 189 | $found = true; |
190 | 190 | } |
191 | 191 | break; |
192 | 192 | } |
193 | 193 | break; |
194 | 194 | case 'reports': |
195 | - switch ( $passed_view ) { |
|
195 | + switch ($passed_view) { |
|
196 | 196 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
197 | 197 | case 'earnings': |
198 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
198 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
199 | 199 | $found = true; |
200 | 200 | } |
201 | 201 | break; |
202 | 202 | case 'donors': |
203 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
203 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
204 | 204 | $found = true; |
205 | 205 | } |
206 | 206 | break; |
207 | 207 | case 'gateways': |
208 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
208 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
209 | 209 | $found = true; |
210 | 210 | } |
211 | 211 | break; |
212 | 212 | case 'export': |
213 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
213 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
214 | 214 | $found = true; |
215 | 215 | } |
216 | 216 | break; |
217 | 217 | case 'logs': |
218 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
218 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
219 | 219 | $found = true; |
220 | 220 | } |
221 | 221 | break; |
222 | 222 | default: |
223 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
223 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
224 | 224 | $found = true; |
225 | 225 | } |
226 | 226 | break; |
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'settings': |
230 | - switch ( $passed_view ) { |
|
230 | + switch ($passed_view) { |
|
231 | 231 | case 'general': |
232 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
232 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
233 | 233 | $found = true; |
234 | 234 | } |
235 | 235 | break; |
236 | 236 | case 'gateways': |
237 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
237 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
238 | 238 | $found = true; |
239 | 239 | } |
240 | 240 | break; |
241 | 241 | case 'emails': |
242 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
242 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
243 | 243 | $found = true; |
244 | 244 | } |
245 | 245 | break; |
246 | 246 | case 'display': |
247 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
247 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
248 | 248 | $found = true; |
249 | 249 | } |
250 | 250 | break; |
251 | 251 | case 'licenses': |
252 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
252 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
253 | 253 | $found = true; |
254 | 254 | } |
255 | 255 | break; |
256 | 256 | case 'api': |
257 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
257 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
258 | 258 | $found = true; |
259 | 259 | } |
260 | 260 | break; |
261 | 261 | case 'advanced': |
262 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
262 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
263 | 263 | $found = true; |
264 | 264 | } |
265 | 265 | break; |
266 | 266 | case 'system_info': |
267 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
267 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
268 | 268 | $found = true; |
269 | 269 | } |
270 | 270 | break; |
271 | 271 | default: |
272 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
272 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
273 | 273 | $found = true; |
274 | 274 | } |
275 | 275 | break; |
276 | 276 | } |
277 | 277 | break; |
278 | 278 | case 'addons': |
279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
280 | 280 | $found = true; |
281 | 281 | } |
282 | 282 | break; |
283 | 283 | case 'donors': |
284 | - switch ( $passed_view ) { |
|
284 | + switch ($passed_view) { |
|
285 | 285 | case 'list-table': |
286 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
286 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
287 | 287 | $found = true; |
288 | 288 | } |
289 | 289 | break; |
290 | 290 | case 'overview': |
291 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
291 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
292 | 292 | $found = true; |
293 | 293 | } |
294 | 294 | break; |
295 | 295 | case 'notes': |
296 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
296 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
297 | 297 | $found = true; |
298 | 298 | } |
299 | 299 | break; |
300 | 300 | default: |
301 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
301 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
302 | 302 | $found = true; |
303 | 303 | } |
304 | 304 | break; |
305 | 305 | } |
306 | 306 | break; |
307 | 307 | case 'reports': |
308 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
308 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
309 | 309 | $found = true; |
310 | 310 | } |
311 | 311 | break; |
312 | 312 | default: |
313 | 313 | 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, $give_tools_page; |
314 | 314 | |
315 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
315 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
316 | 316 | $give_payments_page, |
317 | 317 | $give_settings_page, |
318 | 318 | $give_reports_page, |
@@ -323,19 +323,19 @@ discard block |
||
323 | 323 | $give_customers_page, |
324 | 324 | $give_tools_page, |
325 | 325 | 'widgets.php' |
326 | - ) ); |
|
327 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
326 | + )); |
|
327 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
328 | 328 | $found = true; |
329 | - if ( 'give-upgrades' === $page ) { |
|
329 | + if ('give-upgrades' === $page) { |
|
330 | 330 | $found = false; |
331 | 331 | } |
332 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
332 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
333 | 333 | $found = true; |
334 | 334 | } |
335 | 335 | break; |
336 | 336 | } |
337 | 337 | |
338 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
338 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
339 | 339 | |
340 | 340 | } |
341 | 341 | |
@@ -347,37 +347,37 @@ discard block |
||
347 | 347 | * @param array $settings |
348 | 348 | * @return array |
349 | 349 | */ |
350 | -function give_settings_page_pages( $settings ) { |
|
351 | - include( 'abstract-admin-settings-page.php' ); |
|
352 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
350 | +function give_settings_page_pages($settings) { |
|
351 | + include('abstract-admin-settings-page.php'); |
|
352 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
353 | 353 | |
354 | 354 | $settings = array( |
355 | 355 | // General settings. |
356 | - include( 'settings/class-settings-general.php' ), |
|
356 | + include('settings/class-settings-general.php'), |
|
357 | 357 | |
358 | 358 | // Payment Gateways Settings. |
359 | - include( 'settings/class-settings-gateways.php' ), |
|
359 | + include('settings/class-settings-gateways.php'), |
|
360 | 360 | |
361 | 361 | // Display settings. |
362 | - include( 'settings/class-settings-display.php' ), |
|
362 | + include('settings/class-settings-display.php'), |
|
363 | 363 | |
364 | 364 | // Emails settings. |
365 | - include( 'settings/class-settings-email.php' ), |
|
365 | + include('settings/class-settings-email.php'), |
|
366 | 366 | |
367 | 367 | // Addons settings. |
368 | - include( 'settings/class-settings-addon.php' ), |
|
368 | + include('settings/class-settings-addon.php'), |
|
369 | 369 | |
370 | 370 | // License settings. |
371 | - include( 'settings/class-settings-license.php' ), |
|
371 | + include('settings/class-settings-license.php'), |
|
372 | 372 | |
373 | 373 | // Advanced settinns. |
374 | - include( 'settings/class-settings-advanced.php' ) |
|
374 | + include('settings/class-settings-advanced.php') |
|
375 | 375 | ); |
376 | 376 | |
377 | 377 | // Output. |
378 | 378 | return $settings; |
379 | 379 | } |
380 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
380 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
381 | 381 | |
382 | 382 | |
383 | 383 | /** |
@@ -387,30 +387,30 @@ discard block |
||
387 | 387 | * @param array $settings |
388 | 388 | * @return array |
389 | 389 | */ |
390 | -function give_reports_page_pages( $settings ) { |
|
391 | - include( 'abstract-admin-settings-page.php' ); |
|
390 | +function give_reports_page_pages($settings) { |
|
391 | + include('abstract-admin-settings-page.php'); |
|
392 | 392 | |
393 | 393 | $settings = array( |
394 | 394 | // Earnings. |
395 | - include( 'reporting/class-settings-earnings.php' ), |
|
395 | + include('reporting/class-settings-earnings.php'), |
|
396 | 396 | |
397 | 397 | // Forms. |
398 | - include( 'reporting/class-settings-forms.php' ), |
|
398 | + include('reporting/class-settings-forms.php'), |
|
399 | 399 | |
400 | 400 | // Donors. |
401 | - include( 'reporting/class-settings-donors.php' ), |
|
401 | + include('reporting/class-settings-donors.php'), |
|
402 | 402 | |
403 | 403 | // Gateways. |
404 | - include( 'reporting/class-settings-gateways.php' ), |
|
404 | + include('reporting/class-settings-gateways.php'), |
|
405 | 405 | |
406 | 406 | // Export. |
407 | - include( 'reporting/class-settings-export.php' ), |
|
407 | + include('reporting/class-settings-export.php'), |
|
408 | 408 | ); |
409 | 409 | |
410 | 410 | // Output. |
411 | 411 | return $settings; |
412 | 412 | } |
413 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
413 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
414 | 414 | |
415 | 415 | /** |
416 | 416 | * Add setting tab to give-settings page |
@@ -419,27 +419,27 @@ discard block |
||
419 | 419 | * @param array $settings |
420 | 420 | * @return array |
421 | 421 | */ |
422 | -function give_tools_page_pages( $settings ) { |
|
423 | - include( 'abstract-admin-settings-page.php' ); |
|
422 | +function give_tools_page_pages($settings) { |
|
423 | + include('abstract-admin-settings-page.php'); |
|
424 | 424 | |
425 | 425 | $settings = array( |
426 | 426 | // System Info. |
427 | - include( 'tools/class-settings-system-info.php' ), |
|
427 | + include('tools/class-settings-system-info.php'), |
|
428 | 428 | |
429 | 429 | // Logs. |
430 | - include( 'tools/class-settings-logs.php' ), |
|
430 | + include('tools/class-settings-logs.php'), |
|
431 | 431 | |
432 | 432 | // API. |
433 | - include( 'tools/class-settings-api.php' ), |
|
433 | + include('tools/class-settings-api.php'), |
|
434 | 434 | |
435 | 435 | // Data. |
436 | - include( 'tools/class-settings-data.php' ), |
|
436 | + include('tools/class-settings-data.php'), |
|
437 | 437 | ); |
438 | 438 | |
439 | 439 | // Output. |
440 | 440 | return $settings; |
441 | 441 | } |
442 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
442 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
443 | 443 | |
444 | 444 | /** |
445 | 445 | * Set default tools page tab. |
@@ -448,10 +448,10 @@ discard block |
||
448 | 448 | * @param string $default_tab Default tab name. |
449 | 449 | * @return string |
450 | 450 | */ |
451 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
451 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
452 | 452 | return 'system-info'; |
453 | 453 | } |
454 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
454 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
455 | 455 | |
456 | 456 | |
457 | 457 | /** |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @param string $default_tab Default tab name. |
462 | 462 | * @return string |
463 | 463 | */ |
464 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
464 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
465 | 465 | return 'earnings'; |
466 | 466 | } |
467 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
468 | 467 | \ No newline at end of file |
468 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
469 | 469 | \ No newline at end of file |
@@ -87,13 +87,13 @@ |
||
87 | 87 | 'disabled' => __( 'Head', 'give' ), |
88 | 88 | ) |
89 | 89 | ), |
90 | - array( |
|
91 | - 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
92 | - 'id' => 'advanced_settings_docs_link', |
|
93 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
95 | - 'type' => 'give_docs_link', |
|
96 | - ), |
|
90 | + array( |
|
91 | + 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
92 | + 'id' => 'advanced_settings_docs_link', |
|
93 | + 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | + 'title' => __( 'Advanced Settings', 'give' ), |
|
95 | + 'type' => 'give_docs_link', |
|
96 | + ), |
|
97 | 97 | array( |
98 | 98 | 'id' => 'give_title_data_control_2', |
99 | 99 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Advanced' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Advanced. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'advanced'; |
30 | - $this->label = esc_html__( 'Advanced', 'give' ); |
|
30 | + $this->label = esc_html__('Advanced', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'advanced-options'; |
33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $current_section = give_get_current_setting_section(); |
47 | 47 | |
48 | - switch ( $current_section ) { |
|
48 | + switch ($current_section) { |
|
49 | 49 | case 'advanced-options': |
50 | 50 | $settings = array( |
51 | 51 | array( |
@@ -53,45 +53,45 @@ discard block |
||
53 | 53 | 'type' => 'title' |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => esc_html__( 'Remove Data on Uninstall', 'give' ), |
|
57 | - 'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
56 | + 'name' => esc_html__('Remove Data on Uninstall', 'give'), |
|
57 | + 'desc' => esc_html__('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
58 | 58 | 'id' => 'uninstall_on_delete', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'disabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
63 | - 'disabled' => __( 'No, keep my Give settings and donation data this time', 'give' ), |
|
62 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
63 | + 'disabled' => __('No, keep my Give settings and donation data this time', 'give'), |
|
64 | 64 | ) |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | /* translators: %s: the_content */ |
68 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
68 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
69 | 69 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
70 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
70 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
71 | 71 | 'id' => 'the_content_filter', |
72 | 72 | 'default' => 'enabled', |
73 | 73 | 'type' => 'radio_inline', |
74 | 74 | 'options' => array( |
75 | - 'enabled' => __( 'Enabled', 'give' ), |
|
76 | - 'disabled' => __( 'Disabled', 'give' ), |
|
75 | + 'enabled' => __('Enabled', 'give'), |
|
76 | + 'disabled' => __('Disabled', 'give'), |
|
77 | 77 | ) |
78 | 78 | ), |
79 | 79 | array( |
80 | - 'name' => esc_html__( 'Script Loading Location', 'give' ), |
|
81 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
80 | + 'name' => esc_html__('Script Loading Location', 'give'), |
|
81 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
82 | 82 | 'id' => 'scripts_footer', |
83 | 83 | 'type' => 'radio_inline', |
84 | 84 | 'default' => 'disabled', |
85 | 85 | 'options' => array( |
86 | - 'enabled' => __( 'Footer', 'give' ), |
|
87 | - 'disabled' => __( 'Head', 'give' ), |
|
86 | + 'enabled' => __('Footer', 'give'), |
|
87 | + 'disabled' => __('Head', 'give'), |
|
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | array( |
91 | - 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
91 | + 'name' => esc_html__('Advanced Settings Docs Link', 'give'), |
|
92 | 92 | 'id' => 'advanced_settings_docs_link', |
93 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
93 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
94 | + 'title' => __('Advanced Settings', 'give'), |
|
95 | 95 | 'type' => 'give_docs_link', |
96 | 96 | ), |
97 | 97 | array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * Filter the advanced settings. |
108 | 108 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
109 | 109 | */ |
110 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
110 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Filter the settings. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param array $settings |
118 | 118 | */ |
119 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
119 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
120 | 120 | |
121 | 121 | // Output. |
122 | 122 | return $settings; |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function get_sections() { |
132 | 132 | $sections = array( |
133 | - 'advanced-options' => esc_html__( 'Advanced Options', 'give' ) |
|
133 | + 'advanced-options' => esc_html__('Advanced Options', 'give') |
|
134 | 134 | ); |
135 | 135 | |
136 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
136 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 |