You are here

function bueditor_varexport_editor in BUEditor 6.2

Same name and namespace in other branches
  1. 7 admin/bueditor.admin.inc \bueditor_varexport_editor()

Generate an importable editor string including icon and library files.

1 call to bueditor_varexport_editor()
bueditor_eop_export in admin/bueditor.admin.inc
Editor export operation. Export the editor as text.

File

admin/bueditor.admin.inc, line 753

Code

function bueditor_varexport_editor($editor) {
  $editor = (array) $editor;
  $library = $editor['librarypath'];
  $iconpath = bueditor_path_tr($editor['iconpath']);
  $buepath = drupal_get_path('module', 'bueditor');

  //include buttons
  $editor['buttons'] = bueditor_exportable_buttons(bueditor_buttons($editor['eid']));

  //include icons if they are not in default icon directory.
  $editor['icons'] = array();
  if ($iconpath != $buepath . '/icons') {
    foreach (bueditor_icons($iconpath) as $name => $value) {
      $editor['icons'][$name] = base64_encode(file_get_contents($iconpath . '/' . $name));
    }
  }

  //include library files if they are not in default library directory.
  $editor['library'] = array();
  $buelib = $buepath . '/library';
  foreach (bueditor_get_library($library) as $key => $filepath) {
    $editor['library'][$key] = $buelib == dirname($filepath) ? '' : file_get_contents($filepath);
  }
  unset($editor['eid'], $editor['librarypath'], $editor['spritename']);
  return var_export($editor, TRUE);
}