International Internet connections

International Internet connections 2

Some parts of the world are not that well connected; Australia and South Africa to name a few.  And if a cable is damaged , this can cause severe congestion.

ausmap1
Australian undersea internet connetions at a point in time.
  • https://www.submarinecablemap.com/ as at 2017
  • Alcatel used to have a HUGE map showing the various undersea fibre optic cable connections between Australia and the rest of the world.  Here’s a saved 2006 version  World_Map_LR
  • http://www.iscpc.org/ The international cable protection committee has a database of cables under the sea

Submenu, Page, slug, attached media confusion

I had a really odd one today.  A client had added text to a submenu page that was either empty or just had an image.  Once she had saved and wanted to view the page, wordpress just kept bringing up a set of images with the page slug in the title (‘jazz’).  One could not get the page itself to display, not in preview, not at all and not even when following the menu tree.

The image was displayed along with others in the parent page – intended as a kind of image list to the sub menu pages.  I suspect that somehow this was causing the problem getting to the correct sub menu page.

The page can be edited from the admin area, but is not displayed in anything other than edit mode unless one changes the “slug” to something else (eg: ‘jazz classes’).   One can reverse the process – ie: change the slug back to ‘jazz’ and the problem comes back.   Changing the title does not seem to make any difference.

I had not yet upgraded to 2.7, so I did that – actually to 2.7.1 now in the hope that that would fix it, but no,  the behaviour remained.  It was also happening on other similar pages (eg:’ ballet’).

Not a theme problem

Just to be sure I switched to the default theme and it’s the same.

Examples of links

Menu – sub menu item link:

http://…/dance-classes/jazz/

results in a selection of images that have “jazz” in their nameand the “edit post link”  thinks it needs to edit media

http://…/wp-admin/media.php?action=edit&attachment_id=12

If one edits the post and then does a preview, giving url

http://…/dance-classes/jazz/?preview=true&preview_id=18&preview_nonce=06b1fc7fca

one is back to the set of pictures and not the text

jazz-edit

jazz-preview

Getting the urls and only the urls with ereg

Trying to match any weird and wonderful url or hyperlink in a piece of text is fun – I found “help” all over the place, but none of them quite got it all –  This was clear when using the eccentric holidays calendar for a test case in my ical upcoming events list

Eventually with the help of “The Regex Coach” (thank you very much) to test we (I’m a gemini) settled on the following code.  It will find any of the following links, while excluding any text already hyper linked.

Dasher, Dancer, Prancer, Vixen, Comet, Cupid, Donner, Blixen….

The code handles urls with dashes, underscores, trailing slashes, suffixes, query strings ? and ampersands &, equal signs.  It rejects urls with other funny characters.

We want regular expressions to replace EXPR in the formula below:

$text = ereg_replace( EXPR , "<a href=\"\\0\">\\0</a>", $text);

http or https or ftp type urls:

"[a-zA-Z]+://([.]?[a-zA-Z0-9-])*([/]?[a-zA-Z0-9_-])*([/a-zA-Z0-9?&#\._=-]*)"

and another for www urls (at start of line or after space)

“(^| |\n)(www([.]?[a-zA-Z0-9-])*)([/]?[a-zA-Z0-9_-])*([/a-zA-Z0-9?&#\._=-]*)”

These two lines of code deals with the following examples:

  • http://smarmycarny.com/get-over-it-day
  • http://www.smarmycarny.com/get-over-it-day
  • www.smarmycarny.com/get-over-it-day
  • www.smarmycarny.com/get_over_it-day/
  • www.smarmycarny.com/get-over-it-day/test.htm
  • www.smarmycarny.com/get-over-it-day/test.php?somequery&yes=true
  • www.smarmycarny.com/get-over-it-day/test.html#bot-tom

Strange urls are ignored or dealt with accordingly. See example:

Demo of ignored and selected text
Demo of ignored and selected text