2017 © Pedro Peláez
 

library whip

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

image

yoast/whip

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  • Monday, June 11, 2018
  • by omarreiss
  • Repository
  • 15 Watchers
  • 69 Stars
  • 84,974 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 5 Forks
  • 10 Open issues
  • 28 Versions
  • 31 % Grown

The README.md

CS Test Coverage Status, (*1)

whip

A WordPress package to nudge users to upgrade their software versions (starting with PHP), (*2)

Screenshot of the WordPress notice, (*3)

Requirements

All the PHP versions from 5.3 up to the latest are supported., (*4)

WordPress is also required for certain functionality:, (*5)

  • The WPMessagePresenter requires WordPress or a function called add_action, to hook into WordPress.
  • The PHPVersionDetector requires WordPress or a function called __, to translate strings.

Installation

$ composer require yoast/whip 

Usage

The easiest way to use Whip in WordPress is by using the included function to check the versions. In this case checking if PHP 5.6 or greater is installed:, (*6)

whip_wp_check_versions( array(
    'php' => '>=5.6',
) );

This will show a message to all users of your plugin on PHP 5.3 to PHP 5.5. By default the message will be shown on every page of the admin and to every user. It is up to the implementing plugin to restrict this to certain users and/or pages., (*7)

Adding a message as a host

It is possible to add a custom message to the PHP version message by setting specific environment variables:, (*8)

putenv( "WHIP_NAME_OF_HOST=Name of the host" );
putenv( "WHIP_MESSAGE_FROM_HOST_ABOUT_PHP=A message from the host" );

The WHIP_NAME_OF_HOST environment variable could be reused in the future for showing messages about different software packages., (*9)

Both the name and the message for PHP can also be changed using WordPress filters:, (*10)

function my_host__name_for_whip() {
    return 'Name of the host';
}
add_filter( 'whip_name_of_host', 'my_host__name_for_whip' );

function my_host__php_message_for_whip( $message ) {
    return 'A message from the host';
}
add_filter( 'whip_message_from_host_about_php', 'my_host__php_message_for_whip' );

The WordPress filters can also read the value previously set by the environment variables., (*11)

As a general rule, the filter is the same as the environment variable, but lowercased., (*12)

Linking to the WordPress.org hosting page

We have created a hosting overview page on yoast.com which only contains hosts that we've vetted. The PHP message links to this page by default. If you really prefer to link to the WordPress.org hosting page that is possible. Just use the whip_hosting_page_url_wordpress filter:, (*13)

add_filter( 'whip_hosting_page_url_wordpress', '__return_true' );

Backwards compatibility policy

We follow semantic versioning with an extra strict rule for MAJOR versions. We will do a major version bump whenever we add new methods. We have to do this because of the shared namespace in PHP. When this package will be used in multiple plugins we cannot safely add and use a method without bumping a major version. This is because the version without the new method may be autoloaded and then a fatal error occurs., (*14)

This also means that any major version bump is accompanied by an update of every namespace in the package. So for version 3 of this package all the Yoast\WHIPv2 namespaces will become Yoast\WHIPv3. This prevents fatal errors when two plugins include different versions of this package., (*15)

Changelog

Security

If you discover any security related issues, please email security@yoast.com instead of using the issue tracker., (*16)

Credits

The Versions

11/06 2018

dev-master

9999999-dev

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+ GPL-3.0-or-later

The Requires

 

The Development Requires

29/05 2018

dev-JRF/CS/add-phpcs

dev-JRF/CS/add-phpcs

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

28/05 2018

dev-JRF/minor-Travis-improvement

dev-JRF/minor-Travis-improvement

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

28/05 2018

dev-TEMP/17283

dev-TEMP/17283

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

27/03 2018

dev-JRF/CS/i18n-fixes

dev-JRF/CS/i18n-fixes

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

26/03 2018

dev-JRF/various-documentation-fixes

dev-JRF/various-documentation-fixes

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

26/03 2018

dev-JRF/clean-up-unused-property-param

dev-JRF/clean-up-unused-property-param

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

26/03 2018

dev-JRF/other-exception-related-updates

dev-JRF/other-exception-related-updates

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

26/03 2018

dev-JRF/duplicate-code-maintainability

dev-JRF/duplicate-code-maintainability

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

26/03 2018

dev-JRF/fix-calls-to-invalidtype-exception

dev-JRF/fix-calls-to-invalidtype-exception

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

13/03 2018

dev-JRF/CS/improve-regex

dev-JRF/CS/improve-regex

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

12/02 2018

dev-JRF/CS/various-documentation-fixes

dev-JRF/CS/various-documentation-fixes

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

12/02 2018

dev-JRF/CS/various-whitespace

dev-JRF/CS/various-whitespace

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

10/02 2018

dev-JRF/CS/XSS-escape-all-output

dev-JRF/CS/XSS-escape-all-output

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

10/02 2018

dev-JRF/CS/function-name-consistency

dev-JRF/CS/function-name-consistency

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

10/02 2018

dev-JRF/CS/variable-name-consistency

dev-JRF/CS/variable-name-consistency

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

10/02 2018

dev-JRF/update-gitattributes-file

dev-JRF/update-gitattributes-file

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

04/08 2017

dev-release/1.1

dev-release/1.1

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

04/08 2017

1.1.0

1.1.0.0

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

04/08 2017

1.1.0-RC2

1.1.0.0-RC2

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

01/08 2017

1.1.0-RC1

1.1.0.0-RC1

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

27/06 2017

dev-release/1.0.2

dev-release/1.0.2

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

27/06 2017

1.0.2

1.0.2.0

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

21/03 2017

1.0.1

1.0.1.0

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

11/03 2017

1.0.0

1.0.0.0

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

11/03 2017

1.0.0-beta.2

1.0.0.0-beta2

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

21/02 2017

dev-jdevalk/strip_tags

dev-jdevalk/strip_tags

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

21/02 2017

1.0.0-beta.1

1.0.0.0-beta1

A WordPress package to nudge users to upgrade their software versions (starting with PHP)

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires