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

📄 class.tslib_menu.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 5 页
字号:
				// Setting alternativeMenuTempArray (will be effective only if an array)			if (is_array($altArray))	{				$submenu->alternativeMenuTempArray = $altArray;			}			if ($submenu->start($this->tmpl, $this->sys_page, $uid, $this->conf, $this->menuNumber+1, $objSuffix))	{				$submenu->makeMenu();				return $submenu->writeMenu();			}		}	}	/**	 * Returns true if the page with UID $uid is the NEXT page in root line (which means a submenu should be drawn)	 *	 * @param	integer		Page uid to evaluate.	 * @param	string		MPvar for the current position of item.	 * @return	boolean		True if page with $uid is active	 * @access private	 * @see subMenu()	 */	function isNext($uid, $MPvar='')	{			// Check for always active PIDs:		if (count($this->alwaysActivePIDlist) && in_array($uid,$this->alwaysActivePIDlist))	{			return TRUE;		}		$testUid = $uid.($MPvar?':'.$MPvar:'');		if ($uid && $testUid==$this->nextActive)	{			return TRUE;		}	}	/**	 * Returns true if the page with UID $uid is active (in the current rootline)	 *	 * @param	integer		Page uid to evaluate.	 * @param	string		MPvar for the current position of item.	 * @return	boolean		True if page with $uid is active	 * @access private	 */	function isActive($uid, $MPvar='')	{			// Check for always active PIDs:		if (count($this->alwaysActivePIDlist) && in_array($uid,$this->alwaysActivePIDlist))	{			return TRUE;		}		$testUid = $uid.($MPvar?':'.$MPvar:'');		if ($uid && in_array('ITEM:'.$testUid, $this->rL_uidRegister))	{			return TRUE;		}	}	/**	 * Returns true if the page with UID $uid is the CURRENT page (equals $GLOBALS['TSFE']->id)	 *	 * @param	integer		Page uid to evaluate.	 * @param	string		MPvar for the current position of item.	 * @return	boolean		True if page $uid = $GLOBALS['TSFE']->id	 * @access private	 */	function isCurrent($uid, $MPvar='')	{		$testUid = $uid.($MPvar?':'.$MPvar:'');		if ($uid && !strcmp(end($this->rL_uidRegister),'ITEM:'.$testUid))	{			return TRUE;		}	}	/**	 * Returns true if there is a submenu with items for the page id, $uid	 * Used by the item states "IFSUB", "ACTIFSUB" and "CURIFSUB" to check if there is a submenu	 *	 * @param	integer		Page uid for which to search for a submenu	 * @return	boolean		Returns true if there was a submenu with items found	 * @access private	 */	function isSubMenu($uid)	{			// Looking for a mount-pid for this UID since if that exists we should look for a subpages THERE and not in the input $uid;		$mount_info = $this->sys_page->getMountPointInfo($uid);		if (is_array($mount_info))	{			$uid = $mount_info['mount_pid'];		}		$recs = $this->sys_page->getMenu($uid,'uid,pid,doktype,mount_pid,mount_pid_ol,nav_hide,shortcut,shortcut_mode');		foreach($recs as $theRec)	{			if (!t3lib_div::inList($this->doktypeExcludeList,$theRec['doktype']) && (!$theRec['nav_hide'] || $this->conf['includeNotInMenu']))	{	// If a menu item seems to be another type than 'Not in menu', then return true (there were items!)				return TRUE;			}		}	}	/**	 * Used by procesItemStates() to evaluate if a menu item (identified by $key) is in a certain state.	 *	 * @param	string		The item state to evaluate (SPC, IFSUB, ACT etc... but no xxxRO states of course)	 * @param	integer		Key pointing to menu item from ->menuArr	 * @return	boolean		True (integer!=0) if match, otherwise false (=0, zero)	 * @access private	 * @see procesItemStates()	 */	function isItemState($kind,$key)	{		$natVal=0;		if ($this->menuArr[$key]['ITEM_STATE'])	{		// If any value is set for ITEM_STATE the normal evaluation is discarded			if (!strcmp($this->menuArr[$key]['ITEM_STATE'],$kind))	{$natVal=1;}		} else {			switch($kind)	{				case 'SPC':					$natVal = $this->menuArr[$key]['isSpacer'];				break;				case 'IFSUB':					$natVal = $this->isSubMenu($this->menuArr[$key]['uid']);				break;				case 'ACT':					$natVal = $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key));				break;				case 'ACTIFSUB':					$natVal = $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key)) && $this->isSubMenu($this->menuArr[$key]['uid']);				break;				case 'CUR':					$natVal = $this->isCurrent($this->menuArr[$key]['uid'], $this->getMPvar($key));				break;				case 'CURIFSUB':					$natVal = $this->isCurrent($this->menuArr[$key]['uid'], $this->getMPvar($key)) && $this->isSubMenu($this->menuArr[$key]['uid']);				break;				case 'USR':					$natVal = $this->menuArr[$key]['fe_group'];				break;			}		}		return $natVal;	}	/**	 * Creates an access-key for a TMENU/GMENU menu item based on the menu item titles first letter	 *	 * @param	string		Menu item title.	 * @return	array		Returns an array with keys "code" ("accesskey" attribute for the img-tag) and "alt" (text-addition to the "alt" attribute) if an access key was defined. Otherwise array was empty	 * @access private	 */	function accessKey($title)	{			// The global array ACCESSKEY is used to globally control if letters are already used!!		$result = Array();		$title = trim(strip_tags($title));		$titleLen = strlen($title);		for ($a=0;$a<$titleLen;$a++)	{			$key = strtoupper(substr($title,$a,1));			if (preg_match('/[A-Z]/', $key) && !isset($GLOBALS['TSFE']->accessKey[$key]))	{				$GLOBALS['TSFE']->accessKey[$key]=1;				$result['code'] = ' accesskey="'.$key.'"';				$result['alt'] = ' (ALT+'.$key.')';				break;			}		}		return $result;	}	/**	 * Calls a user function for processing of internal data.	 * Used for the properties "IProcFunc" and "itemArrayProcFunc"	 *	 * @param	string		Key pointing for the property in the current ->mconf array holding possibly parameters to pass along to the function/method. Currently the keys used are "IProcFunc" and "itemArrayProcFunc".	 * @param	mixed		A variable to pass to the user function and which should be returned again from the user function. The idea is that the user function modifies this variable according to what you want to achieve and then returns it. For "itemArrayProcFunc" this variable is $this->menuArr, for "IProcFunc" it is $this->I	 * @return	mixed		The processed $passVar	 * @access private	 */	function userProcess($mConfKey,$passVar)	{		if ($this->mconf[$mConfKey])	{			$funcConf = $this->mconf[$mConfKey.'.'];			$funcConf['parentObj']=&$this;			$passVar = $GLOBALS['TSFE']->cObj->callUserFunction($this->mconf[$mConfKey], $funcConf, $passVar);		}		return $passVar;	}	/**	 * Creates the <A> tag parts for the current item (in $this->I, [A1] and [A2]) based on other information in this array (like $this->I['linkHREF'])	 *	 * @return	void	 * @access private	 */	function setATagParts()	{		$this->I['A1'] = '<a '.t3lib_div::implodeAttributes($this->I['linkHREF'],1).' '.$this->I['val']['ATagParams'].$this->I['accessKey']['code'].'>';		$this->I['A2'] = '</a>';	}	/**	 * Returns the title for the navigation	 *	 * @param	string		The current page title	 * @param	string		The current value of the navigation title	 * @return	string		Returns the navigation title if it is NOT blank, otherwise the page title.	 * @access private	 */	function getPageTitle($title,$nav_title)	{		return strcmp(trim($nav_title),'') ? $nav_title : $title;	}	/**	 * Return MPvar string for entry $key in ->menuArr	 *	 * @param	integer		Pointer to element in ->menuArr	 * @param	string		Implode token.	 * @return	string		MP vars for element.	 * @see link()	 */	function getMPvar($key)	{		if ($GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids'])	{			$localMP_array = $this->MP_array;			if ($this->menuArr[$key]['_MP_PARAM'])	$localMP_array[] = $this->menuArr[$key]['_MP_PARAM'];	// NOTICE: "_MP_PARAM" is allowed to be a commalist of PID pairs!			$MP_params = count($localMP_array) ? implode(',',$localMP_array) : '';			return $MP_params;		}	}	/**	 * Returns where clause part to exclude 'not in menu' pages	 *	 * @return	string		where clause part.	 * @access private	 */	function getDoktypeExcludeWhere() {		return $this->doktypeExcludeList ? ' AND pages.doktype NOT IN ('.$this->doktypeExcludeList.')' : '';	}	/**	 * Returns an array of banned UIDs (from excludeUidList)	 *	 * @return	array		Array of banned UIDs	 * @access private	 */	function getBannedUids() {		$banUidArray = array();		if (trim($this->conf['excludeUidList']))        {			$banUidList = str_replace('current', $GLOBALS['TSFE']->page['uid'], $this->conf['excludeUidList']);			$banUidArray = t3lib_div::intExplode(',', $banUidList);		}		return $banUidArray;	}}/** * Extension class creating text based menus * * @author	Kasper Skaarhoj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage tslib * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=387&cHash=73a3116ab8 */class tslib_tmenu extends tslib_menu {	/**	 * Calls procesItemStates() so that the common configuration for the menu items are resolved into individual configuration per item.	 * Sets the result for the new "normal state" in $this->result	 *	 * @return	void	 * @see tslib_menu::procesItemStates()	 */	function generate()	{		$splitCount = count($this->menuArr);		if ($splitCount)	{			list($NOconf) = $this->procesItemStates($splitCount);		}		if ($this->mconf['debugItemConf'])	{echo '<h3>$NOconf:</h3>';	debug($NOconf);	}		$this->result = $NOconf;	}	/**	 * Traverses the ->result array of menu items configuration (made by ->generate()) and renders each item.	 * During the execution of this function many internal methods prefixed "extProc_" from this class is called and many of these are for now dummy functions. But they can be used for processing as they are used by the TMENU_LAYERS	 * An instance of tslib_cObj is also made and for each menu item rendered it is loaded with the record for that page so that any stdWrap properties that applies will have the current menu items record available.	 *	 * @return	string		The HTML for the menu (returns result through $this->extProc_finish(); )	 */	function writeMenu()	{		if (is_array($this->result) && count($this->result))	{			$this->WMcObj = t3lib_div::makeInstance('tslib_cObj');	// Create new tslib_cObj for our use			$this->WMresult = '';			$this->INPfixMD5 = substr(md5(microtime().'tmenu'),0,4);			$this->WMmenuItems = count($this->result);			$this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(array('sOSuffix'=>$this->mconf['submenuObjSuffixes']),$this->WMmenuItems);			$this->extProc_init();			reset($this->result);			while (list($key,$val)=each($this->result))	{				$GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++;	

⌨️ 快捷键说明

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