1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Jetpack's JITM class. |
4
|
|
|
* |
5
|
|
|
* @package automattic/jetpack-jitm |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Automattic\Jetpack\JITMS; |
9
|
|
|
|
10
|
|
|
use Automattic\Jetpack\Assets; |
11
|
|
|
use Automattic\Jetpack\Connection\Manager as Jetpack_Connection; |
12
|
|
|
use Automattic\Jetpack\Connection\Client; |
13
|
|
|
use Automattic\Jetpack\Assets\Logo as Jetpack_Logo; |
14
|
|
|
use Automattic\Jetpack\Partner; |
15
|
|
|
use Automattic\Jetpack\Tracking; |
16
|
|
|
use Automattic\Jetpack\Connection\Manager; |
17
|
|
|
use Automattic\Jetpack\JITMS\Post_Connection_JITM; |
18
|
|
|
use Automattic\Jetpack\JITMS\Pre_Connection_JITM; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Jetpack just in time messaging through out the admin |
22
|
|
|
* |
23
|
|
|
* @since 5.6.0 |
24
|
|
|
*/ |
25
|
|
|
class JITM { |
26
|
|
|
|
27
|
|
|
const PACKAGE_VERSION = '1.0'; // TODO: Keep in sync with version specified in composer.json. |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Tracking object. |
31
|
|
|
* |
32
|
|
|
* @var Automattic\Jetpack\Tracking |
33
|
|
|
* |
34
|
|
|
* @access private |
35
|
|
|
*/ |
36
|
|
|
public $tracking; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* The configuration method that is called from the jetpack-config package. |
40
|
|
|
*/ |
41
|
|
|
public static function configure() { |
42
|
|
|
$jitm = self::get_instance(); |
43
|
|
|
$jitm->register(); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Pre/Post Connection JITM factory metod |
48
|
|
|
* |
49
|
|
|
* @return Post_Connection_JITM|Pre_Connection_JITM JITM instance. |
50
|
|
|
*/ |
51
|
|
|
public static function get_instance() { |
52
|
|
|
if ( \Jetpack::is_active() ) { |
53
|
|
|
$jitm = new Post_Connection_JITM(); |
54
|
|
|
} else { |
55
|
|
|
$jitm = new Pre_Connection_JITM(); |
56
|
|
|
} |
57
|
|
|
return $jitm; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* JITM constructor. |
62
|
|
|
*/ |
63
|
|
|
public function __construct() { |
64
|
|
|
$this->tracking = new Tracking(); |
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Prepare actions according to screen and post type. |
69
|
|
|
* |
70
|
|
|
* @since 3.8.2 |
71
|
|
|
* |
72
|
|
|
* @uses Jetpack_Autoupdate::get_possible_failures() |
73
|
|
|
* |
74
|
|
|
* @param \WP_Screen $screen WP Core's screen object. |
75
|
|
|
*/ |
76
|
|
|
public function prepare_jitms( $screen ) { |
77
|
|
|
if ( ! in_array( |
78
|
|
|
$screen->id, |
79
|
|
|
array( |
80
|
|
|
'jetpack_page_stats', |
81
|
|
|
'jetpack_page_akismet-key-config', |
82
|
|
|
'admin_page_jetpack_modules', |
83
|
|
|
), |
84
|
|
|
true |
85
|
|
|
) ) { |
86
|
|
|
add_action( 'admin_enqueue_scripts', array( $this, 'jitm_enqueue_files' ) ); |
87
|
|
|
add_action( 'admin_notices', array( $this, 'ajax_message' ) ); |
88
|
|
|
add_action( 'edit_form_top', array( $this, 'ajax_message' ) ); |
89
|
|
|
|
90
|
|
|
// Not really a JITM. Don't know where else to put this :) . |
91
|
|
|
add_action( 'admin_notices', array( $this, 'delete_user_update_connection_owner_notice' ) ); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* A special filter for WooCommerce, to set a message based on local state. |
97
|
|
|
* |
98
|
|
|
* @param string $content The current message. |
99
|
|
|
* |
100
|
|
|
* @return array The new message. |
101
|
|
|
*/ |
102
|
|
|
public static function jitm_woocommerce_services_msg( $content ) { |
103
|
|
|
if ( ! function_exists( 'wc_get_base_location' ) ) { |
104
|
|
|
return $content; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
$base_location = wc_get_base_location(); |
108
|
|
|
|
109
|
|
|
switch ( $base_location['country'] ) { |
110
|
|
|
case 'US': |
111
|
|
|
$content->message = esc_html__( 'New free service: Show USPS shipping rates on your store! Added bonus: print shipping labels without leaving WooCommerce.', 'jetpack' ); |
112
|
|
|
break; |
113
|
|
|
case 'CA': |
114
|
|
|
$content->message = esc_html__( 'New free service: Show Canada Post shipping rates on your store!', 'jetpack' ); |
115
|
|
|
break; |
116
|
|
|
default: |
117
|
|
|
$content->message = ''; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
return $content; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* A special filter for WooCommerce Call To Action button |
125
|
|
|
* |
126
|
|
|
* @return string The new CTA |
127
|
|
|
*/ |
128
|
|
|
public static function jitm_jetpack_woo_services_install() { |
129
|
|
|
return wp_nonce_url( |
130
|
|
|
add_query_arg( |
131
|
|
|
array( |
132
|
|
|
'wc-services-action' => 'install', |
133
|
|
|
), |
134
|
|
|
admin_url( 'admin.php?page=wc-settings' ) |
135
|
|
|
), |
136
|
|
|
'wc-services-install' |
137
|
|
|
); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* A special filter for WooCommerce Call To Action button. |
142
|
|
|
* |
143
|
|
|
* @return string The new CTA |
144
|
|
|
*/ |
145
|
|
|
public static function jitm_jetpack_woo_services_activate() { |
146
|
|
|
return wp_nonce_url( |
147
|
|
|
add_query_arg( |
148
|
|
|
array( |
149
|
|
|
'wc-services-action' => 'activate', |
150
|
|
|
), |
151
|
|
|
admin_url( 'admin.php?page=wc-settings' ) |
152
|
|
|
), |
153
|
|
|
'wc-services-install' |
154
|
|
|
); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* This is an entire admin notice dedicated to messaging and handling of the case where a user is trying to delete |
159
|
|
|
* the connection owner. |
160
|
|
|
*/ |
161
|
|
|
public function delete_user_update_connection_owner_notice() { |
162
|
|
|
global $current_screen; |
163
|
|
|
|
164
|
|
|
/* |
165
|
|
|
* phpcs:disable WordPress.Security.NonceVerification.Recommended |
166
|
|
|
* |
167
|
|
|
* This function is firing within wp-admin and checks (below) if it is in the midst of a deletion on the users |
168
|
|
|
* page. Nonce will be already checked by WordPress, so we do not need to check ourselves. |
169
|
|
|
*/ |
170
|
|
|
|
171
|
|
|
if ( ! isset( $current_screen->base ) || 'users' !== $current_screen->base ) { |
172
|
|
|
return; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
if ( ! isset( $_REQUEST['action'] ) || 'delete' !== $_REQUEST['action'] ) { |
176
|
|
|
return; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
// Get connection owner or bail. |
180
|
|
|
$connection_manager = new Manager(); |
181
|
|
|
$connection_owner_id = $connection_manager->get_connection_owner_id(); |
182
|
|
|
if ( ! $connection_owner_id ) { |
183
|
|
|
return; |
184
|
|
|
} |
185
|
|
|
$connection_owner_userdata = get_userdata( $connection_owner_id ); |
186
|
|
|
|
187
|
|
|
// Bail if we're not trying to delete connection owner. |
188
|
|
|
$user_ids_to_delete = array(); |
189
|
|
View Code Duplication |
if ( isset( $_REQUEST['users'] ) ) { |
190
|
|
|
$user_ids_to_delete = array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['users'] ) ); |
191
|
|
|
} elseif ( isset( $_REQUEST['user'] ) ) { |
192
|
|
|
$user_ids_to_delete[] = sanitize_text_field( wp_unslash( $_REQUEST['user'] ) ); |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
// phpcs:enable |
196
|
|
|
$user_ids_to_delete = array_map( 'absint', $user_ids_to_delete ); |
197
|
|
|
$deleting_connection_owner = in_array( $connection_owner_id, (array) $user_ids_to_delete, true ); |
198
|
|
|
if ( ! $deleting_connection_owner ) { |
199
|
|
|
return; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
// Bail if they're trying to delete themselves to avoid confusion. |
203
|
|
|
if ( get_current_user_id() === $connection_owner_id ) { |
204
|
|
|
return; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
// Track it! |
208
|
|
|
if ( method_exists( $this->tracking, 'record_user_event' ) ) { |
209
|
|
|
$this->tracking->record_user_event( 'delete_connection_owner_notice_view' ); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
$connection_manager = new Manager(); |
213
|
|
|
$connected_admins = $connection_manager->get_connected_users( 'jetpack_disconnect' ); |
214
|
|
|
$user = is_a( $connection_owner_userdata, 'WP_User' ) ? esc_html( $connection_owner_userdata->data->user_login ) : ''; |
215
|
|
|
|
216
|
|
|
echo "<div class='notice notice-warning' id='jetpack-notice-switch-connection-owner'>"; |
217
|
|
|
echo '<h2>' . esc_html__( 'Important notice about your Jetpack connection:', 'jetpack' ) . '</h2>'; |
218
|
|
|
echo '<p>' . sprintf( |
219
|
|
|
/* translators: WordPress User, if available. */ |
220
|
|
|
esc_html__( 'Warning! You are about to delete the Jetpack connection owner (%s) for this site, which may cause some of your Jetpack features to stop working.', 'jetpack' ), |
221
|
|
|
esc_html( $user ) |
222
|
|
|
) . '</p>'; |
223
|
|
|
|
224
|
|
|
if ( ! empty( $connected_admins ) && count( $connected_admins ) > 1 ) { |
225
|
|
|
echo '<form id="jp-switch-connection-owner" action="" method="post">'; |
226
|
|
|
echo "<label for='owner'>" . esc_html__( 'You can choose to transfer connection ownership to one of these already-connected admins:', 'jetpack' ) . ' </label>'; |
227
|
|
|
|
228
|
|
|
$connected_admin_ids = array_map( |
229
|
|
|
function( $connected_admin ) { |
230
|
|
|
return $connected_admin->ID; |
231
|
|
|
}, |
232
|
|
|
$connected_admins |
233
|
|
|
); |
234
|
|
|
|
235
|
|
|
wp_dropdown_users( |
236
|
|
|
array( |
237
|
|
|
'name' => 'owner', |
238
|
|
|
'include' => array_diff( $connected_admin_ids, array( $connection_owner_id ) ), |
239
|
|
|
'show' => 'display_name_with_login', |
240
|
|
|
) |
241
|
|
|
); |
242
|
|
|
|
243
|
|
|
echo '<p>'; |
244
|
|
|
submit_button( esc_html__( 'Set new connection owner', 'jetpack' ), 'primary', 'jp-switch-connection-owner-submit', false ); |
245
|
|
|
echo '</p>'; |
246
|
|
|
|
247
|
|
|
echo "<div id='jp-switch-user-results'></div>"; |
248
|
|
|
echo '</form>'; |
249
|
|
|
?> |
250
|
|
|
<script type="text/javascript"> |
251
|
|
|
jQuery( document ).ready( function( $ ) { |
252
|
|
|
$( '#jp-switch-connection-owner' ).on( 'submit', function( e ) { |
253
|
|
|
var formData = $( this ).serialize(); |
254
|
|
|
var submitBtn = document.getElementById( 'jp-switch-connection-owner-submit' ); |
255
|
|
|
var results = document.getElementById( 'jp-switch-user-results' ); |
256
|
|
|
|
257
|
|
|
submitBtn.disabled = true; |
258
|
|
|
|
259
|
|
|
$.ajax( { |
260
|
|
|
type : "POST", |
261
|
|
|
url : "<?php echo esc_url( get_rest_url() . 'jetpack/v4/connection/owner' ); ?>", |
262
|
|
|
data : formData, |
263
|
|
|
headers : { |
264
|
|
|
'X-WP-Nonce': "<?php echo esc_js( wp_create_nonce( 'wp_rest' ) ); ?>", |
265
|
|
|
}, |
266
|
|
|
success: function() { |
267
|
|
|
results.innerHTML = "<?php esc_html_e( 'Success!', 'jetpack' ); ?>"; |
268
|
|
|
setTimeout( function() { |
269
|
|
|
$( '#jetpack-notice-switch-connection-owner' ).hide( 'slow' ); |
270
|
|
|
}, 1000 ); |
271
|
|
|
} |
272
|
|
|
} ).done( function() { |
273
|
|
|
submitBtn.disabled = false; |
274
|
|
|
} ); |
275
|
|
|
|
276
|
|
|
e.preventDefault(); |
277
|
|
|
return false; |
278
|
|
|
} ); |
279
|
|
|
} ); |
280
|
|
|
</script> |
281
|
|
|
<?php |
282
|
|
|
} else { |
283
|
|
|
echo '<p>' . esc_html__( 'Every Jetpack site needs at least one connected admin for the features to work properly. Please connect to your WordPress.com account via the button below. Once you connect, you may refresh this page to see an option to change the connection owner.', 'jetpack' ) . '</p>'; |
284
|
|
|
$connect_url = \Jetpack::init()->build_connect_url( false, false, 'delete_connection_owner_notice' ); |
285
|
|
|
echo "<a href='" . esc_url( $connect_url ) . "' target='_blank' rel='noopener noreferrer' class='button-primary'>" . esc_html__( 'Connect to WordPress.com', 'jetpack' ) . '</a>'; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
echo '<p>'; |
289
|
|
|
printf( |
290
|
|
|
wp_kses( |
291
|
|
|
/* translators: URL to Jetpack support doc regarding the primary user. */ |
292
|
|
|
__( "<a href='%s' target='_blank' rel='noopener noreferrer'>Learn more</a> about the connection owner and what will break if you do not have one.", 'jetpack' ), |
293
|
|
|
array( |
294
|
|
|
'a' => array( |
295
|
|
|
'href' => true, |
296
|
|
|
'target' => true, |
297
|
|
|
'rel' => true, |
298
|
|
|
), |
299
|
|
|
) |
300
|
|
|
), |
301
|
|
|
'https://jetpack.com/support/primary-user/' |
302
|
|
|
); |
303
|
|
|
echo '</p>'; |
304
|
|
|
echo '<p>'; |
305
|
|
|
printf( |
306
|
|
|
wp_kses( |
307
|
|
|
/* translators: URL to contact Jetpack support. */ |
308
|
|
|
__( 'As always, feel free to <a href="%s" target="_blank" rel="noopener noreferrer">contact our support team</a> if you have any questions.', 'jetpack' ), |
309
|
|
|
array( |
310
|
|
|
'a' => array( |
311
|
|
|
'href' => true, |
312
|
|
|
'target' => true, |
313
|
|
|
'rel' => true, |
314
|
|
|
), |
315
|
|
|
) |
316
|
|
|
), |
317
|
|
|
'https://jetpack.com/contact-support' |
318
|
|
|
); |
319
|
|
|
echo '</p>'; |
320
|
|
|
echo '</div>'; |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* Injects the dom to show a JITM inside of wp-admin. |
325
|
|
|
*/ |
326
|
|
|
public function ajax_message() { |
327
|
|
|
if ( ! is_admin() ) { |
328
|
|
|
return; |
329
|
|
|
} |
330
|
|
|
|
331
|
|
|
// do not display on Gutenberg pages. |
332
|
|
|
if ( $this->is_gutenberg_page() ) { |
333
|
|
|
return; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
$message_path = $this->get_message_path(); |
337
|
|
|
$query_string = _http_build_query( $_GET, '', ',' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
338
|
|
|
$current_screen = wp_unslash( $_SERVER['REQUEST_URI'] ); |
339
|
|
|
?> |
340
|
|
|
<div class="jetpack-jitm-message" |
341
|
|
|
data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_rest' ) ); ?>" |
342
|
|
|
data-ajax-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_ajax_action' ) ); ?>" |
343
|
|
|
data-message-path="<?php echo esc_attr( $message_path ); ?>" |
344
|
|
|
data-query="<?php echo urlencode_deep( $query_string ); ?>" |
345
|
|
|
data-redirect="<?php echo urlencode_deep( $current_screen ); ?>" |
346
|
|
|
></div> |
347
|
|
|
<?php |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* Get's the current message path for display of a JITM |
352
|
|
|
* |
353
|
|
|
* @return string The message path |
354
|
|
|
*/ |
355
|
|
|
public function get_message_path() { |
356
|
|
|
$screen = get_current_screen(); |
357
|
|
|
|
358
|
|
|
return 'wp:' . $screen->id . ':' . current_filter(); |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* Function to enqueue jitm css and js |
363
|
|
|
*/ |
364
|
|
|
public function jitm_enqueue_files() { |
365
|
|
|
if ( $this->is_gutenberg_page() ) { |
366
|
|
|
return; |
367
|
|
|
} |
368
|
|
|
$min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
369
|
|
|
wp_register_style( |
370
|
|
|
'jetpack-jitm-css', |
371
|
|
|
plugins_url( "assets/jetpack-admin-jitm{$min}.css", __DIR__ ), |
372
|
|
|
false, |
373
|
|
|
self::PACKAGE_VERSION . |
374
|
|
|
'-201243242' |
375
|
|
|
); |
376
|
|
|
wp_style_add_data( 'jetpack-jitm-css', 'rtl', 'replace' ); |
377
|
|
|
wp_style_add_data( 'jetpack-jitm-css', 'suffix', $min ); |
378
|
|
|
wp_enqueue_style( 'jetpack-jitm-css' ); |
379
|
|
|
|
380
|
|
|
wp_enqueue_script( |
381
|
|
|
'jetpack-jitm-new', |
382
|
|
|
Assets::get_file_url_for_environment( '_inc/build/jetpack-jitm.min.js', '_inc/jetpack-jitm.js' ), |
383
|
|
|
array( 'jquery' ), |
384
|
|
|
self::PACKAGE_VERSION, |
385
|
|
|
true |
386
|
|
|
); |
387
|
|
|
wp_localize_script( |
388
|
|
|
'jetpack-jitm-new', |
389
|
|
|
'jitm_config', |
390
|
|
|
array( |
391
|
|
|
'api_root' => esc_url_raw( rest_url() ), |
392
|
|
|
'activate_module_text' => esc_html__( 'Activate', 'jetpack' ), |
393
|
|
|
'activated_module_text' => esc_html__( 'Activated', 'jetpack' ), |
394
|
|
|
'activating_module_text' => esc_html__( 'Activating', 'jetpack' ), |
395
|
|
|
) |
396
|
|
|
); |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* Dismisses a JITM feature class so that it will no longer be shown. |
401
|
|
|
* |
402
|
|
|
* @param string $id The id of the JITM that was dismissed. |
403
|
|
|
* @param string $feature_class The feature class of the JITM that was dismissed. |
404
|
|
|
* |
405
|
|
|
* @return bool Always true. |
406
|
|
|
*/ |
407
|
|
|
public function dismiss( $id, $feature_class ) { |
408
|
|
|
$this->tracking->record_user_event( |
409
|
|
|
'jitm_dismiss_client', |
410
|
|
|
array( |
411
|
|
|
'jitm_id' => $id, |
412
|
|
|
'feature_class' => $feature_class, |
413
|
|
|
) |
414
|
|
|
); |
415
|
|
|
|
416
|
|
|
$hide_jitm = \Jetpack_Options::get_option( 'hide_jitm' ); |
417
|
|
|
if ( ! is_array( $hide_jitm ) ) { |
418
|
|
|
$hide_jitm = array(); |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
if ( isset( $hide_jitm[ $feature_class ] ) ) { |
422
|
|
View Code Duplication |
if ( ! is_array( $hide_jitm[ $feature_class ] ) ) { |
423
|
|
|
$hide_jitm[ $feature_class ] = array( |
424
|
|
|
'last_dismissal' => 0, |
425
|
|
|
'number' => 0, |
426
|
|
|
); |
427
|
|
|
} |
428
|
|
|
} else { |
429
|
|
|
$hide_jitm[ $feature_class ] = array( |
430
|
|
|
'last_dismissal' => 0, |
431
|
|
|
'number' => 0, |
432
|
|
|
); |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
$number = $hide_jitm[ $feature_class ]['number']; |
436
|
|
|
|
437
|
|
|
$hide_jitm[ $feature_class ] = array( |
438
|
|
|
'last_dismissal' => time(), |
439
|
|
|
'number' => $number + 1, |
440
|
|
|
); |
441
|
|
|
|
442
|
|
|
\Jetpack_Options::update_option( 'hide_jitm', $hide_jitm ); |
443
|
|
|
|
444
|
|
|
return true; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
/** |
448
|
|
|
* Is the current page a block editor page? |
449
|
|
|
* |
450
|
|
|
* @since 8.0.0 |
451
|
|
|
*/ |
452
|
|
|
public function is_gutenberg_page() { |
453
|
|
|
$current_screen = get_current_screen(); |
454
|
|
|
return ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ); |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* Generate the icon to display on the JITM |
459
|
|
|
* |
460
|
|
|
* @param string $content_icon Icon type name. |
461
|
|
|
* @param bool $full_jp_logo_exists Is there a big JP logo already displayed on this screen. |
462
|
|
|
*/ |
463
|
|
|
public function generate_icon( $content_icon, $full_jp_logo_exists ) { |
464
|
|
|
switch ( $content_icon ) { |
465
|
|
|
case 'jetpack': |
466
|
|
|
$jetpack_logo = new Jetpack_Logo(); |
467
|
|
|
$content_icon = '<div class="jp-emblem">' . ( ( $full_jp_logo_exists ) ? $jetpack_logo->get_jp_emblem() : $jetpack_logo->get_jp_emblem_larger() ) . '</div>'; |
468
|
|
|
break; |
469
|
|
|
case 'woocommerce': |
470
|
|
|
$content_icon = '<div class="jp-emblem"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 168 100" xml:space="preserve" enable-background="new 0 0 168 100" width="50" height="30"><style type="text/css"> |
471
|
|
|
.st0{clip-path:url(#SVGID_2_);enable-background:new ;} |
472
|
|
|
.st1{clip-path:url(#SVGID_4_);} |
473
|
|
|
.st2{clip-path:url(#SVGID_6_);} |
474
|
|
|
.st3{clip-path:url(#SVGID_8_);fill:#8F567F;} |
475
|
|
|
.st4{clip-path:url(#SVGID_10_);fill:#FFFFFE;} |
476
|
|
|
.st5{clip-path:url(#SVGID_12_);fill:#FFFFFE;} |
477
|
|
|
.st6{clip-path:url(#SVGID_14_);fill:#FFFFFE;} |
478
|
|
|
</style><g><defs><polygon id="SVGID_1_" points="83.8 100 0 100 0 0.3 83.8 0.3 167.6 0.3 167.6 100 "/></defs><clipPath id="SVGID_2_"><use xlink:href="#SVGID_1_" overflow="visible"/></clipPath><g class="st0"><g><defs><rect id="SVGID_3_" width="168" height="100"/></defs><clipPath id="SVGID_4_"><use xlink:href="#SVGID_3_" overflow="visible"/></clipPath><g class="st1"><defs><path id="SVGID_5_" d="M15.6 0.3H152c8.6 0 15.6 7 15.6 15.6v52c0 8.6-7 15.6-15.6 15.6h-48.9l6.7 16.4L80.2 83.6H15.6C7 83.6 0 76.6 0 67.9v-52C0 7.3 7 0.3 15.6 0.3"/></defs><clipPath id="SVGID_6_"><use xlink:href="#SVGID_5_" overflow="visible"/></clipPath><g class="st2"><defs><rect id="SVGID_7_" width="168" height="100"/></defs><clipPath id="SVGID_8_"><use xlink:href="#SVGID_7_" overflow="visible"/></clipPath><rect x="-10" y="-9.7" class="st3" width="187.6" height="119.7"/></g></g></g></g></g><g><defs><path id="SVGID_9_" d="M8.4 14.5c1-1.3 2.4-2 4.3-2.1 3.5-0.2 5.5 1.4 6 4.9 2.1 14.3 4.4 26.4 6.9 36.4l15-28.6c1.4-2.6 3.1-3.9 5.2-4.1 3-0.2 4.9 1.7 5.6 5.7 1.7 9.1 3.9 16.9 6.5 23.4 1.8-17.4 4.8-30 9-37.7 1-1.9 2.5-2.9 4.5-3 1.6-0.1 3 0.3 4.3 1.4 1.3 1 2 2.3 2.1 3.9 0.1 1.2-0.1 2.3-0.7 3.3 -2.7 5-4.9 13.2-6.6 24.7 -1.7 11.1-2.3 19.8-1.9 26.1 0.1 1.7-0.1 3.2-0.8 4.5 -0.8 1.5-2 2.4-3.7 2.5 -1.8 0.1-3.6-0.7-5.4-2.5C52.4 66.7 47.4 57 43.7 44.1c-4.4 8.8-7.7 15.3-9.9 19.7 -4 7.7-7.5 11.7-10.3 11.9 -1.9 0.1-3.5-1.4-4.8-4.7 -3.5-9-7.3-26.3-11.3-52C7.1 17.3 7.5 15.8 8.4 14.5"/></defs><clipPath id="SVGID_10_"><use xlink:href="#SVGID_9_" overflow="visible"/></clipPath><rect x="-2.7" y="-0.6" class="st4" width="90.6" height="86.4"/></g><g><defs><path id="SVGID_11_" d="M155.6 25.2c-2.5-4.3-6.1-6.9-11-7.9 -1.3-0.3-2.5-0.4-3.7-0.4 -6.6 0-11.9 3.4-16.1 10.2 -3.6 5.8-5.3 12.3-5.3 19.3 0 5.3 1.1 9.8 3.3 13.6 2.5 4.3 6.1 6.9 11 7.9 1.3 0.3 2.5 0.4 3.7 0.4 6.6 0 12-3.4 16.1-10.2 3.6-5.9 5.3-12.4 5.3-19.4C159 33.4 157.9 28.9 155.6 25.2zM147 44.2c-0.9 4.5-2.7 7.9-5.2 10.1 -2 1.8-3.9 2.5-5.5 2.2 -1.7-0.3-3-1.8-4-4.4 -0.8-2.1-1.2-4.2-1.2-6.2 0-1.7 0.2-3.4 0.5-5 0.6-2.8 1.8-5.5 3.6-8.1 2.3-3.3 4.7-4.8 7.1-4.2 1.7 0.3 3 1.8 4 4.4 0.8 2.1 1.2 4.2 1.2 6.2C147.5 40.9 147.3 42.6 147 44.2z"/></defs><clipPath id="SVGID_12_"><use xlink:href="#SVGID_11_" overflow="visible"/></clipPath><rect x="109.6" y="6.9" class="st5" width="59.4" height="71.4"/></g><g><defs><path id="SVGID_13_" d="M112.7 25.2c-2.5-4.3-6.1-6.9-11-7.9 -1.3-0.3-2.5-0.4-3.7-0.4 -6.6 0-11.9 3.4-16.1 10.2 -3.5 5.8-5.3 12.3-5.3 19.3 0 5.3 1.1 9.8 3.3 13.6 2.5 4.3 6.1 6.9 11 7.9 1.3 0.3 2.5 0.4 3.7 0.4 6.6 0 12-3.4 16.1-10.2 3.5-5.9 5.3-12.4 5.3-19.4C116 33.4 114.9 28.9 112.7 25.2zM104.1 44.2c-0.9 4.5-2.7 7.9-5.2 10.1 -2 1.8-3.9 2.5-5.5 2.2 -1.7-0.3-3-1.8-4-4.4 -0.8-2.1-1.2-4.2-1.2-6.2 0-1.7 0.2-3.4 0.5-5 0.6-2.8 1.8-5.5 3.6-8.1 2.3-3.3 4.7-4.8 7.1-4.2 1.7 0.3 3 1.8 4 4.4 0.8 2.1 1.2 4.2 1.2 6.2C104.6 40.9 104.4 42.6 104.1 44.2z"/></defs><clipPath id="SVGID_14_"><use xlink:href="#SVGID_13_" overflow="visible"/></clipPath><rect x="66.7" y="6.9" class="st6" width="59.4" height="71.4"/></g></svg></div>'; |
479
|
|
|
break; |
480
|
|
|
default: |
481
|
|
|
$content_icon = ''; |
482
|
|
|
break; |
483
|
|
|
} |
484
|
|
|
return $content_icon; |
485
|
|
|
} |
486
|
|
|
} |
487
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..