| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package Freemius |
| 4 | 4 | * @copyright Copyright (c) 2015, Freemius, Inc. |
| 5 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 5 | + * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 | |
| 6 | 6 | * @since 1.0.3 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -79,7 +79,25 @@ | ||
| 79 | 79 | 's_ctx_type' => $entity->get_type(), |
| 80 | 80 | 's_ctx_id' => $entity->id, |
| 81 | 81 | 's_ctx_ts' => $timestamp, |
| 82 | 82 | 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ), |
| 83 | + ); | |
| 84 | + } | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * Gets a sandbox trial token for a given plugin, plan, and trial timestamp. | |
| 88 | + * | |
| 89 | + * @param FS_Plugin $plugin | |
| 90 | + * @param FS_Plugin_Plan $plan | |
| 91 | + * @param int $trial_timestamp | |
| 92 | + * | |
| 93 | + * @return string | |
| 94 | + */ | |
| 95 | + function get_trial_token( FS_Plugin $plugin, FS_Plugin_Plan $plan, $trial_timestamp ) { | |
| 96 | + return md5( | |
| 97 | + $plugin->secret_key . $plugin->public_key . | |
| 98 | + $plan->trial_period . | |
| 99 | + $plan->id . | |
| 100 | + $trial_timestamp | |
| 83 | 101 | ); |
| 84 | 102 | } |
| 85 | 103 | } |