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

📄 class.tx_rtehtmlarea_base.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 5 页
字号:
					return $registerRTEinJSString;	}		/**	 * Return JS configuration of font faces	 *	 * @return string		JS font faces configuration	 */	function buildJSFontfacesConfig($number) {		global $TSFE, $LANG;				if ($this->is_FE()) {			$RTEProperties = $this->RTEsetup;		} else {			$RTEProperties = $this->RTEsetup['properties'];		}				$registerRTEinJSString = '';					// Builing JS array of default font faces		$HTMLAreaFontname = array();		$HTMLAreaFontname['nofont'] = '				"' . $fontName . '" : "' . $this->cleanList($fontValue) . '"';		$defaultFontFacesList = 'nofont,';		if ($this->is_FE()) {			$HTMLAreaFontname['nofont'] = '				"' . $TSFE->csConvObj->conv($TSFE->getLLL('No font',$this->LOCAL_LANG), $TSFE->labelsCharset, $TSFE->renderCharset) . '" : ""';		} else {			$HTMLAreaFontname['nofont'] = '				"' . $LANG->getLL('No font') . '" : ""';		}				$hideFontFaces = $this->cleanList($this->thisConfig['hideFontFaces']);		if ($hideFontFaces != '*') {			$index = 0;			reset($this->defaultFontFaces);			while (list($fontName,$fontValue) = each($this->defaultFontFaces)) {				if (!t3lib_div::inList($hideFontFaces, $index+1)) {					$HTMLAreaFontname[$fontName] = '				"' . $fontName . '" : "' . $this->cleanList($fontValue) . '"';					$defaultFontFacesList .= $fontName . ',';				}				$index++;			}		}					// Adding configured font faces		if (is_array($RTEProperties['fonts.'])) {			reset($RTEProperties['fonts.']);			while(list($fontName,$conf)=each($RTEProperties['fonts.'])) {				$fontName = substr($fontName,0,-1);				$fontLabel = $this->getPageConfigLabel($conf['name'],0);				$HTMLAreaFontname[$fontName] = '				"' . $fontLabel . '" : "' . $this->cleanList($conf['value']) . '"';			}		}					// Setting the list of font faces		$HTMLAreaJSFontface = '{';		$HTMLAreaFontface = t3lib_div::trimExplode(',' , $this->cleanList($defaultFontFacesList . ',' . $this->thisConfig['fontFace']));		reset($HTMLAreaFontface);		$HTMLAreaFontfaceIndex = 0;		while( list(,$fontName) = each($HTMLAreaFontface)) {			if($HTMLAreaFontfaceIndex) { 				$HTMLAreaJSFontface .= ',';			}			$HTMLAreaJSFontface .= $HTMLAreaFontname[$fontName];			$HTMLAreaFontfaceIndex++;		}		$HTMLAreaJSFontface .= '};';				$registerRTEinJSString .= '			RTEarea['.$number.']["fontname"] = '. $HTMLAreaJSFontface;				return $registerRTEinJSString;	}		/**	 * Return JS configuration of colors	 *	 * @return string		JS colors configuration	 */	function buildJSColorsConfig($number) {		global $TSFE, $LANG;				if ($this->is_FE()) {			$RTEProperties = $this->RTEsetup;		} else {			$RTEProperties = $this->RTEsetup['properties'];		}				$registerRTEinJSString = '';				if(trim($this->thisConfig['disableColorPicker'])) {			$registerRTEinJSString .= '			RTEarea['.$number.']["disableColorPicker"] = true;';		} else {			$registerRTEinJSString .= '			RTEarea['.$number.']["disableColorPicker"] = false;';		}					// Building JS array of configured colors		if (is_array($RTEProperties['colors.']) )  {			$HTMLAreaColorname = array();			reset($RTEProperties['colors.']);			while(list($colorName,$conf)=each($RTEProperties['colors.']))      {				$colorName=substr($colorName,0,-1);				$colorLabel = $this->getPageConfigLabel($conf['name']);				$HTMLAreaColorname[$colorName] = '				[' . $colorLabel . ' , "' . $conf['value'] . '"]';			}		}					// Setting the list of colors if specified in the RTE config		if ($this->thisConfig['colors'] ) {			$HTMLAreaJSColors = '[';			$HTMLAreaColors = t3lib_div::trimExplode(',' , $this->cleanList($this->thisConfig['colors']));			reset($HTMLAreaColors);			$HTMLAreaColorsIndex = 0;			while( list(,$colorName) = each($HTMLAreaColors)) {				if($HTMLAreaColorsIndex && $HTMLAreaColorname[$colorName]) { 					$HTMLAreaJSColors .= ',';				}				$HTMLAreaJSColors .= $HTMLAreaColorname[$colorName];				$HTMLAreaColorsIndex++;			}			$HTMLAreaJSColors .= '];';			$registerRTEinJSString .= '			RTEarea['.$number.']["colors"] = '. $HTMLAreaJSColors;		}				return $registerRTEinJSString;	}		/**	 * Build the default content style sheet	 *	 * @return string		Style sheet	 */	function buildStyleSheet() {				if (!trim($this->thisConfig['ignoreMainStyleOverride'])) {			$mainStyle_font = $this->thisConfig['mainStyle_font'] ? $this->thisConfig['mainStyle_font']: 'Verdana,sans-serif';						$mainElements = array();			$mainElements['P'] = $this->thisConfig['mainStyleOverride_add.']['P'];			$elList = explode(',','H1,H2,H3,H4,H5,H6,PRE');			reset($elList);			while(list(,$elListName)=each($elList)) {				if ($this->thisConfig['mainStyleOverride_add.'][$elListName]) {					$mainElements[$elListName] = $this->thisConfig['mainStyleOverride_add.'][$elListName];				}			}						$addElementCode = '';			reset($mainElements);			while(list($elListName,$elValue)=each($mainElements))   {				$addElementCode .= strToLower($elListName) . ' {' . $elValue . '}' . chr(10);			}						$stylesheet = $this->thisConfig['mainStyleOverride'] ? $this->thisConfig['mainStyleOverride'] : chr(10) .				'body.htmlarea-content-body { font-family: ' . $mainStyle_font .					'; font-size: '.($this->thisConfig['mainStyle_size'] ? $this->thisConfig['mainStyle_size'] : '12px') .					'; color: '.($this->thisConfig['mainStyle_color']?$this->thisConfig['mainStyle_color'] : 'black') .					'; background-color: '.($this->thisConfig['mainStyle_bgcolor'] ? $this->thisConfig['mainStyle_bgcolor'] : 'white') .					';'.$this->thisConfig['mainStyleOverride_add.']['BODY'].'}' . chr(10) .				'td { ' . $this->thisConfig['mainStyleOverride_add.']['TD'].'}' . chr(10) .				'div { ' . $this->thisConfig['mainStyleOverride_add.']['DIV'].'}' . chr(10) .				'pre { ' . $this->thisConfig['mainStyleOverride_add.']['PRE'].'}' . chr(10) .				'ol { ' . $this->thisConfig['mainStyleOverride_add.']['OL'].'}' . chr(10) .				'ul { ' . $this->thisConfig['mainStyleOverride_add.']['UL'].'}' . chr(10) .				'blockquote { ' . $this->thisConfig['mainStyleOverride_add.']['BLOCKQUOTE'].'}' . chr(10) .				$addElementCode;				if (is_array($this->thisConfig['inlineStyle.']))        {				$stylesheet .= chr(10) . implode(chr(10), $this->thisConfig['inlineStyle.']) . chr(10);			}		} else {			$stylesheet = '/* mainStyleOverride and inlineStyle properties ignored. */';		}		return $stylesheet;	}		/**	 * Return JS configuration of classes	 *	 * @return string		JS classes configuration	 */	function buildJSClassesConfig($number) {					// Build JS array of lists of classes		$classesTagList = 'classesCharacter, classesParagraph, classesImage, classesTable, classesLinks, classesTD';		$classesTagConvert = array( 'classesCharacter' => 'span', 'classesParagraph' => 'p', 'classesImage' => 'img', 'classesTable' => 'table', 'classesLinks' => 'a', 'classesTD' => 'td');		$classesTagArray = t3lib_div::trimExplode(',' , $classesTagList);		$registerRTEinJSString = '			RTEarea['.$number.']["classesTag"] = new Object();';		while( list(,$classesTagName) = each($classesTagArray)) {			$HTMLAreaJSClasses = ($this->thisConfig[$classesTagName])?('"' . $this->cleanList($this->thisConfig[$classesTagName]) . '";'):'null;';			$registerRTEinJSString .= '			RTEarea['.$number.']["classesTag"]["'. $classesTagConvert[$classesTagName] .'"] = '. $HTMLAreaJSClasses;		}					// Include JS arrays of configured classes		$registerRTEinJSString .= '			RTEarea['.$number.']["classesUrl"] = "' . $this->hostURL . $this->buildJSFile('classes_'.$this->contentLanguageUid, $this->buildJSClassesArray()) . '";';				return $registerRTEinJSString;	}		/**	 * Return JS arrays of classes labels and noShow flags	 *	 * @return string		JS classes arrays	 */	function buildJSClassesArray() {		global $TSFE, $LANG, $TYPO3_CONF_VARS;				if ($this->is_FE()) {			$RTEProperties = $this->RTEsetup;		} else {			$RTEProperties = $this->RTEsetup['properties'];		}				$linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : chr(10);		$index = 0;		$JSClassesLabelsArray = 'HTMLArea.classesLabels = { ' . $linebreak;		$JSClassesValuesArray = 'HTMLArea.classesValues = { ' . $linebreak;		$JSClassesNoShowArray = 'HTMLArea.classesNoShow = { ' . $linebreak;					// Scanning the list of classes if specified in the RTE config		if (is_array($RTEProperties['classes.']))  {			$stylesheet = '';			reset($RTEProperties['classes.']);			while(list($className,$conf)=each($RTEProperties['classes.'])) {				$className = substr($className,0,-1);				$classLabel = $this->getPageConfigLabel($conf['name']);				$JSClassesLabelsArray .= (($index)?',':'') . '"' . $className . '": ' . $classLabel . $linebreak;				$JSClassesValuesArray .= (($index)?',':'') . '"' . $className . '":"' . str_replace('"', '\"', str_replace('\\\'', '\'', $conf['value'])) . '"' . $linebreak;				$JSClassesNoShowArray .= (($index)?',':'') . '"' . $className . '":' . ($conf['noShow']?'true':'false') . $linebreak;				$index++;			}		}		$JSClassesLabelsArray .= '};' . $linebreak;		$JSClassesValuesArray .= '};' . $linebreak;		$JSClassesNoShowArray .= '};' . $linebreak;				return $JSClassesLabelsArray . $JSClassesValuesArray . $JSClassesNoShowArray;	}		/**	 * Return a JS language array for htmlArea RTE	 *	 * @return string		JS language array	 */	function buildJSMainLangArray() { 		global $TSFE, $LANG, $TYPO3_CONF_VARS;				$linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : chr(10);		$JSLanguageArray .= 'var HTMLArea_langArray = new Object();' . $linebreak;		$JSLanguageArray .= 'HTMLArea_langArray = { ' . $linebreak;		if($this->is_FE()) {			$JSLanguageArray = $TSFE->csConvObj->conv($JSLanguageArray, 'iso-8859-1', $this->OutputCharset);		} else {			$JSLanguageArray = $LANG->csConvObj->conv($JSLanguageArray, 'iso-8859-1', $this->OutputCharset);		}		$subArrays = array( 'tooltips', 'msg' , 'dialogs');		$subArraysIndex = 0;		foreach($subArrays as $labels) {			$JSLanguageArray .= (($subArraysIndex++)?',':'') . $labels . ': {' . $linebreak;			if($this->is_FE()) {				$LOCAL_LANG = $TSFE->readLLfile(t3lib_extMgm::extPath($this->ID).'htmlarea/locallang_' . $labels . '.xml', $this->language);				$TSFE->csConvObj->convArray($LOCAL_LANG['default'], 'iso-8859-1', $this->OutputCharset);				if(!empty($LOCAL_LANG[$this->language])) $TSFE->csConvObj->convArray($LOCAL_LANG[$this->language], $this->charset, $this->OutputCharset);			} else {				$LOCAL_LANG = $LANG->readLLfile(t3lib_extMgm::extPath($this->ID).'htmlarea/locallang_' . $labels . '.xml');				$LANG->csConvObj->convArray($LOCAL_LANG['default'], 'iso-8859-1', $this->OutputCharset);				if(!empty($LOCAL_LANG[$this->language])) $LANG->csConvObj->convArray($LOCAL_LANG[$this->language], $this->charset, $this->OutputCharset);			}			if(!empty($LOCAL_LANG[$this->language])) {				$LOCAL_LANG[$this->language] = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG['default'], $LOCAL_LANG[$this->language]);			} else {				$LOCAL_LANG[$this->language] = $LOCAL_LANG['default'];			}			$index = 0;			foreach ( $LOCAL_LANG[$this->language] as $labelKey => $labelValue ) {				$JSLanguageArray .=  (($index++)?',':'') . '"' . $labelKey . '":"' . str_replace('"', '\"', $labelValue) . '"' . $linebreak;			}			if($this->is_FE()) {				$JSLanguageArray .= $TSFE->csConvObj->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset);			} else {				$JSLanguageArray .= $LANG->csConvObj->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset);			}		}		if($this->is_FE()) {			$JSLanguageArray .= $TSFE->csConvObj->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset);		} else {			$JSLanguageArray .= $LANG->csConvObj->conv(' }' . chr(10), 'iso-8859-1', $this->OutputCharset);		}		return $J

⌨️ 快捷键说明

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