����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 216.73.216.68 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/./cbt.bofirm.com/vendor/voku/simple_html_dom/src/voku/helper/ |
Upload File : |
<?php declare(strict_types=1); namespace voku\helper; final class HtmlDomHelper { /** * @param string $html * @param string $optionStr * @param string $htmlCssSelector * * @return string */ public static function mergeHtmlAttributes( string $html, string $optionStr, string $htmlCssSelector ): string { if (!$optionStr) { return $html; } $dom = \voku\helper\HtmlDomParser::str_get_html($html); $domNew = \voku\helper\HtmlDomParser::str_get_html('<textarea ' . $optionStr . '></textarea>'); $domElement = $dom->findOneOrFalse($htmlCssSelector); if ($domElement === false) { return $html; } $attributes = $domElement->getAllAttributes(); if (!$attributes) { return $html; } $domElementNew = $domNew->findOneOrFalse('textarea'); if ($domElementNew === false) { return $html; } $attributesNew = $domElementNew->getAllAttributes(); if (!$attributesNew) { return $html; } foreach ($attributesNew as $attributeNameNew => $attributeValueNew) { $attributeNameNew = \strtolower($attributeNameNew); if ( $attributeNameNew === 'class' || $attributeNameNew === 'style' || \strpos($attributeNameNew, 'on') === 0 // e.g. onClick, ... ) { if (isset($attributes[$attributeNameNew])) { $attributes[$attributeNameNew] .= ' ' . $attributeValueNew; } else { $attributes[$attributeNameNew] = $attributeValueNew; } } else { $attributes[$attributeNameNew] = $attributeValueNew; } } foreach ($attributes as $attributeName => $attributeValue) { $domElement->setAttribute($attributeName, $attributeValue); } return $domElement->html(); } }