@@ -32,11 +32,11 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -40,12 +40,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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( |
@@ -33,22 +33,22 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -30,23 +30,23 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -37,9 +37,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -19,39 +19,39 @@ |
||
| 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 | |
@@ -27,13 +27,15 @@ |
||
| 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 | ?> |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | public function test_to_string_boolean() { |
| 19 | 19 | $boolean = false; |
| 20 | 20 | |
| 21 | - $result = Util::boolean_to_string( $boolean ); |
|
| 21 | + $result = Util::boolean_to_string($boolean); |
|
| 22 | 22 | |
| 23 | - $this->assertEquals( 'false', $result ); |
|
| 23 | + $this->assertEquals('false', $result); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -28,21 +28,21 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @dataProvider format_price_matrix_provider |
| 30 | 30 | */ |
| 31 | - public function test_format_price( $amount, $currency, $expected ) { |
|
| 32 | - $formatted = Util::format_price( $amount ); |
|
| 31 | + public function test_format_price($amount, $currency, $expected) { |
|
| 32 | + $formatted = Util::format_price($amount); |
|
| 33 | 33 | |
| 34 | - $this->assertEquals( $expected, $formatted ); |
|
| 34 | + $this->assertEquals($expected, $formatted); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function format_price_matrix_provider() { |
| 38 | 38 | return array( |
| 39 | - array( '', null, null ), |
|
| 40 | - array( false, null, null ), |
|
| 41 | - array( array(), null, null ), |
|
| 42 | - array( new stdClass(), null, null ), |
|
| 43 | - array( 0, null, '€ 0.00' ), |
|
| 44 | - array( 123, null, '€ 123.00' ), |
|
| 45 | - array( 123456, null, '€ 123,456.00' ), |
|
| 39 | + array('', null, null), |
|
| 40 | + array(false, null, null), |
|
| 41 | + array(array(), null, null), |
|
| 42 | + array(new stdClass(), null, null), |
|
| 43 | + array(0, null, '€ 0.00'), |
|
| 44 | + array(123, null, '€ 123.00'), |
|
| 45 | + array(123456, null, '€ 123,456.00'), |
|
| 46 | 46 | ); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$_tests_dir = getenv( 'WP_TESTS_DIR' ); |
|
| 4 | -if ( ! $_tests_dir ) { |
|
| 3 | +$_tests_dir = getenv('WP_TESTS_DIR'); |
|
| 4 | +if ( ! $_tests_dir) { |
|
| 5 | 5 | $_tests_dir = '/tmp/wordpress-tests-lib'; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | require_once $_tests_dir . '/includes/functions.php'; |
| 9 | 9 | |
| 10 | 10 | function _manually_load_plugin() { |
| 11 | - require dirname( __FILE__ ) . '/../pronamic-ideal.php'; |
|
| 11 | + require dirname(__FILE__) . '/../pronamic-ideal.php'; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); |
|
| 14 | +tests_add_filter('muplugins_loaded', '_manually_load_plugin'); |
|
| 15 | 15 | |
| 16 | 16 | require $_tests_dir . '/includes/bootstrap.php'; |
@@ -60,13 +60,13 @@ discard block |
||
| 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 ) ) { |
|
| 63 | + public static function instance($file = null) { |
|
| 64 | + if (is_null(self::$instance)) { |
|
| 65 | 65 | self::$instance = new self(); |
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 260 | 260 | * @param Payment $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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |