function sharebar_init in ShareBar 6
Same name and namespace in other branches
- 7.2 sharebar.module \sharebar_init()
- 7 sharebar.module \sharebar_init()
Implements hook_init().
File
- ./
sharebar.module, line 85 - Various module information.
Code
function sharebar_init() {
if (arg(0) != 'admin') {
$node = menu_get_object();
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '' && (!empty($node) && variable_get('sharebar_bar_posts_' . $node->type . '_enabled', TRUE)) || !(arg(0) == 'node' && is_numeric(arg(1))) && arg(1) != 'add' && arg(2) != 'edit' && arg(3) != 'edit' && variable_get('sharebar_bar_pages_enabled', TRUE)) {
drupal_add_css(drupal_get_path('module', 'sharebar') . '/css/sharebar.css');
if (!variable_get('sharebar_bar_oncontent', TRUE)) {
if (variable_get('sharebar_bar_horizontal', TRUE)) {
$hori = 'TRUE';
}
else {
$hori = 'FALSE';
}
$width = variable_get('sharebar_bar_width', 1000);
$swidth = variable_get('sharebar_bar_swidth', 75);
$position = variable_get('sharebar_bar_position', 'left');
$leftoffset = variable_get('sharebar_bar_leftoffset', 10);
$rightoffset = variable_get('sharebar_bar_rightoffset', 10);
drupal_add_js(drupal_get_path('module', 'sharebar') . '/js/sharebar.js');
drupal_add_js('jQuery(document).ready(function($) { $(\'.sharebar\').sharebar({horizontal:\'' . $hori . '\',swidth:\'' . $swidth . '\',minwidth:' . $width . ',position:\'' . $position . '\',leftOffset:' . $leftoffset . ',rightOffset:' . $rightoffset . '}); });', 'inline');
}
}
}
}