1 | <?php |
||
2 | /** |
||
3 | * Integration |
||
4 | * |
||
5 | * @author Pronamic <[email protected]> |
||
6 | * @copyright 2005-2018 Pronamic |
||
7 | * @license GPL-3.0-or-later |
||
8 | * @package Pronamic\WordPress\Pay\Gateways\OmniKassa2 |
||
9 | */ |
||
10 | |||
11 | namespace Pronamic\WordPress\Pay\Gateways\OmniKassa2; |
||
12 | |||
13 | use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration; |
||
0 ignored issues
–
show
|
|||
14 | |||
15 | /** |
||
16 | * Integration |
||
17 | * |
||
18 | * @author Remco Tolsma |
||
19 | * @version 2.1.0 |
||
20 | * @since 1.0.0 |
||
21 | */ |
||
22 | class Integration extends AbstractIntegration { |
||
23 | /** |
||
24 | * Construct and initialize integration. |
||
25 | */ |
||
26 | public function __construct() { |
||
27 | $this->id = 'rabobank-omnikassa-2'; |
||
0 ignored issues
–
show
|
|||
28 | $this->name = 'Rabobank - OmniKassa 2.0'; |
||
0 ignored issues
–
show
|
|||
29 | $this->product_url = 'https://www.rabobank.nl/bedrijven/betalen/geld-ontvangen/rabo-omnikassa/'; |
||
0 ignored issues
–
show
|
|||
30 | $this->dashboard_url = 'https://bankieren.rabobank.nl/omnikassa-dashboard/'; |
||
0 ignored issues
–
show
|
|||
31 | $this->provider = 'rabobank'; |
||
0 ignored issues
–
show
|
|||
32 | |||
33 | /** |
||
34 | * Webhook listener function. |
||
35 | * |
||
36 | * @var callable $webhook_listener_function |
||
37 | */ |
||
38 | $webhook_listener_function = array( __NAMESPACE__ . '\WebhookListener', 'listen' ); |
||
39 | |||
40 | if ( ! has_action( 'wp_loaded', $webhook_listener_function ) ) { |
||
41 | add_action( 'wp_loaded', $webhook_listener_function ); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Save post. |
||
46 | * |
||
47 | * @link https://github.com/WordPress/WordPress/blob/5.0/wp-includes/post.php#L3724-L3736 |
||
48 | * |
||
49 | * @var callable $delete_access_token_meta_function |
||
50 | */ |
||
51 | $delete_access_token_meta_function = array( __NAMESPACE__ . '\ConfigFactory', 'delete_access_token_meta' ); |
||
52 | |||
53 | if ( ! has_action( 'save_post_pronamic_gateway', $delete_access_token_meta_function ) ) { |
||
54 | add_action( 'save_post_pronamic_gateway', $delete_access_token_meta_function ); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Admin notices. |
||
59 | * |
||
60 | * @link https://github.com/WordPress/WordPress/blob/5.0/wp-admin/admin-header.php#L259-L264 |
||
61 | * |
||
62 | * @var callable $admin_notices_function |
||
63 | */ |
||
64 | $admin_notices_function = array( $this, 'admin_notice_tld_test' ); |
||
65 | |||
66 | if ( ! has_action( 'admin_notices', $admin_notices_function ) ) { |
||
67 | add_action( 'admin_notices', $admin_notices_function ); |
||
68 | } |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * Admin notice TLD .test. |
||
73 | * |
||
74 | * @link https://github.com/WordPress/WordPress/blob/5.0/wp-admin/admin-header.php#L259-L264 |
||
75 | * @link https://developer.wordpress.org/reference/hooks/admin_notices/ |
||
76 | * @link https://developer.wordpress.org/reference/functions/get_current_screen/ |
||
77 | */ |
||
78 | public function admin_notice_tld_test() { |
||
79 | if ( has_filter( 'pronamic_pay_omnikassa_2_merchant_return_url' ) ) { |
||
80 | return; |
||
81 | } |
||
82 | |||
83 | $screen = get_current_screen(); |
||
1 ignored issue
–
show
Are you sure the assignment to
$screen is correct as get_current_screen() seems to always return null .
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
84 | |||
85 | if ( null === $screen ) { |
||
86 | return; |
||
87 | } |
||
88 | |||
89 | if ( 'pronamic_gateway' !== $screen->id ) { |
||
90 | return; |
||
91 | } |
||
92 | |||
93 | $host = wp_parse_url( home_url( '/' ), PHP_URL_HOST ); |
||
94 | |||
95 | if ( is_array( $host ) ) { |
||
96 | return; |
||
97 | } |
||
98 | |||
99 | if ( '.test' !== substr( $host, -5 ) ) { |
||
100 | return; |
||
101 | } |
||
102 | |||
103 | $post_id = get_the_ID(); |
||
104 | |||
105 | if ( empty( $post_id ) ) { |
||
106 | return; |
||
107 | } |
||
108 | |||
109 | $gateway_id = get_post_meta( $post_id, '_pronamic_gateway_id', true ); |
||
110 | |||
111 | if ( 'rabobank-omnikassa-2' !== $gateway_id ) { |
||
112 | return; |
||
113 | } |
||
114 | |||
115 | $class = 'notice notice-error'; |
||
116 | $message = sprintf( |
||
117 | /* translators: 1: Pronamic Pay, 2: Documentation link, 3: <code>.test</code> */ |
||
118 | __( '%1$s — <a href="%2$s">OmniKassa 2 does not accept payments from %3$s environments</a>.', 'pronamic_ideal' ), |
||
119 | sprintf( |
||
120 | '<strong>%s</strong>', |
||
121 | __( 'Pronamic Pay', 'pronamic_ideal' ) |
||
122 | ), |
||
123 | 'https://github.com/wp-pay-gateways/omnikassa-2/tree/develop/documentation#merchantreturnurl-is-not-a-valid-web-address', |
||
124 | '<code>.test</code>' |
||
125 | ); |
||
126 | |||
127 | printf( |
||
128 | '<div class="%1$s"><p>%2$s</p></div>', |
||
129 | esc_attr( $class ), |
||
130 | wp_kses( |
||
131 | $message, |
||
132 | array( |
||
133 | 'a' => array( |
||
134 | 'href' => true, |
||
135 | ), |
||
136 | 'code' => array(), |
||
137 | 'strong' => array(), |
||
138 | ) |
||
139 | ) |
||
140 | ); |
||
141 | } |
||
142 | |||
143 | /** |
||
144 | * Get config factory class. |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | public function get_config_factory_class() { |
||
149 | return __NAMESPACE__ . '\ConfigFactory'; |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * Get settings class. |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | public function get_settings_class() { |
||
158 | return __NAMESPACE__ . '\Settings'; |
||
159 | } |
||
160 | |||
161 | /** |
||
162 | * Get required settings for this integration. |
||
163 | * |
||
164 | * @link https://github.com/wp-premium/gravityforms/blob/1.9.16/includes/fields/class-gf-field-multiselect.php#L21-L42 |
||
165 | * @since 1.1.6 |
||
166 | * @return array |
||
167 | */ |
||
168 | public function get_settings() { |
||
169 | $settings = parent::get_settings(); |
||
170 | |||
171 | $settings[] = 'omnikassa-2'; |
||
172 | |||
173 | return $settings; |
||
174 | } |
||
175 | } |
||
176 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths