public static function parseAtts($input)
    {
        if (is_object($input) && get_class($input) == 'Xiphe\HTML\core\Tag') {
            $Tag = $input;
            $input = $Tag->attributes;
        }

        /*
         * Check if attributes are already in array form.
         */
        if (is_array($input)) {
            return $input;
        }

        /*
         * If no attributes were passed - return empty array.
         */
        if (empty($input)) {
            return array();
        }

        /*
         * Split the attribute string into separated attributes by |
         */
        $atts = preg_split('/(?<=[^\\\])[|]+/', $input, -1, PREG_SPLIT_NO_EMPTY);

        /*
         * Set the tags attributes to array
         */
        $input = array();

        /*
         * Split the attributes in key an value by =
         */
        foreach ($atts as $k => $attr) {
            $attr = preg_split('/(?<=[^\\\])[=]+/', $attr, 2);

            foreach ($attr as $k => $v) {
                /*
                 * replace escaped pipe and equal glyphs.
                 */
                $attr[$k] = preg_replace('/[\\\]([=|\|])/', '$1', $v);
            }

            /*
             * Has no value or key
             */
            if (count($attr) == 1) {

                /*
                 * A single attribute was passed
                 */
                if (isset($Tag) && count($atts) == 1) {
                    if (($t = self::getKeyAlias($attr)) && !self::_ignoreKeyAlias($t, $Tag) ) {
                        extract($t);
                        $attr[1] = substr($attr[0], strlen($alias));
                        $attr[0] = $key;
                    } else {
                        /*
                         * use the key from TagInfo::$singleAttrkeys
                         */
                        $key = self::getSingleAttrKey($Tag);
                        if (false !== $key) {
                            $attr[1] = $attr[0];
                            $attr[0] = $key;
                        } else {
                            $attr[1] = null;
                        }
                    }
                } elseif (isset($Tag) && ($t = self::getKeyAlias($attr))) {
                    extract($t);
                    $attr[1] = substr($attr[0], strlen($alias));
                    $attr[0] = $key;
                } else {
                    $attr[1] = null;
                }

                if (isset($Tag) && $attr[0] === '%default') {
                    $attr[0] = TagInfo::$singleAttrkeys[$Tag->name];
                }
            }

            /*
             * Write Attribute to tag.
             */
            $input[$attr[0]] = $attr[1];
        }

        return $input;
    }
public static function parseAtts($input)
    {
        if (is_object($input) && get_class($input) == 'Xiphe\HTML\core\Tag') {
            $Tag = $input;
            $input = $Tag->attributes;
        }

        /*
         * Check if attributes are already in array form.
         */
        if (is_array($input)) {
            return $input;
        }

        /*
         * If no attributes were passed - return empty array.
         */
        if (empty($input)) {
            return array();
        }

        /*
         * Split the attribute string into separated attributes by |
         */
        $atts = preg_split('/(?<=[^\\\])[|]+/', $input, -1, PREG_SPLIT_NO_EMPTY);

        /*
         * Set the tags attributes to array
         */
        $input = array();

        /*
         * Split the attributes in key an value by =
         */
        foreach ($atts as $k => $attr) {
            $attr = preg_split('/(?<=[^\\\])[=]+/', $attr, 2);

            foreach ($attr as $k => $v) {
                /*
                 * replace escaped pipe and equal glyphs.
                 */
                $attr[$k] = preg_replace('/[\\\]([=|\|])/', '$1', $v);
            }

            /*
             * Has no value or key
             */
            if (count($attr) == 1) {

                /*
                 * A single attribute was passed
                 */
                if (isset($Tag) && count($atts) == 1) {
                    if (($t = self::getKeyAlias($attr)) && !self::_ignoreKeyAlias($t, $Tag) ) {
                        extract($t);
                        $attr[1] = substr($attr[0], strlen($alias));
                        $attr[0] = $key;
                    } else {
                        /*
                         * use the key from TagInfo::$singleAttrkeys
                         */
                        $key = self::getSingleAttrKey($Tag);
                        if (false !== $key) {
                            $attr[1] = $attr[0];
                            $attr[0] = $key;
                        } else {
                            $attr[1] = null;
                        }
                    }
                } elseif (isset($Tag) && ($t = self::getKeyAlias($attr))) {
                    extract($t);
                    $attr[1] = substr($attr[0], strlen($alias));
                    $attr[0] = $key;
                } else {
                    $attr[1] = null;
                }

                if (isset($Tag) && $attr[0] === '%default') {
                    $attr[0] = TagInfo::$singleAttrkeys[$Tag->name];
                }
            }

            /*
             * Write Attribute to tag.
             */
            $input[$attr[0]] = $attr[1];
        }

        return $input;
    }
public static function parseAtts ( $ input ) { if ( is_object ( $ input ) && get_class ( $ input ) == 'Xiphe\HTML\core\Tag' ) { $ Tag = $ input ; $ input = $ Tag -> attributes ; } /*
         * Check if attributes are already in array form.
         */ if ( is_array ( $ input ) ) { return $ input ; } /*
         * If no attributes were passed - return empty array.
         */ if ( empty ( $ input ) ) { return array ( ) ; } /*
         * Split the attribute string into separated attributes by |
         */ $ atts = preg_split ( '/(?<=[^\\\])[|]+/' , $ input , - 1 , PREG_SPLIT_NO_EMPTY ) ; /*
         * Set the tags attributes to array
         */ $ input = array ( ) ; /*
         * Split the attributes in key an value by =
         */ foreach ( $ atts as $ k => $ attr ) { $ attr = preg_split ( '/(?<=[^\\\])[=]+/' , $ attr , 2 ) ; foreach ( $ attr as $ k => $ v ) { /*
                 * replace escaped pipe and equal glyphs.
                 */ $ attr [ $ k ] = preg_replace ( '/[\\\]([=|\|])/' , '$1' , $ v ) ; } /*
             * Has no value or key
             */ if ( count ( $ attr ) == 1 ) { /*
                 * A single attribute was passed
                 */ if ( isset ( $ Tag ) && count ( $ atts ) == 1 ) { if ( ( $ t = self :: getKeyAlias ( $ attr ) ) && ! self :: _ignoreKeyAlias ( $ t , $ Tag ) ) { extract ( $ t ) ; $ attr [ 1 ] = substr ( $ attr [ 0 ] , strlen ( $ alias ) ) ; $ attr [ 0 ] = $ key ; } else { /*
                         * use the key from TagInfo::$singleAttrkeys
                         */ $ key = self :: getSingleAttrKey ( $ Tag ) ; if ( false !== $ key ) { $ attr [ 1 ] = $ attr [ 0 ] ; $ attr [ 0 ] = $ key ; } else { $ attr [ 1 ] = null ; } } } elseif ( isset ( $ Tag ) && ( $ t = self :: getKeyAlias ( $ attr ) ) ) { extract ( $ t ) ; $ attr [ 1 ] = substr ( $ attr [ 0 ] , strlen ( $ alias ) ) ; $ attr [ 0 ] = $ key ; } else { $ attr [ 1 ] = null ; } if ( isset ( $ Tag ) && $ attr [ 0 ] === '%default' ) { $ attr [ 0 ] = TagInfo :: $ singleAttrkeys [ $ Tag -> name ] ; } } /*
             * Write Attribute to tag.
             */ $ input [ $ attr [ 0 ] ] = $ attr [ 1 ] ; } return $ input ; }
Parser for string formated attribute arrays

Arrays will be returned immediate.
Multiple attributes should be separated by a pipe char "|"
Name and value of the attribute should be separated by an equal sign "="
The signs can be escaped by a backslash (foo\|bar will not be separated)

@param mixed $input the attribute array, string or Tag object

@return void
Parser for string formated attribute arrays