PluginProbe ʕ •ᴥ•ʔ
Presto Player / 4.2.1
Presto Player v4.2.1
4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / inc / Deactivator.php
presto-player / inc Last commit date
Blocks 2 months ago Contracts 1 year ago Database 1 month ago Integrations 3 months ago Libraries 3 months ago Models 1 month ago Seeds 1 year ago Services 1 month ago Support 1 month ago config 1 month ago lib 1 month ago Activator.php 1 month ago Attachment.php 4 months ago Controller.php 1 year ago Core.php 1 year ago Deactivator.php 2 months ago Factory.php 3 months ago Files.php 1 year ago Playlist.php 1 year ago Plugin.php 1 month ago Requirements.php 1 year ago support.php 1 year ago
Deactivator.php
108 lines
1 <?php
2 /**
3 * Plugin deactivation and uninstall handler.
4 *
5 * @package PrestoPlayer
6 */
7
8 namespace PrestoPlayer;
9
10 use PrestoPlayer\Database\Table;
11 use PrestoPlayer\Database\Visits;
12 use PrestoPlayer\Database\Presets;
13 use PrestoPlayer\Database\Videos;
14 use PrestoPlayer\Database\AudioPresets;
15 use PrestoPlayer\Database\Webhooks;
16 use PrestoPlayer\Models\ReusableVideo;
17 use PrestoPlayer\Services\Usage;
18
19 /**
20 * Class Deactivator
21 *
22 * Handles plugin data cleanup on uninstall.
23 */
24 class Deactivator {
25
26 /**
27 * Handle plugin uninstall based on user settings.
28 *
29 * @return void
30 */
31 public static function uninstall() {
32 // Get plugin settings.
33 $uninstall_settings = get_option( 'presto_player_uninstall' );
34
35 // Uninstall all data on delete if selected.
36 if ( isset( $uninstall_settings['uninstall_data'] ) && $uninstall_settings['uninstall_data'] ) {
37 self::delete_data_on_uninstall();
38 }
39 }
40
41 /**
42 * Delete all plugin data from the database.
43 *
44 * @return void
45 */
46 public static function delete_data_on_uninstall() {
47 // License.
48 delete_option( 'presto_player_license' );
49 delete_option( 'presto_player_license_data' );
50
51 // Settings.
52 delete_option( 'presto_player_analytics' );
53 delete_option( 'presto_player_google_analytics' );
54 delete_option( 'presto_player_branding' );
55 delete_option( 'presto_player_bunny_keys' );
56 delete_option( 'presto_player_bunny_storage_zones' );
57 delete_option( 'presto_player_bunny_pull_zones' );
58 delete_option( 'presto_player_bunny_uid' );
59 delete_option( 'presto_player_instant_video_width' );
60 delete_option( 'presto_player_media_hub_sync_default' );
61
62 // Notices.
63 delete_option( 'presto_player_dismissed_notice_nginx_rules' );
64 delete_option( 'presto_player_presto_player_bunny_uid' );
65 delete_option( 'presto_player_dismissed_notice_presto_player_reusable_notice' );
66
67 // Uninstall option.
68 delete_option( 'presto_player_uninstall' );
69
70 // Tables.
71 delete_option( 'presto_preset_seed_version' );
72 delete_option( 'presto_player_visits_database_version' );
73 delete_option( 'presto_player_videos_database_version' );
74 delete_option( 'presto_player_presets_database_version' );
75 delete_option( 'presto_zone_token' );
76 delete_option( 'presto_player_visits_upgrade_version' );
77 delete_option( 'presto_player_pro_update_performance' );
78 delete_option( 'presto_player_audio_presets_database_version' );
79 delete_option( 'presto_player_email_collection_database_version' );
80 delete_option( 'presto_audio_preset_seed_version' );
81
82 // Delete our tables.
83 $table = new Table();
84 ( new Visits( $table ) )->uninstall();
85 ( new Presets( $table ) )->uninstall();
86 ( new AudioPresets( $table ) )->uninstall();
87 ( new Videos( $table ) )->uninstall();
88 ( new Webhooks( $table ) )->uninstall();
89
90 // Daily views KPI tracking.
91 delete_transient( Usage::DAILY_VIEWS_OPTION );
92 delete_transient( 'presto_player_state_events_checked' );
93
94 // BSF Analytics event tracking.
95 delete_option( 'presto_player_tracked_version' );
96 // BSF Analytics library prefixes options with the product slug (hyphenated).
97 delete_option( 'presto-player_usage_events_pending' );
98 delete_option( 'presto-player_usage_events_pushed' );
99
100 // Delete all reusable videos.
101 $videos = new ReusableVideo();
102 $all_videos = $videos->all( array( 'fields' => 'ids' ) );
103 foreach ( $all_videos as $video_id ) {
104 wp_delete_post( $video_id, true );
105 }
106 }
107 }
108