AMP_Style_Sanitizer::process_style PHP Method

process_style() private method

private process_style ( $string )
    private function process_style($string)
    {
        // Filter properties
        $string = safecss_filter_attr(esc_html($string));
        if (!$string) {
            return array();
        }
        // Normalize order
        $styles = array_map('trim', explode(';', $string));
        sort($styles);
        $processed_styles = array();
        // Normalize whitespace and filter rules
        foreach ($styles as $index => $rule) {
            $arr2 = array_map('trim', explode(':', $rule, 2));
            if (2 !== count($arr2)) {
                continue;
            }
            list($property, $value) = $this->filter_style($arr2[0], $arr2[1]);
            if (empty($property) || empty($value)) {
                continue;
            }
            $processed_styles[$index] = $property . ':' . $value;
        }
        return $processed_styles;
    }