| @@ -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.1.5 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -10,14 +10,15 @@ | ||
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @var array $VARS | |
| 14 | + * @var array $VARS | |
| 15 | + * @var Freemius $fs | |
| 15 | 16 | */ |
| 16 | - $slug = $VARS['slug']; | |
| 17 | - $plugin_id = $VARS['id']; | |
| 17 | + $slug = $VARS['slug']; | |
| 18 | + $plugin_id = $VARS['target_module_id']; | |
| 18 | 19 | |
| 19 | - $fs = freemius( $slug ); | |
| 20 | + $fs = freemius( $VARS['id'] ); | |
| 20 | 21 | |
| 21 | 22 | $action = $fs->is_tracking_allowed() ? |
| 22 | 23 | 'stop_tracking' : |
| 23 | 24 | 'allow_tracking'; |
| @@ -27,9 +28,9 @@ | ||
| 27 | 28 | if ( $plugin_id != $fs->get_id() ) { |
| 28 | 29 | $addon = $fs->get_addon( $plugin_id ); |
| 29 | 30 | |
| 30 | 31 | if ( is_object( $addon ) ) { |
| 31 | - $title = $addon->title . ' ' . fs_text( 'addon', $slug ); | |
| 32 | + $title = $addon->title . ' ' . fs_text_inline( 'Add-On', 'addon', $slug ); | |
| 32 | 33 | } |
| 33 | 34 | } |
| 34 | 35 | |
| 35 | 36 | $plugin_title = sprintf( |
| @@ -38,13 +39,16 @@ | ||
| 38 | 39 | ); |
| 39 | 40 | |
| 40 | 41 | $sec_countdown = 30; |
| 41 | 42 | $countdown_html = sprintf( |
| 42 | - esc_js( fs_text( 'x-sec', $slug ) ), | |
| 43 | + esc_js( | |
| 44 | + /* translators: %s: Number of seconds */ | |
| 45 | + fs_text_inline( '%s sec', 'x-sec', $slug ) | |
| 46 | + ), | |
| 43 | 47 | sprintf( '<span class="fs-countdown">%s</span>', $sec_countdown ) |
| 44 | 48 | ); |
| 45 | 49 | |
| 46 | - fs_enqueue_local_style( 'dialog-boxes', '/admin/dialog-boxes.css' ); | |
| 50 | + fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' ); | |
| 47 | 51 | fs_enqueue_local_style( 'fs_common', '/admin/common.css' ); |
| 48 | 52 | |
| 49 | 53 | $params = array(); |
| 50 | 54 | $loader_html = fs_get_template( 'ajax-loader.php', $params ); |
| @@ -75,9 +79,9 @@ | ||
| 75 | 79 | ?> |
| 76 | 80 | <div class="fs-modal fs-modal-auto-install"> |
| 77 | 81 | <div class="fs-modal-dialog"> |
| 78 | 82 | <div class="fs-modal-header"> |
| 79 | - <h4><?php echo esc_js( fs_text( 'auto-installation', $slug ) ) ?></h4> | |
| 83 | + <h4><?php echo esc_js( fs_text_inline( 'Automatic Installation', 'auto-installation', $slug ) ) ?></h4> | |
| 80 | 84 | </div> |
| 81 | 85 | <div class="fs-modal-body"> |
| 82 | 86 | <div class="fs-notice-error" style="display: none"><p></p></div> |
| 83 | 87 | <?php if ( $require_credentials ) : ?> |
| @@ -85,12 +89,12 @@ | ||
| 85 | 89 | <?php echo $credentials_form ?> |
| 86 | 90 | </div> |
| 87 | 91 | <?php else : ?> |
| 88 | 92 | <p class="fs-installation-notice"><?php echo sprintf( |
| 89 | - fs_esc_html( 'installing-in-n', $slug ), | |
| 93 | + fs_esc_html_inline( 'An automated download and installation of %s (paid version) from %s will start in %s. If you would like to do it manually - click the cancellation button now.', 'installing-in-n', $slug ), | |
| 90 | 94 | $plugin_title, |
| 91 | 95 | sprintf( |
| 92 | - '<a href="%s" target="_blank">%s</a>', | |
| 96 | + '<a href="%s" target="_blank" rel="noopener">%s</a>', | |
| 93 | 97 | 'https://freemius.com', |
| 94 | 98 | 'freemius.com' |
| 95 | 99 | ), |
| 96 | 100 | $countdown_html |
| @@ -96,16 +100,16 @@ | ||
| 96 | 100 | $countdown_html |
| 97 | 101 | ) ?></p> |
| 98 | 102 | <?php endif ?> |
| 99 | 103 | <p class="fs-installing" |
| 100 | - style="display: none"><?php echo sprintf( fs_esc_html( 'installing-module-x', $slug ), $plugin_title ) ?></p> | |
| 104 | + style="display: none"><?php echo sprintf( fs_esc_html_inline( 'The installation process has started and may take a few minutes to complete. Please wait until it is done - do not refresh this page.', 'installing-module-x', $slug ), $plugin_title ) ?></p> | |
| 101 | 105 | </div> |
| 102 | 106 | <div class="fs-modal-footer"> |
| 103 | 107 | <?php echo $loader_html ?> |
| 104 | 108 | <button |
| 105 | - class="button button-secondary button-cancel"><?php fs_esc_html_echo( 'cancel-installation', $slug ) ?><?php if ( ! $require_credentials ) : ?> (<?php echo $countdown_html ?>)<?php endif ?></button> | |
| 109 | + class="button button-secondary button-cancel"><?php fs_esc_html_echo_inline( 'Cancel Installation', 'cancel-installation', $slug ) ?><?php if ( ! $require_credentials ) : ?> (<?php echo $countdown_html ?>)<?php endif ?></button> | |
| 106 | 110 | <button |
| 107 | - class="button button-primary"<?php //disabled($require_credentials) ?>><?php echo esc_js( fs_text( 'install-now', $slug ) ) ?></button> | |
| 111 | + class="button button-primary"><?php fs_esc_html_echo_inline( 'Install Now', 'install-now', $slug ) ?></button> | |
| 108 | 112 | </div> |
| 109 | 113 | </div> |
| 110 | 114 | </div>' |
| 111 | 115 | |
| @@ -141,12 +145,13 @@ | ||
| 141 | 145 | $modal.find('button').hide(); |
| 142 | 146 | $modal.find('.fs-ajax-loader').show(); |
| 143 | 147 | |
| 144 | 148 | var data = { |
| 145 | - action : '<?php echo $fs->get_ajax_action( 'install_premium_version' ) ?>', | |
| 146 | - security : '<?php echo $fs->get_ajax_security( 'install_premium_version' ) ?>', | |
| 147 | - slug : '<?php echo $slug ?>', | |
| 148 | - module_id: '<?php echo $plugin_id ?>' | |
| 149 | + action : '<?php echo $fs->get_ajax_action( 'install_premium_version' ) ?>', | |
| 150 | + security : '<?php echo $fs->get_ajax_security( 'install_premium_version' ) ?>', | |
| 151 | + slug : '<?php echo $slug ?>', | |
| 152 | + module_id : '<?php echo $fs->get_id() ?>', | |
| 153 | + target_module_id: '<?php echo $plugin_id ?>' | |
| 149 | 154 | }; |
| 150 | 155 | |
| 151 | 156 | if (requireCredentials) { |
| 152 | 157 | // Add filesystem credentials. |
| @@ -158,9 +163,9 @@ | ||
| 158 | 163 | data.private_key = $('#private_key').val(); |
| 159 | 164 | } |
| 160 | 165 | |
| 161 | 166 | $.ajax({ |
| 162 | - url : ajaxurl, | |
| 167 | + url : <?php echo Freemius::ajax_url() ?>, | |
| 163 | 168 | method : 'POST', |
| 164 | 169 | data : data, |
| 165 | 170 | success: function (resultObj) { |
| 166 | 171 | var reloadAccount = false; |
| @@ -180,9 +185,9 @@ | ||
| 180 | 185 | default: |
| 181 | 186 | $modal.removeClass('fs-warn'); |
| 182 | 187 | $modal.find('.fs-installing').hide(); |
| 183 | 188 | $modal.find('.fs-ajax-loader').hide(); |
| 184 | - $modal.find('.button-cancel').html(<?php fs_json_encode_echo( 'cancel-installation', $slug ) ?>); | |
| 189 | + $modal.find('.button-cancel').html(<?php fs_json_encode_echo_inline( 'Cancel Installation', 'cancel-installation', $slug ) ?>); | |
| 185 | 190 | $modal.find('button').show(); |
| 186 | 191 | |
| 187 | 192 | $errorNotice.find('p').text(resultObj.error.message); |
| 188 | 193 | $errorNotice.addClass('notice notice-alt notice-error').show(); |