function oauth_common_page_user_authorizations in OAuth 1.0 7.4
Same name and namespace in other branches
- 6.3 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 - Implements 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' => array(
"oauth-common-authorization-application",
),
),
array(
'data' => t('Key'),
'class' => array(
"oauth-common-authorization-key",
),
),
array(
'data' => t('Created'),
'class' => array(
"oauth-common-authorization-created",
),
),
array(
'data' => t('Expires'),
'class' => array(
"oauth-common-authorization-expires",
),
),
array(
'data' => t('Operations'),
'class' => array(
"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' => array(
"oauth-common-authorization-application",
),
),
'key' => array(
'data' => substr($token->key, 0, 6) . '...',
'class' => array(
"oauth-common-authorization-key",
),
),
'created' => array(
'data' => format_date($token->created),
'class' => array(
"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' => array(
"oauth-common-authorization-expires",
),
);
$rows[] = array(
'data' => $data + array(
'operations' => array(
'data' => theme('links', array(
'links' => $operations,
)),
'class' => array(
"oauth-common-authorization-operations",
),
),
),
);
}
$table = theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'oauth-common-list-authorization',
),
));
return $table;
}