@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | - exit; // Exit if accessed directly |
|
| 11 | + exit; // Exit if accessed directly |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /** |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | class GetPaid_Meta_Box_Item_Details { |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * Output the metabox. |
|
| 21 | - * |
|
| 22 | - * @param WP_Post $post |
|
| 23 | - */ |
|
| 20 | + * Output the metabox. |
|
| 21 | + * |
|
| 22 | + * @param WP_Post $post |
|
| 23 | + */ |
|
| 24 | 24 | public static function output( $post ) { |
| 25 | - global $aui_bs5; |
|
| 25 | + global $aui_bs5; |
|
| 26 | 26 | |
| 27 | 27 | // Prepare the item. |
| 28 | 28 | $item = new WPInv_Item( $post ); |
@@ -119,24 +119,24 @@ discard block |
||
| 119 | 119 | // Dynamic pricing. |
| 120 | 120 | if ( $item->supports_dynamic_pricing() ) { |
| 121 | 121 | |
| 122 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
| 122 | + do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
| 123 | 123 | |
| 124 | - // NYP toggle. |
|
| 125 | - aui()->input( |
|
| 124 | + // NYP toggle. |
|
| 125 | + aui()->input( |
|
| 126 | 126 | array( |
| 127 | - 'id' => 'wpinv_name_your_price', |
|
| 128 | - 'name' => 'wpinv_name_your_price', |
|
| 129 | - 'type' => 'checkbox', |
|
| 130 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
| 131 | - 'value' => '1', |
|
| 132 | - 'checked' => $item->user_can_set_their_price(), |
|
| 133 | - 'no_wrap' => true, |
|
| 134 | - 'switch' => 'sm', |
|
| 127 | + 'id' => 'wpinv_name_your_price', |
|
| 128 | + 'name' => 'wpinv_name_your_price', |
|
| 129 | + 'type' => 'checkbox', |
|
| 130 | + 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
| 131 | + 'value' => '1', |
|
| 132 | + 'checked' => $item->user_can_set_their_price(), |
|
| 133 | + 'no_wrap' => true, |
|
| 134 | + 'switch' => 'sm', |
|
| 135 | 135 | ), |
| 136 | 136 | true |
| 137 | 137 | ); |
| 138 | 138 | |
| 139 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
| 139 | + do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | 'value' => '1', |
| 152 | 152 | 'checked' => $item->is_recurring(), |
| 153 | 153 | 'no_wrap' => true, |
| 154 | - 'switch' => 'sm', |
|
| 154 | + 'switch' => 'sm', |
|
| 155 | 155 | ), |
| 156 | 156 | true |
| 157 | 157 | ); |
@@ -293,35 +293,35 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
| 296 | - * Save meta box data. |
|
| 297 | - * |
|
| 298 | - * @param int $post_id |
|
| 299 | - */ |
|
| 300 | - public static function save( $post_id ) { |
|
| 296 | + * Save meta box data. |
|
| 297 | + * |
|
| 298 | + * @param int $post_id |
|
| 299 | + */ |
|
| 300 | + public static function save( $post_id ) { |
|
| 301 | 301 | |
| 302 | 302 | // Prepare the item. |
| 303 | 303 | $item = new WPInv_Item( $post_id ); |
| 304 | 304 | |
| 305 | 305 | // Load new data. |
| 306 | 306 | $item->set_props( |
| 307 | - array( |
|
| 308 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, |
|
| 309 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
| 310 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
| 311 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
| 312 | - 'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ), |
|
| 307 | + array( |
|
| 308 | + 'price' => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, |
|
| 309 | + 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
| 310 | + 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
| 311 | + 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
| 312 | + 'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ), |
|
| 313 | 313 | 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_minimum_price'] ) : null, |
| 314 | - 'is_recurring' => ! empty( $_POST['wpinv_is_recurring'] ), |
|
| 315 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
| 316 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
| 317 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
| 318 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
| 319 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
| 320 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
| 321 | - ) |
|
| 314 | + 'is_recurring' => ! empty( $_POST['wpinv_is_recurring'] ), |
|
| 315 | + 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
| 316 | + 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
| 317 | + 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
| 318 | + 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
| 319 | + 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
| 320 | + 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
| 321 | + ) |
|
| 322 | 322 | ); |
| 323 | 323 | |
| 324 | - $item->save(); |
|
| 325 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
| 326 | - } |
|
| 324 | + $item->save(); |
|
| 325 | + do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
| 326 | + } |
|
| 327 | 327 | } |