Remove <html>, <head>, <body> tags from header and footer scripts

This commit is contained in:
Kijin Sung 2023-06-20 17:03:34 +09:00
parent 0de42bebaf
commit be6cc58311
2 changed files with 22 additions and 2 deletions

View file

@ -0,0 +1,19 @@
<?php
namespace Rhymix\Modules\Admin\Models;
class Utility
{
/**
* Clean up header and footer scripts.
*
* @param string $content
* @return string
*/
public static function cleanHeaderAndFooterScripts(string $content)
{
$content = utf8_clean($content);
$content = preg_replace('!</?(html|head|body)[^>]*>!', '', $content);
return utf8_trim($content);
}
}