File tree Expand file tree Collapse file tree 1 file changed +22
-7
lines changed Expand file tree Collapse file tree 1 file changed +22
-7
lines changed Original file line number Diff line number Diff line change 15
15
$ posts = '' ;
16
16
if (isset ($ feed ['entry ' ]) && is_array ($ feed ['entry ' ])) {
17
17
foreach ($ feed ['entry ' ] as $ post ) {
18
- $ date = date ('d/m/Y ' , strtotime ($ post ['updated ' ] ?? '' ));
19
- $ title = $ post ['title ' ] ?? 'Untitled ' ;
20
-
21
- // Handle link as array or string
22
- $ link = is_array ($ post ['link ' ]) ? ($ post ['link ' ]['@attributes ' ]['href ' ] ?? '# ' ) : ($ post ['link ' ] ?? '# ' );
18
+ // Format the date
19
+ $ date = isset ($ post ['updated ' ]) ? date ('d/m/Y ' , strtotime ($ post ['updated ' ])) : 'Unknown Date ' ;
23
20
24
- // Ensure description is a string
25
- $ description = isset ($ post ['summary ' ]) ? (is_string ($ post ['summary ' ]) ? strip_tags ($ post ['summary ' ]) : strip_tags ($ post ['summary ' ][0 ])) : '' ;
21
+ // Ensure title is available
22
+ $ title = $ post ['title ' ] ?? 'Untitled ' ;
23
+
24
+ // Extract the link URL
25
+ if (isset ($ post ['link ' ])) {
26
+ if (is_array ($ post ['link ' ])) {
27
+ $ link = $ post ['link ' ]['@attributes ' ]['href ' ] ?? '# ' ;
28
+ } else {
29
+ $ link = $ post ['link ' ];
30
+ }
31
+ } else {
32
+ $ link = '# ' ;
33
+ }
34
+
35
+ // Extract the description or summary
36
+ $ description = '' ;
37
+ if (isset ($ post ['summary ' ])) {
38
+ $ description = is_string ($ post ['summary ' ]) ? strip_tags ($ post ['summary ' ]) : (isset ($ post ['summary ' ][0 ]) ? strip_tags ($ post ['summary ' ][0 ]) : '' );
39
+ }
26
40
41
+ // Format each post entry
27
42
$ posts .= sprintf (
28
43
"\n* **[%s]** [%s](%s \"%s \") \n > %s " ,
29
44
$ date ,
You can’t perform that action at this time.
0 commit comments