includes/class-mf2-post.php
private function get_mf2meta() {
		$meta = get_post_meta( $this->uid );
		if ( ! $meta ) {
			return array();
		}
		if ( isset( $meta['response'] ) ) {
			$response = maybe_unserialize( $meta['response'] );
			// Retrieve from the old response array and store in new location.
			if ( ! empty( $response ) ) {
				$new = array();
				// Convert to new format and update.
				if ( ! empty( $response['title'] ) ) {
					$new['name'] = $response['title'];
				}
				if ( ! empty( $response['url'] ) ) {
					$new['url'] = $response['url'];
				}
				if ( ! empty( $response['content'] ) ) {
					$new['content'] = $response['content'];
				}
				if ( ! empty( $response['published'] ) ) {
					$new['published'] = $response['published'];
				}
				if ( ! empty( $response['author'] ) ) {
					$new['card']         = array();
					$new['card']['name'] = $response['author'];
					if ( ! empty( $response['icon'] ) ) {
						$new['card']['photo'] = $response['icon'];
					}
				}
				$new         = array_unique( $new );
				$new['card'] = array_unique( $new['card'] );
				if ( isset( $new ) ) {
					update_post_meta( $this->uid, 'mf2_cite', $new );
					delete_post_meta( $this->uid, 'response' );
					$meta['cite'] = $new;
				}
			}
		}
		foreach ( $meta as $key => $value ) {
			if ( ! self::str_prefix( $key, 'mf2_' ) ) {
				unset( $meta[ $key ] );
			} else {
				unset( $meta[ $key ] );
				$key = str_replace( 'mf2_', '', $key );
				// Do not save microput prefixed instructions
				if ( self::str_prefix( $key, 'mp-' ) ) {
					continue;
				}
				$value = array_map( 'maybe_unserialize', $value );
				if ( 1 === count( $value ) ) {
					$value = array_shift( $value );
				}
				if ( is_string( $value ) ) {
					$meta[ $key ] = array( $value );
				} else {
					$meta[ $key ] = $value;
				}
			}
		}
		return array_filter( $meta );
	}
private function get_mf2meta() {
		$meta = get_post_meta( $this->uid );
		if ( ! $meta ) {
			return array();
		}
		if ( isset( $meta['response'] ) ) {
			$response = maybe_unserialize( $meta['response'] );
			// Retrieve from the old response array and store in new location.
			if ( ! empty( $response ) ) {
				$new = array();
				// Convert to new format and update.
				if ( ! empty( $response['title'] ) ) {
					$new['name'] = $response['title'];
				}
				if ( ! empty( $response['url'] ) ) {
					$new['url'] = $response['url'];
				}
				if ( ! empty( $response['content'] ) ) {
					$new['content'] = $response['content'];
				}
				if ( ! empty( $response['published'] ) ) {
					$new['published'] = $response['published'];
				}
				if ( ! empty( $response['author'] ) ) {
					$new['card']         = array();
					$new['card']['name'] = $response['author'];
					if ( ! empty( $response['icon'] ) ) {
						$new['card']['photo'] = $response['icon'];
					}
				}
				$new         = array_unique( $new );
				$new['card'] = array_unique( $new['card'] );
				if ( isset( $new ) ) {
					update_post_meta( $this->uid, 'mf2_cite', $new );
					delete_post_meta( $this->uid, 'response' );
					$meta['cite'] = $new;
				}
			}
		}
		foreach ( $meta as $key => $value ) {
			if ( ! self::str_prefix( $key, 'mf2_' ) ) {
				unset( $meta[ $key ] );
			} else {
				unset( $meta[ $key ] );
				$key = str_replace( 'mf2_', '', $key );
				// Do not save microput prefixed instructions
				if ( self::str_prefix( $key, 'mp-' ) ) {
					continue;
				}
				$value = array_map( 'maybe_unserialize', $value );
				if ( 1 === count( $value ) ) {
					$value = array_shift( $value );
				}
				if ( is_string( $value ) ) {
					$meta[ $key ] = array( $value );
				} else {
					$meta[ $key ] = $value;
				}
			}
		}
		return array_filter( $meta );
	}
private function get_mf2meta ( ) { $ meta = get_post_meta ( $ this -> uid ) ; if ( ! $ meta ) { return array ( ) ; } if ( isset ( $ meta [ 'response' ] ) ) { $ response = maybe_unserialize ( $ meta [ 'response' ] ) ; // Retrieve from the old response array and store in new location. if ( ! empty ( $ response ) ) { $ new = array ( ) ; // Convert to new format and update. if ( ! empty ( $ response [ 'title' ] ) ) { $ new [ 'name' ] = $ response [ 'title' ] ; } if ( ! empty ( $ response [ 'url' ] ) ) { $ new [ 'url' ] = $ response [ 'url' ] ; } if ( ! empty ( $ response [ 'content' ] ) ) { $ new [ 'content' ] = $ response [ 'content' ] ; } if ( ! empty ( $ response [ 'published' ] ) ) { $ new [ 'published' ] = $ response [ 'published' ] ; } if ( ! empty ( $ response [ 'author' ] ) ) { $ new [ 'card' ] = array ( ) ; $ new [ 'card' ] [ 'name' ] = $ response [ 'author' ] ; if ( ! empty ( $ response [ 'icon' ] ) ) { $ new [ 'card' ] [ 'photo' ] = $ response [ 'icon' ] ; } } $ new = array_unique ( $ new ) ; $ new [ 'card' ] = array_unique ( $ new [ 'card' ] ) ; if ( isset ( $ new ) ) { update_post_meta ( $ this -> uid , 'mf2_cite' , $ new ) ; delete_post_meta ( $ this -> uid , 'response' ) ; $ meta [ 'cite' ] = $ new ; } } } foreach ( $ meta as $ key => $ value ) { if ( ! self :: str_prefix ( $ key , 'mf2_' ) ) { unset ( $ meta [ $ key ] ) ; } else { unset ( $ meta [ $ key ] ) ; $ key = str_replace ( 'mf2_' , '' , $ key ) ; // Do not save microput prefixed instructions if ( self :: str_prefix ( $ key , 'mp-' ) ) { continue ; } $ value = array_map ( 'maybe_unserialize' , $ value ) ; if ( 1 === count ( $ value ) ) { $ value = array_shift ( $ value ) ; } if ( is_string ( $ value ) ) { $ meta [ $ key ] = array ( $ value ) ; } else { $ meta [ $ key ] = $ value ; } } } return array_filter ( $ meta ) ; }
Sets an array with only the mf2 prefixed meta.
Sets an array with only the mf2 prefixed meta .