Social Media Share Buttons & Social Sharing Icons - Version 2.3.3

Version Description

Please upgrade

Download this release

Release Info

Developer socialdude
Plugin Icon 128x128 Social Media Share Buttons & Social Sharing Icons
Version 2.3.3
Comparing to
See all releases

Code changes from version 2.3.2 to 2.3.3

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 = ABSPATH . 'wp-content/plugins';
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,606 +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
- wp_send_json_success();
237
- }
238
-
239
- /**
240
- * Will fire when admin deactivates plugin
241
- *
242
- * @return void
243
- */
244
- public function onDeactivatePluginListener()
245
- {
246
- if (!$this->isAllowingLogging()) return;
247
-
248
- $question = isset($_POST['question']) ? stripslashes($_POST['question']) : null;
249
- $reason = isset($_POST['reason']) ? stripslashes($_POST['reason']) : null;
250
-
251
- $response = DeactivateRequest::make($this->collector, $this->id, $this->path, $question, $reason)
252
- ->execute($this->requestor);
253
-
254
- // Exit if request failed
255
- if (!$response->isSuccess()) {
256
- wp_send_json_error($response->body);
257
- }
258
-
259
- $this->setIsInstalled(false);
260
-
261
- AccountDataFactory::syncData();
262
-
263
- wp_send_json_success();
264
- }
265
-
266
- /**
267
- * Will fire when user opted in
268
- *
269
- * @return void
270
- */
271
- public function onOptInListener()
272
- {
273
- $response = OptInRequest::make($this->collector, $this->id, $this->path)->execute($this->requestor);
274
-
275
- // Exit if request failed
276
- if (!$response->isSuccess()) {
277
- wp_send_json_error($response->body);
278
- }
279
-
280
- $this->setIsOptedIn(true);
281
-
282
- AccountDataFactory::syncData();
283
-
284
- wp_die();
285
- }
286
-
287
- /**
288
- * Will fire when user opted out
289
- *
290
- * @return void
291
- */
292
- public function onOptOutListener()
293
- {
294
- $response = OptOutRequest::make($this->collector, $this->id, $this->path)->execute($this->requestor);
295
-
296
- // Exit if request failed
297
- if (!$response->isSuccess()) {
298
- wp_send_json_error($response->body);
299
- }
300
-
301
- $this->setIsOptedIn(false);
302
-
303
- AccountDataFactory::syncData();
304
-
305
- wp_send_json_success();
306
- }
307
-
308
- /**
309
- * Will fire when user accept opt-in
310
- * at first time
311
- *
312
- * @return void
313
- */
314
- public function onInstallListener()
315
- {
316
- $cache = DatabaseCache::getInstance();
317
-
318
- // Set flag to true which indicates that install is resolved
319
- // also remove install plugin id from cache
320
- $this->setIsInstallResolved(true);
321
- $cache->delete('plugin_to_install');
322
-
323
- $response = InstallRequest::make($this->collector, $this->id, $this->path)->execute($this->requestor);
324
-
325
- // Exit if request failed
326
- if (!$response->isSuccess()) {
327
- wp_send_json_error($response->body);
328
- }
329
-
330
- $this->setIsSigned(true);
331
-
332
- $this->setIsOptedIn(true);
333
-
334
- $factory = NoticeFactory::instance();
335
-
336
- $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());
337
-
338
- $notificationId = uniqid();
339
-
340
- $notice = Notice::make(
341
- $notificationId,
342
- $this->getId(),
343
- $message,
344
- $this->collector->getPluginName($this->path)
345
- );
346
-
347
- $factory->addNotice($notice);
348
-
349
- AccountDataFactory::syncData();
350
-
351
- // Set email confirmation notification id to cache
352
- // se we can extract and remove it when user confirmed email
353
- $cache->put(
354
- sprintf('account_email_confirmation_%s', $this->getId()),
355
- $notificationId
356
- );
357
-
358
- wp_send_json_success();
359
- }
360
-
361
- /**
362
- * Will fire when user skipped installation
363
- *
364
- * @return void
365
- */
366
- public function onSkipInstallListener()
367
- {
368
- // Set flag to true which indicates that install is resolved
369
- // also remove install plugin id from cache
370
- $this->setIsInstallResolved(true);
371
- DatabaseCache::getInstance()->delete('plugin_to_install');
372
- }
373
-
374
- /**
375
- * Will fire when user delete plugin through admin panel.
376
- * This action will happen if admin at least once
377
- * activated the plugin.
378
- *
379
- * @return void
380
- * @throws \Exception
381
- */
382
- public static function onUninstallPluginListener()
383
- {
384
- $factory = AccountDataFactory::instance();
385
-
386
- $pluginFile = substr(current_filter(), strlen( 'uninstall_' ));
387
-
388
- $account = $factory->getAccountDataByBasePath($pluginFile);
389
-
390
- // If account somehow is not found, exit the execution
391
- if (!$account) return;
392
-
393
- $analyst = Analyst::getInstance();
394
-
395
- $collector = new Collector($analyst);
396
-
397
- $requestor = new ApiRequestor($account->getId(), $account->getSecret(), $analyst->getApiBase());
398
-
399
- // Just send request to log uninstall event not caring about response
400
- UninstallRequest::make($collector, $account->getId(), $account->getPath())->execute($requestor);
401
-
402
- $factory->sync();
403
- }
404
-
405
- /**
406
- * Fires when used verified his account
407
- */
408
- public function onInstallVerifiedListener()
409
- {
410
- $factory = NoticeFactory::instance();
411
-
412
- $notice = Notice::make(
413
- uniqid(),
414
- $this->getId(),
415
- 'Thank you for confirming your email.',
416
- $this->collector->getPluginName($this->path)
417
- );
418
-
419
- $factory->addNotice($notice);
420
-
421
- // Remove confirmation notification
422
- $confirmationNotificationId = DatabaseCache::getInstance()->pop(sprintf('account_email_confirmation_%s', $this->getId()));
423
- $factory->remove($confirmationNotificationId);
424
-
425
- AccountDataFactory::syncData();
426
-
427
- wp_send_json_success();
428
- }
429
-
430
- /**
431
- * Will fire when wp renders plugin
432
- * action buttons
433
- *
434
- * @param $defaultLinks
435
- * @return array
436
- */
437
- public function onRenderActionLinksHook($defaultLinks)
438
- {
439
- $customLinks = [];
440
-
441
- $customLinks[] = $this->isOptedIn()
442
- ? '<a class="analyst-action-opt analyst-opt-out" analyst-plugin-id="' . $this->getId() . '" analyst-plugin-signed="' . (int) $this->isSigned() . '">Opt Out</a>'
443
- : '<a class="analyst-action-opt analyst-opt-in" analyst-plugin-id="' . $this->getId() . '" analyst-plugin-signed="' . (int) $this->isSigned() . '">Opt In</a>';
444
-
445
- // Append anchor to find specific deactivation link
446
- if (isset($defaultLinks['deactivate'])) {
447
- $defaultLinks['deactivate'] .= '<span analyst-plugin-id="' . $this->getId() . '" analyst-plugin-opted-in="' . (int) $this->isOptedIn() . '"></span>';
448
- }
449
-
450
- return array_merge($customLinks, $defaultLinks);
451
- }
452
-
453
- /**
454
- * @return AccountData
455
- */
456
- public function getData()
457
- {
458
- return $this->data;
459
- }
460
-
461
- /**
462
- * @param AccountData $data
463
- */
464
- public function setData(AccountData $data)
465
- {
466
- $this->data = $data;
467
-
468
- $this->setIsOptedIn($data->isOptedIn());
469
- $this->setIsInstalled($data->isInstalled());
470
- $this->setIsSigned($data->isSigned());
471
- $this->setIsInstallResolved($data->isInstallResolved());
472
- }
473
-
474
- /**
475
- * Resolves valid action name
476
- * based on client id
477
- *
478
- * @param $action
479
- * @return string
480
- */
481
- private function resolveActionName($action)
482
- {
483
- return sprintf('%s_%s', $action, $this->id);
484
- }
485
-
486
- /**
487
- * Register action for current plugin
488
- *
489
- * @param $action
490
- * @param $callback
491
- */
492
- private function addFilter($action, $callback)
493
- {
494
- $validAction = sprintf('%s_%s', $action, $this->basePluginPath);
495
-
496
- add_filter($validAction, $callback, 10);
497
- }
498
-
499
- /**
500
- * Add ajax action for current plugin
501
- *
502
- * @param $action
503
- * @param $callback
504
- * @param bool $raw Format action ??
505
- */
506
- private function addAjax($action, $callback, $raw = false)
507
- {
508
- $validAction = $raw ? $action : sprintf('%s%s', 'wp_ajax_', $this->resolveActionName($action));
509
-
510
- add_action($validAction, $callback);
511
- }
512
-
513
- /**
514
- * @return bool
515
- */
516
- public function isSigned()
517
- {
518
- return $this->isSigned;
519
- }
520
-
521
- /**
522
- * @param bool $isSigned
523
- */
524
- public function setIsSigned($isSigned)
525
- {
526
- $this->data->setIsSigned($isSigned);
527
-
528
- $this->isSigned = $isSigned;
529
- }
530
-
531
- /**
532
- * @return RequestorContract
533
- */
534
- public function getRequestor()
535
- {
536
- return $this->requestor;
537
- }
538
-
539
- /**
540
- * @param RequestorContract $requestor
541
- */
542
- public function setRequestor(RequestorContract $requestor)
543
- {
544
- $this->requestor = $requestor;
545
- }
546
-
547
- /**
548
- * @return string
549
- */
550
- public function getClientSecret()
551
- {
552
- return $this->clientSecret;
553
- }
554
-
555
- /**
556
- * @return Collector
557
- */
558
- public function getCollector()
559
- {
560
- return $this->collector;
561
- }
562
-
563
- /**
564
- * @param Collector $collector
565
- */
566
- public function setCollector(Collector $collector)
567
- {
568
- $this->collector = $collector;
569
- }
570
-
571
- /**
572
- * Do we allowing logging
573
- *
574
- * @return bool
575
- */
576
- public function isAllowingLogging()
577
- {
578
- return $this->isOptedIn;
579
- }
580
-
581
- /**
582
- * @return string
583
- */
584
- public function getBasePluginPath()
585
- {
586
- return $this->basePluginPath;
587
- }
588
-
589
- /**
590
- * @return bool
591
- */
592
- public function isInstallResolved()
593
- {
594
- return $this->isInstallResolved;
595
- }
596
-
597
- /**
598
- * @param bool $isInstallResolved
599
- */
600
- public function setIsInstallResolved($isInstallResolved)
601
- {
602
- $this->data->setIsInstallResolved($isInstallResolved);
603
-
604
- $this->isInstallResolved = $isInstallResolved;
605
- }
606
- }
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('custom', analyst_assets_url('/css/customize.css'));
88
- wp_enqueue_script('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.23',
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
+ );
libs/sfsi_install_uninstall.php CHANGED
@@ -34,7 +34,7 @@ function sfsi_update_plugin()
34
  update_option("sfsi_custom_icons", "yes");
35
  }
36
  //Install version
37
- update_option("sfsi_pluginVersion", "2.32");
38
 
39
  if (!get_option('sfsi_serverphpVersionnotification')) {
40
  add_option("sfsi_serverphpVersionnotification", "yes");
34
  update_option("sfsi_custom_icons", "yes");
35
  }
36
  //Install version
37
+ update_option("sfsi_pluginVersion", "2.33");
38
 
39
  if (!get_option('sfsi_serverphpVersionnotification')) {
40
  add_option("sfsi_serverphpVersionnotification", "yes");
libs/sfsi_subscribe_widget.php CHANGED
@@ -46,11 +46,12 @@ class subscriber_widget extends WP_Widget {
46
  $title = '';
47
  }
48
  ?>
49
- <p>
50
- <label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label>
51
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
52
- </p>
53
- <?php
 
54
  }
55
 
56
  // Updating widget replacing old instances with new
@@ -75,9 +76,15 @@ function sfsi_get_subscriberForm()
75
  {
76
  $option8 = unserialize(get_option('sfsi_section8_options',false));
77
  $sfsi_feediid = sanitize_text_field(get_option('sfsi_feed_id'));
78
- $url = "https://www.specificfeeds.com/widgets/subscribeWidget/";
 
 
 
 
 
 
 
79
  $return = '';
80
- $url = $url.$sfsi_feediid.'/8/';
81
  $return .= '<div class="sfsi_subscribe_Popinner">
82
  <form method="post" onsubmit="return sfsi_processfurther(this);" target="popupwindow" action="'.$url.'">
83
  <h5>'.trim(sanitize_text_field($option8['sfsi_form_heading_text'])).'</h5>
46
  $title = '';
47
  }
48
  ?>
49
+ <p>
50
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label>
51
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>"
52
+ name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
53
+ </p>
54
+ <?php
55
  }
56
 
57
  // Updating widget replacing old instances with new
76
  {
77
  $option8 = unserialize(get_option('sfsi_section8_options',false));
78
  $sfsi_feediid = sanitize_text_field(get_option('sfsi_feed_id'));
79
+ if($sfsi_feediid == ""){
80
+ $url = "https://www.specificfeeds.com/subscribe?pub=boTZa2n0OIjC4D8PkiyzByH-uKEJSZgqMW-sJiFwbuEnoxENjKva2A";
81
+ }else{
82
+ $url = "https://www.specificfeeds.com/widgets/subscribeWidget/";
83
+ $url = $url.$sfsi_feediid.'/8/';
84
+
85
+ }
86
+
87
  $return = '';
 
88
  $return .= '<div class="sfsi_subscribe_Popinner">
89
  <form method="post" onsubmit="return sfsi_processfurther(this);" target="popupwindow" action="'.$url.'">
90
  <h5>'.trim(sanitize_text_field($option8['sfsi_form_heading_text'])).'</h5>
libs/sfsi_widget.php CHANGED
@@ -1,1621 +1,1624 @@
1
- <?php
2
- /* create SFSI widget */
3
- class Sfsi_Widget extends WP_Widget
4
- {
5
-
6
- function __construct()
7
- {
8
- $widget_ops = array( 'classname' => 'sfsi', 'description' => __('Ultimate Social Media Icons widgets', 'Ultimate Social Media Icons ') );
9
- $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sfsi-widget' );
10
-
11
- parent::__construct(
12
- // Base ID of your widget
13
- 'sfsi-widget',
14
-
15
- // Widget name will appear in UI
16
- __('Ultimate Social Media Icons', 'Ultimate Social Media Icons'),
17
-
18
- // Widget description
19
- $widget_ops,
20
-
21
- $control_ops
22
- );
23
- }
24
-
25
- function widget( $args, $instance )
26
- {
27
- extract( $args );
28
- /*Our variables from the widget settings. */
29
- $title = isset( $instance['title'] ) ? apply_filters('widget_title', $instance['title'] ) : '';
30
- // var_dump($title,'ldfjgkdfj');
31
- $show_info = isset( $instance['show_info'] ) ? $instance['show_info'] : false;
32
-
33
- global $is_floter;
34
- echo $before_widget;
35
-
36
- /* Display the widget title */
37
- if ( $title ) echo $before_title . $title . $after_title;
38
- ?>
39
- <div class="sfsi_widget" data-position="widget">
40
- <div id='sfsi_wDiv'></div>
41
- <?php
42
- /* Link the main icons function */
43
- echo sfsi_check_visiblity(0);
44
- ?>
45
- <div style="clear: both;"></div>
46
- </div>
47
- <?php
48
- if ( is_active_widget( false, false, $this->id_base, true ) ) { }
49
- echo $after_widget;
50
- }
51
-
52
- /*Update the widget */
53
- function update( $new_instance, $old_instance )
54
- {
55
- $instance = $old_instance;
56
- //Strip tags from title and name to remove HTML
57
- if($new_instance['showf']==0)
58
- {
59
- $instance['showf']=1;
60
- }
61
- else
62
- {
63
- $instance['showf']=0;
64
- }
65
- $instance['title'] = strip_tags( $new_instance['title'] );
66
- return $instance;
67
- }
68
-
69
- /* Set up some default widget settings. */
70
- function form( $instance )
71
- {
72
- $defaults = array( 'title' =>"" );
73
- $instance = wp_parse_args( (array) $instance, $defaults );
74
- if(isset($instance['showf']) && !empty($instance['showf']))
75
- {
76
- if( $instance['showf'] == 0 && empty($instance['title']))
77
- {
78
- $instance['title']='Please follow & like us :)';
79
- }
80
- else
81
- {
82
- $instance['title'];
83
- }
84
- }
85
- else
86
- {
87
- $instance['title']='Please follow & like us :)';
88
- }
89
- ?>
90
- <p>
91
- <label for="<?php echo $this->get_field_id( 'title' ); ?>">Title</label>
92
- <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />
93
- <input type="hidden" value="<?php echo $instance['showf'] ?>" id="<?php echo $this->get_field_id( 'showf' ); ?>" name="<?php echo $this->get_field_name( 'showf' ); ?>" />
94
- </p>
95
- <p>
96
- Please go to the <a href="admin.php?page=sfsi-options">plugin page</a> to set your preferences
97
- </p>
98
- <?php
99
- }
100
- }
101
- /* END OF widget Class */
102
- /* register widget to wordpress */
103
- function register_sfsi_widgets()
104
- {
105
- register_widget( 'sfsi_widget' );
106
- }
107
- add_action( 'widgets_init', 'register_sfsi_widgets' );
108
-
109
- /* check the icons visiblity */
110
- function sfsi_check_visiblity($isFloter=0)
111
- {
112
- global $wpdb;
113
- /* Access the saved settings in database */
114
- $sfsi_section1_options = unserialize(get_option('sfsi_section1_options',false));
115
- $sfsi_section3 = unserialize(get_option('sfsi_section3_options',false));
116
- $sfsi_section5 = unserialize(get_option('sfsi_section5_options',false));
117
- $sfsi_section9 = unserialize(get_option('sfsi_section9_options',false));
118
-
119
- /* calculate the width and icons display alignments */
120
- $icons_space = $sfsi_section5['sfsi_icons_spacing'];
121
- $icons_size = $sfsi_section5['sfsi_icons_size'];
122
- $icons_per_row = ($sfsi_section5['sfsi_icons_perRow'])? $sfsi_section5['sfsi_icons_perRow'] : '';
123
-
124
- $icons_alignment = $sfsi_section5['sfsi_icons_Alignment'];
125
- $position = 'position:absolute;';
126
- $position1 = 'position:absolute;';
127
- $jquery ='<script>';
128
-
129
- $jquery .= 'jQuery(".sfsi_widget").each(function( index ) {
130
- if(jQuery(this).attr("data-position") == "widget")
131
- {
132
- var wdgt_hght = jQuery(this).children(".norm_row.sfsi_wDiv").height();
133
- var title_hght = jQuery(this).parent(".widget.sfsi").children(".widget-title").height();
134
- var totl_hght = parseInt( title_hght ) + parseInt( wdgt_hght );
135
- jQuery(this).parent(".widget.sfsi").css("min-height", totl_hght+"px");
136
- }
137
- });';
138
-
139
- /* check if icons shuffling is activated in admin or not */
140
- if($sfsi_section5['sfsi_icons_stick']=="yes")
141
- {
142
- if(is_admin_bar_showing())
143
- {
144
- $Ictop = "30px";
145
- }
146
- else
147
- {
148
- $Ictop = "0";
149
- }
150
-
151
- $jquery.='var s = jQuery(".sfsi_widget");
152
- var pos = s.position();
153
- jQuery(window).scroll(function(){
154
- sfsi_stick_widget("'.$Ictop.'");
155
- }); ';
156
- }
157
-
158
- /* check if icons floating is activated in admin */
159
- if($sfsi_section9['sfsi_icons_float']=="yes")
160
- {
161
- $top = "15";
162
- switch($sfsi_section9['sfsi_icons_floatPosition'])
163
- {
164
- case "top-left" : if(is_admin_bar_showing()) : $position.="position:absolute;left:30px;top:35px;"; $top="35"; else : $position.="position:absolute;left:10px;top:2%"; $top="10"; endif;
165
- break;
166
- case "top-right" : if(is_admin_bar_showing()) : $position.="position:absolute;right:30px;top:35px;"; $top="35"; else : $position.="position:absolute;right:10px;top:2%"; $top="10"; endif;
167
- break;
168
- case "center-right" : $position.="position:absolute;right:30px;top:50%"; $top="center";
169
- break;
170
- case "center-left" : $position.="position:absolute;left:30px;top:50%"; $top="center";
171
- break;
172
- case "center-top" :
173
- if(is_admin_bar_showing())
174
- {
175
- $position .= "left:50%;top:35px;"; $top="35";
176
- }
177
- else
178
- {
179
- $position .= "left:50%;top:10px;"; $top="10";
180
- }
181
- break;
182
- case "center-bottom" :
183
- $position .= "left:50%;bottom:0px"; $top="bottom";
184
- break;
185
-
186
- case "bottom-right" : $position.="position:absolute;right:30px;bottom:0px"; $top="bottom";
187
- break;
188
- case "bottom-left" : $position.="position:absolute;left:30px;bottom:0px"; $top="bottom";
189
- break;
190
- }
191
- //$jquery.="jQuery( document ).ready(function( $ ) { sfsi_float_widget('".$top."')});";
192
- if($sfsi_section9['sfsi_icons_floatPosition'] == 'center-right' || $sfsi_section9['sfsi_icons_floatPosition'] == 'center-left')
193
- {
194
- $jquery.="jQuery( document ).ready(function( $ )
195
- {
196
- var topalign = ( jQuery(window).height() - jQuery('#sfsi_floater').height() ) / 2;
197
- jQuery('#sfsi_floater').css('top',topalign);
198
- sfsi_float_widget('".$top."');
199
- });";
200
- }
201
- else if($sfsi_section9['sfsi_icons_floatPosition'] == 'center-top' || $sfsi_section9['sfsi_icons_floatPosition'] == 'center-bottom'){
202
-
203
- $jquery.="jQuery(document).ready(function( $ )
204
- {
205
- var leftalign = ( jQuery(window).width() - jQuery('#sfsi_floater').width() ) / 2;
206
- jQuery('#sfsi_floater').css('left',leftalign);
207
- sfsi_float_widget('".$top."');
208
- });";
209
- }
210
- else
211
- {
212
- $jquery.="jQuery( document ).ready(function( $ ) { sfsi_float_widget('".$top."')});";
213
- }
214
- }
215
-
216
- $extra=0;
217
- if($sfsi_section3['sfsi_shuffle_icons']=="yes")
218
- {
219
- if($sfsi_section3['sfsi_shuffle_Firstload']=="yes" && $sfsi_section3['sfsi_shuffle_interval']=="yes")
220
- {
221
- $shuffle_time=(isset($sfsi_section3['sfsi_shuffle_intervalTime'])) ? $sfsi_section3['sfsi_shuffle_intervalTime'] : 3;
222
- $shuffle_time=$shuffle_time*1000;
223
- $jquery.="jQuery( document ).ready(function( $ ) { jQuery('.sfsi_wDiv').each(function(){ new window.Manipulator( jQuery(this)); }); setTimeout(function(){ jQuery('#sfsi_wDiv').each(function(){ jQuery(this).click(); })},2000); setInterval(function(){ jQuery('#sfsi_wDiv').each(function(){ jQuery(this).click(); })},".$shuffle_time."); });";
224
- }
225
- else if($sfsi_section3['sfsi_shuffle_Firstload']=="no" && $sfsi_section3['sfsi_shuffle_interval']=="yes")
226
- {
227
- $shuffle_time=(isset($sfsi_section3['sfsi_shuffle_intervalTime'])) ? $sfsi_section3['sfsi_shuffle_intervalTime'] : 3;
228
- $shuffle_time=$shuffle_time*1000;
229
- $jquery.="jQuery( document ).ready(function( $ ) { jQuery('.sfsi_wDiv').each(function(){ new window.Manipulator( jQuery(this)); }); setInterval(function(){ jQuery('#sfsi_wDiv').each(function(){ jQuery(this).click(); })},".$shuffle_time."); });";
230
- }
231
- else
232
- {
233
- $jquery.="jQuery( document ).ready(function( $ ) { jQuery('.sfsi_wDiv').each(function(){ new window.Manipulator( jQuery(this)); }); setTimeout(function(){ jQuery('#sfsi_wDiv').each(function(){ jQuery(this).click(); })},2000); });";
234
- }
235
- }
236
-
237
- /* magnage the icons in saved order in admin */
238
- $custom_icons_order = unserialize($sfsi_section5['sfsi_CustomIcons_order']);
239
- $icons = unserialize($sfsi_section1_options['sfsi_custom_files']);
240
- if(!isset($sfsi_section5['sfsi_telegramIcon_order'])){
241
- $sfsi_section5['sfsi_telegramIcon_order'] = '11';
242
- }
243
- if(!isset($sfsi_section5['sfsi_vkIcon_order'])){
244
- $sfsi_section5['sfsi_vkIcon_order'] = '12';
245
- }
246
- if(!isset($sfsi_section5['sfsi_okIcon_order'])){
247
- $sfsi_section5['sfsi_okIcon_order'] = '13';
248
- }
249
- if(!isset($sfsi_section5['sfsi_weiboIcon_order'])){
250
- $sfsi_section5['sfsi_weiboIcon_order'] = '14';
251
- }
252
- if(!isset($sfsi_section5['sfsi_wechatIcon_order'])){
253
- $sfsi_section5['sfsi_wechatIcon_order'] = '15';
254
- }
255
- $icons_order = array(
256
- '0' => '',
257
- $sfsi_section5['sfsi_rssIcon_order']=>'rss',
258
- $sfsi_section5['sfsi_emailIcon_order']=>'email',
259
- $sfsi_section5['sfsi_facebookIcon_order']=>'facebook',
260
- $sfsi_section5['sfsi_twitterIcon_order']=>'twitter',
261
- $sfsi_section5['sfsi_youtubeIcon_order']=>'youtube',
262
- $sfsi_section5['sfsi_pinterestIcon_order']=>'pinterest',
263
- $sfsi_section5['sfsi_linkedinIcon_order']=>'linkedin',
264
- $sfsi_section5['sfsi_instagramIcon_order']=>'instagram',
265
- $sfsi_section5['sfsi_telegramIcon_order']=>'telegram',
266
- $sfsi_section5['sfsi_vkIcon_order']=>'vk',
267
- $sfsi_section5['sfsi_okIcon_order']=>'ok',
268
- $sfsi_section5['sfsi_weiboIcon_order']=>'weibo',
269
- $sfsi_section5['sfsi_wechatIcon_order']=>'wechat',
270
- ) ;
271
- if(is_array($custom_icons_order) )
272
- {
273
- foreach($custom_icons_order as $data)
274
- {
275
- $icons_order[$data['order']] = $data;
276
- }
277
- }
278
- ksort($icons_order);
279
-
280
- /* calculate the total width of widget according to icons */
281
- if(!empty($icons_per_row))
282
- {
283
- $width = ((int)$icons_space+(int)$icons_size)*(int)$icons_per_row;
284
- $main_width = $width = $width+$extra;
285
- $main_width = $main_width."px";
286
- }
287
- else
288
- {
289
- $width = ((int)$icons_space+(int)$icons_size);
290
- $main_width = "35%";
291
- }
292
-
293
- /* built the main widget div */
294
- $icons_main = '<div class="norm_row sfsi_wDiv" style="width:'.$main_width.';text-align:'.$icons_alignment.';'.$position1.'">';
295
- $icons = "";
296
- /* loop through icons and bulit the icons with all settings applied in admin */
297
- foreach($icons_order as $index => $icn) :
298
- if(is_array($icn)) { $icon_arry=$icn; $icn="custom" ; }
299
- switch ($icn) :
300
- case 'rss' : if($sfsi_section1_options['sfsi_rss_display']=='yes') $icons.= sfsi_prepairIcons('rss');
301
- break;
302
- case 'email' : if($sfsi_section1_options['sfsi_email_display']=='yes') $icons.= sfsi_prepairIcons('email');
303
- break;
304
- case 'facebook' : if($sfsi_section1_options['sfsi_facebook_display']=='yes') $icons.= sfsi_prepairIcons('facebook');
305
- break;
306
- case 'twitter' : if($sfsi_section1_options['sfsi_twitter_display']=='yes') $icons.= sfsi_prepairIcons('twitter');
307
- break;
308
- case 'youtube' : if($sfsi_section1_options['sfsi_youtube_display']=='yes') $icons.= sfsi_prepairIcons('youtube');
309
- break;
310
- case 'pinterest' : if($sfsi_section1_options['sfsi_pinterest_display']=='yes') $icons.= sfsi_prepairIcons('pinterest');
311
- break;
312
- case 'linkedin' : if($sfsi_section1_options['sfsi_linkedin_display']=='yes') $icons.= sfsi_prepairIcons('linkedin');
313
- break;
314
- case 'instagram' : if($sfsi_section1_options['sfsi_instagram_display']=='yes') $icons.= sfsi_prepairIcons('instagram');
315
- break;
316
- case 'telegram' : if($sfsi_section1_options['sfsi_telegram_display']=='yes') $icons.= sfsi_prepairIcons('telegram');
317
- break;
318
- case 'vk' : if($sfsi_section1_options['sfsi_vk_display']=='yes') $icons.= sfsi_prepairIcons('vk');
319
- break;
320
- case 'ok' : if($sfsi_section1_options['sfsi_ok_display']=='yes') $icons.= sfsi_prepairIcons('ok');
321
- break;
322
- case 'weibo' : if($sfsi_section1_options['sfsi_weibo_display']=='yes') $icons.= sfsi_prepairIcons('weibo');
323
- break;
324
- case 'wechat' : if($sfsi_section1_options['sfsi_wechat_display']=='yes') $icons.= sfsi_prepairIcons('wechat');
325
- break;
326
- case 'custom' : $icons.= sfsi_prepairIcons($icon_arry['ele']);
327
- break;
328
- endswitch;
329
- endforeach;
330
-
331
- $jquery.="</script>";
332
- $icons.='</div >';
333
-
334
- $margin = $width+11;
335
-
336
- $icons_main.=$icons.'<div id="sfsi_holder" class="sfsi_holders" style="position: relative; float: left;width:100%;z-index:-1;"></div >'.$jquery;
337
- /* if floating of icons is active create a floater div */
338
- $icons_float='';
339
-
340
- if($sfsi_section9['sfsi_icons_float']=="yes" && $isFloter==1)
341
- {
342
- if($sfsi_section9['sfsi_icons_floatPosition'] == "top-left")
343
- {
344
- $styleMargin = "margin-top:".$sfsi_section9['sfsi_icons_floatMargin_top']."px;margin-left:".$sfsi_section9['sfsi_icons_floatMargin_left']."px;";
345
- }
346
- elseif($sfsi_section9['sfsi_icons_floatPosition'] == "top-right")
347
- {
348
- $styleMargin = "margin-top:".$sfsi_section9['sfsi_icons_floatMargin_top']."px;margin-right:".$sfsi_section9['sfsi_icons_floatMargin_right']."px;";
349
- }
350
- elseif($sfsi_section9['sfsi_icons_floatPosition'] == "center-left")
351
- {
352
- $styleMargin = "margin-left:".$sfsi_section9['sfsi_icons_floatMargin_left']."px;";
353
- }
354
- elseif($sfsi_section9['sfsi_icons_floatPosition'] == "center-right")
355
- {
356
- $styleMargin = "margin-right:".$sfsi_section9['sfsi_icons_floatMargin_right']."px;";
357
- }
358
- elseif($sfsi_section9['sfsi_icons_floatPosition'] == "bottom-left")
359
- {
360
- $styleMargin = "margin-bottom:".$sfsi_section9['sfsi_icons_floatMargin_bottom']."px;margin-left:".$sfsi_section9['sfsi_icons_floatMargin_left']."px;";
361
- }
362
- elseif($sfsi_section9['sfsi_icons_floatPosition'] == "bottom-right")
363
- {
364
- $styleMargin = "margin-bottom:".$sfsi_section9['sfsi_icons_floatMargin_bottom']."px;margin-right:".$sfsi_section9['sfsi_icons_floatMargin_right']."px;";
365
- }
366
-
367
- $icons_float = isset($styleMargin) && !empty($styleMargin) ? '<style type="text/css">#sfsi_floater { '.$styleMargin.' }</style>' : '';
368
- $icons_float .= '<div class="norm_row sfsi_wDiv" id="sfsi_floater" style="z-index: 9999;width:'.$width.'px;text-align:'.$icons_alignment.';'.$position.'">';
369
- $icons_float .= $icons;
370
- $icons_float .= "<input type='hidden' id='sfsi_floater_sec' value='".$sfsi_section9['sfsi_icons_floatPosition']."' />";
371
- $icons_float.="</div>".$jquery;
372
- return $icons_float; exit;
373
- }
374
- $icons_data=$icons_main.$icons_float;
375
- return $icons_data;
376
- }
377
-
378
- /* make all icons with saved settings in admin */
379
- function sfsi_prepairIcons($icon_name,$is_front=0)
380
- {
381
- global $wpdb; global $socialObj;
382
- $mouse_hover_effect = '';
383
- $active_theme = 'official';
384
- $sfsi_shuffle_Firstload = 'no';
385
- $sfsi_display_counts = "no";
386
- $icon = '';
387
- $url = '';
388
- $alt_text = '';
389
- $new_window = '';
390
- $class = '';
391
-
392
- /* access all saved settings in admin */
393
- $sfsi_section1_options = unserialize(get_option('sfsi_section1_options',false));
394
- $sfsi_section2_options = unserialize(get_option('sfsi_section2_options',false));
395
- $sfsi_section3_options = unserialize(get_option('sfsi_section3_options',false));
396
- $sfsi_section4_options = unserialize(get_option('sfsi_section4_options',false));
397
- $sfsi_section5_options = unserialize(get_option('sfsi_section5_options',false));
398
- $sfsi_section6_options = unserialize(get_option('sfsi_section6_options',false));
399
- $sfsi_section7_options = unserialize(get_option('sfsi_section7_options',false));
400
- /* get active theme */
401
- $border_radius='';
402
- $active_theme = $sfsi_section3_options['sfsi_actvite_theme'];
403
- if(!isset($sfsi_section2_options['sfsi_wechatShare_option'])){
404
- $sfsi_section2_options['sfsi_wechatShare_option']="yes";
405
- }
406
- /* shuffle effect */
407
- if($sfsi_section3_options['sfsi_shuffle_icons']=='yes')
408
- {
409
- $sfsi_shuffle_Firstload=$sfsi_section3_options["sfsi_shuffle_Firstload"];
410
- if($sfsi_section3_options["sfsi_shuffle_interval"]=="yes")
411
- {
412
- $sfsi_shuffle_interval = $sfsi_section3_options["sfsi_shuffle_intervalTime"];
413
- }
414
- }
415
-
416
- /* define the main url for icon access */
417
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/".$active_theme."/";
418
- $visit_iconsUrl = SFSI_PLUGURL."images/visit_icons/";
419
- $hoverSHow = 0;
420
-
421
- /* check is icon is a custom icon or default icon */
422
- if(is_numeric($icon_name)) { $icon_n=$icon_name; $icon_name="custom" ; }
423
- $counts = '';
424
- $twit_tolCls = "";
425
- $twt_margin = "";
426
- $icons_space = $sfsi_section5_options['sfsi_icons_spacing'];
427
- $padding_top = '';
428
-
429
- // $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https" : "http";
430
- // $current_url = $scheme.'://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
431
-
432
- $current_url = sfsi_get_current_page_url();
433
-
434
- $url = "#";
435
- $cmcls = '';
436
- $toolClass = '';
437
-
438
- $socialObj = new sfsi_SocialHelper(); /* global object to access 3rd party icon's actions */
439
-
440
- switch($icon_name)
441
- {
442
- case "rss" :
443
-
444
- $url = isset($sfsi_section2_options['sfsi_rss_url']) && !empty($sfsi_section2_options['sfsi_rss_url'])? $sfsi_section2_options['sfsi_rss_url'] : '';
445
-
446
- $toolClass = "rss_tool_bdr";
447
- $hoverdiv = '';
448
- $arrow_class = "bot_rss_arow";
449
-
450
- /* fecth no of counts if active in admin section */
451
- if($sfsi_section4_options['sfsi_rss_countsDisplay']=="yes" && $sfsi_section4_options['sfsi_display_counts']=="yes")
452
- {
453
- $counts = $socialObj->format_num($sfsi_section4_options['sfsi_rss_manualCounts']);
454
- }
455
-
456
- if(!empty($sfsi_section5_options['sfsi_rss_MouseOverText']))
457
- {
458
- $alt_text = $sfsi_section5_options['sfsi_rss_MouseOverText'];
459
- }
460
- else
461
- {
462
- $alt_text = 'RSS';
463
- }
464
-
465
- //Custom Skin Support {Monad}
466
- if($active_theme == 'custom_support')
467
- {
468
- if(get_option("rss_skin"))
469
- {
470
- $icon = get_option("rss_skin");
471
- }
472
- else
473
- {
474
- $active_theme = 'default';
475
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
476
- $icon=$icons_baseUrl.$active_theme."_rss.png";
477
- }
478
- }
479
- else
480
- {
481
- $icon=$icons_baseUrl.$active_theme."_rss.png";
482
- }
483
- break;
484
-
485
- case "email" :
486
-
487
- $hoverdiv = '';
488
-
489
- $sfsi_section2_options['sfsi_email_url'];
490
-
491
- $url = (isset($sfsi_section2_options['sfsi_email_url'])) ? $sfsi_section2_options['sfsi_email_url'] : '';
492
-
493
- $toolClass = "email_tool_bdr";
494
- $arrow_class = "bot_eamil_arow";
495
-
496
- /* fecth no of counts if active in admin section */
497
- if(
498
- $sfsi_section4_options['sfsi_email_countsDisplay']=="yes" &&
499
- $sfsi_section4_options['sfsi_display_counts']=="yes"
500
- )
501
- {
502
- if($sfsi_section4_options['sfsi_email_countsFrom']=="manual")
503
- {
504
- $counts=$socialObj->format_num($sfsi_section4_options['sfsi_email_manualCounts']);
505
- }
506
- else
507
- {
508
- $counts = $socialObj->SFSI_getFeedSubscriber(sanitize_text_field(get_option('sfsi_feed_id',false)));
509
- }
510
- }
511
-
512
- if(!empty($sfsi_section5_options['sfsi_email_MouseOverText']))
513
- {
514
- $alt_text = $sfsi_section5_options['sfsi_email_MouseOverText'];
515
- }
516
- else
517
- {
518
- $alt_text = 'EMAIL';
519
- }
520
-
521
- //Custom Skin Support {Monad}
522
- if($active_theme == 'custom_support')
523
- {
524
- if(get_option("email_skin"))
525
- {
526
- $icon = get_option("email_skin");
527
- }
528
- else
529
- {
530
- $active_theme = 'default';
531
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
532
- //$icon=($sfsi_section2_options['sfsi_rss_icons']=="sfsi") ? $icons_baseUrl.$active_theme."_sf.png" : $icons_baseUrl.$active_theme."_email.png";
533
- if($sfsi_section2_options['sfsi_rss_icons']=="sfsi")
534
- {
535
- $icon = $icons_baseUrl.$active_theme."_sf.png";
536
- }
537
- elseif($sfsi_section2_options['sfsi_rss_icons']=="email")
538
- {
539
- $icon = $icons_baseUrl.$active_theme."_email.png";
540
- }
541
- else
542
- {
543
- $icon = $icons_baseUrl.$active_theme."_subscribe.png";
544
- }
545
- }
546
- }
547
- else
548
- {
549
-
550
- $rss_icons = isset($sfsi_section2_options['sfsi_rss_icons']) && !empty($sfsi_section2_options['sfsi_rss_icons']) ? $sfsi_section2_options['sfsi_rss_icons'] : false;
551
-
552
- switch ($rss_icons) {
553
-
554
- case 'email':
555
- $image = "_email.png";
556
- break;
557
-
558
- case 'subscribe':
559
- $image = "_subscribe.png";
560
- break;
561
-
562
- case 'sfsi':
563
- $image = "_sf.png";
564
- break;
565
-
566
- default:
567
- $image = "_subscribe.png";
568
- break;
569
- }
570
-
571
- $icon = $icons_baseUrl.$active_theme.$image;
572
- }
573
- break;
574
-
575
- case "facebook" :
576
-
577
- $width = 62;
578
- $totwith = $width+28+$icons_space;
579
- $twt_margin = $totwith/2;
580
- $toolClass = "fb_tool_bdr";
581
- $arrow_class = "bot_fb_arow";
582
-
583
- /* check for the over section */
584
- if(!empty($sfsi_section5_options['sfsi_facebook_MouseOverText']))
585
- {
586
- $alt_text = $sfsi_section5_options['sfsi_facebook_MouseOverText'];
587
- }
588
- else
589
- {
590
- $alt_text = "FACEBOOK";
591
- }
592
-
593
- $visit_icon = $visit_iconsUrl."facebook.png";
594
-
595
- $url = isset($sfsi_section2_options['sfsi_facebookPage_url']) && !empty($sfsi_section2_options['sfsi_facebookPage_url']) ? $sfsi_section2_options['sfsi_facebookPage_url'] : false;
596
-
597
- $url = false != $url ? $sfsi_section2_options['sfsi_facebookPage_url']:'';
598
-
599
- $like_option = isset($sfsi_section2_options['sfsi_facebookLike_option']) && !empty($sfsi_section2_options['sfsi_facebookLike_option']) ? $sfsi_section2_options['sfsi_facebookLike_option'] : false;
600
-
601
- $page_option = isset($sfsi_section2_options['sfsi_facebookPage_option']) && !empty($sfsi_section2_options['sfsi_facebookPage_option']) ? $sfsi_section2_options['sfsi_facebookPage_option'] : false;
602
-
603
- $share_option = isset($sfsi_section2_options['sfsi_facebookShare_option']) && !empty($sfsi_section2_options['sfsi_facebookShare_option']) ? $sfsi_section2_options['sfsi_facebookShare_option'] : false;
604
-
605
- if((false != $like_option && $like_option=="yes") || (false != $share_option && $share_option=="yes"))
606
- {
607
- $url=($sfsi_section2_options['sfsi_facebookPage_url']) ? $sfsi_section2_options['sfsi_facebookPage_url']:'';
608
- $hoverSHow = 1;
609
- $hoverdiv = '';
610
-
611
- if(false != $page_option && $page_option=="yes")
612
- {
613
- $hoverdiv.="<div class='icon1'><a href='".$url."' ".sfsi_checkNewWindow($url)."><img data-pin-nopin='true' alt='".$alt_text."' title='".$alt_text."' src='".$visit_icon."' /></a></div>";
614
- }
615
- if(false!= $like_option && $like_option=="yes")
616
- {
617
- $hoverdiv.="<div class='icon2'>".$socialObj->sfsi_FBlike($current_url)."</div>";
618
- }
619
- if(false!= $share_option && $share_option=="yes")
620
- {
621
- $hoverdiv.="<div class='icon3'>".$socialObj->sfsiFB_Share($current_url)."</div>";
622
- }
623
-
624
- }
625
-
626
- /* fecth no of counts if active in admin section */
627
- if(
628
- $sfsi_section4_options['sfsi_facebook_countsDisplay']=="yes" &&
629
- $sfsi_section4_options['sfsi_display_counts']=="yes"
630
- )
631
- {
632
- if($sfsi_section4_options['sfsi_facebook_countsFrom']=="manual")
633
- {
634
- $counts=$socialObj->format_num($sfsi_section4_options['sfsi_facebook_manualCounts']);
635
- }
636
- else if($sfsi_section4_options['sfsi_facebook_countsFrom']=="likes")
637
- {
638
- $fb_data=$socialObj->sfsi_get_fb($current_url);
639
- $counts=$socialObj->format_num($fb_data['like_count']);
640
- if(empty($counts))
641
- {
642
- $counts=(string) "0";
643
- }
644
- }
645
- else if($sfsi_section4_options['sfsi_facebook_countsFrom']=="followers")
646
- {
647
- $fb_data=$socialObj->sfsi_get_fb($current_url);
648
- $counts=$socialObj->format_num($fb_data['share_count']);
649
-
650
- }
651
- else if($sfsi_section4_options['sfsi_facebook_countsFrom']=="mypage")
652
- {
653
- $current_url = $sfsi_section4_options['sfsi_facebook_mypageCounts'];
654
- $fb_data=$socialObj->sfsi_get_fb_pagelike($current_url);
655
- $counts=$socialObj->format_num($fb_data);
656
- }
657
- }
658
-
659
- //Custom Skin Support {Monad}
660
- if($active_theme == 'custom_support')
661
- {
662
- if(get_option("facebook_skin"))
663
- {
664
- $icon = get_option("facebook_skin");
665
- }
666
- else
667
- {
668
- $active_theme = 'default';
669
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
670
- $icon=$icons_baseUrl.$active_theme."_facebook.png";
671
- }
672
- }
673
- else
674
- {
675
- $icon=$icons_baseUrl.$active_theme."_facebook.png";
676
- }
677
- break;
678
- case "twitter" :
679
- $toolClass = "twt_tool_bdr";
680
- $arrow_class = "bot_twt_arow";
681
-
682
- $url = isset($sfsi_section2_options['sfsi_twitter_pageURL']) && !empty($sfsi_section2_options['sfsi_twitter_pageURL']) ? $sfsi_section2_options['sfsi_twitter_pageURL'] : '';
683
-
684
- $twitter_user = isset($sfsi_section2_options['sfsi_twitter_followUserName']) && !empty($sfsi_section2_options['sfsi_twitter_followUserName']) ? $sfsi_section2_options['sfsi_twitter_followUserName'] : false;
685
-
686
- $twitter_text = isset($sfsi_section2_options['sfsi_twitter_aboutPageText']) && !empty($sfsi_section2_options['sfsi_twitter_aboutPageText']) ? $sfsi_section2_options['sfsi_twitter_aboutPageText'] : false;
687
-
688
- $visit_icon = $visit_iconsUrl."twitter.png";
689
-
690
- $width = 59;
691
- $totwith = $width+28+$icons_space;
692
- $twt_margin = $totwith/2;
693
- /* check for icons to display */
694
- $hoverdiv='';
695
-
696
- $follow_me = isset($sfsi_section2_options['sfsi_twitter_followme']) && !empty($sfsi_section2_options['sfsi_twitter_followme']) ? $sfsi_section2_options['sfsi_twitter_followme'] : false;
697
-
698
- $about_page = isset($sfsi_section2_options['sfsi_twitter_aboutPage']) && !empty($sfsi_section2_options['sfsi_twitter_aboutPage']) ? $sfsi_section2_options['sfsi_twitter_aboutPage'] : false;
699
-
700
- if($follow_me=="yes" ||$about_page=="yes")
701
- {
702
- $hoverSHow=1;
703
- //Visit twitter page {Monad}
704
- if(isset($sfsi_section2_options['sfsi_twitter_page']) && !empty($sfsi_section2_options['sfsi_twitter_page']) && $sfsi_section2_options['sfsi_twitter_page']=="yes")
705
- {
706
- $hoverdiv.="<div class='cstmicon1'><a href='".$url."' ".sfsi_checkNewWindow($url)."><img data-pin-nopin='true' alt='Visit Us' title='Visit Us' src='".$visit_icon."' /></a></div>";
707
- }
708
- if($follow_me=="yes" && !empty($twitter_user))
709
- {
710
- $hoverdiv.="<div class='icon1'>".$socialObj->sfsi_twitterFollow($twitter_user)."</div>";
711
- }
712
- if($about_page=="yes")
713
- {
714
- $hoverdiv.="<div class='icon2'>".$socialObj->sfsi_twitterShare($current_url,$twitter_text)."</div>";
715
- }
716
-
717
- }
718
-
719
- /* fecth no of counts if active in admin section */
720
- if(
721
- $sfsi_section4_options['sfsi_twitter_countsDisplay']=="yes" &&
722
- $sfsi_section4_options['sfsi_display_counts']=="yes"
723
- )
724
- {
725
- if($sfsi_section4_options['sfsi_twitter_countsFrom']=="manual")
726
- {
727
- $counts = $socialObj->format_num($sfsi_section4_options['sfsi_twitter_manualCounts']);
728
- }
729
- else if($sfsi_section4_options['sfsi_twitter_countsFrom']=="source")
730
- {
731
- $tw_settings = array('tw_consumer_key'=>$sfsi_section4_options['tw_consumer_key'],
732
- 'tw_consumer_secret'=> $sfsi_section4_options['tw_consumer_secret'],
733
- 'tw_oauth_access_token'=> $sfsi_section4_options['tw_oauth_access_token'],
734
- 'tw_oauth_access_token_secret'=> $sfsi_section4_options['tw_oauth_access_token_secret']);
735
-
736
- $followers = $socialObj->sfsi_get_tweets($twitter_user,$tw_settings);
737
- $counts = $socialObj->format_num($followers);
738
- if(empty($counts))
739
- {
740
- $counts=(string) "0";
741
- }
742
- }
743
- }
744
-
745
- //Giving alternative text to image
746
- if(!empty($sfsi_section5_options['sfsi_twitter_MouseOverText']))
747
- {
748
- $alt_text = $sfsi_section5_options['sfsi_twitter_MouseOverText'];
749
- }
750
- else
751
- {
752
- $alt_text = "TWITTER";
753
- }
754
-
755
- //Custom Skin Support {Monad}
756
- if($active_theme == 'custom_support')
757
- {
758
- if(get_option("twitter_skin"))
759
- {
760
- $icon = get_option("twitter_skin");
761
- }
762
- else
763
- {
764
- $active_theme = 'default';
765
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
766
- $icon=$icons_baseUrl.$active_theme."_twitter.png";
767
- }
768
- }
769
- else
770
- {
771
- $icon=$icons_baseUrl.$active_theme."_twitter.png";
772
- }
773
- break;
774
-
775
- case "youtube" :
776
- $toolClass = "utube_tool_bdr";
777
- $arrow_class = "bot_utube_arow";
778
- $width = 96;
779
- $totwith = $width+28+$icons_space;
780
- $twt_margin = $totwith/2;
781
- $youtube_user = (isset($sfsi_section4_options['sfsi_youtube_user']) && !empty($sfsi_section4_options['sfsi_youtube_user'])) ? $sfsi_section4_options['sfsi_youtube_user'] : 'SpecificFeeds';
782
- $visit_icon = $visit_iconsUrl."youtube.png";
783
-
784
- $url = isset($sfsi_section2_options['sfsi_youtube_pageUrl']) && !empty($sfsi_section2_options['sfsi_youtube_pageUrl']) ? $sfsi_section2_options['sfsi_youtube_pageUrl'] : '';
785
-
786
- //Giving alternative text to image
787
- if(!empty($sfsi_section5_options['sfsi_youtube_MouseOverText']))
788
- {
789
- $alt_text = $sfsi_section5_options['sfsi_youtube_MouseOverText'];
790
- }
791
- else
792
- {
793
- $alt_text = "YOUTUBE";
794
- }
795
-
796
- /* check for icons to display */
797
- $hoverdiv="";
798
-
799
- $follow = isset($sfsi_section2_options['sfsi_youtube_follow']) && !empty($sfsi_section2_options['sfsi_youtube_follow']) ? $sfsi_section2_options['sfsi_youtube_follow'] : false;
800
-
801
- $ypage = isset($sfsi_section2_options['sfsi_youtube_page']) && !empty($sfsi_section2_options['sfsi_youtube_page']) ? $sfsi_section2_options['sfsi_youtube_page'] : false;
802
-
803
- if(false != $follow && $follow=="yes")
804
- {
805
- $hoverSHow = 1;
806
-
807
- if($ypage =="yes")
808
- {
809
- $hoverdiv.="<div class='icon1'><a href='".$url."' ".sfsi_checkNewWindow($url)."><img data-pin-nopin='true' alt='".$alt_text."' title='".$alt_text."' src='".$visit_icon."' /></a></div>";
810
- }
811
- if($follow =="yes")
812
- {
813
- $hoverdiv.="<div class='icon2'>".$socialObj->sfsi_YouTubeSub($youtube_user)."</div>";
814
- }
815
- }
816
-
817
- /* fecth no of counts if active in admin section */
818
- if(
819
- $sfsi_section4_options['sfsi_youtube_countsDisplay']=="yes" &&
820
- $sfsi_section4_options['sfsi_display_counts']=="yes"
821
- )
822
- {
823
- if($sfsi_section4_options['sfsi_youtube_countsFrom']=="manual")
824
- {
825
- $counts = $socialObj->format_num($sfsi_section4_options['sfsi_youtube_manualCounts']);
826
- }
827
- else if($sfsi_section4_options['sfsi_youtube_countsFrom']=="subscriber")
828
- {
829
- $followers = $socialObj->sfsi_get_youtube($youtube_user);
830
- $counts = $socialObj->format_num($followers);
831
- if(empty($counts))
832
- {
833
- $counts = (string) "0";
834
- }
835
- }
836
- }
837
-
838
- //Custom Skin Support {Monad}
839
- if($active_theme == 'custom_support')
840
- {
841
- if(get_option("youtube_skin"))
842
- {
843
- $icon = get_option("youtube_skin");
844
- }
845
- else
846
- {
847
- $active_theme = 'default';
848
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
849
- $icon=$icons_baseUrl.$active_theme."_youtube.png";
850
- }
851
- }
852
- else
853
- {
854
- $icon=$icons_baseUrl.$active_theme."_youtube.png";
855
- }
856
- break;
857
-
858
- case "pinterest" :
859
-
860
- $width = 73;
861
- $totwith = $width+28+$icons_space;
862
- $twt_margin = $totwith/2;
863
- $toolClass = "printst_tool_bdr";
864
- $arrow_class = "bot_pintst_arow";
865
-
866
- $pinterest_user = (isset($sfsi_section4_options['sfsi_pinterest_user']))
867
- ? $sfsi_section4_options['sfsi_pinterest_user'] : '';
868
- $pinterest_board = (isset($sfsi_section4_options['sfsi_pinterest_board']))
869
- ? $sfsi_section4_options['sfsi_pinterest_board'] : '';
870
-
871
- $visit_icon = $visit_iconsUrl."pinterest.png";
872
- $url = (isset($sfsi_section2_options['sfsi_pinterest_pageUrl'])) ? $sfsi_section2_options['sfsi_pinterest_pageUrl'] : '';
873
-
874
- //Giving alternative text to image
875
- if(isset($sfsi_section5_options['sfsi_pinterest_MouseOverText']) && !empty($sfsi_section5_options['sfsi_pinterest_MouseOverText']))
876
- {
877
- $alt_text = $sfsi_section5_options['sfsi_pinterest_MouseOverText'];
878
- }
879
- else
880
- {
881
- $alt_text = "PINTEREST";
882
- }
883
-
884
- /* check for icons to display */
885
- $hoverdiv="";
886
-
887
- $pingblog = isset($sfsi_section2_options['sfsi_pinterest_pingBlog']) && !empty($sfsi_section2_options['sfsi_pinterest_pingBlog']) ? $sfsi_section2_options['sfsi_pinterest_pingBlog'] : false;
888
-
889
- $page = isset($sfsi_section2_options['sfsi_pinterest_page']) && !empty($sfsi_section2_options['sfsi_pinterest_page']) ? $sfsi_section2_options['sfsi_pinterest_page'] : false;
890
-
891
- $cDisplay = isset($sfsi_section4_options['sfsi_pinterest_countsDisplay']) && !empty($sfsi_section4_options['sfsi_pinterest_countsDisplay']) ? $sfsi_section4_options['sfsi_pinterest_countsDisplay'] : false;
892
-
893
- $displayC = isset($sfsi_section4_options['sfsi_display_counts']) && !empty($sfsi_section4_options['sfsi_display_counts']) ? $sfsi_section4_options['sfsi_display_counts'] : false;
894
-
895
- $cFrom = isset($sfsi_section4_options['sfsi_pinterest_countsFrom']) && !empty($sfsi_section4_options['sfsi_pinterest_countsFrom']) ? $sfsi_section4_options['sfsi_pinterest_countsFrom'] : false;
896
- // var_dump($sfsi_section4_options['sfsi_pinterest_countsFrom'],$cFrom);die();
897
-
898
- if($pingblog=="yes" )
899
- {
900
- $hoverSHow = 1;
901
-
902
- if($page =="yes")
903
- {
904
- $hoverdiv.="<div class='icon1'><a href='".$url."' ".sfsi_checkNewWindow($url)."><img data-pin-nopin='true' alt='".$alt_text."' title='".$alt_text."' src='".$visit_icon."' /></a></div>";
905
- }
906
- if($pingblog=="yes")
907
- {
908
- $hoverdiv.="<div class='icon2'>".$socialObj->sfsi_PinIt($current_url)."</div>";
909
- }
910
- }
911
-
912
- /* fecth no of counts if active in admin section */
913
- if($cDisplay == "yes" && $displayC=="yes")
914
- {
915
- if($cFrom=="manual")
916
- {
917
- $counts = $socialObj->format_num($sfsi_section4_options['sfsi_pinterest_manualCounts']);
918
- }
919
- else if($cFrom=="pins")
920
- {
921
- $pins = $socialObj->sfsi_get_pinterest($current_url);
922
- $counts = $pins;
923
- if(empty($counts))
924
- {
925
- $counts=(string) "0";
926
- }
927
- }
928
- }
929
-
930
- //Custom Skin Support {Monad}
931
- if($active_theme == 'custom_support')
932
- {
933
- if(get_option("pintrest_skin"))
934
- {
935
- $icon = get_option("pintrest_skin");
936
- }
937
- else
938
- {
939
- $active_theme = 'default';
940
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
941
- $icon = $icons_baseUrl.$active_theme."_pinterest.png";
942
- }
943
- }
944
- else
945
- {
946
- $icon=$icons_baseUrl.$active_theme."_pinterest.png";
947
- }
948
- break;
949
-
950
- case "instagram" :
951
- $toolClass = "instagram_tool_bdr";
952
- $arrow_class = "bot_pintst_arow";
953
-
954
- $url = (isset($sfsi_section2_options['sfsi_instagram_pageUrl'])) ? $sfsi_section2_options['sfsi_instagram_pageUrl'] : '';
955
-
956
- $instagram_user_name = isset($sfsi_section4_options['sfsi_instagram_User']) && !empty($sfsi_section4_options['sfsi_instagram_User']) ? $sfsi_section4_options['sfsi_instagram_User'] : false;
957
-
958
- //Giving alternative text to image
959
- if(isset($sfsi_section5_options['sfsi_instagram_MouseOverText']) && !empty($sfsi_section5_options['sfsi_instagram_MouseOverText']))
960
- {
961
- $alt_text = $sfsi_section5_options['sfsi_instagram_MouseOverText'];
962
- }
963
- else
964
- {
965
- $alt_text = "INSTAGRAM";
966
- }
967
-
968
- $hoverdiv="";
969
-
970
- $cDisplay = isset($sfsi_section4_options['sfsi_instagram_countsDisplay']) && !empty($sfsi_section4_options['sfsi_instagram_countsDisplay']) ? $sfsi_section4_options['sfsi_instagram_countsDisplay']: false;
971
-
972
- $Displayc = isset($sfsi_section4_options['sfsi_display_counts']) && !empty($sfsi_section4_options['sfsi_display_counts']) ? $sfsi_section4_options['sfsi_display_counts']: false;
973
-
974
- $cFrom = isset($sfsi_section4_options['sfsi_instagram_countsFrom']) && !empty($sfsi_section4_options['sfsi_instagram_countsFrom']) ? $sfsi_section4_options['sfsi_instagram_countsFrom']: false;
975
-
976
- /* fecth no of counts if active in admin section */
977
- if($cDisplay=="yes" && $Displayc=="yes")
978
- {
979
- if($cFrom=="manual")
980
- {
981
- $counts = $socialObj->format_num($sfsi_section4_options['sfsi_instagram_manualCounts']);
982
- }
983
- else if($cFrom=="followers")
984
- {
985
- $counts = $socialObj->sfsi_get_instagramFollowers($instagram_user_name);
986
- if(empty($counts))
987
- {
988
- $counts=(string) "0";
989
- }
990
- }
991
- }
992
-
993
- //Custom Skin Support {Monad}
994
- if($active_theme == 'custom_support')
995
- {
996
- if(get_option("instagram_skin"))
997
- {
998
- $icon = get_option("instagram_skin");
999
- }
1000
- else
1001
- {
1002
- $active_theme = 'default';
1003
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
1004
- $icon=$icons_baseUrl.$active_theme."_instagram.png";
1005
- }
1006
- }
1007
- else
1008
- {
1009
- $icon=$icons_baseUrl.$active_theme."_instagram.png";
1010
- }
1011
- break;
1012
-
1013
- case "telegram" :
1014
- $toolClass = "telegram_tool_bdr";
1015
- $arrow_class = "bot_pintst_arow";
1016
- $hoverdiv = '';
1017
-
1018
- // $url = (isset($sfsi_section4_options['sfsi_telegram_pageURL'])) ? $sfsi_section4_options['sfsi_telegram_pageURL'] : '';
1019
-
1020
- // $telegram_user_name = isset($sfsi_section4_options['sfsi_telegram_User']) && !empty($sfsi_section4_options['sfsi_telegram_User']) ? $sfsi_section4_options['sfsi_telegram_User'] : false;
1021
-
1022
- //Giving alternative text to image
1023
- if(isset($sfsi_section5_options['sfsi_telegram_MouseOverText']) && !empty($sfsi_section5_options['sfsi_telegram_MouseOverText']))
1024
- {
1025
- $alt_text = $sfsi_section5_options['sfsi_telegram_MouseOverText'];
1026
-
1027
- }
1028
- else
1029
- {
1030
- $alt_text = "telegram";
1031
- }
1032
- $messageus_icon = $visit_iconsUrl.$icon_name."_message.svg";
1033
- $hoverdiv="";
1034
- $cDisplay = isset($sfsi_section4_options['sfsi_telegram_countsDisplay']) && !empty($sfsi_section4_options['sfsi_telegram_countsDisplay']) ? $sfsi_section4_options['sfsi_telegram_countsDisplay']: false;
1035
-
1036
- $Displayc = isset($sfsi_section4_options['sfsi_display_counts']) && !empty($sfsi_section4_options['sfsi_display_counts']) ? $sfsi_section4_options['sfsi_display_counts']: false;
1037
- /* fecth no of counts if active in admin section */
1038
- if($cDisplay=="yes" && $Displayc=="yes")
1039
- {
1040
-
1041
- $counts = $socialObj->format_num($sfsi_section4_options['sfsi_telegram_manualCounts']);
1042
- }
1043
-
1044
- //Custom Skin Support {Monad}
1045
- if($active_theme == 'custom_support')
1046
- {
1047
- if(get_option("telegram_skin"))
1048
- {
1049
- $icon = get_option("telegram_skin");
1050
- }
1051
- else
1052
- {
1053
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
1054
- $icon=$icons_baseUrl."default_telegram.png";
1055
- }
1056
- }
1057
- else
1058
- {
1059
- $icon=$icons_baseUrl.$active_theme."_telegram.png";
1060
- }
1061
- if(
1062
- isset($sfsi_section2_options['sfsi_telegram_message']) && !empty($sfsi_section2_options['sfsi_telegram_message'])
1063
- &&
1064
- isset($sfsi_section2_options['sfsi_telegram_username']) && !empty($sfsi_section2_options['sfsi_telegram_username'])
1065
-
1066
- ){
1067
- $tg_username = $sfsi_section2_options['sfsi_telegram_username'];
1068
- $tg_msg = stripslashes($sfsi_section2_options['sfsi_telegram_message']);
1069
- $tg_msg = str_replace('"', '', str_replace("'", '', $tg_msg));
1070
- $tg_msg = html_entity_decode(strip_tags($tg_msg), ENT_QUOTES,'UTF-8');
1071
- $tg_msg = str_replace("%26%238230%3B", "...", $tg_msg);
1072
- $tg_msg = rawurlencode($tg_msg);
1073
-
1074
- $tele_url = "https://t.me/".$tg_username;
1075
- $url = $tele_url."?&text=".urlencode($tg_msg);
1076
- // var_dump($url);
1077
- // die();
1078
- // file_get_contents($url);
1079
- }else{
1080
- $url="#";
1081
- $sfsi_onclick="event.preventDefault();";
1082
- }
1083
- if($active_theme=="glossy"){
1084
- $sfsi_new_icons = "yes";
1085
- }
1086
- break;
1087
- case "vk" :
1088
- $toolClass = "vk_tool_bdr";
1089
- $arrow_class = "bot_pintst_arow";
1090
-
1091
- $url = (isset($sfsi_section2_options['sfsi_vk_pageURL'])) ? $sfsi_section2_options['sfsi_vk_pageURL'] : '';
1092
-
1093
- // $vk_user_name = isset($sfsi_section4_options['sfsi_vk_User']) && !empty($sfsi_section4_options['sfsi_vk_User']) ? $sfsi_section4_options['sfsi_vk_User'] : false;
1094
-
1095
- //Giving alternative text to image
1096
- if(isset($sfsi_section5_options['sfsi_vk_MouseOverText']) && !empty($sfsi_section5_options['sfsi_vk_MouseOverText']))
1097
- {
1098
- $alt_text = $sfsi_section5_options['sfsi_vk_MouseOverText'];
1099
- }
1100
- else
1101
- {
1102
- $alt_text = "vk";
1103
- }
1104
-
1105
- $hoverdiv="";
1106
-
1107
- $cDisplay = isset($sfsi_section4_options['sfsi_vk_countsDisplay']) && !empty($sfsi_section4_options['sfsi_vk_countsDisplay']) ? $sfsi_section4_options['sfsi_vk_countsDisplay']: false;
1108
-
1109
- $Displayc = isset($sfsi_section4_options['sfsi_display_counts']) && !empty($sfsi_section4_options['sfsi_display_counts']) ? $sfsi_section4_options['sfsi_display_counts']: false;
1110
-
1111
- /* fecth no of counts if active in admin section */
1112
- if($cDisplay=="yes" && $Displayc=="yes")
1113
- {
1114
- $counts = $socialObj->format_num($sfsi_section4_options['sfsi_vk_manualCounts']);
1115
- }
1116
-
1117
- //Custom Skin Support {Monad}
1118
- if($active_theme == 'custom_support')
1119
- {
1120
- if(get_option("vk_skin"))
1121
- {
1122
- $icon = get_option("vk_skin");
1123
- }
1124
- else
1125
- {
1126
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
1127
- $icon=$icons_baseUrl."default_vk.png";
1128
- }
1129
- }
1130
- else
1131
- {
1132
- $icon=$icons_baseUrl.$active_theme."_vk.png";
1133
- }
1134
- if($active_theme=="glossy"){
1135
- $sfsi_new_icons = "yes";
1136
- }
1137
-
1138
- break;
1139
- case "ok" :
1140
- $toolClass = "ok_tool_bdr";
1141
- $arrow_class = "bot_pintst_arow";
1142
-
1143
- $url = (isset($sfsi_section2_options['sfsi_ok_pageURL'])) ? $sfsi_section2_options['sfsi_ok_pageURL'] : '';
1144
-
1145
- // $ok_user_name = isset($sfsi_section4_options['sfsi_ok_User']) && !empty($sfsi_section4_options['sfsi_ok_User']) ? $sfsi_section4_options['sfsi_ok_User'] : false;
1146
-
1147
- //Giving alternative text to image
1148
- if(isset($sfsi_section5_options['sfsi_ok_MouseOverText']) && !empty($sfsi_section5_options['sfsi_ok_MouseOverText']))
1149
- {
1150
- $alt_text = $sfsi_section5_options['sfsi_ok_MouseOverText'];
1151
- }
1152
- else
1153
- {
1154
- $alt_text = "ok";
1155
- }
1156
-
1157
- $hoverdiv="";
1158
-
1159
- $cDisplay = isset($sfsi_section4_options['sfsi_ok_countsDisplay']) && !empty($sfsi_section4_options['sfsi_ok_countsDisplay']) ? $sfsi_section4_options['sfsi_ok_countsDisplay']: false;
1160
-
1161
- $Displayc = isset($sfsi_section4_options['sfsi_display_counts']) && !empty($sfsi_section4_options['sfsi_display_counts']) ? $sfsi_section4_options['sfsi_display_counts']: false;
1162
- /* fecth no of counts if active in admin section */
1163
- if($cDisplay=="yes" && $Displayc=="yes")
1164
- {
1165
- $counts = $socialObj->format_num($sfsi_section4_options['sfsi_ok_manualCounts']);
1166
- }
1167
-
1168
- //Custom Skin Support {Monad}
1169
- if($active_theme == 'custom_support')
1170
- {
1171
- if(get_option("ok_skin"))
1172
- {
1173
- $icon = get_option("ok_skin");
1174
- }
1175
- else
1176
- {
1177
-
1178
- $icons_baseUrl = SFSI_PLUGURL."images/icons_theme/default/";
1179
- $icon=$icons_baseUrl."default_ok.png";
1180
- }
1181
- }
1182
- else
1183
- {
1184
- $icon=$icons_baseUrl.$active_theme."_ok.png";
1185
- }
1186
- if($active_theme=="glossy"){
1187
- $sfsi_new_icons = "yes";
1188
- }
1189
-
1190
- break;
1191
- case "weibo" :
1192
- $toolClass = "weibo_tool_bdr";
1193
- $arrow_class = "bot_pintst_arow";
1194
-
1195
- $url = (isset($sfsi_section2_options['sfsi_weibo_pageURL'])) ? $sfsi_section2_options['sfsi_weibo_pageURL'] : '';
1196
-
1197
- // $weibo_user_name = isset($sfsi_section4_options['sfsi_weibo_User']) && !empty($sfsi_section4_options['sfsi_weibo_User']) ? $sfsi_section4_options['sfsi_weibo_User'] : false;
1198
-
1199
- //Giving alternative text to image
1200
- if(isset($sfsi_section5_options['sfsi_weibo_MouseOverText']) && !empty($sfsi_section5_options['sfsi_weibo_MouseOverText']))
1201
- {
1202
- $alt_text = $sfsi_section5_options['sfsi_weibo_MouseOverText'];
1203
- }
1204