Validates a module data
@return boolean
192612
protected function validate()
    {
        $this->data = $this->module->getInfo($this->module_id);

        if (empty($this->data)) {
            $this->error = $this->translation->text('Failed to read module @id', array('@id' => $this->module_id));
            return false;
        }

        try {
            $this->module_model->checkCore($this->data);
            $this->module_model->checkPhpVersion($this->data);
            return true;
        } catch (Exception $ex) {
            $this->error = $ex->getMessage();
            return false;
        }
    }
1163748
public function validates()
    {
        $currentAttributeValues = array();

        if ($this->isBound()) {
            foreach ($this->getAttributeNames() as $name) {
                $currentAttributeValues[$name] = $this->{$name};
            }
        }

        return $this->validate(array(
            $this->getInputName() => $currentAttributeValues
        ));
    }
654834
public function validateValidItem()
    {
        if (!$this->value) {
            return;
        }

        // load allowed values in values_list
        // @todo Imants: Actually we don't need to load all values from Model in
        //       array, just to check couple of posted values.
        //       Probably we should do SELECT * FROM t WHERE id IN ($values) or
        //       something like that to limit array size and time spent on
        //       parsing all DB records in Model.
        $this->getValueList();

        $values = explode($this->separator, $this->value);
        foreach ($values as $v) {
            if (!isset($this->value_list[$v])) {
                $this->displayFieldError("Value $v is not one of the offered values");

                return $this->validate();
            }
        }
    }
482650
public function isValid() {
		
		$params = $this -> getParameters();
		$file 	= $this -> getFile();
		$info 	= (object) pathinfo($file['name']);
		$params = array_map(function($value) {

			if(false === is_string($value)) {
				return trigger_error(sprintf('Extension passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($value)), E_USER_ERROR);
			}

			return ltrim(strtolower($value), '.');
		}, $params);

		if(true === isset($info -> extension) && false === in_array($info -> extension, $params)) {
			return true;
		}

		return false;
	}
396350
public function validate()
    {
        $result = true;
        $this->errors = [];
        $data = $this->get();

        foreach ($this->requiredFields as $requiredField) {
            if (!isset($data[$requiredField])) {
                $result = false;
                $this->errors[$requiredField] = 'cannot be empty';
            }
        }

        foreach ($data as $fieldName => $fieldValue) {
            if (!array_key_exists($fieldName, $this->errors) && $fieldValue !== null && !is_string($fieldValue)) {
                $this->errors[$fieldName] = 'should be a string';
            }
        }

        return $result;
    }
34573
public function isValid()
    {
        $value = $this->field->getValue();

        // no file uploaded?
        if (!$value || !isset($value['error']) || $value['error'] == UPLOAD_ERR_NO_FILE) {
            $this->setErrorMessage($this->messages['required']);
            // required ?
            return !$this->required;
        }

        // check the uploaded file
        switch ($value['error']) {
            case UPLOAD_ERR_OK:
                break;

            case UPLOAD_ERR_FORM_SIZE:
            case UPLOAD_ERR_INI_SIZE:
                $this->setErrorMessage($this->messages['file_too_big']);
                return false;

            case UPLOAD_ERR_PARTIAL:
                $this->setErrorMessage($this->messages['incomplete']);
                return false;

            case UPLOAD_ERR_NO_TMP_DIR:
            case UPLOAD_ERR_CANT_WRITE:
                $this->setErrorMessage($this->messages['cannot_write']);
                return false;

            case UPLOAD_ERR_EXTENSION:
            default:
                $this->setErrorMessage($this->messages['error']);
                return false;
        }

        /**
         * if here, the file was uploaded.
         * Validate the uploaded file against our settings (blacklist, whitelist, etc)
         */

        // retrieve the extension
        if (!$this->isExtensionAllowed($value['name'])) {
            $this->setErrorMessage(sprintf($this->messages['wrong_extension'], implode(',', $this->allowedExtensions)));
            return false;
        }

        if (!$this->isMimetypeAllowed($value['tmp_name'], $value['type'])) {
            $this->setErrorMessage($this->messages['wrong_type']);
            return false;
        }

        $size = filesize($value['tmp_name']);

        // validate the upload file size
        if ($this->maxFilesize && $size > $this->maxFilesize) {
            $this->setErrorMessage(sprintf($this->messages['file_larger_then'], $this->maxFilesize / 1024));
            return false;
        }
        if ($this->minFilesize && $size < $this->minFilesize) {
            $this->setErrorMessage(sprintf($this->messages['file_smaller_then'], $this->minFilesize / 1024));
            return false;
        }

        // if here, the extension and the mime type are validated! The file is good!
        return true;
    }
578835
public final function verifySetData(){

        foreach($this->data as $k => $v){
            $this->verifyData($k);
        }//foreach

        if(count($this->errors)){
            return false;
        }//if

        return true;

    }
271129
protected function validate_files_layout() {

        if (!is_array($this->extractfiles) or count($this->extractfiles) < 4) {
            // We need the English language pack with the name of the plugin at least.
            $this->add_message(self::ERROR, 'filesnumber');
            return false;
        }

        foreach ($this->extractfiles as $filerelname => $filestatus) {
            if ($filestatus !== true) {
                $this->add_message(self::ERROR, 'filestatus', array('file' => $filerelname, 'status' => $filestatus));
                return false;
            }
        }

        foreach (array_keys($this->extractfiles) as $filerelname) {
            if (!file_exists($this->extractdir.'/'.$filerelname)) {
                $this->add_message(self::ERROR, 'filenotexists', array('file' => $filerelname));
                return false;
            }
        }

        foreach (array_keys($this->extractfiles) as $filerelname) {
            $matches = array();
            if (!preg_match("#^([^/]+)/#", $filerelname, $matches)
                    or (!is_null($this->rootdir) and $this->rootdir !== $matches[1])) {
                $this->add_message(self::ERROR, 'onedir');
                return false;
            }
            $this->rootdir = $matches[1];
        }

        if ($this->rootdir !== clean_param($this->rootdir, PARAM_PLUGIN)) {
            $this->add_message(self::ERROR, 'rootdirinvalid', $this->rootdir);
            return false;
        } else {
            $this->add_message(self::INFO, 'rootdir', $this->rootdir);
        }

        return is_dir($this->extractdir.'/'.$this->rootdir);
    }
924078
protected function validateUpload()
    {
        $file = $this->request->file('file');

        if (empty($file)) {
            $this->setError('file', $this->text('Nothing to install'));
            return false;
        }

        $result = $this->file_transfer->upload($file, 'zip', gplcart_file_private_module('installer'));

        if ($result !== true) {
            $this->setError('file', $result);
            return false;
        }

        $this->setSubmitted('file', $this->file_transfer->getTransferred());
        return !$this->hasErrors();
    }
1184328
public function verifyModuleStructure(){
		// Check Model Path
		$isValid = $this->verifyPath(dirname($this->getNames()->modelPath));
		
		// Check Entity Path
		$isValid = $isValid && $this->verifyPath(dirname($this->getNames()->entityPath));
		
		//$moduleFile = "{$this->getNames()->modulePath}/Module.php";
		
		return $isValid;
	}
1237609
protected function hasModule()
    {
        global $post;

        $postId = null;
        $modules = array();
        $archiveSlug = \Modularity\Helper\Wp::getArchiveSlug();

        if ($archiveSlug) {
            $postId = $archiveSlug;
        } elseif (isset($post->ID)) {
            $postId = $post->ID;
        } else {
            return apply_filters('Modularity/hasModule', false, null);
        }

        $modules = \Modularity\Editor::getPostModules($postId);
        $modules = array_merge($modules, $this->getShortcodeModules($postId));
        $modules = array_merge($modules, $this->getOnePageModules($postId));

        $modules = json_encode($modules);

        $moduleSlug = $this->moduleSlug;
        if (empty($moduleSlug)) {
            $moduleSlug = isset($this->data['post_type']) ? $this->data['post_type'] : null;
        }

        return apply_filters('Modularity/hasModule', strpos($modules, '"post_type":"' . $moduleSlug . '"') == true, $archiveSlug);
    }
905037
protected function validateFile()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->file->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('File'));
            return false;
        }

        $this->setSubmitted('update', $data);
        return true;
    }
584496
public function isValid()
    {
        if (null === $this->_isValid) {
            $this->_isValid = false;

            if (null !== $data_object = $this->getDataObject()) {
                if (true === property_exists($data_object, 'templateLayouts')
                        && true === is_array($data_object->templateLayouts)
                        && 0 < count($data_object->templateLayouts)) {
                    $this->_isValid = true;

                    foreach ($data_object->templateLayouts as $zone) {
                        if (false === property_exists($zone, 'id')
                                || false === property_exists($zone, 'defaultContainer')
                                || false === property_exists($zone, 'target')
                                || false === property_exists($zone, 'gridClassPrefix')
                                || false === property_exists($zone, 'gridSize')) {
                            $this->_isValid = false;
                            break;
                        }
                    }
                }
            }
        }

        return $this->_isValid;
    }
855141
private function validate() {
        $filterer = new Filterer();
        $valid = true;
        foreach ($this->elements as $element) {
            if (!$element->validate($filterer, $this->data))
                $valid = false;
            $this->data[$element->name] = ($element->type === 'fieldset') ?
                    $element->options->value->getData(true) : $element->data;
        }
        $this->valid = $valid;
        return $valid;
    }
77744
public function validate()
    {
        $multipleUploads = false;
        if (strval($this->multiple) != '') {
            $field = str_replace('[]', '', $this->name);
            if (isset($_FILES[$field]['name'][0]) && strlen($_FILES[$field]['name'][0]) > 0) {
                $multipleUploads = true;
            }
        }

        if (!$this->checkValue($multipleUploads)) {
            return false;
        }

        $validator = $this->getValidator();
        $this->callValidator($validator);

        if ($this->customError) {
            return false;
        }

        return true;
    }
129772
public function doValidate()
    {
        $isValid = true;
        if ($this->props['validate']) {
            $isValid = \call_user_func($this->props['validate'], $this);
        }
        return $isValid;
    }
129595
public function validate(): bool
    {
        foreach ($this->_properties as $v) {
            if ($v instanceof SpecObjectInterface) {
                $v->validate();
            } elseif (is_array($v)) {
                foreach ($v as $item) {
                    if ($item instanceof SpecObjectInterface) {
                        $item->validate();
                    }
                }
            }
        }
        $this->performValidation();
        return \count($this->getErrors()) === 0;
    }