PluginProbe
Passster – Password Protect Pages and Content / 3.5.5.2
Passster – Password Protect Pages and Content v3.5.5.2
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
content-protector / inc / freemius / includes / entities / class-fs-site.php

class-fs-site.php in Passster – Password Protect Pages and Content 3.5.5.2, at inc/freemius/includes/entities/class-fs-site.php

253 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class FS_Site extends FS_Scope_Entity {
14 /**
15 * @var number
16 */
17 public $site_id;
18 /**
19 * @var number
20 */
21 public $plugin_id;
22 /**
23 * @var number
24 */
25 public $user_id;
26 /**
27 * @var string
28 */
29 public $title;
30 /**
31 * @var string
32 */
33 public $url;
34 /**
35 * @var string
36 */
37 public $version;
38 /**
39 * @var string E.g. en-GB
40 */
41 public $language;
42 /**
43 * @var string E.g. UTF-8
44 */
45 public $charset;
46 /**
47 * @var string Platform version (e.g WordPress version).
48 */
49 public $platform_version;
50 /**
51 * Freemius SDK version
52 *
53 * @author Leo Fajardo (@leorw)
54 * @since 1.2.2
55 *
56 * @var string SDK version (e.g.: 1.2.2)
57 */
58 public $sdk_version;
59 /**
60 * @var string Programming language version (e.g PHP version).
61 */
62 public $programming_language_version;
63 /**
64 * @var number|null
65 */
66 public $plan_id;
67 /**
68 * @var number|null
69 */
70 public $license_id;
71 /**
72 * @var number|null
73 */
74 public $trial_plan_id;
75 /**
76 * @var string|null
77 */
78 public $trial_ends;
79 /**
80 * @since 1.0.9
81 *
82 * @var bool
83 */
84 public $is_premium = false;
85 /**
86 * @author Leo Fajardo (@leorw)
87 *
88 * @since 1.2.1.5
89 *
90 * @var bool
91 */
92 public $is_disconnected = false;
93 /**
94 * @since 2.0.0
95 *
96 * @var bool
97 */
98 public $is_active = true;
99 /**
100 * @since 2.0.0
101 *
102 * @var bool
103 */
104 public $is_uninstalled = false;
105 /**
106 * @author Edgar Melkonyan
107 *
108 * @since 2.4.2
109 *
110 * @var bool
111 */
112 public $is_beta;
113
114 /**
115 * @param stdClass|bool $site
116 */
117 function __construct( $site = false ) {
118 parent::__construct( $site );
119
120 if ( is_object( $site ) ) {
121 $this->plan_id = $site->plan_id;
122 }
123
124 if ( ! is_bool( $this->is_disconnected ) ) {
125 $this->is_disconnected = false;
126 }
127 }
128
129 static function get_type() {
130 return 'install';
131 }
132
133 /**
134 * @author Vova Feldman (@svovaf)
135 * @since 2.0.0
136 *
137 * @param string $url
138 *
139 * @return bool
140 */
141 static function is_localhost_by_address( $url ) {
142 if ( false !== strpos( $url, '127.0.0.1' ) ||
143 false !== strpos( $url, 'localhost' )
144 ) {
145 return true;
146 }
147
148 if ( ! fs_starts_with( $url, 'http' ) ) {
149 $url = 'http://' . $url;
150 }
151
152 $url_parts = parse_url( $url );
153
154 $subdomain = $url_parts['host'];
155
156 return (
157 // Starts with.
158 fs_starts_with( $subdomain, 'local.' ) ||
159 fs_starts_with( $subdomain, 'dev.' ) ||
160 fs_starts_with( $subdomain, 'test.' ) ||
161 fs_starts_with( $subdomain, 'stage.' ) ||
162 fs_starts_with( $subdomain, 'staging.' ) ||
163
164 // Ends with.
165 fs_ends_with( $subdomain, '.dev' ) ||
166 fs_ends_with( $subdomain, '.test' ) ||
167 fs_ends_with( $subdomain, '.staging' ) ||
168 fs_ends_with( $subdomain, '.local' ) ||
169 fs_ends_with( $subdomain, '.example' ) ||
170 fs_ends_with( $subdomain, '.invalid' ) ||
171 // GoDaddy test/dev.
172 fs_ends_with( $subdomain, '.myftpupload.com' ) ||
173 // ngrok tunneling.
174 fs_ends_with( $subdomain, '.ngrok.io' ) ||
175 // wpsandbox.
176 fs_ends_with( $subdomain, '.wpsandbox.pro' ) ||
177 // SiteGround staging.
178 fs_starts_with( $subdomain, 'staging' ) ||
179 // WPEngine staging.
180 fs_ends_with( $subdomain, '.staging.wpengine.com' ) ||
181 fs_ends_with( $subdomain, '.dev.wpengine.com' ) ||
182 fs_ends_with( $subdomain, '.wpengine.com' ) ||
183 // Pantheon
184 ( fs_ends_with( $subdomain, 'pantheonsite.io' ) &&
185 ( fs_starts_with( $subdomain, 'test-' ) || fs_starts_with( $subdomain, 'dev-' ) ) ) ||
186 // Cloudways
187 fs_ends_with( $subdomain, '.cloudwaysapps.com' ) ||
188 // Kinsta
189 ( fs_starts_with( $subdomain, 'staging-' ) && ( fs_ends_with( $subdomain, '.kinsta.com' ) || fs_ends_with( $subdomain, '.kinsta.cloud' ) ) ) ||
190 // DesktopServer
191 fs_ends_with( $subdomain, '.dev.cc' ) ||
192 // Pressable
193 fs_ends_with( $subdomain, '.mystagingwebsite.com' )
194 );
195 }
196
197 function is_localhost() {
198 return ( WP_FS__IS_LOCALHOST_FOR_SERVER || self::is_localhost_by_address( $this->url ) );
199 }
200
201 /**
202 * Check if site in trial.
203 *
204 * @author Vova Feldman (@svovaf)
205 * @since 1.0.9
206 *
207 * @return bool
208 */
209 function is_trial() {
210 return is_numeric( $this->trial_plan_id ) && ( strtotime( $this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
211 }
212
213 /**
214 * Check if user already utilized the trial with the current install.
215 *
216 * @author Vova Feldman (@svovaf)
217 * @since 1.0.9
218 *
219 * @return bool
220 */
221 function is_trial_utilized() {
222 return is_numeric( $this->trial_plan_id );
223 }
224
225 /**
226 * @author Vova Feldman (@svovaf)
227 * @since 2.0.0
228 *
229 * @return bool
230 */
231 function is_tracking_allowed() {
232 return ( true !== $this->is_disconnected );
233 }
234
235 /**
236 * @author Vova Feldman (@svovaf)
237 * @since 2.0.0
238 *
239 * @return bool
240 */
241 function is_tracking_prohibited() {
242 return ! $this->is_tracking_allowed();
243 }
244
245 /**
246 * @author Edgar Melkonyan
247 *
248 * @return bool
249 */
250 function is_beta() {
251 return ( isset( $this->is_beta ) && true === $this->is_beta );
252 }
253 }