', '\\', '"', '/', ':', '|', '?', '*']; return str_replace($disabledCharacters, '', $name); } /** * @param bool|string|int $field * @param mixed $default * @return mixed */ public static function getConfig($field = false, $default = null) { if (null === static::$_config) { $name = lcfirst(substr(get_called_class(), 3)); static::$_config = Qs_Config::get($name, 'qs')->toArray(); } if (false === $field) { return static::$_config; } return (array_key_exists($field, static::$_config)) ? static::$_config[$field] : $default; } /** * Returns non quoted relative target file name * Example: userfiles/files/notes(18).pdf * * @static * @param $name * @return string */ protected static function _getFullName($name) { if (!empty($name)) { if ('.' === dirname($name)) { $name = Qs_ImageFs::WEB_PATH . '/' . $name; } $fullName = WWW_PATH . '/' . $name; if (file_exists($fullName)) { return $name; } } return null; } public static function getFileFullName($name) { return constant('WWW_PATH') . '/' . self::WEB_PATH . '/' . $name; } /** * @static * @param string $fullName * @return string */ public static function quotePath($fullName) { $parts = explode('/', $fullName); return implode('/', array_map('rawurlencode', $parts)); } /** * Returns quoted full file name * Example: userfiles/notes(18).pdf * * @static * @param string $name * @return string */ public static function get($name) { $fullName = static::_getFullName($name); return static::quotePath($fullName); } public static function getFullPath($name) { $name = $name ? static::_getFullName($name) : null; return $name ? WWW_PATH . '/' . $name : null; } public static function getUrl($name) { $name = static::get($name); if ($name) { $name = BASE_URL_LANGUAGE . '/' . $name; } return $name; } /** * @param string $fullName * @return bool */ public static function delete($fullName) { return unlink($fullName); } }