Skip to content

Instantly share code, notes, and snippets.

@hellofromtonya
Last active October 15, 2020 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellofromtonya/97598830d1f3da23a111778d84386c70 to your computer and use it in GitHub Desktop.
Save hellofromtonya/97598830d1f3da23a111778d84386c70 to your computer and use it in GitHub Desktop.
Ticket 50787 WordPress Core
/**
* Return compatibility strings.
*
* @since 5.6.0
*
* @param string $key The key for the particular string.
* Default is false.
* @param string $name Plugin or theme name.
*
* @return string The appropriate compatibilty string.
*/
function wp_get_compatibility_string( $key = false, $name = '' ) {
static $strings = [];
if ( empty( $strings ) ) {
$strings = [
'theme_incompatible_wp_php' => __( 'This theme doesn’t work with your versions of WordPress and PHP.' ),
'plugin_incompatible_wp_php' => __( 'This plugin doesn’t work with your versions of WordPress and PHP.' ),
'core_update_incompatible_wp_php' => __( 'This update doesn’t work with your versions of WordPress and PHP.' ),
'theme_incompatible_wp' => __( 'This theme doesn’t work with your version of WordPress.' ),
'plugin_incompatible_wp' => __( 'This plugin doesn’t work with your version of WordPress.' ),
'core_update_incompatible_wp' => __( 'This update doesn’t work with your version of WordPress.' ),
'theme_incompatible_php' => __( 'This theme doesn’t work with your version of PHP.' ),
'plugin_incompatible_php' => __( 'This plugin doesn’t work with your version of PHP.' ),
'core_update_incompatible_php' => __( 'This update doesn’t work with your version of PHP.' ),
];
}
if ( array_key_exists( $key, $strings ) ) {
return $strings[ $key ];
}
if ( $name ) {
$names = [
/* translators: 1: plugin or theme name */
'update_incompatible_wp_php' => sprintf( __( 'There is a new version of %s available, but it doesn’t work with your versions of WordPress and PHP.' ), $name ),
/* translators: 1: plugin or theme name */
'update_incompatible_wp' => sprintf( __( 'There is a new version of %s available, but it doesn’t work with your version of WordPress.' ), $name ),
/* translators: 1: plugin or theme name */
'update_incompatible_php' => sprintf( __( 'There is a new version of %s available, but it doesn’t work with your version of PHP.' ), $name ),
];
if ( array_key_exists( $key, $names ) ) {
return $names[ $key ];
}
}
return '';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment