public function validate($result, &$errors)
 {
     $fields = array();
     try {
         $url = $this->option('url');
         $fields[] = 'url';
         if (preg_match('@^https?://$@', $url) || !preg_match('@/export\\.php@', $url)) {
             throw new waException(_wp('Invalid URL'));
         }
         $fields[] = 'login';
         $fields[] = 'password';
         $this->waQuery('1');
         $this->addOption('url', array('readonly' => true));
         $this->addOption('login', array('readonly' => true));
         $this->addOption('password', array('readonly' => true));
     } catch (Exception $ex) {
         foreach ($fields as $field) {
             $errors[$field] = $ex->getMessage();
         }
         $result = false;
         $this->addOption('url', array('readonly' => false));
         $this->addOption('login', array('readonly' => false));
         $this->addOption('password', array('readonly' => false));
     }
     return parent::validate($result, $errors);
 }
 public function validate($result, &$errors)
 {
     try {
         $this->getSourceModel();
         $this->addOption('path', array('readonly' => true));
     } catch (waException $ex) {
         $result = false;
         $errors['path'] = $ex->getMessage();
         $this->addOption('path', array('readonly' => false));
     }
     return parent::validate($result, $errors);
 }