function facebook_boxes_block_view in Facebook Boxes 7
Implements hook_block_view().
File
- ./
facebook_boxes.module, line 249
Code
function facebook_boxes_block_view($delta = '') {
$block = array();
global $base_root;
if ($delta == 'fb_like') {
$url = urlencode(variable_get('fb_like_url', 'http://www.facebook.com/platform'));
$width = variable_get('fb_like_width', 292);
$height = variable_get('fb_like_height', 300);
$colorscheme = urlencode(variable_get('fb_like_colorscheme', 'light'));
$border = urlencode(variable_get('fb_like_border', ''));
$opts = variable_get('fb_like_toggles', array(
'fb_faces',
'fb_header',
));
$block['subject'] = "On Facebook";
$block['content'] = array(
'#markup' => sprintf('<iframe src="//www.facebook.com/plugins/likebox.php?href=%s&width=%u&height=%u&colorscheme=%s&show_faces=%s&border_color=%s&stream=%s&header=%s" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:%spx; height:%spx;" allowTransparency="true"></iframe>', $url, $width, $height, $colorscheme, in_array('fb_faces', $opts) ? 'true' : 'false', $border, in_array('fb_stream', $opts) ? 'true' : 'false', in_array('fb_header', $opts) ? 'true' : 'false', $width, $height),
);
}
elseif ($delta == 'fb_rec') {
$opts = variable_get('fb_rec_toggles', array(
'fb_blank',
'fb_header',
));
$block['subject'] = "Facebook Recommendations";
$block['content'] = array(
'#markup' => sprintf('<iframe src="//www.facebook.com/plugins/recommendations.php?site=%s&action&width=%u&height=%u&colorscheme=%s&&border_color=%s&header=%s&font&linktarget=%s" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:%upx; height:%upx;" allowTransparency="true"></iframe>', urlencode(variable_get('fb_rec_domain', parse_url($base_root, PHP_URL_HOST))), variable_get('fb_rec_width', 292), variable_get('fb_rec_height', 300), urlencode(variable_get('fb_rec_colorscheme', 'light')), urlencode(variable_get('fb_rec_border', '')), in_array('fb_header', $opts) ? 'true' : 'false', in_array('fb_target', $opts) ? '_blank' : '_top', variable_get('fb_rec_width', 292), variable_get('fb_rec_height', 300)),
);
}
elseif ($delta == 'fb_follow') {
$block['subject'] = 'Follow';
$out = array();
$url = variable_get('fb_follow_url', 'http://www.facebook.com/newsignature');
$out[] = '<iframe src="http://www.facebook.com/plugins/follow.php?href=' . $url;
$layout = variable_get('fb_follow_layout', 'standard');
$out[] = '&layout=' . $layout;
if ($layout == 'standard') {
$showfaces = variable_get('fb_follow_showface', 'TRUE');
if (!$showfaces) {
$showfaces = 'FALSE';
}
$out[] = '&show_faces=' . $showfaces;
}
$out[] = '&colorscheme=' . variable_get('fb_follow_colorscheme', 'light');
$out[] = '&font=' . variable_get('fb_follow_font', 'arial');
$width = preg_replace('/[^\\d\\s]/', '', variable_get('fb_follow_width', '450'));
$out[] = '&width=' . $width;
$out[] = '&height=80" scrolling="no" frameborder="0" ';
$out[] = 'style="border:none; overflow:hidden; width:' . $width;
$out[] = ';height:80px; "allowTransparency="true"></iframe>';
$block['content'] = array(
'#markup' => implode('', $out),
);
}
return $block;
}