function skinr_skinsets in Skinr 6.2
Helper function to process an array of skins or themes .info files.
Parameters
$type: Either 'theme' or 'skinset'.
$refresh: Whether to reload the list of skinsets from the database or not.
Return value
An array of skinsets.
3 calls to skinr_skinsets()
- skinr_skin_data in ./
skinr.module - Themes are allowed to set Skinr skins in their .info files.
- skinr_ui_skinsets_form_submit in ./
skinr_ui.admin.inc - Process skinr_ui_skinsets_form form submissions.
- skinr_ui_skinsets_settings_form in ./
skinr_ui.admin.inc - Menu callback; displays a listing of all skins in a skinsets, allowing you to enable or disable them individually for each theme.
1 string reference to 'skinr_skinsets'
- skinr_update_6002 in ./
skinr.install - Install new skinsets table to allow enabling and disabling of skinsets.
File
- ./
skinr.module, line 860
Code
function skinr_skinsets($type, $refresh = FALSE) {
// Fix for update script.
if (defined('MAINTENANCE_MODE')) {
return array();
}
static $skinsets = array(
'theme' => array(),
'skinset' => array(),
);
if ($refresh) {
$skinsets[$type] = array();
}
if (empty($skinsets[$type])) {
$themes = system_theme_data();
if ($type == 'theme') {
foreach ($themes as $theme) {
$skinset = new StdClass();
$skinset->filename = $theme->filename;
$skinset->name = $theme->name;
$skinset->status = isset($theme->status) ? 1 : 0;
$skinset->info = $theme->info;
$skinsets[$type][$skinset->name] = $skinset;
}
}
elseif ($type == 'skinset') {
// Rebuild if needed.
if (variable_get('skinr_rebuild_skinset_data', FALSE)) {
skinr_rebuild_skinset_data();
}
$result = db_query("SELECT * FROM {skinr_skinsets}");
while ($skinset = db_fetch_object($result)) {
if (file_exists($skinset->filename)) {
$skinset->info = unserialize($skinset->info);
$skinsets[$type][$skinset->name] = $skinset;
}
}
}
$default_status = array();
foreach ($themes as $theme) {
$default_status[$theme->name] = $theme->name;
}
foreach ($skinsets[$type] as $key => $skinset) {
$skinset->type = $type;
$additional = _skinr_skinset($skinset);
$skinset->options = $additional['options'];
$skinset->skins = $additional['skins'];
$statuses = skinr_skinset_statuses($skinset->name);
foreach ($skinset->skins as $skin_name => $skin) {
$skinset->skins[$skin_name]['status'] = !empty($statuses[$skin_name]) ? $statuses[$skin_name] : $default_status;
}
}
}
return $skinsets[$type];
}