Current File : /home/bdmcricketindia.in/public_html/wp-includes/class-wp-application-passwords.php
<?php
/**
 * WP_Application_Passwords class
 *
 * @package WordPress
 * @since   5.6.0
 */

/**
 * Class for displaying, modifying, and sanitizing application passwords.
 *
 * @package WordPress
 */
#[AllowDynamicProperties]
class WP_Application_Passwords {

	/**
	 * The application passwords user meta key.
	 *
	 * @since 5.6.0
	 *
	 * @var string
	 */
	const USERMETA_KEY_APPLICATION_PASSWORDS = '_application_passwords';

	/**
	 * The option name used to store whether application passwords are in use.
	 *
	 * @since 5.6.0
	 *
	 * @var string
	 */
	const OPTION_KEY_IN_USE = 'using_application_passwords';

	/**
	 * The generated application password length.
	 *
	 * @since 5.6.0
	 *
	 * @var int
	 */
	const PW_LENGTH = 24;

	/**
	 * Checks if application passwords are being used by the site.
	 *
	 * This returns true if at least one application password has ever been created.
	 *
	 * @since 5.6.0
	 *
	 * @return bool
	 */
	public static function is_in_use() {
		$network_id = get_main_network_id();
		return (bool) get_network_option( $network_id, self::OPTION_KEY_IN_USE );
	}

	/**
	 * Creates a new application password.
	 *
	 * @since 5.6.0
	 * @since 5.7.0 Returns WP_Error if application name already exists.
	 * @since 6.8.0 The hashed password value now uses wp_fast_hash() instead of phpass.
	 *
	 * @param int   $user_id  User ID.
	 * @param array $args     {
	 *     Arguments used to create the application password.
	 *
	 *     @type string $name   The name of the application password.
	 *     @type string $app_id A UUID provided by the application to uniquely identify it.
	 * }
	 * @return array|WP_Error {
	 *     Application password details, or a WP_Error instance if an error occurs.
	 *
	 *     @type string $0 The generated application password in plain text.
	 *     @type array  $1 {
	 *         The details about the created password.
	 *
	 *         @type string $uuid      The unique identifier for the application password.
	 *         @type string $app_id    A UUID provided by the application to uniquely identify it.
	 *         @type string $name      The name of the application password.
	 *         @type string $password  A one-way hash of the password.
	 *         @type int    $created   Unix timestamp of when the password was created.
	 *         @type null   $last_used Null.
	 *         @type null   $last_ip   Null.
	 *     }
	 * }
	 */
	public static function create_new_application_password( $user_id, $args = array() ) {
		if ( ! empty( $args['name'] ) ) {
			$args['name'] = sanitize_text_field( $args['name'] );
		}

		if ( empty( $args['name'] ) ) {
			return new WP_Error( 'application_password_empty_name', __( 'An application name is required to create an application password.' ), array( 'status' => 400 ) );
		}

		$new_password    = wp_generate_password( static::PW_LENGTH, false );
		$hashed_password = self::hash_password( $new_password );

		$new_item = array(
			'uuid'      => wp_generate_uuid4(),
			'app_id'    => empty( $args['app_id'] ) ? '' : $args['app_id'],
			'name'      => $args['name'],
			'password'  => $hashed_password,
			'created'   => time(),
			'last_used' => null,
			'last_ip'   => null,
		);

		$passwords   = static::get_user_application_passwords( $user_id );
		$passwords[] = $new_item;
		$saved       = static::set_user_application_passwords( $user_id, $passwords );

		if ( ! $saved ) {
			return new WP_Error( 'db_error', __( 'Could not save application password.' ) );
		}

		$network_id = get_main_network_id();
		if ( ! get_network_option( $network_id, self::OPTION_KEY_IN_USE ) ) {
			update_network_option( $network_id, self::OPTION_KEY_IN_USE, true );
		}

		/**
		 * Fires when an application password is created.
		 *
		 * @since 5.6.0
		 * @since 6.8.0 The hashed password value now uses wp_fast_hash() instead of phpass.
		 *
		 * @param int    $user_id      The user ID.
		 * @param array  $new_item     {
		 *     The details about the created password.
		 *
		 *     @type string $uuid      The unique identifier for the application password.
		 *     @type string $app_id    A UUID provided by the application to uniquely identify it.
		 *     @type string $name      The name of the application password.
		 *     @type string $password  A one-way hash of the password.
		 *     @type int    $created   Unix timestamp of when the password was created.
		 *     @type null   $last_used Null.
		 *     @type null   $last_ip   Null.
		 * }
		 * @param string $new_password The generated application password in plain text.
		 * @param array  $args         {
		 *     Arguments used to create the application password.
		 *
		 *     @type string $name   The name of the application password.
		 *     @type string $app_id A UUID provided by the application to uniquely identify it.
		 * }
		 */
		do_action( 'wp_create_application_password', $user_id, $new_item, $new_password, $args );

		return array( $new_password, $new_item );
	}

	/**
	 * Gets a user's application passwords.
	 *
	 * @since 5.6.0
	 *
	 * @param int $user_id User ID.
	 * @return array {
	 *     The list of application passwords.
	 *
	 *     @type array ...$0 {
	 *         @type string      $uuid      The unique identifier for the application password.
	 *         @type string      $app_id    A UUID provided by the application to uniquely identify it.
	 *         @type string      $name      The name of the application password.
	 *         @type string      $password  A one-way hash of the password.
	 *         @type int         $created   Unix timestamp of when the password was created.
	 *         @type int|null    $last_used The Unix timestamp of the GMT date the application password was last used.
	 *         @type string|null $last_ip   The IP address the application password was last used by.
	 *     }
	 * }
	 */
	public static function get_user_application_passwords( $user_id ) {
		$passwords = get_user_meta( $user_id, static::USERMETA_KEY_APPLICATION_PASSWORDS, true );

		if ( ! is_array( $passwords ) ) {
			return array();
		}

		$save = false;

		foreach ( $passwords as $i => $password ) {
			if ( ! isset( $password['uuid'] ) ) {
				$passwords[ $i ]['uuid'] = wp_generate_uuid4();
				$save                    = true;
			}
		}

		if ( $save ) {
			static::set_user_application_passwords( $user_id, $passwords );
		}

		return $passwords;
	}

	/**
	 * Gets a user's application password with the given UUID.
	 *
	 * @since 5.6.0
	 *
	 * @param int    $user_id User ID.
	 * @param string $uuid    The password's UUID.
	 * @return array|null {
	 *     The application password if found, null otherwise.
	 *
	 *     @type string      $uuid      The unique identifier for the application password.
	 *     @type string      $app_id    A UUID provided by the application to uniquely identify it.
	 *     @type string      $name      The name of the application password.
	 *     @type string      $password  A one-way hash of the password.
	 *     @type int         $created   Unix timestamp of when the password was created.
	 *     @type int|null    $last_used The Unix timestamp of the GMT date the application password was last used.
	 *     @type string|null $last_ip   The IP address the application password was last used by.
	 * }
	 */
	public static function get_user_application_password( $user_id, $uuid ) {
		$passwords = static::get_user_application_passwords( $user_id );

		foreach ( $passwords as $password ) {
			if ( $password['uuid'] === $uuid ) {
				return $password;
			}
		}

		return null;
	}

	/**
	 * Checks if an application password with the given name exists for this user.
	 *
	 * @since 5.7.0
	 *
	 * @param int    $user_id User ID.
	 * @param string $name    Application name.
	 * @return bool Whether the provided application name exists.
	 */
	public static function application_name_exists_for_user( $user_id, $name ) {
		$passwords = static::get_user_application_passwords( $user_id );

		foreach ( $passwords as $password ) {
			if ( strtolower( $password['name'] ) === strtolower( $name ) ) {
				return true;
			}
		}

		return false;
	}

	/**
	 * Updates an application password.
	 *
	 * @since 5.6.0
	 * @since 6.8.0 The actual password should now be hashed using wp_fast_hash().
	 *
	 * @param int    $user_id User ID.
	 * @param string $uuid    The password's UUID.
	 * @param array  $update  {
	 *     Information about the application password to update.
	 *
	 *     @type string      $uuid      The unique identifier for the application password.
	 *     @type string      $app_id    A UUID provided by the application to uniquely identify it.
	 *     @type string      $name      The name of the application password.
	 *     @type string      $password  A one-way hash of the password.
	 *     @type int         $created   Unix timestamp of when the password was created.
	 *     @type int|null    $last_used The Unix timestamp of the GMT date the application password was last used.
	 *     @type string|null $last_ip   The IP address the application password was last used by.
	 * }
	 * @return true|WP_Error True if successful, otherwise a WP_Error instance is returned on error.
	 */
	public static function update_application_password( $user_id, $uuid, $update = array() ) {
		$passwords = static::get_user_application_passwords( $user_id );

		foreach ( $passwords as &$item ) {
			if ( $item['uuid'] !== $uuid ) {
				continue;
			}

			if ( ! empty( $update['name'] ) ) {
				$update['name'] = sanitize_text_field( $update['name'] );
			}

			$save = false;

			if ( ! empty( $update['name'] ) && $item['name'] !== $update['name'] ) {
				$item['name'] = $update['name'];
				$save         = true;
			}

			if ( $save ) {
				$saved = static::set_user_application_passwords( $user_id, $passwords );

				if ( ! $saved ) {
					return new WP_Error( 'db_error', __( 'Could not save application password.' ) );
				}
			}

			/**
			 * Fires when an application password is updated.
			 *
			 * @since 5.6.0
			 * @since 6.8.0 The password is now hashed using wp_fast_hash() instead of phpass.
			 *              Existing passwords may still be hashed using phpass.
			 *
			 * @param int   $user_id The user ID.
			 * @param array $item    {
			 *     The updated application password details.
			 *
			 *     @type string      $uuid      The unique identifier for the application password.
			 *     @type string      $app_id    A UUID provided by the application to uniquely identify it.
			 *     @type string      $name      The name of the application password.
			 *     @type string      $password  A one-way hash of the password.
			 *     @type int         $created   Unix timestamp of when the password was created.
			 *     @type int|null    $last_used The Unix timestamp of the GMT date the application password was last used.
			 *     @type string|null $last_ip   The IP address the application password was last used by.
			 * }
			 * @param array $update  The information to update.
			 */
			do_action( 'wp_update_application_password', $user_id, $item, $update );

			return true;
		}

		return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) );
	}

	/**
	 * Records that an application password has been used.
	 *
	 * @since 5.6.0
	 *
	 * @param int    $user_id User ID.
	 * @param string $uuid    The password's UUID.
	 * @return true|WP_Error True if the usage was recorded, a WP_Error if an error occurs.
	 */
	public static function record_application_password_usage( $user_id, $uuid ) {
		$passwords = static::get_user_application_passwords( $user_id );

		foreach ( $passwords as &$password ) {
			if ( $password['uuid'] !== $uuid ) {
				continue;
			}

			// Only record activity once a day.
			if ( $password['last_used'] + DAY_IN_SECONDS > time() ) {
				return true;
			}

			$password['last_used'] = time();
			$password['last_ip']   = $_SERVER['REMOTE_ADDR'];

			$saved = static::set_user_application_passwords( $user_id, $passwords );

			if ( ! $saved ) {
				return new WP_Error( 'db_error', __( 'Could not save application password.' ) );
			}

			return true;
		}

		// Specified application password not found!
		return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) );
	}

	/**
	 * Deletes an application password.
	 *
	 * @since 5.6.0
	 *
	 * @param int    $user_id User ID.
	 * @param string $uuid    The password's UUID.
	 * @return true|WP_Error Whether the password was successfully found and deleted, a WP_Error otherwise.
	 */
	public static function delete_application_password( $user_id, $uuid ) {
		$passwords = static::get_user_application_passwords( $user_id );

		foreach ( $passwords as $key => $item ) {
			if ( $item['uuid'] === $uuid ) {
				unset( $passwords[ $key ] );
				$saved = static::set_user_application_passwords( $user_id, $passwords );

				if ( ! $saved ) {
					return new WP_Error( 'db_error', __( 'Could not delete application password.' ) );
				}

				/**
				 * Fires when an application password is deleted.
				 *
				 * @since 5.6.0
				 *
				 * @param int   $user_id The user ID.
				 * @param array $item    The data about the application password.
				 */
				do_action( 'wp_delete_application_password', $user_id, $item );

				return true;
			}
		}

		return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) );
	}

	/**
	 * Deletes all application passwords for the given user.
	 *
	 * @since 5.6.0
	 *
	 * @param int $user_id User ID.
	 * @return int|WP_Error The number of passwords that were deleted or a WP_Error on failure.
	 */
	public static function delete_all_application_passwords( $user_id ) {
		$passwords = static::get_user_application_passwords( $user_id );

		if ( $passwords ) {
			$saved = static::set_user_application_passwords( $user_id, array() );

			if ( ! $saved ) {
				return new WP_Error( 'db_error', __( 'Could not delete application passwords.' ) );
			}

			foreach ( $passwords as $item ) {
				/** This action is documented in wp-includes/class-wp-application-passwords.php */
				do_action( 'wp_delete_application_password', $user_id, $item );
			}

			return count( $passwords );
		}

		return 0;
	}

	/**
	 * Sets a user's application passwords.
	 *
	 * @since 5.6.0
	 *
	 * @param int   $user_id   User ID.
	 * @param array $passwords {
	 *     The list of application passwords.
	 *
	 *     @type array ...$0 {
	 *         @type string      $uuid      The unique identifier for the application password.
	 *         @type string      $app_id    A UUID provided by the application to uniquely identify it.
	 *         @type string      $name      The name of the application password.
	 *         @type string      $password  A one-way hash of the password.
	 *         @type int         $created   Unix timestamp of when the password was created.
	 *         @type int|null    $last_used The Unix timestamp of the GMT date the application password was last used.
	 *         @type string|null $last_ip   The IP address the application password was last used by.
	 *     }
	 * }
	 * @return int|bool User meta ID if the key didn't exist (ie. this is the first time that an application password
	 *                  has been saved for the user), true on successful update, false on failure or if the value passed
	 *                  is the same as the one that is already in the database.
	 */
	protected static function set_user_application_passwords( $user_id, $passwords ) {
		return update_user_meta( $user_id, static::USERMETA_KEY_APPLICATION_PASSWORDS, $passwords );
	}

	/**
	 * Sanitizes and then splits a password into smaller chunks.
	 *
	 * @since 5.6.0
	 *
	 * @param string $raw_password The raw application password.
	 * @return string The chunked password.
	 */
	public static function chunk_password(
		#[\SensitiveParameter]
		$raw_password
	) {
		$raw_password = preg_replace( '/[^a-z\d]/i', '', $raw_password );

		return trim( chunk_split( $raw_password, 4, ' ' ) );
	}

	/**
	 * Hashes a plaintext application password.
	 *
	 * @since 6.8.0
	 *
	 * @param string $password Plaintext password.
	 * @return string Hashed password.
	 */
	public static function hash_password(
		#[\SensitiveParameter]
		string $password
	): string {
		return wp_fast_hash( $password );
	}

	/**
	 * Checks a plaintext application password against a hashed password.
	 *
	 * @since 6.8.0
	 *
	 * @param string $password Plaintext password.
	 * @param string $hash     Hash of the password to check against.
	 * @return bool Whether the password matches the hashed password.
	 */
	public static function check_password(
		#[\SensitiveParameter]
		string $password,
		string $hash
	): bool {
		if ( ! str_starts_with( $hash, '$generic$' ) ) {
			/*
			 * If the hash doesn't start with `$generic$`, it is a hash created with `wp_hash_password()`.
			 * This is the case for application passwords created before 6.8.0.
			 */
			return wp_check_password( $password, $hash );
		}

		return wp_verify_fast_hash( $password, $hash );
	}
}
7 motivi per cui i casinò online non AAMS stanno conquistando il mercato del gioco!

7 motivi per cui i casinò online non AAMS stanno conquistando il mercato del gioco!

7 motivi per cui i casinò online non AAMS stanno conquistando il mercato del gioco!

I casinò online non AAMS stanno rapidamente guadagnando popolarità nell’industria del gioco d’azzardo. Questa crescente tendenza è alimentata da vari fattori che attraggono giocatori da tutto il mondo. A differenza dei casinò tradizionali e delle piattaforme autorizzate da AAMS, i casinò online non AAMS offrono un’esperienza unica, caratterizzata da maggiore flessibilità e una vasta gamma di opzioni di gioco. In questo articolo, esploreremo sette motivi principali per cui questi casinò stanno conquistando il mercato del gioco online.

Molti giocatori italiani si stanno orientando verso queste piattaforme per sfuggire alle rigide normative imposte da AAMS, cercando libertà e opportunità migliori. Le offerte bonus e le promozioni vantaggiose sono solo alcune delle attrattive che i casinò non AAMS presentano, creando un’attraente alternativa per i giocatori. Inoltre, la tecnologia moderna ha reso l’accesso a questi casinò più facile che mai, permettendo ai giocatori di divertirsi ovunque e in qualsiasi momento.

In questo articolo, approfondiremo vari aspetti dei casinò online non AAMS, analizzando non solo le loro caratteristiche distintive, ma anche i vantaggi e i rischi associati.

La libertà di scelta

Una delle principali attrattive dei casinò online non AAMS è la libertà di scelta che offrono ai giocatori. Mentre i casinò autorizzati da AAMS sono vincolati a normative rigorose, le piattaforme non AAMS possono offrire giochi più vari e innovativi, senza le limitazioni imposte dalle autorità. Questo significa che i giocatori possono accedere a titoli esclusivi e rivisitati, aumentando così le possibilità di divertimento e vincita.

Inoltre, la varietà di modalità di pagamento è molto più ampia. I giocatori possono utilizzare criptovalute, portafogli elettronici e altri metodi alternativi che non sono sempre disponibili in casinò regolamentati. Questo non solo garantisce un maggiore livello di privacy, ma offre anche un modo più conveniente per depositare e prelevare fondi.

Tipo di Gioco
Disponibilità nei Casinò AAMS
Disponibilità nei Casinò non AAMS
Slot machine Limitate Molteplici e variegate
Live Casino Limitato Molto ampio
Giochi da tavolo Standardizzati Varie varianti

Promozioni allettanti

I casinò online non AAMS spesso offrono promozioni più generose rispetto ai concorrenti autorizzati. Bonus di benvenuto, promozioni settimanali e programmi fedeltà sono solo alcune delle offerte che attirano i giocatori. Queste promozioni migliorano significativamente l’esperienza di gioco, fornendo ulteriori fondi per scommettere e aumentando le possibilità di vincita.

Le promozioni sono frequentemente cambiate e adattate per mantenere un alto livello di interesse tra i giocatori. Questo stimola una competizione sana tra le piattaforme, migliorando ulteriormente le offerte per i giocatori. Inoltre, i casinò non AAMS tendono ad avere requisiti di scommessa meno severi, consentendo ai giocatori di ritirare le vincite in modo più semplice.

Esperienza utente migliorata

Un altro fattore che contribuisce al successo dei casinò online non AAMS è l’ottimizzazione dell’esperienza utente. Le piattaforme si concentrano molto sul design e sulla navigabilità, offrendo interfacce intuitive e grafiche accattivanti. Questo rende più semplice per i giocatori trovare i loro giochi preferiti e divertirsi senza ostacoli. Inoltre, l’assistenza clienti è generalmente disponibile 24/7, conferendo un ulteriore valore all’esperienza di gioco.

I casinò non AAMS si prendono cura dei propri clienti, fornendo check-up periodici sulla sicurezza e l’affidabilità delle loro piattaforme. Questa attenzione alle esigenze degli utenti contribuisce a costruire la fiducia e a mantenere un’utenza fedele.

Accessibilità da qualsiasi dispositivo

La tecnologia avanzata ha reso i casinò online non AAMS facilmente accessibili da qualsiasi dispositivo, siano essi computer, tablet o smartphone. Gli sviluppatori investono costantemente nell’ottimizzazione delle loro piattaforme per assicurare che il gioco sia fluido e coinvolgente, indipendentemente dal dispositivo utilizzato. Questo fattore ha reso il gioco d’azzardo online più pratico e comodo per una vasta gamma di utenti.

L’accessibilità è un aspetto cruciale che ha contribuito all’espansione di queste piattaforme. I giocatori possono divertirsi ovunque si trovino, eliminando la necessità di visitare un casinò fisico. In questo scenario di crescente mobilità, i casinò online non AAMS si dimostrano vincenti.

Vantaggi delle criptovalute

Con l’avvento delle criptovalute, molti casinò online non AAMS hanno iniziato ad accettare questo metodo di pagamento innovativo. L’uso di criptovalute non solo garantisce maggiore privacy, ma offre anche transazioni più veloci e sicure. Questo ha attirato un numero sempre crescente di giocatori, che apprezzano la flessibilità e la comodità di utilizzare criptovalute per le loro scommesse.

Le piattaforme offrono anche bonus specifici per i depositi in criptovaluta, il che rende questa modalità ancora più allettante. Questi incentivi non solo attraggono nuovi giocatori, ma hanno anche reso le criptovalute una scelta popolare tra quelli già affermati nel mercato del gioco.

  1. Privacy durante le transazioni
  2. Velocità di prelievo
  3. Offerte esclusive per gli utenti cripto

Sicurezza e protezione dei dati

La sicurezza è un tema cruciale per qualsiasi giocatore online. I casinò online non AAMS investono notevoli risorse per garantire sicurezza e protezione dei dati ai loro utenti. Utilizzano tecnologie avanzate di crittografia e misure di sicurezza per proteggere le informazioni personali e finanziarie.

Inoltre, molte piattaforme forniscono report e audit regolari da enti indipendenti, contribuendo a costruire fiducia tra i loro utenti. Questo approccio proattivo alla sicurezza attrae anche giocatori scettici, che possono sentirsi più a loro agio nel giocare su siti non regolamentati.

Le sfide da affrontare

Nonostante i numerosi vantaggi, i casinò online non AAMS affrontano anche delle sfide significative. La mancanza di una regolamentazione formale può portare a domande sulla legalità e l’affidabilità di queste piattaforme. I giocatori potrebbero essere preoccupati riguardo alla chance di frode o di non ricevere le loro vincite. È essenziale che i giocatori siano ben informati e conducano ricerche approfondite prima di registrarsi su una nuova piattaforma.

Inoltre, la concorrenza tra le piattaforme è intensa. Solo coloro che offrono le migliori esperienze e vantaggi in assoluto potranno continuare a prosperare nel lungo termine. Le aziende devono adattarsi rapidamente alle esigenze in evoluzione dei giocatori e rimanere al passo con le nuove tecnologie per restare competitive.

Chiarimenti sui Casinò Non AAMS
Aspetti Positivi
Rischi
Libertà di gioco Offerte generose Mancanza di regolamenti
Varietà di giochi Ampia gamma di metodi di pagamento Qualità del servizio clienti
Sicurezza Accesso alle criptovalute Possibili frodi

Il futuro dei casinò online non AAMS

Il futuro dei casinò online non AAMS appare promettente e dinamico. Con l’adozione di nuove tecnologie e strumenti, queste piattaforme continueranno a evolvere e a soddisfare le esigenze in continua mutazione dei loro utenti. L’apertura a metodi di pagamento innovativi, come le criptovalute, e l’ottimizzazione dell’esperienza utente saranno le chiavi per attrarre un pubblico sempre più variegato.

Con le giuste strategie e investimenti, i casinò online non AAMS potrebbero continuare a conquistare il mercato a discapito delle tradizionali piattaforme AAMS. In questo ambiente in rapida evoluzione, i giocatori sono avvisati a rimanere informati e a considerare i pro e i contro prima di decidere dove giocare.

In sintesi, i casinò online non AAMS stanno rapidamente guadagnando terreno nel panorama del gioco d’azzardo. Grazie alla loro offerta unica e ai vantaggi sostanziali, attirano sempre più giocatori. Con adeguati investimenti nella sicurezza e nell’innovazione, queste piattaforme hanno il potenziale per dominare il mercato nei prossimi anni.

Check Also

Améliorez vos gains avec des stratégies innovantes et attrayantes.

Améliorez vos gains avec des stratégies innovantes et attrayantes. Comprendre le terrain de jeu Recherchez …