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 1515$ posts = '' ;
1616if (isset ($ feed ['entry ' ]) && is_array ($ feed ['entry ' ])) {
1717 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 ' ;
2320
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+ }
2640
41+ // Format each post entry
2742 $ posts .= sprintf (
2843 "\n* **[%s]** [%s](%s \"%s \") \n > %s " ,
2944 $ date ,
You can’t perform that action at this time.
0 commit comments