Passed
Branch develop (649d49)
by Remco
06:34
created
classes/Forms/FormShortcode.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param FormsModule $forms_module Reference to the forms module.
25 25
 	 */
26
-	public function __construct( $forms_module ) {
26
+	public function __construct($forms_module) {
27 27
 		$this->forms_module = $forms_module;
28 28
 
29
-		add_shortcode( 'pronamic_payment_form', array( $this, 'shortcode_form' ) );
29
+		add_shortcode('pronamic_payment_form', array($this, 'shortcode_form'));
30 30
 
31
-		add_action( 'init', array( $this, 'shortcode_ui_register' ) );
31
+		add_action('init', array($this, 'shortcode_ui_register'));
32 32
 	}
33 33
 
34 34
 	/**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param array $atts Shortcode attributes array.
40 40
 	 * @return string
41 41
 	 */
42
-	public function shortcode_form( $atts ) {
42
+	public function shortcode_form($atts) {
43 43
 		$atts = shortcode_atts(
44 44
 			array(
45 45
 				'id' => null,
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 
49 49
 		$id = $atts['id'];
50 50
 
51
-		return $this->forms_module->get_form_output( $id );
51
+		return $this->forms_module->get_form_output($id);
52 52
 	}
53 53
 
54 54
 	/**
55 55
 	 * Shortcode user interface register.
56 56
 	 */
57 57
 	public function shortcode_ui_register() {
58
-		if ( ! function_exists( 'shortcode_ui_register_for_shortcode' ) ) {
58
+		if ( ! function_exists('shortcode_ui_register_for_shortcode')) {
59 59
 			return;
60 60
 		}
61 61
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			'pronamic_payment_form',
64 64
 			array(
65 65
 				// Display label. String. Required.
66
-				'label'         => __( 'Payment Form', 'pronamic_ideal' ),
66
+				'label'         => __('Payment Form', 'pronamic_ideal'),
67 67
 
68 68
 				// Icon/attachment for shortcode. Optional. src or dashicons-$icon. Defaults to carrot.
69 69
 				'listItemImage' => 'dashicons-money',
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 				'attrs'         => array(
75 75
 
76 76
 					array(
77
-						'label'    => __( 'Select Payment Form', 'pronamic_ideal' ),
77
+						'label'    => __('Select Payment Form', 'pronamic_ideal'),
78 78
 						'attr'     => 'id',
79 79
 						'type'     => 'post_select',
80 80
 						'query'    => array(
Please login to merge, or discard this patch.
classes/Forms/FormPostType.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 		 *
59 59
 		 * @see https://github.com/WordPress/WordPress/blob/4.0/wp-includes/post.php#L167.
60 60
 		 */
61
-		add_action( 'init', array( $this, 'register_post_type' ), 0 ); // Highest priority.
61
+		add_action('init', array($this, 'register_post_type'), 0); // Highest priority.
62 62
 
63
-		add_filter( 'manage_edit-' . self::POST_TYPE . '_columns', array( $this, 'edit_columns' ) );
63
+		add_filter('manage_edit-' . self::POST_TYPE . '_columns', array($this, 'edit_columns'));
64 64
 
65
-		add_action( 'manage_' . self::POST_TYPE . '_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 );
65
+		add_action('manage_' . self::POST_TYPE . '_posts_custom_column', array($this, 'custom_columns'), 10, 2);
66 66
 
67 67
 		/*
68 68
 		 * Add meta box, we use priority 9 to make sure it loads before Yoast SEO meta box.
69 69
 		 * @see https://github.com/Yoast/wordpress-seo/blob/2.3.4/admin/class-metabox.php#L20.
70 70
 		 */
71
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 9 );
71
+		add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 9);
72 72
 
73
-		add_action( 'save_post_' . self::POST_TYPE, array( $this, 'save_post' ) );
73
+		add_action('save_post_' . self::POST_TYPE, array($this, 'save_post'));
74 74
 
75
-		add_action( 'post_submitbox_misc_actions', array( $this, 'post_submitbox_misc_actions' ) );
75
+		add_action('post_submitbox_misc_actions', array($this, 'post_submitbox_misc_actions'));
76 76
 	}
77 77
 
78 78
 	/**
@@ -81,23 +81,23 @@  discard block
 block discarded – undo
81 81
 	public function register_post_type() {
82 82
 		register_post_type(
83 83
 			self::POST_TYPE, array(
84
-				'label'              => __( 'Payment Forms', 'pronamic_ideal' ),
84
+				'label'              => __('Payment Forms', 'pronamic_ideal'),
85 85
 				'labels'             => array(
86
-					'name'                  => __( 'Payment Forms', 'pronamic_ideal' ),
87
-					'singular_name'         => __( 'Payment Form', 'pronamic_ideal' ),
88
-					'add_new'               => __( 'Add New', 'pronamic_ideal' ),
89
-					'add_new_item'          => __( 'Add New Payment Form', 'pronamic_ideal' ),
90
-					'edit_item'             => __( 'Edit Payment Form', 'pronamic_ideal' ),
91
-					'new_item'              => __( 'New Payment Form', 'pronamic_ideal' ),
92
-					'all_items'             => __( 'All Payment Forms', 'pronamic_ideal' ),
93
-					'view_item'             => __( 'View Payment Form', 'pronamic_ideal' ),
94
-					'search_items'          => __( 'Search Payment Forms', 'pronamic_ideal' ),
95
-					'not_found'             => __( 'No payment forms found.', 'pronamic_ideal' ),
96
-					'not_found_in_trash'    => __( 'No payment forms found in Trash.', 'pronamic_ideal' ),
97
-					'menu_name'             => __( 'Payment Forms', 'pronamic_ideal' ),
98
-					'filter_items_list'     => __( 'Filter payment forms list', 'pronamic_ideal' ),
99
-					'items_list_navigation' => __( 'Payment forms list navigation', 'pronamic_ideal' ),
100
-					'items_list'            => __( 'Payment forms list', 'pronamic_ideal' ),
86
+					'name'                  => __('Payment Forms', 'pronamic_ideal'),
87
+					'singular_name'         => __('Payment Form', 'pronamic_ideal'),
88
+					'add_new'               => __('Add New', 'pronamic_ideal'),
89
+					'add_new_item'          => __('Add New Payment Form', 'pronamic_ideal'),
90
+					'edit_item'             => __('Edit Payment Form', 'pronamic_ideal'),
91
+					'new_item'              => __('New Payment Form', 'pronamic_ideal'),
92
+					'all_items'             => __('All Payment Forms', 'pronamic_ideal'),
93
+					'view_item'             => __('View Payment Form', 'pronamic_ideal'),
94
+					'search_items'          => __('Search Payment Forms', 'pronamic_ideal'),
95
+					'not_found'             => __('No payment forms found.', 'pronamic_ideal'),
96
+					'not_found_in_trash'    => __('No payment forms found in Trash.', 'pronamic_ideal'),
97
+					'menu_name'             => __('Payment Forms', 'pronamic_ideal'),
98
+					'filter_items_list'     => __('Filter payment forms list', 'pronamic_ideal'),
99
+					'items_list_navigation' => __('Payment forms list navigation', 'pronamic_ideal'),
100
+					'items_list'            => __('Payment forms list', 'pronamic_ideal'),
101 101
 				),
102 102
 				'public'             => true,
103 103
 				'publicly_queryable' => true,
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 					'revisions',
111 111
 				),
112 112
 				'rewrite'            => array(
113
-					'slug' => _x( 'payment-forms', 'slug', 'pronamic_ideal' ),
113
+					'slug' => _x('payment-forms', 'slug', 'pronamic_ideal'),
114 114
 				),
115 115
 				'query_var'          => false,
116 116
 				'capabilities'       => FormPostType::get_capabilities(),
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
 	 * @param array $columns Edit columns.
126 126
 	 * @return array
127 127
 	 */
128
-	public function edit_columns( $columns ) {
128
+	public function edit_columns($columns) {
129 129
 		$columns = array(
130 130
 			'cb'                              => '<input type="checkbox" />',
131
-			'title'                           => __( 'Title', 'pronamic_ideal' ),
132
-			'pronamic_payment_form_gateway'   => __( 'Gateway', 'pronamic_ideal' ),
133
-			'pronamic_payment_form_payments'  => __( 'Payments', 'pronamic_ideal' ),
134
-			'pronamic_payment_form_earnings'  => __( 'Earnings', 'pronamic_ideal' ),
135
-			'pronamic_payment_form_shortcode' => __( 'Shortcode', 'pronamic_ideal' ),
136
-			'date'                            => __( 'Date', 'pronamic_ideal' ),
131
+			'title'                           => __('Title', 'pronamic_ideal'),
132
+			'pronamic_payment_form_gateway'   => __('Gateway', 'pronamic_ideal'),
133
+			'pronamic_payment_form_payments'  => __('Payments', 'pronamic_ideal'),
134
+			'pronamic_payment_form_earnings'  => __('Earnings', 'pronamic_ideal'),
135
+			'pronamic_payment_form_shortcode' => __('Shortcode', 'pronamic_ideal'),
136
+			'date'                            => __('Date', 'pronamic_ideal'),
137 137
 		);
138 138
 
139 139
 		return $columns;
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	 * @param string $column  Column.
146 146
 	 * @param string $post_id Post ID.
147 147
 	 */
148
-	public function custom_columns( $column, $post_id ) {
148
+	public function custom_columns($column, $post_id) {
149 149
 		global $post;
150 150
 
151
-		switch ( $column ) {
151
+		switch ($column) {
152 152
 			case 'pronamic_payment_form_gateway':
153
-				$config_id = get_post_meta( $post_id, '_pronamic_payment_form_config_id', true );
153
+				$config_id = get_post_meta($post_id, '_pronamic_payment_form_config_id', true);
154 154
 
155
-				if ( ! empty( $config_id ) ) {
156
-					echo get_the_title( $config_id );
155
+				if ( ! empty($config_id)) {
156
+					echo get_the_title($config_id);
157 157
 				} else {
158 158
 					echo '—';
159 159
 				}
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 					$post_id
192 192
 				);
193 193
 
194
-				$value = $wpdb->get_var( $query ); // WPCS: unprepared SQL ok.
194
+				$value = $wpdb->get_var($query); // WPCS: unprepared SQL ok.
195 195
 
196
-				echo esc_html( number_format_i18n( $value ) );
196
+				echo esc_html(number_format_i18n($value));
197 197
 
198 198
 				break;
199 199
 			case 'pronamic_payment_form_earnings':
@@ -228,15 +228,15 @@  discard block
 block discarded – undo
228 228
 					$post_id
229 229
 				);
230 230
 
231
-				$value = $wpdb->get_var( $query ); // WPCS: unprepared SQL ok.
231
+				$value = $wpdb->get_var($query); // WPCS: unprepared SQL ok.
232 232
 
233
-				echo esc_html( \Pronamic\WordPress\Pay\Util::format_price( $value ) );
233
+				echo esc_html(\Pronamic\WordPress\Pay\Util::format_price($value));
234 234
 
235 235
 				break;
236 236
 			case 'pronamic_payment_form_shortcode':
237 237
 				printf(
238 238
 					'<input onclick="this.setSelectionRange( 0, this.value.length )" type="text" class="pronamic-pay-shortcode-input" readonly="" value="%s" />',
239
-					esc_attr( $this->get_shortcode( $post_id ) )
239
+					esc_attr($this->get_shortcode($post_id))
240 240
 				);
241 241
 
242 242
 				break;
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @param string $post_type Post Type.
250 250
 	 */
251
-	public function add_meta_boxes( $post_type ) {
252
-		if ( self::POST_TYPE === $post_type ) {
251
+	public function add_meta_boxes($post_type) {
252
+		if (self::POST_TYPE === $post_type) {
253 253
 			add_meta_box(
254 254
 				'pronamic_payment_form_options',
255
-				__( 'Form Options', 'pronamic_ideal' ),
256
-				array( $this, 'meta_box_form_options' ),
255
+				__('Form Options', 'pronamic_ideal'),
256
+				array($this, 'meta_box_form_options'),
257 257
 				$post_type,
258 258
 				'normal',
259 259
 				'high'
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @param WP_Post $post The object for the current post/page.
268 268
 	 */
269
-	public function meta_box_form_options( $post ) {
269
+	public function meta_box_form_options($post) {
270 270
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/meta-box-form-options.php';
271 271
 	}
272 272
 
@@ -275,21 +275,21 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @param int $post_id The ID of the post being saved.
277 277
 	 */
278
-	public function save_post( $post_id ) {
278
+	public function save_post($post_id) {
279 279
 		// Check if our nonce is set.
280
-		if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_nonce' ) ) {
280
+		if ( ! filter_has_var(INPUT_POST, 'pronamic_pay_nonce')) {
281 281
 			return $post_id;
282 282
 		}
283 283
 
284
-		$nonce = filter_input( INPUT_POST, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING );
284
+		$nonce = filter_input(INPUT_POST, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING);
285 285
 
286 286
 		// Verify that the nonce is valid.
287
-		if ( ! wp_verify_nonce( $nonce, 'pronamic_pay_save_form_options' ) ) {
287
+		if ( ! wp_verify_nonce($nonce, 'pronamic_pay_save_form_options')) {
288 288
 			return $post_id;
289 289
 		}
290 290
 
291 291
 		// If this is an autosave, our form has not been submitted, so we don't want to do anything.
292
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
292
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
293 293
 			return $post_id;
294 294
 		}
295 295
 
@@ -304,22 +304,22 @@  discard block
 block discarded – undo
304 304
 			),
305 305
 		);
306 306
 
307
-		$data = filter_input_array( INPUT_POST, $definition );
307
+		$data = filter_input_array(INPUT_POST, $definition);
308 308
 
309 309
 		// Convert amount choices to cents.
310
-		if ( isset( $data['_pronamic_payment_form_amount_choices'] ) ) {
311
-			foreach ( $data['_pronamic_payment_form_amount_choices'] as $i => $amount ) {
312
-				$amount = \Pronamic\WordPress\Pay\Core\Util::string_to_amount( $amount );
310
+		if (isset($data['_pronamic_payment_form_amount_choices'])) {
311
+			foreach ($data['_pronamic_payment_form_amount_choices'] as $i => $amount) {
312
+				$amount = \Pronamic\WordPress\Pay\Core\Util::string_to_amount($amount);
313 313
 
314
-				$data['_pronamic_payment_form_amount_choices'][ $i ] = \Pronamic\WordPress\Pay\Core\Util::amount_to_cents( $amount );
314
+				$data['_pronamic_payment_form_amount_choices'][$i] = \Pronamic\WordPress\Pay\Core\Util::amount_to_cents($amount);
315 315
 			}
316 316
 
317 317
 			// Remove empty choices.
318
-			$data['_pronamic_payment_form_amount_choices'] = array_filter( $data['_pronamic_payment_form_amount_choices'] );
318
+			$data['_pronamic_payment_form_amount_choices'] = array_filter($data['_pronamic_payment_form_amount_choices']);
319 319
 		}
320 320
 
321 321
 		// Update post meta data.
322
-		pronamic_pay_update_post_meta_data( $post_id, $data );
322
+		pronamic_pay_update_post_meta_data($post_id, $data);
323 323
 	}
324 324
 
325 325
 	/**
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 	 * @param string $post_id Post ID.
329 329
 	 * @return string
330 330
 	 */
331
-	private function get_shortcode( $post_id = null ) {
332
-		$post_id = ( null === $post_id ) ? get_the_ID() : $post_id;
331
+	private function get_shortcode($post_id = null) {
332
+		$post_id = (null === $post_id) ? get_the_ID() : $post_id;
333 333
 
334
-		$shortcode = sprintf( '[pronamic_payment_form id="%s"]', esc_attr( $post_id ) );
334
+		$shortcode = sprintf('[pronamic_payment_form id="%s"]', esc_attr($post_id));
335 335
 
336 336
 		return $shortcode;
337 337
 	}
@@ -340,15 +340,15 @@  discard block
 block discarded – undo
340 340
 	 * Post submit box miscellaneous actions.
341 341
 	 */
342 342
 	public function post_submitbox_misc_actions() {
343
-		if ( self::POST_TYPE !== get_post_type() ) {
343
+		if (self::POST_TYPE !== get_post_type()) {
344 344
 			return false;
345 345
 		}
346 346
 
347 347
 		?>
348 348
 <div class="misc-pub-section">
349
-	<label for="pronamic-pay-shortcode"><?php esc_html_e( 'Shortcode:', 'pronamic_ideal' ); ?></label>
349
+	<label for="pronamic-pay-shortcode"><?php esc_html_e('Shortcode:', 'pronamic_ideal'); ?></label>
350 350
 
351
-	<input id="pronamic-pay-shortcode" class="pronamic-pay-shortcode-input" onClick="this.setSelectionRange( 0, this.value.length )" type="text" class="shortcode-input" readonly value="<?php echo esc_attr( $this->get_shortcode() ); ?>" />
351
+	<input id="pronamic-pay-shortcode" class="pronamic-pay-shortcode-input" onClick="this.setSelectionRange( 0, this.value.length )" type="text" class="shortcode-input" readonly value="<?php echo esc_attr($this->get_shortcode()); ?>" />
352 352
 </div>
353 353
 <?php
354 354
 	}
Please login to merge, or discard this patch.
classes/Forms/FormsModule.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,25 +26,25 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param Plugin $plugin Plugin.
28 28
 	 */
29
-	public function __construct( $plugin ) {
29
+	public function __construct($plugin) {
30 30
 		$this->plugin = $plugin;
31 31
 
32 32
 		// Form Post Type.
33 33
 		$this->form_post_type = new FormPostType();
34 34
 
35 35
 		// Processor.
36
-		$this->processor = new FormProcessor( $plugin );
36
+		$this->processor = new FormProcessor($plugin);
37 37
 
38 38
 		// Scripts.
39
-		$this->scripts = new FormScripts( $plugin );
39
+		$this->scripts = new FormScripts($plugin);
40 40
 
41 41
 		// Shortcode.
42
-		$this->shortcode = new FormShortcode( $this );
42
+		$this->shortcode = new FormShortcode($this);
43 43
 
44 44
 		// Actions.
45
-		add_filter( 'the_content', array( $this, 'maybe_add_form_to_content' ) );
45
+		add_filter('the_content', array($this, 'maybe_add_form_to_content'));
46 46
 
47
-		add_filter( 'pronamic_payment_source_text_payment_form', array( $this, 'source_text' ), 10, 2 );
47
+		add_filter('pronamic_payment_source_text_payment_form', array($this, 'source_text'), 10, 2);
48 48
 	}
49 49
 
50 50
 	/**
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 * @param string $content Post content to maybe extend with a payment form.
55 55
 	 * @return string
56 56
 	 */
57
-	public function maybe_add_form_to_content( $content ) {
58
-		if ( is_singular( 'pronamic_pay_form' ) && 'pronamic_pay_form' === get_post_type() ) {
59
-			$content .= $this->get_form_output( get_the_ID() );
57
+	public function maybe_add_form_to_content($content) {
58
+		if (is_singular('pronamic_pay_form') && 'pronamic_pay_form' === get_post_type()) {
59
+			$content .= $this->get_form_output(get_the_ID());
60 60
 		}
61 61
 
62 62
 		return $content;
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @param string $id Form ID.
69 69
 	 * @return string
70 70
 	 */
71
-	public function get_form_output( $id ) {
72
-		$file = plugin_dir_path( Plugin::$file ) . 'templates/form.php';
71
+	public function get_form_output($id) {
72
+		$file = plugin_dir_path(Plugin::$file) . 'templates/form.php';
73 73
 
74 74
 		ob_start();
75 75
 
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 	 * @param Payment $payment The payment for the specified source text.
88 88
 	 * @return string
89 89
 	 */
90
-	public function source_text( $text, Payment $payment ) {
91
-		$text = __( 'Payment Form', 'pronamic_ideal' ) . '<br />';
90
+	public function source_text($text, Payment $payment) {
91
+		$text = __('Payment Form', 'pronamic_ideal') . '<br />';
92 92
 
93 93
 		$text .= sprintf(
94 94
 			'<a href="%s">%s</a>',
95
-			get_edit_post_link( $payment->source_id ),
95
+			get_edit_post_link($payment->source_id),
96 96
 			$payment->source_id
97 97
 		);
98 98
 
Please login to merge, or discard this patch.
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.