diff --git a/src/Whip_Configuration.php b/src/Whip_Configuration.php index aa66d55..4b6aa32 100644 --- a/src/Whip_Configuration.php +++ b/src/Whip_Configuration.php @@ -19,7 +19,7 @@ class Whip_Configuration { */ public function __construct( $configuration = array() ) { if ( ! is_array( $configuration ) ) { - throw new Whip_InvalidType( "Configuration", gettype( $configuration), "array" ); + throw new Whip_InvalidType( 'Configuration', gettype( $configuration), "array" ); } $this->configuration = $configuration; diff --git a/src/Whip_VersionRequirement.php b/src/Whip_VersionRequirement.php index 38846e2..d12df82 100644 --- a/src/Whip_VersionRequirement.php +++ b/src/Whip_VersionRequirement.php @@ -103,23 +103,23 @@ public static function fromCompareString( $component, $comparisonString ) { */ private function validateParameters( $component, $version, $operator ) { if ( empty( $component ) ) { - throw new Whip_EmptyProperty( "Component" ); + throw new Whip_EmptyProperty( 'Component' ); } if ( !is_string( $component ) ) { - throw new Whip_InvalidType( "Component", "string", $component ); + throw new Whip_InvalidType( 'Component', 'string', $component ); } if ( empty( $version ) ) { - throw new Whip_EmptyProperty( "Version" ); + throw new Whip_EmptyProperty( 'Version' ); } if ( !is_string( $version ) ) { - throw new Whip_InvalidType( "Version", "string", $version ); + throw new Whip_InvalidType( 'Version', 'string', $version ); } if ( empty( $operator ) ) { - throw new Whip_EmptyProperty( "Operator" ); + throw new Whip_EmptyProperty( 'Operator' ); } if ( !is_string( $operator ) ) { diff --git a/src/exceptions/Whip_EmptyProperty.php b/src/exceptions/Whip_EmptyProperty.php index d623819..423ecf2 100644 --- a/src/exceptions/Whip_EmptyProperty.php +++ b/src/exceptions/Whip_EmptyProperty.php @@ -5,6 +5,6 @@ */ class Whip_EmptyProperty extends Exception { public function __construct( $property ) { - parent::__construct( sprintf( "%s cannot be empty.", (string) $property ) ); + parent::__construct( sprintf( '%s cannot be empty.', (string) $property ) ); } } diff --git a/src/exceptions/Whip_InvalidType.php b/src/exceptions/Whip_InvalidType.php index 53dcac1..9801d91 100644 --- a/src/exceptions/Whip_InvalidType.php +++ b/src/exceptions/Whip_InvalidType.php @@ -13,6 +13,6 @@ class Whip_InvalidType extends Exception { * @param string $expectedType */ public function __construct( $property, $value, $expectedType ) { - parent::__construct( sprintf( "%s should be of type %s. Found %s.", $property, $expectedType, gettype( $value ) ) ); + parent::__construct( sprintf( '%s should be of type %s. Found %s.', $property, $expectedType, gettype( $value ) ) ); } } diff --git a/src/messages/Whip_BasicMessage.php b/src/messages/Whip_BasicMessage.php index 2a8e20f..4e1ec33 100644 --- a/src/messages/Whip_BasicMessage.php +++ b/src/messages/Whip_BasicMessage.php @@ -32,11 +32,11 @@ public function body() { private function validateParameters( $body ) { if ( empty( $body ) ) { - throw new Whip_EmptyProperty( "Message body" ); + throw new Whip_EmptyProperty( 'Message body' ); } if ( ! is_string( $body ) ) { - throw new Whip_InvalidType( "Message body", "string", $body ); + throw new Whip_InvalidType( 'Message body', "string", $body ); } } } diff --git a/src/messages/Whip_UpgradePhpMessage.php b/src/messages/Whip_UpgradePhpMessage.php index 3e47dfa..d4953b2 100644 --- a/src/messages/Whip_UpgradePhpMessage.php +++ b/src/messages/Whip_UpgradePhpMessage.php @@ -32,7 +32,7 @@ public function body() { $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 ) ); $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 ) ); $message[] = Whip_MessageFormatter::strongParagraph( __( 'To which version should I update?', $textdomain ) ) . '
'; - $message[] = Whip_MessageFormatter::paragraph( __( '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 here. 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 ) ); + $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 ), '', '' ) ); if ( Whip_Host::name() !== '' ) { $hostMessage = new Whip_HostMessage( 'WHIP_MESSAGE_FROM_HOST_ABOUT_PHP', $textdomain ); @@ -44,7 +44,7 @@ public function body() { $message[] = Whip_MessageFormatter::strongParagraph( __( 'Can\'t update? Ask your host!', $textdomain ) ) . '
'; if ( function_exists( 'apply_filters' ) && apply_filters( Whip_Host::HOSTING_PAGE_FILTER_KEY, false ) ) { - $message[] = Whip_MessageFormatter::paragraph( sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. We have examples here. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', $textdomain ), sprintf( '', esc_url( $hostingPageUrl ) ), '' ) ); + $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 ), '', '', sprintf( '', esc_url( $hostingPageUrl ) ), '' ) ); } else { $message[] = Whip_MessageFormatter::paragraph( sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. We have examples here. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of our recommended %1$sWordPress hosting partners%2$s, they\'ve all been vetted by our Yoast support team and provide all the features a modern host should provide.', $textdomain ), sprintf( '', esc_url( $hostingPageUrl ) ), '' ) ); } diff --git a/src/presenters/Whip_WPMessagePresenter.php b/src/presenters/Whip_WPMessagePresenter.php index b088569..dff2281 100644 --- a/src/presenters/Whip_WPMessagePresenter.php +++ b/src/presenters/Whip_WPMessagePresenter.php @@ -46,6 +46,8 @@ public function kses( $message ) { ), 'strong' => true, 'p' => true, + 'ul' => true, + 'li' => true, ) ); } } diff --git a/tests/MessageTest.php b/tests/MessageTest.php index 73b90ad..1775724 100644 --- a/tests/MessageTest.php +++ b/tests/MessageTest.php @@ -2,7 +2,7 @@ class MessageTest extends PHPUnit_Framework_TestCase { public function testMessageHasBody() { - $message = new Whip_BasicMessage( "This is a message" ); + $message = new Whip_BasicMessage( 'This is a message' ); $this->assertNotEmpty($message->body()); } @@ -11,7 +11,7 @@ public function testMessageHasBody() { * @expectedException Whip_EmptyProperty */ public function testMessageCannotBeEmpty() { - new Whip_BasicMessage( "" ); + new Whip_BasicMessage( '' ); } /**