You are here

function honeypot_library in Honeypot 7

Implements hook_library().

File

./honeypot.module, line 141
Honeypot module, for deterring spam bots from completing Drupal forms.

Code

function honeypot_library() {
  $info = system_get_info('module', 'honeypot');
  $version = $info['version'];

  // Library for Honeypot JS.
  $libraries['timestamp.js'] = array(
    'title' => 'Javascript to support timelimit on cached pages.',
    'version' => $version,
    'js' => array(
      array(
        'type' => 'setting',
        'data' => array(
          'honeypot' => array(
            'jsToken' => honeypot_get_signed_timestamp('js_token:' . mt_rand(0, 2147483647)),
          ),
        ),
      ),
      drupal_get_path('module', 'honeypot') . '/js/honeypot.js' => array(
        'group' => JS_LIBRARY,
        'weight' => 3,
      ),
    ),
  );
  return $libraries;
}