Booking, QI Content, Trees, Media
This commit is contained in:
parent
1f340e96fa
commit
7fbac395a9
260 changed files with 27160 additions and 3773 deletions
|
|
@ -72,7 +72,7 @@ class CMSTravelGuideController extends Controller
|
|||
}
|
||||
|
||||
if(Input::get('clean') == "true"){
|
||||
$model->full_text = $this->cleanHTML($model->full_text);
|
||||
$model->full_text = \App\Services\Util::cleanHTML($model->full_text);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -84,52 +84,8 @@ class CMSTravelGuideController extends Controller
|
|||
|
||||
}
|
||||
|
||||
public function cleanHTML($html)
|
||||
{
|
||||
|
||||
|
||||
$html = str_replace('font-size: 14px;', ' ', $html);
|
||||
$html = str_replace('font-weight: lighter; ', ' ', $html);
|
||||
$html = str_replace('font-family: Helvetica, Arial, sans-serif; ', ' ', $html);
|
||||
$html = str_replace('font-family: Verdana, sans-serif; ', ' ', $html);
|
||||
$html = str_replace('color: rgb(60, 60, 60); ', ' ', $html);
|
||||
$html = str_replace(' style=" padding: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 20px !important; line-height: 20px !important;"', ' ', $html);
|
||||
$html = str_replace('property="article"', ' ', $html);
|
||||
$html = str_replace(' ', ' ', $html);
|
||||
$html = str_replace('https://www.aegypten-online.de', 'https://www.sterntours.de', $html);
|
||||
|
||||
$dom = new \DOMDocument('1.0', 'utf-8');
|
||||
@$dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
|
||||
|
||||
$removeFullTags = ['span', 'a'];
|
||||
|
||||
foreach ($removeFullTags as $removeFullTag){
|
||||
$domElemsToRemove = [];
|
||||
$elements = $dom->getElementsByTagName($removeFullTag);
|
||||
foreach ($elements as $element) {
|
||||
$domElemsToRemove[] = $element;
|
||||
|
||||
}
|
||||
foreach ($domElemsToRemove as $domElem) {
|
||||
if($removeFullTag == 'span' && strpos($domElem->getAttribute('style'), 'font-weight: 700') !== false){
|
||||
$new_node = $dom->createTextNode("<strong>".$domElem->nodeValue."</strong>");
|
||||
}else{
|
||||
$new_node = $dom->createTextNode($domElem->nodeValue);
|
||||
}
|
||||
$domElem->parentNode->replaceChild($new_node, $domElem);
|
||||
}
|
||||
}
|
||||
$removeStyleTags = ['ul', 'li', 'h1', 'h2', 'br'];
|
||||
foreach ($removeStyleTags as $removeStyleTag){
|
||||
$elements = $dom->getElementsByTagName($removeStyleTag);
|
||||
foreach ($elements as $element) {
|
||||
$element->removeAttribute('style');
|
||||
}
|
||||
}
|
||||
$html = $dom->saveHTML();
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function pageDetail($id)
|
||||
{
|
||||
if($id == "new") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue