function _background_process_ass_parse_definition_list in Background Process 8
Same name and namespace in other branches
- 6 background_process_ass/background_process_ass.module \_background_process_ass_parse_definition_list()
- 7.2 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()
Implements to Converts an HTML table into an associative array.
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 297 - Implements Background Process Ass Module. @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 = [];
foreach ($dl_htmls[0] as $dl_html) {
preg_match_all("/<dl.*?>(.*?)<\\/[\\s]*dl>/s", $dl_html, $matches);
$dl = [];
foreach ($matches[1] as $row_html) {
$row_html = preg_replace("/\r|\n/", '', $row_html);
preg_match_all("/<dt.*?>(.*?)<\\/[\\s]*dt>/", $row_html, $dt_matches);
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;
}