core

package
v0.0.0-...-fa3d426 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultLang is default language
	DefaultLang = "en"

	// DefaultTZ is default timezone
	DefaultTZ = "Europe/Paris"

	// DefaultTheme is default theme
	DefaultTheme = "willy"
)

Variables

View Source
var (
	// Version is kowa version
	Version string

	// GitRev is kowa GIT revision
	GitRev string

	// BuildDate is kowa build date
	BuildDate string
)
View Source
var (
	// Langs holds available languages
	Langs []string
)

Functions

func Asset

func Asset(name string) ([]byte, error)

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

func AssetDir(name string) ([]string, error)

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

func AssetInfo(name string) (os.FileInfo, error)

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 AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func BaseUrl

func BaseUrl(siteID string) string

BaseUrl computes a base url for given site id.

func BaseUrlForCustomDomain

func BaseUrlForCustomDomain(domain string) string

BaseUrlForCustomDomain computes a base url for given custom domain.

func BaseUrlForDomain

func BaseUrlForDomain(siteID string, domain string) string

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 LoadLocales

func LoadLocales()

LoadLocales loads i18n locales

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func UploadDir

func UploadDir() string

UploadDir returns the main upload directory path

func UploadSiteDir

func UploadSiteDir(siteID string) string

UploadSiteDir returns the upload directory path for given site

func UploadSiteFilePath

func UploadSiteFilePath(siteID string, fileName string) string

UploadSiteFilePath returns path to uploaded file for given site

func UploadSiteUrlPath

func UploadSiteUrlPath(siteID string, fileName string) string

UploadSiteUrlPath returns relative URL to uploaded file for given site

func ValidDomain

func ValidDomain(domain string) bool

ValidDomain returns true if domain is valid.

func ValidTZ

func ValidTZ(name string) bool

ValidTZ returns true if given timezone name is a valid IANA timezone.

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

type TranslateFunc func(translationID string, args ...interface{}) string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL