| @@ -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.2.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -11,21 +11,25 @@ | ||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * @var array $VARS |
| 15 | + * @var Freemius $fs | |
| 15 | 16 | */ |
| 16 | - $slug = $VARS['slug']; | |
| 17 | - $fs = freemius( $slug ); | |
| 17 | + $fs = freemius( $VARS['id'] ); | |
| 18 | + $slug = $fs->get_slug(); | |
| 18 | 19 | |
| 19 | 20 | $message_header = sprintf( |
| 20 | - fs_text( 'start-trial-prompt-header', $slug ), | |
| 21 | + /* translators: %1$s: Number of trial days; %2$s: Plan name; */ | |
| 22 | + fs_text_inline( 'You are 1-click away from starting your %1$s-day free trial of the %2$s plan.', 'start-trial-prompt-header', $slug ), | |
| 21 | 23 | '<span class="var-trial_period"></span>', |
| 22 | 24 | '<span class="var-plan_title"></span>' |
| 23 | 25 | ); |
| 24 | 26 | $message_content = sprintf( |
| 25 | - fs_text( 'start-trial-prompt-message', $slug ), | |
| 27 | + /* translators: %s: Link to freemius.com */ | |
| 28 | + fs_text_inline( 'For compliance with the WordPress.org guidelines, before we start the trial we ask that you opt in with your user and non-sensitive site information, allowing the %s to periodically send data to %s to check for version updates and to validate your trial.', 'start-trial-prompt-message', $slug ), | |
| 29 | + $fs->get_module_type(), | |
| 26 | 30 | sprintf( |
| 27 | - '<a href="%s" target="_blank">%s</a>', | |
| 31 | + '<a href="%s" target="_blank" rel="noopener">%s</a>', | |
| 28 | 32 | 'https://freemius.com', |
| 29 | 33 | 'freemius.com' |
| 30 | 34 | ) |
| 31 | 35 | ); |
| @@ -35,9 +39,9 @@ | ||
| 35 | 39 | <h3>{$message_header}</h3> |
| 36 | 40 | <p>{$message_content}</p> |
| 37 | 41 | HTML; |
| 38 | 42 | |
| 39 | - fs_enqueue_local_style( 'dialog-boxes', '/admin/dialog-boxes.css' ); | |
| 43 | + fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' ); | |
| 40 | 44 | ?> |
| 41 | 45 | <script type="text/javascript"> |
| 42 | 46 | (function ($) { |
| 43 | 47 | $(document).ready(function () { |
| @@ -45,19 +49,18 @@ | ||
| 45 | 49 | modalHtml = |
| 46 | 50 | '<div class="fs-modal fs-modal-license-key-resend">' |
| 47 | 51 | + ' <div class="fs-modal-dialog">' |
| 48 | 52 | + ' <div class="fs-modal-header">' |
| 49 | - + ' <h4><?php fs_esc_js_echo( 'start-free-trial', $slug ) ?></h4>' | |
| 53 | + + ' <h4><?php echo esc_js( fs_text_x_inline( 'Start free trial', 'call to action', 'start-free-trial', $slug ) ) ?></h4>' | |
| 50 | 54 | + ' </div>' |
| 51 | 55 | + ' <div class="fs-modal-body">' + modalContentHtml + '</div>' |
| 52 | 56 | + ' <div class="fs-modal-footer">' |
| 53 | - + ' <button class="button button-secondary button-close">' + <?php fs_json_encode_echo( 'cancel', $slug ) ?> +'</button>' | |
| 54 | - + ' <button class="button button-primary button-connect">' + <?php fs_json_encode_echo( 'approve-start-trial', $slug ) ?> +'</button>' | |
| 57 | + + ' <button class="button button-secondary button-close">' + <?php fs_json_encode_echo_inline( 'Cancel', 'cancel', $slug ) ?> +'</button>' | |
| 58 | + + ' <button class="button button-primary button-connect">' + <?php fs_json_encode_echo_inline( 'Approve & Start Trial', 'approve-start-trial', $slug ) ?> +'</button>' | |
| 55 | 59 | + ' </div>' |
| 56 | 60 | + ' </div>' |
| 57 | 61 | + '</div>', |
| 58 | - $modal = $(modalHtml), | |
| 59 | - moduleSlug = '<?php echo $slug; ?>', | |
| 62 | + $modal = $( modalHtml ), | |
| 60 | 63 | trialData; |
| 61 | 64 | |
| 62 | 65 | $modal.appendTo($('body')); |
| 63 | 66 | |
| @@ -76,27 +79,27 @@ | ||
| 76 | 79 | |
| 77 | 80 | var $button = $(this); |
| 78 | 81 | |
| 79 | 82 | $.ajax({ |
| 80 | - url : ajaxurl, | |
| 83 | + url : <?php echo Freemius::ajax_url() ?>, | |
| 81 | 84 | method : 'POST', |
| 82 | 85 | data : { |
| 83 | - action : '<?php echo $fs->get_ajax_action( 'start_trial' ) ?>', | |
| 84 | - security: '<?php echo $fs->get_ajax_security( 'start_trial' ) ?>', | |
| 85 | - slug : moduleSlug, | |
| 86 | - trial : trialData | |
| 86 | + action : '<?php echo $fs->get_ajax_action( 'start_trial' ) ?>', | |
| 87 | + security : '<?php echo $fs->get_ajax_security( 'start_trial' ) ?>', | |
| 88 | + module_id: '<?php echo $fs->get_id() ?>', | |
| 89 | + trial : trialData | |
| 87 | 90 | }, |
| 88 | 91 | beforeSend: function () { |
| 89 | 92 | // Disable all buttons during trial activation. |
| 90 | 93 | $modal.find('.button').prop('disabled', true); |
| 91 | 94 | |
| 92 | - $button.text(<?php fs_json_encode_echo( 'starting-trial', $slug ) ?> + '...'); | |
| 95 | + $button.text(<?php fs_json_encode_echo_inline( 'Starting trial', 'starting-trial', $slug ) ?> + '...'); | |
| 93 | 96 | |
| 94 | 97 | setLoadingMode(); |
| 95 | 98 | }, |
| 96 | 99 | success : function (resultObj) { |
| 97 | 100 | if (resultObj.success) { |
| 98 | - $button.text(<?php fs_json_encode_echo( 'please-wait', $slug ) ?> + '...'); | |
| 101 | + $button.text(<?php fs_json_encode_echo_inline( 'Please wait', 'please-wait', $slug ) ?> + '...'); | |
| 99 | 102 | |
| 100 | 103 | // Redirect to the "Account" page and sync the license. |
| 101 | 104 | window.location.href = resultObj.data.next_page; |
| 102 | 105 | } else { |