gingerbeardman

mollify editor plugin

Jul 2nd, 2011
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2.     class EditFileViewer extends FullDocumentViewer {
  3.         protected function getHtml($item, $full) {
  4.             $resourceUrl = $this->getResourceUrl();
  5.             $settings = $this->getSettings();
  6.  
  7.             // read file
  8.             $html  = '';
  9.             $stream = $item->read();
  10.             while (!feof($stream))
  11.                 $html .= fread($stream, 1024);
  12.             fclose($stream);
  13.  
  14.             return <<<HTML
  15. <html>
  16. <head>
  17.     <title>{$item->name()}</title>
  18.     <style type="text/css">
  19.         textarea {
  20.             font: normal normal normal 1em/1.5em "Courier New", Courier, serif;
  21.             width:100%;
  22.             height:100%
  23.         }
  24.     </style>
  25. </head>
  26. <body>
  27.     <textarea>$html</textarea>
  28. </body>
  29. </html>
  30. HTML;
  31.         }
  32.     }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment