| @@ -1,21 +1,14 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Module: Theme Tools | |
| 4 | - * | |
| 2 | +/* | |
| 5 | 3 | * Load code specific to themes or theme tools |
| 6 | 4 | * This file is special, and is not an actual `module` as such. |
| 7 | 5 | * It is included by ./module-extras.php |
| 8 | - * | |
| 9 | - * @package automattic/jetpack | |
| 10 | 6 | */ |
| 11 | 7 | |
| 12 | -/** | |
| 13 | - * Conditionally require the Tonesque lib depending on theme support. | |
| 14 | - */ | |
| 15 | 8 | function jetpack_load_theme_tools() { |
| 16 | 9 | if ( current_theme_supports( 'tonesque' ) ) { |
| 17 | - require_once JETPACK__PLUGIN_DIR . '/_inc/lib/tonesque.php'; | |
| 10 | + jetpack_require_lib( 'tonesque' ); | |
| 18 | 11 | } |
| 19 | 12 | } |
| 20 | 13 | add_action( 'init', 'jetpack_load_theme_tools', 30 ); |
| 21 | 14 | |
| @@ -40,20 +33,15 @@ | ||
| 40 | 33 | * @since 2.8.0 |
| 41 | 34 | * |
| 42 | 35 | * @param array Associative array of theme compat files to load. |
| 43 | 36 | */ |
| 44 | - $compat_files = apply_filters( | |
| 45 | - 'jetpack_theme_compat_files', | |
| 46 | - array( | |
| 47 | - 'twentyfourteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfourteen.php', | |
| 48 | - 'twentyfifteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfifteen.php', | |
| 49 | - 'twentysixteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentysixteen.php', | |
| 50 | - 'twentyseventeen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyseventeen.php', | |
| 51 | - 'twentynineteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentynineteen.php', | |
| 52 | - 'twentytwenty' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentytwenty.php', | |
| 53 | - 'twentytwentyone' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentytwentyone.php', | |
| 54 | - ) | |
| 55 | - ); | |
| 37 | + $compat_files = apply_filters( 'jetpack_theme_compat_files', array( | |
| 38 | + 'twentyfourteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfourteen.php', | |
| 39 | + 'twentyfifteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfifteen.php', | |
| 40 | + 'twentysixteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentysixteen.php', | |
| 41 | + 'twentyseventeen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyseventeen.php', | |
| 42 | + 'twentynineteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentynineteen.php', | |
| 43 | + ) ); | |
| 56 | 44 | |
| 57 | 45 | _jetpack_require_compat_file( get_stylesheet(), $compat_files ); |
| 58 | 46 | |
| 59 | 47 | if ( is_child_theme() ) { |
| @@ -61,15 +49,16 @@ | ||
| 61 | 49 | } |
| 62 | 50 | } |
| 63 | 51 | add_action( 'after_setup_theme', 'jetpack_load_theme_compat', -1 ); |
| 64 | 52 | |
| 53 | + | |
| 65 | 54 | /** |
| 66 | 55 | * Requires a file once, if the passed key exists in the files array. |
| 67 | 56 | * |
| 68 | 57 | * @access private |
| 69 | - * @param string $key The key to check. | |
| 70 | - * @param array $files Array of files to check in. | |
| 71 | - * @return void|WP_Error | |
| 58 | + * @param string $key | |
| 59 | + * @param array $files | |
| 60 | + * @return void | |
| 72 | 61 | */ |
| 73 | 62 | function _jetpack_require_compat_file( $key, $files ) { |
| 74 | 63 | if ( ! is_string( $key ) ) { |
| 75 | 64 | return new WP_Error( 'key_not_string', 'The specified key is not actually a string.', compact( 'key' ) ); |