@@ -1272,22 +1272,23 @@ void WiFiManager::startWPS() {
12721272}
12731273#endif
12741274
1275- String WiFiManager::getHTTPHead (String title){
1275+ String WiFiManager::getHTTPHead (String title, String classes ){
12761276 String page;
12771277 page += FPSTR (HTTP_HEAD_START);
12781278 page.replace (FPSTR (T_v), title);
12791279 page += FPSTR (HTTP_SCRIPT);
12801280 page += FPSTR (HTTP_STYLE);
12811281 page += _customHeadElement;
12821282
1283- if (_bodyClass != " " ){
1284- String p = FPSTR (HTTP_HEAD_END);
1285- p.replace (FPSTR (T_c), _bodyClass); // add class str
1286- page += p;
1283+ String p = FPSTR (HTTP_HEAD_END);
1284+ if (_bodyClass != " " ) {
1285+ if (classes != " " ) {
1286+ classes += " " ; // add spacing, if necessary
1287+ }
1288+ classes += _bodyClass; // add class str
12871289 }
1288- else {
1289- page += FPSTR (HTTP_HEAD_END);
1290- }
1290+ p.replace (FPSTR (T_c), classes);
1291+ page += p;
12911292
12921293 return page;
12931294}
@@ -1332,7 +1333,7 @@ void WiFiManager::handleRoot() {
13321333 #endif
13331334 if (captivePortal ()) return ; // If captive portal redirect instead of displaying the page
13341335 handleRequest ();
1335- String page = getHTTPHead (_title); // @token options @todo replace options with title
1336+ String page = getHTTPHead (_title, FPSTR (C_root) ); // @token options @todo replace options with title
13361337 String str = FPSTR (HTTP_ROOT_MAIN); // @todo custom title
13371338 str.replace (FPSTR (T_t),_title);
13381339 str.replace (FPSTR (T_v),configPortalActive ? _apName : (getWiFiHostname () + " - " + WiFi.localIP ().toString ())); // use ip if ap is not active for heading @todo use hostname?
@@ -1357,7 +1358,7 @@ void WiFiManager::handleWifi(boolean scan) {
13571358 DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Wifi" ));
13581359 #endif
13591360 handleRequest ();
1360- String page = getHTTPHead (FPSTR (S_titlewifi)); // @token titlewifi
1361+ String page = getHTTPHead (FPSTR (S_titlewifi), FPSTR (C_wifi) ); // @token titlewifi
13611362 if (scan) {
13621363 #ifdef WM_DEBUG_LEVEL
13631364 // DEBUG_WM(WM_DEBUG_DEV,"refresh flag:",server->hasArg(F("refresh")));
@@ -1413,7 +1414,7 @@ void WiFiManager::handleParam(){
14131414 DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Param" ));
14141415 #endif
14151416 handleRequest ();
1416- String page = getHTTPHead (FPSTR (S_titleparam)); // @token titlewifi
1417+ String page = getHTTPHead (FPSTR (S_titleparam), FPSTR (C_param) ); // @token titlewifi
14171418
14181419 String pitem = " " ;
14191420
@@ -1878,11 +1879,11 @@ void WiFiManager::handleWifiSave() {
18781879 String page;
18791880
18801881 if (_ssid == " " ){
1881- page = getHTTPHead (FPSTR (S_titlewifisettings)); // @token titleparamsaved
1882+ page = getHTTPHead (FPSTR (S_titlewifisettings), FPSTR (C_wifi) ); // @token titleparamsaved
18821883 page += FPSTR (HTTP_PARAMSAVED);
18831884 }
18841885 else {
1885- page = getHTTPHead (FPSTR (S_titlewifisaved)); // @token titlewifisaved
1886+ page = getHTTPHead (FPSTR (S_titlewifisaved), FPSTR (C_wifi) ); // @token titlewifisaved
18861887 page += FPSTR (HTTP_SAVED);
18871888 }
18881889
@@ -1911,7 +1912,7 @@ void WiFiManager::handleParamSave() {
19111912
19121913 doParamSave ();
19131914
1914- String page = getHTTPHead (FPSTR (S_titleparamsaved)); // @token titleparamsaved
1915+ String page = getHTTPHead (FPSTR (S_titleparamsaved), FPSTR (C_param) ); // @token titleparamsaved
19151916 page += FPSTR (HTTP_PARAMSAVED);
19161917 if (_showBack) page += FPSTR (HTTP_BACKBTN);
19171918 page += FPSTR (HTTP_END);
@@ -1977,7 +1978,7 @@ void WiFiManager::handleInfo() {
19771978 DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Info" ));
19781979 #endif
19791980 handleRequest ();
1980- String page = getHTTPHead (FPSTR (S_titleinfo)); // @token titleinfo
1981+ String page = getHTTPHead (FPSTR (S_titleinfo), FPSTR (C_info) ); // @token titleinfo
19811982 reportStatus (page);
19821983
19831984 uint16_t infos = 0 ;
@@ -2322,7 +2323,7 @@ void WiFiManager::handleExit() {
23222323 DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Exit" ));
23232324 #endif
23242325 handleRequest ();
2325- String page = getHTTPHead (FPSTR (S_titleexit)); // @token titleexit
2326+ String page = getHTTPHead (FPSTR (S_titleexit), FPSTR (C_exit) ); // @token titleexit
23262327 page += FPSTR (S_exiting); // @token exiting
23272328 // ('Logout', 401, {'WWW-Authenticate': 'Basic realm="Login required"'})
23282329 server->sendHeader (F (" Cache-Control" ), F (" no-cache, no-store, must-revalidate" )); // @HTTPHEAD send cache
@@ -2339,7 +2340,7 @@ void WiFiManager::handleReset() {
23392340 DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP Reset" ));
23402341 #endif
23412342 handleRequest ();
2342- String page = getHTTPHead (FPSTR (S_titlereset)); // @token titlereset
2343+ String page = getHTTPHead (FPSTR (S_titlereset), FPSTR (C_restart) ); // @token titlereset
23432344 page += FPSTR (S_resetting); // @token resetting
23442345 page += FPSTR (HTTP_END);
23452346
@@ -2364,7 +2365,7 @@ void WiFiManager::handleErase(boolean opt) {
23642365 DEBUG_WM (WM_DEBUG_NOTIFY,F (" <- HTTP Erase" ));
23652366 #endif
23662367 handleRequest ();
2367- String page = getHTTPHead (FPSTR (S_titleerase)); // @token titleerase
2368+ String page = getHTTPHead (FPSTR (S_titleerase), FPSTR (C_erase) ); // @token titleerase
23682369
23692370 bool ret = erase (opt);
23702371
@@ -2469,7 +2470,7 @@ void WiFiManager::handleClose(){
24692470 DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- HTTP close" ));
24702471 #endif
24712472 handleRequest ();
2472- String page = getHTTPHead (FPSTR (S_titleclose)); // @token titleclose
2473+ String page = getHTTPHead (FPSTR (S_titleclose), FPSTR (C_close) ); // @token titleclose
24732474 page += FPSTR (S_closing); // @token closing
24742475 HTTPSend (page);
24752476}
@@ -3874,7 +3875,7 @@ void WiFiManager::handleUpdate() {
38743875 DEBUG_WM (WM_DEBUG_VERBOSE,F (" <- Handle update" ));
38753876 #endif
38763877 if (captivePortal ()) return ; // If captive portal redirect instead of displaying the page
3877- String page = getHTTPHead (_title); // @token options
3878+ String page = getHTTPHead (_title, FPSTR (C_update) ); // @token options
38783879 String str = FPSTR (HTTP_ROOT_MAIN);
38793880 str.replace (FPSTR (T_t), _title);
38803881 str.replace (FPSTR (T_v), configPortalActive ? _apName : (getWiFiHostname () + " - " + WiFi.localIP ().toString ())); // use ip if ap is not active for heading
@@ -3984,7 +3985,7 @@ void WiFiManager::handleUpdateDone() {
39843985 DEBUG_WM (WM_DEBUG_VERBOSE, F (" <- Handle update done" ));
39853986 // if (captivePortal()) return; // If captive portal redirect instead of displaying the page
39863987
3987- String page = getHTTPHead (FPSTR (S_options)); // @token options
3988+ String page = getHTTPHead (FPSTR (S_options), FPSTR (C_update) ); // @token options
39883989 String str = FPSTR (HTTP_ROOT_MAIN);
39893990 str.replace (FPSTR (T_t),_title);
39903991 str.replace (FPSTR (T_v), configPortalActive ? _apName : WiFi.localIP ().toString ()); // use ip if ap is not active for heading
0 commit comments