You are here

function _site_disclaimer_enabled in Site Disclaimer 7

Same name and namespace in other branches
  1. 6 site_disclaimer.module \_site_disclaimer_enabled()

Determine if site_disclaimer is enabled.

2 calls to _site_disclaimer_enabled()
site_disclaimer_confirm in ./site_disclaimer.pages.inc
Display the Site Disclaimer, when a user needs to confirm them after registering.
site_disclaimer_init in ./site_disclaimer.module
Implements hook_init().

File

./site_disclaimer.module, line 481
This module adds Site Disclaimer to the registration page.

Code

function _site_disclaimer_enabled($langcode = NULL) {

  // Will we show the full text of the Terms or only provide a link to the Terms.
  // Reading the checkbox label to find out.
  $nid = _site_disclaimer_nid_translated(variable_get('site_disclaimer_node_id', ''), $langcode);
  $checkbox_label = filter_xss_admin(_site_disclaimer_variable_get_translated('site_disclaimer_checkbox_label', SITE_DISCLAIMER_DEFAULT_CHECKBOX_LABEL, $langcode));
  $use_link = strpos($checkbox_label, '@link') !== FALSE;
  $use_named_links = strpos($checkbox_label, '@"') !== FALSE;

  // If there is no node to show and no links in the $checkbox_label, we don't show the terms form.
  $site_disclaimer_enabled = $use_link || $use_named_links || !empty($nid);
  return $site_disclaimer_enabled;
}