You are here

function sharebar_bar_filter in ShareBar 6

Same name and namespace in other branches
  1. 8 sharebar.module \sharebar_bar_filter()
  2. 7.2 sharebar.module \sharebar_bar_filter()
  3. 7 sharebar.module \sharebar_bar_filter()

Replaces dynamic data with their values.

1 call to sharebar_bar_filter()
sharebar_preprocess_page in ./sharebar.module
Preprocess variables for region.tpl.php

File

./sharebar.module, line 177
Various module information.

Code

function sharebar_bar_filter($input, $title = '') {
  $name = '';
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    if ($node->nid > 0) {
      $title = $node->title;
      $name = $node->name;
    }
  }
  $path = isset($_GET['q']) ? $_GET['q'] : '<front>';
  $currenturl = url($path, array(
    'absolute' => TRUE,
  ));
  $code = array(
    '[title]',
    '[url]',
    '[author]',
    '[twitter]',
  );
  $values = array(
    $title,
    $currenturl,
    $name,
    variable_get('sharebar_bar_twitter_username', 'themesnap'),
  );
  return str_replace($code, $values, $input);
}