Passed
Pull Request — master (#236)
by Patrik
03:27
created
widgets/invoice-receipt.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -44,25 +44,25 @@
 block discarded – undo
44 44
         parent::__construct( $options );
45 45
     }
46 46
 
47
-	/**
48
-	 * The Super block output function.
49
-	 *
50
-	 * @param array $args
51
-	 * @param array $widget_args
52
-	 * @param string $content
53
-	 *
54
-	 * @return mixed|string|bool
55
-	 */
47
+    /**
48
+     * The Super block output function.
49
+     *
50
+     * @param array $args
51
+     * @param array $widget_args
52
+     * @param string $content
53
+     *
54
+     * @return mixed|string|bool
55
+     */
56 56
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
57 57
 
58
-	    ob_start();
58
+        ob_start();
59 59
 
60
-	    do_action( 'wpinv_success_content_before' );
61
-	    echo wpinv_payment_receipt( $args );
62
-	    do_action( 'wpinv_success_content_after' );
60
+        do_action( 'wpinv_success_content_before' );
61
+        echo wpinv_payment_receipt( $args );
62
+        do_action( 'wpinv_success_content_after' );
63 63
 
64
-	    $output = ob_get_clean();
65
-	    return trim($output);
64
+        $output = ob_get_clean();
65
+        return trim($output);
66 66
 
67 67
     }
68 68
 
Please login to merge, or discard this patch.
includes/class-wpinv.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
140 140
         require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
141 141
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
142
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
143
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
144
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
145
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
146
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
147
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
142
+        require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
143
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
144
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
145
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
146
+        require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
147
+        require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
148 148
         require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
149 149
 
150 150
         if ( !class_exists( 'WPInv_EUVat' ) ) {
@@ -421,16 +421,16 @@  discard block
 block discarded – undo
421 421
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
422 422
     }
423 423
 
424
-	/**
425
-	 * Register widgets
426
-	 *
427
-	 */
428
-	public function register_widgets() {
429
-		register_widget( "WPInv_Checkout_Widget" );
430
-		register_widget( "WPInv_History_Widget" );
431
-		register_widget( "WPInv_Receipt_Widget" );
432
-		register_widget( "WPInv_Subscriptions_Widget" );
433
-		register_widget( "WPInv_Buy_Item_Widget" );
434
-		register_widget( "WPInv_Messages_Widget" );
435
-	}
424
+    /**
425
+     * Register widgets
426
+     *
427
+     */
428
+    public function register_widgets() {
429
+        register_widget( "WPInv_Checkout_Widget" );
430
+        register_widget( "WPInv_History_Widget" );
431
+        register_widget( "WPInv_Receipt_Widget" );
432
+        register_widget( "WPInv_Subscriptions_Widget" );
433
+        register_widget( "WPInv_Buy_Item_Widget" );
434
+        register_widget( "WPInv_Messages_Widget" );
435
+    }
436 436
 }
437 437
\ No newline at end of file
Please login to merge, or discard this patch.
includes/wpinv-template-functions.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -103,29 +103,29 @@  discard block
 block discarded – undo
103 103
 
104 104
 function wpinv_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
105 105
     if ( ! empty( $args ) && is_array( $args ) ) {
106
-		extract( $args );
107
-	}
106
+        extract( $args );
107
+    }
108 108
 
109
-	$located = wpinv_locate_template( $template_name, $template_path, $default_path );
110
-	// Allow 3rd party plugin filter template file from their plugin.
111
-	$located = apply_filters( 'wpinv_get_template', $located, $template_name, $args, $template_path, $default_path );
109
+    $located = wpinv_locate_template( $template_name, $template_path, $default_path );
110
+    // Allow 3rd party plugin filter template file from their plugin.
111
+    $located = apply_filters( 'wpinv_get_template', $located, $template_name, $args, $template_path, $default_path );
112 112
 
113
-	if ( ! file_exists( $located ) ) {
113
+    if ( ! file_exists( $located ) ) {
114 114
         _doing_it_wrong( __FUNCTION__, sprintf( '<code>%s</code> does not exist.', $located ), '2.1' );
115
-		return;
116
-	}
115
+        return;
116
+    }
117 117
 
118
-	do_action( 'wpinv_before_template_part', $template_name, $template_path, $located, $args );
118
+    do_action( 'wpinv_before_template_part', $template_name, $template_path, $located, $args );
119 119
 
120
-	include( $located );
120
+    include( $located );
121 121
 
122
-	do_action( 'wpinv_after_template_part', $template_name, $template_path, $located, $args );
122
+    do_action( 'wpinv_after_template_part', $template_name, $template_path, $located, $args );
123 123
 }
124 124
 
125 125
 function wpinv_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
126
-	ob_start();
127
-	wpinv_get_template( $template_name, $args, $template_path, $default_path );
128
-	return ob_get_clean();
126
+    ob_start();
127
+    wpinv_get_template( $template_name, $args, $template_path, $default_path );
128
+    return ob_get_clean();
129 129
 }
130 130
 
131 131
 function wpinv_locate_template( $template_name, $template_path = '', $default_path = '' ) {
@@ -155,126 +155,126 @@  discard block
 block discarded – undo
155 155
 }
156 156
 
157 157
 function wpinv_get_template_part( $slug, $name = null, $load = true ) {
158
-	do_action( 'get_template_part_' . $slug, $slug, $name );
158
+    do_action( 'get_template_part_' . $slug, $slug, $name );
159 159
 
160
-	// Setup possible parts
161
-	$templates = array();
162
-	if ( isset( $name ) )
163
-		$templates[] = $slug . '-' . $name . '.php';
164
-	$templates[] = $slug . '.php';
160
+    // Setup possible parts
161
+    $templates = array();
162
+    if ( isset( $name ) )
163
+        $templates[] = $slug . '-' . $name . '.php';
164
+    $templates[] = $slug . '.php';
165 165
 
166
-	// Allow template parts to be filtered
167
-	$templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name );
166
+    // Allow template parts to be filtered
167
+    $templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name );
168 168
 
169
-	// Return the part that is found
170
-	return wpinv_locate_tmpl( $templates, $load, false );
169
+    // Return the part that is found
170
+    return wpinv_locate_tmpl( $templates, $load, false );
171 171
 }
172 172
 
173 173
 function wpinv_locate_tmpl( $template_names, $load = false, $require_once = true ) {
174
-	// No file found yet
175
-	$located = false;
174
+    // No file found yet
175
+    $located = false;
176 176
 
177
-	// Try to find a template file
178
-	foreach ( (array)$template_names as $template_name ) {
177
+    // Try to find a template file
178
+    foreach ( (array)$template_names as $template_name ) {
179 179
 
180
-		// Continue if template is empty
181
-		if ( empty( $template_name ) )
182
-			continue;
180
+        // Continue if template is empty
181
+        if ( empty( $template_name ) )
182
+            continue;
183 183
 
184
-		// Trim off any slashes from the template name
185
-		$template_name = ltrim( $template_name, '/' );
184
+        // Trim off any slashes from the template name
185
+        $template_name = ltrim( $template_name, '/' );
186 186
 
187
-		// try locating this template file by looping through the template paths
188
-		foreach( wpinv_get_theme_template_paths() as $template_path ) {
187
+        // try locating this template file by looping through the template paths
188
+        foreach( wpinv_get_theme_template_paths() as $template_path ) {
189 189
 
190
-			if( file_exists( $template_path . $template_name ) ) {
191
-				$located = $template_path . $template_name;
192
-				break;
193
-			}
194
-		}
190
+            if( file_exists( $template_path . $template_name ) ) {
191
+                $located = $template_path . $template_name;
192
+                break;
193
+            }
194
+        }
195 195
 
196
-		if( !empty( $located ) ) {
197
-			break;
198
-		}
199
-	}
196
+        if( !empty( $located ) ) {
197
+            break;
198
+        }
199
+    }
200 200
 
201
-	if ( ( true == $load ) && ! empty( $located ) )
202
-		load_template( $located, $require_once );
201
+    if ( ( true == $load ) && ! empty( $located ) )
202
+        load_template( $located, $require_once );
203 203
 
204
-	return $located;
204
+    return $located;
205 205
 }
206 206
 
207 207
 function wpinv_get_theme_template_paths() {
208
-	$template_dir = wpinv_get_theme_template_dir_name();
208
+    $template_dir = wpinv_get_theme_template_dir_name();
209 209
 
210
-	$file_paths = array(
211
-		1 => trailingslashit( get_stylesheet_directory() ) . $template_dir,
212
-		10 => trailingslashit( get_template_directory() ) . $template_dir,
213
-		100 => wpinv_get_templates_dir()
214
-	);
210
+    $file_paths = array(
211
+        1 => trailingslashit( get_stylesheet_directory() ) . $template_dir,
212
+        10 => trailingslashit( get_template_directory() ) . $template_dir,
213
+        100 => wpinv_get_templates_dir()
214
+    );
215 215
 
216
-	$file_paths = apply_filters( 'wpinv_template_paths', $file_paths );
216
+    $file_paths = apply_filters( 'wpinv_template_paths', $file_paths );
217 217
 
218
-	// sort the file paths based on priority
219
-	ksort( $file_paths, SORT_NUMERIC );
218
+    // sort the file paths based on priority
219
+    ksort( $file_paths, SORT_NUMERIC );
220 220
 
221
-	return array_map( 'trailingslashit', $file_paths );
221
+    return array_map( 'trailingslashit', $file_paths );
222 222
 }
223 223
 
224 224
 function wpinv_get_theme_template_dir_name() {
225
-	return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) );
225
+    return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) );
226 226
 }
227 227
 
228 228
 function wpinv_checkout_meta_tags() {
229 229
 
230
-	$pages   = array();
231
-	$pages[] = wpinv_get_option( 'success_page' );
232
-	$pages[] = wpinv_get_option( 'failure_page' );
233
-	$pages[] = wpinv_get_option( 'invoice_history_page' );
234
-	$pages[] = wpinv_get_option( 'invoice_subscription_page' );
230
+    $pages   = array();
231
+    $pages[] = wpinv_get_option( 'success_page' );
232
+    $pages[] = wpinv_get_option( 'failure_page' );
233
+    $pages[] = wpinv_get_option( 'invoice_history_page' );
234
+    $pages[] = wpinv_get_option( 'invoice_subscription_page' );
235 235
 
236
-	if( !wpinv_is_checkout() && !is_page( $pages ) ) {
237
-		return;
238
-	}
236
+    if( !wpinv_is_checkout() && !is_page( $pages ) ) {
237
+        return;
238
+    }
239 239
 
240
-	echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
240
+    echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
241 241
 }
242 242
 add_action( 'wp_head', 'wpinv_checkout_meta_tags' );
243 243
 
244 244
 function wpinv_add_body_classes( $class ) {
245
-	$classes = (array)$class;
245
+    $classes = (array)$class;
246 246
 
247
-	if( wpinv_is_checkout() ) {
248
-		$classes[] = 'wpinv-checkout';
249
-		$classes[] = 'wpinv-page';
250
-	}
247
+    if( wpinv_is_checkout() ) {
248
+        $classes[] = 'wpinv-checkout';
249
+        $classes[] = 'wpinv-page';
250
+    }
251 251
 
252
-	if( wpinv_is_success_page() ) {
253
-		$classes[] = 'wpinv-success';
254
-		$classes[] = 'wpinv-page';
255
-	}
252
+    if( wpinv_is_success_page() ) {
253
+        $classes[] = 'wpinv-success';
254
+        $classes[] = 'wpinv-page';
255
+    }
256 256
 
257
-	if( wpinv_is_failed_transaction_page() ) {
258
-		$classes[] = 'wpinv-failed-transaction';
259
-		$classes[] = 'wpinv-page';
260
-	}
257
+    if( wpinv_is_failed_transaction_page() ) {
258
+        $classes[] = 'wpinv-failed-transaction';
259
+        $classes[] = 'wpinv-page';
260
+    }
261 261
 
262
-	if( wpinv_is_invoice_history_page() ) {
263
-		$classes[] = 'wpinv-history';
264
-		$classes[] = 'wpinv-page';
265
-	}
262
+    if( wpinv_is_invoice_history_page() ) {
263
+        $classes[] = 'wpinv-history';
264
+        $classes[] = 'wpinv-page';
265
+    }
266 266
 
267
-	if( wpinv_is_subscriptions_history_page() ) {
268
-		$classes[] = 'wpinv-subscription';
269
-		$classes[] = 'wpinv-page';
270
-	}
267
+    if( wpinv_is_subscriptions_history_page() ) {
268
+        $classes[] = 'wpinv-subscription';
269
+        $classes[] = 'wpinv-page';
270
+    }
271 271
 
272
-	if( wpinv_is_test_mode() ) {
273
-		$classes[] = 'wpinv-test-mode';
274
-		$classes[] = 'wpinv-page';
275
-	}
272
+    if( wpinv_is_test_mode() ) {
273
+        $classes[] = 'wpinv-test-mode';
274
+        $classes[] = 'wpinv-page';
275
+    }
276 276
 
277
-	return array_unique( $classes );
277
+    return array_unique( $classes );
278 278
 }
279 279
 add_filter( 'body_class', 'wpinv_add_body_classes' );
280 280
 
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 
1031 1031
                     $item       = $item_id ? new WPInv_Item( $item_id ) : NULL;
1032 1032
                     $summary    = '';
1033
-	                $item_name    = '';
1033
+                    $item_name    = '';
1034 1034
                     $cols       = 3;
1035 1035
                     if ( !empty($item) ) {
1036 1036
                         $item_name  = $item->get_name();
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
     $form_action  = esc_url( wpinv_get_checkout_uri() );
1409 1409
 
1410 1410
     ob_start();
1411
-	    do_action( 'wpinv_checkout_content_before' );
1411
+        do_action( 'wpinv_checkout_content_before' );
1412 1412
         echo '<div id="wpinv_checkout_wrap">';
1413 1413
 
1414 1414
         if ( wpinv_get_cart_contents() || wpinv_cart_has_fees() ) {
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
             do_action( 'wpinv_cart_empty' );
1432 1432
         }
1433 1433
         echo '</div><!--end #wpinv_checkout_wrap-->';
1434
-	    do_action( 'wpinv_checkout_content_after' );
1434
+        do_action( 'wpinv_checkout_content_after' );
1435 1435
     return ob_get_clean();
1436 1436
 }
1437 1437
 
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
 add_action( 'wpinv_checkout_cart', 'wpinv_checkout_cart', 10 );
1459 1459
 
1460 1460
 function wpinv_empty_cart_message() {
1461
-	return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' );
1461
+    return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' );
1462 1462
 }
1463 1463
 
1464 1464
 /**
@@ -1468,7 +1468,7 @@  discard block
 block discarded – undo
1468 1468
  * @return void
1469 1469
  */
1470 1470
 function wpinv_empty_checkout_cart() {
1471
-	echo wpinv_empty_cart_message();
1471
+    echo wpinv_empty_cart_message();
1472 1472
 }
1473 1473
 add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' );
1474 1474
 
Please login to merge, or discard this patch.
widgets/buy-item.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
                     'advanced'    => false
39 39
                 ),
40 40
                 'buy_items'  => array(
41
-	                'title'       => __( 'Items to buy', 'invoicing' ),
42
-	                'desc'        => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing' ),
43
-	                'type'        => 'text',
44
-	                'desc_tip'    => true,
45
-	                'default'     => '',
46
-	                'placeholder' => __('Items to buy','invoicing'),
47
-	                'advanced'    => false
41
+                    'title'       => __( 'Items to buy', 'invoicing' ),
42
+                    'desc'        => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing' ),
43
+                    'type'        => 'text',
44
+                    'desc_tip'    => true,
45
+                    'default'     => '',
46
+                    'placeholder' => __('Items to buy','invoicing'),
47
+                    'advanced'    => false
48 48
                 ),
49 49
                 'button_label'  => array(
50
-	                'title'       => __( 'Button Label', 'invoicing' ),
51
-	                'desc'        => __( 'Enter button label. Default "Buy Now".', 'invoicing' ),
52
-	                'type'        => 'text',
53
-	                'desc_tip'    => true,
54
-	                'default'     => '',
55
-	                'advanced'    => true
50
+                    'title'       => __( 'Button Label', 'invoicing' ),
51
+                    'desc'        => __( 'Enter button label. Default "Buy Now".', 'invoicing' ),
52
+                    'type'        => 'text',
53
+                    'desc_tip'    => true,
54
+                    'default'     => '',
55
+                    'advanced'    => true
56 56
                 ),
57 57
                 'post_id'  => array(
58
-	                'title'       => __( 'Post ID', 'invoicing' ),
59
-	                'desc'        => __( 'Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing' ),
60
-	                'type'        => 'number',
61
-	                'desc_tip'    => true,
62
-	                'default'     => '',
63
-	                'advanced'    => true
58
+                    'title'       => __( 'Post ID', 'invoicing' ),
59
+                    'desc'        => __( 'Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing' ),
60
+                    'type'        => 'number',
61
+                    'desc_tip'    => true,
62
+                    'default'     => '',
63
+                    'advanced'    => true
64 64
                 ),
65 65
             )
66 66
 
@@ -70,36 +70,36 @@  discard block
 block discarded – undo
70 70
         parent::__construct( $options );
71 71
     }
72 72
 
73
-	/**
74
-	 * The Super block output function.
75
-	 *
76
-	 * @param array $args
77
-	 * @param array $widget_args
78
-	 * @param string $content
79
-	 *
80
-	 * @return string
81
-	 */
73
+    /**
74
+     * The Super block output function.
75
+     *
76
+     * @param array $args
77
+     * @param array $widget_args
78
+     * @param string $content
79
+     *
80
+     * @return string
81
+     */
82 82
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
83 83
 
84
-	    $defaults = array(
85
-		    'buy_items'     => '', // should be used like: item_id|quantity,item_id|quantity,item_id|quantity
86
-		    'button_label'  => __( 'Buy Now', 'invoicing' ), // the button title
87
-		    'post_id'   => '', // any related post_id
88
-	    );
84
+        $defaults = array(
85
+            'buy_items'     => '', // should be used like: item_id|quantity,item_id|quantity,item_id|quantity
86
+            'button_label'  => __( 'Buy Now', 'invoicing' ), // the button title
87
+            'post_id'   => '', // any related post_id
88
+        );
89 89
 
90
-	    /**
91
-	     * Parse incoming $args into an array and merge it with $defaults
92
-	     */
93
-	    $args = wp_parse_args( $args, $defaults );
90
+        /**
91
+         * Parse incoming $args into an array and merge it with $defaults
92
+         */
93
+        $args = wp_parse_args( $args, $defaults );
94 94
 
95
-	    $post_id = isset( $args['post_id'] ) ? (int)$args['post_id'] : 0;
95
+        $post_id = isset( $args['post_id'] ) ? (int)$args['post_id'] : 0;
96 96
 
97
-	    $html = '<div class="wpi-buy-button-wrapper wpi-g">';
98
-	    $html .= '<button class="button button-primary wpi-buy-button" type="button" onclick="wpi_buy(this,\'' . $args['buy_items'] . '\',' . $post_id . ');">' . $args['button_label'] . '</button>';
99
-	    $html .= wp_nonce_field( 'wpinv_buy_items', 'wpinv_buy_nonce', true, false );
100
-	    $html .= '</div>';
97
+        $html = '<div class="wpi-buy-button-wrapper wpi-g">';
98
+        $html .= '<button class="button button-primary wpi-buy-button" type="button" onclick="wpi_buy(this,\'' . $args['buy_items'] . '\',' . $post_id . ');">' . $args['button_label'] . '</button>';
99
+        $html .= wp_nonce_field( 'wpinv_buy_items', 'wpinv_buy_nonce', true, false );
100
+        $html .= '</div>';
101 101
 
102
-	    return $html;
102
+        return $html;
103 103
 
104 104
     }
105 105
 
Please login to merge, or discard this patch.