@@ -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) { |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * @param array $args |
| 22 | 22 | * @param array $assoc_args |
| 23 | 23 | */ |
| 24 | - public function count( $args, $assoc_args ) { |
|
| 24 | + public function count($args, $assoc_args) { |
|
| 25 | 25 | $sessions = WP_Session_Utils::count_sessions(); |
| 26 | 26 | |
| 27 | - \WP_CLI::line( sprintf( '%d sessions currently exist.', absint( $sessions ) ) ); |
|
| 27 | + \WP_CLI::line(sprintf('%d sessions currently exist.', absint($sessions))); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | * @param array $args |
| 54 | 54 | * @param array $assoc_args |
| 55 | 55 | */ |
| 56 | - public function delete( $args, $assoc_args ) { |
|
| 57 | - if ( isset( $assoc_args['limit'] ) ) { |
|
| 58 | - $limit = absint( $assoc_args['limit'] ); |
|
| 56 | + public function delete($args, $assoc_args) { |
|
| 57 | + if (isset($assoc_args['limit'])) { |
|
| 58 | + $limit = absint($assoc_args['limit']); |
|
| 59 | 59 | |
| 60 | - $count = WP_Session_Utils::delete_old_sessions( $limit ); |
|
| 60 | + $count = WP_Session_Utils::delete_old_sessions($limit); |
|
| 61 | 61 | |
| 62 | - if ( $count > 0 ) { |
|
| 63 | - \WP_CLI::line( sprintf( 'Deleted %d sessions.', $count ) ); |
|
| 62 | + if ($count > 0) { |
|
| 63 | + \WP_CLI::line(sprintf('Deleted %d sessions.', $count)); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Clear memory |
@@ -69,32 +69,32 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Determine if we're deleting all sessions or just a subset. |
| 72 | - $all = isset( $assoc_args['all'] ); |
|
| 72 | + $all = isset($assoc_args['all']); |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * Determine the size of each batch for deletion. |
| 76 | 76 | * |
| 77 | 77 | * @param int |
| 78 | 78 | */ |
| 79 | - $batch = isset( $assoc_args['batch'] ) ? absint( $assoc_args['batch'] ) : apply_filters( 'wp_session_delete_batch_size', 1000 ); |
|
| 79 | + $batch = isset($assoc_args['batch']) ? absint($assoc_args['batch']) : apply_filters('wp_session_delete_batch_size', 1000); |
|
| 80 | 80 | |
| 81 | - switch ( $all ) { |
|
| 81 | + switch ($all) { |
|
| 82 | 82 | case true: |
| 83 | 83 | $count = WP_Session_Utils::delete_all_sessions(); |
| 84 | 84 | |
| 85 | - \WP_CLI::line( sprintf( 'Deleted all %d sessions.', $count ) ); |
|
| 85 | + \WP_CLI::line(sprintf('Deleted all %d sessions.', $count)); |
|
| 86 | 86 | break; |
| 87 | 87 | case false: |
| 88 | 88 | do { |
| 89 | - $count = WP_Session_Utils::delete_old_sessions( $batch ); |
|
| 89 | + $count = WP_Session_Utils::delete_old_sessions($batch); |
|
| 90 | 90 | |
| 91 | - if ( $count > 0 ) { |
|
| 92 | - \WP_CLI::line( sprintf( 'Deleted %d sessions.', $count ) ); |
|
| 91 | + if ($count > 0) { |
|
| 92 | + \WP_CLI::line(sprintf('Deleted %d sessions.', $count)); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Clear memory |
| 96 | 96 | self::free_up_memory(); |
| 97 | - } while ( $count > 0 ); |
|
| 97 | + } while ($count > 0); |
|
| 98 | 98 | break; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | * @param array $args |
| 121 | 121 | * @param array $assoc_args |
| 122 | 122 | */ |
| 123 | - public function generate( $args, $assoc_args ) { |
|
| 124 | - $count = absint( $args[0] ); |
|
| 125 | - $date = isset( $assoc_args['expires'] ) ? $assoc_args['expires'] : null; |
|
| 123 | + public function generate($args, $assoc_args) { |
|
| 124 | + $count = absint($args[0]); |
|
| 125 | + $date = isset($assoc_args['expires']) ? $assoc_args['expires'] : null; |
|
| 126 | 126 | |
| 127 | - $notify = \WP_CLI\Utils\make_progress_bar( 'Generating sessions', $count ); |
|
| 127 | + $notify = \WP_CLI\Utils\make_progress_bar('Generating sessions', $count); |
|
| 128 | 128 | |
| 129 | - for ( $i = 0; $i < $count; $i ++ ) { |
|
| 130 | - WP_Session_Utils::create_dummy_session( $date ); |
|
| 129 | + for ($i = 0; $i < $count; $i++) { |
|
| 130 | + WP_Session_Utils::create_dummy_session($date); |
|
| 131 | 131 | $notify->tick(); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | global $wp_object_cache, $wpdb; |
| 145 | 145 | $wpdb->queries = array(); |
| 146 | 146 | |
| 147 | - if ( ! is_object( $wp_object_cache ) ) { |
|
| 147 | + if (!is_object($wp_object_cache)) { |
|
| 148 | 148 | return; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -155,4 +155,4 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | -\WP_CLI::add_command( 'session', 'WP_Session_Command' ); |
|
| 159 | 158 | \ No newline at end of file |
| 159 | +\WP_CLI::add_command('session', 'WP_Session_Command'); |
|
| 160 | 160 | \ No newline at end of file |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @param string $data |
| 35 | 35 | */ |
| 36 | -function wp_session_decode( $data ) { |
|
| 36 | +function wp_session_decode($data) { |
|
| 37 | 37 | $wp_session = WP_Session::get_instance(); |
| 38 | 38 | |
| 39 | - return $wp_session->json_in( $data ); |
|
| 39 | + return $wp_session->json_in($data); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return bool |
| 59 | 59 | */ |
| 60 | -function wp_session_regenerate_id( $delete_old_session = false ) { |
|
| 60 | +function wp_session_regenerate_id($delete_old_session = false) { |
|
| 61 | 61 | $wp_session = WP_Session::get_instance(); |
| 62 | 62 | |
| 63 | - $wp_session->regenerate_id( $delete_old_session ); |
|
| 63 | + $wp_session->regenerate_id($delete_old_session); |
|
| 64 | 64 | |
| 65 | 65 | return true; |
| 66 | 66 | } |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | function wp_session_start() { |
| 76 | 76 | $wp_session = WP_Session::get_instance(); |
| 77 | - do_action( 'wp_session_start' ); |
|
| 77 | + do_action('wp_session_start'); |
|
| 78 | 78 | |
| 79 | 79 | return $wp_session->session_started(); |
| 80 | 80 | } |
| 81 | -if ( ! defined( 'WP_CLI' ) || false === WP_CLI ) { |
|
| 82 | - add_action( 'plugins_loaded', 'wp_session_start' ); |
|
| 81 | +if (!defined('WP_CLI') || false === WP_CLI) { |
|
| 82 | + add_action('plugins_loaded', 'wp_session_start'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | function wp_session_status() { |
| 91 | 91 | $wp_session = WP_Session::get_instance(); |
| 92 | 92 | |
| 93 | - if ( $wp_session->session_started() ) { |
|
| 93 | + if ($wp_session->session_started()) { |
|
| 94 | 94 | return PHP_SESSION_ACTIVE; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | $wp_session = WP_Session::get_instance(); |
| 114 | 114 | |
| 115 | 115 | $wp_session->write_data(); |
| 116 | - do_action( 'wp_session_commit' ); |
|
| 116 | + do_action('wp_session_commit'); |
|
| 117 | 117 | } |
| 118 | -if ( ! defined( 'WP_CLI' ) || false === WP_CLI ) { |
|
| 119 | - add_action( 'shutdown', 'wp_session_write_close' ); |
|
| 118 | +if (!defined('WP_CLI') || false === WP_CLI) { |
|
| 119 | + add_action('shutdown', 'wp_session_write_close'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -127,33 +127,33 @@ discard block |
||
| 127 | 127 | * of a scheduled task or cron job. |
| 128 | 128 | */ |
| 129 | 129 | function wp_session_cleanup() { |
| 130 | - if ( defined( 'WP_SETUP_CONFIG' ) ) { |
|
| 130 | + if (defined('WP_SETUP_CONFIG')) { |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if ( ! defined( 'WP_INSTALLING' ) ) { |
|
| 134 | + if (!defined('WP_INSTALLING')) { |
|
| 135 | 135 | /** |
| 136 | 136 | * Determine the size of each batch for deletion. |
| 137 | 137 | * |
| 138 | 138 | * @param int |
| 139 | 139 | */ |
| 140 | - $batch_size = apply_filters( 'wp_session_delete_batch_size', 1000 ); |
|
| 140 | + $batch_size = apply_filters('wp_session_delete_batch_size', 1000); |
|
| 141 | 141 | |
| 142 | 142 | // Delete a batch of old sessions |
| 143 | - WP_Session_Utils::delete_old_sessions( $batch_size ); |
|
| 143 | + WP_Session_Utils::delete_old_sessions($batch_size); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // Allow other plugins to hook in to the garbage collection process. |
| 147 | - do_action( 'wp_session_cleanup' ); |
|
| 147 | + do_action('wp_session_cleanup'); |
|
| 148 | 148 | } |
| 149 | -add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' ); |
|
| 149 | +add_action('wp_session_garbage_collection', 'wp_session_cleanup'); |
|
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * Register the garbage collector as a twice daily event. |
| 153 | 153 | */ |
| 154 | 154 | function wp_session_register_garbage_collection() { |
| 155 | - if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) { |
|
| 156 | - wp_schedule_event( time(), 'hourly', 'wp_session_garbage_collection' ); |
|
| 155 | + if (!wp_next_scheduled('wp_session_garbage_collection')) { |
|
| 156 | + wp_schedule_event(time(), 'hourly', 'wp_session_garbage_collection'); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | -add_action( 'wp', 'wp_session_register_garbage_collection' ); |
|
| 159 | +add_action('wp', 'wp_session_register_garbage_collection'); |
|
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @return bool|WP_Session |
| 54 | 54 | */ |
| 55 | 55 | public static function get_instance() { |
| 56 | - if ( ! self::$instance ) { |
|
| 56 | + if (!self::$instance) { |
|
| 57 | 57 | self::$instance = new self(); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -69,19 +69,19 @@ discard block |
||
| 69 | 69 | * @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire. |
| 70 | 70 | */ |
| 71 | 71 | protected function __construct() { |
| 72 | - if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) { |
|
| 73 | - $cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] ); |
|
| 74 | - $cookie_crumbs = explode( '||', $cookie ); |
|
| 72 | + if (isset($_COOKIE[WP_SESSION_COOKIE])) { |
|
| 73 | + $cookie = stripslashes($_COOKIE[WP_SESSION_COOKIE]); |
|
| 74 | + $cookie_crumbs = explode('||', $cookie); |
|
| 75 | 75 | |
| 76 | - $this->session_id = preg_replace("/[^A-Za-z0-9_]/", '', $cookie_crumbs[0] ); |
|
| 77 | - $this->expires = absint( $cookie_crumbs[1] ); |
|
| 78 | - $this->exp_variant = absint( $cookie_crumbs[2] ); |
|
| 76 | + $this->session_id = preg_replace("/[^A-Za-z0-9_]/", '', $cookie_crumbs[0]); |
|
| 77 | + $this->expires = absint($cookie_crumbs[1]); |
|
| 78 | + $this->exp_variant = absint($cookie_crumbs[2]); |
|
| 79 | 79 | |
| 80 | 80 | // Update the session expiration if we're past the variant time |
| 81 | - if ( time() > $this->exp_variant ) { |
|
| 81 | + if (time() > $this->exp_variant) { |
|
| 82 | 82 | $this->set_expiration(); |
| 83 | - delete_option( "_wp_session_expires_{$this->session_id}" ); |
|
| 84 | - add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' ); |
|
| 83 | + delete_option("_wp_session_expires_{$this->session_id}"); |
|
| 84 | + add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no'); |
|
| 85 | 85 | } |
| 86 | 86 | } else { |
| 87 | 87 | $this->session_id = WP_Session_Utils::generate_id(); |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | * @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions. |
| 114 | 114 | */ |
| 115 | 115 | protected function set_expiration() { |
| 116 | - $this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 ); |
|
| 117 | - $this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 ); |
|
| 116 | + $this->exp_variant = time() + (int)apply_filters('wp_session_expiration_variant', 24 * 60); |
|
| 117 | + $this->expires = time() + (int)apply_filters('wp_session_expiration', 30 * 60); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | * @uses apply_filters Calls `wp_session_cookie_httponly` to set the $httponly parameter of setcookie() |
| 124 | 124 | */ |
| 125 | 125 | protected function set_cookie() { |
| 126 | - if ( !defined( 'WPI_TESTING_MODE' ) ) { |
|
| 126 | + if (!defined('WPI_TESTING_MODE')) { |
|
| 127 | 127 | try { |
| 128 | 128 | $secure = apply_filters('wp_session_cookie_secure', false); |
| 129 | 129 | $httponly = apply_filters('wp_session_cookie_httponly', false); |
| 130 | - setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN, $secure, $httponly ); |
|
| 131 | - } catch(Exception $e) { |
|
| 132 | - error_log( 'Set Cookie Error: ' . $e->getMessage() ); |
|
| 130 | + setcookie(WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant, $this->expires, COOKIEPATH, COOKIE_DOMAIN, $secure, $httponly); |
|
| 131 | + } catch (Exception $e) { |
|
| 132 | + error_log('Set Cookie Error: ' . $e->getMessage()); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @return array |
| 143 | 143 | */ |
| 144 | 144 | protected function read_data() { |
| 145 | - $this->container = get_option( "_wp_session_{$this->session_id}", array() ); |
|
| 145 | + $this->container = get_option("_wp_session_{$this->session_id}", array()); |
|
| 146 | 146 | |
| 147 | 147 | return $this->container; |
| 148 | 148 | } |
@@ -153,12 +153,12 @@ discard block |
||
| 153 | 153 | public function write_data() { |
| 154 | 154 | $option_key = "_wp_session_{$this->session_id}"; |
| 155 | 155 | |
| 156 | - if ( false === get_option( $option_key ) ) { |
|
| 157 | - add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' ); |
|
| 158 | - add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' ); |
|
| 156 | + if (false === get_option($option_key)) { |
|
| 157 | + add_option("_wp_session_{$this->session_id}", $this->container, '', 'no'); |
|
| 158 | + add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no'); |
|
| 159 | 159 | } else { |
| 160 | - delete_option( "_wp_session_{$this->session_id}" ); |
|
| 161 | - add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' ); |
|
| 160 | + delete_option("_wp_session_{$this->session_id}"); |
|
| 161 | + add_option("_wp_session_{$this->session_id}", $this->container, '', 'no'); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * @return string |
| 169 | 169 | */ |
| 170 | 170 | public function json_out() { |
| 171 | - return json_encode( $this->container ); |
|
| 171 | + return json_encode($this->container); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return bool |
| 180 | 180 | */ |
| 181 | - public function json_in( $data ) { |
|
| 182 | - $array = json_decode( $data ); |
|
| 181 | + public function json_in($data) { |
|
| 182 | + $array = json_decode($data); |
|
| 183 | 183 | |
| 184 | - if ( is_array( $array ) ) { |
|
| 184 | + if (is_array($array)) { |
|
| 185 | 185 | $this->container = $array; |
| 186 | 186 | return true; |
| 187 | 187 | } |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @param bool $delete_old Flag whether or not to delete the old session data from the server. |
| 196 | 196 | */ |
| 197 | - public function regenerate_id( $delete_old = false ) { |
|
| 198 | - if ( $delete_old ) { |
|
| 199 | - delete_option( "_wp_session_{$this->session_id}" ); |
|
| 197 | + public function regenerate_id($delete_old = false) { |
|
| 198 | + if ($delete_old) { |
|
| 199 | + delete_option("_wp_session_{$this->session_id}"); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | $this->session_id = WP_Session_Utils::generate_id(); |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param array $data |
| 38 | 38 | */ |
| 39 | - protected function __construct( $data = array() ) { |
|
| 40 | - foreach ( $data as $key => $value ) { |
|
| 41 | - $this[ $key ] = $value; |
|
| 39 | + protected function __construct($data = array()) { |
|
| 40 | + foreach ($data as $key => $value) { |
|
| 41 | + $this[$key] = $value; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * Allow deep copies of objects |
| 47 | 47 | */ |
| 48 | 48 | public function __clone() { |
| 49 | - foreach ( $this->container as $key => $value ) { |
|
| 50 | - if ( $value instanceof self ) { |
|
| 51 | - $this[ $key ] = clone $value; |
|
| 49 | + foreach ($this->container as $key => $value) { |
|
| 50 | + if ($value instanceof self) { |
|
| 51 | + $this[$key] = clone $value; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function toArray() { |
| 62 | 62 | $data = $this->container; |
| 63 | - foreach ( $data as $key => $value ) { |
|
| 64 | - if ( $value instanceof self ) { |
|
| 65 | - $data[ $key ] = $value->toArray(); |
|
| 63 | + foreach ($data as $key => $value) { |
|
| 64 | + if ($value instanceof self) { |
|
| 65 | + $data[$key] = $value->toArray(); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | return $data; |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return boolean true on success or false on failure. |
| 83 | 83 | */ |
| 84 | - public function offsetExists( $offset ) { |
|
| 85 | - return isset( $this->container[ $offset ]) ; |
|
| 84 | + public function offsetExists($offset) { |
|
| 85 | + return isset($this->container[$offset]); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @return mixed Can return all value types. |
| 96 | 96 | */ |
| 97 | - public function offsetGet( $offset ) { |
|
| 98 | - return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null; |
|
| 97 | + public function offsetGet($offset) { |
|
| 98 | + return isset($this->container[$offset]) ? $this->container[$offset] : null; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return void |
| 110 | 110 | */ |
| 111 | - public function offsetSet( $offset, $data ) { |
|
| 112 | - if ( is_array( $data ) ) { |
|
| 113 | - $data = new self( $data ); |
|
| 111 | + public function offsetSet($offset, $data) { |
|
| 112 | + if (is_array($data)) { |
|
| 113 | + $data = new self($data); |
|
| 114 | 114 | } |
| 115 | - if ( $offset === null ) { // don't forget this! |
|
| 115 | + if ($offset === null) { // don't forget this! |
|
| 116 | 116 | $this->container[] = $data; |
| 117 | 117 | } else { |
| 118 | - $this->container[ $offset ] = $data; |
|
| 118 | + $this->container[$offset] = $data; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $this->dirty = true; |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return void |
| 132 | 132 | */ |
| 133 | - public function offsetUnset( $offset ) { |
|
| 134 | - unset( $this->container[ $offset ] ); |
|
| 133 | + public function offsetUnset($offset) { |
|
| 134 | + unset($this->container[$offset]); |
|
| 135 | 135 | |
| 136 | 136 | $this->dirty = true; |
| 137 | 137 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @return mixed |
| 150 | 150 | */ |
| 151 | 151 | public function current() { |
| 152 | - return current( $this->container ); |
|
| 152 | + return current($this->container); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @return mixed |
| 161 | 161 | */ |
| 162 | 162 | public function key() { |
| 163 | - return key( $this->container ); |
|
| 163 | + return key($this->container); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @return void |
| 172 | 172 | */ |
| 173 | 173 | public function next() { |
| 174 | - next( $this->container ); |
|
| 174 | + next($this->container); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @return void |
| 183 | 183 | */ |
| 184 | 184 | public function rewind() { |
| 185 | - reset( $this->container ); |
|
| 185 | + reset($this->container); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @return bool |
| 194 | 194 | */ |
| 195 | 195 | public function valid() { |
| 196 | - return $this->offsetExists( $this->key() ); |
|
| 196 | + return $this->offsetExists($this->key()); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /*****************************************************************/ |
@@ -208,6 +208,6 @@ discard block |
||
| 208 | 208 | * @return int |
| 209 | 209 | */ |
| 210 | 210 | public function count() { |
| 211 | - return count( $this->container ); |
|
| 211 | + return count($this->container); |
|
| 212 | 212 | } |
| 213 | 213 | } |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @param string $query Database count query |
| 25 | 25 | */ |
| 26 | - $query = apply_filters( 'wp_session_count_query', $query ); |
|
| 26 | + $query = apply_filters('wp_session_count_query', $query); |
|
| 27 | 27 | |
| 28 | - $sessions = $wpdb->get_var( $query ); |
|
| 28 | + $sessions = $wpdb->get_var($query); |
|
| 29 | 29 | |
| 30 | - return absint( $sessions ); |
|
| 30 | + return absint($sessions); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -35,33 +35,33 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param null|string $date |
| 37 | 37 | */ |
| 38 | - public static function create_dummy_session( $date = null ) { |
|
| 38 | + public static function create_dummy_session($date = null) { |
|
| 39 | 39 | // Generate our date |
| 40 | - if ( null !== $date ) { |
|
| 41 | - $time = strtotime( $date ); |
|
| 40 | + if (null !== $date) { |
|
| 41 | + $time = strtotime($date); |
|
| 42 | 42 | |
| 43 | - if ( false === $time ) { |
|
| 43 | + if (false === $time) { |
|
| 44 | 44 | $date = null; |
| 45 | 45 | } else { |
| 46 | - $expires = date( 'U', strtotime( $date ) ); |
|
| 46 | + $expires = date('U', strtotime($date)); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // If null was passed, or if the string parsing failed, fall back on a default |
| 51 | - if ( null === $date ) { |
|
| 51 | + if (null === $date) { |
|
| 52 | 52 | /** |
| 53 | 53 | * Filter the expiration of the session in the database |
| 54 | 54 | * |
| 55 | 55 | * @param int |
| 56 | 56 | */ |
| 57 | - $expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 ); |
|
| 57 | + $expires = time() + (int)apply_filters('wp_session_expiration', 30 * 60); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $session_id = self::generate_id(); |
| 61 | 61 | |
| 62 | 62 | // Store the session |
| 63 | - add_option( "_wp_session_{$session_id}", array(), '', 'no' ); |
|
| 64 | - add_option( "_wp_session_expires_{$session_id}", $expires, '', 'no' ); |
|
| 63 | + add_option("_wp_session_{$session_id}", array(), '', 'no'); |
|
| 64 | + add_option("_wp_session_expires_{$session_id}", $expires, '', 'no'); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -73,22 +73,22 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return int Sessions deleted. |
| 75 | 75 | */ |
| 76 | - public static function delete_old_sessions( $limit = 1000 ) { |
|
| 76 | + public static function delete_old_sessions($limit = 1000) { |
|
| 77 | 77 | global $wpdb; |
| 78 | 78 | |
| 79 | - $limit = absint( $limit ); |
|
| 80 | - $keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%' ORDER BY option_value ASC LIMIT 0, {$limit}" ); |
|
| 79 | + $limit = absint($limit); |
|
| 80 | + $keys = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%' ORDER BY option_value ASC LIMIT 0, {$limit}"); |
|
| 81 | 81 | |
| 82 | 82 | $now = time(); |
| 83 | 83 | $expired = array(); |
| 84 | 84 | $count = 0; |
| 85 | 85 | |
| 86 | - foreach( $keys as $expiration ) { |
|
| 86 | + foreach ($keys as $expiration) { |
|
| 87 | 87 | $key = $expiration->option_name; |
| 88 | 88 | $expires = $expiration->option_value; |
| 89 | 89 | |
| 90 | - if ( $now > $expires ) { |
|
| 91 | - $session_id = preg_replace("/[^A-Za-z0-9_]/", '', substr( $key, 20 ) ); |
|
| 90 | + if ($now > $expires) { |
|
| 91 | + $session_id = preg_replace("/[^A-Za-z0-9_]/", '', substr($key, 20)); |
|
| 92 | 92 | |
| 93 | 93 | $expired[] = $key; |
| 94 | 94 | $expired[] = "_wp_session_{$session_id}"; |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Delete expired sessions |
| 101 | - if ( ! empty( $expired ) ) { |
|
| 102 | - $placeholders = array_fill( 0, count( $expired ), '%s' ); |
|
| 103 | - $format = implode( ', ', $placeholders ); |
|
| 101 | + if (!empty($expired)) { |
|
| 102 | + $placeholders = array_fill(0, count($expired), '%s'); |
|
| 103 | + $format = implode(', ', $placeholders); |
|
| 104 | 104 | $query = "DELETE FROM $wpdb->options WHERE option_name IN ($format)"; |
| 105 | 105 | |
| 106 | - $prepared = $wpdb->prepare( $query, $expired ); |
|
| 107 | - $wpdb->query( $prepared ); |
|
| 106 | + $prepared = $wpdb->prepare($query, $expired); |
|
| 107 | + $wpdb->query($prepared); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return $count; |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | public static function delete_all_sessions() { |
| 121 | 121 | global $wpdb; |
| 122 | 122 | |
| 123 | - $count = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'" ); |
|
| 123 | + $count = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'"); |
|
| 124 | 124 | |
| 125 | - return (int) ( $count / 2 ); |
|
| 125 | + return (int)($count / 2); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | * @return string |
| 132 | 132 | */ |
| 133 | 133 | public static function generate_id() { |
| 134 | - require_once( ABSPATH . 'wp-includes/class-phpass.php' ); |
|
| 135 | - $hash = new PasswordHash( 8, false ); |
|
| 134 | + require_once(ABSPATH . 'wp-includes/class-phpass.php'); |
|
| 135 | + $hash = new PasswordHash(8, false); |
|
| 136 | 136 | |
| 137 | - return md5( $hash->get_random_bytes( 32 ) ); |
|
| 137 | + return md5($hash->get_random_bytes(32)); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | \ No newline at end of file |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // MUST have WordPress. |
| 10 | -if ( !defined( 'WPINC' ) ) { |
|
| 11 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
| 10 | +if (!defined('WPINC')) { |
|
| 11 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | function wpinv_init_transactional_emails() { |
| 15 | - $email_actions = apply_filters( 'wpinv_email_actions', array( |
|
| 15 | + $email_actions = apply_filters('wpinv_email_actions', array( |
|
| 16 | 16 | 'wpinv_status_pending_to_processing', |
| 17 | 17 | 'wpinv_status_pending_to_publish', |
| 18 | 18 | 'wpinv_status_pending_to_cancelled', |
@@ -28,74 +28,74 @@ discard block |
||
| 28 | 28 | 'wpinv_fully_refunded', |
| 29 | 29 | 'wpinv_partially_refunded', |
| 30 | 30 | 'wpinv_new_invoice_note' |
| 31 | - ) ); |
|
| 31 | + )); |
|
| 32 | 32 | |
| 33 | - foreach ( $email_actions as $action ) { |
|
| 34 | - add_action( $action, 'wpinv_send_transactional_email', 10, 10 ); |
|
| 33 | + foreach ($email_actions as $action) { |
|
| 34 | + add_action($action, 'wpinv_send_transactional_email', 10, 10); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | -add_action( 'init', 'wpinv_init_transactional_emails' ); |
|
| 37 | +add_action('init', 'wpinv_init_transactional_emails'); |
|
| 38 | 38 | |
| 39 | 39 | // New invoice email |
| 40 | -add_action( 'wpinv_status_pending_to_processing_notification', 'wpinv_new_invoice_notification' ); |
|
| 41 | -add_action( 'wpinv_status_pending_to_publish_notification', 'wpinv_new_invoice_notification' ); |
|
| 42 | -add_action( 'wpinv_status_pending_to_onhold_notification', 'wpinv_new_invoice_notification' ); |
|
| 43 | -add_action( 'wpinv_status_failed_to_processing_notification', 'wpinv_new_invoice_notification' ); |
|
| 44 | -add_action( 'wpinv_status_failed_to_publish_notification', 'wpinv_new_invoice_notification' ); |
|
| 45 | -add_action( 'wpinv_status_failed_to_onhold_notification', 'wpinv_new_invoice_notification' ); |
|
| 40 | +add_action('wpinv_status_pending_to_processing_notification', 'wpinv_new_invoice_notification'); |
|
| 41 | +add_action('wpinv_status_pending_to_publish_notification', 'wpinv_new_invoice_notification'); |
|
| 42 | +add_action('wpinv_status_pending_to_onhold_notification', 'wpinv_new_invoice_notification'); |
|
| 43 | +add_action('wpinv_status_failed_to_processing_notification', 'wpinv_new_invoice_notification'); |
|
| 44 | +add_action('wpinv_status_failed_to_publish_notification', 'wpinv_new_invoice_notification'); |
|
| 45 | +add_action('wpinv_status_failed_to_onhold_notification', 'wpinv_new_invoice_notification'); |
|
| 46 | 46 | |
| 47 | 47 | // Cancelled invoice email |
| 48 | -add_action( 'wpinv_status_pending_to_cancelled_notification', 'wpinv_cancelled_invoice_notification' ); |
|
| 49 | -add_action( 'wpinv_status_onhold_to_cancelled_notification', 'wpinv_cancelled_invoice_notification' ); |
|
| 48 | +add_action('wpinv_status_pending_to_cancelled_notification', 'wpinv_cancelled_invoice_notification'); |
|
| 49 | +add_action('wpinv_status_onhold_to_cancelled_notification', 'wpinv_cancelled_invoice_notification'); |
|
| 50 | 50 | |
| 51 | 51 | // Failed invoice email |
| 52 | -add_action( 'wpinv_status_pending_to_failed_notification', 'wpinv_failed_invoice_notification' ); |
|
| 53 | -add_action( 'wpinv_status_onhold_to_failed_notification', 'wpinv_failed_invoice_notification' ); |
|
| 52 | +add_action('wpinv_status_pending_to_failed_notification', 'wpinv_failed_invoice_notification'); |
|
| 53 | +add_action('wpinv_status_onhold_to_failed_notification', 'wpinv_failed_invoice_notification'); |
|
| 54 | 54 | |
| 55 | 55 | // On hold invoice email |
| 56 | -add_action( 'wpinv_status_pending_to_onhold_notification', 'wpinv_onhold_invoice_notification' ); |
|
| 57 | -add_action( 'wpinv_status_failed_to_onhold_notification', 'wpinv_onhold_invoice_notification' ); |
|
| 56 | +add_action('wpinv_status_pending_to_onhold_notification', 'wpinv_onhold_invoice_notification'); |
|
| 57 | +add_action('wpinv_status_failed_to_onhold_notification', 'wpinv_onhold_invoice_notification'); |
|
| 58 | 58 | |
| 59 | 59 | // Processing invoice email |
| 60 | -add_action( 'wpinv_status_pending_to_processing_notification', 'wpinv_processing_invoice_notification' ); |
|
| 60 | +add_action('wpinv_status_pending_to_processing_notification', 'wpinv_processing_invoice_notification'); |
|
| 61 | 61 | |
| 62 | 62 | // Paid invoice email |
| 63 | -add_action( 'wpinv_status_publish_notification', 'wpinv_completed_invoice_notification' ); |
|
| 63 | +add_action('wpinv_status_publish_notification', 'wpinv_completed_invoice_notification'); |
|
| 64 | 64 | |
| 65 | 65 | // Refunded invoice email |
| 66 | -add_action( 'wpinv_fully_refunded_notification', 'wpinv_fully_refunded_notification' ); |
|
| 67 | -add_action( 'wpinv_partially_refunded_notification', 'wpinv_partially_refunded_notification' ); |
|
| 66 | +add_action('wpinv_fully_refunded_notification', 'wpinv_fully_refunded_notification'); |
|
| 67 | +add_action('wpinv_partially_refunded_notification', 'wpinv_partially_refunded_notification'); |
|
| 68 | 68 | |
| 69 | 69 | // Invoice note |
| 70 | -add_action( 'wpinv_new_invoice_note_notification', 'wpinv_new_invoice_note_notification' ); |
|
| 70 | +add_action('wpinv_new_invoice_note_notification', 'wpinv_new_invoice_note_notification'); |
|
| 71 | 71 | |
| 72 | -add_action( 'wpinv_email_header', 'wpinv_email_header' ); |
|
| 73 | -add_action( 'wpinv_email_footer', 'wpinv_email_footer' ); |
|
| 74 | -add_action( 'wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3 ); |
|
| 75 | -add_action( 'wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3 ); |
|
| 76 | -add_action( 'wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3 ); |
|
| 72 | +add_action('wpinv_email_header', 'wpinv_email_header'); |
|
| 73 | +add_action('wpinv_email_footer', 'wpinv_email_footer'); |
|
| 74 | +add_action('wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3); |
|
| 75 | +add_action('wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3); |
|
| 76 | +add_action('wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3); |
|
| 77 | 77 | |
| 78 | 78 | function wpinv_send_transactional_email() { |
| 79 | 79 | $args = func_get_args(); |
| 80 | 80 | $function = current_filter() . '_notification'; |
| 81 | - do_action_ref_array( $function, $args ); |
|
| 81 | + do_action_ref_array($function, $args); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | -function wpinv_new_invoice_notification( $invoice_id, $new_status = '' ) { |
|
| 84 | +function wpinv_new_invoice_notification($invoice_id, $new_status = '') { |
|
| 85 | 85 | global $wpinv_email_search, $wpinv_email_replace; |
| 86 | 86 | |
| 87 | 87 | $email_type = 'new_invoice'; |
| 88 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 88 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 89 | 89 | return false; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 93 | - if ( empty( $invoice ) ) { |
|
| 92 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 93 | + if (empty($invoice)) { |
|
| 94 | 94 | return false; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 98 | - if ( !is_email( $recipient ) ) { |
|
| 97 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 98 | + if (!is_email($recipient)) { |
|
| 99 | 99 | return false; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -112,37 +112,37 @@ discard block |
||
| 112 | 112 | $wpinv_email_search = $search; |
| 113 | 113 | $wpinv_email_replace = $replace; |
| 114 | 114 | |
| 115 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 116 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 117 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 118 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 115 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 116 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 117 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 118 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 119 | 119 | |
| 120 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 120 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 121 | 121 | 'invoice' => $invoice, |
| 122 | 122 | 'email_type' => $email_type, |
| 123 | 123 | 'email_heading' => $email_heading, |
| 124 | 124 | 'sent_to_admin' => true, |
| 125 | 125 | 'plain_text' => false, |
| 126 | - ) ); |
|
| 126 | + )); |
|
| 127 | 127 | |
| 128 | - return wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 128 | + return wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | -function wpinv_cancelled_invoice_notification( $invoice_id, $new_status = '' ) { |
|
| 131 | +function wpinv_cancelled_invoice_notification($invoice_id, $new_status = '') { |
|
| 132 | 132 | global $wpinv_email_search, $wpinv_email_replace; |
| 133 | 133 | |
| 134 | 134 | $email_type = 'cancelled_invoice'; |
| 135 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 135 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 140 | - if ( empty( $invoice ) ) { |
|
| 139 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 140 | + if (empty($invoice)) { |
|
| 141 | 141 | return false; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 145 | - if ( !is_email( $recipient ) ) { |
|
| 144 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 145 | + if (!is_email($recipient)) { |
|
| 146 | 146 | return false; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -159,37 +159,37 @@ discard block |
||
| 159 | 159 | $wpinv_email_search = $search; |
| 160 | 160 | $wpinv_email_replace = $replace; |
| 161 | 161 | |
| 162 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 163 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 164 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 165 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 162 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 163 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 164 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 165 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 166 | 166 | |
| 167 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 167 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 168 | 168 | 'invoice' => $invoice, |
| 169 | 169 | 'email_type' => $email_type, |
| 170 | 170 | 'email_heading' => $email_heading, |
| 171 | 171 | 'sent_to_admin' => true, |
| 172 | 172 | 'plain_text' => false, |
| 173 | - ) ); |
|
| 173 | + )); |
|
| 174 | 174 | |
| 175 | - return wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 175 | + return wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | -function wpinv_failed_invoice_notification( $invoice_id, $new_status = '' ) { |
|
| 178 | +function wpinv_failed_invoice_notification($invoice_id, $new_status = '') { |
|
| 179 | 179 | global $wpinv_email_search, $wpinv_email_replace; |
| 180 | 180 | |
| 181 | 181 | $email_type = 'failed_invoice'; |
| 182 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 182 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 183 | 183 | return false; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 187 | - if ( empty( $invoice ) ) { |
|
| 186 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 187 | + if (empty($invoice)) { |
|
| 188 | 188 | return false; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 192 | - if ( !is_email( $recipient ) ) { |
|
| 191 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 192 | + if (!is_email($recipient)) { |
|
| 193 | 193 | return false; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -206,37 +206,37 @@ discard block |
||
| 206 | 206 | $wpinv_email_search = $search; |
| 207 | 207 | $wpinv_email_replace = $replace; |
| 208 | 208 | |
| 209 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 210 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 211 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 212 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 209 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 210 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 211 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 212 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 213 | 213 | |
| 214 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 214 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 215 | 215 | 'invoice' => $invoice, |
| 216 | 216 | 'email_type' => $email_type, |
| 217 | 217 | 'email_heading' => $email_heading, |
| 218 | 218 | 'sent_to_admin' => true, |
| 219 | 219 | 'plain_text' => false, |
| 220 | - ) ); |
|
| 220 | + )); |
|
| 221 | 221 | |
| 222 | - return wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 222 | + return wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | -function wpinv_onhold_invoice_notification( $invoice_id, $new_status = '' ) { |
|
| 225 | +function wpinv_onhold_invoice_notification($invoice_id, $new_status = '') { |
|
| 226 | 226 | global $wpinv_email_search, $wpinv_email_replace; |
| 227 | 227 | |
| 228 | 228 | $email_type = 'onhold_invoice'; |
| 229 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 229 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 230 | 230 | return false; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 234 | - if ( empty( $invoice ) ) { |
|
| 233 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 234 | + if (empty($invoice)) { |
|
| 235 | 235 | return false; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 239 | - if ( !is_email( $recipient ) ) { |
|
| 238 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 239 | + if (!is_email($recipient)) { |
|
| 240 | 240 | return false; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -253,45 +253,45 @@ discard block |
||
| 253 | 253 | $wpinv_email_search = $search; |
| 254 | 254 | $wpinv_email_replace = $replace; |
| 255 | 255 | |
| 256 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 257 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 258 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 259 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 256 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 257 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 258 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 259 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 260 | 260 | |
| 261 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 261 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 262 | 262 | 'invoice' => $invoice, |
| 263 | 263 | 'email_type' => $email_type, |
| 264 | 264 | 'email_heading' => $email_heading, |
| 265 | 265 | 'sent_to_admin' => false, |
| 266 | 266 | 'plain_text' => false, |
| 267 | - ) ); |
|
| 267 | + )); |
|
| 268 | 268 | |
| 269 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 269 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 270 | 270 | |
| 271 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
| 272 | - $recipient = wpinv_get_admin_email(); |
|
| 273 | - $subject .= ' - ADMIN BCC COPY'; |
|
| 274 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 271 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
| 272 | + $recipient = wpinv_get_admin_email(); |
|
| 273 | + $subject .= ' - ADMIN BCC COPY'; |
|
| 274 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | return $sent; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | -function wpinv_processing_invoice_notification( $invoice_id, $new_status = '' ) { |
|
| 280 | +function wpinv_processing_invoice_notification($invoice_id, $new_status = '') { |
|
| 281 | 281 | global $wpinv_email_search, $wpinv_email_replace; |
| 282 | 282 | |
| 283 | 283 | $email_type = 'processing_invoice'; |
| 284 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 284 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 285 | 285 | return false; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 289 | - if ( empty( $invoice ) ) { |
|
| 288 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 289 | + if (empty($invoice)) { |
|
| 290 | 290 | return false; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 294 | - if ( !is_email( $recipient ) ) { |
|
| 293 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 294 | + if (!is_email($recipient)) { |
|
| 295 | 295 | return false; |
| 296 | 296 | } |
| 297 | 297 | |
@@ -308,45 +308,45 @@ discard block |
||
| 308 | 308 | $wpinv_email_search = $search; |
| 309 | 309 | $wpinv_email_replace = $replace; |
| 310 | 310 | |
| 311 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 312 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 313 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 314 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 311 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 312 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 313 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 314 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 315 | 315 | |
| 316 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 316 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 317 | 317 | 'invoice' => $invoice, |
| 318 | 318 | 'email_type' => $email_type, |
| 319 | 319 | 'email_heading' => $email_heading, |
| 320 | 320 | 'sent_to_admin' => false, |
| 321 | 321 | 'plain_text' => false, |
| 322 | - ) ); |
|
| 322 | + )); |
|
| 323 | 323 | |
| 324 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 324 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 325 | 325 | |
| 326 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
| 327 | - $recipient = wpinv_get_admin_email(); |
|
| 328 | - $subject .= ' - ADMIN BCC COPY'; |
|
| 329 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 326 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
| 327 | + $recipient = wpinv_get_admin_email(); |
|
| 328 | + $subject .= ' - ADMIN BCC COPY'; |
|
| 329 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | return $sent; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | -function wpinv_completed_invoice_notification( $invoice_id, $new_status = '' ) { |
|
| 335 | +function wpinv_completed_invoice_notification($invoice_id, $new_status = '') { |
|
| 336 | 336 | global $wpinv_email_search, $wpinv_email_replace; |
| 337 | 337 | |
| 338 | 338 | $email_type = 'completed_invoice'; |
| 339 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 339 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 340 | 340 | return false; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 344 | - if ( empty( $invoice ) ) { |
|
| 343 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 344 | + if (empty($invoice)) { |
|
| 345 | 345 | return false; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 349 | - if ( !is_email( $recipient ) ) { |
|
| 348 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 349 | + if (!is_email($recipient)) { |
|
| 350 | 350 | return false; |
| 351 | 351 | } |
| 352 | 352 | |
@@ -363,45 +363,45 @@ discard block |
||
| 363 | 363 | $wpinv_email_search = $search; |
| 364 | 364 | $wpinv_email_replace = $replace; |
| 365 | 365 | |
| 366 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 367 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 368 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 369 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 366 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 367 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 368 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 369 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 370 | 370 | |
| 371 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 371 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 372 | 372 | 'invoice' => $invoice, |
| 373 | 373 | 'email_type' => $email_type, |
| 374 | 374 | 'email_heading' => $email_heading, |
| 375 | 375 | 'sent_to_admin' => false, |
| 376 | 376 | 'plain_text' => false, |
| 377 | - ) ); |
|
| 377 | + )); |
|
| 378 | 378 | |
| 379 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 379 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 380 | 380 | |
| 381 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
| 382 | - $recipient = wpinv_get_admin_email(); |
|
| 383 | - $subject .= ' - ADMIN BCC COPY'; |
|
| 384 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 381 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
| 382 | + $recipient = wpinv_get_admin_email(); |
|
| 383 | + $subject .= ' - ADMIN BCC COPY'; |
|
| 384 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | return $sent; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | -function wpinv_fully_refunded_notification( $invoice_id, $new_status = '' ) { |
|
| 390 | +function wpinv_fully_refunded_notification($invoice_id, $new_status = '') { |
|
| 391 | 391 | global $wpinv_email_search, $wpinv_email_replace; |
| 392 | 392 | |
| 393 | 393 | $email_type = 'refunded_invoice'; |
| 394 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 394 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 395 | 395 | return false; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 399 | - if ( empty( $invoice ) ) { |
|
| 398 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 399 | + if (empty($invoice)) { |
|
| 400 | 400 | return false; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 404 | - if ( !is_email( $recipient ) ) { |
|
| 403 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 404 | + if (!is_email($recipient)) { |
|
| 405 | 405 | return false; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -418,46 +418,46 @@ discard block |
||
| 418 | 418 | $wpinv_email_search = $search; |
| 419 | 419 | $wpinv_email_replace = $replace; |
| 420 | 420 | |
| 421 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 422 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 423 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 424 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 421 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 422 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 423 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 424 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 425 | 425 | |
| 426 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 426 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 427 | 427 | 'invoice' => $invoice, |
| 428 | 428 | 'email_type' => $email_type, |
| 429 | 429 | 'email_heading' => $email_heading, |
| 430 | 430 | 'sent_to_admin' => false, |
| 431 | 431 | 'plain_text' => false, |
| 432 | 432 | 'partial_refund' => false |
| 433 | - ) ); |
|
| 433 | + )); |
|
| 434 | 434 | |
| 435 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 435 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 436 | 436 | |
| 437 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
| 438 | - $recipient = wpinv_get_admin_email(); |
|
| 439 | - $subject .= ' - ADMIN BCC COPY'; |
|
| 440 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 437 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
| 438 | + $recipient = wpinv_get_admin_email(); |
|
| 439 | + $subject .= ' - ADMIN BCC COPY'; |
|
| 440 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | return $sent; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | -function wpinv_partially_refunded_notification( $invoice_id, $new_status = '' ) { |
|
| 446 | +function wpinv_partially_refunded_notification($invoice_id, $new_status = '') { |
|
| 447 | 447 | global $wpinv_email_search, $wpinv_email_replace; |
| 448 | 448 | |
| 449 | 449 | $email_type = 'refunded_invoice'; |
| 450 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 450 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 451 | 451 | return false; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 455 | - if ( empty( $invoice ) ) { |
|
| 454 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 455 | + if (empty($invoice)) { |
|
| 456 | 456 | return false; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 460 | - if ( !is_email( $recipient ) ) { |
|
| 459 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 460 | + if (!is_email($recipient)) { |
|
| 461 | 461 | return false; |
| 462 | 462 | } |
| 463 | 463 | |
@@ -474,49 +474,49 @@ discard block |
||
| 474 | 474 | $wpinv_email_search = $search; |
| 475 | 475 | $wpinv_email_replace = $replace; |
| 476 | 476 | |
| 477 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 478 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 479 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 480 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 477 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 478 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 479 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 480 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 481 | 481 | |
| 482 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 482 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 483 | 483 | 'invoice' => $invoice, |
| 484 | 484 | 'email_type' => $email_type, |
| 485 | 485 | 'email_heading' => $email_heading, |
| 486 | 486 | 'sent_to_admin' => false, |
| 487 | 487 | 'plain_text' => false, |
| 488 | 488 | 'partial_refund' => true |
| 489 | - ) ); |
|
| 489 | + )); |
|
| 490 | 490 | |
| 491 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 491 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 492 | 492 | |
| 493 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
| 494 | - $recipient = wpinv_get_admin_email(); |
|
| 495 | - $subject .= ' - ADMIN BCC COPY'; |
|
| 496 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 493 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
| 494 | + $recipient = wpinv_get_admin_email(); |
|
| 495 | + $subject .= ' - ADMIN BCC COPY'; |
|
| 496 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | return $sent; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | -function wpinv_new_invoice_note_notification( $invoice_id, $new_status = '' ) { |
|
| 502 | +function wpinv_new_invoice_note_notification($invoice_id, $new_status = '') { |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | -function wpinv_user_invoice_notification( $invoice_id ) { |
|
| 505 | +function wpinv_user_invoice_notification($invoice_id) { |
|
| 506 | 506 | global $wpinv_email_search, $wpinv_email_replace; |
| 507 | 507 | |
| 508 | 508 | $email_type = 'user_invoice'; |
| 509 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 509 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 510 | 510 | return false; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 514 | - if ( empty( $invoice ) ) { |
|
| 513 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 514 | + if (empty($invoice)) { |
|
| 515 | 515 | return false; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 519 | - if ( !is_email( $recipient ) ) { |
|
| 518 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 519 | + if (!is_email($recipient)) { |
|
| 520 | 520 | return false; |
| 521 | 521 | } |
| 522 | 522 | |
@@ -533,52 +533,52 @@ discard block |
||
| 533 | 533 | $wpinv_email_search = $search; |
| 534 | 534 | $wpinv_email_replace = $replace; |
| 535 | 535 | |
| 536 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 537 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 538 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 539 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 536 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 537 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 538 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 539 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 540 | 540 | |
| 541 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 541 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 542 | 542 | 'invoice' => $invoice, |
| 543 | 543 | 'email_type' => $email_type, |
| 544 | 544 | 'email_heading' => $email_heading, |
| 545 | 545 | 'sent_to_admin' => false, |
| 546 | 546 | 'plain_text' => false, |
| 547 | - ) ); |
|
| 547 | + )); |
|
| 548 | 548 | |
| 549 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 549 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 550 | 550 | |
| 551 | - if ( $sent ) { |
|
| 552 | - $note = __( 'Invoice has been emailed to the user.', 'invoicing' ); |
|
| 551 | + if ($sent) { |
|
| 552 | + $note = __('Invoice has been emailed to the user.', 'invoicing'); |
|
| 553 | 553 | } else { |
| 554 | - $note = __( 'Fail to send invoice to the user!', 'invoicing' ); |
|
| 554 | + $note = __('Fail to send invoice to the user!', 'invoicing'); |
|
| 555 | 555 | } |
| 556 | - $invoice->add_note( $note ); // Add private note. |
|
| 556 | + $invoice->add_note($note); // Add private note. |
|
| 557 | 557 | |
| 558 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
| 559 | - $recipient = wpinv_get_admin_email(); |
|
| 560 | - $subject .= ' - ADMIN BCC COPY'; |
|
| 561 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 558 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
| 559 | + $recipient = wpinv_get_admin_email(); |
|
| 560 | + $subject .= ' - ADMIN BCC COPY'; |
|
| 561 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | return $sent; |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | -function wpinv_user_note_notification( $invoice_id, $args = array() ) { |
|
| 567 | +function wpinv_user_note_notification($invoice_id, $args = array()) { |
|
| 568 | 568 | global $wpinv_email_search, $wpinv_email_replace; |
| 569 | 569 | |
| 570 | 570 | $email_type = 'user_note'; |
| 571 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 571 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 572 | 572 | return false; |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 576 | - if ( empty( $invoice ) ) { |
|
| 575 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 576 | + if (empty($invoice)) { |
|
| 577 | 577 | return false; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 581 | - if ( !is_email( $recipient ) ) { |
|
| 580 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 581 | + if (!is_email($recipient)) { |
|
| 582 | 582 | return false; |
| 583 | 583 | } |
| 584 | 584 | |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | 'user_note' => '' |
| 587 | 587 | ); |
| 588 | 588 | |
| 589 | - $args = wp_parse_args( $args, $defaults ); |
|
| 589 | + $args = wp_parse_args($args, $defaults); |
|
| 590 | 590 | |
| 591 | 591 | $search = array(); |
| 592 | 592 | $search['invoice_number'] = '{invoice_number}'; |
@@ -603,46 +603,46 @@ discard block |
||
| 603 | 603 | $wpinv_email_search = $search; |
| 604 | 604 | $wpinv_email_replace = $replace; |
| 605 | 605 | |
| 606 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 607 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 608 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 609 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 606 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 607 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 608 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 609 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 610 | 610 | |
| 611 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 611 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 612 | 612 | 'invoice' => $invoice, |
| 613 | 613 | 'email_type' => $email_type, |
| 614 | 614 | 'email_heading' => $email_heading, |
| 615 | 615 | 'sent_to_admin' => false, |
| 616 | 616 | 'plain_text' => false, |
| 617 | 617 | 'customer_note' => $args['user_note'] |
| 618 | - ) ); |
|
| 618 | + )); |
|
| 619 | 619 | |
| 620 | - $content = wpinv_email_format_text( $content ); |
|
| 620 | + $content = wpinv_email_format_text($content); |
|
| 621 | 621 | |
| 622 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 622 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 623 | 623 | |
| 624 | 624 | return $sent; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | function wpinv_mail_get_from_address() { |
| 628 | - $from_address = apply_filters( 'wpinv_mail_from_address', wpinv_get_option( 'email_from' ) ); |
|
| 629 | - return sanitize_email( $from_address ); |
|
| 628 | + $from_address = apply_filters('wpinv_mail_from_address', wpinv_get_option('email_from')); |
|
| 629 | + return sanitize_email($from_address); |
|
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | function wpinv_mail_get_from_name() { |
| 633 | - $from_name = apply_filters( 'wpinv_mail_from_name', wpinv_get_option( 'email_from_name' ) ); |
|
| 634 | - return wp_specialchars_decode( esc_html( $from_name ), ENT_QUOTES ); |
|
| 633 | + $from_name = apply_filters('wpinv_mail_from_name', wpinv_get_option('email_from_name')); |
|
| 634 | + return wp_specialchars_decode(esc_html($from_name), ENT_QUOTES); |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | -function wpinv_mail_admin_bcc_active( $mail_type = '' ) { |
|
| 638 | - $active = apply_filters( 'wpinv_mail_admin_bcc_active', wpinv_get_option( 'email_' . $mail_type . '_admin_bcc' ) ); |
|
| 639 | - return ( $active ? true : false ); |
|
| 637 | +function wpinv_mail_admin_bcc_active($mail_type = '') { |
|
| 638 | + $active = apply_filters('wpinv_mail_admin_bcc_active', wpinv_get_option('email_' . $mail_type . '_admin_bcc')); |
|
| 639 | + return ($active ? true : false); |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | -function wpinv_mail_get_content_type( $content_type = 'text/html', $email_type = 'html' ) { |
|
| 643 | - $email_type = apply_filters( 'wpinv_mail_content_type', $email_type ); |
|
| 642 | +function wpinv_mail_get_content_type($content_type = 'text/html', $email_type = 'html') { |
|
| 643 | + $email_type = apply_filters('wpinv_mail_content_type', $email_type); |
|
| 644 | 644 | |
| 645 | - switch ( $email_type ) { |
|
| 645 | + switch ($email_type) { |
|
| 646 | 646 | case 'html' : |
| 647 | 647 | $content_type = 'text/html'; |
| 648 | 648 | break; |
@@ -657,35 +657,35 @@ discard block |
||
| 657 | 657 | return $content_type; |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | -function wpinv_mail_send( $to, $subject, $message, $headers, $attachments ) { |
|
| 661 | - add_filter( 'wp_mail_from', 'wpinv_mail_get_from_address' ); |
|
| 662 | - add_filter( 'wp_mail_from_name', 'wpinv_mail_get_from_name' ); |
|
| 663 | - add_filter( 'wp_mail_content_type', 'wpinv_mail_get_content_type' ); |
|
| 660 | +function wpinv_mail_send($to, $subject, $message, $headers, $attachments) { |
|
| 661 | + add_filter('wp_mail_from', 'wpinv_mail_get_from_address'); |
|
| 662 | + add_filter('wp_mail_from_name', 'wpinv_mail_get_from_name'); |
|
| 663 | + add_filter('wp_mail_content_type', 'wpinv_mail_get_content_type'); |
|
| 664 | 664 | |
| 665 | - $message = wpinv_email_style_body( $message ); |
|
| 666 | - $message = apply_filters( 'wpinv_mail_content', $message ); |
|
| 665 | + $message = wpinv_email_style_body($message); |
|
| 666 | + $message = apply_filters('wpinv_mail_content', $message); |
|
| 667 | 667 | |
| 668 | - $sent = wp_mail( $to, $subject, $message, $headers, $attachments ); |
|
| 668 | + $sent = wp_mail($to, $subject, $message, $headers, $attachments); |
|
| 669 | 669 | |
| 670 | - if ( !$sent ) { |
|
| 671 | - $log_message = wp_sprintf( __( "\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing' ), date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), ( is_array( $to ) ? implode( ', ', $to ) : $to ), $subject ); |
|
| 672 | - wpinv_error_log( $log_message, __( "Email from Invoicing plugin failed to send", 'invoicing' ), __FILE__, __LINE__ ); |
|
| 670 | + if (!$sent) { |
|
| 671 | + $log_message = wp_sprintf(__("\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing'), date_i18n('F j Y H:i:s', current_time('timestamp')), (is_array($to) ? implode(', ', $to) : $to), $subject); |
|
| 672 | + wpinv_error_log($log_message, __("Email from Invoicing plugin failed to send", 'invoicing'), __FILE__, __LINE__); |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | - remove_filter( 'wp_mail_from', 'wpinv_mail_get_from_address' ); |
|
| 676 | - remove_filter( 'wp_mail_from_name', 'wpinv_mail_get_from_name' ); |
|
| 677 | - remove_filter( 'wp_mail_content_type', 'wpinv_mail_get_content_type' ); |
|
| 675 | + remove_filter('wp_mail_from', 'wpinv_mail_get_from_address'); |
|
| 676 | + remove_filter('wp_mail_from_name', 'wpinv_mail_get_from_name'); |
|
| 677 | + remove_filter('wp_mail_content_type', 'wpinv_mail_get_content_type'); |
|
| 678 | 678 | |
| 679 | 679 | return $sent; |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | function wpinv_get_emails() { |
| 683 | 683 | $overdue_days_options = array(); |
| 684 | - $overdue_days_options[0] = __( 'On the Due Date', 'invoicing' ); |
|
| 685 | - $overdue_days_options[1] = __( '1 day after Due Date', 'invoicing' ); |
|
| 684 | + $overdue_days_options[0] = __('On the Due Date', 'invoicing'); |
|
| 685 | + $overdue_days_options[1] = __('1 day after Due Date', 'invoicing'); |
|
| 686 | 686 | |
| 687 | - for ( $i = 2; $i <= 10; $i++ ) { |
|
| 688 | - $overdue_days_options[$i] = wp_sprintf( __( '%d days after Due Date', 'invoicing' ), $i ); |
|
| 687 | + for ($i = 2; $i <= 10; $i++) { |
|
| 688 | + $overdue_days_options[$i] = wp_sprintf(__('%d days after Due Date', 'invoicing'), $i); |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | // Default, built-in gateways |
@@ -693,130 +693,130 @@ discard block |
||
| 693 | 693 | 'new_invoice' => array( |
| 694 | 694 | 'email_new_invoice_header' => array( |
| 695 | 695 | 'id' => 'email_new_invoice_header', |
| 696 | - 'name' => '<h3>' . __( 'New Invoice', 'invoicing' ) . '</h3>', |
|
| 697 | - 'desc' => __( 'New invoice emails are sent to admin when a new invoice is received.', 'invoicing' ), |
|
| 696 | + 'name' => '<h3>' . __('New Invoice', 'invoicing') . '</h3>', |
|
| 697 | + 'desc' => __('New invoice emails are sent to admin when a new invoice is received.', 'invoicing'), |
|
| 698 | 698 | 'type' => 'header', |
| 699 | 699 | ), |
| 700 | 700 | 'email_new_invoice_active' => array( |
| 701 | 701 | 'id' => 'email_new_invoice_active', |
| 702 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 703 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 702 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 703 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 704 | 704 | 'type' => 'checkbox', |
| 705 | 705 | 'std' => 1 |
| 706 | 706 | ), |
| 707 | 707 | 'email_new_invoice_subject' => array( |
| 708 | 708 | 'id' => 'email_new_invoice_subject', |
| 709 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 710 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 709 | + 'name' => __('Subject', 'invoicing'), |
|
| 710 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 711 | 711 | 'type' => 'text', |
| 712 | - 'std' => __( '[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing' ), |
|
| 712 | + 'std' => __('[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing'), |
|
| 713 | 713 | 'size' => 'large' |
| 714 | 714 | ), |
| 715 | 715 | 'email_new_invoice_heading' => array( |
| 716 | 716 | 'id' => 'email_new_invoice_heading', |
| 717 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 718 | - 'desc' => __( 'Enter the the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
| 717 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 718 | + 'desc' => __('Enter the the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
| 719 | 719 | 'type' => 'text', |
| 720 | - 'std' => __( 'New payment invoice', 'invoicing' ), |
|
| 720 | + 'std' => __('New payment invoice', 'invoicing'), |
|
| 721 | 721 | 'size' => 'large' |
| 722 | 722 | ), |
| 723 | 723 | ), |
| 724 | 724 | 'cancelled_invoice' => array( |
| 725 | 725 | 'email_cancelled_invoice_header' => array( |
| 726 | 726 | 'id' => 'email_cancelled_invoice_header', |
| 727 | - 'name' => '<h3>' . __( 'Cancelled Invoice', 'invoicing' ) . '</h3>', |
|
| 728 | - 'desc' => __( 'Cancelled invoice emails are sent to admin when invoices have been marked cancelled.', 'invoicing' ), |
|
| 727 | + 'name' => '<h3>' . __('Cancelled Invoice', 'invoicing') . '</h3>', |
|
| 728 | + 'desc' => __('Cancelled invoice emails are sent to admin when invoices have been marked cancelled.', 'invoicing'), |
|
| 729 | 729 | 'type' => 'header', |
| 730 | 730 | ), |
| 731 | 731 | 'email_cancelled_invoice_active' => array( |
| 732 | 732 | 'id' => 'email_cancelled_invoice_active', |
| 733 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 734 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 733 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 734 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 735 | 735 | 'type' => 'checkbox', |
| 736 | 736 | 'std' => 1 |
| 737 | 737 | ), |
| 738 | 738 | 'email_cancelled_invoice_subject' => array( |
| 739 | 739 | 'id' => 'email_cancelled_invoice_subject', |
| 740 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 741 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 740 | + 'name' => __('Subject', 'invoicing'), |
|
| 741 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 742 | 742 | 'type' => 'text', |
| 743 | - 'std' => __( '[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing' ), |
|
| 743 | + 'std' => __('[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing'), |
|
| 744 | 744 | 'size' => 'large' |
| 745 | 745 | ), |
| 746 | 746 | 'email_cancelled_invoice_heading' => array( |
| 747 | 747 | 'id' => 'email_cancelled_invoice_heading', |
| 748 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 749 | - 'desc' => __( 'Enter the the main heading contained within the email notification.', 'invoicing' ), |
|
| 748 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 749 | + 'desc' => __('Enter the the main heading contained within the email notification.', 'invoicing'), |
|
| 750 | 750 | 'type' => 'text', |
| 751 | - 'std' => __( 'Cancelled invoice', 'invoicing' ), |
|
| 751 | + 'std' => __('Cancelled invoice', 'invoicing'), |
|
| 752 | 752 | 'size' => 'large' |
| 753 | 753 | ), |
| 754 | 754 | ), |
| 755 | 755 | 'failed_invoice' => array( |
| 756 | 756 | 'email_failed_invoice_header' => array( |
| 757 | 757 | 'id' => 'email_failed_invoice_header', |
| 758 | - 'name' => '<h3>' . __( 'Failed Invoice', 'invoicing' ) . '</h3>', |
|
| 759 | - 'desc' => __( 'Failed invoice emails are sent to admin when invoices have been marked failed (if they were previously processing or on-hold).', 'invoicing' ), |
|
| 758 | + 'name' => '<h3>' . __('Failed Invoice', 'invoicing') . '</h3>', |
|
| 759 | + 'desc' => __('Failed invoice emails are sent to admin when invoices have been marked failed (if they were previously processing or on-hold).', 'invoicing'), |
|
| 760 | 760 | 'type' => 'header', |
| 761 | 761 | ), |
| 762 | 762 | 'email_failed_invoice_active' => array( |
| 763 | 763 | 'id' => 'email_failed_invoice_active', |
| 764 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 765 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 764 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 765 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 766 | 766 | 'type' => 'checkbox', |
| 767 | 767 | 'std' => 1 |
| 768 | 768 | ), |
| 769 | 769 | 'email_failed_invoice_subject' => array( |
| 770 | 770 | 'id' => 'email_failed_invoice_subject', |
| 771 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 772 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 771 | + 'name' => __('Subject', 'invoicing'), |
|
| 772 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 773 | 773 | 'type' => 'text', |
| 774 | - 'std' => __( '[{site_title}] Failed invoice ({invoice_number})', 'invoicing' ), |
|
| 774 | + 'std' => __('[{site_title}] Failed invoice ({invoice_number})', 'invoicing'), |
|
| 775 | 775 | 'size' => 'large' |
| 776 | 776 | ), |
| 777 | 777 | 'email_failed_invoice_heading' => array( |
| 778 | 778 | 'id' => 'email_failed_invoice_heading', |
| 779 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 780 | - 'desc' => __( 'Enter the the main heading contained within the email notification.', 'invoicing' ), |
|
| 779 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 780 | + 'desc' => __('Enter the the main heading contained within the email notification.', 'invoicing'), |
|
| 781 | 781 | 'type' => 'text', |
| 782 | - 'std' => __( 'Failed invoice', 'invoicing' ), |
|
| 782 | + 'std' => __('Failed invoice', 'invoicing'), |
|
| 783 | 783 | 'size' => 'large' |
| 784 | 784 | ) |
| 785 | 785 | ), |
| 786 | 786 | 'onhold_invoice' => array( |
| 787 | 787 | 'email_onhold_invoice_header' => array( |
| 788 | 788 | 'id' => 'email_onhold_invoice_header', |
| 789 | - 'name' => '<h3>' . __( 'On Hold Invoice', 'invoicing' ) . '</h3>', |
|
| 790 | - 'desc' => __( 'This is an invoice notification sent to users containing invoice details after an invoice is placed on-hold.', 'invoicing' ), |
|
| 789 | + 'name' => '<h3>' . __('On Hold Invoice', 'invoicing') . '</h3>', |
|
| 790 | + 'desc' => __('This is an invoice notification sent to users containing invoice details after an invoice is placed on-hold.', 'invoicing'), |
|
| 791 | 791 | 'type' => 'header', |
| 792 | 792 | ), |
| 793 | 793 | 'email_onhold_invoice_active' => array( |
| 794 | 794 | 'id' => 'email_onhold_invoice_active', |
| 795 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 796 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 795 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 796 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 797 | 797 | 'type' => 'checkbox', |
| 798 | 798 | 'std' => 1 |
| 799 | 799 | ), |
| 800 | 800 | 'email_onhold_invoice_subject' => array( |
| 801 | 801 | 'id' => 'email_onhold_invoice_subject', |
| 802 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 803 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 802 | + 'name' => __('Subject', 'invoicing'), |
|
| 803 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 804 | 804 | 'type' => 'text', |
| 805 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
| 805 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
| 806 | 806 | 'size' => 'large' |
| 807 | 807 | ), |
| 808 | 808 | 'email_onhold_invoice_heading' => array( |
| 809 | 809 | 'id' => 'email_onhold_invoice_heading', |
| 810 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 811 | - 'desc' => __( 'Enter the the main heading contained within the email notification.', 'invoicing' ), |
|
| 810 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 811 | + 'desc' => __('Enter the the main heading contained within the email notification.', 'invoicing'), |
|
| 812 | 812 | 'type' => 'text', |
| 813 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
| 813 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
| 814 | 814 | 'size' => 'large' |
| 815 | 815 | ), |
| 816 | 816 | 'email_onhold_invoice_admin_bcc' => array( |
| 817 | 817 | 'id' => 'email_onhold_invoice_admin_bcc', |
| 818 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
| 819 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
| 818 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
| 819 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
| 820 | 820 | 'type' => 'checkbox', |
| 821 | 821 | 'std' => 1 |
| 822 | 822 | ), |
@@ -824,37 +824,37 @@ discard block |
||
| 824 | 824 | 'processing_invoice' => array( |
| 825 | 825 | 'email_processing_invoice_header' => array( |
| 826 | 826 | 'id' => 'email_processing_invoice_header', |
| 827 | - 'name' => '<h3>' . __( 'Processing Invoice', 'invoicing' ) . '</h3>', |
|
| 828 | - 'desc' => __( 'This is an invoice notification sent to users containing invoice details after payment.', 'invoicing' ), |
|
| 827 | + 'name' => '<h3>' . __('Processing Invoice', 'invoicing') . '</h3>', |
|
| 828 | + 'desc' => __('This is an invoice notification sent to users containing invoice details after payment.', 'invoicing'), |
|
| 829 | 829 | 'type' => 'header', |
| 830 | 830 | ), |
| 831 | 831 | 'email_processing_invoice_active' => array( |
| 832 | 832 | 'id' => 'email_processing_invoice_active', |
| 833 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 834 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 833 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 834 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 835 | 835 | 'type' => 'checkbox', |
| 836 | 836 | 'std' => 1 |
| 837 | 837 | ), |
| 838 | 838 | 'email_processing_invoice_subject' => array( |
| 839 | 839 | 'id' => 'email_processing_invoice_subject', |
| 840 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 841 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 840 | + 'name' => __('Subject', 'invoicing'), |
|
| 841 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 842 | 842 | 'type' => 'text', |
| 843 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
| 843 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
| 844 | 844 | 'size' => 'large' |
| 845 | 845 | ), |
| 846 | 846 | 'email_processing_invoice_heading' => array( |
| 847 | 847 | 'id' => 'email_processing_invoice_heading', |
| 848 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 849 | - 'desc' => __( 'Enter the the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
| 848 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 849 | + 'desc' => __('Enter the the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
| 850 | 850 | 'type' => 'text', |
| 851 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
| 851 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
| 852 | 852 | 'size' => 'large' |
| 853 | 853 | ), |
| 854 | 854 | 'email_processing_invoice_admin_bcc' => array( |
| 855 | 855 | 'id' => 'email_processing_invoice_admin_bcc', |
| 856 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
| 857 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
| 856 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
| 857 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
| 858 | 858 | 'type' => 'checkbox', |
| 859 | 859 | 'std' => 1 |
| 860 | 860 | ), |
@@ -862,37 +862,37 @@ discard block |
||
| 862 | 862 | 'completed_invoice' => array( |
| 863 | 863 | 'email_completed_invoice_header' => array( |
| 864 | 864 | 'id' => 'email_completed_invoice_header', |
| 865 | - 'name' => '<h3>' . __( 'Paid Invoice', 'invoicing' ) . '</h3>', |
|
| 866 | - 'desc' => __( 'Invoice paid emails are sent to users when their invoices are marked paid and usually indicate that their payment has been done.', 'invoicing' ), |
|
| 865 | + 'name' => '<h3>' . __('Paid Invoice', 'invoicing') . '</h3>', |
|
| 866 | + 'desc' => __('Invoice paid emails are sent to users when their invoices are marked paid and usually indicate that their payment has been done.', 'invoicing'), |
|
| 867 | 867 | 'type' => 'header', |
| 868 | 868 | ), |
| 869 | 869 | 'email_completed_invoice_active' => array( |
| 870 | 870 | 'id' => 'email_completed_invoice_active', |
| 871 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 872 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 871 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 872 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 873 | 873 | 'type' => 'checkbox', |
| 874 | 874 | 'std' => 1 |
| 875 | 875 | ), |
| 876 | 876 | 'email_completed_invoice_subject' => array( |
| 877 | 877 | 'id' => 'email_completed_invoice_subject', |
| 878 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 879 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 878 | + 'name' => __('Subject', 'invoicing'), |
|
| 879 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 880 | 880 | 'type' => 'text', |
| 881 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing' ), |
|
| 881 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing'), |
|
| 882 | 882 | 'size' => 'large' |
| 883 | 883 | ), |
| 884 | 884 | 'email_completed_invoice_heading' => array( |
| 885 | 885 | 'id' => 'email_completed_invoice_heading', |
| 886 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 887 | - 'desc' => __( 'Enter the the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
| 886 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 887 | + 'desc' => __('Enter the the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
| 888 | 888 | 'type' => 'text', |
| 889 | - 'std' => __( 'Your invoice has been paid', 'invoicing' ), |
|
| 889 | + 'std' => __('Your invoice has been paid', 'invoicing'), |
|
| 890 | 890 | 'size' => 'large' |
| 891 | 891 | ), |
| 892 | 892 | 'email_completed_invoice_admin_bcc' => array( |
| 893 | 893 | 'id' => 'email_completed_invoice_admin_bcc', |
| 894 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
| 895 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
| 894 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
| 895 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
| 896 | 896 | 'type' => 'checkbox', |
| 897 | 897 | ), |
| 898 | 898 | 'std' => 1 |
@@ -900,37 +900,37 @@ discard block |
||
| 900 | 900 | 'refunded_invoice' => array( |
| 901 | 901 | 'email_refunded_invoice_header' => array( |
| 902 | 902 | 'id' => 'email_refunded_invoice_header', |
| 903 | - 'name' => '<h3>' . __( 'Refunded Invoice', 'invoicing' ) . '</h3>', |
|
| 904 | - 'desc' => __( 'Invoice refunded emails are sent to users when their invoices are marked refunded.', 'invoicing' ), |
|
| 903 | + 'name' => '<h3>' . __('Refunded Invoice', 'invoicing') . '</h3>', |
|
| 904 | + 'desc' => __('Invoice refunded emails are sent to users when their invoices are marked refunded.', 'invoicing'), |
|
| 905 | 905 | 'type' => 'header', |
| 906 | 906 | ), |
| 907 | 907 | 'email_refunded_invoice_active' => array( |
| 908 | 908 | 'id' => 'email_refunded_invoice_active', |
| 909 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 910 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 909 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 910 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 911 | 911 | 'type' => 'checkbox', |
| 912 | 912 | 'std' => 1 |
| 913 | 913 | ), |
| 914 | 914 | 'email_refunded_invoice_subject' => array( |
| 915 | 915 | 'id' => 'email_refunded_invoice_subject', |
| 916 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 917 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 916 | + 'name' => __('Subject', 'invoicing'), |
|
| 917 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 918 | 918 | 'type' => 'text', |
| 919 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing' ), |
|
| 919 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing'), |
|
| 920 | 920 | 'size' => 'large' |
| 921 | 921 | ), |
| 922 | 922 | 'email_refunded_invoice_heading' => array( |
| 923 | 923 | 'id' => 'email_refunded_invoice_heading', |
| 924 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 925 | - 'desc' => __( 'Enter the the main heading contained within the email notification.', 'invoicing' ), |
|
| 924 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 925 | + 'desc' => __('Enter the the main heading contained within the email notification.', 'invoicing'), |
|
| 926 | 926 | 'type' => 'text', |
| 927 | - 'std' => __( 'Your invoice has been refunded', 'invoicing' ), |
|
| 927 | + 'std' => __('Your invoice has been refunded', 'invoicing'), |
|
| 928 | 928 | 'size' => 'large' |
| 929 | 929 | ), |
| 930 | 930 | 'email_refunded_invoice_admin_bcc' => array( |
| 931 | 931 | 'id' => 'email_refunded_invoice_admin_bcc', |
| 932 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
| 933 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
| 932 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
| 933 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
| 934 | 934 | 'type' => 'checkbox', |
| 935 | 935 | 'std' => 1 |
| 936 | 936 | ), |
@@ -938,37 +938,37 @@ discard block |
||
| 938 | 938 | 'user_invoice' => array( |
| 939 | 939 | 'email_user_invoice_header' => array( |
| 940 | 940 | 'id' => 'email_user_invoice_header', |
| 941 | - 'name' => '<h3>' . __( 'Customer Invoice', 'invoicing' ) . '</h3>', |
|
| 942 | - 'desc' => __( 'Customer invoice emails can be sent to customers containing their invoice information and payment links.', 'invoicing' ), |
|
| 941 | + 'name' => '<h3>' . __('Customer Invoice', 'invoicing') . '</h3>', |
|
| 942 | + 'desc' => __('Customer invoice emails can be sent to customers containing their invoice information and payment links.', 'invoicing'), |
|
| 943 | 943 | 'type' => 'header', |
| 944 | 944 | ), |
| 945 | 945 | 'email_user_invoice_active' => array( |
| 946 | 946 | 'id' => 'email_user_invoice_active', |
| 947 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 948 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 947 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 948 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 949 | 949 | 'type' => 'checkbox', |
| 950 | 950 | 'std' => 1 |
| 951 | 951 | ), |
| 952 | 952 | 'email_user_invoice_subject' => array( |
| 953 | 953 | 'id' => 'email_user_invoice_subject', |
| 954 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 955 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 954 | + 'name' => __('Subject', 'invoicing'), |
|
| 955 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 956 | 956 | 'type' => 'text', |
| 957 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date}', 'invoicing' ), |
|
| 957 | + 'std' => __('[{site_title}] Your invoice from {invoice_date}', 'invoicing'), |
|
| 958 | 958 | 'size' => 'large' |
| 959 | 959 | ), |
| 960 | 960 | 'email_user_invoice_heading' => array( |
| 961 | 961 | 'id' => 'email_user_invoice_heading', |
| 962 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 963 | - 'desc' => __( 'Enter the the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
| 962 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 963 | + 'desc' => __('Enter the the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
| 964 | 964 | 'type' => 'text', |
| 965 | - 'std' => __( 'Your invoice {invoice_number} details', 'invoicing' ), |
|
| 965 | + 'std' => __('Your invoice {invoice_number} details', 'invoicing'), |
|
| 966 | 966 | 'size' => 'large' |
| 967 | 967 | ), |
| 968 | 968 | 'email_user_invoice_admin_bcc' => array( |
| 969 | 969 | 'id' => 'email_user_invoice_admin_bcc', |
| 970 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
| 971 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
| 970 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
| 971 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
| 972 | 972 | 'type' => 'checkbox', |
| 973 | 973 | 'std' => 1 |
| 974 | 974 | ), |
@@ -976,177 +976,177 @@ discard block |
||
| 976 | 976 | 'user_note' => array( |
| 977 | 977 | 'email_user_note_header' => array( |
| 978 | 978 | 'id' => 'email_user_note_header', |
| 979 | - 'name' => '<h3>' . __( 'Customer Note', 'invoicing' ) . '</h3>', |
|
| 980 | - 'desc' => __( 'Customer note emails are sent when you add a note to an invoice.', 'invoicing' ), |
|
| 979 | + 'name' => '<h3>' . __('Customer Note', 'invoicing') . '</h3>', |
|
| 980 | + 'desc' => __('Customer note emails are sent when you add a note to an invoice.', 'invoicing'), |
|
| 981 | 981 | 'type' => 'header', |
| 982 | 982 | ), |
| 983 | 983 | 'email_user_note_active' => array( |
| 984 | 984 | 'id' => 'email_user_note_active', |
| 985 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 986 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 985 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 986 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 987 | 987 | 'type' => 'checkbox', |
| 988 | 988 | 'std' => 1 |
| 989 | 989 | ), |
| 990 | 990 | 'email_user_note_subject' => array( |
| 991 | 991 | 'id' => 'email_user_note_subject', |
| 992 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 993 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 992 | + 'name' => __('Subject', 'invoicing'), |
|
| 993 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 994 | 994 | 'type' => 'text', |
| 995 | - 'std' => __( '[{site_title}] Note added to your invoice #{invoice_number} from {invoice_date}', 'invoicing' ), |
|
| 995 | + 'std' => __('[{site_title}] Note added to your invoice #{invoice_number} from {invoice_date}', 'invoicing'), |
|
| 996 | 996 | 'size' => 'large' |
| 997 | 997 | ), |
| 998 | 998 | 'email_user_note_heading' => array( |
| 999 | 999 | 'id' => 'email_user_note_heading', |
| 1000 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 1001 | - 'desc' => __( 'Enter the the main heading contained within the email notification.', 'invoicing' ), |
|
| 1000 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 1001 | + 'desc' => __('Enter the the main heading contained within the email notification.', 'invoicing'), |
|
| 1002 | 1002 | 'type' => 'text', |
| 1003 | - 'std' => __( 'A note has been added to your invoice', 'invoicing' ), |
|
| 1003 | + 'std' => __('A note has been added to your invoice', 'invoicing'), |
|
| 1004 | 1004 | 'size' => 'large' |
| 1005 | 1005 | ), |
| 1006 | 1006 | ), |
| 1007 | 1007 | 'overdue' => array( |
| 1008 | 1008 | 'email_overdue_header' => array( |
| 1009 | 1009 | 'id' => 'email_overdue_header', |
| 1010 | - 'name' => '<h3>' . __( 'Payment Reminder', 'invoicing' ) . '</h3>', |
|
| 1011 | - 'desc' => __( 'Payment reminder emails are sent to user automatically.', 'invoicing' ), |
|
| 1010 | + 'name' => '<h3>' . __('Payment Reminder', 'invoicing') . '</h3>', |
|
| 1011 | + 'desc' => __('Payment reminder emails are sent to user automatically.', 'invoicing'), |
|
| 1012 | 1012 | 'type' => 'header', |
| 1013 | 1013 | ), |
| 1014 | 1014 | 'email_overdue_active' => array( |
| 1015 | 1015 | 'id' => 'email_overdue_active', |
| 1016 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
| 1017 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
| 1016 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
| 1017 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
| 1018 | 1018 | 'type' => 'checkbox', |
| 1019 | 1019 | 'std' => 1 |
| 1020 | 1020 | ), |
| 1021 | 1021 | 'email_due_reminder_days' => array( |
| 1022 | 1022 | 'id' => 'email_due_reminder_days', |
| 1023 | - 'name' => __( 'When to Send', 'sliced-invoices' ), |
|
| 1024 | - 'desc' => __( 'Check when you would like payment reminders sent out.', 'invoicing' ), |
|
| 1023 | + 'name' => __('When to Send', 'sliced-invoices'), |
|
| 1024 | + 'desc' => __('Check when you would like payment reminders sent out.', 'invoicing'), |
|
| 1025 | 1025 | 'default' => '', |
| 1026 | 1026 | 'type' => 'multicheck', |
| 1027 | 1027 | 'options' => $overdue_days_options, |
| 1028 | 1028 | ), |
| 1029 | 1029 | 'email_overdue_subject' => array( |
| 1030 | 1030 | 'id' => 'email_overdue_subject', |
| 1031 | - 'name' => __( 'Subject', 'invoicing' ), |
|
| 1032 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
| 1031 | + 'name' => __('Subject', 'invoicing'), |
|
| 1032 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
| 1033 | 1033 | 'type' => 'text', |
| 1034 | - 'std' => __( '[{site_title}] Payment Reminder', 'invoicing' ), |
|
| 1034 | + 'std' => __('[{site_title}] Payment Reminder', 'invoicing'), |
|
| 1035 | 1035 | 'size' => 'large' |
| 1036 | 1036 | ), |
| 1037 | 1037 | 'email_overdue_heading' => array( |
| 1038 | 1038 | 'id' => 'email_overdue_heading', |
| 1039 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
| 1040 | - 'desc' => __( 'Enter the the main heading contained within the email notification.', 'invoicing' ), |
|
| 1039 | + 'name' => __('Email Heading', 'invoicing'), |
|
| 1040 | + 'desc' => __('Enter the the main heading contained within the email notification.', 'invoicing'), |
|
| 1041 | 1041 | 'type' => 'text', |
| 1042 | - 'std' => __( 'Payment reminder for your invoice', 'invoicing' ), |
|
| 1042 | + 'std' => __('Payment reminder for your invoice', 'invoicing'), |
|
| 1043 | 1043 | 'size' => 'large' |
| 1044 | 1044 | ), |
| 1045 | 1045 | 'email_overdue_body' => array( |
| 1046 | 1046 | 'id' => 'email_overdue_body', |
| 1047 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
| 1048 | - 'desc' => __( 'The content of the email.', 'invoicing' ), |
|
| 1047 | + 'name' => __('Email Content', 'invoicing'), |
|
| 1048 | + 'desc' => __('The content of the email.', 'invoicing'), |
|
| 1049 | 1049 | 'type' => 'rich_editor', |
| 1050 | - 'std' => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To pay now for this invoice please use the following link: <a href="{invoice_pay_link}">Pay Now</a></p>', 'invoicing' ), |
|
| 1050 | + 'std' => __('<p>Hi {full_name},</p><p>This is just a friendly reminder your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To pay now for this invoice please use the following link: <a href="{invoice_pay_link}">Pay Now</a></p>', 'invoicing'), |
|
| 1051 | 1051 | 'class' => 'large', |
| 1052 | 1052 | 'size' => 10, |
| 1053 | 1053 | ), |
| 1054 | 1054 | ), |
| 1055 | 1055 | ); |
| 1056 | 1056 | |
| 1057 | - return apply_filters( 'wpinv_get_emails', $emails ); |
|
| 1057 | + return apply_filters('wpinv_get_emails', $emails); |
|
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | -function wpinv_settings_emails( $settings = array() ) { |
|
| 1060 | +function wpinv_settings_emails($settings = array()) { |
|
| 1061 | 1061 | $emails = wpinv_get_emails(); |
| 1062 | 1062 | |
| 1063 | - if ( !empty( $emails ) ) { |
|
| 1064 | - foreach ( $emails as $key => $email ) { |
|
| 1063 | + if (!empty($emails)) { |
|
| 1064 | + foreach ($emails as $key => $email) { |
|
| 1065 | 1065 | $settings[$key] = $email; |
| 1066 | 1066 | } |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | - return apply_filters( 'wpinv_settings_get_emails', $settings ); |
|
| 1069 | + return apply_filters('wpinv_settings_get_emails', $settings); |
|
| 1070 | 1070 | } |
| 1071 | -add_filter( 'wpinv_settings_emails', 'wpinv_settings_emails', 10, 1 ); |
|
| 1071 | +add_filter('wpinv_settings_emails', 'wpinv_settings_emails', 10, 1); |
|
| 1072 | 1072 | |
| 1073 | -function wpinv_settings_sections_emails( $settings ) { |
|
| 1073 | +function wpinv_settings_sections_emails($settings) { |
|
| 1074 | 1074 | $emails = wpinv_get_emails(); |
| 1075 | 1075 | |
| 1076 | 1076 | if (!empty($emails)) { |
| 1077 | - foreach ($emails as $key => $email) { |
|
| 1078 | - $settings[$key] = !empty( $email['email_' . $key . '_header']['name'] ) ? strip_tags( $email['email_' . $key . '_header']['name'] ) : $key; |
|
| 1077 | + foreach ($emails as $key => $email) { |
|
| 1078 | + $settings[$key] = !empty($email['email_' . $key . '_header']['name']) ? strip_tags($email['email_' . $key . '_header']['name']) : $key; |
|
| 1079 | 1079 | } |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | return $settings; |
| 1083 | 1083 | } |
| 1084 | -add_filter( 'wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1 ); |
|
| 1084 | +add_filter('wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1); |
|
| 1085 | 1085 | |
| 1086 | -function wpinv_email_is_enabled( $email_type ) { |
|
| 1086 | +function wpinv_email_is_enabled($email_type) { |
|
| 1087 | 1087 | $emails = wpinv_get_emails(); |
| 1088 | - $enabled = isset( $emails[$email_type] ) && wpinv_get_option( $email_type . '_active', 1 ) ? true : false; |
|
| 1088 | + $enabled = isset($emails[$email_type]) && wpinv_get_option($email_type . '_active', 1) ? true : false; |
|
| 1089 | 1089 | |
| 1090 | - return apply_filters( 'wpinv_email_is_enabled', $enabled, $email_type ); |
|
| 1090 | + return apply_filters('wpinv_email_is_enabled', $enabled, $email_type); |
|
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | -function wpinv_email_get_recipient( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 1094 | - switch ( $email_type ) { |
|
| 1093 | +function wpinv_email_get_recipient($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 1094 | + switch ($email_type) { |
|
| 1095 | 1095 | case 'new_invoice': |
| 1096 | 1096 | case 'cancelled_invoice': |
| 1097 | 1097 | case 'failed_invoice': |
| 1098 | 1098 | $recipient = wpinv_get_admin_email(); |
| 1099 | 1099 | break; |
| 1100 | 1100 | default: |
| 1101 | - $invoice = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL ); |
|
| 1102 | - $recipient = !empty( $invoice ) ? $invoice->get_email() : ''; |
|
| 1101 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL); |
|
| 1102 | + $recipient = !empty($invoice) ? $invoice->get_email() : ''; |
|
| 1103 | 1103 | break; |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | - return apply_filters( 'wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice ); |
|
| 1106 | + return apply_filters('wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice); |
|
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | -function wpinv_email_get_subject( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 1110 | - $subject = wpinv_get_option( 'email_' . $email_type . '_subject' ); |
|
| 1109 | +function wpinv_email_get_subject($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 1110 | + $subject = wpinv_get_option('email_' . $email_type . '_subject'); |
|
| 1111 | 1111 | |
| 1112 | - $subject = wpinv_email_format_text( $subject ); |
|
| 1112 | + $subject = wpinv_email_format_text($subject); |
|
| 1113 | 1113 | |
| 1114 | - return apply_filters( 'wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice ); |
|
| 1114 | + return apply_filters('wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice); |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | -function wpinv_email_get_heading( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 1118 | - $email_heading = wpinv_get_option( 'email_' . $email_type . '_heading' ); |
|
| 1117 | +function wpinv_email_get_heading($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 1118 | + $email_heading = wpinv_get_option('email_' . $email_type . '_heading'); |
|
| 1119 | 1119 | |
| 1120 | - $email_heading = wpinv_email_format_text( $email_heading ); |
|
| 1120 | + $email_heading = wpinv_email_format_text($email_heading); |
|
| 1121 | 1121 | |
| 1122 | - return apply_filters( 'wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice ); |
|
| 1122 | + return apply_filters('wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice); |
|
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | -function wpinv_email_get_content( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 1126 | - $content = wpinv_get_option( 'email_' . $email_type . '_body' ); |
|
| 1125 | +function wpinv_email_get_content($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 1126 | + $content = wpinv_get_option('email_' . $email_type . '_body'); |
|
| 1127 | 1127 | |
| 1128 | - $content = wpinv_email_format_text( $content ); |
|
| 1128 | + $content = wpinv_email_format_text($content); |
|
| 1129 | 1129 | |
| 1130 | - return apply_filters( 'wpinv_email_content', $content, $email_type, $invoice_id, $invoice ); |
|
| 1130 | + return apply_filters('wpinv_email_content', $content, $email_type, $invoice_id, $invoice); |
|
| 1131 | 1131 | } |
| 1132 | 1132 | |
| 1133 | -function wpinv_email_get_headers( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 1133 | +function wpinv_email_get_headers($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 1134 | 1134 | $from_name = wpinv_mail_get_from_address(); |
| 1135 | 1135 | $from_email = wpinv_mail_get_from_address(); |
| 1136 | 1136 | |
| 1137 | - $invoice = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL ); |
|
| 1137 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL); |
|
| 1138 | 1138 | |
| 1139 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
| 1140 | - $headers .= "Reply-To: ". $from_email . "\r\n"; |
|
| 1139 | + $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <$from_email>\r\n"; |
|
| 1140 | + $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
| 1141 | 1141 | $headers .= "Content-Type: " . wpinv_mail_get_content_type() . "\r\n"; |
| 1142 | 1142 | |
| 1143 | - return apply_filters( 'wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice ); |
|
| 1143 | + return apply_filters('wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice); |
|
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | -function wpinv_email_get_attachments( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 1146 | +function wpinv_email_get_attachments($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 1147 | 1147 | $attachments = array(); |
| 1148 | 1148 | |
| 1149 | - return apply_filters( 'wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice ); |
|
| 1149 | + return apply_filters('wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | function wpinv_email_global_vars() { |
@@ -1163,73 +1163,73 @@ discard block |
||
| 1163 | 1163 | $replace['sitename'] = $blogname; |
| 1164 | 1164 | $replace['site-title'] = $blogname; |
| 1165 | 1165 | |
| 1166 | - return apply_filters( 'wpinv_email_global_vars', array( $search, $replace ) ); |
|
| 1166 | + return apply_filters('wpinv_email_global_vars', array($search, $replace)); |
|
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | -function wpinv_email_format_text( $content ) { |
|
| 1169 | +function wpinv_email_format_text($content) { |
|
| 1170 | 1170 | global $wpinv_email_search, $wpinv_email_replace; |
| 1171 | 1171 | |
| 1172 | - if ( empty( $wpinv_email_search ) ) { |
|
| 1172 | + if (empty($wpinv_email_search)) { |
|
| 1173 | 1173 | $wpinv_email_search = array(); |
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | - if ( empty( $wpinv_email_replace ) ) { |
|
| 1176 | + if (empty($wpinv_email_replace)) { |
|
| 1177 | 1177 | $wpinv_email_replace = array(); |
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | - $wpinv_email_search = (array)apply_filters( 'wpinv_email_format_text_search', $wpinv_email_search ); |
|
| 1181 | - $wpinv_email_replace = (array)apply_filters( 'wpinv_email_format_text_replace', $wpinv_email_replace ); |
|
| 1180 | + $wpinv_email_search = (array)apply_filters('wpinv_email_format_text_search', $wpinv_email_search); |
|
| 1181 | + $wpinv_email_replace = (array)apply_filters('wpinv_email_format_text_replace', $wpinv_email_replace); |
|
| 1182 | 1182 | |
| 1183 | 1183 | $global_vars = wpinv_email_global_vars(); |
| 1184 | 1184 | |
| 1185 | - $search = array_merge( $global_vars[0], $wpinv_email_search ); |
|
| 1186 | - $replace = array_merge( $global_vars[1], $wpinv_email_replace ); |
|
| 1185 | + $search = array_merge($global_vars[0], $wpinv_email_search); |
|
| 1186 | + $replace = array_merge($global_vars[1], $wpinv_email_replace); |
|
| 1187 | 1187 | |
| 1188 | - if ( empty( $search ) || empty( $replace ) || !is_array( $search ) || !is_array( $replace ) ) { |
|
| 1188 | + if (empty($search) || empty($replace) || !is_array($search) || !is_array($replace)) { |
|
| 1189 | 1189 | return $content; |
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | - return str_replace( $search, $replace, $content ); |
|
| 1192 | + return str_replace($search, $replace, $content); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | -function wpinv_email_style_body( $content ) { |
|
| 1195 | +function wpinv_email_style_body($content) { |
|
| 1196 | 1196 | // make sure we only inline CSS for html emails |
| 1197 | - if ( in_array( wpinv_mail_get_content_type(), array( 'text/html', 'multipart/alternative' ) ) && class_exists( 'DOMDocument' ) ) { |
|
| 1197 | + if (in_array(wpinv_mail_get_content_type(), array('text/html', 'multipart/alternative')) && class_exists('DOMDocument')) { |
|
| 1198 | 1198 | ob_start(); |
| 1199 | - wpinv_get_template( 'emails/wpinv-email-styles.php' ); |
|
| 1200 | - $css = apply_filters( 'wpinv_email_styles', ob_get_clean() ); |
|
| 1199 | + wpinv_get_template('emails/wpinv-email-styles.php'); |
|
| 1200 | + $css = apply_filters('wpinv_email_styles', ob_get_clean()); |
|
| 1201 | 1201 | |
| 1202 | 1202 | // apply CSS styles inline for picky email clients |
| 1203 | 1203 | try { |
| 1204 | - $emogrifier = new Emogrifier( $content, $css ); |
|
| 1204 | + $emogrifier = new Emogrifier($content, $css); |
|
| 1205 | 1205 | $content = $emogrifier->emogrify(); |
| 1206 | - } catch ( Exception $e ) { |
|
| 1207 | - wpinv_error_log( $e->getMessage(), 'emogrifier' ); |
|
| 1206 | + } catch (Exception $e) { |
|
| 1207 | + wpinv_error_log($e->getMessage(), 'emogrifier'); |
|
| 1208 | 1208 | } |
| 1209 | 1209 | } |
| 1210 | 1210 | return $content; |
| 1211 | 1211 | } |
| 1212 | 1212 | |
| 1213 | -function wpinv_email_header( $email_heading = '', $invoice = array(), $email_type = '', $sent_to_admin = false ) { |
|
| 1214 | - wpinv_get_template( 'emails/wpinv-email-header.php', array( 'email_heading' => $email_heading, 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
| 1213 | +function wpinv_email_header($email_heading = '', $invoice = array(), $email_type = '', $sent_to_admin = false) { |
|
| 1214 | + wpinv_get_template('emails/wpinv-email-header.php', array('email_heading' => $email_heading, 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
| 1215 | 1215 | } |
| 1216 | 1216 | |
| 1217 | 1217 | /** |
| 1218 | 1218 | * Get the email footer. |
| 1219 | 1219 | */ |
| 1220 | -function wpinv_email_footer( $invoice = array(), $email_type = '', $sent_to_admin = false ) { |
|
| 1221 | - wpinv_get_template( 'emails/wpinv-email-footer.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
| 1220 | +function wpinv_email_footer($invoice = array(), $email_type = '', $sent_to_admin = false) { |
|
| 1221 | + wpinv_get_template('emails/wpinv-email-footer.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | -function wpinv_email_wrap_message( $message ) { |
|
| 1224 | +function wpinv_email_wrap_message($message) { |
|
| 1225 | 1225 | // Buffer |
| 1226 | 1226 | ob_start(); |
| 1227 | 1227 | |
| 1228 | - do_action( 'wpinv_email_header' ); |
|
| 1228 | + do_action('wpinv_email_header'); |
|
| 1229 | 1229 | |
| 1230 | - echo wpautop( wptexturize( $message ) ); |
|
| 1230 | + echo wpautop(wptexturize($message)); |
|
| 1231 | 1231 | |
| 1232 | - do_action( 'wpinv_email_footer' ); |
|
| 1232 | + do_action('wpinv_email_footer'); |
|
| 1233 | 1233 | |
| 1234 | 1234 | // Get contents |
| 1235 | 1235 | $message = ob_get_clean(); |
@@ -1237,86 +1237,86 @@ discard block |
||
| 1237 | 1237 | return $message; |
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | -function wpinv_email_invoice_details( $invoice, $email_type = '', $sent_to_admin = false ) { |
|
| 1241 | - wpinv_get_template( 'emails/wpinv-email-invoice-details.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
| 1240 | +function wpinv_email_invoice_details($invoice, $email_type = '', $sent_to_admin = false) { |
|
| 1241 | + wpinv_get_template('emails/wpinv-email-invoice-details.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | -function wpinv_email_invoice_items( $invoice, $email_type = '', $sent_to_admin = false ) { |
|
| 1245 | - wpinv_get_template( 'emails/wpinv-email-invoice-items.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
| 1244 | +function wpinv_email_invoice_items($invoice, $email_type = '', $sent_to_admin = false) { |
|
| 1245 | + wpinv_get_template('emails/wpinv-email-invoice-items.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | -function wpinv_email_billing_details( $invoice, $email_type = '', $sent_to_admin = false ) { |
|
| 1249 | - wpinv_get_template( 'emails/wpinv-email-billing-details.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
| 1248 | +function wpinv_email_billing_details($invoice, $email_type = '', $sent_to_admin = false) { |
|
| 1249 | + wpinv_get_template('emails/wpinv-email-billing-details.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | -function wpinv_send_customer_invoice( $data = array() ) { |
|
| 1253 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
| 1252 | +function wpinv_send_customer_invoice($data = array()) { |
|
| 1253 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
| 1254 | 1254 | |
| 1255 | - if ( empty( $invoice_id ) ) { |
|
| 1255 | + if (empty($invoice_id)) { |
|
| 1256 | 1256 | return; |
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | - if ( !current_user_can( 'manage_options' ) ) { |
|
| 1260 | - wp_die( __( 'You do not have permission to send invoice notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
| 1259 | + if (!current_user_can('manage_options')) { |
|
| 1260 | + wp_die(__('You do not have permission to send invoice notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
| 1261 | 1261 | } |
| 1262 | 1262 | |
| 1263 | - $sent = wpinv_user_invoice_notification( $invoice_id ); |
|
| 1263 | + $sent = wpinv_user_invoice_notification($invoice_id); |
|
| 1264 | 1264 | |
| 1265 | 1265 | $status = $sent ? 'email_sent' : 'email_fail'; |
| 1266 | 1266 | |
| 1267 | - $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
|
| 1268 | - wp_redirect( $redirect ); |
|
| 1267 | + $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false)); |
|
| 1268 | + wp_redirect($redirect); |
|
| 1269 | 1269 | exit; |
| 1270 | 1270 | } |
| 1271 | -add_action( 'wpinv_send_invoice', 'wpinv_send_customer_invoice' ); |
|
| 1271 | +add_action('wpinv_send_invoice', 'wpinv_send_customer_invoice'); |
|
| 1272 | 1272 | |
| 1273 | -function wpinv_send_overdue_reminder( $data = array() ) { |
|
| 1274 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
| 1273 | +function wpinv_send_overdue_reminder($data = array()) { |
|
| 1274 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
| 1275 | 1275 | |
| 1276 | - if ( empty( $invoice_id ) ) { |
|
| 1276 | + if (empty($invoice_id)) { |
|
| 1277 | 1277 | return; |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | - if ( !current_user_can( 'manage_options' ) ) { |
|
| 1281 | - wp_die( __( 'You do not have permission to send reminder notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
| 1280 | + if (!current_user_can('manage_options')) { |
|
| 1281 | + wp_die(__('You do not have permission to send reminder notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | - $sent = wpinv_send_payment_reminder_notification( $invoice_id ); |
|
| 1284 | + $sent = wpinv_send_payment_reminder_notification($invoice_id); |
|
| 1285 | 1285 | |
| 1286 | 1286 | $status = $sent ? 'email_sent' : 'email_fail'; |
| 1287 | 1287 | |
| 1288 | - $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
|
| 1289 | - wp_redirect( $redirect ); |
|
| 1288 | + $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false)); |
|
| 1289 | + wp_redirect($redirect); |
|
| 1290 | 1290 | exit; |
| 1291 | 1291 | } |
| 1292 | -add_action( 'wpinv_send_reminder', 'wpinv_send_overdue_reminder' ); |
|
| 1292 | +add_action('wpinv_send_reminder', 'wpinv_send_overdue_reminder'); |
|
| 1293 | 1293 | |
| 1294 | -function wpinv_send_customer_note_email( $data ) { |
|
| 1295 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
| 1294 | +function wpinv_send_customer_note_email($data) { |
|
| 1295 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
| 1296 | 1296 | |
| 1297 | - if ( empty( $invoice_id ) ) { |
|
| 1297 | + if (empty($invoice_id)) { |
|
| 1298 | 1298 | return; |
| 1299 | 1299 | } |
| 1300 | 1300 | |
| 1301 | - $sent = wpinv_user_note_notification( $invoice_id, $data ); |
|
| 1301 | + $sent = wpinv_user_note_notification($invoice_id, $data); |
|
| 1302 | 1302 | } |
| 1303 | -add_action( 'wpinv_new_customer_note', 'wpinv_send_customer_note_email', 10, 1 ); |
|
| 1303 | +add_action('wpinv_new_customer_note', 'wpinv_send_customer_note_email', 10, 1); |
|
| 1304 | 1304 | |
| 1305 | -function wpinv_add_notes_to_invoice_email( $invoice, $email_type, $sent_to_admin ) { |
|
| 1306 | - if ( !empty( $invoice ) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes( $invoice->ID, true ) ) { |
|
| 1307 | - $date_format = get_option( 'date_format' ); |
|
| 1308 | - $time_format = get_option( 'time_format' ); |
|
| 1305 | +function wpinv_add_notes_to_invoice_email($invoice, $email_type, $sent_to_admin) { |
|
| 1306 | + if (!empty($invoice) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes($invoice->ID, true)) { |
|
| 1307 | + $date_format = get_option('date_format'); |
|
| 1308 | + $time_format = get_option('time_format'); |
|
| 1309 | 1309 | ?> |
| 1310 | 1310 | <div id="wpinv-email-notes"> |
| 1311 | - <h3 class="wpinv-notes-t"><?php echo apply_filters( 'wpinv_email_invoice_notes_title', __( 'Invoice Notes', 'invoicing' ) ); ?></h3> |
|
| 1311 | + <h3 class="wpinv-notes-t"><?php echo apply_filters('wpinv_email_invoice_notes_title', __('Invoice Notes', 'invoicing')); ?></h3> |
|
| 1312 | 1312 | <ol class="wpinv-notes-lists"> |
| 1313 | 1313 | <?php |
| 1314 | - foreach ( $invoice_notes as $note ) { |
|
| 1315 | - $note_time = strtotime( $note->comment_date ); |
|
| 1314 | + foreach ($invoice_notes as $note) { |
|
| 1315 | + $note_time = strtotime($note->comment_date); |
|
| 1316 | 1316 | ?> |
| 1317 | 1317 | <li class="comment wpinv-note"> |
| 1318 | - <p class="wpinv-note-date meta"><?php printf( __( '%2$s at %3$s', 'invoicing' ), $note->comment_author, date_i18n( $date_format, $note_time ), date_i18n( $time_format, $note_time ), $note_time ); ?></p> |
|
| 1319 | - <div class="wpinv-note-desc description"><?php echo wpautop( wptexturize( $note->comment_content ) ); ?></div> |
|
| 1318 | + <p class="wpinv-note-date meta"><?php printf(__('%2$s at %3$s', 'invoicing'), $note->comment_author, date_i18n($date_format, $note_time), date_i18n($time_format, $note_time), $note_time); ?></p> |
|
| 1319 | + <div class="wpinv-note-desc description"><?php echo wpautop(wptexturize($note->comment_content)); ?></div> |
|
| 1320 | 1320 | </li> |
| 1321 | 1321 | <?php |
| 1322 | 1322 | } |
@@ -1325,21 +1325,21 @@ discard block |
||
| 1325 | 1325 | <?php |
| 1326 | 1326 | } |
| 1327 | 1327 | } |
| 1328 | -add_action( 'wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3 ); |
|
| 1328 | +add_action('wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3); |
|
| 1329 | 1329 | |
| 1330 | 1330 | function wpinv_email_payment_reminders() { |
| 1331 | 1331 | global $wpi_auto_reminder; |
| 1332 | - if ( !wpinv_get_option( 'email_overdue_active' ) ) { |
|
| 1332 | + if (!wpinv_get_option('email_overdue_active')) { |
|
| 1333 | 1333 | return; |
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | - if ( $reminder_days = wpinv_get_option( 'email_due_reminder_days' ) ) { |
|
| 1337 | - $reminder_days = is_array( $reminder_days ) ? array_values( $reminder_days ) : ''; |
|
| 1336 | + if ($reminder_days = wpinv_get_option('email_due_reminder_days')) { |
|
| 1337 | + $reminder_days = is_array($reminder_days) ? array_values($reminder_days) : ''; |
|
| 1338 | 1338 | |
| 1339 | - if ( empty( $reminder_days ) ) { |
|
| 1339 | + if (empty($reminder_days)) { |
|
| 1340 | 1340 | return; |
| 1341 | 1341 | } |
| 1342 | - $reminder_days = array_unique( array_map( 'absint', $reminder_days ) ); |
|
| 1342 | + $reminder_days = array_unique(array_map('absint', $reminder_days)); |
|
| 1343 | 1343 | |
| 1344 | 1344 | $args = array( |
| 1345 | 1345 | 'post_type' => 'wpi_invoice', |
@@ -1349,7 +1349,7 @@ discard block |
||
| 1349 | 1349 | 'meta_query' => array( |
| 1350 | 1350 | array( |
| 1351 | 1351 | 'key' => '_wpinv_due_date', |
| 1352 | - 'value' => array( '', 'none' ), |
|
| 1352 | + 'value' => array('', 'none'), |
|
| 1353 | 1353 | 'compare' => 'NOT IN', |
| 1354 | 1354 | ) |
| 1355 | 1355 | ), |
@@ -1358,64 +1358,64 @@ discard block |
||
| 1358 | 1358 | 'order' => 'ASC', |
| 1359 | 1359 | ); |
| 1360 | 1360 | |
| 1361 | - $invoices = get_posts( $args ); |
|
| 1361 | + $invoices = get_posts($args); |
|
| 1362 | 1362 | |
| 1363 | - if ( empty( $invoices ) ) { |
|
| 1363 | + if (empty($invoices)) { |
|
| 1364 | 1364 | return; |
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | - $date_to_send = array(); |
|
| 1367 | + $date_to_send = array(); |
|
| 1368 | 1368 | |
| 1369 | - foreach ( $invoices as $id ) { |
|
| 1370 | - $due_date = get_post_meta( $id, '_wpinv_due_date', true ); |
|
| 1369 | + foreach ($invoices as $id) { |
|
| 1370 | + $due_date = get_post_meta($id, '_wpinv_due_date', true); |
|
| 1371 | 1371 | |
| 1372 | - foreach ( $reminder_days as $key => $days ) { |
|
| 1373 | - if ( $days !== '' ) { |
|
| 1374 | - $date_to_send[$id][] = date_i18n( 'Y-m-d', strtotime( $due_date ) + ( $days * DAY_IN_SECONDS ) ); |
|
| 1372 | + foreach ($reminder_days as $key => $days) { |
|
| 1373 | + if ($days !== '') { |
|
| 1374 | + $date_to_send[$id][] = date_i18n('Y-m-d', strtotime($due_date) + ($days * DAY_IN_SECONDS)); |
|
| 1375 | 1375 | } |
| 1376 | 1376 | } |
| 1377 | 1377 | } |
| 1378 | 1378 | |
| 1379 | - $today = date_i18n( 'Y-m-d' ); |
|
| 1379 | + $today = date_i18n('Y-m-d'); |
|
| 1380 | 1380 | $wpi_auto_reminder = true; |
| 1381 | 1381 | |
| 1382 | - foreach ( $date_to_send as $id => $values ) { |
|
| 1383 | - if ( in_array( $today, $values ) ) { |
|
| 1384 | - $sent = get_post_meta( $id, '_wpinv_reminder_sent', true ); |
|
| 1382 | + foreach ($date_to_send as $id => $values) { |
|
| 1383 | + if (in_array($today, $values)) { |
|
| 1384 | + $sent = get_post_meta($id, '_wpinv_reminder_sent', true); |
|
| 1385 | 1385 | |
| 1386 | - if ( isset( $sent ) && !empty( $sent ) ) { |
|
| 1387 | - if ( !in_array( $today, $sent ) ) { |
|
| 1388 | - do_action( 'wpinv_send_payment_reminder_notification', $id ); |
|
| 1386 | + if (isset($sent) && !empty($sent)) { |
|
| 1387 | + if (!in_array($today, $sent)) { |
|
| 1388 | + do_action('wpinv_send_payment_reminder_notification', $id); |
|
| 1389 | 1389 | } |
| 1390 | 1390 | } else { |
| 1391 | - do_action( 'wpinv_send_payment_reminder_notification', $id ); |
|
| 1391 | + do_action('wpinv_send_payment_reminder_notification', $id); |
|
| 1392 | 1392 | } |
| 1393 | 1393 | } |
| 1394 | 1394 | } |
| 1395 | 1395 | |
| 1396 | - $wpi_auto_reminder = false; |
|
| 1396 | + $wpi_auto_reminder = false; |
|
| 1397 | 1397 | } |
| 1398 | 1398 | } |
| 1399 | 1399 | |
| 1400 | -function wpinv_send_payment_reminder_notification( $invoice_id ) { |
|
| 1400 | +function wpinv_send_payment_reminder_notification($invoice_id) { |
|
| 1401 | 1401 | global $wpinv_email_search, $wpinv_email_replace; |
| 1402 | 1402 | |
| 1403 | 1403 | $email_type = 'overdue'; |
| 1404 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
| 1404 | + if (!wpinv_email_is_enabled($email_type)) { |
|
| 1405 | 1405 | return false; |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 1409 | - if ( empty( $invoice ) ) { |
|
| 1408 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 1409 | + if (empty($invoice)) { |
|
| 1410 | 1410 | return false; |
| 1411 | 1411 | } |
| 1412 | 1412 | |
| 1413 | - if ( !$invoice->needs_payment() ) { |
|
| 1413 | + if (!$invoice->needs_payment()) { |
|
| 1414 | 1414 | return false; |
| 1415 | 1415 | } |
| 1416 | 1416 | |
| 1417 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
| 1418 | - if ( !is_email( $recipient ) ) { |
|
| 1417 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
| 1418 | + if (!is_email($recipient)) { |
|
| 1419 | 1419 | return false; |
| 1420 | 1420 | } |
| 1421 | 1421 | |
@@ -1431,60 +1431,60 @@ discard block |
||
| 1431 | 1431 | $replace = array(); |
| 1432 | 1432 | $replace['full_name'] = $invoice->get_user_full_name(); |
| 1433 | 1433 | $replace['invoice_number'] = $invoice->get_number(); |
| 1434 | - $replace['invoice_due_date']= $invoice->get_due_date( true ); |
|
| 1435 | - $replace['invoice_total'] = $invoice->get_total( true ); |
|
| 1436 | - $replace['invoice_link'] = $invoice->get_view_url( true ); |
|
| 1437 | - $replace['invoice_pay_link']= $invoice->get_checkout_payment_url( false, true ); |
|
| 1438 | - $replace['is_was'] = strtotime( $invoice->get_due_date() ) < strtotime( date_i18n( 'Y-m-d' ) ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ); |
|
| 1434 | + $replace['invoice_due_date'] = $invoice->get_due_date(true); |
|
| 1435 | + $replace['invoice_total'] = $invoice->get_total(true); |
|
| 1436 | + $replace['invoice_link'] = $invoice->get_view_url(true); |
|
| 1437 | + $replace['invoice_pay_link'] = $invoice->get_checkout_payment_url(false, true); |
|
| 1438 | + $replace['is_was'] = strtotime($invoice->get_due_date()) < strtotime(date_i18n('Y-m-d')) ? __('was', 'invoicing') : __('is', 'invoicing'); |
|
| 1439 | 1439 | |
| 1440 | 1440 | $wpinv_email_search = $search; |
| 1441 | 1441 | $wpinv_email_replace = $replace; |
| 1442 | 1442 | |
| 1443 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
| 1444 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
| 1445 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
| 1446 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
| 1443 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
| 1444 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
| 1445 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
| 1446 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
| 1447 | 1447 | |
| 1448 | - $message_body = wpinv_email_get_content( $email_type, $invoice_id, $invoice ); |
|
| 1448 | + $message_body = wpinv_email_get_content($email_type, $invoice_id, $invoice); |
|
| 1449 | 1449 | |
| 1450 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
| 1450 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
| 1451 | 1451 | 'invoice' => $invoice, |
| 1452 | 1452 | 'email_type' => $email_type, |
| 1453 | 1453 | 'email_heading' => $email_heading, |
| 1454 | 1454 | 'sent_to_admin' => false, |
| 1455 | 1455 | 'plain_text' => false, |
| 1456 | 1456 | 'message_body' => $message_body |
| 1457 | - ) ); |
|
| 1457 | + )); |
|
| 1458 | 1458 | |
| 1459 | - $content = wpinv_email_format_text( $content ); |
|
| 1459 | + $content = wpinv_email_format_text($content); |
|
| 1460 | 1460 | |
| 1461 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
| 1462 | - if ( $sent ) { |
|
| 1463 | - do_action( 'wpinv_payment_reminder_sent', $invoice_id, $invoice ); |
|
| 1461 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
| 1462 | + if ($sent) { |
|
| 1463 | + do_action('wpinv_payment_reminder_sent', $invoice_id, $invoice); |
|
| 1464 | 1464 | } |
| 1465 | 1465 | |
| 1466 | 1466 | return $sent; |
| 1467 | 1467 | } |
| 1468 | -add_action( 'wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1 ); |
|
| 1468 | +add_action('wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1); |
|
| 1469 | 1469 | |
| 1470 | -function wpinv_payment_reminder_sent( $invoice_id, $invoice ) { |
|
| 1470 | +function wpinv_payment_reminder_sent($invoice_id, $invoice) { |
|
| 1471 | 1471 | global $wpi_auto_reminder; |
| 1472 | 1472 | |
| 1473 | - $sent = get_post_meta( $invoice_id, '_wpinv_reminder_sent', true ); |
|
| 1473 | + $sent = get_post_meta($invoice_id, '_wpinv_reminder_sent', true); |
|
| 1474 | 1474 | |
| 1475 | - if ( empty( $sent ) ) { |
|
| 1475 | + if (empty($sent)) { |
|
| 1476 | 1476 | $sent = array(); |
| 1477 | 1477 | } |
| 1478 | - $sent[] = date_i18n( 'Y-m-d' ); |
|
| 1478 | + $sent[] = date_i18n('Y-m-d'); |
|
| 1479 | 1479 | |
| 1480 | - update_post_meta( $invoice_id, '_wpinv_reminder_sent', $sent ); |
|
| 1480 | + update_post_meta($invoice_id, '_wpinv_reminder_sent', $sent); |
|
| 1481 | 1481 | |
| 1482 | - if ( $wpi_auto_reminder ) { // Auto reminder note. |
|
| 1483 | - $note = __( 'Manual reminder sent to the user.', 'invoicing' ); |
|
| 1484 | - $invoice->add_note( $note, false, false, true ); |
|
| 1482 | + if ($wpi_auto_reminder) { // Auto reminder note. |
|
| 1483 | + $note = __('Manual reminder sent to the user.', 'invoicing'); |
|
| 1484 | + $invoice->add_note($note, false, false, true); |
|
| 1485 | 1485 | } else { // Menual reminder note. |
| 1486 | - $note = __( 'Manual reminder sent to the user.', 'invoicing' ); |
|
| 1487 | - $invoice->add_note( $note ); |
|
| 1486 | + $note = __('Manual reminder sent to the user.', 'invoicing'); |
|
| 1487 | + $invoice->add_note($note); |
|
| 1488 | 1488 | } |
| 1489 | 1489 | } |
| 1490 | -add_action( 'wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2 ); |
|
| 1491 | 1490 | \ No newline at end of file |
| 1491 | +add_action('wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2); |
|
| 1492 | 1492 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly. |
| 3 | -if (!defined( 'ABSPATH' ) ) exit; |
|
| 3 | +if (!defined('ABSPATH')) exit; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * WPInv_Session Class. |
@@ -46,44 +46,44 @@ discard block |
||
| 46 | 46 | public function __construct() { |
| 47 | 47 | $this->use_php_sessions = $this->use_php_sessions(); |
| 48 | 48 | |
| 49 | - if ( $this->use_php_sessions ) { |
|
| 50 | - if ( is_multisite() ) { |
|
| 49 | + if ($this->use_php_sessions) { |
|
| 50 | + if (is_multisite()) { |
|
| 51 | 51 | $this->prefix = '_' . get_current_blog_id(); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // Use PHP SESSION (must be enabled via the WPINV_USE_PHP_SESSIONS constant) |
| 55 | - add_action( 'init', array( $this, 'maybe_start_session' ), -2 ); |
|
| 55 | + add_action('init', array($this, 'maybe_start_session'), -2); |
|
| 56 | 56 | } else { |
| 57 | 57 | // Use WP_Session (default) |
| 58 | - if ( !defined( 'WP_SESSION_COOKIE' ) ) { |
|
| 59 | - define( 'WP_SESSION_COOKIE', 'wpinv_wp_session' ); |
|
| 58 | + if (!defined('WP_SESSION_COOKIE')) { |
|
| 59 | + define('WP_SESSION_COOKIE', 'wpinv_wp_session'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ( !class_exists( 'Recursive_ArrayAccess' ) ) { |
|
| 62 | + if (!class_exists('Recursive_ArrayAccess')) { |
|
| 63 | 63 | require_once WPINV_PLUGIN_DIR . 'includes/libraries/wp-session/class-recursive-arrayaccess.php'; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if ( !class_exists( 'WP_Session_Utils' ) ) { |
|
| 66 | + if (!class_exists('WP_Session_Utils')) { |
|
| 67 | 67 | require_once WPINV_PLUGIN_DIR . 'includes/libraries/wp-session/class-wp-session-utils.php'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if ( defined( 'WP_CLI' ) && WP_CLI && !class_exists( 'WP_Session_Command' ) ) { |
|
| 70 | + if (defined('WP_CLI') && WP_CLI && !class_exists('WP_Session_Command')) { |
|
| 71 | 71 | require_once WPINV_PLUGIN_DIR . 'includes/libraries/wp-session/wp-cli.php'; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ( !class_exists( 'WP_Session' ) ) { |
|
| 74 | + if (!class_exists('WP_Session')) { |
|
| 75 | 75 | require_once WPINV_PLUGIN_DIR . 'includes/libraries/wp-session/class-wp-session.php'; |
| 76 | 76 | require_once WPINV_PLUGIN_DIR . 'includes/libraries/wp-session/wp-session.php'; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 ); |
|
| 80 | - add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 ); |
|
| 79 | + add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999); |
|
| 80 | + add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if ( empty( $this->session ) && ! $this->use_php_sessions ) { |
|
| 84 | - add_action( 'plugins_loaded', array( $this, 'init' ), -1 ); |
|
| 83 | + if (empty($this->session) && !$this->use_php_sessions) { |
|
| 84 | + add_action('plugins_loaded', array($this, 'init'), -1); |
|
| 85 | 85 | } else { |
| 86 | - add_action( 'init', array( $this, 'init' ), -1 ); |
|
| 86 | + add_action('init', array($this, 'init'), -1); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | * @return void |
| 96 | 96 | */ |
| 97 | 97 | public function init() { |
| 98 | - if ( $this->use_php_sessions ) { |
|
| 99 | - $this->session = isset( $_SESSION['wpi' . $this->prefix ] ) && is_array( $_SESSION['wpi' . $this->prefix ] ) ? $_SESSION['wpi' . $this->prefix ] : array(); |
|
| 98 | + if ($this->use_php_sessions) { |
|
| 99 | + $this->session = isset($_SESSION['wpi' . $this->prefix]) && is_array($_SESSION['wpi' . $this->prefix]) ? $_SESSION['wpi' . $this->prefix] : array(); |
|
| 100 | 100 | } else { |
| 101 | 101 | $this->session = WP_Session::get_instance(); |
| 102 | 102 | } |
@@ -112,10 +112,10 @@ discard block |
||
| 112 | 112 | * @return string Session ID |
| 113 | 113 | */ |
| 114 | 114 | public function get_id() { |
| 115 | - if ( $this->use_php_sessions ) { |
|
| 116 | - $session_id = !empty( $_SESSION ) && function_exists( 'session_id' ) ? session_id() : NULL; |
|
| 115 | + if ($this->use_php_sessions) { |
|
| 116 | + $session_id = !empty($_SESSION) && function_exists('session_id') ? session_id() : NULL; |
|
| 117 | 117 | } else { |
| 118 | - $session_id = !empty( $this->session ) && isset( $this->session->session_id ) ? $this->session->session_id : NULL; |
|
| 118 | + $session_id = !empty($this->session) && isset($this->session->session_id) ? $this->session->session_id : NULL; |
|
| 119 | 119 | } |
| 120 | 120 | return $session_id; |
| 121 | 121 | } |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | * @param string $key Session key |
| 129 | 129 | * @return string Session variable |
| 130 | 130 | */ |
| 131 | - public function get( $key ) { |
|
| 132 | - $key = sanitize_key( $key ); |
|
| 133 | - return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false; |
|
| 131 | + public function get($key) { |
|
| 132 | + $key = sanitize_key($key); |
|
| 133 | + return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -142,20 +142,20 @@ discard block |
||
| 142 | 142 | * @param integer $value Session variable |
| 143 | 143 | * @return string Session variable |
| 144 | 144 | */ |
| 145 | - public function set( $key, $value ) { |
|
| 146 | - $key = sanitize_key( $key ); |
|
| 145 | + public function set($key, $value) { |
|
| 146 | + $key = sanitize_key($key); |
|
| 147 | 147 | |
| 148 | - if ( is_array( $value ) ) { |
|
| 149 | - $this->session[ $key ] = maybe_serialize( $value ); |
|
| 148 | + if (is_array($value)) { |
|
| 149 | + $this->session[$key] = maybe_serialize($value); |
|
| 150 | 150 | } else { |
| 151 | - $this->session[ $key ] = $value; |
|
| 151 | + $this->session[$key] = $value; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if ( $this->use_php_sessions ) { |
|
| 155 | - $_SESSION['wpi' . $this->prefix ] = $this->session; |
|
| 154 | + if ($this->use_php_sessions) { |
|
| 155 | + $_SESSION['wpi' . $this->prefix] = $this->session; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - return $this->session[ $key ]; |
|
| 158 | + return $this->session[$key]; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -167,29 +167,29 @@ discard block |
||
| 167 | 167 | * @param integer $value Session variable. |
| 168 | 168 | * @return string Session variable. |
| 169 | 169 | */ |
| 170 | - public function un_set( $key ) { |
|
| 171 | - if ( empty( $key ) ) { |
|
| 170 | + public function un_set($key) { |
|
| 171 | + if (empty($key)) { |
|
| 172 | 172 | return false; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if ( is_array( $key ) ) { |
|
| 175 | + if (is_array($key)) { |
|
| 176 | 176 | foreach ($key as $index) { |
| 177 | - $index = sanitize_key( $index ); |
|
| 177 | + $index = sanitize_key($index); |
|
| 178 | 178 | |
| 179 | - if ( $index && isset( $this->session[ $index ] ) ) { |
|
| 180 | - unset( $this->session[ $index ] ); |
|
| 179 | + if ($index && isset($this->session[$index])) { |
|
| 180 | + unset($this->session[$index]); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | } else { |
| 184 | - $key = sanitize_key( $key ); |
|
| 184 | + $key = sanitize_key($key); |
|
| 185 | 185 | |
| 186 | - if ( isset( $this->session[ $key ] ) ) { |
|
| 187 | - unset( $this->session[ $key ] ); |
|
| 186 | + if (isset($this->session[$key])) { |
|
| 187 | + unset($this->session[$key]); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if ( $this->use_php_sessions ) { |
|
| 192 | - $_SESSION['wpi' . $this->prefix ] = $this->session; |
|
| 191 | + if ($this->use_php_sessions) { |
|
| 192 | + $_SESSION['wpi' . $this->prefix] = $this->session; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | return true; |
@@ -204,14 +204,14 @@ discard block |
||
| 204 | 204 | * @param integer $value Session variable. |
| 205 | 205 | * @return string Session variable. |
| 206 | 206 | */ |
| 207 | - public function is_set( $key ) { |
|
| 208 | - $key = sanitize_key( $key ); |
|
| 207 | + public function is_set($key) { |
|
| 208 | + $key = sanitize_key($key); |
|
| 209 | 209 | |
| 210 | - if ( empty( $key ) ) { |
|
| 210 | + if (empty($key)) { |
|
| 211 | 211 | return false; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - if ( isset( $this->session[ $key ] ) ) { |
|
| 214 | + if (isset($this->session[$key])) { |
|
| 215 | 215 | return true; |
| 216 | 216 | } |
| 217 | 217 | |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | * @param int $exp Default expiration (1 hour) |
| 227 | 227 | * @return int |
| 228 | 228 | */ |
| 229 | - public function set_expiration_variant_time( $exp ) { |
|
| 230 | - return ( 30 * 60 * 23 ); |
|
| 229 | + public function set_expiration_variant_time($exp) { |
|
| 230 | + return (30 * 60 * 23); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | * @param int $exp Default expiration (1 hour) |
| 239 | 239 | * @return int |
| 240 | 240 | */ |
| 241 | - public function set_expiration_time( $exp ) { |
|
| 242 | - return ( 30 * 60 * 24 ); |
|
| 241 | + public function set_expiration_time($exp) { |
|
| 242 | + return (30 * 60 * 24); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -257,18 +257,18 @@ discard block |
||
| 257 | 257 | $ret = false; |
| 258 | 258 | |
| 259 | 259 | // If the database variable is already set, no need to run autodetection |
| 260 | - $wpinv_use_php_sessions = (bool)get_option( 'wpinv_use_php_sessions' ); |
|
| 260 | + $wpinv_use_php_sessions = (bool)get_option('wpinv_use_php_sessions'); |
|
| 261 | 261 | |
| 262 | - if (!$wpinv_use_php_sessions ) { |
|
| 262 | + if (!$wpinv_use_php_sessions) { |
|
| 263 | 263 | // Attempt to detect if the server supports PHP sessions |
| 264 | - if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 265 | - $this->set( 'wpinv_use_php_sessions', 1 ); |
|
| 264 | + if (function_exists('session_start') && !ini_get('safe_mode')) { |
|
| 265 | + $this->set('wpinv_use_php_sessions', 1); |
|
| 266 | 266 | |
| 267 | - if ( $this->get( 'wpinv_use_php_sessions' ) ) { |
|
| 267 | + if ($this->get('wpinv_use_php_sessions')) { |
|
| 268 | 268 | $ret = true; |
| 269 | 269 | |
| 270 | 270 | // Set the database option |
| 271 | - update_option( 'wpinv_use_php_sessions', true ); |
|
| 271 | + update_option('wpinv_use_php_sessions', true); |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | } else { |
@@ -276,20 +276,20 @@ discard block |
||
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | // Enable or disable PHP Sessions based on the WPINV_USE_PHP_SESSIONS constant |
| 279 | - if ( defined( 'WPINV_USE_PHP_SESSIONS' ) && WPINV_USE_PHP_SESSIONS ) { |
|
| 279 | + if (defined('WPINV_USE_PHP_SESSIONS') && WPINV_USE_PHP_SESSIONS) { |
|
| 280 | 280 | $ret = true; |
| 281 | - } else if ( defined( 'WPINV_USE_PHP_SESSIONS' ) && ! WPINV_USE_PHP_SESSIONS ) { |
|
| 281 | + } else if (defined('WPINV_USE_PHP_SESSIONS') && !WPINV_USE_PHP_SESSIONS) { |
|
| 282 | 282 | $ret = false; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - return (bool) apply_filters( 'wpinv_use_php_sessions', $ret ); |
|
| 285 | + return (bool)apply_filters('wpinv_use_php_sessions', $ret); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
| 289 | 289 | * Starts a new session if one hasn't started yet. |
| 290 | 290 | */ |
| 291 | 291 | public function maybe_start_session() { |
| 292 | - if ( !session_id() && !headers_sent() ) { |
|
| 292 | + if (!session_id() && !headers_sent()) { |
|
| 293 | 293 | session_start(); |
| 294 | 294 | } |
| 295 | 295 | } |