Version Description
- new support for the "AMP for WP" plugin by Ahmed and Mohammed Kaludi
- improved support for the "AMP for WordPress" plugin by Automattic
- new additional workaround for servers without $_SERVER for category pages
- minor bug fixes
Download this release
Release Info
Developer | starguide |
Plugin | Shariff Wrapper |
Version | 4.4.2 |
Comparing to | |
See all releases |
Code changes from version 4.3.0 to 4.4.2
- admin/admin-menu.php +2093 -0
- admin/admin-metabox.php +162 -0
- admin/admin-notices.php +55 -0
- admin/admin_menu.php +0 -1757
- admin/admin_metabox.php +0 -143
- admin/admin_notices.php +0 -73
- bitcoin.php +22 -17
- changelog.txt +594 -551
- css/shariff.css +360 -340
- css/shariff.min.css +1 -1
- {pictos → images}/borderradius.png +0 -0
- {pictos → images}/colorBtns.png +0 -0
- {pictos → images}/defaultBtns.png +0 -0
- {pictos → images}/defaultHint.png +0 -0
- {pictos → images}/greyBtns.png +0 -0
- {pictos → images}/roundBtns.png +0 -0
- {pictos → images}/whiteBtns.png +0 -0
- includes/class-shariff-widget.php +178 -0
- phpqrcode.php → includes/phpqrcode.php +7 -7
- js/shariff-media.js +20 -20
- js/shariff-media.min.js +1 -0
- js/shariff-notice.js +0 -9
- js/shariff-popup.js +29 -30
- js/shariff-popup.min.js +1 -1
- js/shariff.js +100 -100
- js/shariff.min.js +1 -1
- license.txt +47 -47
- locale/mailform-DE.php +0 -36
- locale/mailform-EN.php +0 -36
- locale/mailform-FR.php +0 -37
- locale/mailform-IT.php +0 -36
- readme.txt +340 -304
- services/shariff-addthis.php +70 -67
- services/shariff-bitcoin.php +29 -20
- services/shariff-diaspora.php +42 -13
- services/shariff-facebook.php +102 -96
- services/shariff-flattr.php +71 -66
- services/shariff-flipboard.php +59 -0
- services/shariff-googleplus.php +59 -94
- services/shariff-info.php +70 -46
- services/shariff-linkedin.php +97 -93
- services/shariff-mailform.php +0 -83
- services/shariff-mailto.php +26 -19
- services/shariff-mastodon.php +56 -0
- services/shariff-odnoklassniki.php +71 -69
- services/shariff-patreon.php +28 -19
- services/shariff-paypal.php +29 -20
- services/shariff-paypalme.php +29 -20
- services/shariff-pinterest.php +121 -87
- services/shariff-pocket.php +42 -55
- services/shariff-printer.php +26 -18
- services/shariff-qzone.php +56 -0
- services/shariff-reddit.php +74 -54
- services/shariff-rss.php +43 -34
- services/shariff-sms.php +59 -0
- services/shariff-stumbleupon.php +74 -55
- services/shariff-telegram.php +60 -0
- services/shariff-tencentweibo.php +56 -0
- services/shariff-threema.php +23 -16
- services/shariff-tumblr.php +57 -54
- services/shariff-twitter.php +92 -78
- services/shariff-vk.php +27 -25
- services/shariff-wallabag.php +39 -0
- services/shariff-weibo.php +56 -0
- services/shariff-whatsapp.php +59 -52
- services/shariff-xing.php +86 -83
- shariff.php +949 -1219
- uninstall.php +50 -25
- updates.php +363 -340
admin/admin-menu.php
ADDED
@@ -0,0 +1,2093 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when an admin is logged in.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
* @subpackage admin
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Prevent direct calls to admin_menu.php.
|
10 |
+
if ( ! class_exists( 'WP' ) ) {
|
11 |
+
die();
|
12 |
+
}
|
13 |
+
|
14 |
+
// Set services that have a share count API / backend.
|
15 |
+
$shariff3uu_services_backend = array( 'facebook', 'twitter', 'pinterest', 'linkedin', 'xing', 'reddit', 'stumbleupon', 'tumblr', 'vk', 'addthis', 'flattr', 'odnoklassniki' );
|
16 |
+
|
17 |
+
|
18 |
+
// Adds the actions for the admin page.
|
19 |
+
add_action( 'admin_menu', 'shariff3uu_add_admin_menu' );
|
20 |
+
add_action( 'admin_init', 'shariff3uu_options_init' );
|
21 |
+
add_action( 'init', 'shariff_init_locale' );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Scripts and styles for admin pages e.g. info notice.
|
25 |
+
*
|
26 |
+
* @param string $hook The calling hook.
|
27 |
+
*/
|
28 |
+
function shariff3uu_admin_style( $hook ) {
|
29 |
+
// Scripts only needed on our plugin options page - no need to load them on _ALL_ admin pages.
|
30 |
+
if ( 'settings_page_shariff3uu' === $hook ) {
|
31 |
+
// Scripts for pinterest default image media uploader.
|
32 |
+
wp_enqueue_media();
|
33 |
+
wp_register_script( 'shariff_mediaupload', plugins_url( '../js/shariff-media.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
34 |
+
$translation_array = array(
|
35 |
+
'choose_image' => __( 'Choose image', 'shariff' ),
|
36 |
+
);
|
37 |
+
wp_localize_script( 'shariff_mediaupload', 'shariff_media', $translation_array );
|
38 |
+
wp_enqueue_script( 'shariff_mediaupload' );
|
39 |
+
}
|
40 |
+
}
|
41 |
+
add_action( 'admin_enqueue_scripts', 'shariff3uu_admin_style' );
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Adds the admin menu.
|
45 |
+
*/
|
46 |
+
function shariff3uu_add_admin_menu() {
|
47 |
+
add_options_page( 'Shariff', 'Shariff', 'manage_options', 'shariff3uu', 'shariff3uu_options_page' );
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Creates the plugin options page.
|
52 |
+
*/
|
53 |
+
function shariff3uu_options_init() {
|
54 |
+
|
55 |
+
/** First tab - basic */
|
56 |
+
|
57 |
+
// Registers first tab (basic) settings and calls sanitize function.
|
58 |
+
register_setting( 'basic', 'shariff3uu_basic', 'shariff3uu_basic_sanitize' );
|
59 |
+
|
60 |
+
// First tab - basic options.
|
61 |
+
add_settings_section( 'shariff3uu_basic_section', __( 'Basic options', 'shariff' ),
|
62 |
+
'shariff3uu_basic_section_callback', 'basic' );
|
63 |
+
|
64 |
+
// Services.
|
65 |
+
add_settings_field( 'shariff3uu_text_services', '<div style="width:450px">' . esc_html__( 'Enable the following services in the provided order:', 'shariff' ) . '</div>',
|
66 |
+
'shariff3uu_text_services_render', 'basic', 'shariff3uu_basic_section' );
|
67 |
+
|
68 |
+
// Add after.
|
69 |
+
add_settings_field( 'shariff3uu_multiplecheckbox_add_after', __( 'Add the Shariff buttons <u>after</u> all:', 'shariff' ),
|
70 |
+
'shariff3uu_multiplecheckbox_add_after_render', 'basic', 'shariff3uu_basic_section' );
|
71 |
+
|
72 |
+
// Add before.
|
73 |
+
add_settings_field( 'shariff3uu_checkbox_add_before', __( 'Add the Shariff buttons <u>before</u> all:', 'shariff' ),
|
74 |
+
'shariff3uu_multiplecheckbox_add_before_render', 'basic', 'shariff3uu_basic_section' );
|
75 |
+
|
76 |
+
// Disable on protected posts.
|
77 |
+
add_settings_field( 'shariff3uu_checkbox_disable_on_protected', __( 'Disable the Shariff buttons on password protected posts.', 'shariff' ),
|
78 |
+
'shariff3uu_checkbox_disable_on_protected_render', 'basic', 'shariff3uu_basic_section' );
|
79 |
+
|
80 |
+
// Disable outside of loop.
|
81 |
+
add_settings_field( 'shariff3uu_checkbox_disable_outside_loop', __( 'Disable the Shariff buttons outside of the main loop.', 'shariff' ),
|
82 |
+
'shariff3uu_checkbox_disable_outside_loop_render', 'basic', 'shariff3uu_basic_section' );
|
83 |
+
|
84 |
+
/** Second tab - design */
|
85 |
+
|
86 |
+
// Registers second tab (design) settings and calls sanitize function.
|
87 |
+
register_setting( 'design', 'shariff3uu_design', 'shariff3uu_design_sanitize' );
|
88 |
+
|
89 |
+
// Second tab - design options.
|
90 |
+
add_settings_section( 'shariff3uu_design_section', __( 'Design options', 'shariff' ),
|
91 |
+
'shariff3uu_design_section_callback', 'design' );
|
92 |
+
|
93 |
+
// Button language.
|
94 |
+
add_settings_field( 'shariff3uu_select_language', '<div style="width:450px">' . esc_html__( 'Shariff button language:', 'shariff' ) . '</div>',
|
95 |
+
'shariff3uu_select_language_render', 'design', 'shariff3uu_design_section' );
|
96 |
+
|
97 |
+
// Theme.
|
98 |
+
add_settings_field( 'shariff3uu_radio_theme', __( 'Shariff button design:', 'shariff' ),
|
99 |
+
'shariff3uu_radio_theme_render', 'design', 'shariff3uu_design_section' );
|
100 |
+
|
101 |
+
// Button size.
|
102 |
+
add_settings_field( 'shariff3uu_checkbox_buttonsize', __( 'Button size:', 'shariff' ),
|
103 |
+
'shariff3uu_checkbox_buttonsize_render', 'design', 'shariff3uu_design_section' );
|
104 |
+
|
105 |
+
// Button stretch.
|
106 |
+
add_settings_field( 'shariff3uu_checkbox_buttonsstretch', __( 'Stretch buttons horizontally to full width.', 'shariff' ),
|
107 |
+
'shariff3uu_checkbox_buttonstretch_render', 'design', 'shariff3uu_design_section' );
|
108 |
+
|
109 |
+
// Border radius.
|
110 |
+
add_settings_field( 'shariff3uu_number_borderradius', __( 'Border radius for the round theme (1-50):', 'shariff' ),
|
111 |
+
'shariff3uu_number_borderradius_render', 'design', 'shariff3uu_design_section' );
|
112 |
+
|
113 |
+
// Custom main color.
|
114 |
+
add_settings_field( 'shariff3uu_text_maincolor', __( 'Custom main color for <b>all</b> buttons (hexadecimal):', 'shariff' ),
|
115 |
+
'shariff3uu_text_maincolor_render', 'design', 'shariff3uu_design_section' );
|
116 |
+
|
117 |
+
// Custom secondary color.
|
118 |
+
add_settings_field( 'shariff3uu_text_secondarycolor', __( 'Custom secondary color for <b>all</b> buttons (hexadecimal):', 'shariff' ),
|
119 |
+
'shariff3uu_text_secondarycolor_render', 'design', 'shariff3uu_design_section' );
|
120 |
+
|
121 |
+
// Vertical.
|
122 |
+
add_settings_field( 'shariff3uu_checkbox_vertical', __( 'Shariff button orientation <b>vertical</b>.', 'shariff' ),
|
123 |
+
'shariff3uu_checkbox_vertical_render', 'design', 'shariff3uu_design_section' );
|
124 |
+
|
125 |
+
// Alignment option.
|
126 |
+
add_settings_field( 'shariff3uu_radio_align', __( 'Alignment of the Shariff buttons:', 'shariff' ),
|
127 |
+
'shariff3uu_radio_align_render', 'design', 'shariff3uu_design_section' );
|
128 |
+
|
129 |
+
// Alignment option for the widget.
|
130 |
+
add_settings_field( 'shariff3uu_radio_align_widget', __( 'Alignment of the Shariff buttons in the widget:', 'shariff' ),
|
131 |
+
'shariff3uu_radio_align_widget_render', 'design', 'shariff3uu_design_section' );
|
132 |
+
|
133 |
+
// Headline.
|
134 |
+
add_settings_field( 'shariff3uu_text_headline', __( 'Headline above all Shariff buttons:', 'shariff' ),
|
135 |
+
'shariff3uu_text_headline_render', 'design', 'shariff3uu_design_section' );
|
136 |
+
|
137 |
+
// Custom css.
|
138 |
+
add_settings_field( 'shariff3uu_text_style', __( 'Custom CSS <u>attributes</u> for the container <u>around</u> Shariff:', 'shariff' ),
|
139 |
+
'shariff3uu_text_style_render', 'design', 'shariff3uu_design_section' );
|
140 |
+
|
141 |
+
// Custom css class.
|
142 |
+
add_settings_field( 'shariff3uu_text_cssclass', __( 'Custom CSS <u>class</u> for the container <u>around</u> Shariff:', 'shariff' ),
|
143 |
+
'shariff3uu_text_cssclass_render', 'design', 'shariff3uu_design_section' );
|
144 |
+
|
145 |
+
// Hide until css loaded.
|
146 |
+
add_settings_field( 'shariff3uu_checkbox_hideuntilcss', __( 'Hide buttons until page is fully loaded.', 'shariff' ),
|
147 |
+
'shariff3uu_checkbox_hideuntilcss_render', 'design', 'shariff3uu_design_section' );
|
148 |
+
|
149 |
+
// Open in popup.
|
150 |
+
add_settings_field( 'shariff3uu_checkbox_popup', __( 'Open links in a popup (requires JavaScript).', 'shariff' ),
|
151 |
+
'shariff3uu_checkbox_popup_render', 'design', 'shariff3uu_design_section' );
|
152 |
+
|
153 |
+
/** Third tab - advanced */
|
154 |
+
|
155 |
+
// Registers third tab (advanced) settings and calls sanitize function.
|
156 |
+
register_setting( 'advanced', 'shariff3uu_advanced', 'shariff3uu_advanced_sanitize' );
|
157 |
+
|
158 |
+
// Third tab - advanced options.
|
159 |
+
add_settings_section( 'shariff3uu_advanced_section', __( 'Advanced options', 'shariff' ),
|
160 |
+
'shariff3uu_advanced_section_callback', 'advanced' );
|
161 |
+
|
162 |
+
// Info url.
|
163 |
+
add_settings_field(
|
164 |
+
'shariff3uu_text_info_url', '<div style="width:450px">' . esc_html__( 'Custom link for the info button:', 'shariff' ) . '</div>',
|
165 |
+
'shariff3uu_text_info_url_render', 'advanced', 'shariff3uu_advanced_section' );
|
166 |
+
|
167 |
+
// Info text.
|
168 |
+
add_settings_field(
|
169 |
+
'shariff3uu_text_info_text', '<div style="width:450px">' . esc_html__( 'Custom text for the info button:', 'shariff' ) . '</div>',
|
170 |
+
'shariff3uu_text_info_text_render', 'advanced', 'shariff3uu_advanced_section' );
|
171 |
+
|
172 |
+
// Twitter via.
|
173 |
+
add_settings_field(
|
174 |
+
'shariff3uu_text_twittervia', __( 'Twitter username for the via tag:', 'shariff' ),
|
175 |
+
'shariff3uu_text_twittervia_render', 'advanced', 'shariff3uu_advanced_section' );
|
176 |
+
|
177 |
+
// Flattr username.
|
178 |
+
add_settings_field(
|
179 |
+
'shariff3uu_text_flattruser', __( 'Flattr username:', 'shariff' ),
|
180 |
+
'shariff3uu_text_flattruser_render', 'advanced', 'shariff3uu_advanced_section' );
|
181 |
+
|
182 |
+
// Patreon username.
|
183 |
+
add_settings_field(
|
184 |
+
'shariff3uu_text_patreonid', __( 'Patreon username:', 'shariff' ),
|
185 |
+
'shariff3uu_text_patreonid_render', 'advanced', 'shariff3uu_advanced_section' );
|
186 |
+
|
187 |
+
// Paypal button id.
|
188 |
+
add_settings_field(
|
189 |
+
'shariff3uu_text_paypalbuttonid', __( 'PayPal hosted button ID:', 'shariff' ),
|
190 |
+
'shariff3uu_text_paypalbuttonid_render', 'advanced', 'shariff3uu_advanced_section' );
|
191 |
+
|
192 |
+
// Paypalme id.
|
193 |
+
add_settings_field(
|
194 |
+
'shariff3uu_text_paypalmeid', __( 'PayPal.Me ID:', 'shariff' ),
|
195 |
+
'shariff3uu_text_paypalmeid_render', 'advanced', 'shariff3uu_advanced_section' );
|
196 |
+
|
197 |
+
// Bitcoin address.
|
198 |
+
add_settings_field(
|
199 |
+
'shariff3uu_text_bitcoinaddress', __( 'Bitcoin address:', 'shariff' ),
|
200 |
+
'shariff3uu_text_bitcoinaddress_render', 'advanced', 'shariff3uu_advanced_section' );
|
201 |
+
|
202 |
+
// RSS feed.
|
203 |
+
add_settings_field(
|
204 |
+
'shariff3uu_text_rssfeed', __( 'RSS feed:', 'shariff' ),
|
205 |
+
'shariff3uu_text_rssfeed_render', 'advanced', 'shariff3uu_advanced_section' );
|
206 |
+
|
207 |
+
// Default image for pinterest.
|
208 |
+
add_settings_field( 'shariff3uu_text_default_pinterest', __( 'Default image for Pinterest:', 'shariff' ),
|
209 |
+
'shariff3uu_text_default_pinterest_render', 'advanced', 'shariff3uu_advanced_section' );
|
210 |
+
|
211 |
+
// Shortcode priority.
|
212 |
+
add_settings_field( 'shariff3uu_number_shortcodeprio', __( 'Shortcode priority:', 'shariff' ),
|
213 |
+
'shariff3uu_number_shortcodeprio_render', 'advanced', 'shariff3uu_advanced_section' );
|
214 |
+
|
215 |
+
// Disable metabox.
|
216 |
+
add_settings_field( 'shariff3uu_checkbox_disable_metabox', __( 'Disable the metabox.', 'shariff' ),
|
217 |
+
'shariff3uu_checkbox_disable_metabox_render', 'advanced', 'shariff3uu_advanced_section' );
|
218 |
+
|
219 |
+
/** Fifth tab - statistic */
|
220 |
+
|
221 |
+
// Registers fifth tab (statistic) settings and calls sanitize function.
|
222 |
+
register_setting( 'statistic', 'shariff3uu_statistic', 'shariff3uu_statistic_sanitize' );
|
223 |
+
|
224 |
+
// Fifth tab (statistic).
|
225 |
+
add_settings_section( 'shariff3uu_statistic_section', __( 'Statistic', 'shariff' ),
|
226 |
+
'shariff3uu_statistic_section_callback', 'statistic' );
|
227 |
+
|
228 |
+
// Statistic.
|
229 |
+
add_settings_field( 'shariff3uu_checkbox_backend', '<div style="width:450px">' . esc_html__( 'Enable statistic.', 'shariff' ) . '</div>',
|
230 |
+
'shariff3uu_checkbox_backend_render', 'statistic', 'shariff3uu_statistic_section' );
|
231 |
+
|
232 |
+
// Share counts.
|
233 |
+
add_settings_field( 'shariff3uu_checkbox_sharecounts', __( 'Show share counts on buttons.', 'shariff' ),
|
234 |
+
'shariff3uu_checkbox_sharecounts_render', 'statistic', 'shariff3uu_statistic_section' );
|
235 |
+
|
236 |
+
// Hide when zero.
|
237 |
+
add_settings_field( 'shariff3uu_checkbox_hidezero', __( 'Hide share counts when they are zero.', 'shariff' ),
|
238 |
+
'shariff3uu_checkbox_hidezero_render', 'statistic', 'shariff3uu_statistic_section' );
|
239 |
+
|
240 |
+
// Facebook App ID.
|
241 |
+
add_settings_field( 'shariff3uu_text_fb_id', __( 'Facebook App ID:', 'shariff' ),
|
242 |
+
'shariff3uu_text_fb_id_render', 'statistic', 'shariff3uu_statistic_section' );
|
243 |
+
|
244 |
+
// Facebook App Secret.
|
245 |
+
add_settings_field( 'shariff3uu_text_fb_secret', __( 'Facebook App Secret:', 'shariff' ),
|
246 |
+
'shariff3uu_text_fb_secret_render', 'statistic', 'shariff3uu_statistic_section' );
|
247 |
+
|
248 |
+
// Automatic cache.
|
249 |
+
add_settings_field( 'shariff3uu_checkbox_automaticcache', __( 'Fill cache automatically.', 'shariff' ),
|
250 |
+
'shariff3uu_checkbox_automaticcache_render', 'statistic', 'shariff3uu_statistic_section' );
|
251 |
+
|
252 |
+
// Ranking.
|
253 |
+
add_settings_field( 'shariff3uu_number_ranking', __( 'Number of posts on ranking tab:', 'shariff' ),
|
254 |
+
'shariff3uu_number_ranking_render', 'statistic', 'shariff3uu_statistic_section' );
|
255 |
+
|
256 |
+
// TTL.
|
257 |
+
add_settings_field( 'shariff3uu_number_ttl', __( 'Cache TTL in seconds (60 - 7200):', 'shariff' ),
|
258 |
+
'shariff3uu_number_ttl_render', 'statistic', 'shariff3uu_statistic_section' );
|
259 |
+
|
260 |
+
// Disable dynamic cache lifespan.
|
261 |
+
add_settings_field( 'shariff3uu_checkbox_disable_dynamic_cache', __( 'Disable the dynamic cache lifespan (not recommended).', 'shariff' ),
|
262 |
+
'shariff3uu_checkbox_disable_dynamic_cache_render', 'statistic', 'shariff3uu_statistic_section' );
|
263 |
+
|
264 |
+
// Twitter NewShareCount.
|
265 |
+
add_settings_field( 'shariff3uu_checkbox_newsharecount', __( 'Use NewShareCount instead of OpenShareCount for Twitter.', 'shariff' ),
|
266 |
+
'shariff3uu_checkbox_newsharecount_render', 'statistic', 'shariff3uu_statistic_section' );
|
267 |
+
|
268 |
+
// Disable services.
|
269 |
+
add_settings_field( 'shariff3uu_multiplecheckbox_disable_services', __( 'Disable the following services (share counts only):', 'shariff' ),
|
270 |
+
'shariff3uu_multiplecheckbox_disable_services_render', 'statistic', 'shariff3uu_statistic_section' );
|
271 |
+
|
272 |
+
// External hosts.
|
273 |
+
add_settings_field( 'shariff3uu_text_external_host', __( 'External API for share counts:', 'shariff' ),
|
274 |
+
'shariff3uu_text_external_host_render', 'statistic', 'shariff3uu_statistic_section' );
|
275 |
+
|
276 |
+
// Request external api directly from js.
|
277 |
+
add_settings_field( 'shariff3uu_checkbox_external_direct', __( 'Request external API directly.', 'shariff' ),
|
278 |
+
'shariff3uu_checkbox_external_direct_render', 'statistic', 'shariff3uu_statistic_section' );
|
279 |
+
|
280 |
+
// WP in sub folder and api only reachable there?
|
281 |
+
add_settings_field( 'shariff3uu_checkbox_subapi', __( 'Local API not reachable in root.', 'shariff' ),
|
282 |
+
'shariff3uu_checkbox_subapi_render', 'statistic', 'shariff3uu_statistic_section' );
|
283 |
+
|
284 |
+
/** Sixth tab - help */
|
285 |
+
|
286 |
+
// Register sixth tab (help).
|
287 |
+
add_settings_section( 'shariff3uu_help_section', __( 'Shariff Help', 'shariff' ),
|
288 |
+
'shariff3uu_help_section_callback', 'help' );
|
289 |
+
|
290 |
+
/** Seventh tab - status */
|
291 |
+
|
292 |
+
// Register seventh tab (status).
|
293 |
+
add_settings_section( 'shariff3uu_status_section', __( 'Status', 'shariff' ),
|
294 |
+
'shariff3uu_status_section_callback', 'status' );
|
295 |
+
|
296 |
+
/** Eight tab - ranking */
|
297 |
+
|
298 |
+
// Register eight tab (ranking).
|
299 |
+
add_settings_section( 'shariff3uu_ranking_section', __( 'Ranking', 'shariff' ),
|
300 |
+
'shariff3uu_ranking_section_callback', 'ranking' );
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Sanitizes input from the basic settings page.
|
305 |
+
*
|
306 |
+
* @param array $input Input from settings page to sanitize.
|
307 |
+
*
|
308 |
+
* @return array Sanitized array with settings.
|
309 |
+
*/
|
310 |
+
function shariff3uu_basic_sanitize( $input ) {
|
311 |
+
// Create array.
|
312 |
+
$valid = array();
|
313 |
+
|
314 |
+
if ( isset( $input['version'] ) ) {
|
315 |
+
$valid['version'] = sanitize_text_field( $input['version'] );
|
316 |
+
}
|
317 |
+
if ( isset( $input['services'] ) ) {
|
318 |
+
$valid['services'] = trim( preg_replace( '/[^A-Za-z|]/', '', sanitize_text_field( $input['services'] ) ), '|' );
|
319 |
+
}
|
320 |
+
if ( isset( $input['add_after'] ) ) {
|
321 |
+
$valid['add_after'] = sani_arrays( $input['add_after'] );
|
322 |
+
}
|
323 |
+
if ( isset( $input['add_before'] ) ) {
|
324 |
+
$valid['add_before'] = sani_arrays( $input['add_before'] );
|
325 |
+
}
|
326 |
+
if ( isset( $input['disable_on_protected'] ) ) {
|
327 |
+
$valid['disable_on_protected'] = absint( $input['disable_on_protected'] );
|
328 |
+
}
|
329 |
+
if ( isset( $input['disable_outside_loop'] ) ) {
|
330 |
+
$valid['disable_outside_loop'] = absint( $input['disable_outside_loop'] );
|
331 |
+
}
|
332 |
+
|
333 |
+
// Remove empty elements.
|
334 |
+
$valid = array_filter( $valid );
|
335 |
+
|
336 |
+
return $valid;
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Sanitizes input from the design settings page.
|
341 |
+
*
|
342 |
+
* @param array $input Input from settings page to sanitize.
|
343 |
+
*
|
344 |
+
* @return array Sanitized array with settings.
|
345 |
+
*/
|
346 |
+
function shariff3uu_design_sanitize( $input ) {
|
347 |
+
// Create array.
|
348 |
+
$valid = array();
|
349 |
+
|
350 |
+
if ( isset( $input['lang'] ) ) {
|
351 |
+
$valid['lang'] = sanitize_text_field( $input['lang'] );
|
352 |
+
}
|
353 |
+
if ( isset( $input['theme'] ) ) {
|
354 |
+
$valid['theme'] = sanitize_text_field( $input['theme'] );
|
355 |
+
}
|
356 |
+
if ( isset( $input['buttonsize'] ) ) {
|
357 |
+
$valid['buttonsize'] = sanitize_text_field( $input['buttonsize'] );
|
358 |
+
}
|
359 |
+
if ( isset( $input['buttonstretch'] ) ) {
|
360 |
+
$valid['buttonstretch'] = absint( $input['buttonstretch'] );
|
361 |
+
}
|
362 |
+
if ( isset( $input['borderradius'] ) ) {
|
363 |
+
$valid['borderradius'] = absint( $input['borderradius'] );
|
364 |
+
}
|
365 |
+
if ( isset( $input['maincolor'] ) ) {
|
366 |
+
$valid['maincolor'] = sanitize_text_field( $input['maincolor'] );
|
367 |
+
}
|
368 |
+
if ( isset( $input['secondarycolor'] ) ) {
|
369 |
+
$valid['secondarycolor'] = sanitize_text_field( $input['secondarycolor'] );
|
370 |
+
}
|
371 |
+
if ( isset( $input['vertical'] ) ) {
|
372 |
+
$valid['vertical'] = absint( $input['vertical'] );
|
373 |
+
}
|
374 |
+
if ( isset( $input['align'] ) ) {
|
375 |
+
$valid['align'] = sanitize_text_field( $input['align'] );
|
376 |
+
}
|
377 |
+
if ( isset( $input['align_widget'] ) ) {
|
378 |
+
$valid['align_widget'] = sanitize_text_field( $input['align_widget'] );
|
379 |
+
}
|
380 |
+
if ( isset( $input['style'] ) ) {
|
381 |
+
$valid['style'] = sanitize_text_field( $input['style'] ); }
|
382 |
+
if ( isset( $input['cssclass'] ) ) {
|
383 |
+
$valid['cssclass'] = sanitize_text_field( $input['cssclass'] );
|
384 |
+
}
|
385 |
+
if ( isset( $input['headline'] ) ) {
|
386 |
+
$valid['headline'] = wp_kses( $input['headline'], $GLOBALS['allowed_tags'] );
|
387 |
+
}
|
388 |
+
if ( isset( $input['hideuntilcss'] ) ) {
|
389 |
+
$valid['hideuntilcss'] = absint( $input['hideuntilcss'] );
|
390 |
+
}
|
391 |
+
if ( isset( $input['popup'] ) ) {
|
392 |
+
$valid['popup'] = absint( $input['popup'] );
|
393 |
+
}
|
394 |
+
|
395 |
+
// Remove empty elements.
|
396 |
+
$valid = array_filter( $valid );
|
397 |
+
|
398 |
+
return $valid;
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Sanitize input from the advanced settings page.
|
403 |
+
*
|
404 |
+
* @param array $input Input from settings page to sanitize.
|
405 |
+
*
|
406 |
+
* @return array Sanitized array with settings.
|
407 |
+
*/
|
408 |
+
function shariff3uu_advanced_sanitize( $input ) {
|
409 |
+
// Creates array.
|
410 |
+
$valid = array();
|
411 |
+
|
412 |
+
if ( isset( $input['info_url'] ) ) {
|
413 |
+
$valid['info_url'] = esc_url_raw( $input['info_url'] );
|
414 |
+
}
|
415 |
+
if ( isset( $input['info_text'] ) ) {
|
416 |
+
$valid['info_text'] = sanitize_text_field( $input['info_text'] );
|
417 |
+
}
|
418 |
+
if ( isset( $input['twitter_via'] ) ) {
|
419 |
+
$valid['twitter_via'] = str_replace( '@', '', sanitize_text_field( $input['twitter_via'] ) );
|
420 |
+
}
|
421 |
+
if ( isset( $input['flattruser'] ) ) {
|
422 |
+
$valid['flattruser'] = sanitize_text_field( $input['flattruser'] );
|
423 |
+
}
|
424 |
+
if ( isset( $input['patreonid'] ) ) {
|
425 |
+
$valid['patreonid'] = sanitize_text_field( $input['patreonid'] );
|
426 |
+
}
|
427 |
+
if ( isset( $input['paypalbuttonid'] ) ) {
|
428 |
+
$valid['paypalbuttonid'] = sanitize_text_field( $input['paypalbuttonid'] );
|
429 |
+
}
|
430 |
+
if ( isset( $input['paypalmeid'] ) ) {
|
431 |
+
$valid['paypalmeid'] = sanitize_text_field( $input['paypalmeid'] );
|
432 |
+
}
|
433 |
+
if ( isset( $input['bitcoinaddress'] ) ) {
|
434 |
+
$valid['bitcoinaddress'] = sanitize_text_field( $input['bitcoinaddress'] );
|
435 |
+
}
|
436 |
+
if ( isset( $input['rssfeed'] ) ) {
|
437 |
+
$valid['rssfeed'] = sanitize_text_field( $input['rssfeed'] );
|
438 |
+
}
|
439 |
+
if ( isset( $input['default_pinterest'] ) ) {
|
440 |
+
$valid['default_pinterest'] = sanitize_text_field( $input['default_pinterest'] );
|
441 |
+
}
|
442 |
+
if ( isset( $input['shortcodeprio'] ) ) {
|
443 |
+
$valid['shortcodeprio'] = absint( $input['shortcodeprio'] );
|
444 |
+
}
|
445 |
+
if ( isset( $input['disable_metabox'] ) ) {
|
446 |
+
$valid['disable_metabox'] = absint( $input['disable_metabox'] );
|
447 |
+
}
|
448 |
+
|
449 |
+
// Remove empty elements.
|
450 |
+
$valid = array_filter( $valid );
|
451 |
+
|
452 |
+
return $valid;
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Sanitizes input from the statistic settings page.
|
457 |
+
*
|
458 |
+
* @param array $input Input from settings page to sanitize.
|
459 |
+
*
|
460 |
+
* @return array Sanitized array with settings.
|
461 |
+
*/
|
462 |
+
function shariff3uu_statistic_sanitize( $input ) {
|
463 |
+
// Creates array.
|
464 |
+
$valid = array();
|
465 |
+
|
466 |
+
if ( isset( $input['backend'] ) ) {
|
467 |
+
$valid['backend'] = absint( $input['backend'] );
|
468 |
+
}
|
469 |
+
if ( isset( $input['sharecounts'] ) ) {
|
470 |
+
$valid['sharecounts'] = absint( $input['sharecounts'] );
|
471 |
+
}
|
472 |
+
if ( isset( $input['hidezero'] ) ) {
|
473 |
+
$valid['hidezero'] = absint( $input['hidezero'] );
|
474 |
+
}
|
475 |
+
if ( isset( $input['ranking'] ) ) {
|
476 |
+
$valid['ranking'] = absint( $input['ranking'] );
|
477 |
+
}
|
478 |
+
if ( isset( $input['automaticcache'] ) ) {
|
479 |
+
$valid['automaticcache'] = absint( $input['automaticcache'] );
|
480 |
+
}
|
481 |
+
if ( isset( $input['fb_id'] ) ) {
|
482 |
+
$valid['fb_id'] = sanitize_text_field( $input['fb_id'] );
|
483 |
+
}
|
484 |
+
if ( isset( $input['fb_secret'] ) ) {
|
485 |
+
$valid['fb_secret'] = sanitize_text_field( $input['fb_secret'] );
|
486 |
+
}
|
487 |
+
if ( isset( $input['ttl'] ) ) {
|
488 |
+
$valid['ttl'] = absint( $input['ttl'] );
|
489 |
+
}
|
490 |
+
if ( isset( $input['disable_dynamic_cache'] ) ) {
|
491 |
+
$valid['disable_dynamic_cache'] = absint( $input['disable_dynamic_cache'] );
|
492 |
+
}
|
493 |
+
if ( isset( $input['newsharecount'] ) ) {
|
494 |
+
$valid['newsharecount'] = absint( $input['newsharecount'] );
|
495 |
+
}
|
496 |
+
if ( isset( $input['disable'] ) ) {
|
497 |
+
$valid['disable'] = sani_arrays( $input['disable'] );
|
498 |
+
}
|
499 |
+
if ( isset( $input['external_host'] ) ) {
|
500 |
+
$valid['external_host'] = str_replace( ' ', '', rtrim( esc_url_raw( $input['external_host'], '/' ) ) );
|
501 |
+
}
|
502 |
+
if ( isset( $input['external_direct'] ) ) {
|
503 |
+
$valid['external_direct'] = absint( $input['external_direct'] );
|
504 |
+
}
|
505 |
+
if ( isset( $input['subapi'] ) ) {
|
506 |
+
$valid['subapi'] = absint( $input['subapi'] );
|
507 |
+
}
|
508 |
+
|
509 |
+
// Protect users from themselves.
|
510 |
+
if ( isset( $valid['ttl'] ) && $valid['ttl'] < '60' ) {
|
511 |
+
$valid['ttl'] = '';
|
512 |
+
} elseif ( isset( $valid['ttl'] ) && $valid['ttl'] > '7200' ) {
|
513 |
+
$valid['ttl'] = '7200';
|
514 |
+
}
|
515 |
+
|
516 |
+
// Remove empty elements.
|
517 |
+
$valid = array_filter( $valid );
|
518 |
+
|
519 |
+
return $valid;
|
520 |
+
}
|
521 |
+
|
522 |
+
/**
|
523 |
+
* Helper function to sanitize arrays.
|
524 |
+
*
|
525 |
+
* @param array $data Input array.
|
526 |
+
*
|
527 |
+
* @return array Sanitized array.
|
528 |
+
*/
|
529 |
+
function sani_arrays( $data = array() ) {
|
530 |
+
if ( ! is_array( $data ) || ! count( $data ) ) {
|
531 |
+
return array();
|
532 |
+
}
|
533 |
+
foreach ( $data as $k => $v ) {
|
534 |
+
if ( ! is_array( $v ) && ! is_object( $v ) ) {
|
535 |
+
$data[ $k ] = absint( trim( $v ) );
|
536 |
+
}
|
537 |
+
if ( is_array( $v ) ) {
|
538 |
+
$data[ $k ] = sani_arrays( $v );
|
539 |
+
}
|
540 |
+
}
|
541 |
+
return $data;
|
542 |
+
}
|
543 |
+
|
544 |
+
/** Render admin options: use isset() to prevent errors while debug mode is on. */
|
545 |
+
|
546 |
+
/** Basic options */
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Description of basic options.
|
550 |
+
*/
|
551 |
+
function shariff3uu_basic_section_callback() {
|
552 |
+
esc_html_e( 'Select the desired services in the order you want them to be displayed and where the Shariff buttons should be included automatically.', 'shariff' );
|
553 |
+
}
|
554 |
+
|
555 |
+
/**
|
556 |
+
* Services.
|
557 |
+
*/
|
558 |
+
function shariff3uu_text_services_render() {
|
559 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['services'] ) ) {
|
560 |
+
$services = $GLOBALS['shariff3uu_basic']['services'];
|
561 |
+
} else {
|
562 |
+
$services = '';
|
563 |
+
}
|
564 |
+
echo '<input type="text" name="shariff3uu_basic[services]" value="' . esc_html( $services ) . '" size="75" placeholder="twitter|facebook|googleplus|info">';
|
565 |
+
echo '<p><code>addthis|bitcoin|diaspora|facebook|flattr|flipboard|googleplus|info|linkedin|mailto|mastodon|odnoklassniki|patreon|paypal|paypalme</code></p>';
|
566 |
+
echo '<p><code>pinterest|pocket|printer|qzone|reddit|rss|sms|stumbleupon|telegram|tencentweibo|threema|tumblr|twitter|vk|wallabag|weibo|whatsapp|xing</code></p>';
|
567 |
+
echo '<p>' . esc_html__( 'Use the pipe sign | (Alt Gr + < or ⌥ + 7) between two or more services.', 'shariff' ) . '</p>';
|
568 |
+
}
|
569 |
+
|
570 |
+
/**
|
571 |
+
* Add after.
|
572 |
+
*/
|
573 |
+
function shariff3uu_multiplecheckbox_add_after_render() {
|
574 |
+
// Add after all posts.
|
575 |
+
echo '<p><input type="checkbox" name="shariff3uu_basic[add_after][posts]" ';
|
576 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['add_after']['posts'] ) ) {
|
577 |
+
echo checked( $GLOBALS['shariff3uu_basic']['add_after']['posts'], 1, 0 );
|
578 |
+
}
|
579 |
+
echo ' value="1">' . esc_html__( 'Posts', 'shariff' ) . '</p>';
|
580 |
+
|
581 |
+
// Add after all posts (blog page).
|
582 |
+
echo '<p><input type="checkbox" name="shariff3uu_basic[add_after][posts_blogpage]" ';
|
583 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['add_after']['posts_blogpage'] ) ) {
|
584 |
+
echo checked( $GLOBALS['shariff3uu_basic']['add_after']['posts_blogpage'], 1, 0 );
|
585 |
+
}
|
586 |
+
echo ' value="1">' . esc_html__( 'Posts (blog page)', 'shariff' ) . '</p>';
|
587 |
+
|
588 |
+
// Add after all pages.
|
589 |
+
echo '<p><input type="checkbox" name="shariff3uu_basic[add_after][pages]" ';
|
590 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['add_after']['pages'] ) ) {
|
591 |
+
echo checked( $GLOBALS['shariff3uu_basic']['add_after']['pages'], 1, 0 );
|
592 |
+
}
|
593 |
+
echo ' value="1">' . esc_html__( 'Pages', 'shariff' ) . '</p>';
|
594 |
+
|
595 |
+
// Add after all bbpress replies.
|
596 |
+
echo '<p><input type="checkbox" name="shariff3uu_basic[add_after][bbp_reply]" ';
|
597 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['add_after']['bbp_reply'] ) ) {
|
598 |
+
echo checked( $GLOBALS['shariff3uu_basic']['add_after']['bbp_reply'], 1, 0 );
|
599 |
+
}
|
600 |
+
echo ' value="1">' . esc_html__( 'bbPress replies', 'shariff' ) . '</p>';
|
601 |
+
|
602 |
+
// Add after all excerpts.
|
603 |
+
echo '<p><input type="checkbox" name="shariff3uu_basic[add_after][excerpt]" ';
|
604 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['add_after']['excerpt'] ) ) {
|
605 |
+
echo checked( $GLOBALS['shariff3uu_basic']['add_after']['excerpt'], 1, 0 );
|
606 |
+
}
|
607 |
+
echo ' value="1">' . esc_html__( 'Excerpts', 'shariff' ) . '</p>';
|
608 |
+
|
609 |
+
// Add after custom post types - choose after which to add.
|
610 |
+
$post_types = get_post_types( array( '_builtin' => false ) );
|
611 |
+
if ( isset( $post_types ) && is_array( $post_types ) && ! empty( $post_types ) ) {
|
612 |
+
echo '<p>Custom Post Types:</p>';
|
613 |
+
};
|
614 |
+
|
615 |
+
foreach ( $post_types as $post_type ) {
|
616 |
+
$object = get_post_type_object( $post_type );
|
617 |
+
printf(
|
618 |
+
'<p><input type="checkbox" name="shariff3uu_basic[add_after][%s]" %s value="1">%s</p>',
|
619 |
+
$post_type,
|
620 |
+
isset( $GLOBALS['shariff3uu_basic']['add_after'][ $post_type ] ) ? checked( $GLOBALS['shariff3uu_basic']['add_after'][ $post_type ], 1, 0 ) : '',
|
621 |
+
// The following should already be localized <- not always, but there is no way to know, so we have to accept the language mix up.
|
622 |
+
esc_html( $object->labels->singular_name )
|
623 |
+
);
|
624 |
+
}
|
625 |
+
}
|
626 |
+
|
627 |
+
/**
|
628 |
+
* Add before.
|
629 |
+
*/
|
630 |
+
function shariff3uu_multiplecheckbox_add_before_render() {
|
631 |
+
// Add before all posts.
|
632 |
+
echo '<p><input type="checkbox" name="shariff3uu_basic[add_before][posts]" ';
|
633 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['add_before']['posts'] ) ) {
|
634 |
+
echo checked( $GLOBALS['shariff3uu_basic']['add_before']['posts'], 1, 0 );
|
635 |
+
}
|
636 |
+
echo ' value="1">' . esc_html__( 'Posts', 'shariff' ) . '</p>';
|
637 |
+
|
638 |
+
// Add before all posts (blog page).
|
639 |
+
echo '<p><input type="checkbox" name="shariff3uu_basic[add_before][posts_blogpage]" ';
|
640 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['add_before']['posts_blogpage'] ) ) {
|
641 |
+
echo checked( $GLOBALS['shariff3uu_basic']['add_before']['posts_blogpage'], 1, 0 );
|
642 |
+
}
|
643 |
+
echo ' value="1">' . esc_html__( 'Posts (blog page)', 'shariff' ) . '</p>';
|
644 |
+
|
645 |
+
// Add before all pages.
|
646 |
+
echo '<p><input type="checkbox" name="shariff3uu_basic[add_before][pages]" ';
|
647 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['add_before']['pages'] ) ) {
|
648 |
+
echo checked( $GLOBALS['shariff3uu_basic']['add_before']['pages'], 1, 0 );
|
649 |
+
}
|
650 |
+
echo ' value="1">' . esc_html__( 'Pages', 'shariff' ) . '</p>';
|
651 |
+
|
652 |
+
// Add before all excerpts.
|
653 |
+
echo '<p><input type="checkbox" name="shariff3uu_basic[add_before][excerpt]" ';
|
654 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['add_before']['excerpt'] ) ) {
|
655 |
+
echo checked( $GLOBALS['shariff3uu_basic']['add_before']['excerpt'], 1, 0 );
|
656 |
+
}
|
657 |
+
echo ' value="1">' . esc_html__( 'Excerpts', 'shariff' ) . '</p>';
|
658 |
+
|
659 |
+
// Add before custom post types - choose before which to add.
|
660 |
+
$post_types = get_post_types( array( '_builtin' => false ) );
|
661 |
+
if ( isset( $post_types ) && is_array( $post_types ) && ! empty( $post_types ) ) {
|
662 |
+
echo '<p>Custom Post Types:</p>';
|
663 |
+
};
|
664 |
+
|
665 |
+
foreach ( $post_types as $post_type ) {
|
666 |
+
$object = get_post_type_object( $post_type );
|
667 |
+
printf(
|
668 |
+
'<p><input type="checkbox" name="shariff3uu_basic[add_before][%s]" %s value="1">%s</p>',
|
669 |
+
$post_type,
|
670 |
+
isset( $GLOBALS['shariff3uu_basic']['add_before'][ $post_type ] ) ? checked( $GLOBALS['shariff3uu_basic']['add_before'][ $post_type ], 1, 0 ) : '',
|
671 |
+
// The following should already be localized <- not always, but there is no way to know, so we have to accept the language mix up.
|
672 |
+
esc_html( $object->labels->singular_name )
|
673 |
+
);
|
674 |
+
}
|
675 |
+
}
|
676 |
+
|
677 |
+
/**
|
678 |
+
* Disable on password protected posts.
|
679 |
+
*/
|
680 |
+
function shariff3uu_checkbox_disable_on_protected_render() {
|
681 |
+
echo '<input type="checkbox" name="shariff3uu_basic[disable_on_protected]" ';
|
682 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['disable_on_protected'] ) ) {
|
683 |
+
echo checked( $GLOBALS['shariff3uu_basic']['disable_on_protected'], 1, 0 );
|
684 |
+
}
|
685 |
+
echo ' value="1">';
|
686 |
+
}
|
687 |
+
|
688 |
+
/**
|
689 |
+
* Disable outside loop.
|
690 |
+
*/
|
691 |
+
function shariff3uu_checkbox_disable_outside_loop_render() {
|
692 |
+
echo '<input type="checkbox" name="shariff3uu_basic[disable_outside_loop]" ';
|
693 |
+
if ( isset( $GLOBALS['shariff3uu_basic']['disable_outside_loop'] ) ) {
|
694 |
+
echo checked( $GLOBALS['shariff3uu_basic']['disable_outside_loop'], 1, 0 );
|
695 |
+
}
|
696 |
+
echo ' value="1">';
|
697 |
+
}
|
698 |
+
|
699 |
+
/** Design options */
|
700 |
+
|
701 |
+
/**
|
702 |
+
* Description of the design options.
|
703 |
+
*/
|
704 |
+
function shariff3uu_design_section_callback() {
|
705 |
+
esc_html_e( 'This configures the default design of the Shariff buttons. Most options can be overwritten for single posts or pages with the options within the [shariff] shorttag. ', 'shariff' );
|
706 |
+
$help_link = get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page=shariff3uu&tab=help';
|
707 |
+
// Translators: %s will be replaced with the correct URL to the help section.
|
708 |
+
printf( wp_kses( __( 'For more information please take a look at the <a href="%s">Help Section</a>. ', 'shariff' ), array( 'a' => array( 'href' => true ) ) ), esc_url( $help_link ) );
|
709 |
+
// Translators: %s will be replaced with the correct URL to the wordpress.org support forum.
|
710 |
+
printf( wp_kses( __( 'You should also check out the <a href="%s" target="_blank">Support Forum</a>. ', 'shariff' ),
|
711 |
+
array(
|
712 |
+
'a' => array(
|
713 |
+
'href' => true,
|
714 |
+
'target' => true,
|
715 |
+
),
|
716 |
+
)
|
717 |
+
), 'https://wordpress.org/support/plugin/shariff/' );
|
718 |
+
}
|
719 |
+
|
720 |
+
/**
|
721 |
+
* Language.
|
722 |
+
*/
|
723 |
+
function shariff3uu_select_language_render() {
|
724 |
+
$options = $GLOBALS['shariff3uu_design'];
|
725 |
+
if ( ! isset( $options['lang'] ) ) {
|
726 |
+
$options['lang'] = '';
|
727 |
+
}
|
728 |
+
echo '<select name="shariff3uu_design[lang]">
|
729 |
+
<option value="" ' . selected( $options['lang'], '', 0 ) . '>' . esc_html__( 'auto', 'shariff3uu' ) . '</option>
|
730 |
+
<option value="en" ' . selected( $options['lang'], 'en', 0 ) . '>English</option>
|
731 |
+
<option value="de" ' . selected( $options['lang'], 'de', 0 ) . '>Deutsch</option>
|
732 |
+
<option value="fr" ' . selected( $options['lang'], 'fr', 0 ) . '>Français</option>
|
733 |
+
<option value="es" ' . selected( $options['lang'], 'es', 0 ) . '>Español</option>
|
734 |
+
<option value="zh" ' . selected( $options['lang'], 'zh', 0 ) . '>Chinese</option>
|
735 |
+
<option value="hr" ' . selected( $options['lang'], 'hr', 0 ) . '>Croatian</option>
|
736 |
+
<option value="da" ' . selected( $options['lang'], 'da', 0 ) . '>Danish</option>
|
737 |
+
<option value="nl" ' . selected( $options['lang'], 'nl', 0 ) . '>Dutch</option>
|
738 |
+
<option value="fi" ' . selected( $options['lang'], 'fi', 0 ) . '>Finnish</option>
|
739 |
+
<option value="it" ' . selected( $options['lang'], 'it', 0 ) . '>Italiano</option>
|
740 |
+
<option value="ja" ' . selected( $options['lang'], 'ja', 0 ) . '>Japanese</option>
|
741 |
+
<option value="ko" ' . selected( $options['lang'], 'ko', 0 ) . '>Korean</option>
|
742 |
+
<option value="no" ' . selected( $options['lang'], 'no', 0 ) . '>Norwegian</option>
|
743 |
+
<option value="pl" ' . selected( $options['lang'], 'pl', 0 ) . '>Polish</option>
|
744 |
+
<option value="pt" ' . selected( $options['lang'], 'pt', 0 ) . '>Portuguese</option>
|
745 |
+
<option value="ro" ' . selected( $options['lang'], 'ro', 0 ) . '>Romanian</option>
|
746 |
+
<option value="ru" ' . selected( $options['lang'], 'ru', 0 ) . '>Russian</option>
|
747 |
+
<option value="sk" ' . selected( $options['lang'], 'sk', 0 ) . '>Slovak</option>
|
748 |
+
<option value="sl" ' . selected( $options['lang'], 'sl', 0 ) . '>Slovene</option>
|
749 |
+
<option value="sr" ' . selected( $options['lang'], 'sr', 0 ) . '>Serbian</option>
|
750 |
+
<option value="sv" ' . selected( $options['lang'], 'sv', 0 ) . '>Swedish</option>
|
751 |
+
<option value="tr" ' . selected( $options['lang'], 'tr', 0 ) . '>Turkish</option>
|
752 |
+
</select>';
|
753 |
+
}
|
754 |
+
|
755 |
+
/**
|
756 |
+
* Theme.
|
757 |
+
*/
|
758 |
+
function shariff3uu_radio_theme_render() {
|
759 |
+
$options = $GLOBALS['shariff3uu_design'];
|
760 |
+
if ( ! isset( $options['theme'] ) ) {
|
761 |
+
$options['theme'] = '';
|
762 |
+
}
|
763 |
+
$plugins_url = plugins_url();
|
764 |
+
echo '<div style="display:table;border-spacing:10px;margin:-15px 0 -5px -5px;border-collapse:separate">
|
765 |
+
<div style="display:table-row">
|
766 |
+
<div style="display:table-cell;vertical-align:middle;min-width:75px">
|
767 |
+
<input type="radio" name="shariff3uu_design[theme]" value="" ' . checked( $options['theme'], '', 0 ) . '>default
|
768 |
+
</div>
|
769 |
+
<div class="shariff_options-cell">
|
770 |
+
<img src="' . esc_url( $plugins_url ) . '/shariff/images/defaultBtns.png">
|
771 |
+
</div>
|
772 |
+
</div>
|
773 |
+
<div style="display:table-row">
|
774 |
+
<div style="display:table-cell;vertical-align:middle;min-width:75px">
|
775 |
+
<input type="radio" name="shariff3uu_design[theme]" value="color" ' . checked( $options['theme'], 'color', 0 ) . '>color
|
776 |
+
</div>
|
777 |
+
<div class="shariff_options-cell">
|
778 |
+
<img src="' . esc_url( $plugins_url ) . '/shariff/images/colorBtns.png">
|
779 |
+
</div>
|
780 |
+
</div>
|
781 |
+
<div style="display:table-row">
|
782 |
+
<div style="display:table-cell;vertical-align:middle;min-width:75px">
|
783 |
+
<input type="radio" name="shariff3uu_design[theme]" value="grey" ' . checked( $options['theme'], 'grey', 0 ) . '>grey
|
784 |
+
</div>
|
785 |
+
<div class="shariff_options-cell">
|
786 |
+
<img src="' . esc_url( $plugins_url ) . '/shariff/images/greyBtns.png">
|
787 |
+
</div>
|
788 |
+
</div>
|
789 |
+
<div style="display:table-row">
|
790 |
+
<div style="display:table-cell;vertical-align:middle;min-width:75px">
|
791 |
+
<input type="radio" name="shariff3uu_design[theme]" value="white" ' . checked( $options['theme'], 'white', 0 ) . '>white
|
792 |
+
</div>
|
793 |
+
<div class="shariff_options-cell">
|
794 |
+
<img src="' . esc_url( $plugins_url ) . '/shariff/images/whiteBtns.png">
|
795 |
+
</div>
|
796 |
+
</div>
|
797 |
+
<div style="display:table-row">
|
798 |
+
<div style="display:table-cell;vertical-align:middle;min-width:75px">
|
799 |
+
<input type="radio" name="shariff3uu_design[theme]" value="round" ' . checked( $options['theme'], 'round', 0 ) . '>round
|
800 |
+
</div>
|
801 |
+
<div class="shariff_options-cell">
|
802 |
+
<img src="' . esc_url( $plugins_url ) . '/shariff/images/roundBtns.png">
|
803 |
+
</div>
|
804 |
+
</div>
|
805 |
+
</div>';
|
806 |
+
}
|
807 |
+
|
808 |
+
/**
|
809 |
+
* Button size.
|
810 |
+
*/
|
811 |
+
function shariff3uu_checkbox_buttonsize_render() {
|
812 |
+
$options = $GLOBALS['shariff3uu_design'];
|
813 |
+
if ( ! isset( $options['buttonsize'] ) ) {
|
814 |
+
$options['buttonsize'] = 'medium';
|
815 |
+
}
|
816 |
+
echo '<p><input type="radio" name="shariff3uu_design[buttonsize]" value="small" ' . checked( $options['buttonsize'], 'small', 0 ) . '>' . esc_html__( 'small', 'shariff' ) . '</p>';
|
817 |
+
echo '<p><input type="radio" name="shariff3uu_design[buttonsize]" value="medium" ' . checked( $options['buttonsize'], 'medium', 0 ) . '>' . esc_html__( 'medium', 'shariff' ) . '</p>';
|
818 |
+
echo '<p><input type="radio" name="shariff3uu_design[buttonsize]" value="large" ' . checked( $options['buttonsize'], 'large', 0 ) . '>' . esc_html__( 'large', 'shariff' ) . '</p>';
|
819 |
+
}
|
820 |
+
|
821 |
+
/**
|
822 |
+
* Button stretch.
|
823 |
+
*/
|
824 |
+
function shariff3uu_checkbox_buttonstretch_render() {
|
825 |
+
$plugins_url = plugins_url();
|
826 |
+
echo '<input type="checkbox" name="shariff3uu_design[buttonstretch]" ';
|
827 |
+
if ( isset( $GLOBALS['shariff3uu_design']['buttonstretch'] ) ) {
|
828 |
+
echo checked( $GLOBALS['shariff3uu_design']['buttonstretch'], 1, 0 );
|
829 |
+
}
|
830 |
+
echo ' value="1">';
|
831 |
+
}
|
832 |
+
|
833 |
+
/**
|
834 |
+
* Border radius.
|
835 |
+
*/
|
836 |
+
function shariff3uu_number_borderradius_render() {
|
837 |
+
$plugins_url = plugins_url();
|
838 |
+
if ( isset( $GLOBALS['shariff3uu_design']['borderradius'] ) ) {
|
839 |
+
$borderradius = $GLOBALS['shariff3uu_design']['borderradius'];
|
840 |
+
} else {
|
841 |
+
$borderradius = '';
|
842 |
+
}
|
843 |
+
echo '<input type="number" name="shariff3uu_design[borderradius]" value="' . esc_attr( $borderradius ) . '" maxlength="2" min="1" max="50" placeholder="50" style="width: 75px">';
|
844 |
+
echo '<img src="' . esc_url( $plugins_url ) . '/shariff/images/borderradius.png" align="top">';
|
845 |
+
}
|
846 |
+
|
847 |
+
/**
|
848 |
+
* Custom main color.
|
849 |
+
*/
|
850 |
+
function shariff3uu_text_maincolor_render() {
|
851 |
+
if ( isset( $GLOBALS['shariff3uu_design']['maincolor'] ) ) {
|
852 |
+
$maincolor = $GLOBALS['shariff3uu_design']['maincolor'];
|
853 |
+
} else {
|
854 |
+
$maincolor = '';
|
855 |
+
}
|
856 |
+
echo '<input type="text" name="shariff3uu_design[maincolor]" value="' . esc_html( $maincolor ) . '" size="7" placeholder="#000000">';
|
857 |
+
}
|
858 |
+
|
859 |
+
/**
|
860 |
+
* Custom secondary color.
|
861 |
+
*/
|
862 |
+
function shariff3uu_text_secondarycolor_render() {
|
863 |
+
if ( isset( $GLOBALS['shariff3uu_design']['secondarycolor'] ) ) {
|
864 |
+
$secondarycolor = $GLOBALS['shariff3uu_design']['secondarycolor'];
|
865 |
+
} else {
|
866 |
+
$secondarycolor = '';
|
867 |
+
}
|
868 |
+
echo '<input type="text" name="shariff3uu_design[secondarycolor]" value="' . esc_html( $secondarycolor ) . '" size="7" placeholder="#afafaf">';
|
869 |
+
}
|
870 |
+
|
871 |
+
/**
|
872 |
+
* Vertical.
|
873 |
+
*/
|
874 |
+
function shariff3uu_checkbox_vertical_render() {
|
875 |
+
$plugins_url = plugins_url();
|
876 |
+
echo '<input type="checkbox" name="shariff3uu_design[vertical]" ';
|
877 |
+
if ( isset( $GLOBALS['shariff3uu_design']['vertical'] ) ) {
|
878 |
+
echo checked( $GLOBALS['shariff3uu_design']['vertical'], 1, 0 );
|
879 |
+
}
|
880 |
+
echo ' value="1">';
|
881 |
+
}
|
882 |
+
|
883 |
+
/**
|
884 |
+
* Alignment.
|
885 |
+
*/
|
886 |
+
function shariff3uu_radio_align_render() {
|
887 |
+
$options = $GLOBALS['shariff3uu_design'];
|
888 |
+
if ( ! isset( $options['align'] ) ) {
|
889 |
+
$options['align'] = 'flex-start';
|
890 |
+
}
|
891 |
+
echo '<p><input type="radio" name="shariff3uu_design[align]" value="flex-start" ' . checked( $options['align'], 'flex-start', 0 ) . '>' . esc_html__( 'left', 'shariff' ) . '</p>';
|
892 |
+
echo '<p><input type="radio" name="shariff3uu_design[align]" value="center" ' . checked( $options['align'], 'center', 0 ) . '>' . esc_html__( 'center', 'shariff' ) . '</p>';
|
893 |
+
echo '<p><input type="radio" name="shariff3uu_design[align]" value="flex-end" ' . checked( $options['align'], 'flex-end', 0 ) . '>' . esc_html__( 'right', 'shariff' ) . '</p>';
|
894 |
+
}
|
895 |
+
|
896 |
+
/**
|
897 |
+
* Alignment widget.
|
898 |
+
*/
|
899 |
+
function shariff3uu_radio_align_widget_render() {
|
900 |
+
$options = $GLOBALS['shariff3uu_design'];
|
901 |
+
if ( ! isset( $options['align_widget'] ) ) {
|
902 |
+
$options['align_widget'] = 'flex-start';
|
903 |
+
}
|
904 |
+
echo '<p><input type="radio" name="shariff3uu_design[align_widget]" value="flex-start" ' . checked( $options['align_widget'], 'flex-start', 0 ) . '>' . esc_html__( 'left', 'shariff' ) . '</p>';
|
905 |
+
echo '<p><input type="radio" name="shariff3uu_design[align_widget]" value="center" ' . checked( $options['align_widget'], 'center', 0 ) . '>' . esc_html__( 'center', 'shariff' ) . '</p>';
|
906 |
+
echo '<p><input type="radio" name="shariff3uu_design[align_widget]" value="flex-end" ' . checked( $options['align_widget'], 'flex-end', 0 ) . '>' . esc_html__( 'right', 'shariff' ) . '</p>';
|
907 |
+
}
|
908 |
+
|
909 |
+
/**
|
910 |
+
* Headline.
|
911 |
+
*/
|
912 |
+
function shariff3uu_text_headline_render() {
|
913 |
+
if ( isset( $GLOBALS['shariff3uu_design']['headline'] ) ) {
|
914 |
+
$headline = $GLOBALS['shariff3uu_design']['headline'];
|
915 |
+
} else {
|
916 |
+
$headline = '';
|
917 |
+
}
|
918 |
+
echo '<input type="text" name="shariff3uu_design[headline]" value="' . esc_html( $headline ) . '" size="50" placeholder="' . esc_html__( 'Share this post', 'shariff' ) . '">';
|
919 |
+
echo '<p>';
|
920 |
+
echo esc_html__( 'Basic HTML as well as style and class attributes are allowed. You can use %total to show the total amount of shares.', 'shariff' );
|
921 |
+
echo '<br>';
|
922 |
+
echo esc_html__( 'Example:', 'shariff' );
|
923 |
+
echo '<code><h3 class="shariff_headline">';
|
924 |
+
echo esc_html__( 'Already shared %total times!', 'shariff' );
|
925 |
+
echo '</h3></code></p>';
|
926 |
+
}
|
927 |
+
|
928 |
+
/**
|
929 |
+
* Custom CSS.
|
930 |
+
*/
|
931 |
+
function shariff3uu_text_style_render() {
|
932 |
+
if ( isset( $GLOBALS['shariff3uu_design']['style'] ) ) {
|
933 |
+
$style = $GLOBALS['shariff3uu_design']['style'];
|
934 |
+
} else {
|
935 |
+
$style = '';
|
936 |
+
}
|
937 |
+
echo '<input type="text" name="shariff3uu_design[style]" value="' . esc_html( $style ) . '" size="50" placeholder="' . esc_attr__( 'More information in the FAQ.', 'shariff' ) . '">';
|
938 |
+
}
|
939 |
+
|
940 |
+
/**
|
941 |
+
* Custom CSS class.
|
942 |
+
*/
|
943 |
+
function shariff3uu_text_cssclass_render() {
|
944 |
+
if ( isset( $GLOBALS['shariff3uu_design']['cssclass'] ) ) {
|
945 |
+
$cssclass = $GLOBALS['shariff3uu_design']['cssclass'];
|
946 |
+
} else {
|
947 |
+
$cssclass = '';
|
948 |
+
}
|
949 |
+
echo '<input type="text" name="shariff3uu_design[cssclass]" value="' . esc_html( $cssclass ) . '" size="50" placeholder="' . esc_attr__( 'More information in the FAQ.', 'shariff' ) . '">';
|
950 |
+
}
|
951 |
+
|
952 |
+
/**
|
953 |
+
* Hide buttons until page is fully loaded.
|
954 |
+
*/
|
955 |
+
function shariff3uu_checkbox_hideuntilcss_render() {
|
956 |
+
echo '<input type="checkbox" name="shariff3uu_design[hideuntilcss]" ';
|
957 |
+
if ( isset( $GLOBALS['shariff3uu_design']['hideuntilcss'] ) ) {
|
958 |
+
echo checked( $GLOBALS['shariff3uu_design']['hideuntilcss'], 1, 0 );
|
959 |
+
}
|
960 |
+
echo ' value="1">';
|
961 |
+
}
|
962 |
+
|
963 |
+
/**
|
964 |
+
* Open links in a popup.
|
965 |
+
*/
|
966 |
+
function shariff3uu_checkbox_popup_render() {
|
967 |
+
echo '<input type="checkbox" name="shariff3uu_design[popup]" ';
|
968 |
+
if ( isset( $GLOBALS['shariff3uu_design']['popup'] ) ) {
|
969 |
+
echo checked( $GLOBALS['shariff3uu_design']['popup'], 1, 0 );
|
970 |
+
}
|
971 |
+
echo ' value="1">';
|
972 |
+
}
|
973 |
+
|
974 |
+
/** Advanced options */
|
975 |
+
|
976 |
+
/**
|
977 |
+
* Description of the advanced options.
|
978 |
+
*/
|
979 |
+
function shariff3uu_advanced_section_callback() {
|
980 |
+
esc_html_e( 'This configures the advanced options of Shariff regarding specific services. ', 'shariff' );
|
981 |
+
$help_link = get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page=shariff3uu&tab=help';
|
982 |
+
// Translators: %s will be replaced with the correct URL to the help section.
|
983 |
+
printf( wp_kses( __( 'For more information please take a look at the <a href="%s">Help Section</a>. ', 'shariff' ), array( 'a' => array( 'href' => true ) ) ), esc_url( $help_link ) );
|
984 |
+
// Translators: %s will be replaced with the correct URL to the wordpress.org support forum.
|
985 |
+
printf( wp_kses( __( 'You should also check out the <a href="%s" target="_blank">Support Forum</a>. ', 'shariff' ),
|
986 |
+
array(
|
987 |
+
'a' => array(
|
988 |
+
'href' => true,
|
989 |
+
'target' => true,
|
990 |
+
),
|
991 |
+
)
|
992 |
+
), 'https://wordpress.org/support/plugin/shariff/' );
|
993 |
+
}
|
994 |
+
|
995 |
+
/**
|
996 |
+
* Info URL.
|
997 |
+
*/
|
998 |
+
function shariff3uu_text_info_url_render() {
|
999 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['info_url'] ) ) {
|
1000 |
+
$info_url = $GLOBALS['shariff3uu_advanced']['info_url'];
|
1001 |
+
} else {
|
1002 |
+
$info_url = '';
|
1003 |
+
}
|
1004 |
+
echo '<input type="text" name="shariff3uu_advanced[info_url]" value="' . esc_html( $info_url ) . '" size="50" placeholder="https://ct.de/-2467514">';
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
/**
|
1008 |
+
* Info Text.
|
1009 |
+
*/
|
1010 |
+
function shariff3uu_text_info_text_render() {
|
1011 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['info_text'] ) ) {
|
1012 |
+
$info_text = $GLOBALS['shariff3uu_advanced']['info_text'];
|
1013 |
+
} else {
|
1014 |
+
$info_text = '';
|
1015 |
+
}
|
1016 |
+
echo '<input type="text" name="shariff3uu_advanced[info_text]" value="' . esc_html( $info_text ) . '" size="50" placeholder="' . esc_html__( 'More information about these buttons.', 'shariff' ) . '">';
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
/**
|
1020 |
+
* Twitter via attribute.
|
1021 |
+
*/
|
1022 |
+
function shariff3uu_text_twittervia_render() {
|
1023 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['twitter_via'] ) ) {
|
1024 |
+
$twitter_via = $GLOBALS['shariff3uu_advanced']['twitter_via'];
|
1025 |
+
} else {
|
1026 |
+
$twitter_via = '';
|
1027 |
+
}
|
1028 |
+
echo '<input type="text" name="shariff3uu_advanced[twitter_via]" value="' . esc_html( $twitter_via ) . '" size="50" placeholder="' . esc_html__( 'username', 'shariff' ) . '">';
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
/**
|
1032 |
+
* Flattr username.
|
1033 |
+
*/
|
1034 |
+
function shariff3uu_text_flattruser_render() {
|
1035 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['flattruser'] ) ) {
|
1036 |
+
$flattruser = $GLOBALS['shariff3uu_advanced']['flattruser'];
|
1037 |
+
} else {
|
1038 |
+
$flattruser = '';
|
1039 |
+
}
|
1040 |
+
echo '<input type="text" name="shariff3uu_advanced[flattruser]" value="' . esc_html( $flattruser ) . '" size="50" placeholder="' . esc_html__( 'username', 'shariff' ) . '">';
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
/**
|
1044 |
+
* Patreon username.
|
1045 |
+
*/
|
1046 |
+
function shariff3uu_text_patreonid_render() {
|
1047 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['patreonid'] ) ) {
|
1048 |
+
$patreonid = $GLOBALS['shariff3uu_advanced']['patreonid'];
|
1049 |
+
} else {
|
1050 |
+
$patreonid = '';
|
1051 |
+
}
|
1052 |
+
echo '<input type="text" name="shariff3uu_advanced[patreonid]" value="' . esc_html( $patreonid ) . '" size="50" placeholder="' . esc_html__( 'username', 'shariff' ) . '">';
|
1053 |
+
}
|
1054 |
+
|
1055 |
+
/**
|
1056 |
+
* PayPal Button ID.
|
1057 |
+
*/
|
1058 |
+
function shariff3uu_text_paypalbuttonid_render() {
|
1059 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['paypalbuttonid'] ) ) {
|
1060 |
+
$paypalbuttonid = $GLOBALS['shariff3uu_advanced']['paypalbuttonid'];
|
1061 |
+
} else {
|
1062 |
+
$paypalbuttonid = '';
|
1063 |
+
}
|
1064 |
+
echo '<input type="text" name="shariff3uu_advanced[paypalbuttonid]" value="' . esc_html( $paypalbuttonid ) . '" size="50" placeholder="1ABCDEF23GH4I">';
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
/**
|
1068 |
+
* PayPal.Me ID.
|
1069 |
+
*/
|
1070 |
+
function shariff3uu_text_paypalmeid_render() {
|
1071 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['paypalmeid'] ) ) {
|
1072 |
+
$paypalmeid = $GLOBALS['shariff3uu_advanced']['paypalmeid'];
|
1073 |
+
} else {
|
1074 |
+
$paypalmeid = '';
|
1075 |
+
}
|
1076 |
+
echo '<input type="text" name="shariff3uu_advanced[paypalmeid]" value="' . esc_html( $paypalmeid ) . '" size="50" placeholder="' . esc_html__( 'name', 'shariff' ) . '">';
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
/**
|
1080 |
+
* Bitcoin address.
|
1081 |
+
*/
|
1082 |
+
function shariff3uu_text_bitcoinaddress_render() {
|
1083 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['bitcoinaddress'] ) ) {
|
1084 |
+
$bitcoinaddress = $GLOBALS['shariff3uu_advanced']['bitcoinaddress'];
|
1085 |
+
} else {
|
1086 |
+
$bitcoinaddress = '';
|
1087 |
+
}
|
1088 |
+
echo '<input type="text" name="shariff3uu_advanced[bitcoinaddress]" value="' . esc_html( $bitcoinaddress ) . '" size="50" placeholder="1Ab2CdEfGhijKL34mnoPQRSTu5VwXYzaBcD">';
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
/**
|
1092 |
+
* RSS feed.
|
1093 |
+
*/
|
1094 |
+
function shariff3uu_text_rssfeed_render() {
|
1095 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['rssfeed'] ) ) {
|
1096 |
+
$rssfeed = $GLOBALS['shariff3uu_advanced']['rssfeed'];
|
1097 |
+
} else {
|
1098 |
+
$rssfeed = '';
|
1099 |
+
}
|
1100 |
+
$rssdefault = get_bloginfo( 'rss_url' );
|
1101 |
+
echo '<input type="text" name="shariff3uu_advanced[rssfeed]" value="' . esc_url( $rssfeed ) . '" size="50" placeholder="' . esc_url( $rssdefault ) . '">';
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
/**
|
1105 |
+
* Pinterest Default Image.
|
1106 |
+
*/
|
1107 |
+
function shariff3uu_text_default_pinterest_render() {
|
1108 |
+
$options = $GLOBALS['shariff3uu_advanced'];
|
1109 |
+
if ( ! isset( $options['default_pinterest'] ) ) {
|
1110 |
+
$options['default_pinterest'] = '';
|
1111 |
+
}
|
1112 |
+
echo '<div><input type="text" name="shariff3uu_advanced[default_pinterest]" value="' . esc_url( $options['default_pinterest'] ) . '" id="shariff-image-url" class="regular-text"><input type="button" name="upload-btn" id="shariff-upload-btn" class="button-secondary" value="' . esc_html__( 'Choose image', 'shariff' ) . '"></div>';
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
/**
|
1116 |
+
* Shortcode Priority.
|
1117 |
+
*/
|
1118 |
+
function shariff3uu_number_shortcodeprio_render() {
|
1119 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['shortcodeprio'] ) ) {
|
1120 |
+
$prio = $GLOBALS['shariff3uu_advanced']['shortcodeprio'];
|
1121 |
+
} else {
|
1122 |
+
$prio = '';
|
1123 |
+
}
|
1124 |
+
echo '<input type="number" name="shariff3uu_advanced[shortcodeprio]" value="' . esc_html( $prio ) . '" maxlength="2" min="0" max="20" placeholder="10" style="width: 75px">';
|
1125 |
+
echo '<p>' . esc_html__( 'Warning: DO NOT change this unless you know what you are doing or have been told so by the plugin author!', 'shariff' ) . '</p>';
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
/**
|
1129 |
+
* Disable metabox.
|
1130 |
+
*/
|
1131 |
+
function shariff3uu_checkbox_disable_metabox_render() {
|
1132 |
+
echo '<input type="checkbox" name="shariff3uu_advanced[disable_metabox]" ';
|
1133 |
+
if ( isset( $GLOBALS['shariff3uu_advanced']['disable_metabox'] ) ) {
|
1134 |
+
echo checked( $GLOBALS['shariff3uu_advanced']['disable_metabox'], 1, 0 );
|
1135 |
+
}
|
1136 |
+
echo ' value="1">';
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
/** Statistic section */
|
1140 |
+
|
1141 |
+
/**
|
1142 |
+
* Description statistic options.
|
1143 |
+
*/
|
1144 |
+
function shariff3uu_statistic_section_callback() {
|
1145 |
+
echo esc_html__( 'This determines how share counts are handled by Shariff.', 'shariff' );
|
1146 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['external_direct'] ) ) {
|
1147 |
+
echo '<br><span style="color:red;font-weight:bold;">';
|
1148 |
+
echo esc_html__( 'Warning: ', 'shariff' );
|
1149 |
+
echo '</span>';
|
1150 |
+
echo esc_html__( 'You entered an external API and chose to call it directly! Therefore, all options and features (e.g. the ranking tab) regarding the statistic have no effect. You need to configure them on the external server. Remember: This feature is still experimental!', 'shariff' );
|
1151 |
+
}
|
1152 |
+
// Hook to add or remove cron job.
|
1153 |
+
do_action( 'shariff3uu_save_statistic_options' );
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
/**
|
1157 |
+
* Enable Statistic.
|
1158 |
+
*/
|
1159 |
+
function shariff3uu_checkbox_backend_render() {
|
1160 |
+
// Check WP version.
|
1161 |
+
if ( version_compare( get_bloginfo( 'version' ), '4.4.0' ) < 1 ) {
|
1162 |
+
echo esc_html__( 'WordPress-Version 4.4 or better is required to enable the statistic / share count functionality.', 'shariff' );
|
1163 |
+
} else {
|
1164 |
+
echo '<input type="checkbox" name="shariff3uu_statistic[backend]" ';
|
1165 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['backend'] ) ) {
|
1166 |
+
echo checked( $GLOBALS['shariff3uu_statistic']['backend'], 1, 0 );
|
1167 |
+
}
|
1168 |
+
echo ' value="1">';
|
1169 |
+
}
|
1170 |
+
}
|
1171 |
+
|
1172 |
+
/**
|
1173 |
+
* Share Counts On Buttons.
|
1174 |
+
*/
|
1175 |
+
function shariff3uu_checkbox_sharecounts_render() {
|
1176 |
+
echo '<input type="checkbox" name="shariff3uu_statistic[sharecounts]" ';
|
1177 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['sharecounts'] ) ) {
|
1178 |
+
echo checked( $GLOBALS['shariff3uu_statistic']['sharecounts'], 1, 0 );
|
1179 |
+
}
|
1180 |
+
echo ' value="1">';
|
1181 |
+
if ( ! isset( $GLOBALS['shariff3uu_statistic']['backend'] ) && isset( $GLOBALS['shariff3uu_statistic']['sharecounts'] ) ) {
|
1182 |
+
echo ' ';
|
1183 |
+
echo esc_html__( 'Warning: The statistic functionality must be enabled in order for the share counts to be shown.', 'shariff' );
|
1184 |
+
}
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
/**
|
1188 |
+
* Hide when zero.
|
1189 |
+
*/
|
1190 |
+
function shariff3uu_checkbox_hidezero_render() {
|
1191 |
+
echo '<input type="checkbox" name="shariff3uu_statistic[hidezero]" ';
|
1192 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['hidezero'] ) ) {
|
1193 |
+
echo checked( $GLOBALS['shariff3uu_statistic']['hidezero'], 1, 0 );
|
1194 |
+
}
|
1195 |
+
echo ' value="1">';
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
/**
|
1199 |
+
* Ranking.
|
1200 |
+
*/
|
1201 |
+
function shariff3uu_number_ranking_render() {
|
1202 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['ranking'] ) ) {
|
1203 |
+
$numberposts = $GLOBALS['shariff3uu_statistic']['ranking'];
|
1204 |
+
} else {
|
1205 |
+
$numberposts = '';
|
1206 |
+
}
|
1207 |
+
echo '<input type="number" name="shariff3uu_statistic[ranking]" value="' . esc_html( $numberposts ) . '" maxlength="4" min="0" max="10000" placeholder="100" style="width: 75px">';
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
/**
|
1211 |
+
* Automatic cache.
|
1212 |
+
*/
|
1213 |
+
function shariff3uu_checkbox_automaticcache_render() {
|
1214 |
+
echo '<input type="checkbox" name="shariff3uu_statistic[automaticcache]" ';
|
1215 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['automaticcache'] ) ) {
|
1216 |
+
echo checked( $GLOBALS['shariff3uu_statistic']['automaticcache'], 1, 0 );
|
1217 |
+
}
|
1218 |
+
echo ' value="1">';
|
1219 |
+
}
|
1220 |
+
|
1221 |
+
/**
|
1222 |
+
* Facebook App ID.
|
1223 |
+
*/
|
1224 |
+
function shariff3uu_text_fb_id_render() {
|
1225 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['fb_id'] ) ) {
|
1226 |
+
$fb_id = $GLOBALS['shariff3uu_statistic']['fb_id'];
|
1227 |
+
} else {
|
1228 |
+
$fb_id = '';
|
1229 |
+
}
|
1230 |
+
echo '<input type="text" name="shariff3uu_statistic[fb_id]" value="' . esc_html( $fb_id ) . '" size="50" placeholder="1234567891234567">';
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
/**
|
1234 |
+
* Facebook App Secret.
|
1235 |
+
*/
|
1236 |
+
function shariff3uu_text_fb_secret_render() {
|
1237 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['fb_secret'] ) ) {
|
1238 |
+
$fb_secret = $GLOBALS['shariff3uu_statistic']['fb_secret'];
|
1239 |
+
} else {
|
1240 |
+
$fb_secret = '';
|
1241 |
+
}
|
1242 |
+
echo '<input type="text" name="shariff3uu_statistic[fb_secret]" value="' . esc_html( $fb_secret ) . '" size="50" placeholder="123abc456def789123456789ghi12345">';
|
1243 |
+
}
|
1244 |
+
|
1245 |
+
/**
|
1246 |
+
* TTL.
|
1247 |
+
*/
|
1248 |
+
function shariff3uu_number_ttl_render() {
|
1249 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['ttl'] ) ) {
|
1250 |
+
$ttl = $GLOBALS['shariff3uu_statistic']['ttl'];
|
1251 |
+
} else {
|
1252 |
+
$ttl = '';
|
1253 |
+
}
|
1254 |
+
echo '<input type="number" name="shariff3uu_statistic[ttl]" value="' . esc_html( $ttl ) . '" maxlength="4" min="60" max="7200" placeholder="60" style="width: 75px">';
|
1255 |
+
}
|
1256 |
+
|
1257 |
+
/**
|
1258 |
+
* Disable dynamic cache lifespan.
|
1259 |
+
*/
|
1260 |
+
function shariff3uu_checkbox_disable_dynamic_cache_render() {
|
1261 |
+
echo '<input type="checkbox" name="shariff3uu_statistic[disable_dynamic_cache]" ';
|
1262 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['disable_dynamic_cache'] ) ) {
|
1263 |
+
echo checked( $GLOBALS['shariff3uu_statistic']['disable_dynamic_cache'], 1, 0 );
|
1264 |
+
}
|
1265 |
+
echo ' value="1">';
|
1266 |
+
}
|
1267 |
+
|
1268 |
+
/**
|
1269 |
+
* Twitter NewShareCount.
|
1270 |
+
*/
|
1271 |
+
function shariff3uu_checkbox_newsharecount_render() {
|
1272 |
+
echo '<input type="checkbox" name="shariff3uu_statistic[newsharecount]" ';
|
1273 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['newsharecount'] ) ) {
|
1274 |
+
echo checked( $GLOBALS['shariff3uu_statistic']['newsharecount'], 1, 0 );
|
1275 |
+
}
|
1276 |
+
echo ' value="1">';
|
1277 |
+
}
|
1278 |
+
/**
|
1279 |
+
* Disable services.
|
1280 |
+
*/
|
1281 |
+
function shariff3uu_multiplecheckbox_disable_services_render() {
|
1282 |
+
// Loop through all services with a backend.
|
1283 |
+
foreach ( $GLOBALS['shariff3uu_services_backend'] as $service ) {
|
1284 |
+
// Capitalize service name.
|
1285 |
+
$service_name = ucfirst( $service );
|
1286 |
+
// Add option.
|
1287 |
+
echo '<p><input type="checkbox" name="shariff3uu_statistic[disable][' . esc_html( $service ) . ']" ';
|
1288 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['disable'][ $service ] ) ) {
|
1289 |
+
echo checked( $GLOBALS['shariff3uu_statistic']['disable'][ $service ], 1, 0 );
|
1290 |
+
}
|
1291 |
+
echo ' value="1">' . esc_html( $service_name ) . '</p>';
|
1292 |
+
}
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
/**
|
1296 |
+
* External host.
|
1297 |
+
*/
|
1298 |
+
function shariff3uu_text_external_host_render() {
|
1299 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['external_host'] ) ) {
|
1300 |
+
$external_host = $GLOBALS['shariff3uu_statistic']['external_host'];
|
1301 |
+
} else {
|
1302 |
+
$external_host = '';
|
1303 |
+
}
|
1304 |
+
echo '<input type="text" name="shariff3uu_statistic[external_host]" value="' . esc_html( $external_host ) . '" size="50" placeholder="' . esc_url( get_bloginfo( 'url' ) ) . '/wp-json/shariff/v1/share_counts">';
|
1305 |
+
echo '<p>' . wp_kses( __( 'Warning: This is an experimental feature. Please read the <a href="https://wordpress.org/plugins/shariff/faq/" target="_blank">Frequently Asked Questions (FAQ)</a>.', 'shariff' ),
|
1306 |
+
array(
|
1307 |
+
'a' => array(
|
1308 |
+
'href' => true,
|
1309 |
+
'target' => true,
|
1310 |
+
),
|
1311 |
+
)
|
1312 |
+
) . '</p>';
|
1313 |
+
echo '<p>' . esc_html__( 'Please check, if you have to add this domain to the array $SHARIFF_FRONTENDS on the external server.', 'shariff' ) . '</p>';
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
/**
|
1317 |
+
* Direct external api call from JS.
|
1318 |
+
*/
|
1319 |
+
function shariff3uu_checkbox_external_direct_render() {
|
1320 |
+
echo '<input type="checkbox" name="shariff3uu_statistic[external_direct]" ';
|
1321 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['external_direct'] ) ) {
|
1322 |
+
echo checked( $GLOBALS['shariff3uu_statistic']['external_direct'], 1, 0 );
|
1323 |
+
}
|
1324 |
+
echo ' value="1">';
|
1325 |
+
echo '<p>' . esc_html__( 'Please check, if you have correctly set the Access-Control-Allow-Origin header!', 'shariff' ) . '</p>';
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
/**
|
1329 |
+
* Local API only reachable in subfolder.
|
1330 |
+
*/
|
1331 |
+
function shariff3uu_checkbox_subapi_render() {
|
1332 |
+
echo '<input type="checkbox" name="shariff3uu_statistic[subapi]" ';
|
1333 |
+
if ( isset( $GLOBALS['shariff3uu_statistic']['subapi'] ) ) {
|
1334 |
+
echo checked( $GLOBALS['shariff3uu_statistic']['subapi'], 1, 0 );
|
1335 |
+
}
|
1336 |
+
echo ' value="1">';
|
1337 |
+
}
|
1338 |
+
|
1339 |
+
/**
|
1340 |
+
* Help section.
|
1341 |
+
*/
|
1342 |
+
function shariff3uu_help_section_callback() {
|
1343 |
+
echo '<p>';
|
1344 |
+
// Translators: %1$s and %2$s will be replaced with the correct URLs to the authors websites.
|
1345 |
+
printf( wp_kses( __( 'The WordPress plugin "Shariff Wrapper" has been developed by <a href="%1$s" target="_blank">Jan-Peter Lambeck</a> and <a href="%2$s" target="_blank">3UU</a> in order to help protect the privacy of your visitors. ', 'shariff' ),
|
1346 |
+
array(
|
1347 |
+
'a' => array(
|
1348 |
+
'href' => true,
|
1349 |
+
'target' => true,
|
1350 |
+
),
|
1351 |
+
)
|
1352 |
+
), 'https://www.jplambeck.de', 'https://datenverwurstungszentrale.com' );
|
1353 |
+
echo ' ';
|
1354 |
+
// Translators: %s will be replaced with the correct URL to the German computer magazine.
|
1355 |
+
printf( wp_kses( __( 'It is based on the original Shariff buttons developed by the German computer magazine <a href="%s" target="_blank">c\'t</a> that are compliant to the General Data Protection Regulation (GDPR) (Regulation (EU) 2016/679).', 'shariff' ),
|
1356 |
+
array(
|
1357 |
+
'a' => array(
|
1358 |
+
'href' => true,
|
1359 |
+
'target' => true,
|
1360 |
+
),
|
1361 |
+
)
|
1362 |
+
), 'https://ct.de/-2467514' );
|
1363 |
+
echo ' ';
|
1364 |
+
// Translators: %1$s and %2$s will be replaced with the correct URLs to FAQ and the forum on wordpress.org.
|
1365 |
+
printf( wp_kses( __( 'If you need any help with the plugin, take a look at the <a href="%1$s" target="_blank">Frequently Asked Questions (FAQ)</a> and the <a href="%2$s" target="_blank">Support Forum</a> on wordpress.org. ', 'shariff' ),
|
1366 |
+
array(
|
1367 |
+
'a' => array(
|
1368 |
+
'href' => true,
|
1369 |
+
'target' => true,
|
1370 |
+
),
|
1371 |
+
)
|
1372 |
+
), 'https://wordpress.org/plugins/shariff/#faq', 'https://wordpress.org/support/plugin/shariff' );
|
1373 |
+
echo '</p>';
|
1374 |
+
echo '<p>';
|
1375 |
+
// Translators: %s will be replaced with the correct URL to the authors twitter account.
|
1376 |
+
printf( wp_kses( __( 'You can also follow <a href="%s" target=_blank">@jplambeck</a> on Twitter.', 'shariff' ),
|
1377 |
+
array(
|
1378 |
+
'a' => array(
|
1379 |
+
'href' => true,
|
1380 |
+
'target' => true,
|
1381 |
+
),
|
1382 |
+
)
|
1383 |
+
), 'https://twitter.com/jplambeck' );
|
1384 |
+
echo '</p>';
|
1385 |
+
echo '<p>';
|
1386 |
+
// Translators: %s will be replaced with the correct URL to the wordpress.org review page.
|
1387 |
+
printf( wp_kses( __( 'If you enjoy our plugin, please consider writing a review about it on <a href="%s" target="_blank">wordpress.org</a>.', 'shariff' ),
|
1388 |
+
array(
|
1389 |
+
'a' => array(
|
1390 |
+
'href' => true,
|
1391 |
+
'target' => true,
|
1392 |
+
),
|
1393 |
+
)
|
1394 |
+
), 'https://wordpress.org/support/view/plugin-reviews/shariff' );
|
1395 |
+
echo '</p>';
|
1396 |
+
echo '<p>';
|
1397 |
+
echo wp_kses( __( 'This is a list of all available options for the <code>[shariff]</code> shortcode:', 'shariff' ), array( 'code' => array() ) );
|
1398 |
+
echo '</p>';
|
1399 |
+
// Shortcode table.
|
1400 |
+
echo '<div style="display:table;background-color:#fff">';
|
1401 |
+
// Head.
|
1402 |
+
echo '<div style="display:table-row">';
|
1403 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . esc_html__( 'Name', 'shariff' ) . '</div>';
|
1404 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . esc_html__( 'Options', 'shariff' ) . '</div>';
|
1405 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . esc_html__( 'Default', 'shariff' ) . '</div>';
|
1406 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . esc_html__( 'Example', 'shariff' ) . '</div>';
|
1407 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . esc_html__( 'Description', 'shariff' ) . '</div>';
|
1408 |
+
echo '</div>';
|
1409 |
+
// Services.
|
1410 |
+
echo '<div style="display:table-row">';
|
1411 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">services</div>';
|
1412 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">addthis<br>bitcoin<br>diaspora<br>facebook<br>flattr<br>flipboard<br>googleplus<br>info<br>linkedin<br>mailto<br>mastodon<br>odnoklassniki<br>patreon<br>paypal<br>paypalme<br>pinterest<br>pocket<br>printer<br>qzone<br>reddit<br>rss<br>sms<br>stumbleupon<br>telegram<br>tencentweibo<br>threema<br>tumblr<br>twitter<br>vk<br>wallabag<br>weibo<br>whatsapp<br>xing</div>';
|
1413 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">twitter|facebook|googleplus|info</div>';
|
1414 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff services="facebook|twitter|mailto"]</div>';
|
1415 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Determines which buttons to show and in which order.', 'shariff' ) . '</div>';
|
1416 |
+
echo '</div>';
|
1417 |
+
// Backend.
|
1418 |
+
echo '<div style="display:table-row">';
|
1419 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">backend</div>';
|
1420 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">on<br>off</div>';
|
1421 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">off</div>';
|
1422 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff backend="on"]</div>';
|
1423 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Enables share counts on the buttons.', 'shariff' ) . '</div>';
|
1424 |
+
echo '</div>';
|
1425 |
+
// Theme.
|
1426 |
+
echo '<div style="display:table-row">';
|
1427 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">theme</div>';
|
1428 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">default<br>color<br>grey<br>white<br>round</div>';
|
1429 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">default</div>';
|
1430 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff theme="round"]</div>';
|
1431 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Determines the main design of the buttons.', 'shariff' ) . '</div>';
|
1432 |
+
echo '</div>';
|
1433 |
+
// Buttonsize.
|
1434 |
+
echo '<div style="display:table-row">';
|
1435 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">buttonsize</div>';
|
1436 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">small<br>medium<br>large</div>';
|
1437 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">medium</div>';
|
1438 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff buttonsize="small"]</div>';
|
1439 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Determines the button size regardless of theme choice.', 'shariff' ) . '</div>';
|
1440 |
+
echo '</div>';
|
1441 |
+
// Buttonstretch.
|
1442 |
+
echo '<div style="display:table-row">';
|
1443 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">buttonstretch</div>';
|
1444 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">0<br>1</div>';
|
1445 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">0</div>';
|
1446 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff buttonstretch="1"]</div>';
|
1447 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Stretch buttons horizontally to full width.', 'shariff' ) . '</div>';
|
1448 |
+
echo '</div>';
|
1449 |
+
// Borderradius.
|
1450 |
+
echo '<div style="display:table-row">';
|
1451 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">borderradius</div>';
|
1452 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">1-50</div>';
|
1453 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">50</div>';
|
1454 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff borderradius="1"]</div>';
|
1455 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the border radius for the round theme. 1 essentially equals a square.', 'shariff' ) . '</div>';
|
1456 |
+
echo '</div>';
|
1457 |
+
// Maincolor.
|
1458 |
+
echo '<div style="display:table-row">';
|
1459 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">maincolor</div>';
|
1460 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1461 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1462 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff maincolor="#000"]</div>';
|
1463 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets a custom main color for all buttons (hexadecimal).', 'shariff' ) . '</div>';
|
1464 |
+
echo '</div>';
|
1465 |
+
// Secondarycolor.
|
1466 |
+
echo '<div style="display:table-row">';
|
1467 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">secondarycolor</div>';
|
1468 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1469 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1470 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff secondarycolor="#afafaf"]</div>';
|
1471 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets a custom secondary color for all buttons (hexadecimal). The secondary color is, depending on theme, used for hover effects.', 'shariff' ) . '</div>';
|
1472 |
+
echo '</div>';
|
1473 |
+
// Orientation.
|
1474 |
+
echo '<div style="display:table-row">';
|
1475 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">orientation</div>';
|
1476 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">horizontal<br>vertical</div>';
|
1477 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">horizontal</div>';
|
1478 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff orientation="vertical"]</div>';
|
1479 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Changes the orientation of the buttons.', 'shariff' ) . '</div>';
|
1480 |
+
echo '</div>';
|
1481 |
+
// Alignment.
|
1482 |
+
echo '<div style="display:table-row">';
|
1483 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">align</div>';
|
1484 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">flex-start<br>center<br>flex-end</div>';
|
1485 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">flex-start</div>';
|
1486 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff align="center"]</div>';
|
1487 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Changes the horizontal alignment of the buttons. flex-start means left, center is obvious and flex-end means right.', 'shariff' ) . '</div>';
|
1488 |
+
echo '</div>';
|
1489 |
+
// Language.
|
1490 |
+
echo '<div style="display:table-row">';
|
1491 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">language</div>';
|
1492 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">da, de, en, es, fi, fr, hr, hu, it, ja, ko, nl, no, pl, pt, ro, ru, sk, sl, sr, sv, tr, zh</div>';
|
1493 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Automatically selected by browser.', 'shariff' ) . '</div>';
|
1494 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff lang="de"]</div>';
|
1495 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Changes the language of the share buttons.', 'shariff' ) . '</div>';
|
1496 |
+
echo '</div>';
|
1497 |
+
// Headline.
|
1498 |
+
echo '<div style="display:table-row">';
|
1499 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">headline</div>';
|
1500 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1501 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1502 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff headline="<hr style=\'margin:20px 0\'><p>' . esc_html__( 'Please share this post', 'shariff' ) . '</p>"]</div>';
|
1503 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Adds a headline above the Shariff buttons. Basic HTML as well as style and class attributes can be used. To remove a headline set on the plugins options page use headline="".', 'shariff' ) . '</div>';
|
1504 |
+
echo '</div>';
|
1505 |
+
// Style.
|
1506 |
+
echo '<div style="display:table-row">';
|
1507 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">style</div>';
|
1508 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1509 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1510 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff style="margin:20px;"]</div>';
|
1511 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Adds custom style attributes to the container around Shariff.', 'shariff' ) . '</div>';
|
1512 |
+
echo '</div>';
|
1513 |
+
// CSS class.
|
1514 |
+
echo '<div style="display:table-row">';
|
1515 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">cssclass</div>';
|
1516 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1517 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1518 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff class="classname"]</div>';
|
1519 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Adds a custom class to the container around Shariff.', 'shariff' ) . '</div>';
|
1520 |
+
echo '</div>';
|
1521 |
+
// Twitter_via.
|
1522 |
+
echo '<div style="display:table-row">';
|
1523 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">twitter_via</div>';
|
1524 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1525 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1526 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff twitter_via="your_twittername"]</div>';
|
1527 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the Twitter via tag.', 'shariff' ) . '</div>';
|
1528 |
+
echo '</div>';
|
1529 |
+
// Flattruser.
|
1530 |
+
echo '<div style="display:table-row">';
|
1531 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">flattruser</div>';
|
1532 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1533 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1534 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff flattruser="your_username"]</div>';
|
1535 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the Flattr username.', 'shariff' ) . '</div>';
|
1536 |
+
echo '</div>';
|
1537 |
+
// Patreonid.
|
1538 |
+
echo '<div style="display:table-row">';
|
1539 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">patreonid</div>';
|
1540 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1541 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1542 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff patreonid="your_username"]</div>';
|
1543 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the Patreon username.', 'shariff' ) . '</div>';
|
1544 |
+
echo '</div>';
|
1545 |
+
// Paypalbuttonid.
|
1546 |
+
echo '<div style="display:table-row">';
|
1547 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">paypalbuttonid</div>';
|
1548 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1549 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1550 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff paypalbuttonid="hosted_button_id"]</div>';
|
1551 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the PayPal hosted button ID.', 'shariff' ) . '</div>';
|
1552 |
+
echo '</div>';
|
1553 |
+
// Paypalmeid.
|
1554 |
+
echo '<div style="display:table-row">';
|
1555 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">paypalmeid</div>';
|
1556 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1557 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1558 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff paypalmeid="name"]</div>';
|
1559 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the PayPal.Me ID. Default amount can be added with a / e.g. name/25.', 'shariff' ) . '</div>';
|
1560 |
+
echo '</div>';
|
1561 |
+
// Bitcoinaddress.
|
1562 |
+
echo '<div style="display:table-row">';
|
1563 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">bitcoinaddress</div>';
|
1564 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1565 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1566 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff bitcoinaddress="bitcoin_address"]</div>';
|
1567 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the bitcoin address.', 'shariff' ) . '</div>';
|
1568 |
+
echo '</div>';
|
1569 |
+
// Media.
|
1570 |
+
echo '<div style="display:table-row">';
|
1571 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">media</div>';
|
1572 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1573 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'The post featured image or the first image of the post.', 'shariff' ) . '</div>';
|
1574 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff media="http://www.mydomain.com/image.jpg"]</div>';
|
1575 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Determines the default image to share for Pinterest, if no other usable image is found.', 'shariff' ) . '</div>';
|
1576 |
+
echo '</div>';
|
1577 |
+
// Info_URL.
|
1578 |
+
echo '<div style="display:table-row">';
|
1579 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">info_url</div>';
|
1580 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1581 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">http://ct.de/-2467514</div>';
|
1582 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff info_url="http://www.mydomain.com/shariff-buttons"]</div>';
|
1583 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets a custom link for the info button.', 'shariff' ) . '</div>';
|
1584 |
+
echo '</div>';
|
1585 |
+
// Info_Text.
|
1586 |
+
echo '<div style="display:table-row">';
|
1587 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">info_text</div>';
|
1588 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1589 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'More information about these buttons.', 'shariff' ) . '</div>';
|
1590 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff info_text="' . esc_html__( 'My custom text.', 'shariff' ) . '"]</div>';
|
1591 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets a custom text for the info button.', 'shariff' ) . '</div>';
|
1592 |
+
echo '</div>';
|
1593 |
+
// URL.
|
1594 |
+
echo '<div style="display:table-row">';
|
1595 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">url</div>';
|
1596 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1597 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'The url of the current post or page.', 'shariff' ) . '</div>';
|
1598 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff url="http://www.mydomain.com/somepost"]</div>';
|
1599 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Changes the url to share. Only for special use cases.', 'shariff' ) . '</div>';
|
1600 |
+
echo '</div>';
|
1601 |
+
// Title.
|
1602 |
+
echo '<div style="display:table-row">';
|
1603 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">title</div>';
|
1604 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1605 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'The title of the current post or page.', 'shariff' ) . '</div>';
|
1606 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff title="' . esc_html__( 'My Post Title', 'shariff' ) . '"]</div>';
|
1607 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Changes the title to share. Only for special use cases.', 'shariff' ) . '</div>';
|
1608 |
+
echo '</div>';
|
1609 |
+
// Timestamp.
|
1610 |
+
echo '<div style="display:table-row">';
|
1611 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">timestamp</div>';
|
1612 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1613 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'The timestamp of the last modification of the current post or page.', 'shariff' ) . '</div>';
|
1614 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff timestamp="1473240010"]</div>';
|
1615 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Provides the time the current post or page was last modified as a timestamp. Used for determining the dynamic cache lifespan. Only for special use cases.', 'shariff' ) . '</div>';
|
1616 |
+
echo '</div>';
|
1617 |
+
// RSS feed.
|
1618 |
+
echo '<div style="display:table-row">';
|
1619 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">rssfeed</div>';
|
1620 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1621 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">http://www.mydomain.com/feed/rss/</div>';
|
1622 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff rssfeed="http://www.mydomain.com/feed/rss2/"]</div>';
|
1623 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Changes the rss feed url to another feed.', 'shariff' ) . '</div>';
|
1624 |
+
echo '</div>';
|
1625 |
+
|
1626 |
+
echo '</div>';
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
/**
|
1630 |
+
* Status section.
|
1631 |
+
*/
|
1632 |
+
function shariff3uu_status_section_callback() {
|
1633 |
+
// Get options.
|
1634 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
1635 |
+
|
1636 |
+
// Begin status table.
|
1637 |
+
echo '<div style="display:table;border-spacing:10px;margin:-10px 0 0 -10px">';
|
1638 |
+
|
1639 |
+
// Begin statistic row.
|
1640 |
+
echo '<div style="display:table-row">';
|
1641 |
+
echo '<div style="display:table-cell;width:125px">' . esc_html__( 'Statistic:', 'shariff' ) . '</div>';
|
1642 |
+
|
1643 |
+
// Check if statistic is enabled.
|
1644 |
+
if ( ! isset( $shariff3uu['backend'] ) ) {
|
1645 |
+
// Statistic disabled message.
|
1646 |
+
echo '<div style="display:table">';
|
1647 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold">' . esc_html__( 'Disabled', 'shariff' ) . '</div></div>';
|
1648 |
+
echo '</div>';
|
1649 |
+
// End statistic row, if statistic is disabled.
|
1650 |
+
echo '</div>';
|
1651 |
+
} else {
|
1652 |
+
// Encode shareurl.
|
1653 |
+
$post_url = rawurlencode( esc_url( get_bloginfo( 'url' ) ) );
|
1654 |
+
$post_url_raw = esc_url( get_bloginfo( 'url' ) );
|
1655 |
+
|
1656 |
+
// We only need the backend part.
|
1657 |
+
$backend = 1;
|
1658 |
+
|
1659 |
+
// But we also want error messages.
|
1660 |
+
$record_errors = 1;
|
1661 |
+
|
1662 |
+
// Avoid debug messages.
|
1663 |
+
$service_errors = array();
|
1664 |
+
|
1665 |
+
// Loop through all desired services.
|
1666 |
+
foreach ( $GLOBALS['shariff3uu_services_backend'] as $service ) {
|
1667 |
+
// Include service parameters.
|
1668 |
+
if ( ! isset( $shariff3uu['disable'][ $service ] ) || ( isset( $shariff3uu['disable'][ $service ] ) && 0 === $shariff3uu['disable'][ $service ] ) ) {
|
1669 |
+
include plugin_dir_path( __FILE__ ) . '../services/shariff-' . $service . '.php';
|
1670 |
+
}
|
1671 |
+
}
|
1672 |
+
|
1673 |
+
// General statistic status.
|
1674 |
+
echo '<div style="display:table-cell">';
|
1675 |
+
echo '<div style="display:table">';
|
1676 |
+
if ( empty( $service_errors ) ) {
|
1677 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:green">' . esc_html__( 'OK', 'shariff' ) . '</div></div>';
|
1678 |
+
echo '<div style="display:table-row"><div style="display:table-cell">' . esc_html__( 'No error messages.', 'shariff' ) . '</div></div>';
|
1679 |
+
} elseif ( array_filter( $service_errors ) ) {
|
1680 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:red">' . esc_html__( 'Error', 'shariff' ) . '</div></div>';
|
1681 |
+
echo '<div style="display:table-row"><div style="display:table-cell">' . esc_html__( 'One or more services reported an error.', 'shariff' ) . '</div></div>';
|
1682 |
+
} else {
|
1683 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:orange">' . esc_html__( 'Timeout', 'shariff' ) . '</div></div>';
|
1684 |
+
echo '<div style="display:table-row"><div style="display:table-cell">' . esc_html__( 'One or more services didn\'t respond in less than five seconds.', 'shariff' ) . '</div></div>';
|
1685 |
+
}
|
1686 |
+
echo '<div style="display:table-row"><div style="display:table-cell"></div></div>';
|
1687 |
+
echo '</div>';
|
1688 |
+
echo '</div>';
|
1689 |
+
|
1690 |
+
// End statistic row.
|
1691 |
+
echo '</div>';
|
1692 |
+
|
1693 |
+
// Output all services.
|
1694 |
+
foreach ( $GLOBALS['shariff3uu_services_backend'] as $service ) {
|
1695 |
+
// Begin service row.
|
1696 |
+
echo '<div style="display:table-row">';
|
1697 |
+
echo '<div class="shariff_status-first-cell">' . esc_html( ucfirst( $service ) ) . ':</div>';
|
1698 |
+
echo '<div style="display:table-cell">';
|
1699 |
+
echo '<div class="shariff_status-table">';
|
1700 |
+
if ( isset( $shariff3uu['disable'][ $service ] ) && 1 === $shariff3uu['disable'][ $service ] ) {
|
1701 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold">' . esc_html__( 'Disabled', 'shariff' ) . '</div></div>';
|
1702 |
+
} elseif ( ! array_key_exists( $service, $service_errors ) ) {
|
1703 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:green">' . esc_html__( 'OK', 'shariff' ) . '</div></div>';
|
1704 |
+
echo '<div style="display:table-row"><div style="display:table-cell">' . esc_html__( 'Share Count:', 'shariff' ) . ' ' . absint( $share_counts[ $service ] ) . '</div></div>';
|
1705 |
+
} elseif ( empty( $service_errors[ $service ] ) ) {
|
1706 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:orange">' . esc_html__( 'Timeout', 'shariff' ) . '</div></div>';
|
1707 |
+
echo '<div style="display:table-row"><div style="display:table-cell">';
|
1708 |
+
echo esc_html__( 'Service didn\'t respond in less than five seconds.', 'shariff' );
|
1709 |
+
echo '</div></div>';
|
1710 |
+
} else {
|
1711 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:#ff0000">' . esc_html__( 'Error', 'shariff' ) . '</span></div></div>';
|
1712 |
+
echo '<div style="display:table-row"><div style="display:table-cell">';
|
1713 |
+
echo esc_html( $service_errors[ $service ] );
|
1714 |
+
echo '</div></div>';
|
1715 |
+
}
|
1716 |
+
echo '<div style="display:table-row"><div style="display:table-cell"></div></div>';
|
1717 |
+
echo '</div>';
|
1718 |
+
echo '</div>';
|
1719 |
+
echo '</div>';
|
1720 |
+
}
|
1721 |
+
}// End if().
|
1722 |
+
|
1723 |
+
// GD needed for QR codes of the Bitcoin links.
|
1724 |
+
echo '<div style="display:table-row">';
|
1725 |
+
echo '<div style="display:table-cell">' . esc_html__( 'GD Library:', 'shariff' ) . '</div>';
|
1726 |
+
// Working message.
|
1727 |
+
if ( function_exists( 'gd_info' ) ) {
|
1728 |
+
$gd_info = gd_info();
|
1729 |
+
echo '<div style="display:table-cell">';
|
1730 |
+
echo '<div style="display: table">';
|
1731 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:green">' . esc_html__( 'OK', 'shariff' ) . '</div></div>';
|
1732 |
+
echo '<div style="display:table-row"><div style="display:table-cell">Version: ' . esc_html( $gd_info['GD Version'] ) . '</div></div>';
|
1733 |
+
echo '</div>';
|
1734 |
+
echo '</div>';
|
1735 |
+
} else {
|
1736 |
+
echo '<div style="display:table-cell">';
|
1737 |
+
echo '<div style="display: table">';
|
1738 |
+
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:red">' . esc_html__( 'Error', 'shariff' ) . '</div></div>';
|
1739 |
+
echo '<div style="display:table-row"><div style="display:table-cell">' . esc_html__( 'The GD Library is not installed on this server. This is only needed for the QR codes, if your are using the bitcoin button.', 'shariff' ) . '</div></div>';
|
1740 |
+
echo '</div>';
|
1741 |
+
echo '</div>';
|
1742 |
+
}
|
1743 |
+
echo '</div>';
|
1744 |
+
|
1745 |
+
// End status table.
|
1746 |
+
echo '</div>';
|
1747 |
+
}
|
1748 |
+
|
1749 |
+
/**
|
1750 |
+
* Ranking section.
|
1751 |
+
*/
|
1752 |
+
function shariff3uu_ranking_section_callback() {
|
1753 |
+
// Post and service array.
|
1754 |
+
$posts = array();
|
1755 |
+
$services = array();
|
1756 |
+
|
1757 |
+
// Amount of posts - set to 100 if not set.
|
1758 |
+
if ( isset( $GLOBALS['shariff3uu']['ranking'] ) && absint( $GLOBALS['shariff3uu']['ranking'] ) > '0' ) {
|
1759 |
+
$numberposts = absint( $GLOBALS['shariff3uu']['ranking'] );
|
1760 |
+
} else {
|
1761 |
+
$numberposts = '100';
|
1762 |
+
}
|
1763 |
+
|
1764 |
+
// Set arguments for wp_get_recent_posts().
|
1765 |
+
$args = array(
|
1766 |
+
'numberposts' => $numberposts,
|
1767 |
+
'orderby' => 'post_date',
|
1768 |
+
'order' => 'DESC',
|
1769 |
+
'post_status' => 'publish',
|
1770 |
+
);
|
1771 |
+
|
1772 |
+
// Catch last 100 posts or whatever number is set for it.
|
1773 |
+
$recent_posts = wp_get_recent_posts( $args );
|
1774 |
+
if ( $recent_posts ) {
|
1775 |
+
foreach ( $recent_posts as $recent ) {
|
1776 |
+
// Get URL.
|
1777 |
+
$url = get_permalink( $recent['ID'] );
|
1778 |
+
$post_url = rawurlencode( $url );
|
1779 |
+
// Set transient name.
|
1780 |
+
$post_hash = 'shariff' . hash( 'md5', $post_url );
|
1781 |
+
// Get share counts from cache.
|
1782 |
+
if ( get_transient( $post_hash ) !== false ) {
|
1783 |
+
$share_counts = get_transient( $post_hash );
|
1784 |
+
$services = array_merge( $services, $share_counts );
|
1785 |
+
if ( isset( $share_counts['total'] ) ) {
|
1786 |
+
$total = $share_counts['total'];
|
1787 |
+
} else {
|
1788 |
+
$total = '0';
|
1789 |
+
}
|
1790 |
+
} else {
|
1791 |
+
$share_counts = array();
|
1792 |
+
$total = '';
|
1793 |
+
}
|
1794 |
+
// Add to array.
|
1795 |
+
$posts[ $post_hash ] = array(
|
1796 |
+
'url' => $url,
|
1797 |
+
'title' => $recent['post_title'],
|
1798 |
+
'post_date' => $recent['post_date'],
|
1799 |
+
'share_counts' => $share_counts,
|
1800 |
+
'total_share_counts' => $total,
|
1801 |
+
);
|
1802 |
+
}
|
1803 |
+
}
|
1804 |
+
|
1805 |
+
// Clean up services.
|
1806 |
+
unset( $services['total'] );
|
1807 |
+
unset( $services['timestamp'] );
|
1808 |
+
unset( $services['url'] );
|
1809 |
+
ksort( $services );
|
1810 |
+
|
1811 |
+
// Sort array: first descending using total share counts then descending using post date.
|
1812 |
+
$tmp = array();
|
1813 |
+
$tmp2 = array();
|
1814 |
+
foreach ( $posts as &$ma ) {
|
1815 |
+
$tmp[] = &$ma['total_share_counts'];
|
1816 |
+
}
|
1817 |
+
foreach ( $posts as &$ma2 ) {
|
1818 |
+
$tmp2[] = &$ma2['post_date'];
|
1819 |
+
}
|
1820 |
+
array_multisort( $tmp, SORT_DESC, $tmp2, SORT_DESC, $posts );
|
1821 |
+
|
1822 |
+
// Intro text.
|
1823 |
+
echo '<p>';
|
1824 |
+
echo esc_html__( 'The following tables shows the ranking of your last 100 posts and pages in descending order by total share counts. To prevent slow loading times only cached data is being used. Therefore, you may see blank entries for posts that have not been visited by anyone since the last update or activation of Shariff Wrapper. You can simply visit the respective post yourself in order to have the share counts fetched.', 'shariff' );
|
1825 |
+
echo '</p>';
|
1826 |
+
|
1827 |
+
// Warning if statistic has been disabled.
|
1828 |
+
if ( ! isset( $GLOBALS['shariff3uu']['backend'] ) ) {
|
1829 |
+
echo '<p>';
|
1830 |
+
echo '<span style="color: red; font-weight: bold;">';
|
1831 |
+
echo esc_html__( 'Warning:', 'shariff' );
|
1832 |
+
echo '</span> ';
|
1833 |
+
echo esc_html__( 'The statistic option has been disabled on the statistic tab. Share counts will not get updated!', 'shariff' );
|
1834 |
+
echo '</p>';
|
1835 |
+
}
|
1836 |
+
|
1837 |
+
// Begin ranking table.
|
1838 |
+
echo '<div style="display:table;background-color:#fff">';
|
1839 |
+
// Head.
|
1840 |
+
echo '<div style="display:table-row">';
|
1841 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px">' . esc_html__( 'Rank', 'shariff' ) . '</div>';
|
1842 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px">' . esc_html__( 'Post', 'shariff' ) . '</div>';
|
1843 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px;text-align:center">' . esc_html__( 'Date', 'shariff' ) . '</div>';
|
1844 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px;text-align:center">' . esc_html__( 'Time', 'shariff' ) . '</div>';
|
1845 |
+
foreach ( $services as $service => $nothing ) {
|
1846 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px;text-align:center;">' . esc_html( ucfirst( $service ) ) . '</div>';
|
1847 |
+
}
|
1848 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . esc_html__( 'Total', 'shariff' ) . '</div>';
|
1849 |
+
echo '</div>';
|
1850 |
+
// Posts.
|
1851 |
+
$rank = '0';
|
1852 |
+
foreach ( $posts as $post => $value ) {
|
1853 |
+
$rank++;
|
1854 |
+
echo '<div style="display:table-row">';
|
1855 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;text-align:center">' . absint( $rank ) . '</div>';
|
1856 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"><a href="' . esc_url( $value['url'] ) . '" target="_blank">' . esc_html( wp_strip_all_tags( $value['title'] ) ) . '</a></div>';
|
1857 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html( mysql2date( 'd.m.Y', $value['post_date'] ) ) . '</div>';
|
1858 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html( mysql2date( 'H:i', $value['post_date'] ) ) . '</div>';
|
1859 |
+
// Share counts.
|
1860 |
+
foreach ( $services as $service => $nothing ) {
|
1861 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;text-align:center">';
|
1862 |
+
if ( isset( $value['share_counts'][ $service ] ) ) {
|
1863 |
+
echo absint( $value['share_counts'][ $service ] );
|
1864 |
+
}
|
1865 |
+
echo '</div>';
|
1866 |
+
}
|
1867 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;text-align:center">';
|
1868 |
+
if ( isset( $value['share_counts']['total'] ) ) {
|
1869 |
+
echo absint( $value['share_counts']['total'] );
|
1870 |
+
}
|
1871 |
+
echo '</div>';
|
1872 |
+
echo '</div>';
|
1873 |
+
}
|
1874 |
+
echo '</div>';
|
1875 |
+
|
1876 |
+
// Clear arrays.
|
1877 |
+
$posts = array();
|
1878 |
+
$services = array();
|
1879 |
+
|
1880 |
+
// Set arguments for wp_get_recent_posts().
|
1881 |
+
$args = array(
|
1882 |
+
'numberposts' => $numberposts,
|
1883 |
+
'orderby' => 'post_date',
|
1884 |
+
'order' => 'DESC',
|
1885 |
+
'post_status' => 'publish',
|
1886 |
+
'post_type' => 'page',
|
1887 |
+
);
|
1888 |
+
|
1889 |
+
// Catch last 100 pages or whatever number is set for it.
|
1890 |
+
$recent_posts = wp_get_recent_posts( $args );
|
1891 |
+
if ( $recent_posts ) {
|
1892 |
+
foreach ( $recent_posts as $recent ) {
|
1893 |
+
// Get URL.
|
1894 |
+
$url = get_permalink( $recent['ID'] );
|
1895 |
+
$post_url = rawurlencode( $url );
|
1896 |
+
// Set transient name.
|
1897 |
+
$post_hash = 'shariff' . hash( 'md5', $post_url );
|
1898 |
+
// Get share counts from cache.
|
1899 |
+
if ( get_transient( $post_hash ) !== false ) {
|
1900 |
+
$share_counts = get_transient( $post_hash );
|
1901 |
+
$services = array_merge( $services, $share_counts );
|
1902 |
+
if ( isset( $share_counts['total'] ) ) {
|
1903 |
+
$total = $share_counts['total'];
|
1904 |
+
} else {
|
1905 |
+
$total = '0';
|
1906 |
+
}
|
1907 |
+
} else {
|
1908 |
+
$share_counts = array();
|
1909 |
+
$total = '';
|
1910 |
+
}
|
1911 |
+
// Add to array.
|
1912 |
+
$posts[ $post_hash ] = array(
|
1913 |
+
'url' => $url,
|
1914 |
+
'title' => $recent['post_title'],
|
1915 |
+
'post_date' => $recent['post_date'],
|
1916 |
+
'share_counts' => $share_counts,
|
1917 |
+
'total_share_counts' => $total,
|
1918 |
+
);
|
1919 |
+
}
|
1920 |
+
}
|
1921 |
+
|
1922 |
+
// Clean up services.
|
1923 |
+
unset( $services['total'] );
|
1924 |
+
unset( $services['timestamp'] );
|
1925 |
+
unset( $services['url'] );
|
1926 |
+
ksort( $services );
|
1927 |
+
|
1928 |
+
// Sort array: first descending using total share counts then descending using post date.
|
1929 |
+
$tmp = array();
|
1930 |
+
$tmp2 = array();
|
1931 |
+
foreach ( $posts as &$ma ) {
|
1932 |
+
$tmp[] = &$ma['total_share_counts'];
|
1933 |
+
}
|
1934 |
+
foreach ( $posts as &$ma2 ) {
|
1935 |
+
$tmp2[] = &$ma2['post_date'];
|
1936 |
+
}
|
1937 |
+
array_multisort( $tmp, SORT_DESC, $tmp2, SORT_DESC, $posts );
|
1938 |
+
|
1939 |
+
// Intro text.
|
1940 |
+
echo '<p></p>';
|
1941 |
+
|
1942 |
+
// Warning if statistic has been disabled.
|
1943 |
+
if ( ! isset( $GLOBALS['shariff3uu']['backend'] ) ) {
|
1944 |
+
echo '<p>';
|
1945 |
+
echo '<span style="color: red; font-weight: bold;">';
|
1946 |
+
echo esc_html__( 'Warning:', 'shariff' );
|
1947 |
+
echo '</span> ';
|
1948 |
+
echo esc_html__( 'The statistic option has been disabled on the statistic tab. Share counts will not get updated!', 'shariff' );
|
1949 |
+
echo '</p>';
|
1950 |
+
}
|
1951 |
+
|
1952 |
+
// Begin ranking table.
|
1953 |
+
echo '<div style="display:table;background-color:#fff">';
|
1954 |
+
// Head.
|
1955 |
+
echo '<div style="display:table-row">';
|
1956 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px">' . esc_html__( 'Rank', 'shariff' ) . '</div>';
|
1957 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px">' . esc_html__( 'Page', 'shariff' ) . '</div>';
|
1958 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px;text-align:center">' . esc_html__( 'Date', 'shariff' ) . '</div>';
|
1959 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px;text-align:center">' . esc_html__( 'Time', 'shariff' ) . '</div>';
|
1960 |
+
foreach ( $services as $service => $nothing ) {
|
1961 |
+
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px;text-align:center;">' . esc_html( ucfirst( $service ) ) . '</div>';
|
1962 |
+
}
|
1963 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . esc_html__( 'Total', 'shariff' ) . '</div>';
|
1964 |
+
echo '</div>';
|
1965 |
+
// Pages.
|
1966 |
+
$rank = '0';
|
1967 |
+
foreach ( $posts as $post => $value ) {
|
1968 |
+
$rank++;
|
1969 |
+
echo '<div style="display:table-row">';
|
1970 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;text-align:center">' . absint( $rank ) . '</div>';
|
1971 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px"><a href="' . esc_url( $value['url'] ) . '" target="_blank">' . esc_html( $value['title'] ) . '</a></div>';
|
1972 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html( mysql2date( 'd.m.Y', $value['post_date'] ) ) . '</div>';
|
1973 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html( mysql2date( 'H:i', $value['post_date'] ) ) . '</div>';
|
1974 |
+
// Share counts.
|
1975 |
+
foreach ( $services as $service => $nothing ) {
|
1976 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;text-align:center">';
|
1977 |
+
if ( isset( $value['share_counts'][ $service ] ) ) {
|
1978 |
+
echo absint( $value['share_counts'][ $service ] );
|
1979 |
+
}
|
1980 |
+
echo '</div>';
|
1981 |
+
}
|
1982 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px;text-align:center">';
|
1983 |
+
if ( isset( $value['share_counts']['total'] ) ) {
|
1984 |
+
echo absint( $value['share_counts']['total'] );
|
1985 |
+
}
|
1986 |
+
echo '</div>';
|
1987 |
+
echo '</div>';
|
1988 |
+
}
|
1989 |
+
echo '</div>';
|
1990 |
+
}
|
1991 |
+
|
1992 |
+
/**
|
1993 |
+
* Renders the plugin option page.
|
1994 |
+
*/
|
1995 |
+
function shariff3uu_options_page() {
|
1996 |
+
// The <div> with the class "wrap" makes sure that admin messages are displayed below the title and not above.
|
1997 |
+
echo '<div class="wrap">';
|
1998 |
+
|
1999 |
+
// Title.
|
2000 |
+
echo '<h2>Shariff ' . esc_html( $GLOBALS['shariff3uu_basic']['version'] ) . '</h2>';
|
2001 |
+
|
2002 |
+
// Start the form.
|
2003 |
+
echo '<form class="shariff" action="options.php" method="post">';
|
2004 |
+
|
2005 |
+
// Hidden version entry, so it will get saved upon updating the options.
|
2006 |
+
echo '<input type="hidden" name="shariff3uu_basic[version]" value="' . esc_html( $GLOBALS['shariff3uu_basic']['version'] ) . '">';
|
2007 |
+
|
2008 |
+
// Determine active tab.
|
2009 |
+
// @codingStandardsIgnoreStart
|
2010 |
+
if ( isset( $_GET['tab'] ) ) {
|
2011 |
+
$active_tab = $_GET['tab'];
|
2012 |
+
} else {
|
2013 |
+
$active_tab = 'basic';
|
2014 |
+
}
|
2015 |
+
// @codingStandardsIgnoreEnd
|
2016 |
+
|
2017 |
+
// Tabs.
|
2018 |
+
echo '<h2 class="nav-tab-wrapper">';
|
2019 |
+
// Basic.
|
2020 |
+
echo '<a href="?page=shariff3uu&tab=basic" class="nav-tab ';
|
2021 |
+
if ( 'basic' === $active_tab ) {
|
2022 |
+
echo 'nav-tab-active';
|
2023 |
+
}
|
2024 |
+
echo '">' . esc_html__( 'Basic', 'shariff' ) . '</a>';
|
2025 |
+
// Design.
|
2026 |
+
echo '<a href="?page=shariff3uu&tab=design" class="nav-tab ';
|
2027 |
+
if ( 'design' === $active_tab ) {
|
2028 |
+
echo 'nav-tab-active';
|
2029 |
+
}
|
2030 |
+
echo '">' . esc_html__( 'Design', 'shariff' ) . '</a>';
|
2031 |
+
// Advanced.
|
2032 |
+
echo '<a href="?page=shariff3uu&tab=advanced" class="nav-tab ';
|
2033 |
+
if ( 'advanced' === $active_tab ) {
|
2034 |
+
echo 'nav-tab-active';
|
2035 |
+
}
|
2036 |
+
echo '">' . esc_html__( 'Advanced', 'shariff' ) . '</a>';
|
2037 |
+
// Statistic.
|
2038 |
+
echo '<a href="?page=shariff3uu&tab=statistic" class="nav-tab ';
|
2039 |
+
if ( 'statistic' === $active_tab ) {
|
2040 |
+
echo 'nav-tab-active';
|
2041 |
+
}
|
2042 |
+
echo '">' . esc_html__( 'Statistic', 'shariff' ) . '</a>';
|
2043 |
+
// Help.
|
2044 |
+
echo '<a href="?page=shariff3uu&tab=help" class="nav-tab ';
|
2045 |
+
if ( 'help' === $active_tab ) {
|
2046 |
+
echo 'nav-tab-active';
|
2047 |
+
}
|
2048 |
+
echo '">' . esc_html__( 'Help', 'shariff' ) . '</a>';
|
2049 |
+
// Status.
|
2050 |
+
echo '<a href="?page=shariff3uu&tab=status" class="nav-tab ';
|
2051 |
+
if ( 'status' === $active_tab ) {
|
2052 |
+
echo 'nav-tab-active';
|
2053 |
+
}
|
2054 |
+
echo '">' . esc_html__( 'Status', 'shariff' ) . '</a>';
|
2055 |
+
// Ranking.
|
2056 |
+
echo '<a href="?page=shariff3uu&tab=ranking" class="nav-tab ';
|
2057 |
+
if ( 'ranking' === $active_tab ) {
|
2058 |
+
echo 'nav-tab-active';
|
2059 |
+
}
|
2060 |
+
echo '">' . esc_html__( 'Ranking', 'shariff' ) . '</a>';
|
2061 |
+
echo '</h2>';
|
2062 |
+
|
2063 |
+
// Content of tabs.
|
2064 |
+
if ( 'basic' === $active_tab ) {
|
2065 |
+
settings_fields( 'basic' );
|
2066 |
+
do_settings_sections( 'basic' );
|
2067 |
+
submit_button();
|
2068 |
+
} elseif ( 'design' === $active_tab ) {
|
2069 |
+
settings_fields( 'design' );
|
2070 |
+
do_settings_sections( 'design' );
|
2071 |
+
submit_button();
|
2072 |
+
} elseif ( 'advanced' === $active_tab ) {
|
2073 |
+
settings_fields( 'advanced' );
|
2074 |
+
do_settings_sections( 'advanced' );
|
2075 |
+
submit_button();
|
2076 |
+
} elseif ( 'statistic' === $active_tab ) {
|
2077 |
+
settings_fields( 'statistic' );
|
2078 |
+
do_settings_sections( 'statistic' );
|
2079 |
+
submit_button();
|
2080 |
+
} elseif ( 'help' === $active_tab ) {
|
2081 |
+
settings_fields( 'help' );
|
2082 |
+
do_settings_sections( 'help' );
|
2083 |
+
} elseif ( 'status' === $active_tab ) {
|
2084 |
+
settings_fields( 'status' );
|
2085 |
+
do_settings_sections( 'status' );
|
2086 |
+
} elseif ( 'ranking' === $active_tab ) {
|
2087 |
+
settings_fields( 'ranking' );
|
2088 |
+
do_settings_sections( 'ranking' );
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
// End of form.
|
2092 |
+
echo '</form>';
|
2093 |
+
}
|
admin/admin-metabox.php
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when an user is logged in.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
* @subpackage admin
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Prevent direct calls to admin_menu.php.
|
10 |
+
if ( ! class_exists( 'WP' ) ) {
|
11 |
+
die();
|
12 |
+
}
|
13 |
+
|
14 |
+
// Call setup function on the post editor screen.
|
15 |
+
add_action( 'load-post.php', 'shariff3uu_metabox_setup' );
|
16 |
+
add_action( 'load-post-new.php', 'shariff3uu_metabox_setup' );
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Meta box setup function.
|
20 |
+
*/
|
21 |
+
function shariff3uu_metabox_setup() {
|
22 |
+
add_action( 'add_meta_boxes', 'shariff3uu_add_metabox' );
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Adds the meta box.
|
27 |
+
*/
|
28 |
+
function shariff3uu_add_metabox() {
|
29 |
+
foreach ( get_post_types() as $posttype ) {
|
30 |
+
add_meta_box( 'shariff_metabox', __( 'Shariff Settings', 'shariff' ), 'shariff3uu_build_metabox', $posttype, 'side', 'default' );
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Builds the meta box.
|
36 |
+
*/
|
37 |
+
function shariff3uu_build_metabox() {
|
38 |
+
// Scripts for the pinterest image media uploader.
|
39 |
+
wp_enqueue_media();
|
40 |
+
wp_register_script( 'shariff_mediaupload', plugins_url( '../js/shariff-media.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
41 |
+
$translation_array = array( 'choose_image' => __( 'Choose image', 'shariff' ) );
|
42 |
+
wp_localize_script( 'shariff_mediaupload', 'shariff_media', $translation_array );
|
43 |
+
wp_enqueue_script( 'shariff_mediaupload' );
|
44 |
+
|
45 |
+
// Make sure the form request comes from WordPress.
|
46 |
+
wp_nonce_field( basename( __FILE__ ), 'shariff_metabox_nonce' );
|
47 |
+
|
48 |
+
// Retrieve the current metabox disable value.
|
49 |
+
$shariff_metabox_disable = get_post_meta( get_the_ID(), 'shariff_metabox_disable', true );
|
50 |
+
// Disable checkbox.
|
51 |
+
echo '<p><strong>' . esc_html__( 'Disable Shariff', 'shariff' ) . '</strong><br>';
|
52 |
+
echo '<input type="checkbox" name="shariff_metabox_disable" id="shariff_metabox_disable"';
|
53 |
+
if ( isset( $shariff_metabox_disable ) ) {
|
54 |
+
echo checked( $shariff_metabox_disable, 1, 0 );
|
55 |
+
}
|
56 |
+
echo '>';
|
57 |
+
echo '<label for="shariff_metabox_disable">' . esc_html__( 'Disable Shariff for this content.', 'shariff' ) . '</label></p>';
|
58 |
+
|
59 |
+
// Retrieve the current metabox add before and after values.
|
60 |
+
$shariff_metabox_before = get_post_meta( get_the_ID(), 'shariff_metabox_before', true );
|
61 |
+
$shariff_metabox_after = get_post_meta( get_the_ID(), 'shariff_metabox_after', true );
|
62 |
+
// Add Shariff checkboxes.
|
63 |
+
echo '<p><strong>' . esc_html__( 'Add Shariff', 'shariff' ) . '</strong><br>';
|
64 |
+
// Before checkbox.
|
65 |
+
echo '<input type="checkbox" name="shariff_metabox_before" id="shariff_metabox_before"';
|
66 |
+
if ( isset( $shariff_metabox_before ) ) {
|
67 |
+
echo checked( $shariff_metabox_before, 1, 0 );
|
68 |
+
}
|
69 |
+
echo '>';
|
70 |
+
echo '<label for="shariff_metabox_before">' . esc_html__( 'Add buttons before this content.', 'shariff' ) . '</label><br>';
|
71 |
+
// After checkbox.
|
72 |
+
echo '<input type="checkbox" name="shariff_metabox_after" id="shariff_metabox_after"';
|
73 |
+
if ( isset( $shariff_metabox_after ) ) {
|
74 |
+
echo checked( $shariff_metabox_after, 1, 0 );
|
75 |
+
}
|
76 |
+
echo '>';
|
77 |
+
echo '<label for="shariff_metabox_after">' . esc_html__( 'Add buttons after this content.', 'shariff' ) . '</label></p>';
|
78 |
+
|
79 |
+
// Retrieve the current metabox media value (pinterest image).
|
80 |
+
$shariff_metabox_media = get_post_meta( get_the_ID(), 'shariff_metabox_media', true );
|
81 |
+
|
82 |
+
// Metabox shortcode.
|
83 |
+
echo '<p><strong>' . esc_html__( 'Pinterest Image', 'shariff' ) . '</strong><br><label for="shariff_metabox_media">' . esc_html__( 'The complete url to your desired custom image for Pinterest.', 'shariff' ) . '</label><br>';
|
84 |
+
echo '<input type="text" name="shariff_metabox_media" id="shariff-image-url" value="' . esc_html( $shariff_metabox_media ) . '" style="width:90%; margin-right:5px"><input type="button" name="upload-btn" id="shariff-upload-btn" class="button-secondary" value="' . esc_html__( 'Choose image', 'shariff' ) . '"></p>';
|
85 |
+
|
86 |
+
// Retrieve the current metabox shortcode value.
|
87 |
+
$shariff_metabox = get_post_meta( get_the_ID(), 'shariff_metabox', true );
|
88 |
+
// Metabox shortcode.
|
89 |
+
echo '<p><strong>' . esc_html__( 'Shortcode', 'shariff' ) . '</strong><br><label for="shariff_metabox">' . esc_html__( 'The settings in this shortcode field overwrite ALL global settings.', 'shariff' ) . '</label><br>';
|
90 |
+
echo '<input type="text" name="shariff_metabox" id="shariff_metabox" value="' . esc_html( $shariff_metabox ) . '" placeholder="[shariff]" style="width:90%"></p>';
|
91 |
+
|
92 |
+
// Retrieve the current metabox ignore widget value.
|
93 |
+
$shariff_metabox_ignore_widget = get_post_meta( get_the_ID(), 'shariff_metabox_ignore_widget', true );
|
94 |
+
// Disable checkbox.
|
95 |
+
echo '<p><strong>' . esc_html__( 'Ignore Widgets', 'shariff' ) . '</strong><br>';
|
96 |
+
echo '<input type="checkbox" name="shariff_metabox_ignore_widget" id="shariff_metabox_ignore_widget"';
|
97 |
+
if ( isset( $shariff_metabox_ignore_widget ) ) {
|
98 |
+
echo checked( $shariff_metabox_ignore_widget, 1, 0 );
|
99 |
+
}
|
100 |
+
echo '>';
|
101 |
+
echo '<label for="shariff_metabox_ignore_widget">' . esc_html__( 'Do not affect buttons in widgets.', 'shariff' ) . '</label></p>';
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Save meta data.
|
106 |
+
*
|
107 |
+
* @param integer $post_id ID of the current post.
|
108 |
+
* @param WP_Post $post Current post.
|
109 |
+
*/
|
110 |
+
function shariff3uu_save_metabox_data( $post_id, $post ) {
|
111 |
+
// Check nonce and if shariff_metabox is set.
|
112 |
+
if ( isset( $_REQUEST['shariff_metabox_nonce'] ) && wp_verify_nonce( sanitize_key( $_REQUEST['shariff_metabox_nonce'] ), basename( __FILE__ ) ) ) {
|
113 |
+
// Check if we are not autosaving or previewing (revision), else we are good to go and can save our meta box data.
|
114 |
+
$post_type_object = get_post_type_object( $post->post_type );
|
115 |
+
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || wp_is_post_revision( $post ) || ( is_multisite() && ms_is_switched() ) || ! current_user_can( $post_type_object->cap->edit_post, $post_id ) ) {
|
116 |
+
return;
|
117 |
+
} else {
|
118 |
+
// Save meta box disable.
|
119 |
+
if ( isset( $_POST['shariff_metabox_disable'] ) && 'on' === $_POST['shariff_metabox_disable'] ) {
|
120 |
+
update_post_meta( $post_id, 'shariff_metabox_disable', 1 );
|
121 |
+
} else {
|
122 |
+
delete_post_meta( $post_id, 'shariff_metabox_disable', 1 );
|
123 |
+
}
|
124 |
+
|
125 |
+
// Save meta box add before value.
|
126 |
+
if ( isset( $_POST['shariff_metabox_before'] ) && 'on' === $_POST['shariff_metabox_before'] ) {
|
127 |
+
update_post_meta( $post_id, 'shariff_metabox_before', 1 );
|
128 |
+
} else {
|
129 |
+
delete_post_meta( $post_id, 'shariff_metabox_before', 1 );
|
130 |
+
}
|
131 |
+
|
132 |
+
// Save meta box add after value.
|
133 |
+
if ( isset( $_POST['shariff_metabox_after'] ) && 'on' === $_POST['shariff_metabox_after'] ) {
|
134 |
+
update_post_meta( $post_id, 'shariff_metabox_after', 1 );
|
135 |
+
} else {
|
136 |
+
delete_post_meta( $post_id, 'shariff_metabox_after', 1 );
|
137 |
+
}
|
138 |
+
|
139 |
+
// Save meta box media.
|
140 |
+
if ( isset( $_POST['shariff_metabox_media'] ) && ! empty( $_POST['shariff_metabox_media'] ) ) {
|
141 |
+
update_post_meta( $post_id, 'shariff_metabox_media', esc_url_raw( wp_unslash( $_POST['shariff_metabox_media'] ) ) );
|
142 |
+
} else {
|
143 |
+
delete_post_meta( $post_id, 'shariff_metabox_media' );
|
144 |
+
}
|
145 |
+
|
146 |
+
// Save meta box shortcode.
|
147 |
+
if ( isset( $_POST['shariff_metabox'] ) && ! empty( $_POST['shariff_metabox'] ) ) {
|
148 |
+
update_post_meta( $post_id, 'shariff_metabox', wp_kses( wp_unslash( $_POST['shariff_metabox'] ), $GLOBALS['allowed_tags'] ) );
|
149 |
+
} else {
|
150 |
+
delete_post_meta( $post_id, 'shariff_metabox' );
|
151 |
+
}
|
152 |
+
|
153 |
+
// Save meta box ignore widgets.
|
154 |
+
if ( isset( $_POST['shariff_metabox_ignore_widget'] ) && 'on' === $_POST['shariff_metabox_ignore_widget'] ) {
|
155 |
+
update_post_meta( $post_id, 'shariff_metabox_ignore_widget', 1 );
|
156 |
+
} else {
|
157 |
+
delete_post_meta( $post_id, 'shariff_metabox_ignore_widget', 1 );
|
158 |
+
}
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
add_action( 'save_post', 'shariff3uu_save_metabox_data', 10, 2 );
|
admin/admin-notices.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php to display admin notices about missing settings.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
* @subpackage admin
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Prevent direct calls to admin_menu.php.
|
10 |
+
if ( ! class_exists( 'WP' ) ) {
|
11 |
+
die();
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Display an info notice, if a service has been selected that requires a username, id, etc. and none has been provided.
|
16 |
+
*/
|
17 |
+
function shariff3uu_service_notice() {
|
18 |
+
// Prevent php info notices.
|
19 |
+
$services = array();
|
20 |
+
// Check if any services are set and if user can manage options.
|
21 |
+
if ( isset( $GLOBALS['shariff3uu']['services'] ) && current_user_can( 'manage_options' ) ) {
|
22 |
+
// Flattr.
|
23 |
+
if ( strpos( $GLOBALS['shariff3uu']['services'], 'flattr' ) !== false && empty( $GLOBALS['shariff3uu']['flattruser'] ) ) {
|
24 |
+
$services[] = 'Flattr';
|
25 |
+
}
|
26 |
+
// Patreon.
|
27 |
+
if ( strpos( $GLOBALS['shariff3uu']['services'], 'patreon' ) !== false && empty( $GLOBALS['shariff3uu']['patreonid'] ) ) {
|
28 |
+
$services[] = 'Patreon';
|
29 |
+
}
|
30 |
+
// PayPal.
|
31 |
+
if ( strpos( $GLOBALS['shariff3uu']['services'], 'paypal' ) !== false && strpos( $GLOBALS['shariff3uu']['services'], 'paypalme' ) === false && empty( $GLOBALS['shariff3uu']['paypalbuttonid'] ) ) {
|
32 |
+
$services[] = 'PayPal';
|
33 |
+
}
|
34 |
+
// PayPal.me.
|
35 |
+
if ( strpos( $GLOBALS['shariff3uu']['services'], 'paypalme' ) !== false && empty( $GLOBALS['shariff3uu']['paypalmeid'] ) ) {
|
36 |
+
$services[] = 'PayPal.Me';
|
37 |
+
}
|
38 |
+
// Bitcoin.
|
39 |
+
if ( strpos( $GLOBALS['shariff3uu']['services'], 'bitcoin' ) !== false && empty( $GLOBALS['shariff3uu']['bitcoinaddress'] ) ) {
|
40 |
+
$services[] = 'Bitcoin';
|
41 |
+
}
|
42 |
+
// Loop through services and display an info notice.
|
43 |
+
foreach ( $services as $service ) {
|
44 |
+
echo '<div class="notice notice-error"><p>';
|
45 |
+
$settings_url = get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page=shariff3uu&tab=advanced">';
|
46 |
+
// Translators: %s will be replaced with the correct URL to the local Shariff Settings page and tab.
|
47 |
+
printf( wp_kses( __( 'Please check your <a href="%s">Shariff Settings</a>!', 'shariff' ), array( 'a' => array( 'href' => true ) ) ), esc_url( $settings_url ) );
|
48 |
+
echo ' ';
|
49 |
+
// Translators: %s will be replaced with a service name e.g. Twitter.
|
50 |
+
printf( wp_kses( __( '%s has been selected as a service, but no username, ID or address has been provided! Please enter the required information on the advanced tab!', 'shariff' ), array() ), esc_html( $service ) );
|
51 |
+
echo '</p></div>';
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
add_action( 'admin_notices', 'shariff3uu_service_notice' );
|
admin/admin_menu.php
DELETED
@@ -1,1757 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Will be included in the shariff.php only, when an admin is logged in.
|
3 |
-
|
4 |
-
// prevent direct calls to admin_menu.php
|
5 |
-
if ( ! class_exists('WP') ) { die(); }
|
6 |
-
|
7 |
-
// the admin page
|
8 |
-
add_action( 'admin_menu', 'shariff3UU_add_admin_menu' );
|
9 |
-
add_action( 'admin_init', 'shariff3UU_options_init' );
|
10 |
-
add_action( 'init', 'shariff_init_locale' );
|
11 |
-
|
12 |
-
// scripts and styles for admin pages e.g. info notice
|
13 |
-
function shariff3UU_admin_style( $hook ) {
|
14 |
-
// js for admin notice - needed on _ALL_ admin pages (as long as WordPress does not handle dismiss clicks)
|
15 |
-
wp_enqueue_script( 'shariff_notice', plugins_url( '../js/shariff-notice.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
16 |
-
// scripts only needed on our plugin options page - no need to load them on _ALL_ admin pages
|
17 |
-
if ( $hook == 'settings_page_shariff3uu' ) {
|
18 |
-
// scripts for pinterest default image media uploader
|
19 |
-
wp_enqueue_media();
|
20 |
-
wp_register_script( 'shariff_mediaupload', plugins_url( '../js/shariff-media.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
21 |
-
$translation_array = array( 'choose_image' => __( 'Choose image', 'shariff' ) );
|
22 |
-
wp_localize_script( 'shariff_mediaupload', 'shariff_media', $translation_array );
|
23 |
-
wp_enqueue_script( 'shariff_mediaupload' );
|
24 |
-
}
|
25 |
-
}
|
26 |
-
add_action( 'admin_enqueue_scripts', 'shariff3UU_admin_style' );
|
27 |
-
|
28 |
-
// add admin menu
|
29 |
-
function shariff3UU_add_admin_menu() {
|
30 |
-
add_options_page( 'Shariff', 'Shariff', 'manage_options', 'shariff3uu', 'shariff3UU_options_page' );
|
31 |
-
}
|
32 |
-
|
33 |
-
// plugin options page
|
34 |
-
function shariff3UU_options_init(){
|
35 |
-
|
36 |
-
// first tab - basic
|
37 |
-
|
38 |
-
// register first tab (basic) settings and call sanitize function
|
39 |
-
register_setting( 'basic', 'shariff3UU_basic', 'shariff3UU_basic_sanitize' );
|
40 |
-
|
41 |
-
// first tab - basic options
|
42 |
-
add_settings_section( 'shariff3UU_basic_section', __( 'Basic options', 'shariff' ),
|
43 |
-
'shariff3UU_basic_section_callback', 'basic' );
|
44 |
-
|
45 |
-
// services
|
46 |
-
add_settings_field( 'shariff3UU_text_services', '<div style="width:450px">' . __( 'Enable the following services in the provided order:', 'shariff' ) . '</div>',
|
47 |
-
'shariff3UU_text_services_render', 'basic', 'shariff3UU_basic_section' );
|
48 |
-
|
49 |
-
// add after
|
50 |
-
add_settings_field( 'shariff3UU_multiplecheckbox_add_after', __( 'Add the Shariff buttons <u>after</u> all:', 'shariff' ),
|
51 |
-
'shariff3UU_multiplecheckbox_add_after_render', 'basic', 'shariff3UU_basic_section' );
|
52 |
-
|
53 |
-
// add before
|
54 |
-
add_settings_field( 'shariff3UU_checkbox_add_before', __( 'Add the Shariff buttons <u>before</u> all:', 'shariff' ),
|
55 |
-
'shariff3UU_multiplecheckbox_add_before_render', 'basic', 'shariff3UU_basic_section' );
|
56 |
-
|
57 |
-
// disable on protected posts
|
58 |
-
add_settings_field( 'shariff3UU_checkbox_disable_on_protected', __( 'Disable the Shariff buttons on password protected posts.', 'shariff' ),
|
59 |
-
'shariff3UU_checkbox_disable_on_protected_render', 'basic', 'shariff3UU_basic_section' );
|
60 |
-
|
61 |
-
// disable outside of loop
|
62 |
-
add_settings_field( 'shariff3UU_checkbox_disable_outside_loop', __( 'Disable the Shariff buttons outside of the main loop.', 'shariff' ),
|
63 |
-
'shariff3UU_checkbox_disable_outside_loop_render', 'basic', 'shariff3UU_basic_section' );
|
64 |
-
|
65 |
-
// second tab - design
|
66 |
-
|
67 |
-
// register second tab (design) settings and call sanitize function
|
68 |
-
register_setting( 'design', 'shariff3UU_design', 'shariff3UU_design_sanitize' );
|
69 |
-
|
70 |
-
// second tab - design options
|
71 |
-
add_settings_section( 'shariff3UU_design_section', __( 'Design options', 'shariff' ),
|
72 |
-
'shariff3UU_design_section_callback', 'design' );
|
73 |
-
|
74 |
-
// button language
|
75 |
-
add_settings_field( 'shariff3UU_select_language', '<div style="width:450px">' . __( 'Shariff button language:', 'shariff' ) . '</div>',
|
76 |
-
'shariff3UU_select_language_render', 'design', 'shariff3UU_design_section' );
|
77 |
-
|
78 |
-
// theme
|
79 |
-
add_settings_field( 'shariff3UU_radio_theme', __( 'Shariff button design:', 'shariff' ),
|
80 |
-
'shariff3UU_radio_theme_render', 'design', 'shariff3UU_design_section' );
|
81 |
-
|
82 |
-
// button size
|
83 |
-
add_settings_field( 'shariff3UU_checkbox_buttonsize', __( 'Button size:', 'shariff' ),
|
84 |
-
'shariff3UU_checkbox_buttonsize_render', 'design', 'shariff3UU_design_section' );
|
85 |
-
|
86 |
-
// button stretch
|
87 |
-
add_settings_field( 'shariff3UU_checkbox_buttonsstretch', __( 'Stretch buttons horizontally to full width.', 'shariff' ),
|
88 |
-
'shariff3UU_checkbox_buttonstretch_render', 'design', 'shariff3UU_design_section' );
|
89 |
-
|
90 |
-
// border radius
|
91 |
-
add_settings_field( 'shariff3UU_number_borderradius', __( 'Border radius for the round theme (1-50):', 'shariff' ),
|
92 |
-
'shariff3UU_number_borderradius_render', 'design', 'shariff3UU_design_section' );
|
93 |
-
|
94 |
-
// custom main color
|
95 |
-
add_settings_field( 'shariff3UU_text_maincolor', __( 'Custom main color for <b>all</b> buttons (hexadecimal):', 'shariff' ),
|
96 |
-
'shariff3UU_text_maincolor_render', 'design', 'shariff3UU_design_section' );
|
97 |
-
|
98 |
-
// custom secondary color
|
99 |
-
add_settings_field( 'shariff3UU_text_secondarycolor', __( 'Custom secondary color for <b>all</b> buttons (hexadecimal):', 'shariff' ),
|
100 |
-
'shariff3UU_text_secondarycolor_render', 'design', 'shariff3UU_design_section' );
|
101 |
-
|
102 |
-
// vertical
|
103 |
-
add_settings_field( 'shariff3UU_checkbox_vertical', __( 'Shariff button orientation <b>vertical</b>.', 'shariff' ),
|
104 |
-
'shariff3UU_checkbox_vertical_render', 'design', 'shariff3UU_design_section' );
|
105 |
-
|
106 |
-
// alignment option
|
107 |
-
add_settings_field( 'shariff3UU_radio_align', __( 'Alignment of the Shariff buttons:', 'shariff' ),
|
108 |
-
'shariff3UU_radio_align_render', 'design', 'shariff3UU_design_section' );
|
109 |
-
|
110 |
-
// alignment option for the widget
|
111 |
-
add_settings_field( 'shariff3UU_radio_align_widget', __( 'Alignment of the Shariff buttons in the widget:', 'shariff' ),
|
112 |
-
'shariff3UU_radio_align_widget_render', 'design', 'shariff3UU_design_section' );
|
113 |
-
|
114 |
-
// headline
|
115 |
-
add_settings_field( 'shariff3UU_text_headline', __( 'Headline above all Shariff buttons:', 'shariff' ),
|
116 |
-
'shariff3UU_text_headline_render', 'design', 'shariff3UU_design_section' );
|
117 |
-
|
118 |
-
// custom css
|
119 |
-
add_settings_field( 'shariff3UU_text_style', __( 'Custom CSS <u>attributes</u> for the container <u>around</u> Shariff:', 'shariff' ),
|
120 |
-
'shariff3UU_text_style_render', 'design', 'shariff3UU_design_section' );
|
121 |
-
|
122 |
-
// custom css class
|
123 |
-
add_settings_field( 'shariff3UU_text_cssclass', __( 'Custom CSS <u>class</u> for the container <u>around</u> Shariff:', 'shariff' ),
|
124 |
-
'shariff3UU_text_cssclass_render', 'design', 'shariff3UU_design_section' );
|
125 |
-
|
126 |
-
// hide until css loaded
|
127 |
-
add_settings_field( 'shariff3UU_checkbox_hideuntilcss', __( 'Hide buttons until page is fully loaded.', 'shariff' ),
|
128 |
-
'shariff3UU_checkbox_hideuntilcss_render', 'design', 'shariff3UU_design_section' );
|
129 |
-
|
130 |
-
// open in popup
|
131 |
-
add_settings_field( 'shariff3UU_checkbox_popup', __( 'Open links in a popup (requires JavaScript).', 'shariff' ),
|
132 |
-
'shariff3UU_checkbox_popup_render', 'design', 'shariff3UU_design_section' );
|
133 |
-
|
134 |
-
// third tab - advanced
|
135 |
-
|
136 |
-
// register third tab (advanced) settings and call sanitize function
|
137 |
-
register_setting( 'advanced', 'shariff3UU_advanced', 'shariff3UU_advanced_sanitize' );
|
138 |
-
|
139 |
-
// third tab - advanced options
|
140 |
-
add_settings_section( 'shariff3UU_advanced_section', __( 'Advanced options', 'shariff' ),
|
141 |
-
'shariff3UU_advanced_section_callback', 'advanced' );
|
142 |
-
|
143 |
-
// info url
|
144 |
-
add_settings_field(
|
145 |
-
'shariff3UU_text_info_url', '<div style="width:450px">' . __( 'Custom link for the info button:', 'shariff' ) . '</div>',
|
146 |
-
'shariff3UU_text_info_url_render', 'advanced', 'shariff3UU_advanced_section' );
|
147 |
-
|
148 |
-
// twitter via
|
149 |
-
add_settings_field(
|
150 |
-
'shariff3UU_text_twittervia', __( 'Twitter username for the via tag:', 'shariff' ),
|
151 |
-
'shariff3UU_text_twittervia_render', 'advanced', 'shariff3UU_advanced_section' );
|
152 |
-
|
153 |
-
// flattr username
|
154 |
-
add_settings_field(
|
155 |
-
'shariff3UU_text_flattruser', __( 'Flattr username:', 'shariff' ),
|
156 |
-
'shariff3UU_text_flattruser_render', 'advanced', 'shariff3UU_advanced_section' );
|
157 |
-
|
158 |
-
// patreon username
|
159 |
-
add_settings_field(
|
160 |
-
'shariff3UU_text_patreonid', __( 'Patreon username:', 'shariff' ),
|
161 |
-
'shariff3UU_text_patreonid_render', 'advanced', 'shariff3UU_advanced_section' );
|
162 |
-
|
163 |
-
// paypal button id
|
164 |
-
add_settings_field(
|
165 |
-
'shariff3UU_text_paypalbuttonid', __( 'PayPal hosted button ID:', 'shariff' ),
|
166 |
-
'shariff3UU_text_paypalbuttonid_render', 'advanced', 'shariff3UU_advanced_section' );
|
167 |
-
|
168 |
-
// paypalme id
|
169 |
-
add_settings_field(
|
170 |
-
'shariff3UU_text_paypalmeid', __( 'PayPal.Me ID:', 'shariff' ),
|
171 |
-
'shariff3UU_text_paypalmeid_render', 'advanced', 'shariff3UU_advanced_section' );
|
172 |
-
|
173 |
-
// bitcoin address
|
174 |
-
add_settings_field(
|
175 |
-
'shariff3UU_text_bitcoinaddress', __( 'Bitcoin address:', 'shariff' ),
|
176 |
-
'shariff3UU_text_bitcoinaddress_render', 'advanced', 'shariff3UU_advanced_section' );
|
177 |
-
|
178 |
-
// rss feed
|
179 |
-
add_settings_field(
|
180 |
-
'shariff3UU_text_rssfeed', __( 'RSS feed:', 'shariff' ),
|
181 |
-
'shariff3UU_text_rssfeed_render', 'advanced', 'shariff3UU_advanced_section' );
|
182 |
-
|
183 |
-
// default image for pinterest
|
184 |
-
add_settings_field( 'shariff3UU_text_default_pinterest', __( 'Default image for Pinterest:', 'shariff' ),
|
185 |
-
'shariff3UU_text_default_pinterest_render', 'advanced', 'shariff3UU_advanced_section' );
|
186 |
-
|
187 |
-
// shortcode priority
|
188 |
-
add_settings_field( 'shariff3UU_number_shortcodeprio', __( 'Shortcode priority:', 'shariff' ),
|
189 |
-
'shariff3UU_number_shortcodeprio_render', 'advanced', 'shariff3UU_advanced_section' );
|
190 |
-
|
191 |
-
// fourth tab - mailform
|
192 |
-
|
193 |
-
// register fourth tab (mailform) settings and call sanitize function
|
194 |
-
register_setting( 'mailform', 'shariff3UU_mailform', 'shariff3UU_mailform_sanitize' );
|
195 |
-
|
196 |
-
// fourth tab - mailform options
|
197 |
-
add_settings_section( 'shariff3UU_mailform_section', __( 'Mail form options', 'shariff' ),
|
198 |
-
'shariff3UU_mailform_section_callback', 'mailform' );
|
199 |
-
|
200 |
-
// disable mailform
|
201 |
-
add_settings_field(
|
202 |
-
'shariff3UU_checkbox_disable_mailform', '<div style="width:450px">' . __( 'Disable the mail form functionality.', 'shariff' ) . '</div>',
|
203 |
-
'shariff3UU_checkbox_disable_mailform_render', 'mailform', 'shariff3UU_mailform_section' );
|
204 |
-
|
205 |
-
// require sender e-mail address
|
206 |
-
add_settings_field(
|
207 |
-
'shariff3UU_checkbox_require_sender', __( 'Require sender e-mail address.', 'shariff' ),
|
208 |
-
'shariff3UU_checkbox_require_sender_render', 'mailform', 'shariff3UU_mailform_section' );
|
209 |
-
|
210 |
-
// mailform language
|
211 |
-
add_settings_field(
|
212 |
-
'shariff3UU_select_mailform_language', __( 'Mailform language:', 'shariff' ),
|
213 |
-
'shariff3UU_select_mailform_language_render', 'mailform', 'shariff3UU_mailform_section' );
|
214 |
-
|
215 |
-
// add content of the post to e-mails
|
216 |
-
add_settings_field(
|
217 |
-
'shariff3UU_checkbox_mail_add_post_content', __( 'Add the post content to the e-mail body.', 'shariff' ),
|
218 |
-
'shariff3UU_checkbox_mail_add_post_content_render', 'mailform', 'shariff3UU_mailform_section' );
|
219 |
-
|
220 |
-
// mail sender name
|
221 |
-
add_settings_field(
|
222 |
-
'shariff3UU_text_mail_sender_name', __( 'Default sender name:', 'shariff' ),
|
223 |
-
'shariff3UU_text_mail_sender_name_render', 'mailform', 'shariff3UU_mailform_section' );
|
224 |
-
|
225 |
-
// mail sender address
|
226 |
-
add_settings_field(
|
227 |
-
'shariff3UU_text_mail_sender_from', __( 'Default sender e-mail address:', 'shariff' ),
|
228 |
-
'shariff3UU_text_mail_sender_from_render', 'mailform', 'shariff3UU_mailform_section' );
|
229 |
-
|
230 |
-
// use anchor
|
231 |
-
add_settings_field(
|
232 |
-
'shariff3UU_checkbox_mailform_anchor', __( 'Use an anchor to jump to the mail form.', 'shariff' ),
|
233 |
-
'shariff3UU_checkbox_mailform_anchor_render', 'mailform', 'shariff3UU_mailform_section' );
|
234 |
-
|
235 |
-
// wait timer
|
236 |
-
add_settings_field(
|
237 |
-
'shariff3UU_number_mailform_wait', __( 'Time to wait until the same IP address is allowed to submit the form again (in seconds):', 'shariff' ),
|
238 |
-
'shariff3UU_number_mailform_wait_render', 'mailform', 'shariff3UU_mailform_section' );
|
239 |
-
|
240 |
-
// fifth tab - statistic
|
241 |
-
|
242 |
-
// register fifth tab (statistic) settings and call sanitize function
|
243 |
-
register_setting( 'statistic', 'shariff3UU_statistic', 'shariff3UU_statistic_sanitize' );
|
244 |
-
|
245 |
-
// fifth tab (statistic)
|
246 |
-
add_settings_section( 'shariff3UU_statistic_section', __( 'Statistic', 'shariff' ),
|
247 |
-
'shariff3UU_statistic_section_callback', 'statistic' );
|
248 |
-
|
249 |
-
// statistic
|
250 |
-
add_settings_field( 'shariff3UU_checkbox_backend', '<div style="width:450px">' . __( 'Enable statistic.', 'shariff' ) . '</div>',
|
251 |
-
'shariff3UU_checkbox_backend_render', 'statistic', 'shariff3UU_statistic_section' );
|
252 |
-
|
253 |
-
// share counts
|
254 |
-
add_settings_field( 'shariff3UU_checkbox_sharecounts', __( 'Show share counts on buttons.', 'shariff' ),
|
255 |
-
'shariff3UU_checkbox_sharecounts_render', 'statistic', 'shariff3UU_statistic_section' );
|
256 |
-
|
257 |
-
// hide when zero
|
258 |
-
add_settings_field( 'shariff3UU_checkbox_hidezero', __( 'Hide share counts when they are zero.', 'shariff' ),
|
259 |
-
'shariff3UU_checkbox_hidezero_render', 'statistic', 'shariff3UU_statistic_section' );
|
260 |
-
|
261 |
-
// Facebook App ID
|
262 |
-
add_settings_field( 'shariff3UU_text_fb_id', __( 'Facebook App ID:', 'shariff' ),
|
263 |
-
'shariff3UU_text_fb_id_render', 'statistic', 'shariff3UU_statistic_section' );
|
264 |
-
|
265 |
-
// Facebook App Secret
|
266 |
-
add_settings_field( 'shariff3UU_text_fb_secret', __( 'Facebook App Secret:', 'shariff' ),
|
267 |
-
'shariff3UU_text_fb_secret_render', 'statistic', 'shariff3UU_statistic_section' );
|
268 |
-
|
269 |
-
// autoamtic cache
|
270 |
-
add_settings_field( 'shariff3UU_checkbox_automaticcache', __( 'Fill cache automatically.', 'shariff' ),
|
271 |
-
'shariff3UU_checkbox_automaticcache_render', 'statistic', 'shariff3UU_statistic_section' );
|
272 |
-
|
273 |
-
// ranking
|
274 |
-
add_settings_field( 'shariff3UU_number_ranking', __( 'Number of posts on ranking tab:', 'shariff' ),
|
275 |
-
'shariff3UU_number_ranking_render', 'statistic', 'shariff3UU_statistic_section' );
|
276 |
-
|
277 |
-
// ttl
|
278 |
-
add_settings_field( 'shariff3UU_number_ttl', __( 'Cache TTL in seconds (60 - 7200):', 'shariff' ),
|
279 |
-
'shariff3UU_number_ttl_render', 'statistic', 'shariff3UU_statistic_section' );
|
280 |
-
|
281 |
-
// disable dynamic cache lifespan
|
282 |
-
add_settings_field( 'shariff3UU_checkbox_disable_dynamic_cache', __( 'Disable the dynamic cache lifespan (not recommended).', 'shariff' ),
|
283 |
-
'shariff3UU_checkbox_disable_dynamic_cache_render', 'statistic', 'shariff3UU_statistic_section' );
|
284 |
-
|
285 |
-
// Twitter NewShareCount
|
286 |
-
add_settings_field( 'shariff3UU_checkbox_newsharecount', __( 'Use NewShareCount instead of OpenShareCount for Twitter.', 'shariff' ),
|
287 |
-
'shariff3UU_checkbox_newsharecount_render', 'statistic', 'shariff3UU_statistic_section' );
|
288 |
-
|
289 |
-
// disable services
|
290 |
-
add_settings_field( 'shariff3UU_multiplecheckbox_disable_services', __( 'Disable the following services (share counts only):', 'shariff' ),
|
291 |
-
'shariff3UU_multiplecheckbox_disable_services_render', 'statistic', 'shariff3UU_statistic_section' );
|
292 |
-
|
293 |
-
// external hosts
|
294 |
-
add_settings_field( 'shariff3UU_text_external_host', __( 'External API for share counts:', 'shariff' ),
|
295 |
-
'shariff3UU_text_external_host_render', 'statistic', 'shariff3UU_statistic_section' );
|
296 |
-
|
297 |
-
// request external api directly from js
|
298 |
-
add_settings_field( 'shariff3UU_checkbox_external_direct', __( 'Request external API directly.', 'shariff' ),
|
299 |
-
'shariff3UU_checkbox_external_direct_render', 'statistic', 'shariff3UU_statistic_section' );
|
300 |
-
|
301 |
-
// wp in subfolder and api only reachable there?
|
302 |
-
add_settings_field( 'shariff3UU_checkbox_subapi', __( 'Local API not reachable in root.', 'shariff' ),
|
303 |
-
'shariff3UU_checkbox_subapi_render', 'statistic', 'shariff3UU_statistic_section' );
|
304 |
-
|
305 |
-
// sixth tab - help
|
306 |
-
|
307 |
-
// register sixth tab (help)
|
308 |
-
add_settings_section( 'shariff3UU_help_section', __( 'Shariff Help', 'shariff' ),
|
309 |
-
'shariff3UU_help_section_callback', 'help' );
|
310 |
-
|
311 |
-
// seventh tab - status
|
312 |
-
|
313 |
-
// register seventh tab (status)
|
314 |
-
add_settings_section( 'shariff3UU_status_section', __( 'Status', 'shariff' ),
|
315 |
-
'shariff3UU_status_section_callback', 'status' );
|
316 |
-
|
317 |
-
// eigth tab - ranking
|
318 |
-
|
319 |
-
// register eigth tab (ranking)
|
320 |
-
add_settings_section( 'shariff3UU_ranking_section', __( 'Ranking', 'shariff' ),
|
321 |
-
'shariff3UU_ranking_section_callback', 'ranking' );
|
322 |
-
}
|
323 |
-
|
324 |
-
// sanitize input from the basic settings page
|
325 |
-
function shariff3UU_basic_sanitize( $input ) {
|
326 |
-
// create array
|
327 |
-
$valid = array();
|
328 |
-
|
329 |
-
if ( isset( $input["version"] ) ) $valid["version"] = sanitize_text_field( $input["version"] );
|
330 |
-
if ( isset( $input["services"] ) ) $valid["services"] = trim( preg_replace( "/[^A-Za-z|]/", '', sanitize_text_field( $input["services"] ) ), '|' );
|
331 |
-
if ( isset( $input["add_after"] ) ) $valid["add_after"] = sani_arrays( $input["add_after"] );
|
332 |
-
if ( isset( $input["add_before"] ) ) $valid["add_before"] = sani_arrays( $input["add_before"] );
|
333 |
-
if ( isset( $input["disable_on_protected"] ) ) $valid["disable_on_protected"] = absint( $input["disable_on_protected"] );
|
334 |
-
if ( isset( $input["disable_outside_loop"] ) ) $valid["disable_outside_loop"] = absint( $input["disable_outside_loop"] );
|
335 |
-
|
336 |
-
// remove empty elements
|
337 |
-
$valid = array_filter( $valid );
|
338 |
-
|
339 |
-
return $valid;
|
340 |
-
}
|
341 |
-
|
342 |
-
// sanitize input from the design settings page
|
343 |
-
function shariff3UU_design_sanitize( $input ) {
|
344 |
-
// create array
|
345 |
-
$valid = array();
|
346 |
-
|
347 |
-
if ( isset( $input["lang"] ) ) $valid["lang"] = sanitize_text_field( $input["lang"] );
|
348 |
-
if ( isset( $input["theme"] ) ) $valid["theme"] = sanitize_text_field( $input["theme"] );
|
349 |
-
if ( isset( $input["buttonsize"] ) ) $valid["buttonsize"] = sanitize_text_field( $input["buttonsize"] );
|
350 |
-
if ( isset( $input["buttonstretch"] ) ) $valid["buttonstretch"] = absint( $input["buttonstretch"] );
|
351 |
-
if ( isset( $input["borderradius"] ) ) $valid["borderradius"] = absint( $input["borderradius"] );
|
352 |
-
if ( isset( $input["maincolor"] ) ) $valid["maincolor"] = sanitize_text_field( $input["maincolor"] );
|
353 |
-
if ( isset( $input["secondarycolor"] ) ) $valid["secondarycolor"] = sanitize_text_field( $input["secondarycolor"] );
|
354 |
-
if ( isset( $input["vertical"] ) ) $valid["vertical"] = absint( $input["vertical"] );
|
355 |
-
if ( isset( $input["align"] ) ) $valid["align"] = sanitize_text_field( $input["align"] );
|
356 |
-
if ( isset( $input["align_widget"] ) ) $valid["align_widget"] = sanitize_text_field( $input["align_widget"] );
|
357 |
-
if ( isset( $input["style"] ) ) $valid["style"] = sanitize_text_field( $input["style"] );
|
358 |
-
if ( isset( $input["cssclass"] ) ) $valid["cssclass"] = sanitize_text_field( $input["cssclass"] );
|
359 |
-
if ( isset( $input["headline"] ) ) $valid["headline"] = wp_kses( $input["headline"], $GLOBALS["allowed_tags"] );
|
360 |
-
if ( isset( $input["hideuntilcss"] ) ) $valid["hideuntilcss"] = absint( $input["hideuntilcss"] );
|
361 |
-
if ( isset( $input["popup"] ) ) $valid["popup"] = absint( $input["popup"] );
|
362 |
-
|
363 |
-
// remove empty elements
|
364 |
-
$valid = array_filter($valid);
|
365 |
-
|
366 |
-
return $valid;
|
367 |
-
}
|
368 |
-
|
369 |
-
// sanitize input from the advanced settings page
|
370 |
-
function shariff3UU_advanced_sanitize( $input ) {
|
371 |
-
// create array
|
372 |
-
$valid = array();
|
373 |
-
|
374 |
-
if ( isset($input["info_url"] ) ) $valid["info_url"] = esc_url_raw( $input["info_url"] );
|
375 |
-
if ( isset($input["twitter_via"] ) ) $valid["twitter_via"] = str_replace( '@', '', sanitize_text_field( $input["twitter_via"] ) );
|
376 |
-
if ( isset($input["flattruser"] ) ) $valid["flattruser"] = str_replace( '@', '', sanitize_text_field( $input["flattruser"] ) );
|
377 |
-
if ( isset($input["patreonid"] ) ) $valid["patreonid"] = str_replace( '@', '', sanitize_text_field( $input["patreonid"] ) );
|
378 |
-
if ( isset($input["paypalbuttonid"] ) ) $valid["paypalbuttonid"] = str_replace( '@', '', sanitize_text_field( $input["paypalbuttonid"] ) );
|
379 |
-
if ( isset($input["paypalmeid"] ) ) $valid["paypalmeid"] = str_replace( '@', '', sanitize_text_field( $input["paypalmeid"] ) );
|
380 |
-
if ( isset($input["bitcoinaddress"] ) ) $valid["bitcoinaddress"] = str_replace( '@', '', sanitize_text_field( $input["bitcoinaddress"] ) );
|
381 |
-
if ( isset($input["rssfeed"] ) ) $valid["rssfeed"] = str_replace( '@', '', sanitize_text_field( $input["rssfeed"] ) );
|
382 |
-
if ( isset($input["default_pinterest"] ) ) $valid["default_pinterest"] = sanitize_text_field( $input["default_pinterest"] );
|
383 |
-
if ( isset($input["shortcodeprio"] ) ) $valid["shortcodeprio"] = absint( $input["shortcodeprio"] );
|
384 |
-
|
385 |
-
// remove empty elements
|
386 |
-
$valid = array_filter( $valid );
|
387 |
-
|
388 |
-
return $valid;
|
389 |
-
}
|
390 |
-
|
391 |
-
// sanitize input from the mailform settings page
|
392 |
-
function shariff3UU_mailform_sanitize( $input ) {
|
393 |
-
// create array
|
394 |
-
$valid = array();
|
395 |
-
|
396 |
-
if ( isset( $input["disable_mailform"] ) ) $valid["disable_mailform"] = absint( $input["disable_mailform"] );
|
397 |
-
if ( isset( $input["require_sender"] ) ) $valid["require_sender"] = absint( $input["require_sender"] );
|
398 |
-
if ( isset( $input["mailform_language"] ) ) $valid["mailform_language"] = sanitize_text_field( $input["mailform_language"] );
|
399 |
-
if ( isset( $input["mail_add_post_content"] ) ) $valid["mail_add_post_content"] = absint( $input["mail_add_post_content"] );
|
400 |
-
if ( isset( $input["mail_sender_name"] ) ) $valid["mail_sender_name"] = sanitize_text_field( $input["mail_sender_name"] );
|
401 |
-
if ( isset( $input["mail_sender_from"] ) && is_email( $input["mail_sender_from"] ) != false ) $valid["mail_sender_from"] = sanitize_email( $input["mail_sender_from"] );
|
402 |
-
if ( isset( $input["mailform_anchor"] ) ) $valid["mailform_anchor"] = absint( $input["mailform_anchor"] );
|
403 |
-
if ( isset( $input["mailform_wait"] ) ) $valid["mailform_wait"] = absint( $input["mailform_wait"] );
|
404 |
-
|
405 |
-
// protect users from themselfs
|
406 |
-
if ( isset( $valid["mailform_wait"] ) && $valid["mailform_wait"] < '5' ) $valid["mailform_wait"] = '';
|
407 |
-
elseif ( isset( $valid["mailform_wait"] ) && $valid["mailform_wait"] > '86400' ) $valid["mailform_wait"] = '86400';
|
408 |
-
|
409 |
-
// remove empty elements
|
410 |
-
$valid = array_filter( $valid );
|
411 |
-
|
412 |
-
return $valid;
|
413 |
-
}
|
414 |
-
|
415 |
-
// sanitize input from the statistic settings page
|
416 |
-
function shariff3UU_statistic_sanitize( $input ) {
|
417 |
-
// create array
|
418 |
-
$valid = array();
|
419 |
-
|
420 |
-
if ( isset( $input["backend"] ) ) $valid["backend"] = absint( $input["backend"] );
|
421 |
-
if ( isset( $input["sharecounts"] ) ) $valid["sharecounts"] = absint( $input["sharecounts"] );
|
422 |
-
if ( isset( $input["hidezero"] ) ) $valid["hidezero"] = absint( $input["hidezero"] );
|
423 |
-
if ( isset( $input["ranking"] ) ) $valid["ranking"] = absint( $input["ranking"] );
|
424 |
-
if ( isset( $input["automaticcache"] ) ) $valid["automaticcache"] = absint( $input["automaticcache"] );
|
425 |
-
if ( isset( $input["fb_id"] ) ) $valid["fb_id"] = sanitize_text_field( $input["fb_id"] );
|
426 |
-
if ( isset( $input["fb_secret"] ) ) $valid["fb_secret"] = sanitize_text_field( $input["fb_secret"] );
|
427 |
-
if ( isset( $input["ttl"] ) ) $valid["ttl"] = absint( $input["ttl"] );
|
428 |
-
if ( isset( $input["disable_dynamic_cache"] ) ) $valid["disable_dynamic_cache"] = absint( $input["disable_dynamic_cache"] );
|
429 |
-
if ( isset( $input["newsharecount"] ) ) $valid["newsharecount"] = absint( $input["newsharecount"] );
|
430 |
-
if ( isset( $input["disable"] ) ) $valid["disable"] = sani_arrays( $input["disable"] );
|
431 |
-
if ( isset( $input["external_host"] ) ) $valid["external_host"] = str_replace( ' ', '', rtrim( esc_url_raw( $input["external_host"], "/" ) ) );
|
432 |
-
if ( isset( $input["external_direct"] ) ) $valid["external_direct"] = absint( $input["external_direct"] );
|
433 |
-
if ( isset( $input["subapi"] ) ) $valid["subapi"] = absint( $input["subapi"] );
|
434 |
-
|
435 |
-
// protect users from themselfs
|
436 |
-
if ( isset( $valid["ttl"] ) && $valid["ttl"] < '60' ) $valid["ttl"] = '';
|
437 |
-
elseif ( isset( $valid["ttl"] ) && $valid["ttl"] > '7200' ) $valid["ttl"] = '7200';
|
438 |
-
|
439 |
-
// remove empty elements
|
440 |
-
$valid = array_filter( $valid );
|
441 |
-
|
442 |
-
return $valid;
|
443 |
-
}
|
444 |
-
|
445 |
-
// helper function to sanitize arrays
|
446 |
-
function sani_arrays( $data = array() ) {
|
447 |
-
if ( ! is_array($data) || ! count( $data ) ) {
|
448 |
-
return array();
|
449 |
-
}
|
450 |
-
foreach ( $data as $k => $v ) {
|
451 |
-
if ( ! is_array( $v ) && ! is_object( $v ) ) {
|
452 |
-
$data[ $k ] = absint( trim( $v ) );
|
453 |
-
}
|
454 |
-
if ( is_array( $v ) ) {
|
455 |
-
$data[ $k ] = sani_arrays( $v );
|
456 |
-
}
|
457 |
-
}
|
458 |
-
return $data;
|
459 |
-
}
|
460 |
-
|
461 |
-
// render admin options: use isset() to prevent errors while debug mode is on
|
462 |
-
|
463 |
-
// basic options
|
464 |
-
|
465 |
-
// description basic options
|
466 |
-
function shariff3UU_basic_section_callback() {
|
467 |
-
echo __( "Select the desired services in the order you want them to be displayed and where the Shariff buttons should be included automatically.", "shariff" );
|
468 |
-
}
|
469 |
-
|
470 |
-
// services
|
471 |
-
function shariff3UU_text_services_render() {
|
472 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["services"] ) ) {
|
473 |
-
$services = $GLOBALS["shariff3UU_basic"]["services"];
|
474 |
-
}
|
475 |
-
else {
|
476 |
-
$services = '';
|
477 |
-
}
|
478 |
-
echo '<input type="text" name="shariff3UU_basic[services]" value="' . esc_html($services) . '" size="75" placeholder="twitter|facebook|googleplus|info">';
|
479 |
-
echo '<p><code>facebook|twitter|googleplus|whatsapp|threema|pinterest|xing|linkedin|reddit|vk|odnoklassniki|diaspora|stumbleupon</code></p>';
|
480 |
-
echo '<p><code>tumblr|addthis|pocket|flattr|patreon|paypal|paypalme|bitcoin|mailform|mailto|printer|rss|info</code></p>';
|
481 |
-
echo '<p>' . __( 'Use the pipe sign | (Alt Gr + < or ⌥ + 7) between two or more services.', 'shariff' ) . '</p>';
|
482 |
-
}
|
483 |
-
|
484 |
-
// add after
|
485 |
-
function shariff3UU_multiplecheckbox_add_after_render() {
|
486 |
-
// add after all posts
|
487 |
-
echo '<p><input type="checkbox" name="shariff3UU_basic[add_after][posts]" ';
|
488 |
-
if ( isset( $GLOBALS['shariff3UU_basic']['add_after']['posts'] ) ) echo checked( $GLOBALS['shariff3UU_basic']['add_after']['posts'], 1, 0 );
|
489 |
-
echo ' value="1">' . __('Posts', 'shariff') . '</p>';
|
490 |
-
|
491 |
-
// add after all posts (blog page)
|
492 |
-
echo '<p><input type="checkbox" name="shariff3UU_basic[add_after][posts_blogpage]" ';
|
493 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["add_after"]["posts_blogpage"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_after"]["posts_blogpage"], 1, 0 );
|
494 |
-
echo ' value="1">' . __('Posts (blog page)', 'shariff') . '</p>';
|
495 |
-
|
496 |
-
// add after all pages
|
497 |
-
echo '<p><input type="checkbox" name="shariff3UU_basic[add_after][pages]" ';
|
498 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["add_after"]["pages"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_after"]["pages"], 1, 0 );
|
499 |
-
echo ' value="1">' . __('Pages', 'shariff') . '</p>';
|
500 |
-
|
501 |
-
// add after all bbpress replies
|
502 |
-
echo '<p><input type="checkbox" name="shariff3UU_basic[add_after][bbp_reply]" ';
|
503 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["add_after"]["bbp_reply"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_after"]["bbp_reply"], 1, 0 );
|
504 |
-
echo ' value="1">' . __('bbPress replies', 'shariff') . '</p>';
|
505 |
-
|
506 |
-
// add after all excerpts
|
507 |
-
echo '<p><input type="checkbox" name="shariff3UU_basic[add_after][excerpt]" ';
|
508 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["add_after"]["excerpt"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_after"]["excerpt"], 1, 0 );
|
509 |
-
echo ' value="1">' . __('Excerpts', 'shariff') . '</p>';
|
510 |
-
|
511 |
-
// add after custom post types - choose after which to add
|
512 |
-
$post_types = get_post_types( array( '_builtin' => FALSE ) );
|
513 |
-
if ( isset( $post_types ) && is_array( $post_types ) && ! empty( $post_types ) ) {
|
514 |
-
echo '<p>Custom Post Types:</p>';
|
515 |
-
};
|
516 |
-
|
517 |
-
foreach ( $post_types as $post_type ) {
|
518 |
-
$object = get_post_type_object( $post_type );
|
519 |
-
printf(
|
520 |
-
'<p><input type="checkbox" name="shariff3UU_basic[add_after][%s]" %s value="1">%s</p>',
|
521 |
-
$post_type,
|
522 |
-
isset( $GLOBALS['shariff3UU_basic']['add_after'][$post_type] ) ? checked( $GLOBALS['shariff3UU_basic']['add_after'][$post_type], 1, 0 ) : '',
|
523 |
-
$object->labels->singular_name // this should already be localized <- not always, but there is no way to know, so we have to accept the language mixup
|
524 |
-
);
|
525 |
-
}
|
526 |
-
}
|
527 |
-
|
528 |
-
// add before
|
529 |
-
function shariff3UU_multiplecheckbox_add_before_render() {
|
530 |
-
// Add before all posts
|
531 |
-
echo '<p><input type="checkbox" name="shariff3UU_basic[add_before][posts]" ';
|
532 |
-
if ( isset( $GLOBALS['shariff3UU_basic']['add_before']['posts'] ) ) echo checked( $GLOBALS['shariff3UU_basic']['add_before']['posts'], 1, 0 );
|
533 |
-
echo ' value="1">' . __('Posts', 'shariff') . '</p>';
|
534 |
-
|
535 |
-
// Add before all posts (blog page)
|
536 |
-
echo '<p><input type="checkbox" name="shariff3UU_basic[add_before][posts_blogpage]" ';
|
537 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["add_before"]["posts_blogpage"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_before"]["posts_blogpage"], 1, 0 );
|
538 |
-
echo ' value="1">' . __('Posts (blog page)', 'shariff') . '</p>';
|
539 |
-
|
540 |
-
// Add before all pages
|
541 |
-
echo '<p><input type="checkbox" name="shariff3UU_basic[add_before][pages]" ';
|
542 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["add_before"]["pages"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_before"]["pages"], 1, 0 );
|
543 |
-
echo ' value="1">' . __('Pages', 'shariff') . '</p>';
|
544 |
-
|
545 |
-
// Add before all excerpts
|
546 |
-
echo '<p><input type="checkbox" name="shariff3UU_basic[add_before][excerpt]" ';
|
547 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["add_before"]["excerpt"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_before"]["excerpt"], 1, 0 );
|
548 |
-
echo ' value="1">' . __('Excerpts', 'shariff') . '</p>';
|
549 |
-
}
|
550 |
-
|
551 |
-
// disable on password protected posts
|
552 |
-
function shariff3UU_checkbox_disable_on_protected_render() {
|
553 |
-
echo '<input type="checkbox" name="shariff3UU_basic[disable_on_protected]" ';
|
554 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["disable_on_protected"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["disable_on_protected"], 1, 0 );
|
555 |
-
echo ' value="1">';
|
556 |
-
}
|
557 |
-
|
558 |
-
// disable outside loop
|
559 |
-
function shariff3UU_checkbox_disable_outside_loop_render() {
|
560 |
-
echo '<input type="checkbox" name="shariff3UU_basic[disable_outside_loop]" ';
|
561 |
-
if ( isset( $GLOBALS["shariff3UU_basic"]["disable_outside_loop"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["disable_outside_loop"], 1, 0 );
|
562 |
-
echo ' value="1">';
|
563 |
-
}
|
564 |
-
|
565 |
-
// design options
|
566 |
-
|
567 |
-
// description design options
|
568 |
-
function shariff3UU_design_section_callback(){
|
569 |
-
echo __( 'This configures the default design of the Shariff buttons. Most options can be overwritten for single posts or pages with the options within the <code>[shariff]</code> shorttag. For more information have a look at the ', 'shariff' );
|
570 |
-
echo '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=shariff3uu&tab=help">';
|
571 |
-
echo __( 'Help Section</a> and the ', 'shariff' );
|
572 |
-
echo '<a href="https://wordpress.org/support/plugin/shariff/" target="_blank">';
|
573 |
-
echo __( 'Support Forum</a>.', 'shariff' );
|
574 |
-
}
|
575 |
-
|
576 |
-
// language
|
577 |
-
function shariff3UU_select_language_render() {
|
578 |
-
$options = $GLOBALS["shariff3UU_design"];
|
579 |
-
if ( ! isset( $options["lang"] ) ) $options["lang"] = '';
|
580 |
-
echo '<select name="shariff3UU_design[lang]">
|
581 |
-
<option value="" ' . selected( $options["lang"], "", 0 ) . '>' . __( "auto", "shariff3UU") . '</option>
|
582 |
-
<option value="en" ' . selected( $options["lang"], "en", 0 ) . '>English</option>
|
583 |
-
<option value="de" ' . selected( $options["lang"], "de", 0 ) . '>Deutsch</option>
|
584 |
-
<option value="fr" ' . selected( $options["lang"], "fr", 0 ) . '>Français</option>
|
585 |
-
<option value="es" ' . selected( $options["lang"], "es", 0 ) . '>Español</option>
|
586 |
-
<option value="zh" ' . selected( $options["lang"], "zh", 0 ) . '>Chinese</option>
|
587 |
-
<option value="hr" ' . selected( $options["lang"], "hr", 0 ) . '>Croatian</option>
|
588 |
-
<option value="da" ' . selected( $options["lang"], "da", 0 ) . '>Danish</option>
|
589 |
-
<option value="nl" ' . selected( $options["lang"], "nl", 0 ) . '>Dutch</option>
|
590 |
-
<option value="fi" ' . selected( $options["lang"], "fi", 0 ) . '>Finnish</option>
|
591 |
-
<option value="it" ' . selected( $options["lang"], "it", 0 ) . '>Italiano</option>
|
592 |
-
<option value="ja" ' . selected( $options["lang"], "ja", 0 ) . '>Japanese</option>
|
593 |
-
<option value="ko" ' . selected( $options["lang"], "ko", 0 ) . '>Korean</option>
|
594 |
-
<option value="no" ' . selected( $options["lang"], "no", 0 ) . '>Norwegian</option>
|
595 |
-
<option value="pl" ' . selected( $options["lang"], "pl", 0 ) . '>Polish</option>
|
596 |
-
<option value="pt" ' . selected( $options["lang"], "pt", 0 ) . '>Portuguese</option>
|
597 |
-
<option value="ro" ' . selected( $options["lang"], "ro", 0 ) . '>Romanian</option>
|
598 |
-
<option value="ru" ' . selected( $options["lang"], "ru", 0 ) . '>Russian</option>
|
599 |
-
<option value="sk" ' . selected( $options["lang"], "sk", 0 ) . '>Slovak</option>
|
600 |
-
<option value="sl" ' . selected( $options["lang"], "sl", 0 ) . '>Slovene</option>
|
601 |
-
<option value="sr" ' . selected( $options["lang"], "sr", 0 ) . '>Serbian</option>
|
602 |
-
<option value="sv" ' . selected( $options["lang"], "sv", 0 ) . '>Swedish</option>
|
603 |
-
<option value="tr" ' . selected( $options["lang"], "tr", 0 ) . '>Turkish</option>
|
604 |
-
</select>';
|
605 |
-
}
|
606 |
-
|
607 |
-
// theme
|
608 |
-
function shariff3UU_radio_theme_render() {
|
609 |
-
$options = $GLOBALS["shariff3UU_design"];
|
610 |
-
if ( ! isset( $options["theme"] ) ) $options["theme"] = "";
|
611 |
-
$plugins_url = plugins_url();
|
612 |
-
echo '<div style="display:table;border-spacing:10px;margin:-15px 0 -5px -5px;border-collapse: separate">
|
613 |
-
<div style="display:table-row"><div style="display:table-cell;vertical-align:middle;min-width:75px"><input type="radio" name="shariff3UU_design[theme]" value="" ' . checked( $options["theme"], "", 0 ) . '>default</div><div class="shariff_options-cell"><img src="' . $plugins_url . '/shariff/pictos/defaultBtns.png"></div></div>
|
614 |
-
<div style="display:table-row"><div style="display:table-cell;vertical-align:middle;min-width:75px"><input type="radio" name="shariff3UU_design[theme]" value="color" ' . checked( $options["theme"], "color", 0 ) . '>color</div><div class="shariff_options-cell"><img src="' . $plugins_url . '/shariff/pictos/colorBtns.png"></div></div>
|
615 |
-
<div style="display:table-row"><div style="display:table-cell;vertical-align:middle;min-width:75px"><input type="radio" name="shariff3UU_design[theme]" value="grey" ' . checked( $options["theme"], "grey", 0 ) . '>grey</div><div class="shariff_options-cell"><img src="' . $plugins_url . '/shariff/pictos/greyBtns.png"></div></div>
|
616 |
-
<div style="display:table-row"><div style="display:table-cell;vertical-align:middle;min-width:75px"><input type="radio" name="shariff3UU_design[theme]" value="white" ' . checked( $options["theme"], "white", 0 ) . '>white</div><div class="shariff_options-cell"><img src="' . $plugins_url . '/shariff/pictos/whiteBtns.png"></div></div>
|
617 |
-
<div style="display:table-row"><div style="display:table-cell;vertical-align:middle;min-width:75px"><input type="radio" name="shariff3UU_design[theme]" value="round" ' . checked( $options["theme"], "round", 0 ) . '>round</div><div class="shariff_options-cell"><img src="' . $plugins_url . '/shariff/pictos/roundBtns.png"></div></div>
|
618 |
-
</div>';
|
619 |
-
}
|
620 |
-
|
621 |
-
// button size
|
622 |
-
function shariff3UU_checkbox_buttonsize_render() {
|
623 |
-
$options = $GLOBALS['shariff3UU_design'];
|
624 |
-
if ( ! isset( $options['buttonsize'] ) ) $options['buttonsize'] = 'medium';
|
625 |
-
echo '<p><input type="radio" name="shariff3UU_design[buttonsize]" value="small" ' . checked( $options["buttonsize"], "small", 0 ) . '>' . __( "small", "shariff" ) . '</p>';
|
626 |
-
echo '<p><input type="radio" name="shariff3UU_design[buttonsize]" value="medium" ' . checked( $options["buttonsize"], "medium", 0 ) . '>' . __( "medium", "shariff" ) . '</p>';
|
627 |
-
echo '<p><input type="radio" name="shariff3UU_design[buttonsize]" value="large" ' . checked( $options["buttonsize"], "large", 0 ) . '>' . __( "large", "shariff" ) . '</p>';
|
628 |
-
}
|
629 |
-
|
630 |
-
// button stretch
|
631 |
-
function shariff3UU_checkbox_buttonstretch_render() {
|
632 |
-
$plugins_url = plugins_url();
|
633 |
-
echo '<input type="checkbox" name="shariff3UU_design[buttonstretch]" ';
|
634 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["buttonstretch"] ) ) echo checked( $GLOBALS["shariff3UU_design"]["buttonstretch"], 1, 0 );
|
635 |
-
echo ' value="1">';
|
636 |
-
}
|
637 |
-
|
638 |
-
// border radius
|
639 |
-
function shariff3UU_number_borderradius_render() {
|
640 |
-
$plugins_url = plugins_url();
|
641 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["borderradius"] ) ) {
|
642 |
-
$borderradius = $GLOBALS["shariff3UU_design"]["borderradius"];
|
643 |
-
}
|
644 |
-
else {
|
645 |
-
$borderradius = '';
|
646 |
-
}
|
647 |
-
echo '<input type="number" name="shariff3UU_design[borderradius]" value="'. $borderradius .'" maxlength="2" min="1" max="50" placeholder="50" style="width: 75px">';
|
648 |
-
echo '<img src="'. $plugins_url .'/shariff/pictos/borderradius.png" align="top">';
|
649 |
-
}
|
650 |
-
|
651 |
-
// custom main color
|
652 |
-
function shariff3UU_text_maincolor_render() {
|
653 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["maincolor"] ) ) {
|
654 |
-
$maincolor = $GLOBALS["shariff3UU_design"]["maincolor"];
|
655 |
-
}
|
656 |
-
else {
|
657 |
-
$maincolor = '';
|
658 |
-
}
|
659 |
-
echo '<input type="text" name="shariff3UU_design[maincolor]" value="' . esc_html( $maincolor ) . '" size="7" placeholder="#000000">';
|
660 |
-
}
|
661 |
-
|
662 |
-
// custom secondary color
|
663 |
-
function shariff3UU_text_secondarycolor_render() {
|
664 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["secondarycolor"] ) ) {
|
665 |
-
$secondarycolor = $GLOBALS["shariff3UU_design"]["secondarycolor"];
|
666 |
-
}
|
667 |
-
else {
|
668 |
-
$secondarycolor = '';
|
669 |
-
}
|
670 |
-
echo '<input type="text" name="shariff3UU_design[secondarycolor]" value="' . esc_html( $secondarycolor ) . '" size="7" placeholder="#afafaf">';
|
671 |
-
}
|
672 |
-
|
673 |
-
// vertical
|
674 |
-
function shariff3UU_checkbox_vertical_render() {
|
675 |
-
$plugins_url = plugins_url();
|
676 |
-
echo '<input type="checkbox" name="shariff3UU_design[vertical]" ';
|
677 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["vertical"] ) ) echo checked( $GLOBALS["shariff3UU_design"]["vertical"], 1, 0 );
|
678 |
-
echo ' value="1">';
|
679 |
-
}
|
680 |
-
|
681 |
-
// alignment
|
682 |
-
function shariff3UU_radio_align_render() {
|
683 |
-
$options = $GLOBALS['shariff3UU_design'];
|
684 |
-
if ( ! isset( $options['align'] ) ) $options['align'] = 'flex-start';
|
685 |
-
echo '<p><input type="radio" name="shariff3UU_design[align]" value="flex-start" ' . checked( $options["align"], "flex-start", 0 ) . '>' . __( "left", "shariff" ) . '</p>';
|
686 |
-
echo '<p><input type="radio" name="shariff3UU_design[align]" value="center" ' . checked( $options["align"], "center", 0 ) . '>' . __( "center", "shariff" ) . '</p>';
|
687 |
-
echo '<p><input type="radio" name="shariff3UU_design[align]" value="flex-end" ' . checked( $options["align"], "flex-end", 0 ) . '>' . __( "right", "shariff" ) . '</p>';
|
688 |
-
}
|
689 |
-
|
690 |
-
// alignment widget
|
691 |
-
function shariff3UU_radio_align_widget_render() {
|
692 |
-
$options = $GLOBALS['shariff3UU_design'];
|
693 |
-
if ( ! isset( $options['align_widget'] ) ) $options['align_widget'] = 'flex-start';
|
694 |
-
echo '<p><input type="radio" name="shariff3UU_design[align_widget]" value="flex-start" ' . checked( $options["align_widget"], "flex-start", 0 ) . '>' . __( "left", "shariff" ) . '</p>';
|
695 |
-
echo '<p><input type="radio" name="shariff3UU_design[align_widget]" value="center" ' . checked( $options["align_widget"], "center", 0 ) . '>' . __( "center", "shariff" ) . '</p>';
|
696 |
-
echo '<p><input type="radio" name="shariff3UU_design[align_widget]" value="flex-end" ' . checked( $options["align_widget"], "flex-end", 0 ) . '>' . __( "right", "shariff" ) . '</p>';
|
697 |
-
}
|
698 |
-
|
699 |
-
// headline
|
700 |
-
function shariff3UU_text_headline_render() {
|
701 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["headline"] ) ) {
|
702 |
-
$headline = $GLOBALS["shariff3UU_design"]["headline"];
|
703 |
-
}
|
704 |
-
else {
|
705 |
-
$headline = '';
|
706 |
-
}
|
707 |
-
echo '<input type="text" name="shariff3UU_design[headline]" value="' . esc_html( $headline ) . '" size="50" placeholder="' . __( "Share this post", "shariff" ) . '">';
|
708 |
-
echo '<p>';
|
709 |
-
echo __( 'Basic HTML as well as style and class attributes are allowed. You can use %total to show the total amount of shares.', 'shariff' );
|
710 |
-
echo '<br>';
|
711 |
-
echo __( 'Example:', 'shariff' );
|
712 |
-
echo '<code><h3 class="shariff_headline">';
|
713 |
-
echo __( 'Already shared %total times!', 'shariff' );
|
714 |
-
echo '</h3></code></p>';
|
715 |
-
}
|
716 |
-
|
717 |
-
// custom css
|
718 |
-
function shariff3UU_text_style_render() {
|
719 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["style"] ) ) {
|
720 |
-
$style = $GLOBALS["shariff3UU_design"]["style"];
|
721 |
-
}
|
722 |
-
else {
|
723 |
-
$style = '';
|
724 |
-
}
|
725 |
-
echo '<input type="text" name="shariff3UU_design[style]" value="' . esc_html( $style ) . '" size="50" placeholder="' . __( "More information in the FAQ.", "shariff" ) . '">';
|
726 |
-
}
|
727 |
-
|
728 |
-
// custom css class
|
729 |
-
function shariff3UU_text_cssclass_render() {
|
730 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["cssclass"] ) ) {
|
731 |
-
$cssclass = $GLOBALS["shariff3UU_design"]["cssclass"];
|
732 |
-
}
|
733 |
-
else {
|
734 |
-
$cssclass = '';
|
735 |
-
}
|
736 |
-
echo '<input type="text" name="shariff3UU_design[cssclass]" value="' . esc_html( $cssclass ) . '" size="50" placeholder="' . __( "More information in the FAQ.", "shariff" ) . '">';
|
737 |
-
}
|
738 |
-
|
739 |
-
// hide until page is fully loaded
|
740 |
-
function shariff3UU_checkbox_hideuntilcss_render() {
|
741 |
-
echo '<input type="checkbox" name="shariff3UU_design[hideuntilcss]" ';
|
742 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["hideuntilcss"] ) ) echo checked( $GLOBALS["shariff3UU_design"]["hideuntilcss"], 1, 0 );
|
743 |
-
echo ' value="1">';
|
744 |
-
}
|
745 |
-
|
746 |
-
// open links in a popup
|
747 |
-
function shariff3UU_checkbox_popup_render() {
|
748 |
-
echo '<input type="checkbox" name="shariff3UU_design[popup]" ';
|
749 |
-
if ( isset( $GLOBALS["shariff3UU_design"]["popup"] ) ) echo checked( $GLOBALS["shariff3UU_design"]["popup"], 1, 0 );
|
750 |
-
echo ' value="1">';
|
751 |
-
}
|
752 |
-
|
753 |
-
// advanced options
|
754 |
-
|
755 |
-
// description advanced options
|
756 |
-
function shariff3UU_advanced_section_callback(){
|
757 |
-
echo __( 'This configures the advanced options of Shariff regarding specific services. If you are unsure about an option, take a look at the ', 'shariff' );
|
758 |
-
echo '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=shariff3uu&tab=help">';
|
759 |
-
echo __( 'Help Section</a> and the ', 'shariff' );
|
760 |
-
echo '<a href="https://wordpress.org/support/plugin/shariff/" target="_blank">';
|
761 |
-
echo __( 'Support Forum</a>.', 'shariff' );
|
762 |
-
}
|
763 |
-
|
764 |
-
// info url
|
765 |
-
function shariff3UU_text_info_url_render() {
|
766 |
-
if ( isset( $GLOBALS["shariff3UU_advanced"]["info_url"] ) ) {
|
767 |
-
$info_url = $GLOBALS["shariff3UU_advanced"]["info_url"];
|
768 |
-
}
|
769 |
-
else {
|
770 |
-
$info_url = '';
|
771 |
-
}
|
772 |
-
echo '<input type="text" name="shariff3UU_advanced[info_url]" value="'. esc_html($info_url) .'" size="50" placeholder="http://ct.de/-2467514">';
|
773 |
-
}
|
774 |
-
|
775 |
-
// twitter via
|
776 |
-
function shariff3UU_text_twittervia_render() {
|
777 |
-
if ( isset( $GLOBALS["shariff3UU_advanced"]["twitter_via"] ) ) {
|
778 |
-
$twitter_via = $GLOBALS["shariff3UU_advanced"]["twitter_via"];
|
779 |
-
}
|
780 |
-
else {
|
781 |
-
$twitter_via = '';
|
782 |
-
}
|
783 |
-
echo '<input type="text" name="shariff3UU_advanced[twitter_via]" value="' . $twitter_via . '" size="50" placeholder="' . __( 'username', 'shariff' ) . '">';
|
784 |
-
}
|
785 |
-
|
786 |
-
// flattr username
|
787 |
-
function shariff3UU_text_flattruser_render() {
|
788 |
-
if ( isset($GLOBALS["shariff3UU_advanced"]["flattruser"]) ) {
|
789 |
-
$flattruser = $GLOBALS["shariff3UU_advanced"]["flattruser"];
|
790 |
-
}
|
791 |
-
else {
|
792 |
-
$flattruser = '';
|
793 |
-
}
|
794 |
-
echo '<input type="text" name="shariff3UU_advanced[flattruser]" value="'. $flattruser .'" size="50" placeholder="' . __( 'username', 'shariff' ) . '">';
|
795 |
-
}
|
796 |
-
|
797 |
-
// patreon username
|
798 |
-
function shariff3UU_text_patreonid_render() {
|
799 |
-
if ( isset($GLOBALS["shariff3UU_advanced"]["patreonid"]) ) {
|
800 |
-
$patreonid = $GLOBALS["shariff3UU_advanced"]["patreonid"];
|
801 |
-
}
|
802 |
-
else {
|
803 |
-
$patreonid = '';
|
804 |
-
}
|
805 |
-
echo '<input type="text" name="shariff3UU_advanced[patreonid]" value="'. $patreonid .'" size="50" placeholder="' . __( 'username', 'shariff' ) . '">';
|
806 |
-
}
|
807 |
-
|
808 |
-
// paypal button id
|
809 |
-
function shariff3UU_text_paypalbuttonid_render() {
|
810 |
-
if ( isset($GLOBALS["shariff3UU_advanced"]["paypalbuttonid"]) ) {
|
811 |
-
$paypalbuttonid = $GLOBALS["shariff3UU_advanced"]["paypalbuttonid"];
|
812 |
-
}
|
813 |
-
else {
|
814 |
-
$paypalbuttonid = '';
|
815 |
-
}
|
816 |
-
echo '<input type="text" name="shariff3UU_advanced[paypalbuttonid]" value="'. $paypalbuttonid .'" size="50" placeholder="1ABCDEF23GH4I">';
|
817 |
-
}
|
818 |
-
|
819 |
-
// paypalme id
|
820 |
-
function shariff3UU_text_paypalmeid_render() {
|
821 |
-
if ( isset($GLOBALS["shariff3UU_advanced"]["paypalmeid"]) ) {
|
822 |
-
$paypalmeid = $GLOBALS["shariff3UU_advanced"]["paypalmeid"];
|
823 |
-
}
|
824 |
-
else {
|
825 |
-
$paypalmeid = '';
|
826 |
-
}
|
827 |
-
echo '<input type="text" name="shariff3UU_advanced[paypalmeid]" value="'. $paypalmeid .'" size="50" placeholder="' . __( 'name', 'shariff' ) . '">';
|
828 |
-
}
|
829 |
-
|
830 |
-
// bitcoin address
|
831 |
-
function shariff3UU_text_bitcoinaddress_render() {
|
832 |
-
if ( isset($GLOBALS["shariff3UU_advanced"]["bitcoinaddress"]) ) {
|
833 |
-
$bitcoinaddress = $GLOBALS["shariff3UU_advanced"]["bitcoinaddress"];
|
834 |
-
}
|
835 |
-
else {
|
836 |
-
$bitcoinaddress = '';
|
837 |
-
}
|
838 |
-
echo '<input type="text" name="shariff3UU_advanced[bitcoinaddress]" value="'. $bitcoinaddress .'" size="50" placeholder="1Ab2CdEfGhijKL34mnoPQRSTu5VwXYzaBcD">';
|
839 |
-
}
|
840 |
-
|
841 |
-
// rss feed
|
842 |
-
function shariff3UU_text_rssfeed_render() {
|
843 |
-
if ( isset($GLOBALS["shariff3UU_advanced"]["rssfeed"]) ) {
|
844 |
-
$rssfeed = esc_url( $GLOBALS["shariff3UU_advanced"]["rssfeed"] );
|
845 |
-
}
|
846 |
-
else {
|
847 |
-
$rssfeed = '';
|
848 |
-
}
|
849 |
-
$rssdefault = esc_url( get_bloginfo('rss_url') );
|
850 |
-
echo '<input type="text" name="shariff3UU_advanced[rssfeed]" value="'. $rssfeed .'" size="50" placeholder="' . $rssdefault . '">';
|
851 |
-
}
|
852 |
-
|
853 |
-
// pinterest default image
|
854 |
-
function shariff3UU_text_default_pinterest_render() {
|
855 |
-
$options = $GLOBALS["shariff3UU_advanced"];
|
856 |
-
if ( ! isset( $options["default_pinterest"] ) ) $options["default_pinterest"] = '';
|
857 |
-
echo '<div><input type="text" name="shariff3UU_advanced[default_pinterest]" value="' . $options["default_pinterest"] . '" id="shariff-image-url" class="regular-text"><input type="button" name="upload-btn" id="shariff-upload-btn" class="button-secondary" value="' . __( 'Choose image', 'shariff' ) . '"></div>';
|
858 |
-
}
|
859 |
-
|
860 |
-
// shortcodeprio
|
861 |
-
function shariff3UU_number_shortcodeprio_render() {
|
862 |
-
if ( isset($GLOBALS["shariff3UU_advanced"]["shortcodeprio"]) ) {
|
863 |
-
$prio = $GLOBALS["shariff3UU_advanced"]["shortcodeprio"];
|
864 |
-
}
|
865 |
-
else {
|
866 |
-
$prio = '';
|
867 |
-
}
|
868 |
-
echo '<input type="number" name="shariff3UU_advanced[shortcodeprio]" value="'. $prio .'" maxlength="2" min="0" max="20" placeholder="10" style="width: 75px">';
|
869 |
-
echo '<p>' . __( 'Warning: <strong>DO NOT</strong> change this unless you know what you are doing or have been told so by the plugin author!', 'shariff' ) . '</p>';
|
870 |
-
}
|
871 |
-
|
872 |
-
// mailform options
|
873 |
-
|
874 |
-
// description mailform options
|
875 |
-
function shariff3UU_mailform_section_callback() {
|
876 |
-
echo __( "The mail form can be completely disabled, if not needed. Otherwise, it is recommended to configure a default sender e-mail address from <u>your domain</u> that actually exists, to prevent spam filters from blocking the e-mails.", "shariff" );
|
877 |
-
}
|
878 |
-
|
879 |
-
// disable mailform
|
880 |
-
function shariff3UU_checkbox_disable_mailform_render() {
|
881 |
-
echo '<input type="checkbox" name="shariff3UU_mailform[disable_mailform]" ';
|
882 |
-
if ( isset( $GLOBALS["shariff3UU_mailform"]["disable_mailform"] ) ) echo checked( $GLOBALS["shariff3UU_mailform"]["disable_mailform"], 1, 0 );
|
883 |
-
echo ' value="1">';
|
884 |
-
}
|
885 |
-
|
886 |
-
// require sender e-mail address
|
887 |
-
function shariff3UU_checkbox_require_sender_render() {
|
888 |
-
echo '<input type="checkbox" name="shariff3UU_mailform[require_sender]" ';
|
889 |
-
if ( isset( $GLOBALS["shariff3UU_mailform"]["require_sender"] ) ) echo checked( $GLOBALS["shariff3UU_mailform"]["require_sender"], 1, 0 );
|
890 |
-
echo ' value="1">';
|
891 |
-
}
|
892 |
-
|
893 |
-
// mailform language
|
894 |
-
function shariff3UU_select_mailform_language_render() {
|
895 |
-
$options = $GLOBALS["shariff3UU_mailform"];
|
896 |
-
if ( ! isset( $options["mailform_language"] ) ) $options["mailform_language"] = 'auto';
|
897 |
-
echo '<select name="shariff3UU_mailform[mailform_language]" style="min-width:110px">
|
898 |
-
<option value="auto" ' . selected( $options["mailform_language"], "auto", 0 ) . '>' . __( "auto", "shariff3UU") . '</option>
|
899 |
-
<option value="EN" ' . selected( $options["mailform_language"], "EN", 0 ) . '>English</option>
|
900 |
-
<option value="DE" ' . selected( $options["mailform_language"], "DE", 0 ) . '>Deutsch</option>
|
901 |
-
<option value="FR" ' . selected( $options["mailform_language"], "FR", 0 ) . '>Français</option>
|
902 |
-
<option value="IT" ' . selected( $options["mailform_language"], "IT", 0 ) . '>Italiano</option>';
|
903 |
-
}
|
904 |
-
|
905 |
-
// add post content
|
906 |
-
function shariff3UU_checkbox_mail_add_post_content_render() {
|
907 |
-
echo '<input type="checkbox" name="shariff3UU_mailform[mail_add_post_content]" ';
|
908 |
-
if ( isset( $GLOBALS["shariff3UU_mailform"]["mail_add_post_content"] ) ) echo checked( $GLOBALS["shariff3UU_mailform"]["mail_add_post_content"], 1, 0 );
|
909 |
-
echo ' value="1">';
|
910 |
-
}
|
911 |
-
|
912 |
-
// sender name
|
913 |
-
function shariff3UU_text_mail_sender_name_render() {
|
914 |
-
if ( isset( $GLOBALS["shariff3UU_mailform"]["mail_sender_name"] ) ) {
|
915 |
-
$mail_sender_name = $GLOBALS["shariff3UU_mailform"]["mail_sender_name"];
|
916 |
-
}
|
917 |
-
else {
|
918 |
-
$mail_sender_name = "";
|
919 |
-
}
|
920 |
-
// get blog title
|
921 |
-
$blog_title = get_bloginfo( 'name' );
|
922 |
-
echo '<input type="text" name="shariff3UU_mailform[mail_sender_name]" value="' . esc_html($mail_sender_name) . '" size="50" placeholder="' . $blog_title . '">';
|
923 |
-
}
|
924 |
-
|
925 |
-
// sender address
|
926 |
-
function shariff3UU_text_mail_sender_from_render() {
|
927 |
-
if ( isset( $GLOBALS["shariff3UU_mailform"]["mail_sender_from"] ) ) {
|
928 |
-
$mail_sender_from = $GLOBALS["shariff3UU_mailform"]["mail_sender_from"];
|
929 |
-
}
|
930 |
-
else {
|
931 |
-
$mail_sender_from = "";
|
932 |
-
}
|
933 |
-
// get blog domain
|
934 |
-
$blog_domain = get_bloginfo( 'url');
|
935 |
-
// in case scheme relative URI is passed, e.g., //www.google.com/
|
936 |
-
$input = trim($blog_domain, '/');
|
937 |
-
// If scheme not included, prepend it
|
938 |
-
if ( ! preg_match( '#^http(s)?://#', $input ) ) {
|
939 |
-
$input = 'http://' . $input;
|
940 |
-
}
|
941 |
-
$urlParts = parse_url($input);
|
942 |
-
// remove www
|
943 |
-
$domain = preg_replace('/^www\./', '', $urlParts['host']);
|
944 |
-
echo '<input type="email" name="shariff3UU_mailform[mail_sender_from]" value="' . esc_html($mail_sender_from) . '" size="50" placeholder="wordpress@' . $domain .'">';
|
945 |
-
}
|
946 |
-
|
947 |
-
// mailform anchor
|
948 |
-
function shariff3UU_checkbox_mailform_anchor_render() {
|
949 |
-
echo '<input type="checkbox" name="shariff3UU_mailform[mailform_anchor]" ';
|
950 |
-
if ( isset( $GLOBALS["shariff3UU_mailform"]["mailform_anchor"] ) ) echo checked( $GLOBALS["shariff3UU_mailform"]["mailform_anchor"], 1, 0 );
|
951 |
-
echo ' value="1">';
|
952 |
-
}
|
953 |
-
|
954 |
-
// wait timer
|
955 |
-
function shariff3UU_number_mailform_wait_render() {
|
956 |
-
if ( isset($GLOBALS["shariff3UU_mailform"]["mailform_wait"]) ) {
|
957 |
-
$mailform_wait = $GLOBALS["shariff3UU_mailform"]["mailform_wait"];
|
958 |
-
}
|
959 |
-
else {
|
960 |
-
$mailform_wait = '';
|
961 |
-
}
|
962 |
-
echo '<input type="number" name="shariff3UU_mailform[mailform_wait]" value="'. $mailform_wait .'" maxlength="4" min="5" max="86400" placeholder="5" style="width: 75px">';
|
963 |
-
}
|
964 |
-
|
965 |
-
// statistic section
|
966 |
-
|
967 |
-
// description statistic options
|
968 |
-
function shariff3UU_statistic_section_callback(){
|
969 |
-
echo __( 'This determines how share counts are handled by Shariff.', 'shariff' );
|
970 |
-
if ( isset( $GLOBALS["shariff3UU_statistic"]["external_direct"] ) ) {
|
971 |
-
echo '<br>';
|
972 |
-
echo __( '<span style="color: red; font-weight: bold;">Warning:</span> You entered an external API and chose to call it directly! Therefore, all options and features (e.g. the ranking tab) regarding the statistic have no effect. You need to configure them on the external server. Remember: This feature is still experimental!', 'shariff' );
|
973 |
-
}
|
974 |
-
// hook to add or remove cron job
|
975 |
-
do_action( 'shariff3UU_save_statistic_options' );
|
976 |
-
}
|
977 |
-
|
978 |
-
// statistic
|
979 |
-
function shariff3UU_checkbox_backend_render() {
|
980 |
-
// check WP version
|
981 |
-
if ( version_compare( get_bloginfo('version'), '4.4.0' ) < 1 ) {
|
982 |
-
echo __( 'WordPress-Version 4.4 or better is required to enable the statistic / share count functionality.', 'shariff');
|
983 |
-
}
|
984 |
-
else {
|
985 |
-
echo '<input type="checkbox" name="shariff3UU_statistic[backend]" ';
|
986 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['backend'] ) ) {
|
987 |
-
echo checked( $GLOBALS['shariff3UU_statistic']['backend'], 1, 0 );
|
988 |
-
}
|
989 |
-
echo ' value="1">';
|
990 |
-
}
|
991 |
-
}
|
992 |
-
|
993 |
-
// share counts on buttons
|
994 |
-
function shariff3UU_checkbox_sharecounts_render() {
|
995 |
-
echo '<input type="checkbox" name="shariff3UU_statistic[sharecounts]" ';
|
996 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['sharecounts'] ) ) {
|
997 |
-
echo checked( $GLOBALS['shariff3UU_statistic']['sharecounts'], 1, 0 );
|
998 |
-
}
|
999 |
-
echo ' value="1">';
|
1000 |
-
if ( ! isset( $GLOBALS['shariff3UU_statistic']['backend'] ) && isset( $GLOBALS['shariff3UU_statistic']['sharecounts'] ) ) {
|
1001 |
-
echo ' ';
|
1002 |
-
echo __( 'Warning: The statistic functionality must be enabled in order for the share counts to be shown.', 'shariff' );
|
1003 |
-
}
|
1004 |
-
}
|
1005 |
-
|
1006 |
-
// hide when zero
|
1007 |
-
function shariff3UU_checkbox_hidezero_render() {
|
1008 |
-
echo '<input type="checkbox" name="shariff3UU_statistic[hidezero]" ';
|
1009 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['hidezero'] ) ) {
|
1010 |
-
echo checked( $GLOBALS['shariff3UU_statistic']['hidezero'], 1, 0 );
|
1011 |
-
}
|
1012 |
-
echo ' value="1">';
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
// ranking
|
1016 |
-
function shariff3UU_number_ranking_render() {
|
1017 |
-
if ( isset($GLOBALS["shariff3UU_statistic"]["ranking"]) ) {
|
1018 |
-
$numberposts = $GLOBALS["shariff3UU_statistic"]["ranking"];
|
1019 |
-
}
|
1020 |
-
else {
|
1021 |
-
$numberposts = '';
|
1022 |
-
}
|
1023 |
-
echo '<input type="number" name="shariff3UU_statistic[ranking]" value="'. $numberposts .'" maxlength="4" min="0" max="10000" placeholder="100" style="width: 75px">';
|
1024 |
-
}
|
1025 |
-
|
1026 |
-
// automatic cache
|
1027 |
-
function shariff3UU_checkbox_automaticcache_render() {
|
1028 |
-
echo '<input type="checkbox" name="shariff3UU_statistic[automaticcache]" ';
|
1029 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['automaticcache'] ) ) {
|
1030 |
-
echo checked( $GLOBALS['shariff3UU_statistic']['automaticcache'], 1, 0 );
|
1031 |
-
}
|
1032 |
-
echo ' value="1">';
|
1033 |
-
}
|
1034 |
-
|
1035 |
-
// Facebook App ID
|
1036 |
-
function shariff3UU_text_fb_id_render() {
|
1037 |
-
if ( isset($GLOBALS["shariff3UU_statistic"]["fb_id"]) ) {
|
1038 |
-
$fb_id = $GLOBALS["shariff3UU_statistic"]["fb_id"];
|
1039 |
-
}
|
1040 |
-
else {
|
1041 |
-
$fb_id = '';
|
1042 |
-
}
|
1043 |
-
echo '<input type="text" name="shariff3UU_statistic[fb_id]" value="'. $fb_id .'" size="50" placeholder="1234567891234567">';
|
1044 |
-
}
|
1045 |
-
|
1046 |
-
// Facebook App Secret
|
1047 |
-
function shariff3UU_text_fb_secret_render() {
|
1048 |
-
if ( isset($GLOBALS["shariff3UU_statistic"]["fb_secret"]) ) {
|
1049 |
-
$fb_secret = $GLOBALS["shariff3UU_statistic"]["fb_secret"];
|
1050 |
-
}
|
1051 |
-
else {
|
1052 |
-
$fb_secret = '';
|
1053 |
-
}
|
1054 |
-
echo '<input type="text" name="shariff3UU_statistic[fb_secret]" value="'. $fb_secret .'" size="50" placeholder="123abc456def789123456789ghi12345">';
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
// ttl
|
1058 |
-
function shariff3UU_number_ttl_render() {
|
1059 |
-
if ( isset($GLOBALS["shariff3UU_statistic"]["ttl"]) ) {
|
1060 |
-
$ttl = $GLOBALS["shariff3UU_statistic"]["ttl"];
|
1061 |
-
}
|
1062 |
-
else {
|
1063 |
-
$ttl = '';
|
1064 |
-
}
|
1065 |
-
echo '<input type="number" name="shariff3UU_statistic[ttl]" value="'. $ttl .'" maxlength="4" min="60" max="7200" placeholder="60" style="width: 75px">';
|
1066 |
-
}
|
1067 |
-
|
1068 |
-
// disable dynamic cache lifespan
|
1069 |
-
function shariff3UU_checkbox_disable_dynamic_cache_render() {
|
1070 |
-
echo '<input type="checkbox" name="shariff3UU_statistic[disable_dynamic_cache]" ';
|
1071 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable_dynamic_cache'] ) ) {
|
1072 |
-
echo checked( $GLOBALS['shariff3UU_statistic']['disable_dynamic_cache'], 1, 0 );
|
1073 |
-
}
|
1074 |
-
echo ' value="1">';
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
// Twitter NewShareCount
|
1078 |
-
function shariff3UU_checkbox_newsharecount_render() {
|
1079 |
-
echo '<input type="checkbox" name="shariff3UU_statistic[newsharecount]" ';
|
1080 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['newsharecount'] ) ) {
|
1081 |
-
echo checked( $GLOBALS['shariff3UU_statistic']['newsharecount'], 1, 0 );
|
1082 |
-
}
|
1083 |
-
echo ' value="1">';
|
1084 |
-
}
|
1085 |
-
|
1086 |
-
// disable services
|
1087 |
-
function shariff3UU_multiplecheckbox_disable_services_render() {
|
1088 |
-
// Facebook
|
1089 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][facebook]" ';
|
1090 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['facebook'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['facebook'], 1, 0 );
|
1091 |
-
echo ' value="1">Facebook</p>';
|
1092 |
-
|
1093 |
-
// Twitter
|
1094 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][twitter]" ';
|
1095 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['twitter'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['twitter'], 1, 0 );
|
1096 |
-
echo ' value="1">Twitter</p>';
|
1097 |
-
|
1098 |
-
// GooglePlus
|
1099 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][googleplus]" ';
|
1100 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['googleplus'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['googleplus'], 1, 0 );
|
1101 |
-
echo ' value="1">GooglePlus</p>';
|
1102 |
-
|
1103 |
-
// Pinterest
|
1104 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][pinterest]" ';
|
1105 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['pinterest'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['pinterest'], 1, 0 );
|
1106 |
-
echo ' value="1">Pinterest</p>';
|
1107 |
-
|
1108 |
-
// Xing
|
1109 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][xing]" ';
|
1110 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['xing'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['xing'], 1, 0 );
|
1111 |
-
echo ' value="1">Xing</p>';
|
1112 |
-
|
1113 |
-
// LinkedIn
|
1114 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][linkedin]" ';
|
1115 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['linkedin'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['linkedin'], 1, 0 );
|
1116 |
-
echo ' value="1">LinkedIn</p>';
|
1117 |
-
|
1118 |
-
// Tumblr
|
1119 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][tumblr]" ';
|
1120 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['tumblr'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['tumblr'], 1, 0 );
|
1121 |
-
echo ' value="1">Tumblr</p>';
|
1122 |
-
|
1123 |
-
// VK
|
1124 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][vk]" ';
|
1125 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['vk'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['vk'], 1, 0 );
|
1126 |
-
echo ' value="1">VK</p>';
|
1127 |
-
|
1128 |
-
// StumbleUpon
|
1129 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][stumbleupon]" ';
|
1130 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['stumbleupon'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['stumbleupon'], 1, 0 );
|
1131 |
-
echo ' value="1">StumbleUpon</p>';
|
1132 |
-
|
1133 |
-
// Reddit
|
1134 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][reddit]" ';
|
1135 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['reddit'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['reddit'], 1, 0 );
|
1136 |
-
echo ' value="1">Reddit</p>';
|
1137 |
-
|
1138 |
-
// AddThis
|
1139 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][addthis]" ';
|
1140 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['addthis'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['addthis'], 1, 0 );
|
1141 |
-
echo ' value="1">AddThis</p>';
|
1142 |
-
|
1143 |
-
// Flattr
|
1144 |
-
echo '<p><input type="checkbox" name="shariff3UU_statistic[disable][flattr]" ';
|
1145 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['disable']['flattr'] ) ) echo checked( $GLOBALS['shariff3UU_statistic']['disable']['flattr'], 1, 0 );
|
1146 |
-
echo ' value="1">Flattr</p>';
|
1147 |
-
}
|
1148 |
-
|
1149 |
-
// external host
|
1150 |
-
function shariff3UU_text_external_host_render(){
|
1151 |
-
if ( isset( $GLOBALS["shariff3UU_statistic"]["external_host"] ) ) {
|
1152 |
-
$external_host = $GLOBALS["shariff3UU_statistic"]["external_host"];
|
1153 |
-
}
|
1154 |
-
else {
|
1155 |
-
$external_host = '';
|
1156 |
-
}
|
1157 |
-
echo '<input type="text" name="shariff3UU_statistic[external_host]" value="' . esc_html( $external_host ) . '" size="50" placeholder="'. esc_url( get_bloginfo('url') ) .'/wp-json/shariff/v1/share_counts">';
|
1158 |
-
echo '<p>' . __( 'Warning: This is an <strong>experimental</strong> feature. Please read the <a href="https://wordpress.org/plugins/shariff/faq/" target="_blank">Frequently Asked Questions (FAQ)</a>.', 'shariff' ) . '</p>';
|
1159 |
-
echo '<p>' . __( 'Please check, if you have to add this domain to the array $SHARIFF_FRONTENDS on the external server.', 'shariff' ) . '</p>';
|
1160 |
-
}
|
1161 |
-
|
1162 |
-
// direct external api call from JS
|
1163 |
-
function shariff3UU_checkbox_external_direct_render(){
|
1164 |
-
echo '<input type="checkbox" name="shariff3UU_statistic[external_direct]" ';
|
1165 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['external_direct'] ) ) {
|
1166 |
-
echo checked( $GLOBALS['shariff3UU_statistic']['external_direct'], 1, 0 );
|
1167 |
-
}
|
1168 |
-
echo ' value="1">';
|
1169 |
-
echo '<p>' . __( 'Please check, if you have correctly set the Access-Control-Allow-Origin header!', 'shariff' ) . '</p>';
|
1170 |
-
}
|
1171 |
-
|
1172 |
-
// local API only reachable in subfolder
|
1173 |
-
function shariff3UU_checkbox_subapi_render(){
|
1174 |
-
echo '<input type="checkbox" name="shariff3UU_statistic[subapi]" ';
|
1175 |
-
if ( isset( $GLOBALS['shariff3UU_statistic']['subapi'] ) ) {
|
1176 |
-
echo checked( $GLOBALS['shariff3UU_statistic']['subapi'], 1, 0 );
|
1177 |
-
}
|
1178 |
-
echo ' value="1">';
|
1179 |
-
}
|
1180 |
-
|
1181 |
-
// help section
|
1182 |
-
|
1183 |
-
function shariff3UU_help_section_callback() {
|
1184 |
-
echo '<p>';
|
1185 |
-
echo __( 'The WordPress plugin "Shariff Wrapper" has been developed by <a href="https://www.jplambeck.de" target=_blank">Jan-Peter Lambeck</a> and <a href="http://www.datenverwurstungszentrale.com" target="_blank">3UU</a> in order to help protect the privacy of your visitors.', 'shariff' );
|
1186 |
-
echo ' ' . __( 'It is based on the original Shariff buttons developed by the German computer magazin <a href="http://ct.de/shariff" target="_blank">c\'t</a> that fullfill the strict data protection laws in Germany.', 'shariff' );
|
1187 |
-
echo ' ' . __( 'If you need any help with the plugin, take a look at the <a href="https://wordpress.org/plugins/shariff/faq/" target="_blank">Frequently Asked Questions (FAQ)</a> and the <a href="https://wordpress.org/support/plugin/shariff" target="_blank">Support Forum</a>.', 'shariff' );
|
1188 |
-
echo ' ' . __( 'For up to date news about the plugin you can also follow <a href="https://twitter.com/jplambeck" target=_blank">@jplambeck</a> on Twitter.', 'shariff' );
|
1189 |
-
echo '</p>';
|
1190 |
-
echo '<p>';
|
1191 |
-
echo __( 'If you contact us about a problem with the share counts, please <u>always</u> include the information provided on the <a href="options-general.php?page=shariff3uu&tab=status">status tab</a>! ', 'shariff' );
|
1192 |
-
echo ' ' . __( 'This will help to speed up the process.', 'shariff' );
|
1193 |
-
echo '</p>';
|
1194 |
-
echo '<p>';
|
1195 |
-
echo __( 'If you enjoy our plugin, please consider writing a review about it on <a href="https://wordpress.org/support/view/plugin-reviews/shariff" target="_blank">wordpress.org</a>. ', 'shariff' );
|
1196 |
-
echo ' ' . __( 'If you want to support us financially, you can donate via <a href="http://folge.link/?bitcoin=1Ritz1iUaLaxuYcXhUCoFhkVRH6GWiMTP" target="_blank">Bitcoin</a> and <a href="https://www.paypal.me/jplambeck" target="_blanK">PayPal</a>. ', 'shariff' );
|
1197 |
-
echo ' ' . __( 'Thank you!', 'shariff' );
|
1198 |
-
echo '</p>';
|
1199 |
-
echo '<p>';
|
1200 |
-
echo __( 'This is a list of all available options for the <code>[shariff]</code> shortcode:', 'shariff' );
|
1201 |
-
echo '</p>';
|
1202 |
-
// shortcode table
|
1203 |
-
echo '<div style="display:table;background-color:#fff">';
|
1204 |
-
// head
|
1205 |
-
echo '<div style="display:table-row">';
|
1206 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . __( 'Name', 'shariff' ) . '</div>';
|
1207 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . __( 'Options', 'shariff' ) . '</div>';
|
1208 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . __( 'Default', 'shariff' ) . '</div>';
|
1209 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . __( 'Example', 'shariff' ) . '</div>';
|
1210 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . __( 'Description', 'shariff' ) . '</div>';
|
1211 |
-
echo '</div>';
|
1212 |
-
// services
|
1213 |
-
echo '<div style="display:table-row">';
|
1214 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">services</div>';
|
1215 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">facebook<br>twitter<br>googleplus<br>whatsapp<br>threema<br>pinterest<br>linkedin<br>xing<br>reddit<br>stumbleupon<br>tumblr<br>vk<br>diaspora<br>addthis<br>flattr<br>patreon<br>paypal<br>paypalme<br>bitcoin<br>mailform<br>mailto<br>printer<br>info<br>rss</div>';
|
1216 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">twitter|facebook|googleplus|info</div>';
|
1217 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff services="facebook|twitter|mailform"]</div>';
|
1218 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Determines which buttons to show and in which order.', 'shariff' ) . '</div>';
|
1219 |
-
echo '</div>';
|
1220 |
-
// backend
|
1221 |
-
echo '<div style="display:table-row">';
|
1222 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">backend</div>';
|
1223 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">on<br>off</div>';
|
1224 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">off</div>';
|
1225 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff backend="on"]</div>';
|
1226 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Enables share counts on the buttons.', 'shariff' ) . '</div>';
|
1227 |
-
echo '</div>';
|
1228 |
-
// theme
|
1229 |
-
echo '<div style="display:table-row">';
|
1230 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">theme</div>';
|
1231 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">default<br>color<br>grey<br>white<br>round</div>';
|
1232 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">default</div>';
|
1233 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff theme="round"]</div>';
|
1234 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Determines the main design of the buttons.', 'shariff' ) . '</div>';
|
1235 |
-
echo '</div>';
|
1236 |
-
// button size
|
1237 |
-
echo '<div style="display:table-row">';
|
1238 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">buttonsize</div>';
|
1239 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">small<br>medium<br>large</div>';
|
1240 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">medium</div>';
|
1241 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff buttonsize="small"]</div>';
|
1242 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Determines the button size regardless of theme choice.', 'shariff' ) . '</div>';
|
1243 |
-
echo '</div>';
|
1244 |
-
// buttonstretch
|
1245 |
-
echo '<div style="display:table-row">';
|
1246 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">buttonstretch</div>';
|
1247 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">0<br>1</div>';
|
1248 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">0</div>';
|
1249 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff buttonstretch="1"]</div>';
|
1250 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Stretch buttons horizontally to full width.', 'shariff' ) . '</div>';
|
1251 |
-
echo '</div>';
|
1252 |
-
// borderradius
|
1253 |
-
echo '<div style="display:table-row">';
|
1254 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">borderradius</div>';
|
1255 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">1-50</div>';
|
1256 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">50</div>';
|
1257 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff borderradius="1"]</div>';
|
1258 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets the border radius for the round theme. 1 essentially equals a square.', 'shariff' ) . '</div>';
|
1259 |
-
echo '</div>';
|
1260 |
-
// maincolor
|
1261 |
-
echo '<div style="display:table-row">';
|
1262 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">maincolor</div>';
|
1263 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1264 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1265 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff maincolor="#000"]</div>';
|
1266 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets a custom main color for all buttons (hexadecimal).', 'shariff' ) . '</div>';
|
1267 |
-
echo '</div>';
|
1268 |
-
// secondarycolor
|
1269 |
-
echo '<div style="display:table-row">';
|
1270 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">secondarycolor</div>';
|
1271 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1272 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1273 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff secondarycolor="#afafaf"]</div>';
|
1274 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets a custom secondary color for all buttons (hexadecimal). The secondary color is, depending on theme, used for hover effects.', 'shariff' ) . '</div>';
|
1275 |
-
echo '</div>';
|
1276 |
-
// orientation
|
1277 |
-
echo '<div style="display:table-row">';
|
1278 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">orientation</div>';
|
1279 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">horizontal<br>vertical</div>';
|
1280 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">horizontal</div>';
|
1281 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff orientation="vertical"]</div>';
|
1282 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Changes the orientation of the buttons.', 'shariff' ) . '</div>';
|
1283 |
-
echo '</div>';
|
1284 |
-
// alignment
|
1285 |
-
echo '<div style="display:table-row">';
|
1286 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">align</div>';
|
1287 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">flex-start<br>center<br>flex-end</div>';
|
1288 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">flex-start</div>';
|
1289 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff align="center"]</div>';
|
1290 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Changes the horizontal alignment of the buttons. flex-start means left, center is obvious and flex-end means right.', 'shariff' ) . '</div>';
|
1291 |
-
echo '</div>';
|
1292 |
-
// language
|
1293 |
-
echo '<div style="display:table-row">';
|
1294 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">language</div>';
|
1295 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">da, de, en, es, fi, fr, hr, hu, it, ja, ko, nl, no, pl, pt, ro, ru, sk, sl, sr, sv, tr, zh</div>';
|
1296 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Automatically selected by browser.', 'shariff' ) . '</div>';
|
1297 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff lang="de"]</div>';
|
1298 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Changes the language of the share buttons.', 'shariff' ) . '</div>';
|
1299 |
-
echo '</div>';
|
1300 |
-
// headline
|
1301 |
-
echo '<div style="display:table-row">';
|
1302 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">headline</div>';
|
1303 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1304 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1305 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff headline="<hr style=\'margin:20px 0\'><p>' . __( 'Please share this post:', 'shariff' ) . '</p>"]</div>';
|
1306 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Adds a headline above the Shariff buttons. Basic HTML as well as style and class attributes can be used. To remove a headline set on the plugins options page use headline="".', 'shariff' ) . '</div>';
|
1307 |
-
echo '</div>';
|
1308 |
-
// style
|
1309 |
-
echo '<div style="display:table-row">';
|
1310 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">style</div>';
|
1311 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1312 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1313 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff style="margin:20px;"]</div>';
|
1314 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Adds custom <u>style</u> attributes to the container <u>around</u> Shariff.', 'shariff' ) . '</div>';
|
1315 |
-
echo '</div>';
|
1316 |
-
// cssclass
|
1317 |
-
echo '<div style="display:table-row">';
|
1318 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">cssclass</div>';
|
1319 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1320 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1321 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff class="classname"]</div>';
|
1322 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Adds a custom <u>class</u> to the container <u>around</u> Shariff.', 'shariff' ) . '</div>';
|
1323 |
-
echo '</div>';
|
1324 |
-
// twitter_via
|
1325 |
-
echo '<div style="display:table-row">';
|
1326 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">twitter_via</div>';
|
1327 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1328 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1329 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff twitter_via="your_twittername"]</div>';
|
1330 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets the Twitter via tag.', 'shariff' ) . '</div>';
|
1331 |
-
echo '</div>';
|
1332 |
-
// flattruser
|
1333 |
-
echo '<div style="display:table-row">';
|
1334 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">flattruser</div>';
|
1335 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1336 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1337 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff flattruser="your_username"]</div>';
|
1338 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets the Flattr username.', 'shariff' ) . '</div>';
|
1339 |
-
echo '</div>';
|
1340 |
-
// patreonid
|
1341 |
-
echo '<div style="display:table-row">';
|
1342 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">patreonid</div>';
|
1343 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1344 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1345 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff patreonid="your_username"]</div>';
|
1346 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets the Patreon username.', 'shariff' ) . '</div>';
|
1347 |
-
echo '</div>';
|
1348 |
-
// paypalbuttonid
|
1349 |
-
echo '<div style="display:table-row">';
|
1350 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">paypalbuttonid</div>';
|
1351 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1352 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1353 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff paypalbuttonid="hosted_button_id"]</div>';
|
1354 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets the PayPal hosted button ID.', 'shariff' ) . '</div>';
|
1355 |
-
echo '</div>';
|
1356 |
-
// paypalmeid
|
1357 |
-
echo '<div style="display:table-row">';
|
1358 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">paypalmeid</div>';
|
1359 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1360 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1361 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff paypalmeid="name"]</div>';
|
1362 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets the PayPal.Me ID. Default amount can be added with a / e.g. name/25.', 'shariff' ) . '</div>';
|
1363 |
-
echo '</div>';
|
1364 |
-
// bitcoinaddress
|
1365 |
-
echo '<div style="display:table-row">';
|
1366 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">bitcoinaddress</div>';
|
1367 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1368 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1369 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff bitcoinaddress="bitcoin_address"]</div>';
|
1370 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets the bitcoin address.', 'shariff' ) . '</div>';
|
1371 |
-
echo '</div>';
|
1372 |
-
// media
|
1373 |
-
echo '<div style="display:table-row">';
|
1374 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">media</div>';
|
1375 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1376 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'The post featured image or the first image of the post.</div>', 'shariff' );
|
1377 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff media="http://www.mydomain.com/image.jpg"]</div>';
|
1378 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Determines the default image to share for Pinterest, if no other usable image is found.', 'shariff' ) . '</div>';
|
1379 |
-
echo '</div>';
|
1380 |
-
// info_url
|
1381 |
-
echo '<div style="display:table-row">';
|
1382 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">info_url</div>';
|
1383 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1384 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">http://ct.de/-2467514</div>';
|
1385 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff info_url="http://www.mydomain.com/shariff-buttons"]</div>';
|
1386 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Sets a custom link for the info button.', 'shariff' ) . '</div>';
|
1387 |
-
echo '</div>';
|
1388 |
-
// url
|
1389 |
-
echo '<div style="display:table-row">';
|
1390 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">url</div>';
|
1391 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1392 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'The url of the current post or page.', 'shariff' ) . '</div>';
|
1393 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff url="http://www.mydomain.com/somepost"]</div>';
|
1394 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Changes the url to share. Only for special use cases.', 'shariff' ) . '</div>';
|
1395 |
-
echo '</div>';
|
1396 |
-
// title
|
1397 |
-
echo '<div style="display:table-row">';
|
1398 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">title</div>';
|
1399 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1400 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'The title of the current post or page.', 'shariff' ) . '</div>';
|
1401 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff title="' . __( 'My Post Title', 'shariff' ) . '"]</div>';
|
1402 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Changes the title to share. Only for special use cases.', 'shariff' ) . '</div>';
|
1403 |
-
echo '</div>';
|
1404 |
-
// timestamp
|
1405 |
-
echo '<div style="display:table-row">';
|
1406 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">timestamp</div>';
|
1407 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1408 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'The timestamp of the last modification of the current post or page.', 'shariff' ) . '</div>';
|
1409 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff timestamp="1473240010"]</div>';
|
1410 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Provides the time the current post or page was last modified as a timestamp. Used for determining the dynamic cache lifespan. Only for special use cases.', 'shariff' ) . '</div>';
|
1411 |
-
echo '</div>';
|
1412 |
-
// rssfeed
|
1413 |
-
echo '<div style="display:table-row">';
|
1414 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">rssfeed</div>';
|
1415 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
|
1416 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">http://www.mydomain.com/feed/rss/</div>';
|
1417 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff rssfeed="http://www.mydomain.com/feed/rss2/"]</div>';
|
1418 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . __( 'Changes the rss feed url to another feed.', 'shariff' ) . '</div>';
|
1419 |
-
echo '</div>';
|
1420 |
-
|
1421 |
-
echo '</div>';
|
1422 |
-
}
|
1423 |
-
|
1424 |
-
// status section
|
1425 |
-
|
1426 |
-
function shariff3UU_status_section_callback() {
|
1427 |
-
// options
|
1428 |
-
$shariff3UU = $GLOBALS["shariff3UU"];
|
1429 |
-
|
1430 |
-
// status table
|
1431 |
-
echo '<div style="display:table;border-spacing:10px;margin:-10px 0 0 -10px">';
|
1432 |
-
|
1433 |
-
// statistic row
|
1434 |
-
echo '<div style="display:table-row">';
|
1435 |
-
echo '<div style="display:table-cell;width:125px">' . __( 'Statistic:', 'shariff' ) . '</div>';
|
1436 |
-
|
1437 |
-
// check if statistic is enabled
|
1438 |
-
if ( ! isset( $shariff3UU['backend'] ) ) {
|
1439 |
-
// statistic disabled message
|
1440 |
-
echo '<div style="display:table">';
|
1441 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold">' . __( 'Disabled', 'shariff' ) . '</div></div>';
|
1442 |
-
echo '</div>';
|
1443 |
-
// end statistic row, if statistic is disabled
|
1444 |
-
echo '</div>';
|
1445 |
-
}
|
1446 |
-
else {
|
1447 |
-
// encode shareurl
|
1448 |
-
$post_url = urlencode( esc_url( get_bloginfo( 'url' ) ) );
|
1449 |
-
$post_url2 = esc_url( get_bloginfo( 'url' ) );
|
1450 |
-
|
1451 |
-
// set services
|
1452 |
-
$services = array( 'facebook', 'twitter', 'googleplus', 'pinterest', 'linkedin', 'xing', 'reddit', 'stumbleupon', 'tumblr', 'vk', 'addthis', 'flattr', 'odnoklassniki' );
|
1453 |
-
|
1454 |
-
// we only need the backend part
|
1455 |
-
$backend = '1';
|
1456 |
-
|
1457 |
-
// but we also want error messages
|
1458 |
-
$record_errors = '1';
|
1459 |
-
|
1460 |
-
// avoid debug messages
|
1461 |
-
$service_errors = array();
|
1462 |
-
|
1463 |
-
// loop through all desired services
|
1464 |
-
foreach( $services as $service ) {
|
1465 |
-
// include service parameters
|
1466 |
-
if ( ! isset ( $shariff3UU["disable"][$service] ) || ( isset ( $shariff3UU["disable"][$service] ) && $shariff3UU["disable"][$service] == 0 ) ) {
|
1467 |
-
include( plugin_dir_path( __FILE__ ) . '../services/shariff-' . $service . '.php' );
|
1468 |
-
}
|
1469 |
-
}
|
1470 |
-
|
1471 |
-
// general statistic status
|
1472 |
-
echo '<div style="display:table-cell">';
|
1473 |
-
echo '<div style="display:table">';
|
1474 |
-
if ( empty( $service_errors ) ) {
|
1475 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:green">' . __( 'OK', 'shariff' ) . '</div></div>';
|
1476 |
-
echo '<div style="display:table-row"><div style="display:table-cell">' . __( 'No error messages.', 'shariff' ) . '</div></div>';
|
1477 |
-
}
|
1478 |
-
elseif ( array_filter( $service_errors ) ) {
|
1479 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:red">' . __( 'Error', 'shariff' ) . '</div></div>';
|
1480 |
-
echo '<div style="display:table-row"><div style="display:table-cell">' . __( 'One or more services reported an error.', 'shariff' ) . '</div></div>';
|
1481 |
-
}
|
1482 |
-
else {
|
1483 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:orange">' . __( 'Timeout', 'shariff' ) . '</div></div>';
|
1484 |
-
echo '<div style="display:table-row"><div style="display:table-cell">' . __( 'One or more services didn\'t respond in less than five seconds.', 'shariff' ) . '</div></div>';
|
1485 |
-
}
|
1486 |
-
echo '<div style="display:table-row"><div style="display:table-cell"></div></div>';
|
1487 |
-
echo '</div>';
|
1488 |
-
echo '</div>';
|
1489 |
-
|
1490 |
-
// end statistic row
|
1491 |
-
echo '</div>';
|
1492 |
-
|
1493 |
-
// output all services
|
1494 |
-
foreach( $services as $service ) {
|
1495 |
-
// service row
|
1496 |
-
echo '<div style="display:table-row">';
|
1497 |
-
echo '<div class="shariff_status-first-cell">' . ucfirst( $service ) . ':</div>';
|
1498 |
-
echo '<div style="display:table-cell">';
|
1499 |
-
echo '<div class="shariff_status-table">';
|
1500 |
-
if ( isset ( $shariff3UU["disable"][$service] ) && $shariff3UU["disable"][$service] == '1' ) {
|
1501 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold">' . __( 'Disabled', 'shariff' ) . '</div></div>';
|
1502 |
-
}
|
1503 |
-
elseif ( ! array_key_exists( $service, $service_errors ) ) {
|
1504 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:green">' . __( 'OK', 'shariff' ) . '</div></div>';
|
1505 |
-
echo '<div style="display:table-row"><div style="display:table-cell">' . __( 'Share Count:', 'shariff' ) . ' ' . $share_counts[$service] . '</div></div>';
|
1506 |
-
}
|
1507 |
-
elseif ( empty( $service_errors[$service] ) ) {
|
1508 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:orange">' . __( 'Timeout', 'shariff' ) . '</div></div>';
|
1509 |
-
echo '<div style="display:table-row"><div style="display:table-cell">';
|
1510 |
-
echo __( 'Service didn\'t respond in less than five seconds.', 'shariff' );
|
1511 |
-
echo '</div></div>';
|
1512 |
-
}
|
1513 |
-
else {
|
1514 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:red">' . __( 'Error', 'shariff' ) . '</span></div></div>';
|
1515 |
-
echo '<div style="display:table-row"><div style="display:table-cell">';
|
1516 |
-
echo $service_errors[$service];
|
1517 |
-
echo '</div></div>';
|
1518 |
-
}
|
1519 |
-
echo '<div style="display:table-row"><div style="display:table-cell"></div></div>';
|
1520 |
-
echo '</div>';
|
1521 |
-
echo '</div>';
|
1522 |
-
echo '</div>';
|
1523 |
-
}
|
1524 |
-
}
|
1525 |
-
|
1526 |
-
// GD needed for QR codes of the Bitcoin links
|
1527 |
-
echo '<div style="display:table-row">';
|
1528 |
-
echo '<div style="display:table-cell">' . __( 'GD Library:', 'shariff' ) . '</div>';
|
1529 |
-
// working message
|
1530 |
-
if ( function_exists( 'gd_info' ) ) {
|
1531 |
-
$tmpGDinfo = gd_info();
|
1532 |
-
echo '<div style="display:table-cell">';
|
1533 |
-
echo '<div style="display: table">';
|
1534 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:green">' . __( 'OK', 'shariff' ) . '</div></div>';
|
1535 |
-
echo '<div style="display:table-row"><div style="display:table-cell">Version: ' . $tmpGDinfo["GD Version"] . '</div></div>';
|
1536 |
-
echo '</div>';
|
1537 |
-
echo '</div>';
|
1538 |
-
}
|
1539 |
-
else {
|
1540 |
-
echo '<div style="display:table-cell">';
|
1541 |
-
echo '<div style="display: table">';
|
1542 |
-
echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:red">' . __( 'Error', 'shariff' ) . '</div></div>';
|
1543 |
-
echo '<div style="display:table-row"><div style="display:table-cell">' . __( 'The GD Library is not installed on this server. This is only needed for the QR codes, if your are using the bitcoin button.', 'shariff' ) . '</div></div>';
|
1544 |
-
echo '</div>';
|
1545 |
-
echo '</div>';
|
1546 |
-
}
|
1547 |
-
echo '</div>';
|
1548 |
-
|
1549 |
-
// end status table
|
1550 |
-
echo '</div>';
|
1551 |
-
}
|
1552 |
-
|
1553 |
-
// ranking section
|
1554 |
-
|
1555 |
-
function shariff3UU_ranking_section_callback() {
|
1556 |
-
// post array
|
1557 |
-
$posts = array();
|
1558 |
-
|
1559 |
-
// services
|
1560 |
-
$services = array();
|
1561 |
-
|
1562 |
-
// amount of posts - set to 100 if not set
|
1563 |
-
if ( isset( $GLOBALS["shariff3UU"]["ranking"] ) && absint( $GLOBALS["shariff3UU"]["ranking"] ) > '0' ) {
|
1564 |
-
$numberposts = absint( $GLOBALS["shariff3UU"]["ranking"] );
|
1565 |
-
}
|
1566 |
-
else {
|
1567 |
-
$numberposts = '100';
|
1568 |
-
}
|
1569 |
-
|
1570 |
-
// catch last 100 posts or whatever number is set for it
|
1571 |
-
$args = array( 'numberposts' => $numberposts, 'orderby' => 'post_date', 'order' => 'DESC', 'post_status' => 'publish' );
|
1572 |
-
$recent_posts = wp_get_recent_posts( $args );
|
1573 |
-
if ( $recent_posts ) {
|
1574 |
-
foreach( $recent_posts as $recent ) {
|
1575 |
-
// get url
|
1576 |
-
$url = get_permalink( $recent["ID"] );
|
1577 |
-
$post_url = urlencode( $url );
|
1578 |
-
// set transient name
|
1579 |
-
$post_hash = 'shariff' . hash( "md5", $post_url );
|
1580 |
-
// get share counts from cache
|
1581 |
-
if ( get_transient( $post_hash ) !== false ) {
|
1582 |
-
$share_counts = get_transient( $post_hash );
|
1583 |
-
$services = array_merge( $services, $share_counts );
|
1584 |
-
if ( isset( $share_counts['total'] ) ) $total = $share_counts['total'];
|
1585 |
-
else $total = '0';
|
1586 |
-
}
|
1587 |
-
else {
|
1588 |
-
$share_counts = array();
|
1589 |
-
$total = '';
|
1590 |
-
}
|
1591 |
-
// add to array
|
1592 |
-
$posts[ $post_hash ] = array( 'url' => $url, 'title' => $recent["post_title"], 'post_date' => $recent['post_date'], 'share_counts' => $share_counts, 'total_share_counts' => $total );
|
1593 |
-
}
|
1594 |
-
}
|
1595 |
-
|
1596 |
-
// clean services
|
1597 |
-
unset( $services['total'] );
|
1598 |
-
unset( $services['timestamp'] );
|
1599 |
-
unset( $services['url'] );
|
1600 |
-
ksort( $services );
|
1601 |
-
|
1602 |
-
// sort array: first decending using total share counts then descending using post date
|
1603 |
-
$tmp = Array();
|
1604 |
-
$tmp2 = Array();
|
1605 |
-
foreach( $posts as &$ma ) $tmp[] = &$ma["total_share_counts"];
|
1606 |
-
foreach( $posts as &$ma2 ) $tmp2[] = &$ma2["post_date"];
|
1607 |
-
array_multisort( $tmp, SORT_DESC, $tmp2, SORT_DESC, $posts );
|
1608 |
-
|
1609 |
-
// intro
|
1610 |
-
echo '<p>';
|
1611 |
-
echo __( 'The following table shows the ranking of your last 100 posts in descending order by total share counts. To prevent slow loading times only cached data is being used. Therefore, you may see blank entries for posts that have not been visited by anyone since the last update or activation of Shariff Wrapper. You can simply visit the respective post yourself in order to have the share counts fetched.', 'shariff' );
|
1612 |
-
echo '</p>';
|
1613 |
-
|
1614 |
-
// warning if statistic has been disabled
|
1615 |
-
if ( ! isset( $GLOBALS["shariff3UU"]["backend"] ) ) {
|
1616 |
-
echo '<p>';
|
1617 |
-
echo '<span style="color: red; font-weight: bold;">';
|
1618 |
-
echo __( 'Warning:', 'shariff' );
|
1619 |
-
echo '</span> ';
|
1620 |
-
echo __( 'The statistic option has been disabled on the statistic tab. Share counts will not get updated!', 'shariff' );
|
1621 |
-
echo '</p>';
|
1622 |
-
}
|
1623 |
-
|
1624 |
-
// ranking table
|
1625 |
-
echo '<div style="display:table;background-color:#fff">';
|
1626 |
-
// head
|
1627 |
-
echo '<div style="display:table-row">';
|
1628 |
-
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px">' . __( 'Rank', 'shariff' ) . '</div>';
|
1629 |
-
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px">' . __( 'Post', 'shariff' ) . '</div>';
|
1630 |
-
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px;text-align:center">' . __( 'Date', 'shariff' ) . '</div>';
|
1631 |
-
echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px;text-align:center">' . __( 'Time', 'shariff' ) . '</div>';
|
1632 |
-
foreach( $services as $service => $nothing ) echo '<div style="display:table-cell;font-weight:bold;border:1px solid;padding:10px;text-align:center;">' . ucfirst( $service ) . '</div>';
|
1633 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px;font-weight:bold">' . __( 'Total', 'shariff' ) . '</div>';
|
1634 |
-
echo '</div>';
|
1635 |
-
// posts
|
1636 |
-
$rank = '0';
|
1637 |
-
foreach( $posts as $post => $value ) {
|
1638 |
-
$rank++;
|
1639 |
-
echo '<div style="display:table-row">';
|
1640 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px;text-align:center">' . $rank . '</div>';
|
1641 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px"><a href="' . $value['url'] . '" target="_blank">' . $value['title'] . '</a></div>';
|
1642 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . mysql2date( 'd.m.Y', $value['post_date'] ) . '</div>';
|
1643 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . mysql2date( 'H:i', $value['post_date'] ) . '</div>';
|
1644 |
-
// share counts
|
1645 |
-
foreach( $services as $service => $nothing ) {
|
1646 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px;text-align:center">';
|
1647 |
-
if( isset( $value['share_counts'][$service] ) ) echo $value['share_counts'][$service];
|
1648 |
-
echo '</div>';
|
1649 |
-
}
|
1650 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px;text-align:center">';
|
1651 |
-
if ( isset( $value['share_counts']['total'] ) ) echo $value['share_counts']['total'];
|
1652 |
-
echo '</div>';
|
1653 |
-
echo '</div>';
|
1654 |
-
}
|
1655 |
-
echo '</div>';
|
1656 |
-
}
|
1657 |
-
|
1658 |
-
// render the plugin option page
|
1659 |
-
function shariff3UU_options_page() {
|
1660 |
-
// the <div> with the class "wrap" makes sure that admin messages are displayed below the title and not above
|
1661 |
-
echo '<div class="wrap">';
|
1662 |
-
|
1663 |
-
// title
|
1664 |
-
echo '<h2>Shariff ' . $GLOBALS["shariff3UU_basic"]["version"] . '</h2>';
|
1665 |
-
|
1666 |
-
// start the form
|
1667 |
-
echo '<form class="shariff" action="options.php" method="post">';
|
1668 |
-
|
1669 |
-
// hidden version entry, so it will get saved upon updating the options
|
1670 |
-
echo '<input type="hidden" name="shariff3UU_basic[version]" value="' . $GLOBALS["shariff3UU_basic"]["version"] . '">';
|
1671 |
-
|
1672 |
-
// determine active tab
|
1673 |
-
if ( isset( $_GET['tab'] ) ) {
|
1674 |
-
$active_tab = $_GET['tab'];
|
1675 |
-
}
|
1676 |
-
else {
|
1677 |
-
$active_tab = 'basic';
|
1678 |
-
}
|
1679 |
-
|
1680 |
-
// tabs
|
1681 |
-
echo '<h2 class="nav-tab-wrapper">';
|
1682 |
-
// basic
|
1683 |
-
echo '<a href="?page=shariff3uu&tab=basic" class="nav-tab ';
|
1684 |
-
if ( $active_tab == 'basic' ) echo 'nav-tab-active';
|
1685 |
-
echo '">' . __( 'Basic', 'shariff' ) . '</a>';
|
1686 |
-
// design
|
1687 |
-
echo '<a href="?page=shariff3uu&tab=design" class="nav-tab ';
|
1688 |
-
if ( $active_tab == 'design' ) echo 'nav-tab-active';
|
1689 |
-
echo '">' . __( 'Design', 'shariff' ) . '</a>';
|
1690 |
-
// advanced
|
1691 |
-
echo '<a href="?page=shariff3uu&tab=advanced" class="nav-tab ';
|
1692 |
-
if ( $active_tab == 'advanced' ) echo 'nav-tab-active';
|
1693 |
-
echo '">' . __( 'Advanced', 'shariff' ) . '</a>';
|
1694 |
-
// mailform
|
1695 |
-
echo '<a href="?page=shariff3uu&tab=mailform" class="nav-tab ';
|
1696 |
-
if ( $active_tab == 'mailform' ) echo 'nav-tab-active';
|
1697 |
-
echo '">' . __( 'Mail Form', 'shariff' ) . '</a>';
|
1698 |
-
// statistic
|
1699 |
-
echo '<a href="?page=shariff3uu&tab=statistic" class="nav-tab ';
|
1700 |
-
if ( $active_tab == 'statistic' ) echo 'nav-tab-active';
|
1701 |
-
echo '">' . __( 'Statistic', 'shariff' ) . '</a>';
|
1702 |
-
// help
|
1703 |
-
echo '<a href="?page=shariff3uu&tab=help" class="nav-tab ';
|
1704 |
-
if ( $active_tab == 'help' ) echo 'nav-tab-active';
|
1705 |
-
echo '">' . __( 'Help', 'shariff' ) . '</a>';
|
1706 |
-
// status
|
1707 |
-
echo '<a href="?page=shariff3uu&tab=status" class="nav-tab ';
|
1708 |
-
if ( $active_tab == 'status' ) echo 'nav-tab-active';
|
1709 |
-
echo '">' . __( 'Status', 'shariff' ) . '</a>';
|
1710 |
-
// ranking
|
1711 |
-
echo '<a href="?page=shariff3uu&tab=ranking" class="nav-tab ';
|
1712 |
-
if ( $active_tab == 'ranking' ) echo 'nav-tab-active';
|
1713 |
-
echo '">' . __( 'Ranking', 'shariff' ) . '</a>';
|
1714 |
-
echo '</h2>';
|
1715 |
-
|
1716 |
-
// content of tabs
|
1717 |
-
if ( $active_tab == 'basic' ) {
|
1718 |
-
settings_fields( 'basic' );
|
1719 |
-
do_settings_sections( 'basic' );
|
1720 |
-
submit_button();
|
1721 |
-
}
|
1722 |
-
elseif ( $active_tab == 'design' ) {
|
1723 |
-
settings_fields( 'design' );
|
1724 |
-
do_settings_sections( 'design' );
|
1725 |
-
submit_button();
|
1726 |
-
}
|
1727 |
-
elseif ( $active_tab == 'advanced' ) {
|
1728 |
-
settings_fields( 'advanced' );
|
1729 |
-
do_settings_sections( 'advanced' );
|
1730 |
-
submit_button();
|
1731 |
-
}
|
1732 |
-
elseif ( $active_tab == 'mailform' ) {
|
1733 |
-
settings_fields( 'mailform' );
|
1734 |
-
do_settings_sections( 'mailform' );
|
1735 |
-
submit_button();
|
1736 |
-
}
|
1737 |
-
elseif ( $active_tab == 'statistic' ) {
|
1738 |
-
settings_fields( 'statistic' );
|
1739 |
-
do_settings_sections( 'statistic' );
|
1740 |
-
submit_button();
|
1741 |
-
}
|
1742 |
-
elseif ( $active_tab == 'help' ) {
|
1743 |
-
settings_fields( 'help' );
|
1744 |
-
do_settings_sections( 'help' );
|
1745 |
-
}
|
1746 |
-
elseif ( $active_tab == 'status' ) {
|
1747 |
-
settings_fields( 'status' );
|
1748 |
-
do_settings_sections( 'status' );
|
1749 |
-
}
|
1750 |
-
elseif ( $active_tab == 'ranking' ) {
|
1751 |
-
settings_fields( 'ranking' );
|
1752 |
-
do_settings_sections( 'ranking' );
|
1753 |
-
}
|
1754 |
-
|
1755 |
-
// end of form
|
1756 |
-
echo '</form>';
|
1757 |
-
} // end of plugin option page
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/admin_metabox.php
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Will be included in the shariff.php only, when user is logged in.
|
3 |
-
|
4 |
-
// prevent direct calls to admin_menu.php
|
5 |
-
if ( ! class_exists('WP') ) { die(); }
|
6 |
-
|
7 |
-
// call setup function on the post editor screen
|
8 |
-
add_action( 'load-post.php', 'shariff3UU_metabox_setup' );
|
9 |
-
add_action( 'load-post-new.php', 'shariff3UU_metabox_setup' );
|
10 |
-
|
11 |
-
// meta box setup function
|
12 |
-
function shariff3UU_metabox_setup() {
|
13 |
-
add_action( 'add_meta_boxes', 'shariff3UU_add_metabox' );
|
14 |
-
}
|
15 |
-
|
16 |
-
// add meta box
|
17 |
-
function shariff3UU_add_metabox() {
|
18 |
-
foreach( get_post_types() as $posttype ) {
|
19 |
-
add_meta_box( 'shariff_metabox', __( 'Shariff Settings', 'shariff' ), 'shariff3uu_build_metabox', $posttype, 'side', 'default' );
|
20 |
-
}
|
21 |
-
}
|
22 |
-
|
23 |
-
// build meta box
|
24 |
-
function shariff3uu_build_metabox() {
|
25 |
-
// scripts for pinterest image media uploader
|
26 |
-
wp_enqueue_media();
|
27 |
-
wp_register_script( 'shariff_mediaupload', plugins_url( '../js/shariff-media.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
28 |
-
$translation_array = array( 'choose_image' => __( 'Choose image', 'shariff' ) );
|
29 |
-
wp_localize_script( 'shariff_mediaupload', 'shariff_media', $translation_array );
|
30 |
-
wp_enqueue_script( 'shariff_mediaupload' );
|
31 |
-
|
32 |
-
// make sure the form request comes from WordPress
|
33 |
-
wp_nonce_field( basename( __FILE__ ), 'shariff_metabox_nonce' );
|
34 |
-
|
35 |
-
// retrieve the current metabox disable value
|
36 |
-
$shariff_metabox_disable = get_post_meta( get_the_ID(), 'shariff_metabox_disable', true );
|
37 |
-
// disable checkbox
|
38 |
-
echo '<p><strong>' . __( 'Disable Shariff', 'shariff' ) . '</strong><br>';
|
39 |
-
echo '<input type="checkbox" name="shariff_metabox_disable"';
|
40 |
-
if ( isset( $shariff_metabox_disable ) ) echo checked( $shariff_metabox_disable, 1, 0 );
|
41 |
-
echo '>';
|
42 |
-
echo '<label for="shariff_metabox_disable">' . __( 'Disable Shariff for this content.', 'shariff' ) . '</label></p>';
|
43 |
-
|
44 |
-
// retrieve the current metabox add before and after values
|
45 |
-
$shariff_metabox_before = get_post_meta( get_the_ID(), 'shariff_metabox_before', true );
|
46 |
-
$shariff_metabox_after = get_post_meta( get_the_ID(), 'shariff_metabox_after', true );
|
47 |
-
// add Shariff checkboxes
|
48 |
-
echo '<p><strong>' . __( 'Add Shariff', 'shariff' ) . '</strong><br>';
|
49 |
-
// before checkbox
|
50 |
-
echo '<input type="checkbox" name="shariff_metabox_before"';
|
51 |
-
if ( isset( $shariff_metabox_before ) ) echo checked( $shariff_metabox_before, 1, 0 );
|
52 |
-
echo '>';
|
53 |
-
echo '<label for="shariff_metabox_before">' . __( 'Add buttons <u>before</u> this content.', 'shariff' ) . '</label><br>';
|
54 |
-
// after checkbox
|
55 |
-
echo '<input type="checkbox" name="shariff_metabox_after"';
|
56 |
-
if ( isset( $shariff_metabox_after ) ) echo checked( $shariff_metabox_after, 1, 0 );
|
57 |
-
echo '>';
|
58 |
-
echo '<label for="shariff_metabox_after">' . __( 'Add buttons <u>after</u> this content.', 'shariff' ) . '</label></p>';
|
59 |
-
|
60 |
-
// retrieve the current metabox media value (pinterest image)
|
61 |
-
$shariff_metabox_media = get_post_meta( get_the_ID(), 'shariff_metabox_media', true );
|
62 |
-
// metabox shortcode
|
63 |
-
echo '<p><strong>' . __( 'Pinterest Image', 'shariff' ) . '</strong><br><label for="shariff_metabox_media">' . __( 'The complete url to your desired custom image for Pinterest.', 'shariff' ) . '</label><br>';
|
64 |
-
echo '<input type="text" name="shariff_metabox_media" value="' . esc_html( $shariff_metabox_media ) . '" id="shariff-image-url" style="width:55%; margin-right:5px"><input type="button" name="upload-btn" id="shariff-upload-btn" class="button-secondary" value="' . __( 'Choose image', 'shariff' ) . '"></p>';
|
65 |
-
|
66 |
-
// retrieve the current metabox shortcode value
|
67 |
-
$shariff_metabox = get_post_meta( get_the_ID(), 'shariff_metabox', true );
|
68 |
-
// metabox shortcode
|
69 |
-
echo '<p><strong>' . __( 'Shortcode', 'shariff' ) . '</strong><br><label for="shariff_metabox">' . __( 'The settings in this shortcode field overwrite <u>all</u> global settings.', 'shariff' ) . '</label><br>';
|
70 |
-
echo '<input type="text" name="shariff_metabox" value="' . esc_html( $shariff_metabox ) . '" placeholder="[shariff]" style="width:100%"></p>';
|
71 |
-
|
72 |
-
// retrieve the current metabox ignore widget value
|
73 |
-
$shariff_metabox_ignore_widget = get_post_meta( get_the_ID(), 'shariff_metabox_ignore_widget', true );
|
74 |
-
// disable checkbox
|
75 |
-
echo '<p><strong>' . __( 'Ignore Widgets', 'shariff' ) . '</strong><br>';
|
76 |
-
echo '<input type="checkbox" name="shariff_metabox_ignore_widget"';
|
77 |
-
if ( isset( $shariff_metabox_ignore_widget ) ) echo checked( $shariff_metabox_ignore_widget, 1, 0 );
|
78 |
-
echo '>';
|
79 |
-
echo '<label for="shariff_metabox_ignore_widget">' . __( 'Do not affect buttons in widgets.', 'shariff' ) . '</label></p>';
|
80 |
-
}
|
81 |
-
|
82 |
-
// save meta data
|
83 |
-
function shariff3UU_save_metabox_data( $post_id, $post ) {
|
84 |
-
// check nonce and if shariff_metabox is set
|
85 |
-
if ( isset( $_REQUEST['shariff_metabox_nonce'] ) && wp_verify_nonce( $_REQUEST['shariff_metabox_nonce'], basename( __FILE__ ) ) ) {
|
86 |
-
// check if we are not autosaving or previewing (revision)
|
87 |
-
$post_type_object = get_post_type_object( $post->post_type );
|
88 |
-
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || wp_is_post_revision( $post ) || ( is_multisite() && ms_is_switched() ) || ! current_user_can( $post_type_object->cap->edit_post, $post_id ) ) {
|
89 |
-
return;
|
90 |
-
}
|
91 |
-
// else we are good to go and can save our meta box data
|
92 |
-
else {
|
93 |
-
// save meta box disable
|
94 |
-
if ( isset( $_POST['shariff_metabox_disable'] ) && $_POST['shariff_metabox_disable'] == 'on' ) {
|
95 |
-
update_post_meta( $post_id, 'shariff_metabox_disable', '1' );
|
96 |
-
}
|
97 |
-
else {
|
98 |
-
delete_post_meta( $post_id, 'shariff_metabox_disable', '1' );
|
99 |
-
}
|
100 |
-
|
101 |
-
// save meta box add before value
|
102 |
-
if ( isset( $_POST['shariff_metabox_before'] ) && $_POST['shariff_metabox_before'] == 'on' ) {
|
103 |
-
update_post_meta( $post_id, 'shariff_metabox_before', '1' );
|
104 |
-
}
|
105 |
-
else {
|
106 |
-
delete_post_meta( $post_id, 'shariff_metabox_before', '1' );
|
107 |
-
}
|
108 |
-
|
109 |
-
// save meta box add after value
|
110 |
-
if ( isset( $_POST['shariff_metabox_after'] ) && $_POST['shariff_metabox_after'] == 'on' ) {
|
111 |
-
update_post_meta( $post_id, 'shariff_metabox_after', '1' );
|
112 |
-
}
|
113 |
-
else {
|
114 |
-
delete_post_meta( $post_id, 'shariff_metabox_after', '1' );
|
115 |
-
}
|
116 |
-
|
117 |
-
// save meta box media
|
118 |
-
if ( isset( $_POST['shariff_metabox_media'] ) && ! empty( $_POST['shariff_metabox_media'] ) ) {
|
119 |
-
update_post_meta( $post_id, 'shariff_metabox_media', esc_url_raw( $_POST['shariff_metabox_media'] ) );
|
120 |
-
}
|
121 |
-
else {
|
122 |
-
delete_post_meta( $post_id, 'shariff_metabox_media' );
|
123 |
-
}
|
124 |
-
|
125 |
-
// save meta box shortcode
|
126 |
-
if ( isset( $_POST['shariff_metabox'] ) && ! empty( $_POST['shariff_metabox'] ) ) {
|
127 |
-
update_post_meta( $post_id, 'shariff_metabox', wp_kses( $_POST['shariff_metabox'], $GLOBALS["allowed_tags"] ) );
|
128 |
-
}
|
129 |
-
else {
|
130 |
-
delete_post_meta( $post_id, 'shariff_metabox' );
|
131 |
-
}
|
132 |
-
|
133 |
-
// save meta box ignore widgets
|
134 |
-
if ( isset( $_POST['shariff_metabox_ignore_widget'] ) && $_POST['shariff_metabox_ignore_widget'] == 'on' ) {
|
135 |
-
update_post_meta( $post_id, 'shariff_metabox_ignore_widget', '1' );
|
136 |
-
}
|
137 |
-
else {
|
138 |
-
delete_post_meta( $post_id, 'shariff_metabox_ignore_widget', '1' );
|
139 |
-
}
|
140 |
-
}
|
141 |
-
}
|
142 |
-
}
|
143 |
-
add_action( 'save_post', 'shariff3UU_save_metabox_data', 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/admin_notices.php
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// will be included in the shariff.php to display admin notices about updates and missing settings
|
3 |
-
|
4 |
-
// prevent direct calls to admin_notices.php
|
5 |
-
if ( ! class_exists('WP') ) { die(); }
|
6 |
-
|
7 |
-
// display an dismissible update notice
|
8 |
-
function shariff3UU_update_notice() {
|
9 |
-
global $current_user;
|
10 |
-
$user_id = $current_user->ID;
|
11 |
-
// check that the user hasn't already clicked to ignore the message and can access options
|
12 |
-
if ( current_user_can( 'manage_options' ) && ! get_option( 'shariff3UU_hide_update_notice' ) ) {
|
13 |
-
echo "<div class='notice notice-success is-dismissible shariff-update-notice'><p>";
|
14 |
-
$updatetext = __( 'Shariff Wrapper has been successfully updated to version %version. If you encounter any problems, please report them to the <a href="https://wordpress.org/support/plugin/shariff" target="_blank"><strong>Support Forum</strong></a>, so we can fix them!', 'shariff' );
|
15 |
-
$updatetext = str_replace( '%version', $GLOBALS["shariff3UU"]["version"], $updatetext );
|
16 |
-
echo $updatetext;
|
17 |
-
echo "</p></div>";
|
18 |
-
}
|
19 |
-
}
|
20 |
-
add_action( 'admin_notices', 'shariff3UU_update_notice' );
|
21 |
-
|
22 |
-
// display an info notice, if a service has been selected that requires a username, id, etc. and none has been provided
|
23 |
-
function shariff3UU_service_notice() {
|
24 |
-
// prevent php info notices
|
25 |
-
$services = array();
|
26 |
-
// check if any services are set and if user can manage options
|
27 |
-
if ( isset( $GLOBALS["shariff3UU"]["services"] ) && current_user_can( 'manage_options' ) ) {
|
28 |
-
// Flattr
|
29 |
-
if ( strpos( $GLOBALS["shariff3UU"]["services"], 'flattr' ) !== false && empty( $GLOBALS["shariff3UU"]["flattruser"] ) ) {
|
30 |
-
$services[] = "Flattr";
|
31 |
-
}
|
32 |
-
// Patreon
|
33 |
-
if ( strpos( $GLOBALS["shariff3UU"]["services"], 'patreon' ) !== false && empty( $GLOBALS["shariff3UU"]["patreonid"] ) ) {
|
34 |
-
$services[] = "Patreon";
|
35 |
-
}
|
36 |
-
// PayPal
|
37 |
-
if ( strpos( $GLOBALS["shariff3UU"]["services"], 'paypal' ) !== false && strpos( $GLOBALS["shariff3UU"]["services"], 'paypalme' ) === false && empty( $GLOBALS["shariff3UU"]["paypalbuttonid"] ) ) {
|
38 |
-
$services[] = "PayPal";
|
39 |
-
}
|
40 |
-
// PayPal.me
|
41 |
-
if ( strpos( $GLOBALS["shariff3UU"]["services"], 'paypalme' ) !== false && empty( $GLOBALS["shariff3UU"]["paypalmeid"] ) ) {
|
42 |
-
$services[] = "PayPal.Me";
|
43 |
-
}
|
44 |
-
// Bitcoin
|
45 |
-
if ( strpos( $GLOBALS["shariff3UU"]["services"], 'bitcoin' ) !== false && empty( $GLOBALS["shariff3UU"]["bitcoinaddress"] ) ) {
|
46 |
-
$services[] = "Bitcoin";
|
47 |
-
}
|
48 |
-
// Mailform
|
49 |
-
if ( strpos( $GLOBALS["shariff3UU"]["services"], 'mailform' ) !== false && isset( $GLOBALS["shariff3UU"]["disable_mailform"] ) ) {
|
50 |
-
$services[] = "Mailform";
|
51 |
-
}
|
52 |
-
// loop through services and display an info notice
|
53 |
-
foreach ( $services as $service ) {
|
54 |
-
echo "<div class='notice notice-error'><p>";
|
55 |
-
// mail form error
|
56 |
-
if ( $service === "Mailform" ) {
|
57 |
-
echo __('Please check your', 'shariff');
|
58 |
-
echo " <a href='" . get_bloginfo('wpurl') . "/wp-admin/options-general.php?page=shariff3uu&tab=mailform'>" . __('Shariff Settings', 'shariff') . "</a> - ";
|
59 |
-
echo __('Mailform has been selected as a service, but mail form functionality has been disabled on the mail form tab!', 'shariff');
|
60 |
-
}
|
61 |
-
// other service settings errors
|
62 |
-
else {
|
63 |
-
echo __('Please check your', 'shariff');
|
64 |
-
echo " <a href='" . get_bloginfo('wpurl') . "/wp-admin/options-general.php?page=shariff3uu&tab=advanced'>" . __('Shariff Settings', 'shariff') . "</a> - ";
|
65 |
-
$infotext = __('%service has been selected as a service, but no username, ID or address has been provided! Please enter the required information on the advanced tab!', 'shariff');
|
66 |
-
$infotext = str_replace( '%service', $service, $infotext );
|
67 |
-
echo $infotext;
|
68 |
-
}
|
69 |
-
echo "</p></div>";
|
70 |
-
}
|
71 |
-
}
|
72 |
-
}
|
73 |
-
add_action( 'admin_notices', 'shariff3UU_service_notice' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bitcoin.php
CHANGED
@@ -1,17 +1,22 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
//
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
echo '<
|
16 |
-
echo '</
|
17 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Generates an QR code for bitcoin.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Includes php class for QR code generation.
|
9 |
+
require './includes/phpqrcode.php';
|
10 |
+
|
11 |
+
// Gets the bitcoin address.
|
12 |
+
$bitcoinaddress = htmlspecialchars( $_GET['bitcoinaddress'] );
|
13 |
+
|
14 |
+
// Creates the page.
|
15 |
+
echo '<html><head><title>Bitcoin</title></head><body>';
|
16 |
+
echo '<div style="text-align:center;"><h1>Bitcoin</h1></div>';
|
17 |
+
echo '<p style="text-align:center;"><a href="bitcoin:' . $bitcoinaddress . '">bitcoin:' . $bitcoinaddress . '</a></p>';
|
18 |
+
echo '<p style="text-align:center;">';
|
19 |
+
QRcode::svg( $bitcoinaddress, false, 'h', 5 );
|
20 |
+
echo '</p>';
|
21 |
+
echo '<p style="text-align:center;">Information: <a href="https://www.bitcoin.org" target="_blank">bitcoin.org</a></p>';
|
22 |
+
echo '</body></html>';
|
changelog.txt
CHANGED
@@ -1,551 +1,594 @@
|
|
1 |
-
=== Shariff Wrapper ===
|
2 |
-
|
3 |
-
== Changelog ==
|
4 |
-
|
5 |
-
= 4.
|
6 |
-
- new
|
7 |
-
-
|
8 |
-
- new
|
9 |
-
-
|
10 |
-
|
11 |
-
|
12 |
-
- new
|
13 |
-
-
|
14 |
-
-
|
15 |
-
|
16 |
-
|
17 |
-
-
|
18 |
-
-
|
19 |
-
-
|
20 |
-
-
|
21 |
-
-
|
22 |
-
-
|
23 |
-
|
24 |
-
|
25 |
-
-
|
26 |
-
-
|
27 |
-
-
|
28 |
-
|
29 |
-
|
30 |
-
- new
|
31 |
-
-
|
32 |
-
-
|
33 |
-
-
|
34 |
-
-
|
35 |
-
- updated
|
36 |
-
- updated
|
37 |
-
-
|
38 |
-
|
39 |
-
|
40 |
-
-
|
41 |
-
-
|
42 |
-
-
|
43 |
-
-
|
44 |
-
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
-
|
50 |
-
|
51 |
-
|
52 |
-
- new
|
53 |
-
- new
|
54 |
-
- new
|
55 |
-
- new
|
56 |
-
- new
|
57 |
-
-
|
58 |
-
-
|
59 |
-
- fixed
|
60 |
-
- fixed
|
61 |
-
-
|
62 |
-
-
|
63 |
-
|
64 |
-
|
65 |
-
-
|
66 |
-
|
67 |
-
= 4.
|
68 |
-
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
-
|
74 |
-
-
|
75 |
-
|
76 |
-
|
77 |
-
- fixed
|
78 |
-
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
- fixed
|
86 |
-
- fixed
|
87 |
-
- fixed
|
88 |
-
|
89 |
-
|
90 |
-
- new
|
91 |
-
-
|
92 |
-
- minor css
|
93 |
-
|
94 |
-
= 4.0
|
95 |
-
-
|
96 |
-
-
|
97 |
-
|
98 |
-
|
99 |
-
-
|
100 |
-
-
|
101 |
-
|
102 |
-
|
103 |
-
-
|
104 |
-
-
|
105 |
-
-
|
106 |
-
|
107 |
-
|
108 |
-
-
|
109 |
-
|
110 |
-
|
111 |
-
- new option
|
112 |
-
|
113 |
-
|
114 |
-
-
|
115 |
-
-
|
116 |
-
-
|
117 |
-
-
|
118 |
-
|
119 |
-
|
120 |
-
-
|
121 |
-
-
|
122 |
-
|
123 |
-
|
124 |
-
-
|
125 |
-
-
|
126 |
-
|
127 |
-
|
128 |
-
-
|
129 |
-
-
|
130 |
-
|
131 |
-
|
132 |
-
-
|
133 |
-
-
|
134 |
-
-
|
135 |
-
-
|
136 |
-
|
137 |
-
=
|
138 |
-
-
|
139 |
-
- fixed
|
140 |
-
|
141 |
-
|
142 |
-
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
-
|
147 |
-
-
|
148 |
-
|
149 |
-
|
150 |
-
-
|
151 |
-
|
152 |
-
|
153 |
-
-
|
154 |
-
-
|
155 |
-
|
156 |
-
|
157 |
-
-
|
158 |
-
-
|
159 |
-
|
160 |
-
|
161 |
-
-
|
162 |
-
-
|
163 |
-
-
|
164 |
-
-
|
165 |
-
-
|
166 |
-
-
|
167 |
-
-
|
168 |
-
-
|
169 |
-
-
|
170 |
-
-
|
171 |
-
-
|
172 |
-
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
-
|
177 |
-
-
|
178 |
-
-
|
179 |
-
|
180 |
-
|
181 |
-
-
|
182 |
-
-
|
183 |
-
-
|
184 |
-
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
-
|
191 |
-
|
192 |
-
= 3.
|
193 |
-
-
|
194 |
-
|
195 |
-
= 3.
|
196 |
-
-
|
197 |
-
-
|
198 |
-
|
199 |
-
|
200 |
-
-
|
201 |
-
-
|
202 |
-
|
203 |
-
|
204 |
-
-
|
205 |
-
-
|
206 |
-
-
|
207 |
-
-
|
208 |
-
-
|
209 |
-
|
210 |
-
|
211 |
-
-
|
212 |
-
-
|
213 |
-
-
|
214 |
-
-
|
215 |
-
-
|
216 |
-
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
-
|
222 |
-
-
|
223 |
-
- fix
|
224 |
-
|
225 |
-
|
226 |
-
-
|
227 |
-
- fix
|
228 |
-
|
229 |
-
=
|
230 |
-
- fix
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
- new
|
237 |
-
|
238 |
-
|
239 |
-
- new
|
240 |
-
- new
|
241 |
-
- new
|
242 |
-
-
|
243 |
-
-
|
244 |
-
-
|
245 |
-
-
|
246 |
-
- fix
|
247 |
-
- fix
|
248 |
-
-
|
249 |
-
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
-
|
256 |
-
-
|
257 |
-
|
258 |
-
|
259 |
-
-
|
260 |
-
-
|
261 |
-
-
|
262 |
-
|
263 |
-
|
264 |
-
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
-
|
274 |
-
-
|
275 |
-
-
|
276 |
-
|
277 |
-
|
278 |
-
-
|
279 |
-
- new
|
280 |
-
-
|
281 |
-
-
|
282 |
-
-
|
283 |
-
-
|
284 |
-
-
|
285 |
-
- fix
|
286 |
-
-
|
287 |
-
-
|
288 |
-
-
|
289 |
-
-
|
290 |
-
|
291 |
-
|
292 |
-
-
|
293 |
-
|
294 |
-
= 2.
|
295 |
-
-
|
296 |
-
|
297 |
-
= 2.
|
298 |
-
-
|
299 |
-
|
300 |
-
|
301 |
-
= 2.2
|
302 |
-
-
|
303 |
-
|
304 |
-
|
305 |
-
-
|
306 |
-
-
|
307 |
-
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
-
|
316 |
-
|
317 |
-
|
318 |
-
-
|
319 |
-
-
|
320 |
-
-
|
321 |
-
-
|
322 |
-
-
|
323 |
-
|
324 |
-
|
325 |
-
- fix
|
326 |
-
-
|
327 |
-
|
328 |
-
-
|
329 |
-
|
330 |
-
|
331 |
-
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
-
|
346 |
-
|
347 |
-
|
348 |
-
-
|
349 |
-
-
|
350 |
-
- fix
|
351 |
-
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
-
|
375 |
-
|
376 |
-
|
377 |
-
-
|
378 |
-
-
|
379 |
-
|
380 |
-
-
|
381 |
-
|
382 |
-
= 1.9 =
|
383 |
-
-
|
384 |
-
|
385 |
-
|
386 |
-
-
|
387 |
-
-
|
388 |
-
|
389 |
-
|
390 |
-
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
-
|
395 |
-
|
396 |
-
= 1.
|
397 |
-
-
|
398 |
-
|
399 |
-
|
400 |
-
-
|
401 |
-
|
402 |
-
= 1.
|
403 |
-
-
|
404 |
-
|
405 |
-
|
406 |
-
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
-
|
417 |
-
-
|
418 |
-
|
419 |
-
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
-
|
424 |
-
|
425 |
-
|
426 |
-
-
|
427 |
-
|
428 |
-
|
429 |
-
-
|
430 |
-
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
-
|
443 |
-
-
|
444 |
-
|
445 |
-
= 1.
|
446 |
-
-
|
447 |
-
|
448 |
-
|
449 |
-
-
|
450 |
-
|
451 |
-
-
|
452 |
-
|
453 |
-
= 1.
|
454 |
-
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
-
|
473 |
-
|
474 |
-
|
475 |
-
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
= 1.
|
505 |
-
-
|
506 |
-
|
507 |
-
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
- add
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
-
|
524 |
-
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
- add
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
- add
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
- add
|
546 |
-
|
547 |
-
=
|
548 |
-
-
|
549 |
-
|
550 |
-
|
551 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Shariff Wrapper ===
|
2 |
+
|
3 |
+
== Changelog ==
|
4 |
+
|
5 |
+
= 4.4.2 =
|
6 |
+
- new support for the "AMP for WP" plugin by Ahmed and Mohammed Kaludi
|
7 |
+
- improved support for the "AMP for WordPress" plugin by Automattic
|
8 |
+
- new additional workaround for servers without $_SERVER for category pages
|
9 |
+
- minor bug fixes
|
10 |
+
|
11 |
+
= 4.4.1 =
|
12 |
+
- new service wallabag (thanks to Torsten, @knodderdachs)
|
13 |
+
- minor bug fixes
|
14 |
+
- updated help section
|
15 |
+
|
16 |
+
= 4.4.0 =
|
17 |
+
- new service Telegram (thanks to Daniel Sturm, @dcsturm)
|
18 |
+
- new service Flipboard (thanks to csigncsign, @csigncsign)
|
19 |
+
- new service Mastodon (thanks to scroom, @scroom)
|
20 |
+
- new service Qzone
|
21 |
+
- new service Weibo
|
22 |
+
- new service TencentWeibo
|
23 |
+
- new service SMS (will work on iOS, might not work on other phones)
|
24 |
+
- new support of the "AMP for WordPress" plugin by Automattic
|
25 |
+
- new option to set a custom text for the info button
|
26 |
+
- new option to disable the metabox
|
27 |
+
- new option to add shariff to CPTs before the content
|
28 |
+
- new ranking table now also shows pages
|
29 |
+
- new fix to prevent Shariff buttons from being displayed on admin pages
|
30 |
+
- new fix to support WP-CLI (thanks to Daniel Jagszent, @d--j)
|
31 |
+
- fixed HTML errors regarding self closing tags (thanks to Tooni, @tooni)
|
32 |
+
- fixed a missing closing tag under certain conditions (thanks to Pat, @fortythousandmiles)
|
33 |
+
- removed GooglePlus share counts due to Google removing the API
|
34 |
+
- added Czech translation of the buttons
|
35 |
+
- updated a lot of button translations
|
36 |
+
- updated to Facebook Graph API 2.12
|
37 |
+
- updated a lot of strings to allow for easier translation
|
38 |
+
- updated the reddit icon
|
39 |
+
- updated help section
|
40 |
+
- improved documentation of the REST API endpoint for share counts (thanks to David)
|
41 |
+
- major improvements in regards to code quality
|
42 |
+
- minor css improvements
|
43 |
+
- minor security improvements
|
44 |
+
- removed the mail form for the time being due to technical and legal due diligence
|
45 |
+
- if you need the mail form functionality, please stick to version 4.3
|
46 |
+
- https://downloads.wordpress.org/plugin/shariff.4.3.0.zip
|
47 |
+
|
48 |
+
= 4.3.0 =
|
49 |
+
- new service Odnoklassniki (thanks to rockhit)
|
50 |
+
- new meta box allows for individual settings per post or page
|
51 |
+
- new option to hide share counts that are zero
|
52 |
+
- new option to disable dynamic cache lifespan (not recommended)
|
53 |
+
- new option to set the button size to small, medium or large
|
54 |
+
- new option to add a custom class to the container around Shariff
|
55 |
+
- new option to open links in a popup (thanks to jackennils)
|
56 |
+
- new option to use NewShareCount instead of OpenShareCount (Twitter)
|
57 |
+
- added timestamp variable to be accessible via shortcode
|
58 |
+
- fixed post timestamp for caching under certain conditions
|
59 |
+
- fixed Facebook share count error for never crawled pages
|
60 |
+
- fixed empty tab after sharing on certain mobile devices
|
61 |
+
- fixed custom title attribute (thanks to kschlager)
|
62 |
+
- updated Flattr user id for the future (thanks to poetaster)
|
63 |
+
- reduced changelog on wordpress.org (thanks to timse201)
|
64 |
+
- minor css improvements
|
65 |
+
- updated help section
|
66 |
+
|
67 |
+
= 4.2.1 =
|
68 |
+
- fixed WhatsApp button on Android when using Chrome
|
69 |
+
- fixed Shariff being added to RSS feeds under certain conditions
|
70 |
+
- updated to latest Facebook Graph API for share count requests
|
71 |
+
|
72 |
+
= 4.2.0 =
|
73 |
+
- new option to set the rate limit for sending mails using the mail form
|
74 |
+
- added home url as fallback for share count requests
|
75 |
+
- added further anti-spam prevention mechanics
|
76 |
+
- added noopener and noreferrer to share links
|
77 |
+
- fixed double encoding of share count request links
|
78 |
+
- updated media uploader request for translation
|
79 |
+
- updated handling of admin notices following WordPress core
|
80 |
+
- tested and optimized for WordPress 4.6
|
81 |
+
|
82 |
+
= 4.1.2 =
|
83 |
+
- new fallback for share count requests in case pretty permalinks are disabled
|
84 |
+
- new filter shariff3UU_render_atts to change options on the fly (thx Ov3rfly)
|
85 |
+
- fixed share title in cases with html encoded characters
|
86 |
+
- fixed double counting on ranking tab under certain conditions
|
87 |
+
- fixed php info notice in admin notices
|
88 |
+
|
89 |
+
= 4.1.1 =
|
90 |
+
- new option to disable the Shariff buttons outside of the main loop
|
91 |
+
- fixed Facebook App ID request
|
92 |
+
- minor css fix
|
93 |
+
|
94 |
+
= 4.1.0 =
|
95 |
+
- new design option to set a custom button color for all buttons
|
96 |
+
- new design option to set a border radius for the round theme (up to a square)
|
97 |
+
- new design option to hide all buttons until the page is fully loaded
|
98 |
+
- new mailform option to use a html anchor (again)
|
99 |
+
- new statistic option to fill the cache automatically
|
100 |
+
- new statistic option to set the amount of posts for the ranking tab
|
101 |
+
- new statistic option to use share counts with PHP < 5.4
|
102 |
+
- fixed preventing buttons from beeing added to excerpts under certain conditions
|
103 |
+
- fixed url encoding of share count requests
|
104 |
+
- improved handling of wrong or mistyped service entries
|
105 |
+
- minor bug fixes
|
106 |
+
|
107 |
+
= 4.0.8 =
|
108 |
+
- new workaround for sites running PHP 5.2 and older
|
109 |
+
|
110 |
+
= 4.0.7 =
|
111 |
+
- new option for WordPress installations with REST API not reachable in root
|
112 |
+
|
113 |
+
= 4.0.6 =
|
114 |
+
- fixed an error in combination with bbpress
|
115 |
+
- fixed an error on very old PHP versions
|
116 |
+
- fixed ranking tab
|
117 |
+
- minor css improvements
|
118 |
+
|
119 |
+
= 4.0.5 =
|
120 |
+
- fixed mail form link
|
121 |
+
- fixed xmlns for w3c
|
122 |
+
|
123 |
+
= 4.0.4 =
|
124 |
+
- removed some remaining wrong text domains for translations
|
125 |
+
- minor css fixes
|
126 |
+
|
127 |
+
= 4.0.3 =
|
128 |
+
- fixed mobile services not showing on certain tablets
|
129 |
+
- fixed type error on totalnumber when cache is empty
|
130 |
+
- fixed share count requests when WordPress is installed in a subdirectory
|
131 |
+
- fixed url encoding of share url, title and media
|
132 |
+
- added width and height to SVGs to prevent large initial icons prior to css
|
133 |
+
- new classes shariff-buttons and shariff-link added
|
134 |
+
- removed local translation files due to switching to wordpress.org language packs
|
135 |
+
- minor css resets added
|
136 |
+
|
137 |
+
= 4.0.2 =
|
138 |
+
- added minor css resets to prevent influence of theme css
|
139 |
+
- fixed LinkedIn share link
|
140 |
+
|
141 |
+
= 4.0.1 =
|
142 |
+
- prevent php warning messages on unsuccessful includes while WP_DEBUG is active
|
143 |
+
- change text domain to match plugin slug
|
144 |
+
|
145 |
+
= 4.0.0 =
|
146 |
+
- complete overhaul of the plugin core
|
147 |
+
- buttons now also work without JavaScript
|
148 |
+
- icon font has been removed and replaced with SVGs
|
149 |
+
- share counts now use the WP REST API
|
150 |
+
- share counts now always show the last cached counts prior to updating them
|
151 |
+
- fixed duplicated share count requests
|
152 |
+
- new ranking tab shows the shares of your last 100 posts
|
153 |
+
- new service pocket
|
154 |
+
- new option to show the total amount of shares in the headline with %total
|
155 |
+
- new option to use the total amount of shares in your theme (see FAQ)
|
156 |
+
- new action hook shariff_share_counts (see FAQ)
|
157 |
+
- new option to change the priority of the shortcode filter
|
158 |
+
- new support for selective refresh introduced in WP 4.5
|
159 |
+
- new external API feature replaces the external host option (experimental, see FAQ)
|
160 |
+
- new support for SCRIPT_DEBUG
|
161 |
+
- css and js files are now only loaded on pages with Shariff buttons
|
162 |
+
- improved compatibility with plugin Autoptimize (force scripts in head)
|
163 |
+
- improved compatibility with multiple caching plugins
|
164 |
+
- all shortcodes are now being stripped from the mail message body
|
165 |
+
- fixed potential double sending of mails
|
166 |
+
- removed all jQuery dependencies
|
167 |
+
- requires at least WordPress 4.4 (only for share counts)
|
168 |
+
- we no longer support IE 8 (if it ever worked)
|
169 |
+
- updated status tab
|
170 |
+
- updated help section
|
171 |
+
- minor bug fixes
|
172 |
+
- code cleanup
|
173 |
+
|
174 |
+
= 3.4.2 =
|
175 |
+
- fixed share counts on mobile devices with exactly 360px width
|
176 |
+
- fixed error on the help tab regarding services (thx to Andreas)
|
177 |
+
- small css improvements
|
178 |
+
- added h4-h6 to the allowed tags for the headline
|
179 |
+
|
180 |
+
= 3.4.1 =
|
181 |
+
- changed diaspora share url to official one
|
182 |
+
- fixed css of rss button when using round theme in widget
|
183 |
+
- fixed accessibility of share button text
|
184 |
+
- added rssfeed option to help section
|
185 |
+
- updated to Heise version 1.23.0
|
186 |
+
|
187 |
+
= 3.4.0 =
|
188 |
+
- new service rss
|
189 |
+
- minor bug fixes
|
190 |
+
- update to Heise version 1.22.0
|
191 |
+
|
192 |
+
= 3.3.3 =
|
193 |
+
- fix anonymous function request for PHP < version 5.3
|
194 |
+
|
195 |
+
= 3.3.2 =
|
196 |
+
- improve/extend handling of custom post types
|
197 |
+
- fix Facebook ID call
|
198 |
+
|
199 |
+
= 3.3.1 =
|
200 |
+
- fix ttl setting on statistic tab
|
201 |
+
- reduce timeout for post requests to five seconds
|
202 |
+
|
203 |
+
= 3.3.0 =
|
204 |
+
- new option to use an external host for Shariff and the share count backend
|
205 |
+
- new share count service OpenShareCount.com for Twitter
|
206 |
+
- new settings tab "Statistic" for all options regarding the share counts
|
207 |
+
- new settings tab "Status" for all system checks to increase performance
|
208 |
+
- new design preview button without Twitter
|
209 |
+
- fix counter VK on design round
|
210 |
+
- fix Facebook total_count again
|
211 |
+
- fix double Twitter share windows under certain conditions
|
212 |
+
- reactivate Flattr counts, since they fixed their API
|
213 |
+
- purge Shariff transients on update, deactivate and uninstall
|
214 |
+
- code cleanup
|
215 |
+
- add vk to help section
|
216 |
+
- add a known bugs section to the readme
|
217 |
+
|
218 |
+
= 3.2.0 =
|
219 |
+
- new service VK
|
220 |
+
- new share count service VK
|
221 |
+
- new dynamic cache lifespan (ttl) based on post / page age (last modified)
|
222 |
+
- new option to disable individual services (only share counts)
|
223 |
+
- fix Facebook share counts now use total_counts again
|
224 |
+
- fix search for custom WP locations
|
225 |
+
- backend optimization
|
226 |
+
- temporarily disabled the Flattr counts (statistic) due to ongoing problems of the Flattr API
|
227 |
+
- fix use of wp_title() is/was deprecated in WP4.4
|
228 |
+
|
229 |
+
= 3.1.3 =
|
230 |
+
- fix ajax call when a custom permalink structure is used
|
231 |
+
|
232 |
+
= 3.1.2 =
|
233 |
+
- fix Facebook ID on 32-bit systems
|
234 |
+
|
235 |
+
= 3.1.1 =
|
236 |
+
- make admin help compatible to the new backend
|
237 |
+
|
238 |
+
= 3.1.0 =
|
239 |
+
- new option to add buttons before/after the excerpt
|
240 |
+
- new service Threema (thanks to medienverbinder)
|
241 |
+
- new service Diaspora (thanks to craiq)
|
242 |
+
- new service AddThis (thanks to bozana)
|
243 |
+
- new share count service AddThis (thanks to bozana)
|
244 |
+
- new service PayPal.Me
|
245 |
+
- new google icon
|
246 |
+
- fix title tag usage in some cases
|
247 |
+
- fix rel to data-rel popup
|
248 |
+
- fix round buttons in certain themes
|
249 |
+
- fix Flattr API to fetch counts again
|
250 |
+
- workaround to fix the wrong JSON answer of xing API
|
251 |
+
- up to date with Heise code version 1.21.0 2015-11-06
|
252 |
+
|
253 |
+
= 3.0.0 =
|
254 |
+
- new WP specific statistics backend for share counts
|
255 |
+
- new SHARIFF_WP_ROOT_PATH constant for custom wp locations
|
256 |
+
- automatic search for custom WP locations (thanks to hirasso)
|
257 |
+
- fix timeout issues and a lot of other backend issues
|
258 |
+
- deprecated Heise shariff-backend-php
|
259 |
+
- deprecated ZendFramework
|
260 |
+
- deprecated shariff3uu_cache directory
|
261 |
+
- deprecated SHARIFF_BACKEND_TMPDIR constant
|
262 |
+
|
263 |
+
= 2.4.3 =
|
264 |
+
- fix proxy settings
|
265 |
+
- fix PHP error notice caused by a race condition around concurrent requests in Zend_Cache
|
266 |
+
- fix PHP notice and error in backend on multisite
|
267 |
+
|
268 |
+
= 2.4.2 =
|
269 |
+
- fix lang attribute again
|
270 |
+
- fix update notice
|
271 |
+
|
272 |
+
= 2.4.1 =
|
273 |
+
- fix lang attribute
|
274 |
+
- nicer support hints about GD lib
|
275 |
+
- cleanup readme.txt
|
276 |
+
|
277 |
+
= 2.4.0 =
|
278 |
+
- ensure compatibility to WordPress 4.3
|
279 |
+
- new service Tumblr
|
280 |
+
- new service Patreon
|
281 |
+
- new service PayPal
|
282 |
+
- new service Bitcoin
|
283 |
+
- new supporting bbpress
|
284 |
+
- new using proxy settings from wp_config (thanks to Shogathu)
|
285 |
+
- fix automatic button language
|
286 |
+
- fix button language for Facebook
|
287 |
+
- fix problems with plugin "Hide Title"
|
288 |
+
- fix backend (statistic) for multisite environments
|
289 |
+
- fix backend (statistic) if WP_DEBUG is set to true
|
290 |
+
- fix language info in help section
|
291 |
+
- update to Heise version 1.16.0
|
292 |
+
- remove unnesseray guzzle docs
|
293 |
+
|
294 |
+
= 2.3.4 =
|
295 |
+
- add Italian language to the mailform
|
296 |
+
|
297 |
+
= 2.3.3 =
|
298 |
+
- fix Pinterest button, if pinit.js is present
|
299 |
+
- small css fixes
|
300 |
+
|
301 |
+
= 2.3.2 =
|
302 |
+
- add French (thanks Charlotte) and Italian (thanks Pier) translations
|
303 |
+
- improve screen reader compatibility
|
304 |
+
- fix: prefill mail_comment in case of an error
|
305 |
+
- fix: do not send more than 1 email as CC. Use a new mail for all recipients.
|
306 |
+
- fix: fallback to English at the email form only if language is not supported by this plugin
|
307 |
+
- cleanup mf_wait + extend time to wait of robots blocker to 2 sec
|
308 |
+
|
309 |
+
= 2.3.1 =
|
310 |
+
- fix facebook api (app id & secret)
|
311 |
+
- fix CSS mailform label
|
312 |
+
|
313 |
+
= 2.3.0 =
|
314 |
+
- redesing of the plugins options page
|
315 |
+
- mail form improved (a lot)
|
316 |
+
- split mail into mailform and mailto (check your manual shorttags!)
|
317 |
+
- new backend status section
|
318 |
+
- new option to use Facebook Graph API ID in case of rate limit problems
|
319 |
+
- new option to stretch the buttons horizontally
|
320 |
+
- new option to add a headline above the Shariff buttons
|
321 |
+
- many new button languages
|
322 |
+
- new default cache directory
|
323 |
+
- fix creation of default cache directory in case it is not month / year based
|
324 |
+
- fix url-shorttag-option in widget
|
325 |
+
- fix widget mailform link, if pressed twice
|
326 |
+
- fix widget mailform on blog page
|
327 |
+
- fix responsive flow of buttons in IE
|
328 |
+
- fix Twitter: prevent double encoding with text longer than 120 chars
|
329 |
+
- update shariff backend to 1.5.0 (Heise)
|
330 |
+
- update shariff JS to 1.14.0 (Heise)
|
331 |
+
- many more minor improvements
|
332 |
+
- code cleanup
|
333 |
+
|
334 |
+
= 2.2.4 =
|
335 |
+
- security fix
|
336 |
+
|
337 |
+
= 2.2.3 =
|
338 |
+
- extend blocking of shariff buttons within password protected posts
|
339 |
+
|
340 |
+
= 2.2.2 =
|
341 |
+
- allow email functionality only if service email is configured within the
|
342 |
+
admin menu as common service for all posts
|
343 |
+
|
344 |
+
= 2.2.1 =
|
345 |
+
- "fix" fallback to old twitter api again
|
346 |
+
|
347 |
+
= 2.2.0 =
|
348 |
+
- add option to hide Shariff on password protected posts
|
349 |
+
- tested up to WP 4.2.2
|
350 |
+
- "fix" fallback to old twitter api if another twitter script is found in order to avoid opening the share window twice
|
351 |
+
- share text of the mailto link now is "email"
|
352 |
+
- fix typo and cleanup code
|
353 |
+
|
354 |
+
= 2.1.2 =
|
355 |
+
- fix to make it work with PHP < 5.3 (you should really update your PHP version or change your hoster)
|
356 |
+
|
357 |
+
= 2.1.1 =
|
358 |
+
- change code because of a error with some PHP versions
|
359 |
+
|
360 |
+
= 2.1.0 =
|
361 |
+
- replace sender name if a name is provided with the mail form or set in admin menu
|
362 |
+
- add option to append the post content to the mail
|
363 |
+
- add mail header "Precedence: bulk" to avoid answers of autoresponder
|
364 |
+
- fix: rename a function to avoid problems with other plugins
|
365 |
+
- improve css
|
366 |
+
|
367 |
+
= 2.0.2 =
|
368 |
+
- fix: mail URLs must be a real link and not url-encoded
|
369 |
+
- hotfix: mail form disabled if not on single post. Avoid the
|
370 |
+
self destruction by the DOS-checker ;-)
|
371 |
+
- cleanup Shariff JS code (mailURL no longer needed)
|
372 |
+
|
373 |
+
= 2.0.1 =
|
374 |
+
- fix email form method POST
|
375 |
+
|
376 |
+
= 2.0.0 =
|
377 |
+
- changes to stay compatible to Heise implementation
|
378 |
+
- remove obsolet SHARIFF_ALL_POSTS
|
379 |
+
- fix some small css attributes (size)
|
380 |
+
- code clean up
|
381 |
+
|
382 |
+
= 1.9.9 =
|
383 |
+
- fix widget bug (wrong share links)
|
384 |
+
|
385 |
+
= 1.9.8 =
|
386 |
+
- add headers to avoid caching of backend data
|
387 |
+
- tested with WP 4.2 beta
|
388 |
+
- add option to use on custom pages (e.g. WooCommerce)
|
389 |
+
- better handling of pinterest media attribute
|
390 |
+
- bugfix: SHARIFF_BACKEND_TMPDIR in backend
|
391 |
+
- improve uninstal of cache dir
|
392 |
+
- add option to use smaller size buttons
|
393 |
+
- fix again target of the mailto-link
|
394 |
+
- cleanup code
|
395 |
+
|
396 |
+
= 1.9.7 =
|
397 |
+
- roll back to stable
|
398 |
+
|
399 |
+
= 1.9.6 =
|
400 |
+
- now really go back to 1st block in loop at WMPU
|
401 |
+
|
402 |
+
= 1.9.5 =
|
403 |
+
- nu abba: missing version update
|
404 |
+
|
405 |
+
= 1.9.4 =
|
406 |
+
- fix update bug on WPMS
|
407 |
+
|
408 |
+
= 1.9.3 =
|
409 |
+
- add missing backend files. Last change for this Sunday ;-)
|
410 |
+
|
411 |
+
= 1.9.2 =
|
412 |
+
- fix stupid bug with the update file :-( Sorry!
|
413 |
+
- fix initialisation of REMOTEHOSTS
|
414 |
+
|
415 |
+
= 1.9.1 =
|
416 |
+
- merge with original Shariff JS/CSS code version 1.9.3
|
417 |
+
- CSS theme default like Heise default again + "add" theme color
|
418 |
+
- fix the theme "white"
|
419 |
+
- backend now up to date
|
420 |
+
- disable WPDebug in backend config
|
421 |
+
- improve uninstall (options shariff3UU, shariff3UUversion,
|
422 |
+
widget_shariff) and compatible with multisite installations
|
423 |
+
- improve deactivation
|
424 |
+
|
425 |
+
= 1.9 =
|
426 |
+
- add Flattr
|
427 |
+
- improve version control
|
428 |
+
- update frensh translations
|
429 |
+
- use configuration from admin menu for blank shariff shortcodes
|
430 |
+
- own (much smaller) fonts
|
431 |
+
|
432 |
+
= 1.8.1 =
|
433 |
+
- remove the relativ network-path from service declarations (pinterest,
|
434 |
+
reddit, stumbleupon, xing) because it really makes no sense to change
|
435 |
+
the protocol within a popup of a secure target to unsecure connections
|
436 |
+
depending on the protocol the page is using
|
437 |
+
- change name of jQuery object to avoid conflicts with other plugins/themes
|
438 |
+
|
439 |
+
= 1.8 =
|
440 |
+
- add options to place Shariff (right/left/center)
|
441 |
+
- fix: migration check
|
442 |
+
- css optimized
|
443 |
+
- use the WP bundled jQuery now (save about 80% bandwidth :-)
|
444 |
+
|
445 |
+
= 1.7.1 =
|
446 |
+
- optimize css (thanks again to @jplambeck)
|
447 |
+
- code cleanup (No more warnings in debug mode. Perhaps ;-)
|
448 |
+
- sanitize admin input (thanks again to @jplambeck)
|
449 |
+
- set the title attribute to overwrite get_the_title() now supported
|
450 |
+
- fix: check SHARIFF_BACKEND_TMPDIR
|
451 |
+
- add uninstall script
|
452 |
+
|
453 |
+
= 1.7 =
|
454 |
+
- CHANGES: if no attributes are configured within a shorttag first try to
|
455 |
+
use the option from admin page. However if there are no services
|
456 |
+
configured use the old defaults of Heise to make it backward compatible
|
457 |
+
- add the new service attribut `mailto` to prepare getting the original
|
458 |
+
behavior of the Heise code that provide a email form with `mail`
|
459 |
+
- add option to put Shariff on overview page too
|
460 |
+
- add internal version tracker to enable better migration options in the
|
461 |
+
future
|
462 |
+
- optimized css for the info attribute, added priority to the title
|
463 |
+
attribute over DC.title attribute (thanks again to @jplambeck )
|
464 |
+
|
465 |
+
= 1.6.1 =
|
466 |
+
- fix: again enable WhatsUp on mobile now also works with Mozilla. Sorry
|
467 |
+
this has not been become part of the main branche. Therefor it was lost
|
468 |
+
with the last update :-(
|
469 |
+
- added .shariff span { color: inherit; } (thanks again to @jplambeck )
|
470 |
+
|
471 |
+
= 1.6. =
|
472 |
+
- adopted new responsive css code (thanks to @jplambeck )
|
473 |
+
- update included fa-fonts
|
474 |
+
- fix: descrition "printer"
|
475 |
+
- fix: use WP_CONTENT_URL in admin menu
|
476 |
+
|
477 |
+
= 1.5.4 =
|
478 |
+
- remove alternativ css with links to external hosters. If do you really
|
479 |
+
want enable breaking privacy plz feel free to code you own css
|
480 |
+
|
481 |
+
= 1.5.3 =
|
482 |
+
- hide counter within the theme round
|
483 |
+
|
484 |
+
= 1.5.2 =
|
485 |
+
- default backend temp dir now uses wp content dir
|
486 |
+
- updated original shariff JS code
|
487 |
+
|
488 |
+
= 1.5.1 =
|
489 |
+
- fix: constant had have a wrong declaration check
|
490 |
+
|
491 |
+
= 1.5.0 =
|
492 |
+
- add option "url" to set a fixed URI for all sites (only in shorttag and
|
493 |
+
widgets) because usually it is not a good idea to manipulate this
|
494 |
+
- fix: do not show error in elseif (/tmp check in admin menu)
|
495 |
+
|
496 |
+
= 1.4.4 =
|
497 |
+
- add option to force frensh and spanish buttons
|
498 |
+
- clean up theme selection
|
499 |
+
|
500 |
+
= 1.4.3 =
|
501 |
+
- look like wp_enqueue_script has problems with the shariff js code. Now own
|
502 |
+
script link at the end of the site. Should also improve performance ;-)
|
503 |
+
|
504 |
+
= 1.4.2 =
|
505 |
+
- fix: add the attribute data-title that is needed by the shariff on some
|
506 |
+
themes to render it above the other div containers.
|
507 |
+
- only long PHP-Tags because auf problems with WAMPs
|
508 |
+
- some code clean up. Hopefully it will become more robust on WAMP systems.
|
509 |
+
|
510 |
+
= 1.4.1 =
|
511 |
+
- fixed stupid typo with the SHARIFF_BACKEND_TMP constant
|
512 |
+
|
513 |
+
= 1.4.0 =
|
514 |
+
- add a DIV container to use positioning with CSS
|
515 |
+
- remove long PHP-tags that cause parse problem on Windows
|
516 |
+
|
517 |
+
= 1.3.0 =
|
518 |
+
- clean up the code
|
519 |
+
- add backend options (TTL and temp dir)
|
520 |
+
|
521 |
+
= 1.2.7 =
|
522 |
+
- fixed: enable WhatsUp on mobile now also works with Mozilla
|
523 |
+
- print button does not open a new window
|
524 |
+
- removed min.js make it more readable for own local changes
|
525 |
+
|
526 |
+
= 1.2.6 =
|
527 |
+
- add print button
|
528 |
+
- add default image for pinterest to avoid broken design and giuve a hint
|
529 |
+
|
530 |
+
= 1.2.5 =
|
531 |
+
- hotfix for pinterest (see FAQ)
|
532 |
+
|
533 |
+
= 1.2.4 =
|
534 |
+
- bugfix: widget does not work if SHARIFF_ALL_POSTS is set but not enabled
|
535 |
+
in the admin menu (Please remember, that SHARIFF_ALL_POSTS will be
|
536 |
+
removed with next major version)
|
537 |
+
- add option to add shariff at the begin of a post
|
538 |
+
- merge with new original backend for counters
|
539 |
+
- add spanish language on buttons; hide whatsup on mobile devices
|
540 |
+
(merge with yanniks code)
|
541 |
+
- add reddit
|
542 |
+
- add stumbleupon
|
543 |
+
|
544 |
+
= 1.2.3 =
|
545 |
+
- add round theme to the admin menu
|
546 |
+
|
547 |
+
= 1.2.2 =
|
548 |
+
- tested with WP 4.1
|
549 |
+
- added french language for buttons
|
550 |
+
- added theme "round" (round buttons without text but with fixed width)
|
551 |
+
|
552 |
+
= 1.2.1 =
|
553 |
+
- typos
|
554 |
+
|
555 |
+
= 1.2 =
|
556 |
+
- add widget support
|
557 |
+
|
558 |
+
= create a Stable1.0 tag =
|
559 |
+
- no new funtionality to this tag. Only bugfixes!
|
560 |
+
|
561 |
+
= 1.1.1 =
|
562 |
+
- add french language for the admin menu (thanks Celine ;-)
|
563 |
+
- fix backend problem on shared hosting with no writeable tmp dir
|
564 |
+
|
565 |
+
= 1.1 =
|
566 |
+
- add whatsapp|pinterest|linkedin|xing
|
567 |
+
- include latest upstream changes (fix mail etc.)
|
568 |
+
- add old default selection of services to make it backward compatible
|
569 |
+
|
570 |
+
= 1.0.2 =
|
571 |
+
- add German translation to the admin menu (Admin-Menue in Deutsch)
|
572 |
+
- code cleanup
|
573 |
+
|
574 |
+
= 1.0.1 =
|
575 |
+
- add PHP version check (5.4 is needed by the backend option)
|
576 |
+
|
577 |
+
= 1.0 =
|
578 |
+
- add admin menu page
|
579 |
+
- disable the default add on a post if a special formed tag was found
|
580 |
+
- add support for the theme attribute
|
581 |
+
|
582 |
+
= 0.4 =
|
583 |
+
- Include latest upstream changes
|
584 |
+
- use get_permalink() to set the parameter data-url
|
585 |
+
|
586 |
+
= 0.3 =
|
587 |
+
- add support for "hideshariff"
|
588 |
+
- add screenshots
|
589 |
+
|
590 |
+
= 0.2 =
|
591 |
+
- removed the private update server and changed test domain
|
592 |
+
|
593 |
+
= 0.1 =
|
594 |
+
- initial release
|
css/shariff.css
CHANGED
@@ -1,340 +1,360 @@
|
|
1 |
-
/* Shariff Wrapper */
|
2 |
-
.shariff
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
}
|
71 |
-
/* theme
|
72 |
-
.shariff .theme-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
}
|
78 |
-
/* theme
|
79 |
-
.shariff .theme-
|
80 |
-
|
81 |
-
|
82 |
-
}
|
83 |
-
.shariff .theme-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
.shariff .theme-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
}
|
97 |
-
.shariff .theme-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
.shariff .
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
.shariff .
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
.shariff .buttonsize-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
.shariff .buttonsize-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
}
|
168 |
-
|
169 |
-
.shariff .
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
}
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
}
|
197 |
-
/*
|
198 |
-
.shariff.
|
199 |
-
|
200 |
-
|
201 |
-
.
|
202 |
-
|
203 |
-
|
204 |
-
.
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
.
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
}
|
237 |
-
.
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
.
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
.
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
}
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
}
|
270 |
-
.
|
271 |
-
|
272 |
-
}
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
.
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
.shariff-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
}
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
.shariff .
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
}
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
}
|
338 |
-
|
339 |
-
|
340 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Shariff Wrapper */
|
2 |
+
.shariff {
|
3 |
+
display: block !important;
|
4 |
+
clear: both;
|
5 |
+
}
|
6 |
+
.shariff ul {
|
7 |
+
display: flex;
|
8 |
+
flex-direction: row;
|
9 |
+
flex-flow: row wrap;
|
10 |
+
padding: 0 !important;
|
11 |
+
margin: 0 !important;
|
12 |
+
}
|
13 |
+
.shariff li {
|
14 |
+
height: 35px;
|
15 |
+
box-sizing: border-box;
|
16 |
+
list-style: none !important;
|
17 |
+
overflow: hidden !important;
|
18 |
+
margin: 5px !important;
|
19 |
+
padding: 0 !important;
|
20 |
+
text-indent: 0 !important;
|
21 |
+
border-left: 0 none !important;
|
22 |
+
}
|
23 |
+
.shariff a {
|
24 |
+
position: relative;
|
25 |
+
display: block !important;
|
26 |
+
height: 35px;
|
27 |
+
padding: 0;
|
28 |
+
margin: 0;
|
29 |
+
box-sizing: border-box;
|
30 |
+
border: 0;
|
31 |
+
text-decoration: none;
|
32 |
+
background-image: none !important;
|
33 |
+
text-align: left;
|
34 |
+
}
|
35 |
+
.shariff a:hover {
|
36 |
+
color: #fff;
|
37 |
+
background-color: inherit !important;
|
38 |
+
text-decoration: none !important;
|
39 |
+
}
|
40 |
+
.shariff a:visited {
|
41 |
+
color: inherit;
|
42 |
+
}
|
43 |
+
.shariff .shariff-count {
|
44 |
+
position: absolute;
|
45 |
+
height: 33px;
|
46 |
+
top: 0;
|
47 |
+
right: 0;
|
48 |
+
margin: 1px;
|
49 |
+
padding: 0 8px;
|
50 |
+
background-color: rgba(255, 255, 255, 0.5);
|
51 |
+
}
|
52 |
+
.shariff .shariff-count,
|
53 |
+
.shariff .shariff-text {
|
54 |
+
font-family: Arial, Helvetica, sans-serif;
|
55 |
+
font-size: 12px;
|
56 |
+
line-height: 36px;
|
57 |
+
vertical-align: top;
|
58 |
+
}
|
59 |
+
.shariff .shariff-text {
|
60 |
+
padding-left: 3px;
|
61 |
+
}
|
62 |
+
.shariff .shariff-icon svg {
|
63 |
+
width: 32px;
|
64 |
+
height: 20px;
|
65 |
+
padding: 7px 1px;
|
66 |
+
box-sizing: content-box;
|
67 |
+
}
|
68 |
+
.shariff-button::before {
|
69 |
+
content: none !important;
|
70 |
+
}
|
71 |
+
/* theme default */
|
72 |
+
.shariff .theme-default a {
|
73 |
+
color: #fff !important;
|
74 |
+
}
|
75 |
+
.shariff .theme-default .shariff-icon svg path {
|
76 |
+
fill: #fff;
|
77 |
+
}
|
78 |
+
/* theme color */
|
79 |
+
.shariff .theme-color .shariff-count {
|
80 |
+
background-color: transparent !important;
|
81 |
+
color: #fff !important;
|
82 |
+
}
|
83 |
+
.shariff .theme-color .shariff-icon svg path {
|
84 |
+
fill: #fff;
|
85 |
+
}
|
86 |
+
/* theme grey */
|
87 |
+
.shariff .theme-grey a {
|
88 |
+
background-color: #b0b0b0 !important;
|
89 |
+
}
|
90 |
+
.shariff .theme-grey a:hover {
|
91 |
+
background-color: inherit !important;
|
92 |
+
}
|
93 |
+
.shariff .theme-grey .shariff-count {
|
94 |
+
background-color: transparent;
|
95 |
+
color: #fff !important;
|
96 |
+
}
|
97 |
+
.shariff .theme-grey .shariff-icon svg path {
|
98 |
+
fill: #fff;
|
99 |
+
}
|
100 |
+
/* theme white */
|
101 |
+
.shariff .theme-white a {
|
102 |
+
background-color: #fff !important;
|
103 |
+
border: 1px solid #ddd;
|
104 |
+
}
|
105 |
+
.shariff .theme-white a:hover {
|
106 |
+
background-color: #eee !important;
|
107 |
+
color: inherit;
|
108 |
+
}
|
109 |
+
.shariff .theme-white svg {
|
110 |
+
fill: currentColor;
|
111 |
+
}
|
112 |
+
.shariff .theme-white .shariff-count {
|
113 |
+
background-color: transparent;
|
114 |
+
margin: 0;
|
115 |
+
}
|
116 |
+
/* theme round */
|
117 |
+
.shariff .shariff-buttons.theme-round li {
|
118 |
+
width: 35px !important;
|
119 |
+
height: 35px;
|
120 |
+
border-radius: 50%;
|
121 |
+
margin: 5px;
|
122 |
+
}
|
123 |
+
.shariff .theme-round a {
|
124 |
+
position: relative;
|
125 |
+
height: 35px;
|
126 |
+
border-radius: 50%;
|
127 |
+
}
|
128 |
+
.shariff .theme-round .shariff-icon svg {
|
129 |
+
display: block;
|
130 |
+
margin: auto;
|
131 |
+
padding: 8px 1px;
|
132 |
+
}
|
133 |
+
.shariff .theme-round .shariff-text {
|
134 |
+
display: block;
|
135 |
+
}
|
136 |
+
.shariff .theme-round .shariff-count {
|
137 |
+
display: inline;
|
138 |
+
padding: 0;
|
139 |
+
right: 0;
|
140 |
+
left: 0;
|
141 |
+
top: 0;
|
142 |
+
background-color: transparent;
|
143 |
+
color: transparent !important;
|
144 |
+
text-align: center;
|
145 |
+
}
|
146 |
+
.shariff .theme-round .shariff-count:hover {
|
147 |
+
background-color: inherit !important;
|
148 |
+
color: #fff !important;
|
149 |
+
}
|
150 |
+
.shariff .theme-round .shariff-icon svg path {
|
151 |
+
fill: #fff;
|
152 |
+
}
|
153 |
+
/* buttonsize small */
|
154 |
+
.shariff .buttonsize-small li {
|
155 |
+
height: 25px !important;
|
156 |
+
}
|
157 |
+
.shariff .buttonsize-small a {
|
158 |
+
height: 25px !important;
|
159 |
+
}
|
160 |
+
.shariff .buttonsize-small.orientation-vertical li {
|
161 |
+
width: 115px;
|
162 |
+
}
|
163 |
+
.shariff .buttonsize-small .shariff-icon svg {
|
164 |
+
width: 22px;
|
165 |
+
height: 15px;
|
166 |
+
padding: 5px 1px;
|
167 |
+
}
|
168 |
+
.shariff .buttonsize-small .shariff-text,
|
169 |
+
.shariff .buttonsize-small .shariff-count {
|
170 |
+
font-size: 11px;
|
171 |
+
line-height: 25px;
|
172 |
+
padding: 0 5px;
|
173 |
+
height: 23px;
|
174 |
+
}
|
175 |
+
.shariff .buttonsize-small .shariff-text {
|
176 |
+
padding-left: 1px !important;
|
177 |
+
}
|
178 |
+
.shariff .buttonsize-small.theme-round li {
|
179 |
+
width: 25px !important;
|
180 |
+
}
|
181 |
+
.shariff .buttonsize-small.theme-round a {
|
182 |
+
width: 25px !important;
|
183 |
+
}
|
184 |
+
.shariff .buttonsize-small.theme-round .shariff-count {
|
185 |
+
padding: 0 !important;
|
186 |
+
height: 25px !important;
|
187 |
+
}
|
188 |
+
.shariff .theme-round.buttonsize-small.orientation-horizontal li {
|
189 |
+
margin: 5px 7px
|
190 |
+
}
|
191 |
+
.shariff .theme-round.buttonsize-small.orientation-horizontal li:first-child {
|
192 |
+
margin-left: 5px
|
193 |
+
}
|
194 |
+
.shariff .theme-round.buttonsize-small.orientation-horizontal li:last-child {
|
195 |
+
margin-right: 5px
|
196 |
+
}
|
197 |
+
/* buttonsize large */
|
198 |
+
.shariff .buttonsize-large li {
|
199 |
+
height: 45px !important;
|
200 |
+
}
|
201 |
+
.shariff .buttonsize-large a {
|
202 |
+
height: 45px !important;
|
203 |
+
}
|
204 |
+
.shariff .buttonsize-large.orientation-vertical li {
|
205 |
+
width: 155px;
|
206 |
+
}
|
207 |
+
.shariff .buttonsize-large .shariff-icon svg {
|
208 |
+
width: 40px;
|
209 |
+
height: 28px;
|
210 |
+
padding: 9px 2px;
|
211 |
+
}
|
212 |
+
.shariff .buttonsize-large .shariff-text,
|
213 |
+
.shariff .buttonsize-large .shariff-count {
|
214 |
+
font-size: 14px;
|
215 |
+
line-height: 45px;
|
216 |
+
padding: 0 10px;
|
217 |
+
height: 43px;
|
218 |
+
}
|
219 |
+
.shariff .buttonsize-large .shariff-text {
|
220 |
+
padding-left: 1px !important;
|
221 |
+
}
|
222 |
+
.shariff .buttonsize-large.theme-round li {
|
223 |
+
width: 45px !important;
|
224 |
+
}
|
225 |
+
.shariff .buttonsize-large.theme-round a {
|
226 |
+
width: 45px !important;
|
227 |
+
}
|
228 |
+
.shariff .buttonsize-large.theme-round .shariff-count {
|
229 |
+
padding: 0 !important;
|
230 |
+
height: 45px !important;
|
231 |
+
}
|
232 |
+
/* orientation vertical */
|
233 |
+
/*noinspection CssUnusedSymbol*/
|
234 |
+
.shariff .orientation-vertical {
|
235 |
+
flex-direction: column;
|
236 |
+
}
|
237 |
+
.shariff .orientation-vertical li {
|
238 |
+
width: 135px;
|
239 |
+
}
|
240 |
+
/* button alignment */
|
241 |
+
.shariff.shariff-align-flex-start ul {
|
242 |
+
justify-content: flex-start;
|
243 |
+
align-items: flex-start;
|
244 |
+
}
|
245 |
+
.shariff.shariff-align-center ul {
|
246 |
+
justify-content: center;
|
247 |
+
align-items: center;
|
248 |
+
}
|
249 |
+
.shariff.shariff-align-flex-end ul {
|
250 |
+
justify-content: flex-end;
|
251 |
+
align-items: flex-end;
|
252 |
+
}
|
253 |
+
/* button alignment widget */
|
254 |
+
.widget .shariff.shariff-widget-align-flex-start ul {
|
255 |
+
justify-content: flex-start;
|
256 |
+
align-items: flex-start;
|
257 |
+
}
|
258 |
+
.widget .shariff.shariff-widget-align-center ul {
|
259 |
+
justify-content: center;
|
260 |
+
align-items: center;
|
261 |
+
}
|
262 |
+
.widget .shariff.shariff-widget-align-flex-end ul {
|
263 |
+
justify-content: flex-end;
|
264 |
+
align-items: flex-end;
|
265 |
+
}
|
266 |
+
/* button stretch */
|
267 |
+
.shariff.shariff-buttonstretch li {
|
268 |
+
flex: 1 0 auto !important;
|
269 |
+
}
|
270 |
+
.shariff.shariff-buttonstretch .orientation-vertical li {
|
271 |
+
width: 100% !important;
|
272 |
+
}
|
273 |
+
/* widget */
|
274 |
+
.widget .shariff .theme-default li,
|
275 |
+
.widget .shariff .theme-color li,
|
276 |
+
.widget .shariff .theme-grey li,
|
277 |
+
.widget .shariff .theme-round li {
|
278 |
+
border: medium none;
|
279 |
+
font-weight: 400;
|
280 |
+
}
|
281 |
+
.widget .shariff .theme-default a,
|
282 |
+
.widget .shariff .theme-color a,
|
283 |
+
.widget .shariff .theme-grey a,
|
284 |
+
.widget .shariff .theme-round a {
|
285 |
+
color: #fff;
|
286 |
+
display: block;
|
287 |
+
font-weight: 400;
|
288 |
+
}
|
289 |
+
.widget .shariff .theme-default a:hover,
|
290 |
+
.widget .shariff .theme-color a:hover,
|
291 |
+
.widget .shariff .theme-grey a:hover,
|
292 |
+
.widget .shariff .theme-round a:hover {
|
293 |
+
color: #fff;
|
294 |
+
font-weight: 400;
|
295 |
+
}
|
296 |
+
/* missing usernames warning */
|
297 |
+
.shariff-warning {
|
298 |
+
background-color: red;
|
299 |
+
color: #fff;
|
300 |
+
font-size: 20px;
|
301 |
+
font-weight: 700;
|
302 |
+
padding: 10px;
|
303 |
+
text-align: center;
|
304 |
+
margin: 0 auto;
|
305 |
+
line-height: 1.5;
|
306 |
+
}
|
307 |
+
/* info button */
|
308 |
+
.shariff .info a {
|
309 |
+
border: 1px solid #ddd;
|
310 |
+
width: 35px;
|
311 |
+
}
|
312 |
+
.shariff .shariff-button.info {
|
313 |
+
width: 35px;
|
314 |
+
flex: 0 0 auto !important;
|
315 |
+
}
|
316 |
+
.shariff .theme-default .shariff-button.shariff-nocustomcolor.info svg path {
|
317 |
+
fill: #999;
|
318 |
+
}
|
319 |
+
.shariff .theme-round .shariff-button.shariff-nocustomcolor.info svg path {
|
320 |
+
fill: #999;
|
321 |
+
}
|
322 |
+
.shariff .buttonsize-small .shariff-button.info {
|
323 |
+
width: 25px;
|
324 |
+
}
|
325 |
+
.shariff .buttonsize-small .info a {
|
326 |
+
width: 25px;
|
327 |
+
}
|
328 |
+
.shariff .buttonsize-large .shariff-button.info {
|
329 |
+
width: 45px;
|
330 |
+
}
|
331 |
+
.shariff .buttonsize-large .info a {
|
332 |
+
width: 45px;
|
333 |
+
}
|
334 |
+
.shariff .info .shariff-icon svg {
|
335 |
+
display: block;
|
336 |
+
margin: auto;
|
337 |
+
}
|
338 |
+
/* media queries */
|
339 |
+
@media only screen and (max-width: 360px) {
|
340 |
+
.shariff .orientation-horizontal li { width: 35px; }
|
341 |
+
.shariff .orientation-horizontal.buttonsize-small li { width: 25px; }
|
342 |
+
.shariff .orientation-horizontal.buttonsize-large li { width: 45px; }
|
343 |
+
.shariff .orientation-horizontal .shariff-icon svg { display: block; margin: auto; }
|
344 |
+
.shariff .orientation-horizontal .shariff-count { display: none; }
|
345 |
+
}
|
346 |
+
@media only screen and (min-width: 361px) {
|
347 |
+
.shariff .orientation-horizontal li { width: 80px; }
|
348 |
+
.shariff .orientation-horizontal li .shariff-text { display: block; }
|
349 |
+
.shariff .orientation-horizontal li .shariff-count { display: block; }
|
350 |
+
}
|
351 |
+
@media only screen and (min-width: 768px) {
|
352 |
+
.shariff .orientation-horizontal li { width: 130px; }
|
353 |
+
.shariff .orientation-horizontal.buttonsize-small li { width: 105px; }
|
354 |
+
.shariff .orientation-horizontal.buttonsize-large li { width: 155px; }
|
355 |
+
.shariff .orientation-horizontal li .shariff-text { display: inline; }
|
356 |
+
}
|
357 |
+
@media only screen and (min-device-width: 1025px) {
|
358 |
+
/*noinspection CssUnusedSymbol*/
|
359 |
+
.shariff .shariff-mobile { display: none !important; }
|
360 |
+
}
|
css/shariff.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.shariff
|
1 |
+
.shariff{display:block !important;clear:both}.shariff ul{display:flex;flex-direction:row;flex-flow:row wrap;padding:0 !important;margin:0 !important}.shariff li{height:35px;box-sizing:border-box;list-style:none !important;overflow:hidden !important;margin:5px !important;padding:0 !important;text-indent:0 !important;border-left:0 none !important}.shariff a{position:relative;display:block !important;height:35px;padding:0;margin:0;box-sizing:border-box;border:0;text-decoration:none;background-image:none !important;text-align:left}.shariff a:hover{color:#fff;background-color:inherit !important;text-decoration:none !important}.shariff a:visited{color:inherit}.shariff .shariff-count{position:absolute;height:33px;top:0;right:0;margin:1px;padding:0 8px;background-color:rgba(255,255,255,0.5)}.shariff .shariff-count,.shariff .shariff-text{font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:36px;vertical-align:top}.shariff .shariff-text{padding-left:3px}.shariff .shariff-icon svg{width:32px;height:20px;padding:7px 1px;box-sizing:content-box}.shariff-button::before{content:none !important}.shariff .theme-default a{color:#fff !important}.shariff .theme-default .shariff-icon svg path{fill:#fff}.shariff .theme-color .shariff-count{background-color:transparent !important;color:#fff !important}.shariff .theme-color .shariff-icon svg path{fill:#fff}.shariff .theme-grey a{background-color:#b0b0b0 !important}.shariff .theme-grey a:hover{background-color:inherit !important}.shariff .theme-grey .shariff-count{background-color:transparent;color:#fff !important}.shariff .theme-grey .shariff-icon svg path{fill:#fff}.shariff .theme-white a{background-color:#fff !important;border:1px solid #ddd}.shariff .theme-white a:hover{background-color:#eee !important;color:inherit}.shariff .theme-white svg{fill:currentColor}.shariff .theme-white .shariff-count{background-color:transparent;margin:0}.shariff .shariff-buttons.theme-round li{width:35px !important;height:35px;border-radius:50%;margin:5px}.shariff .theme-round a{position:relative;height:35px;border-radius:50%}.shariff .theme-round .shariff-icon svg{display:block;margin:auto;padding:8px 1px}.shariff .theme-round .shariff-text{display:block}.shariff .theme-round .shariff-count{display:inline;padding:0;right:0;left:0;top:0;background-color:transparent;color:transparent !important;text-align:center}.shariff .theme-round .shariff-count:hover{background-color:inherit !important;color:#fff !important}.shariff .theme-round .shariff-icon svg path{fill:#fff}.shariff .buttonsize-small li{height:25px !important}.shariff .buttonsize-small a{height:25px !important}.shariff .buttonsize-small.orientation-vertical li{width:115px}.shariff .buttonsize-small .shariff-icon svg{width:22px;height:15px;padding:5px 1px}.shariff .buttonsize-small .shariff-text,.shariff .buttonsize-small .shariff-count{font-size:11px;line-height:25px;padding:0 5px;height:23px}.shariff .buttonsize-small .shariff-text{padding-left:1px !important}.shariff .buttonsize-small.theme-round li{width:25px !important}.shariff .buttonsize-small.theme-round a{width:25px !important}.shariff .buttonsize-small.theme-round .shariff-count{padding:0 !important;height:25px !important}.shariff .theme-round.buttonsize-small.orientation-horizontal li{margin:5px 7px}.shariff .theme-round.buttonsize-small.orientation-horizontal li:first-child{margin-left:5px}.shariff .theme-round.buttonsize-small.orientation-horizontal li:last-child{margin-right:5px}.shariff .buttonsize-large li{height:45px !important}.shariff .buttonsize-large a{height:45px !important}.shariff .buttonsize-large.orientation-vertical li{width:155px}.shariff .buttonsize-large .shariff-icon svg{width:40px;height:28px;padding:9px 2px}.shariff .buttonsize-large .shariff-text,.shariff .buttonsize-large .shariff-count{font-size:14px;line-height:45px;padding:0 10px;height:43px}.shariff .buttonsize-large .shariff-text{padding-left:1px !important}.shariff .buttonsize-large.theme-round li{width:45px !important}.shariff .buttonsize-large.theme-round a{width:45px !important}.shariff .buttonsize-large.theme-round .shariff-count{padding:0 !important;height:45px !important}.shariff .orientation-vertical{flex-direction:column}.shariff .orientation-vertical li{width:135px}.shariff.shariff-align-flex-start ul{justify-content:flex-start;align-items:flex-start}.shariff.shariff-align-center ul{justify-content:center;align-items:center}.shariff.shariff-align-flex-end ul{justify-content:flex-end;align-items:flex-end}.widget .shariff.shariff-widget-align-flex-start ul{justify-content:flex-start;align-items:flex-start}.widget .shariff.shariff-widget-align-center ul{justify-content:center;align-items:center}.widget .shariff.shariff-widget-align-flex-end ul{justify-content:flex-end;align-items:flex-end}.shariff.shariff-buttonstretch li{flex:1 0 auto !important}.shariff.shariff-buttonstretch .orientation-vertical li{width:100% !important}.widget .shariff .theme-default li,.widget .shariff .theme-color li,.widget .shariff .theme-grey li,.widget .shariff .theme-round li{border:medium none;font-weight:400}.widget .shariff .theme-default a,.widget .shariff .theme-color a,.widget .shariff .theme-grey a,.widget .shariff .theme-round a{color:#fff;display:block;font-weight:400}.widget .shariff .theme-default a:hover,.widget .shariff .theme-color a:hover,.widget .shariff .theme-grey a:hover,.widget .shariff .theme-round a:hover{color:#fff;font-weight:400}.shariff-warning{background-color:red;color:#fff;font-size:20px;font-weight:700;padding:10px;text-align:center;margin:0 auto;line-height:1.5}.shariff .info a{border:1px solid #ddd;width:35px}.shariff .shariff-button.info{width:35px;flex:0 0 auto !important}.shariff .theme-default .shariff-button.shariff-nocustomcolor.info svg path{fill:#999}.shariff .theme-round .shariff-button.shariff-nocustomcolor.info svg path{fill:#999}.shariff .buttonsize-small .shariff-button.info{width:25px}.shariff .buttonsize-small .info a{width:25px}.shariff .buttonsize-large .shariff-button.info{width:45px}.shariff .buttonsize-large .info a{width:45px}.shariff .info .shariff-icon svg{display:block;margin:auto}@media only screen and (max-width:360px){.shariff .orientation-horizontal li{width:35px}.shariff .orientation-horizontal.buttonsize-small li{width:25px}.shariff .orientation-horizontal.buttonsize-large li{width:45px}.shariff .orientation-horizontal .shariff-icon svg{display:block;margin:auto}.shariff .orientation-horizontal .shariff-count{display:none}}@media only screen and (min-width:361px){.shariff .orientation-horizontal li{width:80px}.shariff .orientation-horizontal li .shariff-text{display:block}.shariff .orientation-horizontal li .shariff-count{display:block}}@media only screen and (min-width:768px){.shariff .orientation-horizontal li{width:130px}.shariff .orientation-horizontal.buttonsize-small li{width:105px}.shariff .orientation-horizontal.buttonsize-large li{width:155px}.shariff .orientation-horizontal li .shariff-text{display:inline}}@media only screen and (min-device-width:1025px){.shariff .shariff-mobile{display:none !important}}
|
{pictos → images}/borderradius.png
RENAMED
File without changes
|
{pictos → images}/colorBtns.png
RENAMED
File without changes
|
{pictos → images}/defaultBtns.png
RENAMED
File without changes
|
{pictos → images}/defaultHint.png
RENAMED
File without changes
|
{pictos → images}/greyBtns.png
RENAMED
File without changes
|
{pictos → images}/roundBtns.png
RENAMED
File without changes
|
{pictos → images}/whiteBtns.png
RENAMED
File without changes
|
includes/class-shariff-widget.php
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class ShariffWidget
|
10 |
+
*/
|
11 |
+
class Shariff_Widget extends WP_Widget {
|
12 |
+
/**
|
13 |
+
* Registers the widget with the WordPress Widget API.
|
14 |
+
*/
|
15 |
+
public static function register() {
|
16 |
+
register_widget( __CLASS__ );
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Shariff_Widget constructor.
|
21 |
+
*/
|
22 |
+
public function __construct() {
|
23 |
+
// Add translations.
|
24 |
+
if ( function_exists( 'load_plugin_textdomain' ) ) {
|
25 |
+
load_plugin_textdomain( 'shariff' );
|
26 |
+
}
|
27 |
+
|
28 |
+
$widget_options = array(
|
29 |
+
'classname' => 'Shariff',
|
30 |
+
'description' => __( 'Add Shariff as configured on the plugin options page.', 'shariff' ),
|
31 |
+
'customize_selective_refresh' => true,
|
32 |
+
);
|
33 |
+
|
34 |
+
$control_options = array();
|
35 |
+
parent::__construct( 'Shariff', 'Shariff', $widget_options, $control_options );
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Create the actual form.
|
40 |
+
*
|
41 |
+
* @param array $instance Current instance.
|
42 |
+
*
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function form( $instance ) {
|
46 |
+
// Set widgets defaults.
|
47 |
+
$instance = wp_parse_args( (array) $instance, array(
|
48 |
+
'shariff-title' => '',
|
49 |
+
'shariff-tag' => '[shariff]',
|
50 |
+
));
|
51 |
+
// Sets the title.
|
52 |
+
echo '<p style="border-bottom: 1px solid #DFDFDF;"><strong>' . esc_html__( 'Title', 'shariff' ) . '</strong></p>';
|
53 |
+
// Set the title.
|
54 |
+
echo '<p><input id="' . esc_html( $this->get_field_id( 'shariff-title' ) ) . '" name="' . esc_html( $this->get_field_name( 'shariff-title' ) ) . '" type="text" size="45" value="' . esc_html( $instance['shariff-title'] ) . '" /> ' . esc_html__( '(optional)', 'shariff' ) . '</p>';
|
55 |
+
// Sets the shorttag.
|
56 |
+
echo '<p style="border-bottom: 1px solid #DFDFDF;"><strong>Shorttag</strong></p>';
|
57 |
+
// Sets the shorttag.
|
58 |
+
echo '<p><input id="' . esc_html( $this->get_field_id( 'shariff-tag' ) ) . '" name="' . esc_html( $this->get_field_name( 'shariff-tag' ) ) . '" type="text" value=\'' . esc_html( str_replace( '\'', '"', $instance['shariff-tag'] ) ) . '\' size="45" /> ' . esc_html__( '(optional)', 'shariff' ) . '</p>';
|
59 |
+
echo '<p style="clear:both;"></p>';
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Saves the widget configuration.
|
64 |
+
*
|
65 |
+
* @param array $new_instance The new instance.
|
66 |
+
* @param array $old_instance The old instance.
|
67 |
+
*
|
68 |
+
* @return array The updated instance.
|
69 |
+
*/
|
70 |
+
public function update( $new_instance, $old_instance ) {
|
71 |
+
$instance = $old_instance;
|
72 |
+
|
73 |
+
// Sets the widget conf defaults.
|
74 |
+
$new_instance = wp_parse_args( (array) $new_instance, array(
|
75 |
+
'shariff-title' => '',
|
76 |
+
'shariff-tag' => '[shariff]',
|
77 |
+
));
|
78 |
+
|
79 |
+
// Checks the input values.
|
80 |
+
$instance['shariff-title'] = (string) strip_tags( $new_instance['shariff-title'] );
|
81 |
+
$instance['shariff-tag'] = (string) wp_kses( $new_instance['shariff-tag'], $GLOBALS['allowed_tags'] );
|
82 |
+
|
83 |
+
// Saves the config.
|
84 |
+
return $instance;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Draws the widget.
|
89 |
+
*
|
90 |
+
* @param array $args Provided arguments.
|
91 |
+
* @param array $instance The current instance.
|
92 |
+
*/
|
93 |
+
public function widget( $args, $instance ) {
|
94 |
+
// Get options.
|
95 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
96 |
+
|
97 |
+
// Creates the container.
|
98 |
+
// @codingStandardsIgnoreStart
|
99 |
+
echo $args['before_widget'];
|
100 |
+
// @codingStandardsIgnoreEnd
|
101 |
+
|
102 |
+
// Prints the title of the widget, if provided.
|
103 |
+
if ( empty( $instance['shariff-title'] ) ) {
|
104 |
+
$title = '';
|
105 |
+
} else {
|
106 |
+
apply_filters( 'shariff_title', $instance['shariff-title'] );
|
107 |
+
$title = $instance['shariff-title'];
|
108 |
+
}
|
109 |
+
if ( ! empty( $title ) ) {
|
110 |
+
echo wp_kses( $args['before_title'] . $title . $args['after_title'], $GLOBALS['allowed_tags'] );
|
111 |
+
}
|
112 |
+
|
113 |
+
// Print the shorttag, but keep the original shorttag for further reference.
|
114 |
+
$original_shorttag = $instance['shariff-tag'];
|
115 |
+
|
116 |
+
// If nothing is configured, uses the global options from admin menu.
|
117 |
+
if ( '[shariff]' === $instance['shariff-tag'] ) {
|
118 |
+
$shorttag = '[shariff]';
|
119 |
+
} else {
|
120 |
+
$shorttag = $instance['shariff-tag'];
|
121 |
+
}
|
122 |
+
|
123 |
+
// Sets the url to the current page to prevent sharing the first or last post on pages with multiple posts.
|
124 |
+
// For example the blog page. Of course only if no manual url is provided in the shorttag.
|
125 |
+
$page_url = '';
|
126 |
+
if ( strpos( $original_shorttag, ' url=' ) === false ) {
|
127 |
+
$wpurl = get_bloginfo( 'wpurl' );
|
128 |
+
$wpurl = str_replace( wp_make_link_relative( $wpurl ), '', $wpurl );
|
129 |
+
if ( isset( $_SERVER['REQUEST_URI'] ) ) {
|
130 |
+
$page_url = ' url="' . $wpurl . esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '"';
|
131 |
+
} else {
|
132 |
+
global $wp;
|
133 |
+
$page_url = ' url="' . home_url( add_query_arg( array(), $wp->request ) ) . '"';
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
// Same for title.
|
138 |
+
$page_title = '';
|
139 |
+
$wp_title = '';
|
140 |
+
if ( strpos( $original_shorttag, 'title=' ) === false ) {
|
141 |
+
$wp_title = wp_get_document_title();
|
142 |
+
// wp_title for all pages that have it.
|
143 |
+
if ( ! empty( $wp_title ) ) {
|
144 |
+
$page_title = $wp_title;
|
145 |
+
} else {
|
146 |
+
$page_title = get_bloginfo( 'name' );
|
147 |
+
}
|
148 |
+
// Replace brackets [ and ] with ( and ).
|
149 |
+
$page_title = str_replace( '[', '(', $page_title );
|
150 |
+
$page_title = str_replace( ']', ')', $page_title );
|
151 |
+
$page_title = ' title="' . $page_title . '"';
|
152 |
+
}
|
153 |
+
|
154 |
+
// Same for media.
|
155 |
+
$media = '';
|
156 |
+
if ( array_key_exists( 'services', $shariff3uu ) && strstr( $shariff3uu['services'], 'pinterest' ) && ( strpos( $original_shorttag, 'media=' ) === false ) ) {
|
157 |
+
if ( isset( $shariff3uu['default_pinterest'] ) ) {
|
158 |
+
$media = ' media="' . $shariff3uu['default_pinterest'] . '"';
|
159 |
+
} else {
|
160 |
+
$media = ' media="' . plugins_url( '/images/defaultHint.png', __FILE__ ) . '"';
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
// Builds the shorttag and adds the url, title and media if necessary as well as the widget attribute.
|
165 |
+
$shorttag = substr( $shorttag, 0, -1 ) . $page_title . $page_url . $media . ' widget="1"]';
|
166 |
+
|
167 |
+
// Processes the shortcode if it is not password protected or "disable on password protected posts" is not set.
|
168 |
+
if ( 1 !== post_password_required( get_the_ID() ) || ( isset( $shariff3uu['disable_on_protected'] ) && 1 !== $shariff3uu['disable_on_protected'] ) ) {
|
169 |
+
echo do_shortcode( $shorttag );
|
170 |
+
}
|
171 |
+
|
172 |
+
// Closes the Container.
|
173 |
+
// @codingStandardsIgnoreStart
|
174 |
+
echo $args['after_widget'];
|
175 |
+
// @codingStandardsIgnoreEnd
|
176 |
+
} // End of widget.
|
177 |
+
} // End of class ShariffWidget.
|
178 |
+
add_action( 'widgets_init', array( 'Shariff_Widget', 'register' ) );
|
phpqrcode.php → includes/phpqrcode.php
RENAMED
@@ -165,7 +165,7 @@
|
|
165 |
foreach ($frame as &$frameLine) {
|
166 |
|
167 |
for($i=0; $i<$len; $i++) {
|
168 |
-
$frameLine[$i] = (ord($frameLine[$i])&1)?
|
169 |
}
|
170 |
}
|
171 |
|
@@ -196,7 +196,7 @@
|
|
196 |
foreach ($qrTab as $line) {
|
197 |
$arrAdd = array();
|
198 |
foreach(str_split($line) as $char)
|
199 |
-
$arrAdd[] = ($char==
|
200 |
$barcode_array['bcode'][] = $arrAdd;
|
201 |
}
|
202 |
|
@@ -817,7 +817,7 @@
|
|
817 |
|
818 |
foreach ($frame as &$frameLine) {
|
819 |
$frameLine = join('<span class="m"> </span>', explode('0', $frameLine));
|
820 |
-
$frameLine = join('██', explode(
|
821 |
}
|
822 |
|
823 |
?>
|
@@ -1017,7 +1017,7 @@
|
|
1017 |
|
1018 |
for($y=0; $y<$h; $y++) {
|
1019 |
for($x=0; $x<$w; $x++) {
|
1020 |
-
if ($frame[$y][$x] ==
|
1021 |
ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]);
|
1022 |
}
|
1023 |
}
|
@@ -3269,7 +3269,7 @@
|
|
3269 |
|
3270 |
switch ($level.'') {
|
3271 |
case '0':
|
3272 |
-
case
|
3273 |
case '2':
|
3274 |
case '3':
|
3275 |
$enc->level = $level;
|
@@ -3533,7 +3533,7 @@
|
|
3533 |
|
3534 |
for($i=0; $i<$h; $i++) {
|
3535 |
for($j=0; $j<$w; $j++) {
|
3536 |
-
if( $frame[$i][$j] ==
|
3537 |
$y = $h - 1 - $i;
|
3538 |
$x = $j;
|
3539 |
$output .= $x.' '.$y.' 1 1 F'."\n";
|
@@ -3607,7 +3607,7 @@
|
|
3607 |
|
3608 |
for($i=0; $i<$h; $i++) {
|
3609 |
for($j=0; $j<$w; $j++) {
|
3610 |
-
if( $frame[$i][$j] ==
|
3611 |
$y = ($i + $outerFrame) * $pixelPerPoint;
|
3612 |
$x = ($j + $outerFrame) * $pixelPerPoint;
|
3613 |
$output .= '<use x="'.$x.'" y="'.$y.'" xlink:href="#p" />'."\n";
|
165 |
foreach ($frame as &$frameLine) {
|
166 |
|
167 |
for($i=0; $i<$len; $i++) {
|
168 |
+
$frameLine[$i] = (ord($frameLine[$i])&1)?1:'0';
|
169 |
}
|
170 |
}
|
171 |
|
196 |
foreach ($qrTab as $line) {
|
197 |
$arrAdd = array();
|
198 |
foreach(str_split($line) as $char)
|
199 |
+
$arrAdd[] = ($char==1)?1:0;
|
200 |
$barcode_array['bcode'][] = $arrAdd;
|
201 |
}
|
202 |
|
817 |
|
818 |
foreach ($frame as &$frameLine) {
|
819 |
$frameLine = join('<span class="m"> </span>', explode('0', $frameLine));
|
820 |
+
$frameLine = join('██', explode(1, $frameLine));
|
821 |
}
|
822 |
|
823 |
?>
|
1017 |
|
1018 |
for($y=0; $y<$h; $y++) {
|
1019 |
for($x=0; $x<$w; $x++) {
|
1020 |
+
if ($frame[$y][$x] == 1) {
|
1021 |
ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]);
|
1022 |
}
|
1023 |
}
|
3269 |
|
3270 |
switch ($level.'') {
|
3271 |
case '0':
|
3272 |
+
case 1:
|
3273 |
case '2':
|
3274 |
case '3':
|
3275 |
$enc->level = $level;
|
3533 |
|
3534 |
for($i=0; $i<$h; $i++) {
|
3535 |
for($j=0; $j<$w; $j++) {
|
3536 |
+
if( $frame[$i][$j] == 1) {
|
3537 |
$y = $h - 1 - $i;
|
3538 |
$x = $j;
|
3539 |
$output .= $x.' '.$y.' 1 1 F'."\n";
|
3607 |
|
3608 |
for($i=0; $i<$h; $i++) {
|
3609 |
for($j=0; $j<$w; $j++) {
|
3610 |
+
if( $frame[$i][$j] == 1) {
|
3611 |
$y = ($i + $outerFrame) * $pixelPerPoint;
|
3612 |
$x = ($j + $outerFrame) * $pixelPerPoint;
|
3613 |
$output .= '<use x="'.$x.'" y="'.$y.'" xlink:href="#p" />'."\n";
|
js/shariff-media.js
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
// shariff media upload
|
2 |
-
jQuery(document).ready(function($){
|
3 |
-
$("#shariff-upload-btn").click(function(e) {
|
4 |
-
e.preventDefault();
|
5 |
-
var image = wp.media({
|
6 |
-
title: shariff_media.choose_image,
|
7 |
-
multiple: false
|
8 |
-
}).open()
|
9 |
-
.on("select", function(
|
10 |
-
// this will return the selected image from the media uploader, the result is an object
|
11 |
-
var uploaded_image = image.state().get("selection").first();
|
12 |
-
// output to the console uploaded_image
|
13 |
-
console.log(uploaded_image);
|
14 |
-
// convert uploaded_image to a JSON object to make accessing it easier
|
15 |
-
var image_url = uploaded_image.toJSON().url;
|
16 |
-
// assign the url value to the input field
|
17 |
-
$("#shariff-image-url").val(image_url);
|
18 |
-
});
|
19 |
-
});
|
20 |
-
});
|
1 |
+
// shariff media upload
|
2 |
+
jQuery(document).ready(function($){
|
3 |
+
$("#shariff-upload-btn").click(function(e) {
|
4 |
+
e.preventDefault();
|
5 |
+
var image = wp.media({
|
6 |
+
title: shariff_media.choose_image,
|
7 |
+
multiple: false
|
8 |
+
}).open()
|
9 |
+
.on("select", function(){
|
10 |
+
// this will return the selected image from the media uploader, the result is an object
|
11 |
+
var uploaded_image = image.state().get("selection").first();
|
12 |
+
// output to the console uploaded_image
|
13 |
+
console.log(uploaded_image);
|
14 |
+
// convert uploaded_image to a JSON object to make accessing it easier
|
15 |
+
var image_url = uploaded_image.toJSON().url;
|
16 |
+
// assign the url value to the input field
|
17 |
+
$("#shariff-image-url").val(image_url);
|
18 |
+
});
|
19 |
+
});
|
20 |
+
});
|
js/shariff-media.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(document).ready(function(a){a("#shariff-upload-btn").click(function(c){c.preventDefault();var b=wp.media({title:shariff_media.choose_image,multiple:false}).open().on("select",function(){var d=b.state().get("selection").first();console.log(d);var e=d.toJSON().url;a("#shariff-image-url").val(e)})})});
|
js/shariff-notice.js
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
jQuery(document).on( 'click', '.shariff-update-notice .notice-dismiss', function() {
|
2 |
-
jQuery.ajax({
|
3 |
-
url: ajaxurl,
|
4 |
-
data: {
|
5 |
-
action: 'shariffdismiss'
|
6 |
-
}
|
7 |
-
})
|
8 |
-
|
9 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/shariff-popup.js
CHANGED
@@ -1,30 +1,29 @@
|
|
1 |
-
//
|
2 |
-
function shariff_click() {
|
3 |
-
// enabled strict mode
|
4 |
-
"use strict";
|
5 |
-
// get elements
|
6 |
-
var classname = document.getElementsByClassName(
|
7 |
-
// set all event listeners
|
8 |
-
for ( var i = 0; i < classname.length; i++ ) {
|
9 |
-
classname[i].addEventListener('click', shariff_popup, false);
|
10 |
-
}
|
11 |
-
}
|
12 |
-
// actual popup function
|
13 |
-
function shariff_popup( evt ) {
|
14 |
-
// set variables
|
15 |
-
var t = this.getAttribute('href');
|
16 |
-
var o = screen.width/2-350;
|
17 |
-
var r = screen.height/2-250;
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
document.addEventListener( "DOMContentLoaded", shariff_click, false );
|
1 |
+
// add click listener function
|
2 |
+
function shariff_click() {
|
3 |
+
// enabled strict mode
|
4 |
+
"use strict";
|
5 |
+
// get elements
|
6 |
+
var classname = document.getElementsByClassName( 'shariff-link' );
|
7 |
+
// set all event listeners
|
8 |
+
for ( var i = 0; i < classname.length; i++ ) {
|
9 |
+
classname[i].addEventListener( 'click', shariff_popup, false );
|
10 |
+
}
|
11 |
+
}
|
12 |
+
// actual popup function
|
13 |
+
function shariff_popup( evt ) {
|
14 |
+
// set variables
|
15 |
+
var t = this.getAttribute( 'href' );
|
16 |
+
var o = screen.width/2-350;
|
17 |
+
var r = screen.height/2-250;
|
18 |
+
// open popup if not one of the special services
|
19 |
+
if ( t.substring( 0, 7 ) !== 'mailto:' && t.substring( 0, 9 ) !== "whatsapp:" && t !== 'javascript:window.print()' && t !== 'http://ct.de/-2467514' ) {
|
20 |
+
// prevent default action
|
21 |
+
evt.preventDefault();
|
22 |
+
// open popup
|
23 |
+
window.open( t,"_blank","height=500, width=700, status=yes, toolbar=no, menubar=no, location=no, top="+r+", left="+o );
|
24 |
+
// return false to prevent tab opening in some browsers
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
// add event listener to call shariff popup function after DOM
|
29 |
+
document.addEventListener( 'DOMContentLoaded', shariff_click, false );
|
|
js/shariff-popup.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function shariff_click(){
|
1 |
+
function shariff_click(){var b=document.getElementsByClassName("shariff-link");for(var a=0;a<b.length;a++){b[a].addEventListener("click",shariff_popup,false)}}function shariff_popup(a){var b=this.getAttribute("href");var d=screen.width/2-350;var c=screen.height/2-250;if(b.substring(0,7)!=="mailto:"&&b.substring(0,9)!=="whatsapp:"&&b!=="javascript:window.print()"&&b!=="http://ct.de/-2467514"){a.preventDefault();window.open(b,"_blank","height=500, width=700, status=yes, toolbar=no, menubar=no, location=no, top="+c+", left="+d);return false}}document.addEventListener("DOMContentLoaded",shariff_click,false);
|
js/shariff.js
CHANGED
@@ -1,100 +1,100 @@
|
|
1 |
-
// main shariff function
|
2 |
-
function shariff_share_counts() {
|
3 |
-
// enabled strict mode
|
4 |
-
"use strict";
|
5 |
-
// get all shariff containers
|
6 |
-
var containers = document.getElementsByClassName("shariff");
|
7 |
-
// init request object
|
8 |
-
var requests = {};
|
9 |
-
// loop through all containers, create each request url and add all to request array
|
10 |
-
for ( var c = 0; containers[c]; c++ ) {
|
11 |
-
var share_url = containers[c].dataset.url;
|
12 |
-
var services = containers[c].dataset.services;
|
13 |
-
var timestamp = containers[c].dataset.timestamp;
|
14 |
-
// check if an external share count api is set
|
15 |
-
var api = containers[c].dataset.backendurl;
|
16 |
-
if ( typeof api === "undefined" ) {
|
17 |
-
api = '/wp-json/shariff/v1/share_counts?';
|
18 |
-
}
|
19 |
-
// build request url
|
20 |
-
var request_url = api + 'url=' + share_url + '&services=' + services + '×tamp=' + timestamp;
|
21 |
-
// check if we have backend services at all
|
22 |
-
if ( typeof services !== "undefined" ) {
|
23 |
-
// check if the url is already in requests to avoid duplicated requests
|
24 |
-
if ( requests[ share_url ] ) {
|
25 |
-
// add additional services to services
|
26 |
-
services = requests[ share_url ][ 1 ] + '|' + services;
|
27 |
-
// remove duplicates
|
28 |
-
var service_array = services.split("|");
|
29 |
-
service_array = service_array.filter( function( elem, pos, arr ) {
|
30 |
-
return arr.indexOf( elem )
|
31 |
-
});
|
32 |
-
services = service_array.join('|');
|
33 |
-
// update request url
|
34 |
-
request_url = api + 'url=' + share_url + '&services=' + services + '×tamp=' + timestamp;
|
35 |
-
// add to requests
|
36 |
-
requests[ share_url ] = [ share_url, services, timestamp, request_url ];
|
37 |
-
}
|
38 |
-
else {
|
39 |
-
requests[ share_url ] = [ share_url, services, timestamp, request_url ];
|
40 |
-
}
|
41 |
-
}
|
42 |
-
}
|
43 |
-
// get share counts
|
44 |
-
for ( var request in requests ) {
|
45 |
-
if ( requests.hasOwnProperty( request ) ) {
|
46 |
-
shariff_get_share_counts( requests[ request ][ 0 ], requests[ request ][ 3 ], containers );
|
47 |
-
}
|
48 |
-
}
|
49 |
-
}
|
50 |
-
// get share counts
|
51 |
-
function shariff_get_share_counts( share_url, request_url, containers ) {
|
52 |
-
// new XMLHttpRequest
|
53 |
-
var request = new XMLHttpRequest();
|
54 |
-
// load asynchronously
|
55 |
-
request.open( 'GET', request_url, true );
|
56 |
-
// actions after answer
|
57 |
-
request.onload = function() {
|
58 |
-
// check if successful
|
59 |
-
if ( request.status >= 200 && request.status < 400 ) {
|
60 |
-
// add to buttons
|
61 |
-
shariff_add_share_counts( share_url, JSON.parse( request.responseText ), containers );
|
62 |
-
}
|
63 |
-
};
|
64 |
-
// start request
|
65 |
-
request.send();
|
66 |
-
}
|
67 |
-
// add share counts
|
68 |
-
function shariff_add_share_counts( share_url, data, containers ) {
|
69 |
-
// add share counts to buttons
|
70 |
-
for ( var d = 0; containers[d]; d++ ) {
|
71 |
-
// check if it is the corresponding button set
|
72 |
-
if ( containers[d].dataset.url
|
73 |
-
// update total in total number spans
|
74 |
-
var shariff_totalnumber = containers[d].getElementsByClassName("shariff-totalnumber");
|
75 |
-
for ( var n = 0; shariff_totalnumber[n]; n++ ) {
|
76 |
-
if ( data !== null && typeof data.total !== 'undefined' ) {
|
77 |
-
shariff_totalnumber[n].innerHTML = data.total;
|
78 |
-
}
|
79 |
-
}
|
80 |
-
// update total in shariff headline
|
81 |
-
var shariff_total = containers[d].getElementsByClassName("shariff-total");
|
82 |
-
for ( var t = 0; shariff_total[t]; t++ ) {
|
83 |
-
if ( data !== null && typeof data.total !== 'undefined' ) {
|
84 |
-
shariff_total[t].innerHTML = data.total;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
// loop through all button in this container
|
88 |
-
var shariff_count = containers[d].getElementsByClassName("shariff-count");
|
89 |
-
for ( var s = 0; shariff_count[s]; s++ ) {
|
90 |
-
// add share count, if we have one, and make it visible
|
91 |
-
if ( data !== null && typeof data[shariff_count[s].dataset.service] !== 'undefined' && ( typeof containers[d].dataset.hidezero === 'undefined' || ( containers[d].dataset.hidezero
|
92 |
-
shariff_count[s].innerHTML = data[shariff_count[s].dataset.service];
|
93 |
-
shariff_count[s].style.opacity =
|
94 |
-
}
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
}
|
99 |
-
// add event listener to call main shariff function after DOM
|
100 |
-
document.addEventListener(
|
1 |
+
// main shariff function
|
2 |
+
function shariff_share_counts() {
|
3 |
+
// enabled strict mode
|
4 |
+
"use strict";
|
5 |
+
// get all shariff containers
|
6 |
+
var containers = document.getElementsByClassName("shariff");
|
7 |
+
// init request object
|
8 |
+
var requests = {};
|
9 |
+
// loop through all containers, create each request url and add all to request array
|
10 |
+
for ( var c = 0; containers[c]; c++ ) {
|
11 |
+
var share_url = containers[c].dataset.url;
|
12 |
+
var services = containers[c].dataset.services;
|
13 |
+
var timestamp = containers[c].dataset.timestamp;
|
14 |
+
// check if an external share count api is set
|
15 |
+
var api = containers[c].dataset.backendurl;
|
16 |
+
if ( typeof api === "undefined" ) {
|
17 |
+
api = '/wp-json/shariff/v1/share_counts?';
|
18 |
+
}
|
19 |
+
// build request url
|
20 |
+
var request_url = api + 'url=' + share_url + '&services=' + services + '×tamp=' + timestamp;
|
21 |
+
// check if we have backend services at all
|
22 |
+
if ( typeof services !== "undefined" ) {
|
23 |
+
// check if the url is already in requests to avoid duplicated requests
|
24 |
+
if ( requests[ share_url ] ) {
|
25 |
+
// add additional services to services
|
26 |
+
services = requests[ share_url ][ 1 ] + '|' + services;
|
27 |
+
// remove duplicates
|
28 |
+
var service_array = services.split("|");
|
29 |
+
service_array = service_array.filter( function( elem, pos, arr ) {
|
30 |
+
return arr.indexOf( elem ) === pos;
|
31 |
+
});
|
32 |
+
services = service_array.join('|');
|
33 |
+
// update request url
|
34 |
+
request_url = api + 'url=' + share_url + '&services=' + services + '×tamp=' + timestamp;
|
35 |
+
// add to requests
|
36 |
+
requests[ share_url ] = [ share_url, services, timestamp, request_url ];
|
37 |
+
}
|
38 |
+
else {
|
39 |
+
requests[ share_url ] = [ share_url, services, timestamp, request_url ];
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
// get share counts
|
44 |
+
for ( var request in requests ) {
|
45 |
+
if ( requests.hasOwnProperty( request ) ) {
|
46 |
+
shariff_get_share_counts( requests[ request ][ 0 ], requests[ request ][ 3 ], containers );
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
// get share counts
|
51 |
+
function shariff_get_share_counts( share_url, request_url, containers ) {
|
52 |
+
// new XMLHttpRequest
|
53 |
+
var request = new XMLHttpRequest();
|
54 |
+
// load asynchronously
|
55 |
+
request.open( 'GET', request_url, true );
|
56 |
+
// actions after answer
|
57 |
+
request.onload = function() {
|
58 |
+
// check if successful
|
59 |
+
if ( request.status >= 200 && request.status < 400 ) {
|
60 |
+
// add to buttons
|
61 |
+
shariff_add_share_counts( share_url, JSON.parse( request.responseText ), containers );
|
62 |
+
}
|
63 |
+
};
|
64 |
+
// start request
|
65 |
+
request.send();
|
66 |
+
}
|
67 |
+
// add share counts
|
68 |
+
function shariff_add_share_counts( share_url, data, containers ) {
|
69 |
+
// add share counts to buttons
|
70 |
+
for ( var d = 0; containers[d]; d++ ) {
|
71 |
+
// check if it is the corresponding button set
|
72 |
+
if ( containers[d].dataset.url === share_url ) {
|
73 |
+
// update total in total number spans
|
74 |
+
var shariff_totalnumber = containers[d].getElementsByClassName("shariff-totalnumber");
|
75 |
+
for ( var n = 0; shariff_totalnumber[n]; n++ ) {
|
76 |
+
if ( data !== null && typeof data.total !== 'undefined' ) {
|
77 |
+
shariff_totalnumber[n].innerHTML = data.total;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
// update total in shariff headline
|
81 |
+
var shariff_total = containers[d].getElementsByClassName("shariff-total");
|
82 |
+
for ( var t = 0; shariff_total[t]; t++ ) {
|
83 |
+
if ( data !== null && typeof data.total !== 'undefined' ) {
|
84 |
+
shariff_total[t].innerHTML = data.total;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
// loop through all button in this container
|
88 |
+
var shariff_count = containers[d].getElementsByClassName("shariff-count");
|
89 |
+
for ( var s = 0; shariff_count[s]; s++ ) {
|
90 |
+
// add share count, if we have one, and make it visible
|
91 |
+
if ( data !== null && typeof data[shariff_count[s].dataset.service] !== 'undefined' && ( typeof containers[d].dataset.hidezero === 'undefined' || ( containers[d].dataset.hidezero === '1' && data[shariff_count[s].dataset.service] > 0 ) ) ) {
|
92 |
+
shariff_count[s].innerHTML = data[shariff_count[s].dataset.service];
|
93 |
+
shariff_count[s].style.opacity = 1;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
// add event listener to call main shariff function after DOM
|
100 |
+
document.addEventListener( 'DOMContentLoaded', shariff_share_counts, false );
|
js/shariff.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function shariff_share_counts(){
|
1 |
+
function shariff_share_counts(){var d=document.getElementsByClassName("shariff");var a={};for(var i=0;d[i];i++){var e=d[i].dataset.url;var j=d[i].dataset.services;var h=d[i].dataset.timestamp;var g=d[i].dataset.backendurl;if(typeof g==="undefined"){g="/wp-json/shariff/v1/share_counts?"}var k=g+"url="+e+"&services="+j+"×tamp="+h;if(typeof j!=="undefined"){if(a[e]){j=a[e][1]+"|"+j;var b=j.split("|");b=b.filter(function(l,m,c){return c.indexOf(l)===m});j=b.join("|");k=g+"url="+e+"&services="+j+"×tamp="+h;a[e]=[e,j,h,k]}else{a[e]=[e,j,h,k]}}}for(var f in a){if(a.hasOwnProperty(f)){shariff_get_share_counts(a[f][0],a[f][3],d)}}}function shariff_get_share_counts(c,a,d){var b=new XMLHttpRequest();b.open("GET",a,true);b.onload=function(){if(b.status>=200&&b.status<400){shariff_add_share_counts(c,JSON.parse(b.responseText),d)}};b.send()}function shariff_add_share_counts(c,e,b){for(var g=0;b[g];g++){if(b[g].dataset.url===c){var j=b[g].getElementsByClassName("shariff-totalnumber");for(var a=0;j[a];a++){if(e!==null&&typeof e.total!=="undefined"){j[a].innerHTML=e.total}}var h=b[g].getElementsByClassName("shariff-total");for(var i=0;h[i];i++){if(e!==null&&typeof e.total!=="undefined"){h[i].innerHTML=e.total}}var f=b[g].getElementsByClassName("shariff-count");for(var k=0;f[k];k++){if(e!==null&&typeof e[f[k].dataset.service]!=="undefined"&&(typeof b[g].dataset.hidezero==="undefined"||(b[g].dataset.hidezero==="1"&&e[f[k].dataset.service]>0))){f[k].innerHTML=e[f[k].dataset.service];f[k].style.opacity=1}}}}}document.addEventListener("DOMContentLoaded",shariff_share_counts,false);
|
license.txt
CHANGED
@@ -1,47 +1,47 @@
|
|
1 |
-
Shariff
|
2 |
-
|
3 |
-
The MIT License (MIT)
|
4 |
-
|
5 |
-
Copyright (c) 2015 Heise Medien GmbH & Co. KG and other contributors.
|
6 |
-
|
7 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8 |
-
of this software and associated documentation files (the "Software"), to deal
|
9 |
-
in the Software without restriction, including without limitation the rights
|
10 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 |
-
copies of the Software, and to permit persons to whom the Software is
|
12 |
-
furnished to do so, subject to the following conditions:
|
13 |
-
|
14 |
-
The above copyright notice and this permission notice shall be included in
|
15 |
-
all copies or substantial portions of the Software.
|
16 |
-
|
17 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23 |
-
THE SOFTWARE.
|
24 |
-
|
25 |
-
Shariff Wrapper (WordPress Plugin)
|
26 |
-
|
27 |
-
The MIT License (MIT)
|
28 |
-
|
29 |
-
Copyright (c) 2015 3UU productions ("Ritze") and Jan-Peter Lambeck.
|
30 |
-
|
31 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
32 |
-
of this software and associated documentation files (the "Software"), to deal
|
33 |
-
in the Software without restriction, including without limitation the rights
|
34 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
35 |
-
copies of the Software, and to permit persons to whom the Software is
|
36 |
-
furnished to do so, subject to the following conditions:
|
37 |
-
|
38 |
-
The above copyright notice and this permission notice shall be included in
|
39 |
-
all copies or substantial portions of the Software.
|
40 |
-
|
41 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
42 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
43 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
44 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
45 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
46 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
47 |
-
THE SOFTWARE.
|
1 |
+
Shariff
|
2 |
+
|
3 |
+
The MIT License (MIT)
|
4 |
+
|
5 |
+
Copyright (c) 2015 Heise Medien GmbH & Co. KG and other contributors.
|
6 |
+
|
7 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8 |
+
of this software and associated documentation files (the "Software"), to deal
|
9 |
+
in the Software without restriction, including without limitation the rights
|
10 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 |
+
copies of the Software, and to permit persons to whom the Software is
|
12 |
+
furnished to do so, subject to the following conditions:
|
13 |
+
|
14 |
+
The above copyright notice and this permission notice shall be included in
|
15 |
+
all copies or substantial portions of the Software.
|
16 |
+
|
17 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23 |
+
THE SOFTWARE.
|
24 |
+
|
25 |
+
Shariff Wrapper (WordPress Plugin)
|
26 |
+
|
27 |
+
The MIT License (MIT)
|
28 |
+
|
29 |
+
Copyright (c) 2015 3UU productions ("Ritze") and Jan-Peter Lambeck.
|
30 |
+
|
31 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
32 |
+
of this software and associated documentation files (the "Software"), to deal
|
33 |
+
in the Software without restriction, including without limitation the rights
|
34 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
35 |
+
copies of the Software, and to permit persons to whom the Software is
|
36 |
+
furnished to do so, subject to the following conditions:
|
37 |
+
|
38 |
+
The above copyright notice and this permission notice shall be included in
|
39 |
+
all copies or substantial portions of the Software.
|
40 |
+
|
41 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
42 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
43 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
44 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
45 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
46 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
47 |
+
THE SOFTWARE.
|
locale/mailform-DE.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// strings for the e-mail form in German
|
3 |
-
|
4 |
-
// mail form
|
5 |
-
$mf_headline['DE'] = 'Diesen Beitrag per E-Mail versenden';
|
6 |
-
$mf_headinfo['DE'] = 'Sie können maximal fünf Empfänger angeben. Diese bitte durch Kommas trennen.';
|
7 |
-
$mf_rcpt['DE'] = 'Empfänger E-Mail-Adresse(n)';
|
8 |
-
$mf_rcpt_ph['DE'] = 'empfänger@example.com';
|
9 |
-
$mf_from['DE'] = 'Absender E-Mail-Adresse';
|
10 |
-
$mf_from_ph['DE'] = 'absender@example.com';
|
11 |
-
$mf_name['DE'] = 'Name des Absenders (optional)';
|
12 |
-
$mf_name_ph['DE'] = 'Ihr Name';
|
13 |
-
$mf_comment['DE'] = 'Zusatztext (optional)';
|
14 |
-
$mf_send['DE'] = 'E-Mail senden';
|
15 |
-
$mf_info['DE'] = 'Die hier eingegebenen Daten werden nur dazu verwendet, die E-Mail in Ihrem Namen zu versenden. Sie werden nicht gespeichert und es erfolgt keine Weitergabe an Dritte oder eine Analyse zu Marketing-Zwecken.';
|
16 |
-
$mf_optional['DE'] = ' (optional)';
|
17 |
-
$mf_wait['DE'] = 'Spam-Schutz: Bitte in %d Sekunden noch einmal versuchen!';
|
18 |
-
$mf_to_error['DE'] = 'Ungültige Empfänger-Adresse(n)!';
|
19 |
-
$mf_from_error['DE'] = 'Ungültige Absender-Adresse!';
|
20 |
-
|
21 |
-
// send confirmation
|
22 |
-
$mf_mail_send['DE'] = 'Die E-Mail wurde erfolgreich gesendet an:';
|
23 |
-
|
24 |
-
// e-mail content
|
25 |
-
$mf_mailbody1['DE'] = 'Der folgende Beitrag wurde Ihnen von ';
|
26 |
-
$mf_mailbody2['DE'] = 'jemanden'; // will be replaced with a name, if provided
|
27 |
-
$mf_mailbody3['DE'] = ' empfohlen:';
|
28 |
-
|
29 |
-
// e-mail footer
|
30 |
-
// 72 123456789012345678901234567890123456789012345678901234567890123456789012
|
31 |
-
$mf_footer['DE'] = "Diese E-Mail wurde ueber das WordPress-Plugin \"Shariff Wrapper\"\r\n";
|
32 |
-
$mf_footer['DE'] .= "versendet. Es wurde entwickelt, um die Privatsphaere der\r\n";
|
33 |
-
$mf_footer['DE'] .= "Besucher zu schuetzen. Der Seitenbetreiber hat daher keine Moeglichkeit,\r\n";
|
34 |
-
$mf_footer['DE'] .= "naehere Angaben zum tatsaechlichen Absender dieser E-Mail zu geben.\r\n";
|
35 |
-
|
36 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
locale/mailform-EN.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// strings for the e-mail form in English
|
3 |
-
|
4 |
-
// mail form
|
5 |
-
$mf_headline['EN'] = 'Share this post by e-mail';
|
6 |
-
$mf_headinfo['EN'] = 'You can enter up to five recipients. Seperate them with a comma.';
|
7 |
-
$mf_rcpt['EN'] = 'E-mail address of the recipient(s)';
|
8 |
-
$mf_rcpt_ph['EN'] = 'recipient@example.com';
|
9 |
-
$mf_from['EN'] = 'E-mail address of the sender';
|
10 |
-
$mf_from_ph['EN'] = 'sender@example.com';
|
11 |
-
$mf_name['EN'] = 'Name of the sender (optional)';
|
12 |
-
$mf_name_ph['EN'] = 'Your name';
|
13 |
-
$mf_comment['EN'] = 'Additional text (optional)';
|
14 |
-
$mf_send['EN'] = 'Send e-mail';
|
15 |
-
$mf_info['EN'] = 'The provided data in this form is only used to send the e-mail in your name. They will not be stored and not be distributed to any third party or used for marketing purposes.';
|
16 |
-
$mf_optional['EN'] = ' (optional)';
|
17 |
-
$mf_wait['EN'] = 'Spam protection: Please try again in %d seconds!';
|
18 |
-
$mf_to_error['EN'] = 'Invalid e-mail address(es)!';
|
19 |
-
$mf_from_error['EN'] = 'Invalid e-mail address!';
|
20 |
-
|
21 |
-
// send confirmation
|
22 |
-
$mf_mail_send['EN'] = 'The e-mail was successfully send to:';
|
23 |
-
|
24 |
-
// e-mail content
|
25 |
-
$mf_mailbody1['EN'] = 'The following post was suggested to you by ';
|
26 |
-
$mf_mailbody2['EN'] = 'somebody'; // will be replaced with a name, if provided
|
27 |
-
$mf_mailbody3['EN'] = ':';
|
28 |
-
|
29 |
-
// e-mail footer
|
30 |
-
//72 123456789012345678901234567890123456789012345678901234567890123456789012
|
31 |
-
$mf_footer['EN'] = "This e-mail was send using the WordPress plugin \"Shariff Wrapper\".\r\n";
|
32 |
-
$mf_footer['EN'] .= "It was developed to protect the privacy of the website visitors.\r\n";
|
33 |
-
$mf_footer['EN'] .= "Therefore the owner of the site cannot provide any more information\r\n";
|
34 |
-
$mf_footer['EN'] .= "about the actual sender of this e-mail.\r\n";
|
35 |
-
|
36 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
locale/mailform-FR.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// strings for the e-mail form in French
|
3 |
-
|
4 |
-
// mail form
|
5 |
-
$mf_headline['FR'] = 'Envoyer cet article par e-mail';
|
6 |
-
$mf_headinfo['FR'] = 'Vous pouvez partager cet article avec 5 destinataires au maximum. Veuillez séparer chaque adresse par une virgule.';
|
7 |
-
$mf_rcpt['FR'] = 'E-mail des destinataires';
|
8 |
-
$mf_rcpt_ph['FR'] = 'destinataire@example.com';
|
9 |
-
$mf_from['FR'] = "E-mail de l'expéditeur";
|
10 |
-
$mf_from_ph['FR'] = 'expéditeur@example.com';
|
11 |
-
$mf_name['FR'] = "Nom de l'expéditeur (optionel)";
|
12 |
-
$mf_name_ph['FR'] = 'Votre nom';
|
13 |
-
$mf_comment['FR'] = 'Message (optionel)';
|
14 |
-
$mf_send['FR'] = 'envoyer e-mail';
|
15 |
-
$mf_info['FR'] = 'Les données fournies ne seront pas utilisées pour envoyer des email en votre nom. Elles ne seront pas conservées, divulguées ou utilisées pour une analyse marketing.';
|
16 |
-
$mf_optional['FR'] = ' (optionel)';
|
17 |
-
$mf_wait['FR'] = 'Protecion contre les spam : Veuillez réessayer dans %d secondes!';
|
18 |
-
$mf_to_error['FR'] = 'Erreur dans la(les) adresse(s) de destination !';
|
19 |
-
$mf_from_error['FR'] = "Erreur dans l'adresse de l'expediteur!";
|
20 |
-
|
21 |
-
// send confirmation
|
22 |
-
$mf_mail_send['FR'] = "L'e-mail a été envoyé avec succès à : ";
|
23 |
-
|
24 |
-
// e-mail content
|
25 |
-
$mf_mailbody1['FR'] = "L'article suivant vous a été envoyé par ";
|
26 |
-
$mf_mailbody2['FR'] = "quelqu'un"; // will be replaced with a name, if provided
|
27 |
-
$mf_mailbody3['FR'] = " : ";
|
28 |
-
|
29 |
-
// e-mail footer
|
30 |
-
//72 123456789012345678901234567890123456789012345678901234567890123456789012
|
31 |
-
$mf_footer['FR'] = "Cet e-mail vous a été envoyé depuis le plugin Wordpress \"Shariff\r\n";
|
32 |
-
$mf_footer['FR'] .= "Wrapper\". Il a été développé pour protéger les données privées de \r\n";
|
33 |
-
$mf_footer['FR'] .= "l'internaute qui visite notre site.Le propriétaire n'a pas la \r\n";
|
34 |
-
$mf_footer['FR'] .= "possibilité de donner des informations plus détaillées sur le \r\n";
|
35 |
-
$mf_footer['FR'] .= "véritable expediteur de cet e-mail.\r\n";
|
36 |
-
|
37 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
locale/mailform-IT.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// strings for the e-mail form in Italian
|
3 |
-
|
4 |
-
// mail form
|
5 |
-
$mf_headline['IT'] = 'Condividi questo articolo via email';
|
6 |
-
$mf_headinfo['IT'] = 'Puoi inserire fino a cinque destinatari. Seperali con una virgola.';
|
7 |
-
$mf_rcpt['IT'] = 'Indirizzo e-mail del(i) destinatario(i)';
|
8 |
-
$mf_rcpt_ph['IT'] = 'destinatario@example.com';
|
9 |
-
$mf_from['IT'] = 'Indirizzo e-mail del mittente';
|
10 |
-
$mf_from_ph['IT'] = 'mittente@example.com';
|
11 |
-
$mf_name['IT'] = 'Nome del mittente (facoltativo)';
|
12 |
-
$mf_name_ph['IT'] = 'Il tuo nome';
|
13 |
-
$mf_comment['IT'] = 'Testo aggiuntivo (facoltativo)';
|
14 |
-
$mf_send['IT'] = 'Invia e-mail';
|
15 |
-
$mf_info['IT'] = 'I dati forniti in questo modulo sono utilizzati unicamente per inviare una e-mail a tuo nome. Non saranno archiviati, ne' distribuiti a terzi o utilizzati con finalita' di marketing.';
|
16 |
-
$mf_optional['IT'] = ' (facoltativo)';
|
17 |
-
$mf_wait['IT'] = 'Protezione spam: Per favore riprova tra %d secondi!';
|
18 |
-
$mf_to_error['IT'] = 'Indirizzo(i) e-mail invalido(i)!';
|
19 |
-
$mf_from_error['IT'] = 'Indirizzo email invalido!';
|
20 |
-
|
21 |
-
// send confirmation
|
22 |
-
$mf_mail_send['IT'] = 'La tua e-mail e' stata inviata con successo a:';
|
23 |
-
|
24 |
-
// e-mail content
|
25 |
-
$mf_mailbody1['IT'] = 'Il seguente articolo ti e' stato consigliato da ';
|
26 |
-
$mf_mailbody2['IT'] = 'qualcuno'; // sostituito da un nome, se fornito
|
27 |
-
$mf_mailbody3['IT'] = ':';
|
28 |
-
|
29 |
-
// e-mail footer
|
30 |
-
//72 123456789012345678901234567890123456789012345678901234567890123456789012
|
31 |
-
$mf_footer['IT'] = "La presente e-mail e' stata inviata utilizzando il plugin di\r\n";
|
32 |
-
$mf_footer['IT'] .= "WordPress \"Shariff Wrapper\". Tale plugin e' stato sviluppato per\r\n";
|
33 |
-
$mf_footer['IT'] .= "garantire la privacy dei visitatori del sito. Pertanto il proprietario\r\n";
|
34 |
-
$mf_footer['IT'] .= "del sito non puo' fornire informazioni aggiuntive sull'effettivo\r\n";
|
35 |
-
$mf_footer['IT'] .= "mittente della presente e-mail.\r\n";
|
36 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,304 +1,340 @@
|
|
1 |
-
=== Shariff Wrapper ===
|
2 |
-
Contributors:
|
3 |
-
Tags: Shariff,
|
4 |
-
Requires at least: 4.
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
License
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
The "original" share buttons automatically transmit data of your visitors to the social network sites as soon as they visit your website. They do not need to click on a share button for this and therefore have no choice, if they want their data to be send. The German computer
|
16 |
-
|
17 |
-
For more
|
18 |
-
|
19 |
-
You can automatically add share buttons to posts, pages, the main blog page, product sites and many more as well as use it as a widget or add the shortcode `[shariff]` manually to your pages or themes.
|
20 |
-
|
21 |
-
== Installation ==
|
22 |
-
|
23 |
-
1. Upload everything to the `/wp-content/plugins/` directory
|
24 |
-
2. Activate the plugin using the plugins menu in WordPress
|
25 |
-
3. Use <code>[shariff]</code> anywhere
|
26 |
-
|
27 |
-
To enable it for all posts please check the options in the plugin settings.
|
28 |
-
|
29 |
-
== Screenshots ==
|
30 |
-
|
31 |
-
1. Differently styled share buttons (all small).
|
32 |
-
2. Basic options.
|
33 |
-
3. Design options.
|
34 |
-
4. Advanced options.
|
35 |
-
5. Mail form options.
|
36 |
-
6. Help section.
|
37 |
-
7. Manual shorttag with options in a post.
|
38 |
-
8. Widget menu. Shorttag works like in posts.
|
39 |
-
|
40 |
-
== Frequently Asked Questions ==
|
41 |
-
|
42 |
-
= Q: Can I use the Shariff buttons in my theme? =
|
43 |
-
A: Yes.
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
= Q:
|
62 |
-
A:
|
63 |
-
|
64 |
-
= Q:
|
65 |
-
A:
|
66 |
-
|
67 |
-
= Q:
|
68 |
-
A:
|
69 |
-
|
70 |
-
= Q:
|
71 |
-
A:
|
72 |
-
|
73 |
-
= Q: I
|
74 |
-
A:
|
75 |
-
|
76 |
-
= Q:
|
77 |
-
A:
|
78 |
-
|
79 |
-
= Q: I
|
80 |
-
A:
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
= Q:
|
91 |
-
A:
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
= Q:
|
108 |
-
A:
|
109 |
-
|
110 |
-
= Q:
|
111 |
-
A:
|
112 |
-
|
113 |
-
= Q:
|
114 |
-
A:
|
115 |
-
|
116 |
-
= Q:
|
117 |
-
A:
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
`
|
126 |
-
|
127 |
-
|
128 |
-
= Q: What
|
129 |
-
A:
|
130 |
-
|
131 |
-
= Q:
|
132 |
-
A:
|
133 |
-
|
134 |
-
= Q:
|
135 |
-
A:
|
136 |
-
|
137 |
-
= Q:
|
138 |
-
A: Please
|
139 |
-
|
140 |
-
=
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
-
|
150 |
-
|
151 |
-
-
|
152 |
-
-
|
153 |
-
|
154 |
-
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
=
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
-
|
180 |
-
-
|
181 |
-
|
182 |
-
|
183 |
-
- new
|
184 |
-
- new
|
185 |
-
- new
|
186 |
-
- new
|
187 |
-
-
|
188 |
-
-
|
189 |
-
-
|
190 |
-
-
|
191 |
-
-
|
192 |
-
-
|
193 |
-
-
|
194 |
-
-
|
195 |
-
-
|
196 |
-
|
197 |
-
|
198 |
-
- fixed
|
199 |
-
-
|
200 |
-
-
|
201 |
-
|
202 |
-
|
203 |
-
-
|
204 |
-
-
|
205 |
-
-
|
206 |
-
-
|
207 |
-
-
|
208 |
-
-
|
209 |
-
-
|
210 |
-
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
-
|
216 |
-
-
|
217 |
-
-
|
218 |
-
|
219 |
-
|
220 |
-
- new option to
|
221 |
-
-
|
222 |
-
-
|
223 |
-
|
224 |
-
|
225 |
-
-
|
226 |
-
-
|
227 |
-
-
|
228 |
-
-
|
229 |
-
-
|
230 |
-
-
|
231 |
-
-
|
232 |
-
|
233 |
-
|
234 |
-
-
|
235 |
-
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
-
|
242 |
-
|
243 |
-
|
244 |
-
-
|
245 |
-
-
|
246 |
-
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
-
|
251 |
-
- fixed
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
-
|
259 |
-
|
260 |
-
|
261 |
-
-
|
262 |
-
-
|
263 |
-
- new
|
264 |
-
-
|
265 |
-
-
|
266 |
-
|
267 |
-
|
268 |
-
-
|
269 |
-
- fixed
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
-
|
278 |
-
|
279 |
-
|
280 |
-
-
|
281 |
-
- fixed
|
282 |
-
-
|
283 |
-
-
|
284 |
-
|
285 |
-
|
286 |
-
-
|
287 |
-
-
|
288 |
-
|
289 |
-
|
290 |
-
-
|
291 |
-
- css
|
292 |
-
|
293 |
-
|
294 |
-
-
|
295 |
-
- fixed
|
296 |
-
-
|
297 |
-
-
|
298 |
-
-
|
299 |
-
-
|
300 |
-
-
|
301 |
-
- minor
|
302 |
-
|
303 |
-
|
304 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Shariff Wrapper ===
|
2 |
+
Contributors: starguide, 3UU
|
3 |
+
Tags: Shariff, GDPR, DSGVO, share buttons, sharing
|
4 |
+
Requires at least: 4.9
|
5 |
+
Requires PHP: 5.6
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 4.4.2
|
8 |
+
License: MIT
|
9 |
+
License URI: http://opensource.org/licenses/mit
|
10 |
+
|
11 |
+
Shariff provides share buttons that respect the privacy of your visitors and follow the General Data Protection Regulation (GDPR).
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
The "original" share buttons automatically transmit data of your visitors to the social network sites as soon as they visit your website. They do not need to click on a share button for this and therefore have no choice, if they want their data to be send. The German computer magazine c't has developed "Shariff" `(ʃɛɹɪf)` that follows the General Data Protection Regulation (GDPR - Regulation (EU) 2016/679). This plugin adapts the Shariff concept and provides an easy to use solution for WordPress. We currently support 32 services: AddThis, Bitcoin, Diaspora, Facebook, Flattr, Flipboard, GooglePlus, LinkedIn, mailto, Mastodon, Odnoklassniki, Patreon, PayPal, PayPal.me, Pinterest, Pocket, Printer, Qzone, Reddit, RSS, SMS, Stumbleupon, Telegram, TencentWeibo, Threema, Tumblr, Twitter, VK, Wallabag, Weibo, WhatsApp, Xing.
|
16 |
+
|
17 |
+
For more information about the Shariff project check out the original [GitHub project](https://github.com/heiseonline/shariff) and read about the project itself [c’t information page](http://ct.de/shariff) (in German).
|
18 |
+
|
19 |
+
You can automatically add share buttons to posts, pages, the main blog page, product sites and many more as well as use it as a widget or add the shortcode `[shariff]` manually to your pages or themes.
|
20 |
+
|
21 |
+
== Installation ==
|
22 |
+
|
23 |
+
1. Upload everything to the `/wp-content/plugins/` directory
|
24 |
+
2. Activate the plugin using the plugins menu in WordPress
|
25 |
+
3. Use <code>[shariff]</code> anywhere on your site and/or use the Shariff settings menu.
|
26 |
+
|
27 |
+
To enable it for all posts please check the options in the plugin settings.
|
28 |
+
|
29 |
+
== Screenshots ==
|
30 |
+
|
31 |
+
1. Differently styled share buttons (all small).
|
32 |
+
2. Basic options.
|
33 |
+
3. Design options.
|
34 |
+
4. Advanced options.
|
35 |
+
5. Mail form options.
|
36 |
+
6. Help section.
|
37 |
+
7. Manual shorttag with options in a post.
|
38 |
+
8. Widget menu. Shorttag works like in posts.
|
39 |
+
|
40 |
+
== Frequently Asked Questions ==
|
41 |
+
|
42 |
+
= Q: Can I use the Shariff buttons in my theme? =
|
43 |
+
A: Yes. Simply use the shortcode function `do_shortcode('[shariff]')`.
|
44 |
+
You can use all options of the shorttag as described on the help tab in the plugin settings.
|
45 |
+
|
46 |
+
= Q: Can I use the total amount of shares in my theme? =
|
47 |
+
A: Yes. You can use `do_shortcode('[shariff services="totalnumber"]')` to simply output the total amount of shares for a post in the loop. It will return the number itself wrapped in a `<span class="shariff-totalnumber"></span>` in order for the shariff.js to update the count. Also only cached data is used, in order to not slow down your site.
|
48 |
+
|
49 |
+
= Q: Is there an action hook to use the share counts every time they get updated? =
|
50 |
+
A: Yes. You can use
|
51 |
+
`function your_awesome_function( $share_counts ) {
|
52 |
+
// $share_counts is an array including all enabled services, the timestamp of the update and the url of the post.
|
53 |
+
// do stuff
|
54 |
+
}
|
55 |
+
add_action( 'shariff_share_counts', 'your_awesome_function' );`
|
56 |
+
WARNING: This hook will get called A LOT. So be sure you know what you are doing.
|
57 |
+
|
58 |
+
= Q: How can I configure the widget? =
|
59 |
+
A: It uses the same options that have been configured on the plugin options page. However, you can put in a shorttag that overwrites the default options. It has the same format as you use in posts. Take a look at the help section of the plugin options page for more information.
|
60 |
+
|
61 |
+
= Q: Can I change the options on a single post? =
|
62 |
+
A: Yes. You can change all options using the shorttag in the Shariff meta box on the right side of the post edit screen.
|
63 |
+
|
64 |
+
= Q: Why are shares not listed? =
|
65 |
+
A: Shariff tries to protect the privacy of your visitors. In order to do this, the statistics have to be requested by your server, so social networks only see a request of your server and not from your visitor. However, we do not know, if you want this. Therefore it is not enabled by default.
|
66 |
+
|
67 |
+
= Q: How can I show the share counts? =
|
68 |
+
A: Enable it on the plugin options page in general or add `backend="on"` to the shariff shorttag in your post.
|
69 |
+
|
70 |
+
= Q: I still do not see share counts =
|
71 |
+
A: Please have a look at the status tab on the plugin options page. It states whether share counts are enabled and if there is a problem with a service. Please also keep in mind that the plugin has a minimum refresh time of 60 seconds and that each service has their own cache as well.
|
72 |
+
|
73 |
+
= Q: Why can't I change the TTL to a smaller / bigger value? =
|
74 |
+
A: The time to live (TTL) value determines, if a share count of a post or page gets refreshed when someone visits this specific page / post of your blog. Too small values create too much useless traffic, too high values negate the goal of motivating visitors to also share a post. The value can be adjusted between 60 and 7200 seconds. Keep in mind, the actual lifespan depends on the age of the post as well.
|
75 |
+
|
76 |
+
= Q: I get the Facebook API error message "request limit reached"! =
|
77 |
+
A: Facebook has a rate limit of 600 requests per 600 seconds per IP address. Especially in shared hosting environments many domains share the same IP address and therefore the same limit. To avoid this you can try to raise the TTL value or provide a Facebook App ID and Secret. Google "facebook app id secret" will provide many guides on how to get these.
|
78 |
+
|
79 |
+
= Q: How can I change the position of all buttons? =
|
80 |
+
A: Have a look at the alignment options in the admin menu or checkout the
|
81 |
+
style option.
|
82 |
+
|
83 |
+
= Q: How can I change the design? =
|
84 |
+
A: Have a look at the parameters "theme", "orientation" and "buttonsize". They work mostly like the original code parameters that are explained at http://heiseonline.github.io/shariff/ Or you can have a look at the test page at http://shariff.3uu.net/shariff-sample-page-with-all-options to get an
|
85 |
+
overview. But please be warned: This is a test page! It is possible that you find features that are only provided in the development version. Use it only to get an impression of the design options.
|
86 |
+
|
87 |
+
= Q: How can I change the design of a single button? =
|
88 |
+
A: If you are a CSS guru please feel free to modify the css file. But of course this is a bad idea, because all changes will be destroyed with the next update! Instead take a look at the style and class attribute of the shorttag. If you put in any value it will create a DIV container with the ID "ShariffSC" around the buttons. If you are really a CSS guru you will know what does the magic from here on out. ;-)
|
89 |
+
|
90 |
+
= Q: I want the buttons to stay fixed while scrolling! =
|
91 |
+
A: No problem. Just use the style attribute to add some CSS to the shorttag. For example in a widget (adjust the width as needed):
|
92 |
+
`[shariff style="position:fixed;width:250px"]`
|
93 |
+
Of course you can use all other options in that shorttag as well. It also works with the CSS style option on the plugins design options page, if you really want this applied to all buttons on your page.
|
94 |
+
|
95 |
+
= Q: I want a horizontal line above my Shariff buttons! =
|
96 |
+
A: You can use the headline option on the design tab. For example, enter the following code to create a horizontal line and a headline:
|
97 |
+
`<hr style='margin:20px 0'><p>Please share this post:</p>`
|
98 |
+
|
99 |
+
= Q: I want a different or no headline in a single widget, post or page! =
|
100 |
+
A: Use the headline attribute to add or remove it. For example, you can use the following shorttag to remove a headline set on the plugins options page in a single widget:
|
101 |
+
`[shariff headline=""]`
|
102 |
+
Of course you can use all other options in that shorttag as well.
|
103 |
+
|
104 |
+
= Q: Can I add [shariff] on all posts? =
|
105 |
+
A: Yes, check out the plugin options.
|
106 |
+
|
107 |
+
= Q: But I want to hide it on a single post! =
|
108 |
+
A: Do you really know what you want? ;-) However, it is possible. Write anywhere in your post "hideshariff". It will be removed and Shariff will not be added. You can also use "/hideshariff" to write "hideshariff" in your post. You might also want to take a look at the Shariff meta box on the right side of your post edit screen.
|
109 |
+
|
110 |
+
= Q: What are the differences between the two Shariff plugins? =
|
111 |
+
A: One is developed by us, one by someone else. ;-) The main difference is that this plugin has a few more options and a great support. :-) Neither of the plugins are "official" or directly developed by Heise.
|
112 |
+
|
113 |
+
= Q: Does it work with a CDN? =
|
114 |
+
A: Yes.
|
115 |
+
|
116 |
+
= Q: Pinterest does not show an image! =
|
117 |
+
A: You can add media="http://wwww.example.com/yourImage.png"
|
118 |
+
within the [shariff] shorttag or add it in on the plugin options page - of course with the link to your image.
|
119 |
+
|
120 |
+
= Q: Can I set a fixed URL to share? =
|
121 |
+
A: You can use the "url" parameter within the shortcode
|
122 |
+
`[shariff url="http://www.example.com/"]`
|
123 |
+
This is also available within widgets. However, it is not a good idea to manipulate the URI, because it could mislead your visitors. So you should only use it, if this is really needed and you do really know what you are doing. Therefore it is not available on the plugin options page in general.
|
124 |
+
|
125 |
+
= Q: What is the difference between the services `mailform` and `mailto´? =
|
126 |
+
A: mailform will provide an e-mail form on top of the post or page and mailto will draw a link with the mailto-protocol to open the default e-mail application of the client.
|
127 |
+
|
128 |
+
= Q: What happened to `mail`? =
|
129 |
+
A: mail was replaced with mailform to provide an easier way of distinguishing between the two types of mail buttons.
|
130 |
+
|
131 |
+
= Q: Can I disable the mail form completely? =
|
132 |
+
A: Yes, take a look at the Mail Form tab on the plugin options page.
|
133 |
+
|
134 |
+
= Q: What happened to the Twitter share counts and what is OpenShareCount? =
|
135 |
+
A: Please read: https://www.jplambeck.de/twitter-saveoursharecounts/
|
136 |
+
|
137 |
+
= Q: The buttons are not correctly being shown on my custom theme! =
|
138 |
+
A: Please make sure that wp_footer(); has been added to your theme. For more information please visit: https://codex.wordpress.org/Function_Reference/wp_footer
|
139 |
+
|
140 |
+
= EXPERIMENTAL FEATURES =
|
141 |
+
|
142 |
+
Features marked as "experimental" in the admin menu are experimental! This means: We think it is a good extension to our plugin that we would like to include in a future version, but we are not sure yet about the best solution that works for all or most people. So please feel free to use and test it and report back to us about it. Experimental features might be removed in an update, if it does not work out. So please pay close attention to our changelog!
|
143 |
+
|
144 |
+
= Q: What is the external API feature? =
|
145 |
+
A: First of all: Usually you do not need it! The plugin requests all share counts itself. However, there are some reasons to put the backend on another server:
|
146 |
+
- avoid requests from you WP server to all the social networks
|
147 |
+
- use a more powerful server for the statistic
|
148 |
+
- use the original backend implementation of Heise or your own solution
|
149 |
+
- make your own backend available for more than one WP installation
|
150 |
+
But please have in mind that there are also some good reasons not to use external servers:
|
151 |
+
- you need an additional installation of WP and the plugin or have to create your own implementation of a Shariff backend
|
152 |
+
- some plugin settings (backend checks, statistic, etc.) will only work on the external server
|
153 |
+
- you have to use SHARIFF_FRONTENDS as an array with all your frontend domains to enable the backend or find your own solution
|
154 |
+
- we CANNOT provide support for your own implementation
|
155 |
+
|
156 |
+
= Q: How can I configure the external API? =
|
157 |
+
A: In the statistic settings fill in the URL to the API of the external server. For the WordPress installation on the external server you have to create a "constant" called SHARIFF_FRONTENDS to permit other domains to use it. Please have in mind that you have to fill in all subdomains you want to use! The domains must be defined like this:
|
158 |
+
`define( 'SHARIFF_FRONTENDS', 'example.com|www.example.com|blog.example.com|another-domain.com' );`
|
159 |
+
|
160 |
+
= Q: What does "Request external API directly." means? =
|
161 |
+
A: By default, the browser request the share counts from the server your site is running on. If you have entered an external API your server will then request the counts from this external API instead of fetching them itself. Therefore, the external server will only see the IP from your server and not the one from your visitors. If you check this option, the browser of your visitors will instead directly request the share counts from the external API and therefore reveal their IP address to them. This might be faster, but it is less secure. Please also make sure to set the Access-Control-Allow-Origin header right. If your site is available using https, your external API will need to be reached by https as well. Otherwise the request will get blocked for security reasons. All options and features (e.g. the ranking tab) regarding the statistic will only work on the external server.
|
162 |
+
|
163 |
+
= KNOWN BUGS =
|
164 |
+
|
165 |
+
These are bugs or unexpected glitches that we know of, but that do not have an impact on the majority of users, are not security relevant and will perhaps be fixed in the future - if we have time to spend or you provide us with a lot of "Kölsch" ;-)
|
166 |
+
|
167 |
+
- If the first post on the start page is password protected and Shariff is disabled on protected posts, a widget at the end of the loop will not be rendered.
|
168 |
+
|
169 |
+
== Changelog ==
|
170 |
+
|
171 |
+
= 4.4.2 =
|
172 |
+
- new support for the "AMP for WP" plugin by Ahmed and Mohammed Kaludi
|
173 |
+
- improved support for the "AMP for WordPress" plugin by Automattic
|
174 |
+
- new additional workaround for servers without $_SERVER for category pages
|
175 |
+
- minor bug fixes
|
176 |
+
|
177 |
+
= 4.4.1 =
|
178 |
+
- new service wallabag (thanks to Torsten, @knodderdachs)
|
179 |
+
- minor bug fixes
|
180 |
+
- updated help section
|
181 |
+
|
182 |
+
= 4.4.0 =
|
183 |
+
- new service Telegram (thanks to Daniel Sturm, @dcsturm)
|
184 |
+
- new service Flipboard (thanks to csigncsign, @csigncsign)
|
185 |
+
- new service Mastodon (thanks to scroom, @scroom)
|
186 |
+
- new service Qzone
|
187 |
+
- new service Weibo
|
188 |
+
- new service TencentWeibo
|
189 |
+
- new service SMS (will work on iOS, might not work on other phones)
|
190 |
+
- new support of the "AMP for WordPress" plugin by Automattic
|
191 |
+
- new option to set a custom text for the info button
|
192 |
+
- new option to disable the metabox
|
193 |
+
- new option to add shariff to CPTs before the content
|
194 |
+
- new ranking table now also shows pages
|
195 |
+
- new fix to prevent Shariff buttons from being displayed on admin pages
|
196 |
+
- new fix to support WP-CLI (thanks to Daniel Jagszent, @d--j)
|
197 |
+
- fixed HTML errors regarding self closing tags (thanks to Tooni, @tooni)
|
198 |
+
- fixed a missing closing tag under certain conditions (thanks to Pat, @fortythousandmiles)
|
199 |
+
- removed GooglePlus share counts due to Google removing the API
|
200 |
+
- added Czech translation of the buttons
|
201 |
+
- updated a lot of button translations
|
202 |
+
- updated to Facebook Graph API 2.12
|
203 |
+
- updated a lot of strings to allow for easier translation
|
204 |
+
- updated the reddit icon
|
205 |
+
- updated help section
|
206 |
+
- improved documentation of the REST API endpoint for share counts (thanks to David)
|
207 |
+
- major improvements in regards to code quality
|
208 |
+
- minor css improvements
|
209 |
+
- minor security improvements
|
210 |
+
- removed the mail form for the time being due to technical and legal due diligence
|
211 |
+
- if you need the mail form functionality, please stick to version 4.3
|
212 |
+
- https://downloads.wordpress.org/plugin/shariff.4.3.0.zip
|
213 |
+
|
214 |
+
= 4.3.0 =
|
215 |
+
- new service Odnoklassniki (thanks to rockhit)
|
216 |
+
- new meta box allows for individual settings per post or page
|
217 |
+
- new option to hide share counts that are zero
|
218 |
+
- new option to disable dynamic cache lifespan (not recommended)
|
219 |
+
- new option to set the button size to small, medium or large
|
220 |
+
- new option to add a custom class to the container around Shariff
|
221 |
+
- new option to open links in a popup (thanks to jackennils)
|
222 |
+
- new option to use NewShareCount instead of OpenShareCount (Twitter)
|
223 |
+
- added timestamp variable to be accessible via shortcode
|
224 |
+
- fixed post timestamp for caching under certain conditions
|
225 |
+
- fixed Facebook share count error for never crawled pages
|
226 |
+
- fixed empty tab after sharing on certain mobile devices
|
227 |
+
- fixed custom title attribute (thanks to kschlager)
|
228 |
+
- updated Flattr user id for the future (thanks to poetaster)
|
229 |
+
- reduced changelog on wordpress.org (thanks to timse201)
|
230 |
+
- minor css improvements
|
231 |
+
- updated help section
|
232 |
+
|
233 |
+
= 4.2.1 =
|
234 |
+
- fixed WhatsApp button on Android when using Chrome
|
235 |
+
- fixed Shariff being added to RSS feeds under certain conditions
|
236 |
+
- updated to latest Facebook Graph API for share count requests
|
237 |
+
|
238 |
+
= 4.2.0 =
|
239 |
+
- new option to set the rate limit for sending mails using the mail form
|
240 |
+
- added home url as fallback for share count requests
|
241 |
+
- added further anti-spam prevention mechanics
|
242 |
+
- added noopener and noreferrer to share links
|
243 |
+
- fixed double encoding of share count request links
|
244 |
+
- updated media uploader request for translation
|
245 |
+
- updated handling of admin notices following WordPress core
|
246 |
+
- tested and optimized for WordPress 4.6
|
247 |
+
|
248 |
+
= 4.1.2 =
|
249 |
+
- new fallback for share count requests in case pretty permalinks are disabled
|
250 |
+
- new filter shariff3UU_render_atts to change options on the fly (thx Ov3rfly)
|
251 |
+
- fixed share title in cases with html encoded characters
|
252 |
+
- fixed double counting on ranking tab under certain conditions
|
253 |
+
- fixed php info notice in admin notices
|
254 |
+
|
255 |
+
= 4.1.1 =
|
256 |
+
- new option to disable the Shariff buttons outside of the main loop
|
257 |
+
- fixed Facebook App ID request
|
258 |
+
- minor css fix
|
259 |
+
|
260 |
+
= 4.1.0 =
|
261 |
+
- new design option to set a custom button color for all buttons
|
262 |
+
- new design option to set a border radius for the round theme (up to a square)
|
263 |
+
- new design option to hide all buttons until the page is fully loaded
|
264 |
+
- new mailform option to use a html anchor (again)
|
265 |
+
- new statistic option to fill the cache automatically
|
266 |
+
- new statistic option to set the amount of posts for the ranking tab
|
267 |
+
- new statistic option to use share counts with PHP < 5.4
|
268 |
+
- fixed preventing buttons from being added to excerpts under certain conditions
|
269 |
+
- fixed url encoding of share count requests
|
270 |
+
- improved handling of wrong or mistyped service entries
|
271 |
+
- minor bug fixes
|
272 |
+
|
273 |
+
= 4.0.8 =
|
274 |
+
- new workaround for sites running PHP 5.2 and older
|
275 |
+
|
276 |
+
= 4.0.7 =
|
277 |
+
- new option for WordPress installations with REST API not reachable in root
|
278 |
+
|
279 |
+
= 4.0.6 =
|
280 |
+
- fixed an error in combination with bbpress
|
281 |
+
- fixed an error on very old PHP versions
|
282 |
+
- fixed ranking tab
|
283 |
+
- minor css improvements
|
284 |
+
|
285 |
+
= 4.0.5 =
|
286 |
+
- fixed mail form link
|
287 |
+
- fixed xmlns for w3c
|
288 |
+
|
289 |
+
= 4.0.4 =
|
290 |
+
- removed some remaining wrong text domains for translations
|
291 |
+
- minor css fixes
|
292 |
+
|
293 |
+
= 4.0.3 =
|
294 |
+
- fixed mobile services not showing on certain tablets
|
295 |
+
- fixed type error on totalnumber when cache is empty
|
296 |
+
- fixed share count requests when WordPress is installed in a subdirectory
|
297 |
+
- fixed url encoding of share url, title and media
|
298 |
+
- added width and height to SVGs to prevent large initial icons prior to css
|
299 |
+
- new classes shariff-buttons and shariff-link added
|
300 |
+
- removed local translation files due to switching to wordpress.org language packs
|
301 |
+
- minor css resets added
|
302 |
+
|
303 |
+
= 4.0.2 =
|
304 |
+
- added minor css resets to prevent influence of theme css
|
305 |
+
- fixed LinkedIn share link
|
306 |
+
|
307 |
+
= 4.0.1 =
|
308 |
+
- prevent php warning messages on unsuccessful includes while WP_DEBUG is active
|
309 |
+
- changed text domain to match plugin slug
|
310 |
+
|
311 |
+
= 4.0.0 =
|
312 |
+
- complete overhaul of the plugin core
|
313 |
+
- buttons now also work without JavaScript
|
314 |
+
- icon font has been removed and replaced with SVGs
|
315 |
+
- share counts now use the WP REST API
|
316 |
+
- share counts now always show the last cached counts prior to updating them
|
317 |
+
- fixed duplicated share count requests
|
318 |
+
- new ranking tab shows the shares of your last 100 posts
|
319 |
+
- new service pocket
|
320 |
+
- new option to show the total amount of shares in the headline with %total
|
321 |
+
- new option to use the total amount of shares in your theme (see FAQ)
|
322 |
+
- new action hook shariff_share_counts (see FAQ)
|
323 |
+
- new option to change the priority of the shortcode filter
|
324 |
+
- new support for selective refresh introduced in WP 4.5
|
325 |
+
- new external API feature replaces the external host option (experimental, see FAQ)
|
326 |
+
- new support for SCRIPT_DEBUG
|
327 |
+
- css and js files are now only loaded on pages with Shariff buttons
|
328 |
+
- improved compatibility with plugin Autoptimize (force scripts in head)
|
329 |
+
- improved compatibility with multiple caching plugins
|
330 |
+
- all shortcodes are now being stripped from the mail message body
|
331 |
+
- fixed potential double sending of mails
|
332 |
+
- removed all jQuery dependencies
|
333 |
+
- requires at least WordPress 4.4 (only for share counts)
|
334 |
+
- we no longer support IE 8 (if it ever worked)
|
335 |
+
- updated status tab
|
336 |
+
- updated help section
|
337 |
+
- minor bug fixes
|
338 |
+
- code cleanup
|
339 |
+
|
340 |
+
The complete changelog can be found here: https://plugins.svn.wordpress.org/shariff/trunk/changelog.txt
|
services/shariff-addthis.php
CHANGED
@@ -1,67 +1,70 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
//
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
//
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
'
|
34 |
-
'
|
35 |
-
'
|
36 |
-
'
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
44 |
-
'
|
45 |
-
'
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
-
'
|
50 |
-
'
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
}
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when AddThis is selected as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevents direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'http://api.addthis.com/oexchange/0.8/offer' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#f8694d';
|
23 |
+
$secondary_color = '#f75b44';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M28.2 12.8h-8.9v-8.9c0-0.4-0.4-0.8-0.8-0.8h-4.9c-0.4 0-0.8 0.4-0.8 0.8v8.9h-8.9c-0.4 0-0.8 0.4-0.8 0.8v4.9c0 0.4 0.4 0.8 0.8 0.8h8.9v8.9c0 0.4 0.4 0.8 0.8 0.8h4.9c0.4 0 0.8-0.4 0.8-0.8v-8.9h8.9c0.4 0 0.8-0.4 0.8-0.8v-4.9c0-0.4-0.4-0.8-0.8-0.8z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 1;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели в AddThis',
|
34 |
+
'cs' => 'Sdílet na AddThis',
|
35 |
+
'da' => 'Del på AddThis',
|
36 |
+
'de' => 'Bei AddThis teilen',
|
37 |
+
'en' => 'Share on AddThis',
|
38 |
+
'es' => 'Compartir en AddThis',
|
39 |
+
'fi' => 'Jaa AddThisissä',
|
40 |
+
'fr' => 'Partager sur AddThis',
|
41 |
+
'hr' => 'Podijelite na AddThis',
|
42 |
+
'hu' => 'Megosztás AddThisen',
|
43 |
+
'it' => 'Condividi su AddThis',
|
44 |
+
'ja' => 'AddThis上で共有',
|
45 |
+
'ko' => 'AddThis에서 공유하기',
|
46 |
+
'nl' => 'Delen op AddThis',
|
47 |
+
'no' => 'Del på AddThis',
|
48 |
+
'pl' => 'Udostępnij przez AddThis',
|
49 |
+
'pt' => 'Compartilhar no AddThis',
|
50 |
+
'ro' => 'Partajează pe AddThis',
|
51 |
+
'ru' => 'Поделиться на AddThis',
|
52 |
+
'sk' => 'Zdieľať na AddThis',
|
53 |
+
'sl' => 'Deli na AddThis',
|
54 |
+
'sr' => 'Podeli na AddThis',
|
55 |
+
'sv' => 'Dela på AddThis',
|
56 |
+
'tr' => 'AddThis\'ta paylaş',
|
57 |
+
'zh' => '在AddThis上分享',
|
58 |
+
);
|
59 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
60 |
+
// Fetch share counts.
|
61 |
+
$addthis = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'http://api-public.addthis.com/url/shares.json?url=' . $post_url ) ) );
|
62 |
+
$addthis_json = json_decode( $addthis, true );
|
63 |
+
|
64 |
+
// Store results, if we have some, else record errors, if enabled (e.g. request from the status tab).
|
65 |
+
if ( isset( $addthis_json['shares'] ) ) {
|
66 |
+
$share_counts['addthis'] = intval( $addthis_json['shares'] );
|
67 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
68 |
+
$service_errors['addthis'] = $addthis;
|
69 |
+
}
|
70 |
+
} // End if Frontend or Backend.
|
services/shariff-bitcoin.php
CHANGED
@@ -1,41 +1,50 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
-
//
|
10 |
$service_url = esc_url( plugins_url( '../', __FILE__ ) . 'bitcoin.php' );
|
11 |
|
12 |
-
//
|
13 |
-
if ( array_key_exists( 'bitcoinaddress', $atts ) )
|
14 |
-
|
|
|
|
|
|
|
15 |
|
16 |
-
//
|
17 |
$button_url = $service_url . '?bitcoinaddress=' . $bitcoinaddress;
|
18 |
|
19 |
-
//
|
20 |
-
$
|
21 |
-
|
22 |
-
// colors
|
23 |
-
$main_color = '#f7931a';
|
24 |
$secondary_color = '#191919';
|
25 |
|
26 |
-
//
|
|
|
|
|
|
|
27 |
$button_text_array = array(
|
28 |
'de' => 'spenden',
|
29 |
'en' => 'donate',
|
30 |
'fr' => 'faire un don',
|
31 |
-
'es' => 'donar'
|
32 |
);
|
33 |
|
34 |
-
//
|
35 |
$button_title_array = array(
|
36 |
'de' => 'Spenden mit Bitcoin',
|
37 |
'en' => 'Donate with Bitcoin',
|
38 |
'fr' => 'Faire un don via Bitcoin',
|
39 |
-
'es' => 'Donar via Bitcoin'
|
40 |
);
|
41 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Bitcoin is selected as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevents direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
$service_url = esc_url( plugins_url( '../', __FILE__ ) . 'bitcoin.php' );
|
17 |
|
18 |
+
// Bitcoin address.
|
19 |
+
if ( array_key_exists( 'bitcoinaddress', $atts ) ) {
|
20 |
+
$bitcoinaddress = esc_html( $atts['bitcoinaddress'] );
|
21 |
+
} else {
|
22 |
+
$bitcoinaddress = '';
|
23 |
+
}
|
24 |
|
25 |
+
// Build button URL.
|
26 |
$button_url = $service_url . '?bitcoinaddress=' . $bitcoinaddress;
|
27 |
|
28 |
+
// Colors.
|
29 |
+
$main_color = '#f7931a';
|
|
|
|
|
|
|
30 |
$secondary_color = '#191919';
|
31 |
|
32 |
+
// SVG icon.
|
33 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23 32"><path fill="' . $main_color . '" d="M20.8 11.4q0.3 3.3-2.3 4.6 2.1 0.5 3.1 1.8t0.8 3.8q-0.1 1.3-0.6 2.2t-1.2 1.6-1.7 1-2.2 0.6-2.6 0.3v4.6h-2.7v-4.5q-1.4 0-2.2 0v4.5h-2.7v-4.6q-0.3 0-1 0t-1 0h-3.6l0.6-3.3h2q0.9 0 1-0.9v-7.2h0.3q-0.1 0-0.3 0v-5.1q-0.2-1.2-1.6-1.2h-2v-2.9l3.8 0q1.1 0 1.7 0v-4.5h2.8v4.4q1.5 0 2.2 0v-4.4h2.8v4.5q1.4 0.1 2.5 0.4t2 0.8 1.5 1.4 0.7 2zM17 21.2q0-0.6-0.3-1.1t-0.7-0.8-1-0.5-1.2-0.3-1.3-0.2-1.2-0.1-1.2 0-0.8 0v6q0.1 0 0.7 0t0.9 0 0.9 0 1-0.1 1-0.2 1-0.2 0.8-0.4 0.7-0.5 0.4-0.7 0.2-0.9zM15.7 12.7q0-0.6-0.2-1t-0.5-0.7-0.9-0.5-1-0.3-1.1-0.1-1 0-1 0-0.7 0v5.5q0.1 0 0.6 0t0.8 0 0.9 0 1-0.1 0.9-0.2 0.9-0.3 0.7-0.5 0.5-0.7 0.2-0.9z"/></svg>';
|
34 |
+
|
35 |
+
// Button text label.
|
36 |
$button_text_array = array(
|
37 |
'de' => 'spenden',
|
38 |
'en' => 'donate',
|
39 |
'fr' => 'faire un don',
|
40 |
+
'es' => 'donar',
|
41 |
);
|
42 |
|
43 |
+
// Button alt label.
|
44 |
$button_title_array = array(
|
45 |
'de' => 'Spenden mit Bitcoin',
|
46 |
'en' => 'Donate with Bitcoin',
|
47 |
'fr' => 'Faire un don via Bitcoin',
|
48 |
+
'es' => 'Donar via Bitcoin',
|
49 |
);
|
50 |
}
|
services/shariff-diaspora.php
CHANGED
@@ -1,27 +1,56 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
//
|
5 |
-
if ( ! class_exists('WP') ) {
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
-
//
|
10 |
$service_url = esc_url( 'https://share.diasporafoundation.org/' );
|
11 |
|
12 |
-
//
|
13 |
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
|
14 |
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
// colors
|
19 |
-
$main_color = '#999';
|
20 |
$secondary_color = '#b3b3b3';
|
21 |
|
22 |
-
//
|
|
|
|
|
|
|
23 |
$button_title_array = array(
|
|
|
|
|
|
|
24 |
'de' => 'Bei Diaspora teilen',
|
25 |
'en' => 'Share on Diaspora',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
);
|
27 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Diaspora is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
$service_url = esc_url( 'https://share.diasporafoundation.org/' );
|
17 |
|
18 |
+
// Build button URL.
|
19 |
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
|
20 |
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#999';
|
|
|
|
|
|
|
23 |
$secondary_color = '#b3b3b3';
|
24 |
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 33 32"><path fill="' . $main_color . '" d="M20.6 28.2c-0.8-1.2-2.1-2.9-2.9-4-0.8-1.1-1.4-1.9-1.4-1.9s-1.2 1.6-2.8 3.8c-1.5 2.1-2.8 3.8-2.8 3.8 0 0-5.5-3.9-5.5-3.9 0 0 1.2-1.8 2.8-4s2.8-4 2.8-4.1c0-0.1-0.5-0.2-4.4-1.5-2.4-0.8-4.4-1.5-4.4-1.5 0 0 0.2-0.8 1-3.2 0.6-1.8 1-3.2 1.1-3.3s2.1 0.6 4.6 1.5c2.5 0.8 4.6 1.5 4.6 1.5s0.1 0 0.1-0.1c0 0 0-2.2 0-4.8s0-4.7 0.1-4.7c0 0 0.7 0 3.3 0 1.8 0 3.3 0 3.4 0 0 0 0.1 1.4 0.2 4.6 0.1 5.2 0.1 5.3 0.2 5.3 0 0 2-0.7 4.5-1.5s4.4-1.5 4.4-1.5c0 0.1 2 6.5 2 6.5 0 0-2 0.7-4.5 1.5-3.4 1.1-4.5 1.5-4.5 1.6 0 0 1.2 1.8 2.6 3.9 1.5 2.1 2.6 3.9 2.6 3.9 0 0-5.4 4-5.5 4 0 0-0.7-0.9-1.5-2.1z"/></svg>';
|
27 |
+
|
28 |
+
// Button alt label.
|
29 |
$button_title_array = array(
|
30 |
+
'bg' => 'Сподели в Diaspora',
|
31 |
+
'cs' => 'Sdílet na Diaspora',
|
32 |
+
'da' => 'Del på Diaspora',
|
33 |
'de' => 'Bei Diaspora teilen',
|
34 |
'en' => 'Share on Diaspora',
|
35 |
+
'es' => 'Compartir en Diaspora',
|
36 |
+
'fi' => 'Jaa Diasporaissä',
|
37 |
+
'fr' => 'Partager sur Diaspora',
|
38 |
+
'hr' => 'Podijelite na Diaspora',
|
39 |
+
'hu' => 'Megosztás Diaspora',
|
40 |
+
'it' => 'Condividi su Diaspora',
|
41 |
+
'ja' => 'Diaspora上で共有',
|
42 |
+
'ko' => 'Diaspora에서 공유하기',
|
43 |
+
'nl' => 'Delen op Diaspora',
|
44 |
+
'no' => 'Del på Diaspora',
|
45 |
+
'pl' => 'Udostępnij przez Diaspora',
|
46 |
+
'pt' => 'Compartilhar no Diaspora',
|
47 |
+
'ro' => 'Partajează pe Diaspora',
|
48 |
+
'ru' => 'Поделиться на Diaspora',
|
49 |
+
'sk' => 'Zdieľať na Diaspora',
|
50 |
+
'sl' => 'Deli na Diaspora',
|
51 |
+
'sr' => 'Podeli na Diaspora-u',
|
52 |
+
'sv' => 'Dela på Diaspora',
|
53 |
+
'tr' => 'Diaspora\'ta paylaş',
|
54 |
+
'zh' => '分享至Diaspora',
|
55 |
);
|
56 |
}
|
services/shariff-facebook.php
CHANGED
@@ -1,96 +1,102 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
//
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
//
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
$
|
69 |
-
|
70 |
-
$
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
$
|
75 |
-
|
76 |
-
$nofbid = '
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
$share_counts['facebook'] = '
|
91 |
-
}
|
92 |
-
|
93 |
-
elseif ( isset( $
|
94 |
-
$
|
95 |
-
}
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Facebook is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://www.facebook.com/sharer/sharer.php' );
|
17 |
+
|
18 |
+
// Build the button URL.
|
19 |
+
$button_url = $service_url . '?u=' . $share_url;
|
20 |
+
|
21 |
+
// Set the Colors (Hexadecimal including the #).
|
22 |
+
$main_color = '#3b5998';
|
23 |
+
$secondary_color = '#4273c8';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 32"><path fill="' . $main_color . '" d="M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 1;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели във Facebook',
|
34 |
+
'cs' => 'Sdílet na Facebooku',
|
35 |
+
'da' => 'Del på Facebook',
|
36 |
+
'de' => 'Bei Facebook teilen',
|
37 |
+
'en' => 'Share on Facebook',
|
38 |
+
'es' => 'Compartir en Facebook',
|
39 |
+
'fi' => 'Jaa Facebookissa',
|
40 |
+
'fr' => 'Partager sur Facebook',
|
41 |
+
'hr' => 'Podijelite na Facebooku',
|
42 |
+
'hu' => 'Megosztás Facebookon',
|
43 |
+
'it' => 'Condividi su Facebook',
|
44 |
+
'ja' => 'フェイスブック上で共有',
|
45 |
+
'ko' => '페이스북에서 공유하기',
|
46 |
+
'nl' => 'Delen op Facebook',
|
47 |
+
'no' => 'Del på Facebook',
|
48 |
+
'pl' => 'Udostępnij na Facebooku',
|
49 |
+
'pt' => 'Compartilhar no Facebook',
|
50 |
+
'ro' => 'Partajează pe Facebook',
|
51 |
+
'ru' => 'Поделиться на Facebook',
|
52 |
+
'sk' => 'Zdieľať na Facebooku',
|
53 |
+
'sl' => 'Deli na Facebooku',
|
54 |
+
'sr' => 'Podeli na Facebook-u',
|
55 |
+
'sv' => 'Dela på Facebook',
|
56 |
+
'tr' => 'Facebook\'ta paylaş',
|
57 |
+
'zh' => '在Facebook上分享',
|
58 |
+
);
|
59 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
60 |
+
// Use the FB ID and Secret, if available, else use the normal way.
|
61 |
+
if ( isset( $shariff3uu['fb_id'] ) && isset( $shariff3uu['fb_secret'] ) ) {
|
62 |
+
// On 32-bit PHP installations the constant is 4 and we have to disable the check because the id is too long.
|
63 |
+
if ( ( defined( PHP_INT_SIZE ) && PHP_INT_SIZE === '4' ) || ! defined( PHP_INT_SIZE ) ) {
|
64 |
+
$fb_app_id = $shariff3uu['fb_id'];
|
65 |
+
} else {
|
66 |
+
$fb_app_id = absint( $shariff3uu['fb_id'] );
|
67 |
+
}
|
68 |
+
$fb_app_secret = sanitize_text_field( $shariff3uu['fb_secret'] );
|
69 |
+
// Create the FB access token.
|
70 |
+
$fb_token = $fb_app_id . '|' . $fb_app_secret;
|
71 |
+
// Use the token to get the share counts.
|
72 |
+
$facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/v2.12/?access_token=' . $fb_token . '&fields=engagement&id=' . $post_url ) ) );
|
73 |
+
// Decode the json response.
|
74 |
+
$facebook_json = json_decode( $facebook, true );
|
75 |
+
// Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided.
|
76 |
+
$nofbid = '0';
|
77 |
+
} else {
|
78 |
+
$facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/?id=' . $post_url ) ) );
|
79 |
+
// Decode the json response.
|
80 |
+
$facebook_json = json_decode( $facebook, true );
|
81 |
+
// Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided.
|
82 |
+
$nofbid = 1;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Stores results - uses engagement (Graph API 2.12) if it exists, otherwise uses share_count - ordered based on proximity of occurrence.
|
87 |
+
* Records errors, if enabled (e.g. request from the status tab).
|
88 |
+
*/
|
89 |
+
if ( isset( $facebook_json['engagement'] ) && isset( $facebook_json['engagement']['share_count'] ) ) {
|
90 |
+
$share_counts['facebook'] = intval( $facebook_json['engagement']['reaction_count'] ) + intval( $facebook_json['engagement']['comment_count'] ) + intval( $facebook_json['engagement']['share_count'] ) + intval( $facebook_json['engagement']['comment_plugin_count'] );
|
91 |
+
} elseif ( isset( $facebook_json['share'] ) && isset( $facebook_json['share']['share_count'] ) ) {
|
92 |
+
$share_counts['facebook'] = intval( $facebook_json['share']['share_count'] );
|
93 |
+
} elseif ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['total_count'] ) ) {
|
94 |
+
$share_counts['facebook'] = intval( $facebook_json['data'][0]['total_count'] );
|
95 |
+
} elseif ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['share_count'] ) ) {
|
96 |
+
$share_counts['facebook'] = intval( $facebook_json['data'][0]['share_count'] );
|
97 |
+
} elseif ( isset( $facebook_json['id'] ) && ! isset( $facebook_json['error'] ) && 1 === $nofbid ) {
|
98 |
+
$share_counts['facebook'] = '0';
|
99 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
100 |
+
$service_errors['facebook'] = $facebook;
|
101 |
+
}
|
102 |
+
}; // End if backend.
|
services/shariff-flattr.php
CHANGED
@@ -1,66 +1,71 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
//
|
40 |
-
$
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Flattr is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://flattr.com/submit/auto' );
|
17 |
+
|
18 |
+
// Lang tag.
|
19 |
+
if ( isset( $atts['lang'] ) ) {
|
20 |
+
$lang = $atts['lang'] . '_' . strtoupper( $atts['lang'] );
|
21 |
+
} else {
|
22 |
+
$lang = 'en_US';
|
23 |
+
}
|
24 |
+
|
25 |
+
// Flattr user.
|
26 |
+
if ( array_key_exists( 'flattruser', $atts ) ) {
|
27 |
+
$flattruser = esc_html( $atts['flattruser'] );
|
28 |
+
} else {
|
29 |
+
$flattruser = '';
|
30 |
+
}
|
31 |
+
|
32 |
+
// Build button URL.
|
33 |
+
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title . '&language=' . $lang . '&fid=' . $flattruser;
|
34 |
+
|
35 |
+
// Colors.
|
36 |
+
$main_color = '#7ea352';
|
37 |
+
$secondary_color = '#F67C1A';
|
38 |
+
|
39 |
+
// SVG icon.
|
40 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31 32"><path fill="' . $main_color . '" d="M0 28.4v-16.4q0-5.7 2.7-8.9t8.3-3.2h17.5q-0.2 0.2-1.7 1.7t-3.2 3.2-3.5 3.5-3 3-1.3 1.2q-0.5 0-0.5-0.5v-5h-1.5q-1.9 0-3 0.2t-2 0.8-1.2 1.8-0.4 3.1v8.4zM2.1 32.1q0.2-0.2 1.7-1.7t3.2-3.2 3.5-3.5 3-3 1.3-1.2q0.5 0 0.5 0.5v5h1.5q3.7 0 5.2-1.2t1.4-4.8v-8.4l7.2-7.1v16.4q0 5.7-2.7 8.9t-8.3 3.2h-17.5z"/></svg>';
|
41 |
+
|
42 |
+
// Backend available?
|
43 |
+
$backend_available = 1;
|
44 |
+
|
45 |
+
// Button text label.
|
46 |
+
$button_text_array = array(
|
47 |
+
'de' => 'flattr',
|
48 |
+
'en' => 'flattr',
|
49 |
+
);
|
50 |
+
|
51 |
+
// Button alt label.
|
52 |
+
$button_title_array = array(
|
53 |
+
'de' => 'Beitrag flattrn!',
|
54 |
+
'en' => 'Flattr this!',
|
55 |
+
'fr' => 'Flattré!',
|
56 |
+
'es' => 'Flattr!',
|
57 |
+
);
|
58 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
59 |
+
// Fetch counts.
|
60 |
+
$flattr = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://api.flattr.com/rest/v2/things/lookup/?url=' . $post_url ) ) );
|
61 |
+
$flattr_json = json_decode( $flattr, true );
|
62 |
+
|
63 |
+
// Store results, if we have some. If no thing was found, set it to 0. Record errors, if enabled (e.g. request from the status tab).
|
64 |
+
if ( isset( $flattr_json['flattrs'] ) ) {
|
65 |
+
$share_counts['flattr'] = intval( $flattr_json['flattrs'] );
|
66 |
+
} elseif ( isset( $flattr_json['description'] ) && 'No thing was found' === $flattr_json['description'] ) {
|
67 |
+
$share_counts['flattr'] = 0;
|
68 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
69 |
+
$service_errors['flattr'] = $flattr;
|
70 |
+
}
|
71 |
+
}
|
services/shariff-flipboard.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Flipboard is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://share.flipboard.com/bookmarklet/popout' );
|
17 |
+
|
18 |
+
// Build the button URL.
|
19 |
+
$button_url = $service_url . '?v=2&title=' . $share_title . '&url=' . $share_url;
|
20 |
+
|
21 |
+
// Set the Colors (Hexadecimal including the #).
|
22 |
+
$main_color = '#f52828';
|
23 |
+
$secondary_color = '#373737';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="24px" height="24px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="' . $main_color . '" d="M0 0h8v24H0V0zm9 9h7v7H9V9zm0-9h15v8H9V0z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 0;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели в Flipboard',
|
34 |
+
'cs' => 'Sdílet na Flipboardu',
|
35 |
+
'da' => 'Del på Flipboard',
|
36 |
+
'de' => 'Bei Flipboard teilen',
|
37 |
+
'en' => 'Share on Flipboard',
|
38 |
+
'es' => 'Compartir en Flipboard',
|
39 |
+
'fi' => 'Jaa Flipboardissä',
|
40 |
+
'fr' => 'Partager sur Flipboard',
|
41 |
+
'hr' => 'Podijelite na Flipboardu',
|
42 |
+
'hu' => 'Megosztás Flipboardon',
|
43 |
+
'it' => 'Condividi su Flipboard',
|
44 |
+
'ja' => 'Flipboard上で共有',
|
45 |
+
'ko' => 'Flipboard에서 공유하기',
|
46 |
+
'nl' => 'Delen op Flipboard',
|
47 |
+
'no' => 'Del på Flipboard',
|
48 |
+
'pl' => 'Udostępnij na Flipboardu',
|
49 |
+
'pt' => 'Compartilhar no Flipboard',
|
50 |
+
'ro' => 'Partajează pe Flipboard',
|
51 |
+
'ru' => 'Поделиться на Flipboard',
|
52 |
+
'sk' => 'Zdieľať na Flipboardu',
|
53 |
+
'sl' => 'Deli na Flipboardu',
|
54 |
+
'sr' => 'Podeli na Flipboard-u',
|
55 |
+
'sv' => 'Dela på Flipboard',
|
56 |
+
'tr' => 'Flipboard\'ta paylaş',
|
57 |
+
'zh' => '在Flipboard上分享',
|
58 |
+
);
|
59 |
+
}
|
services/shariff-googleplus.php
CHANGED
@@ -1,94 +1,59 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
//
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
//
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
'
|
34 |
-
'
|
35 |
-
'
|
36 |
-
'
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
44 |
-
'
|
45 |
-
'
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
-
'
|
50 |
-
'
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
'
|
58 |
-
|
59 |
-
|
60 |
-
'nolog' => 'true',
|
61 |
-
'id' => $post_url2,
|
62 |
-
'source' => 'widget',
|
63 |
-
'userId' => '@viewer',
|
64 |
-
'groupId' => '@self'
|
65 |
-
),
|
66 |
-
'jsonrpc' => '2.0',
|
67 |
-
'key' => 'p',
|
68 |
-
'apiVersion' => 'v1'
|
69 |
-
);
|
70 |
-
|
71 |
-
// set post options
|
72 |
-
$google_post_options = array(
|
73 |
-
'method' => 'POST',
|
74 |
-
'timeout' => 5,
|
75 |
-
'redirection' => 5,
|
76 |
-
'httpversion' => '1.0',
|
77 |
-
'blocking' => true,
|
78 |
-
'headers' => array( 'content-type' => 'application/json' ),
|
79 |
-
'body' => json_encode( $google_options )
|
80 |
-
);
|
81 |
-
|
82 |
-
// fetch counts
|
83 |
-
$googleplus = sanitize_text_field( wp_remote_retrieve_body( wp_remote_post( 'https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ', $google_post_options ) ) );
|
84 |
-
$google_json = json_decode( $googleplus, true );
|
85 |
-
|
86 |
-
// store results, if we have some
|
87 |
-
if ( isset( $google_json['result']['metadata']['globalCounts']['count'] ) ) {
|
88 |
-
$share_counts['googleplus'] = intval( $google_json['result']['metadata']['globalCounts']['count'] );
|
89 |
-
}
|
90 |
-
// record errors, if enabled (e.g. request from the status tab)
|
91 |
-
elseif ( isset( $record_errors ) && $record_errors == '1' ) {
|
92 |
-
$service_errors['googleplus'] = $googleplus;
|
93 |
-
}
|
94 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when GooglePlus is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://plus.google.com/share' );
|
17 |
+
|
18 |
+
// Build the button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url;
|
20 |
+
|
21 |
+
// Set the Colors (Hexadecimal including the #).
|
22 |
+
$main_color = '#d34836';
|
23 |
+
$secondary_color = '#f75b44';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M31.6 14.7h-3.3v-3.3h-2.6v3.3h-3.3v2.6h3.3v3.3h2.6v-3.3h3.3zM10.8 14v4.1h5.7c-0.4 2.4-2.6 4.2-5.7 4.2-3.4 0-6.2-2.9-6.2-6.3s2.8-6.3 6.2-6.3c1.5 0 2.9 0.5 4 1.6v0l2.9-2.9c-1.8-1.7-4.2-2.7-7-2.7-5.8 0-10.4 4.7-10.4 10.4s4.7 10.4 10.4 10.4c6 0 10-4.2 10-10.2 0-0.8-0.1-1.5-0.2-2.2 0 0-9.8 0-9.8 0z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 0;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели в Google+',
|
34 |
+
'cs' => 'Sdílet na Google+',
|
35 |
+
'da' => 'Del på Google+',
|
36 |
+
'de' => 'Bei Google+ teilen',
|
37 |
+
'en' => 'Share on Google+',
|
38 |
+
'es' => 'Compartir en Google+',
|
39 |
+
'fi' => 'Jaa Google+ =>ssa',
|
40 |
+
'fr' => 'Partager sur Goolge+',
|
41 |
+
'hr' => 'Podijelite na Google+',
|
42 |
+
'hu' => 'Megosztás Google+on',
|
43 |
+
'it' => 'Condividi su Google+',
|
44 |
+
'ja' => 'Google+上で共有',
|
45 |
+
'ko' => 'Google+에서 공유하기',
|
46 |
+
'nl' => 'Delen op Google+',
|
47 |
+
'no' => 'Del på Google+',
|
48 |
+
'pl' => 'Udostępnij na Google+',
|
49 |
+
'pt' => 'Compartilhar no Google+',
|
50 |
+
'ro' => 'Partajează pe Google+',
|
51 |
+
'ru' => 'Поделиться на Google+',
|
52 |
+
'sk' => 'Zdieľať na Google+',
|
53 |
+
'sl' => 'Deli na Google+',
|
54 |
+
'sr' => 'Podeli na Google+',
|
55 |
+
'sv' => 'Dela på Google+',
|
56 |
+
'tr' => 'Google+\'da paylaş',
|
57 |
+
'zh' => '在Google+上分享',
|
58 |
+
);
|
59 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
services/shariff-info.php
CHANGED
@@ -1,46 +1,70 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
'
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Info is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Set custom info url or default one.
|
16 |
+
if ( array_key_exists( 'info_url', $atts ) ) {
|
17 |
+
$service_url = esc_url( $atts['info_url'] );
|
18 |
+
} else {
|
19 |
+
$service_url = esc_url( 'http://ct.de/-2467514' );
|
20 |
+
}
|
21 |
+
|
22 |
+
// Build button URL.
|
23 |
+
$button_url = $service_url;
|
24 |
+
|
25 |
+
// Colors.
|
26 |
+
$main_color = '#999';
|
27 |
+
$secondary_color = '#a8a8a8';
|
28 |
+
|
29 |
+
// SVG icon.
|
30 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11 32"><path fill="' . $main_color . '" d="M11.4 24v2.3q0 0.5-0.3 0.8t-0.8 0.4h-9.1q-0.5 0-0.8-0.4t-0.4-0.8v-2.3q0-0.5 0.4-0.8t0.8-0.4h1.1v-6.8h-1.1q-0.5 0-0.8-0.4t-0.4-0.8v-2.3q0-0.5 0.4-0.8t0.8-0.4h6.8q0.5 0 0.8 0.4t0.4 0.8v10.3h1.1q0.5 0 0.8 0.4t0.3 0.8zM9.2 3.4v3.4q0 0.5-0.4 0.8t-0.8 0.4h-4.6q-0.4 0-0.8-0.4t-0.4-0.8v-3.4q0-0.4 0.4-0.8t0.8-0.4h4.6q0.5 0 0.8 0.4t0.4 0.8z"/></svg>';
|
31 |
+
|
32 |
+
// Button text label.
|
33 |
+
$button_text_array = array(
|
34 |
+
'de' => 'info',
|
35 |
+
'en' => 'info',
|
36 |
+
);
|
37 |
+
|
38 |
+
// Button alt label.
|
39 |
+
if ( array_key_exists( 'info_text', $atts ) ) {
|
40 |
+
$button_title_array = array( 'en' => $atts['info_text'] );
|
41 |
+
} else {
|
42 |
+
$button_title_array = array(
|
43 |
+
'bg' => 'Повече информация',
|
44 |
+
'cs' => 'Více informací',
|
45 |
+
'da' => 'Flere oplysninger',
|
46 |
+
'de' => 'Weitere Informationen',
|
47 |
+
'en' => 'More information',
|
48 |
+
'es' => 'Más informaciones',
|
49 |
+
'fi' => 'Lisätietoja',
|
50 |
+
'fr' => 'Plus d\'informations',
|
51 |
+
'hr' => 'Više informacija',
|
52 |
+
'hu' => 'Több információ',
|
53 |
+
'it' => 'Maggiori informazioni',
|
54 |
+
'ja' => '詳しい情報',
|
55 |
+
'ko' => '추가 정보',
|
56 |
+
'nl' => 'Verdere informatie',
|
57 |
+
'no' => 'Mer informasjon',
|
58 |
+
'pl' => 'Więcej informacji',
|
59 |
+
'pt' => 'Mais informações',
|
60 |
+
'ro' => 'Mai multe informatii',
|
61 |
+
'ru' => 'Больше информации',
|
62 |
+
'sk' => 'Viac informácií',
|
63 |
+
'sl' => 'Več informacij',
|
64 |
+
'sr' => 'Više informacija',
|
65 |
+
'sv' => 'Mer information',
|
66 |
+
'tr' => 'Daha fazla bilgi',
|
67 |
+
'zh' => '更多信息',
|
68 |
+
);
|
69 |
+
}
|
70 |
+
}
|
services/shariff-linkedin.php
CHANGED
@@ -1,93 +1,97 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
//
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
//
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
'
|
34 |
-
'
|
35 |
-
'
|
36 |
-
'
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
44 |
-
'
|
45 |
-
'
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
'
|
54 |
-
'
|
55 |
-
'
|
56 |
-
'
|
57 |
-
'
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
'
|
62 |
-
'
|
63 |
-
'
|
64 |
-
'
|
65 |
-
'
|
66 |
-
'
|
67 |
-
'
|
68 |
-
'
|
69 |
-
'
|
70 |
-
'
|
71 |
-
'
|
72 |
-
'
|
73 |
-
'
|
74 |
-
'
|
75 |
-
'
|
76 |
-
'
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when LinedIn is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://www.linkedin.com/shareArticle?mini=true' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '&url=' . $share_url . '&title=' . $share_title;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#0077b5';
|
23 |
+
$secondary_color = '#1488bf';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 32"><path fill="' . $main_color . '" d="M6.2 11.2v17.7h-5.9v-17.7h5.9zM6.6 5.7q0 1.3-0.9 2.2t-2.4 0.9h0q-1.5 0-2.4-0.9t-0.9-2.2 0.9-2.2 2.4-0.9 2.4 0.9 0.9 2.2zM27.4 18.7v10.1h-5.9v-9.5q0-1.9-0.7-2.9t-2.3-1.1q-1.1 0-1.9 0.6t-1.2 1.5q-0.2 0.5-0.2 1.4v9.9h-5.9q0-7.1 0-11.6t0-5.3l0-0.9h5.9v2.6h0q0.4-0.6 0.7-1t1-0.9 1.6-0.8 2-0.3q3 0 4.9 2t1.9 6z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 1;
|
30 |
+
|
31 |
+
// Button text label.
|
32 |
+
$button_text_array = array(
|
33 |
+
'bg' => 'cподеляне',
|
34 |
+
'cs' => 'sdílet',
|
35 |
+
'da' => 'del',
|
36 |
+
'de' => 'mitteilen',
|
37 |
+
'en' => 'share',
|
38 |
+
'es' => 'compartir',
|
39 |
+
'fi' => 'Jaa',
|
40 |
+
'fr' => 'partager',
|
41 |
+
'hr' => 'podijelite',
|
42 |
+
'hu' => 'megosztás',
|
43 |
+
'it' => 'condividi',
|
44 |
+
'ja' => 'シェア',
|
45 |
+
'ko' => '공유하기',
|
46 |
+
'nl' => 'delen',
|
47 |
+
'no' => 'del',
|
48 |
+
'pl' => 'udostępnij',
|
49 |
+
'pt' => 'compartilhar',
|
50 |
+
'ro' => 'distribuiți',
|
51 |
+
'ru' => 'поделиться',
|
52 |
+
'sk' => 'zdieľať',
|
53 |
+
'sl' => 'deli',
|
54 |
+
'sr' => 'podeli',
|
55 |
+
'sv' => 'dela',
|
56 |
+
'tr' => 'paylaş',
|
57 |
+
'zh' => '分享',
|
58 |
+
);
|
59 |
+
// Button alt label.
|
60 |
+
$button_title_array = array(
|
61 |
+
'bg' => 'Сподели в LinkedIn',
|
62 |
+
'cs' => 'Sdílet na LinkedIn',
|
63 |
+
'da' => 'Del på LinkedIn',
|
64 |
+
'de' => 'Bei LinkedIn teilen',
|
65 |
+
'en' => 'Share on LinkedIn',
|
66 |
+
'es' => 'Compartir en LinkedIn',
|
67 |
+
'fi' => 'Jaa LinkedInissä',
|
68 |
+
'fr' => 'Partager sur LinkedIn',
|
69 |
+
'hr' => 'Podijelite na LinkedIn',
|
70 |
+
'hu' => 'Megosztás LinkedInen',
|
71 |
+
'it' => 'Condividi su LinkedIn',
|
72 |
+
'ja' => 'LinkedIn上で共有',
|
73 |
+
'ko' => 'LinkedIn에서 공유하기',
|
74 |
+
'nl' => 'Delen op LinkedIn',
|
75 |
+
'no' => 'Del på LinkedIn',
|
76 |
+
'pl' => 'Udostępnij przez LinkedIn',
|
77 |
+
'pt' => 'Compartilhar no LinkedIn',
|
78 |
+
'ro' => 'Partajează pe LinkedIn',
|
79 |
+
'ru' => 'Поделиться на LinkedIn',
|
80 |
+
'sk' => 'Zdieľať na LinkedIn',
|
81 |
+
'sl' => 'Deli na LinkedIn',
|
82 |
+
'sr' => 'Podeli na LinkedIn-u',
|
83 |
+
'sv' => 'Dela på LinkedIn',
|
84 |
+
'tr' => 'LinkedIn\'ta paylaş',
|
85 |
+
'zh' => '在LinkedIn上分享',
|
86 |
+
);
|
87 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
88 |
+
// Fetch counts.
|
89 |
+
$linkedin = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://www.linkedin.com/countserv/count/share?url=' . $post_url . '&format=json' ) ) );
|
90 |
+
$linkedin_json = json_decode( $linkedin, true );
|
91 |
+
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
|
92 |
+
if ( isset( $linkedin_json['count'] ) ) {
|
93 |
+
$share_counts['linkedin'] = intval( $linkedin_json['count'] );
|
94 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
95 |
+
$service_errors['linkedin'] = $linkedin;
|
96 |
+
}
|
97 |
+
}
|
services/shariff-mailform.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Mailform
|
3 |
-
|
4 |
-
// prevent direct calls
|
5 |
-
if ( ! class_exists('WP') ) { die(); }
|
6 |
-
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend == '1' ) {
|
9 |
-
|
10 |
-
// build button url
|
11 |
-
$button_url = urldecode( $share_url ) . '?view=mail';
|
12 |
-
|
13 |
-
// add anchor if option is set
|
14 |
-
if ( isset( $shariff3UU["mailform_anchor"] ) && $shariff3UU["mailform_anchor"] == '1' ) {
|
15 |
-
$button_url .= '#shariff_mailform';
|
16 |
-
}
|
17 |
-
|
18 |
-
// svg icon
|
19 |
-
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M32 12.7v14.2q0 1.2-0.8 2t-2 0.9h-26.3q-1.2 0-2-0.9t-0.8-2v-14.2q0.8 0.9 1.8 1.6 6.5 4.4 8.9 6.1 1 0.8 1.6 1.2t1.7 0.9 2 0.4h0.1q0.9 0 2-0.4t1.7-0.9 1.6-1.2q3-2.2 8.9-6.1 1-0.7 1.8-1.6zM32 7.4q0 1.4-0.9 2.7t-2.2 2.2q-6.7 4.7-8.4 5.8-0.2 0.1-0.7 0.5t-1 0.7-0.9 0.6-1.1 0.5-0.9 0.2h-0.1q-0.4 0-0.9-0.2t-1.1-0.5-0.9-0.6-1-0.7-0.7-0.5q-1.6-1.1-4.7-3.2t-3.6-2.6q-1.1-0.7-2.1-2t-1-2.5q0-1.4 0.7-2.3t2.1-0.9h26.3q1.2 0 2 0.8t0.9 2z"/></svg>';
|
20 |
-
|
21 |
-
// same window?
|
22 |
-
$same_window = '1';
|
23 |
-
|
24 |
-
// colors
|
25 |
-
$main_color = '#999';
|
26 |
-
$secondary_color = '#a8a8a8';
|
27 |
-
|
28 |
-
// button share text
|
29 |
-
$button_text_array = array(
|
30 |
-
'bg' => 'имейл',
|
31 |
-
'da' => 'e-mail',
|
32 |
-
'de' => 'e-mail',
|
33 |
-
'en' => 'e-mail',
|
34 |
-
'es' => 'emilio',
|
35 |
-
'fi' => 'sähköpostitse',
|
36 |
-
'fr' => 'courriel',
|
37 |
-
'hr' => 'e-pošta',
|
38 |
-
'hu' => 'e-mail',
|
39 |
-
'it' => 'e-mail',
|
40 |
-
'ja' => 'e-mail',
|
41 |
-
'ko' => 'e-mail',
|
42 |
-
'nl' => 'e-mail',
|
43 |
-
'no' => 'e-post',
|
44 |
-
'pl' => 'e-mail',
|
45 |
-
'pt' => 'e-mail',
|
46 |
-
'ro' => 'e-mail',
|
47 |
-
'ru' => 'e-mail',
|
48 |
-
'sk' => 'e-mail',
|
49 |
-
'sl' => 'e-mail',
|
50 |
-
'sr' => 'e-mail',
|
51 |
-
'sv' => 'e-post',
|
52 |
-
'tr' => 'e-posta',
|
53 |
-
'zh' => 'e-mail'
|
54 |
-
);
|
55 |
-
|
56 |
-
// button title / label
|
57 |
-
$button_title_array = array(
|
58 |
-
'bg' => 'Изпрати по имейл',
|
59 |
-
'da' => 'Sende via e-mail',
|
60 |
-
'de' => 'Per E-Mail versenden',
|
61 |
-
'en' => 'Send by email',
|
62 |
-
'es' => 'Enviar por email',
|
63 |
-
'fi' => 'Lähetä sähköpostitse',
|
64 |
-
'fr' => 'Envoyer par courriel',
|
65 |
-
'hr' => 'Pošaljite emailom',
|
66 |
-
'hu' => 'Elküldés e-mailben',
|
67 |
-
'it' => 'Inviare via e-mail',
|
68 |
-
'ja' => '電子メールで送信',
|
69 |
-
'ko' => '이메일로 보내기',
|
70 |
-
'nl' => 'Sturen via e-mail',
|
71 |
-
'no' => 'Send via epost',
|
72 |
-
'pl' => 'Wyślij e-mailem',
|
73 |
-
'pt' => 'Enviar por e-mail',
|
74 |
-
'ro' => 'Trimite prin e-mail',
|
75 |
-
'ru' => 'Отправить по эл. почте',
|
76 |
-
'sk' => 'Poslať e-mailom',
|
77 |
-
'sl' => 'Pošlji po elektronski pošti',
|
78 |
-
'sr' => 'Pošalji putem email-a',
|
79 |
-
'sv' => 'Skicka via e-post',
|
80 |
-
'tr' => 'E-posta ile gönder',
|
81 |
-
'zh' => '通过电子邮件传送'
|
82 |
-
);
|
83 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
services/shariff-mailto.php
CHANGED
@@ -1,26 +1,32 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
//
|
5 |
-
if ( ! class_exists('WP') ) {
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
|
10 |
-
//
|
11 |
$button_url = 'mailto:?body=' . $share_url . '&subject=' . rawurlencode( urldecode( $share_title ) );
|
12 |
|
13 |
-
//
|
14 |
-
$
|
15 |
-
|
16 |
-
// same window?
|
17 |
-
$same_window = '1';
|
18 |
-
|
19 |
-
// colors
|
20 |
-
$main_color = '#999';
|
21 |
$secondary_color = '#a8a8a8';
|
22 |
|
23 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
$button_text_array = array(
|
25 |
'bg' => 'имейл',
|
26 |
'da' => 'e-mail',
|
@@ -45,12 +51,13 @@ if ( isset( $frontend ) && $frontend == '1' ) {
|
|
45 |
'sr' => 'e-mail',
|
46 |
'sv' => 'e-post',
|
47 |
'tr' => 'e-posta',
|
48 |
-
'zh' => '
|
49 |
);
|
50 |
|
51 |
-
//
|
52 |
$button_title_array = array(
|
53 |
'bg' => 'Изпрати по имейл',
|
|
|
54 |
'da' => 'Sende via e-mail',
|
55 |
'de' => 'Per E-Mail versenden',
|
56 |
'en' => 'Send by email',
|
@@ -59,7 +66,7 @@ if ( isset( $frontend ) && $frontend == '1' ) {
|
|
59 |
'fr' => 'Envoyer par courriel',
|
60 |
'hr' => 'Pošaljite emailom',
|
61 |
'hu' => 'Elküldés e-mailben',
|
62 |
-
'it' => 'Inviare via
|
63 |
'ja' => '電子メールで送信',
|
64 |
'ko' => '이메일로 보내기',
|
65 |
'nl' => 'Sturen via e-mail',
|
@@ -73,6 +80,6 @@ if ( isset( $frontend ) && $frontend == '1' ) {
|
|
73 |
'sr' => 'Pošalji putem email-a',
|
74 |
'sv' => 'Skicka via e-post',
|
75 |
'tr' => 'E-posta ile gönder',
|
76 |
-
'zh' => '通过电子邮件传送'
|
77 |
);
|
78 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Mailto is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
|
16 |
+
// Build button URL.
|
17 |
$button_url = 'mailto:?body=' . $share_url . '&subject=' . rawurlencode( urldecode( $share_title ) );
|
18 |
|
19 |
+
// Colors.
|
20 |
+
$main_color = '#999';
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
$secondary_color = '#a8a8a8';
|
22 |
|
23 |
+
// SVG icon.
|
24 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M32 12.7v14.2q0 1.2-0.8 2t-2 0.9h-26.3q-1.2 0-2-0.9t-0.8-2v-14.2q0.8 0.9 1.8 1.6 6.5 4.4 8.9 6.1 1 0.8 1.6 1.2t1.7 0.9 2 0.4h0.1q0.9 0 2-0.4t1.7-0.9 1.6-1.2q3-2.2 8.9-6.1 1-0.7 1.8-1.6zM32 7.4q0 1.4-0.9 2.7t-2.2 2.2q-6.7 4.7-8.4 5.8-0.2 0.1-0.7 0.5t-1 0.7-0.9 0.6-1.1 0.5-0.9 0.2h-0.1q-0.4 0-0.9-0.2t-1.1-0.5-0.9-0.6-1-0.7-0.7-0.5q-1.6-1.1-4.7-3.2t-3.6-2.6q-1.1-0.7-2.1-2t-1-2.5q0-1.4 0.7-2.3t2.1-0.9h26.3q1.2 0 2 0.8t0.9 2z"/></svg>';
|
25 |
+
|
26 |
+
// Same window?
|
27 |
+
$same_window = 1;
|
28 |
+
|
29 |
+
// Button text label.
|
30 |
$button_text_array = array(
|
31 |
'bg' => 'имейл',
|
32 |
'da' => 'e-mail',
|
51 |
'sr' => 'e-mail',
|
52 |
'sv' => 'e-post',
|
53 |
'tr' => 'e-posta',
|
54 |
+
'zh' => '分享',
|
55 |
);
|
56 |
|
57 |
+
// Button alt label.
|
58 |
$button_title_array = array(
|
59 |
'bg' => 'Изпрати по имейл',
|
60 |
+
'cs' => 'Poslat mailem',
|
61 |
'da' => 'Sende via e-mail',
|
62 |
'de' => 'Per E-Mail versenden',
|
63 |
'en' => 'Send by email',
|
66 |
'fr' => 'Envoyer par courriel',
|
67 |
'hr' => 'Pošaljite emailom',
|
68 |
'hu' => 'Elküldés e-mailben',
|
69 |
+
'it' => 'Inviare via email',
|
70 |
'ja' => '電子メールで送信',
|
71 |
'ko' => '이메일로 보내기',
|
72 |
'nl' => 'Sturen via e-mail',
|
80 |
'sr' => 'Pošalji putem email-a',
|
81 |
'sv' => 'Skicka via e-post',
|
82 |
'tr' => 'E-posta ile gönder',
|
83 |
+
'zh' => '通过电子邮件传送',
|
84 |
);
|
85 |
}
|
services/shariff-mastodon.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Mastodon is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_html( 'web+mastodon://share' );
|
17 |
+
|
18 |
+
// Build the button URL.
|
19 |
+
$button_url = $service_url . '?text=' . $share_url;
|
20 |
+
|
21 |
+
// Set the Colors (Hexadecimal including the #).
|
22 |
+
$main_color = '#2b90d9';
|
23 |
+
$secondary_color = '#9baec8';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 200 200"><path fill="' . $main_color . '" d="M155 72q0-15-8-24c-5-6-12-9-20-9-10 0-18 4-23 12l-4 8-5-8c-5-8-13-12-23-12-8 0-15 3-20 9q-8 9-8 24v49h19V73c0-10 5-15 13-15 9 0 14 6 14 18v26h19V76c0-12 5-18 14-18 8 0 13 6 13 15v48h19V72l27 47c-2 13-22 28-46 30l-36 3a216 216 0 0 1-38-5 42 42 0 0 0 1 5c2 21 20 22 37 23a107 107 0 0 0 32-4v15s-11 6-32 7a137 137 0 0 1-43-4c-37-10-43-49-44-88V69c0-40 26-52 26-52 14-6 37-9 60-9h1c24 0 46 3 60 9 0 0 26 12 26 52 0 0 0 30-4 50"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 0;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели във Mastodon',
|
34 |
+
'da' => 'Del på Mastodon',
|
35 |
+
'de' => 'Bei Mastodon teilen',
|
36 |
+
'en' => 'Share on Mastodon',
|
37 |
+
'es' => 'Compartir en Mastodon',
|
38 |
+
'fi' => 'Jaa Mastodon',
|
39 |
+
'fr' => 'Partager sur Mastodon',
|
40 |
+
'hr' => 'Podijelite na Mastodon',
|
41 |
+
'hu' => 'Megosztás Mastodon',
|
42 |
+
'it' => 'Condividi su Mastodon',
|
43 |
+
'nl' => 'Delen op Mastodon',
|
44 |
+
'no' => 'Del på Mastodon',
|
45 |
+
'pl' => 'Udostępnij na Mastodon',
|
46 |
+
'pt' => 'Compartilhar no Mastodon',
|
47 |
+
'ro' => 'Partajează pe Mastodon',
|
48 |
+
'ru' => 'Поделиться на Mastodon',
|
49 |
+
'sk' => 'Zdieľať na Mastodon',
|
50 |
+
'sl' => 'Deli na Mastodon',
|
51 |
+
'sr' => 'Podeli na Mastodon',
|
52 |
+
'sv' => 'Dela på Mastodon',
|
53 |
+
'tr' => 'Mastodon\'ta paylaş',
|
54 |
+
'zh' => '在Mastodon上分享',
|
55 |
+
);
|
56 |
+
}
|
services/shariff-odnoklassniki.php
CHANGED
@@ -1,69 +1,71 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
//
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
//
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
// record errors, if enabled (e.g. request from the status tab)
|
66 |
-
|
67 |
-
$
|
68 |
-
}
|
69 |
-
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Odnoklassniki is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://www.odnoklassniki.ru/dk' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?st.cmd=addShare&st._surl=' . $share_url . '&title=' . $share_title;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#ee8208';
|
23 |
+
$secondary_color = '#f3a752';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="20" viewBox="0 0 14 20"><path fill="' . $main_color . '" d="M7.1 10.1q-2.1 0-3.6-1.5t-1.5-3.6q0-2.1 1.5-3.6t3.6-1.5 3.6 1.5 1.5 3.6q0 2.1-1.5 3.6t-3.6 1.5zM7.1 2.6q-1 0-1.8 0.7t-0.7 1.8q0 1 0.7 1.8t1.8 0.7 1.8-0.7 0.7-1.8q0-1-0.7-1.8t-1.8-0.7zM13 10.7q0.1 0.3 0.2 0.6t0 0.5-0.3 0.4-0.5 0.4-0.7 0.5q-1.3 0.8-3.5 1l0.8 0.8 3 3q0.3 0.3 0.3 0.8t-0.3 0.8l-0.1 0.1q-0.3 0.3-0.8 0.3t-0.8-0.3q-0.7-0.8-3-3l-3 3q-0.3 0.3-0.8 0.3t-0.8-0.3l-0.1-0.1q-0.3-0.3-0.3-0.8t0.3-0.8l3.8-3.8q-2.3-0.2-3.5-1-0.4-0.3-0.7-0.5t-0.5-0.4-0.3-0.4 0-0.5 0.2-0.6q0.1-0.2 0.3-0.4t0.5-0.2 0.6 0 0.7 0.4q0.1 0 0.2 0.1t0.5 0.3 0.8 0.3 1 0.3 1.3 0.1q1 0 1.9-0.3t1.3-0.6l0.4-0.3q0.4-0.3 0.7-0.4t0.6 0 0.5 0.2 0.3 0.4z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 1;
|
30 |
+
|
31 |
+
// Button text label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели във Odnoklassniki',
|
34 |
+
'da' => 'Del på Odnoklassniki',
|
35 |
+
'de' => 'Bei Odnoklassniki teilen',
|
36 |
+
'en' => 'Share on Odnoklassniki',
|
37 |
+
'es' => 'Compartir en Odnoklassniki',
|
38 |
+
'fi' => 'Jaa Odnoklassniki',
|
39 |
+
'fr' => 'Partager sur Odnoklassniki',
|
40 |
+
'hr' => 'Podijelite na Odnoklassniki',
|
41 |
+
'hu' => 'Megosztás Odnoklassniki',
|
42 |
+
'it' => 'Condividi su Odnoklassniki',
|
43 |
+
'ja' => 'Odnoklassnikiでシェア',
|
44 |
+
'ko' => '오드 노 클라스 니키 공유',
|
45 |
+
'nl' => 'Delen op Odnoklassniki',
|
46 |
+
'no' => 'Del på Odnoklassniki',
|
47 |
+
'pl' => 'Udostępnij na Odnoklassniki',
|
48 |
+
'pt' => 'Compartilhar no Odnoklassniki',
|
49 |
+
'ro' => 'Partajează pe Odnoklassniki',
|
50 |
+
'ru' => 'Поделиться на Odnoklassniki',
|
51 |
+
'sk' => 'Zdieľať na Odnoklassniki',
|
52 |
+
'sl' => 'Deli na Odnoklassniki',
|
53 |
+
'sr' => 'Podeli na Odnoklassniki',
|
54 |
+
'sv' => 'Dela på Odnoklassniki',
|
55 |
+
'tr' => 'Odnoklassniki\'ta paylaş',
|
56 |
+
'zh' => '在Odnoklassniki上分享',
|
57 |
+
);
|
58 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
59 |
+
// Fetch share counts.
|
60 |
+
$odnoklassniki = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://connect.ok.ru/dk?st.cmd=extLike&uid=odklcnt0&ref=' . $post_url ) ) );
|
61 |
+
|
62 |
+
// Check results.
|
63 |
+
preg_match( '/^ODKL\.updateCount\(\'odklcnt0\',\'(\d+)\'\);$/i', $odnoklassniki, $ok_shares );
|
64 |
+
|
65 |
+
// Store results and record errors, if enabled (e.g. request from the status tab).
|
66 |
+
if ( isset( $ok_shares ) && ! empty( $ok_shares ) ) {
|
67 |
+
$share_counts['odnoklassniki'] = intval( $ok_shares[1] );
|
68 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
69 |
+
$service_errors['odnoklassniki'] = $odnoklassniki;
|
70 |
+
}
|
71 |
+
}
|
services/shariff-patreon.php
CHANGED
@@ -1,35 +1,44 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
-
//
|
10 |
$service_url = esc_url( 'https://www.patreon.com/' );
|
11 |
|
12 |
-
//
|
13 |
-
if ( array_key_exists( 'patreonid', $atts ) )
|
14 |
-
|
|
|
|
|
|
|
15 |
|
16 |
-
//
|
17 |
$button_url = $service_url . $patreonid;
|
18 |
|
19 |
-
//
|
20 |
-
$
|
21 |
-
|
22 |
-
// colors
|
23 |
-
$main_color = '#e6461a';
|
24 |
$secondary_color = '#FF794D';
|
25 |
|
26 |
-
//
|
|
|
|
|
|
|
27 |
$button_text_array = array(
|
28 |
'de' => 'patreon',
|
29 |
-
'en' => 'patreon'
|
30 |
);
|
31 |
|
32 |
-
//
|
33 |
$button_title_array = array(
|
34 |
'de' => 'Werde ein patron!',
|
35 |
'en' => 'Become a patron!',
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Patreon is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
$service_url = esc_url( 'https://www.patreon.com/' );
|
17 |
|
18 |
+
// Patreon ID.
|
19 |
+
if ( array_key_exists( 'patreonid', $atts ) ) {
|
20 |
+
$patreonid = esc_html( $atts['patreonid'] );
|
21 |
+
} else {
|
22 |
+
$patreonid = '';
|
23 |
+
}
|
24 |
|
25 |
+
// Build button URL.
|
26 |
$button_url = $service_url . $patreonid;
|
27 |
|
28 |
+
// Colors.
|
29 |
+
$main_color = '#e6461a';
|
|
|
|
|
|
|
30 |
$secondary_color = '#FF794D';
|
31 |
|
32 |
+
// SVG icon.
|
33 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M10.4 1.5c-4.4 1.8-6.8 4.1-8.7 8.4-0.9 2-1 2.9-1.2 11.9l-0.2 9.7h3.2l0.1-9.6c0.1-8.8 0.2-9.6 1.1-11.3 1.6-2.9 3.1-4.4 5.9-5.8 3.7-1.9 7.1-1.9 10.8 0 3.1 1.5 4.6 3.1 6.1 6.5 0.9 2 1.1 2.8 0.9 5.3-0.4 4.7-2.5 8.1-6.6 10.3-2.1 1.1-2.8 1.3-5.9 1.3-2 0-3.7-0.1-3.9-0.3-0.2-0.1-0.3-1.5-0.4-3.1 0-2.5 0-2.8 0.8-2.6 3.2 0.6 5.7 0.5 7.1-0.4 4.3-2.6 4.3-9.2 0-11.8-3.1-1.9-7.7-0.8-9.6 2.3-0.8 1.3-0.9 2.2-0.9 10.3v8.9l5.4-0.2c4.7-0.1 5.7-0.3 7.8-1.3 3.5-1.6 5.8-3.9 7.5-7.3 1.3-2.6 1.4-3.3 1.4-6.9 0-3.3-0.2-4.3-1.1-6.4-1.6-3.5-3.9-5.8-7.3-7.5-4-2-8.7-2.2-12.5-0.6z"/></svg>';
|
34 |
+
|
35 |
+
// Button text label.
|
36 |
$button_text_array = array(
|
37 |
'de' => 'patreon',
|
38 |
+
'en' => 'patreon',
|
39 |
);
|
40 |
|
41 |
+
// Button alt label.
|
42 |
$button_title_array = array(
|
43 |
'de' => 'Werde ein patron!',
|
44 |
'en' => 'Become a patron!',
|
services/shariff-paypal.php
CHANGED
@@ -1,41 +1,50 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
-
//
|
10 |
$service_url = esc_url( 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=' );
|
11 |
|
12 |
-
//
|
13 |
-
if ( array_key_exists( 'paypalbuttonid', $atts ) )
|
14 |
-
|
|
|
|
|
|
|
15 |
|
16 |
-
//
|
17 |
$button_url = $service_url . $paypalbuttonid;
|
18 |
|
19 |
-
//
|
20 |
-
$
|
21 |
-
|
22 |
-
// colors
|
23 |
-
$main_color = '#009cde';
|
24 |
$secondary_color = '#0285d2';
|
25 |
|
26 |
-
//
|
|
|
|
|
|
|
27 |
$button_text_array = array(
|
28 |
'de' => 'spenden',
|
29 |
'en' => 'donate',
|
30 |
'fr' => 'faire un don',
|
31 |
-
'es' => 'donar'
|
32 |
);
|
33 |
|
34 |
-
//
|
35 |
$button_title_array = array(
|
36 |
'de' => 'Spenden mit PayPal',
|
37 |
'en' => 'Donate with PayPal',
|
38 |
'fr' => 'Faire un don via PayPal',
|
39 |
-
'es' => 'Donar via PayPal'
|
40 |
);
|
41 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when PayPal is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
$service_url = esc_url( 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=' );
|
17 |
|
18 |
+
// PayPal button ID.
|
19 |
+
if ( array_key_exists( 'paypalbuttonid', $atts ) ) {
|
20 |
+
$paypalbuttonid = esc_html( $atts['paypalbuttonid'] );
|
21 |
+
} else {
|
22 |
+
$paypalbuttonid = '';
|
23 |
+
}
|
24 |
|
25 |
+
// Build button URL.
|
26 |
$button_url = $service_url . $paypalbuttonid;
|
27 |
|
28 |
+
// Colors.
|
29 |
+
$main_color = '#009cde';
|
|
|
|
|
|
|
30 |
$secondary_color = '#0285d2';
|
31 |
|
32 |
+
// SVG icon.
|
33 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M19.9 8q0-2.8-4.2-2.8h-1.2q-0.6 0-1.1 0.4t-0.6 0.9l-1.1 4.9q0 0.1 0 0.3 0 0.4 0.3 0.7t0.7 0.3h0.9q1.2 0 2.3-0.2t2-0.7 1.5-1.5 0.5-2.3zM30.6 10.7q0 4.7-3.9 7.6-3.9 2.9-10.9 2.9h-1.1q-0.6 0-1.1 0.4t-0.6 0.9l-1.3 5.6q-0.1 0.6-0.7 1.1t-1.2 0.5h-3.8q-0.6 0-0.9-0.4t-0.4-0.9q0-0.2 0.2-1.2h2.7q0.6 0 1.1-0.4t0.7-1l1.3-5.6q0.1-0.6 0.7-1t1.1-0.4h1.1q7 0 10.8-2.9t3.9-7.5q0-2.3-0.9-3.7 3.3 1.6 3.3 6zM27.4 7.4q0 4.7-3.9 7.6-3.9 2.9-10.9 2.9h-1.1q-0.6 0-1.1 0.4t-0.6 0.9l-1.3 5.6q-0.1 0.6-0.7 1.1t-1.2 0.5h-3.8q-0.6 0-0.9-0.3t-0.4-0.9q0-0.1 0-0.4l5.4-23.2q0.1-0.6 0.7-1.1t1.2-0.5h7.9q1.2 0 2.2 0.1t2.2 0.3 2 0.5 1.7 0.9 1.4 1.3 0.9 1.8 0.3 2.4z"/></svg>';
|
34 |
+
|
35 |
+
// Button text label.
|
36 |
$button_text_array = array(
|
37 |
'de' => 'spenden',
|
38 |
'en' => 'donate',
|
39 |
'fr' => 'faire un don',
|
40 |
+
'es' => 'donar',
|
41 |
);
|
42 |
|
43 |
+
// Button alt label.
|
44 |
$button_title_array = array(
|
45 |
'de' => 'Spenden mit PayPal',
|
46 |
'en' => 'Donate with PayPal',
|
47 |
'fr' => 'Faire un don via PayPal',
|
48 |
+
'es' => 'Donar via PayPal',
|
49 |
);
|
50 |
}
|
services/shariff-paypalme.php
CHANGED
@@ -1,41 +1,50 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
-
//
|
10 |
$service_url = esc_url( 'https://www.paypal.me/' );
|
11 |
|
12 |
-
//
|
13 |
-
if ( array_key_exists( 'paypalmeid', $atts ) )
|
14 |
-
|
|
|
|
|
|
|
15 |
|
16 |
-
//
|
17 |
$button_url = $service_url . $paypalmeid;
|
18 |
|
19 |
-
//
|
20 |
-
$
|
21 |
-
|
22 |
-
// colors
|
23 |
-
$main_color = '#009cde';
|
24 |
$secondary_color = '#0285d2';
|
25 |
|
26 |
-
//
|
|
|
|
|
|
|
27 |
$button_text_array = array(
|
28 |
'de' => 'spenden',
|
29 |
'en' => 'donate',
|
30 |
'fr' => 'faire un don',
|
31 |
-
'es' => 'donar'
|
32 |
);
|
33 |
|
34 |
-
//
|
35 |
$button_title_array = array(
|
36 |
'de' => 'Spenden mit PayPal',
|
37 |
'en' => 'Donate with PayPal',
|
38 |
'fr' => 'Faire un don via PayPal',
|
39 |
-
'es' => 'Donar via PayPal'
|
40 |
);
|
41 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when PayPal.me is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
$service_url = esc_url( 'https://www.paypal.me/' );
|
17 |
|
18 |
+
// PayPal.me ID.
|
19 |
+
if ( array_key_exists( 'paypalmeid', $atts ) ) {
|
20 |
+
$paypalmeid = esc_html( $atts['paypalmeid'] );
|
21 |
+
} else {
|
22 |
+
$paypalmeid = '';
|
23 |
+
}
|
24 |
|
25 |
+
// Build button URL.
|
26 |
$button_url = $service_url . $paypalmeid;
|
27 |
|
28 |
+
// Colors.
|
29 |
+
$main_color = '#009cde';
|
|
|
|
|
|
|
30 |
$secondary_color = '#0285d2';
|
31 |
|
32 |
+
// SVG icon.
|
33 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M19.9 8q0-2.8-4.2-2.8h-1.2q-0.6 0-1.1 0.4t-0.6 0.9l-1.1 4.9q0 0.1 0 0.3 0 0.4 0.3 0.7t0.7 0.3h0.9q1.2 0 2.3-0.2t2-0.7 1.5-1.5 0.5-2.3zM30.6 10.7q0 4.7-3.9 7.6-3.9 2.9-10.9 2.9h-1.1q-0.6 0-1.1 0.4t-0.6 0.9l-1.3 5.6q-0.1 0.6-0.7 1.1t-1.2 0.5h-3.8q-0.6 0-0.9-0.4t-0.4-0.9q0-0.2 0.2-1.2h2.7q0.6 0 1.1-0.4t0.7-1l1.3-5.6q0.1-0.6 0.7-1t1.1-0.4h1.1q7 0 10.8-2.9t3.9-7.5q0-2.3-0.9-3.7 3.3 1.6 3.3 6zM27.4 7.4q0 4.7-3.9 7.6-3.9 2.9-10.9 2.9h-1.1q-0.6 0-1.1 0.4t-0.6 0.9l-1.3 5.6q-0.1 0.6-0.7 1.1t-1.2 0.5h-3.8q-0.6 0-0.9-0.3t-0.4-0.9q0-0.1 0-0.4l5.4-23.2q0.1-0.6 0.7-1.1t1.2-0.5h7.9q1.2 0 2.2 0.1t2.2 0.3 2 0.5 1.7 0.9 1.4 1.3 0.9 1.8 0.3 2.4z"/></svg>';
|
34 |
+
|
35 |
+
// Button text label.
|
36 |
$button_text_array = array(
|
37 |
'de' => 'spenden',
|
38 |
'en' => 'donate',
|
39 |
'fr' => 'faire un don',
|
40 |
+
'es' => 'donar',
|
41 |
);
|
42 |
|
43 |
+
// Button alt label.
|
44 |
$button_title_array = array(
|
45 |
'de' => 'Spenden mit PayPal',
|
46 |
'en' => 'Donate with PayPal',
|
47 |
'fr' => 'Faire un don via PayPal',
|
48 |
+
'es' => 'Donar via PayPal',
|
49 |
);
|
50 |
}
|
services/shariff-pinterest.php
CHANGED
@@ -1,87 +1,121 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
//
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
$
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Pinterest is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if function catch_image exists.
|
14 |
+
if ( ! function_exists( 'catch_image' ) ) {
|
15 |
+
/**
|
16 |
+
* Helper function to get the first image of a post.
|
17 |
+
*/
|
18 |
+
function catch_image() {
|
19 |
+
// @codingStandardsIgnoreStart
|
20 |
+
$files = get_children( 'post_parent=' . get_the_ID() . '&post_type=attachment&post_mime_type=image' );
|
21 |
+
// @codingStandardsIgnoreEnd
|
22 |
+
if ( $files ) {
|
23 |
+
$keys = array_reverse( array_keys( $files ) );
|
24 |
+
$num = $keys[0];
|
25 |
+
$imageurl = wp_get_attachment_url( $num );
|
26 |
+
return $imageurl;
|
27 |
+
}
|
28 |
+
return '';
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
// Check if we need the frontend or the backend part.
|
33 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
34 |
+
// Service URL.
|
35 |
+
$service_url = esc_url( 'https://www.pinterest.com/pin/create/link/' );
|
36 |
+
|
37 |
+
// Get an image for pinterest (attribute -> featured image -> first image -> default image -> shariff hint).
|
38 |
+
if ( array_key_exists( 'services', $atts ) ) {
|
39 |
+
if ( strstr( $atts['services'], 'pinterest' ) ) {
|
40 |
+
if ( array_key_exists( 'media', $atts ) ) {
|
41 |
+
$share_media = esc_html( $atts['media'] );
|
42 |
+
} else {
|
43 |
+
$feat_image = wp_get_attachment_url( get_post_thumbnail_id() );
|
44 |
+
if ( ! empty( $feat_image ) ) {
|
45 |
+
$share_media = esc_html( $feat_image );
|
46 |
+
} else {
|
47 |
+
$first_image = catch_image();
|
48 |
+
if ( ! empty( $first_image ) ) {
|
49 |
+
$share_media = esc_html( $first_image );
|
50 |
+
} else {
|
51 |
+
if ( isset( $shariff3uu['default_pinterest'] ) ) {
|
52 |
+
$share_media = $shariff3uu['default_pinterest'];
|
53 |
+
} else {
|
54 |
+
$share_media = plugins_url( '../pictos/defaultHint.png', __FILE__ );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
// Build button URL.
|
63 |
+
$button_url = $service_url . '?url=' . $share_url . '&media=' . rawurlencode( $share_media ) . '&description=' . $share_title;
|
64 |
+
|
65 |
+
// Colors.
|
66 |
+
$main_color = '#cb2027';
|
67 |
+
$secondary_color = '#e70f18';
|
68 |
+
|
69 |
+
// SVG icon.
|
70 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 32"><path fill="' . $main_color . '" d="M27.4 16q0 3.7-1.8 6.9t-5 5-6.9 1.9q-2 0-3.9-0.6 1.1-1.7 1.4-2.9 0.2-0.6 1-3.8 0.4 0.7 1.3 1.2t2 0.5q2.1 0 3.8-1.2t2.7-3.4 0.9-4.8q0-2-1.1-3.8t-3.1-2.9-4.5-1.2q-1.9 0-3.5 0.5t-2.8 1.4-2 2-1.2 2.3-0.4 2.4q0 1.9 0.7 3.3t2.1 2q0.5 0.2 0.7-0.4 0-0.1 0.1-0.5t0.2-0.5q0.1-0.4-0.2-0.8-0.9-1.1-0.9-2.7 0-2.7 1.9-4.6t4.9-2q2.7 0 4.2 1.5t1.5 3.8q0 3-1.2 5.2t-3.1 2.1q-1.1 0-1.7-0.8t-0.4-1.9q0.1-0.6 0.5-1.7t0.5-1.8 0.2-1.4q0-0.9-0.5-1.5t-1.4-0.6q-1.1 0-1.9 1t-0.8 2.6q0 1.3 0.4 2.2l-1.8 7.5q-0.3 1.2-0.2 3.2-3.7-1.6-6-5t-2.3-7.6q0-3.7 1.9-6.9t5-5 6.9-1.9 6.9 1.9 5 5 1.8 6.9z"/></svg>';
|
71 |
+
|
72 |
+
// Backend available?
|
73 |
+
$backend_available = 1;
|
74 |
+
|
75 |
+
// Button text label.
|
76 |
+
$button_text_array = array(
|
77 |
+
'de' => 'pinnen',
|
78 |
+
'en' => 'pin it',
|
79 |
+
);
|
80 |
+
|
81 |
+
// Button alt label.
|
82 |
+
$button_title_array = array(
|
83 |
+
'bg' => 'Сподели в Pinterest',
|
84 |
+
'cs' => 'Přidat na Pinterest',
|
85 |
+
'da' => 'Del på Pinterest',
|
86 |
+
'de' => 'Bei Pinterest pinnen',
|
87 |
+
'en' => 'Pin it on Pinterest',
|
88 |
+
'es' => 'Compartir en Pinterest',
|
89 |
+
'fi' => 'Jaa Pinterestissä',
|
90 |
+
'fr' => 'Partager sur Pinterest',
|
91 |
+
'hr' => 'Podijelite na Pinterest',
|
92 |
+
'hu' => 'Megosztás Pinteresten',
|
93 |
+
'it' => 'Condividi su Pinterest',
|
94 |
+
'ja' => 'Pinterest上で共有',
|
95 |
+
'ko' => 'Pinterest에서 공유하기',
|
96 |
+
'nl' => 'Delen op Pinterest',
|
97 |
+
'no' => 'Del på Pinterest',
|
98 |
+
'pl' => 'Udostępnij przez Pinterest',
|
99 |
+
'pt' => 'Compartilhar no Pinterest',
|
100 |
+
'ro' => 'Partajează pe Pinterest',
|
101 |
+
'ru' => 'Поделиться на Pinterest',
|
102 |
+
'sk' => 'Zdieľať na Pinterest',
|
103 |
+
'sl' => 'Deli na Pinterest',
|
104 |
+
'sr' => 'Podeli na Pinterest-u',
|
105 |
+
'sv' => 'Dela på Pinterest',
|
106 |
+
'tr' => 'Pinterest\'ta paylaş',
|
107 |
+
'zh' => '分享至Pinterest',
|
108 |
+
);
|
109 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
110 |
+
// Fetch counts.
|
111 |
+
$pinterest = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'http://api.pinterest.com/v1/urls/count.json?callback=x&url=' . $post_url ) ) );
|
112 |
+
$pinterest_json = rtrim( substr( $pinterest, 2 ), ')' );
|
113 |
+
$pinterest_json = json_decode( $pinterest_json, true );
|
114 |
+
|
115 |
+
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
|
116 |
+
if ( isset( $pinterest_json['count'] ) ) {
|
117 |
+
$share_counts['pinterest'] = intval( $pinterest_json['count'] );
|
118 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
119 |
+
$service_errors['pinterest'] = $pinterest;
|
120 |
+
}
|
121 |
+
}
|
services/shariff-pocket.php
CHANGED
@@ -1,55 +1,42 @@
|
|
1 |
-
<?php
|
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 |
-
'de' => '
|
34 |
-
'en' => '
|
35 |
-
);
|
36 |
-
|
37 |
-
//
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
$xpath = new DOMXpath( $dom );
|
44 |
-
$result = $xpath->query('//em[@id="cnt"]');
|
45 |
-
if ( $result->length > 0 ) $pocket_count = absint( $result->item(0)->nodeValue );
|
46 |
-
|
47 |
-
// store results, if we have some
|
48 |
-
if ( isset( $pocket_count ) ) {
|
49 |
-
$share_counts['pocket'] = intval( $pocket_count );
|
50 |
-
}
|
51 |
-
// record errors, if enabled (e.g. request from the status tab)
|
52 |
-
elseif ( isset( $record_errors ) && $record_errors == '1' ) {
|
53 |
-
$service_errors['pocket'] = $pocket;
|
54 |
-
}
|
55 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Pocket is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://getpocket.com/edit' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#ff0000';
|
23 |
+
$secondary_color = '#444';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 28"><path fill="' . $main_color . '" d="M24.5 2q1 0 1.7 0.7t0.7 1.7v8.1q0 2.8-1.1 5.3t-2.9 4.3-4.3 2.9-5.2 1.1q-2.7 0-5.2-1.1t-4.3-2.9-2.9-4.3-1.1-5.2v-8.1q0-1 0.7-1.7t1.7-0.7h22zM13.5 18.6q0.7 0 1.3-0.5l6.3-6.1q0.6-0.5 0.6-1.3 0-0.8-0.5-1.3t-1.3-0.5q-0.7 0-1.3 0.5l-5 4.8-5-4.8q-0.5-0.5-1.3-0.5-0.8 0-1.3 0.5t-0.5 1.3q0 0.8 0.6 1.3l6.3 6.1q0.5 0.5 1.3 0.5z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 0;
|
30 |
+
|
31 |
+
// Button text label.
|
32 |
+
$button_text_array = array(
|
33 |
+
'de' => 'pocket',
|
34 |
+
'en' => 'pocket',
|
35 |
+
);
|
36 |
+
|
37 |
+
// Button alt label.
|
38 |
+
$button_title_array = array(
|
39 |
+
'de' => 'Bei Pocket speichern',
|
40 |
+
'en' => 'Save to Pocket',
|
41 |
+
);
|
42 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
services/shariff-printer.php
CHANGED
@@ -1,44 +1,52 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
//
|
5 |
-
if ( ! class_exists('WP') ) {
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
|
10 |
-
//
|
11 |
$button_url = 'javascript:window.print()';
|
12 |
|
13 |
-
//
|
14 |
-
$
|
15 |
-
|
16 |
-
// same window?
|
17 |
-
$same_window = '1';
|
18 |
-
|
19 |
-
// colors
|
20 |
-
$main_color = '#999';
|
21 |
$secondary_color = '#a8a8a8';
|
22 |
|
23 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
$button_text_array = array(
|
|
|
25 |
'de' => 'drucken',
|
26 |
'en' => 'print',
|
27 |
'fr' => 'imprimer',
|
28 |
'es' => 'imprimir',
|
29 |
'it' => 'imprimere',
|
30 |
'da' => 'dat trykke',
|
31 |
-
'nl' => 'drukken'
|
32 |
);
|
33 |
|
34 |
-
//
|
35 |
$button_title_array = array(
|
36 |
'de' => 'drucken',
|
|
|
37 |
'en' => 'print',
|
38 |
'fr' => 'imprimer',
|
39 |
'es' => 'imprimir',
|
40 |
'it' => 'imprimere',
|
41 |
'da' => 'dat trykke',
|
42 |
-
'nl' => 'drukken'
|
43 |
);
|
44 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Printer is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
|
16 |
+
// Build button URL.
|
17 |
$button_url = 'javascript:window.print()';
|
18 |
|
19 |
+
// Colors.
|
20 |
+
$main_color = '#999';
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
$secondary_color = '#a8a8a8';
|
22 |
|
23 |
+
// SVG icon.
|
24 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 32"><path fill="' . $main_color . '" d="M6.8 27.4h16v-4.6h-16v4.6zM6.8 16h16v-6.8h-2.8q-0.7 0-1.2-0.5t-0.5-1.2v-2.8h-11.4v11.4zM27.4 17.2q0-0.5-0.3-0.8t-0.8-0.4-0.8 0.4-0.3 0.8 0.3 0.8 0.8 0.3 0.8-0.3 0.3-0.8zM29.7 17.2v7.4q0 0.2-0.2 0.4t-0.4 0.2h-4v2.8q0 0.7-0.5 1.2t-1.2 0.5h-17.2q-0.7 0-1.2-0.5t-0.5-1.2v-2.8h-4q-0.2 0-0.4-0.2t-0.2-0.4v-7.4q0-1.4 1-2.4t2.4-1h1.2v-9.7q0-0.7 0.5-1.2t1.2-0.5h12q0.7 0 1.6 0.4t1.3 0.8l2.7 2.7q0.5 0.5 0.9 1.4t0.4 1.6v4.6h1.1q1.4 0 2.4 1t1 2.4z"/></svg>';
|
25 |
+
|
26 |
+
// Same window?
|
27 |
+
$same_window = 1;
|
28 |
+
|
29 |
+
// Button text label.
|
30 |
$button_text_array = array(
|
31 |
+
'cs' => 'tlačit',
|
32 |
'de' => 'drucken',
|
33 |
'en' => 'print',
|
34 |
'fr' => 'imprimer',
|
35 |
'es' => 'imprimir',
|
36 |
'it' => 'imprimere',
|
37 |
'da' => 'dat trykke',
|
38 |
+
'nl' => 'drukken',
|
39 |
);
|
40 |
|
41 |
+
// Button alt label.
|
42 |
$button_title_array = array(
|
43 |
'de' => 'drucken',
|
44 |
+
'cs' => 'tlačit',
|
45 |
'en' => 'print',
|
46 |
'fr' => 'imprimer',
|
47 |
'es' => 'imprimir',
|
48 |
'it' => 'imprimere',
|
49 |
'da' => 'dat trykke',
|
50 |
+
'nl' => 'drukken',
|
51 |
);
|
52 |
}
|
services/shariff-qzone.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Qzone is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#ffce00';
|
23 |
+
$secondary_color = '#71C5F2';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" width="98" height="98" viewBox="0 0 97.7 97.7"><path fill="' . $main_color . '" d="M97.6 37.8c-0.2-0.8-0.9-1.3-1.7-1.4l-31.4-2.9L50.8 3.5c-0.3-0.7-1.1-1.2-1.9-1.2 -0.8 0-1.6 0.5-1.9 1.2L33 32.8 1.8 36.4c-0.8 0.1-1.5 0.6-1.7 1.4 -0.2 0.8 0 1.6 0.6 2.1l23 21.1L18.1 93c-0.2 0.8 0.1 1.6 0.8 2.1 0.4 0.3 0.8 0.4 1.2 0.4 0.4 0 0.7-0.1 1-0.3l28.1-16.1 27.6 16.3c0.7 0.2 1.6 0.2 2.2-0.3 0.7-0.5 1-1.2 0.8-2l-4.2-23.6c1.1-0.5 4.3-1.9 6.1-3.9 -2.8 1.1-3.8 1.4-6.6 1.9v0c-18.6 3.6-47 0.5-48 0.5L58.3 45c-10.6-1.9-35.1-2.7-36.6-2.8 -0.2 0-0.2 0-0.1 0 0 0 0 0 0.1 0 1.3-0.2 33.3-5.5 51.9-0.2L42.1 64.1c0 0 24.3 2.4 32.8 1.4l-0.6-4.4 22.8-21.2C97.6 39.3 97.8 38.5 97.6 37.8z"/></svg>';
|
27 |
+
|
28 |
+
// Button alt label.
|
29 |
+
$button_title_array = array(
|
30 |
+
'bg' => 'Сподели в Qzone',
|
31 |
+
'cs' => 'Sdílet na Qzone',
|
32 |
+
'da' => 'Del på Qzone',
|
33 |
+
'de' => 'Bei Qzone teilen',
|
34 |
+
'en' => 'Share on Qzone',
|
35 |
+
'es' => 'Compartir en Qzone',
|
36 |
+
'fi' => 'Jaa Qzoneissä',
|
37 |
+
'fr' => 'Partager sur Qzone',
|
38 |
+
'hr' => 'Podijelite na Qzone',
|
39 |
+
'hu' => 'Megosztás Qzone',
|
40 |
+
'it' => 'Condividi su Qzone',
|
41 |
+
'ja' => 'Qzone上で共有',
|
42 |
+
'ko' => 'Qzone에서 공유하기',
|
43 |
+
'nl' => 'Delen op Qzone',
|
44 |
+
'no' => 'Del på Qzone',
|
45 |
+
'pl' => 'Udostępnij przez Qzone',
|
46 |
+
'pt' => 'Compartilhar no Qzone',
|
47 |
+
'ro' => 'Partajează pe Qzone',
|
48 |
+
'ru' => 'Поделиться на Qzone',
|
49 |
+
'sk' => 'Zdieľať na Qzone',
|
50 |
+
'sl' => 'Deli na Qzone',
|
51 |
+
'sr' => 'Podeli na Qzone-u',
|
52 |
+
'sv' => 'Dela på Qzone',
|
53 |
+
'tr' => 'Qzone\'ta paylaş',
|
54 |
+
'zh' => '分享至QQ空间',
|
55 |
+
);
|
56 |
+
}
|
services/shariff-reddit.php
CHANGED
@@ -1,54 +1,74 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
//
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
//
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
'
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Reddit is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://www.reddit.com/submit' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#ff4500';
|
23 |
+
$secondary_color = '#ff5700';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="' . $main_color . '" d="M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 1;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели в Reddit',
|
34 |
+
'cs' => 'Sdílet na Redditu',
|
35 |
+
'da' => 'Del på Reddit',
|
36 |
+
'de' => 'Bei Reddit teilen',
|
37 |
+
'en' => 'Share on Reddit',
|
38 |
+
'es' => 'Compartir en Reddit',
|
39 |
+
'fi' => 'Jaa Redditissä',
|
40 |
+
'fr' => 'Partager sur Reddit',
|
41 |
+
'hr' => 'Podijelite na Reddit',
|
42 |
+
'hu' => 'Megosztás Redditen',
|
43 |
+
'it' => 'Condividi su Reddit',
|
44 |
+
'ja' => 'Reddit上で共有',
|
45 |
+
'ko' => 'Reddit에서 공유하기',
|
46 |
+
'nl' => 'Delen op Reddit',
|
47 |
+
'no' => 'Del på Reddit',
|
48 |
+
'pl' => 'Udostępnij przez Reddit',
|
49 |
+
'pt' => 'Compartilhar no Reddit',
|
50 |
+
'ro' => 'Partajează pe Reddit',
|
51 |
+
'ru' => 'Поделиться на Reddit',
|
52 |
+
'sk' => 'Zdieľať na Reddit',
|
53 |
+
'sl' => 'Deli na Reddit',
|
54 |
+
'sr' => 'Podeli na Reddit-u',
|
55 |
+
'sv' => 'Dela på Reddit',
|
56 |
+
'tr' => 'Reddit\'ta paylaş',
|
57 |
+
'zh' => '分享至Reddit',
|
58 |
+
);
|
59 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
60 |
+
// Fetch counts.
|
61 |
+
$reddit = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://www.reddit.com/api/info.json?url=' . $post_url ) ) );
|
62 |
+
$reddit_json = json_decode( $reddit, true );
|
63 |
+
|
64 |
+
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
|
65 |
+
if ( isset( $reddit_json['data']['children'] ) ) {
|
66 |
+
$count = 0;
|
67 |
+
foreach ( $reddit_json['data']['children'] as $child ) {
|
68 |
+
$count += intval( $child['data']['score'] );
|
69 |
+
}
|
70 |
+
$share_counts['reddit'] = $count;
|
71 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
72 |
+
$service_errors['reddit'] = $reddit;
|
73 |
+
}
|
74 |
+
}
|
services/shariff-rss.php
CHANGED
@@ -1,34 +1,43 @@
|
|
1 |
-
<?php
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when RSS is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
if ( array_key_exists( 'rssfeed', $atts ) ) {
|
17 |
+
$service_url = esc_url( $atts['rssfeed'] );
|
18 |
+
} else {
|
19 |
+
$service_url = esc_url( get_bloginfo( 'rss_url' ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
// Build button URL.
|
23 |
+
$button_url = $service_url;
|
24 |
+
|
25 |
+
// Colors.
|
26 |
+
$main_color = '#fe9312';
|
27 |
+
$secondary_color = '#ff8c00';
|
28 |
+
|
29 |
+
// SVG icon.
|
30 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M4.3 23.5c-2.3 0-4.3 1.9-4.3 4.3 0 2.3 1.9 4.2 4.3 4.2 2.4 0 4.3-1.9 4.3-4.2 0-2.3-1.9-4.3-4.3-4.3zM0 10.9v6.1c4 0 7.7 1.6 10.6 4.4 2.8 2.8 4.4 6.6 4.4 10.6h6.2c0-11.7-9.5-21.1-21.1-21.1zM0 0v6.1c14.2 0 25.8 11.6 25.8 25.9h6.2c0-17.6-14.4-32-32-32z"/></svg>';
|
31 |
+
|
32 |
+
// Button text label.
|
33 |
+
$button_text_array = array(
|
34 |
+
'de' => 'rss-feed',
|
35 |
+
'en' => 'rss feed',
|
36 |
+
);
|
37 |
+
|
38 |
+
// Button alt label.
|
39 |
+
$button_title_array = array(
|
40 |
+
'de' => 'rss-feed',
|
41 |
+
'en' => 'rss feed',
|
42 |
+
);
|
43 |
+
}
|
services/shariff-sms.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when SMS is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = 'sms:';
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?&body=' . $share_url;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#a1e877';
|
23 |
+
$secondary_color = '#d7d9d8';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" width="510" height="510" viewBox="0 0 510 510"><path fill="' . $main_color . '" d="M459 0H51C23 0 0 23 0 51v459l102-102h357c28.1 0 51-22.9 51-51V51C510 23 487.1 0 459 0zM178.5 229.5h-51v-51h51V229.5zM280.5 229.5h-51v-51h51V229.5zM382.5 229.5h-51v-51h51V229.5z"/></svg>';
|
27 |
+
|
28 |
+
// Mobile only?
|
29 |
+
$mobile_only = 1;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели в SMS',
|
34 |
+
'cs' => 'Sdílet na SMS',
|
35 |
+
'da' => 'Del på SMS',
|
36 |
+
'de' => 'Per SMS teilen',
|
37 |
+
'en' => 'Share on SMS',
|
38 |
+
'es' => 'Compartir en SMS',
|
39 |
+
'fi' => 'Jaa SMS',
|
40 |
+
'fr' => 'Partager sur SMS',
|
41 |
+
'hr' => 'Podijelite na SMS',
|
42 |
+
'hu' => 'Megosztás SMS',
|
43 |
+
'it' => 'Condividi su SMS',
|
44 |
+
'ja' => 'SMS上で共有',
|
45 |
+
'ko' => 'SMS에서 공유하기',
|
46 |
+
'nl' => 'Delen op SMS',
|
47 |
+
'no' => 'Del på SMS',
|
48 |
+
'pl' => 'Udostępnij przez SMS',
|
49 |
+
'pt' => 'Compartilhar no SMS',
|
50 |
+
'ro' => 'Partajează pe SMS',
|
51 |
+
'ru' => 'Поделиться на SMS',
|
52 |
+
'sk' => 'Zdieľať na SMS',
|
53 |
+
'sl' => 'Deli na SMS',
|
54 |
+
'sr' => 'Podeli na SMS-u',
|
55 |
+
'sv' => 'Dela på SMS',
|
56 |
+
'tr' => 'SMS\'ta paylaş',
|
57 |
+
'zh' => '在WSMS上分享',
|
58 |
+
);
|
59 |
+
}
|
services/shariff-stumbleupon.php
CHANGED
@@ -1,55 +1,74 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
//
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
//
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
'
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Stumbleupon is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://www.stumbleupon.com/submit' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#eb4b24';
|
23 |
+
$secondary_color = '#e1370e';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 37 32"><path fill="' . $main_color . '" d="M19 12.7v-2.1q0-0.7-0.5-1.3t-1.3-0.5-1.3 0.5-0.5 1.3v10.9q0 3.1-2.2 5.3t-5.4 2.2q-3.2 0-5.4-2.2t-2.2-5.4v-4.8h5.9v4.7q0 0.8 0.5 1.3t1.3 0.5 1.3-0.5 0.5-1.3v-11.1q0-3 2.2-5.2t5.4-2.1q3.1 0 5.4 2.2t2.3 5.2v2.4l-3.5 1zM28.4 16.7h5.9v4.8q0 3.2-2.2 5.4t-5.4 2.2-5.4-2.2-2.2-5.4v-4.8l2.3 1.1 3.5-1v4.8q0 0.7 0.5 1.3t1.3 0.5 1.3-0.5 0.5-1.3v-4.9z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 1;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели в Stumbleupon',
|
34 |
+
'cs' => 'Sdílet na Stumbleuponu',
|
35 |
+
'da' => 'Del på Stumbleupon',
|
36 |
+
'de' => 'Bei Stumbleupon teilen',
|
37 |
+
'en' => 'Share on Stumbleupon',
|
38 |
+
'es' => 'Compartir en Stumbleupon',
|
39 |
+
'fi' => 'Jaa Stumbleuponissä',
|
40 |
+
'fr' => 'Partager sur Stumbleupon',
|
41 |
+
'hr' => 'Podijelite na Stumbleupon',
|
42 |
+
'hu' => 'Megosztás Stumbleupon',
|
43 |
+
'it' => 'Condividi su Stumbleupon',
|
44 |
+
'ja' => 'Stumbleupon上で共有',
|
45 |
+
'ko' => 'Stumbleupon에서 공유하기',
|
46 |
+
'nl' => 'Delen op Stumbleupon',
|
47 |
+
'no' => 'Del på Stumbleupon',
|
48 |
+
'pl' => 'Udostępnij przez Stumbleupon',
|
49 |
+
'pt' => 'Compartilhar no Stumbleupon',
|
50 |
+
'ro' => 'Partajează pe Stumbleupon',
|
51 |
+
'ru' => 'Поделиться на Stumbleupon',
|
52 |
+
'sk' => 'Zdieľať na Stumbleupon',
|
53 |
+
'sl' => 'Deli na Stumbleupon',
|
54 |
+
'sr' => 'Podeli na Stumbleupon-u',
|
55 |
+
'sv' => 'Dela på Stumbleupon',
|
56 |
+
'tr' => 'Stumbleupon\'ta paylaş',
|
57 |
+
'zh' => '分享至Stumbleupon',
|
58 |
+
);
|
59 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
60 |
+
// Fetch counts.
|
61 |
+
$stumbleupon = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://www.stumbleupon.com/services/1.01/badge.getinfo?url=' . $post_url ) ) );
|
62 |
+
$stumbleupon_json = json_decode( $stumbleupon, true );
|
63 |
+
|
64 |
+
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
|
65 |
+
if ( isset( $stumbleupon_json['success'] ) && true === $stumbleupon_json['success'] ) {
|
66 |
+
if ( isset( $stumbleupon_json['result']['views'] ) ) {
|
67 |
+
$share_counts['stumbleupon'] = intval( $stumbleupon_json['result']['views'] );
|
68 |
+
} else {
|
69 |
+
$share_counts['stumbleupon'] = 0;
|
70 |
+
}
|
71 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
72 |
+
$service_errors['stumbleupon'] = $stumbleupon;
|
73 |
+
}
|
74 |
+
}
|
services/shariff-telegram.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Telegram is requested as a service.
|
4 |
+
* Thanks to Daniel Sturm (@dcsturm).
|
5 |
+
*
|
6 |
+
* @package Shariff Wrapper
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Prevent direct calls.
|
10 |
+
if ( ! class_exists( 'WP' ) ) {
|
11 |
+
die();
|
12 |
+
}
|
13 |
+
|
14 |
+
// Check if we need the frontend or the backend part.
|
15 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
16 |
+
// Service URL.
|
17 |
+
$service_url = 'https://telegram.me/share/url';
|
18 |
+
|
19 |
+
// Build button URL.
|
20 |
+
$button_url = $service_url . '?url=' . $share_url . '&text=' . $share_title;
|
21 |
+
|
22 |
+
// Colors.
|
23 |
+
$main_color = '#0088cc';
|
24 |
+
$secondary_color = '#4084A6';
|
25 |
+
|
26 |
+
// SVG icon.
|
27 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M30.8 6.5l-4.5 21.4c-.3 1.5-1.2 1.9-2.5 1.2L16.9 24l-3.3 3.2c-.4.4-.7.7-1.4.7l.5-7L25.5 9.2c.6-.5-.1-.8-.9-.3l-15.8 10L2 16.7c-1.5-.5-1.5-1.5.3-2.2L28.9 4.3c1.3-.5 2.3.3 1.9 2.2z"/></svg>';
|
28 |
+
|
29 |
+
// Mobile only?
|
30 |
+
$mobile_only = 0;
|
31 |
+
|
32 |
+
// Button alt label.
|
33 |
+
$button_title_array = array(
|
34 |
+
'bg' => 'Сподели в Telegram',
|
35 |
+
'cs' => 'Sdílet na Telegramu',
|
36 |
+
'da' => 'Del på Telegram',
|
37 |
+
'de' => 'Bei Telegram teilen',
|
38 |
+
'en' => 'Share on Telegram',
|
39 |
+
'es' => 'Compartir en Telegram',
|
40 |
+
'fi' => 'Jaa Telegramissä',
|
41 |
+
'fr' => 'Partager sur Telegram',
|
42 |
+
'hr' => 'Podijelite na Telegram',
|
43 |
+
'hu' => 'Megosztás Telegramen',
|
44 |
+
'it' => 'Condividi su Telegram',
|
45 |
+
'ja' => 'Telegram上で共有',
|
46 |
+
'ko' => 'Telegram에서 공유하기',
|
47 |
+
'nl' => 'Delen op Telegram',
|
48 |
+
'no' => 'Del på Telegram',
|
49 |
+
'pl' => 'Udostępnij przez Telegram',
|
50 |
+
'pt' => 'Compartilhar no Telegram',
|
51 |
+
'ro' => 'Partajează pe Telegram',
|
52 |
+
'ru' => 'Поделиться на Telegram',
|
53 |
+
'sk' => 'Zdieľať na Telegram',
|
54 |
+
'sl' => 'Deli na Telegram',
|
55 |
+
'sr' => 'Podeli na Telegram-u',
|
56 |
+
'sv' => 'Dela på Telegram',
|
57 |
+
'tr' => 'Telegram\'ta paylaş',
|
58 |
+
'zh' => '在Telegram上分享',
|
59 |
+
);
|
60 |
+
}
|
services/shariff-tencentweibo.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when TencentWeibo is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'http://v.t.qq.com/share/share.php' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#02a8f3';
|
23 |
+
$secondary_color = '#8ac249';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" width="94" height="94" viewBox="0 0 94.1 94.1"><path fill="' . $main_color . '" d="M25.9 9.4C11.6 9.4 0 21 0 35.3c0 4.8 1.3 9.4 3.8 13.5l0.9 1.4 4.6-3.4L8.5 45.3c-1.7-3-2.7-6.5-2.7-10 0-11 9-20 20-20 11 0 20 9 20 20 0 11-9 20-20 20 -2 0-4-0.3-5.9-0.9l-1.7 5.6c2.5 0.8 5 1.1 7.6 1.1 14.3 0 25.9-11.6 25.9-25.9C51.8 21 40.2 9.4 25.9 9.4z"/><path d="M22.2 43.4l0.6-0.5c1 0.5 2.2 0.8 3.4 0.8 4.6 0 8.3-3.7 8.3-8.3 0-4.6-3.7-8.3-8.3-8.3s-8.3 3.7-8.3 8.3c0 1.2 0.3 2.3 0.7 3.4 0 0 0.1 0.6 0.8 1.2C4.2 53.1 3.1 69.4 3.1 70.2v18h5.9V70.2C8.9 70.1 9.3 54.1 22.2 43.4z"/><path d="M72.9 31.3c-1.9 0.1-3.8-0.3-5.6-1.2 -5.4-2.8-7.6-9.4-4.9-14.9 2.8-5.4 9.4-7.6 14.9-4.9 5.4 2.8 7.6 9.4 4.9 14.9 -0.5 1-1.1 1.9-1.9 2.7l2.3 2.2c1-1 1.8-2.2 2.5-3.5 3.6-7 0.7-15.7-6.3-19.2 -7-3.6-15.7-0.7-19.2 6.3 -3.6 7-0.7 15.7 6.3 19.2 2.4 1.2 5 1.7 7.6 1.5l0.9-0.1 -0.5-3.1L72.9 31.3z"/><path fill="' . $main_color . '" d="M85.3 37.4c-0.1 0-7.9-4.2-9.9-13.2l-0.1-0.5c0.5-0.4 0.9-0.9 1.2-1.5 1.1-2.3 0.2-5-2-6.2 -2.3-1.1-5-0.2-6.2 2 -1.1 2.3-0.2 5 2 6.2 0.6 0.3 1.2 0.5 1.8 0.5 0 0 0.3 0.1 0.8-0.1 2.7 10.8 10.4 15.4 10.8 15.6l8.8 4.5 1.5-2.9L85.3 37.4z"/></svg>';
|
27 |
+
|
28 |
+
// Button alt label.
|
29 |
+
$button_title_array = array(
|
30 |
+
'bg' => 'Сподели в tencent weibo',
|
31 |
+
'cs' => 'Sdílet na tencent weibo',
|
32 |
+
'da' => 'Del på tencent weibo',
|
33 |
+
'de' => 'Bei tencent weibo teilen',
|
34 |
+
'en' => 'Share on tencent weibo',
|
35 |
+
'es' => 'Compartir en tencent weibo',
|
36 |
+
'fi' => 'Jaa tencent weiboissä',
|
37 |
+
'fr' => 'Partager sur tencent weibo',
|
38 |
+
'hr' => 'Podijelite na tencent weibo',
|
39 |
+
'hu' => 'Megosztás tencent weiboen',
|
40 |
+
'it' => 'Condividi su tencent weibo',
|
41 |
+
'ja' => 'Tencent weibo上で共有',
|
42 |
+
'ko' => 'Tencent weibo에서 공유하기',
|
43 |
+
'nl' => 'Delen op tencent weibo',
|
44 |
+
'no' => 'Del på tencent weibo',
|
45 |
+
'pl' => 'Udostępnij przez tencent weibo',
|
46 |
+
'pt' => 'Compartilhar no tencent weibo',
|
47 |
+
'ro' => 'Partajează pe tencent weibo',
|
48 |
+
'ru' => 'Поделиться на tencent weibo',
|
49 |
+
'sk' => 'Zdieľať na tencent weibo',
|
50 |
+
'sl' => 'Deli na tencent weibo',
|
51 |
+
'sr' => 'Podeli na tencent weibo-u',
|
52 |
+
'sv' => 'Dela på tencent weibo',
|
53 |
+
'tr' => 'Tencent weibo\'ta paylaş',
|
54 |
+
'zh' => '分享至腾讯微博',
|
55 |
+
);
|
56 |
+
}
|
services/shariff-threema.php
CHANGED
@@ -1,30 +1,37 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
//
|
5 |
-
if ( ! class_exists('WP') ) {
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
-
//
|
10 |
$service_url = 'threema://compose';
|
11 |
|
12 |
-
//
|
13 |
$button_url = $service_url . '?text=' . $share_title . '%20' . $share_url;
|
14 |
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
// colors
|
19 |
-
$main_color = '#1f1f1f';
|
20 |
$secondary_color = '#4fbc24';
|
21 |
|
22 |
-
//
|
23 |
-
$
|
|
|
|
|
|
|
24 |
|
25 |
-
//
|
26 |
$button_title_array = array(
|
27 |
'bg' => 'Сподели в Threema',
|
|
|
28 |
'da' => 'Del på Threema',
|
29 |
'de' => 'Bei Threema teilen',
|
30 |
'en' => 'Share on Threema',
|
@@ -47,6 +54,6 @@ if ( isset( $frontend ) && $frontend == '1' ) {
|
|
47 |
'sr' => 'Podeli na Threema-u',
|
48 |
'sv' => 'Dela på Threema',
|
49 |
'tr' => 'Threema\'ta paylaş',
|
50 |
-
'zh' => '在Threema上分享'
|
51 |
);
|
52 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Threema is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
$service_url = 'threema://compose';
|
17 |
|
18 |
+
// Build button URL.
|
19 |
$button_url = $service_url . '?text=' . $share_title . '%20' . $share_url;
|
20 |
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#1f1f1f';
|
|
|
|
|
|
|
23 |
$secondary_color = '#4fbc24';
|
24 |
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M30.8 10.9c-0.3-1.4-0.9-2.6-1.8-3.8-2-2.6-5.5-4.5-9.4-5.2-1.3-0.2-1.9-0.3-3.5-0.3s-2.2 0-3.5 0.3c-4 0.7-7.4 2.6-9.4 5.2-0.9 1.2-1.5 2.4-1.8 3.8-0.1 0.5-0.2 1.2-0.2 1.6 0 0.4 0.1 1.1 0.2 1.6 0.4 1.9 1.3 3.4 2.9 5 0.8 0.8 0.8 0.8 0.7 1.3 0 0.6-0.5 1.6-1.7 3.6-0.3 0.5-0.5 0.9-0.5 0.9 0 0.1 0.1 0.1 0.5 0 0.8-0.2 2.3-0.6 5.6-1.6 1.1-0.3 1.3-0.4 2.3-0.4 0.8 0 1.1 0 2.3 0.2 1.5 0.2 3.5 0.2 4.9 0 5.1-0.6 9.3-2.9 11.4-6.3 0.5-0.9 0.9-1.8 1.1-2.8 0.1-0.5 0.2-1.1 0.2-1.6 0-0.7-0.1-1.1-0.2-1.6-0.3-1.4 0.1 0.5 0 0zM20.6 17.3c0 0.4-0.4 0.8-0.8 0.8h-7.7c-0.4 0-0.8-0.4-0.8-0.8v-4.6c0-0.4 0.4-0.8 0.8-0.8h0.2l0-1.6c0-0.9 0-1.8 0.1-2 0.1-0.6 0.6-1.2 1.1-1.7s1.1-0.7 1.9-0.8c1.8-0.3 3.7 0.7 4.2 2.2 0.1 0.3 0.1 0.7 0.1 2.1v0 1.7h0.1c0.4 0 0.8 0.4 0.8 0.8v4.6zM15.6 7.3c-0.5 0.1-0.8 0.3-1.2 0.6s-0.6 0.8-0.7 1.3c0 0.2 0 0.8 0 1.5l0 1.2h4.6v-1.3c0-1 0-1.4-0.1-1.6-0.3-1.1-1.5-1.9-2.6-1.7zM25.8 28.2c0 1.2-1 2.2-2.1 2.2s-2.1-1-2.1-2.1c0-1.2 1-2.1 2.2-2.1s2.2 1 2.2 2.2zM18.1 28.2c0 1.2-1 2.2-2.1 2.2s-2.1-1-2.1-2.1c0-1.2 1-2.1 2.2-2.1s2.2 1 2.2 2.2zM10.4 28.2c0 1.2-1 2.2-2.1 2.2s-2.1-1-2.1-2.1c0-1.2 1-2.1 2.2-2.1s2.2 1 2.2 2.2z"/></svg>';
|
27 |
+
|
28 |
+
// Mobile only?
|
29 |
+
$mobile_only = 1;
|
30 |
|
31 |
+
// Button alt label.
|
32 |
$button_title_array = array(
|
33 |
'bg' => 'Сподели в Threema',
|
34 |
+
'cs' => 'Sdílet na Threema',
|
35 |
'da' => 'Del på Threema',
|
36 |
'de' => 'Bei Threema teilen',
|
37 |
'en' => 'Share on Threema',
|
54 |
'sr' => 'Podeli na Threema-u',
|
55 |
'sv' => 'Dela på Threema',
|
56 |
'tr' => 'Threema\'ta paylaş',
|
57 |
+
'zh' => '在Threema上分享',
|
58 |
);
|
59 |
}
|
services/shariff-tumblr.php
CHANGED
@@ -1,76 +1,79 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
//
|
5 |
-
if ( ! class_exists('WP') ) {
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
-
//
|
10 |
$service_url = esc_url( 'https://www.tumblr.com/widgets/share/tool' );
|
11 |
-
|
12 |
-
//
|
13 |
-
$wpurl
|
14 |
$domain = trim( $wpurl, '/' );
|
15 |
if ( ! preg_match( '#^http(s)?://#', $domain ) ) {
|
16 |
$domain = 'http://' . $domain;
|
17 |
}
|
18 |
-
$
|
19 |
-
$domain
|
20 |
-
|
21 |
-
// build button url
|
22 |
-
$button_url = $service_url . '?posttype=link&canonicalUrl=' . $share_url . '&tags=' . urlencode( $domain );
|
23 |
|
24 |
-
//
|
25 |
-
$
|
26 |
|
27 |
-
//
|
28 |
-
$main_color
|
29 |
$secondary_color = '#529ecc';
|
30 |
|
31 |
-
//
|
32 |
-
$
|
33 |
|
34 |
-
//
|
|
|
|
|
|
|
35 |
$button_title_array = array(
|
36 |
-
'bg' => 'Сподели
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
44 |
-
'
|
45 |
-
'
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
-
'
|
50 |
-
'
|
51 |
-
'
|
52 |
-
'
|
53 |
-
'
|
54 |
-
'
|
55 |
-
'
|
56 |
-
'
|
57 |
-
'
|
58 |
-
'
|
59 |
-
'
|
|
|
60 |
);
|
61 |
-
}
|
62 |
-
//
|
63 |
-
|
64 |
-
// fetch counts
|
65 |
-
$tumblr = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://api.tumblr.com/v2/share/stats?url=' . $post_url ) ) );
|
66 |
$tumblr_json = json_decode( $tumblr, true );
|
67 |
|
68 |
-
//
|
69 |
if ( isset( $tumblr_json['response']['note_count'] ) ) {
|
70 |
$share_counts['tumblr'] = intval( $tumblr_json['response']['note_count'] );
|
71 |
-
}
|
72 |
-
// record errors, if enabled (e.g. request from the status tab)
|
73 |
-
elseif ( isset( $record_errors ) && $record_errors == '1' ) {
|
74 |
$service_errors['tumblr'] = $tumblr;
|
75 |
}
|
76 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Tumblr is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
$service_url = esc_url( 'https://www.tumblr.com/widgets/share/tool' );
|
17 |
+
|
18 |
+
// Domain.
|
19 |
+
$wpurl = get_bloginfo( 'wpurl' );
|
20 |
$domain = trim( $wpurl, '/' );
|
21 |
if ( ! preg_match( '#^http(s)?://#', $domain ) ) {
|
22 |
$domain = 'http://' . $domain;
|
23 |
}
|
24 |
+
$url_parts = wp_parse_url( $domain );
|
25 |
+
$domain = preg_replace( '/^www\./', '', $url_parts['host'] );
|
|
|
|
|
|
|
26 |
|
27 |
+
// Build button URL.
|
28 |
+
$button_url = $service_url . '?posttype=link&canonicalUrl=' . $share_url . '&tags=' . rawurlencode( $domain );
|
29 |
|
30 |
+
// Colors.
|
31 |
+
$main_color = '#36465d';
|
32 |
$secondary_color = '#529ecc';
|
33 |
|
34 |
+
// SVG icon.
|
35 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M18 14l0 7.3c0 1.9 0 2.9 0.2 3.5 0.2 0.5 0.7 1.1 1.2 1.4 0.7 0.4 1.5 0.6 2.4 0.6 1.6 0 2.6-0.2 4.2-1.3v4.8c-1.4 0.6-2.6 1-3.7 1.3-1.1 0.3-2.3 0.4-3.6 0.4-1.5 0-2.3-0.2-3.4-0.6-1.1-0.4-2.1-0.9-2.9-1.6-0.8-0.7-1.3-1.4-1.7-2.2s-0.5-1.9-0.5-3.4v-11.2h-4.3v-4.5c1.3-0.4 2.7-1 3.6-1.8 0.9-0.8 1.6-1.7 2.2-2.7 0.5-1.1 0.9-2.4 1.1-4.1h5.2l0 8h8v6h-8z"/></svg>';
|
36 |
|
37 |
+
// Backend available?
|
38 |
+
$backend_available = 1;
|
39 |
+
|
40 |
+
// Button alt label.
|
41 |
$button_title_array = array(
|
42 |
+
'bg' => 'Сподели в tumblr',
|
43 |
+
'cs' => 'Sdílet na tumblru',
|
44 |
+
'da' => 'Del på tumblr',
|
45 |
+
'de' => 'Bei tumblr teilen',
|
46 |
+
'en' => 'Share on tumblr',
|
47 |
+
'es' => 'Compartir en tumblr',
|
48 |
+
'fi' => 'Jaa tumblrissä',
|
49 |
+
'fr' => 'Partager sur tumblr',
|
50 |
+
'hr' => 'Podijelite na tumblr',
|
51 |
+
'hu' => 'Megosztás tumblren',
|
52 |
+
'it' => 'Condividi su tumblr',
|
53 |
+
'ja' => 'tumblr上で共有',
|
54 |
+
'ko' => 'tumblr에서 공유하기',
|
55 |
+
'nl' => 'Delen op tumblr',
|
56 |
+
'no' => 'Del på tumblr',
|
57 |
+
'pl' => 'Udostępnij przez tumblr',
|
58 |
+
'pt' => 'Compartilhar no tumblr',
|
59 |
+
'ro' => 'Partajează pe tumblr',
|
60 |
+
'ru' => 'Поделиться на tumblr',
|
61 |
+
'sk' => 'Zdieľať na tumblr',
|
62 |
+
'sl' => 'Deli na tumblr',
|
63 |
+
'sr' => 'Podeli na tumblr-u',
|
64 |
+
'sv' => 'Dela på tumblr',
|
65 |
+
'tr' => 'tumblr\'ta paylaş',
|
66 |
+
'zh' => '在tumblr上分享',
|
67 |
);
|
68 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
69 |
+
// Fetch counts.
|
70 |
+
$tumblr = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://api.tumblr.com/v2/share/stats?url=' . $post_url ) ) );
|
|
|
|
|
71 |
$tumblr_json = json_decode( $tumblr, true );
|
72 |
|
73 |
+
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
|
74 |
if ( isset( $tumblr_json['response']['note_count'] ) ) {
|
75 |
$share_counts['tumblr'] = intval( $tumblr_json['response']['note_count'] );
|
76 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
|
|
|
|
77 |
$service_errors['tumblr'] = $tumblr;
|
78 |
}
|
79 |
}
|
services/shariff-twitter.php
CHANGED
@@ -1,78 +1,92 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
$
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
//
|
36 |
-
$
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
44 |
-
'
|
45 |
-
'
|
46 |
-
'
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
'
|
52 |
-
'
|
53 |
-
'
|
54 |
-
'
|
55 |
-
'
|
56 |
-
'
|
57 |
-
'
|
58 |
-
'
|
59 |
-
'
|
60 |
-
'
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Twitter is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://twitter.com/share' );
|
17 |
+
|
18 |
+
// Via tag.
|
19 |
+
if ( array_key_exists( 'twitter_via', $atts ) ) {
|
20 |
+
$twitter_via = '&via=' . esc_html( $atts['twitter_via'] );
|
21 |
+
} else {
|
22 |
+
$twitter_via = '';
|
23 |
+
}
|
24 |
+
|
25 |
+
// Build button URL.
|
26 |
+
$button_url = $service_url . '?url=' . $share_url . '&text=' . $share_title . $twitter_via;
|
27 |
+
|
28 |
+
// Colors.
|
29 |
+
$main_color = '#55acee';
|
30 |
+
$secondary_color = '#32bbf5';
|
31 |
+
|
32 |
+
// SVG icon.
|
33 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 32"><path fill="' . $main_color . '" d="M29.7 6.8q-1.2 1.8-3 3.1 0 0.3 0 0.8 0 2.5-0.7 4.9t-2.2 4.7-3.5 4-4.9 2.8-6.1 1q-5.1 0-9.3-2.7 0.6 0.1 1.5 0.1 4.3 0 7.6-2.6-2-0.1-3.5-1.2t-2.2-3q0.6 0.1 1.1 0.1 0.8 0 1.6-0.2-2.1-0.4-3.5-2.1t-1.4-3.9v-0.1q1.3 0.7 2.8 0.8-1.2-0.8-2-2.2t-0.7-2.9q0-1.7 0.8-3.1 2.3 2.8 5.5 4.5t7 1.9q-0.2-0.7-0.2-1.4 0-2.5 1.8-4.3t4.3-1.8q2.7 0 4.5 1.9 2.1-0.4 3.9-1.5-0.7 2.2-2.7 3.4 1.8-0.2 3.5-0.9z"/></svg>';
|
34 |
+
|
35 |
+
// Backend available?
|
36 |
+
$backend_available = 1;
|
37 |
+
|
38 |
+
// Button text label.
|
39 |
+
$button_text_array = array(
|
40 |
+
'de' => 'twittern',
|
41 |
+
'en' => 'tweet',
|
42 |
+
'ja' => 'のつぶやき',
|
43 |
+
'ko' => '짹짹',
|
44 |
+
'ru' => 'твит',
|
45 |
+
'sr' => 'твеет',
|
46 |
+
'zh' => '鸣叫',
|
47 |
+
);
|
48 |
+
|
49 |
+
// Button alt label.
|
50 |
+
$button_title_array = array(
|
51 |
+
'bg' => 'Сподели в Twitter',
|
52 |
+
'cs' => 'Sdílet na Twiiteru',
|
53 |
+
'da' => 'Del på Twitter',
|
54 |
+
'de' => 'Bei Twitter teilen',
|
55 |
+
'en' => 'Share on Twitter',
|
56 |
+
'es' => 'Compartir en Twitter',
|
57 |
+
'fi' => 'Jaa Twitterissä',
|
58 |
+
'fr' => 'Partager sur Twitter',
|
59 |
+
'hr' => 'Podijelite na Twitteru',
|
60 |
+
'hu' => 'Megosztás Twitteren',
|
61 |
+
'it' => 'Condividi su Twitter',
|
62 |
+
'ja' => 'ツイッター上で共有',
|
63 |
+
'ko' => '트위터에서 공유하기',
|
64 |
+
'nl' => 'Delen op Twitter',
|
65 |
+
'no' => 'Del på Twitter',
|
66 |
+
'pl' => 'Udostępnij na Twitterze',
|
67 |
+
'pt' => 'Compartilhar no Twitter',
|
68 |
+
'ro' => 'Partajează pe Twitter',
|
69 |
+
'ru' => 'Поделиться на Twitter',
|
70 |
+
'sk' => 'Zdieľať na Twitteri',
|
71 |
+
'sl' => 'Deli na Twitterju',
|
72 |
+
'sr' => 'Podeli na Twitter-u',
|
73 |
+
'sv' => 'Dela på Twitter',
|
74 |
+
'tr' => 'Twitter\'da paylaş',
|
75 |
+
'zh' => '在Twitter上分享',
|
76 |
+
);
|
77 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
78 |
+
// Fetch counts.
|
79 |
+
if ( isset( $shariff3uu['newsharecount'] ) && 1 === $shariff3uu['newsharecount'] ) {
|
80 |
+
$twitter = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'http://public.newsharecounts.com/count.json?url=' . $post_url ) ) );
|
81 |
+
} else {
|
82 |
+
$twitter = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'http://opensharecount.com/count.json?url=' . $post_url ) ) );
|
83 |
+
}
|
84 |
+
$twitter_json = json_decode( $twitter, true );
|
85 |
+
|
86 |
+
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
|
87 |
+
if ( isset( $twitter_json['count'] ) && ! isset( $twitter_json['error'] ) ) {
|
88 |
+
$share_counts['twitter'] = intval( $twitter_json['count'] );
|
89 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
90 |
+
$service_errors['twitter'] = $twitter;
|
91 |
+
}
|
92 |
+
}
|
services/shariff-vk.php
CHANGED
@@ -1,30 +1,37 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
//
|
5 |
-
if ( ! class_exists('WP') ) {
|
|
|
|
|
6 |
|
7 |
-
// frontend
|
8 |
-
if ( isset( $frontend ) && $frontend
|
9 |
-
//
|
10 |
$service_url = esc_url( 'https://vk.com/share.php' );
|
11 |
|
12 |
-
//
|
13 |
$button_url = $service_url . '?url=' . $share_url;
|
14 |
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
// colors
|
19 |
-
$main_color = '#527498';
|
20 |
$secondary_color = '#4273c8';
|
21 |
|
22 |
-
//
|
23 |
-
$
|
|
|
|
|
|
|
24 |
|
25 |
-
//
|
26 |
$button_title_array = array(
|
27 |
'bg' => 'Сподели във VK',
|
|
|
28 |
'da' => 'Del på VK',
|
29 |
'de' => 'Bei VK teilen',
|
30 |
'en' => 'Share on VK',
|
@@ -41,7 +48,7 @@ if ( isset( $frontend ) && $frontend == '1' ) {
|
|
41 |
'pl' => 'Udostępnij na VKu',
|
42 |
'pt' => 'Compartilhar no VK',
|
43 |
'ro' => 'Partajează pe VK',
|
44 |
-
'ru' => 'Поделиться на
|
45 |
'sk' => 'Zdieľať na VKu',
|
46 |
'sl' => 'Deli na VKu',
|
47 |
'sr' => 'Podeli na VK-u',
|
@@ -49,22 +56,17 @@ if ( isset( $frontend ) && $frontend == '1' ) {
|
|
49 |
'tr' => 'VK\'ta paylaş',
|
50 |
'zh' => '在VK上分享',
|
51 |
);
|
52 |
-
}
|
53 |
-
//
|
54 |
-
elseif ( isset( $backend ) && $backend == '1' ) {
|
55 |
-
// fetch counts
|
56 |
$vk = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'http://vk.com/share.php?act=count&url=' . $post_url ) ) );
|
57 |
if ( isset( $vk ) ) {
|
58 |
preg_match( '/^VK.Share.count\((\d+),\s+(\d+)\);$/i', $vk, $matches );
|
59 |
$vk_count = intval( $matches[2] );
|
60 |
}
|
61 |
-
|
62 |
-
// store results, if we have some
|
63 |
if ( isset( $vk_count ) ) {
|
64 |
$share_counts['vk'] = $vk_count;
|
65 |
-
}
|
66 |
-
// record errors, if enabled (e.g. request from the status tab)
|
67 |
-
elseif ( isset( $record_errors ) && $record_errors == '1' ) {
|
68 |
$service_errors['vk'] = $vk;
|
69 |
}
|
70 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when VK is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
$service_url = esc_url( 'https://vk.com/share.php' );
|
17 |
|
18 |
+
// Build button URL.
|
19 |
$button_url = $service_url . '?url=' . $share_url;
|
20 |
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#527498';
|
|
|
|
|
|
|
23 |
$secondary_color = '#4273c8';
|
24 |
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34 32"><path fill="' . $main_color . '" d="M34.2 9.3q0.4 1.1-2.7 5.3-0.4 0.6-1.2 1.5-1.4 1.8-1.6 2.3-0.3 0.7 0.3 1.4 0.3 0.4 1.4 1.5h0l0.1 0.1q2.5 2.3 3.4 3.9 0.1 0.1 0.1 0.2t0.1 0.5 0 0.6-0.4 0.5-1.1 0.2l-4.6 0.1q-0.4 0.1-1-0.1t-0.9-0.4l-0.4-0.2q-0.5-0.4-1.2-1.1t-1.2-1.4-1.1-1-1-0.3q-0.1 0-0.1 0.1t-0.3 0.3-0.4 0.5-0.3 0.9-0.1 1.4q0 0.3-0.1 0.5t-0.1 0.3l-0.1 0.1q-0.3 0.3-0.9 0.4h-2.1q-1.3 0.1-2.6-0.3t-2.3-0.9-1.8-1.2-1.3-1l-0.4-0.4q-0.2-0.2-0.5-0.5t-1.3-1.6-1.9-2.7-2.2-3.8-2.3-4.9q-0.1-0.3-0.1-0.5t0.1-0.3l0.1-0.1q0.3-0.3 1-0.3l4.9 0q0.2 0 0.4 0.1t0.3 0.2l0.1 0.1q0.3 0.2 0.4 0.6 0.4 0.9 0.8 1.8t0.7 1.5l0.3 0.5q0.5 1.1 1 1.9t0.9 1.2 0.7 0.7 0.6 0.3 0.5-0.1q0 0 0.1-0.1t0.2-0.4 0.2-0.8 0.2-1.4 0-2.2q0-0.7-0.2-1.3t-0.2-0.8l-0.1-0.2q-0.4-0.6-1.5-0.8-0.2 0 0.1-0.4 0.3-0.3 0.7-0.5 0.9-0.5 4.3-0.4 1.5 0 2.4 0.2 0.4 0.1 0.6 0.2t0.4 0.4 0.2 0.6 0.1 0.8 0 1 0 1.3 0 1.5q0 0.2 0 0.8t0 0.9 0.1 0.7 0.2 0.7 0.4 0.4q0.1 0 0.3 0.1t0.5-0.2 0.7-0.6 0.9-1.2 1.2-1.9q1.1-1.9 1.9-4 0.1-0.2 0.2-0.3t0.2-0.2l0.1-0.1 0.1 0t0.2-0.1 0.4 0l5.1 0q0.7-0.1 1.1 0t0.6 0.3z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 1;
|
30 |
|
31 |
+
// Button alt label.
|
32 |
$button_title_array = array(
|
33 |
'bg' => 'Сподели във VK',
|
34 |
+
'cs' => 'Sdílet na VKu',
|
35 |
'da' => 'Del på VK',
|
36 |
'de' => 'Bei VK teilen',
|
37 |
'en' => 'Share on VK',
|
48 |
'pl' => 'Udostępnij na VKu',
|
49 |
'pt' => 'Compartilhar no VK',
|
50 |
'ro' => 'Partajează pe VK',
|
51 |
+
'ru' => 'Поделиться на ВКонтакте',
|
52 |
'sk' => 'Zdieľať na VKu',
|
53 |
'sl' => 'Deli na VKu',
|
54 |
'sr' => 'Podeli na VK-u',
|
56 |
'tr' => 'VK\'ta paylaş',
|
57 |
'zh' => '在VK上分享',
|
58 |
);
|
59 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
60 |
+
// Fetch counts.
|
|
|
|
|
61 |
$vk = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'http://vk.com/share.php?act=count&url=' . $post_url ) ) );
|
62 |
if ( isset( $vk ) ) {
|
63 |
preg_match( '/^VK.Share.count\((\d+),\s+(\d+)\);$/i', $vk, $matches );
|
64 |
$vk_count = intval( $matches[2] );
|
65 |
}
|
66 |
+
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
|
|
|
67 |
if ( isset( $vk_count ) ) {
|
68 |
$share_counts['vk'] = $vk_count;
|
69 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
|
|
|
|
70 |
$service_errors['vk'] = $vk;
|
71 |
}
|
72 |
}
|
services/shariff-wallabag.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Wallabag is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://app.wallabag.it/bookmarklet' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#26a69a';
|
23 |
+
$secondary_color = '#2bbbad';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 500"><path fill="' . $main_color . '" d="M381 474l-5 7c-15 19-29 20-45 2-14-15-30-28-47-38a75 75 0 0 1-15-12c-8-8-10-19-8-30 2-8-2-12-8-16l-3 12c-8 33-31 51-64 57-36 6-73 7-109 5l-57-4c-9-1-9-1-7-9h46c28 0 55-1 82-9 45-14 67-49 62-96l-4-25 43 13q101 24 197-11c6-2 10-2 14 5l-49 53-15 15c-8 8-8 15 1 23l24 18 50 34c-8 20-26 26-43 14l-43-34c-14-10-23-25-31-39-3-4-6-6-10-5h-36c-5-1-8 1-9 6zM409 4l-6 49c-2 19-9 35-28 45l40 50c-13 9-26 11-40 12-19 0-36-6-54-11-16-4-34-9-51-11-10-2-20 0-31 1l30-38c-16-9-25-23-28-41l-1-15-3-41c21 5 38 16 51 33l11 16 22 29c10-9 19-18 24-29 12-26 32-42 60-48l4-1zm-19 187c12 9 17 20 16 35l-2 47c-3 31-26 48-57 40a114 114 0 0 1-11-3 44 44 0 0 0-28-1 110 110 0 0 1-28 5c-16 0-28-8-33-24-6-16-6-33-6-50v-14c-2-15 2-28 17-35 10 6 19 13 17 27v32c-1 14 5 25 16 33 15-12 16-28 15-45v-30c0-11 4-15 12-16 8-2 11 0 15 10 6 13 10 27 8 41-2 17 4 30 16 40 11-10 16-23 14-38v-16c0-21 1-24 19-38z"/></svg>';
|
27 |
+
|
28 |
+
// Button text label.
|
29 |
+
$button_text_array = array(
|
30 |
+
'de' => 'wallabag it',
|
31 |
+
'en' => 'wallabag it',
|
32 |
+
);
|
33 |
+
|
34 |
+
// Button alt label.
|
35 |
+
$button_title_array = array(
|
36 |
+
'de' => 'Bei wallabag speichern',
|
37 |
+
'en' => 'Save to wallabag',
|
38 |
+
);
|
39 |
+
}
|
services/shariff-weibo.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Weibo is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'http://service.weibo.com/share/share.php' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#e6162d';
|
23 |
+
$secondary_color = '#ff9933';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96.7 96.7" width="97" height="97"><path fill="' . $main_color . '" d="M72.6 46.9c-1.4-0.4-2.3-0.7-1.6-2.5 1.5-3.9 1.7-7.2 0-9.6 -3.1-4.5-11.7-4.2-21.6-0.1 0 0-3.1 1.4-2.3-1.1 1.5-4.9 1.3-8.9-1.1-11.3 -5.3-5.3-19.5 0.2-31.7 12.4C5.3 43.8 0 53.4 0 61.8c0 16 20.5 25.7 40.6 25.7 26.3 0 43.8-15.3 43.8-27.4C84.4 52.8 78.2 48.6 72.6 46.9ZM40.6 81.8c-16 1.6-29.8-5.7-30.9-16.2 -1-10.5 11.1-20.3 27.1-21.9 16-1.6 29.8 5.7 30.9 16.2C68.8 70.4 56.6 80.2 40.6 81.8Z"/><path d="M90.1 17.6L90.1 17.6c-6.3-7-15.7-9.7-24.4-7.9h0c-2 0.4-3.3 2.4-2.8 4.4 0.4 2 2.4 3.3 4.4 2.8 6.2-1.3 12.8 0.6 17.3 5.6 4.5 5 5.7 11.8 3.8 17.8l0 0c-0.6 1.9 0.4 4 2.4 4.7 1.9 0.6 4-0.4 4.7-2.4 0 0 0 0 0 0C98.2 34.3 96.5 24.7 90.1 17.6Z"/><path d="M68.5 22.6c-1.7 0.4-2.8 2.1-2.4 3.8 0.4 1.7 2.1 2.8 3.8 2.4v0c2.1-0.4 4.3 0.2 5.8 1.9 1.5 1.7 1.9 4 1.3 6h0c-0.5 1.7 0.4 3.5 2.1 4 1.7 0.5 3.5-0.4 4-2.1 1.3-4.1 0.5-8.8-2.6-12.2C77.3 23 72.7 21.7 68.5 22.6Z"/><polygon points="80.4 26.4 80.4 26.4 80.4 26.4"/><path fill="' . $main_color . '" d="M42.2 51.8c-7.6-2-16.2 1.8-19.5 8.5 -3.4 6.8-0.1 14.4 7.6 16.9 8 2.6 17.4-1.4 20.6-8.8C54.1 61.3 50.1 53.9 42.2 51.8ZM36.4 69.3c-1.5 2.5-4.9 3.6-7.4 2.4 -2.5-1.1-3.2-4-1.6-6.4 1.5-2.4 4.7-3.5 7.2-2.4C37.1 64 37.9 66.8 36.4 69.3ZM41.5 62.8c-0.6 1-1.8 1.4-2.8 1 -1-0.4-1.3-1.5-0.7-2.4 0.6-0.9 1.7-1.4 2.7-1C41.7 60.7 42 61.8 41.5 62.8Z"/></svg>';
|
27 |
+
|
28 |
+
// Button alt label.
|
29 |
+
$button_title_array = array(
|
30 |
+
'bg' => 'Сподели в tencent weibo',
|
31 |
+
'cs' => 'Sdílet na tencent weibo',
|
32 |
+
'da' => 'Del på tencent weibo',
|
33 |
+
'de' => 'Bei tencent weibo teilen',
|
34 |
+
'en' => 'Share on tencent weibo',
|
35 |
+
'es' => 'Compartir en tencent weibo',
|
36 |
+
'fi' => 'Jaa tencent weiboissä',
|
37 |
+
'fr' => 'Partager sur tencent weibo',
|
38 |
+
'hr' => 'Podijelite na tencent weibo',
|
39 |
+
'hu' => 'Megosztás tencent weiboen',
|
40 |
+
'it' => 'Condividi su tencent weibo',
|
41 |
+
'ja' => 'Tencent weibo上で共有',
|
42 |
+
'ko' => 'Tencent weibo에서 공유하기',
|
43 |
+
'nl' => 'Delen op tencent weibo',
|
44 |
+
'no' => 'Del på tencent weibo',
|
45 |
+
'pl' => 'Udostępnij przez tencent weibo',
|
46 |
+
'pt' => 'Compartilhar no tencent weibo',
|
47 |
+
'ro' => 'Partajează pe tencent weibo',
|
48 |
+
'ru' => 'Поделиться на tencent weibo',
|
49 |
+
'sk' => 'Zdieľať na tencent weibo',
|
50 |
+
'sl' => 'Deli na tencent weibo',
|
51 |
+
'sr' => 'Podeli na tencent weibo-u',
|
52 |
+
'sv' => 'Dela på tencent weibo',
|
53 |
+
'tr' => 'Tencent weibo\'ta paylaş',
|
54 |
+
'zh' => '分享至腾讯微博',
|
55 |
+
);
|
56 |
+
}
|
services/shariff-whatsapp.php
CHANGED
@@ -1,52 +1,59 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
//
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
//
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
'
|
34 |
-
'
|
35 |
-
'
|
36 |
-
'
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
44 |
-
'
|
45 |
-
'
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
-
'
|
50 |
-
'
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when WhatsApp is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = 'whatsapp://send';
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?text=' . $share_title . '%20' . $share_url;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#34af23';
|
23 |
+
$secondary_color = '#5cbe4a';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M17.6 17.4q0.2 0 1.7 0.8t1.6 0.9q0 0.1 0 0.3 0 0.6-0.3 1.4-0.3 0.7-1.3 1.2t-1.8 0.5q-1 0-3.4-1.1-1.7-0.8-3-2.1t-2.6-3.3q-1.3-1.9-1.3-3.5v-0.1q0.1-1.6 1.3-2.8 0.4-0.4 0.9-0.4 0.1 0 0.3 0t0.3 0q0.3 0 0.5 0.1t0.3 0.5q0.1 0.4 0.6 1.6t0.4 1.3q0 0.4-0.6 1t-0.6 0.8q0 0.1 0.1 0.3 0.6 1.3 1.8 2.4 1 0.9 2.7 1.8 0.2 0.1 0.4 0.1 0.3 0 1-0.9t0.9-0.9zM14 26.9q2.3 0 4.3-0.9t3.6-2.4 2.4-3.6 0.9-4.3-0.9-4.3-2.4-3.6-3.6-2.4-4.3-0.9-4.3 0.9-3.6 2.4-2.4 3.6-0.9 4.3q0 3.6 2.1 6.6l-1.4 4.2 4.3-1.4q2.8 1.9 6.2 1.9zM14 2.2q2.7 0 5.2 1.1t4.3 2.9 2.9 4.3 1.1 5.2-1.1 5.2-2.9 4.3-4.3 2.9-5.2 1.1q-3.5 0-6.5-1.7l-7.4 2.4 2.4-7.2q-1.9-3.2-1.9-6.9 0-2.7 1.1-5.2t2.9-4.3 4.3-2.9 5.2-1.1z"/></svg>';
|
27 |
+
|
28 |
+
// Mobile only?
|
29 |
+
$mobile_only = 1;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели в Whatsapp',
|
34 |
+
'cs' => 'Sdílet na Whatsappu',
|
35 |
+
'da' => 'Del på Whatsapp',
|
36 |
+
'de' => 'Bei Whatsapp teilen',
|
37 |
+
'en' => 'Share on Whatsapp',
|
38 |
+
'es' => 'Compartir en Whatsapp',
|
39 |
+
'fi' => 'Jaa WhatsAppissä',
|
40 |
+
'fr' => 'Partager sur Whatsapp',
|
41 |
+
'hr' => 'Podijelite na Whatsapp',
|
42 |
+
'hu' => 'Megosztás WhatsAppen',
|
43 |
+
'it' => 'Condividi su Whatsapp',
|
44 |
+
'ja' => 'Whatsapp上で共有',
|
45 |
+
'ko' => 'Whatsapp에서 공유하기',
|
46 |
+
'nl' => 'Delen op Whatsapp',
|
47 |
+
'no' => 'Del på Whatsapp',
|
48 |
+
'pl' => 'Udostępnij przez WhatsApp',
|
49 |
+
'pt' => 'Compartilhar no Whatsapp',
|
50 |
+
'ro' => 'Partajează pe Whatsapp',
|
51 |
+
'ru' => 'Поделиться на Whatsapp',
|
52 |
+
'sk' => 'Zdieľať na Whatsapp',
|
53 |
+
'sl' => 'Deli na Whatsapp',
|
54 |
+
'sr' => 'Podeli na WhatsApp-u',
|
55 |
+
'sv' => 'Dela på Whatsapp',
|
56 |
+
'tr' => 'Whatsapp\'ta paylaş',
|
57 |
+
'zh' => '在Whatsapp上分享',
|
58 |
+
);
|
59 |
+
}
|
services/shariff-xing.php
CHANGED
@@ -1,83 +1,86 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
//
|
16 |
-
$
|
17 |
-
|
18 |
-
//
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
|
25 |
-
//
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
'
|
58 |
-
);
|
59 |
-
|
60 |
-
//
|
61 |
-
$
|
62 |
-
'
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
'
|
68 |
-
'
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
}
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included in the shariff.php only, when Xing is requested as a service.
|
4 |
+
*
|
5 |
+
* @package Shariff Wrapper
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Prevent direct calls.
|
9 |
+
if ( ! class_exists( 'WP' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
+
|
13 |
+
// Check if we need the frontend or the backend part.
|
14 |
+
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
+
// Service URL.
|
16 |
+
$service_url = esc_url( 'https://www.xing.com/social_plugins/share' );
|
17 |
+
|
18 |
+
// Build button URL.
|
19 |
+
$button_url = $service_url . '?url=' . $share_url;
|
20 |
+
|
21 |
+
// Colors.
|
22 |
+
$main_color = '#126567';
|
23 |
+
$secondary_color = '#29888a';
|
24 |
+
|
25 |
+
// SVG icon.
|
26 |
+
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"><path fill="' . $main_color . '" d="M10.7 11.9q-0.2 0.3-4.6 8.2-0.5 0.8-1.2 0.8h-4.3q-0.4 0-0.5-0.3t0-0.6l4.5-8q0 0 0 0l-2.9-5q-0.2-0.4 0-0.7 0.2-0.3 0.5-0.3h4.3q0.7 0 1.2 0.8zM25.1 0.4q0.2 0.3 0 0.7l-9.4 16.7 6 11q0.2 0.4 0 0.6-0.2 0.3-0.6 0.3h-4.3q-0.7 0-1.2-0.8l-6-11.1q0.3-0.6 9.5-16.8 0.4-0.8 1.2-0.8h4.3q0.4 0 0.5 0.3z"/></svg>';
|
27 |
+
|
28 |
+
// Backend available?
|
29 |
+
$backend_available = 1;
|
30 |
+
|
31 |
+
// Button alt label.
|
32 |
+
$button_title_array = array(
|
33 |
+
'bg' => 'Сподели в XING',
|
34 |
+
'cs' => 'Sdílet na XINGu',
|
35 |
+
'da' => 'Del på XING',
|
36 |
+
'de' => 'Bei XING teilen',
|
37 |
+
'en' => 'Share on XING',
|
38 |
+
'es' => 'Compartir en XING',
|
39 |
+
'fi' => 'Jaa XINGissä',
|
40 |
+
'fr' => 'Partager sur XING',
|
41 |
+
'hr' => 'Podijelite na XING',
|
42 |
+
'hu' => 'Megosztás XINGen',
|
43 |
+
'it' => 'Condividi su XING',
|
44 |
+
'ja' => 'XING上で共有',
|
45 |
+
'ko' => 'XING에서 공유하기',
|
46 |
+
'nl' => 'Delen op XING',
|
47 |
+
'no' => 'Del på XING',
|
48 |
+
'pl' => 'Udostępnij przez XING',
|
49 |
+
'pt' => 'Compartilhar no XING',
|
50 |
+
'ro' => 'Partajează pe XING',
|
51 |
+
'ru' => 'Поделиться на XING',
|
52 |
+
'sk' => 'Zdieľať na XING',
|
53 |
+
'sl' => 'Deli na XING',
|
54 |
+
'sr' => 'Podeli na XING-u',
|
55 |
+
'sv' => 'Dela på XING',
|
56 |
+
'tr' => 'XING\'ta paylaş',
|
57 |
+
'zh' => '分享至XING',
|
58 |
+
);
|
59 |
+
} elseif ( isset( $backend ) && 1 === $backend ) {
|
60 |
+
// Set xing options.
|
61 |
+
$xing_json = array(
|
62 |
+
'url' => $post_url_raw,
|
63 |
+
);
|
64 |
+
|
65 |
+
// Set post options.
|
66 |
+
$xing_post_options = array(
|
67 |
+
'method' => 'POST',
|
68 |
+
'timeout' => 5,
|
69 |
+
'redirection' => 5,
|
70 |
+
'httpversion' => '1.0',
|
71 |
+
'blocking' => true,
|
72 |
+
'headers' => array( 'content-type' => 'application/json' ),
|
73 |
+
'body' => wp_json_encode( $xing_json ),
|
74 |
+
);
|
75 |
+
|
76 |
+
// Fetch counts.
|
77 |
+
$xing = sanitize_text_field( wp_remote_retrieve_body( wp_remote_post( 'https://www.xing-share.com/spi/shares/statistics', $xing_post_options ) ) );
|
78 |
+
$xing_json = json_decode( $xing, true );
|
79 |
+
|
80 |
+
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
|
81 |
+
if ( isset( $xing_json['share_counter'] ) ) {
|
82 |
+
$share_counts['xing'] = intval( $xing_json['share_counter'] );
|
83 |
+
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
|
84 |
+
$service_errors['xing'] = $xing;
|
85 |
+
}
|
86 |
+
}
|
shariff.php
CHANGED
@@ -1,688 +1,898 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
* Plugin Name: Shariff Wrapper
|
4 |
-
* Plugin URI: https://
|
5 |
-
* Description:
|
6 |
-
* Version: 4.
|
7 |
* Author: Jan-Peter Lambeck & 3UU
|
8 |
-
* Author URI: https://
|
9 |
* License: MIT
|
10 |
-
* License URI:
|
11 |
-
* Donate link: http://folge.link/?bitcoin:1Ritz1iUaLaxuYcXhUCoFhkVRH6GWiMTP
|
12 |
* Text Domain: shariff
|
|
|
|
|
13 |
*/
|
14 |
|
15 |
-
//
|
16 |
-
if ( ! class_exists('WP') ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
//
|
19 |
-
$
|
20 |
-
$
|
21 |
-
$shariff3UU_advanced = (array) get_option( 'shariff3UU_advanced' );
|
22 |
-
$shariff3UU_mailform = (array) get_option( 'shariff3UU_mailform' );
|
23 |
-
$shariff3UU_statistic = (array) get_option( 'shariff3UU_statistic' );
|
24 |
-
$shariff3UU = array_merge( $shariff3UU_basic, $shariff3UU_design, $shariff3UU_advanced, $shariff3UU_mailform, $shariff3UU_statistic );
|
25 |
|
26 |
-
|
27 |
-
function
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
31 |
|
32 |
-
//
|
33 |
-
$
|
34 |
|
35 |
-
//
|
36 |
-
if ( empty( $
|
37 |
-
//
|
38 |
-
include
|
39 |
}
|
40 |
}
|
41 |
-
add_action( 'admin_init', '
|
42 |
|
43 |
-
|
|
|
|
|
|
|
44 |
$allowed_tags = array(
|
45 |
-
//
|
46 |
'strong' => array(),
|
47 |
'em' => array(),
|
48 |
'b' => array(),
|
49 |
'i' => array(),
|
50 |
'br' => array(),
|
51 |
-
//
|
52 |
-
'span'
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
'
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
);
|
63 |
|
64 |
-
|
65 |
if ( is_admin() ) {
|
66 |
-
//
|
67 |
-
include
|
68 |
-
//
|
69 |
-
include
|
70 |
}
|
71 |
|
72 |
-
|
73 |
-
function
|
74 |
-
//
|
75 |
if ( current_user_can( 'publish_posts' ) ) {
|
76 |
-
//
|
77 |
-
include
|
78 |
}
|
79 |
}
|
80 |
-
add_action
|
81 |
-
|
82 |
-
|
83 |
-
function shariff3UU_dismiss_update_notice() {
|
84 |
-
update_option( 'shariff3UU_hide_update_notice', 'hide' );
|
85 |
}
|
86 |
-
add_action( 'wp_ajax_shariffdismiss', 'shariff3UU_dismiss_update_notice' );
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
return array_merge(
|
94 |
$links,
|
95 |
-
array( '<a href="options-general.php?page=shariff3uu">' . __( 'Settings', 'shariff' ) . '</a>', '<a href="https://wordpress.org/support/plugin/shariff" target="_blank">' . __( 'Support Forum', 'shariff' ) . '</a>' )
|
96 |
);
|
97 |
}
|
98 |
return $links;
|
99 |
}
|
100 |
-
add_filter( 'plugin_row_meta', '
|
101 |
|
102 |
-
|
103 |
function shariff_init_locale() {
|
104 |
if ( function_exists( 'load_plugin_textdomain' ) ) {
|
105 |
load_plugin_textdomain( 'shariff' );
|
106 |
}
|
107 |
}
|
108 |
|
109 |
-
|
110 |
-
function
|
111 |
register_rest_route( 'shariff/v1', '/share_counts', array(
|
112 |
-
'methods'
|
113 |
-
'callback' => '
|
114 |
-
'args'
|
115 |
-
'url'
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
),
|
119 |
) );
|
120 |
}
|
121 |
-
add_action( 'rest_api_init', '
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
-
//
|
129 |
-
$url
|
130 |
-
$services
|
131 |
$timestamp = $request['timestamp'];
|
132 |
-
|
133 |
-
//
|
134 |
-
if ( empty( $url ) ||
|
135 |
return new WP_Error( 'nourl', 'No URL provided!', array( 'status' => 400 ) );
|
136 |
}
|
137 |
|
138 |
-
//
|
139 |
-
if ( empty( $services ) ||
|
140 |
return new WP_Error( 'noservices', 'No services provided!', array( 'status' => 400 ) );
|
141 |
}
|
142 |
|
143 |
-
//
|
144 |
-
$get_url =
|
145 |
-
$wp_url
|
146 |
-
//
|
147 |
if ( defined( 'SHARIFF_FRONTENDS' ) ) {
|
148 |
$shariff_frontends = array_flip( explode( '|', SHARIFF_FRONTENDS ) );
|
149 |
if ( ! isset( $get_url['host'] ) || ! array_key_exists( $get_url['host'], $shariff_frontends ) ) {
|
150 |
return new WP_Error( 'externaldomainnotallowed', 'External domain not allowed by this server!', array( 'status' => 400 ) );
|
151 |
}
|
152 |
-
}
|
153 |
-
// else compare that domain is equal
|
154 |
-
elseif ( ! isset( $get_url['host'] ) || $get_url['host'] != $wp_url['host'] ) {
|
155 |
return new WP_Error( 'domainnotallowed', 'Domain not allowed by this server!', array( 'status' => 400 ) );
|
156 |
}
|
157 |
|
158 |
-
//
|
159 |
-
$post_url
|
160 |
-
$
|
161 |
-
|
162 |
-
//
|
163 |
-
//
|
164 |
-
//
|
165 |
-
$post_hash = 'shariff' . hash(
|
166 |
-
|
167 |
-
//
|
168 |
-
if ( isset( $
|
169 |
-
$ttl = absint( $
|
170 |
-
//
|
171 |
-
if ( $ttl < '61' )
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
176 |
$ttl = '300';
|
177 |
}
|
178 |
|
179 |
-
//
|
180 |
-
if ( isset
|
181 |
-
//
|
182 |
-
$post_time
|
183 |
$current_time = current_time( 'timestamp', true );
|
184 |
-
$post_age
|
185 |
if ( $post_age > '0' ) {
|
186 |
$post_age_days = round( $post_age / 60 / 60 / 24 );
|
187 |
-
//
|
188 |
-
if ( $ttl > '300' )
|
|
|
|
|
189 |
$ttl = round( ( $ttl + $post_age_days * 3 ) * ( $post_age_days * 2 ) );
|
190 |
}
|
191 |
-
|
|
|
192 |
if ( $ttl < '60' ) {
|
193 |
$ttl = '60';
|
194 |
-
}
|
195 |
-
elseif ( $ttl > '604800' ) {
|
196 |
$ttl = '604800';
|
197 |
}
|
198 |
-
|
|
|
199 |
if ( $post_time < '946684800' ) {
|
200 |
$ttl = '300';
|
201 |
}
|
202 |
}
|
203 |
|
204 |
-
// default
|
205 |
$need_update = false;
|
206 |
|
207 |
-
//
|
208 |
$real_services = str_replace( 'totalnumber|', '', $services );
|
209 |
$real_services = str_replace( '|totalnumber', '', $real_services );
|
210 |
|
211 |
-
//
|
212 |
$service_array = explode( '|', $real_services );
|
213 |
-
|
214 |
-
//
|
215 |
$service_array = array_unique( $service_array );
|
216 |
|
217 |
-
//
|
218 |
-
if ( get_transient( $post_hash ) !== false )
|
219 |
-
|
|
|
|
|
|
|
220 |
|
221 |
-
//
|
222 |
if ( get_transient( $post_hash ) !== false ) {
|
223 |
-
//
|
224 |
$diff = current_time( 'timestamp', true ) - $old_share_counts['timestamp'];
|
225 |
-
if ( $diff > $ttl )
|
226 |
-
|
|
|
|
|
227 |
$diff_array = array_diff_key( array_flip( $service_array ), $old_share_counts );
|
228 |
if ( ! empty( $diff_array ) ) {
|
229 |
$need_update = true;
|
230 |
-
//
|
231 |
$service_array = array_flip( $diff_array );
|
232 |
}
|
|
|
|
|
233 |
}
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
$response = '';
|
238 |
$share_counts = array();
|
239 |
|
240 |
-
//
|
241 |
-
if (
|
242 |
$share_counts = $old_share_counts;
|
243 |
-
// update info
|
244 |
$share_counts['updated'] = '0';
|
245 |
-
}
|
246 |
-
|
247 |
-
elseif ( $services == 'totalnumber' ) {
|
248 |
$share_counts = $old_share_counts;
|
249 |
-
}
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
$share_counts = json_decode( $response, true );
|
254 |
-
//
|
255 |
set_transient( $post_hash, $share_counts, '604800' );
|
256 |
-
//
|
257 |
do_action( 'shariff_share_counts', $share_counts );
|
258 |
-
}
|
259 |
-
|
260 |
-
|
261 |
-
$share_counts = shariff3UU_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $post_url, $post_url2 );
|
262 |
}
|
263 |
|
264 |
-
//
|
265 |
-
if ( isset( $share_counts ) && $share_counts
|
266 |
return $share_counts;
|
|
|
|
|
267 |
}
|
268 |
}
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
|
275 |
-
//
|
276 |
-
$
|
277 |
|
278 |
-
//
|
279 |
-
$total_count
|
280 |
$share_counts = array();
|
281 |
-
|
282 |
-
//
|
283 |
foreach ( $service_array as $service ) {
|
284 |
-
//
|
285 |
-
if ( ! empty( $service ) && ( ! isset( $
|
286 |
-
//
|
287 |
-
$path_service_file =
|
288 |
-
//
|
289 |
-
if ( file_exists( $path_service_file ) )
|
|
|
|
|
290 |
// if we have an error (e.g. a timeout) and we have an old share count for this service, keep it!
|
291 |
if ( array_key_exists( $service, $old_share_counts ) && ( ! array_key_exists( $service, $share_counts ) || empty( $share_counts[ $service ] ) ) ) {
|
292 |
$share_counts[ $service ] = $old_share_counts[ $service ];
|
293 |
}
|
294 |
}
|
295 |
-
//
|
296 |
-
if ( isset( $share_counts[ $service ] ) )
|
|
|
|
|
297 |
}
|
298 |
|
299 |
-
//
|
300 |
-
if (
|
|
|
|
|
301 |
|
302 |
-
//
|
303 |
if ( isset( $share_counts ) ) {
|
304 |
-
//
|
305 |
$share_counts['timestamp'] = current_time( 'timestamp', true );
|
306 |
-
$share_counts['url']
|
307 |
-
//
|
308 |
if ( get_transient( $post_hash ) !== false ) {
|
309 |
$other_request = get_transient( $post_hash );
|
310 |
-
$share_counts
|
311 |
}
|
312 |
-
//
|
313 |
set_transient( $post_hash, $share_counts, '604800' );
|
314 |
-
//
|
315 |
do_action( 'shariff_share_counts', $share_counts );
|
316 |
-
//
|
317 |
-
$share_counts['updated'] =
|
318 |
-
}
|
319 |
-
elseif ( isset( $old_share_counts ) ) {
|
320 |
$share_counts = $old_share_counts;
|
321 |
-
//
|
322 |
$share_counts['updated'] = '0';
|
323 |
}
|
324 |
|
325 |
-
//
|
326 |
return $share_counts;
|
327 |
}
|
328 |
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
|
|
336 |
$numberposts = '100';
|
337 |
}
|
338 |
|
339 |
-
//
|
340 |
-
if ( empty( $GLOBALS[
|
341 |
-
|
|
|
|
|
|
|
342 |
|
343 |
-
//
|
344 |
$service_array = explode( '|', $services );
|
345 |
-
|
346 |
-
//
|
347 |
-
$args = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
$recent_posts = wp_get_recent_posts( $args );
|
349 |
if ( $recent_posts ) {
|
350 |
-
foreach( $recent_posts as $recent ) {
|
351 |
-
//
|
352 |
-
$url
|
353 |
-
$post_url =
|
354 |
-
//
|
355 |
-
$post_hash = 'shariff' . hash(
|
356 |
-
//
|
357 |
-
if ( get_transient( $post_hash ) !== false )
|
358 |
-
|
359 |
-
|
360 |
-
|
|
|
|
|
|
|
361 |
}
|
362 |
}
|
363 |
}
|
364 |
-
add_action( '
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
//
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
|
|
|
|
376 |
}
|
377 |
-
}
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
|
383 |
}
|
384 |
}
|
385 |
}
|
386 |
-
add_action( '
|
|
|
|
|
|
|
387 |
|
388 |
-
|
389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
$schedules['weekly'] = array(
|
391 |
-
'display'
|
392 |
-
'interval' =>
|
393 |
);
|
394 |
return $schedules;
|
395 |
}
|
396 |
-
add_filter( 'cron_schedules', '
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
|
|
|
|
|
|
|
|
|
|
403 |
|
404 |
-
//
|
405 |
-
if ( in_array( 'get_the_excerpt', $GLOBALS['wp_current_filter'] ) || ( ! in_the_loop() && isset( $
|
406 |
return $content;
|
407 |
}
|
408 |
|
409 |
-
//
|
410 |
-
if ( ( post_password_required( get_the_ID() )
|
411 |
-
$
|
412 |
-
$
|
413 |
-
$
|
414 |
-
$
|
415 |
-
$
|
416 |
-
$
|
417 |
-
$
|
418 |
-
}
|
419 |
-
|
420 |
-
//
|
421 |
-
if ( strpos( $content,'/hideshariff' )
|
422 |
-
$content = str_replace(
|
423 |
-
}
|
424 |
-
|
425 |
-
|
426 |
-
//
|
427 |
-
$content = str_replace( "hideshariff", "", $content);
|
428 |
-
// and return without adding Shariff
|
429 |
return $content;
|
430 |
}
|
431 |
|
432 |
-
//
|
433 |
$current_post_type = get_post_type();
|
434 |
-
if (
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
|
|
|
|
439 |
|
440 |
-
//
|
441 |
if ( ! is_singular() ) {
|
442 |
-
//
|
443 |
-
if ( isset( $
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
if ( isset( $
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
if ( is_array( $all_custom_post_types ) ) {
|
460 |
$custom_types = array_keys( $all_custom_post_types );
|
461 |
-
//
|
462 |
-
if ( isset( $
|
|
|
|
|
|
|
|
|
|
|
463 |
}
|
464 |
}
|
465 |
-
|
466 |
-
//
|
467 |
-
if ( get_post_meta( get_the_ID(), 'shariff_metabox_before', true ) )
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
return $content;
|
476 |
}
|
477 |
-
if ( ! isset( $GLOBALS[
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
$content = do_shortcode( '[shariff]' ) . $content;
|
491 |
}
|
492 |
-
//
|
493 |
-
if ( isset( $
|
494 |
$content .= do_shortcode( '[shariff]' );
|
495 |
}
|
496 |
return $content;
|
497 |
}
|
498 |
-
add_filter( 'the_excerpt', '
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
|
|
|
|
|
|
|
|
|
|
505 |
}
|
506 |
return $content;
|
507 |
}
|
508 |
-
add_filter( 'the_content', '
|
509 |
-
|
510 |
-
|
511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
$content = preg_replace( '/<div class="shariff\b[^>]*>(.*?)<\/div>/i', '', $content );
|
513 |
$content = preg_replace( '/<div class="ShariffSC\b[^>]*>(.*?)<\/div>/i', '', $content );
|
514 |
return $content;
|
515 |
}
|
516 |
-
add_filter( 'the_content_feed', '
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
if ( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'sendMail' ) $content = sharif3UU_procSentMail( $content );
|
528 |
-
echo $content;
|
529 |
}
|
530 |
-
add_action( 'bbp_theme_after_reply_content', '
|
531 |
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
}
|
538 |
-
add_action( '
|
539 |
-
|
540 |
-
//
|
541 |
-
add_shortcode( 'shariff', '
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
//
|
552 |
-
$
|
553 |
-
|
554 |
-
|
555 |
-
if (
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
$shariff_metabox_ignore_widget = get_post_meta( get_the_ID(), 'shariff_metabox_ignore_widget', true );
|
561 |
-
|
562 |
-
// if
|
563 |
-
if ( ( ! isset( $atts[
|
564 |
-
//
|
565 |
-
$
|
566 |
-
|
567 |
-
// if the meta box setting is set to
|
568 |
-
if (
|
569 |
-
|
570 |
-
// get meta box shortcode
|
571 |
-
$shariff3UU_metabox = get_post_meta( get_the_ID(), 'shariff_metabox', true );
|
572 |
-
|
573 |
-
// replace shariff with shariffmeta
|
574 |
-
$shariff3UU_metabox = str_replace( '[shariff ', '[shariffmeta ', $shariff3UU_metabox );
|
575 |
-
|
576 |
-
// get meta box atts
|
577 |
-
do_shortcode( $shariff3UU_metabox );
|
578 |
-
if ( isset( $GLOBALS["shariff3UU"]["metabox"] ) ) {
|
579 |
-
$metabox = $GLOBALS["shariff3UU"]["metabox"];
|
580 |
}
|
581 |
-
|
582 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
}
|
584 |
-
|
585 |
-
//
|
586 |
-
$
|
587 |
-
if ( ! empty( $
|
588 |
-
$metabox[
|
589 |
}
|
590 |
-
|
591 |
-
// merge with atts array (meta box shortcode overrides all others)
|
592 |
-
if ( ! empty( $metabox ) ) $atts = array_merge( $atts, $metabox );
|
593 |
-
|
594 |
-
// clear metabox global
|
595 |
-
$GLOBALS["shariff3UU"]["metabox"] = '';
|
596 |
-
}
|
597 |
|
598 |
-
|
599 |
-
|
|
|
|
|
600 |
|
601 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
602 |
$atts = array_filter( $atts );
|
603 |
|
604 |
-
//
|
605 |
-
$atts['services'] = trim( preg_replace(
|
606 |
|
607 |
-
//
|
608 |
if ( array_key_exists( 'headline', $atts ) ) {
|
609 |
-
$atts['headline'] = wp_kses( $atts['headline'], $GLOBALS[
|
610 |
}
|
611 |
|
612 |
-
//
|
613 |
-
//
|
614 |
-
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ===
|
615 |
-
wp_enqueue_style( 'shariffcss', plugins_url( '/css/shariff.css', __FILE__ ), '', $
|
616 |
-
}
|
617 |
-
|
618 |
-
wp_enqueue_style( 'shariffcss', plugins_url( '/css/shariff.min.css', __FILE__ ), '', $shariff3UU["version"] );
|
619 |
}
|
620 |
|
621 |
-
//
|
622 |
-
//
|
623 |
-
if ( array_key_exists( 'backend', $atts ) && $atts['backend']
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
else {
|
629 |
-
wp_enqueue_script( 'shariffjs', plugins_url( '/js/shariff.min.js', __FILE__ ), '', $shariff3UU["version"], true );
|
630 |
}
|
631 |
}
|
632 |
-
|
633 |
-
//
|
634 |
-
//
|
635 |
-
if ( array_key_exists( 'popup', $atts ) && $atts['popup']
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
else {
|
641 |
-
wp_enqueue_script( 'shariff_popup', plugins_url( '/js/shariff-popup.min.js', __FILE__ ), '', $shariff3UU["version"], true );
|
642 |
}
|
643 |
}
|
644 |
|
645 |
-
// share url
|
646 |
-
if ( array_key_exists( 'url', $atts ) )
|
647 |
-
|
|
|
|
|
|
|
648 |
|
649 |
-
// share title
|
650 |
-
if ( array_key_exists( 'title', $atts ) )
|
651 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
|
653 |
-
//
|
654 |
-
$post_hash = 'shariff' . hash( "md5", $share_url );
|
655 |
-
|
656 |
-
// prevent php notices
|
657 |
$share_counts = array();
|
|
|
658 |
|
659 |
-
//
|
660 |
-
if ( array_key_exists( 'backend', $atts ) && $atts['backend']
|
661 |
$share_counts = get_transient( $post_hash );
|
662 |
}
|
663 |
|
664 |
-
//
|
665 |
-
$output = '';
|
666 |
-
|
667 |
-
// if we have a custom style attribute or a class add ShariffSC container including these styles
|
668 |
if ( array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts ) ) {
|
669 |
$output .= '<div class="ShariffSC';
|
670 |
-
if ( array_key_exists( 'cssclass', $atts ) )
|
671 |
-
|
672 |
-
|
|
|
|
|
|
|
|
|
|
|
673 |
$output .= '>';
|
674 |
}
|
675 |
-
|
676 |
-
// if no language is set
|
677 |
-
if ( ! array_key_exists( 'lang', $atts ) && function_exists('http_negotiate_language') ) {
|
678 |
$available_lang = array( 'en', 'de', 'fr', 'es', 'zh', 'hr', 'da', 'nl', 'fi', 'it', 'ja', 'ko', 'no', 'pl', 'pt', 'ro', 'ru', 'sk', 'sl', 'sr', 'sv', 'tr', 'zh' );
|
679 |
-
$lang
|
680 |
-
$atts['lang']
|
681 |
}
|
682 |
|
683 |
-
// default button share text
|
684 |
$default_button_text_array = array(
|
685 |
'bg' => 'cподеляне',
|
|
|
686 |
'da' => 'del',
|
687 |
'de' => 'teilen',
|
688 |
'en' => 'share',
|
@@ -708,831 +918,351 @@ function shariff3UU_render( $atts, $content = null ) {
|
|
708 |
'zh' => '分享',
|
709 |
);
|
710 |
|
711 |
-
//
|
712 |
-
if ( array_key_exists( 'timestamp', $atts ) )
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
724 |
}
|
725 |
-
//
|
726 |
-
if (
|
727 |
-
$output .= '
|
728 |
-
}
|
729 |
-
$
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
$output .= ' data-timestamp="' . $post_timestamp . '"';
|
738 |
-
// hide share counts when zero
|
739 |
-
if ( isset( $atts['hidezero'] ) && $atts['hidezero'] == '1' ) {
|
740 |
-
$output .= ' data-hidezero="1"';
|
741 |
-
}
|
742 |
-
// add external api if entered
|
743 |
-
if ( isset( $shariff3UU["external_host"] ) && ! empty( $shariff3UU["external_host"] ) && isset( $shariff3UU["external_direct"] ) ) {
|
744 |
-
$output .= ' data-backendurl="' . $shariff3UU["external_host"] . '"';
|
745 |
-
}
|
746 |
-
// elseif WP is installed in a subdirectory and the api is only reachable in there -> adjust path
|
747 |
-
elseif ( isset( $shariff3UU["subapi"] ) && $shariff3UU["subapi"] == '1' ) {
|
748 |
-
$output .= ' data-backendurl="' . get_bloginfo( 'wpurl' ) . '/wp-json/shariff/v1/share_counts?' . '"';
|
749 |
-
}
|
750 |
-
// elseif pretty permalinks are not activated fall back to manual rest route
|
751 |
-
elseif ( ! get_option('permalink_structure') ) {
|
752 |
-
$output .= ' data-backendurl="?rest_route=/shariff/v1/share_counts&"';
|
753 |
-
}
|
754 |
-
// else use the home url
|
755 |
-
else {
|
756 |
-
$output .= ' data-backendurl="' . rtrim( home_url(), "/" ) . '/wp-json/shariff/v1/share_counts?' . '"';
|
757 |
-
}
|
758 |
}
|
|
|
759 |
$output .= '>';
|
760 |
-
|
761 |
-
// headline
|
762 |
if ( array_key_exists( 'headline', $atts ) ) {
|
763 |
-
if ( ! array_key_exists( 'total', $share_counts ) )
|
|
|
|
|
764 |
$atts['headline'] = str_replace( '%total', '<span class="shariff-total">' . absint( $share_counts['total'] ) . '</span>', $atts['headline'] );
|
765 |
-
$output
|
766 |
}
|
767 |
|
768 |
-
//
|
769 |
$output .= '<ul class="shariff-buttons ';
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
779 |
$output .= '">';
|
780 |
|
781 |
-
//
|
782 |
-
$flattr_error
|
783 |
-
$paypal_error
|
784 |
-
$paypalme_error
|
785 |
-
$bitcoin_error
|
786 |
-
$patreon_error
|
787 |
$button_text_array = '';
|
788 |
$backend_available = '';
|
789 |
-
$mobile_only
|
|
|
|
|
790 |
|
791 |
-
//
|
792 |
$service_array = explode( '|', $atts['services'] );
|
793 |
|
794 |
-
//
|
795 |
-
$service_array = preg_replace( '/\bmail\b/', '
|
|
|
|
|
|
|
|
|
|
|
|
|
796 |
|
797 |
-
//
|
798 |
foreach ( $service_array as $service ) {
|
799 |
-
//
|
800 |
-
if (
|
801 |
-
|
802 |
-
elseif ( $service
|
803 |
-
|
804 |
-
elseif ( $service
|
805 |
-
|
806 |
-
elseif (
|
807 |
-
|
808 |
-
|
809 |
-
$
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
|
|
|
|
|
|
|
|
815 |
if ( file_exists( $path_service_file ) ) {
|
816 |
|
817 |
-
//
|
818 |
-
include
|
819 |
|
820 |
-
//
|
821 |
if ( array_key_exists( 'maincolor', $atts ) ) {
|
822 |
$main_color = $atts['maincolor'];
|
|
|
|
|
823 |
}
|
824 |
if ( array_key_exists( 'secondarycolor', $atts ) ) {
|
825 |
$secondary_color = $atts['secondarycolor'];
|
826 |
}
|
827 |
|
828 |
-
//
|
829 |
-
if ( array_key_exists( 'borderradius', $atts ) && array_key_exists( 'theme', $atts ) && $atts['theme']
|
830 |
$border_radius = '; border-radius:' . $atts['borderradius'] . '%';
|
831 |
-
}
|
832 |
-
else {
|
833 |
$border_radius = '';
|
834 |
}
|
835 |
|
836 |
-
//
|
837 |
-
if ( ! array_key_exists( 'maincolor', $atts ) &&
|
838 |
-
$main_color
|
839 |
-
$secondary_color =
|
840 |
}
|
841 |
|
842 |
-
//
|
843 |
-
$output .= '<li class="shariff-button ' . $service;
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
// use default button share text, if $button_text_array is empty
|
849 |
-
if ( empty( $button_text_array ) ) $button_text_array = $default_button_text_array;
|
850 |
-
|
851 |
-
// set button text in desired language, fallback is English
|
852 |
-
if ( array_key_exists( 'lang', $atts ) && array_key_exists( $atts['lang'], $button_text_array ) ) $button_text = $button_text_array[ $atts['lang'] ];
|
853 |
-
else $button_text = $button_text_array['en'];
|
854 |
-
|
855 |
-
// set button title / label in desired language, fallback is English
|
856 |
-
if ( array_key_exists( 'lang', $atts ) && array_key_exists( $atts['lang'], $button_title_array ) ) $button_title = $button_title_array[ $atts['lang'] ];
|
857 |
-
else $button_title = $button_title_array['en'];
|
858 |
-
|
859 |
-
// reset $button_text_array
|
860 |
-
$button_text_array = '';
|
861 |
-
|
862 |
-
// build the actual button
|
863 |
-
$output .= '<a href="' . $button_url . '" title="' . $button_title . '" aria-label="' . $button_title . '" role="button" rel="';
|
864 |
-
if ( $mobile_only != '1' ) $output .= 'noopener ';
|
865 |
-
$output .= 'nofollow" class="shariff-link" ';
|
866 |
-
// same window?
|
867 |
-
if ( ! isset( $same_window ) || isset( $same_window ) && $same_window != '1' ) $output .= 'target="_blank" ';
|
868 |
-
$output .= 'style="background-color:' . $main_color . $border_radius;
|
869 |
-
// theme white?
|
870 |
-
if ( isset( $atts['theme'] ) && $atts['theme'] == "white" ) $output .= '; color:' . $main_color;
|
871 |
-
else $output .= '; color:#fff';
|
872 |
-
$output .= '">';
|
873 |
-
$output .= '<span class="shariff-icon"';
|
874 |
-
// theme white?
|
875 |
-
if ( isset( $atts['theme'] ) && $atts['theme'] == "white" ) $output .= ' style="fill:' . $main_color . '"';
|
876 |
-
$output .= '>' . $svg_icon . '</span>';
|
877 |
-
$output .= '<span class="shariff-text">' . $button_text . '</span> ';
|
878 |
-
// share counts?
|
879 |
-
if ( array_key_exists( 'sharecounts', $atts ) && $atts['sharecounts'] == "1" && $backend_available == '1' && ! isset ( $shariff3UU["disable"][ $service ] ) ) {
|
880 |
-
$output .= '<span class="shariff-count" data-service="' . $service . '" style="color:' . $main_color;
|
881 |
-
if ( array_key_exists( $service, $share_counts ) === true && $share_counts[ $service ] !== null && $share_counts[ $service ] !== '-1' && ( ! isset( $atts['hidezero'] ) || ( isset( $atts['hidezero'] ) && $atts['hidezero'] != '1' ) || ( isset( $atts['hidezero'] ) && $atts['hidezero'] == '1' && $share_counts[ $service ] > 0 ) ) ) {
|
882 |
-
$output .= '"> ' . $share_counts[ $service ];
|
883 |
-
}
|
884 |
-
else $output .= ';opacity:0">';
|
885 |
-
$output .= '</span> ';
|
886 |
-
}
|
887 |
-
$output .= '</a>';
|
888 |
-
$output .= '</li>';
|
889 |
-
|
890 |
-
// add service to backend service, if available
|
891 |
-
if ( $backend_available == '1' && ! isset ( $shariff3UU["disable"][ $service ] ) ) $backend_service_array[] = $service;
|
892 |
-
|
893 |
-
// reset $backend_available, $mobile_only, $same_window
|
894 |
-
$backend_available = '';
|
895 |
-
$mobile_only = '';
|
896 |
-
$same_window = '';
|
897 |
-
}
|
898 |
-
}
|
899 |
-
}
|
900 |
-
|
901 |
-
// add the list of backend services
|
902 |
-
if ( ! empty( $backend_service_array ) ) {
|
903 |
-
$backend_services = implode( '|', $backend_service_array );
|
904 |
-
$output = str_replace( 'data-url=', 'data-services="' . esc_html( urlencode( $backend_services ) ) . '" data-url=', $output );
|
905 |
-
}
|
906 |
-
|
907 |
-
// close ul and the main shariff div
|
908 |
-
$output .= '</ul></div>';
|
909 |
-
|
910 |
-
// if we had a style attribute close that too
|
911 |
-
if ( array_key_exists( 'style', $atts ) ) $output .= '</div>';
|
912 |
-
|
913 |
-
// display warning to admins if flattr is set, but no flattr username is provided
|
914 |
-
if ( $flattr_error == '1' && current_user_can( 'manage_options' ) ) {
|
915 |
-
$output .= '<div class="shariff-warning">' . __('Username for Flattr is missing!', 'shariff') . '</div>';
|
916 |
-
}
|
917 |
-
// display warning to admins if patreon is set, but no patreon username is provided
|
918 |
-
if ( $patreon_error == '1' && current_user_can( 'manage_options' ) ) {
|
919 |
-
$output .= '<div class="shariff-warning">' . __('Username for patreon is missing!', 'shariff') . '</div>';
|
920 |
-
}
|
921 |
-
// display warning to admins if paypal is set, but no paypal button id is provided
|
922 |
-
if ( $paypal_error == '1' && current_user_can( 'manage_options' ) ) {
|
923 |
-
$output .= '<div class="shariff-warning">' . __('Button ID for PayPal is missing!', 'shariff') . '</div>';
|
924 |
-
}
|
925 |
-
// display warning to admins if paypalme is set, but no paypalme id is provided
|
926 |
-
if ( $paypalme_error == '1' && current_user_can( 'manage_options' ) ) {
|
927 |
-
$output .= '<div class="shariff-warning">' . __('PayPal.Me ID is missing!', 'shariff') . '</div>';
|
928 |
-
}
|
929 |
-
// display warning to admins if bitcoin is set, but no bitcoin address is provided
|
930 |
-
if ( $bitcoin_error == '1' && current_user_can( 'manage_options' ) ) {
|
931 |
-
$output .= '<div class="shariff-warning">' . __('Address for Bitcoin is missing!', 'shariff') . '</div>';
|
932 |
-
}
|
933 |
-
|
934 |
-
// if the service totalnumber is set, just output the total share count
|
935 |
-
if ( array_key_exists( '0', $service_array ) && $service_array['0'] == 'totalnumber' ) {
|
936 |
-
$output = '<span class="shariff" data-services="totalnumber" data-url="' . $share_url . '"';
|
937 |
-
// add external api
|
938 |
-
if ( isset( $shariff3UU["external_host"] ) && ! empty( $shariff3UU["external_host"] ) && isset( $shariff3UU["external_direct"] ) ) {
|
939 |
-
$output .= ' data-backendurl="' . $shariff3UU["external_host"] . '"';
|
940 |
-
}
|
941 |
-
$output .= '><span class="shariff-totalnumber">' . absint( $share_counts['total'] ) . '</span></span>';
|
942 |
-
}
|
943 |
-
|
944 |
-
return $output;
|
945 |
-
}
|
946 |
-
|
947 |
-
// register helper shortcode
|
948 |
-
add_shortcode( 'shariffmeta', 'shariff3UU_meta' );
|
949 |
-
|
950 |
-
// meta box helper function
|
951 |
-
function shariff3UU_meta( $atts, $content = null ) {
|
952 |
-
$GLOBALS["shariff3UU"]["metabox"] = $atts;
|
953 |
-
return;
|
954 |
-
}
|
955 |
-
|
956 |
-
// prepend mailform if view=mail or send mail if act=sendMail
|
957 |
-
function shariff3UU_viewmail( $content ) {
|
958 |
-
// prepend the mail form and return content
|
959 |
-
if ( isset( $_REQUEST['view'] ) && $_REQUEST['view'] == 'mail' ) {
|
960 |
-
// only add to single view
|
961 |
-
if ( is_singular() ) {
|
962 |
-
return $content = shariff3UU_addMailForm( $content, '0' );
|
963 |
-
}
|
964 |
-
}
|
965 |
-
// send mail and return content
|
966 |
-
elseif ( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'sendMail' ) {
|
967 |
-
// only on single view, main query and in the loop
|
968 |
-
if ( is_singular() && is_main_query() && in_the_loop() ) {
|
969 |
-
return $content = sharif3UU_procSentMail( $content );
|
970 |
-
}
|
971 |
-
}
|
972 |
-
// return content
|
973 |
-
else {
|
974 |
-
return $content;
|
975 |
-
}
|
976 |
-
}
|
977 |
-
|
978 |
-
// only add filter if mailform is not disabled
|
979 |
-
if ( ! isset( $shariff3UU["disable_mailform"] ) || ( isset( $shariff3UU["disable_mailform"] ) && $shariff3UU["disable_mailform"] != '1' ) ) {
|
980 |
-
add_filter( 'the_content', 'shariff3UU_viewmail' );
|
981 |
-
}
|
982 |
-
|
983 |
-
// add mailform
|
984 |
-
function shariff3UU_addMailForm( $content, $error ) {
|
985 |
-
// get options
|
986 |
-
$shariff3UU = $GLOBALS["shariff3UU"];
|
987 |
-
|
988 |
-
// check if mailform is disabled
|
989 |
-
if ( isset( $shariff3UU["disable_mailform"] ) && $shariff3UU["disable_mailform"] == '1' ) {
|
990 |
-
echo '<div id="shariff_mailform" class="shariff_mailform"><div class="shariff_mailform_disabled">';
|
991 |
-
echo __( 'Mail form disabled.', 'shariff' );
|
992 |
-
echo '</div></div>';
|
993 |
-
$mailform = '';
|
994 |
-
}
|
995 |
-
else {
|
996 |
-
// set default language to English as fallback
|
997 |
-
$lang = 'EN';
|
998 |
-
|
999 |
-
// available languages
|
1000 |
-
$available_lang = array( 'EN', 'DE', 'FR', 'IT' );
|
1001 |
-
|
1002 |
-
// check plugin options
|
1003 |
-
if ( isset( $shariff3UU["mailform_language"] ) && $shariff3UU["mailform_language"] != 'auto' ) {
|
1004 |
-
$lang = $shariff3UU["mailform_language"];
|
1005 |
-
}
|
1006 |
-
// if language is set to automatic try geoip
|
1007 |
-
// http://datenverwurstungszentrale.com/stadt-und-land-mittels-geoip-ermitteln-268.htm
|
1008 |
-
elseif ( function_exists('geoip_country_code_by_name') ) {
|
1009 |
-
switch ( @geoip_country_code_by_name( $_SERVER[REMOTE_ADDR] ) ) {
|
1010 |
-
case 'DE': $lang = 'DE';
|
1011 |
-
break;
|
1012 |
-
case 'AT': $lang = 'DE';
|
1013 |
-
break;
|
1014 |
-
case 'CH': $lang = 'DE';
|
1015 |
-
break;
|
1016 |
-
case 'FR': $lang = 'FR';
|
1017 |
-
break;
|
1018 |
-
case 'IT': $lang = 'IT';
|
1019 |
-
break;
|
1020 |
-
default: $lang = 'EN';
|
1021 |
-
}
|
1022 |
-
}
|
1023 |
-
// if no geoip try http_negotiate_language
|
1024 |
-
elseif ( function_exists('http_negotiate_language') ) {
|
1025 |
-
$lang = http_negotiate_language( $available_lang );
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
// include selected language
|
1029 |
-
include( plugin_dir_path( __FILE__ ) . '/locale/mailform-' . $lang . '.php' );
|
1030 |
-
|
1031 |
-
// use wp_nonce_url / wp_verify_nonce to prevent automated spam by url
|
1032 |
-
$submit_link = wp_nonce_url( get_permalink(), 'shariff3UU_send_mail', 'shariff_mf_nonce' );
|
1033 |
-
|
1034 |
-
// add anchor if option is set
|
1035 |
-
if ( isset( $shariff3UU["mailform_anchor"] ) && $shariff3UU["mailform_anchor"] == '1' ) {
|
1036 |
-
$submit_link .= '#shariff_mailform';
|
1037 |
-
}
|
1038 |
-
|
1039 |
-
// sender address optional?
|
1040 |
-
$mf_optional_text = '';
|
1041 |
-
$mf_sender_required = '';
|
1042 |
-
if ( isset( $shariff3UU["require_sender"] ) && $shariff3UU["require_sender"] == '1' ) {
|
1043 |
-
// does not work in Safari, but nice to have in all other cases, because less requests
|
1044 |
-
$mf_sender_required = ' required';
|
1045 |
-
}
|
1046 |
-
else {
|
1047 |
-
$mf_optional_text = $mf_optional[$lang];
|
1048 |
-
}
|
1049 |
-
|
1050 |
-
// field content to prefill fields in case of an error
|
1051 |
-
if ( isset( $error['mf_content_mailto'] ) ) $mf_content_mailto = $error['mf_content_mailto'];
|
1052 |
-
else $mf_content_mailto = '';
|
1053 |
-
if ( isset( $error['mf_content_from'] ) ) $mf_content_from = $error['mf_content_from'];
|
1054 |
-
else $mf_content_from = '';
|
1055 |
-
if ( isset( $error['mf_content_sender'] ) ) $mf_content_sender = $error['mf_content_sender'];
|
1056 |
-
else $mf_content_sender = '';
|
1057 |
-
if ( isset( $error['mf_content_mail_comment'] ) ) $mf_content_mail_comment = $error['mf_content_mail_comment'];
|
1058 |
-
else $mf_content_mail_comment = '';
|
1059 |
-
|
1060 |
-
// create the form
|
1061 |
-
$mailform = '<div id="shariff_mailform" class="shariff_mailform">';
|
1062 |
-
// wait error
|
1063 |
-
if ( ! empty ( $error['wait'] ) ) {
|
1064 |
-
$mailform .= '<div class="shariff_mailform_error">' . sprintf($mf_wait[$lang], $error['wait']) . '</div>';
|
1065 |
-
}
|
1066 |
-
// no to address error
|
1067 |
-
$mf_to_error_html = '';
|
1068 |
-
if ( ! empty ( $error['to'] ) && $error['to'] == '1' ) {
|
1069 |
-
$mf_to_error_html = '<span class="shariff_mailform_error"> ' . $mf_to_error[$lang] . '</span>';
|
1070 |
-
}
|
1071 |
-
// no from address error
|
1072 |
-
$mf_from_error_html = '';
|
1073 |
-
if ( ! empty ( $error['from'] ) && $error['from'] == '1' ) {
|
1074 |
-
$mf_from_error_html = '<span class="shariff_mailform_error"> ' . $mf_from_error[$lang] . '</span>';
|
1075 |
-
}
|
1076 |
-
$mailform .= '<form action="' . $submit_link . '" method="POST">
|
1077 |
-
<fieldset>
|
1078 |
-
<div class="shariff_mailform_headline"><legend>' . $mf_headline[$lang] . '</legend>
|
1079 |
-
<a href="' . get_permalink() . '" class="shariff_closeX"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M10 0c-5.5 0-10 4.5-10 10s4.5 10 10 10 10-4.5 10-10-4.5-10-10-10zM10 18.1c-4.5 0-8.1-3.6-8.1-8.1s3.6-8.1 8.1-8.1 8.1 3.6 8.1 8.1-3.6 8.1-8.1 8.1z"/><path d="M13.1 5l-3.1 3.1-3.1-3.1-1.9 1.9 3.1 3.1-3.1 3.1 1.9 1.9 3.1-3.1 3.1 3.1 1.9-1.9-3.1-3.1 3.1-3.1z"/></svg></a></div>' . $mf_headinfo[$lang] . '
|
1080 |
-
<input type="hidden" name="act" value="sendMail">
|
1081 |
-
<input type="hidden" name="lang" value="' . $lang . '">
|
1082 |
-
<p><label for="mailto">' . $mf_rcpt[$lang] . '</label><br>
|
1083 |
-
<input type="text" name="mailto" id="mailto" value="' . $mf_content_mailto . '" size="27" placeholder="' . $mf_rcpt_ph[$lang] . '" required>' . $mf_to_error_html . '</p>
|
1084 |
-
<p><label for="from">' . $mf_from[$lang] . $mf_optional_text . '</label><br>
|
1085 |
-
<input type="email" name="from" id="from" value="' . $mf_content_from . '" size="27" placeholder="' . $mf_from_ph[$lang] . '" ' . $mf_sender_required .'>' . $mf_from_error_html . '</p>
|
1086 |
-
<p><label for="name">' . $mf_name[$lang] . '</label><br>
|
1087 |
-
<input type="text" name="sender" id="sender" value="' . $mf_content_sender . '" size="27" placeholder="' . $mf_name_ph[$lang] . '"></p>
|
1088 |
-
<p><label for="mail_comment">' . $mf_comment[$lang] . '</label><br>
|
1089 |
-
<textarea name="mail_comment" rows="4">' . $mf_content_mail_comment . '</textarea></p>
|
1090 |
-
<input type="url" name="url" id="shariff_mailform_url" value="" size="27" placeholder="">
|
1091 |
-
</fieldset>
|
1092 |
-
<p><input type="submit" class="shariff_mailform_submit" value="' . $mf_send[$lang] . '" /></p>
|
1093 |
-
<p>' . $mf_info[$lang] . '</p>
|
1094 |
-
</form>
|
1095 |
-
</div>';
|
1096 |
-
}
|
1097 |
-
return $mailform . $content;
|
1098 |
-
}
|
1099 |
-
|
1100 |
-
// helper functions to make it work with PHP < 5.3
|
1101 |
-
// better would be: add_filter( 'wp_mail_from_name', function( $name ) { return sanitize_text_field( $_REQUEST['sender'] ); };
|
1102 |
-
function shariff3UU_set_wp_mail_from_name( $name ) { return sanitize_text_field( $_REQUEST['sender'] ); }
|
1103 |
-
function shariff3UU_set2_wp_mail_from_name( $name ) { return sanitize_text_field( $_REQUEST['from'] ); }
|
1104 |
-
function shariff3UU_set3_wp_mail_from_name( $name ) { return sanitize_text_field( $GLOBALS["shariff3UU"]["mail_sender_name"] ); }
|
1105 |
-
function shariff3UU_set4_wp_mail_from_name( $name ) { return sanitize_text_field( get_bloginfo('name') ); }
|
1106 |
-
function shariff3UU_set_wp_mail_from( $email ) { return sanitize_text_field( $GLOBALS["shariff3UU"]["mail_sender_from"] ); }
|
1107 |
-
|
1108 |
-
// send mail
|
1109 |
-
function sharif3UU_procSentMail( $content ) {
|
1110 |
-
// get options
|
1111 |
-
$shariff3UU = $GLOBALS["shariff3UU"];
|
1112 |
-
|
1113 |
-
// honeypot url input
|
1114 |
-
$mailform_url_field = sanitize_text_field( $_REQUEST['url'] );
|
1115 |
-
|
1116 |
-
// check if mailform is disabled
|
1117 |
-
if ( isset( $shariff3UU["disable_mailform"] ) && $shariff3UU["disable_mailform"] == '1' ) {
|
1118 |
-
return $content;
|
1119 |
-
}
|
1120 |
-
// check if url field has been filled
|
1121 |
-
elseif ( ! empty( $mailform_url_field ) ) {
|
1122 |
-
return $content;
|
1123 |
-
}
|
1124 |
-
else {
|
1125 |
-
// get vars from form
|
1126 |
-
$mf_nonce = sanitize_text_field( $_REQUEST['shariff_mf_nonce'] );
|
1127 |
-
$mf_content_mailto = sanitize_text_field( $_REQUEST['mailto'] );
|
1128 |
-
$mf_content_from = sanitize_text_field( $_REQUEST['from'] );
|
1129 |
-
$mf_content_sender = sanitize_text_field( $_REQUEST['sender'] );
|
1130 |
-
$mf_lang = sanitize_text_field( $_REQUEST['lang'] );
|
1131 |
-
|
1132 |
-
// clean up comments
|
1133 |
-
$mf_comment_content = $_REQUEST['mail_comment'] ;
|
1134 |
-
|
1135 |
-
// falls zauberhaft alte Serverkonfiguration, erstmal die Slashes entfernen...
|
1136 |
-
if ( get_magic_quotes_gpc() == 1 ) $mf_comment_content = stripslashes( $mf_comment_content );
|
1137 |
-
|
1138 |
-
// ...denn sonst kan wp_kses den content nicht entschaerfen
|
1139 |
-
$mf_comment_content = wp_kses( $mf_comment_content, '', '' );
|
1140 |
-
|
1141 |
-
// check if nonce is valid
|
1142 |
-
if ( isset( $mf_nonce ) && wp_verify_nonce( $mf_nonce, 'shariff3UU_send_mail' ) ) {
|
1143 |
-
// prevent double execution
|
1144 |
-
$_REQUEST['shariff_mf_nonce'] = '';
|
1145 |
-
|
1146 |
-
// field content to prefill forms in case of an error
|
1147 |
-
$error['mf_content_mailto'] = $mf_content_mailto;
|
1148 |
-
$error['mf_content_from'] = $mf_content_from;
|
1149 |
-
$error['mf_content_sender'] = $mf_content_sender;
|
1150 |
-
$error['mf_content_mail_comment'] = $mf_comment_content;
|
1151 |
-
|
1152 |
-
// get min wait time
|
1153 |
-
if ( isset( $shariff3UU["mailform_wait"] ) ) {
|
1154 |
-
$minwait = $shariff3UU["mailform_wait"];
|
1155 |
-
}
|
1156 |
-
else {
|
1157 |
-
$minwait = '5';
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
// rate limiter
|
1161 |
-
$wait = shariff3UU_limitRemoteUser();
|
1162 |
-
if ( $wait > $minwait ) {
|
1163 |
-
$error['error'] = '1';
|
1164 |
-
$error['wait'] = $wait;
|
1165 |
-
}
|
1166 |
-
else {
|
1167 |
-
// nicer sender name and address
|
1168 |
-
if ( ! empty( $mf_content_sender ) ) {
|
1169 |
-
add_filter( 'wp_mail_from_name', 'shariff3UU_set_wp_mail_from_name' );
|
1170 |
-
}
|
1171 |
-
elseif ( ! empty( $mf_content_from ) ) {
|
1172 |
-
add_filter( 'wp_mail_from_name', 'shariff3UU_set2_wp_mail_from_name' );
|
1173 |
-
}
|
1174 |
-
elseif ( ! empty( $GLOBALS["shariff3UU_mailform"]["mail_sender_name"] ) ) {
|
1175 |
-
add_filter( 'wp_mail_from_name', 'shariff3UU_set3_wp_mail_from_name' );
|
1176 |
-
}
|
1177 |
-
else {
|
1178 |
-
add_filter( 'wp_mail_from_name', 'shariff3UU_set4_wp_mail_from_name' );
|
1179 |
}
|
|
|
1180 |
|
1181 |
-
//
|
1182 |
-
|
1183 |
-
|
1184 |
-
// default sender address
|
1185 |
-
if ( ! empty( $shariff3UU["mail_sender_from"] ) ) {
|
1186 |
-
add_filter( 'wp_mail_from', 'shariff3UU_set_wp_mail_from' );
|
1187 |
}
|
1188 |
|
1189 |
-
//
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
if ( $i == '5' ) break;
|
1195 |
-
$tmp_mail = sanitize_email( $arr[$i] );
|
1196 |
-
// no need to add invalid stuff to the array
|
1197 |
-
if ( is_email( $tmp_mail ) != false ) {
|
1198 |
-
$mailto[] = $tmp_mail;
|
1199 |
-
}
|
1200 |
}
|
1201 |
|
1202 |
-
//
|
1203 |
-
if (
|
1204 |
-
$
|
|
|
|
|
1205 |
}
|
1206 |
-
else {
|
1207 |
-
$lang ='EN';
|
1208 |
-
}
|
1209 |
-
|
1210 |
-
// fallback to EN if a language is not supported by this plugin translations
|
1211 |
-
if ( $lang != 'DE' && $lang != 'FR' && $lang != 'IT' ) { $lang = 'EN'; }
|
1212 |
|
1213 |
-
//
|
1214 |
-
|
1215 |
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
if ( ! empty( $mf_content_sender ) ) {
|
1222 |
-
$message[ $lang ] .= $mf_content_sender;
|
1223 |
}
|
1224 |
-
|
1225 |
-
|
|
|
|
|
1226 |
}
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
|
|
|
|
|
|
1230 |
}
|
1231 |
-
|
1232 |
-
$
|
1233 |
-
|
1234 |
-
$
|
1235 |
-
|
1236 |
-
|
1237 |
-
// add comment
|
1238 |
-
if ( ! empty( $mf_comment_content ) ) {
|
1239 |
-
$message[ $lang ] .= $mf_comment_content . "\r\n\r\n";
|
1240 |
}
|
1241 |
-
|
1242 |
-
|
1243 |
-
if ( isset( $
|
1244 |
-
|
1245 |
-
$post_content = wordwrap( strip_tags( get_the_content() ), 72, "\r\n" );
|
1246 |
-
// strip all shortcodes
|
1247 |
-
$post_content = strip_shortcodes( $post_content );
|
1248 |
-
$message[ $lang ] .= $post_content;
|
1249 |
-
$message[ $lang ] .= " \r\n";
|
1250 |
}
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
if ( ! empty( $mf_content_from ) && is_email( $mf_content_from ) != false ) {
|
1262 |
-
$headers .= "Reply-To: <" . $mf_content_from . ">\r\n";
|
1263 |
}
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
|
|
|
|
1267 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1268 |
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
}
|
1274 |
-
}
|
1275 |
-
// if we have errors provide the mailform again with error message
|
1276 |
-
if ( isset( $error['error'] ) && $error['error'] == '1' ) {
|
1277 |
-
$content = shariff3UU_addMailForm( $content, $error );
|
1278 |
-
}
|
1279 |
-
// if everything is fine, send the e-mail
|
1280 |
-
else {
|
1281 |
-
$mailnotice = '<div id="shariff_mailform" class="shariff_mailform">';
|
1282 |
-
// The e-mail was successfully send to:
|
1283 |
-
$mailnotice .= '<div class="shariff_mailform_headline">' . $mf_mail_send[ $lang ] . '<a href="' . get_permalink() . '" class="shariff_closeX"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M10 0c-5.5 0-10 4.5-10 10s4.5 10 10 10 10-4.5 10-10-4.5-10-10-10zM10 18.1c-4.5 0-8.1-3.6-8.1-8.1s3.6-8.1 8.1-8.1 8.1 3.6 8.1 8.1-3.6 8.1-8.1 8.1z"/><path d="M13.1 5l-3.1 3.1-3.1-3.1-1.9 1.9 3.1 3.1-3.1 3.1 1.9 1.9 3.1-3.1 3.1 3.1 1.9-1.9-3.1-3.1 3.1-3.1z"/></svg></a></div>';
|
1284 |
-
// send the mail ($mailto in this function is allways an array)
|
1285 |
-
foreach ( $mailto as $rcpt ) {
|
1286 |
-
wp_mail( $rcpt, $subject, $message["$lang"], $headers ); // the function is available after the hook 'plugins_loaded'
|
1287 |
-
$mailnotice .= $rcpt . '<br>';
|
1288 |
-
}
|
1289 |
-
$mailnotice .= '</div>';
|
1290 |
-
// add to content
|
1291 |
-
$content = $mailnotice . $content;
|
1292 |
-
}
|
1293 |
-
}
|
1294 |
-
return $content;
|
1295 |
}
|
1296 |
-
}
|
1297 |
|
1298 |
-
//
|
1299 |
-
|
1300 |
-
// options
|
1301 |
-
$shariff3UU_mailform = $GLOBALS["shariff3UU_mailform"];
|
1302 |
-
|
1303 |
-
// rtzrtz: umgeschrieben aus dem DOS-Blocker. Nochmal gruebeln, ob wir das ohne memcache mit der Performance schaffen. Daher auch nur Grundfunktionalitaet.
|
1304 |
-
if ( ! isset( $shariff3UU_mailform['REMOTEHOSTS'] ) ) {
|
1305 |
-
$shariff3UU_mailform['REMOTEHOSTS'] = '';
|
1306 |
-
}
|
1307 |
-
$HOSTS = json_decode( $shariff3UU_mailform['REMOTEHOSTS'], true );
|
1308 |
-
|
1309 |
-
// get wait time
|
1310 |
-
if ( isset( $shariff3UU_mailform["mailform_wait"] ) ) {
|
1311 |
-
$wait = $shariff3UU_mailform["mailform_wait"];
|
1312 |
-
}
|
1313 |
-
else {
|
1314 |
-
$wait = '5';
|
1315 |
-
}
|
1316 |
-
|
1317 |
-
// calculate current wait time
|
1318 |
-
if ( $HOSTS[$_SERVER['REMOTE_ADDR']]-time()+$wait > 0 ) {
|
1319 |
-
if ( $HOSTS[$_SERVER['REMOTE_ADDR']]-time() < 86400 ) {
|
1320 |
-
$wait = ($HOSTS[$_SERVER['REMOTE_ADDR']]-time()+$wait)*2;
|
1321 |
-
}
|
1322 |
-
}
|
1323 |
-
|
1324 |
-
$HOSTS[$_SERVER['REMOTE_ADDR']] = time()+$wait;
|
1325 |
|
1326 |
-
//
|
1327 |
-
if (
|
1328 |
-
|
1329 |
-
if ( $value-time()+$wait < 0 ) {
|
1330 |
-
unset( $HOSTS[$key] );
|
1331 |
-
update_option( 'shariff3UU_mailform', $shariff3UU_mailform );
|
1332 |
-
}
|
1333 |
-
}
|
1334 |
}
|
1335 |
|
1336 |
-
|
1337 |
-
$
|
1338 |
-
|
1339 |
-
|
1340 |
-
if
|
1341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1342 |
}
|
1343 |
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
//
|
1348 |
-
|
1349 |
-
|
1350 |
-
// translations
|
1351 |
-
if ( function_exists('load_plugin_textdomain') ) { load_plugin_textdomain( 'shariff' ); }
|
1352 |
-
|
1353 |
-
$widget_options = array(
|
1354 |
-
'classname' => 'Shariff',
|
1355 |
-
'description' => __('Add Shariff as configured on the plugin options page.', 'shariff'),
|
1356 |
-
'customize_selective_refresh' => true,
|
1357 |
-
);
|
1358 |
-
|
1359 |
-
$control_options = array();
|
1360 |
-
parent::__construct('Shariff', 'Shariff', $widget_options, $control_options);
|
1361 |
-
} // END __construct()
|
1362 |
-
|
1363 |
-
// widget form - see WP_Widget::form()
|
1364 |
-
public function form($instance) {
|
1365 |
-
// widgets defaults
|
1366 |
-
$instance = wp_parse_args((array) $instance, array(
|
1367 |
-
'shariff-title' => '',
|
1368 |
-
'shariff-tag' => '[shariff]',
|
1369 |
-
));
|
1370 |
-
// set title
|
1371 |
-
echo '<p style="border-bottom: 1px solid #DFDFDF;"><strong>' . __( 'Title', 'shariff' ) . '</strong></p>';
|
1372 |
-
// set title
|
1373 |
-
echo '<p><input id="'. $this->get_field_id('shariff-title') .'" name="'. $this->get_field_name('shariff-title')
|
1374 |
-
.'" type="text" value="'. $instance['shariff-title'] .'" />(optional)</p>';
|
1375 |
-
// set shorttag
|
1376 |
-
echo '<p style="border-bottom: 1px solid #DFDFDF;"><strong>Shorttag</strong></p>';
|
1377 |
-
// set shorttag
|
1378 |
-
echo '<p><input id="'. $this->get_field_id('shariff-tag') .'" name="' . $this->get_field_name('shariff-tag')
|
1379 |
-
. '" type="text" value=\''. str_replace('\'','"',$instance['shariff-tag']) .'\' size="30" />(optional)</p>';
|
1380 |
-
|
1381 |
-
echo '<p style="clear:both;"></p>';
|
1382 |
-
} // END form($instance)
|
1383 |
-
|
1384 |
-
// save widget configuration
|
1385 |
-
public function update($new_instance, $old_instance) {
|
1386 |
-
$instance = $old_instance;
|
1387 |
-
|
1388 |
-
// widget conf defaults
|
1389 |
-
$new_instance = wp_parse_args( (array) $new_instance, array( 'shariff-title' => '', 'shariff-tag' => '[shariff]') );
|
1390 |
-
|
1391 |
-
// check input values
|
1392 |
-
$instance['shariff-title'] = (string) strip_tags( $new_instance['shariff-title'] );
|
1393 |
-
$instance['shariff-tag'] = (string) wp_kses( $new_instance['shariff-tag'], $GLOBALS["allowed_tags"] );
|
1394 |
-
|
1395 |
-
// save config
|
1396 |
-
return $instance;
|
1397 |
-
}
|
1398 |
-
|
1399 |
-
// draw widget
|
1400 |
-
public function widget( $args, $instance ) {
|
1401 |
-
// extract $args
|
1402 |
-
extract( $args );
|
1403 |
-
|
1404 |
-
// get options
|
1405 |
-
$shariff3UU = $GLOBALS["shariff3UU"];
|
1406 |
-
|
1407 |
-
// container
|
1408 |
-
echo $before_widget;
|
1409 |
-
|
1410 |
-
// print title of widget, if provided
|
1411 |
-
if ( empty( $instance['shariff-title'] ) ) {
|
1412 |
-
$title = '';
|
1413 |
-
}
|
1414 |
-
else {
|
1415 |
-
apply_filters( 'shariff-title', $instance['shariff-title'] );
|
1416 |
-
$title = $instance['shariff-title'];
|
1417 |
-
}
|
1418 |
-
if ( ! empty( $title ) ) {
|
1419 |
-
echo $before_title . $title . $after_title;
|
1420 |
-
}
|
1421 |
-
|
1422 |
-
// print shorttag
|
1423 |
-
|
1424 |
-
// keep original shorttag for further reference
|
1425 |
-
$original_shorttag = $instance['shariff-tag'];
|
1426 |
-
|
1427 |
-
// if nothing is configured, use the global options from admin menu
|
1428 |
-
if ( $instance['shariff-tag'] == '[shariff]' ) $shorttag = '[shariff]';
|
1429 |
-
else $shorttag = $instance['shariff-tag'];
|
1430 |
-
|
1431 |
-
// set url to current page to prevent sharing the first or last post on pages with multiple posts e.g. the blog page
|
1432 |
-
// ofc only when no manual url is provided in the shorttag
|
1433 |
-
$page_url = '';
|
1434 |
-
if ( strpos( $original_shorttag, ' url=' ) === false ) {
|
1435 |
-
$wpurl = get_bloginfo( 'wpurl' );
|
1436 |
-
$siteurl = get_bloginfo( 'url' );
|
1437 |
-
// for "normal" installations
|
1438 |
-
$page_url = $wpurl . esc_url_raw( $_SERVER['REQUEST_URI'] );
|
1439 |
-
// kill ?view=mail etc. if pressed a second time
|
1440 |
-
$page_url = strtok($page_url, '?');
|
1441 |
-
// if wordpress is installed in a subdirectory, but links are mapped to the main domain
|
1442 |
-
if ( $wpurl != $siteurl ) {
|
1443 |
-
$subdir = str_replace ( $siteurl , '' , $wpurl );
|
1444 |
-
$page_url = str_replace ( $subdir , '' , $page_url );
|
1445 |
-
}
|
1446 |
-
$page_url = ' url="' . $page_url;
|
1447 |
-
$page_url .= '"';
|
1448 |
-
}
|
1449 |
-
|
1450 |
-
// same for title
|
1451 |
-
$page_title = '';
|
1452 |
-
$wp_title = '';
|
1453 |
-
if ( strpos( $original_shorttag, 'title=' ) === false ) {
|
1454 |
-
$wp_title = wp_get_document_title();
|
1455 |
-
// wp_title for all pages that have it
|
1456 |
-
if ( ! empty( $wp_title ) ) $page_title = $wp_title;
|
1457 |
-
// just in case
|
1458 |
-
else $page_title = get_bloginfo('name');
|
1459 |
-
// remove [ and ] with ( and )
|
1460 |
-
$page_title = str_replace( '[', '(', $page_title );
|
1461 |
-
$page_title = str_replace( ']', ')', $page_title );
|
1462 |
-
$page_title = ' title="' . $page_title . '"';
|
1463 |
-
|
1464 |
-
}
|
1465 |
-
|
1466 |
-
// same for media
|
1467 |
-
$media = '';
|
1468 |
-
if ( array_key_exists( 'services', $shariff3UU ) && strstr( $shariff3UU["services"], 'pinterest' ) && ( strpos( $original_shorttag,'media=' ) === false ) ) {
|
1469 |
-
if ( isset( $shariff3UU["default_pinterest"] ) ) $media = ' media="' . $shariff3UU["default_pinterest"] . '"';
|
1470 |
-
else $media = ' media="' . plugins_url( '/pictos/defaultHint.png', __FILE__ ) . '"';
|
1471 |
}
|
|
|
|
|
1472 |
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
// replace mailform with mailto if on blog page to avoid broken button
|
1477 |
-
if ( ! is_singular() ) {
|
1478 |
-
$shorttag = str_replace( 'mailform' , 'mailto' , $shorttag );
|
1479 |
-
}
|
1480 |
|
1481 |
-
|
1482 |
-
|
1483 |
-
if ( post_password_required( get_the_ID() ) != '1' || ( isset( $shariff3UU["disable_on_protected"] ) && $shariff3UU["disable_on_protected"] != '1' ) ) {
|
1484 |
-
echo do_shortcode( $shorttag );
|
1485 |
-
}
|
1486 |
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1492 |
|
1493 |
-
|
1494 |
-
|
|
|
|
|
1495 |
global $wpdb;
|
1496 |
-
//
|
1497 |
-
if ( is_multisite() ) {
|
1498 |
-
$
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
|
1508 |
-
// switch back to main
|
1509 |
-
restore_current_blog();
|
1510 |
-
}
|
1511 |
}
|
1512 |
-
}
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
|
1518 |
}
|
1519 |
}
|
1520 |
-
register_deactivation_hook( __FILE__, '
|
1521 |
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
|
|
|
|
1530 |
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_timeout_shariff%"';
|
1531 |
-
$wpdb->query($sql);
|
1532 |
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_shariff%"';
|
1533 |
-
$wpdb->query($sql);
|
1534 |
-
//
|
|
|
1535 |
wp_cache_flush();
|
1536 |
}
|
1537 |
-
|
1538 |
-
?>
|
1 |
<?php
|
2 |
+
/**
|
3 |
* Plugin Name: Shariff Wrapper
|
4 |
+
* Plugin URI: https://wordpress.org/plugins-wp/shariff/
|
5 |
+
* Description: Shariff provides share buttons that respect the privacy of your visitors and follow the General Data Protection Regulation (GDPR).
|
6 |
+
* Version: 4.4.2
|
7 |
* Author: Jan-Peter Lambeck & 3UU
|
8 |
+
* Author URI: https://wordpress.org/plugins/shariff/
|
9 |
* License: MIT
|
10 |
+
* License URI: https://opensource.org/licenses/MIT
|
|
|
11 |
* Text Domain: shariff
|
12 |
+
*
|
13 |
+
* @package WordPress
|
14 |
*/
|
15 |
|
16 |
+
// Prevent direct calls to shariff.php.
|
17 |
+
if ( ! class_exists( 'WP' ) ) {
|
18 |
+
die();
|
19 |
+
}
|
20 |
+
|
21 |
+
// Get options (needed for front- and backend).
|
22 |
+
$shariff3uu_basic = (array) get_option( 'shariff3uu_basic' );
|
23 |
+
$shariff3uu_design = (array) get_option( 'shariff3uu_design' );
|
24 |
+
$shariff3uu_advanced = (array) get_option( 'shariff3uu_advanced' );
|
25 |
+
$shariff3uu_statistic = (array) get_option( 'shariff3uu_statistic' );
|
26 |
|
27 |
+
// Force the creation as a global variable in order to work with WP-CLI.
|
28 |
+
global $shariff3uu;
|
29 |
+
$shariff3uu = array_merge( $shariff3uu_basic, $shariff3uu_design, $shariff3uu_advanced, $shariff3uu_statistic );
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
/**
|
32 |
+
* Update function to perform tasks _once_ after an update, based on version number to work for automatic as well as manual updates.
|
33 |
+
*/
|
34 |
+
function shariff3uu_update() {
|
35 |
+
// Adjust code version.
|
36 |
+
$code_version = '4.4.2';
|
37 |
|
38 |
+
// Get options.
|
39 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
40 |
|
41 |
+
// Check if the installed version is older than the code version and include updates.php if necessary.
|
42 |
+
if ( empty( $shariff3uu['version'] ) || ( isset( $shariff3uu['version'] ) && version_compare( $shariff3uu['version'], $code_version ) === -1 ) ) {
|
43 |
+
// Include updates.php.
|
44 |
+
include dirname( __FILE__ ) . '/updates.php';
|
45 |
}
|
46 |
}
|
47 |
+
add_action( 'admin_init', 'shariff3uu_update' );
|
48 |
|
49 |
+
/** Require Shariff Widget. */
|
50 |
+
require dirname( __FILE__ ) . '/includes/class-shariff-widget.php';
|
51 |
+
|
52 |
+
// Allowed tags for headline.
|
53 |
$allowed_tags = array(
|
54 |
+
// Direct formatting e.g. <strong>.
|
55 |
'strong' => array(),
|
56 |
'em' => array(),
|
57 |
'b' => array(),
|
58 |
'i' => array(),
|
59 |
'br' => array(),
|
60 |
+
// Elements that can be formatted via CSS.
|
61 |
+
'span' => array(
|
62 |
+
'class' => array(),
|
63 |
+
'style' => array(),
|
64 |
+
'id' => array(),
|
65 |
+
),
|
66 |
+
'div' => array(
|
67 |
+
'class' => array(),
|
68 |
+
'style' => array(),
|
69 |
+
'id' => array(),
|
70 |
+
),
|
71 |
+
'p' => array(
|
72 |
+
'class' => array(),
|
73 |
+
'style' => array(),
|
74 |
+
'id' => array(),
|
75 |
+
),
|
76 |
+
'h1' => array(
|
77 |
+
'class' => array(),
|
78 |
+
'style' => array(),
|
79 |
+
'id' => array(),
|
80 |
+
),
|
81 |
+
'h2' => array(
|
82 |
+
'class' => array(),
|
83 |
+
'style' => array(),
|
84 |
+
'id' => array(),
|
85 |
+
),
|
86 |
+
'h3' => array(
|
87 |
+
'class' => array(),
|
88 |
+
'style' => array(),
|
89 |
+
'id' => array(),
|
90 |
+
),
|
91 |
+
'h4' => array(
|
92 |
+
'class' => array(),
|
93 |
+
'style' => array(),
|
94 |
+
'id' => array(),
|
95 |
+
),
|
96 |
+
'h5' => array(
|
97 |
+
'class' => array(),
|
98 |
+
'style' => array(),
|
99 |
+
'id' => array(),
|
100 |
+
),
|
101 |
+
'h6' => array(
|
102 |
+
'class' => array(),
|
103 |
+
'style' => array(),
|
104 |
+
'id' => array(),
|
105 |
+
),
|
106 |
+
'hr' => array(
|
107 |
+
'class' => array(),
|
108 |
+
'style' => array(),
|
109 |
+
'id' => array(),
|
110 |
+
),
|
111 |
);
|
112 |
|
113 |
+
/** Admin options */
|
114 |
if ( is_admin() ) {
|
115 |
+
// Include admin_menu.php.
|
116 |
+
include dirname( __FILE__ ) . '/admin/admin-menu.php';
|
117 |
+
// Include admin_notices.php.
|
118 |
+
include dirname( __FILE__ ) . '/admin/admin-notices.php';
|
119 |
}
|
120 |
|
121 |
+
/** Custom meta box */
|
122 |
+
function shariff3uu_include_metabox() {
|
123 |
+
// Check if user is allowed to publish posts.
|
124 |
if ( current_user_can( 'publish_posts' ) ) {
|
125 |
+
// Include admin_metabox.php.
|
126 |
+
include dirname( __FILE__ ) . '/admin/admin-metabox.php';
|
127 |
}
|
128 |
}
|
129 |
+
// Check if meta box has been disabled in the options, if not add_action.
|
130 |
+
if ( ! isset( $shariff3uu['disable_metabox'] ) || isset( $shariff3uu['disable_metabox'] ) && 1 !== $shariff3uu['disable_metabox'] ) {
|
131 |
+
add_action( 'init', 'shariff3uu_include_metabox' );
|
|
|
|
|
132 |
}
|
|
|
133 |
|
134 |
+
/**
|
135 |
+
* Add meta links (settings and support forum) to our entry on the plugin page.
|
136 |
+
*
|
137 |
+
* @param array $links Array of all current links.
|
138 |
+
* @param string $file Path to plugin of the current element.
|
139 |
+
*
|
140 |
+
* @return array New array including our links to settings and support forum.
|
141 |
+
*/
|
142 |
+
function shariff3uu_meta_links( $links, $file ) {
|
143 |
+
$plugin = plugin_basename( __FILE__ );
|
144 |
+
// Create link.
|
145 |
+
if ( $file === $plugin ) {
|
146 |
return array_merge(
|
147 |
$links,
|
148 |
+
array( '<a href="' . home_url() . '/wp-admin/options-general.php?page=shariff3uu">' . __( 'Settings', 'shariff' ) . '</a>', '<a href="https://wordpress.org/support/plugin/shariff" target="_blank">' . __( 'Support Forum', 'shariff' ) . '</a>' )
|
149 |
);
|
150 |
}
|
151 |
return $links;
|
152 |
}
|
153 |
+
add_filter( 'plugin_row_meta', 'shariff3uu_meta_links', 10, 2 );
|
154 |
|
155 |
+
/** Initialize translations. */
|
156 |
function shariff_init_locale() {
|
157 |
if ( function_exists( 'load_plugin_textdomain' ) ) {
|
158 |
load_plugin_textdomain( 'shariff' );
|
159 |
}
|
160 |
}
|
161 |
|
162 |
+
/** Register the wp rest api route and sanitize the input */
|
163 |
+
function shariff3uu_sanitize_api() {
|
164 |
register_rest_route( 'shariff/v1', '/share_counts', array(
|
165 |
+
'methods' => 'GET',
|
166 |
+
'callback' => 'shariff3uu_share_counts',
|
167 |
+
'args' => array(
|
168 |
+
'url' => array(
|
169 |
+
'sanitize_callback' => 'esc_url',
|
170 |
+
'required' => true,
|
171 |
+
'description' => __( 'URL of the post or page to request share counts for.', 'shariff' ),
|
172 |
+
),
|
173 |
+
'services' => array(
|
174 |
+
'sanitize_callback' => 'sanitize_text_field',
|
175 |
+
'required' => true,
|
176 |
+
'description' => __( 'A list of services separated by |. Example: twitter|facebook|xing', 'shariff' ),
|
177 |
+
),
|
178 |
+
'timestamp' => array(
|
179 |
+
'sanitize_callback' => 'absint',
|
180 |
+
'description' => __( 'Timestamp of the last update of the post. Used for dynamic cache lifespan.', 'shariff' ),
|
181 |
+
),
|
182 |
),
|
183 |
) );
|
184 |
}
|
185 |
+
add_action( 'rest_api_init', 'shariff3uu_sanitize_api' );
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Provide share counts via the wp rest api.
|
189 |
+
*
|
190 |
+
* @param WP_REST_Request $request Incoming request.
|
191 |
+
*
|
192 |
+
* @return string Returns the share counts for all requested services if available or an error message.
|
193 |
+
*/
|
194 |
+
function shariff3uu_share_counts( WP_REST_Request $request ) {
|
195 |
+
// Get options.
|
196 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
197 |
|
198 |
+
// Setup Parameters.
|
199 |
+
$url = urldecode( $request['url'] );
|
200 |
+
$services = $request['services'];
|
201 |
$timestamp = $request['timestamp'];
|
202 |
+
|
203 |
+
// Exit if no url is provided and provide an error message.
|
204 |
+
if ( empty( $url ) || 'undefined' === $url ) {
|
205 |
return new WP_Error( 'nourl', 'No URL provided!', array( 'status' => 400 ) );
|
206 |
}
|
207 |
|
208 |
+
// Exit if no services are provided and provide an error message.
|
209 |
+
if ( empty( $services ) || 'undefined' === $services ) {
|
210 |
return new WP_Error( 'noservices', 'No services provided!', array( 'status' => 400 ) );
|
211 |
}
|
212 |
|
213 |
+
// Make sure that the provided url matches the WordPress domain.
|
214 |
+
$get_url = wp_parse_url( $url );
|
215 |
+
$wp_url = wp_parse_url( get_bloginfo( 'url' ) );
|
216 |
+
// On an external backend check allowed hosts, else compare that domain is equal.
|
217 |
if ( defined( 'SHARIFF_FRONTENDS' ) ) {
|
218 |
$shariff_frontends = array_flip( explode( '|', SHARIFF_FRONTENDS ) );
|
219 |
if ( ! isset( $get_url['host'] ) || ! array_key_exists( $get_url['host'], $shariff_frontends ) ) {
|
220 |
return new WP_Error( 'externaldomainnotallowed', 'External domain not allowed by this server!', array( 'status' => 400 ) );
|
221 |
}
|
222 |
+
} elseif ( ! isset( $get_url['host'] ) || $get_url['host'] !== $wp_url['host'] ) {
|
|
|
|
|
223 |
return new WP_Error( 'domainnotallowed', 'Domain not allowed by this server!', array( 'status' => 400 ) );
|
224 |
}
|
225 |
|
226 |
+
// Encode the shareurl.
|
227 |
+
$post_url = rawurlencode( esc_url( $url ) );
|
228 |
+
$post_url_raw = $url;
|
229 |
+
|
230 |
+
// Set transient name.
|
231 |
+
// Transient names can only contain 40 characters, therefore we use a hash (md5 always creates a 32 character hash).
|
232 |
+
// We need a prefix so we can clean up on uninstall and updates.
|
233 |
+
$post_hash = 'shariff' . hash( 'md5', $post_url );
|
234 |
+
|
235 |
+
// Check for ttl option, must be between 60 and 7200 seconds.
|
236 |
+
if ( isset( $shariff3uu['ttl'] ) ) {
|
237 |
+
$ttl = absint( $shariff3uu['ttl'] );
|
238 |
+
// Make sure ttl is a reasonable number.
|
239 |
+
if ( $ttl < '61' ) {
|
240 |
+
$ttl = '60';
|
241 |
+
} elseif ( $ttl > '7200' ) {
|
242 |
+
$ttl = '7200';
|
243 |
+
}
|
244 |
+
} else {
|
245 |
+
// Else set it to new default (five minutes).
|
246 |
$ttl = '300';
|
247 |
}
|
248 |
|
249 |
+
// Adjust ttl based on the post age.
|
250 |
+
if ( isset( $timestamp ) && ( ! isset( $shariff3uu['disable_dynamic_cache'] ) || ( isset( $shariff3uu['disable_dynamic_cache'] ) && 1 !== $shariff3uu['disable_dynamic_cache'] ) ) ) {
|
251 |
+
// The timestamp represents the last time the post or page was modified.
|
252 |
+
$post_time = intval( $timestamp );
|
253 |
$current_time = current_time( 'timestamp', true );
|
254 |
+
$post_age = round( abs( $current_time - $post_time ) );
|
255 |
if ( $post_age > '0' ) {
|
256 |
$post_age_days = round( $post_age / 60 / 60 / 24 );
|
257 |
+
// Make sure ttl base is not getting too high.
|
258 |
+
if ( $ttl > '300' ) {
|
259 |
+
$ttl = '300';
|
260 |
+
}
|
261 |
$ttl = round( ( $ttl + $post_age_days * 3 ) * ( $post_age_days * 2 ) );
|
262 |
}
|
263 |
+
|
264 |
+
// Set minimum ttl to 60 seconds and maximum ttl to one week.
|
265 |
if ( $ttl < '60' ) {
|
266 |
$ttl = '60';
|
267 |
+
} elseif ( $ttl > '604800' ) {
|
|
|
268 |
$ttl = '604800';
|
269 |
}
|
270 |
+
|
271 |
+
// In case we get a timestamp older than 01.01.2000 or for example a 0, use a reasonable default value of five minutes.
|
272 |
if ( $post_time < '946684800' ) {
|
273 |
$ttl = '300';
|
274 |
}
|
275 |
}
|
276 |
|
277 |
+
// Set the default value.
|
278 |
$need_update = false;
|
279 |
|
280 |
+
// Remove totalnumber for array.
|
281 |
$real_services = str_replace( 'totalnumber|', '', $services );
|
282 |
$real_services = str_replace( '|totalnumber', '', $real_services );
|
283 |
|
284 |
+
// Explode services.
|
285 |
$service_array = explode( '|', $real_services );
|
286 |
+
|
287 |
+
// Remove duplicated entries.
|
288 |
$service_array = array_unique( $service_array );
|
289 |
|
290 |
+
// Get old share counts.
|
291 |
+
if ( get_transient( $post_hash ) !== false ) {
|
292 |
+
$old_share_counts = get_transient( $post_hash );
|
293 |
+
} else {
|
294 |
+
$old_share_counts = array();
|
295 |
+
}
|
296 |
|
297 |
+
// Check if we need to update.
|
298 |
if ( get_transient( $post_hash ) !== false ) {
|
299 |
+
// Check timestamp.
|
300 |
$diff = current_time( 'timestamp', true ) - $old_share_counts['timestamp'];
|
301 |
+
if ( $diff > $ttl ) {
|
302 |
+
$need_update = true;
|
303 |
+
}
|
304 |
+
// Check if we have a different set of services than stored in the cache.
|
305 |
$diff_array = array_diff_key( array_flip( $service_array ), $old_share_counts );
|
306 |
if ( ! empty( $diff_array ) ) {
|
307 |
$need_update = true;
|
308 |
+
// We only need to update the missing service.
|
309 |
$service_array = array_flip( $diff_array );
|
310 |
}
|
311 |
+
} else {
|
312 |
+
$need_update = true;
|
313 |
}
|
314 |
+
|
315 |
+
// Prevent php notices if debug mode is enabled.
|
316 |
+
$response = '';
|
|
|
317 |
$share_counts = array();
|
318 |
|
319 |
+
// If we do not need an update, use stored data.
|
320 |
+
if ( false === $need_update ) {
|
321 |
$share_counts = $old_share_counts;
|
322 |
+
// Provide update info for debugging and support.
|
323 |
$share_counts['updated'] = '0';
|
324 |
+
} elseif ( 'totalnumber' === $services ) {
|
325 |
+
// If only totalnumber is requested we only use cached data.
|
|
|
326 |
$share_counts = $old_share_counts;
|
327 |
+
} elseif ( isset( $shariff3uu['external_host'] ) && ! empty( $shariff3uu['external_host'] ) ) {
|
328 |
+
// Check if we want to use an external API.
|
329 |
+
$response = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( $shariff3uu['external_host'] . '?url=' . rawurlencode( $url ) . '&services=' . $services . '×tamp=' . $timestamp . '"' ) ) );
|
330 |
+
// Decode response.
|
331 |
$share_counts = json_decode( $response, true );
|
332 |
+
// Save transient.
|
333 |
set_transient( $post_hash, $share_counts, '604800' );
|
334 |
+
// Offer a hook to work with the share counts.
|
335 |
do_action( 'shariff_share_counts', $share_counts );
|
336 |
+
} else {
|
337 |
+
// Else we fetch new counts ourselves.
|
338 |
+
$share_counts = shariff3uu_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $post_url_raw );
|
|
|
339 |
}
|
340 |
|
341 |
+
// Return results, if we have some or an error message if not.
|
342 |
+
if ( isset( $share_counts ) && null !== $share_counts ) {
|
343 |
return $share_counts;
|
344 |
+
} else {
|
345 |
+
return new WP_Error( 'nodata', 'Could not receive any data.', array( 'status' => 400 ) );
|
346 |
}
|
347 |
}
|
348 |
|
349 |
+
/**
|
350 |
+
* Fetch share counts.
|
351 |
+
*
|
352 |
+
* @param array $service_array Array with the desired services.
|
353 |
+
* @param array $old_share_counts Array of all already stored share counts.
|
354 |
+
* @param string $post_hash MD5-Hash of the current post.
|
355 |
+
* @param string $post_url_raw Raw URL of the current post.
|
356 |
+
*
|
357 |
+
* @return array Array of all fetched share counts.
|
358 |
+
*/
|
359 |
+
function shariff3uu_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $post_url_raw ) {
|
360 |
+
// We only need the backend part from the service phps.
|
361 |
+
$backend = 1;
|
362 |
+
|
363 |
+
// Encode the shareurl.
|
364 |
+
$post_url = rawurlencode( esc_url( $post_url_raw ) );
|
365 |
|
366 |
+
// Get options.
|
367 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
368 |
|
369 |
+
// Prevent php notices.
|
370 |
+
$total_count = 0;
|
371 |
$share_counts = array();
|
372 |
+
|
373 |
+
// Loop through all desired services.
|
374 |
foreach ( $service_array as $service ) {
|
375 |
+
// Only include services that are not disabled.
|
376 |
+
if ( ! empty( $service ) && ( ! isset( $shariff3uu['disable'][ $service ] ) || ( isset( $shariff3uu['disable'][ $service ] ) && 0 === $shariff3uu['disable'][ $service ] ) ) ) {
|
377 |
+
// Determine path.
|
378 |
+
$path_service_file = dirname( __FILE__ ) . '/services/shariff-' . $service . '.php';
|
379 |
+
// Include service files.
|
380 |
+
if ( file_exists( $path_service_file ) ) {
|
381 |
+
include $path_service_file;
|
382 |
+
}
|
383 |
// if we have an error (e.g. a timeout) and we have an old share count for this service, keep it!
|
384 |
if ( array_key_exists( $service, $old_share_counts ) && ( ! array_key_exists( $service, $share_counts ) || empty( $share_counts[ $service ] ) ) ) {
|
385 |
$share_counts[ $service ] = $old_share_counts[ $service ];
|
386 |
}
|
387 |
}
|
388 |
+
// Calculate total share count.
|
389 |
+
if ( isset( $share_counts[ $service ] ) ) {
|
390 |
+
$total_count = $total_count + $share_counts[ $service ];
|
391 |
+
}
|
392 |
}
|
393 |
|
394 |
+
// Add total count.
|
395 |
+
if ( 0 !== $total_count ) {
|
396 |
+
$share_counts['total'] = $total_count;
|
397 |
+
}
|
398 |
|
399 |
+
// Save transient, if we have counts.
|
400 |
if ( isset( $share_counts ) ) {
|
401 |
+
// Add current timestamp and url.
|
402 |
$share_counts['timestamp'] = current_time( 'timestamp', true );
|
403 |
+
$share_counts['url'] = $post_url_raw;
|
404 |
+
// Combine different set of services.
|
405 |
if ( get_transient( $post_hash ) !== false ) {
|
406 |
$other_request = get_transient( $post_hash );
|
407 |
+
$share_counts = array_merge( $other_request, $share_counts );
|
408 |
}
|
409 |
+
// Save transient.
|
410 |
set_transient( $post_hash, $share_counts, '604800' );
|
411 |
+
// Offer a hook to work with the share counts.
|
412 |
do_action( 'shariff_share_counts', $share_counts );
|
413 |
+
// Update info.
|
414 |
+
$share_counts['updated'] = 1;
|
415 |
+
} elseif ( isset( $old_share_counts ) ) {
|
|
|
416 |
$share_counts = $old_share_counts;
|
417 |
+
// Update info.
|
418 |
$share_counts['updated'] = '0';
|
419 |
}
|
420 |
|
421 |
+
// Return share counts.
|
422 |
return $share_counts;
|
423 |
}
|
424 |
|
425 |
+
/**
|
426 |
+
* Fills cache automatically.
|
427 |
+
*/
|
428 |
+
function shariff3uu_fill_cache() {
|
429 |
+
// Amount of posts - set to 100 if not set.
|
430 |
+
if ( isset( $GLOBALS['shariff3uu']['ranking'] ) && absint( $GLOBALS['shariff3uu']['ranking'] ) > '0' ) {
|
431 |
+
$numberposts = absint( $GLOBALS['shariff3uu']['ranking'] );
|
432 |
+
} else {
|
433 |
$numberposts = '100';
|
434 |
}
|
435 |
|
436 |
+
// Avoid errors if no services are given - instead use the default set of services.
|
437 |
+
if ( empty( $GLOBALS['shariff3uu']['services'] ) ) {
|
438 |
+
$services = 'twitter|facebook|googleplus';
|
439 |
+
} else {
|
440 |
+
$services = $GLOBALS['shariff3uu']['services'];
|
441 |
+
}
|
442 |
|
443 |
+
// Explode services.
|
444 |
$service_array = explode( '|', $services );
|
445 |
+
|
446 |
+
// Arguments for wp_get_recent_posts().
|
447 |
+
$args = array(
|
448 |
+
'numberposts' => $numberposts,
|
449 |
+
'orderby' => 'post_date',
|
450 |
+
'order' => 'DESC',
|
451 |
+
'post_status' => 'publish',
|
452 |
+
'suppress_filters' => false,
|
453 |
+
);
|
454 |
+
|
455 |
+
// Catch last 100 posts or whatever number is set for it.
|
456 |
$recent_posts = wp_get_recent_posts( $args );
|
457 |
if ( $recent_posts ) {
|
458 |
+
foreach ( $recent_posts as $recent ) {
|
459 |
+
// Get the url.
|
460 |
+
$url = get_permalink( $recent['ID'] );
|
461 |
+
$post_url = rawurlencode( $url );
|
462 |
+
// Set transient name.
|
463 |
+
$post_hash = 'shariff' . hash( 'md5', $post_url );
|
464 |
+
// Get old share counts.
|
465 |
+
if ( get_transient( $post_hash ) !== false ) {
|
466 |
+
$old_share_counts = get_transient( $post_hash );
|
467 |
+
} else {
|
468 |
+
$old_share_counts = array();
|
469 |
+
}
|
470 |
+
// Fetch share counts and save them.
|
471 |
+
shariff3uu_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $url );
|
472 |
}
|
473 |
}
|
474 |
}
|
475 |
+
add_action( 'shariff3uu_fill_cache', 'shariff3uu_fill_cache' );
|
476 |
+
|
477 |
+
/**
|
478 |
+
* Adds schedule event in order to fill cache automatically.
|
479 |
+
*/
|
480 |
+
function shariff3uu_fill_cache_schedule() {
|
481 |
+
// Get options manually bc of start on activation.
|
482 |
+
$shariff3uu_statistic = (array) get_option( 'shariff3uu_statistic' );
|
483 |
+
// Check if option is set.
|
484 |
+
if ( isset( $shariff3uu_statistic['automaticcache'] ) && 1 === $shariff3uu_statistic['automaticcache'] ) {
|
485 |
+
// Check if job is already scheduled.
|
486 |
+
if ( ! wp_next_scheduled( 'shariff3uu_fill_cache' ) ) {
|
487 |
+
// Add cron job.
|
488 |
+
wp_schedule_event( time(), 'weekly', 'shariff3uu_fill_cache' );
|
489 |
}
|
490 |
+
} else {
|
491 |
+
// Else option is not set therefore remove cron job if scheduled.
|
492 |
+
if ( wp_next_scheduled( 'shariff3uu_fill_cache' ) ) {
|
493 |
+
// Remove cron job.
|
494 |
+
wp_clear_scheduled_hook( 'shariff3uu_fill_cache' );
|
|
|
495 |
}
|
496 |
}
|
497 |
}
|
498 |
+
add_action( 'shariff3uu_save_statistic_options', 'shariff3uu_fill_cache_schedule' );
|
499 |
+
|
500 |
+
/** Registers activation hook to start cron job after an update. */
|
501 |
+
register_activation_hook( __FILE__, 'shariff3uu_fill_cache_schedule' );
|
502 |
|
503 |
+
/**
|
504 |
+
* Adds custom weekly cron recurrences.
|
505 |
+
*
|
506 |
+
* @param array $schedules Array of existing schedules.
|
507 |
+
*
|
508 |
+
* @return array Updated array including our new schedule.
|
509 |
+
*/
|
510 |
+
function shariff3uu_fill_cache_schedule_custom_recurrence( $schedules ) {
|
511 |
$schedules['weekly'] = array(
|
512 |
+
'display' => __( 'Once weekly', 'shariff' ),
|
513 |
+
'interval' => 804600,
|
514 |
);
|
515 |
return $schedules;
|
516 |
}
|
517 |
+
add_filter( 'cron_schedules', 'shariff3uu_fill_cache_schedule_custom_recurrence' );
|
518 |
+
|
519 |
+
/**
|
520 |
+
* Adds short tag to posts and pages (including custom post types).
|
521 |
+
*
|
522 |
+
* @param string $content The current post content.
|
523 |
+
*
|
524 |
+
* @return string The post content including our short tag.
|
525 |
+
*/
|
526 |
+
function shariff3uu_posts( $content ) {
|
527 |
+
// Get options.
|
528 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
529 |
|
530 |
+
// Do not add Shariff to excerpts or outside the loop, if option is checked.
|
531 |
+
if ( in_array( 'get_the_excerpt', $GLOBALS['wp_current_filter'], true ) || ( ! in_the_loop() && isset( $shariff3uu['disable_outside_loop'] ) && 1 === $shariff3uu['disable_outside_loop'] ) ) {
|
532 |
return $content;
|
533 |
}
|
534 |
|
535 |
+
// Disable share buttons on password protected posts if configured in the admin menu.
|
536 |
+
if ( ( 1 === post_password_required( get_the_ID() ) || ! empty( $GLOBALS['post']->post_password ) ) && isset( $shariff3uu['disable_on_protected'] ) && 1 === $shariff3uu['disable_on_protected'] ) {
|
537 |
+
$shariff3uu['add_before']['posts'] = 0;
|
538 |
+
$shariff3uu['add_before']['posts_blogpage'] = 0;
|
539 |
+
$shariff3uu['add_before']['pages'] = 0;
|
540 |
+
$shariff3uu['add_after']['posts'] = 0;
|
541 |
+
$shariff3uu['add_after']['posts_blogpage'] = 0;
|
542 |
+
$shariff3uu['add_after']['pages'] = 0;
|
543 |
+
$shariff3uu['add_after']['custom_type'] = 0;
|
544 |
+
}
|
545 |
+
|
546 |
+
// If we want to see it as text - replace the slash.
|
547 |
+
if ( true === strpos( $content, '/hideshariff' ) ) {
|
548 |
+
$content = str_replace( '/hideshariff', 'hideshariff', $content );
|
549 |
+
} elseif ( true === strpos( $content, 'hideshariff' ) ) {
|
550 |
+
// Remove the sign.
|
551 |
+
$content = str_replace( 'hideshariff', '', $content );
|
552 |
+
// Return the content without adding Shariff.
|
|
|
|
|
553 |
return $content;
|
554 |
}
|
555 |
|
556 |
+
// Type of current post.
|
557 |
$current_post_type = get_post_type();
|
558 |
+
if ( 'post' === $current_post_type ) {
|
559 |
+
$current_post_type = 'posts';
|
560 |
+
}
|
561 |
+
|
562 |
+
// Prevent php warnings in debug mode.
|
563 |
+
$add_before = 0;
|
564 |
+
$add_after = 0;
|
565 |
|
566 |
+
// Check if shariff should be added automatically (plugin options).
|
567 |
if ( ! is_singular() ) {
|
568 |
+
// On blog page.
|
569 |
+
if ( isset( $shariff3uu['add_before']['posts_blogpage'] ) && 1 === $shariff3uu['add_before']['posts_blogpage'] ) {
|
570 |
+
$add_before = 1;
|
571 |
+
}
|
572 |
+
if ( isset( $shariff3uu['add_after']['posts_blogpage'] ) && 1 === $shariff3uu['add_after']['posts_blogpage'] ) {
|
573 |
+
$add_after = 1;
|
574 |
+
}
|
575 |
+
} elseif ( is_singular( 'post' ) ) {
|
576 |
+
// On single post.
|
577 |
+
if ( isset( $shariff3uu['add_before'][ $current_post_type ] ) && 1 === $shariff3uu['add_before'][ $current_post_type ] ) {
|
578 |
+
$add_before = 1;
|
579 |
+
}
|
580 |
+
if ( isset( $shariff3uu['add_after'][ $current_post_type ] ) && 1 === $shariff3uu['add_after'][ $current_post_type ] ) {
|
581 |
+
$add_after = 1;
|
582 |
+
}
|
583 |
+
} elseif ( is_singular( 'page' ) ) {
|
584 |
+
// On pages.
|
585 |
+
if ( isset( $shariff3uu['add_before']['pages'] ) && 1 === $shariff3uu['add_before']['pages'] ) {
|
586 |
+
$add_before = 1;
|
587 |
+
}
|
588 |
+
if ( isset( $shariff3uu['add_after']['pages'] ) && 1 === $shariff3uu['add_after']['pages'] ) {
|
589 |
+
$add_after = 1;
|
590 |
+
}
|
591 |
+
} else {
|
592 |
+
// On custom_post_types.
|
593 |
+
$all_custom_post_types = get_post_types( array( '_builtin' => false ) );
|
594 |
if ( is_array( $all_custom_post_types ) ) {
|
595 |
$custom_types = array_keys( $all_custom_post_types );
|
596 |
+
// Add shariff, if custom type and option checked in the admin menu.
|
597 |
+
if ( isset( $shariff3uu['add_before'][ $current_post_type ] ) && 1 === $shariff3uu['add_before'][ $current_post_type ] ) {
|
598 |
+
$add_before = 1;
|
599 |
+
}
|
600 |
+
if ( isset( $shariff3uu['add_after'][ $current_post_type ] ) && 1 === $shariff3uu['add_after'][ $current_post_type ] ) {
|
601 |
+
$add_after = 1;
|
602 |
+
}
|
603 |
}
|
604 |
}
|
605 |
+
|
606 |
+
// Check if buttons are enabled on a single post or page via the meta box.
|
607 |
+
if ( get_post_meta( get_the_ID(), 'shariff_metabox_before', true ) ) {
|
608 |
+
$add_before = 1;
|
609 |
+
}
|
610 |
+
if ( get_post_meta( get_the_ID(), 'shariff_metabox_after', true ) ) {
|
611 |
+
$add_after = 1;
|
612 |
+
}
|
613 |
+
|
614 |
+
// Add shariff.
|
615 |
+
if ( 1 === $add_before ) {
|
616 |
+
$content = '[shariff]' . $content;
|
617 |
+
}
|
618 |
+
if ( 1 === $add_after ) {
|
619 |
+
$content .= '[shariff]';
|
620 |
+
}
|
621 |
+
|
622 |
+
// Return content.
|
623 |
return $content;
|
624 |
}
|
625 |
+
if ( ! isset( $GLOBALS['shariff3uu']['shortcodeprio'] ) ) {
|
626 |
+
$GLOBALS['shariff3uu']['shortcodeprio'] = '10';
|
627 |
+
}
|
628 |
+
add_filter( 'the_content', 'shariff3uu_posts', $GLOBALS['shariff3uu']['shortcodeprio'] );
|
629 |
+
|
630 |
+
/**
|
631 |
+
* Add shorttag to excerpt.
|
632 |
+
*
|
633 |
+
* @param string $content The current content of the excerpt.
|
634 |
+
*
|
635 |
+
* @return string The new content of the post including the shorttag.
|
636 |
+
*/
|
637 |
+
function shariff3uu_excerpt( $content ) {
|
638 |
+
// Get options.
|
639 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
640 |
+
// Remove headline in post.
|
641 |
+
if ( isset( $shariff3uu['headline'] ) ) {
|
642 |
+
$content = str_replace( strip_tags( $shariff3uu['headline'] ), ' ', $content );
|
643 |
+
}
|
644 |
+
// Add shariff before the excerpt, if option checked in the admin menu.
|
645 |
+
if ( isset( $shariff3uu['add_before']['excerpt'] ) && 1 === $shariff3uu['add_before']['excerpt'] ) {
|
646 |
$content = do_shortcode( '[shariff]' ) . $content;
|
647 |
}
|
648 |
+
// Add shariff after the excerpt, if option checked in the admin menu.
|
649 |
+
if ( isset( $shariff3uu['add_after']['excerpt'] ) && 1 === $shariff3uu['add_after']['excerpt'] ) {
|
650 |
$content .= do_shortcode( '[shariff]' );
|
651 |
}
|
652 |
return $content;
|
653 |
}
|
654 |
+
add_filter( 'the_excerpt', 'shariff3uu_excerpt' );
|
655 |
+
|
656 |
+
/**
|
657 |
+
* Removes hideshariff from content in cases of excerpts or other plain text usages.
|
658 |
+
*
|
659 |
+
* @param string $content The current content of the post.
|
660 |
+
*
|
661 |
+
* @return string The modified content without hideshariff.
|
662 |
+
*/
|
663 |
+
function shariff3uu_hideshariff( $content ) {
|
664 |
+
if ( true === strpos( $content, 'hideshariff' ) ) {
|
665 |
+
$content = str_replace( 'hideshariff', '', $content );
|
666 |
}
|
667 |
return $content;
|
668 |
}
|
669 |
+
add_filter( 'the_content', 'shariff3uu_hideshariff', 999 );
|
670 |
+
|
671 |
+
/**
|
672 |
+
* Removes shariff from rss feeds.
|
673 |
+
*
|
674 |
+
* @param string $content The current content of the post.
|
675 |
+
*
|
676 |
+
* @return string The modified content without shariff.
|
677 |
+
*/
|
678 |
+
function shariff3uu_remove_from_rss( $content ) {
|
679 |
$content = preg_replace( '/<div class="shariff\b[^>]*>(.*?)<\/div>/i', '', $content );
|
680 |
$content = preg_replace( '/<div class="ShariffSC\b[^>]*>(.*?)<\/div>/i', '', $content );
|
681 |
return $content;
|
682 |
}
|
683 |
+
add_filter( 'the_content_feed', 'shariff3uu_remove_from_rss', 999 );
|
684 |
+
|
685 |
+
/**
|
686 |
+
* Adds shariff buttons after bbpress replies.
|
687 |
+
*/
|
688 |
+
function shariff3uu_bbp_add_shariff_after_replies() {
|
689 |
+
// Get options.
|
690 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
691 |
+
if ( isset( $shariff3uu['add_after']['bbp_reply'] ) && 1 === $shariff3uu['add_after']['bbp_reply'] ) {
|
692 |
+
echo esc_html( shariff3uu_render( array() ) );
|
693 |
+
}
|
|
|
|
|
694 |
}
|
695 |
+
add_action( 'bbp_theme_after_reply_content', 'shariff3uu_bbp_add_shariff_after_replies' );
|
696 |
|
697 |
+
/**
|
698 |
+
* Function is called to include the shariff.css in the header of AMP pages.
|
699 |
+
* Currently only called by the amp_post_template_css hook.
|
700 |
+
* Supports the AMP plugin by Automatic and the AMP for WP plugin by Ahmed and Mohammed Kaludi.
|
701 |
+
* We need to strip out all !important in order to pass AMP test.
|
702 |
+
*/
|
703 |
+
function shariff3uu_amp_css() {
|
704 |
+
ob_start();
|
705 |
+
include plugins_url( '/css/shariff.min.css', __FILE__ );
|
706 |
+
$shariff_css = ob_get_clean();
|
707 |
+
if ( false !== $shariff_css ) {
|
708 |
+
echo esc_html( str_replace( '!important', '', $shariff_css ) );
|
709 |
+
} else {
|
710 |
+
include plugins_url( '/css/shariff.min.css', __FILE__ );
|
711 |
+
}
|
712 |
+
// Hide print button on AMP pages.
|
713 |
+
echo '.shariff .printer { display: none };';
|
714 |
}
|
715 |
+
add_action( 'amp_post_template_css', 'shariff3uu_amp_css' );
|
716 |
+
|
717 |
+
// Registers the shortcode.
|
718 |
+
add_shortcode( 'shariff', 'shariff3uu_render' );
|
719 |
+
|
720 |
+
/**
|
721 |
+
* Renders the shorttag to the HTML shorttag of Shariff.
|
722 |
+
*
|
723 |
+
* @param array $atts (optional) Array of shariff options provided in the shorttag.
|
724 |
+
*
|
725 |
+
* @return string|null The rendered HTML shorttag or null if a disable condition is met.
|
726 |
+
*/
|
727 |
+
function shariff3uu_render( $atts ) {
|
728 |
+
// Get options.
|
729 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
730 |
+
|
731 |
+
// Stops all further actions if we are on an admin page.
|
732 |
+
if ( is_admin() ) {
|
733 |
+
return null;
|
734 |
+
}
|
735 |
+
|
736 |
+
// Avoids errors if no attributes are given - instead uses the old set of services to make it backward compatible.
|
737 |
+
if ( empty( $shariff3uu['services'] ) ) {
|
738 |
+
$shariff3uu['services'] = 'twitter|facebook|googleplus|info';
|
739 |
+
}
|
740 |
+
|
741 |
+
// Uses the backend option for every option that is not set in the shorttag.
|
742 |
+
$backend_options = $shariff3uu;
|
743 |
+
if ( isset( $shariff3uu['vertical'] ) && 1 === $shariff3uu['vertical'] ) {
|
744 |
+
$backend_options['orientation'] = 'vertical';
|
745 |
+
}
|
746 |
+
if ( isset( $shariff3uu['backend'] ) && 1 === $shariff3uu['backend'] ) {
|
747 |
+
$backend_options['backend'] = 'on';
|
748 |
+
}
|
749 |
+
if ( isset( $shariff3uu['buttonsize'] ) && 1 === $shariff3uu['buttonsize'] ) {
|
750 |
+
$backend_options['buttonsize'] = 'small';
|
751 |
+
}
|
752 |
+
if ( empty( $atts ) ) {
|
753 |
+
$atts = $backend_options;
|
754 |
+
} else {
|
755 |
+
$atts = array_merge( $backend_options, $atts );
|
756 |
+
}
|
757 |
+
|
758 |
+
// Gets the metabox ignore widget value.
|
759 |
$shariff_metabox_ignore_widget = get_post_meta( get_the_ID(), 'shariff_metabox_ignore_widget', true );
|
760 |
+
|
761 |
+
// Adds the meta box settings if it is not a widget or if it is a widget and not being set to be ignored.
|
762 |
+
if ( ( ! isset( $atts['widget'] ) || ( isset( $atts['widget'] ) && 1 === $atts['widget'] && 1 !== $shariff_metabox_ignore_widget ) ) && 'total' !== $atts['services'] && 'totalnumber' !== $atts['services'] ) {
|
763 |
+
// Gets the meta box disable value.
|
764 |
+
$shariff3uu_metabox_disable = get_post_meta( get_the_ID(), 'shariff_metabox_disable', true );
|
765 |
+
|
766 |
+
// Stops all further actions if the meta box setting is set to disabled.
|
767 |
+
if ( '1' === $shariff3uu_metabox_disable ) {
|
768 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
}
|
770 |
+
|
771 |
+
// Gets the meta box shortcode.
|
772 |
+
$shariff3uu_metabox = get_post_meta( get_the_ID(), 'shariff_metabox', true );
|
773 |
+
|
774 |
+
// Replaces shariff with shariffmeta.
|
775 |
+
$shariff3uu_metabox = str_replace( '[shariff ', '[shariffmeta ', $shariff3uu_metabox );
|
776 |
+
|
777 |
+
// Gets the meta box attributes.
|
778 |
+
if ( '[shariff]' !== $shariff3uu_metabox ) {
|
779 |
+
do_shortcode( $shariff3uu_metabox );
|
780 |
+
}
|
781 |
+
|
782 |
+
if ( isset( $GLOBALS['shariff3uu']['metabox'] ) && ! empty( $GLOBALS['shariff3uu']['metabox'] ) ) {
|
783 |
+
$metabox = $GLOBALS['shariff3uu']['metabox'];
|
784 |
+
} else {
|
785 |
+
$metabox = array();
|
786 |
}
|
787 |
+
|
788 |
+
// Gets the meta box media attribute.
|
789 |
+
$shariff3uu_metabox_media = get_post_meta( get_the_ID(), 'shariff_metabox_media', true );
|
790 |
+
if ( ! empty( $shariff3uu_metabox_media ) ) {
|
791 |
+
$metabox['media'] = $shariff3uu_metabox_media;
|
792 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
793 |
|
794 |
+
// Merges the meta box atts array with the atts array (meta box shortcode overrides all others).
|
795 |
+
if ( ! empty( $metabox ) ) {
|
796 |
+
$atts = array_merge( $atts, $metabox );
|
797 |
+
}
|
798 |
|
799 |
+
// Clears the metabox global.
|
800 |
+
$GLOBALS['shariff3uu']['metabox'] = '';
|
801 |
+
} // End meta box if.
|
802 |
+
|
803 |
+
// Ov3rfly: Makes the attributes configurable from outside, e.g. for language etc.
|
804 |
+
$atts = apply_filters( 'shariff3uu_render_atts', $atts );
|
805 |
+
|
806 |
+
// Removes empty elements.
|
807 |
$atts = array_filter( $atts );
|
808 |
|
809 |
+
// Cleans up services (remove leading or trailing |, spaces, etc.).
|
810 |
+
$atts['services'] = trim( preg_replace( '/[^A-Za-z|]/', '', $atts['services'] ), '|' );
|
811 |
|
812 |
+
// Cleans up the headline in case it was used in a shorttag.
|
813 |
if ( array_key_exists( 'headline', $atts ) ) {
|
814 |
+
$atts['headline'] = wp_kses( $atts['headline'], $GLOBALS['allowed_tags'] );
|
815 |
}
|
816 |
|
817 |
+
// Enqueues the stylesheet (loading it here makes sure that it is only loaded on pages that actually contain shariff buttons).
|
818 |
+
// If SCRIPT_DEBUG is set to true, the non minified version will be loaded.
|
819 |
+
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG === true ) {
|
820 |
+
wp_enqueue_style( 'shariffcss', plugins_url( '/css/shariff.min.css', __FILE__ ), '', $shariff3uu['version'] );
|
821 |
+
} else {
|
822 |
+
wp_enqueue_style( 'shariffcss', plugins_url( '/css/shariff.min.css', __FILE__ ), '', $shariff3uu['version'] );
|
|
|
823 |
}
|
824 |
|
825 |
+
// Enqueues the share count script (the JS should be loaded at the footer - make sure that wp_footer() is present in your theme!)
|
826 |
+
// If SCRIPT_DEBUG is set to true, the non minified version will be loaded.
|
827 |
+
if ( array_key_exists( 'backend', $atts ) && 'on' === $atts['backend'] ) {
|
828 |
+
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG === true ) {
|
829 |
+
wp_enqueue_script( 'shariffjs', plugins_url( '/js/shariff.js', __FILE__ ), '', $shariff3uu['version'], true );
|
830 |
+
} else {
|
831 |
+
wp_enqueue_script( 'shariffjs', plugins_url( '/js/shariff.min.js', __FILE__ ), '', $shariff3uu['version'], true );
|
|
|
|
|
832 |
}
|
833 |
}
|
834 |
+
|
835 |
+
// Enqueues the popup script (the JS should be loaded at the footer - make sure that wp_footer() is present in your theme!).
|
836 |
+
// If SCRIPT_DEBUG is set to true, the non minified version will be loaded.
|
837 |
+
if ( array_key_exists( 'popup', $atts ) && 1 === $atts['popup'] ) {
|
838 |
+
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG === true ) {
|
839 |
+
wp_enqueue_script( 'shariff_popup', plugins_url( '/js/shariff-popup.js', __FILE__ ), '', $shariff3uu['version'], true );
|
840 |
+
} else {
|
841 |
+
wp_enqueue_script( 'shariff_popup', plugins_url( '/js/shariff-popup.min.js', __FILE__ ), '', $shariff3uu['version'], true );
|
|
|
|
|
842 |
}
|
843 |
}
|
844 |
|
845 |
+
// Sets the share url.
|
846 |
+
if ( array_key_exists( 'url', $atts ) ) {
|
847 |
+
$share_url = rawurlencode( $atts['url'] );
|
848 |
+
} else {
|
849 |
+
$share_url = rawurlencode( get_permalink() );
|
850 |
+
}
|
851 |
|
852 |
+
// Sets the share title.
|
853 |
+
if ( array_key_exists( 'title', $atts ) ) {
|
854 |
+
$share_title = rawurlencode( wp_strip_all_tags( $atts['title'] ) );
|
855 |
+
} else {
|
856 |
+
$share_title = rawurlencode( html_entity_decode( wp_strip_all_tags( get_the_title() ), ENT_COMPAT, 'UTF-8' ) );
|
857 |
+
}
|
858 |
+
|
859 |
+
// Sets the transient name.
|
860 |
+
$post_hash = 'shariff' . hash( 'md5', $share_url );
|
861 |
|
862 |
+
// Prevents php notices.
|
|
|
|
|
|
|
863 |
$share_counts = array();
|
864 |
+
$output = '';
|
865 |
|
866 |
+
// Gets the cached share counts.
|
867 |
+
if ( array_key_exists( 'backend', $atts ) && 'on' === $atts['backend'] && get_transient( $post_hash ) !== false ) {
|
868 |
$share_counts = get_transient( $post_hash );
|
869 |
}
|
870 |
|
871 |
+
// Adds ShariffSC container including custom styles if a custom style attribute or class exists.
|
|
|
|
|
|
|
872 |
if ( array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts ) ) {
|
873 |
$output .= '<div class="ShariffSC';
|
874 |
+
if ( array_key_exists( 'cssclass', $atts ) ) {
|
875 |
+
$output .= ' ' . esc_html( $atts['cssclass'] ) . '"';
|
876 |
+
} else {
|
877 |
+
$output .= '"';
|
878 |
+
}
|
879 |
+
if ( array_key_exists( 'style', $atts ) ) {
|
880 |
+
$output .= ' style="' . esc_html( $atts['style'] ) . '"';
|
881 |
+
}
|
882 |
$output .= '>';
|
883 |
}
|
884 |
+
|
885 |
+
// Tries http_negotiate_language if no language is set.
|
886 |
+
if ( ! array_key_exists( 'lang', $atts ) && function_exists( 'http_negotiate_language' ) ) {
|
887 |
$available_lang = array( 'en', 'de', 'fr', 'es', 'zh', 'hr', 'da', 'nl', 'fi', 'it', 'ja', 'ko', 'no', 'pl', 'pt', 'ro', 'ru', 'sk', 'sl', 'sr', 'sv', 'tr', 'zh' );
|
888 |
+
$lang = http_negotiate_language( $available_lang );
|
889 |
+
$atts['lang'] = substr( $lang, 0, 2 );
|
890 |
}
|
891 |
|
892 |
+
// Sets the default button share text.
|
893 |
$default_button_text_array = array(
|
894 |
'bg' => 'cподеляне',
|
895 |
+
'cs' => 'sdílet',
|
896 |
'da' => 'del',
|
897 |
'de' => 'teilen',
|
898 |
'en' => 'share',
|
918 |
'zh' => '分享',
|
919 |
);
|
920 |
|
921 |
+
// Adds the timestamp for the cache.
|
922 |
+
if ( array_key_exists( 'timestamp', $atts ) ) {
|
923 |
+
$post_timestamp = $atts['timestamp'];
|
924 |
+
} else {
|
925 |
+
$post_timestamp = absint( get_the_modified_date( 'U' ) );
|
926 |
+
}
|
927 |
+
|
928 |
+
// Starts the output of the actual Shariff buttons.
|
929 |
+
$output .= '<div class="shariff';
|
930 |
+
// Alignment.
|
931 |
+
if ( array_key_exists( 'align', $atts ) && 'none' !== $atts['align'] ) {
|
932 |
+
$output .= ' shariff-align-' . $atts['align'];
|
933 |
+
}
|
934 |
+
// Alignment widget.
|
935 |
+
if ( array_key_exists( 'align_widget', $atts ) && 'none' !== $atts['align_widget'] ) {
|
936 |
+
$output .= ' shariff-widget-align-' . $atts['align_widget'];
|
937 |
+
}
|
938 |
+
// Button Stretch.
|
939 |
+
if ( array_key_exists( 'buttonstretch', $atts ) && 1 === $atts['buttonstretch'] ) {
|
940 |
+
$output .= ' shariff-buttonstretch';
|
941 |
+
}
|
942 |
+
$output .= '"';
|
943 |
+
// Hides buttons until css is loaded.
|
944 |
+
if ( array_key_exists( 'hideuntilcss', $atts ) && 1 === $atts['hideuntilcss'] ) {
|
945 |
+
$output .= ' style="display:none"';
|
946 |
+
}
|
947 |
+
// Adds information for share count request.
|
948 |
+
if ( array_key_exists( 'backend', $atts ) && 'on' === $atts['backend'] ) {
|
949 |
+
// Share url.
|
950 |
+
$output .= ' data-url="' . esc_html( $share_url ) . '"';
|
951 |
+
// Timestamp for cache.
|
952 |
+
$output .= ' data-timestamp="' . $post_timestamp . '"';
|
953 |
+
// Hides share counts when they are zero.
|
954 |
+
if ( isset( $atts['hidezero'] ) && 1 === $atts['hidezero'] ) {
|
955 |
+
$output .= ' data-hidezero="1"';
|
956 |
}
|
957 |
+
// Adds external api if entered.
|
958 |
+
if ( isset( $shariff3uu['external_host'] ) && ! empty( $shariff3uu['external_host'] ) && isset( $shariff3uu['external_direct'] ) ) {
|
959 |
+
$output .= ' data-backendurl="' . $shariff3uu['external_host'] . '"';
|
960 |
+
} // Elseif test the subapi setting.
|
961 |
+
elseif ( isset( $shariff3uu['subapi'] ) && 1 === $shariff3uu['subapi'] ) {
|
962 |
+
$output .= ' data-backendurl="' . get_bloginfo( 'wpurl' ) . '/wp-json/shariff/v1/share_counts?"';
|
963 |
+
} // Elseif pretty permalinks are not activated fall back to manual rest route.
|
964 |
+
elseif ( ! get_option( 'permalink_structure' ) ) {
|
965 |
+
$output .= ' data-backendurl="?rest_route=/shariff/v1/share_counts&"';
|
966 |
+
} // Else use the home url.
|
967 |
+
else {
|
968 |
+
$output .= ' data-backendurl="' . rtrim( home_url(), '/' ) . '/wp-json/shariff/v1/share_counts?"';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
969 |
}
|
970 |
+
}
|
971 |
$output .= '>';
|
972 |
+
|
973 |
+
// Adds the headline.
|
974 |
if ( array_key_exists( 'headline', $atts ) ) {
|
975 |
+
if ( ! array_key_exists( 'total', $share_counts ) ) {
|
976 |
+
$share_counts['total'] = '0';
|
977 |
+
}
|
978 |
$atts['headline'] = str_replace( '%total', '<span class="shariff-total">' . absint( $share_counts['total'] ) . '</span>', $atts['headline'] );
|
979 |
+
$output .= '<div class="ShariffHeadline">' . $atts['headline'] . '</div>';
|
980 |
}
|
981 |
|
982 |
+
// Start the ul list with design classes.
|
983 |
$output .= '<ul class="shariff-buttons ';
|
984 |
+
// Theme.
|
985 |
+
if ( array_key_exists( 'theme', $atts ) ) {
|
986 |
+
$output .= 'theme-' . esc_html( $atts['theme'] ) . ' ';
|
987 |
+
} else {
|
988 |
+
$output .= 'theme-default ';
|
989 |
+
}
|
990 |
+
// Orientation.
|
991 |
+
if ( array_key_exists( 'orientation', $atts ) ) {
|
992 |
+
$output .= 'orientation-' . esc_html( $atts['orientation'] ) . ' ';
|
993 |
+
} else {
|
994 |
+
$output .= 'orientation-horizontal ';
|
995 |
+
}
|
996 |
+
// Size.
|
997 |
+
if ( array_key_exists( 'buttonsize', $atts ) ) {
|
998 |
+
$output .= 'buttonsize-' . esc_html( $atts['buttonsize'] );
|
999 |
+
} else {
|
1000 |
+
$output .= 'buttonsize-medium';
|
1001 |
+
}
|
1002 |
$output .= '">';
|
1003 |
|
1004 |
+
// Prevents warnings while debug mode is on.
|
1005 |
+
$flattr_error = '';
|
1006 |
+
$paypal_error = '';
|
1007 |
+
$paypalme_error = '';
|
1008 |
+
$bitcoin_error = '';
|
1009 |
+
$patreon_error = '';
|
1010 |
$button_text_array = '';
|
1011 |
$backend_available = '';
|
1012 |
+
$mobile_only = '';
|
1013 |
+
$button_url = '';
|
1014 |
+
$no_custom_color = '';
|
1015 |
|
1016 |
+
// Explodes services.
|
1017 |
$service_array = explode( '|', $atts['services'] );
|
1018 |
|
1019 |
+
// Migrates mail to mailto.
|
1020 |
+
$service_array = preg_replace( '/\bmail\b/', 'mailto', $service_array );
|
1021 |
+
|
1022 |
+
// Migrates mailform to mailto.
|
1023 |
+
$service_array = preg_replace( '/\bmailform\b/', 'mailto', $service_array );
|
1024 |
+
|
1025 |
+
// Remove duplicated services.
|
1026 |
+
$service_array = array_unique( $service_array );
|
1027 |
|
1028 |
+
// Loops through all desired services.
|
1029 |
foreach ( $service_array as $service ) {
|
1030 |
+
// Check if necessary usernames are set and display warning to admins, if needed.
|
1031 |
+
if ( 'flattr' === $service && ! array_key_exists( 'flattruser', $atts ) ) {
|
1032 |
+
$flattr_error = 1;
|
1033 |
+
} elseif ( 'paypal' === $service && ! array_key_exists( 'paypalbuttonid', $atts ) ) {
|
1034 |
+
$paypal_error = 1;
|
1035 |
+
} elseif ( 'paypalme' === $service && ! array_key_exists( 'paypalmeid', $atts ) ) {
|
1036 |
+
$paypalme_error = 1;
|
1037 |
+
} elseif ( 'bitcoin' === $service && ! array_key_exists( 'bitcoinaddress', $atts ) ) {
|
1038 |
+
$bitcoin_error = 1;
|
1039 |
+
} elseif ( 'patreon' === $service && ! array_key_exists( 'patreonid', $atts ) ) {
|
1040 |
+
$patreon_error = 1;
|
1041 |
+
} elseif ( 'total' !== $service && 'totalnumber' !== $service ) {
|
1042 |
+
|
1043 |
+
// Only the frontend part is needed.
|
1044 |
+
$frontend = 1;
|
1045 |
+
|
1046 |
+
// Determines the path to the service phps.
|
1047 |
+
$path_service_file = dirname( __FILE__ ) . '/services/shariff-' . $service . '.php';
|
1048 |
+
|
1049 |
+
// Checks if service file exists.
|
1050 |
if ( file_exists( $path_service_file ) ) {
|
1051 |
|
1052 |
+
// Includes service file.
|
1053 |
+
include $path_service_file;
|
1054 |
|
1055 |
+
// Overwrites service specific colors, if custom colors are set.
|
1056 |
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1057 |
$main_color = $atts['maincolor'];
|
1058 |
+
} else {
|
1059 |
+
$no_custom_color = 'shariff-nocustomcolor ';
|
1060 |
}
|
1061 |
if ( array_key_exists( 'secondarycolor', $atts ) ) {
|
1062 |
$secondary_color = $atts['secondarycolor'];
|
1063 |
}
|
1064 |
|
1065 |
+
// Sets the border radius for the round theme.
|
1066 |
+
if ( array_key_exists( 'borderradius', $atts ) && array_key_exists( 'theme', $atts ) && 'round' === $atts['theme'] ) {
|
1067 |
$border_radius = '; border-radius:' . $atts['borderradius'] . '%';
|
1068 |
+
} else {
|
|
|
1069 |
$border_radius = '';
|
1070 |
}
|
1071 |
|
1072 |
+
// Info button for default theme.
|
1073 |
+
if ( ! array_key_exists( 'maincolor', $atts ) && 'info' === $service && ( ( array_key_exists( 'theme', $atts ) && 'default' === $atts['theme'] || ( array_key_exists( 'theme', $atts ) && 'round' === $atts['theme'] ) ) || ! array_key_exists( 'theme', $atts ) ) ) {
|
1074 |
+
$main_color = '#fff';
|
1075 |
+
$secondary_color = '#eee';
|
1076 |
}
|
1077 |
|
1078 |
+
// Start li.
|
1079 |
+
$output .= '<li class="shariff-button ' . $no_custom_color . $service;
|
1080 |
+
// Mobile only.
|
1081 |
+
if ( 1 === $mobile_only ) {
|
1082 |
+
$output .= ' shariff-mobile';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1083 |
}
|
1084 |
+
$output .= '" style="background-color:' . $secondary_color . $border_radius . '">';
|
1085 |
|
1086 |
+
// Uses default button share text, if $button_text_array is empty.
|
1087 |
+
if ( empty( $button_text_array ) ) {
|
1088 |
+
$button_text_array = $default_button_text_array;
|
|
|
|
|
|
|
1089 |
}
|
1090 |
|
1091 |
+
// Sets button text in desired language; fallback is English.
|
1092 |
+
if ( array_key_exists( 'lang', $atts ) && array_key_exists( $atts['lang'], $button_text_array ) ) {
|
1093 |
+
$button_text = $button_text_array[ $atts['lang'] ];
|
1094 |
+
} else {
|
1095 |
+
$button_text = $button_text_array['en'];
|
|
|
|
|
|
|
|
|
|
|
|
|
1096 |
}
|
1097 |
|
1098 |
+
// Sets the button title / label in desired language; fallback is English.
|
1099 |
+
if ( array_key_exists( 'lang', $atts ) && array_key_exists( $atts['lang'], $button_title_array ) ) {
|
1100 |
+
$button_title = $button_title_array[ $atts['lang'] ];
|
1101 |
+
} else {
|
1102 |
+
$button_title = $button_title_array['en'];
|
1103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1104 |
|
1105 |
+
// Resets $button_text_array.
|
1106 |
+
$button_text_array = '';
|
1107 |
|
1108 |
+
// Build the actual button.
|
1109 |
+
$output .= '<a href="' . $button_url . '" title="' . $button_title . '" aria-label="' . $button_title . '" role="button" rel="';
|
1110 |
+
if ( 'facebook' !== $service ) {
|
1111 |
+
$output .= 'noopener ';
|
|
|
|
|
|
|
1112 |
}
|
1113 |
+
$output .= 'nofollow" class="shariff-link" ';
|
1114 |
+
// Same window?
|
1115 |
+
if ( ! isset( $same_window ) || isset( $same_window ) && 1 !== $same_window ) {
|
1116 |
+
$output .= 'target="_blank" ';
|
1117 |
}
|
1118 |
+
$output .= 'style="background-color:' . $main_color . $border_radius;
|
1119 |
+
// Theme white?
|
1120 |
+
if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
|
1121 |
+
$output .= '; color:' . $main_color;
|
1122 |
+
} else {
|
1123 |
+
$output .= '; color:#fff';
|
1124 |
}
|
1125 |
+
$output .= '">';
|
1126 |
+
$output .= '<span class="shariff-icon"';
|
1127 |
+
// Theme white?
|
1128 |
+
if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
|
1129 |
+
$output .= ' style="fill:' . $main_color . '"';
|
|
|
|
|
|
|
|
|
1130 |
}
|
1131 |
+
$output .= '>' . $svg_icon . '</span>';
|
1132 |
+
$output .= '<span class="shariff-text"';
|
1133 |
+
if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
|
1134 |
+
$output .= ' style="color:' . $main_color;
|
|
|
|
|
|
|
|
|
|
|
1135 |
}
|
1136 |
+
$output .= '">' . $button_text . '</span> ';
|
1137 |
+
// Share counts?
|
1138 |
+
if ( array_key_exists( 'sharecounts', $atts ) && 1 === $atts['sharecounts'] && 1 === $backend_available && ! isset( $shariff3uu['disable'][ $service ] ) ) {
|
1139 |
+
$output .= '<span class="shariff-count" data-service="' . $service . '" style="color:' . $main_color;
|
1140 |
+
if ( true === array_key_exists( $service, $share_counts ) && null !== $share_counts[ $service ] && '-1' !== $share_counts[ $service ] && ( ! isset( $atts['hidezero'] ) || ( isset( $atts['hidezero'] ) && '-1' !== $atts['hidezero'] ) || ( isset( $atts['hidezero'] ) && 1 === $atts['hidezero'] && $share_counts[ $service ] > 0 ) ) ) {
|
1141 |
+
$output .= '"> ' . $share_counts[ $service ];
|
1142 |
+
} else {
|
1143 |
+
$output .= ';opacity:0">';
|
1144 |
+
}
|
1145 |
+
$output .= '</span> ';
|
|
|
|
|
1146 |
}
|
1147 |
+
$output .= '</a>';
|
1148 |
+
$output .= '</li>';
|
1149 |
+
// Adds service to backend service, if available.
|
1150 |
+
if ( 1 === $backend_available && ! isset( $shariff3uu['disable'][ $service ] ) ) {
|
1151 |
+
$backend_service_array[] = $service;
|
1152 |
}
|
1153 |
+
// Resets the $backend, $mobile_only and $same_window variables.
|
1154 |
+
$backend_available = '';
|
1155 |
+
$mobile_only = '';
|
1156 |
+
$same_window = '';
|
1157 |
+
} // End if service file exists.
|
1158 |
+
} // End if is real and fully setup service.
|
1159 |
+
} // End foreach() loop.
|
1160 |
|
1161 |
+
// Adds the list of backend services.
|
1162 |
+
if ( ! empty( $backend_service_array ) ) {
|
1163 |
+
$backend_services = implode( '|', $backend_service_array );
|
1164 |
+
$output = str_replace( 'data-url=', 'data-services="' . esc_html( rawurlencode( $backend_services ) ) . '" data-url=', $output );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1165 |
}
|
|
|
1166 |
|
1167 |
+
// Closes ul and the main shariff div.
|
1168 |
+
$output .= '</ul></div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1169 |
|
1170 |
+
// Closes the style attribute, if there was one.
|
1171 |
+
if ( array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts ) ) {
|
1172 |
+
$output .= '</div>';
|
|
|
|
|
|
|
|
|
|
|
1173 |
}
|
1174 |
|
1175 |
+
// Displays a warning to admins if flattr is set, but no flattr username was provided.
|
1176 |
+
if ( 1 === $flattr_error && current_user_can( 'manage_options' ) ) {
|
1177 |
+
$output .= '<div class="shariff-warning">' . __( 'Username for Flattr is missing!', 'shariff' ) . '</div>';
|
1178 |
+
}
|
1179 |
+
// Displays a warning to admins if patreon is set, but no patreon username was provided.
|
1180 |
+
if ( 1 === $patreon_error && current_user_can( 'manage_options' ) ) {
|
1181 |
+
$output .= '<div class="shariff-warning">' . __( 'Username for patreon is missing!', 'shariff' ) . '</div>';
|
1182 |
+
}
|
1183 |
+
// Displays a warning to admins if paypal is set, but no paypal button id was provided.
|
1184 |
+
if ( 1 === $paypal_error && current_user_can( 'manage_options' ) ) {
|
1185 |
+
$output .= '<div class="shariff-warning">' . __( 'Button ID for PayPal is missing!', 'shariff' ) . '</div>';
|
1186 |
+
}
|
1187 |
+
// Displays a warning to admins if paypalme is set, but no paypalme id was provided.
|
1188 |
+
if ( 1 === $paypalme_error && current_user_can( 'manage_options' ) ) {
|
1189 |
+
$output .= '<div class="shariff-warning">' . __( 'PayPal.Me ID is missing!', 'shariff' ) . '</div>';
|
1190 |
+
}
|
1191 |
+
// Displays a warning to admins if bitcoin is set, but no bitcoin address was provided.
|
1192 |
+
if ( 1 === $bitcoin_error && current_user_can( 'manage_options' ) ) {
|
1193 |
+
$output .= '<div class="shariff-warning">' . __( 'Address for Bitcoin is missing!', 'shariff' ) . '</div>';
|
1194 |
}
|
1195 |
|
1196 |
+
// If the service totalnumber is set, just output the total share count.
|
1197 |
+
if ( array_key_exists( '0', $service_array ) && 'totalnumber' === $service_array['0'] ) {
|
1198 |
+
$output = '<span class="shariff" data-services="totalnumber" data-url="' . $share_url . '"';
|
1199 |
+
// Adds the external api.
|
1200 |
+
if ( isset( $shariff3uu['external_host'] ) && ! empty( $shariff3uu['external_host'] ) && isset( $shariff3uu['external_direct'] ) ) {
|
1201 |
+
$output .= ' data-backendurl="' . $shariff3uu['external_host'] . '"';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1202 |
}
|
1203 |
+
$output .= '><span class="shariff-totalnumber">' . absint( $share_counts['total'] ) . '</span></span>';
|
1204 |
+
}
|
1205 |
|
1206 |
+
return $output;
|
1207 |
+
}
|
|
|
|
|
|
|
|
|
|
|
1208 |
|
1209 |
+
// Registers the helper shortcode.
|
1210 |
+
add_shortcode( 'shariffmeta', 'shariff3uu_meta' );
|
|
|
|
|
|
|
1211 |
|
1212 |
+
/**
|
1213 |
+
* Meta box helper function. Creates a global variable with the current meta box attributes.
|
1214 |
+
*
|
1215 |
+
* @param array $atts List of shariff shortcode attributes.
|
1216 |
+
*/
|
1217 |
+
function shariff3uu_meta( $atts ) {
|
1218 |
+
if ( ! empty( $atts ) ) {
|
1219 |
+
$GLOBALS['shariff3uu']['metabox'] = $atts;
|
1220 |
+
} else {
|
1221 |
+
$GLOBALS['shariff3uu']['metabox'] = array();
|
1222 |
+
}
|
1223 |
+
}
|
1224 |
|
1225 |
+
/**
|
1226 |
+
* Clears transients and removes cron job upon deactivation.
|
1227 |
+
*/
|
1228 |
+
function shariff3uu_deactivate() {
|
1229 |
global $wpdb;
|
1230 |
+
// Checks for multisite.
|
1231 |
+
if ( is_multisite() && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
|
1232 |
+
$sites = get_sites();
|
1233 |
+
foreach ( $sites as $site ) {
|
1234 |
+
switch_to_blog( $site->blog_id );
|
1235 |
+
// Purges transients.
|
1236 |
+
shariff3uu_purge_transients_deactivation();
|
1237 |
+
// Removes the cron job.
|
1238 |
+
wp_clear_scheduled_hook( 'shariff3uu_fill_cache' );
|
1239 |
+
// Switches back to main blog.
|
1240 |
+
restore_current_blog();
|
|
|
|
|
|
|
|
|
1241 |
}
|
1242 |
+
} else {
|
1243 |
+
// Purges transients.
|
1244 |
+
shariff3uu_purge_transients_deactivation();
|
1245 |
+
// Removes cron job.
|
1246 |
+
wp_clear_scheduled_hook( 'shariff3uu_fill_cache' );
|
|
|
1247 |
}
|
1248 |
}
|
1249 |
+
register_deactivation_hook( __FILE__, 'shariff3uu_deactivate' );
|
1250 |
|
1251 |
+
/**
|
1252 |
+
* Purges all the transients associated with our plugin.
|
1253 |
+
*/
|
1254 |
+
function shariff3uu_purge_transients_deactivation() {
|
1255 |
+
// Makes sure the $wpdb class is ready.
|
1256 |
+
if ( ! isset( $wpdb ) ) {
|
1257 |
+
global $wpdb;
|
1258 |
+
}
|
1259 |
+
// Deletes transients.
|
1260 |
+
// @codingStandardsIgnoreStart
|
1261 |
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_timeout_shariff%"';
|
1262 |
+
$wpdb->query( $sql );
|
1263 |
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_shariff%"';
|
1264 |
+
$wpdb->query( $sql );
|
1265 |
+
// @codingStandardsIgnoreEnd
|
1266 |
+
// Clears object cache.
|
1267 |
wp_cache_flush();
|
1268 |
}
|
|
|
|
uninstall.php
CHANGED
@@ -1,18 +1,27 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
//
|
5 |
-
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
|
|
|
|
6 |
|
7 |
-
//
|
8 |
if ( is_multisite() ) {
|
9 |
global $wpdb;
|
10 |
-
$
|
|
|
|
|
|
|
11 |
if ( $blogs ) {
|
12 |
-
foreach( $blogs as $blog ) {
|
13 |
-
//
|
14 |
switch_to_blog( $blog['blog_id'] );
|
15 |
-
//
|
16 |
delete_option( 'shariff3UU' );
|
17 |
delete_option( 'shariff3UU_basic' );
|
18 |
delete_option( 'shariff3UU_design' );
|
@@ -21,16 +30,21 @@ if ( is_multisite() ) {
|
|
21 |
delete_option( 'shariff3UU_statistic' );
|
22 |
delete_option( 'widget_shariff' );
|
23 |
delete_option( 'shariff3UU_hide_update_notice' );
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
27 |
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
|
28 |
-
//
|
29 |
restore_current_blog();
|
30 |
}
|
31 |
}
|
32 |
} else {
|
33 |
-
//
|
34 |
delete_option( 'shariff3UU' );
|
35 |
delete_option( 'shariff3UU_basic' );
|
36 |
delete_option( 'shariff3UU_design' );
|
@@ -39,23 +53,34 @@ if ( is_multisite() ) {
|
|
39 |
delete_option( 'shariff3UU_statistic' );
|
40 |
delete_option( 'widget_shariff' );
|
41 |
delete_option( 'shariff3UU_hide_update_notice' );
|
42 |
-
delete_option( '
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
|
47 |
}
|
48 |
|
49 |
-
|
50 |
-
function
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_timeout_shariff%"';
|
54 |
$wpdb->query($sql);
|
55 |
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_shariff%"';
|
56 |
$wpdb->query($sql);
|
57 |
-
//
|
|
|
|
|
58 |
wp_cache_flush();
|
59 |
}
|
60 |
-
|
61 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete options upon uninstall to prevent issues with other plugins and leaving trash behind.
|
4 |
+
*
|
5 |
+
* @package WordPress
|
6 |
+
*/
|
7 |
|
8 |
+
// Exit, if uninstall.php was not called from WordPress.
|
9 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
10 |
+
die();
|
11 |
+
}
|
12 |
|
13 |
+
// Delete options (even old ones), remove cron job and clear cache.
|
14 |
if ( is_multisite() ) {
|
15 |
global $wpdb;
|
16 |
+
$current_blog_id = get_current_blog_id();
|
17 |
+
// @codingStandardsIgnoreStart
|
18 |
+
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
|
19 |
+
// @codingStandardsIgnoreEnd
|
20 |
if ( $blogs ) {
|
21 |
+
foreach ( $blogs as $blog ) {
|
22 |
+
// Switch to each blog.
|
23 |
switch_to_blog( $blog['blog_id'] );
|
24 |
+
// Delete options from options table.
|
25 |
delete_option( 'shariff3UU' );
|
26 |
delete_option( 'shariff3UU_basic' );
|
27 |
delete_option( 'shariff3UU_design' );
|
30 |
delete_option( 'shariff3UU_statistic' );
|
31 |
delete_option( 'widget_shariff' );
|
32 |
delete_option( 'shariff3UU_hide_update_notice' );
|
33 |
+
delete_option( 'shariff3uu_basic' );
|
34 |
+
delete_option( 'shariff3uu_design' );
|
35 |
+
delete_option( 'shariff3uu_advanced' );
|
36 |
+
delete_option( 'shariff3uu_mailform' );
|
37 |
+
delete_option( 'shariff3uu_statistic' );
|
38 |
+
// Purge transients.
|
39 |
+
shariff3uu_purge_transients();
|
40 |
+
// Remove cron job.
|
41 |
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
|
42 |
+
// Switch back to main.
|
43 |
restore_current_blog();
|
44 |
}
|
45 |
}
|
46 |
} else {
|
47 |
+
// Delete options from options table.
|
48 |
delete_option( 'shariff3UU' );
|
49 |
delete_option( 'shariff3UU_basic' );
|
50 |
delete_option( 'shariff3UU_design' );
|
53 |
delete_option( 'shariff3UU_statistic' );
|
54 |
delete_option( 'widget_shariff' );
|
55 |
delete_option( 'shariff3UU_hide_update_notice' );
|
56 |
+
delete_option( 'shariff3uu_basic' );
|
57 |
+
delete_option( 'shariff3uu_design' );
|
58 |
+
delete_option( 'shariff3uu_advanced' );
|
59 |
+
delete_option( 'shariff3uu_mailform' );
|
60 |
+
delete_option( 'shariff3uu_statistic' );
|
61 |
+
// Purge transients.
|
62 |
+
shariff3uu_purge_transients();
|
63 |
+
// Remove cron job.
|
64 |
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
|
65 |
}
|
66 |
|
67 |
+
/**
|
68 |
+
* Helper function to purge all the transients associated with our plugin.
|
69 |
+
*/
|
70 |
+
function shariff3uu_purge_transients() {
|
71 |
+
// Make sure we have the $wpdb class ready.
|
72 |
+
if ( ! isset( $wpdb ) ) {
|
73 |
+
global $wpdb;
|
74 |
+
}
|
75 |
+
|
76 |
+
// Delete transients.
|
77 |
+
// @codingStandardsIgnoreStart
|
78 |
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_timeout_shariff%"';
|
79 |
$wpdb->query($sql);
|
80 |
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_shariff%"';
|
81 |
$wpdb->query($sql);
|
82 |
+
// @codingStandardsIgnoreEnd
|
83 |
+
|
84 |
+
// Clear object cache.
|
85 |
wp_cache_flush();
|
86 |
}
|
|
|
|
updates.php
CHANGED
@@ -1,340 +1,363 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Will be included by shariff3UU_update() only if needed.
|
4 |
-
* Put all update task here
|
5 |
-
* At least you must set $GLOBALS["shariff3UU"]["version"] = [YOUR VERSION]; to avoid includes later on.
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
}
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
}
|
44 |
-
|
45 |
-
$
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
if ( isset( $GLOBALS[
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
if ( isset( $GLOBALS[
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
if ( isset( $GLOBALS[
|
96 |
-
|
97 |
-
|
98 |
-
if ( isset( $GLOBALS[
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
$
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
//
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
@
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
}
|
215 |
-
|
216 |
-
//
|
217 |
-
if (
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
//
|
222 |
-
if ( isset( $GLOBALS[
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
//
|
235 |
-
$
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
$
|
281 |
-
$
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
}
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
//
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
//
|
303 |
-
$
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
//
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
//
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
//
|
331 |
-
$
|
332 |
-
|
333 |
-
|
334 |
-
$
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Will be included by shariff3UU_update() only if needed.
|
4 |
+
* Put all update task here. Make sure that all "older" updates are checked first.
|
5 |
+
* At least you must set $GLOBALS["shariff3UU"]["version"] = [YOUR VERSION]; to avoid includes later on.
|
6 |
+
*
|
7 |
+
* @package WordPress
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Prevent direct calls.
|
11 |
+
if ( ! class_exists( 'WP' ) ) {
|
12 |
+
die();
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Migration < 2.3
|
17 |
+
* Split options in database according to new setting tabs.
|
18 |
+
* Delete old cache directory.
|
19 |
+
*/
|
20 |
+
if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '2.2.5' ) ) {
|
21 |
+
|
22 |
+
// Basic options.
|
23 |
+
if ( isset( $GLOBALS['shariff3UU']['version'] ) ) {
|
24 |
+
$GLOBALS['shariff3UU_basic']['version'] = $GLOBALS['shariff3UU']['version'];
|
25 |
+
}
|
26 |
+
if ( isset( $GLOBALS['shariff3UU']['services'] ) ) {
|
27 |
+
$GLOBALS['shariff3UU_basic']['services'] = $GLOBALS['shariff3UU']['services'];
|
28 |
+
}
|
29 |
+
if ( isset( $GLOBALS['shariff3UU']['add_after_all_posts'] ) ) {
|
30 |
+
$GLOBALS['shariff3UU_basic']['add_after']['posts'] = $GLOBALS['shariff3UU']['add_after_all_posts'];
|
31 |
+
}
|
32 |
+
if ( isset( $GLOBALS['shariff3UU']['add_after_all_overview'] ) ) {
|
33 |
+
$GLOBALS['shariff3UU_basic']['add_after']['posts_blogpage'] = $GLOBALS['shariff3UU']['add_after_all_overview'];
|
34 |
+
}
|
35 |
+
if ( isset( $GLOBALS['shariff3UU']['add_after_all_pages'] ) ) {
|
36 |
+
$GLOBALS['shariff3UU_basic']['add_after']['pages'] = $GLOBALS['shariff3UU']['add_after_all_pages'];
|
37 |
+
}
|
38 |
+
if ( isset( $GLOBALS['shariff3UU']['add_after_all_custom_type'] ) ) {
|
39 |
+
$GLOBALS['shariff3UU_basic']['add_after']['custom_type'] = $GLOBALS['shariff3UU']['add_after_all_custom_type'];
|
40 |
+
}
|
41 |
+
if ( isset( $GLOBALS['shariff3UU']['add_before_all_posts'] ) ) {
|
42 |
+
$GLOBALS['shariff3UU_basic']['add_before']['posts'] = $GLOBALS['shariff3UU']['add_before_all_posts'];
|
43 |
+
}
|
44 |
+
if ( isset( $GLOBALS['shariff3UU']['add_before_all_overview'] ) ) {
|
45 |
+
$GLOBALS['shariff3UU_basic']['add_before']['posts_blogpage'] = $GLOBALS['shariff3UU']['add_before_all_overview'];
|
46 |
+
}
|
47 |
+
if ( isset( $GLOBALS['shariff3UU']['add_before_all_pages'] ) ) {
|
48 |
+
$GLOBALS['shariff3UU_basic']['add_before']['pages'] = $GLOBALS['shariff3UU']['add_before_all_pages'];
|
49 |
+
}
|
50 |
+
if ( isset( $GLOBALS['shariff3UU']['disable_on_protected'] ) ) {
|
51 |
+
$GLOBALS['shariff3UU_basic']['disable_on_protected'] = $GLOBALS['shariff3UU']['disable_on_protected'];
|
52 |
+
}
|
53 |
+
if ( isset( $GLOBALS['shariff3UU']['backend'] ) ) {
|
54 |
+
$GLOBALS['shariff3UU_basic']['backend'] = $GLOBALS['shariff3UU']['backend'];
|
55 |
+
}
|
56 |
+
|
57 |
+
// Design options.
|
58 |
+
if ( isset( $GLOBALS['shariff3UU']['language'] ) ) {
|
59 |
+
$GLOBALS['shariff3UU_design']['language'] = $GLOBALS['shariff3UU']['language'];
|
60 |
+
}
|
61 |
+
if ( isset( $GLOBALS['shariff3UU']['theme'] ) ) {
|
62 |
+
$GLOBALS['shariff3UU_design']['theme'] = $GLOBALS['shariff3UU']['theme'];
|
63 |
+
}
|
64 |
+
if ( isset( $GLOBALS['shariff3UU']['buttonsize'] ) ) {
|
65 |
+
$GLOBALS['shariff3UU_design']['buttonsize'] = $GLOBALS['shariff3UU']['buttonsize'];
|
66 |
+
}
|
67 |
+
if ( isset( $GLOBALS['shariff3UU']['vertical'] ) ) {
|
68 |
+
$GLOBALS['shariff3UU_design']['vertical'] = $GLOBALS['shariff3UU']['vertical'];
|
69 |
+
}
|
70 |
+
if ( isset( $GLOBALS['shariff3UU']['align'] ) ) {
|
71 |
+
$GLOBALS['shariff3UU_design']['align'] = $GLOBALS['shariff3UU']['align'];
|
72 |
+
}
|
73 |
+
if ( isset( $GLOBALS['shariff3UU']['align_widget'] ) ) {
|
74 |
+
$GLOBALS['shariff3UU_design']['align_widget'] = $GLOBALS['shariff3UU']['align_widget'];
|
75 |
+
}
|
76 |
+
if ( isset( $GLOBALS['shariff3UU']['style'] ) ) {
|
77 |
+
$GLOBALS['shariff3UU_design']['style'] = $GLOBALS['shariff3UU']['style'];
|
78 |
+
}
|
79 |
+
|
80 |
+
// Advanced options.
|
81 |
+
if ( isset( $GLOBALS['shariff3UU']['info_url'] ) ) {
|
82 |
+
$GLOBALS['shariff3UU_advanced']['info_url'] = $GLOBALS['shariff3UU']['info_url'];
|
83 |
+
}
|
84 |
+
if ( isset( $GLOBALS['shariff3UU']['twitter_via'] ) ) {
|
85 |
+
$GLOBALS['shariff3UU_advanced']['twitter_via'] = $GLOBALS['shariff3UU']['twitter_via'];
|
86 |
+
}
|
87 |
+
if ( isset( $GLOBALS['shariff3UU']['flattruser'] ) ) {
|
88 |
+
$GLOBALS['shariff3UU_advanced']['flattruser'] = $GLOBALS['shariff3UU']['flattruser'];
|
89 |
+
}
|
90 |
+
if ( isset( $GLOBALS['shariff3UU']['default_pinterest'] ) ) {
|
91 |
+
$GLOBALS['shariff3UU_advanced']['default_pinterest'] = $GLOBALS['shariff3UU']['default_pinterest'];
|
92 |
+
}
|
93 |
+
|
94 |
+
// Mailform options.
|
95 |
+
if ( isset( $GLOBALS['shariff3UU']['mail_add_post_content'] ) ) {
|
96 |
+
$GLOBALS['shariff3UU_mailform']['mail_add_post_content'] = $GLOBALS['shariff3UU']['mail_add_post_content'];
|
97 |
+
}
|
98 |
+
if ( isset( $GLOBALS['shariff3UU']['mail_sender_name'] ) ) {
|
99 |
+
$GLOBALS['shariff3UU_mailform']['mail_sender_name'] = $GLOBALS['shariff3UU']['mail_sender_name'];
|
100 |
+
}
|
101 |
+
if ( isset( $GLOBALS['shariff3UU']['mail_sender_from'] ) ) {
|
102 |
+
$GLOBALS['shariff3UU_mailform']['mail_sender_from'] = $GLOBALS['shariff3UU']['mail_sender_from'];
|
103 |
+
}
|
104 |
+
// Default options should be as save as possible, same reason the statistics are disabled by default.
|
105 |
+
$GLOBALS['shariff3UU_mailform']['require_sender'] = 1;
|
106 |
+
|
107 |
+
// Update global.
|
108 |
+
$GLOBALS['shariff3UU'] = array_merge( $GLOBALS['shariff3UU_basic'], $GLOBALS['shariff3UU_design'], $GLOBALS['shariff3UU_advanced'], $GLOBALS['shariff3UU_mailform'] );
|
109 |
+
|
110 |
+
// Update version.
|
111 |
+
$GLOBALS['shariff3UU']['version'] = '2.3.0';
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Migration < 3.3
|
116 |
+
* Update options that were moved.
|
117 |
+
* Delete old cache directory and db entry.
|
118 |
+
*/
|
119 |
+
if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '3.3.0' ) ) {
|
120 |
+
|
121 |
+
// Update options that were moved.
|
122 |
+
if ( isset( $GLOBALS['shariff3UU']['backend'] ) ) {
|
123 |
+
$GLOBALS['shariff3UU_statistic']['backend'] = $GLOBALS['shariff3UU']['backend'];
|
124 |
+
}
|
125 |
+
if ( isset( $GLOBALS['shariff3UU']['fb_id'] ) ) {
|
126 |
+
$GLOBALS['shariff3UU_statistic']['fb_id'] = $GLOBALS['shariff3UU']['fb_id'];
|
127 |
+
}
|
128 |
+
if ( isset( $GLOBALS['shariff3UU']['fb_secret'] ) ) {
|
129 |
+
$GLOBALS['shariff3UU_statistic']['fb_secret'] = $GLOBALS['shariff3UU']['fb_secret'];
|
130 |
+
}
|
131 |
+
if ( isset( $GLOBALS['shariff3UU']['ttl'] ) ) {
|
132 |
+
$GLOBALS['shariff3UU_statistic']['ttl'] = $GLOBALS['shariff3UU']['ttl'];
|
133 |
+
}
|
134 |
+
if ( isset( $GLOBALS['shariff3UU']['disable'] ) ) {
|
135 |
+
$GLOBALS['shariff3UU_statistic']['disable'] = $GLOBALS['shariff3UU']['disable'];
|
136 |
+
}
|
137 |
+
|
138 |
+
// Delete old cache directory and db entry.
|
139 |
+
if ( is_multisite() ) {
|
140 |
+
global $wpdb;
|
141 |
+
$current_blog_id = get_current_blog_id();
|
142 |
+
// @codingStandardsIgnoreStart
|
143 |
+
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
|
144 |
+
// @codingStandardsIgnoreEnd
|
145 |
+
if ( $blogs ) {
|
146 |
+
foreach ( $blogs as $blog ) {
|
147 |
+
// Switch to each blog.
|
148 |
+
switch_to_blog( $blog['blog_id'] );
|
149 |
+
// Delete cache dir.
|
150 |
+
shariff_removeoldcachedir();
|
151 |
+
// Delete old db entry.
|
152 |
+
delete_option( 'shariff3UU' );
|
153 |
+
// Switch back to main.
|
154 |
+
restore_current_blog();
|
155 |
+
}
|
156 |
+
}
|
157 |
+
} else {
|
158 |
+
// Delete cache dir.
|
159 |
+
shariff_removeoldcachedir();
|
160 |
+
// Delete old db entry.
|
161 |
+
delete_option( 'shariff3UU' );
|
162 |
+
}
|
163 |
+
|
164 |
+
// Disable Twitter backend due to new service OpenShareCount.com.
|
165 |
+
$GLOBALS['shariff3UU_statistic']['disable']['twitter'] = 1;
|
166 |
+
|
167 |
+
// Update version.
|
168 |
+
$GLOBALS['shariff3UU']['version'] = '3.3.0';
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Helper function to delete old cache directory.
|
173 |
+
*/
|
174 |
+
function shariff_removeoldcachedir() {
|
175 |
+
$upload_dir = wp_upload_dir();
|
176 |
+
$cache_dir = $upload_dir['basedir'] . '/1970/01';
|
177 |
+
$cache_dir2 = $upload_dir['basedir'] . '/1970';
|
178 |
+
shariff_removeoldfiles( $cache_dir );
|
179 |
+
// Remove /1970/01 and /1970 if they are empty.
|
180 |
+
// @codingStandardsIgnoreStart
|
181 |
+
@rmdir( $cache_dir );
|
182 |
+
@rmdir( $cache_dir2 );
|
183 |
+
// @codingStandardsIgnoreEnd
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Helper function to delete old .dat files that begin with 'Shariff' and empty folders that also start with 'Shariff'.
|
188 |
+
*
|
189 |
+
* @param string $directory Path to Shariff cache directory.
|
190 |
+
*/
|
191 |
+
function shariff_removeoldfiles( $directory ) {
|
192 |
+
foreach ( glob( '{$directory}/Shariff* ' ) as $file ) {
|
193 |
+
if ( is_dir( $file ) ) {
|
194 |
+
shariff_removeoldfiles( $file );
|
195 |
+
} elseif ( substr( $file, -4 ) === '.dat' ) {
|
196 |
+
// @codingStandardsIgnoreStart
|
197 |
+
@unlink($file);
|
198 |
+
// @codingStandardsIgnoreEnd
|
199 |
+
}
|
200 |
+
}
|
201 |
+
// @codingStandardsIgnoreStart
|
202 |
+
@rmdir( $directory );
|
203 |
+
// @codingStandardsIgnoreEnd
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Migration < 4.0
|
208 |
+
*/
|
209 |
+
if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.0.0' ) ) {
|
210 |
+
|
211 |
+
// Set new option share counts, if statistic is enabled.
|
212 |
+
if ( isset( $GLOBALS['shariff3UU_statistic']['backend'] ) ) {
|
213 |
+
$GLOBALS['shariff3UU_statistic']['sharecounts'] = 1;
|
214 |
+
}
|
215 |
+
|
216 |
+
// Disable share counts if WP version < 4.4.
|
217 |
+
if ( version_compare( get_bloginfo( 'version' ), '4.4.0' ) < 1 ) {
|
218 |
+
unset( $GLOBALS['shariff3UU_statistic']['backend'] );
|
219 |
+
}
|
220 |
+
|
221 |
+
// Change button language to WordPress language, if it is set to auto and http_negotiate_language is not available (auto will not work without it).
|
222 |
+
if ( ! isset( $GLOBALS['shariff3UU_design']['lang'] ) && ! function_exists( 'http_negotiate_language' ) ) {
|
223 |
+
$GLOBALS['shariff3UU_design']['lang'] = substr( get_bloginfo( 'language' ), 0, 2 );
|
224 |
+
}
|
225 |
+
|
226 |
+
// Update version.
|
227 |
+
$GLOBALS['shariff3UU']['version'] = '4.0.0';
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Migration < 4.2
|
232 |
+
*/
|
233 |
+
if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.2.0' ) ) {
|
234 |
+
// Make sure we have the $wpdb class ready.
|
235 |
+
global $wpdb;
|
236 |
+
|
237 |
+
// Delete user meta entry shariff3UU_ignore_notice to display update message again after an update (check for multisite).
|
238 |
+
if ( is_multisite() ) {
|
239 |
+
$current_blog_id = get_current_blog_id();
|
240 |
+
// @codingStandardsIgnoreStart
|
241 |
+
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
|
242 |
+
// @codingStandardsIgnoreEnd
|
243 |
+
if ( $blogs ) {
|
244 |
+
foreach ( $blogs as $blog ) {
|
245 |
+
// Switch to each blog.
|
246 |
+
switch_to_blog( $blog['blog_id'] );
|
247 |
+
// Delete user meta entry shariff3UU_ignore_notice.
|
248 |
+
$users = get_users( 'role=administrator' );
|
249 |
+
foreach ( $users as $user ) {
|
250 |
+
// @codingStandardsIgnoreStart
|
251 |
+
if ( get_user_meta( $user->ID, 'shariff3UU_ignore_notice', true ) ) {
|
252 |
+
delete_user_meta( $user->ID, 'shariff3UU_ignore_notice' );
|
253 |
+
}
|
254 |
+
// @codingStandardsIgnoreEnd
|
255 |
+
}
|
256 |
+
// Switch back to main.
|
257 |
+
restore_current_blog();
|
258 |
+
}
|
259 |
+
}
|
260 |
+
} else {
|
261 |
+
// Delete user meta entry shariff3UU_ignore_notice.
|
262 |
+
$users = get_users( 'role=administrator' );
|
263 |
+
foreach ( $users as $user ) {
|
264 |
+
// @codingStandardsIgnoreStart
|
265 |
+
if ( get_user_meta( $user->ID, 'shariff3UU_ignore_notice', true ) ) {
|
266 |
+
delete_user_meta( $user->ID, 'shariff3UU_ignore_notice' );
|
267 |
+
}
|
268 |
+
// @codingStandardsIgnoreEnd
|
269 |
+
}
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Migration < 4.4
|
275 |
+
*/
|
276 |
+
if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.4.0' ) ) {
|
277 |
+
// Remove hide update notice setting.
|
278 |
+
delete_option( 'shariff3UU_hide_update_notice' );
|
279 |
+
// Create new options.
|
280 |
+
$GLOBALS['shariff3uu_basic'] = (array) get_option( 'shariff3UU_basic' );
|
281 |
+
$GLOBALS['shariff3uu_design'] = (array) get_option( 'shariff3UU_design' );
|
282 |
+
$GLOBALS['shariff3uu_advanced'] = (array) get_option( 'shariff3UU_advanced' );
|
283 |
+
$GLOBALS['shariff3uu_statistic'] = (array) get_option( 'shariff3UU_statistic' );
|
284 |
+
// Delete old options.
|
285 |
+
delete_option( 'shariff3UU_basic' );
|
286 |
+
delete_option( 'shariff3UU_design' );
|
287 |
+
delete_option( 'shariff3UU_advanced' );
|
288 |
+
delete_option( 'shariff3UU_mailform' );
|
289 |
+
delete_option( 'shariff3UU_statistic' );
|
290 |
+
// Update version.
|
291 |
+
$GLOBALS['shariff3UU']['version'] = '4.4.0';
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* General tasks we do on every update, like clean up transients and so on.
|
296 |
+
*/
|
297 |
+
|
298 |
+
// Purge transients (check for multisite).
|
299 |
+
if ( is_multisite() ) {
|
300 |
+
global $wpdb;
|
301 |
+
$current_blog_id = get_current_blog_id();
|
302 |
+
// @codingStandardsIgnoreStart
|
303 |
+
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
|
304 |
+
// @codingStandardsIgnoreEnd
|
305 |
+
if ( $blogs ) {
|
306 |
+
foreach ( $blogs as $blog ) {
|
307 |
+
// Switch to each blog.
|
308 |
+
switch_to_blog( $blog['blog_id'] );
|
309 |
+
// Purge transients.
|
310 |
+
shariff3uu_purge_transients();
|
311 |
+
// Switch back to main.
|
312 |
+
restore_current_blog();
|
313 |
+
}
|
314 |
+
}
|
315 |
+
} else {
|
316 |
+
// Purge transients.
|
317 |
+
shariff3uu_purge_transients();
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Helper function to purge all the transients associated with our plugin.
|
322 |
+
*/
|
323 |
+
function shariff3uu_purge_transients() {
|
324 |
+
// Make sure we have the $wpdb class ready.
|
325 |
+
if ( ! isset( $wpdb ) ) {
|
326 |
+
global $wpdb;
|
327 |
+
}
|
328 |
+
|
329 |
+
// Delete transients.
|
330 |
+
// @codingStandardsIgnoreStart
|
331 |
+
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_timeout_shariff%"';
|
332 |
+
$wpdb->query($sql);
|
333 |
+
$sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_shariff%"';
|
334 |
+
$wpdb->query($sql);
|
335 |
+
// @codingStandardsIgnoreEnd
|
336 |
+
|
337 |
+
// Clear object cache.
|
338 |
+
wp_cache_flush();
|
339 |
+
}
|
340 |
+
|
341 |
+
// Remove Shariff cron job and add it again, if wanted.
|
342 |
+
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
|
343 |
+
do_action( 'shariff3uu_save_statistic_options' );
|
344 |
+
|
345 |
+
// Set new version.
|
346 |
+
$GLOBALS['shariff3uu']['version'] = $code_version;
|
347 |
+
$GLOBALS['shariff3uu_basic']['version'] = $code_version;
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Remove empty elements and save to options table.
|
351 |
+
*/
|
352 |
+
// Basic.
|
353 |
+
$shariff3uu_basic = array_filter( $GLOBALS['shariff3uu_basic'] );
|
354 |
+
update_option( 'shariff3uu_basic', $shariff3uu_basic );
|
355 |
+
// Design.
|
356 |
+
$shariff3uu_design = array_filter( $GLOBALS['shariff3uu_design'] );
|
357 |
+
update_option( 'shariff3uu_design', $shariff3uu_design );
|
358 |
+
// Advanced.
|
359 |
+
$shariff3uu_advanced = array_filter( $GLOBALS['shariff3uu_advanced'] );
|
360 |
+
update_option( 'shariff3uu_advanced', $shariff3uu_advanced );
|
361 |
+
// Statistic.
|
362 |
+
$shariff3uu_statistic = array_filter( $GLOBALS['shariff3uu_statistic'] );
|
363 |
+
update_option( 'shariff3uu_statistic', $shariff3uu_statistic );
|