@@ -7,11 +7,11 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | - <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'The total payable text', 'invoicing' ) ?></label> |
|
15 | + <label :for="active_form_element.id + '_edit'"><?php esc_html_e('The total payable text', 'invoicing') ?></label> |
|
16 | 16 | <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea> |
17 | 17 | </div> |
@@ -7,27 +7,27 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Input Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Input Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.input_label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Button Label', 'invoicing' ); ?></span> |
|
23 | + <span><?php esc_html_e('Button Label', 'invoicing'); ?></span> |
|
24 | 24 | <input v-model='active_form_element.button_label' class='form-control' type="text"/> |
25 | 25 | </label> |
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class='form-group'> |
29 | 29 | <label class="d-block"> |
30 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
31 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
30 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
31 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
32 | 32 | </label> |
33 | 33 | </div> |
@@ -7,11 +7,11 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | - <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Enter your text', 'invoicing' ) ?></label> |
|
15 | + <label :for="active_form_element.id + '_edit'"><?php esc_html_e('Enter your text', 'invoicing') ?></label> |
|
16 | 16 | <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea> |
17 | 17 | </div> |
@@ -7,10 +7,10 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | <div class='form-group'> |
14 | - <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'The IP Address text', 'invoicing' ) ?></label> |
|
14 | + <label :for="active_form_element.id + '_edit'"><?php esc_html_e('The IP Address text', 'invoicing') ?></label> |
|
15 | 15 | <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea> |
16 | 16 | </div> |
@@ -7,35 +7,35 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Button Text', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Button Text', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
24 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
23 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
24 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | 25 | </label> |
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class='form-group'> |
29 | - <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e( 'Button Type', 'invoicing' ) ?></label> |
|
29 | + <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e('Button Type', 'invoicing') ?></label> |
|
30 | 30 | <select class='form-control custom-select' :id="active_form_element.id + '_edit_type'" v-model='active_form_element.class'> |
31 | - <option value='btn-primary'><?php esc_html_e( 'Primary', 'invoicing' ); ?></option> |
|
32 | - <option value='btn-secondary'><?php esc_html_e( 'Secondary', 'invoicing' ); ?></option> |
|
33 | - <option value='btn-success'><?php esc_html_e( 'Success', 'invoicing' ); ?></option> |
|
34 | - <option value='btn-danger'><?php esc_html_e( 'Danger', 'invoicing' ); ?></option> |
|
35 | - <option value='btn-warning'><?php esc_html_e( 'Warning', 'invoicing' ); ?></option> |
|
36 | - <option value='btn-info'><?php esc_html_e( 'Info', 'invoicing' ); ?></option> |
|
37 | - <option value='btn-light'><?php esc_html_e( 'Light', 'invoicing' ); ?></option> |
|
38 | - <option value='btn-dark'><?php esc_html_e( 'Dark', 'invoicing' ); ?></option> |
|
39 | - <option value='btn-link'><?php esc_html_e( 'Link', 'invoicing' ); ?></option> |
|
31 | + <option value='btn-primary'><?php esc_html_e('Primary', 'invoicing'); ?></option> |
|
32 | + <option value='btn-secondary'><?php esc_html_e('Secondary', 'invoicing'); ?></option> |
|
33 | + <option value='btn-success'><?php esc_html_e('Success', 'invoicing'); ?></option> |
|
34 | + <option value='btn-danger'><?php esc_html_e('Danger', 'invoicing'); ?></option> |
|
35 | + <option value='btn-warning'><?php esc_html_e('Warning', 'invoicing'); ?></option> |
|
36 | + <option value='btn-info'><?php esc_html_e('Info', 'invoicing'); ?></option> |
|
37 | + <option value='btn-light'><?php esc_html_e('Light', 'invoicing'); ?></option> |
|
38 | + <option value='btn-dark'><?php esc_html_e('Dark', 'invoicing'); ?></option> |
|
39 | + <option value='btn-link'><?php esc_html_e('Link', 'invoicing'); ?></option> |
|
40 | 40 | </select> |
41 | 41 | </div> |
@@ -7,11 +7,11 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | - <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'The gateway select text', 'invoicing' ) ?></label> |
|
15 | + <label :for="active_form_element.id + '_edit'"><?php esc_html_e('The gateway select text', 'invoicing') ?></label> |
|
16 | 16 | <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea> |
17 | 17 | </div> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -78,30 +78,30 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @param int|object|WPInv_Item|WP_Post $item Item to read. |
80 | 80 | */ |
81 | - public function __construct( $item = 0 ) { |
|
82 | - parent::__construct( $item ); |
|
83 | - |
|
84 | - if ( ! empty( $item ) && is_numeric( $item ) && 'wpi_item' == get_post_type( $item ) ) { |
|
85 | - $this->set_id( $item ); |
|
86 | - } elseif ( $item instanceof self ) { |
|
87 | - $this->set_id( $item->get_id() ); |
|
88 | - } elseif ( ! empty( $item->ID ) ) { |
|
89 | - $this->set_id( $item->ID ); |
|
90 | - } elseif ( is_scalar( $item ) && $item_id = self::get_item_id_by_field( $item, 'custom_id' ) ) { |
|
91 | - $this->set_id( $item_id ); |
|
92 | - } elseif ( is_scalar( $item ) && $item_id = self::get_item_id_by_field( $item, 'name' ) ) { |
|
93 | - $this->set_id( $item_id ); |
|
81 | + public function __construct($item = 0) { |
|
82 | + parent::__construct($item); |
|
83 | + |
|
84 | + if (!empty($item) && is_numeric($item) && 'wpi_item' == get_post_type($item)) { |
|
85 | + $this->set_id($item); |
|
86 | + } elseif ($item instanceof self) { |
|
87 | + $this->set_id($item->get_id()); |
|
88 | + } elseif (!empty($item->ID)) { |
|
89 | + $this->set_id($item->ID); |
|
90 | + } elseif (is_scalar($item) && $item_id = self::get_item_id_by_field($item, 'custom_id')) { |
|
91 | + $this->set_id($item_id); |
|
92 | + } elseif (is_scalar($item) && $item_id = self::get_item_id_by_field($item, 'name')) { |
|
93 | + $this->set_id($item_id); |
|
94 | 94 | } else { |
95 | - $this->set_object_read( true ); |
|
95 | + $this->set_object_read(true); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // Load the datastore. |
99 | - $this->data_store = GetPaid_Data_Store::load( $this->data_store_name ); |
|
99 | + $this->data_store = GetPaid_Data_Store::load($this->data_store_name); |
|
100 | 100 | |
101 | - if ( $this->get_id() > 0 ) { |
|
102 | - $this->post = get_post( $this->get_id() ); |
|
101 | + if ($this->get_id() > 0) { |
|
102 | + $this->post = get_post($this->get_id()); |
|
103 | 103 | $this->ID = $this->get_id(); |
104 | - $this->data_store->read( $this ); |
|
104 | + $this->data_store->read($this); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * @param string $context View or edit context. |
129 | 129 | * @return int |
130 | 130 | */ |
131 | - public function get_parent_id( $context = 'view' ) { |
|
132 | - return (int) $this->get_prop( 'parent_id', $context ); |
|
131 | + public function get_parent_id($context = 'view') { |
|
132 | + return (int) $this->get_prop('parent_id', $context); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | * @param string $context View or edit context. |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - public function get_status( $context = 'view' ) { |
|
143 | - return $this->get_prop( 'status', $context ); |
|
142 | + public function get_status($context = 'view') { |
|
143 | + return $this->get_prop('status', $context); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | * @param string $context View or edit context. |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function get_version( $context = 'view' ) { |
|
154 | - return $this->get_prop( 'version', $context ); |
|
153 | + public function get_version($context = 'view') { |
|
154 | + return $this->get_prop('version', $context); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * @param string $context View or edit context. |
162 | 162 | * @return string |
163 | 163 | */ |
164 | - public function get_date_created( $context = 'view' ) { |
|
165 | - return $this->get_prop( 'date_created', $context ); |
|
164 | + public function get_date_created($context = 'view') { |
|
165 | + return $this->get_prop('date_created', $context); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | * @param string $context View or edit context. |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public function get_date_created_gmt( $context = 'view' ) { |
|
176 | - $date = $this->get_date_created( $context ); |
|
175 | + public function get_date_created_gmt($context = 'view') { |
|
176 | + $date = $this->get_date_created($context); |
|
177 | 177 | |
178 | - if ( $date ) { |
|
179 | - $date = get_gmt_from_date( $date ); |
|
178 | + if ($date) { |
|
179 | + $date = get_gmt_from_date($date); |
|
180 | 180 | } |
181 | 181 | return $date; |
182 | 182 | } |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | * @param string $context View or edit context. |
189 | 189 | * @return string |
190 | 190 | */ |
191 | - public function get_date_modified( $context = 'view' ) { |
|
192 | - return $this->get_prop( 'date_modified', $context ); |
|
191 | + public function get_date_modified($context = 'view') { |
|
192 | + return $this->get_prop('date_modified', $context); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | * @param string $context View or edit context. |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - public function get_date_modified_gmt( $context = 'view' ) { |
|
203 | - $date = $this->get_date_modified( $context ); |
|
202 | + public function get_date_modified_gmt($context = 'view') { |
|
203 | + $date = $this->get_date_modified($context); |
|
204 | 204 | |
205 | - if ( $date ) { |
|
206 | - $date = get_gmt_from_date( $date ); |
|
205 | + if ($date) { |
|
206 | + $date = get_gmt_from_date($date); |
|
207 | 207 | } |
208 | 208 | return $date; |
209 | 209 | } |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @param string $context View or edit context. |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public function get_name( $context = 'view' ) { |
|
219 | - return $this->get_prop( 'name', $context ); |
|
218 | + public function get_name($context = 'view') { |
|
219 | + return $this->get_prop('name', $context); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | * @param string $context View or edit context. |
227 | 227 | * @return string |
228 | 228 | */ |
229 | - public function get_title( $context = 'view' ) { |
|
230 | - return $this->get_name( $context ); |
|
229 | + public function get_title($context = 'view') { |
|
230 | + return $this->get_name($context); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * @param string $context View or edit context. |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public function get_description( $context = 'view' ) { |
|
241 | - return $this->get_prop( 'description', $context ); |
|
240 | + public function get_description($context = 'view') { |
|
241 | + return $this->get_prop('description', $context); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | * @param string $context View or edit context. |
249 | 249 | * @return string |
250 | 250 | */ |
251 | - public function get_excerpt( $context = 'view' ) { |
|
252 | - return $this->get_description( $context ); |
|
251 | + public function get_excerpt($context = 'view') { |
|
252 | + return $this->get_description($context); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | * @param string $context View or edit context. |
260 | 260 | * @return string |
261 | 261 | */ |
262 | - public function get_summary( $context = 'view' ) { |
|
263 | - return $this->get_description( $context ); |
|
262 | + public function get_summary($context = 'view') { |
|
263 | + return $this->get_description($context); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | * @param string $context View or edit context. |
271 | 271 | * @return int |
272 | 272 | */ |
273 | - public function get_author( $context = 'view' ) { |
|
274 | - return (int) $this->get_prop( 'author', $context ); |
|
273 | + public function get_author($context = 'view') { |
|
274 | + return (int) $this->get_prop('author', $context); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @param string $context View or edit context. |
282 | 282 | * @return int |
283 | 283 | */ |
284 | - public function get_owner( $context = 'view' ) { |
|
285 | - return $this->get_author( $context ); |
|
284 | + public function get_owner($context = 'view') { |
|
285 | + return $this->get_author($context); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | * @param string $context View or edit context. |
293 | 293 | * @return float |
294 | 294 | */ |
295 | - public function get_price( $context = 'view' ) { |
|
296 | - return wpinv_sanitize_amount( $this->get_prop( 'price', $context ) ); |
|
295 | + public function get_price($context = 'view') { |
|
296 | + return wpinv_sanitize_amount($this->get_prop('price', $context)); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -303,15 +303,15 @@ discard block |
||
303 | 303 | * @param string $context View or edit context. |
304 | 304 | * @return float |
305 | 305 | */ |
306 | - public function get_initial_price( $context = 'view' ) { |
|
306 | + public function get_initial_price($context = 'view') { |
|
307 | 307 | |
308 | - $price = (float) $this->get_price( $context ); |
|
308 | + $price = (float) $this->get_price($context); |
|
309 | 309 | |
310 | - if ( $this->has_free_trial() ) { |
|
310 | + if ($this->has_free_trial()) { |
|
311 | 311 | $price = 0; |
312 | 312 | } |
313 | 313 | |
314 | - return wpinv_sanitize_amount( apply_filters( 'wpinv_get_initial_item_price', $price, $this ) ); |
|
314 | + return wpinv_sanitize_amount(apply_filters('wpinv_get_initial_item_price', $price, $this)); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @return string |
323 | 323 | */ |
324 | 324 | public function get_the_price() { |
325 | - return wpinv_price( wpinv_format_amount( $this->get_price() ) ); |
|
325 | + return wpinv_price(wpinv_format_amount($this->get_price())); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @return string |
334 | 334 | */ |
335 | 335 | public function get_the_initial_price() { |
336 | - return wpinv_price( wpinv_format_amount( $this->get_initial_price() ) ); |
|
336 | + return wpinv_price(wpinv_format_amount($this->get_initial_price())); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @param string $context View or edit context. |
344 | 344 | * @return string |
345 | 345 | */ |
346 | - public function get_vat_rule( $context = 'view' ) { |
|
347 | - return $this->get_prop( 'vat_rule', $context ); |
|
346 | + public function get_vat_rule($context = 'view') { |
|
347 | + return $this->get_prop('vat_rule', $context); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @param string $context View or edit context. |
355 | 355 | * @return string |
356 | 356 | */ |
357 | - public function get_vat_class( $context = 'view' ) { |
|
358 | - return $this->get_prop( 'vat_class', $context ); |
|
357 | + public function get_vat_class($context = 'view') { |
|
358 | + return $this->get_prop('vat_class', $context); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @param string $context View or edit context. |
366 | 366 | * @return string |
367 | 367 | */ |
368 | - public function get_type( $context = 'view' ) { |
|
369 | - return $this->get_prop( 'type', $context ); |
|
368 | + public function get_type($context = 'view') { |
|
369 | + return $this->get_prop('type', $context); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | /** |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | * @param string $context View or edit context. |
377 | 377 | * @return string |
378 | 378 | */ |
379 | - public function get_custom_id( $context = 'view' ) { |
|
380 | - return $this->get_prop( 'custom_id', $context ); |
|
379 | + public function get_custom_id($context = 'view') { |
|
380 | + return $this->get_prop('custom_id', $context); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | * @param string $context View or edit context. |
388 | 388 | * @return string |
389 | 389 | */ |
390 | - public function get_custom_name( $context = 'view' ) { |
|
391 | - return $this->get_prop( 'custom_name', $context ); |
|
390 | + public function get_custom_name($context = 'view') { |
|
391 | + return $this->get_prop('custom_name', $context); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -398,8 +398,8 @@ discard block |
||
398 | 398 | * @param string $context View or edit context. |
399 | 399 | * @return string |
400 | 400 | */ |
401 | - public function get_custom_singular_name( $context = 'view' ) { |
|
402 | - return $this->get_prop( 'custom_singular_name', $context ); |
|
401 | + public function get_custom_singular_name($context = 'view') { |
|
402 | + return $this->get_prop('custom_singular_name', $context); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | /** |
@@ -409,8 +409,8 @@ discard block |
||
409 | 409 | * @param string $context View or edit context. |
410 | 410 | * @return int |
411 | 411 | */ |
412 | - public function get_is_editable( $context = 'view' ) { |
|
413 | - return (int) $this->get_prop( 'is_editable', $context ); |
|
412 | + public function get_is_editable($context = 'view') { |
|
413 | + return (int) $this->get_prop('is_editable', $context); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | * @param string $context View or edit context. |
421 | 421 | * @return int |
422 | 422 | */ |
423 | - public function get_editable( $context = 'view' ) { |
|
424 | - return $this->get_is_editable( $context ); |
|
423 | + public function get_editable($context = 'view') { |
|
424 | + return $this->get_is_editable($context); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | /** |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | * @param string $context View or edit context. |
432 | 432 | * @return int |
433 | 433 | */ |
434 | - public function get_is_dynamic_pricing( $context = 'view' ) { |
|
435 | - return (int) $this->get_prop( 'is_dynamic_pricing', $context ); |
|
434 | + public function get_is_dynamic_pricing($context = 'view') { |
|
435 | + return (int) $this->get_prop('is_dynamic_pricing', $context); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
@@ -442,8 +442,8 @@ discard block |
||
442 | 442 | * @param string $context View or edit context. |
443 | 443 | * @return float |
444 | 444 | */ |
445 | - public function get_minimum_price( $context = 'view' ) { |
|
446 | - return wpinv_sanitize_amount( $this->get_prop( 'minimum_price', $context ) ); |
|
445 | + public function get_minimum_price($context = 'view') { |
|
446 | + return wpinv_sanitize_amount($this->get_prop('minimum_price', $context)); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | * @param string $context View or edit context. |
454 | 454 | * @return int |
455 | 455 | */ |
456 | - public function get_is_recurring( $context = 'view' ) { |
|
457 | - return (int) $this->get_prop( 'is_recurring', $context ); |
|
456 | + public function get_is_recurring($context = 'view') { |
|
457 | + return (int) $this->get_prop('is_recurring', $context); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -464,9 +464,9 @@ discard block |
||
464 | 464 | * @param string $context View or edit context. |
465 | 465 | * @return float |
466 | 466 | */ |
467 | - public function get_recurring_price( $context = 'view' ) { |
|
468 | - $price = $this->get_price( $context ); |
|
469 | - return wpinv_sanitize_amount( apply_filters( 'wpinv_get_recurring_item_price', $price, $this->ID ) ); |
|
467 | + public function get_recurring_price($context = 'view') { |
|
468 | + $price = $this->get_price($context); |
|
469 | + return wpinv_sanitize_amount(apply_filters('wpinv_get_recurring_item_price', $price, $this->ID)); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return string |
478 | 478 | */ |
479 | 479 | public function get_the_recurring_price() { |
480 | - return wpinv_price( wpinv_format_amount( $this->get_recurring_price() ) ); |
|
480 | + return wpinv_price(wpinv_format_amount($this->get_recurring_price())); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -498,15 +498,15 @@ discard block |
||
498 | 498 | $period = $this->get_recurring_period(); |
499 | 499 | $interval = $this->get_recurring_interval(); |
500 | 500 | |
501 | - if ( $this->has_free_trial() ) { |
|
501 | + if ($this->has_free_trial()) { |
|
502 | 502 | $period = $this->get_trial_period(); |
503 | 503 | $interval = $this->get_trial_interval(); |
504 | 504 | } |
505 | 505 | |
506 | - $period = $periods[ $period ]; |
|
507 | - $interval = empty( $interval ) ? 1 : $interval; |
|
508 | - $next_renewal = strtotime( "+$interval $period", current_time( 'timestamp' ) ); |
|
509 | - return apply_filters( 'wpinv_get_first_renewal_date', $next_renewal, $this ); |
|
506 | + $period = $periods[$period]; |
|
507 | + $interval = empty($interval) ? 1 : $interval; |
|
508 | + $next_renewal = strtotime("+$interval $period", current_time('timestamp')); |
|
509 | + return apply_filters('wpinv_get_first_renewal_date', $next_renewal, $this); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | /** |
@@ -516,14 +516,14 @@ discard block |
||
516 | 516 | * @param bool $full Return abbreviation or in full. |
517 | 517 | * @return string |
518 | 518 | */ |
519 | - public function get_recurring_period( $full = false ) { |
|
520 | - $period = $this->get_prop( 'recurring_period', 'view' ); |
|
519 | + public function get_recurring_period($full = false) { |
|
520 | + $period = $this->get_prop('recurring_period', 'view'); |
|
521 | 521 | |
522 | - if ( $full && ! is_bool( $full ) ) { |
|
522 | + if ($full && !is_bool($full)) { |
|
523 | 523 | $full = false; |
524 | 524 | } |
525 | 525 | |
526 | - return getpaid_sanitize_recurring_period( $period, $full ); |
|
526 | + return getpaid_sanitize_recurring_period($period, $full); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -533,10 +533,10 @@ discard block |
||
533 | 533 | * @param string $context View or edit context. |
534 | 534 | * @return int |
535 | 535 | */ |
536 | - public function get_recurring_interval( $context = 'view' ) { |
|
537 | - $interval = absint( $this->get_prop( 'recurring_interval', $context ) ); |
|
536 | + public function get_recurring_interval($context = 'view') { |
|
537 | + $interval = absint($this->get_prop('recurring_interval', $context)); |
|
538 | 538 | |
539 | - if ( $interval < 1 ) { |
|
539 | + if ($interval < 1) { |
|
540 | 540 | $interval = 1; |
541 | 541 | } |
542 | 542 | |
@@ -550,8 +550,8 @@ discard block |
||
550 | 550 | * @param string $context View or edit context. |
551 | 551 | * @return int |
552 | 552 | */ |
553 | - public function get_recurring_limit( $context = 'view' ) { |
|
554 | - return (int) $this->get_prop( 'recurring_limit', $context ); |
|
553 | + public function get_recurring_limit($context = 'view') { |
|
554 | + return (int) $this->get_prop('recurring_limit', $context); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | /** |
@@ -561,8 +561,8 @@ discard block |
||
561 | 561 | * @param string $context View or edit context. |
562 | 562 | * @return int |
563 | 563 | */ |
564 | - public function get_is_free_trial( $context = 'view' ) { |
|
565 | - return (int) $this->get_prop( 'is_free_trial', $context ); |
|
564 | + public function get_is_free_trial($context = 'view') { |
|
565 | + return (int) $this->get_prop('is_free_trial', $context); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | * @param string $context View or edit context. |
573 | 573 | * @return int |
574 | 574 | */ |
575 | - public function get_free_trial( $context = 'view' ) { |
|
576 | - return $this->get_is_free_trial( $context ); |
|
575 | + public function get_free_trial($context = 'view') { |
|
576 | + return $this->get_is_free_trial($context); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | /** |
@@ -583,14 +583,14 @@ discard block |
||
583 | 583 | * @param bool $full Return abbreviation or in full. |
584 | 584 | * @return string |
585 | 585 | */ |
586 | - public function get_trial_period( $full = false ) { |
|
587 | - $period = $this->get_prop( 'trial_period', 'view' ); |
|
586 | + public function get_trial_period($full = false) { |
|
587 | + $period = $this->get_prop('trial_period', 'view'); |
|
588 | 588 | |
589 | - if ( $full && ! is_bool( $full ) ) { |
|
589 | + if ($full && !is_bool($full)) { |
|
590 | 590 | $full = false; |
591 | 591 | } |
592 | 592 | |
593 | - return getpaid_sanitize_recurring_period( $period, $full ); |
|
593 | + return getpaid_sanitize_recurring_period($period, $full); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | /** |
@@ -600,8 +600,8 @@ discard block |
||
600 | 600 | * @param string $context View or edit context. |
601 | 601 | * @return int |
602 | 602 | */ |
603 | - public function get_trial_interval( $context = 'view' ) { |
|
604 | - return (int) $this->get_prop( 'trial_interval', $context ); |
|
603 | + public function get_trial_interval($context = 'view') { |
|
604 | + return (int) $this->get_prop('trial_interval', $context); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | /** |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @return string |
612 | 612 | */ |
613 | 613 | public function get_edit_url() { |
614 | - return get_edit_post_link( $this->get_id() ); |
|
614 | + return get_edit_post_link($this->get_id()); |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | /** |
@@ -625,36 +625,36 @@ discard block |
||
625 | 625 | * @since 1.0.15 |
626 | 626 | * @return int |
627 | 627 | */ |
628 | - public static function get_item_id_by_field( $value, $field = 'custom_id', $type = '' ) { |
|
628 | + public static function get_item_id_by_field($value, $field = 'custom_id', $type = '') { |
|
629 | 629 | |
630 | 630 | // Trim the value. |
631 | - $value = sanitize_text_field( $value ); |
|
631 | + $value = sanitize_text_field($value); |
|
632 | 632 | |
633 | - if ( empty( $value ) ) { |
|
633 | + if (empty($value)) { |
|
634 | 634 | return 0; |
635 | 635 | } |
636 | 636 | |
637 | 637 | // Valid fields. |
638 | - $fields = array( 'custom_id', 'name', 'slug' ); |
|
638 | + $fields = array('custom_id', 'name', 'slug'); |
|
639 | 639 | |
640 | 640 | // Ensure a field has been passed. |
641 | - if ( empty( $field ) || ! in_array( $field, $fields ) ) { |
|
641 | + if (empty($field) || !in_array($field, $fields)) { |
|
642 | 642 | return 0; |
643 | 643 | } |
644 | 644 | |
645 | - if ( $field == 'name' ) { |
|
645 | + if ($field == 'name') { |
|
646 | 646 | $field = 'slug'; |
647 | 647 | } |
648 | 648 | |
649 | 649 | // Maybe retrieve from the cache. |
650 | - $item_id = wp_cache_get( $value, "getpaid_{$type}_item_{$field}s_to_item_ids" ); |
|
651 | - if ( ! empty( $item_id ) ) { |
|
650 | + $item_id = wp_cache_get($value, "getpaid_{$type}_item_{$field}s_to_item_ids"); |
|
651 | + if (!empty($item_id)) { |
|
652 | 652 | return $item_id; |
653 | 653 | } |
654 | 654 | |
655 | 655 | // Fetch from the db. |
656 | 656 | $items = array(); |
657 | - if ( $field =='slug' ) { |
|
657 | + if ($field == 'slug') { |
|
658 | 658 | $items = get_posts( |
659 | 659 | array( |
660 | 660 | 'post_type' => 'wpi_item', |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | ); |
666 | 666 | } |
667 | 667 | |
668 | - if ( $field =='custom_id' ) { |
|
668 | + if ($field == 'custom_id') { |
|
669 | 669 | $items = get_posts( |
670 | 670 | array( |
671 | 671 | 'post_type' => 'wpi_item', |
@@ -685,12 +685,12 @@ discard block |
||
685 | 685 | ); |
686 | 686 | } |
687 | 687 | |
688 | - if ( empty( $items ) ) { |
|
688 | + if (empty($items)) { |
|
689 | 689 | return 0; |
690 | 690 | } |
691 | 691 | |
692 | 692 | // Update the cache with our data |
693 | - wp_cache_set( $value, $items[0]->ID, "getpaid_{$type}_item_{$field}s_to_item_ids" ); |
|
693 | + wp_cache_set($value, $items[0]->ID, "getpaid_{$type}_item_{$field}s_to_item_ids"); |
|
694 | 694 | |
695 | 695 | return $items[0]->ID; |
696 | 696 | } |
@@ -698,19 +698,19 @@ discard block |
||
698 | 698 | /** |
699 | 699 | * Margic method for retrieving a property. |
700 | 700 | */ |
701 | - public function __get( $key ) { |
|
701 | + public function __get($key) { |
|
702 | 702 | |
703 | 703 | // Check if we have a helper method for that. |
704 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
705 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
704 | + if (method_exists($this, 'get_' . $key)) { |
|
705 | + return call_user_func(array($this, 'get_' . $key)); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | // Check if the key is in the associated $post object. |
709 | - if ( ! empty( $this->post ) && isset( $this->post->$key ) ) { |
|
709 | + if (!empty($this->post) && isset($this->post->$key)) { |
|
710 | 710 | return $this->post->$key; |
711 | 711 | } |
712 | 712 | |
713 | - return $this->get_prop( $key ); |
|
713 | + return $this->get_prop($key); |
|
714 | 714 | |
715 | 715 | } |
716 | 716 | |
@@ -729,11 +729,11 @@ discard block |
||
729 | 729 | * |
730 | 730 | * @since 1.0.19 |
731 | 731 | */ |
732 | - public function set_parent_id( $value ) { |
|
733 | - if ( $value && ( $value === $this->get_id() || ! get_post( $value ) ) ) { |
|
732 | + public function set_parent_id($value) { |
|
733 | + if ($value && ($value === $this->get_id() || !get_post($value))) { |
|
734 | 734 | return; |
735 | 735 | } |
736 | - $this->set_prop( 'parent_id', absint( $value ) ); |
|
736 | + $this->set_prop('parent_id', absint($value)); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | /** |
@@ -743,10 +743,10 @@ discard block |
||
743 | 743 | * @param string $status New status. |
744 | 744 | * @return array details of change. |
745 | 745 | */ |
746 | - public function set_status( $status ) { |
|
746 | + public function set_status($status) { |
|
747 | 747 | $old_status = $this->get_status(); |
748 | 748 | |
749 | - $this->set_prop( 'status', $status ); |
|
749 | + $this->set_prop('status', $status); |
|
750 | 750 | |
751 | 751 | return array( |
752 | 752 | 'from' => $old_status, |
@@ -759,8 +759,8 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @since 1.0.19 |
761 | 761 | */ |
762 | - public function set_version( $value ) { |
|
763 | - $this->set_prop( 'version', $value ); |
|
762 | + public function set_version($value) { |
|
763 | + $this->set_prop('version', $value); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -770,11 +770,11 @@ discard block |
||
770 | 770 | * @param string $value Value to set. |
771 | 771 | * @return bool Whether or not the date was set. |
772 | 772 | */ |
773 | - public function set_date_created( $value ) { |
|
774 | - $date = strtotime( $value ); |
|
773 | + public function set_date_created($value) { |
|
774 | + $date = strtotime($value); |
|
775 | 775 | |
776 | - if ( $date ) { |
|
777 | - $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) ); |
|
776 | + if ($date) { |
|
777 | + $this->set_prop('date_created', date('Y-m-d H:i:s', $date)); |
|
778 | 778 | return true; |
779 | 779 | } |
780 | 780 | |
@@ -789,11 +789,11 @@ discard block |
||
789 | 789 | * @param string $value Value to set. |
790 | 790 | * @return bool Whether or not the date was set. |
791 | 791 | */ |
792 | - public function set_date_modified( $value ) { |
|
793 | - $date = strtotime( $value ); |
|
792 | + public function set_date_modified($value) { |
|
793 | + $date = strtotime($value); |
|
794 | 794 | |
795 | - if ( $date ) { |
|
796 | - $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) ); |
|
795 | + if ($date) { |
|
796 | + $this->set_prop('date_modified', date('Y-m-d H:i:s', $date)); |
|
797 | 797 | return true; |
798 | 798 | } |
799 | 799 | |
@@ -807,9 +807,9 @@ discard block |
||
807 | 807 | * @since 1.0.19 |
808 | 808 | * @param string $value New name. |
809 | 809 | */ |
810 | - public function set_name( $value ) { |
|
811 | - $name = sanitize_text_field( $value ); |
|
812 | - $this->set_prop( 'name', $name ); |
|
810 | + public function set_name($value) { |
|
811 | + $name = sanitize_text_field($value); |
|
812 | + $this->set_prop('name', $name); |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | /** |
@@ -818,8 +818,8 @@ discard block |
||
818 | 818 | * @since 1.0.19 |
819 | 819 | * @param string $value New name. |
820 | 820 | */ |
821 | - public function set_title( $value ) { |
|
822 | - $this->set_name( $value ); |
|
821 | + public function set_title($value) { |
|
822 | + $this->set_name($value); |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | /** |
@@ -828,9 +828,9 @@ discard block |
||
828 | 828 | * @since 1.0.19 |
829 | 829 | * @param string $value New description. |
830 | 830 | */ |
831 | - public function set_description( $value ) { |
|
832 | - $description = wp_kses_post( $value ); |
|
833 | - return $this->set_prop( 'description', $description ); |
|
831 | + public function set_description($value) { |
|
832 | + $description = wp_kses_post($value); |
|
833 | + return $this->set_prop('description', $description); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | /** |
@@ -839,8 +839,8 @@ discard block |
||
839 | 839 | * @since 1.0.19 |
840 | 840 | * @param string $value New description. |
841 | 841 | */ |
842 | - public function set_excerpt( $value ) { |
|
843 | - $this->set_description( $value ); |
|
842 | + public function set_excerpt($value) { |
|
843 | + $this->set_description($value); |
|
844 | 844 | } |
845 | 845 | |
846 | 846 | /** |
@@ -849,8 +849,8 @@ discard block |
||
849 | 849 | * @since 1.0.19 |
850 | 850 | * @param string $value New description. |
851 | 851 | */ |
852 | - public function set_summary( $value ) { |
|
853 | - $this->set_description( $value ); |
|
852 | + public function set_summary($value) { |
|
853 | + $this->set_description($value); |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | /** |
@@ -859,8 +859,8 @@ discard block |
||
859 | 859 | * @since 1.0.19 |
860 | 860 | * @param int $value New author. |
861 | 861 | */ |
862 | - public function set_author( $value ) { |
|
863 | - $this->set_prop( 'author', (int) $value ); |
|
862 | + public function set_author($value) { |
|
863 | + $this->set_prop('author', (int) $value); |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | /** |
@@ -869,8 +869,8 @@ discard block |
||
869 | 869 | * @since 1.0.19 |
870 | 870 | * @param int $value New author. |
871 | 871 | */ |
872 | - public function set_owner( $value ) { |
|
873 | - $this->set_author( $value ); |
|
872 | + public function set_owner($value) { |
|
873 | + $this->set_author($value); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | /** |
@@ -879,8 +879,8 @@ discard block |
||
879 | 879 | * @since 1.0.19 |
880 | 880 | * @param float $value New price. |
881 | 881 | */ |
882 | - public function set_price( $value ) { |
|
883 | - $this->set_prop( 'price', (float) wpinv_sanitize_amount( $value ) ); |
|
882 | + public function set_price($value) { |
|
883 | + $this->set_prop('price', (float) wpinv_sanitize_amount($value)); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | /** |
@@ -889,8 +889,8 @@ discard block |
||
889 | 889 | * @since 1.0.19 |
890 | 890 | * @param string $value new rule. |
891 | 891 | */ |
892 | - public function set_vat_rule( $value ) { |
|
893 | - $this->set_prop( 'vat_rule', $value ); |
|
892 | + public function set_vat_rule($value) { |
|
893 | + $this->set_prop('vat_rule', $value); |
|
894 | 894 | } |
895 | 895 | |
896 | 896 | /** |
@@ -899,8 +899,8 @@ discard block |
||
899 | 899 | * @since 1.0.19 |
900 | 900 | * @param string $value new class. |
901 | 901 | */ |
902 | - public function set_vat_class( $value ) { |
|
903 | - $this->set_prop( 'vat_class', $value ); |
|
902 | + public function set_vat_class($value) { |
|
903 | + $this->set_prop('vat_class', $value); |
|
904 | 904 | } |
905 | 905 | |
906 | 906 | /** |
@@ -910,13 +910,13 @@ discard block |
||
910 | 910 | * @param string $value new item type. |
911 | 911 | * @return string |
912 | 912 | */ |
913 | - public function set_type( $value ) { |
|
913 | + public function set_type($value) { |
|
914 | 914 | |
915 | - if ( empty( $value ) ) { |
|
915 | + if (empty($value)) { |
|
916 | 916 | $value = 'custom'; |
917 | 917 | } |
918 | 918 | |
919 | - $this->set_prop( 'type', $value ); |
|
919 | + $this->set_prop('type', $value); |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | /** |
@@ -925,8 +925,8 @@ discard block |
||
925 | 925 | * @since 1.0.19 |
926 | 926 | * @param string $value new custom id. |
927 | 927 | */ |
928 | - public function set_custom_id( $value ) { |
|
929 | - $this->set_prop( 'custom_id', $value ); |
|
928 | + public function set_custom_id($value) { |
|
929 | + $this->set_prop('custom_id', $value); |
|
930 | 930 | } |
931 | 931 | |
932 | 932 | /** |
@@ -935,8 +935,8 @@ discard block |
||
935 | 935 | * @since 1.0.19 |
936 | 936 | * @param string $value new custom name. |
937 | 937 | */ |
938 | - public function set_custom_name( $value ) { |
|
939 | - $this->set_prop( 'custom_name', $value ); |
|
938 | + public function set_custom_name($value) { |
|
939 | + $this->set_prop('custom_name', $value); |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | /** |
@@ -945,8 +945,8 @@ discard block |
||
945 | 945 | * @since 1.0.19 |
946 | 946 | * @param string $value new custom singular name. |
947 | 947 | */ |
948 | - public function set_custom_singular_name( $value ) { |
|
949 | - $this->set_prop( 'custom_singular_name', $value ); |
|
948 | + public function set_custom_singular_name($value) { |
|
949 | + $this->set_prop('custom_singular_name', $value); |
|
950 | 950 | } |
951 | 951 | |
952 | 952 | /** |
@@ -955,9 +955,9 @@ discard block |
||
955 | 955 | * @since 1.0.19 |
956 | 956 | * @param int|bool $value whether or not the item is editable. |
957 | 957 | */ |
958 | - public function set_is_editable( $value ) { |
|
959 | - if ( is_numeric( $value ) ) { |
|
960 | - $this->set_prop( 'is_editable', (int) $value ); |
|
958 | + public function set_is_editable($value) { |
|
959 | + if (is_numeric($value)) { |
|
960 | + $this->set_prop('is_editable', (int) $value); |
|
961 | 961 | } |
962 | 962 | } |
963 | 963 | |
@@ -967,8 +967,8 @@ discard block |
||
967 | 967 | * @since 1.0.19 |
968 | 968 | * @param int|bool $value whether or not dynamic pricing is allowed. |
969 | 969 | */ |
970 | - public function set_is_dynamic_pricing( $value ) { |
|
971 | - $this->set_prop( 'is_dynamic_pricing', (int) $value ); |
|
970 | + public function set_is_dynamic_pricing($value) { |
|
971 | + $this->set_prop('is_dynamic_pricing', (int) $value); |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | /** |
@@ -977,8 +977,8 @@ discard block |
||
977 | 977 | * @since 1.0.19 |
978 | 978 | * @param float $value minimum price. |
979 | 979 | */ |
980 | - public function set_minimum_price( $value ) { |
|
981 | - $this->set_prop( 'minimum_price', (float) wpinv_sanitize_amount( $value ) ); |
|
980 | + public function set_minimum_price($value) { |
|
981 | + $this->set_prop('minimum_price', (float) wpinv_sanitize_amount($value)); |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | /** |
@@ -987,8 +987,8 @@ discard block |
||
987 | 987 | * @since 1.0.19 |
988 | 988 | * @param int|bool $value whether or not dynamic pricing is allowed. |
989 | 989 | */ |
990 | - public function set_is_recurring( $value ) { |
|
991 | - $this->set_prop( 'is_recurring', (int) $value ); |
|
990 | + public function set_is_recurring($value) { |
|
991 | + $this->set_prop('is_recurring', (int) $value); |
|
992 | 992 | } |
993 | 993 | |
994 | 994 | /** |
@@ -997,8 +997,8 @@ discard block |
||
997 | 997 | * @since 1.0.19 |
998 | 998 | * @param string $value new period. |
999 | 999 | */ |
1000 | - public function set_recurring_period( $value ) { |
|
1001 | - $this->set_prop( 'recurring_period', $value ); |
|
1000 | + public function set_recurring_period($value) { |
|
1001 | + $this->set_prop('recurring_period', $value); |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | /** |
@@ -1007,8 +1007,8 @@ discard block |
||
1007 | 1007 | * @since 1.0.19 |
1008 | 1008 | * @param int $value recurring interval. |
1009 | 1009 | */ |
1010 | - public function set_recurring_interval( $value ) { |
|
1011 | - return $this->set_prop( 'recurring_interval', (int) $value ); |
|
1010 | + public function set_recurring_interval($value) { |
|
1011 | + return $this->set_prop('recurring_interval', (int) $value); |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | /** |
@@ -1017,8 +1017,8 @@ discard block |
||
1017 | 1017 | * @param int $value The recurring limit. |
1018 | 1018 | * @return int |
1019 | 1019 | */ |
1020 | - public function set_recurring_limit( $value ) { |
|
1021 | - $this->set_prop( 'recurring_limit', (int) $value ); |
|
1020 | + public function set_recurring_limit($value) { |
|
1021 | + $this->set_prop('recurring_limit', (int) $value); |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | /** |
@@ -1027,8 +1027,8 @@ discard block |
||
1027 | 1027 | * @since 1.0.19 |
1028 | 1028 | * @param int|bool $value whether or not it has a free trial. |
1029 | 1029 | */ |
1030 | - public function set_is_free_trial( $value ) { |
|
1031 | - $this->set_prop( 'is_free_trial', (int) $value ); |
|
1030 | + public function set_is_free_trial($value) { |
|
1031 | + $this->set_prop('is_free_trial', (int) $value); |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | /** |
@@ -1037,8 +1037,8 @@ discard block |
||
1037 | 1037 | * @since 1.0.19 |
1038 | 1038 | * @param string $value trial period. |
1039 | 1039 | */ |
1040 | - public function set_trial_period( $value ) { |
|
1041 | - $this->set_prop( 'trial_period', $value ); |
|
1040 | + public function set_trial_period($value) { |
|
1041 | + $this->set_prop('trial_period', $value); |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | /** |
@@ -1047,8 +1047,8 @@ discard block |
||
1047 | 1047 | * @since 1.0.19 |
1048 | 1048 | * @param int $value trial interval. |
1049 | 1049 | */ |
1050 | - public function set_trial_interval( $value ) { |
|
1051 | - $this->set_prop( 'trial_interval', $value ); |
|
1050 | + public function set_trial_interval($value) { |
|
1051 | + $this->set_prop('trial_interval', $value); |
|
1052 | 1052 | } |
1053 | 1053 | |
1054 | 1054 | /** |
@@ -1057,11 +1057,11 @@ discard block |
||
1057 | 1057 | * @deprecated |
1058 | 1058 | * @return int item id |
1059 | 1059 | */ |
1060 | - public function create( $data = array() ) { |
|
1060 | + public function create($data = array()) { |
|
1061 | 1061 | |
1062 | 1062 | // Set the properties. |
1063 | - if ( is_array( $data ) ) { |
|
1064 | - $this->set_props( $data ); |
|
1063 | + if (is_array($data)) { |
|
1064 | + $this->set_props($data); |
|
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | // Save the item. |
@@ -1075,8 +1075,8 @@ discard block |
||
1075 | 1075 | * @deprecated |
1076 | 1076 | * @return int item id |
1077 | 1077 | */ |
1078 | - public function update( $data = array() ) { |
|
1079 | - return $this->create( $data ); |
|
1078 | + public function update($data = array()) { |
|
1079 | + return $this->create($data); |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | /* |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | */ |
1117 | 1117 | public function has_free_trial() { |
1118 | 1118 | $has_trial = $this->is_recurring() && (bool) $this->get_free_trial() ? true : false; |
1119 | - return (bool) apply_filters( 'wpinv_item_has_free_trial', $has_trial, $this->ID, $this ); |
|
1119 | + return (bool) apply_filters('wpinv_item_has_free_trial', $has_trial, $this->ID, $this); |
|
1120 | 1120 | } |
1121 | 1121 | |
1122 | 1122 | /** |
@@ -1126,8 +1126,8 @@ discard block |
||
1126 | 1126 | * @return bool |
1127 | 1127 | */ |
1128 | 1128 | public function is_free() { |
1129 | - $is_free = $this->get_price() == 0; |
|
1130 | - return (bool) apply_filters( 'wpinv_is_free_item', $is_free, $this->ID, $this ); |
|
1129 | + $is_free = $this->get_price() == 0; |
|
1130 | + return (bool) apply_filters('wpinv_is_free_item', $is_free, $this->ID, $this); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | /** |
@@ -1136,9 +1136,9 @@ discard block |
||
1136 | 1136 | * @param array|string $status Status to check. |
1137 | 1137 | * @return bool |
1138 | 1138 | */ |
1139 | - public function has_status( $status ) { |
|
1140 | - $has_status = ( is_array( $status ) && in_array( $this->get_status(), $status, true ) ) || $this->get_status() === $status; |
|
1141 | - return (bool) apply_filters( 'getpaid_item_has_status', $has_status, $this, $status ); |
|
1139 | + public function has_status($status) { |
|
1140 | + $has_status = (is_array($status) && in_array($this->get_status(), $status, true)) || $this->get_status() === $status; |
|
1141 | + return (bool) apply_filters('getpaid_item_has_status', $has_status, $this, $status); |
|
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | /** |
@@ -1147,9 +1147,9 @@ discard block |
||
1147 | 1147 | * @param array|string $type Type to check. |
1148 | 1148 | * @return bool |
1149 | 1149 | */ |
1150 | - public function is_type( $type ) { |
|
1151 | - $is_type = ( is_array( $type ) && in_array( $this->get_type(), $type, true ) ) || $this->get_type() === $type; |
|
1152 | - return (bool) apply_filters( 'getpaid_item_is_type', $is_type, $this, $type ); |
|
1150 | + public function is_type($type) { |
|
1151 | + $is_type = (is_array($type) && in_array($this->get_type(), $type, true)) || $this->get_type() === $type; |
|
1152 | + return (bool) apply_filters('getpaid_item_is_type', $is_type, $this, $type); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | /** |
@@ -1160,52 +1160,52 @@ discard block |
||
1160 | 1160 | */ |
1161 | 1161 | public function is_editable() { |
1162 | 1162 | $is_editable = $this->get_is_editable(); |
1163 | - return (bool) apply_filters( 'wpinv_item_is_editable', $is_editable, $this->ID, $this ); |
|
1163 | + return (bool) apply_filters('wpinv_item_is_editable', $is_editable, $this->ID, $this); |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | /** |
1167 | 1167 | * Returns an array of cart fees. |
1168 | 1168 | */ |
1169 | - public function get_fees( $type = 'fee', $item_id = 0 ) { |
|
1169 | + public function get_fees($type = 'fee', $item_id = 0) { |
|
1170 | 1170 | |
1171 | - $fees = getpaid_session()->get( 'wpi_cart_fees' ); |
|
1171 | + $fees = getpaid_session()->get('wpi_cart_fees'); |
|
1172 | 1172 | |
1173 | - if ( ! wpinv_get_cart_contents() ) { |
|
1173 | + if (!wpinv_get_cart_contents()) { |
|
1174 | 1174 | // We can only get item type fees when the cart is empty |
1175 | 1175 | $type = 'custom'; |
1176 | 1176 | } |
1177 | 1177 | |
1178 | - if ( ! empty( $fees ) && ! empty( $type ) && 'all' !== $type ) { |
|
1179 | - foreach( $fees as $key => $fee ) { |
|
1180 | - if( ! empty( $fee['type'] ) && $type != $fee['type'] ) { |
|
1181 | - unset( $fees[ $key ] ); |
|
1178 | + if (!empty($fees) && !empty($type) && 'all' !== $type) { |
|
1179 | + foreach ($fees as $key => $fee) { |
|
1180 | + if (!empty($fee['type']) && $type != $fee['type']) { |
|
1181 | + unset($fees[$key]); |
|
1182 | 1182 | } |
1183 | 1183 | } |
1184 | 1184 | } |
1185 | 1185 | |
1186 | - if ( ! empty( $fees ) && ! empty( $item_id ) ) { |
|
1186 | + if (!empty($fees) && !empty($item_id)) { |
|
1187 | 1187 | // Remove fees that don't belong to the specified Item |
1188 | - foreach ( $fees as $key => $fee ) { |
|
1189 | - if ( (int) $item_id !== (int)$fee['custom_id'] ) { |
|
1190 | - unset( $fees[ $key ] ); |
|
1188 | + foreach ($fees as $key => $fee) { |
|
1189 | + if ((int) $item_id !== (int) $fee['custom_id']) { |
|
1190 | + unset($fees[$key]); |
|
1191 | 1191 | } |
1192 | 1192 | } |
1193 | 1193 | } |
1194 | 1194 | |
1195 | - if ( ! empty( $fees ) ) { |
|
1195 | + if (!empty($fees)) { |
|
1196 | 1196 | // Remove fees that belong to a specific item but are not in the cart |
1197 | - foreach( $fees as $key => $fee ) { |
|
1198 | - if( empty( $fee['custom_id'] ) ) { |
|
1197 | + foreach ($fees as $key => $fee) { |
|
1198 | + if (empty($fee['custom_id'])) { |
|
1199 | 1199 | continue; |
1200 | 1200 | } |
1201 | 1201 | |
1202 | - if ( !wpinv_item_in_cart( $fee['custom_id'] ) ) { |
|
1203 | - unset( $fees[ $key ] ); |
|
1202 | + if (!wpinv_item_in_cart($fee['custom_id'])) { |
|
1203 | + unset($fees[$key]); |
|
1204 | 1204 | } |
1205 | 1205 | } |
1206 | 1206 | } |
1207 | 1207 | |
1208 | - return ! empty( $fees ) ? $fees : array(); |
|
1208 | + return !empty($fees) ? $fees : array(); |
|
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | /** |
@@ -1217,11 +1217,11 @@ discard block |
||
1217 | 1217 | public function can_purchase() { |
1218 | 1218 | $can_purchase = $this->exists(); |
1219 | 1219 | |
1220 | - if ( ! current_user_can( 'edit_post', $this->ID ) && $this->post_status != 'publish' ) { |
|
1220 | + if (!current_user_can('edit_post', $this->ID) && $this->post_status != 'publish') { |
|
1221 | 1221 | $can_purchase = false; |
1222 | 1222 | } |
1223 | 1223 | |
1224 | - return (bool) apply_filters( 'wpinv_can_purchase_item', $can_purchase, $this ); |
|
1224 | + return (bool) apply_filters('wpinv_can_purchase_item', $can_purchase, $this); |
|
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | /** |
@@ -1231,6 +1231,6 @@ discard block |
||
1231 | 1231 | * @return bool |
1232 | 1232 | */ |
1233 | 1233 | public function supports_dynamic_pricing() { |
1234 | - return (bool) apply_filters( 'wpinv_item_supports_dynamic_pricing', true, $this ); |
|
1234 | + return (bool) apply_filters('wpinv_item_supports_dynamic_pricing', true, $this); |
|
1235 | 1235 | } |
1236 | 1236 | } |
@@ -7,25 +7,25 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
24 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
23 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
24 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | 25 | </label> |
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class='form-group form-check'> |
29 | 29 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
30 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
30 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
31 | 31 | </div> |
@@ -7,32 +7,32 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span> |
|
23 | + <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span> |
|
24 | 24 | <input v-model='active_form_element.placeholder' class='form-control' type="text"/> |
25 | 25 | </label> |
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class='form-group'> |
29 | 29 | <label class="d-block"> |
30 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
31 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
30 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
31 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
32 | 32 | </label> |
33 | 33 | </div> |
34 | 34 | |
35 | 35 | <div class='form-group form-check'> |
36 | 36 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
37 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
37 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
38 | 38 | </div> |