_jetpack_require_compat_file

Requires a file once, if the passed key exists in the files array.

Description

_jetpack_require_compat_file( (string) $key, (array) $files ); 

Parameters (2)

0. $key (string)
The key.
1. $files (array)
The files.

Usage

  1. if ( !function_exists( '_jetpack_require_compat_file' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/theme-tools.php'; 
  3.  
  4. // The key. 
  5. $key = ''; 
  6.  
  7. // The files. 
  8. $files = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _jetpack_require_compat_file($key, $files); 
  12.  

Defined (1)

The function is defined in the following location(s).

/modules/theme-tools.php  
  1. function _jetpack_require_compat_file( $key, $files ) { 
  2. if ( ! is_string( $key ) ) { 
  3. return new WP_Error( 'key_not_string', 'The specified key is not actually a string.', compact( 'key' ) ); 
  4.  
  5. if ( array_key_exists( $key, $files ) && is_readable( $files[ $key ] ) ) { 
  6. require_once $files[ $key ];