You are here

public static function PHPExcel_Shared_File::sys_get_temp_dir in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/File.php \PHPExcel_Shared_File::sys_get_temp_dir()

* Get the systems temporary directory. * *

Return value

string

9 calls to PHPExcel_Shared_File::sys_get_temp_dir()
PHPExcel_CachedObjectStorage_DiscISAM::__construct in vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php
* Initialise this new cell collection * *
PHPExcel_Shared_OLE_PPS_Root::save in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE/PPS/Root.php
* Method for saving the whole OLE container (including files). * In fact, if called with an empty argument (or '-'), it saves to a * temporary file and then outputs it's contents to stdout. * If a resource pointer to a stream created…
PHPExcel_Shared_OLE_PPS_Root::__construct in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE/PPS/Root.php
*
PHPExcel_Shared_XMLWriter::__construct in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/XMLWriter.php
* Create a new PHPExcel_Shared_XMLWriter instance * *
PHPExcel_Shared_ZipArchive::open in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/ZipArchive.php
* Open a new zip archive * *

... See full list

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/File.php, line 135

Class

PHPExcel_Shared_File
PHPExcel_Shared_File

Code

public static function sys_get_temp_dir() {
  if (self::$_useUploadTempDirectory) {

    //  use upload-directory when defined to allow running on environments having very restricted
    //      open_basedir configs
    if (ini_get('upload_tmp_dir') !== FALSE) {
      if ($temp = ini_get('upload_tmp_dir')) {
        if (file_exists($temp)) {
          return realpath($temp);
        }
      }
    }
  }

  // sys_get_temp_dir is only available since PHP 5.2.1
  // http://php.net/manual/en/function.sys-get-temp-dir.php#94119
  if (!function_exists('sys_get_temp_dir')) {
    if ($temp = getenv('TMP')) {
      if (!empty($temp) && file_exists($temp)) {
        return realpath($temp);
      }
    }
    if ($temp = getenv('TEMP')) {
      if (!empty($temp) && file_exists($temp)) {
        return realpath($temp);
      }
    }
    if ($temp = getenv('TMPDIR')) {
      if (!empty($temp) && file_exists($temp)) {
        return realpath($temp);
      }
    }

    // trick for creating a file in system's temporary dir
    // without knowing the path of the system's temporary dir
    $temp = tempnam(__FILE__, '');
    if (file_exists($temp)) {
      unlink($temp);
      return realpath(dirname($temp));
    }
    return null;
  }

  // use ordinary built-in PHP function
  //	There should be no problem with the 5.2.4 Suhosin realpath() bug, because this line should only
  //		be called if we're running 5.2.1 or earlier
  return realpath(sys_get_temp_dir());
}