Passed
Pull Request — master (#284)
by Brian
06:18
created
includes/admin/meta-boxes/class-mb-form-items.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -144,11 +144,11 @@
 block discarded – undo
144 144
         <?php
145 145
     }
146 146
 
147
-     /**
148
-     * Outputs the payment options.
149
-     *
150
-     * @param WP_Post $post
151
-     */
147
+        /**
148
+         * Outputs the payment options.
149
+         *
150
+         * @param WP_Post $post
151
+         */
152 152
     public static function output_options( $post ) {
153 153
 
154 154
         $post_id             = ! empty( $post->ID ) ? $post->ID : 0;
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7 7
 class WPInv_Meta_Box_Form_Items {
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @param WP_Post $post
13 13
      */
14
-    public static function output( $post ) {
14
+    public static function output($post) {
15 15
 
16
-        $items = get_post_meta( $post->ID, 'wpinv_payment_form_items', true );
16
+        $items = get_post_meta($post->ID, 'wpinv_payment_form_items', true);
17 17
 
18
-        if ( empty( $items ) || ! is_array( $items ) ) {
18
+        if (empty($items) || !is_array($items)) {
19 19
             $items = array();
20 20
         }
21 21
 
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 
27 27
                 <thead>
28 28
                     <tr>
29
-                        <th class="id"><?php _e( 'ID', 'invoicing' );?></th>
30
-                        <th class="title"><?php _e( 'Name', 'invoicing' );?></th>
31
-                        <th class="desc"><?php _e( 'Description', 'invoicing' );?></th>
32
-                        <th class="price"><?php _e( 'Price', 'invoicing' );?></th>
29
+                        <th class="id"><?php _e('ID', 'invoicing'); ?></th>
30
+                        <th class="title"><?php _e('Name', 'invoicing'); ?></th>
31
+                        <th class="desc"><?php _e('Description', 'invoicing'); ?></th>
32
+                        <th class="price"><?php _e('Price', 'invoicing'); ?></th>
33 33
                         <th class="action"></th>
34 34
                     </tr>
35 35
                 </thead>
@@ -37,32 +37,32 @@  discard block
 block discarded – undo
37 37
                 <tbody class="wpinv-line-items">
38 38
                     <?php
39 39
 
40
-                        foreach ( $items as $item_data ) {
40
+                        foreach ($items as $item_data) {
41 41
 
42
-                            $id   = isset( $item['id'] ) ? (int) $item['id'] : 0;
43
-                            $item = new WPInv_Item( $id );
42
+                            $id   = isset($item['id']) ? (int) $item['id'] : 0;
43
+                            $item = new WPInv_Item($id);
44 44
 
45
-                            if ( empty( $item ) || $item->post_type != 'wpi_item' ) {
45
+                            if (empty($item) || $item->post_type != 'wpi_item') {
46 46
                                 continue;
47 47
                             }
48 48
                             
49
-                            $name          = isset( $item_data['name'] ) ? sanitize_text_field( $item_data['name'] ) : $item->get_name();
50
-                            $price         = isset( $item_data['price'] ) ? wpinv_format_amount( $item_data['price'] ) : $item->get_price();
51
-                            $description   = isset( $item_data['description'] ) ? esc_textarea( $item_data['description'] ) : $item->get_summary();
49
+                            $name          = isset($item_data['name']) ? sanitize_text_field($item_data['name']) : $item->get_name();
50
+                            $price         = isset($item_data['price']) ? wpinv_format_amount($item_data['price']) : $item->get_price();
51
+                            $description   = isset($item_data['description']) ? esc_textarea($item_data['description']) : $item->get_summary();
52 52
 
53 53
                     ?>
54 54
 
55 55
                     <tr class="item" data-item-id="<?php echo $id; ?>">
56 56
                         <td class="id"><?php echo $id; ?></td>
57 57
                         <td class="title">
58
-                            <a href="<?php echo esc_url( get_edit_post_link( $id ) ); ?>" target="_blank"><?php echo $name ; ?></a>
59
-                            <?php echo wpinv_get_item_suffix( $id ); ?>
58
+                            <a href="<?php echo esc_url(get_edit_post_link($id)); ?>" target="_blank"><?php echo $name; ?></a>
59
+                            <?php echo wpinv_get_item_suffix($id); ?>
60 60
                         </td>
61 61
                         <td class="meta">
62
-                            <?php echo $description ; ?>
62
+                            <?php echo $description; ?>
63 63
                         </td>
64 64
                         <td class="price">
65
-                            <?php echo $price ; ?>
65
+                            <?php echo $price; ?>
66 66
                         </td>
67 67
                     </tr>
68 68
 
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
                         <td class="id"></td>
73 73
 
74 74
                         <td class="title">
75
-                            <input type="text" class="regular-text" placeholder="<?php _e( 'Item Name', 'invoicing' ); ?>" value="" id="wpinv_create_payment_form_item_name" />
75
+                            <input type="text" class="regular-text" placeholder="<?php _e('Item Name', 'invoicing'); ?>" value="" id="wpinv_create_payment_form_item_name" />
76 76
 
77 77
                             <div class="wp-clearfix">
78 78
                                 <label class="wpi-item-actions">
79 79
                                     <span class="input-text-wrap">
80
-                                        <input type="button" value="<?php esc_attr_e( 'Add', 'invoicing' ); ?>" class="button button-primary" id="wpinv-payment-form-save-item">
80
+                                        <input type="button" value="<?php esc_attr_e('Add', 'invoicing'); ?>" class="button button-primary" id="wpinv-payment-form-save-item">
81 81
                                         <input type="button" value="Cancel" class="button button-secondary" id="wpinv-payment-form-cancel-item">
82 82
                                     </span>
83 83
                                 </label>
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                         </td>
86 86
 
87 87
                         <td class="meta">
88
-                            <textarea placeholder="<?php esc_attr_e( 'Item description', 'invoicing' ) ?>" id="wpinv_create_payment_form_item_description" class="large-text" rows="3"></textarea>
88
+                            <textarea placeholder="<?php esc_attr_e('Item description', 'invoicing') ?>" id="wpinv_create_payment_form_item_description" class="large-text" rows="3"></textarea>
89 89
                         </td>
90 90
 
91 91
                         <td class="price">
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
 
101 101
                 <?php
102 102
 
103
-                    echo wpinv_item_dropdown( array(
103
+                    echo wpinv_item_dropdown(array(
104 104
                         'name'             => 'wpinv_payment_form_item',
105 105
                         'id'               => 'wpinv_payment_form_item',
106 106
                         'show_recurring'   => true,
107 107
                         'class'            => 'wpi_select2',
108
-                    ) );
108
+                    ));
109 109
 
110 110
                 ?>
111 111
 
112
-                <input type="button" value="<?php esc_attr_e( 'Add item to form', 'invoicing'); ?>" class="button button-primary" id="wpinv-payment-form-add-item" />
113
-                <input type="button" value="<?php esc_attr_e( 'Create new item', 'invoicing' );?>" class="button button-primary" id="wpinv-payment-form-new-item" />
112
+                <input type="button" value="<?php esc_attr_e('Add item to form', 'invoicing'); ?>" class="button button-primary" id="wpinv-payment-form-add-item" />
113
+                <input type="button" value="<?php esc_attr_e('Create new item', 'invoicing'); ?>" class="button button-primary" id="wpinv-payment-form-new-item" />
114 114
 
115 115
             </div>
116 116
         </div>
@@ -122,23 +122,23 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @param WP_Post $post
124 124
      */
125
-    public static function output_options( $post ) {
125
+    public static function output_options($post) {
126 126
 
127
-        $post_id             = ! empty( $post->ID ) ? $post->ID : 0;
128
-        $success_page        = get_post_meta( $post->ID, 'wpinv_success_page', true );
129
-        $button_text         = get_post_meta( $post->ID, 'wpinv_button_text', true );
130
-        $processing_text     = get_post_meta( $post->ID, 'wpinv_processing_text', true );
131
-        $supports_quantities = (int) get_post_meta( $post->ID, 'wpinv_form_supports_quantities', true );
132
-        $supports_discounts  = (int) get_post_meta( $post->ID, 'wpinv_form_supports_discounts', true );
133
-        $enable_taxes        = (int) get_post_meta( $post->ID, 'wpinv_form_supports_quantities', true );
127
+        $post_id             = !empty($post->ID) ? $post->ID : 0;
128
+        $success_page        = get_post_meta($post->ID, 'wpinv_success_page', true);
129
+        $button_text         = get_post_meta($post->ID, 'wpinv_button_text', true);
130
+        $processing_text     = get_post_meta($post->ID, 'wpinv_processing_text', true);
131
+        $supports_quantities = (int) get_post_meta($post->ID, 'wpinv_form_supports_quantities', true);
132
+        $supports_discounts  = (int) get_post_meta($post->ID, 'wpinv_form_supports_discounts', true);
133
+        $enable_taxes        = (int) get_post_meta($post->ID, 'wpinv_form_supports_quantities', true);
134 134
 
135 135
         $values = array(
136
-            'success_page'         => empty( $success_page ) ? wpinv_get_success_page_uri() : $success_page,
137
-            'button_text'          => empty( $button_text ) ? __( 'Pay Now', 'invoicing' ) : $button_text,
138
-            'processing_text'      => empty( $processing_text ) ? __( 'Processing', 'invoicing' ) : $processing_text,
139
-            'supports_quantities'  => empty( $supports_quantities ) ? 0 : 1,
140
-            'enable_taxes'         => empty( $enable_taxes ) ? 0 : 1,
141
-            'supports_discounts'   => empty( $supports_discounts ) ? 0 : 1,
136
+            'success_page'         => empty($success_page) ? wpinv_get_success_page_uri() : $success_page,
137
+            'button_text'          => empty($button_text) ? __('Pay Now', 'invoicing') : $button_text,
138
+            'processing_text'      => empty($processing_text) ? __('Processing', 'invoicing') : $processing_text,
139
+            'supports_quantities'  => empty($supports_quantities) ? 0 : 1,
140
+            'enable_taxes'         => empty($enable_taxes) ? 0 : 1,
141
+            'supports_discounts'   => empty($supports_discounts) ? 0 : 1,
142 142
         );
143 143
 
144 144
         ?>
@@ -148,31 +148,31 @@  discard block
 block discarded – undo
148 148
                 <tbody>
149 149
 
150 150
                     <tr class="form-field-success_page">
151
-                        <th scope="row"><label for="field_success_page"><?php _e( 'Success Page', 'invoicing' ); ?></label></th>
151
+                        <th scope="row"><label for="field_success_page"><?php _e('Success Page', 'invoicing'); ?></label></th>
152 152
                         <td>
153 153
                             <div>
154
-                                <input type="text" class="regular-text" name="success_page" id="field_success_page" value="<?php echo esc_attr( $values['success_page'] ); ?>">
155
-                                <p class="description"><?php _e( 'Where should we redirect users after successfuly completing their payment?', 'invoicing' ); ?></p>
154
+                                <input type="text" class="regular-text" name="success_page" id="field_success_page" value="<?php echo esc_attr($values['success_page']); ?>">
155
+                                <p class="description"><?php _e('Where should we redirect users after successfuly completing their payment?', 'invoicing'); ?></p>
156 156
                             </div>
157 157
                         </td>
158 158
                     </tr>
159 159
 
160 160
                     <tr class="form-field-button_text">
161
-                        <th scope="row"><label for="field_button_text"><?php _e( 'Button Text', 'invoicing' ); ?></label></th>
161
+                        <th scope="row"><label for="field_button_text"><?php _e('Button Text', 'invoicing'); ?></label></th>
162 162
                         <td>
163 163
                             <div>
164
-                                <input type="text" class="regular-text" name="button_text" id="field_button_text" value="<?php echo esc_attr( $values['button_text'] ); ?>">
165
-                                <p class="description"><?php _e( 'Payment button text', 'invoicing' ); ?></p>
164
+                                <input type="text" class="regular-text" name="button_text" id="field_button_text" value="<?php echo esc_attr($values['button_text']); ?>">
165
+                                <p class="description"><?php _e('Payment button text', 'invoicing'); ?></p>
166 166
                             </div>
167 167
                         </td>
168 168
                     </tr>
169 169
 
170 170
                     <tr class="form-field-processing_text">
171
-                        <th scope="row"><label for="field_processing_text"><?php _e( 'Processing Text', 'invoicing' ); ?></label></th>
171
+                        <th scope="row"><label for="field_processing_text"><?php _e('Processing Text', 'invoicing'); ?></label></th>
172 172
                         <td>
173 173
                             <div>
174
-                                <input type="text" class="regular-text" name="processing_text" id="field_processing_text" value="<?php echo esc_attr( $values['processing_text'] ); ?>">
175
-                                <p class="description"><?php _e( 'Processing payment button text', 'invoicing' ); ?></p>
174
+                                <input type="text" class="regular-text" name="processing_text" id="field_processing_text" value="<?php echo esc_attr($values['processing_text']); ?>">
175
+                                <p class="description"><?php _e('Processing payment button text', 'invoicing'); ?></p>
176 176
                             </div>
177 177
                         </td>
178 178
                     </tr>
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
                         <td>
183 183
                             <div>
184 184
                                 <label>
185
-                                    <input type="checkbox" name="supports_quantities" id="field_supports_quantities" value="1" <?php checked( $values['supports_quantities'], 1 ); ?>>
186
-                                    <span><?php _e( 'Let users set custom item quantities', 'invoicing' ); ?></span>
185
+                                    <input type="checkbox" name="supports_quantities" id="field_supports_quantities" value="1" <?php checked($values['supports_quantities'], 1); ?>>
186
+                                    <span><?php _e('Let users set custom item quantities', 'invoicing'); ?></span>
187 187
                                 </label>
188 188
                             </div>
189 189
                         </td>
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
                         <td>
195 195
                             <div>
196 196
                                 <label>
197
-                                    <input type="checkbox" name="enable_taxes" id="field_enable_taxes" value="1" <?php checked( $values['enable_taxes'], 1 ); ?>>
198
-                                    <span><?php _e( 'Enable tax calculations', 'invoicing' ); ?></span>
197
+                                    <input type="checkbox" name="enable_taxes" id="field_enable_taxes" value="1" <?php checked($values['enable_taxes'], 1); ?>>
198
+                                    <span><?php _e('Enable tax calculations', 'invoicing'); ?></span>
199 199
                                 </label>
200 200
                             </div>
201 201
                         </td>
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
                         <td>
207 207
                             <div>
208 208
                                 <label>
209
-                                    <input type="checkbox" name="supports_discounts" id="field_supports_discounts" value="1" <?php checked( $values['supports_discounts'], 1 ); ?>>
210
-                                    <span><?php _e( 'Enable coupon codes', 'invoicing' ); ?></span>
209
+                                    <input type="checkbox" name="supports_discounts" id="field_supports_discounts" value="1" <?php checked($values['supports_discounts'], 1); ?>>
210
+                                    <span><?php _e('Enable coupon codes', 'invoicing'); ?></span>
211 211
                                 </label>
212 212
                             </div>
213 213
                         </td>
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         <?php
220 220
     }
221 221
 
222
-    public static function save( $post_id, $data, $post ) {
222
+    public static function save($post_id, $data, $post) {
223 223
 
224 224
     }
225 225
 }
Please login to merge, or discard this patch.
invoicing.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@
 block discarded – undo
12 12
 */
13 13
 
14 14
 // MUST have WordPress.
15
-if ( !defined( 'WPINC' ) ) {
16
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
15
+if (!defined('WPINC')) {
16
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
17 17
 }
18 18
 
19
-if ( !defined( 'WPINV_VERSION' ) ) {
20
-    define( 'WPINV_VERSION', '1.0.18' );
19
+if (!defined('WPINV_VERSION')) {
20
+    define('WPINV_VERSION', '1.0.18');
21 21
 }
22 22
 
23
-if ( !defined( 'WPINV_PLUGIN_FILE' ) ) {
24
-    define( 'WPINV_PLUGIN_FILE', __FILE__ );
23
+if (!defined('WPINV_PLUGIN_FILE')) {
24
+    define('WPINV_PLUGIN_FILE', __FILE__);
25 25
 }
26 26
 
27
-require plugin_dir_path( __FILE__ ) . 'includes/class-wpinv.php';
27
+require plugin_dir_path(__FILE__) . 'includes/class-wpinv.php';
28 28
 
29 29
 function wpinv_run() {
30 30
     global $invoicing;
Please login to merge, or discard this patch.