6 | | {{{ |
7 | | /** |
8 | | * Return the requested compatibility string, when available. |
9 | | * |
10 | | * @since 5.6.0 |
11 | | * |
12 | | * @param string $key The key for the particular string. |
13 | | * Default is false. |
14 | | * @param string $name Plugin or theme name. |
15 | | * |
16 | | * @return string The appropriate compatibilty string. |
17 | | */ |
18 | | function wp_get_compatibility_string( $key = false, $name = '' ) { |
19 | | static $strings = array(); |
20 | | |
21 | | if ( empty( $strings ) ) { |
22 | | $strings = array( |
23 | | 'theme_incompatible_wp_php' => __( 'This theme doesn’t work with your versions of WordPress and PHP.' ), |
24 | | 'plugin_incompatible_wp_php' => __( 'This plugin doesn’t work with your versions of WordPress and PHP.' ), |
25 | | 'core_update_incompatible_wp_php' => __( 'This update doesn’t work with your versions of WordPress and PHP.' ), |
26 | | 'theme_incompatible_wp' => __( 'This theme doesn’t work with your version of WordPress.' ), |
27 | | 'plugin_incompatible_wp' => __( 'This plugin doesn’t work with your version of WordPress.' ), |
28 | | 'core_update_incompatible_wp' => __( 'This update doesn’t work with your version of WordPress.' ), |
29 | | 'theme_incompatible_php' => __( 'This theme doesn’t work with your version of PHP.' ), |
30 | | 'plugin_incompatible_php' => __( 'This plugin doesn’t work with your version of PHP.' ), |
31 | | 'core_update_incompatible_php' => __( 'This update doesn’t work with your version of PHP.' ), |
32 | | ); |
33 | | } |
34 | | |
35 | | if ( array_key_exists( $key, $strings ) ) { |
36 | | return $strings[ $key ]; |
37 | | } |
38 | | |
39 | | if ( $name ) { |
40 | | $names = array( |
41 | | /* translators: 1: plugin or theme name */ |
42 | | '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 ), |
43 | | /* translators: 1: plugin or theme name */ |
44 | | 'update_incompatible_wp' => sprintf( __( 'There is a new version of %s available, but it doesn’t work with your version of WordPress.' ), $name ), |
45 | | /* translators: 1: plugin or theme name */ |
46 | | 'update_incompatible_php' => sprintf( __( 'There is a new version of %s available, but it doesn’t work with your version of PHP.' ), $name ), |
47 | | ); |
48 | | |
49 | | if ( array_key_exists( $key, $names ) ) { |
50 | | return $names[ $key ]; |
51 | | } |
52 | | } |
53 | | |
54 | | return ''; |
55 | | } |
56 | | }}} |
| 7 | It's a tiny tiny performance boost. |