@@ -7,22 +7,22 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Print the email header. |
13 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
13 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
14 | 14 | |
15 | 15 | // Generate the custom message body. |
16 | 16 | echo $message_body; |
17 | 17 | |
18 | 18 | // Print invoice details. |
19 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
19 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
20 | 20 | |
21 | 21 | // Print invoice items. |
22 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
22 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
23 | 23 | |
24 | 24 | // Print the billing details. |
25 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
25 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
26 | 26 | |
27 | 27 | // Print the email footer. |
28 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
28 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
@@ -7,22 +7,22 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Print the email header. |
13 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
13 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
14 | 14 | |
15 | 15 | // Generate the custom message body. |
16 | 16 | echo $message_body; |
17 | 17 | |
18 | 18 | // Print invoice details. |
19 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
19 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
20 | 20 | |
21 | 21 | // Print invoice items. |
22 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
22 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
23 | 23 | |
24 | 24 | // Print the billing details. |
25 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
25 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
26 | 26 | |
27 | 27 | // Print the email footer. |
28 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
28 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
@@ -7,21 +7,21 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
12 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
13 | 13 | |
14 | -do_action( 'wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
14 | +do_action('wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
15 | 15 | |
16 | 16 | // Generate the custom message body. |
17 | -$message_body = wptexturize( wp_kses_post( str_replace( '{customer_note}', $customer_note, $message_body ) ) ); |
|
17 | +$message_body = wptexturize(wp_kses_post(str_replace('{customer_note}', $customer_note, $message_body))); |
|
18 | 18 | |
19 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
19 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
20 | 20 | |
21 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
21 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
22 | 22 | |
23 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
23 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
24 | 24 | |
25 | -do_action( 'wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
25 | +do_action('wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
26 | 26 | |
27 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
28 | 27 | \ No newline at end of file |
28 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
29 | 29 | \ No newline at end of file |
@@ -13,36 +13,36 @@ discard block |
||
13 | 13 | class GetPaid_Notification_Email { |
14 | 14 | |
15 | 15 | /** |
16 | - * Contains the type of this notification email. |
|
17 | - * |
|
18 | - * @var string |
|
19 | - */ |
|
16 | + * Contains the type of this notification email. |
|
17 | + * |
|
18 | + * @var string |
|
19 | + */ |
|
20 | 20 | public $id; |
21 | 21 | |
22 | 22 | /** |
23 | - * Contains any object to use in filters. |
|
24 | - * |
|
25 | - * @var false|WPInv_Invoice|WPInv_Item|WPInv_Subscription |
|
26 | - */ |
|
23 | + * Contains any object to use in filters. |
|
24 | + * |
|
25 | + * @var false|WPInv_Invoice|WPInv_Item|WPInv_Subscription |
|
26 | + */ |
|
27 | 27 | public $object; |
28 | 28 | |
29 | 29 | /** |
30 | - * Class constructor. |
|
31 | - * |
|
30 | + * Class constructor. |
|
31 | + * |
|
32 | 32 | * @param string $id Email Type. |
33 | 33 | * @param mixed $object Optional. Associated object. |
34 | - */ |
|
35 | - public function __construct( $id, $object = false ) { |
|
34 | + */ |
|
35 | + public function __construct( $id, $object = false ) { |
|
36 | 36 | $this->id = $id; |
37 | 37 | $this->object = $object; |
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * Retrieves an option |
|
42 | - * |
|
41 | + * Retrieves an option |
|
42 | + * |
|
43 | 43 | * @return mixed |
44 | - */ |
|
45 | - public function get_option( $key ) { |
|
44 | + */ |
|
45 | + public function get_option( $key ) { |
|
46 | 46 | |
47 | 47 | $key = "email_{$this->id}_$key"; |
48 | 48 | $value = wpinv_get_option( $key, null ); |
@@ -61,80 +61,80 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * Retrieves the email body. |
|
65 | - * |
|
64 | + * Retrieves the email body. |
|
65 | + * |
|
66 | 66 | * @return string |
67 | - */ |
|
68 | - public function get_body() { |
|
67 | + */ |
|
68 | + public function get_body() { |
|
69 | 69 | $body = $this->get_option( 'body' ); |
70 | 70 | return apply_filters( 'getpaid_get_email_body', $body, $this->id, $this->object ); |
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | - * Retrieves the email subject. |
|
75 | - * |
|
74 | + * Retrieves the email subject. |
|
75 | + * |
|
76 | 76 | * @return string |
77 | - */ |
|
78 | - public function get_subject() { |
|
77 | + */ |
|
78 | + public function get_subject() { |
|
79 | 79 | $subject = $this->get_option( 'subject' ); |
80 | 80 | return apply_filters( 'getpaid_get_email_subject', $subject, $this->id, $this->object ); |
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | - * Retrieves the email heading. |
|
85 | - * |
|
84 | + * Retrieves the email heading. |
|
85 | + * |
|
86 | 86 | * @return string |
87 | - */ |
|
88 | - public function get_heading() { |
|
87 | + */ |
|
88 | + public function get_heading() { |
|
89 | 89 | $heading = $this->get_option( 'heading' ); |
90 | 90 | return apply_filters( 'getpaid_get_email_heading', $heading, $this->id, $this->object ); |
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | - * Checks if an email is active. |
|
95 | - * |
|
94 | + * Checks if an email is active. |
|
95 | + * |
|
96 | 96 | * @return bool |
97 | - */ |
|
98 | - public function is_active() { |
|
97 | + */ |
|
98 | + public function is_active() { |
|
99 | 99 | $is_active = ! empty( $this->get_option( 'is_active' ) ); |
100 | 100 | return apply_filters( 'getpaid_email_type_is_active', $is_active, $this->id, $this->object ); |
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | - * Checks if the site's admin should receive email notifications. |
|
105 | - * |
|
104 | + * Checks if the site's admin should receive email notifications. |
|
105 | + * |
|
106 | 106 | * @return bool |
107 | - */ |
|
108 | - public function include_admin_bcc() { |
|
107 | + */ |
|
108 | + public function include_admin_bcc() { |
|
109 | 109 | $include_admin_bcc = ! empty( $this->get_option( 'admin_bcc' ) ); |
110 | 110 | return apply_filters( 'getpaid_email_type_include_admin_bcc', $include_admin_bcc, $this->id, $this->object ); |
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | - * Checks whether this email should be sent to the customer or admin. |
|
115 | - * |
|
114 | + * Checks whether this email should be sent to the customer or admin. |
|
115 | + * |
|
116 | 116 | * @return bool |
117 | - */ |
|
118 | - public function is_admin_email() { |
|
117 | + */ |
|
118 | + public function is_admin_email() { |
|
119 | 119 | $is_admin_email = in_array( $this->id, array( 'new_invoice', 'cancelled_invoice', 'failed_invoice' ) ); |
120 | 120 | return apply_filters( 'getpaid_email_type_is_admin_email', $is_admin_email, $this->id, $this->object ); |
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
124 | - * Returns email attachments. |
|
125 | - * |
|
124 | + * Returns email attachments. |
|
125 | + * |
|
126 | 126 | * @return array |
127 | - */ |
|
128 | - public function get_attachments() { |
|
127 | + */ |
|
128 | + public function get_attachments() { |
|
129 | 129 | return apply_filters( 'getpaid_get_email_attachments', array(), $this->id, $this->object ); |
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
133 | - * Returns an array of merge tags. |
|
134 | - * |
|
133 | + * Returns an array of merge tags. |
|
134 | + * |
|
135 | 135 | * @return array |
136 | - */ |
|
137 | - public function get_merge_tags() { |
|
136 | + */ |
|
137 | + public function get_merge_tags() { |
|
138 | 138 | |
139 | 139 | $merge_tags = array( |
140 | 140 | '{site_title}' => wpinv_get_blogname(), |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | - * Adds merge tags to a text. |
|
149 | - * |
|
148 | + * Adds merge tags to a text. |
|
149 | + * |
|
150 | 150 | * @param string string $text |
151 | 151 | * @param array $merge_tags |
152 | 152 | * @return string |
153 | - */ |
|
154 | - public function add_merge_tags( $text, $merge_tags = array() ) { |
|
153 | + */ |
|
154 | + public function add_merge_tags( $text, $merge_tags = array() ) { |
|
155 | 155 | |
156 | 156 | foreach ( $merge_tags as $key => $value ) { |
157 | 157 | $text = str_replace( $key, $value, $text ); |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
164 | - * Returns the email content |
|
165 | - * |
|
164 | + * Returns the email content |
|
165 | + * |
|
166 | 166 | * @param array $merge_tags |
167 | 167 | * @param array $extra_args Extra template args |
168 | 168 | * @return string |
169 | - */ |
|
170 | - public function get_content( $merge_tags = array(), $extra_args = array() ) { |
|
169 | + */ |
|
170 | + public function get_content( $merge_tags = array(), $extra_args = array() ) { |
|
171 | 171 | |
172 | 172 | $content = wpinv_get_template_html( |
173 | 173 | "emails/wpinv-email-{$this->id}.php", |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Represents a single email type. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param string $id Email Type. |
33 | 33 | * @param mixed $object Optional. Associated object. |
34 | 34 | */ |
35 | - public function __construct( $id, $object = false ) { |
|
35 | + public function __construct($id, $object = false) { |
|
36 | 36 | $this->id = $id; |
37 | 37 | $this->object = $object; |
38 | 38 | } |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return mixed |
44 | 44 | */ |
45 | - public function get_option( $key ) { |
|
45 | + public function get_option($key) { |
|
46 | 46 | |
47 | 47 | $key = "email_{$this->id}_$key"; |
48 | - $value = wpinv_get_option( $key, null ); |
|
48 | + $value = wpinv_get_option($key, null); |
|
49 | 49 | |
50 | - if ( is_null( $value ) ) { |
|
50 | + if (is_null($value)) { |
|
51 | 51 | $options = wpinv_get_emails(); |
52 | 52 | |
53 | - if ( ! isset( $options[ $this->id ] ) || ! isset( $options[ $this->id ][ $key ] ) ) { |
|
53 | + if (!isset($options[$this->id]) || !isset($options[$this->id][$key])) { |
|
54 | 54 | return ''; |
55 | 55 | } |
56 | 56 | |
57 | - $value = isset( $options[ $this->id ][ $key ]['std'] ) ? $options[ $this->id ][ $key ]['std'] : ''; |
|
57 | + $value = isset($options[$this->id][$key]['std']) ? $options[$this->id][$key]['std'] : ''; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $value; |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @return string |
67 | 67 | */ |
68 | 68 | public function get_body() { |
69 | - $body = $this->get_option( 'body' ); |
|
70 | - return apply_filters( 'getpaid_get_email_body', $body, $this->id, $this->object ); |
|
69 | + $body = $this->get_option('body'); |
|
70 | + return apply_filters('getpaid_get_email_body', $body, $this->id, $this->object); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @return string |
77 | 77 | */ |
78 | 78 | public function get_subject() { |
79 | - $subject = $this->get_option( 'subject' ); |
|
80 | - return apply_filters( 'getpaid_get_email_subject', $subject, $this->id, $this->object ); |
|
79 | + $subject = $this->get_option('subject'); |
|
80 | + return apply_filters('getpaid_get_email_subject', $subject, $this->id, $this->object); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @return string |
87 | 87 | */ |
88 | 88 | public function get_heading() { |
89 | - $heading = $this->get_option( 'heading' ); |
|
90 | - return apply_filters( 'getpaid_get_email_heading', $heading, $this->id, $this->object ); |
|
89 | + $heading = $this->get_option('heading'); |
|
90 | + return apply_filters('getpaid_get_email_heading', $heading, $this->id, $this->object); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * @return bool |
97 | 97 | */ |
98 | 98 | public function is_active() { |
99 | - $is_active = ! empty( $this->get_option( 'is_active' ) ); |
|
100 | - return apply_filters( 'getpaid_email_type_is_active', $is_active, $this->id, $this->object ); |
|
99 | + $is_active = !empty($this->get_option('is_active')); |
|
100 | + return apply_filters('getpaid_email_type_is_active', $is_active, $this->id, $this->object); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * @return bool |
107 | 107 | */ |
108 | 108 | public function include_admin_bcc() { |
109 | - $include_admin_bcc = ! empty( $this->get_option( 'admin_bcc' ) ); |
|
110 | - return apply_filters( 'getpaid_email_type_include_admin_bcc', $include_admin_bcc, $this->id, $this->object ); |
|
109 | + $include_admin_bcc = !empty($this->get_option('admin_bcc')); |
|
110 | + return apply_filters('getpaid_email_type_include_admin_bcc', $include_admin_bcc, $this->id, $this->object); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @return bool |
117 | 117 | */ |
118 | 118 | public function is_admin_email() { |
119 | - $is_admin_email = in_array( $this->id, array( 'new_invoice', 'cancelled_invoice', 'failed_invoice' ) ); |
|
120 | - return apply_filters( 'getpaid_email_type_is_admin_email', $is_admin_email, $this->id, $this->object ); |
|
119 | + $is_admin_email = in_array($this->id, array('new_invoice', 'cancelled_invoice', 'failed_invoice')); |
|
120 | + return apply_filters('getpaid_email_type_is_admin_email', $is_admin_email, $this->id, $this->object); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @return array |
127 | 127 | */ |
128 | 128 | public function get_attachments() { |
129 | - return apply_filters( 'getpaid_get_email_attachments', array(), $this->id, $this->object ); |
|
129 | + return apply_filters('getpaid_get_email_attachments', array(), $this->id, $this->object); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | |
139 | 139 | $merge_tags = array( |
140 | 140 | '{site_title}' => wpinv_get_blogname(), |
141 | - '{date}' => date_i18n( get_option( 'date_format' ), current_time( 'timestamp' ) ), |
|
141 | + '{date}' => date_i18n(get_option('date_format'), current_time('timestamp')), |
|
142 | 142 | ); |
143 | 143 | |
144 | - return apply_filters( 'getpaid_get_email_merge_tags', $merge_tags, $this->id, $this->object ); |
|
144 | + return apply_filters('getpaid_get_email_merge_tags', $merge_tags, $this->id, $this->object); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | * @param array $merge_tags |
152 | 152 | * @return string |
153 | 153 | */ |
154 | - public function add_merge_tags( $text, $merge_tags = array() ) { |
|
154 | + public function add_merge_tags($text, $merge_tags = array()) { |
|
155 | 155 | |
156 | - foreach ( $merge_tags as $key => $value ) { |
|
157 | - $text = str_replace( $key, $value, $text ); |
|
156 | + foreach ($merge_tags as $key => $value) { |
|
157 | + $text = str_replace($key, $value, $text); |
|
158 | 158 | } |
159 | 159 | |
160 | - return wptexturize( $text ); |
|
160 | + return wptexturize($text); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param array $extra_args Extra template args |
168 | 168 | * @return string |
169 | 169 | */ |
170 | - public function get_content( $merge_tags = array(), $extra_args = array() ) { |
|
170 | + public function get_content($merge_tags = array(), $extra_args = array()) { |
|
171 | 171 | |
172 | 172 | $content = wpinv_get_template_html( |
173 | 173 | "emails/wpinv-email-{$this->id}.php", |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | 'invoice' => $this->object, // Backwards compat. |
178 | 178 | 'object' => $this->object, |
179 | 179 | 'email_type' => $this->id, |
180 | - 'email_heading' => $this->add_merge_tags( $this->get_heading(), $merge_tags ), |
|
180 | + 'email_heading' => $this->add_merge_tags($this->get_heading(), $merge_tags), |
|
181 | 181 | 'sent_to_admin' => $this->is_admin_email(), |
182 | 182 | 'plain_text' => false, |
183 | - 'message_body' => wpautop( $this->add_merge_tags( $this->get_body(), $merge_tags ) ), |
|
183 | + 'message_body' => wpautop($this->add_merge_tags($this->get_body(), $merge_tags)), |
|
184 | 184 | ) |
185 | 185 | ) |
186 | 186 | ); |
187 | 187 | |
188 | - return wpinv_email_style_body( $content ); |
|
188 | + return wpinv_email_style_body($content); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | } |
@@ -13,17 +13,17 @@ discard block |
||
13 | 13 | class GetPaid_Notification_Email_Sender { |
14 | 14 | |
15 | 15 | /** |
16 | - * Whether or not we should inline CSS into the email. |
|
17 | - */ |
|
18 | - public $inline_css = true; |
|
16 | + * Whether or not we should inline CSS into the email. |
|
17 | + */ |
|
18 | + public $inline_css = true; |
|
19 | 19 | |
20 | 20 | /** |
21 | - * The wp_mail() data. |
|
22 | - */ |
|
21 | + * The wp_mail() data. |
|
22 | + */ |
|
23 | 23 | public $wp_mail_data = null; |
24 | 24 | |
25 | 25 | /** |
26 | - * Sends a new email. |
|
26 | + * Sends a new email. |
|
27 | 27 | * |
28 | 28 | * @param string|array $to The recipients email or an array of recipient emails. |
29 | 29 | * @param string $subject The email's subject. |
@@ -31,49 +31,49 @@ discard block |
||
31 | 31 | * @param array $attachments The email attachments. |
32 | 32 | * |
33 | 33 | * @return bool |
34 | - */ |
|
35 | - public function send( $to, $subject, $email, $attachments = array() ) { |
|
34 | + */ |
|
35 | + public function send( $to, $subject, $email, $attachments = array() ) { |
|
36 | 36 | |
37 | - /* |
|
37 | + /* |
|
38 | 38 | * Allow to filter data on per-email basis. |
39 | 39 | */ |
40 | - $data = apply_filters( |
|
41 | - 'getpaid_email_data', |
|
42 | - array( |
|
43 | - 'to' => array_filter( array_unique( wpinv_parse_list( $to ) ) ), |
|
44 | - 'subject' => $subject, |
|
45 | - 'email' => $email, |
|
46 | - 'headers' => $this->get_headers(), |
|
47 | - 'attachments' => $attachments, |
|
48 | - ), |
|
49 | - $this |
|
50 | - ); |
|
40 | + $data = apply_filters( |
|
41 | + 'getpaid_email_data', |
|
42 | + array( |
|
43 | + 'to' => array_filter( array_unique( wpinv_parse_list( $to ) ) ), |
|
44 | + 'subject' => $subject, |
|
45 | + 'email' => $email, |
|
46 | + 'headers' => $this->get_headers(), |
|
47 | + 'attachments' => $attachments, |
|
48 | + ), |
|
49 | + $this |
|
50 | + ); |
|
51 | 51 | |
52 | 52 | // Remove slashes. |
53 | 53 | $data = (array) wp_unslash( $data ); |
54 | 54 | |
55 | 55 | // Cache it. |
56 | - $this->wp_mail_data = $data; |
|
56 | + $this->wp_mail_data = $data; |
|
57 | 57 | |
58 | - // Attach our own hooks. |
|
59 | - $this->before_sending(); |
|
58 | + // Attach our own hooks. |
|
59 | + $this->before_sending(); |
|
60 | 60 | |
61 | 61 | $result = false; |
62 | 62 | |
63 | 63 | foreach ( $this->wp_mail_data['to'] as $to ) { |
64 | - $result = $this->_send( $to, $data ); |
|
64 | + $result = $this->_send( $to, $data ); |
|
65 | 65 | } |
66 | 66 | |
67 | - // Remove our hooks. |
|
68 | - $this->after_sending(); |
|
67 | + // Remove our hooks. |
|
68 | + $this->after_sending(); |
|
69 | 69 | |
70 | - $this->wp_mail_data = null; |
|
70 | + $this->wp_mail_data = null; |
|
71 | 71 | |
72 | - return $result; |
|
73 | - } |
|
72 | + return $result; |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Does the actual sending. |
|
75 | + /** |
|
76 | + * Does the actual sending. |
|
77 | 77 | * |
78 | 78 | * @param string $to The recipient's email. |
79 | 79 | * @param array $data The email's data. |
@@ -81,81 +81,81 @@ discard block |
||
81 | 81 | * @param array $attachments The email attachments. |
82 | 82 | * |
83 | 83 | * @return bool |
84 | - */ |
|
85 | - protected function _send( $to, $data ) { |
|
86 | - |
|
87 | - // Prepare the sending function. |
|
88 | - $sending_function = apply_filters( 'getpaid_email_email_sending_function', 'wp_mail' ); |
|
89 | - |
|
90 | - // Send the actual email. |
|
91 | - $result = call_user_func( |
|
92 | - $sending_function, |
|
93 | - $to, |
|
94 | - html_entity_decode( $data['subject'], ENT_QUOTES, get_bloginfo( 'charset' ) ), |
|
95 | - $data['email'], |
|
96 | - $data['headers'], |
|
97 | - $data['attachments'] |
|
98 | - ); |
|
99 | - |
|
100 | - if ( ! $result ) { |
|
101 | - $log_message = wp_sprintf( __( "\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing' ), date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), $to, $data['subject'] ); |
|
102 | - wpinv_error_log( $log_message, __( 'Email from Invoicing plugin failed to send', 'invoicing' ), __FILE__, __LINE__ ); |
|
103 | - } |
|
104 | - |
|
105 | - return $result; |
|
106 | - } |
|
84 | + */ |
|
85 | + protected function _send( $to, $data ) { |
|
86 | + |
|
87 | + // Prepare the sending function. |
|
88 | + $sending_function = apply_filters( 'getpaid_email_email_sending_function', 'wp_mail' ); |
|
89 | + |
|
90 | + // Send the actual email. |
|
91 | + $result = call_user_func( |
|
92 | + $sending_function, |
|
93 | + $to, |
|
94 | + html_entity_decode( $data['subject'], ENT_QUOTES, get_bloginfo( 'charset' ) ), |
|
95 | + $data['email'], |
|
96 | + $data['headers'], |
|
97 | + $data['attachments'] |
|
98 | + ); |
|
99 | + |
|
100 | + if ( ! $result ) { |
|
101 | + $log_message = wp_sprintf( __( "\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing' ), date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), $to, $data['subject'] ); |
|
102 | + wpinv_error_log( $log_message, __( 'Email from Invoicing plugin failed to send', 'invoicing' ), __FILE__, __LINE__ ); |
|
103 | + } |
|
104 | + |
|
105 | + return $result; |
|
106 | + } |
|
107 | 107 | |
108 | 108 | /** |
109 | - * Retrieves email headers. |
|
110 | - */ |
|
111 | - public function get_headers() { |
|
109 | + * Retrieves email headers. |
|
110 | + */ |
|
111 | + public function get_headers() { |
|
112 | 112 | |
113 | - $name = $this->get_from_name(); |
|
114 | - $reply_to = $this->get_reply_to(); |
|
115 | - $headers = array( "Reply-To:$name <$reply_to>" ); |
|
113 | + $name = $this->get_from_name(); |
|
114 | + $reply_to = $this->get_reply_to(); |
|
115 | + $headers = array( "Reply-To:$name <$reply_to>" ); |
|
116 | 116 | |
117 | - return apply_filters( 'getpaid_email_headers', $headers, $this ); |
|
117 | + return apply_filters( 'getpaid_email_headers', $headers, $this ); |
|
118 | 118 | |
119 | - } |
|
119 | + } |
|
120 | 120 | |
121 | 121 | /** |
122 | - * Fires before an email is sent |
|
123 | - * |
|
124 | - * @since 1.0.0 |
|
125 | - */ |
|
126 | - public function before_sending() { |
|
122 | + * Fires before an email is sent |
|
123 | + * |
|
124 | + * @since 1.0.0 |
|
125 | + */ |
|
126 | + public function before_sending() { |
|
127 | 127 | |
128 | 128 | do_action( 'getpaid_before_send_email', $this ); |
129 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ), 1000 ); |
|
130 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ), 1000 ); |
|
131 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ), 1000 ); |
|
132 | - add_filter( 'wp_mail', array( $this, 'ensure_email_content' ), 1000000 ); |
|
129 | + add_filter( 'wp_mail_from', array( $this, 'get_from_address' ), 1000 ); |
|
130 | + add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ), 1000 ); |
|
131 | + add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ), 1000 ); |
|
132 | + add_filter( 'wp_mail', array( $this, 'ensure_email_content' ), 1000000 ); |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | 136 | /** |
137 | - * Returns the from name. |
|
138 | - */ |
|
139 | - public function get_from_name() { |
|
137 | + * Returns the from name. |
|
138 | + */ |
|
139 | + public function get_from_name() { |
|
140 | 140 | |
141 | 141 | $from_name = wpinv_get_option( 'email_from_name', get_bloginfo( 'name' ) ); |
142 | 142 | |
143 | - if ( empty( $from_name ) ) { |
|
144 | - $from_name = get_bloginfo( 'name' ); |
|
143 | + if ( empty( $from_name ) ) { |
|
144 | + $from_name = get_bloginfo( 'name' ); |
|
145 | 145 | } |
146 | 146 | |
147 | - return wp_specialchars_decode( $from_name, ENT_QUOTES ); |
|
147 | + return wp_specialchars_decode( $from_name, ENT_QUOTES ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | - * Returns the from email. |
|
152 | - */ |
|
153 | - public function get_from_address() { |
|
151 | + * Returns the from email. |
|
152 | + */ |
|
153 | + public function get_from_address() { |
|
154 | 154 | |
155 | 155 | $from_address = wpinv_get_option( 'email_from', $this->default_from_address() ); |
156 | 156 | |
157 | - if ( ! is_email( $from_address ) ) { |
|
158 | - $from_address = $this->default_from_address(); |
|
157 | + if ( ! is_email( $from_address ) ) { |
|
158 | + $from_address = $this->default_from_address(); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return $from_address; |
@@ -163,75 +163,75 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | - * The default emails from address. |
|
167 | - * |
|
168 | - * Defaults to wordpress@$sitename |
|
169 | - * Some hosts will block outgoing mail from this address if it doesn't exist, |
|
170 | - * but there's no easy alternative. Defaulting to admin_email might appear to be |
|
171 | - * another option, but some hosts may refuse to relay mail from an unknown domain. |
|
172 | - * |
|
173 | - */ |
|
174 | - public function default_from_address() { |
|
175 | - |
|
176 | - // Get the site domain and get rid of www. |
|
177 | - $sitename = strtolower( $_SERVER['SERVER_NAME'] ); |
|
178 | - if ( substr( $sitename, 0, 4 ) == 'www.' ) { |
|
179 | - $sitename = substr( $sitename, 4 ); |
|
180 | - } |
|
181 | - |
|
182 | - $from_email = 'wordpress@' . $sitename; |
|
183 | - |
|
184 | - return apply_filters( 'getpaid_default_from_address', $from_email ); |
|
166 | + * The default emails from address. |
|
167 | + * |
|
168 | + * Defaults to wordpress@$sitename |
|
169 | + * Some hosts will block outgoing mail from this address if it doesn't exist, |
|
170 | + * but there's no easy alternative. Defaulting to admin_email might appear to be |
|
171 | + * another option, but some hosts may refuse to relay mail from an unknown domain. |
|
172 | + * |
|
173 | + */ |
|
174 | + public function default_from_address() { |
|
175 | + |
|
176 | + // Get the site domain and get rid of www. |
|
177 | + $sitename = strtolower( $_SERVER['SERVER_NAME'] ); |
|
178 | + if ( substr( $sitename, 0, 4 ) == 'www.' ) { |
|
179 | + $sitename = substr( $sitename, 4 ); |
|
180 | + } |
|
181 | + |
|
182 | + $from_email = 'wordpress@' . $sitename; |
|
183 | + |
|
184 | + return apply_filters( 'getpaid_default_from_address', $from_email ); |
|
185 | 185 | |
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
189 | - * Get the email reply-to. |
|
190 | - * |
|
191 | - * |
|
192 | - * @return string The email reply-to address. |
|
193 | - */ |
|
194 | - public function get_reply_to() { |
|
189 | + * Get the email reply-to. |
|
190 | + * |
|
191 | + * |
|
192 | + * @return string The email reply-to address. |
|
193 | + */ |
|
194 | + public function get_reply_to() { |
|
195 | 195 | |
196 | - $reply_to = wpinv_get_admin_email(); |
|
196 | + $reply_to = wpinv_get_admin_email(); |
|
197 | 197 | |
198 | - if ( ! is_email( $reply_to ) ) { |
|
199 | - $reply_to = get_option( 'admin_email' ); |
|
200 | - } |
|
198 | + if ( ! is_email( $reply_to ) ) { |
|
199 | + $reply_to = get_option( 'admin_email' ); |
|
200 | + } |
|
201 | 201 | |
202 | - return $reply_to; |
|
202 | + return $reply_to; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
206 | - * Get the email content type. |
|
207 | - * |
|
208 | - */ |
|
209 | - public function get_content_type() { |
|
210 | - return apply_filters( 'getpaid_email_content_type', 'text/html', $this ); |
|
206 | + * Get the email content type. |
|
207 | + * |
|
208 | + */ |
|
209 | + public function get_content_type() { |
|
210 | + return apply_filters( 'getpaid_email_content_type', 'text/html', $this ); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
214 | - * Ensures that our email messages are not messed up by template plugins. |
|
215 | - * |
|
216 | - * @return array wp_mail_data. |
|
217 | - */ |
|
218 | - public function ensure_email_content( $args ) { |
|
219 | - $args['message'] = $this->wp_mail_data['email']; |
|
220 | - return $args; |
|
214 | + * Ensures that our email messages are not messed up by template plugins. |
|
215 | + * |
|
216 | + * @return array wp_mail_data. |
|
217 | + */ |
|
218 | + public function ensure_email_content( $args ) { |
|
219 | + $args['message'] = $this->wp_mail_data['email']; |
|
220 | + return $args; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * A little house keeping after an email is sent. |
|
225 | - * |
|
226 | - */ |
|
227 | - public function after_sending() { |
|
224 | + * A little house keeping after an email is sent. |
|
225 | + * |
|
226 | + */ |
|
227 | + public function after_sending() { |
|
228 | 228 | |
229 | 229 | do_action( 'after_noptin_sends_email', $this->wp_mail_data ); |
230 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ), 1000 ); |
|
231 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ), 1000 ); |
|
232 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ), 1000 ); |
|
233 | - remove_filter( 'wp_mail', array( $this, 'ensure_email_content' ), 1000000 ); |
|
230 | + remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ), 1000 ); |
|
231 | + remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ), 1000 ); |
|
232 | + remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ), 1000 ); |
|
233 | + remove_filter( 'wp_mail', array( $this, 'ensure_email_content' ), 1000000 ); |
|
234 | 234 | |
235 | - } |
|
235 | + } |
|
236 | 236 | |
237 | 237 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * This function is responsible for sending emails. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return bool |
34 | 34 | */ |
35 | - public function send( $to, $subject, $email, $attachments = array() ) { |
|
35 | + public function send($to, $subject, $email, $attachments = array()) { |
|
36 | 36 | |
37 | 37 | /* |
38 | 38 | * Allow to filter data on per-email basis. |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $data = apply_filters( |
41 | 41 | 'getpaid_email_data', |
42 | 42 | array( |
43 | - 'to' => array_filter( array_unique( wpinv_parse_list( $to ) ) ), |
|
43 | + 'to' => array_filter(array_unique(wpinv_parse_list($to))), |
|
44 | 44 | 'subject' => $subject, |
45 | 45 | 'email' => $email, |
46 | 46 | 'headers' => $this->get_headers(), |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | ); |
51 | 51 | |
52 | 52 | // Remove slashes. |
53 | - $data = (array) wp_unslash( $data ); |
|
53 | + $data = (array) wp_unslash($data); |
|
54 | 54 | |
55 | 55 | // Cache it. |
56 | 56 | $this->wp_mail_data = $data; |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | $result = false; |
62 | 62 | |
63 | - foreach ( $this->wp_mail_data['to'] as $to ) { |
|
64 | - $result = $this->_send( $to, $data ); |
|
63 | + foreach ($this->wp_mail_data['to'] as $to) { |
|
64 | + $result = $this->_send($to, $data); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // Remove our hooks. |
@@ -82,24 +82,24 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return bool |
84 | 84 | */ |
85 | - protected function _send( $to, $data ) { |
|
85 | + protected function _send($to, $data) { |
|
86 | 86 | |
87 | 87 | // Prepare the sending function. |
88 | - $sending_function = apply_filters( 'getpaid_email_email_sending_function', 'wp_mail' ); |
|
88 | + $sending_function = apply_filters('getpaid_email_email_sending_function', 'wp_mail'); |
|
89 | 89 | |
90 | 90 | // Send the actual email. |
91 | 91 | $result = call_user_func( |
92 | 92 | $sending_function, |
93 | 93 | $to, |
94 | - html_entity_decode( $data['subject'], ENT_QUOTES, get_bloginfo( 'charset' ) ), |
|
94 | + html_entity_decode($data['subject'], ENT_QUOTES, get_bloginfo('charset')), |
|
95 | 95 | $data['email'], |
96 | 96 | $data['headers'], |
97 | 97 | $data['attachments'] |
98 | 98 | ); |
99 | 99 | |
100 | - if ( ! $result ) { |
|
101 | - $log_message = wp_sprintf( __( "\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing' ), date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), $to, $data['subject'] ); |
|
102 | - wpinv_error_log( $log_message, __( 'Email from Invoicing plugin failed to send', 'invoicing' ), __FILE__, __LINE__ ); |
|
100 | + if (!$result) { |
|
101 | + $log_message = wp_sprintf(__("\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing'), date_i18n('F j Y H:i:s', current_time('timestamp')), $to, $data['subject']); |
|
102 | + wpinv_error_log($log_message, __('Email from Invoicing plugin failed to send', 'invoicing'), __FILE__, __LINE__); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return $result; |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | |
113 | 113 | $name = $this->get_from_name(); |
114 | 114 | $reply_to = $this->get_reply_to(); |
115 | - $headers = array( "Reply-To:$name <$reply_to>" ); |
|
115 | + $headers = array("Reply-To:$name <$reply_to>"); |
|
116 | 116 | |
117 | - return apply_filters( 'getpaid_email_headers', $headers, $this ); |
|
117 | + return apply_filters('getpaid_email_headers', $headers, $this); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function before_sending() { |
127 | 127 | |
128 | - do_action( 'getpaid_before_send_email', $this ); |
|
129 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ), 1000 ); |
|
130 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ), 1000 ); |
|
131 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ), 1000 ); |
|
132 | - add_filter( 'wp_mail', array( $this, 'ensure_email_content' ), 1000000 ); |
|
128 | + do_action('getpaid_before_send_email', $this); |
|
129 | + add_filter('wp_mail_from', array($this, 'get_from_address'), 1000); |
|
130 | + add_filter('wp_mail_from_name', array($this, 'get_from_name'), 1000); |
|
131 | + add_filter('wp_mail_content_type', array($this, 'get_content_type'), 1000); |
|
132 | + add_filter('wp_mail', array($this, 'ensure_email_content'), 1000000); |
|
133 | 133 | |
134 | 134 | } |
135 | 135 | |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function get_from_name() { |
140 | 140 | |
141 | - $from_name = wpinv_get_option( 'email_from_name', get_bloginfo( 'name' ) ); |
|
141 | + $from_name = wpinv_get_option('email_from_name', get_bloginfo('name')); |
|
142 | 142 | |
143 | - if ( empty( $from_name ) ) { |
|
144 | - $from_name = get_bloginfo( 'name' ); |
|
143 | + if (empty($from_name)) { |
|
144 | + $from_name = get_bloginfo('name'); |
|
145 | 145 | } |
146 | 146 | |
147 | - return wp_specialchars_decode( $from_name, ENT_QUOTES ); |
|
147 | + return wp_specialchars_decode($from_name, ENT_QUOTES); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function get_from_address() { |
154 | 154 | |
155 | - $from_address = wpinv_get_option( 'email_from', $this->default_from_address() ); |
|
155 | + $from_address = wpinv_get_option('email_from', $this->default_from_address()); |
|
156 | 156 | |
157 | - if ( ! is_email( $from_address ) ) { |
|
158 | - $from_address = $this->default_from_address(); |
|
157 | + if (!is_email($from_address)) { |
|
158 | + $from_address = $this->default_from_address(); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return $from_address; |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | public function default_from_address() { |
175 | 175 | |
176 | 176 | // Get the site domain and get rid of www. |
177 | - $sitename = strtolower( $_SERVER['SERVER_NAME'] ); |
|
178 | - if ( substr( $sitename, 0, 4 ) == 'www.' ) { |
|
179 | - $sitename = substr( $sitename, 4 ); |
|
177 | + $sitename = strtolower($_SERVER['SERVER_NAME']); |
|
178 | + if (substr($sitename, 0, 4) == 'www.') { |
|
179 | + $sitename = substr($sitename, 4); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | $from_email = 'wordpress@' . $sitename; |
183 | 183 | |
184 | - return apply_filters( 'getpaid_default_from_address', $from_email ); |
|
184 | + return apply_filters('getpaid_default_from_address', $from_email); |
|
185 | 185 | |
186 | 186 | } |
187 | 187 | |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | |
196 | 196 | $reply_to = wpinv_get_admin_email(); |
197 | 197 | |
198 | - if ( ! is_email( $reply_to ) ) { |
|
199 | - $reply_to = get_option( 'admin_email' ); |
|
198 | + if (!is_email($reply_to)) { |
|
199 | + $reply_to = get_option('admin_email'); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $reply_to; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | */ |
209 | 209 | public function get_content_type() { |
210 | - return apply_filters( 'getpaid_email_content_type', 'text/html', $this ); |
|
210 | + return apply_filters('getpaid_email_content_type', 'text/html', $this); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @return array wp_mail_data. |
217 | 217 | */ |
218 | - public function ensure_email_content( $args ) { |
|
218 | + public function ensure_email_content($args) { |
|
219 | 219 | $args['message'] = $this->wp_mail_data['email']; |
220 | 220 | return $args; |
221 | 221 | } |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function after_sending() { |
228 | 228 | |
229 | - do_action( 'after_noptin_sends_email', $this->wp_mail_data ); |
|
230 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ), 1000 ); |
|
231 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ), 1000 ); |
|
232 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ), 1000 ); |
|
233 | - remove_filter( 'wp_mail', array( $this, 'ensure_email_content' ), 1000000 ); |
|
229 | + do_action('after_noptin_sends_email', $this->wp_mail_data); |
|
230 | + remove_filter('wp_mail_from', array($this, 'get_from_address'), 1000); |
|
231 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name'), 1000); |
|
232 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type'), 1000); |
|
233 | + remove_filter('wp_mail', array($this, 'ensure_email_content'), 1000000); |
|
234 | 234 | |
235 | 235 | } |
236 | 236 |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | $cb = "wpinv_{$option['type']}_callback"; |
197 | 197 | $section = "wpinv_settings_{$tab}_$section"; |
198 | 198 | |
199 | - if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) { |
|
200 | - $tip = esc_attr( $option['desc'] ); |
|
201 | - $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
202 | - unset( $option['desc'] ); |
|
203 | - } |
|
199 | + if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) { |
|
200 | + $tip = esc_attr( $option['desc'] ); |
|
201 | + $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
202 | + unset( $option['desc'] ); |
|
203 | + } |
|
204 | 204 | |
205 | 205 | // Loop through all tabs. |
206 | 206 | add_settings_field( |
@@ -425,333 +425,333 @@ discard block |
||
425 | 425 | } |
426 | 426 | |
427 | 427 | function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
428 | - $pages_options = array(); |
|
428 | + $pages_options = array(); |
|
429 | 429 | |
430 | - if( $default_label !== NULL && $default_label !== false ) { |
|
431 | - $pages_options = array( '' => $default_label ); // Blank option |
|
432 | - } |
|
430 | + if( $default_label !== NULL && $default_label !== false ) { |
|
431 | + $pages_options = array( '' => $default_label ); // Blank option |
|
432 | + } |
|
433 | 433 | |
434 | - $pages = get_pages(); |
|
435 | - if ( $pages ) { |
|
436 | - foreach ( $pages as $page ) { |
|
437 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
434 | + $pages = get_pages(); |
|
435 | + if ( $pages ) { |
|
436 | + foreach ( $pages as $page ) { |
|
437 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
438 | 438 | $pages_options[ $page->ID ] = $title; |
439 | - } |
|
440 | - } |
|
439 | + } |
|
440 | + } |
|
441 | 441 | |
442 | - return $pages_options; |
|
442 | + return $pages_options; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | function wpinv_header_callback( $args ) { |
446 | - if ( !empty( $args['desc'] ) ) { |
|
446 | + if ( !empty( $args['desc'] ) ) { |
|
447 | 447 | echo $args['desc']; |
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
451 | 451 | function wpinv_hidden_callback( $args ) { |
452 | - global $wpinv_options; |
|
453 | - |
|
454 | - if ( isset( $args['set_value'] ) ) { |
|
455 | - $value = $args['set_value']; |
|
456 | - } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
457 | - $value = $wpinv_options[ $args['id'] ]; |
|
458 | - } else { |
|
459 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
460 | - } |
|
461 | - |
|
462 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
463 | - $args['readonly'] = true; |
|
464 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
465 | - $name = ''; |
|
466 | - } else { |
|
467 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
468 | - } |
|
469 | - |
|
470 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
452 | + global $wpinv_options; |
|
453 | + |
|
454 | + if ( isset( $args['set_value'] ) ) { |
|
455 | + $value = $args['set_value']; |
|
456 | + } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
457 | + $value = $wpinv_options[ $args['id'] ]; |
|
458 | + } else { |
|
459 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
460 | + } |
|
461 | + |
|
462 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
463 | + $args['readonly'] = true; |
|
464 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
465 | + $name = ''; |
|
466 | + } else { |
|
467 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
468 | + } |
|
469 | + |
|
470 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
471 | 471 | |
472 | - echo $html; |
|
472 | + echo $html; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | function wpinv_checkbox_callback( $args ) { |
476 | - global $wpinv_options; |
|
476 | + global $wpinv_options; |
|
477 | 477 | |
478 | 478 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
479 | 479 | |
480 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
481 | - $name = ''; |
|
482 | - } else { |
|
483 | - $name = 'name="wpinv_settings[' . $sanitize_id . ']"'; |
|
484 | - } |
|
480 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
481 | + $name = ''; |
|
482 | + } else { |
|
483 | + $name = 'name="wpinv_settings[' . $sanitize_id . ']"'; |
|
484 | + } |
|
485 | 485 | |
486 | - $std = isset( $args['std'] ) ? $args['std'] : 0; |
|
487 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
488 | - $checked = checked( empty( $value ), false, false ); |
|
486 | + $std = isset( $args['std'] ) ? $args['std'] : 0; |
|
487 | + $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
488 | + $checked = checked( empty( $value ), false, false ); |
|
489 | 489 | |
490 | - $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>'; |
|
491 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
490 | + $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>'; |
|
491 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
492 | 492 | |
493 | - echo $html; |
|
493 | + echo $html; |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | function wpinv_multicheck_callback( $args ) { |
497 | - global $wpinv_options; |
|
497 | + global $wpinv_options; |
|
498 | 498 | |
499 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
500 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
499 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
500 | + $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
501 | 501 | |
502 | - if ( ! empty( $args['options'] ) ) { |
|
502 | + if ( ! empty( $args['options'] ) ) { |
|
503 | 503 | |
504 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
505 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
504 | + $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
505 | + $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
506 | 506 | |
507 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
507 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
508 | 508 | foreach( $args['options'] as $key => $option ): |
509 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
510 | - if ( in_array( $sanitize_key, $value ) ) { |
|
511 | - $enabled = $sanitize_key; |
|
512 | - } else { |
|
513 | - $enabled = NULL; |
|
514 | - } |
|
515 | - echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
516 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
517 | - endforeach; |
|
518 | - echo '</div>'; |
|
519 | - echo '<p class="description">' . $args['desc'] . '</p>'; |
|
520 | - } |
|
509 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
510 | + if ( in_array( $sanitize_key, $value ) ) { |
|
511 | + $enabled = $sanitize_key; |
|
512 | + } else { |
|
513 | + $enabled = NULL; |
|
514 | + } |
|
515 | + echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
516 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
517 | + endforeach; |
|
518 | + echo '</div>'; |
|
519 | + echo '<p class="description">' . $args['desc'] . '</p>'; |
|
520 | + } |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | function wpinv_payment_icons_callback( $args ) { |
524 | - global $wpinv_options; |
|
524 | + global $wpinv_options; |
|
525 | 525 | |
526 | 526 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
527 | 527 | |
528 | - if ( ! empty( $args['options'] ) ) { |
|
529 | - foreach( $args['options'] as $key => $option ) { |
|
528 | + if ( ! empty( $args['options'] ) ) { |
|
529 | + foreach( $args['options'] as $key => $option ) { |
|
530 | 530 | $sanitize_key = wpinv_sanitize_key( $key ); |
531 | 531 | |
532 | - if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
533 | - $enabled = $option; |
|
534 | - } else { |
|
535 | - $enabled = NULL; |
|
536 | - } |
|
537 | - |
|
538 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
539 | - |
|
540 | - echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
541 | - |
|
542 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
543 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
544 | - } else { |
|
545 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
546 | - |
|
547 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
548 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
549 | - } else { |
|
550 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
551 | - $content_dir = WP_CONTENT_DIR; |
|
552 | - |
|
553 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
554 | - // Replaces backslashes with forward slashes for Windows systems |
|
555 | - $image = wp_normalize_path( $image ); |
|
556 | - $content_dir = wp_normalize_path( $content_dir ); |
|
557 | - } |
|
558 | - |
|
559 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
560 | - } |
|
561 | - |
|
562 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
563 | - } |
|
564 | - echo $option . '</label>'; |
|
565 | - } |
|
566 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
567 | - } |
|
532 | + if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
533 | + $enabled = $option; |
|
534 | + } else { |
|
535 | + $enabled = NULL; |
|
536 | + } |
|
537 | + |
|
538 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
539 | + |
|
540 | + echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
541 | + |
|
542 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
543 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
544 | + } else { |
|
545 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
546 | + |
|
547 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
548 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
549 | + } else { |
|
550 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
551 | + $content_dir = WP_CONTENT_DIR; |
|
552 | + |
|
553 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
554 | + // Replaces backslashes with forward slashes for Windows systems |
|
555 | + $image = wp_normalize_path( $image ); |
|
556 | + $content_dir = wp_normalize_path( $content_dir ); |
|
557 | + } |
|
558 | + |
|
559 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
560 | + } |
|
561 | + |
|
562 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
563 | + } |
|
564 | + echo $option . '</label>'; |
|
565 | + } |
|
566 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
567 | + } |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | function wpinv_radio_callback( $args ) { |
571 | - global $wpinv_options; |
|
571 | + global $wpinv_options; |
|
572 | 572 | |
573 | 573 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
574 | 574 | |
575 | 575 | foreach ( $args['options'] as $key => $option ) : |
576 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
576 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
577 | 577 | |
578 | 578 | $checked = false; |
579 | 579 | |
580 | - if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
581 | - $checked = true; |
|
582 | - elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
583 | - $checked = true; |
|
580 | + if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
581 | + $checked = true; |
|
582 | + elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
583 | + $checked = true; |
|
584 | 584 | |
585 | - echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
|
586 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
|
587 | - endforeach; |
|
585 | + echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
|
586 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
|
587 | + endforeach; |
|
588 | 588 | |
589 | - echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
589 | + echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | function wpinv_gateways_callback( $args ) { |
593 | - global $wpinv_options; |
|
593 | + global $wpinv_options; |
|
594 | 594 | |
595 | 595 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
596 | 596 | |
597 | - foreach ( $args['options'] as $key => $option ) : |
|
598 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
597 | + foreach ( $args['options'] as $key => $option ) : |
|
598 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
599 | 599 | |
600 | 600 | if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
601 | - $enabled = '1'; |
|
602 | - else |
|
603 | - $enabled = null; |
|
601 | + $enabled = '1'; |
|
602 | + else |
|
603 | + $enabled = null; |
|
604 | 604 | |
605 | - echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
|
606 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
607 | - endforeach; |
|
605 | + echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
|
606 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
607 | + endforeach; |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | function wpinv_gateway_select_callback($args) { |
611 | - global $wpinv_options; |
|
611 | + global $wpinv_options; |
|
612 | 612 | |
613 | 613 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
614 | 614 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
615 | 615 | |
616 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
616 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
617 | 617 | |
618 | - foreach ( $args['options'] as $key => $option ) : |
|
619 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
618 | + foreach ( $args['options'] as $key => $option ) : |
|
619 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
620 | 620 | $selected = selected( $key, $args['selected'], false ); |
621 | 621 | } else { |
622 | 622 | $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : ''; |
623 | 623 | } |
624 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
625 | - endforeach; |
|
624 | + echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
625 | + endforeach; |
|
626 | 626 | |
627 | - echo '</select>'; |
|
628 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
627 | + echo '</select>'; |
|
628 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | function wpinv_text_callback( $args ) { |
632 | - global $wpinv_options; |
|
632 | + global $wpinv_options; |
|
633 | 633 | |
634 | 634 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
635 | 635 | |
636 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
637 | - $value = $wpinv_options[ $args['id'] ]; |
|
638 | - } else { |
|
639 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
640 | - } |
|
641 | - |
|
642 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
643 | - $args['readonly'] = true; |
|
644 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
645 | - $name = ''; |
|
646 | - } else { |
|
647 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
648 | - } |
|
649 | - $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
650 | - |
|
651 | - $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; |
|
652 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
653 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>'; |
|
654 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
655 | - |
|
656 | - echo $html; |
|
636 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
637 | + $value = $wpinv_options[ $args['id'] ]; |
|
638 | + } else { |
|
639 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
640 | + } |
|
641 | + |
|
642 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
643 | + $args['readonly'] = true; |
|
644 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
645 | + $name = ''; |
|
646 | + } else { |
|
647 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
648 | + } |
|
649 | + $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
650 | + |
|
651 | + $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; |
|
652 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
653 | + $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>'; |
|
654 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
655 | + |
|
656 | + echo $html; |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | function wpinv_number_callback( $args ) { |
660 | - global $wpinv_options; |
|
660 | + global $wpinv_options; |
|
661 | 661 | |
662 | 662 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
663 | 663 | |
664 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
665 | - $value = $wpinv_options[ $args['id'] ]; |
|
666 | - } else { |
|
667 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
668 | - } |
|
669 | - |
|
670 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
671 | - $args['readonly'] = true; |
|
672 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
673 | - $name = ''; |
|
674 | - } else { |
|
675 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
676 | - } |
|
677 | - |
|
678 | - $max = isset( $args['max'] ) ? $args['max'] : 999999; |
|
679 | - $min = isset( $args['min'] ) ? $args['min'] : 0; |
|
680 | - $step = isset( $args['step'] ) ? $args['step'] : 1; |
|
681 | - $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
682 | - |
|
683 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
684 | - $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
685 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
686 | - |
|
687 | - echo $html; |
|
664 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
665 | + $value = $wpinv_options[ $args['id'] ]; |
|
666 | + } else { |
|
667 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
668 | + } |
|
669 | + |
|
670 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
671 | + $args['readonly'] = true; |
|
672 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
673 | + $name = ''; |
|
674 | + } else { |
|
675 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
676 | + } |
|
677 | + |
|
678 | + $max = isset( $args['max'] ) ? $args['max'] : 999999; |
|
679 | + $min = isset( $args['min'] ) ? $args['min'] : 0; |
|
680 | + $step = isset( $args['step'] ) ? $args['step'] : 1; |
|
681 | + $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
682 | + |
|
683 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
684 | + $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
685 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
686 | + |
|
687 | + echo $html; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | function wpinv_textarea_callback( $args ) { |
691 | - global $wpinv_options; |
|
691 | + global $wpinv_options; |
|
692 | 692 | |
693 | 693 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
694 | 694 | |
695 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
696 | - $value = $wpinv_options[ $args['id'] ]; |
|
697 | - } else { |
|
698 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
699 | - } |
|
695 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
696 | + $value = $wpinv_options[ $args['id'] ]; |
|
697 | + } else { |
|
698 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
699 | + } |
|
700 | 700 | |
701 | 701 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
702 | 702 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
703 | 703 | |
704 | - $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
705 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
704 | + $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
705 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
706 | 706 | |
707 | - echo $html; |
|
707 | + echo $html; |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | function wpinv_password_callback( $args ) { |
711 | - global $wpinv_options; |
|
711 | + global $wpinv_options; |
|
712 | 712 | |
713 | 713 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
714 | 714 | |
715 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
716 | - $value = $wpinv_options[ $args['id'] ]; |
|
717 | - } else { |
|
718 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
719 | - } |
|
715 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
716 | + $value = $wpinv_options[ $args['id'] ]; |
|
717 | + } else { |
|
718 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
719 | + } |
|
720 | 720 | |
721 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
722 | - $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
723 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
721 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
722 | + $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
723 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
724 | 724 | |
725 | - echo $html; |
|
725 | + echo $html; |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | function wpinv_missing_callback($args) { |
729 | - printf( |
|
730 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
731 | - '<strong>' . $args['id'] . '</strong>' |
|
732 | - ); |
|
729 | + printf( |
|
730 | + __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
731 | + '<strong>' . $args['id'] . '</strong>' |
|
732 | + ); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | function wpinv_select_callback($args) { |
736 | - global $wpinv_options; |
|
736 | + global $wpinv_options; |
|
737 | 737 | |
738 | 738 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
739 | 739 | |
740 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
741 | - $value = $wpinv_options[ $args['id'] ]; |
|
742 | - } else { |
|
743 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
744 | - } |
|
740 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
741 | + $value = $wpinv_options[ $args['id'] ]; |
|
742 | + } else { |
|
743 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
744 | + } |
|
745 | 745 | |
746 | 746 | if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
747 | 747 | $value = $args['selected']; |
748 | 748 | } |
749 | 749 | |
750 | - if ( isset( $args['placeholder'] ) ) { |
|
751 | - $placeholder = $args['placeholder']; |
|
752 | - } else { |
|
753 | - $placeholder = ''; |
|
754 | - } |
|
750 | + if ( isset( $args['placeholder'] ) ) { |
|
751 | + $placeholder = $args['placeholder']; |
|
752 | + } else { |
|
753 | + $placeholder = ''; |
|
754 | + } |
|
755 | 755 | |
756 | 756 | if( !empty( $args['onchange'] ) ) { |
757 | 757 | $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
@@ -761,143 +761,143 @@ discard block |
||
761 | 761 | |
762 | 762 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
763 | 763 | |
764 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />'; |
|
764 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />'; |
|
765 | 765 | |
766 | - foreach ( $args['options'] as $option => $name ) { |
|
767 | - $selected = selected( $option, $value, false ); |
|
768 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
769 | - } |
|
766 | + foreach ( $args['options'] as $option => $name ) { |
|
767 | + $selected = selected( $option, $value, false ); |
|
768 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
769 | + } |
|
770 | 770 | |
771 | - $html .= '</select>'; |
|
772 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
771 | + $html .= '</select>'; |
|
772 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
773 | 773 | |
774 | - echo $html; |
|
774 | + echo $html; |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | function wpinv_color_select_callback( $args ) { |
778 | - global $wpinv_options; |
|
778 | + global $wpinv_options; |
|
779 | 779 | |
780 | 780 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
781 | 781 | |
782 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
783 | - $value = $wpinv_options[ $args['id'] ]; |
|
784 | - } else { |
|
785 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
786 | - } |
|
782 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
783 | + $value = $wpinv_options[ $args['id'] ]; |
|
784 | + } else { |
|
785 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
786 | + } |
|
787 | 787 | |
788 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
788 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
789 | 789 | |
790 | - foreach ( $args['options'] as $option => $color ) { |
|
791 | - $selected = selected( $option, $value, false ); |
|
792 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
793 | - } |
|
790 | + foreach ( $args['options'] as $option => $color ) { |
|
791 | + $selected = selected( $option, $value, false ); |
|
792 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
793 | + } |
|
794 | 794 | |
795 | - $html .= '</select>'; |
|
796 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
795 | + $html .= '</select>'; |
|
796 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
797 | 797 | |
798 | - echo $html; |
|
798 | + echo $html; |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | function wpinv_rich_editor_callback( $args ) { |
802 | - global $wpinv_options, $wp_version; |
|
802 | + global $wpinv_options, $wp_version; |
|
803 | 803 | |
804 | 804 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
805 | 805 | |
806 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
807 | - $value = $wpinv_options[ $args['id'] ]; |
|
806 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
807 | + $value = $wpinv_options[ $args['id'] ]; |
|
808 | 808 | |
809 | - if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
810 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
811 | - } |
|
812 | - } else { |
|
813 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
814 | - } |
|
809 | + if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
810 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
811 | + } |
|
812 | + } else { |
|
813 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
814 | + } |
|
815 | 815 | |
816 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
816 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
817 | 817 | |
818 | - $html = '<div class="getpaid-settings-editor-input">'; |
|
819 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
820 | - ob_start(); |
|
821 | - wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
822 | - $html .= ob_get_clean(); |
|
823 | - } else { |
|
824 | - $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
825 | - } |
|
818 | + $html = '<div class="getpaid-settings-editor-input">'; |
|
819 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
820 | + ob_start(); |
|
821 | + wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
822 | + $html .= ob_get_clean(); |
|
823 | + } else { |
|
824 | + $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
825 | + } |
|
826 | 826 | |
827 | - $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
827 | + $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
828 | 828 | |
829 | - echo $html; |
|
829 | + echo $html; |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | function wpinv_upload_callback( $args ) { |
833 | - global $wpinv_options; |
|
833 | + global $wpinv_options; |
|
834 | 834 | |
835 | 835 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
836 | 836 | |
837 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
838 | - $value = $wpinv_options[$args['id']]; |
|
839 | - } else { |
|
840 | - $value = isset($args['std']) ? $args['std'] : ''; |
|
841 | - } |
|
837 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
838 | + $value = $wpinv_options[$args['id']]; |
|
839 | + } else { |
|
840 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
841 | + } |
|
842 | 842 | |
843 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
844 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
845 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
846 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
843 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
844 | + $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
845 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
846 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
847 | 847 | |
848 | - echo $html; |
|
848 | + echo $html; |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | function wpinv_color_callback( $args ) { |
852 | - global $wpinv_options; |
|
852 | + global $wpinv_options; |
|
853 | 853 | |
854 | 854 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
855 | 855 | |
856 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
857 | - $value = $wpinv_options[ $args['id'] ]; |
|
858 | - } else { |
|
859 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
860 | - } |
|
856 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
857 | + $value = $wpinv_options[ $args['id'] ]; |
|
858 | + } else { |
|
859 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
860 | + } |
|
861 | 861 | |
862 | - $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
862 | + $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
863 | 863 | |
864 | - $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
865 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
864 | + $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
865 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
866 | 866 | |
867 | - echo $html; |
|
867 | + echo $html; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | function wpinv_country_states_callback($args) { |
871 | - global $wpinv_options; |
|
871 | + global $wpinv_options; |
|
872 | 872 | |
873 | 873 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
874 | 874 | |
875 | - if ( isset( $args['placeholder'] ) ) { |
|
876 | - $placeholder = $args['placeholder']; |
|
877 | - } else { |
|
878 | - $placeholder = ''; |
|
879 | - } |
|
875 | + if ( isset( $args['placeholder'] ) ) { |
|
876 | + $placeholder = $args['placeholder']; |
|
877 | + } else { |
|
878 | + $placeholder = ''; |
|
879 | + } |
|
880 | 880 | |
881 | - $states = wpinv_get_country_states(); |
|
881 | + $states = wpinv_get_country_states(); |
|
882 | 882 | |
883 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
884 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
883 | + $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
884 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
885 | 885 | |
886 | - foreach ( $states as $option => $name ) { |
|
887 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
888 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
889 | - } |
|
886 | + foreach ( $states as $option => $name ) { |
|
887 | + $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
888 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
889 | + } |
|
890 | 890 | |
891 | - $html .= '</select>'; |
|
892 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
891 | + $html .= '</select>'; |
|
892 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
893 | 893 | |
894 | - echo $html; |
|
894 | + echo $html; |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | function wpinv_tax_rates_callback($args) { |
898 | - global $wpinv_options; |
|
899 | - $rates = wpinv_get_tax_rates(); |
|
900 | - ob_start(); ?> |
|
898 | + global $wpinv_options; |
|
899 | + $rates = wpinv_get_tax_rates(); |
|
900 | + ob_start(); ?> |
|
901 | 901 | </td><tr> |
902 | 902 | <td colspan="2" class="wpinv_tax_tdbox"> |
903 | 903 | <p><?php echo $args['desc']; ?></p> |
@@ -921,40 +921,40 @@ discard block |
||
921 | 921 | <tr> |
922 | 922 | <td class="wpinv_tax_country"> |
923 | 923 | <?php |
924 | - echo wpinv_html_select( array( |
|
925 | - 'options' => wpinv_get_country_list( true ), |
|
926 | - 'name' => 'tax_rates[' . $sanitized_key . '][country]', |
|
924 | + echo wpinv_html_select( array( |
|
925 | + 'options' => wpinv_get_country_list( true ), |
|
926 | + 'name' => 'tax_rates[' . $sanitized_key . '][country]', |
|
927 | 927 | 'id' => 'tax_rates[' . $sanitized_key . '][country]', |
928 | - 'selected' => $rate['country'], |
|
929 | - 'show_option_all' => false, |
|
930 | - 'show_option_none' => false, |
|
931 | - 'class' => 'wpinv-tax-country wpi_select2', |
|
932 | - 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
933 | - ) ); |
|
934 | - ?> |
|
928 | + 'selected' => $rate['country'], |
|
929 | + 'show_option_all' => false, |
|
930 | + 'show_option_none' => false, |
|
931 | + 'class' => 'wpinv-tax-country wpi_select2', |
|
932 | + 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
933 | + ) ); |
|
934 | + ?> |
|
935 | 935 | </td> |
936 | 936 | <td class="wpinv_tax_state"> |
937 | 937 | <?php |
938 | - $states = wpinv_get_country_states( $rate['country'] ); |
|
939 | - if( !empty( $states ) ) { |
|
940 | - echo wpinv_html_select( array( |
|
941 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
942 | - 'name' => 'tax_rates[' . $sanitized_key . '][state]', |
|
938 | + $states = wpinv_get_country_states( $rate['country'] ); |
|
939 | + if( !empty( $states ) ) { |
|
940 | + echo wpinv_html_select( array( |
|
941 | + 'options' => array_merge( array( '' => '' ), $states ), |
|
942 | + 'name' => 'tax_rates[' . $sanitized_key . '][state]', |
|
943 | 943 | 'id' => 'tax_rates[' . $sanitized_key . '][state]', |
944 | - 'selected' => $rate['state'], |
|
945 | - 'show_option_all' => false, |
|
946 | - 'show_option_none' => false, |
|
944 | + 'selected' => $rate['state'], |
|
945 | + 'show_option_all' => false, |
|
946 | + 'show_option_none' => false, |
|
947 | 947 | 'class' => 'wpi_select2', |
948 | - 'placeholder' => __( 'Choose a state', 'invoicing' ) |
|
949 | - ) ); |
|
950 | - } else { |
|
951 | - echo wpinv_html_text( array( |
|
952 | - 'name' => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'], |
|
953 | - 'value' => ! empty( $rate['state'] ) ? $rate['state'] : '', |
|
948 | + 'placeholder' => __( 'Choose a state', 'invoicing' ) |
|
949 | + ) ); |
|
950 | + } else { |
|
951 | + echo wpinv_html_text( array( |
|
952 | + 'name' => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'], |
|
953 | + 'value' => ! empty( $rate['state'] ) ? $rate['state'] : '', |
|
954 | 954 | 'id' => 'tax_rates[' . $sanitized_key . '][state]', |
955 | - ) ); |
|
956 | - } |
|
957 | - ?> |
|
955 | + ) ); |
|
956 | + } |
|
957 | + ?> |
|
958 | 958 | </td> |
959 | 959 | <td class="wpinv_tax_global"> |
960 | 960 | <input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/> |
@@ -969,19 +969,19 @@ discard block |
||
969 | 969 | <tr> |
970 | 970 | <td class="wpinv_tax_country"> |
971 | 971 | <?php |
972 | - echo wpinv_html_select( array( |
|
973 | - 'options' => wpinv_get_country_list( true ), |
|
974 | - 'name' => 'tax_rates[0][country]', |
|
975 | - 'show_option_all' => false, |
|
976 | - 'show_option_none' => false, |
|
977 | - 'class' => 'wpinv-tax-country wpi_select2', |
|
978 | - 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
979 | - ) ); ?> |
|
972 | + echo wpinv_html_select( array( |
|
973 | + 'options' => wpinv_get_country_list( true ), |
|
974 | + 'name' => 'tax_rates[0][country]', |
|
975 | + 'show_option_all' => false, |
|
976 | + 'show_option_none' => false, |
|
977 | + 'class' => 'wpinv-tax-country wpi_select2', |
|
978 | + 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
979 | + ) ); ?> |
|
980 | 980 | </td> |
981 | 981 | <td class="wpinv_tax_state"> |
982 | 982 | <?php echo wpinv_html_text( array( |
983 | - 'name' => 'tax_rates[0][state]' |
|
984 | - ) ); ?> |
|
983 | + 'name' => 'tax_rates[0][state]' |
|
984 | + ) ); ?> |
|
985 | 985 | </td> |
986 | 986 | <td class="wpinv_tax_global"> |
987 | 987 | <input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/> |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot> |
997 | 997 | </table> |
998 | 998 | <?php |
999 | - echo ob_get_clean(); |
|
999 | + echo ob_get_clean(); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | function wpinv_tools_callback($args) { |
@@ -1024,15 +1024,15 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | function wpinv_descriptive_text_callback( $args ) { |
1027 | - echo wp_kses_post( $args['desc'] ); |
|
1027 | + echo wp_kses_post( $args['desc'] ); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | function wpinv_hook_callback( $args ) { |
1031 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
1031 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | function wpinv_set_settings_cap() { |
1035 | - return wpinv_get_capability(); |
|
1035 | + return wpinv_get_capability(); |
|
1036 | 1036 | } |
1037 | 1037 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
1038 | 1038 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @since 1.0.0 |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Retrieves all default settings. |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | function wpinv_get_settings() { |
17 | 17 | $defaults = array(); |
18 | 18 | |
19 | - foreach ( array_values( wpinv_get_registered_settings() ) as $tab_settings ) { |
|
19 | + foreach (array_values(wpinv_get_registered_settings()) as $tab_settings) { |
|
20 | 20 | |
21 | - foreach ( array_values( $tab_settings ) as $section_settings ) { |
|
21 | + foreach (array_values($tab_settings) as $section_settings) { |
|
22 | 22 | |
23 | - foreach ( $section_settings as $key => $setting ) { |
|
24 | - if ( isset( $setting['std'] ) ) { |
|
25 | - $defaults[ $key ] = $setting['std']; |
|
23 | + foreach ($section_settings as $key => $setting) { |
|
24 | + if (isset($setting['std'])) { |
|
25 | + $defaults[$key] = $setting['std']; |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | global $wpinv_options; |
44 | 44 | |
45 | 45 | // Try fetching the saved options. |
46 | - if ( ! is_array( $wpinv_options ) ) { |
|
47 | - $wpinv_options = get_option( 'wpinv_settings' ); |
|
46 | + if (!is_array($wpinv_options)) { |
|
47 | + $wpinv_options = get_option('wpinv_settings'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // If that fails, don't fetch the default settings to prevent a loop. |
51 | - if ( ! is_array( $wpinv_options ) ) { |
|
51 | + if (!is_array($wpinv_options)) { |
|
52 | 52 | $wpinv_options = array(); |
53 | 53 | } |
54 | 54 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | * @param mixed $default The default value to use if the setting has not been set. |
63 | 63 | * @return array |
64 | 64 | */ |
65 | -function wpinv_get_option( $key = '', $default = false ) { |
|
65 | +function wpinv_get_option($key = '', $default = false) { |
|
66 | 66 | |
67 | 67 | $options = wpinv_get_options(); |
68 | - $value = isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
69 | - $value = apply_filters( 'wpinv_get_option', $value, $key, $default ); |
|
68 | + $value = isset($options[$key]) ? $options[$key] : $default; |
|
69 | + $value = apply_filters('wpinv_get_option', $value, $key, $default); |
|
70 | 70 | |
71 | - return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default ); |
|
71 | + return apply_filters('wpinv_get_option_' . $key, $value, $key, $default); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | * @param array $options the new options. |
78 | 78 | * @return bool |
79 | 79 | */ |
80 | -function wpinv_update_options( $options ) { |
|
80 | +function wpinv_update_options($options) { |
|
81 | 81 | global $wpinv_options; |
82 | 82 | |
83 | 83 | // update the option. |
84 | - if ( is_array( $options ) && update_option( 'wpinv_settings', $options ) ) { |
|
84 | + if (is_array($options) && update_option('wpinv_settings', $options)) { |
|
85 | 85 | $wpinv_options = $options; |
86 | 86 | return true; |
87 | 87 | } |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | * @param mixed $value The setting value. |
97 | 97 | * @return bool |
98 | 98 | */ |
99 | -function wpinv_update_option( $key = '', $value = false ) { |
|
99 | +function wpinv_update_option($key = '', $value = false) { |
|
100 | 100 | |
101 | 101 | // If no key, exit. |
102 | - if ( empty( $key ) ) { |
|
102 | + if (empty($key)) { |
|
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | |
106 | 106 | // Maybe delete the option instead. |
107 | - if ( is_null( $value ) ) { |
|
108 | - return wpinv_delete_option( $key ); |
|
107 | + if (is_null($value)) { |
|
108 | + return wpinv_delete_option($key); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // Prepare the new options. |
112 | 112 | $options = wpinv_get_options(); |
113 | - $options[ $key ] = apply_filters( 'wpinv_update_option', $value, $key ); |
|
113 | + $options[$key] = apply_filters('wpinv_update_option', $value, $key); |
|
114 | 114 | |
115 | 115 | // Save the new options. |
116 | - return wpinv_update_options( $options ); |
|
116 | + return wpinv_update_options($options); |
|
117 | 117 | |
118 | 118 | } |
119 | 119 | |
@@ -123,18 +123,18 @@ discard block |
||
123 | 123 | * @param string $key the setting key. |
124 | 124 | * @return bool |
125 | 125 | */ |
126 | -function wpinv_delete_option( $key = '' ) { |
|
126 | +function wpinv_delete_option($key = '') { |
|
127 | 127 | |
128 | 128 | // If no key, exit |
129 | - if ( empty( $key ) ) { |
|
129 | + if (empty($key)) { |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | |
133 | 133 | $options = wpinv_get_options(); |
134 | 134 | |
135 | - if ( isset( $options[ $key ] ) ) { |
|
136 | - unset( $options[ $key ] ); |
|
137 | - return wpinv_update_options( $options ); |
|
135 | + if (isset($options[$key])) { |
|
136 | + unset($options[$key]); |
|
137 | + return wpinv_update_options($options); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | return true; |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | function wpinv_register_settings() { |
149 | 149 | |
150 | 150 | // Loop through all tabs. |
151 | - foreach ( wpinv_get_registered_settings() as $tab => $sections ) { |
|
151 | + foreach (wpinv_get_registered_settings() as $tab => $sections) { |
|
152 | 152 | |
153 | 153 | // In each tab, loop through sections. |
154 | - foreach ( $sections as $section => $settings ) { |
|
154 | + foreach ($sections as $section => $settings) { |
|
155 | 155 | |
156 | 156 | // Check for backwards compatibility |
157 | - $section_tabs = wpinv_get_settings_tab_sections( $tab ); |
|
158 | - if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) { |
|
157 | + $section_tabs = wpinv_get_settings_tab_sections($tab); |
|
158 | + if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) { |
|
159 | 159 | $section = 'main'; |
160 | 160 | $settings = $sections; |
161 | 161 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | 'wpinv_settings_' . $tab . '_' . $section |
169 | 169 | ); |
170 | 170 | |
171 | - foreach ( $settings as $option ) { |
|
172 | - if ( ! empty( $option['id'] ) ) { |
|
173 | - wpinv_register_settings_option( $tab, $section, $option ); |
|
171 | + foreach ($settings as $option) { |
|
172 | + if (!empty($option['id'])) { |
|
173 | + wpinv_register_settings_option($tab, $section, $option); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | // Creates our settings in the options table. |
181 | - register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' ); |
|
181 | + register_setting('wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize'); |
|
182 | 182 | } |
183 | -add_action( 'admin_init', 'wpinv_register_settings' ); |
|
183 | +add_action('admin_init', 'wpinv_register_settings'); |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Register a single settings option. |
@@ -190,46 +190,46 @@ discard block |
||
190 | 190 | * @param string $option |
191 | 191 | * |
192 | 192 | */ |
193 | -function wpinv_register_settings_option( $tab, $section, $option ) { |
|
193 | +function wpinv_register_settings_option($tab, $section, $option) { |
|
194 | 194 | |
195 | - $name = isset( $option['name'] ) ? $option['name'] : ''; |
|
195 | + $name = isset($option['name']) ? $option['name'] : ''; |
|
196 | 196 | $cb = "wpinv_{$option['type']}_callback"; |
197 | 197 | $section = "wpinv_settings_{$tab}_$section"; |
198 | 198 | |
199 | - if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) { |
|
200 | - $tip = esc_attr( $option['desc'] ); |
|
199 | + if (isset($option['desc']) && !empty($option['help-tip'])) { |
|
200 | + $tip = esc_attr($option['desc']); |
|
201 | 201 | $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
202 | - unset( $option['desc'] ); |
|
202 | + unset($option['desc']); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // Loop through all tabs. |
206 | 206 | add_settings_field( |
207 | 207 | 'wpinv_settings[' . $option['id'] . ']', |
208 | 208 | $name, |
209 | - function_exists( $cb ) ? $cb : 'wpinv_missing_callback', |
|
209 | + function_exists($cb) ? $cb : 'wpinv_missing_callback', |
|
210 | 210 | $section, |
211 | 211 | $section, |
212 | 212 | array( |
213 | 213 | 'section' => $section, |
214 | - 'id' => isset( $option['id'] ) ? $option['id'] : null, |
|
215 | - 'desc' => isset( $option['desc'] ) ? $option['desc'] : '', |
|
214 | + 'id' => isset($option['id']) ? $option['id'] : null, |
|
215 | + 'desc' => isset($option['desc']) ? $option['desc'] : '', |
|
216 | 216 | 'name' => $name, |
217 | - 'size' => isset( $option['size'] ) ? $option['size'] : null, |
|
218 | - 'options' => isset( $option['options'] ) ? $option['options'] : '', |
|
219 | - 'selected' => isset( $option['selected'] ) ? $option['selected'] : null, |
|
220 | - 'std' => isset( $option['std'] ) ? $option['std'] : '', |
|
221 | - 'min' => isset( $option['min'] ) ? $option['min'] : null, |
|
222 | - 'max' => isset( $option['max'] ) ? $option['max'] : null, |
|
223 | - 'step' => isset( $option['step'] ) ? $option['step'] : null, |
|
224 | - 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null, |
|
225 | - 'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true, |
|
226 | - 'readonly' => isset( $option['readonly'] ) ? $option['readonly'] : false, |
|
227 | - 'faux' => isset( $option['faux'] ) ? $option['faux'] : false, |
|
228 | - 'onchange' => isset( $option['onchange'] ) ? $option['onchange'] : '', |
|
229 | - 'custom' => isset( $option['custom'] ) ? $option['custom'] : '', |
|
230 | - 'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
231 | - 'cols' => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
|
232 | - 'rows' => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
|
217 | + 'size' => isset($option['size']) ? $option['size'] : null, |
|
218 | + 'options' => isset($option['options']) ? $option['options'] : '', |
|
219 | + 'selected' => isset($option['selected']) ? $option['selected'] : null, |
|
220 | + 'std' => isset($option['std']) ? $option['std'] : '', |
|
221 | + 'min' => isset($option['min']) ? $option['min'] : null, |
|
222 | + 'max' => isset($option['max']) ? $option['max'] : null, |
|
223 | + 'step' => isset($option['step']) ? $option['step'] : null, |
|
224 | + 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null, |
|
225 | + 'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true, |
|
226 | + 'readonly' => isset($option['readonly']) ? $option['readonly'] : false, |
|
227 | + 'faux' => isset($option['faux']) ? $option['faux'] : false, |
|
228 | + 'onchange' => isset($option['onchange']) ? $option['onchange'] : '', |
|
229 | + 'custom' => isset($option['custom']) ? $option['custom'] : '', |
|
230 | + 'class' => isset($option['class']) ? $option['class'] : '', |
|
231 | + 'cols' => isset($option['cols']) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
|
232 | + 'rows' => isset($option['rows']) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
|
233 | 233 | ) |
234 | 234 | ); |
235 | 235 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @return array |
242 | 242 | */ |
243 | 243 | function wpinv_get_registered_settings() { |
244 | - return apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ); |
|
244 | + return apply_filters('wpinv_registered_settings', wpinv_get_data('admin-settings')); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -249,134 +249,134 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return array |
251 | 251 | */ |
252 | -function wpinv_settings_sanitize( $input = array() ) { |
|
252 | +function wpinv_settings_sanitize($input = array()) { |
|
253 | 253 | |
254 | 254 | $wpinv_options = wpinv_get_options(); |
255 | 255 | |
256 | - if ( empty( wp_get_raw_referer() ) ) { |
|
256 | + if (empty(wp_get_raw_referer())) { |
|
257 | 257 | return $input; |
258 | 258 | } |
259 | 259 | |
260 | - wp_parse_str( wp_get_raw_referer(), $referrer ); |
|
260 | + wp_parse_str(wp_get_raw_referer(), $referrer); |
|
261 | 261 | |
262 | 262 | $settings = wpinv_get_registered_settings(); |
263 | - $tab = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general'; |
|
264 | - $section = isset( $referrer['section'] ) ? $referrer['section'] : 'main'; |
|
263 | + $tab = isset($referrer['tab']) ? $referrer['tab'] : 'general'; |
|
264 | + $section = isset($referrer['section']) ? $referrer['section'] : 'main'; |
|
265 | 265 | |
266 | 266 | $input = $input ? $input : array(); |
267 | - $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input ); |
|
268 | - $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input ); |
|
267 | + $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input); |
|
268 | + $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input); |
|
269 | 269 | |
270 | 270 | // Loop through each setting being saved and pass it through a sanitization filter |
271 | - foreach ( $input as $key => $value ) { |
|
271 | + foreach ($input as $key => $value) { |
|
272 | 272 | |
273 | 273 | // Get the setting type (checkbox, select, etc) |
274 | - $type = isset( $settings[ $tab ][$section][ $key ]['type'] ) ? $settings[ $tab ][$section][ $key ]['type'] : false; |
|
274 | + $type = isset($settings[$tab][$section][$key]['type']) ? $settings[$tab][$section][$key]['type'] : false; |
|
275 | 275 | |
276 | - if ( $type ) { |
|
276 | + if ($type) { |
|
277 | 277 | // Field type specific filter |
278 | - $input[$key] = apply_filters( 'wpinv_settings_sanitize_' . $type, $value, $key ); |
|
278 | + $input[$key] = apply_filters('wpinv_settings_sanitize_' . $type, $value, $key); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | // General filter |
282 | - $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
282 | + $input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | // Loop through the whitelist and unset any that are empty for the tab being saved |
286 | - $main_settings = $section == 'main' ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections |
|
287 | - $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array(); |
|
286 | + $main_settings = $section == 'main' ? $settings[$tab] : array(); // Check for extensions that aren't using new sections |
|
287 | + $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array(); |
|
288 | 288 | |
289 | - $found_settings = array_merge( $main_settings, $section_settings ); |
|
289 | + $found_settings = array_merge($main_settings, $section_settings); |
|
290 | 290 | |
291 | - if ( ! empty( $found_settings ) ) { |
|
292 | - foreach ( $found_settings as $key => $value ) { |
|
291 | + if (!empty($found_settings)) { |
|
292 | + foreach ($found_settings as $key => $value) { |
|
293 | 293 | |
294 | 294 | // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work |
295 | - if ( is_numeric( $key ) ) { |
|
295 | + if (is_numeric($key)) { |
|
296 | 296 | $key = $value['id']; |
297 | 297 | } |
298 | 298 | |
299 | - if ( ! isset( $input[ $key ] ) && isset( $wpinv_options[ $key ] ) ) { |
|
300 | - unset( $wpinv_options[ $key ] ); |
|
299 | + if (!isset($input[$key]) && isset($wpinv_options[$key])) { |
|
300 | + unset($wpinv_options[$key]); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | } |
304 | 304 | |
305 | 305 | // Merge our new settings with the existing |
306 | - $output = array_merge( $wpinv_options, $input ); |
|
306 | + $output = array_merge($wpinv_options, $input); |
|
307 | 307 | |
308 | - add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' ); |
|
308 | + add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated'); |
|
309 | 309 | |
310 | 310 | return $output; |
311 | 311 | } |
312 | 312 | |
313 | -function wpinv_settings_sanitize_misc_accounting( $input ) { |
|
313 | +function wpinv_settings_sanitize_misc_accounting($input) { |
|
314 | 314 | |
315 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
315 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
316 | 316 | return $input; |
317 | 317 | } |
318 | 318 | |
319 | - if( ! empty( $input['enable_sequential'] ) && !wpinv_get_option( 'enable_sequential' ) ) { |
|
319 | + if (!empty($input['enable_sequential']) && !wpinv_get_option('enable_sequential')) { |
|
320 | 320 | // Shows an admin notice about upgrading previous order numbers |
321 | - getpaid_session()->set( 'upgrade_sequential', '1' ); |
|
321 | + getpaid_session()->set('upgrade_sequential', '1'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | return $input; |
325 | 325 | } |
326 | -add_filter( 'wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting' ); |
|
326 | +add_filter('wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting'); |
|
327 | 327 | |
328 | -function wpinv_settings_sanitize_tax_rates( $input ) { |
|
329 | - if( ! wpinv_current_user_can_manage_invoicing() ) { |
|
328 | +function wpinv_settings_sanitize_tax_rates($input) { |
|
329 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
330 | 330 | return $input; |
331 | 331 | } |
332 | 332 | |
333 | - $new_rates = !empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array(); |
|
333 | + $new_rates = !empty($_POST['tax_rates']) ? array_values($_POST['tax_rates']) : array(); |
|
334 | 334 | |
335 | 335 | $tax_rates = array(); |
336 | 336 | |
337 | - if ( !empty( $new_rates ) ) { |
|
338 | - foreach ( $new_rates as $rate ) { |
|
339 | - if ( isset( $rate['country'] ) && empty( $rate['country'] ) && empty( $rate['state'] ) ) { |
|
337 | + if (!empty($new_rates)) { |
|
338 | + foreach ($new_rates as $rate) { |
|
339 | + if (isset($rate['country']) && empty($rate['country']) && empty($rate['state'])) { |
|
340 | 340 | continue; |
341 | 341 | } |
342 | 342 | |
343 | - $rate['rate'] = wpinv_sanitize_amount( $rate['rate'], 4 ); |
|
343 | + $rate['rate'] = wpinv_sanitize_amount($rate['rate'], 4); |
|
344 | 344 | |
345 | 345 | $tax_rates[] = $rate; |
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
349 | - update_option( 'wpinv_tax_rates', $tax_rates ); |
|
349 | + update_option('wpinv_tax_rates', $tax_rates); |
|
350 | 350 | |
351 | 351 | return $input; |
352 | 352 | } |
353 | -add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' ); |
|
353 | +add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates'); |
|
354 | 354 | |
355 | -function wpinv_sanitize_text_field( $input ) { |
|
356 | - return trim( $input ); |
|
355 | +function wpinv_sanitize_text_field($input) { |
|
356 | + return trim($input); |
|
357 | 357 | } |
358 | -add_filter( 'wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field' ); |
|
358 | +add_filter('wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field'); |
|
359 | 359 | |
360 | 360 | function wpinv_get_settings_tabs() { |
361 | 361 | $tabs = array(); |
362 | - $tabs['general'] = __( 'General', 'invoicing' ); |
|
363 | - $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' ); |
|
364 | - $tabs['taxes'] = __( 'Taxes', 'invoicing' ); |
|
365 | - $tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
366 | - $tabs['privacy'] = __( 'Privacy', 'invoicing' ); |
|
367 | - $tabs['misc'] = __( 'Misc', 'invoicing' ); |
|
368 | - $tabs['tools'] = __( 'Tools', 'invoicing' ); |
|
369 | - |
|
370 | - return apply_filters( 'wpinv_settings_tabs', $tabs ); |
|
362 | + $tabs['general'] = __('General', 'invoicing'); |
|
363 | + $tabs['gateways'] = __('Payment Gateways', 'invoicing'); |
|
364 | + $tabs['taxes'] = __('Taxes', 'invoicing'); |
|
365 | + $tabs['emails'] = __('Emails', 'invoicing'); |
|
366 | + $tabs['privacy'] = __('Privacy', 'invoicing'); |
|
367 | + $tabs['misc'] = __('Misc', 'invoicing'); |
|
368 | + $tabs['tools'] = __('Tools', 'invoicing'); |
|
369 | + |
|
370 | + return apply_filters('wpinv_settings_tabs', $tabs); |
|
371 | 371 | } |
372 | 372 | |
373 | -function wpinv_get_settings_tab_sections( $tab = false ) { |
|
373 | +function wpinv_get_settings_tab_sections($tab = false) { |
|
374 | 374 | $tabs = false; |
375 | 375 | $sections = wpinv_get_registered_settings_sections(); |
376 | 376 | |
377 | - if( $tab && ! empty( $sections[ $tab ] ) ) { |
|
378 | - $tabs = $sections[ $tab ]; |
|
379 | - } else if ( $tab ) { |
|
377 | + if ($tab && !empty($sections[$tab])) { |
|
378 | + $tabs = $sections[$tab]; |
|
379 | + } else if ($tab) { |
|
380 | 380 | $tabs = false; |
381 | 381 | } |
382 | 382 | |
@@ -386,150 +386,150 @@ discard block |
||
386 | 386 | function wpinv_get_registered_settings_sections() { |
387 | 387 | static $sections = false; |
388 | 388 | |
389 | - if ( false !== $sections ) { |
|
389 | + if (false !== $sections) { |
|
390 | 390 | return $sections; |
391 | 391 | } |
392 | 392 | |
393 | 393 | $sections = array( |
394 | - 'general' => apply_filters( 'wpinv_settings_sections_general', array( |
|
395 | - 'main' => __( 'General Settings', 'invoicing' ), |
|
396 | - 'currency_section' => __( 'Currency Settings', 'invoicing' ), |
|
397 | - 'labels' => __( 'Label Texts', 'invoicing' ), |
|
398 | - ) ), |
|
399 | - 'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array( |
|
400 | - 'main' => __( 'Gateway Settings', 'invoicing' ), |
|
401 | - ) ), |
|
402 | - 'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array( |
|
403 | - 'main' => __( 'Tax Settings', 'invoicing' ), |
|
404 | - 'rates' => __( 'Tax Rates', 'invoicing' ), |
|
405 | - ) ), |
|
406 | - 'emails' => apply_filters( 'wpinv_settings_sections_emails', array( |
|
407 | - 'main' => __( 'Email Settings', 'invoicing' ), |
|
408 | - ) ), |
|
409 | - 'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array( |
|
410 | - 'main' => __( 'Privacy policy', 'invoicing' ), |
|
411 | - ) ), |
|
412 | - 'misc' => apply_filters( 'wpinv_settings_sections_misc', array( |
|
413 | - 'main' => __( 'Miscellaneous', 'invoicing' ), |
|
414 | - 'fields' => __( 'Fields Settings', 'invoicing' ), |
|
415 | - 'custom-css' => __( 'Custom CSS', 'invoicing' ), |
|
416 | - ) ), |
|
417 | - 'tools' => apply_filters( 'wpinv_settings_sections_tools', array( |
|
418 | - 'main' => __( 'Diagnostic Tools', 'invoicing' ), |
|
419 | - ) ), |
|
394 | + 'general' => apply_filters('wpinv_settings_sections_general', array( |
|
395 | + 'main' => __('General Settings', 'invoicing'), |
|
396 | + 'currency_section' => __('Currency Settings', 'invoicing'), |
|
397 | + 'labels' => __('Label Texts', 'invoicing'), |
|
398 | + )), |
|
399 | + 'gateways' => apply_filters('wpinv_settings_sections_gateways', array( |
|
400 | + 'main' => __('Gateway Settings', 'invoicing'), |
|
401 | + )), |
|
402 | + 'taxes' => apply_filters('wpinv_settings_sections_taxes', array( |
|
403 | + 'main' => __('Tax Settings', 'invoicing'), |
|
404 | + 'rates' => __('Tax Rates', 'invoicing'), |
|
405 | + )), |
|
406 | + 'emails' => apply_filters('wpinv_settings_sections_emails', array( |
|
407 | + 'main' => __('Email Settings', 'invoicing'), |
|
408 | + )), |
|
409 | + 'privacy' => apply_filters('wpinv_settings_sections_privacy', array( |
|
410 | + 'main' => __('Privacy policy', 'invoicing'), |
|
411 | + )), |
|
412 | + 'misc' => apply_filters('wpinv_settings_sections_misc', array( |
|
413 | + 'main' => __('Miscellaneous', 'invoicing'), |
|
414 | + 'fields' => __('Fields Settings', 'invoicing'), |
|
415 | + 'custom-css' => __('Custom CSS', 'invoicing'), |
|
416 | + )), |
|
417 | + 'tools' => apply_filters('wpinv_settings_sections_tools', array( |
|
418 | + 'main' => __('Diagnostic Tools', 'invoicing'), |
|
419 | + )), |
|
420 | 420 | ); |
421 | 421 | |
422 | - $sections = apply_filters( 'wpinv_settings_sections', $sections ); |
|
422 | + $sections = apply_filters('wpinv_settings_sections', $sections); |
|
423 | 423 | |
424 | 424 | return $sections; |
425 | 425 | } |
426 | 426 | |
427 | -function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
|
427 | +function wpinv_get_pages($with_slug = false, $default_label = NULL) { |
|
428 | 428 | $pages_options = array(); |
429 | 429 | |
430 | - if( $default_label !== NULL && $default_label !== false ) { |
|
431 | - $pages_options = array( '' => $default_label ); // Blank option |
|
430 | + if ($default_label !== NULL && $default_label !== false) { |
|
431 | + $pages_options = array('' => $default_label); // Blank option |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | $pages = get_pages(); |
435 | - if ( $pages ) { |
|
436 | - foreach ( $pages as $page ) { |
|
435 | + if ($pages) { |
|
436 | + foreach ($pages as $page) { |
|
437 | 437 | $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
438 | - $pages_options[ $page->ID ] = $title; |
|
438 | + $pages_options[$page->ID] = $title; |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | |
442 | 442 | return $pages_options; |
443 | 443 | } |
444 | 444 | |
445 | -function wpinv_header_callback( $args ) { |
|
446 | - if ( !empty( $args['desc'] ) ) { |
|
445 | +function wpinv_header_callback($args) { |
|
446 | + if (!empty($args['desc'])) { |
|
447 | 447 | echo $args['desc']; |
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
451 | -function wpinv_hidden_callback( $args ) { |
|
451 | +function wpinv_hidden_callback($args) { |
|
452 | 452 | global $wpinv_options; |
453 | 453 | |
454 | - if ( isset( $args['set_value'] ) ) { |
|
454 | + if (isset($args['set_value'])) { |
|
455 | 455 | $value = $args['set_value']; |
456 | - } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
457 | - $value = $wpinv_options[ $args['id'] ]; |
|
456 | + } elseif (isset($wpinv_options[$args['id']])) { |
|
457 | + $value = $wpinv_options[$args['id']]; |
|
458 | 458 | } else { |
459 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
459 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
460 | 460 | } |
461 | 461 | |
462 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
462 | + if (isset($args['faux']) && true === $args['faux']) { |
|
463 | 463 | $args['readonly'] = true; |
464 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
464 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
465 | 465 | $name = ''; |
466 | 466 | } else { |
467 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
467 | + $name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"'; |
|
468 | 468 | } |
469 | 469 | |
470 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
470 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />'; |
|
471 | 471 | |
472 | 472 | echo $html; |
473 | 473 | } |
474 | 474 | |
475 | -function wpinv_checkbox_callback( $args ) { |
|
475 | +function wpinv_checkbox_callback($args) { |
|
476 | 476 | global $wpinv_options; |
477 | 477 | |
478 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
478 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
479 | 479 | |
480 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
480 | + if (isset($args['faux']) && true === $args['faux']) { |
|
481 | 481 | $name = ''; |
482 | 482 | } else { |
483 | 483 | $name = 'name="wpinv_settings[' . $sanitize_id . ']"'; |
484 | 484 | } |
485 | 485 | |
486 | - $std = isset( $args['std'] ) ? $args['std'] : 0; |
|
487 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
488 | - $checked = checked( empty( $value ), false, false ); |
|
486 | + $std = isset($args['std']) ? $args['std'] : 0; |
|
487 | + $value = isset($wpinv_options[$args['id']]) ? $wpinv_options[$args['id']] : $std; |
|
488 | + $checked = checked(empty($value), false, false); |
|
489 | 489 | |
490 | 490 | $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>'; |
491 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
491 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
492 | 492 | |
493 | 493 | echo $html; |
494 | 494 | } |
495 | 495 | |
496 | -function wpinv_multicheck_callback( $args ) { |
|
496 | +function wpinv_multicheck_callback($args) { |
|
497 | 497 | global $wpinv_options; |
498 | 498 | |
499 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
500 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
499 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
500 | + $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : ''; |
|
501 | 501 | |
502 | - if ( ! empty( $args['options'] ) ) { |
|
502 | + if (!empty($args['options'])) { |
|
503 | 503 | |
504 | - $std = isset( $args['std'] ) ? $args['std'] : array(); |
|
505 | - $value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
504 | + $std = isset($args['std']) ? $args['std'] : array(); |
|
505 | + $value = isset($wpinv_options[$args['id']]) ? $wpinv_options[$args['id']] : $std; |
|
506 | 506 | |
507 | 507 | echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
508 | - foreach( $args['options'] as $key => $option ): |
|
509 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
510 | - if ( in_array( $sanitize_key, $value ) ) { |
|
508 | + foreach ($args['options'] as $key => $option): |
|
509 | + $sanitize_key = wpinv_sanitize_key($key); |
|
510 | + if (in_array($sanitize_key, $value)) { |
|
511 | 511 | $enabled = $sanitize_key; |
512 | 512 | } else { |
513 | 513 | $enabled = NULL; |
514 | 514 | } |
515 | - echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
516 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
515 | + echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($sanitize_key) . '" ' . checked($sanitize_key, $enabled, false) . '/> '; |
|
516 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label></div>'; |
|
517 | 517 | endforeach; |
518 | 518 | echo '</div>'; |
519 | 519 | echo '<p class="description">' . $args['desc'] . '</p>'; |
520 | 520 | } |
521 | 521 | } |
522 | 522 | |
523 | -function wpinv_payment_icons_callback( $args ) { |
|
523 | +function wpinv_payment_icons_callback($args) { |
|
524 | 524 | global $wpinv_options; |
525 | 525 | |
526 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
526 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
527 | 527 | |
528 | - if ( ! empty( $args['options'] ) ) { |
|
529 | - foreach( $args['options'] as $key => $option ) { |
|
530 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
528 | + if (!empty($args['options'])) { |
|
529 | + foreach ($args['options'] as $key => $option) { |
|
530 | + $sanitize_key = wpinv_sanitize_key($key); |
|
531 | 531 | |
532 | - if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
532 | + if (isset($wpinv_options[$args['id']][$key])) { |
|
533 | 533 | $enabled = $option; |
534 | 534 | } else { |
535 | 535 | $enabled = NULL; |
@@ -537,197 +537,197 @@ discard block |
||
537 | 537 | |
538 | 538 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
539 | 539 | |
540 | - echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
540 | + echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($option) . '" ' . checked($option, $enabled, false) . '/> '; |
|
541 | 541 | |
542 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
543 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
542 | + if (wpinv_string_is_image_url($key)) { |
|
543 | + echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
544 | 544 | } else { |
545 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
545 | + $card = strtolower(str_replace(' ', '', $option)); |
|
546 | 546 | |
547 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
548 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
547 | + if (has_filter('wpinv_accepted_payment_' . $card . '_image')) { |
|
548 | + $image = apply_filters('wpinv_accepted_payment_' . $card . '_image', ''); |
|
549 | 549 | } else { |
550 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
550 | + $image = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false); |
|
551 | 551 | $content_dir = WP_CONTENT_DIR; |
552 | 552 | |
553 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
553 | + if (function_exists('wp_normalize_path')) { |
|
554 | 554 | // Replaces backslashes with forward slashes for Windows systems |
555 | - $image = wp_normalize_path( $image ); |
|
556 | - $content_dir = wp_normalize_path( $content_dir ); |
|
555 | + $image = wp_normalize_path($image); |
|
556 | + $content_dir = wp_normalize_path($content_dir); |
|
557 | 557 | } |
558 | 558 | |
559 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
559 | + $image = str_replace($content_dir, content_url(), $image); |
|
560 | 560 | } |
561 | 561 | |
562 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
562 | + echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
563 | 563 | } |
564 | 564 | echo $option . '</label>'; |
565 | 565 | } |
566 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
566 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>'; |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | -function wpinv_radio_callback( $args ) { |
|
570 | +function wpinv_radio_callback($args) { |
|
571 | 571 | global $wpinv_options; |
572 | 572 | |
573 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
573 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
574 | 574 | |
575 | - foreach ( $args['options'] as $key => $option ) : |
|
576 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
575 | + foreach ($args['options'] as $key => $option) : |
|
576 | + $sanitize_key = wpinv_sanitize_key($key); |
|
577 | 577 | |
578 | 578 | $checked = false; |
579 | 579 | |
580 | - if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
580 | + if (isset($wpinv_options[$args['id']]) && $wpinv_options[$args['id']] == $key) |
|
581 | 581 | $checked = true; |
582 | - elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
582 | + elseif (isset($args['std']) && $args['std'] == $key && !isset($wpinv_options[$args['id']])) |
|
583 | 583 | $checked = true; |
584 | 584 | |
585 | 585 | echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
586 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
|
586 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option) . '</label><br/>'; |
|
587 | 587 | endforeach; |
588 | 588 | |
589 | - echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
589 | + echo '<p class="description">' . wp_kses_post($args['desc']) . '</p>'; |
|
590 | 590 | } |
591 | 591 | |
592 | -function wpinv_gateways_callback( $args ) { |
|
592 | +function wpinv_gateways_callback($args) { |
|
593 | 593 | global $wpinv_options; |
594 | 594 | |
595 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
595 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
596 | 596 | |
597 | - foreach ( $args['options'] as $key => $option ) : |
|
598 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
597 | + foreach ($args['options'] as $key => $option) : |
|
598 | + $sanitize_key = wpinv_sanitize_key($key); |
|
599 | 599 | |
600 | - if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
|
600 | + if (isset($wpinv_options['gateways'][$key])) |
|
601 | 601 | $enabled = '1'; |
602 | 602 | else |
603 | 603 | $enabled = null; |
604 | 604 | |
605 | - echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
|
606 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
605 | + echo '<input name="wpinv_settings[' . esc_attr($args['id']) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
|
606 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option['admin_label']) . '</label><br/>'; |
|
607 | 607 | endforeach; |
608 | 608 | } |
609 | 609 | |
610 | 610 | function wpinv_gateway_select_callback($args) { |
611 | 611 | global $wpinv_options; |
612 | 612 | |
613 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
614 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
613 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
614 | + $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : ''; |
|
615 | 615 | |
616 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
616 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '" >'; |
|
617 | 617 | |
618 | - foreach ( $args['options'] as $key => $option ) : |
|
619 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
620 | - $selected = selected( $key, $args['selected'], false ); |
|
618 | + foreach ($args['options'] as $key => $option) : |
|
619 | + if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) { |
|
620 | + $selected = selected($key, $args['selected'], false); |
|
621 | 621 | } else { |
622 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : ''; |
|
622 | + $selected = isset($wpinv_options[$args['id']]) ? selected($key, $wpinv_options[$args['id']], false) : ''; |
|
623 | 623 | } |
624 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
624 | + echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>'; |
|
625 | 625 | endforeach; |
626 | 626 | |
627 | 627 | echo '</select>'; |
628 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
628 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
629 | 629 | } |
630 | 630 | |
631 | -function wpinv_text_callback( $args ) { |
|
631 | +function wpinv_text_callback($args) { |
|
632 | 632 | global $wpinv_options; |
633 | 633 | |
634 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
634 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
635 | 635 | |
636 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
637 | - $value = $wpinv_options[ $args['id'] ]; |
|
636 | + if (isset($wpinv_options[$args['id']])) { |
|
637 | + $value = $wpinv_options[$args['id']]; |
|
638 | 638 | } else { |
639 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
639 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
640 | 640 | } |
641 | 641 | |
642 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
642 | + if (isset($args['faux']) && true === $args['faux']) { |
|
643 | 643 | $args['readonly'] = true; |
644 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
644 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
645 | 645 | $name = ''; |
646 | 646 | } else { |
647 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
647 | + $name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"'; |
|
648 | 648 | } |
649 | - $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
649 | + $class = !empty($args['class']) ? sanitize_html_class($args['class']) : ''; |
|
650 | 650 | |
651 | 651 | $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; |
652 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
653 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>'; |
|
654 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
652 | + $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular'; |
|
653 | + $html = '<input type="text" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"' . $readonly . '/>'; |
|
654 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
655 | 655 | |
656 | 656 | echo $html; |
657 | 657 | } |
658 | 658 | |
659 | -function wpinv_number_callback( $args ) { |
|
659 | +function wpinv_number_callback($args) { |
|
660 | 660 | global $wpinv_options; |
661 | 661 | |
662 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
662 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
663 | 663 | |
664 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
665 | - $value = $wpinv_options[ $args['id'] ]; |
|
664 | + if (isset($wpinv_options[$args['id']])) { |
|
665 | + $value = $wpinv_options[$args['id']]; |
|
666 | 666 | } else { |
667 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
667 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
668 | 668 | } |
669 | 669 | |
670 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
670 | + if (isset($args['faux']) && true === $args['faux']) { |
|
671 | 671 | $args['readonly'] = true; |
672 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
672 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
673 | 673 | $name = ''; |
674 | 674 | } else { |
675 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
675 | + $name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"'; |
|
676 | 676 | } |
677 | 677 | |
678 | - $max = isset( $args['max'] ) ? $args['max'] : 999999; |
|
679 | - $min = isset( $args['min'] ) ? $args['min'] : 0; |
|
680 | - $step = isset( $args['step'] ) ? $args['step'] : 1; |
|
681 | - $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
678 | + $max = isset($args['max']) ? $args['max'] : 999999; |
|
679 | + $min = isset($args['min']) ? $args['min'] : 0; |
|
680 | + $step = isset($args['step']) ? $args['step'] : 1; |
|
681 | + $class = !empty($args['class']) ? sanitize_html_class($args['class']) : ''; |
|
682 | 682 | |
683 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
684 | - $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
685 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
683 | + $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular'; |
|
684 | + $html = '<input type="number" step="' . esc_attr($step) . '" max="' . esc_attr($max) . '" min="' . esc_attr($min) . '" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"/>'; |
|
685 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
686 | 686 | |
687 | 687 | echo $html; |
688 | 688 | } |
689 | 689 | |
690 | -function wpinv_textarea_callback( $args ) { |
|
690 | +function wpinv_textarea_callback($args) { |
|
691 | 691 | global $wpinv_options; |
692 | 692 | |
693 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
693 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
694 | 694 | |
695 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
696 | - $value = $wpinv_options[ $args['id'] ]; |
|
695 | + if (isset($wpinv_options[$args['id']])) { |
|
696 | + $value = $wpinv_options[$args['id']]; |
|
697 | 697 | } else { |
698 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
698 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
699 | 699 | } |
700 | 700 | |
701 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
702 | - $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
|
701 | + $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular'; |
|
702 | + $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text'; |
|
703 | 703 | |
704 | - $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
705 | - $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
704 | + $html = '<textarea class="' . sanitize_html_class($class) . ' txtarea-' . sanitize_html_class($size) . ' wpi-' . esc_attr(sanitize_html_class($sanitize_id)) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']">' . esc_textarea(stripslashes($value)) . '</textarea>'; |
|
705 | + $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
706 | 706 | |
707 | 707 | echo $html; |
708 | 708 | } |
709 | 709 | |
710 | -function wpinv_password_callback( $args ) { |
|
710 | +function wpinv_password_callback($args) { |
|
711 | 711 | global $wpinv_options; |
712 | 712 | |
713 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
713 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
714 | 714 | |
715 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
716 | - $value = $wpinv_options[ $args['id'] ]; |
|
715 | + if (isset($wpinv_options[$args['id']])) { |
|
716 | + $value = $wpinv_options[$args['id']]; |
|
717 | 717 | } else { |
718 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
718 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
719 | 719 | } |
720 | 720 | |
721 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
722 | - $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
723 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
721 | + $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular'; |
|
722 | + $html = '<input type="password" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '"/>'; |
|
723 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
724 | 724 | |
725 | 725 | echo $html; |
726 | 726 | } |
727 | 727 | |
728 | 728 | function wpinv_missing_callback($args) { |
729 | 729 | printf( |
730 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
730 | + __('The callback function used for the %s setting is missing.', 'invoicing'), |
|
731 | 731 | '<strong>' . $args['id'] . '</strong>' |
732 | 732 | ); |
733 | 733 | } |
@@ -735,134 +735,134 @@ discard block |
||
735 | 735 | function wpinv_select_callback($args) { |
736 | 736 | global $wpinv_options; |
737 | 737 | |
738 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
738 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
739 | 739 | |
740 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
741 | - $value = $wpinv_options[ $args['id'] ]; |
|
740 | + if (isset($wpinv_options[$args['id']])) { |
|
741 | + $value = $wpinv_options[$args['id']]; |
|
742 | 742 | } else { |
743 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
743 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
744 | 744 | } |
745 | 745 | |
746 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
746 | + if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) { |
|
747 | 747 | $value = $args['selected']; |
748 | 748 | } |
749 | 749 | |
750 | - if ( isset( $args['placeholder'] ) ) { |
|
750 | + if (isset($args['placeholder'])) { |
|
751 | 751 | $placeholder = $args['placeholder']; |
752 | 752 | } else { |
753 | 753 | $placeholder = ''; |
754 | 754 | } |
755 | 755 | |
756 | - if( !empty( $args['onchange'] ) ) { |
|
757 | - $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
|
756 | + if (!empty($args['onchange'])) { |
|
757 | + $onchange = ' onchange="' . esc_attr($args['onchange']) . '"'; |
|
758 | 758 | } else { |
759 | 759 | $onchange = ''; |
760 | 760 | } |
761 | 761 | |
762 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
762 | + $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : ''; |
|
763 | 763 | |
764 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />'; |
|
764 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '" name="wpinv_settings[' . esc_attr($args['id']) . ']" data-placeholder="' . esc_html($placeholder) . '"' . $onchange . ' />'; |
|
765 | 765 | |
766 | - foreach ( $args['options'] as $option => $name ) { |
|
767 | - $selected = selected( $option, $value, false ); |
|
768 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
766 | + foreach ($args['options'] as $option => $name) { |
|
767 | + $selected = selected($option, $value, false); |
|
768 | + $html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>'; |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | $html .= '</select>'; |
772 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
772 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
773 | 773 | |
774 | 774 | echo $html; |
775 | 775 | } |
776 | 776 | |
777 | -function wpinv_color_select_callback( $args ) { |
|
777 | +function wpinv_color_select_callback($args) { |
|
778 | 778 | global $wpinv_options; |
779 | 779 | |
780 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
780 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
781 | 781 | |
782 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
783 | - $value = $wpinv_options[ $args['id'] ]; |
|
782 | + if (isset($wpinv_options[$args['id']])) { |
|
783 | + $value = $wpinv_options[$args['id']]; |
|
784 | 784 | } else { |
785 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
785 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
786 | 786 | } |
787 | 787 | |
788 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
788 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>'; |
|
789 | 789 | |
790 | - foreach ( $args['options'] as $option => $color ) { |
|
791 | - $selected = selected( $option, $value, false ); |
|
792 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
790 | + foreach ($args['options'] as $option => $color) { |
|
791 | + $selected = selected($option, $value, false); |
|
792 | + $html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>'; |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | $html .= '</select>'; |
796 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
796 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
797 | 797 | |
798 | 798 | echo $html; |
799 | 799 | } |
800 | 800 | |
801 | -function wpinv_rich_editor_callback( $args ) { |
|
801 | +function wpinv_rich_editor_callback($args) { |
|
802 | 802 | global $wpinv_options, $wp_version; |
803 | 803 | |
804 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
804 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
805 | 805 | |
806 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
807 | - $value = $wpinv_options[ $args['id'] ]; |
|
806 | + if (isset($wpinv_options[$args['id']])) { |
|
807 | + $value = $wpinv_options[$args['id']]; |
|
808 | 808 | |
809 | - if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
810 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
809 | + if (empty($args['allow_blank']) && empty($value)) { |
|
810 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
811 | 811 | } |
812 | 812 | } else { |
813 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
813 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
814 | 814 | } |
815 | 815 | |
816 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
816 | + $rows = isset($args['size']) ? $args['size'] : 20; |
|
817 | 817 | |
818 | 818 | $html = '<div class="getpaid-settings-editor-input">'; |
819 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
819 | + if ($wp_version >= 3.3 && function_exists('wp_editor')) { |
|
820 | 820 | ob_start(); |
821 | - wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
821 | + wp_editor(stripslashes($value), 'wpinv_settings_' . esc_attr($args['id']), array('textarea_name' => 'wpinv_settings[' . esc_attr($args['id']) . ']', 'textarea_rows' => absint($rows), 'media_buttons' => false)); |
|
822 | 822 | $html .= ob_get_clean(); |
823 | 823 | } else { |
824 | - $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
824 | + $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" class="wpi-' . esc_attr(sanitize_html_class($args['id'])) . '">' . esc_textarea(stripslashes($value)) . '</textarea>'; |
|
825 | 825 | } |
826 | 826 | |
827 | - $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
827 | + $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
828 | 828 | |
829 | 829 | echo $html; |
830 | 830 | } |
831 | 831 | |
832 | -function wpinv_upload_callback( $args ) { |
|
832 | +function wpinv_upload_callback($args) { |
|
833 | 833 | global $wpinv_options; |
834 | 834 | |
835 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
835 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
836 | 836 | |
837 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
837 | + if (isset($wpinv_options[$args['id']])) { |
|
838 | 838 | $value = $wpinv_options[$args['id']]; |
839 | 839 | } else { |
840 | 840 | $value = isset($args['std']) ? $args['std'] : ''; |
841 | 841 | } |
842 | 842 | |
843 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
844 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
845 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
846 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
843 | + $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular'; |
|
844 | + $html = '<input type="text" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr(stripslashes($value)) . '"/>'; |
|
845 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>'; |
|
846 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
847 | 847 | |
848 | 848 | echo $html; |
849 | 849 | } |
850 | 850 | |
851 | -function wpinv_color_callback( $args ) { |
|
851 | +function wpinv_color_callback($args) { |
|
852 | 852 | global $wpinv_options; |
853 | 853 | |
854 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
854 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
855 | 855 | |
856 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
857 | - $value = $wpinv_options[ $args['id'] ]; |
|
856 | + if (isset($wpinv_options[$args['id']])) { |
|
857 | + $value = $wpinv_options[$args['id']]; |
|
858 | 858 | } else { |
859 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
859 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
860 | 860 | } |
861 | 861 | |
862 | - $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
862 | + $default = isset($args['std']) ? $args['std'] : ''; |
|
863 | 863 | |
864 | - $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
865 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
864 | + $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '" data-default-color="' . esc_attr($default) . '" />'; |
|
865 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
866 | 866 | |
867 | 867 | echo $html; |
868 | 868 | } |
@@ -870,9 +870,9 @@ discard block |
||
870 | 870 | function wpinv_country_states_callback($args) { |
871 | 871 | global $wpinv_options; |
872 | 872 | |
873 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
873 | + $sanitize_id = wpinv_sanitize_key($args['id']); |
|
874 | 874 | |
875 | - if ( isset( $args['placeholder'] ) ) { |
|
875 | + if (isset($args['placeholder'])) { |
|
876 | 876 | $placeholder = $args['placeholder']; |
877 | 877 | } else { |
878 | 878 | $placeholder = ''; |
@@ -880,16 +880,16 @@ discard block |
||
880 | 880 | |
881 | 881 | $states = wpinv_get_country_states(); |
882 | 882 | |
883 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
884 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
883 | + $class = empty($states) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
884 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"' . $class . 'data-placeholder="' . esc_html($placeholder) . '"/>'; |
|
885 | 885 | |
886 | - foreach ( $states as $option => $name ) { |
|
887 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
888 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
886 | + foreach ($states as $option => $name) { |
|
887 | + $selected = isset($wpinv_options[$args['id']]) ? selected($option, $wpinv_options[$args['id']], false) : ''; |
|
888 | + $html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>'; |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | $html .= '</select>'; |
892 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
892 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>'; |
|
893 | 893 | |
894 | 894 | echo $html; |
895 | 895 | } |
@@ -904,96 +904,96 @@ discard block |
||
904 | 904 | <table id="wpinv_tax_rates" class="wp-list-table widefat fixed posts"> |
905 | 905 | <thead> |
906 | 906 | <tr> |
907 | - <th scope="col" class="wpinv_tax_country"><?php _e( 'Country', 'invoicing' ); ?></th> |
|
908 | - <th scope="col" class="wpinv_tax_state"><?php _e( 'State / Province', 'invoicing' ); ?></th> |
|
909 | - <th scope="col" class="wpinv_tax_global" title="<?php esc_attr_e( 'Apply rate to whole country, regardless of state / province', 'invoicing' ); ?>"><?php _e( 'Country Wide', 'invoicing' ); ?></th> |
|
910 | - <th scope="col" class="wpinv_tax_rate"><?php _e( 'Rate %', 'invoicing' ); ?></th> |
|
911 | - <th scope="col" class="wpinv_tax_name"><?php _e( 'Tax Name', 'invoicing' ); ?></th> |
|
912 | - <th scope="col" class="wpinv_tax_action"><?php _e( 'Remove', 'invoicing' ); ?></th> |
|
907 | + <th scope="col" class="wpinv_tax_country"><?php _e('Country', 'invoicing'); ?></th> |
|
908 | + <th scope="col" class="wpinv_tax_state"><?php _e('State / Province', 'invoicing'); ?></th> |
|
909 | + <th scope="col" class="wpinv_tax_global" title="<?php esc_attr_e('Apply rate to whole country, regardless of state / province', 'invoicing'); ?>"><?php _e('Country Wide', 'invoicing'); ?></th> |
|
910 | + <th scope="col" class="wpinv_tax_rate"><?php _e('Rate %', 'invoicing'); ?></th> |
|
911 | + <th scope="col" class="wpinv_tax_name"><?php _e('Tax Name', 'invoicing'); ?></th> |
|
912 | + <th scope="col" class="wpinv_tax_action"><?php _e('Remove', 'invoicing'); ?></th> |
|
913 | 913 | </tr> |
914 | 914 | </thead> |
915 | 915 | <tbody> |
916 | - <?php if( !empty( $rates ) ) : ?> |
|
917 | - <?php foreach( $rates as $key => $rate ) : ?> |
|
916 | + <?php if (!empty($rates)) : ?> |
|
917 | + <?php foreach ($rates as $key => $rate) : ?> |
|
918 | 918 | <?php |
919 | - $sanitized_key = wpinv_sanitize_key( $key ); |
|
919 | + $sanitized_key = wpinv_sanitize_key($key); |
|
920 | 920 | ?> |
921 | 921 | <tr> |
922 | 922 | <td class="wpinv_tax_country"> |
923 | 923 | <?php |
924 | - echo wpinv_html_select( array( |
|
925 | - 'options' => wpinv_get_country_list( true ), |
|
924 | + echo wpinv_html_select(array( |
|
925 | + 'options' => wpinv_get_country_list(true), |
|
926 | 926 | 'name' => 'tax_rates[' . $sanitized_key . '][country]', |
927 | 927 | 'id' => 'tax_rates[' . $sanitized_key . '][country]', |
928 | 928 | 'selected' => $rate['country'], |
929 | 929 | 'show_option_all' => false, |
930 | 930 | 'show_option_none' => false, |
931 | 931 | 'class' => 'wpinv-tax-country wpi_select2', |
932 | - 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
933 | - ) ); |
|
932 | + 'placeholder' => __('Choose a country', 'invoicing') |
|
933 | + )); |
|
934 | 934 | ?> |
935 | 935 | </td> |
936 | 936 | <td class="wpinv_tax_state"> |
937 | 937 | <?php |
938 | - $states = wpinv_get_country_states( $rate['country'] ); |
|
939 | - if( !empty( $states ) ) { |
|
940 | - echo wpinv_html_select( array( |
|
941 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
938 | + $states = wpinv_get_country_states($rate['country']); |
|
939 | + if (!empty($states)) { |
|
940 | + echo wpinv_html_select(array( |
|
941 | + 'options' => array_merge(array('' => ''), $states), |
|
942 | 942 | 'name' => 'tax_rates[' . $sanitized_key . '][state]', |
943 | 943 | 'id' => 'tax_rates[' . $sanitized_key . '][state]', |
944 | 944 | 'selected' => $rate['state'], |
945 | 945 | 'show_option_all' => false, |
946 | 946 | 'show_option_none' => false, |
947 | 947 | 'class' => 'wpi_select2', |
948 | - 'placeholder' => __( 'Choose a state', 'invoicing' ) |
|
949 | - ) ); |
|
948 | + 'placeholder' => __('Choose a state', 'invoicing') |
|
949 | + )); |
|
950 | 950 | } else { |
951 | - echo wpinv_html_text( array( |
|
951 | + echo wpinv_html_text(array( |
|
952 | 952 | 'name' => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'], |
953 | - 'value' => ! empty( $rate['state'] ) ? $rate['state'] : '', |
|
953 | + 'value' => !empty($rate['state']) ? $rate['state'] : '', |
|
954 | 954 | 'id' => 'tax_rates[' . $sanitized_key . '][state]', |
955 | - ) ); |
|
955 | + )); |
|
956 | 956 | } |
957 | 957 | ?> |
958 | 958 | </td> |
959 | 959 | <td class="wpinv_tax_global"> |
960 | - <input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/> |
|
961 | - <label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label> |
|
960 | + <input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked(true, !empty($rate['global'])); ?>/> |
|
961 | + <label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label> |
|
962 | 962 | </td> |
963 | - <td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[<?php echo $sanitized_key; ?>][rate]" value="<?php echo esc_html( $rate['rate'] ); ?>"/></td> |
|
964 | - <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[<?php echo $sanitized_key; ?>][name]" value="<?php echo esc_html( $rate['name'] ); ?>"/></td> |
|
965 | - <td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td> |
|
963 | + <td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[<?php echo $sanitized_key; ?>][rate]" value="<?php echo esc_html($rate['rate']); ?>"/></td> |
|
964 | + <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[<?php echo $sanitized_key; ?>][name]" value="<?php echo esc_html($rate['name']); ?>"/></td> |
|
965 | + <td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td> |
|
966 | 966 | </tr> |
967 | 967 | <?php endforeach; ?> |
968 | 968 | <?php else : ?> |
969 | 969 | <tr> |
970 | 970 | <td class="wpinv_tax_country"> |
971 | 971 | <?php |
972 | - echo wpinv_html_select( array( |
|
973 | - 'options' => wpinv_get_country_list( true ), |
|
972 | + echo wpinv_html_select(array( |
|
973 | + 'options' => wpinv_get_country_list(true), |
|
974 | 974 | 'name' => 'tax_rates[0][country]', |
975 | 975 | 'show_option_all' => false, |
976 | 976 | 'show_option_none' => false, |
977 | 977 | 'class' => 'wpinv-tax-country wpi_select2', |
978 | - 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
979 | - ) ); ?> |
|
978 | + 'placeholder' => __('Choose a country', 'invoicing') |
|
979 | + )); ?> |
|
980 | 980 | </td> |
981 | 981 | <td class="wpinv_tax_state"> |
982 | - <?php echo wpinv_html_text( array( |
|
982 | + <?php echo wpinv_html_text(array( |
|
983 | 983 | 'name' => 'tax_rates[0][state]' |
984 | - ) ); ?> |
|
984 | + )); ?> |
|
985 | 985 | </td> |
986 | 986 | <td class="wpinv_tax_global"> |
987 | 987 | <input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/> |
988 | - <label for="tax_rates[0][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label> |
|
988 | + <label for="tax_rates[0][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label> |
|
989 | 989 | </td> |
990 | - <td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[0][rate]" placeholder="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>" value="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>"/></td> |
|
990 | + <td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[0][rate]" placeholder="<?php echo (float) wpinv_get_option('tax_rate', 0); ?>" value="<?php echo (float) wpinv_get_option('tax_rate', 0); ?>"/></td> |
|
991 | 991 | <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[0][name]" /></td> |
992 | - <td><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td> |
|
992 | + <td><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td> |
|
993 | 993 | </tr> |
994 | 994 | <?php endif; ?> |
995 | 995 | </tbody> |
996 | - <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot> |
|
996 | + <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e('Add Tax Rate', 'invoicing'); ?></span></td></tr></tfoot> |
|
997 | 997 | </table> |
998 | 998 | <?php |
999 | 999 | echo ob_get_clean(); |
@@ -1004,76 +1004,76 @@ discard block |
||
1004 | 1004 | ob_start(); ?> |
1005 | 1005 | </td><tr> |
1006 | 1006 | <td colspan="2" class="wpinv_tools_tdbox"> |
1007 | - <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?> |
|
1008 | - <?php do_action( 'wpinv_tools_before' ); ?> |
|
1007 | + <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?> |
|
1008 | + <?php do_action('wpinv_tools_before'); ?> |
|
1009 | 1009 | <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts"> |
1010 | 1010 | <thead> |
1011 | 1011 | <tr> |
1012 | - <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th> |
|
1013 | - <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th> |
|
1014 | - <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th> |
|
1012 | + <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th> |
|
1013 | + <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th> |
|
1014 | + <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th> |
|
1015 | 1015 | </tr> |
1016 | 1016 | </thead> |
1017 | - <?php do_action( 'wpinv_tools_row' ); ?> |
|
1017 | + <?php do_action('wpinv_tools_row'); ?> |
|
1018 | 1018 | <tbody> |
1019 | 1019 | </tbody> |
1020 | 1020 | </table> |
1021 | - <?php do_action( 'wpinv_tools_after' ); ?> |
|
1021 | + <?php do_action('wpinv_tools_after'); ?> |
|
1022 | 1022 | <?php |
1023 | 1023 | echo ob_get_clean(); |
1024 | 1024 | } |
1025 | 1025 | |
1026 | -function wpinv_descriptive_text_callback( $args ) { |
|
1027 | - echo wp_kses_post( $args['desc'] ); |
|
1026 | +function wpinv_descriptive_text_callback($args) { |
|
1027 | + echo wp_kses_post($args['desc']); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | -function wpinv_hook_callback( $args ) { |
|
1031 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
1030 | +function wpinv_hook_callback($args) { |
|
1031 | + do_action('wpinv_' . $args['id'], $args); |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | function wpinv_set_settings_cap() { |
1035 | 1035 | return wpinv_get_capability(); |
1036 | 1036 | } |
1037 | -add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
|
1037 | +add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap'); |
|
1038 | 1038 | |
1039 | -function wpinv_settings_sanitize_input( $value, $key ) { |
|
1040 | - if ( $key == 'tax_rate' || $key == 'eu_fallback_rate' ) { |
|
1041 | - $value = wpinv_sanitize_amount( $value, 4 ); |
|
1039 | +function wpinv_settings_sanitize_input($value, $key) { |
|
1040 | + if ($key == 'tax_rate' || $key == 'eu_fallback_rate') { |
|
1041 | + $value = wpinv_sanitize_amount($value, 4); |
|
1042 | 1042 | $value = $value >= 100 ? 99 : $value; |
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | return $value; |
1046 | 1046 | } |
1047 | -add_filter( 'wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2 ); |
|
1047 | +add_filter('wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2); |
|
1048 | 1048 | |
1049 | -function wpinv_on_update_settings( $old_value, $value, $option ) { |
|
1050 | - $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : ''; |
|
1051 | - $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : ''; |
|
1049 | +function wpinv_on_update_settings($old_value, $value, $option) { |
|
1050 | + $old = !empty($old_value['remove_data_on_unistall']) ? 1 : ''; |
|
1051 | + $new = !empty($value['remove_data_on_unistall']) ? 1 : ''; |
|
1052 | 1052 | |
1053 | - if ( $old != $new ) { |
|
1054 | - update_option( 'wpinv_remove_data_on_invoice_unistall', $new ); |
|
1053 | + if ($old != $new) { |
|
1054 | + update_option('wpinv_remove_data_on_invoice_unistall', $new); |
|
1055 | 1055 | } |
1056 | 1056 | } |
1057 | -add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 ); |
|
1058 | -add_action( 'wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1059 | -add_action( 'wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1060 | -add_action( 'wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1061 | -add_action( 'wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1062 | -add_action( 'wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1063 | -add_action( 'wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1064 | -add_action( 'wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1065 | -add_action( 'wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1066 | -add_action( 'wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1067 | -add_action( 'wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1068 | - |
|
1069 | -function wpinv_settings_tab_bottom_emails( $active_tab, $section ) { |
|
1057 | +add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3); |
|
1058 | +add_action('wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1059 | +add_action('wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1060 | +add_action('wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1061 | +add_action('wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1062 | +add_action('wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1063 | +add_action('wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1064 | +add_action('wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1065 | +add_action('wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1066 | +add_action('wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1067 | +add_action('wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2); |
|
1068 | + |
|
1069 | +function wpinv_settings_tab_bottom_emails($active_tab, $section) { |
|
1070 | 1070 | ?> |
1071 | 1071 | <div class="wpinv-email-wc-row "> |
1072 | 1072 | <div class="wpinv-email-wc-td"> |
1073 | - <h3 class="wpinv-email-wc-title"><?php echo apply_filters( 'wpinv_settings_email_wildcards_title', __( 'Wildcards For Emails', 'invoicing' ) ); ?></h3> |
|
1073 | + <h3 class="wpinv-email-wc-title"><?php echo apply_filters('wpinv_settings_email_wildcards_title', __('Wildcards For Emails', 'invoicing')); ?></h3> |
|
1074 | 1074 | <p class="wpinv-email-wc-description"> |
1075 | 1075 | <?php |
1076 | - $description = __( 'The following wildcards can be used in email subjects, heading and content:<br> |
|
1076 | + $description = __('The following wildcards can be used in email subjects, heading and content:<br> |
|
1077 | 1077 | <strong>{site_title} :</strong> Site Title<br> |
1078 | 1078 | <strong>{name} :</strong> Customer\'s full name<br> |
1079 | 1079 | <strong>{first_name} :</strong> Customer\'s first name<br> |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | <strong>{invoice_due_date} :</strong> The date the invoice is due<br> |
1088 | 1088 | <strong>{date} :</strong> Today\'s date.<br> |
1089 | 1089 | <strong>{is_was} :</strong> If due date of invoice is past, displays "was" otherwise displays "is"<br> |
1090 | - <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing' ); |
|
1090 | + <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing'); |
|
1091 | 1091 | echo apply_filters('wpinv_settings_email_wildcards_description', $description, $active_tab, $section); |
1092 | 1092 | ?> |
1093 | 1093 | </p> |
@@ -14,438 +14,438 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class WPInv_Plugin { |
16 | 16 | |
17 | - /** |
|
18 | - * GetPaid version. |
|
19 | - * |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - public $version; |
|
23 | - |
|
24 | - /** |
|
25 | - * Data container. |
|
26 | - * |
|
27 | - * @var array |
|
28 | - */ |
|
29 | - protected $data = array(); |
|
30 | - |
|
31 | - /** |
|
32 | - * Form elements instance. |
|
33 | - * |
|
34 | - * @var WPInv_Payment_Form_Elements |
|
35 | - */ |
|
36 | - public $form_elements; |
|
37 | - |
|
38 | - /** |
|
39 | - * Tax instance. |
|
40 | - * |
|
41 | - * @var WPInv_EUVat |
|
42 | - */ |
|
43 | - public $tax; |
|
44 | - |
|
45 | - /** |
|
46 | - * @param array An array of payment gateways. |
|
47 | - */ |
|
48 | - public $gateways; |
|
49 | - |
|
50 | - /** |
|
51 | - * Class constructor. |
|
52 | - */ |
|
53 | - public function __construct() { |
|
54 | - $this->define_constants(); |
|
55 | - $this->includes(); |
|
56 | - $this->init_hooks(); |
|
57 | - $this->set_properties(); |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Sets a custom data property. |
|
62 | - * |
|
63 | - * @param string $prop The prop to set. |
|
64 | - * @param mixed $value The value to retrieve. |
|
65 | - */ |
|
66 | - public function set( $prop, $value ) { |
|
67 | - $this->data[ $prop ] = $value; |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Gets a custom data property. |
|
72 | - * |
|
73 | - * @param string $prop The prop to set. |
|
74 | - * @return mixed The value. |
|
75 | - */ |
|
76 | - public function get( $prop ) { |
|
77 | - |
|
78 | - if ( isset( $this->data[ $prop ] ) ) { |
|
79 | - return $this->data[ $prop ]; |
|
80 | - } |
|
81 | - |
|
82 | - return null; |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * Define class properties. |
|
87 | - */ |
|
88 | - public function set_properties() { |
|
89 | - |
|
90 | - // Sessions. |
|
91 | - $this->set( 'session', new WPInv_Session_Handler() ); |
|
92 | - $GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility. |
|
93 | - $this->form_elements = new WPInv_Payment_Form_Elements(); |
|
94 | - $this->tax = new WPInv_EUVat(); |
|
95 | - $this->tax->init(); |
|
96 | - $GLOBALS['wpinv_euvat'] = $this->tax; // Backwards compatibility. |
|
97 | - |
|
98 | - // Init other objects. |
|
99 | - $this->set( 'reports', new WPInv_Reports() ); // TODO: Refactor. |
|
100 | - $this->set( 'session', new WPInv_Session_Handler() ); |
|
101 | - $this->set( 'notes', new WPInv_Notes() ); |
|
102 | - $this->set( 'api', new WPInv_API() ); |
|
103 | - $this->set( 'post_types', new GetPaid_Post_Types() ); |
|
104 | - $this->set( 'template', new GetPaid_Template() ); |
|
105 | - $this->set( 'admin', new GetPaid_Admin() ); |
|
106 | - $this->set( 'subscriptions', new WPInv_Subscriptions() ); |
|
107 | - $this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() ); |
|
108 | - |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * Define plugin constants. |
|
113 | - */ |
|
114 | - public function define_constants() { |
|
115 | - define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
116 | - define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
117 | - $this->version = WPINV_VERSION; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * Hook into actions and filters. |
|
122 | - * |
|
123 | - * @since 1.0.19 |
|
124 | - */ |
|
125 | - protected function init_hooks() { |
|
126 | - /* Internationalize the text strings used. */ |
|
127 | - add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
128 | - |
|
129 | - // Init the plugin after WordPress inits. |
|
130 | - add_action( 'init', array( $this, 'init' ), 1 ); |
|
131 | - add_action( 'getpaid_init', array( $this, 'maybe_process_ipn' ), 5 ); |
|
132 | - add_action( 'init', array( &$this, 'wpinv_actions' ) ); |
|
133 | - add_action( 'init', array( $this, 'maybe_do_authenticated_action' ) ); |
|
134 | - |
|
135 | - if ( class_exists( 'BuddyPress' ) ) { |
|
136 | - add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) ); |
|
137 | - } |
|
138 | - |
|
139 | - add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) ); |
|
140 | - add_action( 'wp_footer', array( &$this, 'wp_footer' ) ); |
|
141 | - add_action( 'widgets_init', array( &$this, 'register_widgets' ) ); |
|
142 | - add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) ); |
|
143 | - add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
144 | - |
|
145 | - // Fires after registering actions. |
|
146 | - do_action( 'wpinv_actions', $this ); |
|
147 | - do_action( 'getpaid_actions', $this ); |
|
148 | - |
|
149 | - } |
|
150 | - |
|
151 | - public function plugins_loaded() { |
|
152 | - /* Internationalize the text strings used. */ |
|
153 | - $this->load_textdomain(); |
|
154 | - |
|
155 | - do_action( 'wpinv_loaded' ); |
|
156 | - |
|
157 | - // Fix oxygen page builder conflict |
|
158 | - if ( function_exists( 'ct_css_output' ) ) { |
|
159 | - wpinv_oxygen_fix_conflict(); |
|
160 | - } |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * Load the translation of the plugin. |
|
165 | - * |
|
166 | - * @since 1.0 |
|
167 | - */ |
|
168 | - public function load_textdomain( $locale = NULL ) { |
|
169 | - if ( empty( $locale ) ) { |
|
170 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
171 | - } |
|
172 | - |
|
173 | - $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' ); |
|
174 | - |
|
175 | - unload_textdomain( 'invoicing' ); |
|
176 | - load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
177 | - load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
178 | - |
|
179 | - /** |
|
180 | - * Define language constants. |
|
181 | - */ |
|
182 | - require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * Include required core files used in admin and on the frontend. |
|
187 | - */ |
|
188 | - public function includes() { |
|
189 | - |
|
190 | - // Start with the settings. |
|
191 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
192 | - |
|
193 | - // Packages/libraries. |
|
194 | - require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' ); |
|
195 | - require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' ); |
|
196 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' ); |
|
197 | - |
|
198 | - // Load functions. |
|
199 | - require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' ); |
|
200 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
201 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
202 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
203 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
204 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
205 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
206 | - require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' ); |
|
207 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
208 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
209 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
210 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
211 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' ); |
|
212 | - require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' ); |
|
213 | - |
|
214 | - // Register autoloader. |
|
215 | - try { |
|
216 | - spl_autoload_register( array( $this, 'autoload' ), true ); |
|
217 | - } catch ( Exception $e ) { |
|
218 | - wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true ); |
|
219 | - } |
|
220 | - |
|
221 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' ); |
|
222 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' ); |
|
223 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
224 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
225 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' ); |
|
226 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' ); |
|
227 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
|
228 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
|
229 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
|
230 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' ); |
|
231 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' ); |
|
232 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
|
233 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
|
234 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
|
235 | - require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
236 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
237 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
238 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
239 | - require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
240 | - require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
|
241 | - require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' ); |
|
242 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' ); |
|
243 | - |
|
244 | - /** |
|
245 | - * Load the tax class. |
|
246 | - */ |
|
247 | - if ( ! class_exists( 'WPInv_EUVat' ) ) { |
|
248 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' ); |
|
249 | - } |
|
250 | - |
|
251 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
252 | - if ( !empty( $gateways ) ) { |
|
253 | - foreach ( $gateways as $gateway ) { |
|
254 | - if ( $gateway == 'manual' ) { |
|
255 | - continue; |
|
256 | - } |
|
257 | - |
|
258 | - $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php'; |
|
259 | - |
|
260 | - if ( file_exists( $gateway_file ) ) { |
|
261 | - require_once( $gateway_file ); |
|
262 | - } |
|
263 | - } |
|
264 | - } |
|
265 | - |
|
266 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
267 | - GetPaid_Post_Types_Admin::init(); |
|
268 | - |
|
269 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' ); |
|
270 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
271 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' ); |
|
272 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
273 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
274 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' ); |
|
275 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' ); |
|
276 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' ); |
|
277 | - // load the user class only on the users.php page |
|
278 | - global $pagenow; |
|
279 | - if($pagenow=='users.php'){ |
|
280 | - new WPInv_Admin_Users(); |
|
281 | - } |
|
282 | - } |
|
283 | - |
|
284 | - // Register cli commands |
|
285 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
286 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' ); |
|
287 | - WP_CLI::add_command( 'invoicing', 'WPInv_CLI' ); |
|
288 | - } |
|
289 | - |
|
290 | - // include css inliner |
|
291 | - if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) { |
|
292 | - include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' ); |
|
293 | - } |
|
294 | - |
|
295 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' ); |
|
296 | - } |
|
297 | - |
|
298 | - /** |
|
299 | - * Class autoloader |
|
300 | - * |
|
301 | - * @param string $class_name The name of the class to load. |
|
302 | - * @access public |
|
303 | - * @since 1.0.19 |
|
304 | - * @return void |
|
305 | - */ |
|
306 | - public function autoload( $class_name ) { |
|
307 | - |
|
308 | - // Normalize the class name... |
|
309 | - $class_name = strtolower( $class_name ); |
|
310 | - |
|
311 | - // ... and make sure it is our class. |
|
312 | - if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) { |
|
313 | - return; |
|
314 | - } |
|
315 | - |
|
316 | - // Next, prepare the file name from the class. |
|
317 | - $file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php'; |
|
318 | - |
|
319 | - // Base path of the classes. |
|
320 | - $plugin_path = untrailingslashit( WPINV_PLUGIN_DIR ); |
|
321 | - |
|
322 | - // And an array of possible locations in order of importance. |
|
323 | - $locations = array( |
|
324 | - "$plugin_path/includes", |
|
325 | - "$plugin_path/includes/data-stores", |
|
326 | - "$plugin_path/includes/gateways", |
|
327 | - "$plugin_path/includes/api", |
|
328 | - "$plugin_path/includes/admin", |
|
329 | - "$plugin_path/includes/admin/meta-boxes", |
|
330 | - ); |
|
331 | - |
|
332 | - foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) { |
|
333 | - |
|
334 | - if ( file_exists( trailingslashit( $location ) . $file_name ) ) { |
|
335 | - include trailingslashit( $location ) . $file_name; |
|
336 | - break; |
|
337 | - } |
|
338 | - |
|
339 | - } |
|
340 | - |
|
341 | - } |
|
342 | - |
|
343 | - /** |
|
344 | - * Inits hooks etc. |
|
345 | - */ |
|
346 | - public function init() { |
|
347 | - |
|
348 | - // Fires before getpaid inits. |
|
349 | - do_action( 'before_getpaid_init', $this ); |
|
350 | - |
|
351 | - // Load default gateways. |
|
352 | - $gateways = apply_filters( |
|
353 | - 'getpaid_default_gateways', |
|
354 | - array( |
|
355 | - 'manual' => 'GetPaid_Manual_Gateway', |
|
356 | - 'paypal' => 'GetPaid_Paypal_Gateway', |
|
357 | - 'worldpay' => 'GetPaid_Worldpay_Gateway', |
|
358 | - 'bank_transfer' => 'GetPaid_Bank_Transfer_Gateway', |
|
359 | - 'authorizenet' => 'GetPaid_Authorize_Net_Gateway', |
|
360 | - ) |
|
361 | - ); |
|
362 | - |
|
363 | - foreach ( $gateways as $id => $class ) { |
|
364 | - $this->gateways[ $id ] = new $class(); |
|
365 | - } |
|
366 | - |
|
367 | - // Fires after getpaid inits. |
|
368 | - do_action( 'getpaid_init', $this ); |
|
369 | - |
|
370 | - } |
|
371 | - |
|
372 | - /** |
|
373 | - * Checks if this is an IPN request and processes it. |
|
374 | - */ |
|
375 | - public function maybe_process_ipn() { |
|
376 | - |
|
377 | - // Ensure that this is an IPN request. |
|
378 | - if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) { |
|
379 | - return; |
|
380 | - } |
|
381 | - |
|
382 | - $gateway = wpinv_clean( $_GET['wpi-gateway'] ); |
|
383 | - |
|
384 | - do_action( 'wpinv_verify_payment_ipn', $gateway ); |
|
385 | - do_action( "wpinv_verify_{$gateway}_ipn" ); |
|
386 | - exit; |
|
387 | - |
|
388 | - } |
|
389 | - |
|
390 | - public function enqueue_scripts() { |
|
391 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
392 | - |
|
393 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/invoice-front.css' ); |
|
394 | - wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), $version ); |
|
395 | - wp_enqueue_style( 'wpinv_front_style' ); |
|
396 | - |
|
397 | - // Register scripts |
|
398 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
399 | - wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ), filemtime( WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js' ) ); |
|
400 | - |
|
401 | - $localize = array(); |
|
402 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
403 | - $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
404 | - $localize['currency_symbol'] = wpinv_currency_symbol(); |
|
405 | - $localize['currency_pos'] = wpinv_currency_position(); |
|
406 | - $localize['thousand_sep'] = wpinv_thousands_separator(); |
|
407 | - $localize['decimal_sep'] = wpinv_decimal_separator(); |
|
408 | - $localize['decimals'] = wpinv_decimals(); |
|
409 | - $localize['txtComplete'] = __( 'Continue', 'invoicing' ); |
|
410 | - $localize['UseTaxes'] = wpinv_use_taxes(); |
|
411 | - $localize['checkoutNonce'] = wp_create_nonce( 'wpinv_checkout_nonce' ); |
|
412 | - $localize['formNonce'] = wp_create_nonce( 'getpaid_form_nonce' ); |
|
413 | - $localize['connectionError'] = __( 'Could not establish a connection to the server.', 'invoicing' ); |
|
414 | - |
|
415 | - $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
416 | - |
|
417 | - wp_enqueue_script( 'jquery-blockui' ); |
|
418 | - $autofill_api = wpinv_get_option('address_autofill_api'); |
|
419 | - $autofill_active = wpinv_get_option('address_autofill_active'); |
|
420 | - if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) { |
|
421 | - if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) { |
|
422 | - wp_dequeue_script( 'google-maps-api' ); |
|
423 | - } |
|
424 | - wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false ); |
|
425 | - wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true ); |
|
426 | - } |
|
427 | - |
|
428 | - wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' ); |
|
429 | - wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION ); |
|
430 | - |
|
431 | - wp_enqueue_script( 'wpinv-front-script' ); |
|
432 | - wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
433 | - |
|
434 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' ); |
|
435 | - wp_enqueue_script( 'wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'wpinv-front-script', 'wp-hooks' ), $version, true ); |
|
436 | - } |
|
437 | - |
|
438 | - public function wpinv_actions() { |
|
439 | - if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
440 | - do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
441 | - } |
|
442 | - } |
|
443 | - |
|
444 | - /** |
|
17 | + /** |
|
18 | + * GetPaid version. |
|
19 | + * |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + public $version; |
|
23 | + |
|
24 | + /** |
|
25 | + * Data container. |
|
26 | + * |
|
27 | + * @var array |
|
28 | + */ |
|
29 | + protected $data = array(); |
|
30 | + |
|
31 | + /** |
|
32 | + * Form elements instance. |
|
33 | + * |
|
34 | + * @var WPInv_Payment_Form_Elements |
|
35 | + */ |
|
36 | + public $form_elements; |
|
37 | + |
|
38 | + /** |
|
39 | + * Tax instance. |
|
40 | + * |
|
41 | + * @var WPInv_EUVat |
|
42 | + */ |
|
43 | + public $tax; |
|
44 | + |
|
45 | + /** |
|
46 | + * @param array An array of payment gateways. |
|
47 | + */ |
|
48 | + public $gateways; |
|
49 | + |
|
50 | + /** |
|
51 | + * Class constructor. |
|
52 | + */ |
|
53 | + public function __construct() { |
|
54 | + $this->define_constants(); |
|
55 | + $this->includes(); |
|
56 | + $this->init_hooks(); |
|
57 | + $this->set_properties(); |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Sets a custom data property. |
|
62 | + * |
|
63 | + * @param string $prop The prop to set. |
|
64 | + * @param mixed $value The value to retrieve. |
|
65 | + */ |
|
66 | + public function set( $prop, $value ) { |
|
67 | + $this->data[ $prop ] = $value; |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Gets a custom data property. |
|
72 | + * |
|
73 | + * @param string $prop The prop to set. |
|
74 | + * @return mixed The value. |
|
75 | + */ |
|
76 | + public function get( $prop ) { |
|
77 | + |
|
78 | + if ( isset( $this->data[ $prop ] ) ) { |
|
79 | + return $this->data[ $prop ]; |
|
80 | + } |
|
81 | + |
|
82 | + return null; |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * Define class properties. |
|
87 | + */ |
|
88 | + public function set_properties() { |
|
89 | + |
|
90 | + // Sessions. |
|
91 | + $this->set( 'session', new WPInv_Session_Handler() ); |
|
92 | + $GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility. |
|
93 | + $this->form_elements = new WPInv_Payment_Form_Elements(); |
|
94 | + $this->tax = new WPInv_EUVat(); |
|
95 | + $this->tax->init(); |
|
96 | + $GLOBALS['wpinv_euvat'] = $this->tax; // Backwards compatibility. |
|
97 | + |
|
98 | + // Init other objects. |
|
99 | + $this->set( 'reports', new WPInv_Reports() ); // TODO: Refactor. |
|
100 | + $this->set( 'session', new WPInv_Session_Handler() ); |
|
101 | + $this->set( 'notes', new WPInv_Notes() ); |
|
102 | + $this->set( 'api', new WPInv_API() ); |
|
103 | + $this->set( 'post_types', new GetPaid_Post_Types() ); |
|
104 | + $this->set( 'template', new GetPaid_Template() ); |
|
105 | + $this->set( 'admin', new GetPaid_Admin() ); |
|
106 | + $this->set( 'subscriptions', new WPInv_Subscriptions() ); |
|
107 | + $this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() ); |
|
108 | + |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * Define plugin constants. |
|
113 | + */ |
|
114 | + public function define_constants() { |
|
115 | + define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
116 | + define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
117 | + $this->version = WPINV_VERSION; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * Hook into actions and filters. |
|
122 | + * |
|
123 | + * @since 1.0.19 |
|
124 | + */ |
|
125 | + protected function init_hooks() { |
|
126 | + /* Internationalize the text strings used. */ |
|
127 | + add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
128 | + |
|
129 | + // Init the plugin after WordPress inits. |
|
130 | + add_action( 'init', array( $this, 'init' ), 1 ); |
|
131 | + add_action( 'getpaid_init', array( $this, 'maybe_process_ipn' ), 5 ); |
|
132 | + add_action( 'init', array( &$this, 'wpinv_actions' ) ); |
|
133 | + add_action( 'init', array( $this, 'maybe_do_authenticated_action' ) ); |
|
134 | + |
|
135 | + if ( class_exists( 'BuddyPress' ) ) { |
|
136 | + add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) ); |
|
137 | + } |
|
138 | + |
|
139 | + add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) ); |
|
140 | + add_action( 'wp_footer', array( &$this, 'wp_footer' ) ); |
|
141 | + add_action( 'widgets_init', array( &$this, 'register_widgets' ) ); |
|
142 | + add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) ); |
|
143 | + add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
144 | + |
|
145 | + // Fires after registering actions. |
|
146 | + do_action( 'wpinv_actions', $this ); |
|
147 | + do_action( 'getpaid_actions', $this ); |
|
148 | + |
|
149 | + } |
|
150 | + |
|
151 | + public function plugins_loaded() { |
|
152 | + /* Internationalize the text strings used. */ |
|
153 | + $this->load_textdomain(); |
|
154 | + |
|
155 | + do_action( 'wpinv_loaded' ); |
|
156 | + |
|
157 | + // Fix oxygen page builder conflict |
|
158 | + if ( function_exists( 'ct_css_output' ) ) { |
|
159 | + wpinv_oxygen_fix_conflict(); |
|
160 | + } |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * Load the translation of the plugin. |
|
165 | + * |
|
166 | + * @since 1.0 |
|
167 | + */ |
|
168 | + public function load_textdomain( $locale = NULL ) { |
|
169 | + if ( empty( $locale ) ) { |
|
170 | + $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
171 | + } |
|
172 | + |
|
173 | + $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' ); |
|
174 | + |
|
175 | + unload_textdomain( 'invoicing' ); |
|
176 | + load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
177 | + load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
178 | + |
|
179 | + /** |
|
180 | + * Define language constants. |
|
181 | + */ |
|
182 | + require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * Include required core files used in admin and on the frontend. |
|
187 | + */ |
|
188 | + public function includes() { |
|
189 | + |
|
190 | + // Start with the settings. |
|
191 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
192 | + |
|
193 | + // Packages/libraries. |
|
194 | + require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' ); |
|
195 | + require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' ); |
|
196 | + require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' ); |
|
197 | + |
|
198 | + // Load functions. |
|
199 | + require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' ); |
|
200 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
201 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
202 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
203 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
204 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
205 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
206 | + require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' ); |
|
207 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
208 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
209 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
210 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
211 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' ); |
|
212 | + require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' ); |
|
213 | + |
|
214 | + // Register autoloader. |
|
215 | + try { |
|
216 | + spl_autoload_register( array( $this, 'autoload' ), true ); |
|
217 | + } catch ( Exception $e ) { |
|
218 | + wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true ); |
|
219 | + } |
|
220 | + |
|
221 | + require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' ); |
|
222 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' ); |
|
223 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
224 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
225 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' ); |
|
226 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' ); |
|
227 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
|
228 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
|
229 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
|
230 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' ); |
|
231 | + require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' ); |
|
232 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
|
233 | + require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
|
234 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
|
235 | + require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
236 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
237 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
238 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
239 | + require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
240 | + require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
|
241 | + require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' ); |
|
242 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' ); |
|
243 | + |
|
244 | + /** |
|
245 | + * Load the tax class. |
|
246 | + */ |
|
247 | + if ( ! class_exists( 'WPInv_EUVat' ) ) { |
|
248 | + require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' ); |
|
249 | + } |
|
250 | + |
|
251 | + $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
252 | + if ( !empty( $gateways ) ) { |
|
253 | + foreach ( $gateways as $gateway ) { |
|
254 | + if ( $gateway == 'manual' ) { |
|
255 | + continue; |
|
256 | + } |
|
257 | + |
|
258 | + $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php'; |
|
259 | + |
|
260 | + if ( file_exists( $gateway_file ) ) { |
|
261 | + require_once( $gateway_file ); |
|
262 | + } |
|
263 | + } |
|
264 | + } |
|
265 | + |
|
266 | + if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
267 | + GetPaid_Post_Types_Admin::init(); |
|
268 | + |
|
269 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' ); |
|
270 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
271 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' ); |
|
272 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
273 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
274 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' ); |
|
275 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' ); |
|
276 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' ); |
|
277 | + // load the user class only on the users.php page |
|
278 | + global $pagenow; |
|
279 | + if($pagenow=='users.php'){ |
|
280 | + new WPInv_Admin_Users(); |
|
281 | + } |
|
282 | + } |
|
283 | + |
|
284 | + // Register cli commands |
|
285 | + if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
286 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' ); |
|
287 | + WP_CLI::add_command( 'invoicing', 'WPInv_CLI' ); |
|
288 | + } |
|
289 | + |
|
290 | + // include css inliner |
|
291 | + if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) { |
|
292 | + include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' ); |
|
293 | + } |
|
294 | + |
|
295 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' ); |
|
296 | + } |
|
297 | + |
|
298 | + /** |
|
299 | + * Class autoloader |
|
300 | + * |
|
301 | + * @param string $class_name The name of the class to load. |
|
302 | + * @access public |
|
303 | + * @since 1.0.19 |
|
304 | + * @return void |
|
305 | + */ |
|
306 | + public function autoload( $class_name ) { |
|
307 | + |
|
308 | + // Normalize the class name... |
|
309 | + $class_name = strtolower( $class_name ); |
|
310 | + |
|
311 | + // ... and make sure it is our class. |
|
312 | + if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) { |
|
313 | + return; |
|
314 | + } |
|
315 | + |
|
316 | + // Next, prepare the file name from the class. |
|
317 | + $file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php'; |
|
318 | + |
|
319 | + // Base path of the classes. |
|
320 | + $plugin_path = untrailingslashit( WPINV_PLUGIN_DIR ); |
|
321 | + |
|
322 | + // And an array of possible locations in order of importance. |
|
323 | + $locations = array( |
|
324 | + "$plugin_path/includes", |
|
325 | + "$plugin_path/includes/data-stores", |
|
326 | + "$plugin_path/includes/gateways", |
|
327 | + "$plugin_path/includes/api", |
|
328 | + "$plugin_path/includes/admin", |
|
329 | + "$plugin_path/includes/admin/meta-boxes", |
|
330 | + ); |
|
331 | + |
|
332 | + foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) { |
|
333 | + |
|
334 | + if ( file_exists( trailingslashit( $location ) . $file_name ) ) { |
|
335 | + include trailingslashit( $location ) . $file_name; |
|
336 | + break; |
|
337 | + } |
|
338 | + |
|
339 | + } |
|
340 | + |
|
341 | + } |
|
342 | + |
|
343 | + /** |
|
344 | + * Inits hooks etc. |
|
345 | + */ |
|
346 | + public function init() { |
|
347 | + |
|
348 | + // Fires before getpaid inits. |
|
349 | + do_action( 'before_getpaid_init', $this ); |
|
350 | + |
|
351 | + // Load default gateways. |
|
352 | + $gateways = apply_filters( |
|
353 | + 'getpaid_default_gateways', |
|
354 | + array( |
|
355 | + 'manual' => 'GetPaid_Manual_Gateway', |
|
356 | + 'paypal' => 'GetPaid_Paypal_Gateway', |
|
357 | + 'worldpay' => 'GetPaid_Worldpay_Gateway', |
|
358 | + 'bank_transfer' => 'GetPaid_Bank_Transfer_Gateway', |
|
359 | + 'authorizenet' => 'GetPaid_Authorize_Net_Gateway', |
|
360 | + ) |
|
361 | + ); |
|
362 | + |
|
363 | + foreach ( $gateways as $id => $class ) { |
|
364 | + $this->gateways[ $id ] = new $class(); |
|
365 | + } |
|
366 | + |
|
367 | + // Fires after getpaid inits. |
|
368 | + do_action( 'getpaid_init', $this ); |
|
369 | + |
|
370 | + } |
|
371 | + |
|
372 | + /** |
|
373 | + * Checks if this is an IPN request and processes it. |
|
374 | + */ |
|
375 | + public function maybe_process_ipn() { |
|
376 | + |
|
377 | + // Ensure that this is an IPN request. |
|
378 | + if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) { |
|
379 | + return; |
|
380 | + } |
|
381 | + |
|
382 | + $gateway = wpinv_clean( $_GET['wpi-gateway'] ); |
|
383 | + |
|
384 | + do_action( 'wpinv_verify_payment_ipn', $gateway ); |
|
385 | + do_action( "wpinv_verify_{$gateway}_ipn" ); |
|
386 | + exit; |
|
387 | + |
|
388 | + } |
|
389 | + |
|
390 | + public function enqueue_scripts() { |
|
391 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
392 | + |
|
393 | + $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/invoice-front.css' ); |
|
394 | + wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), $version ); |
|
395 | + wp_enqueue_style( 'wpinv_front_style' ); |
|
396 | + |
|
397 | + // Register scripts |
|
398 | + wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
399 | + wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ), filemtime( WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js' ) ); |
|
400 | + |
|
401 | + $localize = array(); |
|
402 | + $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
403 | + $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
404 | + $localize['currency_symbol'] = wpinv_currency_symbol(); |
|
405 | + $localize['currency_pos'] = wpinv_currency_position(); |
|
406 | + $localize['thousand_sep'] = wpinv_thousands_separator(); |
|
407 | + $localize['decimal_sep'] = wpinv_decimal_separator(); |
|
408 | + $localize['decimals'] = wpinv_decimals(); |
|
409 | + $localize['txtComplete'] = __( 'Continue', 'invoicing' ); |
|
410 | + $localize['UseTaxes'] = wpinv_use_taxes(); |
|
411 | + $localize['checkoutNonce'] = wp_create_nonce( 'wpinv_checkout_nonce' ); |
|
412 | + $localize['formNonce'] = wp_create_nonce( 'getpaid_form_nonce' ); |
|
413 | + $localize['connectionError'] = __( 'Could not establish a connection to the server.', 'invoicing' ); |
|
414 | + |
|
415 | + $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
416 | + |
|
417 | + wp_enqueue_script( 'jquery-blockui' ); |
|
418 | + $autofill_api = wpinv_get_option('address_autofill_api'); |
|
419 | + $autofill_active = wpinv_get_option('address_autofill_active'); |
|
420 | + if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) { |
|
421 | + if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) { |
|
422 | + wp_dequeue_script( 'google-maps-api' ); |
|
423 | + } |
|
424 | + wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false ); |
|
425 | + wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true ); |
|
426 | + } |
|
427 | + |
|
428 | + wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' ); |
|
429 | + wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION ); |
|
430 | + |
|
431 | + wp_enqueue_script( 'wpinv-front-script' ); |
|
432 | + wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
433 | + |
|
434 | + $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' ); |
|
435 | + wp_enqueue_script( 'wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'wpinv-front-script', 'wp-hooks' ), $version, true ); |
|
436 | + } |
|
437 | + |
|
438 | + public function wpinv_actions() { |
|
439 | + if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
440 | + do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
441 | + } |
|
442 | + } |
|
443 | + |
|
444 | + /** |
|
445 | 445 | * Fires an action after verifying that a user can fire them. |
446 | - * |
|
447 | - * Note: If the action is on an invoice, subscription etc, esure that the |
|
448 | - * current user owns the invoice/subscription. |
|
446 | + * |
|
447 | + * Note: If the action is on an invoice, subscription etc, esure that the |
|
448 | + * current user owns the invoice/subscription. |
|
449 | 449 | */ |
450 | 450 | public function maybe_do_authenticated_action() { |
451 | 451 | |
@@ -456,82 +456,82 @@ discard block |
||
456 | 456 | |
457 | 457 | } |
458 | 458 | |
459 | - public function pre_get_posts( $wp_query ) { |
|
460 | - if ( ! is_admin() && !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) { |
|
461 | - $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() ); |
|
462 | - } |
|
463 | - |
|
464 | - return $wp_query; |
|
465 | - } |
|
466 | - |
|
467 | - public function bp_invoicing_init() { |
|
468 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
|
469 | - } |
|
470 | - |
|
471 | - /** |
|
472 | - * Register widgets |
|
473 | - * |
|
474 | - */ |
|
475 | - public function register_widgets() { |
|
476 | - $widgets = apply_filters( |
|
477 | - 'getpaid_widget_classes', |
|
478 | - array( |
|
479 | - 'WPInv_Checkout_Widget', |
|
480 | - 'WPInv_History_Widget', |
|
481 | - 'WPInv_Receipt_Widget', |
|
482 | - 'WPInv_Subscriptions_Widget', |
|
483 | - 'WPInv_Buy_Item_Widget', |
|
484 | - 'WPInv_Messages_Widget', |
|
485 | - 'WPInv_GetPaid_Widget' |
|
486 | - ) |
|
487 | - ); |
|
488 | - |
|
489 | - foreach ( $widgets as $widget ) { |
|
490 | - register_widget( $widget ); |
|
491 | - } |
|
459 | + public function pre_get_posts( $wp_query ) { |
|
460 | + if ( ! is_admin() && !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) { |
|
461 | + $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() ); |
|
462 | + } |
|
463 | + |
|
464 | + return $wp_query; |
|
465 | + } |
|
466 | + |
|
467 | + public function bp_invoicing_init() { |
|
468 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
|
469 | + } |
|
470 | + |
|
471 | + /** |
|
472 | + * Register widgets |
|
473 | + * |
|
474 | + */ |
|
475 | + public function register_widgets() { |
|
476 | + $widgets = apply_filters( |
|
477 | + 'getpaid_widget_classes', |
|
478 | + array( |
|
479 | + 'WPInv_Checkout_Widget', |
|
480 | + 'WPInv_History_Widget', |
|
481 | + 'WPInv_Receipt_Widget', |
|
482 | + 'WPInv_Subscriptions_Widget', |
|
483 | + 'WPInv_Buy_Item_Widget', |
|
484 | + 'WPInv_Messages_Widget', |
|
485 | + 'WPInv_GetPaid_Widget' |
|
486 | + ) |
|
487 | + ); |
|
488 | + |
|
489 | + foreach ( $widgets as $widget ) { |
|
490 | + register_widget( $widget ); |
|
491 | + } |
|
492 | 492 | |
493 | - } |
|
493 | + } |
|
494 | 494 | |
495 | - /** |
|
496 | - * Remove our pages from yoast sitemaps. |
|
497 | - * |
|
498 | - * @since 1.0.19 |
|
499 | - * @param int[] $excluded_posts_ids |
|
500 | - */ |
|
501 | - public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){ |
|
495 | + /** |
|
496 | + * Remove our pages from yoast sitemaps. |
|
497 | + * |
|
498 | + * @since 1.0.19 |
|
499 | + * @param int[] $excluded_posts_ids |
|
500 | + */ |
|
501 | + public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){ |
|
502 | 502 | |
503 | - // Ensure that we have an array. |
|
504 | - if ( ! is_array( $excluded_posts_ids ) ) { |
|
505 | - $excluded_posts_ids = array(); |
|
506 | - } |
|
503 | + // Ensure that we have an array. |
|
504 | + if ( ! is_array( $excluded_posts_ids ) ) { |
|
505 | + $excluded_posts_ids = array(); |
|
506 | + } |
|
507 | 507 | |
508 | - // Prepare our pages. |
|
509 | - $our_pages = array(); |
|
508 | + // Prepare our pages. |
|
509 | + $our_pages = array(); |
|
510 | 510 | |
511 | - // Checkout page. |
|
512 | - $our_pages[] = wpinv_get_option( 'checkout_page', false ); |
|
511 | + // Checkout page. |
|
512 | + $our_pages[] = wpinv_get_option( 'checkout_page', false ); |
|
513 | 513 | |
514 | - // Success page. |
|
515 | - $our_pages[] = wpinv_get_option( 'success_page', false ); |
|
514 | + // Success page. |
|
515 | + $our_pages[] = wpinv_get_option( 'success_page', false ); |
|
516 | 516 | |
517 | - // Failure page. |
|
518 | - $our_pages[] = wpinv_get_option( 'failure_page', false ); |
|
517 | + // Failure page. |
|
518 | + $our_pages[] = wpinv_get_option( 'failure_page', false ); |
|
519 | 519 | |
520 | - // History page. |
|
521 | - $our_pages[] = wpinv_get_option( 'invoice_history_page', false ); |
|
520 | + // History page. |
|
521 | + $our_pages[] = wpinv_get_option( 'invoice_history_page', false ); |
|
522 | 522 | |
523 | - // Subscriptions page. |
|
524 | - $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false ); |
|
523 | + // Subscriptions page. |
|
524 | + $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false ); |
|
525 | 525 | |
526 | - $our_pages = array_map( 'intval', array_filter( $our_pages ) ); |
|
526 | + $our_pages = array_map( 'intval', array_filter( $our_pages ) ); |
|
527 | 527 | |
528 | - $excluded_posts_ids = $excluded_posts_ids + $our_pages; |
|
529 | - return array_unique( $excluded_posts_ids ); |
|
528 | + $excluded_posts_ids = $excluded_posts_ids + $our_pages; |
|
529 | + return array_unique( $excluded_posts_ids ); |
|
530 | 530 | |
531 | - } |
|
531 | + } |
|
532 | 532 | |
533 | - public function wp_footer() { |
|
534 | - echo ' |
|
533 | + public function wp_footer() { |
|
534 | + echo ' |
|
535 | 535 | <div class="bsui"> |
536 | 536 | <div id="getpaid-payment-modal" class="modal" tabindex="-1" role="dialog"> |
537 | 537 | <div class="modal-dialog modal-dialog-centered modal-lg" role="checkout" style="max-width: 650px;"> |
@@ -542,6 +542,6 @@ discard block |
||
542 | 542 | </div> |
543 | 543 | </div> |
544 | 544 | '; |
545 | - } |
|
545 | + } |
|
546 | 546 | |
547 | 547 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @since 1.0.0 |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Main Invoicing class. |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param string $prop The prop to set. |
64 | 64 | * @param mixed $value The value to retrieve. |
65 | 65 | */ |
66 | - public function set( $prop, $value ) { |
|
67 | - $this->data[ $prop ] = $value; |
|
66 | + public function set($prop, $value) { |
|
67 | + $this->data[$prop] = $value; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * @param string $prop The prop to set. |
74 | 74 | * @return mixed The value. |
75 | 75 | */ |
76 | - public function get( $prop ) { |
|
76 | + public function get($prop) { |
|
77 | 77 | |
78 | - if ( isset( $this->data[ $prop ] ) ) { |
|
79 | - return $this->data[ $prop ]; |
|
78 | + if (isset($this->data[$prop])) { |
|
79 | + return $this->data[$prop]; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return null; |
@@ -88,23 +88,23 @@ discard block |
||
88 | 88 | public function set_properties() { |
89 | 89 | |
90 | 90 | // Sessions. |
91 | - $this->set( 'session', new WPInv_Session_Handler() ); |
|
92 | - $GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility. |
|
91 | + $this->set('session', new WPInv_Session_Handler()); |
|
92 | + $GLOBALS['wpi_session'] = $this->get('session'); // Backwards compatibility. |
|
93 | 93 | $this->form_elements = new WPInv_Payment_Form_Elements(); |
94 | 94 | $this->tax = new WPInv_EUVat(); |
95 | 95 | $this->tax->init(); |
96 | 96 | $GLOBALS['wpinv_euvat'] = $this->tax; // Backwards compatibility. |
97 | 97 | |
98 | 98 | // Init other objects. |
99 | - $this->set( 'reports', new WPInv_Reports() ); // TODO: Refactor. |
|
100 | - $this->set( 'session', new WPInv_Session_Handler() ); |
|
101 | - $this->set( 'notes', new WPInv_Notes() ); |
|
102 | - $this->set( 'api', new WPInv_API() ); |
|
103 | - $this->set( 'post_types', new GetPaid_Post_Types() ); |
|
104 | - $this->set( 'template', new GetPaid_Template() ); |
|
105 | - $this->set( 'admin', new GetPaid_Admin() ); |
|
106 | - $this->set( 'subscriptions', new WPInv_Subscriptions() ); |
|
107 | - $this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() ); |
|
99 | + $this->set('reports', new WPInv_Reports()); // TODO: Refactor. |
|
100 | + $this->set('session', new WPInv_Session_Handler()); |
|
101 | + $this->set('notes', new WPInv_Notes()); |
|
102 | + $this->set('api', new WPInv_API()); |
|
103 | + $this->set('post_types', new GetPaid_Post_Types()); |
|
104 | + $this->set('template', new GetPaid_Template()); |
|
105 | + $this->set('admin', new GetPaid_Admin()); |
|
106 | + $this->set('subscriptions', new WPInv_Subscriptions()); |
|
107 | + $this->set('invoice_emails', new GetPaid_Invoice_Notification_Emails()); |
|
108 | 108 | |
109 | 109 | } |
110 | 110 | |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * Define plugin constants. |
113 | 113 | */ |
114 | 114 | public function define_constants() { |
115 | - define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
116 | - define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
115 | + define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE)); |
|
116 | + define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE)); |
|
117 | 117 | $this->version = WPINV_VERSION; |
118 | 118 | } |
119 | 119 | |
@@ -124,27 +124,27 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function init_hooks() { |
126 | 126 | /* Internationalize the text strings used. */ |
127 | - add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
127 | + add_action('plugins_loaded', array(&$this, 'plugins_loaded')); |
|
128 | 128 | |
129 | 129 | // Init the plugin after WordPress inits. |
130 | - add_action( 'init', array( $this, 'init' ), 1 ); |
|
131 | - add_action( 'getpaid_init', array( $this, 'maybe_process_ipn' ), 5 ); |
|
132 | - add_action( 'init', array( &$this, 'wpinv_actions' ) ); |
|
133 | - add_action( 'init', array( $this, 'maybe_do_authenticated_action' ) ); |
|
130 | + add_action('init', array($this, 'init'), 1); |
|
131 | + add_action('getpaid_init', array($this, 'maybe_process_ipn'), 5); |
|
132 | + add_action('init', array(&$this, 'wpinv_actions')); |
|
133 | + add_action('init', array($this, 'maybe_do_authenticated_action')); |
|
134 | 134 | |
135 | - if ( class_exists( 'BuddyPress' ) ) { |
|
136 | - add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) ); |
|
135 | + if (class_exists('BuddyPress')) { |
|
136 | + add_action('bp_include', array(&$this, 'bp_invoicing_init')); |
|
137 | 137 | } |
138 | 138 | |
139 | - add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) ); |
|
140 | - add_action( 'wp_footer', array( &$this, 'wp_footer' ) ); |
|
141 | - add_action( 'widgets_init', array( &$this, 'register_widgets' ) ); |
|
142 | - add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) ); |
|
143 | - add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
139 | + add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts')); |
|
140 | + add_action('wp_footer', array(&$this, 'wp_footer')); |
|
141 | + add_action('widgets_init', array(&$this, 'register_widgets')); |
|
142 | + add_filter('wpseo_exclude_from_sitemap_by_post_ids', array($this, 'wpseo_exclude_from_sitemap_by_post_ids')); |
|
143 | + add_filter('pre_get_posts', array(&$this, 'pre_get_posts')); |
|
144 | 144 | |
145 | 145 | // Fires after registering actions. |
146 | - do_action( 'wpinv_actions', $this ); |
|
147 | - do_action( 'getpaid_actions', $this ); |
|
146 | + do_action('wpinv_actions', $this); |
|
147 | + do_action('getpaid_actions', $this); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | /* Internationalize the text strings used. */ |
153 | 153 | $this->load_textdomain(); |
154 | 154 | |
155 | - do_action( 'wpinv_loaded' ); |
|
155 | + do_action('wpinv_loaded'); |
|
156 | 156 | |
157 | 157 | // Fix oxygen page builder conflict |
158 | - if ( function_exists( 'ct_css_output' ) ) { |
|
158 | + if (function_exists('ct_css_output')) { |
|
159 | 159 | wpinv_oxygen_fix_conflict(); |
160 | 160 | } |
161 | 161 | } |
@@ -165,21 +165,21 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @since 1.0 |
167 | 167 | */ |
168 | - public function load_textdomain( $locale = NULL ) { |
|
169 | - if ( empty( $locale ) ) { |
|
170 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
168 | + public function load_textdomain($locale = NULL) { |
|
169 | + if (empty($locale)) { |
|
170 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
171 | 171 | } |
172 | 172 | |
173 | - $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' ); |
|
173 | + $locale = apply_filters('plugin_locale', $locale, 'invoicing'); |
|
174 | 174 | |
175 | - unload_textdomain( 'invoicing' ); |
|
176 | - load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
177 | - load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
175 | + unload_textdomain('invoicing'); |
|
176 | + load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo'); |
|
177 | + load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages'); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Define language constants. |
181 | 181 | */ |
182 | - require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
182 | + require_once(WPINV_PLUGIN_DIR . 'language.php'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -188,111 +188,111 @@ discard block |
||
188 | 188 | public function includes() { |
189 | 189 | |
190 | 190 | // Start with the settings. |
191 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
191 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php'); |
|
192 | 192 | |
193 | 193 | // Packages/libraries. |
194 | - require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' ); |
|
195 | - require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' ); |
|
196 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' ); |
|
194 | + require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php'); |
|
195 | + require_once(WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php'); |
|
196 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php'); |
|
197 | 197 | |
198 | 198 | // Load functions. |
199 | - require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' ); |
|
200 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
201 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
202 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
203 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
204 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
205 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
206 | - require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' ); |
|
207 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
208 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
209 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
210 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
211 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' ); |
|
212 | - require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' ); |
|
199 | + require_once(WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php'); |
|
200 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php'); |
|
201 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php'); |
|
202 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php'); |
|
203 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php'); |
|
204 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php'); |
|
205 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php'); |
|
206 | + require_once(WPINV_PLUGIN_DIR . 'includes/invoice-functions.php'); |
|
207 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php'); |
|
208 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php'); |
|
209 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php'); |
|
210 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php'); |
|
211 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php'); |
|
212 | + require_once(WPINV_PLUGIN_DIR . 'includes/error-functions.php'); |
|
213 | 213 | |
214 | 214 | // Register autoloader. |
215 | 215 | try { |
216 | - spl_autoload_register( array( $this, 'autoload' ), true ); |
|
217 | - } catch ( Exception $e ) { |
|
218 | - wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true ); |
|
216 | + spl_autoload_register(array($this, 'autoload'), true); |
|
217 | + } catch (Exception $e) { |
|
218 | + wpinv_error_log($e->getMessage(), '', __FILE__, 149, true); |
|
219 | 219 | } |
220 | 220 | |
221 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' ); |
|
222 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' ); |
|
223 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
224 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
225 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' ); |
|
226 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' ); |
|
227 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
|
228 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
|
229 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
|
230 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' ); |
|
231 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' ); |
|
232 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
|
233 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
|
234 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
|
235 | - require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
236 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
237 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
238 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
239 | - require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
240 | - require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
|
241 | - require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' ); |
|
242 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' ); |
|
221 | + require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php'); |
|
222 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php'); |
|
223 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php'); |
|
224 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php'); |
|
225 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php'); |
|
226 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php'); |
|
227 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php'); |
|
228 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php'); |
|
229 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php'); |
|
230 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php'); |
|
231 | + require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php'); |
|
232 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php'); |
|
233 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php'); |
|
234 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php'); |
|
235 | + require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php'); |
|
236 | + require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php'); |
|
237 | + require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php'); |
|
238 | + require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php'); |
|
239 | + require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php'); |
|
240 | + require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php'); |
|
241 | + require_once(WPINV_PLUGIN_DIR . 'widgets/getpaid.php'); |
|
242 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php'); |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * Load the tax class. |
246 | 246 | */ |
247 | - if ( ! class_exists( 'WPInv_EUVat' ) ) { |
|
248 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' ); |
|
247 | + if (!class_exists('WPInv_EUVat')) { |
|
248 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php'); |
|
249 | 249 | } |
250 | 250 | |
251 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
252 | - if ( !empty( $gateways ) ) { |
|
253 | - foreach ( $gateways as $gateway ) { |
|
254 | - if ( $gateway == 'manual' ) { |
|
251 | + $gateways = array_keys(wpinv_get_enabled_payment_gateways()); |
|
252 | + if (!empty($gateways)) { |
|
253 | + foreach ($gateways as $gateway) { |
|
254 | + if ($gateway == 'manual') { |
|
255 | 255 | continue; |
256 | 256 | } |
257 | 257 | |
258 | 258 | $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php'; |
259 | 259 | |
260 | - if ( file_exists( $gateway_file ) ) { |
|
261 | - require_once( $gateway_file ); |
|
260 | + if (file_exists($gateway_file)) { |
|
261 | + require_once($gateway_file); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
266 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
267 | 267 | GetPaid_Post_Types_Admin::init(); |
268 | 268 | |
269 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' ); |
|
270 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
271 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' ); |
|
272 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
273 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
274 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' ); |
|
275 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' ); |
|
276 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' ); |
|
269 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php'); |
|
270 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php'); |
|
271 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php'); |
|
272 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php'); |
|
273 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php'); |
|
274 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php'); |
|
275 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php'); |
|
276 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php'); |
|
277 | 277 | // load the user class only on the users.php page |
278 | 278 | global $pagenow; |
279 | - if($pagenow=='users.php'){ |
|
279 | + if ($pagenow == 'users.php') { |
|
280 | 280 | new WPInv_Admin_Users(); |
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
284 | 284 | // Register cli commands |
285 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
286 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' ); |
|
287 | - WP_CLI::add_command( 'invoicing', 'WPInv_CLI' ); |
|
285 | + if (defined('WP_CLI') && WP_CLI) { |
|
286 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php'); |
|
287 | + WP_CLI::add_command('invoicing', 'WPInv_CLI'); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // include css inliner |
291 | - if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) { |
|
292 | - include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' ); |
|
291 | + if (!class_exists('Emogrifier') && class_exists('DOMDocument')) { |
|
292 | + include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php'); |
|
293 | 293 | } |
294 | 294 | |
295 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' ); |
|
295 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php'); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
@@ -303,21 +303,21 @@ discard block |
||
303 | 303 | * @since 1.0.19 |
304 | 304 | * @return void |
305 | 305 | */ |
306 | - public function autoload( $class_name ) { |
|
306 | + public function autoload($class_name) { |
|
307 | 307 | |
308 | 308 | // Normalize the class name... |
309 | - $class_name = strtolower( $class_name ); |
|
309 | + $class_name = strtolower($class_name); |
|
310 | 310 | |
311 | 311 | // ... and make sure it is our class. |
312 | - if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) { |
|
312 | + if (false === strpos($class_name, 'getpaid_') && false === strpos($class_name, 'wpinv_')) { |
|
313 | 313 | return; |
314 | 314 | } |
315 | 315 | |
316 | 316 | // Next, prepare the file name from the class. |
317 | - $file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php'; |
|
317 | + $file_name = 'class-' . str_replace('_', '-', $class_name) . '.php'; |
|
318 | 318 | |
319 | 319 | // Base path of the classes. |
320 | - $plugin_path = untrailingslashit( WPINV_PLUGIN_DIR ); |
|
320 | + $plugin_path = untrailingslashit(WPINV_PLUGIN_DIR); |
|
321 | 321 | |
322 | 322 | // And an array of possible locations in order of importance. |
323 | 323 | $locations = array( |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | "$plugin_path/includes/admin/meta-boxes", |
330 | 330 | ); |
331 | 331 | |
332 | - foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) { |
|
332 | + foreach (apply_filters('getpaid_autoload_locations', $locations) as $location) { |
|
333 | 333 | |
334 | - if ( file_exists( trailingslashit( $location ) . $file_name ) ) { |
|
335 | - include trailingslashit( $location ) . $file_name; |
|
334 | + if (file_exists(trailingslashit($location) . $file_name)) { |
|
335 | + include trailingslashit($location) . $file_name; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | public function init() { |
347 | 347 | |
348 | 348 | // Fires before getpaid inits. |
349 | - do_action( 'before_getpaid_init', $this ); |
|
349 | + do_action('before_getpaid_init', $this); |
|
350 | 350 | |
351 | 351 | // Load default gateways. |
352 | 352 | $gateways = apply_filters( |
@@ -360,12 +360,12 @@ discard block |
||
360 | 360 | ) |
361 | 361 | ); |
362 | 362 | |
363 | - foreach ( $gateways as $id => $class ) { |
|
364 | - $this->gateways[ $id ] = new $class(); |
|
363 | + foreach ($gateways as $id => $class) { |
|
364 | + $this->gateways[$id] = new $class(); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | // Fires after getpaid inits. |
368 | - do_action( 'getpaid_init', $this ); |
|
368 | + do_action('getpaid_init', $this); |
|
369 | 369 | |
370 | 370 | } |
371 | 371 | |
@@ -375,69 +375,69 @@ discard block |
||
375 | 375 | public function maybe_process_ipn() { |
376 | 376 | |
377 | 377 | // Ensure that this is an IPN request. |
378 | - if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) { |
|
378 | + if (empty($_GET['wpi-listener']) || 'IPN' !== $_GET['wpi-listener'] || empty($_GET['wpi-gateway'])) { |
|
379 | 379 | return; |
380 | 380 | } |
381 | 381 | |
382 | - $gateway = wpinv_clean( $_GET['wpi-gateway'] ); |
|
382 | + $gateway = wpinv_clean($_GET['wpi-gateway']); |
|
383 | 383 | |
384 | - do_action( 'wpinv_verify_payment_ipn', $gateway ); |
|
385 | - do_action( "wpinv_verify_{$gateway}_ipn" ); |
|
384 | + do_action('wpinv_verify_payment_ipn', $gateway); |
|
385 | + do_action("wpinv_verify_{$gateway}_ipn"); |
|
386 | 386 | exit; |
387 | 387 | |
388 | 388 | } |
389 | 389 | |
390 | 390 | public function enqueue_scripts() { |
391 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
391 | + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
392 | 392 | |
393 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/invoice-front.css' ); |
|
394 | - wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), $version ); |
|
395 | - wp_enqueue_style( 'wpinv_front_style' ); |
|
393 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/invoice-front.css'); |
|
394 | + wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), $version); |
|
395 | + wp_enqueue_style('wpinv_front_style'); |
|
396 | 396 | |
397 | 397 | // Register scripts |
398 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
399 | - wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ), filemtime( WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js' ) ); |
|
398 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
399 | + wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array('jquery'), filemtime(WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js')); |
|
400 | 400 | |
401 | 401 | $localize = array(); |
402 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
403 | - $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
402 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
403 | + $localize['nonce'] = wp_create_nonce('wpinv-nonce'); |
|
404 | 404 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
405 | 405 | $localize['currency_pos'] = wpinv_currency_position(); |
406 | 406 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
407 | 407 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
408 | 408 | $localize['decimals'] = wpinv_decimals(); |
409 | - $localize['txtComplete'] = __( 'Continue', 'invoicing' ); |
|
409 | + $localize['txtComplete'] = __('Continue', 'invoicing'); |
|
410 | 410 | $localize['UseTaxes'] = wpinv_use_taxes(); |
411 | - $localize['checkoutNonce'] = wp_create_nonce( 'wpinv_checkout_nonce' ); |
|
412 | - $localize['formNonce'] = wp_create_nonce( 'getpaid_form_nonce' ); |
|
413 | - $localize['connectionError'] = __( 'Could not establish a connection to the server.', 'invoicing' ); |
|
411 | + $localize['checkoutNonce'] = wp_create_nonce('wpinv_checkout_nonce'); |
|
412 | + $localize['formNonce'] = wp_create_nonce('getpaid_form_nonce'); |
|
413 | + $localize['connectionError'] = __('Could not establish a connection to the server.', 'invoicing'); |
|
414 | 414 | |
415 | - $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
415 | + $localize = apply_filters('wpinv_front_js_localize', $localize); |
|
416 | 416 | |
417 | - wp_enqueue_script( 'jquery-blockui' ); |
|
417 | + wp_enqueue_script('jquery-blockui'); |
|
418 | 418 | $autofill_api = wpinv_get_option('address_autofill_api'); |
419 | 419 | $autofill_active = wpinv_get_option('address_autofill_active'); |
420 | - if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) { |
|
421 | - if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) { |
|
422 | - wp_dequeue_script( 'google-maps-api' ); |
|
420 | + if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) { |
|
421 | + if (wp_script_is('google-maps-api', 'enqueued')) { |
|
422 | + wp_dequeue_script('google-maps-api'); |
|
423 | 423 | } |
424 | - wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false ); |
|
425 | - wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true ); |
|
424 | + wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false); |
|
425 | + wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true); |
|
426 | 426 | } |
427 | 427 | |
428 | - wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' ); |
|
429 | - wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION ); |
|
428 | + wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all'); |
|
429 | + wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION); |
|
430 | 430 | |
431 | - wp_enqueue_script( 'wpinv-front-script' ); |
|
432 | - wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
431 | + wp_enqueue_script('wpinv-front-script'); |
|
432 | + wp_localize_script('wpinv-front-script', 'WPInv', $localize); |
|
433 | 433 | |
434 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' ); |
|
435 | - wp_enqueue_script( 'wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'wpinv-front-script', 'wp-hooks' ), $version, true ); |
|
434 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js'); |
|
435 | + wp_enqueue_script('wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array('wpinv-front-script', 'wp-hooks'), $version, true); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | public function wpinv_actions() { |
439 | - if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
440 | - do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
439 | + if (isset($_REQUEST['wpi_action'])) { |
|
440 | + do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
@@ -449,23 +449,23 @@ discard block |
||
449 | 449 | */ |
450 | 450 | public function maybe_do_authenticated_action() { |
451 | 451 | |
452 | - if ( is_user_logged_in() && isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) { |
|
453 | - $key = sanitize_key( $_REQUEST['getpaid-action'] ); |
|
454 | - do_action( "getpaid_authenticated_action_$key", $_REQUEST ); |
|
452 | + if (is_user_logged_in() && isset($_REQUEST['getpaid-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) { |
|
453 | + $key = sanitize_key($_REQUEST['getpaid-action']); |
|
454 | + do_action("getpaid_authenticated_action_$key", $_REQUEST); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | } |
458 | 458 | |
459 | - public function pre_get_posts( $wp_query ) { |
|
460 | - if ( ! is_admin() && !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) { |
|
461 | - $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() ); |
|
459 | + public function pre_get_posts($wp_query) { |
|
460 | + if (!is_admin() && !empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query()) { |
|
461 | + $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses()); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | return $wp_query; |
465 | 465 | } |
466 | 466 | |
467 | 467 | public function bp_invoicing_init() { |
468 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
|
468 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php'); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | /** |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | ) |
487 | 487 | ); |
488 | 488 | |
489 | - foreach ( $widgets as $widget ) { |
|
490 | - register_widget( $widget ); |
|
489 | + foreach ($widgets as $widget) { |
|
490 | + register_widget($widget); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | } |
@@ -498,10 +498,10 @@ discard block |
||
498 | 498 | * @since 1.0.19 |
499 | 499 | * @param int[] $excluded_posts_ids |
500 | 500 | */ |
501 | - public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){ |
|
501 | + public function wpseo_exclude_from_sitemap_by_post_ids($excluded_posts_ids) { |
|
502 | 502 | |
503 | 503 | // Ensure that we have an array. |
504 | - if ( ! is_array( $excluded_posts_ids ) ) { |
|
504 | + if (!is_array($excluded_posts_ids)) { |
|
505 | 505 | $excluded_posts_ids = array(); |
506 | 506 | } |
507 | 507 | |
@@ -509,24 +509,24 @@ discard block |
||
509 | 509 | $our_pages = array(); |
510 | 510 | |
511 | 511 | // Checkout page. |
512 | - $our_pages[] = wpinv_get_option( 'checkout_page', false ); |
|
512 | + $our_pages[] = wpinv_get_option('checkout_page', false); |
|
513 | 513 | |
514 | 514 | // Success page. |
515 | - $our_pages[] = wpinv_get_option( 'success_page', false ); |
|
515 | + $our_pages[] = wpinv_get_option('success_page', false); |
|
516 | 516 | |
517 | 517 | // Failure page. |
518 | - $our_pages[] = wpinv_get_option( 'failure_page', false ); |
|
518 | + $our_pages[] = wpinv_get_option('failure_page', false); |
|
519 | 519 | |
520 | 520 | // History page. |
521 | - $our_pages[] = wpinv_get_option( 'invoice_history_page', false ); |
|
521 | + $our_pages[] = wpinv_get_option('invoice_history_page', false); |
|
522 | 522 | |
523 | 523 | // Subscriptions page. |
524 | - $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false ); |
|
524 | + $our_pages[] = wpinv_get_option('invoice_subscription_page', false); |
|
525 | 525 | |
526 | - $our_pages = array_map( 'intval', array_filter( $our_pages ) ); |
|
526 | + $our_pages = array_map('intval', array_filter($our_pages)); |
|
527 | 527 | |
528 | 528 | $excluded_posts_ids = $excluded_posts_ids + $our_pages; |
529 | - return array_unique( $excluded_posts_ids ); |
|
529 | + return array_unique($excluded_posts_ids); |
|
530 | 530 | |
531 | 531 | } |
532 | 532 |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $message = wpinv_email_style_body( $message ); |
186 | 186 | $to = array_merge( wpinv_parse_list( $to ), wpinv_parse_list( $cc ) ); |
187 | 187 | |
188 | - return $mailer->send( |
|
188 | + return $mailer->send( |
|
189 | 189 | $to, |
190 | 190 | $subject, |
191 | 191 | $message, |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | $table = $wpdb->prefix . 'wpinv_subscriptions'; |
505 | 505 | |
506 | 506 | // Fetch invoices. |
507 | - $subscriptions = $wpdb->get_results( |
|
508 | - "SELECT parent_payment_id, product_id, expiration FROM $table |
|
507 | + $subscriptions = $wpdb->get_results( |
|
508 | + "SELECT parent_payment_id, product_id, expiration FROM $table |
|
509 | 509 | WHERE |
510 | 510 | $where |
511 | 511 | AND status IN ( 'trialling', 'active' )"); |
@@ -570,8 +570,8 @@ discard block |
||
570 | 570 | $table = $wpdb->prefix . 'getpaid_invoices'; |
571 | 571 | |
572 | 572 | // Fetch invoices. |
573 | - $invoices = $wpdb->get_col( |
|
574 | - "SELECT posts.ID FROM $wpdb->posts as posts |
|
573 | + $invoices = $wpdb->get_col( |
|
574 | + "SELECT posts.ID FROM $wpdb->posts as posts |
|
575 | 575 | LEFT JOIN $table as invoices ON invoices.post_id = posts.ID |
576 | 576 | WHERE |
577 | 577 | $where |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /* |
10 | 10 | |-------------------------------------------------------------------------- |
@@ -15,19 +15,19 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * Generates the email header. |
17 | 17 | */ |
18 | -function wpinv_email_header( $email_heading ) { |
|
19 | - wpinv_get_template( 'emails/wpinv-email-header.php', compact( 'email_heading' ) ); |
|
18 | +function wpinv_email_header($email_heading) { |
|
19 | + wpinv_get_template('emails/wpinv-email-header.php', compact('email_heading')); |
|
20 | 20 | } |
21 | -add_action( 'wpinv_email_header', 'wpinv_email_header' ); |
|
21 | +add_action('wpinv_email_header', 'wpinv_email_header'); |
|
22 | 22 | |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Generates the email footer. |
26 | 26 | */ |
27 | 27 | function wpinv_email_footer() { |
28 | - wpinv_get_template( 'emails/wpinv-email-footer.php' ); |
|
28 | + wpinv_get_template('emails/wpinv-email-footer.php'); |
|
29 | 29 | } |
30 | -add_action( 'wpinv_email_footer', 'wpinv_email_footer' ); |
|
30 | +add_action('wpinv_email_footer', 'wpinv_email_footer'); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * @param string $email_type |
38 | 38 | * @param bool $sent_to_admin |
39 | 39 | */ |
40 | -function wpinv_email_invoice_details( $invoice, $email_type, $sent_to_admin ) { |
|
40 | +function wpinv_email_invoice_details($invoice, $email_type, $sent_to_admin) { |
|
41 | 41 | |
42 | - $args = compact( 'invoice', 'email_type', 'sent_to_admin' ); |
|
43 | - wpinv_get_template( 'emails/wpinv-email-invoice-details.php', $args ); |
|
42 | + $args = compact('invoice', 'email_type', 'sent_to_admin'); |
|
43 | + wpinv_get_template('emails/wpinv-email-invoice-details.php', $args); |
|
44 | 44 | |
45 | 45 | } |
46 | -add_action( 'wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3 ); |
|
46 | +add_action('wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3); |
|
47 | 47 | |
48 | 48 | |
49 | 49 | /** |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | * @param string $email_type |
54 | 54 | * @param bool $sent_to_admin |
55 | 55 | */ |
56 | -function wpinv_email_invoice_items( $invoice, $email_type, $sent_to_admin ) { |
|
56 | +function wpinv_email_invoice_items($invoice, $email_type, $sent_to_admin) { |
|
57 | 57 | |
58 | 58 | // Prepare line items. |
59 | - $columns = getpaid_invoice_item_columns( $invoice ); |
|
60 | - $columns = apply_filters( 'getpaid_invoice_line_items_table_columns', $columns, $invoice ); |
|
59 | + $columns = getpaid_invoice_item_columns($invoice); |
|
60 | + $columns = apply_filters('getpaid_invoice_line_items_table_columns', $columns, $invoice); |
|
61 | 61 | |
62 | 62 | // Load the template. |
63 | - wpinv_get_template( 'emails/wpinv-email-invoice-items.php', compact( 'invoice', 'columns', 'email_type', 'sent_to_admin' ) ); |
|
63 | + wpinv_get_template('emails/wpinv-email-invoice-items.php', compact('invoice', 'columns', 'email_type', 'sent_to_admin')); |
|
64 | 64 | |
65 | 65 | } |
66 | -add_action( 'wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3 ); |
|
66 | +add_action('wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3); |
|
67 | 67 | |
68 | 68 | |
69 | 69 | /** |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | * @param string $email_type |
74 | 74 | * @param bool $sent_to_admin |
75 | 75 | */ |
76 | -function wpinv_email_billing_details( $invoice, $email_type, $sent_to_admin ) { |
|
76 | +function wpinv_email_billing_details($invoice, $email_type, $sent_to_admin) { |
|
77 | 77 | |
78 | - $args = compact( 'invoice', 'email_type', 'sent_to_admin' ); |
|
79 | - wpinv_get_template( 'emails/wpinv-email-billing-details.php', $args ); |
|
78 | + $args = compact('invoice', 'email_type', 'sent_to_admin'); |
|
79 | + wpinv_get_template('emails/wpinv-email-billing-details.php', $args); |
|
80 | 80 | |
81 | 81 | } |
82 | -add_action( 'wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3 ); |
|
82 | +add_action('wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Returns email css. |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function getpaid_get_email_css() { |
89 | 89 | |
90 | - $css = wpinv_get_template_html( 'emails/wpinv-email-styles.php' ); |
|
91 | - return apply_filters( 'wpinv_email_styles', $css ); |
|
90 | + $css = wpinv_get_template_html('emails/wpinv-email-styles.php'); |
|
91 | + return apply_filters('wpinv_email_styles', $css); |
|
92 | 92 | |
93 | 93 | } |
94 | 94 | |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | * |
101 | 101 | */ |
102 | -function wpinv_email_style_body( $content ) { |
|
102 | +function wpinv_email_style_body($content) { |
|
103 | 103 | |
104 | 104 | $css = getpaid_get_email_css(); |
105 | 105 | |
106 | 106 | // Inline the css. |
107 | 107 | try { |
108 | - $emogrifier = new Emogrifier( $content, $css ); |
|
108 | + $emogrifier = new Emogrifier($content, $css); |
|
109 | 109 | $_content = $emogrifier->emogrify(); |
110 | 110 | $content = $_content; |
111 | - } catch ( Exception $e ) { |
|
112 | - wpinv_error_log( $e->getMessage(), 'emogrifier' ); |
|
111 | + } catch (Exception $e) { |
|
112 | + wpinv_error_log($e->getMessage(), 'emogrifier'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $content; |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | |
119 | 119 | // Backwards compatibility. |
120 | 120 | function wpinv_init_transactional_emails() { |
121 | - foreach ( apply_filters( 'wpinv_email_actions', array() ) as $action ) { |
|
122 | - add_action( $action, 'wpinv_send_transactional_email', 10, 10 ); |
|
121 | + foreach (apply_filters('wpinv_email_actions', array()) as $action) { |
|
122 | + add_action($action, 'wpinv_send_transactional_email', 10, 10); |
|
123 | 123 | } |
124 | 124 | } |
125 | -add_action( 'init', 'wpinv_init_transactional_emails' ); |
|
125 | +add_action('init', 'wpinv_init_transactional_emails'); |
|
126 | 126 | |
127 | 127 | |
128 | 128 | |
@@ -133,28 +133,28 @@ discard block |
||
133 | 133 | function wpinv_send_transactional_email() { |
134 | 134 | $args = func_get_args(); |
135 | 135 | $function = current_filter() . '_notification'; |
136 | - do_action_ref_array( $function, $args ); |
|
136 | + do_action_ref_array($function, $args); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | function wpinv_mail_get_from_address() { |
140 | - $from_address = apply_filters( 'wpinv_mail_from_address', wpinv_get_option( 'email_from' ) ); |
|
141 | - return sanitize_email( $from_address ); |
|
140 | + $from_address = apply_filters('wpinv_mail_from_address', wpinv_get_option('email_from')); |
|
141 | + return sanitize_email($from_address); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | function wpinv_mail_get_from_name() { |
145 | - $from_name = apply_filters( 'wpinv_mail_from_name', wpinv_get_option( 'email_from_name' ) ); |
|
146 | - return wp_specialchars_decode( esc_html( $from_name ), ENT_QUOTES ); |
|
145 | + $from_name = apply_filters('wpinv_mail_from_name', wpinv_get_option('email_from_name')); |
|
146 | + return wp_specialchars_decode(esc_html($from_name), ENT_QUOTES); |
|
147 | 147 | } |
148 | 148 | |
149 | -function wpinv_mail_admin_bcc_active( $mail_type = '' ) { |
|
150 | - $active = apply_filters( 'wpinv_mail_admin_bcc_active', wpinv_get_option( 'email_' . $mail_type . '_admin_bcc' ) ); |
|
151 | - return ( $active ? true : false ); |
|
149 | +function wpinv_mail_admin_bcc_active($mail_type = '') { |
|
150 | + $active = apply_filters('wpinv_mail_admin_bcc_active', wpinv_get_option('email_' . $mail_type . '_admin_bcc')); |
|
151 | + return ($active ? true : false); |
|
152 | 152 | } |
153 | 153 | |
154 | -function wpinv_mail_get_content_type( $content_type = 'text/html', $email_type = 'html' ) { |
|
155 | - $email_type = apply_filters( 'wpinv_mail_content_type', $email_type ); |
|
154 | +function wpinv_mail_get_content_type($content_type = 'text/html', $email_type = 'html') { |
|
155 | + $email_type = apply_filters('wpinv_mail_content_type', $email_type); |
|
156 | 156 | |
157 | - switch ( $email_type ) { |
|
157 | + switch ($email_type) { |
|
158 | 158 | case 'html' : |
159 | 159 | $content_type = 'text/html'; |
160 | 160 | break; |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | * @param array $attachments Any files to attach to the email. |
180 | 180 | * @param string|array $cc An email or array of extra emails to send a copy of the email to. |
181 | 181 | */ |
182 | -function wpinv_mail_send( $to, $subject, $message, $deprecated, $attachments = array(), $cc = array() ) { |
|
182 | +function wpinv_mail_send($to, $subject, $message, $deprecated, $attachments = array(), $cc = array()) { |
|
183 | 183 | |
184 | 184 | $mailer = new GetPaid_Notification_Email_Sender(); |
185 | - $message = wpinv_email_style_body( $message ); |
|
186 | - $to = array_merge( wpinv_parse_list( $to ), wpinv_parse_list( $cc ) ); |
|
185 | + $message = wpinv_email_style_body($message); |
|
186 | + $to = array_merge(wpinv_parse_list($to), wpinv_parse_list($cc)); |
|
187 | 187 | |
188 | 188 | return $mailer->send( |
189 | 189 | $to, |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @return array |
201 | 201 | */ |
202 | 202 | function wpinv_get_emails() { |
203 | - return apply_filters( 'wpinv_get_emails', wpinv_get_data( 'email-settings' ) ); |
|
203 | + return apply_filters('wpinv_get_emails', wpinv_get_data('email-settings')); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -209,172 +209,172 @@ discard block |
||
209 | 209 | * @param array $settings |
210 | 210 | * @return array |
211 | 211 | */ |
212 | -function wpinv_settings_emails( $settings = array() ) { |
|
213 | - $settings = array_merge( $settings, wpinv_get_emails() ); |
|
214 | - return apply_filters( 'wpinv_settings_get_emails', $settings ); |
|
212 | +function wpinv_settings_emails($settings = array()) { |
|
213 | + $settings = array_merge($settings, wpinv_get_emails()); |
|
214 | + return apply_filters('wpinv_settings_get_emails', $settings); |
|
215 | 215 | } |
216 | -add_filter( 'wpinv_settings_emails', 'wpinv_settings_emails', 10, 1 ); |
|
216 | +add_filter('wpinv_settings_emails', 'wpinv_settings_emails', 10, 1); |
|
217 | 217 | |
218 | 218 | /** |
219 | 219 | * Filter email section names. |
220 | 220 | * |
221 | 221 | */ |
222 | -function wpinv_settings_sections_emails( $settings ) { |
|
223 | - foreach ( wpinv_get_emails() as $key => $email) { |
|
224 | - $settings[$key] = ! empty( $email['email_' . $key . '_header']['name'] ) ? strip_tags( $email['email_' . $key . '_header']['name'] ) : strip_tags( $key ); |
|
222 | +function wpinv_settings_sections_emails($settings) { |
|
223 | + foreach (wpinv_get_emails() as $key => $email) { |
|
224 | + $settings[$key] = !empty($email['email_' . $key . '_header']['name']) ? strip_tags($email['email_' . $key . '_header']['name']) : strip_tags($key); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | return $settings; |
228 | 228 | } |
229 | -add_filter( 'wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1 ); |
|
229 | +add_filter('wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1); |
|
230 | 230 | |
231 | -function wpinv_email_is_enabled( $email_type ) { |
|
231 | +function wpinv_email_is_enabled($email_type) { |
|
232 | 232 | $emails = wpinv_get_emails(); |
233 | - $enabled = isset( $emails[$email_type] ) && wpinv_get_option( 'email_'. $email_type . '_active', 0 ) ? true : false; |
|
233 | + $enabled = isset($emails[$email_type]) && wpinv_get_option('email_' . $email_type . '_active', 0) ? true : false; |
|
234 | 234 | |
235 | - return apply_filters( 'wpinv_email_is_enabled', $enabled, $email_type ); |
|
235 | + return apply_filters('wpinv_email_is_enabled', $enabled, $email_type); |
|
236 | 236 | } |
237 | 237 | |
238 | -function wpinv_email_get_recipient( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
239 | - switch ( $email_type ) { |
|
238 | +function wpinv_email_get_recipient($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
239 | + switch ($email_type) { |
|
240 | 240 | case 'new_invoice': |
241 | 241 | case 'cancelled_invoice': |
242 | 242 | case 'failed_invoice': |
243 | 243 | $recipient = wpinv_get_admin_email(); |
244 | 244 | break; |
245 | 245 | default: |
246 | - $invoice = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL ); |
|
247 | - $recipient = !empty( $invoice ) ? $invoice->get_email() : ''; |
|
246 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL); |
|
247 | + $recipient = !empty($invoice) ? $invoice->get_email() : ''; |
|
248 | 248 | break; |
249 | 249 | } |
250 | 250 | |
251 | - return apply_filters( 'wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice ); |
|
251 | + return apply_filters('wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | 255 | * Returns invoice CC recipients |
256 | 256 | */ |
257 | -function wpinv_email_get_cc_recipients( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
258 | - switch ( $email_type ) { |
|
257 | +function wpinv_email_get_cc_recipients($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
258 | + switch ($email_type) { |
|
259 | 259 | case 'new_invoice': |
260 | 260 | case 'cancelled_invoice': |
261 | 261 | case 'failed_invoice': |
262 | 262 | return array(); |
263 | 263 | break; |
264 | 264 | default: |
265 | - $invoice = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL ); |
|
266 | - $recipient = empty( $invoice ) ? '' : get_post_meta( $invoice->ID, 'wpinv_email_cc', true ); |
|
267 | - if ( empty( $recipient ) ) { |
|
265 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL); |
|
266 | + $recipient = empty($invoice) ? '' : get_post_meta($invoice->ID, 'wpinv_email_cc', true); |
|
267 | + if (empty($recipient)) { |
|
268 | 268 | return array(); |
269 | 269 | } |
270 | - return array_filter( array_map( 'trim', explode( ',', $recipient ) ) ); |
|
270 | + return array_filter(array_map('trim', explode(',', $recipient))); |
|
271 | 271 | break; |
272 | 272 | } |
273 | 273 | |
274 | 274 | } |
275 | 275 | |
276 | -function wpinv_email_get_subject( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
277 | - $subject = wpinv_get_option( 'email_' . $email_type . '_subject' ); |
|
278 | - $subject = __( $subject, 'invoicing' ); |
|
276 | +function wpinv_email_get_subject($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
277 | + $subject = wpinv_get_option('email_' . $email_type . '_subject'); |
|
278 | + $subject = __($subject, 'invoicing'); |
|
279 | 279 | |
280 | - $subject = wpinv_email_format_text( $subject, $invoice ); |
|
280 | + $subject = wpinv_email_format_text($subject, $invoice); |
|
281 | 281 | |
282 | - return apply_filters( 'wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice ); |
|
282 | + return apply_filters('wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice); |
|
283 | 283 | } |
284 | 284 | |
285 | -function wpinv_email_get_heading( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
286 | - $email_heading = wpinv_get_option( 'email_' . $email_type . '_heading' ); |
|
287 | - $email_heading = __( $email_heading, 'invoicing' ); |
|
285 | +function wpinv_email_get_heading($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
286 | + $email_heading = wpinv_get_option('email_' . $email_type . '_heading'); |
|
287 | + $email_heading = __($email_heading, 'invoicing'); |
|
288 | 288 | |
289 | - $email_heading = wpinv_email_format_text( $email_heading, $invoice ); |
|
289 | + $email_heading = wpinv_email_format_text($email_heading, $invoice); |
|
290 | 290 | |
291 | - return apply_filters( 'wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice ); |
|
291 | + return apply_filters('wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice); |
|
292 | 292 | } |
293 | 293 | |
294 | -function wpinv_email_get_content( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
295 | - $content = wpinv_get_option( 'email_' . $email_type . '_body' ); |
|
296 | - $content = __( $content, 'invoicing' ); |
|
294 | +function wpinv_email_get_content($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
295 | + $content = wpinv_get_option('email_' . $email_type . '_body'); |
|
296 | + $content = __($content, 'invoicing'); |
|
297 | 297 | |
298 | - $content = wpinv_email_format_text( $content, $invoice ); |
|
298 | + $content = wpinv_email_format_text($content, $invoice); |
|
299 | 299 | |
300 | - return apply_filters( 'wpinv_email_content', $content, $email_type, $invoice_id, $invoice ); |
|
300 | + return apply_filters('wpinv_email_content', $content, $email_type, $invoice_id, $invoice); |
|
301 | 301 | } |
302 | 302 | |
303 | -function wpinv_email_get_headers( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
303 | +function wpinv_email_get_headers($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
304 | 304 | $from_name = wpinv_mail_get_from_address(); |
305 | 305 | $from_email = wpinv_mail_get_from_address(); |
306 | 306 | |
307 | - $invoice = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL ); |
|
307 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL); |
|
308 | 308 | |
309 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
310 | - $headers .= "Reply-To: ". $from_email . "\r\n"; |
|
309 | + $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <$from_email>\r\n"; |
|
310 | + $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
311 | 311 | $headers .= "Content-Type: " . wpinv_mail_get_content_type() . "\r\n"; |
312 | 312 | |
313 | - return apply_filters( 'wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice ); |
|
313 | + return apply_filters('wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice); |
|
314 | 314 | } |
315 | 315 | |
316 | -function wpinv_email_get_attachments( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
316 | +function wpinv_email_get_attachments($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
317 | 317 | $attachments = array(); |
318 | 318 | |
319 | - return apply_filters( 'wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice ); |
|
319 | + return apply_filters('wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
323 | 323 | * Searches for and replaces certain placeholders in an email. |
324 | 324 | */ |
325 | -function wpinv_email_format_text( $content, $invoice ) { |
|
325 | +function wpinv_email_format_text($content, $invoice) { |
|
326 | 326 | |
327 | 327 | $replace_array = array( |
328 | 328 | '{site_title}' => wpinv_get_blogname(), |
329 | - '{date}' => date_i18n( get_option( 'date_format' ), (int) current_time( 'timestamp' ) ), |
|
329 | + '{date}' => date_i18n(get_option('date_format'), (int) current_time('timestamp')), |
|
330 | 330 | ); |
331 | 331 | |
332 | - $invoice = new WPInv_Invoice( $invoice ); |
|
332 | + $invoice = new WPInv_Invoice($invoice); |
|
333 | 333 | |
334 | - if ( $invoice->get_id() ) { |
|
334 | + if ($invoice->get_id()) { |
|
335 | 335 | |
336 | 336 | $replace_array = array_merge( |
337 | 337 | $replace_array, |
338 | 338 | array( |
339 | - '{name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
340 | - '{full_name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
341 | - '{first_name}' => sanitize_text_field( $invoice->get_first_name() ), |
|
342 | - '{last_name}' => sanitize_text_field( $invoice->get_last_name() ), |
|
343 | - '{email}' => sanitize_email( $invoice->get_email() ), |
|
344 | - '{invoice_number}' => sanitize_text_field( $invoice->get_number() ), |
|
345 | - '{invoice_total}' => wpinv_price( wpinv_format_amount( $invoice->get_total( true ) ) ), |
|
346 | - '{invoice_link}' => esc_url( $invoice->get_view_url() ), |
|
347 | - '{invoice_pay_link}'=> esc_url( $invoice->get_checkout_payment_url() ), |
|
348 | - '{invoice_date}' => date( get_option( 'date_format' ), strtotime( $invoice->get_date_created(), current_time( 'timestamp' ) ) ), |
|
349 | - '{invoice_due_date}'=> date( get_option( 'date_format' ), strtotime( $invoice->get_due_date(), current_time( 'timestamp' ) ) ), |
|
350 | - '{invoice_quote}' => sanitize_text_field( $invoice->get_type() ), |
|
351 | - '{invoice_label}' => sanitize_text_field( ucfirst( $invoice->get_type() ) ), |
|
352 | - '{is_was}' => strtotime( $invoice->get_due_date() ) < current_time( 'timestamp' ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ), |
|
339 | + '{name}' => sanitize_text_field($invoice->get_user_full_name()), |
|
340 | + '{full_name}' => sanitize_text_field($invoice->get_user_full_name()), |
|
341 | + '{first_name}' => sanitize_text_field($invoice->get_first_name()), |
|
342 | + '{last_name}' => sanitize_text_field($invoice->get_last_name()), |
|
343 | + '{email}' => sanitize_email($invoice->get_email()), |
|
344 | + '{invoice_number}' => sanitize_text_field($invoice->get_number()), |
|
345 | + '{invoice_total}' => wpinv_price(wpinv_format_amount($invoice->get_total(true))), |
|
346 | + '{invoice_link}' => esc_url($invoice->get_view_url()), |
|
347 | + '{invoice_pay_link}'=> esc_url($invoice->get_checkout_payment_url()), |
|
348 | + '{invoice_date}' => date(get_option('date_format'), strtotime($invoice->get_date_created(), current_time('timestamp'))), |
|
349 | + '{invoice_due_date}'=> date(get_option('date_format'), strtotime($invoice->get_due_date(), current_time('timestamp'))), |
|
350 | + '{invoice_quote}' => sanitize_text_field($invoice->get_type()), |
|
351 | + '{invoice_label}' => sanitize_text_field(ucfirst($invoice->get_type())), |
|
352 | + '{is_was}' => strtotime($invoice->get_due_date()) < current_time('timestamp') ? __('was', 'invoicing') : __('is', 'invoicing'), |
|
353 | 353 | ) |
354 | 354 | ); |
355 | 355 | |
356 | 356 | } |
357 | 357 | |
358 | 358 | // Let third party plugins filter the arra. |
359 | - $replace_array = apply_filters( 'wpinv_email_format_text', $replace_array, $content, $invoice ); |
|
359 | + $replace_array = apply_filters('wpinv_email_format_text', $replace_array, $content, $invoice); |
|
360 | 360 | |
361 | - foreach ( $replace_array as $key => $value ) { |
|
362 | - $content = str_replace( $key, $value, $content ); |
|
361 | + foreach ($replace_array as $key => $value) { |
|
362 | + $content = str_replace($key, $value, $content); |
|
363 | 363 | } |
364 | 364 | |
365 | - return apply_filters( 'wpinv_email_content_replace', $content ); |
|
365 | + return apply_filters('wpinv_email_content_replace', $content); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
369 | -function wpinv_email_wrap_message( $message ) { |
|
369 | +function wpinv_email_wrap_message($message) { |
|
370 | 370 | // Buffer |
371 | 371 | ob_start(); |
372 | 372 | |
373 | - do_action( 'wpinv_email_header' ); |
|
373 | + do_action('wpinv_email_header'); |
|
374 | 374 | |
375 | - echo wpautop( wptexturize( $message ) ); |
|
375 | + echo wpautop(wptexturize($message)); |
|
376 | 376 | |
377 | - do_action( 'wpinv_email_footer' ); |
|
377 | + do_action('wpinv_email_footer'); |
|
378 | 378 | |
379 | 379 | // Get contents |
380 | 380 | $message = ob_get_clean(); |
@@ -384,74 +384,74 @@ discard block |
||
384 | 384 | |
385 | 385 | |
386 | 386 | |
387 | -function wpinv_send_customer_invoice( $data = array() ) { |
|
388 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
387 | +function wpinv_send_customer_invoice($data = array()) { |
|
388 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
389 | 389 | |
390 | - if ( empty( $invoice_id ) ) { |
|
390 | + if (empty($invoice_id)) { |
|
391 | 391 | return; |
392 | 392 | } |
393 | 393 | |
394 | - if ( !wpinv_current_user_can_manage_invoicing() ) { |
|
395 | - wp_die( __( 'You do not have permission to send invoice notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
394 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
395 | + wp_die(__('You do not have permission to send invoice notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
396 | 396 | } |
397 | 397 | |
398 | - $sent = wpinv_user_invoice_notification( $invoice_id ); |
|
398 | + $sent = wpinv_user_invoice_notification($invoice_id); |
|
399 | 399 | |
400 | 400 | if ( -1 === $sent ) { |
401 | 401 | $status = 'email_disabled'; |
402 | - } elseif ( $sent ) { |
|
402 | + } elseif ($sent) { |
|
403 | 403 | $status = 'email_sent'; |
404 | 404 | } else { |
405 | 405 | $status = 'email_fail'; |
406 | 406 | } |
407 | 407 | |
408 | - $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
|
409 | - wp_redirect( $redirect ); |
|
408 | + $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false)); |
|
409 | + wp_redirect($redirect); |
|
410 | 410 | exit; |
411 | 411 | } |
412 | -add_action( 'wpinv_send_invoice', 'wpinv_send_customer_invoice' ); |
|
412 | +add_action('wpinv_send_invoice', 'wpinv_send_customer_invoice'); |
|
413 | 413 | |
414 | -function wpinv_send_overdue_reminder( $data = array() ) { |
|
415 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
414 | +function wpinv_send_overdue_reminder($data = array()) { |
|
415 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
416 | 416 | |
417 | - if ( empty( $invoice_id ) ) { |
|
417 | + if (empty($invoice_id)) { |
|
418 | 418 | return; |
419 | 419 | } |
420 | 420 | |
421 | - if ( !wpinv_current_user_can_manage_invoicing() ) { |
|
422 | - wp_die( __( 'You do not have permission to send reminder notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
421 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
422 | + wp_die(__('You do not have permission to send reminder notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
423 | 423 | } |
424 | 424 | |
425 | - $sent = wpinv_send_payment_reminder_notification( $invoice_id ); |
|
425 | + $sent = wpinv_send_payment_reminder_notification($invoice_id); |
|
426 | 426 | |
427 | 427 | $status = $sent ? 'email_sent' : 'email_fail'; |
428 | 428 | |
429 | - $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
|
430 | - wp_redirect( $redirect ); |
|
429 | + $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false)); |
|
430 | + wp_redirect($redirect); |
|
431 | 431 | exit; |
432 | 432 | } |
433 | -add_action( 'wpinv_send_reminder', 'wpinv_send_overdue_reminder' ); |
|
433 | +add_action('wpinv_send_reminder', 'wpinv_send_overdue_reminder'); |
|
434 | 434 | |
435 | 435 | /** |
436 | 436 | * @deprecated |
437 | 437 | */ |
438 | 438 | function wpinv_send_customer_note_email() {} |
439 | 439 | |
440 | -function wpinv_add_notes_to_invoice_email( $invoice, $email_type, $sent_to_admin ) { |
|
441 | - if ( !empty( $invoice ) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes( $invoice->ID, true ) ) { |
|
442 | - $date_format = get_option( 'date_format' ); |
|
443 | - $time_format = get_option( 'time_format' ); |
|
440 | +function wpinv_add_notes_to_invoice_email($invoice, $email_type, $sent_to_admin) { |
|
441 | + if (!empty($invoice) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes($invoice->ID, true)) { |
|
442 | + $date_format = get_option('date_format'); |
|
443 | + $time_format = get_option('time_format'); |
|
444 | 444 | ?> |
445 | 445 | <div id="wpinv-email-notes"> |
446 | - <h3 class="wpinv-notes-t"><?php echo apply_filters( 'wpinv_email_invoice_notes_title', __( 'Invoice Notes', 'invoicing' ) ); ?></h3> |
|
446 | + <h3 class="wpinv-notes-t"><?php echo apply_filters('wpinv_email_invoice_notes_title', __('Invoice Notes', 'invoicing')); ?></h3> |
|
447 | 447 | <ol class="wpinv-notes-lists"> |
448 | 448 | <?php |
449 | - foreach ( $invoice_notes as $note ) { |
|
450 | - $note_time = strtotime( $note->comment_date ); |
|
449 | + foreach ($invoice_notes as $note) { |
|
450 | + $note_time = strtotime($note->comment_date); |
|
451 | 451 | ?> |
452 | 452 | <li class="comment wpinv-note"> |
453 | - <p class="wpinv-note-date meta"><?php printf( __( '%2$s at %3$s', 'invoicing' ), $note->comment_author, date_i18n( $date_format, $note_time ), date_i18n( $time_format, $note_time ), $note_time ); ?></p> |
|
454 | - <div class="wpinv-note-desc description"><?php echo wpautop( wptexturize( $note->comment_content ) ); ?></div> |
|
453 | + <p class="wpinv-note-date meta"><?php printf(__('%2$s at %3$s', 'invoicing'), $note->comment_author, date_i18n($date_format, $note_time), date_i18n($time_format, $note_time), $note_time); ?></p> |
|
454 | + <div class="wpinv-note-desc description"><?php echo wpautop(wptexturize($note->comment_content)); ?></div> |
|
455 | 455 | </li> |
456 | 456 | <?php |
457 | 457 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | <?php |
461 | 461 | } |
462 | 462 | } |
463 | -add_action( 'wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3 ); |
|
463 | +add_action('wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3); |
|
464 | 464 | |
465 | 465 | /** |
466 | 466 | * Sends renewal reminders. |
@@ -468,35 +468,35 @@ discard block |
||
468 | 468 | function wpinv_email_renewal_reminders() { |
469 | 469 | global $wpdb; |
470 | 470 | |
471 | - if ( ! wpinv_get_option( 'email_pre_payment_active' ) ) { |
|
471 | + if (!wpinv_get_option('email_pre_payment_active')) { |
|
472 | 472 | return; |
473 | 473 | } |
474 | 474 | |
475 | - $reminder_days = wpinv_get_option( 'email_pre_payment_reminder_days' ); |
|
475 | + $reminder_days = wpinv_get_option('email_pre_payment_reminder_days'); |
|
476 | 476 | |
477 | - if ( empty( $reminder_days ) ) { |
|
477 | + if (empty($reminder_days)) { |
|
478 | 478 | return; |
479 | 479 | } |
480 | 480 | |
481 | 481 | // How many days before renewal should we send this email? |
482 | - $reminder_days = array_unique( array_map( 'absint', array_filter( wpinv_parse_list( $reminder_days ) ) ) ); |
|
483 | - if ( empty( $reminder_days ) ) { |
|
482 | + $reminder_days = array_unique(array_map('absint', array_filter(wpinv_parse_list($reminder_days)))); |
|
483 | + if (empty($reminder_days)) { |
|
484 | 484 | return; |
485 | 485 | } |
486 | 486 | |
487 | - if ( 1 == count( $reminder_days ) ) { |
|
487 | + if (1 == count($reminder_days)) { |
|
488 | 488 | $days = $reminder_days[0]; |
489 | - $date = date( 'Y-m-d', strtotime( "+$days days", current_time( 'timestamp' ) ) ); |
|
490 | - $where = $wpdb->prepare( "DATE(expiration)=%s", $date ); |
|
489 | + $date = date('Y-m-d', strtotime("+$days days", current_time('timestamp'))); |
|
490 | + $where = $wpdb->prepare("DATE(expiration)=%s", $date); |
|
491 | 491 | } else { |
492 | 492 | $in = array(); |
493 | 493 | |
494 | - foreach ( $reminder_days as $days ) { |
|
495 | - $date = date( 'Y-m-d', strtotime( "+$days days", current_time( 'timestamp' ) ) ); |
|
496 | - $in[] = $wpdb->prepare( "%s", $date ); |
|
494 | + foreach ($reminder_days as $days) { |
|
495 | + $date = date('Y-m-d', strtotime("+$days days", current_time('timestamp'))); |
|
496 | + $in[] = $wpdb->prepare("%s", $date); |
|
497 | 497 | } |
498 | 498 | |
499 | - $in = implode( ',', $in ); |
|
499 | + $in = implode(',', $in); |
|
500 | 500 | $where = "DATE(expiration) IN ($in)"; |
501 | 501 | } |
502 | 502 | |
@@ -504,20 +504,20 @@ discard block |
||
504 | 504 | $table = $wpdb->prefix . 'wpinv_subscriptions'; |
505 | 505 | |
506 | 506 | // Fetch invoices. |
507 | - $subscriptions = $wpdb->get_results( |
|
507 | + $subscriptions = $wpdb->get_results( |
|
508 | 508 | "SELECT parent_payment_id, product_id, expiration FROM $table |
509 | 509 | WHERE |
510 | 510 | $where |
511 | 511 | AND status IN ( 'trialling', 'active' )"); |
512 | 512 | |
513 | - foreach ( $subscriptions as $subscription ) { |
|
513 | + foreach ($subscriptions as $subscription) { |
|
514 | 514 | |
515 | 515 | // Skip packages. |
516 | - if ( get_post_meta( $subscription->product_id, '_wpinv_type', true ) == 'package' ) { |
|
516 | + if (get_post_meta($subscription->product_id, '_wpinv_type', true) == 'package') { |
|
517 | 517 | continue; |
518 | 518 | } |
519 | 519 | |
520 | - wpinv_send_pre_payment_reminder_notification( $subscription->parent_payment_id, $subscription->expiration ); |
|
520 | + wpinv_send_pre_payment_reminder_notification($subscription->parent_payment_id, $subscription->expiration); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | } |
@@ -525,44 +525,44 @@ discard block |
||
525 | 525 | function wpinv_email_payment_reminders() { |
526 | 526 | global $wpi_auto_reminder, $wpdb; |
527 | 527 | |
528 | - if ( ! wpinv_get_option( 'email_overdue_active' ) ) { |
|
528 | + if (!wpinv_get_option('email_overdue_active')) { |
|
529 | 529 | return; |
530 | 530 | } |
531 | 531 | |
532 | - if ( $reminder_days = wpinv_get_option( 'email_due_reminder_days' ) ) { |
|
532 | + if ($reminder_days = wpinv_get_option('email_due_reminder_days')) { |
|
533 | 533 | |
534 | 534 | // Get a list of all reminder dates. |
535 | - $reminder_days = is_array( $reminder_days ) ? array_values( $reminder_days ) : array(); |
|
535 | + $reminder_days = is_array($reminder_days) ? array_values($reminder_days) : array(); |
|
536 | 536 | |
537 | 537 | // Ensure we have integers. |
538 | - $reminder_days = array_unique( array_map( 'absint', $reminder_days ) ); |
|
538 | + $reminder_days = array_unique(array_map('absint', $reminder_days)); |
|
539 | 539 | |
540 | 540 | // Abort if non is selected. |
541 | - if ( empty( $reminder_days ) ) { |
|
541 | + if (empty($reminder_days)) { |
|
542 | 542 | return; |
543 | 543 | } |
544 | 544 | |
545 | 545 | // Fetch the max reminder day. |
546 | - $max_date = max( $reminder_days ); |
|
546 | + $max_date = max($reminder_days); |
|
547 | 547 | |
548 | 548 | // Todays date. |
549 | - $today = date( 'Y-m-d', current_time( 'timestamp' ) ); |
|
549 | + $today = date('Y-m-d', current_time('timestamp')); |
|
550 | 550 | |
551 | - if ( empty( $max_date ) ) { |
|
552 | - $where = $wpdb->prepare( "DATE(invoices.due_date)=%s", $today ); |
|
553 | - } else if ( 1 == count( $reminder_days ) ) { |
|
551 | + if (empty($max_date)) { |
|
552 | + $where = $wpdb->prepare("DATE(invoices.due_date)=%s", $today); |
|
553 | + } else if (1 == count($reminder_days)) { |
|
554 | 554 | $days = $reminder_days[0]; |
555 | - $date = date( 'Y-m-d', strtotime( "-$days days", current_time( 'timestamp' ) ) ); |
|
556 | - $where = $wpdb->prepare( "DATE(invoices.due_date)=%s", $date ); |
|
555 | + $date = date('Y-m-d', strtotime("-$days days", current_time('timestamp'))); |
|
556 | + $where = $wpdb->prepare("DATE(invoices.due_date)=%s", $date); |
|
557 | 557 | } else { |
558 | 558 | $in = array(); |
559 | 559 | |
560 | - foreach ( $reminder_days as $days ) { |
|
561 | - $date = date( 'Y-m-d', strtotime( "-$days days", current_time( 'timestamp' ) ) ); |
|
562 | - $in[] = $wpdb->prepare( "%s", $date ); |
|
560 | + foreach ($reminder_days as $days) { |
|
561 | + $date = date('Y-m-d', strtotime("-$days days", current_time('timestamp'))); |
|
562 | + $in[] = $wpdb->prepare("%s", $date); |
|
563 | 563 | } |
564 | 564 | |
565 | - $in = implode( ',', $in ); |
|
565 | + $in = implode(',', $in); |
|
566 | 566 | $where = "DATE(invoices.due_date) IN ($in)"; |
567 | 567 | } |
568 | 568 | |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $table = $wpdb->prefix . 'getpaid_invoices'; |
571 | 571 | |
572 | 572 | // Fetch invoices. |
573 | - $invoices = $wpdb->get_col( |
|
573 | + $invoices = $wpdb->get_col( |
|
574 | 574 | "SELECT posts.ID FROM $wpdb->posts as posts |
575 | 575 | LEFT JOIN $table as invoices ON invoices.post_id = posts.ID |
576 | 576 | WHERE |
@@ -578,144 +578,144 @@ discard block |
||
578 | 578 | AND posts.post_type = 'wpi_invoice' |
579 | 579 | AND posts.post_status = 'wpi-pending'"); |
580 | 580 | |
581 | - $wpi_auto_reminder = true; |
|
581 | + $wpi_auto_reminder = true; |
|
582 | 582 | |
583 | - foreach ( $invoices as $invoice ) { |
|
583 | + foreach ($invoices as $invoice) { |
|
584 | 584 | |
585 | - if ( 'payment_form' != get_post_meta( $invoice, 'wpinv_created_via', true ) ) { |
|
586 | - do_action( 'wpinv_send_payment_reminder_notification', $invoice ); |
|
585 | + if ('payment_form' != get_post_meta($invoice, 'wpinv_created_via', true)) { |
|
586 | + do_action('wpinv_send_payment_reminder_notification', $invoice); |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | } |
590 | 590 | |
591 | - $wpi_auto_reminder = false; |
|
591 | + $wpi_auto_reminder = false; |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
596 | 596 | * Sends an upcoming renewal notification. |
597 | 597 | */ |
598 | -function wpinv_send_pre_payment_reminder_notification( $invoice_id, $renewal_date ) { |
|
598 | +function wpinv_send_pre_payment_reminder_notification($invoice_id, $renewal_date) { |
|
599 | 599 | |
600 | 600 | $email_type = 'pre_payment'; |
601 | - if ( ! wpinv_email_is_enabled( $email_type ) ) { |
|
601 | + if (!wpinv_email_is_enabled($email_type)) { |
|
602 | 602 | return false; |
603 | 603 | } |
604 | 604 | |
605 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
606 | - if ( empty( $invoice ) ) { |
|
605 | + $invoice = wpinv_get_invoice($invoice_id); |
|
606 | + if (empty($invoice)) { |
|
607 | 607 | return false; |
608 | 608 | } |
609 | 609 | |
610 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
611 | - if ( ! is_email( $recipient ) ) { |
|
610 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
611 | + if (!is_email($recipient)) { |
|
612 | 612 | return false; |
613 | 613 | } |
614 | 614 | |
615 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
616 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
617 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
618 | - $message_body = wpinv_email_get_content( $email_type, $invoice_id, $invoice ); |
|
619 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
615 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
616 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
617 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
618 | + $message_body = wpinv_email_get_content($email_type, $invoice_id, $invoice); |
|
619 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
620 | 620 | |
621 | - $renewal_date = date_i18n( 'Y-m-d', strtotime( $renewal_date ) ); |
|
622 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
621 | + $renewal_date = date_i18n('Y-m-d', strtotime($renewal_date)); |
|
622 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
623 | 623 | 'invoice' => $invoice, |
624 | 624 | 'email_type' => $email_type, |
625 | - 'email_heading' => str_replace( '{subscription_renewal_date}', $renewal_date, $email_heading ), |
|
625 | + 'email_heading' => str_replace('{subscription_renewal_date}', $renewal_date, $email_heading), |
|
626 | 626 | 'sent_to_admin' => false, |
627 | 627 | 'plain_text' => false, |
628 | - 'message_body' => str_replace( '{subscription_renewal_date}', $renewal_date, $message_body ) |
|
629 | - ) ); |
|
628 | + 'message_body' => str_replace('{subscription_renewal_date}', $renewal_date, $message_body) |
|
629 | + )); |
|
630 | 630 | |
631 | - $content = wpinv_email_format_text( $content, $invoice ); |
|
631 | + $content = wpinv_email_format_text($content, $invoice); |
|
632 | 632 | |
633 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
633 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
634 | 634 | |
635 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
636 | - $recipient = wpinv_get_admin_email(); |
|
637 | - $subject .= ' - ADMIN BCC COPY'; |
|
638 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
635 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
636 | + $recipient = wpinv_get_admin_email(); |
|
637 | + $subject .= ' - ADMIN BCC COPY'; |
|
638 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | return $sent; |
642 | 642 | |
643 | 643 | } |
644 | 644 | |
645 | -function wpinv_send_payment_reminder_notification( $invoice_id ) { |
|
645 | +function wpinv_send_payment_reminder_notification($invoice_id) { |
|
646 | 646 | $email_type = 'overdue'; |
647 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
647 | + if (!wpinv_email_is_enabled($email_type)) { |
|
648 | 648 | return false; |
649 | 649 | } |
650 | 650 | |
651 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
652 | - if ( empty( $invoice ) ) { |
|
651 | + $invoice = wpinv_get_invoice($invoice_id); |
|
652 | + if (empty($invoice)) { |
|
653 | 653 | return false; |
654 | 654 | } |
655 | 655 | |
656 | - if ( !$invoice->needs_payment() ) { |
|
656 | + if (!$invoice->needs_payment()) { |
|
657 | 657 | return false; |
658 | 658 | } |
659 | 659 | |
660 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
661 | - if ( !is_email( $recipient ) ) { |
|
660 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
661 | + if (!is_email($recipient)) { |
|
662 | 662 | return false; |
663 | 663 | } |
664 | 664 | |
665 | - do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type ); |
|
665 | + do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type); |
|
666 | 666 | |
667 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
668 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
669 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
670 | - $message_body = wpinv_email_get_content( $email_type, $invoice_id, $invoice ); |
|
671 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
667 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
668 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
669 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
670 | + $message_body = wpinv_email_get_content($email_type, $invoice_id, $invoice); |
|
671 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
672 | 672 | |
673 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
673 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
674 | 674 | 'invoice' => $invoice, |
675 | 675 | 'email_type' => $email_type, |
676 | 676 | 'email_heading' => $email_heading, |
677 | 677 | 'sent_to_admin' => false, |
678 | 678 | 'plain_text' => false, |
679 | 679 | 'message_body' => $message_body |
680 | - ) ); |
|
680 | + )); |
|
681 | 681 | |
682 | - $content = wpinv_email_format_text( $content, $invoice ); |
|
682 | + $content = wpinv_email_format_text($content, $invoice); |
|
683 | 683 | |
684 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
685 | - if ( $sent ) { |
|
686 | - do_action( 'wpinv_payment_reminder_sent', $invoice_id, $invoice ); |
|
684 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
685 | + if ($sent) { |
|
686 | + do_action('wpinv_payment_reminder_sent', $invoice_id, $invoice); |
|
687 | 687 | } |
688 | 688 | |
689 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
690 | - $recipient = wpinv_get_admin_email(); |
|
691 | - $subject .= ' - ADMIN BCC COPY'; |
|
692 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
689 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
690 | + $recipient = wpinv_get_admin_email(); |
|
691 | + $subject .= ' - ADMIN BCC COPY'; |
|
692 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
693 | 693 | } |
694 | 694 | |
695 | - do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type ); |
|
695 | + do_action('wpinv_post_send_invoice_notification', $invoice, $email_type); |
|
696 | 696 | |
697 | 697 | return $sent; |
698 | 698 | } |
699 | -add_action( 'wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1 ); |
|
699 | +add_action('wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1); |
|
700 | 700 | |
701 | -function wpinv_payment_reminder_sent( $invoice_id, $invoice ) { |
|
701 | +function wpinv_payment_reminder_sent($invoice_id, $invoice) { |
|
702 | 702 | global $wpi_auto_reminder; |
703 | 703 | |
704 | - $sent = get_post_meta( $invoice_id, '_wpinv_reminder_sent', true ); |
|
704 | + $sent = get_post_meta($invoice_id, '_wpinv_reminder_sent', true); |
|
705 | 705 | |
706 | - if ( empty( $sent ) ) { |
|
706 | + if (empty($sent)) { |
|
707 | 707 | $sent = array(); |
708 | 708 | } |
709 | - $sent[] = date_i18n( 'Y-m-d' ); |
|
709 | + $sent[] = date_i18n('Y-m-d'); |
|
710 | 710 | |
711 | - update_post_meta( $invoice_id, '_wpinv_reminder_sent', $sent ); |
|
711 | + update_post_meta($invoice_id, '_wpinv_reminder_sent', $sent); |
|
712 | 712 | |
713 | - if ( $wpi_auto_reminder ) { // Auto reminder note. |
|
714 | - $note = __( 'Automated reminder sent to the user.', 'invoicing' ); |
|
715 | - $invoice->add_note( $note, false, false, true ); |
|
713 | + if ($wpi_auto_reminder) { // Auto reminder note. |
|
714 | + $note = __('Automated reminder sent to the user.', 'invoicing'); |
|
715 | + $invoice->add_note($note, false, false, true); |
|
716 | 716 | } else { // Menual reminder note. |
717 | - $note = __( 'Manual reminder sent to the user.', 'invoicing' ); |
|
718 | - $invoice->add_note( $note ); |
|
717 | + $note = __('Manual reminder sent to the user.', 'invoicing'); |
|
718 | + $invoice->add_note($note); |
|
719 | 719 | } |
720 | 720 | } |
721 | -add_action( 'wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2 ); |
|
721 | +add_action('wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2); |
@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | * @version 1.0.19 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | // Prepare the due date reminder options. |
14 | 14 | $overdue_days_options = array(); |
15 | -$overdue_days_options['0'] = __( 'On the Due Date', 'invoicing' ); |
|
16 | -$overdue_days_options['1'] = __( '1 day after Due Date', 'invoicing' ); |
|
15 | +$overdue_days_options['0'] = __('On the Due Date', 'invoicing'); |
|
16 | +$overdue_days_options['1'] = __('1 day after Due Date', 'invoicing'); |
|
17 | 17 | |
18 | -for ( $i = 2; $i <= 10; $i++ ) { |
|
19 | - $overdue_days_options["$i"] = wp_sprintf( __( '%d days after Due Date', 'invoicing' ), $i ); |
|
18 | +for ($i = 2; $i <= 10; $i++) { |
|
19 | + $overdue_days_options["$i"] = wp_sprintf(__('%d days after Due Date', 'invoicing'), $i); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // Prepare up coming renewal reminder options. |
23 | 23 | $renewal_days_options = array(); |
24 | -$renewal_days_options['0'] = __( 'On the renewal date', 'invoicing' ); |
|
25 | -$renewal_days_options['1'] = __( '1 day before the renewal date', 'invoicing' ); |
|
24 | +$renewal_days_options['0'] = __('On the renewal date', 'invoicing'); |
|
25 | +$renewal_days_options['1'] = __('1 day before the renewal date', 'invoicing'); |
|
26 | 26 | |
27 | -for ( $i = 2; $i <= 10; $i++ ) { |
|
28 | - $renewal_days_options["$i"] = wp_sprintf( __( '%d days before the renewal date', 'invoicing' ), $i ); |
|
27 | +for ($i = 2; $i <= 10; $i++) { |
|
28 | + $renewal_days_options["$i"] = wp_sprintf(__('%d days before the renewal date', 'invoicing'), $i); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | // Default, built-in gateways |
@@ -34,45 +34,45 @@ discard block |
||
34 | 34 | |
35 | 35 | 'email_new_invoice_header' => array( |
36 | 36 | 'id' => 'email_new_invoice_header', |
37 | - 'name' => '<h3>' . __( 'New Invoice', 'invoicing' ) . '</h3>', |
|
38 | - 'desc' => __( 'These emails are sent to the site admin whenever there is a new invoice.', 'invoicing' ), |
|
37 | + 'name' => '<h3>' . __('New Invoice', 'invoicing') . '</h3>', |
|
38 | + 'desc' => __('These emails are sent to the site admin whenever there is a new invoice.', 'invoicing'), |
|
39 | 39 | 'type' => 'header', |
40 | 40 | ), |
41 | 41 | |
42 | 42 | 'email_new_invoice_active' => array( |
43 | 43 | 'id' => 'email_new_invoice_active', |
44 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
45 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
44 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
45 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
46 | 46 | 'type' => 'checkbox', |
47 | 47 | 'std' => 1 |
48 | 48 | ), |
49 | 49 | |
50 | 50 | 'email_new_invoice_subject' => array( |
51 | 51 | 'id' => 'email_new_invoice_subject', |
52 | - 'name' => __( 'Subject', 'invoicing' ), |
|
53 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
52 | + 'name' => __('Subject', 'invoicing'), |
|
53 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
54 | 54 | 'help-tip' => true, |
55 | 55 | 'type' => 'text', |
56 | - 'std' => __( '[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing' ), |
|
56 | + 'std' => __('[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing'), |
|
57 | 57 | 'size' => 'large' |
58 | 58 | ), |
59 | 59 | |
60 | 60 | 'email_new_invoice_heading' => array( |
61 | 61 | 'id' => 'email_new_invoice_heading', |
62 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
63 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
62 | + 'name' => __('Email Heading', 'invoicing'), |
|
63 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
64 | 64 | 'help-tip' => true, |
65 | 65 | 'type' => 'text', |
66 | - 'std' => __( 'New Invoice', 'invoicing' ), |
|
66 | + 'std' => __('New Invoice', 'invoicing'), |
|
67 | 67 | 'size' => 'large' |
68 | 68 | ), |
69 | 69 | |
70 | 70 | 'email_new_invoice_body' => array( |
71 | 71 | 'id' => 'email_new_invoice_body', |
72 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
73 | - 'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ), |
|
72 | + 'name' => __('Email Content', 'invoicing'), |
|
73 | + 'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'), |
|
74 | 74 | 'type' => 'rich_editor', |
75 | - 'std' => __( '<p>A new <a href="{invoice_link}">invoice</a> of {invoice_total} has been created for {name} on {site_title}.</p>', 'invoicing' ), |
|
75 | + 'std' => __('<p>A new <a href="{invoice_link}">invoice</a> of {invoice_total} has been created for {name} on {site_title}.</p>', 'invoicing'), |
|
76 | 76 | 'class' => 'large', |
77 | 77 | 'size' => '10' |
78 | 78 | ), |
@@ -82,45 +82,45 @@ discard block |
||
82 | 82 | |
83 | 83 | 'email_cancelled_invoice_header' => array( |
84 | 84 | 'id' => 'email_cancelled_invoice_header', |
85 | - 'name' => '<h3>' . __( 'Cancelled Invoice', 'invoicing' ) . '</h3>', |
|
86 | - 'desc' => __( 'These emails are sent to the site admin whenever invoices are cancelled.', 'invoicing' ), |
|
85 | + 'name' => '<h3>' . __('Cancelled Invoice', 'invoicing') . '</h3>', |
|
86 | + 'desc' => __('These emails are sent to the site admin whenever invoices are cancelled.', 'invoicing'), |
|
87 | 87 | 'type' => 'header', |
88 | 88 | ), |
89 | 89 | |
90 | 90 | 'email_cancelled_invoice_active' => array( |
91 | 91 | 'id' => 'email_cancelled_invoice_active', |
92 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
93 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
92 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
93 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
94 | 94 | 'type' => 'checkbox', |
95 | 95 | 'std' => 1 |
96 | 96 | ), |
97 | 97 | |
98 | 98 | 'email_cancelled_invoice_subject' => array( |
99 | 99 | 'id' => 'email_cancelled_invoice_subject', |
100 | - 'name' => __( 'Subject', 'invoicing' ), |
|
101 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
100 | + 'name' => __('Subject', 'invoicing'), |
|
101 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
102 | 102 | 'help-tip' => true, |
103 | 103 | 'type' => 'text', |
104 | - 'std' => __( '[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing' ), |
|
104 | + 'std' => __('[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing'), |
|
105 | 105 | 'size' => 'large' |
106 | 106 | ), |
107 | 107 | |
108 | 108 | 'email_cancelled_invoice_heading' => array( |
109 | 109 | 'id' => 'email_cancelled_invoice_heading', |
110 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
111 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
110 | + 'name' => __('Email Heading', 'invoicing'), |
|
111 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
112 | 112 | 'help-tip' => true, |
113 | 113 | 'type' => 'text', |
114 | - 'std' => __( 'Cancelled Invoice', 'invoicing' ), |
|
114 | + 'std' => __('Cancelled Invoice', 'invoicing'), |
|
115 | 115 | 'size' => 'large' |
116 | 116 | ), |
117 | 117 | |
118 | 118 | 'email_cancelled_invoice_body' => array( |
119 | 119 | 'id' => 'email_cancelled_invoice_body', |
120 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
121 | - 'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ), |
|
120 | + 'name' => __('Email Content', 'invoicing'), |
|
121 | + 'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'), |
|
122 | 122 | 'type' => 'rich_editor', |
123 | - 'std' => __( '<p>The invoice <a href="{invoice_link}">#{invoice_number}</a> created for {name} on {site_title} has been cancelled.</p>', 'invoicing' ), |
|
123 | + 'std' => __('<p>The invoice <a href="{invoice_link}">#{invoice_number}</a> created for {name} on {site_title} has been cancelled.</p>', 'invoicing'), |
|
124 | 124 | 'class' => 'large', |
125 | 125 | 'size' => '10' |
126 | 126 | ), |
@@ -130,45 +130,45 @@ discard block |
||
130 | 130 | |
131 | 131 | 'email_failed_invoice_header' => array( |
132 | 132 | 'id' => 'email_failed_invoice_header', |
133 | - 'name' => '<h3>' . __( 'Failed Invoice', 'invoicing' ) . '</h3>', |
|
134 | - 'desc' => __( 'Failed invoice emails are sent to the site admin when invoice payments fail.', 'invoicing' ), |
|
133 | + 'name' => '<h3>' . __('Failed Invoice', 'invoicing') . '</h3>', |
|
134 | + 'desc' => __('Failed invoice emails are sent to the site admin when invoice payments fail.', 'invoicing'), |
|
135 | 135 | 'type' => 'header', |
136 | 136 | ), |
137 | 137 | |
138 | 138 | 'email_failed_invoice_active' => array( |
139 | 139 | 'id' => 'email_failed_invoice_active', |
140 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
141 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
140 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
141 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
142 | 142 | 'type' => 'checkbox', |
143 | 143 | 'std' => 1 |
144 | 144 | ), |
145 | 145 | |
146 | 146 | 'email_failed_invoice_subject' => array( |
147 | 147 | 'id' => 'email_failed_invoice_subject', |
148 | - 'name' => __( 'Subject', 'invoicing' ), |
|
149 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
148 | + 'name' => __('Subject', 'invoicing'), |
|
149 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
150 | 150 | 'help-tip' => true, |
151 | 151 | 'type' => 'text', |
152 | - 'std' => __( '[{site_title}] Failed invoice ({invoice_number})', 'invoicing' ), |
|
152 | + 'std' => __('[{site_title}] Failed invoice ({invoice_number})', 'invoicing'), |
|
153 | 153 | 'size' => 'large' |
154 | 154 | ), |
155 | 155 | |
156 | 156 | 'email_failed_invoice_heading' => array( |
157 | 157 | 'id' => 'email_failed_invoice_heading', |
158 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
159 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
158 | + 'name' => __('Email Heading', 'invoicing'), |
|
159 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
160 | 160 | 'help-tip' => true, |
161 | 161 | 'type' => 'text', |
162 | - 'std' => __( 'Failed invoice', 'invoicing' ), |
|
162 | + 'std' => __('Failed invoice', 'invoicing'), |
|
163 | 163 | 'size' => 'large' |
164 | 164 | ), |
165 | 165 | |
166 | 166 | 'email_failed_invoice_body' => array( |
167 | 167 | 'id' => 'email_failed_invoice_body', |
168 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
169 | - 'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ), |
|
168 | + 'name' => __('Email Content', 'invoicing'), |
|
169 | + 'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'), |
|
170 | 170 | 'type' => 'rich_editor', |
171 | - 'std' => __( '<p>Payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title} has failed to go through.</p>', 'invoicing' ), |
|
171 | + 'std' => __('<p>Payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title} has failed to go through.</p>', 'invoicing'), |
|
172 | 172 | 'class' => 'large', |
173 | 173 | 'size' => '10' |
174 | 174 | ), |
@@ -178,53 +178,53 @@ discard block |
||
178 | 178 | |
179 | 179 | 'email_onhold_invoice_header' => array( |
180 | 180 | 'id' => 'email_onhold_invoice_header', |
181 | - 'name' => '<h3>' . __( 'On Hold Invoice', 'invoicing' ) . '</h3>', |
|
182 | - 'desc' => __( 'These emails are sent to customers whenever their invoices are held.', 'invoicing' ), |
|
181 | + 'name' => '<h3>' . __('On Hold Invoice', 'invoicing') . '</h3>', |
|
182 | + 'desc' => __('These emails are sent to customers whenever their invoices are held.', 'invoicing'), |
|
183 | 183 | 'type' => 'header', |
184 | 184 | ), |
185 | 185 | |
186 | 186 | 'email_onhold_invoice_active' => array( |
187 | 187 | 'id' => 'email_onhold_invoice_active', |
188 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
189 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
188 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
189 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
190 | 190 | 'type' => 'checkbox', |
191 | 191 | 'std' => 1 |
192 | 192 | ), |
193 | 193 | |
194 | 194 | 'email_onhold_invoice_admin_bcc' => array( |
195 | 195 | 'id' => 'email_onhold_invoice_admin_bcc', |
196 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
197 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
196 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
197 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
198 | 198 | 'type' => 'checkbox', |
199 | 199 | 'std' => 1 |
200 | 200 | ), |
201 | 201 | |
202 | 202 | 'email_onhold_invoice_subject' => array( |
203 | 203 | 'id' => 'email_onhold_invoice_subject', |
204 | - 'name' => __( 'Subject', 'invoicing' ), |
|
205 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
204 | + 'name' => __('Subject', 'invoicing'), |
|
205 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
206 | 206 | 'help-tip' => true, |
207 | 207 | 'type' => 'text', |
208 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
208 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
209 | 209 | 'size' => 'large' |
210 | 210 | ), |
211 | 211 | |
212 | 212 | 'email_onhold_invoice_heading' => array( |
213 | 213 | 'id' => 'email_onhold_invoice_heading', |
214 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
215 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
214 | + 'name' => __('Email Heading', 'invoicing'), |
|
215 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
216 | 216 | 'help-tip' => true, |
217 | 217 | 'type' => 'text', |
218 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
218 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
219 | 219 | 'size' => 'large' |
220 | 220 | ), |
221 | 221 | |
222 | 222 | 'email_onhold_invoice_body' => array( |
223 | 223 | 'id' => 'email_onhold_invoice_body', |
224 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
225 | - 'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ), |
|
224 | + 'name' => __('Email Content', 'invoicing'), |
|
225 | + 'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'), |
|
226 | 226 | 'type' => 'rich_editor', |
227 | - 'std' => __( '<p>Hi {name},</p><p>Your invoice is on-hold and will be processed when we receive your payment.</p>', 'invoicing' ), |
|
227 | + 'std' => __('<p>Hi {name},</p><p>Your invoice is on-hold and will be processed when we receive your payment.</p>', 'invoicing'), |
|
228 | 228 | 'class' => 'large', |
229 | 229 | 'size' => '10' |
230 | 230 | ), |
@@ -235,53 +235,53 @@ discard block |
||
235 | 235 | |
236 | 236 | 'email_processing_invoice_header' => array( |
237 | 237 | 'id' => 'email_processing_invoice_header', |
238 | - 'name' => '<h3>' . __( 'Processing Invoice', 'invoicing' ) . '</h3>', |
|
239 | - 'desc' => __( 'These emails are sent to users whenever payments for their invoices are processing.', 'invoicing' ), |
|
238 | + 'name' => '<h3>' . __('Processing Invoice', 'invoicing') . '</h3>', |
|
239 | + 'desc' => __('These emails are sent to users whenever payments for their invoices are processing.', 'invoicing'), |
|
240 | 240 | 'type' => 'header', |
241 | 241 | ), |
242 | 242 | |
243 | 243 | 'email_processing_invoice_active' => array( |
244 | 244 | 'id' => 'email_processing_invoice_active', |
245 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
246 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
245 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
246 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
247 | 247 | 'type' => 'checkbox', |
248 | 248 | 'std' => 1 |
249 | 249 | ), |
250 | 250 | |
251 | 251 | 'email_processing_invoice_admin_bcc' => array( |
252 | 252 | 'id' => 'email_processing_invoice_admin_bcc', |
253 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
254 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
253 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
254 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
255 | 255 | 'type' => 'checkbox', |
256 | 256 | 'std' => 1 |
257 | 257 | ), |
258 | 258 | |
259 | 259 | 'email_processing_invoice_subject' => array( |
260 | 260 | 'id' => 'email_processing_invoice_subject', |
261 | - 'name' => __( 'Subject', 'invoicing' ), |
|
262 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
261 | + 'name' => __('Subject', 'invoicing'), |
|
262 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
263 | 263 | 'help-tip' => true, |
264 | 264 | 'type' => 'text', |
265 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
265 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
266 | 266 | 'size' => 'large' |
267 | 267 | ), |
268 | 268 | |
269 | 269 | 'email_processing_invoice_heading' => array( |
270 | 270 | 'id' => 'email_processing_invoice_heading', |
271 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
272 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
271 | + 'name' => __('Email Heading', 'invoicing'), |
|
272 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
273 | 273 | 'help-tip' => true, |
274 | 274 | 'type' => 'text', |
275 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
275 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
276 | 276 | 'size' => 'large' |
277 | 277 | ), |
278 | 278 | |
279 | 279 | 'email_processing_invoice_body' => array( |
280 | 280 | 'id' => 'email_processing_invoice_body', |
281 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
282 | - 'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ), |
|
281 | + 'name' => __('Email Content', 'invoicing'), |
|
282 | + 'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'), |
|
283 | 283 | 'type' => 'rich_editor', |
284 | - 'std' => __( '<p>Hi {name},</p><p>I would like to let you know that we have received and are currently processing your payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title}.</p>', 'invoicing' ), |
|
284 | + 'std' => __('<p>Hi {name},</p><p>I would like to let you know that we have received and are currently processing your payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title}.</p>', 'invoicing'), |
|
285 | 285 | 'class' => 'large', |
286 | 286 | 'size' => '10' |
287 | 287 | ), |
@@ -292,61 +292,61 @@ discard block |
||
292 | 292 | |
293 | 293 | 'email_completed_invoice_header' => array( |
294 | 294 | 'id' => 'email_completed_invoice_header', |
295 | - 'name' => '<h3>' . __( 'Paid Invoice', 'invoicing' ) . '</h3>', |
|
296 | - 'desc' => __( 'These emails are sent to customers when their invoices are marked as paid.', 'invoicing' ), |
|
295 | + 'name' => '<h3>' . __('Paid Invoice', 'invoicing') . '</h3>', |
|
296 | + 'desc' => __('These emails are sent to customers when their invoices are marked as paid.', 'invoicing'), |
|
297 | 297 | 'type' => 'header', |
298 | 298 | ), |
299 | 299 | |
300 | 300 | 'email_completed_invoice_active' => array( |
301 | 301 | 'id' => 'email_completed_invoice_active', |
302 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
303 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
302 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
303 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
304 | 304 | 'type' => 'checkbox', |
305 | 305 | 'std' => 1 |
306 | 306 | ), |
307 | 307 | |
308 | 308 | 'email_completed_invoice_renewal_active' => array( |
309 | 309 | 'id' => 'email_completed_invoice_renewal_active', |
310 | - 'name' => __( 'Enable renewal notification', 'invoicing' ), |
|
311 | - 'desc' => __( 'Should this email be sent for renewals too?', 'invoicing' ), |
|
310 | + 'name' => __('Enable renewal notification', 'invoicing'), |
|
311 | + 'desc' => __('Should this email be sent for renewals too?', 'invoicing'), |
|
312 | 312 | 'type' => 'checkbox', |
313 | 313 | 'std' => 1 |
314 | 314 | ), |
315 | 315 | |
316 | 316 | 'email_completed_invoice_admin_bcc' => array( |
317 | 317 | 'id' => 'email_completed_invoice_admin_bcc', |
318 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
319 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
318 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
319 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
320 | 320 | 'type' => 'checkbox', |
321 | 321 | 'std' => 1, |
322 | 322 | ), |
323 | 323 | |
324 | 324 | 'email_completed_invoice_subject' => array( |
325 | 325 | 'id' => 'email_completed_invoice_subject', |
326 | - 'name' => __( 'Subject', 'invoicing' ), |
|
327 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
326 | + 'name' => __('Subject', 'invoicing'), |
|
327 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
328 | 328 | 'help-tip' => true, |
329 | 329 | 'type' => 'text', |
330 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing' ), |
|
330 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing'), |
|
331 | 331 | 'size' => 'large' |
332 | 332 | ), |
333 | 333 | |
334 | 334 | 'email_completed_invoice_heading' => array( |
335 | 335 | 'id' => 'email_completed_invoice_heading', |
336 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
337 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
336 | + 'name' => __('Email Heading', 'invoicing'), |
|
337 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
338 | 338 | 'help-tip' => true, |
339 | 339 | 'type' => 'text', |
340 | - 'std' => __( 'Your invoice has been paid', 'invoicing' ), |
|
340 | + 'std' => __('Your invoice has been paid', 'invoicing'), |
|
341 | 341 | 'size' => 'large' |
342 | 342 | ), |
343 | 343 | |
344 | 344 | 'email_completed_invoice_body' => array( |
345 | 345 | 'id' => 'email_completed_invoice_body', |
346 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
347 | - 'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ), |
|
346 | + 'name' => __('Email Content', 'invoicing'), |
|
347 | + 'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'), |
|
348 | 348 | 'type' => 'rich_editor', |
349 | - 'std' => __( '<p>Hi {name},</p><p>Your recent invoice on {site_title} has been paid.</p>', 'invoicing' ), |
|
349 | + 'std' => __('<p>Hi {name},</p><p>Your recent invoice on {site_title} has been paid.</p>', 'invoicing'), |
|
350 | 350 | 'class' => 'large', |
351 | 351 | 'size' => '10' |
352 | 352 | ), |
@@ -357,53 +357,53 @@ discard block |
||
357 | 357 | |
358 | 358 | 'email_refunded_invoice_header' => array( |
359 | 359 | 'id' => 'email_refunded_invoice_header', |
360 | - 'name' => '<h3>' . __( 'Refunded Invoice', 'invoicing' ) . '</h3>', |
|
361 | - 'desc' => __( 'These emails are sent to users when their invoices are marked as refunded.', 'invoicing' ), |
|
360 | + 'name' => '<h3>' . __('Refunded Invoice', 'invoicing') . '</h3>', |
|
361 | + 'desc' => __('These emails are sent to users when their invoices are marked as refunded.', 'invoicing'), |
|
362 | 362 | 'type' => 'header', |
363 | 363 | ), |
364 | 364 | |
365 | 365 | 'email_refunded_invoice_active' => array( |
366 | 366 | 'id' => 'email_refunded_invoice_active', |
367 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
368 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
367 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
368 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
369 | 369 | 'type' => 'checkbox', |
370 | 370 | 'std' => 1 |
371 | 371 | ), |
372 | 372 | |
373 | 373 | 'email_refunded_invoice_admin_bcc' => array( |
374 | 374 | 'id' => 'email_refunded_invoice_admin_bcc', |
375 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
376 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
375 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
376 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
377 | 377 | 'type' => 'checkbox', |
378 | 378 | 'std' => 1 |
379 | 379 | ), |
380 | 380 | |
381 | 381 | 'email_refunded_invoice_subject' => array( |
382 | 382 | 'id' => 'email_refunded_invoice_subject', |
383 | - 'name' => __( 'Subject', 'invoicing' ), |
|
384 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
383 | + 'name' => __('Subject', 'invoicing'), |
|
384 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
385 | 385 | 'help-tip' => true, |
386 | 386 | 'type' => 'text', |
387 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing' ), |
|
387 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing'), |
|
388 | 388 | 'size' => 'large' |
389 | 389 | ), |
390 | 390 | |
391 | 391 | 'email_refunded_invoice_heading' => array( |
392 | 392 | 'id' => 'email_refunded_invoice_heading', |
393 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
394 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
393 | + 'name' => __('Email Heading', 'invoicing'), |
|
394 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
395 | 395 | 'help-tip' => true, |
396 | 396 | 'type' => 'text', |
397 | - 'std' => __( 'Your invoice has been refunded', 'invoicing' ), |
|
397 | + 'std' => __('Your invoice has been refunded', 'invoicing'), |
|
398 | 398 | 'size' => 'large' |
399 | 399 | ), |
400 | 400 | |
401 | 401 | 'email_refunded_invoice_body' => array( |
402 | 402 | 'id' => 'email_refunded_invoice_body', |
403 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
404 | - 'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ), |
|
403 | + 'name' => __('Email Content', 'invoicing'), |
|
404 | + 'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'), |
|
405 | 405 | 'type' => 'rich_editor', |
406 | - 'std' => __( '<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded.</p>', 'invoicing' ), |
|
406 | + 'std' => __('<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded.</p>', 'invoicing'), |
|
407 | 407 | 'class' => 'large', |
408 | 408 | 'size' => '10' |
409 | 409 | ), |
@@ -414,53 +414,53 @@ discard block |
||
414 | 414 | |
415 | 415 | 'email_user_invoice_header' => array( |
416 | 416 | 'id' => 'email_user_invoice_header', |
417 | - 'name' => '<h3>' . __( 'Customer Invoice', 'invoicing' ) . '</h3>', |
|
418 | - 'desc' => __( 'These emails are sent to customers containing their invoice information and payment links.', 'invoicing' ), |
|
417 | + 'name' => '<h3>' . __('Customer Invoice', 'invoicing') . '</h3>', |
|
418 | + 'desc' => __('These emails are sent to customers containing their invoice information and payment links.', 'invoicing'), |
|
419 | 419 | 'type' => 'header', |
420 | 420 | ), |
421 | 421 | |
422 | 422 | 'email_user_invoice_active' => array( |
423 | 423 | 'id' => 'email_user_invoice_active', |
424 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
425 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
424 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
425 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
426 | 426 | 'type' => 'checkbox', |
427 | 427 | 'std' => 1 |
428 | 428 | ), |
429 | 429 | |
430 | 430 | 'email_user_invoice_admin_bcc' => array( |
431 | 431 | 'id' => 'email_user_invoice_admin_bcc', |
432 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
433 | - 'desc' => __( 'Check if you want to send a copy of this notification email to to the site admin.', 'invoicing' ), |
|
432 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
433 | + 'desc' => __('Check if you want to send a copy of this notification email to to the site admin.', 'invoicing'), |
|
434 | 434 | 'type' => 'checkbox', |
435 | 435 | 'std' => 0 |
436 | 436 | ), |
437 | 437 | |
438 | 438 | 'email_user_invoice_subject' => array( |
439 | 439 | 'id' => 'email_user_invoice_subject', |
440 | - 'name' => __( 'Subject', 'invoicing' ), |
|
441 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
440 | + 'name' => __('Subject', 'invoicing'), |
|
441 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
442 | 442 | 'help-tip' => true, |
443 | 443 | 'type' => 'text', |
444 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date}', 'invoicing' ), |
|
444 | + 'std' => __('[{site_title}] Your invoice from {invoice_date}', 'invoicing'), |
|
445 | 445 | 'size' => 'large' |
446 | 446 | ), |
447 | 447 | |
448 | 448 | 'email_user_invoice_heading' => array( |
449 | 449 | 'id' => 'email_user_invoice_heading', |
450 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
451 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
450 | + 'name' => __('Email Heading', 'invoicing'), |
|
451 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
452 | 452 | 'help-tip' => true, |
453 | 453 | 'type' => 'text', |
454 | - 'std' => __( 'Your invoice {invoice_number} details', 'invoicing' ), |
|
454 | + 'std' => __('Your invoice {invoice_number} details', 'invoicing'), |
|
455 | 455 | 'size' => 'large' |
456 | 456 | ), |
457 | 457 | |
458 | 458 | 'email_user_invoice_body' => array( |
459 | 459 | 'id' => 'email_user_invoice_body', |
460 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
461 | - 'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ), |
|
460 | + 'name' => __('Email Content', 'invoicing'), |
|
461 | + 'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'), |
|
462 | 462 | 'type' => 'rich_editor', |
463 | - 'std' => __( '<p>Hi {name},</p><p>An invoice of {invoice_total} has been created for you on {site_title}. You can <a href="{invoice_link}">view</a> or <a href="{invoice_pay_link}">pay</a> the invoice. Please reply to this email if you have any questions about the invoice.', 'invoicing' ), |
|
463 | + 'std' => __('<p>Hi {name},</p><p>An invoice of {invoice_total} has been created for you on {site_title}. You can <a href="{invoice_link}">view</a> or <a href="{invoice_pay_link}">pay</a> the invoice. Please reply to this email if you have any questions about the invoice.', 'invoicing'), |
|
464 | 464 | 'class' => 'large', |
465 | 465 | 'size' => '10' |
466 | 466 | ), |
@@ -470,53 +470,53 @@ discard block |
||
470 | 470 | |
471 | 471 | 'email_user_note_header' => array( |
472 | 472 | 'id' => 'email_user_note_header', |
473 | - 'name' => '<h3>' . __( 'Customer Note', 'invoicing' ) . '</h3>', |
|
474 | - 'desc' => __( 'These emails are sent when you add a customer note to an invoice/quote.', 'invoicing' ), |
|
473 | + 'name' => '<h3>' . __('Customer Note', 'invoicing') . '</h3>', |
|
474 | + 'desc' => __('These emails are sent when you add a customer note to an invoice/quote.', 'invoicing'), |
|
475 | 475 | 'type' => 'header', |
476 | 476 | ), |
477 | 477 | |
478 | 478 | 'email_user_note_active' => array( |
479 | 479 | 'id' => 'email_user_note_active', |
480 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
481 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
480 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
481 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
482 | 482 | 'type' => 'checkbox', |
483 | 483 | 'std' => 1 |
484 | 484 | ), |
485 | 485 | |
486 | 486 | 'email_user_note_admin_bcc' => array( |
487 | 487 | 'id' => 'email_user_note_admin_bcc', |
488 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
489 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
488 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
489 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
490 | 490 | 'type' => 'checkbox', |
491 | 491 | 'std' => 0 |
492 | 492 | ), |
493 | 493 | |
494 | 494 | 'email_user_note_subject' => array( |
495 | 495 | 'id' => 'email_user_note_subject', |
496 | - 'name' => __( 'Subject', 'invoicing' ), |
|
497 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
496 | + 'name' => __('Subject', 'invoicing'), |
|
497 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
498 | 498 | 'help-tip' => true, |
499 | 499 | 'type' => 'text', |
500 | - 'std' => __( '[{site_title}] Note added to your {invoice_label} #{invoice_number} from {invoice_date}', 'invoicing' ), |
|
500 | + 'std' => __('[{site_title}] Note added to your {invoice_label} #{invoice_number} from {invoice_date}', 'invoicing'), |
|
501 | 501 | 'size' => 'large' |
502 | 502 | ), |
503 | 503 | |
504 | 504 | 'email_user_note_heading' => array( |
505 | 505 | 'id' => 'email_user_note_heading', |
506 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
507 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
506 | + 'name' => __('Email Heading', 'invoicing'), |
|
507 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
508 | 508 | 'help-tip' => true, |
509 | 509 | 'type' => 'text', |
510 | - 'std' => __( 'A note has been added to your {invoice_label}', 'invoicing' ), |
|
510 | + 'std' => __('A note has been added to your {invoice_label}', 'invoicing'), |
|
511 | 511 | 'size' => 'large' |
512 | 512 | ), |
513 | 513 | |
514 | 514 | 'email_user_note_body' => array( |
515 | 515 | 'id' => 'email_user_note_body', |
516 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
517 | - 'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ), |
|
516 | + 'name' => __('Email Content', 'invoicing'), |
|
517 | + 'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'), |
|
518 | 518 | 'type' => 'rich_editor', |
519 | - 'std' => __( '<p>Hi {name},</p><p>Following note has been added to your {invoice_label}:</p><blockquote class="wpinv-note">{customer_note}</blockquote>', 'invoicing' ), |
|
519 | + 'std' => __('<p>Hi {name},</p><p>Following note has been added to your {invoice_label}:</p><blockquote class="wpinv-note">{customer_note}</blockquote>', 'invoicing'), |
|
520 | 520 | 'class' => 'large', |
521 | 521 | 'size' => '10' |
522 | 522 | ), |
@@ -527,63 +527,63 @@ discard block |
||
527 | 527 | |
528 | 528 | 'email_overdue_header' => array( |
529 | 529 | 'id' => 'email_overdue_header', |
530 | - 'name' => '<h3>' . __( 'Payment Reminder', 'invoicing' ) . '</h3>', |
|
531 | - 'desc' => __( 'Payment reminder emails are sent to customers whenever their invoices are due.', 'invoicing' ), |
|
530 | + 'name' => '<h3>' . __('Payment Reminder', 'invoicing') . '</h3>', |
|
531 | + 'desc' => __('Payment reminder emails are sent to customers whenever their invoices are due.', 'invoicing'), |
|
532 | 532 | 'type' => 'header', |
533 | 533 | ), |
534 | 534 | |
535 | 535 | 'email_overdue_active' => array( |
536 | 536 | 'id' => 'email_overdue_active', |
537 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
538 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
537 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
538 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
539 | 539 | 'type' => 'checkbox', |
540 | 540 | 'std' => 1 |
541 | 541 | ), |
542 | 542 | |
543 | 543 | 'email_overdue_admin_bcc' => array( |
544 | 544 | 'id' => 'email_overdue_admin_bcc', |
545 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
546 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
545 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
546 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
547 | 547 | 'type' => 'checkbox', |
548 | 548 | 'std' => 0 |
549 | 549 | ), |
550 | 550 | |
551 | 551 | 'email_due_reminder_days' => array( |
552 | 552 | 'id' => 'email_due_reminder_days', |
553 | - 'name' => __( 'When to Send', 'invoicing' ), |
|
554 | - 'desc' => __( 'Check when you would like payment reminders sent out.', 'invoicing' ), |
|
553 | + 'name' => __('When to Send', 'invoicing'), |
|
554 | + 'desc' => __('Check when you would like payment reminders sent out.', 'invoicing'), |
|
555 | 555 | 'help-tip' => true, |
556 | - 'std' => array( '1' ), |
|
556 | + 'std' => array('1'), |
|
557 | 557 | 'type' => 'multicheck', |
558 | 558 | 'options' => $overdue_days_options, |
559 | 559 | ), |
560 | 560 | |
561 | 561 | 'email_overdue_subject' => array( |
562 | 562 | 'id' => 'email_overdue_subject', |
563 | - 'name' => __( 'Subject', 'invoicing' ), |
|
564 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
563 | + 'name' => __('Subject', 'invoicing'), |
|
564 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
565 | 565 | 'help-tip' => true, |
566 | 566 | 'type' => 'text', |
567 | - 'std' => __( '[{site_title}] Payment Reminder', 'invoicing' ), |
|
567 | + 'std' => __('[{site_title}] Payment Reminder', 'invoicing'), |
|
568 | 568 | 'size' => 'large' |
569 | 569 | ), |
570 | 570 | |
571 | 571 | 'email_overdue_heading' => array( |
572 | 572 | 'id' => 'email_overdue_heading', |
573 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
574 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
573 | + 'name' => __('Email Heading', 'invoicing'), |
|
574 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
575 | 575 | 'help-tip' => true, |
576 | 576 | 'type' => 'text', |
577 | - 'std' => __( 'Payment reminder for your invoice', 'invoicing' ), |
|
577 | + 'std' => __('Payment reminder for your invoice', 'invoicing'), |
|
578 | 578 | 'size' => 'large' |
579 | 579 | ), |
580 | 580 | |
581 | 581 | 'email_overdue_body' => array( |
582 | 582 | 'id' => 'email_overdue_body', |
583 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
584 | - 'desc' => __( 'The content of the email.', 'invoicing' ), |
|
583 | + 'name' => __('Email Content', 'invoicing'), |
|
584 | + 'desc' => __('The content of the email.', 'invoicing'), |
|
585 | 585 | 'type' => 'rich_editor', |
586 | - 'std' => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing' ), |
|
586 | + 'std' => __('<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing'), |
|
587 | 587 | 'class' => 'large', |
588 | 588 | 'size' => 10, |
589 | 589 | ), |
@@ -594,63 +594,63 @@ discard block |
||
594 | 594 | |
595 | 595 | 'email_renewal_header' => array( |
596 | 596 | 'id' => 'email_renewal_header', |
597 | - 'name' => '<h3>' . __( 'Renewal Reminder', 'invoicing' ) . '</h3>', |
|
598 | - 'desc' => __( 'These emails are sent to customers whenever their subscription is about to expire.', 'invoicing' ), |
|
597 | + 'name' => '<h3>' . __('Renewal Reminder', 'invoicing') . '</h3>', |
|
598 | + 'desc' => __('These emails are sent to customers whenever their subscription is about to expire.', 'invoicing'), |
|
599 | 599 | 'type' => 'header', |
600 | 600 | ), |
601 | 601 | |
602 | 602 | 'email_renewal_active' => array( |
603 | 603 | 'id' => 'email_renewal_active', |
604 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
605 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
604 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
605 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
606 | 606 | 'type' => 'checkbox', |
607 | 607 | 'std' => 0 |
608 | 608 | ), |
609 | 609 | |
610 | 610 | 'email_renewal_reminder_admin_bcc' => array( |
611 | 611 | 'id' => 'email_renewal_reminder_admin_bcc', |
612 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
613 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
612 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
613 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
614 | 614 | 'type' => 'checkbox', |
615 | 615 | 'std' => 1 |
616 | 616 | ), |
617 | 617 | |
618 | 618 | 'email_renewal_reminder_days' => array( |
619 | 619 | 'id' => 'email_renewal_reminder_days', |
620 | - 'name' => __( 'When to Send', 'invoicing' ), |
|
621 | - 'desc' => __( 'Check when you would like renewal reminders sent out.', 'invoicing' ), |
|
620 | + 'name' => __('When to Send', 'invoicing'), |
|
621 | + 'desc' => __('Check when you would like renewal reminders sent out.', 'invoicing'), |
|
622 | 622 | 'help-tip' => true, |
623 | - 'std' => array( '1', '5', '10' ), |
|
623 | + 'std' => array('1', '5', '10'), |
|
624 | 624 | 'type' => 'multicheck', |
625 | 625 | 'options' => $renewal_days_options, |
626 | 626 | ), |
627 | 627 | |
628 | 628 | 'email_renewal_reminder_subject' => array( |
629 | 629 | 'id' => 'email_renewal_reminder_subject', |
630 | - 'name' => __( 'Subject', 'invoicing' ), |
|
631 | - 'desc' => __( 'Enter the subject line for the email.', 'invoicing' ), |
|
630 | + 'name' => __('Subject', 'invoicing'), |
|
631 | + 'desc' => __('Enter the subject line for the email.', 'invoicing'), |
|
632 | 632 | 'help-tip' => true, |
633 | 633 | 'type' => 'text', |
634 | - 'std' => __( '[{site_title}] Renewal Reminder', 'invoicing' ), |
|
634 | + 'std' => __('[{site_title}] Renewal Reminder', 'invoicing'), |
|
635 | 635 | 'size' => 'large' |
636 | 636 | ), |
637 | 637 | |
638 | 638 | 'email_renewal_reminder_heading' => array( |
639 | 639 | 'id' => 'email_renewal_reminder_heading', |
640 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
641 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
640 | + 'name' => __('Email Heading', 'invoicing'), |
|
641 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
642 | 642 | 'help-tip' => true, |
643 | 643 | 'type' => 'text', |
644 | - 'std' => __( 'Upcoming renewal reminder', 'invoicing' ), |
|
644 | + 'std' => __('Upcoming renewal reminder', 'invoicing'), |
|
645 | 645 | 'size' => 'large' |
646 | 646 | ), |
647 | 647 | |
648 | 648 | 'email_renewal_reminder_body' => array( |
649 | 649 | 'id' => 'email_renewal_reminder_body', |
650 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
651 | - 'desc' => __( 'The content of the email.', 'invoicing' ), |
|
650 | + 'name' => __('Email Content', 'invoicing'), |
|
651 | + 'desc' => __('The content of the email.', 'invoicing'), |
|
652 | 652 | 'type' => 'rich_editor', |
653 | - 'std' => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder that your subscription for invoice <a href="{invoice_link}">#{invoice_number}</a> will renew on {subscription_renewal_date}.</p>', 'invoicing' ), |
|
653 | + 'std' => __('<p>Hi {full_name},</p><p>This is just a friendly reminder that your subscription for invoice <a href="{invoice_link}">#{invoice_number}</a> will renew on {subscription_renewal_date}.</p>', 'invoicing'), |
|
654 | 654 | 'class' => 'large', |
655 | 655 | 'size' => 10, |
656 | 656 | ), |
@@ -661,53 +661,53 @@ discard block |
||
661 | 661 | |
662 | 662 | 'email_subscription_trial_header' => array( |
663 | 663 | 'id' => 'email_subscription_trial_header', |
664 | - 'name' => '<h3>' . __( 'Trial Started', 'invoicing' ) . '</h3>', |
|
665 | - 'desc' => __( 'These emails are sent when a customer starts a subscription trial.', 'invoicing' ), |
|
664 | + 'name' => '<h3>' . __('Trial Started', 'invoicing') . '</h3>', |
|
665 | + 'desc' => __('These emails are sent when a customer starts a subscription trial.', 'invoicing'), |
|
666 | 666 | 'type' => 'header', |
667 | 667 | ), |
668 | 668 | |
669 | 669 | 'email_subscription_trial_active' => array( |
670 | 670 | 'id' => 'email_subscription_trial_active', |
671 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
672 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
671 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
672 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
673 | 673 | 'type' => 'checkbox', |
674 | 674 | 'std' => 0 |
675 | 675 | ), |
676 | 676 | |
677 | 677 | 'email_subscription_trial_bcc' => array( |
678 | 678 | 'id' => 'email_subscription_trial_admin_bcc', |
679 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
680 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
679 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
680 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
681 | 681 | 'type' => 'checkbox', |
682 | 682 | 'std' => 1 |
683 | 683 | ), |
684 | 684 | |
685 | 685 | 'email_subscription_trial_subject' => array( |
686 | 686 | 'id' => 'email_subscription_trial_subject', |
687 | - 'name' => __( 'Subject', 'invoicing' ), |
|
688 | - 'desc' => __( 'Enter the subject line for the subscription trial email.', 'invoicing' ), |
|
687 | + 'name' => __('Subject', 'invoicing'), |
|
688 | + 'desc' => __('Enter the subject line for the subscription trial email.', 'invoicing'), |
|
689 | 689 | 'help-tip' => true, |
690 | 690 | 'type' => 'text', |
691 | - 'std' => __( '[{site_title}] Trial Started', 'invoicing' ), |
|
691 | + 'std' => __('[{site_title}] Trial Started', 'invoicing'), |
|
692 | 692 | 'size' => 'large' |
693 | 693 | ), |
694 | 694 | |
695 | 695 | 'email_subscription_trial_heading' => array( |
696 | 696 | 'id' => 'email_subscription_trial_heading', |
697 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
698 | - 'desc' => __( 'Enter the main heading of this email.', 'invoicing' ), |
|
697 | + 'name' => __('Email Heading', 'invoicing'), |
|
698 | + 'desc' => __('Enter the main heading of this email.', 'invoicing'), |
|
699 | 699 | 'help-tip' => true, |
700 | 700 | 'type' => 'text', |
701 | - 'std' => __( 'Trial Started', 'invoicing' ), |
|
701 | + 'std' => __('Trial Started', 'invoicing'), |
|
702 | 702 | 'size' => 'large' |
703 | 703 | ), |
704 | 704 | |
705 | 705 | 'email_subscription_trial_body' => array( |
706 | 706 | 'id' => 'email_trial_body', |
707 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
708 | - 'desc' => __( 'The content of the email.', 'invoicing' ), |
|
707 | + 'name' => __('Email Content', 'invoicing'), |
|
708 | + 'desc' => __('The content of the email.', 'invoicing'), |
|
709 | 709 | 'type' => 'rich_editor', |
710 | - 'std' => __( '<p>Hi {first_name},</p><p>Your trial for {subscription_name} is now active and will expire on {subscription_expiry}.</p>', 'invoicing' ), |
|
710 | + 'std' => __('<p>Hi {first_name},</p><p>Your trial for {subscription_name} is now active and will expire on {subscription_expiry}.</p>', 'invoicing'), |
|
711 | 711 | 'class' => 'large', |
712 | 712 | 'size' => 10, |
713 | 713 | ), |
@@ -717,53 +717,53 @@ discard block |
||
717 | 717 | |
718 | 718 | 'email_subscription_cancelled_header' => array( |
719 | 719 | 'id' => 'email_subscription_cancelled_header', |
720 | - 'name' => '<h3>' . __( 'Subscription Cancelled', 'invoicing' ) . '</h3>', |
|
721 | - 'desc' => __( 'These emails are sent when a customer cancels their subscription.', 'invoicing' ), |
|
720 | + 'name' => '<h3>' . __('Subscription Cancelled', 'invoicing') . '</h3>', |
|
721 | + 'desc' => __('These emails are sent when a customer cancels their subscription.', 'invoicing'), |
|
722 | 722 | 'type' => 'header', |
723 | 723 | ), |
724 | 724 | |
725 | 725 | 'email_subscription_cancelled_active' => array( |
726 | 726 | 'id' => 'email_subscription_cancelled_active', |
727 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
728 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
727 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
728 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
729 | 729 | 'type' => 'checkbox', |
730 | 730 | 'std' => 1 |
731 | 731 | ), |
732 | 732 | |
733 | 733 | 'email_subscription_cancelled_bcc' => array( |
734 | 734 | 'id' => 'email_subscription_cancelled_admin_bcc', |
735 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
736 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
735 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
736 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
737 | 737 | 'type' => 'checkbox', |
738 | 738 | 'std' => 1 |
739 | 739 | ), |
740 | 740 | |
741 | 741 | 'email_subscription_cancelled_subject' => array( |
742 | 742 | 'id' => 'email_subscription_cancelled_subject', |
743 | - 'name' => __( 'Subject', 'invoicing' ), |
|
744 | - 'desc' => __( 'Enter the subject line for the subscription cancelled email.', 'invoicing' ), |
|
743 | + 'name' => __('Subject', 'invoicing'), |
|
744 | + 'desc' => __('Enter the subject line for the subscription cancelled email.', 'invoicing'), |
|
745 | 745 | 'help-tip' => true, |
746 | 746 | 'type' => 'text', |
747 | - 'std' => __( '[{site_title}] Subscription Cancelled', 'invoicing' ), |
|
747 | + 'std' => __('[{site_title}] Subscription Cancelled', 'invoicing'), |
|
748 | 748 | 'size' => 'large' |
749 | 749 | ), |
750 | 750 | |
751 | 751 | 'email_subscription_cancelled_heading' => array( |
752 | 752 | 'id' => 'email_subscription_complete_heading', |
753 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
754 | - 'desc' => __( 'Enter the main heading of this email.', 'invoicing' ), |
|
753 | + 'name' => __('Email Heading', 'invoicing'), |
|
754 | + 'desc' => __('Enter the main heading of this email.', 'invoicing'), |
|
755 | 755 | 'help-tip' => true, |
756 | 756 | 'type' => 'text', |
757 | - 'std' => __( 'Subscription Cancelled', 'invoicing' ), |
|
757 | + 'std' => __('Subscription Cancelled', 'invoicing'), |
|
758 | 758 | 'size' => 'large' |
759 | 759 | ), |
760 | 760 | |
761 | 761 | 'email_subscription_cancelled_body' => array( |
762 | 762 | 'id' => 'email_cancelled_body', |
763 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
764 | - 'desc' => __( 'The content of the email.', 'invoicing' ), |
|
763 | + 'name' => __('Email Content', 'invoicing'), |
|
764 | + 'desc' => __('The content of the email.', 'invoicing'), |
|
765 | 765 | 'type' => 'rich_editor', |
766 | - 'std' => __( '<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has been cancelled and will no longer renew.</p>', 'invoicing' ), |
|
766 | + 'std' => __('<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has been cancelled and will no longer renew.</p>', 'invoicing'), |
|
767 | 767 | 'class' => 'large', |
768 | 768 | 'size' => 10, |
769 | 769 | ), |
@@ -773,53 +773,53 @@ discard block |
||
773 | 773 | |
774 | 774 | 'email_subscription_expired_header' => array( |
775 | 775 | 'id' => 'email_subscription_expired_header', |
776 | - 'name' => '<h3>' . __( 'Subscription Expired', 'invoicing' ) . '</h3>', |
|
777 | - 'desc' => __( "These emails are sent when a customer's subscription expires and automatic renewal fails.", 'invoicing' ), |
|
776 | + 'name' => '<h3>' . __('Subscription Expired', 'invoicing') . '</h3>', |
|
777 | + 'desc' => __("These emails are sent when a customer's subscription expires and automatic renewal fails.", 'invoicing'), |
|
778 | 778 | 'type' => 'header', |
779 | 779 | ), |
780 | 780 | |
781 | 781 | 'email_subscription_expired_active' => array( |
782 | 782 | 'id' => 'email_subscription_expired_active', |
783 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
784 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
783 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
784 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
785 | 785 | 'type' => 'checkbox', |
786 | 786 | 'std' => 1 |
787 | 787 | ), |
788 | 788 | |
789 | 789 | 'email_subscription_expired_bcc' => array( |
790 | 790 | 'id' => 'email_subscription_expired_admin_bcc', |
791 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
792 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
791 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
792 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
793 | 793 | 'type' => 'checkbox', |
794 | 794 | 'std' => 1 |
795 | 795 | ), |
796 | 796 | |
797 | 797 | 'email_subscription_expired_subject' => array( |
798 | 798 | 'id' => 'email_subscription_expired_subject', |
799 | - 'name' => __( 'Subject', 'invoicing' ), |
|
800 | - 'desc' => __( 'Enter the subject line for the subscription expired email.', 'invoicing' ), |
|
799 | + 'name' => __('Subject', 'invoicing'), |
|
800 | + 'desc' => __('Enter the subject line for the subscription expired email.', 'invoicing'), |
|
801 | 801 | 'help-tip' => true, |
802 | 802 | 'type' => 'text', |
803 | - 'std' => __( '[{site_title}] Subscription Expired', 'invoicing' ), |
|
803 | + 'std' => __('[{site_title}] Subscription Expired', 'invoicing'), |
|
804 | 804 | 'size' => 'large' |
805 | 805 | ), |
806 | 806 | |
807 | 807 | 'email_subscription_expired_heading' => array( |
808 | 808 | 'id' => 'email_subscription_expired_heading', |
809 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
810 | - 'desc' => __( 'Enter the main heading of this email.', 'invoicing' ), |
|
809 | + 'name' => __('Email Heading', 'invoicing'), |
|
810 | + 'desc' => __('Enter the main heading of this email.', 'invoicing'), |
|
811 | 811 | 'type' => 'text', |
812 | - 'std' => __( 'Subscription Expired', 'invoicing' ), |
|
812 | + 'std' => __('Subscription Expired', 'invoicing'), |
|
813 | 813 | 'help-tip' => true, |
814 | 814 | 'size' => 'large' |
815 | 815 | ), |
816 | 816 | |
817 | 817 | 'email_subscription_expired_body' => array( |
818 | 818 | 'id' => 'email_expired_body', |
819 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
820 | - 'desc' => __( 'The content of the email.', 'invoicing' ), |
|
819 | + 'name' => __('Email Content', 'invoicing'), |
|
820 | + 'desc' => __('The content of the email.', 'invoicing'), |
|
821 | 821 | 'type' => 'rich_editor', |
822 | - 'std' => __( '<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has expired.</p>', 'invoicing' ), |
|
822 | + 'std' => __('<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has expired.</p>', 'invoicing'), |
|
823 | 823 | 'class' => 'large', |
824 | 824 | 'size' => 10, |
825 | 825 | ), |
@@ -829,53 +829,53 @@ discard block |
||
829 | 829 | |
830 | 830 | 'email_subscription_complete_header' => array( |
831 | 831 | 'id' => 'email_subscription_complete_header', |
832 | - 'name' => '<h3>' . __( 'Subscription Complete', 'invoicing' ) . '</h3>', |
|
833 | - 'desc' => __( 'These emails are sent when a customer completes their subscription.', 'invoicing' ), |
|
832 | + 'name' => '<h3>' . __('Subscription Complete', 'invoicing') . '</h3>', |
|
833 | + 'desc' => __('These emails are sent when a customer completes their subscription.', 'invoicing'), |
|
834 | 834 | 'type' => 'header', |
835 | 835 | ), |
836 | 836 | |
837 | 837 | 'email_subscription_complete_active' => array( |
838 | 838 | 'id' => 'email_subscription_complete_active', |
839 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
840 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
839 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
840 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
841 | 841 | 'type' => 'checkbox', |
842 | 842 | 'std' => 1 |
843 | 843 | ), |
844 | 844 | |
845 | 845 | 'email_subscription_complete_bcc' => array( |
846 | 846 | 'id' => 'email_subscription_complete_admin_bcc', |
847 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
848 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
847 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
848 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
849 | 849 | 'type' => 'checkbox', |
850 | 850 | 'std' => 1 |
851 | 851 | ), |
852 | 852 | |
853 | 853 | 'email_subscription_complete_subject' => array( |
854 | 854 | 'id' => 'email_subscription_complete_subject', |
855 | - 'name' => __( 'Subject', 'invoicing' ), |
|
856 | - 'desc' => __( 'Enter the subject line for the subscription complete email.', 'invoicing' ), |
|
855 | + 'name' => __('Subject', 'invoicing'), |
|
856 | + 'desc' => __('Enter the subject line for the subscription complete email.', 'invoicing'), |
|
857 | 857 | 'help-tip' => true, |
858 | 858 | 'type' => 'text', |
859 | - 'std' => __( '[{site_title}] Subscription Complete', 'invoicing' ), |
|
859 | + 'std' => __('[{site_title}] Subscription Complete', 'invoicing'), |
|
860 | 860 | 'size' => 'large' |
861 | 861 | ), |
862 | 862 | |
863 | 863 | 'email_subscription_complete_heading' => array( |
864 | 864 | 'id' => 'email_subscription_complete_heading', |
865 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
866 | - 'desc' => __( 'Enter the main heading of this email.', 'invoicing' ), |
|
865 | + 'name' => __('Email Heading', 'invoicing'), |
|
866 | + 'desc' => __('Enter the main heading of this email.', 'invoicing'), |
|
867 | 867 | 'help-tip' => true, |
868 | 868 | 'type' => 'text', |
869 | - 'std' => __( 'Subscription Complete', 'invoicing' ), |
|
869 | + 'std' => __('Subscription Complete', 'invoicing'), |
|
870 | 870 | 'size' => 'large' |
871 | 871 | ), |
872 | 872 | |
873 | 873 | 'email_subscription_complete_body' => array( |
874 | 874 | 'id' => 'email_complete_body', |
875 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
876 | - 'desc' => __( 'The content of the email.', 'invoicing' ), |
|
875 | + 'name' => __('Email Content', 'invoicing'), |
|
876 | + 'desc' => __('The content of the email.', 'invoicing'), |
|
877 | 877 | 'type' => 'rich_editor', |
878 | - 'std' => __( '<p>Hi {first_name},</p><p>Your subscription for {subscription_name} is now complete.</p>', 'invoicing' ), |
|
878 | + 'std' => __('<p>Hi {first_name},</p><p>Your subscription for {subscription_name} is now complete.</p>', 'invoicing'), |
|
879 | 879 | 'class' => 'large', |
880 | 880 | 'size' => 10, |
881 | 881 | ), |