View source
<?php
require_once 'splashify.display.inc';
function splashify_menu() {
$items = array();
$items['splash'] = array(
'title' => 'Splash',
'page callback' => 'splashify_display_splashtext',
'access arguments' => array(
'access content',
),
'type' => MENU_CALLBACK,
);
$items['admin/settings/splashify'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'splashify_admin_when_form',
),
'title' => 'Splashify',
'description' => 'Configuration area for the Splashify system.',
'file' => 'admin/splashify.admin.when.inc',
'type' => MENU_NORMAL_ITEM,
'access arguments' => array(
'access splashify admin',
),
);
$items['admin/settings/splashify/when'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'splashify_admin_when_form',
),
'title' => 'When',
'file' => 'admin/splashify.admin.when.inc',
'type' => MENU_DEFAULT_LOCAL_TASK,
'access arguments' => array(
'access splashify admin',
),
);
$items['admin/settings/splashify/where'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'splashify_admin_where_form',
),
'title' => 'Where',
'file' => 'admin/splashify.admin.where.inc',
'type' => MENU_LOCAL_TASK,
'access arguments' => array(
'access splashify admin',
),
);
$items['admin/settings/splashify/what'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'splashify_admin_what_form',
),
'title' => 'What',
'file' => 'admin/splashify.admin.what.inc',
'type' => MENU_LOCAL_TASK,
'access arguments' => array(
'access splashify admin',
),
);
$items['admin/settings/splashify/how'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'splashify_admin_how_form',
),
'title' => 'How',
'file' => 'admin/splashify.admin.how.inc',
'type' => MENU_LOCAL_TASK,
'access arguments' => array(
'access splashify admin',
),
);
return $items;
}
function splashify_perm() {
return array(
'access splashify admin',
);
}
function _splashify_jstorage_version($library, $version) {
return $version;
}
function _splashify_test_installed($library, $name, $args) {
$path = DRUPAL_ROOT . '/' . $library['library path'] . '/';
$file = file_exists($path . 'jstorage.min.js');
if (!$file) {
return FALSE;
}
else {
return TRUE;
}
}
function splashify_help($path, $arg) {
switch ($path) {
case 'admin/help#splashify':
$output = '';
$output .= '<h3>' . t('Splashify Help') . '</h3>';
$output .= '<h4>' . t('What do we consider a splash page?') . '</h4>';
$output .= '<p>' . t("We define a splash page as being content that shows up at a specified interval, at a specified location, one time. If someone goes to a certain page for the first time, we want to make sure the splash content shows up. But if the person is coming from an internal link on the site, we don't want the splash content to show up over and over again (otherwise, the splash page would become a nuisance).") . '</p>';
$output .= '<p>' . t('We determine how often the splash page should show up by what is defined under the "When" tab.') . '</p>';
$output .= '<h3>' . t('Caching') . '</h3>';
$output .= '<p>' . t('The only default cache settings that we found to break the splash functionality is if you set "Cache pages for anonymous users" to be on. This will cause the same splash page to show up over and over again for anonymous users.') . '</p>';
return $output;
}
}
function splashify_get_library_path($library_name) {
static $path;
if (isset($path)) {
return $path;
}
$path = FALSE;
if (function_exists('libraries_get_path')) {
$path = libraries_get_path($library_name);
if ($path !== FALSE && !file_exists($path)) {
$path = FALSE;
}
}
elseif (file_exists('./sites/all/libraries/' . $library_name)) {
$path = 'sites/all/libraries/' . $library_name;
}
if (!$path) {
if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install') {
$path = drupal_substr(dirname(__FILE__), drupal_strlen(getcwd()) + 1);
$path = strtr($path, '\\', '/');
$path .= '/' . $library_name;
}
else {
$path = drupal_get_path('module', 'splashify') . '/' . $library_name;
}
if (!file_exists($path)) {
$path = FALSE;
}
}
return $path;
}