LinkTel

Summary: Active telephone links in wiki pages
Version: 20170618
Prerequisites: PmWiki 2.2.58
Status: beta
Maintainer: Petko
Categories: Links, Markup, Media, Mobile, PHP55, PHP72
Users: (view? / edit)
Discussion: LinkTel-Talk
License: GPL3+

Recent versions of PmWiki have the tel: links automatically enabled. This recipe would be only useful if you require the (:prefix ...:) markup.

Description

Insert active telephone links into your wiki pages. Visitors on compatible devices such as smartphones can tap the links to dial the numbers.

Additionally, you can define sections with telephone prefixes. All standalone numbers in these sections will be converted to active telephone links with the predefined prefixes. This can be used when a short internal number can be dialed from inside the office, and an external, longer number must be dialed from outside.

Installation

  • Copy linktel.phpΔ into your pmwiki/cookbook directory.
  • Add to config.php such a line:
     include_once("$FarmD/cookbook/linktel.php");

If you want to disable the automatic number detection by the device, add also this line:

  $HTMLHeaderFmt['linktel'] = '<meta name="format-detection" content="telephone=no"/>';

Configuration

The telephone links have the CSS class "tel", so you may want to add something like this to pub/css/local.css:

  a.tel { color: green; }

Usage

In a wiki page, there are two formats: tel:+442044440000 or (:prefix +440204444=XXXX:)

You can use telephone links like page links and external links:

  • [[tel:+442044440000|020 4444 0000]] displays 020 4444 0000
  • [[tel:+442044440000|0000]] displays 0000 (use for internal numbers with prefix)
  • tel:(+44204444)1234 displays 1234 and calls 020 4444 1234
  • Use the international calling format, eg. for UK +44 replacing the first 0 of the number, this way the links will work from anywhere.

To enable automatic detection of standalone numbers and convert them to active telephone links with prefixes, place this code at the beginning of a line: (:prefix +44204444=XXXX:). This way you don't need to add the tel: prefix.

  • The +44204444 part contains the prefix.
  • The XXXX part causes any 4-digit number that follows to be converted to active telephone link with the +44204444 prefix, eg. 5678 will call 020 4444 5678.
  • You can have several number patterns, eg. (:prefix +4420444=XXXXX,XXXX:) will convert 5-digit and 4-digit numbers to active links.
  • You can have number ranges like (:prefix +44203333=[0-3]XXX:) will activate 4-digit numbers starting with 0, 1, 2 or 3.
  • You can define more than one prefix: (:prefix +44204444=XXXX,7XX +44209999=[0-3]XXX:). They will be applied to found numbers in the order you define them.
  • Use another (:prefix...:) line to change the prefix for numbers that follow.
  • Use (:prefixend:) to stop activating numbers into telephone links.

Notes

The (:prefix ...:) markup will only work on devices with JavaScript enabled.

If you don't need the (:prefix ...:) markup and the link styles, instead of installing this recipe, just edit [[Site.InterMap]] and place such a line at the end:

  tel: tel:$1

Change log / Release notes

  • 20170618: Update for PHP 7.2 compatibility.
  • 20140422: Release on pmwiki.org after a few weeks usage on a private project.

See also

Contributors

  • Recipe written and maintained by Petko (5ko [snail] 5ko [period] fr).

Comments

See discussion at LinkTel-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.