Skip to content

Commit

Permalink
auto generate content for OwnYourSwarm checkins. #56
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed May 7, 2017
1 parent 3e71e6b commit 6048458
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions micropub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a class="h-card p-location" href="' .
($urls[1] ?: $urls[0]) . '">' . $name . '</a>.';
}

// 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 ] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_micropub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 class="h-card p-location" href="http:/a/place">A Place</a>.', $post->post_content );
}

function check_create_content_html() {
Expand Down

0 comments on commit 6048458

Please sign in to comment.