You are here

function freelinking_filter_tips in Freelinking 6.3

Same name and namespace in other branches
  1. 5 freelinking.module \freelinking_filter_tips()
  2. 6 freelinking.module \freelinking_filter_tips()
  3. 6.2 freelinking.module \freelinking_filter_tips()

Implementation of hook_filter_tips().

File

./freelinking.module, line 188

Code

function freelinking_filter_tips($delta, $format, $long = FALSE) {
  $syntax = variable_get('freelinking_syntax_mode', 'double_bracket');
  if ($syntax == 'double_bracket') {
    $pattern = '<tt>[[indicator:target|Title]]</tt>';
  }
  elseif ($syntax == 'markdown') {
    $pattern = '<tt>[Title](indicator:target)</tt>';
  }
  else {
    $pattern = '<tt>[indicator:target|Title]</tt>';
  }
  $text = t('Freelinking helps you easily create HTML links. Links take the form of !pattern.', array(
    '!pattern' => $pattern,
  ));
  $plugins = freelinking_get_plugins();
  if ($long == FALSE) {
    $default_tip = $plugins[variable_get('freelinking_default', 'nodetitle')]['tip'];
    if ($default_tip) {
      $text .= ' By default (no indicator): ' . $default_tip;
    }
    return $text;
  }
  $text = '<h4>' . t('Freelinking') . '</h4>' . $text;
  $text .= '<br />';
  $text .= t('Below is a list of available types of freelinks you may use, organized as <strong>Plugin Name</strong>: <em>[indicator]</em>.');
  foreach ($plugins as $name => $plugin) {
    $tips[$name] = '<strong>' . drupal_ucfirst($name) . '</strong> <em>[' . $plugin['indicator'] . ']</em>';
    if ($plugin['tip']) {
      $tips[$name] .= ' — ' . $plugin['tip'];
    }
  }
  $text .= theme('item_list', $tips);
  return $text;
}