Sanitizes select control values.

@access public
@since 1.0
@param array $value The value.
@return string|array
357070
public function sanitize( $value ) {
		if ( is_array( $value ) ) {
			foreach ( $value as $key => $subvalue ) {
				if ( '' !== $subvalue || isset( $this->choices[''] ) ) {
					$key           = sanitize_key( $key );
					$value[ $key ] = sanitize_text_field( $subvalue );
				}
			}
			return $value;
		}
		return sanitize_text_field( $value );
	}
925349
public function sanitizeValue()
    {
        $strColNameId    = $this->objAttribute->get('tag_id') ?: 'id';
        $strColNameAlias = $this->objAttribute->get('tag_alias');
        $arrValues       = \is_array($this->value) ? $this->value : \explode(',', $this->value);

        if (!$this->isMetaModel()) {
            if ($strColNameAlias) {
                $builder = $this->connection->createQueryBuilder()
                    ->select($strColNameId)
                    ->from($this->objAttribute->get('tag_table'));
                foreach ($arrValues as $index => $value) {
                    $builder
                        ->orWhere($strColNameAlias . ' LIKE :value_' . $index)
                        ->setParameter('value_' . $index, $value);
                }
                $arrValues = $builder->execute()->fetchAll(\PDO::FETCH_COLUMN);
            } else {
                $arrValues = \array_map('intval', $arrValues);
            }
        } else {
            if ($strColNameAlias == 'id') {
                $values = $arrValues;
            } else {
                $values = [];
                foreach ($arrValues as $value) {
                    $values[] = \array_values(
                        $this->getTagMetaModel()->getAttribute($strColNameAlias)->searchFor($value)
                    );
                }
            }

            $arrValues = $this->flatten($values);
        }

        return $arrValues;
    }
1045968
public static function sanitize( $value ) {
		if ( class_exists( '\Kirki\Field\Color' ) ) {
			return \Kirki\Field\Color::sanitize( $value );
		}
		return esc_attr( $value );
	}
493324
protected function _sanitize($value)
    {
        $value = (string) $value;

        // Filter var for XSS and other 'bad' code etc.
        if (!empty($value)) {
            $value = $this->_remove($this->_decode($value));
        }

        return $value;
    }
1072529
protected function _cleanValue($value, $trim = false)
    {
        $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
        return ($trim) ? trim($value) : $value;
    }
397796
public function sanitize_email_type( $value ) {
		$value = trim( (string) $value );
		$new_value = '';

		if ( in_array( $value, [ 'html', 'text' ], true ) ) {
			$new_value = $value;
		}

		if ( ! $new_value ) {
			add_settings_error(
				'soter_email_type',
				'invalid_soter_email_type',
				sprintf(
					'Email type must be one of "text" or "html" - "%s" given.',
					esc_html( $value )
				)
			);

			return $this->email_type;
		}

		return $new_value;
	}
224289
protected function stringDecode($value)
    {
        // Handle empty case
        if (empty($value)) {
            return array();
        }

        // If json deserialisation fails, then fallover to legacy format
        $result = json_decode($value, true);
        if ($result !== false) {
            return $result;
        }

        throw new \InvalidArgumentException("Invalid string encoded value for multi select field");
    }
800980
public static function clean($value) {
    if (!get_magic_quotes_gpc() && !self::$forceStripSlashes) return $value;
    
    return is_array($value) ?
            array_map(array('GPC','clean'), $value) :
            stripslashes($value);
  }
293228
public function sanitize($value)
    {
        $value = (string) $value;

        if (!empty($value)) {
            $value = JComponentHelper::filterText($value);
        }

        return $value;
    }
922897
public static function sanitize( $value ) {
		if ( ! is_array( $value ) ) {
			return [];
		}
		foreach ( $value as $key => $val ) {
			$value[ $key ] = Color::sanitize( $val );
		}
		return $value;
	}
310651
protected function sanitizeValue($str)
    {
        if (is_array($str)) {
            foreach ($str as &$value) {
                $value = $this->sanitizeValue($value);
            }
            unset($value);

            return $str;
        }

        $str = filter_var((string) $str, FILTER_UNSAFE_RAW, array('flags' => FILTER_FLAG_STRIP_LOW));
        $str = trim($str);

        return $str;
    }
1181812
public static function sanitizeInputValue($value)
    {
        $value = self::sanitizeLineBreaks($value);
        $value = self::sanitizeString($value);
        return $value;
    }
554971
protected function cleanValueFrom($name, $value, array &$values = [])
    {
        if (str_contains($name, '[')) {
            $name = str_replace(['][', '[', ']', '..'], ['.', '.', '', '.*.'], $name);
        }
        array_set($values, str_replace('.*', '.0', $name), $value);
    }
747878
public static function sanitizeCategoryName($value)
    {
        $output = preg_replace('/\s+/', '-', trim($value));
        $output = preg_replace('/[^a-z0-9\-]/', '',  strtolower($output));
        $output = preg_replace('/^[0-9\-_]+/', '',  strtolower($output));
        return substr($output, 0, 32);
    }
1074131
public static function FILTER_SANITIZE_GEO($value)
	{
		// http://www.regexlib.com/REDetails.aspx?regexp_id=2728
		$value = preg_replace('/,/', '.', $value);
		$value = preg_replace('/(.+)\.(\d{1,6}).*/', '$1.$2', $value);
		return preg_match('/^-?([1-8]?[0-9]\.{1}\d{1,6}$|90\.{1}0{1,6}$)/', $value)?$value:null;
	}
1321518
public function sanitize($value)
    {
        if(!$value instanceof ObjectConfigJson)
        {
            if(is_string($value)) {
                $value = $this->getObject('object.config.factory')->fromString('json', $value);
            } else {
                $value = $this->getObject('object.config.factory')->createFormat('json', $value);
            }
        }

        return $value;
    }
344561
private function prepareRow($value)
    {
        if (is_array($value) and count($value) === 1) {
            $value = array_shift($value);
        }

        return $value;
    }