### Eclipse Workspace Patch 1.0
#P Vagrant local Trunk
|
|
|
116 | 116 | * or if the file doesn't exist. |
117 | 117 | */ |
118 | 118 | public function get_contents( $file ) { |
119 | | if ( ! $this->exists($file) ) |
| 119 | if ( ! $this->exists( $file ) ) { |
120 | 120 | return false; |
121 | | |
| 121 | } |
| 122 | |
122 | 123 | $temp = wp_tempnam( $file ); |
123 | 124 | |
124 | | if ( ! $temphandle = fopen($temp, 'w+') ) |
| 125 | if ( ! $temphandle = fopen( $temp, 'w+' ) ) { |
| 126 | unlink( $temp ); |
125 | 127 | return false; |
126 | | |
| 128 | } |
| 129 | |
127 | 130 | mbstring_binary_safe_encoding(); |
128 | 131 | |
129 | | if ( ! $this->ftp->fget($temphandle, $file) ) { |
130 | | fclose($temphandle); |
131 | | unlink($temp); |
| 132 | if ( ! $this->ftp->fget( $temphandle, $file ) ) { |
| 133 | fclose( $temphandle ); |
| 134 | unlink( $temp ); |
132 | 135 | |
133 | 136 | reset_mbstring_encoding(); |
134 | 137 | |
… |
… |
|
140 | 143 | fseek( $temphandle, 0 ); // Skip back to the start of the file being written to |
141 | 144 | $contents = ''; |
142 | 145 | |
143 | | while ( ! feof($temphandle) ) |
144 | | $contents .= fread($temphandle, 8192); |
| 146 | while ( ! feof( $temphandle ) ) { |
| 147 | $contents .= fread( $temphandle, 8192 ); |
| 148 | } |
145 | 149 | |
146 | | fclose($temphandle); |
147 | | unlink($temp); |
| 150 | fclose( $temphandle ); |
| 151 | unlink( $temp ); |
148 | 152 | return $contents; |
149 | 153 | } |
150 | 154 | |