Skip to content
Snippets Groups Projects
Commit 53d40709 authored by Wouter Wolters's avatar Wouter Wolters Committed by Christian Kuhn
Browse files

[TASK] Move PhpInfo utility to a ViewHelper

Resolves: #57124
Related: #55116
Releases: 6.2
Change-Id: I26ce6a340c06f6dfccf255b9b6c9424d9bd70efb
Reviewed-on: https://review.typo3.org/28583
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny
Reviewed-by: Helmut Hummel
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
parent ee6b726c
Branches
Tags
No related merge requests found
......@@ -46,10 +46,6 @@ class SystemEnvironment extends Action\AbstractAction {
$sortedStatusObjects = $statusUtility->sortBySeverity($statusObjects);
$this->view->assign('statusObjectsBySeverity', $sortedStatusObjects);
/** @var $statusUtility \TYPO3\CMS\Install\Utility\PhpInfo */
$phpInfoUtility = $this->objectManager->get('TYPO3\\CMS\\Install\\Utility\\PhpInfo');
$this->view->assign('phpInfo', $phpInfoUtility->getBodyContent());
return $this->view->render();
}
......
<?php
namespace TYPO3\CMS\Install\Utility;
namespace TYPO3\CMS\Install\ViewHelpers;
/***************************************************************
* Copyright notice
......@@ -29,14 +29,22 @@ namespace TYPO3\CMS\Install\Utility;
*
* @author Patrick Broens <patrick@patrickbroens.nl>
*/
class PhpInfo {
class PhpInfoViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
/**
* Get the content of the body tag of phpinfo()
* Disable the escaping interceptor because otherwise the child nodes would be escaped before this view helper
* can decode the text's entities.
*
* @var boolean
*/
protected $escapingInterceptorEnabled = FALSE;
/**
* Render PHP info
*
* @return string
*/
public function getBodyContent() {
public function render() {
return $this->removeAllHtmlOutsideBody(
$this->changeHtmlToHtml5(
$this->getPhpInfo()
......@@ -63,7 +71,7 @@ class PhpInfo {
* @return string Content of the body tag
*/
protected function removeAllHtmlOutsideBody($html) {
// Delete anything outside of the body tag and the body tag itself
// Delete anything outside of the body tag and the body tag itself
$html = preg_replace('/^.*?<body.*?>/is', '', $html);
$html = preg_replace('/<\/body>.*?$/is', '', $html);
......@@ -77,12 +85,10 @@ class PhpInfo {
* @return string
*/
protected function changeHtmlToHtml5($html) {
// Delete obsolete attributes
// Delete obsolete attributes
$html = preg_replace('#\s(cellpadding|border|width)="[^"]+"#', '', $html);
// Replace font tag with span
$html = str_replace(array('<font', '</font>'), array('<span', '</span>'), $html);
return $html;
// Replace font tag with span
return str_replace(array('<font', '</font>'), array('<span', '</span>'), $html);
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@
<div class="toggleData" style="display:none">
<div class="toggleDataContent">
<f:format.raw>{phpInfo}</f:format.raw>
<i:phpInfo />
</div>
</div>
</div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment