?? editor_class.php
字號:
$this->original_name = $name;
}
}
}
/***************************************************************************
set_code
Public: sets the code that should be loaded into the editor at startup
$code: the HTML code to load
*/
function set_code($code='') {
// we will not check the cache because code is not cached so that you can still insert different code into a saved configuration.
if (!empty($code)) {
// standardise carriage returns, strip slashes incase sent from a form post or database.
$code = str_replace(array("\r\n", "\r"), array("\n", "\n"), stripslashes($code));
// strip out the XML declaration because this can confuse Internet Explorer
$code = preg_replace('/<\?php echo "<\?xml version=\"1\.0\" encoding=\"(.*?)\"\?"\.">"; \?>/smi', "", $code);
$code = preg_replace("/<\?xml version=\"1.0\" encoding=\"(.*?)\"\?>/smi", "", $code);
$code = $this->wp_entities($code);
// convert to htmlentities to make it safe to paste in a textarea
$this->code = htmlspecialchars($code);
}
}
/***************************************************************************
set_lang
Public: sets the attribute value for lang tags
$lang: the lang attribute value eg "en"
*/
function set_xhtml_lang($lang="en") {
if ($this->has_expired) {
if (isset ($lang) ? $lang : '') {
$this->xhtml_lang = $lang;
}
}
}
/***************************************************************************
set_encoding
Public:
$encoding: eg "UTF-8"
*/
function set_encoding($encoding="iso-8859-1") {
if ($this->has_expired) {
if (isset ($encoding) ? $encoding : '') {
$this->encoding = $encoding;
}
}
}
/***************************************************************************
set_doctype
Public:
*/
function set_doctype($doctype='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">') {
if ($this->has_expired) {
if (isset ($doctype) ? $doctype : '') {
$doctype = str_replace(array("'","\r\n","\r","\n"),array("\'",'\n','\n','\n'),$doctype);
$this->doctype = $doctype;
}
}
}
/***************************************************************************
set_charset
Public:
*/
function set_charset($charset='iso-8859-1') {
if ($this->has_expired) {
if (isset ($charset) ? $charset : '') {
$this->set_encoding($charset);
$charset = '<meta http-equiv="Content-Type" content="text/html; charset='.str_replace(array("'","\r\n","\r","\n"),array("\'",'\n','\n','\n'),$charset).'" />';
$this->charset = $charset;
}
}
}
/***************************************************************************
usexhtml
Public: tells the editor to generate well formed xhtml
$usexhtml: true or false
*/
function usexhtml($usexhtml=true, $encoding="iso-8859-1", $lang="en") {
if ($this->has_expired) {
if ($usexhtml) {
$this->usexhtml = 'true';
if ($encoding != $this->encoding) {
$this->set_encoding($encoding);
}
$this->set_xhtml_lang($lang);
$this->set_doctype('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
}
}
}
/***************************************************************************
usep
Public: tells the editor to use <p> on return instead of <div> (the default)
$usep: true or false
*/
function usep($usep=true) {
if ($this->has_expired) {
if ($usep) {
$this->usep = 'true';
}
}
}
/***************************************************************************
set_baseURL
Public: sets the baseURL
$baseURL: the base url of the document being edited. Set this to avoid broken links and images.
*/
function set_baseurl($baseURL='') {
if ($this->has_expired) {
if (!empty($baseURL)) {
$this->baseURL = $baseURL;
$this->baseURL2 = "<base href=\"$baseURL\">";
$this->domain = str_replace('/','\/',quotemeta($baseURL));
}
}
}
/***************************************************************************
set_stylesheet
Public: sets the stylesheet to use with the wysiwyg view. Set only if editing a snippit of code.
$stylesheet: the path to the stylesheet to be applied to the WYSIWYG view required if you are only editing a snippit of html. Should look like: '/myfolder/mystyles.css'
OR an array of stylesheets to be applied.
*/
function set_stylesheet($stylesheet='') {
if ($this->has_expired) {
if (!empty($stylesheet)) {
if (is_array($stylesheet)) {
$this->set_style = implode("','", $stylesheet);
} else {
$this->set_style = $stylesheet;
}
}
}
}
/***************************************************************************
set_instance_lang
Public: sets the language file for this instance
$lang_file: the lang file to use eg "ger";
*/
function set_instance_lang($lang_file="en-us.php") {
if ($this->has_expired) {
if (!empty($lang_file)) {
if (!file_exists (WP_FILE_DIRECTORY.'lang/'.$lang_file)) {
die("<p><b>WysiwygPro - Paramater Error:</b> set_instance_lang: the language file you specified for this instance does not exist.");
}
$this->instance_lang = $lang_file;
}
}
}
/***************************************************************************
guidelines_visible
Public: sets whether guidelines are on by default
$show: true means they are false means theyre not
*/
function guidelines_visible($show = true) {
if ($this->has_expired) {
if ($show) {
$this->guidelines = '1';
} else {
$this->guidelines = '0';
}
}
}
/***************************************************************************
subsequent
Public: sets the attribute value for lang tags
$lang: the lang attribute value eg "en"
*/
function subsequent($subsequent=true) {
if ($this->has_expired) {
if ($subsequent) {
$this->subsequent = 'true';
} else {
$this->subsequent = 'false';
}
}
}
/***************************************************************************
removebuttons
Public: sets the buttons and tabs that shouldn't be displayed.
$removearray: a comma separated list of buttons that SHOULDN'T be displayed.
*/
function removebuttons($removearray='') {
if ($this->has_expired) {
if (!empty($removearray)) {
$this->remove($removearray);
}
}
}
/***************************************************************************
addbutton
Public: adds a button to the toolbar
*/
function addbutton($title, $location, $function, $url, $width=NULL, $height=NULL, $cid='forecolor') {
if ($this->has_expired) {
$button = "<td><img cid=\"$cid\" class=\"ready\" onclick=\"$function\" src=\"$url\"";
if (is_int($width)) {
$button .= ' width="'.$width.'"';
}
if (is_int($height)) {
$button .= ' height="'.$height.'"';
}
$button .= " alt=\"$title\" title=\"$title\" type=\"btn\" onMouseOver=\"wp_m_over(this, ##name##);\" onMouseOut=\"wp_m_out(this, ##name##);\" onMouseDown=\"wp_m_down(this, ##name##);\" onMouseUp=\"wp_m_up(this, ##name##);\"></td>";
if (substr($location, 0, 6) == 'after:') {
$handle = substr($location, 6);
$this->WYSIWYGPRO_code = preg_replace("/(<\/td>\s+<!-- end $handle -->)/smi", "\$1\n<!-- begin $title -->\n$button\n<!-- end $title -->\n", $this->WYSIWYGPRO_code);
} else if (substr($location, 0, 7) == 'before:') {
$handle = substr($location, 7);
$this->WYSIWYGPRO_code = preg_replace("/(<!-- begin $handle -->\s+<td>)/smi", "\n<!-- begin $title -->\n$button\n<!-- end $title -->\n\$1", $this->WYSIWYGPRO_code);
} else {
die("<p><b>WysiwygPro Paramater Error:</b> You supplied an incorrect argument to addbuttons</p>");
}
}
}
/***************************************************************************
addspacer
Public: add a spacer to the toolbar
*/
function addspacer($title, $location) {
if ($this->has_expired) {
$button = '<td><img class="wpSpacer" width="1" height="22" src="'.WP_WEB_DIRECTORY.'images/spacer.gif" alt=""></td>';
if (!empty($title)) {
$before = "\n<!-- begin $title -->\n";
$after = "\n<!-- end $title -->\n";
} else {
$before = "\n";
$after = "\n";
}
if (substr($location, 0, 6) == 'after:') {
$handle = substr($location, 6);
$this->WYSIWYGPRO_code = preg_replace("/(<\/td>\s+<!-- end $handle -->)/smi", "\$1$before$button$after", $this->WYSIWYGPRO_code);
} else if (substr($location, 0, 7) == 'before:') {
$handle = substr($location, 7);
$this->WYSIWYGPRO_code = preg_replace("/(<!-- begin $handle -->\s+<td>)/smi", "$before$button$after\$1", $this->WYSIWYGPRO_code);
} else {
die("<p><b>WysiwygPro Paramater Error:</b> You supplied an incorrect argument to addspacer</p>");
}
}
}
/***************************************************************************
usefullurls
Public: removes code that cleans urls and links by deleting the server name.
$dontremoveserver: true or false. if set to true url cleaning wil be disabled
*/
function usefullurls($dontremoveserver=true) {
if ($this->has_expired) {
if ($dontremoveserver) {
$this->remove('removeserver');
$this->dontremoveserver=true;
}
}
}
/***************************************************************************
set_classmenu
Public: builds a custom class menu
$classes: array of class names and titles where the key in each row is the className and the value is a description eg. array('className' =>' Title to appear in menu', 'anotherClass' => 'Another title');
*/
function set_classmenu($classes) {
if ($this->has_expired) {
if (!is_array($classes)) {
die('<p><b>WYSIWYGPRO Paramater Error:</b> Your class list is not an array!</p>');
} else {
$class_menu = '';
foreach($classes as $k => $v) {
$k = trim($k);
$v = trim($v);
if ((!empty($k)) && (!empty($v))) {
$class_menu.='<div class="off" onclick="parent.wp_change_class(parent.wp_current_obj,\''.$k.'\');off(this)" onmouseover="on(this)" onmouseout="off(this)"><nobr><span class="'.$k.'" style="position: static; float: none; clear: both; display: block; visibility: visible">'.$v.' ('.$k.')</span></nobr></div>';
}
}
$this->class_menu = $class_menu;
}
}
}
/***************************************************************************
set_fontmenu
Public: builds the font menu
$classes: comma separated list of fonts to display.
*/
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -