SmartSlider3Info.php
6.79 KB
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
<?php
namespace Nextend\SmartSlider3;
use Nextend\Framework\Api;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Notification\Notification;
use Nextend\Framework\Platform\Platform;
use Nextend\Framework\Url\Url;
use Nextend\Framework\Url\UrlHelper;
use Nextend\SmartSlider3\Application\ApplicationSmartSlider3;
use Nextend\SmartSlider3\Application\Model\ModelLicense;
class SmartSlider3Info {
public static $version = '3.5.1.2';
public static $channel = 'stable';
public static $revision = 'f4759c2e729fca8cf3071d0c6356eadecf6f7308';
public static $revisionShort = 'f4759c2e';
public static $branch = 'release-3.5.1.2';
public static $completeVersion;
public static $completeVersionReadable;
public static $plan = 'pro';
public static $product = 'smartslider3';
public static $campaign = 'smartslider3';
public static $source = '';
public static $forceDesktop = false;
public static $forceAllDevices = false;
public static function init() {
self::$completeVersion = self::$version . '/b:' . self::$branch . '/r:' . self::$revision;
self::$completeVersionReadable = self::$version . 'r' . self::$revisionShort;
self::$plan = 'free';
}
public static function shouldSkipLicenseModal() {
return true;
}
public static function applySource(&$params) {
if (!empty(self::$source)) {
$params['source'] = self::$source;
}
}
public static function getProUrlHome($params = array()) {
self::applySource($params);
return 'https://smartslider3.com/?' . http_build_query($params);
}
public static function getProUrlPricing($params = array()) {
self::applySource($params);
return 'https://smartslider3.com/pricing/?' . http_build_query($params);
}
public static function decorateExternalUrl($url, $params = array()) {
self::applySource($params);
$params['utm_campaign'] = self::$campaign;
$params['utm_medium'] = 'smartslider-' . Platform::getName() . '-' . self::$plan;
return UrlHelper::add_query_arg($params, $url);
}
public static function getWhyProUrl($params = array()) {
self::applySource($params);
$params['utm_campaign'] = self::$campaign;
$params['utm_medium'] = 'smartslider-' . Platform::getName() . '-' . self::$plan;
return 'https://smartslider3.com/features/?' . http_build_query($params);
}
public static function getSampleSlidesUrl($params = array()) {
self::applySource($params);
return 'https://smartslider3.com/slides/' . self::$version . '/free/?' . http_build_query($params);
}
public static function getActivationUrl($params = array()) {
self::applySource($params);
return 'https://secure.nextendweb.com/activate/?' . http_build_query($params);
}
public static function getUpdateInfo() {
return array(
'name' => 'smartslider3',
'plugin' => 'nextend-smart-slider3-pro/nextend-smart-slider3-pro.php'
);
}
public static function getDomain() {
$domain = parse_url(Url::getSiteUri(), PHP_URL_HOST);
if (empty($domain)) {
if (isset($_SERVER['HTTP_HOST'])) {
$domain = $_SERVER['HTTP_HOST'];
}
if (empty($domain) && isset($_SERVER['SERVER_NAME'])) {
$domain = $_SERVER['SERVER_NAME'];
}
}
return $domain;
}
public static function api($_posts, $returnUrl = false) {
$isPro = 0;
$posts = array(
'product' => self::$product,
'pro' => $isPro
);
return Api::api($_posts + $posts, $returnUrl);
}
public static function hasApiError($status, $data = array()) {
extract($data);
switch ($status) {
case 'OK':
return false;
case 'PRODUCT_ASSET_NOT_AVAILABLE':
Notification::error(sprintf(n2_('Demo slider is not available with the following ID: %s'), $key));
break;
case 'ASSET_PREMIUM':
Notification::error('Premium sliders are available in Pro version only!');
break;
case 'ASSET_VERSION':
Notification::error('Please <a href="https://smartslider.helpscoutdocs.com/article/1752-update" target="_blank">update</a> your Smart Slider to the latest version to be able to import the selected sample slider!');
break;
case 'LICENSE_EXPIRED':
Notification::error('Your license has <a href="https://smartslider.helpscoutdocs.com/article/1718-activation#nopackage" target="_blank">expired</a>! Get new one: <a href="https://smartslider3.com/pricing" target="_blank">smartslider3.com</a>.');
break;
case 'DOMAIN_REGISTER_FAILED':
Notification::error('Smart Slider 3 Pro license is not registered on the current domain. Please activate this domain by following <a href="https://smartslider.helpscoutdocs.com/article/1718-activation" target="_blank">the license activation documentation</a>.');
break;
case 'LICENSE_INVALID':
Notification::error('Smart Slider 3 Pro license is not registered on the current domain. Please activate this domain by following <a href="https://smartslider.helpscoutdocs.com/article/1718-activation" target="_blank">the license activation documentation</a>.');
ModelLicense::getInstance()
->setKey('');
return 'dashboard';
break;
case 'UPDATE_ERROR':
Notification::error('Update error, please update manually!');
break;
case 'PLATFORM_NOT_ALLOWED':
Notification::error(sprintf('Your license is not valid for Smart Slider3 - %s!', Platform::getLabel()));
break;
case 'ERROR_HANDLED':
break;
case '503':
Notification::error('Licensing server is down. Please try again later.');
break;
case null:
Notification::error('Licensing server not reachable. Please allow outgoing connection to the following ip addresses: 139.162.190.63, 172.104.28.39');
break;
default:
Notification::error('Debug: ' . $status);
Notification::error('Licensing server not reachable. Please allow outgoing connection to the following ip addresses: 139.162.190.63, 172.104.28.39');
break;
}
return true;
}
public static function initLicense() {
}
public static function sliderChanged() {
do_action('smartslider3_slider_changed');
}
}
SmartSlider3Info::init();