inline-uploading.php

来自「php 开发的内容管理系统」· PHP 代码 · 共 723 行 · 第 1/2 页

PHP
723
字号
}function toggleImage(n) {	oi = document.getElementById('I'+n);	if ( oi.innerHTML == htmldecode(usingthumbnail) ) {		oi.innerHTML = usingoriginal;	} else {		oi.innerHTML = usingthumbnail;	}	updateImage(n);}function toggleOtherIcon(n) {	od = document.getElementById('div'+n);	oi = document.getElementById('I'+n);	if ( oi.innerHTML == htmldecode(usingtitle) ) {		oi.innerHTML = usingfilename;		od.className = 'otherwrap usingtext';	} else if ( oi.innerHTML == htmldecode(usingfilename) && icon[n] != '' ) {		oi.innerHTML = usingicon;		od.className = 'otherwrap usingicon';	} else {		oi.innerHTML = usingtitle;		od.className = 'otherwrap usingtext';	}	updateOtherIcon(n);}function updateImage(n) {	od=document.getElementById('div'+n);	ol=document.getElementById('L'+n);	oi=document.getElementById('I'+n);	if ( oi.innerHTML == htmldecode(usingthumbnail) ) {		img = imga[n];	} else {		img = imgb[n];	}	if ( ol.innerHTML == htmldecode(linkedtoimage) ) {		od.innerHTML = ab[n]+img+'</a>';	} else if ( ol.innerHTML == htmldecode(linkedtopage) ) {		od.innerHTML = aa[n]+img+'</a>';	} else {		od.innerHTML = img;	}}function updateOtherIcon(n) {	od=document.getElementById('div'+n);	ol=document.getElementById('L'+n);	oi=document.getElementById('I'+n);	if ( oi.innerHTML == htmldecode(usingfilename) ) {		txt = filename[n];	} else if ( oi.innerHTML == htmldecode(usingicon) ) {		txt = icon[n];	} else {		txt = title[n];	}	if ( ol.innerHTML == htmldecode(linkedtofile) ) {		od.innerHTML = ab[n]+txt+'</a>';	} else if ( ol.innerHTML == htmldecode(linkedtopage) ) {		od.innerHTML = aa[n]+txt+'</a>';	} else {		od.innerHTML = txt;	}}var win = window.opener ? window.opener : window.dialogArguments;if (!win) win = top;tinyMCE = win.tinyMCE;richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 );function sendToEditor(n) {	o = document.getElementById('div'+n);	h = o.innerHTML.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // Trim	h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]*)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes	h = h.replace(new RegExp(' (width|height)=".*?"', 'g'), ''); // Drop size constraints	h = h.replace(new RegExp(' on(click|mousedown)="[^"]*"', 'g'), ''); // Drop menu events	h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames	h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again	h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML	if ( richedit )		win.tinyMCE.execCommand('mceInsertContent', false, h);	else		win.edInsertContent(win.edCanvas, h);}// ]]></script><style type="text/css"><?php if ( $action == 'links' ) : ?>* html { overflow-x: hidden; }<?php else : ?>* html { overflow-y: hidden; }<?php endif; ?>body {	font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;	border: none;	margin: 0px;	height: 150px;	background: #dfe8f1;}form {	margin: 3px 2px 0px 6px;}#wrap {	clear: both;	padding: 0px;	width: 100%;}#images {	position: absolute;	clear: both;	margin: 0px;	padding: 15px 15px;	width: <?php echo $images_width; ?>px;}#images img {	background-color: rgb(209, 226, 239);}<?php echo $style; ?>.attwrap, .attwrap * {	margin: 0px;	padding: 0px;	border: 0px;}.imagewrap {	margin-right: 5px;	overflow: hidden;	width: 128px;}.otherwrap {	margin-right: 5px;	overflow: hidden;	background-color: #f9fcfe;}.otherwrap a {	display: block;}.otherwrap a, .otherwrap a:hover, .otherwrap a:active, .otherwrap a:visited {	color: blue;}.usingicon {	padding: 0px;	height: 96px;	text-align: center;	width: 128px;}.usingtext {	padding: 3px;	height: 90px;	text-align: left;	width: 122px;}.filetype {	font-size: 80%;	border-bottom: 3px double #89a}.imagewrap, .imagewrap img, .imagewrap a, .imagewrap a img, .imagewrap a:hover img, .imagewrap a:visited img, .imagewrap a:active img {	text-decoration: none;}#upload-menu {	background: #fff;	margin: 0px;	padding: 0;	list-style: none;	height: 2em;	border-bottom: 1px solid #448abd;	width: 100%;}#upload-menu li {	float: left;	margin: 0 0 0 .75em;}#upload-menu a {	display: block;	padding: 5px;	text-decoration: none;	color: #000;	border-top: 3px solid #fff;}#upload-menu .current a {	background: #dfe8f1;	border-right: 2px solid #448abd;}#upload-menu a:hover {	background: #dfe8f1;	color: #000;}.tip {	color: rgb(68, 138, 189);	padding: 2px 1em;}.inactive {	color: #fff;	padding: 1px 3px;}.left {	float: left;}.right {	float: right;}.center {	text-align: center;}#upload-menu li.spacer {	margin-left: 40px;}#title, #descr {	width: 99%;	margin-top: 1px;}th {	width: 4.5em;}#descr {	height: 36px;}#buttons {	margin-top: 2px;	text-align: right;}.popup {	margin: 4px 4px;	padding: 1px;	position: absolute;	width: 114px;	display: none;	background-color: rgb(240, 240, 238);	border-top: 2px solid #fff;	border-right: 2px solid #ddd;	border-bottom: 2px solid #ddd;	border-left: 2px solid #fff;	text-align: center;}.imagewrap .popup {	opacity: .90;	filter:alpha(opacity=90);}.otherwrap .popup {	padding-top: 20px;}.popup a, .popup a:visited, .popup a:active {	background-color: transparent;	display: block;	width: 100%;	text-decoration: none;	color: #246;}.popup a:hover {	background-color: #fff;	color: #000;}.caption {	text-align: center;}#submit {	margin: 1px;	width: 99%;}#submit input, #submit input:focus {	background: url( images/fade-butt.png );	border: 3px double #999;	border-left-color: #ccc;	border-top-color: #ccc;	color: #333;	padding: 0.25em;}#submit input:active {	background: #f4f4f4;	border: 3px double #ccc;	border-left-color: #999;	border-top-color: #999;}.zerosize {	width: 0px;	height: 0px;	overflow: hidden;	position: absolute;}#links {	margin: 3px 8px;	line-height: 2em;}#links textarea {	width: 95%;	height: 4.5em;}</style></head><body><ul id="upload-menu"><li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__) . "?action=upload&amp;post=$post&amp;all=$all&amp;start=$start"; ?>"><?php _e('Upload'); ?></a></li><?php if ( $attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post'") ) { ?><li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__) . "?action=view&amp;post=$post&amp;all=false"; ?>"><?php _e('Browse'); ?></a></li><?php } ?><?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment'")) { ?><li<?php echo $current_3; ?>><a href="<?php echo basename(__FILE__) . "?action=view&amp;post=$post&amp;all=true"; ?>"><?php _e('Browse All'); ?></a></li><?php } ?><li> </li><?php if ( $action == 'view' ) { ?><?php if ( false !== $back ) : ?><li class="spacer"><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;start=0"; ?>" title="<?php _e('First'); ?>">|&laquo;</a></li><li><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;start=$back"; ?>">&laquo; <?php _e('Back'); ?></a></li><?php else : ?><li class="inactive spacer">|&laquo;</li><li class="inactive">&laquo; <?php _e('Back'); ?></li><?php endif; ?><?php if ( false !== $next ) : ?><li><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;start=$next"; ?>"><?php _e('Next &raquo;'); ?></a></li><li><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;last=true"; ?>" title="<?php _e('Last'); ?>">&raquo;|</a></li><?php else : ?><li class="inactive"><?php _e('Next'); ?> &raquo;</li><li class="inactive">&raquo;|</li><?php endif; ?><?php } // endif not upload?></ul><?php if ( $action == 'view' ) : ?><div id="wrap"><!--<div class="tip"><?php _e('You can drag and drop these items into your post. Click on one for more options.'); ?></div>--><div id="images"><?php echo $html; ?><?php echo $popups; ?></div></div><?php elseif ( $action == 'upload' ) : ?><div class="tip"></div><form enctype="multipart/form-data" id="uploadForm" method="post" action="<?php echo basename(__FILE__); ?>"><table style="width:99%;"><tr><th scope="row" align="right"><label for="upload"><?php _e('File:'); ?></label></th><td><input type="file" id="upload" name="image" /></td></tr><tr><th scope="row" align="right"><label for="title"><?php _e('Title:'); ?></label></th><td><input type="text" id="title" name="imgtitle" /></td></tr><tr><th scope="row" align="right"><label for="descr"><?php _e('Description:'); ?></label></th><td><input type="textarea" name="descr" id="descr" value="" /></td></tr><tr id="buttons"><th></th><td><input type="hidden" name="action" value="save" /><input type="hidden" name="post" value="<?php echo $post; ?>" /><input type="hidden" name="all" value="<?php echo $all; ?>" /><input type="hidden" name="start" value="<?php echo $start; ?>" /><?php wp_nonce_field( 'inlineuploading' ); ?><div id="submit"><input type="submit" value="<?php _e('Upload'); ?>" /><?php if ( !empty($all) ) : ?><input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" /><?php endif; ?></div></td></tr></table></form><?php elseif ( $action == 'links' ) : ?><div id="links"><?php the_attachment_links($attachment); ?></div><?php endif; ?></body></html>

⌨️ 快捷键说明

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