/var/www/hkosl.com/aga/wp-content/plugins/foogallery/freemius/includes/entities/class-fs-site.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?php
    
/**
     * @package     Freemius
     * @copyright   Copyright (c) 2015, Freemius, Inc.
     * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
     * @since       1.0.3
     */

    
if ( ! defined'ABSPATH' ) ) {
        exit;
    }

    class 
FS_Site extends FS_Scope_Entity {
        
/**
         * @var number
         */
        
public $site_id;
        
/**
         * @var number
         */
        
public $plugin_id;
        
/**
         * @var number
         */
        
public $user_id;
        
/**
         * @var string
         */
        
public $title;
        
/**
         * @var string
         */
        
public $url;
        
/**
         * @var string
         */
        
public $version;
        
/**
         * @var string E.g. en-GB
         */
        
public $language;
        
/**
         * @var string E.g. UTF-8
         */
        
public $charset;
        
/**
         * @var string Platform version (e.g WordPress version).
         */
        
public $platform_version;
        
/**
         * Freemius SDK version
         *
         * @author Leo Fajardo (@leorw)
         * @since  1.2.2
         *
         * @var string SDK version (e.g.: 1.2.2)
         */
        
public $sdk_version;
        
/**
         * @var string Programming language version (e.g PHP version).
         */
        
public $programming_language_version;
        
/**
         * @var number|null
         */
        
public $plan_id;
        
/**
         * @var number|null
         */
        
public $license_id;
        
/**
         * @var number|null
         */
        
public $trial_plan_id;
        
/**
         * @var string|null
         */
        
public $trial_ends;
        
/**
         * @since 1.0.9
         *
         * @var bool
         */
        
public $is_premium false;
        
/**
         * @author Leo Fajardo (@leorw)
         *
         * @since  1.2.1.5
         *
         * @var bool
         */
        
public $is_disconnected false;
        
/**
         * @since  2.0.0
         *
         * @var bool
         */
        
public $is_active true;
        
/**
         * @since  2.0.0
         *
         * @var bool
         */
        
public $is_uninstalled false;

        
/**
         * @param stdClass|bool $site
         */
        
function __construct$site false ) {
            
parent::__construct$site );

            if ( 
is_object$site ) ) {
                
$this->plan_id $site->plan_id;
            }

            if ( ! 
is_bool$this->is_disconnected ) ) {
                
$this->is_disconnected false;
            }
        }

        static function 
get_type() {
            return 
'install';
        }

        
/**
         * @author Vova Feldman (@svovaf)
         * @since  2.0.0
         *
         * @param string $url
         *
         * @return bool
         */
        
static function is_localhost_by_address$url ) {
            if ( 
false !== strpos$url'127.0.0.1' ) ||
                 
false !== strpos$url'localhost' )
            ) {
                return 
true;
            }

            if ( ! 
fs_starts_with$url'http' ) ) {
                
$url 'http://' $url;
            }

            
$url_parts parse_url$url );

            
$subdomain $url_parts['host'];

            return (
                
// Starts with.
                
fs_starts_with$subdomain'local.' ) ||
                
fs_starts_with$subdomain'dev.' ) ||
                
fs_starts_with$subdomain'test.' ) ||
                
fs_starts_with$subdomain'stage.' ) ||
                
fs_starts_with$subdomain'staging.' ) ||

                
// Ends with.
                
fs_ends_with$subdomain'.dev' ) ||
                
fs_ends_with$subdomain'.test' ) ||
                
fs_ends_with$subdomain'.staging' ) ||
                
fs_ends_with$subdomain'.local' ) ||
                
fs_ends_with$subdomain'.example' ) ||
                
fs_ends_with$subdomain'.invalid' ) ||
                
// GoDaddy test/dev.
                
fs_ends_with$subdomain'.myftpupload.com' ) ||
                
// ngrok tunneling.
                
fs_ends_with$subdomain'.ngrok.io' ) ||
                
// wpsandbox.
                
fs_ends_with$subdomain'.wpsandbox.pro' ) ||
                
// SiteGround staging.
                
fs_starts_with$subdomain'staging' ) ||
                
// WPEngine staging.
                
fs_ends_with$subdomain'.staging.wpengine.com' ) ||
                
fs_ends_with$subdomain'.dev.wpengine.com' ) ||
                
// Pantheon
                
fs_ends_with($subdomain'pantheonsite.io') &&
                  (
fs_starts_with($subdomain'test-') || fs_starts_with($subdomain'dev-'))) ||
                
// Cloudways
                
fs_ends_with$subdomain'.cloudwaysapps.com' ) ||
                
// Kinsta
                
(fs_ends_with($subdomain'.kinsta.com') && fs_starts_with($subdomain'staging-')) ||
                
// DesktopServer
                
fs_ends_with$subdomain'.dev.cc' )
            );
        }

        function 
is_localhost() {
            return ( 
WP_FS__IS_LOCALHOST_FOR_SERVER || self::is_localhost_by_address$this->url ) );
        }

        
/**
         * Check if site in trial.
         *
         * @author Vova Feldman (@svovaf)
         * @since  1.0.9
         *
         * @return bool
         */
        
function is_trial() {
            return 
is_numeric$this->trial_plan_id ) && ( strtotime$this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
        }

        
/**
         * Check if user already utilized the trial with the current install.
         *
         * @author Vova Feldman (@svovaf)
         * @since  1.0.9
         *
         * @return bool
         */
        
function is_trial_utilized() {
            return 
is_numeric$this->trial_plan_id );
        }

        
/**
         * @author Vova Feldman (@svovaf)
         * @since  2.0.0
         *
         * @return bool
         */
        
function is_tracking_allowed() {
            return ( 
true !== $this->is_disconnected );
        }

        
/**
         * @author Vova Feldman (@svovaf)
         * @since  2.0.0
         *
         * @return bool
         */
        
function is_tracking_prohibited() {
            return ! 
$this->is_tracking_allowed();
        }
    }