<?php
# Waiting for php 5.3 anonymous functions...
if (!function_exists('a'))
{
    function a(array $attribute)
    {
        $all = array();
        
        foreach ($attribute as $k => $v)
        {
            $all[] = $k . '="' . htmlspecialchars($v) . '"';
        }
        
        return ' ' . implode(' ', $all);
    }
}
#
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html<?php if (isset($html)) : echo a($html); endif; ?>>
    <head<?php if (isset($head)) : echo a($head); endif; ?>>
        <?php if (isset($title)) : ?><title><?php echo htmlspecialchars($title); ?></title><?php endif; ?>
        <?php if (isset($base)) : ?><base<?php echo a($base); ?> /><?php endif; ?>
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <?php if (isset($meta)) : foreach ($meta as $m) : ?><meta<?php echo a($m); ?> /><?php endforeach; endif; ?>
        <?php if (isset($link)) : foreach ($link as $l) : ?><link<?php echo a($l); ?> /><?php endforeach; endif; ?>
        <script type="text/javascript" src="core/widget/jquery.js"></script>
        <?php if (isset($script)) : foreach ($script as $s) : ?><script<?php echo a($s); ?>></script><?php endforeach; endif; ?>
        <style type="text/css">
            <?php foreach ($theme['skin']['options'] as $option) : ?>
                <?php if (trim($option['value'])) : ?>
                    <?php echo htmlspecialchars($option['selector']); ?> { <?php echo htmlspecialchars($option['property']); ?>: <?php echo htmlspecialchars($option['value']); ?>; }
                <?php endif; ?>
            <?php endforeach; ?>
        </style>
    </head>
    <body<?php if (isset($body)) : echo a($body); endif; ?>>
        <?php echo $content; ?>
    </body>
</html>
