@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
27 | 27 | } |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
31 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
32 | 32 | |
33 | 33 | $export = new $_REQUEST['class']; |
34 | 34 | $export->export(); |
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
38 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Exports earnings for a specified time period |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | function give_export_earnings() { |
49 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php'; |
|
49 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php'; |
|
50 | 50 | |
51 | 51 | $earnings_export = new Give_Earnings_Export(); |
52 | 52 | |
53 | 53 | $earnings_export->export(); |
54 | 54 | } |
55 | 55 | |
56 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
56 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function give_export_all_customers() { |
69 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php'; |
|
69 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php'; |
|
70 | 70 | |
71 | 71 | $customer_export = new Give_Donors_Export(); |
72 | 72 | |
73 | 73 | $customer_export->export(); |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'give_email_export', 'give_export_all_customers' ); |
|
76 | +add_action('give_email_export', 'give_export_all_customers'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Add a hook allowing extensions to register a hook on the batch export process |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | function give_register_batch_exporters() { |
85 | - if ( is_admin() ) { |
|
86 | - do_action( 'give_register_batch_exporter' ); |
|
85 | + if (is_admin()) { |
|
86 | + do_action('give_register_batch_exporter'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
90 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Register the payments batch exporter |
94 | 94 | * @since 1.5 |
95 | 95 | */ |
96 | 96 | function give_register_payments_batch_export() { |
97 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
97 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
98 | 98 | } |
99 | 99 | |
100 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
100 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Loads the payments batch process if needed |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return void |
110 | 110 | */ |
111 | -function give_include_payments_batch_processor( $class ) { |
|
111 | +function give_include_payments_batch_processor($class) { |
|
112 | 112 | |
113 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
114 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
113 | + if ('Give_Batch_Payments_Export' === $class) { |
|
114 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * @since 1.5.2 |
122 | 122 | */ |
123 | 123 | function give_register_customers_batch_export() { |
124 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 ); |
|
124 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1); |
|
125 | 125 | } |
126 | 126 | |
127 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
127 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Loads the customers batch process if needed |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_include_customers_batch_processor( $class ) { |
|
138 | +function give_include_customers_batch_processor($class) { |
|
139 | 139 | |
140 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
141 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
140 | + if ('Give_Batch_Customers_Export' === $class) { |
|
141 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | } |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | * @since 1.5 |
150 | 150 | */ |
151 | 151 | function give_register_forms_batch_export() { |
152 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
152 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
153 | 153 | } |
154 | 154 | |
155 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
155 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
156 | 156 | |
157 | 157 | /** |
158 | 158 | * Loads the file downloads batch process if needed |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return void |
165 | 165 | */ |
166 | -function give_include_forms_batch_processor( $class ) { |
|
166 | +function give_include_forms_batch_processor($class) { |
|
167 | 167 | |
168 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
169 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
168 | + if ('Give_Batch_Forms_Export' === $class) { |
|
169 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | } |
173 | 173 | \ No newline at end of file |
@@ -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 | |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function __construct() { |
81 | 81 | |
82 | - if ( 'none' === $this->get_template() ) { |
|
82 | + if ('none' === $this->get_template()) { |
|
83 | 83 | $this->html = false; |
84 | 84 | } |
85 | 85 | |
86 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
87 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
86 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
87 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
88 | 88 | |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @since 1.0 |
95 | 95 | */ |
96 | - public function __set( $key, $value ) { |
|
96 | + public function __set($key, $value) { |
|
97 | 97 | $this->$key = $value; |
98 | 98 | } |
99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @since 1.0 |
104 | 104 | */ |
105 | 105 | public function get_from_name() { |
106 | - if ( ! $this->from_name ) { |
|
107 | - $this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) ); |
|
106 | + if ( ! $this->from_name) { |
|
107 | + $this->from_name = give_get_option('from_name', get_bloginfo('name')); |
|
108 | 108 | } |
109 | 109 | |
110 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
110 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | * @since 1.0 |
117 | 117 | */ |
118 | 118 | public function get_from_address() { |
119 | - if ( ! $this->from_address ) { |
|
120 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
119 | + if ( ! $this->from_address) { |
|
120 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
121 | 121 | } |
122 | 122 | |
123 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
123 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | * @since 1.0 |
130 | 130 | */ |
131 | 131 | public function get_content_type() { |
132 | - if ( ! $this->content_type && $this->html ) { |
|
133 | - $this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this ); |
|
134 | - } else if ( ! $this->html ) { |
|
132 | + if ( ! $this->content_type && $this->html) { |
|
133 | + $this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this); |
|
134 | + } else if ( ! $this->html) { |
|
135 | 135 | $this->content_type = 'text/plain'; |
136 | 136 | } |
137 | 137 | |
138 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
138 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | * @since 1.0 |
145 | 145 | */ |
146 | 146 | public function get_headers() { |
147 | - if ( ! $this->headers ) { |
|
147 | + if ( ! $this->headers) { |
|
148 | 148 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
149 | 149 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
150 | 150 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
151 | 151 | } |
152 | 152 | |
153 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
153 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function get_templates() { |
162 | 162 | $templates = array( |
163 | - 'default' => __( 'Default Template', 'give' ), |
|
164 | - 'none' => __( 'No template, plain text only', 'give' ) |
|
163 | + 'default' => __('Default Template', 'give'), |
|
164 | + 'none' => __('No template, plain text only', 'give') |
|
165 | 165 | ); |
166 | 166 | |
167 | - return apply_filters( 'give_email_templates', $templates ); |
|
167 | + return apply_filters('give_email_templates', $templates); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * @since 1.0 |
174 | 174 | */ |
175 | 175 | public function get_template() { |
176 | - if ( ! $this->template ) { |
|
177 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
176 | + if ( ! $this->template) { |
|
177 | + $this->template = give_get_option('email_template', 'default'); |
|
178 | 178 | } |
179 | 179 | |
180 | - return apply_filters( 'give_email_template', $this->template ); |
|
180 | + return apply_filters('give_email_template', $this->template); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @since 1.0 |
187 | 187 | */ |
188 | 188 | public function get_heading() { |
189 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
189 | + return apply_filters('give_email_heading', $this->heading); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return mixed |
198 | 198 | */ |
199 | - public function parse_tags( $content ) { |
|
199 | + public function parse_tags($content) { |
|
200 | 200 | return $content; |
201 | 201 | } |
202 | 202 | |
@@ -205,36 +205,36 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @since 1.0 |
207 | 207 | */ |
208 | - public function build_email( $message ) { |
|
208 | + public function build_email($message) { |
|
209 | 209 | |
210 | - if ( false === $this->html ) { |
|
211 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
210 | + if (false === $this->html) { |
|
211 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
212 | 212 | } |
213 | 213 | |
214 | - $message = $this->text_to_html( $message ); |
|
214 | + $message = $this->text_to_html($message); |
|
215 | 215 | |
216 | 216 | ob_start(); |
217 | 217 | |
218 | - give_get_template_part( 'emails/header', $this->get_template(), true ); |
|
218 | + give_get_template_part('emails/header', $this->get_template(), true); |
|
219 | 219 | |
220 | - do_action( 'give_email_header', $this ); |
|
220 | + do_action('give_email_header', $this); |
|
221 | 221 | |
222 | - if ( has_action( 'give_email_template_' . $this->get_template() ) ) { |
|
223 | - do_action( 'give_email_template_' . $this->get_template() ); |
|
222 | + if (has_action('give_email_template_'.$this->get_template())) { |
|
223 | + do_action('give_email_template_'.$this->get_template()); |
|
224 | 224 | } else { |
225 | - give_get_template_part( 'emails/body', $this->get_template(), true ); |
|
225 | + give_get_template_part('emails/body', $this->get_template(), true); |
|
226 | 226 | } |
227 | 227 | |
228 | - do_action( 'give_email_body', $this ); |
|
228 | + do_action('give_email_body', $this); |
|
229 | 229 | |
230 | - give_get_template_part( 'emails/footer', $this->get_template(), true ); |
|
230 | + give_get_template_part('emails/footer', $this->get_template(), true); |
|
231 | 231 | |
232 | - do_action( 'give_email_footer', $this ); |
|
232 | + do_action('give_email_footer', $this); |
|
233 | 233 | |
234 | 234 | $body = ob_get_clean(); |
235 | - $message = str_replace( '{email}', $message, $body ); |
|
235 | + $message = str_replace('{email}', $message, $body); |
|
236 | 236 | |
237 | - return apply_filters( 'give_email_message', $message, $this ); |
|
237 | + return apply_filters('give_email_message', $message, $this); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -247,26 +247,26 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return bool |
249 | 249 | */ |
250 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
250 | + public function send($to, $subject, $message, $attachments = '') { |
|
251 | 251 | |
252 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
253 | - _doing_it_wrong( __FUNCTION__, __( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); |
|
252 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
253 | + _doing_it_wrong(__FUNCTION__, __('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null); |
|
254 | 254 | |
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | |
258 | - do_action( 'give_email_send_before', $this ); |
|
258 | + do_action('give_email_send_before', $this); |
|
259 | 259 | |
260 | - $subject = $this->parse_tags( $subject ); |
|
261 | - $message = $this->parse_tags( $message ); |
|
260 | + $subject = $this->parse_tags($subject); |
|
261 | + $message = $this->parse_tags($message); |
|
262 | 262 | |
263 | - $message = $this->build_email( $message ); |
|
263 | + $message = $this->build_email($message); |
|
264 | 264 | |
265 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
265 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
266 | 266 | |
267 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
267 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
268 | 268 | |
269 | - do_action( 'give_email_send_after', $this ); |
|
269 | + do_action('give_email_send_after', $this); |
|
270 | 270 | |
271 | 271 | return $sent; |
272 | 272 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | * @since 1.0 |
279 | 279 | */ |
280 | 280 | public function send_before() { |
281 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
282 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
283 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
281 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
282 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
283 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | * @since 1.0 |
290 | 290 | */ |
291 | 291 | public function send_after() { |
292 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
293 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
294 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
292 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
293 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
294 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
295 | 295 | |
296 | 296 | // Reset heading to an empty string |
297 | 297 | $this->heading = ''; |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @since 1.0 |
304 | 304 | */ |
305 | - public function text_to_html( $message ) { |
|
305 | + public function text_to_html($message) { |
|
306 | 306 | |
307 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
308 | - $message = wpautop( $message ); |
|
307 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
308 | + $message = wpautop($message); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | return $message; |
@@ -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,40 +23,40 @@ discard block |
||
23 | 23 | function give_setup_post_types() { |
24 | 24 | |
25 | 25 | /** Give Forms Post Type */ |
26 | - $give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false; |
|
26 | + $give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false; |
|
27 | 27 | |
28 | - $give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false; |
|
28 | + $give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false; |
|
29 | 29 | |
30 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
30 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
31 | 31 | //support for old 'GIVE_FORMS_SLUG' constant |
32 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
32 | + if (defined('GIVE_FORMS_SLUG')) { |
|
33 | 33 | $give_forms_slug = GIVE_FORMS_SLUG; |
34 | 34 | } |
35 | 35 | |
36 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
36 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
37 | 37 | 'slug' => $give_forms_slug, |
38 | 38 | 'with_front' => false |
39 | 39 | ); |
40 | 40 | |
41 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
42 | - 'name' => __( 'Donation %2$s', 'give' ), |
|
41 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
42 | + 'name' => __('Donation %2$s', 'give'), |
|
43 | 43 | 'singular_name' => '%1$s', |
44 | - 'add_new' => __( 'Add %1$s', 'give' ), |
|
45 | - 'add_new_item' => __( 'Add New Donation %1$s', 'give' ), |
|
46 | - 'edit_item' => __( 'Edit Donation %1$s', 'give' ), |
|
47 | - 'new_item' => __( 'New %1$s', 'give' ), |
|
48 | - 'all_items' => __( 'All %2$s', 'give' ), |
|
49 | - 'view_item' => __( 'View %1$s', 'give' ), |
|
50 | - 'search_items' => __( 'Search %2$s', 'give' ), |
|
51 | - 'not_found' => __( 'No %2$s found', 'give' ), |
|
52 | - 'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ), |
|
44 | + 'add_new' => __('Add %1$s', 'give'), |
|
45 | + 'add_new_item' => __('Add New Donation %1$s', 'give'), |
|
46 | + 'edit_item' => __('Edit Donation %1$s', 'give'), |
|
47 | + 'new_item' => __('New %1$s', 'give'), |
|
48 | + 'all_items' => __('All %2$s', 'give'), |
|
49 | + 'view_item' => __('View %1$s', 'give'), |
|
50 | + 'search_items' => __('Search %2$s', 'give'), |
|
51 | + 'not_found' => __('No %2$s found', 'give'), |
|
52 | + 'not_found_in_trash' => __('No %2$s found in Trash', 'give'), |
|
53 | 53 | 'parent_item_colon' => '', |
54 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
55 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ) |
|
56 | - ) ); |
|
54 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
55 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')) |
|
56 | + )); |
|
57 | 57 | |
58 | - foreach ( $give_forms_labels as $key => $value ) { |
|
59 | - $give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() ); |
|
58 | + foreach ($give_forms_labels as $key => $value) { |
|
59 | + $give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | //Default give_forms supports |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | ); |
70 | 70 | |
71 | 71 | //Has the user disabled the excerpt |
72 | - if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) { |
|
73 | - unset( $give_form_supports[2] ); |
|
72 | + if (give_get_option('disable_forms_excerpt') === 'on') { |
|
73 | + unset($give_form_supports[2]); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | //Has user disabled the featured image? |
77 | - if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
78 | - unset( $give_form_supports[1] ); |
|
79 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
77 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
78 | + unset($give_form_supports[1]); |
|
79 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $give_forms_args = array( |
@@ -92,42 +92,42 @@ discard block |
||
92 | 92 | 'has_archive' => $give_forms_archives, |
93 | 93 | 'menu_icon' => 'dashicons-give', |
94 | 94 | 'hierarchical' => false, |
95 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
95 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
96 | 96 | ); |
97 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
97 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
98 | 98 | |
99 | 99 | /** Payment Post Type */ |
100 | 100 | $payment_labels = array( |
101 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
102 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
103 | - 'add_new' => __( 'Add New', 'give' ), |
|
104 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
105 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
106 | - 'new_item' => __( 'New Donation', 'give' ), |
|
107 | - 'all_items' => __( 'All Donations', 'give' ), |
|
108 | - 'view_item' => __( 'View Donation', 'give' ), |
|
109 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
110 | - 'not_found' => __( 'No Donations found', 'give' ), |
|
111 | - 'not_found_in_trash' => __( 'No Donations found in Trash', 'give' ), |
|
101 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
102 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
103 | + 'add_new' => __('Add New', 'give'), |
|
104 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
105 | + 'edit_item' => __('Edit Donation', 'give'), |
|
106 | + 'new_item' => __('New Donation', 'give'), |
|
107 | + 'all_items' => __('All Donations', 'give'), |
|
108 | + 'view_item' => __('View Donation', 'give'), |
|
109 | + 'search_items' => __('Search Donations', 'give'), |
|
110 | + 'not_found' => __('No Donations found', 'give'), |
|
111 | + 'not_found_in_trash' => __('No Donations found in Trash', 'give'), |
|
112 | 112 | 'parent_item_colon' => '', |
113 | - 'menu_name' => __( 'Transactions', 'give' ) |
|
113 | + 'menu_name' => __('Transactions', 'give') |
|
114 | 114 | ); |
115 | 115 | |
116 | 116 | $payment_args = array( |
117 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
117 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
118 | 118 | 'public' => false, |
119 | 119 | 'query_var' => false, |
120 | 120 | 'rewrite' => false, |
121 | 121 | 'map_meta_cap' => true, |
122 | 122 | 'capability_type' => 'give_payment', |
123 | - 'supports' => array( 'title' ), |
|
123 | + 'supports' => array('title'), |
|
124 | 124 | 'can_export' => true |
125 | 125 | ); |
126 | - register_post_type( 'give_payment', $payment_args ); |
|
126 | + register_post_type('give_payment', $payment_args); |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
130 | +add_action('init', 'give_setup_post_types', 1); |
|
131 | 131 | |
132 | 132 | |
133 | 133 | /** |
@@ -140,30 +140,30 @@ discard block |
||
140 | 140 | */ |
141 | 141 | function give_setup_taxonomies() { |
142 | 142 | |
143 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
143 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
144 | 144 | |
145 | 145 | /** Categories */ |
146 | 146 | $category_labels = array( |
147 | - 'name' => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
148 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
149 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
150 | - 'all_items' => __( 'All Categories', 'give' ), |
|
151 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
152 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
153 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
154 | - 'update_item' => __( 'Update Category', 'give' ), |
|
155 | - 'add_new_item' => sprintf( __( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ), |
|
156 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
157 | - 'menu_name' => __( 'Categories', 'give' ), |
|
147 | + 'name' => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
148 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
149 | + 'search_items' => __('Search Categories', 'give'), |
|
150 | + 'all_items' => __('All Categories', 'give'), |
|
151 | + 'parent_item' => __('Parent Category', 'give'), |
|
152 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
153 | + 'edit_item' => __('Edit Category', 'give'), |
|
154 | + 'update_item' => __('Update Category', 'give'), |
|
155 | + 'add_new_item' => sprintf(__('Add New %s Category', 'give'), give_get_forms_label_singular()), |
|
156 | + 'new_item_name' => __('New Category Name', 'give'), |
|
157 | + 'menu_name' => __('Categories', 'give'), |
|
158 | 158 | ); |
159 | 159 | |
160 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
160 | + $category_args = apply_filters('give_forms_category_args', array( |
|
161 | 161 | 'hierarchical' => true, |
162 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
162 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
163 | 163 | 'show_ui' => true, |
164 | 164 | 'query_var' => 'give_forms_category', |
165 | 165 | 'rewrite' => array( |
166 | - 'slug' => $slug . '/category', |
|
166 | + 'slug' => $slug.'/category', |
|
167 | 167 | 'with_front' => false, |
168 | 168 | 'hierarchical' => true |
169 | 169 | ), |
@@ -177,34 +177,34 @@ discard block |
||
177 | 177 | ); |
178 | 178 | |
179 | 179 | //Does the user want categories? |
180 | - if ( give_get_option( 'enable_categories' ) == 'on' ) { |
|
181 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
182 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
180 | + if (give_get_option('enable_categories') == 'on') { |
|
181 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
182 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
186 | 186 | /** Tags */ |
187 | 187 | $tag_labels = array( |
188 | - 'name' => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
189 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
190 | - 'search_items' => __( 'Search Tags', 'give' ), |
|
191 | - 'all_items' => __( 'All Tags', 'give' ), |
|
192 | - 'parent_item' => __( 'Parent Tag', 'give' ), |
|
193 | - 'parent_item_colon' => __( 'Parent Tag:', 'give' ), |
|
194 | - 'edit_item' => __( 'Edit Tag', 'give' ), |
|
195 | - 'update_item' => __( 'Update Tag', 'give' ), |
|
196 | - 'add_new_item' => __( 'Add New Tag', 'give' ), |
|
197 | - 'new_item_name' => __( 'New Tag Name', 'give' ), |
|
198 | - 'menu_name' => __( 'Tags', 'give' ), |
|
199 | - 'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags.', 'give' ), give_get_forms_label_singular() ), |
|
188 | + 'name' => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
189 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
190 | + 'search_items' => __('Search Tags', 'give'), |
|
191 | + 'all_items' => __('All Tags', 'give'), |
|
192 | + 'parent_item' => __('Parent Tag', 'give'), |
|
193 | + 'parent_item_colon' => __('Parent Tag:', 'give'), |
|
194 | + 'edit_item' => __('Edit Tag', 'give'), |
|
195 | + 'update_item' => __('Update Tag', 'give'), |
|
196 | + 'add_new_item' => __('Add New Tag', 'give'), |
|
197 | + 'new_item_name' => __('New Tag Name', 'give'), |
|
198 | + 'menu_name' => __('Tags', 'give'), |
|
199 | + 'choose_from_most_used' => sprintf(__('Choose from most used %s tags.', 'give'), give_get_forms_label_singular()), |
|
200 | 200 | ); |
201 | 201 | |
202 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
202 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
203 | 203 | 'hierarchical' => false, |
204 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
204 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
205 | 205 | 'show_ui' => true, |
206 | 206 | 'query_var' => 'give_forms_tag', |
207 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
207 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
208 | 208 | 'capabilities' => array( |
209 | 209 | 'manage_terms' => 'manage_give_forms_terms', |
210 | 210 | 'edit_terms' => 'edit_give_forms_terms', |
@@ -215,15 +215,15 @@ discard block |
||
215 | 215 | ) |
216 | 216 | ); |
217 | 217 | |
218 | - if ( give_get_option( 'enable_tags' ) == 'on' ) { |
|
219 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
220 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
218 | + if (give_get_option('enable_tags') == 'on') { |
|
219 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
220 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
224 | 224 | } |
225 | 225 | |
226 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
226 | +add_action('init', 'give_setup_taxonomies', 0); |
|
227 | 227 | |
228 | 228 | |
229 | 229 | /** |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | */ |
235 | 235 | function give_get_default_form_labels() { |
236 | 236 | $defaults = array( |
237 | - 'singular' => __( 'Form', 'give' ), |
|
238 | - 'plural' => __( 'Forms', 'give' ) |
|
237 | + 'singular' => __('Form', 'give'), |
|
238 | + 'plural' => __('Forms', 'give') |
|
239 | 239 | ); |
240 | 240 | |
241 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
241 | + return apply_filters('give_default_form_name', $defaults); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return string $defaults['singular'] Singular label |
252 | 252 | */ |
253 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
253 | +function give_get_forms_label_singular($lowercase = false) { |
|
254 | 254 | $defaults = give_get_default_form_labels(); |
255 | 255 | |
256 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
256 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | * @since 1.0 |
263 | 263 | * @return string $defaults['plural'] Plural label |
264 | 264 | */ |
265 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
265 | +function give_get_forms_label_plural($lowercase = false) { |
|
266 | 266 | $defaults = give_get_default_form_labels(); |
267 | 267 | |
268 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
268 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -277,26 +277,26 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return string $title New placeholder text |
279 | 279 | */ |
280 | -function give_change_default_title( $title ) { |
|
280 | +function give_change_default_title($title) { |
|
281 | 281 | // If a frontend plugin uses this filter (check extensions before changing this function) |
282 | - if ( ! is_admin() ) { |
|
282 | + if ( ! is_admin()) { |
|
283 | 283 | $label = give_get_forms_label_singular(); |
284 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
284 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
285 | 285 | |
286 | 286 | return $title; |
287 | 287 | } |
288 | 288 | |
289 | 289 | $screen = get_current_screen(); |
290 | 290 | |
291 | - if ( 'give_forms' == $screen->post_type ) { |
|
291 | + if ('give_forms' == $screen->post_type) { |
|
292 | 292 | $label = give_get_forms_label_singular(); |
293 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
293 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | return $title; |
297 | 297 | } |
298 | 298 | |
299 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
299 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Registers Custom Post Statuses which are used by the Payments |
@@ -306,50 +306,50 @@ discard block |
||
306 | 306 | */ |
307 | 307 | function give_register_post_type_statuses() { |
308 | 308 | // Payment Statuses |
309 | - register_post_status( 'refunded', array( |
|
310 | - 'label' => _x( 'Refunded', 'Refunded payment status', 'give' ), |
|
309 | + register_post_status('refunded', array( |
|
310 | + 'label' => _x('Refunded', 'Refunded payment status', 'give'), |
|
311 | 311 | 'public' => true, |
312 | 312 | 'exclude_from_search' => false, |
313 | 313 | 'show_in_admin_all_list' => true, |
314 | 314 | 'show_in_admin_status_list' => true, |
315 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ) |
|
316 | - ) ); |
|
317 | - register_post_status( 'failed', array( |
|
318 | - 'label' => _x( 'Failed', 'Failed payment status', 'give' ), |
|
315 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give') |
|
316 | + )); |
|
317 | + register_post_status('failed', array( |
|
318 | + 'label' => _x('Failed', 'Failed payment status', 'give'), |
|
319 | 319 | 'public' => true, |
320 | 320 | 'exclude_from_search' => false, |
321 | 321 | 'show_in_admin_all_list' => true, |
322 | 322 | 'show_in_admin_status_list' => true, |
323 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ) |
|
324 | - ) ); |
|
325 | - register_post_status( 'revoked', array( |
|
326 | - 'label' => _x( 'Revoked', 'Revoked payment status', 'give' ), |
|
323 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give') |
|
324 | + )); |
|
325 | + register_post_status('revoked', array( |
|
326 | + 'label' => _x('Revoked', 'Revoked payment status', 'give'), |
|
327 | 327 | 'public' => true, |
328 | 328 | 'exclude_from_search' => false, |
329 | 329 | 'show_in_admin_all_list' => true, |
330 | 330 | 'show_in_admin_status_list' => true, |
331 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ) |
|
332 | - ) ); |
|
333 | - register_post_status( 'cancelled', array( |
|
334 | - 'label' => _x( 'Cancelled', 'Cancelled payment status', 'give' ), |
|
331 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give') |
|
332 | + )); |
|
333 | + register_post_status('cancelled', array( |
|
334 | + 'label' => _x('Cancelled', 'Cancelled payment status', 'give'), |
|
335 | 335 | 'public' => true, |
336 | 336 | 'exclude_from_search' => false, |
337 | 337 | 'show_in_admin_all_list' => true, |
338 | 338 | 'show_in_admin_status_list' => true, |
339 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ) |
|
340 | - ) ); |
|
341 | - register_post_status( 'abandoned', array( |
|
342 | - 'label' => _x( 'Abandoned', 'Abandoned payment status', 'give' ), |
|
339 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give') |
|
340 | + )); |
|
341 | + register_post_status('abandoned', array( |
|
342 | + 'label' => _x('Abandoned', 'Abandoned payment status', 'give'), |
|
343 | 343 | 'public' => true, |
344 | 344 | 'exclude_from_search' => false, |
345 | 345 | 'show_in_admin_all_list' => true, |
346 | 346 | 'show_in_admin_status_list' => true, |
347 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ) |
|
348 | - ) ); |
|
347 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give') |
|
348 | + )); |
|
349 | 349 | |
350 | 350 | } |
351 | 351 | |
352 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
352 | +add_action('init', 'give_register_post_type_statuses'); |
|
353 | 353 | |
354 | 354 | /** |
355 | 355 | * Updated Messages |
@@ -362,43 +362,43 @@ discard block |
||
362 | 362 | * |
363 | 363 | * @return array $messages New post updated messages |
364 | 364 | */ |
365 | -function give_updated_messages( $messages ) { |
|
365 | +function give_updated_messages($messages) { |
|
366 | 366 | global $post, $post_ID; |
367 | 367 | |
368 | - $url1 = '<a href="' . get_permalink( $post_ID ) . '">'; |
|
368 | + $url1 = '<a href="'.get_permalink($post_ID).'">'; |
|
369 | 369 | $url2 = give_get_forms_label_singular(); |
370 | 370 | $url3 = '</a>'; |
371 | 371 | |
372 | 372 | $messages['give_forms'] = array( |
373 | - 1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
374 | - 4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
375 | - 6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
376 | - 7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
377 | - 8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ) |
|
373 | + 1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
374 | + 4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
375 | + 6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
376 | + 7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
377 | + 8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3) |
|
378 | 378 | ); |
379 | 379 | |
380 | 380 | return $messages; |
381 | 381 | } |
382 | 382 | |
383 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
383 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
384 | 384 | |
385 | 385 | |
386 | 386 | /** |
387 | 387 | * Setup Post Type Images |
388 | 388 | */ |
389 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
389 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
390 | 390 | |
391 | 391 | /** |
392 | 392 | * Ensure post thumbnail support is turned on |
393 | 393 | */ |
394 | 394 | function give_add_thumbnail_support() { |
395 | - if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
395 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
396 | 396 | return; |
397 | 397 | } |
398 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
399 | - add_theme_support( 'post-thumbnails' ); |
|
398 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
399 | + add_theme_support('post-thumbnails'); |
|
400 | 400 | } |
401 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
401 | + add_post_type_support('give_forms', 'thumbnail'); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
@@ -410,19 +410,19 @@ discard block |
||
410 | 410 | function give_widgets_init() { |
411 | 411 | |
412 | 412 | //Single Give Forms (disabled if single turned off in settings) |
413 | - if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) { |
|
413 | + if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') { |
|
414 | 414 | |
415 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
416 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
415 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
416 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
417 | 417 | 'id' => 'give-forms-sidebar', |
418 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
418 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
419 | 419 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
420 | 420 | 'after_widget' => '</div>', |
421 | 421 | 'before_title' => '<h3 class="widgettitle widget-title">', |
422 | 422 | 'after_title' => '</h3>', |
423 | - ) ) ); |
|
423 | + ))); |
|
424 | 424 | |
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
428 | +add_action('widgets_init', 'give_widgets_init', 999); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | 32 | |
33 | 33 | // Make sure that payments are only completed once |
34 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
34 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Make sure the payment completion is only processed when new status is complete |
39 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
39 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $payment = new Give_Payment( $payment_id ); |
|
43 | + $payment = new Give_Payment($payment_id); |
|
44 | 44 | |
45 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
45 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
46 | 46 | $payment_meta = $payment->payment_meta; |
47 | 47 | $completed_date = $payment->completed_date; |
48 | 48 | $user_info = $payment->user_info; |
@@ -51,45 +51,45 @@ discard block |
||
51 | 51 | $price_id = $payment->price_id; |
52 | 52 | $form_id = $payment->form_id; |
53 | 53 | |
54 | - do_action( 'give_pre_complete_purchase', $payment_id ); |
|
54 | + do_action('give_pre_complete_purchase', $payment_id); |
|
55 | 55 | |
56 | 56 | // Ensure these actions only run once, ever |
57 | - if ( empty( $completed_date ) ) { |
|
57 | + if (empty($completed_date)) { |
|
58 | 58 | |
59 | - give_record_sale_in_log( $form_id, $payment_id, $price_id, $creation_date ); |
|
60 | - do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta ); |
|
59 | + give_record_sale_in_log($form_id, $payment_id, $price_id, $creation_date); |
|
60 | + do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta); |
|
61 | 61 | |
62 | 62 | } |
63 | 63 | |
64 | 64 | // Increase the earnings for this form ID |
65 | - give_increase_earnings( $form_id, $amount ); |
|
66 | - give_increase_purchase_count( $form_id ); |
|
65 | + give_increase_earnings($form_id, $amount); |
|
66 | + give_increase_purchase_count($form_id); |
|
67 | 67 | |
68 | 68 | // Clear the total earnings cache |
69 | - delete_transient( 'give_earnings_total' ); |
|
69 | + delete_transient('give_earnings_total'); |
|
70 | 70 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
71 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
72 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
71 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
72 | + delete_transient(md5('give_earnings_todaytoday')); |
|
73 | 73 | |
74 | 74 | // Increase the donor's purchase stats |
75 | - $customer = new Give_Customer( $customer_id ); |
|
75 | + $customer = new Give_Customer($customer_id); |
|
76 | 76 | $customer->increase_purchase_count(); |
77 | - $customer->increase_value( $amount ); |
|
77 | + $customer->increase_value($amount); |
|
78 | 78 | |
79 | - give_increase_total_earnings( $amount ); |
|
79 | + give_increase_total_earnings($amount); |
|
80 | 80 | |
81 | 81 | // Ensure this action only runs once ever |
82 | - if ( empty( $completed_date ) ) { |
|
82 | + if (empty($completed_date)) { |
|
83 | 83 | |
84 | 84 | // Save the completed date |
85 | - $payment->completed_date = current_time( 'mysql' ); |
|
85 | + $payment->completed_date = current_time('mysql'); |
|
86 | 86 | $payment->save(); |
87 | - do_action( 'give_complete_purchase', $payment_id ); |
|
87 | + do_action('give_complete_purchase', $payment_id); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | } |
91 | 91 | |
92 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
92 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
93 | 93 | |
94 | 94 | |
95 | 95 | /** |
@@ -103,19 +103,19 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return void |
105 | 105 | */ |
106 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
106 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
107 | 107 | |
108 | 108 | // Get the list of statuses so that status in the payment note can be translated |
109 | 109 | $stati = give_get_payment_statuses(); |
110 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
111 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
110 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
111 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
112 | 112 | |
113 | - $status_change = sprintf( __( 'Status changed from %s to %s.', 'give' ), $old_status, $new_status ); |
|
113 | + $status_change = sprintf(__('Status changed from %s to %s.', 'give'), $old_status, $new_status); |
|
114 | 114 | |
115 | - give_insert_payment_note( $payment_id, $status_change ); |
|
115 | + give_insert_payment_note($payment_id, $status_change); |
|
116 | 116 | } |
117 | 117 | |
118 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
118 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
119 | 119 | |
120 | 120 | |
121 | 121 | /** |
@@ -128,17 +128,17 @@ discard block |
||
128 | 128 | * @param $new_status the status of the payment, probably "publish" |
129 | 129 | * @param $old_status the status of the payment prior to being marked as "complete", probably "pending" |
130 | 130 | */ |
131 | -function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) { |
|
131 | +function give_clear_user_history_cache($payment_id, $new_status, $old_status) { |
|
132 | 132 | |
133 | - $payment = new Give_Payment( $payment_id ); |
|
133 | + $payment = new Give_Payment($payment_id); |
|
134 | 134 | |
135 | - if ( ! empty( $payment->user_id ) ) { |
|
136 | - delete_transient( 'give_user_' . $payment->user_id . '_purchases' ); |
|
135 | + if ( ! empty($payment->user_id)) { |
|
136 | + delete_transient('give_user_'.$payment->user_id.'_purchases'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | } |
140 | 140 | |
141 | -add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 ); |
|
141 | +add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3); |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * Updates all old payments, prior to 1.2, with new |
@@ -152,25 +152,25 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return void |
154 | 154 | */ |
155 | -function give_update_old_payments_with_totals( $data ) { |
|
156 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
155 | +function give_update_old_payments_with_totals($data) { |
|
156 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
160 | + if (get_option('give_payment_totals_upgraded')) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 | |
164 | - $payments = give_get_payments( array( |
|
164 | + $payments = give_get_payments(array( |
|
165 | 165 | 'offset' => 0, |
166 | - 'number' => - 1, |
|
166 | + 'number' => -1, |
|
167 | 167 | 'mode' => 'all' |
168 | - ) ); |
|
168 | + )); |
|
169 | 169 | |
170 | - if ( $payments ) { |
|
171 | - foreach ( $payments as $payment ) { |
|
170 | + if ($payments) { |
|
171 | + foreach ($payments as $payment) { |
|
172 | 172 | |
173 | - $payment = new Give_Payment( $payment->ID ); |
|
173 | + $payment = new Give_Payment($payment->ID); |
|
174 | 174 | $meta = $payment->get_meta(); |
175 | 175 | |
176 | 176 | $payment->total = $meta['amount']; |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
182 | + add_option('give_payment_totals_upgraded', 1); |
|
183 | 183 | } |
184 | 184 | |
185 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
185 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Updates week-old+ 'pending' orders to 'abandoned' |
@@ -193,21 +193,21 @@ discard block |
||
193 | 193 | function give_mark_abandoned_donations() { |
194 | 194 | $args = array( |
195 | 195 | 'status' => 'pending', |
196 | - 'number' => - 1, |
|
196 | + 'number' => -1, |
|
197 | 197 | 'output' => 'give_payments', |
198 | 198 | ); |
199 | 199 | |
200 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
200 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
201 | 201 | |
202 | - $payments = give_get_payments( $args ); |
|
202 | + $payments = give_get_payments($args); |
|
203 | 203 | |
204 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
204 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
205 | 205 | |
206 | - if ( $payments ) { |
|
207 | - foreach ( $payments as $payment ) { |
|
208 | - $gateway = give_get_payment_gateway( $payment ); |
|
206 | + if ($payments) { |
|
207 | + foreach ($payments as $payment) { |
|
208 | + $gateway = give_get_payment_gateway($payment); |
|
209 | 209 | //Skip offline gateway payments |
210 | - if ( $gateway == 'offline' ) { |
|
210 | + if ($gateway == 'offline') { |
|
211 | 211 | continue; |
212 | 212 | } |
213 | 213 | $payment->status = 'abandoned'; |
@@ -216,4 +216,4 @@ discard block |
||
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
220 | 219 | \ No newline at end of file |
220 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
|
221 | 221 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class Give_Shortcode_Donation_Form |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = __( 'Donation Form', 'give' ); |
|
25 | - $this->shortcode['label'] = __( 'Donation Form', 'give' ); |
|
24 | + $this->shortcode['title'] = __('Donation Form', 'give'); |
|
25 | + $this->shortcode['label'] = __('Donation Form', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_form' ); |
|
27 | + parent::__construct('give_form'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | public function define_fields() { |
36 | 36 | |
37 | 37 | $create_form_link = sprintf( |
38 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
39 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
38 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
39 | + admin_url('post-new.php?post_type=give_forms') |
|
40 | 40 | ); |
41 | 41 | |
42 | 42 | return array( |
@@ -46,68 +46,68 @@ discard block |
||
46 | 46 | 'post_type' => 'give_forms', |
47 | 47 | ), |
48 | 48 | 'name' => 'id', |
49 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
50 | - 'placeholder' => __( '- Select a Form -', 'give' ), |
|
49 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
50 | + 'placeholder' => __('- Select a Form -', 'give'), |
|
51 | 51 | 'required' => array( |
52 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
53 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
52 | + 'alert' => __('You must first select a Form!', 'give'), |
|
53 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
54 | 54 | ), |
55 | 55 | ), |
56 | 56 | array( |
57 | 57 | 'type' => 'container', |
58 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional form settings', 'give' ) ), |
|
58 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional form settings', 'give')), |
|
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'listbox', |
62 | 62 | 'name' => 'show_title', |
63 | - 'label' => __( 'Show Title:', 'give' ), |
|
64 | - 'tooltip' => __( 'Do you want to display the form title?', 'give' ), |
|
63 | + 'label' => __('Show Title:', 'give'), |
|
64 | + 'tooltip' => __('Do you want to display the form title?', 'give'), |
|
65 | 65 | 'options' => array( |
66 | - 'true' => __( 'Show', 'give' ), |
|
67 | - 'false' => __( 'Hide', 'give' ), |
|
66 | + 'true' => __('Show', 'give'), |
|
67 | + 'false' => __('Hide', 'give'), |
|
68 | 68 | ), |
69 | 69 | ), |
70 | 70 | array( |
71 | 71 | 'type' => 'listbox', |
72 | 72 | 'name' => 'show_goal', |
73 | - 'label' => __( 'Show Goal:', 'give' ), |
|
74 | - 'tooltip' => __( 'Do you want to display the donation goal?', 'give' ), |
|
73 | + 'label' => __('Show Goal:', 'give'), |
|
74 | + 'tooltip' => __('Do you want to display the donation goal?', 'give'), |
|
75 | 75 | 'options' => array( |
76 | - 'true' => __( 'Show', 'give' ), |
|
77 | - 'false' => __( 'Hide', 'give' ), |
|
76 | + 'true' => __('Show', 'give'), |
|
77 | + 'false' => __('Hide', 'give'), |
|
78 | 78 | ), |
79 | 79 | ), |
80 | 80 | array( |
81 | 81 | 'type' => 'listbox', |
82 | 82 | 'name' => 'show_content', |
83 | 83 | 'minWidth' => 240, |
84 | - 'label' => __( 'Display Content:', 'give' ), |
|
85 | - 'tooltip' => __( 'Do you want to display the form content?', 'give' ), |
|
84 | + 'label' => __('Display Content:', 'give'), |
|
85 | + 'tooltip' => __('Do you want to display the form content?', 'give'), |
|
86 | 86 | 'options' => array( |
87 | - 'none' => __( 'No Content', 'give' ), |
|
88 | - 'above' => __( 'Display above the form fields', 'give' ), |
|
89 | - 'below' => __( 'Display below the form fields', 'give' ), |
|
87 | + 'none' => __('No Content', 'give'), |
|
88 | + 'above' => __('Display above the form fields', 'give'), |
|
89 | + 'below' => __('Display below the form fields', 'give'), |
|
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | array( |
93 | 93 | 'type' => 'listbox', |
94 | 94 | 'name' => 'display_style', |
95 | - 'label' => __( 'Payment Fields:', 'give' ), |
|
96 | - 'tooltip' => __( 'How would you like to display payment information?', 'give' ), |
|
95 | + 'label' => __('Payment Fields:', 'give'), |
|
96 | + 'tooltip' => __('How would you like to display payment information?', 'give'), |
|
97 | 97 | 'options' => array( |
98 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
99 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
100 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
98 | + 'onpage' => __('Show on Page', 'give'), |
|
99 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
100 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
101 | 101 | ), |
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'type' => 'listbox', |
105 | 105 | 'name' => 'float_labels', |
106 | - 'label' => __( 'Floating Labels:', 'give' ), |
|
107 | - 'tooltip' => __( 'Override the default floating labels setting for this form?', 'give' ), |
|
106 | + 'label' => __('Floating Labels:', 'give'), |
|
107 | + 'tooltip' => __('Override the default floating labels setting for this form?', 'give'), |
|
108 | 108 | 'options' => array( |
109 | - 'enabled' => __( 'Enabled', 'give' ), |
|
110 | - 'disabled' => __( 'Disabled', 'give' ), |
|
109 | + 'enabled' => __('Enabled', 'give'), |
|
110 | + 'disabled' => __('Disabled', 'give'), |
|
111 | 111 | ), |
112 | 112 | ), |
113 | 113 | ); |