← Back to team overview

mahara-contributors team mailing list archive

[Bug 1213994] Re: Additional HTML is useless if it passes through clean_html()

 

To clarify, the way I see it there are two main ways we could do an
interface for this:

1. Files under /local: The admin creates a file like
/local/additionalhtml/head.html; The code looks for the presence of this
file, and if it's there, we insert it into the appropriate point in the
header template. Likewise for the other three additional HTML locations.

Downside: It's somewhat obscure. Currently the /local directory is
poorly documented. But we could address that somewhat by including with
core some "dist" files much like we do for config.php:
/local/additionalhtml/head.html.dist or something. Also putting a proper
README in /local

2. $cfg settings in config-defaults.php : It's true that these snippets
can get arbitrarily large. On the other hand, an admin could use PHP
"heredoc" syntax to input a big block of HTML with no problems

$cfg->headhtml = <<<HTML
<script ... etc ... snippet goes here
HTML;

Or, because the config.php file is in fact a PHP file, the admin could
put code there that reads the contents of an external file, and stores
that as the $cfg value.

Downside: Your config.php file could get quite large. And it could look
a little ugly to have this big block of HTML in there. (Come to think of
it, I think some of the deployment scripts we use here at Catalyst might
have difficulty with a multi-line $cfg value that contains double-quotes
and apostrophes...). It also adds another option to config-defaults.php,
which is getting rather lengthy.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contrib members
https://bugs.launchpad.net/bugs/1213994

Title:
  Additional HTML is useless if it passes through clean_html()

Status in Mahara ePortfolio:
  Confirmed

Bug description:
  See parent bug: https://bugs.launchpad.net/mahara/+bug/1073625

  I have got an email request explaining the problem:

  "...But the problem is when I add a sample reference to Additional
  HTML (Within HEAD), e.g.

  <link href="some.css" type="text/css" rel="stylesheet">
  it doesn't show inside HEAD element at all. Do you have an idea what to do  to make it show inside HEAD element?"

  It seems that clean_html parsing applied to Additional HTML removes
  type of content similar to above. And actually make the Additional
  HTML feature useless, as it seems ignore everything apart of very
  simple html.  I suggest not to do clean_html for this kind of output.
  The reason is the feature is used by site admins only and simply makes
  easier to add extra content without modifying the theme code. I think
  site admin should take all responsibility for the content as it is the
  same as adding it directly to theme code itself. BTW, similar feature
  in Moodle does not apply clean html parsing to output as well.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1213994/+subscriptions


References