function ckeditor_install in CKEditor - WYSIWYG HTML editor 7
Same name and namespace in other branches
- 6 ckeditor.install \ckeditor_install()
File
- ./
ckeditor.install, line 48
Code
function ckeditor_install() {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
//searching ckeditor.js
$ckeditor_path = _ckeditor_script_path();
//insert default input formats to profiles
db_insert('ckeditor_input_format')
->fields(array(
"name" => "Advanced",
"format" => 'filtered_html',
))
->execute();
db_insert('ckeditor_input_format')
->fields(array(
"name" => "Full",
"format" => 'full_html',
))
->execute();
//insert settings for default role
$arr = array();
$arr['filebrowser'] = 'none';
$arr['quickupload'] = 'f';
//security
$arr['ss'] = "2";
$arr['filters']['filter_html'] = 1;
//appearance
$arr['default'] = "t";
$arr['show_toggle'] = "t";
$arr['popup'] = variable_get('ckeditor_popup', 0) ? "t" : "f";
// <!--break--> does not work in Filtered HTML, so DrupalBreak does not make sense here
// https://drupal.org/node/881006
$arr['toolbar'] = "\n[\n ['Source'],\n ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],\n ['Undo','Redo','Find','Replace','-','SelectAll'],\n ['Image','Media','Flash','Table','HorizontalRule','Smiley','SpecialChar'],\n ['Maximize', 'ShowBlocks'],\n '/',\n ['Format'],\n ['Bold','Italic','Underline','Strike','-','Subscript','Superscript','-','RemoveFormat'],\n ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],\n ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],\n ['Link','Unlink','Anchor','Linkit']\n]\n ";
$arr['expand'] = variable_get('ckeditor_toolbar_start_expanded', 1) ? "t" : "f";
$arr['width'] = variable_get("ckeditor_width", "100%");
$arr['lang'] = "en";
$arr['auto_lang'] = "t";
$arr['language_direction'] = "default";
//output
$arr['enter_mode'] = "p";
$arr['shift_enter_mode'] = "br";
$arr['font_format'] = 'p;div;pre;address;h1;h2;h3;h4;h5;h6';
$arr['format_source'] = "t";
$arr['format_output'] = "t";
$arr['custom_formatting'] = "f";
$arr['formatting']['custom_formatting_options'] = array(
'indent' => 'indent',
'breakBeforeOpen' => 'breakBeforeOpen',
'breakAfterOpen' => 'breakAfterOpen',
'breakAfterClose' => 'breakAfterClose',
);
//css
$arr['css_mode'] = "none";
$arr['css_path'] = variable_get("ckeditor_stylesheet", "");
//config location
$arr['config_js'] = "none";
$arr['config_js_path'] = "";
//upload
//get permissions here like in _update_role_permissions
$arr['filebrowser'] = "none";
$arr['user_choose'] = "f";
$arr['ckeditor_load_method'] = "ckeditor.js";
$arr['ckeditor_load_time_out'] = 0;
$arr['scayt_autoStartup'] = "f";
//advanced options
$arr['html_entities'] = "f";
db_insert('ckeditor_settings')
->fields(array(
"name" => "Advanced",
"settings" => serialize($arr),
))
->execute();
//insert settings for advanced role
$arr['toolbar'] = "\n[\n ['Source'],\n ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],\n ['Undo','Redo','Find','Replace','-','SelectAll'],\n ['Image','Media','Flash','Table','HorizontalRule','Smiley','SpecialChar','Iframe'],\n '/',\n ['Bold','Italic','Underline','Strike','-','Subscript','Superscript','-','RemoveFormat'],\n ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],\n ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl','-','Language'],\n ['Link','Unlink','Anchor','Linkit'],\n ['DrupalBreak'],\n '/',\n ['Format','Font','FontSize'],\n ['TextColor','BGColor'],\n ['Maximize', 'ShowBlocks']\n]\n ";
$arr['filters'] = array();
db_insert('ckeditor_settings')
->fields(array(
"name" => "Full",
"settings" => serialize($arr),
))
->execute();
$arr = array();
if (!empty($ckeditor_path)) {
$arr['ckeditor_path'] = $ckeditor_path;
}
else {
$arr['ckeditor_path'] = '//cdn.ckeditor.com/' . CKEDITOR_LATEST . '/full-all';
}
db_insert('ckeditor_settings')
->fields(array(
"name" => "CKEditor Global Profile",
"settings" => serialize($arr),
))
->execute();
module_load_include('inc', 'ckeditor', 'includes/ckeditor.admin');
}