-
Notifications
You must be signed in to change notification settings - Fork 136
/
Copy pathaddthis-js.phtml
41 lines (40 loc) · 1.35 KB
/
addthis-js.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* Copyright © Magefan ([email protected]). All rights reserved.
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
*
* Glory to Ukraine! Glory to the heroes!
*/
?>
<?php
/**
* @var $block \Magefan\Blog\Block\Social\AddThis
* @var $mfSecureRenderer \Magefan\Community\Api\SecureHtmlRendererInterface
*/
?>
<?php $script = "
function mfShareWindowOpen(url, type, image) {
function reverse(s){
return s.split('').reverse().join('');
}
var u;
switch (type) {
case 'facebook':
u = reverse('" . strrev('https://www.facebook.com/sharer/sharer.php?u=') . "') + url;
break;
case 'pinterest':
u = reverse('" . strrev('https://pinterest.com/pin/create/button/?url=') . "') + url + '&media='+ image;
break;
case 'twitter':
u =reverse('" . strrev('http://twitter.com/share?url=') . "') + url;
break;
case 'linkedin':
u =reverse('" . strrev('https://www.linkedin.com/sharing/share-offsite/?url=') . "') + url;
break;
}
if (u) {
window.open (u, null, 'width=600,height=400');
}
}
"; ?>
<?= /* @noEscape */ $mfSecureRenderer->renderTag('script', [], $script, false) ?>