@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_get_logs_tab() { |
24 | 24 | |
25 | - require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' ); |
|
25 | + require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'); |
|
26 | 26 | |
27 | 27 | // Get current section. |
28 | 28 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | - do_action( "give_logs_view_{$current_section}" ); |
|
35 | + do_action("give_logs_view_{$current_section}"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function give_logs_view_sales() { |
48 | 48 | |
49 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
49 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
50 | 50 | |
51 | 51 | $logs_table = new Give_Sales_Log_Table(); |
52 | 52 | $logs_table->prepare_items(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @since 1.8.12 |
61 | 61 | */ |
62 | - do_action( 'give_logs_donations_top' ); |
|
62 | + do_action('give_logs_donations_top'); |
|
63 | 63 | |
64 | 64 | $logs_table->display(); ?> |
65 | 65 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @since 1.8.12 |
75 | 75 | */ |
76 | - do_action( 'give_logs_donations_bottom' ); |
|
76 | + do_action('give_logs_donations_bottom'); |
|
77 | 77 | ?> |
78 | 78 | |
79 | 79 | </div> |
80 | 80 | <?php |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
83 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | function give_logs_view_gateway_errors() { |
95 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' ); |
|
95 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php'); |
|
96 | 96 | |
97 | 97 | $logs_table = new Give_Gateway_Error_Log_Table(); |
98 | 98 | $logs_table->prepare_items(); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 1.8.12 |
107 | 107 | */ |
108 | - do_action( 'give_logs_payment_error_top' ); |
|
108 | + do_action('give_logs_payment_error_top'); |
|
109 | 109 | |
110 | 110 | $logs_table->display(); ?> |
111 | 111 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @since 1.8.12 |
121 | 121 | */ |
122 | - do_action( 'give_logs_payment_error_bottom' ); |
|
122 | + do_action('give_logs_payment_error_bottom'); |
|
123 | 123 | ?> |
124 | 124 | |
125 | 125 | </div> |
126 | 126 | <?php |
127 | 127 | } |
128 | 128 | |
129 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
129 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * API Request Logs |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return void |
139 | 139 | */ |
140 | 140 | function give_logs_view_api_requests() { |
141 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' ); |
|
141 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php'); |
|
142 | 142 | |
143 | 143 | $logs_table = new Give_API_Request_Log_Table(); |
144 | 144 | $logs_table->prepare_items(); |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - do_action( 'give_logs_api_requests_top' ); |
|
154 | + do_action('give_logs_api_requests_top'); |
|
155 | 155 | |
156 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
156 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
157 | 157 | $logs_table->display(); |
158 | 158 | ?> |
159 | 159 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @since 1.0 |
169 | 169 | */ |
170 | - do_action( 'give_logs_api_requests_bottom' ); |
|
170 | + do_action('give_logs_api_requests_bottom'); |
|
171 | 171 | ?> |
172 | 172 | |
173 | 173 | </div> |
174 | 174 | <?php |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
177 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Renders the log views drop down. |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | $current_section = give_get_current_setting_section(); |
187 | 187 | |
188 | 188 | // If there are not any event attach to action then do not show form. |
189 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
189 | + if ( ! has_action('give_log_view_actions')) { |
|
190 | 190 | return; |
191 | 191 | } |
192 | 192 | ?> |
193 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
193 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
194 | 194 | <?php |
195 | 195 | /** |
196 | 196 | * Fires after displaying the reports page views drop down. |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @since 1.0 |
201 | 201 | */ |
202 | - do_action( 'give_log_view_actions' ); |
|
202 | + do_action('give_log_view_actions'); |
|
203 | 203 | ?> |
204 | 204 | |
205 | 205 | <input type="hidden" name="post_type" value="give_forms"/> |
206 | 206 | <input type="hidden" name="page" value="give-tools"/> |
207 | 207 | <input type="hidden" name="tab" value="logs"/> |
208 | 208 | |
209 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
209 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
210 | 210 | </form> |
211 | 211 | <?php |
212 | 212 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return string |
220 | 220 | */ |
221 | -function give_tools_set_form_method( $method ) { |
|
221 | +function give_tools_set_form_method($method) { |
|
222 | 222 | return 'get'; |
223 | 223 | } |
224 | -add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 ); |
|
224 | +add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Logs' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Logs')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Logs. |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'logs'; |
46 | - $this->label = __( 'Logs', 'give' ); |
|
46 | + $this->label = __('Logs', 'give'); |
|
47 | 47 | |
48 | 48 | $this->default_tab = 'sales'; |
49 | 49 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return array |
62 | 62 | */ |
63 | - public function add_settings_page( $pages ) { |
|
64 | - $pages[ $this->id ] = $this->label; |
|
63 | + public function add_settings_page($pages) { |
|
64 | + $pages[$this->id] = $this->label; |
|
65 | 65 | |
66 | 66 | return $pages; |
67 | 67 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $GLOBALS['give_hide_save_button'] = true; |
78 | 78 | |
79 | 79 | // Get settings. |
80 | - $settings = apply_filters( 'give_settings_logs', array( |
|
80 | + $settings = apply_filters('give_settings_logs', array( |
|
81 | 81 | array( |
82 | 82 | 'id' => 'give_tools_logs', |
83 | 83 | 'type' => 'title', |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ), |
86 | 86 | array( |
87 | 87 | 'id' => 'api', |
88 | - 'name' => __( 'Log', 'give' ), |
|
88 | + 'name' => __('Log', 'give'), |
|
89 | 89 | 'type' => 'logs', |
90 | 90 | |
91 | 91 | ), |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | 'type' => 'sectionend', |
95 | 95 | 'table_html' => false, |
96 | 96 | ), |
97 | - ) ); |
|
97 | + )); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Filter the settings. |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @param array $settings |
105 | 105 | */ |
106 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
106 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
107 | 107 | |
108 | 108 | // Output. |
109 | 109 | return $settings; |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function get_sections() { |
119 | 119 | $sections = array( |
120 | - 'sales' => __( 'Donations', 'give' ), |
|
121 | - 'gateway_errors' => __( 'Payment Errors', 'give' ), |
|
122 | - 'api_requests' => __( 'API Requests', 'give' ), |
|
120 | + 'sales' => __('Donations', 'give'), |
|
121 | + 'gateway_errors' => __('Payment Errors', 'give'), |
|
122 | + 'api_requests' => __('API Requests', 'give'), |
|
123 | 123 | ); |
124 | 124 | |
125 | - $sections = apply_filters( 'give_log_views', $sections ); |
|
125 | + $sections = apply_filters('give_log_views', $sections); |
|
126 | 126 | |
127 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
127 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function output() { |
137 | 137 | $settings = $this->get_settings(); |
138 | 138 | |
139 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
139 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_System_Info' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_System_Info')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_System_Info. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'system-info'; |
46 | - $this->label = esc_html__( 'System Info', 'give' ); |
|
46 | + $this->label = esc_html__('System Info', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return array |
66 | 66 | */ |
67 | - public function add_settings_page( $pages ) { |
|
68 | - $pages[ $this->id ] = $this->label; |
|
67 | + public function add_settings_page($pages) { |
|
68 | + $pages[$this->id] = $this->label; |
|
69 | 69 | |
70 | 70 | return $pages; |
71 | 71 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function output() { |
80 | 80 | $GLOBALS['give_hide_save_button'] = true; |
81 | - include_once( 'views/html-admin-page-system-info.php' ); |
|
81 | + include_once('views/html-admin-page-system-info.php'); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 |
@@ -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 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
57 | 57 | */ |
58 | - public function __construct( $args = array() ) { |
|
58 | + public function __construct($args = array()) { |
|
59 | 59 | $defaults = array( |
60 | 60 | 'output' => 'payments', |
61 | - 'post_type' => array( 'give_payment' ), |
|
61 | + 'post_type' => array('give_payment'), |
|
62 | 62 | 'start_date' => false, |
63 | 63 | 'end_date' => false, |
64 | 64 | 'number' => 20, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'give_forms' => null, |
80 | 80 | ); |
81 | 81 | |
82 | - $this->args = wp_parse_args( $args, $defaults ); |
|
82 | + $this->args = wp_parse_args($args, $defaults); |
|
83 | 83 | |
84 | 84 | $this->init(); |
85 | 85 | } |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | * @param $query_var |
94 | 94 | * @param $value |
95 | 95 | */ |
96 | - public function __set( $query_var, $value ) { |
|
97 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
98 | - $this->args[ $query_var ][] = $value; |
|
96 | + public function __set($query_var, $value) { |
|
97 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
98 | + $this->args[$query_var][] = $value; |
|
99 | 99 | } else { |
100 | - $this->args[ $query_var ] = $value; |
|
100 | + $this->args[$query_var] = $value; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param $query_var |
111 | 111 | */ |
112 | - public function __unset( $query_var ) { |
|
113 | - unset( $this->args[ $query_var ] ); |
|
112 | + public function __unset($query_var) { |
|
113 | + unset($this->args[$query_var]); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $this->children(); |
146 | 146 | $this->give_forms(); |
147 | 147 | |
148 | - add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 ); |
|
148 | + add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | private function unset_filters() { |
158 | 158 | $this->date_filter_post(); |
159 | - remove_filter( 'posts_orderby', array( $this, 'custom_orderby' ) ); |
|
159 | + remove_filter('posts_orderby', array($this, 'custom_orderby')); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -183,27 +183,27 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param Give_Payments_Query $this Payments query object. |
185 | 185 | */ |
186 | - do_action( 'give_pre_get_payments', $this ); |
|
186 | + do_action('give_pre_get_payments', $this); |
|
187 | 187 | |
188 | - $query = new WP_Query( $this->args ); |
|
188 | + $query = new WP_Query($this->args); |
|
189 | 189 | |
190 | 190 | $custom_output = array( |
191 | 191 | 'payments', |
192 | 192 | 'give_payments', |
193 | 193 | ); |
194 | 194 | |
195 | - if ( ! in_array( $this->args['output'], $custom_output ) ) { |
|
195 | + if ( ! in_array($this->args['output'], $custom_output)) { |
|
196 | 196 | return $query->posts; |
197 | 197 | } |
198 | 198 | |
199 | - if ( $query->have_posts() ) { |
|
200 | - while ( $query->have_posts() ) { |
|
199 | + if ($query->have_posts()) { |
|
200 | + while ($query->have_posts()) { |
|
201 | 201 | $query->the_post(); |
202 | 202 | |
203 | 203 | $payment_id = get_post()->ID; |
204 | - $payment = new Give_Payment( $payment_id ); |
|
204 | + $payment = new Give_Payment($payment_id); |
|
205 | 205 | |
206 | - $this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this ); |
|
206 | + $this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | wp_reset_postdata(); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @param Give_Payments_Query $this Payments query object. |
222 | 222 | */ |
223 | - do_action( 'give_post_get_payments', $this ); |
|
223 | + do_action('give_post_get_payments', $this); |
|
224 | 224 | |
225 | 225 | return $this->payments; |
226 | 226 | } |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | * @return void |
235 | 235 | */ |
236 | 236 | public function date_filter_pre() { |
237 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
237 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | |
241 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
241 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
242 | 242 | |
243 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
243 | + add_filter('posts_where', array($this, 'payments_where')); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | * @return void |
254 | 254 | */ |
255 | 255 | public function date_filter_post() { |
256 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
256 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
257 | 257 | return; |
258 | 258 | } |
259 | 259 | |
260 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
260 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | * @return void |
270 | 270 | */ |
271 | 271 | public function status() { |
272 | - if ( ! isset ( $this->args['status'] ) ) { |
|
272 | + if ( ! isset ($this->args['status'])) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | - $this->__set( 'post_status', $this->args['status'] ); |
|
277 | - $this->__unset( 'status' ); |
|
276 | + $this->__set('post_status', $this->args['status']); |
|
277 | + $this->__unset('status'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -286,12 +286,12 @@ discard block |
||
286 | 286 | * @return void |
287 | 287 | */ |
288 | 288 | public function page() { |
289 | - if ( ! isset ( $this->args['page'] ) ) { |
|
289 | + if ( ! isset ($this->args['page'])) { |
|
290 | 290 | return; |
291 | 291 | } |
292 | 292 | |
293 | - $this->__set( 'paged', $this->args['page'] ); |
|
294 | - $this->__unset( 'page' ); |
|
293 | + $this->__set('paged', $this->args['page']); |
|
294 | + $this->__unset('page'); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -304,17 +304,17 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function per_page() { |
306 | 306 | |
307 | - if ( ! isset( $this->args['number'] ) ) { |
|
307 | + if ( ! isset($this->args['number'])) { |
|
308 | 308 | return; |
309 | 309 | } |
310 | 310 | |
311 | - if ( $this->args['number'] == - 1 ) { |
|
312 | - $this->__set( 'nopaging', true ); |
|
311 | + if ($this->args['number'] == - 1) { |
|
312 | + $this->__set('nopaging', true); |
|
313 | 313 | } else { |
314 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
314 | + $this->__set('posts_per_page', $this->args['number']); |
|
315 | 315 | } |
316 | 316 | |
317 | - $this->__unset( 'number' ); |
|
317 | + $this->__unset('number'); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | * @return void |
327 | 327 | */ |
328 | 328 | public function month() { |
329 | - if ( ! isset ( $this->args['month'] ) ) { |
|
329 | + if ( ! isset ($this->args['month'])) { |
|
330 | 330 | return; |
331 | 331 | } |
332 | 332 | |
333 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
334 | - $this->__unset( 'month' ); |
|
333 | + $this->__set('monthnum', $this->args['month']); |
|
334 | + $this->__unset('month'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -343,23 +343,23 @@ discard block |
||
343 | 343 | * @return void |
344 | 344 | */ |
345 | 345 | public function orderby() { |
346 | - switch ( $this->args['orderby'] ) { |
|
346 | + switch ($this->args['orderby']) { |
|
347 | 347 | case 'amount' : |
348 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
349 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
348 | + $this->__set('orderby', 'meta_value_num'); |
|
349 | + $this->__set('meta_key', '_give_payment_total'); |
|
350 | 350 | break; |
351 | 351 | |
352 | 352 | case 'status' : |
353 | - $this->__set( 'orderby', 'post_status' ); |
|
353 | + $this->__set('orderby', 'post_status'); |
|
354 | 354 | break; |
355 | 355 | |
356 | 356 | case 'donation_form' : |
357 | - $this->__set( 'orderby', 'meta_value' ); |
|
358 | - $this->__set( 'meta_key', '_give_payment_form_title' ); |
|
357 | + $this->__set('orderby', 'meta_value'); |
|
358 | + $this->__set('meta_key', '_give_payment_form_title'); |
|
359 | 359 | break; |
360 | 360 | |
361 | 361 | default : |
362 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
362 | + $this->__set('orderby', $this->args['orderby']); |
|
363 | 363 | break; |
364 | 364 | } |
365 | 365 | } |
@@ -376,17 +376,17 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @return mixed |
378 | 378 | */ |
379 | - public function custom_orderby( $order, $query ) { |
|
379 | + public function custom_orderby($order, $query) { |
|
380 | 380 | global $wpdb; |
381 | 381 | |
382 | - $post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] ); |
|
383 | - if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) { |
|
382 | + $post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']); |
|
383 | + if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) { |
|
384 | 384 | return $order; |
385 | 385 | } |
386 | 386 | |
387 | - switch ( $query->query['orderby'] ) { |
|
387 | + switch ($query->query['orderby']) { |
|
388 | 388 | case 'post_status': |
389 | - $order = $wpdb->posts .'.post_status ' . strtoupper( $query->query['order'] ); |
|
389 | + $order = $wpdb->posts.'.post_status '.strtoupper($query->query['order']); |
|
390 | 390 | break; |
391 | 391 | } |
392 | 392 | |
@@ -402,20 +402,20 @@ discard block |
||
402 | 402 | * @return void |
403 | 403 | */ |
404 | 404 | public function user() { |
405 | - if ( is_null( $this->args['user'] ) ) { |
|
405 | + if (is_null($this->args['user'])) { |
|
406 | 406 | return; |
407 | 407 | } |
408 | 408 | |
409 | - if ( is_numeric( $this->args['user'] ) ) { |
|
409 | + if (is_numeric($this->args['user'])) { |
|
410 | 410 | $user_key = '_give_payment_user_id'; |
411 | 411 | } else { |
412 | 412 | $user_key = '_give_payment_user_email'; |
413 | 413 | } |
414 | 414 | |
415 | - $this->__set( 'meta_query', array( |
|
415 | + $this->__set('meta_query', array( |
|
416 | 416 | 'key' => $user_key, |
417 | 417 | 'value' => $this->args['user'], |
418 | - ) ); |
|
418 | + )); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
@@ -426,14 +426,14 @@ discard block |
||
426 | 426 | * @return void |
427 | 427 | */ |
428 | 428 | public function donor() { |
429 | - if ( is_null( $this->args['donor'] ) || ! is_numeric( $this->args['donor'] ) ) { |
|
429 | + if (is_null($this->args['donor']) || ! is_numeric($this->args['donor'])) { |
|
430 | 430 | return; |
431 | 431 | } |
432 | 432 | |
433 | - $this->__set( 'meta_query', array( |
|
433 | + $this->__set('meta_query', array( |
|
434 | 434 | 'key' => '_give_payment_customer_id', |
435 | 435 | 'value' => (int) $this->args['donor'], |
436 | - ) ); |
|
436 | + )); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | /** |
@@ -446,33 +446,33 @@ discard block |
||
446 | 446 | */ |
447 | 447 | public function search() { |
448 | 448 | |
449 | - if ( ! isset( $this->args['s'] ) ) { |
|
449 | + if ( ! isset($this->args['s'])) { |
|
450 | 450 | return; |
451 | 451 | } |
452 | 452 | |
453 | - $search = trim( $this->args['s'] ); |
|
453 | + $search = trim($this->args['s']); |
|
454 | 454 | |
455 | - if ( empty( $search ) ) { |
|
455 | + if (empty($search)) { |
|
456 | 456 | return; |
457 | 457 | } |
458 | 458 | |
459 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
460 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
459 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
460 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
461 | 461 | |
462 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
462 | + if ( ! empty($this->args['search_in_notes'])) { |
|
463 | 463 | |
464 | - $notes = give_get_payment_notes( 0, $search ); |
|
464 | + $notes = give_get_payment_notes(0, $search); |
|
465 | 465 | |
466 | - if ( ! empty( $notes ) ) { |
|
466 | + if ( ! empty($notes)) { |
|
467 | 467 | |
468 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
468 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
469 | 469 | |
470 | - $this->__set( 'post__in', $payment_ids ); |
|
470 | + $this->__set('post__in', $payment_ids); |
|
471 | 471 | } |
472 | 472 | |
473 | - $this->__unset( 's' ); |
|
473 | + $this->__unset('s'); |
|
474 | 474 | |
475 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
475 | + } elseif ($is_email || strlen($search) == 32) { |
|
476 | 476 | |
477 | 477 | $key = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key'; |
478 | 478 | $search_meta = array( |
@@ -481,19 +481,19 @@ discard block |
||
481 | 481 | 'compare' => 'LIKE', |
482 | 482 | ); |
483 | 483 | |
484 | - $this->__set( 'meta_query', $search_meta ); |
|
485 | - $this->__unset( 's' ); |
|
484 | + $this->__set('meta_query', $search_meta); |
|
485 | + $this->__unset('s'); |
|
486 | 486 | |
487 | - } elseif ( $is_user ) { |
|
487 | + } elseif ($is_user) { |
|
488 | 488 | |
489 | 489 | $search_meta = array( |
490 | 490 | 'key' => '_give_payment_user_id', |
491 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ), |
|
491 | + 'value' => trim(str_replace('user:', '', strtolower($search))), |
|
492 | 492 | ); |
493 | 493 | |
494 | - $this->__set( 'meta_query', $search_meta ); |
|
494 | + $this->__set('meta_query', $search_meta); |
|
495 | 495 | |
496 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
496 | + if (give_get_option('enable_sequential')) { |
|
497 | 497 | |
498 | 498 | $search_meta = array( |
499 | 499 | 'key' => '_give_payment_number', |
@@ -501,19 +501,19 @@ discard block |
||
501 | 501 | 'compare' => 'LIKE', |
502 | 502 | ); |
503 | 503 | |
504 | - $this->__set( 'meta_query', $search_meta ); |
|
504 | + $this->__set('meta_query', $search_meta); |
|
505 | 505 | |
506 | 506 | $this->args['meta_query']['relation'] = 'OR'; |
507 | 507 | |
508 | 508 | } |
509 | 509 | |
510 | - $this->__unset( 's' ); |
|
510 | + $this->__unset('s'); |
|
511 | 511 | |
512 | 512 | } elseif ( |
513 | - give_get_option( 'enable_sequential' ) && |
|
513 | + give_get_option('enable_sequential') && |
|
514 | 514 | ( |
515 | - false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) || |
|
516 | - false !== strpos( $search, give_get_option( 'sequential_postfix' ) ) |
|
515 | + false !== strpos($search, give_get_option('sequential_prefix')) || |
|
516 | + false !== strpos($search, give_get_option('sequential_postfix')) |
|
517 | 517 | ) |
518 | 518 | ) { |
519 | 519 | |
@@ -523,29 +523,29 @@ discard block |
||
523 | 523 | 'compare' => 'LIKE', |
524 | 524 | ); |
525 | 525 | |
526 | - $this->__set( 'meta_query', $search_meta ); |
|
527 | - $this->__unset( 's' ); |
|
526 | + $this->__set('meta_query', $search_meta); |
|
527 | + $this->__unset('s'); |
|
528 | 528 | |
529 | - } elseif ( is_numeric( $search ) ) { |
|
529 | + } elseif (is_numeric($search)) { |
|
530 | 530 | |
531 | - $post = get_post( $search ); |
|
531 | + $post = get_post($search); |
|
532 | 532 | |
533 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
533 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
534 | 534 | |
535 | 535 | $arr = array(); |
536 | 536 | $arr[] = $search; |
537 | - $this->__set( 'post__in', $arr ); |
|
538 | - $this->__unset( 's' ); |
|
537 | + $this->__set('post__in', $arr); |
|
538 | + $this->__unset('s'); |
|
539 | 539 | } |
540 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
540 | + } elseif ('#' == substr($search, 0, 1)) { |
|
541 | 541 | |
542 | - $search = str_replace( '#:', '', $search ); |
|
543 | - $search = str_replace( '#', '', $search ); |
|
544 | - $this->__set( 'give_forms', $search ); |
|
545 | - $this->__unset( 's' ); |
|
542 | + $search = str_replace('#:', '', $search); |
|
543 | + $search = str_replace('#', '', $search); |
|
544 | + $this->__set('give_forms', $search); |
|
545 | + $this->__unset('s'); |
|
546 | 546 | |
547 | 547 | } else { |
548 | - $this->__set( 's', $search ); |
|
548 | + $this->__set('s', $search); |
|
549 | 549 | |
550 | 550 | } |
551 | 551 | |
@@ -560,16 +560,16 @@ discard block |
||
560 | 560 | * @return void |
561 | 561 | */ |
562 | 562 | public function mode() { |
563 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
564 | - $this->__unset( 'mode' ); |
|
563 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
564 | + $this->__unset('mode'); |
|
565 | 565 | |
566 | 566 | return; |
567 | 567 | } |
568 | 568 | |
569 | - $this->__set( 'meta_query', array( |
|
569 | + $this->__set('meta_query', array( |
|
570 | 570 | 'key' => '_give_payment_mode', |
571 | 571 | 'value' => $this->args['mode'], |
572 | - ) ); |
|
572 | + )); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | /** |
@@ -581,10 +581,10 @@ discard block |
||
581 | 581 | * @return void |
582 | 582 | */ |
583 | 583 | public function children() { |
584 | - if ( empty( $this->args['children'] ) ) { |
|
585 | - $this->__set( 'post_parent', 0 ); |
|
584 | + if (empty($this->args['children'])) { |
|
585 | + $this->__set('post_parent', 0); |
|
586 | 586 | } |
587 | - $this->__unset( 'children' ); |
|
587 | + $this->__unset('children'); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | /** |
@@ -597,25 +597,25 @@ discard block |
||
597 | 597 | */ |
598 | 598 | public function give_forms() { |
599 | 599 | |
600 | - if ( empty( $this->args['give_forms'] ) ) { |
|
600 | + if (empty($this->args['give_forms'])) { |
|
601 | 601 | return; |
602 | 602 | } |
603 | 603 | |
604 | 604 | $compare = '='; |
605 | 605 | |
606 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
606 | + if (is_array($this->args['give_forms'])) { |
|
607 | 607 | $compare = 'IN'; |
608 | 608 | } |
609 | 609 | |
610 | - $this->__set( 'meta_query', array( |
|
610 | + $this->__set('meta_query', array( |
|
611 | 611 | array( |
612 | 612 | 'key' => '_give_payment_form_id', |
613 | 613 | 'value' => $this->args['give_forms'], |
614 | 614 | 'compare' => $compare, |
615 | 615 | ), |
616 | - ) ); |
|
616 | + )); |
|
617 | 617 | |
618 | - $this->__unset( 'give_forms' ); |
|
618 | + $this->__unset('give_forms'); |
|
619 | 619 | |
620 | 620 | } |
621 | 621 |
@@ -521,7 +521,7 @@ |
||
521 | 521 | * Example: <?php $give = Give(); ?> |
522 | 522 | * |
523 | 523 | * @since 1.0 |
524 | - * @return object|Give |
|
524 | + * @return Give |
|
525 | 525 | */ |
526 | 526 | function Give() { |
527 | 527 | return Give::instance(); |
@@ -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 | |
49 | 49 | /** |
50 | 50 | * Main Give Class |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return Give |
203 | 203 | */ |
204 | 204 | public static function instance() { |
205 | - if ( is_null( self::$_instance ) ) { |
|
205 | + if (is_null(self::$_instance)) { |
|
206 | 206 | self::$_instance = new self(); |
207 | 207 | } |
208 | 208 | |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function __construct() { |
216 | 216 | // PHP version |
217 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
218 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
217 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
218 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | // Bailout: Need minimum php version to load plugin. |
222 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
223 | - add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) ); |
|
222 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
223 | + add_action('admin_notices', array($this, 'minmum_phpversion_notice')); |
|
224 | 224 | |
225 | 225 | return; |
226 | 226 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $this->includes(); |
231 | 231 | $this->init_hooks(); |
232 | 232 | |
233 | - do_action( 'give_loaded' ); |
|
233 | + do_action('give_loaded'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | * @since 1.8.9 |
240 | 240 | */ |
241 | 241 | private function init_hooks() { |
242 | - register_activation_hook( __FILE__, 'give_install' ); |
|
243 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
242 | + register_activation_hook(__FILE__, 'give_install'); |
|
243 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
244 | 244 | } |
245 | 245 | /** |
246 | 246 | * Init Give when WordPress Initializes. |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @since 1.8.9 |
256 | 256 | */ |
257 | - do_action( 'before_give_init' ); |
|
257 | + do_action('before_give_init'); |
|
258 | 258 | |
259 | 259 | // Set up localization. |
260 | 260 | $this->load_textdomain(); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @since 1.8.7 |
281 | 281 | */ |
282 | - do_action( 'give_init', $this ); |
|
282 | + do_action('give_init', $this); |
|
283 | 283 | |
284 | 284 | } |
285 | 285 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function __clone() { |
298 | 298 | // Cloning instances of the class is forbidden. |
299 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
299 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function __wakeup() { |
311 | 311 | // Unserializing instances of the class is forbidden. |
312 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
312 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -323,33 +323,33 @@ discard block |
||
323 | 323 | private function setup_constants() { |
324 | 324 | |
325 | 325 | // Plugin version |
326 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
327 | - define( 'GIVE_VERSION', '1.8.16' ); |
|
326 | + if ( ! defined('GIVE_VERSION')) { |
|
327 | + define('GIVE_VERSION', '1.8.16'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | // Plugin Folder Path |
331 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
332 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
331 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
332 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | // Plugin Folder URL |
336 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
337 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
336 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
337 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | // Plugin Basename aka: "give/give.php" |
341 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
342 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
341 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
342 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | // Plugin Root File |
346 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
347 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
346 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
347 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | // Make sure CAL_GREGORIAN is defined |
351 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
352 | - define( 'CAL_GREGORIAN', 1 ); |
|
351 | + if ( ! defined('CAL_GREGORIAN')) { |
|
352 | + define('CAL_GREGORIAN', 1); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -364,132 +364,132 @@ discard block |
||
364 | 364 | private function includes() { |
365 | 365 | global $give_options; |
366 | 366 | |
367 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
368 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
368 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
369 | 369 | $give_options = give_get_settings(); |
370 | 370 | |
371 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
374 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
375 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
377 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
378 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
379 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
380 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
381 | - |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
393 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
395 | - |
|
396 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
404 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
406 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
407 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
408 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
409 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
410 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
411 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
412 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
413 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
414 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
415 | - |
|
416 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
417 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
418 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
419 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
420 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
421 | - |
|
422 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
423 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
424 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
425 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
426 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
427 | - |
|
428 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
429 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
430 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
431 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
432 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
433 | - |
|
434 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
435 | - |
|
436 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
437 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
374 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
375 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
377 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
378 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
379 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
380 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
381 | + |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
393 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
395 | + |
|
396 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
404 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
406 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
408 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
409 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
410 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
411 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
412 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
413 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
414 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
415 | + |
|
416 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
417 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
418 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
419 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
420 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
421 | + |
|
422 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
423 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
424 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
425 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
426 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
427 | + |
|
428 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
429 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
430 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
431 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
432 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
433 | + |
|
434 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
435 | + |
|
436 | + if (defined('WP_CLI') && WP_CLI) { |
|
437 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
438 | 438 | } |
439 | 439 | |
440 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
440 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
441 | 441 | |
442 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
443 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
444 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
445 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
446 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
447 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
448 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
449 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
450 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
451 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
452 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
442 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
443 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
444 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
445 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
446 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
447 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
448 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
449 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
450 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
451 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
452 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
453 | 453 | |
454 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
455 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
454 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
455 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
456 | 456 | |
457 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
458 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
459 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
457 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
458 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
459 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
460 | 460 | |
461 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
462 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
463 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
461 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
462 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
463 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
464 | 464 | |
465 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
466 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
467 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
468 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
465 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
466 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
467 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
468 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
469 | 469 | |
470 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
471 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
472 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
470 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
471 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
473 | 473 | |
474 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
475 | 475 | |
476 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
477 | 477 | |
478 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
484 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
484 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
487 | 487 | |
488 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
488 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
489 | 489 | |
490 | 490 | }// End if(). |
491 | 491 | |
492 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
@@ -504,16 +504,16 @@ discard block |
||
504 | 504 | public function load_textdomain() { |
505 | 505 | |
506 | 506 | // Set filter for Give's languages directory |
507 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
508 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
507 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
508 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
509 | 509 | |
510 | 510 | // Traditional WordPress plugin locale filter. |
511 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
512 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
511 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
512 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
513 | 513 | |
514 | - unload_textdomain( 'give' ); |
|
515 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
516 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
514 | + unload_textdomain('give'); |
|
515 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
516 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
517 | 517 | |
518 | 518 | } |
519 | 519 | |
@@ -526,17 +526,17 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function minmum_phpversion_notice() { |
528 | 528 | // Bailout. |
529 | - if ( ! is_admin() ) { |
|
529 | + if ( ! is_admin()) { |
|
530 | 530 | return; |
531 | 531 | } |
532 | 532 | |
533 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
534 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
535 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
536 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
537 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
538 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
539 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
533 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
534 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
535 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
536 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
537 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
538 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
539 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
540 | 540 | |
541 | 541 | echo sprintf( |
542 | 542 | '<div class="notice notice-error">%1$s</div>', |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * Return the calculated completion percentage. |
217 | 217 | * |
218 | 218 | * @since 1.8.12 |
219 | - * @return int |
|
219 | + * @return double |
|
220 | 220 | */ |
221 | 221 | public function get_percentage_complete() { |
222 | 222 | return ceil( ( 100 * $this->step_completed ) / $this->total_step ); |
@@ -353,6 +353,9 @@ discard block |
||
353 | 353 | return true; |
354 | 354 | } |
355 | 355 | |
356 | + /** |
|
357 | + * @param integer $page |
|
358 | + */ |
|
356 | 359 | public function get_delete_ids( $donation_ids, $page ) { |
357 | 360 | $index = $page --; |
358 | 361 | $count = count( $donation_ids ); |
@@ -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 | |
@@ -109,32 +109,32 @@ discard block |
||
109 | 109 | $donor_ids = array(); |
110 | 110 | |
111 | 111 | // Check if the ajax request if running for the first time. |
112 | - if ( 1 === (int) $this->step ) { |
|
112 | + if (1 === (int) $this->step) { |
|
113 | 113 | // Delete all the donation ids. |
114 | - $this->delete_option( $this->donation_key ); |
|
114 | + $this->delete_option($this->donation_key); |
|
115 | 115 | // Delete all the donor ids. |
116 | - $this->delete_option( $this->donor_key ); |
|
116 | + $this->delete_option($this->donor_key); |
|
117 | 117 | |
118 | 118 | // Delete all the step and set to 'count' which if the first step in the process of deleting the donors. |
119 | - $this->update_option( $this->step_key, 'count' ); |
|
119 | + $this->update_option($this->step_key, 'count'); |
|
120 | 120 | |
121 | 121 | // Delete tha page count of the step. |
122 | - $this->update_option( $this->step_on_key, '0' ); |
|
122 | + $this->update_option($this->step_on_key, '0'); |
|
123 | 123 | } else { |
124 | 124 | // Get the old donors list. |
125 | - $donor_ids = $this->get_option( $this->donor_key ); |
|
125 | + $donor_ids = $this->get_option($this->donor_key); |
|
126 | 126 | |
127 | 127 | // Get the old donation list. |
128 | - $donation_ids = $this->get_option( $this->donation_key ); |
|
128 | + $donation_ids = $this->get_option($this->donation_key); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Get the step and check for it if it's on the first step( 'count' ) or not. |
132 | 132 | $step = (int) $this->get_step(); |
133 | - if ( 1 === $step ) { |
|
133 | + if (1 === $step) { |
|
134 | 134 | /** |
135 | 135 | * Will add or update the donation and donor data by running wp query. |
136 | 136 | */ |
137 | - $this->count( $step, $donation_ids, $donor_ids ); |
|
137 | + $this->count($step, $donation_ids, $donor_ids); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | * @param array $donation_ids Contain the list of all the donation id's that has being add before this |
146 | 146 | * @param array $donor_ids Contain the list of all the donors id's that has being add before this |
147 | 147 | */ |
148 | - private function count( $step, $donation_ids = array(), $donor_ids = array() ) { |
|
148 | + private function count($step, $donation_ids = array(), $donor_ids = array()) { |
|
149 | 149 | |
150 | 150 | // Get the Page count by default it's zero. |
151 | 151 | $paged = (int) $this->get_step_page(); |
152 | 152 | // Incresed the page count by one. |
153 | - ++ $paged; |
|
153 | + ++$paged; |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Filter add to alter the argument before the wp quest run |
157 | 157 | */ |
158 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
158 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
159 | 159 | 'post_type' => 'give_payment', |
160 | 160 | 'post_status' => 'any', |
161 | 161 | 'posts_per_page' => $this->per_step, |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | // ONLY TEST MODE TRANSACTIONS!!! |
164 | 164 | 'meta_key' => '_give_payment_mode', |
165 | 165 | 'meta_value' => 'test', |
166 | - ) ); |
|
166 | + )); |
|
167 | 167 | |
168 | 168 | // Reset the post data. |
169 | 169 | wp_reset_postdata(); |
170 | 170 | // Getting the new donation. |
171 | - $donation_posts = new WP_Query( $args ); |
|
171 | + $donation_posts = new WP_Query($args); |
|
172 | 172 | |
173 | 173 | // The Loop. |
174 | - if ( $donation_posts->have_posts() ) { |
|
175 | - while ( $donation_posts->have_posts() ) { |
|
174 | + if ($donation_posts->have_posts()) { |
|
175 | + while ($donation_posts->have_posts()) { |
|
176 | 176 | $donation_posts->the_post(); |
177 | 177 | global $post; |
178 | 178 | // Add the donation id in side the array. |
@@ -191,23 +191,23 @@ discard block |
||
191 | 191 | $max_num_pages = (int) $donation_posts->max_num_pages; |
192 | 192 | |
193 | 193 | // Check current page is less then max number of page or not |
194 | - if ( $paged < $max_num_pages ) { |
|
194 | + if ($paged < $max_num_pages) { |
|
195 | 195 | // Update the curretn page virable for the next step |
196 | - $this->update_option( $this->step_on_key, $paged ); |
|
196 | + $this->update_option($this->step_on_key, $paged); |
|
197 | 197 | |
198 | 198 | // Calculating percentage. |
199 | 199 | $page_remain = $max_num_pages - $paged; |
200 | - $this->total_step = (int) $max_num_pages + ( $total_donation / $this->per_step ) + ( ( $page_remain * 2 ) * count( $donor_ids ) ); |
|
200 | + $this->total_step = (int) $max_num_pages + ($total_donation / $this->per_step) + (($page_remain * 2) * count($donor_ids)); |
|
201 | 201 | $this->step_completed = $paged; |
202 | 202 | } else { |
203 | - $donation_ids_count = count( $donor_ids ); |
|
204 | - $this->update_option( $this->step_key, 'donation' ); |
|
205 | - $this->update_option( $this->step_on_key, '0' ); |
|
203 | + $donation_ids_count = count($donor_ids); |
|
204 | + $this->update_option($this->step_key, 'donation'); |
|
205 | + $this->update_option($this->step_on_key, '0'); |
|
206 | 206 | } |
207 | 207 | |
208 | - $donor_ids = array_unique( $donor_ids ); |
|
209 | - $this->update_option( $this->donor_key, $donor_ids ); |
|
210 | - $this->update_option( $this->donation_key, $donation_ids ); |
|
208 | + $donor_ids = array_unique($donor_ids); |
|
209 | + $this->update_option($this->donor_key, $donor_ids); |
|
210 | + $this->update_option($this->donation_key, $donation_ids); |
|
211 | 211 | |
212 | 212 | wp_reset_postdata(); |
213 | 213 | } |
@@ -219,34 +219,34 @@ discard block |
||
219 | 219 | * @return int |
220 | 220 | */ |
221 | 221 | public function get_percentage_complete() { |
222 | - return ceil( ( 100 * $this->step_completed ) / $this->total_step ); |
|
222 | + return ceil((100 * $this->step_completed) / $this->total_step); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | public function process_step() { |
226 | 226 | |
227 | - if ( ! $this->can_export() ) { |
|
228 | - wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
227 | + if ( ! $this->can_export()) { |
|
228 | + wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | $had_data = $this->get_data(); |
232 | 232 | |
233 | - if ( $had_data ) { |
|
233 | + if ($had_data) { |
|
234 | 234 | $this->done = false; |
235 | 235 | |
236 | 236 | return true; |
237 | 237 | } else { |
238 | - update_option( 'give_earnings_total', give_get_total_earnings( true ) ); |
|
239 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
238 | + update_option('give_earnings_total', give_get_total_earnings(true)); |
|
239 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
240 | 240 | |
241 | - $this->delete_option( $this->donation_key ); |
|
241 | + $this->delete_option($this->donation_key); |
|
242 | 242 | |
243 | 243 | // Reset the sequential order numbers |
244 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
245 | - delete_option( 'give_last_payment_number' ); |
|
244 | + if (give_get_option('enable_sequential')) { |
|
245 | + delete_option('give_last_payment_number'); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | $this->done = true; |
249 | - $this->message = __( 'Test donor and transactions successfully deleted.', 'give' ); |
|
249 | + $this->message = __('Test donor and transactions successfully deleted.', 'give'); |
|
250 | 250 | |
251 | 251 | return false; |
252 | 252 | } |
@@ -264,12 +264,12 @@ discard block |
||
264 | 264 | public function get_data() { |
265 | 265 | |
266 | 266 | // Get the donation id's. |
267 | - $donation_ids = $this->get_option( $this->donation_key ); |
|
267 | + $donation_ids = $this->get_option($this->donation_key); |
|
268 | 268 | |
269 | 269 | /** |
270 | 270 | * Return false id not test donation is found. |
271 | 271 | */ |
272 | - if ( empty( $donation_ids ) ) { |
|
272 | + if (empty($donation_ids)) { |
|
273 | 273 | $this->is_empty = true; |
274 | 274 | $this->total_step = 1; |
275 | 275 | |
@@ -280,81 +280,81 @@ discard block |
||
280 | 280 | $step = (int) $this->get_step(); |
281 | 281 | |
282 | 282 | // get teh donor ids. |
283 | - $donor_ids = $this->get_option( $this->donor_key ); |
|
283 | + $donor_ids = $this->get_option($this->donor_key); |
|
284 | 284 | |
285 | 285 | // In step to we delete all the donation in loop. |
286 | - if ( 2 === $step ) { |
|
286 | + if (2 === $step) { |
|
287 | 287 | $pass_to_donor = false; |
288 | 288 | $page = (int) $this->get_step_page(); |
289 | - $page ++; |
|
290 | - $count = count( $donation_ids ); |
|
289 | + $page++; |
|
290 | + $count = count($donation_ids); |
|
291 | 291 | |
292 | - $this->total_step = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids ); |
|
292 | + $this->total_step = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids); |
|
293 | 293 | $this->step_completed = $page; |
294 | 294 | |
295 | 295 | |
296 | - if ( $count > $this->per_step ) { |
|
296 | + if ($count > $this->per_step) { |
|
297 | 297 | |
298 | - $this->update_option( $this->step_on_key, $page ); |
|
299 | - $donation_ids = $this->get_delete_ids( $donation_ids, $page ); |
|
300 | - $current_page = (int) ceil( $count / $this->per_step ); |
|
298 | + $this->update_option($this->step_on_key, $page); |
|
299 | + $donation_ids = $this->get_delete_ids($donation_ids, $page); |
|
300 | + $current_page = (int) ceil($count / $this->per_step); |
|
301 | 301 | |
302 | - if ( $page === $current_page ) { |
|
302 | + if ($page === $current_page) { |
|
303 | 303 | $pass_to_donor = true; |
304 | 304 | } |
305 | 305 | } else { |
306 | 306 | $pass_to_donor = true; |
307 | 307 | } |
308 | 308 | |
309 | - if ( true === $pass_to_donor ) { |
|
310 | - $this->update_option( $this->step_key, 'donor' ); |
|
311 | - $this->update_option( $this->step_on_key, '0' ); |
|
309 | + if (true === $pass_to_donor) { |
|
310 | + $this->update_option($this->step_key, 'donor'); |
|
311 | + $this->update_option($this->step_on_key, '0'); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | global $wpdb; |
315 | - foreach ( $donation_ids as $item ) { |
|
315 | + foreach ($donation_ids as $item) { |
|
316 | 316 | |
317 | 317 | // will delete the payment log first. |
318 | - $parent_query = $wpdb->prepare( "SELECT post_id as id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %d", '_give_log_payment_id', (int) $item ); |
|
319 | - $log_id = $wpdb->get_row( $parent_query, ARRAY_A ); |
|
318 | + $parent_query = $wpdb->prepare("SELECT post_id as id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %d", '_give_log_payment_id', (int) $item); |
|
319 | + $log_id = $wpdb->get_row($parent_query, ARRAY_A); |
|
320 | 320 | // Check if payment has it log or not if yes then delete it. |
321 | - if ( ! empty( $log_id['id'] ) ) { |
|
321 | + if ( ! empty($log_id['id'])) { |
|
322 | 322 | // Deleting the payment log. |
323 | - wp_delete_post( $log_id['id'], true ); |
|
323 | + wp_delete_post($log_id['id'], true); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | // Delete the main payment. |
327 | - wp_delete_post( $item, true ); |
|
327 | + wp_delete_post($item, true); |
|
328 | 328 | } |
329 | - do_action( 'give_delete_log_cache' ); |
|
329 | + do_action('give_delete_log_cache'); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
333 | 333 | // Here we delete all the donor |
334 | - if ( 3 === $step ) { |
|
334 | + if (3 === $step) { |
|
335 | 335 | $page = (int) $this->get_step_page(); |
336 | - $count = count( $donor_ids ); |
|
336 | + $count = count($donor_ids); |
|
337 | 337 | |
338 | - $this->total_step = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids ); |
|
339 | - $this->step_completed = $page + ( count( $donation_ids ) / $this->per_step ); |
|
338 | + $this->total_step = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids); |
|
339 | + $this->step_completed = $page + (count($donation_ids) / $this->per_step); |
|
340 | 340 | |
341 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
341 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
342 | 342 | 'post_type' => 'give_payment', |
343 | 343 | 'post_status' => 'any', |
344 | 344 | 'posts_per_page' => 1, |
345 | 345 | 'meta_key' => '_give_payment_mode', |
346 | 346 | 'meta_value' => 'live', |
347 | - 'author' => $donor_ids[ $page ], |
|
348 | - ) ); |
|
347 | + 'author' => $donor_ids[$page], |
|
348 | + )); |
|
349 | 349 | |
350 | - $donation_posts = get_posts( $args ); |
|
351 | - if ( empty( $donation_posts ) ) { |
|
352 | - Give()->donors->delete_by_user_id( $donor_ids[ $page ] ); |
|
350 | + $donation_posts = get_posts($args); |
|
351 | + if (empty($donation_posts)) { |
|
352 | + Give()->donors->delete_by_user_id($donor_ids[$page]); |
|
353 | 353 | } |
354 | 354 | |
355 | - $page ++; |
|
356 | - $this->update_option( $this->step_on_key, $page ); |
|
357 | - if ( $count === $page ) { |
|
355 | + $page++; |
|
356 | + $this->update_option($this->step_on_key, $page); |
|
357 | + if ($count === $page) { |
|
358 | 358 | $this->is_empty = false; |
359 | 359 | |
360 | 360 | return false; |
@@ -366,24 +366,24 @@ discard block |
||
366 | 366 | return true; |
367 | 367 | } |
368 | 368 | |
369 | - public function get_delete_ids( $donation_ids, $page ) { |
|
370 | - $index = $page --; |
|
371 | - $count = count( $donation_ids ); |
|
369 | + public function get_delete_ids($donation_ids, $page) { |
|
370 | + $index = $page--; |
|
371 | + $count = count($donation_ids); |
|
372 | 372 | $temp = 0; |
373 | 373 | $current_page = 0; |
374 | 374 | $post_delete = $this->per_step; |
375 | 375 | $page_donation_id = array(); |
376 | 376 | |
377 | - foreach ( $donation_ids as $item ) { |
|
378 | - $temp ++; |
|
379 | - $page_donation_id[ $current_page ][] = $item; |
|
380 | - if ( $temp === $post_delete ) { |
|
381 | - $current_page ++; |
|
377 | + foreach ($donation_ids as $item) { |
|
378 | + $temp++; |
|
379 | + $page_donation_id[$current_page][] = $item; |
|
380 | + if ($temp === $post_delete) { |
|
381 | + $current_page++; |
|
382 | 382 | $temp = 0; |
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
386 | - return $page_donation_id[ $page ]; |
|
386 | + return $page_donation_id[$page]; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -395,8 +395,8 @@ discard block |
||
395 | 395 | * |
396 | 396 | * @return mixed Returns the data from the database |
397 | 397 | */ |
398 | - public function get_option( $key, $defalut_value = false ) { |
|
399 | - return get_option( $key, $defalut_value ); |
|
398 | + public function get_option($key, $defalut_value = false) { |
|
399 | + return get_option($key, $defalut_value); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -409,8 +409,8 @@ discard block |
||
409 | 409 | * |
410 | 410 | * @return void |
411 | 411 | */ |
412 | - public function update_option( $key, $value ) { |
|
413 | - update_option( $key, $value, false ); |
|
412 | + public function update_option($key, $value) { |
|
413 | + update_option($key, $value, false); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | * |
423 | 423 | * @return void |
424 | 424 | */ |
425 | - public function delete_option( $key ) { |
|
426 | - delete_option( $key ); |
|
425 | + public function delete_option($key) { |
|
426 | + delete_option($key); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | * @return int|string |
435 | 435 | */ |
436 | 436 | private function get_step() { |
437 | - $step_key = (string) $this->get_option( $this->step_key, false ); |
|
438 | - if ( 'count' === $step_key ) { |
|
437 | + $step_key = (string) $this->get_option($this->step_key, false); |
|
438 | + if ('count' === $step_key) { |
|
439 | 439 | return 1; |
440 | - } elseif ( 'donation' === $step_key ) { |
|
440 | + } elseif ('donation' === $step_key) { |
|
441 | 441 | return 2; |
442 | - } elseif ( 'donor' === $step_key ) { |
|
442 | + } elseif ('donor' === $step_key) { |
|
443 | 443 | return 3; |
444 | 444 | } else { |
445 | 445 | return $step_key; |
@@ -450,6 +450,6 @@ discard block |
||
450 | 450 | * Get the current $page value in the ajax. |
451 | 451 | */ |
452 | 452 | private function get_step_page() { |
453 | - return $this->get_option( $this->step_on_key, false ); |
|
453 | + return $this->get_option($this->step_on_key, false); |
|
454 | 454 | } |
455 | 455 | } |
@@ -340,7 +340,7 @@ |
||
340 | 340 | * @since 1.0 |
341 | 341 | * |
342 | 342 | * @param int|float|string $amount Formatted or sanitized price |
343 | - * @param int|bool $dp number of decimals |
|
343 | + * @param boolean $dp number of decimals |
|
344 | 344 | * @param bool $sanitize Whether or not sanitize number |
345 | 345 | * |
346 | 346 | * @return string $amount Newly formatted amount or Price Not Available |
@@ -134,9 +134,9 @@ |
||
134 | 134 | // Handle thousand separator as '.' |
135 | 135 | // Handle sanitize database values. |
136 | 136 | $is_db_sanitize_val = ( 2 === count( $number_parts ) && |
137 | - is_numeric( $number_parts[0] ) && |
|
138 | - is_numeric( $number_parts[1] ) && |
|
139 | - ( 6 === strlen( $number_parts[1] ) ) ); |
|
137 | + is_numeric( $number_parts[0] ) && |
|
138 | + is_numeric( $number_parts[1] ) && |
|
139 | + ( 6 === strlen( $number_parts[1] ) ) ); |
|
140 | 140 | |
141 | 141 | if ( $is_db_sanitize_val ) { |
142 | 142 | // Sanitize database value. |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,33 +23,33 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return mixed |
25 | 25 | */ |
26 | -function give_get_currency_formatting_settings( $id_or_currency_code = null ) { |
|
26 | +function give_get_currency_formatting_settings($id_or_currency_code = null) { |
|
27 | 27 | $give_options = give_get_settings(); |
28 | 28 | $setting = array(); |
29 | 29 | |
30 | - if ( ! empty( $id_or_currency_code ) ) { |
|
31 | - $currencies = give_get_currencies('all'); |
|
30 | + if ( ! empty($id_or_currency_code)) { |
|
31 | + $currencies = give_get_currencies('all'); |
|
32 | 32 | |
33 | 33 | // Set default formatting setting only if currency not set as global currency. |
34 | 34 | |
35 | - if( is_string( $id_or_currency_code ) && ( $id_or_currency_code !== $give_options['currency'] ) && array_key_exists( $id_or_currency_code, $currencies ) ) { |
|
36 | - $setting = $currencies[ $id_or_currency_code ]['setting']; |
|
37 | - }elseif ( is_numeric( $id_or_currency_code ) && 'give_payment' === get_post_type( $id_or_currency_code ) ) { |
|
38 | - $donation_meta = give_get_meta( $id_or_currency_code, '_give_payment_meta', true ); |
|
35 | + if (is_string($id_or_currency_code) && ($id_or_currency_code !== $give_options['currency']) && array_key_exists($id_or_currency_code, $currencies)) { |
|
36 | + $setting = $currencies[$id_or_currency_code]['setting']; |
|
37 | + }elseif (is_numeric($id_or_currency_code) && 'give_payment' === get_post_type($id_or_currency_code)) { |
|
38 | + $donation_meta = give_get_meta($id_or_currency_code, '_give_payment_meta', true); |
|
39 | 39 | |
40 | 40 | if ( |
41 | - ! empty( $donation_meta['currency'] ) && |
|
41 | + ! empty($donation_meta['currency']) && |
|
42 | 42 | $give_options['currency'] !== $donation_meta['currency'] |
43 | 43 | ) { |
44 | - $setting = $currencies[ $donation_meta['currency'] ]['setting']; |
|
44 | + $setting = $currencies[$donation_meta['currency']]['setting']; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - if ( empty( $setting ) ) { |
|
49 | + if (empty($setting)) { |
|
50 | 50 | // Set thousand separator. |
51 | - $thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ','; |
|
52 | - $thousand_separator = empty( $thousand_separator ) ? ' ' : $thousand_separator; |
|
51 | + $thousand_separator = isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ','; |
|
52 | + $thousand_separator = empty($thousand_separator) ? ' ' : $thousand_separator; |
|
53 | 53 | |
54 | 54 | // Set decimal separator. |
55 | 55 | $default_decimal_separators = array( |
@@ -57,17 +57,16 @@ discard block |
||
57 | 57 | ',' => '.', |
58 | 58 | ); |
59 | 59 | |
60 | - $default_decimal_separator = in_array( $thousand_separator, $default_decimal_separators ) ? |
|
61 | - $default_decimal_separators[ $thousand_separator ] : |
|
62 | - '.'; |
|
60 | + $default_decimal_separator = in_array($thousand_separator, $default_decimal_separators) ? |
|
61 | + $default_decimal_separators[$thousand_separator] : '.'; |
|
63 | 62 | |
64 | - $decimal_separator = ! empty( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : $default_decimal_separator; |
|
63 | + $decimal_separator = ! empty($give_options['decimal_separator']) ? $give_options['decimal_separator'] : $default_decimal_separator; |
|
65 | 64 | |
66 | 65 | $setting = array( |
67 | - 'currency_position' => give_get_option( 'currency_position', 'before' ), |
|
66 | + 'currency_position' => give_get_option('currency_position', 'before'), |
|
68 | 67 | 'thousands_separator' => $thousand_separator, |
69 | 68 | 'decimal_separator' => $decimal_separator, |
70 | - 'number_decimals' => give_get_option( 'number_decimals', 0 ), |
|
69 | + 'number_decimals' => give_get_option('number_decimals', 0), |
|
71 | 70 | ); |
72 | 71 | } |
73 | 72 | |
@@ -77,7 +76,7 @@ discard block |
||
77 | 76 | * |
78 | 77 | * @since 1.8.15 |
79 | 78 | */ |
80 | - return apply_filters( 'give_get_currency_formatting_settings', $setting, $id_or_currency_code ); |
|
79 | + return apply_filters('give_get_currency_formatting_settings', $setting, $id_or_currency_code); |
|
81 | 80 | } |
82 | 81 | |
83 | 82 | /** |
@@ -89,16 +88,16 @@ discard block |
||
89 | 88 | * |
90 | 89 | * @return mixed |
91 | 90 | */ |
92 | -function give_get_price_decimals( $id_or_currency_code = null ) { |
|
91 | +function give_get_price_decimals($id_or_currency_code = null) { |
|
93 | 92 | // Set currency on basis of donation id. |
94 | - if( empty( $id_or_currency_code ) ){ |
|
93 | + if (empty($id_or_currency_code)) { |
|
95 | 94 | $id_or_currency_code = give_get_currency(); |
96 | 95 | } |
97 | 96 | |
98 | 97 | $number_of_decimals = 0; |
99 | 98 | |
100 | - if( ! give_is_zero_based_currency( $id_or_currency_code ) ){ |
|
101 | - $setting = give_get_currency_formatting_settings( $id_or_currency_code ); |
|
99 | + if ( ! give_is_zero_based_currency($id_or_currency_code)) { |
|
100 | + $setting = give_get_currency_formatting_settings($id_or_currency_code); |
|
102 | 101 | $number_of_decimals = $setting['number_decimals']; |
103 | 102 | } |
104 | 103 | |
@@ -107,7 +106,7 @@ discard block |
||
107 | 106 | * |
108 | 107 | * @since 1.6 |
109 | 108 | */ |
110 | - return apply_filters( 'give_sanitize_amount_decimals', $number_of_decimals, $id_or_currency_code ); |
|
109 | + return apply_filters('give_sanitize_amount_decimals', $number_of_decimals, $id_or_currency_code); |
|
111 | 110 | } |
112 | 111 | |
113 | 112 | /** |
@@ -119,15 +118,15 @@ discard block |
||
119 | 118 | * |
120 | 119 | * @return mixed |
121 | 120 | */ |
122 | -function give_get_price_thousand_separator( $id_or_currency_code = null ) { |
|
123 | - $setting = give_get_currency_formatting_settings( $id_or_currency_code ); |
|
121 | +function give_get_price_thousand_separator($id_or_currency_code = null) { |
|
122 | + $setting = give_get_currency_formatting_settings($id_or_currency_code); |
|
124 | 123 | |
125 | 124 | /** |
126 | 125 | * Filter the thousand separator |
127 | 126 | * |
128 | 127 | * @since 1.6 |
129 | 128 | */ |
130 | - return apply_filters( 'give_get_price_thousand_separator', $setting['thousands_separator'], $id_or_currency_code ); |
|
129 | + return apply_filters('give_get_price_thousand_separator', $setting['thousands_separator'], $id_or_currency_code); |
|
131 | 130 | } |
132 | 131 | |
133 | 132 | /** |
@@ -139,15 +138,15 @@ discard block |
||
139 | 138 | * |
140 | 139 | * @return mixed |
141 | 140 | */ |
142 | -function give_get_price_decimal_separator( $id_or_currency_code = null ) { |
|
143 | - $setting = give_get_currency_formatting_settings( $id_or_currency_code ); |
|
141 | +function give_get_price_decimal_separator($id_or_currency_code = null) { |
|
142 | + $setting = give_get_currency_formatting_settings($id_or_currency_code); |
|
144 | 143 | |
145 | 144 | /** |
146 | 145 | * Filter the thousand separator |
147 | 146 | * |
148 | 147 | * @since 1.6 |
149 | 148 | */ |
150 | - return apply_filters( 'give_get_price_decimal_separator', $setting['decimal_separator'], $id_or_currency_code ); |
|
149 | + return apply_filters('give_get_price_decimal_separator', $setting['decimal_separator'], $id_or_currency_code); |
|
151 | 150 | } |
152 | 151 | |
153 | 152 | |
@@ -160,8 +159,8 @@ discard block |
||
160 | 159 | * |
161 | 160 | * @return string $amount Newly sanitized amount |
162 | 161 | */ |
163 | -function give_sanitize_amount_for_db( $number ) { |
|
164 | - return give_maybe_sanitize_amount( $number, 6 ); |
|
162 | +function give_sanitize_amount_for_db($number) { |
|
163 | + return give_maybe_sanitize_amount($number, 6); |
|
165 | 164 | } |
166 | 165 | |
167 | 166 | /** |
@@ -175,29 +174,29 @@ discard block |
||
175 | 174 | * |
176 | 175 | * @return string $amount Newly sanitized amount |
177 | 176 | */ |
178 | -function give_maybe_sanitize_amount( $number, $dp = false, $trim_zeros = false ) { |
|
177 | +function give_maybe_sanitize_amount($number, $dp = false, $trim_zeros = false) { |
|
179 | 178 | $thousand_separator = give_get_price_thousand_separator(); |
180 | 179 | $decimal_separator = give_get_price_decimal_separator(); |
181 | - $number_decimals = is_bool( $dp ) ? give_get_price_decimals() : $dp; |
|
180 | + $number_decimals = is_bool($dp) ? give_get_price_decimals() : $dp; |
|
182 | 181 | |
183 | 182 | // Explode number by . decimal separator. |
184 | - $number_parts = explode( '.', $number ); |
|
183 | + $number_parts = explode('.', $number); |
|
185 | 184 | |
186 | 185 | /* |
187 | 186 | * Bailout: Quick format number |
188 | 187 | */ |
189 | - if ( empty( $number ) || ( ! is_numeric( $number ) && ! is_string( $number ) ) ) { |
|
188 | + if (empty($number) || ( ! is_numeric($number) && ! is_string($number))) { |
|
190 | 189 | return $number; |
191 | 190 | } |
192 | 191 | |
193 | 192 | // Remove currency symbols from number if any. |
194 | - $number = trim( str_replace( give_currency_symbols( true ), '', $number ) ); |
|
193 | + $number = trim(str_replace(give_currency_symbols(true), '', $number)); |
|
195 | 194 | |
196 | 195 | if ( |
197 | 196 | // Non formatted number. |
198 | 197 | ( |
199 | - ( false === strpos( $number, $thousand_separator ) ) && |
|
200 | - ( false === strpos( $number, $decimal_separator ) ) |
|
198 | + (false === strpos($number, $thousand_separator)) && |
|
199 | + (false === strpos($number, $decimal_separator)) |
|
201 | 200 | ) || |
202 | 201 | |
203 | 202 | // Decimal formatted number. |
@@ -208,35 +207,35 @@ discard block |
||
208 | 207 | ( |
209 | 208 | $number_decimals && |
210 | 209 | '.' === $thousand_separator && |
211 | - false !== strpos( $number, $thousand_separator ) && |
|
212 | - false === strpos( $number, $decimal_separator ) && |
|
213 | - 2 === count( $number_parts ) && |
|
214 | - ( $number_decimals >= strlen( $number_parts[1] ) ) |
|
210 | + false !== strpos($number, $thousand_separator) && |
|
211 | + false === strpos($number, $decimal_separator) && |
|
212 | + 2 === count($number_parts) && |
|
213 | + ($number_decimals >= strlen($number_parts[1])) |
|
215 | 214 | ) |
216 | 215 | ) { |
217 | - return number_format( $number, $number_decimals, '.', '' ); |
|
216 | + return number_format($number, $number_decimals, '.', ''); |
|
218 | 217 | } |
219 | 218 | |
220 | 219 | // Handle thousand separator as '.' |
221 | 220 | // Handle sanitize database values. |
222 | - $is_db_sanitize_val = ( 2 === count( $number_parts ) && |
|
223 | - is_numeric( $number_parts[0] ) && |
|
224 | - is_numeric( $number_parts[1] ) && |
|
225 | - ( 6 === strlen( $number_parts[1] ) ) ); |
|
221 | + $is_db_sanitize_val = (2 === count($number_parts) && |
|
222 | + is_numeric($number_parts[0]) && |
|
223 | + is_numeric($number_parts[1]) && |
|
224 | + (6 === strlen($number_parts[1]))); |
|
226 | 225 | |
227 | - if ( $is_db_sanitize_val ) { |
|
226 | + if ($is_db_sanitize_val) { |
|
228 | 227 | // Sanitize database value. |
229 | - return number_format( $number, $number_decimals, '.', '' ); |
|
228 | + return number_format($number, $number_decimals, '.', ''); |
|
230 | 229 | |
231 | 230 | } elseif ( |
232 | 231 | '.' === $thousand_separator && |
233 | - false !== strpos( $number, $thousand_separator ) |
|
232 | + false !== strpos($number, $thousand_separator) |
|
234 | 233 | ) { |
235 | 234 | // Fix point thousand separator value. |
236 | - $number = str_replace( '.', '', $number ); |
|
235 | + $number = str_replace('.', '', $number); |
|
237 | 236 | } |
238 | 237 | |
239 | - return give_sanitize_amount( $number, $number_decimals, $trim_zeros ); |
|
238 | + return give_sanitize_amount($number, $number_decimals, $trim_zeros); |
|
240 | 239 | } |
241 | 240 | |
242 | 241 | /** |
@@ -254,67 +253,67 @@ discard block |
||
254 | 253 | * |
255 | 254 | * @return string $amount Newly sanitized amount |
256 | 255 | */ |
257 | -function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) { |
|
256 | +function give_sanitize_amount($number, $dp = false, $trim_zeros = false) { |
|
258 | 257 | |
259 | 258 | // Bailout. |
260 | - if ( empty( $number ) || ( ! is_numeric( $number ) && ! is_string( $number ) ) ) { |
|
259 | + if (empty($number) || ( ! is_numeric($number) && ! is_string($number))) { |
|
261 | 260 | return $number; |
262 | 261 | } |
263 | 262 | |
264 | 263 | // Remove slash from amount. |
265 | 264 | // If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number. |
266 | 265 | // To prevent notices and warning remove slash from amount/number. |
267 | - $number = wp_unslash( $number ); |
|
266 | + $number = wp_unslash($number); |
|
268 | 267 | |
269 | 268 | $thousand_separator = give_get_price_thousand_separator(); |
270 | 269 | |
271 | 270 | $locale = localeconv(); |
272 | - $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
271 | + $decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']); |
|
273 | 272 | |
274 | 273 | // Remove locale from string |
275 | - if ( ! is_float( $number ) ) { |
|
276 | - $number = str_replace( $decimals, '.', $number ); |
|
274 | + if ( ! is_float($number)) { |
|
275 | + $number = str_replace($decimals, '.', $number); |
|
277 | 276 | } |
278 | 277 | |
279 | 278 | // Remove thousand amount formatting if amount has. |
280 | 279 | // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
281 | 280 | // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code. |
282 | - if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) { |
|
283 | - $number = str_replace( $thousand_separator, '', $number ); |
|
284 | - } elseif ( in_array( $thousand_separator, $decimals ) ) { |
|
285 | - $number = preg_replace( '/\.(?=.*\.)/', '', $number ); |
|
281 | + if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) { |
|
282 | + $number = str_replace($thousand_separator, '', $number); |
|
283 | + } elseif (in_array($thousand_separator, $decimals)) { |
|
284 | + $number = preg_replace('/\.(?=.*\.)/', '', $number); |
|
286 | 285 | } |
287 | 286 | |
288 | 287 | // Remove non numeric entity before decimal separator. |
289 | - $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
288 | + $number = preg_replace('/[^0-9\.]/', '', $number); |
|
290 | 289 | $default_dp = give_get_price_decimals(); |
291 | 290 | |
292 | 291 | // Reset negative amount to zero. |
293 | - if ( 0 > $number ) { |
|
294 | - $number = number_format( 0, $default_dp, '.' ); |
|
292 | + if (0 > $number) { |
|
293 | + $number = number_format(0, $default_dp, '.'); |
|
295 | 294 | } |
296 | 295 | |
297 | 296 | // If number does not have decimal then add number of decimals to it. |
298 | 297 | if ( |
299 | - false === strpos( $number, '.' ) |
|
300 | - || ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) ) |
|
298 | + false === strpos($number, '.') |
|
299 | + || ($default_dp > strlen(substr($number, strpos($number, '.') + 1))) |
|
301 | 300 | ) { |
302 | - $number = number_format( $number, $default_dp, '.', '' ); |
|
301 | + $number = number_format($number, $default_dp, '.', ''); |
|
303 | 302 | } |
304 | 303 | |
305 | 304 | // Format number by custom number of decimals. |
306 | - if ( false !== $dp ) { |
|
307 | - $dp = intval( is_bool( $dp ) ? $default_dp : $dp ); |
|
308 | - $dp = apply_filters( 'give_sanitize_amount_decimals', $dp, $number ); |
|
309 | - $number = number_format( floatval( $number ), $dp, '.', '' ); |
|
305 | + if (false !== $dp) { |
|
306 | + $dp = intval(is_bool($dp) ? $default_dp : $dp); |
|
307 | + $dp = apply_filters('give_sanitize_amount_decimals', $dp, $number); |
|
308 | + $number = number_format(floatval($number), $dp, '.', ''); |
|
310 | 309 | } |
311 | 310 | |
312 | 311 | // Trim zeros. |
313 | - if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
314 | - $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
312 | + if ($trim_zeros && strstr($number, '.')) { |
|
313 | + $number = rtrim(rtrim($number, '0'), '.'); |
|
315 | 314 | } |
316 | 315 | |
317 | - return apply_filters( 'give_sanitize_amount', $number ); |
|
316 | + return apply_filters('give_sanitize_amount', $number); |
|
318 | 317 | } |
319 | 318 | |
320 | 319 | /** |
@@ -327,10 +326,10 @@ discard block |
||
327 | 326 | * |
328 | 327 | * @return string $amount Newly formatted amount or Price Not Available |
329 | 328 | */ |
330 | -function give_format_amount( $amount, $args = array() ) { |
|
329 | +function give_format_amount($amount, $args = array()) { |
|
331 | 330 | // Backward compatibility. |
332 | - if( is_bool( $args ) ) { |
|
333 | - $args = array( 'decimal' => $args ); |
|
331 | + if (is_bool($args)) { |
|
332 | + $args = array('decimal' => $args); |
|
334 | 333 | } |
335 | 334 | |
336 | 335 | $default_args = array( |
@@ -340,62 +339,61 @@ discard block |
||
340 | 339 | 'currency' => '', |
341 | 340 | ); |
342 | 341 | |
343 | - $args = wp_parse_args( $args, $default_args ); |
|
342 | + $args = wp_parse_args($args, $default_args); |
|
344 | 343 | |
345 | 344 | // Set Currency based on donation id, if required. |
346 | - if( $args['donation_id'] && empty( $args['currency'] ) ) { |
|
347 | - $donation_meta = give_get_meta( $args['donation_id'], '_give_payment_meta', true ); |
|
345 | + if ($args['donation_id'] && empty($args['currency'])) { |
|
346 | + $donation_meta = give_get_meta($args['donation_id'], '_give_payment_meta', true); |
|
348 | 347 | $args['currency'] = $donation_meta['currency']; |
349 | 348 | } |
350 | 349 | |
351 | 350 | $formatted = 0; |
352 | - $currency = ! empty( $args['currency'] ) ? $args['currency'] : give_get_currency( $args['donation_id'] ); |
|
353 | - $thousands_sep = give_get_price_thousand_separator( $currency ); |
|
354 | - $decimal_sep = give_get_price_decimal_separator( $currency ); |
|
355 | - $decimals = ! empty( $args['decimal'] ) ? give_get_price_decimals( $currency ) : 0; |
|
351 | + $currency = ! empty($args['currency']) ? $args['currency'] : give_get_currency($args['donation_id']); |
|
352 | + $thousands_sep = give_get_price_thousand_separator($currency); |
|
353 | + $decimal_sep = give_get_price_decimal_separator($currency); |
|
354 | + $decimals = ! empty($args['decimal']) ? give_get_price_decimals($currency) : 0; |
|
356 | 355 | |
357 | - if ( ! empty( $amount ) ) { |
|
356 | + if ( ! empty($amount)) { |
|
358 | 357 | // Sanitize amount before formatting. |
359 | - $amount = ! empty( $args['sanitize'] ) ? |
|
360 | - give_maybe_sanitize_amount( $amount, $decimals ) : |
|
361 | - number_format( $amount, $decimals, '.', '' ); |
|
358 | + $amount = ! empty($args['sanitize']) ? |
|
359 | + give_maybe_sanitize_amount($amount, $decimals) : number_format($amount, $decimals, '.', ''); |
|
362 | 360 | |
363 | - switch ( $currency ) { |
|
361 | + switch ($currency) { |
|
364 | 362 | case 'INR': |
365 | 363 | $decimal_amount = ''; |
366 | 364 | |
367 | 365 | // Extract decimals from amount |
368 | - if ( ( $pos = strpos( $amount, '.' ) ) !== false ) { |
|
369 | - if ( ! empty( $decimals ) ) { |
|
370 | - $decimal_amount = substr( round( substr( $amount, $pos ), $decimals ), 1 ); |
|
371 | - $amount = substr( $amount, 0, $pos ); |
|
372 | - |
|
373 | - if ( ! $decimal_amount ) { |
|
374 | - $decimal_amount = substr( '.0000000000', 0, ( $decimals + 1 ) ); |
|
375 | - } elseif ( ( $decimals + 1 ) > strlen( $decimal_amount ) ) { |
|
376 | - $decimal_amount = substr( "{$decimal_amount}000000000", 0, ( $decimals + 1 ) ); |
|
366 | + if (($pos = strpos($amount, '.')) !== false) { |
|
367 | + if ( ! empty($decimals)) { |
|
368 | + $decimal_amount = substr(round(substr($amount, $pos), $decimals), 1); |
|
369 | + $amount = substr($amount, 0, $pos); |
|
370 | + |
|
371 | + if ( ! $decimal_amount) { |
|
372 | + $decimal_amount = substr('.0000000000', 0, ($decimals + 1)); |
|
373 | + } elseif (($decimals + 1) > strlen($decimal_amount)) { |
|
374 | + $decimal_amount = substr("{$decimal_amount}000000000", 0, ($decimals + 1)); |
|
377 | 375 | } |
378 | 376 | |
379 | 377 | } else { |
380 | - $amount = number_format( $amount, $decimals, $decimal_sep, '' ); |
|
378 | + $amount = number_format($amount, $decimals, $decimal_sep, ''); |
|
381 | 379 | } |
382 | 380 | } |
383 | 381 | |
384 | 382 | // Extract last 3 from amount |
385 | - $result = substr( $amount, - 3 ); |
|
386 | - $amount = substr( $amount, 0, - 3 ); |
|
383 | + $result = substr($amount, - 3); |
|
384 | + $amount = substr($amount, 0, - 3); |
|
387 | 385 | |
388 | 386 | // Apply digits 2 by 2 |
389 | - while ( strlen( $amount ) > 0 ) { |
|
390 | - $result = substr( $amount, - 2 ) . $thousands_sep . $result; |
|
391 | - $amount = substr( $amount, 0, - 2 ); |
|
387 | + while (strlen($amount) > 0) { |
|
388 | + $result = substr($amount, - 2).$thousands_sep.$result; |
|
389 | + $amount = substr($amount, 0, - 2); |
|
392 | 390 | } |
393 | 391 | |
394 | - $formatted = $result . $decimal_amount; |
|
392 | + $formatted = $result.$decimal_amount; |
|
395 | 393 | break; |
396 | 394 | |
397 | 395 | default: |
398 | - $formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
396 | + $formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep); |
|
399 | 397 | } |
400 | 398 | } |
401 | 399 | |
@@ -404,7 +402,7 @@ discard block |
||
404 | 402 | * |
405 | 403 | * @since 1.0 |
406 | 404 | */ |
407 | - return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $currency, $args ); |
|
405 | + return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $currency, $args); |
|
408 | 406 | } |
409 | 407 | |
410 | 408 | |
@@ -422,14 +420,14 @@ discard block |
||
422 | 420 | * |
423 | 421 | * @return float|string formatted amount number with large number names. |
424 | 422 | */ |
425 | -function give_human_format_large_amount( $amount, $args = array() ) { |
|
423 | +function give_human_format_large_amount($amount, $args = array()) { |
|
426 | 424 | // Bailout. |
427 | - if( empty( $amount ) ) { |
|
425 | + if (empty($amount)) { |
|
428 | 426 | return ''; |
429 | 427 | }; |
430 | 428 | |
431 | 429 | // Set default currency; |
432 | - if( empty( $args['currency'] )) { |
|
430 | + if (empty($args['currency'])) { |
|
433 | 431 | $args['currency'] = give_get_currency(); |
434 | 432 | } |
435 | 433 | |
@@ -437,40 +435,40 @@ discard block |
||
437 | 435 | $thousands_sep = give_get_price_thousand_separator(); |
438 | 436 | |
439 | 437 | // Sanitize amount. |
440 | - $sanitize_amount = give_maybe_sanitize_amount( $amount ); |
|
438 | + $sanitize_amount = give_maybe_sanitize_amount($amount); |
|
441 | 439 | |
442 | 440 | // Explode amount to calculate name of large numbers. |
443 | - $amount_array = explode( $thousands_sep, $amount ); |
|
441 | + $amount_array = explode($thousands_sep, $amount); |
|
444 | 442 | |
445 | 443 | // Calculate amount parts count. |
446 | - $amount_count_parts = count( $amount_array ); |
|
444 | + $amount_count_parts = count($amount_array); |
|
447 | 445 | |
448 | 446 | // Human format amount (default). |
449 | 447 | $human_format_amount = $amount; |
450 | 448 | |
451 | - switch ( $args['currency'] ) { |
|
449 | + switch ($args['currency']) { |
|
452 | 450 | case 'INR': |
453 | 451 | // Calculate large number formatted amount. |
454 | - if ( 4 < $amount_count_parts ) { |
|
455 | - $human_format_amount = sprintf( esc_html__( '%s arab', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) ); |
|
456 | - } elseif ( 3 < $amount_count_parts ) { |
|
457 | - $human_format_amount = sprintf( esc_html__( '%s crore', 'give' ), round( ( $sanitize_amount / 10000000 ), 2 ) ); |
|
458 | - } elseif ( 2 < $amount_count_parts ) { |
|
459 | - $human_format_amount = sprintf( esc_html__( '%s lakh', 'give' ), round( ( $sanitize_amount / 100000 ), 2 ) ); |
|
452 | + if (4 < $amount_count_parts) { |
|
453 | + $human_format_amount = sprintf(esc_html__('%s arab', 'give'), round(($sanitize_amount / 1000000000), 2)); |
|
454 | + } elseif (3 < $amount_count_parts) { |
|
455 | + $human_format_amount = sprintf(esc_html__('%s crore', 'give'), round(($sanitize_amount / 10000000), 2)); |
|
456 | + } elseif (2 < $amount_count_parts) { |
|
457 | + $human_format_amount = sprintf(esc_html__('%s lakh', 'give'), round(($sanitize_amount / 100000), 2)); |
|
460 | 458 | } |
461 | 459 | break; |
462 | 460 | default: |
463 | 461 | // Calculate large number formatted amount. |
464 | - if ( 4 < $amount_count_parts ) { |
|
465 | - $human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) ); |
|
466 | - } elseif ( 3 < $amount_count_parts ) { |
|
467 | - $human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) ); |
|
468 | - } elseif ( 2 < $amount_count_parts ) { |
|
469 | - $human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) ); |
|
462 | + if (4 < $amount_count_parts) { |
|
463 | + $human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2)); |
|
464 | + } elseif (3 < $amount_count_parts) { |
|
465 | + $human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2)); |
|
466 | + } elseif (2 < $amount_count_parts) { |
|
467 | + $human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2)); |
|
470 | 468 | } |
471 | 469 | } |
472 | 470 | |
473 | - return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount ); |
|
471 | + return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount); |
|
474 | 472 | } |
475 | 473 | |
476 | 474 | /** |
@@ -484,17 +482,16 @@ discard block |
||
484 | 482 | * |
485 | 483 | * @return string $amount Newly formatted amount or Price Not Available |
486 | 484 | */ |
487 | -function give_format_decimal( $amount, $dp = false, $sanitize = true ) { |
|
485 | +function give_format_decimal($amount, $dp = false, $sanitize = true) { |
|
488 | 486 | $decimal_separator = give_get_price_decimal_separator(); |
489 | 487 | $formatted_amount = $sanitize ? |
490 | - give_maybe_sanitize_amount( $amount, $dp ) : |
|
491 | - number_format( $amount, ( is_bool( $dp ) ? give_get_price_decimals() : $dp ), '.', '' ); |
|
488 | + give_maybe_sanitize_amount($amount, $dp) : number_format($amount, (is_bool($dp) ? give_get_price_decimals() : $dp), '.', ''); |
|
492 | 489 | |
493 | - if ( false !== strpos( $formatted_amount, '.' ) ) { |
|
494 | - $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
490 | + if (false !== strpos($formatted_amount, '.')) { |
|
491 | + $formatted_amount = str_replace('.', $decimal_separator, $formatted_amount); |
|
495 | 492 | } |
496 | 493 | |
497 | - return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
494 | + return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator); |
|
498 | 495 | } |
499 | 496 | |
500 | 497 | /** |
@@ -508,24 +505,24 @@ discard block |
||
508 | 505 | * |
509 | 506 | * @return mixed|string |
510 | 507 | */ |
511 | -function give_currency_filter( $price = '', $currency = '', $decode_currency = false ) { |
|
508 | +function give_currency_filter($price = '', $currency = '', $decode_currency = false) { |
|
512 | 509 | |
513 | - if ( empty( $currency ) || ! array_key_exists( (string) $currency, give_get_currencies() ) ) { |
|
510 | + if (empty($currency) || ! array_key_exists((string) $currency, give_get_currencies())) { |
|
514 | 511 | $currency = give_get_currency(); |
515 | 512 | } |
516 | 513 | |
517 | - $position = give_get_option( 'currency_position', 'before' ); |
|
514 | + $position = give_get_option('currency_position', 'before'); |
|
518 | 515 | |
519 | 516 | $negative = $price < 0; |
520 | 517 | |
521 | - if ( $negative ) { |
|
518 | + if ($negative) { |
|
522 | 519 | // Remove proceeding "-". |
523 | - $price = substr( $price, 1 ); |
|
520 | + $price = substr($price, 1); |
|
524 | 521 | } |
525 | 522 | |
526 | - $symbol = give_currency_symbol( $currency, $decode_currency ); |
|
523 | + $symbol = give_currency_symbol($currency, $decode_currency); |
|
527 | 524 | |
528 | - switch ( $currency ) : |
|
525 | + switch ($currency) : |
|
529 | 526 | case 'GBP' : |
530 | 527 | case 'BRL' : |
531 | 528 | case 'EUR' : |
@@ -554,13 +551,13 @@ discard block |
||
554 | 551 | case 'MAD' : |
555 | 552 | case 'KRW' : |
556 | 553 | case 'ZAR' : |
557 | - $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol ); |
|
554 | + $formatted = ('before' === $position ? $symbol.$price : $price.$symbol); |
|
558 | 555 | break; |
559 | 556 | case 'NOK' : |
560 | - $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol ); |
|
557 | + $formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol); |
|
561 | 558 | break; |
562 | 559 | default : |
563 | - $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency ); |
|
560 | + $formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency); |
|
564 | 561 | break; |
565 | 562 | endswitch; |
566 | 563 | |
@@ -575,11 +572,11 @@ discard block |
||
575 | 572 | * and if currency is USD and currency position is after then |
576 | 573 | * filter name will be give_usd_currency_filter_after |
577 | 574 | */ |
578 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price ); |
|
575 | + $formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price); |
|
579 | 576 | |
580 | - if ( $negative ) { |
|
577 | + if ($negative) { |
|
581 | 578 | // Prepend the minus sign before the currency sign. |
582 | - $formatted = '-' . $formatted; |
|
579 | + $formatted = '-'.$formatted; |
|
583 | 580 | } |
584 | 581 | |
585 | 582 | return $formatted; |
@@ -595,7 +592,7 @@ discard block |
||
595 | 592 | * |
596 | 593 | * @return string Date format string |
597 | 594 | */ |
598 | -function give_date_format( $date_context = '' ) { |
|
595 | +function give_date_format($date_context = '') { |
|
599 | 596 | /** |
600 | 597 | * Filter the date context |
601 | 598 | * |
@@ -616,19 +613,19 @@ discard block |
||
616 | 613 | * |
617 | 614 | * } |
618 | 615 | */ |
619 | - $date_format_contexts = apply_filters( 'give_date_format_contexts', array() ); |
|
616 | + $date_format_contexts = apply_filters('give_date_format_contexts', array()); |
|
620 | 617 | |
621 | 618 | // Set date format to default date format. |
622 | - $date_format = get_option( 'date_format' ); |
|
619 | + $date_format = get_option('date_format'); |
|
623 | 620 | |
624 | 621 | // Update date format if we have non empty date format context array and non empty date format string for that context. |
625 | - if ( $date_context && ! empty( $date_format_contexts ) && array_key_exists( $date_context, $date_format_contexts ) ) { |
|
626 | - $date_format = ! empty( $date_format_contexts[ $date_context ] ) |
|
627 | - ? $date_format_contexts[ $date_context ] |
|
622 | + if ($date_context && ! empty($date_format_contexts) && array_key_exists($date_context, $date_format_contexts)) { |
|
623 | + $date_format = ! empty($date_format_contexts[$date_context]) |
|
624 | + ? $date_format_contexts[$date_context] |
|
628 | 625 | : $date_format; |
629 | 626 | } |
630 | 627 | |
631 | - return apply_filters( 'give_date_format', $date_format ); |
|
628 | + return apply_filters('give_date_format', $date_format); |
|
632 | 629 | } |
633 | 630 | |
634 | 631 | /** |
@@ -642,8 +639,8 @@ discard block |
||
642 | 639 | * |
643 | 640 | * @return string |
644 | 641 | */ |
645 | -function give_get_cache_key( $action, $query_args ) { |
|
646 | - return Give_Cache::get_key( $action, $query_args ); |
|
642 | +function give_get_cache_key($action, $query_args) { |
|
643 | + return Give_Cache::get_key($action, $query_args); |
|
647 | 644 | } |
648 | 645 | |
649 | 646 | /** |
@@ -656,11 +653,11 @@ discard block |
||
656 | 653 | * |
657 | 654 | * @return string|array |
658 | 655 | */ |
659 | -function give_clean( $var ) { |
|
660 | - if ( is_array( $var ) ) { |
|
661 | - return array_map( 'give_clean', $var ); |
|
656 | +function give_clean($var) { |
|
657 | + if (is_array($var)) { |
|
658 | + return array_map('give_clean', $var); |
|
662 | 659 | } else { |
663 | - return is_scalar( $var ) ? sanitize_text_field( $var ) : $var; |
|
660 | + return is_scalar($var) ? sanitize_text_field($var) : $var; |
|
664 | 661 | } |
665 | 662 | } |
666 | 663 | |
@@ -673,10 +670,10 @@ discard block |
||
673 | 670 | * |
674 | 671 | * @return int |
675 | 672 | */ |
676 | -function give_let_to_num( $size ) { |
|
677 | - $l = substr( $size, - 1 ); |
|
678 | - $ret = substr( $size, 0, - 1 ); |
|
679 | - switch ( strtoupper( $l ) ) { |
|
673 | +function give_let_to_num($size) { |
|
674 | + $l = substr($size, - 1); |
|
675 | + $ret = substr($size, 0, - 1); |
|
676 | + switch (strtoupper($l)) { |
|
680 | 677 | case 'P': |
681 | 678 | $ret *= 1024; |
682 | 679 | case 'T': |
@@ -701,19 +698,19 @@ discard block |
||
701 | 698 | * @param int $action |
702 | 699 | * @param array $wp_die_args |
703 | 700 | */ |
704 | -function give_validate_nonce( $nonce, $action = - 1, $wp_die_args = array() ) { |
|
701 | +function give_validate_nonce($nonce, $action = - 1, $wp_die_args = array()) { |
|
705 | 702 | |
706 | 703 | $default_wp_die_args = array( |
707 | - 'message' => esc_html__( 'Nonce verification has failed.', 'give' ), |
|
708 | - 'title' => esc_html__( 'Error', 'give' ), |
|
704 | + 'message' => esc_html__('Nonce verification has failed.', 'give'), |
|
705 | + 'title' => esc_html__('Error', 'give'), |
|
709 | 706 | 'args' => array( |
710 | 707 | 'response' => 403, |
711 | 708 | ), |
712 | 709 | ); |
713 | 710 | |
714 | - $wp_die_args = wp_parse_args( $wp_die_args, $default_wp_die_args ); |
|
711 | + $wp_die_args = wp_parse_args($wp_die_args, $default_wp_die_args); |
|
715 | 712 | |
716 | - if ( ! wp_verify_nonce( $nonce, $action ) ) { |
|
713 | + if ( ! wp_verify_nonce($nonce, $action)) { |
|
717 | 714 | wp_die( |
718 | 715 | $wp_die_args['message'], |
719 | 716 | $wp_die_args['title'], |
@@ -735,23 +732,23 @@ discard block |
||
735 | 732 | * |
736 | 733 | * @return mixed |
737 | 734 | */ |
738 | -function give_check_variable( $variable, $conditional = '', $default = false ) { |
|
735 | +function give_check_variable($variable, $conditional = '', $default = false) { |
|
739 | 736 | |
740 | - switch ( $conditional ) { |
|
737 | + switch ($conditional) { |
|
741 | 738 | case 'isset_empty': |
742 | - $variable = ( isset( $variable ) && ! empty( $variable ) ) ? $variable : $default; |
|
739 | + $variable = (isset($variable) && ! empty($variable)) ? $variable : $default; |
|
743 | 740 | break; |
744 | 741 | |
745 | 742 | case 'empty': |
746 | - $variable = ! empty( $variable ) ? $variable : $default; |
|
743 | + $variable = ! empty($variable) ? $variable : $default; |
|
747 | 744 | break; |
748 | 745 | |
749 | 746 | case 'null': |
750 | - $variable = ! is_null( $variable ) ? $variable : $default; |
|
747 | + $variable = ! is_null($variable) ? $variable : $default; |
|
751 | 748 | break; |
752 | 749 | |
753 | 750 | default: |
754 | - $variable = isset( $variable ) ? $variable : $default; |
|
751 | + $variable = isset($variable) ? $variable : $default; |
|
755 | 752 | |
756 | 753 | } |
757 | 754 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | if( is_string( $id_or_currency_code ) && ( $id_or_currency_code !== $give_options['currency'] ) && array_key_exists( $id_or_currency_code, $currencies ) ) { |
36 | 36 | $setting = $currencies[ $id_or_currency_code ]['setting']; |
37 | - }elseif ( is_numeric( $id_or_currency_code ) && 'give_payment' === get_post_type( $id_or_currency_code ) ) { |
|
37 | + } elseif ( is_numeric( $id_or_currency_code ) && 'give_payment' === get_post_type( $id_or_currency_code ) ) { |
|
38 | 38 | $donation_meta = give_get_meta( $id_or_currency_code, '_give_payment_meta', true ); |
39 | 39 | |
40 | 40 | if ( |
@@ -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 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param bool $_id Post id. Default is false. |
338 | 338 | * @param array $_args Arguments passed. |
339 | 339 | */ |
340 | - public function __construct( $_id = false, $_args = array() ) { |
|
340 | + public function __construct($_id = false, $_args = array()) { |
|
341 | 341 | |
342 | - $donation_form = WP_Post::get_instance( $_id ); |
|
342 | + $donation_form = WP_Post::get_instance($_id); |
|
343 | 343 | |
344 | - return $this->setup_donation_form( $donation_form ); |
|
344 | + return $this->setup_donation_form($donation_form); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -354,23 +354,23 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return bool If the setup was successful or not. |
356 | 356 | */ |
357 | - private function setup_donation_form( $donation_form ) { |
|
357 | + private function setup_donation_form($donation_form) { |
|
358 | 358 | |
359 | - if ( ! is_object( $donation_form ) ) { |
|
359 | + if ( ! is_object($donation_form)) { |
|
360 | 360 | return false; |
361 | 361 | } |
362 | 362 | |
363 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
363 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
367 | + if ('give_forms' !== $donation_form->post_type) { |
|
368 | 368 | return false; |
369 | 369 | } |
370 | 370 | |
371 | - foreach ( $donation_form as $key => $value ) { |
|
371 | + foreach ($donation_form as $key => $value) { |
|
372 | 372 | |
373 | - switch ( $key ) { |
|
373 | + switch ($key) { |
|
374 | 374 | |
375 | 375 | default: |
376 | 376 | $this->$key = $value; |
@@ -394,16 +394,16 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return mixed |
396 | 396 | */ |
397 | - public function __get( $key ) { |
|
397 | + public function __get($key) { |
|
398 | 398 | |
399 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
399 | + if (method_exists($this, 'get_'.$key)) { |
|
400 | 400 | |
401 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
401 | + return call_user_func(array($this, 'get_'.$key)); |
|
402 | 402 | |
403 | 403 | } else { |
404 | 404 | |
405 | 405 | /* translators: %s: property key */ |
406 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
406 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
407 | 407 | |
408 | 408 | } |
409 | 409 | |
@@ -419,30 +419,30 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
421 | 421 | */ |
422 | - public function create( $data = array() ) { |
|
422 | + public function create($data = array()) { |
|
423 | 423 | |
424 | - if ( $this->id != 0 ) { |
|
424 | + if ($this->id != 0) { |
|
425 | 425 | return false; |
426 | 426 | } |
427 | 427 | |
428 | 428 | $defaults = array( |
429 | 429 | 'post_type' => 'give_forms', |
430 | 430 | 'post_status' => 'draft', |
431 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
431 | + 'post_title' => __('New Donation Form', 'give'), |
|
432 | 432 | ); |
433 | 433 | |
434 | - $args = wp_parse_args( $data, $defaults ); |
|
434 | + $args = wp_parse_args($data, $defaults); |
|
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Fired before a donation form is created |
438 | 438 | * |
439 | 439 | * @param array $args The post object arguments used for creation. |
440 | 440 | */ |
441 | - do_action( 'give_form_pre_create', $args ); |
|
441 | + do_action('give_form_pre_create', $args); |
|
442 | 442 | |
443 | - $id = wp_insert_post( $args, true ); |
|
443 | + $id = wp_insert_post($args, true); |
|
444 | 444 | |
445 | - $donation_form = WP_Post::get_instance( $id ); |
|
445 | + $donation_form = WP_Post::get_instance($id); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fired after a donation form is created |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | * @param int $id The post ID of the created item. |
451 | 451 | * @param array $args The post object arguments used for creation. |
452 | 452 | */ |
453 | - do_action( 'give_form_post_create', $id, $args ); |
|
453 | + do_action('give_form_post_create', $id, $args); |
|
454 | 454 | |
455 | - return $this->setup_donation_form( $donation_form ); |
|
455 | + return $this->setup_donation_form($donation_form); |
|
456 | 456 | |
457 | 457 | } |
458 | 458 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return string Donation form name. |
478 | 478 | */ |
479 | 479 | public function get_name() { |
480 | - return get_the_title( $this->ID ); |
|
480 | + return get_the_title($this->ID); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | public function get_price() { |
492 | 492 | |
493 | - if ( ! isset( $this->price ) ) { |
|
493 | + if ( ! isset($this->price)) { |
|
494 | 494 | |
495 | 495 | $this->price = give_maybe_sanitize_amount( |
496 | 496 | give_get_meta( |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | ) |
501 | 501 | ); |
502 | 502 | |
503 | - if ( ! $this->price ) { |
|
503 | + if ( ! $this->price) { |
|
504 | 504 | $this->price = 0; |
505 | 505 | } |
506 | 506 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @param string $price The donation form price. |
515 | 515 | * @param string|int $id The form ID. |
516 | 516 | */ |
517 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
517 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
@@ -527,18 +527,18 @@ discard block |
||
527 | 527 | */ |
528 | 528 | public function get_minimum_price() { |
529 | 529 | |
530 | - if ( ! isset( $this->minimum_price ) ) { |
|
530 | + if ( ! isset($this->minimum_price)) { |
|
531 | 531 | |
532 | - $allow_custom_amount = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
533 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
532 | + $allow_custom_amount = give_get_meta($this->ID, '_give_custom_amount', true); |
|
533 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true); |
|
534 | 534 | |
535 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
535 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
536 | 536 | $this->minimum_price = 0; |
537 | 537 | } |
538 | 538 | |
539 | 539 | } |
540 | 540 | |
541 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
541 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | /** |
@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public function get_prices() { |
553 | 553 | |
554 | - if ( ! isset( $this->prices ) ) { |
|
554 | + if ( ! isset($this->prices)) { |
|
555 | 555 | |
556 | - $this->prices = give_get_meta( $this->ID, '_give_donation_levels', true ); |
|
556 | + $this->prices = give_get_meta($this->ID, '_give_donation_levels', true); |
|
557 | 557 | |
558 | 558 | } |
559 | 559 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @param array $prices The array of mulit-level prices. |
566 | 566 | * @param int|string $ID The ID of the form. |
567 | 567 | */ |
568 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
568 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
569 | 569 | |
570 | 570 | } |
571 | 571 | |
@@ -579,17 +579,17 @@ discard block |
||
579 | 579 | */ |
580 | 580 | public function get_goal() { |
581 | 581 | |
582 | - if ( ! isset( $this->goal ) ) { |
|
582 | + if ( ! isset($this->goal)) { |
|
583 | 583 | |
584 | - $this->goal = give_get_meta( $this->ID, '_give_set_goal', true ); |
|
584 | + $this->goal = give_get_meta($this->ID, '_give_set_goal', true); |
|
585 | 585 | |
586 | - if ( ! $this->goal ) { |
|
586 | + if ( ! $this->goal) { |
|
587 | 587 | $this->goal = 0; |
588 | 588 | } |
589 | 589 | |
590 | 590 | } |
591 | 591 | |
592 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
592 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
593 | 593 | |
594 | 594 | } |
595 | 595 | |
@@ -603,10 +603,10 @@ discard block |
||
603 | 603 | */ |
604 | 604 | public function is_single_price_mode() { |
605 | 605 | |
606 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
606 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
607 | 607 | $ret = 0; |
608 | 608 | |
609 | - if ( empty( $option ) || $option === 'set' ) { |
|
609 | + if (empty($option) || $option === 'set') { |
|
610 | 610 | $ret = 1; |
611 | 611 | } |
612 | 612 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * @param bool $ret Is donation form in single price mode? |
619 | 619 | * @param int|string $ID The ID of the donation form. |
620 | 620 | */ |
621 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
621 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
622 | 622 | |
623 | 623 | } |
624 | 624 | |
@@ -632,10 +632,10 @@ discard block |
||
632 | 632 | */ |
633 | 633 | public function is_custom_price_mode() { |
634 | 634 | |
635 | - $option = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
635 | + $option = give_get_meta($this->ID, '_give_custom_amount', true); |
|
636 | 636 | $ret = 0; |
637 | 637 | |
638 | - if ( give_is_setting_enabled( $option ) ) { |
|
638 | + if (give_is_setting_enabled($option)) { |
|
639 | 639 | $ret = 1; |
640 | 640 | } |
641 | 641 | |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @param bool $ret Is donation form in custom price mode? |
648 | 648 | * @param int|string $ID The ID of the donation form. |
649 | 649 | */ |
650 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
650 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
651 | 651 | |
652 | 652 | } |
653 | 653 | |
@@ -663,10 +663,10 @@ discard block |
||
663 | 663 | */ |
664 | 664 | public function has_variable_prices() { |
665 | 665 | |
666 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
666 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
667 | 667 | $ret = 0; |
668 | 668 | |
669 | - if ( $option === 'multi' ) { |
|
669 | + if ($option === 'multi') { |
|
670 | 670 | $ret = 1; |
671 | 671 | } |
672 | 672 | |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | * @param bool $ret Does donation form have variable prices? |
677 | 677 | * @param int|string $ID The ID of the donation form. |
678 | 678 | */ |
679 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
679 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
680 | 680 | |
681 | 681 | } |
682 | 682 | |
@@ -690,17 +690,17 @@ discard block |
||
690 | 690 | */ |
691 | 691 | public function get_type() { |
692 | 692 | |
693 | - if ( ! isset( $this->type ) ) { |
|
693 | + if ( ! isset($this->type)) { |
|
694 | 694 | |
695 | - $this->type = give_get_meta( $this->ID, '_give_price_option', true ); |
|
695 | + $this->type = give_get_meta($this->ID, '_give_price_option', true); |
|
696 | 696 | |
697 | - if ( empty( $this->type ) ) { |
|
697 | + if (empty($this->type)) { |
|
698 | 698 | $this->type = 'set'; |
699 | 699 | } |
700 | 700 | |
701 | 701 | } |
702 | 702 | |
703 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
703 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
704 | 704 | |
705 | 705 | } |
706 | 706 | |
@@ -716,23 +716,23 @@ discard block |
||
716 | 716 | * |
717 | 717 | * @return string |
718 | 718 | */ |
719 | - public function get_form_classes( $args ) { |
|
719 | + public function get_form_classes($args) { |
|
720 | 720 | |
721 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
721 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
722 | 722 | ? 'float-labels-enabled' |
723 | 723 | : ''; |
724 | 724 | |
725 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
725 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
726 | 726 | 'give-form', |
727 | - 'give-form-' . $this->ID, |
|
728 | - 'give-form-type-' . $this->get_type(), |
|
727 | + 'give-form-'.$this->ID, |
|
728 | + 'give-form-type-'.$this->get_type(), |
|
729 | 729 | $float_labels_option, |
730 | - ), $this->ID, $args ); |
|
730 | + ), $this->ID, $args); |
|
731 | 731 | |
732 | 732 | // Remove empty class names. |
733 | - $form_classes_array = array_filter( $form_classes_array ); |
|
733 | + $form_classes_array = array_filter($form_classes_array); |
|
734 | 734 | |
735 | - return implode( ' ', $form_classes_array ); |
|
735 | + return implode(' ', $form_classes_array); |
|
736 | 736 | |
737 | 737 | } |
738 | 738 | |
@@ -747,24 +747,24 @@ discard block |
||
747 | 747 | * |
748 | 748 | * @return string |
749 | 749 | */ |
750 | - public function get_form_wrap_classes( $args ) { |
|
750 | + public function get_form_wrap_classes($args) { |
|
751 | 751 | |
752 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
752 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
753 | 753 | ? $args['display_style'] |
754 | - : give_get_meta( $this->ID, '_give_payment_display', true ); |
|
754 | + : give_get_meta($this->ID, '_give_payment_display', true); |
|
755 | 755 | |
756 | 756 | // If admin want to show only button for form then user inbuilt modal functionality. |
757 | - if( 'button' === $display_option ) { |
|
757 | + if ('button' === $display_option) { |
|
758 | 758 | $display_option = 'modal give-display-button-only'; |
759 | 759 | } |
760 | 760 | |
761 | - $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
761 | + $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
762 | 762 | 'give-form-wrap', |
763 | - 'give-display-' . $display_option, |
|
764 | - ), $this->ID, $args ); |
|
763 | + 'give-display-'.$display_option, |
|
764 | + ), $this->ID, $args); |
|
765 | 765 | |
766 | 766 | |
767 | - return implode( ' ', $form_wrap_classes_array ); |
|
767 | + return implode(' ', $form_wrap_classes_array); |
|
768 | 768 | |
769 | 769 | } |
770 | 770 | |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | public function is_set_type_donation_form() { |
780 | 780 | $form_type = $this->get_type(); |
781 | 781 | |
782 | - return ( 'set' === $form_type ? true : false ); |
|
782 | + return ('set' === $form_type ? true : false); |
|
783 | 783 | } |
784 | 784 | |
785 | 785 | /** |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | public function is_multi_type_donation_form() { |
794 | 794 | $form_type = $this->get_type(); |
795 | 795 | |
796 | - return ( 'multi' === $form_type ? true : false ); |
|
796 | + return ('multi' === $form_type ? true : false); |
|
797 | 797 | |
798 | 798 | } |
799 | 799 | |
@@ -807,15 +807,15 @@ discard block |
||
807 | 807 | */ |
808 | 808 | public function get_sales() { |
809 | 809 | |
810 | - if ( ! isset( $this->sales ) ) { |
|
810 | + if ( ! isset($this->sales)) { |
|
811 | 811 | |
812 | - if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
|
813 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
812 | + if ('' == give_get_meta($this->ID, '_give_form_sales', true)) { |
|
813 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
814 | 814 | } // End if |
815 | 815 | |
816 | - $this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
|
816 | + $this->sales = give_get_meta($this->ID, '_give_form_sales', true); |
|
817 | 817 | |
818 | - if ( $this->sales < 0 ) { |
|
818 | + if ($this->sales < 0) { |
|
819 | 819 | // Never let sales be less than zero |
820 | 820 | $this->sales = 0; |
821 | 821 | } |
@@ -836,13 +836,13 @@ discard block |
||
836 | 836 | * |
837 | 837 | * @return int|false New number of total sales. |
838 | 838 | */ |
839 | - public function increase_sales( $quantity = 1 ) { |
|
839 | + public function increase_sales($quantity = 1) { |
|
840 | 840 | |
841 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
842 | - $quantity = absint( $quantity ); |
|
841 | + $sales = give_get_form_sales_stats($this->ID); |
|
842 | + $quantity = absint($quantity); |
|
843 | 843 | $total_sales = $sales + $quantity; |
844 | 844 | |
845 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
845 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
846 | 846 | |
847 | 847 | $this->sales = $total_sales; |
848 | 848 | |
@@ -863,17 +863,17 @@ discard block |
||
863 | 863 | * |
864 | 864 | * @return int|false New number of total sales. |
865 | 865 | */ |
866 | - public function decrease_sales( $quantity = 1 ) { |
|
866 | + public function decrease_sales($quantity = 1) { |
|
867 | 867 | |
868 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
868 | + $sales = give_get_form_sales_stats($this->ID); |
|
869 | 869 | |
870 | 870 | // Only decrease if not already zero |
871 | - if ( $sales > 0 ) { |
|
871 | + if ($sales > 0) { |
|
872 | 872 | |
873 | - $quantity = absint( $quantity ); |
|
873 | + $quantity = absint($quantity); |
|
874 | 874 | $total_sales = $sales - $quantity; |
875 | 875 | |
876 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
876 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
877 | 877 | |
878 | 878 | $this->sales = $sales; |
879 | 879 | |
@@ -897,15 +897,15 @@ discard block |
||
897 | 897 | */ |
898 | 898 | public function get_earnings() { |
899 | 899 | |
900 | - if ( ! isset( $this->earnings ) ) { |
|
900 | + if ( ! isset($this->earnings)) { |
|
901 | 901 | |
902 | - if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
903 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
902 | + if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) { |
|
903 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
904 | 904 | } |
905 | 905 | |
906 | - $this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
|
906 | + $this->earnings = give_get_meta($this->ID, '_give_form_earnings', true); |
|
907 | 907 | |
908 | - if ( $this->earnings < 0 ) { |
|
908 | + if ($this->earnings < 0) { |
|
909 | 909 | // Never let earnings be less than zero |
910 | 910 | $this->earnings = 0; |
911 | 911 | } |
@@ -926,12 +926,12 @@ discard block |
||
926 | 926 | * |
927 | 927 | * @return float|false |
928 | 928 | */ |
929 | - public function increase_earnings( $amount = 0 ) { |
|
929 | + public function increase_earnings($amount = 0) { |
|
930 | 930 | |
931 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
931 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
932 | 932 | $new_amount = $earnings + (float) $amount; |
933 | 933 | |
934 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
934 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
935 | 935 | |
936 | 936 | $this->earnings = $new_amount; |
937 | 937 | |
@@ -953,16 +953,16 @@ discard block |
||
953 | 953 | * |
954 | 954 | * @return float|false |
955 | 955 | */ |
956 | - public function decrease_earnings( $amount ) { |
|
956 | + public function decrease_earnings($amount) { |
|
957 | 957 | |
958 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
958 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
959 | 959 | |
960 | - if ( $earnings > 0 ) { |
|
960 | + if ($earnings > 0) { |
|
961 | 961 | // Only decrease if greater than zero |
962 | 962 | $new_amount = $earnings - (float) $amount; |
963 | 963 | |
964 | 964 | |
965 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
965 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
966 | 966 | |
967 | 967 | $this->earnings = $new_amount; |
968 | 968 | |
@@ -986,22 +986,22 @@ discard block |
||
986 | 986 | * |
987 | 987 | * @return bool |
988 | 988 | */ |
989 | - public function is_free( $price_id = false ) { |
|
989 | + public function is_free($price_id = false) { |
|
990 | 990 | |
991 | 991 | $is_free = false; |
992 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
992 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
993 | 993 | |
994 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
995 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
996 | - } elseif ( ! $variable_pricing ) { |
|
997 | - $price = give_get_meta( $this->ID, '_give_set_price', true ); |
|
994 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
995 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
996 | + } elseif ( ! $variable_pricing) { |
|
997 | + $price = give_get_meta($this->ID, '_give_set_price', true); |
|
998 | 998 | } |
999 | 999 | |
1000 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
1000 | + if (isset($price) && (float) $price == 0) { |
|
1001 | 1001 | $is_free = true; |
1002 | 1002 | } |
1003 | 1003 | |
1004 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
1004 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
1005 | 1005 | |
1006 | 1006 | } |
1007 | 1007 | |
@@ -1028,9 +1028,9 @@ discard block |
||
1028 | 1028 | $is_close_form = apply_filters( |
1029 | 1029 | 'give_is_close_donation_form', |
1030 | 1030 | ( |
1031 | - give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true ) ) ) |
|
1032 | - && give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
1033 | - && ( $this->get_goal() <= $this->get_earnings() |
|
1031 | + give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true)) ) |
|
1032 | + && give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true)) |
|
1033 | + && ($this->get_goal() <= $this->get_earnings() |
|
1034 | 1034 | ), |
1035 | 1035 | $this->ID |
1036 | 1036 | ); |
@@ -1049,29 +1049,29 @@ discard block |
||
1049 | 1049 | * |
1050 | 1050 | * @return bool The result of the update query. |
1051 | 1051 | */ |
1052 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1052 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1053 | 1053 | |
1054 | 1054 | /* @var WPDB $wpdb */ |
1055 | 1055 | global $wpdb; |
1056 | 1056 | |
1057 | - if ( empty( $meta_key ) ) { |
|
1057 | + if (empty($meta_key)) { |
|
1058 | 1058 | return false; |
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | // Make sure if it needs to be serialized, we do |
1062 | - $meta_value = maybe_serialize( $meta_value ); |
|
1062 | + $meta_value = maybe_serialize($meta_value); |
|
1063 | 1063 | |
1064 | - if ( is_numeric( $meta_value ) ) { |
|
1065 | - $value_type = is_float( $meta_value ) ? '%f' : '%d'; |
|
1064 | + if (is_numeric($meta_value)) { |
|
1065 | + $value_type = is_float($meta_value) ? '%f' : '%d'; |
|
1066 | 1066 | } else { |
1067 | 1067 | $value_type = "'%s'"; |
1068 | 1068 | } |
1069 | 1069 | |
1070 | - $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key ); |
|
1070 | + $sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key); |
|
1071 | 1071 | |
1072 | - if ( $wpdb->query( $sql ) ) { |
|
1072 | + if ($wpdb->query($sql)) { |
|
1073 | 1073 | |
1074 | - clean_post_cache( $this->ID ); |
|
1074 | + clean_post_cache($this->ID); |
|
1075 | 1075 | |
1076 | 1076 | return true; |
1077 | 1077 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | public function headers() { |
41 | - ignore_user_abort( true ); |
|
41 | + ignore_user_abort(true); |
|
42 | 42 | |
43 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
44 | - set_time_limit( 0 ); |
|
43 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
44 | + set_time_limit(0); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | nocache_headers(); |
48 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
49 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
50 | - header( "Expires: 0" ); |
|
48 | + header('Content-Type: text/csv; charset=utf-8'); |
|
49 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
50 | + header("Expires: 0"); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | public function csv_cols() { |
62 | 62 | |
63 | 63 | $cols = array( |
64 | - 'date' => __( 'Date', 'give' ), |
|
65 | - 'donations' => __( 'Donations', 'give' ), |
|
64 | + 'date' => __('Date', 'give'), |
|
65 | + 'donations' => __('Donations', 'give'), |
|
66 | 66 | /* translators: %s: currency */ |
67 | - 'earnings' => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) ) |
|
67 | + 'earnings' => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true)) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | return $cols; |
@@ -79,28 +79,28 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function get_data() { |
81 | 81 | |
82 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
83 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
84 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
85 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
82 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
83 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
84 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
85 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
86 | 86 | |
87 | 87 | $data = array(); |
88 | 88 | $year = $start_year; |
89 | 89 | $stats = new Give_Payment_Stats; |
90 | 90 | |
91 | - while ( $year <= $end_year ) { |
|
91 | + while ($year <= $end_year) { |
|
92 | 92 | |
93 | - if ( $year == $start_year && $year == $end_year ) { |
|
93 | + if ($year == $start_year && $year == $end_year) { |
|
94 | 94 | |
95 | 95 | $m1 = $start_month; |
96 | 96 | $m2 = $end_month; |
97 | 97 | |
98 | - } elseif ( $year == $start_year ) { |
|
98 | + } elseif ($year == $start_year) { |
|
99 | 99 | |
100 | 100 | $m1 = $start_month; |
101 | 101 | $m2 = 12; |
102 | 102 | |
103 | - } elseif ( $year == $end_year ) { |
|
103 | + } elseif ($year == $end_year) { |
|
104 | 104 | |
105 | 105 | $m1 = 1; |
106 | 106 | $m2 = $end_month; |
@@ -112,28 +112,28 @@ discard block |
||
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - while ( $m1 <= $m2 ) { |
|
115 | + while ($m1 <= $m2) { |
|
116 | 116 | |
117 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
118 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
117 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
118 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
119 | 119 | |
120 | 120 | $data[] = array( |
121 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
122 | - 'donations' => $stats->get_sales( 0, $date1, $date2 ), |
|
123 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ), array( 'sanitize' => false ) ), |
|
121 | + 'date' => date_i18n('F Y', $date1), |
|
122 | + 'donations' => $stats->get_sales(0, $date1, $date2), |
|
123 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2), array('sanitize' => false)), |
|
124 | 124 | ); |
125 | 125 | |
126 | - $m1 ++; |
|
126 | + $m1++; |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | - $year ++; |
|
131 | + $year++; |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
136 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
135 | + $data = apply_filters('give_export_get_data', $data); |
|
136 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
137 | 137 | |
138 | 138 | return $data; |
139 | 139 | } |