Completed
Push — develop ( 8a861b...6459a3 )
by Remco
04:56
created
classes/Forms/FormProcessor.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param Plugin $plugin Plugin.
25 25
 	 */
26
-	public function __construct( $plugin ) {
26
+	public function __construct($plugin) {
27 27
 		$this->plugin = $plugin;
28 28
 
29 29
 		// Actions.
30
-		add_action( 'init', array( $this, 'init' ) );
30
+		add_action('init', array($this, 'init'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -39,58 +39,58 @@  discard block
 block discarded – undo
39 39
 		$pronamic_pay_errors = array();
40 40
 
41 41
 		// Nonce.
42
-		if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_nonce' ) ) {
42
+		if ( ! filter_has_var(INPUT_POST, 'pronamic_pay_nonce')) {
43 43
 			return;
44 44
 		}
45 45
 
46
-		$nonce = filter_input( INPUT_POST, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING );
46
+		$nonce = filter_input(INPUT_POST, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING);
47 47
 
48
-		if ( ! wp_verify_nonce( $nonce, 'pronamic_pay' ) ) {
48
+		if ( ! wp_verify_nonce($nonce, 'pronamic_pay')) {
49 49
 			return;
50 50
 		}
51 51
 
52 52
 		// Validate.
53 53
 		$valid = $this->validate();
54 54
 
55
-		if ( ! $valid ) {
55
+		if ( ! $valid) {
56 56
 			return;
57 57
 		}
58 58
 
59 59
 		// Gateway.
60
-		$id = filter_input( INPUT_POST, 'pronamic_pay_form_id', FILTER_VALIDATE_INT );
60
+		$id = filter_input(INPUT_POST, 'pronamic_pay_form_id', FILTER_VALIDATE_INT);
61 61
 
62
-		$config_id = get_post_meta( $id, '_pronamic_payment_form_config_id', true );
62
+		$config_id = get_post_meta($id, '_pronamic_payment_form_config_id', true);
63 63
 
64
-		$gateway = \Pronamic\WordPress\Pay\Plugin::get_gateway( $config_id );
64
+		$gateway = \Pronamic\WordPress\Pay\Plugin::get_gateway($config_id);
65 65
 
66
-		if ( ! $gateway ) {
66
+		if ( ! $gateway) {
67 67
 			return;
68 68
 		}
69 69
 
70 70
 		// Data.
71 71
 		$data = new PaymentFormData();
72 72
 
73
-		$payment = \Pronamic\WordPress\Pay\Plugin::start( $config_id, $gateway, $data );
73
+		$payment = \Pronamic\WordPress\Pay\Plugin::start($config_id, $gateway, $data);
74 74
 
75 75
 		$error = $gateway->get_error();
76 76
 
77
-		if ( is_wp_error( $error ) ) {
78
-			\Pronamic\WordPress\Pay\Plugin::render_errors( $error );
77
+		if (is_wp_error($error)) {
78
+			\Pronamic\WordPress\Pay\Plugin::render_errors($error);
79 79
 
80 80
 			exit;
81 81
 		}
82 82
 
83 83
 		// @see https://github.com/WordImpress/Give/blob/1.1/includes/payments/functions.php#L172-L178.
84 84
 		// @see https://github.com/woothemes/woocommerce/blob/2.4.3/includes/wc-user-functions.php#L36-L118.
85
-		$first_name = filter_input( INPUT_POST, 'pronamic_pay_first_name', FILTER_SANITIZE_STRING );
86
-		$last_name  = filter_input( INPUT_POST, 'pronamic_pay_last_name', FILTER_SANITIZE_STRING );
87
-		$email      = filter_input( INPUT_POST, 'pronamic_pay_email', FILTER_VALIDATE_EMAIL );
85
+		$first_name = filter_input(INPUT_POST, 'pronamic_pay_first_name', FILTER_SANITIZE_STRING);
86
+		$last_name  = filter_input(INPUT_POST, 'pronamic_pay_last_name', FILTER_SANITIZE_STRING);
87
+		$email      = filter_input(INPUT_POST, 'pronamic_pay_email', FILTER_VALIDATE_EMAIL);
88 88
 
89
-		$user = get_user_by( 'email', $email );
89
+		$user = get_user_by('email', $email);
90 90
 
91
-		if ( ! $user ) {
91
+		if ( ! $user) {
92 92
 			// Make a random string for password.
93
-			$password = wp_generate_password( 10 );
93
+			$password = wp_generate_password(10);
94 94
 
95 95
 			// Make a user with the username as the email.
96 96
 			$user_id = wp_insert_user(
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			);
106 106
 
107 107
 			// User.
108
-			$user = new \WP_User( $user_id );
108
+			$user = new \WP_User($user_id);
109 109
 		}
110 110
 
111 111
 		wp_update_post(
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			)
116 116
 		);
117 117
 
118
-		$gateway->redirect( $payment );
118
+		$gateway->redirect($payment);
119 119
 
120 120
 		exit;
121 121
 	}
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
 		global $pronamic_pay_errors;
130 130
 
131 131
 		// First Name.
132
-		$first_name = filter_input( INPUT_POST, 'pronamic_pay_first_name', FILTER_SANITIZE_STRING );
132
+		$first_name = filter_input(INPUT_POST, 'pronamic_pay_first_name', FILTER_SANITIZE_STRING);
133 133
 
134
-		if ( empty( $first_name ) ) {
135
-			$pronamic_pay_errors['first_name'] = __( 'Please enter your first name', 'pronamic_ideal' );
134
+		if (empty($first_name)) {
135
+			$pronamic_pay_errors['first_name'] = __('Please enter your first name', 'pronamic_ideal');
136 136
 		}
137 137
 
138 138
 		// E-mail.
139
-		$email = filter_input( INPUT_POST, 'pronamic_pay_email', FILTER_VALIDATE_EMAIL );
139
+		$email = filter_input(INPUT_POST, 'pronamic_pay_email', FILTER_VALIDATE_EMAIL);
140 140
 
141
-		if ( empty( $email ) ) {
142
-			$pronamic_pay_errors['email'] = __( 'Please enter a valid email address', 'pronamic_ideal' );
141
+		if (empty($email)) {
142
+			$pronamic_pay_errors['email'] = __('Please enter a valid email address', 'pronamic_ideal');
143 143
 		}
144 144
 
145
-		return empty( $pronamic_pay_errors );
145
+		return empty($pronamic_pay_errors);
146 146
 	}
147 147
 }
Please login to merge, or discard this patch.
classes/Forms/FormScripts.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,22 +23,22 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param Plugin $plugin Plugin.
25 25
 	 */
26
-	public function __construct( $plugin ) {
26
+	public function __construct($plugin) {
27 27
 		$this->plugin = $plugin;
28 28
 
29
-		add_action( 'wp_enqueue_scripts', array( $this, 'register' ) );
30
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ) );
29
+		add_action('wp_enqueue_scripts', array($this, 'register'));
30
+		add_action('wp_enqueue_scripts', array($this, 'enqueue'));
31 31
 	}
32 32
 
33 33
 	/**
34 34
 	 * Register.
35 35
 	 */
36 36
 	public function register() {
37
-		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
37
+		$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
38 38
 
39 39
 		wp_register_style(
40 40
 			'pronamic-pay-forms',
41
-			plugins_url( 'css/forms' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file ),
41
+			plugins_url('css/forms' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file),
42 42
 			array(),
43 43
 			$this->plugin->get_version()
44 44
 		);
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 		$post = get_post();
55 55
 
56 56
 		if (
57
-			is_object( $post ) && has_shortcode( $post->post_content, 'pronamic_payment_form' )
57
+			is_object($post) && has_shortcode($post->post_content, 'pronamic_payment_form')
58 58
 				||
59
-			is_singular( 'pronamic_pay_form' )
59
+			is_singular('pronamic_pay_form')
60 60
 		) {
61
-			wp_enqueue_style( 'pronamic-pay-forms' );
61
+			wp_enqueue_style('pronamic-pay-forms');
62 62
 		}
63 63
 	}
64 64
 }
Please login to merge, or discard this patch.
classes/Forms/PaymentFormData.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @return string
47 47
 	 */
48 48
 	public function get_source_id() {
49
-		return filter_input( INPUT_POST, 'pronamic_pay_form_id', FILTER_VALIDATE_INT );
49
+		return filter_input(INPUT_POST, 'pronamic_pay_form_id', FILTER_VALIDATE_INT);
50 50
 	}
51 51
 
52 52
 	/**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @return string
57 57
 	 */
58 58
 	public function get_description() {
59
-		return sprintf( __( 'Payment Form %s', 'pronamic_ideal' ), $this->get_order_id() );
59
+		return sprintf(__('Payment Form %s', 'pronamic_ideal'), $this->get_order_id());
60 60
 	}
61 61
 
62 62
 	/**
@@ -80,25 +80,25 @@  discard block
 block discarded – undo
80 80
 		$items = new Items();
81 81
 
82 82
 		// Amount.
83
-		$amount_method = get_post_meta( $this->get_source_id(), '_pronamic_payment_form_amount_method', true );
84
-		$amount        = filter_input( INPUT_POST, 'pronamic_pay_amount', FILTER_SANITIZE_STRING );
83
+		$amount_method = get_post_meta($this->get_source_id(), '_pronamic_payment_form_amount_method', true);
84
+		$amount        = filter_input(INPUT_POST, 'pronamic_pay_amount', FILTER_SANITIZE_STRING);
85 85
 
86
-		if ( 'other' === $amount ) {
87
-			$amount = filter_input( INPUT_POST, 'pronamic_pay_amount_other', FILTER_SANITIZE_STRING );
86
+		if ('other' === $amount) {
87
+			$amount = filter_input(INPUT_POST, 'pronamic_pay_amount_other', FILTER_SANITIZE_STRING);
88 88
 
89
-			$amount = Core_util::string_to_amount( $amount );
90
-		} elseif ( in_array( $amount_method, array( FormPostType::AMOUNT_METHOD_CHOICES_ONLY, FormPostType::AMOUNT_METHOD_CHOICES_AND_INPUT ), true ) ) {
89
+			$amount = Core_util::string_to_amount($amount);
90
+		} elseif (in_array($amount_method, array(FormPostType::AMOUNT_METHOD_CHOICES_ONLY, FormPostType::AMOUNT_METHOD_CHOICES_AND_INPUT), true)) {
91 91
 			$amount /= 100;
92 92
 		}
93 93
 
94 94
 		// Item.
95 95
 		$item = new Item();
96
-		$item->setNumber( $this->get_order_id() );
97
-		$item->setDescription( sprintf( __( 'Payment %s', 'pronamic_ideal' ), $this->get_order_id() ) );
98
-		$item->setPrice( $amount );
99
-		$item->setQuantity( 1 );
96
+		$item->setNumber($this->get_order_id());
97
+		$item->setDescription(sprintf(__('Payment %s', 'pronamic_ideal'), $this->get_order_id()));
98
+		$item->setPrice($amount);
99
+		$item->setQuantity(1);
100 100
 
101
-		$items->addItem( $item );
101
+		$items->addItem($item);
102 102
 
103 103
 		return $items;
104 104
 	}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @return string
120 120
 	 */
121 121
 	public function get_email() {
122
-		return filter_input( INPUT_POST, 'pronamic_pay_email', FILTER_SANITIZE_EMAIL );
122
+		return filter_input(INPUT_POST, 'pronamic_pay_email', FILTER_SANITIZE_EMAIL);
123 123
 	}
124 124
 
125 125
 	/**
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 * @return string
129 129
 	 */
130 130
 	public function get_customer_name() {
131
-		$first_name = filter_input( INPUT_POST, 'pronamic_pay_first_name', FILTER_SANITIZE_STRING );
132
-		$last_name  = filter_input( INPUT_POST, 'pronamic_pay_last_name', FILTER_SANITIZE_STRING );
131
+		$first_name = filter_input(INPUT_POST, 'pronamic_pay_first_name', FILTER_SANITIZE_STRING);
132
+		$last_name  = filter_input(INPUT_POST, 'pronamic_pay_last_name', FILTER_SANITIZE_STRING);
133 133
 
134 134
 		return $first_name . ' ' . $last_name;
135 135
 	}
Please login to merge, or discard this patch.
classes/Plugin.php 1 patch
Spacing   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param string $file The plugin file.
62 62
 	 */
63
-	public static function instance( $file = null ) {
64
-		if ( is_null( self::$instance ) ) {
65
-			self::$instance = new self( $file );
63
+	public static function instance($file = null) {
64
+		if (is_null(self::$instance)) {
65
+			self::$instance = new self($file);
66 66
 
67 67
 			// Backward compatibility.
68 68
 			self::$file    = $file;
69
-			self::$dirname = dirname( $file );
69
+			self::$dirname = dirname($file);
70 70
 		}
71 71
 
72 72
 		return self::$instance;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		Extensions\RestrictContentPro\Extension::bootstrap();
98 98
 
99 99
 		// Settings.
100
-		$this->settings = new Settings( $this );
100
+		$this->settings = new Settings($this);
101 101
 
102 102
 		// Data Stores.
103 103
 		$this->payments_data_store      = new Payments\PaymentsDataStoreCPT();
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 		$this->subscription_post_type = new SubscriptionPostType();
110 110
 
111 111
 		// License Manager.
112
-		$this->license_manager = new LicenseManager( $this );
112
+		$this->license_manager = new LicenseManager($this);
113 113
 
114 114
 		// Modules.
115
-		$this->forms_module         = new Forms\FormsModule( $this );
116
-		$this->subscriptions_module = new Subscriptions\SubscriptionsModule( $this );
115
+		$this->forms_module         = new Forms\FormsModule($this);
116
+		$this->subscriptions_module = new Subscriptions\SubscriptionsModule($this);
117 117
 
118 118
 		// Payment Status Checker.
119 119
 		$this->payment_status_checker = new Payments\StatusChecker();
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 		$this->google_analytics_ecommerce = new GoogleAnalyticsEcommerce();
123 123
 
124 124
 		// Admin.
125
-		if ( is_admin() ) {
126
-			$this->admin = new Admin\AdminModule( $this );
125
+		if (is_admin()) {
126
+			$this->admin = new Admin\AdminModule($this);
127 127
 		}
128 128
 
129 129
 		/*
@@ -141,20 +141,20 @@  discard block
 block discarded – undo
141 141
 		 * @see https://github.com/wp-e-commerce/WP-e-Commerce/blob/branch-3.11.2/wp-shopping-cart.php#L54
142 142
 		 * @see https://github.com/wp-e-commerce/WP-e-Commerce/blob/branch-3.11.2/wp-shopping-cart.php#L296-L297
143 143
 		 */
144
-		add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ), 5 );
144
+		add_action('plugins_loaded', array($this, 'plugins_loaded'), 5);
145 145
 
146 146
 		// Exclude payment and subscription notes.
147
-		add_filter( 'comments_clauses', array( $this, 'exclude_comment_notes' ), 10, 2 );
147
+		add_filter('comments_clauses', array($this, 'exclude_comment_notes'), 10, 2);
148 148
 
149 149
 		// Payment redirect URL.
150
-		add_filter( 'pronamic_payment_redirect_url', array( $this, 'payment_redirect_url' ), 5, 2 );
150
+		add_filter('pronamic_payment_redirect_url', array($this, 'payment_redirect_url'), 5, 2);
151 151
 
152 152
 		// Plugin locale.
153
-		add_filter( 'plugin_locale', array( $this, 'plugin_locale' ), 10, 2 );
153
+		add_filter('plugin_locale', array($this, 'plugin_locale'), 10, 2);
154 154
 
155 155
 		// If WordPress is loaded check on returns and maybe redirect requests.
156
-		add_action( 'wp_loaded', array( $this, 'handle_returns' ) );
157
-		add_action( 'wp_loaded', array( $this, 'maybe_redirect' ) );
156
+		add_action('wp_loaded', array($this, 'handle_returns'));
157
+		add_action('wp_loaded', array($this, 'maybe_redirect'));
158 158
 	}
159 159
 
160 160
 	/**
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return string
184 184
 	 */
185 185
 	public function get_plugin_dir_path() {
186
-		return plugin_dir_path( $this->get_file() );
186
+		return plugin_dir_path($this->get_file());
187 187
 	}
188 188
 
189 189
 	/**
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return array
196 196
 	 */
197
-	public function exclude_comment_notes( $clauses, $query ) {
197
+	public function exclude_comment_notes($clauses, $query) {
198 198
 		$type = $query->query_vars['type'];
199 199
 
200 200
 		// Ignore payment notes comments if it's not specifically requested.
201
-		if ( 'payment_note' !== $type ) {
201
+		if ('payment_note' !== $type) {
202 202
 			$clauses['where'] .= " AND comment_type != 'payment_note'";
203 203
 		}
204 204
 
@@ -213,40 +213,40 @@  discard block
 block discarded – undo
213 213
 	 *
214 214
 	 * @return string
215 215
 	 */
216
-	public function payment_redirect_url( $url, $payment ) {
216
+	public function payment_redirect_url($url, $payment) {
217 217
 		$page_id = null;
218 218
 
219
-		switch ( $payment->status ) {
219
+		switch ($payment->status) {
220 220
 			case Core\Statuses::CANCELLED:
221
-				$page_id = pronamic_pay_get_page_id( 'cancel' );
221
+				$page_id = pronamic_pay_get_page_id('cancel');
222 222
 
223 223
 				break;
224 224
 			case Core\Statuses::EXPIRED:
225
-				$page_id = pronamic_pay_get_page_id( 'expired' );
225
+				$page_id = pronamic_pay_get_page_id('expired');
226 226
 
227 227
 				break;
228 228
 			case Core\Statuses::FAILURE:
229
-				$page_id = pronamic_pay_get_page_id( 'error' );
229
+				$page_id = pronamic_pay_get_page_id('error');
230 230
 
231 231
 				break;
232 232
 			case Core\Statuses::OPEN:
233
-				$page_id = pronamic_pay_get_page_id( 'unknown' );
233
+				$page_id = pronamic_pay_get_page_id('unknown');
234 234
 
235 235
 				break;
236 236
 			case Core\Statuses::SUCCESS:
237
-				$page_id = pronamic_pay_get_page_id( 'completed' );
237
+				$page_id = pronamic_pay_get_page_id('completed');
238 238
 
239 239
 				break;
240 240
 			default:
241
-				$page_id = pronamic_pay_get_page_id( 'unknown' );
241
+				$page_id = pronamic_pay_get_page_id('unknown');
242 242
 
243 243
 				break;
244 244
 		}
245 245
 
246
-		if ( ! empty( $page_id ) ) {
247
-			$page_url = get_permalink( $page_id );
246
+		if ( ! empty($page_id)) {
247
+			$page_url = get_permalink($page_id);
248 248
 
249
-			if ( false !== $page_url ) {
249
+			if (false !== $page_url) {
250 250
 				$url = $page_url;
251 251
 			}
252 252
 		}
@@ -260,43 +260,43 @@  discard block
 block discarded – undo
260 260
 	 * @param null $payment      The payment to update.
261 261
 	 * @param bool $can_redirect Flag to indicate if redirect is allowed after the payment update.
262 262
 	 */
263
-	public static function update_payment( $payment = null, $can_redirect = true ) {
264
-		if ( empty( $payment ) ) {
263
+	public static function update_payment($payment = null, $can_redirect = true) {
264
+		if (empty($payment)) {
265 265
 			return;
266 266
 		}
267 267
 
268
-		$gateway = Plugin::get_gateway( $payment->config_id );
268
+		$gateway = Plugin::get_gateway($payment->config_id);
269 269
 
270
-		if ( empty( $gateway ) ) {
270
+		if (empty($gateway)) {
271 271
 			return;
272 272
 		}
273 273
 
274 274
 		$amount = $payment->get_amount();
275 275
 
276
-		if ( empty( $amount ) ) {
277
-			$payment->set_status( Core\Statuses::SUCCESS );
276
+		if (empty($amount)) {
277
+			$payment->set_status(Core\Statuses::SUCCESS);
278 278
 		} else {
279
-			$gateway->update_status( $payment );
279
+			$gateway->update_status($payment);
280 280
 
281
-			if ( $gateway->has_error() ) {
282
-				foreach ( $gateway->error->get_error_codes() as $code ) {
283
-					$payment->add_note( sprintf( '%s: %s', $code, $gateway->error->get_error_message( $code ) ) );
281
+			if ($gateway->has_error()) {
282
+				foreach ($gateway->error->get_error_codes() as $code) {
283
+					$payment->add_note(sprintf('%s: %s', $code, $gateway->error->get_error_message($code)));
284 284
 				}
285 285
 			}
286 286
 		}
287 287
 
288 288
 		global $pronamic_ideal;
289 289
 
290
-		$pronamic_ideal->payments_data_store->update( $payment );
290
+		$pronamic_ideal->payments_data_store->update($payment);
291 291
 
292
-		if ( defined( 'DOING_CRON' ) && ( empty( $payment->status ) || Statuses::OPEN === $payment->status ) ) {
292
+		if (defined('DOING_CRON') && (empty($payment->status) || Statuses::OPEN === $payment->status)) {
293 293
 			$can_redirect = false;
294 294
 		}
295 295
 
296
-		if ( $can_redirect ) {
296
+		if ($can_redirect) {
297 297
 			$url = $payment->get_return_redirect_url();
298 298
 
299
-			wp_redirect( $url );
299
+			wp_redirect($url);
300 300
 
301 301
 			exit;
302 302
 		}
@@ -306,27 +306,27 @@  discard block
 block discarded – undo
306 306
 	 * Handle returns.
307 307
 	 */
308 308
 	public function handle_returns() {
309
-		if ( ! filter_has_var( INPUT_GET, 'payment' ) ) {
309
+		if ( ! filter_has_var(INPUT_GET, 'payment')) {
310 310
 			return;
311 311
 		}
312 312
 
313
-		$payment_id = filter_input( INPUT_GET, 'payment', FILTER_SANITIZE_NUMBER_INT );
313
+		$payment_id = filter_input(INPUT_GET, 'payment', FILTER_SANITIZE_NUMBER_INT);
314 314
 
315
-		$payment = get_pronamic_payment( $payment_id );
315
+		$payment = get_pronamic_payment($payment_id);
316 316
 
317 317
 		// Check if payment key is valid.
318 318
 		$valid_key = false;
319 319
 
320
-		if ( empty( $payment->key ) ) {
320
+		if (empty($payment->key)) {
321 321
 			$valid_key = true;
322
-		} elseif ( filter_has_var( INPUT_GET, 'key' ) ) {
323
-			$key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_STRING );
322
+		} elseif (filter_has_var(INPUT_GET, 'key')) {
323
+			$key = filter_input(INPUT_GET, 'key', FILTER_SANITIZE_STRING);
324 324
 
325
-			$valid_key = ( $key === $payment->key );
325
+			$valid_key = ($key === $payment->key);
326 326
 		}
327 327
 
328
-		if ( ! $valid_key ) {
329
-			wp_redirect( home_url() );
328
+		if ( ! $valid_key) {
329
+			wp_redirect(home_url());
330 330
 
331 331
 			exit;
332 332
 		}
@@ -336,71 +336,71 @@  discard block
 block discarded – undo
336 336
 
337 337
 		// Check if the request is an callback request.
338 338
 		// Sisow gatway will extend callback requests with querystring "callback=true".
339
-		if ( filter_has_var( INPUT_GET, 'callback' ) && filter_input( INPUT_GET, 'callback', FILTER_VALIDATE_BOOLEAN ) ) {
339
+		if (filter_has_var(INPUT_GET, 'callback') && filter_input(INPUT_GET, 'callback', FILTER_VALIDATE_BOOLEAN)) {
340 340
 			$should_redirect = false;
341 341
 		}
342 342
 
343 343
 		// Check if the request is an notify request.
344 344
 		// Sisow gatway will extend callback requests with querystring "notify=true".
345
-		if ( filter_has_var( INPUT_GET, 'notify' ) && filter_input( INPUT_GET, 'notify', FILTER_VALIDATE_BOOLEAN ) ) {
345
+		if (filter_has_var(INPUT_GET, 'notify') && filter_input(INPUT_GET, 'notify', FILTER_VALIDATE_BOOLEAN)) {
346 346
 			$should_redirect = false;
347 347
 		}
348 348
 
349
-		self::update_payment( $payment, $should_redirect );
349
+		self::update_payment($payment, $should_redirect);
350 350
 	}
351 351
 
352 352
 	/**
353 353
 	 * Maybe redirect.
354 354
 	 */
355 355
 	public function maybe_redirect() {
356
-		if ( ! filter_has_var( INPUT_GET, 'payment_redirect' ) ) {
356
+		if ( ! filter_has_var(INPUT_GET, 'payment_redirect')) {
357 357
 			return;
358 358
 		}
359 359
 
360
-		$payment_id = filter_input( INPUT_GET, 'payment_redirect', FILTER_SANITIZE_NUMBER_INT );
360
+		$payment_id = filter_input(INPUT_GET, 'payment_redirect', FILTER_SANITIZE_NUMBER_INT);
361 361
 
362
-		$payment = get_pronamic_payment( $payment_id );
362
+		$payment = get_pronamic_payment($payment_id);
363 363
 
364 364
 		// HTML Answer.
365
-		$html_answer = $payment->get_meta( 'ogone_directlink_html_answer' );
365
+		$html_answer = $payment->get_meta('ogone_directlink_html_answer');
366 366
 
367
-		if ( ! empty( $html_answer ) ) {
367
+		if ( ! empty($html_answer)) {
368 368
 			echo $html_answer; // WPCS: XSS ok.
369 369
 
370 370
 			exit;
371 371
 		}
372 372
 
373
-		$redirect_message = $payment->get_meta( 'payment_redirect_message' );
373
+		$redirect_message = $payment->get_meta('payment_redirect_message');
374 374
 
375
-		if ( ! empty( $redirect_message ) ) {
376
-			$key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_STRING );
375
+		if ( ! empty($redirect_message)) {
376
+			$key = filter_input(INPUT_GET, 'key', FILTER_SANITIZE_STRING);
377 377
 
378
-			if ( $key !== $payment->key ) {
379
-				wp_redirect( home_url() );
378
+			if ($key !== $payment->key) {
379
+				wp_redirect(home_url());
380 380
 
381 381
 				exit;
382 382
 			}
383 383
 
384 384
 			// @see https://github.com/woothemes/woocommerce/blob/2.3.11/includes/class-wc-cache-helper.php
385 385
 			// @see https://www.w3-edge.com/products/w3-total-cache/
386
-			if ( ! defined( 'DONOTCACHEPAGE' ) ) {
387
-				define( 'DONOTCACHEPAGE', true );
386
+			if ( ! defined('DONOTCACHEPAGE')) {
387
+				define('DONOTCACHEPAGE', true);
388 388
 			}
389 389
 
390
-			if ( ! defined( 'DONOTCACHEDB' ) ) {
391
-				define( 'DONOTCACHEDB', true );
390
+			if ( ! defined('DONOTCACHEDB')) {
391
+				define('DONOTCACHEDB', true);
392 392
 			}
393 393
 
394
-			if ( ! defined( 'DONOTMINIFY' ) ) {
395
-				define( 'DONOTMINIFY', true );
394
+			if ( ! defined('DONOTMINIFY')) {
395
+				define('DONOTMINIFY', true);
396 396
 			}
397 397
 
398
-			if ( ! defined( 'DONOTCDN' ) ) {
399
-				define( 'DONOTCDN', true );
398
+			if ( ! defined('DONOTCDN')) {
399
+				define('DONOTCDN', true);
400 400
 			}
401 401
 
402
-			if ( ! defined( 'DONOTCACHEOBJECT' ) ) {
403
-				define( 'DONOTCACHEOBJECT', true );
402
+			if ( ! defined('DONOTCACHEOBJECT')) {
403
+				define('DONOTCACHEOBJECT', true);
404 404
 			}
405 405
 
406 406
 			nocache_headers();
@@ -410,22 +410,22 @@  discard block
 block discarded – undo
410 410
 			exit;
411 411
 		}
412 412
 
413
-		$gateway = Plugin::get_gateway( $payment->config_id );
413
+		$gateway = Plugin::get_gateway($payment->config_id);
414 414
 
415
-		if ( $gateway && $gateway->is_html_form() ) {
416
-			$gateway->start( $payment );
415
+		if ($gateway && $gateway->is_html_form()) {
416
+			$gateway->start($payment);
417 417
 
418 418
 			$error = $gateway->get_error();
419 419
 
420
-			if ( is_wp_error( $error ) ) {
421
-				Plugin::render_errors( $error );
420
+			if (is_wp_error($error)) {
421
+				Plugin::render_errors($error);
422 422
 			} else {
423
-				$gateway->redirect( $payment );
423
+				$gateway->redirect($payment);
424 424
 			}
425 425
 		}
426 426
 
427
-		if ( ! empty( $payment->action_url ) ) {
428
-			wp_redirect( $payment->action_url );
427
+		if ( ! empty($payment->action_url)) {
428
+			wp_redirect($payment->action_url);
429 429
 
430 430
 			exit;
431 431
 		}
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
 	public static function get_number_payments() {
440 440
 		$number = false;
441 441
 
442
-		$count = wp_count_posts( 'pronamic_payment' );
442
+		$count = wp_count_posts('pronamic_payment');
443 443
 
444
-		if ( isset( $count, $count->payment_completed ) ) {
445
-			$number = intval( $count->payment_completed );
444
+		if (isset($count, $count->payment_completed)) {
445
+			$number = intval($count->payment_completed);
446 446
 		}
447 447
 
448 448
 		return $number;
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
 	 */
454 454
 	public function plugins_loaded() {
455 455
 		// Load plugin text domain.
456
-		$rel_path = dirname( plugin_basename( self::$file ) ) . '/languages/';
456
+		$rel_path = dirname(plugin_basename(self::$file)) . '/languages/';
457 457
 
458
-		load_plugin_textdomain( 'pronamic_ideal', false, $rel_path );
458
+		load_plugin_textdomain('pronamic_ideal', false, $rel_path);
459 459
 
460 460
 		// Gateway Integrations.
461 461
 		$this->register_gateway_integrations();
@@ -472,118 +472,118 @@  discard block
 block discarded – undo
472 472
 
473 473
 		// ABN AMRO iDEAL Easy.
474 474
 		$integration = new Gateways\Ingenico\OrderStandardEasy\Integration();
475
-		$integration->set_id( 'abnamro-ideal-easy' );
476
-		$integration->set_name( 'ABN AMRO - iDEAL Easy' );
475
+		$integration->set_id('abnamro-ideal-easy');
476
+		$integration->set_name('ABN AMRO - iDEAL Easy');
477 477
 		$integration->url           = 'https://internetkassa.abnamro.nl/';
478 478
 		$integration->product_url   = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/';
479 479
 		$integration->dashboard_url = 'https://internetkassa.abnamro.nl/';
480 480
 		$integration->provider      = 'abnamro';
481 481
 
482
-		$integrations[ $integration->get_id() ] = $integration;
482
+		$integrations[$integration->get_id()] = $integration;
483 483
 
484 484
 		// ABN AMRO - iDEAL Only Kassa.
485 485
 		$integration = new Gateways\Ingenico\OrderStandard\Integration();
486
-		$integration->set_id( 'abnamro-ideal-only-kassa' );
487
-		$integration->set_name( 'ABN AMRO - iDEAL Only Kassa' );
486
+		$integration->set_id('abnamro-ideal-only-kassa');
487
+		$integration->set_name('ABN AMRO - iDEAL Only Kassa');
488 488
 		$integration->url           = 'https://internetkassa.abnamro.nl/';
489 489
 		$integration->product_url   = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/';
490 490
 		$integration->dashboard_url = 'https://internetkassa.abnamro.nl/';
491 491
 		$integration->provider      = 'abnamro';
492 492
 
493
-		$integrations[ $integration->get_id() ] = $integration;
493
+		$integrations[$integration->get_id()] = $integration;
494 494
 
495 495
 		// ABN AMRO - Internetkassa.
496 496
 		$integration = new Gateways\Ingenico\OrderStandard\Integration();
497
-		$integration->set_id( 'abnamro-internetkassa' );
498
-		$integration->set_name( 'ABN AMRO - Internetkassa' );
497
+		$integration->set_id('abnamro-internetkassa');
498
+		$integration->set_name('ABN AMRO - Internetkassa');
499 499
 		$integration->url           = 'https://internetkassa.abnamro.nl/';
500 500
 		$integration->product_url   = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/';
501 501
 		$integration->dashboard_url = 'https://internetkassa.abnamro.nl/';
502 502
 		$integration->provider      = 'abnamro';
503 503
 
504
-		$integrations[ $integration->get_id() ] = $integration;
504
+		$integrations[$integration->get_id()] = $integration;
505 505
 
506 506
 		// ABN AMRO - iDEAL Zelfbouw (v3).
507 507
 		$integration = new Gateways\IDeal_Advanced_V3\Integration();
508
-		$integration->set_id( 'abnamro-ideal-zelfbouw-v3' );
509
-		$integration->set_name( 'ABN AMRO - iDEAL Zelfbouw (v3)' );
508
+		$integration->set_id('abnamro-ideal-zelfbouw-v3');
509
+		$integration->set_name('ABN AMRO - iDEAL Zelfbouw (v3)');
510 510
 		$integration->url           = 'https://abnamro.ideal-payment.de/';
511 511
 		$integration->product_url   = 'https://www.abnamro.nl/nl/zakelijk/betalen/online-betalen/betaaloplossing/';
512 512
 		$integration->dashboard_url = array(
513 513
 			'test' => 'https://abnamro-test.ideal-payment.de/',
514 514
 			'live' => 'https://abnamro.ideal-payment.de/',
515 515
 		);
516
-		$integration->provider      = 'abnamro';
516
+		$integration->provider = 'abnamro';
517 517
 
518
-		$integrations[ $integration->get_id() ] = $integration;
518
+		$integrations[$integration->get_id()] = $integration;
519 519
 
520 520
 		// Buckaroo.
521 521
 		$integration = new Gateways\Buckaroo\Integration();
522 522
 
523
-		$integrations[ $integration->get_id() ] = $integration;
523
+		$integrations[$integration->get_id()] = $integration;
524 524
 
525 525
 		// Deutsche Bank - iDEAL via Ogone.
526 526
 		$integration = new Gateways\Ingenico\OrderStandardEasy\Integration();
527
-		$integration->set_id( 'deutschebank-ideal-via-ogone' );
528
-		$integration->set_name( 'Deutsche Bank - iDEAL via Ogone' );
527
+		$integration->set_id('deutschebank-ideal-via-ogone');
528
+		$integration->set_name('Deutsche Bank - iDEAL via Ogone');
529 529
 		$integration->product_url = 'https://www.deutschebank.nl/nl/content/producten_en_services_commercial_banking_cash_management_betalen_ideal.html';
530 530
 		$integration->provider    = 'deutschebank';
531 531
 
532
-		$integrations[ $integration->get_id() ] = $integration;
532
+		$integrations[$integration->get_id()] = $integration;
533 533
 
534 534
 		// Deutsche Bank - iDEAL Expert (v3).
535 535
 		$integration = new Gateways\IDeal_Advanced_V3\Integration();
536
-		$integration->set_id( 'deutschebank-ideal-expert-v3' );
537
-		$integration->set_name( 'Deutsche Bank - iDEAL Expert (v3)' );
536
+		$integration->set_id('deutschebank-ideal-expert-v3');
537
+		$integration->set_name('Deutsche Bank - iDEAL Expert (v3)');
538 538
 		$integration->product_url   = 'https://www.deutschebank.nl/nl/content/producten_en_services_commercial_banking_cash_management_betalen_ideal.html';
539 539
 		$integration->dashboard_url = array(
540 540
 			'test' => 'https://myideal.test.db.com/',
541 541
 			'live' => 'https://myideal.db.com/',
542 542
 		);
543
-		$integration->provider      = 'deutschebank';
543
+		$integration->provider = 'deutschebank';
544 544
 
545
-		$integrations[ $integration->get_id() ] = $integration;
545
+		$integrations[$integration->get_id()] = $integration;
546 546
 
547 547
 		// EMS e-Commerce Gateway.
548 548
 		$integration = new Gateways\EMS_ECommerce\Integration();
549 549
 
550
-		$integrations[ $integration->get_id() ] = $integration;
550
+		$integrations[$integration->get_id()] = $integration;
551 551
 
552 552
 		// Fibonacci ORANGE.
553 553
 		$integration = new Gateways\Icepay\Integration();
554
-		$integration->set_id( 'fibonacciorange' );
555
-		$integration->set_name( 'Fibonacci ORANGE' );
554
+		$integration->set_id('fibonacciorange');
555
+		$integration->set_name('Fibonacci ORANGE');
556 556
 		$integration->product_url = 'http://www.fibonacciorange.nl/';
557 557
 		$integration->provider    = 'fibonacciorange';
558 558
 
559
-		$integrations[ $integration->get_id() ] = $integration;
559
+		$integrations[$integration->get_id()] = $integration;
560 560
 
561 561
 		// ICEPAY.
562 562
 		$integration = new Gateways\Icepay\Integration();
563 563
 
564
-		$integrations[ $integration->get_id() ] = $integration;
564
+		$integrations[$integration->get_id()] = $integration;
565 565
 
566 566
 		// iDEAL Simulator - iDEAL Lite / Basic.
567 567
 		$integration = new Gateways\IDeal_Basic\Integration();
568
-		$integration->set_id( 'ideal-simulator-ideal-basic' );
569
-		$integration->set_name( 'iDEAL Simulator - iDEAL Lite / Basic' );
568
+		$integration->set_id('ideal-simulator-ideal-basic');
569
+		$integration->set_name('iDEAL Simulator - iDEAL Lite / Basic');
570 570
 		$integration->provider = 'ideal-simulator';
571 571
 
572
-		$integrations[ $integration->get_id() ] = $integration;
572
+		$integrations[$integration->get_id()] = $integration;
573 573
 
574 574
 		// iDEAL Simulator - iDEAL Professional / Advanced / Zelfbouw (v3).
575 575
 		$integration = new Gateways\IDeal_Advanced_V3\Integration();
576
-		$integration->set_id( 'ideal-simulator-ideal-advanced-v3' );
577
-		$integration->set_name( 'iDEAL Simulator - iDEAL Professional / Advanced / Zelfbouw (v3)' );
576
+		$integration->set_id('ideal-simulator-ideal-advanced-v3');
577
+		$integration->set_name('iDEAL Simulator - iDEAL Professional / Advanced / Zelfbouw (v3)');
578 578
 		$integration->provider    = 'ideal-simulator';
579 579
 		$integration->product_url = 'https://www.ideal-checkout.nl/support/ideal-simulator';
580 580
 
581
-		$integrations[ $integration->get_id() ] = $integration;
581
+		$integrations[$integration->get_id()] = $integration;
582 582
 
583 583
 		// ING - iDEAL Basic.
584 584
 		$integration = new Gateways\IDeal_Basic\Integration();
585
-		$integration->set_id( 'ing-ideal-basic' );
586
-		$integration->set_name( 'ING - iDEAL Basic' );
585
+		$integration->set_id('ing-ideal-basic');
586
+		$integration->set_name('ING - iDEAL Basic');
587 587
 		$integration->provider      = 'ing';
588 588
 		$integration->product_url   = 'https://www.ing.nl/zakelijk/betalen/geld-ontvangen/ideal/';
589 589
 		$integration->dashboard_url = array(
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
 			'live' => 'https://ideal.secure-ing.com/',
592 592
 		);
593 593
 
594
-		$integrations[ $integration->get_id() ] = $integration;
594
+		$integrations[$integration->get_id()] = $integration;
595 595
 
596 596
 		// ING - iDEAL Advanced (v3).
597 597
 		$integration = new Gateways\IDeal_Advanced_V3\Integration();
598
-		$integration->set_id( 'ing-ideal-advanced-v3' );
599
-		$integration->set_name( 'ING - iDEAL Advanced (v3)' );
598
+		$integration->set_id('ing-ideal-advanced-v3');
599
+		$integration->set_name('ING - iDEAL Advanced (v3)');
600 600
 		$integration->provider      = 'ing';
601 601
 		$integration->product_url   = 'https://www.ing.nl/zakelijk/betalen/geld-ontvangen/ideal/';
602 602
 		$integration->dashboard_url = array(
@@ -604,98 +604,98 @@  discard block
 block discarded – undo
604 604
 			'live' => 'https://ideal.secure-ing.com/',
605 605
 		);
606 606
 
607
-		$integrations[ $integration->get_id() ] = $integration;
607
+		$integrations[$integration->get_id()] = $integration;
608 608
 
609 609
 		// ING - Kassa Compleet.
610 610
 		$integration = new Gateways\ING_KassaCompleet\Integration();
611 611
 
612
-		$integrations[ $integration->get_id() ] = $integration;
612
+		$integrations[$integration->get_id()] = $integration;
613 613
 
614 614
 		// Mollie.
615 615
 		$integration = new Gateways\Mollie\Integration();
616 616
 
617
-		$integrations[ $integration->get_id() ] = $integration;
617
+		$integrations[$integration->get_id()] = $integration;
618 618
 
619 619
 		// Mollie - iDEAL.
620 620
 		$integration = new Gateways\Mollie_IDeal\Integration();
621 621
 
622
-		$integrations[ $integration->get_id() ] = $integration;
622
+		$integrations[$integration->get_id()] = $integration;
623 623
 
624 624
 		// Mollie - iDEAL Basic.
625 625
 		$integration = new Gateways\IDeal_Basic\Integration();
626
-		$integration->set_id( 'mollie-ideal-basic' );
627
-		$integration->set_name( 'Mollie - iDEAL Basic' );
626
+		$integration->set_id('mollie-ideal-basic');
627
+		$integration->set_name('Mollie - iDEAL Basic');
628 628
 		$integration->dashboard_url = 'http://www.mollie.nl/beheer/';
629 629
 		$integration->provider      = 'mollie';
630 630
 		$integration->deprecated    = true;
631 631
 
632
-		$integrations[ $integration->get_id() ] = $integration;
632
+		$integrations[$integration->get_id()] = $integration;
633 633
 
634 634
 		// MultiSafepay.
635 635
 		$integration = new Gateways\MultiSafepay\Connect\Integration();
636 636
 
637
-		$integrations[ $integration->get_id() ] = $integration;
637
+		$integrations[$integration->get_id()] = $integration;
638 638
 
639 639
 		// Ogone - DirectLink.
640 640
 		$integration = new Gateways\Ingenico\DirectLink\Integration();
641 641
 
642
-		$integrations[ $integration->get_id() ] = $integration;
642
+		$integrations[$integration->get_id()] = $integration;
643 643
 
644 644
 		// Ogone - OrderStandard.
645 645
 		$integration = new Gateways\Ingenico\OrderStandard\Integration();
646 646
 
647
-		$integrations[ $integration->get_id() ] = $integration;
647
+		$integrations[$integration->get_id()] = $integration;
648 648
 
649 649
 		// OmniKassa.
650 650
 		$integration = new Gateways\OmniKassa\Integration();
651 651
 
652
-		$integrations[ $integration->get_id() ] = $integration;
652
+		$integrations[$integration->get_id()] = $integration;
653 653
 
654 654
 		// OmniKassa 2.0.
655 655
 		$integration = new Gateways\OmniKassa2\Integration();
656 656
 
657
-		$integrations[ $integration->get_id() ] = $integration;
657
+		$integrations[$integration->get_id()] = $integration;
658 658
 
659 659
 		// Pay.nl.
660 660
 		$integration = new Gateways\PayNL\Integration();
661 661
 
662
-		$integrations[ $integration->get_id() ] = $integration;
662
+		$integrations[$integration->get_id()] = $integration;
663 663
 
664 664
 		// Paytor.
665 665
 		$integration = new Gateways\Mollie\Integration();
666
-		$integration->set_id( 'paytor' );
667
-		$integration->set_name( 'Paytor' );
666
+		$integration->set_id('paytor');
667
+		$integration->set_name('Paytor');
668 668
 		$integration->url         = 'http://paytor.com/';
669 669
 		$integration->product_url = 'http://paytor.com/';
670 670
 		$integration->provider    = 'paytor';
671 671
 
672
-		$integrations[ $integration->get_id() ] = $integration;
672
+		$integrations[$integration->get_id()] = $integration;
673 673
 
674 674
 		// Postcode iDEAL.
675 675
 		$integration = new Gateways\IDeal_Advanced_V3\Integration();
676
-		$integration->set_id( 'postcode-ideal' );
677
-		$integration->set_name( 'Postcode iDEAL' );
676
+		$integration->set_id('postcode-ideal');
677
+		$integration->set_name('Postcode iDEAL');
678 678
 		$integration->provider      = 'postcode.nl';
679 679
 		$integration->product_url   = 'https://services.postcode.nl/ideal';
680 680
 		$integration->dashboard_url = 'https://services.postcode.nl/ideal';
681 681
 
682
-		$integrations[ $integration->get_id() ] = $integration;
682
+		$integrations[$integration->get_id()] = $integration;
683 683
 
684 684
 		// Qantani (new platform).
685 685
 		$integration = new Gateways\Mollie\Integration();
686
-		$integration->set_id( 'qantani-mollie' );
687
-		$integration->set_name( __( 'Qantani (new platform)', 'pronamic_ideal' ) );
686
+		$integration->set_id('qantani-mollie');
687
+		$integration->set_name(__('Qantani (new platform)', 'pronamic_ideal'));
688 688
 		$integration->url           = 'https://www.qantani.com/';
689 689
 		$integration->product_url   = 'https://www.qantani.com/tarieven/';
690 690
 		$integration->dashboard_url = 'https://www.qantani.eu/';
691 691
 		$integration->provider      = 'qantani';
692 692
 
693
-		$integrations[ $integration->get_id() ] = $integration;
693
+		$integrations[$integration->get_id()] = $integration;
694 694
 
695 695
 		// Rabobank - iDEAL Professional (v3).
696 696
 		$integration = new Gateways\IDeal_Advanced_V3\Integration();
697
-		$integration->set_id( 'rabobank-ideal-professional-v3' );
698
-		$integration->set_name( 'Rabobank - iDEAL Professional (v3)' );
697
+		$integration->set_id('rabobank-ideal-professional-v3');
698
+		$integration->set_name('Rabobank - iDEAL Professional (v3)');
699 699
 		$integration->provider      = 'rabobank';
700 700
 		$integration->product_url   = 'https://www.rabobank.nl/bedrijven/betalen/geld-ontvangen/ideal-professional/';
701 701
 		$integration->dashboard_url = array(
@@ -703,35 +703,35 @@  discard block
 block discarded – undo
703 703
 			'live' => 'https://ideal.rabobank.nl/',
704 704
 		);
705 705
 
706
-		$integrations[ $integration->get_id() ] = $integration;
706
+		$integrations[$integration->get_id()] = $integration;
707 707
 
708 708
 		// Sisow.
709 709
 		$integration = new Gateways\Sisow\Integration();
710 710
 
711
-		$integrations[ $integration->get_id() ] = $integration;
711
+		$integrations[$integration->get_id()] = $integration;
712 712
 
713 713
 		// Sisow - iDEAL Basic.
714 714
 		$integration = new Gateways\IDeal_Basic\Integration();
715
-		$integration->set_id( 'sisow-ideal-basic' );
716
-		$integration->set_name( 'Sisow - iDEAL Basic' );
715
+		$integration->set_id('sisow-ideal-basic');
716
+		$integration->set_name('Sisow - iDEAL Basic');
717 717
 		$integration->url           = 'https://www.sisow.nl/';
718 718
 		$integration->dashboard_url = 'https://www.sisow.nl/Sisow/iDeal/Login.aspx';
719 719
 		$integration->provider      = 'sisow';
720 720
 		$integration->deprecated    = true;
721 721
 
722
-		$integrations[ $integration->get_id() ] = $integration;
722
+		$integrations[$integration->get_id()] = $integration;
723 723
 
724 724
 		// TargetPay.
725 725
 		$integration = new Gateways\TargetPay\Integration();
726 726
 
727
-		$integrations[ $integration->get_id() ] = $integration;
727
+		$integrations[$integration->get_id()] = $integration;
728 728
 
729 729
 		// Gateway integrations.
730 730
 		$this->gateway_integrations = $integrations;
731 731
 
732 732
 		// Register config providers.
733
-		foreach ( $integrations as $integration ) {
734
-			Core\ConfigProvider::register( $integration->get_id(), $integration->get_config_factory_class() );
733
+		foreach ($integrations as $integration) {
734
+			Core\ConfigProvider::register($integration->get_id(), $integration->get_config_factory_class());
735 735
 		}
736 736
 	}
737 737
 
@@ -743,16 +743,16 @@  discard block
 block discarded – undo
743 743
 	 *
744 744
 	 * @return string
745 745
 	 */
746
-	public function plugin_locale( $locale, $domain ) {
747
-		if ( 'pronamic_ideal' !== $domain ) {
746
+	public function plugin_locale($locale, $domain) {
747
+		if ('pronamic_ideal' !== $domain) {
748 748
 			return $locale;
749 749
 		}
750 750
 
751
-		if ( 'nl_NL_formal' === $locale ) {
751
+		if ('nl_NL_formal' === $locale) {
752 752
 			return 'nl_NL';
753 753
 		}
754 754
 
755
-		if ( 'nl_BE' === $locale ) {
755
+		if ('nl_BE' === $locale) {
756 756
 			return 'nl_NL';
757 757
 		}
758 758
 
@@ -766,14 +766,14 @@  discard block
 block discarded – undo
766 766
 	 */
767 767
 	public static function get_payment_states() {
768 768
 		return array(
769
-			'payment_pending'    => _x( 'Pending', 'Payment status', 'pronamic_ideal' ),
770
-			'payment_processing' => _x( 'Processing', 'Payment status', 'pronamic_ideal' ),
771
-			'payment_on_hold'    => _x( 'On Hold', 'Payment status', 'pronamic_ideal' ),
772
-			'payment_completed'  => _x( 'Completed', 'Payment status', 'pronamic_ideal' ),
773
-			'payment_cancelled'  => _x( 'Cancelled', 'Payment status', 'pronamic_ideal' ),
774
-			'payment_refunded'   => _x( 'Refunded', 'Payment status', 'pronamic_ideal' ),
775
-			'payment_failed'     => _x( 'Failed', 'Payment status', 'pronamic_ideal' ),
776
-			'payment_expired'    => _x( 'Expired', 'Payment status', 'pronamic_ideal' ),
769
+			'payment_pending'    => _x('Pending', 'Payment status', 'pronamic_ideal'),
770
+			'payment_processing' => _x('Processing', 'Payment status', 'pronamic_ideal'),
771
+			'payment_on_hold'    => _x('On Hold', 'Payment status', 'pronamic_ideal'),
772
+			'payment_completed'  => _x('Completed', 'Payment status', 'pronamic_ideal'),
773
+			'payment_cancelled'  => _x('Cancelled', 'Payment status', 'pronamic_ideal'),
774
+			'payment_refunded'   => _x('Refunded', 'Payment status', 'pronamic_ideal'),
775
+			'payment_failed'     => _x('Failed', 'Payment status', 'pronamic_ideal'),
776
+			'payment_expired'    => _x('Expired', 'Payment status', 'pronamic_ideal'),
777 777
 		);
778 778
 	}
779 779
 
@@ -784,12 +784,12 @@  discard block
 block discarded – undo
784 784
 	 */
785 785
 	public static function get_subscription_states() {
786 786
 		return array(
787
-			'subscr_pending'   => _x( 'Pending', 'Subscription status', 'pronamic_ideal' ),
788
-			'subscr_cancelled' => _x( 'Cancelled', 'Subscription status', 'pronamic_ideal' ),
789
-			'subscr_expired'   => _x( 'Expired', 'Subscription status', 'pronamic_ideal' ),
790
-			'subscr_failed'    => _x( 'Failed', 'Subscription status', 'pronamic_ideal' ),
791
-			'subscr_active'    => _x( 'Active', 'Subscription status', 'pronamic_ideal' ),
792
-			'subscr_completed' => _x( 'Completed', 'Subscription status', 'pronamic_ideal' ),
787
+			'subscr_pending'   => _x('Pending', 'Subscription status', 'pronamic_ideal'),
788
+			'subscr_cancelled' => _x('Cancelled', 'Subscription status', 'pronamic_ideal'),
789
+			'subscr_expired'   => _x('Expired', 'Subscription status', 'pronamic_ideal'),
790
+			'subscr_failed'    => _x('Failed', 'Subscription status', 'pronamic_ideal'),
791
+			'subscr_active'    => _x('Active', 'Subscription status', 'pronamic_ideal'),
792
+			'subscr_completed' => _x('Completed', 'Subscription status', 'pronamic_ideal'),
793 793
 		);
794 794
 	}
795 795
 
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	 * @return string
800 800
 	 */
801 801
 	public static function get_default_error_message() {
802
-		return __( 'Something went wrong with the payment. Please try again later or pay another way.', 'pronamic_ideal' );
802
+		return __('Something went wrong with the payment. Please try again later or pay another way.', 'pronamic_ideal');
803 803
 	}
804 804
 
805 805
 	/**
@@ -809,22 +809,22 @@  discard block
 block discarded – undo
809 809
 	 *
810 810
 	 * @return array
811 811
 	 */
812
-	public static function get_config_select_options( $payment_method = null ) {
812
+	public static function get_config_select_options($payment_method = null) {
813 813
 		$args = array(
814 814
 			'post_type' => 'pronamic_gateway',
815 815
 			'nopaging'  => true,
816 816
 		);
817 817
 
818
-		if ( $payment_method ) {
818
+		if ($payment_method) {
819 819
 			$gateways = array();
820 820
 
821
-			switch ( $payment_method ) {
821
+			switch ($payment_method) {
822 822
 				case PaymentMethods::ALIPAY:
823
-					$gateways = array( 'multisafepay-connect' );
823
+					$gateways = array('multisafepay-connect');
824 824
 
825 825
 					break;
826 826
 				case PaymentMethods::BUNQ:
827
-					$gateways = array( 'sisow-ideal' );
827
+					$gateways = array('sisow-ideal');
828 828
 
829 829
 					break;
830 830
 				case PaymentMethods::BANCONTACT:
@@ -899,11 +899,11 @@  discard block
 block discarded – undo
899 899
 
900 900
 					break;
901 901
 				case PaymentMethods::GIROPAY:
902
-					$gateways = array( 'multisafepay-connect' );
902
+					$gateways = array('multisafepay-connect');
903 903
 
904 904
 					break;
905 905
 				case PaymentMethods::IDEALQR:
906
-					$gateways = array( 'multisafepay-connect' );
906
+					$gateways = array('multisafepay-connect');
907 907
 
908 908
 					break;
909 909
 				case PaymentMethods::KBC:
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 
923 923
 					break;
924 924
 				case PaymentMethods::PAYCONIQ:
925
-					$gateways = array( 'ing-kassa-compleet' );
925
+					$gateways = array('ing-kassa-compleet');
926 926
 
927 927
 					break;
928 928
 				case PaymentMethods::PAYPAL:
@@ -958,17 +958,17 @@  discard block
 block discarded – undo
958 958
 			);
959 959
 		}
960 960
 
961
-		$query = new WP_Query( $args );
961
+		$query = new WP_Query($args);
962 962
 
963
-		$options = array( __( '— Select Configuration —', 'pronamic_ideal' ) );
963
+		$options = array(__('— Select Configuration —', 'pronamic_ideal'));
964 964
 
965
-		foreach ( $query->posts as $post ) {
965
+		foreach ($query->posts as $post) {
966 966
 			$id = $post->ID;
967 967
 
968
-			$options[ $id ] = sprintf(
968
+			$options[$id] = sprintf(
969 969
 				'%s (%s)',
970
-				get_the_title( $id ),
971
-				get_post_meta( $id, '_pronamic_gateway_mode', true )
970
+				get_the_title($id),
971
+				get_post_meta($id, '_pronamic_gateway_mode', true)
972 972
 			);
973 973
 		}
974 974
 
@@ -981,9 +981,9 @@  discard block
 block discarded – undo
981 981
 	 * @since unreleased
982 982
 	 */
983 983
 	public static function maybe_set_active_payment_methods() {
984
-		$active_methods = get_option( 'pronamic_pay_active_payment_methods' );
984
+		$active_methods = get_option('pronamic_pay_active_payment_methods');
985 985
 
986
-		if ( is_array( $active_methods ) ) {
986
+		if (is_array($active_methods)) {
987 987
 			return;
988 988
 		}
989 989
 
@@ -995,12 +995,12 @@  discard block
 block discarded – undo
995 995
 	 *
996 996
 	 * @param array $errors An array with errors to render.
997 997
 	 */
998
-	public static function render_errors( $errors = array() ) {
999
-		if ( ! is_array( $errors ) ) {
1000
-			$errors = array( $errors );
998
+	public static function render_errors($errors = array()) {
999
+		if ( ! is_array($errors)) {
1000
+			$errors = array($errors);
1001 1001
 		}
1002 1002
 
1003
-		foreach ( $errors as $error ) {
1003
+		foreach ($errors as $error) {
1004 1004
 			include Plugin::$dirname . '/views/error.php';
1005 1005
 		}
1006 1006
 	}
@@ -1012,14 +1012,14 @@  discard block
 block discarded – undo
1012 1012
 	 *
1013 1013
 	 * @return Gateway
1014 1014
 	 */
1015
-	public static function get_gateway( $config_id ) {
1016
-		$gateway_id = get_post_meta( $config_id, '_pronamic_gateway_id', true );
1017
-		$mode       = get_post_meta( $config_id, '_pronamic_gateway_mode', true );
1018
-		$is_utf8    = strcasecmp( get_bloginfo( 'charset' ), 'UTF-8' ) === 0;
1015
+	public static function get_gateway($config_id) {
1016
+		$gateway_id = get_post_meta($config_id, '_pronamic_gateway_id', true);
1017
+		$mode       = get_post_meta($config_id, '_pronamic_gateway_mode', true);
1018
+		$is_utf8    = strcasecmp(get_bloginfo('charset'), 'UTF-8') === 0;
1019 1019
 
1020
-		$config = Core\ConfigProvider::get_config( $gateway_id, $config_id );
1020
+		$config = Core\ConfigProvider::get_config($gateway_id, $config_id);
1021 1021
 
1022
-		switch ( $gateway_id ) {
1022
+		switch ($gateway_id) {
1023 1023
 			case 'abnamro-ideal-easy':
1024 1024
 			case 'abnamro-ideal-only-kassa':
1025 1025
 			case 'abnamro-internetkassa':
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 			case 'abnamro-ideal-zelfbouw-v3':
1034 1034
 				$config->payment_server_url = 'https://abnamro.ideal-payment.de/ideal/iDEALv3';
1035 1035
 
1036
-				if ( 'test' === $mode ) {
1036
+				if ('test' === $mode) {
1037 1037
 					$config->payment_server_url = 'https://abnamro-test.ideal-payment.de/ideal/iDEALv3';
1038 1038
 				}
1039 1039
 
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 			case 'ing-ideal-basic':
1060 1060
 				$config->url = 'https://ideal.secure-ing.com/ideal/mpiPayInitIng.do';
1061 1061
 
1062
-				if ( 'test' === $mode ) {
1062
+				if ('test' === $mode) {
1063 1063
 					$config->url = 'https://idealtest.secure-ing.com/ideal/mpiPayInitIng.do';
1064 1064
 				}
1065 1065
 
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 			case 'ing-ideal-advanced-v3':
1068 1068
 				$config->payment_server_url = 'https://ideal.secure-ing.com/ideal/iDEALv3';
1069 1069
 
1070
-				if ( 'test' === $mode ) {
1070
+				if ('test' === $mode) {
1071 1071
 					$config->payment_server_url = 'https://idealtest.secure-ing.com/ideal/iDEALv3';
1072 1072
 				}
1073 1073
 
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 			case 'mollie-ideal-basic':
1078 1078
 				$config->url = 'https://secure.mollie.nl/xml/idealAcquirer/lite/';
1079 1079
 
1080
-				if ( 'test' === $mode ) {
1080
+				if ('test' === $mode) {
1081 1081
 					$config->url = 'https://secure.mollie.nl/xml/idealAcquirer/testmode/lite/';
1082 1082
 				}
1083 1083
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 			case 'postcode-ideal':
1086 1086
 				$config->payment_server_url = 'https://ideal.postcode.nl/ideal';
1087 1087
 
1088
-				if ( 'test' === $mode ) {
1088
+				if ('test' === $mode) {
1089 1089
 					$config->payment_server_url = 'https://ideal-test.postcode.nl/ideal';
1090 1090
 				}
1091 1091
 
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 			case 'rabobank-ideal-professional-v3':
1096 1096
 				$config->payment_server_url = 'https://ideal.rabobank.nl/ideal/iDEALv3';
1097 1097
 
1098
-				if ( 'test' === $mode ) {
1098
+				if ('test' === $mode) {
1099 1099
 					$config->payment_server_url = 'https://idealtest.rabobank.nl/ideal/iDEALv3';
1100 1100
 				}
1101 1101
 
@@ -1105,14 +1105,14 @@  discard block
 block discarded – undo
1105 1105
 			case 'sisow-ideal-basic':
1106 1106
 				$config->url = 'https://www.sisow.nl/Sisow/iDeal/IssuerHandler.ashx';
1107 1107
 
1108
-				if ( 'test' === $mode ) {
1108
+				if ('test' === $mode) {
1109 1109
 					$config->url = 'https://www.sisow.nl/Sisow/iDeal/IssuerHandler.ashx/test';
1110 1110
 				}
1111 1111
 
1112 1112
 				break;
1113 1113
 		}
1114 1114
 
1115
-		$gateway = Core\GatewayFactory::create( $config );
1115
+		$gateway = Core\GatewayFactory::create($config);
1116 1116
 
1117 1117
 		return $gateway;
1118 1118
 	}
@@ -1127,13 +1127,13 @@  discard block
 block discarded – undo
1127 1127
 	 *
1128 1128
 	 * @return Payment
1129 1129
 	 */
1130
-	public static function start( $config_id, Gateway $gateway, PaymentDataInterface $data, $payment_method = null ) {
1130
+	public static function start($config_id, Gateway $gateway, PaymentDataInterface $data, $payment_method = null) {
1131 1131
 		$payment = new Payments\Payment();
1132 1132
 
1133
-		$payment->title               = sprintf( __( 'Payment for %s', 'pronamic_ideal' ), $data->get_title() );
1133
+		$payment->title               = sprintf(__('Payment for %s', 'pronamic_ideal'), $data->get_title());
1134 1134
 		$payment->user_id             = $data->get_user_id();
1135 1135
 		$payment->config_id           = $config_id;
1136
-		$payment->key                 = uniqid( 'pay_' );
1136
+		$payment->key                 = uniqid('pay_');
1137 1137
 		$payment->order_id            = $data->get_order_id();
1138 1138
 		$payment->currency            = $data->get_currency();
1139 1139
 		$payment->amount              = $data->get_amount();
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 		$payment->email               = $data->get_email();
1147 1147
 		$payment->status              = null;
1148 1148
 		$payment->method              = $payment_method;
1149
-		$payment->issuer              = $data->get_issuer( $payment_method );
1149
+		$payment->issuer              = $data->get_issuer($payment_method);
1150 1150
 		$payment->first_name          = $data->get_first_name();
1151 1151
 		$payment->last_name           = $data->get_last_name();
1152 1152
 		$payment->customer_name       = $data->get_customer_name();
@@ -1159,9 +1159,9 @@  discard block
 block discarded – undo
1159 1159
 		$payment->recurring           = $data->get_recurring();
1160 1160
 		$payment->subscription        = $data->get_subscription();
1161 1161
 		$payment->subscription_id     = $data->get_subscription_id();
1162
-		$payment->set_credit_card( $data->get_credit_card() );
1162
+		$payment->set_credit_card($data->get_credit_card());
1163 1163
 
1164
-		return self::start_payment( $payment, $gateway );
1164
+		return self::start_payment($payment, $gateway);
1165 1165
 	}
1166 1166
 
1167 1167
 	/**
@@ -1172,47 +1172,47 @@  discard block
 block discarded – undo
1172 1172
 	 *
1173 1173
 	 * @return Payment
1174 1174
 	 */
1175
-	public static function start_payment( Payment $payment, Gateway $gateway ) {
1175
+	public static function start_payment(Payment $payment, Gateway $gateway) {
1176 1176
 		global $pronamic_ideal;
1177 1177
 
1178
-		$pronamic_ideal->payments_data_store->create( $payment );
1178
+		$pronamic_ideal->payments_data_store->create($payment);
1179 1179
 
1180 1180
 		// Start payment at the gateway.
1181
-		$result = $gateway->start( $payment );
1181
+		$result = $gateway->start($payment);
1182 1182
 
1183 1183
 		// If result is false the payment failed to start.
1184
-		if ( false === $result ) {
1184
+		if (false === $result) {
1185 1185
 			// If payment failed to start we directly update the payment status to 'failure'.
1186
-			$payment->set_status( Core\Statuses::FAILURE );
1186
+			$payment->set_status(Core\Statuses::FAILURE);
1187 1187
 
1188 1188
 			// Check if there is a subscription attached to the payment.
1189 1189
 			$subscription = $payment->get_subscription();
1190 1190
 
1191
-			if ( $subscription ) {
1192
-				if ( ! $payment->get_recurring() ) {
1191
+			if ($subscription) {
1192
+				if ( ! $payment->get_recurring()) {
1193 1193
 					// First payment.
1194 1194
 					// Cancel subscription to prevent unwanted recurring payments in the future,
1195 1195
 					// when a valid customer ID might be set for the user.
1196
-					$subscription->update_status( Core\Statuses::CANCELLED );
1196
+					$subscription->update_status(Core\Statuses::CANCELLED);
1197 1197
 				} else {
1198
-					$subscription->set_status( Core\Statuses::FAILURE );
1198
+					$subscription->set_status(Core\Statuses::FAILURE);
1199 1199
 				}
1200 1200
 
1201
-				$pronamic_ideal->subscriptions_data_store->update( $subscription );
1201
+				$pronamic_ideal->subscriptions_data_store->update($subscription);
1202 1202
 			}
1203 1203
 		}
1204 1204
 
1205 1205
 		// Check if the gateway has an error.
1206
-		if ( $gateway->has_error() ) {
1207
-			foreach ( $gateway->error->get_error_codes() as $code ) {
1208
-				$payment->add_note( sprintf( '%s: %s', $code, $gateway->error->get_error_message( $code ) ) );
1206
+		if ($gateway->has_error()) {
1207
+			foreach ($gateway->error->get_error_codes() as $code) {
1208
+				$payment->add_note(sprintf('%s: %s', $code, $gateway->error->get_error_message($code)));
1209 1209
 			}
1210 1210
 		}
1211 1211
 
1212
-		$pronamic_ideal->payments_data_store->update( $payment );
1212
+		$pronamic_ideal->payments_data_store->update($payment);
1213 1213
 
1214
-		if ( $gateway->supports( 'payment_status_request' ) ) {
1215
-			Payments\StatusChecker::schedule_event( $payment );
1214
+		if ($gateway->supports('payment_status_request')) {
1215
+			Payments\StatusChecker::schedule_event($payment);
1216 1216
 		}
1217 1217
 
1218 1218
 		return $payment;
@@ -1227,17 +1227,17 @@  discard block
 block discarded – undo
1227 1227
 		$return = array();
1228 1228
 
1229 1229
 		$pages = array(
1230
-			'completed' => __( 'Completed', 'pronamic_ideal' ),
1231
-			'cancel'    => __( 'Canceled', 'pronamic_ideal' ),
1232
-			'expired'   => __( 'Expired', 'pronamic_ideal' ),
1233
-			'error'     => __( 'Error', 'pronamic_ideal' ),
1234
-			'unknown'   => __( 'Unknown', 'pronamic_ideal' ),
1230
+			'completed' => __('Completed', 'pronamic_ideal'),
1231
+			'cancel'    => __('Canceled', 'pronamic_ideal'),
1232
+			'expired'   => __('Expired', 'pronamic_ideal'),
1233
+			'error'     => __('Error', 'pronamic_ideal'),
1234
+			'unknown'   => __('Unknown', 'pronamic_ideal'),
1235 1235
 		);
1236 1236
 
1237
-		foreach ( $pages as $key => $label ) {
1238
-			$id = sprintf( 'pronamic_pay_%s_page_id', $key );
1237
+		foreach ($pages as $key => $label) {
1238
+			$id = sprintf('pronamic_pay_%s_page_id', $key);
1239 1239
 
1240
-			$return[ $id ] = $label;
1240
+			$return[$id] = $label;
1241 1241
 		}
1242 1242
 
1243 1243
 		return $return;
Please login to merge, or discard this patch.
classes/Admin/Install.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @param AdminModule $admin Admin Module.
44 44
 	 */
45
-	public function __construct( AdminModule $admin ) {
45
+	public function __construct(AdminModule $admin) {
46 46
 		$this->admin = $admin;
47 47
 
48 48
 		// Actions.
49
-		add_action( 'admin_init', array( $this, 'admin_init' ), 5 );
49
+		add_action('admin_init', array($this, 'admin_init'), 5);
50 50
 	}
51 51
 
52 52
 	/**
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 		// Install.
57 57
 		global $pronamic_pay_version;
58 58
 
59
-		if ( get_option( 'pronamic_pay_version' ) !== $pronamic_pay_version ) {
59
+		if (get_option('pronamic_pay_version') !== $pronamic_pay_version) {
60 60
 			$this->install();
61 61
 		}
62 62
 
63 63
 		// Maybe update database.
64
-		if ( filter_has_var( INPUT_GET, 'pronamic_pay_update_db' ) && wp_verify_nonce( filter_input( INPUT_GET, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING ), 'pronamic_pay_update_db' ) ) {
64
+		if (filter_has_var(INPUT_GET, 'pronamic_pay_update_db') && wp_verify_nonce(filter_input(INPUT_GET, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING), 'pronamic_pay_update_db')) {
65 65
 			$this->update_db();
66 66
 
67
-			$this->admin->notices->remove_notice( 'update_db' );
67
+			$this->admin->notices->remove_notice('update_db');
68 68
 
69 69
 			$this->redirect_to_about();
70 70
 		}
@@ -85,52 +85,52 @@  discard block
 block discarded – undo
85 85
 		// Database update.
86 86
 		$version = $pronamic_pay_version;
87 87
 
88
-		$parts = explode( '.', $version );
88
+		$parts = explode('.', $version);
89 89
 
90
-		$major_version = implode( '.', array_slice( $parts, 0, 1 ) );
91
-		$minor_version = implode( '.', array_slice( $parts, 0, 2 ) );
90
+		$major_version = implode('.', array_slice($parts, 0, 1));
91
+		$minor_version = implode('.', array_slice($parts, 0, 2));
92 92
 
93
-		$current_version    = get_option( 'pronamic_pay_version', null );
94
-		$current_db_version = get_option( 'pronamic_pay_db_version', null );
93
+		$current_version    = get_option('pronamic_pay_version', null);
94
+		$current_db_version = get_option('pronamic_pay_db_version', null);
95 95
 
96 96
 		if (
97 97
 			$current_db_version
98 98
 				&&
99 99
 			(
100 100
 				// Check for old database version notation without dots, for example `366`.
101
-				false === strpos( $current_db_version, '.' )
101
+				false === strpos($current_db_version, '.')
102 102
 					||
103
-				version_compare( $current_db_version, max( $this->db_updates ), '<' )
103
+				version_compare($current_db_version, max($this->db_updates), '<')
104 104
 			)
105 105
 		) {
106
-			$this->admin->notices->add_notice( 'update_db' );
106
+			$this->admin->notices->add_notice('update_db');
107 107
 		}
108 108
 
109 109
 		// Redirect.
110
-		if ( null === $current_version ) {
110
+		if (null === $current_version) {
111 111
 			// No version? This is a new install :).
112 112
 			$url = add_query_arg(
113 113
 				array(
114 114
 					'page' => 'pronamic-pay-about',
115 115
 					'tab'  => 'getting-started',
116
-				), admin_url( 'index.php' )
116
+				), admin_url('index.php')
117 117
 			);
118 118
 
119
-			set_transient( 'pronamic_pay_admin_redirect', $url, 3600 );
120
-		} elseif ( version_compare( $current_version, $minor_version, '<' ) ) {
119
+			set_transient('pronamic_pay_admin_redirect', $url, 3600);
120
+		} elseif (version_compare($current_version, $minor_version, '<')) {
121 121
 			// Show welcome screen for minor updates only.
122 122
 			$url = add_query_arg(
123 123
 				array(
124 124
 					'page' => 'pronamic-pay-about',
125 125
 					'tab'  => 'new',
126
-				), admin_url( 'index.php' )
126
+				), admin_url('index.php')
127 127
 			);
128 128
 
129
-			set_transient( 'pronamic_pay_admin_redirect', $url, 3600 );
129
+			set_transient('pronamic_pay_admin_redirect', $url, 3600);
130 130
 		}
131 131
 
132 132
 		// Update version.
133
-		update_option( 'pronamic_pay_version', $version );
133
+		update_option('pronamic_pay_version', $version);
134 134
 	}
135 135
 
136 136
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	private function create_roles() {
144 144
 		// Payer role.
145 145
 		add_role(
146
-			'payer', __( 'Payer', 'pronamic_ideal' ), array(
146
+			'payer', __('Payer', 'pronamic_ideal'), array(
147 147
 				'read' => true,
148 148
 			)
149 149
 		);
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 		// Payments.
155 155
 		$payment_capabilities = PaymentPostType::get_capabilities();
156 156
 
157
-		unset( $payment_capabilities['publish_posts'] );
158
-		unset( $payment_capabilities['create_posts'] );
157
+		unset($payment_capabilities['publish_posts']);
158
+		unset($payment_capabilities['create_posts']);
159 159
 
160
-		foreach ( $payment_capabilities as $capability ) {
161
-			$roles->add_cap( 'administrator', $capability );
160
+		foreach ($payment_capabilities as $capability) {
161
+			$roles->add_cap('administrator', $capability);
162 162
 		}
163 163
 
164 164
 		// Forms.
165 165
 		$form_capabilities = FormPostType::get_capabilities();
166 166
 
167
-		foreach ( $form_capabilities as $capability ) {
168
-			$roles->add_cap( 'administrator', $capability );
167
+		foreach ($form_capabilities as $capability) {
168
+			$roles->add_cap('administrator', $capability);
169 169
 		}
170 170
 	}
171 171
 
@@ -175,32 +175,32 @@  discard block
 block discarded – undo
175 175
 	public function update_db() {
176 176
 		global $pronamic_pay_version;
177 177
 
178
-		$current_db_version = get_option( 'pronamic_pay_db_version', null );
178
+		$current_db_version = get_option('pronamic_pay_db_version', null);
179 179
 
180
-		if ( $current_db_version ) {
181
-			foreach ( $this->db_updates as $version ) {
182
-				if ( ! version_compare( $current_db_version, $version, '<' ) ) {
180
+		if ($current_db_version) {
181
+			foreach ($this->db_updates as $version) {
182
+				if ( ! version_compare($current_db_version, $version, '<')) {
183 183
 					continue;
184 184
 				}
185 185
 
186
-				$file = plugin_dir_path( Plugin::$file ) . 'includes/updates/update-' . $version . '.php';
186
+				$file = plugin_dir_path(Plugin::$file) . 'includes/updates/update-' . $version . '.php';
187 187
 
188
-				if ( is_readable( $file ) ) {
188
+				if (is_readable($file)) {
189 189
 					include $file;
190 190
 
191
-					update_option( 'pronamic_pay_db_version', $version );
191
+					update_option('pronamic_pay_db_version', $version);
192 192
 				}
193 193
 			}
194 194
 		}
195 195
 
196
-		update_option( 'pronamic_pay_db_version', $pronamic_pay_version );
196
+		update_option('pronamic_pay_db_version', $pronamic_pay_version);
197 197
 	}
198 198
 
199 199
 	/**
200 200
 	 * Redirect to about.
201 201
 	 */
202 202
 	private function redirect_to_about() {
203
-		wp_safe_redirect( admin_url( 'index.php?page=pronamic-pay-about' ) );
203
+		wp_safe_redirect(admin_url('index.php?page=pronamic-pay-about'));
204 204
 
205 205
 		exit;
206 206
 	}
Please login to merge, or discard this patch.
classes/Admin/PaymentPostType.php 1 patch
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -36,29 +36,29 @@  discard block
 block discarded – undo
36 36
 	 * Constructs and initializes an admin payment post type object.
37 37
 	 */
38 38
 	public function __construct() {
39
-		add_filter( 'request', array( $this, 'request' ) );
39
+		add_filter('request', array($this, 'request'));
40 40
 
41
-		add_filter( 'manage_edit-' . self::POST_TYPE . '_columns', array( $this, 'columns' ) );
42
-		add_filter( 'manage_edit-' . self::POST_TYPE . '_sortable_columns', array( $this, 'sortable_columns' ) );
41
+		add_filter('manage_edit-' . self::POST_TYPE . '_columns', array($this, 'columns'));
42
+		add_filter('manage_edit-' . self::POST_TYPE . '_sortable_columns', array($this, 'sortable_columns'));
43 43
 
44
-		add_action( 'manage_' . self::POST_TYPE . '_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 );
44
+		add_action('manage_' . self::POST_TYPE . '_posts_custom_column', array($this, 'custom_columns'), 10, 2);
45 45
 
46
-		add_action( 'load-post.php', array( $this, 'maybe_check_status' ) );
46
+		add_action('load-post.php', array($this, 'maybe_check_status'));
47 47
 
48
-		add_action( 'admin_notices', array( $this, 'admin_notices' ) );
48
+		add_action('admin_notices', array($this, 'admin_notices'));
49 49
 
50
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
50
+		add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
51 51
 
52
-		add_filter( 'post_row_actions', array( $this, 'post_row_actions' ), 10, 2 );
52
+		add_filter('post_row_actions', array($this, 'post_row_actions'), 10, 2);
53 53
 
54
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
54
+		add_action('pre_get_posts', array($this, 'pre_get_posts'));
55 55
 
56
-		add_filter( 'default_hidden_columns', array( $this, 'default_hidden_columns' ) );
56
+		add_filter('default_hidden_columns', array($this, 'default_hidden_columns'));
57 57
 
58
-		add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
58
+		add_filter('post_updated_messages', array($this, 'post_updated_messages'));
59 59
 
60 60
 		// Transition Post Status.
61
-		add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 );
61
+		add_action('transition_post_status', array($this, 'transition_post_status'), 10, 3);
62 62
 
63 63
 		// Bulk Actions.
64 64
 		$this->bulk_actions = new PaymentBulkActions();
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 	 * @param  array $vars Request variables.
73 73
 	 * @return array
74 74
 	 */
75
-	public function request( $vars ) {
75
+	public function request($vars) {
76 76
 		$screen = get_current_screen();
77 77
 
78
-		if ( self::POST_TYPE === $screen->post_type ) {
79
-			if ( ! isset( $vars['post_status'] ) ) {
80
-				$vars['post_status'] = array_keys( \Pronamic\WordPress\Pay\Plugin::get_payment_states() );
78
+		if (self::POST_TYPE === $screen->post_type) {
79
+			if ( ! isset($vars['post_status'])) {
80
+				$vars['post_status'] = array_keys(\Pronamic\WordPress\Pay\Plugin::get_payment_states());
81 81
 
82 82
 				$vars['post_status'][] = 'publish';
83 83
 			}
@@ -91,27 +91,27 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function maybe_check_status() {
93 93
 		// Current user.
94
-		if ( ! current_user_can( 'edit_payments' ) ) {
94
+		if ( ! current_user_can('edit_payments')) {
95 95
 			return;
96 96
 		}
97 97
 
98 98
 		// Screen.
99 99
 		$screen = get_current_screen();
100 100
 
101
-		if ( ! ( 'post' === $screen->base && 'pronamic_payment' === $screen->post_type ) ) {
101
+		if ( ! ('post' === $screen->base && 'pronamic_payment' === $screen->post_type)) {
102 102
 			return;
103 103
 		}
104 104
 
105
-		$post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT );
105
+		$post_id = filter_input(INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT);
106 106
 
107
-		if ( filter_has_var( INPUT_GET, 'pronamic_pay_check_status' ) && check_admin_referer( 'pronamic_payment_check_status_' . $post_id ) ) {
108
-			$payment = get_pronamic_payment( $post_id );
107
+		if (filter_has_var(INPUT_GET, 'pronamic_pay_check_status') && check_admin_referer('pronamic_payment_check_status_' . $post_id)) {
108
+			$payment = get_pronamic_payment($post_id);
109 109
 
110
-			\Pronamic\WordPress\Pay\Plugin::update_payment( $payment, false );
110
+			\Pronamic\WordPress\Pay\Plugin::update_payment($payment, false);
111 111
 
112 112
 			$this->admin_notices[] = array(
113 113
 				'type'    => 'info',
114
-				'message' => __( 'Payment status updated.', 'pronamic_ideal' ),
114
+				'message' => __('Payment status updated.', 'pronamic_ideal'),
115 115
 			);
116 116
 		}
117 117
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	 * Admin notices.
121 121
 	 */
122 122
 	public function admin_notices() {
123
-		foreach ( $this->admin_notices as $notice ) {
123
+		foreach ($this->admin_notices as $notice) {
124 124
 			printf(
125 125
 				'<div class="notice notice-%1$s"><p>%2$s</p></div>',
126
-				esc_attr( $notice['type'] ),
127
-				esc_html( $notice['message'] )
126
+				esc_attr($notice['type']),
127
+				esc_html($notice['message'])
128 128
 			);
129 129
 		}
130 130
 	}
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @param WP_Query $query WordPress query.
136 136
 	 */
137
-	public function pre_get_posts( $query ) {
138
-		if ( 'pronamic_payment_amount' === $query->get( 'orderby' ) ) {
139
-			$query->set( 'meta_key', '_pronamic_payment_amount' );
140
-			$query->set( 'orderby', 'meta_value_num' );
137
+	public function pre_get_posts($query) {
138
+		if ('pronamic_payment_amount' === $query->get('orderby')) {
139
+			$query->set('meta_key', '_pronamic_payment_amount');
140
+			$query->set('orderby', 'meta_value_num');
141 141
 		}
142 142
 	}
143 143
 
@@ -147,26 +147,26 @@  discard block
 block discarded – undo
147 147
 	 * @param array $columns Columns.
148 148
 	 * @return array
149 149
 	 */
150
-	public function columns( $columns ) {
150
+	public function columns($columns) {
151 151
 		$columns = array(
152 152
 			'cb'                            => '<input type="checkbox" />',
153 153
 			'pronamic_payment_status'       => sprintf(
154 154
 				'<span class="pronamic-pay-tip pronamic-pay-icon" title="%s">%s</span>',
155
-				esc_html__( 'Status', 'pronamic_ideal' ),
156
-				esc_html__( 'Status', 'pronamic_ideal' )
155
+				esc_html__('Status', 'pronamic_ideal'),
156
+				esc_html__('Status', 'pronamic_ideal')
157 157
 			),
158 158
 			'pronamic_payment_subscription' => sprintf(
159 159
 				'<span class="pronamic-pay-tip pronamic-pay-icon pronamic-pay-icon-recurring" title="%s">%s</span>',
160
-				esc_html__( 'Subscription', 'pronamic_ideal' ),
161
-				esc_html__( 'Subscription', 'pronamic_ideal' )
160
+				esc_html__('Subscription', 'pronamic_ideal'),
161
+				esc_html__('Subscription', 'pronamic_ideal')
162 162
 			),
163
-			'pronamic_payment_title'        => __( 'Payment', 'pronamic_ideal' ),
164
-			'pronamic_payment_transaction'  => __( 'Transaction', 'pronamic_ideal' ),
165
-			'pronamic_payment_gateway'      => __( 'Gateway', 'pronamic_ideal' ),
166
-			'pronamic_payment_description'  => __( 'Description', 'pronamic_ideal' ),
167
-			'pronamic_payment_customer'     => __( 'Customer', 'pronamic_ideal' ),
168
-			'pronamic_payment_amount'       => __( 'Amount', 'pronamic_ideal' ),
169
-			'pronamic_payment_date'         => __( 'Date', 'pronamic_ideal' ),
163
+			'pronamic_payment_title'        => __('Payment', 'pronamic_ideal'),
164
+			'pronamic_payment_transaction'  => __('Transaction', 'pronamic_ideal'),
165
+			'pronamic_payment_gateway'      => __('Gateway', 'pronamic_ideal'),
166
+			'pronamic_payment_description'  => __('Description', 'pronamic_ideal'),
167
+			'pronamic_payment_customer'     => __('Customer', 'pronamic_ideal'),
168
+			'pronamic_payment_amount'       => __('Amount', 'pronamic_ideal'),
169
+			'pronamic_payment_date'         => __('Date', 'pronamic_ideal'),
170 170
 		);
171 171
 
172 172
 		return $columns;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 * @param array $hidden Default hidden columns.
179 179
 	 * @return array
180 180
 	 */
181
-	public function default_hidden_columns( $hidden ) {
181
+	public function default_hidden_columns($hidden) {
182 182
 		$hidden[] = 'pronamic_payment_gateway';
183 183
 		$hidden[] = 'pronamic_payment_description';
184 184
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 * @param array $sortable_columns Sortable columns.
192 192
 	 * @return array
193 193
 	 */
194
-	public function sortable_columns( $sortable_columns ) {
194
+	public function sortable_columns($sortable_columns) {
195 195
 		$sortable_columns['pronamic_payment_title']  = 'ID';
196 196
 		$sortable_columns['pronamic_payment_amount'] = 'pronamic_payment_amount';
197 197
 		$sortable_columns['pronamic_payment_date']   = 'date';
@@ -205,52 +205,52 @@  discard block
 block discarded – undo
205 205
 	 * @param string $column  Column.
206 206
 	 * @param string $post_id Post ID.
207 207
 	 */
208
-	public function custom_columns( $column, $post_id ) {
209
-		$payment = get_pronamic_payment( $post_id );
208
+	public function custom_columns($column, $post_id) {
209
+		$payment = get_pronamic_payment($post_id);
210 210
 
211
-		switch ( $column ) {
211
+		switch ($column) {
212 212
 			case 'pronamic_payment_status':
213
-				$post_status = get_post_status( $post_id );
213
+				$post_status = get_post_status($post_id);
214 214
 
215
-				$label = __( 'Unknown', 'pronamic_ideal' );
215
+				$label = __('Unknown', 'pronamic_ideal');
216 216
 
217
-				if ( 'trash' === $post_status ) {
218
-					$post_status = get_post_meta( $post_id, '_wp_trash_meta_status', true );
217
+				if ('trash' === $post_status) {
218
+					$post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
219 219
 				}
220 220
 
221
-				$status_object = get_post_status_object( $post_status );
221
+				$status_object = get_post_status_object($post_status);
222 222
 
223
-				if ( isset( $status_object, $status_object->label ) ) {
223
+				if (isset($status_object, $status_object->label)) {
224 224
 					$label = $status_object->label;
225 225
 				}
226 226
 
227 227
 				printf(
228 228
 					'<span class="pronamic-pay-tip pronamic-pay-icon %s" title="%s">%s</span>',
229
-					esc_attr( AdminModule::get_post_status_icon_class( $post_status ) ),
230
-					esc_attr( $label ),
231
-					esc_html( $label )
229
+					esc_attr(AdminModule::get_post_status_icon_class($post_status)),
230
+					esc_attr($label),
231
+					esc_html($label)
232 232
 				);
233 233
 
234 234
 				break;
235 235
 			case 'pronamic_payment_subscription':
236
-				$subscription_id = get_post_meta( $post_id, '_pronamic_payment_subscription_id', true );
236
+				$subscription_id = get_post_meta($post_id, '_pronamic_payment_subscription_id', true);
237 237
 
238
-				if ( $subscription_id ) {
239
-					$label = __( 'Recurring payment', 'pronamic_ideal' );
238
+				if ($subscription_id) {
239
+					$label = __('Recurring payment', 'pronamic_ideal');
240 240
 					$class = 'pronamic-pay-icon-recurring';
241 241
 
242
-					$recurring = get_post_meta( $post_id, '_pronamic_payment_recurring', true );
242
+					$recurring = get_post_meta($post_id, '_pronamic_payment_recurring', true);
243 243
 
244
-					if ( ! $recurring ) {
245
-						$label = __( 'First of recurring payment', 'pronamic_ideal' );
244
+					if ( ! $recurring) {
245
+						$label = __('First of recurring payment', 'pronamic_ideal');
246 246
 						$class = ' pronamic-pay-icon-recurring-first';
247 247
 					}
248 248
 
249 249
 					printf(
250 250
 						'<span class="pronamic-pay-tip pronamic-pay-icon %s" title="%s">%s</span>',
251
-						esc_attr( $class ),
252
-						esc_attr( $label ),
253
-						esc_attr( $label )
251
+						esc_attr($class),
252
+						esc_attr($label),
253
+						esc_attr($label)
254 254
 					);
255 255
 				}
256 256
 
@@ -264,21 +264,21 @@  discard block
 block discarded – undo
264 264
 
265 265
 				$source_link = $payment->get_source_link();
266 266
 
267
-				if ( null !== $source_link ) {
267
+				if (null !== $source_link) {
268 268
 					$source_id_text = sprintf(
269 269
 						'<a href="%s">%s</a>',
270
-						esc_url( $source_link ),
270
+						esc_url($source_link),
271 271
 						$source_id_text
272 272
 					);
273 273
 				}
274 274
 
275 275
 				echo wp_kses(
276 276
 					sprintf(
277
-						__( '%1$s for %2$s %3$s', 'pronamic_ideal' ),
277
+						__('%1$s for %2$s %3$s', 'pronamic_ideal'),
278 278
 						sprintf(
279 279
 							'<a href="%s" class="row-title"><strong>#%s</strong></a>',
280
-							esc_url( get_edit_post_link( $post_id ) ),
281
-							esc_html( $post_id )
280
+							esc_url(get_edit_post_link($post_id)),
281
+							esc_html($post_id)
282 282
 						),
283 283
 						$source_description,
284 284
 						$source_id_text
@@ -294,58 +294,58 @@  discard block
 block discarded – undo
294 294
 
295 295
 				break;
296 296
 			case 'pronamic_payment_gateway':
297
-				$config_id = get_post_meta( $post_id, '_pronamic_payment_config_id', true );
297
+				$config_id = get_post_meta($post_id, '_pronamic_payment_config_id', true);
298 298
 
299
-				if ( ! empty( $config_id ) ) {
300
-					echo get_the_title( $config_id );
299
+				if ( ! empty($config_id)) {
300
+					echo get_the_title($config_id);
301 301
 				} else {
302 302
 					echo '—';
303 303
 				}
304 304
 
305 305
 				break;
306 306
 			case 'pronamic_payment_transaction':
307
-				$transaction_id = get_post_meta( $post_id, '_pronamic_payment_transaction_id', true );
307
+				$transaction_id = get_post_meta($post_id, '_pronamic_payment_transaction_id', true);
308 308
 
309 309
 				$url = $payment->get_provider_link();
310 310
 
311
-				if ( empty( $url ) ) {
312
-					echo esc_html( $transaction_id );
311
+				if (empty($url)) {
312
+					echo esc_html($transaction_id);
313 313
 				} else {
314 314
 					printf(
315 315
 						'<a href="%s">%s</a>',
316
-						esc_url( $url ),
317
-						esc_html( $transaction_id )
316
+						esc_url($url),
317
+						esc_html($transaction_id)
318 318
 					);
319 319
 				}
320 320
 
321 321
 				break;
322 322
 			case 'pronamic_payment_description':
323
-				echo esc_html( get_post_meta( $post_id, '_pronamic_payment_description', true ) );
323
+				echo esc_html(get_post_meta($post_id, '_pronamic_payment_description', true));
324 324
 
325 325
 				break;
326 326
 			case 'pronamic_payment_amount':
327
-				$currency = get_post_meta( $post_id, '_pronamic_payment_currency', true );
328
-				$amount   = get_post_meta( $post_id, '_pronamic_payment_amount', true );
327
+				$currency = get_post_meta($post_id, '_pronamic_payment_currency', true);
328
+				$amount   = get_post_meta($post_id, '_pronamic_payment_amount', true);
329 329
 
330
-				echo esc_html( \Pronamic\WordPress\Pay\Util::format_price( $amount, $currency ) );
330
+				echo esc_html(\Pronamic\WordPress\Pay\Util::format_price($amount, $currency));
331 331
 
332 332
 				break;
333 333
 			case 'pronamic_payment_date':
334
-				echo esc_html( get_the_time( __( 'D j M Y \a\t H:i', 'pronamic_ideal' ), $post_id ) );
334
+				echo esc_html(get_the_time(__('D j M Y \a\t H:i', 'pronamic_ideal'), $post_id));
335 335
 
336 336
 				break;
337 337
 			case 'pronamic_payment_consumer':
338
-				echo esc_html( get_post_meta( $post_id, '_pronamic_payment_consumer_name', true ) );
338
+				echo esc_html(get_post_meta($post_id, '_pronamic_payment_consumer_name', true));
339 339
 				echo '<br />';
340
-				echo esc_html( get_post_meta( $post_id, '_pronamic_payment_consumer_account_number', true ) );
341
-				echo esc_html( get_post_meta( $post_id, '_pronamic_payment_consumer_iban', true ) );
342
-				echo esc_html( get_post_meta( $post_id, '_pronamic_payment_consumer_bic', true ) );
340
+				echo esc_html(get_post_meta($post_id, '_pronamic_payment_consumer_account_number', true));
341
+				echo esc_html(get_post_meta($post_id, '_pronamic_payment_consumer_iban', true));
342
+				echo esc_html(get_post_meta($post_id, '_pronamic_payment_consumer_bic', true));
343 343
 				echo '<br />';
344
-				echo esc_html( get_post_meta( $post_id, '_pronamic_payment_consumer_city', true ) );
344
+				echo esc_html(get_post_meta($post_id, '_pronamic_payment_consumer_city', true));
345 345
 
346 346
 				break;
347 347
 			case 'pronamic_payment_customer':
348
-				echo esc_html( get_post_meta( $post_id, '_pronamic_payment_customer_name', true ) );
348
+				echo esc_html(get_post_meta($post_id, '_pronamic_payment_customer_name', true));
349 349
 
350 350
 				break;
351 351
 			case 'pronamic_payment_source':
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
 	 *
361 361
 	 * @param string $post_type Post Type.
362 362
 	 */
363
-	public function add_meta_boxes( $post_type ) {
364
-		if ( self::POST_TYPE === $post_type ) {
363
+	public function add_meta_boxes($post_type) {
364
+		if (self::POST_TYPE === $post_type) {
365 365
 			add_meta_box(
366 366
 				'pronamic_payment',
367
-				__( 'Payment', 'pronamic_ideal' ),
368
-				array( $this, 'meta_box_info' ),
367
+				__('Payment', 'pronamic_ideal'),
368
+				array($this, 'meta_box_info'),
369 369
 				$post_type,
370 370
 				'normal',
371 371
 				'high'
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 
374 374
 			add_meta_box(
375 375
 				'pronamic_payment_subscription',
376
-				__( 'Subscription', 'pronamic_ideal' ),
377
-				array( $this, 'meta_box_subscription' ),
376
+				__('Subscription', 'pronamic_ideal'),
377
+				array($this, 'meta_box_subscription'),
378 378
 				$post_type,
379 379
 				'normal',
380 380
 				'high'
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 
383 383
 			add_meta_box(
384 384
 				'pronamic_payment_log',
385
-				__( 'Log', 'pronamic_ideal' ),
386
-				array( $this, 'meta_box_log' ),
385
+				__('Log', 'pronamic_ideal'),
386
+				array($this, 'meta_box_log'),
387 387
 				$post_type,
388 388
 				'normal',
389 389
 				'high'
@@ -391,15 +391,15 @@  discard block
 block discarded – undo
391 391
 
392 392
 			add_meta_box(
393 393
 				'pronamic_payment_update',
394
-				__( 'Update', 'pronamic_ideal' ),
395
-				array( $this, 'meta_box_update' ),
394
+				__('Update', 'pronamic_ideal'),
395
+				array($this, 'meta_box_update'),
396 396
 				$post_type,
397 397
 				'side',
398 398
 				'high'
399 399
 			);
400 400
 
401 401
 			// @see http://kovshenin.com/2012/how-to-remove-the-publish-box-from-a-post-type/.
402
-			remove_meta_box( 'submitdiv', $post_type, 'side' );
402
+			remove_meta_box('submitdiv', $post_type, 'side');
403 403
 		}
404 404
 	}
405 405
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @param WP_Post $post The object for the current post/page.
410 410
 	 */
411
-	public function meta_box_info( $post ) {
411
+	public function meta_box_info($post) {
412 412
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-payment-info.php';
413 413
 	}
414 414
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * @param WP_Post $post The object for the current post/page.
419 419
 	 */
420
-	public function meta_box_log( $post ) {
420
+	public function meta_box_log($post) {
421 421
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-payment-log.php';
422 422
 	}
423 423
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 *
427 427
 	 * @param WP_Post $post The object for the current post/page.
428 428
 	 */
429
-	public function meta_box_subscription( $post ) {
429
+	public function meta_box_subscription($post) {
430 430
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-payment-subscription.php';
431 431
 	}
432 432
 
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 	 *
436 436
 	 * @param WP_Post $post The object for the current post/page.
437 437
 	 */
438
-	public function meta_box_update( $post ) {
439
-		wp_nonce_field( 'pronamic_payment_update', 'pronamic_payment_update_nonce' );
438
+	public function meta_box_update($post) {
439
+		wp_nonce_field('pronamic_payment_update', 'pronamic_payment_update_nonce');
440 440
 
441 441
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-payment-update.php';
442 442
 	}
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 	 * @param \WP_Post $post    WordPress post.
449 449
 	 * @return array
450 450
 	 */
451
-	public function post_row_actions( $actions, $post ) {
452
-		if ( self::POST_TYPE === $post->post_type ) {
451
+	public function post_row_actions($actions, $post) {
452
+		if (self::POST_TYPE === $post->post_type) {
453 453
 			return array();
454 454
 		}
455 455
 
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 	 * @param string $post_status Post status.
463 463
 	 * @return string
464 464
 	 */
465
-	private function translate_post_status_to_meta_status( $post_status ) {
466
-		switch ( $post_status ) {
465
+	private function translate_post_status_to_meta_status($post_status) {
466
+		switch ($post_status) {
467 467
 			case 'payment_pending':
468 468
 				return \Pronamic\WordPress\Pay\Core\Statuses::OPEN;
469 469
 			case 'payment_processing':
@@ -490,26 +490,26 @@  discard block
 block discarded – undo
490 490
 	 * @param string   $old_status Old status.
491 491
 	 * @param \WP_Post $post       WordPress post.
492 492
 	 */
493
-	public function transition_post_status( $new_status, $old_status, $post ) {
493
+	public function transition_post_status($new_status, $old_status, $post) {
494 494
 		if (
495
-			filter_has_var( INPUT_POST, 'pronamic_payment_update_nonce' )
495
+			filter_has_var(INPUT_POST, 'pronamic_payment_update_nonce')
496 496
 				&&
497
-			check_admin_referer( 'pronamic_payment_update', 'pronamic_payment_update_nonce' )
497
+			check_admin_referer('pronamic_payment_update', 'pronamic_payment_update_nonce')
498 498
 				&&
499
-			'pronamic_payment' === get_post_type( $post )
499
+			'pronamic_payment' === get_post_type($post)
500 500
 		) {
501 501
 			$can_redirect = false;
502 502
 
503
-			$old_status_meta = $this->translate_post_status_to_meta_status( $old_status );
504
-			$new_status_meta = $this->translate_post_status_to_meta_status( $new_status );
503
+			$old_status_meta = $this->translate_post_status_to_meta_status($old_status);
504
+			$new_status_meta = $this->translate_post_status_to_meta_status($new_status);
505 505
 
506
-			update_post_meta( $post->ID, '_pronamic_payment_status', $new_status_meta );
506
+			update_post_meta($post->ID, '_pronamic_payment_status', $new_status_meta);
507 507
 
508
-			$payment = get_pronamic_payment( $post->ID );
508
+			$payment = get_pronamic_payment($post->ID);
509 509
 
510
-			do_action( 'pronamic_payment_status_update_' . $payment->source . '_' . strtolower( $old_status_meta ) . '_to_' . strtolower( $new_status_meta ), $payment, $can_redirect );
511
-			do_action( 'pronamic_payment_status_update_' . $payment->source, $payment, $can_redirect );
512
-			do_action( 'pronamic_payment_status_update', $payment, $can_redirect );
510
+			do_action('pronamic_payment_status_update_' . $payment->source . '_' . strtolower($old_status_meta) . '_to_' . strtolower($new_status_meta), $payment, $can_redirect);
511
+			do_action('pronamic_payment_status_update_' . $payment->source, $payment, $can_redirect);
512
+			do_action('pronamic_payment_status_update', $payment, $can_redirect);
513 513
 		}
514 514
 	}
515 515
 
@@ -522,34 +522,34 @@  discard block
 block discarded – undo
522 522
 	 * @param array $messages Message.
523 523
 	 * @return array
524 524
 	 */
525
-	public function post_updated_messages( $messages ) {
525
+	public function post_updated_messages($messages) {
526 526
 		global $post;
527 527
 
528 528
 		// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352797&filters[translation_id]=37948900
529
-		$scheduled_date = date_i18n( __( 'M j, Y @ H:i', 'pronamic_ideal' ), strtotime( $post->post_date ) );
529
+		$scheduled_date = date_i18n(__('M j, Y @ H:i', 'pronamic_ideal'), strtotime($post->post_date));
530 530
 
531
-		$messages[ self::POST_TYPE ] = array(
531
+		$messages[self::POST_TYPE] = array(
532 532
 			0  => '', // Unused. Messages start at index 1.
533
-			1  => __( 'Payment updated.', 'pronamic_ideal' ),
533
+			1  => __('Payment updated.', 'pronamic_ideal'),
534 534
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352799&filters[translation_id]=37947229.
535 535
 			2  => $messages['post'][2],
536 536
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352800&filters[translation_id]=37947870.
537 537
 			3  => $messages['post'][3],
538 538
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352798&filters[translation_id]=37947230.
539
-			4  => __( 'Payment updated.', 'pronamic_ideal' ),
539
+			4  => __('Payment updated.', 'pronamic_ideal'),
540 540
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352801&filters[translation_id]=37947231.
541 541
 			// translators: %s: date and time of the revision
542
-			5  => isset( $_GET['revision'] ) ? sprintf( __( 'Payment restored to revision from %s.', 'pronamic_ideal' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, // WPCS: CSRF ok.
542
+			5  => isset($_GET['revision']) ? sprintf(__('Payment restored to revision from %s.', 'pronamic_ideal'), wp_post_revision_title((int) $_GET['revision'], false)) : false, // WPCS: CSRF ok.
543 543
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352802&filters[translation_id]=37949178.
544
-			6  => __( 'Payment published.', 'pronamic_ideal' ),
544
+			6  => __('Payment published.', 'pronamic_ideal'),
545 545
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352803&filters[translation_id]=37947232.
546
-			7  => __( 'Payment saved.', 'pronamic_ideal' ),
546
+			7  => __('Payment saved.', 'pronamic_ideal'),
547 547
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352804&filters[translation_id]=37949303.
548
-			8  => __( 'Payment submitted.', 'pronamic_ideal' ),
548
+			8  => __('Payment submitted.', 'pronamic_ideal'),
549 549
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352805&filters[translation_id]=37949302.
550
-			9  => sprintf( __( 'Payment scheduled for: %s.', 'pronamic_ideal' ), '<strong>' . $scheduled_date . '</strong>' ),
550
+			9  => sprintf(__('Payment scheduled for: %s.', 'pronamic_ideal'), '<strong>' . $scheduled_date . '</strong>'),
551 551
 			// @https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352806&filters[translation_id]=37949301.
552
-			10 => __( 'Payment draft updated.', 'pronamic_ideal' ),
552
+			10 => __('Payment draft updated.', 'pronamic_ideal'),
553 553
 		);
554 554
 
555 555
 		return $messages;
Please login to merge, or discard this patch.
classes/Admin/SubscriptionPostType.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
 	 * Constructs and initializes an admin payment post type object.
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_filter( 'request', array( $this, 'request' ) );
30
+		add_filter('request', array($this, 'request'));
31 31
 
32
-		add_filter( 'manage_edit-' . self::POST_TYPE . '_columns', array( $this, 'columns' ) );
33
-		add_filter( 'manage_edit-' . self::POST_TYPE . '_sortable_columns', array( $this, 'sortable_columns' ) );
32
+		add_filter('manage_edit-' . self::POST_TYPE . '_columns', array($this, 'columns'));
33
+		add_filter('manage_edit-' . self::POST_TYPE . '_sortable_columns', array($this, 'sortable_columns'));
34 34
 
35
-		add_action( 'manage_' . self::POST_TYPE . '_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 );
35
+		add_action('manage_' . self::POST_TYPE . '_posts_custom_column', array($this, 'custom_columns'), 10, 2);
36 36
 
37
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
37
+		add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
38 38
 
39
-		add_filter( 'post_row_actions', array( $this, 'post_row_actions' ), 10, 2 );
39
+		add_filter('post_row_actions', array($this, 'post_row_actions'), 10, 2);
40 40
 
41 41
 		// Transition post status.
42
-		add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 );
42
+		add_action('transition_post_status', array($this, 'transition_post_status'), 10, 3);
43 43
 	}
44 44
 
45 45
 	/**
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	 * @param  array $vars Request variables.
51 51
 	 * @return array
52 52
 	 */
53
-	public function request( $vars ) {
53
+	public function request($vars) {
54 54
 		$screen = get_current_screen();
55 55
 
56
-		if ( self::POST_TYPE === $screen->post_type ) {
57
-			if ( ! isset( $vars['post_status'] ) ) {
58
-				$vars['post_status'] = array_keys( \Pronamic\WordPress\Pay\Plugin::get_subscription_states() );
56
+		if (self::POST_TYPE === $screen->post_type) {
57
+			if ( ! isset($vars['post_status'])) {
58
+				$vars['post_status'] = array_keys(\Pronamic\WordPress\Pay\Plugin::get_subscription_states());
59 59
 
60 60
 				$vars['post_status'][] = 'publish';
61 61
 			}
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
 	 * @param array $columns Columns.
71 71
 	 * @return array
72 72
 	 */
73
-	public function columns( $columns ) {
73
+	public function columns($columns) {
74 74
 		$columns = array(
75 75
 			'cb'                              => '<input type="checkbox" />',
76 76
 			'pronamic_subscription_status'    => sprintf(
77 77
 				'<span class="pronamic-pay-tip pronamic-pay-icon" title="%s">%s</span>',
78
-				esc_html__( 'Status', 'pronamic_ideal' ),
79
-				esc_html__( 'Status', 'pronamic_ideal' )
78
+				esc_html__('Status', 'pronamic_ideal'),
79
+				esc_html__('Status', 'pronamic_ideal')
80 80
 			),
81
-			'pronamic_subscription_title'     => __( 'Subscription', 'pronamic_ideal' ),
82
-			'pronamic_subscription_customer'  => __( 'Customer', 'pronamic_ideal' ),
83
-			'pronamic_subscription_amount'    => __( 'Amount', 'pronamic_ideal' ),
84
-			'pronamic_subscription_recurring' => __( 'Recurrence', 'pronamic_ideal' ),
85
-			'pronamic_subscription_date'      => __( 'Date', 'pronamic_ideal' ),
81
+			'pronamic_subscription_title'     => __('Subscription', 'pronamic_ideal'),
82
+			'pronamic_subscription_customer'  => __('Customer', 'pronamic_ideal'),
83
+			'pronamic_subscription_amount'    => __('Amount', 'pronamic_ideal'),
84
+			'pronamic_subscription_recurring' => __('Recurrence', 'pronamic_ideal'),
85
+			'pronamic_subscription_date'      => __('Date', 'pronamic_ideal'),
86 86
 		);
87 87
 
88 88
 		return $columns;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @param array $sortable_columns Sortable columns.
95 95
 	 * @return array
96 96
 	 */
97
-	public function sortable_columns( $sortable_columns ) {
97
+	public function sortable_columns($sortable_columns) {
98 98
 		$sortable_columns['pronamic_subscription_title'] = 'ID';
99 99
 		$sortable_columns['pronamic_subscription_date']  = 'date';
100 100
 
@@ -107,30 +107,30 @@  discard block
 block discarded – undo
107 107
 	 * @param string $column  Column.
108 108
 	 * @param string $post_id Post ID.
109 109
 	 */
110
-	public function custom_columns( $column, $post_id ) {
111
-		$subscription = get_pronamic_subscription( $post_id );
110
+	public function custom_columns($column, $post_id) {
111
+		$subscription = get_pronamic_subscription($post_id);
112 112
 
113
-		switch ( $column ) {
113
+		switch ($column) {
114 114
 			case 'pronamic_subscription_status':
115
-				$post_status = get_post_status( $post_id );
115
+				$post_status = get_post_status($post_id);
116 116
 
117
-				$label = __( 'Unknown', 'pronamic_ideal' );
117
+				$label = __('Unknown', 'pronamic_ideal');
118 118
 
119
-				if ( 'trash' === $post_status ) {
120
-					$post_status = get_post_meta( $post_id, '_wp_trash_meta_status', true );
119
+				if ('trash' === $post_status) {
120
+					$post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
121 121
 				}
122 122
 
123
-				$status_object = get_post_status_object( $post_status );
123
+				$status_object = get_post_status_object($post_status);
124 124
 
125
-				if ( isset( $status_object, $status_object->label ) ) {
125
+				if (isset($status_object, $status_object->label)) {
126 126
 					$label = $status_object->label;
127 127
 				}
128 128
 
129 129
 				printf(
130 130
 					'<span class="pronamic-pay-tip pronamic-pay-icon %s" title="%s">%s</span>',
131
-					esc_attr( AdminModule::get_post_status_icon_class( $post_status ) ),
132
-					esc_attr( $label ),
133
-					esc_html( $label )
131
+					esc_attr(AdminModule::get_post_status_icon_class($post_status)),
132
+					esc_attr($label),
133
+					esc_html($label)
134 134
 				);
135 135
 
136 136
 				break;
@@ -143,21 +143,21 @@  discard block
 block discarded – undo
143 143
 
144 144
 				$source_link = $subscription->get_source_link();
145 145
 
146
-				if ( null !== $source_link ) {
146
+				if (null !== $source_link) {
147 147
 					$source_id_text = sprintf(
148 148
 						'<a href="%s">%s</a>',
149
-						esc_url( $source_link ),
149
+						esc_url($source_link),
150 150
 						$source_id_text
151 151
 					);
152 152
 				}
153 153
 
154 154
 				echo wp_kses(
155 155
 					sprintf(
156
-						__( '%1$s for %2$s %3$s', 'pronamic_ideal' ),
156
+						__('%1$s for %2$s %3$s', 'pronamic_ideal'),
157 157
 						sprintf(
158 158
 							'<a href="%s" class="row-title"><strong>#%s</strong></a>',
159
-							esc_url( get_edit_post_link( $post_id ) ),
160
-							esc_html( $post_id )
159
+							esc_url(get_edit_post_link($post_id)),
160
+							esc_html($post_id)
161 161
 						),
162 162
 						$source_description,
163 163
 						$source_id_text
@@ -173,75 +173,75 @@  discard block
 block discarded – undo
173 173
 
174 174
 				break;
175 175
 			case 'pronamic_subscription_gateway':
176
-				$payment = get_pronamic_payment_by_meta( '_pronamic_payment_subscription_id', $post_id );
176
+				$payment = get_pronamic_payment_by_meta('_pronamic_payment_subscription_id', $post_id);
177 177
 
178
-				if ( $payment ) {
179
-					$config_id = get_post_meta( $payment->get_id(), '_pronamic_payment_config_id', true );
178
+				if ($payment) {
179
+					$config_id = get_post_meta($payment->get_id(), '_pronamic_payment_config_id', true);
180 180
 				}
181 181
 
182
-				if ( isset( $config_id ) && ! empty( $config_id ) ) {
183
-					echo get_the_title( $config_id );
182
+				if (isset($config_id) && ! empty($config_id)) {
183
+					echo get_the_title($config_id);
184 184
 				} else {
185 185
 					echo '—';
186 186
 				}
187 187
 
188 188
 				break;
189 189
 			case 'pronamic_subscription_description':
190
-				echo esc_html( get_post_meta( $post_id, '_pronamic_subscription_description', true ) );
190
+				echo esc_html(get_post_meta($post_id, '_pronamic_subscription_description', true));
191 191
 
192 192
 				break;
193 193
 			case 'pronamic_subscription_amount':
194
-				$currency = get_post_meta( $post_id, '_pronamic_subscription_currency', true );
195
-				$amount   = get_post_meta( $post_id, '_pronamic_subscription_amount', true );
194
+				$currency = get_post_meta($post_id, '_pronamic_subscription_currency', true);
195
+				$amount   = get_post_meta($post_id, '_pronamic_subscription_amount', true);
196 196
 
197
-				echo esc_html( \Pronamic\WordPress\Pay\Util::format_price( $amount, $currency ) );
197
+				echo esc_html(\Pronamic\WordPress\Pay\Util::format_price($amount, $currency));
198 198
 
199 199
 				break;
200 200
 			case 'pronamic_subscription_interval':
201
-				echo esc_html( \Pronamic\WordPress\Pay\Util::format_interval( $subscription->get_interval(), $subscription->get_interval_period() ) );
201
+				echo esc_html(\Pronamic\WordPress\Pay\Util::format_interval($subscription->get_interval(), $subscription->get_interval_period()));
202 202
 
203 203
 				break;
204 204
 			case 'pronamic_subscription_frequency':
205
-				echo esc_html( \Pronamic\WordPress\Pay\Util::format_frequency( $subscription->get_frequency() ) );
205
+				echo esc_html(\Pronamic\WordPress\Pay\Util::format_frequency($subscription->get_frequency()));
206 206
 
207 207
 				break;
208 208
 			case 'pronamic_subscription_recurring':
209
-				echo esc_html( \Pronamic\WordPress\Pay\Util::format_interval( $subscription->get_interval(), $subscription->get_interval_period() ) );
209
+				echo esc_html(\Pronamic\WordPress\Pay\Util::format_interval($subscription->get_interval(), $subscription->get_interval_period()));
210 210
 				echo '<br />';
211
-				echo esc_html( \Pronamic\WordPress\Pay\Util::format_frequency( $subscription->get_frequency() ) );
211
+				echo esc_html(\Pronamic\WordPress\Pay\Util::format_frequency($subscription->get_frequency()));
212 212
 
213 213
 				break;
214 214
 			case 'pronamic_subscription_date':
215
-				the_time( __( 'D j M Y \a\t H:i', 'pronamic_ideal' ) );
215
+				the_time(__('D j M Y \a\t H:i', 'pronamic_ideal'));
216 216
 
217 217
 				break;
218 218
 			case 'pronamic_subscription_source':
219
-				$payment = get_pronamic_payment_by_meta( '_pronamic_payment_subscription_id', $post_id );
219
+				$payment = get_pronamic_payment_by_meta('_pronamic_payment_subscription_id', $post_id);
220 220
 
221
-				if ( $payment ) {
221
+				if ($payment) {
222 222
 					echo $payment->get_source_text(); // WPCS: XSS ok.
223 223
 				} else {
224
-					$source    = get_post_meta( $post_id, '_pronamic_subscription_source', true );
225
-					$source_id = get_post_meta( $post_id, '_pronamic_subscription_source_id', true );
224
+					$source    = get_post_meta($post_id, '_pronamic_subscription_source', true);
225
+					$source_id = get_post_meta($post_id, '_pronamic_subscription_source_id', true);
226 226
 
227 227
 					printf(
228 228
 						'%s<br />%s', // WPCS: XSS ok.
229
-						esc_html( $source ),
230
-						esc_html( $source_id )
229
+						esc_html($source),
230
+						esc_html($source_id)
231 231
 					);
232 232
 				}
233 233
 
234 234
 				break;
235 235
 			case 'pronamic_subscription_consumer':
236
-				echo esc_html( get_post_meta( $post_id, '_pronamic_subscription_consumer_name', true ) );
236
+				echo esc_html(get_post_meta($post_id, '_pronamic_subscription_consumer_name', true));
237 237
 				echo '<br />';
238
-				echo esc_html( get_post_meta( $post_id, '_pronamic_subscription_consumer_iban', true ) );
238
+				echo esc_html(get_post_meta($post_id, '_pronamic_subscription_consumer_iban', true));
239 239
 				echo '<br />';
240
-				echo esc_html( get_post_meta( $post_id, '_pronamic_subscription_consumer_bic', true ) );
240
+				echo esc_html(get_post_meta($post_id, '_pronamic_subscription_consumer_bic', true));
241 241
 
242 242
 				break;
243 243
 			case 'pronamic_subscription_customer':
244
-				echo esc_html( get_post_meta( $post_id, '_pronamic_subscription_customer_name', true ) );
244
+				echo esc_html(get_post_meta($post_id, '_pronamic_subscription_customer_name', true));
245 245
 
246 246
 				break;
247 247
 		}
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @param string $post_type Post Type.
254 254
 	 */
255
-	public function add_meta_boxes( $post_type ) {
256
-		if ( self::POST_TYPE === $post_type ) {
255
+	public function add_meta_boxes($post_type) {
256
+		if (self::POST_TYPE === $post_type) {
257 257
 			add_meta_box(
258 258
 				'pronamic_subscription',
259
-				__( 'Subscription', 'pronamic_ideal' ),
260
-				array( $this, 'meta_box_info' ),
259
+				__('Subscription', 'pronamic_ideal'),
260
+				array($this, 'meta_box_info'),
261 261
 				$post_type,
262 262
 				'normal',
263 263
 				'high'
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 
266 266
 			add_meta_box(
267 267
 				'pronamic_subscription_payments',
268
-				__( 'Payments', 'pronamic_ideal' ),
269
-				array( $this, 'meta_box_payments' ),
268
+				__('Payments', 'pronamic_ideal'),
269
+				array($this, 'meta_box_payments'),
270 270
 				$post_type,
271 271
 				'normal',
272 272
 				'high'
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 
275 275
 			add_meta_box(
276 276
 				'pronamic_subscription_log',
277
-				__( 'Log', 'pronamic_ideal' ),
278
-				array( $this, 'meta_box_log' ),
277
+				__('Log', 'pronamic_ideal'),
278
+				array($this, 'meta_box_log'),
279 279
 				$post_type,
280 280
 				'normal',
281 281
 				'high'
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 
284 284
 			add_meta_box(
285 285
 				'pronamic_subscription_update',
286
-				__( 'Update', 'pronamic_ideal' ),
287
-				array( $this, 'meta_box_update' ),
286
+				__('Update', 'pronamic_ideal'),
287
+				array($this, 'meta_box_update'),
288 288
 				$post_type,
289 289
 				'side',
290 290
 				'high'
291 291
 			);
292 292
 
293 293
 			// @see http://kovshenin.com/2012/how-to-remove-the-publish-box-from-a-post-type/.
294
-			remove_meta_box( 'submitdiv', $post_type, 'side' );
294
+			remove_meta_box('submitdiv', $post_type, 'side');
295 295
 		}
296 296
 	}
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 *
301 301
 	 * @param WP_Post $post The object for the current post/page.
302 302
 	 */
303
-	public function meta_box_info( $post ) {
303
+	public function meta_box_info($post) {
304 304
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-subscription-info.php';
305 305
 	}
306 306
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 *
310 310
 	 * @param WP_Post $post The object for the current post/page.
311 311
 	 */
312
-	public function meta_box_log( $post ) {
312
+	public function meta_box_log($post) {
313 313
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-subscription-log.php';
314 314
 	}
315 315
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 *
319 319
 	 * @param WP_Post $post The object for the current post/page.
320 320
 	 */
321
-	public function meta_box_payments( $post ) {
321
+	public function meta_box_payments($post) {
322 322
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-subscription-payments.php';
323 323
 	}
324 324
 
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @param WP_Post $post The object for the current post/page.
329 329
 	 */
330
-	public function meta_box_update( $post ) {
331
-		wp_nonce_field( 'pronamic_subscription_update', 'pronamic_subscription_update_nonce' );
330
+	public function meta_box_update($post) {
331
+		wp_nonce_field('pronamic_subscription_update', 'pronamic_subscription_update_nonce');
332 332
 
333 333
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-subscription-update.php';
334 334
 	}
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 * @param \WP_Post $post    WordPress post.
341 341
 	 * @return array
342 342
 	 */
343
-	public function post_row_actions( $actions, $post ) {
344
-		if ( self::POST_TYPE === $post->post_type ) {
343
+	public function post_row_actions($actions, $post) {
344
+		if (self::POST_TYPE === $post->post_type) {
345 345
 			return array();
346 346
 		}
347 347
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 * @param string $post_status Post status.
355 355
 	 * @return string
356 356
 	 */
357
-	private function translate_post_status_to_meta_status( $post_status ) {
358
-		switch ( $post_status ) {
357
+	private function translate_post_status_to_meta_status($post_status) {
358
+		switch ($post_status) {
359 359
 			case 'subscr_pending':
360 360
 				return \Pronamic\WordPress\Pay\Core\Statuses::OPEN;
361 361
 			case 'subscr_cancelled':
@@ -378,36 +378,36 @@  discard block
 block discarded – undo
378 378
 	 * @param string   $old_status Old status.
379 379
 	 * @param \WP_Post $post       WordPress post.
380 380
 	 */
381
-	public function transition_post_status( $new_status, $old_status, $post ) {
381
+	public function transition_post_status($new_status, $old_status, $post) {
382 382
 		if (
383
-			filter_has_var( INPUT_POST, 'pronamic_subscription_update_nonce' )
383
+			filter_has_var(INPUT_POST, 'pronamic_subscription_update_nonce')
384 384
 			&&
385
-			check_admin_referer( 'pronamic_subscription_update', 'pronamic_subscription_update_nonce' )
385
+			check_admin_referer('pronamic_subscription_update', 'pronamic_subscription_update_nonce')
386 386
 			&&
387
-			'pronamic_pay_subscr' === get_post_type( $post )
387
+			'pronamic_pay_subscr' === get_post_type($post)
388 388
 		) {
389 389
 			$can_redirect = false;
390 390
 
391
-			$old_status_meta = $this->translate_post_status_to_meta_status( $old_status );
392
-			$new_status_meta = $this->translate_post_status_to_meta_status( $new_status );
391
+			$old_status_meta = $this->translate_post_status_to_meta_status($old_status);
392
+			$new_status_meta = $this->translate_post_status_to_meta_status($new_status);
393 393
 
394
-			$subscription = get_pronamic_subscription( $post->ID );
394
+			$subscription = get_pronamic_subscription($post->ID);
395 395
 
396 396
 			// Update subscription status.
397
-			remove_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 );
397
+			remove_action('transition_post_status', array($this, 'transition_post_status'), 10, 3);
398 398
 
399 399
 			$can_redirect = false;
400 400
 
401
-			$subscription->update_status( $new_status_meta );
401
+			$subscription->update_status($new_status_meta);
402 402
 
403
-			\Pronamic\WordPress\Pay\Plugin::update_subscription( $subscription, $can_redirect );
403
+			\Pronamic\WordPress\Pay\Plugin::update_subscription($subscription, $can_redirect);
404 404
 
405
-			add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 );
405
+			add_action('transition_post_status', array($this, 'transition_post_status'), 10, 3);
406 406
 
407 407
 			// Do subscription status update actions.
408
-			do_action( 'pronamic_subscription_status_update_' . $subscription->source . '_' . strtolower( $old_status_meta ) . '_to_' . strtolower( $new_status_meta ), $subscription, $can_redirect );
409
-			do_action( 'pronamic_subscription_status_update_' . $subscription->source, $subscription, $can_redirect );
410
-			do_action( 'pronamic_subscription_status_update', $subscription, $can_redirect );
408
+			do_action('pronamic_subscription_status_update_' . $subscription->source . '_' . strtolower($old_status_meta) . '_to_' . strtolower($new_status_meta), $subscription, $can_redirect);
409
+			do_action('pronamic_subscription_status_update_' . $subscription->source, $subscription, $can_redirect);
410
+			do_action('pronamic_subscription_status_update', $subscription, $can_redirect);
411 411
 		}
412 412
 	}
413 413
 }
Please login to merge, or discard this patch.
classes/Admin/AdminModule.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -25,28 +25,28 @@  discard block
 block discarded – undo
25 25
 	 *
26 26
 	 * @param Plugin $plugin Plugin.
27 27
 	 */
28
-	public function __construct( Plugin $plugin ) {
28
+	public function __construct(Plugin $plugin) {
29 29
 		$this->plugin = $plugin;
30 30
 
31
-		$this->install = new Install( $this );
31
+		$this->install = new Install($this);
32 32
 
33 33
 		// Actions.
34
-		add_action( 'admin_init', array( $this, 'admin_init' ) );
35
-		add_action( 'admin_menu', array( $this, 'admin_menu' ) );
34
+		add_action('admin_init', array($this, 'admin_init'));
35
+		add_action('admin_menu', array($this, 'admin_menu'));
36 36
 
37
-		add_action( 'load-post.php', array( $this, 'maybe_test_payment' ) );
37
+		add_action('load-post.php', array($this, 'maybe_test_payment'));
38 38
 
39
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
39
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
40 40
 
41
-		add_filter( 'pronamic_pay_gateway_settings', array( $this, 'gateway_settings' ) );
41
+		add_filter('pronamic_pay_gateway_settings', array($this, 'gateway_settings'));
42 42
 
43 43
 		// Modules.
44
-		$this->settings  = new AdminSettings( $plugin );
45
-		$this->about     = new AdminAboutPage( $plugin, $this );
46
-		$this->dashboard = new AdminDashboard( $plugin );
47
-		$this->notices   = new AdminNotices( $plugin );
48
-		$this->reports   = new AdminReports( $plugin, $this );
49
-		$this->tour      = new AdminTour( $plugin );
44
+		$this->settings  = new AdminSettings($plugin);
45
+		$this->about     = new AdminAboutPage($plugin, $this);
46
+		$this->dashboard = new AdminDashboard($plugin);
47
+		$this->notices   = new AdminNotices($plugin);
48
+		$this->reports   = new AdminReports($plugin, $this);
49
+		$this->tour      = new AdminTour($plugin);
50 50
 	}
51 51
 
52 52
 	/**
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 		$this->maybe_redirect();
63 63
 
64 64
 		// Post types.
65
-		new GatewayPostType( $this );
65
+		new GatewayPostType($this);
66 66
 		new PaymentPostType();
67 67
 		new SubscriptionPostType();
68 68
 
69 69
 		// Gateway settings.
70 70
 		$this->gateway_settings = new GatewaySettings();
71 71
 
72
-		if ( ! wp_next_scheduled( 'pronamic_pay_license_check' ) ) {
73
-			wp_schedule_event( time(), 'daily', 'pronamic_pay_license_check' );
72
+		if ( ! wp_next_scheduled('pronamic_pay_license_check')) {
73
+			wp_schedule_event(time(), 'daily', 'pronamic_pay_license_check');
74 74
 		}
75 75
 	}
76 76
 
@@ -81,33 +81,33 @@  discard block
 block discarded – undo
81 81
 	 * @see https://github.com/woothemes/woocommerce/blob/2.4.4/includes/admin/class-wc-admin.php#L96-L122
82 82
 	 */
83 83
 	public function maybe_redirect() {
84
-		$redirect = get_transient( 'pronamic_pay_admin_redirect' );
84
+		$redirect = get_transient('pronamic_pay_admin_redirect');
85 85
 
86 86
 		// Check.
87 87
 		if (
88 88
 			false === $redirect
89 89
 				||
90
-			defined( 'DOING_AJAX' ) && DOING_AJAX
90
+			defined('DOING_AJAX') && DOING_AJAX
91 91
 				||
92
-			defined( 'DOING_CRON' ) && DOING_CRON
92
+			defined('DOING_CRON') && DOING_CRON
93 93
 				||
94 94
 			is_network_admin()
95 95
 				||
96
-			filter_has_var( INPUT_GET, 'activate-multi' )
96
+			filter_has_var(INPUT_GET, 'activate-multi')
97 97
 				||
98
-			! current_user_can( 'manage_options' )
98
+			! current_user_can('manage_options')
99 99
 		) {
100 100
 			return;
101 101
 		}
102 102
 
103 103
 		// Update.
104
-		set_transient( 'pronamic_pay_admin_redirect', false );
104
+		set_transient('pronamic_pay_admin_redirect', false);
105 105
 
106 106
 		// Delete.
107
-		delete_transient( 'pronamic_pay_admin_redirect' );
107
+		delete_transient('pronamic_pay_admin_redirect');
108 108
 
109 109
 		// Redirect.
110
-		wp_safe_redirect( $redirect );
110
+		wp_safe_redirect($redirect);
111 111
 
112 112
 		exit;
113 113
 	}
@@ -117,37 +117,37 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @param array $args Arguments.
119 119
 	 */
120
-	public static function input_checkbox( $args ) {
120
+	public static function input_checkbox($args) {
121 121
 		$defaults = array(
122 122
 			'label_for' => '',
123 123
 			'type'      => 'text',
124 124
 			'label'     => '',
125 125
 		);
126 126
 
127
-		$args = wp_parse_args( $args, $defaults );
127
+		$args = wp_parse_args($args, $defaults);
128 128
 
129 129
 		$id    = $args['label_for'];
130
-		$value = get_option( $id );
130
+		$value = get_option($id);
131 131
 
132 132
 		$legend = sprintf(
133 133
 			'<legend class="screen-reader-text"><span>%s</span></legend>',
134
-			esc_html( $args['label'] )
134
+			esc_html($args['label'])
135 135
 		);
136 136
 
137 137
 		$input = sprintf(
138 138
 			'<input name="%s" id="%s" type="%s" value="%s" %s />',
139
-			esc_attr( $id ),
140
-			esc_attr( $id ),
141
-			esc_attr( 'checkbox' ),
142
-			esc_attr( '1' ),
143
-			checked( $value, true, false )
139
+			esc_attr($id),
140
+			esc_attr($id),
141
+			esc_attr('checkbox'),
142
+			esc_attr('1'),
143
+			checked($value, true, false)
144 144
 		);
145 145
 
146 146
 		$label = sprintf(
147 147
 			'<label for="%s">%s %s</label>',
148
-			esc_attr( $id ),
148
+			esc_attr($id),
149 149
 			$input,
150
-			esc_html( $args['label'] )
150
+			esc_html($args['label'])
151 151
 		);
152 152
 
153 153
 		printf( // WPCS: XSS ok.
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 	 * @param mixed $value Value.
164 164
 	 * @return boolean
165 165
 	 */
166
-	public static function sanitize_boolean( $value ) {
167
-		return filter_var( $value, FILTER_VALIDATE_BOOLEAN );
166
+	public static function sanitize_boolean($value) {
167
+		return filter_var($value, FILTER_VALIDATE_BOOLEAN);
168 168
 	}
169 169
 
170 170
 	/**
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 * @param array $args Arguments.
174 174
 	 * @return string
175 175
 	 */
176
-	public static function dropdown_configs( $args ) {
176
+	public static function dropdown_configs($args) {
177 177
 		$defaults = array(
178 178
 			'name'           => 'pronamic_pay_config_id',
179 179
 			'echo'           => true,
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			'payment_method' => null,
182 182
 		);
183 183
 
184
-		$args = wp_parse_args( $args, $defaults );
184
+		$args = wp_parse_args($args, $defaults);
185 185
 
186 186
 		// Output.
187 187
 		$output = '';
@@ -191,31 +191,31 @@  discard block
 block discarded – undo
191 191
 		$name     = $args['name'];
192 192
 		$selected = $args['selected'];
193 193
 
194
-		if ( false === $selected ) {
195
-			$selected = get_option( $id );
194
+		if (false === $selected) {
195
+			$selected = get_option($id);
196 196
 		}
197 197
 
198 198
 		$output .= sprintf(
199 199
 			'<select id="%s" name="%s">',
200
-			esc_attr( $id ),
201
-			esc_attr( $name )
200
+			esc_attr($id),
201
+			esc_attr($name)
202 202
 		);
203 203
 
204
-		$options = \Pronamic\WordPress\Pay\Plugin::get_config_select_options( $args['payment_method'] );
204
+		$options = \Pronamic\WordPress\Pay\Plugin::get_config_select_options($args['payment_method']);
205 205
 
206
-		foreach ( $options as $value => $name ) {
206
+		foreach ($options as $value => $name) {
207 207
 			$output .= sprintf(
208 208
 				'<option value="%s" %s>%s</option>',
209
-				esc_attr( $value ),
210
-				selected( $value, $selected, false ),
211
-				esc_html( $name )
209
+				esc_attr($value),
210
+				selected($value, $selected, false),
211
+				esc_html($name)
212 212
 			);
213 213
 		}
214 214
 
215
-		$output .= sprintf( '</select>' );
215
+		$output .= sprintf('</select>');
216 216
 
217 217
 		// Return or echo.
218
-		if ( $args['echo'] ) {
218
+		if ($args['echo']) {
219 219
 			echo $output; // WPCS: XSS ok.
220 220
 		} else {
221 221
 			return $output;
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 	 * @param array  $pages   Page.
229 229
 	 * @param string $parent Parent post ID.
230 230
 	 */
231
-	private function create_pages( $pages, $parent = null ) {
232
-		foreach ( $pages as $page ) {
231
+	private function create_pages($pages, $parent = null) {
232
+		foreach ($pages as $page) {
233 233
 			$post = array(
234 234
 				'post_title'     => $page['post_title'],
235 235
 				'post_name'      => $page['post_title'],
@@ -239,25 +239,25 @@  discard block
 block discarded – undo
239 239
 				'comment_status' => 'closed',
240 240
 			);
241 241
 
242
-			if ( isset( $parent ) ) {
242
+			if (isset($parent)) {
243 243
 				$post['post_parent'] = $parent;
244 244
 			}
245 245
 
246
-			$result = wp_insert_post( $post, true );
246
+			$result = wp_insert_post($post, true);
247 247
 
248
-			if ( ! is_wp_error( $result ) ) {
249
-				if ( isset( $page['post_meta'] ) ) {
250
-					foreach ( $page['post_meta'] as $key => $value ) {
251
-						update_post_meta( $result, $key, $value );
248
+			if ( ! is_wp_error($result)) {
249
+				if (isset($page['post_meta'])) {
250
+					foreach ($page['post_meta'] as $key => $value) {
251
+						update_post_meta($result, $key, $value);
252 252
 					}
253 253
 				}
254 254
 
255
-				if ( isset( $page['option_name'] ) ) {
256
-					update_option( $page['option_name'], $result );
255
+				if (isset($page['option_name'])) {
256
+					update_option($page['option_name'], $result);
257 257
 				}
258 258
 
259
-				if ( isset( $page['children'] ) ) {
260
-					$this->create_pages( $page['children'], $result );
259
+				if (isset($page['children'])) {
260
+					$this->create_pages($page['children'], $result);
261 261
 				}
262 262
 			}
263 263
 		}
@@ -267,63 +267,63 @@  discard block
 block discarded – undo
267 267
 	 * Maybe create pages.
268 268
 	 */
269 269
 	public function maybe_create_pages() {
270
-		if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_create_pages' ) ) {
270
+		if ( ! filter_has_var(INPUT_POST, 'pronamic_pay_create_pages')) {
271 271
 			return;
272 272
 		}
273 273
 
274
-		if ( ! check_admin_referer( 'pronamic_pay_settings', 'pronamic_pay_nonce' ) ) {
274
+		if ( ! check_admin_referer('pronamic_pay_settings', 'pronamic_pay_nonce')) {
275 275
 			return;
276 276
 		}
277 277
 
278 278
 		$pages = array(
279 279
 			array(
280
-				'post_title'   => __( 'Payment Status', 'pronamic_ideal' ),
281
-				'post_name'    => __( 'payment', 'pronamic_ideal' ),
280
+				'post_title'   => __('Payment Status', 'pronamic_ideal'),
281
+				'post_name'    => __('payment', 'pronamic_ideal'),
282 282
 				'post_content' => '',
283 283
 				'post_meta'    => array(
284 284
 					'_yoast_wpseo_meta-robots-noindex' => true,
285 285
 				),
286 286
 				'children'     => array(
287 287
 					'completed' => array(
288
-						'post_title'   => __( 'Payment completed', 'pronamic_ideal' ),
289
-						'post_name'    => __( 'completed', 'pronamic_ideal' ),
290
-						'post_content' => __( '<p>The payment has been successfully completed.</p>', 'pronamic_ideal' ),
288
+						'post_title'   => __('Payment completed', 'pronamic_ideal'),
289
+						'post_name'    => __('completed', 'pronamic_ideal'),
290
+						'post_content' => __('<p>The payment has been successfully completed.</p>', 'pronamic_ideal'),
291 291
 						'post_meta'    => array(
292 292
 							'_yoast_wpseo_meta-robots-noindex' => true,
293 293
 						),
294 294
 						'option_name'  => 'pronamic_pay_completed_page_id',
295 295
 					),
296 296
 					'cancel'    => array(
297
-						'post_title'   => __( 'Payment cancelled', 'pronamic_ideal' ),
298
-						'post_name'    => __( 'cancelled', 'pronamic_ideal' ),
299
-						'post_content' => __( '<p>You have cancelled the payment.</p>', 'pronamic_ideal' ),
297
+						'post_title'   => __('Payment cancelled', 'pronamic_ideal'),
298
+						'post_name'    => __('cancelled', 'pronamic_ideal'),
299
+						'post_content' => __('<p>You have cancelled the payment.</p>', 'pronamic_ideal'),
300 300
 						'post_meta'    => array(
301 301
 							'_yoast_wpseo_meta-robots-noindex' => true,
302 302
 						),
303 303
 						'option_name'  => 'pronamic_pay_cancel_page_id',
304 304
 					),
305 305
 					'expired'   => array(
306
-						'post_title'   => __( 'Payment expired', 'pronamic_ideal' ),
307
-						'post_name'    => __( 'expired', 'pronamic_ideal' ),
308
-						'post_content' => __( '<p>Your payment session has expired.</p>', 'pronamic_ideal' ),
306
+						'post_title'   => __('Payment expired', 'pronamic_ideal'),
307
+						'post_name'    => __('expired', 'pronamic_ideal'),
308
+						'post_content' => __('<p>Your payment session has expired.</p>', 'pronamic_ideal'),
309 309
 						'post_meta'    => array(
310 310
 							'_yoast_wpseo_meta-robots-noindex' => true,
311 311
 						),
312 312
 						'option_name'  => 'pronamic_pay_expired_page_id',
313 313
 					),
314 314
 					'error'     => array(
315
-						'post_title'   => __( 'Payment error', 'pronamic_ideal' ),
316
-						'post_name'    => __( 'error', 'pronamic_ideal' ),
317
-						'post_content' => __( '<p>An error has occurred during payment.</p>', 'pronamic_ideal' ),
315
+						'post_title'   => __('Payment error', 'pronamic_ideal'),
316
+						'post_name'    => __('error', 'pronamic_ideal'),
317
+						'post_content' => __('<p>An error has occurred during payment.</p>', 'pronamic_ideal'),
318 318
 						'post_meta'    => array(
319 319
 							'_yoast_wpseo_meta-robots-noindex' => true,
320 320
 						),
321 321
 						'option_name'  => 'pronamic_pay_error_page_id',
322 322
 					),
323 323
 					'unknown'   => array(
324
-						'post_title'   => __( 'Payment status unknown', 'pronamic_ideal' ),
325
-						'post_name'    => __( 'unknown', 'pronamic_ideal' ),
326
-						'post_content' => __( '<p>The payment status is unknown.</p>', 'pronamic_ideal' ),
324
+						'post_title'   => __('Payment status unknown', 'pronamic_ideal'),
325
+						'post_name'    => __('unknown', 'pronamic_ideal'),
326
+						'post_content' => __('<p>The payment status is unknown.</p>', 'pronamic_ideal'),
327 327
 						'post_meta'    => array(
328 328
 							'_yoast_wpseo_meta-robots-noindex' => true,
329 329
 						),
@@ -333,16 +333,16 @@  discard block
 block discarded – undo
333 333
 			),
334 334
 		);
335 335
 
336
-		$this->create_pages( $pages );
336
+		$this->create_pages($pages);
337 337
 
338 338
 		$url = add_query_arg(
339 339
 			array(
340 340
 				'page'    => 'pronamic_pay_settings',
341 341
 				'message' => 'pages-generated',
342
-			), admin_url( 'admin.php' )
342
+			), admin_url('admin.php')
343 343
 		);
344 344
 
345
-		wp_redirect( $url );
345
+		wp_redirect($url);
346 346
 
347 347
 		exit;
348 348
 	}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 *
353 353
 	 * @param string $hook Hook.
354 354
 	 */
355
-	public function enqueue_scripts( $hook ) {
355
+	public function enqueue_scripts($hook) {
356 356
 		$screen = get_current_screen();
357 357
 
358 358
 		$enqueue  = false;
@@ -366,17 +366,17 @@  discard block
 block discarded – undo
366 366
 			), true
367 367
 		);
368 368
 		$enqueue |= 'dashboard' === $screen->id;
369
-		$enqueue |= strpos( $hook, 'pronamic_pay' ) !== false;
370
-		$enqueue |= strpos( $hook, 'pronamic_ideal' ) !== false;
369
+		$enqueue |= strpos($hook, 'pronamic_pay') !== false;
370
+		$enqueue |= strpos($hook, 'pronamic_ideal') !== false;
371 371
 		$enqueue |= 'toplevel_page_gf_edit_forms' === $screen->id;
372 372
 
373
-		if ( $enqueue ) {
374
-			$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
373
+		if ($enqueue) {
374
+			$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
375 375
 
376 376
 			// Tippy.js - https://atomiks.github.io/tippyjs/.
377 377
 			wp_register_script(
378 378
 				'tippy.js',
379
-				plugins_url( 'assets/tippy.js/tippy.all' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ),
379
+				plugins_url('assets/tippy.js/tippy.all' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file),
380 380
 				array(),
381 381
 				'2.2.3',
382 382
 				true
@@ -385,29 +385,29 @@  discard block
 block discarded – undo
385 385
 			// Pronamic.
386 386
 			wp_register_style(
387 387
 				'pronamic-pay-icons',
388
-				plugins_url( 'fonts/pronamic-pay-icons.css', \Pronamic\WordPress\Pay\Plugin::$file ),
388
+				plugins_url('fonts/pronamic-pay-icons.css', \Pronamic\WordPress\Pay\Plugin::$file),
389 389
 				array(),
390 390
 				$this->plugin->get_version()
391 391
 			);
392 392
 
393 393
 			wp_register_style(
394 394
 				'pronamic-pay-admin',
395
-				plugins_url( 'css/admin' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file ),
396
-				array( 'pronamic-pay-icons' ),
395
+				plugins_url('css/admin' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file),
396
+				array('pronamic-pay-icons'),
397 397
 				$this->plugin->get_version()
398 398
 			);
399 399
 
400 400
 			wp_register_script(
401 401
 				'pronamic-pay-admin',
402
-				plugins_url( 'js/admin' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ),
403
-				array( 'jquery', 'tippy.js' ),
402
+				plugins_url('js/admin' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file),
403
+				array('jquery', 'tippy.js'),
404 404
 				$this->plugin->get_version(),
405 405
 				true
406 406
 			);
407 407
 
408 408
 			// Enqueue.
409
-			wp_enqueue_style( 'pronamic-pay-admin' );
410
-			wp_enqueue_script( 'pronamic-pay-admin' );
409
+			wp_enqueue_style('pronamic-pay-admin');
410
+			wp_enqueue_script('pronamic-pay-admin');
411 411
 		}
412 412
 	}
413 413
 
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
 	 * Maybe test payment.
416 416
 	 */
417 417
 	public function maybe_test_payment() {
418
-		if ( filter_has_var( INPUT_POST, 'test_pay_gateway' ) && check_admin_referer( 'test_pay_gateway', 'pronamic_pay_test_nonce' ) ) {
419
-			$id = filter_input( INPUT_POST, 'post_ID', FILTER_SANITIZE_NUMBER_INT );
418
+		if (filter_has_var(INPUT_POST, 'test_pay_gateway') && check_admin_referer('test_pay_gateway', 'pronamic_pay_test_nonce')) {
419
+			$id = filter_input(INPUT_POST, 'post_ID', FILTER_SANITIZE_NUMBER_INT);
420 420
 
421
-			$gateway = \Pronamic\WordPress\Pay\Plugin::get_gateway( $id );
421
+			$gateway = \Pronamic\WordPress\Pay\Plugin::get_gateway($id);
422 422
 
423
-			if ( $gateway ) {
423
+			if ($gateway) {
424 424
 				$amount = filter_input(
425 425
 					INPUT_POST, 'test_amount', FILTER_VALIDATE_FLOAT, array(
426 426
 						'flags'   => FILTER_FLAG_ALLOW_THOUSAND,
@@ -430,21 +430,21 @@  discard block
 block discarded – undo
430 430
 					)
431 431
 				);
432 432
 
433
-				$data = new \Pronamic\WordPress\Pay\Payments\PaymentTestData( wp_get_current_user(), $amount );
433
+				$data = new \Pronamic\WordPress\Pay\Payments\PaymentTestData(wp_get_current_user(), $amount);
434 434
 
435
-				$payment_method = filter_input( INPUT_POST, 'pronamic_pay_test_payment_method', FILTER_SANITIZE_STRING );
435
+				$payment_method = filter_input(INPUT_POST, 'pronamic_pay_test_payment_method', FILTER_SANITIZE_STRING);
436 436
 
437
-				$payment = \Pronamic\WordPress\Pay\Plugin::start( $id, $gateway, $data, $payment_method );
437
+				$payment = \Pronamic\WordPress\Pay\Plugin::start($id, $gateway, $data, $payment_method);
438 438
 
439 439
 				$error = $gateway->get_error();
440 440
 
441
-				if ( is_wp_error( $error ) ) {
442
-					\Pronamic\WordPress\Pay\Plugin::render_errors( $error );
441
+				if (is_wp_error($error)) {
442
+					\Pronamic\WordPress\Pay\Plugin::render_errors($error);
443 443
 
444 444
 					exit;
445 445
 				}
446 446
 
447
-				$gateway->redirect( $payment );
447
+				$gateway->redirect($payment);
448 448
 			}
449 449
 		}
450 450
 	}
@@ -454,10 +454,10 @@  discard block
 block discarded – undo
454 454
 	 */
455 455
 	public function admin_menu() {
456 456
 		// @see https://github.com/woothemes/woocommerce/blob/2.3.13/includes/admin/class-wc-admin-menus.php#L145
457
-		$counts = wp_count_posts( 'pronamic_payment' );
457
+		$counts = wp_count_posts('pronamic_payment');
458 458
 
459 459
 		$badge = '';
460
-		if ( isset( $counts, $counts->payment_pending ) && $counts->payment_pending > 0 ) {
460
+		if (isset($counts, $counts->payment_pending) && $counts->payment_pending > 0) {
461 461
 			$badge = sprintf(
462 462
 				' <span class="awaiting-mod update-plugins count-%s"><span class="processing-count">%s</span></span>',
463 463
 				$counts->payment_pending,
@@ -466,70 +466,70 @@  discard block
 block discarded – undo
466 466
 		}
467 467
 
468 468
 		add_menu_page(
469
-			__( 'Pronamic Pay', 'pronamic_ideal' ),
470
-			__( 'Pay', 'pronamic_ideal' ) . $badge,
469
+			__('Pronamic Pay', 'pronamic_ideal'),
470
+			__('Pay', 'pronamic_ideal') . $badge,
471 471
 			'edit_payments',
472 472
 			'pronamic_ideal',
473
-			array( $this, 'page_dashboard' ),
473
+			array($this, 'page_dashboard'),
474 474
 			'dashicons-money'
475 475
 		);
476 476
 
477 477
 		add_submenu_page(
478 478
 			'pronamic_ideal',
479
-			__( 'Payments', 'pronamic_ideal' ),
480
-			__( 'Payments', 'pronamic_ideal' ) . $badge,
479
+			__('Payments', 'pronamic_ideal'),
480
+			__('Payments', 'pronamic_ideal') . $badge,
481 481
 			'edit_payments',
482 482
 			'edit.php?post_type=pronamic_payment'
483 483
 		);
484 484
 
485 485
 		add_submenu_page(
486 486
 			'pronamic_ideal',
487
-			__( 'Subscriptions', 'pronamic_ideal' ),
488
-			__( 'Subscriptions', 'pronamic_ideal' ),
487
+			__('Subscriptions', 'pronamic_ideal'),
488
+			__('Subscriptions', 'pronamic_ideal'),
489 489
 			'edit_payments',
490 490
 			'edit.php?post_type=pronamic_pay_subscr'
491 491
 		);
492 492
 
493
-		do_action( 'pronamic_pay_admin_menu' );
493
+		do_action('pronamic_pay_admin_menu');
494 494
 
495 495
 		add_submenu_page(
496 496
 			'pronamic_ideal',
497
-			__( 'Payment Forms', 'pronamic_ideal' ),
498
-			__( 'Forms', 'pronamic_ideal' ),
497
+			__('Payment Forms', 'pronamic_ideal'),
498
+			__('Forms', 'pronamic_ideal'),
499 499
 			'edit_forms',
500 500
 			'edit.php?post_type=pronamic_pay_form'
501 501
 		);
502 502
 
503 503
 		add_submenu_page(
504 504
 			'pronamic_ideal',
505
-			__( 'Configurations', 'pronamic_ideal' ),
506
-			__( 'Configurations', 'pronamic_ideal' ),
505
+			__('Configurations', 'pronamic_ideal'),
506
+			__('Configurations', 'pronamic_ideal'),
507 507
 			'manage_options',
508 508
 			'edit.php?post_type=pronamic_gateway'
509 509
 		);
510 510
 
511 511
 		add_submenu_page(
512 512
 			'pronamic_ideal',
513
-			__( 'Settings', 'pronamic_ideal' ),
514
-			__( 'Settings', 'pronamic_ideal' ),
513
+			__('Settings', 'pronamic_ideal'),
514
+			__('Settings', 'pronamic_ideal'),
515 515
 			'manage_options',
516 516
 			'pronamic_pay_settings',
517
-			array( $this, 'page_settings' )
517
+			array($this, 'page_settings')
518 518
 		);
519 519
 
520 520
 		add_submenu_page(
521 521
 			'pronamic_ideal',
522
-			__( 'Tools', 'pronamic_ideal' ),
523
-			__( 'Tools', 'pronamic_ideal' ),
522
+			__('Tools', 'pronamic_ideal'),
523
+			__('Tools', 'pronamic_ideal'),
524 524
 			'manage_options',
525 525
 			'pronamic_pay_tools',
526
-			array( $this, 'page_tools' )
526
+			array($this, 'page_tools')
527 527
 		);
528 528
 
529 529
 		global $submenu;
530 530
 
531
-		if ( isset( $submenu['pronamic_ideal'] ) ) {
532
-			$submenu['pronamic_ideal'][0][0] = __( 'Dashboard', 'pronamic_ideal' ); // WPCS: override ok.
531
+		if (isset($submenu['pronamic_ideal'])) {
532
+			$submenu['pronamic_ideal'][0][0] = __('Dashboard', 'pronamic_ideal'); // WPCS: override ok.
533 533
 		}
534 534
 	}
535 535
 
@@ -537,21 +537,21 @@  discard block
 block discarded – undo
537 537
 	 * Page dashboard.
538 538
 	 */
539 539
 	public function page_dashboard() {
540
-		return $this->render_page( 'dashboard' );
540
+		return $this->render_page('dashboard');
541 541
 	}
542 542
 
543 543
 	/**
544 544
 	 * Page settings.
545 545
 	 */
546 546
 	public function page_settings() {
547
-		return $this->render_page( 'settings' );
547
+		return $this->render_page('settings');
548 548
 	}
549 549
 
550 550
 	/**
551 551
 	 * Page tools.
552 552
 	 */
553 553
 	public function page_tools() {
554
-		return $this->render_page( 'tools' );
554
+		return $this->render_page('tools');
555 555
 	}
556 556
 
557 557
 	/**
@@ -560,12 +560,12 @@  discard block
 block discarded – undo
560 560
 	 * @param string $name Page identifier.
561 561
 	 * @return boolean True if a page is rendered, false otherwise.
562 562
 	 */
563
-	public function render_page( $name ) {
563
+	public function render_page($name) {
564 564
 		$result = false;
565 565
 
566
-		$file = plugin_dir_path( \Pronamic\WordPress\Pay\Plugin::$file ) . 'admin/page-' . $name . '.php';
566
+		$file = plugin_dir_path(\Pronamic\WordPress\Pay\Plugin::$file) . 'admin/page-' . $name . '.php';
567 567
 
568
-		if ( is_readable( $file ) ) {
568
+		if (is_readable($file)) {
569 569
 			include $file;
570 570
 
571 571
 			$result = true;
@@ -579,20 +579,20 @@  discard block
 block discarded – undo
579 579
 	 *
580 580
 	 * @param array $classes Classes.
581 581
 	 */
582
-	public function gateway_settings( $classes ) {
583
-		foreach ( $this->plugin->gateway_integrations as $integration ) {
582
+	public function gateway_settings($classes) {
583
+		foreach ($this->plugin->gateway_integrations as $integration) {
584 584
 			$class = $integration->get_settings_class();
585 585
 
586
-			if ( null === $class ) {
586
+			if (null === $class) {
587 587
 				continue;
588 588
 			}
589 589
 
590
-			if ( is_array( $class ) ) {
591
-				foreach ( $class as $c ) {
592
-					$classes[ $c ] = $c;
590
+			if (is_array($class)) {
591
+				foreach ($class as $c) {
592
+					$classes[$c] = $c;
593 593
 				}
594 594
 			} else {
595
-				$classes[ $class ] = $class;
595
+				$classes[$class] = $class;
596 596
 			}
597 597
 		}
598 598
 
@@ -605,8 +605,8 @@  discard block
 block discarded – undo
605 605
 	 * @param string $post_status Post status.
606 606
 	 * @return string
607 607
 	 */
608
-	public static function get_post_status_icon_class( $post_status ) {
609
-		switch ( $post_status ) {
608
+	public static function get_post_status_icon_class($post_status) {
609
+		switch ($post_status) {
610 610
 			case 'payment_pending':
611 611
 			case 'subscr_pending':
612 612
 				return 'pronamic-pay-icon-pending';
Please login to merge, or discard this patch.
classes/Admin/PaymentBulkActions.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * Constructs and initializes an admin payment bulk actions object.
24 24
 	 */
25 25
 	public function __construct() {
26
-		add_action( 'load-edit.php', array( $this, 'load' ) );
26
+		add_action('load-edit.php', array($this, 'load'));
27 27
 	}
28 28
 
29 29
 	/**
@@ -31,24 +31,24 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function load() {
33 33
 		// Current user.
34
-		if ( ! current_user_can( 'edit_payments' ) ) {
34
+		if ( ! current_user_can('edit_payments')) {
35 35
 			return;
36 36
 		}
37 37
 
38 38
 		// Screen.
39 39
 		$screen = get_current_screen();
40 40
 
41
-		if ( 'edit-pronamic_payment' !== $screen->id ) {
41
+		if ('edit-pronamic_payment' !== $screen->id) {
42 42
 			return;
43 43
 		}
44 44
 
45 45
 		// Bulk actions.
46
-		add_filter( 'bulk_actions-' . $screen->id, array( $this, 'bulk_actions' ) );
46
+		add_filter('bulk_actions-' . $screen->id, array($this, 'bulk_actions'));
47 47
 
48
-		add_filter( 'handle_bulk_actions-' . $screen->id, array( $this, 'handle_bulk_action' ), 10, 3 );
48
+		add_filter('handle_bulk_actions-' . $screen->id, array($this, 'handle_bulk_action'), 10, 3);
49 49
 
50 50
 		// Admin notices.
51
-		add_action( 'admin_notices', array( $this, 'admin_notices' ) );
51
+		add_action('admin_notices', array($this, 'admin_notices'));
52 52
 	}
53 53
 
54 54
 	/**
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 	 * @param array $bulk_actions Bulk actions.
60 60
 	 * @return array
61 61
 	 */
62
-	public function bulk_actions( $bulk_actions ) {
62
+	public function bulk_actions($bulk_actions) {
63 63
 		// Don't allow edit in bulk.
64
-		unset( $bulk_actions['edit'] );
64
+		unset($bulk_actions['edit']);
65 65
 
66 66
 		// Bulk check payment status.
67
-		$bulk_actions['pronamic_payment_check_status'] = __( 'Check Payment Status', 'pronamic_ideal' );
67
+		$bulk_actions['pronamic_payment_check_status'] = __('Check Payment Status', 'pronamic_ideal');
68 68
 
69 69
 		return $bulk_actions;
70 70
 	}
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 * @param array  $post_ids  Post ID's to bulk edit.
80 80
 	 * @return string
81 81
 	 */
82
-	public function handle_bulk_action( $sendback, $doaction, $post_ids ) {
83
-		if ( 'pronamic_payment_check_status' !== $doaction ) {
82
+	public function handle_bulk_action($sendback, $doaction, $post_ids) {
83
+		if ('pronamic_payment_check_status' !== $doaction) {
84 84
 			return $sendback;
85 85
 		}
86 86
 
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 		$unsupported_gateways = array();
90 90
 		$gateways             = array();
91 91
 
92
-		foreach ( $post_ids as $post_id ) {
93
-			$payment = get_pronamic_payment( $post_id );
92
+		foreach ($post_ids as $post_id) {
93
+			$payment = get_pronamic_payment($post_id);
94 94
 
95 95
 			// Only check status for pending payments.
96
-			if ( \Pronamic\WordPress\Pay\Core\Statuses::OPEN !== $payment->status && '' !== $payment->status ) {
96
+			if (\Pronamic\WordPress\Pay\Core\Statuses::OPEN !== $payment->status && '' !== $payment->status) {
97 97
 				$skipped_check++;
98 98
 
99 99
 				continue;
@@ -102,19 +102,19 @@  discard block
 block discarded – undo
102 102
 			// Make sure gateway supports `payment_status_request` feature.
103 103
 			$config_id = $payment->config_id;
104 104
 
105
-			if ( ! isset( $gateways[ $config_id ] ) ) {
106
-				$gateways[ $config_id ] = \Pronamic\WordPress\Pay\Plugin::get_gateway( $config_id );
105
+			if ( ! isset($gateways[$config_id])) {
106
+				$gateways[$config_id] = \Pronamic\WordPress\Pay\Plugin::get_gateway($config_id);
107 107
 
108
-				if ( $gateways[ $config_id ] && ! $gateways[ $config_id ]->supports( 'payment_status_request' ) ) {
108
+				if ($gateways[$config_id] && ! $gateways[$config_id]->supports('payment_status_request')) {
109 109
 					$unsupported_gateways[] = $config_id;
110 110
 				}
111 111
 			}
112 112
 
113
-			if ( in_array( $config_id, $unsupported_gateways, true ) ) {
113
+			if (in_array($config_id, $unsupported_gateways, true)) {
114 114
 				continue;
115 115
 			}
116 116
 
117
-			\Pronamic\WordPress\Pay\Plugin::update_payment( $payment, false );
117
+			\Pronamic\WordPress\Pay\Plugin::update_payment($payment, false);
118 118
 
119 119
 			$status_updated++;
120 120
 		}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			array(
124 124
 				'status_updated'       => $status_updated,
125 125
 				'skipped_check'        => $skipped_check,
126
-				'unsupported_gateways' => implode( ',', $unsupported_gateways ),
126
+				'unsupported_gateways' => implode(',', $unsupported_gateways),
127 127
 			), $sendback
128 128
 		);
129 129
 
@@ -134,50 +134,50 @@  discard block
 block discarded – undo
134 134
 	 * Admin notices.
135 135
 	 */
136 136
 	public function admin_notices() {
137
-		if ( filter_has_var( INPUT_GET, 'status_updated' ) ) {
138
-			$updated = filter_input( INPUT_GET, 'status_updated', FILTER_VALIDATE_INT );
137
+		if (filter_has_var(INPUT_GET, 'status_updated')) {
138
+			$updated = filter_input(INPUT_GET, 'status_updated', FILTER_VALIDATE_INT);
139 139
 
140
-			if ( $updated > 0 ) {
141
-				$message = sprintf( _n( '%s payment updated.', '%s payments updated.', $updated, 'pronamic_ideal' ), number_format_i18n( $updated ) );
140
+			if ($updated > 0) {
141
+				$message = sprintf(_n('%s payment updated.', '%s payments updated.', $updated, 'pronamic_ideal'), number_format_i18n($updated));
142 142
 
143 143
 				printf(
144 144
 					'<div class="notice notice-success"><p>%s</p></div>',
145
-					esc_html( $message )
145
+					esc_html($message)
146 146
 				);
147 147
 			}
148 148
 		}
149 149
 
150
-		if ( filter_has_var( INPUT_GET, 'skipped_check' ) ) {
151
-			$updated = filter_input( INPUT_GET, 'skipped_check', FILTER_VALIDATE_INT );
150
+		if (filter_has_var(INPUT_GET, 'skipped_check')) {
151
+			$updated = filter_input(INPUT_GET, 'skipped_check', FILTER_VALIDATE_INT);
152 152
 
153
-			if ( $updated > 0 ) {
153
+			if ($updated > 0) {
154 154
 				$message = sprintf(
155
-					_n( '%s payment is not updated because it already has a final payment status.', '%s payments are not updated because they already have a final payment status.', $updated, 'pronamic_ideal' ),
156
-					number_format_i18n( $updated )
155
+					_n('%s payment is not updated because it already has a final payment status.', '%s payments are not updated because they already have a final payment status.', $updated, 'pronamic_ideal'),
156
+					number_format_i18n($updated)
157 157
 				);
158 158
 
159 159
 				printf(
160 160
 					'<div class="notice notice-warning"><p>%s</p></div>',
161
-					esc_html( $message )
161
+					esc_html($message)
162 162
 				);
163 163
 			}
164 164
 		}
165 165
 
166
-		if ( filter_has_var( INPUT_GET, 'unsupported_gateways' ) ) {
167
-			$unsupported = filter_input( INPUT_GET, 'unsupported_gateways', FILTER_SANITIZE_STRING );
166
+		if (filter_has_var(INPUT_GET, 'unsupported_gateways')) {
167
+			$unsupported = filter_input(INPUT_GET, 'unsupported_gateways', FILTER_SANITIZE_STRING);
168 168
 
169
-			if ( '' !== $unsupported ) {
170
-				$gateways = explode( ',', $unsupported );
169
+			if ('' !== $unsupported) {
170
+				$gateways = explode(',', $unsupported);
171 171
 
172
-				foreach ( $gateways as $index => $config_id ) {
173
-					$gateways[ $index ] = get_the_title( $config_id );
172
+				foreach ($gateways as $index => $config_id) {
173
+					$gateways[$index] = get_the_title($config_id);
174 174
 				}
175 175
 
176
-				$message = sprintf( __( 'Requesting the current payment status is unsupported by %s.', 'pronamic_ideal' ), implode( ', ', $gateways ) );
176
+				$message = sprintf(__('Requesting the current payment status is unsupported by %s.', 'pronamic_ideal'), implode(', ', $gateways));
177 177
 
178 178
 				printf(
179 179
 					'<div class="notice notice-error"><p>%s</p></div>',
180
-					esc_html( $message )
180
+					esc_html($message)
181 181
 				);
182 182
 			}
183 183
 		}
Please login to merge, or discard this patch.