You are here

function bueditor_insert_latest in BUEditor 6

Insert the latest version of default editor.

2 calls to bueditor_insert_latest()
bueditor_install in ./bueditor.install
Implementation of hook_install()
bueditor_update_6000 in ./bueditor.install
Update from 4|5.x to 6.x Add new fields: {bueditor_editors}.iconpath, {bueditor_editors}.librarypath. Change {bueditor_buttons}.accesskey field type from char to varchar. Update {bueditor_buttons}.content field values. Insert the latest version of…

File

./bueditor.install, line 132

Code

function bueditor_insert_latest($name = 'default') {

  //editor
  db_query("INSERT INTO {bueditor_editors} (name, pages, excludes, iconpath, librarypath) VALUES ('%s', '%s', '%s', '%s', '%s')", array(
    $name,
    "node/*\ncomment/*",
    'edit-log',
    '%BUEDITOR/icons',
    '%BUEDITOR/library',
  ));
  $eid = db_last_insert_id('bueditor_editors', 'eid');

  //buttons
  $buttons = array();
  $buttons[] = array(
    $eid,
    'Insert/edit image',
    "php:\n\$imce_url = function_exists('imce_access') && imce_access() ? url('imce') : '';\n\nreturn \"js:\nvar B = eDefBrowseButton('\$imce_url', 'attr_src', 'Browse', 'image');\nvar form = [\n {name: 'src', title: 'Image URL', suffix: B},\n {name: 'width', title: 'Width x Height', suffix: ' x ', getnext: true, attributes: {size: 3}},\n {name: 'height', attributes: {size: 3}},\n {name: 'alt', title: 'Alternative text'}\n];\neDefTagDialog('img', form, 'Insert/edit image', 'OK');\n\";",
    'image.png',
    'M',
    -10,
  );
  $buttons[] = array(
    $eid,
    'Insert/edit link',
    "php:\n\$imce_url = function_exists('imce_access') && imce_access() ? url('imce') : '';\n\nreturn \"js:\nvar B = eDefBrowseButton('\$imce_url', 'attr_href', 'Browse', 'link');\nvar form = [\n {name: 'href', title: 'Link URL', suffix: B},\n {name: 'html', title: 'Link text'},\n {name: 'title', title: 'Link title'}\n];\neDefTagDialog('a', form, 'Insert/edit link', 'OK');\n\";",
    'link.png',
    'L',
    -10,
  );
  $buttons[] = array(
    $eid,
    'tpl:',
    '',
    'separator.png',
    '',
    -8,
  );
  $buttons[] = array(
    $eid,
    'Bold',
    "<strong>%TEXT%</strong>",
    'bold.png',
    'B',
    -6,
  );
  $buttons[] = array(
    $eid,
    'Italic',
    "js: eDefTagger('em');/*toggle tag*/",
    'italic.png',
    'I',
    -6,
  );
  $buttons[] = array(
    $eid,
    'Headers',
    "js: eDefTagChooser([\n ['h1', 'Header1'],\n ['h2', 'Header2'],\n ['h3', 'Header3'],\n ['h4', 'Header4']\n], true, 'li', 'ul', 'slideDown');/*choose among tags*/",
    'headers.png',
    'H',
    -5,
  );
  $buttons[] = array(
    $eid,
    'tpl:',
    '',
    'separator.png',
    '',
    -4,
  );
  $buttons[] = array(
    $eid,
    'Ordered list. Converts selected lines to a numbered list.',
    "js: eDefTagLines('<ol>\\n', ' <li>', '</li>', '\\n</ol>');",
    'ol.png',
    'O',
    -2,
  );
  $buttons[] = array(
    $eid,
    'Unordered list. Converts selected lines to a bulleted list.',
    "js: eDefTagLines('<ul>\\n', ' <li>', '</li>', '\\n</ul>');",
    'ul.png',
    'U',
    -2,
  );
  $buttons[] = array(
    $eid,
    'tpl:',
    '',
    'separator.png',
    '',
    0,
  );
  $buttons[] = array(
    $eid,
    'Teaser break',
    "<!--break-->",
    'teaserbr.png',
    'T',
    2,
  );
  $buttons[] = array(
    $eid,
    'Preview',
    "js: eDefPreview();",
    'preview.png',
    'P',
    6,
  );
  $buttons[] = array(
    $eid,
    'Help',
    "js: eDefHelp('slideDown');",
    'help.png',
    'F',
    10,
  );
  foreach ($buttons as $button) {
    db_query("INSERT INTO {bueditor_buttons} (eid, title, content, icon, accesskey, weight) VALUES (%d, '%s', '%s', '%s', '%s', %d)", $button);
  }
}