src/Alg/HtmlMetaTagReader.php
public static function getMetaTags( $string, $transformKeys = 0 )
	{
		$metaTags	= array();
		preg_match_all( "@<meta.*/?>@", $string, $tags );
		if( !$tags )
			return array();
		foreach( $tags[0] as $tag )
		{
			$attributes	= Alg_SgmlTagReader::getAttributes( $tag, self::TRANSFORM_LOWERCASE );	//  read HTML Tag Attributes
			if( !isset( $attributes['content'] ) )
				continue;
			if( isset( $attributes['content'] ) && isset( $attributes['name'] ) )
				$key	= $attributes['name'];
			if( isset( $attributes['content'] ) && isset( $attributes['http-equiv'] ) )
				$key	= $attributes['http-equiv'];
			if( $transformKeys == self::TRANSFORM_LOWERCASE )
				$key	= strtolower( $key );
			else if( $transformKeys == self::TRANSFORM_UPPERCASE )
				$key	= strtoupper( $key );
			$metaTags[$key]	= $attributes['content'];
		}
		return $metaTags;
	}
public static function getMetaTags( $string, $transformKeys = 0 )
	{
		$metaTags	= array();
		preg_match_all( "@<meta.*/?>@", $string, $tags );
		if( !$tags )
			return array();
		foreach( $tags[0] as $tag )
		{
			$attributes	= Alg_SgmlTagReader::getAttributes( $tag, self::TRANSFORM_LOWERCASE );	//  read HTML Tag Attributes
			if( !isset( $attributes['content'] ) )
				continue;
			if( isset( $attributes['content'] ) && isset( $attributes['name'] ) )
				$key	= $attributes['name'];
			if( isset( $attributes['content'] ) && isset( $attributes['http-equiv'] ) )
				$key	= $attributes['http-equiv'];
			if( $transformKeys == self::TRANSFORM_LOWERCASE )
				$key	= strtolower( $key );
			else if( $transformKeys == self::TRANSFORM_UPPERCASE )
				$key	= strtoupper( $key );
			$metaTags[$key]	= $attributes['content'];
		}
		return $metaTags;
	}
public static function getMetaTags ( $ string , $ transformKeys = 0 ) { $ metaTags = array ( ) ; preg_match_all ( "@<meta.*/?>@" , $ string , $ tags ) ; if ( ! $ tags ) return array ( ) ; foreach ( $ tags [ 0 ] as $ tag ) { $ attributes = Alg_SgmlTagReader :: getAttributes ( $ tag , self :: TRANSFORM_LOWERCASE ) ; //  read HTML Tag Attributes if ( ! isset ( $ attributes [ 'content' ] ) ) continue ; if ( isset ( $ attributes [ 'content' ] ) && isset ( $ attributes [ 'name' ] ) ) $ key = $ attributes [ 'name' ] ; if ( isset ( $ attributes [ 'content' ] ) && isset ( $ attributes [ 'http-equiv' ] ) ) $ key = $ attributes [ 'http-equiv' ] ; if ( $ transformKeys == self :: TRANSFORM_LOWERCASE ) $ key = strtolower ( $ key ) ; else if ( $ transformKeys == self :: TRANSFORM_UPPERCASE ) $ key = strtoupper ( $ key ) ; $ metaTags [ $ key ] = $ attributes [ 'content' ] ; } return $ metaTags ; }
Returns Array of Meta Tags from a HTML Page String.
@access		public
@static
@param		string		$string			HTML Page String
@param		int			$transformKeys	Flag: transform Attribute Keys
@return		array
Returns Array of Meta Tags from a HTML Page String .