? Success

User tests: Successful: Unsuccessful:

avatar okonomiyaki3000
okonomiyaki3000
21 Nov 2014

This is consistent with how author name is show elsewhere so it just make sense.

avatar okonomiyaki3000 okonomiyaki3000 - open - 21 Nov 2014
avatar jissues-bot jissues-bot - change - 21 Nov 2014
Labels Added: ?
avatar okonomiyaki3000
okonomiyaki3000 - comment - 21 Nov 2014

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.

avatar waader
waader - comment - 21 Nov 2014

@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.

avatar brianteeman
brianteeman - comment - 21 Nov 2014

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).

avatar infograf768
infograf768 - comment - 21 Nov 2014

@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.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 21 Nov 2014

Good suggestions. But it's already :beer: time in Tokyo so it'll have to wait till next week.

avatar infograf768
infograf768 - comment - 21 Nov 2014

I would do that TRIM in fact in the model save() method. :)

avatar infograf768
infograf768 - comment - 21 Nov 2014

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.]
avatar waader
waader - comment - 22 Nov 2014

And there is also the "author" field that should be trimmed.

avatar infograf768
infograf768 - comment - 23 Nov 2014

it is included in my code above $data['metadata']['author']

avatar wilsonge
wilsonge - comment - 25 Nov 2014

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'

avatar infograf768
infograf768 - comment - 25 Nov 2014

only one line more indeed to TRIM $author in this PR proposal

avatar okonomiyaki3000
okonomiyaki3000 - comment - 25 Nov 2014

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.

avatar infograf768
infograf768 - comment - 25 Nov 2014

Can you update your PR?

avatar infograf768
infograf768 - comment - 25 Nov 2014

Why use
if (isset($data['metadata']) && isset($data['metadata']['author']))
instead of a straight
if (isset($data['metadata']['author']))

avatar okonomiyaki3000
okonomiyaki3000 - comment - 25 Nov 2014

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.

avatar infograf768 infograf768 - close - 26 Nov 2014
avatar infograf768 infograf768 - reference | - 26 Nov 14
avatar infograf768 infograf768 - merge - 26 Nov 2014
avatar infograf768 infograf768 - close - 26 Nov 2014
avatar infograf768 infograf768 - change - 26 Nov 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-11-26 09:54:55
avatar infograf768
infograf768 - comment - 26 Nov 2014

Note: I guess the TRIM would also be good elsewhere in core (contacts, newsfeeds, categories, etc)

avatar okonomiyaki3000 okonomiyaki3000 - head_ref_deleted - 27 Nov 2014
avatar hungctk33
hungctk33 - comment - 6 Mar 2015

Up

Add a Comment

Login with GitHub to post a comment