コード例 #1
0
 /**
  * Safely get file content.
  *
  * @since  1.1.4
  * @global object $wp_filesystem
  * @param  string $file File path.
  * @return bool
  */
 public function get_file($file)
 {
     if (!function_exists('WP_Filesystem')) {
         include_once ABSPATH . '/wp-admin/includes/file.php';
     }
     WP_Filesystem();
     global $wp_filesystem;
     $result = '';
     if ($wp_filesystem->abspath()) {
         $result = $wp_filesystem->get_contents($file);
     } else {
         $result = Cherry_Toolkit::get_file($file);
     }
     return $result;
 }