You are here

function nodejs_add_js_to_page_check in Node.js integration 7

Same name and namespace in other branches
  1. 8 nodejs.module \nodejs_add_js_to_page_check()

Check if we should add the node.js js to the page.

We check the url, and whether or not the admin has closed down access to auth users only.

1 call to nodejs_add_js_to_page_check()
nodejs_init in ./nodejs.module
Implements hook_init().

File

./nodejs.module, line 281

Code

function nodejs_add_js_to_page_check() {
  global $user;
  $disabled_pages = variable_get('nodejs_disabled_pages', 1);
  $valid_page = drupal_match_path(drupal_get_path_alias(), variable_get('nodejs_pages', '*'));
  if (variable_get('nodejs_authenticated_users_only', FALSE)) {
    $valid_user = $user->uid > 0;
  }
  else {
    $valid_user = TRUE;
  }
  return $disabled_pages ? $valid_page && $valid_user : !$valid_page && $valid_user;
}