PluginProbe
Code Profiler – WordPress Performance Profiling and Debugging Made Easy / 1.6
Code Profiler – WordPress Performance Profiling and Debugging Made Easy v1.6
1.9.5 1.9.4 1.9.3 trunk 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.6 1.6.1 1.6.10 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 All 40 releases
← All changes | lib/class-stream.php +37 -35 1.51.6 View file →
@@ -1,6 +1,6 @@
1 1 <?php
2 -/*
2 +/**
3 3 +=====================================================================+
4 4 | ____ _ ____ __ _ _ |
5 5 | / ___|___ __| | ___ | _ \ _ __ ___ / _(_) | ___ _ __ |
6 6 | | | / _ \ / _` |/ _ \ | |_) | '__/ _ \| |_| | |/ _ \ '__| |
@@ -49,9 +49,9 @@
49 49 public static function stop() {
50 50 stream_wrapper_restore( self::$protocol );
51 51 }
52 52
53 - /*
53 + /**
54 54 * Opens file or URL
55 55 */
56 56 public function stream_open( $path, $mode, $options, &$opened_path ) {
57 57 self::$io_stats['open']++;
@@ -67,9 +67,9 @@
67 67 }
68 68 return $this->resource !== false;
69 69 }
70 70
71 - /*
71 + /**
72 72 * Close a resource
73 73 */
74 74 public function stream_close() {
75 75 self::$io_stats['close']++;
@@ -75,9 +75,9 @@
75 75 self::$io_stats['close']++;
76 76 return fclose( $this->resource );
77 77 }
78 78
79 - /*
79 + /**
80 80 * Tests for end-of-file on a file pointer
81 81 */
82 82 public function stream_eof() {
83 83 self::$io_stats['eof']++;
@@ -83,9 +83,9 @@
83 83 self::$io_stats['eof']++;
84 84 return feof( $this->resource );
85 85 }
86 86
87 - /*
87 + /**
88 88 * Flushes the output
89 89 */
90 90 public function stream_flush() {
91 91 self::$io_stats['flush']++;
@@ -91,9 +91,9 @@
91 91 self::$io_stats['flush']++;
92 92 return fflush( $this->resource );
93 93 }
94 94
95 - /*
95 + /**
96 96 * Seeks to specific location in a stream
97 97 */
98 98 public function stream_seek( $offset, $whence = SEEK_SET ) {
99 99 self::$io_stats['seek']++;
@@ -99,9 +99,9 @@
99 99 self::$io_stats['seek']++;
100 100 return fseek( $this->resource, $offset, $whence ) === 0;
101 101 }
102 102
103 - /*
103 + /**
104 104 * Delete a file
105 105 */
106 106 public function unlink( $path ) {
107 107 self::$io_stats['unlink']++;
@@ -114,9 +114,9 @@
114 114 self::start();
115 115 return $res;
116 116 }
117 117
118 - /*
118 + /**
119 119 * Renames a file or directory
120 120 */
121 121 public function rename( $path_from, $path_to ) {
122 122 self::$io_stats['rename']++;
@@ -129,9 +129,9 @@
129 129 self::start();
130 130 return $res;
131 131 }
132 132
133 - /*
133 + /**
134 134 * Removes a directory
135 135 */
136 136 public function rmdir( $path, $options ) {
137 137 self::$io_stats['rmdir']++;
@@ -144,9 +144,9 @@
144 144 self::start();
145 145 return $res;
146 146 }
147 147
148 - /*
148 + /**
149 149 * Retrieve the underlaying resource
150 150 */
151 151 public function stream_cast( $cast_as ) {
152 152 self::$io_stats['cast']++;
@@ -152,9 +152,9 @@
152 152 self::$io_stats['cast']++;
153 153 return $this->resource;
154 154 }
155 155
156 - /*
156 + /**
157 157 * Advisory file locking
158 158 */
159 159 public function stream_lock( $operation ) {
160 160 self::$io_stats['lock']++;
@@ -163,9 +163,9 @@
163 163 }
164 164 return flock( $this->resource, $operation );
165 165 }
166 166
167 - /*
167 + /**
168 168 * Truncate stream
169 169 */
170 170 public function stream_truncate( $new_size ) {
171 171 self::$io_stats['truncate']++;
@@ -179,9 +179,9 @@
179 179 self::$io_write += $write;
180 180 return $write;
181 181 }
182 182
183 - /*
183 + /**
184 184 * Change stream options
185 185 */
186 186 public function stream_set_option( $option, $arg1, $arg2 ) {
187 187 self::$io_stats['set_option']++;
@@ -198,9 +198,9 @@
198 198 return false;
199 199 }
200 200 }
201 201
202 - /*
202 + /**
203 203 * Change stream metadata
204 204 */
205 205 public function stream_metadata( $path, $option, $value ) {
206 206 self::stop();
@@ -232,9 +232,9 @@
232 232 self::start();
233 233 return $res;
234 234 }
235 235
236 - /*
236 + /**
237 237 * Create a directory
238 238 */
239 239 public function mkdir( $path, $mode, $options ) {
240 240 self::$io_stats['mkdir']++;
@@ -247,9 +247,9 @@
247 247 self::start();
248 248 return $res;
249 249 }
250 250
251 - /*
251 + /**
252 252 * Open directory handle
253 253 */
254 254 public function dir_opendir( $path, $options ) {
255 255 self::$io_stats['opendir']++;
@@ -262,9 +262,9 @@
262 262 self::start();
263 263 return $this->resource;
264 264 }
265 265
266 - /*
266 + /**
267 267 * Close directory handle
268 268 */
269 269 public function dir_closedir() {
270 270 self::$io_stats['closedir']++;
@@ -271,9 +271,9 @@
271 271 // closedir returns no value
272 272 return closedir( $this->resource );
273 273 }
274 274
275 - /*
275 + /**
276 276 * Read entry from directory handle
277 277 */
278 278 public function dir_readdir() {
279 279 self::$io_stats['readdir']++;
@@ -279,9 +279,9 @@
279 279 self::$io_stats['readdir']++;
280 280 return readdir( $this->resource );
281 281 }
282 282
283 - /*
283 + /**
284 284 * Rewind directory handle
285 285 */
286 286 public function dir_rewinddir() {
287 287 self::$io_stats['rewinddir']++;
@@ -287,9 +287,9 @@
287 287 self::$io_stats['rewinddir']++;
288 288 return rewinddir( $this->resource );
289 289 }
290 290
291 - /*
291 + /**
292 292 * Retrieve information about a file
293 293 */
294 294 public function url_stat( $path, $flags ) {
295 295 self::$io_stats['url_stat']++;
@@ -305,32 +305,34 @@
305 305 self::start();
306 306 return $res;
307 307 }
308 308
309 - /*
309 + /**
310 310 * Read from stream & enable ticks
311 311 */
312 312 public function stream_read( $count ) {
313 313 self::$io_stats['read']++;
314 - self::stop();
315 - if ( $this->script && ftell( $this->resource ) == 0 ) {
314 + if ( $this->script ) {
315 + self::stop();
316 + if ( ftell( $this->resource ) == 0 ) {
317 + self::start();
318 + $read = fread( $this->resource, $count - CODE_PROFILER_LENGTH );
319 + self::$io_read += strlen( $read );
320 + return preg_replace(
321 + '/<\?php/i',
322 + '<?php declare(ticks='. CODE_PROFILER_TICKS .');',
323 + $read,
324 + 1
325 + );
326 + }
316 327 self::start();
317 - $read = fread( $this->resource, $count - CODE_PROFILER_LENGTH );
318 - self::$io_read += strlen( $read );
319 - return preg_replace(
320 - '/<\?php/i',
321 - '<?php declare(ticks='. CODE_PROFILER_TICKS .');',
322 - $read,
323 - 1
324 - );
325 328 }
326 - self::start();
327 329 $read = fread( $this->resource, $count );
328 330 self::$io_read += strlen( $read );
329 331 return $read;
330 - }
332 + }
331 333
332 - /*
334 + /**
333 335 * Retrieve information about a file resource
334 336 */
335 337 public function stream_stat() {
336 338 self::$io_stats['stat']++;
@@ -341,9 +343,9 @@
341 343 }
342 344 return $res;
343 345 }
344 346
345 - /*
347 + /**
346 348 * Retrieve the current position of a stream
347 349 */
348 350 function stream_tell() {
349 351 self::$io_stats['tell']++;