HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/delta/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/system.php
<?php

namespace WPML\FP\System;

/**
 * Returns a filter function to filter a collection by the given key
 * Use like:
 * $theCollection->map( getFilterFor( 'my-key' )->using( santatizeString() )->defaultTo( '' ) )
 * This will filter the collection item with a key of 'my-key' using the 'FILTER_SANITIZE_STRING'.
 * If the key doesn't exist it defaults to an empty string.
 *
 * defaultTo can be a value or a callable that returns a value
 *
 * @param string $key
 *
 * @return _Filter
 */
function getFilterFor( $key ) {
	return new _Filter( $key );
}

/**
 * Returns a function of the defined type that can then be used to map
 * over a variable.
 *
 * @param int $filter - Filter type same as for php filter_var function
 *
 * @return \Closure
 */
function filterVar( $filter ) {
	return function ( $var ) use ( $filter ) {
		return filter_var( $var, $filter );
	};
}

/**
 * returns a function that will sanitize a string.
 * @return \Closure
 */
function sanitizeString( $flags = ENT_QUOTES ) {
	return function( $value ) use ( $flags ) {
		return is_string( $value ) || is_numeric( $value )
			? str_replace( '&amp;', '&', htmlspecialchars( strip_tags( $value ), $flags ) ) : false;
	};
}

/**
 * Returns a validator function to filter a collection by the given key
 * Use like:
 * map( getValidatorFor( 'my-key' )->using( Logic::isNotNull() )->error( 'It was false' ) ), $myCollection)
 * This will run the validator on the collection item with a key of 'my-key' and return Either::Right
 * containing the given collection or Either::Left containing the error depending if the supplied
 * using function returns true or false
 *
 * error can be a value or a callable that returns a value
 *
 * @param string $key
 *
 * @return _Validator
 */
function getValidatorFor( $key ) {
	return new _Validator( $key );
}