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

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