Server IP : 172.67.216.182 / Your IP : 162.158.189.242 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/coircraft.com/wp-content/plugins/post-smtp/Postman/ |
Upload File : |
<?php if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } if (! class_exists ( 'PostmanOAuthToken.php' )) { class PostmanOAuthToken { const OPTIONS_NAME = 'postman_auth_token'; // const REFRESH_TOKEN = 'refresh_token'; const EXPIRY_TIME = 'auth_token_expires'; const ACCESS_TOKEN = 'access_token'; const VENDOR_NAME = 'vendor_name'; // private $vendorName; private $accessToken; private $refreshToken; private $expiryTime; // singleton instance public static function getInstance() { static $inst = null; if ($inst === null) { $inst = new PostmanOAuthToken (); } return $inst; } // private constructor private function __construct() { $this->load (); } /** * Is there a valid access token and refresh token */ public function isValid() { $accessToken = $this->getAccessToken (); $refreshToken = $this->getRefreshToken (); return ! (empty ( $accessToken ) || empty ( $refreshToken )); } /** * Load the Postman OAuth token properties to the database */ private function load() { $a = get_option ( PostmanOAuthToken::OPTIONS_NAME ); if ( ! is_array( $a ) ) { return; } if ( isset( $a [PostmanOAuthToken::ACCESS_TOKEN] ) ) { $this->setAccessToken ( $a [PostmanOAuthToken::ACCESS_TOKEN] ); } if ( isset( $a [PostmanOAuthToken::REFRESH_TOKEN] ) ) { $this->setRefreshToken($a [PostmanOAuthToken::REFRESH_TOKEN]); } if ( isset( $a [PostmanOAuthToken::EXPIRY_TIME] ) ) { $this->setExpiryTime($a [PostmanOAuthToken::EXPIRY_TIME]); } if ( isset( $a [PostmanOAuthToken::VENDOR_NAME] ) ) { $this->setVendorName($a [PostmanOAuthToken::VENDOR_NAME]); } } /** * Save the Postman OAuth token properties to the database */ public function save() { $a [PostmanOAuthToken::ACCESS_TOKEN] = $this->getAccessToken (); $a [PostmanOAuthToken::REFRESH_TOKEN] = $this->getRefreshToken (); $a [PostmanOAuthToken::EXPIRY_TIME] = $this->getExpiryTime (); $a [PostmanOAuthToken::VENDOR_NAME] = $this->getVendorName (); update_option ( PostmanOAuthToken::OPTIONS_NAME, $a ); } public function getVendorName() { return $this->vendorName; } public function getExpiryTime() { return $this->expiryTime; } public function getAccessToken() { return $this->accessToken; } public function getRefreshToken() { return $this->refreshToken; } public function setVendorName($name) { $this->vendorName = sanitize_text_field ( $name ); } public function setExpiryTime($time) { $this->expiryTime = sanitize_text_field ( $time ); } public function setAccessToken($token) { $this->accessToken = sanitize_text_field ( $token ); } public function setRefreshToken($token) { $this->refreshToken = sanitize_text_field ( $token ); } } }