diff options
author | Carlo Landmeter <clandmeter@gmail.com> | 2011-04-26 18:09:08 +0200 |
---|---|---|
committer | Carlo Landmeter <clandmeter@gmail.com> | 2011-04-26 18:09:08 +0200 |
commit | 2de1c21e8fa5225703f07db126b48d4ff3fd3d76 (patch) | |
tree | b79d707b4fb23819fc04a5061a0ce20dd92f103d /apk_browser.module | |
parent | e78d4261c296d20c3cebcd7e4e23431c04afa0a9 (diff) | |
download | apk_browser-2de1c21e8fa5225703f07db126b48d4ff3fd3d76.tar.bz2 apk_browser-2de1c21e8fa5225703f07db126b48d4ff3fd3d76.tar.xz |
some small fixes for commit url
Diffstat (limited to 'apk_browser.module')
-rw-r--r-- | apk_browser.module | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/apk_browser.module b/apk_browser.module index 7a7b87c..f33f606 100644 --- a/apk_browser.module +++ b/apk_browser.module @@ -482,22 +482,20 @@ function apk_browser_cleanup() { function apk_browser_commit_url($commit) { $fid = variable_get('apk_import_aggregator','0'); if (module_exists('aggregator') && $fid) { - if (!empty($commit)) { - $commit = '%' . $commit . '%'; + if (!empty($commit)) { + $search = '%' . $commit . '%'; } - $title = db_query("SELECT title FROM {aggregator_item} WHERE link LIKE :commit AND fid = :fid", array(':commit' => $commit, ':fid' => $fid))->fetchField(); - $href = str_replace('%commit%', $commit, variable_get('apk_import_commit_url', '')); - $attributes = ($title) ? array('title' => $title, 'class' => 'with-tooltip') : array(); - return l($commit, $href, array('attributes' => $attributes)); - } else { - return FALSE; + $title = db_query("SELECT title FROM {aggregator_item} WHERE link LIKE :commit AND fid = :fid", array(':commit' => $search, ':fid' => $fid))->fetchField(); } + $href = str_replace('%commit%', $commit, variable_get('apk_import_commit_url', '')); + $attributes = empty($title) ? array() : array('title' => check_plain($title), 'class' => 'with-tooltip'); + return l($commit, $href, array('attributes' => $attributes)); } -function apk_browser_preprocess_node($vars) { +function apk_browser_preprocess_node(&$vars) { if ($vars['node']->type == 'apk') { if (isset($vars['apk_commit']['0']['value'])) { - $vars['commit_url'] = apk_browser_commit_url($vars['apk_commit']['0']['value']); + $vars['commit_url'] = apk_browser_commit_url($vars['apk_commit']['0']['value']); } $path = drupal_get_path('module', 'apk_browser'); drupal_add_js($path . '/tooltip/tooltip.js'); |