PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/WebsiteFiles/admin/bin/pear/Compat/Function/file_get_contents.php

https://github.com/mcherryleigh/seniordesign
PHP | 60 lines | 23 code | 7 blank | 30 comment | 5 complexity | 54f0bd3b7ea2cb199feed895feb06a0b MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4 |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2004 The PHP Group |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 3.0 of the PHP license, |
  9. // | that is bundled with this package in the file LICENSE, and is |
  10. // | available at through the world-wide-web at |
  11. // | http://www.php.net/license/3_0.txt. |
  12. // | If you did not receive a copy of the PHP license and are unable to |
  13. // | obtain it through the world-wide-web, please send a note to |
  14. // | license@php.net so we can mail you a copy immediately. |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Aidan Lister <aidan@php.net> |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: file_get_contents.php,v 1.14 2004/06/12 06:53:00 aidan Exp $
  20. //
  21. /**
  22. * Replace file_get_contents()
  23. *
  24. * @category PHP
  25. * @package PHP_Compat
  26. * @link http://php.net/function.file_get_contents
  27. * @author Aidan Lister <aidan@php.net>
  28. * @version $Revision: 1.14 $
  29. * @internal $resource_context is not supported
  30. * @since PHP 5
  31. */
  32. if (!function_exists('file_get_contents'))
  33. {
  34. function file_get_contents ($filename, $incpath = false, $resource_context = null)
  35. {
  36. if ($fh = @fopen($filename, 'rb', $incpath) === false) {
  37. trigger_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING);
  38. return false;
  39. }
  40. clearstatcache();
  41. if ($fsize = filesize($filename)) {
  42. $data = fread($fh, $fsize);
  43. }
  44. else {
  45. while (!feof($fh)) {
  46. $data .= fread($fh, 8192);
  47. }
  48. }
  49. fclose($fh);
  50. return $data;
  51. }
  52. }
  53. ?>