You are here

function _hide_submit_get_image in Hide submit button 5

Same name and namespace in other branches
  1. 6 hide_submit.module \_hide_submit_get_image()
  2. 7 hide_submit.module \_hide_submit_get_image()

get the image according to user selection, default, random etc...

2 calls to _hide_submit_get_image()
_hide_submit_get_javascript in ./hide_submit.module
Get javascript code for injection
_hide_submit_get_message in ./hide_submit.module
Get javascript code for injection

File

./hide_submit.module, line 236

Code

function _hide_submit_get_image() {

  // Use static to assure the same image is returned for the current page
  static $image = FALSE;
  if ($image !== FALSE) {
    return $image;
  }
  $image = variable_get('hide_submit_image', HIDE_SUBMIT_DEFAULT_IMAGE);
  if (is_array($image)) {
    list($usec, $sec) = explode(' ', microtime());
    srand((double) $sec + (double) $usec * 100000);
    $image = $image[rand() % count($image)];
  }
  return $image;
}