summaryrefslogtreecommitdiffstats
path: root/apk_browser.module
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2011-04-26 18:09:08 +0200
committerCarlo Landmeter <clandmeter@gmail.com>2011-04-26 18:09:08 +0200
commit2de1c21e8fa5225703f07db126b48d4ff3fd3d76 (patch)
treeb79d707b4fb23819fc04a5061a0ce20dd92f103d /apk_browser.module
parente78d4261c296d20c3cebcd7e4e23431c04afa0a9 (diff)
downloadapk_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.module18
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');