function bueditor_import_csv_buttons in BUEditor 6.2
Same name and namespace in other branches
- 7 admin/bueditor.admin.inc \bueditor_import_csv_buttons()
Import buttons from a CSV file.
1 call to bueditor_import_csv_buttons()
- bueditor_editor_form in admin/
bueditor.admin.inc - Editor form.
File
- admin/
bueditor.admin.inc, line 478
Code
function bueditor_import_csv_buttons($file) {
$buttons = array();
if (is_file($file) && ($fp = fopen($file, 'r'))) {
$fields = fgetcsv($fp, 100000);
if (in_array('title', $fields)) {
while ($values = fgetcsv($fp, 100000)) {
$button = array();
for ($i = 0; isset($fields[$i]); $i++) {
$button[$fields[$i]] = stripslashes($values[$i]);
}
$buttons[] = (object) $button;
}
}
}
return $buttons;
}