YaWK
24.1
Yet another WebKit
|
The template controller - get and set template settings. More...
Public Member Functions | |
checkIfTemplateAlreadyExists (object $db, string $name) | |
Check if a template with given name already exists, return true or false. More... | |
deleteSettingsCSSFile ($db, $filename) | |
downloadTemplate ($db, $templateFolder, $templateID, $user) | |
Create a zip file from template and force direct download. More... | |
drawFontFamilySelectField ($db, $lang, $selectName, $defaultValue) | |
return a select option list with all fonts: More... | |
emptyTmpFolder () | |
getCustomCSSFile (object $db, int $templateID) | |
return the content of custom.css More... | |
getCustomJSFile (object $db, int $templateID) | |
return the content of custom.js More... | |
getFontRow ($db, $lang, $fontRow, $previewClass, $templateSettings) | |
return font edit row including preview More... | |
getFormElements ($db, $settings, $type, $lang, $user) | |
return html form field, depending on fieldClass More... | |
loadActiveAssets ($db, $templateID, $host) | |
Load Active Assets. More... | |
loadActiveAssetsIntoArray ($db, $templateID) | |
loadAllSettingsIntoArray (object $db, int $id) | |
load template settings of ID and return as array More... | |
loadProperties ($db, $id) | |
load properties into template object More... | |
loadPropertiesIntoArray (object $db, int $id) | |
load template properties and return as array More... | |
loadSettingsTypesIntoArray (object $db) | |
load template_settings_types and return as array More... | |
saveAs (object $db) | |
save a template as new. It copies the tpl folder and all settings into a new one. More... | |
saveProperties (object $db, int $id, array $data, array $oldTplSettings) | |
save new template properties into database More... | |
switchPositionIndicators (object $db, int $templateID, int $status) | |
switch all positions indicators on or off More... | |
uploadTemplate ($db, $postData, $postFiles, $lang) | |
Upload a template (install / update) More... | |
Static Public Member Functions | |
static | checkWrapper ($lang, $title, $subtitle) |
check if an admin LTE wrapper should be loaded around the backend content. This function must be called at the top of every backend page (admin/includes/xyz.php) More... | |
static | drawAssetsSelectFields ($db, $type, $templateID, $lang) |
Draw asset select fields. More... | |
static | drawAssetsTitles ($db, $templateID, $lang) |
Draw a list with all assets that are used in this template. More... | |
static | getActiveBodyFont ($db, $user, $template) |
Get and return current active google font. More... | |
static | getActivegfont ($db, $status, $property) |
return currently active google font More... | |
static | getAllSettingsIntoArray ($db, $user) |
Returns an array with all template settings. More... | |
static | getAssetsByType ($db, $type) |
Return a multidimensional array with all assets by requested type. More... | |
static | getCurrentTemplateId (object $db) |
return ID of current (active) template More... | |
static | getFontsFromFolder ($folder) |
get fonts from folder and return as array More... | |
static | getGoogleFontsArray ($db) |
get all google fonts into an array and return array More... | |
static | getMaxId ($db) |
return biggest ID from template database More... | |
static | getPositionDivBox ($db, $lang, $position, $row, $bootstrapGrid, $positions, $indicators, $user, $template) |
return div box with postition settings More... | |
static | getPositionIndicatorStatusArray ($db, $templateID) |
get the position indicators. This is used on index.php to mark indicated positions More... | |
static | getPositionStatesArray ($db, $templateID) |
get the position states of all templates. This is used on index.php to render only templates that are enabled (1) More... | |
static | getTemplateIds (object $db) |
return array with all template id's + names. More... | |
static | getTemplateSettingsArray ($db, $templateID) |
get all template settings into an array and return it More... | |
static | getValidTemplateID ($db, $user, $template) |
check the current template ID, considering if user is logged in, allowed to override template and so on More... | |
static | includeHeader ($db) |
include header for html page *outdated? *moved to sys? More... | |
static | loadGoogleFonts ($db) |
get settings for heading, menu and text font and output html to load font More... | |
static | returnCurrentBootstrapVersion ($db, $templateID) |
Return which Bootstrap version is currently loaded in given template. More... | |
static | setCssBodyFontFace ($cssTagName, $tplSettings) |
set css code for custom fonts (ttf / otf / woff) More... | |
static | setCssBodyFontSettings ($cssTagName, $tplSettings) |
set body font settings css code More... | |
static | setCssBodyLinkTags ($cssTagName, $tplSettings) |
set css code for body link styling More... | |
static | setCssBodySmallFontSettings ($cssTagName, $tplSettings) |
set small font settings css code More... | |
static | setCssFontSettings ($cssTagName, $tplSettings) |
set font settings css code More... | |
static | setPosition ($db, $lang, $position, $currentpage, $user, $template) |
set template position and output the correct data depending on position More... | |
Public Attributes | |
$active | |
$author | |
$authorUrl | |
$bootstrapVersion | |
$config | |
$description | |
$folder = '../system/templates/' | |
$framework = 'bootstrap4' | |
$id | |
$license | |
$modifyDate | |
$name | |
$newId | |
$newTplName | |
$positions | |
$releaseDate | |
int | $selectedTemplate |
$subAuthor = '' | |
$subAuthorUrl = '' | |
$subFolder | |
$tmpFolder = '../system/templates/tmp/' | |
string | $ttfPath = '../system/fonts/' |
$uploadFile = '' | |
$version | |
$weblink | |
The template controller - get and set template settings.
Template controller - get and set template settings.
Templates itself are located in /system/templates/ - if you want to modify them, start there.
Class covers both, backend & frontend functionality. See Methods Summary for Details!
Definition at line 15 of file template.php.
YAWK\template::checkIfTemplateAlreadyExists | ( | object | $db, |
string | $name | ||
) |
Check if a template with given name already exists, return true or false.
object | $db | |
string | $name |
Definition at line 95 of file template.php.
References $db, YAWK\template\$name, and $result.
Referenced by YAWK\template\uploadTemplate().
|
static |
check if an admin LTE wrapper should be loaded around the backend content. This function must be called at the top of every backend page (admin/includes/xyz.php)
array | $lang | language array |
Definition at line 2819 of file template.php.
YAWK\template::deleteSettingsCSSFile | ( | $db, | |
$filename | |||
) |
delete template settings css file
object | $db | database |
string | $filename | the filename (including path) you wish to delete |
Definition at line 799 of file template.php.
References $db, $filename, and YAWK\alert\draw().
YAWK\template::downloadTemplate | ( | $db, | |
$templateFolder, | |||
$templateID, | |||
$user | |||
) |
Create a zip file from template and force direct download.
object | $db | database |
string | $templateFolder | the template folder to zip + download |
int | $templateID | ID of the template to process |
object | $user | user object |
dump database settings into .json files, write template.ini and license file, zip the whole template folder and serve .zip for direct download
Definition at line 3714 of file template.php.
References $_GET, YAWK\template\$author, YAWK\template\$authorUrl, $db, YAWK\template\$description, YAWK\template\$folder, YAWK\template\$framework, YAWK\template\$id, YAWK\template\$license, YAWK\template\$name, YAWK\template\$subAuthor, YAWK\template\$subAuthorUrl, YAWK\template\$subFolder, $templateID, $templateSettings, YAWK\template\$tmpFolder, YAWK\template\$version, YAWK\template\$weblink, description, YAWK\template\loadActiveAssetsIntoArray(), YAWK\template\loadAllSettingsIntoArray(), YAWK\template\loadProperties(), YAWK\template\loadPropertiesIntoArray(), YAWK\template\loadSettingsTypesIntoArray(), name, YAWK\sys\now(), YAWK\filemanager\recursiveRemoveDirectory(), YAWK\sys\writeIniFile(), and YAWK\sys\xcopy().
|
static |
Draw asset select fields.
This method is used in the backend to generate asset select fields in template-assets view
object | $db | database object |
int | $type | 0 = all, 1 = required, 2 = optional, 3 = additional |
int | $templateID | id of the affected template |
array | $lang | language array |
Definition at line 2947 of file template.php.
References $db, $templateID, $type, YAWK\template\getAssetsByType(), and YAWK\settings\getSetting().
|
static |
Draw a list with all assets that are used in this template.
object | $db | database object |
int | $templateID | ID of the affectd template |
array | $lang | language array |
Definition at line 2909 of file template.php.
References $db, $res, $templateID, and YAWK\settings\getSetting().
YAWK\template::drawFontFamilySelectField | ( | $db, | |
$lang, | |||
$selectName, | |||
$defaultValue | |||
) |
return a select option list with all fonts:
object | $db | database |
string | $selectName | selectName |
array | $lang | language array |
Definition at line 1841 of file template.php.
References $googleFonts, $item, and YAWK\template\getGoogleFontsArray().
Referenced by YAWK\template\getFontRow().
YAWK\template::emptyTmpFolder | ( | ) |
Definition at line 3245 of file template.php.
References YAWK\filemanager\recursiveRemoveDirectory().
Referenced by YAWK\template\uploadTemplate().
|
static |
Get and return current active google font.
$db |
Definition at line 2481 of file template.php.
References $db.
|
static |
return currently active google font
object | $db | database |
string | $status | the url or font name |
string | $property | affected settings property |
Definition at line 2496 of file template.php.
|
static |
Returns an array with all template settings.
object | $db | Database Object |
object | $user | User Object |
Definition at line 1061 of file template.php.
|
static |
Return a multidimensional array with all assets by requested type.
If no type is set, or type == 0, all assets will be returned.
object | $db | database object |
int | $type | 0 = all, 1 = required, 2 = optional, 3 = additional |
Definition at line 2857 of file template.php.
References $db, $res, $type, and die.
Referenced by YAWK\template\drawAssetsSelectFields().
|
static |
return ID of current (active) template
object | $db | database object |
Definition at line 73 of file template.php.
References $db, and YAWK\template\getValidTemplateID().
Referenced by YAWK\sys\checkIfAssetsAreLoaded(), YAWK\menu\display(), YAWK\WIDGETS\BLOG\WIDGET\blogWidget\drawBlogWidget(), and YAWK\template\switchPositionIndicators().
YAWK\template::getCustomCSSFile | ( | object | $db, |
int | $templateID | ||
) |
return the content of custom.css
object | $db | database |
int | $templateID | affected template ID |
Definition at line 698 of file template.php.
References $db, $filename, and $templateID.
YAWK\template::getCustomJSFile | ( | object | $db, |
int | $templateID | ||
) |
return the content of custom.js
object | $db | database |
int | $templateID | affected template ID |
Definition at line 710 of file template.php.
References $db, $filename, and $templateID.
YAWK\template::getFontRow | ( | $db, | |
$lang, | |||
$fontRow, | |||
$previewClass, | |||
$templateSettings | |||
) |
return font edit row including preview
object | $db | database |
array | $lang | language array |
string | $fontRow | the prefix of the font group to edit (eg. h1, h2, h3, globaltext...) |
string | $previewClass | css class you want to use on the preview |
array | $templateSettings | all template settings as an array |
Definition at line 1460 of file template.php.
References $col, $lang, $templateSettings, and YAWK\template\drawFontFamilySelectField().
|
static |
get fonts from folder and return as array
string | $folder | folder that helds all fonts (usually ../system/fonts/) |
Definition at line 1674 of file template.php.
References YAWK\template\$folder, and $fontArray.
YAWK\template::getFormElements | ( | $db, | |
$settings, | |||
$type, | |||
$lang, | |||
$user | |||
) |
return html form field, depending on fieldClass
object | $db | Database Object |
Definition at line 1163 of file template.php.
References $db, $lang, $settings, $type, $value, and YAWK\template\getTemplateIds().
|
static |
get all google fonts into an array and return array
object | $db | database |
Definition at line 1949 of file template.php.
References $db, $googleFonts, and $sql.
Referenced by YAWK\template\drawFontFamilySelectField().
|
static |
return biggest ID from template database
object | $db | database |
Definition at line 779 of file template.php.
|
static |
return div box with postition settings
object | $db | Database object |
string | $position | The position to load |
array | $positions | Positions [enabled] status array |
array | $indicators | Positions [indicator] status array |
object | $user | the current user object |
object | $template | Template object |
Definition at line 1118 of file template.php.
References $db, $indicators, $lang, YAWK\template\$positions, and YAWK\template\setPosition().
|
static |
get the position indicators. This is used on index.php to mark indicated positions
object | $db | database |
int | $templateID | ID of the current template |
Definition at line 2710 of file template.php.
References $db, $sql, and $templateID.
|
static |
get the position states of all templates. This is used on index.php to render only templates that are enabled (1)
object | $db | database |
int | $templateID | ID of the current selected template |
Definition at line 2686 of file template.php.
References $db, $sql, $templateID, and die.
|
static |
return array with all template id's + names.
object | $db | database |
\YAWK\db | $db |
Definition at line 426 of file template.php.
Referenced by YAWK\backend\drawTemplateSelectField(), and YAWK\template\getFormElements().
|
static |
get all template settings into an array and return it
object | $db | database |
int | $templateID | affected template ID |
Definition at line 2794 of file template.php.
References $db, $res, $templateID, and YAWK\settings\getSetting().
|
static |
check the current template ID, considering if user is logged in, allowed to override template and so on
object | $db | database |
object | $user | the current user object |
object | $template | the current page object |
Definition at line 2603 of file template.php.
References $db, and YAWK\settings\getSetting().
Referenced by YAWK\template\getCurrentTemplateId().
|
static |
include header for html page *outdated? *moved to sys?
object | $db | database |
\YAWK\db | $db |
Definition at line 2651 of file template.php.
References $db, $host, $i, and YAWK\settings\getSetting().
YAWK\template::loadActiveAssets | ( | $db, | |
$templateID, | |||
$host | |||
) |
Load Active Assets.
Load HTML markup for each active asset of current template
$db | object db connection |
$templateID | int the current template ID |
$host | string host URL will be used by internal assets to avoid relative paths |
$type | string css|js to detect which assets to load |
Definition at line 3045 of file template.php.
References $db, $host, $res, $templateID, and $url.
YAWK\template::loadActiveAssetsIntoArray | ( | $db, | |
$templateID | |||
) |
Definition at line 3088 of file template.php.
References $db, $sql, and $templateID.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::loadAllSettingsIntoArray | ( | object | $db, |
int | $id | ||
) |
load template settings of ID and return as array
object | $db | database object |
int | $id | template id to load |
$db | \YAWK\db $res |
Definition at line 328 of file template.php.
References $db, YAWK\template\$id, $res, and $templateSettings.
Referenced by YAWK\template\downloadTemplate().
|
static |
get settings for heading, menu and text font and output html to load font
object | $db | database |
Definition at line 2536 of file template.php.
YAWK\template::loadProperties | ( | $db, | |
$id | |||
) |
load properties into template object
object | $db | database object |
int | $id | template id to load |
$db | \YAWK\db $res |
Definition at line 264 of file template.php.
References $db, YAWK\template\$id, $res, description, YAWK\settings\getSetting(), name, and selectedTemplate.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::loadPropertiesIntoArray | ( | object | $db, |
int | $id | ||
) |
load template properties and return as array
object | $db | database object |
int | $id | template id to load |
$db | \YAWK\db $res |
Definition at line 300 of file template.php.
References $db, YAWK\template\$id, and $res.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::loadSettingsTypesIntoArray | ( | object | $db | ) |
load template_settings_types and return as array
object | $db | database object |
$db | \YAWK\db $res |
Definition at line 401 of file template.php.
Referenced by YAWK\template\downloadTemplate().
|
static |
Return which Bootstrap version is currently loaded in given template.
object | $db | database |
Definition at line 3158 of file template.php.
References $db, $sql, and $templateID.
Referenced by YAWK\menu\display().
YAWK\template::saveAs | ( | object | $db | ) |
save a template as new. It copies the tpl folder and all settings into a new one.
object | $db | |
object | $template | |
string | $new_template | |
string | $description | |
string | $author | |
string | $authorUrl | |
string | $weblink | |
string | $version | |
string | $license |
\YAWK\db | $db |
Definition at line 201 of file template.php.
References $db, $now, $res, name, YAWK\sys\now(), and YAWK\sys\xcopy().
YAWK\template::saveProperties | ( | object | $db, |
int | $id, | ||
array | $data, | ||
array | $oldTplSettings | ||
) |
save new template properties into database
object | $db | database object |
int | $id | template id to save |
array | $data | post data from form (new settings) |
array | $oldTplSettings | template settings array (old settings) |
Definition at line 356 of file template.php.
References $data, $db, YAWK\template\$id, $oldTplSettings, and $value.
|
static |
set css code for custom fonts (ttf / otf / woff)
$cssTagName | |
$tplSettings |
Definition at line 2127 of file template.php.
References $filename.
|
static |
set body font settings css code
$cssTagName | |
$tplSettings |
Definition at line 2220 of file template.php.
|
static |
set css code for body link styling
$cssTagName | |
$tplSettings |
Definition at line 2162 of file template.php.
|
static |
set small font settings css code
$cssTagName | |
$tplSettings |
Definition at line 2196 of file template.php.
|
static |
set font settings css code
$cssTagName | |
$tplSettings |
Definition at line 2262 of file template.php.
References $filename.
|
static |
set template position and output the correct data depending on position
object | $db | database |
object | $user | the current user object |
string | $position | the template position |
object | $template | template object |
Definition at line 2736 of file template.php.
References $_GET, $blog, $db, $lang, $position, YAWK\menu\displayGlobalMenu(), and YAWK\user\getUserList().
Referenced by YAWK\template\getPositionDivBox().
YAWK\template::switchPositionIndicators | ( | object | $db, |
int | $templateID, | ||
int | $status | ||
) |
switch all positions indicators on or off
int | $templateID | ID of the affected template |
int | $status | value to set (0|1) |
object | $db |
Definition at line 131 of file template.php.
References $db, $templateID, and YAWK\template\getCurrentTemplateId().
YAWK\template::uploadTemplate | ( | $db, | |
$postData, | |||
$postFiles, | |||
$lang | |||
) |
Upload a template (install / update)
object | $db | database object |
array | $postData | data that has been sent by upload form |
array | $postFiles | uploaded file that has been sent by upload form |
upload .zip file, unpack to tmp folder,
Definition at line 3268 of file template.php.
References $db, YAWK\template\$id, $res, $templateSettings, YAWK\template\checkIfTemplateAlreadyExists(), YAWK\template\emptyTmpFolder(), YAWK\filemanager\recursiveRemoveDirectory(), and YAWK\sys\xcopy().
YAWK\template::$active |
int | 0|1 is this template active? |
Definition at line 22 of file template.php.
YAWK\template::$author |
string | author of this template |
Definition at line 44 of file template.php.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::$authorUrl |
string | author's url |
Definition at line 46 of file template.php.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::$bootstrapVersion |
string | the current loaded Bootstrap version |
Definition at line 58 of file template.php.
YAWK\template::$config |
array | db config array |
Definition at line 28 of file template.php.
YAWK\template::$description |
string | template description |
Definition at line 40 of file template.php.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::$folder = '../system/templates/' |
string | template folder (root path of all templates) |
Definition at line 30 of file template.php.
Referenced by YAWK\template\downloadTemplate(), and YAWK\template\getFontsFromFolder().
YAWK\template::$framework = 'bootstrap4' |
string | required framework for this template |
Definition at line 60 of file template.php.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::$id |
int | template ID |
Definition at line 18 of file template.php.
Referenced by YAWK\template\downloadTemplate(), YAWK\template\loadAllSettingsIntoArray(), YAWK\template\loadProperties(), YAWK\template\loadPropertiesIntoArray(), YAWK\template\saveProperties(), and YAWK\template\uploadTemplate().
YAWK\template::$license |
string | template's license |
Definition at line 62 of file template.php.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::$modifyDate |
string | datetime when this template was modified |
Definition at line 54 of file template.php.
YAWK\template::$name |
string | template name |
Definition at line 24 of file template.php.
Referenced by YAWK\template\checkIfTemplateAlreadyExists(), and YAWK\template\downloadTemplate().
YAWK\template::$newId |
int | new TPL ID (latest template) |
Definition at line 20 of file template.php.
YAWK\template::$newTplName |
string | new template name |
Definition at line 26 of file template.php.
YAWK\template::$positions |
string | positions as string |
Definition at line 38 of file template.php.
Referenced by YAWK\template\getPositionDivBox().
YAWK\template::$releaseDate |
string | datetime when this template was released |
Definition at line 42 of file template.php.
int YAWK\template::$selectedTemplate |
int | which template is currently set to active? |
Definition at line 64 of file template.php.
YAWK\template::$subAuthor = '' |
string | sub-author who has modified the template |
Definition at line 50 of file template.php.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::$subAuthorUrl = '' |
string | sub-author's url |
Definition at line 52 of file template.php.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::$subFolder |
string | template sub folder (template name, eg. ../system/templates/SUBFOLDER |
Definition at line 36 of file template.php.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::$tmpFolder = '../system/templates/tmp/' |
string | template tmp folder (where uploads will be unpacked) |
Definition at line 32 of file template.php.
Referenced by YAWK\template\downloadTemplate().
string YAWK\template::$ttfPath = '../system/fonts/' |
string | path to custom fonts (ttf|otf|woff) |
Definition at line 66 of file template.php.
YAWK\template::$uploadFile = '' |
string | upload file (including complete path) |
Definition at line 34 of file template.php.
YAWK\template::$version |
string | template's version number |
Definition at line 56 of file template.php.
Referenced by YAWK\template\downloadTemplate().
YAWK\template::$weblink |
string | weblink to this template |
Definition at line 48 of file template.php.
Referenced by YAWK\template\downloadTemplate().