I think that "most" of the css options would be for colors, right?
After all, are you going to let a user go in and trash a layout and end up with a myspace nightmare?
That being the case...
- Initially read in the original css file (first time).
- Replace any colors with text boxes, just for the color name.
- User adds new color combination.
- On post, each posted field is ran against a regex ([0-9A-F]).
If this fails, it's kicked back. (strtoupper on the post data)
- Write the new css file, set a blog option to true.
- Now this editor page will load the modified css file, with an option to
turn it off, or "restore to default".
It's basic in theory, but are they changing anything other than colors? I wouldn't think they would. And "most" users would need a color box to pick from.
Now, what you "could" do, is set up a "special" file (that mirrors) the current css file, but it puts a % around any color options.
This way, the editor page knows where to add the text boxes.
In turn, it would save 2 copies of the file to the users directory.
A new style.css file (or blogname.css), and a style.css.info file.
The difference would be the .info file would have the % around the color options, and the style.css file written would (obviously) not have those.
It would be a slight pain in the ass to initially implement, but once it was in place it would work out pretty well.
Then when a blog loads, the header uses a function to make the css declaration, where the original css tag is now.
Original Example:
<style type="text/css" media="screen">
@import "http://example.com/wp-content/themes/mytheme/style.css"
</style>
New example:
<style type="text/css" media="screen">
@import "<?php get_my_css(); ?>"
</style>
Function:
<?php
function get_my_css() {
if ( get_option('premium_custom_css') ) {
$css_link = get_bloginfo('home') . '/files/mytheme/style.css';
} else {
$css_link = get_stylesheet_directory() . '/style.css';
}
echo $css_link;
}
?>
To be honest, this really wouldn't be too difficult at all.
The "worst" parts would be:
- Adding in the little color box (which isn't bad) for each
textbox, so that it updates the color in that field.
- Initially making duplicate css files to be read from initially.
The actual coding of it is pretty simplistic, really.
No need for kses, or anything like that.
Combine this with a custom header image option, that fully works of course, and it's all good.