File tree 1 file changed +10
-15
lines changed
1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change 4
4
5
5
require_once "../../../resources/autoload.php " ;
6
6
7
- if (isset ($ _GET ["line_wrap " ])) {
8
- $ CHAR_WRAP = $ _GET ["line_wrap " ];
9
- } else {
10
- $ CHAR_WRAP = 80 ;
11
- }
12
-
13
7
$ notices = $ SQL ->getNotices ();
8
+ $ jsonArray = [];
14
9
foreach ($ notices as $ notice ) {
15
- echo $ notice ["title " ] . "\r\n" ;
16
- echo date ('m-d-Y ' , strtotime ($ notice ["date " ])) . "\r\n" ;
17
-
18
- $ lineArr = explode ("\r\n" , wordwrap ($ notice ["message " ], $ CHAR_WRAP ));
19
- foreach ($ lineArr as $ line ) {
20
- echo $ line ;
21
- }
22
-
23
- echo "\r\n\r\n" ;
10
+ $ formattedNotice = [
11
+ "title " => $ notice ["title " ],
12
+ "date " => date ('m-d-Y ' , strtotime ($ notice ["date " ])),
13
+ "message " => $ notice ["message " ]
14
+ ];
15
+ $ jsonArray [] = $ formattedNotice ;
24
16
}
17
+
18
+ $ jsonOutput = json_encode ($ jsonArray , JSON_PRETTY_PRINT );
19
+ echo $ jsonOutput ;
You can’t perform that action at this time.
0 commit comments