0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: tel.php.tar
home/academiac/www/libraries/joomla/form/rules/tel.php 0000644 00000006101 15137266514 0017046 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage Form * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * Form Rule class for the Joomla Platform * * @package Joomla.Platform * @subpackage Form * @since 11.1 */ class JFormRuleTel extends JFormRule { /** * Method to test the url for a valid parts. * * @param SimpleXMLElement &$element The SimpleXMLElement object representing the <field /> tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * @param object &$input An optional JRegistry object with the entire data set to validate against the entire form. * @param object &$form The form object for which the field is being tested. * * @return boolean True if the value is valid, false otherwise. * * @since 11.1 * @throws JException on invalid rule. */ public function test(&$element, $value, $group = null, &$input = null, &$form = null) { // If the field is empty and not required, the field is valid. $required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required'); if (!$required && empty($value)) { return true; } // @see http://www.nanpa.com/ // @see http://tools.ietf.org/html/rfc4933 // @see http://www.itu.int/rec/T-REC-E.164/en // Regex by Steve Levithan // @see http://blog.stevenlevithan.com/archives/validate-phone-number // @note that valid ITU-T and EPP must begin with +. $regexarray = array('NANP' => '/^(?:\+?1[-. ]?)?\(?([2-9][0-8][0-9])\)?[-. ]?([2-9][0-9]{2})[-. ]?([0-9]{4})$/', 'ITU-T' => '/^\+(?:[0-9] ?){6,14}[0-9]$/', 'EPP' => '/^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/'); if (isset($element['plan'])) { $plan = (string) $element['plan']; if ($plan == 'northamerica' || $plan == 'us') { $plan = 'NANP'; } elseif ($plan == 'International' || $plan == 'int' || $plan == 'missdn' || !$plan) { $plan = 'ITU-T'; } elseif ($plan == 'IETF') { $plan = 'EPP'; } $regex = $regexarray[$plan]; // Test the value against the regular expression. if (preg_match($regex, $value) == false) { return false; } } else { //If the rule is set but no plan is selected just check that there are between //7 and 15 digits inclusive and no illegal characters (but common number separators //are allowed). $cleanvalue = preg_replace('/[+. \-(\)]/', '', $value); $regex = '/^[0-9]{7,15}?$/'; if (preg_match($regex, $cleanvalue) == true) { return true; } else { return false; } } return true; } } home/academiac/www/libraries/joomla/html/html/tel.php 0000644 00000004326 15137273776 0016700 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage HTML * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * HTML helper class for rendering telephone numbers. * * @package Joomla.Platform * @subpackage HTML * @since 11.1 */ abstract class JHtmlTel { /** * Converts strings of integers into more readable telephone format * * By default, the ITU-T format will automatically be used. * However, one of the allowed unit types may also be used instead. * * @param integer $number The integers in a phone number with dot separated country code * ccc.nnnnnnn where ccc represents country code and nnn represents the local number. * @param string $displayplan The numbering plan used to display the numbers. * * @return string The formatted telephone number. * * @since 11.1 * * @see JFormRuleTel */ public static function tel($number, $displayplan) { $number = explode('.', $number); $countrycode = $number[0]; $number = $number[1]; if ($displayplan == 'ITU-T' || $displayplan == 'International' || $displayplan == 'int' || $displayplan == 'missdn' || $displayplan == null) { $display[0] = '+'; $display[1] = $countrycode; $display[2] = ' '; $display[3] = implode(str_split($number, 2), ' '); } elseif ($displayplan == 'NANP' || $displayplan == 'northamerica' || $displayplan == 'US') { $display[0] = '('; $display[1] = substr($number, 0, 3); $display[2] = ') '; $display[3] = substr($number, 3, 3); $display[4] = '-'; $display[5] = substr($number, 6, 4); } elseif ($displayplan == 'EPP' || $displayplan == 'IETF') { $display[0] = '+'; $display[1] = $countrycode; $display[2] = '.'; $display[3] = $number; } elseif ($displayplan == 'ARPA' || $displayplan == 'ENUM') { $number = implode(str_split(strrev($number), 1), '.'); $display[0] = '+'; $display[1] = $number; $display[2] = '.'; $display[3] = $countrycode; $display[4] = '.e164.arpa'; } $display = implode($display, ''); return $display; } } home/academiac/www/libraries/joomla/form/fields/tel.php 0000644 00000001457 15137515134 0017166 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage Form * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; JFormHelper::loadFieldClass('text'); /** * Form Field class for the Joomla Platform. * Supports a text field telephone numbers. * * @package Joomla.Platform * @subpackage Form * @link http://www.w3.org/TR/html-markup/input.tel.html * @see JFormRuleTel for telephone number validation * @see JHtmlTel for rendering of telephone numbers * @since 11.1 */ class JFormFieldTel extends JFormFieldText { /** * The form field type. * * @var string * @since 11.1 */ protected $type = 'Tel'; }
©
2018.