⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editor_class.php

📁 类似youtube的视频分享网站源码。有后台管理系统及模板
💻 PHP
📖 第 1 页 / 共 4 页
字号:
	
	function set_fontmenu($fonts) {
		if ($this->has_expired) {
			if (isset ($fonts) ? $fonts : '') {
				$fonts_array = explode (';', $fonts);
				// loop through the array add the fonts
				$fonts_menu = '';
				$num_fonts = sizeof($fonts_array);
				for ($i=0; $i<$num_fonts; $i++) { 
					if (!empty($fonts_array[$i])) {
						$font= trim($fonts_array[$i]);
						$fonts_menu.='<div class="off" onclick="parent.wp_change_font(parent.wp_current_obj,\''.$font.'\');off(this)" title="'.$font.'" onmouseover="on(this)" onmouseout="off(this)" style="font-family:'.$font.'"><nobr>'.$font.'</nobr></div>';
					}
				}
				$this->font_menu = $fonts_menu;
			}
		}
	}
	
	
	/***************************************************************************
	 set_formatmenu
	 Public: builds the format menu
	 $classes: An array where the key in each row is the block level format tag and the value is a description of that tag.
	 
	*/
	
	function set_formatmenu($formats) {
		if ($this->has_expired) {
			if (!is_array($formats)) {
				die('<p><b>WYSIWYGPRO Paramater Error:</b> Your format list is not an array!</p>');
			} else {
				$format_menu = '';
				foreach($formats as $k => $v) {
					if ((!empty($k)) && (!empty($v))) {
						$k = trim($k);
						$v = trim($v);
						$format_menu.= '
			<div class="off" onclick="parent.wp_change_format(parent.wp_current_obj,\'&lt;'.$k.'&gt;\');off(this)" onmouseover="on(this)" onmouseout="off(this)"><nobr> 
			<'.$k.' style="position: static; float: none; clear: both; display: block; visibility: visible">'.$v.'</'.$k.'>
			</nobr></div>';
					}
				}
				$this->format_menu = $format_menu;
			}
		}
	}


	/***************************************************************************
	 set_sizemenu
	 Public: builds the font size menu
	 $classes: An array where the key in each row is the size and the value is a description of that size.
	 
	*/
	
	function set_sizemenu($sizes) {
		if ($this->has_expired) {
			if (!is_array($sizes)) {
				die('<p><b>WYSIWYGPRO Paramater Error:</b> Your size list is not an array!</p>');
			} else {
				$size_menu = '';
				foreach($sizes as $k => $v) {
					$k = trim($k);
					$v = trim($v);
					if ((!empty($k)) && (!empty($v))) {
						$size_menu.= '
			<div class="off" onclick="parent.wp_change_font_size(parent.wp_current_obj,\''.$k.'\');off(this)" onmouseover="on(this)" onmouseout="off(this)"><nobr><font size="'.$k.'">'.$v.'</font></nobr></div>';
					}
				}
				$this->size_menu = $size_menu;
			}
		}
	}
	
	/***************************************************************************
	 set_color_swatches
	 Public: adds a color swatches to the color dialog
	 $colors: comma separated list of colors
	 
	*/
	
	function set_color_swatches($colors) {
		if ($this->has_expired) {
			if (!empty($colors)) {
				$this->color_swatches = str_replace(' ', '', $colors);
			}
		}
	}

	

	/***************************************************************************
	 disableimgmngr
	 Public: disables the image manager. Users can still insert images but must enter a URL to the image
	 $dsbleimgmngr: true or false
	 
	*/
	
	function disableimgmngr($dsbleimgmngr=true) {
		if ($this->has_expired) {
			if ($dsbleimgmngr) {
				$this->dsbleimgmngr = true;
				$this->image_window = 'imageoptions.php';
			}
		}
	}


	/***************************************************************************
	 disablelinkmngr
	 Public: disables the link manager. This is public but not documented because this function will automatically be called if no links have been set.
	 $dsbleimgmngr: true or false
	 
	*/
	
	function disablelinkmngr($disable=true) {
		if ($this->has_expired) {
			if ($disable) {
				$this->hyperlink_function = "callFormatting(##name##,'CreateLink')";
				$this->hyperlink_function2 = "callFormatting(parent.wp_current_obj,'CreateLink')";
			}
		}
	}
	
	/***************************************************************************
	 disablebookmarkmngr
	 Public: disables the bookmark manager.
	 $dsbleimgmngr: true or false
	 
	*/
	
	function disablebookmarkmngr($disable=true) {
		if ($this->has_expired) {
			if ($disable) {
				$this->showbookmarkmngr = 'false';
			}
		}
	}


	/***************************************************************************
	 add_insert
	 Public: adds custom objects.
	 $inserts: an array where the key is the description and the value is the html code to insert
	 
	*/
	
	function set_inserts($inserts) {
		if ($this->has_expired) {
			if (!is_array($inserts)) {
				die('<p><b>WYSIWYGPRO Paramater Error:</b> Your custom inserts are not an array!</p>');
			} else {
				$custom_objects = array();
				foreach($inserts as $k => $v) {
					if (!empty($v)) {
						$description = str_replace(array("'","\r\n","\r","\n"),array("\'",'\n','\n','\n'),$k);
						$code = str_replace(array("'","\r\n","\r","\n"),array("\'",'\n','\n','\n'),$this->wp_entities($v));
						array_push($custom_objects, "['".$description."','".$code."']");
					}
				}
				$this->custom_objects = implode(',', $custom_objects);
			}
		}
	}
	
	/***************************************************************************
	 set_links
	 Public: generates a list of selectable links to appear in the hyperlink window.
	 $links: an auto indexed 2d array with three values in each row: indentdepth, url, name, e.g. array( array(0, '/myfolder/page1.htm', 'Page One'),	array(0, 'folder', 'Section 1'),	array(1, '/myfolder/page2.htm', 'Page two') );
	 
	*/
	
	function set_links($links) {
		if ($this->has_expired) {
			if (!is_array($links)) {
				die('<p>WYSIWYGPRO Paramater Error: Your link list is not an array!</p>');
			} else {
				$num_links = sizeof($links);
				$arr = array();
				for ($i=0; $i<$num_links; $i++) { 
					if ((!empty($links[$i][1])) && (!empty($links[$i][2]))) {
						array_push($arr, '['.intval($links[$i][0]).',"'.str_replace('"', '\"', $links[$i][1]).'","'.str_replace('"', '\"', $links[$i][2]).'"]');
					}	
				}
				$this->links = implode(',',$arr);
			}
		}
	}
	
	/***************************************************************************
	 set_savebutton
	 Public: adds a custom save button to the toolbar
	 
	*/
	
	function set_savebutton($name, $url=NULL, $width=NULL, $height=NULL) {
		if ($this->has_expired) {
			if (strtolower($name) == 'save') {
				$name= '##save##';
				if ($url == NULL) {
					$url = WP_WEB_DIRECTORY.'images/save.gif';
				}
				if ($width == NULL) {
					$width = 22;
				}
				if ($height == NULL) {
					$height = 22;
				}
			} else if (strtolower($name) == 'send') {
				$name= '##send##';
				if ($url == NULL) {
					$url = WP_WEB_DIRECTORY.'images/send.gif';
				}
				if ($width == NULL) {
					$width = 50;
				}
				if ($height == NULL) {
					$height = 22;
				}
			} else if (strtolower($name) == 'post') {
				$name= '##post##';
				if ($url == NULL) {
					$url = WP_WEB_DIRECTORY.'images/post.gif';
				}
				if ($width == NULL) {
					$width = 50;
				}
				if ($height == NULL) {
					$height = 22;
				}
			}
			$save_button = "\n<!-- begin save -->\n<td><input cid=\"ignore\" style=\"cursor:default\" class=\"ready\" id=\"##name##_wp_save\" name=\"##name##_wp_save\" type=\"image\" src=\"$url\"";
			if (is_int($width)) {
				$save_button .= ' width="'.$width.'"';
			}
			if (is_int($height)) {
				$save_button .= ' height="'.$height.'"';
			}
			$this->save_button = $save_button." border=\"0\" title=\"$name\" 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>\n<!-- end save -->\n";
		}
	}
	
	
	/***************************************************************************
	 set_img_dir
	 Public: 
	 
	*/
	
	function set_img_dir($name) {
		if ($this->has_expired) {
			if (isset ($name) ? $name : '') {
				$this->instance_img_dir = $name;
			}
		}
	}


	/***************************************************************************
	 set_doc_dir
	 Public: 
	 
	*/
	
	function set_doc_dir($name) {
		if ($this->has_expired) {
			if (isset ($name) ? $name : '') {
				$this->instance_doc_dir = $name;
			}
		}
	}

	
	/***************************************************************************
	 Return editor
	 Public: returns all necissary DHTML code for displaying the editor 
	 $width: width of WYSIWYGPRO
	 $height: height of WYSIWYGPRO
	
	*/ 

	function return_editor($width=680, $height=390) {
		
		global $wp_has_been_previous;
		if ($wp_has_been_previous) {
			$this->subsequent(true);
		}
		$wp_has_been_previous = true;
		
		// if cache has expired build the editor from scratch, else simply load it from the cache file
		if ($this->has_expired) {
		
			// BEGIN
			
			// check document directory. If NULL disable downloadable document manager
			if ((DOCUMENT_FILE_DIRECTORY == NULL || DOCUMENT_WEB_DIRECTORY == NULL) && empty($this->instance_doc_dir)) {
				$this->remove('document');
			}
			
			// check image directory. If NULL disable image manager
			if ((IMAGE_FILE_DIRECTORY == NULL || IMAGE_WEB_DIRECTORY == NULL) && empty($this->instance_img_dir)) {
				$this->image_window = 'imageoptions.php';
			}
			
			// check we have been sent valid width
			if (!(isset ($width) ? $width : '')) {
				// default width
				$width = 680;
			}
			
			// check we have been sent valid height settings
			if (isset ($height) ? $height : '') {
				$height = intval($height);
				if ($height == 0) {
					die("<p><b>WYSIWYGPRO - Paramater Error:</b> Your height paramater is not a valid integer!</p>");
				}
			} else {
				// default height
				$height = 390;
			}

			
			// initialize variables
			$imenu_height = 182;
			$bmenu_height = 125;
			$tmenu_height = 422;
			$smenu_height = 151;
			
			
			$format_list_style = '';
			$font_list_style = '';
			$size_list_style = '';
			$class_list_style = '';
			$toolbar1_style = '';
			$toolbar2_style = '';
			
			if ($this->is_ie50 == true) {
				$is_ie50 = 'true';
			} else {
				$is_ie50 = 'false';
			}
			
			if ($this->is_gecko == true) {
			
				$imenu_height -= 72;
				$tmenu_height -= 72;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -