@@ -29,25 +29,25 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param Plugin $plugin Plugin. |
31 | 31 | */ |
32 | - public function __construct( Plugin $plugin ) { |
|
32 | + public function __construct(Plugin $plugin) { |
|
33 | 33 | $this->plugin = $plugin; |
34 | 34 | |
35 | 35 | // Actions. |
36 | - add_action( 'admin_init', array( $this, 'admin_init' ) ); |
|
36 | + add_action('admin_init', array($this, 'admin_init')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Admin initialize. |
41 | 41 | */ |
42 | 42 | public function admin_init() { |
43 | - if ( filter_has_var( INPUT_GET, 'pronamic_pay_ignore_tour' ) && wp_verify_nonce( filter_input( INPUT_GET, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING ), 'pronamic_pay_ignore_tour' ) ) { |
|
44 | - $ignore = filter_input( INPUT_GET, 'pronamic_pay_ignore_tour', FILTER_VALIDATE_BOOLEAN ); |
|
43 | + if (filter_has_var(INPUT_GET, 'pronamic_pay_ignore_tour') && wp_verify_nonce(filter_input(INPUT_GET, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING), 'pronamic_pay_ignore_tour')) { |
|
44 | + $ignore = filter_input(INPUT_GET, 'pronamic_pay_ignore_tour', FILTER_VALIDATE_BOOLEAN); |
|
45 | 45 | |
46 | - update_user_meta( get_current_user_id(), 'pronamic_pay_ignore_tour', $ignore ); |
|
46 | + update_user_meta(get_current_user_id(), 'pronamic_pay_ignore_tour', $ignore); |
|
47 | 47 | } |
48 | 48 | |
49 | - if ( ! get_user_meta( get_current_user_id(), 'pronamic_pay_ignore_tour', true ) ) { |
|
50 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
49 | + if ( ! get_user_meta(get_current_user_id(), 'pronamic_pay_ignore_tour', true)) { |
|
50 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | * Admin enqueue scripts. |
56 | 56 | */ |
57 | 57 | public function admin_enqueue_scripts() { |
58 | - $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
58 | + $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
59 | 59 | |
60 | 60 | // Pointers. |
61 | 61 | wp_register_style( |
62 | 62 | 'proanmic-pay-admin-tour', |
63 | - plugins_url( 'css/admin-tour' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
63 | + plugins_url('css/admin-tour' . $min . '.css', \Pronamic\WordPress\Pay\Plugin::$file), |
|
64 | 64 | array( |
65 | 65 | 'wp-pointer', |
66 | 66 | ), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | wp_register_script( |
71 | 71 | 'proanmic-pay-admin-tour', |
72 | - plugins_url( 'js/admin-tour' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file ), |
|
72 | + plugins_url('js/admin-tour' . $min . '.js', \Pronamic\WordPress\Pay\Plugin::$file), |
|
73 | 73 | array( |
74 | 74 | 'jquery', |
75 | 75 | 'wp-pointer', |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | ); |
88 | 88 | |
89 | 89 | // Enqueue. |
90 | - wp_enqueue_style( 'proanmic-pay-admin-tour' ); |
|
91 | - wp_enqueue_script( 'proanmic-pay-admin-tour' ); |
|
90 | + wp_enqueue_style('proanmic-pay-admin-tour'); |
|
91 | + wp_enqueue_script('proanmic-pay-admin-tour'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | * @param string $file File. |
98 | 98 | * @return string |
99 | 99 | */ |
100 | - private function get_content( $file ) { |
|
100 | + private function get_content($file) { |
|
101 | 101 | $content = ''; |
102 | 102 | |
103 | - $path = plugin_dir_path( \Pronamic\WordPress\Pay\Plugin::$file ) . 'admin/' . $file . '.php'; |
|
103 | + $path = plugin_dir_path(\Pronamic\WordPress\Pay\Plugin::$file) . 'admin/' . $file . '.php'; |
|
104 | 104 | |
105 | - if ( is_readable( $path ) ) { |
|
105 | + if (is_readable($path)) { |
|
106 | 106 | ob_start(); |
107 | 107 | |
108 | 108 | include $path; |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | private function get_pointers() { |
124 | 124 | $pointers = array(); |
125 | 125 | |
126 | - $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING ); |
|
126 | + $page = filter_input(INPUT_GET, 'page', FILTER_SANITIZE_STRING); |
|
127 | 127 | $screen = get_current_screen(); |
128 | 128 | |
129 | - switch ( $screen->id ) { |
|
129 | + switch ($screen->id) { |
|
130 | 130 | case 'toplevel_page_pronamic_ideal': |
131 | 131 | $pointers = array( |
132 | 132 | array( |
133 | 133 | // @see https://github.com/WordPress/WordPress/blob/4.7/wp-admin/edit.php#L321 |
134 | 134 | 'selector' => '.wrap .wp-header-end', |
135 | 135 | 'options' => (object) array( |
136 | - 'content' => $this->get_content( 'pointer-dashboard' ), |
|
136 | + 'content' => $this->get_content('pointer-dashboard'), |
|
137 | 137 | 'position' => (object) array( |
138 | 138 | 'edge' => 'top', |
139 | - 'align' => ( is_rtl() ) ? 'left' : 'right', |
|
139 | + 'align' => (is_rtl()) ? 'left' : 'right', |
|
140 | 140 | ), |
141 | 141 | 'pointerWidth' => 450, |
142 | 142 | ), |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | array( |
150 | 150 | 'selector' => '.wrap .wp-header-end', |
151 | 151 | 'options' => (object) array( |
152 | - 'content' => $this->get_content( 'pointer-payments' ), |
|
152 | + 'content' => $this->get_content('pointer-payments'), |
|
153 | 153 | 'position' => (object) array( |
154 | 154 | 'edge' => 'top', |
155 | - 'align' => ( is_rtl() ) ? 'left' : 'right', |
|
155 | + 'align' => (is_rtl()) ? 'left' : 'right', |
|
156 | 156 | ), |
157 | 157 | 'pointerWidth' => 450, |
158 | 158 | ), |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | array( |
166 | 166 | 'selector' => '.wrap .wp-header-end', |
167 | 167 | 'options' => (object) array( |
168 | - 'content' => $this->get_content( 'pointer-gateways' ), |
|
168 | + 'content' => $this->get_content('pointer-gateways'), |
|
169 | 169 | 'position' => (object) array( |
170 | 170 | 'edge' => 'top', |
171 | - 'align' => ( is_rtl() ) ? 'left' : 'right', |
|
171 | + 'align' => (is_rtl()) ? 'left' : 'right', |
|
172 | 172 | ), |
173 | 173 | 'pointerWidth' => 450, |
174 | 174 | ), |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | array( |
182 | 182 | 'selector' => '.wrap .wp-header-end', |
183 | 183 | 'options' => (object) array( |
184 | - 'content' => $this->get_content( 'pointer-forms' ), |
|
184 | + 'content' => $this->get_content('pointer-forms'), |
|
185 | 185 | 'position' => (object) array( |
186 | 186 | 'edge' => 'top', |
187 | - 'align' => ( is_rtl() ) ? 'left' : 'right', |
|
187 | + 'align' => (is_rtl()) ? 'left' : 'right', |
|
188 | 188 | ), |
189 | 189 | 'pointerWidth' => 450, |
190 | 190 | ), |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | break; |
195 | 195 | } |
196 | 196 | |
197 | - switch ( $page ) { |
|
197 | + switch ($page) { |
|
198 | 198 | case 'pronamic_pay_settings': |
199 | 199 | $pointers = array( |
200 | 200 | array( |
201 | 201 | 'selector' => '.wrap .wp-header-end', |
202 | 202 | 'options' => (object) array( |
203 | - 'content' => $this->get_content( 'pointer-settings' ), |
|
203 | + 'content' => $this->get_content('pointer-settings'), |
|
204 | 204 | 'position' => (object) array( |
205 | 205 | 'edge' => 'top', |
206 | - 'align' => ( is_rtl() ) ? 'left' : 'right', |
|
206 | + 'align' => (is_rtl()) ? 'left' : 'right', |
|
207 | 207 | ), |
208 | 208 | 'pointerWidth' => 450, |
209 | 209 | ), |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | array( |
217 | 217 | 'selector' => '.wrap .wp-header-end', |
218 | 218 | 'options' => (object) array( |
219 | - 'content' => $this->get_content( 'pointer-tools' ), |
|
219 | + 'content' => $this->get_content('pointer-tools'), |
|
220 | 220 | 'position' => (object) array( |
221 | 221 | 'edge' => 'top', |
222 | - 'align' => ( is_rtl() ) ? 'left' : 'right', |
|
222 | + 'align' => (is_rtl()) ? 'left' : 'right', |
|
223 | 223 | ), |
224 | 224 | 'pointerWidth' => 450, |
225 | 225 | ), |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | array( |
233 | 233 | 'selector' => '.wrap .wp-header-end', |
234 | 234 | 'options' => (object) array( |
235 | - 'content' => $this->get_content( 'pointer-reports' ), |
|
235 | + 'content' => $this->get_content('pointer-reports'), |
|
236 | 236 | 'position' => (object) array( |
237 | 237 | 'edge' => 'top', |
238 | - 'align' => ( is_rtl() ) ? 'left' : 'right', |
|
238 | + 'align' => (is_rtl()) ? 'left' : 'right', |
|
239 | 239 | ), |
240 | 240 | 'pointerWidth' => 450, |
241 | 241 | ), |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | break; |
246 | 246 | } |
247 | 247 | |
248 | - if ( empty( $pointers ) ) { |
|
248 | + if (empty($pointers)) { |
|
249 | 249 | $pointers = array( |
250 | 250 | array( |
251 | 251 | 'selector' => 'li.toplevel_page_pronamic_ideal', |
252 | 252 | 'options' => (object) array( |
253 | - 'content' => $this->get_content( 'pointer-start' ), |
|
253 | + 'content' => $this->get_content('pointer-start'), |
|
254 | 254 | 'position' => (object) array( |
255 | 255 | 'edge' => 'left', |
256 | 256 | 'align' => 'center', |