@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Prepare the selectable items. |
| 13 | 13 | $selectable = array(); |
| 14 | -foreach ( $form->get_items() as $item ) { |
|
| 15 | - if ( ! $item->is_required ) { |
|
| 16 | - $selectable[$item->get_id()] = strip_tags( $item->get_name() . ' — ' . wpinv_price( wpinv_format_amount( $item->get_initial_price() ) ) ); |
|
| 14 | +foreach ($form->get_items() as $item) { |
|
| 15 | + if (!$item->is_required) { |
|
| 16 | + $selectable[$item->get_id()] = strip_tags($item->get_name() . ' — ' . wpinv_price(wpinv_format_amount($item->get_initial_price()))); |
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 20 | +if (empty($selectable)) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | echo aui()->select( |
| 28 | 28 | array( |
| 29 | 29 | 'name' => 'getpaid-payment-form-selected-item', |
| 30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
| 30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_'), |
|
| 31 | 31 | 'required' => true, |
| 32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
| 32 | + 'label' => __('Select Item', 'invoicing'), |
|
| 33 | 33 | 'label_type' => 'vertical', |
| 34 | 34 | 'inline' => false, |
| 35 | 35 | 'options' => $selectable, |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | - exit; |
|
| 3 | + exit; |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -10,60 +10,60 @@ discard block |
||
| 10 | 10 | class GetPaid_Form_Item extends WPInv_Item { |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * Stores a custom description for the item. |
|
| 14 | - * |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 17 | - protected $custom_description = null; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Stores the item quantity. |
|
| 21 | - * |
|
| 22 | - * @var int |
|
| 23 | - */ |
|
| 24 | - protected $quantity = 1; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Stores the item meta. |
|
| 28 | - * |
|
| 29 | - * @var array |
|
| 30 | - */ |
|
| 31 | - protected $meta = array(); |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Is this item required? |
|
| 35 | - * |
|
| 36 | - * @var int |
|
| 37 | - */ |
|
| 38 | - protected $is_required = true; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Are quantities allowed? |
|
| 42 | - * |
|
| 43 | - * @var int |
|
| 44 | - */ |
|
| 45 | - protected $allow_quantities = false; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Associated invoice. |
|
| 49 | - * |
|
| 50 | - * @var int |
|
| 51 | - */ |
|
| 52 | - public $invoice_id = 0; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Item discount. |
|
| 56 | - * |
|
| 57 | - * @var float |
|
| 58 | - */ |
|
| 59 | - public $item_discount = 0; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Item tax. |
|
| 63 | - * |
|
| 64 | - * @var float |
|
| 65 | - */ |
|
| 66 | - public $item_tax = 0; |
|
| 13 | + * Stores a custom description for the item. |
|
| 14 | + * |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | + protected $custom_description = null; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Stores the item quantity. |
|
| 21 | + * |
|
| 22 | + * @var int |
|
| 23 | + */ |
|
| 24 | + protected $quantity = 1; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Stores the item meta. |
|
| 28 | + * |
|
| 29 | + * @var array |
|
| 30 | + */ |
|
| 31 | + protected $meta = array(); |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Is this item required? |
|
| 35 | + * |
|
| 36 | + * @var int |
|
| 37 | + */ |
|
| 38 | + protected $is_required = true; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Are quantities allowed? |
|
| 42 | + * |
|
| 43 | + * @var int |
|
| 44 | + */ |
|
| 45 | + protected $allow_quantities = false; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Associated invoice. |
|
| 49 | + * |
|
| 50 | + * @var int |
|
| 51 | + */ |
|
| 52 | + public $invoice_id = 0; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Item discount. |
|
| 56 | + * |
|
| 57 | + * @var float |
|
| 58 | + */ |
|
| 59 | + public $item_discount = 0; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Item tax. |
|
| 63 | + * |
|
| 64 | + * @var float |
|
| 65 | + */ |
|
| 66 | + public $item_tax = 0; |
|
| 67 | 67 | |
| 68 | 68 | /* |
| 69 | 69 | |-------------------------------------------------------------------------- |
@@ -81,232 +81,232 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | - * Get the item name. |
|
| 85 | - * |
|
| 86 | - * @since 1.0.19 |
|
| 87 | - * @param string $context View or edit context. |
|
| 88 | - * @return string |
|
| 89 | - */ |
|
| 90 | - public function get_name( $context = 'view' ) { |
|
| 91 | - $name = parent::get_name( $context ); |
|
| 92 | - return $name . wpinv_get_item_suffix( $this ); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Get the item name without a suffix. |
|
| 97 | - * |
|
| 98 | - * @since 1.0.19 |
|
| 99 | - * @param string $context View or edit context. |
|
| 100 | - * @return string |
|
| 101 | - */ |
|
| 102 | - public function get_raw_name( $context = 'view' ) { |
|
| 103 | - return parent::get_name( $context ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Get the item description. |
|
| 108 | - * |
|
| 109 | - * @since 1.0.19 |
|
| 110 | - * @param string $context View or edit context. |
|
| 111 | - * @return string |
|
| 112 | - */ |
|
| 113 | - public function get_description( $context = 'view' ) { |
|
| 114 | - |
|
| 115 | - if ( isset( $this->custom_description ) ) { |
|
| 116 | - return $this->custom_description; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - return parent::get_description( $context ); |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Returns the sub total. |
|
| 124 | - * |
|
| 125 | - * @since 1.0.19 |
|
| 126 | - * @param string $context View or edit context. |
|
| 127 | - * @return float |
|
| 128 | - */ |
|
| 129 | - public function get_sub_total( $context = 'view' ) { |
|
| 130 | - return $this->get_quantity( $context ) * $this->get_initial_price( $context ); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * Returns the recurring sub total. |
|
| 135 | - * |
|
| 136 | - * @since 1.0.19 |
|
| 137 | - * @param string $context View or edit context. |
|
| 138 | - * @return float |
|
| 139 | - */ |
|
| 140 | - public function get_recurring_sub_total( $context = 'view' ) { |
|
| 141 | - |
|
| 142 | - if ( $this->is_recurring() ) { |
|
| 143 | - return $this->get_quantity( $context ) * $this->get_price( $context ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - return 0; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * @deprecated |
|
| 151 | - */ |
|
| 152 | - public function get_qantity( $context = 'view' ) { |
|
| 153 | - return $this->get_quantity( $context ); |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Get the item quantity. |
|
| 158 | - * |
|
| 159 | - * @since 1.0.19 |
|
| 160 | - * @param string $context View or edit context. |
|
| 161 | - * @return int |
|
| 162 | - */ |
|
| 163 | - public function get_quantity( $context = 'view' ) { |
|
| 164 | - $quantity = (int) $this->quantity; |
|
| 165 | - |
|
| 166 | - if ( empty( $quantity ) || 1 > $quantity ) { |
|
| 167 | - $quantity = 1; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - if ( 'view' == $context ) { |
|
| 171 | - return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this ); |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - return $quantity; |
|
| 175 | - |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * Get the item meta data. |
|
| 180 | - * |
|
| 181 | - * @since 1.0.19 |
|
| 182 | - * @param string $context View or edit context. |
|
| 183 | - * @return meta |
|
| 184 | - */ |
|
| 185 | - public function get_item_meta( $context = 'view' ) { |
|
| 186 | - $meta = $this->meta; |
|
| 187 | - |
|
| 188 | - if ( 'view' == $context ) { |
|
| 189 | - return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this ); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - return $meta; |
|
| 193 | - |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * Returns whether or not customers can update the item quantity. |
|
| 198 | - * |
|
| 199 | - * @since 1.0.19 |
|
| 200 | - * @param string $context View or edit context. |
|
| 201 | - * @return bool |
|
| 202 | - */ |
|
| 203 | - public function get_allow_quantities( $context = 'view' ) { |
|
| 204 | - $allow_quantities = (bool) $this->allow_quantities; |
|
| 205 | - |
|
| 206 | - if ( 'view' == $context ) { |
|
| 207 | - return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this ); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - return $allow_quantities; |
|
| 211 | - |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * Returns whether or not the item is required. |
|
| 216 | - * |
|
| 217 | - * @since 1.0.19 |
|
| 218 | - * @param string $context View or edit context. |
|
| 219 | - * @return bool |
|
| 220 | - */ |
|
| 221 | - public function get_is_required( $context = 'view' ) { |
|
| 222 | - $is_required = (bool) $this->is_required; |
|
| 223 | - |
|
| 224 | - if ( 'view' == $context ) { |
|
| 225 | - return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this ); |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - return $is_required; |
|
| 229 | - |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - /** |
|
| 233 | - * Prepares form data for use. |
|
| 234 | - * |
|
| 235 | - * @since 1.0.19 |
|
| 236 | - * @return array |
|
| 237 | - */ |
|
| 238 | - public function prepare_data_for_use( $required = null ) { |
|
| 239 | - |
|
| 240 | - $required = is_null( $required ) ? $this->is_required() : $required; |
|
| 241 | - return array( |
|
| 242 | - 'title' => strip_tags( $this->get_name() ), |
|
| 243 | - 'id' => $this->get_id(), |
|
| 244 | - 'price' => $this->get_price(), |
|
| 245 | - 'recurring' => $this->is_recurring(), |
|
| 246 | - 'description' => $this->get_description(), |
|
| 247 | - 'allow_quantities' => $this->allows_quantities(), |
|
| 248 | - 'required' => $required, |
|
| 249 | - ); |
|
| 250 | - |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * Prepares form data for ajax use. |
|
| 255 | - * |
|
| 256 | - * @since 1.0.19 |
|
| 257 | - * @return array |
|
| 258 | - */ |
|
| 259 | - public function prepare_data_for_invoice_edit_ajax( $currency = '' ) { |
|
| 260 | - |
|
| 261 | - $description = getpaid_item_recurring_price_help_text( $this, $currency ); |
|
| 262 | - |
|
| 263 | - if ( $description ) { |
|
| 264 | - $description = "<div class='getpaid-subscription-help-text'>$description</div>"; |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - return array( |
|
| 268 | - 'id' => $this->get_id(), |
|
| 269 | - 'texts' => array( |
|
| 270 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
| 271 | - 'item-description' => wp_kses_post( $this->get_description() ) . $description, |
|
| 272 | - 'item-quantity' => absint( $this->get_quantity() ), |
|
| 273 | - 'item-price' => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ), |
|
| 274 | - 'item-total' => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ), |
|
| 275 | - ), |
|
| 276 | - 'inputs' => array( |
|
| 277 | - 'item-id' => $this->get_id(), |
|
| 278 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
| 279 | - 'item-description' => wp_kses_post( $this->get_description() ), |
|
| 280 | - 'item-quantity' => absint( $this->get_quantity() ), |
|
| 281 | - 'item-price' => $this->get_price(), |
|
| 282 | - ) |
|
| 283 | - ); |
|
| 284 | - |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * Prepares form data for saving (cart_details). |
|
| 289 | - * |
|
| 290 | - * @since 1.0.19 |
|
| 291 | - * @return array |
|
| 292 | - */ |
|
| 293 | - public function prepare_data_for_saving() { |
|
| 294 | - |
|
| 295 | - return array( |
|
| 296 | - 'post_id' => $this->invoice_id, |
|
| 297 | - 'item_id' => $this->get_id(), |
|
| 298 | - 'item_name' => sanitize_text_field( $this->get_raw_name() ), |
|
| 299 | - 'item_description' => $this->get_description(), |
|
| 300 | - 'tax' => $this->item_tax, |
|
| 301 | - 'item_price' => $this->get_price(), |
|
| 302 | - 'quantity' => (int) $this->get_quantity(), |
|
| 303 | - 'discount' => $this->item_discount, |
|
| 304 | - 'subtotal' => $this->get_sub_total(), |
|
| 305 | - 'price' => $this->get_sub_total() + $this->item_tax + $this->item_discount, |
|
| 306 | - 'meta' => $this->get_item_meta(), |
|
| 307 | - ); |
|
| 308 | - |
|
| 309 | - } |
|
| 84 | + * Get the item name. |
|
| 85 | + * |
|
| 86 | + * @since 1.0.19 |
|
| 87 | + * @param string $context View or edit context. |
|
| 88 | + * @return string |
|
| 89 | + */ |
|
| 90 | + public function get_name( $context = 'view' ) { |
|
| 91 | + $name = parent::get_name( $context ); |
|
| 92 | + return $name . wpinv_get_item_suffix( $this ); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Get the item name without a suffix. |
|
| 97 | + * |
|
| 98 | + * @since 1.0.19 |
|
| 99 | + * @param string $context View or edit context. |
|
| 100 | + * @return string |
|
| 101 | + */ |
|
| 102 | + public function get_raw_name( $context = 'view' ) { |
|
| 103 | + return parent::get_name( $context ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Get the item description. |
|
| 108 | + * |
|
| 109 | + * @since 1.0.19 |
|
| 110 | + * @param string $context View or edit context. |
|
| 111 | + * @return string |
|
| 112 | + */ |
|
| 113 | + public function get_description( $context = 'view' ) { |
|
| 114 | + |
|
| 115 | + if ( isset( $this->custom_description ) ) { |
|
| 116 | + return $this->custom_description; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + return parent::get_description( $context ); |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Returns the sub total. |
|
| 124 | + * |
|
| 125 | + * @since 1.0.19 |
|
| 126 | + * @param string $context View or edit context. |
|
| 127 | + * @return float |
|
| 128 | + */ |
|
| 129 | + public function get_sub_total( $context = 'view' ) { |
|
| 130 | + return $this->get_quantity( $context ) * $this->get_initial_price( $context ); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * Returns the recurring sub total. |
|
| 135 | + * |
|
| 136 | + * @since 1.0.19 |
|
| 137 | + * @param string $context View or edit context. |
|
| 138 | + * @return float |
|
| 139 | + */ |
|
| 140 | + public function get_recurring_sub_total( $context = 'view' ) { |
|
| 141 | + |
|
| 142 | + if ( $this->is_recurring() ) { |
|
| 143 | + return $this->get_quantity( $context ) * $this->get_price( $context ); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + return 0; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * @deprecated |
|
| 151 | + */ |
|
| 152 | + public function get_qantity( $context = 'view' ) { |
|
| 153 | + return $this->get_quantity( $context ); |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Get the item quantity. |
|
| 158 | + * |
|
| 159 | + * @since 1.0.19 |
|
| 160 | + * @param string $context View or edit context. |
|
| 161 | + * @return int |
|
| 162 | + */ |
|
| 163 | + public function get_quantity( $context = 'view' ) { |
|
| 164 | + $quantity = (int) $this->quantity; |
|
| 165 | + |
|
| 166 | + if ( empty( $quantity ) || 1 > $quantity ) { |
|
| 167 | + $quantity = 1; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + if ( 'view' == $context ) { |
|
| 171 | + return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this ); |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + return $quantity; |
|
| 175 | + |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * Get the item meta data. |
|
| 180 | + * |
|
| 181 | + * @since 1.0.19 |
|
| 182 | + * @param string $context View or edit context. |
|
| 183 | + * @return meta |
|
| 184 | + */ |
|
| 185 | + public function get_item_meta( $context = 'view' ) { |
|
| 186 | + $meta = $this->meta; |
|
| 187 | + |
|
| 188 | + if ( 'view' == $context ) { |
|
| 189 | + return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this ); |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + return $meta; |
|
| 193 | + |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * Returns whether or not customers can update the item quantity. |
|
| 198 | + * |
|
| 199 | + * @since 1.0.19 |
|
| 200 | + * @param string $context View or edit context. |
|
| 201 | + * @return bool |
|
| 202 | + */ |
|
| 203 | + public function get_allow_quantities( $context = 'view' ) { |
|
| 204 | + $allow_quantities = (bool) $this->allow_quantities; |
|
| 205 | + |
|
| 206 | + if ( 'view' == $context ) { |
|
| 207 | + return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this ); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + return $allow_quantities; |
|
| 211 | + |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * Returns whether or not the item is required. |
|
| 216 | + * |
|
| 217 | + * @since 1.0.19 |
|
| 218 | + * @param string $context View or edit context. |
|
| 219 | + * @return bool |
|
| 220 | + */ |
|
| 221 | + public function get_is_required( $context = 'view' ) { |
|
| 222 | + $is_required = (bool) $this->is_required; |
|
| 223 | + |
|
| 224 | + if ( 'view' == $context ) { |
|
| 225 | + return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this ); |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + return $is_required; |
|
| 229 | + |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + /** |
|
| 233 | + * Prepares form data for use. |
|
| 234 | + * |
|
| 235 | + * @since 1.0.19 |
|
| 236 | + * @return array |
|
| 237 | + */ |
|
| 238 | + public function prepare_data_for_use( $required = null ) { |
|
| 239 | + |
|
| 240 | + $required = is_null( $required ) ? $this->is_required() : $required; |
|
| 241 | + return array( |
|
| 242 | + 'title' => strip_tags( $this->get_name() ), |
|
| 243 | + 'id' => $this->get_id(), |
|
| 244 | + 'price' => $this->get_price(), |
|
| 245 | + 'recurring' => $this->is_recurring(), |
|
| 246 | + 'description' => $this->get_description(), |
|
| 247 | + 'allow_quantities' => $this->allows_quantities(), |
|
| 248 | + 'required' => $required, |
|
| 249 | + ); |
|
| 250 | + |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * Prepares form data for ajax use. |
|
| 255 | + * |
|
| 256 | + * @since 1.0.19 |
|
| 257 | + * @return array |
|
| 258 | + */ |
|
| 259 | + public function prepare_data_for_invoice_edit_ajax( $currency = '' ) { |
|
| 260 | + |
|
| 261 | + $description = getpaid_item_recurring_price_help_text( $this, $currency ); |
|
| 262 | + |
|
| 263 | + if ( $description ) { |
|
| 264 | + $description = "<div class='getpaid-subscription-help-text'>$description</div>"; |
|
| 265 | + } |
|
| 266 | + |
|
| 267 | + return array( |
|
| 268 | + 'id' => $this->get_id(), |
|
| 269 | + 'texts' => array( |
|
| 270 | + 'item-name' => sanitize_text_field( $this->get_name() ), |
|
| 271 | + 'item-description' => wp_kses_post( $this->get_description() ) . $description, |
|
| 272 | + 'item-quantity' => absint( $this->get_quantity() ), |
|
| 273 | + 'item-price' => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ), |
|
| 274 | + 'item-total' => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ), |
|
| 275 | + ), |
|
| 276 | + 'inputs' => array( |
|
| 277 | + 'item-id' => $this->get_id(), |
|
| 278 | + 'item-name' => sanitize_text_field( $this->get_name() ), |
|
| 279 | + 'item-description' => wp_kses_post( $this->get_description() ), |
|
| 280 | + 'item-quantity' => absint( $this->get_quantity() ), |
|
| 281 | + 'item-price' => $this->get_price(), |
|
| 282 | + ) |
|
| 283 | + ); |
|
| 284 | + |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * Prepares form data for saving (cart_details). |
|
| 289 | + * |
|
| 290 | + * @since 1.0.19 |
|
| 291 | + * @return array |
|
| 292 | + */ |
|
| 293 | + public function prepare_data_for_saving() { |
|
| 294 | + |
|
| 295 | + return array( |
|
| 296 | + 'post_id' => $this->invoice_id, |
|
| 297 | + 'item_id' => $this->get_id(), |
|
| 298 | + 'item_name' => sanitize_text_field( $this->get_raw_name() ), |
|
| 299 | + 'item_description' => $this->get_description(), |
|
| 300 | + 'tax' => $this->item_tax, |
|
| 301 | + 'item_price' => $this->get_price(), |
|
| 302 | + 'quantity' => (int) $this->get_quantity(), |
|
| 303 | + 'discount' => $this->item_discount, |
|
| 304 | + 'subtotal' => $this->get_sub_total(), |
|
| 305 | + 'price' => $this->get_sub_total() + $this->item_tax + $this->item_discount, |
|
| 306 | + 'meta' => $this->get_item_meta(), |
|
| 307 | + ); |
|
| 308 | + |
|
| 309 | + } |
|
| 310 | 310 | |
| 311 | 311 | /* |
| 312 | 312 | |-------------------------------------------------------------------------- |
@@ -318,70 +318,70 @@ discard block |
||
| 318 | 318 | | object. |
| 319 | 319 | */ |
| 320 | 320 | |
| 321 | - /** |
|
| 322 | - * Set the item qantity. |
|
| 323 | - * |
|
| 324 | - * @since 1.0.19 |
|
| 325 | - * @param int $quantity The item quantity. |
|
| 326 | - */ |
|
| 327 | - public function set_quantity( $quantity ) { |
|
| 328 | - |
|
| 329 | - if ( empty( $quantity ) || ! is_numeric( $quantity ) ) { |
|
| 330 | - $quantity = 1; |
|
| 331 | - } |
|
| 332 | - |
|
| 333 | - $this->quantity = (int) $quantity; |
|
| 334 | - |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - /** |
|
| 338 | - * Set the item meta data. |
|
| 339 | - * |
|
| 340 | - * @since 1.0.19 |
|
| 341 | - * @param array $meta The item meta data. |
|
| 342 | - */ |
|
| 343 | - public function set_item_meta( $meta ) { |
|
| 344 | - $this->meta = maybe_unserialize( $meta ); |
|
| 345 | - } |
|
| 346 | - |
|
| 347 | - /** |
|
| 348 | - * Set whether or not the quantities are allowed. |
|
| 349 | - * |
|
| 350 | - * @since 1.0.19 |
|
| 351 | - * @param bool $allow_quantities |
|
| 352 | - */ |
|
| 353 | - public function set_allow_quantities( $allow_quantities ) { |
|
| 354 | - $this->allow_quantities = (bool) $allow_quantities; |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - /** |
|
| 358 | - * Set whether or not the item is required. |
|
| 359 | - * |
|
| 360 | - * @since 1.0.19 |
|
| 361 | - * @param bool $is_required |
|
| 362 | - */ |
|
| 363 | - public function set_is_required( $is_required ) { |
|
| 364 | - $this->is_required = (bool) $is_required; |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - /** |
|
| 368 | - * Sets the custom item description. |
|
| 369 | - * |
|
| 370 | - * @since 1.0.19 |
|
| 371 | - * @param string $description |
|
| 372 | - */ |
|
| 373 | - public function set_custom_description( $description ) { |
|
| 374 | - $this->custom_description = $description; |
|
| 375 | - } |
|
| 321 | + /** |
|
| 322 | + * Set the item qantity. |
|
| 323 | + * |
|
| 324 | + * @since 1.0.19 |
|
| 325 | + * @param int $quantity The item quantity. |
|
| 326 | + */ |
|
| 327 | + public function set_quantity( $quantity ) { |
|
| 328 | + |
|
| 329 | + if ( empty( $quantity ) || ! is_numeric( $quantity ) ) { |
|
| 330 | + $quantity = 1; |
|
| 331 | + } |
|
| 332 | + |
|
| 333 | + $this->quantity = (int) $quantity; |
|
| 334 | + |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + /** |
|
| 338 | + * Set the item meta data. |
|
| 339 | + * |
|
| 340 | + * @since 1.0.19 |
|
| 341 | + * @param array $meta The item meta data. |
|
| 342 | + */ |
|
| 343 | + public function set_item_meta( $meta ) { |
|
| 344 | + $this->meta = maybe_unserialize( $meta ); |
|
| 345 | + } |
|
| 346 | + |
|
| 347 | + /** |
|
| 348 | + * Set whether or not the quantities are allowed. |
|
| 349 | + * |
|
| 350 | + * @since 1.0.19 |
|
| 351 | + * @param bool $allow_quantities |
|
| 352 | + */ |
|
| 353 | + public function set_allow_quantities( $allow_quantities ) { |
|
| 354 | + $this->allow_quantities = (bool) $allow_quantities; |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + /** |
|
| 358 | + * Set whether or not the item is required. |
|
| 359 | + * |
|
| 360 | + * @since 1.0.19 |
|
| 361 | + * @param bool $is_required |
|
| 362 | + */ |
|
| 363 | + public function set_is_required( $is_required ) { |
|
| 364 | + $this->is_required = (bool) $is_required; |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + /** |
|
| 368 | + * Sets the custom item description. |
|
| 369 | + * |
|
| 370 | + * @since 1.0.19 |
|
| 371 | + * @param string $description |
|
| 372 | + */ |
|
| 373 | + public function set_custom_description( $description ) { |
|
| 374 | + $this->custom_description = $description; |
|
| 375 | + } |
|
| 376 | 376 | |
| 377 | 377 | /** |
| 378 | 378 | * We do not want to save items to the database. |
| 379 | 379 | * |
| 380 | - * @return int item id |
|
| 380 | + * @return int item id |
|
| 381 | 381 | */ |
| 382 | 382 | public function save( $data = array() ) { |
| 383 | 383 | return $this->get_id(); |
| 384 | - } |
|
| 384 | + } |
|
| 385 | 385 | |
| 386 | 386 | /* |
| 387 | 387 | |-------------------------------------------------------------------------- |
@@ -393,23 +393,23 @@ discard block |
||
| 393 | 393 | */ |
| 394 | 394 | |
| 395 | 395 | /** |
| 396 | - * Checks whether the item has enabled dynamic pricing. |
|
| 397 | - * |
|
| 398 | - * @since 1.0.19 |
|
| 399 | - * @return bool |
|
| 400 | - */ |
|
| 401 | - public function is_required() { |
|
| 396 | + * Checks whether the item has enabled dynamic pricing. |
|
| 397 | + * |
|
| 398 | + * @since 1.0.19 |
|
| 399 | + * @return bool |
|
| 400 | + */ |
|
| 401 | + public function is_required() { |
|
| 402 | 402 | return (bool) $this->get_is_required(); |
| 403 | - } |
|
| 404 | - |
|
| 405 | - /** |
|
| 406 | - * Checks whether users can edit the quantities. |
|
| 407 | - * |
|
| 408 | - * @since 1.0.19 |
|
| 409 | - * @return bool |
|
| 410 | - */ |
|
| 411 | - public function allows_quantities() { |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + /** |
|
| 406 | + * Checks whether users can edit the quantities. |
|
| 407 | + * |
|
| 408 | + * @since 1.0.19 |
|
| 409 | + * @return bool |
|
| 410 | + */ |
|
| 411 | + public function allows_quantities() { |
|
| 412 | 412 | return (bool) $this->get_allow_quantities(); |
| 413 | - } |
|
| 413 | + } |
|
| 414 | 414 | |
| 415 | 415 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | * @param string $context View or edit context. |
| 88 | 88 | * @return string |
| 89 | 89 | */ |
| 90 | - public function get_name( $context = 'view' ) { |
|
| 91 | - $name = parent::get_name( $context ); |
|
| 92 | - return $name . wpinv_get_item_suffix( $this ); |
|
| 90 | + public function get_name($context = 'view') { |
|
| 91 | + $name = parent::get_name($context); |
|
| 92 | + return $name . wpinv_get_item_suffix($this); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | * @param string $context View or edit context. |
| 100 | 100 | * @return string |
| 101 | 101 | */ |
| 102 | - public function get_raw_name( $context = 'view' ) { |
|
| 103 | - return parent::get_name( $context ); |
|
| 102 | + public function get_raw_name($context = 'view') { |
|
| 103 | + return parent::get_name($context); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | * @param string $context View or edit context. |
| 111 | 111 | * @return string |
| 112 | 112 | */ |
| 113 | - public function get_description( $context = 'view' ) { |
|
| 113 | + public function get_description($context = 'view') { |
|
| 114 | 114 | |
| 115 | - if ( isset( $this->custom_description ) ) { |
|
| 115 | + if (isset($this->custom_description)) { |
|
| 116 | 116 | return $this->custom_description; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - return parent::get_description( $context ); |
|
| 119 | + return parent::get_description($context); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * @param string $context View or edit context. |
| 127 | 127 | * @return float |
| 128 | 128 | */ |
| 129 | - public function get_sub_total( $context = 'view' ) { |
|
| 130 | - return $this->get_quantity( $context ) * $this->get_initial_price( $context ); |
|
| 129 | + public function get_sub_total($context = 'view') { |
|
| 130 | + return $this->get_quantity($context) * $this->get_initial_price($context); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | * @param string $context View or edit context. |
| 138 | 138 | * @return float |
| 139 | 139 | */ |
| 140 | - public function get_recurring_sub_total( $context = 'view' ) { |
|
| 140 | + public function get_recurring_sub_total($context = 'view') { |
|
| 141 | 141 | |
| 142 | - if ( $this->is_recurring() ) { |
|
| 143 | - return $this->get_quantity( $context ) * $this->get_price( $context ); |
|
| 142 | + if ($this->is_recurring()) { |
|
| 143 | + return $this->get_quantity($context) * $this->get_price($context); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | return 0; |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | /** |
| 150 | 150 | * @deprecated |
| 151 | 151 | */ |
| 152 | - public function get_qantity( $context = 'view' ) { |
|
| 153 | - return $this->get_quantity( $context ); |
|
| 152 | + public function get_qantity($context = 'view') { |
|
| 153 | + return $this->get_quantity($context); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -160,15 +160,15 @@ discard block |
||
| 160 | 160 | * @param string $context View or edit context. |
| 161 | 161 | * @return int |
| 162 | 162 | */ |
| 163 | - public function get_quantity( $context = 'view' ) { |
|
| 163 | + public function get_quantity($context = 'view') { |
|
| 164 | 164 | $quantity = (int) $this->quantity; |
| 165 | 165 | |
| 166 | - if ( empty( $quantity ) || 1 > $quantity ) { |
|
| 166 | + if (empty($quantity) || 1 > $quantity) { |
|
| 167 | 167 | $quantity = 1; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if ( 'view' == $context ) { |
|
| 171 | - return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this ); |
|
| 170 | + if ('view' == $context) { |
|
| 171 | + return apply_filters('getpaid_payment_form_item_quantity', $quantity, $this); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | return $quantity; |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | * @param string $context View or edit context. |
| 183 | 183 | * @return meta |
| 184 | 184 | */ |
| 185 | - public function get_item_meta( $context = 'view' ) { |
|
| 185 | + public function get_item_meta($context = 'view') { |
|
| 186 | 186 | $meta = $this->meta; |
| 187 | 187 | |
| 188 | - if ( 'view' == $context ) { |
|
| 189 | - return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this ); |
|
| 188 | + if ('view' == $context) { |
|
| 189 | + return apply_filters('getpaid_payment_form_item_meta', $meta, $this); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | return $meta; |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | * @param string $context View or edit context. |
| 201 | 201 | * @return bool |
| 202 | 202 | */ |
| 203 | - public function get_allow_quantities( $context = 'view' ) { |
|
| 203 | + public function get_allow_quantities($context = 'view') { |
|
| 204 | 204 | $allow_quantities = (bool) $this->allow_quantities; |
| 205 | 205 | |
| 206 | - if ( 'view' == $context ) { |
|
| 207 | - return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this ); |
|
| 206 | + if ('view' == $context) { |
|
| 207 | + return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | return $allow_quantities; |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | * @param string $context View or edit context. |
| 219 | 219 | * @return bool |
| 220 | 220 | */ |
| 221 | - public function get_is_required( $context = 'view' ) { |
|
| 221 | + public function get_is_required($context = 'view') { |
|
| 222 | 222 | $is_required = (bool) $this->is_required; |
| 223 | 223 | |
| 224 | - if ( 'view' == $context ) { |
|
| 225 | - return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this ); |
|
| 224 | + if ('view' == $context) { |
|
| 225 | + return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | return $is_required; |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | * @since 1.0.19 |
| 236 | 236 | * @return array |
| 237 | 237 | */ |
| 238 | - public function prepare_data_for_use( $required = null ) { |
|
| 238 | + public function prepare_data_for_use($required = null) { |
|
| 239 | 239 | |
| 240 | - $required = is_null( $required ) ? $this->is_required() : $required; |
|
| 240 | + $required = is_null($required) ? $this->is_required() : $required; |
|
| 241 | 241 | return array( |
| 242 | - 'title' => strip_tags( $this->get_name() ), |
|
| 242 | + 'title' => strip_tags($this->get_name()), |
|
| 243 | 243 | 'id' => $this->get_id(), |
| 244 | 244 | 'price' => $this->get_price(), |
| 245 | 245 | 'recurring' => $this->is_recurring(), |
@@ -256,28 +256,28 @@ discard block |
||
| 256 | 256 | * @since 1.0.19 |
| 257 | 257 | * @return array |
| 258 | 258 | */ |
| 259 | - public function prepare_data_for_invoice_edit_ajax( $currency = '' ) { |
|
| 259 | + public function prepare_data_for_invoice_edit_ajax($currency = '') { |
|
| 260 | 260 | |
| 261 | - $description = getpaid_item_recurring_price_help_text( $this, $currency ); |
|
| 261 | + $description = getpaid_item_recurring_price_help_text($this, $currency); |
|
| 262 | 262 | |
| 263 | - if ( $description ) { |
|
| 263 | + if ($description) { |
|
| 264 | 264 | $description = "<div class='getpaid-subscription-help-text'>$description</div>"; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | return array( |
| 268 | 268 | 'id' => $this->get_id(), |
| 269 | 269 | 'texts' => array( |
| 270 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
| 271 | - 'item-description' => wp_kses_post( $this->get_description() ) . $description, |
|
| 272 | - 'item-quantity' => absint( $this->get_quantity() ), |
|
| 273 | - 'item-price' => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ), |
|
| 274 | - 'item-total' => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ), |
|
| 270 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
| 271 | + 'item-description' => wp_kses_post($this->get_description()) . $description, |
|
| 272 | + 'item-quantity' => absint($this->get_quantity()), |
|
| 273 | + 'item-price' => wpinv_price(wpinv_format_amount($this->get_price()), $currency), |
|
| 274 | + 'item-total' => wpinv_price(wpinv_format_amount($this->get_sub_total()), $currency), |
|
| 275 | 275 | ), |
| 276 | 276 | 'inputs' => array( |
| 277 | 277 | 'item-id' => $this->get_id(), |
| 278 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
| 279 | - 'item-description' => wp_kses_post( $this->get_description() ), |
|
| 280 | - 'item-quantity' => absint( $this->get_quantity() ), |
|
| 278 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
| 279 | + 'item-description' => wp_kses_post($this->get_description()), |
|
| 280 | + 'item-quantity' => absint($this->get_quantity()), |
|
| 281 | 281 | 'item-price' => $this->get_price(), |
| 282 | 282 | ) |
| 283 | 283 | ); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | return array( |
| 296 | 296 | 'post_id' => $this->invoice_id, |
| 297 | 297 | 'item_id' => $this->get_id(), |
| 298 | - 'item_name' => sanitize_text_field( $this->get_raw_name() ), |
|
| 298 | + 'item_name' => sanitize_text_field($this->get_raw_name()), |
|
| 299 | 299 | 'item_description' => $this->get_description(), |
| 300 | 300 | 'tax' => $this->item_tax, |
| 301 | 301 | 'item_price' => $this->get_price(), |
@@ -324,9 +324,9 @@ discard block |
||
| 324 | 324 | * @since 1.0.19 |
| 325 | 325 | * @param int $quantity The item quantity. |
| 326 | 326 | */ |
| 327 | - public function set_quantity( $quantity ) { |
|
| 327 | + public function set_quantity($quantity) { |
|
| 328 | 328 | |
| 329 | - if ( empty( $quantity ) || ! is_numeric( $quantity ) ) { |
|
| 329 | + if (empty($quantity) || !is_numeric($quantity)) { |
|
| 330 | 330 | $quantity = 1; |
| 331 | 331 | } |
| 332 | 332 | |
@@ -340,8 +340,8 @@ discard block |
||
| 340 | 340 | * @since 1.0.19 |
| 341 | 341 | * @param array $meta The item meta data. |
| 342 | 342 | */ |
| 343 | - public function set_item_meta( $meta ) { |
|
| 344 | - $this->meta = maybe_unserialize( $meta ); |
|
| 343 | + public function set_item_meta($meta) { |
|
| 344 | + $this->meta = maybe_unserialize($meta); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | * @since 1.0.19 |
| 351 | 351 | * @param bool $allow_quantities |
| 352 | 352 | */ |
| 353 | - public function set_allow_quantities( $allow_quantities ) { |
|
| 353 | + public function set_allow_quantities($allow_quantities) { |
|
| 354 | 354 | $this->allow_quantities = (bool) $allow_quantities; |
| 355 | 355 | } |
| 356 | 356 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * @since 1.0.19 |
| 361 | 361 | * @param bool $is_required |
| 362 | 362 | */ |
| 363 | - public function set_is_required( $is_required ) { |
|
| 363 | + public function set_is_required($is_required) { |
|
| 364 | 364 | $this->is_required = (bool) $is_required; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | * @since 1.0.19 |
| 371 | 371 | * @param string $description |
| 372 | 372 | */ |
| 373 | - public function set_custom_description( $description ) { |
|
| 373 | + public function set_custom_description($description) { |
|
| 374 | 374 | $this->custom_description = $description; |
| 375 | 375 | } |
| 376 | 376 | |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | * |
| 380 | 380 | * @return int item id |
| 381 | 381 | */ |
| 382 | - public function save( $data = array() ) { |
|
| 382 | + public function save($data = array()) { |
|
| 383 | 383 | return $this->get_id(); |
| 384 | 384 | } |
| 385 | 385 | |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$watermark = wpinv_watermark( $invoice->get_id() ) |
|
| 12 | +$watermark = wpinv_watermark($invoice->get_id()) |
|
| 13 | 13 | |
| 14 | 14 | ?> |
| 15 | 15 | |
| 16 | - <?php do_action( 'getpaid_before_invoice_details_top', $invoice ); ?> |
|
| 16 | + <?php do_action('getpaid_before_invoice_details_top', $invoice); ?> |
|
| 17 | 17 | |
| 18 | - <?php if ( ! empty( $watermark ) ) : ?> |
|
| 18 | + <?php if (!empty($watermark)) : ?> |
|
| 19 | 19 | |
| 20 | 20 | <div class="getpaid-watermark no-print"> |
| 21 | - <p><?php echo sanitize_text_field( $watermark ) ?></p> |
|
| 21 | + <p><?php echo sanitize_text_field($watermark) ?></p> |
|
| 22 | 22 | </div> |
| 23 | 23 | |
| 24 | 24 | <?php endif; ?> |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | <div class="getpaid-invoice-details-top mb-5"> |
| 27 | 27 | <div class="row"> |
| 28 | 28 | <div class="col-12 col-sm-6 text-left"> |
| 29 | - <?php do_action( 'getpaid_invoice_details_top_left', $invoice ); ?> |
|
| 29 | + <?php do_action('getpaid_invoice_details_top_left', $invoice); ?> |
|
| 30 | 30 | </div> |
| 31 | 31 | |
| 32 | 32 | <div class="col-12 col-sm-6 text-right"> |
| 33 | - <?php do_action( 'getpaid_invoice_details_top_right', $invoice ); ?> |
|
| 33 | + <?php do_action('getpaid_invoice_details_top_right', $invoice); ?> |
|
| 34 | 34 | </div> |
| 35 | 35 | </div> |
| 36 | 36 | </div> |
| 37 | 37 | |
| 38 | - <?php do_action( 'getpaid_after_invoice_details_top', $invoice ); ?> |
|
| 38 | + <?php do_action('getpaid_after_invoice_details_top', $invoice); ?> |
|
| 39 | 39 | |
| 40 | 40 | <?php |
@@ -7,51 +7,51 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$class = ! is_singular( 'page' ) ? 'table-sm' : ''; |
|
| 12 | +$class = !is_singular('page') ? 'table-sm' : ''; |
|
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | - <?php do_action( 'getpaid_before_invoice_meta', $invoice ); ?> |
|
| 15 | + <?php do_action('getpaid_before_invoice_meta', $invoice); ?> |
|
| 16 | 16 | <div class="getpaid-invoice-meta-data"> |
| 17 | 17 | |
| 18 | 18 | |
| 19 | - <?php do_action( 'getpaid_before_invoice_meta_table', $invoice ); ?> |
|
| 19 | + <?php do_action('getpaid_before_invoice_meta_table', $invoice); ?> |
|
| 20 | 20 | <table class="table <?php echo $class; ?> table-bordered"> |
| 21 | 21 | <tbody> |
| 22 | 22 | |
| 23 | - <?php do_action( "getpaid_before_invoice_meta_rows", $invoice ); ?> |
|
| 24 | - <?php foreach ( $meta as $key => $data ) : ?> |
|
| 23 | + <?php do_action("getpaid_before_invoice_meta_rows", $invoice); ?> |
|
| 24 | + <?php foreach ($meta as $key => $data) : ?> |
|
| 25 | 25 | |
| 26 | - <?php if ( ! empty( $data['value'] ) ) : ?> |
|
| 26 | + <?php if (!empty($data['value'])) : ?> |
|
| 27 | 27 | |
| 28 | - <?php do_action( "getpaid_before_invoice_meta_$key", $invoice, $data ); ?> |
|
| 28 | + <?php do_action("getpaid_before_invoice_meta_$key", $invoice, $data); ?> |
|
| 29 | 29 | |
| 30 | - <tr class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>"> |
|
| 30 | + <tr class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>"> |
|
| 31 | 31 | |
| 32 | 32 | <th> |
| 33 | - <?php echo sanitize_text_field( $data['label'] ); ?> |
|
| 33 | + <?php echo sanitize_text_field($data['label']); ?> |
|
| 34 | 34 | </th> |
| 35 | 35 | |
| 36 | 36 | <td> |
| 37 | - <span class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span> |
|
| 37 | + <span class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span> |
|
| 38 | 38 | </td> |
| 39 | 39 | |
| 40 | 40 | </tr> |
| 41 | 41 | |
| 42 | - <?php do_action( "getpaid_after_invoice_meta_$key", $invoice, $data ); ?> |
|
| 42 | + <?php do_action("getpaid_after_invoice_meta_$key", $invoice, $data); ?> |
|
| 43 | 43 | |
| 44 | 44 | <?php endif; ?> |
| 45 | 45 | |
| 46 | 46 | <?php endforeach; ?> |
| 47 | - <?php do_action( "getpaid_after_invoice_meta_rows", $invoice ); ?> |
|
| 47 | + <?php do_action("getpaid_after_invoice_meta_rows", $invoice); ?> |
|
| 48 | 48 | |
| 49 | 49 | </tbody> |
| 50 | 50 | </table> |
| 51 | - <?php do_action( 'getpaid_after_invoice_meta_table', $invoice ); ?> |
|
| 51 | + <?php do_action('getpaid_after_invoice_meta_table', $invoice); ?> |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | </div> |
| 55 | - <?php do_action( 'getpaid_after_invoice_meta', $invoice ); ?> |
|
| 55 | + <?php do_action('getpaid_after_invoice_meta', $invoice); ?> |
|
| 56 | 56 | |
| 57 | 57 | <?php |
@@ -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="getpaid-header-right-actions"> |
| 15 | 15 | |
| 16 | - <?php if ( $invoice->is_type( 'invoice' ) ) : ?> |
|
| 16 | + <?php if ($invoice->is_type('invoice')) : ?> |
|
| 17 | 17 | |
| 18 | 18 | <a class="btn btn-sm btn-secondary invoice-action-print" onclick="window.print();" href="javascript:void(0)"> |
| 19 | - <?php _e( 'Print Invoice', 'invoicing' ); ?> |
|
| 19 | + <?php _e('Print Invoice', 'invoicing'); ?> |
|
| 20 | 20 | </a> |
| 21 | 21 | |
| 22 | - <?php if ( is_user_logged_in() ) : ?> |
|
| 22 | + <?php if (is_user_logged_in()) : ?> |
|
| 23 | 23 | |
| 24 | - <a class="btn btn-sm btn-secondary invoice-action-history" href="<?php echo esc_url( wpinv_get_history_page_uri() ); ?>"> |
|
| 25 | - <?php _e( 'Invoice History', 'invoicing' ); ?> |
|
| 24 | + <a class="btn btn-sm btn-secondary invoice-action-history" href="<?php echo esc_url(wpinv_get_history_page_uri()); ?>"> |
|
| 25 | + <?php _e('Invoice History', 'invoicing'); ?> |
|
| 26 | 26 | </a> |
| 27 | 27 | <?php endif; ?> |
| 28 | 28 | |
| 29 | - <?php if ( wpinv_current_user_can_manage_invoicing() ) : ?> |
|
| 29 | + <?php if (wpinv_current_user_can_manage_invoicing()) : ?> |
|
| 30 | 30 | |
| 31 | - <a class="btn btn-sm btn-secondary invoice-action-edit" href="<?php echo esc_url( get_edit_post_link( $invoice->get_id() ) ); ?>"> |
|
| 32 | - <?php _e( 'Edit Invoice', 'invoicing' ); ?> |
|
| 31 | + <a class="btn btn-sm btn-secondary invoice-action-edit" href="<?php echo esc_url(get_edit_post_link($invoice->get_id())); ?>"> |
|
| 32 | + <?php _e('Edit Invoice', 'invoicing'); ?> |
|
| 33 | 33 | </a> |
| 34 | 34 | <?php endif; ?> |
| 35 | 35 | |
| 36 | 36 | <?php endif; ?> |
| 37 | 37 | |
| 38 | - <?php do_action('wpinv_invoice_display_right_actions', $invoice ); ?> |
|
| 38 | + <?php do_action('wpinv_invoice_display_right_actions', $invoice); ?> |
|
| 39 | 39 | </div> |
| 40 | 40 | |
| 41 | 41 | <?php |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | * @var array $fee |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) || exit; |
|
| 12 | +defined('ABSPATH') || exit; |
|
| 13 | 13 | |
| 14 | -do_action( 'getpaid_before_invoice_fee_item', $invoice, $fee ); |
|
| 14 | +do_action('getpaid_before_invoice_fee_item', $invoice, $fee); |
|
| 15 | 15 | |
| 16 | 16 | ?> |
| 17 | 17 | |
@@ -19,61 +19,61 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | <div class="form-row"> |
| 21 | 21 | |
| 22 | - <?php foreach ( array_keys( $columns ) as $column ): ?> |
|
| 22 | + <?php foreach (array_keys($columns) as $column): ?> |
|
| 23 | 23 | |
| 24 | - <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-item-<?php echo sanitize_html_class( $column ); ?>"> |
|
| 24 | + <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-item-<?php echo sanitize_html_class($column); ?>"> |
|
| 25 | 25 | |
| 26 | 26 | <?php |
| 27 | 27 | |
| 28 | 28 | // Fires before printing a fee item column. |
| 29 | - do_action( "getpaid_invoice_fee_item_before_$column", $fee, $invoice ); |
|
| 29 | + do_action("getpaid_invoice_fee_item_before_$column", $fee, $invoice); |
|
| 30 | 30 | |
| 31 | 31 | // Item name. |
| 32 | - if ( 'name' == $column ) { |
|
| 32 | + if ('name' == $column) { |
|
| 33 | 33 | |
| 34 | 34 | // Display the name. |
| 35 | - echo '<div class="mb-1">' . sanitize_text_field( $fee['name'] ) . '</div>'; |
|
| 35 | + echo '<div class="mb-1">' . sanitize_text_field($fee['name']) . '</div>'; |
|
| 36 | 36 | |
| 37 | 37 | // And an optional description. |
| 38 | - $description = esc_html__( 'Fee', 'invoicing' ); |
|
| 38 | + $description = esc_html__('Fee', 'invoicing'); |
|
| 39 | 39 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Item price. |
| 44 | - if ( 'price' == $column ) { |
|
| 44 | + if ('price' == $column) { |
|
| 45 | 45 | |
| 46 | 46 | // Display the item price (or recurring price if this is a renewal invoice) |
| 47 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
| 48 | - echo wpinv_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
| 47 | + if ($invoice->is_recurring() && $invoice->is_renewal()) { |
|
| 48 | + echo wpinv_price($fee['recurring_fee'], $invoice->get_currency()); |
|
| 49 | 49 | } else { |
| 50 | - echo wpinv_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
| 50 | + echo wpinv_price($fee['initial_fee'], $invoice->get_currency()); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Item quantity. |
| 56 | - if ( 'quantity' == $column ) { |
|
| 56 | + if ('quantity' == $column) { |
|
| 57 | 57 | echo "—"; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Item sub total. |
| 61 | - if ( 'subtotal' == $column ) { |
|
| 61 | + if ('subtotal' == $column) { |
|
| 62 | 62 | |
| 63 | 63 | // Display the item price (or recurring price if this is a renewal invoice) |
| 64 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
| 65 | - echo wpinv_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
| 64 | + if ($invoice->is_recurring() && $invoice->is_renewal()) { |
|
| 65 | + echo wpinv_price($fee['recurring_fee'], $invoice->get_currency()); |
|
| 66 | 66 | } else { |
| 67 | - echo wpinv_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
| 67 | + echo wpinv_price($fee['initial_fee'], $invoice->get_currency()); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Fires when printing a fee item column. |
| 73 | - do_action( "getpaid_invoice_fee_item_$column", $fee, $invoice ); |
|
| 73 | + do_action("getpaid_invoice_fee_item_$column", $fee, $invoice); |
|
| 74 | 74 | |
| 75 | 75 | // Fires after printing a fee item column. |
| 76 | - do_action( "getpaid_invoice_fee_item_after_$column", $fee, $invoice ); |
|
| 76 | + do_action("getpaid_invoice_fee_item_after_$column", $fee, $invoice); |
|
| 77 | 77 | |
| 78 | 78 | ?> |
| 79 | 79 | |
@@ -9,26 +9,26 @@ discard block |
||
| 9 | 9 | * @var WPInv_Invoice $invoice |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) || exit; |
|
| 12 | +defined('ABSPATH') || exit; |
|
| 13 | 13 | |
| 14 | 14 | // Totals rows. |
| 15 | -$totals = getpaid_invoice_totals_rows( $invoice ); |
|
| 15 | +$totals = getpaid_invoice_totals_rows($invoice); |
|
| 16 | 16 | |
| 17 | -do_action( 'getpaid_before_invoice_line_totals', $invoice, $totals ); |
|
| 17 | +do_action('getpaid_before_invoice_line_totals', $invoice, $totals); |
|
| 18 | 18 | |
| 19 | 19 | ?> |
| 20 | 20 | <div class='getpaid-invoice-line-totals'> |
| 21 | 21 | <div class="row"> |
| 22 | 22 | <div class="col-12 offset-sm-6 col-sm-6 border-left pl-0"> |
| 23 | 23 | |
| 24 | - <?php foreach ( $totals as $key => $label ) : ?> |
|
| 24 | + <?php foreach ($totals as $key => $label) : ?> |
|
| 25 | 25 | |
| 26 | - <div class="getpaid-invoice-line-totals-col <?php echo sanitize_html_class( $key ); ?>"> |
|
| 26 | + <div class="getpaid-invoice-line-totals-col <?php echo sanitize_html_class($key); ?>"> |
|
| 27 | 27 | |
| 28 | 28 | <div class="row"> |
| 29 | 29 | |
| 30 | 30 | <div class="col-12 col-sm-8 getpaid-invoice-line-totals-label"> |
| 31 | - <?php echo sanitize_text_field( $label ); ?> |
|
| 31 | + <?php echo sanitize_text_field($label); ?> |
|
| 32 | 32 | </div> |
| 33 | 33 | |
| 34 | 34 | <div class="col-12 col-sm-2 getpaid-invoice-line-totals-value"> |
@@ -36,32 +36,32 @@ discard block |
||
| 36 | 36 | <?php |
| 37 | 37 | |
| 38 | 38 | // Total tax. |
| 39 | - if ( 'tax' == $key ) { |
|
| 40 | - echo wpinv_price( wpinv_format_amount( $invoice->get_total_tax() ), $invoice->get_currency() ); |
|
| 39 | + if ('tax' == $key) { |
|
| 40 | + echo wpinv_price(wpinv_format_amount($invoice->get_total_tax()), $invoice->get_currency()); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Total Fee. |
| 44 | - if ( 'fee' == $key ) { |
|
| 45 | - echo wpinv_price( wpinv_format_amount( $invoice->get_total_fees() ), $invoice->get_currency() ); |
|
| 44 | + if ('fee' == $key) { |
|
| 45 | + echo wpinv_price(wpinv_format_amount($invoice->get_total_fees()), $invoice->get_currency()); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // Total discount. |
| 49 | - if ( 'discount' == $key ) { |
|
| 50 | - echo wpinv_price( wpinv_format_amount( $invoice->get_total_discount() ), $invoice->get_currency() ); |
|
| 49 | + if ('discount' == $key) { |
|
| 50 | + echo wpinv_price(wpinv_format_amount($invoice->get_total_discount()), $invoice->get_currency()); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Sub total. |
| 54 | - if ( 'subtotal' == $key ) { |
|
| 55 | - echo wpinv_price( wpinv_format_amount( $invoice->get_subtotal() ), $invoice->get_currency() ); |
|
| 54 | + if ('subtotal' == $key) { |
|
| 55 | + echo wpinv_price(wpinv_format_amount($invoice->get_subtotal()), $invoice->get_currency()); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Total. |
| 59 | - if ( 'total' == $key ) { |
|
| 60 | - echo wpinv_price( wpinv_format_amount( $invoice->get_total() ), $invoice->get_currency() ); |
|
| 59 | + if ('total' == $key) { |
|
| 60 | + echo wpinv_price(wpinv_format_amount($invoice->get_total()), $invoice->get_currency()); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Fires when printing a cart total. |
| 64 | - do_action( "getpaid_invoice_cart_totals_$key", $invoice ); |
|
| 64 | + do_action("getpaid_invoice_cart_totals_$key", $invoice); |
|
| 65 | 65 | |
| 66 | 66 | ?> |
| 67 | 67 | |
@@ -75,4 +75,4 @@ discard block |
||
| 75 | 75 | </div> |
| 76 | 76 | </div> <!-- end .getpaid-invoice-line-totals --> |
| 77 | 77 | |
| 78 | -<?php do_action( 'getpaid_after_invoice_line_totals', $invoice, $totals ); ?> |
|
| 78 | +<?php do_action('getpaid_after_invoice_line_totals', $invoice, $totals); ?> |
|
@@ -8,21 +8,21 @@ discard block |
||
| 8 | 8 | * @var WPInv_Invoice $invoice |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | +defined('ABSPATH') || exit; |
|
| 12 | 12 | |
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | -<?php do_action( 'getpaid_invoice_before_line_items', $invoice ); ?> |
|
| 15 | +<?php do_action('getpaid_invoice_before_line_items', $invoice); ?> |
|
| 16 | 16 | |
| 17 | - <h2 class="mt-5 mb-1 h4"><?php echo sprintf( esc_html__( '%s Items', 'invoicing' ), ucfirst( $invoice->get_type() )); ?></h2> |
|
| 17 | + <h2 class="mt-5 mb-1 h4"><?php echo sprintf(esc_html__('%s Items', 'invoicing'), ucfirst($invoice->get_type())); ?></h2> |
|
| 18 | 18 | <div class="getpaid-invoice-items mb-4 border"> |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - <div class="getpaid-invoice-items-header <?php echo sanitize_html_class( $invoice->get_template() ); ?>"> |
|
| 21 | + <div class="getpaid-invoice-items-header <?php echo sanitize_html_class($invoice->get_template()); ?>"> |
|
| 22 | 22 | <div class="form-row"> |
| 23 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
| 24 | - <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-line-item-col-<?php echo esc_attr( $key ); ?>"> |
|
| 25 | - <?php echo sanitize_text_field( $label ); ?> |
|
| 23 | + <?php foreach ($columns as $key => $label) : ?> |
|
| 24 | + <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-line-item-col-<?php echo esc_attr($key); ?>"> |
|
| 25 | + <?php echo sanitize_text_field($label); ?> |
|
| 26 | 26 | </div> |
| 27 | 27 | <?php endforeach; ?> |
| 28 | 28 | </div> |
@@ -32,20 +32,20 @@ discard block |
||
| 32 | 32 | <?php |
| 33 | 33 | |
| 34 | 34 | // Display the item totals. |
| 35 | - foreach ( $invoice->get_items() as $item ) { |
|
| 36 | - wpinv_get_template( 'invoice/line-item.php', compact( 'invoice', 'item', 'columns' ) ); |
|
| 35 | + foreach ($invoice->get_items() as $item) { |
|
| 36 | + wpinv_get_template('invoice/line-item.php', compact('invoice', 'item', 'columns')); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Display the fee totals. |
| 40 | - foreach ( $invoice->get_fees() as $fee ) { |
|
| 41 | - wpinv_get_template( 'invoice/fee-item.php', compact( 'invoice', 'fee', 'columns' ) ); |
|
| 40 | + foreach ($invoice->get_fees() as $fee) { |
|
| 41 | + wpinv_get_template('invoice/fee-item.php', compact('invoice', 'fee', 'columns')); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Display the cart totals. |
| 45 | - wpinv_get_template( 'invoice/line-totals.php', compact( 'invoice' ) ); |
|
| 45 | + wpinv_get_template('invoice/line-totals.php', compact('invoice')); |
|
| 46 | 46 | |
| 47 | 47 | ?> |
| 48 | 48 | |
| 49 | 49 | </div> |
| 50 | 50 | |
| 51 | -<?php do_action( 'getpaid_invoice_after_line_items', $invoice ); ?> |
|
| 51 | +<?php do_action('getpaid_invoice_after_line_items', $invoice); ?> |
|
@@ -7,52 +7,52 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -do_action( 'getpaid_before_invoice_line_item', $invoice, $item ); |
|
| 12 | +do_action('getpaid_before_invoice_line_item', $invoice, $item); |
|
| 13 | 13 | |
| 14 | 14 | ?> |
| 15 | 15 | |
| 16 | -<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo sanitize_html_class( $item->get_type() ); ?> border-bottom'> |
|
| 16 | +<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo sanitize_html_class($item->get_type()); ?> border-bottom'> |
|
| 17 | 17 | |
| 18 | 18 | <div class="form-row"> |
| 19 | 19 | |
| 20 | - <?php foreach ( array_keys( $columns ) as $column ): ?> |
|
| 20 | + <?php foreach (array_keys($columns) as $column): ?> |
|
| 21 | 21 | |
| 22 | - <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-item-<?php echo sanitize_html_class( $column ); ?>"> |
|
| 22 | + <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-item-<?php echo sanitize_html_class($column); ?>"> |
|
| 23 | 23 | |
| 24 | 24 | <?php |
| 25 | 25 | |
| 26 | 26 | // Fires before printing a line item column. |
| 27 | - do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice ); |
|
| 27 | + do_action("getpaid_invoice_line_item_before_$column", $item, $invoice); |
|
| 28 | 28 | |
| 29 | 29 | // Item name. |
| 30 | - if ( 'name' == $column ) { |
|
| 30 | + if ('name' == $column) { |
|
| 31 | 31 | |
| 32 | 32 | // Display the name. |
| 33 | - echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>'; |
|
| 33 | + echo '<div class="mb-1">' . sanitize_text_field($item->get_name()) . '</div>'; |
|
| 34 | 34 | |
| 35 | 35 | // And an optional description. |
| 36 | 36 | $description = $item->get_description(); |
| 37 | 37 | |
| 38 | - if ( ! empty( $description ) ) { |
|
| 39 | - $description = wp_kses_post( $description ); |
|
| 38 | + if (!empty($description)) { |
|
| 39 | + $description = wp_kses_post($description); |
|
| 40 | 40 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice ); |
|
| 43 | + $actions = apply_filters('getpaid-invoice-page-line-item-actions', array(), $item, $invoice); |
|
| 44 | 44 | |
| 45 | - if ( ! empty( $actions ) ) { |
|
| 45 | + if (!empty($actions)) { |
|
| 46 | 46 | |
| 47 | - $sanitized = array(); |
|
| 48 | - foreach ( $actions as $key => $action ) { |
|
| 49 | - $key = sanitize_html_class( $key ); |
|
| 50 | - $action = wp_kses_post( $action ); |
|
| 47 | + $sanitized = array(); |
|
| 48 | + foreach ($actions as $key => $action) { |
|
| 49 | + $key = sanitize_html_class($key); |
|
| 50 | + $action = wp_kses_post($action); |
|
| 51 | 51 | $sanitized[] = "<span class='$key'>$action</span>"; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | echo "<small class='form-text getpaid-line-item-actions'>"; |
| 55 | - echo implode( ' | ', $sanitized ); |
|
| 55 | + echo implode(' | ', $sanitized); |
|
| 56 | 56 | echo '</small>'; |
| 57 | 57 | |
| 58 | 58 | } |
@@ -60,32 +60,32 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Item price. |
| 63 | - if ( 'price' == $column ) { |
|
| 63 | + if ('price' == $column) { |
|
| 64 | 64 | |
| 65 | 65 | // Display the item price (or recurring price if this is a renewal invoice) |
| 66 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
| 67 | - echo wpinv_price( wpinv_format_amount( $item->get_price() ), $invoice->get_currency() ); |
|
| 66 | + if ($invoice->is_recurring() && $invoice->is_renewal()) { |
|
| 67 | + echo wpinv_price(wpinv_format_amount($item->get_price()), $invoice->get_currency()); |
|
| 68 | 68 | } else { |
| 69 | - echo wpinv_price( wpinv_format_amount( $item->get_initial_price() ), $invoice->get_currency() ); |
|
| 69 | + echo wpinv_price(wpinv_format_amount($item->get_initial_price()), $invoice->get_currency()); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Item quantity. |
| 75 | - if ( 'quantity' == $column ) { |
|
| 75 | + if ('quantity' == $column) { |
|
| 76 | 76 | echo (int) $item->get_qantity(); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // Item sub total. |
| 80 | - if ( 'subtotal' == $column ) { |
|
| 81 | - echo wpinv_price( wpinv_format_amount( $item->get_sub_total() ), $invoice->get_currency() ); |
|
| 80 | + if ('subtotal' == $column) { |
|
| 81 | + echo wpinv_price(wpinv_format_amount($item->get_sub_total()), $invoice->get_currency()); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Fires when printing a line item column. |
| 85 | - do_action( "getpaid_invoice_line_item_$column", $item, $invoice ); |
|
| 85 | + do_action("getpaid_invoice_line_item_$column", $item, $invoice); |
|
| 86 | 86 | |
| 87 | 87 | // Fires after printing a line item column. |
| 88 | - do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice ); |
|
| 88 | + do_action("getpaid_invoice_line_item_after_$column", $item, $invoice); |
|
| 89 | 89 | |
| 90 | 90 | ?> |
| 91 | 91 | |