library/Helper/Html.php
public static function getHtmlAttributes($content)
    {
        $content = self::getHtmlTags($content, false);

        if (!is_array($content) || empty($content)) {
            return;
        }

        $content = implode($content);

        $re = '@(\s+)(\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>]))+.)["\']?@';

        preg_match_all($re, $content, $matches, PREG_SET_ORDER, 0);

        $atts = array();
        if ($matches) {
            foreach ($matches as $match) {
                $atts[$match[2]] = $match[0];
            }

            return $atts;
        }

        return;
    }
public static function getHtmlAttributes($content)
    {
        $content = self::getHtmlTags($content, false);

        if (!is_array($content) || empty($content)) {
            return;
        }

        $content = implode($content);

        $re = '@(\s+)(\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>]))+.)["\']?@';

        preg_match_all($re, $content, $matches, PREG_SET_ORDER, 0);

        $atts = array();
        if ($matches) {
            foreach ($matches as $match) {
                $atts[$match[2]] = $match[0];
            }

            return $atts;
        }

        return;
    }
public static function getHtmlAttributes ( $ content ) { $ content = self :: getHtmlTags ( $ content , false ) ; if ( ! is_array ( $ content ) || empty ( $ content ) ) { return ; } $ content = implode ( $ content ) ; $ re = '@(\s+)(\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>]))+.)["\']?@' ; preg_match_all ( $ re , $ content , $ matches , PREG_SET_ORDER , 0 ) ; $ atts = array ( ) ; if ( $ matches ) { foreach ( $ matches as $ match ) { $ atts [ $ match [ 2 ] ] = $ match [ 0 ] ; } return $ atts ; } return ; }
Get HTML attributes from string
@param string $content String to get HTML attributes from
@return array       Attributes
Get HTML attributes from string