: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
if ( ! defined( 'ABSPATH' ) ) {
$fs = freemius( $VARS['id'] );
$unique_affix = $fs->get_unique_affix();
$last_license_user_id = $fs->get_last_license_user_id();
$has_last_license_user_id = FS_User::is_valid_id( $last_license_user_id );
$message_above_input_field = ( ! $has_last_license_user_id ) ?
fs_text_inline( 'Please enter the license key to enable the debug mode:', 'submit-developer-license-key-message', $slug ) :
fs_text_inline( 'To enter the debug mode, please enter the secret key of the license owner (UserID = %d), which you can find in your "My Profile" section of your User Dashboard:', 'submit-addon-developer-key-message', $slug ),
$processing_text = ( fs_esc_js_inline( 'Processing', 'processing', $slug ) . '...' );
$submit_button_text = fs_text_inline( 'Submit', 'submit', $slug );
$debug_license_link_text = fs_esc_html_inline( 'Start Debug', 'start-debug-license', $slug );
$license_or_user_key_text = ( ! $has_last_license_user_id ) ?
fs_text_inline( 'License key', 'license-key' , $slug ) :
fs_text_inline( 'User key', 'user-key' , $slug );
$input_html = "<input class='fs-license-or-user-key' type='password' placeholder='{$license_or_user_key_text}' tabindex='1' />";
$modal_content_html = <<< HTML
<div class="notice notice-error inline license-or-user-key-submission-message"><p></p></div>
<p>{$message_above_input_field}</p>
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
<script type="text/javascript">
$( document ).ready( function() {
var modalContentHtml = <?php echo json_encode( $modal_content_html ) ?>,
'<div class="fs-modal fs-modal-developer-license-debug-mode fs-modal-developer-license-debug-mode-<?php echo $unique_affix ?>">'
+ ' <div class="fs-modal-dialog">'
+ ' <div class="fs-modal-body">'
+ ' <div class="fs-modal-panel active">' + modalContentHtml + '</div>'
+ ' <div class="fs-modal-footer">'
+ ' <button class="button button-secondary button-close" tabindex="4"><?php fs_esc_js_echo_inline( 'Cancel', 'cancel', $slug ) ?></button>'
+ ' <button class="button button-primary button-submit-license-or-user-key" tabindex="3"><?php echo esc_js( $submit_button_text ) ?></button>'
$debugLicenseLink = $( '.debug-license-trigger' ),
$submitKeyButton = $modal.find( '.button-submit-license-or-user-key' ),
$licenseOrUserKeyInput = $modal.find( 'input.fs-license-or-user-key' ),
$licenseOrUserKeySubmissionMessage = $modal.find( '.license-or-user-key-submission-message' ),
isDebugMode = <?php echo $fs->is_data_debug_mode() ? 'true' : 'false' ?>;
$modal.appendTo( $( 'body' ) );
function registerEventHandlers() {
$debugLicenseLink.click(function (evt) {
setDeveloperLicenseDebugMode();
$modal.on( 'input propertychange', 'input.fs-license-or-user-key', function () {
var licenseOrUserKey = $( this ).val().trim();
* If license or user key is not empty, enable the submission button.
if ( licenseOrUserKey.length > 0 ) {
$modal.on( 'blur', 'input.fs-license-or-user-key', function () {
var licenseOrUserKey = $( this ).val().trim();
* If license or user key is empty, disable the submission button.
if ( 0 === licenseOrUserKey.length ) {
$modal.on( 'click', '.button-submit-license-or-user-key', function ( evt ) {
if ( $( this ).hasClass( 'disabled' ) ) {
var licenseOrUserKey = $licenseOrUserKeyInput.val().trim();
if ( 0 === licenseOrUserKey.length ) {
setDeveloperLicenseDebugMode( licenseOrUserKey );
// If the user has clicked outside the window, close the modal.
$modal.on( 'click', '.fs-close, .button-secondary', function () {
function setDeveloperLicenseDebugMode( licenseOrUserKey ) {
action : '<?php echo $fs->get_ajax_action( 'set_data_debug_mode' ) ?>',
security : '<?php echo $fs->get_ajax_security( 'set_data_debug_mode' ) ?>',
license_or_user_key: licenseOrUserKey,
is_debug_mode : isDebugMode,
module_id : '<?php echo $fs->get_id() ?>'
url : <?php echo Freemius::ajax_url() ?>,
beforeSend: function () {
$debugLicenseLink.find('span').text( '<?php echo $processing_text ?>' );
$submitKeyButton.text( '<?php echo $processing_text ?>' );
success : function ( result ) {
// Reload the "Account" page so that the pricing/upgrade link will be properly hidden/shown.
window.location.reload();
showError( result.error.message ? result.error.message : result.error );
showError( <?php echo json_encode( fs_text_inline( 'An unknown error has occurred.', 'unknown-error', $slug ) ) ?> );
function showModal( evt ) {
// Display the dialog box.
$modal.addClass( 'active' );
$( 'body' ).addClass( 'has-fs-modal' );
$licenseOrUserKeyInput.val( '' );
$licenseOrUserKeyInput.focus();
$modal.removeClass( 'active' );
$( 'body' ).removeClass( 'has-fs-modal' );
function resetButtons() {
$submitKeyButton.text( <?php echo json_encode( $submit_button_text ) ?> );
$debugLicenseLink.find('span').text( <?php echo json_encode( $debug_license_link_text ) ?> );
function enableSubmitButton() {
$submitKeyButton.removeClass( 'disabled' );
function disableSubmitButton() {
$submitKeyButton.addClass( 'disabled' );
$licenseOrUserKeySubmissionMessage.hide();
function showError( msg ) {
$licenseOrUserKeySubmissionMessage.find( ' > p' ).html( msg );
$licenseOrUserKeySubmissionMessage.show();