File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 32
32
->description ('<div>Blog body</div> ' )
33
33
->contentEncoded ('<div>Blog body</div> ' )
34
34
->url ('http://blog.example.com/2012/08/21/blog-entry/ ' )
35
- ->author ('John Smith ' )
35
+
36
+ ->creator ('John Smith ' )
36
37
->pubDate (strtotime ('Tue, 21 Aug 2012 19:50:37 +0900 ' ))
37
38
->guid ('http://blog.example.com/2012/08/21/blog-entry/ ' , true )
38
39
->preferCdata (true ) // By this, title and description become CDATA wrapped HTML.
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ class Item implements ItemInterface
38
38
/** @var string */
39
39
protected $ author ;
40
40
41
+ /** @var string */
42
+ protected $ creator ;
43
+
41
44
protected $ preferCdata = false ;
42
45
43
46
public function title ($ title )
@@ -95,6 +98,12 @@ public function author($author)
95
98
return $ this ;
96
99
}
97
100
101
+ public function creator ($ creator )
102
+ {
103
+ $ this ->creator = $ creator ;
104
+ return $ this ;
105
+ }
106
+
98
107
public function preferCdata ($ preferCdata )
99
108
{
100
109
$ this ->preferCdata = (bool )$ preferCdata ;
@@ -163,6 +172,10 @@ public function asXML()
163
172
$ xml ->addChild ('author ' , $ this ->author );
164
173
}
165
174
175
+ if (!empty ($ this ->creator )) {
176
+ $ xml ->addChild ('dc:creator ' , $ this ->creator ,"http://purl.org/dc/elements/1.1/ " );
177
+ }
178
+
166
179
return $ xml ;
167
180
}
168
181
}
You can’t perform that action at this time.
0 commit comments