From 604845883048d8c5a780d0d3df0341a2ac5ba3dc Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Sun, 7 May 2017 15:18:55 -0700 Subject: [PATCH] auto generate content for OwnYourSwarm checkins. #56 --- micropub.php | 8 ++++++++ tests/test_micropub.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/micropub.php b/micropub.php index a52b0de..3190acc 100755 --- a/micropub.php +++ b/micropub.php @@ -549,6 +549,14 @@ public static function generate_post_content( $args ) { $lines[] = $args['post_content']; } + $checkin = $props['checkin'][0]; + if ( $checkin ) { + $name = $checkin['properties']['name'][0]; + $urls = $checkin['properties']['url']; + $lines[] = 'Checked into ' . $name . '.'; + } + // TODO: generate my own markup so i can include u-photo foreach ( array( 'photo', 'video', 'audio' ) as $field ) { if ( isset( $_FILES[ $field ] ) || isset( $props[ $field ] ) ) { diff --git a/tests/test_micropub.php b/tests/test_micropub.php index a323b6b..664b4d3 100644 --- a/tests/test_micropub.php +++ b/tests/test_micropub.php @@ -435,7 +435,6 @@ function test_create_checkin() { Recorder::$input = array( 'type' => array( 'h-entry' ), 'properties' => array( - 'content' => 'I checked in', 'checkin' => array( array( 'type' => array( 'h-card' ), 'properties' => array( @@ -463,6 +462,7 @@ function test_create_checkin() { get_post_meta( $post->ID, 'geo_address', true ) ); $this->assertEquals( '42.361', get_post_meta( $post->ID, 'geo_latitude', true ) ); $this->assertEquals( '-71.092', get_post_meta( $post->ID, 'geo_longitude', true ) ); + $this->assertEquals( 'Checked into A Place.', $post->post_content ); } function check_create_content_html() {