text form用のお薦め設定を返します。

@param	array	$current_rule	追加したいvalidation rule
@return	array	お薦め設定
162168
public function text ($current_rule = [], $is_array = false) {
		return array_merge([
			['require', 'raise_exception' => true],
			['not_string_empty', 'is_array' => $is_array, 'is_last' => true],
		], $is_array ? $this->adjustOption($current_rule, 'is_array', $is_array) : $current_rule);
	}
802314
public function getTextSettings()
    {
        $messages = array(
            'gaf_id' => $this->_('Sub filter may not be the same as this filter.'),
            $this->_('Filters may be chosen only once.')
                );

        return array(
            'gaf_filter_text1' => array(
                'label'        => $this->_('Filter 1'),
                'elementClass' => 'Select',
                'multiOptions' => $this->_filters,
                'required'     => true,
                'validator'    => new \MUtil_Validate_NotEqualTo('gaf_id', $messages),
                ),
            'gaf_filter_text2' => array(
                'label'        => $this->_('Filter 2'),
                'elementClass' => 'Select',
                'multiOptions' => $this->_filters,
                'required'     => true,
                'validator'    => new \MUtil_Validate_NotEqualTo(array('gaf_id', 'gaf_filter_text1'), $messages),
                ),
            'gaf_filter_text3' => array(
                'label'        => $this->_('Filter 3'),
                'elementClass' => 'Select',
                'multiOptions' => $this->_filters,
                'validator'    => new \MUtil_Validate_NotEqualTo(
                        array('gaf_id', 'gaf_filter_text1', 'gaf_filter_text2'),
                        $messages
                        ),
                ),
            'gaf_filter_text4' => array(
                'label'        => $this->_('Filter 4'),
                'elementClass' => 'Select',
                'multiOptions' => $this->_filters,
                'validator'    => new \MUtil_Validate_NotEqualTo(
                        array('gaf_id', 'gaf_filter_text1', 'gaf_filter_text2', 'gaf_filter_text3'),
                        $messages
                        ),
                ),
            );
    }
566320
public function getValidationMessage(): array{
        $fields = [];
        foreach ($this->validations as $validation) {
            /* @var Validation $validation */
            if ($validation->getStatus() == Validation::ERROR) {
                if (!isset($fields[$validation->getField()])) {
                    $fields[$validation->getField()] = [];
                }
                var_dump($validation->getMessage());
                array_push($fields[$validation->getField()], $validation->getMessage());
            }
        }
        return $fields;
    }
140664
function import( array $current_import ) {

		try {
			$this->isValidZip( $current_import['file'] );
		} catch ( \Exception $e ) {
			return false;
		}

		$xml = $this->getZipContent( 'content.xml' );
		$meta = $this->getZipContent( 'meta.xml' );

		// introduce a stylesheet
		$proc = new \XSLTProcessor();
		$xsl = new \DOMDocument();
		$xsl->load( __DIR__ . '/xsl/odt2html.xsl' );
		$proc->importStylesheet( $xsl );

		// throw it back into the DOM
		$dom_doc = $proc->transformToDoc( $xml );

		if ( $meta ) {
			$this->parseMetaData( $meta );
		}

		$chapter_parent = $this->getChapterParent();

		foreach ( $current_import['chapters'] as $id => $chapter_title ) {
			// do nothing it has been omitted
			if ( ! $this->flaggedForImport( $id ) ) {
				continue;
			}

			$html = $this->parseContent( $dom_doc, $chapter_title );
			$this->kneadAndInsert( $html, $chapter_title, $this->determinePostType( $id ), $chapter_parent, $current_import['default_post_status'] );
		}

		// Done
		return $this->revokeCurrentImport();
	}
1172265
public function current()
    {
        $part  = substr($this->string, ($this->index * $this->count), $this->count);
        $chars = array_pad(str_split($part), $this->count, 0);

        return [
            'r' => $chars[0],
            'g' => $chars[1],
            'b' => $chars[2],
        ];
    }
1167171
protected function getValidationRulesFromElements(array $rules = [])
    {
        $this->getElements()->onlyActive()->each(function ($element) use (&$rules) {
            $element = $this->getElementContainer($element);

            if ($element instanceof Validable) {
                $rules += $element->getValidationRules();
            }
        });

        return $rules;
    }
1348758
public function getMessageRules()
    {
        $rules = [];
        $rules = array_merge($rules, $this->getMutualRules());
        if (is_string($this->attachmentAttribute) && !empty($this->attachmentAttribute)) {
            $rules[] = [$this->attachmentAttribute, 'safe'];
        }
        if (is_string($this->receivedAtAttribute) && !empty($this->receivedAtAttribute)) {
            $rules[] = [$this->receivedAtAttribute, 'safe'];
        }
        if (is_string($this->readAtAttribute) && !empty($this->readAtAttribute)) {
            $rules[] = [$this->readAtAttribute, 'safe'];
        }
        return $rules;
    }
1052268
public function getDetailMessages()
    {
        $messages = array();
        foreach ($this->invalidRules as $field => $rules) {
            foreach ($rules as $rule) {
                $messages[$field][$rule] = $this->ruleValidators[$field][$rule]->getMessages();
            }
        }
        return $messages;
    }
106390
public function rules()
	{
		$args = func_get_args();

		$key = array_shift( $args );

		if ( !is_array( reset( $args ) ) )
		{
			$rules = $args;
		}
		else 
		{
			$rules = array_shift( $args );
		}

		$success = true;

		foreach( $rules as $rule )
		{
			$rule = explode( ':', $rule );
			$params = array();

			if ( array_key_exists( 1, $rule ) )
			{
				$params = explode( ',', $rule[1] );
			}

			$rule = reset( $rule );

			array_unshift( $params, $key );

			if ( !call_user_func_array( array( $this, $rule ), $params ) )
			{
				$success = false;
			}
		}

		return $success;
	}
890492
public function validateRules()
    {
        $input = request()->all();
        $rules = [];
        $messages = [];

        if ($this->formRequest) {
            $this->formRequest = new $this->formRequest;
            $rules = $this->formRequest->rules();
            $messages = $this->formRequest->messages();
        }

        return Validator::make($input, $rules, $messages);
    }
476291
public function getValidatorMessages()
    {
        $messages = [];
        
        foreach ($this->owner->getValidatorRules() as $rule) {
            
            if ($rule->hasMessage()) {
                $messages[$rule->getType()] = $rule->getMessage();
            }
            
        }
        
        return $messages;
    }
109072
public function rules()
    {

        // Start with a default rules array for the
        // role_id check
        $rules = [
            'role_id' => 'required|exists:roles,id',
            'inverse' => 'nullable|in:on',
        ];

        // Ensure that the permissions is set, if not,
        // complain that it is actually required
        if (! $this->request->get('permissions')) {

            $rules['permissions'] = 'required';

            return $rules;

        }

        // Add each permission in the multi select dynamically
        foreach ($this->request->get('permissions') as $key => $value)

            // Permissions can be written in . notation. If this is
            // the case, we need to build the filter so that the
            // actual value we got from the form request exists in the
            // 'in' constraint on the validation rules. We do this by
            // running array map on the categorized permissions and
            // appending the category to the rule to match the value
            // the form request would have sent.
            if (str_contains($value, '.')) {

                $category = explode('.', $value)[0];

                $rules['permissions.' . $key] = 'required|in:' .
                    implode(',', array_filter(
                        array_map(function ($web_perm) use ($category) {

                            return $category . '.' . $web_perm;

                        }, config('web.permissions.' . $category))));

            } else {

                // If the string does not have . notation,
                // then we can assume its flat and no category needs
                // appending to the permission name
                $rules['permissions.' . $key] = 'required|in:' .
                    implode(',', array_filter(
                        array_map(function ($web_perm) {

                            // If the permission is an array, then
                            // we just return null
                            if (is_array($web_perm))
                                return null;

                            return $web_perm;

                        }, config('web.permissions'))));
            }

        return $rules;
    }
928844
protected function validateForm()
    {
        if (2 == $this->currentStep) {
            return true;
        }
        // Note we use an MUtil_Form
        return $this->_form->isValid($this->formData, $this->disableValidatorTranslation);
    }
1068975
public function current()
    {
        $full_current = [];

        foreach ($this->style as $style) {
            $full_current = array_merge($full_current, Helper::toArray($style->current()));
        }

        $full_current = array_filter($full_current);

        return array_values($full_current);
    }
1241545
public function get_mform_set_data() {
        if (!empty($this->rule)) {
            $rule = fullclone($this->rule);
            $rule->description = array('text' => $rule->description, 'format' => $rule->descriptionformat);
            $rule->template = array('text' => $rule->template, 'format' => $rule->templateformat);
            return $rule;
        }
        throw new \coding_exception('Invalid call to get_mform_set_data.');
    }
1277961
protected function validatePost()
    {
        $oFormValidation = Factory::service('FormValidation');

        $aRules = [
            'ref'             => 'trim',
            'state'           => 'trim|required',
            'dated'           => 'trim|required|valid_date',
            'currency'        => 'trim|required|callback__callbackValidCurrency',
            'terms'           => 'trim|is_natural',
            'customer_id'     => 'trim',
            'additional_text' => 'trim',
            'items'           => '',
        ];

        $aRulesFV = [];
        foreach ($aRules as $sKey => $sRules) {
            $aRulesFV[] = [
                'field' => $sKey,
                'label' => '',
                'rules' => $sRules,
            ];
        }

        $oFormValidation->set_rules($aRulesFV);

        $oFormValidation->set_message('required', lang('fv_required'));
        $oFormValidation->set_message('valid_date', lang('fv_valid_date'));
        $oFormValidation->set_message('is_natural', lang('fv_is_natural'));
        $oFormValidation->set_message('valid_email', lang('fv_valid_email'));

        return $oFormValidation->run($this);
    }
550515
public function getValidAttribs()
    {
        return array_combine(
            array_keys($this->validAttribs),
            array_map(function ($ref) {
                return $ref['attrib'];
            }, array_values($this->validAttribs))
        );
    }