����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 216.73.216.15 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; use Symfony\Component\CssSelector\CssSelectorConverter; class SelectorConverter { /** * @var string[] * * @phpstan-var array<string,string> */ protected static $compiled = []; /** * @param string $selector * @param bool $ignoreCssSelectorErrors * <p> * Ignore css selector errors and use the $selector as it is on error, * so that you can also use xPath selectors. * </p> * @param bool $isForHtml * * @return string */ public static function toXPath(string $selector, bool $ignoreCssSelectorErrors = false, bool $isForHtml = true) { if (isset(self::$compiled[$selector])) { return self::$compiled[$selector]; } // Select DOMText if ($selector === 'text') { return '//text()'; } // Select DOMComment if ($selector === 'comment') { return '//comment()'; } if (\strpos($selector, '//') === 0) { return $selector; } if (!\class_exists(CssSelectorConverter::class)) { throw new \RuntimeException('Unable to filter with a CSS selector as the Symfony CssSelector 2.8+ is not installed (you can use filterXPath instead).'); } $converterKey = '-' . $isForHtml . '-' . $ignoreCssSelectorErrors . '-'; static $converterArray = []; if (!isset($converterArray[$converterKey])) { $converterArray[$converterKey] = new CssSelectorConverter($isForHtml); } $converter = $converterArray[$converterKey]; assert($converter instanceof CssSelectorConverter); if ($ignoreCssSelectorErrors) { try { $xPathQuery = $converter->toXPath($selector); } catch (\Exception $e) { $xPathQuery = $selector; } } else { $xPathQuery = $converter->toXPath($selector); } self::$compiled[$selector] = $xPathQuery; return $xPathQuery; } }