@@ -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,10 +17,10 @@ discard block |
||
| 17 | 17 | class GetPaid_Meta_Box_Payment_Form_Info { |
| 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 | 25 | |
| 26 | 26 | // Prepare the form. |
@@ -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,10 +17,10 @@ discard block |
||
| 17 | 17 | class GetPaid_Meta_Box_Invoice_Items { |
| 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 | 25 | |
| 26 | 26 | // Prepare the invoice. |
@@ -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,10 +17,10 @@ discard block |
||
| 17 | 17 | class GetPaid_Meta_Box_Invoice_Payment_Meta { |
| 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 | 25 | |
| 26 | 26 | // Prepare the invoice. |
@@ -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,10 +17,10 @@ discard block |
||
| 17 | 17 | class GetPaid_Meta_Box_Invoice_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 | 25 | |
| 26 | 26 | // Prepare the invoice. |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
| 161 | 161 | |
| 162 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 163 | - return 'manage_options'; |
|
| 164 | - }; |
|
| 162 | + if ( current_user_can( 'manage_options' ) ) { |
|
| 163 | + return 'manage_options'; |
|
| 164 | + }; |
|
| 165 | 165 | |
| 166 | - return $capalibilty; |
|
| 166 | + return $capalibilty; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | function wpinv_create_user( $email ) { |
| 186 | 186 | |
| 187 | 187 | // Prepare user values. |
| 188 | - $args = array( |
|
| 189 | - 'user_login' => wpinv_generate_user_name( $email ), |
|
| 190 | - 'user_pass' => wp_generate_password(), |
|
| 191 | - 'user_email' => $email, |
|
| 188 | + $args = array( |
|
| 189 | + 'user_login' => wpinv_generate_user_name( $email ), |
|
| 190 | + 'user_pass' => wp_generate_password(), |
|
| 191 | + 'user_email' => $email, |
|
| 192 | 192 | 'role' => 'subscriber', |
| 193 | 193 | ); |
| 194 | 194 | |
@@ -205,20 +205,20 @@ discard block |
||
| 205 | 205 | function wpinv_generate_user_name( $prefix = '' ) { |
| 206 | 206 | |
| 207 | 207 | // If prefix is an email, retrieve the part before the email. |
| 208 | - $prefix = strtok( $prefix, '@' ); |
|
| 208 | + $prefix = strtok( $prefix, '@' ); |
|
| 209 | 209 | |
| 210 | - // Trim to 4 characters max. |
|
| 211 | - $prefix = sanitize_user( $prefix ); |
|
| 210 | + // Trim to 4 characters max. |
|
| 211 | + $prefix = sanitize_user( $prefix ); |
|
| 212 | 212 | |
| 213 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
| 214 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
| 215 | - $prefix = 'gtp'; |
|
| 216 | - } |
|
| 213 | + $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
| 214 | + if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
| 215 | + $prefix = 'gtp'; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | - $username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
| 219 | - if ( username_exists( $username ) ) { |
|
| 220 | - return wpinv_generate_user_name( $username ); |
|
| 221 | - } |
|
| 218 | + $username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
| 219 | + if ( username_exists( $username ) ) { |
|
| 220 | + return wpinv_generate_user_name( $username ); |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | 223 | return $username; |
| 224 | 224 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | - exit; // Exit if accessed directly |
|
| 9 | + exit; // Exit if accessed directly |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /** |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | class GetPaid_Meta_Box_Resend_Invoice { |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | - * Output the metabox. |
|
| 19 | - * |
|
| 20 | - * @param WP_Post $post |
|
| 21 | - */ |
|
| 18 | + * Output the metabox. |
|
| 19 | + * |
|
| 20 | + * @param WP_Post $post |
|
| 21 | + */ |
|
| 22 | 22 | public static function output( $post ) { |
| 23 | 23 | |
| 24 | 24 | // Fetch the invoice. |
@@ -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,10 +17,10 @@ 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 | 25 | |
| 26 | 26 | // Prepare the item. |
@@ -289,35 +289,35 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | - * Save meta box data. |
|
| 293 | - * |
|
| 294 | - * @param int $post_id |
|
| 295 | - */ |
|
| 296 | - public static function save( $post_id ) { |
|
| 292 | + * Save meta box data. |
|
| 293 | + * |
|
| 294 | + * @param int $post_id |
|
| 295 | + */ |
|
| 296 | + public static function save( $post_id ) { |
|
| 297 | 297 | |
| 298 | 298 | // Prepare the item. |
| 299 | 299 | $item = new WPInv_Item( $post_id ); |
| 300 | 300 | |
| 301 | 301 | // Load new data. |
| 302 | 302 | $item->set_props( |
| 303 | - array( |
|
| 304 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
| 305 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
| 306 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
| 307 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
| 308 | - 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
| 303 | + array( |
|
| 304 | + 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
| 305 | + 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
| 306 | + 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
| 307 | + 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
| 308 | + 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
| 309 | 309 | 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null, |
| 310 | - 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
| 311 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
| 312 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
| 313 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
| 314 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
| 315 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
| 316 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
| 317 | - ) |
|
| 310 | + 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
| 311 | + 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
| 312 | + 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
| 313 | + 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
| 314 | + 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
| 315 | + 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
| 316 | + 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
| 317 | + ) |
|
| 318 | 318 | ); |
| 319 | 319 | |
| 320 | - $item->save(); |
|
| 321 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
| 322 | - } |
|
| 320 | + $item->save(); |
|
| 321 | + do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
| 322 | + } |
|
| 323 | 323 | } |
@@ -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,10 +17,10 @@ discard block |
||
| 17 | 17 | class GetPaid_Meta_Box_Invoice_Address { |
| 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 | 25 | |
| 26 | 26 | // Prepare the invoice. |
@@ -300,18 +300,18 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
| 303 | - * Save meta box data. |
|
| 304 | - * |
|
| 305 | - * @param int $post_id |
|
| 306 | - */ |
|
| 307 | - public static function save( $post_id ) { |
|
| 303 | + * Save meta box data. |
|
| 304 | + * |
|
| 305 | + * @param int $post_id |
|
| 306 | + */ |
|
| 307 | + public static function save( $post_id ) { |
|
| 308 | 308 | |
| 309 | 309 | // Prepare the invoice. |
| 310 | 310 | $invoice = new WPInv_Invoice( $post_id ); |
| 311 | 311 | |
| 312 | 312 | // Load new data. |
| 313 | 313 | $invoice->set_props( |
| 314 | - array( |
|
| 314 | + array( |
|
| 315 | 315 | 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
| 316 | 316 | 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
| 317 | 317 | 'disable_taxes' => isset( $_POST['disable_taxes'] ), |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
| 333 | 333 | 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
| 334 | 334 | 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
| 335 | - ) |
|
| 335 | + ) |
|
| 336 | 336 | ); |
| 337 | 337 | |
| 338 | 338 | // Recalculate totals. |
@@ -362,6 +362,6 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | // Fires after an invoice is saved. |
| 365 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
| 366 | - } |
|
| 365 | + do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
| 366 | + } |
|
| 367 | 367 | } |
@@ -45,17 +45,17 @@ |
||
| 45 | 45 | parent::__construct( $options ); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * The Super block output function. |
|
| 50 | - * |
|
| 51 | - * @param array $args |
|
| 52 | - * @param array $widget_args |
|
| 53 | - * @param string $content |
|
| 54 | - * |
|
| 55 | - * @return mixed|string|bool |
|
| 56 | - */ |
|
| 48 | + /** |
|
| 49 | + * The Super block output function. |
|
| 50 | + * |
|
| 51 | + * @param array $args |
|
| 52 | + * @param array $widget_args |
|
| 53 | + * @param string $content |
|
| 54 | + * |
|
| 55 | + * @return mixed|string|bool |
|
| 56 | + */ |
|
| 57 | 57 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 58 | - return wpinv_checkout_form(); |
|
| 58 | + return wpinv_checkout_form(); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | } |