includes/class-parse-this-mf2.php
public static function normalize_feed( $input ) {
		$hcard = array();
		foreach ( $input['items'] as $key => $item ) {
			if ( self::is_type( $item, 'h-card' ) ) {
				$hcard = $item;
				unset( $input['items'][ $key ] );
				break;
			}
		}
		if ( 1 === count( $input['items'] ) ) {
			if ( self::has_prop( $input['items'][0], 'author' ) ) {
				$input['items'][0]['properties']['author'] = array( $hcard );
			}
			return $input;
		}
		return array(
			'items' => array(
				array(
					'type'       => array( 'h-feed' ),
					'properties' => array(
						'author' => array( $hcard ),
					),
					'children'   => $input['items'],
				),
			),
		);
	}
public static function normalize_feed( $input ) {
		$hcard = array();
		foreach ( $input['items'] as $key => $item ) {
			if ( self::is_type( $item, 'h-card' ) ) {
				$hcard = $item;
				unset( $input['items'][ $key ] );
				break;
			}
		}
		if ( 1 === count( $input['items'] ) ) {
			if ( self::has_prop( $input['items'][0], 'author' ) ) {
				$input['items'][0]['properties']['author'] = array( $hcard );
			}
			return $input;
		}
		return array(
			'items' => array(
				array(
					'type'       => array( 'h-feed' ),
					'properties' => array(
						'author' => array( $hcard ),
					),
					'children'   => $input['items'],
				),
			),
		);
	}
public static function normalize_feed ( $ input ) { $ hcard = array ( ) ; foreach ( $ input [ 'items' ] as $ key => $ item ) { if ( self :: is_type ( $ item , 'h-card' ) ) { $ hcard = $ item ; unset ( $ input [ 'items' ] [ $ key ] ) ; break ; } } if ( 1 === count ( $ input [ 'items' ] ) ) { if ( self :: has_prop ( $ input [ 'items' ] [ 0 ] , 'author' ) ) { $ input [ 'items' ] [ 0 ] [ 'properties' ] [ 'author' ] = array ( $ hcard ) ; } return $ input ; } return array ( 'items' => array ( array ( 'type' => array ( 'h-feed' ) , 'properties' => array ( 'author' => array ( $ hcard ) , ) , 'children' => $ input [ 'items' ] , ) , ) , ) ; }
Tries to normalize a set of items into a feed
Tries to normalize a set of items into a feed