Skip to content

Commit

Permalink
Simplify ob_end usage (#41671)
Browse files Browse the repository at this point in the history
Co-authored-by: Denitz <[email protected]>
  • Loading branch information
Denitz and Denitz authored Sep 12, 2023
1 parent 0ca2b6e commit 4a5d4d5
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,7 @@ public function &getPHPInfo(): string
ob_start();
date_default_timezone_set('UTC');
phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES);
$phpInfo = ob_get_contents();
ob_end_clean();
$phpInfo = ob_get_clean();
preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpInfo, $output);
$output = preg_replace('#<table[^>]*>#', '<table class="table">', $output[1][0]);
$output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,7 @@ public function finaliseUpgrade()
}

// Create msg object; first use here.
$msg = ob_get_contents();
ob_end_clean();
$msg = ob_get_clean();

// Get a database connector object.
$db = version_compare(JVERSION, '4.2.0', 'lt') ? $this->getDbo() : $this->getDatabase();
Expand Down Expand Up @@ -782,8 +781,7 @@ public function finaliseUpgrade()
}

// Append messages.
$msg .= ob_get_contents();
ob_end_clean();
$msg .= ob_get_clean();

// Clobber any possible pending updates.
$update = new \Joomla\CMS\Table\Update($db);
Expand All @@ -804,8 +802,7 @@ public function finaliseUpgrade()
}

// Append messages.
$msg .= ob_get_contents();
ob_end_clean();
$msg .= ob_get_clean();

if ($msg != '') {
$installer->set('extension_message', $msg);
Expand Down
3 changes: 1 addition & 2 deletions libraries/src/Document/HtmlDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,7 @@ protected function _loadTemplate($directory, $filename)
// Get the file content
ob_start();
require $directory . '/' . $filename;
$contents = ob_get_contents();
ob_end_clean();
$contents = ob_get_clean();
}

return $contents;
Expand Down
3 changes: 1 addition & 2 deletions libraries/src/Layout/FileLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ public function render($displayData = [])

ob_start();
include $path;
$layoutOutput .= ob_get_contents();
ob_end_clean();
$layoutOutput .= ob_get_clean();

return $layoutOutput;
}
Expand Down
3 changes: 1 addition & 2 deletions libraries/src/MVC/View/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@ public function loadTemplate($tpl = null)

// Done with the requested template; get the buffer and
// clear it.
$this->_output = ob_get_contents();
ob_end_clean();
$this->_output = ob_get_clean();

return $this->_output;
}
Expand Down
3 changes: 1 addition & 2 deletions plugins/media-action/resize/src/Extension/Resize.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public function onContentBeforeSave($context, $item, $isNew, $data = [])

ob_start();
$imgObject->toFile(null, $type);
$item->data = ob_get_contents();
ob_end_clean();
$item->data = ob_get_clean();
}
}

0 comments on commit 4a5d4d5

Please sign in to comment.