function janrain_capture_url in Janrain Registration 7
Same name and namespace in other branches
- 6 janrain_capture.module \janrain_capture_url()
- 7.4 janrain_capture.module \janrain_capture_url()
- 7.2 janrain_capture.module \janrain_capture_url()
- 7.3 janrain_capture.module \janrain_capture_url()
Returns the full URL of a specified CaptureUI screen
Parameters
array $options: An associative array of options to use in constructing the URL
Return value
string The full URL string of the Capture URL screen being requested
4 calls to janrain_capture_url()
- janrain_capture_oauth in ./
janrain_capture.pages.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_profile in ./
janrain_capture.pages.inc - Callback for the janrain_capture/profile menu item. Ensures the access_token is valid before redirecting the user to the Capture profile screen.
- janrain_capture_signin in ./
janrain_capture.module - Menu callback to override user/login and user/register.
- janrain_capture_signin_link in ./
janrain_capture.module - Returns a render array for the 'Register / Sign in' link for Janrain Capture.
File
- ./
janrain_capture.module, line 227 - This module implements authentication endpoints for Janrain Capture.
Code
function janrain_capture_url($options = NULL) {
$janrain_capture_main = variable_get('janrain_capture_main', array());
$janrain_capture_optional = variable_get('janrain_capture_optional', array());
if (!empty($janrain_capture_main['capture_address']) && !empty($janrain_capture_main['capture_client_id'])) {
$required = array(
'redirect_uri' => url('janrain_capture/oauth', array(
'absolute' => TRUE,
)),
'xd_receiver' => url(NULL, array(
'absolute' => TRUE,
)) . drupal_get_path('module', 'janrain_capture') . '/xdcomm.html',
'client_id' => $janrain_capture_main['capture_client_id'],
);
if (!$options || strpos($options['action'], 'profile') !== 0) {
if (!$options) {
$options = array();
}
$defaults = array(
'action' => 'signin',
'recover_password_callback' => 'Drupal.janrainCapture.closeRecoverPassword',
'response_type' => 'code',
);
}
else {
$defaults = array(
'callback' => 'Drupal.janrainCapture.closeProfileEditor',
);
}
$args = array_merge($required, $defaults, $options);
$action = $args['action'];
unset($args['action']);
$url = 'https://' . (!empty($janrain_capture_optional['captureui_address']) ? $janrain_capture_optional['captureui_address'] : $janrain_capture_main['capture_address']) . '/oauth/' . $action . '?' . http_build_query($args, '', '&');
}
else {
$url = '';
}
return $url;
}