TYPO3 CMS  TYPO3_6-2
PhpInfoViewHelper.php
Go to the documentation of this file.
1 <?php
3 
23 
30  protected $escapingInterceptorEnabled = FALSE;
31 
37  public function render() {
38  return $this->removeAllHtmlOutsideBody(
39  $this->changeHtmlToHtml5(
40  $this->getPhpInfo()
41  )
42  );
43  }
44 
50  public function getPhpInfo() {
51  ob_start();
52  phpinfo();
53 
54  return ob_get_clean();
55  }
56 
63  protected function removeAllHtmlOutsideBody($html) {
64  // Delete anything outside of the body tag and the body tag itself
65  $html = preg_replace('/^.*?<body.*?>/is', '', $html);
66  $html = preg_replace('/<\/body>.*?$/is', '', $html);
67 
68  return $html;
69  }
70 
77  protected function changeHtmlToHtml5($html) {
78  // Delete obsolete attributes
79  $html = preg_replace('#\s(cellpadding|border|width)="[^"]+"#', '', $html);
80 
81  // Replace font tag with span
82  return str_replace(array('<font', '</font>'), array('<span', '</span>'), $html);
83  }
84 }