@@ -130,6 +130,10 @@ discard block |
||
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | + /** |
|
134 | + * @param string $name |
|
135 | + * @param string $value |
|
136 | + */ |
|
133 | 137 | public function setcookie($name, $value, $expire = 0, $secure = false, $httponly = false){ |
134 | 138 | if ( ! headers_sent() ) { |
135 | 139 | setcookie( $name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure, apply_filters( 'wpinv_cookie_httponly', $httponly, $name, $value, $expire, $secure ) ); |
@@ -274,7 +278,7 @@ discard block |
||
274 | 278 | * When a user is logged out, ensure they have a unique nonce by using the customer/session ID. |
275 | 279 | * |
276 | 280 | * @param int $uid User ID. |
277 | - * @return string |
|
281 | + * @return integer |
|
278 | 282 | */ |
279 | 283 | public function nonce_user_logged_out( $uid ) { |
280 | 284 | return $this->has_session() && $this->_customer_id ? $this->_customer_id : $uid; |
@@ -321,12 +321,18 @@ discard block |
||
321 | 321 | return apply_filters( 'wpinv_get_discount_code', $code, $code_id ); |
322 | 322 | } |
323 | 323 | |
324 | +/** |
|
325 | + * @return string |
|
326 | + */ |
|
324 | 327 | function wpinv_get_discount_start_date( $code_id = null ) { |
325 | 328 | $start_date = get_post_meta( $code_id, '_wpi_discount_start', true ); |
326 | 329 | |
327 | 330 | return apply_filters( 'wpinv_get_discount_start_date', $start_date, $code_id ); |
328 | 331 | } |
329 | 332 | |
333 | +/** |
|
334 | + * @return string |
|
335 | + */ |
|
330 | 336 | function wpinv_get_discount_expiration( $code_id = null ) { |
331 | 337 | $expiration = get_post_meta( $code_id, '_wpi_discount_expiration', true ); |
332 | 338 | |
@@ -649,6 +655,9 @@ discard block |
||
649 | 655 | return (bool) apply_filters( 'wpinv_is_discount_item_req_met', $ret, $code_id, $condition ); |
650 | 656 | } |
651 | 657 | |
658 | +/** |
|
659 | + * @param string $code |
|
660 | + */ |
|
652 | 661 | function wpinv_is_discount_used( $code = null, $user = '', $code_id = 0 ) { |
653 | 662 | global $wpi_checkout_id; |
654 | 663 | |
@@ -816,6 +825,9 @@ discard block |
||
816 | 825 | |
817 | 826 | } |
818 | 827 | |
828 | +/** |
|
829 | + * @param double $amount |
|
830 | + */ |
|
819 | 831 | function wpinv_format_discount_rate( $type, $amount ) { |
820 | 832 | if ( $type == 'flat' ) { |
821 | 833 | return wpinv_price( wpinv_format_amount( $amount ) ); |
@@ -860,6 +872,9 @@ discard block |
||
860 | 872 | return $discounts; |
861 | 873 | } |
862 | 874 | |
875 | +/** |
|
876 | + * @return boolean |
|
877 | + */ |
|
863 | 878 | function wpinv_unset_cart_discount( $code = '' ) { |
864 | 879 | $discounts = wpinv_get_cart_discounts(); |
865 | 880 | |
@@ -1140,6 +1155,9 @@ discard block |
||
1140 | 1155 | return (bool) apply_filters( 'wpinv_multiple_discounts_allowed', $ret ); |
1141 | 1156 | } |
1142 | 1157 | |
1158 | +/** |
|
1159 | + * @param integer $code |
|
1160 | + */ |
|
1143 | 1161 | function wpinv_get_discount_label( $code, $echo = true ) { |
1144 | 1162 | $label = wp_sprintf( __( 'Discount%1$s', 'invoicing' ), ( $code != '' && $code != 'none' ? ' (<code>' . $code . '</code>)': '' ) ); |
1145 | 1163 | $label = apply_filters( 'wpinv_get_discount_label', $label, $code ); |
@@ -159,8 +159,9 @@ discard block |
||
159 | 159 | |
160 | 160 | // Setup possible parts |
161 | 161 | $templates = array(); |
162 | - if ( isset( $name ) ) |
|
163 | - $templates[] = $slug . '-' . $name . '.php'; |
|
162 | + if ( isset( $name ) ) { |
|
163 | + $templates[] = $slug . '-' . $name . '.php'; |
|
164 | + } |
|
164 | 165 | $templates[] = $slug . '.php'; |
165 | 166 | |
166 | 167 | // Allow template parts to be filtered |
@@ -178,8 +179,9 @@ discard block |
||
178 | 179 | foreach ( (array)$template_names as $template_name ) { |
179 | 180 | |
180 | 181 | // Continue if template is empty |
181 | - if ( empty( $template_name ) ) |
|
182 | - continue; |
|
182 | + if ( empty( $template_name ) ) { |
|
183 | + continue; |
|
184 | + } |
|
183 | 185 | |
184 | 186 | // Trim off any slashes from the template name |
185 | 187 | $template_name = ltrim( $template_name, '/' ); |
@@ -198,8 +200,9 @@ discard block |
||
198 | 200 | } |
199 | 201 | } |
200 | 202 | |
201 | - if ( ( true == $load ) && ! empty( $located ) ) |
|
202 | - load_template( $located, $require_once ); |
|
203 | + if ( ( true == $load ) && ! empty( $located ) ) { |
|
204 | + load_template( $located, $require_once ); |
|
205 | + } |
|
203 | 206 | |
204 | 207 | return $located; |
205 | 208 | } |
@@ -281,8 +284,9 @@ discard block |
||
281 | 284 | function wpinv_html_dropdown( $name = 'wpinv_discounts', $selected = 0, $status = '' ) { |
282 | 285 | $args = array( 'nopaging' => true ); |
283 | 286 | |
284 | - if ( ! empty( $status ) ) |
|
285 | - $args['post_status'] = $status; |
|
287 | + if ( ! empty( $status ) ) { |
|
288 | + $args['post_status'] = $status; |
|
289 | + } |
|
286 | 290 | |
287 | 291 | $discounts = wpinv_get_discounts( $args ); |
288 | 292 | $options = array(); |
@@ -1424,9 +1428,10 @@ discard block |
||
1424 | 1428 | add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' ); |
1425 | 1429 | |
1426 | 1430 | function wpinv_update_cart_button() { |
1427 | - if ( !wpinv_item_quantities_enabled() ) |
|
1428 | - return; |
|
1429 | -?> |
|
1431 | + if ( !wpinv_item_quantities_enabled() ) { |
|
1432 | + return; |
|
1433 | + } |
|
1434 | + ?> |
|
1430 | 1435 | <input type="submit" name="wpinv_update_cart_submit" class="wpinv-submit wpinv-no-js button" value="<?php _e( 'Update Cart', 'invoicing' ); ?>"/> |
1431 | 1436 | <input type="hidden" name="wpi_action" value="update_cart"/> |
1432 | 1437 | <?php |