Passed
Push — develop ( 880e1e...04c4f1 )
by Remco
09:23 queued 05:16
created
classes/Admin/AdminNotices.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @param Plugin $plugin Plugin.
29 29
 	 */
30
-	public function __construct( Plugin $plugin ) {
30
+	public function __construct(Plugin $plugin) {
31 31
 		$this->plugin = $plugin;
32 32
 
33 33
 		// Actions.
34
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 11 );
34
+		add_action('admin_notices', array($this, 'admin_notices'), 11);
35 35
 	}
36 36
 
37 37
 	/**
@@ -43,31 +43,31 @@  discard block
 block discarded – undo
43 43
 		$screen = get_current_screen();
44 44
 
45 45
 		// Show notices only to options managers (administrators).
46
-		if ( ! current_user_can( 'manage_options' ) ) {
46
+		if ( ! current_user_can('manage_options')) {
47 47
 			return;
48 48
 		}
49 49
 
50 50
 		// Jetpack.
51
-		if ( 'jetpack' === $screen->parent_base ) {
51
+		if ('jetpack' === $screen->parent_base) {
52 52
 			return;
53 53
 		}
54 54
 
55 55
 		// License notice.
56
-		if ( 'valid' !== get_option( 'pronamic_pay_license_status' ) ) {
56
+		if ('valid' !== get_option('pronamic_pay_license_status')) {
57 57
 			$class = \Pronamic\WordPress\Pay\Plugin::get_number_payments() > 20 ? 'error' : 'updated';
58 58
 
59
-			$license = get_option( 'pronamic_pay_license_key' );
59
+			$license = get_option('pronamic_pay_license_key');
60 60
 
61
-			if ( '' === $license ) {
61
+			if ('' === $license) {
62 62
 				$notice = sprintf(
63
-					__( '<strong>Pronamic Pay</strong> — You have not entered a valid <a href="%1$s">support license key</a>, please <a href="%2$s" target="_blank">get your key at pronamic.eu</a>.', 'pronamic_ideal' ),
64
-					add_query_arg( 'page', 'pronamic_pay_settings', get_admin_url( null, 'admin.php' ) ),
63
+					__('<strong>Pronamic Pay</strong> — You have not entered a valid <a href="%1$s">support license key</a>, please <a href="%2$s" target="_blank">get your key at pronamic.eu</a>.', 'pronamic_ideal'),
64
+					add_query_arg('page', 'pronamic_pay_settings', get_admin_url(null, 'admin.php')),
65 65
 					'https://www.pronamic.eu/plugins/pronamic-ideal/'
66 66
 				);
67 67
 			} else {
68 68
 				$notice = sprintf(
69
-					__( '<strong>Pronamic Pay</strong> — You have not entered a valid <a href="%1$s">support license key</a>. Please <a href="%2$s" target="_blank">get your key at pronamic.eu</a> or login to <a href="%3$s" target="_blank">check your license status</a>.', 'pronamic_ideal' ),
70
-					add_query_arg( 'page', 'pronamic_pay_settings', get_admin_url( null, 'admin.php' ) ),
69
+					__('<strong>Pronamic Pay</strong> — You have not entered a valid <a href="%1$s">support license key</a>. Please <a href="%2$s" target="_blank">get your key at pronamic.eu</a> or login to <a href="%3$s" target="_blank">check your license status</a>.', 'pronamic_ideal'),
70
+					add_query_arg('page', 'pronamic_pay_settings', get_admin_url(null, 'admin.php')),
71 71
 					'https://www.pronamic.eu/plugins/pronamic-ideal/',
72 72
 					'https://www.pronamic.eu/account/'
73 73
 				);
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
 
76 76
 			printf( // WPCS: XSS ok.
77 77
 				'<div class="%s"><p>%s</p></div>',
78
-				esc_attr( $class ),
78
+				esc_attr($class),
79 79
 				$notice
80 80
 			);
81 81
 		}
82 82
 
83 83
 		// Stored notices.
84
-		$notices = get_option( 'pronamic_pay_admin_notices', array() );
84
+		$notices = get_option('pronamic_pay_admin_notices', array());
85 85
 
86
-		foreach ( $notices as $name ) {
87
-			$file = plugin_dir_path( \Pronamic\WordPress\Pay\Plugin::$file ) . 'admin/notice-' . $name . '.php';
86
+		foreach ($notices as $name) {
87
+			$file = plugin_dir_path(\Pronamic\WordPress\Pay\Plugin::$file) . 'admin/notice-' . $name . '.php';
88 88
 
89
-			if ( is_readable( $file ) ) {
89
+			if (is_readable($file)) {
90 90
 				include $file;
91 91
 			}
92 92
 		}
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @param string $name Name.
99 99
 	 */
100
-	public function add_notice( $name ) {
101
-		$notices = array_unique( array_merge( get_option( 'pronamic_pay_admin_notices', array() ), array( $name ) ) );
100
+	public function add_notice($name) {
101
+		$notices = array_unique(array_merge(get_option('pronamic_pay_admin_notices', array()), array($name)));
102 102
 
103
-		update_option( 'pronamic_pay_admin_notices', $notices );
103
+		update_option('pronamic_pay_admin_notices', $notices);
104 104
 	}
105 105
 
106 106
 	/**
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param string $name Name.
110 110
 	 */
111
-	public static function remove_notice( $name ) {
112
-		$notices = array_diff( get_option( 'pronamic_pay_admin_notices', array() ), array( $name ) );
111
+	public static function remove_notice($name) {
112
+		$notices = array_diff(get_option('pronamic_pay_admin_notices', array()), array($name));
113 113
 
114
-		update_option( 'pronamic_pay_admin_notices', $notices );
114
+		update_option('pronamic_pay_admin_notices', $notices);
115 115
 	}
116 116
 }
Please login to merge, or discard this patch.
classes/Admin/AdminDashboard.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,22 +36,22 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @param Plugin $plugin Plugin.
38 38
 	 */
39
-	public function __construct( Plugin $plugin ) {
39
+	public function __construct(Plugin $plugin) {
40 40
 		$this->plugin = $plugin;
41 41
 
42 42
 		// Actions.
43
-		add_action( 'wp_dashboard_setup', array( $this, 'setup' ) );
43
+		add_action('wp_dashboard_setup', array($this, 'setup'));
44 44
 	}
45 45
 
46 46
 	/**
47 47
 	 * Setup.
48 48
 	 */
49 49
 	public function setup() {
50
-		if ( current_user_can( 'manage_options' ) ) {
50
+		if (current_user_can('manage_options')) {
51 51
 			wp_add_dashboard_widget(
52 52
 				'pronamic_pay_dashboard_status',
53
-				__( 'Pronamic Pay Status', 'pronamic_ideal' ),
54
-				array( $this, 'status_widget' )
53
+				__('Pronamic Pay Status', 'pronamic_ideal'),
54
+				array($this, 'status_widget')
55 55
 			);
56 56
 		}
57 57
 	}
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 	 * Status widget.
61 61
 	 */
62 62
 	public function status_widget() {
63
-		$counts = wp_count_posts( 'pronamic_payment' );
63
+		$counts = wp_count_posts('pronamic_payment');
64 64
 
65 65
 		$states = array(
66
-			'payment_completed' => __( '%s completed', 'pronamic_ideal' ),
67
-			'payment_pending'   => __( '%s pending', 'pronamic_ideal' ),
68
-			'payment_cancelled' => __( '%s cancelled', 'pronamic_ideal' ),
69
-			'payment_failed'    => __( '%s failed', 'pronamic_ideal' ),
70
-			'payment_expired'   => __( '%s expired', 'pronamic_ideal' ),
66
+			'payment_completed' => __('%s completed', 'pronamic_ideal'),
67
+			'payment_pending'   => __('%s pending', 'pronamic_ideal'),
68
+			'payment_cancelled' => __('%s cancelled', 'pronamic_ideal'),
69
+			'payment_failed'    => __('%s failed', 'pronamic_ideal'),
70
+			'payment_expired'   => __('%s expired', 'pronamic_ideal'),
71 71
 		);
72 72
 
73 73
 		$url = add_query_arg(
74 74
 			array(
75 75
 				'post_type' => 'pronamic_payment',
76
-			), admin_url( 'edit.php' )
76
+			), admin_url('edit.php')
77 77
 		);
78 78
 
79 79
 		include \Pronamic\WordPress\Pay\Plugin::$dirname . '/admin/widget-payments-status-list.php';
Please login to merge, or discard this patch.
classes/Admin/AdminSettings.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param Plugin $plugin Plugin.
34 34
 	 */
35
-	public function __construct( Plugin $plugin ) {
35
+	public function __construct(Plugin $plugin) {
36 36
 		$this->plugin = $plugin;
37 37
 
38 38
 		// Actions.
39
-		add_action( 'admin_init', array( $this, 'admin_init' ) );
39
+		add_action('admin_init', array($this, 'admin_init'));
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 		// Settings - General.
47 47
 		add_settings_section(
48 48
 			'pronamic_pay_general',
49
-			__( 'General', 'pronamic_ideal' ),
50
-			array( $this, 'settings_section' ),
49
+			__('General', 'pronamic_ideal'),
50
+			array($this, 'settings_section'),
51 51
 			'pronamic_pay'
52 52
 		);
53 53
 
54 54
 		add_settings_field(
55 55
 			'pronamic_pay_license_key',
56
-			__( 'Support License Key', 'pronamic_ideal' ),
57
-			array( $this, 'input_license_key' ),
56
+			__('Support License Key', 'pronamic_ideal'),
57
+			array($this, 'input_license_key'),
58 58
 			'pronamic_pay',
59 59
 			'pronamic_pay_general',
60 60
 			array(
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 		// Default Config.
67 67
 		add_settings_field(
68 68
 			'pronamic_pay_config_id',
69
-			__( 'Default Gateway', 'pronamic_ideal' ),
70
-			array( $this, 'input_page' ),
69
+			__('Default Gateway', 'pronamic_ideal'),
70
+			array($this, 'input_page'),
71 71
 			'pronamic_pay',
72 72
 			'pronamic_pay_general',
73 73
 			array(
74 74
 				'post_type'        => 'pronamic_gateway',
75
-				'show_option_none' => __( '— Select a gateway —', 'pronamic_ideal' ),
75
+				'show_option_none' => __('— Select a gateway —', 'pronamic_ideal'),
76 76
 				'label_for'        => 'pronamic_pay_config_id',
77 77
 			)
78 78
 		);
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 		// Google Analytics property UA code.
81 81
 		add_settings_field(
82 82
 			'pronamic_pay_google_analytics_property',
83
-			__( 'Google Analytics Property ID', 'pronamic_ideal' ),
84
-			array( $this, 'input_element' ),
83
+			__('Google Analytics Property ID', 'pronamic_ideal'),
84
+			array($this, 'input_element'),
85 85
 			'pronamic_pay',
86 86
 			'pronamic_pay_general',
87 87
 			array(
88
-				'description' => __( 'Set a Google Analytics Property UA code to track ecommerce revenue.', 'pronamic_ideal' ),
88
+				'description' => __('Set a Google Analytics Property UA code to track ecommerce revenue.', 'pronamic_ideal'),
89 89
 				'label_for'   => 'pronamic_pay_google_analytics_property',
90 90
 				'classes'     => 'regular-text code',
91 91
 			)
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 		// Remove data on uninstall.
95 95
 		add_settings_field(
96 96
 			'pronamic_pay_uninstall_clear_data',
97
-			__( 'Remove Data', 'pronamic_ideal' ),
98
-			array( $this, 'input_checkbox' ),
97
+			__('Remove Data', 'pronamic_ideal'),
98
+			array($this, 'input_checkbox'),
99 99
 			'pronamic_pay',
100 100
 			'pronamic_pay_general',
101 101
 			array(
102
-				'legend'      => __( 'Remove Data', 'pronamic_ideal' ),
103
-				'description' => __( 'Remove all plugin data on uninstall', 'pronamic_ideal' ),
102
+				'legend'      => __('Remove Data', 'pronamic_ideal'),
103
+				'description' => __('Remove all plugin data on uninstall', 'pronamic_ideal'),
104 104
 				'label_for'   => 'pronamic_pay_uninstall_clear_data',
105 105
 				'classes'     => 'regular-text',
106 106
 				'type'        => 'checkbox',
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 		// Settings - Pages.
111 111
 		add_settings_section(
112 112
 			'pronamic_pay_pages',
113
-			__( 'Payment Status Pages', 'pronamic_ideal' ),
114
-			array( $this, 'settings_section' ),
113
+			__('Payment Status Pages', 'pronamic_ideal'),
114
+			array($this, 'settings_section'),
115 115
 			'pronamic_pay'
116 116
 		);
117 117
 
118
-		foreach ( $this->plugin->get_pages() as $id => $label ) {
118
+		foreach ($this->plugin->get_pages() as $id => $label) {
119 119
 			add_settings_field(
120 120
 				$id,
121 121
 				$label,
122
-				array( $this, 'input_page' ),
122
+				array($this, 'input_page'),
123 123
 				'pronamic_pay',
124 124
 				'pronamic_pay_pages',
125 125
 				array(
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 		// Settings - Currency.
132 132
 		add_settings_section(
133 133
 			'pronamic_pay_currency',
134
-			__( 'Currency', 'pronamic_ideal' ),
135
-			array( $this, 'settings_section' ),
134
+			__('Currency', 'pronamic_ideal'),
135
+			array($this, 'settings_section'),
136 136
 			'pronamic_pay'
137 137
 		);
138 138
 
139 139
 		add_settings_field(
140 140
 			'pronamic_pay_thousands_sep',
141
-			__( 'Thousands Seperator', 'pronamic_ideal' ),
142
-			array( $this, 'input_element' ),
141
+			__('Thousands Seperator', 'pronamic_ideal'),
142
+			array($this, 'input_element'),
143 143
 			'pronamic_pay',
144 144
 			'pronamic_pay_currency',
145 145
 			array(
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 
151 151
 		add_settings_field(
152 152
 			'pronamic_pay_decimal_sep',
153
-			__( 'Decimal Seperator', 'pronamic_ideal' ),
154
-			array( $this, 'input_element' ),
153
+			__('Decimal Seperator', 'pronamic_ideal'),
154
+			array($this, 'input_element'),
155 155
 			'pronamic_pay',
156 156
 			'pronamic_pay_currency',
157 157
 			array(
@@ -166,28 +166,28 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @param array $args Arguments.
168 168
 	 */
169
-	public function settings_section( $args ) {
170
-		switch ( $args['id'] ) {
169
+	public function settings_section($args) {
170
+		switch ($args['id']) {
171 171
 			case 'pronamic_pay_pages':
172 172
 				echo '<p>';
173
-				esc_html_e( 'The page an user will get redirected to after payment, based on the payment status.', 'pronamic_ideal' );
173
+				esc_html_e('The page an user will get redirected to after payment, based on the payment status.', 'pronamic_ideal');
174 174
 				echo '</p>';
175 175
 
176
-				$pages = array( 'completed', 'cancel', 'expired', 'error', 'unknown' );
176
+				$pages = array('completed', 'cancel', 'expired', 'error', 'unknown');
177 177
 
178
-				foreach ( $pages as $status ) {
179
-					$option_name = sprintf( 'pronamic_pay_%s_page_id', $status );
178
+				foreach ($pages as $status) {
179
+					$option_name = sprintf('pronamic_pay_%s_page_id', $status);
180 180
 
181
-					$option = get_option( $option_name );
181
+					$option = get_option($option_name);
182 182
 
183
-					if ( ! empty( $option ) ) {
183
+					if ( ! empty($option)) {
184 184
 						$hide_button = true;
185 185
 					}
186 186
 				}
187 187
 
188
-				if ( ! isset( $hide_button ) ) {
188
+				if ( ! isset($hide_button)) {
189 189
 					submit_button(
190
-						__( 'Set default pages', 'pronamic_ideal' ),
190
+						__('Set default pages', 'pronamic_ideal'),
191 191
 						'',
192 192
 						'pronamic_pay_create_pages',
193 193
 						false
@@ -203,17 +203,17 @@  discard block
 block discarded – undo
203 203
 	 *
204 204
 	 * @param array $args Arguments.
205 205
 	 */
206
-	public function input_element( $args ) {
206
+	public function input_element($args) {
207 207
 		$defaults = array(
208 208
 			'type'        => 'text',
209 209
 			'classes'     => 'regular-text',
210 210
 			'description' => '',
211 211
 		);
212 212
 
213
-		$args = wp_parse_args( $args, $defaults );
213
+		$args = wp_parse_args($args, $defaults);
214 214
 
215 215
 		$name  = $args['label_for'];
216
-		$value = get_option( $name );
216
+		$value = get_option($name);
217 217
 
218 218
 		$atts = array(
219 219
 			'name'  => $name,
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
 		printf(
227 227
 			'<input %s />',
228 228
 			// @codingStandardsIgnoreStart
229
-			Util::array_to_html_attributes( $atts )
229
+			Util::array_to_html_attributes($atts)
230 230
 			// @codingStandardsIgnoreEn
231 231
 		);
232 232
 
233
-		if ( ! empty( $args['description'] ) ) {
233
+		if ( ! empty($args['description'])) {
234 234
 			printf(
235 235
 				'<p class="description">%s</p>',
236
-				esc_html( $args['description'] )
236
+				esc_html($args['description'])
237 237
 			);
238 238
 		}
239 239
 	}
@@ -245,32 +245,32 @@  discard block
 block discarded – undo
245 245
 	 * @see https://github.com/WordPress/WordPress/blob/4.9.1/wp-admin/options-reading.php#L110-L141
246 246
 	 * @param array $args Arguments.
247 247
 	 */
248
-	public function input_checkbox( $args ) {
248
+	public function input_checkbox($args) {
249 249
 		$id     = $args['label_for'];
250 250
 		$name   = $args['label_for'];
251
-		$value  = get_option( $name );
251
+		$value  = get_option($name);
252 252
 		$legend = $args['legend'];
253 253
 
254 254
 		echo '<fieldset>';
255 255
 
256 256
 		printf(
257 257
 			'<legend class="screen-reader-text"><span>%s</span></legend>',
258
-			esc_html( $legend )
258
+			esc_html($legend)
259 259
 		);
260 260
 
261 261
 		printf(
262 262
 			'<label for="%s">',
263
-			esc_attr( $id )
263
+			esc_attr($id)
264 264
 		);
265 265
 
266 266
 		printf(
267 267
 			'<input name="%s" id="%s" type="checkbox" value="1" %s />',
268
-			esc_attr( $name ),
269
-			esc_attr( $id ),
270
-			checked( $value, 1, false )
268
+			esc_attr($name),
269
+			esc_attr($id),
270
+			checked($value, 1, false)
271 271
 		);
272 272
 
273
-		echo esc_html( $args['description'] );
273
+		echo esc_html($args['description']);
274 274
 
275 275
 		echo '</label>';
276 276
 
@@ -282,16 +282,16 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * @param array $args Arguments.
284 284
 	 */
285
-	public function input_license_key( $args ) {
286
-		do_action( 'pronamic_pay_license_check' );
285
+	public function input_license_key($args) {
286
+		do_action('pronamic_pay_license_check');
287 287
 
288
-		$this->input_element( $args );
288
+		$this->input_element($args);
289 289
 
290
-		$status = get_option( 'pronamic_pay_license_status' );
290
+		$status = get_option('pronamic_pay_license_status');
291 291
 
292 292
 		$icon = 'valid' === $status ? 'yes' : 'no';
293 293
 
294
-		printf( '<span class="dashicons dashicons-%s" style="vertical-align: text-bottom;"></span>', esc_attr( $icon ) );
294
+		printf('<span class="dashicons dashicons-%s" style="vertical-align: text-bottom;"></span>', esc_attr($icon));
295 295
 	}
296 296
 
297 297
 	/**
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @param array $args Arguments.
301 301
 	 */
302
-	public function input_page( $args ) {
302
+	public function input_page($args) {
303 303
 		$name = $args['label_for'];
304 304
 
305
-		wp_dropdown_pages( array(
306
-			'name'             => esc_attr( $name ),
307
-			'post_type'        => esc_attr( isset( $args['post_type'] ) ? $args['post_type'] : 'page' ),
308
-			'selected'         => esc_attr( get_option( $name, '' ) ),
309
-			'show_option_none' => esc_attr( isset( $args['show_option_none'] ) ? $args['show_option_none'] : __( '— Select a page —', 'pronamic_ideal' ) ),
305
+		wp_dropdown_pages(array(
306
+			'name'             => esc_attr($name),
307
+			'post_type'        => esc_attr(isset($args['post_type']) ? $args['post_type'] : 'page'),
308
+			'selected'         => esc_attr(get_option($name, '')),
309
+			'show_option_none' => esc_attr(isset($args['show_option_none']) ? $args['show_option_none'] : __('— Select a page —', 'pronamic_ideal')),
310 310
 			'class'            => 'regular-text',
311
-		) );
311
+		));
312 312
 	}
313 313
 }
Please login to merge, or discard this patch.
classes/Admin/AdminReports.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	 * @param Plugin      $plugin Plugin.
41 41
 	 * @param AdminModule $admin  Admin.
42 42
 	 */
43
-	public function __construct( Plugin $plugin, AdminModule $admin ) {
43
+	public function __construct(Plugin $plugin, AdminModule $admin) {
44 44
 		$this->plugin = $plugin;
45 45
 		$this->admin  = $admin;
46 46
 
47 47
 		// Actions.
48
-		add_action( 'pronamic_pay_admin_menu', array( $this, 'admin_menu' ) );
48
+		add_action('pronamic_pay_admin_menu', array($this, 'admin_menu'));
49 49
 	}
50 50
 
51 51
 	/**
@@ -54,53 +54,53 @@  discard block
 block discarded – undo
54 54
 	public function admin_menu() {
55 55
 		$hook_suffix = add_submenu_page(
56 56
 			'pronamic_ideal',
57
-			__( 'Reports', 'pronamic_ideal' ),
58
-			__( 'Reports', 'pronamic_ideal' ),
57
+			__('Reports', 'pronamic_ideal'),
58
+			__('Reports', 'pronamic_ideal'),
59 59
 			'edit_payments',
60 60
 			'pronamic_pay_reports',
61
-			array( $this, 'page_reports' )
61
+			array($this, 'page_reports')
62 62
 		);
63 63
 
64 64
 		// @see https://github.com/WordPress/WordPress/blob/4.2.4/wp-admin/admin-header.php#L82-L87.
65
-		add_action( 'admin_print_styles-' . $hook_suffix, array( $this, 'admin_css' ) );
65
+		add_action('admin_print_styles-' . $hook_suffix, array($this, 'admin_css'));
66 66
 	}
67 67
 
68 68
 	/**
69 69
 	 * Page reports.
70 70
 	 */
71 71
 	public function page_reports() {
72
-		return $this->admin->render_page( 'reports' );
72
+		return $this->admin->render_page('reports');
73 73
 	}
74 74
 
75 75
 	/**
76 76
 	 * Enqueue admin scripts.
77 77
 	 */
78 78
 	public function admin_css() {
79
-		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
79
+		$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
80 80
 
81 81
 		// Flot - http://www.flotcharts.org/.
82 82
 		$flot_version = '0.8.0-alpha';
83 83
 
84 84
 		wp_register_script(
85 85
 			'flot',
86
-			plugins_url( 'assets/flot/jquery.flot' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ),
87
-			array( 'jquery' ),
86
+			plugins_url('assets/flot/jquery.flot' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file),
87
+			array('jquery'),
88 88
 			$flot_version,
89 89
 			true
90 90
 		);
91 91
 
92 92
 		wp_register_script(
93 93
 			'flot-time',
94
-			plugins_url( 'assets/flot/jquery.flot.time' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ),
95
-			array( 'flot' ),
94
+			plugins_url('assets/flot/jquery.flot.time' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file),
95
+			array('flot'),
96 96
 			$flot_version,
97 97
 			true
98 98
 		);
99 99
 
100 100
 		wp_register_script(
101 101
 			'flot-resize',
102
-			plugins_url( 'assets/flot/jquery.flot.resize' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ),
103
-			array( 'flot' ),
102
+			plugins_url('assets/flot/jquery.flot.resize' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file),
103
+			array('flot'),
104 104
 			$flot_version,
105 105
 			true
106 106
 		);
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 		// Accounting.js - http://openexchangerates.github.io/accounting.js.
109 109
 		wp_register_script(
110 110
 			'accounting',
111
-			plugins_url( 'assets/accounting/accounting' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ),
112
-			array( 'jquery' ),
111
+			plugins_url('assets/accounting/accounting' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file),
112
+			array('jquery'),
113 113
 			'0.4.1',
114 114
 			true
115 115
 		);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		// Reports.
118 118
 		wp_register_script(
119 119
 			'proanmic-pay-admin-reports',
120
-			plugins_url( 'js/admin-reports' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ),
120
+			plugins_url('js/admin-reports' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file),
121 121
 			array(
122 122
 				'jquery',
123 123
 				'flot',
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 			'pronamicPayAdminReports',
137 137
 			array(
138 138
 				'data'       => $this->get_reports(),
139
-				'monthNames' => array_values( $wp_locale->month_abbrev ),
139
+				'monthNames' => array_values($wp_locale->month_abbrev),
140 140
 			)
141 141
 		);
142 142
 
143 143
 		// Enqueue.
144
-		wp_enqueue_script( 'proanmic-pay-admin-reports' );
144
+		wp_enqueue_script('proanmic-pay-admin-reports');
145 145
 	}
146 146
 
147 147
 	/**
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 	 * @return array
151 151
 	 */
152 152
 	public function get_reports() {
153
-		$start = new \DateTime( 'First day of January' );
154
-		$end   = new \DateTime( 'Last day of December' );
153
+		$start = new \DateTime('First day of January');
154
+		$end   = new \DateTime('Last day of December');
155 155
 
156 156
 		$data = array(
157 157
 			(object) array(
158
-				'label'      => __( 'Number succesfull payments', 'pronamic_ideal' ),
159
-				'data'       => $this->get_report( 'payment_completed', 'COUNT', $start, $end ),
158
+				'label'      => __('Number succesfull payments', 'pronamic_ideal'),
159
+				'data'       => $this->get_report('payment_completed', 'COUNT', $start, $end),
160 160
 				'color'      => '#dbe1e3',
161 161
 				'bars'       => (object) array(
162 162
 					'fillColor' => '#dbe1e3',
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 				'class'      => 'completed-count',
172 172
 			),
173 173
 			(object) array(
174
-				'label'            => __( 'Open payments', 'pronamic_ideal' ),
175
-				'data'             => $this->get_report( 'payment_pending', 'SUM', $start, $end ),
174
+				'label'            => __('Open payments', 'pronamic_ideal'),
175
+				'data'             => $this->get_report('payment_pending', 'SUM', $start, $end),
176 176
 				'yaxis'            => 2,
177 177
 				'color'            => '#b1d4ea',
178 178
 				'points'           => (object) array(
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 				'class'            => 'pending-sum',
193 193
 			),
194 194
 			(object) array(
195
-				'label'            => __( 'Succesfull payments', 'pronamic_ideal' ),
196
-				'data'             => $this->get_report( 'payment_completed', 'SUM', $start, $end ),
195
+				'label'            => __('Succesfull payments', 'pronamic_ideal'),
196
+				'data'             => $this->get_report('payment_completed', 'SUM', $start, $end),
197 197
 				'yaxis'            => 2,
198 198
 				'color'            => '#3498db',
199 199
 				'points'           => (object) array(
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 				'class'            => 'completed-sum',
215 215
 			),
216 216
 			(object) array(
217
-				'label'            => __( 'Cancelled payments', 'pronamic_ideal' ),
218
-				'data'             => $this->get_report( 'payment_cancelled', 'SUM', $start, $end ),
217
+				'label'            => __('Cancelled payments', 'pronamic_ideal'),
218
+				'data'             => $this->get_report('payment_cancelled', 'SUM', $start, $end),
219 219
 				'yaxis'            => 2,
220 220
 				'color'            => '#F1C40F',
221 221
 				'points'           => (object) array(
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 				'class'            => 'cancelled-sum',
237 237
 			),
238 238
 			(object) array(
239
-				'label'            => __( 'Expired payments', 'pronamic_ideal' ),
240
-				'data'             => $this->get_report( 'payment_expired', 'SUM', $start, $end ),
239
+				'label'            => __('Expired payments', 'pronamic_ideal'),
240
+				'data'             => $this->get_report('payment_expired', 'SUM', $start, $end),
241 241
 				'yaxis'            => 2,
242 242
 				'color'            => '#DBE1E3',
243 243
 				'points'           => (object) array(
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 				'class'            => 'expired-sum',
259 259
 			),
260 260
 			(object) array(
261
-				'label'            => __( 'Failed payments', 'pronamic_ideal' ),
262
-				'data'             => $this->get_report( 'payment_failed', 'SUM', $start, $end ),
261
+				'label'            => __('Failed payments', 'pronamic_ideal'),
262
+				'data'             => $this->get_report('payment_failed', 'SUM', $start, $end),
263 263
 				'yaxis'            => 2,
264 264
 				'color'            => '#E74C3C',
265 265
 				'points'           => (object) array(
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 			),
282 282
 		);
283 283
 
284
-		foreach ( $data as $serie ) {
285
-			$serie->legendValue = array_sum( wp_list_pluck( $serie->data, 1 ) );
284
+		foreach ($data as $serie) {
285
+			$serie->legendValue = array_sum(wp_list_pluck($serie->data, 1));
286 286
 		}
287 287
 
288 288
 		return $data;
@@ -298,16 +298,16 @@  discard block
 block discarded – undo
298 298
 	 * @param \DateTime $start    Start date.
299 299
 	 * @param \DateTime $end      End date.
300 300
 	 */
301
-	private function get_report( $status, $function, $start, $end ) {
301
+	private function get_report($status, $function, $start, $end) {
302 302
 		global $wpdb;
303 303
 
304
-		$interval = new \DateInterval( 'P1M' );
305
-		$period   = new \DatePeriod( $start, $interval, $end );
304
+		$interval = new \DateInterval('P1M');
305
+		$period   = new \DatePeriod($start, $interval, $end);
306 306
 
307 307
 		$date_format = '%Y-%m';
308 308
 
309 309
 		// @codingStandardsIgnoreStart
310
-		$query = $wpdb->prepare( "
310
+		$query = $wpdb->prepare("
311 311
 				SELECT
312 312
 					DATE_FORMAT( post.post_date, %s ) AS month,
313 313
 					$function( meta_amount.meta_value ) AS value
@@ -329,22 +329,22 @@  discard block
 block discarded – undo
329 329
 				;
330 330
 			",
331 331
 			$date_format,
332
-			$start->format( 'Y-m-d' ),
333
-			$end->format( 'Y-m-d' ),
332
+			$start->format('Y-m-d'),
333
+			$end->format('Y-m-d'),
334 334
 			$status
335 335
 		);
336 336
 		// @codingStandardsIgnoreEnd
337 337
 
338
-		$data = $wpdb->get_results( $query, OBJECT_K ); // WPCS: unprepared SQL ok.
338
+		$data = $wpdb->get_results($query, OBJECT_K); // WPCS: unprepared SQL ok.
339 339
 
340 340
 		$report = array();
341 341
 
342
-		foreach ( $period as $date ) {
343
-			$key = $date->format( 'Y-m' );
342
+		foreach ($period as $date) {
343
+			$key = $date->format('Y-m');
344 344
 
345 345
 			$value = 0;
346
-			if ( isset( $data[ $key ] ) ) {
347
-				$value = (float) $data[ $key ]->value;
346
+			if (isset($data[$key])) {
347
+				$value = (float) $data[$key]->value;
348 348
 			}
349 349
 
350 350
 			$report[] = array(
Please login to merge, or discard this patch.
classes/Admin/GatewayPostType.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -33,22 +33,22 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @param AdminModule $admin Admin Module.
35 35
 	 */
36
-	public function __construct( AdminModule $admin ) {
36
+	public function __construct(AdminModule $admin) {
37 37
 		$this->admin = $admin;
38 38
 
39
-		add_filter( 'manage_edit-' . self::POST_TYPE . '_columns', array( $this, 'edit_columns' ) );
39
+		add_filter('manage_edit-' . self::POST_TYPE . '_columns', array($this, 'edit_columns'));
40 40
 
41
-		add_action( 'manage_' . self::POST_TYPE . '_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 );
41
+		add_action('manage_' . self::POST_TYPE . '_posts_custom_column', array($this, 'custom_columns'), 10, 2);
42 42
 
43
-		add_action( 'post_edit_form_tag', array( $this, 'post_edit_form_tag' ) );
43
+		add_action('post_edit_form_tag', array($this, 'post_edit_form_tag'));
44 44
 
45
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
45
+		add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
46 46
 
47
-		add_action( 'save_post_' . self::POST_TYPE, array( $this, 'save_post' ) );
47
+		add_action('save_post_' . self::POST_TYPE, array($this, 'save_post'));
48 48
 
49
-		add_action( 'display_post_states', array( $this, 'display_post_states' ), 10, 2 );
49
+		add_action('display_post_states', array($this, 'display_post_states'), 10, 2);
50 50
 
51
-		add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
51
+		add_filter('post_updated_messages', array($this, 'post_updated_messages'));
52 52
 	}
53 53
 
54 54
 	/**
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 	 * @param array $columns Columns.
58 58
 	 * @return array
59 59
 	 */
60
-	public function edit_columns( $columns ) {
60
+	public function edit_columns($columns) {
61 61
 		$columns = array(
62 62
 			'cb'                         => '<input type="checkbox" />',
63
-			'title'                      => __( 'Title', 'pronamic_ideal' ),
64
-			'pronamic_gateway_variant'   => __( 'Variant', 'pronamic_ideal' ),
65
-			'pronamic_gateway_id'        => __( 'ID', 'pronamic_ideal' ),
66
-			'pronamic_gateway_dashboard' => __( 'Dashboard', 'pronamic_ideal' ),
67
-			'date'                       => __( 'Date', 'pronamic_ideal' ),
63
+			'title'                      => __('Title', 'pronamic_ideal'),
64
+			'pronamic_gateway_variant'   => __('Variant', 'pronamic_ideal'),
65
+			'pronamic_gateway_id'        => __('ID', 'pronamic_ideal'),
66
+			'pronamic_gateway_dashboard' => __('Dashboard', 'pronamic_ideal'),
67
+			'date'                       => __('Date', 'pronamic_ideal'),
68 68
 		);
69 69
 
70 70
 		return $columns;
@@ -76,80 +76,80 @@  discard block
 block discarded – undo
76 76
 	 * @param string $column  Column.
77 77
 	 * @param string $post_id Post ID.
78 78
 	 */
79
-	public function custom_columns( $column, $post_id ) {
80
-		$id = get_post_meta( $post_id, '_pronamic_gateway_id', true );
79
+	public function custom_columns($column, $post_id) {
80
+		$id = get_post_meta($post_id, '_pronamic_gateway_id', true);
81 81
 
82 82
 		$integrations = $this->admin->plugin->gateway_integrations;
83 83
 
84
-		if ( isset( $integrations[ $id ] ) ) {
85
-			$integration = $integrations[ $id ];
84
+		if (isset($integrations[$id])) {
85
+			$integration = $integrations[$id];
86 86
 		}
87 87
 
88
-		switch ( $column ) {
88
+		switch ($column) {
89 89
 			case 'pronamic_gateway_variant':
90
-				if ( isset( $integration ) ) {
91
-					echo esc_html( $integration->get_name() );
90
+				if (isset($integration)) {
91
+					echo esc_html($integration->get_name());
92 92
 				} else {
93
-					echo esc_html( $id );
93
+					echo esc_html($id);
94 94
 				}
95 95
 
96 96
 				break;
97 97
 			case 'pronamic_gateway_id':
98 98
 				$data = array_filter(
99 99
 					array(
100
-						get_post_meta( $post_id, '_pronamic_gateway_ideal_merchant_id', true ),
101
-						get_post_meta( $post_id, '_pronamic_gateway_omnikassa_merchant_id', true ),
102
-						get_post_meta( $post_id, '_pronamic_gateway_buckaroo_website_key', true ),
103
-						get_post_meta( $post_id, '_pronamic_gateway_icepay_merchant_id', true ),
104
-						get_post_meta( $post_id, '_pronamic_gateway_mollie_partner_id', true ),
105
-						get_post_meta( $post_id, '_pronamic_gateway_multisafepay_account_id', true ),
106
-						get_post_meta( $post_id, '_pronamic_gateway_pay_nl_service_id', true ),
107
-						get_post_meta( $post_id, '_pronamic_gateway_paydutch_username', true ),
108
-						get_post_meta( $post_id, '_pronamic_gateway_sisow_merchant_id', true ),
109
-						get_post_meta( $post_id, '_pronamic_gateway_targetpay_layoutcode', true ),
110
-						get_post_meta( $post_id, '_pronamic_gateway_ogone_psp_id', true ),
111
-						get_post_meta( $post_id, '_pronamic_gateway_ogone_user_id', true ),
100
+						get_post_meta($post_id, '_pronamic_gateway_ideal_merchant_id', true),
101
+						get_post_meta($post_id, '_pronamic_gateway_omnikassa_merchant_id', true),
102
+						get_post_meta($post_id, '_pronamic_gateway_buckaroo_website_key', true),
103
+						get_post_meta($post_id, '_pronamic_gateway_icepay_merchant_id', true),
104
+						get_post_meta($post_id, '_pronamic_gateway_mollie_partner_id', true),
105
+						get_post_meta($post_id, '_pronamic_gateway_multisafepay_account_id', true),
106
+						get_post_meta($post_id, '_pronamic_gateway_pay_nl_service_id', true),
107
+						get_post_meta($post_id, '_pronamic_gateway_paydutch_username', true),
108
+						get_post_meta($post_id, '_pronamic_gateway_sisow_merchant_id', true),
109
+						get_post_meta($post_id, '_pronamic_gateway_targetpay_layoutcode', true),
110
+						get_post_meta($post_id, '_pronamic_gateway_ogone_psp_id', true),
111
+						get_post_meta($post_id, '_pronamic_gateway_ogone_user_id', true),
112 112
 					)
113 113
 				);
114 114
 
115
-				echo esc_html( implode( ' ', $data ) );
115
+				echo esc_html(implode(' ', $data));
116 116
 
117 117
 				break;
118 118
 			case 'pronamic_gateway_secret':
119 119
 				$data = array_filter(
120 120
 					array(
121
-						get_post_meta( $post_id, '_pronamic_gateway_ideal_basic_hash_key', true ),
122
-						get_post_meta( $post_id, '_pronamic_gateway_omnikassa_secret_key', true ),
123
-						get_post_meta( $post_id, '_pronamic_gateway_buckaroo_secret_key', true ),
124
-						get_post_meta( $post_id, '_pronamic_gateway_icepay_secret_code', true ),
125
-						get_post_meta( $post_id, '_pronamic_gateway_sisow_merchant_key', true ),
126
-						get_post_meta( $post_id, '_pronamic_gateway_ogone_password', true ),
121
+						get_post_meta($post_id, '_pronamic_gateway_ideal_basic_hash_key', true),
122
+						get_post_meta($post_id, '_pronamic_gateway_omnikassa_secret_key', true),
123
+						get_post_meta($post_id, '_pronamic_gateway_buckaroo_secret_key', true),
124
+						get_post_meta($post_id, '_pronamic_gateway_icepay_secret_code', true),
125
+						get_post_meta($post_id, '_pronamic_gateway_sisow_merchant_key', true),
126
+						get_post_meta($post_id, '_pronamic_gateway_ogone_password', true),
127 127
 					)
128 128
 				);
129 129
 
130
-				echo esc_html( implode( ' ', $data ) );
130
+				echo esc_html(implode(' ', $data));
131 131
 
132 132
 				break;
133 133
 			case 'pronamic_gateway_dashboard':
134
-				if ( isset( $integration ) ) {
134
+				if (isset($integration)) {
135 135
 					$urls = $integration->get_dashboard_url();
136 136
 
137 137
 					// Output.
138 138
 					$content = array();
139 139
 
140
-					foreach ( $urls as $name => $url ) {
141
-						if ( empty( $name ) ) {
142
-							$name = __( 'Dashboard', 'pronamic_ideal' );
140
+					foreach ($urls as $name => $url) {
141
+						if (empty($name)) {
142
+							$name = __('Dashboard', 'pronamic_ideal');
143 143
 						}
144 144
 
145 145
 						$content[] = sprintf(
146 146
 							'<a href="%s" target="_blank">%s</a>',
147
-							esc_attr( $url ),
148
-							esc_html( ucfirst( $name ) )
147
+							esc_attr($url),
148
+							esc_html(ucfirst($name))
149 149
 						);
150 150
 					}
151 151
 
152
-					echo implode( ' | ', $content ); // WPCS: XSS ok.
152
+					echo implode(' | ', $content); // WPCS: XSS ok.
153 153
 				}
154 154
 
155 155
 				break;
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
 	 * @param array    $post_states Post states.
163 163
 	 * @param \WP_Post $post        Post.
164 164
 	 */
165
-	public function display_post_states( $post_states, $post ) {
166
-		if ( self::POST_TYPE !== get_post_type( $post ) ) {
165
+	public function display_post_states($post_states, $post) {
166
+		if (self::POST_TYPE !== get_post_type($post)) {
167 167
 			return $post_states;
168 168
 		}
169 169
 
170
-		if ( intval( get_option( 'pronamic_pay_config_id' ) ) === $post->ID ) {
171
-			$post_states['pronamic_pay_config_default'] = __( 'Default', 'pronamic_ideal' );
170
+		if (intval(get_option('pronamic_pay_config_id')) === $post->ID) {
171
+			$post_states['pronamic_pay_config_default'] = __('Default', 'pronamic_ideal');
172 172
 		}
173 173
 
174 174
 		return $post_states;
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @param WP_Post $post Post (only available @since 3.5.2).
184 184
 	 */
185
-	public function post_edit_form_tag( $post ) {
186
-		if ( empty( $post ) ) {
185
+	public function post_edit_form_tag($post) {
186
+		if (empty($post)) {
187 187
 			global $post;
188 188
 		}
189 189
 
190
-		if ( $post ) {
191
-			if ( self::POST_TYPE === $post->post_type ) {
190
+		if ($post) {
191
+			if (self::POST_TYPE === $post->post_type) {
192 192
 				echo ' enctype="multipart/form-data"';
193 193
 			}
194 194
 		}
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @param string $post_type Post Type.
201 201
 	 */
202
-	public function add_meta_boxes( $post_type ) {
203
-		if ( self::POST_TYPE === $post_type ) {
202
+	public function add_meta_boxes($post_type) {
203
+		if (self::POST_TYPE === $post_type) {
204 204
 			add_meta_box(
205 205
 				'pronamic_gateway_config',
206
-				__( 'Configuration', 'pronamic_ideal' ),
207
-				array( $this, 'meta_box_config' ),
206
+				__('Configuration', 'pronamic_ideal'),
207
+				array($this, 'meta_box_config'),
208 208
 				$post_type,
209 209
 				'normal',
210 210
 				'high'
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 
213 213
 			add_meta_box(
214 214
 				'pronamic_gateway_test',
215
-				__( 'Test', 'pronamic_ideal' ),
216
-				array( $this, 'meta_box_test' ),
215
+				__('Test', 'pronamic_ideal'),
216
+				array($this, 'meta_box_test'),
217 217
 				$post_type,
218 218
 				'normal',
219 219
 				'high'
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 *
227 227
 	 * @param WP_Post $post The object for the current post/page.
228 228
 	 */
229
-	public function meta_box_config( $post ) {
230
-		wp_nonce_field( 'pronamic_pay_save_gateway', 'pronamic_pay_nonce' );
229
+	public function meta_box_config($post) {
230
+		wp_nonce_field('pronamic_pay_save_gateway', 'pronamic_pay_nonce');
231 231
 
232 232
 		include Plugin::$dirname . '/admin/meta-box-gateway-config.php';
233 233
 	}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @param WP_Post $post The object for the current post/page.
239 239
 	 */
240
-	public function meta_box_test( $post ) {
240
+	public function meta_box_test($post) {
241 241
 		include Plugin::$dirname . '/admin/meta-box-gateway-test.php';
242 242
 	}
243 243
 
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @param int $post_id The ID of the post being saved.
248 248
 	 */
249
-	public function save_post( $post_id ) {
249
+	public function save_post($post_id) {
250 250
 		// Nonce.
251
-		if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_nonce' ) ) {
251
+		if ( ! filter_has_var(INPUT_POST, 'pronamic_pay_nonce')) {
252 252
 			return $post_id;
253 253
 		}
254 254
 
255
-		check_admin_referer( 'pronamic_pay_save_gateway', 'pronamic_pay_nonce' );
255
+		check_admin_referer('pronamic_pay_save_gateway', 'pronamic_pay_nonce');
256 256
 
257 257
 		// If this is an autosave, our form has not been submitted, so we don't want to do anything.
258
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
258
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
259 259
 			return $post_id;
260 260
 		}
261 261
 
@@ -267,39 +267,39 @@  discard block
 block discarded – undo
267 267
 			'_pronamic_gateway_id' => FILTER_SANITIZE_STRING,
268 268
 		);
269 269
 
270
-		foreach ( $fields as $field ) {
271
-			if ( isset( $field['meta_key'], $field['filter'] ) ) {
270
+		foreach ($fields as $field) {
271
+			if (isset($field['meta_key'], $field['filter'])) {
272 272
 				$name   = $field['meta_key'];
273 273
 				$filter = $field['filter'];
274 274
 
275
-				$definition[ $name ] = $filter;
275
+				$definition[$name] = $filter;
276 276
 			}
277 277
 		}
278 278
 
279
-		$data = filter_input_array( INPUT_POST, $definition );
279
+		$data = filter_input_array(INPUT_POST, $definition);
280 280
 
281
-		if ( ! empty( $data['_pronamic_gateway_id'] ) ) {
281
+		if ( ! empty($data['_pronamic_gateway_id'])) {
282 282
 			$integrations = $this->admin->plugin->gateway_integrations;
283 283
 
284
-			if ( isset( $integrations[ $data['_pronamic_gateway_id'] ] ) ) {
285
-				$integration = $integrations[ $data['_pronamic_gateway_id'] ];
284
+			if (isset($integrations[$data['_pronamic_gateway_id']])) {
285
+				$integration = $integrations[$data['_pronamic_gateway_id']];
286 286
 			}
287 287
 
288
-			if ( $integration ) {
288
+			if ($integration) {
289 289
 				$settings = $integration->get_settings();
290 290
 
291
-				foreach ( $fields as $field ) {
292
-					if ( isset( $field['default'], $field['meta_key'], $data[ $field['meta_key'] ] ) ) {
291
+				foreach ($fields as $field) {
292
+					if (isset($field['default'], $field['meta_key'], $data[$field['meta_key']])) {
293 293
 						// Remove default value if not applicable to the selected gateway.
294
-						if ( isset( $field['methods'] ) ) {
295
-							$clean_default = array_intersect( $settings, $field['methods'] );
294
+						if (isset($field['methods'])) {
295
+							$clean_default = array_intersect($settings, $field['methods']);
296 296
 
297
-							if ( empty( $clean_default ) ) {
298
-								$meta_value = get_post_meta( $post_id, $field['meta_key'], true );
297
+							if (empty($clean_default)) {
298
+								$meta_value = get_post_meta($post_id, $field['meta_key'], true);
299 299
 
300 300
 								// Only remove value if not saved before.
301
-								if ( empty( $meta_value ) ) {
302
-									$data[ $field['meta_key'] ] = null;
301
+								if (empty($meta_value)) {
302
+									$data[$field['meta_key']] = null;
303 303
 
304 304
 									continue;
305 305
 								}
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 						}
308 308
 
309 309
 						// Set the default value if empty.
310
-						if ( empty( $data[ $field['meta_key'] ] ) ) {
310
+						if (empty($data[$field['meta_key']])) {
311 311
 							$default = $field['default'];
312 312
 
313
-							if ( is_array( $default ) && 2 === count( $default ) && Util::class_method_exists( $default[0], $default[1] ) ) {
314
-								$data[ $field['meta_key'] ] = call_user_func( $default, $field );
313
+							if (is_array($default) && 2 === count($default) && Util::class_method_exists($default[0], $default[1])) {
314
+								$data[$field['meta_key']] = call_user_func($default, $field);
315 315
 							} else {
316
-								$data[ $field['meta_key'] ] = $default;
316
+								$data[$field['meta_key']] = $default;
317 317
 							}
318 318
 						}
319 319
 					}
@@ -322,23 +322,23 @@  discard block
 block discarded – undo
322 322
 				// Filter data through gateway integration settings.
323 323
 				$settings_classes = $integration->get_settings_class();
324 324
 
325
-				if ( ! is_array( $settings_classes ) ) {
326
-					$settings_classes = array( $settings_classes );
325
+				if ( ! is_array($settings_classes)) {
326
+					$settings_classes = array($settings_classes);
327 327
 				}
328 328
 
329
-				foreach ( $settings_classes as $settings_class ) {
329
+				foreach ($settings_classes as $settings_class) {
330 330
 					$gateway_settings = new $settings_class();
331 331
 
332
-					$data = $gateway_settings->save_post( $data );
332
+					$data = $gateway_settings->save_post($data);
333 333
 				}
334 334
 			}
335 335
 		}
336 336
 
337 337
 		// Update post meta data.
338
-		pronamic_pay_update_post_meta_data( $post_id, $data );
338
+		pronamic_pay_update_post_meta_data($post_id, $data);
339 339
 
340 340
 		// Transient.
341
-		delete_transient( 'pronamic_pay_issuers_' . $post_id );
341
+		delete_transient('pronamic_pay_issuers_' . $post_id);
342 342
 
343 343
 		\Pronamic\WordPress\Pay\Core\PaymentMethods::update_active_payment_methods();
344 344
 	}
@@ -352,34 +352,34 @@  discard block
 block discarded – undo
352 352
 	 * @param array $messages Messages.
353 353
 	 * @return array
354 354
 	 */
355
-	public function post_updated_messages( $messages ) {
355
+	public function post_updated_messages($messages) {
356 356
 		global $post;
357 357
 
358 358
 		// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352797&filters[translation_id]=37948900
359
-		$scheduled_date = date_i18n( __( 'M j, Y @ H:i', 'pronamic_ideal' ), strtotime( $post->post_date ) );
359
+		$scheduled_date = date_i18n(__('M j, Y @ H:i', 'pronamic_ideal'), strtotime($post->post_date));
360 360
 
361
-		$messages[ self::POST_TYPE ] = array(
361
+		$messages[self::POST_TYPE] = array(
362 362
 			0  => '', // Unused. Messages start at index 1.
363
-			1  => __( 'Configuration updated.', 'pronamic_ideal' ),
363
+			1  => __('Configuration updated.', 'pronamic_ideal'),
364 364
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352799&filters[translation_id]=37947229
365 365
 			2  => $messages['post'][2],
366 366
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352800&filters[translation_id]=37947870
367 367
 			3  => $messages['post'][3],
368 368
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352798&filters[translation_id]=37947230
369
-			4  => __( 'Configuration updated.', 'pronamic_ideal' ),
369
+			4  => __('Configuration updated.', 'pronamic_ideal'),
370 370
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352801&filters[translation_id]=37947231
371 371
 			// translators: %s: date and time of the revision.
372
-			5  => isset( $_GET['revision'] ) ? sprintf( __( 'Configuration restored to revision from %s.', 'pronamic_ideal' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, // WPCS: CSRF ok.
372
+			5  => isset($_GET['revision']) ? sprintf(__('Configuration restored to revision from %s.', 'pronamic_ideal'), wp_post_revision_title((int) $_GET['revision'], false)) : false, // WPCS: CSRF ok.
373 373
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352802&filters[translation_id]=37949178
374
-			6  => __( 'Configuration published.', 'pronamic_ideal' ),
374
+			6  => __('Configuration published.', 'pronamic_ideal'),
375 375
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352803&filters[translation_id]=37947232
376
-			7  => __( 'Configuration saved.', 'pronamic_ideal' ),
376
+			7  => __('Configuration saved.', 'pronamic_ideal'),
377 377
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352804&filters[translation_id]=37949303
378
-			8  => __( 'Configuration submitted.', 'pronamic_ideal' ),
378
+			8  => __('Configuration submitted.', 'pronamic_ideal'),
379 379
 			// @see https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352805&filters[translation_id]=37949302
380
-			9  => sprintf( __( 'Configuration scheduled for: %s.', 'pronamic_ideal' ), '<strong>' . $scheduled_date . '</strong>' ),
380
+			9  => sprintf(__('Configuration scheduled for: %s.', 'pronamic_ideal'), '<strong>' . $scheduled_date . '</strong>'),
381 381
 			// @https://translate.wordpress.org/projects/wp/4.4.x/admin/nl/default?filters[status]=either&filters[original_id]=2352806&filters[translation_id]=37949301
382
-			10 => __( 'Configuration draft updated.', 'pronamic_ideal' ),
382
+			10 => __('Configuration draft updated.', 'pronamic_ideal'),
383 383
 		);
384 384
 
385 385
 		return $messages;
Please login to merge, or discard this patch.
classes/Admin/AdminTour.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param Plugin $plugin Plugin.
31 31
 	 */
32
-	public function __construct( Plugin $plugin ) {
32
+	public function __construct(Plugin $plugin) {
33 33
 		$this->plugin = $plugin;
34 34
 
35 35
 		// Actions.
36
-		add_action( 'admin_init', array( $this, 'admin_init' ) );
36
+		add_action('admin_init', array($this, 'admin_init'));
37 37
 	}
38 38
 
39 39
 	/**
40 40
 	 * Admin initialize.
41 41
 	 */
42 42
 	public function admin_init() {
43
-		if ( filter_has_var( INPUT_GET, 'pronamic_pay_ignore_tour' ) && wp_verify_nonce( filter_input( INPUT_GET, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING ), 'pronamic_pay_ignore_tour' ) ) {
44
-			$ignore = filter_input( INPUT_GET, 'pronamic_pay_ignore_tour', FILTER_VALIDATE_BOOLEAN );
43
+		if (filter_has_var(INPUT_GET, 'pronamic_pay_ignore_tour') && wp_verify_nonce(filter_input(INPUT_GET, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING), 'pronamic_pay_ignore_tour')) {
44
+			$ignore = filter_input(INPUT_GET, 'pronamic_pay_ignore_tour', FILTER_VALIDATE_BOOLEAN);
45 45
 
46
-			update_user_meta( get_current_user_id(), 'pronamic_pay_ignore_tour', $ignore );
46
+			update_user_meta(get_current_user_id(), 'pronamic_pay_ignore_tour', $ignore);
47 47
 		}
48 48
 
49
-		if ( ! get_user_meta( get_current_user_id(), 'pronamic_pay_ignore_tour', true ) ) {
50
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
49
+		if ( ! get_user_meta(get_current_user_id(), 'pronamic_pay_ignore_tour', true)) {
50
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
51 51
 		}
52 52
 	}
53 53
 
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 	 * Admin enqueue scripts.
56 56
 	 */
57 57
 	public function admin_enqueue_scripts() {
58
-		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
58
+		$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
59 59
 
60 60
 		// Pointers.
61 61
 		wp_register_style(
62 62
 			'proanmic-pay-admin-tour',
63
-			plugins_url( 'css/admin-tour' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file ),
63
+			plugins_url('css/admin-tour' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file),
64 64
 			array(
65 65
 				'wp-pointer',
66 66
 			),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 		wp_register_script(
71 71
 			'proanmic-pay-admin-tour',
72
-			plugins_url( 'js/admin-tour' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ),
72
+			plugins_url('js/admin-tour' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file),
73 73
 			array(
74 74
 				'jquery',
75 75
 				'wp-pointer',
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 		);
88 88
 
89 89
 		// Enqueue.
90
-		wp_enqueue_style( 'proanmic-pay-admin-tour' );
91
-		wp_enqueue_script( 'proanmic-pay-admin-tour' );
90
+		wp_enqueue_style('proanmic-pay-admin-tour');
91
+		wp_enqueue_script('proanmic-pay-admin-tour');
92 92
 	}
93 93
 
94 94
 	/**
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 * @param string $file File.
98 98
 	 * @return string
99 99
 	 */
100
-	private function get_content( $file ) {
101
-		$path = plugin_dir_path( \Pronamic\WordPress\Pay\Plugin::$file ) . 'admin/' . $file . '.php';
100
+	private function get_content($file) {
101
+		$path = plugin_dir_path(\Pronamic\WordPress\Pay\Plugin::$file) . 'admin/' . $file . '.php';
102 102
 
103
-		if ( is_readable( $path ) ) {
103
+		if (is_readable($path)) {
104 104
 			ob_start();
105 105
 
106 106
 			include $path;
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
 	private function get_pointers() {
122 122
 		$pointers = array();
123 123
 
124
-		$page   = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
124
+		$page   = filter_input(INPUT_GET, 'page', FILTER_SANITIZE_STRING);
125 125
 		$screen = get_current_screen();
126 126
 
127
-		switch ( $screen->id ) {
127
+		switch ($screen->id) {
128 128
 			case 'toplevel_page_pronamic_ideal':
129 129
 				$pointers = array(
130 130
 					array(
131 131
 						// @see https://github.com/WordPress/WordPress/blob/4.7/wp-admin/edit.php#L321
132 132
 						'selector' => '.wrap .wp-header-end',
133 133
 						'options'  => (object) array(
134
-							'content'      => $this->get_content( 'pointer-dashboard' ),
134
+							'content'      => $this->get_content('pointer-dashboard'),
135 135
 							'position'     => (object) array(
136 136
 								'edge'  => 'top',
137
-								'align' => ( is_rtl() ) ? 'left' : 'right',
137
+								'align' => (is_rtl()) ? 'left' : 'right',
138 138
 							),
139 139
 							'pointerWidth' => 450,
140 140
 						),
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 					array(
148 148
 						'selector' => '.wrap .wp-header-end',
149 149
 						'options'  => (object) array(
150
-							'content'      => $this->get_content( 'pointer-payments' ),
150
+							'content'      => $this->get_content('pointer-payments'),
151 151
 							'position'     => (object) array(
152 152
 								'edge'  => 'top',
153
-								'align' => ( is_rtl() ) ? 'left' : 'right',
153
+								'align' => (is_rtl()) ? 'left' : 'right',
154 154
 							),
155 155
 							'pointerWidth' => 450,
156 156
 						),
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 					array(
164 164
 						'selector' => '.wrap .wp-header-end',
165 165
 						'options'  => (object) array(
166
-							'content'      => $this->get_content( 'pointer-gateways' ),
166
+							'content'      => $this->get_content('pointer-gateways'),
167 167
 							'position'     => (object) array(
168 168
 								'edge'  => 'top',
169
-								'align' => ( is_rtl() ) ? 'left' : 'right',
169
+								'align' => (is_rtl()) ? 'left' : 'right',
170 170
 							),
171 171
 							'pointerWidth' => 450,
172 172
 						),
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 					array(
180 180
 						'selector' => '.wrap .wp-header-end',
181 181
 						'options'  => (object) array(
182
-							'content'      => $this->get_content( 'pointer-forms' ),
182
+							'content'      => $this->get_content('pointer-forms'),
183 183
 							'position'     => (object) array(
184 184
 								'edge'  => 'top',
185
-								'align' => ( is_rtl() ) ? 'left' : 'right',
185
+								'align' => (is_rtl()) ? 'left' : 'right',
186 186
 							),
187 187
 							'pointerWidth' => 450,
188 188
 						),
@@ -192,16 +192,16 @@  discard block
 block discarded – undo
192 192
 				break;
193 193
 		}
194 194
 
195
-		switch ( $page ) {
195
+		switch ($page) {
196 196
 			case 'pronamic_pay_settings':
197 197
 				$pointers = array(
198 198
 					array(
199 199
 						'selector' => '.wrap .wp-header-end',
200 200
 						'options'  => (object) array(
201
-							'content'      => $this->get_content( 'pointer-settings' ),
201
+							'content'      => $this->get_content('pointer-settings'),
202 202
 							'position'     => (object) array(
203 203
 								'edge'  => 'top',
204
-								'align' => ( is_rtl() ) ? 'left' : 'right',
204
+								'align' => (is_rtl()) ? 'left' : 'right',
205 205
 							),
206 206
 							'pointerWidth' => 450,
207 207
 						),
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 					array(
215 215
 						'selector' => '.wrap .wp-header-end',
216 216
 						'options'  => (object) array(
217
-							'content'      => $this->get_content( 'pointer-tools' ),
217
+							'content'      => $this->get_content('pointer-tools'),
218 218
 							'position'     => (object) array(
219 219
 								'edge'  => 'top',
220
-								'align' => ( is_rtl() ) ? 'left' : 'right',
220
+								'align' => (is_rtl()) ? 'left' : 'right',
221 221
 							),
222 222
 							'pointerWidth' => 450,
223 223
 						),
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 					array(
231 231
 						'selector' => '.wrap .wp-header-end',
232 232
 						'options'  => (object) array(
233
-							'content'      => $this->get_content( 'pointer-reports' ),
233
+							'content'      => $this->get_content('pointer-reports'),
234 234
 							'position'     => (object) array(
235 235
 								'edge'  => 'top',
236
-								'align' => ( is_rtl() ) ? 'left' : 'right',
236
+								'align' => (is_rtl()) ? 'left' : 'right',
237 237
 							),
238 238
 							'pointerWidth' => 450,
239 239
 						),
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
 				break;
244 244
 		}
245 245
 
246
-		if ( empty( $pointers ) ) {
246
+		if (empty($pointers)) {
247 247
 			$pointers = array(
248 248
 				array(
249 249
 					'selector' => 'li.toplevel_page_pronamic_ideal',
250 250
 					'options'  => (object) array(
251
-						'content'  => $this->get_content( 'pointer-start' ),
251
+						'content'  => $this->get_content('pointer-start'),
252 252
 						'position' => (object) array(
253 253
 							'edge'  => 'left',
254 254
 							'align' => 'center',
Please login to merge, or discard this patch.
classes/Util.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -30,23 +30,23 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @return string|WP_Error
32 32
 	 */
33
-	public static function remote_get_body( $url, $required_response_code = 200, array $args = array() ) {
34
-		$result = wp_remote_request( $url, $args );
33
+	public static function remote_get_body($url, $required_response_code = 200, array $args = array()) {
34
+		$result = wp_remote_request($url, $args);
35 35
 
36
-		if ( is_wp_error( $result ) ) {
36
+		if (is_wp_error($result)) {
37 37
 			return $result;
38 38
 		}
39 39
 
40
-		$response_code = wp_remote_retrieve_response_code( $result );
40
+		$response_code = wp_remote_retrieve_response_code($result);
41 41
 
42
-		if ( $response_code === $required_response_code ) {
43
-			return wp_remote_retrieve_body( $result );
42
+		if ($response_code === $required_response_code) {
43
+			return wp_remote_retrieve_body($result);
44 44
 		}
45 45
 
46 46
 		return new WP_Error(
47 47
 			'wrong_response_code',
48 48
 			sprintf(
49
-				__( 'The response code (<code>%1$s<code>) was incorrect, required response code <code>%2$s</code>.', 'pronamic_ideal' ),
49
+				__('The response code (<code>%1$s<code>) was incorrect, required response code <code>%2$s</code>.', 'pronamic_ideal'),
50 50
 				$response_code,
51 51
 				$required_response_code
52 52
 			)
@@ -60,22 +60,22 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @return SimpleXMLElement|WP_Error
62 62
 	 */
63
-	public static function simplexml_load_string( $string ) {
63
+	public static function simplexml_load_string($string) {
64 64
 		$result = false;
65 65
 
66 66
 		// Suppress all XML errors.
67
-		$use_errors = libxml_use_internal_errors( true );
67
+		$use_errors = libxml_use_internal_errors(true);
68 68
 
69 69
 		// Load.
70
-		$xml = simplexml_load_string( $string );
70
+		$xml = simplexml_load_string($string);
71 71
 
72
-		if ( false !== $xml ) {
72
+		if (false !== $xml) {
73 73
 			$result = $xml;
74 74
 		} else {
75
-			$error = new WP_Error( 'simplexml_load_error', __( 'Could not load the XML string.', 'pronamic_ideal' ) );
75
+			$error = new WP_Error('simplexml_load_error', __('Could not load the XML string.', 'pronamic_ideal'));
76 76
 
77
-			foreach ( libxml_get_errors() as $e ) {
78
-				$error->add( 'libxml_error', $e->message, $e );
77
+			foreach (libxml_get_errors() as $e) {
78
+				$error->add('libxml_error', $e->message, $e);
79 79
 			}
80 80
 
81 81
 			libxml_clear_errors();
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 
86 86
 		// Set back to previous value.
87
-		libxml_use_internal_errors( $use_errors );
87
+		libxml_use_internal_errors($use_errors);
88 88
 
89 89
 		return $result;
90 90
 	}
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @return int
98 98
 	 */
99
-	public static function amount_to_cents( $price ) {
100
-		return round( $price * 100 );
99
+	public static function amount_to_cents($price) {
100
+		return round($price * 100);
101 101
 	}
102 102
 
103 103
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return float
109 109
 	 */
110
-	public static function cents_to_amount( $cents ) {
110
+	public static function cents_to_amount($cents) {
111 111
 		return $cents / 100;
112 112
 	}
113 113
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @return int
122 122
 	 */
123
-	public static function boolean_to_numeric( $boolean ) {
123
+	public static function boolean_to_numeric($boolean) {
124 124
 		return $boolean ? 1 : 0;
125 125
 	}
126 126
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return int
135 135
 	 */
136
-	public static function boolean_to_string( $boolean ) {
136
+	public static function boolean_to_string($boolean) {
137 137
 		return $boolean ? 'true' : 'false';
138 138
 	}
139 139
 
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 	 * @param DateTime $date   The date to format.
145 145
 	 * @return string
146 146
 	 */
147
-	public static function format_date( $format, DateTime $date = null ) {
147
+	public static function format_date($format, DateTime $date = null) {
148 148
 		$result = null;
149 149
 
150
-		if ( null !== $date ) {
151
-			$result = $date->format( $format );
150
+		if (null !== $date) {
151
+			$result = $date->format($format);
152 152
 		}
153 153
 
154 154
 		return $result;
@@ -165,18 +165,18 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return string
167 167
 	 */
168
-	public static function format_price( $amount, $currency = null ) {
169
-		$float = filter_var( $amount, FILTER_VALIDATE_FLOAT );
168
+	public static function format_price($amount, $currency = null) {
169
+		$float = filter_var($amount, FILTER_VALIDATE_FLOAT);
170 170
 
171
-		if ( false === $float ) {
171
+		if (false === $float) {
172 172
 			return;
173 173
 		}
174 174
 
175
-		$currency = ( null === $currency ) ? 'EUR' : $currency;
175
+		$currency = (null === $currency) ? 'EUR' : $currency;
176 176
 
177 177
 		$currency_symbol = $currency;
178 178
 
179
-		switch ( $currency ) {
179
+		switch ($currency) {
180 180
 			case 'EUR':
181 181
 				$currency_symbol = '€';
182 182
 				break;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		// @see https://en.wikipedia.org/wiki/Non-breaking_space#Keyboard_entry_methods
189 189
 		$non_breaking_space = ' ';
190 190
 
191
-		return '' . $currency_symbol . $non_breaking_space . number_format_i18n( $float, 2 );
191
+		return '' . $currency_symbol . $non_breaking_space . number_format_i18n($float, 2);
192 192
 	}
193 193
 
194 194
 	/**
@@ -199,24 +199,24 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return string
201 201
 	 */
202
-	public static function format_interval( $interval, $period ) {
203
-		switch ( $period ) {
202
+	public static function format_interval($interval, $period) {
203
+		switch ($period) {
204 204
 			case 'D':
205 205
 			case 'day':
206 206
 			case 'days':
207
-				return sprintf( _n( 'Every %s day', 'Every %s days', $interval, 'pronamic_ideal' ), $interval );
207
+				return sprintf(_n('Every %s day', 'Every %s days', $interval, 'pronamic_ideal'), $interval);
208 208
 			case 'W':
209 209
 			case 'week':
210 210
 			case 'weeks':
211
-				return sprintf( _n( 'Every %s week', 'Every %s weeks', $interval, 'pronamic_ideal' ), $interval );
211
+				return sprintf(_n('Every %s week', 'Every %s weeks', $interval, 'pronamic_ideal'), $interval);
212 212
 			case 'M':
213 213
 			case 'month':
214 214
 			case 'months':
215
-				return sprintf( _n( 'Every %s month', 'Every %s months', $interval, 'pronamic_ideal' ), $interval );
215
+				return sprintf(_n('Every %s month', 'Every %s months', $interval, 'pronamic_ideal'), $interval);
216 216
 			case 'Y':
217 217
 			case 'year':
218 218
 			case 'years':
219
-				return sprintf( _n( 'Every %s year', 'Every %s years', $interval, 'pronamic_ideal' ), $interval );
219
+				return sprintf(_n('Every %s year', 'Every %s years', $interval, 'pronamic_ideal'), $interval);
220 220
 		}
221 221
 	}
222 222
 
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @return string
229 229
 	 */
230
-	public static function to_interval_name( $interval_period ) {
231
-		switch ( $interval_period ) {
230
+	public static function to_interval_name($interval_period) {
231
+		switch ($interval_period) {
232 232
 			case 'D':
233 233
 				return 'days';
234 234
 			case 'W':
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @return string
251 251
 	 */
252
-	public static function format_frequency( $frequency ) {
253
-		if ( '' === $frequency ) {
254
-			return _x( 'Unlimited', 'Recurring payment', 'pronamic_ideal' );
252
+	public static function format_frequency($frequency) {
253
+		if ('' === $frequency) {
254
+			return _x('Unlimited', 'Recurring payment', 'pronamic_ideal');
255 255
 		}
256 256
 
257
-		return sprintf( _n( '%s time', '%s times', $frequency, 'pronamic_ideal' ), $frequency );
257
+		return sprintf(_n('%s time', '%s times', $frequency, 'pronamic_ideal'), $frequency);
258 258
 	}
259 259
 
260 260
 	/**
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @return string
267 267
 	 */
268
-	public static function build_url( $url, array $parameters ) {
269
-		return $url . '?' . _http_build_query( $parameters, null, '&' );
268
+	public static function build_url($url, array $parameters) {
269
+		return $url . '?' . _http_build_query($parameters, null, '&');
270 270
 	}
271 271
 
272 272
 	/**
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @return string
278 278
 	 */
279
-	public static function html_hidden_fields( $data ) {
279
+	public static function html_hidden_fields($data) {
280 280
 		$html = '';
281 281
 
282
-		foreach ( $data as $name => $value ) {
283
-			$html .= sprintf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $name ), esc_attr( $value ) );
282
+		foreach ($data as $name => $value) {
283
+			$html .= sprintf('<input type="hidden" name="%s" value="%s" />', esc_attr($name), esc_attr($value));
284 284
 		}
285 285
 
286 286
 		return $html;
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return string
295 295
 	 */
296
-	public static function array_to_html_attributes( array $attributes ) {
296
+	public static function array_to_html_attributes(array $attributes) {
297 297
 		$html = '';
298 298
 
299
-		foreach ( $attributes as $key => $value ) {
300
-			$html .= sprintf( '%s="%s"', $key, esc_attr( $value ) );
299
+		foreach ($attributes as $key => $value) {
300
+			$html .= sprintf('%s="%s"', $key, esc_attr($value));
301 301
 		}
302 302
 
303
-		$html = trim( $html );
303
+		$html = trim($html);
304 304
 
305 305
 		return $html;
306 306
 	}
@@ -313,22 +313,22 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @return string
315 315
 	 */
316
-	public static function select_options_grouped( $groups, $selected_value = null ) {
316
+	public static function select_options_grouped($groups, $selected_value = null) {
317 317
 		$html = '';
318 318
 
319
-		if ( is_array( $groups ) ) {
320
-			foreach ( $groups as $group ) {
321
-				$optgroup = isset( $group['name'] ) && ! empty( $group['name'] );
319
+		if (is_array($groups)) {
320
+			foreach ($groups as $group) {
321
+				$optgroup = isset($group['name']) && ! empty($group['name']);
322 322
 
323
-				if ( $optgroup ) {
323
+				if ($optgroup) {
324 324
 					$html .= '<optgroup label="' . $group['name'] . '">';
325 325
 				}
326 326
 
327
-				foreach ( $group['options'] as $value => $label ) {
328
-					$html .= '<option value="' . $value . '" ' . selected( $selected_value, $value, false ) . '>' . $label . '</option>';
327
+				foreach ($group['options'] as $value => $label) {
328
+					$html .= '<option value="' . $value . '" ' . selected($selected_value, $value, false) . '>' . $label . '</option>';
329 329
 				}
330 330
 
331
-				if ( $optgroup ) {
331
+				if ($optgroup) {
332 332
 					$html .= '</optgroup>';
333 333
 				}
334 334
 			}
Please login to merge, or discard this patch.
classes/GatewayPostType.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 		 *
38 38
 		 * @see https://github.com/WordPress/WordPress/blob/4.0/wp-includes/post.php#L167
39 39
 		 */
40
-		add_action( 'init', array( $this, 'register_gateway_post_type' ), 0 ); // Highest priority.
40
+		add_action('init', array($this, 'register_gateway_post_type'), 0); // Highest priority.
41 41
 
42
-		add_action( 'save_post_' . self::POST_TYPE, array( $this, 'maybe_set_default_gateway' ) );
42
+		add_action('save_post_' . self::POST_TYPE, array($this, 'maybe_set_default_gateway'));
43 43
 	}
44 44
 
45 45
 	/**
@@ -50,23 +50,23 @@  discard block
 block discarded – undo
50 50
 	public function register_gateway_post_type() {
51 51
 		register_post_type(
52 52
 			'pronamic_gateway', array(
53
-				'label'              => __( 'Payment Gateway Configurations', 'pronamic_ideal' ),
53
+				'label'              => __('Payment Gateway Configurations', 'pronamic_ideal'),
54 54
 				'labels'             => array(
55
-					'name'                  => __( 'Payment Gateway Configurations', 'pronamic_ideal' ),
56
-					'singular_name'         => __( 'Payment Gateway Configuration', 'pronamic_ideal' ),
57
-					'add_new'               => __( 'Add New', 'pronamic_ideal' ),
58
-					'add_new_item'          => __( 'Add New Payment Gateway Configuration', 'pronamic_ideal' ),
59
-					'edit_item'             => __( 'Edit Payment Gateway Configuration', 'pronamic_ideal' ),
60
-					'new_item'              => __( 'New Payment Gateway Configuration', 'pronamic_ideal' ),
61
-					'all_items'             => __( 'All Payment Gateway Configurations', 'pronamic_ideal' ),
62
-					'view_item'             => __( 'View Payment Gateway Configuration', 'pronamic_ideal' ),
63
-					'search_items'          => __( 'Search Payment Gateway Configurations', 'pronamic_ideal' ),
64
-					'not_found'             => __( 'No payment gateway configurations found.', 'pronamic_ideal' ),
65
-					'not_found_in_trash'    => __( 'No payment gateway configurations found in Trash.', 'pronamic_ideal' ),
66
-					'menu_name'             => __( 'Configurations', 'pronamic_ideal' ),
67
-					'filter_items_list'     => __( 'Filter payment gateway configurations list', 'pronamic_ideal' ),
68
-					'items_list_navigation' => __( 'Payment gateway configurations list navigation', 'pronamic_ideal' ),
69
-					'items_list'            => __( 'Payment gateway configurations list', 'pronamic_ideal' ),
55
+					'name'                  => __('Payment Gateway Configurations', 'pronamic_ideal'),
56
+					'singular_name'         => __('Payment Gateway Configuration', 'pronamic_ideal'),
57
+					'add_new'               => __('Add New', 'pronamic_ideal'),
58
+					'add_new_item'          => __('Add New Payment Gateway Configuration', 'pronamic_ideal'),
59
+					'edit_item'             => __('Edit Payment Gateway Configuration', 'pronamic_ideal'),
60
+					'new_item'              => __('New Payment Gateway Configuration', 'pronamic_ideal'),
61
+					'all_items'             => __('All Payment Gateway Configurations', 'pronamic_ideal'),
62
+					'view_item'             => __('View Payment Gateway Configuration', 'pronamic_ideal'),
63
+					'search_items'          => __('Search Payment Gateway Configurations', 'pronamic_ideal'),
64
+					'not_found'             => __('No payment gateway configurations found.', 'pronamic_ideal'),
65
+					'not_found_in_trash'    => __('No payment gateway configurations found in Trash.', 'pronamic_ideal'),
66
+					'menu_name'             => __('Configurations', 'pronamic_ideal'),
67
+					'filter_items_list'     => __('Filter payment gateway configurations list', 'pronamic_ideal'),
68
+					'items_list_navigation' => __('Payment gateway configurations list navigation', 'pronamic_ideal'),
69
+					'items_list'            => __('Payment gateway configurations list', 'pronamic_ideal'),
70 70
 				),
71 71
 				'public'             => false,
72 72
 				'publicly_queryable' => false,
@@ -93,21 +93,21 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @param int $post_id Post ID.
95 95
 	 */
96
-	public function maybe_set_default_gateway( $post_id ) {
96
+	public function maybe_set_default_gateway($post_id) {
97 97
 		// Don't set the default gateway if the post is not published.
98
-		if ( 'publish' !== get_post_status( $post_id ) ) {
98
+		if ('publish' !== get_post_status($post_id)) {
99 99
 			return;
100 100
 		}
101 101
 
102 102
 		// Don't set the default gateway if there is already a published gateway set.
103
-		$config_id = get_option( 'pronamic_pay_config_id' );
103
+		$config_id = get_option('pronamic_pay_config_id');
104 104
 
105
-		if ( ! empty( $config_id ) && 'publish' === get_post_status( $config_id ) ) {
105
+		if ( ! empty($config_id) && 'publish' === get_post_status($config_id)) {
106 106
 			return;
107 107
 		}
108 108
 
109 109
 		// Update.
110
-		update_option( 'pronamic_pay_config_id', $post_id );
110
+		update_option('pronamic_pay_config_id', $post_id);
111 111
 	}
112 112
 
113 113
 	/**
Please login to merge, or discard this patch.
admin/meta-box-subscription-log.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,39 +19,39 @@
 block discarded – undo
19 19
 <table class="widefat fixed comments comments-box" cellspacing="0">
20 20
 	<tbody>
21 21
 
22
-		<?php if ( empty( $comments ) ) : ?>
22
+		<?php if (empty($comments)) : ?>
23 23
 
24 24
 			<tr class="no-items">
25 25
 				<td>
26
-					<?php esc_html_e( 'No logs found.', 'pronamic_ideal' ); ?>
26
+					<?php esc_html_e('No logs found.', 'pronamic_ideal'); ?>
27 27
 				</td>
28 28
 			</tr>
29 29
 
30 30
 		<?php else : ?>
31 31
 
32
-			<?php foreach ( $comments as $comment ) : ?>
32
+			<?php foreach ($comments as $comment) : ?>
33 33
 
34 34
 				<?php
35 35
 
36 36
 				$html_id    = 'comment-' . $comment->comment_ID;
37
-				$html_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) );
37
+				$html_class = join(' ', get_comment_class(wp_get_comment_status($comment->comment_ID)));
38 38
 
39 39
 				?>
40
-				<tr id="<?php esc_attr( $html_id ); ?>" class="<?php esc_attr( $html_class ); ?>">
40
+				<tr id="<?php esc_attr($html_id); ?>" class="<?php esc_attr($html_class); ?>">
41 41
 					<td>
42 42
 						<?php
43 43
 
44 44
 						printf(
45
-							esc_html__( '%1$s at %2$s', 'pronamic_ideal' ),
45
+							esc_html__('%1$s at %2$s', 'pronamic_ideal'),
46 46
 							/* translators: comment date format. See http://php.net/date */
47
-							esc_html( get_comment_date( __( 'Y/m/d', 'pronamic_ideal' ), $comment->comment_ID ) ),
48
-							esc_html( get_comment_date( get_option( 'time_format' ), $comment->comment_ID ) )
47
+							esc_html(get_comment_date(__('Y/m/d', 'pronamic_ideal'), $comment->comment_ID)),
48
+							esc_html(get_comment_date(get_option('time_format'), $comment->comment_ID))
49 49
 						);
50 50
 
51 51
 						?>
52 52
 					</td>
53 53
 					<td>
54
-						<?php comment_text( $comment ); ?>
54
+						<?php comment_text($comment); ?>
55 55
 					</td>
56 56
 				</tr>
57 57
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,13 +27,15 @@
 block discarded – undo
27 27
 				</td>
28 28
 			</tr>
29 29
 
30
-		<?php else : ?>
30
+		<?php else {
31
+	: ?>
31 32
 
32 33
 			<?php foreach ( $comments as $comment ) : ?>
33 34
 
34 35
 				<?php
35 36
 
36 37
 				$html_id    = 'comment-' . $comment->comment_ID;
38
+}
37 39
 				$html_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) );
38 40
 
39 41
 				?>
Please login to merge, or discard this patch.