PluginProbe
Passster – Password Protect Pages and Content / 3.5.5.2
Passster – Password Protect Pages and Content v3.5.5.2
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.2, at inc/setup.php

132 lines 3.6 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( 'ps_fs' ) ) {
4 /**
5 * Initialze freemius
6 *
7 * @return array
8 */
9 function ps_fs()
10 {
11 global $ps_fs ;
12
13 if ( !isset( $ps_fs ) ) {
14 // Include Freemius SDK.
15 require_once dirname( __FILE__ ) . '/freemius/start.php';
16 $ps_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' => false,
28 ),
29 'menu' => array(
30 'slug' => 'passster',
31 'override_exact' => true,
32 'contact' => false,
33 'support' => false,
34 'parent' => array(
35 'slug' => 'passster',
36 ),
37 ),
38 'is_live' => true,
39 ) );
40 }
41
42 return $ps_fs;
43 }
44
45 // Init Freemius.
46 ps_fs();
47 // Signal that SDK was initiated.
48 do_action( 'ps_fs_loaded' );
49 /**
50 * Return freemius settings URL
51 *
52 * @return string
53 */
54 function ps_fs_settings_url()
55 {
56 return admin_url( 'admin.php?page=passster' );
57 }
58
59 ps_fs()->add_filter( 'connect_url', 'ps_fs_settings_url' );
60 ps_fs()->add_filter( 'after_skip_url', 'ps_fs_settings_url' );
61 ps_fs()->add_filter( 'after_connect_url', 'ps_fs_settings_url' );
62 ps_fs()->add_filter( 'after_pending_connect_url', 'ps_fs_settings_url' );
63 }
64
65 /**
66 * Remove freemius pages.
67 *
68 * @param bool $is_visible indicates if visible or not.
69 * @param int $submenu_id current submenu id.
70 * @return bool
71 */
72 function passster_is_submenu_visible( $is_visible, $submenu_id )
73 {
74 return false;
75 }
76
77 ps_fs()->add_filter(
78 'is_submenu_visible',
79 'passster_is_submenu_visible',
80 10,
81 2
82 );
83 /**
84 * Add custom icon for Freemius.
85 *
86 * @return string
87 */
88 function passster_custom_icon()
89 {
90 return PASSSTER_PATH . '/assets/admin/passster-logo.svg';
91 }
92
93 ps_fs()->add_filter( 'plugin_icon', 'passster_custom_icon' );
94 /**
95 * Clean up passster settings after uninstallation
96 *
97 * @return void
98 */
99 function passster_cleanup()
100 {
101 $advanced_options = get_option( 'passster_advanced_settings' );
102 if ( isset( $advanced_options ) ) {
103
104 if ( 'on' === $advanced_options['passster_advanced_delete_options'] ) {
105 $options = array(
106 'passster_general_settings',
107 'passster_advanced_settings',
108 'passster_passwords_usage',
109 'passster_passwords_times'
110 );
111
112 if ( is_multisite() ) {
113 foreach ( $options as $option ) {
114 delete_site_option( $option );
115 }
116 } else {
117 foreach ( $options as $option ) {
118 delete_option( $option );
119 }
120 }
121
122 global $wpdb ;
123 /* delete all customer groups */
124 $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type='password_lists'" );
125 /* delete all assigned meta */
126 $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE 'passster_%'" );
127 }
128
129 }
130 }
131
132 ps_fs()->add_action( 'after_uninstall', 'passster_cleanup' );