gsc-display.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Google_Search_Console
  6. */
  7. // Admin header.
  8. Yoast_Form::get_instance()->admin_header( false, 'wpseo-gsc', false, 'yoast_wpseo_gsc_options' );
  9. // GSC Error notification.
  10. $gsc_profile = WPSEO_GSC_Settings::get_profile();
  11. $gsc_url = 'https://search.google.com/search-console/index';
  12. if ( $gsc_profile !== '' ) {
  13. $gsc_url .= '?resource_id=' . rawurlencode( $gsc_profile );
  14. }
  15. $gsc_post_url = 'https://yoa.st/google-search-console-deprecated';
  16. $gsc_style_alert = '
  17. display: flex;
  18. align-items: baseline;
  19. position: relative;
  20. padding: 16px;
  21. border: 1px solid rgba(0, 0, 0, 0.2);
  22. font-size: 14px;
  23. font-weight: 400;
  24. line-height: 1.5;
  25. margin: 16px 0;
  26. color: #450c11;
  27. background: #f8d7da;
  28. ';
  29. $gsc_style_alert_icon = 'display: block; margin-right: 8px;';
  30. $gsc_style_alert_content = 'max-width: 600px;';
  31. $gsc_style_alert_link = 'color: #004973;';
  32. $gsc_notification = sprintf(
  33. /* Translators: %1$s: expands to opening anchor tag, %2$s expands to closing anchor tag. */
  34. __( 'Google has discontinued its Crawl Errors API. Therefore, any possible crawl errors you might have cannot be displayed here anymore. %1$sRead our statement on this for further information%2$s.', 'wordpress-seo' ),
  35. '<a style="' . $gsc_style_alert_link . '" href="' . WPSEO_Shortlinker::get( $gsc_post_url ) . '" target="_blank" rel="noopener">',
  36. WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
  37. );
  38. $gsc_notification .= '<br/><br/>';
  39. $gsc_notification .= sprintf(
  40. /* Translators: %1$s: expands to opening anchor tag, %2$s expands to closing anchor tag. */
  41. __( 'To view your current crawl errors, %1$splease visit Google Search Console%2$s.', 'wordpress-seo' ),
  42. '<a style="' . $gsc_style_alert_link . '" href="' . $gsc_url . '" target="_blank" rel="noopener noreferrer">',
  43. WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
  44. );
  45. ?>
  46. <div style="<?php echo $gsc_style_alert; ?>">
  47. <span style="<?php echo $gsc_style_alert_icon; ?>">
  48. <svg xmlns="http://www.w3.org/2000/svg" width="12" height="14" viewBox="0 0 12 14" role="img" aria-hidden="true"
  49. focusable="false" fill="#450c11">
  50. <path
  51. d="M6 1q1.6 0 3 .8T11.2 4t.8 3-.8 3T9 12.2 6 13t-3-.8T.8 10 0 7t.8-3T3 1.8 6 1zm1 9.7V9.3 9L6.7 9H5l-.1.3V10.9l.3.1h1.6l.1-.3zm0-2.6L7 3.2v-.1L6.8 3H5 5l-.1.2.1 4.9.3.2h1.4l.2-.1Q7 8 6.9 8z"></path>
  52. </svg>
  53. </span>
  54. <span style="<?php echo $gsc_style_alert_content; ?>"><?php echo $gsc_notification; ?></span>
  55. </div>
  56. <?php