PluginProbe
Passster – Password Protect Pages and Content / 4.3.8
Passster – Password Protect Pages and Content v4.3.8
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 4.2.16 All 47 releases
content-protector / inc / freemius-setup.php

freemius-setup.php in Passster – Password Protect Pages and Content 4.3.8, at inc/freemius-setup.php

99 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( !function_exists( 'passster_fs' ) ) {
4 // Create a helper function for easy SDK access.
5 function passster_fs() {
6 global $passster_fs;
7 if ( !isset( $passster_fs ) ) {
8 // Activate multisite network integration.
9 if ( !defined( 'WP_FS__PRODUCT_1938_MULTISITE' ) ) {
10 define( 'WP_FS__PRODUCT_1938_MULTISITE', true );
11 }
12 // Include Freemius SDK.
13 require_once dirname( __FILE__ ) . '/freemius/start.php';
14 $passster_fs = fs_dynamic_init( array(
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,
30 ) );
31 }
32 return $passster_fs;
33 }
34
35 // Init Freemius.
36 passster_fs();
37 // Signal that SDK was initiated.
38 do_action( 'passster_fs_loaded' );
39 }
40 function passster_fs_settings_url() {
41 return admin_url( 'admin.php?page=passster-settings' );
42 }
43
44 passster_fs()->add_filter( 'connect_url', 'passster_fs_settings_url' );
45 passster_fs()->add_filter( 'after_skip_url', 'passster_fs_settings_url' );
46 passster_fs()->add_filter( 'after_connect_url', 'passster_fs_settings_url' );
47 passster_fs()->add_filter( 'after_pending_connect_url', 'passster_fs_settings_url' );
48 passster_fs()->add_filter( 'show_deactivation_subscription_cancellation', '__return_false' );
49 passster_fs()->add_filter( 'show_deactivation_feedback_form', '__return_false' );
50 /**
51 * Hide freemius submenus except account (for license management).
52 *
53 * @param bool $is_visible indicates if visible or not.
54 * @param string $submenu_id current submenu id.
55 *
56 * @return bool
57 */
58 function passster_is_submenu_visible( $is_visible, $submenu_id ) {
59 // Show account submenu for license activation/management
60 if ( 'account' === $submenu_id ) {
61 return true;
62 }
63 return false;
64 }
65
66 passster_fs()->add_filter(
67 'is_submenu_visible',
68 'passster_is_submenu_visible',
69 10,
70 2
71 );
72 /**
73 * Add custom icon for Freemius.
74 *
75 * @return string
76 */
77 passster_fs()->add_filter( 'plugin_icon', function () {
78 return PASSSTER_PATH . '/assets/admin/passster-icon.png';
79 } );
80 passster_fs()->add_action( 'after_uninstall', function () {
81 global $wpdb;
82 // Delete option.
83 if ( is_multisite() ) {
84 delete_site_option( 'passster' );
85 } else {
86 delete_option( 'passster' );
87 }
88 // Delete tables.
89 $tables = [$wpdb->prefix . "passster_concurrent_logins", $wpdb->prefix . "passster_statistics"];
90 foreach ( $tables as $table ) {
91 $wpdb->query( "DROP TABLE IF EXISTS {$table}" );
92 }
93 // Delete all password lists.
94 $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type='password_lists'" );
95 // Delete all protected areas.
96 $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type='protected_areas'" );
97 // Delete all assigned meta
98 $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE 'passster_%'" );
99 } );