function _background_process_ass_parse_definition_list in Background Process 7.2
Same name and namespace in other branches
- 8 background_process_ass/background_process_ass.module \_background_process_ass_parse_definition_list()
- 6 background_process_ass/background_process_ass.module \_background_process_ass_parse_definition_list()
- 7 background_process_ass/background_process_ass.module \_background_process_ass_parse_definition_list()
Converts an HTML table into an associative array.
Parameters
$html: HTML containing table.
Return value
array Table data.
1 call to _background_process_ass_parse_definition_list()
- background_process_ass_get_server_status in background_process_ass/
background_process_ass.module - Get apache extended server status.
File
- background_process_ass/
background_process_ass.module, line 395 - @todo Implement admin interface. @todo Fix runtime check of running process.
Code
function _background_process_ass_parse_definition_list($html) {
// Find the table
preg_match_all("/<dl.*?>.*?<\\/[\\s]*dl>/s", $html, $dl_htmls);
$dls = array();
foreach ($dl_htmls[0] as $dl_html) {
// Get title for each row
preg_match_all("/<dl.*?>(.*?)<\\/[\\s]*dl>/s", $dl_html, $matches);
$dl = array();
foreach ($matches[1] as $row_html) {
$row_html = preg_replace("/\r|\n/", '', $row_html);
preg_match_all("/<dt.*?>(.*?)<\\/[\\s]*dt>/", $row_html, $dt_matches);
$row = array();
for ($i = 0; $i < count($dt_matches[1]); $i++) {
$dt = strip_tags(html_entity_decode($dt_matches[1][$i]));
if (strpos($dt, ':') !== FALSE) {
list($key, $value) = explode(': ', $dt, 2);
$dl[$key] = $value;
}
}
}
$dls[] = $dl;
}
return $dls;
}