1
|
<?php
|
2
|
/* SVN FILE: $Id: legacy.php 4409 2007-02-02 13:20:59Z phpnut $ */
|
3
|
/**
|
4
|
* Backwards compatibility functions.
|
5
|
*
|
6
|
* With this hack you can use clone() in PHP4 code
|
7
|
* use "clone($object)" not "clone $object"! the former works in both PHP4 and PHP5
|
8
|
*
|
9
|
* PHP versions 4 and 5
|
10
|
*
|
11
|
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
12
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
13
|
* 1785 E. Sahara Avenue, Suite 490-204
|
14
|
* Las Vegas, Nevada 89104
|
15
|
*
|
16
|
* Licensed under The MIT License
|
17
|
* Redistributions of files must retain the above copyright notice.
|
18
|
*
|
19
|
* @filesource
|
20
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
21
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
22
|
* @package cake
|
23
|
* @subpackage cake.cake.libs
|
24
|
* @since CakePHP(tm) v 0.2.9
|
25
|
* @version $Revision: 4409 $
|
26
|
* @modifiedby $LastChangedBy: phpnut $
|
27
|
* @lastmodified $Date: 2007-02-02 07:20:59 -0600 (Fri, 02 Feb 2007) $
|
28
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
29
|
*/
|
30
|
if (version_compare(phpversion(), '5.0') < 0) {
|
31
|
eval ('
|
32
|
function clone($object)
|
33
|
{
|
34
|
return $object;
|
35
|
}');
|
36
|
}
|
37
|
/**
|
38
|
* Replace file_get_contents()
|
39
|
*
|
40
|
* @internal resource_context is not supported
|
41
|
* @since PHP 5
|
42
|
* require PHP 4.0.0 (user_error)
|
43
|
*
|
44
|
* @param unknown_type $filename
|
45
|
* @param unknown_type $incpath
|
46
|
* @return unknown
|
47
|
*/
|
48
|
if (!function_exists('file_get_contents')) {
|
49
|
function file_get_contents($filename, $incpath = false) {
|
50
|
if (false === $fh = fopen($filename, 'rb', $incpath)) {
|
51
|
user_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING);
|
52
|
return false;
|
53
|
}
|
54
|
clearstatcache();
|
55
|
|
56
|
if ($fsize = @filesize($filename)) {
|
57
|
$data = fread($fh, $fsize);
|
58
|
} else {
|
59
|
$data='';
|
60
|
|
61
|
while(!feof($fh)) {
|
62
|
$data .= fread($fh, 8192);
|
63
|
}
|
64
|
}
|
65
|
fclose ($fh);
|
66
|
return $data;
|
67
|
}
|
68
|
}
|
69
|
?>
|