advanced_help_search

Versions
6
advanced_help_search($op = 'search', $keys = null)

Implementation of hook_search()

Code

contributions/advanced_help/advanced_help.module, line 731

<?php
function advanced_help_search($op = 'search', $keys = null) {
  switch ($op) {
    case 'name':
      return t('Help');
    case 'reset':
      variable_del('advanced_help_last_cron');
      return;
    case 'search':
      $topics = advanced_help_get_topics();
      $find = do_search($keys, 'help');
      if (!$find) {
        return;
      }

      $results = array();

      $placeholders = implode(', ', array_fill(0, count($find), '%d'));
      foreach ($find as $item) {
        $sids[] = $item->sid;
      }

      $result = db_query("SELECT * FROM {advanced_help_index} WHERE sid IN ($placeholders)", $sids);
      while ($sid = db_fetch_object($result)) {
        // Guard against removed help topics that are still indexed.
        if (empty($topics[$sid->module][$sid->topic])) {
          continue;
        }
        $info = $topics[$sid->module][$sid->topic];
        $text = advanced_help_view_topic($sid->module, $sid->topic);
        $results[] = array('link' => advanced_help_url("help/$sid->module/$sid->topic"),
                           'title' => $info['title'],
                           'snippet' => search_excerpt($keys, $text));
      }
      return $results;
  }
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.