public static function getTemplateColors() { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $colors = array(); $path = ''; $templates = self::getTemplates(); foreach ($templates as $template) { // Template CSS $path = JPATH_SITE . DS . 'templates' . DS . $template . DS . 'css'; // get the first path that exists if (is_dir($path)) { break; } // reset path $path = ''; } if ($path) { $files = JFolder::files($path, '\\.css$', false, true); foreach ($files as $file) { $colors = array_merge($colors, WFToolsHelper::parseColors($file)); } } return implode(",", array_unique($colors)); }
public static function getTemplateColors() { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $colors = array(); $path = ''; $templates = self::getTemplates(); foreach ($templates as $template) { // Template CSS $path = JPATH_SITE . '/templates/' . $template . '/css'; // get the first path that exists if (is_dir($path)) { break; } // reset path $path = ''; } if ($path) { $files = JFolder::files($path, '\\.css$', false, true); foreach ($files as $file) { $colors = array_merge($colors, WFToolsHelper::parseColors($file)); } } // make all colors 6 character hex, eg: #333 to #333333 for ($i = 0; $i < count($colors); $i++) { if ($colors[$i][0] == '#' && strlen($colors[$i]) == 4) { $colors[$i] .= substr($colors[$i], -3); } } // sort $colors = self::sort_hex_colors($colors); return implode(",", array_unique($colors)); }