Needs review
Project:
SPARQL Views
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 May 2011 at 18:30 UTC
Updated:
9 May 2011 at 17:26 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bryanhirsch commentedThe attached patch fixes the bug and cleans up these few lines of code.
Comment #2
Anonymous (not verified) commentedThanks for the patch :)
Two style issues:
Comment #3
Anonymous (not verified) commentedThe second argument to t() actually was an array already, but was hard to tell because of the length of the arguments in the function call. I went ahead and cleaned it up a little by moving the link to a variable as you had done.
Done in commit http://drupalcode.org/project/sparql_views.git/commit/702686f
Comment #4
scor commentedLin, you've only moved the bug one line up :) When Bryan said "The second argument in the t() function on line 53 should be an array. It's currently a string.", he meant the second call to t().
However, usually the string is kept in one call to t() with the urls as replacements. It helps translators to have more context when doing the translations.
edit: sorry again for extra hunks...
Comment #5
Anonymous (not verified) commentedok, I see. It wasn't as much that the second argument in the call to t() should be an array, it was that the parenthesis was misplaced and that there shouldn't have been a second argument.
You changed the ! to an @... is there a reason? I don't think we need to check_plain a url that is hardcoded, since it is sanitized by the fact that we wrote the path directly in code. The relevant docs:
Comment #6
scor commented@is the placeholder for lazy developers who don't want to think twice whether a string is already sanitized or not (check core, you will see this same pattern very often).!is valid here to for the reason you mention, but the overhead of the extra check_plain with @ is really negligible for something that is run once on a page that's rarely going to be displayed (since the error should be fixed by the site admin). I agree with your remark for the general case though.Edit: so feel free to use either ! or @ :)