Documentation
¶
Index ¶
- Constants
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func BaseUrl(siteID string) string
- func BaseUrlForCustomDomain(domain string) string
- func BaseUrlForDomain(siteID string, domain string) string
- func DefaultDomain() string
- func EnsureSiteUploadDir(siteID string)
- func EnsureUploadDir()
- func FormatVersion() string
- func LoadLocales()
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func UploadDir() string
- func UploadSiteDir(siteID string) string
- func UploadSiteFilePath(siteID string, fileName string) string
- func UploadSiteUrlPath(siteID string, fileName string) string
- func ValidDomain(domain string) bool
- func ValidTZ(name string) bool
- type P
- type TranslateFunc
Constants ¶
const ( // DefaultLang is default language DefaultLang = "en" // DefaultTZ is default timezone DefaultTZ = "Europe/Paris" // DefaultTheme is default theme DefaultTheme = "willy" )
Variables ¶
var ( // Version is kowa version Version string // GitRev is kowa GIT revision GitRev string // BuildDate is kowa build date BuildDate string )
var ( // Langs holds available languages Langs []string )
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func BaseUrlForCustomDomain ¶
BaseUrlForCustomDomain computes a base url for given custom domain.
func BaseUrlForDomain ¶
BaseUrlForDomain computes a base url for given site id and domain.
func DefaultDomain ¶
func DefaultDomain() string
DefaultDomain returns default domain, or an empty string if no domain found in settings.
func EnsureSiteUploadDir ¶
func EnsureSiteUploadDir(siteID string)
EnsureUploadDir ensures that the upload directory for given site exists
func EnsureUploadDir ¶
func EnsureUploadDir()
EnsureUploadDir ensures that main upload directory exists
func FormatVersion ¶
func FormatVersion() string
FormatVersion returns the human readable kowa version
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func UploadSiteDir ¶
UploadSiteDir returns the upload directory path for given site
func UploadSiteFilePath ¶
UploadSiteFilePath returns path to uploaded file for given site
func UploadSiteUrlPath ¶
UploadSiteUrlPath returns relative URL to uploaded file for given site
func ValidDomain ¶
ValidDomain returns true if domain is valid.
Types ¶
type P ¶
type P map[string]interface{}
P is a sugar type to write core.P{} instead of map[string]interface{} for i18n parameters
type TranslateFunc ¶
TranslateFunc represents a translation function
func MustTfunc ¶
func MustTfunc(lang string) TranslateFunc
MustTfunc is our own wrapper around i18n.MustTfunc that converts core.P arguments into map[string]interface{} to please i18n lib