// ... /** * Get application setting value * @param string|null $dot Dot-notation key * @param mixed $default * @return mixed */ function app($dot = null, $default=null) { return Core\Application::getInstance()->getSetting($dot, $default); } /** * Checks if an application setting key is present * @param string $dot Dot-notation key * @return bool */ function app_has($dot = null) { return Core\Application::getInstance()->hasSetting($dot); } /** * Get project directory * @param string|null $default * @return string project directory */ function project_dir($path = null):string { return add_path(Core\Application::getInstance()->getProjectDir(), $path); } /** * Get config directory * @param string $path Sub path, if necessary * @return string config directory */ function config_dir($path = null):string { return add_path(Core\Application::getInstance()->getConfigDir(), $path); } /** * Get assets directory * @param string $path Sub path, if necessary * @return string assets directory */ function assets_dir($path = null):string { return add_path(Core\Application::getInstance()->getAssetsDir(), $path); } /** * Get var directory * @param string $path Sub path, if necessary * @return string var directory */ function var_dir($path = null):string { return add_path(Core\Application::getInstance()->getVarDir(), $path); } /** * Get public directory * @param string $path Sub path, if necessary * @return string public directory */ function public_dir($path = null):string { return add_path(Core\Application::getInstance()->getPublicDirectory(),$path); } /** * Get application URL * @param string $path Sub path, if necessary * @return string URL */ function url($path = null):string { // TODO: APP_URLが無い時は、DomainとProtocolから絶対URLを作る $base = env('APP_URL', Core\Application::getInstance()->getRouteBase()); return add_path($base,$path); } /** * Get file URL With version * @param string $filename * @return string URL */ function url_ver(string $filename) { return url($filename).'?v='.env('APP_VERSION'); } /** * Get routing path * @param string $path Sub path, if necessary * @return string routing path */ function route($path = null):string { return add_path(Core\Application::getInstance()->getRouteBase(),$path); } /** * Get current controller name * @return string name */ function controllerName():string { return Core\Application::getInstance()->getControllerName(); } /** * Get current action name * @return string name */ function actionName():string { return Core\Application::getInstance()->getActionName(); }