📄 editor_class.php
字号:
$smenu_height -= 72;
$bmenu_height -= 72;
$height1 = ($height - 81);
$height2 = ($height - 33);
} else {
$height1 = ($height - 83);
$height2 = ($height - 32);
}
// if no save button requested remove the button
if (empty($this->save_button)) {
$this->remove ('save');
}
// remove custom object button if no inserts set.
if (empty($this->custom_objects)) {
$this->remove ('custom');
}
// adds class menu to the remove array if no classes set
if (empty($this->class_menu)) {
$this->remove ('class');
}
if (strstr(WP_WEB_DIRECTORY, 'https:') || strstr(DOMAIN_ADDRESS, 'https:')) {
$secure = 'src="'.WP_WEB_DIRECTORY.'secure.htm"';
} else {
$secure = '';
}
if (strstr($this->remove_array,'image')){
$this->image_window = 'imageoptions.php';
}
if (strstr($this->remove_array,'image') || strstr($this->remove_array,'toolbar1')){
$this->image_window = 'imageoptions.php';
}
// remove requested buttons from the code
if (!empty($this->remove_array)) {
// if user requests the removal of buttons that also appear on the context menus we must add those to the remove array!
if ($this->is_ie55 || $this->is_gecko) {
if (strstr($this->remove_array,'pasteword')) {
$imenu_height -= 24;
$tmenu_height -= 24;
$smenu_height -= 24;
$bmenu_height -= 24;
}
if (strstr($this->remove_array,'document')) {
$imenu_height -= 24;
$tmenu_height -= 24;
$smenu_height -= 24;
}
if (strstr($this->remove_array,'link')) {
$imenu_height -= 24;
$tmenu_height -= 24;
$smenu_height -= 24;
}
if (strstr($this->remove_array,'image')) {
$imenu_height -= 24;
}
if (strstr($this->remove_array,'bookmark')) {
$bmenu_height -= 24;
}
if ((strstr($this->remove_array,'tbl')) || (strstr($this->remove_array,'edittable'))){
$tmenu_height -= 271;
}
}
// explode the remove array from a comma separated list into an actual array.
$this->remove_array = explode (',', $this->remove_array);
// loop through the array and remove the buttons
$num_removes = sizeof($this->remove_array);
for ($i=0; $i<$num_removes; $i++) {
$handle = trim ($this->remove_array[$i]); // trim incase there were spaces after the commas.
// if any of the drop-down menus are requested for removal we need to hide these menus...
// but because they are referenced so often in the JavaScript this is tricky...
// so instead of removing them completely we will just hide them by pasting display:none; in their style attribute.
// beause we are checking the items in the remove array now this is a good time to do this.
switch($handle) {
case 'format':
$format_list_style = 'display:none;';
break;
case 'size':
$size_list_style = 'display:none;';
break;
case 'font':
$font_list_style = 'display:none;';
break;
case 'class':
$class_list_style = 'display:none;';
break;
case 'toolbar1':
$toolbar1_style = 'display:none;';
$height1 += 24;
break;
case 'toolbar2':
$toolbar2_style = 'display:none;';
$height1 += 24;
break;
default:
// now do the removal
$this->WYSIWYGPRO_code = preg_replace('/<!--\s+begin '.$handle.'\s+-->.*?<!--\s+end '.$handle.'\s+-->/sm', '', $this->WYSIWYGPRO_code);
break;
}
}
}
// load language file
$lang_include = '';
if (DEFAULT_LANG != $this->instance_lang) {
$lang_include = $this->instance_lang;
} else {
$lang_include = DEFAULT_LANG;
}
include (WP_FILE_DIRECTORY.'lang/'.$lang_include);
// paste in the requested paramaters and language variables.
$this->format_menu = $this->wp_replace($this->format_menu, array(
'normal' => $lang['normal'] ,
'heading_1' => $lang['heading_1'],
'heading_2' => $lang['heading_2'],
'heading_3' => $lang['heading_3'],
'heading_4' => $lang['heading_4'],
'heading_5' => $lang['heading_5'],
'heading_6' => $lang['heading_6'],
'pre_formatted' => $lang['pre_formatted'],
'address1' => $lang['address1']
));
if ($this->is_gecko && $this->gecko_revision < 1.4) {
$this->format_menu = str_replace('<div>', 'div', $this->format_menu);
}
$this->size_menu = $this->wp_replace($this->size_menu, array(
'1' => $lang['1'] ,
'2' => $lang['2'],
'3' => $lang['3'],
'4' => $lang['4'],
'5' => $lang['5'],
'6' => $lang['6'],
'7' => $lang['7'],
));
$this->WYSIWYGPRO_code = $this->wp_replace($this->WYSIWYGPRO_code, array(
// configuration paramaters
'usexhtml' => $this->usexhtml,
'stylesheet' => empty($this->set_style) ? "''" : '[\''.$this->set_style.'\']',
'directory' => WP_WEB_DIRECTORY,
'width' => $width,
'absheight' => $height,
'height' => $height1,
'height2' => $height2,
'height3' => $height2 + 1,
'imenu_height' => $imenu_height,
'bmenu_height' => $bmenu_height,
'tmenu_height' => $tmenu_height,
'smenu_height' => $smenu_height,
'baseURLurl' => $this->baseURL,
'baseURL' => $this->baseURL2,
'domain' => $this->domain,
'domain2' => str_replace('/','\/',quotemeta(DOMAIN_ADDRESS)),
'imgwindow' => $this->image_window,
'is_ie50' => $is_ie50,
'class_menu' => $this->class_menu,
'format_list_style' => $format_list_style,
'font_list_style' => $font_list_style,
'size_list_style' => $size_list_style,
'class_list_style' => $class_list_style,
'toolbar1_style' => $toolbar1_style,
'toolbar2_style' => $toolbar2_style,
'font_menu' => $this->font_menu,
'format_menu' => $this->format_menu,
'size_menu' => $this->size_menu,
'hyperlink_function' => $this->hyperlink_function,
'hyperlink_function2' => $this->hyperlink_function2,
"custom_objects" => empty($this->custom_objects) ? "''" : '['.$this->custom_objects.']',
"links" => empty($this->links) ? "''" : '['.$this->links.']',
"xhtml_lang" => $this->xhtml_lang,
"encoding" => $this->encoding,
"usep" => $this->usep,
"showbookmarkmngr" => $this->showbookmarkmngr,
"savebutton" => $this->save_button,
"subsequent" => $this->subsequent,
"instance_lang" => $this->instance_lang,
'color_swatches' => $this->color_swatches,
'instance_img_dir' => $this->instance_img_dir,
'instance_doc_dir' => $this->instance_doc_dir,
'secure' => $secure,
'guidelines' => $this->guidelines,
'name' => $this->name,
'original_name' => $this->original_name,
'doctype' => $this->doctype,
'charset' => $this->charset,
// language
'please_wait' => $lang['please_wait'],
'save' => $lang['save'],
'post' => $lang['post'],
'send' => $lang['send'],
'print' => $lang['print'],
'find_and_replace' => $lang['find_and_replace'],
'cut' => $lang['cut'],
'copy' => $lang['copy'],
'paste' => $lang['paste'],
'paste_word' => $lang['paste_word'],
'undo' => $lang['undo'],
'redo' => $lang['redo'],
'insert_table' => $lang['insert_table'],
'table_properties' => $lang['table_properties'],
'add_row' => $lang['add_row'],
'delete_row' => $lang['delete_row'],
'insert_column' => $lang['insert_column'],
'delete_column' => $lang['delete_column'],
'merge_cell' => $lang['merge_cell'],
'unmerge_cell' => $lang['unmerge_cell'],
'insert_emoticon' => $lang['insert_emoticon'],
'insert_image' => $lang['insert_image'],
'horizontal_line' => $lang['horizontal_line'],
'insert_hyperlink' => $lang['insert_hyperlink'],
'document_link' => $lang['document_link'],
'insert_bookmark' => $lang['insert_bookmark'],
'special_characters' => $lang['special_characters'],
'insert_object' => $lang['insert_object'],
'paragraph_format' => $lang['paragraph_format'],
'style_class' => $lang['style_class'],
'font_face' => $lang['font_face'],
'font_size' => $lang['font_size'],
'bold' => $lang['bold'],
'italic' => $lang['italic'],
'underline' => $lang['underline'],
'align_left' => $lang['align_left'],
'align_right' => $lang['align_right'],
'align_center' => $lang['align_center'],
'justify' => $lang['justify'],
'numbering' => $lang['numbering'],
'bullets' => $lang['bullets'],
'increase_indent' => $lang['increase_indent'],
'decrease_indent' => $lang['decrease_indent'],
'font_color' => $lang['font_color'],
'highlight' => $lang['highlight'],
'design' => $lang['design'],
'html_code' => $lang['html_code'],
'preview' => $lang['preview'],
'br_tag' => $lang['br_tag'],
'toggle_guidelines' => $lang['toggle_guidelines'],
'image_properties' => $lang['image_properties'],
'bookmark_properties' => $lang['bookmark_properties'],
'add_row_above' => $lang['add_row_above'],
'add_row_below' => $lang['add_row_below'],
'add_column_left' => $lang['add_column_left'],
'add_column_right' => $lang['add_column_right'],
'merge_right' => $lang['merge_right'],
'merge_below' => $lang['merge_below'],
'unmerge_right' => $lang['unmerge_right'],
'unmerge_below' => $lang['unmerge_below'],
'cancel' => $lang['cancel'],
'default' => $lang['default'],
'clear_styles' => $lang['clear_styles'],
'javascript_warning' => $lang['javascript_warning'],
// javascript
'guidelines_hidden' => $lang['guidelines_hidden'],
'guidelines_visible' => $lang['guidelines_visible'],
'place_cursor_in_table' => $lang['place_cursor_in_table'],
'only_split_merged_cells' => $lang['only_split_merged_cells'],
'no_cell_right' => $lang['no_cell_right'],
'different_row_spans' => $lang['different_row_spans'],
'no_cell_below' => $lang['no_cell_below'],
'different_column_spans' => $lang['different_column_spans'],
'select_hyperlink_text' => $lang['select_hyperlink_text'],
'upgrade' => $lang['upgrade'],
'format' => $lang['format'],
'font' => $lang['font'],
'class' => $lang['class'],
'size' => $lang['size1']
));
$arr = explode('</script>',$this->WYSIWYGPRO_code);
$num = count($arr);
for ($i=0; $i<$num; $i++) {
$arr2 = explode('<script', $arr[$i]);//>
$foo = str_replace(array("\t", "\r", "\n"), '', $arr2[0]);
if (isset($arr2[1])) {
$arr[$i] = $foo.'<script'.$arr2[1];//>
} else {
$arr[$i] = $foo;
}
}
$this->WYSIWYGPRO_code = implode('</script>',$arr);
// if we have been asked to save this configuration then save it to a file
if (!empty($this->save_name)) {
$fp = fopen (SAVE_DIRECTORY . $this->save_name, 'w');
@flock ($fp, LOCK_EX);
fwrite ($fp, $this->WYSIWYGPRO_code);
@flock ($fp, LOCK_UN);
fclose ($fp);
}
} else {
// if cache has not expired simply load the data from the cache.
$this->WYSIWYGPRO_code = implode('', file (SAVE_DIRECTORY . $this->save_name));
if (get_magic_quotes_runtime ()) {
$this->WYSIWYGPRO_code = stripslashes($this->WYSIWYGPRO_code);
}
}
// set code if empty
if (empty($this->code)) {
if ($this->usep == 'true') {
$this->code = '<p> </p>';
} else {
$this->code = '<div> </div>';
}
}
// if subsequent remove stuff not required
if ($this->subsequent == 'true') {
$this->WYSIWYGPRO_code = preg_replace('/<!--\s+begin 1st instance only\s+-->.*?<!--\s+end 1st instance only\s+-->/sm', '', $this->WYSIWYGPRO_code);
}
// tidy up comments
$this->WYSIWYGPRO_code = preg_replace("/<!--\s.*?-->/smi", '', $this->WYSIWYGPRO_code);
// now insert the code to be edited, this is done after the caching so that the code is not cached.
return str_replace('##htmlCode##', $this->code, $this->WYSIWYGPRO_code);
}
/***************************************************************************
print_editor
Public: prints the output from return_editor() directly in the browser
*/
function print_editor($width=680, $height=390) {
print $this->return_editor($width,$height);
}
// End class
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -