function oauth_common_page_user_authorizations in OAuth 1.0 6.3
Same name and namespace in other branches
- 7.4 oauth_common.authorizations.inc \oauth_common_page_user_authorizations()
- 7.3 oauth_common.authorizations.inc \oauth_common_page_user_authorizations()
@file Functions related to a user's authorization section
1 string reference to 'oauth_common_page_user_authorizations'
- oauth_common_providerui_menu in ./
oauth_common_providerui.module - Implementation of hook_menu().
File
- ./
oauth_common.authorizations.inc, line 8 - Functions related to a user's authorization section
Code
function oauth_common_page_user_authorizations($account) {
$header = array(
array(
'data' => t('Application'),
'class' => "oauth-common-authorization-application",
),
array(
'data' => t('Key'),
'class' => "oauth-common-authorization-key",
),
array(
'data' => t('Created'),
'class' => "oauth-common-authorization-created",
),
array(
'data' => t('Expires'),
'class' => "oauth-common-authorization-expires",
),
array(
'data' => t('Operations'),
'class' => "oauth-common-authorization-operations",
),
);
$access_tokens = oauth_common_get_user_provider_tokens($account->uid);
$rows = array();
foreach ($access_tokens as $token) {
$consumer = $token->consumer;
$data = array(
'application' => array(
'data' => check_plain($consumer->name),
'class' => "oauth-common-authorization-application",
),
'key' => array(
'data' => substr($token->key, 0, 6) . '...',
'class' => "oauth-common-authorization-key",
),
'created' => array(
'data' => format_date($token->created),
'class' => "oauth-common-authorization-created",
),
);
$operations = array();
$operations[] = array(
'title' => t('Edit'),
'href' => sprintf('user/%d/oauth/authorizations/%s', $account->uid, $token->tid),
'query' => array(
'destination' => $_GET['q'],
),
);
$operations[] = array(
'title' => t('Delete'),
'href' => sprintf('user/%d/oauth/authorizations/%s', $account->uid, $token->tid) . '/delete',
'query' => array(
'destination' => $_GET['q'],
),
);
$data['expires'] = array(
'data' => $token->expires ? format_date($token->expires) : t('Never'),
'class' => "oauth-common-authorization-expires",
);
$rows[] = array(
'data' => $data + array(
'operations' => array(
'data' => theme('links', $operations),
'class' => "oauth-common-authorization-operations",
),
),
);
}
$table = theme('table', $header, $rows, array(
'id' => "oauth-common-list-authorization",
));
return $table;
}