/** * Optimises values * @access public * @version 1.0 */ function value() { $shorthands =& $this->meta_css['shorthands']; // optimise shorthand properties if (isset($shorthands[$this->property])) { $temp = csstidy_optimise::shorthand($this->value); // FIXME - move if ($temp != $this->value) { $this->log('Optimised shorthand notation (' . $this->property . '): Changed "' . $this->value . '" to "' . $temp . '"', 'Information'); } $this->value = $temp; } // Remove whitespace at ! important if ($this->value != $this->compress_important($this->value)) { $this->log('Optimised !important', 'Information'); } }
/** * Merges Shorthand properties again, the opposite of dissolve_4value_shorthands() * @param array $array * @return array * @version 1.2 * @see dissolve_4value_shorthands() */ function merge_4value_shorthands($array) { $return = $array; $shorthands =& $GLOBALS['csstidy']['shorthands']; foreach ($shorthands as $key => $value) { if (isset($array[$value[0]]) && isset($array[$value[1]]) && isset($array[$value[2]]) && isset($array[$value[3]]) && $value !== 0) { $return[$key] = ''; $important = ''; for ($i = 0; $i < 4; $i++) { $val = $array[$value[$i]]; if ($this->parser->is_important($val)) { $important = '!important'; $return[$key] .= $this->parser->gvw_important($val) . ' '; } else { $return[$key] .= $val . ' '; } unset($return[$value[$i]]); } $return[$key] = csstidy_optimise::shorthand(trim($return[$key] . $important)); } } return $return; }
/** * Merges Shorthand properties again, the opposite of dissolve_4value_shorthands() * @param array $array * @return array * @version 1.2 * @see dissolve_4value_shorthands() */ function merge_4value_shorthands($array) { $return = $array; $shorthands =& $this->meta_css['shorthands']; foreach ($shorthands as $key => $value) { //print_r($value); NOTICE if (isset($array[$value[0]]) && isset($array[$value[1]]) && isset($array[$value[2]]) && isset($array[$value[3]]) && $value !== 0) { $return[$key] = ''; $important = ''; for ($i = 0; $i < 4; $i++) { $val = $array[$value[$i]]; if (csstidy::is_important($val)) { $important = '!important'; $return[$key] .= csstidy::gvw_important($val) . ' '; } else { $return[$key] .= $val . ' '; } unset($return[$value[$i]]); } $return[$key] = csstidy_optimise::shorthand(trim($return[$key] . $important)); } } return $return; }