Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 499

Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 506

Warning: Incorrect key file for table './miphpf_miphpfcom/watchdog.MYI'; try to repair it query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', 'preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.', 2, '', 'http://www.miphpf.com/manual/url_validator.html', '', '3.145.40.222', 1734786030) in /home/miphpf/domains/miphpf.com/public_html/includes/database.mysql.inc on line 121
Url validator | MIPHPF - Your Open Source RAD PHP Framework
Skip navigation.
Home

Url validator

: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.

miValidatorHttp class performs sanity check over url addresses. It can be mapped in the data manager, or created runtime.

* Mapped in the data manager class

<?php
class miUserDataManager extends miDataManager  {
   
protected $_dataFields = array(
        array(
           
'field' => 'miWebFormWidgetText',
           
'data' => 'UserWebSiteAddress',
           
'validator' => 'miValidatorHttp'
       
)
    );
}
?>

* Created runtime
<?php
class miUserDataManager extends miDataManager  {
   
protected $_dataFields = array(
        array(
           
'field' => 'miWebFormWidgetText',
           
'data' => 'UserWebSiteAddress'
       
)
    );

   
public function initWebForm(miWebForm $form)
    {
       
parent::initWebForm($form);

       
$validator = new miValidatorHttp($form, 'UserWebSiteAddress');
       
$form->addValidator('UserWebSiteAddress', $validator);
    }
}
?>

* Valid url addresses:
http://87.14.20.231
http://www.google.com
http://something.com

* Invalid url addresses:
ftp://87.14.20.231
file:///index.html
www.google.com