Cookbook
Topics |
Auto TelAutoTelnew version 2024-04-10new Summary: A recipe to automatically detect and markup telephone numbers
Version: 2022-02-20
Prerequisites: PmWiki 2.3.17; PHP 8
Status: Alpha
Maintainer: skiwi
File: autotel-2022-02-20.php Δ
Discussion: AutoTel-Talk
Questions answered by this recipeHow can I make the telephone and mobile phone numbers on my wiki dialable? DescriptionThis recipe automatically detects service, mobile, and land phone numbers.
These phone numbers are for a New Zealand context, but if the demand is there it can be upgraded for other countries.
The telephone numbers are wrapped in an anchor element using the " The To recognise a telephone number a visual indicator or separator is required. These include:
Land and mobile numbers have a different syntax
This recipe is based on Petko Yotov's code snippet from Cookbook:LinkTel-Talk tarted up a bit to improve the matching and delivered in a recipe format. Note it still have a few false positives, but no known false negatives. Installation
include_once(
UsageNo changes are required to PmWiki pages, however to improve matching and to reduce false positives some telephone number reformatting may be required. To limit the scope of this recipe install it as a group or page recipe. The recipe provides a page variable The recipe may create false positive matches of telephone numbers. If this is the case Cookbook:LinkTel may be a better match for your requirements. Limited configuration can be performed from the config file. AutoTelConfig = array( 'CountryCodeDefault' => '+64', 'AreaCodeDefault' => '4', 'LongDistancePrefixDefault' => '0'); The following string can be internationalised:
DetailsTo attempt to constrain the automatic detection of telephone numbers
Service numberA service number, e.g. 0800 123 456 or 0508 765 4321, is composed as follows: a service code, optionally in (parenthesis)
a mandatory visual separator or bracket
a subscriber number, the mobile subscriber number pattern is used
Mobile numberA mobile number, e.g. 012 345 6789, is composed as follows: optional country code, e.g. +64 or (+64)
area code mobile, optionally in (parenthesis)
a mandatory visual separator
a subscriber number, the mobile subscriber number pattern is used
Land line numberA land line number, e.g. 01 234 5678, is composed as follows: and optional country code and area code
a subscriber number, the land line subscriver number pattern is used
Change log / Release notes2024-02-20 Updates to improve rexex matching, and to documentation 2023-12-29 Updates to improve regex matching 2022-12-22 Initial version based on Petko Yotov's code snippet at Cookbook:LinkTel-Talk See also
|
tahi Page last modified on 2024 Jun 03 08:52
Edit - History - Recent Changes - WikiHelp - Search - email page as link -> mailto:?Subject="KiwiWiki: Auto Tel"&Body=