PluginProbe ʕ •ᴥ•ʔ
Image Widget / 4.2
Image Widget v4.2
trunk 1.0 2.0 2.1 2.2 2.2.1 2.2.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.2 3.2.1 3.2.10 3.2.11 3.2.2 3.2.3 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1 4.1.1 4.1.2 4.2 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.11 4.4.12 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9
image-widget / freemius / includes / class-fs-security.php
image-widget / freemius / includes Last commit date
entities 10 years ago managers 10 years ago sdk 10 years ago class-freemius-abstract.php 10 years ago class-freemius.php 10 years ago class-fs-api.php 10 years ago class-fs-logger.php 10 years ago class-fs-plugin-updater.php 10 years ago class-fs-security.php 10 years ago fs-core-functions.php 10 years ago fs-plugin-functions.php 10 years ago i18n.php 10 years ago
class-fs-security.php
61 lines
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 define( 'WP_FS__SECURITY_PARAMS_PREFIX', 's_' );
14
15 class FS_Security {
16 /**
17 * @var FS_Security
18 * @since 1.0.3
19 */
20 private static $_instance;
21 /**
22 * @var FS_Logger
23 * @since 1.0.3
24 */
25 private static $_logger;
26
27 public static function instance() {
28 if ( ! isset( self::$_instance ) ) {
29 self::$_instance = new FS_Security();
30 self::$_logger = FS_Logger::get_logger( WP_FS__SLUG, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
31 }
32
33 return self::$_instance;
34 }
35
36 private function __construct() {
37 }
38
39 function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
40 return md5(
41 $timestamp .
42 $entity->id .
43 $entity->secret_key .
44 $entity->public_key .
45 $action
46 );
47 }
48
49 function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
50 if ( false === $timestamp ) {
51 $timestamp = time();
52 }
53
54 return array(
55 's_ctx_type' => $entity->get_type(),
56 's_ctx_id' => $entity->id,
57 's_ctx_ts' => $timestamp,
58 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
59 );
60 }
61 }