Esempio n. 1
0
 public function check()
 {
     $errorArray = array();
     $baseErrorMsg = get_class($this) . '::store-check failed - ';
     if ('' == trim($this->company_name)) {
         $errorArray['company_name'] = $baseErrorMsg . 'company name is not set';
     }
     if ((int) $this->company_owner == 0) {
         $errorArray['company_owner'] = $baseErrorMsg . 'company owner is not set';
     }
     if ('' != $this->company_primary_url && !w2p_check_url($this->company_primary_url)) {
         $errorArray['company_primary_url'] = $baseErrorMsg . 'company primary url is not formatted properly';
     }
     if ('' != $this->company_email && !w2p_check_email($this->company_email)) {
         $errorArray['company_email'] = $baseErrorMsg . 'company email is not formatted properly';
     }
     return $errorArray;
 }
Esempio n. 2
0
 public function check()
 {
     $errorArray = array();
     $baseErrorMsg = get_class($this) . '::store-check failed - ';
     if ('' != $this->contact_url && !w2p_check_url($this->contact_url)) {
         $errorArray['contact_url'] = $baseErrorMsg . 'contact url is not formatted properly';
     }
     if ('' != $this->contact_email && !w2p_check_email($this->contact_email)) {
         $errorArray['contact_email'] = $baseErrorMsg . 'contact email is not formatted properly';
     }
     if ('' != $this->contact_email2 && !w2p_check_email($this->contact_email2)) {
         $errorArray['contact_email2'] = $baseErrorMsg . 'contact email2 is not formatted properly';
     }
     return $errorArray;
 }
 public function test_w2p_check_email()
 {
     $this->assertEquals('*****@*****.**', w2p_check_email('*****@*****.**'));
     $this->assertEquals('*****@*****.**', w2p_check_email('*****@*****.**'));
     $this->assertFalse(w2p_check_email('@web2project.net'));
     $this->assertFalse(w2p_check_email('testsweb2project.net'));
     $this->assertFalse(w2p_check_email('tests@web2project'));
     $this->assertFalse(w2p_check_email('tests@'));
     $this->assertFalse(w2p_check_email('tests@.net'));
 }
Esempio n. 4
0
 public function isValid()
 {
     $baseErrorMsg = get_class($this) . '::store-check failed - ';
     if (mb_strlen($this->contact_first_name) <= 1) {
         $this->_error['contact_first_name'] = $baseErrorMsg . 'contact first name is not set';
     }
     if (mb_strlen($this->contact_display_name) <= 1) {
         $this->_error['contact_display_name'] = $baseErrorMsg . 'contact display name is not set';
     }
     if (mb_strlen($this->contact_email) && !w2p_check_email($this->contact_email)) {
         $this->_error['contact_email'] = $baseErrorMsg . 'contact email is not valid';
     }
     return count($this->_error) ? false : true;
 }