选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
查看 IniHandler.class.php - 文件管理器
👁 查看:IniHandler.class.php
路径:/virtual/bigbrother/public_html/edream-c.com/cd/core/libs/IniHandler.class.php
大小:2.56 KB · 修改:2013-09-07 07:19:54 · 权限:0644 · 可写
<?php
/**
 *
 * @package XCube
 * @version $Id: XCube_IniHandler.class.php,v 1.0
 * @copyright Copyright 2005-2010 XOOPS Cube Project  <https://github.com/xoopscube/legacy>
 * @license https://github.com/xoopscube/legacy/blob/master/docs/bsd_licenses.txt Modified BSD license
 *
 */



/*
If the first character in a line is #, ; or //, the line is treated as comment.
*/

class XCube_IniHandler
{
	protected /*** string[] ***/	$_mConfig = array();
	protected /*** string ***/	$_mFilePath = null;
	protected /*** bool ***/	$_mSectionFlag = false;

	/**
	 * __constract
	 * 
	 * @param	string	$filePath
	 * @param	bool	$section
	 * 
	 * @return	void
	**/
	public function __construct(/*** string ***/ $filePath, /*** bool ***/ $section=false)
	{
		$this->_mSectionFlag = $section;
		$this->_mFilePath = $filePath;
		$this->_loadIni();
	}

	/**
	 * _loadIni
	 * 
	 * @param	void
	 * 
	 * @return	void
	**/
	protected function _loadIni()
	{
		if(file_exists($this->_mFilePath)){
			$key = null;
			foreach (explode("\n", file_get_contents($this->_mFilePath)) as $line) {
				//case: comment line
				if(preg_match('/^\s*([;#]|\/\/)/', $line)) continue;
				//remove CR
				$line = preg_replace('/\r/', '', $line);
				//case: section line
				if (preg_match('/\[(.*)\]/', $line, $str)) {
					if($this->_mSectionFlag===true){
						$key = $str[1];
						$this->_mConfig[$key] = array();
					}
				}
				//case: key/value line
				elseif(preg_match('/^(.*)=(.*)$/', $line, $str)){
					$name =& $str[1];
					$val =& $str[2];
					if(preg_match('/^"(.*)"$/', $val, $body)||preg_match('/^\'(.*)\'$/', $val, $body)){
						$val =& $body[1];
					}
				
					if($this->_mSectionFlag===true){
						$this->_mConfig[$key][$name] = $val;
					}
					else{
						$this->_mConfig[$name] = $val;
					}
				}
			}
		}
	}

	/**
	 * getConfig
	 * 
	 * @param	string	$key
	 * @param	string	$section
	 * 
	 * @return	string
	**/
	public function getConfig(/*** string ***/ $key, /*** string ***/ $section='')
	{
		if($this->_mSectionFlag===true){
			return $this->_mConfig[$section][$key];
		}
		else{
			return $this->_mConfig[$key];
		}
	}

	/**
	 * getSectionConfig
	 * 
	 * @param	string	$section
	 * 
	 * @return	string[]
	**/
	public function getSectionConfig(/*** string ***/ $section)
	{
		return ($this->_mSectionFlag===true) ? $this->_mConfig[$section] : null;
	}

	/**
	 * getAllConfig
	 * 
	 * @param	void
	 * 
	 * @return	string[]
	**/
	public function getAllConfig()
	{
		return $this->_mConfig;
	}

}
?>
ページが見つかりませんでした – Lumiere Shop
ここを指しているリンクに誤りがあったようです。検索してみるのはいかがですか ?
お買い物カゴ