Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
531 changes: 15 additions & 516 deletions includes/class-freemius.php

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions includes/class-fs-garbage-collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ function clean() {
$user_cleaner->clean();
}

// @todo - We need a garbage collector for `all_plugins` and `active_plugins` (and variants of themes).
foreach ( array( 'active_plugins', 'all_plugins', 'all_themes' ) as $key ) {
$_accounts->unset_option($key);
}

// Always store regardless of whether there were cleaned products or not since during the process, the logic may set the last load timestamp of some products.
$_accounts->store();
Expand Down Expand Up @@ -436,4 +438,4 @@ private function get_product_cleaners( FS_Options $_accounts ) {

return $products_cleaners;
}
}
}
1 change: 0 additions & 1 deletion includes/class-fs-storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*
* @property bool $is_network_activation
* @property int $network_install_blog_id
* @property bool|null $is_extensions_tracking_allowed
* @property bool|null $is_diagnostic_tracking_allowed
* @property object $sync_cron
* @property bool|int $install_timestamp
Expand Down
4 changes: 1 addition & 3 deletions includes/debug/class-fs-debug-bar-panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ public function render() {
<br>
<?php fs_require_template( '/debug/scheduled-crons.php' ) ?>
<br>
<?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?>
<br>
<?php fs_require_template( '/debug/logger.php' ) ?>
</div>
<?php
}
}
}
}
59 changes: 2 additions & 57 deletions includes/managers/class-fs-permission-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class FS_Permission_Manager {
const PERMISSION_EVENTS = 'events';
const PERMISSION_ESSENTIALS = 'essentials';
const PERMISSION_DIAGNOSTIC = 'diagnostic';
const PERMISSION_EXTENSIONS = 'extensions';
const PERMISSION_NEWSLETTER = 'newsletter';

/**
Expand Down Expand Up @@ -72,7 +71,6 @@ static function get_all_permission_ids() {
self::PERMISSION_EVENTS,
self::PERMISSION_ESSENTIALS,
self::PERMISSION_DIAGNOSTIC,
self::PERMISSION_EXTENSIONS,
self::PERMISSION_NEWSLETTER,
);
}
Expand All @@ -84,7 +82,6 @@ static function get_api_managed_permission_ids() {
return array(
self::PERMISSION_USER,
self::PERMISSION_SITE,
self::PERMISSION_EXTENSIONS,
);
}

Expand Down Expand Up @@ -160,14 +157,7 @@ function get_opt_in_optional_permissions(
$load_default_from_storage = false,
$is_optional = false
) {
return array_merge(
$this->get_opt_in_diagnostic_permissions( $load_default_from_storage, $is_optional ),
array( $this->get_extensions_permission(
false,
false,
$load_default_from_storage
) )
);
return $this->get_opt_in_diagnostic_permissions( $load_default_from_storage, $is_optional );
}

/**
Expand Down Expand Up @@ -306,7 +296,6 @@ function get_license_optional_permissions(
) {
return array(
$this->get_diagnostic_permission( $include_optional_label, $load_default_from_storage ),
$this->get_extensions_permission( true, $include_optional_label, $load_default_from_storage ),
);
}

Expand Down Expand Up @@ -343,33 +332,6 @@ function get_diagnostic_permission(
#region Common Permissions
#--------------------------------------------------------------------------------

/**
* @param bool $is_license_activation
* @param bool $include_optional_label
* @param bool $load_default_from_storage
*
* @return array
*/
function get_extensions_permission(
$is_license_activation,
$include_optional_label = false,
$load_default_from_storage = false
) {
$is_on_by_default = ! $is_license_activation;

return $this->get_permission(
self::PERMISSION_EXTENSIONS,
'block-default',
$this->_fs->get_text_inline( 'View Plugins & Themes List', 'permissions-extensions' ) . ( $is_license_activation ? ( $include_optional_label ? ' (' . $this->_fs->get_text_inline( 'optional' ) . ')' : '' ) : '' ),
$this->_fs->get_text_inline( 'Names, slugs, versions, and if active or not', 'permissions-extensions_desc' ),
$this->_fs->get_text_inline( 'To ensure compatibility and avoid conflicts with your installed plugins and themes.', 'permissions-events_tooltip' ),
25,
true,
$is_on_by_default,
$load_default_from_storage
);
}

/**
* @param bool $load_default_from_storage
*
Expand Down Expand Up @@ -415,15 +377,6 @@ function get_newsletter_permission() {
#region Permissions Storage
#--------------------------------------------------------------------------------

/**
* @param int|null $blog_id
*
* @return bool
*/
function is_extensions_tracking_allowed( $blog_id = null ) {
return $this->is_permission_allowed( self::PERMISSION_EXTENSIONS, ! $this->_fs->is_premium(), $blog_id );
}

/**
* @param int|null $blog_id
*
Expand Down Expand Up @@ -586,14 +539,6 @@ function update_permissions_tracking_flag( $permissions ) {
* @return bool
*/
function get_permission_default( $permission ) {
if (
$this->_fs->is_premium() &&
self::PERMISSION_EXTENSIONS === $permission
) {
return false;
}

// All permissions except for the extensions in paid version are on by default when the user opts in to usage tracking.
return true;
}

Expand Down Expand Up @@ -704,4 +649,4 @@ private function get_sorted_permissions_by_priority( array $permissions ) {
}

#endregion
}
}
17 changes: 1 addition & 16 deletions templates/connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ class="button button-secondary" tabindex="2"><?php fs_esc_html_echo_x_inline( 'S
<input type="hidden" name="fs_action"
value="<?php echo esc_attr( $fs->get_unique_affix() . '_activate_existing' ) ?>">
<?php wp_nonce_field( $fs->get_unique_affix() . '_activate_existing' ) ?>
<input type="hidden" name="is_extensions_tracking_allowed" value="1">
<input type="hidden" name="is_diagnostic_tracking_allowed" value="1">
<button class="button button-primary" tabindex="1"
type="submit"><?php echo esc_html( $button_label ) ?></button>
Expand All @@ -380,7 +379,6 @@ class="button button-secondary" tabindex="2"><?php fs_esc_html_echo_x_inline( 'S
<?php foreach ( $optin_params as $name => $value ) : ?>
<input type="hidden" name="<?php echo esc_attr( $name ) ?>" value="<?php echo esc_attr( $value ) ?>">
<?php endforeach ?>
<input type="hidden" name="is_extensions_tracking_allowed" value="1">
<input type="hidden" name="is_diagnostic_tracking_allowed" value="1">
<button class="button button-primary" tabindex="1"
type="submit"<?php if ( $require_license_key ) {
Expand Down Expand Up @@ -699,22 +697,11 @@ function updatePrimaryCtaText( actionType ) {
var ajaxOptin = ( requireLicenseKey || isNetworkActive );

$form.on('submit', function () {
var $extensionsPermission = $( '#fs_permission_extensions .fs-switch' ),
isExtensionsTrackingAllowed = ( $extensionsPermission.length > 0 ) ?
$extensionsPermission.hasClass( 'fs-on' ) :
null;

var $diagnosticPermission = $( '#fs_permission_diagnostic .fs-switch' ),
isDiagnosticTrackingAllowed = ( $diagnosticPermission.length > 0 ) ?
$diagnosticPermission.hasClass( 'fs-on' ) :
null;

if ( null === isExtensionsTrackingAllowed ) {
$( 'input[name=is_extensions_tracking_allowed]' ).remove();
} else {
$( 'input[name=is_extensions_tracking_allowed]' ).val( isExtensionsTrackingAllowed ? 1 : 0 );
}

// We are not showing switch to enable/disable diagnostic tracking while activating free version. So, don't remove hidden `is_diagnostic_tracking_allowed` element from DOM and change the value only if switch is available.
if ( null !== isDiagnosticTrackingAllowed ) {
$( 'input[name=is_diagnostic_tracking_allowed]' ).val( isDiagnosticTrackingAllowed ? 1 : 0 );
Expand Down Expand Up @@ -774,8 +761,6 @@ function updatePrimaryCtaText( actionType ) {

data.is_marketing_allowed = isMarketingAllowed;

data.is_extensions_tracking_allowed = isExtensionsTrackingAllowed;

data.is_diagnostic_tracking_allowed = isDiagnosticTrackingAllowed;
}

Expand Down Expand Up @@ -1059,4 +1044,4 @@ function updatePrimaryCtaText( actionType ) {
})(jQuery);
</script>
<?php
fs_require_once_template( 'api-connectivity-message-js.php' );
fs_require_once_template( 'api-connectivity-message-js.php' );
76 changes: 0 additions & 76 deletions templates/debug/plugins-themes-sync.php

This file was deleted.

12 changes: 0 additions & 12 deletions templates/forms/optout.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
fs_enqueue_local_style( 'fs_common', '/admin/common.css' );

if ( ! $permission_manager->is_premium_context() ) {
$optional_permissions = array( $permission_manager->get_extensions_permission( false,
false,
true
) );

$permission_groups = array(
array(
'id' => 'communication',
Expand Down Expand Up @@ -76,13 +71,6 @@
),
'prompt_cancel_label' => $fs->get_text_inline( 'Keep Sharing', 'keep-sharing' )
),
array(
'id' => 'extensions',
'type' => 'optional',
'title' => $fs->get_text_inline( 'Extensions', 'extensions' ),
'desc' => '',
'permissions' => $optional_permissions,
),
);
} else {
$optional_permissions = $permission_manager->get_license_optional_permissions( false, true );
Expand Down
Loading