Can anyone help me sort why single and double quotes are getting stripped out when, for example, Content: Title is used for the file's display name? It seems to be an issue with the views field formatter since the standard unformatted list, table, etc. formatters display the titles properly.

Comments

sondes’s picture

Here's a screenshot to clarify.

sondes’s picture

Status: Active » Needs review

I ended up going with a really simple solution to render HTML characters properly.

On line 116 of jplayer_style_plugin.inc I added:

$label = htmlspecialchars_decode($label, ENT_QUOTES);

The playlist seems to be working just as it was. Is this something that someone could add to .dev?

dawehner’s picture

The problem here is that views already escapes it's values, so the additional check plain might causes problems.

One possible solution could be to let code which provides the label take care about the escaping, so maybe let jplayer_sort_files() escape all
item labels unless the ones coming from an external source and then drop the check_plain() out of the template?

ghosts’s picture

This is not the most elegant way to fix it, but in the file jplayer_style_plugin.inc I added the following at line 120:

        /**** restore apostrophe ****/
        $label = str_replace(''', '\'', $label);

It works. Of course, only for apostrophes (which is all I wanted) but you could tinker with it.

Since I didn't include a patch, here is the surrounding code so that you can navigate yourself:

        $label = trim(strip_tags($this->row_plugin->render($row)));
        if (empty($label)) {
          $label = basename($filepath);
        }
		
        /**** restore apostrophe ****/
        $label = str_replace(''', '\'', $label);
     
        
        $items[] = array(
          'url' => file_create_url($filepath),
          'label' => $label,
        );
xamanu’s picture

Here is a patch. I just decode htmlspecialchars in the jplayer_sort_files() function, works for me and should be fine.

jerry’s picture

The patch above is working for me, though I needed to specify ENT_QUOTES rather than the default ENT_COMPAT to htmlspecialchars_decode().