@@ -157,7 +157,7 @@ |
||
157 | 157 | * |
158 | 158 | * @access public |
159 | 159 | * @since 1.0 |
160 | - * @return string|bool String if search is present, false otherwise |
|
160 | + * @return string|false String if search is present, false otherwise |
|
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | 163 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -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 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | - 'ajax' => false,// Does this table support ajax? |
|
52 | - ) ); |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | + 'ajax' => false, // Does this table support ajax? |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
67 | - $input_id = $input_id . '-search-input'; |
|
66 | + public function search_box($text, $input_id) { |
|
67 | + $input_id = $input_id.'-search-input'; |
|
68 | 68 | |
69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
71 | 71 | } |
72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
73 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
72 | + if ( ! empty($_REQUEST['order'])) { |
|
73 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | <p class="search-box" role="search"> |
77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
80 | 80 | </p> |
81 | 81 | <?php |
82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_columns() { |
92 | 92 | $columns = array( |
93 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
94 | - 'details' => esc_html__( 'Request Details', 'give' ), |
|
95 | - 'ip' => esc_html__( 'Request IP', 'give' ), |
|
96 | - 'date' => esc_html__( 'Date', 'give' ), |
|
93 | + 'ID' => esc_html__('Log ID', 'give'), |
|
94 | + 'details' => esc_html__('Request Details', 'give'), |
|
95 | + 'ip' => esc_html__('Request IP', 'give'), |
|
96 | + 'date' => esc_html__('Date', 'give'), |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | default: |
116 | - return $item[ $column_name ]; |
|
116 | + return $item[$column_name]; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function column_details( $item ) { |
|
130 | + public function column_details($item) { |
|
131 | 131 | ?> |
132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Request', 'give' ); ?></a> |
|
132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Request', 'give'); ?></a> |
|
133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
134 | 134 | <?php |
135 | 135 | |
136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
138 | - echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>'; |
|
139 | - echo '<div>' . $request . '</div>'; |
|
140 | - if ( ! empty( $error ) ) { |
|
141 | - echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>'; |
|
142 | - echo '<div>' . esc_html( $error ) . '</div>'; |
|
136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
137 | + $error = get_post_field('post_content', $item['ID']); |
|
138 | + echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>'; |
|
139 | + echo '<div>'.$request.'</div>'; |
|
140 | + if ( ! empty($error)) { |
|
141 | + echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>'; |
|
142 | + echo '<div>'.esc_html($error).'</div>'; |
|
143 | 143 | } |
144 | - echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>'; |
|
145 | - echo '<div>' . give_get_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
146 | - echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>'; |
|
147 | - echo '<div>' . give_get_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
148 | - echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>'; |
|
149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
144 | + echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>'; |
|
145 | + echo '<div>'.give_get_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
146 | + echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>'; |
|
147 | + echo '<div>'.give_get_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
148 | + echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>'; |
|
149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return string|bool String if search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
180 | - if ( 'top' === $which ) { |
|
181 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
179 | + protected function display_tablenav($which) { |
|
180 | + if ('top' === $which) { |
|
181 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
182 | 182 | } |
183 | 183 | ?> |
184 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
184 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
185 | 185 | |
186 | 186 | <div class="alignleft actions bulkactions"> |
187 | - <?php $this->bulk_actions( $which ); ?> |
|
187 | + <?php $this->bulk_actions($which); ?> |
|
188 | 188 | </div> |
189 | 189 | <?php |
190 | - $this->extra_tablenav( $which ); |
|
191 | - $this->pagination( $which ); |
|
190 | + $this->extra_tablenav($which); |
|
191 | + $this->pagination($which); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <br class="clear"/> |
@@ -210,31 +210,31 @@ discard block |
||
210 | 210 | |
211 | 211 | $search = $this->get_search(); |
212 | 212 | |
213 | - if ( $search ) { |
|
214 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
213 | + if ($search) { |
|
214 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
215 | 215 | // This is an IP address search |
216 | 216 | $key = '_give_log_request_ip'; |
217 | - } elseif ( is_email( $search ) ) { |
|
217 | + } elseif (is_email($search)) { |
|
218 | 218 | // This is an email search |
219 | - $userdata = get_user_by( 'email', $search ); |
|
219 | + $userdata = get_user_by('email', $search); |
|
220 | 220 | |
221 | - if ( $userdata ) { |
|
221 | + if ($userdata) { |
|
222 | 222 | $search = $userdata->ID; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $key = '_give_log_user'; |
226 | - } elseif ( strlen( $search ) == 32 ) { |
|
226 | + } elseif (strlen($search) == 32) { |
|
227 | 227 | // Look for an API key |
228 | 228 | $key = '_give_log_key'; |
229 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
229 | + } elseif (stristr($search, 'token:')) { |
|
230 | 230 | // Look for an API token |
231 | - $search = str_ireplace( 'token:', '', $search ); |
|
231 | + $search = str_ireplace('token:', '', $search); |
|
232 | 232 | $key = '_give_log_token'; |
233 | 233 | } else { |
234 | 234 | // This is (probably) a user ID search |
235 | - $userdata = get_userdata( $search ); |
|
235 | + $userdata = get_userdata($search); |
|
236 | 236 | |
237 | - if ( $userdata ) { |
|
237 | + if ($userdata) { |
|
238 | 238 | $search = $userdata->ID; |
239 | 239 | } |
240 | 240 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return int Current page number |
261 | 261 | */ |
262 | 262 | public function get_paged() { |
263 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
263 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - function bulk_actions( $which = '' ) { |
|
273 | + function bulk_actions($which = '') { |
|
274 | 274 | give_log_views(); |
275 | 275 | } |
276 | 276 | |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | 'posts_per_page' => $this->per_page, |
295 | 295 | ); |
296 | 296 | |
297 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
297 | + $logs = $give_logs->get_connected_logs($log_query); |
|
298 | 298 | |
299 | - if ( $logs ) { |
|
300 | - foreach ( $logs as $log ) { |
|
299 | + if ($logs) { |
|
300 | + foreach ($logs as $log) { |
|
301 | 301 | |
302 | 302 | $logs_data[] = array( |
303 | 303 | 'ID' => $log->ID, |
304 | - 'ip' => give_get_meta( $log->ID, '_give_log_request_ip', true ), |
|
304 | + 'ip' => give_get_meta($log->ID, '_give_log_request_ip', true), |
|
305 | 305 | 'date' => $log->post_date, |
306 | 306 | ); |
307 | 307 | } |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | $columns = $this->get_columns(); |
330 | 330 | $hidden = array(); // No hidden columns |
331 | 331 | $sortable = $this->get_sortable_columns(); |
332 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
332 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
333 | 333 | $this->items = $this->get_logs(); |
334 | - $total_items = $give_logs->get_log_count( 0, 'api_request' ); |
|
334 | + $total_items = $give_logs->get_log_count(0, 'api_request'); |
|
335 | 335 | |
336 | - $this->set_pagination_args( array( |
|
336 | + $this->set_pagination_args(array( |
|
337 | 337 | 'total_items' => $total_items, |
338 | 338 | 'per_page' => $this->per_page, |
339 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
339 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
340 | 340 | ) |
341 | 341 | ); |
342 | 342 | } |
@@ -157,7 +157,7 @@ |
||
157 | 157 | * |
158 | 158 | * @access public |
159 | 159 | * @since 1.0 |
160 | - * @return string|bool string If search is present, false otherwise |
|
160 | + * @return string|false string If search is present, false otherwise |
|
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | 163 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded. |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | global $status, $page; |
45 | 45 | |
46 | 46 | // Set parent defaults |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | - 'ajax' => false,// Does this table support ajax? |
|
51 | - ) ); |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | + 'ajax' => false, // Does this table support ajax? |
|
51 | + )); |
|
52 | 52 | |
53 | - add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) ); |
|
53 | + add_action('give_log_view_actions', array($this, 'give_forms_filter')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -64,39 +64,39 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | 68 | |
69 | - $payment = give_get_payment_by( 'id', $item['payment_id'] ); |
|
69 | + $payment = give_get_payment_by('id', $item['payment_id']); |
|
70 | 70 | |
71 | - switch ( $column_name ) { |
|
71 | + switch ($column_name) { |
|
72 | 72 | case 'form' : |
73 | - $form_title = get_the_title( $item[ $column_name ] ); |
|
74 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item[ $column_name ] ) : $form_title; |
|
75 | - return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . $form_title . '</a>'; |
|
73 | + $form_title = get_the_title($item[$column_name]); |
|
74 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $item[$column_name]) : $form_title; |
|
75 | + return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.$form_title.'</a>'; |
|
76 | 76 | |
77 | 77 | case 'user_id' : |
78 | - return '<a href="' . |
|
79 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . ( ! empty( $item['user_id'] ) ? urlencode( $item['user_id'] ) : give_get_payment_user_email( $item['payment_id'] ) ) ) . |
|
80 | - '">' . $item['user_name'] . '</a>'; |
|
78 | + return '<a href="'. |
|
79 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.( ! empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))). |
|
80 | + '">'.$item['user_name'].'</a>'; |
|
81 | 81 | |
82 | 82 | case 'amount' : |
83 | - return give_currency_filter( give_format_amount( $item['amount'], array( 'sanitize' => false ) ) ); |
|
83 | + return give_currency_filter(give_format_amount($item['amount'], array('sanitize' => false))); |
|
84 | 84 | |
85 | 85 | case 'status' : |
86 | 86 | |
87 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
87 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
88 | 88 | |
89 | - if ( $payment->mode == 'test' ) { |
|
90 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . __( 'Test', 'give' ) . '</span>'; |
|
89 | + if ($payment->mode == 'test') { |
|
90 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.__('Test', 'give').'</span>'; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $value; |
94 | 94 | |
95 | 95 | case 'payment_id' : |
96 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $item['payment_id'] ) . '">' . give_get_payment_number( $item['payment_id'] ) . '</a>'; |
|
96 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$item['payment_id']).'">'.give_get_payment_number($item['payment_id']).'</a>'; |
|
97 | 97 | |
98 | 98 | default: |
99 | - return $item[ $column_name ]; |
|
99 | + return $item[$column_name]; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function get_columns() { |
111 | 111 | $columns = array( |
112 | - 'ID' => __( 'Log ID', 'give' ), |
|
113 | - 'user_id' => __( 'Donor', 'give' ), |
|
114 | - 'form' => __( 'Form', 'give' ), |
|
115 | - 'amount' => __( 'Donation Amount', 'give' ), |
|
116 | - 'status' => __( 'Status', 'give' ), |
|
117 | - 'payment_id' => __( 'Donation ID', 'give' ), |
|
118 | - 'date' => __( 'Date', 'give' ), |
|
112 | + 'ID' => __('Log ID', 'give'), |
|
113 | + 'user_id' => __('Donor', 'give'), |
|
114 | + 'form' => __('Form', 'give'), |
|
115 | + 'amount' => __('Donation Amount', 'give'), |
|
116 | + 'status' => __('Status', 'give'), |
|
117 | + 'payment_id' => __('Donation ID', 'give'), |
|
118 | + 'date' => __('Date', 'give'), |
|
119 | 119 | ); |
120 | 120 | |
121 | 121 | return $columns; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return int Current page number |
130 | 130 | */ |
131 | 131 | public function get_paged() { |
132 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
132 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return mixed int If User ID, string If Email/Login |
141 | 141 | */ |
142 | 142 | public function get_filtered_user() { |
143 | - return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false; |
|
143 | + return isset($_GET['user']) ? absint($_GET['user']) : false; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return int Download ID |
152 | 152 | */ |
153 | 153 | public function get_filtered_give_form() { |
154 | - return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false; |
|
154 | + return ! empty($_GET['form']) ? absint($_GET['form']) : false; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @return string|bool string If search is present, false otherwise |
163 | 163 | */ |
164 | 164 | public function get_search() { |
165 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
165 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -178,20 +178,20 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @param string $which |
180 | 180 | */ |
181 | - protected function display_tablenav( $which ) { |
|
181 | + protected function display_tablenav($which) { |
|
182 | 182 | |
183 | - if ( 'top' === $which ) { |
|
184 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
183 | + if ('top' === $which) { |
|
184 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
185 | 185 | } |
186 | 186 | ?> |
187 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
187 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
188 | 188 | |
189 | 189 | <div class="alignleft actions bulkactions"> |
190 | - <?php $this->bulk_actions( $which ); ?> |
|
190 | + <?php $this->bulk_actions($which); ?> |
|
191 | 191 | </div> |
192 | 192 | <?php |
193 | - $this->extra_tablenav( $which ); |
|
194 | - $this->pagination( $which ); |
|
193 | + $this->extra_tablenav($which); |
|
194 | + $this->pagination($which); |
|
195 | 195 | ?> |
196 | 196 | |
197 | 197 | <br class="clear"/> |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | $meta_query = array(); |
217 | 217 | |
218 | - if ( $user ) { |
|
218 | + if ($user) { |
|
219 | 219 | // Show only logs from a specific user. |
220 | 220 | $meta_query[] = array( |
221 | 221 | 'key' => '_give_log_user_id', |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | $search = $this->get_search(); |
227 | - if ( $search ) { |
|
228 | - if ( is_email( $search ) ) { |
|
227 | + if ($search) { |
|
228 | + if (is_email($search)) { |
|
229 | 229 | // This is an email search. We use this to ensure it works for guest users and logged-in users. |
230 | 230 | $key = '_give_log_user_info'; |
231 | 231 | $compare = 'LIKE'; |
@@ -234,32 +234,32 @@ discard block |
||
234 | 234 | $key = '_give_log_user_id'; |
235 | 235 | $compare = 'LIKE'; |
236 | 236 | |
237 | - if ( ! is_numeric( $search ) ) { |
|
237 | + if ( ! is_numeric($search)) { |
|
238 | 238 | // Searching for user by username |
239 | - $user = get_user_by( 'login', $search ); |
|
239 | + $user = get_user_by('login', $search); |
|
240 | 240 | |
241 | - if ( $user ) { |
|
241 | + if ($user) { |
|
242 | 242 | // Found one, set meta value to user's ID. |
243 | 243 | $search = $user->ID; |
244 | 244 | } else { |
245 | 245 | // No user found so let's do a real search query. |
246 | - $users = new WP_User_Query( array( |
|
246 | + $users = new WP_User_Query(array( |
|
247 | 247 | 'search' => $search, |
248 | - 'search_columns' => array( 'user_url', 'user_nicename' ), |
|
248 | + 'search_columns' => array('user_url', 'user_nicename'), |
|
249 | 249 | 'number' => 1, |
250 | 250 | 'fields' => 'ids', |
251 | - ) ); |
|
251 | + )); |
|
252 | 252 | |
253 | 253 | $found_user = $users->get_results(); |
254 | 254 | |
255 | - if ( $found_user ) { |
|
255 | + if ($found_user) { |
|
256 | 256 | $search = $found_user[0]; |
257 | 257 | } |
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
262 | - if ( ! $this->file_search ) { |
|
262 | + if ( ! $this->file_search) { |
|
263 | 263 | // Meta query only works for non file name search. |
264 | 264 | $meta_query[] = array( |
265 | 265 | 'key' => $key, |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @since 1.0 |
281 | 281 | * @return void |
282 | 282 | */ |
283 | - function bulk_actions( $which = '' ) { |
|
283 | + function bulk_actions($which = '') { |
|
284 | 284 | give_log_views(); |
285 | 285 | } |
286 | 286 | |
@@ -292,24 +292,24 @@ discard block |
||
292 | 292 | * @return void |
293 | 293 | */ |
294 | 294 | public function give_forms_filter() { |
295 | - $give_forms = get_posts( array( |
|
295 | + $give_forms = get_posts(array( |
|
296 | 296 | 'post_type' => 'give_forms', |
297 | 297 | 'post_status' => 'any', |
298 | - 'posts_per_page' => - 1, |
|
298 | + 'posts_per_page' => -1, |
|
299 | 299 | 'orderby' => 'title', |
300 | 300 | 'order' => 'ASC', |
301 | 301 | 'fields' => 'ids', |
302 | 302 | 'update_post_meta_cache' => false, |
303 | 303 | 'update_post_term_cache' => false, |
304 | - ) ); |
|
304 | + )); |
|
305 | 305 | |
306 | - if ( $give_forms ) { |
|
306 | + if ($give_forms) { |
|
307 | 307 | echo '<select name="form" id="give-log-form-filter">'; |
308 | - echo '<option value="0">' . __( 'All', 'give' ) . '</option>'; |
|
309 | - foreach ( $give_forms as $form ) { |
|
310 | - $form_title = get_the_title( $form ); |
|
311 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form ) : $form_title; |
|
312 | - echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html( $form_title ) . '</option>'; |
|
308 | + echo '<option value="0">'.__('All', 'give').'</option>'; |
|
309 | + foreach ($give_forms as $form) { |
|
310 | + $form_title = get_the_title($form); |
|
311 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $form) : $form_title; |
|
312 | + echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html($form_title).'</option>'; |
|
313 | 313 | } |
314 | 314 | echo '</select>'; |
315 | 315 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | $logs_data = array(); |
331 | 331 | $paged = $this->get_paged(); |
332 | - $give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null; |
|
332 | + $give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null; |
|
333 | 333 | $user = $this->get_filtered_user(); |
334 | 334 | |
335 | 335 | $log_query = array( |
@@ -340,38 +340,38 @@ discard block |
||
340 | 340 | 'posts_per_page' => $this->per_page, |
341 | 341 | ); |
342 | 342 | |
343 | - $cache_key = Give_Cache::get_key( 'get_logs', $log_query ); |
|
343 | + $cache_key = Give_Cache::get_key('get_logs', $log_query); |
|
344 | 344 | |
345 | 345 | // Return result from cache if exist. |
346 | - if ( ! ( $logs_data = Give_Cache::get( $cache_key ) ) ) { |
|
347 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
346 | + if ( ! ($logs_data = Give_Cache::get($cache_key))) { |
|
347 | + $logs = $give_logs->get_connected_logs($log_query); |
|
348 | 348 | |
349 | - if ( $logs ) { |
|
350 | - foreach ( $logs as $log ) { |
|
351 | - $payment_id = give_get_meta( $log->ID, '_give_log_payment_id', true ); |
|
349 | + if ($logs) { |
|
350 | + foreach ($logs as $log) { |
|
351 | + $payment_id = give_get_meta($log->ID, '_give_log_payment_id', true); |
|
352 | 352 | |
353 | 353 | // Make sure this payment hasn't been deleted. |
354 | - if ( get_post( $payment_id ) ) : |
|
355 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
356 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
357 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
354 | + if (get_post($payment_id)) : |
|
355 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
356 | + $payment_meta = give_get_payment_meta($payment_id); |
|
357 | + $payment_amount = give_get_payment_amount($payment_id); |
|
358 | 358 | |
359 | 359 | $logs_data[] = array( |
360 | - 'ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', |
|
360 | + 'ID' => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>', |
|
361 | 361 | 'payment_id' => $payment_id, |
362 | 362 | 'form' => $log->post_parent, |
363 | 363 | 'amount' => $payment_amount, |
364 | 364 | 'user_id' => $user_info['id'], |
365 | - 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], |
|
366 | - 'date' => get_post_field( 'post_date', $payment_id ), |
|
365 | + 'user_name' => $user_info['first_name'].' '.$user_info['last_name'], |
|
366 | + 'date' => get_post_field('post_date', $payment_id), |
|
367 | 367 | ); |
368 | 368 | |
369 | 369 | endif; |
370 | 370 | } |
371 | 371 | |
372 | 372 | // Cache results. |
373 | - if ( ! empty( $logs_data ) ) { |
|
374 | - Give_Cache::set( $cache_key, $logs_data ); |
|
373 | + if ( ! empty($logs_data)) { |
|
374 | + Give_Cache::set($cache_key, $logs_data); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | } |
@@ -399,15 +399,15 @@ discard block |
||
399 | 399 | $columns = $this->get_columns(); |
400 | 400 | $hidden = array(); |
401 | 401 | $sortable = $this->get_sortable_columns(); |
402 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
402 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
403 | 403 | $current_page = $this->get_pagenum(); |
404 | 404 | $this->items = $this->get_logs(); |
405 | - $total_items = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() ); |
|
405 | + $total_items = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query()); |
|
406 | 406 | |
407 | - $this->set_pagination_args( array( |
|
407 | + $this->set_pagination_args(array( |
|
408 | 408 | 'total_items' => $total_items, |
409 | 409 | 'per_page' => $this->per_page, |
410 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
410 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
411 | 411 | ) |
412 | 412 | ); |
413 | 413 | } |
@@ -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 | |
@@ -62,50 +62,50 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return bool If the gravatar exists or not |
64 | 64 | */ |
65 | - public function validate_gravatar( $id_or_email ) { |
|
65 | + public function validate_gravatar($id_or_email) { |
|
66 | 66 | //id or email code borrowed from wp-includes/pluggable.php |
67 | 67 | $email = ''; |
68 | - if ( is_numeric( $id_or_email ) ) { |
|
68 | + if (is_numeric($id_or_email)) { |
|
69 | 69 | $id = (int) $id_or_email; |
70 | - $user = get_userdata( $id ); |
|
71 | - if ( $user ) { |
|
70 | + $user = get_userdata($id); |
|
71 | + if ($user) { |
|
72 | 72 | $email = $user->user_email; |
73 | 73 | } |
74 | - } elseif ( is_object( $id_or_email ) ) { |
|
74 | + } elseif (is_object($id_or_email)) { |
|
75 | 75 | // No avatar for pingbacks or trackbacks |
76 | - $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); |
|
77 | - if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) { |
|
76 | + $allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment')); |
|
77 | + if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! empty( $id_or_email->user_id ) ) { |
|
81 | + if ( ! empty($id_or_email->user_id)) { |
|
82 | 82 | $id = (int) $id_or_email->user_id; |
83 | - $user = get_userdata( $id ); |
|
84 | - if ( $user ) { |
|
83 | + $user = get_userdata($id); |
|
84 | + if ($user) { |
|
85 | 85 | $email = $user->user_email; |
86 | 86 | } |
87 | - } elseif ( ! empty( $id_or_email->comment_author_email ) ) { |
|
87 | + } elseif ( ! empty($id_or_email->comment_author_email)) { |
|
88 | 88 | $email = $id_or_email->comment_author_email; |
89 | 89 | } |
90 | 90 | } else { |
91 | 91 | $email = $id_or_email; |
92 | 92 | } |
93 | 93 | |
94 | - $hashkey = md5( strtolower( trim( $email ) ) ); |
|
95 | - $uri = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404'; |
|
94 | + $hashkey = md5(strtolower(trim($email))); |
|
95 | + $uri = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404'; |
|
96 | 96 | |
97 | - $data = wp_cache_get( $hashkey ); |
|
98 | - if ( false === $data ) { |
|
99 | - $response = wp_remote_head( $uri ); |
|
100 | - if ( is_wp_error( $response ) ) { |
|
97 | + $data = wp_cache_get($hashkey); |
|
98 | + if (false === $data) { |
|
99 | + $response = wp_remote_head($uri); |
|
100 | + if (is_wp_error($response)) { |
|
101 | 101 | $data = 'not200'; |
102 | 102 | } else { |
103 | 103 | $data = $response['response']['code']; |
104 | 104 | } |
105 | - wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 ); |
|
105 | + wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5); |
|
106 | 106 | |
107 | 107 | } |
108 | - if ( $data == '200' ) { |
|
108 | + if ($data == '200') { |
|
109 | 109 | return true; |
110 | 110 | } else { |
111 | 111 | return false; |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return array IDs if logs, false otherwise |
124 | 124 | */ |
125 | - public function get_log_ids( $form_id = '' ) { |
|
125 | + public function get_log_ids($form_id = '') { |
|
126 | 126 | |
127 | 127 | // get Give_Logging class |
128 | 128 | global $give_logs; |
129 | 129 | |
130 | 130 | // get log for this form |
131 | - $logs = $give_logs->get_logs( $form_id ); |
|
131 | + $logs = $give_logs->get_logs($form_id); |
|
132 | 132 | |
133 | - if ( $logs ) { |
|
133 | + if ($logs) { |
|
134 | 134 | $log_ids = array(); |
135 | 135 | |
136 | 136 | // make an array with all the donor IDs |
137 | - foreach ( $logs as $log ) { |
|
137 | + foreach ($logs as $log) { |
|
138 | 138 | $log_ids[] = $log->ID; |
139 | 139 | } |
140 | 140 | |
@@ -155,51 +155,51 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return mixed |
157 | 157 | */ |
158 | - public function get_payment_ids( $form_id = '' ) { |
|
158 | + public function get_payment_ids($form_id = '') { |
|
159 | 159 | |
160 | 160 | $give_options = give_get_settings(); |
161 | 161 | |
162 | - $log_ids = $this->get_log_ids( $form_id ); |
|
162 | + $log_ids = $this->get_log_ids($form_id); |
|
163 | 163 | |
164 | - if ( $log_ids ) { |
|
164 | + if ($log_ids) { |
|
165 | 165 | |
166 | 166 | $payment_ids = array(); |
167 | 167 | |
168 | - foreach ( $log_ids as $id ) { |
|
168 | + foreach ($log_ids as $id) { |
|
169 | 169 | // get the payment ID for each corresponding log ID |
170 | - $payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true ); |
|
170 | + $payment_ids[] = give_get_meta($id, '_give_log_payment_id', true); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // remove donors who have donated more than once so we can have unique avatars |
174 | 174 | $unique_emails = array(); |
175 | 175 | |
176 | - foreach ( $payment_ids as $key => $id ) { |
|
176 | + foreach ($payment_ids as $key => $id) { |
|
177 | 177 | |
178 | - $email = give_get_meta( $id, '_give_payment_user_email', true ); |
|
178 | + $email = give_get_meta($id, '_give_payment_user_email', true); |
|
179 | 179 | |
180 | - if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) { |
|
181 | - if ( ! $this->validate_gravatar( $email ) ) { |
|
180 | + if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) { |
|
181 | + if ( ! $this->validate_gravatar($email)) { |
|
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | - $unique_emails[ $id ] = give_get_meta( $id, '_give_payment_user_email', true ); |
|
186 | + $unique_emails[$id] = give_get_meta($id, '_give_payment_user_email', true); |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
190 | 190 | $unique_ids = array(); |
191 | 191 | |
192 | 192 | // strip duplicate emails |
193 | - $unique_emails = array_unique( $unique_emails ); |
|
193 | + $unique_emails = array_unique($unique_emails); |
|
194 | 194 | |
195 | 195 | // convert the unique IDs back into simple array |
196 | - foreach ( $unique_emails as $id => $email ) { |
|
196 | + foreach ($unique_emails as $id => $email) { |
|
197 | 197 | $unique_ids[] = $id; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // randomize the payment IDs if enabled |
201 | - if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) { |
|
202 | - shuffle( $unique_ids ); |
|
201 | + if (isset($give_options['give_donors_gravatars_random_gravatars'])) { |
|
202 | + shuffle($unique_ids); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // return our unique IDs |
@@ -220,22 +220,22 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - public function gravatars( $form_id = false, $title = '' ) { |
|
223 | + public function gravatars($form_id = false, $title = '') { |
|
224 | 224 | |
225 | 225 | // unique $payment_ids |
226 | - $payment_ids = $this->get_payment_ids( $form_id ); |
|
226 | + $payment_ids = $this->get_payment_ids($form_id); |
|
227 | 227 | |
228 | 228 | $give_options = give_get_settings(); |
229 | 229 | |
230 | 230 | // return if no ID |
231 | - if ( ! $form_id ) { |
|
231 | + if ( ! $form_id) { |
|
232 | 232 | return; |
233 | 233 | } |
234 | 234 | |
235 | 235 | // minimum amount of donations before showing gravatars |
236 | 236 | // if the number of items in array is not greater or equal to the number specified, then exit |
237 | - if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) { |
|
238 | - if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) { |
|
237 | + if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) { |
|
238 | + if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 | } |
@@ -246,51 +246,51 @@ discard block |
||
246 | 246 | echo '<div id="give-purchase-gravatars">'; |
247 | 247 | |
248 | 248 | |
249 | - if ( isset ( $title ) ) { |
|
249 | + if (isset ($title)) { |
|
250 | 250 | |
251 | - if ( $title ) { |
|
252 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' ); |
|
253 | - } elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) { |
|
254 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' ); |
|
251 | + if ($title) { |
|
252 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>'); |
|
253 | + } elseif (isset($give_options['give_donors_gravatars_heading'])) { |
|
254 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>'); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | } |
258 | 258 | echo '<ul class="give-purchase-gravatars-list">'; |
259 | 259 | $i = 0; |
260 | 260 | |
261 | - if ( $payment_ids ) { |
|
262 | - foreach ( $payment_ids as $id ) { |
|
261 | + if ($payment_ids) { |
|
262 | + foreach ($payment_ids as $id) { |
|
263 | 263 | |
264 | 264 | // Give saves a blank option even when the control is turned off, hence the extra check |
265 | - if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) { |
|
265 | + if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) { |
|
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
269 | 269 | // get the payment meta |
270 | - $payment_meta = give_get_meta( $id, '_give_payment_meta', true ); |
|
270 | + $payment_meta = give_get_meta($id, '_give_payment_meta', true); |
|
271 | 271 | |
272 | 272 | // unserialize the payment meta |
273 | - $user_info = maybe_unserialize( $payment_meta['user_info'] ); |
|
273 | + $user_info = maybe_unserialize($payment_meta['user_info']); |
|
274 | 274 | |
275 | 275 | // get donor's first name |
276 | 276 | $name = $user_info['first_name']; |
277 | 277 | |
278 | 278 | // get donor's email |
279 | - $email = give_get_meta( $id, '_give_payment_user_email', true ); |
|
279 | + $email = give_get_meta($id, '_give_payment_user_email', true); |
|
280 | 280 | |
281 | 281 | // set gravatar size and provide filter |
282 | - $size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : ''; |
|
282 | + $size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : ''; |
|
283 | 283 | |
284 | 284 | // default image |
285 | - $default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false ); |
|
285 | + $default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false); |
|
286 | 286 | |
287 | 287 | // assemble output |
288 | 288 | $output .= '<li>'; |
289 | 289 | |
290 | - $output .= get_avatar( $email, $size, $default_image, $name ); |
|
290 | + $output .= get_avatar($email, $size, $default_image, $name); |
|
291 | 291 | $output .= '</li>'; |
292 | 292 | |
293 | - $i ++; |
|
293 | + $i++; |
|
294 | 294 | |
295 | 295 | } // end foreach |
296 | 296 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | echo '</ul>'; |
300 | 300 | echo '</div>'; |
301 | 301 | |
302 | - return apply_filters( 'give_donors_gravatars', ob_get_clean() ); |
|
302 | + return apply_filters('give_donors_gravatars', ob_get_clean()); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * @return void |
312 | 312 | */ |
313 | 313 | public function register_widget() { |
314 | - register_widget( 'Give_Donors_Gravatars_Widget' ); |
|
314 | + register_widget('Give_Donors_Gravatars_Widget'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -325,19 +325,19 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @return string |
327 | 327 | */ |
328 | - public function shortcode( $atts, $content = null ) { |
|
328 | + public function shortcode($atts, $content = null) { |
|
329 | 329 | |
330 | - $atts = shortcode_atts( array( |
|
330 | + $atts = shortcode_atts(array( |
|
331 | 331 | 'id' => '', |
332 | 332 | 'title' => '' |
333 | - ), $atts, 'give_donors_gravatars' ); |
|
333 | + ), $atts, 'give_donors_gravatars'); |
|
334 | 334 | |
335 | 335 | // if no ID is passed on single give_forms pages, get the correct ID |
336 | - if ( is_singular( 'give_forms' ) ) { |
|
336 | + if (is_singular('give_forms')) { |
|
337 | 337 | $id = get_the_ID(); |
338 | 338 | } |
339 | 339 | |
340 | - $content = $this->gravatars( $atts['id'], $atts['title'] ); |
|
340 | + $content = $this->gravatars($atts['id'], $atts['title']); |
|
341 | 341 | |
342 | 342 | return $content; |
343 | 343 | |
@@ -353,56 +353,56 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return array Gravatar settings. |
355 | 355 | */ |
356 | - public function settings( $settings ) { |
|
356 | + public function settings($settings) { |
|
357 | 357 | |
358 | 358 | $give_gravatar_settings = array( |
359 | 359 | array( |
360 | - 'name' => esc_html__( 'Donator Gravatars', 'give' ), |
|
360 | + 'name' => esc_html__('Donator Gravatars', 'give'), |
|
361 | 361 | 'desc' => '<hr>', |
362 | 362 | 'id' => 'give_title', |
363 | 363 | 'type' => 'give_title' |
364 | 364 | ), |
365 | 365 | array( |
366 | - 'name' => esc_html__( 'Heading', 'give' ), |
|
367 | - 'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ), |
|
366 | + 'name' => esc_html__('Heading', 'give'), |
|
367 | + 'desc' => esc_html__('The heading to display above the Gravatars.', 'give'), |
|
368 | 368 | 'type' => 'text', |
369 | 369 | 'id' => 'give_donors_gravatars_heading' |
370 | 370 | ), |
371 | 371 | array( |
372 | - 'name' => esc_html__( 'Gravatar Size', 'give' ), |
|
373 | - 'desc' => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ), |
|
372 | + 'name' => esc_html__('Gravatar Size', 'give'), |
|
373 | + 'desc' => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'), |
|
374 | 374 | 'type' => 'text_small', |
375 | 375 | 'id' => 'give_donors_gravatars_gravatar_size', |
376 | 376 | 'default' => '64' |
377 | 377 | ), |
378 | 378 | array( |
379 | - 'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ), |
|
380 | - 'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), |
|
379 | + 'name' => esc_html__('Minimum Unique Donations Required', 'give'), |
|
380 | + 'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), |
|
381 | 381 | 'type' => 'text_small', |
382 | 382 | 'id' => 'give_donors_gravatars_min_purchases_required', |
383 | 383 | ), |
384 | 384 | array( |
385 | - 'name' => esc_html__( 'Maximum Gravatars To Show', 'give' ), |
|
386 | - 'desc' => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ), |
|
385 | + 'name' => esc_html__('Maximum Gravatars To Show', 'give'), |
|
386 | + 'desc' => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'), |
|
387 | 387 | 'type' => 'text', |
388 | 388 | 'id' => 'give_donors_gravatars_maximum_number', |
389 | 389 | 'default' => '20', |
390 | 390 | ), |
391 | 391 | array( |
392 | - 'name' => esc_html__( 'Gravatar Visibility', 'give' ), |
|
393 | - 'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ), |
|
392 | + 'name' => esc_html__('Gravatar Visibility', 'give'), |
|
393 | + 'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'), |
|
394 | 394 | 'id' => 'give_donors_gravatars_has_gravatar_account', |
395 | 395 | 'type' => 'checkbox', |
396 | 396 | ), |
397 | 397 | array( |
398 | - 'name' => esc_html__( 'Randomize Gravatars', 'give' ), |
|
399 | - 'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ), |
|
398 | + 'name' => esc_html__('Randomize Gravatars', 'give'), |
|
399 | + 'desc' => esc_html__('Randomize the Gravatars.', 'give'), |
|
400 | 400 | 'id' => 'give_donors_gravatars_random_gravatars', |
401 | 401 | 'type' => 'checkbox', |
402 | 402 | ), |
403 | 403 | ); |
404 | 404 | |
405 | - return array_merge( $settings, $give_gravatar_settings ); |
|
405 | + return array_merge($settings, $give_gravatar_settings); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | // widget settings |
429 | 429 | $widget_ops = array( |
430 | 430 | 'classname' => 'give-donors-gravatars', |
431 | - 'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ), |
|
431 | + 'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'), |
|
432 | 432 | ); |
433 | 433 | |
434 | 434 | // widget control settings |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | // create the widget |
442 | 442 | parent::__construct( |
443 | 443 | 'give_donors_gravatars_widget', |
444 | - esc_html__( 'Give Donors Gravatars', 'give' ), |
|
444 | + esc_html__('Give Donors Gravatars', 'give'), |
|
445 | 445 | $widget_ops, |
446 | 446 | $control_ops |
447 | 447 | ); |
@@ -461,29 +461,29 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @return void |
463 | 463 | */ |
464 | - public function widget( $args, $instance ) { |
|
464 | + public function widget($args, $instance) { |
|
465 | 465 | |
466 | 466 | //@TODO: Don't extract it!!! |
467 | - extract( $args ); |
|
467 | + extract($args); |
|
468 | 468 | |
469 | - if ( ! is_singular( 'give_forms' ) ) { |
|
469 | + if ( ! is_singular('give_forms')) { |
|
470 | 470 | return; |
471 | 471 | } |
472 | 472 | |
473 | 473 | // Variables from widget settings |
474 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
474 | + $title = apply_filters('widget_title', $instance['title']); |
|
475 | 475 | |
476 | 476 | // Used by themes. Opens the widget |
477 | 477 | echo $before_widget; |
478 | 478 | |
479 | 479 | // Display the widget title |
480 | - if ( $title ) { |
|
481 | - echo $before_title . $title . $after_title; |
|
480 | + if ($title) { |
|
481 | + echo $before_title.$title.$after_title; |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | $gravatars = new Give_Donors_Gravatars(); |
485 | 485 | |
486 | - echo $gravatars->gravatars( get_the_ID(), null ); // remove title |
|
486 | + echo $gravatars->gravatars(get_the_ID(), null); // remove title |
|
487 | 487 | |
488 | 488 | // Used by themes. Closes the widget |
489 | 489 | echo $after_widget; |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @return array Updated settings to save. |
505 | 505 | */ |
506 | - public function update( $new_instance, $old_instance ) { |
|
506 | + public function update($new_instance, $old_instance) { |
|
507 | 507 | |
508 | 508 | $instance = $old_instance; |
509 | 509 | |
510 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
510 | + $instance['title'] = strip_tags($new_instance['title']); |
|
511 | 511 | |
512 | 512 | return $instance; |
513 | 513 | |
@@ -525,19 +525,19 @@ discard block |
||
525 | 525 | * |
526 | 526 | * @return void |
527 | 527 | */ |
528 | - public function form( $instance ) { |
|
528 | + public function form($instance) { |
|
529 | 529 | |
530 | 530 | // Set up some default widget settings. |
531 | 531 | $defaults = array( |
532 | 532 | 'title' => '', |
533 | 533 | ); |
534 | 534 | |
535 | - $instance = wp_parse_args( (array) $instance, $defaults ); ?> |
|
535 | + $instance = wp_parse_args((array) $instance, $defaults); ?> |
|
536 | 536 | |
537 | 537 | <!-- Title --> |
538 | 538 | <p> |
539 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label> |
|
540 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
539 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label> |
|
540 | + <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
541 | 541 | </p> |
542 | 542 | |
543 | 543 | <?php |
@@ -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 | |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | // Default, built-in gateways |
25 | 25 | $gateways = array( |
26 | 26 | 'paypal' => array( |
27 | - 'admin_label' => __( 'PayPal Standard', 'give' ), |
|
28 | - 'checkout_label' => __( 'PayPal', 'give' ), |
|
27 | + 'admin_label' => __('PayPal Standard', 'give'), |
|
28 | + 'checkout_label' => __('PayPal', 'give'), |
|
29 | 29 | ), |
30 | 30 | 'manual' => array( |
31 | - 'admin_label' => __( 'Test Donation', 'give' ), |
|
32 | - 'checkout_label' => __( 'Test Donation', 'give' ) |
|
31 | + 'admin_label' => __('Test Donation', 'give'), |
|
32 | + 'checkout_label' => __('Test Donation', 'give') |
|
33 | 33 | ), |
34 | 34 | ); |
35 | 35 | |
36 | - return apply_filters( 'give_payment_gateways', $gateways ); |
|
36 | + return apply_filters('give_payment_gateways', $gateways); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array $gateway_list All the available gateways |
48 | 48 | */ |
49 | -function give_get_enabled_payment_gateways( $form_id = 0 ) { |
|
49 | +function give_get_enabled_payment_gateways($form_id = 0) { |
|
50 | 50 | |
51 | 51 | $gateways = give_get_payment_gateways(); |
52 | 52 | |
53 | - $enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
53 | + $enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
54 | 54 | |
55 | 55 | $gateway_list = array(); |
56 | 56 | |
57 | - foreach ( $gateways as $key => $gateway ) { |
|
58 | - if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) { |
|
59 | - $gateway_list[ $key ] = $gateway; |
|
57 | + foreach ($gateways as $key => $gateway) { |
|
58 | + if (isset($enabled[$key]) && $enabled[$key] == 1) { |
|
59 | + $gateway_list[$key] = $gateway; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Set order of payment gateway in list. |
64 | - $gateway_list = give_get_ordered_payment_gateways( $gateway_list ); |
|
64 | + $gateway_list = give_get_ordered_payment_gateways($gateway_list); |
|
65 | 65 | |
66 | - return apply_filters( 'give_enabled_payment_gateways', $gateway_list, $form_id ); |
|
66 | + return apply_filters('give_enabled_payment_gateways', $gateway_list, $form_id); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return boolean true if enabled, false otherwise |
77 | 77 | */ |
78 | -function give_is_gateway_active( $gateway ) { |
|
78 | +function give_is_gateway_active($gateway) { |
|
79 | 79 | $gateways = give_get_enabled_payment_gateways(); |
80 | 80 | |
81 | - $ret = array_key_exists( $gateway, $gateways ); |
|
81 | + $ret = array_key_exists($gateway, $gateways); |
|
82 | 82 | |
83 | - return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways ); |
|
83 | + return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -92,23 +92,23 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return string Gateway ID |
94 | 94 | */ |
95 | -function give_get_default_gateway( $form_id ) { |
|
95 | +function give_get_default_gateway($form_id) { |
|
96 | 96 | |
97 | 97 | $give_options = give_get_settings(); |
98 | - $default = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | - $form_default = give_get_meta( $form_id, '_give_default_gateway', true ); |
|
98 | + $default = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | + $form_default = give_get_meta($form_id, '_give_default_gateway', true); |
|
100 | 100 | |
101 | 101 | // Single Form settings varies compared to the Global default settings. |
102 | - if ( ! empty( $form_default ) && |
|
102 | + if ( ! empty($form_default) && |
|
103 | 103 | $form_id !== null && |
104 | 104 | $default !== $form_default && |
105 | 105 | $form_default !== 'global' && |
106 | - give_is_gateway_active( $form_default ) |
|
106 | + give_is_gateway_active($form_default) |
|
107 | 107 | ) { |
108 | 108 | $default = $form_default; |
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters( 'give_default_gateway', $default ); |
|
111 | + return apply_filters('give_default_gateway', $default); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -120,18 +120,18 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string Gateway admin label |
122 | 122 | */ |
123 | -function give_get_gateway_admin_label( $gateway ) { |
|
123 | +function give_get_gateway_admin_label($gateway) { |
|
124 | 124 | $gateways = give_get_payment_gateways(); |
125 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway; |
|
126 | - $payment = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false; |
|
125 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway; |
|
126 | + $payment = isset($_GET['id']) ? absint($_GET['id']) : false; |
|
127 | 127 | |
128 | - if ( $gateway == 'manual' && $payment ) { |
|
129 | - if ( give_get_payment_amount( $payment ) == 0 ) { |
|
130 | - $label = __( 'Test Donation', 'give' ); |
|
128 | + if ($gateway == 'manual' && $payment) { |
|
129 | + if (give_get_payment_amount($payment) == 0) { |
|
130 | + $label = __('Test Donation', 'give'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( 'give_gateway_admin_label', $label, $gateway ); |
|
134 | + return apply_filters('give_gateway_admin_label', $label, $gateway); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return string Checkout label for the gateway |
145 | 145 | */ |
146 | -function give_get_gateway_checkout_label( $gateway ) { |
|
146 | +function give_get_gateway_checkout_label($gateway) { |
|
147 | 147 | $gateways = give_get_payment_gateways(); |
148 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway; |
|
148 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway; |
|
149 | 149 | |
150 | - if ( $gateway == 'manual' ) { |
|
151 | - $label = __( 'Test Donation', 'give' ); |
|
150 | + if ($gateway == 'manual') { |
|
151 | + $label = __('Test Donation', 'give'); |
|
152 | 152 | } |
153 | 153 | |
154 | - return apply_filters( 'give_gateway_checkout_label', $label, $gateway ); |
|
154 | + return apply_filters('give_gateway_checkout_label', $label, $gateway); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return array Options the gateway supports |
165 | 165 | */ |
166 | -function give_get_gateway_supports( $gateway ) { |
|
166 | +function give_get_gateway_supports($gateway) { |
|
167 | 167 | $gateways = give_get_enabled_payment_gateways(); |
168 | - $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array(); |
|
168 | + $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array(); |
|
169 | 169 | |
170 | - return apply_filters( 'give_gateway_supports', $supports, $gateway ); |
|
170 | + return apply_filters('give_gateway_supports', $supports, $gateway); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return void |
182 | 182 | */ |
183 | -function give_send_to_gateway( $gateway, $payment_data ) { |
|
183 | +function give_send_to_gateway($gateway, $payment_data) { |
|
184 | 184 | |
185 | - $payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' ); |
|
185 | + $payment_data['gateway_nonce'] = wp_create_nonce('give-gateway'); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Fires while loading payment gateway via AJAX. |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param array $payment_data All the payment data to be sent to the gateway. |
195 | 195 | */ |
196 | - do_action( "give_gateway_{$gateway}", $payment_data ); |
|
196 | + do_action("give_gateway_{$gateway}", $payment_data); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -207,34 +207,34 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return string $enabled_gateway The slug of the gateway |
209 | 209 | */ |
210 | -function give_get_chosen_gateway( $form_id ) { |
|
210 | +function give_get_chosen_gateway($form_id) { |
|
211 | 211 | |
212 | - $request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0; |
|
212 | + $request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0; |
|
213 | 213 | |
214 | 214 | // Back to check if 'form-id' is present. |
215 | - if ( empty( $request_form_id ) ) { |
|
216 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0; |
|
215 | + if (empty($request_form_id)) { |
|
216 | + $request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0; |
|
217 | 217 | } |
218 | 218 | |
219 | - $request_payment_mode = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : ''; |
|
219 | + $request_payment_mode = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : ''; |
|
220 | 220 | $chosen = false; |
221 | 221 | |
222 | 222 | // If both 'payment-mode' and 'form-id' then set for only this form. |
223 | - if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) { |
|
223 | + if ( ! empty($request_form_id) && $form_id == $request_form_id) { |
|
224 | 224 | $chosen = $request_payment_mode; |
225 | - } elseif ( empty( $request_form_id ) && $request_payment_mode ) { |
|
225 | + } elseif (empty($request_form_id) && $request_payment_mode) { |
|
226 | 226 | // If no 'form-id' but there is 'payment-mode'. |
227 | 227 | $chosen = $request_payment_mode; |
228 | 228 | } |
229 | 229 | |
230 | 230 | // Get the enable gateway based of chosen var. |
231 | - if ( $chosen && give_is_gateway_active( $chosen ) ) { |
|
232 | - $enabled_gateway = urldecode( $chosen ); |
|
231 | + if ($chosen && give_is_gateway_active($chosen)) { |
|
232 | + $enabled_gateway = urldecode($chosen); |
|
233 | 233 | } else { |
234 | - $enabled_gateway = give_get_default_gateway( $form_id ); |
|
234 | + $enabled_gateway = give_get_default_gateway($form_id); |
|
235 | 235 | } |
236 | 236 | |
237 | - return apply_filters( 'give_chosen_gateway', $enabled_gateway ); |
|
237 | + return apply_filters('give_chosen_gateway', $enabled_gateway); |
|
238 | 238 | |
239 | 239 | } |
240 | 240 | |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return int ID of the new log entry |
254 | 254 | */ |
255 | -function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) { |
|
256 | - return give_record_log( $title, $message, $parent, 'gateway_error' ); |
|
255 | +function give_record_gateway_error($title = '', $message = '', $parent = 0) { |
|
256 | + return give_record_log($title, $message, $parent, 'gateway_error'); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @return int |
268 | 268 | */ |
269 | -function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
|
269 | +function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') { |
|
270 | 270 | |
271 | 271 | $ret = 0; |
272 | 272 | $args = array( |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | 'fields' => 'ids', |
279 | 279 | ); |
280 | 280 | |
281 | - $payments = new WP_Query( $args ); |
|
281 | + $payments = new WP_Query($args); |
|
282 | 282 | |
283 | - if ( $payments ) { |
|
283 | + if ($payments) { |
|
284 | 284 | $ret = $payments->post_count; |
285 | 285 | } |
286 | 286 | |
@@ -297,27 +297,27 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return array $gateways All the available gateways |
299 | 299 | */ |
300 | -function give_get_ordered_payment_gateways( $gateways ) { |
|
300 | +function give_get_ordered_payment_gateways($gateways) { |
|
301 | 301 | |
302 | 302 | // Get gateways setting. |
303 | - $gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
303 | + $gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
304 | 304 | |
305 | 305 | // Return from here if we do not have gateways setting. |
306 | - if ( empty( $gateways_setting ) ) { |
|
306 | + if (empty($gateways_setting)) { |
|
307 | 307 | return $gateways; |
308 | 308 | } |
309 | 309 | |
310 | 310 | // Reverse array to order payment gateways. |
311 | - $gateways_setting = array_reverse( $gateways_setting ); |
|
311 | + $gateways_setting = array_reverse($gateways_setting); |
|
312 | 312 | |
313 | 313 | // Reorder gateways array |
314 | - foreach ( $gateways_setting as $gateway_key => $value ) { |
|
314 | + foreach ($gateways_setting as $gateway_key => $value) { |
|
315 | 315 | |
316 | - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; |
|
317 | - unset( $gateways[ $gateway_key ] ); |
|
316 | + $new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : ''; |
|
317 | + unset($gateways[$gateway_key]); |
|
318 | 318 | |
319 | - if ( ! empty( $new_gateway_value ) ) { |
|
320 | - $gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways ); |
|
319 | + if ( ! empty($new_gateway_value)) { |
|
320 | + $gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -328,5 +328,5 @@ discard block |
||
328 | 328 | * |
329 | 329 | * @param array $gateways All the available gateways |
330 | 330 | */ |
331 | - return apply_filters( 'give_payment_gateways_order', $gateways ); |
|
331 | + return apply_filters('give_payment_gateways_order', $gateways); |
|
332 | 332 | } |
333 | 333 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Exit if accessed directly. |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | * 'testing' => false, // (required) Never leave as "true" in production!!! |
33 | 33 | * } |
34 | 34 | */ |
35 | - function __construct( $_banner_details ) { |
|
35 | + function __construct($_banner_details) { |
|
36 | 36 | $current_user = wp_get_current_user(); |
37 | 37 | |
38 | 38 | $this->plugin_activate_by = 0; |
39 | 39 | $this->banner_details = $_banner_details; |
40 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
41 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
42 | - $this->activate_by_meta_key = 'give_addon_' . sanitize_title( $this->banner_details['name'] ) . '_active_by_user'; |
|
40 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
41 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
42 | + $this->activate_by_meta_key = 'give_addon_'.sanitize_title($this->banner_details['name']).'_active_by_user'; |
|
43 | 43 | |
44 | 44 | //Get current user |
45 | 45 | $this->user_id = $current_user->ID; |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | public function init() { |
63 | 63 | |
64 | 64 | //Testing? |
65 | - if ( $this->test_mode ) { |
|
66 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
65 | + if ($this->test_mode) { |
|
66 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | //Get the current page to add the notice to |
70 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
71 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
70 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
71 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
72 | 72 | |
73 | 73 | // File path of addon must be included in banner detail other addon activate meta will not delete. |
74 | 74 | $file_name = $this->get_plugin_file_name(); |
75 | 75 | |
76 | - if ( ! empty( $file_name ) ) { |
|
77 | - add_action( 'deactivate_' . $file_name, array( $this, 'remove_addon_activate_meta' ) ); |
|
76 | + if ( ! empty($file_name)) { |
|
77 | + add_action('deactivate_'.$file_name, array($this, 'remove_addon_activate_meta')); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | private function is_plugin_page() { |
90 | 90 | $screen = get_current_screen(); |
91 | 91 | |
92 | - return ( $screen->parent_file === 'plugins.php' ); |
|
92 | + return ($screen->parent_file === 'plugins.php'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | public function give_addon_activation_admin_notice() { |
103 | 103 | |
104 | 104 | // Bailout. |
105 | - if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by ) { |
|
105 | + if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | |
109 | 109 | // If the user hasn't already dismissed the alert, output activation banner. |
110 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { |
|
110 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { |
|
111 | 111 | |
112 | 112 | // Output inline styles here because there's no reason |
113 | 113 | // to enqueued them after the alert is dismissed. |
@@ -189,44 +189,44 @@ discard block |
||
189 | 189 | <h3><?php |
190 | 190 | printf( |
191 | 191 | /* translators: %s: Add-on name */ |
192 | - esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
193 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
192 | + esc_html__("Thank you for installing Give's %s Add-on!", 'give'), |
|
193 | + '<span>'.$this->banner_details['name'].'</span>' |
|
194 | 194 | ); |
195 | 195 | ?></h3> |
196 | 196 | |
197 | 197 | <a href="<?php |
198 | 198 | //The Dismiss Button. |
199 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
200 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span |
|
199 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
200 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span |
|
201 | 201 | class="dashicons dashicons-dismiss"></span></a> |
202 | 202 | |
203 | 203 | <div class="alert-actions"> |
204 | 204 | |
205 | 205 | <?php //Point them to your settings page. |
206 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
206 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
207 | 207 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
208 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?> |
|
208 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?> |
|
209 | 209 | </a> |
210 | 210 | <?php } ?> |
211 | 211 | |
212 | 212 | <?php |
213 | 213 | // Show them how to configure the Addon. |
214 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
214 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
215 | 215 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
216 | 216 | <span class="dashicons dashicons-media-text"></span><?php |
217 | 217 | printf( |
218 | 218 | /* translators: %s: Add-on name */ |
219 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
219 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
220 | 220 | $this->banner_details['name'] |
221 | 221 | ); |
222 | 222 | ?></a> |
223 | 223 | <?php } ?> |
224 | 224 | <?php |
225 | 225 | //Let them signup for plugin updates |
226 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
226 | + if (isset($this->banner_details['support_url'])) { ?> |
|
227 | 227 | |
228 | 228 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
229 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
229 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
230 | 230 | </a> |
231 | 231 | |
232 | 232 | <?php } ?> |
@@ -253,13 +253,13 @@ discard block |
||
253 | 253 | * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
254 | 254 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
255 | 255 | */ |
256 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
256 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
257 | 257 | |
258 | 258 | //Get the global user |
259 | 259 | $current_user = wp_get_current_user(); |
260 | 260 | $user_id = $current_user->ID; |
261 | 261 | |
262 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
262 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | * @access private |
271 | 271 | */ |
272 | 272 | private function add_addon_activate_meta() { |
273 | - $user_id = get_option( $this->activate_by_meta_key ); |
|
273 | + $user_id = get_option($this->activate_by_meta_key); |
|
274 | 274 | $this->plugin_activate_by = (int) $user_id; |
275 | 275 | |
276 | - if ( ! $user_id ) { |
|
277 | - add_option( $this->activate_by_meta_key, $this->user_id, '', 'no' ); |
|
276 | + if ( ! $user_id) { |
|
277 | + add_option($this->activate_by_meta_key, $this->user_id, '', 'no'); |
|
278 | 278 | $this->plugin_activate_by = (int) $this->user_id; |
279 | 279 | } |
280 | 280 | } |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | * @access public |
288 | 288 | */ |
289 | 289 | public function remove_addon_activate_meta() { |
290 | - $user_id = get_option( $this->activate_by_meta_key ); |
|
290 | + $user_id = get_option($this->activate_by_meta_key); |
|
291 | 291 | |
292 | - if ( $user_id ) { |
|
293 | - delete_option( $this->activate_by_meta_key ); |
|
292 | + if ($user_id) { |
|
293 | + delete_option($this->activate_by_meta_key); |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
@@ -303,39 +303,39 @@ discard block |
||
303 | 303 | * @return mixed |
304 | 304 | */ |
305 | 305 | private function get_plugin_file_name() { |
306 | - $active_plugins = get_option( 'active_plugins' ); |
|
306 | + $active_plugins = get_option('active_plugins'); |
|
307 | 307 | $file_name = ''; |
308 | 308 | |
309 | 309 | try { |
310 | 310 | |
311 | 311 | // Check addon file path. |
312 | - if ( ! empty( $this->banner_details['file'] ) ) { |
|
312 | + if ( ! empty($this->banner_details['file'])) { |
|
313 | 313 | $file_name = ''; |
314 | - if ( $file_path = explode( '/plugins/', $this->banner_details['file'] ) ) { |
|
315 | - $file_path = array_pop( $file_path ); |
|
316 | - $file_name = current( explode( '/', $file_path ) ); |
|
314 | + if ($file_path = explode('/plugins/', $this->banner_details['file'])) { |
|
315 | + $file_path = array_pop($file_path); |
|
316 | + $file_name = current(explode('/', $file_path)); |
|
317 | 317 | } |
318 | 318 | |
319 | - if ( empty( $file_name ) ) { |
|
319 | + if (empty($file_name)) { |
|
320 | 320 | return false; |
321 | 321 | } |
322 | 322 | |
323 | - foreach ( $active_plugins as $plugin ) { |
|
324 | - if ( false !== strpos( $plugin, $file_name ) ) { |
|
323 | + foreach ($active_plugins as $plugin) { |
|
324 | + if (false !== strpos($plugin, $file_name)) { |
|
325 | 325 | $file_name = $plugin; |
326 | 326 | break; |
327 | 327 | } |
328 | 328 | } |
329 | - } elseif ( WP_DEBUG ) { |
|
330 | - throw new Exception( __( "File path must be added within the {$this->banner_details['name']} add-on in the banner details.", 'give' ) ); |
|
329 | + } elseif (WP_DEBUG) { |
|
330 | + throw new Exception(__("File path must be added within the {$this->banner_details['name']} add-on in the banner details.", 'give')); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | // Check plugin path calculated by addon file path. |
334 | - if ( empty( $file_name ) && WP_DEBUG ) { |
|
335 | - throw new Exception( __( "Empty add-on plugin path for {$this->banner_details['name']} add-on.", 'give' ) ); |
|
334 | + if (empty($file_name) && WP_DEBUG) { |
|
335 | + throw new Exception(__("Empty add-on plugin path for {$this->banner_details['name']} add-on.", 'give')); |
|
336 | 336 | } |
337 | 337 | |
338 | - } catch ( Exception $e ) { |
|
338 | + } catch (Exception $e) { |
|
339 | 339 | echo $e->getMessage(); |
340 | 340 | } |
341 | 341 |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | 'disabled' => __( 'Disabled', 'give' ), |
88 | 88 | ) |
89 | 89 | ), |
90 | - array( |
|
91 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
92 | - 'id' => 'display_settings_docs_link', |
|
93 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
94 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
95 | - 'type' => 'give_docs_link', |
|
96 | - ), |
|
90 | + array( |
|
91 | + 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
92 | + 'id' => 'display_settings_docs_link', |
|
93 | + 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
94 | + 'title' => __( 'Display Options Settings', 'give' ), |
|
95 | + 'type' => 'give_docs_link', |
|
96 | + ), |
|
97 | 97 | array( |
98 | 98 | 'id' => 'give_title_display_settings_1', |
99 | 99 | 'type' => 'sectionend' |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | 'disabled' => __( 'Disabled', 'give' ), |
171 | 171 | ) |
172 | 172 | ), |
173 | - array( |
|
174 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
175 | - 'id' => 'post_types_settings_docs_link', |
|
176 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
177 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
178 | - 'type' => 'give_docs_link', |
|
179 | - ), |
|
173 | + array( |
|
174 | + 'name' => __( 'Post Types Docs Link', 'give' ), |
|
175 | + 'id' => 'post_types_settings_docs_link', |
|
176 | + 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
177 | + 'title' => __( 'Post Types Settings', 'give' ), |
|
178 | + 'type' => 'give_docs_link', |
|
179 | + ), |
|
180 | 180 | array( |
181 | 181 | 'id' => 'give_title_display_settings_2', |
182 | 182 | 'type' => 'sectionend' |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | 'disabled' => __( 'Disabled', 'give' ), |
213 | 213 | ) |
214 | 214 | ), |
215 | - array( |
|
216 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
217 | - 'id' => 'taxonomies_settings_docs_link', |
|
218 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
219 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
220 | - 'type' => 'give_docs_link', |
|
221 | - ), |
|
215 | + array( |
|
216 | + 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
217 | + 'id' => 'taxonomies_settings_docs_link', |
|
218 | + 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
219 | + 'title' => __( 'Taxonomies Settings', 'give' ), |
|
220 | + 'type' => 'give_docs_link', |
|
221 | + ), |
|
222 | 222 | array( |
223 | 223 | 'id' => 'give_title_display_settings_3', |
224 | 224 | 'type' => 'sectionend' |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | 'id' => 'agreement_text', |
259 | 259 | 'type' => 'wysiwyg' |
260 | 260 | ), |
261 | - array( |
|
262 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
263 | - 'id' => 'terms_settings_docs_link', |
|
264 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
265 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
266 | - 'type' => 'give_docs_link', |
|
267 | - ), |
|
261 | + array( |
|
262 | + 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
263 | + 'id' => 'terms_settings_docs_link', |
|
264 | + 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
265 | + 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
266 | + 'type' => 'give_docs_link', |
|
267 | + ), |
|
268 | 268 | array( |
269 | 269 | 'id' => 'give_title_display_settings_4', |
270 | 270 | '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_Display' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Display')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Display. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'display'; |
30 | - $this->label = __( 'Display Options', 'give' ); |
|
30 | + $this->label = __('Display Options', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'display-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'display-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Display |
@@ -53,45 +53,45 @@ discard block |
||
53 | 53 | 'type' => 'title' |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'Default Give Styles', 'give' ), |
|
57 | - 'desc' => __( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ), |
|
56 | + 'name' => __('Default Give Styles', 'give'), |
|
57 | + 'desc' => __('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'), |
|
58 | 58 | 'id' => 'css', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'enabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Enabled', 'give' ), |
|
63 | - 'disabled' => __( 'Disabled', 'give' ), |
|
62 | + 'enabled' => __('Enabled', 'give'), |
|
63 | + 'disabled' => __('Disabled', 'give'), |
|
64 | 64 | ) |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'Floating Labels', 'give' ), |
|
67 | + 'name' => __('Floating Labels', 'give'), |
|
68 | 68 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
69 | - 'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
69 | + 'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
70 | 70 | 'id' => 'floatlabels', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'default' => 'disabled', |
73 | 73 | 'options' => array( |
74 | - 'enabled' => __( 'Enabled', 'give' ), |
|
75 | - 'disabled' => __( 'Disabled', 'give' ), |
|
74 | + 'enabled' => __('Enabled', 'give'), |
|
75 | + 'disabled' => __('Disabled', 'give'), |
|
76 | 76 | ) |
77 | 77 | ), |
78 | 78 | array( |
79 | - 'name' => __( 'Welcome Screen', 'give' ), |
|
79 | + 'name' => __('Welcome Screen', 'give'), |
|
80 | 80 | /* translators: %s: about page URL */ |
81 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
81 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))), |
|
82 | 82 | 'id' => 'welcome', |
83 | 83 | 'type' => 'radio_inline', |
84 | 84 | 'default' => 'enabled', |
85 | 85 | 'options' => array( |
86 | - 'enabled' => __( 'Enabled', 'give' ), |
|
87 | - 'disabled' => __( 'Disabled', 'give' ), |
|
86 | + 'enabled' => __('Enabled', 'give'), |
|
87 | + 'disabled' => __('Disabled', 'give'), |
|
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | array( |
91 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
91 | + 'name' => __('Display Settings Docs Link', 'give'), |
|
92 | 92 | 'id' => 'display_settings_docs_link', |
93 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
94 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
93 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
94 | + 'title' => __('Display Options Settings', 'give'), |
|
95 | 95 | 'type' => 'give_docs_link', |
96 | 96 | ), |
97 | 97 | array( |
@@ -108,73 +108,73 @@ discard block |
||
108 | 108 | 'type' => 'title' |
109 | 109 | ), |
110 | 110 | array( |
111 | - 'name' => __( 'Form Single Views', 'give' ), |
|
112 | - 'desc' => __( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
111 | + 'name' => __('Form Single Views', 'give'), |
|
112 | + 'desc' => __('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
113 | 113 | 'id' => 'forms_singular', |
114 | 114 | 'type' => 'radio_inline', |
115 | 115 | 'default' => 'enabled', |
116 | 116 | 'options' => array( |
117 | - 'enabled' => __( 'Enabled', 'give' ), |
|
118 | - 'disabled' => __( 'Disabled', 'give' ), |
|
117 | + 'enabled' => __('Enabled', 'give'), |
|
118 | + 'disabled' => __('Disabled', 'give'), |
|
119 | 119 | ) |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Form Archives', 'give' ), |
|
123 | - 'desc' => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
122 | + 'name' => __('Form Archives', 'give'), |
|
123 | + 'desc' => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('options-permalink.php'))), |
|
124 | 124 | 'id' => 'forms_archives', |
125 | 125 | 'type' => 'radio_inline', |
126 | 126 | 'default' => 'enabled', |
127 | 127 | 'options' => array( |
128 | - 'enabled' => __( 'Enabled', 'give' ), |
|
129 | - 'disabled' => __( 'Disabled', 'give' ), |
|
128 | + 'enabled' => __('Enabled', 'give'), |
|
129 | + 'disabled' => __('Disabled', 'give'), |
|
130 | 130 | ) |
131 | 131 | ), |
132 | 132 | array( |
133 | - 'name' => __( 'Form Excerpts', 'give' ), |
|
134 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
133 | + 'name' => __('Form Excerpts', 'give'), |
|
134 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
135 | 135 | 'id' => 'forms_excerpt', |
136 | 136 | 'type' => 'radio_inline', |
137 | 137 | 'default' => 'enabled', |
138 | 138 | 'options' => array( |
139 | - 'enabled' => __( 'Enabled', 'give' ), |
|
140 | - 'disabled' => __( 'Disabled', 'give' ), |
|
139 | + 'enabled' => __('Enabled', 'give'), |
|
140 | + 'disabled' => __('Disabled', 'give'), |
|
141 | 141 | ) |
142 | 142 | ), |
143 | 143 | array( |
144 | - 'name' => __( 'Form Featured Image', 'give' ), |
|
145 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
144 | + 'name' => __('Form Featured Image', 'give'), |
|
145 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
146 | 146 | 'id' => 'form_featured_img', |
147 | 147 | 'type' => 'radio_inline', |
148 | 148 | 'default' => 'enabled', |
149 | 149 | 'options' => array( |
150 | - 'enabled' => __( 'Enabled', 'give' ), |
|
151 | - 'disabled' => __( 'Disabled', 'give' ), |
|
150 | + 'enabled' => __('Enabled', 'give'), |
|
151 | + 'disabled' => __('Disabled', 'give'), |
|
152 | 152 | ) |
153 | 153 | ), |
154 | 154 | array( |
155 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
156 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
155 | + 'name' => __('Featured Image Size', 'give'), |
|
156 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
157 | 157 | 'id' => 'featured_image_size', |
158 | 158 | 'type' => 'select', |
159 | 159 | 'default' => 'large', |
160 | 160 | 'options' => give_get_featured_image_sizes() |
161 | 161 | ), |
162 | 162 | array( |
163 | - 'name' => __( 'Single Form Sidebar', 'give' ), |
|
164 | - 'desc' => __( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
163 | + 'name' => __('Single Form Sidebar', 'give'), |
|
164 | + 'desc' => __('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
165 | 165 | 'id' => 'form_sidebar', |
166 | 166 | 'type' => 'radio_inline', |
167 | 167 | 'default' => 'enabled', |
168 | 168 | 'options' => array( |
169 | - 'enabled' => __( 'Enabled', 'give' ), |
|
170 | - 'disabled' => __( 'Disabled', 'give' ), |
|
169 | + 'enabled' => __('Enabled', 'give'), |
|
170 | + 'disabled' => __('Disabled', 'give'), |
|
171 | 171 | ) |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
174 | + 'name' => __('Post Types Docs Link', 'give'), |
|
175 | 175 | 'id' => 'post_types_settings_docs_link', |
176 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
177 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
176 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
177 | + 'title' => __('Post Types Settings', 'give'), |
|
178 | 178 | 'type' => 'give_docs_link', |
179 | 179 | ), |
180 | 180 | array( |
@@ -191,32 +191,32 @@ discard block |
||
191 | 191 | 'type' => 'title' |
192 | 192 | ), |
193 | 193 | array( |
194 | - 'name' => __( 'Form Categories', 'give' ), |
|
195 | - 'desc' => __( 'Enable Categories for all Give forms.', 'give' ), |
|
194 | + 'name' => __('Form Categories', 'give'), |
|
195 | + 'desc' => __('Enable Categories for all Give forms.', 'give'), |
|
196 | 196 | 'id' => 'categories', |
197 | 197 | 'type' => 'radio_inline', |
198 | 198 | 'default' => 'disabled', |
199 | 199 | 'options' => array( |
200 | - 'enabled' => __( 'Enabled', 'give' ), |
|
201 | - 'disabled' => __( 'Disabled', 'give' ), |
|
200 | + 'enabled' => __('Enabled', 'give'), |
|
201 | + 'disabled' => __('Disabled', 'give'), |
|
202 | 202 | ) |
203 | 203 | ), |
204 | 204 | array( |
205 | - 'name' => __( 'Form Tags', 'give' ), |
|
206 | - 'desc' => __( 'Enable Tags for all Give forms.', 'give' ), |
|
205 | + 'name' => __('Form Tags', 'give'), |
|
206 | + 'desc' => __('Enable Tags for all Give forms.', 'give'), |
|
207 | 207 | 'id' => 'tags', |
208 | 208 | 'type' => 'radio_inline', |
209 | 209 | 'default' => 'disabled', |
210 | 210 | 'options' => array( |
211 | - 'enabled' => __( 'Enabled', 'give' ), |
|
212 | - 'disabled' => __( 'Disabled', 'give' ), |
|
211 | + 'enabled' => __('Enabled', 'give'), |
|
212 | + 'disabled' => __('Disabled', 'give'), |
|
213 | 213 | ) |
214 | 214 | ), |
215 | 215 | array( |
216 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
216 | + 'name' => __('Taxonomies Docs Link', 'give'), |
|
217 | 217 | 'id' => 'taxonomies_settings_docs_link', |
218 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
219 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
218 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
219 | + 'title' => __('Taxonomies Settings', 'give'), |
|
220 | 220 | 'type' => 'give_docs_link', |
221 | 221 | ), |
222 | 222 | array( |
@@ -233,36 +233,36 @@ discard block |
||
233 | 233 | 'type' => 'title' |
234 | 234 | ), |
235 | 235 | array( |
236 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
237 | - 'desc' => __( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ), |
|
236 | + 'name' => __('Terms and Conditions', 'give'), |
|
237 | + 'desc' => __('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'), |
|
238 | 238 | 'id' => 'terms', |
239 | 239 | 'type' => 'radio_inline', |
240 | 240 | 'default' => 'disabled', |
241 | 241 | 'options' => array( |
242 | - 'enabled' => __( 'Enabled', 'give' ), |
|
243 | - 'disabled' => __( 'Disabled', 'give' ), |
|
242 | + 'enabled' => __('Enabled', 'give'), |
|
243 | + 'disabled' => __('Disabled', 'give'), |
|
244 | 244 | ) |
245 | 245 | ), |
246 | 246 | array( |
247 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
248 | - 'desc' => __( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ), |
|
247 | + 'name' => __('Agree to Terms Label', 'give'), |
|
248 | + 'desc' => __('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'), |
|
249 | 249 | 'id' => 'agree_to_terms_label', |
250 | 250 | 'attributes' => array( |
251 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
251 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
252 | 252 | ), |
253 | 253 | 'type' => 'text' |
254 | 254 | ), |
255 | 255 | array( |
256 | - 'name' => __( 'Agreement Text', 'give' ), |
|
257 | - 'desc' => __( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ), |
|
256 | + 'name' => __('Agreement Text', 'give'), |
|
257 | + 'desc' => __('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'), |
|
258 | 258 | 'id' => 'agreement_text', |
259 | 259 | 'type' => 'wysiwyg' |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
262 | + 'name' => __('Terms and Conditions Docs Link', 'give'), |
|
263 | 263 | 'id' => 'terms_settings_docs_link', |
264 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
265 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
264 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
265 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
266 | 266 | 'type' => 'give_docs_link', |
267 | 267 | ), |
268 | 268 | array( |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * Filter the display options settings. |
278 | 278 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
279 | 279 | */ |
280 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
280 | + $settings = apply_filters('give_settings_display', $settings); |
|
281 | 281 | |
282 | 282 | /** |
283 | 283 | * Filter the settings. |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @since 1.8 |
286 | 286 | * @param array $settings |
287 | 287 | */ |
288 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
288 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
289 | 289 | |
290 | 290 | // Output. |
291 | 291 | return $settings; |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function get_sections() { |
301 | 301 | $sections = array( |
302 | - 'display-settings' => __( 'Display', 'give' ), |
|
303 | - 'post-types' => __( 'Post Types', 'give' ), |
|
304 | - 'taxonomies' => __( 'Taxonomies', 'give' ), |
|
305 | - 'term-and-conditions' => __( 'Terms and Conditions', 'give' ) |
|
302 | + 'display-settings' => __('Display', 'give'), |
|
303 | + 'post-types' => __('Post Types', 'give'), |
|
304 | + 'taxonomies' => __('Taxonomies', 'give'), |
|
305 | + 'term-and-conditions' => __('Terms and Conditions', 'give') |
|
306 | 306 | ); |
307 | 307 | |
308 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
308 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 |
@@ -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 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -53,49 +53,49 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_data() { |
55 | 55 | |
56 | - if ( $this->step == 1 ) { |
|
57 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
56 | + if ($this->step == 1) { |
|
57 | + $this->delete_data('give_temp_recount_earnings'); |
|
58 | 58 | } |
59 | 59 | |
60 | - $total = get_option( 'give_temp_recount_earnings', false ); |
|
60 | + $total = get_option('give_temp_recount_earnings', false); |
|
61 | 61 | |
62 | - if ( false === $total ) { |
|
62 | + if (false === $total) { |
|
63 | 63 | $total = (float) 0; |
64 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
64 | + $this->store_data('give_temp_recount_earnings', $total); |
|
65 | 65 | } |
66 | 66 | |
67 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
67 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
68 | 68 | |
69 | - $args = apply_filters( 'give_recount_earnings_args', array( |
|
69 | + $args = apply_filters('give_recount_earnings_args', array( |
|
70 | 70 | 'number' => $this->per_step, |
71 | 71 | 'page' => $this->step, |
72 | 72 | 'status' => $accepted_statuses, |
73 | 73 | 'fields' => 'ids' |
74 | - ) ); |
|
74 | + )); |
|
75 | 75 | |
76 | - $payments = give_get_payments( $args ); |
|
76 | + $payments = give_get_payments($args); |
|
77 | 77 | |
78 | - if ( ! empty( $payments ) ) { |
|
78 | + if ( ! empty($payments)) { |
|
79 | 79 | |
80 | - foreach ( $payments as $payment ) { |
|
80 | + foreach ($payments as $payment) { |
|
81 | 81 | |
82 | - $total += give_get_payment_amount( $payment ); |
|
82 | + $total += give_get_payment_amount($payment); |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
86 | - if ( $total < 0 ) { |
|
86 | + if ($total < 0) { |
|
87 | 87 | $totals = 0; |
88 | 88 | } |
89 | 89 | |
90 | - $total = round( $total, give_currency_decimal_filter() ); |
|
90 | + $total = round($total, give_currency_decimal_filter()); |
|
91 | 91 | |
92 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
92 | + $this->store_data('give_temp_recount_earnings', $total); |
|
93 | 93 | |
94 | 94 | return true; |
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | - update_option( 'give_earnings_total', $total ); |
|
98 | + update_option('give_earnings_total', $total); |
|
99 | 99 | |
100 | 100 | return false; |
101 | 101 | |
@@ -109,25 +109,25 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function get_percentage_complete() { |
111 | 111 | |
112 | - $total = $this->get_stored_data( 'give_recount_earnings_total' ); |
|
112 | + $total = $this->get_stored_data('give_recount_earnings_total'); |
|
113 | 113 | |
114 | - if ( false === $total ) { |
|
115 | - $args = apply_filters( 'give_recount_earnings_total_args', array() ); |
|
114 | + if (false === $total) { |
|
115 | + $args = apply_filters('give_recount_earnings_total_args', array()); |
|
116 | 116 | |
117 | - $counts = give_count_payments( $args ); |
|
118 | - $total = absint( $counts->publish ); |
|
119 | - $total = apply_filters( 'give_recount_store_earnings_total', $total ); |
|
117 | + $counts = give_count_payments($args); |
|
118 | + $total = absint($counts->publish); |
|
119 | + $total = apply_filters('give_recount_store_earnings_total', $total); |
|
120 | 120 | |
121 | - $this->store_data( 'give_recount_earnings_total', $total ); |
|
121 | + $this->store_data('give_recount_earnings_total', $total); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $percentage = 100; |
125 | 125 | |
126 | - if ( $total > 0 ) { |
|
127 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
126 | + if ($total > 0) { |
|
127 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
128 | 128 | } |
129 | 129 | |
130 | - if ( $percentage > 100 ) { |
|
130 | + if ($percentage > 100) { |
|
131 | 131 | $percentage = 100; |
132 | 132 | } |
133 | 133 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @param array $request The Form Data passed into the batch processing |
143 | 143 | */ |
144 | - public function set_properties( $request ) { |
|
144 | + public function set_properties($request) { |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -152,31 +152,31 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function process_step() { |
154 | 154 | |
155 | - if ( ! $this->can_export() ) { |
|
156 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
155 | + if ( ! $this->can_export()) { |
|
156 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $had_data = $this->get_data(); |
160 | 160 | |
161 | - if ( $had_data ) { |
|
161 | + if ($had_data) { |
|
162 | 162 | $this->done = false; |
163 | 163 | |
164 | 164 | return true; |
165 | 165 | } else { |
166 | - $this->delete_data( 'give_recount_earnings_total' ); |
|
167 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
166 | + $this->delete_data('give_recount_earnings_total'); |
|
167 | + $this->delete_data('give_temp_recount_earnings'); |
|
168 | 168 | $this->done = true; |
169 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
169 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
170 | 170 | |
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | 175 | public function headers() { |
176 | - ignore_user_abort( true ); |
|
176 | + ignore_user_abort(true); |
|
177 | 177 | |
178 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
179 | - set_time_limit( 0 ); |
|
178 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
179 | + set_time_limit(0); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return mixed Returns the data from the database |
206 | 206 | */ |
207 | - private function get_stored_data( $key ) { |
|
207 | + private function get_stored_data($key) { |
|
208 | 208 | global $wpdb; |
209 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
209 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
210 | 210 | |
211 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
211 | + return empty($value) ? false : maybe_unserialize($value); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return void |
223 | 223 | */ |
224 | - private function store_data( $key, $value ) { |
|
224 | + private function store_data($key, $value) { |
|
225 | 225 | global $wpdb; |
226 | 226 | |
227 | - $value = maybe_serialize( $value ); |
|
227 | + $value = maybe_serialize($value); |
|
228 | 228 | |
229 | 229 | $data = array( |
230 | 230 | 'option_name' => $key, |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | '%s', |
239 | 239 | ); |
240 | 240 | |
241 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
241 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return void |
252 | 252 | */ |
253 | - private function delete_data( $key ) { |
|
253 | + private function delete_data($key) { |
|
254 | 254 | global $wpdb; |
255 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
255 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | } |
@@ -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_Export' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Export')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Export. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'export'; |
46 | - $this->label = __( 'Export', 'give' ); |
|
46 | + $this->label = __('Export', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_tools_export', array( $this, 'render_export_field' ), 10, 2 ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_tools_export', array($this, 'render_export_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-tools_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-tools_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-tools_open_form', '__return_empty_string'); |
|
55 | + add_action('give-tools_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_export', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'export', |
98 | - 'name' => __( 'Export', 'give' ), |
|
98 | + 'name' => __('Export', 'give'), |
|
99 | 99 | 'type' => 'tools_export', |
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_export_field( $field, $option_value ) { |
|
135 | - include_once( 'views/html-admin-page-exports.php' ); |
|
134 | + public function render_export_field($field, $option_value) { |
|
135 | + include_once('views/html-admin-page-exports.php'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |