function _splashify_get_config in Splashify 6
Same name and namespace in other branches
- 7 splashify.display.inc \_splashify_get_config()
Retrieves the admin settings.
Will either retrieve the desktop or mobile settings, depending whether this is a mobile request or not.
Return value
array Returns an associate array with the following keys: when_frequency, when_mobile_test, where_page, where_listpages, what_mode, what_content, what_content_value, how_mode, and how_size.
2 calls to _splashify_get_config()
- splashify_display_splashtext in ./
splashify.display.inc - Display the What: Content either in the site template or full screen.
- splashify_init in ./
splashify.display.inc - Implements hook_init().
File
- ./
splashify.display.inc, line 336 - Handles displaying the splash page.
Code
function _splashify_get_config() {
// This controls whether mobile is enabled or not.
$is_mobile_enabled = variable_get('splashify_when_mobile', 0);
// This controls whether or not we should use the mobile settings for this
// request.
$do_mobile = FALSE;
// If this admin setting is true, force the system to use the mobile
// settings.
$force_mobile = variable_get('splashify_when_mobile_test', FALSE);
if (!empty($is_mobile_enabled) && module_exists('mobile_tools')) {
// Is this a mobile request?
module_load_include('module', 'mobile_tools');
$mobile = mobile_tools_is_mobile_device();
if ($mobile['type'] != 'desktop' || $force_mobile) {
// This is a mobile request!
$do_mobile = TRUE;
// Get the mobile admin settings.
$when_frequency = variable_get('splashify_when_mobile_frequency', 'never');
$where_page = variable_get('splashify_where_mobile_page', 'home');
$where_listpages = variable_get('splashify_where_mobile_listpages', '');
$what_mode = variable_get('splashify_what_mobile_mode', 'random');
$what_content = variable_get('splashify_what_mobile_content', '');
$what_content_format = variable_get('splashify_what_mobile_content_format', 'FILTER_FORMAT_DEFAULT');
$what_content_title = variable_get('splashify_what_mobile_pagetitle', '');
$how_mode = variable_get('splashify_how_mobile_mode', 'redirect');
// This is no longer an option for the mobile settings.
$how_size = '';
}
}
if (!$do_mobile) {
// Get the desktop admin settings.
$when_frequency = variable_get('splashify_when_desktop_frequency', 'never');
$where_page = variable_get('splashify_where_desktop_page', 'home');
$where_listpages = variable_get('splashify_where_desktop_listpages', '');
$what_mode = variable_get('splashify_what_desktop_mode', 'random');
$what_content = variable_get('splashify_what_desktop_content', '');
$what_content_format = variable_get('splashify_what_desktop_content_format', 'FILTER_FORMAT_DEFAULT');
$what_content_title = variable_get('splashify_what_desktop_pagetitle', '');
$how_mode = variable_get('splashify_how_desktop_mode', 'redirect');
$how_size = variable_get('splashify_how_desktop_size', '');
}
// This is a textarea field, so make sure this value is safe.
$where_listpages = check_plain($where_listpages);
if (isset($what_content)) {
// We are dealing with a textarea field.
// Do not check for access to the input format, as doing so might result in
// unexpected behavior when anons visit the page.
$check_access = FALSE;
$what_content_value = check_markup($what_content, $what_content_format, $check_access);
}
else {
$what_content_value = '';
}
return array(
'when_frequency' => $when_frequency,
'when_mobile_test' => $force_mobile,
'where_page' => $where_page,
'where_listpages' => $where_listpages,
'what_mode' => $what_mode,
'what_content' => $what_content,
'what_content_value' => $what_content_value,
'what_content_title' => $what_content_title,
'how_mode' => $how_mode,
'how_size' => $how_size,
);
}