You are here

function _janrain_capture_get_screen in Janrain Registration 7.4

Same name and namespace in other branches
  1. 7.2 janrain_capture.module \_janrain_capture_get_screen()
  2. 7.3 janrain_capture.module \_janrain_capture_get_screen()
3 calls to _janrain_capture_get_screen()
janrain_capture_oauth in includes/janrain_capture.endpoints.inc
Callback for the janrain_capture/oauth menu item. This serves as the redirect_uri Capture redirects the user to and performs the authentication.
janrain_capture_page_alter in ./janrain_capture.module
Implements hook_page_alter().
janrain_capture_user_view in ./janrain_capture.module
Implementation of hook_user_view to customize profile view

File

./janrain_capture.module, line 1130
This module implements authentication endpoints for Janrain Capture.

Code

function _janrain_capture_get_screen($fname) {

  // sanity check the screen is valid
  static $allowed_screens = array(
    'signin.html',
    'edit-profile.html',
    'forgot.html',
    'public-profile.html',
    'verify.html',
    'signin.js',
    'edit-profile.js',
    'forgot.js',
    'public-profile.js',
    'verify.js',
  );
  if (!in_array($fname, $allowed_screens)) {
    $message = 'Janrain Capture: Invalid screen file specified "@filename." Please make sure your screens folder is in' . ' the correct location.';
    drupal_set_message(t($message, array(
      '@filename' => $fname,
    )), 'error');
    return '';
  }

  // check for screens module
  if (module_exists('janrain_capture_screens')) {

    // proceed with screens module
    if (!in_array($fname, _janrain_capture_get_screens())) {
      return '';
    }
    if ($screen_file = _janrain_capture_get_screen_file($fname)) {
      return file_get_contents($screen_file);
    }
    return '';
  }
  else {
    $country_id = $_SESSION['country_id'];

    // not using screens module
    $screens_folder = variable_get('janrain_capture_screens_folder', 'file:///sites/all/themes/janrain-capture-screens/');
    $url = is_array($screens_folder) ? $screens_folder[$country_id] : $screens_folder;
    if (strpos($url, 'file') === 0) {

      // using local screens
      return _janrain_capture_get_local_screen($fname);
    }
    elseif (strpos($url, 'http') === 0) {

      // using remote screens
      return _janrain_capture_get_local_screen($fname, TRUE);
    }
    else {

      // empty url setting
      watchdog('janrain_capture', 'No Capture screens folder specified in the Janrain Capture settings.', array(), WATCHDOG_WARNING);
      return '';
    }
  }
}