Whip_UpgradePhpMessage

Class Whip_UpgradePhpMessage.

Defined (1)

The class is defined in the following location(s).

/vendor/yoast/whip/src/messages/Whip_UpgradePhpMessage.php  
  1. class Whip_UpgradePhpMessage implements Whip_Message { 
  2. /** 
  3. * @var string 
  4. */ 
  5. private $textdomain; 
  6.  
  7. /** 
  8. * Whip_UpgradePhpMessage constructor. 
  9. * @param string $textdomain The text domain to use for the translations. 
  10. */ 
  11. public function __construct( $textdomain ) { 
  12. $this->textdomain = $textdomain; 
  13.  
  14. /** 
  15. * Composes the body of the message to display. 
  16. * @return string The message to display. 
  17. */ 
  18. public function body() { 
  19. $textdomain = $this->textdomain; 
  20.  
  21. $message = array(); 
  22.  
  23. $message[] = Whip_MessageFormatter::strongParagraph( __( 'Your site could be faster and more secure with a newer PHP version.', $textdomain ) ) . '<br />'; 
  24. $message[] = Whip_MessageFormatter::paragraph( __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Yoast SEO are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you to this notice.', $textdomain ) ); 
  25. $message[] = Whip_MessageFormatter::paragraph( __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', $textdomain ) ); 
  26. $message[] = Whip_MessageFormatter::strongParagraph( __( 'To which version should I update?', $textdomain ) ) . '<br />'; 
  27. $message[] = Whip_MessageFormatter::paragraph( sprintf( __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. We have an article on how to test whether that\'s an option for you %1$shere%2$s. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', $textdomain ), '<a href="https://yoa.st/wg" target="_blank">', '</a>' ) ); 
  28.  
  29. if ( Whip_Host::name() !== '' ) { 
  30. $hostMessage = new Whip_HostMessage( 'WHIP_MESSAGE_FROM_HOST_ABOUT_PHP', $textdomain ); 
  31. $message[] = $hostMessage->body(); 
  32.  
  33. $hostingPageUrl = Whip_Host::hostingPageUrl(); 
  34.  
  35. $message[] = Whip_MessageFormatter::strongParagraph( __( 'Can\'t update? Ask your host!', $textdomain ) ) . '<br />'; 
  36.  
  37. if ( function_exists( 'apply_filters' ) && apply_filters( Whip_Host::HOSTING_PAGE_FILTER_KEY, false ) ) { 
  38. $message[] = Whip_MessageFormatter::paragraph( sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. We have %1$sexamples here%2$s. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %3$sWordPress hosting partners%4$s.', $textdomain ), '<a href="https://yoa.st/wh" target="_blank">', '</a>', sprintf( '<a href="%1$s" target="_blank">', esc_url( $hostingPageUrl ) ), '</a>' ) ); 
  39. } else { 
  40. $message[] = Whip_MessageFormatter::paragraph( sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. We have %1$sexamples here%2$s. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of our recommended %3$sWordPress hosting partners%4$s, they\'ve all been vetted by our Yoast support team and provide all the features a modern host should provide.', $textdomain ), '<a href="https://yoa.st/wh" target="_blank">', '</a>', sprintf( '<a href="%1$s" target="_blank">', esc_url( $hostingPageUrl ) ), '</a>' ) ); 
  41.  
  42. return implode( $message, "\n" ); 
  43.