@@ -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 --> |
@@ -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 |
@@ -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) { |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if (preg_match('/xml/',$post_url)) { |
|
| 99 | + if (preg_match('/xml/', $post_url)) { |
|
| 100 | 100 | curl_setopt($curl_request, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $this->xml = @simplexml_load_string($response); |
| 30 | 30 | |
| 31 | 31 | // Remove namespaces for use with XPath. |
| 32 | - $this->xpath_xml = @simplexml_load_string(preg_replace('/ xmlns:xsi[^>]+/','',$response)); |
|
| 32 | + $this->xpath_xml = @simplexml_load_string(preg_replace('/ xmlns:xsi[^>]+/', '', $response)); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | $start = "<$elementName>"; |
| 118 | 118 | $end = "</$elementName>"; |
| 119 | - if (strpos($this->response,$start) === false || strpos($this->response,$end) === false) { |
|
| 119 | + if (strpos($this->response, $start) === false || strpos($this->response, $end) === false) { |
|
| 120 | 120 | return false; |
| 121 | 121 | } else { |
| 122 | - $start_position = strpos($this->response, $start)+strlen($start); |
|
| 122 | + $start_position = strpos($this->response, $start) + strlen($start); |
|
| 123 | 123 | $end_position = strpos($this->response, $end); |
| 124 | - return substr($this->response, $start_position, $end_position-$start_position); |
|
| 124 | + return substr($this->response, $start_position, $end_position - $start_position); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |