@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | ?> |
| 10 | 10 | |
@@ -12,24 +12,24 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | <form method="post" class="text-center card-body"> |
| 14 | 14 | <div class="gp-wizard-payments"> |
| 15 | - <h2 class="gd-settings-title h3 "><?php esc_html_e( 'Gateway Setup', 'invoicing' ); ?></h2> |
|
| 16 | - <p><?php esc_html_e( 'Below are a few gateways that can be setup in a few seconds.', 'invoicing' ); ?> |
|
| 15 | + <h2 class="gd-settings-title h3 "><?php esc_html_e('Gateway Setup', 'invoicing'); ?></h2> |
|
| 16 | + <p><?php esc_html_e('Below are a few gateways that can be setup in a few seconds.', 'invoicing'); ?> |
|
| 17 | 17 | <br> |
| 18 | - <?php esc_html_e( 'We have 20+ Gateways that can be setup later.', 'invoicing' ); ?> |
|
| 18 | + <?php esc_html_e('We have 20+ Gateways that can be setup later.', 'invoicing'); ?> |
|
| 19 | 19 | </p> |
| 20 | 20 | |
| 21 | 21 | <ul class="list-group"> |
| 22 | 22 | |
| 23 | 23 | <li class="list-group-item d-flex justify-content-between align-items-center"> |
| 24 | - <span class="mr-auto"><img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg' ); ?>" class="ml-n2" alt="Stripe"></span> |
|
| 25 | - <?php if ( false === wpinv_get_option( 'stripe_live_connect_account_id' ) ) : ?> |
|
| 24 | + <span class="mr-auto"><img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg'); ?>" class="ml-n2" alt="Stripe"></span> |
|
| 25 | + <?php if (false === wpinv_get_option('stripe_live_connect_account_id')) : ?> |
|
| 26 | 26 | <a href="<?php |
| 27 | - echo esc_url( wp_nonce_url( |
|
| 27 | + echo esc_url(wp_nonce_url( |
|
| 28 | 28 | add_query_arg( |
| 29 | 29 | array( |
| 30 | 30 | 'getpaid-admin-action' => 'connect_gateway', |
| 31 | 31 | 'plugin' => 'stripe', |
| 32 | - 'redirect' => urlencode( add_query_arg( 'step', 'payments' ) ), |
|
| 32 | + 'redirect' => urlencode(add_query_arg('step', 'payments')), |
|
| 33 | 33 | ), |
| 34 | 34 | admin_url() |
| 35 | 35 | ), |
@@ -37,31 +37,31 @@ discard block |
||
| 37 | 37 | 'getpaid-nonce' |
| 38 | 38 | )); |
| 39 | 39 | ?>" |
| 40 | - class="btn btn-sm btn-outline-primary"><?php esc_html_e( 'Connect', 'invoicing' ); ?></a> |
|
| 40 | + class="btn btn-sm btn-outline-primary"><?php esc_html_e('Connect', 'invoicing'); ?></a> |
|
| 41 | 41 | <?php else : ?> |
| 42 | - <span class="btn btn-sm btn-success"><?php esc_html_e( 'Connected', 'invoicing' ); ?></span> |
|
| 42 | + <span class="btn btn-sm btn-success"><?php esc_html_e('Connected', 'invoicing'); ?></span> |
|
| 43 | 43 | <?php endif; ?> |
| 44 | 44 | </li> |
| 45 | 45 | |
| 46 | 46 | <li class="list-group-item"> |
| 47 | 47 | <div class="d-flex justify-content-between align-items-center"> |
| 48 | 48 | <span class="mr-auto"> |
| 49 | - <img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp' ); ?>" class="" alt="PayPal" height="25"> |
|
| 49 | + <img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp'); ?>" class="" alt="PayPal" height="25"> |
|
| 50 | 50 | </span> |
| 51 | 51 | <a |
| 52 | 52 | href="#" |
| 53 | 53 | onclick="jQuery('.getpaid-setup-paypal-input').toggleClass('d-none'); return false;" |
| 54 | - class="getpaid-setup-paypal btn btn-sm btn-outline-primary"><?php esc_html_e( 'Set-up', 'invoicing' ); ?></a> |
|
| 54 | + class="getpaid-setup-paypal btn btn-sm btn-outline-primary"><?php esc_html_e('Set-up', 'invoicing'); ?></a> |
|
| 55 | 55 | </div> |
| 56 | 56 | <div class="mt-4 getpaid-setup-paypal-input d-none"> |
| 57 | - <input type="text" placeholder="<?php esc_attr_e( 'PayPal Email', 'invoicing' ); ?>" name="paypal-email" class="form-control" value="<?php echo esc_attr( wpinv_get_option( 'paypal_email' ) ); ?>"> |
|
| 57 | + <input type="text" placeholder="<?php esc_attr_e('PayPal Email', 'invoicing'); ?>" name="paypal-email" class="form-control" value="<?php echo esc_attr(wpinv_get_option('paypal_email')); ?>"> |
|
| 58 | 58 | </div> |
| 59 | 59 | </li> |
| 60 | 60 | |
| 61 | 61 | <li class="list-group-item d-flex justify-content-between align-items-center"> |
| 62 | - <span class="mr-auto"><?php esc_html_e( 'Test Gateway', 'invoicing' ); ?></span> |
|
| 62 | + <span class="mr-auto"><?php esc_html_e('Test Gateway', 'invoicing'); ?></span> |
|
| 63 | 63 | <div class="custom-control custom-switch"> |
| 64 | - <input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked( wpinv_is_gateway_active( 'manual' ) ); ?>> |
|
| 64 | + <input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked(wpinv_is_gateway_active('manual')); ?>> |
|
| 65 | 65 | <label class="custom-control-label" for="enable-manual-gateway"></label> |
| 66 | 66 | </div> |
| 67 | 67 | </li> |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | </div> |
| 71 | 71 | |
| 72 | 72 | <p class="gp-setup-actions step text-center mt-4"> |
| 73 | - <input type="submit" class="btn btn-primary" value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" /> |
|
| 73 | + <input type="submit" class="btn btn-primary" value="<?php esc_attr_e('Continue', 'invoicing'); ?>" /> |
|
| 74 | 74 | </p> |
| 75 | 75 | |
| 76 | - <?php getpaid_hidden_field( 'save_step', 1 ); ?> |
|
| 77 | - <?php wp_nonce_field( 'getpaid-setup-wizard', 'getpaid-setup-wizard' ); ?> |
|
| 76 | + <?php getpaid_hidden_field('save_step', 1); ?> |
|
| 77 | + <?php wp_nonce_field('getpaid-setup-wizard', 'getpaid-setup-wizard'); ?> |
|
| 78 | 78 | </form> |
| 79 | 79 | </div> |
@@ -38,8 +38,11 @@ |
||
| 38 | 38 | )); |
| 39 | 39 | ?>" |
| 40 | 40 | class="btn btn-sm btn-outline-primary"><?php esc_html_e( 'Connect', 'invoicing' ); ?></a> |
| 41 | - <?php else : ?> |
|
| 42 | - <span class="btn btn-sm btn-success"><?php esc_html_e( 'Connected', 'invoicing' ); ?></span> |
|
| 41 | + <?php else { |
|
| 42 | + : ?> |
|
| 43 | + <span class="btn btn-sm btn-success"><?php esc_html_e( 'Connected', 'invoicing' ); |
|
| 44 | +} |
|
| 45 | +?></span> |
|
| 43 | 46 | <?php endif; ?> |
| 44 | 47 | </li> |
| 45 | 48 | |
@@ -1,32 +1,32 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - // Is the request set up correctly? |
|
| 4 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 5 | - return aui()->alert( |
|
| 6 | - array( |
|
| 7 | - 'type' => 'warning', |
|
| 8 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
| 9 | - ) |
|
| 10 | - ); |
|
| 11 | - wp_die( esc_html__( 'No payment form or item selected', 'invoicing' ), 400 ); |
|
| 12 | - } |
|
| 13 | - |
|
| 14 | - // Payment form or button? |
|
| 15 | - if ( ! empty( $_GET['form'] ) ) { |
|
| 16 | - |
|
| 17 | - $shortcode = sprintf( |
|
| 18 | - '[getpaid form=%s]', |
|
| 19 | - (int) $_GET['form'] |
|
| 20 | - ); |
|
| 21 | - |
|
| 22 | - } else { |
|
| 23 | - |
|
| 24 | - $shortcode = sprintf( |
|
| 25 | - '[getpaid item=%s]', |
|
| 26 | - esc_attr( urldecode( $_GET['item'] ) ) |
|
| 27 | - ); |
|
| 28 | - |
|
| 29 | - } |
|
| 3 | + // Is the request set up correctly? |
|
| 4 | + if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 5 | + return aui()->alert( |
|
| 6 | + array( |
|
| 7 | + 'type' => 'warning', |
|
| 8 | + 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
| 9 | + ) |
|
| 10 | + ); |
|
| 11 | + wp_die( esc_html__( 'No payment form or item selected', 'invoicing' ), 400 ); |
|
| 12 | + } |
|
| 13 | + |
|
| 14 | + // Payment form or button? |
|
| 15 | + if ( ! empty( $_GET['form'] ) ) { |
|
| 16 | + |
|
| 17 | + $shortcode = sprintf( |
|
| 18 | + '[getpaid form=%s]', |
|
| 19 | + (int) $_GET['form'] |
|
| 20 | + ); |
|
| 21 | + |
|
| 22 | + } else { |
|
| 23 | + |
|
| 24 | + $shortcode = sprintf( |
|
| 25 | + '[getpaid item=%s]', |
|
| 26 | + esc_attr( urldecode( $_GET['item'] ) ) |
|
| 27 | + ); |
|
| 28 | + |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | ?> |
| 32 | 32 | |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | <title><?php echo esc_html( get_bloginfo( 'name' ) ); ?></title> |
| 46 | 46 | <?php |
| 47 | - wp_enqueue_scripts(); |
|
| 48 | - wp_print_styles(); |
|
| 49 | - wp_print_head_scripts(); |
|
| 50 | - wp_custom_css_cb(); |
|
| 51 | - wpinv_get_template( 'frontend-head.php' ); |
|
| 52 | - wp_site_icon(); |
|
| 53 | - ?> |
|
| 47 | + wp_enqueue_scripts(); |
|
| 48 | + wp_print_styles(); |
|
| 49 | + wp_print_head_scripts(); |
|
| 50 | + wp_custom_css_cb(); |
|
| 51 | + wpinv_get_template( 'frontend-head.php' ); |
|
| 52 | + wp_site_icon(); |
|
| 53 | + ?> |
|
| 54 | 54 | |
| 55 | 55 | <style type="text/css"> |
| 56 | 56 | .body{ |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | <body class="body page-template-default page"> |
| 85 | 85 | <div id="getpaid-form-embed" class="container my-5 page type-page status-publish hentry post post-content"> |
| 86 | 86 | <?php |
| 87 | - do_action( 'getpaid_payment_form_embed_top' ); |
|
| 88 | - echo do_shortcode( $shortcode ); |
|
| 89 | - do_action( 'getpaid_payment_form_embed_bottom' ); |
|
| 90 | - wpinv_get_template( 'frontend-footer.php' ); |
|
| 91 | - ?> |
|
| 87 | + do_action( 'getpaid_payment_form_embed_top' ); |
|
| 88 | + echo do_shortcode( $shortcode ); |
|
| 89 | + do_action( 'getpaid_payment_form_embed_bottom' ); |
|
| 90 | + wpinv_get_template( 'frontend-footer.php' ); |
|
| 91 | + ?> |
|
| 92 | 92 | </div> |
| 93 | 93 | <?php wp_footer(); ?> |
| 94 | 94 | </body> |
@@ -1,18 +1,18 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Is the request set up correctly? |
| 4 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 4 | + if (empty($_GET['form']) && empty($_GET['item'])) { |
|
| 5 | 5 | return aui()->alert( |
| 6 | 6 | array( |
| 7 | 7 | 'type' => 'warning', |
| 8 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
| 8 | + 'content' => __('No payment form or item selected', 'invoicing'), |
|
| 9 | 9 | ) |
| 10 | 10 | ); |
| 11 | - wp_die( esc_html__( 'No payment form or item selected', 'invoicing' ), 400 ); |
|
| 11 | + wp_die(esc_html__('No payment form or item selected', 'invoicing'), 400); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // Payment form or button? |
| 15 | - if ( ! empty( $_GET['form'] ) ) { |
|
| 15 | + if (!empty($_GET['form'])) { |
|
| 16 | 16 | |
| 17 | 17 | $shortcode = sprintf( |
| 18 | 18 | '[getpaid form=%s]', |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $shortcode = sprintf( |
| 25 | 25 | '[getpaid item=%s]', |
| 26 | - esc_attr( urldecode( $_GET['item'] ) ) |
|
| 26 | + esc_attr(urldecode($_GET['item'])) |
|
| 27 | 27 | ); |
| 28 | 28 | |
| 29 | 29 | } |
@@ -35,20 +35,20 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | <head> |
| 37 | 37 | |
| 38 | - <meta charset="<?php bloginfo( 'charset' ); ?>"> |
|
| 38 | + <meta charset="<?php bloginfo('charset'); ?>"> |
|
| 39 | 39 | <meta name="viewport" content="width=device-width, initial-scale=1.0" > |
| 40 | 40 | |
| 41 | 41 | <meta name="robots" content="noindex,nofollow"> |
| 42 | 42 | |
| 43 | 43 | <link rel="profile" href="https://gmpg.org/xfn/11"> |
| 44 | 44 | |
| 45 | - <title><?php echo esc_html( get_bloginfo( 'name' ) ); ?></title> |
|
| 45 | + <title><?php echo esc_html(get_bloginfo('name')); ?></title> |
|
| 46 | 46 | <?php |
| 47 | 47 | wp_enqueue_scripts(); |
| 48 | 48 | wp_print_styles(); |
| 49 | 49 | wp_print_head_scripts(); |
| 50 | 50 | wp_custom_css_cb(); |
| 51 | - wpinv_get_template( 'frontend-head.php' ); |
|
| 51 | + wpinv_get_template('frontend-head.php'); |
|
| 52 | 52 | wp_site_icon(); |
| 53 | 53 | ?> |
| 54 | 54 | |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | <body class="body page-template-default page"> |
| 85 | 85 | <div id="getpaid-form-embed" class="container my-5 page type-page status-publish hentry post post-content"> |
| 86 | 86 | <?php |
| 87 | - do_action( 'getpaid_payment_form_embed_top' ); |
|
| 88 | - echo do_shortcode( $shortcode ); |
|
| 89 | - do_action( 'getpaid_payment_form_embed_bottom' ); |
|
| 90 | - wpinv_get_template( 'frontend-footer.php' ); |
|
| 87 | + do_action('getpaid_payment_form_embed_top'); |
|
| 88 | + echo do_shortcode($shortcode); |
|
| 89 | + do_action('getpaid_payment_form_embed_bottom'); |
|
| 90 | + wpinv_get_template('frontend-footer.php'); |
|
| 91 | 91 | ?> |
| 92 | 92 | </div> |
| 93 | 93 | <?php wp_footer(); ?> |
@@ -1,34 +1,34 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | - // Is the request set up correctly? |
|
| 4 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 5 | - return aui()->alert( |
|
| 6 | - array( |
|
| 7 | - 'type' => 'warning', |
|
| 8 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
| 9 | - ) |
|
| 10 | - ); |
|
| 11 | - wp_die( esc_html__( 'No payment form or item selected', 'invoicing' ), 400 ); |
|
| 12 | - } |
|
| 3 | + // Is the request set up correctly? |
|
| 4 | + if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 5 | + return aui()->alert( |
|
| 6 | + array( |
|
| 7 | + 'type' => 'warning', |
|
| 8 | + 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
| 9 | + ) |
|
| 10 | + ); |
|
| 11 | + wp_die( esc_html__( 'No payment form or item selected', 'invoicing' ), 400 ); |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - // Payment form or button? |
|
| 15 | - if ( ! empty( $_GET['form'] ) ) { |
|
| 14 | + // Payment form or button? |
|
| 15 | + if ( ! empty( $_GET['form'] ) ) { |
|
| 16 | 16 | |
| 17 | - $shortcode = sprintf( |
|
| 18 | - '[getpaid form=%s]', |
|
| 19 | - (int) $_GET['form'] |
|
| 20 | - ); |
|
| 17 | + $shortcode = sprintf( |
|
| 18 | + '[getpaid form=%s]', |
|
| 19 | + (int) $_GET['form'] |
|
| 20 | + ); |
|
| 21 | 21 | |
| 22 | - } else { |
|
| 22 | + } else { |
|
| 23 | 23 | |
| 24 | - $shortcode = sprintf( |
|
| 25 | - '[getpaid item=%s]', |
|
| 26 | - esc_attr( urldecode( $_GET['item'] ) ) |
|
| 27 | - ); |
|
| 24 | + $shortcode = sprintf( |
|
| 25 | + '[getpaid item=%s]', |
|
| 26 | + esc_attr( urldecode( $_GET['item'] ) ) |
|
| 27 | + ); |
|
| 28 | 28 | |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | -?> |
|
| 31 | + ?> |
|
| 32 | 32 | |
| 33 | 33 | <!DOCTYPE html> |
| 34 | 34 | <html <?php language_attributes(); ?> class="bsui"> |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | <title><?php echo esc_html( get_bloginfo( 'name' ) ); ?></title> |
| 46 | 46 | <?php |
| 47 | - wp_enqueue_scripts(); |
|
| 48 | - wp_print_styles(); |
|
| 49 | - wp_print_head_scripts(); |
|
| 50 | - wp_custom_css_cb(); |
|
| 51 | - wpinv_get_template( 'frontend-head.php' ); |
|
| 52 | - wp_site_icon(); |
|
| 53 | - ?> |
|
| 47 | + wp_enqueue_scripts(); |
|
| 48 | + wp_print_styles(); |
|
| 49 | + wp_print_head_scripts(); |
|
| 50 | + wp_custom_css_cb(); |
|
| 51 | + wpinv_get_template( 'frontend-head.php' ); |
|
| 52 | + wp_site_icon(); |
|
| 53 | + ?> |
|
| 54 | 54 | |
| 55 | 55 | <style type="text/css"> |
| 56 | 56 | .body{ |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | <body class="body page-template-default page"> |
| 78 | 78 | <div id="getpaid-form-embed" class="container my-5 page type-page status-publish hentry post post-content"> |
| 79 | 79 | <?php |
| 80 | - do_action( 'getpaid_payment_form_embed_top' ); |
|
| 81 | - echo do_shortcode( $shortcode ); |
|
| 82 | - do_action( 'getpaid_payment_form_embed_bottom' ); |
|
| 83 | - wpinv_get_template( 'frontend-footer.php' ); |
|
| 84 | - ?> |
|
| 85 | - </div> |
|
| 80 | + do_action( 'getpaid_payment_form_embed_top' ); |
|
| 81 | + echo do_shortcode( $shortcode ); |
|
| 82 | + do_action( 'getpaid_payment_form_embed_bottom' ); |
|
| 83 | + wpinv_get_template( 'frontend-footer.php' ); |
|
| 84 | + ?> |
|
| 85 | + </div> |
|
| 86 | 86 | <?php wp_footer(); ?> |
| 87 | 87 | </body> |
| 88 | 88 | |
@@ -13,311 +13,311 @@ |
||
| 13 | 13 | class GetPaid_Subscription_Notification_Emails { |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * The array of subscription email actions. |
|
| 17 | - * |
|
| 18 | - * @param array |
|
| 19 | - */ |
|
| 20 | - public $subscription_actions; |
|
| 16 | + * The array of subscription email actions. |
|
| 17 | + * |
|
| 18 | + * @param array |
|
| 19 | + */ |
|
| 20 | + public $subscription_actions; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * Class constructor |
|
| 23 | + * Class constructor |
|
| 24 | 24 | * |
| 25 | - */ |
|
| 26 | - public function __construct() { |
|
| 27 | - |
|
| 28 | - $this->subscription_actions = apply_filters( |
|
| 29 | - 'getpaid_notification_email_subscription_triggers', |
|
| 30 | - array( |
|
| 31 | - 'getpaid_subscription_trialling' => 'subscription_trial', |
|
| 32 | - 'getpaid_subscription_cancelled' => 'subscription_cancelled', |
|
| 33 | - 'getpaid_subscription_expired' => 'subscription_expired', |
|
| 34 | - 'getpaid_subscription_completed' => 'subscription_complete', |
|
| 35 | - 'getpaid_daily_maintenance' => 'renewal_reminder', |
|
| 36 | - ) |
|
| 37 | - ); |
|
| 38 | - |
|
| 39 | - $this->init_hooks(); |
|
| 25 | + */ |
|
| 26 | + public function __construct() { |
|
| 27 | + |
|
| 28 | + $this->subscription_actions = apply_filters( |
|
| 29 | + 'getpaid_notification_email_subscription_triggers', |
|
| 30 | + array( |
|
| 31 | + 'getpaid_subscription_trialling' => 'subscription_trial', |
|
| 32 | + 'getpaid_subscription_cancelled' => 'subscription_cancelled', |
|
| 33 | + 'getpaid_subscription_expired' => 'subscription_expired', |
|
| 34 | + 'getpaid_subscription_completed' => 'subscription_complete', |
|
| 35 | + 'getpaid_daily_maintenance' => 'renewal_reminder', |
|
| 36 | + ) |
|
| 37 | + ); |
|
| 38 | + |
|
| 39 | + $this->init_hooks(); |
|
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * Registers email hooks. |
|
| 45 | - */ |
|
| 46 | - public function init_hooks() { |
|
| 47 | - |
|
| 48 | - add_filter( 'getpaid_get_email_merge_tags', array( $this, 'subscription_merge_tags' ), 10, 2 ); |
|
| 49 | - foreach ( $this->subscription_actions as $hook => $email_type ) { |
|
| 50 | - |
|
| 51 | - $email = new GetPaid_Notification_Email( $email_type ); |
|
| 52 | - |
|
| 53 | - if ( ! $email->is_active() ) { |
|
| 54 | - continue; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - if ( method_exists( $this, $email_type ) ) { |
|
| 58 | - add_action( $hook, array( $this, $email_type ), 100, 2 ); |
|
| 59 | - continue; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - do_action( 'getpaid_subscription_notification_email_register_hook', $email_type, $hook ); |
|
| 63 | - |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Filters subscription merge tags. |
|
| 70 | - * |
|
| 71 | - * @param array $merge_tags |
|
| 72 | - * @param mixed|WPInv_Invoice|WPInv_Subscription $object |
|
| 73 | - */ |
|
| 74 | - public function subscription_merge_tags( $merge_tags, $object ) { |
|
| 75 | - |
|
| 76 | - if ( is_a( $object, 'WPInv_Subscription' ) ) { |
|
| 77 | - $merge_tags = array_merge( |
|
| 78 | - $merge_tags, |
|
| 79 | - $this->get_subscription_merge_tags( $object ) |
|
| 80 | - ); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - return $merge_tags; |
|
| 84 | - |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Generates subscription merge tags. |
|
| 89 | - * |
|
| 90 | - * @param WPInv_Subscription $subscription |
|
| 91 | - * @return array |
|
| 92 | - */ |
|
| 93 | - public function get_subscription_merge_tags( $subscription ) { |
|
| 94 | - |
|
| 95 | - // Abort if it does not exist. |
|
| 96 | - if ( ! $subscription->get_id() ) { |
|
| 97 | - return array(); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $invoice = $subscription->get_parent_invoice(); |
|
| 101 | - return array( |
|
| 102 | - '{subscription_renewal_date}' => getpaid_format_date_value( $subscription->get_next_renewal_date(), __( 'Never', 'invoicing' ) ), |
|
| 103 | - '{subscription_created}' => getpaid_format_date_value( $subscription->get_date_created() ), |
|
| 104 | - '{subscription_status}' => sanitize_text_field( $subscription->get_status_label() ), |
|
| 105 | - '{subscription_profile_id}' => sanitize_text_field( $subscription->get_profile_id() ), |
|
| 106 | - '{subscription_id}' => absint( $subscription->get_id() ), |
|
| 107 | - '{subscription_recurring_amount}' => sanitize_text_field( wpinv_price( $subscription->get_recurring_amount(), $invoice->get_currency() ) ), |
|
| 108 | - '{subscription_initial_amount}' => sanitize_text_field( wpinv_price( $subscription->get_initial_amount(), $invoice->get_currency() ) ), |
|
| 109 | - '{subscription_recurring_period}' => getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ), |
|
| 110 | - '{subscription_bill_times}' => $subscription->get_bill_times(), |
|
| 111 | - '{subscription_url}' => esc_url( $subscription->get_view_url() ), |
|
| 112 | - ); |
|
| 113 | - |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * Checks if we should send a notification for a subscription. |
|
| 118 | - * |
|
| 119 | - * @param WPInv_Invoice $invoice |
|
| 120 | - * @return bool |
|
| 121 | - */ |
|
| 122 | - public function should_send_notification( $invoice ) { |
|
| 123 | - return 0 != $invoice->get_id(); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Returns notification recipients. |
|
| 128 | - * |
|
| 129 | - * @param WPInv_Invoice $invoice |
|
| 130 | - * @return array |
|
| 131 | - */ |
|
| 132 | - public function get_recipients( $invoice ) { |
|
| 133 | - $recipients = array( $invoice->get_email() ); |
|
| 134 | - |
|
| 135 | - $cc = $invoice->get_email_cc(); |
|
| 136 | - |
|
| 137 | - if ( ! empty( $cc ) ) { |
|
| 138 | - $cc = array_map( 'sanitize_email', wpinv_parse_list( $cc ) ); |
|
| 139 | - $recipients = array_filter( array_unique( array_merge( $recipients, $cc ) ) ); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - return $recipients; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Helper function to send an email. |
|
| 147 | - * |
|
| 148 | - * @param WPInv_Subscription $subscription |
|
| 149 | - * @param GetPaid_Notification_Email $email |
|
| 150 | - * @param string $type |
|
| 151 | - * @param array $extra_args Extra template args. |
|
| 152 | - */ |
|
| 153 | - public function send_email( $subscription, $email, $type, $extra_args = array() ) { |
|
| 154 | - |
|
| 155 | - if ( empty( $subscription ) ) { |
|
| 156 | - return; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - if ( is_array( $subscription ) ) { |
|
| 160 | - $subscription = current( $subscription ); |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - if ( ! $subscription instanceof WPInv_Subscription ) { |
|
| 164 | - return; |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - // Abort in case the parent invoice does not exist. |
|
| 168 | - $invoice = $subscription->get_parent_invoice(); |
|
| 169 | - if ( ! $this->should_send_notification( $invoice ) ) { |
|
| 170 | - return; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - if ( apply_filters( 'getpaid_skip_subscription_email', false, $type, $subscription ) ) { |
|
| 174 | - return; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - do_action( 'getpaid_before_send_subscription_notification', $type, $subscription, $email ); |
|
| 178 | - |
|
| 179 | - $recipients = $this->get_recipients( $invoice ); |
|
| 180 | - $mailer = new GetPaid_Notification_Email_Sender(); |
|
| 181 | - $merge_tags = $email->get_merge_tags(); |
|
| 182 | - $content = $email->get_content( $merge_tags, $extra_args ); |
|
| 183 | - $subject = $email->add_merge_tags( $email->get_subject(), $merge_tags ); |
|
| 184 | - $attachments = $email->get_attachments(); |
|
| 185 | - |
|
| 186 | - $result = $mailer->send( |
|
| 187 | - apply_filters( 'getpaid_subscription_email_recipients', wpinv_parse_list( $recipients ), $email ), |
|
| 188 | - $subject, |
|
| 189 | - $content, |
|
| 190 | - $attachments |
|
| 191 | - ); |
|
| 192 | - |
|
| 193 | - // Maybe send a copy to the admin. |
|
| 194 | - if ( $email->include_admin_bcc() ) { |
|
| 195 | - $mailer->send( |
|
| 196 | - wpinv_get_admin_email(), |
|
| 197 | - $subject . __( ' - ADMIN BCC COPY', 'invoicing' ), |
|
| 198 | - $content, |
|
| 199 | - $attachments |
|
| 200 | - ); |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - if ( $result ) { |
|
| 204 | - $invoice->add_system_note( |
|
| 205 | - sprintf( |
|
| 206 | - __( 'Successfully sent %1$s notification email to %2$s.', 'invoicing' ), |
|
| 207 | - sanitize_key( $type ), |
|
| 208 | - $email->is_admin_email() ? __( 'admin' ) : __( 'the customer' ) |
|
| 209 | - ) |
|
| 210 | - ); |
|
| 211 | - } else { |
|
| 212 | - $invoice->add_system_note( |
|
| 213 | - sprintf( |
|
| 214 | - __( 'Failed sending %1$s notification email to %2$s.', 'invoicing' ), |
|
| 215 | - sanitize_key( $type ), |
|
| 216 | - $email->is_admin_email() ? __( 'admin' ) : __( 'the customer' ) |
|
| 217 | - ) |
|
| 218 | - ); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - do_action( 'getpaid_after_send_subscription_notification', $type, $subscription, $email ); |
|
| 222 | - |
|
| 223 | - } |
|
| 44 | + * Registers email hooks. |
|
| 45 | + */ |
|
| 46 | + public function init_hooks() { |
|
| 47 | + |
|
| 48 | + add_filter( 'getpaid_get_email_merge_tags', array( $this, 'subscription_merge_tags' ), 10, 2 ); |
|
| 49 | + foreach ( $this->subscription_actions as $hook => $email_type ) { |
|
| 50 | + |
|
| 51 | + $email = new GetPaid_Notification_Email( $email_type ); |
|
| 52 | + |
|
| 53 | + if ( ! $email->is_active() ) { |
|
| 54 | + continue; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + if ( method_exists( $this, $email_type ) ) { |
|
| 58 | + add_action( $hook, array( $this, $email_type ), 100, 2 ); |
|
| 59 | + continue; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + do_action( 'getpaid_subscription_notification_email_register_hook', $email_type, $hook ); |
|
| 63 | + |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + } |
|
| 224 | 67 | |
| 225 | 68 | /** |
| 226 | - * Sends a new trial notification. |
|
| 227 | - * |
|
| 228 | - * @param WPInv_Subscription $subscription |
|
| 229 | - */ |
|
| 230 | - public function subscription_trial( $subscription ) { |
|
| 69 | + * Filters subscription merge tags. |
|
| 70 | + * |
|
| 71 | + * @param array $merge_tags |
|
| 72 | + * @param mixed|WPInv_Invoice|WPInv_Subscription $object |
|
| 73 | + */ |
|
| 74 | + public function subscription_merge_tags( $merge_tags, $object ) { |
|
| 231 | 75 | |
| 232 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 233 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 76 | + if ( is_a( $object, 'WPInv_Subscription' ) ) { |
|
| 77 | + $merge_tags = array_merge( |
|
| 78 | + $merge_tags, |
|
| 79 | + $this->get_subscription_merge_tags( $object ) |
|
| 80 | + ); |
|
| 81 | + } |
|
| 234 | 82 | |
| 235 | - } |
|
| 83 | + return $merge_tags; |
|
| 236 | 84 | |
| 237 | - /** |
|
| 238 | - * Sends a cancelled subscription notification. |
|
| 239 | - * |
|
| 240 | - * @param WPInv_Subscription $subscription |
|
| 241 | - */ |
|
| 242 | - public function subscription_cancelled( $subscription ) { |
|
| 85 | + } |
|
| 243 | 86 | |
| 244 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 245 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 87 | + /** |
|
| 88 | + * Generates subscription merge tags. |
|
| 89 | + * |
|
| 90 | + * @param WPInv_Subscription $subscription |
|
| 91 | + * @return array |
|
| 92 | + */ |
|
| 93 | + public function get_subscription_merge_tags( $subscription ) { |
|
| 94 | + |
|
| 95 | + // Abort if it does not exist. |
|
| 96 | + if ( ! $subscription->get_id() ) { |
|
| 97 | + return array(); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $invoice = $subscription->get_parent_invoice(); |
|
| 101 | + return array( |
|
| 102 | + '{subscription_renewal_date}' => getpaid_format_date_value( $subscription->get_next_renewal_date(), __( 'Never', 'invoicing' ) ), |
|
| 103 | + '{subscription_created}' => getpaid_format_date_value( $subscription->get_date_created() ), |
|
| 104 | + '{subscription_status}' => sanitize_text_field( $subscription->get_status_label() ), |
|
| 105 | + '{subscription_profile_id}' => sanitize_text_field( $subscription->get_profile_id() ), |
|
| 106 | + '{subscription_id}' => absint( $subscription->get_id() ), |
|
| 107 | + '{subscription_recurring_amount}' => sanitize_text_field( wpinv_price( $subscription->get_recurring_amount(), $invoice->get_currency() ) ), |
|
| 108 | + '{subscription_initial_amount}' => sanitize_text_field( wpinv_price( $subscription->get_initial_amount(), $invoice->get_currency() ) ), |
|
| 109 | + '{subscription_recurring_period}' => getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ), |
|
| 110 | + '{subscription_bill_times}' => $subscription->get_bill_times(), |
|
| 111 | + '{subscription_url}' => esc_url( $subscription->get_view_url() ), |
|
| 112 | + ); |
|
| 246 | 113 | |
| 247 | - } |
|
| 114 | + } |
|
| 248 | 115 | |
| 249 | - /** |
|
| 250 | - * Sends a subscription expired notification. |
|
| 251 | - * |
|
| 252 | - * @param WPInv_Subscription $subscription |
|
| 253 | - */ |
|
| 254 | - public function subscription_expired( $subscription ) { |
|
| 116 | + /** |
|
| 117 | + * Checks if we should send a notification for a subscription. |
|
| 118 | + * |
|
| 119 | + * @param WPInv_Invoice $invoice |
|
| 120 | + * @return bool |
|
| 121 | + */ |
|
| 122 | + public function should_send_notification( $invoice ) { |
|
| 123 | + return 0 != $invoice->get_id(); |
|
| 124 | + } |
|
| 255 | 125 | |
| 256 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 257 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 126 | + /** |
|
| 127 | + * Returns notification recipients. |
|
| 128 | + * |
|
| 129 | + * @param WPInv_Invoice $invoice |
|
| 130 | + * @return array |
|
| 131 | + */ |
|
| 132 | + public function get_recipients( $invoice ) { |
|
| 133 | + $recipients = array( $invoice->get_email() ); |
|
| 258 | 134 | |
| 259 | - } |
|
| 135 | + $cc = $invoice->get_email_cc(); |
|
| 260 | 136 | |
| 261 | - /** |
|
| 262 | - * Sends a completed subscription notification. |
|
| 263 | - * |
|
| 264 | - * @param WPInv_Subscription $subscription |
|
| 265 | - */ |
|
| 266 | - public function subscription_complete( $subscription ) { |
|
| 137 | + if ( ! empty( $cc ) ) { |
|
| 138 | + $cc = array_map( 'sanitize_email', wpinv_parse_list( $cc ) ); |
|
| 139 | + $recipients = array_filter( array_unique( array_merge( $recipients, $cc ) ) ); |
|
| 140 | + } |
|
| 267 | 141 | |
| 268 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 269 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 142 | + return $recipients; |
|
| 143 | + } |
|
| 270 | 144 | |
| 271 | - } |
|
| 145 | + /** |
|
| 146 | + * Helper function to send an email. |
|
| 147 | + * |
|
| 148 | + * @param WPInv_Subscription $subscription |
|
| 149 | + * @param GetPaid_Notification_Email $email |
|
| 150 | + * @param string $type |
|
| 151 | + * @param array $extra_args Extra template args. |
|
| 152 | + */ |
|
| 153 | + public function send_email( $subscription, $email, $type, $extra_args = array() ) { |
|
| 154 | + |
|
| 155 | + if ( empty( $subscription ) ) { |
|
| 156 | + return; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + if ( is_array( $subscription ) ) { |
|
| 160 | + $subscription = current( $subscription ); |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + if ( ! $subscription instanceof WPInv_Subscription ) { |
|
| 164 | + return; |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + // Abort in case the parent invoice does not exist. |
|
| 168 | + $invoice = $subscription->get_parent_invoice(); |
|
| 169 | + if ( ! $this->should_send_notification( $invoice ) ) { |
|
| 170 | + return; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + if ( apply_filters( 'getpaid_skip_subscription_email', false, $type, $subscription ) ) { |
|
| 174 | + return; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + do_action( 'getpaid_before_send_subscription_notification', $type, $subscription, $email ); |
|
| 178 | + |
|
| 179 | + $recipients = $this->get_recipients( $invoice ); |
|
| 180 | + $mailer = new GetPaid_Notification_Email_Sender(); |
|
| 181 | + $merge_tags = $email->get_merge_tags(); |
|
| 182 | + $content = $email->get_content( $merge_tags, $extra_args ); |
|
| 183 | + $subject = $email->add_merge_tags( $email->get_subject(), $merge_tags ); |
|
| 184 | + $attachments = $email->get_attachments(); |
|
| 185 | + |
|
| 186 | + $result = $mailer->send( |
|
| 187 | + apply_filters( 'getpaid_subscription_email_recipients', wpinv_parse_list( $recipients ), $email ), |
|
| 188 | + $subject, |
|
| 189 | + $content, |
|
| 190 | + $attachments |
|
| 191 | + ); |
|
| 192 | + |
|
| 193 | + // Maybe send a copy to the admin. |
|
| 194 | + if ( $email->include_admin_bcc() ) { |
|
| 195 | + $mailer->send( |
|
| 196 | + wpinv_get_admin_email(), |
|
| 197 | + $subject . __( ' - ADMIN BCC COPY', 'invoicing' ), |
|
| 198 | + $content, |
|
| 199 | + $attachments |
|
| 200 | + ); |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + if ( $result ) { |
|
| 204 | + $invoice->add_system_note( |
|
| 205 | + sprintf( |
|
| 206 | + __( 'Successfully sent %1$s notification email to %2$s.', 'invoicing' ), |
|
| 207 | + sanitize_key( $type ), |
|
| 208 | + $email->is_admin_email() ? __( 'admin' ) : __( 'the customer' ) |
|
| 209 | + ) |
|
| 210 | + ); |
|
| 211 | + } else { |
|
| 212 | + $invoice->add_system_note( |
|
| 213 | + sprintf( |
|
| 214 | + __( 'Failed sending %1$s notification email to %2$s.', 'invoicing' ), |
|
| 215 | + sanitize_key( $type ), |
|
| 216 | + $email->is_admin_email() ? __( 'admin' ) : __( 'the customer' ) |
|
| 217 | + ) |
|
| 218 | + ); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + do_action( 'getpaid_after_send_subscription_notification', $type, $subscription, $email ); |
|
| 272 | 222 | |
| 273 | - /** |
|
| 274 | - * Sends a subscription renewal reminder notification. |
|
| 275 | - * |
|
| 276 | - */ |
|
| 277 | - public function renewal_reminder() { |
|
| 223 | + } |
|
| 278 | 224 | |
| 279 | - $email = new GetPaid_Notification_Email( __FUNCTION__ ); |
|
| 225 | + /** |
|
| 226 | + * Sends a new trial notification. |
|
| 227 | + * |
|
| 228 | + * @param WPInv_Subscription $subscription |
|
| 229 | + */ |
|
| 230 | + public function subscription_trial( $subscription ) { |
|
| 280 | 231 | |
| 281 | - // Fetch reminder days. |
|
| 282 | - $reminder_days = array_unique( wp_parse_id_list( $email->get_option( 'days' ) ) ); |
|
| 232 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 233 | + $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 283 | 234 | |
| 284 | - // Abort if non is set. |
|
| 285 | - if ( empty( $reminder_days ) ) { |
|
| 286 | - return; |
|
| 287 | - } |
|
| 235 | + } |
|
| 288 | 236 | |
| 289 | - // Fetch matching subscriptions. |
|
| 237 | + /** |
|
| 238 | + * Sends a cancelled subscription notification. |
|
| 239 | + * |
|
| 240 | + * @param WPInv_Subscription $subscription |
|
| 241 | + */ |
|
| 242 | + public function subscription_cancelled( $subscription ) { |
|
| 243 | + |
|
| 244 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 245 | + $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 246 | + |
|
| 247 | + } |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * Sends a subscription expired notification. |
|
| 251 | + * |
|
| 252 | + * @param WPInv_Subscription $subscription |
|
| 253 | + */ |
|
| 254 | + public function subscription_expired( $subscription ) { |
|
| 255 | + |
|
| 256 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 257 | + $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 258 | + |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * Sends a completed subscription notification. |
|
| 263 | + * |
|
| 264 | + * @param WPInv_Subscription $subscription |
|
| 265 | + */ |
|
| 266 | + public function subscription_complete( $subscription ) { |
|
| 267 | + |
|
| 268 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 269 | + $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 270 | + |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + /** |
|
| 274 | + * Sends a subscription renewal reminder notification. |
|
| 275 | + * |
|
| 276 | + */ |
|
| 277 | + public function renewal_reminder() { |
|
| 278 | + |
|
| 279 | + $email = new GetPaid_Notification_Email( __FUNCTION__ ); |
|
| 280 | + |
|
| 281 | + // Fetch reminder days. |
|
| 282 | + $reminder_days = array_unique( wp_parse_id_list( $email->get_option( 'days' ) ) ); |
|
| 283 | + |
|
| 284 | + // Abort if non is set. |
|
| 285 | + if ( empty( $reminder_days ) ) { |
|
| 286 | + return; |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + // Fetch matching subscriptions. |
|
| 290 | 290 | $args = array( |
| 291 | 291 | 'number' => -1, |
| 292 | - 'count_total' => false, |
|
| 293 | - 'status' => 'trialling active', |
|
| 292 | + 'count_total' => false, |
|
| 293 | + 'status' => 'trialling active', |
|
| 294 | 294 | 'date_expires_query' => array( |
| 295 | - 'relation' => 'OR', |
|
| 295 | + 'relation' => 'OR', |
|
| 296 | 296 | ), |
| 297 | - ); |
|
| 297 | + ); |
|
| 298 | 298 | |
| 299 | - foreach ( $reminder_days as $days ) { |
|
| 300 | - $date = date_parse( date( 'Y-m-d', strtotime( "+$days days", current_time( 'timestamp' ) ) ) ); |
|
| 299 | + foreach ( $reminder_days as $days ) { |
|
| 300 | + $date = date_parse( date( 'Y-m-d', strtotime( "+$days days", current_time( 'timestamp' ) ) ) ); |
|
| 301 | 301 | |
| 302 | - $args['date_expires_query'][] = array( |
|
| 303 | - 'year' => $date['year'], |
|
| 304 | - 'month' => $date['month'], |
|
| 305 | - 'day' => $date['day'], |
|
| 306 | - ); |
|
| 302 | + $args['date_expires_query'][] = array( |
|
| 303 | + 'year' => $date['year'], |
|
| 304 | + 'month' => $date['month'], |
|
| 305 | + 'day' => $date['day'], |
|
| 306 | + ); |
|
| 307 | 307 | |
| 308 | - } |
|
| 308 | + } |
|
| 309 | 309 | |
| 310 | - $subscriptions = new GetPaid_Subscriptions_Query( $args ); |
|
| 310 | + $subscriptions = new GetPaid_Subscriptions_Query( $args ); |
|
| 311 | 311 | |
| 312 | 312 | foreach ( $subscriptions->get_results() as $subscription ) { |
| 313 | 313 | |
| 314 | - // Skip packages. |
|
| 315 | - if ( apply_filters( 'getpaid_send_subscription_renewal_reminder_email', true ) ) { |
|
| 316 | - $email->object = $subscription; |
|
| 317 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 318 | - } |
|
| 319 | - } |
|
| 314 | + // Skip packages. |
|
| 315 | + if ( apply_filters( 'getpaid_send_subscription_renewal_reminder_email', true ) ) { |
|
| 316 | + $email->object = $subscription; |
|
| 317 | + $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 318 | + } |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - } |
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | 323 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * This class handles subscription notificaiton emails. |
@@ -45,21 +45,21 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function init_hooks() { |
| 47 | 47 | |
| 48 | - add_filter( 'getpaid_get_email_merge_tags', array( $this, 'subscription_merge_tags' ), 10, 2 ); |
|
| 49 | - foreach ( $this->subscription_actions as $hook => $email_type ) { |
|
| 48 | + add_filter('getpaid_get_email_merge_tags', array($this, 'subscription_merge_tags'), 10, 2); |
|
| 49 | + foreach ($this->subscription_actions as $hook => $email_type) { |
|
| 50 | 50 | |
| 51 | - $email = new GetPaid_Notification_Email( $email_type ); |
|
| 51 | + $email = new GetPaid_Notification_Email($email_type); |
|
| 52 | 52 | |
| 53 | - if ( ! $email->is_active() ) { |
|
| 53 | + if (!$email->is_active()) { |
|
| 54 | 54 | continue; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if ( method_exists( $this, $email_type ) ) { |
|
| 58 | - add_action( $hook, array( $this, $email_type ), 100, 2 ); |
|
| 57 | + if (method_exists($this, $email_type)) { |
|
| 58 | + add_action($hook, array($this, $email_type), 100, 2); |
|
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - do_action( 'getpaid_subscription_notification_email_register_hook', $email_type, $hook ); |
|
| 62 | + do_action('getpaid_subscription_notification_email_register_hook', $email_type, $hook); |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | * @param array $merge_tags |
| 72 | 72 | * @param mixed|WPInv_Invoice|WPInv_Subscription $object |
| 73 | 73 | */ |
| 74 | - public function subscription_merge_tags( $merge_tags, $object ) { |
|
| 74 | + public function subscription_merge_tags($merge_tags, $object) { |
|
| 75 | 75 | |
| 76 | - if ( is_a( $object, 'WPInv_Subscription' ) ) { |
|
| 76 | + if (is_a($object, 'WPInv_Subscription')) { |
|
| 77 | 77 | $merge_tags = array_merge( |
| 78 | 78 | $merge_tags, |
| 79 | - $this->get_subscription_merge_tags( $object ) |
|
| 79 | + $this->get_subscription_merge_tags($object) |
|
| 80 | 80 | ); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -90,25 +90,25 @@ discard block |
||
| 90 | 90 | * @param WPInv_Subscription $subscription |
| 91 | 91 | * @return array |
| 92 | 92 | */ |
| 93 | - public function get_subscription_merge_tags( $subscription ) { |
|
| 93 | + public function get_subscription_merge_tags($subscription) { |
|
| 94 | 94 | |
| 95 | 95 | // Abort if it does not exist. |
| 96 | - if ( ! $subscription->get_id() ) { |
|
| 96 | + if (!$subscription->get_id()) { |
|
| 97 | 97 | return array(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $invoice = $subscription->get_parent_invoice(); |
|
| 100 | + $invoice = $subscription->get_parent_invoice(); |
|
| 101 | 101 | return array( |
| 102 | - '{subscription_renewal_date}' => getpaid_format_date_value( $subscription->get_next_renewal_date(), __( 'Never', 'invoicing' ) ), |
|
| 103 | - '{subscription_created}' => getpaid_format_date_value( $subscription->get_date_created() ), |
|
| 104 | - '{subscription_status}' => sanitize_text_field( $subscription->get_status_label() ), |
|
| 105 | - '{subscription_profile_id}' => sanitize_text_field( $subscription->get_profile_id() ), |
|
| 106 | - '{subscription_id}' => absint( $subscription->get_id() ), |
|
| 107 | - '{subscription_recurring_amount}' => sanitize_text_field( wpinv_price( $subscription->get_recurring_amount(), $invoice->get_currency() ) ), |
|
| 108 | - '{subscription_initial_amount}' => sanitize_text_field( wpinv_price( $subscription->get_initial_amount(), $invoice->get_currency() ) ), |
|
| 109 | - '{subscription_recurring_period}' => getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ), |
|
| 102 | + '{subscription_renewal_date}' => getpaid_format_date_value($subscription->get_next_renewal_date(), __('Never', 'invoicing')), |
|
| 103 | + '{subscription_created}' => getpaid_format_date_value($subscription->get_date_created()), |
|
| 104 | + '{subscription_status}' => sanitize_text_field($subscription->get_status_label()), |
|
| 105 | + '{subscription_profile_id}' => sanitize_text_field($subscription->get_profile_id()), |
|
| 106 | + '{subscription_id}' => absint($subscription->get_id()), |
|
| 107 | + '{subscription_recurring_amount}' => sanitize_text_field(wpinv_price($subscription->get_recurring_amount(), $invoice->get_currency())), |
|
| 108 | + '{subscription_initial_amount}' => sanitize_text_field(wpinv_price($subscription->get_initial_amount(), $invoice->get_currency())), |
|
| 109 | + '{subscription_recurring_period}' => getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), ''), |
|
| 110 | 110 | '{subscription_bill_times}' => $subscription->get_bill_times(), |
| 111 | - '{subscription_url}' => esc_url( $subscription->get_view_url() ), |
|
| 111 | + '{subscription_url}' => esc_url($subscription->get_view_url()), |
|
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | 114 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @param WPInv_Invoice $invoice |
| 120 | 120 | * @return bool |
| 121 | 121 | */ |
| 122 | - public function should_send_notification( $invoice ) { |
|
| 122 | + public function should_send_notification($invoice) { |
|
| 123 | 123 | return 0 != $invoice->get_id(); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | * @param WPInv_Invoice $invoice |
| 130 | 130 | * @return array |
| 131 | 131 | */ |
| 132 | - public function get_recipients( $invoice ) { |
|
| 133 | - $recipients = array( $invoice->get_email() ); |
|
| 132 | + public function get_recipients($invoice) { |
|
| 133 | + $recipients = array($invoice->get_email()); |
|
| 134 | 134 | |
| 135 | 135 | $cc = $invoice->get_email_cc(); |
| 136 | 136 | |
| 137 | - if ( ! empty( $cc ) ) { |
|
| 138 | - $cc = array_map( 'sanitize_email', wpinv_parse_list( $cc ) ); |
|
| 139 | - $recipients = array_filter( array_unique( array_merge( $recipients, $cc ) ) ); |
|
| 137 | + if (!empty($cc)) { |
|
| 138 | + $cc = array_map('sanitize_email', wpinv_parse_list($cc)); |
|
| 139 | + $recipients = array_filter(array_unique(array_merge($recipients, $cc))); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | return $recipients; |
@@ -150,75 +150,75 @@ discard block |
||
| 150 | 150 | * @param string $type |
| 151 | 151 | * @param array $extra_args Extra template args. |
| 152 | 152 | */ |
| 153 | - public function send_email( $subscription, $email, $type, $extra_args = array() ) { |
|
| 153 | + public function send_email($subscription, $email, $type, $extra_args = array()) { |
|
| 154 | 154 | |
| 155 | - if ( empty( $subscription ) ) { |
|
| 155 | + if (empty($subscription)) { |
|
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if ( is_array( $subscription ) ) { |
|
| 160 | - $subscription = current( $subscription ); |
|
| 159 | + if (is_array($subscription)) { |
|
| 160 | + $subscription = current($subscription); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if ( ! $subscription instanceof WPInv_Subscription ) { |
|
| 163 | + if (!$subscription instanceof WPInv_Subscription) { |
|
| 164 | 164 | return; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // Abort in case the parent invoice does not exist. |
| 168 | 168 | $invoice = $subscription->get_parent_invoice(); |
| 169 | - if ( ! $this->should_send_notification( $invoice ) ) { |
|
| 169 | + if (!$this->should_send_notification($invoice)) { |
|
| 170 | 170 | return; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - if ( apply_filters( 'getpaid_skip_subscription_email', false, $type, $subscription ) ) { |
|
| 173 | + if (apply_filters('getpaid_skip_subscription_email', false, $type, $subscription)) { |
|
| 174 | 174 | return; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - do_action( 'getpaid_before_send_subscription_notification', $type, $subscription, $email ); |
|
| 177 | + do_action('getpaid_before_send_subscription_notification', $type, $subscription, $email); |
|
| 178 | 178 | |
| 179 | - $recipients = $this->get_recipients( $invoice ); |
|
| 179 | + $recipients = $this->get_recipients($invoice); |
|
| 180 | 180 | $mailer = new GetPaid_Notification_Email_Sender(); |
| 181 | 181 | $merge_tags = $email->get_merge_tags(); |
| 182 | - $content = $email->get_content( $merge_tags, $extra_args ); |
|
| 183 | - $subject = $email->add_merge_tags( $email->get_subject(), $merge_tags ); |
|
| 182 | + $content = $email->get_content($merge_tags, $extra_args); |
|
| 183 | + $subject = $email->add_merge_tags($email->get_subject(), $merge_tags); |
|
| 184 | 184 | $attachments = $email->get_attachments(); |
| 185 | 185 | |
| 186 | 186 | $result = $mailer->send( |
| 187 | - apply_filters( 'getpaid_subscription_email_recipients', wpinv_parse_list( $recipients ), $email ), |
|
| 187 | + apply_filters('getpaid_subscription_email_recipients', wpinv_parse_list($recipients), $email), |
|
| 188 | 188 | $subject, |
| 189 | 189 | $content, |
| 190 | 190 | $attachments |
| 191 | 191 | ); |
| 192 | 192 | |
| 193 | 193 | // Maybe send a copy to the admin. |
| 194 | - if ( $email->include_admin_bcc() ) { |
|
| 194 | + if ($email->include_admin_bcc()) { |
|
| 195 | 195 | $mailer->send( |
| 196 | 196 | wpinv_get_admin_email(), |
| 197 | - $subject . __( ' - ADMIN BCC COPY', 'invoicing' ), |
|
| 197 | + $subject . __(' - ADMIN BCC COPY', 'invoicing'), |
|
| 198 | 198 | $content, |
| 199 | 199 | $attachments |
| 200 | 200 | ); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - if ( $result ) { |
|
| 203 | + if ($result) { |
|
| 204 | 204 | $invoice->add_system_note( |
| 205 | 205 | sprintf( |
| 206 | - __( 'Successfully sent %1$s notification email to %2$s.', 'invoicing' ), |
|
| 207 | - sanitize_key( $type ), |
|
| 208 | - $email->is_admin_email() ? __( 'admin' ) : __( 'the customer' ) |
|
| 206 | + __('Successfully sent %1$s notification email to %2$s.', 'invoicing'), |
|
| 207 | + sanitize_key($type), |
|
| 208 | + $email->is_admin_email() ? __('admin') : __('the customer') |
|
| 209 | 209 | ) |
| 210 | 210 | ); |
| 211 | 211 | } else { |
| 212 | 212 | $invoice->add_system_note( |
| 213 | 213 | sprintf( |
| 214 | - __( 'Failed sending %1$s notification email to %2$s.', 'invoicing' ), |
|
| 215 | - sanitize_key( $type ), |
|
| 216 | - $email->is_admin_email() ? __( 'admin' ) : __( 'the customer' ) |
|
| 214 | + __('Failed sending %1$s notification email to %2$s.', 'invoicing'), |
|
| 215 | + sanitize_key($type), |
|
| 216 | + $email->is_admin_email() ? __('admin') : __('the customer') |
|
| 217 | 217 | ) |
| 218 | 218 | ); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - do_action( 'getpaid_after_send_subscription_notification', $type, $subscription, $email ); |
|
| 221 | + do_action('getpaid_after_send_subscription_notification', $type, $subscription, $email); |
|
| 222 | 222 | |
| 223 | 223 | } |
| 224 | 224 | |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | * @param WPInv_Subscription $subscription |
| 229 | 229 | */ |
| 230 | - public function subscription_trial( $subscription ) { |
|
| 230 | + public function subscription_trial($subscription) { |
|
| 231 | 231 | |
| 232 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 233 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 232 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $subscription); |
|
| 233 | + $this->send_email($subscription, $email, __FUNCTION__); |
|
| 234 | 234 | |
| 235 | 235 | } |
| 236 | 236 | |
@@ -239,10 +239,10 @@ discard block |
||
| 239 | 239 | * |
| 240 | 240 | * @param WPInv_Subscription $subscription |
| 241 | 241 | */ |
| 242 | - public function subscription_cancelled( $subscription ) { |
|
| 242 | + public function subscription_cancelled($subscription) { |
|
| 243 | 243 | |
| 244 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 245 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 244 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $subscription); |
|
| 245 | + $this->send_email($subscription, $email, __FUNCTION__); |
|
| 246 | 246 | |
| 247 | 247 | } |
| 248 | 248 | |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | * @param WPInv_Subscription $subscription |
| 253 | 253 | */ |
| 254 | - public function subscription_expired( $subscription ) { |
|
| 254 | + public function subscription_expired($subscription) { |
|
| 255 | 255 | |
| 256 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 257 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 256 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $subscription); |
|
| 257 | + $this->send_email($subscription, $email, __FUNCTION__); |
|
| 258 | 258 | |
| 259 | 259 | } |
| 260 | 260 | |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @param WPInv_Subscription $subscription |
| 265 | 265 | */ |
| 266 | - public function subscription_complete( $subscription ) { |
|
| 266 | + public function subscription_complete($subscription) { |
|
| 267 | 267 | |
| 268 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $subscription ); |
|
| 269 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 268 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $subscription); |
|
| 269 | + $this->send_email($subscription, $email, __FUNCTION__); |
|
| 270 | 270 | |
| 271 | 271 | } |
| 272 | 272 | |
@@ -276,18 +276,18 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | public function renewal_reminder() { |
| 278 | 278 | |
| 279 | - $email = new GetPaid_Notification_Email( __FUNCTION__ ); |
|
| 279 | + $email = new GetPaid_Notification_Email(__FUNCTION__); |
|
| 280 | 280 | |
| 281 | 281 | // Fetch reminder days. |
| 282 | - $reminder_days = array_unique( wp_parse_id_list( $email->get_option( 'days' ) ) ); |
|
| 282 | + $reminder_days = array_unique(wp_parse_id_list($email->get_option('days'))); |
|
| 283 | 283 | |
| 284 | 284 | // Abort if non is set. |
| 285 | - if ( empty( $reminder_days ) ) { |
|
| 285 | + if (empty($reminder_days)) { |
|
| 286 | 286 | return; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // Fetch matching subscriptions. |
| 290 | - $args = array( |
|
| 290 | + $args = array( |
|
| 291 | 291 | 'number' => -1, |
| 292 | 292 | 'count_total' => false, |
| 293 | 293 | 'status' => 'trialling active', |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | ), |
| 297 | 297 | ); |
| 298 | 298 | |
| 299 | - foreach ( $reminder_days as $days ) { |
|
| 300 | - $date = date_parse( date( 'Y-m-d', strtotime( "+$days days", current_time( 'timestamp' ) ) ) ); |
|
| 299 | + foreach ($reminder_days as $days) { |
|
| 300 | + $date = date_parse(date('Y-m-d', strtotime("+$days days", current_time('timestamp')))); |
|
| 301 | 301 | |
| 302 | 302 | $args['date_expires_query'][] = array( |
| 303 | 303 | 'year' => $date['year'], |
@@ -307,14 +307,14 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - $subscriptions = new GetPaid_Subscriptions_Query( $args ); |
|
| 310 | + $subscriptions = new GetPaid_Subscriptions_Query($args); |
|
| 311 | 311 | |
| 312 | - foreach ( $subscriptions->get_results() as $subscription ) { |
|
| 312 | + foreach ($subscriptions->get_results() as $subscription) { |
|
| 313 | 313 | |
| 314 | 314 | // Skip packages. |
| 315 | - if ( apply_filters( 'getpaid_send_subscription_renewal_reminder_email', true ) ) { |
|
| 315 | + if (apply_filters('getpaid_send_subscription_renewal_reminder_email', true)) { |
|
| 316 | 316 | $email->object = $subscription; |
| 317 | - $this->send_email( $subscription, $email, __FUNCTION__ ); |
|
| 317 | + $this->send_email($subscription, $email, __FUNCTION__); |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | |
@@ -7,50 +7,50 @@ |
||
| 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' ) ? 'px-1' : ''; |
|
| 12 | +$class = !is_singular('page') ? 'px-1' : ''; |
|
| 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 | - <?php do_action( 'getpaid_before_invoice_meta_table', $invoice ); ?> |
|
| 18 | + <?php do_action('getpaid_before_invoice_meta_table', $invoice); ?> |
|
| 19 | 19 | <table class="table table-bordered"> |
| 20 | 20 | <tbody> |
| 21 | 21 | |
| 22 | - <?php do_action( 'getpaid_before_invoice_meta_rows', $invoice ); ?> |
|
| 23 | - <?php foreach ( $meta as $key => $data ) : ?> |
|
| 22 | + <?php do_action('getpaid_before_invoice_meta_rows', $invoice); ?> |
|
| 23 | + <?php foreach ($meta as $key => $data) : ?> |
|
| 24 | 24 | |
| 25 | - <?php if ( ! empty( $data['value'] ) ) : ?> |
|
| 25 | + <?php if (!empty($data['value'])) : ?> |
|
| 26 | 26 | |
| 27 | - <?php do_action( "getpaid_before_invoice_meta_$key", $invoice, $data ); ?> |
|
| 27 | + <?php do_action("getpaid_before_invoice_meta_$key", $invoice, $data); ?> |
|
| 28 | 28 | |
| 29 | - <tr class="getpaid-invoice-meta-<?php echo esc_attr( $key ); ?>"> |
|
| 29 | + <tr class="getpaid-invoice-meta-<?php echo esc_attr($key); ?>"> |
|
| 30 | 30 | |
| 31 | - <th class="<?php echo esc_attr( $class ); ?> font-weight-bold" style="width: 40%"> |
|
| 32 | - <?php echo esc_html( $data['label'] ); ?> |
|
| 31 | + <th class="<?php echo esc_attr($class); ?> font-weight-bold" style="width: 40%"> |
|
| 32 | + <?php echo esc_html($data['label']); ?> |
|
| 33 | 33 | </th> |
| 34 | 34 | |
| 35 | - <td class="<?php echo esc_attr( $class ); ?> <?php echo 'invoice_total' === $key ? 'font-weight-bold' : 'font-weight-normal'; ?> text-break" style="width: 60%"> |
|
| 36 | - <span class="getpaid-invoice-meta-<?php echo esc_attr( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span> |
|
| 35 | + <td class="<?php echo esc_attr($class); ?> <?php echo 'invoice_total' === $key ? 'font-weight-bold' : 'font-weight-normal'; ?> text-break" style="width: 60%"> |
|
| 36 | + <span class="getpaid-invoice-meta-<?php echo esc_attr($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span> |
|
| 37 | 37 | </td> |
| 38 | 38 | |
| 39 | 39 | </tr> |
| 40 | 40 | |
| 41 | - <?php do_action( "getpaid_after_invoice_meta_$key", $invoice, $data ); ?> |
|
| 41 | + <?php do_action("getpaid_after_invoice_meta_$key", $invoice, $data); ?> |
|
| 42 | 42 | |
| 43 | 43 | <?php endif; ?> |
| 44 | 44 | |
| 45 | 45 | <?php endforeach; ?> |
| 46 | - <?php do_action( 'getpaid_after_invoice_meta_rows', $invoice ); ?> |
|
| 46 | + <?php do_action('getpaid_after_invoice_meta_rows', $invoice); ?> |
|
| 47 | 47 | |
| 48 | 48 | </tbody> |
| 49 | 49 | </table> |
| 50 | - <?php do_action( 'getpaid_after_invoice_meta_table', $invoice ); ?> |
|
| 50 | + <?php do_action('getpaid_after_invoice_meta_table', $invoice); ?> |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | </div> |
| 54 | - <?php do_action( 'getpaid_after_invoice_meta', $invoice ); ?> |
|
| 54 | + <?php do_action('getpaid_after_invoice_meta', $invoice); ?> |
|
| 55 | 55 | |
| 56 | 56 | <?php |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays the invoice meta data. |
| 4 | 4 | * |
@@ -7,23 +7,23 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | - |
|
| 12 | -$class = ! is_singular( 'page' ) ? 'px-1' : ''; |
|
| 13 | -?> |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 14 | 11 | |
| 12 | + $class = ! is_singular( 'page' ) ? 'px-1' : ''; |
|
| 13 | + ?> |
|
| 14 | + |
|
| 15 | 15 | <?php do_action( 'getpaid_before_invoice_meta', $invoice ); ?> |
| 16 | - <div class="getpaid-invoice-meta-data"> |
|
| 16 | + <div class="getpaid-invoice-meta-data"> |
|
| 17 | 17 | |
| 18 | 18 | <?php do_action( 'getpaid_before_invoice_meta_table', $invoice ); ?> |
| 19 | 19 | <table class="table table-bordered"> |
| 20 | 20 | <tbody> |
| 21 | 21 | |
| 22 | 22 | <?php do_action( 'getpaid_before_invoice_meta_rows', $invoice ); ?> |
| 23 | - <?php foreach ( $meta as $key => $data ) : ?> |
|
| 24 | - |
|
| 23 | + <?php foreach ( $meta as $key => $data ) : ?> |
|
| 24 | + |
|
| 25 | 25 | <?php if ( ! empty( $data['value'] ) ) : ?> |
| 26 | - |
|
| 26 | + |
|
| 27 | 27 | <?php do_action( "getpaid_before_invoice_meta_$key", $invoice, $data ); ?> |
| 28 | 28 | |
| 29 | 29 | <tr class="getpaid-invoice-meta-<?php echo esc_attr( $key ); ?>"> |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | </tr> |
| 40 | 40 | |
| 41 | 41 | <?php do_action( "getpaid_after_invoice_meta_$key", $invoice, $data ); ?> |
| 42 | - |
|
| 42 | + |
|
| 43 | 43 | <?php endif; ?> |
| 44 | - |
|
| 44 | + |
|
| 45 | 45 | <?php endforeach; ?> |
| 46 | - <?php do_action( 'getpaid_after_invoice_meta_rows', $invoice ); ?> |
|
| 46 | + <?php do_action( 'getpaid_after_invoice_meta_rows', $invoice ); ?> |
|
| 47 | 47 | |
| 48 | 48 | </tbody> |
| 49 | 49 | </table> |
@@ -52,5 +52,5 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | </div> |
| 54 | 54 | <?php do_action( 'getpaid_after_invoice_meta', $invoice ); ?> |
| 55 | - |
|
| 56 | -<?php |
|
| 55 | + |
|
| 56 | + <?php |
|
@@ -7,20 +7,20 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$class = empty( $class ) ? 'btn-primary' : sanitize_html_class( $class ); |
|
| 13 | -$label = empty( $label ) ? esc_attr__( 'Pay %price% »', 'invoicing' ) : esc_attr( $label ); |
|
| 14 | -$free = empty( $free ) ? esc_attr__( 'Continue »', 'invoicing' ) : esc_attr( $free ); |
|
| 12 | +$class = empty($class) ? 'btn-primary' : sanitize_html_class($class); |
|
| 13 | +$label = empty($label) ? esc_attr__('Pay %price% »', 'invoicing') : esc_attr($label); |
|
| 14 | +$free = empty($free) ? esc_attr__('Continue »', 'invoicing') : esc_attr($free); |
|
| 15 | 15 | |
| 16 | -do_action( 'getpaid_before_payment_form_pay_button', $form ); |
|
| 16 | +do_action('getpaid_before_payment_form_pay_button', $form); |
|
| 17 | 17 | |
| 18 | 18 | aui()->input( |
| 19 | 19 | array( |
| 20 | - 'name' => esc_attr( $id ), |
|
| 21 | - 'id' => esc_attr( $element_id ), |
|
| 20 | + 'name' => esc_attr($id), |
|
| 21 | + 'id' => esc_attr($element_id), |
|
| 22 | 22 | 'value' => $label, |
| 23 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 23 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 24 | 24 | 'type' => 'submit', |
| 25 | 25 | 'class' => 'getpaid-payment-form-submit btn btn-block submit-button ' . $class, |
| 26 | 26 | 'extra_attributes' => array( |
@@ -31,4 +31,4 @@ discard block |
||
| 31 | 31 | true |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | -do_action( 'getpaid_after_payment_form_pay_button', $form ); |
|
| 34 | +do_action('getpaid_after_payment_form_pay_button', $form); |
|
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a payment button in payment form |
| 4 | 4 | * |
@@ -7,28 +7,28 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | 11 | |
| 12 | -$class = empty( $class ) ? 'btn-primary' : sanitize_html_class( $class ); |
|
| 13 | -$label = empty( $label ) ? esc_attr__( 'Pay %price% »', 'invoicing' ) : esc_attr( $label ); |
|
| 14 | -$free = empty( $free ) ? esc_attr__( 'Continue »', 'invoicing' ) : esc_attr( $free ); |
|
| 12 | + $class = empty( $class ) ? 'btn-primary' : sanitize_html_class( $class ); |
|
| 13 | + $label = empty( $label ) ? esc_attr__( 'Pay %price% »', 'invoicing' ) : esc_attr( $label ); |
|
| 14 | + $free = empty( $free ) ? esc_attr__( 'Continue »', 'invoicing' ) : esc_attr( $free ); |
|
| 15 | 15 | |
| 16 | -do_action( 'getpaid_before_payment_form_pay_button', $form ); |
|
| 16 | + do_action( 'getpaid_before_payment_form_pay_button', $form ); |
|
| 17 | 17 | |
| 18 | -aui()->input( |
|
| 19 | - array( |
|
| 20 | - 'name' => esc_attr( $id ), |
|
| 21 | - 'id' => esc_attr( $element_id ), |
|
| 22 | - 'value' => $label, |
|
| 23 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 24 | - 'type' => 'submit', |
|
| 25 | - 'class' => 'getpaid-payment-form-submit btn btn-block submit-button ' . $class, |
|
| 26 | - 'extra_attributes' => array( |
|
| 27 | - 'data-free' => $free, |
|
| 28 | - 'data-pay' => $label, |
|
| 18 | + aui()->input( |
|
| 19 | + array( |
|
| 20 | + 'name' => esc_attr( $id ), |
|
| 21 | + 'id' => esc_attr( $element_id ), |
|
| 22 | + 'value' => $label, |
|
| 23 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 24 | + 'type' => 'submit', |
|
| 25 | + 'class' => 'getpaid-payment-form-submit btn btn-block submit-button ' . $class, |
|
| 26 | + 'extra_attributes' => array( |
|
| 27 | + 'data-free' => $free, |
|
| 28 | + 'data-pay' => $label, |
|
| 29 | + ), |
|
| 29 | 30 | ), |
| 30 | - ), |
|
| 31 | - true |
|
| 32 | -); |
|
| 31 | + true |
|
| 32 | + ); |
|
| 33 | 33 | |
| 34 | -do_action( 'getpaid_after_payment_form_pay_button', $form ); |
|
| 34 | + do_action( 'getpaid_after_payment_form_pay_button', $form ); |
|
@@ -7,24 +7,24 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 15 | +if (!empty($required)) { |
|
| 16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | aui()->input( |
| 20 | 20 | array( |
| 21 | 21 | 'type' => 'checkbox', |
| 22 | - 'name' => esc_attr( $id ), |
|
| 23 | - 'id' => esc_attr( $element_id ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 22 | + 'name' => esc_attr($id), |
|
| 23 | + 'id' => esc_attr($element_id), |
|
| 24 | + 'required' => !empty($required), |
|
| 25 | 25 | 'label' => $label, |
| 26 | - 'value' => esc_attr__( 'Yes', 'invoicing' ), |
|
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 26 | + 'value' => esc_attr__('Yes', 'invoicing'), |
|
| 27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 28 | 28 | 'class' => 'w-auto ' . $label_class, |
| 29 | 29 | ), |
| 30 | 30 | true |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a checkbox in payment form |
| 4 | 4 | * |
@@ -7,25 +7,25 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | + $label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | + $label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 16 | - $label .= "<span class='text-danger'> *</span>"; |
|
| 15 | + if ( ! empty( $required ) ) { |
|
| 16 | + $label .= "<span class='text-danger'> *</span>"; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -aui()->input( |
|
| 20 | - array( |
|
| 21 | - 'type' => 'checkbox', |
|
| 22 | - 'name' => esc_attr( $id ), |
|
| 23 | - 'id' => esc_attr( $element_id ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 25 | - 'label' => $label, |
|
| 26 | - 'value' => esc_attr__( 'Yes', 'invoicing' ), |
|
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | - 'class' => 'w-auto ' . $label_class, |
|
| 29 | - ), |
|
| 30 | - true |
|
| 31 | -); |
|
| 19 | + aui()->input( |
|
| 20 | + array( |
|
| 21 | + 'type' => 'checkbox', |
|
| 22 | + 'name' => esc_attr( $id ), |
|
| 23 | + 'id' => esc_attr( $element_id ), |
|
| 24 | + 'required' => ! empty( $required ), |
|
| 25 | + 'label' => $label, |
|
| 26 | + 'value' => esc_attr__( 'Yes', 'invoicing' ), |
|
| 27 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | + 'class' => 'w-auto ' . $label_class, |
|
| 29 | + ), |
|
| 30 | + true |
|
| 31 | + ); |
|
@@ -13,25 +13,25 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class GetPaid_Meta_Box_Description { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Output the metabox. |
|
| 18 | - * |
|
| 19 | - * @param WP_Post $post Post object. |
|
| 20 | - */ |
|
| 21 | - public static function output( $post ) { |
|
| 16 | + /** |
|
| 17 | + * Output the metabox. |
|
| 18 | + * |
|
| 19 | + * @param WP_Post $post Post object. |
|
| 20 | + */ |
|
| 21 | + public static function output( $post ) { |
|
| 22 | 22 | |
| 23 | - $settings = array( |
|
| 24 | - 'textarea_name' => 'excerpt', |
|
| 25 | - 'quicktags' => array( 'buttons' => 'em,strong,link' ), |
|
| 26 | - 'teeny' => true, |
|
| 27 | - 'media_buttons' => false, |
|
| 28 | - 'tinymce' => array( |
|
| 29 | - 'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator', |
|
| 30 | - 'theme_advanced_buttons2' => '', |
|
| 31 | - ), |
|
| 32 | - 'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>', |
|
| 33 | - ); |
|
| 23 | + $settings = array( |
|
| 24 | + 'textarea_name' => 'excerpt', |
|
| 25 | + 'quicktags' => array( 'buttons' => 'em,strong,link' ), |
|
| 26 | + 'teeny' => true, |
|
| 27 | + 'media_buttons' => false, |
|
| 28 | + 'tinymce' => array( |
|
| 29 | + 'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator', |
|
| 30 | + 'theme_advanced_buttons2' => '', |
|
| 31 | + ), |
|
| 32 | + 'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>', |
|
| 33 | + ); |
|
| 34 | 34 | |
| 35 | - wp_editor( htmlspecialchars_decode( $post->post_excerpt, ENT_QUOTES ), 'excerpt', apply_filters( 'getpaid_description_editor_settings', $settings ) ); |
|
| 36 | - } |
|
| 35 | + wp_editor( htmlspecialchars_decode( $post->post_excerpt, ENT_QUOTES ), 'excerpt', apply_filters( 'getpaid_description_editor_settings', $settings ) ); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * GetPaid_Meta_Box_Description Class. |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @param WP_Post $post Post object. |
| 20 | 20 | */ |
| 21 | - public static function output( $post ) { |
|
| 21 | + public static function output($post) { |
|
| 22 | 22 | |
| 23 | 23 | $settings = array( |
| 24 | 24 | 'textarea_name' => 'excerpt', |
| 25 | - 'quicktags' => array( 'buttons' => 'em,strong,link' ), |
|
| 25 | + 'quicktags' => array('buttons' => 'em,strong,link'), |
|
| 26 | 26 | 'teeny' => true, |
| 27 | 27 | 'media_buttons' => false, |
| 28 | 28 | 'tinymce' => array( |
@@ -32,6 +32,6 @@ discard block |
||
| 32 | 32 | 'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>', |
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | - wp_editor( htmlspecialchars_decode( $post->post_excerpt, ENT_QUOTES ), 'excerpt', apply_filters( 'getpaid_description_editor_settings', $settings ) ); |
|
| 35 | + wp_editor(htmlspecialchars_decode($post->post_excerpt, ENT_QUOTES), 'excerpt', apply_filters('getpaid_description_editor_settings', $settings)); |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -7,24 +7,24 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 15 | +if (!empty($required)) { |
|
| 16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | aui()->input( |
| 20 | 20 | array( |
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $element_id ), |
|
| 23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 21 | + 'name' => esc_attr($id), |
|
| 22 | + 'id' => esc_attr($element_id), |
|
| 23 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 24 | + 'required' => !empty($required), |
|
| 25 | 25 | 'label' => $label, |
| 26 | 26 | 'label_type' => 'vertical', |
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 28 | 28 | 'type' => 'time', |
| 29 | 29 | 'class' => $label_class, |
| 30 | 30 | 'value' => $query_value, |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a time input in payment form |
| 4 | 4 | * |
@@ -7,27 +7,27 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | + $label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | + $label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 16 | - $label .= "<span class='text-danger'> *</span>"; |
|
| 15 | + if ( ! empty( $required ) ) { |
|
| 16 | + $label .= "<span class='text-danger'> *</span>"; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -aui()->input( |
|
| 20 | - array( |
|
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $element_id ), |
|
| 23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 25 | - 'label' => $label, |
|
| 26 | - 'label_type' => 'vertical', |
|
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | - 'type' => 'time', |
|
| 29 | - 'class' => $label_class, |
|
| 30 | - 'value' => $query_value, |
|
| 31 | - ), |
|
| 32 | - true |
|
| 33 | -); |
|
| 19 | + aui()->input( |
|
| 20 | + array( |
|
| 21 | + 'name' => esc_attr( $id ), |
|
| 22 | + 'id' => esc_attr( $element_id ), |
|
| 23 | + 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | + 'required' => ! empty( $required ), |
|
| 25 | + 'label' => $label, |
|
| 26 | + 'label_type' => 'vertical', |
|
| 27 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | + 'type' => 'time', |
|
| 29 | + 'class' => $label_class, |
|
| 30 | + 'value' => $query_value, |
|
| 31 | + ), |
|
| 32 | + true |
|
| 33 | + ); |
|
@@ -7,24 +7,24 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 15 | +if (!empty($required)) { |
|
| 16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | aui()->textarea( |
| 20 | 20 | array( |
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $element_id ), |
|
| 23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 21 | + 'name' => esc_attr($id), |
|
| 22 | + 'id' => esc_attr($element_id), |
|
| 23 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 24 | + 'required' => !empty($required), |
|
| 25 | 25 | 'label' => $label, |
| 26 | 26 | 'label_type' => 'vertical', |
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 28 | 28 | 'class' => $label_class, |
| 29 | 29 | 'value' => $query_value, |
| 30 | 30 | ), |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a textarea in payment form |
| 4 | 4 | * |
@@ -7,26 +7,26 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | + $label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | + $label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 16 | - $label .= "<span class='text-danger'> *</span>"; |
|
| 15 | + if ( ! empty( $required ) ) { |
|
| 16 | + $label .= "<span class='text-danger'> *</span>"; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -aui()->textarea( |
|
| 20 | - array( |
|
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $element_id ), |
|
| 23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 25 | - 'label' => $label, |
|
| 26 | - 'label_type' => 'vertical', |
|
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | - 'class' => $label_class, |
|
| 29 | - 'value' => $query_value, |
|
| 30 | - ), |
|
| 31 | - true |
|
| 32 | -); |
|
| 19 | + aui()->textarea( |
|
| 20 | + array( |
|
| 21 | + 'name' => esc_attr( $id ), |
|
| 22 | + 'id' => esc_attr( $element_id ), |
|
| 23 | + 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | + 'required' => ! empty( $required ), |
|
| 25 | + 'label' => $label, |
|
| 26 | + 'label_type' => 'vertical', |
|
| 27 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | + 'class' => $label_class, |
|
| 29 | + 'value' => $query_value, |
|
| 30 | + ), |
|
| 31 | + true |
|
| 32 | + ); |
|