HEX
Server: Apache/2
System: Linux host.jethost.pl 4.19.0-26-amd64 #1 SMP Debian 4.19.304-1 (2024-01-09) x86_64
User: frigodor (1049)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname,mail
Upload Files
File: /home/frigodor/domains/frigodor.pl/public_html/wp-content/plugins/polylang/include/db-tools.php
<?php
/**
 * @package Polylang
 */

defined( 'ABSPATH' ) || exit;

/**
 * Small set of tools to work with the database.
 *
 * @since 3.2
 */
class PLL_Db_Tools {

	/**
	 * Changes an array of values into a comma separated list, ready to be used in a `IN ()` clause.
	 * Only string and integers and supported for now.
	 *
	 * @since 3.2
	 *
	 * @param (int|string)[] $values An array of values.
	 * @return string A comma separated list of values.
	 */
	public static function prepare_values_list( $values ) {
		$values = array_map( array( __CLASS__, 'prepare_value' ), (array) $values );

		return implode( ',', $values );
	}

	/**
	 * Wraps a value in escaped double quotes or casts as an integer.
	 * Only string and integers and supported for now.
	 *
	 * @since 3.2
	 *
	 * @global wpdb $wpdb
	 *
	 * @param int|string $value A value.
	 * @return int|string
	 */
	public static function prepare_value( $value ) {
		if ( ! is_numeric( $value ) ) {
			return $GLOBALS['wpdb']->prepare( '%s', $value );
		}

		return (int) $value;
	}
}