Dotclear 2.24
Loading...
Searching...
No Matches
dcThemeConfig Class Reference

Static Public Member Functions

static computeContrastRatio (string $color, string $background)
 
static contrastRatioLevel (float $ratio, string $size, bool $bold=false)
 
static contrastRatio (string $color, string $background, string $size='', bool $bold=false)
 
static adjustFontSize (string $size)
 
static adjustPosition (string $position)
 
static adjustColor (string $color)
 
static cleanCSS (string $css)
 
static cssPath (string $folder)
 
static cssURL (string $folder)
 
static canWriteCss (string $folder, bool $create=false)
 
static prop (array &$css, string $selector, string $prop, $value)
 
static backgroundImg (string $folder, array &$css, string $selector, bool $value, string $image)
 
static writeCss (string $folder, string $theme, string $css)
 
static dropCss (string $folder, string $theme)
 
static publicCssUrlHelper (string $folder)
 
static imagesPath (string $folder)
 
static imagesURL (string $folder)
 
static canWriteImages (string $folder, bool $create=false)
 
static uploadImage (string $folder, array $file, int $width=0)
 
static dropImage (string $folder, string $img)
 

Member Function Documentation

◆ computeContrastRatio()

static computeContrastRatio ( string  $color,
string  $background 
)
static

Compute contrast ratio between two colors

Parameters
string$colortext color
string$backgroundbackground color
Returns
float computed ratio

References adjustColor().

Referenced by contrastRatio().

◆ contrastRatioLevel()

static contrastRatioLevel ( float  $ratio,
string  $size,
bool  $bold = false 
)
static

Compute WCAG contrast ration level

Parameters
float$ratiocomputed ratio between foreground and backround color
string$sizefont size as defined in CSS
boolean$boldtrue if bold font
Returns
string WCAG contrast ratio level (AAA, AA or <nothing>)

Referenced by contrastRatio().

◆ contrastRatio()

static contrastRatio ( string  $color,
string  $background,
string  $size = '',
bool  $bold = false 
)
static

Return full information about constrat ratio

Parameters
string$colortext color
string$backgroundbackground color
string$sizefont size
boolean$boldbold font
Returns
string contrast ratio including WCAG level

References computeContrastRatio(), and contrastRatioLevel().

Referenced by adminConfigThemeDuctile\render().

◆ adjustFontSize()

static adjustFontSize ( string  $size)
static

Check font size

Parameters
string$sizefont size
Returns
string checked font size

Referenced by adminBlowupConfig\process(), and adminConfigThemeDuctile\process().

◆ adjustPosition()

static adjustPosition ( string  $position)
static

Check object position, should be x:y

Parameters
string$positionposition
Returns
string checked position

Referenced by adminBlowupConfig\process().

◆ adjustColor()

static adjustColor ( string  $color)
static

Check a CSS color

Parameters
string$colorCSS color
Returns
string checked CSS color

Referenced by computeContrastRatio(), blowupConfig\createImages(), adminBlowupConfig\process(), and adminConfigThemeDuctile\process().

◆ cleanCSS()

static cleanCSS ( string  $css)
static

Check and clean CSS

Parameters
string$cssCSS to be checked
Returns
string checked CSS

Referenced by adminBlowupConfig\process().

◆ cssPath()

static cssPath ( string  $folder)
static

Return real path of a user defined CSS

Parameters
string$folderCSS folder
Returns
string real path of CSS

References dcCore\app(), and path\real().

Referenced by canWriteCss(), blowupConfig\cssPath(), and publicCssUrlHelper().

◆ cssURL()

static cssURL ( string  $folder)
static

Retirn URL of a user defined CSS

Parameters
string$folderCSS folder
Returns
string CSS URL

References dcCore\app().

Referenced by blowupConfig\cssURL(), and publicCssUrlHelper().

◆ canWriteCss()

static canWriteCss ( string  $folder,
bool  $create = false 
)
static

Check if user defined CSS may be written

Parameters
string$folderCSS folder
boolean$createcreate CSS folder if necessary
Returns
boolean true if CSS folder exists and may be written, else false

References dcCore\app(), cssPath(), files\makeDir(), and path\real().

Referenced by blowupConfig\canWriteCss().

◆ prop()

static prop ( array &  $css,
string  $selector,
string  $prop,
  $value 
)
static

Store CSS property value in associated array

Parameters
array$cssCSS associated array
string$selectorselector
string$propproperty
mixed$valuevalue

Referenced by blowupConfig\createCss().

◆ backgroundImg()

static backgroundImg ( string  $folder,
array &  $css,
string  $selector,
bool  $value,
string  $image 
)
static

Store background image property in CSS associated array

Parameters
string$folderimage folder
array$cssCSS associated array
string$selectorselector
boolean$valuefalse for default, true if image should be set
string$imageimage filename

References imagesPath(), and imagesURL().

Referenced by blowupConfig\backgroundImg().

◆ writeCss()

static writeCss ( string  $folder,
string  $theme,
string  $css 
)
static

Write CSS file

Parameters
string$folderCSS folder
string$themeCSS filename
string$cssCSS file content

◆ dropCss()

static dropCss ( string  $folder,
string  $theme 
)
static

Delete CSS file

Parameters
string$folderCSS folder
string$themeCSS filename to be removed

References path\real().

Referenced by blowupConfig\dropCss().

◆ publicCssUrlHelper()

static publicCssUrlHelper ( string  $folder)
static

Return public URL of user defined CSS

Parameters
string$folderCSS folder
Returns
mixed CSS file URL

References dcCore\app(), cssPath(), and cssURL().

Referenced by blowupConfig\publicCssUrlHelper().

◆ imagesPath()

static imagesPath ( string  $folder)
static

Return real path of folder images

Parameters
string$folderimages folder
Returns
string|false real path of folder

References dcCore\app(), and path\real().

Referenced by backgroundImg(), canWriteImages(), blowupConfig\imagesPath(), and uploadImage().

◆ imagesURL()

static imagesURL ( string  $folder)
static

Return URL of images folder

Parameters
string$folderimages folder
Returns
string URL of images folder

References dcCore\app().

Referenced by backgroundImg(), and blowupConfig\imagesURL().

◆ canWriteImages()

static canWriteImages ( string  $folder,
bool  $create = false 
)
static

Check if images folder exists and may be written

Parameters
string$folderimages folder
boolean$createcreate the folder if not exists
Returns
boolean true if folder exists and may be written

References dcCore\app(), imagesPath(), files\makeDir(), and path\real().

Referenced by blowupConfig\canWriteImages().

◆ uploadImage()

static uploadImage ( string  $folder,
array  $file,
int  $width = 0 
)
static

Upload an image in images folder

Parameters
string$folderimages folder
array$fileselected image file (as $_FILES[<file input fieldname>])
int$widthcheck accurate width of uploaded image if <> 0
Returns
string full pathname of uploaded image

References files\getMimeType(), and imagesPath().

Referenced by blowupConfig\uploadImage().

◆ dropImage()

static dropImage ( string  $folder,
string  $img 
)
static

Delete an image from images folder (with its thumbnails if any)

Parameters
string$folderimages folder
string$imgimage filename

References dcCore\app(), and path\real().

Referenced by blowupConfig\dropImage().


The documentation for this class was generated from the following file: