Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class PHP2CSS {
- private static $stylesheet = [];
- private static $setContenttype = false;
- public static function contentType($contentType) {
- self::$setContenttype = true;
- }
- public static function addStyle($keyname, array $array) {
- self::$stylesheet[] = [
- 'name' => $keyname,
- 'styles' => $array
- ];
- }
- public static function generateStylesheet() {
- if(self::$setContenttype) {
- header('Content-type: '.self::$setContenttype);
- }
- $nStyle = null;
- foreach(self::$stylesheet as $style) {
- $nStyle .= $style['name'].' {'."\n";
- foreach($style['styles'] as $keyword => $value) {
- $nStyle .= "\t".$keyword.': '.$value.";\n";
- }
- $nStyle .= '}'."\n\n";
- }
- echo $nStyle;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement