should_notify_files_missing() ) { $applicable_slug = self::SLUG_FILES_MISSING; NotificationManager::get()->register( self::SLUG_FILES_MISSING, __( 'Your AdPresso license is Premium, but the Premium plugin files are not installed on this site. Ad features may not work correctly until this is resolved - please download the AdPresso Pro plugin from your account, install it, and deactivate this Free version (Pro is a separate plugin that replaces Free, not an in-place update to it).', 'adpresso' ), [ 'type' => 'error', 'location' => 'wp_notice', 'context' => 'all', 'dismissible' => false, 'link' => adpresso_fs()->get_account_url(), ] ); } elseif ( $this->should_notify_license_available() ) { $applicable_slug = self::SLUG_LICENSE_AVAILABLE; NotificationManager::get()->register( self::SLUG_LICENSE_AVAILABLE, __( 'You have an active AdPresso Pro license that is not being used on this site yet. Since WordPress.org does not allow plugins to install additional code automatically, please download the AdPresso Pro plugin from your account, install and activate it, then deactivate this Free version - AdPresso Pro replaces it, it does not run next to it.', 'adpresso' ), [ 'type' => 'warning', 'location' => 'wp_notice', 'context' => 'all', 'dismissible' => true, 'link' => adpresso_fs()->get_account_url(), ] ); } elseif ( $this->should_notify_license_not_activated() ) { $applicable_slug = self::SLUG_LICENSE_NOT_ACTIVATED; NotificationManager::get()->register( self::SLUG_LICENSE_NOT_ACTIVATED, __( 'AdPresso Pro is installed, but no license is activated for this site yet - Pro features stay locked until you do. Go to your account and activate your license to unlock them.', 'adpresso' ), [ 'type' => 'warning', 'location' => 'wp_notice', 'context' => 'all', 'dismissible' => true, 'link' => adpresso_fs()->get_account_url(), ] ); } foreach ( $all_slugs as $slug ) { if ( $slug !== $applicable_slug ) { Notification_Center::get()->resolve( $slug ); } } } /** * True if this install's code believes it's running Premium, but the * /pro/ boot file isn't actually present on disk. * * @return bool */ public function should_notify_files_missing(): bool { // pro-gate: license-diagnostics return adpresso_fs()->is_premium() && ! file_exists( ADPRESSO_ABSPATH . 'pro/class-plugin-pro.php' ); } /** * True if this install is genuinely running Free code, but the connected * Freemius account has a valid, unused Premium license available. * * @return bool */ public function should_notify_license_available(): bool { // pro-gate: license-diagnostics if ( adpresso_fs()->is_premium() || ! adpresso_fs()->is_registered() ) { return false; } return false !== adpresso_fs()->_get_available_premium_license(); } /** * True while Pro features are off only because the activated license has expired. * * @return bool */ public function has_expired_license(): bool { // pro-gate: license-diagnostics. if ( adpresso_fs()->can_use_premium_code() || ! adpresso_fs()->is_registered() ) { return false; } // pro-gate: license-diagnostics. $license = adpresso_fs()->_get_license(); return is_object( $license ) && method_exists( $license, 'is_expired' ) && $license->is_expired(); } /** * True if the Pro plugin is genuinely running here, but no seat from the * account's license has been activated for this site yet. * * @return bool */ public function should_notify_license_not_activated(): bool { // pro-gate: license-diagnostics if ( ! adpresso_fs()->is_premium() || adpresso_fs()->can_use_premium_code() || ! adpresso_fs()->is_registered() ) { return false; } return false !== adpresso_fs()->_get_available_premium_license(); } }