REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 3.16 KB
Close
/home/nshryvcy/taramarriagebureau.com/wp-content/plugins/chatway-live-chat/app/User.php
Text
Base64
<?php /** * Chatway internal user APIs * * @author : Chatway * @license : GPLv3 * */ namespace Chatway\App; /** * @since 1.0.0 * Create an internal API group for users by extending Api class */ class User extends Api { use Singleton; public function config() { // this prefix will used in api endpoint - example: /chatway/v1/user $this->prefix = 'user'; } /** * @method POST * @api /chatway/v1/user/save * * Save user current user data. Initiall it receives user identifier and token */ public function post_save() { $params = $this->request->get_params(); $user_identifier = sanitize_text_field( isset( $params['user_identifier'] ) ? $params['user_identifier'] : '' ); $token = sanitize_text_field( isset( $params['token'] ) ? $params['token'] : '' ); // clear the cache of the user is new if (function_exists('chatway_clear_all_caches')) { chatway_clear_all_caches(); } // delete all data User::clear_chatway_keys(); if ( ! empty( $user_identifier ) && ! empty( $token ) ) { // save user identifier and token to DB add_option( 'chatway_user_identifier', $user_identifier ); add_option( 'chatway_user_cache_identifier', $user_identifier ); add_option( 'chatway_token', $token ); return [ 'code' => 200, 'message' => 'success', ]; } return [ 'code' => 401, 'message' => 'error', ]; } /** * @method GET * @api /chatway/v1/user/logout * * Remote everything related to the current user from DB */ public function get_logout() { ExternalApi::sync_wp_plugin_version(\Chatway::is_woocomerce_active(), 0); User::clear_chatway_keys(); if (function_exists('chatway_clear_all_caches')) { chatway_clear_all_caches(); } return [ 'code' => 200, 'message' => 'success', ]; } /** * Retrieves the unread messages count from an external API and caches it as a transient. * * @return array An associative array containing the count of unread messages ('count') and a status code ('code'). */ public function get_count() { delete_transient( 'chatway_unread_messages_count' ); $count = ExternalApi::get_unread_messages_count(); set_transient( 'chatway_unread_messages_count', $count, 5*60 ); return ['count' => $count, 'code' => 200]; } /** * Removes all Chatway-related options from the WordPress options table. * * @return void * Method does not return any value. */ static function clear_chatway_keys() { delete_option( 'chatway_redirection' ); delete_option( 'chatway_user_identifier' ); delete_option( 'chatway_api_secret_license_key' ); delete_option( 'chatway_token' ); delete_option( 'chatway_wp_plugin_version' ); delete_option( 'chatway_secret_key' ); delete_option( 'chatway_has_auth_error' ); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 11
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Api.php
1.48 KB
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Assets.php
4.84 KB
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Base.php
2.12 KB
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ChatwayApi.php
20.60 KB
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ExternalApi.php
12.98 KB
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Front.php
10.28 KB
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Icons.php
904 B
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Singleton.php
396 B
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Url.php
4.67 KB
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
User.php
3.16 KB
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
View.php
5.38 KB
lrw-r--r--
2025-06-11 14:05:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).