11<?php
22
3- /**
4- * @param bool $status
5- * @return string
6- */
7- function status ($ status )
8- {
9- return $ status ? success ('success ' ) : fail ('fail ' );
3+ if (!function_exists ('status ' )) {
4+ /**
5+ * @param bool $status
6+ * @return string
7+ */
8+ function status ($ status )
9+ {
10+ return $ status ? success ('success ' ) : fail ('fail ' );
11+ }
1012}
1113
12- /**
13- * @return bool
14- * @SuppressWarnings("SuperGlobals")
15- */
16- function is_http ()
17- {
18- return isset ($ _SERVER ['HTTP_HOST ' ]);
14+ if (!function_exists ('is_http ' )) {
15+ /**
16+ * @return bool
17+ * @SuppressWarnings("SuperGlobals")
18+ */
19+ function is_http ()
20+ {
21+ return isset ($ _SERVER ['HTTP_HOST ' ]);
22+ }
1923}
2024
21- /**
22- * @param string $message
23- * @return string
24- */
25- function success ($ message )
26- {
27- //chr(27) . '[42m success ' . chr(27) . '[0m'
28- $ success = chr (27 ) . '[42m ' . $ message . chr (27 ) . '[0m ' ;
29- if (is_http ()) {
30- $ success = '<span style="background-color: green; color: #fff; padding: 0 5px;"> ' . $ message . '</span> ' ;
25+ if (!function_exists ('success ' )) {
26+ /**
27+ * @param string $message
28+ * @return string
29+ */
30+ function success ($ message )
31+ {
32+ //chr(27) . '[42m success ' . chr(27) . '[0m'
33+ $ success = chr (27 ) . '[42m ' . $ message . chr (27 ) . '[0m ' ;
34+ if (is_http ()) {
35+ $ success = '<span style="background-color: green; color: #fff; padding: 0 5px;"> ' . $ message . '</span> ' ;
36+ }
37+ return $ success ;
3138 }
32- return $ success ;
3339}
3440
35- /**
36- * @param string $message
37- * @return string
38- */
39- function fail ($ message )
40- {
41- //chr(27) . '[42m success ' . chr(27) . '[0m'
42- $ success = chr (27 ) . '[41m ' . $ message . chr (27 ) . '[0m ' ;
43- if (is_http ()) {
44- $ success = '<span style="background-color: red; color: #fff; padding: 0 5px;"> ' . $ message . '</span> ' ;
41+ if (!function_exists ('fail ' )) {
42+ /**
43+ * @param string $message
44+ * @return string
45+ */
46+ function fail ($ message )
47+ {
48+ //chr(27) . '[42m success ' . chr(27) . '[0m'
49+ $ success = chr (27 ) . '[41m ' . $ message . chr (27 ) . '[0m ' ;
50+ if (is_http ()) {
51+ $ success = '<span style="background-color: red; color: #fff; padding: 0 5px;"> ' . $ message . '</span> ' ;
52+ }
53+ return $ success ;
4554 }
46- return $ success ;
47- }
55+ }
0 commit comments