Guest User

Untitled

a guest
Jul 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <?php
  2. function translator(){
  3. # not used right. =-=-=-= if($ob == null){ echo '<div style="visibility: visible!important; opacity: 1.0!important; display: block!important; width: 98%!important; height: auto!important; overflow: hidden!important; font-size: 1.5em;">There was an XML parsing error. Translation failed permanentaly.</div>'; }
  4. $obgc = ob_get_contents();
  5. ob_end_clean();
  6.  
  7. if(!$obgc || $obgc = null){ return 'fail'; }
  8.  
  9. /* if($obgc < 1){
  10. return '<div style="visibility: visible!important; opacity: 1.0!important; display: block!important; width: 98%!important; height: auto!important; overflow: hidden!important; font-size: 1.5em;">Translation failed permanentaly. ob_start() probably didn\'t happen.</div>';
  11. }
  12. */
  13. $xml = new DOMDocument();
  14.  
  15. if($obgc === false){
  16. return '<div style="visibility: visible!important; opacity: 1.0!important; display: block!important; width: 98%!important; height: auto!important; overflow: hidden!important; font-size: 1.5em;">XML errors. Please validate page in XHTML Strict. Translation failed permanentaly.</div>';
  17. }
  18.  
  19. if (!$xml->loadxml($obgc)) {
  20. $return = '<div style="visibility: visible!important; opacity: 1.0!important; display: block!important; width: 98%!important; height: auto!important; overflow: hidden!important; font-size: 1.5em;">XML errors. Please validate page in XHTML. Translation failed permanentaly.<br /><br />';
  21. foreach (libxml_get_errors() as $error) {
  22. $return .= $error.'<br/>';
  23. }
  24. libxml_clear_errors();
  25. return $return;
  26. } else {
  27.  
  28. }
  29.  
  30. }
  31. ?>
Add Comment
Please, Sign In to add comment