Version Description
- solved: Wrong link on icons when curl not installed.
Download this release
Release Info
Developer | socialdude |
Plugin | ![]() |
Version | 2.3.7 |
Comparing to | |
See all releases |
Code changes from version 2.3.6 to 2.3.7
- analyst/sdk_resolver.php +79 -79
- analyst/src/Account/Account.php +604 -604
- analyst/src/Mutator.php +103 -103
- analyst/version.php +15 -15
- js/custom-admin.js +3297 -3297
- libs/sfsi_install_uninstall.php +3 -3
- libs/sfsi_widget.php +1623 -1623
- readme.txt +848 -846
- ultimate_social_media_icons.php +2 -2
- views/sfsi_option_view1.php +817 -817
- views/sfsi_option_view2.php +503 -503
- views/sfsi_option_view5.php +455 -455
- views/sfsi_option_view6.php +497 -497
- views/sfsi_option_view8.php +954 -954
- views/subviews/que4/animatethem.php +234 -234
analyst/sdk_resolver.php
CHANGED
@@ -1,79 +1,79 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (!function_exists('analyst_resolve_sdk')) {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Resolve supported sdk versions and load latest supported one
|
7 |
-
* also bootstrap sdk with autoloader
|
8 |
-
*
|
9 |
-
* @since 1.1.3
|
10 |
-
*
|
11 |
-
* @param null $thisPluginPath
|
12 |
-
* @return void
|
13 |
-
* @throws Exception
|
14 |
-
*/
|
15 |
-
function analyst_resolve_sdk($thisPluginPath = null) {
|
16 |
-
static $loaded = false;
|
17 |
-
|
18 |
-
// Exit if we already resolved SDK
|
19 |
-
if ($loaded) return;
|
20 |
-
|
21 |
-
$plugins = get_option('active_plugins');
|
22 |
-
|
23 |
-
if ($thisPluginPath) {
|
24 |
-
array_push($plugins, plugin_basename($thisPluginPath));
|
25 |
-
}
|
26 |
-
|
27 |
-
$pluginsFolder = WP_PLUGIN_DIR;
|
28 |
-
|
29 |
-
$possibleSDKs = array_map(function ($path) use ($pluginsFolder) {
|
30 |
-
$sdkFolder = sprintf('%s/%s/analyst/', $pluginsFolder, dirname($path));
|
31 |
-
|
32 |
-
$sdkFolder = str_replace('\\', '/', $sdkFolder);
|
33 |
-
|
34 |
-
$versionPath = $sdkFolder . 'version.php';
|
35 |
-
|
36 |
-
if (file_exists($versionPath)) {
|
37 |
-
return require $versionPath;
|
38 |
-
}
|
39 |
-
|
40 |
-
return false;
|
41 |
-
}, $plugins);
|
42 |
-
|
43 |
-
global $wp_version;
|
44 |
-
|
45 |
-
// Filter out plugins which has no SDK
|
46 |
-
$SDKs = array_filter($possibleSDKs, function ($s) {return is_array($s);});
|
47 |
-
|
48 |
-
// Filter SDKs which is supported by PHP and WP
|
49 |
-
$supported = array_values(array_filter($SDKs, function ($sdk) use($wp_version) {
|
50 |
-
$phpSupported = version_compare(PHP_VERSION, $sdk['php']) >= 0;
|
51 |
-
$wpSupported = version_compare($wp_version, $sdk['wp']) >= 0;
|
52 |
-
|
53 |
-
return $phpSupported && $wpSupported;
|
54 |
-
}));
|
55 |
-
|
56 |
-
// Sort SDK by version in descending order
|
57 |
-
uasort($supported, function ($x, $y) {
|
58 |
-
return version_compare($y['sdk'], $x['sdk']);
|
59 |
-
});
|
60 |
-
|
61 |
-
// Reset sorted values keys
|
62 |
-
$supported = array_values($supported);
|
63 |
-
|
64 |
-
if (!isset($supported[0])) {
|
65 |
-
throw new Exception('There is no SDK which is support current PHP version and WP version');
|
66 |
-
}
|
67 |
-
|
68 |
-
// Autoload files for supported SDK
|
69 |
-
$autoloaderPath = str_replace(
|
70 |
-
'\\',
|
71 |
-
'/',
|
72 |
-
sprintf('%s/autoload.php', $supported[0]['path'])
|
73 |
-
);
|
74 |
-
|
75 |
-
require_once $autoloaderPath;
|
76 |
-
|
77 |
-
$loaded = true;
|
78 |
-
}
|
79 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!function_exists('analyst_resolve_sdk')) {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Resolve supported sdk versions and load latest supported one
|
7 |
+
* also bootstrap sdk with autoloader
|
8 |
+
*
|
9 |
+
* @since 1.1.3
|
10 |
+
*
|
11 |
+
* @param null $thisPluginPath
|
12 |
+
* @return void
|
13 |
+
* @throws Exception
|
14 |
+
*/
|
15 |
+
function analyst_resolve_sdk($thisPluginPath = null) {
|
16 |
+
static $loaded = false;
|
17 |
+
|
18 |
+
// Exit if we already resolved SDK
|
19 |
+
if ($loaded) return;
|
20 |
+
|
21 |
+
$plugins = get_option('active_plugins');
|
22 |
+
|
23 |
+
if ($thisPluginPath) {
|
24 |
+
array_push($plugins, plugin_basename($thisPluginPath));
|
25 |
+
}
|
26 |
+
|
27 |
+
$pluginsFolder = WP_PLUGIN_DIR;
|
28 |
+
|
29 |
+
$possibleSDKs = array_map(function ($path) use ($pluginsFolder) {
|
30 |
+
$sdkFolder = sprintf('%s/%s/analyst/', $pluginsFolder, dirname($path));
|
31 |
+
|
32 |
+
$sdkFolder = str_replace('\\', '/', $sdkFolder);
|
33 |
+
|
34 |
+
$versionPath = $sdkFolder . 'version.php';
|
35 |
+
|
36 |
+
if (file_exists($versionPath)) {
|
37 |
+
return require $versionPath;
|
38 |
+
}
|
39 |
+
|
40 |
+
return false;
|
41 |
+
}, $plugins);
|
42 |
+
|
43 |
+
global $wp_version;
|
44 |
+
|
45 |
+
// Filter out plugins which has no SDK
|
46 |
+
$SDKs = array_filter($possibleSDKs, function ($s) {return is_array($s);});
|
47 |
+
|
48 |
+
// Filter SDKs which is supported by PHP and WP
|
49 |
+
$supported = array_values(array_filter($SDKs, function ($sdk) use($wp_version) {
|
50 |
+
$phpSupported = version_compare(PHP_VERSION, $sdk['php']) >= 0;
|
51 |
+
$wpSupported = version_compare($wp_version, $sdk['wp']) >= 0;
|
52 |
+
|
53 |
+
return $phpSupported && $wpSupported;
|
54 |
+
}));
|
55 |
+
|
56 |
+
// Sort SDK by version in descending order
|
57 |
+
uasort($supported, function ($x, $y) {
|
58 |
+
return version_compare($y['sdk'], $x['sdk']);
|
59 |
+
});
|
60 |
+
|
61 |
+
// Reset sorted values keys
|
62 |
+
$supported = array_values($supported);
|
63 |
+
|
64 |
+
if (!isset($supported[0])) {
|
65 |
+
throw new Exception('There is no SDK which is support current PHP version and WP version');
|
66 |
+
}
|
67 |
+
|
68 |
+
// Autoload files for supported SDK
|
69 |
+
$autoloaderPath = str_replace(
|
70 |
+
'\\',
|
71 |
+
'/',
|
72 |
+
sprintf('%s/autoload.php', $supported[0]['path'])
|
73 |
+
);
|
74 |
+
|
75 |
+
require_once $autoloaderPath;
|
76 |
+
|
77 |
+
$loaded = true;
|
78 |
+
}
|
79 |
+
}
|
analyst/src/Account/Account.php
CHANGED
@@ -1,604 +1,604 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Account;
|
4 |
-
|
5 |
-
use Analyst\Analyst;
|
6 |
-
use Analyst\ApiRequestor;
|
7 |
-
use Analyst\Cache\DatabaseCache;
|
8 |
-
use Analyst\Collector;
|
9 |
-
use Analyst\Http\Requests\ActivateRequest;
|
10 |
-
use Analyst\Http\Requests\DeactivateRequest;
|
11 |
-
use Analyst\Http\Requests\InstallRequest;
|
12 |
-
use Analyst\Http\Requests\OptInRequest;
|
13 |
-
use Analyst\Http\Requests\OptOutRequest;
|
14 |
-
use Analyst\Http\Requests\UninstallRequest;
|
15 |
-
use Analyst\Notices\Notice;
|
16 |
-
use Analyst\Notices\NoticeFactory;
|
17 |
-
use Analyst\Contracts\TrackerContract;
|
18 |
-
use Analyst\Contracts\RequestorContract;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Class Account
|
22 |
-
*
|
23 |
-
* This is plugin's account object
|
24 |
-
*/
|
25 |
-
class Account implements TrackerContract
|
26 |
-
{
|
27 |
-
/**
|
28 |
-
* Account id
|
29 |
-
*
|
30 |
-
* @var string
|
31 |
-
*/
|
32 |
-
protected $id;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Basename of plugin
|
36 |
-
*
|
37 |
-
* @var string
|
38 |
-
*/
|
39 |
-
protected $path;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Whether plugin is active or not
|
43 |
-
*
|
44 |
-
* @var bool
|
45 |
-
*/
|
46 |
-
protected $isInstalled = false;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Is user sign in for data tracking
|
50 |
-
*
|
51 |
-
* @var bool
|
52 |
-
*/
|
53 |
-
protected $isOptedIn = false;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Is user accepted permissions grant
|
57 |
-
* for collection site data
|
58 |
-
*
|
59 |
-
* @var bool
|
60 |
-
*/
|
61 |
-
protected $isSigned = false;
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Is user ever resolved install modal window?
|
65 |
-
*
|
66 |
-
* @var bool
|
67 |
-
*/
|
68 |
-
protected $isInstallResolved = false;
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Public secret code
|
72 |
-
*
|
73 |
-
* @var string
|
74 |
-
*/
|
75 |
-
protected $clientSecret;
|
76 |
-
|
77 |
-
/**
|
78 |
-
* @var AccountData
|
79 |
-
*/
|
80 |
-
protected $data;
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Base plugin path
|
84 |
-
*
|
85 |
-
* @var string
|
86 |
-
*/
|
87 |
-
protected $basePluginPath;
|
88 |
-
|
89 |
-
/**
|
90 |
-
* @var RequestorContract
|
91 |
-
*/
|
92 |
-
protected $requestor;
|
93 |
-
|
94 |
-
/**
|
95 |
-
* @var Collector
|
96 |
-
*/
|
97 |
-
protected $collector;
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Account constructor.
|
101 |
-
* @param $id
|
102 |
-
* @param $secret
|
103 |
-
* @param $baseDir
|
104 |
-
*/
|
105 |
-
public function __construct($id, $secret, $baseDir)
|
106 |
-
{
|
107 |
-
$this->id = $id;
|
108 |
-
$this->clientSecret = $secret;
|
109 |
-
|
110 |
-
$this->path = $baseDir;
|
111 |
-
|
112 |
-
$this->basePluginPath = plugin_basename($baseDir);
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* @return string
|
117 |
-
*/
|
118 |
-
public function getPath()
|
119 |
-
{
|
120 |
-
return $this->path;
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* @param string $path
|
125 |
-
*/
|
126 |
-
public function setPath($path)
|
127 |
-
{
|
128 |
-
$this->data->setPath($path);
|
129 |
-
|
130 |
-
$this->path = $path;
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* @return bool
|
135 |
-
*/
|
136 |
-
public function isOptedIn()
|
137 |
-
{
|
138 |
-
return $this->isOptedIn;
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* @param bool $isOptedIn
|
143 |
-
*/
|
144 |
-
public function setIsOptedIn($isOptedIn)
|
145 |
-
{
|
146 |
-
$this->data->setIsOptedIn($isOptedIn);
|
147 |
-
|
148 |
-
$this->isOptedIn = $isOptedIn;
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Whether plugin is active
|
153 |
-
*
|
154 |
-
* @return bool
|
155 |
-
*/
|
156 |
-
public function isActive()
|
157 |
-
{
|
158 |
-
return is_plugin_active($this->path);
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* @param string $id
|
163 |
-
*/
|
164 |
-
public function setId($id)
|
165 |
-
{
|
166 |
-
$this->id = $id;
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* @return string
|
171 |
-
*/
|
172 |
-
public function getId()
|
173 |
-
{
|
174 |
-
return $this->id;
|
175 |
-
}
|
176 |
-
|
177 |
-
/**
|
178 |
-
* @return bool
|
179 |
-
*/
|
180 |
-
public function isInstalled()
|
181 |
-
{
|
182 |
-
return $this->isInstalled;
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* @param bool $isInstalled
|
187 |
-
*/
|
188 |
-
public function setIsInstalled($isInstalled)
|
189 |
-
{
|
190 |
-
$this->data->setIsInstalled($isInstalled);
|
191 |
-
|
192 |
-
$this->isInstalled = $isInstalled;
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Should register activation and deactivation
|
197 |
-
* event hooks
|
198 |
-
*
|
199 |
-
* @return void
|
200 |
-
*/
|
201 |
-
public function registerHooks()
|
202 |
-
{
|
203 |
-
register_activation_hook($this->basePluginPath, [&$this, 'onActivePluginListener']);
|
204 |
-
register_uninstall_hook($this->basePluginPath, ['Account\Account', 'onUninstallPluginListener']);
|
205 |
-
|
206 |
-
$this->addFilter('plugin_action_links', [&$this, 'onRenderActionLinksHook']);
|
207 |
-
|
208 |
-
$this->addAjax('analyst_opt_in', [&$this, 'onOptInListener']);
|
209 |
-
$this->addAjax('analyst_opt_out', [&$this, 'onOptOutListener']);
|
210 |
-
$this->addAjax('analyst_plugin_deactivate', [&$this, 'onDeactivatePluginListener']);
|
211 |
-
$this->addAjax('analyst_install', [&$this, 'onInstallListener']);
|
212 |
-
$this->addAjax('analyst_skip_install', [&$this, 'onSkipInstallListener']);
|
213 |
-
$this->addAjax('analyst_install_verified', [&$this, 'onInstallVerifiedListener']);
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Will fire when admin activates plugin
|
218 |
-
*
|
219 |
-
* @return void
|
220 |
-
*/
|
221 |
-
public function onActivePluginListener()
|
222 |
-
{
|
223 |
-
if (!$this->isInstallResolved()) {
|
224 |
-
DatabaseCache::getInstance()->put('plugin_to_install', $this->id);
|
225 |
-
}
|
226 |
-
|
227 |
-
if (!$this->isAllowingLogging()) return;
|
228 |
-
|
229 |
-
ActivateRequest::make($this->collector, $this->id, $this->path)
|
230 |
-
->execute($this->requestor);
|
231 |
-
|
232 |
-
$this->setIsInstalled(true);
|
233 |
-
|
234 |
-
AccountDataFactory::syncData();
|
235 |
-
}
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Will fire when admin deactivates plugin
|
239 |
-
*
|
240 |
-
* @return void
|
241 |
-
*/
|
242 |
-
public function onDeactivatePluginListener()
|
243 |
-
{
|
244 |
-
if (!$this->isAllowingLogging()) return;
|
245 |
-
|
246 |
-
$question = isset($_POST['question']) ? stripslashes($_POST['question']) : null;
|
247 |
-
$reason = isset($_POST['reason']) ? stripslashes($_POST['reason']) : null;
|
248 |
-
|
249 |
-
$response = DeactivateRequest::make($this->collector, $this->id, $this->path, $question, $reason)
|
250 |
-
->execute($this->requestor);
|
251 |
-
|
252 |
-
// Exit if request failed
|
253 |
-
if (!$response->isSuccess()) {
|
254 |
-
wp_send_json_error($response->body);
|
255 |
-
}
|
256 |
-
|
257 |
-
$this->setIsInstalled(false);
|
258 |
-
|
259 |
-
AccountDataFactory::syncData();
|
260 |
-
|
261 |
-
wp_send_json_success();
|
262 |
-
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Will fire when user opted in
|
266 |
-
*
|
267 |
-
* @return void
|
268 |
-
*/
|
269 |
-
public function onOptInListener()
|
270 |
-
{
|
271 |
-
$response = OptInRequest::make($this->collector, $this->id, $this->path)->execute($this->requestor);
|
272 |
-
|
273 |
-
// Exit if request failed
|
274 |
-
if (!$response->isSuccess()) {
|
275 |
-
wp_send_json_error($response->body);
|
276 |
-
}
|
277 |
-
|
278 |
-
$this->setIsOptedIn(true);
|
279 |
-
|
280 |
-
AccountDataFactory::syncData();
|
281 |
-
|
282 |
-
wp_die();
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Will fire when user opted out
|
287 |
-
*
|
288 |
-
* @return void
|
289 |
-
*/
|
290 |
-
public function onOptOutListener()
|
291 |
-
{
|
292 |
-
$response = OptOutRequest::make($this->collector, $this->id, $this->path)->execute($this->requestor);
|
293 |
-
|
294 |
-
// Exit if request failed
|
295 |
-
if (!$response->isSuccess()) {
|
296 |
-
wp_send_json_error($response->body);
|
297 |
-
}
|
298 |
-
|
299 |
-
$this->setIsOptedIn(false);
|
300 |
-
|
301 |
-
AccountDataFactory::syncData();
|
302 |
-
|
303 |
-
wp_send_json_success();
|
304 |
-
}
|
305 |
-
|
306 |
-
/**
|
307 |
-
* Will fire when user accept opt-in
|
308 |
-
* at first time
|
309 |
-
*
|
310 |
-
* @return void
|
311 |
-
*/
|
312 |
-
public function onInstallListener()
|
313 |
-
{
|
314 |
-
$cache = DatabaseCache::getInstance();
|
315 |
-
|
316 |
-
// Set flag to true which indicates that install is resolved
|
317 |
-
// also remove install plugin id from cache
|
318 |
-
$this->setIsInstallResolved(true);
|
319 |
-
$cache->delete('plugin_to_install');
|
320 |
-
|
321 |
-
$response = InstallRequest::make($this->collector, $this->id, $this->path)->execute($this->requestor);
|
322 |
-
|
323 |
-
// Exit if request failed
|
324 |
-
if (!$response->isSuccess()) {
|
325 |
-
wp_send_json_error($response->body);
|
326 |
-
}
|
327 |
-
|
328 |
-
$this->setIsSigned(true);
|
329 |
-
|
330 |
-
$this->setIsOptedIn(true);
|
331 |
-
|
332 |
-
$factory = NoticeFactory::instance();
|
333 |
-
|
334 |
-
$message = sprintf('Please confirm your email by clicking on the link we sent to %s. This makes sure you’re not a bot.', $this->collector->getGeneralEmailAddress());
|
335 |
-
|
336 |
-
$notificationId = uniqid();
|
337 |
-
|
338 |
-
$notice = Notice::make(
|
339 |
-
$notificationId,
|
340 |
-
$this->getId(),
|
341 |
-
$message,
|
342 |
-
$this->collector->getPluginName($this->path)
|
343 |
-
);
|
344 |
-
|
345 |
-
$factory->addNotice($notice);
|
346 |
-
|
347 |
-
AccountDataFactory::syncData();
|
348 |
-
|
349 |
-
// Set email confirmation notification id to cache
|
350 |
-
// se we can extract and remove it when user confirmed email
|
351 |
-
$cache->put(
|
352 |
-
sprintf('account_email_confirmation_%s', $this->getId()),
|
353 |
-
$notificationId
|
354 |
-
);
|
355 |
-
|
356 |
-
wp_send_json_success();
|
357 |
-
}
|
358 |
-
|
359 |
-
/**
|
360 |
-
* Will fire when user skipped installation
|
361 |
-
*
|
362 |
-
* @return void
|
363 |
-
*/
|
364 |
-
public function onSkipInstallListener()
|
365 |
-
{
|
366 |
-
// Set flag to true which indicates that install is resolved
|
367 |
-
// also remove install plugin id from cache
|
368 |
-
$this->setIsInstallResolved(true);
|
369 |
-
DatabaseCache::getInstance()->delete('plugin_to_install');
|
370 |
-
}
|
371 |
-
|
372 |
-
/**
|
373 |
-
* Will fire when user delete plugin through admin panel.
|
374 |
-
* This action will happen if admin at least once
|
375 |
-
* activated the plugin.
|
376 |
-
*
|
377 |
-
* @return void
|
378 |
-
* @throws \Exception
|
379 |
-
*/
|
380 |
-
public static function onUninstallPluginListener()
|
381 |
-
{
|
382 |
-
$factory = AccountDataFactory::instance();
|
383 |
-
|
384 |
-
$pluginFile = substr(current_filter(), strlen( 'uninstall_' ));
|
385 |
-
|
386 |
-
$account = $factory->getAccountDataByBasePath($pluginFile);
|
387 |
-
|
388 |
-
// If account somehow is not found, exit the execution
|
389 |
-
if (!$account) return;
|
390 |
-
|
391 |
-
$analyst = Analyst::getInstance();
|
392 |
-
|
393 |
-
$collector = new Collector($analyst);
|
394 |
-
|
395 |
-
$requestor = new ApiRequestor($account->getId(), $account->getSecret(), $analyst->getApiBase());
|
396 |
-
|
397 |
-
// Just send request to log uninstall event not caring about response
|
398 |
-
UninstallRequest::make($collector, $account->getId(), $account->getPath())->execute($requestor);
|
399 |
-
|
400 |
-
$factory->sync();
|
401 |
-
}
|
402 |
-
|
403 |
-
/**
|
404 |
-
* Fires when used verified his account
|
405 |
-
*/
|
406 |
-
public function onInstallVerifiedListener()
|
407 |
-
{
|
408 |
-
$factory = NoticeFactory::instance();
|
409 |
-
|
410 |
-
$notice = Notice::make(
|
411 |
-
uniqid(),
|
412 |
-
$this->getId(),
|
413 |
-
'Thank you for confirming your email.',
|
414 |
-
$this->collector->getPluginName($this->path)
|
415 |
-
);
|
416 |
-
|
417 |
-
$factory->addNotice($notice);
|
418 |
-
|
419 |
-
// Remove confirmation notification
|
420 |
-
$confirmationNotificationId = DatabaseCache::getInstance()->pop(sprintf('account_email_confirmation_%s', $this->getId()));
|
421 |
-
$factory->remove($confirmationNotificationId);
|
422 |
-
|
423 |
-
AccountDataFactory::syncData();
|
424 |
-
|
425 |
-
wp_send_json_success();
|
426 |
-
}
|
427 |
-
|
428 |
-
/**
|
429 |
-
* Will fire when wp renders plugin
|
430 |
-
* action buttons
|
431 |
-
*
|
432 |
-
* @param $defaultLinks
|
433 |
-
* @return array
|
434 |
-
*/
|
435 |
-
public function onRenderActionLinksHook($defaultLinks)
|
436 |
-
{
|
437 |
-
$customLinks = [];
|
438 |
-
|
439 |
-
$customLinks[] = $this->isOptedIn()
|
440 |
-
? '<a class="analyst-action-opt analyst-opt-out" analyst-plugin-id="' . $this->getId() . '" analyst-plugin-signed="' . (int) $this->isSigned() . '">Opt Out</a>'
|
441 |
-
: '<a class="analyst-action-opt analyst-opt-in" analyst-plugin-id="' . $this->getId() . '" analyst-plugin-signed="' . (int) $this->isSigned() . '">Opt In</a>';
|
442 |
-
|
443 |
-
// Append anchor to find specific deactivation link
|
444 |
-
if (isset($defaultLinks['deactivate'])) {
|
445 |
-
$defaultLinks['deactivate'] .= '<span analyst-plugin-id="' . $this->getId() . '" analyst-plugin-opted-in="' . (int) $this->isOptedIn() . '"></span>';
|
446 |
-
}
|
447 |
-
|
448 |
-
return array_merge($customLinks, $defaultLinks);
|
449 |
-
}
|
450 |
-
|
451 |
-
/**
|
452 |
-
* @return AccountData
|
453 |
-
*/
|
454 |
-
public function getData()
|
455 |
-
{
|
456 |
-
return $this->data;
|
457 |
-
}
|
458 |
-
|
459 |
-
/**
|
460 |
-
* @param AccountData $data
|
461 |
-
*/
|
462 |
-
public function setData(AccountData $data)
|
463 |
-
{
|
464 |
-
$this->data = $data;
|
465 |
-
|
466 |
-
$this->setIsOptedIn($data->isOptedIn());
|
467 |
-
$this->setIsInstalled($data->isInstalled());
|
468 |
-
$this->setIsSigned($data->isSigned());
|
469 |
-
$this->setIsInstallResolved($data->isInstallResolved());
|
470 |
-
}
|
471 |
-
|
472 |
-
/**
|
473 |
-
* Resolves valid action name
|
474 |
-
* based on client id
|
475 |
-
*
|
476 |
-
* @param $action
|
477 |
-
* @return string
|
478 |
-
*/
|
479 |
-
private function resolveActionName($action)
|
480 |
-
{
|
481 |
-
return sprintf('%s_%s', $action, $this->id);
|
482 |
-
}
|
483 |
-
|
484 |
-
/**
|
485 |
-
* Register action for current plugin
|
486 |
-
*
|
487 |
-
* @param $action
|
488 |
-
* @param $callback
|
489 |
-
*/
|
490 |
-
private function addFilter($action, $callback)
|
491 |
-
{
|
492 |
-
$validAction = sprintf('%s_%s', $action, $this->basePluginPath);
|
493 |
-
|
494 |
-
add_filter($validAction, $callback, 10);
|
495 |
-
}
|
496 |
-
|
497 |
-
/**
|
498 |
-
* Add ajax action for current plugin
|
499 |
-
*
|
500 |
-
* @param $action
|
501 |
-
* @param $callback
|
502 |
-
* @param bool $raw Format action ??
|
503 |
-
*/
|
504 |
-
private function addAjax($action, $callback, $raw = false)
|
505 |
-
{
|
506 |
-
$validAction = $raw ? $action : sprintf('%s%s', 'wp_ajax_', $this->resolveActionName($action));
|
507 |
-
|
508 |
-
add_action($validAction, $callback);
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* @return bool
|
513 |
-
*/
|
514 |
-
public function isSigned()
|
515 |
-
{
|
516 |
-
return $this->isSigned;
|
517 |
-
}
|
518 |
-
|
519 |
-
/**
|
520 |
-
* @param bool $isSigned
|
521 |
-
*/
|
522 |
-
public function setIsSigned($isSigned)
|
523 |
-
{
|
524 |
-
$this->data->setIsSigned($isSigned);
|
525 |
-
|
526 |
-
$this->isSigned = $isSigned;
|
527 |
-
}
|
528 |
-
|
529 |
-
/**
|
530 |
-
* @return RequestorContract
|
531 |
-
*/
|
532 |
-
public function getRequestor()
|
533 |
-
{
|
534 |
-
return $this->requestor;
|
535 |
-
}
|
536 |
-
|
537 |
-
/**
|
538 |
-
* @param RequestorContract $requestor
|
539 |
-
*/
|
540 |
-
public function setRequestor(RequestorContract $requestor)
|
541 |
-
{
|
542 |
-
$this->requestor = $requestor;
|
543 |
-
}
|
544 |
-
|
545 |
-
/**
|
546 |
-
* @return string
|
547 |
-
*/
|
548 |
-
public function getClientSecret()
|
549 |
-
{
|
550 |
-
return $this->clientSecret;
|
551 |
-
}
|
552 |
-
|
553 |
-
/**
|
554 |
-
* @return Collector
|
555 |
-
*/
|
556 |
-
public function getCollector()
|
557 |
-
{
|
558 |
-
return $this->collector;
|
559 |
-
}
|
560 |
-
|
561 |
-
/**
|
562 |
-
* @param Collector $collector
|
563 |
-
*/
|
564 |
-
public function setCollector(Collector $collector)
|
565 |
-
{
|
566 |
-
$this->collector = $collector;
|
567 |
-
}
|
568 |
-
|
569 |
-
/**
|
570 |
-
* Do we allowing logging
|
571 |
-
*
|
572 |
-
* @return bool
|
573 |
-
*/
|
574 |
-
public function isAllowingLogging()
|
575 |
-
{
|
576 |
-
return $this->isOptedIn;
|
577 |
-
}
|
578 |
-
|
579 |
-
/**
|
580 |
-
* @return string
|
581 |
-
*/
|
582 |
-
public function getBasePluginPath()
|
583 |
-
{
|
584 |
-
return $this->basePluginPath;
|
585 |
-
}
|
586 |
-
|
587 |
-
/**
|
588 |
-
* @return bool
|
589 |
-
*/
|
590 |
-
public function isInstallResolved()
|
591 |
-
{
|
592 |
-
return $this->isInstallResolved;
|
593 |
-
}
|
594 |
-
|
595 |
-
/**
|
596 |
-
* @param bool $isInstallResolved
|
597 |
-
*/
|
598 |
-
public function setIsInstallResolved($isInstallResolved)
|
599 |
-
{
|
600 |
-
$this->data->setIsInstallResolved($isInstallResolved);
|
601 |
-
|
602 |
-
$this->isInstallResolved = $isInstallResolved;
|
603 |
-
}
|
604 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Account;
|
4 |
+
|
5 |
+
use Analyst\Analyst;
|
6 |
+
use Analyst\ApiRequestor;
|
7 |
+
use Analyst\Cache\DatabaseCache;
|
8 |
+
use Analyst\Collector;
|
9 |
+
use Analyst\Http\Requests\ActivateRequest;
|
10 |
+
use Analyst\Http\Requests\DeactivateRequest;
|
11 |
+
use Analyst\Http\Requests\InstallRequest;
|
12 |
+
use Analyst\Http\Requests\OptInRequest;
|
13 |
+
use Analyst\Http\Requests\OptOutRequest;
|
14 |
+
use Analyst\Http\Requests\UninstallRequest;
|
15 |
+
use Analyst\Notices\Notice;
|
16 |
+
use Analyst\Notices\NoticeFactory;
|
17 |
+
use Analyst\Contracts\TrackerContract;
|
18 |
+
use Analyst\Contracts\RequestorContract;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class Account
|
22 |
+
*
|
23 |
+
* This is plugin's account object
|
24 |
+
*/
|
25 |
+
class Account implements TrackerContract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Account id
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $id;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Basename of plugin
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $path;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Whether plugin is active or not
|
43 |
+
*
|
44 |
+
* @var bool
|
45 |
+
*/
|
46 |
+
protected $isInstalled = false;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Is user sign in for data tracking
|
50 |
+
*
|
51 |
+
* @var bool
|
52 |
+
*/
|
53 |
+
protected $isOptedIn = false;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Is user accepted permissions grant
|
57 |
+
* for collection site data
|
58 |
+
*
|
59 |
+
* @var bool
|
60 |
+
*/
|
61 |
+
protected $isSigned = false;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Is user ever resolved install modal window?
|
65 |
+
*
|
66 |
+
* @var bool
|
67 |
+
*/
|
68 |
+
protected $isInstallResolved = false;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Public secret code
|
72 |
+
*
|
73 |
+
* @var string
|
74 |
+
*/
|
75 |
+
protected $clientSecret;
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @var AccountData
|
79 |
+
*/
|
80 |
+
protected $data;
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Base plugin path
|
84 |
+
*
|
85 |
+
* @var string
|
86 |
+
*/
|
87 |
+
protected $basePluginPath;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @var RequestorContract
|
91 |
+
*/
|
92 |
+
protected $requestor;
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @var Collector
|
96 |
+
*/
|
97 |
+
protected $collector;
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Account constructor.
|
101 |
+
* @param $id
|
102 |
+
* @param $secret
|
103 |
+
* @param $baseDir
|
104 |
+
*/
|
105 |
+
public function __construct($id, $secret, $baseDir)
|
106 |
+
{
|
107 |
+
$this->id = $id;
|
108 |
+
$this->clientSecret = $secret;
|
109 |
+
|
110 |
+
$this->path = $baseDir;
|
111 |
+
|
112 |
+
$this->basePluginPath = plugin_basename($baseDir);
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* @return string
|
117 |
+
*/
|
118 |
+
public function getPath()
|
119 |
+
{
|
120 |
+
return $this->path;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* @param string $path
|
125 |
+
*/
|
126 |
+
public function setPath($path)
|
127 |
+
{
|
128 |
+
$this->data->setPath($path);
|
129 |
+
|
130 |
+
$this->path = $path;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* @return bool
|
135 |
+
*/
|
136 |
+
public function isOptedIn()
|
137 |
+
{
|
138 |
+
return $this->isOptedIn;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @param bool $isOptedIn
|
143 |
+
*/
|
144 |
+
public function setIsOptedIn($isOptedIn)
|
145 |
+
{
|
146 |
+
$this->data->setIsOptedIn($isOptedIn);
|
147 |
+
|
148 |
+
$this->isOptedIn = $isOptedIn;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Whether plugin is active
|
153 |
+
*
|
154 |
+
* @return bool
|
155 |
+
*/
|
156 |
+
public function isActive()
|
157 |
+
{
|
158 |
+
return is_plugin_active($this->path);
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* @param string $id
|
163 |
+
*/
|
164 |
+
public function setId($id)
|
165 |
+
{
|
166 |
+
$this->id = $id;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* @return string
|
171 |
+
*/
|
172 |
+
public function getId()
|
173 |
+
{
|
174 |
+
return $this->id;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* @return bool
|
179 |
+
*/
|
180 |
+
public function isInstalled()
|
181 |
+
{
|
182 |
+
return $this->isInstalled;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* @param bool $isInstalled
|
187 |
+
*/
|
188 |
+
public function setIsInstalled($isInstalled)
|
189 |
+
{
|
190 |
+
$this->data->setIsInstalled($isInstalled);
|
191 |
+
|
192 |
+
$this->isInstalled = $isInstalled;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Should register activation and deactivation
|
197 |
+
* event hooks
|
198 |
+
*
|
199 |
+
* @return void
|
200 |
+
*/
|
201 |
+
public function registerHooks()
|
202 |
+
{
|
203 |
+
register_activation_hook($this->basePluginPath, [&$this, 'onActivePluginListener']);
|
204 |
+
register_uninstall_hook($this->basePluginPath, ['Account\Account', 'onUninstallPluginListener']);
|
205 |
+
|
206 |
+
$this->addFilter('plugin_action_links', [&$this, 'onRenderActionLinksHook']);
|
207 |
+
|
208 |
+
$this->addAjax('analyst_opt_in', [&$this, 'onOptInListener']);
|
209 |
+
$this->addAjax('analyst_opt_out', [&$this, 'onOptOutListener']);
|
210 |
+
$this->addAjax('analyst_plugin_deactivate', [&$this, 'onDeactivatePluginListener']);
|
211 |
+
$this->addAjax('analyst_install', [&$this, 'onInstallListener']);
|
212 |
+
$this->addAjax('analyst_skip_install', [&$this, 'onSkipInstallListener']);
|
213 |
+
$this->addAjax('analyst_install_verified', [&$this, 'onInstallVerifiedListener']);
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Will fire when admin activates plugin
|
218 |
+
*
|
219 |
+
* @return void
|
220 |
+
*/
|
221 |
+
public function onActivePluginListener()
|
222 |
+
{
|
223 |
+
if (!$this->isInstallResolved()) {
|
224 |
+
DatabaseCache::getInstance()->put('plugin_to_install', $this->id);
|
225 |
+
}
|
226 |
+
|
227 |
+
if (!$this->isAllowingLogging()) return;
|
228 |
+
|
229 |
+
ActivateRequest::make($this->collector, $this->id, $this->path)
|
230 |
+
->execute($this->requestor);
|
231 |
+
|
232 |
+
$this->setIsInstalled(true);
|
233 |
+
|
234 |
+
AccountDataFactory::syncData();
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Will fire when admin deactivates plugin
|
239 |
+
*
|
240 |
+
* @return void
|
241 |
+
*/
|
242 |
+
public function onDeactivatePluginListener()
|
243 |
+
{
|
244 |
+
if (!$this->isAllowingLogging()) return;
|
245 |
+
|
246 |
+
$question = isset($_POST['question']) ? stripslashes($_POST['question']) : null;
|
247 |
+
$reason = isset($_POST['reason']) ? stripslashes($_POST['reason']) : null;
|
248 |
+
|
249 |
+
$response = DeactivateRequest::make($this->collector, $this->id, $this->path, $question, $reason)
|
250 |
+
->execute($this->requestor);
|
251 |
+
|
252 |
+
// Exit if request failed
|
253 |
+
if (!$response->isSuccess()) {
|
254 |
+
wp_send_json_error($response->body);
|
255 |
+
}
|
256 |
+
|
257 |
+
$this->setIsInstalled(false);
|
258 |
+
|
259 |
+
AccountDataFactory::syncData();
|
260 |
+
|
261 |
+
wp_send_json_success();
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Will fire when user opted in
|
266 |
+
*
|
267 |
+
* @return void
|
268 |
+
*/
|
269 |
+
public function onOptInListener()
|
270 |
+
{
|
271 |
+
$response = OptInRequest::make($this->collector, $this->id, $this->path)->execute($this->requestor);
|
272 |
+
|
273 |
+
// Exit if request failed
|
274 |
+
if (!$response->isSuccess()) {
|
275 |
+
wp_send_json_error($response->body);
|
276 |
+
}
|
277 |
+
|
278 |
+
$this->setIsOptedIn(true);
|
279 |
+
|
280 |
+
AccountDataFactory::syncData();
|
281 |
+
|
282 |
+
wp_die();
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Will fire when user opted out
|
287 |
+
*
|
288 |
+
* @return void
|
289 |
+
*/
|
290 |
+
public function onOptOutListener()
|
291 |
+
{
|
292 |
+
$response = OptOutRequest::make($this->collector, $this->id, $this->path)->execute($this->requestor);
|
293 |
+
|
294 |
+
// Exit if request failed
|
295 |
+
if (!$response->isSuccess()) {
|
296 |
+
wp_send_json_error($response->body);
|
297 |
+
}
|
298 |
+
|
299 |
+
$this->setIsOptedIn(false);
|
300 |
+
|
301 |
+
AccountDataFactory::syncData();
|
302 |
+
|
303 |
+
wp_send_json_success();
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Will fire when user accept opt-in
|
308 |
+
* at first time
|
309 |
+
*
|
310 |
+
* @return void
|
311 |
+
*/
|
312 |
+
public function onInstallListener()
|
313 |
+
{
|
314 |
+
$cache = DatabaseCache::getInstance();
|
315 |
+
|
316 |
+
// Set flag to true which indicates that install is resolved
|
317 |
+
// also remove install plugin id from cache
|
318 |
+
$this->setIsInstallResolved(true);
|
319 |
+
$cache->delete('plugin_to_install');
|
320 |
+
|
321 |
+
$response = InstallRequest::make($this->collector, $this->id, $this->path)->execute($this->requestor);
|
322 |
+
|
323 |
+
// Exit if request failed
|
324 |
+
if (!$response->isSuccess()) {
|
325 |
+
wp_send_json_error($response->body);
|
326 |
+
}
|
327 |
+
|
328 |
+
$this->setIsSigned(true);
|
329 |
+
|
330 |
+
$this->setIsOptedIn(true);
|
331 |
+
|
332 |
+
$factory = NoticeFactory::instance();
|
333 |
+
|
334 |
+
$message = sprintf('Please confirm your email by clicking on the link we sent to %s. This makes sure you’re not a bot.', $this->collector->getGeneralEmailAddress());
|
335 |
+
|
336 |
+
$notificationId = uniqid();
|
337 |
+
|
338 |
+
$notice = Notice::make(
|
339 |
+
$notificationId,
|
340 |
+
$this->getId(),
|
341 |
+
$message,
|
342 |
+
$this->collector->getPluginName($this->path)
|
343 |
+
);
|
344 |
+
|
345 |
+
$factory->addNotice($notice);
|
346 |
+
|
347 |
+
AccountDataFactory::syncData();
|
348 |
+
|
349 |
+
// Set email confirmation notification id to cache
|
350 |
+
// se we can extract and remove it when user confirmed email
|
351 |
+
$cache->put(
|
352 |
+
sprintf('account_email_confirmation_%s', $this->getId()),
|
353 |
+
$notificationId
|
354 |
+
);
|
355 |
+
|
356 |
+
wp_send_json_success();
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Will fire when user skipped installation
|
361 |
+
*
|
362 |
+
* @return void
|
363 |
+
*/
|
364 |
+
public function onSkipInstallListener()
|
365 |
+
{
|
366 |
+
// Set flag to true which indicates that install is resolved
|
367 |
+
// also remove install plugin id from cache
|
368 |
+
$this->setIsInstallResolved(true);
|
369 |
+
DatabaseCache::getInstance()->delete('plugin_to_install');
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Will fire when user delete plugin through admin panel.
|
374 |
+
* This action will happen if admin at least once
|
375 |
+
* activated the plugin.
|
376 |
+
*
|
377 |
+
* @return void
|
378 |
+
* @throws \Exception
|
379 |
+
*/
|
380 |
+
public static function onUninstallPluginListener()
|
381 |
+
{
|
382 |
+
$factory = AccountDataFactory::instance();
|
383 |
+
|
384 |
+
$pluginFile = substr(current_filter(), strlen( 'uninstall_' ));
|
385 |
+
|
386 |
+
$account = $factory->getAccountDataByBasePath($pluginFile);
|
387 |
+
|
388 |
+
// If account somehow is not found, exit the execution
|
389 |
+
if (!$account) return;
|
390 |
+
|
391 |
+
$analyst = Analyst::getInstance();
|
392 |
+
|
393 |
+
$collector = new Collector($analyst);
|
394 |
+
|
395 |
+
$requestor = new ApiRequestor($account->getId(), $account->getSecret(), $analyst->getApiBase());
|
396 |
+
|
397 |
+
// Just send request to log uninstall event not caring about response
|
398 |
+
UninstallRequest::make($collector, $account->getId(), $account->getPath())->execute($requestor);
|
399 |
+
|
400 |
+
$factory->sync();
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* Fires when used verified his account
|
405 |
+
*/
|
406 |
+
public function onInstallVerifiedListener()
|
407 |
+
{
|
408 |
+
$factory = NoticeFactory::instance();
|
409 |
+
|
410 |
+
$notice = Notice::make(
|
411 |
+
uniqid(),
|
412 |
+
$this->getId(),
|
413 |
+
'Thank you for confirming your email.',
|
414 |
+
$this->collector->getPluginName($this->path)
|
415 |
+
);
|
416 |
+
|
417 |
+
$factory->addNotice($notice);
|
418 |
+
|
419 |
+
// Remove confirmation notification
|
420 |
+
$confirmationNotificationId = DatabaseCache::getInstance()->pop(sprintf('account_email_confirmation_%s', $this->getId()));
|
421 |
+
$factory->remove($confirmationNotificationId);
|
422 |
+
|
423 |
+
AccountDataFactory::syncData();
|
424 |
+
|
425 |
+
wp_send_json_success();
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Will fire when wp renders plugin
|
430 |
+
* action buttons
|
431 |
+
*
|
432 |
+
* @param $defaultLinks
|
433 |
+
* @return array
|
434 |
+
*/
|
435 |
+
public function onRenderActionLinksHook($defaultLinks)
|
436 |
+
{
|
437 |
+
$customLinks = [];
|
438 |
+
|
439 |
+
$customLinks[] = $this->isOptedIn()
|
440 |
+
? '<a class="analyst-action-opt analyst-opt-out" analyst-plugin-id="' . $this->getId() . '" analyst-plugin-signed="' . (int) $this->isSigned() . '">Opt Out</a>'
|
441 |
+
: '<a class="analyst-action-opt analyst-opt-in" analyst-plugin-id="' . $this->getId() . '" analyst-plugin-signed="' . (int) $this->isSigned() . '">Opt In</a>';
|
442 |
+
|
443 |
+
// Append anchor to find specific deactivation link
|
444 |
+
if (isset($defaultLinks['deactivate'])) {
|
445 |
+
$defaultLinks['deactivate'] .= '<span analyst-plugin-id="' . $this->getId() . '" analyst-plugin-opted-in="' . (int) $this->isOptedIn() . '"></span>';
|
446 |
+
}
|
447 |
+
|
448 |
+
return array_merge($customLinks, $defaultLinks);
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* @return AccountData
|
453 |
+
*/
|
454 |
+
public function getData()
|
455 |
+
{
|
456 |
+
return $this->data;
|
457 |
+
}
|
458 |
+
|
459 |
+
/**
|
460 |
+
* @param AccountData $data
|
461 |
+
*/
|
462 |
+
public function setData(AccountData $data)
|
463 |
+
{
|
464 |
+
$this->data = $data;
|
465 |
+
|
466 |
+
$this->setIsOptedIn($data->isOptedIn());
|
467 |
+
$this->setIsInstalled($data->isInstalled());
|
468 |
+
$this->setIsSigned($data->isSigned());
|
469 |
+
$this->setIsInstallResolved($data->isInstallResolved());
|
470 |
+
}
|
471 |
+
|
472 |
+
/**
|
473 |
+
* Resolves valid action name
|
474 |
+
* based on client id
|
475 |
+
*
|
476 |
+
* @param $action
|
477 |
+
* @return string
|
478 |
+
*/
|
479 |
+
private function resolveActionName($action)
|
480 |
+
{
|
481 |
+
return sprintf('%s_%s', $action, $this->id);
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* Register action for current plugin
|
486 |
+
*
|
487 |
+
* @param $action
|
488 |
+
* @param $callback
|
489 |
+
*/
|
490 |
+
private function addFilter($action, $callback)
|
491 |
+
{
|
492 |
+
$validAction = sprintf('%s_%s', $action, $this->basePluginPath);
|
493 |
+
|
494 |
+
add_filter($validAction, $callback, 10);
|
495 |
+
}
|
496 |
+
|
497 |
+
/**
|
498 |
+
* Add ajax action for current plugin
|
499 |
+
*
|
500 |
+
* @param $action
|
501 |
+
* @param $callback
|
502 |
+
* @param bool $raw Format action ??
|
503 |
+
*/
|
504 |
+
private function addAjax($action, $callback, $raw = false)
|
505 |
+
{
|
506 |
+
$validAction = $raw ? $action : sprintf('%s%s', 'wp_ajax_', $this->resolveActionName($action));
|
507 |
+
|
508 |
+
add_action($validAction, $callback);
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* @return bool
|
513 |
+
*/
|
514 |
+
public function isSigned()
|
515 |
+
{
|
516 |
+
return $this->isSigned;
|
517 |
+
}
|
518 |
+
|
519 |
+
/**
|
520 |
+
* @param bool $isSigned
|
521 |
+
*/
|
522 |
+
public function setIsSigned($isSigned)
|
523 |
+
{
|
524 |
+
$this->data->setIsSigned($isSigned);
|
525 |
+
|
526 |
+
$this->isSigned = $isSigned;
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* @return RequestorContract
|
531 |
+
*/
|
532 |
+
public function getRequestor()
|
533 |
+
{
|
534 |
+
return $this->requestor;
|
535 |
+
}
|
536 |
+
|
537 |
+
/**
|
538 |
+
* @param RequestorContract $requestor
|
539 |
+
*/
|
540 |
+
public function setRequestor(RequestorContract $requestor)
|
541 |
+
{
|
542 |
+
$this->requestor = $requestor;
|
543 |
+
}
|
544 |
+
|
545 |
+
/**
|
546 |
+
* @return string
|
547 |
+
*/
|
548 |
+
public function getClientSecret()
|
549 |
+
{
|
550 |
+
return $this->clientSecret;
|
551 |
+
}
|
552 |
+
|
553 |
+
/**
|
554 |
+
* @return Collector
|
555 |
+
*/
|
556 |
+
public function getCollector()
|
557 |
+
{
|
558 |
+
return $this->collector;
|
559 |
+
}
|
560 |
+
|
561 |
+
/**
|
562 |
+
* @param Collector $collector
|
563 |
+
*/
|
564 |
+
public function setCollector(Collector $collector)
|
565 |
+
{
|
566 |
+
$this->collector = $collector;
|
567 |
+
}
|
568 |
+
|
569 |
+
/**
|
570 |
+
* Do we allowing logging
|
571 |
+
*
|
572 |
+
* @return bool
|
573 |
+
*/
|
574 |
+
public function isAllowingLogging()
|
575 |
+
{
|
576 |
+
return $this->isOptedIn;
|
577 |
+
}
|
578 |
+
|
579 |
+
/**
|
580 |
+
* @return string
|
581 |
+
*/
|
582 |
+
public function getBasePluginPath()
|
583 |
+
{
|
584 |
+
return $this->basePluginPath;
|
585 |
+
}
|
586 |
+
|
587 |
+
/**
|
588 |
+
* @return bool
|
589 |
+
*/
|
590 |
+
public function isInstallResolved()
|
591 |
+
{
|
592 |
+
return $this->isInstallResolved;
|
593 |
+
}
|
594 |
+
|
595 |
+
/**
|
596 |
+
* @param bool $isInstallResolved
|
597 |
+
*/
|
598 |
+
public function setIsInstallResolved($isInstallResolved)
|
599 |
+
{
|
600 |
+
$this->data->setIsInstallResolved($isInstallResolved);
|
601 |
+
|
602 |
+
$this->isInstallResolved = $isInstallResolved;
|
603 |
+
}
|
604 |
+
}
|
analyst/src/Mutator.php
CHANGED
@@ -1,103 +1,103 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Analyst;
|
4 |
-
|
5 |
-
use Analyst\Cache\DatabaseCache;
|
6 |
-
use Analyst\Contracts\CacheContract;
|
7 |
-
use Analyst\Notices\NoticeFactory;
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Class Mutator mutates (modifies) UX with additional
|
11 |
-
* functional
|
12 |
-
*/
|
13 |
-
class Mutator
|
14 |
-
{
|
15 |
-
protected $notices = [];
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var NoticeFactory
|
19 |
-
*/
|
20 |
-
protected $factory;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var CacheContract
|
24 |
-
*/
|
25 |
-
protected $cache;
|
26 |
-
|
27 |
-
public function __construct()
|
28 |
-
{
|
29 |
-
$this->factory = NoticeFactory::instance();
|
30 |
-
|
31 |
-
$this->notices = $this->factory->getNotices();
|
32 |
-
|
33 |
-
$this->cache = DatabaseCache::getInstance();
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Register filters all necessary stuff.
|
38 |
-
* Can be invoked only once.
|
39 |
-
*
|
40 |
-
* @return void
|
41 |
-
*/
|
42 |
-
public function initialize()
|
43 |
-
{
|
44 |
-
$this->registerLinks();
|
45 |
-
$this->registerAssets();
|
46 |
-
$this->registerHooks();
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Register all necessary filters and templates
|
51 |
-
*
|
52 |
-
* @return void
|
53 |
-
*/
|
54 |
-
protected function registerLinks()
|
55 |
-
{
|
56 |
-
add_action('admin_footer', function () {
|
57 |
-
analyst_require_template('optout.php', [
|
58 |
-
'shieldImage' => analyst_assets_url('img/shield_question.png')
|
59 |
-
]);
|
60 |
-
|
61 |
-
analyst_require_template('optin.php');
|
62 |
-
|
63 |
-
analyst_require_template('forms/deactivate.php', [
|
64 |
-
'pencilImage' => analyst_assets_url('img/pencil.png'),
|
65 |
-
'smileImage' => analyst_assets_url('img/smile.png'),
|
66 |
-
]);
|
67 |
-
|
68 |
-
analyst_require_template('forms/install.php', [
|
69 |
-
'pluginToInstall' => $this->cache->get('plugin_to_install'),
|
70 |
-
'shieldImage' => analyst_assets_url('img/shield_success.png'),
|
71 |
-
]);
|
72 |
-
});
|
73 |
-
|
74 |
-
add_action('admin_notices',function () {
|
75 |
-
foreach ($this->notices as $notice) {
|
76 |
-
analyst_require_template('notice.php', ['notice' => $notice]);
|
77 |
-
}
|
78 |
-
});
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Register all assets
|
83 |
-
*/
|
84 |
-
public function registerAssets()
|
85 |
-
{
|
86 |
-
add_action('admin_enqueue_scripts', function () {
|
87 |
-
wp_enqueue_style('analyst_custom', analyst_assets_url('/css/customize.css'));
|
88 |
-
wp_enqueue_script('analyst_custom', analyst_assets_url('/js/customize.js'));
|
89 |
-
});
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Register action hooks
|
94 |
-
*/
|
95 |
-
public function registerHooks()
|
96 |
-
{
|
97 |
-
add_action('wp_ajax_analyst_notification_dismiss', function () {
|
98 |
-
$this->factory->remove($_POST['id']);
|
99 |
-
|
100 |
-
$this->factory->sync();
|
101 |
-
});
|
102 |
-
}
|
103 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Analyst;
|
4 |
+
|
5 |
+
use Analyst\Cache\DatabaseCache;
|
6 |
+
use Analyst\Contracts\CacheContract;
|
7 |
+
use Analyst\Notices\NoticeFactory;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class Mutator mutates (modifies) UX with additional
|
11 |
+
* functional
|
12 |
+
*/
|
13 |
+
class Mutator
|
14 |
+
{
|
15 |
+
protected $notices = [];
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var NoticeFactory
|
19 |
+
*/
|
20 |
+
protected $factory;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var CacheContract
|
24 |
+
*/
|
25 |
+
protected $cache;
|
26 |
+
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
$this->factory = NoticeFactory::instance();
|
30 |
+
|
31 |
+
$this->notices = $this->factory->getNotices();
|
32 |
+
|
33 |
+
$this->cache = DatabaseCache::getInstance();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Register filters all necessary stuff.
|
38 |
+
* Can be invoked only once.
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function initialize()
|
43 |
+
{
|
44 |
+
$this->registerLinks();
|
45 |
+
$this->registerAssets();
|
46 |
+
$this->registerHooks();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Register all necessary filters and templates
|
51 |
+
*
|
52 |
+
* @return void
|
53 |
+
*/
|
54 |
+
protected function registerLinks()
|
55 |
+
{
|
56 |
+
add_action('admin_footer', function () {
|
57 |
+
analyst_require_template('optout.php', [
|
58 |
+
'shieldImage' => analyst_assets_url('img/shield_question.png')
|
59 |
+
]);
|
60 |
+
|
61 |
+
analyst_require_template('optin.php');
|
62 |
+
|
63 |
+
analyst_require_template('forms/deactivate.php', [
|
64 |
+
'pencilImage' => analyst_assets_url('img/pencil.png'),
|
65 |
+
'smileImage' => analyst_assets_url('img/smile.png'),
|
66 |
+
]);
|
67 |
+
|
68 |
+
analyst_require_template('forms/install.php', [
|
69 |
+
'pluginToInstall' => $this->cache->get('plugin_to_install'),
|
70 |
+
'shieldImage' => analyst_assets_url('img/shield_success.png'),
|
71 |
+
]);
|
72 |
+
});
|
73 |
+
|
74 |
+
add_action('admin_notices',function () {
|
75 |
+
foreach ($this->notices as $notice) {
|
76 |
+
analyst_require_template('notice.php', ['notice' => $notice]);
|
77 |
+
}
|
78 |
+
});
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Register all assets
|
83 |
+
*/
|
84 |
+
public function registerAssets()
|
85 |
+
{
|
86 |
+
add_action('admin_enqueue_scripts', function () {
|
87 |
+
wp_enqueue_style('analyst_custom', analyst_assets_url('/css/customize.css'));
|
88 |
+
wp_enqueue_script('analyst_custom', analyst_assets_url('/js/customize.js'));
|
89 |
+
});
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Register action hooks
|
94 |
+
*/
|
95 |
+
public function registerHooks()
|
96 |
+
{
|
97 |
+
add_action('wp_ajax_analyst_notification_dismiss', function () {
|
98 |
+
$this->factory->remove($_POST['id']);
|
99 |
+
|
100 |
+
$this->factory->sync();
|
101 |
+
});
|
102 |
+
}
|
103 |
+
}
|
analyst/version.php
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
return array(
|
4 |
-
// The sdk version
|
5 |
-
'sdk' => '1.3.26',
|
6 |
-
|
7 |
-
// Minimum supported WordPress version
|
8 |
-
'wp' => '4.7',
|
9 |
-
|
10 |
-
// Supported PHP version
|
11 |
-
'php' => '5.4',
|
12 |
-
|
13 |
-
// Path to current SDK$
|
14 |
-
'path' => __DIR__,
|
15 |
-
);
|
1 |
+
<?php
|
2 |
+
|
3 |
+
return array(
|
4 |
+
// The sdk version
|
5 |
+
'sdk' => '1.3.26',
|
6 |
+
|
7 |
+
// Minimum supported WordPress version
|
8 |
+
'wp' => '4.7',
|
9 |
+
|
10 |
+
// Supported PHP version
|
11 |
+
'php' => '5.4',
|
12 |
+
|
13 |
+
// Path to current SDK$
|
14 |
+
'path' => __DIR__,
|
15 |
+
);
|
js/custom-admin.js
CHANGED
@@ -1,3298 +1,3298 @@
|
|
1 |
-
function sfsi_update_index() {
|
2 |
-
var s = 1;
|
3 |
-
SFSI("ul.icn_listing li.custom").each(function () {
|
4 |
-
SFSI(this).children("span.custom-txt").html("Custom " + s), s++;
|
5 |
-
}), cntt = 1, SFSI("div.cm_lnk").each(function () {
|
6 |
-
SFSI(this).find("h2.custom").find("span.sfsiCtxt").html("Custom " + cntt + ":"),
|
7 |
-
cntt++;
|
8 |
-
}), cntt = 1, SFSI("div.custom_m").find("div.custom_section").each(function () {
|
9 |
-
SFSI(this).find("label").html("Custom " + cntt + ":"), cntt++;
|
10 |
-
});
|
11 |
-
}
|
12 |
-
|
13 |
-
function sfsicollapse(s) {
|
14 |
-
var i = !0,
|
15 |
-
e = SFSI(s).closest("div.ui-accordion-content").prev("h3.ui-accordion-header"),
|
16 |
-
t = SFSI(s).closest("div.ui-accordion-content").first();
|
17 |
-
e.toggleClass("ui-corner-all", i).toggleClass("accordion-header-active ui-state-active ui-corner-top", !i).attr("aria-selected", (!i).toString()),
|
18 |
-
e.children(".ui-icon").toggleClass("ui-icon-triangle-1-e", i).toggleClass("ui-icon-triangle-1-s", !i),
|
19 |
-
t.toggleClass("accordion-content-active", !i), i ? t.slideUp() : t.slideDown();
|
20 |
-
}
|
21 |
-
|
22 |
-
function sfsi_delete_CusIcon(s, i) {
|
23 |
-
beForeLoad();
|
24 |
-
var e = {
|
25 |
-
action: "deleteIcons",
|
26 |
-
icon_name: i.attr("name"),
|
27 |
-
nonce: SFSI(i).parents('.custom').find('input[name="nonce"]').val()
|
28 |
-
};
|
29 |
-
SFSI.ajax({
|
30 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
31 |
-
type: "post",
|
32 |
-
data: e,
|
33 |
-
dataType: "json",
|
34 |
-
success: function (e) {
|
35 |
-
if ("success" == e.res) {
|
36 |
-
showErrorSuc("success", "Saved !", 1);
|
37 |
-
var t = e.last_index + 1;
|
38 |
-
SFSI("#total_cusotm_icons").val(e.total_up), SFSI(s).closest(".custom").remove(),
|
39 |
-
SFSI("li.custom:last-child").addClass("bdr_btm_non"), SFSI(".custom-links").find("div." + i.attr("name")).remove(),
|
40 |
-
SFSI(".custom_m").find("div." + i.attr("name")).remove(), SFSI(".share_icon_order").children("li." + i.attr("name")).remove(),
|
41 |
-
SFSI("ul.sfsi_sample_icons").children("li." + i.attr("name")).remove();
|
42 |
-
|
43 |
-
if (e.total_up == 0) {
|
44 |
-
SFSI(".notice_custom_icons_premium").hide();
|
45 |
-
}
|
46 |
-
var n = e.total_up + 1;
|
47 |
-
4 == e.total_up && SFSI(".icn_listing").append('<li id="c' + t + '" class="custom bdr_btm_non"><div class="radio_section tb_4_ck"><span class="checkbox" dynamic_ele="yes" style="background-position: 0px 0px;"></span><input name="sfsiICON_' + t + '_display" type="checkbox" value="yes" class="styled" style="display:none;" isNew="yes" /></div> <span class="custom-img"><img src="' + SFSI("#plugin_url").val() + 'images/custom.png" id="CImg_' + t + '" alt="error" /> </span> <span class="custom custom-txt">Custom' + n + ' </span> <div class="right_info"> <p><span>It depends:</span> Upload a custom icon if you have other accounts/websites you want to link to.</p><div class="inputWrapper"></div></li>');
|
48 |
-
} else showErrorSuc("error", "Unkown error , please try again", 1);
|
49 |
-
return sfsi_update_index(), update_Sec5Iconorder(), sfsi_update_step1(), sfsi_update_step5(),
|
50 |
-
afterLoad(), "suc";
|
51 |
-
}
|
52 |
-
});
|
53 |
-
}
|
54 |
-
|
55 |
-
function update_Sec5Iconorder() {
|
56 |
-
SFSI("ul.share_icon_order").children("li").each(function () {
|
57 |
-
SFSI(this).attr("data-index", SFSI(this).index() + 1);
|
58 |
-
});
|
59 |
-
}
|
60 |
-
|
61 |
-
function sfsi_section_Display(s, i) {
|
62 |
-
"hide" == i ? (SFSI("." + s + " :input").prop("disabled", !0), SFSI("." + s + " :button").prop("disabled", !0),
|
63 |
-
SFSI("." + s).hide()) : (SFSI("." + s + " :input").removeAttr("disabled", !0), SFSI("." + s + " :button").removeAttr("disabled", !0),
|
64 |
-
SFSI("." + s).show());
|
65 |
-
}
|
66 |
-
|
67 |
-
function sfsi_depened_sections() {
|
68 |
-
if ("sfsi" == SFSI("input[name='sfsi_rss_icons']:checked").val()) {
|
69 |
-
for (i = 0; 16 > i; i++) {
|
70 |
-
var s = i + 1,
|
71 |
-
e = 74 * i;
|
72 |
-
SFSI(".row_" + s + "_2").css("background-position", "-588px -" + e + "px");
|
73 |
-
}
|
74 |
-
var t = SFSI(".icon_img").attr("src");
|
75 |
-
if (t) {
|
76 |
-
if (t.indexOf("subscribe") != -1) {
|
77 |
-
var n = t.replace("subscribe.png", "sf_arow_icn.png");
|
78 |
-
} else {
|
79 |
-
var n = t.replace("email.png", "sf_arow_icn.png");
|
80 |
-
}
|
81 |
-
SFSI(".icon_img").attr("src", n);
|
82 |
-
}
|
83 |
-
} else {
|
84 |
-
if ("email" == SFSI("input[name='sfsi_rss_icons']:checked").val()) {
|
85 |
-
for (SFSI(".row_1_2").css("background-position", "-58px 0"), i = 0; 16 > i; i++) {
|
86 |
-
var s = i + 1,
|
87 |
-
e = 74 * i;
|
88 |
-
SFSI(".row_" + s + "_2").css("background-position", "-58px -" + e + "px");
|
89 |
-
}
|
90 |
-
var t = SFSI(".icon_img").attr("src");
|
91 |
-
if (t) {
|
92 |
-
if (t.indexOf("sf_arow_icn") != -1) {
|
93 |
-
var n = t.replace("sf_arow_icn.png", "email.png");
|
94 |
-
} else {
|
95 |
-
var n = t.replace("subscribe.png", "email.png");
|
96 |
-
}
|
97 |
-
SFSI(".icon_img").attr("src", n);
|
98 |
-
}
|
99 |
-
} else {
|
100 |
-
for (SFSI(".row_1_2").css("background-position", "-649px 0"), i = 0; 16 > i; i++) {
|
101 |
-
var s = i + 1,
|
102 |
-
e = 74 * i;
|
103 |
-
SFSI(".row_" + s + "_2").css("background-position", "-649px -" + e + "px");
|
104 |
-
}
|
105 |
-
var t = SFSI(".icon_img").attr("src");
|
106 |
-
if (t) {
|
107 |
-
if (t.indexOf("email") != -1) {
|
108 |
-
var n = t.replace("email.png", "subscribe.png");
|
109 |
-
} else {
|
110 |
-
var n = t.replace("sf_arow_icn.png", "subscribe.png");
|
111 |
-
}
|
112 |
-
SFSI(".icon_img").attr("src", n);
|
113 |
-
}
|
114 |
-
}
|
115 |
-
}
|
116 |
-
SFSI("input[name='sfsi_rss_display']").prop("checked") ? sfsi_section_Display("rss_section", "show") : sfsi_section_Display("rss_section", "hide"),
|
117 |
-
SFSI("input[name='sfsi_email_display']").prop("checked") ? sfsi_section_Display("email_section", "show") : sfsi_section_Display("email_section", "hide"),
|
118 |
-
SFSI("input[name='sfsi_facebook_display']").prop("checked") ? sfsi_section_Display("facebook_section", "show") : sfsi_section_Display("facebook_section", "hide"),
|
119 |
-
SFSI("input[name='sfsi_twitter_display']").prop("checked") ? sfsi_section_Display("twitter_section", "show") : sfsi_section_Display("twitter_section", "hide"),
|
120 |
-
SFSI("input[name='sfsi_youtube_display']").prop("checked") ? sfsi_section_Display("youtube_section", "show") : sfsi_section_Display("youtube_section", "hide"),
|
121 |
-
SFSI("input[name='sfsi_pinterest_display']").prop("checked") ? sfsi_section_Display("pinterest_section", "show") : sfsi_section_Display("pinterest_section", "hide"),
|
122 |
-
SFSI("input[name='sfsi_telegram_display']").prop("checked") ? sfsi_section_Display("telegram_section", "show") : sfsi_section_Display("telegram_section", "hide"),
|
123 |
-
SFSI("input[name='sfsi_vk_display']").prop("checked") ? sfsi_section_Display("vk_section", "show") : sfsi_section_Display("vk_section", "hide"),
|
124 |
-
SFSI("input[name='sfsi_ok_display']").prop("checked") ? sfsi_section_Display("ok_section", "show") : sfsi_section_Display("ok_section", "hide"),
|
125 |
-
SFSI("input[name='sfsi_wechat_display']").prop("checked") ? sfsi_section_Display("wechat_section", "show") : sfsi_section_Display("wechat_section", "hide"),
|
126 |
-
SFSI("input[name='sfsi_weibo_display']").prop("checked") ? sfsi_section_Display("weibo_section", "show") : sfsi_section_Display("weibo_section", "hide"),
|
127 |
-
SFSI("input[name='sfsi_instagram_display']").prop("checked") ? sfsi_section_Display("instagram_section", "show") : sfsi_section_Display("instagram_section", "hide"),
|
128 |
-
SFSI("input[name='sfsi_linkedin_display']").prop("checked") ? sfsi_section_Display("linkedin_section", "show") : sfsi_section_Display("linkedin_section", "hide"),
|
129 |
-
SFSI("input[element-type='cusotm-icon']").prop("checked") ? sfsi_section_Display("custom_section", "show") : sfsi_section_Display("custom_section", "hide");
|
130 |
-
}
|
131 |
-
|
132 |
-
function CustomIConSectionsUpdate() {
|
133 |
-
sfsi_section_Display("counter".ele, show);
|
134 |
-
}
|
135 |
-
|
136 |
-
// Upload Custom Skin {Monad}
|
137 |
-
function sfsi_customskin_upload(s, ref, nonce) {
|
138 |
-
var ttl = jQuery(ref).attr("title");
|
139 |
-
var i = s,
|
140 |
-
e = {
|
141 |
-
action: "UploadSkins",
|
142 |
-
custom_imgurl: i,
|
143 |
-
nonce: nonce
|
144 |
-
};
|
145 |
-
SFSI.ajax({
|
146 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
147 |
-
type: "post",
|
148 |
-
data: e,
|
149 |
-
success: function (msg) {
|
150 |
-
if (msg.res = "success") {
|
151 |
-
var arr = s.split('=');
|
152 |
-
jQuery(ref).prev('.imgskin').attr('src', arr[1]);
|
153 |
-
jQuery(ref).prev('.imgskin').css("display", "block");
|
154 |
-
jQuery(ref).text("Update");
|
155 |
-
jQuery(ref).next('.dlt_btn').css("display", "block");
|
156 |
-
}
|
157 |
-
}
|
158 |
-
});
|
159 |
-
}
|
160 |
-
|
161 |
-
// Delete Custom Skin {Monad}
|
162 |
-
function deleteskin_icon(s) {
|
163 |
-
var iconname = jQuery(s).attr("title");
|
164 |
-
var nonce = jQuery(s).attr("data-nonce");
|
165 |
-
var i = iconname,
|
166 |
-
e = {
|
167 |
-
action: "DeleteSkin",
|
168 |
-
iconname: i,
|
169 |
-
nonce: nonce
|
170 |
-
};
|
171 |
-
console.log('delete sin icon', i, iconname, nonce);
|
172 |
-
SFSI.ajax({
|
173 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
174 |
-
type: "post",
|
175 |
-
data: e,
|
176 |
-
dataType: "json",
|
177 |
-
success: function (msg) {
|
178 |
-
console.log(s, e, msg);
|
179 |
-
|
180 |
-
if (msg.res === "success") {
|
181 |
-
SFSI(s).prev("a").text("Upload");
|
182 |
-
SFSI(s).prev("a").prev("img").attr("src", '');
|
183 |
-
SFSI(s).prev("a").prev("img").css("display", "none");
|
184 |
-
SFSI(s).css("display", "none");
|
185 |
-
} else {
|
186 |
-
alert("Whoops! something went wrong.")
|
187 |
-
}
|
188 |
-
}
|
189 |
-
});
|
190 |
-
}
|
191 |
-
|
192 |
-
// Save Custom Skin {Monad}
|
193 |
-
function SFSI_done(nonce) {
|
194 |
-
e = {
|
195 |
-
action: "Iamdone",
|
196 |
-
nonce: nonce
|
197 |
-
};
|
198 |
-
|
199 |
-
SFSI.ajax({
|
200 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
201 |
-
type: "post",
|
202 |
-
data: e,
|
203 |
-
success: function (msg) {
|
204 |
-
if (msg.res === "success") {
|
205 |
-
|
206 |
-
|
207 |
-
jQuery("li.cstomskins_upload").children(".icns_tab_3").html(msg);
|
208 |
-
SFSI("input[name='sfsi_rss_display']").prop("checked") ? sfsi_section_Display("rss_section", "show") : sfsi_section_Display("rss_section", "hide"), SFSI("input[name='sfsi_email_display']").prop("checked") ? sfsi_section_Display("email_section", "show") : sfsi_section_Display("email_section", "hide"), SFSI("input[name='sfsi_facebook_display']").prop("checked") ? sfsi_section_Display("facebook_section", "show") : sfsi_section_Display("facebook_section", "hide"), SFSI("input[name='sfsi_twitter_display']").prop("checked") ? sfsi_section_Display("twitter_section", "show") : sfsi_section_Display("twitter_section", "hide"), SFSI("input[name='sfsi_youtube_display']").prop("checked") ? sfsi_section_Display("youtube_section", "show") : sfsi_section_Display("youtube_section", "hide"), SFSI("input[name='sfsi_pinterest_display']").prop("checked") ? sfsi_section_Display("pinterest_section", "show") : sfsi_section_Display("pinterest_section", "hide"), SFSI("input[name='sfsi_instagram_display']").prop("checked") ? sfsi_section_Display("instagram_section", "show") : sfsi_section_Display("instagram_section", "hide"), SFSI("input[name='sfsi_linkedin_display']").prop("checked") ? sfsi_section_Display("linkedin_section", "show") : sfsi_section_Display("linkedin_section", "hide"), SFSI("input[element-type='cusotm-icon']").prop("checked") ? sfsi_section_Display("custom_section", "show") : sfsi_section_Display("custom_section", "hide");
|
209 |
-
SFSI(".cstmskins-overlay").hide("slow");
|
210 |
-
sfsi_update_step3() && sfsicollapse(this);
|
211 |
-
}
|
212 |
-
}
|
213 |
-
});
|
214 |
-
}
|
215 |
-
|
216 |
-
// Upload Custom Icons {Monad}
|
217 |
-
function sfsi_newcustomicon_upload(s, nonce, nonce2) {
|
218 |
-
var i = s,
|
219 |
-
e = {
|
220 |
-
action: "UploadIcons",
|
221 |
-
custom_imgurl: i,
|
222 |
-
nonce: nonce
|
223 |
-
};
|
224 |
-
SFSI.ajax({
|
225 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
226 |
-
type: "post",
|
227 |
-
data: e,
|
228 |
-
dataType: "json",
|
229 |
-
async: !0,
|
230 |
-
success: function (s) {
|
231 |
-
if (s.res == 'success') {
|
232 |
-
afterIconSuccess(s, nonce2);
|
233 |
-
} else {
|
234 |
-
SFSI(".upload-overlay").hide("slow");
|
235 |
-
SFSI(".uperror").html(s.res);
|
236 |
-
showErrorSuc("Error", "Some Error Occured During Upload Custom Icon", 1)
|
237 |
-
}
|
238 |
-
}
|
239 |
-
});
|
240 |
-
}
|
241 |
-
|
242 |
-
function sfsi_update_step1() {
|
243 |
-
var nonce = SFSI("#sfsi_save1").attr("data-nonce");
|
244 |
-
global_error = 0, beForeLoad(), sfsi_depened_sections();
|
245 |
-
var s = !1,
|
246 |
-
i = SFSI("input[name='sfsi_rss_display']:checked").val(),
|
247 |
-
e = SFSI("input[name='sfsi_email_display']:checked").val(),
|
248 |
-
t = SFSI("input[name='sfsi_facebook_display']:checked").val(),
|
249 |
-
n = SFSI("input[name='sfsi_twitter_display']:checked").val(),
|
250 |
-
r = SFSI("input[name='sfsi_youtube_display']:checked").val(),
|
251 |
-
c = SFSI("input[name='sfsi_pinterest_display']:checked").val(),
|
252 |
-
p = SFSI("input[name='sfsi_linkedin_display']:checked").val(),
|
253 |
-
tg = SFSI("input[name='sfsi_telegram_display']:checked").val(),
|
254 |
-
vk = SFSI("input[name='sfsi_vk_display']:checked").val(),
|
255 |
-
ok = SFSI("input[name='sfsi_ok_display']:checked").val(),
|
256 |
-
wc = SFSI("input[name='sfsi_wechat_display']:checked").val(),
|
257 |
-
wb = SFSI("input[name='sfsi_weibo_display']:checked").val(),
|
258 |
-
_ = SFSI("input[name='sfsi_instagram_display']:checked").val(),
|
259 |
-
l = SFSI("input[name='sfsi_custom1_display']:checked").val(),
|
260 |
-
S = SFSI("input[name='sfsi_custom2_display']:checked").val(),
|
261 |
-
u = SFSI("input[name='sfsi_custom3_display']:checked").val(),
|
262 |
-
f = SFSI("input[name='sfsi_custom4_display']:checked").val(),
|
263 |
-
d = SFSI("input[name='sfsi_custom5_display']:checked").val(),
|
264 |
-
I = {
|
265 |
-
action: "updateSrcn1",
|
266 |
-
sfsi_rss_display: i,
|
267 |
-
sfsi_email_display: e,
|
268 |
-
sfsi_facebook_display: t,
|
269 |
-
sfsi_twitter_display: n,
|
270 |
-
sfsi_youtube_display: r,
|
271 |
-
sfsi_pinterest_display: c,
|
272 |
-
sfsi_linkedin_display: p,
|
273 |
-
sfsi_telegram_display: tg,
|
274 |
-
sfsi_vk_display: vk,
|
275 |
-
sfsi_ok_display: ok,
|
276 |
-
sfsi_wechat_display: wc,
|
277 |
-
sfsi_weibo_display: wb,
|
278 |
-
sfsi_instagram_display: _,
|
279 |
-
sfsi_custom1_display: l,
|
280 |
-
sfsi_custom2_display: S,
|
281 |
-
sfsi_custom3_display: u,
|
282 |
-
sfsi_custom4_display: f,
|
283 |
-
sfsi_custom5_display: d,
|
284 |
-
nonce: nonce
|
285 |
-
};
|
286 |
-
SFSI.ajax({
|
287 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
288 |
-
type: "post",
|
289 |
-
data: I,
|
290 |
-
async: !0,
|
291 |
-
dataType: "json",
|
292 |
-
success: function (i) {
|
293 |
-
if (i == "wrong_nonce") {
|
294 |
-
showErrorSuc("error", "Unauthorised Request, Try again after refreshing page", 1);
|
295 |
-
s = !1;
|
296 |
-
afterLoad();
|
297 |
-
} else {
|
298 |
-
"success" == i ? (showErrorSuc("success", "Saved !", 1), sfsicollapse("#sfsi_save1"),
|
299 |
-
sfsi_make_popBox()) : (global_error = 1, showErrorSuc("error", "Unkown error , please try again", 1),
|
300 |
-
s = !1), afterLoad();
|
301 |
-
}
|
302 |
-
}
|
303 |
-
});
|
304 |
-
}
|
305 |
-
|
306 |
-
function sfsi_update_step2() {
|
307 |
-
|
308 |
-
var nonce = SFSI("#sfsi_save2").attr("data-nonce");
|
309 |
-
var s = sfsi_validationStep2();
|
310 |
-
if (!s) return global_error = 1, !1;
|
311 |
-
beForeLoad();
|
312 |
-
var i = 1 == SFSI("input[name='sfsi_rss_url']").prop("disabled") ? "" : SFSI("input[name='sfsi_rss_url']").val(),
|
313 |
-
e = 1 == SFSI("input[name='sfsi_rss_icons']").prop("disabled") ? "" : SFSI("input[name='sfsi_rss_icons']:checked").val(),
|
314 |
-
|
315 |
-
t = 1 == SFSI("input[name='sfsi_facebookPage_option']").prop("disabled") ? "" : SFSI("input[name='sfsi_facebookPage_option']:checked").val(),
|
316 |
-
n = 1 == SFSI("input[name='sfsi_facebookLike_option']").prop("disabled") ? "" : SFSI("input[name='sfsi_facebookLike_option']:checked").val(),
|
317 |
-
o = 1 == SFSI("input[name='sfsi_facebookShare_option']").prop("disabled") ? "" : SFSI("input[name='sfsi_facebookShare_option']:checked").val(),
|
318 |
-
a = SFSI("input[name='sfsi_facebookPage_url']").val(),
|
319 |
-
r = 1 == SFSI("input[name='sfsi_twitter_followme']").prop("disabled") ? "" : SFSI("input[name='sfsi_twitter_followme']:checked").val(),
|
320 |
-
c = 1 == SFSI("input[name='sfsi_twitter_followUserName']").prop("disabled") ? "" : SFSI("input[name='sfsi_twitter_followUserName']").val(),
|
321 |
-
p = 1 == SFSI("input[name='sfsi_twitter_aboutPage']").prop("disabled") ? "" : SFSI("input[name='sfsi_twitter_aboutPage']:checked").val(),
|
322 |
-
_ = 1 == SFSI("input[name='sfsi_twitter_page']").prop("disabled") ? "" : SFSI("input[name='sfsi_twitter_page']:checked").val(),
|
323 |
-
l = SFSI("input[name='sfsi_twitter_pageURL']").val(),
|
324 |
-
S = SFSI("textarea[name='sfsi_twitter_aboutPageText']").val(),
|
325 |
-
m = 1 == SFSI("input[name='sfsi_youtube_page']").prop("disabled") ? "" : SFSI("input[name='sfsi_youtube_page']:checked").val(),
|
326 |
-
F = 1 == SFSI("input[name='sfsi_youtube_pageUrl']").prop("disabled") ? "" : SFSI("input[name='sfsi_youtube_pageUrl']").val(),
|
327 |
-
h = 1 == SFSI("input[name='sfsi_youtube_follow']").prop("disabled") ? "" : SFSI("input[name='sfsi_youtube_follow']:checked").val(),
|
328 |
-
cls = SFSI("input[name='sfsi_youtubeusernameorid']:checked").val(),
|
329 |
-
v = SFSI("input[name='sfsi_ytube_user']").val(),
|
330 |
-
vchid = SFSI("input[name='sfsi_ytube_chnlid']").val(),
|
331 |
-
g = 1 == SFSI("input[name='sfsi_pinterest_page']").prop("disabled") ? "" : SFSI("input[name='sfsi_pinterest_page']:checked").val(),
|
332 |
-
k = 1 == SFSI("input[name='sfsi_pinterest_pageUrl']").prop("disabled") ? "" : SFSI("input[name='sfsi_pinterest_pageUrl']").val(),
|
333 |
-
y = 1 == SFSI("input[name='sfsi_pinterest_pingBlog']").prop("disabled") ? "" : SFSI("input[name='sfsi_pinterest_pingBlog']:checked").val(),
|
334 |
-
b = 1 == SFSI("input[name='sfsi_instagram_pageUrl']").prop("disabled") ? "" : SFSI("input[name='sfsi_instagram_pageUrl']").val(),
|
335 |
-
w = 1 == SFSI("input[name='sfsi_linkedin_page']").prop("disabled") ? "" : SFSI("input[name='sfsi_linkedin_page']:checked").val(),
|
336 |
-
x = 1 == SFSI("input[name='sfsi_linkedin_pageURL']").prop("disabled") ? "" : SFSI("input[name='sfsi_linkedin_pageURL']").val(),
|
337 |
-
C = 1 == SFSI("input[name='sfsi_linkedin_follow']").prop("disabled") ? "" : SFSI("input[name='sfsi_linkedin_follow']:checked").val(),
|
338 |
-
D = SFSI("input[name='sfsi_linkedin_followCompany']").val(),
|
339 |
-
U = 1 == SFSI("input[name='sfsi_linkedin_SharePage']").prop("disabled") ? "" : SFSI("input[name='sfsi_linkedin_SharePage']:checked").val(),
|
340 |
-
O = SFSI("input[name='sfsi_linkedin_recommendBusines']:checked").val(),
|
341 |
-
T = SFSI("input[name='sfsi_linkedin_recommendProductId']").val(),
|
342 |
-
j = SFSI("input[name='sfsi_linkedin_recommendCompany']").val(),
|
343 |
-
tp = 1 == SFSI("input[name='sfsi_telegram_page']").prop("disabled") ? "" : SFSI("input[name='sfsi_telegram_page']:checked").val(),
|
344 |
-
tpu = SFSI("input[name='sfsi_telegram_pageURL']").val(),
|
345 |
-
tm = SFSI("input[name='sfsi_telegram_message']").val(),
|
346 |
-
tmn = SFSI("input[name='sfsi_telegram_username']").val(),
|
347 |
-
wp = 1 == SFSI("input[name='sfsi_weibo_page']").prop("disabled") ? "" : SFSI("input[name='sfsi_weibo_page']:checked").val(),
|
348 |
-
wpu = SFSI("input[name='sfsi_weibo_pageURL']").val(),
|
349 |
-
vp = 1 == SFSI("input[name='sfsi_vk_page']").prop("disabled") ? "" : SFSI("input[name='sfsi_vk_page']:checked").val(),
|
350 |
-
vpu = SFSI("input[name='sfsi_vk_pageURL']").val(),
|
351 |
-
op = 1 == SFSI("input[name='sfsi_ok_page']").prop("disabled") ? "" : SFSI("input[name='sfsi_ok_page']:checked").val(),
|
352 |
-
opu = SFSI("input[name='sfsi_ok_pageURL']").val(),
|
353 |
-
P = {};
|
354 |
-
SFSI("input[name='sfsi_CustomIcon_links[]']").each(function () {
|
355 |
-
P[SFSI(this).attr("file-id")] = this.value;
|
356 |
-
});
|
357 |
-
var M = {
|
358 |
-
action: "updateSrcn2",
|
359 |
-
sfsi_rss_url: i,
|
360 |
-
sfsi_rss_icons: e,
|
361 |
-
sfsi_facebookPage_option: t,
|
362 |
-
sfsi_facebookLike_option: n,
|
363 |
-
sfsi_facebookShare_option: o,
|
364 |
-
sfsi_facebookPage_url: a,
|
365 |
-
sfsi_twitter_followme: r,
|
366 |
-
sfsi_twitter_followUserName: c,
|
367 |
-
sfsi_twitter_aboutPage: p,
|
368 |
-
sfsi_twitter_page: _,
|
369 |
-
sfsi_twitter_pageURL: l,
|
370 |
-
sfsi_twitter_aboutPageText: S,
|
371 |
-
sfsi_youtube_page: m,
|
372 |
-
sfsi_youtube_pageUrl: F,
|
373 |
-
sfsi_youtube_follow: h,
|
374 |
-
sfsi_youtubeusernameorid: cls,
|
375 |
-
sfsi_ytube_user: v,
|
376 |
-
sfsi_ytube_chnlid: vchid,
|
377 |
-
sfsi_pinterest_page: g,
|
378 |
-
sfsi_pinterest_pageUrl: k,
|
379 |
-
sfsi_instagram_pageUrl: b,
|
380 |
-
sfsi_pinterest_pingBlog: y,
|
381 |
-
sfsi_linkedin_page: w,
|
382 |
-
sfsi_linkedin_pageURL: x,
|
383 |
-
sfsi_linkedin_follow: C,
|
384 |
-
sfsi_linkedin_followCompany: D,
|
385 |
-
sfsi_linkedin_SharePage: U,
|
386 |
-
sfsi_linkedin_recommendBusines: O,
|
387 |
-
sfsi_linkedin_recommendCompany: j,
|
388 |
-
sfsi_linkedin_recommendProductId: T,
|
389 |
-
sfsi_custom_links: P,
|
390 |
-
sfsi_telegram_page: tp,
|
391 |
-
sfsi_telegram_pageURL: tpu,
|
392 |
-
sfsi_telegram_message: tm,
|
393 |
-
sfsi_telegram_username: tmn,
|
394 |
-
sfsi_weibo_page: wp,
|
395 |
-
sfsi_weibo_pageURL: wpu,
|
396 |
-
sfsi_vk_page: vp,
|
397 |
-
sfsi_vk_pageURL: vpu,
|
398 |
-
sfsi_ok_page: op,
|
399 |
-
sfsi_ok_pageURL: opu,
|
400 |
-
nonce: nonce
|
401 |
-
};
|
402 |
-
SFSI.ajax({
|
403 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
404 |
-
type: "post",
|
405 |
-
data: M,
|
406 |
-
async: !0,
|
407 |
-
dataType: "json",
|
408 |
-
success: function (s) {
|
409 |
-
if (s == "wrong_nonce") {
|
410 |
-
showErrorSuc("error", "Unauthorised Request, Try again after refreshing page", 2);
|
411 |
-
return_value = !1;
|
412 |
-
afterLoad();
|
413 |
-
} else {
|
414 |
-
"success" == s ? (showErrorSuc("success", "Saved !", 2), sfsicollapse("#sfsi_save2"),
|
415 |
-
sfsi_depened_sections()) : (global_error = 1, showErrorSuc("error", "Unkown error , please try again", 2),
|
416 |
-
return_value = !1), afterLoad();
|
417 |
-
}
|
418 |
-
}
|
419 |
-
});
|
420 |
-
}
|
421 |
-
|
422 |
-
function sfsi_update_step3() {
|
423 |
-
var nonce = SFSI("#sfsi_save3").attr("data-nonce");
|
424 |
-
var s = sfsi_validationStep3();
|
425 |
-
if (!s) return global_error = 1, !1;
|
426 |
-
beForeLoad();
|
427 |
-
var i = SFSI("input[name='sfsi_actvite_theme']:checked").val(),
|
428 |
-
e = SFSI("input[name='sfsi_mouseOver']:checked").val(),
|
429 |
-
t = SFSI("input[name='sfsi_shuffle_icons']:checked").val(),
|
430 |
-
n = SFSI("input[name='sfsi_shuffle_Firstload']:checked").val(),
|
431 |
-
o = SFSI("input[name='sfsi_same_icons_mouseOver_effect']:checked").val(),
|
432 |
-
a = SFSI("input[name='sfsi_shuffle_interval']:checked").val(),
|
433 |
-
r = SFSI("input[name='sfsi_shuffle_intervalTime']").val(),
|
434 |
-
c = SFSI("input[name='sfsi_specialIcon_animation']:checked").val(),
|
435 |
-
p = SFSI("input[name='sfsi_specialIcon_MouseOver']:checked").val(),
|
436 |
-
_ = SFSI("input[name='sfsi_specialIcon_Firstload']:checked").val(),
|
437 |
-
l = SFSI("#sfsi_specialIcon_Firstload_Icons option:selected").val(),
|
438 |
-
S = SFSI("input[name='sfsi_specialIcon_interval']:checked").val(),
|
439 |
-
u = SFSI("input[name='sfsi_specialIcon_intervalTime']").val(),
|
440 |
-
f = SFSI("#sfsi_specialIcon_intervalIcons option:selected").val();
|
441 |
-
|
442 |
-
var mouseover_effect_type = 'same_icons'; //SFSI("input[name='sfsi_mouseOver_effect_type']:checked").val();
|
443 |
-
|
444 |
-
d = {
|
445 |
-
action: "updateSrcn3",
|
446 |
-
sfsi_actvite_theme: i,
|
447 |
-
sfsi_mouseOver: e,
|
448 |
-
sfsi_shuffle_icons: t,
|
449 |
-
sfsi_shuffle_Firstload: n,
|
450 |
-
sfsi_mouseOver_effect: o,
|
451 |
-
sfsi_mouseover_effect_type: mouseover_effect_type,
|
452 |
-
sfsi_shuffle_interval: a,
|
453 |
-
sfsi_shuffle_intervalTime: r,
|
454 |
-
sfsi_specialIcon_animation: c,
|
455 |
-
sfsi_specialIcon_MouseOver: p,
|
456 |
-
sfsi_specialIcon_Firstload: _,
|
457 |
-
sfsi_specialIcon_Firstload_Icons: l,
|
458 |
-
sfsi_specialIcon_interval: S,
|
459 |
-
sfsi_specialIcon_intervalTime: u,
|
460 |
-
sfsi_specialIcon_intervalIcons: f,
|
461 |
-
nonce: nonce
|
462 |
-
};
|
463 |
-
SFSI.ajax({
|
464 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
465 |
-
type: "post",
|
466 |
-
data: d,
|
467 |
-
async: !0,
|
468 |
-
dataType: "json",
|
469 |
-
success: function (s) {
|
470 |
-
if (s == "wrong_nonce") {
|
471 |
-
showErrorSuc("error", "Unauthorised Request, Try again after refreshing page", 3);
|
472 |
-
return_value = !1;
|
473 |
-
afterLoad();
|
474 |
-
} else {
|
475 |
-
"success" == s ? (showErrorSuc("success", "Saved !", 3), sfsicollapse("#sfsi_save3")) : (showErrorSuc("error", "Unkown error , please try again", 3),
|
476 |
-
return_value = !1), afterLoad();
|
477 |
-
}
|
478 |
-
}
|
479 |
-
});
|
480 |
-
}
|
481 |
-
|
482 |
-
function sfsi_show_counts() {
|
483 |
-
"yes" == SFSI("input[name='sfsi_display_counts']:checked").val() ? (SFSI(".count_sections").slideDown(),
|
484 |
-
sfsi_showPreviewCounts()) : (SFSI(".count_sections").slideUp(), sfsi_showPreviewCounts());
|
485 |
-
}
|
486 |
-
|
487 |
-
function sfsi_showPreviewCounts() {
|
488 |
-
var s = 0;
|
489 |
-
1 == SFSI("input[name='sfsi_rss_countsDisplay']").prop("checked") ? (SFSI("#sfsi_rss_countsDisplay").css("opacity", 1), s = 1) : SFSI("#sfsi_rss_countsDisplay").css("opacity", 0),
|
490 |
-
1 == SFSI("input[name='sfsi_email_countsDisplay']").prop("checked") ? (SFSI("#sfsi_email_countsDisplay").css("opacity", 1),
|
491 |
-
s = 1) : SFSI("#sfsi_email_countsDisplay").css("opacity", 0), 1 == SFSI("input[name='sfsi_facebook_countsDisplay']").prop("checked") ? (SFSI("#sfsi_facebook_countsDisplay").css("opacity", 1),
|
492 |
-
s = 1) : SFSI("#sfsi_facebook_countsDisplay").css("opacity", 0), 1 == SFSI("input[name='sfsi_twitter_countsDisplay']").prop("checked") ? (SFSI("#sfsi_twitter_countsDisplay").css("opacity", 1),
|
493 |
-
s = 1) : SFSI("#sfsi_twitter_countsDisplay").css("opacity", 0),
|
494 |
-
1 == SFSI("input[name='sfsi_linkedIn_countsDisplay']").prop("checked") ? (SFSI("#sfsi_linkedIn_countsDisplay").css("opacity", 1), s = 1) : SFSI("#sfsi_linkedIn_countsDisplay").css("opacity", 0),
|
495 |
-
1 == SFSI("input[name='sfsi_youtube_countsDisplay']").prop("checked") ? (SFSI("#sfsi_youtube_countsDisplay").css("opacity", 1),
|
496 |
-
s = 1) : SFSI("#sfsi_youtube_countsDisplay").css("opacity", 0), 1 == SFSI("input[name='sfsi_pinterest_countsDisplay']").prop("checked") ? (SFSI("#sfsi_pinterest_countsDisplay").css("opacity", 1),
|
497 |
-
s = 1) : SFSI("#sfsi_pinterest_countsDisplay").css("opacity", 0), 1 == SFSI("input[name='sfsi_instagram_countsDisplay']").prop("checked") ? (SFSI("#sfsi_instagram_countsDisplay").css("opacity", 1),
|
498 |
-
s = 1) : SFSI("#sfsi_instagram_countsDisplay").css("opacity", 0),
|
499 |
-
1 == SFSI("input[name='sfsi_telegram_countsDisplay']").prop("checked") ? (SFSI("#sfsi_telegram_countsDisplay").css("opacity", 0), s = 1) : SFSI("#sfsi_telegram_countsDisplay").css("opacity", 0),
|
500 |
-
1 == SFSI("input[name='sfsi_vk_countsDisplay']").prop("checked") ? (SFSI("#sfsi_vk_countsDisplay").css("opacity", 0), s = 1) : SFSI("#sfsi_vk_countsDisplay").css("opacity", 0),
|
501 |
-
1 == SFSI("input[name='sfsi_ok_countsDisplay']").prop("checked") ? (SFSI("#sfsi_ok_countsDisplay").css("opacity", 0), s = 1) : SFSI("#sfsi_ok_countsDisplay").css("opacity", 0),
|
502 |
-
1 == SFSI("input[name='sfsi_weibo_countsDisplay']").prop("checked") ? (SFSI("#sfsi_weibo_countsDisplay").css("opacity", 0), s = 1) : SFSI("#sfsi_weibo_countsDisplay").css("opacity", 0),
|
503 |
-
1 == SFSI("input[name='sfsi_wechat_countsDisplay']").prop("checked") ? (SFSI("#sfsi_wechat_countsDisplay").css("opacity", 0), s = 1) : SFSI("#sfsi_wechat_countsDisplay").css("opacity", 0),
|
504 |
-
|
505 |
-
0 == s || "no" == SFSI("input[name='sfsi_display_counts']:checked").val() ? SFSI(".sfsi_Cdisplay").hide() : SFSI(".sfsi_Cdisplay").show();
|
506 |
-
}
|
507 |
-
|
508 |
-
function sfsi_show_OnpostsDisplay() {
|
509 |
-
//"yes" == SFSI("input[name='sfsi_show_Onposts']:checked").val() ? SFSI(".PostsSettings_section").slideDown() :SFSI(".PostsSettings_section").slideUp();
|
510 |
-
}
|
511 |
-
|
512 |
-
function sfsi_update_step4() {
|
513 |
-
var nonce = SFSI("#sfsi_save4").attr("data-nonce");
|
514 |
-
var s = !1,
|
515 |
-
i = sfsi_validationStep4();
|
516 |
-
if (!i) return global_error = 1, !1;
|
517 |
-
beForeLoad();
|
518 |
-
var e = SFSI("input[name='sfsi_display_counts']:checked").val(),
|
519 |
-
t = 1 == SFSI("input[name='sfsi_email_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_email_countsDisplay']:checked").val(),
|
520 |
-
n = 1 == SFSI("input[name='sfsi_email_countsFrom']").prop("disabled") ? "" : SFSI("input[name='sfsi_email_countsFrom']:checked").val(),
|
521 |
-
o = SFSI("input[name='sfsi_email_manualCounts']").val(),
|
522 |
-
r = 1 == SFSI("input[name='sfsi_rss_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_rss_countsDisplay']:checked").val(),
|
523 |
-
c = SFSI("input[name='sfsi_rss_manualCounts']").val(),
|
524 |
-
p = 1 == SFSI("input[name='sfsi_facebook_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_facebook_countsDisplay']:checked").val(),
|
525 |
-
_ = 1 == SFSI("input[name='sfsi_facebook_countsFrom']").prop("disabled") ? "" : SFSI("input[name='sfsi_facebook_countsFrom']:checked").val(),
|
526 |
-
mp = SFSI("input[name='sfsi_facebook_mypageCounts']").val(),
|
527 |
-
l = SFSI("input[name='sfsi_facebook_manualCounts']").val(),
|
528 |
-
S = 1 == SFSI("input[name='sfsi_twitter_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_twitter_countsDisplay']:checked").val(),
|
529 |
-
u = 1 == SFSI("input[name='sfsi_twitter_countsFrom']").prop("disabled") ? "" : SFSI("input[name='sfsi_twitter_countsFrom']:checked").val(),
|
530 |
-
f = SFSI("input[name='sfsi_twitter_manualCounts']").val(),
|
531 |
-
d = SFSI("input[name='tw_consumer_key']").val(),
|
532 |
-
I = SFSI("input[name='tw_consumer_secret']").val(),
|
533 |
-
m = SFSI("input[name='tw_oauth_access_token']").val(),
|
534 |
-
F = SFSI("input[name='tw_oauth_access_token_secret']").val(),
|
535 |
-
k = 1 == SFSI("input[name='sfsi_linkedIn_countsFrom']").prop("disabled") ? "" : SFSI("input[name='sfsi_linkedIn_countsFrom']:checked").val(),
|
536 |
-
y = SFSI("input[name='sfsi_linkedIn_manualCounts']").val(),
|
537 |
-
b = SFSI("input[name='ln_company']").val(),
|
538 |
-
w = SFSI("input[name='ln_api_key']").val(),
|
539 |
-
x = SFSI("input[name='ln_secret_key']").val(),
|
540 |
-
C = SFSI("input[name='ln_oAuth_user_token']").val(),
|
541 |
-
D = 1 == SFSI("input[name='sfsi_linkedIn_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_linkedIn_countsDisplay']:checked").val(),
|
542 |
-
k = 1 == SFSI("input[name='sfsi_linkedIn_countsFrom']").prop("disabled") ? "" : SFSI("input[name='sfsi_linkedIn_countsFrom']:checked").val(),
|
543 |
-
y = SFSI("input[name='sfsi_linkedIn_manualCounts']").val(),
|
544 |
-
U = 1 == SFSI("input[name='sfsi_youtube_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_youtube_countsDisplay']:checked").val(),
|
545 |
-
O = 1 == SFSI("input[name='sfsi_youtube_countsFrom']").prop("disabled") ? "" : SFSI("input[name='sfsi_youtube_countsFrom']:checked").val(),
|
546 |
-
T = SFSI("input[name='sfsi_youtube_manualCounts']").val(),
|
547 |
-
j = SFSI("input[name='sfsi_youtube_user']").val(),
|
548 |
-
P = 1 == SFSI("input[name='sfsi_pinterest_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_pinterest_countsDisplay']:checked").val(),
|
549 |
-
M = 1 == SFSI("input[name='sfsi_pinterest_countsFrom']").prop("disabled") ? "" : SFSI("input[name='sfsi_pinterest_countsFrom']:checked").val(),
|
550 |
-
L = SFSI("input[name='sfsi_pinterest_manualCounts']").val(),
|
551 |
-
B = SFSI("input[name='sfsi_pinterest_user']").val(),
|
552 |
-
E = SFSI("input[name='sfsi_pinterest_board']").val(),
|
553 |
-
z = 1 == SFSI("input[name='sfsi_instagram_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_instagram_countsDisplay']:checked").val(),
|
554 |
-
A = 1 == SFSI("input[name='sfsi_instagram_countsFrom']").prop("disabled") ? "" : SFSI("input[name='sfsi_instagram_countsFrom']:checked").val(),
|
555 |
-
N = SFSI("input[name='sfsi_instagram_manualCounts']").val(),
|
556 |
-
H = SFSI("input[name='sfsi_instagram_User']").val(),
|
557 |
-
ha = SFSI("input[name='sfsi_instagram_clientid']").val(),
|
558 |
-
ia = SFSI("input[name='sfsi_instagram_appurl']").val(),
|
559 |
-
ja = SFSI("input[name='sfsi_instagram_token']").val(),
|
560 |
-
|
561 |
-
tc = 1 == SFSI("input[name='sfsi_telegram_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_telegram_countsDisplay']:checked").val(),
|
562 |
-
tm = SFSI("input[name='sfsi_telegram_manualCounts']").val(),
|
563 |
-
|
564 |
-
vc = 1 == SFSI("input[name='sfsi_vk_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_vk_countsDisplay']:checked").val(),
|
565 |
-
vm = SFSI("input[name='sfsi_vk_manualCounts']").val(),
|
566 |
-
|
567 |
-
|
568 |
-
oc = 1 == SFSI("input[name='sfsi_ok_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_ok_countsDisplay']:checked").val(),
|
569 |
-
om = SFSI("input[name='sfsi_ok_manualCounts']").val(),
|
570 |
-
|
571 |
-
|
572 |
-
wc = 1 == SFSI("input[name='sfsi_weibo_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_weibo_countsDisplay']:checked").val(),
|
573 |
-
wm = SFSI("input[name='sfsi_weibo_manualCounts']").val(),
|
574 |
-
|
575 |
-
wcc = 1 == SFSI("input[name='sfsi_wechat_countsDisplay']").prop("disabled") ? "" : SFSI("input[name='sfsi_wechat_countsDisplay']:checked").val(),
|
576 |
-
wcm = SFSI("input[name='sfsi_wechat_manualCounts']").val(),
|
577 |
-
$ = {
|
578 |
-
action: "updateSrcn4",
|
579 |
-
sfsi_display_counts: e,
|
580 |
-
sfsi_email_countsDisplay: t,
|
581 |
-
sfsi_email_countsFrom: n,
|
582 |
-
sfsi_email_manualCounts: o,
|
583 |
-
sfsi_rss_countsDisplay: r,
|
584 |
-
sfsi_rss_manualCounts: c,
|
585 |
-
sfsi_facebook_countsDisplay: p,
|
586 |
-
sfsi_facebook_countsFrom: _,
|
587 |
-
sfsi_facebook_mypageCounts: mp,
|
588 |
-
sfsi_facebook_manualCounts: l,
|
589 |
-
sfsi_twitter_countsDisplay: S,
|
590 |
-
sfsi_twitter_countsFrom: u,
|
591 |
-
sfsi_twitter_manualCounts: f,
|
592 |
-
tw_consumer_key: d,
|
593 |
-
tw_consumer_secret: I,
|
594 |
-
tw_oauth_access_token: m,
|
595 |
-
tw_oauth_access_token_secret: F,
|
596 |
-
sfsi_linkedIn_countsDisplay: D,
|
597 |
-
sfsi_linkedIn_countsFrom: k,
|
598 |
-
sfsi_linkedIn_manualCounts: y,
|
599 |
-
ln_company: b,
|
600 |
-
ln_api_key: w,
|
601 |
-
ln_secret_key: x,
|
602 |
-
ln_oAuth_user_token: C,
|
603 |
-
sfsi_youtube_countsDisplay: U,
|
604 |
-
sfsi_youtube_countsFrom: O,
|
605 |
-
sfsi_youtube_manualCounts: T,
|
606 |
-
sfsi_youtube_user: j,
|
607 |
-
sfsi_youtube_channelId: SFSI("input[name='sfsi_youtube_channelId']").val(),
|
608 |
-
sfsi_pinterest_countsDisplay: P,
|
609 |
-
sfsi_pinterest_countsFrom: M,
|
610 |
-
sfsi_pinterest_manualCounts: L,
|
611 |
-
sfsi_pinterest_user: B,
|
612 |
-
sfsi_pinterest_board: E,
|
613 |
-
sfsi_instagram_countsDisplay: z,
|
614 |
-
sfsi_instagram_countsFrom: A,
|
615 |
-
sfsi_instagram_manualCounts: N,
|
616 |
-
sfsi_instagram_User: H,
|
617 |
-
sfsi_instagram_clientid: ha,
|
618 |
-
sfsi_instagram_appurl: ia,
|
619 |
-
sfsi_instagram_token: ja,
|
620 |
-
sfsi_telegram_countsDisplay: tc,
|
621 |
-
sfsi_telegram_manualCounts: tm,
|
622 |
-
sfsi_vk_countsDisplay: vc,
|
623 |
-
sfsi_vk_manualCounts: vm,
|
624 |
-
sfsi_ok_countsDisplay: oc,
|
625 |
-
sfsi_ok_manualCounts: om,
|
626 |
-
sfsi_weibo_countsDisplay: wc,
|
627 |
-
sfsi_weibo_manualCounts: wm,
|
628 |
-
sfsi_wechat_countsDisplay: wcc,
|
629 |
-
sfsi_wechat_manualCounts: wcm,
|
630 |
-
nonce: nonce
|
631 |
-
};
|
632 |
-
console.log($);
|
633 |
-
return SFSI.ajax({
|
634 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
635 |
-
type: "post",
|
636 |
-
data: $,
|
637 |
-
dataType: "json",
|
638 |
-
async: !0,
|
639 |
-
success: function (s) {
|
640 |
-
if (s == "wrong_nonce") {
|
641 |
-
showErrorSuc("error", "Unauthorised Request, Try again after refreshing page", 4);
|
642 |
-
global_error = 1;
|
643 |
-
afterLoad();
|
644 |
-
} else {
|
645 |
-
"success" == s.res ? (showErrorSuc("success", "Saved !", 4), sfsicollapse("#sfsi_save4"),
|
646 |
-
sfsi_showPreviewCounts()) : (showErrorSuc("error", "Unkown error , please try again", 4),
|
647 |
-
global_error = 1), afterLoad();
|
648 |
-
}
|
649 |
-
}
|
650 |
-
}), s;
|
651 |
-
}
|
652 |
-
|
653 |
-
function sfsi_update_step5() {
|
654 |
-
var nonce = SFSI("#sfsi_save5").attr("data-nonce");
|
655 |
-
sfsi_update_step3();
|
656 |
-
|
657 |
-
var s = sfsi_validationStep5();
|
658 |
-
|
659 |
-
if (!s) return global_error = 1, !1;
|
660 |
-
|
661 |
-
beForeLoad();
|
662 |
-
|
663 |
-
var i = SFSI("input[name='sfsi_icons_size']").val(),
|
664 |
-
e = SFSI("input[name='sfsi_icons_perRow']").val(),
|
665 |
-
t = SFSI("input[name='sfsi_icons_spacing']").val(),
|
666 |
-
n = SFSI("#sfsi_icons_Alignment").val(),
|
667 |
-
o = SFSI("input[name='sfsi_icons_ClickPageOpen']:checked").val(),
|
668 |
-
|
669 |
-
se = SFSI("input[name='sfsi_icons_suppress_errors']:checked").val(),
|
670 |
-
c = SFSI("input[name='sfsi_icons_stick']:checked").val(),
|
671 |
-
p = SFSI("#sfsi_rssIcon_order").attr("data-index"),
|
672 |
-
_ = SFSI("#sfsi_emailIcon_order").attr("data-index"),
|
673 |
-
S = SFSI("#sfsi_facebookIcon_order").attr("data-index"),
|
674 |
-
u = SFSI("#sfsi_twitterIcon_order").attr("data-index"),
|
675 |
-
f = SFSI("#sfsi_youtubeIcon_order").attr("data-index"),
|
676 |
-
d = SFSI("#sfsi_pinterestIcon_order").attr("data-index"),
|
677 |
-
I = SFSI("#sfsi_instagramIcon_order").attr("data-index"),
|
678 |
-
F = SFSI("#sfsi_linkedinIcon_order").attr("data-index"),
|
679 |
-
tgi = SFSI("#sfsi_telegramIcon_order").attr("data-index"),
|
680 |
-
vki = SFSI("#sfsi_vkIcon_order").attr("data-index"),
|
681 |
-
oki = SFSI("#sfsi_okIcon_order").attr("data-index"),
|
682 |
-
wbi = SFSI("#sfsi_weiboIcon_order").attr("data-index"),
|
683 |
-
wci = SFSI("#sfsi_wechatIcon_order").attr("data-index"),
|
684 |
-
|
685 |
-
h = new Array();
|
686 |
-
|
687 |
-
SFSI(".custom_iconOrder").each(function () {
|
688 |
-
h.push({
|
689 |
-
order: SFSI(this).attr("data-index"),
|
690 |
-
ele: SFSI(this).attr("element-id")
|
691 |
-
});
|
692 |
-
});
|
693 |
-
|
694 |
-
var v = 1 == SFSI("input[name='sfsi_rss_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_rss_MouseOverText']").val(),
|
695 |
-
g = 1 == SFSI("input[name='sfsi_email_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_email_MouseOverText']").val(),
|
696 |
-
k = 1 == SFSI("input[name='sfsi_twitter_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_twitter_MouseOverText']").val(),
|
697 |
-
y = 1 == SFSI("input[name='sfsi_facebook_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_facebook_MouseOverText']").val(),
|
698 |
-
w = 1 == SFSI("input[name='sfsi_linkedIn_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_linkedIn_MouseOverText']").val(),
|
699 |
-
x = 1 == SFSI("input[name='sfsi_youtube_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_youtube_MouseOverText']").val(),
|
700 |
-
C = 1 == SFSI("input[name='sfsi_pinterest_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_pinterest_MouseOverText']").val(),
|
701 |
-
D = 1 == SFSI("input[name='sfsi_instagram_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_instagram_MouseOverText']").val(),
|
702 |
-
tg = 1 == SFSI("input[name='sfsi_telegram_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_telegram_MouseOverText']").val(),
|
703 |
-
vk = 1 == SFSI("input[name='sfsi_vk_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_vk_MouseOverText']").val(),
|
704 |
-
ok = 1 == SFSI("input[name='sfsi_ok_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_ok_MouseOverText']").val(),
|
705 |
-
wb = 1 == SFSI("input[name='sfsi_weibo_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_weibo_MouseOverText']").val(),
|
706 |
-
wc = 1 == SFSI("input[name='sfsi_wechat_MouseOverText']").prop("disabled") ? "" : SFSI("input[name='sfsi_wechat_MouseOverText']").val(),
|
707 |
-
|
708 |
-
O = {};
|
709 |
-
SFSI("input[name='sfsi_custom_MouseOverTexts[]']").each(function () {
|
710 |
-
O[SFSI(this).attr("file-id")] = this.value;
|
711 |
-
});
|
712 |
-
|
713 |
-
var sfsi_custom_social_hide = SFSI("input[name='sfsi_custom_social_hide']").val();
|
714 |
-
|
715 |
-
var T = {
|
716 |
-
action: "updateSrcn5",
|
717 |
-
sfsi_icons_size: i,
|
718 |
-
sfsi_icons_Alignment: n,
|
719 |
-
sfsi_icons_perRow: e,
|
720 |
-
sfsi_icons_spacing: t,
|
721 |
-
sfsi_icons_ClickPageOpen: o,
|
722 |
-
sfsi_icons_suppress_errors: se,
|
723 |
-
sfsi_icons_stick: c,
|
724 |
-
sfsi_rss_MouseOverText: v,
|
725 |
-
sfsi_email_MouseOverText: g,
|
726 |
-
sfsi_twitter_MouseOverText: k,
|
727 |
-
sfsi_facebook_MouseOverText: y,
|
728 |
-
sfsi_youtube_MouseOverText: x,
|
729 |
-
sfsi_linkedIn_MouseOverText: w,
|
730 |
-
sfsi_pinterest_MouseOverText: C,
|
731 |
-
sfsi_instagram_MouseOverText: D,
|
732 |
-
sfsi_telegram_MouseOverText: tg,
|
733 |
-
sfsi_vk_MouseOverText: vk,
|
734 |
-
sfsi_ok_MouseOverText: ok,
|
735 |
-
sfsi_weibo_MouseOverText: wb,
|
736 |
-
sfsi_wechat_MouseOverText: wc,
|
737 |
-
sfsi_custom_MouseOverTexts: O,
|
738 |
-
sfsi_rssIcon_order: p,
|
739 |
-
sfsi_emailIcon_order: _,
|
740 |
-
sfsi_facebookIcon_order: S,
|
741 |
-
sfsi_twitterIcon_order: u,
|
742 |
-
sfsi_youtubeIcon_order: f,
|
743 |
-
sfsi_pinterestIcon_order: d,
|
744 |
-
sfsi_instagramIcon_order: I,
|
745 |
-
sfsi_linkedinIcon_order: F,
|
746 |
-
sfsi_telegramIcon_order: tgi,
|
747 |
-
sfsi_vkIcon_order: vki,
|
748 |
-
sfsi_okIcon_order: oki,
|
749 |
-
sfsi_weiboIcon_order: wbi,
|
750 |
-
sfsi_wechatIcon_order: wci,
|
751 |
-
|
752 |
-
sfsi_custom_orders: h,
|
753 |
-
sfsi_custom_social_hide: sfsi_custom_social_hide,
|
754 |
-
nonce: nonce
|
755 |
-
};
|
756 |
-
console.log(T);
|
757 |
-
SFSI.ajax({
|
758 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
759 |
-
type: "post",
|
760 |
-
data: T,
|
761 |
-
dataType: "json",
|
762 |
-
async: !0,
|
763 |
-
success: function (s) {
|
764 |
-
if (s == "wrong_nonce") {
|
765 |
-
showErrorSuc("error", "Unauthorised Request, Try again after refreshing page", 5);
|
766 |
-
global_error = 1;
|
767 |
-
afterLoad();
|
768 |
-
} else {
|
769 |
-
"success" == s ? (showErrorSuc("success", "Saved !", 5), sfsicollapse("#sfsi_save5")) : (global_error = 1,
|
770 |
-
showErrorSuc("error", "Unkown error , please try again", 5)), afterLoad();
|
771 |
-
}
|
772 |
-
}
|
773 |
-
});
|
774 |
-
}
|
775 |
-
|
776 |
-
function sfsi_update_step6() {
|
777 |
-
var nonce = SFSI("#sfsi_save6").attr("data-nonce");
|
778 |
-
beForeLoad();
|
779 |
-
var s = SFSI("input[name='sfsi_show_Onposts']:checked").val(),
|
780 |
-
i = SFSI("input[name='sfsi_textBefor_icons']").val(),
|
781 |
-
e = SFSI("#sfsi_icons_alignment").val(),
|
782 |
-
t = SFSI("#sfsi_icons_DisplayCounts").val(),
|
783 |
-
rsub = SFSI("input[name='sfsi_rectsub']:checked").val(),
|
784 |
-
rfb = SFSI("input[name='sfsi_rectfb']:checked").val(),
|
785 |
-
rpin = SFSI("input[name='sfsi_rectpinit']:checked").val(),
|
786 |
-
rshr = SFSI("input[name='sfsi_rectshr']:checked").val(),
|
787 |
-
rtwr = SFSI("input[name='sfsi_recttwtr']:checked").val(),
|
788 |
-
rfbshare = SFSI("input[name='sfsi_rectfbshare']:checked").val(),
|
789 |
-
a = SFSI("input[name='sfsi_display_button_type']:checked").val();
|
790 |
-
countshare = SFSI("input[name='sfsi_share_count']:checked").val();
|
791 |
-
endpost = SFSI("input[name='sfsi_responsive_icons_end_post']:checked").val();
|
792 |
-
|
793 |
-
var responsive_icons = {
|
794 |
-
"default_icons": {},
|
795 |
-
"settings": {}
|
796 |
-
};
|
797 |
-
SFSI('.sfsi_responsive_default_icon_container input[type="checkbox"]').each(function (index, obj) {
|
798 |
-
var data_obj = {};
|
799 |
-
data_obj.active = ('checked' == SFSI(obj).attr('checked')) ? 'yes' : 'no';
|
800 |
-
var iconname = SFSI(obj).attr('data-icon');
|
801 |
-
var next_section = SFSI(obj).parent().parent();
|
802 |
-
data_obj.text = next_section.find('input[name="sfsi_responsive_' + iconname + '_input"]').val();
|
803 |
-
data_obj.url = next_section.find('input[name="sfsi_responsive_' + iconname + '_url_input"]').val();
|
804 |
-
responsive_icons.default_icons[iconname] = data_obj;
|
805 |
-
});
|
806 |
-
SFSI('.sfsi_responsive_custom_icon_container input[type="checkbox"]').each(function (index, obj) {
|
807 |
-
if (SFSI(obj).attr('id') != "sfsi_responsive_custom_new_display") {
|
808 |
-
var data_obj = {};
|
809 |
-
data_obj.active = 'checked' == SFSI(obj).attr('checked') ? 'yes' : 'no';
|
810 |
-
var icon_index = SFSI(obj).attr('data-custom-index');
|
811 |
-
var next_section = SFSI(obj).parent().parent();
|
812 |
-
data_obj['added'] = SFSI('input[name="sfsi_responsive_custom_' + index + '_added"]').val();
|
813 |
-
data_obj.icon = next_section.find('img').attr('src');
|
814 |
-
data_obj["bg-color"] = next_section.find('.sfsi_bg-color-picker').val();
|
815 |
-
|
816 |
-
data_obj.text = next_section.find('input[name="sfsi_responsive_custom_' + icon_index + '_input"]').val();
|
817 |
-
data_obj.url = next_section.find('input[name="sfsi_responsive_custom_' + icon_index + '_url_input"]').val();
|
818 |
-
responsive_icons.custom_icons[index] = data_obj;
|
819 |
-
}
|
820 |
-
});
|
821 |
-
responsive_icons.settings.icon_size = SFSI('select[name="sfsi_responsive_icons_settings_icon_size"]').val();
|
822 |
-
responsive_icons.settings.icon_width_type = SFSI('select[name="sfsi_responsive_icons_settings_icon_width_type"]').val();
|
823 |
-
responsive_icons.settings.icon_width_size = SFSI('input[name="sfsi_responsive_icons_sttings_icon_width_size"]').val();
|
824 |
-
responsive_icons.settings.edge_type = SFSI('select[name="sfsi_responsive_icons_settings_edge_type"]').val();
|
825 |
-
responsive_icons.settings.edge_radius = SFSI('select[name="sfsi_responsive_icons_settings_edge_radius"]').val();
|
826 |
-
responsive_icons.settings.style = SFSI('select[name="sfsi_responsive_icons_settings_style"]').val();
|
827 |
-
responsive_icons.settings.margin = SFSI('input[name="sfsi_responsive_icons_settings_margin"]').val();
|
828 |
-
responsive_icons.settings.text_align = SFSI('select[name="sfsi_responsive_icons_settings_text_align"]').val();
|
829 |
-
responsive_icons.settings.show_count = SFSI('input[name="sfsi_responsive_icon_show_count"]:checked').val();
|
830 |
-
responsive_icons.settings.counter_color = SFSI('input[name="sfsi_responsive_counter_color"]').val();
|
831 |
-
responsive_icons.settings.counter_bg_color = SFSI('input[name="sfsi_responsive_counter_bg_color"]').val();
|
832 |
-
responsive_icons.settings.share_count_text = SFSI('input[name="sfsi_responsive_counter_share_count_text"]').val();
|
833 |
-
responsive_icons.settings.show_count = countshare;
|
834 |
-
n = {
|
835 |
-
action: "updateSrcn6",
|
836 |
-
sfsi_show_Onposts: s,
|
837 |
-
sfsi_icons_DisplayCounts: t,
|
838 |
-
sfsi_icons_alignment: e,
|
839 |
-
sfsi_textBefor_icons: i,
|
840 |
-
sfsi_rectsub: rsub,
|
841 |
-
sfsi_rectfb: rfb,
|
842 |
-
sfsi_rectpinit: rpin,
|
843 |
-
sfsi_rectshr: rshr,
|
844 |
-
sfsi_recttwtr: rtwr,
|
845 |
-
sfsi_rectfbshare: rfbshare,
|
846 |
-
sfsi_responsive_icons: responsive_icons,
|
847 |
-
sfsi_display_button_type: a,
|
848 |
-
sfsi_responsive_icons_end_post:endpost,
|
849 |
-
sfsi_share_count: countshare,
|
850 |
-
nonce: nonce
|
851 |
-
};
|
852 |
-
SFSI.ajax({
|
853 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
854 |
-
type: "post",
|
855 |
-
data: n,
|
856 |
-
dataType: "json",
|
857 |
-
async: !0,
|
858 |
-
success: function (s) {
|
859 |
-
if (s == "wrong_nonce") {
|
860 |
-
showErrorSuc("error", "Unauthorised Request, Try again after refreshing page", 6);
|
861 |
-
global_error = 1;
|
862 |
-
afterLoad();
|
863 |
-
} else {
|
864 |
-
"success" == s ? (showErrorSuc("success", "Saved !", 6), sfsicollapse("#sfsi_save6")) : (global_error = 1,
|
865 |
-
showErrorSuc("error", "Unkown error , please try again", 6)), afterLoad();
|
866 |
-
}
|
867 |
-
}
|
868 |
-
});
|
869 |
-
}
|
870 |
-
|
871 |
-
function sfsi_update_step7() {
|
872 |
-
var nonce = SFSI("#sfsi_save7").attr("data-nonce");
|
873 |
-
var s = sfsi_validationStep7();
|
874 |
-
if (!s) return global_error = 1, !1;
|
875 |
-
beForeLoad();
|
876 |
-
var i = SFSI("input[name='sfsi_popup_text']").val(),
|
877 |
-
e = SFSI("#sfsi_popup_font option:selected").val(),
|
878 |
-
t = SFSI("#sfsi_popup_fontStyle option:selected").val(),
|
879 |
-
color = SFSI("input[name='sfsi_popup_fontColor']").val(),
|
880 |
-
n = SFSI("input[name='sfsi_popup_fontSize']").val(),
|
881 |
-
o = SFSI("input[name='sfsi_popup_background_color']").val(),
|
882 |
-
a = SFSI("input[name='sfsi_popup_border_color']").val(),
|
883 |
-
r = SFSI("input[name='sfsi_popup_border_thickness']").val(),
|
884 |
-
c = SFSI("input[name='sfsi_popup_border_shadow']:checked").val(),
|
885 |
-
p = SFSI("input[name='sfsi_Show_popupOn']:checked").val(),
|
886 |
-
_ = [];
|
887 |
-
SFSI("#sfsi_Show_popupOn_PageIDs :selected").each(function (s, i) {
|
888 |
-
_[s] = SFSI(i).val();
|
889 |
-
});
|
890 |
-
var l = SFSI("input[name='sfsi_Shown_pop']:checked").val(),
|
891 |
-
S = SFSI("input[name='sfsi_Shown_popupOnceTime']").val(),
|
892 |
-
u = SFSI("#sfsi_Shown_popuplimitPerUserTime").val(),
|
893 |
-
f = {
|
894 |
-
action: "updateSrcn7",
|
895 |
-
sfsi_popup_text: i,
|
896 |
-
sfsi_popup_font: e,
|
897 |
-
sfsi_popup_fontColor: color,
|
898 |
-
/*sfsi_popup_fontStyle: t,*/
|
899 |
-
sfsi_popup_fontSize: n,
|
900 |
-
sfsi_popup_background_color: o,
|
901 |
-
sfsi_popup_border_color: a,
|
902 |
-
sfsi_popup_border_thickness: r,
|
903 |
-
sfsi_popup_border_shadow: c,
|
904 |
-
sfsi_Show_popupOn: p,
|
905 |
-
sfsi_Show_popupOn_PageIDs: _,
|
906 |
-
sfsi_Shown_pop: l,
|
907 |
-
sfsi_Shown_popupOnceTime: S,
|
908 |
-
sfsi_Shown_popuplimitPerUserTime: u,
|
909 |
-
nonce: nonce
|
910 |
-
};
|
911 |
-
SFSI.ajax({
|
912 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
913 |
-
type: "post",
|
914 |
-
data: f,
|
915 |
-
dataType: "json",
|
916 |
-
async: !0,
|
917 |
-
success: function (s) {
|
918 |
-
if (s == "wrong_nonce") {
|
919 |
-
showErrorSuc("error", "Unauthorised Request, Try again after refreshing page", 7);
|
920 |
-
afterLoad();
|
921 |
-
} else {
|
922 |
-
"success" == s ? (showErrorSuc("success", "Saved !", 7), sfsicollapse("#sfsi_save7")) : showErrorSuc("error", "Unkown error , please try again", 7),
|
923 |
-
afterLoad();
|
924 |
-
}
|
925 |
-
}
|
926 |
-
});
|
927 |
-
}
|
928 |
-
|
929 |
-
function sfsi_update_step8() {
|
930 |
-
var nonce = SFSI("#sfsi_save8").attr("data-nonce");
|
931 |
-
beForeLoad();
|
932 |
-
var ie = SFSI("input[name='sfsi_form_adjustment']:checked").val(),
|
933 |
-
je = SFSI("input[name='sfsi_form_height']").val(),
|
934 |
-
ke = SFSI("input[name='sfsi_form_width']").val(),
|
935 |
-
le = SFSI("input[name='sfsi_form_border']:checked").val(),
|
936 |
-
me = SFSI("input[name='sfsi_form_border_thickness']").val(),
|
937 |
-
ne = SFSI("input[name='sfsi_form_border_color']").val(),
|
938 |
-
oe = SFSI("input[name='sfsi_form_background']").val(),
|
939 |
-
|
940 |
-
ae = SFSI("input[name='sfsi_form_heading_text']").val(),
|
941 |
-
be = SFSI("#sfsi_form_heading_font option:selected").val(),
|
942 |
-
ce = SFSI("#sfsi_form_heading_fontstyle option:selected").val(),
|
943 |
-
de = SFSI("input[name='sfsi_form_heading_fontcolor']").val(),
|
944 |
-
ee = SFSI("input[name='sfsi_form_heading_fontsize']").val(),
|
945 |
-
fe = SFSI("#sfsi_form_heading_fontalign option:selected").val(),
|
946 |
-
|
947 |
-
ue = SFSI("input[name='sfsi_form_field_text']").val(),
|
948 |
-
ve = SFSI("#sfsi_form_field_font option:selected").val(),
|
949 |
-
we = SFSI("#sfsi_form_field_fontstyle option:selected").val(),
|
950 |
-
xe = SFSI("input[name='sfsi_form_field_fontcolor']").val(),
|
951 |
-
ye = SFSI("input[name='sfsi_form_field_fontsize']").val(),
|
952 |
-
ze = SFSI("#sfsi_form_field_fontalign option:selected").val(),
|
953 |
-
|
954 |
-
i = SFSI("input[name='sfsi_form_button_text']").val(),
|
955 |
-
j = SFSI("#sfsi_form_button_font option:selected").val(),
|
956 |
-
k = SFSI("#sfsi_form_button_fontstyle option:selected").val(),
|
957 |
-
l = SFSI("input[name='sfsi_form_button_fontcolor']").val(),
|
958 |
-
m = SFSI("input[name='sfsi_form_button_fontsize']").val(),
|
959 |
-
n = SFSI("#sfsi_form_button_fontalign option:selected").val(),
|
960 |
-
o = SFSI("input[name='sfsi_form_button_background']").val();
|
961 |
-
|
962 |
-
var f = {
|
963 |
-
action: "updateSrcn8",
|
964 |
-
sfsi_form_adjustment: ie,
|
965 |
-
sfsi_form_height: je,
|
966 |
-
sfsi_form_width: ke,
|
967 |
-
sfsi_form_border: le,
|
968 |
-
sfsi_form_border_thickness: me,
|
969 |
-
sfsi_form_border_color: ne,
|
970 |
-
sfsi_form_background: oe,
|
971 |
-
|
972 |
-
sfsi_form_heading_text: ae,
|
973 |
-
sfsi_form_heading_font: be,
|
974 |
-
sfsi_form_heading_fontstyle: ce,
|
975 |
-
sfsi_form_heading_fontcolor: de,
|
976 |
-
sfsi_form_heading_fontsize: ee,
|
977 |
-
sfsi_form_heading_fontalign: fe,
|
978 |
-
|
979 |
-
sfsi_form_field_text: ue,
|
980 |
-
sfsi_form_field_font: ve,
|
981 |
-
sfsi_form_field_fontstyle: we,
|
982 |
-
sfsi_form_field_fontcolor: xe,
|
983 |
-
sfsi_form_field_fontsize: ye,
|
984 |
-
sfsi_form_field_fontalign: ze,
|
985 |
-
|
986 |
-
sfsi_form_button_text: i,
|
987 |
-
sfsi_form_button_font: j,
|
988 |
-
sfsi_form_button_fontstyle: k,
|
989 |
-
sfsi_form_button_fontcolor: l,
|
990 |
-
sfsi_form_button_fontsize: m,
|
991 |
-
sfsi_form_button_fontalign: n,
|
992 |
-
sfsi_form_button_background: o,
|
993 |
-
|
994 |
-
nonce: nonce
|
995 |
-
};
|
996 |
-
SFSI.ajax({
|
997 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
998 |
-
type: "post",
|
999 |
-
data: f,
|
1000 |
-
dataType: "json",
|
1001 |
-
async: !0,
|
1002 |
-
success: function (s) {
|
1003 |
-
if (s == "wrong_nonce") {
|
1004 |
-
showErrorSuc("error", "Unauthorised Request, Try again after refreshing page", 7);
|
1005 |
-
afterLoad();
|
1006 |
-
} else {
|
1007 |
-
"success" == s ? (showErrorSuc("success", "Saved !", 8), sfsicollapse("#sfsi_save8"), create_suscriber_form()) : showErrorSuc("error", "Unkown error , please try again", 8),
|
1008 |
-
afterLoad();
|
1009 |
-
}
|
1010 |
-
}
|
1011 |
-
});
|
1012 |
-
}
|
1013 |
-
|
1014 |
-
// Queestion 3
|
1015 |
-
function sfsi_update_step9() {
|
1016 |
-
var nonce = SFSI("#sfsi_save9").attr("data-nonce");
|
1017 |
-
beForeLoad();
|
1018 |
-
|
1019 |
-
var i_float = SFSI("input[name='sfsi_icons_float']:checked").val(),
|
1020 |
-
i_floatP = SFSI("input[name='sfsi_icons_floatPosition']:checked").val(),
|
1021 |
-
i_floatMt = SFSI("input[name='sfsi_icons_floatMargin_top']").val(),
|
1022 |
-
i_floatMb = SFSI("input[name='sfsi_icons_floatMargin_bottom']").val(),
|
1023 |
-
i_floatMl = SFSI("input[name='sfsi_icons_floatMargin_left']").val(),
|
1024 |
-
i_floatMr = SFSI("input[name='sfsi_icons_floatMargin_right']").val(),
|
1025 |
-
i_disableFloat = SFSI("input[name='sfsi_disable_floaticons']:checked").val(),
|
1026 |
-
|
1027 |
-
show_via_widget = SFSI("input[name='sfsi_show_via_widget']").val(),
|
1028 |
-
show_via__shortcode = SFSI("input[name='sfsi_show_via_shortcode']:checked").length==0?"no":"yes",
|
1029 |
-
sfsi_show_via_afterposts = SFSI("input[name='sfsi_show_via_afterposts']").val();
|
1030 |
-
|
1031 |
-
var f = {
|
1032 |
-
|
1033 |
-
action: "updateSrcn9",
|
1034 |
-
|
1035 |
-
sfsi_icons_float: i_float,
|
1036 |
-
sfsi_icons_floatPosition: i_floatP,
|
1037 |
-
sfsi_icons_floatMargin_top: i_floatMt,
|
1038 |
-
sfsi_icons_floatMargin_bottom: i_floatMb,
|
1039 |
-
sfsi_icons_floatMargin_left: i_floatMl,
|
1040 |
-
sfsi_icons_floatMargin_right: i_floatMr,
|
1041 |
-
sfsi_disable_floaticons: i_disableFloat,
|
1042 |
-
|
1043 |
-
sfsi_show_via_widget: show_via_widget,
|
1044 |
-
sfsi_show_via_shortcode: show_via__shortcode,
|
1045 |
-
sfsi_show_via_afterposts: sfsi_show_via_afterposts,
|
1046 |
-
nonce: nonce
|
1047 |
-
};
|
1048 |
-
SFSI.ajax({
|
1049 |
-
url: sfsi_icon_ajax_object.ajax_url,
|
1050 |
-
type: "post",
|
1051 |
-
data: f,
|
1052 |
-
dataType: "json",
|
1053 |
-
async: !0,
|
1054 |
-
success: function (s) {
|
1055 |
-
if (s == "wrong_nonce") {
|
1056 |
-
showErrorSuc("error", "Unauthorised Request, Try again after refreshing page", 9);
|
1057 |
-
afterLoad();
|
1058 |
-
} else {
|
1059 |
-
"success" == s ? (showErrorSuc("success", "Saved !", 9), sfsicollapse("#sfsi_save9")) : showErrorSuc("error", "Unkown error , please try again", 9),
|
1060 |
-
afterLoad();
|
1061 |
-
}
|
1062 |
-
}
|
1063 |
-
});
|
1064 |
-
}
|
1065 |
-
|
1066 |
-
function sfsi_validationStep2() {
|
1067 |
-
//var class_name= SFSI(element).hasAttr('sfsi_validate');
|
1068 |
-
SFSI('input').removeClass('inputError'); // remove previous error
|
1069 |
-
if (sfsi_validator(SFSI('input[name="sfsi_rss_display"]'), 'checked')) {
|
1070 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_rss_url"]'), 'url')) {
|
1071 |
-
showErrorSuc("error", "Error : Invalid Rss url ", 2);
|
1072 |
-
SFSI('input[name="sfsi_rss_url"]').addClass('inputError');
|
1073 |
-
|
1074 |
-
return false;
|
1075 |
-
}
|
1076 |
-
}
|
1077 |
-
/* validate facebook */
|
1078 |
-
if (sfsi_validator(SFSI('input[name="sfsi_facebookPage_option"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_facebookPage_option"]'), 'checked')) {
|
1079 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_facebookPage_url"]'), 'blank')) {
|
1080 |
-
showErrorSuc("error", "Error : Invalid Facebook page url ", 2);
|
1081 |
-
SFSI('input[name="sfsi_facebookPage_url"]').addClass('inputError');
|
1082 |
-
|
1083 |
-
return false;
|
1084 |
-
}
|
1085 |
-
}
|
1086 |
-
/* validate twitter user name */
|
1087 |
-
if (sfsi_validator(SFSI('input[name="sfsi_twitter_followme"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_twitter_followme"]'), 'checked')) {
|
1088 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_twitter_followUserName"]'), 'blank')) {
|
1089 |
-
showErrorSuc("error", "Error : Invalid Twitter UserName ", 2);
|
1090 |
-
SFSI('input[name="sfsi_twitter_followUserName"]').addClass('inputError');
|
1091 |
-
return false;
|
1092 |
-
}
|
1093 |
-
}
|
1094 |
-
/* validate twitter about page */
|
1095 |
-
if (sfsi_validator(SFSI('input[name="sfsi_twitter_aboutPage"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_twitter_aboutPage"]'), 'checked')) {
|
1096 |
-
if (!sfsi_validator(SFSI('#sfsi_twitter_aboutPageText'), 'blank')) {
|
1097 |
-
showErrorSuc("error", "Error : Tweet about my page is blank ", 2);
|
1098 |
-
SFSI('#sfsi_twitter_aboutPageText').addClass('inputError');
|
1099 |
-
return false;
|
1100 |
-
}
|
1101 |
-
}
|
1102 |
-
/* twitter validation */
|
1103 |
-
if (sfsi_validator(SFSI('input[name="sfsi_twitter_page"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_twitter_page"]'), 'checked')) {
|
1104 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_twitter_pageURL"]'), 'blank')) {
|
1105 |
-
showErrorSuc("error", "Error : Invalid twitter page Url ", 2);
|
1106 |
-
SFSI('input[name="sfsi_twitter_pageURL"]').addClass('inputError');
|
1107 |
-
return false;
|
1108 |
-
}
|
1109 |
-
}
|
1110 |
-
|
1111 |
-
/* youtube validation */
|
1112 |
-
if (sfsi_validator(SFSI('input[name="sfsi_youtube_page"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_youtube_page"]'), 'checked')) {
|
1113 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_youtube_pageUrl"]'), 'blank')) {
|
1114 |
-
showErrorSuc("error", "Error : Invalid youtube Url ", 2);
|
1115 |
-
SFSI('input[name="sfsi_youtube_pageUrl"]').addClass('inputError');
|
1116 |
-
return false;
|
1117 |
-
}
|
1118 |
-
}
|
1119 |
-
/* youtube validation */
|
1120 |
-
if (sfsi_validator(SFSI('input[name="sfsi_youtube_page"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_youtube_follow"]'), 'checked')) {
|
1121 |
-
cls = SFSI("input[name='sfsi_youtubeusernameorid']:checked").val();
|
1122 |
-
if (cls == 'name' && !sfsi_validator(SFSI('input[name="sfsi_ytube_user"]'), 'blank')) {
|
1123 |
-
showErrorSuc("error", "Error : Invalid youtube user name", 2);
|
1124 |
-
SFSI('input[name="sfsi_ytube_user"]').addClass('inputError');
|
1125 |
-
return false;
|
1126 |
-
}
|
1127 |
-
|
1128 |
-
if (cls == 'id' && !sfsi_validator(SFSI('input[name="sfsi_ytube_chnlid"]'), 'blank')) {
|
1129 |
-
showErrorSuc("error", "Error : Invalid youtube Channel ID ", 2);
|
1130 |
-
SFSI('input[name="sfsi_ytube_user"]').addClass('inputError');
|
1131 |
-
return false;
|
1132 |
-
}
|
1133 |
-
}
|
1134 |
-
/* pinterest validation */
|
1135 |
-
if (sfsi_validator(SFSI('input[name="sfsi_pinterest_page"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_pinterest_page"]'), 'checked')) {
|
1136 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_pinterest_pageUrl"]'), 'blank')) {
|
1137 |
-
showErrorSuc("error", "Error : Invalid pinterest page url ", 2);
|
1138 |
-
SFSI('input[name="sfsi_pinterest_pageUrl"]').addClass('inputError');
|
1139 |
-
return false;
|
1140 |
-
}
|
1141 |
-
}
|
1142 |
-
/* instagram validation */
|
1143 |
-
if (sfsi_validator(SFSI('input[name="sfsi_instagram_display"]'), 'checked')) {
|
1144 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_instagram_pageUrl"]'), 'blank')) {
|
1145 |
-
showErrorSuc("error", "Error : Invalid Instagram url ", 2);
|
1146 |
-
SFSI('input[name="sfsi_instagram_pageUrl"]').addClass('inputError');
|
1147 |
-
return false;
|
1148 |
-
}
|
1149 |
-
}
|
1150 |
-
/* telegram validation */
|
1151 |
-
if (sfsi_validator(SFSI('input[name="sfsi_telegram_display"]'), 'checked')) {
|
1152 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_telegram_username"]'), 'blank')) {
|
1153 |
-
showErrorSuc("error", "Error : Invalid telegram username ", 2);
|
1154 |
-
SFSI('input[name="sfsi_telegram_username"]').addClass('inputError');
|
1155 |
-
return false;
|
1156 |
-
}
|
1157 |
-
}
|
1158 |
-
/* telegram validation */
|
1159 |
-
if (sfsi_validator(SFSI('input[name="sfsi_telegram_display"]'), 'checked')) {
|
1160 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_telegram_message"]'), 'blank')) {
|
1161 |
-
showErrorSuc("error", "Error : Invalid Message ", 2);
|
1162 |
-
SFSI('input[name="sfsi_telegram_message"]').addClass('inputError');
|
1163 |
-
return false;
|
1164 |
-
}
|
1165 |
-
}
|
1166 |
-
/* vk validation */
|
1167 |
-
if (sfsi_validator(SFSI('input[name="sfsi_vk_display"]'), 'checked')) {
|
1168 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_vk_pageURL"]'), 'blank')) {
|
1169 |
-
showErrorSuc("error", "Error : Invalid vk url ", 2);
|
1170 |
-
SFSI('input[name="sfsi_vk_pageURL"]').addClass('inputError');
|
1171 |
-
return false;
|
1172 |
-
}
|
1173 |
-
}
|
1174 |
-
/* ok validation */
|
1175 |
-
if (sfsi_validator(SFSI('input[name="sfsi_ok_display"]'), 'checked')) {
|
1176 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_ok_pageURL"]'), 'blank')) {
|
1177 |
-
showErrorSuc("error", "Error : Invalid ok url ", 2);
|
1178 |
-
SFSI('input[name="sfsi_ok_pageURL"]').addClass('inputError');
|
1179 |
-
return false;
|
1180 |
-
}
|
1181 |
-
}
|
1182 |
-
/* weibo validation */
|
1183 |
-
if (sfsi_validator(SFSI('input[name="sfsi_weibo_display"]'), 'checked')) {
|
1184 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_weibo_pageURL"]'), 'blank')) {
|
1185 |
-
showErrorSuc("error", "Error : Invalid weibo url ", 2);
|
1186 |
-
SFSI('input[name="sfsi_weibo_pageURL"]').addClass('inputError');
|
1187 |
-
return false;
|
1188 |
-
}
|
1189 |
-
}
|
1190 |
-
/* LinkedIn validation */
|
1191 |
-
if (sfsi_validator(SFSI('input[name="sfsi_linkedin_page"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_linkedin_page"]'), 'checked')) {
|
1192 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_linkedin_pageURL"]'), 'blank')) {
|
1193 |
-
showErrorSuc("error", "Error : Invalid LinkedIn page url ", 2);
|
1194 |
-
SFSI('input[name="sfsi_linkedin_pageURL"]').addClass('inputError');
|
1195 |
-
return false;
|
1196 |
-
}
|
1197 |
-
}
|
1198 |
-
if (sfsi_validator(SFSI('input[name="sfsi_linkedin_recommendBusines"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_linkedin_recommendBusines"]'), 'checked')) {
|
1199 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_linkedin_recommendProductId"]'), 'blank') || !sfsi_validator(SFSI('input[name="sfsi_linkedin_recommendCompany"]'), 'blank')) {
|
1200 |
-
showErrorSuc("error", "Error : Please Enter Product Id and Company for LinkedIn Recommendation ", 2);
|
1201 |
-
SFSI('input[name="sfsi_linkedin_recommendProductId"]').addClass('inputError');
|
1202 |
-
SFSI('input[name="sfsi_linkedin_recommendCompany"]').addClass('inputError');
|
1203 |
-
return false;
|
1204 |
-
}
|
1205 |
-
}
|
1206 |
-
/* validate custom links */
|
1207 |
-
var er = 0;
|
1208 |
-
SFSI("input[name='sfsi_CustomIcon_links[]']").each(function () {
|
1209 |
-
|
1210 |
-
//if(!sfsi_validator(SFSI(this),'blank') || !sfsi_validator(SFSI(SFSI(this)),'url') )
|
1211 |
-
if (!sfsi_validator(SFSI(this), 'blank')) {
|
1212 |
-
showErrorSuc("error", "Error : Please Enter a valid Custom link ", 2);
|
1213 |
-
SFSI(this).addClass('inputError');
|
1214 |
-
er = 1;
|
1215 |
-
}
|
1216 |
-
});
|
1217 |
-
if (!er) return true;
|
1218 |
-
else return false;
|
1219 |
-
}
|
1220 |
-
|
1221 |
-
function sfsi_validationStep3() {
|
1222 |
-
SFSI('input').removeClass('inputError'); // remove previous error
|
1223 |
-
/* validate shuffle effect */
|
1224 |
-
if (sfsi_validator(SFSI('input[name="sfsi_shuffle_icons"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_shuffle_icons"]'), 'checked')) {
|
1225 |
-
if ((!sfsi_validator(SFSI('input[name="sfsi_shuffle_Firstload"]'), 'activte') || !sfsi_validator(SFSI('input[name="sfsi_shuffle_Firstload"]'), 'checked')) && (!sfsi_validator(SFSI('input[name="sfsi_shuffle_interval"]'), 'activte') || !sfsi_validator(SFSI('input[name="sfsi_shuffle_interval"]'), 'checked'))) {
|
1226 |
-
showErrorSuc("error", "Error : Please Chose a Shuffle option ", 3);
|
1227 |
-
SFSI('input[name="sfsi_shuffle_Firstload"]').addClass('inputError');
|
1228 |
-
SFSI('input[name="sfsi_shuffle_interval"]').addClass('inputError');
|
1229 |
-
return false;
|
1230 |
-
}
|
1231 |
-
}
|
1232 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_shuffle_icons"]'), 'checked') && (sfsi_validator(SFSI('input[name="sfsi_shuffle_Firstload"]'), 'checked') || sfsi_validator(SFSI('input[name="sfsi_shuffle_interval"]'), 'checked'))) {
|
1233 |
-
showErrorSuc("error", "Error : Please check \"Shuffle them automatically\" option also ", 3);
|
1234 |
-
SFSI('input[name="sfsi_shuffle_Firstload"]').addClass('inputError');
|
1235 |
-
SFSI('input[name="sfsi_shuffle_interval"]').addClass('inputError');
|
1236 |
-
return false;
|
1237 |
-
}
|
1238 |
-
|
1239 |
-
/* validate twitter user name */
|
1240 |
-
if (sfsi_validator(SFSI('input[name="sfsi_shuffle_interval"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_shuffle_interval"]'), 'checked')) {
|
1241 |
-
|
1242 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_shuffle_intervalTime"]'), 'blank') || !sfsi_validator(SFSI('input[name="sfsi_shuffle_intervalTime"]'), 'int')) {
|
1243 |
-
showErrorSuc("error", "Error : Invalid shuffle time interval", 3);
|
1244 |
-
SFSI('input[name="sfsi_shuffle_intervalTime"]').addClass('inputError');
|
1245 |
-
return false;
|
1246 |
-
}
|
1247 |
-
}
|
1248 |
-
return true;
|
1249 |
-
}
|
1250 |
-
|
1251 |
-
function sfsi_validationStep4() {
|
1252 |
-
//var class_name= SFSI(element).hasAttr('sfsi_validate');
|
1253 |
-
/* validate email */
|
1254 |
-
if (sfsi_validator(SFSI('input[name="sfsi_email_countsDisplay"]'), 'activte') && sfsi_validator(SFSI('input[name="sfsi_email_countsDisplay"]'), 'checked')) {
|
1255 |
-
if (SFSI('input[name="sfsi_email_countsFrom"]:checked').val() == 'manual') {
|
1256 |
-
if (!sfsi_validator(SFSI('input[name="sfsi_email_manualCounts"]'), 'blank')) {
|
1257 |
-
showErrorSuc("error", "Error : Please Enter manual counts for Email icon ", 4);
|
1258 |
-
SFSI('input[name="sfsi_email_manualCounts"]').addClass('inputError');
|