4 * Implementation of theme functions.
6 * XFBML markup will only work on canvas pages and facebook connect pages.
9 // @TODO theme function now take only one parameter, an associative array.
11 function theme_fb_login_button($params) {
12 $text = isset($params['text']) ?
$params['text'] : '';
13 $options = isset($params['options']) ?
$params['options'] : array();
15 // Facebook used to provide default text. No longer, apparently.
22 'attributes' => array(),
24 if (!isset($options['attributes']['scope'])) {
25 // Which permissions to prompt for?
27 drupal_alter('fb_required_perms', $perms);
29 $options['attributes']['scope'] = implode(',', $perms);
34 $button = '<fb:login-button ' .
drupal_attributes($options['attributes']) .
'>' .
35 ($text ?
'<fb:intl>' .
check_plain($text) .
'</fb:intl>' : '') .
'</fb:login-button>';
41 function theme_fb_username($params) {
42 $fbu = $params['fbu'];
43 $object = $params['account'];
44 $orig = $params['orig'];
45 if (!$fbu || arg(0) == 'admin') {
49 $wrap_pre = "<span class=fb_hide>$orig</span><span class=fb_show style='display:none'>";
50 $wrap_post = "</span>\n";
52 if ($object->uid
&& user_access('access user profiles')) {
53 // Provide link if local account.
54 $wrap_pre = $wrap_pre .
'<a href="' .
url('user/' .
$object->uid
) .
'">';
55 $wrap_post = '</a>' .
$wrap_post;
56 $ifcantsee = 'ifcantsee="' .
addslashes(check_plain($object->name
)) .
'"';
59 $fbml = "<fb:name linked=false useyou=false uid=\"$fbu\" $ifcantsee></fb:name>"; $output = $wrap_pre .
$fbml .
$wrap_post;
64 function theme_fb_user_picture($params) {
66 return $params['orig'];
68 $fbu = $params['fbu'];
69 $object = $params['account'];
70 $orig = $params['orig'];
72 // http://developers.facebook.com/docs/reference/fbml/profile-pic
73 $fbml = "<fb:profile-pic linked=false uid=\"$fbu\"></fb:profile-pic>";
74 $wrap_pre = '<span class=fb_hide>' .
$orig .
'</span><span class="fb_show" style="display:none;"><div class="picture">';
75 $wrap_post = '</div></span>';
76 if ($object->uid
&& user_access('access user profiles')) {
77 // Provide link to local account.
78 $wrap_pre = $wrap_pre .
'<a href="' .
url('user/' .
$object->uid
) .
'">';
79 $wrap_post = '</a>' .
$wrap_post;
81 return $wrap_pre .
$fbml .
$wrap_post;
85 function theme_fb_fbml_popup($elem) {
86 // Hide this markup until javascript shows it.
87 $t = '<div class="fb_fbml_popup_wrap" style="display:none;" ' .
">\n";
89 $t .
= '<a href="#" title="' .
check_plain($elem['#title']) .
'" ' .
90 (isset($elem['#link_attributes']) ?
drupal_attributes($elem['#link_attributes']) : '') .
91 '>' .
check_plain($elem['#link_text']) .
'</a>';
92 $t .
= '<div class="fb_fbml_popup" ' .
drupal_attributes($elem['#attributes']) .
'>';
93 $t .
= $elem['#children'];
94 $t .
= "</div></div>\n";