Hi Dan - I did some coding  and testing and come up with this proposal:

to add a $BOLTpluginStyles array for style insertion. It is an extra
line of code in function BOLTmakepage():
Something like this:

add $BOLTpluginStyles to global
replace
       if (is_array($BOLTpluginHeader)) $out = str_replace ('</head>',
implode($BOLTpluginHeader, "\n") . "\n</head>", $out);
with
        $BOLTpluginHeader['boltstyles'] = "<style
type='text/css'><!--\n".implode("\n",
(array)$BOLTpluginStyles)."\n--></style>";
        $out = str_replace ('</head>', implode($BOLTpluginHeader, "\n") .
"\n</head>", $out);

then plugins and scripts can use
       $BOLTpluginStyles['mystyles'] = "some css styles here...";
and we get rid of the need to add <style>  ..</style> tags and get a
neater HTML output as well.

For example you can see the dramatic effect on code in ShowHide plugin:

with using new $BOLTpluginStyles:

        //add initial css display style to HTML head
        $BOLTpluginStyles['showhide'] = "@media print {.toggle{display:none}}";
        $BOLTpluginStyles[] = "#$id {display:$style}";
        if ($tog=='show' && $args['printhidden']==1)
                $BOLTpluginStyles[] = "@media print { #$id {display:block}}";
   if ($tog=='hide' && $args['id2']) {
      if ($args['printhidden']==1)
        $BOLTpluginStyles[] = "@media print { #{$args['id2']} {display:none} }";
      else $BOLTpluginStyles[] = "#{$args['id2']} {display:none}";
        }

with using $BOLTpluginHeader

        //add initial css display style to HTML head
        if (!isset($BOLTpluginHeader['showhide']))
$BOLTpluginHeader['showhide'] = "<style type='text/css'><!-...@media
print {.toggle{display:none}}\n#$id {display:$style}\n--></style>";
        else $BOLTpluginHeader['showhide'] = str_replace ("\n--></style>",
"\n#$id {display:$style}\n--></style>",
$BOLTpluginHeader['showhide']);
        if ($tog=='show' && $args['printhidden']==1)
                $BOLTpluginHeader['showhide'] = str_replace ("\n--></style>",
"\...@media print { #$id {display:block}}\n--></style>",
$BOLTpluginHeader['showhide']);
   if($tog=='hide' && $args['id2']) {
      if ($args['printhidden']==1)
        $BOLTpluginHeader['showhide'] = str_replace ("\n--></style>",
"\...@media print { #{$args['id2']} {display:none} }\n--></style>",
$BOLTpluginHeader['showhide']);
      else
        $BOLTpluginHeader['showhide'] = str_replace ("\n--></style>",
"\n#{$args['id2']} {display:none}\n--></style>",
$BOLTpluginHeader['showhide']);
        }

About halfed the code, and made it much easier to read.

What you think?

Cheers,
~Hans

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to