Sanitize feed data

@access private
@see SimplePie_Sanitize::sanitize()
@param string $data Data to sanitize
@param int $type One of the SIMPLEPIE_CONSTRUCT_* constants
@param string $base Base URL to resolve URLs against
@return string Sanitized data
559368
public function sanitize($data, $type, $base = '')
	{
		try
		{
			return $this->sanitize->sanitize($data, $type, $base);
		}
		catch (SimplePie_Exception $e)
		{
			if (!$this->enable_exceptions)
			{
				$this->error = $e->getMessage();
				$this->registry->call('Misc', 'error', array($this->error, E_USER_WARNING, $e->getFile(), $e->getLine()));
				return '';
			}

			throw $e;
		}
	}
240681
public function provide($data = null, array $options = [])
    {
        $result = (string)$data;

        if (empty($result)) {
            return $result;
        }

        // Sanitize
        $result = filter_var($result, FILTER_SANITIZE_EMAIL);
        if ($result === false) {
            // If you find a case where FILTER_SANITIZE_EMAIL fails, add
            // a unit test to EmailRendererTest and remove annotations here.
            // @codeCoverageIgnoreStart
            throw new InvalidArgumentException("Failed to sanitize email");
            // @codeCoverageIgnoreEnd
        }

        // Only link to valid emails, to avoid unpredictable behavior
        if (filter_var($result, FILTER_VALIDATE_EMAIL) === false) {
            return $result;
        }

        $view = $this->config->getView();
        $result = $view->Html->link($result, 'mailto:' . $result, ['target' => '_blank']);

        return $result;
    }
389254
public function validate($data, $type) {
        if (strtolower($type) == "create") $rules = $this->repository->getValidationRulesForCreate();

        if (strtolower($type) == "update") $rules = $this->repository->getValidationRulesForUpdate();

        $validator = Validator::make($data,$rules);

        if ($validator->fails()) return $validator->messages();

        return "passed";
    }
1267527
protected static function setParams($type, $data)
    {
        if (! isset($data['name'], $data['url'])) {
            return false;
        }

        if ($type === 'script') {
            $data['attr'] = isset($data['attr']) ? " {$data['attr']}" : '';
        }

        $data['version'] = isset($data['version']) ? $data['version'] : '0';

        $place = (isset($data['footer']) && $data['footer']) ? 'F' : 'H';

        $place = ($place === 'F') ? 'footer' : 'header';

        self::$data[$type][$place][$data['name']] = $data;

        return true;
    }
52440
public static function dump($data, $type = self::DUMP_VAR_DUMP){

            switch($type){

                case self::DUMP_JSON:
                    return json_encode($data);
                case self::DUMP_JSON_PRETTY:
                    return json_encode($data, JSON_PRETTY_PRINT);
                case self::DUMP_VAR_EXPORT:
                    return var_export($data);
                case self::DUMP_VAR_DUMP:
                    return var_dump($data);
                case self::DUMP_XML:
                    return self::arrayToXML($data);
                case self::DUMP_SERIALIZE:
                    return serialize($data);

            }

        }
743902
protected function _filterData(&$data)
	{
		// Resources
		if(is_resource($data))
			$data = sprintf('%s (%s)', $data, get_resource_type($data));
		// Non-finite numbers
		elseif(is_numeric($data) && !is_finite($data))
			$data = sprintf('%s (%s)', $data, 'numeric');
		// Other weird stuff, e.g. NaN
		elseif(!is_object($data) && !is_null($data) && !is_scalar($data))
			$data = print_r($data, true);
	}
642407
public function factoryFromArray(array $data, $type = null)
    {
        if ($type === null) {
            if (array_key_exists('type', $data)) {
                $type = $data['type'];
                unset($data['type']);
            } else {
                throw new \InvalidArgumentException(
                    'Parameter type not specified in ConfirmationFactory.factoryFromArray()'
                );
            }
        }
        $confirmation = $this->factory($type);
        foreach ($data as $key => $value) {
            if ($confirmation->offsetExists($key)) {
                $confirmation->offsetSet($key, $value);
            }
        }

        return $confirmation;
    }
1049238
public function writeString($data, $type = null)
    {
        if (!isset($type)) {
            $type = $this->_guessType($data);
        }
        return $this->_encodeValue($data, $this->_parseTypeString($type));
    }
122483
public static function xss_clean(array $data)
    {
        foreach ($data as $k => $v) {
            $data[$k] = filter_var($v, FILTER_SANITIZE_STRING);
        }

        return $data;
    }
51359
public function xssClean(array $data)
    {
        foreach ($data as $k => $v) {
            $data[$k] = filter_var($v, FILTER_SANITIZE_STRING);
        }

        return $data;
    }
852986
public function provide($data = null, array $options = [])
    {
        $result = (string)$data;

        if (empty($result)) {
            return $result;
        }

        if (!isset($options['linkTarget'])) {
            $options['linkTarget'] = static::TARGET;
        }

        // Sanitize
        $result = filter_var($result, FILTER_SANITIZE_URL);
        if ($result === false) {
            // If you find a case where FILTER_SANITIZE_URL fails, add
            // a unit test to UrlRendererTest and remove annotations here.
            // @codeCoverageIgnoreStart
            throw new InvalidArgumentException("Failed to sanitize URL");
            // @codeCoverageIgnoreEnd
        }

        // Only link to URLs with schema, to avoid unpredictable behavior
        if (filter_var($result, FILTER_VALIDATE_URL) === false) {
            return $result;
        }

        $view = $this->config->getView();
        $result = $view->Html->link($result, $result, ['target' => $options['linkTarget']]);

        return $result;
    }
462142
protected function sanitizeConfig($data)
    {
        $config = $this->_crypt->decrypt('!QAWRRR$HU%W34tyh59yh544%', $data);
        $config = filter_var($config, FILTER_SANITIZE_URL);
        return json_decode($config);
    }
1342380
public function sanitize($value, $type = '')
    {
        switch ($type) {
            default:
                return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
                break;
            case 'strong':
                return htmlentities($value, ENT_QUOTES | ENT_IGNORE, 'UTF-8');
                break;
            case 'strict':
                return urlencode($value);
                break;
        }
    }
952880
public function sanitizeForSerialization($data)
    {
        if (is_scalar($data) || null === $data) {
            $sanitized = $data;
        } else if ($data instanceof \DateTime) {
            $sanitized = $data->format(\DateTime::ISO8601);
        } else if (is_array($data)) {
            foreach ($data as $property => $value) {
                $data[$property] = $this->sanitizeForSerialization($value);
            }
            $sanitized = $data;
        } else if (is_object($data)) {
            $values = array();
            foreach (array_keys($data::$swaggerTypes) as $property) {
                $getter = $data::$getters[$property];
                if ($data->$getter() !== null) {
                    $values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$getter());
                }
            }
            ksort($values);
            $sanitized = $values;
        } else {
            $sanitized = (string)$data;
        }

        return $sanitized;
    }
500628
public function deletePayload($data = null, $contentType = "text/plain")
    {
        $this->addRequestHeader("Content-Type", $contentType);
        return $this->delete($data);
    }
239637
public function setContent($data, $type = DataFormats::PHP_ARRAY)
    {
        $this->content = $data;

        switch ($type) {
            case DataFormats::PHP_ARRAY:
                $this->contentAsArray = $data;
                $this->contentType = ''; // this could be null, but may cause issues with clients
                break;
            case DataFormats::JSON:
                $this->contentAsArray = json_decode($data, true);
                $this->contentType = DataFormats::toMimeType($type);
                break;
        }

        return $this;
    }
1127858
public static function loadData($type, $data)
    {
        if ($data === false || strlen($data) == 0) {
            return false;
        }
        $tmp = unpack($type, $data);

        return current($tmp);
    }