You are here

function xbbcode_highlighter_filter_tips in Extensible BBCode 5

File

xbbcode_highlighter/xbbcode_highlighter.module, line 39

Code

function xbbcode_highlighter_filter_tips($delta, $format = -1, $long = false) {
  $row = db_fetch_array(db_query("SELECT id,name,description,sample FROM {xbbcode_highlighter} WHERE delta=%d", $delta));
  if (!$row['name']) {
    $long = false;
  }

  // no long tips for unset names.
  $out .= t("Your text will be syntax-colored as !lang code.", array(
    '!lang' => $row['name'] ? $row['name'] : strtoupper($row['id']),
  ));
  if ($long) {
    if ($row['description']) {
      $out .= "<p>" . $row['description'] . "</p>";
    }
    if ($row['sample']) {
      $out .= @xbbcode_highlighter_highlight($row['id'], $row['sample'], true);
    }
  }
  return $out;
}