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 +70 -47 4.1.44.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,45 +11,40 @@
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' => 'edit.php?post_type=protected_areas',
32 - 'contact' => false,
33 - 'support' => false,
34 - 'affiliation' => false,
35 - ),
36 - '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,
37 30 ) );
38 31 }
39 -
40 32 return $passster_fs;
41 33 }
42 -
34 +
43 35 // Init Freemius.
44 36 passster_fs();
45 37 // Signal that SDK was initiated.
46 38 do_action( 'passster_fs_loaded' );
47 39 }
48 -
49 -function passster_fs_settings_url()
50 -{
40 +function passster_fs_settings_url() {
51 41 return admin_url( 'admin.php?page=passster-settings' );
52 42 }
53 43
44 +if ( !passster_fs()->is_registered() && !passster_fs()->is_anonymous() && !passster_fs()->is_pending_activation() ) {
45 + passster_fs()->skip_connection();
46 +}
54 47 passster_fs()->add_filter( 'connect_url', 'passster_fs_settings_url' );
55 48 passster_fs()->add_filter( 'after_skip_url', 'passster_fs_settings_url' );
56 49 passster_fs()->add_filter( 'after_connect_url', 'passster_fs_settings_url' );
57 50 passster_fs()->add_filter( 'after_pending_connect_url', 'passster_fs_settings_url' );
@@ -57,17 +50,48 @@
57 50 passster_fs()->add_filter( 'after_pending_connect_url', 'passster_fs_settings_url' );
58 51 passster_fs()->add_filter( 'show_deactivation_subscription_cancellation', '__return_false' );
59 52 passster_fs()->add_filter( 'show_deactivation_feedback_form', '__return_false' );
60 53 /**
61 - * Remove freemius pages.
54 + * Hide specific Freemius sticky admin notices.
62 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;
71 + }
72 + return $show;
73 +}
74 +
75 +passster_fs()->add_filter(
76 + 'show_admin_notice',
77 + 'passster_hide_admin_notices',
78 + 10,
79 + 2
80 +);
81 +/**
82 + * Hide freemius submenus except account (for license management).
83 + *
63 84 * @param bool $is_visible indicates if visible or not.
64 - * @param int $submenu_id current submenu id.
85 + * @param string $submenu_id current submenu id.
65 86 *
66 87 * @return bool
67 88 */
68 -function passster_is_submenu_visible( $is_visible, $submenu_id )
69 -{
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 + }
70 94 return false;
71 95 }
72 96
73 97 passster_fs()->add_filter(
@@ -81,27 +105,26 @@
81 105 *
82 106 * @return string
83 107 */
84 108 passster_fs()->add_filter( 'plugin_icon', function () {
85 - return PASSSTER_PATH . '/assets/admin/passster-logo.svg';
109 + return PASSSTER_PATH . '/assets/admin/passster-icon.png';
86 110 } );
87 111 passster_fs()->add_action( 'after_uninstall', function () {
88 - $options = array( 'passster', 'passster_passwords_usage', 'passster_passwords_times' );
89 -
112 + global $wpdb;
113 + // Delete option.
90 114 if ( is_multisite() ) {
91 - foreach ( $options as $option ) {
92 - delete_site_option( $option );
93 - }
115 + delete_site_option( 'passster' );
94 116 } else {
95 - foreach ( $options as $option ) {
96 - delete_option( $option );
97 - }
117 + delete_option( 'passster' );
98 118 }
99 -
100 - global $wpdb ;
101 - /* delete all password lists */
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.
102 125 $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type='password_lists'" );
103 - /* delete all protected areas */
126 + // Delete all protected areas.
104 127 $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type='protected_areas'" );
105 - /* delete all assigned meta */
128 + // Delete all assigned meta
106 129 $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE 'passster_%'" );
107 130 } );