Author Topic: quake-json.php version 3.02  (Read 693 times)

0 Members and 1 Guest are viewing this topic.

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
quake-json.php version 3.02
« on: June 28, 2020, 02:47:28 AM »
Hi Ken,
thank you for the new version wit location names [tup]
works very good, already added new location
Code: [Select]
$nameTrans = array(   // optional location name translation
 'P?hala' => 'Pāhala',
'Or?ova' => 'Orşova',     
 );

kr
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: quake-json.php version 3.03
« Reply #1 on: June 30, 2020, 12:27:31 PM »
Thanks... I also had discussions with Stan in Hawaii.
It seems the W3C HTML validator didn't like/honor the ā HTML entity name, so I've switched to using the &#nnnn; format instead (which does pass the validator).

Also added the capability to use Settings.php $SITE['USGStranslate'] = array('name?here' => 'name&#nnnn'); to merge with the existing $nameTrans array in quake-json.php so you won't have to update quake-json.php to preserve any custom names you might have using the Saratoga template.

Here's the updated comments in quake-json.php:
Code: [Select]
# optional location name translation - use only &#nnnn; or &#xnnnn; form for HTML validation
# and NOT the &{name}; format.. it will cause the validator.w3c.org to incorrectly cite them
# as HTML errors (even if the page displays correctly);
#
# see https://www.w3schools.com/charsets/ref_utf_latin_extended_a.asp for a list of numeric/hex entities
#
# Note: a $SITE['USGStranslate'] array in Settings.php will be merged with this set - do your customization there
#
 $nameTrans = array(   
 'P?hala' => 'Pāhala',
 'Or?ova' => 'Orşova',
 );

quake-json.php V3.03 - 30-Jun-2020 is now released.
« Last Edit: June 30, 2020, 12:32:45 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: quake-json.php version 3.02
« Reply #2 on: June 30, 2020, 02:14:26 PM »
Thank you for the update.
I always forget to check the validator
For my page   https://www.matar.be/weather/wxquake.php I tried it now but it doesn't get that far , see attachment

Has it to do with topic https://www.wxforum.net/index.php?topic=39776.0 ?

Ps : I recently integrated the wrnWarningv3.php script of Wim, that's another thing I have to look into regarding the validation I see now.
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: quake-json.php version 3.02
« Reply #3 on: June 30, 2020, 03:11:41 PM »
I tried validating your page, and had to select ISO-8859-1 to get the validator to do the scan.
Most of the HTML errata cited are due to the <br> or <p> tags inside a title="..." for the warning.  HTML tags inside an attribute of another tag are invalid HTML.  Maybe if they were replaced with NEW_LINE (\n) characters, the effect would be the same but would likely validate that part at least.  You'll need to talk with Wim about changing the warning script to have valid HTML output.

Quote
<td><img src="./wrnImages/warn_20.gif" title="nederlands: <br>Een actieve golvende storing bereikt vanavond ons land via het westen en verlaat woensdagavond ons land via het zuidoosten. Tijdens deze doortocht verwachten we cumulatieve neerslaghoeveelheden van 20 tot 40 l/m? in 24h. De meeste neerslag wordt vooral ten noorden van Samber en Maas verwacht.Woensdagnamiddag is er tevens een kans op onweer in sommige streken. <br><br><p>français: <br>Une perturbation ondulante active aborde le pays a partir de l'ouest ce soir et ne quittera nos regions par le sud-est que mercredi en cours de soiree. Sur son passage, on s'attend generalement a des cumuls de 20 a 40 l/m? en 24h. Les cumuls les plus eleves devraient toutefois essentiellement concerner les regions situees au nord du sillon Sambre et Meuse.Mercredi apres-midi, il faudra egalement composer avec un risque d'orage par endroits.</b>&nbsp;" alt="Rain" style="vertical-align: bottom;"/></td>

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: quake-json.php version 3.02
« Reply #4 on: June 30, 2020, 03:42:37 PM »
I tried validating your page, and had to select ISO-8859-1 to get the validator to do the scan.
Most of the HTML errata cited are due to the <br> or <p> tags inside a title="..." for the warning.  HTML tags inside an attribute of another tag are invalid HTML.  Maybe if they were replaced with NEW_LINE (\n) characters, the effect would be the same but would likely validate that part at least.  You'll need to talk with Wim about changing the warning script to have valid HTML output.

Quote
<td><img src="./wrnImages/warn_20.gif" title="nederlands: <br>Een actieve golvende storing bereikt vanavond ons land via het westen en verlaat woensdagavond ons land via het zuidoosten. Tijdens deze doortocht verwachten we cumulatieve neerslaghoeveelheden van 20 tot 40 l/m? in 24h. De meeste neerslag wordt vooral ten noorden van Samber en Maas verwacht.Woensdagnamiddag is er tevens een kans op onweer in sommige streken. <br><br><p>français: <br>Une perturbation ondulante active aborde le pays a partir de l'ouest ce soir et ne quittera nos regions par le sud-est que mercredi en cours de soiree. Sur son passage, on s'attend generalement a des cumuls de 20 a 40 l/m? en 24h. Les cumuls les plus eleves devraient toutefois essentiellement concerner les regions situees au nord du sillon Sambre et Meuse.Mercredi apres-midi, il faudra egalement composer avec un risque d'orage par endroits.</b>&nbsp;" alt="Rain" style="vertical-align: bottom;"/></td>

The only one  error I see when running the validator
https://validator.w3.org/nu/?showsource=yes&doc=https%3A%2F%2Fwww.matar.be%2Fweather%2Fwxquake.php#l537c73
is in the warning  part lines 482 - 503 on line 495 in the word fran�ais
Malformed byte sequence: e7.
No other warnings / error in that part
Code: [Select]
<!-- warnings and other info goes here  -->
<!--
Severe weatherdata (./cache/warningBE002) cache times:
        cache time   = 2020-06-30T21:28:42+02:00 from unix time 1593545322
        current time = 2020-06-30T21:29:40+02:00 from unix time 1593545380
        difference   = 58 (seconds)
        diff allowed = 900 (seconds) -->
<!-- Severe weatherdata (./cache/warningBE002) loaded from cache -->
<!-- one warning per box -->
<div style= "margin: 5px; border-radius: 5px; border: 1px solid grey; border-bottom: 3px solid grey; color: black; text-align: center; overflow: hidden; min-height: 15px; background-color: #FFFD38" >
<table style= "border-collapse: collapse; width: 100%; color: black;text-align: center;">
<tr>
  <td><img src="./wrnImages/warn_20.gif" title="nederlands: <br>Een actieve golvende storing bereikt vanavond ons land via het westen en verlaat woensdagavond ons land via het zuidoosten. Tijdens deze doortocht verwachten we cumulatieve neerslaghoeveelheden van 20 tot 40 l/m? in 24h. De meeste neerslag wordt vooral ten noorden van Samber en Maas verwacht.Woensdagnamiddag is er tevens een kans op onweer in sommige streken. <br><br><p>fran�ais: <br>Une perturbation ondulante active aborde le pays a partir de l'ouest ce soir et ne quittera nos regions par le sud-est que mercredi en cours de soiree. Sur son passage, on s'attend generalement a des cumuls de 20 a 40 l/m? en 24h. Les cumuls les plus eleves devraient toutefois essentiellement concerner les regions situees au nord du sillon Sambre et Meuse.Mercredi apres-midi, il faudra egalement composer avec un risque d'orage par endroits.</b>&nbsp;" alt="Rain" style="vertical-align: bottom;"/></td>
  <td>From:&nbsp;30-06-2020 20:59</td>
  <td>Until:&nbsp;01-07-2020 21:59</td>
  <td>warning for:&nbsp;<span style="font-weight: bold;">Rain</span>&nbsp;Level:&nbsp;<span style="font-weight: bold;">Yellow</span></td>
  <td><a href="wxadvisoryv3.php"><img src=".//wrnImages/i_symbol.png" alt="info button" style="vertical-align: bottom; width: 20px;"/></a></td>
</tr>
</table>
</div>
<!-- end warnings -->

With which checker did you run to get complaints about that text-block?

Best regards,
Wim

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: quake-json.php version 3.02
« Reply #5 on: July 01, 2020, 04:45:07 AM »
Hey Wim,
validator used by Ken (and link provided in the scripts) is following :
https://validator.w3.org/

you used https://validator.w3.org/nu/

I leave the discussion to the specialists what is the most appropriate.
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: quake-json.php version 3.02
« Reply #6 on: July 01, 2020, 05:24:43 AM »
Hey Wim,
validator used by Ken (and link provided in the scripts) is following :
https://validator.w3.org/

you used https://validator.w3.org/nu/

I leave the discussion to the specialists what is the most appropriate.

I will make sure today that that part it will pass the old checker also.

Wim

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: quake-json.php version 3.02
« Reply #7 on: July 01, 2020, 05:41:16 AM »
Hey Wim,
validator used by Ken (and link provided in the scripts) is following :
https://validator.w3.org/

you used https://validator.w3.org/nu/

I leave the discussion to the specialists what is the most appropriate.

I will make sure today that that part it will pass the old checker also.

Wim
Attached new version which changes all < and > in the title to their html equivalent

Result of your page without the warning script, i simply removed that part form your page-html
Quote
Congratulations
The uploaded document was tentatively checked as XHTML 1.0 Transitional. This means that with the use of some fallback or override mechanism, we successfully performed a formal validation of it. In other words, the document would validate as XHTML 1.0 Transitional if you changed the markup to match the changes we have performed automatically, but it will not be valid until you make these changes. The parser implementations we used for this check are based on OpenSP (SGML/XML) and libxml2 (XML).

Result of your page with the warning script, I inserted the new warning html
Quote
Congratulations
The uploaded document was tentatively checked as XHTML 1.0 Transitional. This means that with the use of some fallback or override mechanism, we successfully performed a formal validation of it. In other words, the document would validate as XHTML 1.0 Transitional if you changed the markup to match the changes we have performed automatically, but it will not be valid until you make these changes. The parser implementations we used for this check are based on OpenSP (SGML/XML) and libxml2 (XML).

Wim

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: quake-json.php version 3.02
« Reply #8 on: July 01, 2020, 07:08:17 AM »
Wim,
thank you very much, great work. [tup]

What I will check and change for my page during the next period will be some characters like the "ü" because on my earthquake page it gives the strange characters in the  message box , not on the other pages. (when I display the page in an other language)
These are changes I do in the texts parts of your script.  ( eg &uumlt;  instead of ü)

Thanks for the great work
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

 

anything