PluginProbe
Passster – Password Protect Pages and Content / 4.3.16
Passster – Password Protect Pages and Content v4.3.16
4.3.16 4.3.15 4.3.14 4.3.12 4.3.13 4.3.11 4.3.10 4.3.9 4.3.8 4.3.7 4.3.6 4.3.5 trunk 3.5.4 3.5.5.2 3.5.5.8 3.5.5.9 4.0 4.1.4 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.15 All 48 releases
← All changes | inc/freemius-setup.php +86 -86 4.04.3.16 View file →
@@ -1,12 +1,10 @@
1 1 <?php
2 2
3 3 if ( !function_exists( 'passster_fs' ) ) {
4 4 // Create a helper function for easy SDK access.
5 - function passster_fs()
6 - {
7 - global $passster_fs ;
8 -
5 + function passster_fs() {
6 + global $passster_fs;
9 7 if ( !isset( $passster_fs ) ) {
10 8 // Activate multisite network integration.
11 9 if ( !defined( 'WP_FS__PRODUCT_1938_MULTISITE' ) ) {
12 10 define( 'WP_FS__PRODUCT_1938_MULTISITE', true );
@@ -13,63 +11,87 @@
13 11 }
14 12 // Include Freemius SDK.
15 13 require_once dirname( __FILE__ ) . '/freemius/start.php';
16 14 $passster_fs = fs_dynamic_init( array(
17 - 'id' => '1938',
18 - 'slug' => 'content-protector',
19 - 'type' => 'plugin',
20 - 'public_key' => 'pk_9d9d6d17bd34372b199f36e37dd4b',
21 - 'is_premium' => false,
22 - 'premium_suffix' => '',
23 - 'has_addons' => false,
24 - 'has_paid_plans' => true,
25 - 'trial' => array(
26 - 'days' => 7,
27 - 'is_require_payment' => true,
28 - ),
29 - 'has_affiliation' => 'selected',
30 - 'menu' => array(
31 - 'slug' => 'passster-settings',
32 - 'override_exact' => true,
33 - 'contact' => false,
34 - 'support' => false,
35 - 'affiliation' => false,
36 - 'parent' => array(
37 - 'slug' => 'admin.php',
38 - ),
39 - ),
40 - 'is_live' => true,
15 + 'id' => '1938',
16 + 'slug' => 'content-protector',
17 + 'type' => 'plugin',
18 + 'public_key' => 'pk_9d9d6d17bd34372b199f36e37dd4b',
19 + 'is_premium' => false,
20 + 'premium_suffix' => '',
21 + 'has_addons' => false,
22 + 'has_paid_plans' => true,
23 + 'has_affiliation' => 'selected',
24 + 'menu' => array(
25 + 'contact' => false,
26 + 'support' => false,
27 + ),
28 + 'is_live' => true,
29 + 'is_org_compliant' => true,
41 30 ) );
42 31 }
43 -
44 32 return $passster_fs;
45 33 }
46 -
34 +
47 35 // Init Freemius.
48 36 passster_fs();
49 37 // Signal that SDK was initiated.
50 38 do_action( 'passster_fs_loaded' );
51 - function passster_fs_settings_url()
52 - {
53 - return admin_url( 'admin.php?page=passster-settings' );
39 +}
40 +function passster_fs_settings_url() {
41 + return admin_url( 'admin.php?page=passster-settings' );
42 +}
43 +
44 +if ( !passster_fs()->is_registered() && !passster_fs()->is_anonymous() && !passster_fs()->is_pending_activation() ) {
45 + passster_fs()->skip_connection();
46 +}
47 +passster_fs()->add_filter( 'connect_url', 'passster_fs_settings_url' );
48 +passster_fs()->add_filter( 'after_skip_url', 'passster_fs_settings_url' );
49 +passster_fs()->add_filter( 'after_connect_url', 'passster_fs_settings_url' );
50 +passster_fs()->add_filter( 'after_pending_connect_url', 'passster_fs_settings_url' );
51 +passster_fs()->add_filter( 'show_deactivation_subscription_cancellation', '__return_false' );
52 +passster_fs()->add_filter( 'show_deactivation_feedback_form', '__return_false' );
53 +/**
54 + * Hide specific Freemius sticky admin notices.
55 + *
56 + * @param bool $show Whether the notice should be shown.
57 + * @param array $notice Notice data, includes 'id'.
58 + *
59 + * @return bool
60 + */
61 +function passster_hide_admin_notices( $show, $notice ) {
62 + $hidden_notice_ids = array(
63 + 'connect_account',
64 + // "We made a few tweaks to the plugin, Opt in to make it better!"
65 + 'premium_activated',
66 + // "W00t! Premium plugin version was successfully activated."
67 + 'plan_upgraded',
68 + );
69 + if ( in_array( $notice['id'], $hidden_notice_ids, true ) ) {
70 + return false;
54 71 }
55 -
56 - passster_fs()->add_filter( 'connect_url', 'passster_fs_settings_url' );
57 - passster_fs()->add_filter( 'after_skip_url', 'passster_fs_settings_url' );
58 - passster_fs()->add_filter( 'after_connect_url', 'passster_fs_settings_url' );
59 - passster_fs()->add_filter( 'after_pending_connect_url', 'passster_fs_settings_url' );
72 + return $show;
60 73 }
61 74
75 +passster_fs()->add_filter(
76 + 'show_admin_notice',
77 + 'passster_hide_admin_notices',
78 + 10,
79 + 2
80 +);
62 81 /**
63 - * Remove freemius pages.
82 + * Hide freemius submenus except account (for license management).
64 83 *
65 84 * @param bool $is_visible indicates if visible or not.
66 - * @param int $submenu_id current submenu id.
85 + * @param string $submenu_id current submenu id.
67 86 *
68 87 * @return bool
69 88 */
70 -function passster_is_submenu_visible( $is_visible, $submenu_id )
71 -{
89 +function passster_is_submenu_visible( $is_visible, $submenu_id ) {
90 + // Show account submenu for license activation/management
91 + if ( 'account' === $submenu_id ) {
92 + return true;
93 + }
72 94 return false;
73 95 }
74 96
75 97 passster_fs()->add_filter(
@@ -82,49 +104,27 @@
82 104 * Add custom icon for Freemius.
83 105 *
84 106 * @return string
85 107 */
86 -function passster_custom_icon()
87 -{
88 - return PASSSTER_PATH . '/assets/admin/passster-logo.svg';
89 -}
90 -
91 -passster_fs()->add_filter( 'plugin_icon', 'passster_custom_icon' );
92 -/**
93 - * Clean up passster settings after uninstallation
94 - *
95 - * @return void
96 - */
97 -function passster_cleanup()
98 -{
99 - $advanced_options = get_option( 'passster_advanced_settings' );
100 - if ( isset( $advanced_options ) ) {
101 -
102 - if ( 'on' === $advanced_options['passster_advanced_delete_options'] ) {
103 - $options = array(
104 - 'passster_general_settings',
105 - 'passster_advanced_settings',
106 - 'passster_passwords_usage',
107 - 'passster_passwords_times'
108 - );
109 -
110 - if ( is_multisite() ) {
111 - foreach ( $options as $option ) {
112 - delete_site_option( $option );
113 - }
114 - } else {
115 - foreach ( $options as $option ) {
116 - delete_option( $option );
117 - }
118 - }
119 -
120 - global $wpdb ;
121 - /* delete all customer groups */
122 - $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type='password_lists'" );
123 - /* delete all assigned meta */
124 - $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE 'passster_%'" );
125 - }
126 -
108 +passster_fs()->add_filter( 'plugin_icon', function () {
109 + return PASSSTER_PATH . '/assets/admin/passster-icon.png';
110 +} );
111 +passster_fs()->add_action( 'after_uninstall', function () {
112 + global $wpdb;
113 + // Delete option.
114 + if ( is_multisite() ) {
115 + delete_site_option( 'passster' );
116 + } else {
117 + delete_option( 'passster' );
127 118 }
128 -}
129 -
130 -passster_fs()->add_action( 'after_uninstall', 'passster_cleanup' );
119 + // Delete tables.
120 + $tables = [$wpdb->prefix . "passster_concurrent_logins", $wpdb->prefix . "passster_statistics"];
121 + foreach ( $tables as $table ) {
122 + $wpdb->query( "DROP TABLE IF EXISTS {$table}" );
123 + }
124 + // Delete all password lists.
125 + $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type='password_lists'" );
126 + // Delete all protected areas.
127 + $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type='protected_areas'" );
128 + // Delete all assigned meta
129 + $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE 'passster_%'" );
130 +} );