: 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' ) ) {
global $fs_active_plugins;
$fs_options = FS_Options::instance( WP_FS__ACCOUNTS_OPTION_NAME, true );
$off_text = fs_text_x_inline( 'Off', 'as turned off' );
$on_text = fs_text_x_inline( 'On', 'as turned on' );
$has_any_active_clone = false;
$is_multisite = is_multisite();
<h1><?php echo fs_text_inline( 'Freemius Debug' ) . ' - ' . fs_text_inline( 'SDK' ) . ' v.' . $fs_active_plugins->newest->version ?></h1>
<!-- Debugging Switch -->
<?php //$debug_mode = get_option( 'fs_debug_mode', null ) ?>
<span class="fs-switch-label"><?php fs_esc_html_echo_x_inline( 'Debugging', 'as code debugging' ) ?></span>
<div class="fs-switch fs-round <?php echo WP_FS__DEBUG_SDK ? 'fs-on' : 'fs-off' ?>">
<div class="fs-toggle"></div>
<script type="text/javascript">
$(document).ready(function () {
$( '.fs-switch' ).click( function () {
.toggleClass( 'fs-off' );
$.post( <?php echo Freemius::ajax_url() ?>, {
action: 'fs_toggle_debug_mode',
// As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
_wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_toggle_debug_mode' ) ); ?>,
is_on : ($(this).hasClass( 'fs-on' ) ? 1 : 0)
}, function ( response ) {
// Refresh page on success.
<h2><?php fs_esc_html_echo_inline( 'Actions', 'actions' ) ?></h2>
<!-- Delete All Accounts -->
<form action="" method="POST">
<input type="hidden" name="fs_action" value="restart_freemius">
<?php wp_nonce_field( 'restart_freemius' ) ?>
<button class="button button-primary"
onclick="if (confirm('<?php fs_esc_attr_echo_inline( 'Are you sure you want to delete all Freemius data?', 'delete-all-confirm' ) ?>')) this.parentNode.submit(); return false;"><?php fs_esc_html_echo_inline( 'Delete All Accounts' ) ?></button>
<form action="" method="POST">
<input type="hidden" name="fs_clear_api_cache" value="true">
<button class="button button-primary"><?php fs_esc_html_echo_inline( 'Clear API Cache' ) ?></button>
<!-- Clear Updates Transients -->
<form action="" method="POST">
<input type="hidden" name="fs_action" value="clear_updates_data">
<?php wp_nonce_field( 'clear_updates_data' ) ?>
<button class="button"><?php fs_esc_html_echo_inline( 'Clear Updates Transients' ) ?></button>
<?php if ( Freemius::is_deactivation_snoozed() ) : ?>
<!-- Reset Deactivation Snoozing -->
<form action="" method="POST">
<input type="hidden" name="fs_action" value="reset_deactivation_snoozing">
<?php wp_nonce_field( 'reset_deactivation_snoozing' ) ?>
<button class="button"><?php fs_esc_html_echo_inline( 'Reset Deactivation Snoozing' ) ?> (Expires in <?php echo ( Freemius::deactivation_snooze_expires_at() - time() ) ?> sec)</button>
<!-- Sync Data with Server -->
<form action="" method="POST">
<input type="hidden" name="background_sync" value="true">
<button class="button button-primary"><?php fs_esc_html_echo_inline( 'Sync Data From Server' ) ?></button>
<?php if ( fs_is_network_admin() && true !== $fs_options->get_option( 'ms_migration_complete', false, true ) ) : ?>
<!-- Migrate Options to Network -->
<form action="" method="POST">
<input type="hidden" name="fs_action" value="migrate_options_to_network">
<?php wp_nonce_field( 'migrate_options_to_network' ) ?>
<button class="button button-primary"><?php fs_esc_html_echo_inline( 'Migrate Options to Network' ) ?></button>
<button id="fs_load_db_option" class="button"><?php fs_esc_html_echo_inline( 'Load DB Option' ) ?></button>
<button id="fs_set_db_option" class="button"><?php fs_esc_html_echo_inline( 'Set DB Option' ) ?></button>
$fs_debug_page_url = 'admin.php?page=freemius&fs_action=allow_clone_resolution_notice';
$fs_debug_page_url = fs_is_network_admin() ?
network_admin_url( $fs_debug_page_url ) :
admin_url( $fs_debug_page_url );
<a href="<?php echo wp_nonce_url( $fs_debug_page_url, 'fs_allow_clone_resolution_notice' ) ?>" class="button button-primary">Resolve Clone(s)</a>
<script type="text/javascript">
$('#fs_load_db_option').click(function () {
var optionName = prompt('Please enter the option name:');
$.post(<?php echo Freemius::ajax_url() ?>, {
action : 'fs_get_db_option',
// As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
_wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_get_db_option' ) ); ?>,
prompt('The option value is:', response.data.value);
alert('Oops... Option does not exist in the DB.');
$('#fs_set_db_option').click(function () {
var optionName = prompt('Please enter the option name:');
var optionValue = prompt('Please enter the option value:');
$.post(<?php echo Freemius::ajax_url() ?>, {
action : 'fs_set_db_option',
// As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
_wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_set_db_option' ) ); ?>,
option_name : optionName,
option_value: optionValue
alert('Option was successfully set.');
if ( ! defined( 'FS_API__ADDRESS' ) ) {
define( 'FS_API__ADDRESS', '://api.freemius.com' );
if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) {
define( 'FS_API__SANDBOX_ADDRESS', '://sandbox-api.freemius.com' );
'key' => 'WP_FS__REMOTE_ADDR',
'val' => WP_FS__REMOTE_ADDR,
'key' => 'WP_FS__ADDRESS_PRODUCTION',
'val' => WP_FS__ADDRESS_PRODUCTION,
'key' => 'FS_API__ADDRESS',
'val' => FS_API__ADDRESS,
'key' => 'FS_API__SANDBOX_ADDRESS',
'val' => FS_API__SANDBOX_ADDRESS,
'key' => 'wp_using_ext_object_cache()',
'val' => wp_using_ext_object_cache() ? 'true' : 'false',
<th><?php fs_esc_html_echo_inline( 'Key', 'key' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Value', 'value' ) ?></th>
<?php $alternate = false;
foreach ( $defines as $p ) : ?>
<tr<?php if ( $alternate ) {
echo ' class="alternate"';
<td><?php echo $p['key'] ?></td>
<td><?php echo $p['val'] ?></td>
<?php $alternate = ! $alternate ?>
<h2><?php fs_esc_html_echo_x_inline( 'SDK Versions', 'as software development kit versions', 'sdk-versions' ) ?></h2>
<table id="fs_sdks" class="widefat">
<th><?php fs_esc_html_echo_x_inline( 'Version', 'product version' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'SDK Path' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Module Path' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Is Active' ) ?></th>
<?php foreach ( $fs_active_plugins->plugins as $sdk_path => $data ) : ?>
<?php $is_active = ( WP_FS__SDK_VERSION == $data->version ) ?>
<tr<?php if ( $is_active ) {
echo ' style="background: #E6FFE6; font-weight: bold"';
<td><?php echo $data->version ?></td>
<td><?php echo $sdk_path ?></td>
<td><?php echo $data->plugin_path ?></td>
<td><?php echo ( $is_active ) ? 'Active' : 'Inactive' ?></td>
WP_FS__MODULE_TYPE_PLUGIN,
<?php $active_modules_by_id = array() ?>
<?php foreach ( $module_types as $module_type ) : ?>
<?php $modules = fs_get_entities( $fs_options->get_option( $module_type . 's' ), FS_Plugin::get_class_name() ) ?>
<?php if ( is_array( $modules ) && count( $modules ) > 0 ) : ?>
<h2><?php echo esc_html( ( WP_FS__MODULE_TYPE_PLUGIN == $module_type ) ? fs_text_inline( 'Plugins', 'plugins' ) : fs_text_inline( 'Themes', 'themes' ) ) ?></h2>
<table id="fs_<?php echo $module_type ?>" class="widefat">
<th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Slug' ) ?></th>
<th><?php fs_esc_html_echo_x_inline( 'Version', 'product version' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Title' ) ?></th>
<th><?php fs_esc_html_echo_x_inline( 'API', 'as application program interface' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Freemius State' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Module Path' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Public Key' ) ?></th>
<?php if ( $is_multisite ) : ?>
<th><?php fs_esc_html_echo_inline( 'Network Blog' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Network User' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Actions' ) ?></th>
<?php foreach ( $modules as $slug => $data ) : ?>
if ( WP_FS__MODULE_TYPE_THEME !== $module_type ) {
$is_active = is_plugin_active( $data->file );
$current_theme = wp_get_theme();
$is_active = ( $current_theme->stylesheet === $data->file );
if ( ! $is_active && is_child_theme() ) {
$parent_theme = $current_theme->parent();
$is_active = ( ( $parent_theme instanceof WP_Theme ) && $parent_theme->stylesheet === $data->file );
$fs = freemius( $data->id );
$active_modules_by_id[ $data->id ] = true;
<tr<?php if ( $is_active ) {
$has_api_connectivity = $fs->has_api_connectivity();
if ( true === $has_api_connectivity && $fs->is_on() ) {
echo ' style="background: #E6FFE6; font-weight: bold"';
echo ' style="background: #ffd0d0; font-weight: bold"';
<td><?php echo $data->id ?></td>
<td><?php echo $slug ?></td>
<td><?php echo $data->version ?></td>
<td><?php echo $data->title ?></td>
<td<?php if ( $is_active && true !== $has_api_connectivity ) {
echo ' style="color: red; text-transform: uppercase;"';
} ?>><?php if ( $is_active ) {
echo esc_html( true === $has_api_connectivity ?
fs_text_x_inline( 'Connected', 'as connection was successful' ) :
( false === $has_api_connectivity ?
fs_text_x_inline( 'Blocked', 'as connection blocked' ) :
fs_text_x_inline( 'Unknown', 'API connectivity state is unknown' ) )
<td<?php if ( $is_active && ! $fs->is_on() ) {
echo ' style="color: red; text-transform: uppercase;"';
} ?>><?php if ( $is_active ) {
echo esc_html( $fs->is_on() ?
<td><?php echo $data->file ?></td>
<td><?php echo $data->public_key ?></td>
<?php if ( $is_multisite ) : ?>
if ( is_object( $fs ) ) {
$network_blog_id = $fs->get_network_install_blog_id();
$network_user = $fs->get_network_user();
<td><?php echo is_numeric( $network_blog_id ) ? $network_blog_id : '' ?></td>
<td><?php if ( is_object( $network_user ) ) {
echo $network_user->email;
<?php if ( $is_active ) : ?>
<?php if ( $fs->has_trial_plan() ) : ?>
<form action="" method="POST">
<input type="hidden" name="fs_action" value="simulate_trial">
<input type="hidden" name="module_id" value="<?php echo $fs->get_id() ?>">
<?php wp_nonce_field( 'simulate_trial' ) ?>
<button type="submit" class="button button-primary simulate-trial"><?php fs_esc_html_echo_inline( 'Simulate Trial Promotion' ) ?></button>
<?php if ( $fs->is_registered() ) : ?>
<a class="button" href="<?php echo $fs->get_account_url() ?>"><?php fs_esc_html_echo_inline( 'Account', 'account' ) ?></a>
<?php if ( fs_is_network_admin() && ! $fs->is_network_upgrade_mode() ) : ?>
<form action="" method="POST">
<input type="hidden" name="fs_action" value="simulate_network_upgrade">
<input type="hidden" name="module_id" value="<?php echo $fs->get_id() ?>">
<?php wp_nonce_field( 'simulate_network_upgrade' ) ?>
<button type="submit" class="button button-small"><?php fs_esc_html_echo_inline( 'Simulate Network Upgrade' ) ?></button>
<?php foreach ( $module_types as $module_type ) : ?>
* @var array[string]FS_Site|array[string]FS_Site[] $sites_map
$sites_map = $VARS[ $module_type . '_sites' ];
<?php if ( is_array( $sites_map ) && count( $sites_map ) > 0 ) : ?>
<h2><?php echo esc_html( sprintf(
/* translators: %s: 'plugin' or 'theme' */
fs_text_inline( '%s Installs', 'module-installs' ),
( WP_FS__MODULE_TYPE_PLUGIN === $module_type ? fs_text_inline( 'Plugin', 'plugin' ) : fs_text_inline( 'Theme', 'theme' ) )
) ) ?> / <?php fs_esc_html_echo_x_inline( 'Sites', 'like websites', 'sites' ) ?></h2>
<table id="fs_<?php echo $module_type ?>_installs" class="widefat">
<th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th>
<?php if ( $is_multisite ) : ?>
<th><?php fs_esc_html_echo_inline( 'Blog ID' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Address' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Slug' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'User ID' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'License ID' ) ?></th>
<th><?php fs_esc_html_echo_x_inline( 'Plan', 'as product pricing plan', 'plan' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Public Key' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Secret Key' ) ?></th>
<th><?php fs_esc_html_echo_inline( 'Actions' ) ?></th>
<?php $site_url = null ?>
<?php foreach ( $sites_map as $slug => $sites ) : ?>
<?php foreach ( $sites as $site ) : ?>
$blog_id = $is_multisite ?
if ( is_null( $site_url ) || $is_multisite ) {
$site_url = Freemius::get_unfiltered_site_url(
$is_active_clone = ( $site->is_clone( $site_url ) && isset( $active_modules_by_id[ $site->plugin_id ] ) );
if ( $is_active_clone ) {
$has_any_active_clone = true;
<?php if ( $is_active_clone ) : ?>
<label class="fs-tag fs-warn">Clone</label>
<?php if ( $is_multisite ) : ?>
<td><?php echo $blog_id ?></td>
<td><?php echo fs_strip_url_protocol( $site->url ) ?></td>
<td><?php echo $slug ?></td>
<td><?php echo $site->user_id ?></td>
<td><?php echo !empty($site->license_id) ? $site->license_id : '' ?></td>
if ( FS_Plugin_Plan::is_valid_id( $site->plan_id ) ) {
if ( false === $all_plans ) {
if ( WP_FS__MODULE_TYPE_PLUGIN !== $module_type ) {
$option_name = $module_type . '_' . $option_name;
$all_plans = fs_get_entities( $fs_options->get_option( $option_name, array() ), FS_Plugin_Plan::get_class_name() );
foreach ( $all_plans[ $slug ] as $plan ) {
$plan_id = Freemius::_decrypt( $plan->id );
if ( $site->plan_id == $plan_id ) {
$plan_name = Freemius::_decrypt( $plan->name );
<td><?php echo $site->public_key ?></td>
$plugin_storage = FS_Storage::instance( $module_type, $slug );
echo $plugin_storage->is_whitelabeled ?
FS_Plugin_License::mask_secret_key_for_html( $site->secret_key ) :
esc_html( $site->secret_key );
<form action="" method="POST">
<input type="hidden" name="fs_action" value="delete_install">
<?php wp_nonce_field( 'delete_install' ) ?>
<input type="hidden" name="module_id" value="<?php echo $site->plugin_id ?>">
<?php if ( $is_multisite ) : ?>
<input type="hidden" name="blog_id" value="<?php echo $site->blog_id ?>">
<input type="hidden" name="module_type" value="<?php echo $module_type ?>">
<input type="hidden" name="slug" value="<?php echo $slug ?>">
<button type="submit" class="button"><?php fs_esc_html_echo_x_inline( 'Delete', 'verb', 'delete' ) ?></button>