function sheetnode_html_import in Sheetnode 7
Same name and namespace in other branches
- 6 modules/sheetnode_html/sheetnode_html.module \sheetnode_html_import()
- 7.2 modules/sheetnode_html/sheetnode_html.module \sheetnode_html_import()
API function to import a URL.
1 call to sheetnode_html_import()
- sheetnode_html_import_form_submit in modules/
sheetnode_html/ sheetnode_html.module - Submit handler for import form.
File
- modules/
sheetnode_html/ sheetnode_html.module, line 86 - Module file for the sheetnode_html module. This extends sheetnodes to enable inmporting of html to sheetnodes.
Code
function sheetnode_html_import($url, $querypath, $options = array()) {
module_load_include('inc', 'sheetnode', 'socialcalc');
$doc = new DOMDocument('1.0');
@$doc
->loadHTMLFile($url);
$qp = htmlqp($doc);
$title = $qp
->top('title')
->text();
$sheet = array();
foreach ($qp
->top($querypath) as $table) {
sheetnode_html_import_table($table, $sheet, $options);
}
$socialcalc = array(
'sheet' => $sheet,
'edit' => socialcalc_default_edit($sheet),
'audit' => socialcalc_default_audit($sheet),
);
return array(
$title,
socialcalc_save($socialcalc),
);
}