class-link-compatibility-notifier.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Links
  6. */
  7. /**
  8. * Represents compatibility with php version 5.3.
  9. */
  10. class WPSEO_Link_Compatibility_Notifier {
  11. /**
  12. * Notification id.
  13. *
  14. * @var string
  15. */
  16. const NOTIFICATION_ID = 'wpseo-links-compatibility';
  17. /**
  18. * Adds the notification to the notification center.
  19. */
  20. public function add_notification() {
  21. Yoast_Notification_Center::get()->add_notification( $this->get_notification() );
  22. }
  23. /**
  24. * Removes the notification from the notification center.
  25. */
  26. public function remove_notification() {
  27. Yoast_Notification_Center::get()->remove_notification( $this->get_notification() );
  28. }
  29. /**
  30. * Returns the notification when the version is incompatible.
  31. *
  32. * @return Yoast_Notification The notification.
  33. */
  34. protected function get_notification() {
  35. return new Yoast_Notification(
  36. sprintf(
  37. /* translators: %1$s: Yoast SEO. %2$s: Version number of Yoast SEO. */
  38. esc_html__( 'The %3$sText link counter%4$s feature (introduced in %1$s %2$s) is currently disabled.', 'wordpress-seo' ),
  39. 'Yoast SEO',
  40. '5.0',
  41. '<strong>',
  42. '</strong>'
  43. ) . ' ' .
  44. sprintf(
  45. /* translators: %1$s: Yoast SEO. %2$s: PHP version %3$s: The current PHP version. */
  46. esc_html__( 'For this feature to work %1$s requires at least PHP version %2$s. We have detected PHP version %3$s on this website.', 'wordpress-seo' ),
  47. 'Yoast SEO',
  48. '5.3',
  49. phpversion()
  50. ) . '<br>' .
  51. sprintf(
  52. /* translators: %1$s: link to knowledge base article about solving PHP issue. %2$s: is anchor closing. */
  53. esc_html__( 'Please read the following %1$sknowledge base article%2$s to find out how to resolve this problem.', 'wordpress-seo' ),
  54. '<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/16f' ) . '" target="_blank">',
  55. '</a>'
  56. ),
  57. [
  58. 'type' => Yoast_Notification::WARNING,
  59. 'id' => self::NOTIFICATION_ID,
  60. 'capabilities' => 'wpseo_manage_options',
  61. 'priority' => 0.8,
  62. ]
  63. );
  64. }
  65. }