Passed
Pull Request — master (#98)
by Kiran
04:35
created
templates/emails/wpinv-email-refunded_invoice.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if (!defined('ABSPATH'))
4 4
     die('-1');
5 5
 
6
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
6
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
7 7
 ?>
8 8
 
9 9
 <p><?php
10
-    if ( !empty( $partial_refund ) ) {
11
-        printf( __( 'Hi there. Your invoice on %s has been partially refunded.', 'invoicing' ), wpinv_get_business_name() );
10
+    if (!empty($partial_refund)) {
11
+        printf(__('Hi there. Your invoice on %s has been partially refunded.', 'invoicing'), wpinv_get_business_name());
12 12
     }
13 13
     else {
14
-        printf( __( 'Hi there. Your invoice on %s has been refunded.', 'invoicing' ), wpinv_get_business_name() );
14
+        printf(__('Hi there. Your invoice on %s has been refunded.', 'invoicing'), wpinv_get_business_name());
15 15
     }
16 16
 ?></p>
17 17
 
18 18
 <?php
19
-do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin );
19
+do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin);
20 20
 
21
-do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin );
21
+do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin);
22 22
 
23
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
23
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
24 24
 
25
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
26 25
\ No newline at end of file
26
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
templates/wpinv-payment-processing.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 global $wpi_invoice;
3 3
 
4 4
 $success_page_uri = wpinv_get_success_page_uri();
5
-if ( !empty( $wpi_invoice ) ) {
6
-    $success_page_uri = add_query_arg( 'invoice_key', $wpi_invoice->get_key(), $success_page_uri );
5
+if (!empty($wpi_invoice)) {
6
+    $success_page_uri = add_query_arg('invoice_key', $wpi_invoice->get_key(), $success_page_uri);
7 7
 }
8 8
 ?>
9 9
 <div id="wpinv-payment-processing">
10
-    <p><?php echo wp_sprintf( __( 'Your payment is processing. This page will reload automatically in 10 seconds. If it does not, click <a href="%s">here</a>.', 'invoicing' ), $success_page_uri ); ?> <i class="fa fa-spin fa-refresh"></i></p>
10
+    <p><?php echo wp_sprintf(__('Your payment is processing. This page will reload automatically in 10 seconds. If it does not, click <a href="%s">here</a>.', 'invoicing'), $success_page_uri); ?> <i class="fa fa-spin fa-refresh"></i></p>
11 11
     <script type="text/javascript">setTimeout(function(){ window.location = '<?php echo $success_page_uri; ?>'; }, 10000);</script>
12 12
 </div>
13 13
\ No newline at end of file
Please login to merge, or discard this patch.
templates/wpinv-invoice-receipt.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@  discard block
 block discarded – undo
4 4
  */
5 5
 global $wpinv_receipt_args;
6 6
 
7
-$invoice   = get_post( $wpinv_receipt_args['id'] );
7
+$invoice = get_post($wpinv_receipt_args['id']);
8 8
 
9
-if( empty( $invoice ) ) {
9
+if (empty($invoice)) {
10 10
     ?>
11 11
     <div class="wpinv_errors alert wpi-alert-error">
12
-        <?php _e( 'The specified receipt ID appears to be invalid', 'invoicing' ); ?>
12
+        <?php _e('The specified receipt ID appears to be invalid', 'invoicing'); ?>
13 13
     </div>
14 14
     <?php
15 15
     return;
16 16
 }
17
-$invoice = wpinv_get_invoice( $invoice->ID );
17
+$invoice = wpinv_get_invoice($invoice->ID);
18 18
 
19 19
 global $ajax_cart_details;
20 20
 $ajax_cart_details = $invoice->get_cart_details();
@@ -24,18 +24,18 @@  discard block
 block discarded – undo
24 24
 $quantities_enabled = wpinv_item_quantities_enabled();
25 25
 $use_taxes          = wpinv_use_taxes();
26 26
 $zero_tax           = !(float)$invoice->get_tax() > 0 ? true : false;
27
-$tax_label          = !$zero_tax && $use_taxes ? ( wpinv_prices_include_tax() ? __( '(Tax Incl.)', 'invoicing' ) : __( '(Tax Excl.)', 'invoicing' ) ) : '';
27
+$tax_label          = !$zero_tax && $use_taxes ? (wpinv_prices_include_tax() ? __('(Tax Incl.)', 'invoicing') : __('(Tax Excl.)', 'invoicing')) : '';
28 28
 ?>
29
-<?php do_action( 'wpinv_before_receipt', $invoice ); ?>
29
+<?php do_action('wpinv_before_receipt', $invoice); ?>
30 30
 <div class="wpinv-receipt">
31
-    <?php do_action( 'wpinv_receipt_start', $invoice ); ?>
32
-    <div class="wpinv-receipt-message"><?php _e( 'Thank you for your payment!', 'invoicing' ); ?></div>
33
-    <?php do_action( 'wpinv_before_receipt_details', $invoice ); ?>
31
+    <?php do_action('wpinv_receipt_start', $invoice); ?>
32
+    <div class="wpinv-receipt-message"><?php _e('Thank you for your payment!', 'invoicing'); ?></div>
33
+    <?php do_action('wpinv_before_receipt_details', $invoice); ?>
34 34
     <div class="wpinv-receipt-details">
35
-        <h3 class="wpinv-details-t"><?php echo apply_filters( 'wpinv_receipt_details_title', __( 'Invoice Details', 'invoicing' ) ); ?></h3>
36
-        <?php wpinv_display_invoice_details( $invoice ); ?>
35
+        <h3 class="wpinv-details-t"><?php echo apply_filters('wpinv_receipt_details_title', __('Invoice Details', 'invoicing')); ?></h3>
36
+        <?php wpinv_display_invoice_details($invoice); ?>
37 37
     </div>
38
-    <?php do_action( 'wpinv_after_receipt_details', $invoice ); ?>
39
-    <?php do_action( 'wpinv_receipt_end', $invoice ); ?>
38
+    <?php do_action('wpinv_after_receipt_details', $invoice); ?>
39
+    <?php do_action('wpinv_receipt_end', $invoice); ?>
40 40
 </div>
41
-<?php do_action( 'wpinv_after_receipt', $invoice ); ?>
42 41
\ No newline at end of file
42
+<?php do_action('wpinv_after_receipt', $invoice); ?>
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-wpinv-bp-core.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
     exit; // Exit if accessed directly
4 4
 }
5 5
 
@@ -11,60 +11,60 @@  discard block
 block discarded – undo
11 11
     public function __construct() {
12 12
         global $bp;
13 13
         
14
-        if ( !defined( 'WPINV_BP_SLUG' ) ) {
15
-            define( 'WPINV_BP_SLUG', 'invoices' );
14
+        if (!defined('WPINV_BP_SLUG')) {
15
+            define('WPINV_BP_SLUG', 'invoices');
16 16
         }
17 17
         
18
-        $position       = wpinv_get_option( 'wpinv_menu_position' );
18
+        $position       = wpinv_get_option('wpinv_menu_position');
19 19
         $position       = $position !== '' && $position !== false ? $position : 91;
20
-        $this->position = apply_filters( 'wpinv_bp_nav_position', $position );
20
+        $this->position = apply_filters('wpinv_bp_nav_position', $position);
21 21
         $this->slug     = WPINV_BP_SLUG;
22 22
         
23 23
         parent::start(
24 24
             'invoicing',
25
-            _x( 'Invoices', 'Invoices screen page <title>', 'invoicing' ),
26
-            trailingslashit( dirname( __FILE__ ) ),
25
+            _x('Invoices', 'Invoices screen page <title>', 'invoicing'),
26
+            trailingslashit(dirname(__FILE__)),
27 27
             array(
28 28
                 'adminbar_myaccount_order' => $this->position
29 29
             )
30 30
         );
31 31
     }
32 32
     
33
-    public function includes( $includes = array() ) {
34
-        parent::includes( $includes );
33
+    public function includes($includes = array()) {
34
+        parent::includes($includes);
35 35
     }
36 36
     
37
-    public function setup_globals( $args = array() ) {
37
+    public function setup_globals($args = array()) {
38 38
         global $bp;
39 39
 
40 40
         $args = array(
41 41
             'slug' => $this->slug,
42 42
         );
43 43
 
44
-        parent::setup_globals( $args );
44
+        parent::setup_globals($args);
45 45
     }
46 46
     
47
-    public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
48
-        if ( !bp_is_my_profile() ) {
47
+    public function setup_nav($main_nav = array(), $sub_nav = array()) {
48
+        if (!bp_is_my_profile()) {
49 49
             return;
50 50
         }
51 51
         
52
-        if ( wpinv_get_option( 'wpinv_bp_hide_menu' ) ) {
52
+        if (wpinv_get_option('wpinv_bp_hide_menu')) {
53 53
             return;
54 54
         }
55 55
         
56 56
         $this->setup_invoice_count();
57 57
 
58 58
         $user_domain    = bp_loggedin_user_domain();
59
-        $invoices_link  = trailingslashit( $user_domain . $this->slug );
60
-        $class          = ( 0 === $this->count ) ? 'no-count' : 'count';
59
+        $invoices_link  = trailingslashit($user_domain . $this->slug);
60
+        $class          = (0 === $this->count) ? 'no-count' : 'count';
61 61
 
62 62
         $main_nav_name = sprintf(
63
-            __( 'My Invoices %s', 'invoicing' ),
63
+            __('My Invoices %s', 'invoicing'),
64 64
             sprintf(
65 65
                 '<span class="%s">%s</span>',
66
-                esc_attr( $class ),
67
-                bp_core_number_format( $this->count )
66
+                esc_attr($class),
67
+                bp_core_number_format($this->count)
68 68
             )
69 69
         );
70 70
 
@@ -72,54 +72,54 @@  discard block
 block discarded – undo
72 72
             'name'                => $main_nav_name,
73 73
             'slug'                => $this->slug,
74 74
             'position'            => $this->position,
75
-            'screen_function'     => array( $this, 'invoices_screen' ),
75
+            'screen_function'     => array($this, 'invoices_screen'),
76 76
             'default_subnav_slug' => 'invoices',
77 77
             'item_css_id'         => $this->id
78 78
         );
79 79
         
80 80
         $sub_nav[] = array(
81
-            'name'            => _x( 'My Invoices', 'Invoices screen sub nav', 'invoicing' ),
81
+            'name'            => _x('My Invoices', 'Invoices screen sub nav', 'invoicing'),
82 82
             'slug'            => 'invoices',
83 83
             'parent_url'      => $invoices_link,
84 84
             'parent_slug'     => $this->slug,
85
-            'screen_function' => array( $this, 'invoices_screen' ),
85
+            'screen_function' => array($this, 'invoices_screen'),
86 86
             'position'        => 10,
87 87
             'item_css_id'     => 'invoices-my-invoices'
88 88
         );
89 89
 
90
-        parent::setup_nav( $main_nav, $sub_nav );
90
+        parent::setup_nav($main_nav, $sub_nav);
91 91
     }
92 92
     
93 93
     public function setup_title() {
94 94
         // Adjust title.
95
-        if ( (bool)bp_is_current_component( 'invoicing' ) ) {
95
+        if ((bool)bp_is_current_component('invoicing')) {
96 96
             global $bp;
97 97
             
98
-            $bp->bp_options_title = __( 'My Invoices', 'invoicing' );
98
+            $bp->bp_options_title = __('My Invoices', 'invoicing');
99 99
         }
100 100
 
101 101
         parent::setup_title();
102 102
     }
103 103
     
104 104
     public function invoices_screen() {
105
-        if ( wpinv_get_option( 'wpinv_bp_hide_menu' ) ) {
105
+        if (wpinv_get_option('wpinv_bp_hide_menu')) {
106 106
             return;
107 107
         }
108 108
         
109 109
         global $bp;
110 110
         
111
-        add_action( 'bp_template_content', array( $this, 'invoices_content' ) );
111
+        add_action('bp_template_content', array($this, 'invoices_content'));
112 112
 
113
-        $template = apply_filters( 'bp_core_template_plugin', 'members/single/plugins' );
113
+        $template = apply_filters('bp_core_template_plugin', 'members/single/plugins');
114 114
         
115
-        bp_core_load_template( apply_filters( 'wpinv_bp_core_template_plugin', $template ) );
115
+        bp_core_load_template(apply_filters('wpinv_bp_core_template_plugin', $template));
116 116
     }
117 117
     
118 118
     public function invoices_content() {
119
-        if ( $this->has_invoices( bp_ajax_querystring( 'invoices' ) ) ) {
119
+        if ($this->has_invoices(bp_ajax_querystring('invoices'))) {
120 120
             global $invoices_template;
121 121
             
122
-            do_action( 'wpinv_bp_invoices_before_content' );
122
+            do_action('wpinv_bp_invoices_before_content');
123 123
             ?>
124 124
             <div class="wpi-bp-invoices invoices invoicing" style="position:relative">
125 125
                 <div id="pag-top" class="pagination">
@@ -133,58 +133,58 @@  discard block
 block discarded – undo
133 133
                 <table class="table table-bordered table-hover wpi-user-invoices" style="margin:0">
134 134
                     <thead>
135 135
                         <tr>
136
-                            <?php foreach ( wpinv_get_user_invoices_columns() as $column_id => $column_name ) : ?>
137
-                                <th class="<?php echo esc_attr( $column_id ); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : '');?>"><span class="nobr"><?php echo esc_html( $column_name['title'] ); ?></span></th>
136
+                            <?php foreach (wpinv_get_user_invoices_columns() as $column_id => $column_name) : ?>
137
+                                <th class="<?php echo esc_attr($column_id); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : ''); ?>"><span class="nobr"><?php echo esc_html($column_name['title']); ?></span></th>
138 138
                             <?php endforeach; ?>
139 139
                         </tr>
140 140
                     </thead>
141 141
                     <tbody>
142
-                        <?php foreach ( $invoices_template->invoices as $invoice ) {
142
+                        <?php foreach ($invoices_template->invoices as $invoice) {
143 143
                             ?>
144 144
                             <tr class="wpinv-item wpinv-item-<?php echo $invoice_status = $invoice->get_status(); ?>">
145
-                                <?php foreach ( wpinv_get_user_invoices_columns() as $column_id => $column_name ) : ?>
146
-                                    <td class="<?php echo esc_attr( $column_id ); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : '');?>" data-title="<?php echo esc_attr( $column_name['title'] ); ?>">
147
-                                        <?php if ( has_action( 'wpinv_user_invoices_column_' . $column_id ) ) : ?>
148
-                                            <?php do_action( 'wpinv_user_invoices_column_' . $column_id, $invoice ); ?>
149
-
150
-                                        <?php elseif ( 'invoice-number' === $column_id ) : ?>
151
-                                            <a href="<?php echo esc_url( $invoice->get_view_url() ); ?>">
152
-                                                <?php echo _x( '#', 'hash before invoice number', 'invoicing' ) . $invoice->get_number(); ?>
145
+                                <?php foreach (wpinv_get_user_invoices_columns() as $column_id => $column_name) : ?>
146
+                                    <td class="<?php echo esc_attr($column_id); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : ''); ?>" data-title="<?php echo esc_attr($column_name['title']); ?>">
147
+                                        <?php if (has_action('wpinv_user_invoices_column_' . $column_id)) : ?>
148
+                                            <?php do_action('wpinv_user_invoices_column_' . $column_id, $invoice); ?>
149
+
150
+                                        <?php elseif ('invoice-number' === $column_id) : ?>
151
+                                            <a href="<?php echo esc_url($invoice->get_view_url()); ?>">
152
+                                                <?php echo _x('#', 'hash before invoice number', 'invoicing') . $invoice->get_number(); ?>
153 153
                                             </a>
154 154
 
155
-                                        <?php elseif ( 'invoice-date' === $column_id ) : $date = wpinv_get_invoice_date( $invoice->ID ); $dateYMD = wpinv_get_invoice_date( $invoice->ID, 'Y-m-d H:i:s' ); ?>
156
-                                            <time datetime="<?php echo strtotime( $dateYMD ); ?>" title="<?php echo $dateYMD; ?>"><?php echo $date; ?></time>
155
+                                        <?php elseif ('invoice-date' === $column_id) : $date = wpinv_get_invoice_date($invoice->ID); $dateYMD = wpinv_get_invoice_date($invoice->ID, 'Y-m-d H:i:s'); ?>
156
+                                            <time datetime="<?php echo strtotime($dateYMD); ?>" title="<?php echo $dateYMD; ?>"><?php echo $date; ?></time>
157 157
 
158
-                                        <?php elseif ( 'invoice-status' === $column_id ) : ?>
159
-                                            <?php echo wpinv_invoice_status_label( $invoice_status, $invoice->get_status( true ) ) ; ?>
158
+                                        <?php elseif ('invoice-status' === $column_id) : ?>
159
+                                            <?php echo wpinv_invoice_status_label($invoice_status, $invoice->get_status(true)); ?>
160 160
 
161
-                                        <?php elseif ( 'invoice-total' === $column_id ) : ?>
162
-                                            <?php echo $invoice->get_total( true ); ?>
161
+                                        <?php elseif ('invoice-total' === $column_id) : ?>
162
+                                            <?php echo $invoice->get_total(true); ?>
163 163
 
164
-                                        <?php elseif ( 'invoice-actions' === $column_id ) : ?>
164
+                                        <?php elseif ('invoice-actions' === $column_id) : ?>
165 165
                                             <?php
166 166
                                                 $actions = array(
167 167
                                                     'pay'    => array(
168 168
                                                         'url'  => $invoice->get_checkout_payment_url(),
169
-                                                        'name' => __( 'Pay Now', 'invoicing' ),
169
+                                                        'name' => __('Pay Now', 'invoicing'),
170 170
                                                         'class' => 'btn-success'
171 171
                                                     ),
172 172
                                                     'print'   => array(
173 173
                                                         'url'  => $invoice->get_view_url(),
174
-                                                        'name' => __( 'Print', 'invoicing' ),
174
+                                                        'name' => __('Print', 'invoicing'),
175 175
                                                         'class' => 'btn-primary',
176 176
                                                         'attrs' => 'target="_blank"'
177 177
                                                     )
178 178
                                                 );
179 179
 
180
-                                                if ( ! $invoice->needs_payment() ) {
181
-                                                    unset( $actions['pay'] );
180
+                                                if (!$invoice->needs_payment()) {
181
+                                                    unset($actions['pay']);
182 182
                                                 }
183 183
 
184
-                                                if ( $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice ) ) {
185
-                                                    foreach ( $actions as $key => $action ) {
184
+                                                if ($actions = apply_filters('wpinv_user_invoices_actions', $actions, $invoice)) {
185
+                                                    foreach ($actions as $key => $action) {
186 186
                                                         $class = !empty($action['class']) ? sanitize_html_class($action['class']) : '';
187
-                                                        echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( !empty($action['attrs']) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>';
187
+                                                        echo '<a href="' . esc_url($action['url']) . '" class="btn btn-sm ' . $class . ' ' . sanitize_html_class($key) . '" ' . (!empty($action['attrs']) ? $action['attrs'] : '') . '>' . $action['name'] . '</a>';
188 188
                                                     }
189 189
                                                 }
190 190
                                             ?>
@@ -212,64 +212,64 @@  discard block
 block discarded – undo
212 212
             </div>
213 213
             <?php
214 214
         
215
-            do_action( 'wpinv_bp_invoices_after_content' );
215
+            do_action('wpinv_bp_invoices_after_content');
216 216
         } else {
217 217
             ?>
218 218
             <div id="message" class="info">
219
-                <p><?php _e( 'No invoice has been made yet.', 'invoicing' ); ?></p>
219
+                <p><?php _e('No invoice has been made yet.', 'invoicing'); ?></p>
220 220
             </div>
221 221
             <?php
222 222
         }
223 223
         
224
-        if ( defined( 'DOING_AJAX' ) ) {
224
+        if (defined('DOING_AJAX')) {
225 225
             exit;
226 226
         }
227 227
     }
228 228
     
229
-    public function has_invoices( $args = '' ) {
229
+    public function has_invoices($args = '') {
230 230
         global $invoices_template;
231 231
 
232
-        $per_page = absint( wpinv_get_option( 'wpinv_bp_per_page' ) );
232
+        $per_page = absint(wpinv_get_option('wpinv_bp_per_page'));
233 233
         // Parse arguments.
234
-        $r = bp_parse_args( $args, array(
234
+        $r = bp_parse_args($args, array(
235 235
             'status'            => 'all',
236 236
             'page_arg'          => 'bpage',
237 237
             'page'              => 1,
238 238
             'per_page'          => $per_page > 0 ? $per_page : 20,
239 239
             'max'               => false,
240 240
             'user_id'           => bp_loggedin_user_id(),
241
-        ), 'has_invoices' );
241
+        ), 'has_invoices');
242 242
 
243 243
 
244
-        if ( ! empty( $r['max'] ) && ( (int)$r['per_page'] > (int)$r['max'] ) ) {
244
+        if (!empty($r['max']) && ((int)$r['per_page'] > (int)$r['max'])) {
245 245
             $r['per_page'] = (int)$r['max'];
246 246
         }
247 247
 
248 248
         // Get the invoices.
249
-        $invoices_template = new WPInv_BP_Invoices_Template( $r['status'], $r['page'], $r['per_page'], $r['max'], $r['user_id'], $r['page_arg'] );
249
+        $invoices_template = new WPInv_BP_Invoices_Template($r['status'], $r['page'], $r['per_page'], $r['max'], $r['user_id'], $r['page_arg']);
250 250
 
251
-        return apply_filters( 'wpinv_bp_has_invoices', $invoices_template->has_invoices(), $invoices_template, $r );
251
+        return apply_filters('wpinv_bp_has_invoices', $invoices_template->has_invoices(), $invoices_template, $r);
252 252
     }
253 253
     
254 254
     public function setup_invoice_count() {
255
-        $query      = apply_filters( 'wpinv_user_invoices_count_query', array( 'user' => bp_loggedin_user_id(), 'limit' => '-1', 'return' => 'ids', 'paginate' => false ) );
256
-        $invoices   = wpinv_get_invoices( $query );
255
+        $query      = apply_filters('wpinv_user_invoices_count_query', array('user' => bp_loggedin_user_id(), 'limit' => '-1', 'return' => 'ids', 'paginate' => false));
256
+        $invoices   = wpinv_get_invoices($query);
257 257
         
258
-        $this->count = !empty( $invoices ) ? count( $invoices ) : 0;
258
+        $this->count = !empty($invoices) ? count($invoices) : 0;
259 259
     }
260 260
     
261 261
     public function pagination_count() {
262 262
         global $invoices_template;
263 263
 
264
-        $start_num = intval( ( $invoices_template->pag_page - 1 ) * $invoices_template->pag_num ) + 1;
265
-        $from_num  = bp_core_number_format( $start_num );
266
-        $to_num    = bp_core_number_format( ( $start_num + ( $invoices_template->pag_num - 1 ) > $invoices_template->total_invoice_count ) ? $invoices_template->total_invoice_count : $start_num + ( $invoices_template->pag_num - 1 ) );
267
-        $total     = bp_core_number_format( $invoices_template->total_invoice_count );
264
+        $start_num = intval(($invoices_template->pag_page - 1) * $invoices_template->pag_num) + 1;
265
+        $from_num  = bp_core_number_format($start_num);
266
+        $to_num    = bp_core_number_format(($start_num + ($invoices_template->pag_num - 1) > $invoices_template->total_invoice_count) ? $invoices_template->total_invoice_count : $start_num + ($invoices_template->pag_num - 1));
267
+        $total     = bp_core_number_format($invoices_template->total_invoice_count);
268 268
 
269
-        if ( 1 == $invoices_template->total_invoice_count ) {
270
-            $message = __( 'Viewing 1 invoice', 'invoicing' );
269
+        if (1 == $invoices_template->total_invoice_count) {
270
+            $message = __('Viewing 1 invoice', 'invoicing');
271 271
         } else {
272
-            $message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s invoice', 'Viewing %1$s - %2$s of %3$s invoices', $invoices_template->total_invoice_count, 'invoicing' ), $from_num, $to_num, $total );
272
+            $message = sprintf(_n('Viewing %1$s - %2$s of %3$s invoice', 'Viewing %1$s - %2$s of %3$s invoices', $invoices_template->total_invoice_count, 'invoicing'), $from_num, $to_num, $total);
273 273
         }
274 274
 
275 275
         return $message;
@@ -278,32 +278,32 @@  discard block
 block discarded – undo
278 278
     function pagination_links() {
279 279
         global $invoices_template;
280 280
 
281
-        return apply_filters( 'wpinv_bp_get_pagination_links', $invoices_template->pag_links );
281
+        return apply_filters('wpinv_bp_get_pagination_links', $invoices_template->pag_links);
282 282
     }
283 283
     
284
-    public function bp_section( $settings = array() ) {
285
-        $settings['wpinv_bp'] = __( 'BuddyPress Integration', 'invoicing' );
284
+    public function bp_section($settings = array()) {
285
+        $settings['wpinv_bp'] = __('BuddyPress Integration', 'invoicing');
286 286
         return $settings;
287 287
     }
288 288
     
289
-    public function bp_settings( $settings = array() ) {
289
+    public function bp_settings($settings = array()) {
290 290
         $settings['wpinv_bp'] = array(
291 291
             'wpinv_bp_labels' => array(
292 292
                 'id'   => 'wpinv_bp_settings',
293
-                'name' => '<h3>' . __( 'BuddyPress Integration', 'invoicing' ) . '</h3>',
293
+                'name' => '<h3>' . __('BuddyPress Integration', 'invoicing') . '</h3>',
294 294
                 'desc' => '',
295 295
                 'type' => 'header',
296 296
             ),
297 297
             'wpinv_bp_hide_menu' => array(
298 298
                 'id'   => 'wpinv_bp_hide_menu',
299
-                'name' => __( 'Hide Invoices link', 'invoicing' ),
300
-                'desc' => __( 'Hide Invoices link from BP Profile menu.', 'invoicing' ),
299
+                'name' => __('Hide Invoices link', 'invoicing'),
300
+                'desc' => __('Hide Invoices link from BP Profile menu.', 'invoicing'),
301 301
                 'type' => 'checkbox',
302 302
             ),
303 303
             'wpinv_menu_position' => array(
304 304
                 'id'   => 'wpinv_menu_position',
305
-                'name' => __( 'Menu position', 'invoicing' ),
306
-                'desc' => __( 'Menu position for the Invoices link in BP Profile menu.', 'invoicing' ),
305
+                'name' => __('Menu position', 'invoicing'),
306
+                'desc' => __('Menu position for the Invoices link in BP Profile menu.', 'invoicing'),
307 307
                 'type' => 'number',
308 308
                 'size' => 'small',
309 309
                 'min'  => '1',
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
             ),
314 314
             'wpinv_bp_per_page' => array(
315 315
                 'id'   => 'wpinv_bp_per_page',
316
-                'name' => __( 'Max invoices per page', 'invoicing' ),
317
-                'desc' => __( 'Enter a number to lists the invoices for each page.', 'invoicing' ),
316
+                'name' => __('Max invoices per page', 'invoicing'),
317
+                'desc' => __('Enter a number to lists the invoices for each page.', 'invoicing'),
318 318
                 'type' => 'number',
319 319
                 'size' => 'small',
320 320
                 'min'  => '1',
@@ -339,25 +339,25 @@  discard block
 block discarded – undo
339 339
     public $pag_links = '';
340 340
     public $total_invoice_count = 0;
341 341
     
342
-    public function __construct( $status, $page, $per_page, $max, $user_id, $page_arg = 'bpage' ) {
343
-        $this->invoices = array( 'invoices' => array(), 'total' => 0 );
342
+    public function __construct($status, $page, $per_page, $max, $user_id, $page_arg = 'bpage') {
343
+        $this->invoices = array('invoices' => array(), 'total' => 0);
344 344
         
345
-        $this->pag_arg  = sanitize_key( $page_arg );
346
-        $this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $page );
347
-        $this->pag_num  = bp_sanitize_pagination_arg( 'num', $per_page );
345
+        $this->pag_arg  = sanitize_key($page_arg);
346
+        $this->pag_page = bp_sanitize_pagination_arg($this->pag_arg, $page);
347
+        $this->pag_num  = bp_sanitize_pagination_arg('num', $per_page);
348 348
 
349
-        $query_args     = array( 'user' => $user_id, 'page' => $this->pag_page, 'limit' => $this->pag_num, 'return' => 'self', 'paginate' => true );
350
-        if ( !empty( $status ) && $status != 'all' ) {
349
+        $query_args     = array('user' => $user_id, 'page' => $this->pag_page, 'limit' => $this->pag_num, 'return' => 'self', 'paginate' => true);
350
+        if (!empty($status) && $status != 'all') {
351 351
            $query_args['status'] = $status;
352 352
         }
353
-        $invoices  = wpinv_get_invoices( apply_filters( 'wpinv_bp_user_invoices_query', $query_args ) );
353
+        $invoices = wpinv_get_invoices(apply_filters('wpinv_bp_user_invoices_query', $query_args));
354 354
         
355
-        if ( !empty( $invoices ) && !empty( $invoices->found_posts ) ) {
356
-            $this->invoices['invoices'] = array_map( 'wpinv_get_invoice', $invoices->posts );
355
+        if (!empty($invoices) && !empty($invoices->found_posts)) {
356
+            $this->invoices['invoices'] = array_map('wpinv_get_invoice', $invoices->posts);
357 357
             $this->invoices['total']    = $invoices->found_posts;
358 358
         }
359 359
 
360
-        if ( empty( $max ) || ( $max >= (int)$this->invoices['total'] ) ) {
360
+        if (empty($max) || ($max >= (int)$this->invoices['total'])) {
361 361
             $this->total_invoice_count = (int)$this->invoices['total'];
362 362
         } else {
363 363
             $this->total_invoice_count = (int)$max;
@@ -365,52 +365,52 @@  discard block
 block discarded – undo
365 365
 
366 366
         $this->invoices = $this->invoices['invoices'];
367 367
 
368
-        $invoice_count = count( $this->invoices );
368
+        $invoice_count = count($this->invoices);
369 369
 
370
-        if ( empty( $max ) || ( $max >= (int)$invoice_count ) ) {
370
+        if (empty($max) || ($max >= (int)$invoice_count)) {
371 371
             $this->invoice_count = (int)$invoice_count;
372 372
         } else {
373 373
             $this->invoice_count = (int)$max;
374 374
         }
375 375
         
376
-        if ( ! empty( $this->total_invoice_count ) && ! empty( $this->pag_num ) ) {
377
-            $this->pag_links = paginate_links( array(
378
-                'base'      => add_query_arg( $this->pag_arg, '%#%' ),
376
+        if (!empty($this->total_invoice_count) && !empty($this->pag_num)) {
377
+            $this->pag_links = paginate_links(array(
378
+                'base'      => add_query_arg($this->pag_arg, '%#%'),
379 379
                 'format'    => '',
380
-                'total'     => ceil( (int)$this->total_invoice_count / (int)$this->pag_num ),
380
+                'total'     => ceil((int)$this->total_invoice_count / (int)$this->pag_num),
381 381
                 'current'   => (int)$this->pag_page,
382
-                'prev_text' => _x( '&larr;', 'Invoice pagination previous text', 'invoicing' ),
383
-                'next_text' => _x( '&rarr;', 'Invoice pagination next text',     'invoicing' ),
382
+                'prev_text' => _x('&larr;', 'Invoice pagination previous text', 'invoicing'),
383
+                'next_text' => _x('&rarr;', 'Invoice pagination next text', 'invoicing'),
384 384
                 'mid_size'  => 1,
385 385
                 'add_args'  => array(),
386
-            ) );
386
+            ));
387 387
         }
388 388
     }
389 389
 
390 390
     public function has_invoices() {
391
-        return (bool) ! empty( $this->invoice_count );
391
+        return (bool)!empty($this->invoice_count);
392 392
     }
393 393
 
394 394
     public function next_invoice() {
395 395
         $this->current_invoice++;
396
-        $this->invoice = $this->invoices[ $this->current_invoice ];
396
+        $this->invoice = $this->invoices[$this->current_invoice];
397 397
 
398 398
         return $this->invoice;
399 399
     }
400 400
 
401 401
     public function rewind_invoices() {
402 402
         $this->current_invoice = -1;
403
-        if ( $this->invoice_count > 0 ) {
403
+        if ($this->invoice_count > 0) {
404 404
             $this->invoice = $this->invoices[0];
405 405
         }
406 406
     }
407 407
 
408 408
     public function invoices() {
409
-        if ( ( $this->current_invoice + 1 ) < $this->invoice_count ) {
409
+        if (($this->current_invoice + 1) < $this->invoice_count) {
410 410
             return true;
411
-        } elseif ( ( $this->current_invoice + 1 ) === $this->invoice_count ) {
411
+        } elseif (($this->current_invoice + 1) === $this->invoice_count) {
412 412
 
413
-            do_action( 'wpinv_bp_invoice_loop_end' );
413
+            do_action('wpinv_bp_invoice_loop_end');
414 414
             
415 415
             $this->rewind_invoices();
416 416
         }
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
         $this->in_the_loop = true;
425 425
         $this->invoice     = $this->next_invoice();
426 426
 
427
-        if ( 0 === $this->current_invoice ) {
428
-            do_action( 'wpinv_bp_invoice_loop_start' );
427
+        if (0 === $this->current_invoice) {
428
+            do_action('wpinv_bp_invoice_loop_start');
429 429
         }
430 430
     }
431 431
 }
@@ -435,9 +435,9 @@  discard block
 block discarded – undo
435 435
 
436 436
     $bp->invoicing = new WPInv_BP_Component();
437 437
     
438
-    add_action( 'wp_ajax_invoicing_filter', array( $bp->invoicing, 'invoices_content' ) );
439
-    add_action( 'wp_ajax_nopriv_invoicing_filter', array( $bp->invoicing, 'invoices_content' ) );
440
-    add_filter( 'wpinv_settings_sections_general', array( $bp->invoicing, 'bp_section' ), 10, 1 );
441
-    add_filter( 'wpinv_settings_general', array( $bp->invoicing, 'bp_settings' ), 10, 1 );
438
+    add_action('wp_ajax_invoicing_filter', array($bp->invoicing, 'invoices_content'));
439
+    add_action('wp_ajax_nopriv_invoicing_filter', array($bp->invoicing, 'invoices_content'));
440
+    add_filter('wpinv_settings_sections_general', array($bp->invoicing, 'bp_section'), 10, 1);
441
+    add_filter('wpinv_settings_general', array($bp->invoicing, 'bp_settings'), 10, 1);
442 442
 }
443
-add_action( 'bp_loaded', 'wpinv_bp_setup_component' );
444 443
\ No newline at end of file
444
+add_action('bp_loaded', 'wpinv_bp_setup_component');
445 445
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-invoice-notes.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,39 +1,39 @@
 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_Notes {
8
-    public static function output( $post ) {
8
+    public static function output($post) {
9 9
         global $post;
10 10
 
11
-        $notes = wpinv_get_invoice_notes( $post->ID );
11
+        $notes = wpinv_get_invoice_notes($post->ID);
12 12
 
13 13
         echo '<ul class="invoice_notes">';
14 14
 
15
-        if ( $notes ) {
16
-            foreach( $notes as $note ) {
17
-                wpinv_get_invoice_note_line_item( $note );
15
+        if ($notes) {
16
+            foreach ($notes as $note) {
17
+                wpinv_get_invoice_note_line_item($note);
18 18
             }
19 19
 
20 20
         } else {
21
-            echo '<li>' . __( 'There are no notes yet.', 'invoicing' ) . '</li>';
21
+            echo '<li>' . __('There are no notes yet.', 'invoicing') . '</li>';
22 22
         }
23 23
 
24 24
         echo '</ul>';
25 25
         ?>
26 26
         <div class="add_note">
27
-            <h4><?php _e( 'Add note', 'invoicing' ); ?></h4>
27
+            <h4><?php _e('Add note', 'invoicing'); ?></h4>
28 28
             <p>
29 29
                 <textarea type="text" name="invoice_note" id="add_invoice_note" class="input-text" cols="20" rows="5"></textarea>
30 30
             </p>
31 31
             <p>
32 32
                 <select name="invoice_note_type" id="invoice_note_type">
33
-                    <option value=""><?php _e( 'Private note', 'invoicing' ); ?></option>
34
-                    <option value="customer"><?php _e( 'Note to customer', 'invoicing' ); ?></option>
33
+                    <option value=""><?php _e('Private note', 'invoicing'); ?></option>
34
+                    <option value="customer"><?php _e('Note to customer', 'invoicing'); ?></option>
35 35
                 </select>
36
-                <a href="#" class="add_note button"><?php _e( 'Add', 'invoicing' ); ?></a> <span class="description"><?php _e( 'Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing' ); ?></span>
36
+                <a href="#" class="add_note button"><?php _e('Add', 'invoicing'); ?></a> <span class="description"><?php _e('Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing'); ?></span>
37 37
             </p>
38 38
         </div>
39 39
         <?php
Please login to merge, or discard this patch.
includes/wpinv-error-functions.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,61 +1,61 @@  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
 function wpinv_print_errors() {
8 8
     $errors = wpinv_get_errors();
9 9
 
10
-    if ( $errors ) {
11
-        $classes = apply_filters( 'wpinv_error_class', array(
10
+    if ($errors) {
11
+        $classes = apply_filters('wpinv_error_class', array(
12 12
             'wpinv_errors', 'wpinv-alert', 'wpinv-alert-error'
13
-        ) );
14
-        echo '<div class="' . implode( ' ', $classes ) . '">';
13
+        ));
14
+        echo '<div class="' . implode(' ', $classes) . '">';
15 15
             // Loop error codes and display errors
16
-           foreach ( $errors as $error_id => $error ) {
17
-                echo '<p class="wpinv_error" id="wpinv_error_' . $error_id . '"><strong>' . __( 'Error', 'invoicing' ) . '</strong>: ' . $error . '</p>';
16
+           foreach ($errors as $error_id => $error) {
17
+                echo '<p class="wpinv_error" id="wpinv_error_' . $error_id . '"><strong>' . __('Error', 'invoicing') . '</strong>: ' . $error . '</p>';
18 18
            }
19 19
         echo '</div>';
20 20
         wpinv_clear_errors();
21 21
     }
22 22
 }
23
-add_action( 'wpinv_purchase_form_before_submit', 'wpinv_print_errors' );
24
-add_action( 'wpinv_ajax_checkout_errors', 'wpinv_print_errors' );
23
+add_action('wpinv_purchase_form_before_submit', 'wpinv_print_errors');
24
+add_action('wpinv_ajax_checkout_errors', 'wpinv_print_errors');
25 25
 
26 26
 function wpinv_get_errors() {
27 27
     global $wpi_session;
28 28
     
29
-    return $wpi_session->get( 'wpinv_errors' );
29
+    return $wpi_session->get('wpinv_errors');
30 30
 }
31 31
 
32
-function wpinv_set_error( $error_id, $error_message ) {
32
+function wpinv_set_error($error_id, $error_message) {
33 33
     global $wpi_session;
34 34
     
35 35
     $errors = wpinv_get_errors();
36 36
 
37
-    if ( ! $errors ) {
37
+    if (!$errors) {
38 38
         $errors = array();
39 39
     }
40 40
 
41
-    $errors[ $error_id ] = $error_message;
42
-    $wpi_session->set( 'wpinv_errors', $errors );
41
+    $errors[$error_id] = $error_message;
42
+    $wpi_session->set('wpinv_errors', $errors);
43 43
 }
44 44
 
45 45
 function wpinv_clear_errors() {
46 46
     global $wpi_session;
47 47
     
48
-    $wpi_session->set( 'wpinv_errors', null );
48
+    $wpi_session->set('wpinv_errors', null);
49 49
 }
50 50
 
51
-function wpinv_unset_error( $error_id ) {
51
+function wpinv_unset_error($error_id) {
52 52
     global $wpi_session;
53 53
     
54 54
     $errors = wpinv_get_errors();
55 55
 
56
-    if ( $errors ) {
57
-        unset( $errors[ $error_id ] );
58
-        $wpi_session->set( 'wpinv_errors', $errors );
56
+    if ($errors) {
57
+        unset($errors[$error_id]);
58
+        $wpi_session->set('wpinv_errors', $errors);
59 59
     }
60 60
 }
61 61
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
     die();
64 64
 }
65 65
 
66
-function wpinv_die( $message = '', $title = '', $status = 400 ) {
67
-    add_filter( 'wp_die_ajax_handler', 'wpinv_die_handler', 10, 3 );
68
-    add_filter( 'wp_die_handler', 'wpinv_die_handler', 10, 3 );
69
-    wp_die( $message, $title, array( 'response' => $status ));
66
+function wpinv_die($message = '', $title = '', $status = 400) {
67
+    add_filter('wp_die_ajax_handler', 'wpinv_die_handler', 10, 3);
68
+    add_filter('wp_die_handler', 'wpinv_die_handler', 10, 3);
69
+    wp_die($message, $title, array('response' => $status));
70 70
 }
Please login to merge, or discard this patch.
includes/libraries/GeoIp2/Model/City.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,6 @@
 block discarded – undo
130 130
     private function mostSpecificSubdivision()
131 131
     {
132 132
         return empty($this->subdivisions) ?
133
-            new \GeoIp2\Record\Subdivision(array(), $this->locales) :
134
-            end($this->subdivisions);
133
+            new \GeoIp2\Record\Subdivision(array(), $this->locales) : end($this->subdivisions);
135 134
     }
136 135
 }
Please login to merge, or discard this patch.
includes/libraries/GeoIp2/WebService/Client.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
         // This is for backwards compatibility. Do not remove except for a
77 77
         // major version bump.
78 78
         if (is_string($options)) {
79
-            $options = array( 'host' => $options );
79
+            $options = array('host' => $options);
80 80
         }
81 81
 
82 82
         if (!isset($options['host'])) {
Please login to merge, or discard this patch.
includes/libraries/class-emogrifier.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		if ($nodesWithStyleAttributes !== false) {
239 239
 			/** @var $nodeWithStyleAttribute DOMNode */
240 240
 			foreach ($nodesWithStyleAttributes as $node) {
241
-				$normalizedOriginalStyle = preg_replace_callback( '/[A-z\\-]+(?=\\:)/S', array( $this, 'strtolower' ), $node->getAttribute('style') );
241
+				$normalizedOriginalStyle = preg_replace_callback('/[A-z\\-]+(?=\\:)/S', array($this, 'strtolower'), $node->getAttribute('style'));
242 242
 
243 243
 				// in order to not overwrite existing style attributes in the HTML, we have to save the original HTML styles
244 244
 				$nodePath = $node->getNodePath();
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			}
290 290
 
291 291
 			// now sort the selectors by precedence
292
-			usort($allSelectors, array($this,'sortBySelectorPrecedence'));
292
+			usort($allSelectors, array($this, 'sortBySelectorPrecedence'));
293 293
 
294 294
 			$this->caches[self::CACHE_KEY_CSS][$cssKey] = $allSelectors;
295 295
 		}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		if ($nodesWithStyleDisplayNone->length > 0) {
330 330
 			/** @var $node \DOMNode */
331 331
 			foreach ($nodesWithStyleDisplayNone as $node) {
332
-				if ($node->parentNode && is_callable(array($node->parentNode,'removeChild'))) {
332
+				if ($node->parentNode && is_callable(array($node->parentNode, 'removeChild'))) {
333 333
 					$node->parentNode->removeChild($node);
334 334
 				}
335 335
 			}
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 		$this->copyCssWithMediaToStyleNode($cssParts, $xmlDocument);
339 339
 
340 340
 		if ($this->preserveEncoding) {
341
-			if ( function_exists( 'mb_convert_encoding' ) ) {
342
-				return mb_convert_encoding( $xmlDocument->saveHTML(), self::ENCODING, 'HTML-ENTITIES' );
341
+			if (function_exists('mb_convert_encoding')) {
342
+				return mb_convert_encoding($xmlDocument->saveHTML(), self::ENCODING, 'HTML-ENTITIES');
343 343
 			} else {
344
-				return htmlspecialchars_decode( utf8_encode( html_entity_decode( $xmlDocument->saveHTML(), ENT_COMPAT, self::ENCODING ) ) );
344
+				return htmlspecialchars_decode(utf8_encode(html_entity_decode($xmlDocument->saveHTML(), ENT_COMPAT, self::ENCODING)));
345 345
 			}
346 346
 		} else {
347 347
 			return $xmlDocument->saveHTML();
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 	 * @return array
463 463
 	 */
464 464
 	private function splitCssAndMediaQuery($css) {
465
-		$css = preg_replace_callback( '#@media\\s+(?:only\\s)?(?:[\\s{\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', array( $this, '_media_concat' ), $css );
465
+		$css = preg_replace_callback('#@media\\s+(?:only\\s)?(?:[\\s{\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', array($this, '_media_concat'), $css);
466 466
 
467 467
 		// filter the CSS
468 468
 		$search = array(
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 		return array('css' => $css, 'media' => self::$_media);
487 487
 	}
488 488
 
489
-	private function _media_concat( $matches ) {
489
+	private function _media_concat($matches) {
490 490
 		self::$_media .= $matches[0];
491 491
 	}
492 492
 
@@ -524,10 +524,10 @@  discard block
 block discarded – undo
524 524
 			$bodyWithoutUnprocessableTags = $this->html;
525 525
 		}
526 526
 
527
-		if ( function_exists( 'mb_convert_encoding' ) ) {
528
-			return mb_convert_encoding( $bodyWithoutUnprocessableTags, 'HTML-ENTITIES', self::ENCODING );
527
+		if (function_exists('mb_convert_encoding')) {
528
+			return mb_convert_encoding($bodyWithoutUnprocessableTags, 'HTML-ENTITIES', self::ENCODING);
529 529
 		} else {
530
-			return htmlspecialchars_decode( utf8_decode( htmlentities( $bodyWithoutUnprocessableTags, ENT_COMPAT, self::ENCODING, false ) ) );
530
+			return htmlspecialchars_decode(utf8_decode(htmlentities($bodyWithoutUnprocessableTags, ENT_COMPAT, self::ENCODING, false)));
531 531
 		}
532 532
 	}
533 533
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 			$precedence = 0;
563 563
 			$value = 100;
564 564
 			// ids: worth 100, classes: worth 10, elements: worth 1
565
-			$search = array('\\#','\\.','');
565
+			$search = array('\\#', '\\.', '');
566 566
 
567 567
 			foreach ($search as $s) {
568 568
 				if (trim($selector == '')) {
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	private function translateCssToXpath($paramCssSelector) {
592 592
 		$cssSelector = ' ' . $paramCssSelector . ' ';
593
-		$cssSelector = preg_replace_callback( '/\s+\w+\s+/', array( $this, 'strtolower' ), $cssSelector );
593
+		$cssSelector = preg_replace_callback('/\s+\w+\s+/', array($this, 'strtolower'), $cssSelector);
594 594
 		$cssSelector = trim($cssSelector);
595 595
 		$xpathKey = md5($cssSelector);
596 596
 		if (!isset($this->caches[self::CACHE_KEY_XPATH][$xpathKey])) {
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	 * @return array
714 714
 	 */
715 715
 	private function parseNth(array $match) {
716
-		if (in_array(strtolower($match[2]), array('even','odd'))) {
716
+		if (in_array(strtolower($match[2]), array('even', 'odd'))) {
717 717
 			$index = strtolower($match[2]) == 'even' ? 0 : 1;
718 718
 			return array(self::MULTIPLIER => 2, self::INDEX => $index);
719 719
 		} elseif (stripos($match[2], 'n') === false) {
Please login to merge, or discard this patch.