@@ -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 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @see Give_Cron::weekly_events() |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
33 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
32 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
33 | + add_action('wp', array($this, 'schedule_Events')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return array |
44 | 44 | */ |
45 | - public function add_schedules( $schedules = array() ) { |
|
45 | + public function add_schedules($schedules = array()) { |
|
46 | 46 | // Adds once weekly to the existing schedules. |
47 | 47 | $schedules['weekly'] = array( |
48 | 48 | 'interval' => 604800, |
49 | - 'display' => __( 'Once Weekly', 'easy-digital-downloads' ) |
|
49 | + 'display' => __('Once Weekly', 'easy-digital-downloads') |
|
50 | 50 | ); |
51 | 51 | |
52 | 52 | return $schedules; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | private function weekly_events() { |
75 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
76 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
75 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
76 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | private function daily_events() { |
88 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
89 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
88 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
89 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Cron |
|
4 | - * |
|
5 | - * @package Give |
|
6 | - * @subpackage Classes/Cron |
|
7 | - * @copyright Copyright (c) 2015, WordImpress |
|
8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | - * @since 1.3.2 |
|
10 | - */ |
|
3 | + * Cron |
|
4 | + * |
|
5 | + * @package Give |
|
6 | + * @subpackage Classes/Cron |
|
7 | + * @copyright Copyright (c) 2015, WordImpress |
|
8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | + * @since 1.3.2 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -32,32 +32,32 @@ discard block |
||
32 | 32 | function give_reports_page() { |
33 | 33 | global $give_options; |
34 | 34 | |
35 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
36 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
35 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
36 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
37 | 37 | ?> |
38 | 38 | <div class="wrap"> |
39 | 39 | <h1 class="nav-tab-wrapper"> |
40 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
40 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
41 | 41 | 'tab' => 'reports', |
42 | 42 | 'settings-updated' => false |
43 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Reports', 'give' ); ?></a> |
|
44 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
45 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
43 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e('Reports', 'give'); ?></a> |
|
44 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
45 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
46 | 46 | 'tab' => 'export', |
47 | 47 | 'settings-updated' => false |
48 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Export', 'give' ); ?></a> |
|
48 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e('Export', 'give'); ?></a> |
|
49 | 49 | <?php } ?> |
50 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
50 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
51 | 51 | 'tab' => 'logs', |
52 | 52 | 'settings-updated' => false |
53 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Logs', 'give' ); ?></a> |
|
54 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
53 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e('Logs', 'give'); ?></a> |
|
54 | + <?php do_action('give_reports_tabs'); ?> |
|
55 | 55 | </h1> |
56 | 56 | |
57 | 57 | <?php |
58 | - do_action( 'give_reports_page_top' ); |
|
59 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
60 | - do_action( 'give_reports_page_bottom' ); |
|
58 | + do_action('give_reports_page_top'); |
|
59 | + do_action('give_reports_tab_'.$active_tab); |
|
60 | + do_action('give_reports_page_bottom'); |
|
61 | 61 | ?> |
62 | 62 | </div><!-- .wrap --> |
63 | 63 | <?php |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | */ |
72 | 72 | function give_reports_default_views() { |
73 | 73 | $views = array( |
74 | - 'earnings' => __( 'Income', 'give' ), |
|
74 | + 'earnings' => __('Income', 'give'), |
|
75 | 75 | 'forms' => give_get_forms_label_plural(), |
76 | - 'donors' => __( 'Donors', 'give' ), |
|
77 | - 'gateways' => __( 'Payment Methods', 'give' ) |
|
76 | + 'donors' => __('Donors', 'give'), |
|
77 | + 'gateways' => __('Payment Methods', 'give') |
|
78 | 78 | ); |
79 | 79 | |
80 | - $views = apply_filters( 'give_report_views', $views ); |
|
80 | + $views = apply_filters('give_report_views', $views); |
|
81 | 81 | |
82 | 82 | return $views; |
83 | 83 | } |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | * @return string $view Report View |
94 | 94 | * |
95 | 95 | */ |
96 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
96 | +function give_get_reporting_view($default = 'earnings') { |
|
97 | 97 | |
98 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
98 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
99 | 99 | $view = $default; |
100 | 100 | } else { |
101 | 101 | $view = $_GET['view']; |
102 | 102 | } |
103 | 103 | |
104 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
104 | + return apply_filters('give_get_reporting_view', $view); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | $current_view = 'earnings'; |
115 | 115 | $views = give_reports_default_views(); |
116 | 116 | |
117 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
117 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
118 | 118 | $current_view = $_GET['view']; |
119 | 119 | } |
120 | 120 | |
121 | - do_action( 'give_reports_view_' . $current_view ); |
|
121 | + do_action('give_reports_view_'.$current_view); |
|
122 | 122 | } |
123 | 123 | |
124 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
124 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Renders the Reports Page Views Drop Downs |
@@ -131,25 +131,25 @@ discard block |
||
131 | 131 | */ |
132 | 132 | function give_report_views() { |
133 | 133 | $views = give_reports_default_views(); |
134 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
135 | - do_action( 'give_report_view_actions_before' ); |
|
134 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
135 | + do_action('give_report_view_actions_before'); |
|
136 | 136 | ?> |
137 | 137 | <form id="give-reports-filter" method="get"> |
138 | 138 | <select id="give-reports-view" name="view"> |
139 | - <option value="-1"><?php _e( 'Report Type', 'give' ); ?></option> |
|
140 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
141 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
139 | + <option value="-1"><?php _e('Report Type', 'give'); ?></option> |
|
140 | + <?php foreach ($views as $view_id => $label) : ?> |
|
141 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
142 | 142 | <?php endforeach; ?> |
143 | 143 | </select> |
144 | 144 | |
145 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
145 | + <?php do_action('give_report_view_actions'); ?> |
|
146 | 146 | |
147 | 147 | <input type="hidden" name="post_type" value="give_forms" /> |
148 | 148 | <input type="hidden" name="page" value="give-reports" /> |
149 | - <?php submit_button( __( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
149 | + <?php submit_button(__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
150 | 150 | </form> |
151 | 151 | <?php |
152 | - do_action( 'give_report_view_actions_after' ); |
|
152 | + do_action('give_report_view_actions_after'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -162,18 +162,18 @@ discard block |
||
162 | 162 | */ |
163 | 163 | function give_reports_forms_table() { |
164 | 164 | |
165 | - if ( isset( $_GET['form-id'] ) ) { |
|
165 | + if (isset($_GET['form-id'])) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
169 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
170 | 170 | |
171 | 171 | $give_table = new Give_Form_Reports_Table(); |
172 | 172 | $give_table->prepare_items(); |
173 | 173 | $give_table->display(); |
174 | 174 | } |
175 | 175 | |
176 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
176 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Renders the detailed report for a specific give form |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @return void |
183 | 183 | */ |
184 | 184 | function give_reports_form_details() { |
185 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
185 | + if ( ! isset($_GET['form-id'])) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | ?> |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | <div class="actions bulkactions"> |
191 | 191 | <?php give_report_views(); ?> |
192 | 192 | |
193 | - <button onclick="history.go(-1);" class="button-secondary"><?php _e( 'Go Back', 'give' ); ?></button> |
|
193 | + <button onclick="history.go(-1);" class="button-secondary"><?php _e('Go Back', 'give'); ?></button> |
|
194 | 194 | </div> |
195 | 195 | </div> |
196 | 196 | <?php |
197 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
197 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
198 | 198 | } |
199 | 199 | |
200 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
200 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Renders the Reports Donors Table |
@@ -208,28 +208,28 @@ discard block |
||
208 | 208 | * @return void |
209 | 209 | */ |
210 | 210 | function give_reports_donors_table() { |
211 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
211 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
212 | 212 | |
213 | 213 | $give_table = new Give_Donor_Reports_Table(); |
214 | 214 | $give_table->prepare_items(); |
215 | 215 | ?> |
216 | 216 | <div class="wrap give-reports-donors-wrap"> |
217 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
218 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
217 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
218 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
219 | 219 | <?php |
220 | - $give_table->search_box( __( 'Search', 'give' ), 'give-donors' ); |
|
220 | + $give_table->search_box(__('Search', 'give'), 'give-donors'); |
|
221 | 221 | $give_table->display(); |
222 | 222 | ?> |
223 | 223 | <input type="hidden" name="post_type" value="give_forms" /> |
224 | 224 | <input type="hidden" name="page" value="give-reports" /> |
225 | 225 | <input type="hidden" name="view" value="donors" /> |
226 | 226 | </form> |
227 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
227 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
228 | 228 | </div> |
229 | 229 | <?php |
230 | 230 | } |
231 | 231 | |
232 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
232 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
233 | 233 | |
234 | 234 | |
235 | 235 | /** |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | * @return void |
242 | 242 | */ |
243 | 243 | function give_reports_gateways_table() { |
244 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
244 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
245 | 245 | |
246 | 246 | $give_table = new Give_Gateawy_Reports_Table(); |
247 | 247 | $give_table->prepare_items(); |
248 | 248 | $give_table->display(); |
249 | 249 | } |
250 | 250 | |
251 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
251 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
252 | 252 | |
253 | 253 | |
254 | 254 | /** |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | function give_reports_earnings() { |
261 | 261 | ?> |
262 | 262 | <div class="tablenav top reports-table-nav"> |
263 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Income Over Time', 'give' ); ?></span></h3> |
|
263 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Income Over Time', 'give'); ?></span></h3> |
|
264 | 264 | |
265 | 265 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
266 | 266 | </div> |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | give_reports_graph(); |
269 | 269 | } |
270 | 270 | |
271 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
271 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
272 | 272 | |
273 | 273 | |
274 | 274 | /** |
@@ -283,51 +283,51 @@ discard block |
||
283 | 283 | <div id="post-body"> |
284 | 284 | <div id="post-body-content"> |
285 | 285 | |
286 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
286 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
287 | 287 | |
288 | 288 | |
289 | 289 | <table class="widefat export-options-table give-table"> |
290 | 290 | <thead> |
291 | 291 | <tr> |
292 | - <th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th> |
|
293 | - <th><?php _e( 'Export Options', 'give' ); ?></th> |
|
292 | + <th class="row-title"><?php _e('Export Type', 'give'); ?></th> |
|
293 | + <th><?php _e('Export Options', 'give'); ?></th> |
|
294 | 294 | </tr> |
295 | 295 | </thead> |
296 | 296 | <tbody> |
297 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
297 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
298 | 298 | <tr class="give-export-pdf-sales-earnings"> |
299 | 299 | <td class="row-title"> |
300 | - <h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
300 | + <h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
301 | 301 | |
302 | - <p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
302 | + <p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
303 | 303 | </td> |
304 | 304 | <td> |
305 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php _e( 'Generate PDF', 'give' ); ?></a> |
|
305 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php _e('Generate PDF', 'give'); ?></a> |
|
306 | 306 | </td> |
307 | 307 | </tr> |
308 | 308 | <tr class="alternate give-export-sales-earnings"> |
309 | 309 | <td class="row-title"> |
310 | - <h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
310 | + <h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
311 | 311 | |
312 | - <p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
312 | + <p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
313 | 313 | </td> |
314 | 314 | <td> |
315 | 315 | <form method="post"> |
316 | - <?php echo Give()->html->year_dropdown( 'start_year' ); ?> |
|
317 | - <?php echo Give()->html->month_dropdown( 'start_month' ); ?> |
|
318 | - <?php echo _x( 'to', 'Date one to date two', 'give' ); ?> |
|
319 | - <?php echo Give()->html->year_dropdown( 'end_year' ); ?> |
|
320 | - <?php echo Give()->html->month_dropdown( 'end_month' ); ?> |
|
316 | + <?php echo Give()->html->year_dropdown('start_year'); ?> |
|
317 | + <?php echo Give()->html->month_dropdown('start_month'); ?> |
|
318 | + <?php echo _x('to', 'Date one to date two', 'give'); ?> |
|
319 | + <?php echo Give()->html->year_dropdown('end_year'); ?> |
|
320 | + <?php echo Give()->html->month_dropdown('end_month'); ?> |
|
321 | 321 | <input type="hidden" name="give-action" value="earnings_export" /> |
322 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary" /> |
|
322 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary" /> |
|
323 | 323 | </form> |
324 | 324 | </td> |
325 | 325 | </tr> |
326 | 326 | <tr class="give-export-payment-history"> |
327 | 327 | <td class="row-title"> |
328 | - <h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3> |
|
328 | + <h3><span><?php _e('Export Donation History', 'give'); ?></span></h3> |
|
329 | 329 | |
330 | - <p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
330 | + <p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
331 | 331 | </td> |
332 | 332 | <td> |
333 | 333 | |
@@ -335,57 +335,57 @@ discard block |
||
335 | 335 | <?php echo Give()->html->year_dropdown(); ?> |
336 | 336 | <?php echo Give()->html->month_dropdown(); ?> |
337 | 337 | <select name="give_export_payment_status"> |
338 | - <option value="0"><?php _e( 'All Statuses', 'give' ); ?></option> |
|
338 | + <option value="0"><?php _e('All Statuses', 'give'); ?></option> |
|
339 | 339 | <?php |
340 | 340 | $statuses = give_get_payment_statuses(); |
341 | - foreach ( $statuses as $status => $label ) { |
|
342 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
341 | + foreach ($statuses as $status => $label) { |
|
342 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
343 | 343 | } |
344 | 344 | ?> |
345 | 345 | </select> |
346 | 346 | <input type="hidden" name="give-action" value="payment_export" /> |
347 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary" /> |
|
347 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary" /> |
|
348 | 348 | </form> |
349 | 349 | |
350 | 350 | </td> |
351 | 351 | </tr> |
352 | 352 | <tr class="alt give-export-donors"> |
353 | 353 | <td class="row-title"> |
354 | - <h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
354 | + <h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3> |
|
355 | 355 | |
356 | - <p><?php _e( 'Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give' ); ?></p> |
|
356 | + <p><?php _e('Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give'); ?></p> |
|
357 | 357 | </td> |
358 | 358 | <td> |
359 | 359 | <form method="post" id="give_donor_export"> |
360 | 360 | <select name="give_export_download" id="give_donor_export_download"> |
361 | - <option value="0"><?php printf( __( 'All %s', 'give' ), give_get_forms_label_plural() ); ?></option> |
|
361 | + <option value="0"><?php printf(__('All %s', 'give'), give_get_forms_label_plural()); ?></option> |
|
362 | 362 | <?php |
363 | - $forms = get_posts( array( |
|
363 | + $forms = get_posts(array( |
|
364 | 364 | 'post_type' => 'give_forms', |
365 | - 'posts_per_page' => - 1 |
|
366 | - ) ); |
|
367 | - if ( $forms ) { |
|
368 | - foreach ( $forms as $form ) { |
|
369 | - echo '<option value="' . $form->ID . '">' . get_the_title( $form->ID ) . '</option>'; |
|
365 | + 'posts_per_page' => -1 |
|
366 | + )); |
|
367 | + if ($forms) { |
|
368 | + foreach ($forms as $form) { |
|
369 | + echo '<option value="'.$form->ID.'">'.get_the_title($form->ID).'</option>'; |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | ?> |
373 | 373 | </select> |
374 | 374 | <select name="give_export_option" id="give_donor_export_option"> |
375 | - <option value="emails"><?php _e( 'Emails', 'give' ); ?></option> |
|
376 | - <option value="emails_and_names"><?php _e( 'Emails and Names', 'give' ); ?></option> |
|
377 | - <option value="full"><?php _e( 'Emails, Names, and Purchase Stats', 'give' ); ?></option> |
|
375 | + <option value="emails"><?php _e('Emails', 'give'); ?></option> |
|
376 | + <option value="emails_and_names"><?php _e('Emails and Names', 'give'); ?></option> |
|
377 | + <option value="full"><?php _e('Emails, Names, and Purchase Stats', 'give'); ?></option> |
|
378 | 378 | </select> |
379 | 379 | <input type="hidden" name="give-action" value="email_export" /> |
380 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary" /> |
|
380 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary" /> |
|
381 | 381 | </form> |
382 | 382 | </td> |
383 | 383 | </tr> |
384 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
384 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
385 | 385 | </tbody> |
386 | 386 | </table> |
387 | 387 | |
388 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
388 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
389 | 389 | |
390 | 390 | </div> |
391 | 391 | <!-- .post-body-content --> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | <?php |
396 | 396 | } |
397 | 397 | |
398 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
398 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
399 | 399 | |
400 | 400 | /** |
401 | 401 | * Renders the Reports page |
@@ -404,19 +404,19 @@ discard block |
||
404 | 404 | * @return void |
405 | 405 | */ |
406 | 406 | function give_reports_tab_logs() { |
407 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
407 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
408 | 408 | |
409 | 409 | $current_view = 'sales'; |
410 | 410 | $log_views = give_log_default_views(); |
411 | 411 | |
412 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
412 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
413 | 413 | $current_view = $_GET['view']; |
414 | 414 | } |
415 | 415 | |
416 | - do_action( 'give_logs_view_' . $current_view ); |
|
416 | + do_action('give_logs_view_'.$current_view); |
|
417 | 417 | } |
418 | 418 | |
419 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
419 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
420 | 420 | |
421 | 421 | /** |
422 | 422 | * Retrieves estimated monthly earnings and sales |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | */ |
427 | 427 | function give_estimated_monthly_stats() { |
428 | 428 | |
429 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
429 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
430 | 430 | |
431 | - if ( false === $estimated ) { |
|
431 | + if (false === $estimated) { |
|
432 | 432 | |
433 | 433 | $estimated = array( |
434 | 434 | 'earnings' => 0, |
@@ -437,20 +437,20 @@ discard block |
||
437 | 437 | |
438 | 438 | $stats = new Give_Payment_Stats; |
439 | 439 | |
440 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
441 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
440 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
441 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
442 | 442 | |
443 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
444 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
445 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
446 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
443 | + $current_day = date('d', current_time('timestamp')); |
|
444 | + $current_month = date('n', current_time('timestamp')); |
|
445 | + $current_year = date('Y', current_time('timestamp')); |
|
446 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
447 | 447 | |
448 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
449 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
448 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
449 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
450 | 450 | |
451 | 451 | // Cache for one day |
452 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
452 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
453 | 453 | } |
454 | 454 | |
455 | - return maybe_unserialize( $estimated ); |
|
455 | + return maybe_unserialize($estimated); |
|
456 | 456 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Offline Donations Gateway |
|
4 | - * |
|
5 | - * @package Give |
|
6 | - * @subpackage Gateways |
|
7 | - * @copyright Copyright (c) 2015, WordImpress |
|
8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | - * @since 1.0 |
|
10 | - */ |
|
3 | + * Offline Donations Gateway |
|
4 | + * |
|
5 | + * @package Give |
|
6 | + * @subpackage Gateways |
|
7 | + * @copyright Copyright (c) 2015, WordImpress |
|
8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | + * @since 1.0 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Register the payment gateway |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,47 +40,47 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | |
45 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
46 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
47 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
45 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
46 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
47 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
48 | 48 | $offline_instructions = $global_offline_instruction; |
49 | 49 | |
50 | - if ( $post_offline_customization_option == 'yes' ) { |
|
50 | + if ($post_offline_customization_option == 'yes') { |
|
51 | 51 | $offline_instructions = $post_offline_instructions; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | ob_start(); ?> |
56 | - <?php do_action( 'give_before_offline_info_fields', $form_id ); ?> |
|
56 | + <?php do_action('give_before_offline_info_fields', $form_id); ?> |
|
57 | 57 | <fieldset id="give_offline_payment_info"> |
58 | 58 | <?php |
59 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
60 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( esc_attr__( 'Please enter offline donation instructions in the %s.', 'give' ), '<a href="' . $settings_url . '">' . __( 'this form\'s settings', 'give' ) . '</a>' ); |
|
61 | - echo wpautop( stripslashes( $offline_instructions ) ); |
|
59 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
60 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(esc_attr__('Please enter offline donation instructions in the %s.', 'give'), '<a href="'.$settings_url.'">'.__('this form\'s settings', 'give').'</a>'); |
|
61 | + echo wpautop(stripslashes($offline_instructions)); |
|
62 | 62 | ?> |
63 | 63 | </fieldset> |
64 | - <?php do_action( 'give_after_offline_info_fields', $form_id ); ?> |
|
64 | + <?php do_action('give_after_offline_info_fields', $form_id); ?> |
|
65 | 65 | <?php |
66 | 66 | echo ob_get_clean(); |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
69 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
70 | 70 | |
71 | 71 | |
72 | -function give_offline_billing_fields( $form_id ) { |
|
72 | +function give_offline_billing_fields($form_id) { |
|
73 | 73 | //Enable Default CC fields (billing info) |
74 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
75 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
74 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
75 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
76 | 76 | |
77 | 77 | |
78 | - if ( $global_offline_cc_fields == 'on' || $post_offline_cc_fields == 'on' ) { |
|
79 | - give_default_cc_address_fields( $form_id ); |
|
78 | + if ($global_offline_cc_fields == 'on' || $post_offline_cc_fields == 'on') { |
|
79 | + give_default_cc_address_fields($form_id); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
83 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Process the payment |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return void |
93 | 93 | */ |
94 | -function give_offline_process_payment( $purchase_data ) { |
|
94 | +function give_offline_process_payment($purchase_data) { |
|
95 | 95 | |
96 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
96 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
97 | 97 | |
98 | 98 | // setup the payment details |
99 | 99 | $payment_data = array( |
100 | 100 | 'price' => $purchase_data['price'], |
101 | 101 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
102 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
102 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
103 | 103 | 'date' => $purchase_data['date'], |
104 | 104 | 'user_email' => $purchase_data['user_email'], |
105 | 105 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -111,20 +111,20 @@ discard block |
||
111 | 111 | |
112 | 112 | |
113 | 113 | // record the pending payment |
114 | - $payment = give_insert_payment( $payment_data ); |
|
114 | + $payment = give_insert_payment($payment_data); |
|
115 | 115 | |
116 | - if ( $payment ) { |
|
117 | - give_offline_send_admin_notice( $payment ); |
|
118 | - give_offline_send_donor_instructions( $payment ); |
|
116 | + if ($payment) { |
|
117 | + give_offline_send_admin_notice($payment); |
|
118 | + give_offline_send_donor_instructions($payment); |
|
119 | 119 | give_send_to_success_page(); |
120 | 120 | } else { |
121 | 121 | // if errors are present, send the user back to the donation form so they can be corrected |
122 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
122 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | } |
126 | 126 | |
127 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
127 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
128 | 128 | |
129 | 129 | |
130 | 130 | /** |
@@ -137,47 +137,47 @@ discard block |
||
137 | 137 | * @since 1.0 |
138 | 138 | * @return void |
139 | 139 | */ |
140 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
140 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
141 | 141 | |
142 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
143 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
142 | + $payment_data = give_get_payment_meta($payment_id); |
|
143 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
144 | 144 | |
145 | 145 | //Customize email content depending on whether the single form has been customized |
146 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
146 | + $email_content = give_get_option('global_offline_donation_email'); |
|
147 | 147 | |
148 | - if ( $post_offline_customization_option === 'yes' ) { |
|
149 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
148 | + if ($post_offline_customization_option === 'yes') { |
|
149 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
150 | 150 | } |
151 | 151 | |
152 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
153 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
152 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
153 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
154 | 154 | |
155 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
156 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
155 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
156 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
157 | 157 | |
158 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
158 | + $to_email = give_get_payment_user_email($payment_id); |
|
159 | 159 | |
160 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
161 | - if ( $post_offline_customization_option === 'yes' ) { |
|
162 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
160 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
161 | + if ($post_offline_customization_option === 'yes') { |
|
162 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
163 | 163 | } |
164 | 164 | |
165 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
166 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
165 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
166 | + $subject = give_do_email_tags($subject, $payment_id); |
|
167 | 167 | |
168 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
169 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
168 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
169 | + $message = give_do_email_tags($email_content, $payment_id); |
|
170 | 170 | |
171 | 171 | $emails = Give()->emails; |
172 | 172 | |
173 | - $emails->__set( 'from_name', $from_name ); |
|
174 | - $emails->__set( 'from_email', $from_email ); |
|
175 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
173 | + $emails->__set('from_name', $from_name); |
|
174 | + $emails->__set('from_email', $from_email); |
|
175 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
176 | 176 | |
177 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
178 | - $emails->__set( 'headers', $headers ); |
|
177 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
178 | + $emails->__set('headers', $headers); |
|
179 | 179 | |
180 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
180 | + $emails->send($to_email, $subject, $message, $attachments); |
|
181 | 181 | |
182 | 182 | } |
183 | 183 | |
@@ -194,48 +194,48 @@ discard block |
||
194 | 194 | * @return void |
195 | 195 | * |
196 | 196 | */ |
197 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
197 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
198 | 198 | |
199 | 199 | /* Send an email notification to the admin */ |
200 | 200 | $admin_email = give_get_admin_notice_emails(); |
201 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
201 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
202 | 202 | |
203 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
204 | - $user_data = get_userdata( $user_info['id'] ); |
|
203 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
204 | + $user_data = get_userdata($user_info['id']); |
|
205 | 205 | $name = $user_data->display_name; |
206 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
207 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
206 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
207 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
208 | 208 | } else { |
209 | 209 | $name = $user_info['email']; |
210 | 210 | } |
211 | 211 | |
212 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
212 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
213 | 213 | |
214 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id ); |
|
214 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id); |
|
215 | 215 | |
216 | - $admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n"; |
|
217 | - $admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' '; |
|
218 | - $admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
216 | + $admin_message = esc_attr__('Dear Admin,', 'give')."\n\n"; |
|
217 | + $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' '; |
|
218 | + $admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
219 | 219 | |
220 | 220 | |
221 | - $admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
222 | - $admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n"; |
|
221 | + $admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
222 | + $admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n"; |
|
223 | 223 | |
224 | 224 | //Order URL |
225 | - $order_url = '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ) . '">'; |
|
226 | - $admin_message .= sprintf( __( '%sClick Here to View and/or Update Donation Details%s', 'give' ), $order_url, ' »</a>' ) . "\n\n"; |
|
225 | + $order_url = '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id).'">'; |
|
226 | + $admin_message .= sprintf(__('%sClick Here to View and/or Update Donation Details%s', 'give'), $order_url, ' »</a>')."\n\n"; |
|
227 | 227 | |
228 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
229 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
230 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
228 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
229 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
230 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
231 | 231 | |
232 | 232 | //Send Email |
233 | 233 | $emails = Give()->emails; |
234 | - if ( ! empty( $admin_headers ) ) { |
|
235 | - $emails->__set( 'headers', $admin_headers ); |
|
234 | + if ( ! empty($admin_headers)) { |
|
235 | + $emails->__set('headers', $admin_headers); |
|
236 | 236 | } |
237 | 237 | |
238 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
238 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
239 | 239 | |
240 | 240 | } |
241 | 241 | |
@@ -246,15 +246,15 @@ discard block |
||
246 | 246 | * @since 1.0 |
247 | 247 | * @return array |
248 | 248 | */ |
249 | -function give_offline_add_settings( $settings ) { |
|
249 | +function give_offline_add_settings($settings) { |
|
250 | 250 | |
251 | 251 | //Vars |
252 | 252 | $prefix = '_give_'; |
253 | 253 | |
254 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
254 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
255 | 255 | |
256 | 256 | //this gateway isn't active |
257 | - if ( ! $is_gateway_active ) { |
|
257 | + if ( ! $is_gateway_active) { |
|
258 | 258 | //return settings and bounce |
259 | 259 | return $settings; |
260 | 260 | } |
@@ -263,27 +263,27 @@ discard block |
||
263 | 263 | $check_settings = array( |
264 | 264 | |
265 | 265 | array( |
266 | - 'name' => esc_attr__( 'Customize Offline Donations', 'give' ), |
|
267 | - 'desc' => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ), |
|
268 | - 'id' => $prefix . 'customize_offline_donations', |
|
266 | + 'name' => esc_attr__('Customize Offline Donations', 'give'), |
|
267 | + 'desc' => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'), |
|
268 | + 'id' => $prefix.'customize_offline_donations', |
|
269 | 269 | 'type' => 'radio_inline', |
270 | 270 | 'default' => 'no', |
271 | 271 | 'options' => array( |
272 | - 'yes' => esc_attr__( 'Yes', 'give' ), |
|
273 | - 'no' => esc_attr__( 'No', 'give' ), |
|
272 | + 'yes' => esc_attr__('Yes', 'give'), |
|
273 | + 'no' => esc_attr__('No', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => esc_attr__( 'Request Billing Information', 'give' ), |
|
278 | - 'desc' => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
279 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
277 | + 'name' => esc_attr__('Request Billing Information', 'give'), |
|
278 | + 'desc' => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
279 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
280 | 280 | 'row_classes' => 'give-subfield', |
281 | 281 | 'type' => 'checkbox' |
282 | 282 | ), |
283 | 283 | array( |
284 | - 'id' => $prefix . 'offline_checkout_notes', |
|
285 | - 'name' => esc_attr__( 'Offline Donation Instructions', 'give' ), |
|
286 | - 'desc' => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
284 | + 'id' => $prefix.'offline_checkout_notes', |
|
285 | + 'name' => esc_attr__('Offline Donation Instructions', 'give'), |
|
286 | + 'desc' => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
287 | 287 | 'default' => give_get_default_offline_donation_content(), |
288 | 288 | 'type' => 'wysiwyg', |
289 | 289 | 'row_classes' => 'give-subfield', |
@@ -292,17 +292,17 @@ discard block |
||
292 | 292 | ) |
293 | 293 | ), |
294 | 294 | array( |
295 | - 'id' => $prefix . 'offline_donation_subject', |
|
296 | - 'name' => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
297 | - 'desc' => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
298 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
295 | + 'id' => $prefix.'offline_donation_subject', |
|
296 | + 'name' => esc_attr__('Offline Donation Email Instructions Subject', 'give'), |
|
297 | + 'desc' => esc_attr__('Enter the subject line for the donation receipt email.', 'give'), |
|
298 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
299 | 299 | 'row_classes' => 'give-subfield', |
300 | 300 | 'type' => 'text' |
301 | 301 | ), |
302 | 302 | array( |
303 | - 'id' => $prefix . 'offline_donation_email', |
|
304 | - 'name' => esc_attr__( 'Offline Donation Email Instructions', 'give' ), |
|
305 | - 'desc' => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
303 | + 'id' => $prefix.'offline_donation_email', |
|
304 | + 'name' => esc_attr__('Offline Donation Email Instructions', 'give'), |
|
305 | + 'desc' => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
306 | 306 | 'default' => give_get_default_offline_donation_email_content(), |
307 | 307 | 'type' => 'wysiwyg', |
308 | 308 | 'row_classes' => 'give-subfield', |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | ) |
313 | 313 | ); |
314 | 314 | |
315 | - return array_merge( $settings, $check_settings ); |
|
315 | + return array_merge($settings, $check_settings); |
|
316 | 316 | } |
317 | 317 | |
318 | -add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' ); |
|
318 | +add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings'); |
|
319 | 319 | |
320 | 320 | |
321 | 321 | /** |
@@ -327,20 +327,20 @@ discard block |
||
327 | 327 | */ |
328 | 328 | function give_get_default_offline_donation_content() { |
329 | 329 | |
330 | - $sitename = get_bloginfo( 'sitename' ); |
|
330 | + $sitename = get_bloginfo('sitename'); |
|
331 | 331 | |
332 | - $default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
332 | + $default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
333 | 333 | $default_text .= '<ol>'; |
334 | - $default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>'; |
|
335 | - $default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>'; |
|
336 | - $default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>'; |
|
334 | + $default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>'; |
|
335 | + $default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>'; |
|
336 | + $default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>'; |
|
337 | 337 | $default_text .= '</ol>'; |
338 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
338 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
339 | 339 | $default_text .= ' <em>123 G Street </em><br>'; |
340 | 340 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
341 | - $default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
341 | + $default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
342 | 342 | |
343 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
343 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
344 | 344 | |
345 | 345 | } |
346 | 346 | |
@@ -353,21 +353,21 @@ discard block |
||
353 | 353 | */ |
354 | 354 | function give_get_default_offline_donation_email_content() { |
355 | 355 | |
356 | - $sitename = get_bloginfo( 'sitename' ); |
|
357 | - $default_text = '<p>' . esc_attr__( 'Dear {name},', 'give' ) . '</p>'; |
|
358 | - $default_text .= '<p>' . esc_attr__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
356 | + $sitename = get_bloginfo('sitename'); |
|
357 | + $default_text = '<p>'.esc_attr__('Dear {name},', 'give').'</p>'; |
|
358 | + $default_text .= '<p>'.esc_attr__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
359 | 359 | $default_text .= '<ol>'; |
360 | - $default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>'; |
|
361 | - $default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>'; |
|
362 | - $default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>'; |
|
360 | + $default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>'; |
|
361 | + $default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>'; |
|
362 | + $default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>'; |
|
363 | 363 | $default_text .= '</ol>'; |
364 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
364 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
365 | 365 | $default_text .= ' <em>123 G Street </em><br>'; |
366 | 366 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
367 | - $default_text .= '<p>' . esc_attr__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
368 | - $default_text .= '<p>' . esc_attr__( 'Sincerely,', 'give' ) . '</p>'; |
|
369 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
367 | + $default_text .= '<p>'.esc_attr__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
368 | + $default_text .= '<p>'.esc_attr__('Sincerely,', 'give').'</p>'; |
|
369 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
370 | 370 | |
371 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
371 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
372 | 372 | |
373 | 373 | } |
@@ -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 | |
@@ -28,66 +28,66 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
32 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
33 | 33 | return; |
34 | 34 | } // Make sure that payments are only completed once |
35 | 35 | |
36 | 36 | // Make sure the payment completion is only processed when new status is complete |
37 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
37 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | |
41 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
42 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
43 | - $completed_date = give_get_payment_completed_date( $payment_id ); |
|
44 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
45 | - $donor_id = give_get_payment_customer_id( $payment_id ); |
|
46 | - $amount = give_get_payment_amount( $payment_id ); |
|
41 | + $payment_meta = give_get_payment_meta($payment_id); |
|
42 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
43 | + $completed_date = give_get_payment_completed_date($payment_id); |
|
44 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
45 | + $donor_id = give_get_payment_customer_id($payment_id); |
|
46 | + $amount = give_get_payment_amount($payment_id); |
|
47 | 47 | |
48 | - do_action( 'give_pre_complete_purchase', $payment_id ); |
|
48 | + do_action('give_pre_complete_purchase', $payment_id); |
|
49 | 49 | |
50 | - $price_id = isset( $_POST['give-price-id'] ) ? (int) $_POST['give-price-id'] : false; |
|
50 | + $price_id = isset($_POST['give-price-id']) ? (int) $_POST['give-price-id'] : false; |
|
51 | 51 | |
52 | 52 | // Ensure these actions only run once, ever |
53 | - if ( empty( $completed_date ) ) { |
|
53 | + if (empty($completed_date)) { |
|
54 | 54 | |
55 | - if ( ! give_is_test_mode() || apply_filters( 'give_log_test_payment_stats', false ) ) { |
|
55 | + if ( ! give_is_test_mode() || apply_filters('give_log_test_payment_stats', false)) { |
|
56 | 56 | |
57 | - give_record_sale_in_log( $payment_meta['form_id'], $payment_id, $price_id, $creation_date ); |
|
58 | - give_increase_purchase_count( $payment_meta['form_id'] ); |
|
59 | - give_increase_earnings( $payment_meta['form_id'], $amount ); |
|
57 | + give_record_sale_in_log($payment_meta['form_id'], $payment_id, $price_id, $creation_date); |
|
58 | + give_increase_purchase_count($payment_meta['form_id']); |
|
59 | + give_increase_earnings($payment_meta['form_id'], $amount); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | - do_action( 'give_complete_form_donation', $payment_meta['form_id'], $payment_id, $payment_meta ); |
|
63 | + do_action('give_complete_form_donation', $payment_meta['form_id'], $payment_id, $payment_meta); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
67 | 67 | // Clear the total earnings cache |
68 | - delete_transient( 'give_earnings_total' ); |
|
68 | + delete_transient('give_earnings_total'); |
|
69 | 69 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
70 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
71 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
70 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
71 | + delete_transient(md5('give_earnings_todaytoday')); |
|
72 | 72 | |
73 | 73 | |
74 | 74 | // Increase the donor's purchase stats |
75 | - Give()->customers->increment_stats( $donor_id, $amount ); |
|
75 | + Give()->customers->increment_stats($donor_id, $amount); |
|
76 | 76 | |
77 | - give_increase_total_earnings( $amount ); |
|
77 | + give_increase_total_earnings($amount); |
|
78 | 78 | |
79 | 79 | // Ensure this action only runs once ever |
80 | - if ( empty( $completed_date ) ) { |
|
80 | + if (empty($completed_date)) { |
|
81 | 81 | |
82 | 82 | // Save the completed date |
83 | - give_update_payment_meta( $payment_id, '_give_completed_date', current_time( 'mysql' ) ); |
|
83 | + give_update_payment_meta($payment_id, '_give_completed_date', current_time('mysql')); |
|
84 | 84 | |
85 | - do_action( 'give_complete_purchase', $payment_id ); |
|
85 | + do_action('give_complete_purchase', $payment_id); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
90 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
91 | 91 | |
92 | 92 | |
93 | 93 | /** |
@@ -101,19 +101,19 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return void |
103 | 103 | */ |
104 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
104 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
105 | 105 | |
106 | 106 | // Get the list of statuses so that status in the payment note can be translated |
107 | 107 | $stati = give_get_payment_statuses(); |
108 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
109 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
108 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
109 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
110 | 110 | |
111 | - $status_change = sprintf( __( 'Status changed from %s to %s', 'give' ), $old_status, $new_status ); |
|
111 | + $status_change = sprintf(__('Status changed from %s to %s', 'give'), $old_status, $new_status); |
|
112 | 112 | |
113 | - give_insert_payment_note( $payment_id, $status_change ); |
|
113 | + give_insert_payment_note($payment_id, $status_change); |
|
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
116 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Reduces earnings and donation stats when a donation is refunded |
@@ -126,40 +126,40 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return void |
128 | 128 | */ |
129 | -function give_undo_donation_on_refund( $payment_id, $new_status, $old_status ) { |
|
129 | +function give_undo_donation_on_refund($payment_id, $new_status, $old_status) { |
|
130 | 130 | |
131 | - if ( 'publish' != $old_status && 'revoked' != $old_status ) { |
|
131 | + if ('publish' != $old_status && 'revoked' != $old_status) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if ( 'refunded' != $new_status ) { |
|
135 | + if ('refunded' != $new_status) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Set necessary vars |
140 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
141 | - $amount = give_get_payment_amount( $payment_id ); |
|
140 | + $payment_meta = give_get_payment_meta($payment_id); |
|
141 | + $amount = give_get_payment_amount($payment_id); |
|
142 | 142 | |
143 | 143 | // Undo this purchase |
144 | - give_undo_purchase( $payment_meta['form_id'], $payment_id ); |
|
144 | + give_undo_purchase($payment_meta['form_id'], $payment_id); |
|
145 | 145 | |
146 | 146 | // Decrease total earnings |
147 | - give_decrease_total_earnings( $amount ); |
|
147 | + give_decrease_total_earnings($amount); |
|
148 | 148 | |
149 | 149 | // Decrement the stats for the donor |
150 | - $donor_id = give_get_payment_customer_id( $payment_id ); |
|
150 | + $donor_id = give_get_payment_customer_id($payment_id); |
|
151 | 151 | |
152 | - if ( $donor_id ) { |
|
152 | + if ($donor_id) { |
|
153 | 153 | |
154 | - Give()->customers->decrement_stats( $donor_id, $amount ); |
|
154 | + Give()->customers->decrement_stats($donor_id, $amount); |
|
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
159 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
159 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
160 | 160 | } |
161 | 161 | |
162 | -add_action( 'give_update_payment_status', 'give_undo_donation_on_refund', 100, 3 ); |
|
162 | +add_action('give_update_payment_status', 'give_undo_donation_on_refund', 100, 3); |
|
163 | 163 | |
164 | 164 | |
165 | 165 | /** |
@@ -172,13 +172,13 @@ discard block |
||
172 | 172 | * @param $new_status the status of the payment, probably "publish" |
173 | 173 | * @param $old_status the status of the payment prior to being marked as "complete", probably "pending" |
174 | 174 | */ |
175 | -function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) { |
|
176 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
175 | +function give_clear_user_history_cache($payment_id, $new_status, $old_status) { |
|
176 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
177 | 177 | |
178 | - delete_transient( 'give_user_' . $user_info['id'] . '_purchases' ); |
|
178 | + delete_transient('give_user_'.$user_info['id'].'_purchases'); |
|
179 | 179 | } |
180 | 180 | |
181 | -add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 ); |
|
181 | +add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3); |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Updates all old payments, prior to 1.2, with new |
@@ -192,32 +192,32 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return void |
194 | 194 | */ |
195 | -function give_update_old_payments_with_totals( $data ) { |
|
196 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
195 | +function give_update_old_payments_with_totals($data) { |
|
196 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
197 | 197 | return; |
198 | 198 | } |
199 | 199 | |
200 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
200 | + if (get_option('give_payment_totals_upgraded')) { |
|
201 | 201 | return; |
202 | 202 | } |
203 | 203 | |
204 | - $payments = give_get_payments( array( |
|
204 | + $payments = give_get_payments(array( |
|
205 | 205 | 'offset' => 0, |
206 | - 'number' => - 1, |
|
206 | + 'number' => -1, |
|
207 | 207 | 'mode' => 'all' |
208 | - ) ); |
|
208 | + )); |
|
209 | 209 | |
210 | - if ( $payments ) { |
|
211 | - foreach ( $payments as $payment ) { |
|
212 | - $meta = give_get_payment_meta( $payment->ID ); |
|
213 | - give_update_payment_meta( $payment->ID, '_give_payment_total', $meta['amount'] ); |
|
210 | + if ($payments) { |
|
211 | + foreach ($payments as $payment) { |
|
212 | + $meta = give_get_payment_meta($payment->ID); |
|
213 | + give_update_payment_meta($payment->ID, '_give_payment_total', $meta['amount']); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
217 | + add_option('give_payment_totals_upgraded', 1); |
|
218 | 218 | } |
219 | 219 | |
220 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
220 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
221 | 221 | |
222 | 222 | /** |
223 | 223 | * Updates week-old+ 'pending' orders to 'abandoned' |
@@ -226,29 +226,29 @@ discard block |
||
226 | 226 | * @return void |
227 | 227 | */ |
228 | 228 | function give_mark_abandoned_donations() { |
229 | - $args = array( |
|
229 | + $args = array( |
|
230 | 230 | 'status' => 'pending', |
231 | - 'number' => - 1, |
|
231 | + 'number' => -1, |
|
232 | 232 | 'fields' => 'ids' |
233 | 233 | ); |
234 | 234 | |
235 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
235 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
236 | 236 | |
237 | - $payments = give_get_payments( $args ); |
|
237 | + $payments = give_get_payments($args); |
|
238 | 238 | |
239 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
239 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
240 | 240 | |
241 | - if ( $payments ) { |
|
242 | - foreach ( $payments as $payment ) { |
|
243 | - $gateway = give_get_payment_gateway( $payment ); |
|
241 | + if ($payments) { |
|
242 | + foreach ($payments as $payment) { |
|
243 | + $gateway = give_get_payment_gateway($payment); |
|
244 | 244 | //Skip offline gateway payments |
245 | - if ( $gateway == 'offline' ) { |
|
245 | + if ($gateway == 'offline') { |
|
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | //Non-offline get marked as 'abandoned' |
249 | - give_update_payment_status( $payment, 'abandoned' ); |
|
249 | + give_update_payment_status($payment, 'abandoned'); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
255 | 254 | \ No newline at end of file |
255 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
|
256 | 256 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_show_upgrade_notices() { |
27 | 27 | |
28 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
28 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
29 | 29 | return; |
30 | 30 | } // Don't show notices on the upgrades page |
31 | 31 | |
32 | - $give_version = get_option( 'give_version' ); |
|
32 | + $give_version = get_option('give_version'); |
|
33 | 33 | |
34 | - if ( ! $give_version ) { |
|
34 | + if ( ! $give_version) { |
|
35 | 35 | // 1.0 is the first version to use this option so we must add it |
36 | 36 | $give_version = '1.0'; |
37 | 37 | } |
38 | 38 | |
39 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
39 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
40 | 40 | |
41 | 41 | /* |
42 | 42 | * NOTICE: |
@@ -47,18 +47,18 @@ discard block |
||
47 | 47 | */ |
48 | 48 | |
49 | 49 | //v1.3.2 Upgrades |
50 | - if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) { |
|
50 | + if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) { |
|
51 | 51 | printf( |
52 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
53 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
52 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
53 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
54 | 54 | ); |
55 | 55 | } |
56 | 56 | |
57 | 57 | //v1.3.4 Upgrades //ensure the user has gone through 1.3.4 |
58 | - if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) { |
|
58 | + if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) { |
|
59 | 59 | printf( |
60 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
61 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
60 | + '<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
61 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | } |
70 | 70 | |
71 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
71 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Triggers all upgrade functions |
@@ -80,26 +80,26 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function give_trigger_upgrades() { |
82 | 82 | |
83 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
84 | - wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
83 | + if ( ! current_user_can('manage_give_settings')) { |
|
84 | + wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403)); |
|
85 | 85 | } |
86 | 86 | |
87 | - $give_version = get_option( 'give_version' ); |
|
87 | + $give_version = get_option('give_version'); |
|
88 | 88 | |
89 | - if ( ! $give_version ) { |
|
89 | + if ( ! $give_version) { |
|
90 | 90 | // 1.0 is the first version to use this option so we must add it |
91 | 91 | $give_version = '1.0'; |
92 | - add_option( 'give_version', $give_version ); |
|
92 | + add_option('give_version', $give_version); |
|
93 | 93 | } |
94 | 94 | |
95 | - update_option( 'give_version', GIVE_VERSION ); |
|
95 | + update_option('give_version', GIVE_VERSION); |
|
96 | 96 | |
97 | - if ( DOING_AJAX ) { |
|
98 | - die( 'complete' ); |
|
97 | + if (DOING_AJAX) { |
|
98 | + die('complete'); |
|
99 | 99 | } // Let AJAX know that the upgrade is complete |
100 | 100 | } |
101 | 101 | |
102 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
102 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Check if the upgrade routine has been run for a specific action |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return bool If the action has been added to the completed actions array |
112 | 112 | */ |
113 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
113 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
114 | 114 | |
115 | - if ( empty( $upgrade_action ) ) { |
|
115 | + if (empty($upgrade_action)) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $completed_upgrades = give_get_completed_upgrades(); |
120 | 120 | |
121 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
121 | + return in_array($upgrade_action, $completed_upgrades); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @return bool If the function was successfully added |
133 | 133 | */ |
134 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
134 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
135 | 135 | |
136 | - if ( empty( $upgrade_action ) ) { |
|
136 | + if (empty($upgrade_action)) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | $completed_upgrades[] = $upgrade_action; |
142 | 142 | |
143 | 143 | // Remove any blanks, and only show uniques |
144 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
144 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
145 | 145 | |
146 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
146 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | */ |
155 | 155 | function give_get_completed_upgrades() { |
156 | 156 | |
157 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
157 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
158 | 158 | |
159 | - if ( false === $completed_upgrades ) { |
|
159 | + if (false === $completed_upgrades) { |
|
160 | 160 | $completed_upgrades = array(); |
161 | 161 | } |
162 | 162 | |
@@ -175,30 +175,30 @@ discard block |
||
175 | 175 | */ |
176 | 176 | function give_v132_upgrade_give_payment_customer_id() { |
177 | 177 | global $wpdb; |
178 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
179 | - wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
178 | + if ( ! current_user_can('manage_give_settings')) { |
|
179 | + wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403)); |
|
180 | 180 | } |
181 | 181 | |
182 | - ignore_user_abort( true ); |
|
182 | + ignore_user_abort(true); |
|
183 | 183 | |
184 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
185 | - @set_time_limit( 0 ); |
|
184 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
185 | + @set_time_limit(0); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | //UPDATE DB METAKEYS |
189 | 189 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
190 | - $query = $wpdb->query( $sql ); |
|
190 | + $query = $wpdb->query($sql); |
|
191 | 191 | |
192 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
193 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
194 | - delete_option( 'give_doing_upgrade' ); |
|
195 | - wp_redirect( admin_url() ); |
|
192 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
193 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
194 | + delete_option('give_doing_upgrade'); |
|
195 | + wp_redirect(admin_url()); |
|
196 | 196 | exit; |
197 | 197 | |
198 | 198 | |
199 | 199 | } |
200 | 200 | |
201 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
201 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Upgrades the Offline Status |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | |
213 | 213 | global $wpdb; |
214 | 214 | |
215 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
216 | - wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
215 | + if ( ! current_user_can('manage_give_settings')) { |
|
216 | + wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403)); |
|
217 | 217 | } |
218 | 218 | |
219 | - ignore_user_abort( true ); |
|
219 | + ignore_user_abort(true); |
|
220 | 220 | |
221 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
222 | - @set_time_limit( 0 ); |
|
221 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
222 | + @set_time_limit(0); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | // Get abandoned offline payments |
@@ -229,32 +229,32 @@ discard block |
||
229 | 229 | $where .= "AND ( p.post_status = 'abandoned' )"; |
230 | 230 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
231 | 231 | |
232 | - $sql = $select . $join . $where; |
|
233 | - $found_payments = $wpdb->get_col( $sql ); |
|
232 | + $sql = $select.$join.$where; |
|
233 | + $found_payments = $wpdb->get_col($sql); |
|
234 | 234 | |
235 | 235 | |
236 | - foreach ( $found_payments as $payment ) { |
|
236 | + foreach ($found_payments as $payment) { |
|
237 | 237 | |
238 | 238 | //Only change ones marked abandoned since our release last week |
239 | 239 | //because the admin may have marked some abandoned themselves |
240 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
240 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
241 | 241 | |
242 | 242 | //1450124863 = 12/10/2015 20:42:25 |
243 | - if ( $modified_time >= 1450124863 ) { |
|
243 | + if ($modified_time >= 1450124863) { |
|
244 | 244 | |
245 | - give_update_payment_status( $payment, 'pending' ); |
|
245 | + give_update_payment_status($payment, 'pending'); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
252 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
253 | - delete_option( 'give_doing_upgrade' ); |
|
254 | - wp_redirect( admin_url() ); |
|
251 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
252 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
253 | + delete_option('give_doing_upgrade'); |
|
254 | + wp_redirect(admin_url()); |
|
255 | 255 | exit; |
256 | 256 | |
257 | 257 | |
258 | 258 | } |
259 | 259 | |
260 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
260 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
@@ -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 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_system_info_callback() { |
26 | 26 | |
27 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
27 | + if ( ! current_user_can('manage_give_settings')) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" title="To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo give_tools_sysinfo_get(); ?></textarea> |
33 | 33 | <p class="submit"> |
34 | 34 | <input type="hidden" name="give-action" value="download_sysinfo" /> |
35 | - <?php submit_button( 'Download System Info File', 'secondary', 'give-download-sysinfo', false ); ?> |
|
35 | + <?php submit_button('Download System Info File', 'secondary', 'give-download-sysinfo', false); ?> |
|
36 | 36 | </p> |
37 | 37 | <style> |
38 | 38 | .give_forms_page_give-settings .give-submit-wrap { |
@@ -55,63 +55,63 @@ discard block |
||
55 | 55 | function give_tools_sysinfo_get() { |
56 | 56 | global $wpdb, $give_options; |
57 | 57 | |
58 | - if ( ! class_exists( 'Browser' ) ) { |
|
59 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php'; |
|
58 | + if ( ! class_exists('Browser')) { |
|
59 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/browser.php'; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $browser = new Browser(); |
63 | 63 | |
64 | 64 | // Get theme info |
65 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
66 | - $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
67 | - $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; |
|
65 | + if (get_bloginfo('version') < '3.4') { |
|
66 | + $theme_data = get_theme_data(get_stylesheet_directory().'/style.css'); |
|
67 | + $theme = $theme_data['Name'].' '.$theme_data['Version']; |
|
68 | 68 | } else { |
69 | 69 | $theme_data = wp_get_theme(); |
70 | - $theme = $theme_data->Name . ' ' . $theme_data->Version; |
|
70 | + $theme = $theme_data->Name.' '.$theme_data->Version; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Try to identify the hosting provider |
74 | 74 | $host = give_get_host(); |
75 | 75 | |
76 | - $return = '### Begin System Info ###' . "\n\n"; |
|
76 | + $return = '### Begin System Info ###'."\n\n"; |
|
77 | 77 | |
78 | 78 | // Start with the basics... |
79 | - $return .= '-- Site Info' . "\n\n"; |
|
80 | - $return .= 'Site URL: ' . site_url() . "\n"; |
|
81 | - $return .= 'Home URL: ' . home_url() . "\n"; |
|
82 | - $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; |
|
79 | + $return .= '-- Site Info'."\n\n"; |
|
80 | + $return .= 'Site URL: '.site_url()."\n"; |
|
81 | + $return .= 'Home URL: '.home_url()."\n"; |
|
82 | + $return .= 'Multisite: '.(is_multisite() ? 'Yes' : 'No')."\n"; |
|
83 | 83 | |
84 | - $return = apply_filters( 'give_sysinfo_after_site_info', $return ); |
|
84 | + $return = apply_filters('give_sysinfo_after_site_info', $return); |
|
85 | 85 | |
86 | 86 | // Can we determine the site's host? |
87 | - if ( $host ) { |
|
88 | - $return .= "\n" . '-- Hosting Provider' . "\n\n"; |
|
89 | - $return .= 'Host: ' . $host . "\n"; |
|
87 | + if ($host) { |
|
88 | + $return .= "\n".'-- Hosting Provider'."\n\n"; |
|
89 | + $return .= 'Host: '.$host."\n"; |
|
90 | 90 | |
91 | - $return = apply_filters( 'give_sysinfo_after_host_info', $return ); |
|
91 | + $return = apply_filters('give_sysinfo_after_host_info', $return); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // The local users' browser information, handled by the Browser class |
95 | - $return .= "\n" . '-- User Browser' . "\n\n"; |
|
95 | + $return .= "\n".'-- User Browser'."\n\n"; |
|
96 | 96 | $return .= $browser; |
97 | 97 | |
98 | - $return = apply_filters( 'give_sysinfo_after_user_browser', $return ); |
|
98 | + $return = apply_filters('give_sysinfo_after_user_browser', $return); |
|
99 | 99 | |
100 | 100 | // WordPress configuration |
101 | - $return .= "\n" . '-- WordPress Configuration' . "\n\n"; |
|
102 | - $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; |
|
103 | - $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; |
|
104 | - $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; |
|
105 | - $return .= 'Active Theme: ' . $theme . "\n"; |
|
106 | - $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; |
|
101 | + $return .= "\n".'-- WordPress Configuration'."\n\n"; |
|
102 | + $return .= 'Version: '.get_bloginfo('version')."\n"; |
|
103 | + $return .= 'Language: '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n"; |
|
104 | + $return .= 'Permalink Structure: '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n"; |
|
105 | + $return .= 'Active Theme: '.$theme."\n"; |
|
106 | + $return .= 'Show On Front: '.get_option('show_on_front')."\n"; |
|
107 | 107 | |
108 | 108 | // Only show page specs if frontpage is set to 'page' |
109 | - if ( get_option( 'show_on_front' ) == 'page' ) { |
|
110 | - $front_page_id = get_option( 'page_on_front' ); |
|
111 | - $blog_page_id = get_option( 'page_for_posts' ); |
|
109 | + if (get_option('show_on_front') == 'page') { |
|
110 | + $front_page_id = get_option('page_on_front'); |
|
111 | + $blog_page_id = get_option('page_for_posts'); |
|
112 | 112 | |
113 | - $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; |
|
114 | - $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; |
|
113 | + $return .= 'Page On Front: '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n"; |
|
114 | + $return .= 'Page For Posts: '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n"; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | // Make sure wp_remote_post() is working |
@@ -120,200 +120,200 @@ discard block |
||
120 | 120 | $params = array( |
121 | 121 | 'sslverify' => false, |
122 | 122 | 'timeout' => 60, |
123 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
123 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
124 | 124 | 'body' => $request |
125 | 125 | ); |
126 | 126 | |
127 | - $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); |
|
127 | + $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); |
|
128 | 128 | |
129 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
129 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
130 | 130 | $WP_REMOTE_POST = 'wp_remote_post() works'; |
131 | 131 | } else { |
132 | 132 | $WP_REMOTE_POST = 'wp_remote_post() does not work'; |
133 | 133 | } |
134 | 134 | |
135 | - $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; |
|
136 | - $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; |
|
137 | - $return .= 'Admin AJAX: ' . ( give_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; |
|
138 | - $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; |
|
139 | - $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; |
|
140 | - $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; |
|
135 | + $return .= 'Remote Post: '.$WP_REMOTE_POST."\n"; |
|
136 | + $return .= 'Table Prefix: '.'Length: '.strlen($wpdb->prefix).' Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n"; |
|
137 | + $return .= 'Admin AJAX: '.(give_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n"; |
|
138 | + $return .= 'WP_DEBUG: '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n"; |
|
139 | + $return .= 'Memory Limit: '.WP_MEMORY_LIMIT."\n"; |
|
140 | + $return .= 'Registered Post Stati: '.implode(', ', get_post_stati())."\n"; |
|
141 | 141 | |
142 | - $return = apply_filters( 'give_sysinfo_after_wordpress_config', $return ); |
|
142 | + $return = apply_filters('give_sysinfo_after_wordpress_config', $return); |
|
143 | 143 | |
144 | 144 | // GIVE configuration |
145 | - $return .= "\n" . '-- Give Configuration' . "\n\n"; |
|
146 | - $return .= 'Version: ' . GIVE_VERSION . "\n"; |
|
147 | - $return .= 'Upgraded From: ' . get_option( 'give_version_upgraded_from', 'None' ) . "\n"; |
|
148 | - $return .= 'Test Mode: ' . ( give_is_test_mode() ? "Enabled\n" : "Disabled\n" ); |
|
149 | - $return .= 'Currency Code: ' . give_get_currency() . "\n"; |
|
150 | - $return .= 'Currency Position: ' . give_get_option( 'currency_position', 'before' ) . "\n"; |
|
151 | - $return .= 'Decimal Separator: ' . give_get_option( 'decimal_separator', '.' ) . "\n"; |
|
152 | - $return .= 'Thousands Separator: ' . give_get_option( 'thousands_separator', ',' ) . "\n"; |
|
145 | + $return .= "\n".'-- Give Configuration'."\n\n"; |
|
146 | + $return .= 'Version: '.GIVE_VERSION."\n"; |
|
147 | + $return .= 'Upgraded From: '.get_option('give_version_upgraded_from', 'None')."\n"; |
|
148 | + $return .= 'Test Mode: '.(give_is_test_mode() ? "Enabled\n" : "Disabled\n"); |
|
149 | + $return .= 'Currency Code: '.give_get_currency()."\n"; |
|
150 | + $return .= 'Currency Position: '.give_get_option('currency_position', 'before')."\n"; |
|
151 | + $return .= 'Decimal Separator: '.give_get_option('decimal_separator', '.')."\n"; |
|
152 | + $return .= 'Thousands Separator: '.give_get_option('thousands_separator', ',')."\n"; |
|
153 | 153 | |
154 | - $return = apply_filters( 'give_sysinfo_after_give_config', $return ); |
|
154 | + $return = apply_filters('give_sysinfo_after_give_config', $return); |
|
155 | 155 | |
156 | 156 | // GIVE pages |
157 | - $return .= "\n" . '-- Give Page Configuration' . "\n\n"; |
|
158 | - $return .= 'Success Page: ' . ( ! empty( $give_options['success_page'] ) ? get_permalink( $give_options['success_page'] ) . "\n" : "Unset\n" ); |
|
159 | - $return .= 'Failure Page: ' . ( ! empty( $give_options['failure_page'] ) ? get_permalink( $give_options['failure_page'] ) . "\n" : "Unset\n" ); |
|
160 | - $return .= 'Give Forms Slug: ' . ( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . "\n" : "/donations\n" ); |
|
157 | + $return .= "\n".'-- Give Page Configuration'."\n\n"; |
|
158 | + $return .= 'Success Page: '.( ! empty($give_options['success_page']) ? get_permalink($give_options['success_page'])."\n" : "Unset\n"); |
|
159 | + $return .= 'Failure Page: '.( ! empty($give_options['failure_page']) ? get_permalink($give_options['failure_page'])."\n" : "Unset\n"); |
|
160 | + $return .= 'Give Forms Slug: '.(defined('GIVE_SLUG') ? '/'.GIVE_SLUG."\n" : "/donations\n"); |
|
161 | 161 | |
162 | - $return = apply_filters( 'give_sysinfo_after_give_pages', $return ); |
|
162 | + $return = apply_filters('give_sysinfo_after_give_pages', $return); |
|
163 | 163 | |
164 | 164 | // GIVE gateways |
165 | - $return .= "\n" . '-- Give Gateway Configuration' . "\n\n"; |
|
165 | + $return .= "\n".'-- Give Gateway Configuration'."\n\n"; |
|
166 | 166 | |
167 | 167 | $active_gateways = give_get_enabled_payment_gateways(); |
168 | - if ( $active_gateways ) { |
|
169 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
170 | - if ( $default_gateway_is_active ) { |
|
171 | - $default_gateway = give_get_default_gateway( null ); |
|
172 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
168 | + if ($active_gateways) { |
|
169 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
170 | + if ($default_gateway_is_active) { |
|
171 | + $default_gateway = give_get_default_gateway(null); |
|
172 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
173 | 173 | } else { |
174 | 174 | $default_gateway = 'Test Payment'; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $gateways = array(); |
178 | - foreach ( $active_gateways as $gateway ) { |
|
178 | + foreach ($active_gateways as $gateway) { |
|
179 | 179 | $gateways[] = $gateway['admin_label']; |
180 | 180 | } |
181 | 181 | |
182 | - $return .= 'Enabled Gateways: ' . implode( ', ', $gateways ) . "\n"; |
|
183 | - $return .= 'Default Gateway: ' . $default_gateway . "\n"; |
|
182 | + $return .= 'Enabled Gateways: '.implode(', ', $gateways)."\n"; |
|
183 | + $return .= 'Default Gateway: '.$default_gateway."\n"; |
|
184 | 184 | } else { |
185 | - $return .= 'Enabled Gateways: None' . "\n"; |
|
185 | + $return .= 'Enabled Gateways: None'."\n"; |
|
186 | 186 | } |
187 | 187 | |
188 | - $return = apply_filters( 'give_sysinfo_after_give_gateways', $return ); |
|
188 | + $return = apply_filters('give_sysinfo_after_give_gateways', $return); |
|
189 | 189 | |
190 | 190 | // GIVE Templates |
191 | - $dir = get_stylesheet_directory() . '/give_templates/*'; |
|
192 | - if ( is_dir( $dir ) && ( count( glob( "$dir/*" ) ) !== 0 ) ) { |
|
193 | - $return .= "\n" . '-- Give Template Overrides' . "\n\n"; |
|
191 | + $dir = get_stylesheet_directory().'/give_templates/*'; |
|
192 | + if (is_dir($dir) && (count(glob("$dir/*")) !== 0)) { |
|
193 | + $return .= "\n".'-- Give Template Overrides'."\n\n"; |
|
194 | 194 | |
195 | - foreach ( glob( $dir ) as $file ) { |
|
196 | - $return .= 'Filename: ' . basename( $file ) . "\n"; |
|
195 | + foreach (glob($dir) as $file) { |
|
196 | + $return .= 'Filename: '.basename($file)."\n"; |
|
197 | 197 | } |
198 | 198 | |
199 | - $return = apply_filters( 'give_sysinfo_after_give_templates', $return ); |
|
199 | + $return = apply_filters('give_sysinfo_after_give_templates', $return); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Must-use plugins |
203 | 203 | $muplugins = get_mu_plugins(); |
204 | - if ( count( $muplugins > 0 ) ) { |
|
205 | - $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; |
|
204 | + if (count($muplugins > 0)) { |
|
205 | + $return .= "\n".'-- Must-Use Plugins'."\n\n"; |
|
206 | 206 | |
207 | - foreach ( $muplugins as $plugin => $plugin_data ) { |
|
208 | - $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; |
|
207 | + foreach ($muplugins as $plugin => $plugin_data) { |
|
208 | + $return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n"; |
|
209 | 209 | } |
210 | 210 | |
211 | - $return = apply_filters( 'give_sysinfo_after_wordpress_mu_plugins', $return ); |
|
211 | + $return = apply_filters('give_sysinfo_after_wordpress_mu_plugins', $return); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | // WordPress active plugins |
215 | - $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; |
|
215 | + $return .= "\n".'-- WordPress Active Plugins'."\n\n"; |
|
216 | 216 | |
217 | 217 | $plugins = get_plugins(); |
218 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
218 | + $active_plugins = get_option('active_plugins', array()); |
|
219 | 219 | |
220 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
221 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
220 | + foreach ($plugins as $plugin_path => $plugin) { |
|
221 | + if ( ! in_array($plugin_path, $active_plugins)) { |
|
222 | 222 | continue; |
223 | 223 | } |
224 | 224 | |
225 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
225 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
226 | 226 | } |
227 | 227 | |
228 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins', $return ); |
|
228 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins', $return); |
|
229 | 229 | |
230 | 230 | // WordPress inactive plugins |
231 | - $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; |
|
231 | + $return .= "\n".'-- WordPress Inactive Plugins'."\n\n"; |
|
232 | 232 | |
233 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
234 | - if ( in_array( $plugin_path, $active_plugins ) ) { |
|
233 | + foreach ($plugins as $plugin_path => $plugin) { |
|
234 | + if (in_array($plugin_path, $active_plugins)) { |
|
235 | 235 | continue; |
236 | 236 | } |
237 | 237 | |
238 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
238 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
239 | 239 | } |
240 | 240 | |
241 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins_inactive', $return ); |
|
241 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins_inactive', $return); |
|
242 | 242 | |
243 | - if ( is_multisite() ) { |
|
243 | + if (is_multisite()) { |
|
244 | 244 | // WordPress Multisite active plugins |
245 | - $return .= "\n" . '-- Network Active Plugins' . "\n\n"; |
|
245 | + $return .= "\n".'-- Network Active Plugins'."\n\n"; |
|
246 | 246 | |
247 | 247 | $plugins = wp_get_active_network_plugins(); |
248 | - $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); |
|
248 | + $active_plugins = get_site_option('active_sitewide_plugins', array()); |
|
249 | 249 | |
250 | - foreach ( $plugins as $plugin_path ) { |
|
251 | - $plugin_base = plugin_basename( $plugin_path ); |
|
250 | + foreach ($plugins as $plugin_path) { |
|
251 | + $plugin_base = plugin_basename($plugin_path); |
|
252 | 252 | |
253 | - if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { |
|
253 | + if ( ! array_key_exists($plugin_base, $active_plugins)) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 | |
257 | - $plugin = get_plugin_data( $plugin_path ); |
|
258 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
257 | + $plugin = get_plugin_data($plugin_path); |
|
258 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
259 | 259 | } |
260 | 260 | |
261 | - $return = apply_filters( 'give_sysinfo_after_wordpress_ms_plugins', $return ); |
|
261 | + $return = apply_filters('give_sysinfo_after_wordpress_ms_plugins', $return); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // Server configuration (really just versioning) |
265 | - $return .= "\n" . '-- Webserver Configuration' . "\n\n"; |
|
266 | - $return .= 'PHP Version: ' . PHP_VERSION . "\n"; |
|
267 | - $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; |
|
268 | - $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; |
|
265 | + $return .= "\n".'-- Webserver Configuration'."\n\n"; |
|
266 | + $return .= 'PHP Version: '.PHP_VERSION."\n"; |
|
267 | + $return .= 'MySQL Version: '.$wpdb->db_version()."\n"; |
|
268 | + $return .= 'Webserver Info: '.$_SERVER['SERVER_SOFTWARE']."\n"; |
|
269 | 269 | |
270 | - $return = apply_filters( 'give_sysinfo_after_webserver_config', $return ); |
|
270 | + $return = apply_filters('give_sysinfo_after_webserver_config', $return); |
|
271 | 271 | |
272 | 272 | // PHP configs... now we're getting to the important stuff |
273 | - $return .= "\n" . '-- PHP Configuration' . "\n\n"; |
|
274 | - $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); |
|
275 | - $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; |
|
276 | - $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
277 | - $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; |
|
278 | - $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
279 | - $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; |
|
280 | - $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; |
|
281 | - $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; |
|
282 | - |
|
283 | - $return = apply_filters( 'give_sysinfo_after_php_config', $return ); |
|
273 | + $return .= "\n".'-- PHP Configuration'."\n\n"; |
|
274 | + $return .= 'Safe Mode: '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n"); |
|
275 | + $return .= 'Memory Limit: '.ini_get('memory_limit')."\n"; |
|
276 | + $return .= 'Upload Max Size: '.ini_get('upload_max_filesize')."\n"; |
|
277 | + $return .= 'Post Max Size: '.ini_get('post_max_size')."\n"; |
|
278 | + $return .= 'Upload Max Filesize: '.ini_get('upload_max_filesize')."\n"; |
|
279 | + $return .= 'Time Limit: '.ini_get('max_execution_time')."\n"; |
|
280 | + $return .= 'Max Input Vars: '.ini_get('max_input_vars')."\n"; |
|
281 | + $return .= 'Display Errors: '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n"; |
|
282 | + |
|
283 | + $return = apply_filters('give_sysinfo_after_php_config', $return); |
|
284 | 284 | |
285 | 285 | // PHP extensions and such |
286 | - $return .= "\n" . '-- PHP Extensions' . "\n\n"; |
|
287 | - $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
286 | + $return .= "\n".'-- PHP Extensions'."\n\n"; |
|
287 | + $return .= 'cURL: '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n"; |
|
288 | 288 | |
289 | 289 | //cURL version |
290 | - if ( function_exists( 'curl_init' ) && function_exists( 'curl_version' ) ) { |
|
290 | + if (function_exists('curl_init') && function_exists('curl_version')) { |
|
291 | 291 | $curl_values = curl_version(); |
292 | - $return .= 'cURL Version: ' . $curl_values["version"] . "\n"; |
|
292 | + $return .= 'cURL Version: '.$curl_values["version"]."\n"; |
|
293 | 293 | } |
294 | - $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
295 | - $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
296 | - $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
294 | + $return .= 'fsockopen: '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n"; |
|
295 | + $return .= 'SOAP Client: '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n"; |
|
296 | + $return .= 'Suhosin: '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n"; |
|
297 | 297 | |
298 | - $return = apply_filters( 'give_sysinfo_after_php_ext', $return ); |
|
298 | + $return = apply_filters('give_sysinfo_after_php_ext', $return); |
|
299 | 299 | |
300 | 300 | // Session stuff |
301 | - $return .= "\n" . '-- Session Configuration' . "\n\n"; |
|
302 | - $return .= 'Give Use Sessions: ' . ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? 'Enforced' : ( Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled' ) ) . "\n"; |
|
303 | - $return .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n"; |
|
301 | + $return .= "\n".'-- Session Configuration'."\n\n"; |
|
302 | + $return .= 'Give Use Sessions: '.(defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? 'Enforced' : (Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled'))."\n"; |
|
303 | + $return .= 'Session: '.(isset($_SESSION) ? 'Enabled' : 'Disabled')."\n"; |
|
304 | 304 | |
305 | 305 | // The rest of this is only relevant is session is enabled |
306 | - if ( isset( $_SESSION ) ) { |
|
307 | - $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; |
|
308 | - $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; |
|
309 | - $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; |
|
310 | - $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
311 | - $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
306 | + if (isset($_SESSION)) { |
|
307 | + $return .= 'Session Name: '.esc_html(ini_get('session.name'))."\n"; |
|
308 | + $return .= 'Cookie Path: '.esc_html(ini_get('session.cookie_path'))."\n"; |
|
309 | + $return .= 'Save Path: '.esc_html(ini_get('session.save_path'))."\n"; |
|
310 | + $return .= 'Use Cookies: '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n"; |
|
311 | + $return .= 'Use Only Cookies: '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n"; |
|
312 | 312 | } |
313 | 313 | |
314 | - $return = apply_filters( 'give_sysinfo_after_session_config', $return ); |
|
314 | + $return = apply_filters('give_sysinfo_after_session_config', $return); |
|
315 | 315 | |
316 | - $return .= "\n" . '### End System Info ###'; |
|
316 | + $return .= "\n".'### End System Info ###'; |
|
317 | 317 | |
318 | 318 | return $return; |
319 | 319 | } |
@@ -327,17 +327,17 @@ discard block |
||
327 | 327 | */ |
328 | 328 | function give_tools_sysinfo_download() { |
329 | 329 | |
330 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
330 | + if ( ! current_user_can('manage_give_settings')) { |
|
331 | 331 | return; |
332 | 332 | } |
333 | 333 | |
334 | 334 | nocache_headers(); |
335 | 335 | |
336 | - header( 'Content-Type: text/plain' ); |
|
337 | - header( 'Content-Disposition: attachment; filename="give-system-info.txt"' ); |
|
336 | + header('Content-Type: text/plain'); |
|
337 | + header('Content-Disposition: attachment; filename="give-system-info.txt"'); |
|
338 | 338 | |
339 | - echo wp_strip_all_tags( $_POST['give-sysinfo'] ); |
|
339 | + echo wp_strip_all_tags($_POST['give-sysinfo']); |
|
340 | 340 | give_die(); |
341 | 341 | } |
342 | 342 | |
343 | -add_action( 'give_download_sysinfo', 'give_tools_sysinfo_download' ); |
|
344 | 343 | \ No newline at end of file |
344 | +add_action('give_download_sysinfo', 'give_tools_sysinfo_download'); |
|
345 | 345 | \ No newline at end of file |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : /** |
|
47 | +if ( ! class_exists('Give')) : /** |
|
48 | 48 | * Main Give Class |
49 | 49 | * |
50 | 50 | * @since 1.0 |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | * @return Give |
143 | 143 | */ |
144 | 144 | public static function instance() { |
145 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
145 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
146 | 146 | self::$instance = new Give; |
147 | 147 | self::$instance->setup_constants(); |
148 | 148 | |
149 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
149 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
150 | 150 | |
151 | 151 | self::$instance->includes(); |
152 | 152 | self::$instance->roles = new Give_Roles(); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function __clone() { |
179 | 179 | // Cloning instances of the class is forbidden |
180 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
180 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function __wakeup() { |
191 | 191 | // Unserializing instances of the class is forbidden |
192 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
192 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -202,33 +202,33 @@ discard block |
||
202 | 202 | private function setup_constants() { |
203 | 203 | |
204 | 204 | // Plugin version |
205 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
206 | - define( 'GIVE_VERSION', '1.3.5' ); |
|
205 | + if ( ! defined('GIVE_VERSION')) { |
|
206 | + define('GIVE_VERSION', '1.3.5'); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | // Plugin Folder Path |
210 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
211 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
210 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
211 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | // Plugin Folder URL |
215 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
216 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
215 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
216 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | // Plugin Basename aka: "give/give.php" |
220 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
221 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
220 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
221 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | // Plugin Root File |
225 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
226 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
225 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
226 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | // Make sure CAL_GREGORIAN is defined |
230 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
231 | - define( 'CAL_GREGORIAN', 1 ); |
|
230 | + if ( ! defined('CAL_GREGORIAN')) { |
|
231 | + define('CAL_GREGORIAN', 1); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -242,103 +242,103 @@ discard block |
||
242 | 242 | private function includes() { |
243 | 243 | global $give_options; |
244 | 244 | |
245 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/register-settings.php'; |
|
245 | + require_once GIVE_PLUGIN_DIR.'includes/admin/register-settings.php'; |
|
246 | 246 | $give_options = give_get_settings(); |
247 | 247 | |
248 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
249 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
250 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
251 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
252 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
253 | - |
|
254 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
255 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
256 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
257 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
258 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
259 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
260 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
261 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
262 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
263 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
264 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
265 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
266 | - |
|
267 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
268 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
269 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
270 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
271 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
272 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
273 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
274 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
275 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
276 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
277 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
278 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
279 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
280 | - |
|
281 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
282 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
283 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
284 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
285 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-donators-gravatars.php'; |
|
286 | - |
|
287 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
288 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
289 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
290 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
291 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
292 | - |
|
293 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
294 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
295 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
296 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
297 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
298 | - |
|
299 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
300 | - |
|
301 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
302 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
304 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
305 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
306 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
307 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
308 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/export-functions.php'; |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
310 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
311 | - |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
313 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
314 | - |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
320 | - |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
325 | - |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
335 | - |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
248 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
249 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
250 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
251 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
252 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
253 | + |
|
254 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
255 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
256 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
257 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
258 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
259 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
260 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
261 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
262 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
263 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
264 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
265 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
266 | + |
|
267 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
268 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
269 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
270 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
271 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
272 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
273 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
274 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
275 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
276 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
277 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
278 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
279 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
280 | + |
|
281 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
282 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
283 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
284 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
285 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-donators-gravatars.php'; |
|
286 | + |
|
287 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
288 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
289 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
290 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
291 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
292 | + |
|
293 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
294 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
295 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
296 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
297 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
298 | + |
|
299 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
300 | + |
|
301 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
302 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
304 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
305 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
306 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
307 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
308 | + require_once GIVE_PLUGIN_DIR.'includes/admin/export-functions.php'; |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
311 | + |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
313 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
314 | + |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
320 | + |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
325 | + |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
335 | + |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
338 | 338 | |
339 | 339 | } |
340 | 340 | |
341 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
342 | 342 | |
343 | 343 | } |
344 | 344 | |
@@ -351,26 +351,26 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public function load_textdomain() { |
353 | 353 | // Set filter for Give's languages directory |
354 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
355 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
354 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
355 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
356 | 356 | |
357 | 357 | // Traditional WordPress plugin locale filter |
358 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
359 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
358 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
359 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
360 | 360 | |
361 | 361 | // Setup paths to current locale file |
362 | - $mofile_local = $give_lang_dir . $mofile; |
|
363 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
362 | + $mofile_local = $give_lang_dir.$mofile; |
|
363 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
364 | 364 | |
365 | - if ( file_exists( $mofile_global ) ) { |
|
365 | + if (file_exists($mofile_global)) { |
|
366 | 366 | // Look in global /wp-content/languages/give folder |
367 | - load_textdomain( 'give', $mofile_global ); |
|
368 | - } elseif ( file_exists( $mofile_local ) ) { |
|
367 | + load_textdomain('give', $mofile_global); |
|
368 | + } elseif (file_exists($mofile_local)) { |
|
369 | 369 | // Look in local /wp-content/plugins/give/languages/ folder |
370 | - load_textdomain( 'give', $mofile_local ); |
|
370 | + load_textdomain('give', $mofile_local); |
|
371 | 371 | } else { |
372 | 372 | // Load the default language files |
373 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
373 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | } |
@@ -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 | |
@@ -32,25 +32,25 @@ discard block |
||
32 | 32 | give_setup_post_types(); |
33 | 33 | |
34 | 34 | // Clear the permalinks |
35 | - flush_rewrite_rules( false ); |
|
35 | + flush_rewrite_rules(false); |
|
36 | 36 | |
37 | 37 | // Add Upgraded From Option |
38 | - $current_version = get_option( 'give_version' ); |
|
39 | - if ( $current_version ) { |
|
40 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
38 | + $current_version = get_option('give_version'); |
|
39 | + if ($current_version) { |
|
40 | + update_option('give_version_upgraded_from', $current_version); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | // Setup some default options |
44 | 44 | $options = array(); |
45 | 45 | |
46 | 46 | // Checks if the Success Page option exists AND that the page exists |
47 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
47 | + if ( ! get_post(give_get_option('success_page'))) { |
|
48 | 48 | |
49 | 49 | // Purchase Confirmation (Success) Page |
50 | 50 | $success = wp_insert_post( |
51 | 51 | array( |
52 | - 'post_title' => __( 'Donation Confirmation', 'give' ), |
|
53 | - 'post_content' => __( 'Thank you for your donation! [give_receipt]', 'give' ), |
|
52 | + 'post_title' => __('Donation Confirmation', 'give'), |
|
53 | + 'post_content' => __('Thank you for your donation! [give_receipt]', 'give'), |
|
54 | 54 | 'post_status' => 'publish', |
55 | 55 | 'post_author' => 1, |
56 | 56 | 'post_type' => 'page', |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // Checks if the Failure Page option exists AND that the page exists |
66 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
66 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
67 | 67 | |
68 | 68 | // Failed Purchase Page |
69 | 69 | $failed = wp_insert_post( |
70 | 70 | array( |
71 | - 'post_title' => __( 'Transaction Failed', 'give' ), |
|
72 | - 'post_content' => __( 'Your transaction failed, please try again or contact site support.', 'give' ), |
|
71 | + 'post_title' => __('Transaction Failed', 'give'), |
|
72 | + 'post_content' => __('Your transaction failed, please try again or contact site support.', 'give'), |
|
73 | 73 | 'post_status' => 'publish', |
74 | 74 | 'post_author' => 1, |
75 | 75 | 'post_type' => 'page', |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // Checks if the History Page option exists AND that the page exists |
84 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
84 | + if ( ! get_post(give_get_option('history_page'))) { |
|
85 | 85 | // Purchase History (History) Page |
86 | 86 | $history = wp_insert_post( |
87 | 87 | array( |
88 | - 'post_title' => __( 'Donation History', 'give' ), |
|
88 | + 'post_title' => __('Donation History', 'give'), |
|
89 | 89 | 'post_content' => '[donation_history]', |
90 | 90 | 'post_status' => 'publish', |
91 | 91 | 'post_author' => 1, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency |
101 | - if ( empty( $current_version ) ) { |
|
101 | + if (empty($current_version)) { |
|
102 | 102 | $options['base_country'] = 'US'; |
103 | 103 | $options['test_mode'] = 1; |
104 | 104 | $options['currency'] = 'USD'; |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | // Populate some default values |
118 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
119 | - update_option( 'give_version', GIVE_VERSION ); |
|
118 | + update_option('give_settings', array_merge($give_options, $options)); |
|
119 | + update_option('give_version', GIVE_VERSION); |
|
120 | 120 | |
121 | 121 | //Update Version Number |
122 | - if ( $current_version ) { |
|
123 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
122 | + if ($current_version) { |
|
123 | + update_option('give_version_upgraded_from', $current_version); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // Create Give roles |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $roles->add_caps(); |
130 | 130 | |
131 | 131 | $api = new Give_API(); |
132 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
132 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
133 | 133 | |
134 | 134 | // Create the customers database |
135 | 135 | @Give()->customers->create_table(); |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | Give()->session->use_php_sessions(); |
139 | 139 | |
140 | 140 | // Add a temporary option to note that Give pages have been created |
141 | - set_transient( '_give_installed', $options, 30 ); |
|
141 | + set_transient('_give_installed', $options, 30); |
|
142 | 142 | |
143 | 143 | |
144 | - if ( ! $current_version ) { |
|
145 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
144 | + if ( ! $current_version) { |
|
145 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
146 | 146 | |
147 | 147 | // When new upgrade routines are added, mark them as complete on fresh install |
148 | 148 | $upgrade_routines = array( |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | 'upgrade_give_offline_status' |
151 | 151 | ); |
152 | 152 | |
153 | - foreach ( $upgrade_routines as $upgrade ) { |
|
154 | - give_set_upgrade_complete( $upgrade ); |
|
153 | + foreach ($upgrade_routines as $upgrade) { |
|
154 | + give_set_upgrade_complete($upgrade); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | // Bail if activating from network, or bulk |
158 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
158 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
159 | 159 | return; |
160 | 160 | } |
161 | 161 | // Add the transient to redirect |
162 | - set_transient( '_give_activation_redirect', true, 30 ); |
|
162 | + set_transient('_give_activation_redirect', true, 30); |
|
163 | 163 | |
164 | 164 | } |
165 | 165 | |
166 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
166 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Post-installation |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | */ |
176 | 176 | function give_after_install() { |
177 | 177 | |
178 | - if ( ! is_admin() ) { |
|
178 | + if ( ! is_admin()) { |
|
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | - $give_options = get_transient( '_give_installed' ); |
|
182 | + $give_options = get_transient('_give_installed'); |
|
183 | 183 | |
184 | 184 | // Exit if not in admin or the transient doesn't exist |
185 | - if ( false === $give_options ) { |
|
185 | + if (false === $give_options) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | @Give()->customers->create_table(); |
191 | 191 | |
192 | 192 | // Delete the transient |
193 | - delete_transient( '_give_installed' ); |
|
193 | + delete_transient('_give_installed'); |
|
194 | 194 | |
195 | - do_action( 'give_after_install', $give_options ); |
|
195 | + do_action('give_after_install', $give_options); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
199 | -add_action( 'admin_init', 'give_after_install' ); |
|
199 | +add_action('admin_init', 'give_after_install'); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | /** |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | |
212 | 212 | global $wp_roles; |
213 | 213 | |
214 | - if ( ! is_object( $wp_roles ) ) { |
|
214 | + if ( ! is_object($wp_roles)) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | |
218 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
218 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
219 | 219 | |
220 | 220 | // Create Give shop roles |
221 | 221 | $roles = new Give_Roles; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | } |
228 | 228 | |
229 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
229 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
230 | 230 | |
231 | 231 | /** |
232 | 232 | * Network Activated New Site Setup |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * @param $site_id |
243 | 243 | * @param $meta |
244 | 244 | */ |
245 | -function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
246 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
247 | - switch_to_blog( $blog_id ); |
|
245 | +function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
246 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
247 | + switch_to_blog($blog_id); |
|
248 | 248 | give_install(); |
249 | 249 | restore_current_blog(); |
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | -add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 ); |
|
254 | 253 | \ No newline at end of file |
254 | +add_action('wpmu_new_blog', 'on_create_blog', 10, 6); |
|
255 | 255 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | function give_add_ons_page() { |
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | - <h2><?php _e( 'Give Add-ons', 'give' ); ?> |
|
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php _e( 'Browse All Add-ons', 'give' ); ?>" target="_blank"><?php _e( 'View All Add-ons', 'give' ); ?> |
|
28 | + <h2><?php _e('Give Add-ons', 'give'); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php _e('Browse All Add-ons', 'give'); ?>" target="_blank"><?php _e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h2> |
32 | 32 | |
33 | - <p><?php _e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php _e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
51 | + $cache = get_transient('give_add_ons_feed'); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | - $cache = '<div class="error"><p>' . __( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
62 | + $cache = '<div class="error"><p>'.__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |