protected function captureAttributes(Tag $tag, $elName, $str)
	{
		preg_match_all(
			'/[a-z][-a-z0-9]*(?>\\s*=\\s*(?>"[^"]*"|\'[^\']*\'|[^\\s"\'=<>`]+))?/i',
			$str,
			$attrMatches
		);

		foreach ($attrMatches[0] as $attrMatch)
		{
			$pos = strpos($attrMatch, '=');

			/**
			* If there's no equal sign, it's a boolean attribute and we generate a value equal
			* to the attribute's name, lowercased
			*
			* @link http://www.w3.org/html/wg/drafts/html/master/single-page.html#boolean-attributes
			*/
			if ($pos === false)
			{
				$pos = strlen($attrMatch);
				$attrMatch .= '=' . strtolower($attrMatch);
			}

			// Normalize the attribute name, remove the whitespace around its value to account
			// for cases like <b title = "foo"/>
			$attrName  = strtolower(trim(substr($attrMatch, 0, $pos)));
			$attrValue = trim(substr($attrMatch, 1 + $pos));

			// Use the attribute's alias if applicable
			if (isset($this->config['aliases'][$elName][$attrName]))
			{
				$attrName = $this->config['aliases'][$elName][$attrName];
			}

			// Remove quotes around the value
			if ($attrValue[0] === '"' || $attrValue[0] === "'")
			{
				$attrValue = substr($attrValue, 1, -1);
			}

			$tag->setAttribute($attrName, html_entity_decode($attrValue, ENT_QUOTES, 'UTF-8'));
		}
	}
protected function captureAttributes(Tag $tag, $elName, $str)
	{
		preg_match_all(
			'/[a-z][-a-z0-9]*(?>\\s*=\\s*(?>"[^"]*"|\'[^\']*\'|[^\\s"\'=<>`]+))?/i',
			$str,
			$attrMatches
		);

		foreach ($attrMatches[0] as $attrMatch)
		{
			$pos = strpos($attrMatch, '=');

			/**
			* If there's no equal sign, it's a boolean attribute and we generate a value equal
			* to the attribute's name, lowercased
			*
			* @link http://www.w3.org/html/wg/drafts/html/master/single-page.html#boolean-attributes
			*/
			if ($pos === false)
			{
				$pos = strlen($attrMatch);
				$attrMatch .= '=' . strtolower($attrMatch);
			}

			// Normalize the attribute name, remove the whitespace around its value to account
			// for cases like <b title = "foo"/>
			$attrName  = strtolower(trim(substr($attrMatch, 0, $pos)));
			$attrValue = trim(substr($attrMatch, 1 + $pos));

			// Use the attribute's alias if applicable
			if (isset($this->config['aliases'][$elName][$attrName]))
			{
				$attrName = $this->config['aliases'][$elName][$attrName];
			}

			// Remove quotes around the value
			if ($attrValue[0] === '"' || $attrValue[0] === "'")
			{
				$attrValue = substr($attrValue, 1, -1);
			}

			$tag->setAttribute($attrName, html_entity_decode($attrValue, ENT_QUOTES, 'UTF-8'));
		}
	}
protected function captureAttributes ( Tag $ tag , $ elName , $ str ) { preg_match_all ( '/[a-z][-a-z0-9]*(?>\\s*=\\s*(?>"[^"]*"|\'[^\']*\'|[^\\s"\'=<>`]+))?/i' , $ str , $ attrMatches ) ; foreach ( $ attrMatches [ 0 ] as $ attrMatch ) { $ pos = strpos ( $ attrMatch , '=' ) ; /**
			* If there's no equal sign, it's a boolean attribute and we generate a value equal
			* to the attribute's name, lowercased
			*
			* @link http://www.w3.org/html/wg/drafts/html/master/single-page.html#boolean-attributes
			*/ if ( $ pos === false ) { $ pos = strlen ( $ attrMatch ) ; $ attrMatch .= '=' . strtolower ( $ attrMatch ) ; } // Normalize the attribute name, remove the whitespace around its value to account // for cases like <b title = "foo"/> $ attrName = strtolower ( trim ( substr ( $ attrMatch , 0 , $ pos ) ) ) ; $ attrValue = trim ( substr ( $ attrMatch , 1 + $ pos ) ) ; // Use the attribute's alias if applicable if ( isset ( $ this -> config [ 'aliases' ] [ $ elName ] [ $ attrName ] ) ) { $ attrName = $ this -> config [ 'aliases' ] [ $ elName ] [ $ attrName ] ; } // Remove quotes around the value if ( $ attrValue [ 0 ] === '"' || $ attrValue [ 0 ] === "'" ) { $ attrValue = substr ( $ attrValue , 1 , - 1 ) ; } $ tag -> setAttribute ( $ attrName , html_entity_decode ( $ attrValue , ENT_QUOTES , 'UTF-8' ) ) ; } }
Capture all attributes in given string

@param  Tag    $tag    Target tag
@param  string $elName Name of the HTML element
@param  string $str    String containing the attribute declarations
@return void
Capture all attributes in given string