@@ -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 | /** |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | global $status, $page; |
57 | 57 | |
58 | 58 | // Set parent defaults |
59 | - parent::__construct( array( |
|
60 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
59 | + parent::__construct(array( |
|
60 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
61 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
62 | 62 | 'ajax' => false // Does this table support ajax? |
63 | - ) ); |
|
63 | + )); |
|
64 | 64 | |
65 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
65 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
66 | 66 | $this->query(); |
67 | 67 | |
68 | 68 | } |
@@ -78,32 +78,32 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string Column Name |
80 | 80 | */ |
81 | - public function column_default( $item, $column_name ) { |
|
82 | - switch ( $column_name ) { |
|
81 | + public function column_default($item, $column_name) { |
|
82 | + switch ($column_name) { |
|
83 | 83 | case 'title': |
84 | - $title = empty( $item['title'] ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item['ID'] ) : $item['title']; |
|
84 | + $title = empty($item['title']) ? sprintf(__('Untitled (#%s)', 'give'), $item['ID']) : $item['title']; |
|
85 | 85 | |
86 | 86 | return sprintf( |
87 | 87 | '<a href="%s">%s</a>', |
88 | - get_edit_post_link( $item['ID'] ), |
|
88 | + get_edit_post_link($item['ID']), |
|
89 | 89 | $title |
90 | 90 | ); |
91 | 91 | case 'sales': |
92 | 92 | return sprintf( |
93 | 93 | '<a href="%s">%s</a>', |
94 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . urlencode( $item['ID'] ) ), |
|
94 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.urlencode($item['ID'])), |
|
95 | 95 | $item['sales'] |
96 | 96 | ); |
97 | 97 | case 'earnings' : |
98 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
98 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
99 | 99 | case 'average_sales' : |
100 | - return round( $item[ $column_name ] ); |
|
100 | + return round($item[$column_name]); |
|
101 | 101 | case 'average_earnings' : |
102 | - return give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
102 | + return give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
103 | 103 | case 'details' : |
104 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>'; |
|
104 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>'; |
|
105 | 105 | default: |
106 | - return $item[ $column_name ]; |
|
106 | + return $item[$column_name]; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function get_columns() { |
119 | 119 | $columns = array( |
120 | - 'title' => esc_html__( 'Form', 'give' ), |
|
121 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
122 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
123 | - 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), |
|
124 | - 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), |
|
125 | - 'details' => esc_html__( 'Detailed Report', 'give' ) |
|
120 | + 'title' => esc_html__('Form', 'give'), |
|
121 | + 'sales' => esc_html__('Donations', 'give'), |
|
122 | + 'earnings' => esc_html__('Income', 'give'), |
|
123 | + 'average_sales' => esc_html__('Monthly Average Donations', 'give'), |
|
124 | + 'average_earnings' => esc_html__('Monthly Average Income', 'give'), |
|
125 | + 'details' => esc_html__('Detailed Report', 'give') |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | return $columns; |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function get_sortable_columns() { |
140 | 140 | return array( |
141 | - 'title' => array( 'title', true ), |
|
142 | - 'sales' => array( 'sales', false ), |
|
143 | - 'earnings' => array( 'earnings', false ), |
|
141 | + 'title' => array('title', true), |
|
142 | + 'sales' => array('sales', false), |
|
143 | + 'earnings' => array('earnings', false), |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return int Current page number |
154 | 154 | */ |
155 | 155 | public function get_paged() { |
156 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
156 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return int Category ID |
166 | 166 | */ |
167 | 167 | public function get_category() { |
168 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
168 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return void |
178 | 178 | */ |
179 | - public function bulk_actions( $which = '' ) { |
|
179 | + public function bulk_actions($which = '') { |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
@@ -188,27 +188,27 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param string $which |
190 | 190 | */ |
191 | - protected function display_tablenav( $which ) { |
|
191 | + protected function display_tablenav($which) { |
|
192 | 192 | |
193 | - if ( 'top' === $which ) { |
|
194 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
193 | + if ('top' === $which) { |
|
194 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
195 | 195 | } |
196 | 196 | ?> |
197 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
197 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
198 | 198 | |
199 | - <?php if ( 'top' === $which ) { ?> |
|
199 | + <?php if ('top' === $which) { ?> |
|
200 | 200 | <h2 class="alignleft reports-earnings-title screen-reader-text"> |
201 | - <?php _e( 'Donation Forms Report', 'give' ); ?> |
|
201 | + <?php _e('Donation Forms Report', 'give'); ?> |
|
202 | 202 | </h2> |
203 | 203 | <?php } ?> |
204 | 204 | |
205 | 205 | <div class="alignright tablenav-right"> |
206 | 206 | <div class="actions bulkactions"> |
207 | - <?php $this->bulk_actions( $which ); ?> |
|
207 | + <?php $this->bulk_actions($which); ?> |
|
208 | 208 | </div> |
209 | 209 | <?php |
210 | - $this->extra_tablenav( $which ); |
|
211 | - $this->pagination( $which ); |
|
210 | + $this->extra_tablenav($which); |
|
211 | + $this->pagination($which); |
|
212 | 212 | ?> |
213 | 213 | </div> |
214 | 214 | |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function category_filter() { |
230 | 230 | |
231 | - $categories = get_terms( 'form_category' ); |
|
232 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
233 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
231 | + $categories = get_terms('form_category'); |
|
232 | + if ($categories && ! is_wp_error($categories)) { |
|
233 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function query() { |
246 | 246 | |
247 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
248 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
247 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
248 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
249 | 249 | $category = $this->get_category(); |
250 | 250 | |
251 | 251 | $args = array( |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | 'suppress_filters' => true |
259 | 259 | ); |
260 | 260 | |
261 | - if ( ! empty( $category ) ) { |
|
261 | + if ( ! empty($category)) { |
|
262 | 262 | $args['tax_query'] = array( |
263 | 263 | array( |
264 | 264 | 'taxonomy' => 'form_category', |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | ); |
268 | 268 | } |
269 | 269 | |
270 | - switch ( $orderby ) : |
|
270 | + switch ($orderby) : |
|
271 | 271 | case 'title' : |
272 | 272 | $args['orderby'] = 'title'; |
273 | 273 | break; |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | break; |
284 | 284 | endswitch; |
285 | 285 | |
286 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
286 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
287 | 287 | |
288 | - $this->donation_forms = new WP_Query( $args ); |
|
288 | + $this->donation_forms = new WP_Query($args); |
|
289 | 289 | |
290 | 290 | // Store total number of donation forms count. |
291 | 291 | $this->count = $this->donation_forms->found_posts; |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | |
306 | 306 | $give_forms = $this->donation_forms->posts; |
307 | 307 | |
308 | - if ( $give_forms ) { |
|
309 | - foreach ( $give_forms as $form ) { |
|
308 | + if ($give_forms) { |
|
309 | + foreach ($give_forms as $form) { |
|
310 | 310 | $reports_data[] = array( |
311 | 311 | 'ID' => $form, |
312 | - 'title' => get_the_title( $form ), |
|
313 | - 'sales' => give_get_form_sales_stats( $form ), |
|
314 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
315 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
316 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
312 | + 'title' => get_the_title($form), |
|
313 | + 'sales' => give_get_form_sales_stats($form), |
|
314 | + 'earnings' => give_get_form_earnings_stats($form), |
|
315 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
316 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
317 | 317 | ); |
318 | 318 | } |
319 | 319 | } |
@@ -338,14 +338,14 @@ discard block |
||
338 | 338 | $columns = $this->get_columns(); |
339 | 339 | $hidden = array(); // No hidden columns |
340 | 340 | $sortable = $this->get_sortable_columns(); |
341 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
341 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
342 | 342 | $this->items = $this->reports_data(); |
343 | 343 | $total_items = $this->count; |
344 | 344 | |
345 | - $this->set_pagination_args( array( |
|
345 | + $this->set_pagination_args(array( |
|
346 | 346 | 'total_items' => $total_items, |
347 | 347 | 'per_page' => $this->per_page, |
348 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
348 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
349 | 349 | ) |
350 | 350 | ); |
351 | 351 | } |
@@ -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 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_register_dashboard_widgets() { |
24 | - if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
25 | - wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); |
|
24 | + if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
25 | + wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); |
|
29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sales Summary Dashboard Widget |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function give_dashboard_sales_widget() { |
40 | 40 | |
41 | - if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
41 | + if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | $stats = new Give_Payment_Stats(); ?> |
@@ -46,27 +46,27 @@ discard block |
||
46 | 46 | <div class="give-dashboard-widget"> |
47 | 47 | |
48 | 48 | <div class="give-dashboard-today give-clearfix"> |
49 | - <h3 class="give-dashboard-date-today"><?php echo date( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3> |
|
49 | + <h3 class="give-dashboard-date-today"><?php echo date(_x('F j, Y', 'dashboard widget', 'give')); ?></h3> |
|
50 | 50 | |
51 | 51 | <p class="give-dashboard-happy-day"><?php |
52 | 52 | printf( |
53 | 53 | /* translators: %s: day of the week */ |
54 | - __( 'Happy %s!', 'give' ), |
|
55 | - date( 'l', current_time( 'timestamp' ) ) |
|
54 | + __('Happy %s!', 'give'), |
|
55 | + date('l', current_time('timestamp')) |
|
56 | 56 | ); |
57 | 57 | ?></p> |
58 | 58 | |
59 | 59 | <p class="give-dashboard-today-earnings"><?php |
60 | - $earnings_today = $stats->get_earnings( 0, 'today', false ); |
|
61 | - echo give_currency_filter( give_format_amount( $earnings_today, array( 'sanitize' => false ) ) ); |
|
60 | + $earnings_today = $stats->get_earnings(0, 'today', false); |
|
61 | + echo give_currency_filter(give_format_amount($earnings_today, array('sanitize' => false))); |
|
62 | 62 | ?></p> |
63 | 63 | |
64 | 64 | <p class="give-donations-today"><?php |
65 | - $donations_today = $stats->get_sales( 0, 'today', false ); |
|
65 | + $donations_today = $stats->get_sales(0, 'today', false); |
|
66 | 66 | printf( |
67 | 67 | /* translators: %s: daily donation count */ |
68 | - __( '%s donations today', 'give' ), |
|
69 | - give_format_amount( $donations_today, array( 'decimal' => false, 'sanitize' => false ) ) |
|
68 | + __('%s donations today', 'give'), |
|
69 | + give_format_amount($donations_today, array('decimal' => false, 'sanitize' => false)) |
|
70 | 70 | ); |
71 | 71 | ?></p> |
72 | 72 | |
@@ -76,34 +76,34 @@ discard block |
||
76 | 76 | <table class="give-table-stats"> |
77 | 77 | <thead style="display: none;"> |
78 | 78 | <tr> |
79 | - <th><?php _e( 'This Week', 'give' ); ?></th> |
|
80 | - <th><?php _e( 'This Month', 'give' ); ?></th> |
|
81 | - <th><?php _e( 'Past 30 Days', 'give' ); ?></th> |
|
79 | + <th><?php _e('This Week', 'give'); ?></th> |
|
80 | + <th><?php _e('This Month', 'give'); ?></th> |
|
81 | + <th><?php _e('Past 30 Days', 'give'); ?></th> |
|
82 | 82 | </tr> |
83 | 83 | </thead> |
84 | 84 | <tbody> |
85 | 85 | <tr id="give-table-stats-tr-1"> |
86 | 86 | <td> |
87 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ), array( 'sanitize' => false ) ) ); ?></p> |
|
87 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'), array('sanitize' => false))); ?></p> |
|
88 | 88 | |
89 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Week', 'give' ); ?></p> |
|
89 | + <p class="give-dashboard-stat-total-label"><?php _e('This Week', 'give'); ?></p> |
|
90 | 90 | </td> |
91 | 91 | <td> |
92 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ), array( 'sanitize' => false ) ) ); ?></p> |
|
92 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'), array('sanitize' => false))); ?></p> |
|
93 | 93 | |
94 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Month', 'give' ); ?></p> |
|
94 | + <p class="give-dashboard-stat-total-label"><?php _e('This Month', 'give'); ?></p> |
|
95 | 95 | </td> |
96 | 96 | </tr> |
97 | 97 | <tr id="give-table-stats-tr-2"> |
98 | 98 | <td> |
99 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ), array( 'sanitize' => false ) ) ) ?></p> |
|
99 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'), array('sanitize' => false))) ?></p> |
|
100 | 100 | |
101 | - <p class="give-dashboard-stat-total-label"><?php _e( 'Last Month', 'give' ); ?></p> |
|
101 | + <p class="give-dashboard-stat-total-label"><?php _e('Last Month', 'give'); ?></p> |
|
102 | 102 | </td> |
103 | 103 | <td> |
104 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( give_get_total_earnings(), array( 'sanitize' => false ) ) ) ?></p> |
|
104 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount(give_get_total_earnings(), array('sanitize' => false))) ?></p> |
|
105 | 105 | |
106 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Year', 'give' ); ?></p> |
|
106 | + <p class="give-dashboard-stat-total-label"><?php _e('This Year', 'give'); ?></p> |
|
107 | 107 | </td> |
108 | 108 | </tr> |
109 | 109 | </tbody> |
@@ -123,24 +123,24 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return array |
125 | 125 | */ |
126 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
126 | +function give_dashboard_at_a_glance_widget($items) { |
|
127 | 127 | |
128 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
128 | + $num_posts = wp_count_posts('give_forms'); |
|
129 | 129 | |
130 | - if ( $num_posts && $num_posts->publish ) { |
|
130 | + if ($num_posts && $num_posts->publish) { |
|
131 | 131 | |
132 | 132 | $text = sprintf( |
133 | 133 | /* translators: %s: number of posts published */ |
134 | - _n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ), |
|
134 | + _n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'), |
|
135 | 135 | $num_posts->publish |
136 | 136 | ); |
137 | 137 | |
138 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
138 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
139 | 139 | |
140 | - if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
140 | + if (current_user_can('edit_give_forms', get_current_user_id())) { |
|
141 | 141 | $text = sprintf( |
142 | 142 | '<a class="give-forms-count" href="%1$s">%2$s</a>', |
143 | - admin_url( 'edit.php?post_type=give_forms' ), |
|
143 | + admin_url('edit.php?post_type=give_forms'), |
|
144 | 144 | $text |
145 | 145 | ); |
146 | 146 | } else { |
@@ -156,4 +156,4 @@ discard block |
||
156 | 156 | return $items; |
157 | 157 | } |
158 | 158 | |
159 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 ); |
|
159 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
@@ -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 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function admin_menus() { |
52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
53 | 53 | |
54 | 54 | // About Page |
55 | 55 | add_dashboard_page( |
56 | 56 | /* translators: %s: Give version */ |
57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
58 | + esc_html__('Welcome to Give', 'give'), |
|
59 | 59 | $this->minimum_capability, |
60 | 60 | 'give-about', |
61 | - array( $this, 'about_screen' ) |
|
61 | + array($this, 'about_screen') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Changelog Page |
65 | 65 | add_dashboard_page( |
66 | - esc_html__( 'Give Changelog', 'give' ), |
|
67 | - esc_html__( 'Give Changelog', 'give' ), |
|
66 | + esc_html__('Give Changelog', 'give'), |
|
67 | + esc_html__('Give Changelog', 'give'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'give-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Getting Started Page |
74 | 74 | add_dashboard_page( |
75 | 75 | /* translators: %s: Give version */ |
76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
77 | + esc_html__('Getting started with Give', 'give'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'give-getting-started', |
80 | - array( $this, 'getting_started_screen' ) |
|
80 | + array($this, 'getting_started_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Credits Page |
84 | 84 | add_dashboard_page( |
85 | 85 | /* translators: %s: Give version */ |
86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
87 | - esc_html__( 'The people that build Give', 'give' ), |
|
86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
87 | + esc_html__('The people that build Give', 'give'), |
|
88 | 88 | $this->minimum_capability, |
89 | 89 | 'give-credits', |
90 | - array( $this, 'credits_screen' ) |
|
90 | + array($this, 'credits_screen') |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function admin_head() { |
102 | 102 | |
103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
103 | + remove_submenu_page('index.php', 'give-about'); |
|
104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
106 | + remove_submenu_page('index.php', 'give-credits'); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | * @return void |
116 | 116 | */ |
117 | 117 | public function tabs() { |
118 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
118 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
119 | 119 | ?> |
120 | 120 | <h2 class="nav-tab-wrapper"> |
121 | 121 | <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" |
122 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
123 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
122 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
123 | + <?php esc_html_e('About Give', 'give'); ?> |
|
124 | 124 | </a> |
125 | 125 | <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" |
126 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
127 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
126 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
127 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
128 | 128 | </a> |
129 | 129 | <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" |
130 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
131 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
130 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
131 | + <?php esc_html_e('Credits', 'give'); ?> |
|
132 | 132 | </a> |
133 | 133 | <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" |
134 | - href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
135 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
134 | + href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
135 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
136 | 136 | </a> |
137 | 137 | </h2> |
138 | 138 | <?php |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | public function about_screen() { |
149 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
149 | + list($display_version) = explode('-', GIVE_VERSION); |
|
150 | 150 | ?> |
151 | 151 | <div class="wrap about-wrap"> |
152 | 152 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | <p class="about-text"><?php |
156 | 156 | printf( |
157 | 157 | /* translators: %s: http://docs.givewp.com/docs */ |
158 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
159 | - esc_url( 'http://docs.givewp.com/docs' ) |
|
158 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
159 | + esc_url('http://docs.givewp.com/docs') |
|
160 | 160 | ); |
161 | 161 | ?></p> |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <div class="give-badge"><?php |
166 | 166 | printf( |
167 | 167 | /* translators: %s: Give version */ |
168 | - esc_html__( 'Version %s', 'give' ), |
|
168 | + esc_html__('Version %s', 'give'), |
|
169 | 169 | $display_version |
170 | 170 | ); |
171 | 171 | ?></div> |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | <div class="feature-section clearfix introduction"> |
176 | 176 | |
177 | 177 | <div class="video feature-section-item"> |
178 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | - alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
178 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | + alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
180 | 180 | </div> |
181 | 181 | |
182 | 182 | <div class="content feature-section-item last-feature"> |
183 | 183 | |
184 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
184 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
185 | 185 | |
186 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
186 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
187 | 187 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
188 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
188 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
189 | 189 | <span class="dashicons dashicons-external"></span> |
190 | 190 | </a> |
191 | 191 | |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | |
199 | 199 | <div class="content feature-section-item"> |
200 | 200 | |
201 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
201 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
202 | 202 | |
203 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
203 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
204 | 204 | |
205 | 205 | <h4>Find Out More:</h4> |
206 | 206 | <ul class="ul-disc"> |
207 | - <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li> |
|
208 | - <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li> |
|
209 | - <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li> |
|
207 | + <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li> |
|
208 | + <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li> |
|
209 | + <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li> |
|
210 | 210 | </ul> |
211 | 211 | |
212 | 212 | </div> |
213 | 213 | |
214 | 214 | <div class="content feature-section-item last-feature"> |
215 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | - alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
215 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | + alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
217 | 217 | </div> |
218 | 218 | |
219 | 219 | </div> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return void |
233 | 233 | */ |
234 | 234 | public function changelog_screen() { |
235 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
235 | + list($display_version) = explode('-', GIVE_VERSION); |
|
236 | 236 | ?> |
237 | 237 | <div class="wrap about-wrap"> |
238 | 238 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | <p class="about-text"><?php |
241 | 241 | printf( |
242 | 242 | /* translators: %s: Give version */ |
243 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
243 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
244 | 244 | $display_version |
245 | 245 | ); |
246 | 246 | ?></p> |
247 | 247 | <div class="give-badge"><?php |
248 | 248 | printf( |
249 | 249 | /* translators: %s: Give version */ |
250 | - esc_html__( 'Version %s', 'give' ), |
|
250 | + esc_html__('Version %s', 'give'), |
|
251 | 251 | $display_version |
252 | 252 | ); |
253 | 253 | ?></div> |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | <?php $this->tabs(); ?> |
256 | 256 | |
257 | 257 | <div class="changelog"> |
258 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
258 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
259 | 259 | |
260 | 260 | <div class="feature-section"> |
261 | 261 | <?php echo $this->parse_readme(); ?> |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | </div> |
264 | 264 | |
265 | 265 | <div class="return-to-dashboard"> |
266 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
266 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
267 | 267 | 'post_type' => 'give_forms', |
268 | 268 | 'page' => 'give-settings' |
269 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
269 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
270 | 270 | </div> |
271 | 271 | </div> |
272 | 272 | <?php |
@@ -280,36 +280,36 @@ discard block |
||
280 | 280 | * @return void |
281 | 281 | */ |
282 | 282 | public function getting_started_screen() { |
283 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
283 | + list($display_version) = explode('-', GIVE_VERSION); |
|
284 | 284 | ?> |
285 | 285 | <div class="wrap about-wrap get-started"> |
286 | 286 | |
287 | 287 | <?php $this->get_welcome_header() ?> |
288 | 288 | |
289 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
289 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
290 | 290 | |
291 | 291 | <?php give_get_newsletter(); ?> |
292 | 292 | |
293 | 293 | <div class="give-badge"><?php |
294 | 294 | printf( |
295 | 295 | /* translators: %s: Give version */ |
296 | - esc_html__( 'Version %s', 'give' ), |
|
296 | + esc_html__('Version %s', 'give'), |
|
297 | 297 | $display_version |
298 | 298 | ); |
299 | 299 | ?></div> |
300 | 300 | |
301 | 301 | <?php $this->tabs(); ?> |
302 | 302 | |
303 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
303 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
304 | 304 | |
305 | 305 | <div class="feature-section clearfix"> |
306 | 306 | |
307 | 307 | <div class="content feature-section-item"> |
308 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
308 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
309 | 309 | |
310 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p> |
|
310 | + <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p> |
|
311 | 311 | |
312 | - <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p> |
|
312 | + <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p> |
|
313 | 313 | </div> |
314 | 314 | |
315 | 315 | <div class="content feature-section-item last-feature"> |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | </div> |
327 | 327 | |
328 | 328 | <div class="content feature-section-item last-feature"> |
329 | - <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3> |
|
329 | + <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3> |
|
330 | 330 | |
331 | - <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p> |
|
331 | + <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p> |
|
332 | 332 | </div> |
333 | 333 | |
334 | 334 | </div> |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | <div class="feature-section clearfix"> |
338 | 338 | |
339 | 339 | <div class="content feature-section-item add-content"> |
340 | - <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3> |
|
340 | + <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3> |
|
341 | 341 | |
342 | - <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p> |
|
342 | + <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p> |
|
343 | 343 | |
344 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
344 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
345 | 345 | </div> |
346 | 346 | |
347 | 347 | <div class="content feature-section-item last-feature"> |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | </div> |
359 | 359 | |
360 | 360 | <div class="content feature-section-item last-feature"> |
361 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
361 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
362 | 362 | |
363 | - <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p> |
|
363 | + <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p> |
|
364 | 364 | </div> |
365 | 365 | |
366 | 366 | |
@@ -380,20 +380,20 @@ discard block |
||
380 | 380 | * @return void |
381 | 381 | */ |
382 | 382 | public function credits_screen() { |
383 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
383 | + list($display_version) = explode('-', GIVE_VERSION); |
|
384 | 384 | ?> |
385 | 385 | <div class="wrap about-wrap"> |
386 | 386 | |
387 | 387 | <?php $this->get_welcome_header() ?> |
388 | 388 | |
389 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
389 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
390 | 390 | |
391 | 391 | <?php give_get_newsletter(); ?> |
392 | 392 | |
393 | 393 | <div class="give-badge"><?php |
394 | 394 | printf( |
395 | 395 | /* translators: %s: Give version */ |
396 | - esc_html__( 'Version %s', 'give' ), |
|
396 | + esc_html__('Version %s', 'give'), |
|
397 | 397 | $display_version |
398 | 398 | ); |
399 | 399 | ?></div> |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | <p class="about-description"><?php |
404 | 404 | printf( |
405 | 405 | /* translators: %s: https://github.com/WordImpress/give */ |
406 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
407 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
406 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
407 | + esc_url('https://github.com/WordImpress/give') |
|
408 | 408 | ); |
409 | 409 | ?></p> |
410 | 410 | |
@@ -421,21 +421,21 @@ discard block |
||
421 | 421 | * @return string $readme HTML formatted readme file |
422 | 422 | */ |
423 | 423 | public function parse_readme() { |
424 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
424 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
425 | 425 | |
426 | - if ( ! $file ) { |
|
427 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
426 | + if ( ! $file) { |
|
427 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
428 | 428 | } else { |
429 | - $readme = file_get_contents( $file ); |
|
430 | - $readme = nl2br( esc_html( $readme ) ); |
|
431 | - $readme = explode( '== Changelog ==', $readme ); |
|
432 | - $readme = end( $readme ); |
|
433 | - |
|
434 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
435 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
436 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
437 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
438 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
429 | + $readme = file_get_contents($file); |
|
430 | + $readme = nl2br(esc_html($readme)); |
|
431 | + $readme = explode('== Changelog ==', $readme); |
|
432 | + $readme = end($readme); |
|
433 | + |
|
434 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
435 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
436 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
437 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
438 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | return $readme; |
@@ -452,24 +452,24 @@ discard block |
||
452 | 452 | public function contributors() { |
453 | 453 | $contributors = $this->get_contributors(); |
454 | 454 | |
455 | - if ( empty( $contributors ) ) { |
|
455 | + if (empty($contributors)) { |
|
456 | 456 | return ''; |
457 | 457 | } |
458 | 458 | |
459 | 459 | $contributor_list = '<ul class="wp-people-group">'; |
460 | 460 | |
461 | - foreach ( $contributors as $contributor ) { |
|
461 | + foreach ($contributors as $contributor) { |
|
462 | 462 | $contributor_list .= '<li class="wp-person">'; |
463 | 463 | $contributor_list .= sprintf( |
464 | 464 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
465 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
466 | - esc_url( $contributor->avatar_url ), |
|
467 | - esc_attr( $contributor->login ) |
|
465 | + esc_url('https://github.com/'.$contributor->login), |
|
466 | + esc_url($contributor->avatar_url), |
|
467 | + esc_attr($contributor->login) |
|
468 | 468 | ); |
469 | 469 | $contributor_list .= sprintf( |
470 | 470 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
471 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
472 | - esc_html( $contributor->login ) |
|
471 | + esc_url('https://github.com/'.$contributor->login), |
|
472 | + esc_html($contributor->login) |
|
473 | 473 | ); |
474 | 474 | $contributor_list .= '</li>'; |
475 | 475 | } |
@@ -487,25 +487,25 @@ discard block |
||
487 | 487 | * @return array $contributors List of contributors |
488 | 488 | */ |
489 | 489 | public function get_contributors() { |
490 | - $contributors = Give_Cache::get( 'give_contributors', true ); |
|
490 | + $contributors = Give_Cache::get('give_contributors', true); |
|
491 | 491 | |
492 | - if ( false !== $contributors ) { |
|
492 | + if (false !== $contributors) { |
|
493 | 493 | return $contributors; |
494 | 494 | } |
495 | 495 | |
496 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
496 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
497 | 497 | |
498 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
498 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
499 | 499 | return array(); |
500 | 500 | } |
501 | 501 | |
502 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
502 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
503 | 503 | |
504 | - if ( ! is_array( $contributors ) ) { |
|
504 | + if ( ! is_array($contributors)) { |
|
505 | 505 | return array(); |
506 | 506 | } |
507 | 507 | |
508 | - Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true ); |
|
508 | + Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true); |
|
509 | 509 | |
510 | 510 | return $contributors; |
511 | 511 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function get_welcome_header() { |
519 | 519 | // Badge for welcome page |
520 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
520 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
521 | 521 | ?> |
522 | 522 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
523 | 523 | <?php $this->social_media_elements(); ?> |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
611 | 611 | printf( |
612 | 612 | /* translators: %s: Give twitter user @givewp */ |
613 | - esc_html_e( 'Follow %s', 'give' ), |
|
613 | + esc_html_e('Follow %s', 'give'), |
|
614 | 614 | '@givewp' |
615 | 615 | ); |
616 | 616 | ?></a> |
@@ -644,27 +644,27 @@ discard block |
||
644 | 644 | public function welcome() { |
645 | 645 | |
646 | 646 | // Bail if no activation redirect |
647 | - if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) { |
|
647 | + if ( ! Give_Cache::get('_give_activation_redirect', true)) { |
|
648 | 648 | return; |
649 | 649 | } |
650 | 650 | |
651 | 651 | // Delete the redirect transient |
652 | - Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) ); |
|
652 | + Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect')); |
|
653 | 653 | |
654 | 654 | // Bail if activating from network, or bulk |
655 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
655 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
656 | 656 | return; |
657 | 657 | } |
658 | 658 | |
659 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
659 | + $upgrade = get_option('give_version_upgraded_from'); |
|
660 | 660 | |
661 | - if ( ! $upgrade ) { // First time install |
|
662 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
661 | + if ( ! $upgrade) { // First time install |
|
662 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
663 | 663 | exit; |
664 | - } elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings |
|
664 | + } elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings |
|
665 | 665 | |
666 | 666 | } else { // Welcome is NOT disabled in settings |
667 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
667 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
668 | 668 | exit; |
669 | 669 | } |
670 | 670 | } |
@@ -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_Page' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Page')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Page. |
@@ -70,25 +70,25 @@ discard block |
||
70 | 70 | // Get current setting page. |
71 | 71 | $this->current_setting_page = give_get_current_setting_page(); |
72 | 72 | |
73 | - add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); |
|
74 | - add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); |
|
75 | - add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
73 | + add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10); |
|
74 | + add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20); |
|
75 | + add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output')); |
|
76 | 76 | |
77 | 77 | // Output section only if exist. |
78 | 78 | $sections = $this->get_sections(); |
79 | - if ( ! empty( $sections ) ) { |
|
80 | - add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
79 | + if ( ! empty($sections)) { |
|
80 | + add_action("{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
81 | 81 | $this, |
82 | 82 | 'output_sections', |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Save hide button by default. |
87 | 87 | $GLOBALS['give_hide_save_button'] = true; |
88 | 88 | |
89 | 89 | // Enable saving feature. |
90 | - if ( $this->enable_save ) { |
|
91 | - add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) ); |
|
90 | + if ($this->enable_save) { |
|
91 | + add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save')); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string |
115 | 115 | */ |
116 | - function set_default_setting_tab( $setting_tab ) { |
|
116 | + function set_default_setting_tab($setting_tab) { |
|
117 | 117 | return $this->default_tab; |
118 | 118 | } |
119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return array |
128 | 128 | */ |
129 | - public function add_settings_page( $pages ) { |
|
130 | - $pages[ $this->id ] = $this->label; |
|
129 | + public function add_settings_page($pages) { |
|
130 | + $pages[$this->id] = $this->label; |
|
131 | 131 | |
132 | 132 | return $pages; |
133 | 133 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param array $settings |
148 | 148 | */ |
149 | - $settings = apply_filters( 'give_get_settings_' . $this->id, array() ); |
|
149 | + $settings = apply_filters('give_get_settings_'.$this->id, array()); |
|
150 | 150 | |
151 | 151 | // Output. |
152 | 152 | return $settings; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @return array |
160 | 160 | */ |
161 | 161 | public function get_sections() { |
162 | - return apply_filters( 'give_get_sections_' . $this->id, array() ); |
|
162 | + return apply_filters('give_get_sections_'.$this->id, array()); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -176,29 +176,29 @@ discard block |
||
176 | 176 | $sections = $this->get_sections(); |
177 | 177 | |
178 | 178 | // Show section settings only if setting section exist. |
179 | - if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) { |
|
180 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
179 | + if ($current_section && ! in_array($current_section, array_keys($sections))) { |
|
180 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
181 | 181 | $GLOBALS['give_hide_save_button'] = true; |
182 | 182 | |
183 | 183 | return; |
184 | 184 | } |
185 | 185 | |
186 | 186 | // Bailout. |
187 | - if ( empty( $sections ) ) { |
|
187 | + if (empty($sections)) { |
|
188 | 188 | return; |
189 | 189 | } |
190 | 190 | |
191 | - if ( is_null( $this->current_setting_page ) ) { |
|
191 | + if (is_null($this->current_setting_page)) { |
|
192 | 192 | $this->current_setting_page = give_get_current_setting_page(); |
193 | 193 | } |
194 | 194 | |
195 | 195 | echo '<ul class="subsubsub">'; |
196 | 196 | |
197 | 197 | // Get section keys. |
198 | - $array_keys = array_keys( $sections ); |
|
198 | + $array_keys = array_keys($sections); |
|
199 | 199 | |
200 | - foreach ( $sections as $id => $label ) { |
|
201 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
200 | + foreach ($sections as $id => $label) { |
|
201 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | echo '</ul><br class="clear" /><hr>'; |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | * @return void |
214 | 214 | */ |
215 | 215 | public function output() { |
216 | - if ( $this->enable_save ) { |
|
216 | + if ($this->enable_save) { |
|
217 | 217 | $GLOBALS['give_hide_save_button'] = false; |
218 | 218 | } |
219 | 219 | |
220 | 220 | $settings = $this->get_settings(); |
221 | 221 | |
222 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
222 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | $settings = $this->get_settings(); |
233 | 233 | $current_section = give_get_current_setting_section(); |
234 | 234 | |
235 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
235 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Trigger Action |
239 | 239 | * |
240 | 240 | * @since 1.8 |
241 | 241 | */ |
242 | - do_action( 'give_update_options_' . $this->id . '_' . $current_section ); |
|
242 | + do_action('give_update_options_'.$this->id.'_'.$current_section); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | $section = $this->get_sections(); |
257 | 257 | $current_section = give_get_current_setting_section(); |
258 | 258 | |
259 | - if ( array_key_exists( $current_section, $section ) ) { |
|
260 | - $heading[] = $section[ $current_section ]; |
|
259 | + if (array_key_exists($current_section, $section)) { |
|
260 | + $heading[] = $section[$current_section]; |
|
261 | 261 | } |
262 | 262 | |
263 | - return array_unique( $heading ); |
|
263 | + return array_unique($heading); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | public function get_heading_html() { |
275 | 275 | return sprintf( |
276 | 276 | '<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">', |
277 | - implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() ) |
|
277 | + implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading()) |
|
278 | 278 | ); |
279 | 279 | } |
280 | 280 | } |
@@ -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 | |
@@ -25,52 +25,52 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | -function give_update_payment_details( $data ) { |
|
28 | +function give_update_payment_details($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
31 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
35 | 35 | |
36 | 36 | // Retrieve the payment ID. |
37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
37 | + $payment_id = absint($data['give_payment_id']); |
|
38 | 38 | |
39 | 39 | /* @var Give_Payment $payment */ |
40 | - $payment = new Give_Payment( $payment_id ); |
|
40 | + $payment = new Give_Payment($payment_id); |
|
41 | 41 | |
42 | 42 | // Retrieve existing payment meta. |
43 | 43 | $meta = $payment->get_meta(); |
44 | 44 | $user_info = $payment->user_info; |
45 | 45 | |
46 | 46 | $status = $data['give-payment-status']; |
47 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
48 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
47 | + $date = sanitize_text_field($data['give-payment-date']); |
|
48 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
49 | 49 | |
50 | 50 | // Restrict to our high and low. |
51 | - if ( $hour > 23 ) { |
|
51 | + if ($hour > 23) { |
|
52 | 52 | $hour = 23; |
53 | - } elseif ( $hour < 0 ) { |
|
53 | + } elseif ($hour < 0) { |
|
54 | 54 | $hour = 00; |
55 | 55 | } |
56 | 56 | |
57 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
57 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
58 | 58 | |
59 | 59 | // Restrict to our high and low. |
60 | - if ( $minute > 59 ) { |
|
60 | + if ($minute > 59) { |
|
61 | 61 | $minute = 59; |
62 | - } elseif ( $minute < 0 ) { |
|
62 | + } elseif ($minute < 0) { |
|
63 | 63 | $minute = 00; |
64 | 64 | } |
65 | 65 | |
66 | - $address = give_clean( $data['give-payment-address'][0] ); |
|
66 | + $address = give_clean($data['give-payment-address'][0]); |
|
67 | 67 | |
68 | 68 | $curr_total = $payment->total; |
69 | - $new_total = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) ); |
|
70 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
69 | + $new_total = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0)); |
|
70 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
71 | 71 | |
72 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
73 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
72 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
73 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Fires before updating edited donation. |
@@ -80,100 +80,100 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param int $payment_id The ID of the payment. |
82 | 82 | */ |
83 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
83 | + do_action('give_update_edited_donation', $payment_id); |
|
84 | 84 | |
85 | 85 | $payment->date = $date; |
86 | 86 | $updated = $payment->save(); |
87 | 87 | |
88 | - if ( 0 === $updated ) { |
|
89 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
88 | + if (0 === $updated) { |
|
89 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $donor_changed = false; |
93 | 93 | |
94 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
94 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
95 | 95 | |
96 | - $email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
97 | - $names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : ''; |
|
96 | + $email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
97 | + $names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : ''; |
|
98 | 98 | |
99 | - if ( empty( $email ) || empty( $names ) ) { |
|
100 | - wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
99 | + if (empty($email) || empty($names)) { |
|
100 | + wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
101 | 101 | } |
102 | 102 | |
103 | - $donor = new Give_Donor( $email ); |
|
104 | - if ( empty( $donor->id ) ) { |
|
105 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
106 | - $user_id = email_exists( $email ); |
|
107 | - if ( false !== $user_id ) { |
|
103 | + $donor = new Give_Donor($email); |
|
104 | + if (empty($donor->id)) { |
|
105 | + $donor_data = array('name' => $names, 'email' => $email); |
|
106 | + $user_id = email_exists($email); |
|
107 | + if (false !== $user_id) { |
|
108 | 108 | $donor_data['user_id'] = $user_id; |
109 | 109 | } |
110 | 110 | |
111 | - if ( ! $donor->create( $donor_data ) ) { |
|
111 | + if ( ! $donor->create($donor_data)) { |
|
112 | 112 | // Failed to crete the new donor, assume the previous donor. |
113 | 113 | $donor_changed = false; |
114 | - $donor = new Give_Donor( $curr_donor_id ); |
|
115 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
114 | + $donor = new Give_Donor($curr_donor_id); |
|
115 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | 119 | $new_donor_id = $donor->id; |
120 | 120 | |
121 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
121 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
122 | 122 | |
123 | 123 | $donor_changed = true; |
124 | 124 | |
125 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
125 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
126 | 126 | |
127 | - $donor = new Give_Donor( $new_donor_id ); |
|
127 | + $donor = new Give_Donor($new_donor_id); |
|
128 | 128 | $email = $donor->email; |
129 | 129 | $names = $donor->name; |
130 | 130 | |
131 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
131 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
132 | 132 | |
133 | 133 | $donor_changed = true; |
134 | 134 | |
135 | 135 | } else { |
136 | - $donor = new Give_Donor( $curr_donor_id ); |
|
136 | + $donor = new Give_Donor($curr_donor_id); |
|
137 | 137 | $email = $donor->email; |
138 | 138 | $names = $donor->name; |
139 | 139 | |
140 | 140 | } |
141 | 141 | |
142 | - if ( $donor_changed ) { |
|
142 | + if ($donor_changed) { |
|
143 | 143 | |
144 | 144 | // Setup first and last name from input values. |
145 | - $names = explode( ' ', $names ); |
|
146 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
145 | + $names = explode(' ', $names); |
|
146 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
147 | 147 | $last_name = ''; |
148 | - if ( ! empty( $names[1] ) ) { |
|
149 | - unset( $names[0] ); |
|
150 | - $last_name = implode( ' ', $names ); |
|
148 | + if ( ! empty($names[1])) { |
|
149 | + unset($names[0]); |
|
150 | + $last_name = implode(' ', $names); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $payment->first_name = $first_name; |
154 | 154 | $payment->last_name = $last_name; |
155 | 155 | |
156 | 156 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
157 | - $previous_donor->remove_payment( $payment_id, false ); |
|
158 | - $donor->attach_payment( $payment_id, false ); |
|
157 | + $previous_donor->remove_payment($payment_id, false); |
|
158 | + $donor->attach_payment($payment_id, false); |
|
159 | 159 | |
160 | - if ( 'publish' == $status ) { |
|
160 | + if ('publish' == $status) { |
|
161 | 161 | |
162 | 162 | // Reduce previous user donation count and amount. |
163 | 163 | $previous_donor->decrease_donation_count(); |
164 | - $previous_donor->decrease_value( $curr_total ); |
|
164 | + $previous_donor->decrease_value($curr_total); |
|
165 | 165 | |
166 | 166 | // If donation was completed adjust stats of new donors. |
167 | 167 | $donor->increase_purchase_count(); |
168 | - $donor->increase_value( $new_total ); |
|
168 | + $donor->increase_value($new_total); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | $payment->customer_id = $donor->id; |
172 | 172 | } else { |
173 | 173 | |
174 | - if ( 'publish' === $status ) { |
|
174 | + if ('publish' === $status) { |
|
175 | 175 | // Update user donation stat. |
176 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
176 | + $donor->update_donation_value($curr_total, $new_total); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | $payment->total = $new_total; |
185 | 185 | |
186 | 186 | // Check for payment notes. |
187 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
187 | + if ( ! empty($data['give-payment-note'])) { |
|
188 | 188 | |
189 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
190 | - give_insert_payment_note( $payment_id, $note ); |
|
189 | + $note = wp_kses($data['give-payment-note'], array()); |
|
190 | + give_insert_payment_note($payment_id, $note); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | $payment->status = $status; |
196 | 196 | |
197 | 197 | // Adjust total store earnings if the payment total has been changed. |
198 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
198 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
199 | 199 | |
200 | - if ( $new_total > $curr_total ) { |
|
200 | + if ($new_total > $curr_total) { |
|
201 | 201 | // Increase if our new total is higher. |
202 | 202 | $difference = $new_total - $curr_total; |
203 | - give_increase_total_earnings( $difference ); |
|
203 | + give_increase_total_earnings($difference); |
|
204 | 204 | |
205 | - } elseif ( $curr_total > $new_total ) { |
|
205 | + } elseif ($curr_total > $new_total) { |
|
206 | 206 | // Decrease if our new total is lower. |
207 | 207 | $difference = $curr_total - $new_total; |
208 | - give_decrease_total_earnings( $difference ); |
|
208 | + give_decrease_total_earnings($difference); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | } |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | $payment->save(); |
214 | 214 | |
215 | 215 | // Get new give form ID. |
216 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
217 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
216 | + $new_form_id = absint($data['give-payment-form-select']); |
|
217 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
218 | 218 | |
219 | 219 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
220 | 220 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
221 | 221 | // Check if user want to transfer current payment to new give form id. |
222 | - if ( $new_form_id && $new_form_id != $current_form_id ) { |
|
222 | + if ($new_form_id && $new_form_id != $current_form_id) { |
|
223 | 223 | |
224 | 224 | // Get new give form title. |
225 | - $new_form_title = get_the_title( $new_form_id ); |
|
225 | + $new_form_title = get_the_title($new_form_id); |
|
226 | 226 | |
227 | 227 | // Update new give form data in payment data. |
228 | 228 | $payment_meta = $payment->get_meta(); |
@@ -230,43 +230,43 @@ discard block |
||
230 | 230 | $payment_meta['form_id'] = $new_form_id; |
231 | 231 | |
232 | 232 | // Update price id post meta data for set donation form. |
233 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
233 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
234 | 234 | $payment_meta['price_id'] = ''; |
235 | 235 | } |
236 | 236 | |
237 | 237 | // Update payment give form meta data. |
238 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
239 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
240 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
238 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
239 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
240 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
241 | 241 | |
242 | 242 | // Update price id payment metadata. |
243 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
244 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
243 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
244 | + $payment->update_meta('_give_payment_price_id', ''); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | // If donation was completed, adjust stats of forms. |
248 | - if ( 'publish' == $status ) { |
|
248 | + if ('publish' == $status) { |
|
249 | 249 | |
250 | 250 | // Decrease sale of old give form. For other payment status. |
251 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
251 | + $current_form = new Give_Donate_Form($current_form_id); |
|
252 | 252 | $current_form->decrease_sales(); |
253 | - $current_form->decrease_earnings( $curr_total ); |
|
253 | + $current_form->decrease_earnings($curr_total); |
|
254 | 254 | |
255 | 255 | // Increase sale of new give form. |
256 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
256 | + $new_form = new Give_Donate_Form($new_form_id); |
|
257 | 257 | $new_form->increase_sales(); |
258 | - $new_form->increase_earnings( $new_total ); |
|
258 | + $new_form->increase_earnings($new_total); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | // Re setup payment to update new meta value in object. |
262 | - $payment->update_payment_setup( $payment->ID ); |
|
262 | + $payment->update_payment_setup($payment->ID); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | // Update price id if current form is variable form. |
266 | 266 | /* @var Give_Donate_Form $form */ |
267 | - $form = new Give_Donate_Form( $payment->form_id ); |
|
267 | + $form = new Give_Donate_Form($payment->form_id); |
|
268 | 268 | |
269 | - if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) { |
|
269 | + if (isset($data['give-variable-price']) && $form->has_variable_prices()) { |
|
270 | 270 | |
271 | 271 | // Get payment meta data. |
272 | 272 | $payment_meta = $payment->get_meta(); |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | $price_id = ''; |
276 | 276 | |
277 | 277 | // Get price info |
278 | - if( 0 <= $data['give-variable-price'] ) { |
|
279 | - foreach ( $form->prices as $variable_price ) { |
|
280 | - if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) { |
|
278 | + if (0 <= $data['give-variable-price']) { |
|
279 | + foreach ($form->prices as $variable_price) { |
|
280 | + if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) { |
|
281 | 281 | $price_info = $variable_price; |
282 | 282 | break; |
283 | 283 | } |
@@ -285,15 +285,15 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | // Set price id. |
288 | - if( ! empty( $price_info ) ) { |
|
288 | + if ( ! empty($price_info)) { |
|
289 | 289 | $price_id = $data['give-variable-price']; |
290 | 290 | |
291 | - if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) { |
|
291 | + if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) { |
|
292 | 292 | // Set price id to amount match. |
293 | 293 | $price_id = $price_info['_give_id']['level_id']; |
294 | 294 | } |
295 | 295 | |
296 | - } elseif( $form->is_custom_price_mode() ){ |
|
296 | + } elseif ($form->is_custom_price_mode()) { |
|
297 | 297 | $price_id = 'custom'; |
298 | 298 | } |
299 | 299 | |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | $payment_meta['price_id'] = $price_id; |
302 | 302 | |
303 | 303 | // Update payment give form meta data. |
304 | - $payment->update_meta( '_give_payment_price_id', $price_id ); |
|
305 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
304 | + $payment->update_meta('_give_payment_price_id', $price_id); |
|
305 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
306 | 306 | |
307 | 307 | // Re setup payment to update new meta value in object. |
308 | - $payment->update_payment_setup( $payment->ID ); |
|
308 | + $payment->update_payment_setup($payment->ID); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -316,13 +316,13 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @param int $payment_id The ID of the payment. |
318 | 318 | */ |
319 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
319 | + do_action('give_updated_edited_donation', $payment_id); |
|
320 | 320 | |
321 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
321 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id)); |
|
322 | 322 | exit; |
323 | 323 | } |
324 | 324 | |
325 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
325 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Trigger a Donation Deletion. |
@@ -333,48 +333,48 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @return void |
335 | 335 | */ |
336 | -function give_trigger_donation_delete( $data ) { |
|
337 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
336 | +function give_trigger_donation_delete($data) { |
|
337 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
338 | 338 | |
339 | - $payment_id = absint( $data['purchase_id'] ); |
|
339 | + $payment_id = absint($data['purchase_id']); |
|
340 | 340 | |
341 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
342 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
341 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
342 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
343 | 343 | } |
344 | 344 | |
345 | - give_delete_donation( $payment_id ); |
|
346 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
345 | + give_delete_donation($payment_id); |
|
346 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
347 | 347 | give_die(); |
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
351 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
352 | 352 | |
353 | 353 | /** |
354 | 354 | * AJAX Store Donation Note |
355 | 355 | */ |
356 | 356 | function give_ajax_store_payment_note() { |
357 | 357 | |
358 | - $payment_id = absint( $_POST['payment_id'] ); |
|
359 | - $note = wp_kses( $_POST['note'], array() ); |
|
358 | + $payment_id = absint($_POST['payment_id']); |
|
359 | + $note = wp_kses($_POST['note'], array()); |
|
360 | 360 | |
361 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
362 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
361 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
362 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
363 | 363 | } |
364 | 364 | |
365 | - if ( empty( $payment_id ) ) { |
|
366 | - die( '-1' ); |
|
365 | + if (empty($payment_id)) { |
|
366 | + die('-1'); |
|
367 | 367 | } |
368 | 368 | |
369 | - if ( empty( $note ) ) { |
|
370 | - die( '-1' ); |
|
369 | + if (empty($note)) { |
|
370 | + die('-1'); |
|
371 | 371 | } |
372 | 372 | |
373 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
374 | - die( give_get_payment_note_html( $note_id ) ); |
|
373 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
374 | + die(give_get_payment_note_html($note_id)); |
|
375 | 375 | } |
376 | 376 | |
377 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
377 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Triggers a donation note deletion without ajax |
@@ -385,24 +385,24 @@ discard block |
||
385 | 385 | * |
386 | 386 | * @return void |
387 | 387 | */ |
388 | -function give_trigger_payment_note_deletion( $data ) { |
|
388 | +function give_trigger_payment_note_deletion($data) { |
|
389 | 389 | |
390 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
390 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
391 | 391 | return; |
392 | 392 | } |
393 | 393 | |
394 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
395 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
394 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
395 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
396 | 396 | } |
397 | 397 | |
398 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
398 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
399 | 399 | |
400 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
400 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
401 | 401 | |
402 | - wp_redirect( $edit_order_url ); |
|
402 | + wp_redirect($edit_order_url); |
|
403 | 403 | } |
404 | 404 | |
405 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
405 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
406 | 406 | |
407 | 407 | /** |
408 | 408 | * Delete a payment note deletion with ajax |
@@ -413,16 +413,16 @@ discard block |
||
413 | 413 | */ |
414 | 414 | function give_ajax_delete_payment_note() { |
415 | 415 | |
416 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
417 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
416 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
417 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
418 | 418 | } |
419 | 419 | |
420 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
421 | - die( '1' ); |
|
420 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
421 | + die('1'); |
|
422 | 422 | } else { |
423 | - die( '-1' ); |
|
423 | + die('-1'); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | } |
427 | 427 | |
428 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
428 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
@@ -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. |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'export'; |
37 | - $this->label = __( 'Export', 'give' ); |
|
37 | + $this->label = __('Export', 'give'); |
|
38 | 38 | |
39 | 39 | parent::__construct(); |
40 | 40 | |
41 | - add_action( 'give_admin_field_tools_export', array( $this, 'render_export_field' ), 10, 2 ); |
|
41 | + add_action('give_admin_field_tools_export', array($this, 'render_export_field'), 10, 2); |
|
42 | 42 | |
43 | 43 | // Do not use main donor for this tab. |
44 | - if( give_get_current_setting_tab() === $this->id ) { |
|
45 | - add_action( 'give-tools_open_form', '__return_empty_string' ); |
|
46 | - add_action( 'give-tools_close_form', '__return_empty_string' ); |
|
44 | + if (give_get_current_setting_tab() === $this->id) { |
|
45 | + add_action('give-tools_open_form', '__return_empty_string'); |
|
46 | + add_action('give-tools_close_form', '__return_empty_string'); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param array $settings |
62 | 62 | */ |
63 | 63 | $settings = apply_filters( |
64 | - 'give_get_settings_' . $this->id, |
|
64 | + 'give_get_settings_'.$this->id, |
|
65 | 65 | array( |
66 | 66 | array( |
67 | 67 | 'id' => 'give_tools_export', |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ), |
71 | 71 | array( |
72 | 72 | 'id' => 'export', |
73 | - 'name' => __( 'Export', 'give' ), |
|
73 | + 'name' => __('Export', 'give'), |
|
74 | 74 | 'type' => 'tools_export', |
75 | 75 | ), |
76 | 76 | array( |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @param $field |
95 | 95 | * @param $option_value |
96 | 96 | */ |
97 | - public function render_export_field( $field, $option_value ) { |
|
98 | - include_once( 'views/html-admin-page-exports.php' ); |
|
97 | + public function render_export_field($field, $option_value) { |
|
98 | + include_once('views/html-admin-page-exports.php'); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array( |
|
27 | 27 | 'response' => 403, |
28 | - ) ); |
|
28 | + )); |
|
29 | 29 | } |
30 | 30 | |
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Fires before batch export. |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $class Export class. |
39 | 39 | */ |
40 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
40 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
41 | 41 | |
42 | 42 | $export = new $_REQUEST['class']; |
43 | 43 | $export->export(); |
44 | 44 | |
45 | 45 | } |
46 | 46 | |
47 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
47 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Exports earnings for a specified time period. |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | function give_export_earnings() { |
58 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php'; |
|
58 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php'; |
|
59 | 59 | |
60 | 60 | $earnings_export = new Give_Earnings_Export(); |
61 | 61 | |
62 | 62 | $earnings_export->export(); |
63 | 63 | } |
64 | 64 | |
65 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
65 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Exports Give's core settings. |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * @return void |
74 | 74 | */ |
75 | 75 | function give_core_settings_export() { |
76 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-core-settings-export.php'; |
|
76 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-core-settings-export.php'; |
|
77 | 77 | |
78 | 78 | $core_settings = new Give_Core_Settings_Export(); |
79 | 79 | |
80 | 80 | $core_settings->export(); |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'give_core_settings_export', 'give_core_settings_export' ); |
|
83 | +add_action('give_core_settings_export', 'give_core_settings_export'); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @return void |
91 | 91 | */ |
92 | 92 | function give_register_batch_exporters() { |
93 | - if ( is_admin() ) { |
|
93 | + if (is_admin()) { |
|
94 | 94 | /** |
95 | 95 | * Fires in the admin, while plugins loaded. |
96 | 96 | * |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param string $class Export class. |
102 | 102 | */ |
103 | - do_action( 'give_register_batch_exporter' ); |
|
103 | + do_action('give_register_batch_exporter'); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
107 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Register the payments batch exporter |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | * @since 1.5 |
113 | 113 | */ |
114 | 114 | function give_register_payments_batch_export() { |
115 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
115 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
116 | 116 | } |
117 | 117 | |
118 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
118 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Loads the payments batch process if needed |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return void |
128 | 128 | */ |
129 | -function give_include_payments_batch_processor( $class ) { |
|
129 | +function give_include_payments_batch_processor($class) { |
|
130 | 130 | |
131 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
132 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-payments.php'; |
|
131 | + if ('Give_Batch_Payments_Export' === $class) { |
|
132 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-payments.php'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | } |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | * @since 1.5.2 |
141 | 141 | */ |
142 | 142 | function give_register_donors_batch_export() { |
143 | - add_action( 'give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1 ); |
|
143 | + add_action('give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1); |
|
144 | 144 | } |
145 | 145 | |
146 | -add_action( 'give_register_batch_exporter', 'give_register_donors_batch_export', 10 ); |
|
146 | +add_action('give_register_batch_exporter', 'give_register_donors_batch_export', 10); |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Loads the donors batch process if needed. |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return void |
156 | 156 | */ |
157 | -function give_include_donors_batch_processor( $class ) { |
|
157 | +function give_include_donors_batch_processor($class) { |
|
158 | 158 | |
159 | - if ( 'Give_Batch_Donors_Export' === $class ) { |
|
160 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-donors.php'; |
|
159 | + if ('Give_Batch_Donors_Export' === $class) { |
|
160 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-donors.php'; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | } |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | * @since 1.5 |
169 | 169 | */ |
170 | 170 | function give_register_forms_batch_export() { |
171 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
171 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
172 | 172 | } |
173 | 173 | |
174 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
174 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
175 | 175 | |
176 | 176 | /** |
177 | 177 | * Loads the file downloads batch process if needed |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return void |
184 | 184 | */ |
185 | -function give_include_forms_batch_processor( $class ) { |
|
185 | +function give_include_forms_batch_processor($class) { |
|
186 | 186 | |
187 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
188 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php'; |
|
187 | + if ('Give_Batch_Forms_Export' === $class) { |
|
188 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php'; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | } |
@@ -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_API' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_API')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_API. |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'api'; |
37 | - $this->label = esc_html__( 'API', 'give' ); |
|
37 | + $this->label = esc_html__('API', 'give'); |
|
38 | 38 | |
39 | 39 | parent::__construct(); |
40 | 40 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function get_settings() { |
49 | 49 | // Get settings. |
50 | - $settings = apply_filters( 'give_settings_api', array( |
|
50 | + $settings = apply_filters('give_settings_api', array( |
|
51 | 51 | array( |
52 | 52 | 'id' => 'give_tools_api', |
53 | 53 | 'type' => 'title', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ), |
56 | 56 | array( |
57 | 57 | 'id' => 'api', |
58 | - 'name' => esc_html__( 'API', 'give' ), |
|
58 | + 'name' => esc_html__('API', 'give'), |
|
59 | 59 | 'type' => 'api', |
60 | 60 | ), |
61 | 61 | array( |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @since 1.8 |
72 | 72 | * @param array $settings |
73 | 73 | */ |
74 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
74 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
75 | 75 | |
76 | 76 | // Output. |
77 | 77 | return $settings; |
@@ -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_Logs' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Logs')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Logs. |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'logs'; |
37 | - $this->label = __( 'Logs', 'give' ); |
|
37 | + $this->label = __('Logs', 'give'); |
|
38 | 38 | |
39 | 39 | $this->default_tab = 'sales'; |
40 | 40 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function get_settings() { |
52 | 52 | // Get settings. |
53 | - $settings = apply_filters( 'give_settings_logs', array( |
|
53 | + $settings = apply_filters('give_settings_logs', array( |
|
54 | 54 | array( |
55 | 55 | 'id' => 'give_tools_logs', |
56 | 56 | 'type' => 'title', |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ), |
59 | 59 | array( |
60 | 60 | 'id' => 'api', |
61 | - 'name' => __( 'Log', 'give' ), |
|
61 | + 'name' => __('Log', 'give'), |
|
62 | 62 | 'type' => 'logs', |
63 | 63 | |
64 | 64 | ), |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'type' => 'sectionend', |
68 | 68 | 'table_html' => false, |
69 | 69 | ), |
70 | - ) ); |
|
70 | + )); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Filter the settings. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param array $settings |
78 | 78 | */ |
79 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
79 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
80 | 80 | |
81 | 81 | // Output. |
82 | 82 | return $settings; |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_sections() { |
92 | 92 | $sections = array( |
93 | - 'sales' => __( 'Donations', 'give' ), |
|
94 | - 'gateway_errors' => __( 'Payment Errors', 'give' ), |
|
95 | - 'api_requests' => __( 'API Requests', 'give' ), |
|
93 | + 'sales' => __('Donations', 'give'), |
|
94 | + 'gateway_errors' => __('Payment Errors', 'give'), |
|
95 | + 'api_requests' => __('API Requests', 'give'), |
|
96 | 96 | ); |
97 | 97 | |
98 | - $sections = apply_filters( 'give_log_views', $sections ); |
|
98 | + $sections = apply_filters('give_log_views', $sections); |
|
99 | 99 | |
100 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
100 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 |