@@ -6,7 +6,7 @@ |
||
6 | 6 | * @package Invoicing/data |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | return array( |
12 | 12 |
@@ -37,25 +37,25 @@ |
||
37 | 37 | public function get_privacy_message() { |
38 | 38 | |
39 | 39 | $content = '<div class="wp-suggested-text">' . |
40 | - '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' . |
|
41 | - '<p class="privacy-policy-tutorial">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' . |
|
42 | - '<p>' . __( 'We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing' ) . '</p>' . |
|
43 | - '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' . |
|
44 | - '<ul>' . |
|
45 | - '<li>' . __( '- Send you important account/invoice/service information.', 'invoicing' ) . '</li>' . |
|
46 | - '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' . |
|
47 | - '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' . |
|
48 | - '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
49 | - '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' . |
|
50 | - '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
51 | - '</ul>' . |
|
52 | - '<p>' . __( 'In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing' ) . '</p>' . |
|
53 | - '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' . |
|
54 | - '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' . |
|
55 | - '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing' ) . '</p>' . |
|
56 | - '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing' ) . '</p>' . |
|
57 | - '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing' ) . '</p>' . |
|
58 | - '</div>'; |
|
40 | + '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' . |
|
41 | + '<p class="privacy-policy-tutorial">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' . |
|
42 | + '<p>' . __( 'We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing' ) . '</p>' . |
|
43 | + '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' . |
|
44 | + '<ul>' . |
|
45 | + '<li>' . __( '- Send you important account/invoice/service information.', 'invoicing' ) . '</li>' . |
|
46 | + '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' . |
|
47 | + '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' . |
|
48 | + '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
49 | + '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' . |
|
50 | + '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
51 | + '</ul>' . |
|
52 | + '<p>' . __( 'In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing' ) . '</p>' . |
|
53 | + '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' . |
|
54 | + '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' . |
|
55 | + '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing' ) . '</p>' . |
|
56 | + '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing' ) . '</p>' . |
|
57 | + '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing' ) . '</p>' . |
|
58 | + '</div>'; |
|
59 | 59 | |
60 | 60 | return apply_filters( 'wpinv_privacy_policy_content', $content ); |
61 | 61 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Privacy/GDPR related functionality which ties into WordPress functionality. |
4 | 4 | */ |
5 | 5 | |
6 | -defined( 'ABSPATH' ) || exit; |
|
6 | +defined('ABSPATH') || exit; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * WPInv_Privacy Class. |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $this->init(); |
27 | 27 | |
28 | 28 | // This hook registers Invoicing data exporters. |
29 | - $this->add_exporter( 'wpinv-customer-invoices', __( 'Customer Invoices', 'invoicing' ), array( 'WPInv_Privacy_Exporters', 'customer_invoice_data_exporter' ) ); |
|
29 | + $this->add_exporter('wpinv-customer-invoices', __('Customer Invoices', 'invoicing'), array('WPInv_Privacy_Exporters', 'customer_invoice_data_exporter')); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -37,27 +37,27 @@ discard block |
||
37 | 37 | public function get_privacy_message() { |
38 | 38 | |
39 | 39 | $content = '<div class="wp-suggested-text">' . |
40 | - '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' . |
|
41 | - '<p class="privacy-policy-tutorial">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' . |
|
42 | - '<p>' . __( 'We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing' ) . '</p>' . |
|
43 | - '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' . |
|
40 | + '<h2>' . __('Invoices and checkout', 'invoicing') . '</h2>' . |
|
41 | + '<p class="privacy-policy-tutorial">' . __('Example privacy texts.', 'invoicing') . '</p>' . |
|
42 | + '<p>' . __('We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing') . '</p>' . |
|
43 | + '<p>' . __('Handling this data also allows us to:', 'invoicing') . '</p>' . |
|
44 | 44 | '<ul>' . |
45 | - '<li>' . __( '- Send you important account/invoice/service information.', 'invoicing' ) . '</li>' . |
|
46 | - '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' . |
|
47 | - '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' . |
|
48 | - '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
49 | - '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' . |
|
50 | - '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
45 | + '<li>' . __('- Send you important account/invoice/service information.', 'invoicing') . '</li>' . |
|
46 | + '<li>' . __('- Estimate taxes based on your location.', 'invoicing') . '</li>' . |
|
47 | + '<li>' . __('- Respond to your queries or complaints.', 'invoicing') . '</li>' . |
|
48 | + '<li>' . __('- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing') . '</li>' . |
|
49 | + '<li>' . __('- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing') . '</li>' . |
|
50 | + '<li>' . __('- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing') . '</li>' . |
|
51 | 51 | '</ul>' . |
52 | - '<p>' . __( 'In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing' ) . '</p>' . |
|
53 | - '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' . |
|
54 | - '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' . |
|
55 | - '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing' ) . '</p>' . |
|
56 | - '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing' ) . '</p>' . |
|
57 | - '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing' ) . '</p>' . |
|
52 | + '<p>' . __('In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing') . '</p>' . |
|
53 | + '<h2>' . __('What we share with others', 'invoicing') . '</h2>' . |
|
54 | + '<p>' . __('We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing') . '</p>' . |
|
55 | + '<p class="privacy-policy-tutorial">' . __('In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing') . '</p>' . |
|
56 | + '<p>' . __('We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing') . '</p>' . |
|
57 | + '<p>' . __('Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing') . '</p>' . |
|
58 | 58 | '</div>'; |
59 | 59 | |
60 | - return apply_filters( 'wpinv_privacy_policy_content', $content ); |
|
60 | + return apply_filters('wpinv_privacy_policy_content', $content); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | { |
166 | 166 | $installPath = $this->getPackageBasePath($package); |
167 | 167 | $io = $this->io; |
168 | - $outputStatus = function () use ($io, $installPath) { |
|
168 | + $outputStatus = function() use ($io, $installPath) { |
|
169 | 169 | $io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>')); |
170 | 170 | }; |
171 | 171 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $pattern = $locations ? '(' . implode('|', $locations) . ')' : false; |
236 | 236 | } |
237 | 237 | |
238 | - return $pattern ? : '(\w+)'; |
|
238 | + return $pattern ?: '(\w+)'; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function getLocations() |
37 | 37 | { |
38 | 38 | if ($this->matchesCakeVersion('>=', '3.0.0')) { |
39 | - $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/'; |
|
39 | + $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/'; |
|
40 | 40 | } |
41 | 41 | return $this->locations; |
42 | 42 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | protected function matchesCakeVersion($matcher, $version) |
52 | 52 | { |
53 | 53 | $repositoryManager = $this->composer->getRepositoryManager(); |
54 | - if (! $repositoryManager) { |
|
54 | + if (!$repositoryManager) { |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | class OxidInstaller extends BaseInstaller |
7 | 7 | { |
8 | - const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/'; |
|
8 | + const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/'; |
|
9 | 9 | |
10 | 10 | protected $locations = array( |
11 | 11 | 'module' => 'modules/{$name}/', |
@@ -13,47 +13,47 @@ discard block |
||
13 | 13 | 'out' => 'out/{$name}/', |
14 | 14 | ); |
15 | 15 | |
16 | - /** |
|
17 | - * getInstallPath |
|
18 | - * |
|
19 | - * @param PackageInterface $package |
|
20 | - * @param string $frameworkType |
|
21 | - * @return string |
|
22 | - */ |
|
23 | - public function getInstallPath(PackageInterface $package, $frameworkType = '') |
|
24 | - { |
|
25 | - $installPath = parent::getInstallPath($package, $frameworkType); |
|
26 | - $type = $this->package->getType(); |
|
27 | - if ($type === 'oxid-module') { |
|
28 | - $this->prepareVendorDirectory($installPath); |
|
29 | - } |
|
30 | - return $installPath; |
|
31 | - } |
|
16 | + /** |
|
17 | + * getInstallPath |
|
18 | + * |
|
19 | + * @param PackageInterface $package |
|
20 | + * @param string $frameworkType |
|
21 | + * @return string |
|
22 | + */ |
|
23 | + public function getInstallPath(PackageInterface $package, $frameworkType = '') |
|
24 | + { |
|
25 | + $installPath = parent::getInstallPath($package, $frameworkType); |
|
26 | + $type = $this->package->getType(); |
|
27 | + if ($type === 'oxid-module') { |
|
28 | + $this->prepareVendorDirectory($installPath); |
|
29 | + } |
|
30 | + return $installPath; |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * prepareVendorDirectory |
|
35 | - * |
|
36 | - * Makes sure there is a vendormetadata.php file inside |
|
37 | - * the vendor folder if there is a vendor folder. |
|
38 | - * |
|
39 | - * @param string $installPath |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - protected function prepareVendorDirectory($installPath) |
|
43 | - { |
|
44 | - $matches = ''; |
|
45 | - $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches); |
|
46 | - if (!$hasVendorDirectory) { |
|
47 | - return; |
|
48 | - } |
|
33 | + /** |
|
34 | + * prepareVendorDirectory |
|
35 | + * |
|
36 | + * Makes sure there is a vendormetadata.php file inside |
|
37 | + * the vendor folder if there is a vendor folder. |
|
38 | + * |
|
39 | + * @param string $installPath |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + protected function prepareVendorDirectory($installPath) |
|
43 | + { |
|
44 | + $matches = ''; |
|
45 | + $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches); |
|
46 | + if (!$hasVendorDirectory) { |
|
47 | + return; |
|
48 | + } |
|
49 | 49 | |
50 | - $vendorDirectory = $matches['vendor']; |
|
51 | - $vendorPath = getcwd() . '/modules/' . $vendorDirectory; |
|
52 | - if (!file_exists($vendorPath)) { |
|
53 | - mkdir($vendorPath, 0755, true); |
|
54 | - } |
|
50 | + $vendorDirectory = $matches['vendor']; |
|
51 | + $vendorPath = getcwd() . '/modules/' . $vendorDirectory; |
|
52 | + if (!file_exists($vendorPath)) { |
|
53 | + mkdir($vendorPath, 0755, true); |
|
54 | + } |
|
55 | 55 | |
56 | - $vendorMetaDataPath = $vendorPath . '/vendormetadata.php'; |
|
57 | - touch($vendorMetaDataPath); |
|
58 | - } |
|
56 | + $vendorMetaDataPath = $vendorPath . '/vendormetadata.php'; |
|
57 | + touch($vendorMetaDataPath); |
|
58 | + } |
|
59 | 59 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 |
@@ -14,51 +14,51 @@ |
||
14 | 14 | */ |
15 | 15 | class GetPaid_Payment_Exception extends Exception { |
16 | 16 | |
17 | - /** |
|
18 | - * Sanitized error code. |
|
19 | - * |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - protected $error_code; |
|
17 | + /** |
|
18 | + * Sanitized error code. |
|
19 | + * |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + protected $error_code; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Error extra data. |
|
26 | - * |
|
27 | - * @var array |
|
28 | - */ |
|
29 | - protected $error_data; |
|
24 | + /** |
|
25 | + * Error extra data. |
|
26 | + * |
|
27 | + * @var array |
|
28 | + */ |
|
29 | + protected $error_data; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Setup exception. |
|
33 | - * |
|
34 | - * @param string $code Machine-readable error code, e.g `getpaid-discount-error`. |
|
35 | - * @param string $message User-friendly translated error message, e.g. 'Discount is invalid'. |
|
36 | - * @param int $http_status_code Proper HTTP status code to respond with, e.g. 400. |
|
37 | - * @param array $data Extra error data. |
|
38 | - */ |
|
39 | - public function __construct( $code, $message, $http_status_code = 400, $data = array() ) { |
|
40 | - $this->error_code = $code; |
|
41 | - $this->error_data = array_merge( array( 'status' => $http_status_code ), $data ); |
|
31 | + /** |
|
32 | + * Setup exception. |
|
33 | + * |
|
34 | + * @param string $code Machine-readable error code, e.g `getpaid-discount-error`. |
|
35 | + * @param string $message User-friendly translated error message, e.g. 'Discount is invalid'. |
|
36 | + * @param int $http_status_code Proper HTTP status code to respond with, e.g. 400. |
|
37 | + * @param array $data Extra error data. |
|
38 | + */ |
|
39 | + public function __construct( $code, $message, $http_status_code = 400, $data = array() ) { |
|
40 | + $this->error_code = $code; |
|
41 | + $this->error_data = array_merge( array( 'status' => $http_status_code ), $data ); |
|
42 | 42 | |
43 | - parent::__construct( $message, $http_status_code ); |
|
44 | - } |
|
43 | + parent::__construct( $message, $http_status_code ); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Returns the error code. |
|
48 | - * |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - public function getErrorCode() { |
|
52 | - return $this->error_code; |
|
53 | - } |
|
46 | + /** |
|
47 | + * Returns the error code. |
|
48 | + * |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + public function getErrorCode() { |
|
52 | + return $this->error_code; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Returns error data. |
|
57 | - * |
|
58 | - * @return array |
|
59 | - */ |
|
60 | - public function getErrorData() { |
|
61 | - return $this->error_data; |
|
62 | - } |
|
55 | + /** |
|
56 | + * Returns error data. |
|
57 | + * |
|
58 | + * @return array |
|
59 | + */ |
|
60 | + public function getErrorData() { |
|
61 | + return $this->error_data; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @since 2.2.2 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Payment exception class. |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | * @param int $http_status_code Proper HTTP status code to respond with, e.g. 400. |
37 | 37 | * @param array $data Extra error data. |
38 | 38 | */ |
39 | - public function __construct( $code, $message, $http_status_code = 400, $data = array() ) { |
|
39 | + public function __construct($code, $message, $http_status_code = 400, $data = array()) { |
|
40 | 40 | $this->error_code = $code; |
41 | - $this->error_data = array_merge( array( 'status' => $http_status_code ), $data ); |
|
41 | + $this->error_data = array_merge(array('status' => $http_status_code), $data); |
|
42 | 42 | |
43 | - parent::__construct( $message, $http_status_code ); |
|
43 | + parent::__construct($message, $http_status_code); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; // Exit if accessed directly |
|
10 | + exit; // Exit if accessed directly |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | class GetPaid_Meta_Box_Payment_Form { |
17 | 17 | |
18 | 18 | /** |
19 | - * Output the metabox. |
|
20 | - * |
|
21 | - * @param WP_Post $post |
|
22 | - */ |
|
19 | + * Output the metabox. |
|
20 | + * |
|
21 | + * @param WP_Post $post |
|
22 | + */ |
|
23 | 23 | public static function output( $post ) { |
24 | 24 | ?> |
25 | 25 | <style> |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | - * Save meta box data. |
|
106 | - * |
|
107 | - * @param int $post_id |
|
108 | - */ |
|
109 | - public static function save( $post_id ) { |
|
105 | + * Save meta box data. |
|
106 | + * |
|
107 | + * @param int $post_id |
|
108 | + */ |
|
109 | + public static function save( $post_id ) { |
|
110 | 110 | |
111 | 111 | // Prepare the form. |
112 | 112 | $form = new GetPaid_Payment_Form( $post_id ); |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
140 | - * Converts an array fo form items to objects. |
|
141 | - * |
|
142 | - * @param array $items |
|
143 | - */ |
|
144 | - public static function item_to_objects( $items ) { |
|
140 | + * Converts an array fo form items to objects. |
|
141 | + * |
|
142 | + * @param array $items |
|
143 | + */ |
|
144 | + public static function item_to_objects( $items ) { |
|
145 | 145 | |
146 | 146 | $objects = array(); |
147 | 147 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if (!defined('ABSPATH')) { |
|
10 | 10 | exit; // Exit if accessed directly |
11 | 11 | } |
12 | 12 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @param WP_Post $post |
22 | 22 | */ |
23 | - public static function output( $post ) { |
|
23 | + public static function output($post) { |
|
24 | 24 | ?> |
25 | 25 | <style> |
26 | 26 | .wpinv-form-builder-edit-field-wrapper label.d-block > span:first-child{ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | <div class="col-sm-4"> |
34 | 34 | |
35 | 35 | <!-- Builder tabs --> |
36 | - <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php esc_html_e( 'Go Back', 'invoicing' ); ?></button> |
|
36 | + <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php esc_html_e('Go Back', 'invoicing'); ?></button> |
|
37 | 37 | |
38 | 38 | <!-- Builder tab content --> |
39 | 39 | <div class="mt-4"> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | <!-- Available builder elements --> |
42 | 42 | <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'"> |
43 | 43 | <div class="wpinv-form-builder-add-field-types"> |
44 | - <small class='form-text text-muted'><?php esc_html_e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small> |
|
44 | + <small class='form-text text-muted'><?php esc_html_e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small> |
|
45 | 45 | <draggable class="section mt-2" style="display: flex; flex-flow: wrap; justify-content: space-between;" v-model="elements" :group="{ name: 'fields', pull: 'clone', put: false }" :sort="false" :clone="addDraggedField" tag="ul" filter=".wpinv-undraggable"> |
46 | 46 | <li v-for="element in elements" class= "wpinv-payment-form-left-fields-field" @click.prevent="addField(element)" :class="{ 'd-none': element.defaults.premade }"> |
47 | 47 | <button class="button btn text-dark"> |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | <!-- Edit an element --> |
57 | 57 | <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='edit_item'" style="font-size: 14px;"> |
58 | 58 | <div class="wpinv-form-builder-edit-field-wrapper"> |
59 | - <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?> |
|
60 | - <?php do_action( 'getpaid_payment_form_edit_element_template', $post ); ?> |
|
59 | + <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?> |
|
60 | + <?php do_action('getpaid_payment_form_edit_element_template', $post); ?> |
|
61 | 61 | <div class='form-group mb-3'> |
62 | - <label :for="active_form_element.id + '_grid_width'"><?php esc_html_e( 'Width', 'invoicing' ); ?></label> |
|
62 | + <label :for="active_form_element.id + '_grid_width'"><?php esc_html_e('Width', 'invoicing'); ?></label> |
|
63 | 63 | <select class='form-control custom-select' :id="active_form_element.id + '_grid_width'" v-model='gridWidth'> |
64 | - <option value='full'><?php esc_html_e( 'Full Width', 'invoicing' ); ?></option> |
|
65 | - <option value='half'><?php esc_html_e( 'Half Width', 'invoicing' ); ?></option> |
|
66 | - <option value='third'><?php esc_html_e( '1/3 Width', 'invoicing' ); ?></option> |
|
64 | + <option value='full'><?php esc_html_e('Full Width', 'invoicing'); ?></option> |
|
65 | + <option value='half'><?php esc_html_e('Half Width', 'invoicing'); ?></option> |
|
66 | + <option value='third'><?php esc_html_e('1/3 Width', 'invoicing'); ?></option> |
|
67 | 67 | </select> |
68 | 68 | </div> |
69 | 69 | <div> |
70 | - <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php esc_html_e( 'Delete Element', 'invoicing' ); ?></button> |
|
70 | + <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php esc_html_e('Delete Element', 'invoicing'); ?></button> |
|
71 | 71 | </div> |
72 | 72 | </div> |
73 | 73 | </div> |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | |
77 | 77 | </div> |
78 | 78 | <div class="col-sm-8 border-left"> |
79 | - <small class='form-text text-muted' v-if='form_elements.length'><?php esc_html_e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small> |
|
80 | - <p class='form-text text-muted' v-if='! form_elements.length'><?php esc_html_e( 'This form is empty. Add new elements by dragging them from the right.', 'invoicing' ); ?></p> |
|
79 | + <small class='form-text text-muted' v-if='form_elements.length'><?php esc_html_e('Click on any element to edit or delete it.', 'invoicing'); ?></small> |
|
80 | + <p class='form-text text-muted' v-if='! form_elements.length'><?php esc_html_e('This form is empty. Add new elements by dragging them from the right.', 'invoicing'); ?></p> |
|
81 | 81 | |
82 | 82 | <div class="container-fluid"> |
83 | 83 | <draggable class="section row" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 14px;"> |
84 | 84 | <div v-for="form_element in form_elements" class="wpinv-form-builder-element-preview" :class="[{ active: active_form_element==form_element && active_tab=='edit_item' }, form_element.type, grid_class( form_element ) ]" @click="active_tab = 'edit_item'; active_form_element = form_element"> |
85 | 85 | <div class="wpinv-form-builder-element-preview-inner"> |
86 | 86 | <div class="wpinv-payment-form-field-preview-overlay"></div> |
87 | - <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?> |
|
87 | + <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?> |
|
88 | 88 | </div> |
89 | 89 | </div> |
90 | 90 | </draggable> |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | </script> |
104 | 104 | <?php |
105 | 105 | |
106 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
106 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -111,33 +111,33 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param int $post_id |
113 | 113 | */ |
114 | - public static function save( $post_id ) { |
|
114 | + public static function save($post_id) { |
|
115 | 115 | |
116 | 116 | // Prepare the form. |
117 | - $form = new GetPaid_Payment_Form( $post_id ); |
|
117 | + $form = new GetPaid_Payment_Form($post_id); |
|
118 | 118 | |
119 | 119 | // Fetch form items. |
120 | - $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true ); |
|
120 | + $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true); |
|
121 | 121 | |
122 | 122 | // Ensure that we have an array... |
123 | - if ( empty( $form_items ) ) { |
|
123 | + if (empty($form_items)) { |
|
124 | 124 | $form_items = array(); |
125 | 125 | } |
126 | 126 | |
127 | 127 | // Add it to the form. |
128 | - $form->set_items( self::item_to_objects( wp_kses_post_deep( $form_items ) ) ); |
|
128 | + $form->set_items(self::item_to_objects(wp_kses_post_deep($form_items))); |
|
129 | 129 | |
130 | 130 | // Save form elements. |
131 | - $form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true ); |
|
132 | - if ( empty( $form_elements ) ) { |
|
131 | + $form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true); |
|
132 | + if (empty($form_elements)) { |
|
133 | 133 | $form_elements = array(); |
134 | 134 | } |
135 | 135 | |
136 | - $form->set_elements( wp_kses_post_deep( $form_elements ) ); |
|
136 | + $form->set_elements(wp_kses_post_deep($form_elements)); |
|
137 | 137 | |
138 | 138 | // Persist data to the datastore. |
139 | 139 | $form->save(); |
140 | - do_action( 'getpaid_payment_form_metabox_save', $post_id, $form ); |
|
140 | + do_action('getpaid_payment_form_metabox_save', $post_id, $form); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param array $items |
148 | 148 | */ |
149 | - public static function item_to_objects( $items ) { |
|
149 | + public static function item_to_objects($items) { |
|
150 | 150 | |
151 | 151 | $objects = array(); |
152 | 152 | |
153 | - foreach ( $items as $item ) { |
|
154 | - $_item = new GetPaid_Form_Item( $item['id'] ); |
|
155 | - $_item->set_allow_quantities( (bool) $item['allow_quantities'] ); |
|
156 | - $_item->set_is_required( (bool) $item['required'] ); |
|
153 | + foreach ($items as $item) { |
|
154 | + $_item = new GetPaid_Form_Item($item['id']); |
|
155 | + $_item->set_allow_quantities((bool) $item['allow_quantities']); |
|
156 | + $_item->set_is_required((bool) $item['required']); |
|
157 | 157 | $objects[] = $_item; |
158 | 158 | } |
159 | 159 |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @deprecated |
247 | 247 | */ |
248 | 248 | function wpinv_get_payment_key( $invoice = 0 ) { |
249 | - $invoice = new WPInv_Invoice( $invoice ); |
|
249 | + $invoice = new WPInv_Invoice( $invoice ); |
|
250 | 250 | return $invoice->get_key(); |
251 | 251 | } |
252 | 252 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @deprecated |
425 | 425 | */ |
426 | 426 | function wpinv_get_checkout_session() { |
427 | - return false; |
|
427 | + return false; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -1273,5 +1273,5 @@ discard block |
||
1273 | 1273 | * @deprecated |
1274 | 1274 | */ |
1275 | 1275 | function wpinv_get_subscription( $invoice ) { |
1276 | - return wpinv_get_invoice_subscription( $invoice ); |
|
1276 | + return wpinv_get_invoice_subscription( $invoice ); |
|
1277 | 1277 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Invoicing |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @deprecated |
@@ -19,48 +19,48 @@ discard block |
||
19 | 19 | * @deprecated |
20 | 20 | */ |
21 | 21 | function wpinv_get_invoice_cart() { |
22 | - return wpinv_get_invoice( getpaid_get_current_invoice_id() ); |
|
22 | + return wpinv_get_invoice(getpaid_get_current_invoice_id()); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @deprecated |
27 | 27 | */ |
28 | -function wpinv_get_invoice_description( $invoice ) { |
|
29 | - $invoice = new WPInv_Invoice( $invoice ); |
|
28 | +function wpinv_get_invoice_description($invoice) { |
|
29 | + $invoice = new WPInv_Invoice($invoice); |
|
30 | 30 | return $invoice->get_description(); |
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @deprecated |
35 | 35 | */ |
36 | -function wpinv_get_invoice_currency_code( $invoice ) { |
|
37 | - $invoice = new WPInv_Invoice( $invoice ); |
|
36 | +function wpinv_get_invoice_currency_code($invoice) { |
|
37 | + $invoice = new WPInv_Invoice($invoice); |
|
38 | 38 | return $invoice->get_currency(); |
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @deprecated |
43 | 43 | */ |
44 | -function wpinv_get_payment_user_email( $invoice ) { |
|
45 | - $invoice = new WPInv_Invoice( $invoice ); |
|
44 | +function wpinv_get_payment_user_email($invoice) { |
|
45 | + $invoice = new WPInv_Invoice($invoice); |
|
46 | 46 | return $invoice->get_email(); |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @deprecated |
51 | 51 | */ |
52 | -function wpinv_get_user_id( $invoice ) { |
|
53 | - $invoice = new WPInv_Invoice( $invoice ); |
|
52 | +function wpinv_get_user_id($invoice) { |
|
53 | + $invoice = new WPInv_Invoice($invoice); |
|
54 | 54 | return $invoice->get_user_id(); |
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @deprecated |
59 | 59 | */ |
60 | -function wpinv_get_invoice_status( $invoice, $return_label = false ) { |
|
61 | - $invoice = new WPInv_Invoice( $invoice ); |
|
60 | +function wpinv_get_invoice_status($invoice, $return_label = false) { |
|
61 | + $invoice = new WPInv_Invoice($invoice); |
|
62 | 62 | |
63 | - if ( $return_label ) { |
|
63 | + if ($return_label) { |
|
64 | 64 | return $invoice->get_status_nicename(); |
65 | 65 | } |
66 | 66 | |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * @deprecated |
72 | 72 | */ |
73 | -function wpinv_get_payment_gateway( $invoice, $return_label = false ) { |
|
74 | - $invoice = new WPInv_Invoice( $invoice ); |
|
73 | +function wpinv_get_payment_gateway($invoice, $return_label = false) { |
|
74 | + $invoice = new WPInv_Invoice($invoice); |
|
75 | 75 | |
76 | - if ( $return_label ) { |
|
76 | + if ($return_label) { |
|
77 | 77 | return $invoice->get_gateway_title(); |
78 | 78 | } |
79 | 79 | |
@@ -83,75 +83,75 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * @deprecated |
85 | 85 | */ |
86 | -function wpinv_get_payment_gateway_name( $invoice ) { |
|
87 | - return wpinv_get_payment_gateway( $invoice, true ); |
|
86 | +function wpinv_get_payment_gateway_name($invoice) { |
|
87 | + return wpinv_get_payment_gateway($invoice, true); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @deprecated |
92 | 92 | */ |
93 | -function wpinv_get_payment_transaction_id( $invoice ) { |
|
94 | - $invoice = new WPInv_Invoice( $invoice ); |
|
93 | +function wpinv_get_payment_transaction_id($invoice) { |
|
94 | + $invoice = new WPInv_Invoice($invoice); |
|
95 | 95 | return $invoice->get_transaction_id(); |
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * @deprecated |
100 | 100 | */ |
101 | -function wpinv_get_invoice_meta( $invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true ) { |
|
102 | - $invoice = new WPInv_Invoice( $invoice_id ); |
|
103 | - return $invoice->get_meta( $meta_key, $single ); |
|
101 | +function wpinv_get_invoice_meta($invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true) { |
|
102 | + $invoice = new WPInv_Invoice($invoice_id); |
|
103 | + return $invoice->get_meta($meta_key, $single); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
107 | 107 | * @deprecated |
108 | 108 | */ |
109 | -function wpinv_update_invoice_meta( $invoice_id = 0, $meta_key = '', $meta_value = '' ) { |
|
110 | - $invoice = new WPInv_Invoice( $invoice_id ); |
|
111 | - return $invoice->update_meta_data( $meta_key, $meta_value ); |
|
109 | +function wpinv_update_invoice_meta($invoice_id = 0, $meta_key = '', $meta_value = '') { |
|
110 | + $invoice = new WPInv_Invoice($invoice_id); |
|
111 | + return $invoice->update_meta_data($meta_key, $meta_value); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
115 | 115 | * @deprecated |
116 | 116 | */ |
117 | -function wpinv_get_items( $invoice = 0 ) { |
|
118 | - $invoice = new WPInv_Invoice( $invoice ); |
|
117 | +function wpinv_get_items($invoice = 0) { |
|
118 | + $invoice = new WPInv_Invoice($invoice); |
|
119 | 119 | return $invoice->get_items(); |
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * @deprecated |
124 | 124 | */ |
125 | -function wpinv_get_fees( $invoice = 0 ) { |
|
126 | - $invoice = new WPInv_Invoice( $invoice ); |
|
125 | +function wpinv_get_fees($invoice = 0) { |
|
126 | + $invoice = new WPInv_Invoice($invoice); |
|
127 | 127 | return $invoice->get_fees(); |
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | 131 | * @deprecated |
132 | 132 | */ |
133 | -function wpinv_get_invoice_ip( $invoice ) { |
|
134 | - $invoice = new WPInv_Invoice( $invoice ); |
|
133 | +function wpinv_get_invoice_ip($invoice) { |
|
134 | + $invoice = new WPInv_Invoice($invoice); |
|
135 | 135 | return $invoice->get_ip(); |
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
139 | 139 | * @deprecated |
140 | 140 | */ |
141 | -function wpinv_get_invoice_user_info( $invoice ) { |
|
142 | - $invoice = new WPInv_Invoice( $invoice ); |
|
141 | +function wpinv_get_invoice_user_info($invoice) { |
|
142 | + $invoice = new WPInv_Invoice($invoice); |
|
143 | 143 | return $invoice->get_user_info(); |
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | 147 | * @deprecated |
148 | 148 | */ |
149 | -function wpinv_subtotal( $invoice = 0, $currency = false ) { |
|
150 | - $invoice = new WPInv_Invoice( $invoice ); |
|
149 | +function wpinv_subtotal($invoice = 0, $currency = false) { |
|
150 | + $invoice = new WPInv_Invoice($invoice); |
|
151 | 151 | $subtotal = $invoice->get_subtotal(); |
152 | 152 | |
153 | - if ( $currency ) { |
|
154 | - return wpinv_price( $subtotal, $invoice->get_currency() ); |
|
153 | + if ($currency) { |
|
154 | + return wpinv_price($subtotal, $invoice->get_currency()); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | return $subtotal; |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | /** |
161 | 161 | * @deprecated |
162 | 162 | */ |
163 | -function wpinv_tax( $invoice = 0, $currency = false ) { |
|
164 | - $invoice = new WPInv_Invoice( $invoice ); |
|
163 | +function wpinv_tax($invoice = 0, $currency = false) { |
|
164 | + $invoice = new WPInv_Invoice($invoice); |
|
165 | 165 | $tax = $invoice->get_total_tax(); |
166 | 166 | |
167 | - if ( $currency ) { |
|
168 | - return wpinv_price( $tax, $invoice->get_currency() ); |
|
167 | + if ($currency) { |
|
168 | + return wpinv_price($tax, $invoice->get_currency()); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | return $tax; |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * @deprecated |
176 | 176 | */ |
177 | -function wpinv_discount( $invoice = 0, $currency = false ) { |
|
178 | - $invoice = new WPInv_Invoice( $invoice ); |
|
177 | +function wpinv_discount($invoice = 0, $currency = false) { |
|
178 | + $invoice = new WPInv_Invoice($invoice); |
|
179 | 179 | $discount = $invoice->get_total_discount(); |
180 | 180 | |
181 | - if ( $currency ) { |
|
182 | - return wpinv_price( $discount, $invoice->get_currency() ); |
|
181 | + if ($currency) { |
|
182 | + return wpinv_price($discount, $invoice->get_currency()); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | return $discount; |
@@ -188,20 +188,20 @@ discard block |
||
188 | 188 | /** |
189 | 189 | * @deprecated |
190 | 190 | */ |
191 | -function wpinv_discount_code( $invoice = 0 ) { |
|
192 | - $invoice = new WPInv_Invoice( $invoice ); |
|
191 | +function wpinv_discount_code($invoice = 0) { |
|
192 | + $invoice = new WPInv_Invoice($invoice); |
|
193 | 193 | return $invoice->get_discount_code(); |
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
197 | 197 | * @deprecated |
198 | 198 | */ |
199 | -function wpinv_payment_total( $invoice = 0, $currency = false ) { |
|
200 | - $invoice = new WPInv_Invoice( $invoice ); |
|
199 | +function wpinv_payment_total($invoice = 0, $currency = false) { |
|
200 | + $invoice = new WPInv_Invoice($invoice); |
|
201 | 201 | $total = $invoice->get_total(); |
202 | 202 | |
203 | - if ( $currency ) { |
|
204 | - return wpinv_price( $total, $invoice->get_currency() ); |
|
203 | + if ($currency) { |
|
204 | + return wpinv_price($total, $invoice->get_currency()); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $total; |
@@ -210,51 +210,51 @@ discard block |
||
210 | 210 | /** |
211 | 211 | * @deprecated |
212 | 212 | */ |
213 | -function wpinv_get_date_created( $invoice = 0, $format = '' ) { |
|
214 | - $invoice = new WPInv_Invoice( $invoice ); |
|
213 | +function wpinv_get_date_created($invoice = 0, $format = '') { |
|
214 | + $invoice = new WPInv_Invoice($invoice); |
|
215 | 215 | |
216 | - $format = ! empty( $format ) ? $format : get_option( 'date_format' ); |
|
216 | + $format = !empty($format) ? $format : get_option('date_format'); |
|
217 | 217 | $date_created = $invoice->get_created_date(); |
218 | 218 | |
219 | - return empty( $date_created ) ? date_i18n( $format, strtotime( $date_created ) ) : ''; |
|
219 | + return empty($date_created) ? date_i18n($format, strtotime($date_created)) : ''; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
223 | 223 | * @deprecated |
224 | 224 | */ |
225 | -function wpinv_get_invoice_date( $invoice = 0, $format = '' ) { |
|
226 | - wpinv_get_date_created( $invoice, $format ); |
|
225 | +function wpinv_get_invoice_date($invoice = 0, $format = '') { |
|
226 | + wpinv_get_date_created($invoice, $format); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
230 | 230 | * @deprecated |
231 | 231 | */ |
232 | -function wpinv_get_invoice_vat_number( $invoice = 0 ) { |
|
233 | - $invoice = new WPInv_Invoice( $invoice ); |
|
232 | +function wpinv_get_invoice_vat_number($invoice = 0) { |
|
233 | + $invoice = new WPInv_Invoice($invoice); |
|
234 | 234 | return $invoice->get_vat_number(); |
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
238 | 238 | * @deprecated |
239 | 239 | */ |
240 | -function wpinv_insert_payment_note( $invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false ) { |
|
241 | - $invoice = new WPInv_Invoice( $invoice ); |
|
242 | - return $invoice->add_note( $note, $user_type, $added_by_user, $system ); |
|
240 | +function wpinv_insert_payment_note($invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false) { |
|
241 | + $invoice = new WPInv_Invoice($invoice); |
|
242 | + return $invoice->add_note($note, $user_type, $added_by_user, $system); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
246 | 246 | * @deprecated |
247 | 247 | */ |
248 | -function wpinv_get_payment_key( $invoice = 0 ) { |
|
249 | - $invoice = new WPInv_Invoice( $invoice ); |
|
248 | +function wpinv_get_payment_key($invoice = 0) { |
|
249 | + $invoice = new WPInv_Invoice($invoice); |
|
250 | 250 | return $invoice->get_key(); |
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
254 | 254 | * @deprecated |
255 | 255 | */ |
256 | -function wpinv_get_invoice_number( $invoice = 0 ) { |
|
257 | - $invoice = new WPInv_Invoice( $invoice ); |
|
256 | +function wpinv_get_invoice_number($invoice = 0) { |
|
257 | + $invoice = new WPInv_Invoice($invoice); |
|
258 | 258 | return $invoice->get_number(); |
259 | 259 | } |
260 | 260 | |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | /** |
402 | 402 | * @deprecated |
403 | 403 | */ |
404 | -function wpinv_update_payment_status( $invoice, $new_status = 'publish' ) { |
|
405 | - $invoice = new WPInv_Invoice( $invoice ); |
|
406 | - return $invoice->update_status( $new_status ); |
|
404 | +function wpinv_update_payment_status($invoice, $new_status = 'publish') { |
|
405 | + $invoice = new WPInv_Invoice($invoice); |
|
406 | + return $invoice->update_status($new_status); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -456,22 +456,22 @@ discard block |
||
456 | 456 | /** |
457 | 457 | * @deprecated |
458 | 458 | */ |
459 | -function wpinv_set_payment_transaction_id( $invoice_id = 0, $transaction_id = '' ) { |
|
459 | +function wpinv_set_payment_transaction_id($invoice_id = 0, $transaction_id = '') { |
|
460 | 460 | |
461 | 461 | // Fetch the invoice. |
462 | - $invoice = new WPInv_Invoice( $invoice_id ); |
|
462 | + $invoice = new WPInv_Invoice($invoice_id); |
|
463 | 463 | |
464 | - if ( 0 == $invoice->get_id() ) { |
|
464 | + if (0 == $invoice->get_id()) { |
|
465 | 465 | return false; |
466 | 466 | } |
467 | 467 | |
468 | 468 | // Prepare the transaction id. |
469 | - if ( empty( $transaction_id ) ) { |
|
469 | + if (empty($transaction_id)) { |
|
470 | 470 | $transaction_id = $invoice_id; |
471 | 471 | } |
472 | 472 | |
473 | 473 | // Set the transaction id; |
474 | - $invoice->set_transaction_id( apply_filters( 'wpinv_set_payment_transaction_id', $transaction_id, $invoice ) ); |
|
474 | + $invoice->set_transaction_id(apply_filters('wpinv_set_payment_transaction_id', $transaction_id, $invoice)); |
|
475 | 475 | |
476 | 476 | // Save the invoice. |
477 | 477 | return $invoice->save(); |
@@ -484,12 +484,12 @@ discard block |
||
484 | 484 | * @param WPInv_Invoice $invoice |
485 | 485 | * @param string $gateway |
486 | 486 | */ |
487 | -function wpinv_send_to_gateway( $gateway, $invoice ) { |
|
487 | +function wpinv_send_to_gateway($gateway, $invoice) { |
|
488 | 488 | |
489 | 489 | $payment_data = array( |
490 | 490 | 'invoice_id' => $invoice->get_id(), |
491 | 491 | 'items' => $invoice->get_cart_details(), |
492 | - 'cart_discounts' => array( $invoice->get_discount_code() ), |
|
492 | + 'cart_discounts' => array($invoice->get_discount_code()), |
|
493 | 493 | 'fees' => $invoice->get_total_fees(), |
494 | 494 | 'subtotal' => $invoice->get_subtotal(), |
495 | 495 | 'discount' => $invoice->get_total_discount(), |
@@ -497,16 +497,16 @@ discard block |
||
497 | 497 | 'price' => $invoice->get_total(), |
498 | 498 | 'invoice_key' => $invoice->get_key(), |
499 | 499 | 'user_email' => $invoice->get_email(), |
500 | - 'date' => gmdate( 'Y-m-d H:i:s', time() ), |
|
500 | + 'date' => gmdate('Y-m-d H:i:s', time()), |
|
501 | 501 | 'user_info' => $invoice->get_user_info(), |
502 | - 'post_data' => wp_kses_post_deep( wp_unslash( $_POST ) ), |
|
502 | + 'post_data' => wp_kses_post_deep(wp_unslash($_POST)), |
|
503 | 503 | 'cart_details' => $invoice->get_cart_details(), |
504 | 504 | 'gateway' => $gateway, |
505 | 505 | 'card_info' => array(), |
506 | - 'gateway_nonce' => wp_create_nonce( 'wpi-gateway' ), |
|
506 | + 'gateway_nonce' => wp_create_nonce('wpi-gateway'), |
|
507 | 507 | ); |
508 | 508 | |
509 | - do_action( 'wpinv_gateway_' . $gateway, $payment_data ); |
|
509 | + do_action('wpinv_gateway_' . $gateway, $payment_data); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | /** |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | /** |
520 | 520 | * @deprecated |
521 | 521 | */ |
522 | -function wpinv_die( $message = '', $title = '', $status = 400 ) { |
|
523 | - add_filter( 'wp_die_ajax_handler', 'wpinv_die_handler', 10, 3 ); |
|
524 | - add_filter( 'wp_die_handler', 'wpinv_die_handler', 10, 3 ); |
|
525 | - wp_die( esc_html( $message ), esc_html( $title ), array( 'response' => (int) $status ) ); |
|
522 | +function wpinv_die($message = '', $title = '', $status = 400) { |
|
523 | + add_filter('wp_die_ajax_handler', 'wpinv_die_handler', 10, 3); |
|
524 | + add_filter('wp_die_handler', 'wpinv_die_handler', 10, 3); |
|
525 | + wp_die(esc_html($message), esc_html($title), array('response' => (int) $status)); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
@@ -640,14 +640,14 @@ discard block |
||
640 | 640 | /** |
641 | 641 | * @deprecated |
642 | 642 | */ |
643 | -function wpinv_invoice_status_label( $status, $status_display = '' ) { |
|
644 | - return empty( $status_display ) ? sanitize_text_field( $status ) : sanitize_text_field( $status_display ); |
|
643 | +function wpinv_invoice_status_label($status, $status_display = '') { |
|
644 | + return empty($status_display) ? sanitize_text_field($status) : sanitize_text_field($status_display); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | /** |
648 | 648 | * @deprecated |
649 | 649 | */ |
650 | -function wpinv_clean_invoice_number( $number ) { |
|
650 | +function wpinv_clean_invoice_number($number) { |
|
651 | 651 | return $number; |
652 | 652 | } |
653 | 653 | |
@@ -852,12 +852,12 @@ discard block |
||
852 | 852 | /** |
853 | 853 | * @deprecated |
854 | 854 | */ |
855 | -function wpinv_item_show_price( $item_id = 0, $echo = true ) { |
|
855 | +function wpinv_item_show_price($item_id = 0, $echo = true) { |
|
856 | 856 | |
857 | - if ( $echo ) { |
|
858 | - echo wp_kses_post( wpinv_item_price( $item_id ) ); |
|
857 | + if ($echo) { |
|
858 | + echo wp_kses_post(wpinv_item_price($item_id)); |
|
859 | 859 | } else { |
860 | - return wpinv_item_price( $item_id ); |
|
860 | + return wpinv_item_price($item_id); |
|
861 | 861 | } |
862 | 862 | |
863 | 863 | } |
@@ -1272,6 +1272,6 @@ discard block |
||
1272 | 1272 | * @return WPInv_Subscription|bool |
1273 | 1273 | * @deprecated |
1274 | 1274 | */ |
1275 | -function wpinv_get_subscription( $invoice ) { |
|
1276 | - return wpinv_get_invoice_subscription( $invoice ); |
|
1275 | +function wpinv_get_subscription($invoice) { |
|
1276 | + return wpinv_get_invoice_subscription($invoice); |
|
1277 | 1277 | } |