@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -$email_footer = apply_filters( 'wpinv_email_footer_text', wpinv_get_option( 'email_footer_text' ) ); |
|
| 7 | -$email_footer = $email_footer ? wpautop( wp_kses_post( wptexturize( $email_footer ) ) ) : ''; |
|
| 6 | +$email_footer = apply_filters('wpinv_email_footer_text', wpinv_get_option('email_footer_text')); |
|
| 7 | +$email_footer = $email_footer ? wpautop(wp_kses_post(wptexturize($email_footer))) : ''; |
|
| 8 | 8 | ?> |
| 9 | 9 | </div> |
| 10 | 10 | </td> |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -if ( !isset( $email_heading ) ) { |
|
| 6 | +if (!isset($email_heading)) { |
|
| 7 | 7 | global $email_heading; |
| 8 | 8 | } |
| 9 | 9 | ?> |
| 10 | 10 | <!DOCTYPE html> |
| 11 | 11 | <html dir="<?php echo is_rtl() ? 'rtl' : 'ltr'?>"> |
| 12 | 12 | <head> |
| 13 | - <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" /> |
|
| 13 | + <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" /> |
|
| 14 | 14 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 15 | 15 | <meta name="robots" content="noindex,nofollow"> |
| 16 | 16 | <title><?php echo wpinv_get_blogname(); ?></title> |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | <td align="center" valign="top"> |
| 23 | 23 | <div id="template_header_image"> |
| 24 | 24 | <?php |
| 25 | - if ( $img = wpinv_get_option( 'email_header_image' ) ) { |
|
| 26 | - echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url( $img ) . '" alt="' . esc_attr( wpinv_get_blogname() ) . '" /></p>'; |
|
| 25 | + if ($img = wpinv_get_option('email_header_image')) { |
|
| 26 | + echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url($img) . '" alt="' . esc_attr(wpinv_get_blogname()) . '" /></p>'; |
|
| 27 | 27 | } |
| 28 | 28 | ?> |
| 29 | 29 | </div> |
| 30 | 30 | <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_container"> |
| 31 | - <?php if ( !empty( $email_heading ) ) { ?> |
|
| 31 | + <?php if (!empty($email_heading)) { ?> |
|
| 32 | 32 | <tr> |
| 33 | 33 | <td align="center" valign="top"> |
| 34 | 34 | <!-- Header --> |
@@ -1,67 +1,67 @@ |
||
| 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_before_billing_details', $invoice ); ?> |
|
| 6 | +do_action('wpinv_email_before_billing_details', $invoice); ?> |
|
| 7 | 7 | <div id="wpinv-email-billing"> |
| 8 | - <h3 class="wpinv-address-t"><?php echo apply_filters( 'wpinv_email_billing_title', __( 'Billing Details', 'invoicing' ) ); ?></h3> |
|
| 8 | + <h3 class="wpinv-address-t"><?php echo apply_filters('wpinv_email_billing_title', __('Billing Details', 'invoicing')); ?></h3> |
|
| 9 | 9 | <?php |
| 10 | 10 | $address_row = ''; |
| 11 | - if ( $address = $invoice->get_address() ) { |
|
| 12 | - $address_row .= wpautop( wp_kses_post( $address ) ); |
|
| 11 | + if ($address = $invoice->get_address()) { |
|
| 12 | + $address_row .= wpautop(wp_kses_post($address)); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $address_fields = array(); |
| 16 | - if ( !empty( $invoice->city ) ) { |
|
| 16 | + if (!empty($invoice->city)) { |
|
| 17 | 17 | $address_fields[] = $invoice->city; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - $country_code = !empty( $invoice->country ) ? $invoice->country : ''; |
|
| 21 | - if ( !empty( $invoice->state ) ) { |
|
| 22 | - $address_fields[] = wpinv_state_name( $invoice->state, $country_code ); |
|
| 20 | + $country_code = !empty($invoice->country) ? $invoice->country : ''; |
|
| 21 | + if (!empty($invoice->state)) { |
|
| 22 | + $address_fields[] = wpinv_state_name($invoice->state, $country_code); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if ( !empty( $address_fields ) ) { |
|
| 26 | - $address_fields = implode( ", ", $address_fields ); |
|
| 27 | - $address_row .= wpautop( wp_kses_post( $address_fields ) ); |
|
| 25 | + if (!empty($address_fields)) { |
|
| 26 | + $address_fields = implode(", ", $address_fields); |
|
| 27 | + $address_row .= wpautop(wp_kses_post($address_fields)); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if ( !empty( $country_code ) ) { |
|
| 31 | - $country = wpinv_country_name( $country_code ); |
|
| 32 | - $address_row .= wpautop( wp_kses_post( trim( $country . '(' . $country_code . ')' . ' ' . $invoice->zip ) ) ); |
|
| 30 | + if (!empty($country_code)) { |
|
| 31 | + $country = wpinv_country_name($country_code); |
|
| 32 | + $address_row .= wpautop(wp_kses_post(trim($country . '(' . $country_code . ')' . ' ' . $invoice->zip))); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | ?> |
| 36 | 36 | <table class="table table-bordered table-sm wpi-billing-details"> |
| 37 | 37 | <tbody> |
| 38 | - <?php do_action( 'wpinv_email_billing_fields_first', $invoice ); ?> |
|
| 38 | + <?php do_action('wpinv_email_billing_fields_first', $invoice); ?> |
|
| 39 | 39 | <tr class="wpi-receipt-name"> |
| 40 | - <th class="text-left"><?php _e( 'Name', 'invoicing' ); ?></th> |
|
| 41 | - <td><?php if ( $sent_to_admin && $invoice->user_id ) { ?><a href="<?php echo esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), self_admin_url( 'user-edit.php' ) ) ) ;?>"><?php echo esc_html( $invoice->get_user_full_name() ); ?></a><?php } else { echo esc_html( $invoice->get_user_full_name() ); } ?></td> |
|
| 40 | + <th class="text-left"><?php _e('Name', 'invoicing'); ?></th> |
|
| 41 | + <td><?php if ($sent_to_admin && $invoice->user_id) { ?><a href="<?php echo esc_url(add_query_arg('user_id', $invoice->get_user_id(), self_admin_url('user-edit.php'))); ?>"><?php echo esc_html($invoice->get_user_full_name()); ?></a><?php } else { echo esc_html($invoice->get_user_full_name()); } ?></td> |
|
| 42 | 42 | </tr> |
| 43 | 43 | <tr class="wpi-receipt-email"> |
| 44 | - <th class="text-left"><?php _e( 'Email', 'invoicing' ); ?></th> |
|
| 45 | - <td><?php echo $invoice->get_email() ;?></td> |
|
| 44 | + <th class="text-left"><?php _e('Email', 'invoicing'); ?></th> |
|
| 45 | + <td><?php echo $invoice->get_email(); ?></td> |
|
| 46 | 46 | </tr> |
| 47 | - <?php if ( $invoice->company ) { ?> |
|
| 47 | + <?php if ($invoice->company) { ?> |
|
| 48 | 48 | <tr class="wpi-receipt-company"> |
| 49 | - <th class="text-left"><?php _e( 'Company', 'invoicing' ); ?></th> |
|
| 50 | - <td><?php echo esc_html( $invoice->company ) ;?></td> |
|
| 49 | + <th class="text-left"><?php _e('Company', 'invoicing'); ?></th> |
|
| 50 | + <td><?php echo esc_html($invoice->company); ?></td> |
|
| 51 | 51 | </tr> |
| 52 | 52 | <?php } ?> |
| 53 | 53 | <tr class="wpi-receipt-address"> |
| 54 | - <th class="text-left"><?php _e( 'Address', 'invoicing' ); ?></th> |
|
| 55 | - <td><?php echo $address_row ;?></td> |
|
| 54 | + <th class="text-left"><?php _e('Address', 'invoicing'); ?></th> |
|
| 55 | + <td><?php echo $address_row; ?></td> |
|
| 56 | 56 | </tr> |
| 57 | - <?php if ( $invoice->phone ) { ?> |
|
| 57 | + <?php if ($invoice->phone) { ?> |
|
| 58 | 58 | <tr class="wpi-receipt-phone"> |
| 59 | - <th class="text-left"><?php _e( 'Phone', 'invoicing' ); ?></th> |
|
| 60 | - <td><?php echo esc_html( $invoice->phone ) ;?></td> |
|
| 59 | + <th class="text-left"><?php _e('Phone', 'invoicing'); ?></th> |
|
| 60 | + <td><?php echo esc_html($invoice->phone); ?></td> |
|
| 61 | 61 | </tr> |
| 62 | 62 | <?php } ?> |
| 63 | - <?php do_action( 'wpinv_email_billing_fields_last', $invoice ); ?> |
|
| 63 | + <?php do_action('wpinv_email_billing_fields_last', $invoice); ?> |
|
| 64 | 64 | </tbody> |
| 65 | 65 | </table> |
| 66 | 66 | </div> |
| 67 | -<?php do_action( 'wpinv_email_after_billing_details', $invoice ); ?> |
|
| 68 | 67 | \ No newline at end of file |
| 68 | +<?php do_action('wpinv_email_after_billing_details', $invoice); ?> |
|
| 69 | 69 | \ No newline at end of file |
@@ -2,11 +2,11 @@ |
||
| 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 |
@@ -4,17 +4,17 @@ discard block |
||
| 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 |
||
| 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 |
@@ -1,61 +1,61 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -130,7 +130,6 @@ |
||
| 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 | } |
@@ -76,7 +76,7 @@ |
||
| 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'])) { |
@@ -238,7 +238,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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) { |