PluginProbe
Passster – Password Protect Pages and Content / 3.5.5.8
Passster – Password Protect Pages and Content v3.5.5.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 / setup.php

setup.php in Passster – Password Protect Pages and Content 3.5.5.8, at inc/setup.php

130 lines 4.0 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 {
7 global $passster_fs ;
8
9 if ( !isset( $passster_fs ) ) {
10 // Activate multisite network integration.
11 if ( !defined( 'WP_FS__PRODUCT_1938_MULTISITE' ) ) {
12 define( 'WP_FS__PRODUCT_1938_MULTISITE', true );
13 }
14 // Include Freemius SDK.
15 require_once dirname( __FILE__ ) . '/freemius/start.php';
16 $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' => 'options-general.php',
38 ),
39 ),
40 'is_live' => true,
41 ) );
42 }
43
44 return $passster_fs;
45 }
46
47 // Init Freemius.
48 passster_fs();
49 // Signal that SDK was initiated.
50 do_action( 'passster_fs_loaded' );
51 function passster_fs_settings_url()
52 {
53 return admin_url( 'options-general.php?page=passster_settings' );
54 }
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' );
60 }
61
62 /**
63 * Remove freemius pages.
64 *
65 * @param bool $is_visible indicates if visible or not.
66 * @param int $submenu_id current submenu id.
67 *
68 * @return bool
69 */
70 function passster_is_submenu_visible( $is_visible, $submenu_id )
71 {
72 return false;
73 }
74
75 passster_fs()->add_filter(
76 'is_submenu_visible',
77 'passster_is_submenu_visible',
78 10,
79 2
80 );
81 /**
82 * Add custom icon for Freemius.
83 *
84 * @return string
85 */
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
127 }
128 }
129
130 passster_fs()->add_action( 'after_uninstall', 'passster_cleanup' );