Passed
Push — master ( 825506...0612be )
by Brian
05:08
created
includes/error-functions.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -117,14 +117,14 @@
 block discarded – undo
117 117
  */
118 118
 function getpaid_doing_it_wrong( $function, $message, $version ) {
119 119
 
120
-	$message .= ' Backtrace: ' . wp_debug_backtrace_summary();
121
-
122
-	if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) {
123
-		do_action( 'doing_it_wrong_run', $function, $message, $version );
124
-		error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
125
-	} else {
126
-		_doing_it_wrong( $function, $message, $version );
127
-	}
120
+    $message .= ' Backtrace: ' . wp_debug_backtrace_summary();
121
+
122
+    if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) {
123
+        do_action( 'doing_it_wrong_run', $function, $message, $version );
124
+        error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
125
+    } else {
126
+        _doing_it_wrong( $function, $message, $version );
127
+    }
128 128
 
129 129
 }
130 130
 
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 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
  * Returns the errors as html
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
  * @param bool $wrap whether or not to wrap the errors.
16 16
  * @since  1.0.19
17 17
  */
18
-function getpaid_get_errors_html( $clear = true, $wrap = true ) {
18
+function getpaid_get_errors_html($clear = true, $wrap = true) {
19 19
 
20 20
     $errors = '';
21
-    foreach ( wpinv_get_errors() as $id => $error ) {
22
-        $type     = 'error';
21
+    foreach (wpinv_get_errors() as $id => $error) {
22
+        $type = 'error';
23 23
 
24
-        if ( is_array( $error ) ) {
24
+        if (is_array($error)) {
25 25
             $type  = $error['type'];
26 26
             $error = $error['text'];
27 27
         }
28 28
 
29
-        if ( $wrap ) {
29
+        if ($wrap) {
30 30
 
31 31
             $errors .= aui()->alert(
32 32
                 array(
33
-                    'content'     => wp_kses_post( $error ),
33
+                    'content'     => wp_kses_post($error),
34 34
                     'type'        => $type,
35 35
                 )
36 36
             );
37 37
 
38 38
         } else {
39 39
 
40
-            $id      = esc_attr( $id );
41
-            $error   = wp_kses_post( $error );
40
+            $id      = esc_attr($id);
41
+            $error   = wp_kses_post($error);
42 42
             $errors .= "<div data-code='$id'>$error</div>";
43 43
         }
44 44
 
45 45
     }
46 46
 
47
-    if ( $clear ){
47
+    if ($clear) {
48 48
         wpinv_clear_errors();
49 49
     }
50 50
 
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
  * @return array
66 66
  */
67 67
 function wpinv_get_errors() {
68
-    $errors = getpaid_session()->get( 'wpinv_errors' );
69
-    return is_array( $errors ) ? $errors : array();
68
+    $errors = getpaid_session()->get('wpinv_errors');
69
+    return is_array($errors) ? $errors : array();
70 70
 }
71 71
 
72 72
 /**
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
  * @param string $error_message The error message.
77 77
  * @param string $type Either error, info, warning, primary, dark, light or success.
78 78
  */
79
-function wpinv_set_error( $error_id, $error_message, $type = 'error' ) {
79
+function wpinv_set_error($error_id, $error_message, $type = 'error') {
80 80
 
81 81
     $errors              = wpinv_get_errors();
82
-    $errors[ $error_id ] = array(
82
+    $errors[$error_id] = array(
83 83
         'type' =>  $type,
84 84
         'text' =>  $error_message,
85 85
     );
86 86
 
87
-    getpaid_session()->set( 'wpinv_errors', $errors );
87
+    getpaid_session()->set('wpinv_errors', $errors);
88 88
 }
89 89
 
90 90
 /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
  * 
93 93
  */
94 94
 function wpinv_has_errors() {
95
-    return count( wpinv_get_errors() ) > 0;
95
+    return count(wpinv_get_errors()) > 0;
96 96
 }
97 97
 
98 98
 /**
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
  * 
101 101
  */
102 102
 function wpinv_clear_errors() {
103
-    getpaid_session()->set( 'wpinv_errors', null );
103
+    getpaid_session()->set('wpinv_errors', null);
104 104
 }
105 105
 
106 106
 /**
107 107
  * Clears a single error.
108 108
  * 
109 109
  */
110
-function wpinv_unset_error( $error_id ) {
110
+function wpinv_unset_error($error_id) {
111 111
     $errors = wpinv_get_errors();
112 112
 
113
-    if ( isset( $errors[ $error_id ] ) ) {
114
-        unset( $errors[ $error_id ] );
113
+    if (isset($errors[$error_id])) {
114
+        unset($errors[$error_id]);
115 115
     }
116 116
 
117
-    getpaid_session()->set( 'wpinv_errors', $errors );
117
+    getpaid_session()->set('wpinv_errors', $errors);
118 118
 }
119 119
 
120 120
 /**
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
  * @param string $message Message to log.
126 126
  * @param string $version Version the message was added in.
127 127
  */
128
-function getpaid_doing_it_wrong( $function, $message, $version ) {
128
+function getpaid_doing_it_wrong($function, $message, $version) {
129 129
 
130 130
 	$message .= ' Backtrace: ' . wp_debug_backtrace_summary();
131 131
 
132
-	if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) {
133
-		do_action( 'doing_it_wrong_run', $function, $message, $version );
134
-		error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
132
+	if (wp_doing_ajax() || defined('REST_REQUEST')) {
133
+		do_action('doing_it_wrong_run', $function, $message, $version);
134
+		error_log("{$function} was called incorrectly. {$message}. This message was added in version {$version}.");
135 135
 	} else {
136
-		_doing_it_wrong( $function, $message, $version );
136
+		_doing_it_wrong($function, $message, $version);
137 137
 	}
138 138
 
139 139
 }
@@ -147,42 +147,42 @@  discard block
 block discarded – undo
147 147
  * @param string $line The line that contains the error.
148 148
  * @param bool $exit Whether or not to exit function execution.
149 149
  */
150
-function wpinv_error_log( $log, $title = '', $file = '', $line = '', $exit = false ) {
150
+function wpinv_error_log($log, $title = '', $file = '', $line = '', $exit = false) {
151 151
     
152
-    if ( true === apply_filters( 'wpinv_log_errors', true ) ) {
152
+    if (true === apply_filters('wpinv_log_errors', true)) {
153 153
 
154 154
         // Ensure the log is a scalar.
155
-        if ( ! is_scalar( $log ) ) {
156
-            $log = print_r( $log, true );
155
+        if (!is_scalar($log)) {
156
+            $log = print_r($log, true);
157 157
         }
158 158
 
159 159
         // Add title.
160
-        if ( ! empty( $title ) ) {
161
-            $log  = $title . ' ' . trim( $log );
160
+        if (!empty($title)) {
161
+            $log = $title . ' ' . trim($log);
162 162
         }
163 163
 
164 164
         // Add the file to the label.
165
-        if ( ! empty( $file ) ) {
165
+        if (!empty($file)) {
166 166
             $log .= ' in ' . $file;
167 167
         }
168 168
 
169 169
         // Add the line number to the label.
170
-        if ( ! empty( $line ) ) {
170
+        if (!empty($line)) {
171 171
             $log .= ' on line ' . $line;
172 172
         }
173 173
 
174 174
         // Log the message.
175
-        error_log( trim ( $log ) );
175
+        error_log(trim($log));
176 176
 
177 177
         // ... and a backtrace.
178
-        if ( false !== $title ) {
179
-            error_log( 'Backtrace ' . wp_debug_backtrace_summary() );
178
+        if (false !== $title) {
179
+            error_log('Backtrace ' . wp_debug_backtrace_summary());
180 180
         }
181 181
 
182 182
     }
183 183
 
184 184
     // Maybe exit.
185
-    if ( $exit ) {
185
+    if ($exit) {
186 186
         exit;
187 187
     }
188 188
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/price_select.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,52 +7,52 @@
 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
 
14 14
 <small class='form-text text-muted mb-2'>
15
-    <?php esc_html_e( 'This amount will be added to the total amount for this form', 'invoicing' ); ?>
15
+    <?php esc_html_e('This amount will be added to the total amount for this form', 'invoicing'); ?>
16 16
 </small>
17 17
 
18 18
 <div class='form-group'>
19 19
     <label class="d-block">
20
-        <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span>
20
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
21 21
         <input v-model='active_form_element.label' class='form-control' />
22 22
     </label>
23 23
 </div>
24 24
 
25 25
 <div class='form-group' v-if="active_form_element.select_type=='select'">
26 26
     <label class="d-block">
27
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
27
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
28 28
         <input v-model='active_form_element.placeholder' class='form-control' />
29 29
     </label>
30 30
 </div>
31 31
 
32 32
 <div class='form-group'>
33 33
     <label class="d-block">
34
-        <span><?php esc_html_e( 'Select Type', 'invoicing' ); ?></span>
34
+        <span><?php esc_html_e('Select Type', 'invoicing'); ?></span>
35 35
         <select class='form-control custom-select' v-model='active_form_element.select_type'>
36
-            <option value='select'><?php esc_html_e( 'Dropdown', 'invoicing' ) ?></option>
37
-            <option value='checkboxes'><?php esc_html_e( 'Checkboxes', 'invoicing' ) ?></option>
38
-            <option value='radios'><?php esc_html_e( 'Radio Buttons', 'invoicing' ) ?></option>
39
-            <option value='buttons'><?php esc_html_e( 'Buttons', 'invoicing' ) ?></option>
40
-            <option value='circles'><?php esc_html_e( 'Circles', 'invoicing' ) ?></option>
36
+            <option value='select'><?php esc_html_e('Dropdown', 'invoicing') ?></option>
37
+            <option value='checkboxes'><?php esc_html_e('Checkboxes', 'invoicing') ?></option>
38
+            <option value='radios'><?php esc_html_e('Radio Buttons', 'invoicing') ?></option>
39
+            <option value='buttons'><?php esc_html_e('Buttons', 'invoicing') ?></option>
40
+            <option value='circles'><?php esc_html_e('Circles', 'invoicing') ?></option>
41 41
         </select>
42 42
     </label>
43 43
 </div>
44 44
 
45 45
 <div class='form-group'>
46 46
     <label class="d-block">
47
-        <span><?php esc_html_e( 'Options', 'invoicing' ); ?></span>
47
+        <span><?php esc_html_e('Options', 'invoicing'); ?></span>
48 48
         <textarea placeholder='Basic|10,Pro|99,Business|199' v-model='active_form_element.options' class='form-control' rows='3'></textarea>
49
-        <small class='form-text text-muted mb-2'><?php esc_html_e( 'Use commas to separate options and pipes to separate a label and its price. Do not include a currency symbol in the price.', 'invoicing' ); ?></small>
49
+        <small class='form-text text-muted mb-2'><?php esc_html_e('Use commas to separate options and pipes to separate a label and its price. Do not include a currency symbol in the price.', 'invoicing'); ?></small>
50 50
     </label>
51 51
 </div>
52 52
 
53 53
 <div class='form-group'>
54 54
     <label class="d-block">
55
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
56
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
55
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
56
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
57 57
     </label>
58 58
 </div>
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/total_payable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 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
 
14 14
 <div class='form-group'>
15
-    <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'The total payable text', 'invoicing' ) ?></label>
15
+    <label :for="active_form_element.id + '_edit'"><?php esc_html_e('The total payable text', 'invoicing') ?></label>
16 16
     <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea>
17 17
 </div>
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/discount.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,27 +7,27 @@
 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
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Input Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Input Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.input_label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Button Label', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Button Label', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.button_label' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32 32
     </label>
33 33
 </div>
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/paragraph.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 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
 
14 14
 <div class='form-group'>
15
-    <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Enter your text', 'invoicing' ) ?></label>
15
+    <label :for="active_form_element.id + '_edit'"><?php esc_html_e('Enter your text', 'invoicing') ?></label>
16 16
     <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea>
17 17
 </div>
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/ip_address.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 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
 <div class='form-group'>
14
-    <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'The IP Address text', 'invoicing' ) ?></label>
14
+    <label :for="active_form_element.id + '_edit'"><?php esc_html_e('The IP Address text', 'invoicing') ?></label>
15 15
     <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea>
16 16
 </div>
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/gateway_select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 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
 
14 14
 <div class='form-group'>
15
-    <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'The gateway select text', 'invoicing' ) ?></label>
15
+    <label :for="active_form_element.id + '_edit'"><?php esc_html_e('The gateway select text', 'invoicing') ?></label>
16 16
     <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea>
17 17
 </div>
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/date.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@
 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
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
24
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
23
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
24
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group form-check'>
29 29
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
30
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
30
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
31 31
 </div>
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/number.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,32 +7,32 @@
 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
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.placeholder' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32 32
     </label>
33 33
 </div>
34 34
 
35 35
 <div class='form-group form-check'>
36 36
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
37
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
37
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
38 38
 </div>
Please login to merge, or discard this patch.