| Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/ |
| Current File : /home/x/b/o/xbodynamge/namtation/wp-content/TrustToken.php.tar |
namtation/wp-content/plugins/all-in-one-seo-pack/app/Common/SearchStatistics/Api/TrustToken.php 0000644 00000003001 15113670326 0031610 0 ustar 00 home/xbodynamge <?php
namespace AIOSEO\Plugin\Common\SearchStatistics\Api;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Handles the trust token.
*
* @since 4.3.0
* @version 4.6.2 Moved from Pro to Common.
*/
class TrustToken {
/**
* Returns the trust token from the database or creates a new one & stores it.
*
* @since 4.3.0
*
* @return string The trust token.
*/
public function get() {
$trustToken = aioseo()->internalOptions->internal->searchStatistics->trustToken;
if ( empty( $trustToken ) ) {
$trustToken = $this->generate();
aioseo()->internalOptions->internal->searchStatistics->trustToken = $trustToken;
}
return $trustToken;
}
/**
* Rotates the trust token.
*
* @since 4.3.0
*
* @return void
*/
public function rotate() {
$trustToken = $this->generate();
aioseo()->internalOptions->internal->searchStatistics->trustToken = $trustToken;
}
/**
* Generates a new trust token.
*
* @since 4.3.0
*
* @return string The trust token.
*/
public function generate() {
return hash( 'sha512', wp_generate_password( 128, true, true ) . uniqid( '', true ) );
}
/**
* Verifies whether the passed trust token is valid or not.
*
* @since 4.3.0
*
* @param string $passedTrustToken The trust token to validate.
* @return bool Whether the trust token is valid or not.
*/
public function validate( $passedTrustToken = '' ) {
$trustToken = $this->get();
return hash_equals( $trustToken, $passedTrustToken );
}
} xbodynamge/dev/wp-content/plugins/all-in-one-seo-pack/app/Common/SearchStatistics/Api/TrustToken.php0000644 00000003001 15114322725 0030372 0 ustar 00 home <?php
namespace AIOSEO\Plugin\Common\SearchStatistics\Api;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Handles the trust token.
*
* @since 4.3.0
* @version 4.6.2 Moved from Pro to Common.
*/
class TrustToken {
/**
* Returns the trust token from the database or creates a new one & stores it.
*
* @since 4.3.0
*
* @return string The trust token.
*/
public function get() {
$trustToken = aioseo()->internalOptions->internal->searchStatistics->trustToken;
if ( empty( $trustToken ) ) {
$trustToken = $this->generate();
aioseo()->internalOptions->internal->searchStatistics->trustToken = $trustToken;
}
return $trustToken;
}
/**
* Rotates the trust token.
*
* @since 4.3.0
*
* @return void
*/
public function rotate() {
$trustToken = $this->generate();
aioseo()->internalOptions->internal->searchStatistics->trustToken = $trustToken;
}
/**
* Generates a new trust token.
*
* @since 4.3.0
*
* @return string The trust token.
*/
public function generate() {
return hash( 'sha512', wp_generate_password( 128, true, true ) . uniqid( '', true ) );
}
/**
* Verifies whether the passed trust token is valid or not.
*
* @since 4.3.0
*
* @param string $passedTrustToken The trust token to validate.
* @return bool Whether the trust token is valid or not.
*/
public function validate( $passedTrustToken = '' ) {
$trustToken = $this->get();
return hash_equals( $trustToken, $passedTrustToken );
}
}