From 2de1c21e8fa5225703f07db126b48d4ff3fd3d76 Mon Sep 17 00:00:00 2001 From: Carlo Landmeter Date: Tue, 26 Apr 2011 18:09:08 +0200 Subject: some small fixes for commit url --- apk_browser.module | 18 ++++++++---------- 1 file 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'); -- cgit v1.2.3