/home/techb158/l2hypotheques.com/wp-content/plugins/wpforms-lite/src/Helpers
Edit: /home/techb158/l2hypotheques.com/wp-content/plugins/wpforms-lite/src/Helpers/Transient.php (7521B)
query(
$wpdb->prepare(
"DELETE FROM $wpdb->options
WHERE option_name LIKE %s",
$wpdb->esc_like( self::OPTION_PREFIX ) . '%'
)
);
}
/**
* Delete all expired WPForms transients.
*
* The multi-table delete syntax is used to delete the transient record
* from table 'a', and the corresponding transient_timeout record from table 'b'.
*
* @since 1.6.3.1
*
* @return int|false Number of rows affected/selected or false on error
*/
public static function delete_all_expired() {
global $wpdb;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
return $wpdb->query(
$wpdb->prepare(
"DELETE a, b FROM $wpdb->options a, $wpdb->options b
WHERE a.option_name LIKE %s
AND a.option_name NOT LIKE %s
AND b.option_name = CONCAT( %s, SUBSTRING( a.option_name, %d ) )
AND b.option_value < %d",
$wpdb->esc_like( self::OPTION_PREFIX ) . '%',
$wpdb->esc_like( self::TIMEOUT_PREFIX ) . '%',
self::TIMEOUT_PREFIX,
strlen( self::OPTION_PREFIX ) + 1,
time()
)
);
}
/**
* Check if transient is expired.
*
* @since 1.6.3.1
*
* @param string $transient Transient name. Expected to not be SQL-escaped.
*
* @return bool true if expired, false otherwise
*/
public static function is_expired( $transient ) {
$timeout = self::get_timeout( $transient );
// If there's no timeout data found, the transient is considered to be valid.
if ( $timeout === false ) {
return false;
}
if ( $timeout >= time() ) {
return false;
}
return true;
}
/**
* Get a transient option value.
*
* @since 1.6.3.1
*
* @param string $transient Transient name. Expected to not be SQL-escaped.
*
* @return mixed Value set for the option.
*/
private static function get_option( $transient ) {
return get_option( self::OPTION_PREFIX . $transient );
}
/**
* Get a transient timeout option value.
*
* @since 1.6.3.1
*
* @param string $transient Transient name. Expected to not be SQL-escaped.
*
* @return mixed Value set for the option.
*/
private static function get_timeout( $transient ) {
return get_option( self::TIMEOUT_PREFIX . $transient );
}
}