class-link-compatibility-notifier.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. const NOTIFICATION_ID = 'wpseo-links-compatibility';
  12. /**
  13. * Adds the notification to the notification center.
  14. */
  15. public function add_notification() {
  16. Yoast_Notification_Center::get()->add_notification( $this->get_notification() );
  17. }
  18. /**
  19. * Removes the notification from the notification center.
  20. */
  21. public function remove_notification() {
  22. Yoast_Notification_Center::get()->remove_notification( $this->get_notification() );
  23. }
  24. /**
  25. * Returns the notification when the version is incompatible
  26. *
  27. * @return Yoast_Notification The notification.
  28. */
  29. protected function get_notification() {
  30. return new Yoast_Notification(
  31. sprintf(
  32. /* translators: %1$s: Yoast SEO. %2$s: Version number of Yoast SEO. %3$s: PHP version %4$s: The current PHP versione. %5$s link to knowledge base article about solving PHP issue. %6$s: is anchor closing. */
  33. __(
  34. 'The <strong>Text link counter</strong> feature (introduced in %1$s %2$s) is currently disabled. For this feature to work %1$s requires at least PHP version %3$s. We have detected PHP version %4$s on this website.
  35. Please read the following %5$sknowledge base article%6$s to find out how to resolve this problem.',
  36. 'wordpress-seo'
  37. ),
  38. 'Yoast SEO',
  39. '5.0',
  40. '5.3',
  41. phpversion(),
  42. '<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/16f' ) . '" target="_blank">',
  43. '</a>'
  44. ),
  45. array(
  46. 'type' => Yoast_Notification::WARNING,
  47. 'id' => self::NOTIFICATION_ID,
  48. 'capabilities' => 'wpseo_manage_options',
  49. 'priority' => 0.8,
  50. )
  51. );
  52. }
  53. }