Exemple #1
0
}
// Include CKEditor class.
include "../../ckeditor.php";
// Create class instance.
$CKEditor = new CKEditor();
// Set configuration option for all editors.
$CKEditor->config['width'] = 750;
// Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
//   $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor->basePath = '../../';
// The initial value to be displayed in the editor.
$initialValue = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>';
// Event that will be handled only by the first editor.
$CKEditor->addEventHandler('instanceReady', 'function (evt) {
	alert("Loaded editor: " + evt.editor.name);
}');
// Create first instance.
$CKEditor->editor("editor1", $initialValue);
// Clear event handlers, instances that will be created later will not have
// the 'instanceReady' listener defined a couple of lines above.
$CKEditor->clearEventHandlers();
?>

			<p>
				<label>Editor 2:</label><br/>
			</p>
<?php 
// Configuration that will be used only by the second editor.
$config['width'] = '600';
$config['toolbar'] = 'Basic';
 function getHTML($name, $content, $height, $width, $conf = null)
 {
     $CKeditor = new CKEditor();
     $CKeditor->returnOutput = true;
     $CKeditor->basePath = $this->correctPath() . $this->editorDir;
     $CKeditor->config['width'] = $width;
     $CKeditor->config['height'] = $height;
     $CKeditor->config['toolbar'] = $conf;
     $CKeditor->config['enterMode'] = 2;
     $lang_data = SJB_I18N::getInstance()->getLanguageData(SJB_I18N::getInstance()->getCurrentLanguage());
     $CKeditor->config['contentsLangDirection'] = $lang_data['rightToLeft'] == 1 ? 'rtl' : 'ltr';
     if ($conf == 'BasicAdmin') {
         // kcfinder
         $CKeditor->config['filebrowserBrowseUrl'] = SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/kcfinder/browse.php?type=files';
         $CKeditor->config['filebrowserImageBrowseUrl'] = SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/kcfinder/browse.php?type=images';
         $CKeditor->config['filebrowserFlashBrowseUrl'] = SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/kcfinder/browse.php?type=flash';
         $CKeditor->config['filebrowserUploadUrl'] = SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/kcfinder/upload.php?type=files';
         $CKeditor->config['filebrowserImageUploadUrl'] = SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/kcfinder/upload.php?type=images';
         $CKeditor->config['filebrowserFlashUploadUrl'] = SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/kcfinder/upload.php?type=flash';
     }
     $CKeditor->config['toolbar_Full'] = array(array('name' => 'document', 'items' => array('Source', '-', 'Save', 'NewPage', 'DocProps', 'Preview', 'Print', '-', 'Templates')), array('name' => 'clipboard', 'items' => array('Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo')), array('name' => 'editing', 'items' => array('Find', 'Replace', '-', 'SelectAll', '-', 'SpellChecker', 'Scayt')), array('name' => 'forms', 'items' => array('Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField')), '/', array('name' => 'basicstyles', 'items' => array('Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat')), array('name' => 'paragraph', 'items' => array('NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl')), array('name' => 'links', 'items' => array('Link', 'Unlink', 'Anchor')), array('name' => 'insert', 'items' => array('Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe')), '/', array('name' => 'styles', 'items' => array('Styles', 'Format', 'Font', 'FontSize')), array('name' => 'colors', 'items' => array('TextColor', 'BGColor')), array('name' => 'tools', 'items' => array('Maximize', 'ShowBlocks', '-', 'About')));
     $CKeditor->config['toolbar_BasicAdmin'] = array(array('name' => 'document', 'items' => array('Source', 'Templates')), array('name' => 'clipboard', 'items' => array('Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo')), array('name' => 'editing', 'items' => array('SpellChecker', 'Scayt')), '/', array('name' => 'basicstyles', 'items' => array('Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat')), array('name' => 'paragraph', 'items' => array('NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock')), array('name' => 'links', 'items' => array('Link', 'Unlink', 'Anchor')), array('name' => 'insert', 'items' => array('Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe')), array('name' => 'tools', 'items' => array('About')), '/', array('name' => 'styles', 'items' => array('Styles', 'Format', 'Font', 'FontSize')), array('name' => 'colors', 'items' => array('TextColor', 'BGColor')));
     $CKeditor->config['toolbar_Basic'] = array(array('name' => 'clipboard', 'items' => array('Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo')), array('name' => 'editing', 'items' => array('SpellChecker', 'Scayt')), array('name' => 'basicstyles', 'items' => array('Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat')), '/', array('name' => 'paragraph', 'items' => array('NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock')), array('name' => 'links', 'items' => array('Link', 'Unlink')), array('name' => 'insert', 'items' => array('Table', 'HorizontalRule', 'PageBreak')), '/', array('name' => 'styles', 'items' => array('Styles', 'Format', 'Font', 'FontSize')), array('name' => 'colors', 'items' => array('TextColor', 'BGColor')), array('name' => 'tools', 'items' => array('About')));
     $CKeditor->addEventHandler('instanceReady', "function (ev) {\n\t\t\tev.editor.dataProcessor.writer.indentationChars = '';\n\t\t\tev.editor.dataProcessor.writer.lineBreakChars = '';\n\t\t}");
     return $CKeditor->editor($name, $content, $conf);
 }