Skip to content

Commit cf9ac74

Browse files
committed
added filters to extend the mf/jf data
see #3
1 parent bf4163b commit cf9ac74

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

includes/class-mf2-feed-entry.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Based on the work of @dshankse: https://github.com/dshanske/indieweb-post-kinds/blob/master/includes/class-mf2-post.php
88
*/
99
class Mf2_Feed_Entry {
10+
public $_id;
1011
public $type;
1112
public $name;
1213
public $url;
@@ -25,6 +26,7 @@ public function __construct( $post, $with_comments = false ) {
2526
return false;
2627
}
2728

29+
$this->_id = $post->ID;
2830
$this->type = 'entry';
2931
$this->name = $post->post_name;
3032
$this->published = mysql2date( DATE_W3C, $post->post_date );
@@ -112,14 +114,14 @@ private function get_excerpt_by_id( $post_id = 0, $more_link_text = null, $strip
112114
}
113115

114116
public function to_mf2() {
115-
$entry = get_object_vars( $this );
116-
$entry = $this->jf2_to_mf2( $entry );
117+
$entry = apply_filters( 'jf2_entry_array', get_object_vars( $this ), $this->_id );
118+
$entry = apply_filters( 'mf2_entry_array', $this->jf2_to_mf2( $entry ), $this->_id );
117119

118120
return array_filter( $entry );
119121
}
120122

121123
public function to_jf2() {
122-
$entry = get_object_vars( $this );
124+
$entry = apply_filters( 'jf2_entry_array', get_object_vars( $this ), $this->_id );
123125

124126
return array_filter( $entry );
125127
}

0 commit comments

Comments
 (0)