When we said that our Flight Radar WordPress plugin was the simplest thing you’ll ever see from us… we lied. In fact, we’ll likely reserve the ‘simplest’ claim a little longer while we roll out a number of plugins that aren’t nearly as feature rich as some of our premium products.
The latest plugin we’ve released is “Aviation Quotes“. The first (and very basic) version will simply render an aviation quote on your WordPress website with the use of shortcode. While the launch version is made simply to establish an audience – not to mention that it makes it easier for us to install and update it on our own websites – the future versions will introduce more features that’ll allow you to do far more with our data.
One of the most limiting aspects of the current setup is that we’ll indiscriminately deliver a quote – comedic, serious, or otherwise. The ability to specifically request quotes of a specific nature hasn’t yet been implemented.
The shortcode of
[aviationquote p="1"] in your text editor will render the following on your WordPress website (blockquote is my own formatting):
It's always better to be down on the ground wishing you were up in the air than up in the air wishing you were down on the ground.
p=1 is used to wrap the quote in paragraph <p> tags. If not used the quote will display inline (as follows): A fool and his money are soon flying more airplane than he can handle.
The individual receiving attribution for the quote can be formatted with standard HTML tags (assuming of course that the quote provides attribution). For example, to render the text as bold and in italics, use the following:
[aviationquote p="1" tags="em,strong"]. Note that the opening and closing tags aren’t used, and each html formatting instruction is separated by a comma.
“The important achievement of Apollo was demonstrating that humanity is not forever chained to this planet and our visions go rather further than that and our opportunities are unlimited.” – Neil Armstrong
While we use a double hyphen between the quote and attribution by default, you may use any character(s) you like. For example,
[aviationquote p="1" sep="::"] will return:
“Nobody who gets too damned relaxed builds up much flying time.” :: Ernest K. Gann, advice from the ‘old pelican’, The Black Watch, 1989
Again, the attribution will obviously only be formatted if it is returned in the XML (or JSON) data.
The cache is set to keep quotes stored locally (in your own WordPress database) for one hour.
The Quotes API
The endpoint used for the purpose of providing the initial (fairly generic) service is
http://api.flight.org/quotes/xml/random.xml. While it is used for the purpose of providing the WordPress plugin, it can obviously be used in any application.
There are general usage restrictions that apply but they’re generally only enforced when abuse is detected. A
423 status message will be returned when the API is unavailable, and a
420 message will be returned when rate limited. We’ll provide the number of seconds that you’ll have to wait before you’re white-listed again in the status message field. Again, you would have to be making repeated ‘spammy’ requests for this to be a problem (this issue doesn’t apply to the plugin because it’ll cache for at least one hour by default). Under normal circumstances we’ll return an okay code of
If you’re building your own application, keep in mind that we generally cache data on our end for up to 60 minutes, so you would be wise to do the same. Making a new request within the same 60-minute period may return the same data.
The above image shows the 420 “slow down” message after 10 requests were made in 30 seconds (which would result in a one-day ban). The below data shows the wait time when making 5 requests in one minute.
The block can apply from one hour to forever depending upon the nature of the “abuse”. Of course, all clients or API key holders have full uninterrupted access and can do whatever they want.
We currently have over 5000 aviation quotes but we’re always interested in building upon existing data. The first formal release of the plugin will have a feature that’ll submit quotes back to us.
Following is a basic function that can be used outside of WordPress. The code is basic and not nearly as feature rich as its WordPress counterpart.
You will need to create a cache directory and a ‘currentquote.txt’ file, with the full path defined.
If you require any assistance, or have any ideas, let us know below.
Shortt URL for this post: