You are here

function shoutbox_get_refresh_rate in Shoutbox 7

Same name and namespace in other branches
  1. 6.2 shoutbox.module \shoutbox_get_refresh_rate()
  2. 7.2 shoutbox.module \shoutbox_get_refresh_rate()

Return the auto refresh interval.

Parameters

$milliseconds: TRUE if the interval should be converted to milliseconds. If FALSE, the return value will be in seconds.

Return value

The shoutbox automatic refresh interval in. Returns 0 if auto refresh is disabled or if the shoutbox is being paged

3 calls to shoutbox_get_refresh_rate()
shoutbox_add_form in ./shoutbox.module
Generates form for adding shouts.
shoutbox_admin_settings in ./shoutbox.pages.inc
Admin settings form.
_shoutbox_js_config in ./shoutbox.module
Unified function to generate JS settings.

File

./shoutbox.module, line 285
Shoutbox module displays a block for users to create short messages for the whole site. Uses AHAH to update the database and display content.

Code

function shoutbox_get_refresh_rate($milliseconds = FALSE) {

  // If we're on the page view and it's being paged, force auto refresh
  // to be disabled to prevent the paged data from being refreshed with
  // what would be on the front page.
  if ($_GET['q'] == 'shoutbox' && isset($_GET['page'])) {
    return 0;
  }
  else {
    return variable_get('shoutbox_refresh', 0) * ($milliseconds ? 1000 : 1);
  }
}