PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/berry/lib/berry/piles/except.php

http://goodgirl.googlecode.com/
PHP | 47 lines | 27 code | 9 blank | 11 comment | 1 complexity | 6ca2a939c391db6992a8415b6434dbce MD5 | raw file
  1. <?php /* `,
  2. ,\, #
  3. B E R R Y |/ ?
  4. <http://goodgirl.ru/berry> | ~ )\
  5. <http://goodgirl.ru/berry/license> /__/\ \____
  6. / \_/ \
  7. ???? zloy ? ???????? <http://lexa.cutenews.ru> / <_ ____,_-/\ __
  8. ---------------------------------------------------------/___/_____ \--'\|/----
  9. \/|*/
  10. class Piles_Except extends Except {
  11. ////////////////////////////////////////////////////////////////////////////////
  12. function __construct($message, $string){
  13. $message = explode(':', trim(strip_tags($message)));
  14. $this->message = $message[0];
  15. $this->string = $string;
  16. $this->code = preg_replace('/(.*?)(T\_([A-Z_]+))(.*?)/e', "constant('\\2')", $message[0]);
  17. $this->file = 'eval()';
  18. $this->line = strrchr(end($message), ' '); }
  19. ////////////////////////////////////////////////////////////////////////////////
  20. function __toString(){
  21. $result = '<h2>'.$this->message.'</h2>';
  22. $result .= '<h3>Line: <a href="#'.$this->line.'">'.$this->line.'</a>.</h3>';
  23. $result .= '<table>';
  24. foreach (explode("\n", $this->string) as $k => $v){
  25. $bg = $this->colors[++$k == $this->line];
  26. $result .= '<tr>';
  27. $result .= '<td style="background: #'.$bg[0].'; padding: 5px; text-align: center;">';
  28. $result .= '<a name="'.$k.'"></a>'.$k;
  29. $result .= '</td>';
  30. $result .= '<td style="background: #'.$bg[1].'; padding: 5px;">';
  31. $result .= '<pre>'.str::unhtml($v).'</pre>';
  32. $result .= '</td>';
  33. $result .= '</tr>';
  34. }
  35. return $result.'</table>';
  36. }
  37. ////////////////////////////////////////////////////////////////////////////////
  38. }