/** * register a namespace prefix for the document, it will be used in * createElement and setAttribute * * @param string $prefix * @param string $namespace * @throws \LogicException */ public function registerNamespace($prefix, $namespace) { $prefix = $this->validatePrefix($prefix); if (isset($this->_reserved[$prefix])) { throw new \LogicException(sprintf('Can not register reserved namespace prefix "%s".', $prefix)); } $this->_namespaces[$prefix] = $namespace; if (isset($this->_xpath) && $prefix !== '#default') { $this->_xpath->registerNamespace($prefix, $namespace); } }
public static function quote($string) { if (false === strpos($string, '"')) { return '"' . $string . '"'; } if (false === strpos($string, "'")) { return "'" . $string . "'"; } $exp = explode('\'', $string); return 'concat(' . implode(', ', array_map(function ($val) { return Xpath::quote($val); }, $exp)) . ')'; }
/** * @param $alias * @param $property * @param $value * @param string $operator * * @return string * * @throws NotImplementedException if the storage backend is neither mysql * nor postgres nor sqlite */ private function sqlXpathComparePropertyValue($alias, $property, $value, $operator) { $expression = null; if ($this->platform instanceof MySqlPlatform) { $expression = "EXTRACTVALUE({$alias}.props, 'count(//sv:property[@sv:name=\"" . $property . "\"]/sv:value[text()%s%s]) > 0')"; // mysql does not escape the backslashes for us, while postgres and sqlite do $value = Xpath::escapeBackslashes($value); } elseif ($this->platform instanceof PostgreSqlPlatform) { $expression = "xpath_exists('//sv:property[@sv:name=\"" . $property . "\"]/sv:value[text()%s%s]', CAST({$alias}.props AS xml), " . $this->sqlXpathPostgreSQLNamespaces() . ") = 't'"; } elseif ($this->platform instanceof SqlitePlatform) { $expression = "EXTRACTVALUE({$alias}.props, 'count(//sv:property[@sv:name=\"" . $property . "\"]/sv:value[text()%s%s]) > 0')"; } else { throw new NotImplementedException("Xpath evaluations cannot be executed with '" . $this->platform->getName() . "' yet."); } return sprintf($expression, $this->walkOperator($operator), Xpath::escape($value)); }
</h2> <script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage1" ) );</script> </div> <div class="tab-page" id="tabPage2"> <h2 class="tab"><?php echo $_lang["modules_install_new"]; ?> </h2> <script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage2" ) );</script> <?php include "includes/XPath.class.php"; $xPath = new Xpath(); $modspath = getcwd() . "/modules"; if ($dir = @opendir($modspath)) { while (($file = readdir($dir)) !== false) { $currPath = $modspath . "/" . $file; if (is_dir($currPath) && $file != "." && $file != "..") { $configFile = $currPath . "/config.xml"; // XPath stuff $xPath->XPath($fileName = $configFile); ?> <br /> <table width="600" border="0" cellspacing="1" cellpadding="3" bgcolor="#000000"> <thead> <tr> <td colspan="3"> <b><?php