function bueditor_export_buttons in BUEditor 5
Same name and namespace in other branches
- 6.2 admin/bueditor.admin.inc \bueditor_export_buttons()
- 6 bueditor.admin.inc \bueditor_export_buttons()
- 7 admin/bueditor.admin.inc \bueditor_export_buttons()
Export an array of buttons as CSV.
1 call to bueditor_export_buttons()
- bueditor_form_editor_submit in ./
bueditor.module - Editor form submitted.
File
- ./
bueditor.module, line 436
Code
function bueditor_export_buttons($bids = array()) {
if ($n = count($bids)) {
$result = db_query("SELECT * FROM {bueditor_buttons} WHERE bid IN (" . str_repeat("%d, ", $n - 1) . "%d) ORDER BY weight, title", $bids);
while ($button = db_fetch_array($result)) {
unset($button['bid'], $button['eid']);
if (!isset($output)) {
$output = '"' . implode('", "', array_keys($button)) . '"' . "\n";
}
$output .= '"' . implode('", "', array_map('addslashes', array_values($button))) . '"' . "\n";
}
}
if (isset($output)) {
header('Content-type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=bueditor_buttons.csv');
print $output;
exit;
}
drupal_set_message(t('There is no button to export.'), 'error');
}