icon_list = $tree; } /** * Sets the sizes of various icon sets. * * @param mixed[] $sizes Icon set size data. */ public function set_icon_sizes($sizes) { $this->icon_sizes = $sizes; } /** * Returns generated SCSS code. * * @return string SCSS code. */ public function get_scss() { if (empty($this->scss)) { $this->generate_scss(); } return $this->scss; } /** * Generates SCSS code corresponding to our Pokémon icons. */ public function generate_scss() { $var_base_name = Settings::get('var_base_name'); // Generate the variables. ob_start(); ?> $-types: ( icon_sizes as $var => $size) { // Check whether this icon type has variable sizes or not. if (isset($size['w']) && isset($size['h'])) { ?> : ( w: , h: , ), : (), ); $-coords: ( icon_list as $pos) { // If this icon is a duplicate, // refer to the original icon's coordinates. if (isset($pos['original'])) { $x = $pos['original']['fit']['x']; $y = $pos['original']['fit']['y']; } else { $x = $pos['fit']['x']; $y = $pos['fit']['y']; } // We'll add the width and height variables to each item // for completeness purposes, even though in practice the // size will be dictated by the item type. // (Except in the case of icon collections containing // images of multiple sizes.) $attrs = array( 'x' => intval($x), 'y' => intval($y), 'w' => intval($pos['w']), 'h' => intval($pos['h']), ); $attr_list = array(); foreach ($attrs as $k => $v) { $attr_list[] = $k.': '.$v; } ?> : (), ); icon_sizes as $var => $size) { ?> &[class*='-'] { @include -type(''); } decorate_tpl_with_defaults($this->tpl, array( 'item_vars' => $item_vars, 'type_sizes' => $this->indent_lines($type_sizes, 2), 'var_base_name' => $var_base_name, 'img_output' => Settings::get('img_output'), )); $this->scss = $this->process_output($scss); } }