function flickr_tags_menu in Flickr 5
Same name and namespace in other branches
- 6 tags/flickr_tags.module \flickr_tags_menu()
- 7 tags/flickr_tags.module \flickr_tags_menu()
Implementation of hook_menu().
File
- tags/
flickr_tags.module, line 8
Code
function flickr_tags_menu($may_cache) {
global $user;
$items = array();
if ($may_cache) {
}
else {
if (arg(0) == 'flickr' && is_numeric(arg(1)) && arg(1) > 0) {
$account = user_load(array(
'uid' => arg(1),
));
if ($account !== FALSE && isset($account->flickr['nsid'])) {
$nsid = $account->flickr['nsid'];
$admin_access = user_access('administer flickr');
// let a user view their own account or all if they have permission
$view_access |= user_access('view own flickr photos') && $user->uid == arg(1) || user_access('view all flickr photos');
// Only admins can view blocked accounts
$view_access &= $account->status || $admin_access;
//flickr main tags page(cloud)
$items[] = array(
'path' => 'flickr/' . arg(1) . '/tags',
'title' => t("Tags"),
'type' => MENU_LOCAL_TASK,
'callback' => 'flickr_tags_cloud',
'callback arguments' => array(
arg(1),
$nsid,
),
'access' => $view_access,
);
$items[] = array(
'path' => 'flickr/' . arg(1) . '/tags/cloud',
'title' => t("Cloud"),
'type' => MENU_DEFAULT_LOCAL_TASK,
'access' => $view_access,
);
//flickr tag list page
$items[] = array(
'path' => 'flickr/' . arg(1) . '/tags/list',
'title' => t("List"),
'type' => MENU_LOCAL_TASK,
'callback' => 'flickr_tags_list',
'callback arguments' => array(
arg(1),
$nsid,
),
'access' => $view_access,
);
//flickr specific tag page
if (arg(3) !== NULL && arg(3) != 'cloud' && arg(3) != 'list') {
$items[] = array(
'path' => 'flickr/' . arg(1) . '/tags/' . arg(3),
'title' => t('Tags: @tags', array(
'@tags' => str_replace(',', ', ', arg(3)),
)),
'type' => MENU_LOCAL_TASK,
'callback' => 'flickr_tags_photos',
'callback arguments' => array(
arg(1),
$nsid,
arg(3),
),
'access' => $view_access,
);
}
}
}
}
return $items;
}