@@ -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 | /** |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if (!defined('ABSPATH')) { |
|
9 | 9 | exit; // Exit if accessed directly |
10 | 10 | } |
11 | 11 | |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param WP_Post $post |
21 | 21 | */ |
22 | - public static function output( $post ) { |
|
22 | + public static function output($post) { |
|
23 | 23 | |
24 | 24 | // Fetch the invoice. |
25 | - $invoice = new WPInv_Invoice( $post ); |
|
25 | + $invoice = new WPInv_Invoice($post); |
|
26 | 26 | |
27 | 27 | // Fetch the subscription. |
28 | - $subscription = getpaid_get_invoice_subscription( $invoice ); |
|
28 | + $subscription = getpaid_get_invoice_subscription($invoice); |
|
29 | 29 | |
30 | 30 | echo '<div class="bsui">'; |
31 | - getpaid_admin_subscription_details_metabox( /** @scrutinizer ignore-type */$subscription ); |
|
31 | + getpaid_admin_subscription_details_metabox(/** @scrutinizer ignore-type */$subscription); |
|
32 | 32 | echo '</div>'; |
33 | 33 | |
34 | 34 | } |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param WP_Post $post |
40 | 40 | */ |
41 | - public static function output_invoices( $post ) { |
|
41 | + public static function output_invoices($post) { |
|
42 | 42 | |
43 | 43 | // Fetch the invoice. |
44 | - $invoice = new WPInv_Invoice( $post ); |
|
44 | + $invoice = new WPInv_Invoice($post); |
|
45 | 45 | |
46 | 46 | // Fetch the subscription. |
47 | - $subscription = getpaid_get_invoice_subscription( $invoice ); |
|
47 | + $subscription = getpaid_get_invoice_subscription($invoice); |
|
48 | 48 | |
49 | 49 | echo '<div class="bsui">'; |
50 | - getpaid_admin_subscription_invoice_details_metabox( /** @scrutinizer ignore-type */$subscription, false ); |
|
50 | + getpaid_admin_subscription_invoice_details_metabox(/** @scrutinizer ignore-type */$subscription, false); |
|
51 | 51 | echo '</div>'; |
52 | 52 | |
53 | 53 | } |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param WP_Post $post |
59 | 59 | */ |
60 | - public static function output_related( $post ) { |
|
60 | + public static function output_related($post) { |
|
61 | 61 | |
62 | 62 | // Fetch the invoice. |
63 | - $invoice = new WPInv_Invoice( $post ); |
|
63 | + $invoice = new WPInv_Invoice($post); |
|
64 | 64 | |
65 | 65 | // Fetch the subscription. |
66 | - $subscription = getpaid_get_invoice_subscription( $invoice ); |
|
66 | + $subscription = getpaid_get_invoice_subscription($invoice); |
|
67 | 67 | |
68 | 68 | echo '<div class="bsui">'; |
69 | - getpaid_admin_subscription_related_subscriptions_metabox( /** @scrutinizer ignore-type */$subscription, false ); |
|
69 | + getpaid_admin_subscription_related_subscriptions_metabox(/** @scrutinizer ignore-type */$subscription, false); |
|
70 | 70 | echo '</div>'; |
71 | 71 | |
72 | 72 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Uses MaxMind for Geolocation |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | * @since 1.0.19 |
35 | 35 | * @return mixed|null The geolocation database service. |
36 | 36 | */ |
37 | - $this->database_service = apply_filters( 'getpaid_maxmind_geolocation_database_service', null ); |
|
38 | - if ( null === $this->database_service ) { |
|
39 | - $this->database_service = new GetPaid_MaxMind_Database_Service( $this->get_database_prefix() ); |
|
37 | + $this->database_service = apply_filters('getpaid_maxmind_geolocation_database_service', null); |
|
38 | + if (null === $this->database_service) { |
|
39 | + $this->database_service = new GetPaid_MaxMind_Database_Service($this->get_database_prefix()); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | // Bind to the scheduled updater action. |
43 | - add_action( 'getpaid_update_geoip_databases', array( $this, 'update_database' ) ); |
|
43 | + add_action('getpaid_update_geoip_databases', array($this, 'update_database')); |
|
44 | 44 | |
45 | 45 | // Bind to the geolocation filter for MaxMind database lookups. |
46 | - add_filter( 'getpaid_get_geolocation', array( $this, 'get_geolocation' ), 10, 2 ); |
|
46 | + add_filter('getpaid_get_geolocation', array($this, 'get_geolocation'), 10, 2); |
|
47 | 47 | |
48 | 48 | // Handle maxmind key updates. |
49 | - add_filter( 'wpinv_settings_sanitize_maxmind_license_key', array( $this, 'handle_key_updates' ) ); |
|
49 | + add_filter('wpinv_settings_sanitize_maxmind_license_key', array($this, 'handle_key_updates')); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -65,29 +65,29 @@ discard block |
||
65 | 65 | * @param string $license_key The new license key. |
66 | 66 | * @return string |
67 | 67 | */ |
68 | - public function handle_key_updates( $license_key ) { |
|
68 | + public function handle_key_updates($license_key) { |
|
69 | 69 | |
70 | 70 | // Trim whitespaces and strip slashes. |
71 | - $license_key = trim( $license_key ); |
|
71 | + $license_key = trim($license_key); |
|
72 | 72 | |
73 | 73 | // Abort if the license key is empty or unchanged. |
74 | - if ( empty( $license_key ) ) { |
|
74 | + if (empty($license_key)) { |
|
75 | 75 | return $license_key; |
76 | 76 | } |
77 | 77 | |
78 | 78 | // Abort if a database exists and the license key is unchaged. |
79 | - if ( file_exists( $this->database_service->get_database_path() && $license_key == wpinv_get_option( 'maxmind_license_key' ) ) ) { |
|
79 | + if (file_exists($this->database_service->get_database_path() && $license_key == wpinv_get_option('maxmind_license_key'))) { |
|
80 | 80 | return $license_key; |
81 | 81 | } |
82 | 82 | |
83 | 83 | // Check the license key by attempting to download the Geolocation database. |
84 | - $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
85 | - if ( is_wp_error( $tmp_database_path ) ) { |
|
86 | - getpaid_admin()->show_error( $tmp_database_path->get_error_message() ); |
|
84 | + $tmp_database_path = $this->database_service->download_database($license_key); |
|
85 | + if (is_wp_error($tmp_database_path)) { |
|
86 | + getpaid_admin()->show_error($tmp_database_path->get_error_message()); |
|
87 | 87 | return $license_key; |
88 | 88 | } |
89 | 89 | |
90 | - $this->update_database( /** @scrutinizer ignore-type */ $tmp_database_path ); |
|
90 | + $this->update_database(/** @scrutinizer ignore-type */ $tmp_database_path); |
|
91 | 91 | |
92 | 92 | return $license_key; |
93 | 93 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param string $tmp_database_path Temporary database path. |
99 | 99 | */ |
100 | - public function update_database( $tmp_database_path = null ) { |
|
100 | + public function update_database($tmp_database_path = null) { |
|
101 | 101 | |
102 | 102 | // Allow us to easily interact with the filesystem. |
103 | 103 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
@@ -108,32 +108,32 @@ discard block |
||
108 | 108 | $target_database_path = $this->database_service->get_database_path(); |
109 | 109 | |
110 | 110 | // If there's no database path, we can't store the database. |
111 | - if ( empty( $target_database_path ) ) { |
|
111 | + if (empty($target_database_path)) { |
|
112 | 112 | return; |
113 | 113 | } |
114 | 114 | |
115 | - if ( $wp_filesystem->exists( $target_database_path ) ) { |
|
116 | - $wp_filesystem->delete( $target_database_path ); |
|
115 | + if ($wp_filesystem->exists($target_database_path)) { |
|
116 | + $wp_filesystem->delete($target_database_path); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // We can't download a database if there's no license key configured. |
120 | - $license_key = wpinv_get_option( 'maxmind_license_key' ); |
|
121 | - if ( empty( $license_key ) ) { |
|
120 | + $license_key = wpinv_get_option('maxmind_license_key'); |
|
121 | + if (empty($license_key)) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
125 | - if ( empty( $tmp_database_path ) ) { |
|
126 | - $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
125 | + if (empty($tmp_database_path)) { |
|
126 | + $tmp_database_path = $this->database_service->download_database($license_key); |
|
127 | 127 | } |
128 | 128 | |
129 | - if ( is_wp_error( $tmp_database_path ) ) { |
|
130 | - wpinv_error_log( $tmp_database_path->get_error_message() ); |
|
129 | + if (is_wp_error($tmp_database_path)) { |
|
130 | + wpinv_error_log($tmp_database_path->get_error_message()); |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Move the new database into position. |
135 | - $wp_filesystem->move( $tmp_database_path, $target_database_path, true ); |
|
136 | - $wp_filesystem->delete( dirname( $tmp_database_path ) ); |
|
135 | + $wp_filesystem->move($tmp_database_path, $target_database_path, true); |
|
136 | + $wp_filesystem->delete(dirname($tmp_database_path)); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | * @param string $ip_address The IP address to geolocate. |
144 | 144 | * @return array Geolocation including country code, state, city and postcode based on an IP address. |
145 | 145 | */ |
146 | - public function get_geolocation( $data, $ip_address ) { |
|
146 | + public function get_geolocation($data, $ip_address) { |
|
147 | 147 | |
148 | - if ( ! empty( $data['country'] ) || empty( $ip_address ) ) { |
|
148 | + if (!empty($data['country']) || empty($ip_address)) { |
|
149 | 149 | return $data; |
150 | 150 | } |
151 | 151 | |
152 | - $country_code = $this->database_service->get_iso_country_code_for_ip( $ip_address ); |
|
152 | + $country_code = $this->database_service->get_iso_country_code_for_ip($ip_address); |
|
153 | 153 | |
154 | 154 | return array( |
155 | 155 | 'country' => $country_code, |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | */ |
168 | 168 | private function get_database_prefix() { |
169 | 169 | |
170 | - $prefix = get_option( 'wpinv_maxmind_database_prefix' ); |
|
170 | + $prefix = get_option('wpinv_maxmind_database_prefix'); |
|
171 | 171 | |
172 | - if ( empty( $prefix ) ) { |
|
173 | - $prefix = md5( uniqid( 'wpinv' ) ); |
|
174 | - update_option( 'wpinv_maxmind_database_prefix', $prefix ); |
|
172 | + if (empty($prefix)) { |
|
173 | + $prefix = md5(uniqid('wpinv')); |
|
174 | + update_option('wpinv_maxmind_database_prefix', $prefix); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return $prefix; |
@@ -14,13 +14,13 @@ |
||
14 | 14 | * Tested up to: 5.8 |
15 | 15 | */ |
16 | 16 | |
17 | -if ( ! defined( 'ABSPATH' ) ) { |
|
17 | +if (!defined('ABSPATH')) { |
|
18 | 18 | exit; |
19 | 19 | } |
20 | 20 | |
21 | -if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) { |
|
21 | +if (!class_exists('AyeCode_Deactivation_Survey')) { |
|
22 | 22 | // include the class if needed |
23 | - include_once( dirname( __FILE__ ) . "/wp-deactivation-survey.php" ); |
|
23 | + include_once(dirname(__FILE__) . "/wp-deactivation-survey.php"); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 |
@@ -7,10 +7,10 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | <span>{{form_element.text}}</span> |
14 | 14 | <a target='_blank' href="#"> |
15 | - <?php echo esc_html( wpinv_get_ip() ); ?> <i class='fa fa-external-link-square' aria-hidden='true'></i> |
|
15 | + <?php echo esc_html(wpinv_get_ip()); ?> <i class='fa fa-external-link-square' aria-hidden='true'></i> |
|
16 | 16 | </a> |
@@ -6,35 +6,35 @@ discard block |
||
6 | 6 | |
7 | 7 | class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5 |
8 | 8 | { |
9 | - public static $files = array ( |
|
9 | + public static $files = array( |
|
10 | 10 | 'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php', |
11 | 11 | '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php', |
12 | 12 | '42671a413efb740d7040437ff2a982cd' => __DIR__ . '/..' . '/ayecode/wp-super-duper/sd-functions.php', |
13 | 13 | ); |
14 | 14 | |
15 | - public static $prefixLengthsPsr4 = array ( |
|
15 | + public static $prefixLengthsPsr4 = array( |
|
16 | 16 | 'M' => |
17 | - array ( |
|
17 | + array( |
|
18 | 18 | 'MaxMind\\Db\\' => 11, |
19 | 19 | ), |
20 | 20 | 'C' => |
21 | - array ( |
|
21 | + array( |
|
22 | 22 | 'Composer\\Installers\\' => 20, |
23 | 23 | ), |
24 | 24 | ); |
25 | 25 | |
26 | - public static $prefixDirsPsr4 = array ( |
|
26 | + public static $prefixDirsPsr4 = array( |
|
27 | 27 | 'MaxMind\\Db\\' => |
28 | - array ( |
|
28 | + array( |
|
29 | 29 | 0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db', |
30 | 30 | ), |
31 | 31 | 'Composer\\Installers\\' => |
32 | - array ( |
|
32 | + array( |
|
33 | 33 | 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers', |
34 | 34 | ), |
35 | 35 | ); |
36 | 36 | |
37 | - public static $classMap = array ( |
|
37 | + public static $classMap = array( |
|
38 | 38 | 'AyeCode_Connect_Helper' => __DIR__ . '/..' . '/ayecode/ayecode-connect-helper/ayecode-connect-helper.php', |
39 | 39 | 'AyeCode_Deactivation_Survey' => __DIR__ . '/..' . '/ayecode/wp-deactivation-survey/wp-deactivation-survey.php', |
40 | 40 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public static function getInitializer(ClassLoader $loader) |
45 | 45 | { |
46 | - return \Closure::bind(function () use ($loader) { |
|
46 | + return \Closure::bind(function() use ($loader) { |
|
47 | 47 | $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4; |
48 | 48 | $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4; |
49 | 49 | $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap; |
@@ -312,9 +312,9 @@ |
||
312 | 312 | foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
313 | 313 | if (isset(self::$installedByVendor[$vendorDir])) { |
314 | 314 | $installed[] = self::$installedByVendor[$vendorDir]; |
315 | - } elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
316 | - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
|
317 | - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
315 | + } elseif (is_file($vendorDir . '/composer/installed.php')) { |
|
316 | + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir . '/composer/installed.php'; |
|
317 | + if (null === self::$installed && strtr($vendorDir . '/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
318 | 318 | self::$installed = $installed[count($installed) - 1]; |
319 | 319 | } |
320 | 320 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | } |
15 | 15 | if (!ini_get('display_errors')) { |
16 | 16 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
17 | - fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); |
|
17 | + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL . PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL . PHP_EOL); |
|
18 | 18 | } elseif (!headers_sent()) { |
19 | - echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; |
|
19 | + echo 'Composer detected issues in your platform:' . PHP_EOL . PHP_EOL . str_replace('You are running ' . PHP_VERSION . '.', '', implode(PHP_EOL, $issues)) . PHP_EOL . PHP_EOL; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | trigger_error( |
@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | * @package GetPaid |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | -include plugin_dir_path( __FILE__ ) . 'rapid-addon.php'; |
|
10 | +include plugin_dir_path(__FILE__) . 'rapid-addon.php'; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * WP All Import class. |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | public function __construct() { |
35 | 35 | |
36 | 36 | // Init each store separately. |
37 | - foreach ( array_keys( $this->datastores ) as $key ) { |
|
38 | - $this->init_store( $key ); |
|
37 | + foreach (array_keys($this->datastores) as $key) { |
|
38 | + $this->init_store($key); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | } |
@@ -43,51 +43,51 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * Inits a store. |
45 | 45 | */ |
46 | - public function init_store( $key ) { |
|
46 | + public function init_store($key) { |
|
47 | 47 | |
48 | 48 | // Register the add-on. |
49 | - $this->add_ons[ $key ] = new RapidAddon( 'GetPaid', 'getpaid_wp_al_import_' . $key ); |
|
49 | + $this->add_ons[$key] = new RapidAddon('GetPaid', 'getpaid_wp_al_import_' . $key); |
|
50 | 50 | |
51 | 51 | // Create import function. |
52 | - $import_function = function ( $post_id, $data, $import_options, $_post ) use ( $key ) { |
|
53 | - $this->import_store( $key, $post_id, $data, $import_options, $_post ); |
|
52 | + $import_function = function($post_id, $data, $import_options, $_post) use ($key) { |
|
53 | + $this->import_store($key, $post_id, $data, $import_options, $_post); |
|
54 | 54 | }; |
55 | 55 | |
56 | - $this->add_ons[ $key ]->set_import_function( $import_function ); |
|
56 | + $this->add_ons[$key]->set_import_function($import_function); |
|
57 | 57 | |
58 | 58 | // Register store fields. |
59 | - $this->add_store_fields( $key ); |
|
59 | + $this->add_store_fields($key); |
|
60 | 60 | |
61 | 61 | // Only load on the correct post type. |
62 | - $this->add_ons[ $key ]->run( array( 'post_types' => array( 'wpi_' . $key ) ) ); |
|
62 | + $this->add_ons[$key]->run(array('post_types' => array('wpi_' . $key))); |
|
63 | 63 | |
64 | 64 | // Disable images. |
65 | - $this->add_ons[ $key ]->disable_default_images(); |
|
65 | + $this->add_ons[$key]->disable_default_images(); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Retrieves store fields. |
71 | 71 | */ |
72 | - public function get_store_fields( $key ) { |
|
72 | + public function get_store_fields($key) { |
|
73 | 73 | |
74 | 74 | // Fetch from data/invoice-schema.php, from data/discount-schema.php, from data/item-schema.php |
75 | - $fields = wpinv_get_data( $key . '-schema' ); |
|
75 | + $fields = wpinv_get_data($key . '-schema'); |
|
76 | 76 | |
77 | - if ( empty( $fields ) ) { |
|
77 | + if (empty($fields)) { |
|
78 | 78 | return array(); |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Clean the fields. |
82 | 82 | $prepared = array(); |
83 | - foreach ( $fields as $id => $field ) { |
|
83 | + foreach ($fields as $id => $field) { |
|
84 | 84 | |
85 | 85 | // Skip read only fields. |
86 | - if ( ! empty( $field['readonly'] ) ) { |
|
86 | + if (!empty($field['readonly'])) { |
|
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | |
90 | - $prepared[ $id ] = $field; |
|
90 | + $prepared[$id] = $field; |
|
91 | 91 | |
92 | 92 | } |
93 | 93 | |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Registers store fields. |
100 | 100 | */ |
101 | - public function add_store_fields( $key ) { |
|
101 | + public function add_store_fields($key) { |
|
102 | 102 | |
103 | - foreach ( $this->get_store_fields( $key ) as $field_id => $data ) { |
|
104 | - $this->add_ons[ $key ]->add_field( $field_id, $data['description'], 'text' ); |
|
103 | + foreach ($this->get_store_fields($key) as $field_id => $data) { |
|
104 | + $this->add_ons[$key]->add_field($field_id, $data['description'], 'text'); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -109,36 +109,36 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * Handles store imports. |
111 | 111 | */ |
112 | - public function import_store( $key, $post_id, $data, $import_options, $_post ) { |
|
112 | + public function import_store($key, $post_id, $data, $import_options, $_post) { |
|
113 | 113 | |
114 | 114 | // Is the store class set? |
115 | - if ( ! isset( $this->datastores[ $key ] ) ) { |
|
115 | + if (!isset($this->datastores[$key])) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
119 | 119 | /**@var GetPaid_Data */ |
120 | - $data_store = new $this->datastores[ $key ]( $post_id ); |
|
120 | + $data_store = new $this->datastores[$key]($post_id); |
|
121 | 121 | |
122 | 122 | // Abort if the invoice/item/discount does not exist. |
123 | - if ( ! $data_store->exists() ) { |
|
123 | + if (!$data_store->exists()) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | 127 | // Prepare data props. |
128 | 128 | $prepared = array(); |
129 | 129 | |
130 | - foreach ( array_keys( $this->get_store_fields( $key ) ) as $field ) { |
|
130 | + foreach (array_keys($this->get_store_fields($key)) as $field) { |
|
131 | 131 | // Make sure the user has allowed this field to be updated. |
132 | - if ( empty( $_post['ID'] ) || $this->add_ons[ $key ]->can_update_meta( $field, $import_options ) ) { |
|
132 | + if (empty($_post['ID']) || $this->add_ons[$key]->can_update_meta($field, $import_options)) { |
|
133 | 133 | |
134 | 134 | // Update the custom field with the imported data. |
135 | - $prepared[ $field ] = $data[ $field ]; |
|
135 | + $prepared[$field] = $data[$field]; |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Only update if we have something to update. |
140 | - if ( ! empty( $prepared ) ) { |
|
141 | - $data_store->set_props( $prepared ); |
|
140 | + if (!empty($prepared)) { |
|
141 | + $data_store->set_props($prepared); |
|
142 | 142 | $data_store->save(); |
143 | 143 | } |
144 | 144 |