/** * Executes a search against the XML tree structure in the * specified $file, using the specified $query. Returns the output * of calling query() on the parsed file. * * @access public * @param string $file * @param string $query * @return mixed * */ function queryFile($file, $query) { global $loader; $loader->import('saf.XML.Sloppy'); $sloppy = new SloppyDOM(); $doc = $sloppy->parseFromFile($file); if (!$doc) { $this->error = $sloppy->error; $this->err_line = $sloppy->err_line; $this->err_byte = $sloppy->err_byte; $this->err_code = $sloppy->err_code; $this->err_colnum = $sloppy->err_colnum; return false; } return $this->query($doc, $query); }
/** * Load a distribution list from a file. The format is an * XML format which can be found in sitellite/mod/modfinder/distributions.xml * in your Sitellite CMS installation. * * @access public * @param string $filename * @return boolean * */ function loadDistros($filename) { global $loader; $loader->inc('saf.XML.Sloppy'); $sloppy = new SloppyDOM(); $doc = $sloppy->parseFromFile($filename); if (!$doc) { $this->error = $sloppy->error; return false; } foreach ($doc->query('/modfinderDistributions/distribution') as $dist) { $dist = $dist->makeObj(); $this->distros[$dist->name] = $dist; } return true; }
} $loader->import('saf.XML.Sloppy'); $loader->import('saf.I18n'); $loader->import('saf.CGI'); $loader->import('saf.Template'); $simple = new SimpleTemplate(); $cgi = new CGI(); if (!isset($cgi->offset)) { $cgi->offset = 0; } if (!isset($cgi->view)) { $cgi->view = 'browse'; } $intl = new I18n(); $sloppy = new SloppyDOM(); $doc = $sloppy->parseFromFile('../../../sitellite/inc/lang/languages.xml'); $xbrowser = new XMLBrowser($doc); $xbrowser->set(array('editLink' => $PHP_SELF . '?view=edit&path=', 'addLink' => $PHP_SELF . '?view=add&path=', 'browseLink' => $PHP_SELF . '?', 'downloadLink' => $PHP_SELF . '?view=download&path=')); //echo $xbrowser->browse ('/languages/lang', array ('name', 'code', 'charset'), $cgi->offset, 2); //printf ('<p>%s</p>', $doc->root->children[0]->path ()); /* $res = $xbrowser->editable ('/languages[0]/lang[0]'); if (is_array ($res)) { // form has been submitted echo '<pre>'; print_r ($res); echo '</pre>'; } elseif ($res === false) { printf ('<p>%s</p>', $xbrowser->error); } else { echo $res; } */