/** * Finds an internal resource file by type * * @param string $name * @param string $type * @return null|string */ public static function getResourcePath($name, $type) { if ($type === self::RESOURCE_CONFIG || $type === self::RESOURCE_TEMPLATE) { $local_path = realpath(Helper::getPath(array(dirname(__DIR__), 'Resources', strtolower($type)))); if (file_exists($local = $local_path . DIRECTORY_SEPARATOR . $name)) { return $local; } $mask = $type === self::RESOURCE_TEMPLATE ? self::RESOURCE_TEMPLATE_MASK : self::RESOURCE_CONFIG_MASK; $final_name = sprintf($mask, $name); if (file_exists($final = $local_path . DIRECTORY_SEPARATOR . $final_name)) { return $final; } } return null; }