@@ -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 --> |
@@ -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) { |
@@ -1,56 +1,56 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( !defined('ABSPATH') ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | -do_action( 'wpinv_invalid_invoice_before_display' ); ?><!DOCTYPE html> |
|
| 5 | +do_action('wpinv_invalid_invoice_before_display'); ?><!DOCTYPE html> |
|
| 6 | 6 | <html <?php language_attributes(); ?>> |
| 7 | 7 | <head> |
| 8 | 8 | <meta charset="UTF-8"> |
| 9 | 9 | <title><?php wp_title() ?></title> |
| 10 | - <meta charset="<?php bloginfo( 'charset' ); ?>" /> |
|
| 10 | + <meta charset="<?php bloginfo('charset'); ?>" /> |
|
| 11 | 11 | <meta name="viewport" content="width=device-width,initial-scale=1"> |
| 12 | 12 | <meta name="robots" content="noindex,nofollow"> |
| 13 | - <?php do_action( 'wpinv_invalid_invoice_head' ); ?> |
|
| 13 | + <?php do_action('wpinv_invalid_invoice_head'); ?> |
|
| 14 | 14 | </head> |
| 15 | 15 | <body class="body wpinv wpinv-print wpinv-invalid-invoice"> |
| 16 | - <?php do_action( 'wpinv_invalid_invoice_body_start' ); ?> |
|
| 16 | + <?php do_action('wpinv_invalid_invoice_body_start'); ?> |
|
| 17 | 17 | <div class="container wpinv-wrap"> |
| 18 | 18 | <!-- ///// Start Header --> |
| 19 | 19 | <htmlpageheader name="wpinv-pdf-header"> |
| 20 | - <?php do_action( 'wpinv_invalid_invoice_before_header' ); ?> |
|
| 20 | + <?php do_action('wpinv_invalid_invoice_before_header'); ?> |
|
| 21 | 21 | <div class="row wpinv-header"> |
| 22 | 22 | <div class="col-xs-12 wpinv-business"> |
| 23 | - <a target="_blank" href="<?php echo esc_url( wpinv_get_business_website() ); ?>"> |
|
| 24 | - <?php if ( $logo = wpinv_get_business_logo() ) { ?> |
|
| 25 | - <img class="logo" src="<?php echo esc_url( $logo ); ?>"> |
|
| 23 | + <a target="_blank" href="<?php echo esc_url(wpinv_get_business_website()); ?>"> |
|
| 24 | + <?php if ($logo = wpinv_get_business_logo()) { ?> |
|
| 25 | + <img class="logo" src="<?php echo esc_url($logo); ?>"> |
|
| 26 | 26 | <?php } else { ?> |
| 27 | - <h1><?php echo esc_html( wpinv_get_business_name() ); ?></h1> |
|
| 27 | + <h1><?php echo esc_html(wpinv_get_business_name()); ?></h1> |
|
| 28 | 28 | <?php } ?> |
| 29 | 29 | </a> |
| 30 | 30 | </div> |
| 31 | 31 | </div> |
| 32 | - <?php do_action( 'wpinv_invalid_invoice_after_header' ); ?> |
|
| 32 | + <?php do_action('wpinv_invalid_invoice_after_header'); ?> |
|
| 33 | 33 | </htmlpageheader> |
| 34 | 34 | <!-- End Header ///// --> |
| 35 | 35 | |
| 36 | - <?php do_action( 'wpinv_invalid_invoice_before_content' ); ?> |
|
| 36 | + <?php do_action('wpinv_invalid_invoice_before_content'); ?> |
|
| 37 | 37 | |
| 38 | - <?php do_action( 'wpinv_invalid_invoice_content' ); ?> |
|
| 38 | + <?php do_action('wpinv_invalid_invoice_content'); ?> |
|
| 39 | 39 | |
| 40 | - <?php do_action( 'wpinv_invalid_invoice_after_content' ); ?> |
|
| 40 | + <?php do_action('wpinv_invalid_invoice_after_content'); ?> |
|
| 41 | 41 | |
| 42 | 42 | <!-- ///// Start Footer --> |
| 43 | 43 | <htmlpagefooter name="wpinv-pdf-footer"> |
| 44 | - <?php do_action( 'wpinv_invalid_invoice_before_footer' ); ?> |
|
| 44 | + <?php do_action('wpinv_invalid_invoice_before_footer'); ?> |
|
| 45 | 45 | <div class="row wpinv-footer"> |
| 46 | 46 | <div class="col-sm-12"> |
| 47 | 47 | <div class="footer-text"><?php echo wpinv_get_business_footer(); ?></div> |
| 48 | 48 | </div> |
| 49 | 49 | </div> |
| 50 | - <?php do_action( 'wpinv_invalid_invoice_after_footer' ); ?> |
|
| 50 | + <?php do_action('wpinv_invalid_invoice_after_footer'); ?> |
|
| 51 | 51 | </htmlpagefooter> |
| 52 | 52 | <!-- End Footer ///// --> |
| 53 | 53 | </div> |
| 54 | - <?php do_action( 'wpinv_invalid_invoice_body_end' ); ?> |
|
| 54 | + <?php do_action('wpinv_invalid_invoice_body_end'); ?> |
|
| 55 | 55 | </body> |
| 56 | 56 | </html> |
| 57 | 57 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 4 | +if (!defined('ABSPATH')) exit; |
|
| 5 | 5 | |
| 6 | 6 | abstract class Wpinv_DB { |
| 7 | 7 | |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | * @since 1.0.0 |
| 67 | 67 | * @return object |
| 68 | 68 | */ |
| 69 | - public function get( $row_id ) { |
|
| 69 | + public function get($row_id) { |
|
| 70 | 70 | global $wpdb; |
| 71 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
| 71 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | * @since 1.0.0 |
| 79 | 79 | * @return object |
| 80 | 80 | */ |
| 81 | - public function get_by( $column, $row_id ) { |
|
| 81 | + public function get_by($column, $row_id) { |
|
| 82 | 82 | global $wpdb; |
| 83 | - $column = esc_sql( $column ); |
|
| 84 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
|
| 83 | + $column = esc_sql($column); |
|
| 84 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id)); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | * @since 1.0.0 |
| 92 | 92 | * @return string |
| 93 | 93 | */ |
| 94 | - public function get_column( $column, $row_id ) { |
|
| 94 | + public function get_column($column, $row_id) { |
|
| 95 | 95 | global $wpdb; |
| 96 | - $column = esc_sql( $column ); |
|
| 97 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
| 96 | + $column = esc_sql($column); |
|
| 97 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | * @since 1.0.0 |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | - public function get_column_by( $column, $column_where, $column_value ) { |
|
| 107 | + public function get_column_by($column, $column_where, $column_value) { |
|
| 108 | 108 | global $wpdb; |
| 109 | - $column_where = esc_sql( $column_where ); |
|
| 110 | - $column = esc_sql( $column ); |
|
| 111 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) ); |
|
| 109 | + $column_where = esc_sql($column_where); |
|
| 110 | + $column = esc_sql($column); |
|
| 111 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value)); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -118,31 +118,31 @@ discard block |
||
| 118 | 118 | * @since 1.0.0 |
| 119 | 119 | * @return int |
| 120 | 120 | */ |
| 121 | - public function insert( $data, $type = '' ) { |
|
| 121 | + public function insert($data, $type = '') { |
|
| 122 | 122 | global $wpdb; |
| 123 | 123 | |
| 124 | 124 | // Set default values |
| 125 | - $data = wp_parse_args( $data, $this->get_column_defaults() ); |
|
| 125 | + $data = wp_parse_args($data, $this->get_column_defaults()); |
|
| 126 | 126 | |
| 127 | - do_action( 'wpinv_pre_insert_' . $type, $data ); |
|
| 127 | + do_action('wpinv_pre_insert_' . $type, $data); |
|
| 128 | 128 | |
| 129 | 129 | // Initialise column format array |
| 130 | 130 | $column_formats = $this->get_columns(); |
| 131 | 131 | |
| 132 | 132 | // Force fields to lower case |
| 133 | - $data = array_change_key_case( $data ); |
|
| 133 | + $data = array_change_key_case($data); |
|
| 134 | 134 | |
| 135 | 135 | // White list columns |
| 136 | - $data = array_intersect_key( $data, $column_formats ); |
|
| 136 | + $data = array_intersect_key($data, $column_formats); |
|
| 137 | 137 | |
| 138 | 138 | // Reorder $column_formats to match the order of columns given in $data |
| 139 | - $data_keys = array_keys( $data ); |
|
| 140 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
| 139 | + $data_keys = array_keys($data); |
|
| 140 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
| 141 | 141 | |
| 142 | - $wpdb->insert( $this->table_name, $data, $column_formats ); |
|
| 142 | + $wpdb->insert($this->table_name, $data, $column_formats); |
|
| 143 | 143 | $wpdb_insert_id = $wpdb->insert_id; |
| 144 | 144 | |
| 145 | - do_action( 'wpinv_post_insert_' . $type, $wpdb_insert_id, $data ); |
|
| 145 | + do_action('wpinv_post_insert_' . $type, $wpdb_insert_id, $data); |
|
| 146 | 146 | |
| 147 | 147 | return $wpdb_insert_id; |
| 148 | 148 | } |
@@ -154,18 +154,18 @@ discard block |
||
| 154 | 154 | * @since 1.0.0 |
| 155 | 155 | * @return bool |
| 156 | 156 | */ |
| 157 | - public function update( $row_id, $data = array(), $where = '' ) { |
|
| 157 | + public function update($row_id, $data = array(), $where = '') { |
|
| 158 | 158 | |
| 159 | 159 | global $wpdb; |
| 160 | 160 | |
| 161 | 161 | // Row ID must be positive integer |
| 162 | - $row_id = absint( $row_id ); |
|
| 162 | + $row_id = absint($row_id); |
|
| 163 | 163 | |
| 164 | - if( empty( $row_id ) ) { |
|
| 164 | + if (empty($row_id)) { |
|
| 165 | 165 | return false; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if( empty( $where ) ) { |
|
| 168 | + if (empty($where)) { |
|
| 169 | 169 | $where = $this->primary_key; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -173,16 +173,16 @@ discard block |
||
| 173 | 173 | $column_formats = $this->get_columns(); |
| 174 | 174 | |
| 175 | 175 | // Force fields to lower case |
| 176 | - $data = array_change_key_case( $data ); |
|
| 176 | + $data = array_change_key_case($data); |
|
| 177 | 177 | |
| 178 | 178 | // White list columns |
| 179 | - $data = array_intersect_key( $data, $column_formats ); |
|
| 179 | + $data = array_intersect_key($data, $column_formats); |
|
| 180 | 180 | |
| 181 | 181 | // Reorder $column_formats to match the order of columns given in $data |
| 182 | - $data_keys = array_keys( $data ); |
|
| 183 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
| 182 | + $data_keys = array_keys($data); |
|
| 183 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
| 184 | 184 | |
| 185 | - if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) { |
|
| 185 | + if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) { |
|
| 186 | 186 | return false; |
| 187 | 187 | } |
| 188 | 188 | |
@@ -196,18 +196,18 @@ discard block |
||
| 196 | 196 | * @since 1.0.0 |
| 197 | 197 | * @return bool |
| 198 | 198 | */ |
| 199 | - public function delete( $row_id = 0 ) { |
|
| 199 | + public function delete($row_id = 0) { |
|
| 200 | 200 | |
| 201 | 201 | global $wpdb; |
| 202 | 202 | |
| 203 | 203 | // Row ID must be positive integer |
| 204 | - $row_id = absint( $row_id ); |
|
| 204 | + $row_id = absint($row_id); |
|
| 205 | 205 | |
| 206 | - if( empty( $row_id ) ) { |
|
| 206 | + if (empty($row_id)) { |
|
| 207 | 207 | return false; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) { |
|
| 210 | + if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) { |
|
| 211 | 211 | return false; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | * @param string $table The table name |
| 222 | 222 | * @return bool If the table name exists |
| 223 | 223 | */ |
| 224 | - public function table_exists( $table ) { |
|
| 224 | + public function table_exists($table) { |
|
| 225 | 225 | global $wpdb; |
| 226 | - $table = sanitize_text_field( $table ); |
|
| 226 | + $table = sanitize_text_field($table); |
|
| 227 | 227 | |
| 228 | - return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table; |
|
| 228 | + return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @return bool Returns if the customers table was installed and upgrade routine run |
| 236 | 236 | */ |
| 237 | 237 | public function installed() { |
| 238 | - return $this->table_exists( $this->table_name ); |
|
| 238 | + return $this->table_exists($this->table_name); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | } |
@@ -1,25 +1,25 @@ 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 | 6 | // Load colours |
| 7 | -$bg = wpinv_get_option( 'email_background_color', '#f5f5f5' ); |
|
| 8 | -$body = wpinv_get_option( 'email_body_background_color', '#fdfdfd' ); |
|
| 9 | -$base = wpinv_get_option( 'email_base_color', '#557da2' ); |
|
| 10 | -$base_text = wpinv_light_or_dark( $base, '#202020', '#ffffff' ); |
|
| 11 | -$text = wpinv_get_option( 'email_text_color', '#505050' ); |
|
| 7 | +$bg = wpinv_get_option('email_background_color', '#f5f5f5'); |
|
| 8 | +$body = wpinv_get_option('email_body_background_color', '#fdfdfd'); |
|
| 9 | +$base = wpinv_get_option('email_base_color', '#557da2'); |
|
| 10 | +$base_text = wpinv_light_or_dark($base, '#202020', '#ffffff'); |
|
| 11 | +$text = wpinv_get_option('email_text_color', '#505050'); |
|
| 12 | 12 | |
| 13 | -$bg_darker_10 = wpinv_hex_darker( $bg, 10 ); |
|
| 14 | -$body_darker_10 = wpinv_hex_darker( $body, 10 ); |
|
| 15 | -$base_lighter_20 = wpinv_hex_lighter( $base, 20 ); |
|
| 16 | -$base_lighter_40 = wpinv_hex_lighter( $base, 40 ); |
|
| 17 | -$text_lighter_20 = wpinv_hex_lighter( $text, 20 ); |
|
| 13 | +$bg_darker_10 = wpinv_hex_darker($bg, 10); |
|
| 14 | +$body_darker_10 = wpinv_hex_darker($body, 10); |
|
| 15 | +$base_lighter_20 = wpinv_hex_lighter($base, 20); |
|
| 16 | +$base_lighter_40 = wpinv_hex_lighter($base, 40); |
|
| 17 | +$text_lighter_20 = wpinv_hex_lighter($text, 20); |
|
| 18 | 18 | |
| 19 | 19 | // !important; is a gmail hack to prevent styles being stripped if it doesn't like something. |
| 20 | 20 | ?> |
| 21 | 21 | #wrapper { |
| 22 | - background-color: <?php echo esc_attr( $bg ); ?>; |
|
| 22 | + background-color: <?php echo esc_attr($bg); ?>; |
|
| 23 | 23 | margin: 0; |
| 24 | 24 | -webkit-text-size-adjust: none !important; |
| 25 | 25 | padding: 3%; |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | #template_container { |
| 42 | 42 | box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important; |
| 43 | - background-color: <?php echo esc_attr( $body ); ?>; |
|
| 44 | - border: 1px solid <?php echo esc_attr( $bg_darker_10 ); ?>; |
|
| 43 | + background-color: <?php echo esc_attr($body); ?>; |
|
| 44 | + border: 1px solid <?php echo esc_attr($bg_darker_10); ?>; |
|
| 45 | 45 | border-radius: 3px !important; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | #template_header { |
| 49 | - background-color: <?php echo esc_attr( $base ); ?>; |
|
| 49 | + background-color: <?php echo esc_attr($base); ?>; |
|
| 50 | 50 | border-radius: 3px 3px 0 0 !important; |
| 51 | - color: <?php echo esc_attr( $base_text ); ?>; |
|
| 51 | + color: <?php echo esc_attr($base_text); ?>; |
|
| 52 | 52 | border-bottom: 0; |
| 53 | 53 | font-weight: bold; |
| 54 | 54 | line-height: 100%; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | #template_header h1 { |
| 64 | - color: <?php echo esc_attr( $base_text ); ?>; |
|
| 64 | + color: <?php echo esc_attr($base_text); ?>; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | #template_footer td { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | #template_footer #credit { |
| 74 | 74 | border:0; |
| 75 | - color: <?php echo esc_attr( $base_lighter_40 ); ?>; |
|
| 75 | + color: <?php echo esc_attr($base_lighter_40); ?>; |
|
| 76 | 76 | font-family: Arial; |
| 77 | 77 | font-size:12px; |
| 78 | 78 | line-height:125%; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | #body_content { |
| 84 | - background-color: <?php echo esc_attr( $body ); ?>; |
|
| 84 | + background-color: <?php echo esc_attr($body); ?>; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | #body_content table td { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | #body_content_inner { |
| 104 | - color: <?php echo esc_attr( $text_lighter_20 ); ?>; |
|
| 104 | + color: <?php echo esc_attr($text_lighter_20); ?>; |
|
| 105 | 105 | font-family: Arial,Helvetica,sans-serif; |
| 106 | 106 | font-size: 14px; |
| 107 | 107 | line-height: 150%; |
@@ -109,17 +109,17 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | .td { |
| 112 | - color: <?php echo esc_attr( $text_lighter_20 ); ?>; |
|
| 113 | - border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>; |
|
| 112 | + color: <?php echo esc_attr($text_lighter_20); ?>; |
|
| 113 | + border: 1px solid <?php echo esc_attr($body_darker_10); ?>; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | .text { |
| 117 | - color: <?php echo esc_attr( $text ); ?>; |
|
| 117 | + color: <?php echo esc_attr($text); ?>; |
|
| 118 | 118 | font-family: Arial,Helvetica,sans-serif; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | .link { |
| 122 | - color: <?php echo esc_attr( $base ); ?>; |
|
| 122 | + color: <?php echo esc_attr($base); ?>; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | #header_wrapper { |
@@ -128,19 +128,19 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | h1 { |
| 131 | - color: <?php echo esc_attr( $base ); ?>; |
|
| 131 | + color: <?php echo esc_attr($base); ?>; |
|
| 132 | 132 | font-family: Arial,Helvetica,sans-serif; |
| 133 | 133 | font-size: 30px; |
| 134 | 134 | font-weight: 300; |
| 135 | 135 | line-height: 150%; |
| 136 | 136 | margin: 0; |
| 137 | 137 | text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>; |
| 138 | - text-shadow: 0 1px 0 <?php echo esc_attr( $base_lighter_20 ); ?>; |
|
| 138 | + text-shadow: 0 1px 0 <?php echo esc_attr($base_lighter_20); ?>; |
|
| 139 | 139 | -webkit-font-smoothing: antialiased; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | h2 { |
| 143 | - color: <?php echo esc_attr( $base ); ?>; |
|
| 143 | + color: <?php echo esc_attr($base); ?>; |
|
| 144 | 144 | display: block; |
| 145 | 145 | font-family: Arial,Helvetica,sans-serif; |
| 146 | 146 | font-size: 18px; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | h3 { |
| 154 | - color: <?php echo esc_attr( $base ); ?>; |
|
| 154 | + color: <?php echo esc_attr($base); ?>; |
|
| 155 | 155 | display: block; |
| 156 | 156 | font-family: Arial,Helvetica,sans-serif; |
| 157 | 157 | font-size: 16px; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | a { |
| 165 | - color: <?php echo esc_attr( $base ); ?>; |
|
| 165 | + color: <?php echo esc_attr($base); ?>; |
|
| 166 | 166 | font-weight: normal; |
| 167 | 167 | text-decoration: underline; |
| 168 | 168 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | .table-bordered { |
| 183 | - border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>; |
|
| 183 | + border: 1px solid <?php echo esc_attr($body_darker_10); ?>; |
|
| 184 | 184 | border-collapse: collapse; |
| 185 | 185 | border-spacing: 0; |
| 186 | 186 | width: 100%; |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | .table-bordered th, |
| 190 | 190 | .table-bordered td { |
| 191 | - border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>; |
|
| 192 | - color: <?php echo esc_attr( $text_lighter_20 ); ?>; |
|
| 191 | + border: 1px solid <?php echo esc_attr($body_darker_10); ?>; |
|
| 192 | + color: <?php echo esc_attr($text_lighter_20); ?>; |
|
| 193 | 193 | font-size: 14px; |
| 194 | 194 | } |
| 195 | 195 | .small { |
@@ -288,9 +288,9 @@ discard block |
||
| 288 | 288 | text-decoration: none; |
| 289 | 289 | } |
| 290 | 290 | .btn-default { |
| 291 | - color: <?php echo esc_attr( $base_text ); ?>; |
|
| 292 | - background-color: <?php echo esc_attr( $base ); ?>; |
|
| 293 | - border-color: <?php echo esc_attr( $base ); ?>; |
|
| 291 | + color: <?php echo esc_attr($base_text); ?>; |
|
| 292 | + background-color: <?php echo esc_attr($base); ?>; |
|
| 293 | + border-color: <?php echo esc_attr($base); ?>; |
|
| 294 | 294 | } |
| 295 | 295 | .btn-primary { |
| 296 | 296 | color: #fff; |
@@ -1,12 +1,12 @@ |
||
| 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 | -if ( ! empty( $message_body ) ) { |
|
| 9 | - echo wpautop( wptexturize( $message_body ) ); |
|
| 8 | +if (!empty($message_body)) { |
|
| 9 | + echo wpautop(wptexturize($message_body)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 13 | 12 | \ No newline at end of file |
| 13 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 14 | 14 | \ No newline at end of file |