Hawk - PHP documentation
  • Namespace
  • Class
  • Tree

Namespaces

  • Hawk
    • View
      • Plugins

Classes

  • App
  • ButtonInput
  • Cache
  • CheckboxInput
  • ColorInput
  • Conf
  • Controller
  • Crypto
  • DatabaseSessionHandler
  • DatetimeInput
  • DB
  • DBExample
  • DeleteInput
  • Dialogbox
  • EmailInput
  • ErrorHandler
  • Event
  • FileInput
  • FileSystem
  • FloatInput
  • Form
  • FormFieldset
  • FormInput
  • GenericModel
  • GifImage
  • HawkApi
  • HawkUpdater
  • HiddenInput
  • HtmlInput
  • HTTPRequest
  • Icon
  • Image
  • IntegerInput
  • ItemList
  • ItemListField
  • JpegImage
  • Lang
  • Language
  • LeftSidebarTab
  • Less
  • Logger
  • Mail
  • MenuItem
  • Model
  • NoSidebarTab
  • NumberInput
  • ObjectInput
  • Option
  • Panel
  • PasswordInput
  • Permission
  • Plugin
  • PluginInstaller
  • PngImage
  • ProfileQuestion
  • ProfileQuestionValue
  • RadioInput
  • Request
  • Response
  • RightSidebarTab
  • Role
  • RolePermission
  • Route
  • Router
  • SelectInput
  • Session
  • Singleton
  • SubmitInput
  • Tabs
  • TextareaInput
  • TextInput
  • Theme
  • TimeInput
  • Upload
  • User
  • View
  • ViewPlugin
  • Widget
  • WysiwygInput

Traits

  • Utils

Exceptions

  • AppStopException
  • DBExampleException
  • DBException
  • FileSystemException
  • HawkApiException
  • ImageException
  • MailException
  • UploadException
  • ViewException

Class Theme

This class describes the themes behavior

Namespace: Hawk
Package: Core
Located at Theme.php

Methods summary

public static Hawk\Theme
# get( string $name = Hawk\Theme::DEFAULT_THEME )

Instanciate a new theme by it name

Instanciate a new theme by it name

Parameters

$name
The name of the theme, corresponding to it directory name under /themes

Returns

Hawk\Theme
The found theme
public static Hawk\Theme
# getSelected( )

Get the theme configured for the application

Get the theme configured for the application

Returns

Hawk\Theme
The selected theme
public static
# setSelected( string $name )

Set a theme as the selected one for the application

Set a theme as the selected one for the application

Parameters

$name
The name of the theme
public static array
# getAll( )

Get all the available themes

Get all the available themes

Returns

array
All the themes
public mixed
# getDefinition( string $prop = "" )

Get the theme data in the file manifest.json. If $prop is set, this method returns the property value in the theme data, else it returns all the theme data

Get the theme data in the file manifest.json. If $prop is set, this method returns the property value in the theme data, else it returns all the theme data

Parameters

$prop
The property in data to get

Returns

mixed
The value of the property $prop if it is set, else, all the theme data
public string
# getTitle( )

Get the theme title (data accessible in the manifest.json file of the theme)

Get the theme title (data accessible in the manifest.json file of the theme)

Returns

string
the theme title
public string
# getName( )

Get the theme name (the name of the directory containing the theme)

Get the theme name (the name of the directory containing the theme)

Returns

string
The theme name
public boolean
# isRemovable( )

Check if the theme is removable. A theme is removable if it's not a native theme, and if it is not the selected one for the application

Check if the theme is removable. A theme is removable if it's not a native theme, and if it is not the selected one for the application

Returns

boolean
true if the theme is removable, else false.
public string
# getStartFile( )

Get the start file of the theme. The start file is the file start.php in the theme that initialize special intructions for the theme

Get the start file of the theme. The start file is the file start.php in the theme that initialize special intructions for the theme

Returns

string
public string
# getRootDir( )

Get the root directory of the theme files

Get the root directory of the theme files

Returns

string
The root directory of the theme files
public string
# getStaticDir( )

Get the directory for HTTP accessible files. During theme build, the files are copied in this directory

Get the directory for HTTP accessible files. During theme build, the files are copied in this directory

Returns

string
public string
# getRootUrl( )

Get the root URL to get theme files by HTTP request

Get the root URL to get theme files by HTTP request

Returns

string
public string
# getFileUrl( string $file )

Copy a file from the theme directory to the static directory (to be accessible by HTTP requests) and returns it URL

Copy a file from the theme directory to the static directory (to be accessible by HTTP requests) and returns it URL

Parameters

$file
The source file to get the URL

Returns

string
The public copied file URL
public string
# getPreviewFilename( )

Get the file path for the theme preview image

Get the file path for the theme preview image

Returns

string
public string
# getPreviewUrl( )

Get the URL for the theme preview image

Get the URL for the theme preview image

Returns

string
public
# getLessDirname( )

Get the dirname containing the less files

Get the dirname containing the less files

public string
# getBaseLessFile( )

Get the base CSS file path

Get the base CSS file path

Returns

string
public string
# getStaticLessFile( )

Get the base less file theme.less in static folder

Get the base less file theme.less in static folder

Returns

string
public string
# getStaticCssFile( )

Get the filename of the compiled theme.css file, in the static folder

Get the filename of the compiled theme.css file, in the static folder

Returns

string
The filename
public string
# getBaseLessUrl( )

Build the base css file of the theme, and get the URL of the built file

Build the base css file of the theme, and get the URL of the built file

Returns

string
The URL of the built CSS file
public string
# getBaseCssUrl( )

This method return the URL to access the CSS file of the theme, compiled from theme.less

This method return the URL to access the CSS file of the theme, compiled from theme.less

Returns

string
The URL of the file theme.css
public boole
# build( boolean $force = false )

Build the theme : copy every resource files in themes/{themename}

Build the theme : copy every resource files in themes/{themename}

Parameters

$force
If set to true, the theme will be rebuilt without condition

Returns

boole
True if the theme has been built, false it it has been taken from cache
public array
# getEditableVariables( string $less = null )

Get the variables in a CSS file content. In CSS files, variables are defined with the folowing format : /* define("variableName", color|dimension|file, "variable description that will appear in the customization page of the theme", defaultValue) *\/

Get the variables in a CSS file content. In CSS files, variables are defined with the folowing format : /* define("variableName", color|dimension|file, "variable description that will appear in the customization page of the theme", defaultValue) *\/

Parameters

$less
The Less code to parse

Returns

array
The variables, where each element contains the 'name' of the variable, it 'type', it 'description', and it 'default' value
public array
# getVariablesCustomValues( )

Get the customized variables values

Get the customized variables values

Returns

array
The custom values
public
# setVariablesCustomValues( array $values )

Set customized variables values

Set customized variables values

Parameters

$values
The values to set
public
# getStaticUserfilesDir( )

Get the directory containing theme userfiles

Get the directory containing theme userfiles

public string
# getStaticUserfilesUrl( string $filename = '' )

Get the URL of a static user file

Get the URL of a static user file

Parameters

$filename
The basename of the file to get the url

Returns

string
public string
# getMediasDir( )

Get the directory containing the medias uplaoded by the administrator

Get the directory containing the medias uplaoded by the administrator

Returns

string
The directory containing the medias uploaded by the administrator
public string
# getMediasUrl( string $filename = '' )

Get the URL of the directory containing the medias uplaoded by the administrator

Get the URL of the directory containing the medias uplaoded by the administrator

Parameters

$filename
The basename of the file to get the URL

Returns

string
The URL of the directory containing the medias uplaoded by the administrator
public string
# getCustomCssFile( )

Get the file path of the CSS file customized by the application administrator

Get the file path of the CSS file customized by the application administrator

Returns

string
The file path of the custom CSS file
public string
# getCustomCssUrl( )

Get the URL of the CSS file customized by the application administrator

Get the URL of the CSS file customized by the application administrator

Returns

string
The URL of the custom CSS file
public string
# getViewsDir( )

Get the directory containing the theme views

Get the directory containing the theme views

Returns

string
The directory containing the theme views files
public string
# getView( string $filename )

Get the filename of a view in the theme. If the view file does not exists in the theme, the method will return the view in the default theme

Get the filename of a view in the theme. If the view file does not exists in the theme, the method will return the view in the default theme

Parameters

$filename
The basename of the view file, relative to the theme views directory path

Returns

string
The path of the view file

Constants summary

string DEFAULT_THEME

The default theme name

The default theme name

# 'hawk'
string LESS_BASENAME

The theme css file basename

The theme css file basename

# 'theme.less'
string COMPILED_CSS_BASENAME

The filename of the compiled Css file

The filename of the compiled Css file

# 'theme.css'
string CSS_CUSTOM_BASENAME

The theme css custom file basename

The theme css custom file basename

# 'theme-custom.css'
string MANIFEST_BASENAME

The filename of the definition file

The filename of the definition file

# 'manifest.json'
string PREVIEW_BASENAME

The filename of the preview image

The filename of the preview image

# 'preview.png'
string NAME_PATTERN

The pattern for a theme name

The pattern for a theme name

# '[a-zA-Z0-9\-_.]+'
string EDITABLE_VARS_PATTERN

The pattern to find the editable variables in the less main file

The pattern to find the editable variables in the less main file

# '#^\s*@([\w\-]+)\s*\:\s*(.+?)\s*\;\s*//\s*editable\s*\:\s*"(.+?)"\s*\,?\s*(color|file)?\s*$#m'

Properties summary

public static array $nativeThemes

The themes embedded with Hawk, that are not removable

The themes embedded with Hawk, that are not removable

# array('hawk', 'dark')
Hawk - PHP documentation API documentation generated by ApiGen