adamlc / address-format Goto Github PK
View Code? Open in Web Editor NEWA PHP library to parse street addresses to localized formats
License: MIT License
A PHP library to parse street addresses to localized formats
License: MIT License
Example:
Name
Company
Street
AD100
Andorre
I changed in AD.json, "fmt": "%N%n%O%n%A%n%Z %S"
to "fmt": "%N%n%O%n%A%n%Z %C %S"
.
Result:
Name
Company
Street
AD100 Canillo
Andorre
The method setLocale($locale) passes $locale to file_get_contents after a concatenation, but with no input validation. If this was user controlled data, which is possible, it would allow directory traversal.
As far as I can see $locale should always be a string of two capital A to Z letters, it would be sensible to validate, or give an indication that this should be done by the user in the readme.
Example:
Name
Company
Street
Dublin
Ireland
I changed in IE.json, "fmt": "%N%n%O%n%A%n%C%n%S"
to "fmt": "fmt": "%N%n%O%n%A%n%C%n%Z%n%S"
.
Result:
Name
Company
Street
Dublin
D24 YN15
Ireland
since STREET_ADDRESS can only accept a single line, which is an issue, a simple fix would be on line 113 of Format.php to add:
$formatted_address = str_replace("\n", "%n", $formatted_address);
$formatted_address = str_replace('%n', "\n" . '<br>', $formatted_address);
instead of
$formatted_address = str_replace('%n', "\n" . '<br>', $formatted_address);
that way, any variable could have multiple lines, at the user's choice..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.