![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/php-webdriver/webdriver/lib/Support/ |
<?php namespace Facebook\WebDriver\Support; class XPathEscaper { /** * Converts xpath strings with both quotes and ticks into: * `foo'"bar` -> `concat('foo', "'" ,'"bar')` * * @param string $xpathToEscape The xpath to be converted. * @return string The escaped string. */ public static function escapeQuotes($xpathToEscape) { // Single quotes not present => we can quote in them if (mb_strpos($xpathToEscape, "'") === false) { return sprintf("'%s'", $xpathToEscape); } // Double quotes not present => we can quote in them if (mb_strpos($xpathToEscape, '"') === false) { return sprintf('"%s"', $xpathToEscape); } // Both single and double quotes are present return sprintf( "concat('%s')", str_replace("'", "', \"'\" ,'", $xpathToEscape) ); } }