PluginProbe
WPSSO Core – Complete Schema Markup and Meta Tags / 22.7.0
WPSSO Core – Complete Schema Markup and Meta Tags v22.7.0
22.7.0 22.6.1 22.6.0 22.5.3 22.5.2 22.5.1 22.4.0 22.3.0 22.2.1 22.2.0 22.1.3 22.1.2 22.1.1 22.1.0 22.0.0 21.13.3 21.13.2 trunk 21.13.1
wpsso / lib / messages.php

messages.php in WPSSO Core – Complete Schema Markup and Meta Tags 22.7.0, at lib/messages.php

1,493 lines 61.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * License: GPLv3
4 * License URI: https://www.gnu.org/licenses/gpl.txt
5 * Copyright 2012-2026 Jean-Sebastien Morisset (https://wpsso.com/)
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9
10 die( 'These aren\'t the droids you\'re looking for.' );
11 }
12
13 if ( ! defined( 'WPSSO_PLUGINDIR' ) ) {
14
15 die( 'Do. Or do not. There is no try.' );
16 }
17
18 if ( ! class_exists( 'WpssoMessages' ) ) {
19
20 class WpssoMessages {
21
22 protected $p; // Wpsso class object.
23
24 protected $pkg_info = array();
25 protected $p_name = '';
26 protected $p_name_pro = '';
27 protected $pkg_pro_transl = '';
28 protected $pkg_std_transl = '';
29 protected $fb_prefs_transl = '';
30
31 private $info = null; // WpssoMessagesInfo class object.
32 private $tooltip = null; // WpssoMessagesTooltip class object.
33
34 /*
35 * Instantiated by Wpsso->set_objects() when is_admin() is true.
36 */
37 public function __construct( &$plugin ) {
38
39 $this->p =& $plugin;
40
41 if ( $this->p->debug->enabled ) {
42
43 $this->p->debug->mark();
44 }
45 }
46
47 public function get( $get_key = false, $info = array() ) {
48
49 $this->maybe_set_properties();
50
51 $msg_key = sanitize_title_with_dashes( $get_key );
52
53 /*
54 * Set a default text string, if one is provided.
55 */
56 $text = '';
57
58 if ( is_string( $info ) ) {
59
60 $text = $info;
61
62 $info = array( 'text' => $text );
63
64 } elseif ( isset( $info[ 'text' ] ) ) {
65
66 $text = $info[ 'text' ];
67 }
68
69 /*
70 * Set a lowercase acronym.
71 *
72 * Example plugin IDs: wpsso, wpssoum, etc.
73 */
74 $plugin_id = $info[ 'plugin_id' ] = isset( $info[ 'plugin_id' ] ) ? $info[ 'plugin_id' ] : $this->p->id;
75
76 /*
77 * Get the array of plugin URLs (download, purchase, etc.).
78 */
79 $url = isset( $this->p->cf[ 'plugin' ][ $plugin_id ][ 'url' ] ) ? $this->p->cf[ 'plugin' ][ $plugin_id ][ 'url' ] : array();
80
81 /*
82 * Make sure specific plugin information is available, like 'short', 'short_pro', etc.
83 */
84 foreach ( array( 'short', 'name', 'version' ) as $info_key ) {
85
86 if ( ! isset( $info[ $info_key ] ) ) {
87
88 if ( ! isset( $this->p->cf[ 'plugin' ][ $plugin_id ][ $info_key ] ) ) { // Just in case.
89
90 $info[ $info_key ] = null;
91
92 continue;
93 }
94
95 $info[ $info_key ] = $this->p->cf[ 'plugin' ][ $plugin_id ][ $info_key ];
96 }
97
98 if ( 'name' === $info_key ) {
99
100 $info[ $info_key ] = _x( $info[ $info_key ], 'plugin name', 'wpsso' );
101 }
102
103 if ( 'version' !== $info_key ) {
104
105 if ( ! isset( $info[ $info_key . '_pro' ] ) ) {
106
107 $info[ $info_key . '_pro' ] = $this->p->util->get_pkg_name( $info[ $info_key ], $this->pkg_pro_transl );
108 }
109 }
110 }
111
112 /*
113 * Tooltips.
114 */
115 if ( 0 === strpos( $msg_key, 'tooltip-' ) ) {
116
117 /*
118 * Instantiate WpssoMessagesTooltip when needed.
119 */
120 if ( null === $this->tooltip ) {
121
122 require_once WPSSO_PLUGINDIR . 'lib/messages-tooltip.php';
123
124 $this->tooltip = new WpssoMessagesTooltip( $this->p );
125 }
126
127 $text = $this->tooltip->get( $msg_key, $info );
128
129 /*
130 * Informational messages.
131 */
132 } elseif ( 0 === strpos( $msg_key, 'info-' ) ) {
133
134 /*
135 * Instantiate WpssoMessagesInfo when needed.
136 */
137 if ( null === $this->info ) {
138
139 require_once WPSSO_PLUGINDIR . 'lib/messages-info.php';
140
141 $this->info = new WpssoMessagesInfo( $this->p );
142 }
143
144 $text = $this->info->get( $msg_key, $info );
145
146 /*
147 * Misc pro messages
148 */
149 } elseif ( 0 === strpos( $msg_key, 'pro-' ) ) {
150
151 switch ( $msg_key ) {
152
153 case 'pro-feature-msg':
154
155 $text = '<p class="pro-feature-msg">';
156
157 $text .= empty( $url[ 'purchase' ] ) ? '' : '<a href="' . $url[ 'purchase' ] . '">';
158
159 $text .= sprintf( __( 'Upgrade to the %s edition and get the following features.', 'wpsso' ), $info[ 'short_pro' ] );
160
161 $text .= empty( $url[ 'purchase' ] ) ? '' : '</a>';
162
163 $text .= '</p>';
164
165 break;
166
167 case 'pro-ecom-product-msg':
168
169 if ( empty( $this->p->avail[ 'ecom' ][ 'any' ] ) ) { // No e-commerce plugin active.
170
171 $text = '';
172
173 } elseif ( ! empty( $this->p->avail[ 'ecom' ][ 'woocommerce' ] ) ) { // WooCommerce plugin is active.
174
175 if ( 'product' === $info[ 'mod' ][ 'post_type' ] ) { // WooCommerce product editing page.
176
177 // translators: Please ignore - translation uses a different text domain.
178 $wc_mb_name = '<strong>' . __( 'Product data', 'woocommerce' ) . '</strong>';
179
180 $text = '<p class="pro-feature-msg">';
181
182 $text .= sprintf( __( 'Read-only product options show values imported from the WooCommerce %s metabox for the main product.', 'wpsso' ), $wc_mb_name ) . ' ';
183
184 $text .= sprintf( __( 'You can edit product information in the WooCommerce %s metabox to update these values.', 'wpsso' ), $wc_mb_name ) . ' ';
185
186 if ( $this->p->util->wc->is_mod_variable( $info[ 'mod' ] ) ) {
187
188 $text .= __( 'This is a variable product - information from product variations may supersede these values in Schema product offers.', 'wpsso' ) . ' ';
189 }
190
191 $text .= '</p>';
192 }
193
194 } else { // Another e-commerce plugin is active.
195
196 $text = '<p class="pro-feature-msg">';
197
198 $text .= __( 'An e-commerce plugin is active &ndash; read-only product information fields may show values imported from the e-commerce plugin.', 'wpsso' );
199
200 $text .= '</p>';
201 }
202
203 break;
204
205 case 'pro-purchase-link':
206
207 if ( empty( $info[ 'ext' ] ) ) { // Nothing to do.
208
209 break;
210 }
211
212 if ( $this->pkg_info[ $info[ 'ext' ] ][ 'pp' ] ) {
213
214 $text = _x( 'Get More Licenses', 'plugin action link', 'wpsso' );
215
216 } elseif ( $info[ 'ext' ] === $plugin_id ) {
217
218 $text = sprintf( _x( 'Purchase %s Plugin', 'plugin action link', 'wpsso' ), $this->pkg_pro_transl );
219
220 } else {
221
222 $text = sprintf( _x( 'Purchase %s Add-on', 'plugin action link', 'wpsso' ), $this->pkg_pro_transl );
223 }
224
225 if ( ! empty( $info[ 'url' ] ) ) {
226
227 $text = '<a href="' . $info[ 'url' ] . '"' . ( empty( $info[ 'tabindex' ] ) ? '' :
228 ' tabindex="' . $info[ 'tabindex' ] . '"' ) . '>' . $text . '</a>';
229 }
230
231 break;
232
233 default:
234
235 $text = apply_filters( 'wpsso_messages_pro', $text, $msg_key, $info );
236
237 break;
238 }
239
240 /*
241 * Misc notice messages.
242 */
243 } elseif ( 0 === strpos( $msg_key, 'notice-' ) ) {
244
245 switch ( $msg_key ) {
246
247 case 'notice-check-img-dims-disabled':
248
249 $opt_label = _x( 'Image Dimension Checks', 'option label', 'wpsso' );
250 $opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_integration', $opt_label );
251
252 $text = '<p class="top">';
253
254 $text .= '<b>' . sprintf( __( 'The %s advanced option is currently disabled.', 'wpsso' ), $opt_link ) . '</b> ';
255
256 $text = __( 'Users may upload small images to the Media Library without knowing that WordPress creates (or tries to create) several different image sizes from the uploaded originals.', 'wpsso' ) . ' ';
257
258 $text .= __( 'Uploading small images to the Media Library means that WordPress cannot create image sizes that are larger than the uploaded image, and <strong>WordPress will provide images that are too small for larger image sizes</strong>.', 'wpsso' ) . ' ';
259
260 $text .= __( 'Providing social sites and search engines with correctly sized images is highly recommended, so this option should be enabled if possible, to double-check the dimension of images provided by WordPress.', 'wpsso' ) . ' ';
261
262 $text .= '</p>';
263
264 break;
265
266 case 'notice-content-filters-disabled':
267
268 $opt_label = _x( 'Use Filtered Content', 'option label', 'wpsso' );
269 $opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_integration', $opt_label );
270
271 $text = '<p class="top">';
272
273 $text .= '<b>' . sprintf( __( 'The %s advanced option is currently disabled.', 'wpsso' ), $opt_link ) . '</b> ';
274
275 $text .= sprintf( __( 'The use of WordPress content filters allows %s to fully render your content text for meta tag descriptions and detect additional images and/or embedded videos provided by shortcodes.', 'wpsso' ), $this->p_name );
276
277 $text .= '</p> <p>';
278
279 $text .= '<b>' . __( 'Many themes and plugins have badly coded content filters, so this option is disabled by default.', 'wpsso' ) . '</b> ';
280
281 $text .= __( 'If you use shortcodes in your content text, this option should be enabled - IF YOU EXPERIENCE WEBPAGE LAYOUT OR PERFORMANCE ISSUES AFTER ENABLING THIS OPTION, disable the option or determine which theme or plugin is filtering the content incorrectly and report the problem to its author(s).', 'wpsso' );
282
283 $text .= '</p>';
284
285 break;
286
287 case 'notice-image-rejected':
288
289 $mb_title = _x( $this->p->cf[ 'meta' ][ 'title' ], 'metabox title', 'wpsso' );
290 $media_tab = _x( 'Edit Media', 'metabox tab', 'wpsso' );
291 $is_meta_page = WpssoAbstractWpMeta::is_meta_page();
292
293 $text = '<!-- show-once -->';
294
295 $text .= ' <p>';
296
297 $text .= __( 'Note that correct image sizes are required for several markup standards, including Google Rich Results.', 'wpsso' ) . ' ';
298
299 $text .= __( 'Correct image sizes also improve click through rates by presenting your content at its best on social sites and in search results.', 'wpsso' ) . ' ';
300
301 $text .= __( 'Consider replacing the original image with a higher resolution version.', 'wpsso' ) . ' ';
302
303 if ( $is_meta_page ) {
304
305 $text .= sprintf( __( 'A larger image can also be uploaded and/or selected in the %1$s metabox under the %2$s tab.', 'wpsso' ), $mb_title, $media_tab ) . ' ';
306 }
307
308 $text .= sprintf( __( 'See <a href="%s">Why shouldn\'t I upload small images to the media library?</a> for more information on how WordPress uses high resolution images and automatically creates smaller images from them.', 'wpsso' ), 'https://wpsso.com/docs/plugins/wpsso/faqs/why-shouldnt-i-upload-small-images-to-the-media-library/' ). ' ';
309
310 $text .= '</p>';
311
312 /*
313 * WpssoMedia->is_image_within_config_limits() sets 'show_adjust_img_opts' = false
314 * for images with an aspect ratio that exceeds the hard-coded config limits.
315 */
316 if ( ! isset( $info[ 'show_adjust_img_opts' ] ) || ! empty( $info[ 'show_adjust_img_opts' ] ) ) {
317
318 if ( current_user_can( 'manage_options' ) ) {
319
320 $image_dim_opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_integration',
321 _x( 'Image Dimension Checks', 'option label', 'wpsso' ) );
322
323 $attached_img_opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_integration',
324 _x( 'Consider Attached Images', 'option label', 'wpsso' ) );
325
326 $content_img_opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_integration',
327 _x( 'Consider Content Images', 'option label', 'wpsso' ) );
328
329 $upscale_opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_integration',
330 _x( 'Upscale Media Library Images', 'option label', 'wpsso' ) );
331
332 $percent_opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_integration',
333 _x( 'Maximum Image Upscale Percent', 'option label', 'wpsso' ) );
334
335 $image_sizes_tab_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_image_sizes',
336 _x( 'Image Sizes', 'lib file description', 'wpsso' ) );
337
338 $text .= ' <p><strong>';
339
340 $text .= __( 'Actions available to resolve this issue, in order of preference:', 'wpsso' );
341
342 $text .= '</strong></p>';
343
344 $text .= '<ul>';
345
346 $text .= ' <li>' . __( 'Replace the uploaded full size image with a higher resolution version.',
347 'wpsso' ) . '</li>';
348
349 if ( $is_meta_page ) {
350
351 $text .= ' <li>' . sprintf( __( 'Select a higher resolution image under the %1$s &gt; %2$s tab.',
352 'wpsso' ), $mb_title, $media_tab ) . '</li>';
353 }
354
355 if ( empty( $this->p->options[ 'plugin_attached_images' ] ) ) {
356
357 $text .= ' <li>' . sprintf( __( 'Enable the %s option to use attached images (recommended).',
358 'wpsso' ), $attached_img_opt_link ) . '</li>';
359 }
360
361 if ( empty( $this->p->options[ 'plugin_content_images' ] ) ) {
362
363 $text .= ' <li>' . sprintf( __( 'Enable the %s option to search the content text for more images.',
364 'wpsso' ), $content_img_opt_link ) . '</li>';
365
366 } else $text .= ' <li>' . sprintf( __( 'Disable the %s option if uploaded content images are too small.',
367 'wpsso' ), $content_img_opt_link ) . '</li>';
368
369 if ( empty( $this->p->options[ 'plugin_upscale_images' ] ) ) {
370
371 $text .= ' <li>' . sprintf( __( 'Enable the %s option.', 'wpsso' ), $upscale_opt_link ) . '</li>';
372
373 } else $text .= ' <li>' . sprintf( __( 'Increase the %s option value.', 'wpsso' ), $percent_opt_link ) . '</li>';
374
375 /*
376 * Note that WpssoMedia->is_image_within_config_limits() sets
377 * 'show_adjust_img_size_opts' to false for images that are too
378 * small for the hard-coded limits. It would be pointless to update
379 * the image size dimensions or disable the image dimension checks
380 * in this case.
381 */
382 if ( ! isset( $info[ 'show_adjust_img_size_opts' ] ) || ! empty( $info[ 'show_adjust_img_size_opts' ] ) ) {
383
384 $text .= ' <li>' . sprintf( __( 'Reduce the image size dimensions in the %s settings page.',
385 'wpsso' ), $image_sizes_tab_link ) . '</li>';
386
387 if ( ! empty( $this->p->options[ 'plugin_check_img_dims' ] ) ) {
388
389 $text .= ' <li>' . sprintf( __( 'Disable the %s option (not recommended).',
390 'wpsso' ), $image_dim_opt_link ) . '</li>';
391 }
392 }
393
394 $text .= '</ul>';
395 }
396 }
397
398 $text .= '<!-- /show-once -->';
399
400 break;
401
402 case 'notice-missing-og-description':
403 case 'notice-missing-og-image':
404
405 $mb_title = _x( $this->p->cf[ 'meta' ][ 'title' ], 'metabox title', 'wpsso' );
406 $prop_name = str_replace( 'notice-missing-og-', '', $get_key ); // Use $get_key for mixed case.
407
408 $text = sprintf( __( 'An Open Graph %1$s meta tag could not be generated from this content or its custom %2$s metabox options.',
409 'wpsso' ), $prop_name, $mb_title ) . ' ';
410
411 $text .= sprintf( __( 'Facebook requires at least one %1$s meta tag to render shared content correctly.',
412 'wpsso' ), $prop_name );
413
414 break;
415
416 case 'notice-missing-schema-image':
417 case 'notice-missing-schema-itemlistelement':
418
419 $mb_title = _x( $this->p->cf[ 'meta' ][ 'title' ], 'metabox title', 'wpsso' );
420 $prop_name = str_replace( 'notice-missing-schema-', '', $get_key ); // Use $get_key for mixed case.
421
422 $text = sprintf( __( 'A Schema %1$s property could not be generated from this content or its custom %2$s metabox options.',
423 'wpsso' ), $prop_name, $mb_title ) . ' ';
424
425 if ( empty( $info[ 'type_name' ] ) ) {
426
427 $text .= sprintf( __( 'Google requires at least one %1$s property for this Schema type.',
428 'wpsso' ), $prop_name ) . ' ';
429
430 } else {
431
432 $text .= sprintf( __( 'Google requires at least one %1$s property for the Schema %2$s type.',
433 'wpsso' ), $prop_name, $info[ 'type_name' ] ) . ' ';
434 }
435
436 break;
437
438 case 'notice-pro-not-installed':
439
440 $licenses_page_text = _x( 'Premium Licenses', 'lib file description', 'wpsso' );
441 $licenses_page_link = $this->p->util->get_admin_url( 'licenses', $licenses_page_text );
442
443 $text = sprintf( __( 'An Authentication ID for %1$s has been entered in the %2$s settings page but the plugin has not been installed yet.', 'wpsso' ), '<b>' . $info[ 'name' ] . '</b>', $licenses_page_link, $this->pkg_pro_transl ) . ' ';
444
445 $text .= sprintf( __( 'You can install and activate the %3$s plugin from the %2$s settings page.', 'wpsso' ), '<b>' . $info[ 'name' ] . '</b>', $licenses_page_link, $this->pkg_pro_transl ) . ' ';
446
447 break;
448
449 case 'notice-pro-not-updated':
450
451 $licenses_page_text = _x( 'Premium Licenses', 'lib file description', 'wpsso' );
452 $licenses_page_link = $this->p->util->get_admin_url( 'licenses', $licenses_page_text );
453
454 $text = sprintf( __( 'An Authentication ID for %1$s has been entered in the %2$s settings page but the %3$s version has not been installed yet.', 'wpsso' ), '<b>' . $info[ 'name' ] . '</b>', $licenses_page_link, $this->pkg_pro_transl ) . ' ';
455
456 $text .= sprintf( __( 'Don\'t forget to update the plugin to install the latest %3$s version.', 'wpsso' ), '<b>' . $info[ 'name' ] . '</b>', $licenses_page_link, $this->pkg_pro_transl ) . ' ';
457
458 break;
459
460 /*
461 * Example $info = array(
462 * 'svc_title_transl' => _x( 'Shopper Approved (Ratings and Reviews)', 'metabox title', 'wpsso' ),
463 * );
464 */
465 case 'notice-ratings-reviews-wc-enabled':
466
467 $opt_label = _x( 'Ratings and Reviews Service', 'option label', 'wpsso' );
468 $opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_services-tab_ratings_reviews', $opt_label );
469 $wc_settings_url = get_admin_url( $blog_id = null, 'admin.php?page=wc-settings&tab=products' );
470 $svc_label_transl = empty( $info[ 'svc_title_transl' ] ) ?
471 _x( 'ratings and reviews', 'tooltip fragment', 'wpsso' ) : $info[ 'svc_title_transl' ];
472
473 $text = sprintf( __( 'WooCommerce product reviews are not compatible with the selected %s service API.', 'wpsso' ),
474 $svc_label_transl ) . ' ';
475
476 $text .= sprintf( __( 'Please choose another %1$s or <a href="%2$s">disable product reviews in WooCommerce</a>.',
477 'wpsso' ), $opt_link, $wc_settings_url ) . ' ';
478
479 break;
480
481 case 'notice-recommend-version':
482
483 $text = sprintf( __( 'You are using %1$s version %2$s - <a href="%3$s">this %1$s version is outdated, unsupported, possibly insecure</a>, and may lack important updates and features.', 'wpsso' ), $info[ 'app_label' ], $info[ 'app_version' ], $info[ 'version_url' ] ) . ' ';
484
485 $text .= sprintf( __( 'Please update to the latest %1$s version (or at least version %2$s).', 'wpsso' ), $info[ 'app_label' ], $info[ 'rec_version' ] ) . ' ';
486
487 break;
488
489 case 'notice-um-activate-add-on':
490 case 'notice-um-add-on-required':
491
492 $um_info = $this->p->cf[ 'plugin' ][ 'wpssoum' ];
493 $um_info_name = _x( $um_info[ 'name' ], 'plugin name', 'wpsso' );
494
495 $addons_page_text = _x( 'Plugin Add-ons', 'lib file description', 'wpsso' );
496 $addons_page_link = $this->p->util->get_admin_url( 'addons#wpssoum', $addons_page_text );
497
498 $licenses_page_text = _x( 'Premium Licenses', 'lib file description', 'wpsso' );
499 $licenses_page_link = $this->p->util->get_admin_url( 'licenses', $licenses_page_text );
500
501 $search_url = get_admin_url( $blog_id = null, 'plugins.php' );
502 $search_url = add_query_arg( array( 's' => $um_info[ 'slug' ] ), $search_url );
503
504 $text .= '<b>' . sprintf( __( 'An Authentication ID has been entered in the %1$s settings page, but the %2$s add-on is not active.', 'wpsso' ), $licenses_page_link, $um_info_name ) . '</b> ';
505
506 $text .= sprintf( __( 'The %1$s add-on is required to enable %2$s features and get %2$s updates.', 'wpsso' ), $um_info_name, $this->pkg_pro_transl ) . ' ';
507
508 if ( 'notice-um-add-on-required' === $msg_key ) {
509
510 $text .= sprintf( __( 'You can install and activate the %1$s add-on from the %2$s settings page.', 'wpsso' ), $um_info_name, $addons_page_link ) . ' ';
511
512 } else {
513
514 $text .= sprintf( __( 'You can activate the %1$s add-on from <a href="%2$s">the WordPress Plugins page</a>.', 'wpsso' ), $um_info_name, $search_url ) . ' ';
515 }
516
517 $text .= sprintf( __( 'Once the %1$s add-on is active, %2$s updates may be available for the %3$s plugin.', 'wpsso' ), $um_info_name, $this->pkg_pro_transl, $this->p_name_pro ) . ' ';
518
519 break;
520
521 case 'notice-um-update-required':
522 case 'notice-um-update-recommended':
523
524 $um_info = $this->p->cf[ 'plugin' ][ 'wpssoum' ];
525 $um_info_name = _x( $um_info[ 'name' ], 'plugin name', 'wpsso' );
526 $um_version = isset( $um_info[ 'version' ] ) ? $um_info[ 'version' ] : 'unknown';
527 $um_rec_version = WpssoConfig::$cf[ 'um' ][ 'rec_version' ];
528 $um_check_updates = _x( 'Check for Plugin Updates', 'submit button', 'wpsso' );
529
530 $tools_page_text = _x( 'Tools and Actions', 'lib file description', 'wpsso' );
531 $tools_page_link = $this->p->util->get_admin_url( 'tools', $tools_page_text );
532
533 // translators: Please ignore - translation uses a different text domain.
534 $wp_updates_page_text = __( 'Dashboard' ) . ' &gt; ' . __( 'Updates' );
535 $wp_updates_page_link = '<a href="' . admin_url( 'update-core.php' ) . '">' . $wp_updates_page_text . '</a>';
536
537 $text = sprintf( __( '%1$s version %2$s requires the use of %3$s version %4$s or newer (version %5$s is currently installed).', 'wpsso' ), $this->p_name_pro, $info[ 'version' ], $um_info_name, $um_rec_version, $um_version ) . ' ';
538
539 // translators: %1$s is the WPSSO Update Manager add-on name.
540 $text .= sprintf( __( 'If an update for the %1$s add-on is not available under the WordPress %2$s page, use the <em>%3$s</em> button in the %4$s settings page to force an immediate refresh of the plugin update information.', 'wpsso' ), $um_info_name, $wp_updates_page_link, $um_check_updates, $tools_page_link ) . ' ';
541
542 break;
543
544 case 'notice-wc-attributes-available':
545
546 $attr_md_index = WpssoConfig::get_attr_md_index();
547 $suggest_names = array();
548
549 foreach ( $attr_md_index as $opt_attr_key => $md_key ) {
550
551 if ( empty( $md_key ) ) continue;
552
553 $attr_name_transl = SucomUtilOptions::get_key_value( $opt_attr_key, $this->p->options ); // Translated name.
554
555 if ( empty( $attr_name_transl ) ) continue;
556
557 $suggest_names[] = $attr_name_transl;
558 }
559
560 if ( ! empty( $suggest_names ) ) { // Just in case.
561
562 $suggest_list = implode( $glue = ', ', $suggest_names );
563 $attr_tab_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_metadata-tab_product_attrs',
564 _x( 'SSO', 'menu title', 'wpsso' ) . ' &gt; ' .
565 _x( 'Advanced Settings', 'lib file description', 'wpsso' ) . ' &gt; ' .
566 _x( 'Attributes and Metadata', 'metabox title', 'wpsso' ) . ' &gt; ' .
567 _x( 'Product Attributes', 'metabox tab', 'wpsso' ) );
568
569 $text .= sprintf( __( '%1$s can read additional WooCommerce product attributes: %2$s.',
570 'wpsso' ), $this->p_name, '<strong>' . $suggest_list . '</strong>' ) . ' ';
571
572 $text .= sprintf( __( 'You can view and modify the complete list of supported product attributes under the %s tab.',
573 'wpsso' ), $attr_tab_link );
574 }
575
576 break;
577
578 case 'notice-wc-inherit-featured-disabled':
579
580 $opt_label = _x( 'Inherit Featured Image', 'option label', 'wpsso' );
581 $opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_integration', $opt_label );
582
583 $text = '<p class="top">';
584
585 $text .= '<b>' . sprintf( __( 'The %s advanced option is currently disabled.', 'wpsso' ), $opt_link ) . '</b> ';
586
587 $text .= __( 'WooCommerce product variations are children of their product page.', 'wpsso' ) . ' ';
588
589 $text .= __( 'Unless you have an image selected for each product variation, we recommend enabling this option.', 'wpsso' ) . ' ';
590
591 $text .= '</p>';
592
593 break;
594
595 case 'notice-wp-config-php-variable-home':
596
597 $const_html = '<code>WP_HOME</code>';
598 $cfg_php_html = '<code>wp-config.php</code>';
599
600 $text = sprintf( __( 'The %1$s constant definition in your %2$s file contains a variable.', 'wpsso' ), $const_html, $cfg_php_html ) . ' ';
601
602 $text .= sprintf( __( 'WordPress uses the %s constant to provide a single unique canonical URL for each webpage and Media Library content.', 'wpsso' ), $const_html ) . ' ';
603
604 $text .= sprintf( __( 'A changing %s value will create different canonical URLs in your webpages, leading to duplicate content penalties from Google, incorrect social share counts, possible broken media links, mixed content issues, and SSL certificate errors.', 'wpsso' ), $const_html ) . ' ';
605
606 $text .= sprintf( __( 'Please update your %1$s file and provide a fixed, non-variable value for the %2$s constant.', 'wpsso' ), $cfg_php_html, $const_html );
607
608 break;
609
610 default:
611
612 $text = apply_filters( 'wpsso_messages_notice', $text, $msg_key, $info );
613
614 break;
615 }
616
617 /*
618 * Misc sidebox messages
619 */
620 } elseif ( 0 === strpos( $msg_key, 'column-' ) ) {
621
622 $mb_title = _x( $this->p->cf[ 'meta' ][ 'title' ], 'metabox title', 'wpsso' );
623 $li_support_text = __( 'Premium plugin support.', 'wpsso' );
624 $li_support_link = empty( $info[ 'url' ][ 'support' ] ) ? '' :
625 '<li><strong><a href="' . $info[ 'url' ][ 'support' ] . '">' . $li_support_text . '</a></strong></li>';
626
627 switch ( $msg_key ) {
628
629 case 'column-purchase-wpsso':
630
631 $advanced_page_url = $this->p->util->get_admin_url( 'advanced' );
632
633 $text = '<p><strong>' . sprintf( __( 'The %s plugin includes:', 'wpsso' ), $info[ 'name_pro' ] ) . '</strong></p>';
634
635 $text .= '<ul>';
636
637 $text .= $li_support_link;
638
639 $text .= '<li>' . sprintf( __( '<strong><a href="%s">Customize advanced settings</a></strong>, including image sizes, video services, shortening services, default types, contact fields, product attributes, custom fields, and more.', 'wpsso' ), $advanced_page_url ) . '</li>';
640
641 $text .= '<li>' . __( '<strong>Get video details from video hosting platforms</strong> (Facebook, Gravatar, SlideShare, Soundcloud, Vimeo, Wistia, Youtube).', 'wpsso' ) . '</li>';
642
643 $text .= '<li>' . __( '<strong>Get short URLs from shortening services</strong> (Bitly, DLMY.App, Ow.ly, TinyURL, YOURLS).', 'wpsso' ) . '</li>';
644
645 $text .= '</ul>';
646
647 break;
648
649 case 'column-help-support':
650
651 $text = '<p>';
652
653 $text .= sprintf( __( '<strong>Development of %s is driven by user requests</strong> - we welcome all your comments and suggestions.', 'wpsso' ), $info[ 'short' ] ) . ' ;-)';
654
655 $text .= '</p>';
656
657 break;
658
659 case 'column-rate-review':
660
661 $text = '<p><strong>';
662
663 $text .= __( 'Great ratings are an excellent way to ensure the continued development of your favorite plugins.', 'wpsso' ) . ' ';
664
665 $text .= '</strong></p><p>' . "\n";
666
667 $text .= __( 'Without new ratings, plugins and add-ons that you and your site depend on could be discontinued prematurely.', 'wpsso' ) . ' ';
668
669 $text .= __( 'Don\'t let that happen!', 'wpsso' ) . ' ';
670
671 $text .= __( 'Rate your active plugins today - it only takes a few seconds to rate a plugin!', 'wpsso' ) . ' ';
672
673 $text .= convert_smilies( ';-)' );
674
675 $text .= '</p>' . "\n";
676
677 break;
678
679 default:
680
681 $text = apply_filters( 'wpsso_messages_column', $text, $msg_key, $info );
682
683 break;
684 }
685
686 } else $text = apply_filters( 'wpsso_messages', $text, $msg_key, $info );
687
688 if ( ! empty( $info[ 'is_locale' ] ) ) {
689
690 // translators: %s is the wordpress.org URL for the WPSSO User Locale Selector add-on.
691 $text .= ' ' . sprintf( __( 'This option is localized - <a href="%s">you may change the WordPress locale</a> to define alternate values for different languages.', 'wpsso' ), 'https://wordpress.org/plugins/wpsso-user-locale/' );
692 }
693
694 if ( ! empty( $text ) ) { // Just in case.
695
696 if ( preg_match( '/_(area|contact|location|org|organization|place)_id$/', $msg_key ) ) {
697
698 $text .= $this->maybe_ext_required( 'opm' );
699 }
700
701 if ( 0 === strpos( $msg_key, 'tooltip-' ) && empty( $info[ 'no-tooltip' ] ) ) {
702
703 $tooltip_class = $this->p->cf[ 'form' ][ 'tooltip_class' ];
704 $tooltip_icon = '<span class="' . $tooltip_class . '-icon"></span>';
705
706 if ( false === strpos( $text, '<span class="' . $tooltip_class . '"' ) ) { // Only add the tooltip wrapper once.
707
708 $text = '<span class="' . $tooltip_class . '" data-help="' . esc_attr( $text ) . '">' . $tooltip_icon . '</span>';
709 }
710 }
711 }
712
713 return $text;
714 }
715
716 protected function get_tooltip_fragments( $msg_key = false ) {
717
718 static $local_cache = null;
719
720 if ( null === $local_cache ) {
721
722 $local_cache = array(
723 'addl_type_urls' => array(
724 'label' => _x( 'Microdata Type URLs', 'option label', 'wpsso' ),
725 'name' => _x( 'Microdata type URLs', 'tooltip fragment', 'wpsso' ),
726 'desc' => _x( 'additional microdata type URLs', 'tooltip fragment', 'wpsso' ),
727 'about' => __( 'https://schema.org/additionalType', 'wpsso' ),
728 'filter' => 'wpsso_json_prop_https_schema_org_additionaltype',
729 ),
730 'article_section' => array(
731 'label' => _x( 'Article Section', 'option label', 'wpsso' ),
732 'name' => _x( 'article section', 'tooltip fragment', 'wpsso' ),
733 'desc' => _x( 'an article section', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
734 'about' => __( 'https://schema.org/articleSection', 'wpsso' ),
735 'inherit' => true,
736 ),
737 'book_author_name' => array(
738 'label' => _x( 'Book Author Name', 'option label', 'wpsso' ),
739 'name' => _x( 'book author name', 'tooltip fragment', 'wpsso' ),
740 'desc' => _x( 'a book author name', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
741 ),
742 'book_isbn' => array(
743 'label' => _x( 'Book ISBN', 'option label', 'wpsso' ),
744 'name' => _x( 'book ISBN', 'tooltip fragment', 'wpsso' ),
745 'desc' => _x( 'an ISBN code (aka International Standard Book Number)', 'tooltip fragment', 'wpsso' ),
746 'about' => __( 'https://support.google.com/merchants/answer/6324461', 'wpsso' ),
747 ),
748 'howto_steps' => array(
749 'label' => _x( 'How-To Steps', 'option label', 'wpsso' ),
750 'name' => _x( 'how-to steps', 'tooltip fragment', 'wpsso' ),
751 'desc' => _x( 'how-to steps', 'tooltip fragment', 'wpsso' ),
752 ),
753 'howto_supplies' => array(
754 'label' => _x( 'How-To Supplies', 'option label', 'wpsso' ),
755 'name' => _x( 'how-to supplies', 'tooltip fragment', 'wpsso' ),
756 'desc' => _x( 'how-to supplies', 'tooltip fragment', 'wpsso' ),
757 ),
758 'howto_tools' => array(
759 'label' => _x( 'How-To Tools', 'option label', 'wpsso' ),
760 'name' => _x( 'how-to tools', 'tooltip fragment', 'wpsso' ),
761 'desc' => _x( 'how-to tools', 'tooltip fragment', 'wpsso' ),
762 ),
763 'img_url' => array(
764 'label' => _x( 'Image URL', 'option label', 'wpsso' ),
765 'name' => _x( 'image URL', 'tooltip fragment', 'wpsso' ),
766 'desc' => _x( 'an image URL', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
767 ),
768 'product_adult_type' => array(
769 'label' => _x( 'Product Adult Type', 'option label', 'wpsso' ),
770 'name' => _x( 'product adult type', 'tooltip fragment', 'wpsso' ),
771 'desc' => _x( 'a product adult type', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
772 'about' => __( 'https://support.google.com/merchants/answer/6324508', 'wpsso' ),
773 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'adult_type', $val_prefix = '', $val_suffix = 'Consideration' ),
774 'inherit' => true,
775 ),
776 'product_age_group' => array(
777 'label' => _x( 'Product Age Group', 'option label', 'wpsso' ),
778 'name' => _x( 'product age group', 'tooltip fragment', 'wpsso' ),
779 'desc' => _x( 'a product age group', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
780 'about' => __( 'https://support.google.com/merchants/answer/6324463', 'wpsso' ),
781 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'age_group' ),
782 'inherit' => true,
783 ),
784 'product_avail' => array(
785 'label' => _x( 'Product Availability', 'option label', 'wpsso' ),
786 'name' => _x( 'product availability', 'tooltip fragment', 'wpsso' ),
787 'desc' => _x( 'a product availability', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
788 'about' => __( 'https://support.google.com/merchants/answer/6324448', 'wpsso' ),
789 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'item_availability' ),
790 ),
791 'product_brand' => array(
792 'label' => _x( 'Product Brand', 'option label', 'wpsso' ),
793 'name' => _x( 'product brand', 'tooltip fragment', 'wpsso' ),
794 'desc' => _x( 'a product brand', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
795 'about' => __( 'https://support.google.com/merchants/answer/6324351', 'wpsso' ),
796 'inherit' => true,
797 ),
798 'product_category' => array( // Product Google Category.
799 'label' => _x( 'Product Google Category', 'option label', 'wpsso' ),
800 'name' => _x( 'product Google category', 'tooltip fragment', 'wpsso' ),
801 'desc' => _x( 'a product Google category', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
802 'about' => __( 'https://support.google.com/merchants/answer/6324436', 'wpsso' ),
803 'opt_label' => _x( 'Default Product Google Category', 'option label', 'wpsso' ),
804 'opt_menu_id' => 'advanced#sucom-tabset_schema_defs-tab_product',
805 'inherit' => true,
806 ),
807 'product_color' => array(
808 'label' => _x( 'Product Color', 'option label', 'wpsso' ),
809 'name' => _x( 'product color', 'tooltip fragment', 'wpsso' ),
810 'desc' => _x( 'a product color', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
811 'about' => __( 'https://support.google.com/merchants/answer/6324487', 'wpsso' ),
812 ),
813 'product_condition' => array(
814 'label' => _x( 'Product Condition', 'option label', 'wpsso' ),
815 'name' => _x( 'product condition', 'tooltip fragment', 'wpsso' ),
816 'desc' => _x( 'a product condition', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
817 'about' => __( 'https://support.google.com/merchants/answer/6324469', 'wpsso' ),
818 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'item_condition', $val_prefix = '', $val_suffix = 'Condition' ),
819 ),
820 'product_currency' => array(
821 'label' => _x( 'Product Currency', 'option label', 'wpsso' ),
822 'name' => _x( 'product currency', 'tooltip fragment', 'wpsso' ),
823 'desc' => _x( 'a product currency', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
824 ),
825 'product_energy_efficiency' => array(
826 'label' => _x( 'Product Energy Rating', 'option label', 'wpsso' ),
827 'name' => _x( 'product energy efficiency rating', 'tooltip fragment', 'wpsso' ),
828 'desc' => _x( 'a product energy efficiency rating', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
829 'about' => 'https://support.google.com/merchants/answer/7562785',
830 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'energy_efficiency', $val_prefix = 'EUEnergyEfficiencyCategory' ),
831 'inherit' => true,
832 ),
833 'product_energy_efficiency_min_max' => array(
834 'label' => _x( 'Product Energy Rating Range', 'option label', 'wpsso' ),
835 'name' => _x( 'product energy efficiency rating minimum and maximum', 'tooltip fragment', 'wpsso' ),
836 'desc' => _x( 'a product energy efficiency rating range', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
837 'about' => 'https://support.google.com/merchants/answer/7562785',
838 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'energy_efficiency', $val_prefix = 'EUEnergyEfficiencyCategory' ),
839 'inherit' => true,
840 ),
841 'product_fluid_volume_value' => array(
842 'label' => _x( 'Product Fluid Volume', 'option label', 'wpsso' ),
843 'name' => _x( 'product fluid volume', 'tooltip fragment', 'wpsso' ),
844 'desc' => _x( 'a product fluid volume', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
845 ),
846 'product_gtin14' => array(
847 'label' => _x( 'Product GTIN-14', 'option label', 'wpsso' ),
848 'name' => _x( 'product GTIN-14', 'tooltip fragment', 'wpsso' ),
849 'desc' => _x( 'a product GTIN-14 code (aka ITF-14)', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
850 'about' => __( 'https://support.google.com/merchants/answer/6324461', 'wpsso' ),
851 ),
852 'product_gtin13' => array(
853 'label' => _x( 'Product GTIN-13 (EAN)', 'option label', 'wpsso' ),
854 'name' => _x( 'product GTIN-13 (EAN)', 'tooltip fragment', 'wpsso' ),
855 'desc' => _x( 'a product GTIN-13 code (aka 13-digit ISBN codes or EAN/UCC-13)', 'tooltip fragment', 'wpsso' ), // Prefix with a/an when singular.
856 'about' => __( 'https://support.google.com/merchants/answer/6324461', 'wpsso' ),
857 ),
858 'product_gtin12' => array(
859 'label' => _x( 'Product GTIN-12 (UPC)', 'option label', 'wpsso' ),
860 'name' => _x( 'product GTIN-12 (UPC)', 'tooltip fragment', 'wpsso' ),
861 'desc' => _x( 'a product GTIN-12 code (12-digit GS1 identification key composed of a UPC company prefix, item reference, and check digit)', 'tooltip fragment', 'wpsso' ),
862 'about' => __( 'https://support.google.com/merchants/answer/6324461', 'wpsso' ),
863 ),
864 'product_gtin8' => array(
865 'label' => _x( 'Product GTIN-8', 'option label', 'wpsso' ),
866 'name' => _x( 'product GTIN-8', 'tooltip fragment', 'wpsso' ),
867 'desc' => _x( 'a product GTIN-8 code (aka EAN/UCC-8 or 8-digit EAN)', 'tooltip fragment', 'wpsso' ),
868 'about' => __( 'https://support.google.com/merchants/answer/6324461', 'wpsso' ),
869 ),
870 'product_gtin' => array(
871 'label' => _x( 'Product GTIN', 'option label', 'wpsso' ),
872 'name' => _x( 'product GTIN', 'tooltip fragment', 'wpsso' ),
873 'desc' => _x( 'a product GTIN code (GTIN-8, GTIN-12/UPC, GTIN-13/EAN, or GTIN-14)', 'tooltip fragment', 'wpsso' ),
874 'about' => __( 'https://support.google.com/merchants/answer/6324461', 'wpsso' ),
875 ),
876 'product_height_value' => array(
877 'label' => _x( 'Product Net Height', 'option label', 'wpsso' ),
878 'name' => _x( 'product net height', 'tooltip fragment', 'wpsso' ),
879 'desc' => _x( 'a product net height, as opposed to a shipping or packaged height used for shipping cost calculations', 'tooltip fragment', 'wpsso' ),
880 'about' => __( 'https://support.google.com/merchants/answer/11018531', 'wpsso' ),
881 ),
882 'product_isbn' => array(
883 'label' => _x( 'Product ISBN', 'option label', 'wpsso' ),
884 'name' => _x( 'product ISBN', 'tooltip fragment', 'wpsso' ),
885 'desc' => _x( 'an ISBN code (aka International Standard Book Number)', 'tooltip fragment', 'wpsso' ),
886 'about' => __( 'https://support.google.com/merchants/answer/6324461', 'wpsso' ),
887 ),
888 'product_length_value' => array(
889 'label' => _x( 'Product Net Len. / Depth', 'option label', 'wpsso' ),
890 'name' => _x( 'product net length or depth', 'tooltip fragment', 'wpsso' ),
891 'desc' => _x( 'a product net length or depth, as opposed to a shipping or packaged length used for shipping cost calculations', 'tooltip fragment', 'wpsso' ),
892 'about' => __( 'https://support.google.com/merchants/answer/11018531', 'wpsso' ),
893 ),
894 'product_material' => array(
895 'label' => _x( 'Product Material', 'option label', 'wpsso' ),
896 'name' => _x( 'product material', 'tooltip fragment', 'wpsso' ),
897 'desc' => _x( 'a product material', 'tooltip fragment', 'wpsso' ),
898 'about' => __( 'https://support.google.com/merchants/answer/6324410', 'wpsso' ),
899 ),
900 'product_mfr_part_no' => array(
901 'label' => _x( 'Product MPN', 'option label', 'wpsso' ),
902 'name' => _x( 'product MPN', 'tooltip fragment', 'wpsso' ),
903 'desc' => _x( 'a Manufacturer Part Number (MPN)', 'tooltip fragment', 'wpsso' ),
904 'about' => __( 'https://support.google.com/merchants/answer/6324482', 'wpsso' ),
905 ),
906 'product_min_advert_price' => array(
907 'label' => _x( 'Product Min Advert Price', 'option label', 'wpsso' ),
908 'name' => _x( 'product minimum advertised price', 'tooltip fragment', 'wpsso' ),
909 'desc' => _x( 'a Minimum Advertised Price (MAP)', 'tooltip fragment', 'wpsso' ),
910 'inherit' => true,
911 ),
912 'product_mrp' => array( // Product Return Policy.
913 'label' => _x( 'Product Return Policy', 'option label', 'wpsso' ),
914 'name' => _x( 'product return policy', 'tooltip fragment', 'wpsso' ),
915 'desc' => _x( 'a product return policy', 'tooltip fragment', 'wpsso' ),
916 'opt_label' => _x( 'Default Product Return Policy', 'option label', 'wpsso' ),
917 'opt_menu_id' => 'advanced#sucom-tabset_schema_defs-tab_product',
918 'inherit' => true,
919 ),
920 'product_pattern' => array(
921 'label' => _x( 'Product Pattern', 'option label', 'wpsso' ),
922 'name' => _x( 'product pattern', 'tooltip fragment', 'wpsso' ),
923 'desc' => _x( 'a product pattern', 'tooltip fragment', 'wpsso' ),
924 'about' => __( 'https://support.google.com/merchants/answer/6324483', 'wpsso' ),
925 ),
926 'product_price' => array(
927 'label' => _x( 'Product Price', 'option label', 'wpsso' ),
928 'name' => _x( 'product price', 'tooltip fragment', 'wpsso' ),
929 'desc' => _x( 'a product price', 'tooltip fragment', 'wpsso' ),
930 ),
931 'product_price_type' => array(
932 'label' => _x( 'Product Price Type', 'option label', 'wpsso' ),
933 'name' => _x( 'product price type', 'tooltip fragment', 'wpsso' ),
934 'desc' => _x( 'a product price type', 'tooltip fragment', 'wpsso' ),
935 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'price_type' ),
936 'inherit' => true,
937 ),
938 'product_retailer_part_no' => array(
939 'label' => _x( 'Product SKU', 'option label', 'wpsso' ),
940 'name' => _x( 'product SKU', 'tooltip fragment', 'wpsso' ),
941 'desc' => _x( 'a Stock-Keeping Unit (SKU)', 'tooltip fragment', 'wpsso' ),
942 ),
943 'product_shipping_height_value' => array(
944 'label' => _x( 'Product Shipping Height', 'option label', 'wpsso' ),
945 'name' => _x( 'product shipping height', 'tooltip fragment', 'wpsso' ),
946 'desc' => _x( 'a product shipping or packaged height used for shipping cost calculations', 'tooltip fragment', 'wpsso' ),
947 'about' => __( 'https://support.google.com/merchants/answer/6324498', 'wpsso' ),
948 ),
949 'product_shipping_length_value' => array(
950 'label' => _x( 'Product Shipping Length', 'option label', 'wpsso' ),
951 'name' => _x( 'product shipping length', 'tooltip fragment', 'wpsso' ),
952 'desc' => _x( 'a product shipping or packaged length used for shipping cost calculations', 'tooltip fragment', 'wpsso' ),
953 'about' => __( 'https://support.google.com/merchants/answer/6324498', 'wpsso' ),
954 ),
955 'product_shipping_weight_value' => array(
956 'label' => _x( 'Product Shipping Weight', 'option label', 'wpsso' ),
957 'name' => _x( 'product shipping weight', 'tooltip fragment', 'wpsso' ),
958 'desc' => _x( 'a product shipping or packaged weight used for shipping cost calculations', 'tooltip fragment', 'wpsso' ),
959 'about' => __( 'https://support.google.com/merchants/answer/6324503', 'wpsso' ),
960 ),
961 'product_shipping_width_value' => array(
962 'label' => _x( 'Product Shipping Width', 'option label', 'wpsso' ),
963 'name' => _x( 'product shipping width', 'tooltip fragment', 'wpsso' ),
964 'desc' => _x( 'a product shipping or packaged width used for shipping cost calculations', 'tooltip fragment', 'wpsso' ),
965 'about' => __( 'https://support.google.com/merchants/answer/6324498', 'wpsso' ),
966 ),
967 'product_size' => array(
968 'label' => _x( 'Product Size', 'option label', 'wpsso' ),
969 'name' => _x( 'product size', 'tooltip fragment', 'wpsso' ),
970 'desc' => _x( 'a product size', 'tooltip fragment', 'wpsso' ),
971 'about' => __( 'https://support.google.com/merchants/answer/6324492', 'wpsso' ),
972 ),
973 'product_size_group' => array(
974 'label' => _x( 'Product Size Group', 'option label', 'wpsso' ),
975 'name' => _x( 'product size group', 'tooltip fragment', 'wpsso' ),
976 'desc' => _x( 'a product size group', 'tooltip fragment', 'wpsso' ),
977 'about' => __( 'https://support.google.com/merchants/answer/6324497', 'wpsso' ),
978 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'size_group', $val_prefix = 'WearableSizeGroup' ),
979 'inherit' => true,
980 ),
981 'product_size_system' => array(
982 'label' => _x( 'Product Size System', 'option label', 'wpsso' ),
983 'name' => _x( 'product size system', 'tooltip fragment', 'wpsso' ),
984 'desc' => _x( 'a product size system', 'tooltip fragment', 'wpsso' ),
985 'about' => __( 'https://support.google.com/merchants/answer/6324502', 'wpsso' ),
986 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'size_system', $val_prefix = 'WearableSizeSystem' ),
987 'inherit' => true,
988 ),
989 'product_target_gender' => array(
990 'label' => _x( 'Product Target Gender', 'option label', 'wpsso' ),
991 'name' => _x( 'product target gender', 'tooltip fragment', 'wpsso' ),
992 'desc' => _x( 'a product target gender', 'tooltip fragment', 'wpsso' ),
993 'about' => __( 'https://support.google.com/merchants/answer/6324479', 'wpsso' ),
994 'values' => WpssoSchema::get_enumeration_examples( $enum_key = 'target_gender' ),
995 'inherit' => true,
996 ),
997 'product_weight_value' => array(
998 'label' => _x( 'Product Net Weight', 'option label', 'wpsso' ),
999 'name' => _x( 'product net weight', 'tooltip fragment', 'wpsso' ),
1000 'desc' => _x( 'a product net weight, as opposed to a shipping or packaged weight used for shipping cost calculations', 'tooltip fragment', 'wpsso' ),
1001 'about' => __( 'https://support.google.com/merchants/answer/11018531', 'wpsso' ),
1002 ),
1003 'product_width_value' => array(
1004 'label' => _x( 'Product Net Width', 'option label', 'wpsso' ),
1005 'name' => _x( 'product net width', 'tooltip fragment', 'wpsso' ),
1006 'desc' => _x( 'a product net width, as opposed to a shipping or packaged width used for shipping cost calculations', 'tooltip fragment', 'wpsso' ),
1007 'about' => __( 'https://support.google.com/merchants/answer/11018531', 'wpsso' ),
1008 ),
1009 'review_item_name' => array(
1010 'label' => _x( 'Review Subject Name', 'option label', 'wpsso' ),
1011 'name' => _x( 'review subject name', 'tooltip fragment', 'wpsso' ),
1012 'desc' => _x( 'a Schema Review subject (aka item reviewed) name', 'tooltip fragment', 'wpsso' ),
1013 'about' => __( 'https://developers.google.com/search/docs/appearance/structured-data/review-snippet#review-properties', 'wpsso' ),
1014 ),
1015 'review_item_desc' => array(
1016 'label' => _x( 'Review Subject Description', 'option label', 'wpsso' ),
1017 'name' => _x( 'review subject description', 'tooltip fragment', 'wpsso' ),
1018 'desc' => _x( 'a Schema Review subject (aka item reviewed) description', 'tooltip fragment', 'wpsso' ),
1019 ),
1020 'review_rating' => array(
1021 'label' => _x( 'Review Rating', 'option label', 'wpsso' ),
1022 'name' => _x( 'review rating', 'tooltip fragment', 'wpsso' ),
1023 'desc' => _x( 'a Schema Review rating', 'tooltip fragment', 'wpsso' ),
1024 'about' => __( 'https://schema.org/Review', 'wpsso' ),
1025 ),
1026 'review_rating_alt_name' => array(
1027 'label' => _x( 'Rating Alt Name', 'option label', 'wpsso' ),
1028 'name' => _x( 'rating alternate name', 'tooltip fragment', 'wpsso' ),
1029 'desc' => _x( 'a Schema Review rating alternate name', 'tooltip fragment', 'wpsso' ),
1030 'about' => __( 'https://developers.google.com/search/docs/appearance/structured-data/factcheck#rating', 'wpsso' ),
1031 ),
1032 'recipe_ingredients' => array(
1033 'label' => _x( 'Recipe Ingredients', 'option label', 'wpsso' ),
1034 'name' => _x( 'recipe ingredients', 'tooltip fragment', 'wpsso' ),
1035 'desc' => _x( 'recipe ingredients', 'tooltip fragment', 'wpsso' ),
1036 ),
1037 'recipe_instructions' => array(
1038 'label' => _x( 'Recipe Instructions', 'option label', 'wpsso' ),
1039 'name' => _x( 'recipe instructions', 'tooltip fragment', 'wpsso' ),
1040 'desc' => _x( 'recipe instructions', 'tooltip fragment', 'wpsso' ),
1041 ),
1042 'sameas_urls' => array(
1043 'label' => _x( 'Same-As URLs', 'option label', 'wpsso' ),
1044 'name' => _x( 'same-as URLs', 'tooltip fragment', 'wpsso' ),
1045 'desc' => _x( 'additional same-as URLs', 'tooltip fragment', 'wpsso' ),
1046 'filter' => 'wpsso_json_prop_https_schema_org_sameas',
1047 ),
1048 'vid_embed' => array(
1049 'label' => _x( 'Video Embed HTML', 'option label', 'wpsso' ),
1050 'name' => _x( 'video embed HTML', 'tooltip fragment', 'wpsso' ),
1051 'desc' => _x( 'video embed HTML code (not a URL)', 'tooltip fragment', 'wpsso' ),
1052 ),
1053 'vid_url' => array(
1054 'label' => _x( 'Video URL', 'option label', 'wpsso' ),
1055 'name' => _x( 'video URL', 'tooltip fragment', 'wpsso' ),
1056 'desc' => _x( 'a video URL (not HTML code)', 'tooltip fragment', 'wpsso' ),
1057 ),
1058 );
1059
1060 $cf_md_index = WpssoConfig::get_cf_md_index(); // Uses a local cache.
1061
1062 foreach ( $cf_md_index as $opt_cf_key => $md_key ) {
1063
1064 if ( ! empty( $md_key ) ) { // Just in case.
1065
1066 if ( ! empty( $this->p->options[ $opt_cf_key ] ) ) { // A custom field name is defined.
1067
1068 $cache_key = preg_replace( '/^plugin_cf_/', '', $opt_cf_key );
1069
1070 if ( ! empty( $local_cache[ $cache_key ] ) ) {
1071
1072 $cf_key = $this->p->options[ $opt_cf_key ]; // Example: '_format_video_url'.
1073
1074 $local_cache[ $cache_key ][ 'import_cf' ] = SucomUtil::sanitize_hookname( 'wpsso_import_cf_' . $cf_key );
1075 }
1076 }
1077 }
1078 }
1079 }
1080
1081 if ( false !== $local_cache ) {
1082
1083 if ( isset( $local_cache[ $msg_key ] ) ) {
1084
1085 return $local_cache[ $msg_key ];
1086 }
1087
1088 return null;
1089 }
1090
1091 return $local_cache;
1092 }
1093
1094 protected function get_def_checked( $opt_key ) {
1095
1096 $def_checked = $this->p->opt->get_defaults( $opt_key ) ?
1097 _x( 'enabled', 'option value', 'wpsso' ) :
1098 _x( 'disabled', 'option value', 'wpsso' );
1099
1100 return $def_checked;
1101 }
1102
1103 public function get_def_img_dims( $opt_pre ) {
1104
1105 $defs = $this->p->opt->get_defaults();
1106
1107 $img_width = empty( $defs[ $opt_pre . '_img_width' ] ) ? 0 : $defs[ $opt_pre . '_img_width' ];
1108 $img_height = empty( $defs[ $opt_pre . '_img_height' ] ) ? 0 : $defs[ $opt_pre . '_img_height' ];
1109 $img_cropped = empty( $defs[ $opt_pre . '_img_crop' ] ) ? _x( 'uncropped', 'option value', 'wpsso' ) : _x( 'cropped', 'option value', 'wpsso' );
1110
1111 return $img_width . 'x' . $img_height . 'px ' . $img_cropped;
1112 }
1113
1114 public function get_schema_disabled_rows( $table_rows = array(), $col_span = 1 ) {
1115
1116 if ( ! is_array( $table_rows ) ) { // Just in case.
1117
1118 $table_rows = array();
1119 }
1120
1121 $html = '<p class="status-msg">' . __( 'Schema markup is disabled.', 'wpsso' ) . '</p>';
1122
1123 $html .= '<p class="status-msg">' . __( 'No options available.', 'wpsso' ) . '</p>';
1124
1125 $table_rows[ 'schema_disabled' ] = '<tr><td align="center" colspan="' . $col_span . '">' . $html . '</td></tr>';
1126
1127 return $table_rows;
1128 }
1129
1130 public function get_wp_sitemaps_disabled_rows( $table_rows = array() ) {
1131
1132 if ( ! is_array( $table_rows ) ) { // Just in case.
1133
1134 $table_rows = array();
1135 }
1136
1137 $table_rows[ 'wp_sitemaps_disabled' ] = '<tr><td align="center">' .
1138 $this->wp_sitemaps_disabled() .
1139 '<p class="status-msg">' . __( 'No options available.', 'wpsso' ) . '</p>' .
1140 '</td></tr>';
1141
1142
1143 return $table_rows;
1144 }
1145
1146 /*
1147 * Define and translate certain strings only once.
1148 */
1149 protected function maybe_set_properties() {
1150
1151 if ( empty( $this->pkg_info ) ) {
1152
1153 if ( ! empty( $this->p->util ) ) { // Just in case.
1154
1155 if ( $this->p->debug->enabled ) {
1156
1157 $this->p->debug->log( 'setting properties' );
1158 }
1159
1160 $this->pkg_info = $this->p->util->get_pkg_info(); // Uses a local cache.
1161 $this->p_name = $this->pkg_info[ 'wpsso' ][ 'name' ];
1162 $this->p_name_pro = $this->pkg_info[ 'wpsso' ][ 'name_pro' ];
1163 $this->pkg_pro_transl = _x( $this->p->cf[ 'packages' ][ 'pro' ], 'package name', 'wpsso' );
1164 $this->pkg_std_transl = _x( $this->p->cf[ 'packages' ][ 'std' ], 'package name', 'wpsso' );
1165 $this->fb_prefs_transl = sprintf( __( 'Facebook prefers images of %1$s cropped (for Retina and high-PPI displays), %2$s cropped as a recommended minimum, and ignores images smaller than %3$s.', 'wpsso' ), '1200x628px', '600x314px', '200x200px' );
1166 }
1167 }
1168 }
1169
1170 /*
1171 * Used by the Advanced Settings page for the "Webpage Title Tag" option.
1172 *
1173 * WpssoMessages->maybe_doc_title_disabled() returns a message if:
1174 *
1175 * - An SEO plugin is active.
1176 * - The theme does not support the 'title-tag' feature.
1177 * - The WPSSO_TITLE_TAG_DISABLE constant is true.
1178 */
1179 public function maybe_doc_title_disabled() {
1180
1181 $html = '';
1182
1183 /*
1184 * WpssoUtil->is_canonical_disabled() returns true if:
1185 *
1186 * - An SEO plugin is active.
1187 * - The theme does not support the 'title-tag' feature.
1188 * - The WPSSO_TITLE_TAG_DISABLE constant is true.
1189 * - The 'plugin_title_tag' option is not 'seo_title'.
1190 */
1191 if ( $this->p->util->is_seo_title_disabled() ) {
1192
1193 if ( ! empty( $this->p->avail[ 'seo' ][ 'any' ] ) ) {
1194
1195 $html = __( 'Modifications disabled (SEO plugin detected).', 'wpsso' );
1196
1197 } elseif ( ! current_theme_supports( 'title-tag' ) ) {
1198
1199 $title_tag_url = __( 'https://codex.wordpress.org/Title_Tag', 'wpsso' );
1200
1201 $html = sprintf( __( 'No theme support for <a href="%s">WordPress Title Tag</a>.', 'wpsso' ), $title_tag_url );
1202
1203 } elseif ( SucomUtil::get_const( 'WPSSO_TITLE_TAG_DISABLE' ) ) {
1204
1205 $html = sprintf( __( 'Modifications disabled (%s constant is true).', 'wpsso' ), 'WPSSO_TITLE_TAG_DISABLE' );
1206 }
1207
1208 if ( ! empty( $html ) ) {
1209
1210 $html = '<p class="status-msg smaller long_name">' . $html . '</p>';
1211 }
1212 }
1213
1214 return $html;
1215 }
1216
1217 /*
1218 * WpssoMessages->maybe_seo_title_disabled() returns a message if:
1219 *
1220 * - An SEO plugin is active.
1221 * - The theme does not support the 'title-tag' feature.
1222 * - The WPSSO_TITLE_TAG_DISABLE constant is true.
1223 * - The 'plugin_title_tag' option is not 'seo_title'.
1224 *
1225 * See WpssoEditGeneral->filter_mb_sso_edit_general_rows().
1226 */
1227 public function maybe_seo_title_disabled() {
1228
1229 $html = '';
1230
1231 /*
1232 * WpssoUtil->is_canonical_disabled() returns true if:
1233 *
1234 * - An SEO plugin is active.
1235 * - The theme does not support the 'title-tag' feature.
1236 * - The WPSSO_TITLE_TAG_DISABLE constant is true.
1237 * - The 'plugin_title_tag' option is not 'seo_title'.
1238 */
1239 if ( $this->p->util->is_seo_title_disabled() ) {
1240
1241 if ( ! empty( $this->p->avail[ 'seo' ][ 'any' ] ) ) {
1242
1243 $html = __( 'Modifications disabled (SEO plugin detected).', 'wpsso' );
1244
1245 } elseif ( ! current_theme_supports( 'title-tag' ) ) {
1246
1247 $html = __( 'Modifications disabled (no theme support).', 'wpsso' );
1248
1249 } elseif ( SucomUtil::get_const( 'WPSSO_TITLE_TAG_DISABLE' ) ) {
1250
1251 $html = sprintf( __( 'Modifications disabled (%s constant is true).', 'wpsso' ), 'WPSSO_TITLE_TAG_DISABLE' );
1252
1253 } elseif ( 'seo_title' !== $this->p->options[ 'plugin_title_tag' ] ) {
1254
1255 $opt_key = 'seo_title';
1256 $opt_val_transl = _x( $this->p->cf[ 'form' ][ 'document_title' ][ $opt_key ], 'option value', 'wpsso' );
1257 $opt_label_transl = _x( 'Webpage Title Tag', 'option label', 'wpsso' );
1258 $opt_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_plugin-tab_integration', $opt_label_transl );
1259
1260 $html = sprintf( __( 'Modifications disabled (%1$s option not "%2$s").', 'wpsso' ), $opt_link, $opt_val_transl );
1261 }
1262
1263 if ( $html ) {
1264
1265 $html = '<p class="status-msg smaller">' . $html . '</p>';
1266 }
1267 }
1268
1269 return $html;
1270 }
1271
1272 /*
1273 * Returns a message if an SEO plugin is active or the meta tag is disabled.
1274 *
1275 * See WpssoEditGeneral->filter_mb_sso_edit_general_rows().
1276 * See WpssoEditVisibility->filter_mb_sso_edit_visibility_rows().
1277 * See WpssoEditVisibility->filter_mb_sso_edit_visibility_robots_rows().
1278 */
1279 public function maybe_seo_tag_disabled( $mt_name ) {
1280
1281 $opt_key = SucomUtil::sanitize_input_name( 'add_' . $mt_name );
1282
1283 if ( empty( $this->p->options[ $opt_key ] ) ) { // Option does not exist or is unchecked.
1284
1285 if ( ! empty( $this->p->avail[ 'seo' ][ 'any' ] ) ) { // An SEO plugin is active.
1286
1287 $msg = __( 'Modifications disabled (SEO plugin detected).', 'wpsso' );
1288
1289 } else $msg = sprintf( __( 'Modifications disabled (<code>%s</code> tag disabled).', 'wpsso' ), $mt_name );
1290
1291 return '<p class="status-msg smaller">' . $msg . '</p>';
1292 }
1293
1294 return '';
1295 }
1296
1297 /*
1298 * See WpssoMessagesTooltipMeta->get().
1299 * See WpssoMessagesTooltip->get().
1300 */
1301 public function maybe_add_seo_tag_disabled_link( $mt_name ) {
1302
1303 $opt_key = SucomUtil::sanitize_input_name( 'add_' . $mt_name );
1304
1305 if ( empty( $this->p->options[ $opt_key ] ) ) { // Option does not exist or is unchecked.
1306
1307 $seo_other_tab_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_head_tags-tab_seo_other',
1308 _x( 'SSO', 'menu title', 'wpsso' ) . ' &gt; ' .
1309 _x( 'Advanced Settings', 'lib file description', 'wpsso' ) . ' &gt; ' .
1310 _x( 'HTML Tags', 'metabox title', 'wpsso' ) . ' &gt; ' .
1311 _x( 'SEO / Other', 'metabox tab', 'wpsso' ) );
1312
1313 return ' ' . sprintf( __( 'Note that the <code>%s</code> HTML tag is currently disabled.', 'wpsso' ), $mt_name ) . ' ' .
1314 sprintf( __( 'You can re-enable this option under the %s tab.', 'wpsso' ), $seo_other_tab_link );
1315 }
1316
1317 return '';
1318 }
1319
1320 /*
1321 * If an add-on is not active, return a short message that this add-on is recommended.
1322 */
1323 public function maybe_ext_required( $ext ) {
1324
1325 list( $ext, $p_ext ) = $this->ext_p_ext( $ext );
1326
1327 if ( empty( $ext ) ) { // Just in case.
1328
1329 return '';
1330
1331 } elseif ( 'wpsso' === $ext ) { // The main plugin is not considered an add-on.
1332
1333 return '';
1334
1335 } elseif ( ! empty( $this->p->avail[ 'p_ext' ][ $p_ext ] ) ) { // Add-on is already active.
1336
1337 return '';
1338
1339 } elseif ( empty( $this->p->cf[ 'plugin' ][ $ext ][ 'short' ] ) ) { // Unknown add-on.
1340
1341 return '';
1342 }
1343
1344 $ext_name_link = $this->p->util->get_admin_url( 'addons#' . $ext, $this->p->cf[ 'plugin' ][ $ext ][ 'name' ] );
1345
1346 return ' ' . sprintf( _x( 'Activating the %s add-on is recommended to manage the values for this option.', 'wpsso' ), $ext_name_link );
1347 }
1348
1349 /*
1350 * Pinterest disabled.
1351 *
1352 * $extra_css_class can be empty, 'left', or 'inline'.
1353 */
1354 public function maybe_pin_img_disabled( $extra_css_class = '' ) {
1355
1356 return $this->p->util->is_pin_img_disabled() ? $this->pin_img_disabled( $extra_css_class ) : '';
1357 }
1358
1359 /*
1360 * Used by the General Settings page.
1361 */
1362 public function maybe_preview_images_first() {
1363
1364 return empty( $this->form->options[ 'og_vid_prev_img' ] ) ? '' :
1365 ' ' . _x( 'video preview images are enabled (and included first)', 'option comment', 'wpsso' );
1366 }
1367
1368 public function maybe_schema_disabled() {
1369
1370 return $this->p->util->is_schema_disabled() ? '<p class="status-msg smaller">' . __( 'Schema markup is disabled.', 'wpsso' ) . '</p>' : '';
1371 }
1372
1373 public function pin_img_disabled( $extra_css_class = '' ) {
1374
1375 $opt_label = _x( 'Add Hidden Image for Pinterest', 'option label', 'wpsso' );
1376 $opt_link = $this->p->util->get_admin_url( 'general#sucom-tabset_social_search-tab_pinterest', $opt_label );
1377
1378 // translators: %s is the option name, linked to its settings page.
1379 $text = sprintf( __( 'Modifications disabled (%s option is disabled).', 'wpsso' ), $opt_link );
1380
1381 return '<p class="status-msg smaller disabled ' . $extra_css_class . '">' . $text . '</p>';
1382 }
1383
1384 public function preview_images_are_first() {
1385
1386 return ' (' . _x( 'video preview images are included first', 'option comment', 'wpsso' ) . ')';
1387 }
1388
1389 public function pro_feature( $ext ) {
1390
1391 list( $ext, $p_ext ) = $this->ext_p_ext( $ext );
1392
1393 return empty( $ext ) ? '' : $this->get( 'pro-feature-msg', array( 'plugin_id' => $ext ) );
1394 }
1395
1396 public function pro_feature_video_api() {
1397
1398 $this->maybe_set_properties();
1399
1400 $short_pro = $this->pkg_info[ $this->p->id ][ 'short_pro' ];
1401
1402 $html = '<p class="pro-feature-msg">';
1403
1404 $html .= sprintf( __( 'Video service API modules are provided with the %1$s edition.', 'wpsso' ), $short_pro );
1405
1406 $html .= '</p>';
1407
1408 return $html;
1409 }
1410
1411 public function pro_feature_video_found_notice( $svc_transl, array $mod ) {
1412
1413 $this->maybe_set_properties();
1414
1415 $canonical_url = $this->p->util->maybe_set_ref( $canonical_url = null, $mod, __( 'adding video markup', 'wpsso' ) );
1416
1417 $short_pro = $this->pkg_info[ $this->p->id ][ 'short_pro' ];
1418
1419 $notice_msg = sprintf( __( 'A %1$s video was found but details about this video (title, description, preview image, upload date, duration, width, height, encoding, etc.) could not be retrieved as video service API modules are provided with the %2$s edition.', 'wpsso' ), $svc_transl, $short_pro );
1420
1421 $notice_key = 'pro-feature-video-found-notice-' . $svc_transl;
1422
1423 $this->p->notice->warn( $notice_msg );
1424
1425 $this->p->util->maybe_unset_ref( $canonical_url );
1426 }
1427
1428 /*
1429 * Use SucomUtilWP::sitemaps_disabled() as a test before calling this method.
1430 */
1431 public function wp_sitemaps_disabled( $is_notice = false ) {
1432
1433 $html = '';
1434 $is_public = get_option( 'blog_public' );
1435 $is_prod_env = 'production' === wp_get_environment_type() ? true : false; // Since WP v5.5.
1436
1437 if ( ! $is_prod_env && $is_notice ) { // Only show notice for production sites.
1438
1439 return $html;
1440 }
1441
1442 $html .= '<p class="status-msg">';
1443 $html .= __( 'The WordPress sitemaps functionality is disabled.', 'wpsso' );
1444 $html .= '</p>';
1445
1446 if ( ! $is_public ) {
1447
1448 $settings_url = get_admin_url( $blog_id = null, 'options-reading.php' );
1449
1450 $html .= '<p class="status-msg">';
1451 $html .= sprintf( __( 'The WordPress <a href="%s">Search Engine Visibility</a> option is set to discourage search engines from indexing this site.', 'wpsso' ), $settings_url );
1452 $html .= '</p>';
1453 }
1454
1455 /*
1456 * Check if a theme or another plugin has disabled the Wordpress sitemaps functionality.
1457 */
1458 if ( ! apply_filters( 'wp_sitemaps_enabled', true ) ) {
1459
1460 $html .= '<p class="status-msg">';
1461 $html .= __( 'A theme or plugin is returning <code>false</code> for the \'wp_sitemaps_enabled\' filter.', 'wpsso' );
1462 $html .= '</p>';
1463 }
1464
1465 return $is_notice ? preg_replace( '/(<p>|<p[^>]+>|<\/p>)/i', ' ', $html ) : $html;
1466 }
1467
1468 /*
1469 * Returns an array of two elements.
1470 */
1471 protected function ext_p_ext( $ext ) {
1472
1473 if ( is_string( $ext ) ) {
1474
1475 if ( 0 !== strpos( $ext, $this->p->id ) ) {
1476
1477 $ext = $this->p->id . $ext;
1478 }
1479
1480 $p_ext = substr( $ext, strlen( $this->p->id ) );
1481
1482 } else {
1483
1484 $ext = '';
1485
1486 $p_ext = '';
1487 }
1488
1489 return array( $ext, $p_ext );
1490 }
1491 }
1492 }
1493