You are here

function _feeds_xls_load_phpexcel in Feeds XLS 7

2 calls to _feeds_xls_load_phpexcel()
feeds_xls_load_phpexcel in ./feeds_xls.module
Simple helper function to load the PHPExcel class file(s)
feeds_xls_requirements in ./feeds_xls.install
Implementation of hook_requirements().

File

./feeds_xls.install, line 36

Code

function _feeds_xls_load_phpexcel() {
  static $path = FALSE;
  if (!$path) {
    if (function_exists('libraries_get_path') && ($path = libraries_get_path('PHPExcel')) != FALSE) {
      if (file_exists("{$path}/Classes/PHPExcel/IOFactory.php")) {
        $path = "{$path}/Classes/PHPExcel/IOFactory.php";
      }
      elseif (file_exists("{$path}/PHPExcel/IOFactory.php")) {
        $path = "{$path}/PHPExcel/IOFactory.php";
      }
    }
    else {
      $path_guess = drupal_get_path('module', 'feeds_xls');
      $path_guess2 = $path_guess . '/PHPExcel/PHPExcel/IOFactory.php';
      $path_guess = $path_guess . '/PHPExcel/Classes/PHPExcel/IOFactory.php';
      if (file_exists($path_guess)) {
        $path = $path_guess;
      }
      elseif (file_exists($path_guess2)) {
        $path = $path_guess2;
      }
    }
    if ($path) {
      require_once $path;
    }
  }
  return $path;
}