Hello again!

I just wrote a small plugin allowing to change the values of the skinvars 
for some members or on somepages only.
I called it cssprefix, because it works by adding a prefix to the skinvars, 
and I mainly used it to change the colors of some pages without even 
touching the skin file.
I would gladly maintain this plugin, if it is published on the website.

To use it, choose a prefix name (let's say "test"), and write in 
config.settings things like test_sitename: Test website or 
test_text_color:violet in order to change the sitename or the text color on 
pages with test cssprefix enabled.
Then, to use prefix test only on page plugins and its subpages, edit your 
config file and write: if(in_array("plugins",$pageArray)) 
$BOLTconfig['cssPrefix'] = "test";
Or to use prefix test on page plugins only, edit your config file and 
write: if($pageLink == "plugins") $BOLTconfig['cssPrefix'] = "test";
Members can also write on their profile "member" page: 
/*test_background_color: #0000ff*/ if they want to change the background 
color for pages with test cssprefix enabled. But, with this customization 
plugin, members can also write on their profile page: /*background_color: 
dimgray*/

The plugin could probably be edited to disallow personal customization for 
members, or limit it to certain skinvars, like colors but not sitename, and 
I'll probably add that feature later, but you can also not tell your 
members the name of your skinvars, and/or not tell them about this feature; 
they won't think of it by themselves ;-)

The cssprefix.php file contains the following:
<?php if (!defined('BOLTWIRE')) exit();

function myBOLTmakePage($out) {//the only change is the call to 
myBOLTskinSettings instead of BOLTskinSettings; this should be limited to 
the page content generation, since we only want the layout to be 
customizable
    global $pageLink,$BOLTreplaceHTML,$BOLTserverHeaders;
    BOLTstopWatch('Skin creation begun');
    $out = preg_replace('/\<\<([-_a-z0-9\.]+)\>\>/ie', 
"BOLTloadskin('$1')", $out);  // Code zone--like <<css>>
    $out = preg_replace('/\=\=(.*?)\=\=/e', 'BOLTdomarkup("$1", $pageLink, 
"SKIN")', $out);  // Put markup in skin directly--like ==[(function)]==
    BOLTstopWatch('Skin creation complete');
    preg_match_all('/\[\[([-_a-z0-9]+)\]\]/i', $out, $matches);  // 
identify zones
    $BOLTvar['zones'] = strtolower(implode(',', $matches[1]));
    foreach($matches[1] as $zone)     $BOLTvar["zone_$zone"] = 
BOLTgetlink($zone);
    foreach($matches[1] as $zone) {
        BOLTstopWatch("Zone $zone begun");
        $out = str_replace("[[$zone]]", BOLTgetzones($zone), $out);  // Do 
each zone
        BOLTstopWatch("Zone $zone complete");
        }
    $out = preg_replace('/\{([-_a-z0-9:]+)\}/ie', 
"myBOLTskinSettings('$1')", $out);  // Inserts {cssprefix-vars} from 
code.settings or member page
    $out = BOLTescape($out, false);  // Undo escaped content
    $out = preg_replace('/\[messages( [~,-_a-z0-9]+)?\]/ie', 
'BOLTmessageDisplay("$1")', $out);  // Display messages
    if (BOLTconfig('robotBlock') != '') {  // can turn specific pages off 
for robots. Use site*,test.block
        if (BOLTpageCheck(BOLTconfig('robotBlock'))) {
            $BOLTreplaceHTML['find'][] = '</head>';
            $BOLTreplaceHTML['replace'][] = "<meta name='robots' 
content='noindex'>\n</head>";
            }
        }
    if (is_array($BOLTreplaceHTML)) $out = 
str_replace($BOLTreplaceHTML['find'], $BOLTreplaceHTML['replace'], $out);  
// Any custom code replacements
    if (is_array($BOLTserverHeaders)) { foreach($BOLTserverHeaders as $h) 
header($h); } // Add custom headers
    return $out;
    }
    
function myBOLTskinSettings($var, $skin=true) {
    global $BOLTzone,$BOLTconfig,$BOLTid;
    $zone = BOLTinit('SKIN', $BOLTzone);
    if (inlist($var, 'skin,script,shared,field,files,domain')) return 
BOLTvars($var);
    if (!empty($BOLTconfig['cssPrefix'])) {
        $out = 
BOLTvars("member.$BOLTid::".$BOLTconfig['cssPrefix']."_".$var, false);
        if ($out == '') $out = 
BOLTvars("code.settings::".$BOLTconfig['cssPrefix']."_".$var, false);
        }
    if ($out == "default" || $out == '') $out = 
BOLTvars("member.$BOLTid::$var", false);
    if ($out == '') $out = BOLTvars("code.settings::$var", false);
    if ($out != '') return BOLTdomarkup($out, '', $zone); // should reflect 
local zones too?
    return $out;
    }

-- 
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/d/optout.

Reply via email to