View source
<?php
require_once 'splashify.display.inc';
function splashify_menu() {
$items = array();
$items['splashify-splash'] = array(
'title' => 'Splash',
'page callback' => 'splashify_display_splashtext',
'access arguments' => array(
'access content',
),
'type' => MENU_CALLBACK,
);
$items['_splashify_ajax'] = array(
'title' => 'AJAX Splash',
'page callback' => 'splashify_display_ajax',
'access arguments' => array(
'access content',
),
'type' => MENU_CALLBACK,
);
$items['admin/config/system/splashify'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'splashify_admin_when_form',
),
'title' => 'Splashify',
'description' => t('Configuration area for the Splashify system.'),
'file' => 'admin/splashify.admin.when.inc',
'type' => MENU_NORMAL_ITEM,
'access arguments' => array(
'access splashify admin',
),
'weight' => 6,
);
$items['admin/config/system/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',
),
'weight' => 6,
);
$items['admin/config/system/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',
),
'weight' => 8,
);
$items['admin/config/system/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',
),
'weight' => 10,
);
$items['admin/config/system/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',
),
'weight' => 12,
);
return $items;
}
function splashify_permission() {
return array(
'access splashify admin' => array(
'title' => t('Administer Splashify'),
'description' => t('Access the admin area for the splashify module.'),
),
);
}
function splashify_libraries_info() {
$libraries = array();
$libraries['jstorage'] = array(
'name' => 'jStorage library',
'vendor url' => 'http://www.jstorage.info/',
'download url' => 'https://github.com/andris9/jStorage/zipball/master',
'version callback' => '_splashify_jstorage_version',
'version arguments' => array(
'1',
'2',
),
'versions' => array(
'1' => array(),
'2' => array(),
),
'files' => array(
'js' => array(
'jstorage.js',
),
),
'variants' => array(
'minified' => array(
'files' => array(
'js' => array(
'jstorage.min.js',
),
),
'variant callback' => '_splashify_test_installed',
'variant arguments' => array(),
),
),
);
$libraries['Mobile_Detect'] = array(
'name' => 'Mobile Detect',
'vendor url' => 'http://mobiledetect.net',
'download url' => 'https://raw.github.com/serbanghita/Mobile-Detect/master/Mobile_Detect.php',
'version callback' => '_splashify_mobiledetect_version',
'files' => array(
'php' => array(
'Mobile_Detect.php',
),
),
'versions' => array(
'2' => array(),
),
);
return $libraries;
}
function _splashify_jstorage_version($library, $version) {
return $version;
}
function _splashify_mobiledetect_version($library, $version) {
return 2;
}
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>';
return $output;
}
}