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

📄 class.tx_rtehtmlarea_select_image.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 3 页
字号:
	function main_rte()	{		global $LANG, $TYPO3_CONF_VARS, $FILEMOUNTS, $BE_USER;					// Starting content:		$this->content = $this->doc->startPage($LANG->getLL('Insert Image',1));					// Making menu in top:		$menuDef = array();		if (in_array('image',$this->allowedItems) && ($this->act=='image' || t3lib_div::_GP('cWidth'))) {			$menuDef['page']['isActive'] = $this->act=='image';			$menuDef['page']['label'] = $LANG->getLL('currentImage',1);			$menuDef['page']['url'] = '#';			$menuDef['page']['addParams'] = 'onClick="jumpToUrl(\'?act=image&editorNo='.$this->editorNo.'\');return false;"';		}		if (in_array('magic',$this->allowedItems)){			$menuDef['file']['isActive'] = $this->act=='magic';			$menuDef['file']['label'] = $LANG->getLL('magicImage',1);			$menuDef['file']['url'] = '#';			$menuDef['file']['addParams'] = 'onClick="jumpToUrl(\'?act=magic&editorNo='.$this->editorNo.'\');return false;"';		}		if (in_array('plain',$this->allowedItems)) {			$menuDef['url']['isActive'] = $this->act=='plain';			$menuDef['url']['label'] = $LANG->getLL('plainImage',1);			$menuDef['url']['url'] = '#';			$menuDef['url']['addParams'] = 'onClick="jumpToUrl(\'?act=plain&editorNo='.$this->editorNo.'\');return false;"';		}		if (in_array('dragdrop',$this->allowedItems)) {			$menuDef['mail']['isActive'] = $this->act=='dragdrop';			$menuDef['mail']['label'] = $LANG->getLL('dragDropImage',1);			$menuDef['mail']['url'] = '#';			$menuDef['mail']['addParams'] = 'onClick="openDragDrop();return false;"';		}		$this->content .= $this->doc->getTabMenuRaw($menuDef);				if ($this->act!='image')	{						// ***************************			// Upload			// ***************************				// Create upload/create folder forms, if a path is given:			if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) {				$fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');				$fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);				$path=$this->expandFolder;				if (!$path || !@is_dir($path))	{					$path = $fileProcessor->findTempFolder().'/';	// The closest TEMP-path is found				}				if ($path!='/' && @is_dir($path))	{					$uploadForm=$this->uploadForm($path);					$createFolder=$this->createFolder($path);				} else {					$createFolder='';					$uploadForm='';				}				$this->content .= $uploadForm;				if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) {					$this->content.=$createFolder;				}			}				// Getting flag for showing/not showing thumbnails:			$noThumbs = $BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect');			if (!$noThumbs)	{					// MENU-ITEMS, fetching the setting for thumbnails from File>List module:				$_MOD_MENU = array('displayThumbs' => '');				$_MCONF['name']='file_list';				$_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']);				$addParams = '&act='.$this->act.'&editorNo='.$this->editorNo.'&expandFolder='.rawurlencode($this->expandFolder);				$thumbNailCheck = t3lib_BEfunc::getFuncCheck('','SET[displayThumbs]',$_MOD_SETTINGS['displayThumbs'],'select_image.php',$addParams,'id="checkDisplayThumbs"').' <label for="checkDisplayThumbs">'.$LANG->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs',1).'</label>';			} else {				$thumbNailCheck='';			}				// File-folders:			$foldertree = t3lib_div::makeInstance('tx_rtehtmlarea_image_folderTree');			$tree=$foldertree->getBrowsableTree();			list(,,$specUid) = explode('_',t3lib_div::_GP('PM'));			$files = $this->expandFolder($foldertree->specUIDmap[$specUid],$this->act=='plain',$noThumbs?$noThumbs:!$_MOD_SETTINGS['displayThumbs']);						$this->content.= '<table border=0 cellpadding=0 cellspacing=0>			<tr>				<td valign=top>'.$this->barheader($LANG->getLL('folderTree').':').$tree.'</td>				<td>&nbsp;</td>				<td valign=top>'.$files.'</td>			</tr>			</table>			<br />'.$thumbNailCheck;						// ***************************			// Help			// ***************************			if ($this->act=='magic')	{				$this->content .= $this->getMsgBox($LANG->getLL('magicImage_msg'));			}			if ($this->act=='plain')	{				$this->content .= $this->getMsgBox(sprintf($LANG->getLL('plainImage_msg'), $this->plainMaxWidth, $this->plainMaxHeight));			}		} else {			$JScode = '				document.write(printCurrentImageOptions());				insertImagePropertiesInForm();';			$this->content.= '<br />'.$this->doc->wrapScriptTags($JScode);		}		$this->content.= $this->doc->endPage();		return $this->content;	}		/***************************	 *	 * OTHER FUNCTIONS:	 *	 ***************************/	/**	 * @param	[type]		$expandFolder: ...	 * @param	[type]		$plainFlag: ...	 * @return	[type]		...	 */	function expandFolder($expandFolder=0,$plainFlag=0,$noThumbs=0)	{		global $LANG, $BE_USER, $BACK_PATH;		$expandFolder = $expandFolder ? $expandFolder :t3lib_div::_GP('expandFolder');		$out='';		if ($expandFolder && $this->checkFolder($expandFolder))	{			$files = t3lib_div::getFilesInDir($expandFolder,($plainFlag?'jpg,jpeg,gif,png':$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),1,1);	// $extensionList="",$prependPath=0,$order="")			if (is_array($files))	{				reset($files);				$out.=$this->barheader(sprintf($LANG->getLL('images').' (%s):',count($files)));				$titleLen = intval($BE_USER->uc['titleLen']);				$picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';				$picon.=htmlspecialchars(t3lib_div::fixed_lgd(basename($expandFolder),$titleLen));				$out.='<span class="nobr">'.$picon.'</span><br />';				$imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');				$imgObj->init();				$imgObj->mayScaleUp=0;				$imgObj->tempPath=PATH_site.$imgObj->tempPath;								$lines=array();				while(list(,$filepath)=each($files))	{					$fI=pathinfo($filepath);										$origFile = t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site)));					$iurl = $this->siteUrl.$origFile;					$imgInfo = $imgObj->getImageDimensions($filepath);						// File icon:					$icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));					$pDim = $imgInfo[0].'x'.$imgInfo[1].' '.$LANG->getLL('pixels',1);					$size=' ('.t3lib_div::formatSize(filesize($filepath)).$LANG->getLL('bytes',1).', '.$pDim.')';					$icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$icon.'','width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';					if (!$plainFlag)	{						$ATag = '<a href="#" onclick="return jumpToUrl(\'?editorNo='.$this->editorNo.'&insertMagicImage='.rawurlencode($filepath).'\');">';					} else {						$ATag = '<a href="#" onclick="return insertImage(\''.$iurl.'\','.$imgInfo[0].','.$imgInfo[1].',\''.$origFile.'\');">';					}					$ATag_e='</a>';					if ($plainFlag && (($imgInfo[0] > $this->plainMaxWidth) || ($imgInfo[1] > $this->plainMaxHeight)))	{						$ATag='';						$ATag_e='';						$ATag2='';						$ATag2_e='';					} else {						$ATag2='<a href="#" onClick="launchView(\''.rawurlencode($filepath).'\'); return false;">';						$ATag2_e='</a>';					}					$filenameAndIcon=$ATag.$icon.htmlspecialchars(t3lib_div::fixed_lgd(basename($filepath),$titleLen)).$ATag_e;					$lines[]='<tr class="bgColor4"><td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td><td nowrap="nowrap">'.$pDim.'&nbsp;</td></tr>';					$lines[]='<tr><td colspan="2">'.($noThumbs ? '' : $ATag2.t3lib_BEfunc::getThumbNail($this->doc->backPath.'thumbs.php',$filepath,'hspace="5" vspace="5" border="1"').$ATag2_e).						'</td></tr>';					$lines[]='<tr><td colspan="2"><img src="clear.gif" width="1" height="3"></td></tr>';				}				$out.='<table border="0" cellpadding="0" cellspacing="1">'.implode('',$lines).'</table>';			}		}		return $out;	}		/**	 * For TBE: Makes an upload form for uploading files to the filemount the user is browsing.	 * The files are uploaded to the tce_file.php script in the core which will handle the upload.	 *	 * @param	string		Absolute filepath on server to which to upload.	 * @return	string		HTML for an upload form.	 */	function uploadForm($path)	{		global $BACK_PATH;		$count=3;			// Create header, showing upload path:		$header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;		$code=$this->barheader($GLOBALS['LANG']->getLL('uploadImage').':');		$code.='			<!--				Form, for uploading files:			-->			<form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">				<table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">					<tr>						<td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>					</tr>					<tr>						<td>';			// Traverse the number of upload fields (default is 3):		for ($a=1;$a<=$count;$a++)	{			$code.='<input type="file" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50" />				<input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($path).'" />				<input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';		}			// Make footer of upload form, including the submit button:		$redirectValue = $this->thisScript.'?act='.$this->act.'&editorNo='.$this->editorNo.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);		$code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.				'<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';		$code.='			<div id="c-override">				<input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> <label for="overwriteExistingFiles">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'</label>			</div>		';		$code.='</td>					</tr>				</table>			</form>';		return $code;	}				/**	 * For TBE: Makes a form for creating new folders in the filemount the user is browsing.	 * The folder creation request is sent to the tce_file.php script in the core which will handle the creation.	 *	 * @param	string		Absolute filepath on server in which to create the new folder.	 * @return	string		HTML for the create folder form.	 */	function createFolder($path)	{		global $BACK_PATH;			// Create header, showing upload path:		$header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;		$code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');		$code.='			<!--				Form, for creating new folders:			-->			<form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform2">				<table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">					<tr>						<td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>					</tr>					<tr>						<td>';			// Create the new-folder name field:		$a=1;		$code.='<input'.$this->doc->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.				'<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($path).'" />';			// Make footer of upload form, including the submit button:		$redirectValue = $this->thisScript.'?act='.$this->act.'&editorNo='.$this->editorNo.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);		$code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.				'<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';		$code.='</td>					</tr>				</table>			</form>';		return $code;	}}if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php'])	{	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php']);}?>

⌨️ 快捷键说明

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