@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if ( !defined('ABSPATH') ) { |
|
| 4 | 4 | die('-1'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -if ( ! empty( $message_body ) ) { |
|
| 9 | - echo wpautop( wptexturize( $message_body ) ); |
|
| 8 | +if (!empty($message_body)) { |
|
| 9 | + echo wpautop(wptexturize($message_body)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 16 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if ( !defined('ABSPATH') ) { |
|
| 4 | 4 | die('-1'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | |
@@ -1,22 +1,22 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -do_action( 'wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
| 8 | +do_action('wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
| 9 | 9 | |
| 10 | -if ( ! empty( $message_body ) ) { |
|
| 11 | - echo wpautop( wptexturize( $message_body ) ); |
|
| 10 | +if (!empty($message_body)) { |
|
| 11 | + echo wpautop(wptexturize($message_body)); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 16 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 18 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 19 | 19 | |
| 20 | -do_action( 'wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
| 20 | +do_action('wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
| 21 | 21 | |
| 22 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 23 | 22 | \ No newline at end of file |
| 23 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 24 | 24 | \ No newline at end of file |
@@ -1,6 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly. |
| 3 | -if (!defined( 'ABSPATH' ) ) exit; |
|
| 3 | +if (!defined( 'ABSPATH' ) ) { |
|
| 4 | + exit; |
|
| 5 | +} |
|
| 4 | 6 | |
| 5 | 7 | function wpinv_subscription_init() { |
| 6 | 8 | return WPInv_Subscriptions::instance(); |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly. |
| 3 | -if (!defined( 'ABSPATH' ) ) exit; |
|
| 3 | +if (!defined('ABSPATH')) exit; |
|
| 4 | 4 | |
| 5 | 5 | function wpinv_subscription_init() { |
| 6 | 6 | return WPInv_Subscriptions::instance(); |
| 7 | 7 | } |
| 8 | -add_action( 'plugins_loaded', 'wpinv_subscription_init', 100 ); |
|
| 8 | +add_action('plugins_loaded', 'wpinv_subscription_init', 100); |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * WPInv_Subscriptions Class. |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * Main WPInv_Subscriptions Instance |
| 21 | 21 | */ |
| 22 | 22 | public static function instance() { |
| 23 | - if ( ! isset( self::$instance ) ) { |
|
| 23 | + if (!isset(self::$instance)) { |
|
| 24 | 24 | self::$instance = new WPInv_Subscriptions; |
| 25 | 25 | |
| 26 | 26 | self::$instance->init(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @since 1.0.0 |
| 36 | 36 | */ |
| 37 | - private function __construct(){ |
|
| 37 | + private function __construct() { |
|
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | private function setup_constants() { |
| 64 | 64 | |
| 65 | 65 | // Make sure CAL_GREGORIAN is defined. |
| 66 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
| 67 | - define( 'CAL_GREGORIAN', 1 ); |
|
| 66 | + if (!defined('CAL_GREGORIAN')) { |
|
| 67 | + define('CAL_GREGORIAN', 1); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
@@ -76,15 +76,15 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | private function actions() { |
| 78 | 78 | |
| 79 | - add_action( 'admin_menu', array( $this, 'wpinv_subscriptions_list' ), 40 ); |
|
| 80 | - add_action( 'admin_notices', array( $this, 'notices' ) ); |
|
| 81 | - add_action( 'init', array( $this, 'wpinv_post_actions' ) ); |
|
| 82 | - add_action( 'init', array( $this, 'wpinv_get_actions' ) ); |
|
| 83 | - add_action( 'wpinv_cancel_subscription', array( $this, 'wpinv_process_cancellation' ) ); |
|
| 84 | - add_action( 'getpaid_checkout_before_gateway', array( $this, 'add_subscription' ), -999 ); |
|
| 85 | - add_action( 'wpinv_subscriptions_front_notices', array( $this, 'notices' ) ); |
|
| 86 | - add_action( 'getpaid_authenticated_admin_action_update_single_subscription', array( $this, 'admin_update_single_subscription' ) ); |
|
| 87 | - add_action( 'getpaid_authenticated_admin_action_subscription_manual_renew', array( $this, 'admin_renew_single_subscription' ) ); |
|
| 79 | + add_action('admin_menu', array($this, 'wpinv_subscriptions_list'), 40); |
|
| 80 | + add_action('admin_notices', array($this, 'notices')); |
|
| 81 | + add_action('init', array($this, 'wpinv_post_actions')); |
|
| 82 | + add_action('init', array($this, 'wpinv_get_actions')); |
|
| 83 | + add_action('wpinv_cancel_subscription', array($this, 'wpinv_process_cancellation')); |
|
| 84 | + add_action('getpaid_checkout_before_gateway', array($this, 'add_subscription'), -999); |
|
| 85 | + add_action('wpinv_subscriptions_front_notices', array($this, 'notices')); |
|
| 86 | + add_action('getpaid_authenticated_admin_action_update_single_subscription', array($this, 'admin_update_single_subscription')); |
|
| 87 | + add_action('getpaid_authenticated_admin_action_subscription_manual_renew', array($this, 'admin_renew_single_subscription')); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | public function wpinv_subscriptions_list() { |
| 107 | 107 | add_submenu_page( |
| 108 | 108 | 'wpinv', |
| 109 | - __( 'Subscriptions', 'invoicing' ), |
|
| 110 | - __( 'Subscriptions', 'invoicing' ), |
|
| 109 | + __('Subscriptions', 'invoicing'), |
|
| 110 | + __('Subscriptions', 'invoicing'), |
|
| 111 | 111 | wpinv_get_capability(), |
| 112 | 112 | 'wpinv-subscriptions', |
| 113 | 113 | 'wpinv_subscriptions_page' |
@@ -116,37 +116,37 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function notices() { |
| 118 | 118 | |
| 119 | - if( empty( $_GET['wpinv-message'] ) ) { |
|
| 119 | + if (empty($_GET['wpinv-message'])) { |
|
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $type = 'updated'; |
| 124 | 124 | $message = ''; |
| 125 | 125 | |
| 126 | - switch( strtolower( $_GET['wpinv-message'] ) ) { |
|
| 126 | + switch (strtolower($_GET['wpinv-message'])) { |
|
| 127 | 127 | |
| 128 | 128 | case 'updated' : |
| 129 | 129 | |
| 130 | - $message = __( 'Subscription updated successfully.', 'invoicing' ); |
|
| 130 | + $message = __('Subscription updated successfully.', 'invoicing'); |
|
| 131 | 131 | |
| 132 | 132 | break; |
| 133 | 133 | |
| 134 | 134 | case 'deleted' : |
| 135 | 135 | |
| 136 | - $message = __( 'Subscription deleted successfully.', 'invoicing' ); |
|
| 136 | + $message = __('Subscription deleted successfully.', 'invoicing'); |
|
| 137 | 137 | |
| 138 | 138 | break; |
| 139 | 139 | |
| 140 | 140 | case 'cancelled' : |
| 141 | 141 | |
| 142 | - $message = __( 'Subscription cancelled successfully.', 'invoicing' ); |
|
| 142 | + $message = __('Subscription cancelled successfully.', 'invoicing'); |
|
| 143 | 143 | |
| 144 | 144 | break; |
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ( ! empty( $message ) ) { |
|
| 149 | - echo '<div class="' . esc_attr( $type ) . '"><p>' . $message . '</p></div>'; |
|
| 148 | + if (!empty($message)) { |
|
| 149 | + echo '<div class="' . esc_attr($type) . '"><p>' . $message . '</p></div>'; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | } |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | * @return void |
| 160 | 160 | */ |
| 161 | 161 | function wpinv_get_actions() { |
| 162 | - if ( isset( $_GET['wpinv_action'] ) ) { |
|
| 163 | - do_action( 'wpinv_' . $_GET['wpinv_action'], $_GET ); |
|
| 162 | + if (isset($_GET['wpinv_action'])) { |
|
| 163 | + do_action('wpinv_' . $_GET['wpinv_action'], $_GET); |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | * @return void |
| 173 | 173 | */ |
| 174 | 174 | function wpinv_post_actions() { |
| 175 | - if ( isset( $_POST['wpinv_action'] ) ) { |
|
| 176 | - do_action( 'wpinv_' . $_POST['wpinv_action'], $_POST ); |
|
| 175 | + if (isset($_POST['wpinv_action'])) { |
|
| 176 | + do_action('wpinv_' . $_POST['wpinv_action'], $_POST); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
@@ -184,29 +184,29 @@ discard block |
||
| 184 | 184 | * @param int $frequency_count The frequency of the period. |
| 185 | 185 | * @return mixed|string|void |
| 186 | 186 | */ |
| 187 | - public static function wpinv_get_pretty_subscription_frequency( $period, $frequency_count = 1) { |
|
| 187 | + public static function wpinv_get_pretty_subscription_frequency($period, $frequency_count = 1) { |
|
| 188 | 188 | |
| 189 | 189 | $frequency = ''; |
| 190 | 190 | //Format period details |
| 191 | - switch ( strtolower( $period ) ) { |
|
| 191 | + switch (strtolower($period)) { |
|
| 192 | 192 | case 'day' : |
| 193 | 193 | case 'd' : |
| 194 | - $frequency = sprintf( _n('%d Day', '%d Days', $frequency_count, 'invoicing'), $frequency_count); |
|
| 194 | + $frequency = sprintf(_n('%d Day', '%d Days', $frequency_count, 'invoicing'), $frequency_count); |
|
| 195 | 195 | break; |
| 196 | 196 | case 'week' : |
| 197 | 197 | case 'w' : |
| 198 | - $frequency = sprintf( _n('%d Week', '%d Weeks', $frequency_count, 'invoicing'), $frequency_count); |
|
| 198 | + $frequency = sprintf(_n('%d Week', '%d Weeks', $frequency_count, 'invoicing'), $frequency_count); |
|
| 199 | 199 | break; |
| 200 | 200 | case 'month' : |
| 201 | 201 | case 'm' : |
| 202 | - $frequency = sprintf( _n('%d Month', '%d Months', $frequency_count, 'invoicing'), $frequency_count); |
|
| 202 | + $frequency = sprintf(_n('%d Month', '%d Months', $frequency_count, 'invoicing'), $frequency_count); |
|
| 203 | 203 | break; |
| 204 | 204 | case 'year' : |
| 205 | 205 | case 'y' : |
| 206 | - $frequency = sprintf( _n('%d Year', '%d Years', $frequency_count, 'invoicing'), $frequency_count); |
|
| 206 | + $frequency = sprintf(_n('%d Year', '%d Years', $frequency_count, 'invoicing'), $frequency_count); |
|
| 207 | 207 | break; |
| 208 | 208 | default : |
| 209 | - $frequency = apply_filters( 'wpinv_recurring_subscription_frequency', $frequency, $period, $frequency_count ); |
|
| 209 | + $frequency = apply_filters('wpinv_recurring_subscription_frequency', $frequency, $period, $frequency_count); |
|
| 210 | 210 | break; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -221,50 +221,50 @@ discard block |
||
| 221 | 221 | * @since 1.0.0 |
| 222 | 222 | * @return void |
| 223 | 223 | */ |
| 224 | - public function wpinv_process_cancellation( $data ) { |
|
| 224 | + public function wpinv_process_cancellation($data) { |
|
| 225 | 225 | |
| 226 | 226 | |
| 227 | - if( empty( $data['sub_id'] ) ) { |
|
| 227 | + if (empty($data['sub_id'])) { |
|
| 228 | 228 | return; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if( ! is_user_logged_in() ) { |
|
| 231 | + if (!is_user_logged_in()) { |
|
| 232 | 232 | return; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - if( ! wp_verify_nonce( $data['_wpnonce'], 'wpinv-recurring-cancel' ) ) { |
|
| 236 | - wp_die( __( 'Error', 'invoicing' ), __( 'Nonce verification failed', 'invoicing' ), array( 'response' => 403 ) ); |
|
| 235 | + if (!wp_verify_nonce($data['_wpnonce'], 'wpinv-recurring-cancel')) { |
|
| 236 | + wp_die(__('Error', 'invoicing'), __('Nonce verification failed', 'invoicing'), array('response' => 403)); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - $data['sub_id'] = absint( $data['sub_id'] ); |
|
| 240 | - $subscription = new WPInv_Subscription( $data['sub_id'] ); |
|
| 239 | + $data['sub_id'] = absint($data['sub_id']); |
|
| 240 | + $subscription = new WPInv_Subscription($data['sub_id']); |
|
| 241 | 241 | |
| 242 | - if( ! $subscription->can_cancel() ) { |
|
| 243 | - wp_die( __( 'Error', 'invoicing' ), __( 'This subscription cannot be cancelled', 'invoicing' ), array( 'response' => 403 ) ); |
|
| 242 | + if (!$subscription->can_cancel()) { |
|
| 243 | + wp_die(__('Error', 'invoicing'), __('This subscription cannot be cancelled', 'invoicing'), array('response' => 403)); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | try { |
| 247 | 247 | |
| 248 | - do_action( 'wpinv_recurring_cancel_' . $subscription->gateway . '_subscription', $subscription, true ); |
|
| 248 | + do_action('wpinv_recurring_cancel_' . $subscription->gateway . '_subscription', $subscription, true); |
|
| 249 | 249 | |
| 250 | 250 | $subscription->cancel(); |
| 251 | 251 | |
| 252 | - if( is_admin() ) { |
|
| 252 | + if (is_admin()) { |
|
| 253 | 253 | |
| 254 | - wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=cancelled&id=' . $subscription->id ) ); |
|
| 254 | + wp_redirect(admin_url('admin.php?page=wpinv-subscriptions&wpinv-message=cancelled&id=' . $subscription->id)); |
|
| 255 | 255 | exit; |
| 256 | 256 | |
| 257 | 257 | } else { |
| 258 | 258 | |
| 259 | - $redirect = remove_query_arg( array( '_wpnonce', 'wpinv_action', 'sub_id' ), add_query_arg( array( 'wpinv-message' => 'cancelled' ) ) ); |
|
| 260 | - $redirect = apply_filters( 'wpinv_recurring_cancellation_redirect', $redirect, $subscription ); |
|
| 261 | - wp_safe_redirect( $redirect ); |
|
| 259 | + $redirect = remove_query_arg(array('_wpnonce', 'wpinv_action', 'sub_id'), add_query_arg(array('wpinv-message' => 'cancelled'))); |
|
| 260 | + $redirect = apply_filters('wpinv_recurring_cancellation_redirect', $redirect, $subscription); |
|
| 261 | + wp_safe_redirect($redirect); |
|
| 262 | 262 | exit; |
| 263 | 263 | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - } catch ( Exception $e ) { |
|
| 267 | - wp_die( __( 'Error', 'invoicing' ), $e->getMessage(), array( 'response' => 403 ) ); |
|
| 266 | + } catch (Exception $e) { |
|
| 267 | + wp_die(__('Error', 'invoicing'), $e->getMessage(), array('response' => 403)); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | } |
@@ -277,33 +277,33 @@ discard block |
||
| 277 | 277 | * @since 1.0.0 |
| 278 | 278 | * @return void |
| 279 | 279 | */ |
| 280 | - public function add_subscription( $invoice ) { |
|
| 280 | + public function add_subscription($invoice) { |
|
| 281 | 281 | |
| 282 | - $invoice = new WPInv_Invoice( $invoice ); |
|
| 282 | + $invoice = new WPInv_Invoice($invoice); |
|
| 283 | 283 | |
| 284 | 284 | // Abort if it is not recurring. |
| 285 | - if ( ! $invoice->is_recurring() || $invoice->is_renewal() ) { |
|
| 285 | + if (!$invoice->is_recurring() || $invoice->is_renewal()) { |
|
| 286 | 286 | return; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // Should we create a subscription for the invoice? |
| 290 | - if ( apply_filters( 'wpinv_skip_invoice_subscription_creation', false, $invoice ) ) { |
|
| 290 | + if (apply_filters('wpinv_skip_invoice_subscription_creation', false, $invoice)) { |
|
| 291 | 291 | return; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // Get the recurring item. |
| 295 | - $subscription_item = $invoice->get_recurring( true ); |
|
| 295 | + $subscription_item = $invoice->get_recurring(true); |
|
| 296 | 296 | |
| 297 | 297 | // Prepare the subscription details. |
| 298 | - $period = $subscription_item->get_recurring_period( true ); |
|
| 298 | + $period = $subscription_item->get_recurring_period(true); |
|
| 299 | 299 | $interval = $subscription_item->get_recurring_interval(); |
| 300 | 300 | $add_period = $interval . ' ' . $period; |
| 301 | 301 | $trial_period = ''; |
| 302 | 302 | |
| 303 | - if ( $invoice->has_free_trial() ) { |
|
| 303 | + if ($invoice->has_free_trial()) { |
|
| 304 | 304 | |
| 305 | - if ( $subscription_item->has_free_trial() ) { |
|
| 306 | - $trial_period = $subscription_item->get_trial_period( true ); |
|
| 305 | + if ($subscription_item->has_free_trial()) { |
|
| 306 | + $trial_period = $subscription_item->get_trial_period(true); |
|
| 307 | 307 | $free_interval = $subscription_item->get_trial_interval(); |
| 308 | 308 | } else { |
| 309 | 309 | $trial_period = $period; |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // Calculate the next renewal date. |
| 319 | - $expiration = date( 'Y-m-d H:i:s', strtotime( "+ $add_period", current_time( 'timestamp' ) ) ); |
|
| 319 | + $expiration = date('Y-m-d H:i:s', strtotime("+ $add_period", current_time('timestamp'))); |
|
| 320 | 320 | |
| 321 | 321 | // Subscription arguments. |
| 322 | 322 | $args = array( |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | 'initial_amount' => $invoice->get_initial_total(), |
| 330 | 330 | 'recurring_amount' => $invoice->get_recurring_total(), |
| 331 | 331 | 'bill_times' => $subscription_item->get_recurring_limit(), |
| 332 | - 'created' => current_time( 'mysql' ), |
|
| 332 | + 'created' => current_time('mysql'), |
|
| 333 | 333 | 'expiration' => $expiration, |
| 334 | 334 | 'trial_period' => $trial_period, |
| 335 | 335 | 'profile_id' => '', |
@@ -337,19 +337,19 @@ discard block |
||
| 337 | 337 | ); |
| 338 | 338 | |
| 339 | 339 | // Create or update the subscription. |
| 340 | - $subscription = wpinv_get_subscription( $invoice ); |
|
| 340 | + $subscription = wpinv_get_subscription($invoice); |
|
| 341 | 341 | |
| 342 | - if ( empty( $subscription ) ) { |
|
| 342 | + if (empty($subscription)) { |
|
| 343 | 343 | |
| 344 | 344 | $subscription = new WPInv_Subscription(); |
| 345 | - $subscription->create( $args ); |
|
| 345 | + $subscription->create($args); |
|
| 346 | 346 | |
| 347 | 347 | } else { |
| 348 | 348 | |
| 349 | 349 | |
| 350 | - unset( $args['transaction_id'] ); |
|
| 351 | - unset( $args['profile_id'] ); |
|
| 352 | - $subscription->update( $args ); |
|
| 350 | + unset($args['transaction_id']); |
|
| 351 | + unset($args['profile_id']); |
|
| 352 | + $subscription->update($args); |
|
| 353 | 353 | |
| 354 | 354 | } |
| 355 | 355 | |
@@ -362,21 +362,21 @@ discard block |
||
| 362 | 362 | * @param array $data |
| 363 | 363 | * @since 1.0.19 |
| 364 | 364 | */ |
| 365 | - public function admin_update_single_subscription( $args ) { |
|
| 365 | + public function admin_update_single_subscription($args) { |
|
| 366 | 366 | |
| 367 | 367 | // Ensure the subscription exists and that a status has been given. |
| 368 | - if ( empty( $args['subscription_id'] ) || empty( $args['subscription_status'] ) ) { |
|
| 368 | + if (empty($args['subscription_id']) || empty($args['subscription_status'])) { |
|
| 369 | 369 | return; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | // Retrieve the subscriptions. |
| 373 | - $subscription = new WPInv_Subscription( $args['subscription_id'] ); |
|
| 373 | + $subscription = new WPInv_Subscription($args['subscription_id']); |
|
| 374 | 374 | |
| 375 | - if ( $subscription->get_id() ) { |
|
| 375 | + if ($subscription->get_id()) { |
|
| 376 | 376 | |
| 377 | - $subscription->set_status( $args['subscription_status'] ); |
|
| 377 | + $subscription->set_status($args['subscription_status']); |
|
| 378 | 378 | $subscription->save(); |
| 379 | - getpaid_admin()->show_info( __( 'Your changes have been saved', 'invoicing' ) ); |
|
| 379 | + getpaid_admin()->show_info(__('Your changes have been saved', 'invoicing')); |
|
| 380 | 380 | |
| 381 | 381 | } |
| 382 | 382 | |
@@ -388,25 +388,25 @@ discard block |
||
| 388 | 388 | * @param array $data |
| 389 | 389 | * @since 1.0.19 |
| 390 | 390 | */ |
| 391 | - public function admin_renew_single_subscription( $args ) { |
|
| 391 | + public function admin_renew_single_subscription($args) { |
|
| 392 | 392 | |
| 393 | 393 | // Ensure the subscription exists and that a status has been given. |
| 394 | - if ( empty( $args['id'] ) ) { |
|
| 394 | + if (empty($args['id'])) { |
|
| 395 | 395 | return; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | // Retrieve the subscriptions. |
| 399 | - $subscription = new WPInv_Subscription( $args['id'] ); |
|
| 399 | + $subscription = new WPInv_Subscription($args['id']); |
|
| 400 | 400 | |
| 401 | - if ( $subscription->get_id() ) { |
|
| 401 | + if ($subscription->get_id()) { |
|
| 402 | 402 | |
| 403 | - $args = array( 'transaction_id', $subscription->get_parent_invoice()->generate_key( 'renewal_' ) ); |
|
| 403 | + $args = array('transaction_id', $subscription->get_parent_invoice()->generate_key('renewal_')); |
|
| 404 | 404 | |
| 405 | - if ( $subscription->add_payment( $args ) ) { |
|
| 405 | + if ($subscription->add_payment($args)) { |
|
| 406 | 406 | $subscription->renew(); |
| 407 | - getpaid_admin()->show_info( __( 'This subscription has been renewed and extended.', 'invoicing' ) ); |
|
| 407 | + getpaid_admin()->show_info(__('This subscription has been renewed and extended.', 'invoicing')); |
|
| 408 | 408 | } else { |
| 409 | - getpaid_admin()->show_error( __( 'We are unable to renew this subscription as the parent invoice does not exist.', 'invoicing' ) ); |
|
| 409 | + getpaid_admin()->show_error(__('We are unable to renew this subscription as the parent invoice does not exist.', 'invoicing')); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | wp_safe_redirect( |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if ( !defined('ABSPATH') ) { |
|
| 4 | 4 | die('-1'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -if ( ! empty( $message_body ) ) { |
|
| 9 | - echo wpautop( wptexturize( $message_body ) ); |
|
| 8 | +if (!empty($message_body)) { |
|
| 9 | + echo wpautop(wptexturize($message_body)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 16 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if ( !defined('ABSPATH') ) { |
|
| 4 | 4 | die('-1'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -if ( ! empty( $message_body ) ) { |
|
| 9 | - echo wpautop( wptexturize( $message_body ) ); |
|
| 8 | +if (!empty($message_body)) { |
|
| 9 | + echo wpautop(wptexturize($message_body)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 16 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if ( !defined('ABSPATH') ) { |
|
| 4 | 4 | die('-1'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -if ( ! empty( $message_body ) ) { |
|
| 9 | - echo wpautop( wptexturize( $message_body ) ); |
|
| 8 | +if (!empty($message_body)) { |
|
| 9 | + echo wpautop(wptexturize($message_body)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 16 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if ( !defined('ABSPATH') ) { |
|
| 4 | 4 | die('-1'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -if ( ! empty( $message_body ) ) { |
|
| 9 | - echo wpautop( wptexturize( $message_body ) ); |
|
| 8 | +if (!empty($message_body)) { |
|
| 9 | + echo wpautop(wptexturize($message_body)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 16 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if ( !defined('ABSPATH') ) { |
|
| 4 | 4 | die('-1'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -if ( ! empty( $message_body ) ) { |
|
| 9 | - echo wpautop( wptexturize( $message_body ) ); |
|
| 8 | +if (!empty($message_body)) { |
|
| 9 | + echo wpautop(wptexturize($message_body)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 16 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if ( !defined('ABSPATH') ) { |
|
| 4 | 4 | die('-1'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -if ( ! empty( $message_body ) ) { |
|
| 9 | - echo wpautop( wptexturize( $message_body ) ); |
|
| 8 | +if (!empty($message_body)) { |
|
| 9 | + echo wpautop(wptexturize($message_body)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 16 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |