/** * Renders the CSS from a collection of Template objects. * * @param array $templates Array of XenForo_Template_Abstract objects * @param boolean $withDebug If true, output debug CSS when invalid properties are accessed * * @return string */ public static function renderCssFromObjects(array $templates, $withDebug = false) { $errors = array(); $output = '@charset "UTF-8";' . "\n"; ob_start(); foreach ($templates as $templateName => $template) { if ($withDebug) { XenForo_Template_Helper_Core::resetInvalidStylePropertyAccessList(); } $rendered = $template->render(); if ($rendered !== '') { $output .= "\n/* --- " . str_replace('*/', '', $templateName) . " --- */\n\n{$rendered}\n"; } if ($withDebug) { $propertyError = self::createDebugErrorString(XenForo_Template_Helper_Core::getInvalidStylePropertyAccessList()); if ($propertyError) { $errors["{$templateName}"] = $propertyError; } } } $phpErrors = ob_get_clean(); if ($phpErrors) { $errors["PHP"] = $phpErrors; } if ($withDebug && $errors) { $output .= self::getDebugErrorsAsCss($errors); } return $output; }