User tests: Successful: Unsuccessful:
This is consistent with how author name is show elsewhere so it just make sense.
Labels |
Added:
?
|
Isn't that true for all uses of the alias field?
On 21 Nov 2014 09:52, "waader" notifications@github.com wrote:
@test https://github.com/test successful
Remark: When I put only a space character in the alias field, the space
character get´s display. Ideally the alias field should be trimmed.—
Reply to this email directly or view it on GitHub
#5155 (comment).
@test
patch works OK.
Aliases are generally trimmed, Brian, although not as much as I would like, i.e. using the new 'TRIM' function which takes care of asian multibyte space as well as non-breaking spaces as in
$data['title'] = JFilterInput::getInstance()->clean($data['title'], 'TRIM');
But Created by Alias as well as meta Author are not trimmed indeed.
Good suggestions. But it's already time in Tokyo so it'll have to wait till next week.
I would do that TRIM in fact in the model save() method. :)
Something like:
public function save($data)
{
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
if (isset($data['metadata']['author']))
{
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
}
if (isset($data['created_by_alias']))
{
$data['created_by_alias'] = $filter->clean($data['created_by_alias'], 'TRIM');
}
if (isset($data['images']) && is_array($data['images']))
[etc.]
And there is also the "author" field that should be trimmed.
it is included in my code above $data['metadata']['author']
Problem with doing it in the save function is that whilst technically correct it wouldn't affect anything which has already been saved. So may be better doing it in both places. Technically correct place as well as the 'quick fix'
only one line more indeed to TRIM $author in this PR proposal
I think it's fine to do it on save only and not care about older cases that might have been saved with a space in this field. That space is not really doing any harm.
Can you update your PR?
Why use
if (isset($data['metadata']) && isset($data['metadata']['author']))
instead of a straight
if (isset($data['metadata']['author']))
I'm pretty sure php complains if you check for the 'author' key on a nonexistent array. I know this would never happen in practice but it's my habit to check like that.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-11-26 09:54:55 |
Note: I guess the TRIM would also be good elsewhere in core (contacts, newsfeeds, categories, etc)
Up
Testing
1) Create an article. Fill in the
Created by alias
field with some alternative name.2) Look at the HTML source for the article page on the site. Find the
author
meta tag somewhere in the head.Before
The meta tag value will be the actual creator's name, not the alias.
After
It will be the alias.