<?php
/**
* 設定に関するユーティリティクラス
*
* PHP version 5
*
* @package    core
* @author     stk2k <stk2k@sazysoft.com>
* @copyright  2008 stk2k, sazysoft
*/

class charcoal_ConfigUtil
{
	/*
	 * マクロ展開
	 */
	public static function processMacro( $value )
	{
		// 展開キーワード
		$macro_defs = array(

				'%CONFIG_DIR%'       => charcoal_ResourceLocator::getWebAppPath( 'config' ),
				'%COMPONENTS_DIR%'   => charcoal_ResourceLocator::getWebAppPath( 'components' ),
				'%LOGS_DIR%'         => charcoal_ResourceLocator::getWebAppPath( 'logs' ),
				'%TEMPLATES_DIR%'    => charcoal_ResourceLocator::getWebAppPath( 'templates' ),
				'%WEBAPP_DIR%'       => WEBAPP_DIR . '/' . APPLICATION,

			);

		// 展開
		foreach( $macro_defs as $macro_key => $macro_value ){
			$value = str_replace( $macro_key, $macro_value, $value );
		}

		return $value;
	}
}
