Passed
Push — master ( 3bc955...30a2aa )
by Brian
08:45 queued 03:07
created
vendor/composer/installers/src/Composer/Installers/Installer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $installPath = $this->getPackageBasePath($package);
167 167
         $io = $this->io;
168
-        $outputStatus = function () use ($io, $installPath) {
168
+        $outputStatus = function() use ($io, $installPath) {
169 169
             $io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
170 170
         };
171 171
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
236 236
         }
237 237
 
238
-        return $pattern ? : '(\w+)';
238
+        return $pattern ?: '(\w+)';
239 239
     }
240 240
 
241 241
     /**
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function getLocations()
37 37
     {
38 38
         if ($this->matchesCakeVersion('>=', '3.0.0')) {
39
-            $this->locations['plugin'] =  $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
39
+            $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
40 40
         }
41 41
         return $this->locations;
42 42
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     protected function matchesCakeVersion($matcher, $version)
52 52
     {
53 53
         $repositoryManager = $this->composer->getRepositoryManager();
54
-        if (! $repositoryManager) {
54
+        if (!$repositoryManager) {
55 55
             return false;
56 56
         }
57 57
 
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/OxidInstaller.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 class OxidInstaller extends BaseInstaller
7 7
 {
8
-	const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
8
+    const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
9 9
 
10 10
     protected $locations = array(
11 11
         'module'    => 'modules/{$name}/',
@@ -13,47 +13,47 @@  discard block
 block discarded – undo
13 13
         'out'    => 'out/{$name}/',
14 14
     );
15 15
 
16
-	/**
17
-	 * getInstallPath
18
-	 *
19
-	 * @param PackageInterface $package
20
-	 * @param string $frameworkType
21
-	 * @return string
22
-	 */
23
-	public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
-	{
25
-		$installPath = parent::getInstallPath($package, $frameworkType);
26
-		$type = $this->package->getType();
27
-		if ($type === 'oxid-module') {
28
-			$this->prepareVendorDirectory($installPath);
29
-		}
30
-		return $installPath;
31
-	}
16
+    /**
17
+     * getInstallPath
18
+     *
19
+     * @param PackageInterface $package
20
+     * @param string $frameworkType
21
+     * @return string
22
+     */
23
+    public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
+    {
25
+        $installPath = parent::getInstallPath($package, $frameworkType);
26
+        $type = $this->package->getType();
27
+        if ($type === 'oxid-module') {
28
+            $this->prepareVendorDirectory($installPath);
29
+        }
30
+        return $installPath;
31
+    }
32 32
 
33
-	/**
34
-	 * prepareVendorDirectory
35
-	 *
36
-	 * Makes sure there is a vendormetadata.php file inside
37
-	 * the vendor folder if there is a vendor folder.
38
-	 *
39
-	 * @param string $installPath
40
-	 * @return void
41
-	 */
42
-	protected function prepareVendorDirectory($installPath)
43
-	{
44
-		$matches = '';
45
-		$hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
-		if (!$hasVendorDirectory) {
47
-			return;
48
-		}
33
+    /**
34
+     * prepareVendorDirectory
35
+     *
36
+     * Makes sure there is a vendormetadata.php file inside
37
+     * the vendor folder if there is a vendor folder.
38
+     *
39
+     * @param string $installPath
40
+     * @return void
41
+     */
42
+    protected function prepareVendorDirectory($installPath)
43
+    {
44
+        $matches = '';
45
+        $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
+        if (!$hasVendorDirectory) {
47
+            return;
48
+        }
49 49
 
50
-		$vendorDirectory = $matches['vendor'];
51
-		$vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
-		if (!file_exists($vendorPath)) {
53
-			mkdir($vendorPath, 0755, true);
54
-		}
50
+        $vendorDirectory = $matches['vendor'];
51
+        $vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
+        if (!file_exists($vendorPath)) {
53
+            mkdir($vendorPath, 0755, true);
54
+        }
55 55
 
56
-		$vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
-		touch($vendorMetaDataPath);
58
-	}
56
+        $vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
+        touch($vendorMetaDataPath);
58
+    }
59 59
 }
Please login to merge, or discard this patch.
templates/frontend-head.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-exception.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -14,51 +14,51 @@
 block discarded – undo
14 14
  */
15 15
 class GetPaid_Payment_Exception extends Exception {
16 16
 
17
-	/**
18
-	 * Sanitized error code.
19
-	 *
20
-	 * @var string
21
-	 */
22
-	protected $error_code;
17
+    /**
18
+     * Sanitized error code.
19
+     *
20
+     * @var string
21
+     */
22
+    protected $error_code;
23 23
 
24
-	/**
25
-	 * Error extra data.
26
-	 *
27
-	 * @var array
28
-	 */
29
-	protected $error_data;
24
+    /**
25
+     * Error extra data.
26
+     *
27
+     * @var array
28
+     */
29
+    protected $error_data;
30 30
 
31
-	/**
32
-	 * Setup exception.
33
-	 *
34
-	 * @param string $code             Machine-readable error code, e.g `getpaid-discount-error`.
35
-	 * @param string $message          User-friendly translated error message, e.g. 'Discount is invalid'.
36
-	 * @param int    $http_status_code Proper HTTP status code to respond with, e.g. 400.
37
-	 * @param array  $data             Extra error data.
38
-	 */
39
-	public function __construct( $code, $message, $http_status_code = 400, $data = array() ) {
40
-		$this->error_code = $code;
41
-		$this->error_data = array_merge( array( 'status' => $http_status_code ), $data );
31
+    /**
32
+     * Setup exception.
33
+     *
34
+     * @param string $code             Machine-readable error code, e.g `getpaid-discount-error`.
35
+     * @param string $message          User-friendly translated error message, e.g. 'Discount is invalid'.
36
+     * @param int    $http_status_code Proper HTTP status code to respond with, e.g. 400.
37
+     * @param array  $data             Extra error data.
38
+     */
39
+    public function __construct( $code, $message, $http_status_code = 400, $data = array() ) {
40
+        $this->error_code = $code;
41
+        $this->error_data = array_merge( array( 'status' => $http_status_code ), $data );
42 42
 
43
-		parent::__construct( $message, $http_status_code );
44
-	}
43
+        parent::__construct( $message, $http_status_code );
44
+    }
45 45
 
46
-	/**
47
-	 * Returns the error code.
48
-	 *
49
-	 * @return string
50
-	 */
51
-	public function getErrorCode() {
52
-		return $this->error_code;
53
-	}
46
+    /**
47
+     * Returns the error code.
48
+     *
49
+     * @return string
50
+     */
51
+    public function getErrorCode() {
52
+        return $this->error_code;
53
+    }
54 54
 
55
-	/**
56
-	 * Returns error data.
57
-	 *
58
-	 * @return array
59
-	 */
60
-	public function getErrorData() {
61
-		return $this->error_data;
62
-	}
55
+    /**
56
+     * Returns error data.
57
+     *
58
+     * @return array
59
+     */
60
+    public function getErrorData() {
61
+        return $this->error_data;
62
+    }
63 63
 
64 64
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @since   2.2.2
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 /**
13 13
  * Payment exception class.
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	 * @param int    $http_status_code Proper HTTP status code to respond with, e.g. 400.
37 37
 	 * @param array  $data             Extra error data.
38 38
 	 */
39
-	public function __construct( $code, $message, $http_status_code = 400, $data = array() ) {
39
+	public function __construct($code, $message, $http_status_code = 400, $data = array()) {
40 40
 		$this->error_code = $code;
41
-		$this->error_data = array_merge( array( 'status' => $http_status_code ), $data );
41
+		$this->error_data = array_merge(array('status' => $http_status_code), $data);
42 42
 
43
-		parent::__construct( $message, $http_status_code );
43
+		parent::__construct($message, $http_status_code);
44 44
 	}
45 45
 
46 46
 	/**
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-payment-form.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit; // Exit if accessed directly
10
+    exit; // Exit if accessed directly
11 11
 }
12 12
 
13 13
 /**
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 class GetPaid_Meta_Box_Payment_Form {
17 17
 
18 18
     /**
19
-	 * Output the metabox.
20
-	 *
21
-	 * @param WP_Post $post
22
-	 */
19
+     * Output the metabox.
20
+     *
21
+     * @param WP_Post $post
22
+     */
23 23
     public static function output( $post ) {
24 24
         ?>
25 25
         <style>
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
     }
103 103
 
104 104
     /**
105
-	 * Save meta box data.
106
-	 *
107
-	 * @param int $post_id
108
-	 */
109
-	public static function save( $post_id ) {
105
+     * Save meta box data.
106
+     *
107
+     * @param int $post_id
108
+     */
109
+    public static function save( $post_id ) {
110 110
 
111 111
         // Prepare the form.
112 112
         $form = new GetPaid_Payment_Form( $post_id );
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
     }
138 138
 
139 139
     /**
140
-	 * Converts an array fo form items to objects.
141
-	 *
142
-	 * @param array $items
143
-	 */
144
-	public static function item_to_objects( $items ) {
140
+     * Converts an array fo form items to objects.
141
+     *
142
+     * @param array $items
143
+     */
144
+    public static function item_to_objects( $items ) {
145 145
 
146 146
         $objects = array();
147 147
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit; // Exit if accessed directly
11 11
 }
12 12
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @param WP_Post $post
22 22
 	 */
23
-    public static function output( $post ) {
23
+    public static function output($post) {
24 24
         ?>
25 25
         <style>
26 26
             .wpinv-form-builder-edit-field-wrapper label.d-block > span:first-child{
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                 <div class="col-sm-4">
34 34
 
35 35
                     <!-- Builder tabs -->
36
-                    <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php esc_html_e( 'Go Back', 'invoicing' ); ?></button>
36
+                    <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php esc_html_e('Go Back', 'invoicing'); ?></button>
37 37
 
38 38
                     <!-- Builder tab content -->
39 39
                     <div class="mt-4">
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
                         <!-- Available builder elements -->
42 42
                         <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'">
43 43
                             <div class="wpinv-form-builder-add-field-types">
44
-                                <small class='form-text text-muted'><?php esc_html_e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small>
44
+                                <small class='form-text text-muted'><?php esc_html_e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small>
45 45
                                 <draggable class="section mt-2" style="display: flex; flex-flow: wrap; justify-content: space-between;" v-model="elements" :group="{ name: 'fields', pull: 'clone', put: false }" :sort="false" :clone="addDraggedField" tag="ul" filter=".wpinv-undraggable">
46 46
                                     <li v-for="element in elements" class= "wpinv-payment-form-left-fields-field" @click.prevent="addField(element)" :class="{ 'd-none': element.defaults.premade }">
47 47
                                         <button class="button btn text-dark">
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
                         <!-- Edit an element -->
57 57
                         <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='edit_item'" style="font-size: 14px;">
58 58
                             <div class="wpinv-form-builder-edit-field-wrapper">
59
-                                <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?>
60
-                                <?php do_action( 'getpaid_payment_form_edit_element_template', $post ); ?>
59
+                                <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?>
60
+                                <?php do_action('getpaid_payment_form_edit_element_template', $post); ?>
61 61
                                 <div class='form-group mb-3'>
62
-                                    <label :for="active_form_element.id + '_grid_width'"><?php esc_html_e( 'Width', 'invoicing' ); ?></label>
62
+                                    <label :for="active_form_element.id + '_grid_width'"><?php esc_html_e('Width', 'invoicing'); ?></label>
63 63
                                     <select class='form-control custom-select' :id="active_form_element.id + '_grid_width'" v-model='gridWidth'>
64
-                                        <option value='full'><?php esc_html_e( 'Full Width', 'invoicing' ); ?></option>
65
-                                        <option value='half'><?php esc_html_e( 'Half Width', 'invoicing' ); ?></option>
66
-                                        <option value='third'><?php esc_html_e( '1/3 Width', 'invoicing' ); ?></option>
64
+                                        <option value='full'><?php esc_html_e('Full Width', 'invoicing'); ?></option>
65
+                                        <option value='half'><?php esc_html_e('Half Width', 'invoicing'); ?></option>
66
+                                        <option value='third'><?php esc_html_e('1/3 Width', 'invoicing'); ?></option>
67 67
                                     </select>
68 68
                                 </div>
69 69
                                 <div>
70
-                                    <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php esc_html_e( 'Delete Element', 'invoicing' ); ?></button>
70
+                                    <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php esc_html_e('Delete Element', 'invoicing'); ?></button>
71 71
                                 </div>
72 72
                             </div>
73 73
                         </div>
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
 
77 77
                 </div>
78 78
                 <div class="col-sm-8 border-left">
79
-                    <small class='form-text text-muted' v-if='form_elements.length'><?php esc_html_e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small>
80
-                    <p class='form-text text-muted' v-if='! form_elements.length'><?php esc_html_e( 'This form is empty. Add new elements by dragging them from the right.', 'invoicing' ); ?></p>
79
+                    <small class='form-text text-muted' v-if='form_elements.length'><?php esc_html_e('Click on any element to edit or delete it.', 'invoicing'); ?></small>
80
+                    <p class='form-text text-muted' v-if='! form_elements.length'><?php esc_html_e('This form is empty. Add new elements by dragging them from the right.', 'invoicing'); ?></p>
81 81
 
82 82
                     <div class="container-fluid">
83 83
                         <draggable class="section row" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 14px;">
84 84
                             <div v-for="form_element in form_elements" class="wpinv-form-builder-element-preview" :class="[{ active: active_form_element==form_element &&  active_tab=='edit_item' }, form_element.type, grid_class( form_element ) ]" @click="active_tab = 'edit_item'; active_form_element = form_element">
85 85
                                 <div class="wpinv-form-builder-element-preview-inner">
86 86
                                     <div class="wpinv-payment-form-field-preview-overlay"></div>
87
-                                    <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?>
87
+                                    <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?>
88 88
                                 </div>
89 89
                             </div>
90 90
                         </draggable>
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         </script>
104 104
         <?php
105 105
 
106
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
106
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
107 107
     }
108 108
 
109 109
     /**
@@ -111,33 +111,33 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @param int $post_id
113 113
 	 */
114
-	public static function save( $post_id ) {
114
+	public static function save($post_id) {
115 115
 
116 116
         // Prepare the form.
117
-        $form = new GetPaid_Payment_Form( $post_id );
117
+        $form = new GetPaid_Payment_Form($post_id);
118 118
 
119 119
         // Fetch form items.
120
-        $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true );
120
+        $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true);
121 121
 
122 122
         // Ensure that we have an array...
123
-        if ( empty( $form_items ) ) {
123
+        if (empty($form_items)) {
124 124
             $form_items = array();
125 125
         }
126 126
 
127 127
         // Add it to the form.
128
-        $form->set_items( self::item_to_objects( wp_kses_post_deep( $form_items ) ) );
128
+        $form->set_items(self::item_to_objects(wp_kses_post_deep($form_items)));
129 129
 
130 130
         // Save form elements.
131
-        $form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true );
132
-        if ( empty( $form_elements ) ) {
131
+        $form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true);
132
+        if (empty($form_elements)) {
133 133
             $form_elements = array();
134 134
         }
135 135
 
136
-        $form->set_elements( wp_kses_post_deep( $form_elements ) );
136
+        $form->set_elements(wp_kses_post_deep($form_elements));
137 137
 
138 138
         // Persist data to the datastore.
139 139
         $form->save();
140
-        do_action( 'getpaid_payment_form_metabox_save', $post_id, $form );
140
+        do_action('getpaid_payment_form_metabox_save', $post_id, $form);
141 141
 
142 142
     }
143 143
 
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param array $items
148 148
 	 */
149
-	public static function item_to_objects( $items ) {
149
+	public static function item_to_objects($items) {
150 150
 
151 151
         $objects = array();
152 152
 
153
-        foreach ( $items as $item ) {
154
-            $_item = new GetPaid_Form_Item( $item['id'] );
155
-            $_item->set_allow_quantities( (bool) $item['allow_quantities'] );
156
-            $_item->set_is_required( (bool) $item['required'] );
153
+        foreach ($items as $item) {
154
+            $_item = new GetPaid_Form_Item($item['id']);
155
+            $_item->set_allow_quantities((bool) $item['allow_quantities']);
156
+            $_item->set_is_required((bool) $item['required']);
157 157
             $objects[] = $_item;
158 158
         }
159 159
 
Please login to merge, or discard this patch.
includes/deprecated-functions.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
  * @deprecated
247 247
  */
248 248
 function wpinv_get_payment_key( $invoice = 0 ) {
249
-	$invoice = new WPInv_Invoice( $invoice );
249
+    $invoice = new WPInv_Invoice( $invoice );
250 250
     return $invoice->get_key();
251 251
 }
252 252
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
  * @deprecated
425 425
  */
426 426
 function wpinv_get_checkout_session() {
427
-	return false;
427
+    return false;
428 428
 }
429 429
 
430 430
 /**
@@ -1273,5 +1273,5 @@  discard block
 block discarded – undo
1273 1273
  * @deprecated
1274 1274
  */
1275 1275
 function wpinv_get_subscription( $invoice ) {
1276
-	return wpinv_get_invoice_subscription( $invoice );
1276
+    return wpinv_get_invoice_subscription( $invoice );
1277 1277
 }
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * @deprecated
@@ -19,48 +19,48 @@  discard block
 block discarded – undo
19 19
  * @deprecated
20 20
  */
21 21
 function wpinv_get_invoice_cart() {
22
-    return wpinv_get_invoice( getpaid_get_current_invoice_id() );
22
+    return wpinv_get_invoice(getpaid_get_current_invoice_id());
23 23
 }
24 24
 
25 25
 /**
26 26
  * @deprecated
27 27
  */
28
-function wpinv_get_invoice_description( $invoice ) {
29
-    $invoice = new WPInv_Invoice( $invoice );
28
+function wpinv_get_invoice_description($invoice) {
29
+    $invoice = new WPInv_Invoice($invoice);
30 30
     return $invoice->get_description();
31 31
 }
32 32
 
33 33
 /**
34 34
  * @deprecated
35 35
  */
36
-function wpinv_get_invoice_currency_code( $invoice ) {
37
-    $invoice = new WPInv_Invoice( $invoice );
36
+function wpinv_get_invoice_currency_code($invoice) {
37
+    $invoice = new WPInv_Invoice($invoice);
38 38
     return $invoice->get_currency();
39 39
 }
40 40
 
41 41
 /**
42 42
  * @deprecated
43 43
  */
44
-function wpinv_get_payment_user_email( $invoice ) {
45
-    $invoice = new WPInv_Invoice( $invoice );
44
+function wpinv_get_payment_user_email($invoice) {
45
+    $invoice = new WPInv_Invoice($invoice);
46 46
     return $invoice->get_email();
47 47
 }
48 48
 
49 49
 /**
50 50
  * @deprecated
51 51
  */
52
-function wpinv_get_user_id( $invoice ) {
53
-    $invoice = new WPInv_Invoice( $invoice );
52
+function wpinv_get_user_id($invoice) {
53
+    $invoice = new WPInv_Invoice($invoice);
54 54
     return $invoice->get_user_id();
55 55
 }
56 56
 
57 57
 /**
58 58
  * @deprecated
59 59
  */
60
-function wpinv_get_invoice_status( $invoice, $return_label = false ) {
61
-    $invoice = new WPInv_Invoice( $invoice );
60
+function wpinv_get_invoice_status($invoice, $return_label = false) {
61
+    $invoice = new WPInv_Invoice($invoice);
62 62
 
63
-    if ( $return_label ) {
63
+    if ($return_label) {
64 64
         return $invoice->get_status_nicename();
65 65
     }
66 66
 
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 /**
71 71
  * @deprecated
72 72
  */
73
-function wpinv_get_payment_gateway( $invoice, $return_label = false ) {
74
-    $invoice = new WPInv_Invoice( $invoice );
73
+function wpinv_get_payment_gateway($invoice, $return_label = false) {
74
+    $invoice = new WPInv_Invoice($invoice);
75 75
 
76
-    if ( $return_label ) {
76
+    if ($return_label) {
77 77
         return $invoice->get_gateway_title();
78 78
     }
79 79
 
@@ -83,75 +83,75 @@  discard block
 block discarded – undo
83 83
 /**
84 84
  * @deprecated
85 85
  */
86
-function wpinv_get_payment_gateway_name( $invoice ) {
87
-    return wpinv_get_payment_gateway( $invoice, true );
86
+function wpinv_get_payment_gateway_name($invoice) {
87
+    return wpinv_get_payment_gateway($invoice, true);
88 88
 }
89 89
 
90 90
 /**
91 91
  * @deprecated
92 92
  */
93
-function wpinv_get_payment_transaction_id( $invoice ) {
94
-    $invoice = new WPInv_Invoice( $invoice );
93
+function wpinv_get_payment_transaction_id($invoice) {
94
+    $invoice = new WPInv_Invoice($invoice);
95 95
     return $invoice->get_transaction_id();
96 96
 }
97 97
 
98 98
 /**
99 99
  * @deprecated
100 100
  */
101
-function wpinv_get_invoice_meta( $invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true ) {
102
-    $invoice = new WPInv_Invoice( $invoice_id );
103
-    return $invoice->get_meta( $meta_key, $single );
101
+function wpinv_get_invoice_meta($invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true) {
102
+    $invoice = new WPInv_Invoice($invoice_id);
103
+    return $invoice->get_meta($meta_key, $single);
104 104
 }
105 105
 
106 106
 /**
107 107
  * @deprecated
108 108
  */
109
-function wpinv_update_invoice_meta( $invoice_id = 0, $meta_key = '', $meta_value = '' ) {
110
-    $invoice = new WPInv_Invoice( $invoice_id );
111
-    return $invoice->update_meta_data( $meta_key, $meta_value );
109
+function wpinv_update_invoice_meta($invoice_id = 0, $meta_key = '', $meta_value = '') {
110
+    $invoice = new WPInv_Invoice($invoice_id);
111
+    return $invoice->update_meta_data($meta_key, $meta_value);
112 112
 }
113 113
 
114 114
 /**
115 115
  * @deprecated
116 116
  */
117
-function wpinv_get_items( $invoice = 0 ) {
118
-    $invoice = new WPInv_Invoice( $invoice );
117
+function wpinv_get_items($invoice = 0) {
118
+    $invoice = new WPInv_Invoice($invoice);
119 119
     return $invoice->get_items();
120 120
 }
121 121
 
122 122
 /**
123 123
  * @deprecated
124 124
  */
125
-function wpinv_get_fees( $invoice = 0 ) {
126
-    $invoice = new WPInv_Invoice( $invoice );
125
+function wpinv_get_fees($invoice = 0) {
126
+    $invoice = new WPInv_Invoice($invoice);
127 127
     return $invoice->get_fees();
128 128
 }
129 129
 
130 130
 /**
131 131
  * @deprecated
132 132
  */
133
-function wpinv_get_invoice_ip( $invoice ) {
134
-    $invoice = new WPInv_Invoice( $invoice );
133
+function wpinv_get_invoice_ip($invoice) {
134
+    $invoice = new WPInv_Invoice($invoice);
135 135
     return $invoice->get_ip();
136 136
 }
137 137
 
138 138
 /**
139 139
  * @deprecated
140 140
  */
141
-function wpinv_get_invoice_user_info( $invoice ) {
142
-    $invoice = new WPInv_Invoice( $invoice );
141
+function wpinv_get_invoice_user_info($invoice) {
142
+    $invoice = new WPInv_Invoice($invoice);
143 143
     return $invoice->get_user_info();
144 144
 }
145 145
 
146 146
 /**
147 147
  * @deprecated
148 148
  */
149
-function wpinv_subtotal( $invoice = 0, $currency = false ) {
150
-    $invoice  = new WPInv_Invoice( $invoice );
149
+function wpinv_subtotal($invoice = 0, $currency = false) {
150
+    $invoice  = new WPInv_Invoice($invoice);
151 151
     $subtotal = $invoice->get_subtotal();
152 152
 
153
-    if ( $currency ) {
154
-        return wpinv_price( $subtotal, $invoice->get_currency() );
153
+    if ($currency) {
154
+        return wpinv_price($subtotal, $invoice->get_currency());
155 155
     }
156 156
 
157 157
     return $subtotal;
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 /**
161 161
  * @deprecated
162 162
  */
163
-function wpinv_tax( $invoice = 0, $currency = false ) {
164
-    $invoice  = new WPInv_Invoice( $invoice );
163
+function wpinv_tax($invoice = 0, $currency = false) {
164
+    $invoice  = new WPInv_Invoice($invoice);
165 165
     $tax      = $invoice->get_total_tax();
166 166
 
167
-    if ( $currency ) {
168
-        return wpinv_price( $tax, $invoice->get_currency() );
167
+    if ($currency) {
168
+        return wpinv_price($tax, $invoice->get_currency());
169 169
     }
170 170
 
171 171
     return $tax;
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 /**
175 175
  * @deprecated
176 176
  */
177
-function wpinv_discount( $invoice = 0, $currency = false ) {
178
-    $invoice  = new WPInv_Invoice( $invoice );
177
+function wpinv_discount($invoice = 0, $currency = false) {
178
+    $invoice  = new WPInv_Invoice($invoice);
179 179
     $discount = $invoice->get_total_discount();
180 180
 
181
-    if ( $currency ) {
182
-        return wpinv_price( $discount, $invoice->get_currency() );
181
+    if ($currency) {
182
+        return wpinv_price($discount, $invoice->get_currency());
183 183
     }
184 184
 
185 185
     return $discount;
@@ -188,20 +188,20 @@  discard block
 block discarded – undo
188 188
 /**
189 189
  * @deprecated
190 190
  */
191
-function wpinv_discount_code( $invoice = 0 ) {
192
-    $invoice = new WPInv_Invoice( $invoice );
191
+function wpinv_discount_code($invoice = 0) {
192
+    $invoice = new WPInv_Invoice($invoice);
193 193
     return $invoice->get_discount_code();
194 194
 }
195 195
 
196 196
 /**
197 197
  * @deprecated
198 198
  */
199
-function wpinv_payment_total( $invoice = 0, $currency = false ) {
200
-    $invoice  = new WPInv_Invoice( $invoice );
199
+function wpinv_payment_total($invoice = 0, $currency = false) {
200
+    $invoice = new WPInv_Invoice($invoice);
201 201
     $total = $invoice->get_total();
202 202
 
203
-    if ( $currency ) {
204
-        return wpinv_price( $total, $invoice->get_currency() );
203
+    if ($currency) {
204
+        return wpinv_price($total, $invoice->get_currency());
205 205
     }
206 206
 
207 207
     return $total;
@@ -210,51 +210,51 @@  discard block
 block discarded – undo
210 210
 /**
211 211
  * @deprecated
212 212
  */
213
-function wpinv_get_date_created( $invoice = 0, $format = '' ) {
214
-    $invoice = new WPInv_Invoice( $invoice );
213
+function wpinv_get_date_created($invoice = 0, $format = '') {
214
+    $invoice = new WPInv_Invoice($invoice);
215 215
 
216
-    $format         = ! empty( $format ) ? $format : get_option( 'date_format' );
216
+    $format         = !empty($format) ? $format : get_option('date_format');
217 217
     $date_created   = $invoice->get_created_date();
218 218
 
219
-    return empty( $date_created ) ? date_i18n( $format, strtotime( $date_created ) ) : '';
219
+    return empty($date_created) ? date_i18n($format, strtotime($date_created)) : '';
220 220
 }
221 221
 
222 222
 /**
223 223
  * @deprecated
224 224
  */
225
-function wpinv_get_invoice_date( $invoice = 0, $format = '' ) {
226
-    wpinv_get_date_created( $invoice, $format );
225
+function wpinv_get_invoice_date($invoice = 0, $format = '') {
226
+    wpinv_get_date_created($invoice, $format);
227 227
 }
228 228
 
229 229
 /**
230 230
  * @deprecated
231 231
  */
232
-function wpinv_get_invoice_vat_number( $invoice = 0 ) {
233
-    $invoice = new WPInv_Invoice( $invoice );
232
+function wpinv_get_invoice_vat_number($invoice = 0) {
233
+    $invoice = new WPInv_Invoice($invoice);
234 234
     return $invoice->get_vat_number();
235 235
 }
236 236
 
237 237
 /**
238 238
  * @deprecated
239 239
  */
240
-function wpinv_insert_payment_note( $invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false ) {
241
-    $invoice = new WPInv_Invoice( $invoice );
242
-    return $invoice->add_note( $note, $user_type, $added_by_user, $system );
240
+function wpinv_insert_payment_note($invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false) {
241
+    $invoice = new WPInv_Invoice($invoice);
242
+    return $invoice->add_note($note, $user_type, $added_by_user, $system);
243 243
 }
244 244
 
245 245
 /**
246 246
  * @deprecated
247 247
  */
248
-function wpinv_get_payment_key( $invoice = 0 ) {
249
-	$invoice = new WPInv_Invoice( $invoice );
248
+function wpinv_get_payment_key($invoice = 0) {
249
+	$invoice = new WPInv_Invoice($invoice);
250 250
     return $invoice->get_key();
251 251
 }
252 252
 
253 253
 /**
254 254
  * @deprecated
255 255
  */
256
-function wpinv_get_invoice_number( $invoice = 0 ) {
257
-    $invoice = new WPInv_Invoice( $invoice );
256
+function wpinv_get_invoice_number($invoice = 0) {
257
+    $invoice = new WPInv_Invoice($invoice);
258 258
     return $invoice->get_number();
259 259
 }
260 260
 
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
 /**
402 402
  * @deprecated
403 403
  */
404
-function wpinv_update_payment_status( $invoice, $new_status = 'publish' ) {
405
-    $invoice = new WPInv_Invoice( $invoice );
406
-    return $invoice->update_status( $new_status );
404
+function wpinv_update_payment_status($invoice, $new_status = 'publish') {
405
+    $invoice = new WPInv_Invoice($invoice);
406
+    return $invoice->update_status($new_status);
407 407
 }
408 408
 
409 409
 /**
@@ -456,22 +456,22 @@  discard block
 block discarded – undo
456 456
 /**
457 457
  * @deprecated
458 458
  */
459
-function wpinv_set_payment_transaction_id( $invoice_id = 0, $transaction_id = '' ) {
459
+function wpinv_set_payment_transaction_id($invoice_id = 0, $transaction_id = '') {
460 460
 
461 461
     // Fetch the invoice.
462
-    $invoice = new WPInv_Invoice( $invoice_id );
462
+    $invoice = new WPInv_Invoice($invoice_id);
463 463
 
464
-    if ( 0 == $invoice->get_id() ) {
464
+    if (0 == $invoice->get_id()) {
465 465
         return false;
466 466
     }
467 467
 
468 468
     // Prepare the transaction id.
469
-    if ( empty( $transaction_id ) ) {
469
+    if (empty($transaction_id)) {
470 470
         $transaction_id = $invoice_id;
471 471
     }
472 472
 
473 473
     // Set the transaction id;
474
-    $invoice->set_transaction_id( apply_filters( 'wpinv_set_payment_transaction_id', $transaction_id, $invoice ) );
474
+    $invoice->set_transaction_id(apply_filters('wpinv_set_payment_transaction_id', $transaction_id, $invoice));
475 475
 
476 476
     // Save the invoice.
477 477
     return $invoice->save();
@@ -484,12 +484,12 @@  discard block
 block discarded – undo
484 484
  * @param WPInv_Invoice $invoice
485 485
  * @param string $gateway
486 486
  */
487
-function wpinv_send_to_gateway( $gateway, $invoice ) {
487
+function wpinv_send_to_gateway($gateway, $invoice) {
488 488
 
489 489
     $payment_data = array(
490 490
         'invoice_id'     => $invoice->get_id(),
491 491
         'items'          => $invoice->get_cart_details(),
492
-        'cart_discounts' => array( $invoice->get_discount_code() ),
492
+        'cart_discounts' => array($invoice->get_discount_code()),
493 493
         'fees'           => $invoice->get_total_fees(),
494 494
         'subtotal'       => $invoice->get_subtotal(),
495 495
         'discount'       => $invoice->get_total_discount(),
@@ -497,16 +497,16 @@  discard block
 block discarded – undo
497 497
         'price'          => $invoice->get_total(),
498 498
         'invoice_key'    => $invoice->get_key(),
499 499
         'user_email'     => $invoice->get_email(),
500
-        'date'           => gmdate( 'Y-m-d H:i:s', time() ),
500
+        'date'           => gmdate('Y-m-d H:i:s', time()),
501 501
         'user_info'      => $invoice->get_user_info(),
502
-        'post_data'      => wp_kses_post_deep( wp_unslash( $_POST ) ),
502
+        'post_data'      => wp_kses_post_deep(wp_unslash($_POST)),
503 503
         'cart_details'   => $invoice->get_cart_details(),
504 504
         'gateway'        => $gateway,
505 505
         'card_info'      => array(),
506
-        'gateway_nonce'  => wp_create_nonce( 'wpi-gateway' ),
506
+        'gateway_nonce'  => wp_create_nonce('wpi-gateway'),
507 507
     );
508 508
 
509
-    do_action( 'wpinv_gateway_' . $gateway, $payment_data );
509
+    do_action('wpinv_gateway_' . $gateway, $payment_data);
510 510
 }
511 511
 
512 512
 /**
@@ -519,10 +519,10 @@  discard block
 block discarded – undo
519 519
 /**
520 520
  * @deprecated
521 521
  */
522
-function wpinv_die( $message = '', $title = '', $status = 400 ) {
523
-    add_filter( 'wp_die_ajax_handler', 'wpinv_die_handler', 10, 3 );
524
-    add_filter( 'wp_die_handler', 'wpinv_die_handler', 10, 3 );
525
-    wp_die( esc_html( $message ), esc_html( $title ), array( 'response' => (int) $status ) );
522
+function wpinv_die($message = '', $title = '', $status = 400) {
523
+    add_filter('wp_die_ajax_handler', 'wpinv_die_handler', 10, 3);
524
+    add_filter('wp_die_handler', 'wpinv_die_handler', 10, 3);
525
+    wp_die(esc_html($message), esc_html($title), array('response' => (int) $status));
526 526
 }
527 527
 
528 528
 /**
@@ -640,14 +640,14 @@  discard block
 block discarded – undo
640 640
 /**
641 641
  * @deprecated
642 642
  */
643
-function wpinv_invoice_status_label( $status, $status_display = '' ) {
644
-    return empty( $status_display ) ? sanitize_text_field( $status ) : sanitize_text_field( $status_display );
643
+function wpinv_invoice_status_label($status, $status_display = '') {
644
+    return empty($status_display) ? sanitize_text_field($status) : sanitize_text_field($status_display);
645 645
 }
646 646
 
647 647
 /**
648 648
  * @deprecated
649 649
  */
650
-function wpinv_clean_invoice_number( $number ) {
650
+function wpinv_clean_invoice_number($number) {
651 651
     return $number;
652 652
 }
653 653
 
@@ -852,12 +852,12 @@  discard block
 block discarded – undo
852 852
 /**
853 853
  * @deprecated
854 854
  */
855
-function wpinv_item_show_price( $item_id = 0, $echo = true ) {
855
+function wpinv_item_show_price($item_id = 0, $echo = true) {
856 856
 
857
-    if ( $echo ) {
858
-        echo wp_kses_post( wpinv_item_price( $item_id ) );
857
+    if ($echo) {
858
+        echo wp_kses_post(wpinv_item_price($item_id));
859 859
     } else {
860
-        return wpinv_item_price( $item_id );
860
+        return wpinv_item_price($item_id);
861 861
     }
862 862
 
863 863
 }
@@ -1272,6 +1272,6 @@  discard block
 block discarded – undo
1272 1272
  * @return WPInv_Subscription|bool
1273 1273
  * @deprecated
1274 1274
  */
1275
-function wpinv_get_subscription( $invoice ) {
1276
-	return wpinv_get_invoice_subscription( $invoice );
1275
+function wpinv_get_subscription($invoice) {
1276
+	return wpinv_get_invoice_subscription($invoice);
1277 1277
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-subscription.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 if ( ! defined( 'ABSPATH' ) ) {
9
-	exit; // Exit if accessed directly
9
+    exit; // Exit if accessed directly
10 10
 }
11 11
 
12 12
 /**
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 class GetPaid_Meta_Box_Invoice_Subscription {
16 16
 
17 17
     /**
18
-	 * Output the subscription metabox.
19
-	 *
20
-	 * @param WP_Post $post
21
-	 */
18
+     * Output the subscription metabox.
19
+     *
20
+     * @param WP_Post $post
21
+     */
22 22
     public static function output( $post ) {
23 23
 
24 24
         // Fetch the invoice.
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
     }
35 35
 
36 36
     /**
37
-	 * Output the subscription invoices.
38
-	 *
39
-	 * @param WP_Post $post
40
-	 */
37
+     * Output the subscription invoices.
38
+     *
39
+     * @param WP_Post $post
40
+     */
41 41
     public static function output_invoices( $post ) {
42 42
 
43 43
         // Fetch the invoice.
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
     }
54 54
 
55 55
     /**
56
-	 * Outputs related subscriptions.
57
-	 *
58
-	 * @param WP_Post $post
59
-	 */
56
+     * Outputs related subscriptions.
57
+     *
58
+     * @param WP_Post $post
59
+     */
60 60
     public static function output_related( $post ) {
61 61
 
62 62
         // Fetch the invoice.
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 	exit; // Exit if accessed directly
10 10
 }
11 11
 
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @param WP_Post $post
21 21
 	 */
22
-    public static function output( $post ) {
22
+    public static function output($post) {
23 23
 
24 24
         // Fetch the invoice.
25
-        $invoice = new WPInv_Invoice( $post );
25
+        $invoice = new WPInv_Invoice($post);
26 26
 
27 27
         // Fetch the subscription.
28
-        $subscription = getpaid_get_invoice_subscription( $invoice );
28
+        $subscription = getpaid_get_invoice_subscription($invoice);
29 29
 
30 30
         echo '<div class="bsui">';
31
-        getpaid_admin_subscription_details_metabox( /** @scrutinizer ignore-type */$subscription );
31
+        getpaid_admin_subscription_details_metabox(/** @scrutinizer ignore-type */$subscription);
32 32
         echo '</div>';
33 33
 
34 34
     }
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param WP_Post $post
40 40
 	 */
41
-    public static function output_invoices( $post ) {
41
+    public static function output_invoices($post) {
42 42
 
43 43
         // Fetch the invoice.
44
-        $invoice = new WPInv_Invoice( $post );
44
+        $invoice = new WPInv_Invoice($post);
45 45
 
46 46
         // Fetch the subscription.
47
-        $subscription = getpaid_get_invoice_subscription( $invoice );
47
+        $subscription = getpaid_get_invoice_subscription($invoice);
48 48
 
49 49
         echo '<div class="bsui">';
50
-        getpaid_admin_subscription_invoice_details_metabox( /** @scrutinizer ignore-type */$subscription, false );
50
+        getpaid_admin_subscription_invoice_details_metabox(/** @scrutinizer ignore-type */$subscription, false);
51 51
         echo '</div>';
52 52
 
53 53
     }
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @param WP_Post $post
59 59
 	 */
60
-    public static function output_related( $post ) {
60
+    public static function output_related($post) {
61 61
 
62 62
         // Fetch the invoice.
63
-        $invoice = new WPInv_Invoice( $post );
63
+        $invoice = new WPInv_Invoice($post);
64 64
 
65 65
         // Fetch the subscription.
66
-        $subscription = getpaid_get_invoice_subscription( $invoice );
66
+        $subscription = getpaid_get_invoice_subscription($invoice);
67 67
 
68 68
         echo '<div class="bsui">';
69
-        getpaid_admin_subscription_related_subscriptions_metabox( /** @scrutinizer ignore-type */$subscription, false );
69
+        getpaid_admin_subscription_related_subscriptions_metabox(/** @scrutinizer ignore-type */$subscription, false);
70 70
         echo '</div>';
71 71
 
72 72
     }
Please login to merge, or discard this patch.
includes/wpinv-payment-functions.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@
 block discarded – undo
239 239
         do_action( 'getpaid_checkout_invoice_exception', $invoice );
240 240
     }
241 241
 
242
-	// Do we have any errors?
242
+    // Do we have any errors?
243 243
     if ( wpinv_get_errors() ) {
244 244
         $response['data'] = getpaid_get_errors_html( true, false );
245 245
     } else {
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -1,155 +1,155 @@  discard block
 block discarded – undo
1 1
 <?php
2
-function wpinv_is_subscription_payment( $invoice = '' ) {
3
-    if ( empty( $invoice ) ) {
2
+function wpinv_is_subscription_payment($invoice = '') {
3
+    if (empty($invoice)) {
4 4
         return false;
5 5
     }
6 6
 
7
-    if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) {
8
-        $invoice = wpinv_get_invoice( $invoice );
7
+    if (!is_object($invoice) && is_scalar($invoice)) {
8
+        $invoice = wpinv_get_invoice($invoice);
9 9
     }
10 10
 
11
-    if ( empty( $invoice ) ) {
11
+    if (empty($invoice)) {
12 12
         return false;
13 13
     }
14 14
 
15
-    if ( $invoice->is_renewal() ) {
15
+    if ($invoice->is_renewal()) {
16 16
         return true;
17 17
     }
18 18
 
19 19
     return false;
20 20
 }
21 21
 
22
-function wpinv_payment_link_transaction_id( $invoice = '' ) {
23
-    if ( empty( $invoice ) ) {
22
+function wpinv_payment_link_transaction_id($invoice = '') {
23
+    if (empty($invoice)) {
24 24
         return false;
25 25
     }
26 26
 
27
-    if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) {
28
-        $invoice = wpinv_get_invoice( $invoice );
27
+    if (!is_object($invoice) && is_scalar($invoice)) {
28
+        $invoice = wpinv_get_invoice($invoice);
29 29
     }
30 30
 
31
-    if ( empty( $invoice ) ) {
31
+    if (empty($invoice)) {
32 32
         return false;
33 33
     }
34 34
 
35
-    return apply_filters( 'wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice );
35
+    return apply_filters('wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice);
36 36
 }
37 37
 
38
-function wpinv_subscription_initial_payment_desc( $amount, $period, $interval, $trial_period = '', $trial_interval = 0 ) {
39
-    $interval   = (int)$interval > 0 ? (int)$interval : 1;
38
+function wpinv_subscription_initial_payment_desc($amount, $period, $interval, $trial_period = '', $trial_interval = 0) {
39
+    $interval   = (int) $interval > 0 ? (int) $interval : 1;
40 40
 
41
-    if ( $trial_interval > 0 && ! empty( $trial_period ) ) {
42
-        $amount = __( 'Free', 'invoicing' );
41
+    if ($trial_interval > 0 && !empty($trial_period)) {
42
+        $amount = __('Free', 'invoicing');
43 43
         $interval = $trial_interval;
44 44
         $period = $trial_period;
45 45
     }
46 46
 
47 47
     $description = '';
48
-    switch ( $period ) {
48
+    switch ($period) {
49 49
         case 'D':
50 50
         case 'day':
51
-            $description = wp_sprintf( _n( '%s for the first day.', '%1$s for the first %2$d days.', $interval, 'invoicing' ), $amount, $interval );
51
+            $description = wp_sprintf(_n('%s for the first day.', '%1$s for the first %2$d days.', $interval, 'invoicing'), $amount, $interval);
52 52
             break;
53 53
         case 'W':
54 54
         case 'week':
55
-            $description = wp_sprintf( _n( '%s for the first week.', '%1$s for the first %2$d weeks.', $interval, 'invoicing' ), $amount, $interval );
55
+            $description = wp_sprintf(_n('%s for the first week.', '%1$s for the first %2$d weeks.', $interval, 'invoicing'), $amount, $interval);
56 56
             break;
57 57
         case 'M':
58 58
         case 'month':
59
-            $description = wp_sprintf( _n( '%s for the first month.', '%1$s for the first %2$d months.', $interval, 'invoicing' ), $amount, $interval );
59
+            $description = wp_sprintf(_n('%s for the first month.', '%1$s for the first %2$d months.', $interval, 'invoicing'), $amount, $interval);
60 60
             break;
61 61
         case 'Y':
62 62
         case 'year':
63
-            $description = wp_sprintf( _n( '%s for the first year.', '%1$s for the first %2$d years.', $interval, 'invoicing' ), $amount, $interval );
63
+            $description = wp_sprintf(_n('%s for the first year.', '%1$s for the first %2$d years.', $interval, 'invoicing'), $amount, $interval);
64 64
             break;
65 65
     }
66 66
 
67
-    return apply_filters( 'wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval );
67
+    return apply_filters('wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval);
68 68
 }
69 69
 
70
-function wpinv_subscription_recurring_payment_desc( $amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0 ) {
71
-    $interval   = (int)$interval > 0 ? (int)$interval : 1;
72
-    $bill_times = (int)$bill_times > 0 ? (int)$bill_times : 0;
70
+function wpinv_subscription_recurring_payment_desc($amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0) {
71
+    $interval   = (int) $interval > 0 ? (int) $interval : 1;
72
+    $bill_times = (int) $bill_times > 0 ? (int) $bill_times : 0;
73 73
 
74 74
     $description = '';
75
-    switch ( $period ) {
75
+    switch ($period) {
76 76
         case 'D':
77 77
         case 'day':
78
-            if ( (int)$bill_times > 0 ) {
79
-                if ( $interval > 1 ) {
80
-                    if ( $bill_times > 1 ) {
81
-                        $description = wp_sprintf( __( '%1$s for each %2$d days, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
78
+            if ((int) $bill_times > 0) {
79
+                if ($interval > 1) {
80
+                    if ($bill_times > 1) {
81
+                        $description = wp_sprintf(__('%1$s for each %2$d days, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times);
82 82
                     } else {
83
-                        $description = wp_sprintf( __( '%1$s for %2$d days.', 'invoicing' ), $amount, $interval );
83
+                        $description = wp_sprintf(__('%1$s for %2$d days.', 'invoicing'), $amount, $interval);
84 84
                     }
85 85
                 } else {
86
-                    $description = wp_sprintf( _n( '%s for one day.', '%1$s for each day, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
86
+                    $description = wp_sprintf(_n('%s for one day.', '%1$s for each day, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times);
87 87
                 }
88 88
             } else {
89
-                $description = wp_sprintf( _n( '%s for each day.', '%1$s for each %2$d days.', $interval, 'invoicing' ), $amount, $interval );
89
+                $description = wp_sprintf(_n('%s for each day.', '%1$s for each %2$d days.', $interval, 'invoicing'), $amount, $interval);
90 90
             }
91 91
             break;
92 92
         case 'W':
93 93
         case 'week':
94
-            if ( (int)$bill_times > 0 ) {
95
-                if ( $interval > 1 ) {
96
-                    if ( $bill_times > 1 ) {
97
-                        $description = wp_sprintf( __( '%1$s for each %2$d weeks, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
94
+            if ((int) $bill_times > 0) {
95
+                if ($interval > 1) {
96
+                    if ($bill_times > 1) {
97
+                        $description = wp_sprintf(__('%1$s for each %2$d weeks, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times);
98 98
                     } else {
99
-                        $description = wp_sprintf( __( '%1$s for %2$d weeks.', 'invoicing' ), $amount, $interval );
99
+                        $description = wp_sprintf(__('%1$s for %2$d weeks.', 'invoicing'), $amount, $interval);
100 100
                     }
101 101
                 } else {
102
-                    $description = wp_sprintf( _n( '%s for one week.', '%1$s for each week, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
102
+                    $description = wp_sprintf(_n('%s for one week.', '%1$s for each week, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times);
103 103
                 }
104 104
             } else {
105
-                $description = wp_sprintf( _n( '%s for each week.', '%1$s for each %2$d weeks.', $interval, 'invoicing' ), $amount, $interval );
105
+                $description = wp_sprintf(_n('%s for each week.', '%1$s for each %2$d weeks.', $interval, 'invoicing'), $amount, $interval);
106 106
             }
107 107
             break;
108 108
         case 'M':
109 109
         case 'month':
110
-            if ( (int)$bill_times > 0 ) {
111
-                if ( $interval > 1 ) {
112
-                    if ( $bill_times > 1 ) {
113
-                        $description = wp_sprintf( __( '%1$s for each %2$d months, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
110
+            if ((int) $bill_times > 0) {
111
+                if ($interval > 1) {
112
+                    if ($bill_times > 1) {
113
+                        $description = wp_sprintf(__('%1$s for each %2$d months, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times);
114 114
                     } else {
115
-                        $description = wp_sprintf( __( '%1$s for %2$d months.', 'invoicing' ), $amount, $interval );
115
+                        $description = wp_sprintf(__('%1$s for %2$d months.', 'invoicing'), $amount, $interval);
116 116
                     }
117 117
                 } else {
118
-                    $description = wp_sprintf( _n( '%s for one month.', '%1$s for each month, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
118
+                    $description = wp_sprintf(_n('%s for one month.', '%1$s for each month, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times);
119 119
                 }
120 120
             } else {
121
-                $description = wp_sprintf( _n( '%s for each month.', '%1$s for each %2$d months.', $interval, 'invoicing' ), $amount, $interval );
121
+                $description = wp_sprintf(_n('%s for each month.', '%1$s for each %2$d months.', $interval, 'invoicing'), $amount, $interval);
122 122
             }
123 123
             break;
124 124
         case 'Y':
125 125
         case 'year':
126
-            if ( (int)$bill_times > 0 ) {
127
-                if ( $interval > 1 ) {
128
-                    if ( $bill_times > 1 ) {
129
-                        $description = wp_sprintf( __( '%1$s for each %2$d years, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
126
+            if ((int) $bill_times > 0) {
127
+                if ($interval > 1) {
128
+                    if ($bill_times > 1) {
129
+                        $description = wp_sprintf(__('%1$s for each %2$d years, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times);
130 130
                     } else {
131
-                        $description = wp_sprintf( __( '%1$s for %2$d years.', 'invoicing' ), $amount, $interval );
131
+                        $description = wp_sprintf(__('%1$s for %2$d years.', 'invoicing'), $amount, $interval);
132 132
                     }
133 133
                 } else {
134
-                    $description = wp_sprintf( _n( '%s for one year.', '%1$s for each year, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
134
+                    $description = wp_sprintf(_n('%s for one year.', '%1$s for each year, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times);
135 135
                 }
136 136
             } else {
137
-                $description = wp_sprintf( _n( '%s for each year.', '%1$s for each %2$d years.', $interval, 'invoicing' ), $amount, $interval );
137
+                $description = wp_sprintf(_n('%s for each year.', '%1$s for each %2$d years.', $interval, 'invoicing'), $amount, $interval);
138 138
             }
139 139
             break;
140 140
     }
141 141
 
142
-    return apply_filters( 'wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval );
142
+    return apply_filters('wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval);
143 143
 }
144 144
 
145
-function wpinv_subscription_payment_desc( $invoice ) {
146
-    if ( empty( $invoice ) ) {
145
+function wpinv_subscription_payment_desc($invoice) {
146
+    if (empty($invoice)) {
147 147
         return null;
148 148
     }
149 149
 
150 150
     $description = '';
151
-    if ( $invoice->is_parent() && $item = $invoice->get_recurring( true ) ) {
152
-        if ( $item->has_free_trial() ) {
151
+    if ($invoice->is_parent() && $item = $invoice->get_recurring(true)) {
152
+        if ($item->has_free_trial()) {
153 153
             $trial_period = $item->get_trial_period();
154 154
             $trial_interval = $item->get_trial_interval();
155 155
         } else {
@@ -157,40 +157,40 @@  discard block
 block discarded – undo
157 157
             $trial_interval = 0;
158 158
         }
159 159
 
160
-        $description = wpinv_get_billing_cycle( $invoice->get_total(), $invoice->get_recurring_details( 'total' ), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency() );
160
+        $description = wpinv_get_billing_cycle($invoice->get_total(), $invoice->get_recurring_details('total'), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency());
161 161
     }
162 162
 
163
-    return apply_filters( 'wpinv_subscription_payment_desc', $description, $invoice );
163
+    return apply_filters('wpinv_subscription_payment_desc', $description, $invoice);
164 164
 }
165 165
 
166
-function wpinv_get_billing_cycle( $initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '' ) {
167
-    $initial_total      = wpinv_round_amount( $initial );
168
-    $recurring_total    = wpinv_round_amount( $recurring );
166
+function wpinv_get_billing_cycle($initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '') {
167
+    $initial_total      = wpinv_round_amount($initial);
168
+    $recurring_total    = wpinv_round_amount($recurring);
169 169
 
170
-    if ( $trial_interval > 0 && ! empty( $trial_period ) ) {
170
+    if ($trial_interval > 0 && !empty($trial_period)) {
171 171
         // Free trial
172 172
     } else {
173
-        if ( $bill_times == 1 ) {
173
+        if ($bill_times == 1) {
174 174
             $recurring_total = $initial_total;
175
-        } elseif ( $bill_times > 1 && $initial_total != $recurring_total ) {
175
+        } elseif ($bill_times > 1 && $initial_total != $recurring_total) {
176 176
             $bill_times--;
177 177
         }
178 178
     }
179 179
 
180
-    $initial_amount     = wpinv_price( $initial_total, $currency );
181
-    $recurring_amount   = wpinv_price( $recurring_total, $currency );
180
+    $initial_amount     = wpinv_price($initial_total, $currency);
181
+    $recurring_amount   = wpinv_price($recurring_total, $currency);
182 182
 
183
-    $recurring          = wpinv_subscription_recurring_payment_desc( $recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval );
183
+    $recurring          = wpinv_subscription_recurring_payment_desc($recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval);
184 184
 
185
-    if ( $initial_total != $recurring_total ) {
186
-        $initial        = wpinv_subscription_initial_payment_desc( $initial_amount, $period, $interval, $trial_period, $trial_interval );
185
+    if ($initial_total != $recurring_total) {
186
+        $initial        = wpinv_subscription_initial_payment_desc($initial_amount, $period, $interval, $trial_period, $trial_interval);
187 187
 
188
-        $description    = wp_sprintf( __( '%1$s Then %2$s', 'invoicing' ), $initial, $recurring );
188
+        $description    = wp_sprintf(__('%1$s Then %2$s', 'invoicing'), $initial, $recurring);
189 189
     } else {
190 190
         $description    = $recurring;
191 191
     }
192 192
 
193
-    return apply_filters( 'wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency );
193
+    return apply_filters('wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency);
194 194
 }
195 195
 
196 196
 /**
@@ -200,27 +200,27 @@  discard block
 block discarded – undo
200 200
  * @param string $card_number Card number.
201 201
  * @return string
202 202
  */
203
-function getpaid_get_card_name( $card_number ) {
203
+function getpaid_get_card_name($card_number) {
204 204
 
205 205
     // Known regexes.
206 206
     $regexes = array(
207
-        '/^4/'                     => __( 'Visa', 'invoicing' ),
208
-        '/^5[1-5]/'                => __( 'Mastercard', 'invoicing' ),
209
-        '/^3[47]/'                 => __( 'Amex', 'invoicing' ),
210
-        '/^3(?:0[0-5]|[68])/'      => __( 'Diners Club', 'invoicing' ),
211
-        '/^6(?:011|5)/'            => __( 'Discover', 'invoicing' ),
212
-        '/^(?:2131|1800|35\d{3})/' => __( 'JCB', 'invoicing' ),
207
+        '/^4/'                     => __('Visa', 'invoicing'),
208
+        '/^5[1-5]/'                => __('Mastercard', 'invoicing'),
209
+        '/^3[47]/'                 => __('Amex', 'invoicing'),
210
+        '/^3(?:0[0-5]|[68])/'      => __('Diners Club', 'invoicing'),
211
+        '/^6(?:011|5)/'            => __('Discover', 'invoicing'),
212
+        '/^(?:2131|1800|35\d{3})/' => __('JCB', 'invoicing'),
213 213
     );
214 214
 
215 215
     // Confirm if one matches.
216
-    foreach ( $regexes as $regex => $card ) {
217
-        if ( preg_match( $regex, $card_number ) >= 1 ) {
216
+    foreach ($regexes as $regex => $card) {
217
+        if (preg_match($regex, $card_number) >= 1) {
218 218
             return $card;
219 219
         }
220 220
     }
221 221
 
222 222
     // None matched.
223
-    return __( 'Card', 'invoicing' );
223
+    return __('Card', 'invoicing');
224 224
 
225 225
 }
226 226
 
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
  *
230 230
  * @param WPInv_Invoice|int|null $invoice
231 231
  */
232
-function wpinv_send_back_to_checkout( $invoice = null ) {
233
-    $response = array( 'success' => false );
234
-    $invoice  = wpinv_get_invoice( $invoice );
232
+function wpinv_send_back_to_checkout($invoice = null) {
233
+    $response = array('success' => false);
234
+    $invoice  = wpinv_get_invoice($invoice);
235 235
 
236 236
     // Was an invoice created?
237
-    if ( ! empty( $invoice ) ) {
238
-        $invoice             = is_scalar( $invoice ) ? new WPInv_Invoice( $invoice ) : $invoice;
237
+    if (!empty($invoice)) {
238
+        $invoice             = is_scalar($invoice) ? new WPInv_Invoice($invoice) : $invoice;
239 239
         $response['invoice'] = $invoice->get_id();
240
-        do_action( 'getpaid_checkout_invoice_exception', $invoice );
240
+        do_action('getpaid_checkout_invoice_exception', $invoice);
241 241
     }
242 242
 
243 243
 	// Do we have any errors?
244
-    if ( wpinv_get_errors() ) {
245
-        $response['data'] = getpaid_get_errors_html( true, false );
244
+    if (wpinv_get_errors()) {
245
+        $response['data'] = getpaid_get_errors_html(true, false);
246 246
     } else {
247
-        $response['data'] = __( 'An error occured while processing your payment. Please try again.', 'invoicing' );
247
+        $response['data'] = __('An error occured while processing your payment. Please try again.', 'invoicing');
248 248
     }
249 249
 
250
-    wp_send_json( $response );
250
+    wp_send_json($response);
251 251
 }
Please login to merge, or discard this patch.