# HG changeset patch # User Nathan Phillip Brink # Date 2012-02-12 22:42:14 # Node ID dcc324bd004e10ab683dd6a38981e3895cae441c # Parent b55b22ef1a1f8fc09d67ce880f1ed9b71efdfadd Fix some form parsing functions in the crawler API. diff --git a/inc/school.crawl.inc b/inc/school.crawl.inc --- a/inc/school.crawl.inc +++ b/inc/school.crawl.inc @@ -484,7 +484,7 @@ function school_crawl_form(DOMElement $f $form = array(); $xpath = new DOMXPath($form_node->ownerDocument); - foreach ($xpath->query('input', $form_node) as $input_node) + foreach ($xpath->query('.//input', $form_node) as $input_node) { if ($input_node->hasAttribute('name')) { @@ -507,14 +507,14 @@ function school_crawl_form(DOMElement $f } } - foreach ($xpath->query('select', $form_node) as $select_node) + foreach ($xpath->query('.//select', $form_node) as $select_node) { if ($select_node->hasAttribute('name')) { $select_name = $select_node->getAttribute('name'); if (!isset($form[$select_name])) $form[$select_name] = array(); - foreach ($xpath->query('option[selected]', $select_node) as $option_node) + foreach ($xpath->query('.//option[@selected]', $select_node) as $option_node) if ($option_node->hasAttribute('value')) $form[$select_name][] = $option_node->getAttribute('value'); } @@ -536,28 +536,32 @@ function school_crawl_form(DOMElement $f * \param $selected * Will be set to an array of the currently selected keys if passed. * \return - * An associative array mapping an