Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class PhpCompatStream
- {
- private $handle = null;
- function stream_open($path, $mode, $options, &$opened_path)
- {
- $this->handle = fopen(substr($path, 5), $mode, $options);
- return true;
- }
- function stream_read($count)
- {
- return str_replace(
- array('<?=', '<? ', "<?\n", "<?\r", "<?\t"),
- array('<?php echo ', '<?php ', "<?php\n", "<?php\r", "<?php\t"),
- fread($this->handle, $count)
- );
- }
- function stream_write($data)
- {
- return fwrite($this->handle, $data);
- }
- function stream_tell()
- {
- return ftell($this->handle);
- }
- function stream_eof()
- {
- return feof($this->handle);
- }
- function stream_seek($offset, $whence)
- {
- return fseek($offset, $whence);
- }
- }
- stream_wrapper_register('pc', 'PhpCompatStream');
- include 'pc://./test.php';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement