function skinr_get in Skinr 6.2
Same name and namespace in other branches
- 6 skinr.module \skinr_get()
Retrieves the desired skinr object.
Return value
A skinr object if both $module and $sid are specified. An array of skinr objects if only $module is specified. An array of all skinr objects for a theme if neither $module nor $sid is specified. FALSE on failure.
12 calls to skinr_get()
- panels_skinr_data_handler in modules/
panels.skinr.inc - Skinr data handler. This is the data that populates the skinr form.
- panels_skinr_submit_handler_settings in modules/
panels.skinr.inc - Skinr submit handler.
- skinr_data_handler in ./
skinr.handlers.inc - skinr_set in ./
skinr.module - Save a skinr object.
- skinr_skin_extract in ./
skinr.module
File
- ./
skinr.module, line 489
Code
function skinr_get($theme = NULL, $module = NULL, $sid = NULL, $reset = FALSE) {
static $cache = array();
if (is_null($theme)) {
$theme = skinr_current_theme();
}
if ($reset) {
$cache = array();
}
if (!isset($cache[$theme][$module][$sid])) {
if (!isset($cache[$theme])) {
$cache[$theme] = array();
}
if (!is_null($module) && !isset($cache[$theme][$module])) {
$cache[$theme][$module] = array();
}
if (!is_null($module) && !is_null($sid)) {
// Fetch just this sid.
$result = db_query("SELECT theme, module, sid, settings, skins FROM {skinr} WHERE theme = '%s' AND module = '%s' AND sid = '%s'", $theme, $module, $sid);
}
elseif (!is_null($module)) {
// Fetch all settings for this theme and module.
$result = db_query("SELECT theme, module, sid, settings, skins FROM {skinr} WHERE theme = '%s' AND module = '%s'", $theme, $module);
}
else {
// Fetch all settings for this theme.
$result = db_query("SELECT theme, module, sid, settings, skins FROM {skinr} WHERE theme = '%s'", $theme);
}
while ($skinr = db_fetch_object($result)) {
$skinr->settings = unserialize($skinr->settings);
$skinr->skins = unserialize($skinr->skins);
$cache[$skinr->theme][$skinr->module][$skinr->sid] = $skinr;
}
}
if (is_null($sid) && is_null($module)) {
// Return all the skinrs for the theme.
if (isset($cache[$theme])) {
return $cache[$theme];
}
}
elseif (is_null($sid)) {
// Return all the skinrs for the module.
if (isset($cache[$theme][$module])) {
return $cache[$theme][$module];
}
}
elseif (isset($cache[$theme][$module][$sid])) {
return $cache[$theme][$module][$sid];
}
return FALSE;
}