Version Description
- new high contrast theme (WCAG)
- improved support for WPML for easier translation of headlines and info button texts
- updated WhatsApp share link to support WhatsApp Web (thanks to Oliver, @oliverpw)
- updated Spanish translations (thanks to Torsten, @torstenbulk)
- updated Pinterest Share Count API
- updated VK Share Count API
- updated Pocket API
- updated XING API
- removed GooglePlus due to Google shutting GooglePlus down
- fixed a PHP notice in regards to Tumblr (thanks to Mario, @mariobartlack)
- fixed a conflict with another plugin (thanks to David, @daveshine)
- tested with WordPress 5.1
Download this release
Release Info
Developer | starguide |
Plugin | Shariff Wrapper |
Version | 4.6.0 |
Comparing to | |
See all releases |
Code changes from version 4.5.3 to 4.6.0
- admin/admin-menu.php +106 -139
- changelog.txt +14 -0
- css/shariff.css +15 -0
- css/shariff.min.css +1 -1
- images/borderradius.png +0 -0
- images/colorBtns.png +0 -0
- images/defaultBtns.png +0 -0
- images/defaultHint.png +0 -0
- images/greyBtns.png +0 -0
- images/roundBtns.png +0 -0
- images/shariff_designs.png +0 -0
- images/whiteBtns.png +0 -0
- readme.txt +17 -3
- services/shariff-addthis.php +1 -0
- services/shariff-bitcoin.php +1 -0
- services/shariff-diaspora.php +1 -0
- services/shariff-facebook.php +1 -0
- services/shariff-flattr.php +1 -0
- services/shariff-flipboard.php +1 -0
- services/shariff-googleplus.php +0 -59
- services/shariff-info.php +7 -0
- services/shariff-linkedin.php +1 -0
- services/shariff-mailto.php +5 -4
- services/shariff-odnoklassniki.php +1 -0
- services/shariff-patreon.php +1 -0
- services/shariff-paypal.php +1 -0
- services/shariff-paypalme.php +1 -0
- services/shariff-pinterest.php +4 -2
- services/shariff-pocket.php +26 -2
- services/shariff-printer.php +1 -0
- services/shariff-qzone.php +1 -0
- services/shariff-reddit.php +1 -0
- services/shariff-rss.php +1 -0
- services/shariff-sms.php +1 -0
- services/shariff-stumbleupon.php +1 -0
- services/shariff-telegram.php +1 -0
- services/shariff-tencentweibo.php +1 -0
- services/shariff-threema.php +1 -0
- services/shariff-tumblr.php +3 -2
- services/shariff-twitter.php +1 -0
- services/shariff-vk.php +2 -1
- services/shariff-wallabag.php +1 -0
- services/shariff-weibo.php +1 -0
- services/shariff-whatsapp.php +3 -2
- services/shariff-xing.php +3 -2
- shariff.php +1609 -1592
- wpml-config.xml +12 -0
admin/admin-menu.php
CHANGED
@@ -12,7 +12,7 @@ if ( ! class_exists( 'WP' ) ) {
|
|
12 |
}
|
13 |
|
14 |
// Set services that have a share count API / backend.
|
15 |
-
$shariff3uu_services_backend = array( 'facebook', 'twitter', 'pinterest', '
|
16 |
|
17 |
|
18 |
// Adds the actions for the admin page.
|
@@ -55,25 +55,25 @@ function shariff3uu_options_init() {
|
|
55 |
/** First tab - basic */
|
56 |
|
57 |
// Registers first tab (basic) settings and calls sanitize function.
|
58 |
-
register_setting( '
|
59 |
|
60 |
// First tab - basic options.
|
61 |
add_settings_section(
|
62 |
'shariff3uu_basic_section',
|
63 |
__( 'Basic options', 'shariff' ),
|
64 |
'shariff3uu_basic_section_callback',
|
65 |
-
'
|
66 |
);
|
67 |
|
68 |
// Services.
|
69 |
-
add_settings_field( 'shariff3uu_text_services', '<div style="width:450px">' . __( 'Enable the following services in the provided order:', 'shariff' ) . '</div>', 'shariff3uu_text_services_render', '
|
70 |
|
71 |
// Add after.
|
72 |
add_settings_field(
|
73 |
'shariff3uu_multiplecheckbox_add_after',
|
74 |
__( 'Add the Shariff buttons <u>after</u> all:', 'shariff' ),
|
75 |
'shariff3uu_multiplecheckbox_add_after_render',
|
76 |
-
'
|
77 |
'shariff3uu_basic_section'
|
78 |
);
|
79 |
|
@@ -82,7 +82,7 @@ function shariff3uu_options_init() {
|
|
82 |
'shariff3uu_checkbox_add_before',
|
83 |
__( 'Add the Shariff buttons <u>before</u> all:', 'shariff' ),
|
84 |
'shariff3uu_multiplecheckbox_add_before_render',
|
85 |
-
'
|
86 |
'shariff3uu_basic_section'
|
87 |
);
|
88 |
|
@@ -91,7 +91,7 @@ function shariff3uu_options_init() {
|
|
91 |
'shariff3uu_checkbox_disable_on_protected',
|
92 |
__( 'Disable the Shariff buttons on password protected posts.', 'shariff' ),
|
93 |
'shariff3uu_checkbox_disable_on_protected_render',
|
94 |
-
'
|
95 |
'shariff3uu_basic_section'
|
96 |
);
|
97 |
|
@@ -100,30 +100,30 @@ function shariff3uu_options_init() {
|
|
100 |
'shariff3uu_checkbox_disable_outside_loop',
|
101 |
__( 'Disable the Shariff buttons outside of the main loop.', 'shariff' ),
|
102 |
'shariff3uu_checkbox_disable_outside_loop_render',
|
103 |
-
'
|
104 |
'shariff3uu_basic_section'
|
105 |
);
|
106 |
|
107 |
// Add to custom WordPress hooks.
|
108 |
-
add_settings_field( 'shariff3uu_text_custom_hooks', __( 'Add Shariff to the following custom WordPress hooks:', 'shariff' ), 'shariff3uu_text_custom_hooks_render', '
|
109 |
|
110 |
// Shortcode to use for custom hook.
|
111 |
-
add_settings_field( 'shariff3uu_text_custom_hooks_shortcode', __( 'Use the following shortcode for the custom hooks:', 'shariff' ), 'shariff3uu_text_custom_hooks_shortcode_render', '
|
112 |
|
113 |
/** Second tab - design */
|
114 |
|
115 |
// Registers second tab (design) settings and calls sanitize function.
|
116 |
-
register_setting( '
|
117 |
|
118 |
// Second tab - design options.
|
119 |
-
add_settings_section( 'shariff3uu_design_section', __( 'Design options', 'shariff' ), 'shariff3uu_design_section_callback', '
|
120 |
|
121 |
// Button language.
|
122 |
add_settings_field(
|
123 |
'shariff3uu_select_language',
|
124 |
'<div style="width:450px">' . esc_html__( 'Default button language:', 'shariff' ) . '</div>',
|
125 |
'shariff3uu_select_language_render',
|
126 |
-
'
|
127 |
'shariff3uu_design_section'
|
128 |
);
|
129 |
|
@@ -132,7 +132,7 @@ function shariff3uu_options_init() {
|
|
132 |
'shariff3uu_checkbox_autolang',
|
133 |
__( 'Automatically set button language based on locale (e.g. set by WPML).', 'shariff' ),
|
134 |
'shariff3uu_checkbox_autolang_render',
|
135 |
-
'
|
136 |
'shariff3uu_design_section'
|
137 |
);
|
138 |
|
@@ -141,7 +141,7 @@ function shariff3uu_options_init() {
|
|
141 |
'shariff3uu_radio_theme',
|
142 |
__( 'Shariff button design:', 'shariff' ),
|
143 |
'shariff3uu_radio_theme_render',
|
144 |
-
'
|
145 |
'shariff3uu_design_section'
|
146 |
);
|
147 |
|
@@ -150,7 +150,7 @@ function shariff3uu_options_init() {
|
|
150 |
'shariff3uu_checkbox_buttonsize',
|
151 |
__( 'Button size:', 'shariff' ),
|
152 |
'shariff3uu_checkbox_buttonsize_render',
|
153 |
-
'
|
154 |
'shariff3uu_design_section'
|
155 |
);
|
156 |
|
@@ -159,7 +159,7 @@ function shariff3uu_options_init() {
|
|
159 |
'shariff3uu_checkbox_buttonsstretch',
|
160 |
__( 'Stretch buttons horizontally to full width.', 'shariff' ),
|
161 |
'shariff3uu_checkbox_buttonstretch_render',
|
162 |
-
'
|
163 |
'shariff3uu_design_section'
|
164 |
);
|
165 |
|
@@ -168,7 +168,7 @@ function shariff3uu_options_init() {
|
|
168 |
'shariff3uu_number_borderradius',
|
169 |
__( 'Border radius for the round theme (1-50):', 'shariff' ),
|
170 |
'shariff3uu_number_borderradius_render',
|
171 |
-
'
|
172 |
'shariff3uu_design_section'
|
173 |
);
|
174 |
|
@@ -177,7 +177,7 @@ function shariff3uu_options_init() {
|
|
177 |
'shariff3uu_text_maincolor',
|
178 |
__( 'Custom main color for <b>all</b> buttons (hexadecimal):', 'shariff' ),
|
179 |
'shariff3uu_text_maincolor_render',
|
180 |
-
'
|
181 |
'shariff3uu_design_section'
|
182 |
);
|
183 |
|
@@ -186,7 +186,7 @@ function shariff3uu_options_init() {
|
|
186 |
'shariff3uu_text_secondarycolor',
|
187 |
__( 'Custom secondary color for <b>all</b> buttons (hexadecimal):', 'shariff' ),
|
188 |
'shariff3uu_text_secondarycolor_render',
|
189 |
-
'
|
190 |
'shariff3uu_design_section'
|
191 |
);
|
192 |
|
@@ -195,7 +195,7 @@ function shariff3uu_options_init() {
|
|
195 |
'shariff3uu_checkbox_vertical',
|
196 |
__( 'Shariff button orientation <b>vertical</b>.', 'shariff' ),
|
197 |
'shariff3uu_checkbox_vertical_render',
|
198 |
-
'
|
199 |
'shariff3uu_design_section'
|
200 |
);
|
201 |
|
@@ -204,7 +204,7 @@ function shariff3uu_options_init() {
|
|
204 |
'shariff3uu_radio_align',
|
205 |
__( 'Alignment of the Shariff buttons:', 'shariff' ),
|
206 |
'shariff3uu_radio_align_render',
|
207 |
-
'
|
208 |
'shariff3uu_design_section'
|
209 |
);
|
210 |
|
@@ -213,7 +213,7 @@ function shariff3uu_options_init() {
|
|
213 |
'shariff3uu_radio_align_widget',
|
214 |
__( 'Alignment of the Shariff buttons in the widget:', 'shariff' ),
|
215 |
'shariff3uu_radio_align_widget_render',
|
216 |
-
'
|
217 |
'shariff3uu_design_section'
|
218 |
);
|
219 |
|
@@ -222,7 +222,7 @@ function shariff3uu_options_init() {
|
|
222 |
'shariff3uu_text_headline',
|
223 |
__( 'Headline above all Shariff buttons:', 'shariff' ),
|
224 |
'shariff3uu_text_headline_render',
|
225 |
-
'
|
226 |
'shariff3uu_design_section'
|
227 |
);
|
228 |
|
@@ -231,7 +231,7 @@ function shariff3uu_options_init() {
|
|
231 |
'shariff3uu_text_headline_zero',
|
232 |
__( 'Alternative headline, if share counts are zero:', 'shariff' ),
|
233 |
'shariff3uu_text_headline_zero_render',
|
234 |
-
'
|
235 |
'shariff3uu_design_section'
|
236 |
);
|
237 |
|
@@ -240,7 +240,7 @@ function shariff3uu_options_init() {
|
|
240 |
'shariff3uu_text_style',
|
241 |
__( 'Custom CSS <u>attributes</u> for the container <u>around</u> Shariff:', 'shariff' ),
|
242 |
'shariff3uu_text_style_render',
|
243 |
-
'
|
244 |
'shariff3uu_design_section'
|
245 |
);
|
246 |
|
@@ -249,7 +249,7 @@ function shariff3uu_options_init() {
|
|
249 |
'shariff3uu_text_cssclass',
|
250 |
__( 'Custom CSS <u>class</u> for the container <u>around</u> Shariff:', 'shariff' ),
|
251 |
'shariff3uu_text_cssclass_render',
|
252 |
-
'
|
253 |
'shariff3uu_design_section'
|
254 |
);
|
255 |
|
@@ -258,7 +258,7 @@ function shariff3uu_options_init() {
|
|
258 |
'shariff3uu_checkbox_hideuntilcss',
|
259 |
__( 'Hide buttons until page is fully loaded.', 'shariff' ),
|
260 |
'shariff3uu_checkbox_hideuntilcss_render',
|
261 |
-
'
|
262 |
'shariff3uu_design_section'
|
263 |
);
|
264 |
|
@@ -267,21 +267,21 @@ function shariff3uu_options_init() {
|
|
267 |
'shariff3uu_checkbox_popup',
|
268 |
__( 'Open links in a popup (requires JavaScript).', 'shariff' ),
|
269 |
'shariff3uu_checkbox_popup_render',
|
270 |
-
'
|
271 |
'shariff3uu_design_section'
|
272 |
);
|
273 |
|
274 |
/** Third tab - advanced */
|
275 |
|
276 |
// Registers third tab (advanced) settings and calls sanitize function.
|
277 |
-
register_setting( '
|
278 |
|
279 |
// Third tab - advanced options.
|
280 |
add_settings_section(
|
281 |
'shariff3uu_advanced_section',
|
282 |
__( 'Advanced options', 'shariff' ),
|
283 |
'shariff3uu_advanced_section_callback',
|
284 |
-
'
|
285 |
);
|
286 |
|
287 |
// Info url.
|
@@ -289,7 +289,7 @@ function shariff3uu_options_init() {
|
|
289 |
'shariff3uu_text_info_url',
|
290 |
'<div style="width:450px">' . __( 'Custom link for the info button:', 'shariff' ) . '</div>',
|
291 |
'shariff3uu_text_info_url_render',
|
292 |
-
'
|
293 |
'shariff3uu_advanced_section'
|
294 |
);
|
295 |
|
@@ -298,7 +298,7 @@ function shariff3uu_options_init() {
|
|
298 |
'shariff3uu_text_info_text',
|
299 |
__( 'Custom text for the info button:', 'shariff' ),
|
300 |
'shariff3uu_text_info_text_render',
|
301 |
-
'
|
302 |
'shariff3uu_advanced_section'
|
303 |
);
|
304 |
|
@@ -307,7 +307,7 @@ function shariff3uu_options_init() {
|
|
307 |
'shariff3uu_text_twittervia',
|
308 |
__( 'Twitter username for the via tag:', 'shariff' ),
|
309 |
'shariff3uu_text_twittervia_render',
|
310 |
-
'
|
311 |
'shariff3uu_advanced_section'
|
312 |
);
|
313 |
|
@@ -316,7 +316,7 @@ function shariff3uu_options_init() {
|
|
316 |
'shariff3uu_text_flattruser',
|
317 |
__( 'Flattr username:', 'shariff' ),
|
318 |
'shariff3uu_text_flattruser_render',
|
319 |
-
'
|
320 |
'shariff3uu_advanced_section'
|
321 |
);
|
322 |
|
@@ -325,7 +325,7 @@ function shariff3uu_options_init() {
|
|
325 |
'shariff3uu_text_patreonid',
|
326 |
__( 'Patreon username:', 'shariff' ),
|
327 |
'shariff3uu_text_patreonid_render',
|
328 |
-
'
|
329 |
'shariff3uu_advanced_section'
|
330 |
);
|
331 |
|
@@ -334,7 +334,7 @@ function shariff3uu_options_init() {
|
|
334 |
'shariff3uu_text_paypalbuttonid',
|
335 |
__( 'PayPal hosted button ID:', 'shariff' ),
|
336 |
'shariff3uu_text_paypalbuttonid_render',
|
337 |
-
'
|
338 |
'shariff3uu_advanced_section'
|
339 |
);
|
340 |
|
@@ -343,7 +343,7 @@ function shariff3uu_options_init() {
|
|
343 |
'shariff3uu_text_paypalmeid',
|
344 |
__( 'PayPal.Me ID:', 'shariff' ),
|
345 |
'shariff3uu_text_paypalmeid_render',
|
346 |
-
'
|
347 |
'shariff3uu_advanced_section'
|
348 |
);
|
349 |
|
@@ -352,7 +352,7 @@ function shariff3uu_options_init() {
|
|
352 |
'shariff3uu_text_bitcoinaddress',
|
353 |
__( 'Bitcoin address:', 'shariff' ),
|
354 |
'shariff3uu_text_bitcoinaddress_render',
|
355 |
-
'
|
356 |
'shariff3uu_advanced_section'
|
357 |
);
|
358 |
|
@@ -361,7 +361,7 @@ function shariff3uu_options_init() {
|
|
361 |
'shariff3uu_text_rssfeed',
|
362 |
__( 'RSS feed:', 'shariff' ),
|
363 |
'shariff3uu_text_rssfeed_render',
|
364 |
-
'
|
365 |
'shariff3uu_advanced_section'
|
366 |
);
|
367 |
|
@@ -370,7 +370,7 @@ function shariff3uu_options_init() {
|
|
370 |
'shariff3uu_text_default_pinterest',
|
371 |
__( 'Default image for Pinterest:', 'shariff' ),
|
372 |
'shariff3uu_text_default_pinterest_render',
|
373 |
-
'
|
374 |
'shariff3uu_advanced_section'
|
375 |
);
|
376 |
|
@@ -379,7 +379,7 @@ function shariff3uu_options_init() {
|
|
379 |
'shariff3uu_number_shortcodeprio',
|
380 |
__( 'Shortcode priority:', 'shariff' ),
|
381 |
'shariff3uu_number_shortcodeprio_render',
|
382 |
-
'
|
383 |
'shariff3uu_advanced_section'
|
384 |
);
|
385 |
|
@@ -388,21 +388,21 @@ function shariff3uu_options_init() {
|
|
388 |
'shariff3uu_checkbox_disable_metabox',
|
389 |
__( 'Disable the metabox.', 'shariff' ),
|
390 |
'shariff3uu_checkbox_disable_metabox_render',
|
391 |
-
'
|
392 |
'shariff3uu_advanced_section'
|
393 |
);
|
394 |
|
395 |
/** Fifth tab - statistic */
|
396 |
|
397 |
// Registers fifth tab (statistic) settings and calls sanitize function.
|
398 |
-
register_setting( '
|
399 |
|
400 |
// Fifth tab (statistic).
|
401 |
add_settings_section(
|
402 |
'shariff3uu_statistic_section',
|
403 |
__( 'Statistic', 'shariff' ),
|
404 |
'shariff3uu_statistic_section_callback',
|
405 |
-
'
|
406 |
);
|
407 |
|
408 |
// Statistic.
|
@@ -410,7 +410,7 @@ function shariff3uu_options_init() {
|
|
410 |
'shariff3uu_checkbox_backend',
|
411 |
'<div style="width:450px">' . __( 'Enable statistic.', 'shariff' ) . '</div>',
|
412 |
'shariff3uu_checkbox_backend_render',
|
413 |
-
'
|
414 |
'shariff3uu_statistic_section'
|
415 |
);
|
416 |
|
@@ -419,7 +419,7 @@ function shariff3uu_options_init() {
|
|
419 |
'shariff3uu_checkbox_sharecounts',
|
420 |
__( 'Show share counts on buttons.', 'shariff' ),
|
421 |
'shariff3uu_checkbox_sharecounts_render',
|
422 |
-
'
|
423 |
'shariff3uu_statistic_section'
|
424 |
);
|
425 |
|
@@ -428,7 +428,7 @@ function shariff3uu_options_init() {
|
|
428 |
'shariff3uu_checkbox_hidezero',
|
429 |
__( 'Hide share counts when they are zero.', 'shariff' ),
|
430 |
'shariff3uu_checkbox_hidezero_render',
|
431 |
-
'
|
432 |
'shariff3uu_statistic_section'
|
433 |
);
|
434 |
|
@@ -437,7 +437,7 @@ function shariff3uu_options_init() {
|
|
437 |
'shariff3uu_text_fb_id',
|
438 |
__( 'Facebook App ID:', 'shariff' ),
|
439 |
'shariff3uu_text_fb_id_render',
|
440 |
-
'
|
441 |
'shariff3uu_statistic_section'
|
442 |
);
|
443 |
|
@@ -446,7 +446,7 @@ function shariff3uu_options_init() {
|
|
446 |
'shariff3uu_text_fb_secret',
|
447 |
__( 'Facebook App Secret:', 'shariff' ),
|
448 |
'shariff3uu_text_fb_secret_render',
|
449 |
-
'
|
450 |
'shariff3uu_statistic_section'
|
451 |
);
|
452 |
|
@@ -455,7 +455,7 @@ function shariff3uu_options_init() {
|
|
455 |
'shariff3uu_checkbox_automaticcache',
|
456 |
__( 'Fill cache automatically.', 'shariff' ),
|
457 |
'shariff3uu_checkbox_automaticcache_render',
|
458 |
-
'
|
459 |
'shariff3uu_statistic_section'
|
460 |
);
|
461 |
|
@@ -464,7 +464,7 @@ function shariff3uu_options_init() {
|
|
464 |
'shariff3uu_number_ranking',
|
465 |
__( 'Number of posts on ranking tab:', 'shariff' ),
|
466 |
'shariff3uu_number_ranking_render',
|
467 |
-
'
|
468 |
'shariff3uu_statistic_section'
|
469 |
);
|
470 |
|
@@ -473,7 +473,7 @@ function shariff3uu_options_init() {
|
|
473 |
'shariff3uu_number_ttl',
|
474 |
__( 'Cache TTL in seconds (60 - 7200):', 'shariff' ),
|
475 |
'shariff3uu_number_ttl_render',
|
476 |
-
'
|
477 |
'shariff3uu_statistic_section'
|
478 |
);
|
479 |
|
@@ -482,7 +482,7 @@ function shariff3uu_options_init() {
|
|
482 |
'shariff3uu_checkbox_disable_dynamic_cache',
|
483 |
__( 'Disable the dynamic cache lifespan (not recommended).', 'shariff' ),
|
484 |
'shariff3uu_checkbox_disable_dynamic_cache_render',
|
485 |
-
'
|
486 |
'shariff3uu_statistic_section'
|
487 |
);
|
488 |
|
@@ -491,7 +491,7 @@ function shariff3uu_options_init() {
|
|
491 |
'shariff3uu_multiplecheckbox_disable_services',
|
492 |
__( 'Disable the following services (share counts only):', 'shariff' ),
|
493 |
'shariff3uu_multiplecheckbox_disable_services_render',
|
494 |
-
'
|
495 |
'shariff3uu_statistic_section'
|
496 |
);
|
497 |
|
@@ -500,7 +500,7 @@ function shariff3uu_options_init() {
|
|
500 |
'shariff3uu_text_external_host',
|
501 |
__( 'External API for share counts:', 'shariff' ),
|
502 |
'shariff3uu_text_external_host_render',
|
503 |
-
'
|
504 |
'shariff3uu_statistic_section'
|
505 |
);
|
506 |
|
@@ -509,7 +509,7 @@ function shariff3uu_options_init() {
|
|
509 |
'shariff3uu_checkbox_external_direct',
|
510 |
__( 'Request external API directly.', 'shariff' ),
|
511 |
'shariff3uu_checkbox_external_direct_render',
|
512 |
-
'
|
513 |
'shariff3uu_statistic_section'
|
514 |
);
|
515 |
|
@@ -518,7 +518,7 @@ function shariff3uu_options_init() {
|
|
518 |
'shariff3uu_checkbox_subapi',
|
519 |
__( 'Local API not reachable in root.', 'shariff' ),
|
520 |
'shariff3uu_checkbox_subapi_render',
|
521 |
-
'
|
522 |
'shariff3uu_statistic_section'
|
523 |
);
|
524 |
|
@@ -529,7 +529,7 @@ function shariff3uu_options_init() {
|
|
529 |
'shariff3uu_help_section',
|
530 |
__( 'Shariff Help', 'shariff' ),
|
531 |
'shariff3uu_help_section_callback',
|
532 |
-
'
|
533 |
);
|
534 |
|
535 |
/** Seventh tab - status */
|
@@ -539,7 +539,7 @@ function shariff3uu_options_init() {
|
|
539 |
'shariff3uu_status_section',
|
540 |
__( 'Status', 'shariff' ),
|
541 |
'shariff3uu_status_section_callback',
|
542 |
-
'
|
543 |
);
|
544 |
|
545 |
/** Eight tab - ranking */
|
@@ -549,7 +549,7 @@ function shariff3uu_options_init() {
|
|
549 |
'shariff3uu_ranking_section',
|
550 |
__( 'Ranking', 'shariff' ),
|
551 |
'shariff3uu_ranking_section_callback',
|
552 |
-
'
|
553 |
);
|
554 |
}
|
555 |
|
@@ -1060,47 +1060,14 @@ function shariff3uu_radio_theme_render() {
|
|
1060 |
$options['theme'] = '';
|
1061 |
}
|
1062 |
$plugins_url = plugins_url();
|
1063 |
-
echo '<div style="display:
|
1064 |
-
<div
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
</div>
|
1072 |
-
<div style="display:table-row">
|
1073 |
-
<div style="display:table-cell;vertical-align:middle;min-width:75px">
|
1074 |
-
<input type="radio" name="shariff3uu_design[theme]" value="color" ' . checked( $options['theme'], 'color', 0 ) . '>color
|
1075 |
-
</div>
|
1076 |
-
<div class="shariff_options-cell">
|
1077 |
-
<img alt="color" src="' . esc_url( $plugins_url ) . '/shariff/images/colorBtns.png">
|
1078 |
-
</div>
|
1079 |
-
</div>
|
1080 |
-
<div style="display:table-row">
|
1081 |
-
<div style="display:table-cell;vertical-align:middle;min-width:75px">
|
1082 |
-
<input type="radio" name="shariff3uu_design[theme]" value="grey" ' . checked( $options['theme'], 'grey', 0 ) . '>grey
|
1083 |
-
</div>
|
1084 |
-
<div class="shariff_options-cell">
|
1085 |
-
<img alt="grey" src="' . esc_url( $plugins_url ) . '/shariff/images/greyBtns.png">
|
1086 |
-
</div>
|
1087 |
-
</div>
|
1088 |
-
<div style="display:table-row">
|
1089 |
-
<div style="display:table-cell;vertical-align:middle;min-width:75px">
|
1090 |
-
<input type="radio" name="shariff3uu_design[theme]" value="white" ' . checked( $options['theme'], 'white', 0 ) . '>white
|
1091 |
-
</div>
|
1092 |
-
<div class="shariff_options-cell">
|
1093 |
-
<img alt="white" src="' . esc_url( $plugins_url ) . '/shariff/images/whiteBtns.png">
|
1094 |
-
</div>
|
1095 |
-
</div>
|
1096 |
-
<div style="display:table-row">
|
1097 |
-
<div style="display:table-cell;vertical-align:middle;min-width:75px">
|
1098 |
-
<input type="radio" name="shariff3uu_design[theme]" value="round" ' . checked( $options['theme'], 'round', 0 ) . '>round
|
1099 |
-
</div>
|
1100 |
-
<div class="shariff_options-cell">
|
1101 |
-
<img alt="round" src="' . esc_url( $plugins_url ) . '/shariff/images/roundBtns.png">
|
1102 |
-
</div>
|
1103 |
-
</div>
|
1104 |
</div>';
|
1105 |
}
|
1106 |
|
@@ -1759,7 +1726,7 @@ function shariff3uu_help_section_callback() {
|
|
1759 |
// Theme.
|
1760 |
echo '<div style="display:table-row">';
|
1761 |
echo '<div style="display:table-cell;border:1px solid;padding:10px">theme</div>';
|
1762 |
-
echo '<div style="display:table-cell;border:1px solid;padding:10px">default<br>color<br>grey<br>white<br>round</div>';
|
1763 |
echo '<div style="display:table-cell;border:1px solid;padding:10px">default</div>';
|
1764 |
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff theme="round"]</div>';
|
1765 |
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Determines the main design of the buttons.', 'shariff' ) . '</div>';
|
@@ -2460,81 +2427,81 @@ function shariff3uu_options_page() {
|
|
2460 |
// phpcs:ignore
|
2461 |
$active_tab = $_GET['tab'];
|
2462 |
} else {
|
2463 |
-
$active_tab = '
|
2464 |
}
|
2465 |
|
2466 |
// Tabs.
|
2467 |
echo '<h2 class="nav-tab-wrapper">';
|
2468 |
// Basic.
|
2469 |
-
echo '<a href="?page=shariff3uu&tab=
|
2470 |
-
if ( '
|
2471 |
echo 'nav-tab-active';
|
2472 |
}
|
2473 |
echo '">' . esc_html__( 'Basic', 'shariff' ) . '</a>';
|
2474 |
// Design.
|
2475 |
-
echo '<a href="?page=shariff3uu&tab=
|
2476 |
-
if ( '
|
2477 |
echo 'nav-tab-active';
|
2478 |
}
|
2479 |
echo '">' . esc_html__( 'Design', 'shariff' ) . '</a>';
|
2480 |
// Advanced.
|
2481 |
-
echo '<a href="?page=shariff3uu&tab=
|
2482 |
-
if ( '
|
2483 |
echo 'nav-tab-active';
|
2484 |
}
|
2485 |
echo '">' . esc_html__( 'Advanced', 'shariff' ) . '</a>';
|
2486 |
// Statistic.
|
2487 |
-
echo '<a href="?page=shariff3uu&tab=
|
2488 |
-
if ( '
|
2489 |
echo 'nav-tab-active';
|
2490 |
}
|
2491 |
echo '">' . esc_html__( 'Statistic', 'shariff' ) . '</a>';
|
2492 |
// Help.
|
2493 |
-
echo '<a href="?page=shariff3uu&tab=
|
2494 |
-
if ( '
|
2495 |
echo 'nav-tab-active';
|
2496 |
}
|
2497 |
echo '">' . esc_html__( 'Help', 'shariff' ) . '</a>';
|
2498 |
// Status.
|
2499 |
-
echo '<a href="?page=shariff3uu&tab=
|
2500 |
-
if ( '
|
2501 |
echo 'nav-tab-active';
|
2502 |
}
|
2503 |
echo '">' . esc_html__( 'Status', 'shariff' ) . '</a>';
|
2504 |
// Ranking.
|
2505 |
-
echo '<a href="?page=shariff3uu&tab=
|
2506 |
-
if ( '
|
2507 |
echo 'nav-tab-active';
|
2508 |
}
|
2509 |
echo '">' . esc_html__( 'Ranking', 'shariff' ) . '</a>';
|
2510 |
echo '</h2>';
|
2511 |
|
2512 |
// Content of tabs.
|
2513 |
-
if ( '
|
2514 |
-
settings_fields( '
|
2515 |
-
do_settings_sections( '
|
2516 |
submit_button();
|
2517 |
-
} elseif ( '
|
2518 |
-
settings_fields( '
|
2519 |
-
do_settings_sections( '
|
2520 |
submit_button();
|
2521 |
-
} elseif ( '
|
2522 |
-
settings_fields( '
|
2523 |
-
do_settings_sections( '
|
2524 |
submit_button();
|
2525 |
-
} elseif ( '
|
2526 |
-
settings_fields( '
|
2527 |
-
do_settings_sections( '
|
2528 |
submit_button();
|
2529 |
-
} elseif ( '
|
2530 |
-
settings_fields( '
|
2531 |
-
do_settings_sections( '
|
2532 |
-
} elseif ( '
|
2533 |
-
settings_fields( '
|
2534 |
-
do_settings_sections( '
|
2535 |
-
} elseif ( '
|
2536 |
-
settings_fields( '
|
2537 |
-
do_settings_sections( '
|
2538 |
}
|
2539 |
|
2540 |
// End of form.
|
12 |
}
|
13 |
|
14 |
// Set services that have a share count API / backend.
|
15 |
+
$shariff3uu_services_backend = array( 'facebook', 'twitter', 'pinterest', 'xing', 'reddit', 'stumbleupon', 'tumblr', 'vk', 'addthis', 'flattr', 'odnoklassniki' );
|
16 |
|
17 |
|
18 |
// Adds the actions for the admin page.
|
55 |
/** First tab - basic */
|
56 |
|
57 |
// Registers first tab (basic) settings and calls sanitize function.
|
58 |
+
register_setting( 'shariff3uu_basic', 'shariff3uu_basic', 'shariff3uu_basic_sanitize' );
|
59 |
|
60 |
// First tab - basic options.
|
61 |
add_settings_section(
|
62 |
'shariff3uu_basic_section',
|
63 |
__( 'Basic options', 'shariff' ),
|
64 |
'shariff3uu_basic_section_callback',
|
65 |
+
'shariff3uu_basic'
|
66 |
);
|
67 |
|
68 |
// Services.
|
69 |
+
add_settings_field( 'shariff3uu_text_services', '<div style="width:450px">' . __( 'Enable the following services in the provided order:', 'shariff' ) . '</div>', 'shariff3uu_text_services_render', 'shariff3uu_basic', 'shariff3uu_basic_section' );
|
70 |
|
71 |
// Add after.
|
72 |
add_settings_field(
|
73 |
'shariff3uu_multiplecheckbox_add_after',
|
74 |
__( 'Add the Shariff buttons <u>after</u> all:', 'shariff' ),
|
75 |
'shariff3uu_multiplecheckbox_add_after_render',
|
76 |
+
'shariff3uu_basic',
|
77 |
'shariff3uu_basic_section'
|
78 |
);
|
79 |
|
82 |
'shariff3uu_checkbox_add_before',
|
83 |
__( 'Add the Shariff buttons <u>before</u> all:', 'shariff' ),
|
84 |
'shariff3uu_multiplecheckbox_add_before_render',
|
85 |
+
'shariff3uu_basic',
|
86 |
'shariff3uu_basic_section'
|
87 |
);
|
88 |
|
91 |
'shariff3uu_checkbox_disable_on_protected',
|
92 |
__( 'Disable the Shariff buttons on password protected posts.', 'shariff' ),
|
93 |
'shariff3uu_checkbox_disable_on_protected_render',
|
94 |
+
'shariff3uu_basic',
|
95 |
'shariff3uu_basic_section'
|
96 |
);
|
97 |
|
100 |
'shariff3uu_checkbox_disable_outside_loop',
|
101 |
__( 'Disable the Shariff buttons outside of the main loop.', 'shariff' ),
|
102 |
'shariff3uu_checkbox_disable_outside_loop_render',
|
103 |
+
'shariff3uu_basic',
|
104 |
'shariff3uu_basic_section'
|
105 |
);
|
106 |
|
107 |
// Add to custom WordPress hooks.
|
108 |
+
add_settings_field( 'shariff3uu_text_custom_hooks', __( 'Add Shariff to the following custom WordPress hooks:', 'shariff' ), 'shariff3uu_text_custom_hooks_render', 'shariff3uu_basic', 'shariff3uu_basic_section' );
|
109 |
|
110 |
// Shortcode to use for custom hook.
|
111 |
+
add_settings_field( 'shariff3uu_text_custom_hooks_shortcode', __( 'Use the following shortcode for the custom hooks:', 'shariff' ), 'shariff3uu_text_custom_hooks_shortcode_render', 'shariff3uu_basic', 'shariff3uu_basic_section' );
|
112 |
|
113 |
/** Second tab - design */
|
114 |
|
115 |
// Registers second tab (design) settings and calls sanitize function.
|
116 |
+
register_setting( 'shariff3uu_design', 'shariff3uu_design', 'shariff3uu_design_sanitize' );
|
117 |
|
118 |
// Second tab - design options.
|
119 |
+
add_settings_section( 'shariff3uu_design_section', __( 'Design options', 'shariff' ), 'shariff3uu_design_section_callback', 'shariff3uu_design' );
|
120 |
|
121 |
// Button language.
|
122 |
add_settings_field(
|
123 |
'shariff3uu_select_language',
|
124 |
'<div style="width:450px">' . esc_html__( 'Default button language:', 'shariff' ) . '</div>',
|
125 |
'shariff3uu_select_language_render',
|
126 |
+
'shariff3uu_design',
|
127 |
'shariff3uu_design_section'
|
128 |
);
|
129 |
|
132 |
'shariff3uu_checkbox_autolang',
|
133 |
__( 'Automatically set button language based on locale (e.g. set by WPML).', 'shariff' ),
|
134 |
'shariff3uu_checkbox_autolang_render',
|
135 |
+
'shariff3uu_design',
|
136 |
'shariff3uu_design_section'
|
137 |
);
|
138 |
|
141 |
'shariff3uu_radio_theme',
|
142 |
__( 'Shariff button design:', 'shariff' ),
|
143 |
'shariff3uu_radio_theme_render',
|
144 |
+
'shariff3uu_design',
|
145 |
'shariff3uu_design_section'
|
146 |
);
|
147 |
|
150 |
'shariff3uu_checkbox_buttonsize',
|
151 |
__( 'Button size:', 'shariff' ),
|
152 |
'shariff3uu_checkbox_buttonsize_render',
|
153 |
+
'shariff3uu_design',
|
154 |
'shariff3uu_design_section'
|
155 |
);
|
156 |
|
159 |
'shariff3uu_checkbox_buttonsstretch',
|
160 |
__( 'Stretch buttons horizontally to full width.', 'shariff' ),
|
161 |
'shariff3uu_checkbox_buttonstretch_render',
|
162 |
+
'shariff3uu_design',
|
163 |
'shariff3uu_design_section'
|
164 |
);
|
165 |
|
168 |
'shariff3uu_number_borderradius',
|
169 |
__( 'Border radius for the round theme (1-50):', 'shariff' ),
|
170 |
'shariff3uu_number_borderradius_render',
|
171 |
+
'shariff3uu_design',
|
172 |
'shariff3uu_design_section'
|
173 |
);
|
174 |
|
177 |
'shariff3uu_text_maincolor',
|
178 |
__( 'Custom main color for <b>all</b> buttons (hexadecimal):', 'shariff' ),
|
179 |
'shariff3uu_text_maincolor_render',
|
180 |
+
'shariff3uu_design',
|
181 |
'shariff3uu_design_section'
|
182 |
);
|
183 |
|
186 |
'shariff3uu_text_secondarycolor',
|
187 |
__( 'Custom secondary color for <b>all</b> buttons (hexadecimal):', 'shariff' ),
|
188 |
'shariff3uu_text_secondarycolor_render',
|
189 |
+
'shariff3uu_design',
|
190 |
'shariff3uu_design_section'
|
191 |
);
|
192 |
|
195 |
'shariff3uu_checkbox_vertical',
|
196 |
__( 'Shariff button orientation <b>vertical</b>.', 'shariff' ),
|
197 |
'shariff3uu_checkbox_vertical_render',
|
198 |
+
'shariff3uu_design',
|
199 |
'shariff3uu_design_section'
|
200 |
);
|
201 |
|
204 |
'shariff3uu_radio_align',
|
205 |
__( 'Alignment of the Shariff buttons:', 'shariff' ),
|
206 |
'shariff3uu_radio_align_render',
|
207 |
+
'shariff3uu_design',
|
208 |
'shariff3uu_design_section'
|
209 |
);
|
210 |
|
213 |
'shariff3uu_radio_align_widget',
|
214 |
__( 'Alignment of the Shariff buttons in the widget:', 'shariff' ),
|
215 |
'shariff3uu_radio_align_widget_render',
|
216 |
+
'shariff3uu_design',
|
217 |
'shariff3uu_design_section'
|
218 |
);
|
219 |
|
222 |
'shariff3uu_text_headline',
|
223 |
__( 'Headline above all Shariff buttons:', 'shariff' ),
|
224 |
'shariff3uu_text_headline_render',
|
225 |
+
'shariff3uu_design',
|
226 |
'shariff3uu_design_section'
|
227 |
);
|
228 |
|
231 |
'shariff3uu_text_headline_zero',
|
232 |
__( 'Alternative headline, if share counts are zero:', 'shariff' ),
|
233 |
'shariff3uu_text_headline_zero_render',
|
234 |
+
'shariff3uu_design',
|
235 |
'shariff3uu_design_section'
|
236 |
);
|
237 |
|
240 |
'shariff3uu_text_style',
|
241 |
__( 'Custom CSS <u>attributes</u> for the container <u>around</u> Shariff:', 'shariff' ),
|
242 |
'shariff3uu_text_style_render',
|
243 |
+
'shariff3uu_design',
|
244 |
'shariff3uu_design_section'
|
245 |
);
|
246 |
|
249 |
'shariff3uu_text_cssclass',
|
250 |
__( 'Custom CSS <u>class</u> for the container <u>around</u> Shariff:', 'shariff' ),
|
251 |
'shariff3uu_text_cssclass_render',
|
252 |
+
'shariff3uu_design',
|
253 |
'shariff3uu_design_section'
|
254 |
);
|
255 |
|
258 |
'shariff3uu_checkbox_hideuntilcss',
|
259 |
__( 'Hide buttons until page is fully loaded.', 'shariff' ),
|
260 |
'shariff3uu_checkbox_hideuntilcss_render',
|
261 |
+
'shariff3uu_design',
|
262 |
'shariff3uu_design_section'
|
263 |
);
|
264 |
|
267 |
'shariff3uu_checkbox_popup',
|
268 |
__( 'Open links in a popup (requires JavaScript).', 'shariff' ),
|
269 |
'shariff3uu_checkbox_popup_render',
|
270 |
+
'shariff3uu_design',
|
271 |
'shariff3uu_design_section'
|
272 |
);
|
273 |
|
274 |
/** Third tab - advanced */
|
275 |
|
276 |
// Registers third tab (advanced) settings and calls sanitize function.
|
277 |
+
register_setting( 'shariff3uu_advanced', 'shariff3uu_advanced', 'shariff3uu_advanced_sanitize' );
|
278 |
|
279 |
// Third tab - advanced options.
|
280 |
add_settings_section(
|
281 |
'shariff3uu_advanced_section',
|
282 |
__( 'Advanced options', 'shariff' ),
|
283 |
'shariff3uu_advanced_section_callback',
|
284 |
+
'shariff3uu_advanced'
|
285 |
);
|
286 |
|
287 |
// Info url.
|
289 |
'shariff3uu_text_info_url',
|
290 |
'<div style="width:450px">' . __( 'Custom link for the info button:', 'shariff' ) . '</div>',
|
291 |
'shariff3uu_text_info_url_render',
|
292 |
+
'shariff3uu_advanced',
|
293 |
'shariff3uu_advanced_section'
|
294 |
);
|
295 |
|
298 |
'shariff3uu_text_info_text',
|
299 |
__( 'Custom text for the info button:', 'shariff' ),
|
300 |
'shariff3uu_text_info_text_render',
|
301 |
+
'shariff3uu_advanced',
|
302 |
'shariff3uu_advanced_section'
|
303 |
);
|
304 |
|
307 |
'shariff3uu_text_twittervia',
|
308 |
__( 'Twitter username for the via tag:', 'shariff' ),
|
309 |
'shariff3uu_text_twittervia_render',
|
310 |
+
'shariff3uu_advanced',
|
311 |
'shariff3uu_advanced_section'
|
312 |
);
|
313 |
|
316 |
'shariff3uu_text_flattruser',
|
317 |
__( 'Flattr username:', 'shariff' ),
|
318 |
'shariff3uu_text_flattruser_render',
|
319 |
+
'shariff3uu_advanced',
|
320 |
'shariff3uu_advanced_section'
|
321 |
);
|
322 |
|
325 |
'shariff3uu_text_patreonid',
|
326 |
__( 'Patreon username:', 'shariff' ),
|
327 |
'shariff3uu_text_patreonid_render',
|
328 |
+
'shariff3uu_advanced',
|
329 |
'shariff3uu_advanced_section'
|
330 |
);
|
331 |
|
334 |
'shariff3uu_text_paypalbuttonid',
|
335 |
__( 'PayPal hosted button ID:', 'shariff' ),
|
336 |
'shariff3uu_text_paypalbuttonid_render',
|
337 |
+
'shariff3uu_advanced',
|
338 |
'shariff3uu_advanced_section'
|
339 |
);
|
340 |
|
343 |
'shariff3uu_text_paypalmeid',
|
344 |
__( 'PayPal.Me ID:', 'shariff' ),
|
345 |
'shariff3uu_text_paypalmeid_render',
|
346 |
+
'shariff3uu_advanced',
|
347 |
'shariff3uu_advanced_section'
|
348 |
);
|
349 |
|
352 |
'shariff3uu_text_bitcoinaddress',
|
353 |
__( 'Bitcoin address:', 'shariff' ),
|
354 |
'shariff3uu_text_bitcoinaddress_render',
|
355 |
+
'shariff3uu_advanced',
|
356 |
'shariff3uu_advanced_section'
|
357 |
);
|
358 |
|
361 |
'shariff3uu_text_rssfeed',
|
362 |
__( 'RSS feed:', 'shariff' ),
|
363 |
'shariff3uu_text_rssfeed_render',
|
364 |
+
'shariff3uu_advanced',
|
365 |
'shariff3uu_advanced_section'
|
366 |
);
|
367 |
|
370 |
'shariff3uu_text_default_pinterest',
|
371 |
__( 'Default image for Pinterest:', 'shariff' ),
|
372 |
'shariff3uu_text_default_pinterest_render',
|
373 |
+
'shariff3uu_advanced',
|
374 |
'shariff3uu_advanced_section'
|
375 |
);
|
376 |
|
379 |
'shariff3uu_number_shortcodeprio',
|
380 |
__( 'Shortcode priority:', 'shariff' ),
|
381 |
'shariff3uu_number_shortcodeprio_render',
|
382 |
+
'shariff3uu_advanced',
|
383 |
'shariff3uu_advanced_section'
|
384 |
);
|
385 |
|
388 |
'shariff3uu_checkbox_disable_metabox',
|
389 |
__( 'Disable the metabox.', 'shariff' ),
|
390 |
'shariff3uu_checkbox_disable_metabox_render',
|
391 |
+
'shariff3uu_advanced',
|
392 |
'shariff3uu_advanced_section'
|
393 |
);
|
394 |
|
395 |
/** Fifth tab - statistic */
|
396 |
|
397 |
// Registers fifth tab (statistic) settings and calls sanitize function.
|
398 |
+
register_setting( 'shariff3uu_statistic', 'shariff3uu_statistic', 'shariff3uu_statistic_sanitize' );
|
399 |
|
400 |
// Fifth tab (statistic).
|
401 |
add_settings_section(
|
402 |
'shariff3uu_statistic_section',
|
403 |
__( 'Statistic', 'shariff' ),
|
404 |
'shariff3uu_statistic_section_callback',
|
405 |
+
'shariff3uu_statistic'
|
406 |
);
|
407 |
|
408 |
// Statistic.
|
410 |
'shariff3uu_checkbox_backend',
|
411 |
'<div style="width:450px">' . __( 'Enable statistic.', 'shariff' ) . '</div>',
|
412 |
'shariff3uu_checkbox_backend_render',
|
413 |
+
'shariff3uu_statistic',
|
414 |
'shariff3uu_statistic_section'
|
415 |
);
|
416 |
|
419 |
'shariff3uu_checkbox_sharecounts',
|
420 |
__( 'Show share counts on buttons.', 'shariff' ),
|
421 |
'shariff3uu_checkbox_sharecounts_render',
|
422 |
+
'shariff3uu_statistic',
|
423 |
'shariff3uu_statistic_section'
|
424 |
);
|
425 |
|
428 |
'shariff3uu_checkbox_hidezero',
|
429 |
__( 'Hide share counts when they are zero.', 'shariff' ),
|
430 |
'shariff3uu_checkbox_hidezero_render',
|
431 |
+
'shariff3uu_statistic',
|
432 |
'shariff3uu_statistic_section'
|
433 |
);
|
434 |
|
437 |
'shariff3uu_text_fb_id',
|
438 |
__( 'Facebook App ID:', 'shariff' ),
|
439 |
'shariff3uu_text_fb_id_render',
|
440 |
+
'shariff3uu_statistic',
|
441 |
'shariff3uu_statistic_section'
|
442 |
);
|
443 |
|
446 |
'shariff3uu_text_fb_secret',
|
447 |
__( 'Facebook App Secret:', 'shariff' ),
|
448 |
'shariff3uu_text_fb_secret_render',
|
449 |
+
'shariff3uu_statistic',
|
450 |
'shariff3uu_statistic_section'
|
451 |
);
|
452 |
|
455 |
'shariff3uu_checkbox_automaticcache',
|
456 |
__( 'Fill cache automatically.', 'shariff' ),
|
457 |
'shariff3uu_checkbox_automaticcache_render',
|
458 |
+
'shariff3uu_statistic',
|
459 |
'shariff3uu_statistic_section'
|
460 |
);
|
461 |
|
464 |
'shariff3uu_number_ranking',
|
465 |
__( 'Number of posts on ranking tab:', 'shariff' ),
|
466 |
'shariff3uu_number_ranking_render',
|
467 |
+
'shariff3uu_statistic',
|
468 |
'shariff3uu_statistic_section'
|
469 |
);
|
470 |
|
473 |
'shariff3uu_number_ttl',
|
474 |
__( 'Cache TTL in seconds (60 - 7200):', 'shariff' ),
|
475 |
'shariff3uu_number_ttl_render',
|
476 |
+
'shariff3uu_statistic',
|
477 |
'shariff3uu_statistic_section'
|
478 |
);
|
479 |
|
482 |
'shariff3uu_checkbox_disable_dynamic_cache',
|
483 |
__( 'Disable the dynamic cache lifespan (not recommended).', 'shariff' ),
|
484 |
'shariff3uu_checkbox_disable_dynamic_cache_render',
|
485 |
+
'shariff3uu_statistic',
|
486 |
'shariff3uu_statistic_section'
|
487 |
);
|
488 |
|
491 |
'shariff3uu_multiplecheckbox_disable_services',
|
492 |
__( 'Disable the following services (share counts only):', 'shariff' ),
|
493 |
'shariff3uu_multiplecheckbox_disable_services_render',
|
494 |
+
'shariff3uu_statistic',
|
495 |
'shariff3uu_statistic_section'
|
496 |
);
|
497 |
|
500 |
'shariff3uu_text_external_host',
|
501 |
__( 'External API for share counts:', 'shariff' ),
|
502 |
'shariff3uu_text_external_host_render',
|
503 |
+
'shariff3uu_statistic',
|
504 |
'shariff3uu_statistic_section'
|
505 |
);
|
506 |
|
509 |
'shariff3uu_checkbox_external_direct',
|
510 |
__( 'Request external API directly.', 'shariff' ),
|
511 |
'shariff3uu_checkbox_external_direct_render',
|
512 |
+
'shariff3uu_statistic',
|
513 |
'shariff3uu_statistic_section'
|
514 |
);
|
515 |
|
518 |
'shariff3uu_checkbox_subapi',
|
519 |
__( 'Local API not reachable in root.', 'shariff' ),
|
520 |
'shariff3uu_checkbox_subapi_render',
|
521 |
+
'shariff3uu_statistic',
|
522 |
'shariff3uu_statistic_section'
|
523 |
);
|
524 |
|
529 |
'shariff3uu_help_section',
|
530 |
__( 'Shariff Help', 'shariff' ),
|
531 |
'shariff3uu_help_section_callback',
|
532 |
+
'shariff3uu_help'
|
533 |
);
|
534 |
|
535 |
/** Seventh tab - status */
|
539 |
'shariff3uu_status_section',
|
540 |
__( 'Status', 'shariff' ),
|
541 |
'shariff3uu_status_section_callback',
|
542 |
+
'shariff3uu_status'
|
543 |
);
|
544 |
|
545 |
/** Eight tab - ranking */
|
549 |
'shariff3uu_ranking_section',
|
550 |
__( 'Ranking', 'shariff' ),
|
551 |
'shariff3uu_ranking_section_callback',
|
552 |
+
'shariff3uu_ranking'
|
553 |
);
|
554 |
}
|
555 |
|
1060 |
$options['theme'] = '';
|
1061 |
}
|
1062 |
$plugins_url = plugins_url();
|
1063 |
+
echo '<div style="display:grid;grid-template-columns:75px auto;grid-template-rows:44px 45px 45px 45px 45px 45px;grid-auto-flow: column;align-items:center">
|
1064 |
+
<div><input type="radio" name="shariff3uu_design[theme]" value="" ' . checked( $options['theme'], '', 0 ) . '>default</div>
|
1065 |
+
<div><input type="radio" name="shariff3uu_design[theme]" value="color" ' . checked( $options['theme'], 'color', 0 ) . '>color</div>
|
1066 |
+
<div><input type="radio" name="shariff3uu_design[theme]" value="grey" ' . checked( $options['theme'], 'grey', 0 ) . '>grey</div>
|
1067 |
+
<div><input type="radio" name="shariff3uu_design[theme]" value="white" ' . checked( $options['theme'], 'white', 0 ) . '>white</div>
|
1068 |
+
<div><input type="radio" name="shariff3uu_design[theme]" value="round" ' . checked( $options['theme'], 'round', 0 ) . '>round</div>
|
1069 |
+
<div><input type="radio" name="shariff3uu_design[theme]" value="wcag" ' . checked( $options['theme'], 'wcag', 0 ) . '>wcag</div>
|
1070 |
+
<img alt="Shariff Designs" src="' . esc_url( $plugins_url ) . '/shariff/images/shariff_designs.png" style="grid-row: 1 / span 6;align-self:baseline">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1071 |
</div>';
|
1072 |
}
|
1073 |
|
1726 |
// Theme.
|
1727 |
echo '<div style="display:table-row">';
|
1728 |
echo '<div style="display:table-cell;border:1px solid;padding:10px">theme</div>';
|
1729 |
+
echo '<div style="display:table-cell;border:1px solid;padding:10px">default<br>color<br>grey<br>white<br>round<br>wcag</div>';
|
1730 |
echo '<div style="display:table-cell;border:1px solid;padding:10px">default</div>';
|
1731 |
echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff theme="round"]</div>';
|
1732 |
echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Determines the main design of the buttons.', 'shariff' ) . '</div>';
|
2427 |
// phpcs:ignore
|
2428 |
$active_tab = $_GET['tab'];
|
2429 |
} else {
|
2430 |
+
$active_tab = 'shariff3uu_basic';
|
2431 |
}
|
2432 |
|
2433 |
// Tabs.
|
2434 |
echo '<h2 class="nav-tab-wrapper">';
|
2435 |
// Basic.
|
2436 |
+
echo '<a href="?page=shariff3uu&tab=shariff3uu_basic" class="nav-tab ';
|
2437 |
+
if ( 'shariff3uu_basic' === $active_tab ) {
|
2438 |
echo 'nav-tab-active';
|
2439 |
}
|
2440 |
echo '">' . esc_html__( 'Basic', 'shariff' ) . '</a>';
|
2441 |
// Design.
|
2442 |
+
echo '<a href="?page=shariff3uu&tab=shariff3uu_design" class="nav-tab ';
|
2443 |
+
if ( 'shariff3uu_design' === $active_tab ) {
|
2444 |
echo 'nav-tab-active';
|
2445 |
}
|
2446 |
echo '">' . esc_html__( 'Design', 'shariff' ) . '</a>';
|
2447 |
// Advanced.
|
2448 |
+
echo '<a href="?page=shariff3uu&tab=shariff3uu_advanced" class="nav-tab ';
|
2449 |
+
if ( 'shariff3uu_advanced' === $active_tab ) {
|
2450 |
echo 'nav-tab-active';
|
2451 |
}
|
2452 |
echo '">' . esc_html__( 'Advanced', 'shariff' ) . '</a>';
|
2453 |
// Statistic.
|
2454 |
+
echo '<a href="?page=shariff3uu&tab=shariff3uu_statistic" class="nav-tab ';
|
2455 |
+
if ( 'shariff3uu_statistic' === $active_tab ) {
|
2456 |
echo 'nav-tab-active';
|
2457 |
}
|
2458 |
echo '">' . esc_html__( 'Statistic', 'shariff' ) . '</a>';
|
2459 |
// Help.
|
2460 |
+
echo '<a href="?page=shariff3uu&tab=shariff3uu_help" class="nav-tab ';
|
2461 |
+
if ( 'shariff3uu_help' === $active_tab ) {
|
2462 |
echo 'nav-tab-active';
|
2463 |
}
|
2464 |
echo '">' . esc_html__( 'Help', 'shariff' ) . '</a>';
|
2465 |
// Status.
|
2466 |
+
echo '<a href="?page=shariff3uu&tab=shariff3uu_status" class="nav-tab ';
|
2467 |
+
if ( 'shariff3uu_status' === $active_tab ) {
|
2468 |
echo 'nav-tab-active';
|
2469 |
}
|
2470 |
echo '">' . esc_html__( 'Status', 'shariff' ) . '</a>';
|
2471 |
// Ranking.
|
2472 |
+
echo '<a href="?page=shariff3uu&tab=shariff3uu_ranking" class="nav-tab ';
|
2473 |
+
if ( 'shariff3uu_ranking' === $active_tab ) {
|
2474 |
echo 'nav-tab-active';
|
2475 |
}
|
2476 |
echo '">' . esc_html__( 'Ranking', 'shariff' ) . '</a>';
|
2477 |
echo '</h2>';
|
2478 |
|
2479 |
// Content of tabs.
|
2480 |
+
if ( 'shariff3uu_basic' === $active_tab ) {
|
2481 |
+
settings_fields( 'shariff3uu_basic' );
|
2482 |
+
do_settings_sections( 'shariff3uu_basic' );
|
2483 |
submit_button();
|
2484 |
+
} elseif ( 'shariff3uu_design' === $active_tab ) {
|
2485 |
+
settings_fields( 'shariff3uu_design' );
|
2486 |
+
do_settings_sections( 'shariff3uu_design' );
|
2487 |
submit_button();
|
2488 |
+
} elseif ( 'shariff3uu_advanced' === $active_tab ) {
|
2489 |
+
settings_fields( 'shariff3uu_advanced' );
|
2490 |
+
do_settings_sections( 'shariff3uu_advanced' );
|
2491 |
submit_button();
|
2492 |
+
} elseif ( 'shariff3uu_statistic' === $active_tab ) {
|
2493 |
+
settings_fields( 'shariff3uu_statistic' );
|
2494 |
+
do_settings_sections( 'shariff3uu_statistic' );
|
2495 |
submit_button();
|
2496 |
+
} elseif ( 'shariff3uu_help' === $active_tab ) {
|
2497 |
+
settings_fields( 'shariff3uu_help' );
|
2498 |
+
do_settings_sections( 'shariff3uu_help' );
|
2499 |
+
} elseif ( 'shariff3uu_status' === $active_tab ) {
|
2500 |
+
settings_fields( 'shariff3uu_status' );
|
2501 |
+
do_settings_sections( 'shariff3uu_status' );
|
2502 |
+
} elseif ( 'shariff3uu_ranking' === $active_tab ) {
|
2503 |
+
settings_fields( 'shariff3uu_ranking' );
|
2504 |
+
do_settings_sections( 'shariff3uu_ranking' );
|
2505 |
}
|
2506 |
|
2507 |
// End of form.
|
changelog.txt
CHANGED
@@ -2,6 +2,20 @@
|
|
2 |
|
3 |
== Changelog ==
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
= 4.5.3 =
|
6 |
- removed LinkedIn Share Counts due to LinkedIn removing them completely
|
7 |
- removed GooglePlus Share Counts due to Google shutting GooglePlus down
|
2 |
|
3 |
== Changelog ==
|
4 |
|
5 |
+
= 4.6.0 =
|
6 |
+
- new high contrast theme (WCAG)
|
7 |
+
- improved support for WPML for easier translation of headlines and info button texts
|
8 |
+
- updated WhatsApp share link to support WhatsApp Web (thanks to Oliver, @oliverpw)
|
9 |
+
- updated Spanish translations (thanks to Torsten, @torstenbulk)
|
10 |
+
- updated Pinterest Share Count API
|
11 |
+
- updated VK Share Count API
|
12 |
+
- updated Pocket API
|
13 |
+
- updated XING API
|
14 |
+
- removed GooglePlus due to Google shutting GooglePlus down
|
15 |
+
- fixed a PHP notice in regards to Tumblr (thanks to Mario, @mariobartlack)
|
16 |
+
- fixed a conflict with another plugin (thanks to David, @daveshine)
|
17 |
+
- tested with WordPress 5.1
|
18 |
+
|
19 |
= 4.5.3 =
|
20 |
- removed LinkedIn Share Counts due to LinkedIn removing them completely
|
21 |
- removed GooglePlus Share Counts due to Google shutting GooglePlus down
|
css/shariff.css
CHANGED
@@ -121,6 +121,11 @@
|
|
121 |
background-color: transparent;
|
122 |
margin: 0;
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
124 |
/* theme round */
|
125 |
.shariff .shariff-buttons.theme-round li {
|
126 |
width: 35px !important;
|
@@ -314,6 +319,10 @@
|
|
314 |
border: 1px solid #ddd;
|
315 |
width: 35px;
|
316 |
}
|
|
|
|
|
|
|
|
|
317 |
.shariff .shariff-button.info {
|
318 |
width: 35px;
|
319 |
flex: 0 0 auto !important;
|
@@ -321,9 +330,15 @@
|
|
321 |
.shariff .theme-default .shariff-button.shariff-nocustomcolor.info svg path {
|
322 |
fill: #999;
|
323 |
}
|
|
|
|
|
|
|
324 |
.shariff .theme-round .shariff-button.shariff-nocustomcolor.info svg path {
|
325 |
fill: #999;
|
326 |
}
|
|
|
|
|
|
|
327 |
.shariff .buttonsize-small .shariff-button.info {
|
328 |
width: 25px;
|
329 |
}
|
121 |
background-color: transparent;
|
122 |
margin: 0;
|
123 |
}
|
124 |
+
/* theme wcag */
|
125 |
+
.shariff .wcag_colors .shariff-count {
|
126 |
+
color: #fff !important;
|
127 |
+
background-color: rgba(255, 255, 255, 0.2);
|
128 |
+
}
|
129 |
/* theme round */
|
130 |
.shariff .shariff-buttons.theme-round li {
|
131 |
width: 35px !important;
|
319 |
border: 1px solid #ddd;
|
320 |
width: 35px;
|
321 |
}
|
322 |
+
.shariff .wcag_colors .info a {
|
323 |
+
border: 1px solid #575757;
|
324 |
+
width: 35px;
|
325 |
+
}
|
326 |
.shariff .shariff-button.info {
|
327 |
width: 35px;
|
328 |
flex: 0 0 auto !important;
|
330 |
.shariff .theme-default .shariff-button.shariff-nocustomcolor.info svg path {
|
331 |
fill: #999;
|
332 |
}
|
333 |
+
.shariff .theme-default.wcag_colors .shariff-button.shariff-nocustomcolor.info svg path {
|
334 |
+
fill: #595959;
|
335 |
+
}
|
336 |
.shariff .theme-round .shariff-button.shariff-nocustomcolor.info svg path {
|
337 |
fill: #999;
|
338 |
}
|
339 |
+
.shariff .theme-round.wcag_colors .shariff-button.shariff-nocustomcolor.info svg path {
|
340 |
+
fill: #595959;
|
341 |
+
}
|
342 |
.shariff .buttonsize-small .shariff-button.info {
|
343 |
width: 25px;
|
344 |
}
|
css/shariff.min.css
CHANGED
@@ -1 +1 @@
|
|
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;box-shadow:none;cursor:pointer}.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 !important}.shariff-button::before{content:none !important}.shariff .shariff-buttons .shariff-text-white{color:#fff}.shariff .shariff-buttons .shariff-hidezero{opacity:0}.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 .shariff-buttons.buttonsize-small li{height:25px !important}.shariff .shariff-buttons.buttonsize-small a{height:25px !important}.shariff .shariff-buttons.buttonsize-small.orientation-vertical li{width:115px}.shariff .shariff-buttons.buttonsize-small .shariff-icon svg{width:22px;height:15px;padding:5px 1px}.shariff .shariff-buttons.buttonsize-small .shariff-text,.shariff .shariff-buttons.buttonsize-small .shariff-count{font-size:11px;line-height:25px;padding:0 5px;height:23px}.shariff .shariff-buttons.buttonsize-small .shariff-text{padding-left:1px !important}.shariff .shariff-buttons.buttonsize-small.theme-round li{width:25px !important}.shariff .shariff-buttons.buttonsize-small.theme-round a{width:25px !important}.shariff .shariff-buttons.buttonsize-small.theme-round .shariff-count{padding:0 !important;height:25px !important}.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li{margin:5px 7px}.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li:first-child{margin-left:5px}.shariff .shariff-buttons.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 .shariff-buttons.buttonsize-large.theme-round li{width:45px !important;height: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 li{border:0;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 .shariff-buttons.buttonsize-small li{width:25px}.shariff .shariff-buttons li{width:35px}.shariff .shariff-buttons.buttonsize-large li{width:45px}.shariff .shariff-buttons .shariff-icon svg{display:block;margin:auto}.shariff .shariff-buttons .shariff-text{display:none}.shariff .shariff-buttons .shariff-count{display:none}}@media only screen and (min-width:361px){.shariff .shariff-buttons.buttonsize-small li{width:105px}.shariff .shariff-buttons li{width:125px}.shariff .shariff-buttons.buttonsize-large li{width:155px}.shariff .shariff-buttons .shariff-text{display:inline}.shariff .shariff-buttons .shariff-count{display:inline}}@media only screen and (min-device-width:1025px){.shariff .shariff-mobile{display:none !important}}
|
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;box-shadow:none;cursor:pointer}.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 !important}.shariff-button::before{content:none !important}.shariff .shariff-buttons .shariff-text-white{color:#fff}.shariff .shariff-buttons .shariff-hidezero{opacity:0}.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 .wcag_colors .shariff-count{color:#fff !important;background-color:rgba(255,255,255,0.2)}.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 .shariff-buttons.buttonsize-small li{height:25px !important}.shariff .shariff-buttons.buttonsize-small a{height:25px !important}.shariff .shariff-buttons.buttonsize-small.orientation-vertical li{width:115px}.shariff .shariff-buttons.buttonsize-small .shariff-icon svg{width:22px;height:15px;padding:5px 1px}.shariff .shariff-buttons.buttonsize-small .shariff-text,.shariff .shariff-buttons.buttonsize-small .shariff-count{font-size:11px;line-height:25px;padding:0 5px;height:23px}.shariff .shariff-buttons.buttonsize-small .shariff-text{padding-left:1px !important}.shariff .shariff-buttons.buttonsize-small.theme-round li{width:25px !important}.shariff .shariff-buttons.buttonsize-small.theme-round a{width:25px !important}.shariff .shariff-buttons.buttonsize-small.theme-round .shariff-count{padding:0 !important;height:25px !important}.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li{margin:5px 7px}.shariff .shariff-buttons.theme-round.buttonsize-small.orientation-horizontal li:first-child{margin-left:5px}.shariff .shariff-buttons.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 .shariff-buttons.buttonsize-large.theme-round li{width:45px !important;height: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 li{border:0;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 .wcag_colors .info a{border:1px solid #575757;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-default.wcag_colors .shariff-button.shariff-nocustomcolor.info svg path{fill:#595959}.shariff .theme-round .shariff-button.shariff-nocustomcolor.info svg path{fill:#999}.shariff .theme-round.wcag_colors .shariff-button.shariff-nocustomcolor.info svg path{fill:#595959}.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 .shariff-buttons.buttonsize-small li{width:25px}.shariff .shariff-buttons li{width:35px}.shariff .shariff-buttons.buttonsize-large li{width:45px}.shariff .shariff-buttons .shariff-icon svg{display:block;margin:auto}.shariff .shariff-buttons .shariff-text{display:none}.shariff .shariff-buttons .shariff-count{display:none}}@media only screen and (min-width:361px){.shariff .shariff-buttons.buttonsize-small li{width:105px}.shariff .shariff-buttons li{width:125px}.shariff .shariff-buttons.buttonsize-large li{width:155px}.shariff .shariff-buttons .shariff-text{display:inline}.shariff .shariff-buttons .shariff-count{display:inline}}@media only screen and (min-device-width:1025px){.shariff .shariff-mobile{display:none !important}}
|
images/borderradius.png
CHANGED
Binary file
|
images/colorBtns.png
DELETED
Binary file
|
images/defaultBtns.png
DELETED
Binary file
|
images/defaultHint.png
CHANGED
Binary file
|
images/greyBtns.png
DELETED
Binary file
|
images/roundBtns.png
DELETED
Binary file
|
images/shariff_designs.png
ADDED
Binary file
|
images/whiteBtns.png
DELETED
Binary file
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: starguide, 3UU
|
3 |
Tags: Shariff, GDPR, DSGVO, share buttons, sharing
|
4 |
Requires at least: 4.9
|
5 |
-
Requires PHP: 7.
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 4.5.
|
8 |
License: MIT
|
9 |
License URI: http://opensource.org/licenses/mit
|
10 |
|
@@ -152,6 +152,20 @@ These are bugs or unexpected glitches that we know of, but that do not have an i
|
|
152 |
|
153 |
== Changelog ==
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
= 4.5.3 =
|
156 |
- removed LinkedIn Share Counts due to LinkedIn removing them completely
|
157 |
- removed GooglePlus Share Counts due to Google shutting GooglePlus down
|
2 |
Contributors: starguide, 3UU
|
3 |
Tags: Shariff, GDPR, DSGVO, share buttons, sharing
|
4 |
Requires at least: 4.9
|
5 |
+
Requires PHP: 7.1
|
6 |
+
Tested up to: 5.1
|
7 |
+
Stable tag: 4.5.4
|
8 |
License: MIT
|
9 |
License URI: http://opensource.org/licenses/mit
|
10 |
|
152 |
|
153 |
== Changelog ==
|
154 |
|
155 |
+
= 4.6.0 =
|
156 |
+
- new high contrast theme (WCAG)
|
157 |
+
- improved support for WPML for easier translation of headlines and info button texts
|
158 |
+
- updated WhatsApp share link to support WhatsApp Web (thanks to Oliver, @oliverpw)
|
159 |
+
- updated Spanish translations (thanks to Torsten, @torstenbulk)
|
160 |
+
- updated Pinterest Share Count API
|
161 |
+
- updated VK Share Count API
|
162 |
+
- updated Pocket API
|
163 |
+
- updated XING API
|
164 |
+
- removed GooglePlus due to Google shutting GooglePlus down
|
165 |
+
- fixed a PHP notice in regards to Tumblr (thanks to Mario, @mariobartlack)
|
166 |
+
- fixed a conflict with another plugin (thanks to David, @daveshine)
|
167 |
+
- tested with WordPress 5.1
|
168 |
+
|
169 |
= 4.5.3 =
|
170 |
- removed LinkedIn Share Counts due to LinkedIn removing them completely
|
171 |
- removed GooglePlus Share Counts due to Google shutting GooglePlus down
|
services/shariff-addthis.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#f8694d';
|
23 |
$secondary_color = '#f75b44';
|
24 |
+
$wcag_color = '#AC2207';
|
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="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>';
|
services/shariff-bitcoin.php
CHANGED
@@ -28,6 +28,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
28 |
// Colors.
|
29 |
$main_color = '#f7931a';
|
30 |
$secondary_color = '#191919';
|
31 |
+
$wcag_color = '#824808';
|
32 |
|
33 |
// SVG icon.
|
34 |
$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>';
|
services/shariff-diaspora.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#999';
|
23 |
$secondary_color = '#b3b3b3';
|
24 |
+
$wcag_color = '#595959';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-facebook.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Set the Colors (Hexadecimal including the #).
|
22 |
$main_color = '#3b5998';
|
23 |
$secondary_color = '#4273c8';
|
24 |
+
$wcag_color = '#38548F';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-flattr.php
CHANGED
@@ -35,6 +35,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
35 |
// Colors.
|
36 |
$main_color = '#7ea352';
|
37 |
$secondary_color = '#F67C1A';
|
38 |
+
$wcag_color = '#415728';
|
39 |
|
40 |
// SVG icon.
|
41 |
$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>';
|
services/shariff-flipboard.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Set the Colors (Hexadecimal including the #).
|
22 |
$main_color = '#f52828';
|
23 |
$secondary_color = '#373737';
|
24 |
+
$wcag_color = '#B30A0A';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-googleplus.php
DELETED
@@ -1,59 +0,0 @@
|
|
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
@@ -25,6 +25,13 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
25 |
// Colors.
|
26 |
$main_color = '#999';
|
27 |
$secondary_color = '#a8a8a8';
|
28 |
+
$wcag_color = '#595959';
|
29 |
+
|
30 |
+
// Replace $main_color with $wcag_color and $secondary_color with #000, if $wacg_theme is selected.
|
31 |
+
if ( isset( $atts['theme'] ) && 'wcag' === $atts['theme'] && isset( $wcag_color ) && '' !== $wcag_color ) {
|
32 |
+
$main_color = $wcag_color;
|
33 |
+
$secondary_color = '#000';
|
34 |
+
}
|
35 |
|
36 |
// SVG icon.
|
37 |
$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>';
|
services/shariff-linkedin.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#0077b5';
|
23 |
$secondary_color = '#1488bf';
|
24 |
+
$wcag_color = '#005B8A';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-mailto.php
CHANGED
@@ -19,6 +19,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
@@ -30,9 +31,9 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
30 |
$button_text_array = array(
|
31 |
'bg' => 'имейл',
|
32 |
'da' => 'e-mail',
|
33 |
-
'de' => '
|
34 |
-
'en' => '
|
35 |
-
'es' => '
|
36 |
'fi' => 'sähköpostitse',
|
37 |
'fr' => 'courriel',
|
38 |
'hr' => 'e-pošta',
|
@@ -61,7 +62,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
61 |
'da' => 'Sende via e-mail',
|
62 |
'de' => 'Per E-Mail versenden',
|
63 |
'en' => 'Send by email',
|
64 |
-
'es' => 'Enviar por
|
65 |
'fi' => 'Lähetä sähköpostitse',
|
66 |
'fr' => 'Envoyer par courriel',
|
67 |
'hr' => 'Pošaljite emailom',
|
19 |
// Colors.
|
20 |
$main_color = '#999';
|
21 |
$secondary_color = '#a8a8a8';
|
22 |
+
$wcag_color = '#595959';
|
23 |
|
24 |
// SVG icon.
|
25 |
$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>';
|
31 |
$button_text_array = array(
|
32 |
'bg' => 'имейл',
|
33 |
'da' => 'e-mail',
|
34 |
+
'de' => 'E-Mail',
|
35 |
+
'en' => 'email',
|
36 |
+
'es' => 'correo',
|
37 |
'fi' => 'sähköpostitse',
|
38 |
'fr' => 'courriel',
|
39 |
'hr' => 'e-pošta',
|
62 |
'da' => 'Sende via e-mail',
|
63 |
'de' => 'Per E-Mail versenden',
|
64 |
'en' => 'Send by email',
|
65 |
+
'es' => 'Enviar por correo electrónico',
|
66 |
'fi' => 'Lähetä sähköpostitse',
|
67 |
'fr' => 'Envoyer par courriel',
|
68 |
'hr' => 'Pošaljite emailom',
|
services/shariff-odnoklassniki.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#ee8208';
|
23 |
$secondary_color = '#f3a752';
|
24 |
+
$wcag_color = '#874508';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-patreon.php
CHANGED
@@ -28,6 +28,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
28 |
// Colors.
|
29 |
$main_color = '#e6461a';
|
30 |
$secondary_color = '#FF794D';
|
31 |
+
$wcag_color = '#A23210';
|
32 |
|
33 |
// SVG icon.
|
34 |
$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>';
|
services/shariff-paypal.php
CHANGED
@@ -28,6 +28,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
28 |
// Colors.
|
29 |
$main_color = '#009cde';
|
30 |
$secondary_color = '#0285d2';
|
31 |
+
$wcag_color = '#005C8A';
|
32 |
|
33 |
// SVG icon.
|
34 |
$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>';
|
services/shariff-paypalme.php
CHANGED
@@ -28,6 +28,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
28 |
// Colors.
|
29 |
$main_color = '#009cde';
|
30 |
$secondary_color = '#0285d2';
|
31 |
+
$wcag_color = '#005C8A';
|
32 |
|
33 |
// SVG icon.
|
34 |
$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>';
|
services/shariff-pinterest.php
CHANGED
@@ -61,6 +61,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
61 |
// Colors.
|
62 |
$main_color = '#cb2027';
|
63 |
$secondary_color = '#e70f18';
|
|
|
64 |
|
65 |
// SVG icon.
|
66 |
$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>';
|
@@ -72,6 +73,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
72 |
$button_text_array = array(
|
73 |
'de' => 'merken',
|
74 |
'en' => 'save',
|
|
|
75 |
'fr' => 'enregistrer',
|
76 |
'it' => 'salva',
|
77 |
);
|
@@ -83,7 +85,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
83 |
'da' => 'Del på Pinterest',
|
84 |
'de' => 'Bei Pinterest pinnen',
|
85 |
'en' => 'Pin it on Pinterest',
|
86 |
-
'es' => '
|
87 |
'fi' => 'Jaa Pinterestissä',
|
88 |
'fr' => 'Partager sur Pinterest',
|
89 |
'hr' => 'Podijelite na Pinterest',
|
@@ -106,7 +108,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
106 |
);
|
107 |
} elseif ( isset( $backend ) && 1 === $backend ) {
|
108 |
// Fetch counts.
|
109 |
-
$pinterest = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( '
|
110 |
$pinterest_json = rtrim( substr( $pinterest, 2 ), ')' );
|
111 |
$pinterest_json = json_decode( $pinterest_json, true );
|
112 |
|
61 |
// Colors.
|
62 |
$main_color = '#cb2027';
|
63 |
$secondary_color = '#e70f18';
|
64 |
+
$wcag_color = '#AE1920';
|
65 |
|
66 |
// SVG icon.
|
67 |
$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>';
|
73 |
$button_text_array = array(
|
74 |
'de' => 'merken',
|
75 |
'en' => 'save',
|
76 |
+
'es' => 'ahorrar',
|
77 |
'fr' => 'enregistrer',
|
78 |
'it' => 'salva',
|
79 |
);
|
85 |
'da' => 'Del på Pinterest',
|
86 |
'de' => 'Bei Pinterest pinnen',
|
87 |
'en' => 'Pin it on Pinterest',
|
88 |
+
'es' => 'Ahorrar en Pinterest',
|
89 |
'fi' => 'Jaa Pinterestissä',
|
90 |
'fr' => 'Partager sur Pinterest',
|
91 |
'hr' => 'Podijelite na Pinterest',
|
108 |
);
|
109 |
} elseif ( isset( $backend ) && 1 === $backend ) {
|
110 |
// Fetch counts.
|
111 |
+
$pinterest = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://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 |
|
services/shariff-pocket.php
CHANGED
@@ -13,7 +13,7 @@ if ( ! class_exists( 'WP' ) ) {
|
|
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/
|
17 |
|
18 |
// Build button URL.
|
19 |
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
|
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
@@ -30,13 +31,36 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
30 |
|
31 |
// Button text label.
|
32 |
$button_text_array = array(
|
33 |
-
'de' => '
|
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 |
}
|
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/save' );
|
17 |
|
18 |
// Build button URL.
|
19 |
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
|
21 |
// Colors.
|
22 |
$main_color = '#ff0000';
|
23 |
$secondary_color = '#444';
|
24 |
+
$wcag_color = '#B30000';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
31 |
|
32 |
// Button text label.
|
33 |
$button_text_array = array(
|
34 |
+
'de' => 'Pocket',
|
35 |
'en' => 'pocket',
|
36 |
);
|
37 |
|
38 |
// Button alt label.
|
39 |
$button_title_array = array(
|
40 |
+
'bg' => 'Запазване в Pocket',
|
41 |
+
'cs' => 'Uložit do Pocket',
|
42 |
+
'da' => 'Gem i Pocket',
|
43 |
'de' => 'Bei Pocket speichern',
|
44 |
'en' => 'Save to Pocket',
|
45 |
+
'es' => 'Guardar en Pocket',
|
46 |
+
'fi' => 'Tallenna kohtaan Pocket',
|
47 |
+
'fr' => 'Enregistrer dans Pocket',
|
48 |
+
'hr' => 'Spremi u Pocket',
|
49 |
+
'hu' => 'Mentés "Pocket"-be',
|
50 |
+
'it' => 'Salva in Pocket',
|
51 |
+
'ja' => '「ポケット」に保存',
|
52 |
+
'ko' => 'Pocket에 저장',
|
53 |
+
'nl' => 'Opslaan in Pocket',
|
54 |
+
'no' => 'Lagre i Pocket',
|
55 |
+
'pl' => 'Zapisz w Pocket',
|
56 |
+
'pt' => 'Salvar em Pocket',
|
57 |
+
'ro' => 'Salvați în Pocket',
|
58 |
+
'ru' => 'Сохранить в Pocket',
|
59 |
+
'sk' => 'Uložiť do priečinka Pocket',
|
60 |
+
'sl' => 'Shrani v Pocket',
|
61 |
+
'sr' => 'Sačuvaj u Pocket',
|
62 |
+
'sv' => 'Spara till Pocket',
|
63 |
+
'tr' => 'Pocket e kaydet',
|
64 |
+
'zh' => '保存到Pocket',
|
65 |
);
|
66 |
}
|
services/shariff-printer.php
CHANGED
@@ -19,6 +19,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
19 |
// Colors.
|
20 |
$main_color = '#999';
|
21 |
$secondary_color = '#a8a8a8';
|
22 |
+
$wcag_color = '#595959';
|
23 |
|
24 |
// SVG icon.
|
25 |
$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>';
|
services/shariff-qzone.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#ffce00';
|
23 |
$secondary_color = '#71C5F2';
|
24 |
+
$wcag_color = '#6B5700';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-reddit.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#ff4500';
|
23 |
$secondary_color = '#ff5700';
|
24 |
+
$wcag_color = '#A32D00';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-rss.php
CHANGED
@@ -25,6 +25,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
25 |
// Colors.
|
26 |
$main_color = '#fe9312';
|
27 |
$secondary_color = '#ff8c00';
|
28 |
+
$wcag_color = '#aa2e00';
|
29 |
|
30 |
// SVG icon.
|
31 |
$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>';
|
services/shariff-sms.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#a1e877';
|
23 |
$secondary_color = '#d7d9d8';
|
24 |
+
$wcag_color = '#31640C';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-stumbleupon.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#eb4b24';
|
23 |
$secondary_color = '#e1370e';
|
24 |
+
$wcag_color = '#A22D16';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-telegram.php
CHANGED
@@ -22,6 +22,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
22 |
// Colors.
|
23 |
$main_color = '#0088cc';
|
24 |
$secondary_color = '#4084A6';
|
25 |
+
$wcag_color = '#005E8F';
|
26 |
|
27 |
// SVG icon.
|
28 |
$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>';
|
services/shariff-tencentweibo.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#02a8f3';
|
23 |
$secondary_color = '#8ac249';
|
24 |
+
$wcag_color = '#025C88';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-threema.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#1f1f1f';
|
23 |
$secondary_color = '#4fbc24';
|
24 |
+
$wcag_color = '#1f1f1f';
|
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 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>';
|
services/shariff-tumblr.php
CHANGED
@@ -18,10 +18,10 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
18 |
// Domain.
|
19 |
$wpurl = get_bloginfo( 'wpurl' );
|
20 |
$domainname = trim( $wpurl, '/' );
|
21 |
-
if ( ! preg_match( '#^http(s)?://#', $
|
22 |
$domainname = 'http://' . $domainname;
|
23 |
}
|
24 |
-
$url_parts = wp_parse_url( $
|
25 |
$domainname = preg_replace( '/^www\./', '', $url_parts['host'] );
|
26 |
|
27 |
// Build button URL.
|
@@ -30,6 +30,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
18 |
// Domain.
|
19 |
$wpurl = get_bloginfo( 'wpurl' );
|
20 |
$domainname = trim( $wpurl, '/' );
|
21 |
+
if ( ! preg_match( '#^http(s)?://#', $domainname ) ) {
|
22 |
$domainname = 'http://' . $domainname;
|
23 |
}
|
24 |
+
$url_parts = wp_parse_url( $domainname );
|
25 |
$domainname = preg_replace( '/^www\./', '', $url_parts['host'] );
|
26 |
|
27 |
// Build button URL.
|
30 |
// Colors.
|
31 |
$main_color = '#36465d';
|
32 |
$secondary_color = '#529ecc';
|
33 |
+
$wcag_color = '#36465d';
|
34 |
|
35 |
// SVG icon.
|
36 |
$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>';
|
services/shariff-twitter.php
CHANGED
@@ -28,6 +28,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
28 |
// Colors.
|
29 |
$main_color = '#55acee';
|
30 |
$secondary_color = '#32bbf5';
|
31 |
+
$wcag_color = '#115A92';
|
32 |
|
33 |
// SVG icon.
|
34 |
$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>';
|
services/shariff-vk.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
@@ -58,7 +59,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
58 |
);
|
59 |
} elseif ( isset( $backend ) && 1 === $backend ) {
|
60 |
// Fetch counts.
|
61 |
-
$vk = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( '
|
62 |
if ( isset( $vk ) ) {
|
63 |
preg_match( '/^VK.Share.count\((\d+),\s+(\d+)\);$/i', $vk, $matches );
|
64 |
$vk_count = intval( $matches[2] );
|
21 |
// Colors.
|
22 |
$main_color = '#527498';
|
23 |
$secondary_color = '#4273c8';
|
24 |
+
$wcag_color = '#3A5773';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
59 |
);
|
60 |
} elseif ( isset( $backend ) && 1 === $backend ) {
|
61 |
// Fetch counts.
|
62 |
+
$vk = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://vk.com/share.php?act=count&url=' . $post_url ) ) );
|
63 |
if ( isset( $vk ) ) {
|
64 |
preg_match( '/^VK.Share.count\((\d+),\s+(\d+)\);$/i', $vk, $matches );
|
65 |
$vk_count = intval( $matches[2] );
|
services/shariff-wallabag.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#26a69a';
|
23 |
$secondary_color = '#2bbbad';
|
24 |
+
$wcag_color = '#156058';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-weibo.php
CHANGED
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
21 |
// Colors.
|
22 |
$main_color = '#e6162d';
|
23 |
$secondary_color = '#ff9933';
|
24 |
+
$wcag_color = '#AB1221';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
services/shariff-whatsapp.php
CHANGED
@@ -13,7 +13,7 @@ if ( ! class_exists( 'WP' ) ) {
|
|
13 |
// Check if we need the frontend or the backend part.
|
14 |
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
// Service URL.
|
16 |
-
$service_url = '
|
17 |
|
18 |
// Build button URL.
|
19 |
$button_url = $service_url . '?text=' . $share_title . '%20' . $share_url;
|
@@ -21,12 +21,13 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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 =
|
30 |
|
31 |
// Button alt label.
|
32 |
$button_title_array = array(
|
13 |
// Check if we need the frontend or the backend part.
|
14 |
if ( isset( $frontend ) && 1 === $frontend ) {
|
15 |
// Service URL.
|
16 |
+
$service_url = 'https://wa.me/';
|
17 |
|
18 |
// Build button URL.
|
19 |
$button_url = $service_url . '?text=' . $share_title . '%20' . $share_url;
|
21 |
// Colors.
|
22 |
$main_color = '#34af23';
|
23 |
$secondary_color = '#5cbe4a';
|
24 |
+
$wcag_color = '#226411';
|
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="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>';
|
28 |
|
29 |
// Mobile only?
|
30 |
+
$mobile_only = 0;
|
31 |
|
32 |
// Button alt label.
|
33 |
$button_title_array = array(
|
services/shariff-xing.php
CHANGED
@@ -13,7 +13,7 @@ if ( ! class_exists( 'WP' ) ) {
|
|
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/
|
17 |
|
18 |
// Build button URL.
|
19 |
$button_url = $service_url . '?url=' . $share_url;
|
@@ -21,6 +21,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
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>';
|
@@ -74,7 +75,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
|
|
74 |
);
|
75 |
|
76 |
// Fetch counts.
|
77 |
-
$xing = sanitize_text_field( wp_remote_retrieve_body( wp_remote_post( 'https://www.xing
|
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).
|
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/spi/shares/new' );
|
17 |
|
18 |
// Build button URL.
|
19 |
$button_url = $service_url . '?url=' . $share_url;
|
21 |
// Colors.
|
22 |
$main_color = '#126567';
|
23 |
$secondary_color = '#29888a';
|
24 |
+
$wcag_color = '#0F595C';
|
25 |
|
26 |
// SVG icon.
|
27 |
$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>';
|
75 |
);
|
76 |
|
77 |
// Fetch counts.
|
78 |
+
$xing = sanitize_text_field( wp_remote_retrieve_body( wp_remote_post( 'https://www.xing.com/spi/shares/statistics', $xing_post_options ) ) );
|
79 |
$xing_json = json_decode( $xing, true );
|
80 |
|
81 |
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
|
shariff.php
CHANGED
@@ -1,1592 +1,1609 @@
|
|
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.
|
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.
|
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 |
-
/**
|
50 |
-
* Add privacy policy suggestions to WordPress privacy generator introduced in WordPress 4.9.6.
|
51 |
-
*/
|
52 |
-
function shariff3uu_privacy() {
|
53 |
-
if ( function_exists( 'wp_add_privacy_policy_content' ) ) {
|
54 |
-
$content = __(
|
55 |
-
'<h2>Social Media Plugin "Shariff Wrapper"</h2>
|
56 |
-
|
57 |
-
On our website we offer you the possibility to use so called "Social Media Buttons". To protect your data, we use a solution called "Shariff". Hereby the share buttons are implemented as static images, which contain a link to the corresponding social network site. If you click on such a button, you will be redirected to the respective social network site in the same way, as normal links would do as well. Only in that moment of time the provider of the social network site will get information about you, for example your IP address. If you do not click on such a share button, no data will be transmitted. Information about the collection and usage of your date on the social network sites can be found in the corresponding terms of use of the respective provider. More information about the plugin and the Shariff solution can be found here: <a href="https://wordpress.org/plugins/shariff/">https://wordpress.org/plugins/shariff/</a>
|
58 |
-
|
59 |
-
On our website we offer share buttons for the following services / companies: AddThis, Diaspora, Facebook, Flattr, Flipboard, LinkedIn, Odnoklassniki, Patreon, PayPal, Pinterest, Pocket, Qzone, Reddit, Stumbleupon, Telegram, TencentWeibo, Threema, Tumblr, Twitter, VK, Wallabag, Weibo, WhatsApp, Xing.',
|
60 |
-
'shariff'
|
61 |
-
);
|
62 |
-
wp_add_privacy_policy_content( 'Shariff Wrapper', wp_kses_post( wpautop( $content, false ) ) );
|
63 |
-
}
|
64 |
-
}
|
65 |
-
add_action( 'admin_init', 'shariff3uu_privacy' );
|
66 |
-
|
67 |
-
/** Require Shariff Widget. */
|
68 |
-
require dirname( __FILE__ ) . '/includes/class-shariff-widget.php';
|
69 |
-
|
70 |
-
// Allowed tags for headline.
|
71 |
-
$allowed_tags = array(
|
72 |
-
// Direct formatting e.g. <strong>.
|
73 |
-
'strong' => array(),
|
74 |
-
'em' => array(),
|
75 |
-
'b' => array(),
|
76 |
-
'i' => array(),
|
77 |
-
'br' => array(),
|
78 |
-
// Elements that can be formatted via CSS.
|
79 |
-
'span' => array(
|
80 |
-
'class' => array(),
|
81 |
-
'style' => array(),
|
82 |
-
'id' => array(),
|
83 |
-
),
|
84 |
-
'div' => array(
|
85 |
-
'class' => array(),
|
86 |
-
'style' => array(),
|
87 |
-
'id' => array(),
|
88 |
-
),
|
89 |
-
'p' => array(
|
90 |
-
'class' => array(),
|
91 |
-
'style' => array(),
|
92 |
-
'id' => array(),
|
93 |
-
),
|
94 |
-
'h1' => array(
|
95 |
-
'class' => array(),
|
96 |
-
'style' => array(),
|
97 |
-
'id' => array(),
|
98 |
-
),
|
99 |
-
'h2' => array(
|
100 |
-
'class' => array(),
|
101 |
-
'style' => array(),
|
102 |
-
'id' => array(),
|
103 |
-
),
|
104 |
-
'h3' => array(
|
105 |
-
'class' => array(),
|
106 |
-
'style' => array(),
|
107 |
-
'id' => array(),
|
108 |
-
),
|
109 |
-
'h4' => array(
|
110 |
-
'class' => array(),
|
111 |
-
'style' => array(),
|
112 |
-
'id' => array(),
|
113 |
-
),
|
114 |
-
'h5' => array(
|
115 |
-
'class' => array(),
|
116 |
-
'style' => array(),
|
117 |
-
'id' => array(),
|
118 |
-
),
|
119 |
-
'h6' => array(
|
120 |
-
'class' => array(),
|
121 |
-
'style' => array(),
|
122 |
-
'id' => array(),
|
123 |
-
),
|
124 |
-
'hr' => array(
|
125 |
-
'class' => array(),
|
126 |
-
'style' => array(),
|
127 |
-
'id' => array(),
|
128 |
-
),
|
129 |
-
);
|
130 |
-
|
131 |
-
/** Admin options */
|
132 |
-
if ( is_admin() ) {
|
133 |
-
// Include admin_menu.php.
|
134 |
-
include dirname( __FILE__ ) . '/admin/admin-menu.php';
|
135 |
-
// Include admin_notices.php.
|
136 |
-
include dirname( __FILE__ ) . '/admin/admin-notices.php';
|
137 |
-
}
|
138 |
-
|
139 |
-
/** Custom meta box */
|
140 |
-
function shariff3uu_include_metabox() {
|
141 |
-
// Check if user is allowed to publish posts.
|
142 |
-
if ( current_user_can( 'publish_posts' ) ) {
|
143 |
-
// Include admin_metabox.php.
|
144 |
-
include dirname( __FILE__ ) . '/admin/admin-metabox.php';
|
145 |
-
}
|
146 |
-
}
|
147 |
-
// Check if meta box has been disabled in the options, if not add_action.
|
148 |
-
if ( ! isset( $shariff3uu['disable_metabox'] ) || isset( $shariff3uu['disable_metabox'] ) && 1 !== $shariff3uu['disable_metabox'] ) {
|
149 |
-
add_action( 'init', 'shariff3uu_include_metabox' );
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Add meta links (settings and support forum) to our entry on the plugin page.
|
154 |
-
*
|
155 |
-
* @param array $links Array of all current links.
|
156 |
-
* @param string $file Path to plugin of the current element.
|
157 |
-
*
|
158 |
-
* @return array New array including our links to settings and support forum.
|
159 |
-
*/
|
160 |
-
function shariff3uu_meta_links( $links, $file ) {
|
161 |
-
$plugin = plugin_basename( __FILE__ );
|
162 |
-
// Create link.
|
163 |
-
if ( $file === $plugin ) {
|
164 |
-
return array_merge(
|
165 |
-
$links,
|
166 |
-
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>' )
|
167 |
-
);
|
168 |
-
}
|
169 |
-
return $links;
|
170 |
-
}
|
171 |
-
add_filter( 'plugin_row_meta', 'shariff3uu_meta_links', 10, 2 );
|
172 |
-
|
173 |
-
/** Initialize translations. */
|
174 |
-
function shariff_init_locale() {
|
175 |
-
if ( function_exists( 'load_plugin_textdomain' ) ) {
|
176 |
-
load_plugin_textdomain( 'shariff' );
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
/** Register the wp rest api route and sanitize the input */
|
181 |
-
function shariff3uu_sanitize_api() {
|
182 |
-
register_rest_route(
|
183 |
-
'shariff/v1',
|
184 |
-
'/share_counts',
|
185 |
-
array(
|
186 |
-
'methods' => 'GET',
|
187 |
-
'callback' => 'shariff3uu_share_counts',
|
188 |
-
'args' => array(
|
189 |
-
'url' => array(
|
190 |
-
'sanitize_callback' => 'esc_url',
|
191 |
-
'required' => true,
|
192 |
-
'description' => __( 'URL of the post or page to request share counts for.', 'shariff' ),
|
193 |
-
),
|
194 |
-
'services' => array(
|
195 |
-
'sanitize_callback' => 'sanitize_text_field',
|
196 |
-
'required' => true,
|
197 |
-
'description' => __( 'A list of services separated by |. Example: twitter|facebook|xing', 'shariff' ),
|
198 |
-
),
|
199 |
-
'timestamp' => array(
|
200 |
-
'sanitize_callback' => 'absint',
|
201 |
-
'description' => __( 'Timestamp of the last update of the post. Used for dynamic cache lifespan.', 'shariff' ),
|
202 |
-
),
|
203 |
-
),
|
204 |
-
)
|
205 |
-
);
|
206 |
-
}
|
207 |
-
add_action( 'rest_api_init', 'shariff3uu_sanitize_api' );
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Provide share counts via the wp rest api.
|
211 |
-
*
|
212 |
-
* @param WP_REST_Request $request Incoming request.
|
213 |
-
*
|
214 |
-
* @return string Returns the share counts for all requested services if available or an error message.
|
215 |
-
*/
|
216 |
-
function shariff3uu_share_counts( WP_REST_Request $request ) {
|
217 |
-
// Get options.
|
218 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
219 |
-
|
220 |
-
// Setup Parameters.
|
221 |
-
$url = urldecode( $request['url'] );
|
222 |
-
$services = $request['services'];
|
223 |
-
$timestamp = $request['timestamp'];
|
224 |
-
|
225 |
-
// Exit if no url is provided and provide an error message.
|
226 |
-
if ( empty( $url ) || 'undefined' === $url ) {
|
227 |
-
return new WP_Error( 'nourl', 'No URL provided!', array( 'status' => 400 ) );
|
228 |
-
}
|
229 |
-
|
230 |
-
// Exit if no services are provided and provide an error message.
|
231 |
-
if ( empty( $services ) || 'undefined' === $services ) {
|
232 |
-
return new WP_Error( 'noservices', 'No services provided!', array( 'status' => 400 ) );
|
233 |
-
}
|
234 |
-
|
235 |
-
// Make sure that the provided url matches the WordPress domain.
|
236 |
-
$get_url = wp_parse_url( $url );
|
237 |
-
$wp_url = wp_parse_url( get_bloginfo( 'url' ) );
|
238 |
-
// On an external backend check allowed hosts, else compare that domain is equal.
|
239 |
-
if ( defined( 'SHARIFF_FRONTENDS' ) ) {
|
240 |
-
$shariff_frontends = array_flip( explode( '|', SHARIFF_FRONTENDS ) );
|
241 |
-
if ( ! isset( $get_url['host'] ) || ! array_key_exists( $get_url['host'], $shariff_frontends ) ) {
|
242 |
-
return new WP_Error( 'externaldomainnotallowed', 'External domain not allowed by this server!', array( 'status' => 400 ) );
|
243 |
-
}
|
244 |
-
} elseif ( ! isset( $get_url['host'] ) || $get_url['host'] !== $wp_url['host'] ) {
|
245 |
-
return new WP_Error( 'domainnotallowed', 'Domain not allowed by this server!', array( 'status' => 400 ) );
|
246 |
-
}
|
247 |
-
|
248 |
-
// Encode the shareurl.
|
249 |
-
$post_url = rawurlencode( $url );
|
250 |
-
$post_url_raw = $url;
|
251 |
-
|
252 |
-
// Set transient name.
|
253 |
-
// Transient names can only contain 40 characters, therefore we use a hash (md5 always creates a 32 character hash).
|
254 |
-
// We need a prefix so we can clean up on uninstall and updates.
|
255 |
-
$post_hash = 'shariff' . hash( 'md5', $post_url );
|
256 |
-
|
257 |
-
// Check for ttl option, must be between 60 and 7200 seconds.
|
258 |
-
if ( isset( $shariff3uu['ttl'] ) ) {
|
259 |
-
$ttl = absint( $shariff3uu['ttl'] );
|
260 |
-
// Make sure ttl is a reasonable number.
|
261 |
-
if ( $ttl < '61' ) {
|
262 |
-
$ttl = '60';
|
263 |
-
} elseif ( $ttl > '7200' ) {
|
264 |
-
$ttl = '7200';
|
265 |
-
}
|
266 |
-
} else {
|
267 |
-
// Else set it to new default (five minutes).
|
268 |
-
$ttl = '300';
|
269 |
-
}
|
270 |
-
|
271 |
-
// Adjust ttl based on the post age.
|
272 |
-
if ( isset( $timestamp ) && ( ! isset( $shariff3uu['disable_dynamic_cache'] ) || ( isset( $shariff3uu['disable_dynamic_cache'] ) && 1 !== $shariff3uu['disable_dynamic_cache'] ) ) ) {
|
273 |
-
// The timestamp represents the last time the post or page was modified.
|
274 |
-
$post_time = intval( $timestamp );
|
275 |
-
$current_time = current_time( 'timestamp', true );
|
276 |
-
$post_age = round( abs( $current_time - $post_time ) );
|
277 |
-
if ( $post_age > '0' ) {
|
278 |
-
$post_age_days = round( $post_age / 60 / 60 / 24 );
|
279 |
-
// Make sure ttl base is not getting too high.
|
280 |
-
if ( $ttl > '300' ) {
|
281 |
-
$ttl = '300';
|
282 |
-
}
|
283 |
-
$ttl = round( ( $ttl + $post_age_days * 3 ) * ( $post_age_days * 2 ) );
|
284 |
-
}
|
285 |
-
|
286 |
-
// Set minimum ttl to 60 seconds and maximum ttl to one week.
|
287 |
-
if ( $ttl < '60' ) {
|
288 |
-
$ttl = '60';
|
289 |
-
} elseif ( $ttl > '604800' ) {
|
290 |
-
$ttl = '604800';
|
291 |
-
}
|
292 |
-
|
293 |
-
// In case we get a timestamp older than 01.01.2000 or for example a 0, use a reasonable default value of five minutes.
|
294 |
-
if ( $post_time < '946684800' ) {
|
295 |
-
$ttl = '300';
|
296 |
-
}
|
297 |
-
}
|
298 |
-
|
299 |
-
// Set the default value.
|
300 |
-
$need_update = false;
|
301 |
-
|
302 |
-
// Remove totalnumber for array.
|
303 |
-
$real_services = str_replace( 'totalnumber|', '', $services );
|
304 |
-
$real_services = str_replace( '|totalnumber', '', $real_services );
|
305 |
-
|
306 |
-
// Explode services.
|
307 |
-
$service_array = explode( '|', $real_services );
|
308 |
-
|
309 |
-
// Remove duplicated entries.
|
310 |
-
$service_array = array_unique( $service_array );
|
311 |
-
|
312 |
-
// Get old share counts.
|
313 |
-
if ( get_transient( $post_hash ) !== false ) {
|
314 |
-
$old_share_counts = get_transient( $post_hash );
|
315 |
-
} else {
|
316 |
-
$old_share_counts = array();
|
317 |
-
}
|
318 |
-
|
319 |
-
// Check if we need to update.
|
320 |
-
if ( get_transient( $post_hash ) !== false ) {
|
321 |
-
// Check timestamp.
|
322 |
-
$diff = current_time( 'timestamp', true ) - $old_share_counts['timestamp'];
|
323 |
-
if ( $diff > $ttl ) {
|
324 |
-
$need_update = true;
|
325 |
-
}
|
326 |
-
// Check if we have a different set of services than stored in the cache.
|
327 |
-
$diff_array = array_diff_key( array_flip( $service_array ), $old_share_counts );
|
328 |
-
if ( ! empty( $diff_array ) ) {
|
329 |
-
$need_update = true;
|
330 |
-
// We only need to update the missing service.
|
331 |
-
$service_array = array_flip( $diff_array );
|
332 |
-
}
|
333 |
-
} else {
|
334 |
-
$need_update = true;
|
335 |
-
}
|
336 |
-
|
337 |
-
// Prevent php notices if debug mode is enabled.
|
338 |
-
$response = '';
|
339 |
-
$share_counts = array();
|
340 |
-
|
341 |
-
// If we do not need an update, use stored data.
|
342 |
-
if ( false === $need_update ) {
|
343 |
-
$share_counts = $old_share_counts;
|
344 |
-
// Provide update info for debugging and support.
|
345 |
-
$share_counts['updated'] = '0';
|
346 |
-
} elseif ( 'totalnumber' === $services ) {
|
347 |
-
// If only totalnumber is requested we only use cached data.
|
348 |
-
$share_counts = $old_share_counts;
|
349 |
-
} elseif ( isset( $shariff3uu['external_host'] ) && ! empty( $shariff3uu['external_host'] ) ) {
|
350 |
-
// Check if we want to use an external API.
|
351 |
-
$response = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( $shariff3uu['external_host'] . '?url=' . rawurlencode( $url ) . '&services=' . $services . '×tamp=' . $timestamp . '"' ) ) );
|
352 |
-
// Decode response.
|
353 |
-
$share_counts = json_decode( $response, true );
|
354 |
-
// Save transient.
|
355 |
-
set_transient( $post_hash, $share_counts, '604800' );
|
356 |
-
// Offer a hook to work with the share counts.
|
357 |
-
do_action( 'shariff_share_counts', $share_counts );
|
358 |
-
} else {
|
359 |
-
// Else we fetch new counts ourselves.
|
360 |
-
$share_counts = shariff3uu_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $post_url_raw );
|
361 |
-
}
|
362 |
-
|
363 |
-
// Return results, if we have some or an error message if not.
|
364 |
-
if ( isset( $share_counts ) && null !== $share_counts ) {
|
365 |
-
return $share_counts;
|
366 |
-
} else {
|
367 |
-
return new WP_Error( 'nodata', 'Could not receive any data.', array( 'status' => 400 ) );
|
368 |
-
}
|
369 |
-
}
|
370 |
-
|
371 |
-
/**
|
372 |
-
* Fetch share counts.
|
373 |
-
*
|
374 |
-
* @param array $service_array Array with the desired services.
|
375 |
-
* @param array $old_share_counts Array of all already stored share counts.
|
376 |
-
* @param string $post_hash MD5-Hash of the current post.
|
377 |
-
* @param string $post_url_raw Raw URL of the current post.
|
378 |
-
*
|
379 |
-
* @return array Array of all fetched share counts.
|
380 |
-
*/
|
381 |
-
function shariff3uu_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $post_url_raw ) {
|
382 |
-
// We only need the backend part from the service phps.
|
383 |
-
$backend = 1;
|
384 |
-
|
385 |
-
// Encode the shareurl.
|
386 |
-
$post_url = rawurlencode( esc_url( $post_url_raw ) );
|
387 |
-
|
388 |
-
// Get options.
|
389 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
390 |
-
|
391 |
-
// Prevent php notices.
|
392 |
-
$total_count = 0;
|
393 |
-
$share_counts = array();
|
394 |
-
|
395 |
-
// Loop through all desired services.
|
396 |
-
foreach ( $service_array as $service ) {
|
397 |
-
// Only include services that are not disabled.
|
398 |
-
if ( ! empty( $service ) && ( ! isset( $shariff3uu['disable'][ $service ] ) || ( isset( $shariff3uu['disable'][ $service ] ) && 0 === $shariff3uu['disable'][ $service ] ) ) ) {
|
399 |
-
// Determine path.
|
400 |
-
$path_service_file = dirname( __FILE__ ) . '/services/shariff-' . $service . '.php';
|
401 |
-
// Include service files.
|
402 |
-
if ( file_exists( $path_service_file ) ) {
|
403 |
-
include $path_service_file;
|
404 |
-
}
|
405 |
-
// if we have an error (e.g. a timeout) and we have an old share count for this service, keep it!
|
406 |
-
if ( array_key_exists( $service, $old_share_counts ) && ( ! array_key_exists( $service, $share_counts ) || empty( $share_counts[ $service ] ) ) ) {
|
407 |
-
$share_counts[ $service ] = $old_share_counts[ $service ];
|
408 |
-
}
|
409 |
-
}
|
410 |
-
// Calculate total share count.
|
411 |
-
if ( isset( $share_counts[ $service ] ) ) {
|
412 |
-
$total_count = $total_count + $share_counts[ $service ];
|
413 |
-
}
|
414 |
-
}
|
415 |
-
|
416 |
-
// Add total count.
|
417 |
-
if ( 0 !== $total_count ) {
|
418 |
-
$share_counts['total'] = $total_count;
|
419 |
-
}
|
420 |
-
|
421 |
-
// Save transient, if we have counts.
|
422 |
-
if ( isset( $share_counts ) ) {
|
423 |
-
// Add current timestamp and url.
|
424 |
-
$share_counts['timestamp'] = current_time( 'timestamp', true );
|
425 |
-
$share_counts['url'] = $post_url_raw;
|
426 |
-
// Combine different set of services.
|
427 |
-
if ( get_transient( $post_hash ) !== false ) {
|
428 |
-
$other_request = get_transient( $post_hash );
|
429 |
-
$share_counts = array_merge( $other_request, $share_counts );
|
430 |
-
}
|
431 |
-
// Save transient.
|
432 |
-
set_transient( $post_hash, $share_counts, '604800' );
|
433 |
-
// Offer a hook to work with the share counts.
|
434 |
-
do_action( 'shariff_share_counts', $share_counts );
|
435 |
-
// Update info.
|
436 |
-
$share_counts['updated'] = 1;
|
437 |
-
} elseif ( isset( $old_share_counts ) ) {
|
438 |
-
$share_counts = $old_share_counts;
|
439 |
-
// Update info.
|
440 |
-
$share_counts['updated'] = '0';
|
441 |
-
}
|
442 |
-
|
443 |
-
// Return share counts.
|
444 |
-
return $share_counts;
|
445 |
-
}
|
446 |
-
|
447 |
-
/**
|
448 |
-
* Fills cache automatically.
|
449 |
-
*/
|
450 |
-
function shariff3uu_fill_cache() {
|
451 |
-
// Amount of posts - set to 100 if not set.
|
452 |
-
if ( isset( $GLOBALS['shariff3uu']['ranking'] ) && absint( $GLOBALS['shariff3uu']['ranking'] ) > '0' ) {
|
453 |
-
$numberposts = absint( $GLOBALS['shariff3uu']['ranking'] );
|
454 |
-
} else {
|
455 |
-
$numberposts = '100';
|
456 |
-
}
|
457 |
-
|
458 |
-
// Avoid errors if no services are given - instead use the default set of services.
|
459 |
-
if ( empty( $GLOBALS['shariff3uu']['services'] ) ) {
|
460 |
-
$services = 'twitter|facebook|linkedin';
|
461 |
-
} else {
|
462 |
-
$services = $GLOBALS['shariff3uu']['services'];
|
463 |
-
}
|
464 |
-
|
465 |
-
// Explode services.
|
466 |
-
$service_array = explode( '|', $services );
|
467 |
-
|
468 |
-
// Arguments for wp_get_recent_posts().
|
469 |
-
$args = array(
|
470 |
-
'numberposts' => $numberposts,
|
471 |
-
'orderby' => 'post_date',
|
472 |
-
'order' => 'DESC',
|
473 |
-
'post_status' => 'publish',
|
474 |
-
'suppress_filters' => false,
|
475 |
-
);
|
476 |
-
|
477 |
-
// Catch last 100 posts or whatever number is set for it.
|
478 |
-
$recent_posts = wp_get_recent_posts( $args );
|
479 |
-
if ( $recent_posts ) {
|
480 |
-
foreach ( $recent_posts as $recent ) {
|
481 |
-
// Get the url.
|
482 |
-
$url = get_permalink( $recent['ID'] );
|
483 |
-
$post_url = rawurlencode( $url );
|
484 |
-
// Set transient name.
|
485 |
-
$post_hash = 'shariff' . hash( 'md5', $post_url );
|
486 |
-
// Get old share counts.
|
487 |
-
if ( get_transient( $post_hash ) !== false ) {
|
488 |
-
$old_share_counts = get_transient( $post_hash );
|
489 |
-
} else {
|
490 |
-
$old_share_counts = array();
|
491 |
-
}
|
492 |
-
// Fetch share counts and save them.
|
493 |
-
shariff3uu_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $url );
|
494 |
-
}
|
495 |
-
}
|
496 |
-
}
|
497 |
-
add_action( 'shariff3uu_fill_cache', 'shariff3uu_fill_cache' );
|
498 |
-
|
499 |
-
/**
|
500 |
-
* Adds schedule event in order to fill cache automatically.
|
501 |
-
*/
|
502 |
-
function shariff3uu_fill_cache_schedule() {
|
503 |
-
// Get options manually bc of start on activation.
|
504 |
-
$shariff3uu_statistic = (array) get_option( 'shariff3uu_statistic' );
|
505 |
-
// Check if option is set.
|
506 |
-
if ( isset( $shariff3uu_statistic['automaticcache'] ) && 1 === $shariff3uu_statistic['automaticcache'] ) {
|
507 |
-
// Check if job is already scheduled.
|
508 |
-
if ( ! wp_next_scheduled( 'shariff3uu_fill_cache' ) ) {
|
509 |
-
// Add cron job.
|
510 |
-
wp_schedule_event( time(), 'weekly', 'shariff3uu_fill_cache' );
|
511 |
-
}
|
512 |
-
} else {
|
513 |
-
// Else option is not set therefore remove cron job if scheduled.
|
514 |
-
if ( wp_next_scheduled( 'shariff3uu_fill_cache' ) ) {
|
515 |
-
// Remove cron job.
|
516 |
-
wp_clear_scheduled_hook( 'shariff3uu_fill_cache' );
|
517 |
-
}
|
518 |
-
}
|
519 |
-
}
|
520 |
-
add_action( 'shariff3uu_save_statistic_options', 'shariff3uu_fill_cache_schedule' );
|
521 |
-
|
522 |
-
/** Registers activation hook to start cron job after an update. */
|
523 |
-
register_activation_hook( __FILE__, 'shariff3uu_fill_cache_schedule' );
|
524 |
-
|
525 |
-
/**
|
526 |
-
* Adds custom weekly cron recurrences.
|
527 |
-
*
|
528 |
-
* @param array $schedules Array of existing schedules.
|
529 |
-
*
|
530 |
-
* @return array Updated array including our new schedule.
|
531 |
-
*/
|
532 |
-
function shariff3uu_fill_cache_schedule_custom_recurrence( $schedules ) {
|
533 |
-
$schedules['weekly'] = array(
|
534 |
-
'display' => __( 'Once weekly', 'shariff' ),
|
535 |
-
'interval' => 604800,
|
536 |
-
);
|
537 |
-
return $schedules;
|
538 |
-
}
|
539 |
-
add_filter( 'cron_schedules', 'shariff3uu_fill_cache_schedule_custom_recurrence' );
|
540 |
-
|
541 |
-
/**
|
542 |
-
* Adds short tag to posts and pages (including custom post types).
|
543 |
-
*
|
544 |
-
* @param string $content The current post content.
|
545 |
-
*
|
546 |
-
* @return string The post content including our short tag.
|
547 |
-
*/
|
548 |
-
function shariff3uu_posts( $content ) {
|
549 |
-
// Get options.
|
550 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
551 |
-
|
552 |
-
// Do not add Shariff to excerpts or outside the loop, if option is checked.
|
553 |
-
if ( in_array( 'get_the_excerpt', $GLOBALS['wp_current_filter'], true ) || ( ! in_the_loop() && isset( $shariff3uu['disable_outside_loop'] ) && 1 === $shariff3uu['disable_outside_loop'] ) ) {
|
554 |
-
return $content;
|
555 |
-
}
|
556 |
-
|
557 |
-
// Disable share buttons on password protected posts if configured in the admin menu.
|
558 |
-
if ( ( 1 === post_password_required( get_the_ID() ) || ! empty( $GLOBALS['post']->post_password ) ) && isset( $shariff3uu['disable_on_protected'] ) && 1 === $shariff3uu['disable_on_protected'] ) {
|
559 |
-
$shariff3uu['add_before']['posts'] = 0;
|
560 |
-
$shariff3uu['add_before']['posts_blogpage'] = 0;
|
561 |
-
$shariff3uu['add_before']['pages'] = 0;
|
562 |
-
$shariff3uu['add_after']['posts'] = 0;
|
563 |
-
$shariff3uu['add_after']['posts_blogpage'] = 0;
|
564 |
-
$shariff3uu['add_after']['pages'] = 0;
|
565 |
-
$shariff3uu['add_after']['custom_type'] = 0;
|
566 |
-
}
|
567 |
-
|
568 |
-
// If we want to see it as text - replace the slash.
|
569 |
-
if ( false !== strpos( $content, '/hideshariff' ) ) {
|
570 |
-
$content = str_replace( '/hideshariff', 'hideshariff', $content );
|
571 |
-
} elseif ( false !== strpos( $content, 'hideshariff' ) ) {
|
572 |
-
// Remove the sign.
|
573 |
-
$content = str_replace( 'hideshariff', '', $content );
|
574 |
-
// Return the content without adding Shariff.
|
575 |
-
return $content;
|
576 |
-
}
|
577 |
-
|
578 |
-
// Type of current post.
|
579 |
-
$current_post_type = get_post_type();
|
580 |
-
if ( 'post' === $current_post_type ) {
|
581 |
-
$current_post_type = 'posts';
|
582 |
-
}
|
583 |
-
|
584 |
-
// Prevent php warnings in debug mode.
|
585 |
-
$add_before = 0;
|
586 |
-
$add_after = 0;
|
587 |
-
|
588 |
-
// Check if shariff should be added automatically (plugin options).
|
589 |
-
if ( ! is_singular() ) {
|
590 |
-
// On blog page.
|
591 |
-
if ( isset( $shariff3uu['add_before']['posts_blogpage'] ) && 1 === $shariff3uu['add_before']['posts_blogpage'] ) {
|
592 |
-
$add_before = 1;
|
593 |
-
}
|
594 |
-
if ( isset( $shariff3uu['add_after']['posts_blogpage'] ) && 1 === $shariff3uu['add_after']['posts_blogpage'] ) {
|
595 |
-
$add_after = 1;
|
596 |
-
}
|
597 |
-
} elseif ( is_singular( 'post' ) ) {
|
598 |
-
// On single post.
|
599 |
-
if ( isset( $shariff3uu['add_before'][ $current_post_type ] ) && 1 === $shariff3uu['add_before'][ $current_post_type ] ) {
|
600 |
-
$add_before = 1;
|
601 |
-
}
|
602 |
-
if ( isset( $shariff3uu['add_after'][ $current_post_type ] ) && 1 === $shariff3uu['add_after'][ $current_post_type ] ) {
|
603 |
-
$add_after = 1;
|
604 |
-
}
|
605 |
-
} elseif ( is_singular( 'page' ) ) {
|
606 |
-
// On pages.
|
607 |
-
if ( isset( $shariff3uu['add_before']['pages'] ) && 1 === $shariff3uu['add_before']['pages'] ) {
|
608 |
-
$add_before = 1;
|
609 |
-
}
|
610 |
-
if ( isset( $shariff3uu['add_after']['pages'] ) && 1 === $shariff3uu['add_after']['pages'] ) {
|
611 |
-
$add_after = 1;
|
612 |
-
}
|
613 |
-
} else {
|
614 |
-
// On custom_post_types.
|
615 |
-
$all_custom_post_types = get_post_types( array( '_builtin' => false ) );
|
616 |
-
if ( is_array( $all_custom_post_types ) ) {
|
617 |
-
$custom_types = array_keys( $all_custom_post_types );
|
618 |
-
// Add shariff, if custom type and option checked in the admin menu.
|
619 |
-
if ( isset( $shariff3uu['add_before'][ $current_post_type ] ) && 1 === $shariff3uu['add_before'][ $current_post_type ] ) {
|
620 |
-
$add_before = 1;
|
621 |
-
}
|
622 |
-
if ( isset( $shariff3uu['add_after'][ $current_post_type ] ) && 1 === $shariff3uu['add_after'][ $current_post_type ] ) {
|
623 |
-
$add_after = 1;
|
624 |
-
}
|
625 |
-
}
|
626 |
-
}
|
627 |
-
|
628 |
-
// Check if buttons are enabled on a single post or page via the meta box.
|
629 |
-
if ( get_post_meta( get_the_ID(), 'shariff_metabox_before', true ) ) {
|
630 |
-
$add_before = 1;
|
631 |
-
}
|
632 |
-
if ( get_post_meta( get_the_ID(), 'shariff_metabox_after', true ) ) {
|
633 |
-
$add_after = 1;
|
634 |
-
}
|
635 |
-
|
636 |
-
// Add shariff.
|
637 |
-
if ( 1 === $add_before ) {
|
638 |
-
$content = '[shariff]' . $content;
|
639 |
-
}
|
640 |
-
if ( 1 === $add_after ) {
|
641 |
-
$content .= '[shariff]';
|
642 |
-
}
|
643 |
-
|
644 |
-
// Return content.
|
645 |
-
return $content;
|
646 |
-
}
|
647 |
-
if ( ! isset( $GLOBALS['shariff3uu']['shortcodeprio'] ) ) {
|
648 |
-
$GLOBALS['shariff3uu']['shortcodeprio'] = '10';
|
649 |
-
}
|
650 |
-
add_filter( 'the_content', 'shariff3uu_posts', $GLOBALS['shariff3uu']['shortcodeprio'] );
|
651 |
-
|
652 |
-
/**
|
653 |
-
* Add shorttag to excerpt.
|
654 |
-
*
|
655 |
-
* @param string $content The current content of the excerpt.
|
656 |
-
*
|
657 |
-
* @return string The new content of the post including the shorttag.
|
658 |
-
*/
|
659 |
-
function shariff3uu_excerpt( $content ) {
|
660 |
-
// Get options.
|
661 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
662 |
-
// Remove headline in post.
|
663 |
-
if ( isset( $shariff3uu['headline'] ) ) {
|
664 |
-
$content = str_replace( wp_strip_all_tags( $shariff3uu['headline'] ), ' ', $content );
|
665 |
-
}
|
666 |
-
// Add shariff before the excerpt, if option checked in the admin menu.
|
667 |
-
if ( isset( $shariff3uu['add_before']['excerpt'] ) && 1 === $shariff3uu['add_before']['excerpt'] ) {
|
668 |
-
$content = do_shortcode( '[shariff]' ) . $content;
|
669 |
-
}
|
670 |
-
// Add shariff after the excerpt, if option checked in the admin menu.
|
671 |
-
if ( isset( $shariff3uu['add_after']['excerpt'] ) && 1 === $shariff3uu['add_after']['excerpt'] ) {
|
672 |
-
$content .= do_shortcode( '[shariff]' );
|
673 |
-
}
|
674 |
-
return $content;
|
675 |
-
}
|
676 |
-
add_filter( 'the_excerpt', 'shariff3uu_excerpt' );
|
677 |
-
|
678 |
-
/**
|
679 |
-
* Removes hideshariff from content in cases of excerpts or other plain text usages.
|
680 |
-
*
|
681 |
-
* @param string $content The current content of the post.
|
682 |
-
*
|
683 |
-
* @return string The modified content without hideshariff.
|
684 |
-
*/
|
685 |
-
function shariff3uu_hideshariff( $content ) {
|
686 |
-
if ( true === strpos( $content, 'hideshariff' ) ) {
|
687 |
-
$content = str_replace( 'hideshariff', '', $content );
|
688 |
-
}
|
689 |
-
return $content;
|
690 |
-
}
|
691 |
-
add_filter( 'the_content', 'shariff3uu_hideshariff', 999 );
|
692 |
-
|
693 |
-
/**
|
694 |
-
* Removes shariff from rss feeds.
|
695 |
-
*
|
696 |
-
* @param string $content The current content of the post.
|
697 |
-
*
|
698 |
-
* @return string The modified content without shariff.
|
699 |
-
*/
|
700 |
-
function shariff3uu_remove_from_rss( $content ) {
|
701 |
-
$content = preg_replace( '/<div class="shariff\b[^>]*>(.*?)<\/div>/i', '', $content );
|
702 |
-
$content = preg_replace( '/<div class="ShariffSC\b[^>]*>(.*?)<\/div>/i', '', $content );
|
703 |
-
return $content;
|
704 |
-
}
|
705 |
-
add_filter( 'the_content_feed', 'shariff3uu_remove_from_rss', 999 );
|
706 |
-
|
707 |
-
/**
|
708 |
-
* Adds shariff buttons after bbpress forums.
|
709 |
-
*/
|
710 |
-
function shariff3uu_bbp_add_shariff_after_forum() {
|
711 |
-
// Get options.
|
712 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
713 |
-
if ( isset( $shariff3uu['add_after']['forum'] ) && 1 === $shariff3uu['add_after']['forum'] ) {
|
714 |
-
// phpcs:ignore
|
715 |
-
echo shariff3uu_render( array() );
|
716 |
-
}
|
717 |
-
}
|
718 |
-
add_action( 'bbp_template_after_forums_loop', 'shariff3uu_bbp_add_shariff_after_forum' );
|
719 |
-
|
720 |
-
/**
|
721 |
-
* Adds shariff buttons after bbpress topics.
|
722 |
-
*/
|
723 |
-
function shariff3uu_bbp_add_shariff_after_topic() {
|
724 |
-
// Get options.
|
725 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
726 |
-
if ( isset( $shariff3uu['add_after']['topic'] ) && 1 === $shariff3uu['add_after']['topic'] ) {
|
727 |
-
// phpcs:ignore
|
728 |
-
echo shariff3uu_render( array() );
|
729 |
-
}
|
730 |
-
}
|
731 |
-
add_action( 'bbp_template_after_topics_loop', 'shariff3uu_bbp_add_shariff_after_topic' );
|
732 |
-
|
733 |
-
/**
|
734 |
-
* Adds shariff buttons after bbpress replies.
|
735 |
-
*/
|
736 |
-
function shariff3uu_bbp_add_shariff_after_reply() {
|
737 |
-
// Get options.
|
738 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
739 |
-
if ( isset( $shariff3uu['add_after']['reply'] ) && 1 === $shariff3uu['add_after']['reply'] ) {
|
740 |
-
// phpcs:ignore
|
741 |
-
echo shariff3uu_render( array() );
|
742 |
-
}
|
743 |
-
}
|
744 |
-
add_action( 'bbp_theme_after_reply_content', 'shariff3uu_bbp_add_shariff_after_reply' );
|
745 |
-
|
746 |
-
/**
|
747 |
-
* Adds shariff buttons before bbpress forums.
|
748 |
-
*/
|
749 |
-
function shariff3uu_bbp_add_shariff_before_forum() {
|
750 |
-
// Get options.
|
751 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
752 |
-
if ( isset( $shariff3uu['add_before']['forum'] ) && 1 === $shariff3uu['add_before']['forum'] ) {
|
753 |
-
// phpcs:ignore
|
754 |
-
echo shariff3uu_render( array() );
|
755 |
-
}
|
756 |
-
}
|
757 |
-
add_action( 'bbp_template_before_forums_loop', 'shariff3uu_bbp_add_shariff_before_forum' );
|
758 |
-
|
759 |
-
/**
|
760 |
-
* Adds shariff buttons before bbpress topics.
|
761 |
-
*/
|
762 |
-
function shariff3uu_bbp_add_shariff_before_topic() {
|
763 |
-
// Get options.
|
764 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
765 |
-
if ( isset( $shariff3uu['add_before']['topic'] ) && 1 === $shariff3uu['add_before']['topic'] ) {
|
766 |
-
// phpcs:ignore
|
767 |
-
echo shariff3uu_render( array() );
|
768 |
-
}
|
769 |
-
}
|
770 |
-
add_action( 'bbp_template_before_topics_loop', 'shariff3uu_bbp_add_shariff_before_topic' );
|
771 |
-
|
772 |
-
/**
|
773 |
-
* Adds shariff buttons before bbpress replies.
|
774 |
-
*/
|
775 |
-
function shariff3uu_bbp_add_shariff_before_reply() {
|
776 |
-
// Get options.
|
777 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
778 |
-
if ( isset( $shariff3uu['add_before']['reply'] ) && 1 === $shariff3uu['add_before']['reply'] ) {
|
779 |
-
// phpcs:ignore
|
780 |
-
echo shariff3uu_render( array() );
|
781 |
-
}
|
782 |
-
}
|
783 |
-
add_action( 'bbp_theme_before_reply_content', 'shariff3uu_bbp_add_shariff_before_reply' );
|
784 |
-
|
785 |
-
/**
|
786 |
-
* Adds shariff to custom hooks.
|
787 |
-
*/
|
788 |
-
function shariff3uu_add_shariff_custom_hooks() {
|
789 |
-
// Get options.
|
790 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
791 |
-
|
792 |
-
if ( isset( $shariff3uu['custom_hooks_shortcode'] ) && ! empty( $shariff3uu['custom_hooks_shortcode'] ) ) {
|
793 |
-
// Replaces shariff with shariffmeta.
|
794 |
-
$shariff3uu_custom_hooks_shortcode = str_replace( '[shariff ', '[shariffmeta ', $shariff3uu['custom_hooks_shortcode'] );
|
795 |
-
|
796 |
-
// Extracts attributes.
|
797 |
-
if ( '[shariffmeta]' !== $shariff3uu_custom_hooks_shortcode ) {
|
798 |
-
do_shortcode( $shariff3uu_custom_hooks_shortcode );
|
799 |
-
}
|
800 |
-
|
801 |
-
if ( isset( $GLOBALS['shariff3uu']['metabox'] ) && ! empty( $GLOBALS['shariff3uu']['metabox'] ) ) {
|
802 |
-
$shariff3uu_custom_hooks_shortcode = $GLOBALS['shariff3uu']['metabox'];
|
803 |
-
} else {
|
804 |
-
$shariff3uu_custom_hooks_shortcode = array();
|
805 |
-
}
|
806 |
-
|
807 |
-
// Clears the metabox global.
|
808 |
-
$GLOBALS['shariff3uu']['metabox'] = '';
|
809 |
-
|
810 |
-
// phpcs:ignore
|
811 |
-
echo shariff3uu_render( $shariff3uu_custom_hooks_shortcode );
|
812 |
-
} else {
|
813 |
-
// phpcs:ignore
|
814 |
-
echo shariff3uu_render( array() );
|
815 |
-
}
|
816 |
-
}
|
817 |
-
if ( isset( $shariff3uu['custom_hooks'] ) && ! empty( $shariff3uu['custom_hooks'] ) ) {
|
818 |
-
// Explodes hooks.
|
819 |
-
$hook_array = explode( '|', $shariff3uu['custom_hooks'] );
|
820 |
-
|
821 |
-
// Remove duplicated hooks.
|
822 |
-
$hook_array = array_unique( $hook_array );
|
823 |
-
|
824 |
-
// Loops through all desired hooks.
|
825 |
-
foreach ( $hook_array as $hook ) {
|
826 |
-
add_action( esc_html( $hook ), 'shariff3uu_add_shariff_custom_hooks' );
|
827 |
-
}
|
828 |
-
}
|
829 |
-
|
830 |
-
/**
|
831 |
-
* Function is called to include the shariff.css in the header of AMP pages.
|
832 |
-
* Currently only called by the amp_post_template_css hook.
|
833 |
-
* Supports the AMP plugin by Automatic and the AMP for WP plugin by Ahmed and Mohammed Kaludi.
|
834 |
-
* We need to strip out all !important in order to pass AMP test.
|
835 |
-
*/
|
836 |
-
function shariff3uu_amp_css() {
|
837 |
-
// Get options.
|
838 |
-
$shariff3uu = $GLOBALS['shariff3uu'];
|
839 |
-
// Output CSS.
|
840 |
-
ob_start();
|
841 |
-
include dirname( __FILE__ ) . '/css/shariff.min.css';
|
842 |
-
$shariff_css = ob_get_clean();
|
843 |
-
if ( false !== $shariff_css ) {
|
844 |
-
echo esc_html( str_replace( '!important', '', $shariff_css ) );
|
845 |
-
} else {
|
846 |
-
include dirname( __FILE__ ) . '/css/shariff.min.css';
|
847 |
-
}
|
848 |
-
if ( array_key_exists( 'dynamic_css', $shariff3uu ) && ! empty( $shariff3uu['dynamic_css'] ) ) {
|
849 |
-
echo esc_html( $shariff3uu['dynamic_css'] );
|
850 |
-
}
|
851 |
-
}
|
852 |
-
add_action( 'amp_post_template_css', 'shariff3uu_amp_css' );
|
853 |
-
|
854 |
-
// Registers the shortcode.
|
855 |
-
add_shortcode( 'shariff', 'shariff3uu_render' );
|
856 |
-
|
857 |
-
/**
|
858 |
-
* Renders the shorttag to the HTML shorttag of Shariff.
|
859 |
-
*
|
860 |
-
* @param array $atts (optional) Array of shariff options provided in the shorttag.
|
861 |
-
*
|
862 |
-
* @return string|null The rendered HTML shorttag or null if a disable condition is met.
|
863 |
-
*/
|
864 |
-
function shariff3uu_render( $atts ) {
|
865 |
-
// Get options.
|
866 |
-
$
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
}
|
877 |
-
|
878 |
-
//
|
879 |
-
if (
|
880 |
-
|
881 |
-
}
|
882 |
-
|
883 |
-
//
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
$
|
898 |
-
}
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
//
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
if ( ! empty( $
|
938 |
-
$
|
939 |
-
}
|
940 |
-
|
941 |
-
//
|
942 |
-
$
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
//
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
// Cleans up the
|
960 |
-
if ( array_key_exists( '
|
961 |
-
$atts['
|
962 |
-
}
|
963 |
-
|
964 |
-
//
|
965 |
-
if (
|
966 |
-
|
967 |
-
}
|
968 |
-
|
969 |
-
//
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
}
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
$
|
1007 |
-
}
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
//
|
1024 |
-
if ( array_key_exists( '
|
1025 |
-
$
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
if ( array_key_exists( '
|
1032 |
-
$output .= '
|
1033 |
-
}
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
$
|
1040 |
-
}
|
1041 |
-
|
1042 |
-
// Sets the
|
1043 |
-
$
|
1044 |
-
'
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
'
|
1050 |
-
'
|
1051 |
-
'
|
1052 |
-
'
|
1053 |
-
'
|
1054 |
-
'
|
1055 |
-
'
|
1056 |
-
'
|
1057 |
-
'
|
1058 |
-
'
|
1059 |
-
'
|
1060 |
-
'
|
1061 |
-
'
|
1062 |
-
'
|
1063 |
-
'
|
1064 |
-
'
|
1065 |
-
'
|
1066 |
-
'
|
1067 |
-
'
|
1068 |
-
'
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
//
|
1090 |
-
if ( array_key_exists( '
|
1091 |
-
$output .= ' shariff-
|
1092 |
-
}
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
$output .= '
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
$
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
$output .= '
|
1155 |
-
}
|
1156 |
-
|
1157 |
-
|
1158 |
-
//
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
$
|
1165 |
-
|
1166 |
-
|
1167 |
-
$
|
1168 |
-
$
|
1169 |
-
|
1170 |
-
|
1171 |
-
$
|
1172 |
-
|
1173 |
-
|
1174 |
-
$
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
$
|
1195 |
-
} elseif ( '
|
1196 |
-
|
1197 |
-
|
1198 |
-
$
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
$
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
//
|
1224 |
-
if (
|
1225 |
-
$
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
}
|
1248 |
-
}
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
if (
|
1253 |
-
$
|
1254 |
-
}
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
//
|
1282 |
-
if (
|
1283 |
-
$
|
1284 |
-
}
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
$
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
$output .= '
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
$
|
1395 |
-
} else {
|
1396 |
-
$output .= '
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
$
|
1411 |
-
}
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
if (
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
if (
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
}
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
$
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
//
|
1506 |
-
if (
|
1507 |
-
$output .= '
|
1508 |
-
}
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
}
|
1517 |
-
|
1518 |
-
if
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
//
|
1523 |
-
if (
|
1524 |
-
$output
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
}
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.6.0
|
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.6.0';
|
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 |
+
/**
|
50 |
+
* Add privacy policy suggestions to WordPress privacy generator introduced in WordPress 4.9.6.
|
51 |
+
*/
|
52 |
+
function shariff3uu_privacy() {
|
53 |
+
if ( function_exists( 'wp_add_privacy_policy_content' ) ) {
|
54 |
+
$content = __(
|
55 |
+
'<h2>Social Media Plugin "Shariff Wrapper"</h2>
|
56 |
+
|
57 |
+
On our website we offer you the possibility to use so called "Social Media Buttons". To protect your data, we use a solution called "Shariff". Hereby the share buttons are implemented as static images, which contain a link to the corresponding social network site. If you click on such a button, you will be redirected to the respective social network site in the same way, as normal links would do as well. Only in that moment of time the provider of the social network site will get information about you, for example your IP address. If you do not click on such a share button, no data will be transmitted. Information about the collection and usage of your date on the social network sites can be found in the corresponding terms of use of the respective provider. More information about the plugin and the Shariff solution can be found here: <a href="https://wordpress.org/plugins/shariff/">https://wordpress.org/plugins/shariff/</a>
|
58 |
+
|
59 |
+
On our website we offer share buttons for the following services / companies: AddThis, Diaspora, Facebook, Flattr, Flipboard, LinkedIn, Odnoklassniki, Patreon, PayPal, Pinterest, Pocket, Qzone, Reddit, Stumbleupon, Telegram, TencentWeibo, Threema, Tumblr, Twitter, VK, Wallabag, Weibo, WhatsApp, Xing.',
|
60 |
+
'shariff'
|
61 |
+
);
|
62 |
+
wp_add_privacy_policy_content( 'Shariff Wrapper', wp_kses_post( wpautop( $content, false ) ) );
|
63 |
+
}
|
64 |
+
}
|
65 |
+
add_action( 'admin_init', 'shariff3uu_privacy' );
|
66 |
+
|
67 |
+
/** Require Shariff Widget. */
|
68 |
+
require dirname( __FILE__ ) . '/includes/class-shariff-widget.php';
|
69 |
+
|
70 |
+
// Allowed tags for headline.
|
71 |
+
$allowed_tags = array(
|
72 |
+
// Direct formatting e.g. <strong>.
|
73 |
+
'strong' => array(),
|
74 |
+
'em' => array(),
|
75 |
+
'b' => array(),
|
76 |
+
'i' => array(),
|
77 |
+
'br' => array(),
|
78 |
+
// Elements that can be formatted via CSS.
|
79 |
+
'span' => array(
|
80 |
+
'class' => array(),
|
81 |
+
'style' => array(),
|
82 |
+
'id' => array(),
|
83 |
+
),
|
84 |
+
'div' => array(
|
85 |
+
'class' => array(),
|
86 |
+
'style' => array(),
|
87 |
+
'id' => array(),
|
88 |
+
),
|
89 |
+
'p' => array(
|
90 |
+
'class' => array(),
|
91 |
+
'style' => array(),
|
92 |
+
'id' => array(),
|
93 |
+
),
|
94 |
+
'h1' => array(
|
95 |
+
'class' => array(),
|
96 |
+
'style' => array(),
|
97 |
+
'id' => array(),
|
98 |
+
),
|
99 |
+
'h2' => array(
|
100 |
+
'class' => array(),
|
101 |
+
'style' => array(),
|
102 |
+
'id' => array(),
|
103 |
+
),
|
104 |
+
'h3' => array(
|
105 |
+
'class' => array(),
|
106 |
+
'style' => array(),
|
107 |
+
'id' => array(),
|
108 |
+
),
|
109 |
+
'h4' => array(
|
110 |
+
'class' => array(),
|
111 |
+
'style' => array(),
|
112 |
+
'id' => array(),
|
113 |
+
),
|
114 |
+
'h5' => array(
|
115 |
+
'class' => array(),
|
116 |
+
'style' => array(),
|
117 |
+
'id' => array(),
|
118 |
+
),
|
119 |
+
'h6' => array(
|
120 |
+
'class' => array(),
|
121 |
+
'style' => array(),
|
122 |
+
'id' => array(),
|
123 |
+
),
|
124 |
+
'hr' => array(
|
125 |
+
'class' => array(),
|
126 |
+
'style' => array(),
|
127 |
+
'id' => array(),
|
128 |
+
),
|
129 |
+
);
|
130 |
+
|
131 |
+
/** Admin options */
|
132 |
+
if ( is_admin() ) {
|
133 |
+
// Include admin_menu.php.
|
134 |
+
include dirname( __FILE__ ) . '/admin/admin-menu.php';
|
135 |
+
// Include admin_notices.php.
|
136 |
+
include dirname( __FILE__ ) . '/admin/admin-notices.php';
|
137 |
+
}
|
138 |
+
|
139 |
+
/** Custom meta box */
|
140 |
+
function shariff3uu_include_metabox() {
|
141 |
+
// Check if user is allowed to publish posts.
|
142 |
+
if ( current_user_can( 'publish_posts' ) ) {
|
143 |
+
// Include admin_metabox.php.
|
144 |
+
include dirname( __FILE__ ) . '/admin/admin-metabox.php';
|
145 |
+
}
|
146 |
+
}
|
147 |
+
// Check if meta box has been disabled in the options, if not add_action.
|
148 |
+
if ( ! isset( $shariff3uu['disable_metabox'] ) || isset( $shariff3uu['disable_metabox'] ) && 1 !== $shariff3uu['disable_metabox'] ) {
|
149 |
+
add_action( 'init', 'shariff3uu_include_metabox' );
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Add meta links (settings and support forum) to our entry on the plugin page.
|
154 |
+
*
|
155 |
+
* @param array $links Array of all current links.
|
156 |
+
* @param string $file Path to plugin of the current element.
|
157 |
+
*
|
158 |
+
* @return array New array including our links to settings and support forum.
|
159 |
+
*/
|
160 |
+
function shariff3uu_meta_links( $links, $file ) {
|
161 |
+
$plugin = plugin_basename( __FILE__ );
|
162 |
+
// Create link.
|
163 |
+
if ( $file === $plugin ) {
|
164 |
+
return array_merge(
|
165 |
+
$links,
|
166 |
+
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>' )
|
167 |
+
);
|
168 |
+
}
|
169 |
+
return $links;
|
170 |
+
}
|
171 |
+
add_filter( 'plugin_row_meta', 'shariff3uu_meta_links', 10, 2 );
|
172 |
+
|
173 |
+
/** Initialize translations. */
|
174 |
+
function shariff_init_locale() {
|
175 |
+
if ( function_exists( 'load_plugin_textdomain' ) ) {
|
176 |
+
load_plugin_textdomain( 'shariff' );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
/** Register the wp rest api route and sanitize the input */
|
181 |
+
function shariff3uu_sanitize_api() {
|
182 |
+
register_rest_route(
|
183 |
+
'shariff/v1',
|
184 |
+
'/share_counts',
|
185 |
+
array(
|
186 |
+
'methods' => 'GET',
|
187 |
+
'callback' => 'shariff3uu_share_counts',
|
188 |
+
'args' => array(
|
189 |
+
'url' => array(
|
190 |
+
'sanitize_callback' => 'esc_url',
|
191 |
+
'required' => true,
|
192 |
+
'description' => __( 'URL of the post or page to request share counts for.', 'shariff' ),
|
193 |
+
),
|
194 |
+
'services' => array(
|
195 |
+
'sanitize_callback' => 'sanitize_text_field',
|
196 |
+
'required' => true,
|
197 |
+
'description' => __( 'A list of services separated by |. Example: twitter|facebook|xing', 'shariff' ),
|
198 |
+
),
|
199 |
+
'timestamp' => array(
|
200 |
+
'sanitize_callback' => 'absint',
|
201 |
+
'description' => __( 'Timestamp of the last update of the post. Used for dynamic cache lifespan.', 'shariff' ),
|
202 |
+
),
|
203 |
+
),
|
204 |
+
)
|
205 |
+
);
|
206 |
+
}
|
207 |
+
add_action( 'rest_api_init', 'shariff3uu_sanitize_api' );
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Provide share counts via the wp rest api.
|
211 |
+
*
|
212 |
+
* @param WP_REST_Request $request Incoming request.
|
213 |
+
*
|
214 |
+
* @return string Returns the share counts for all requested services if available or an error message.
|
215 |
+
*/
|
216 |
+
function shariff3uu_share_counts( WP_REST_Request $request ) {
|
217 |
+
// Get options.
|
218 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
219 |
+
|
220 |
+
// Setup Parameters.
|
221 |
+
$url = urldecode( $request['url'] );
|
222 |
+
$services = $request['services'];
|
223 |
+
$timestamp = $request['timestamp'];
|
224 |
+
|
225 |
+
// Exit if no url is provided and provide an error message.
|
226 |
+
if ( empty( $url ) || 'undefined' === $url ) {
|
227 |
+
return new WP_Error( 'nourl', 'No URL provided!', array( 'status' => 400 ) );
|
228 |
+
}
|
229 |
+
|
230 |
+
// Exit if no services are provided and provide an error message.
|
231 |
+
if ( empty( $services ) || 'undefined' === $services ) {
|
232 |
+
return new WP_Error( 'noservices', 'No services provided!', array( 'status' => 400 ) );
|
233 |
+
}
|
234 |
+
|
235 |
+
// Make sure that the provided url matches the WordPress domain.
|
236 |
+
$get_url = wp_parse_url( $url );
|
237 |
+
$wp_url = wp_parse_url( get_bloginfo( 'url' ) );
|
238 |
+
// On an external backend check allowed hosts, else compare that domain is equal.
|
239 |
+
if ( defined( 'SHARIFF_FRONTENDS' ) ) {
|
240 |
+
$shariff_frontends = array_flip( explode( '|', SHARIFF_FRONTENDS ) );
|
241 |
+
if ( ! isset( $get_url['host'] ) || ! array_key_exists( $get_url['host'], $shariff_frontends ) ) {
|
242 |
+
return new WP_Error( 'externaldomainnotallowed', 'External domain not allowed by this server!', array( 'status' => 400 ) );
|
243 |
+
}
|
244 |
+
} elseif ( ! isset( $get_url['host'] ) || $get_url['host'] !== $wp_url['host'] ) {
|
245 |
+
return new WP_Error( 'domainnotallowed', 'Domain not allowed by this server!', array( 'status' => 400 ) );
|
246 |
+
}
|
247 |
+
|
248 |
+
// Encode the shareurl.
|
249 |
+
$post_url = rawurlencode( $url );
|
250 |
+
$post_url_raw = $url;
|
251 |
+
|
252 |
+
// Set transient name.
|
253 |
+
// Transient names can only contain 40 characters, therefore we use a hash (md5 always creates a 32 character hash).
|
254 |
+
// We need a prefix so we can clean up on uninstall and updates.
|
255 |
+
$post_hash = 'shariff' . hash( 'md5', $post_url );
|
256 |
+
|
257 |
+
// Check for ttl option, must be between 60 and 7200 seconds.
|
258 |
+
if ( isset( $shariff3uu['ttl'] ) ) {
|
259 |
+
$ttl = absint( $shariff3uu['ttl'] );
|
260 |
+
// Make sure ttl is a reasonable number.
|
261 |
+
if ( $ttl < '61' ) {
|
262 |
+
$ttl = '60';
|
263 |
+
} elseif ( $ttl > '7200' ) {
|
264 |
+
$ttl = '7200';
|
265 |
+
}
|
266 |
+
} else {
|
267 |
+
// Else set it to new default (five minutes).
|
268 |
+
$ttl = '300';
|
269 |
+
}
|
270 |
+
|
271 |
+
// Adjust ttl based on the post age.
|
272 |
+
if ( isset( $timestamp ) && ( ! isset( $shariff3uu['disable_dynamic_cache'] ) || ( isset( $shariff3uu['disable_dynamic_cache'] ) && 1 !== $shariff3uu['disable_dynamic_cache'] ) ) ) {
|
273 |
+
// The timestamp represents the last time the post or page was modified.
|
274 |
+
$post_time = intval( $timestamp );
|
275 |
+
$current_time = current_time( 'timestamp', true );
|
276 |
+
$post_age = round( abs( $current_time - $post_time ) );
|
277 |
+
if ( $post_age > '0' ) {
|
278 |
+
$post_age_days = round( $post_age / 60 / 60 / 24 );
|
279 |
+
// Make sure ttl base is not getting too high.
|
280 |
+
if ( $ttl > '300' ) {
|
281 |
+
$ttl = '300';
|
282 |
+
}
|
283 |
+
$ttl = round( ( $ttl + $post_age_days * 3 ) * ( $post_age_days * 2 ) );
|
284 |
+
}
|
285 |
+
|
286 |
+
// Set minimum ttl to 60 seconds and maximum ttl to one week.
|
287 |
+
if ( $ttl < '60' ) {
|
288 |
+
$ttl = '60';
|
289 |
+
} elseif ( $ttl > '604800' ) {
|
290 |
+
$ttl = '604800';
|
291 |
+
}
|
292 |
+
|
293 |
+
// In case we get a timestamp older than 01.01.2000 or for example a 0, use a reasonable default value of five minutes.
|
294 |
+
if ( $post_time < '946684800' ) {
|
295 |
+
$ttl = '300';
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
// Set the default value.
|
300 |
+
$need_update = false;
|
301 |
+
|
302 |
+
// Remove totalnumber for array.
|
303 |
+
$real_services = str_replace( 'totalnumber|', '', $services );
|
304 |
+
$real_services = str_replace( '|totalnumber', '', $real_services );
|
305 |
+
|
306 |
+
// Explode services.
|
307 |
+
$service_array = explode( '|', $real_services );
|
308 |
+
|
309 |
+
// Remove duplicated entries.
|
310 |
+
$service_array = array_unique( $service_array );
|
311 |
+
|
312 |
+
// Get old share counts.
|
313 |
+
if ( get_transient( $post_hash ) !== false ) {
|
314 |
+
$old_share_counts = get_transient( $post_hash );
|
315 |
+
} else {
|
316 |
+
$old_share_counts = array();
|
317 |
+
}
|
318 |
+
|
319 |
+
// Check if we need to update.
|
320 |
+
if ( get_transient( $post_hash ) !== false ) {
|
321 |
+
// Check timestamp.
|
322 |
+
$diff = current_time( 'timestamp', true ) - $old_share_counts['timestamp'];
|
323 |
+
if ( $diff > $ttl ) {
|
324 |
+
$need_update = true;
|
325 |
+
}
|
326 |
+
// Check if we have a different set of services than stored in the cache.
|
327 |
+
$diff_array = array_diff_key( array_flip( $service_array ), $old_share_counts );
|
328 |
+
if ( ! empty( $diff_array ) ) {
|
329 |
+
$need_update = true;
|
330 |
+
// We only need to update the missing service.
|
331 |
+
$service_array = array_flip( $diff_array );
|
332 |
+
}
|
333 |
+
} else {
|
334 |
+
$need_update = true;
|
335 |
+
}
|
336 |
+
|
337 |
+
// Prevent php notices if debug mode is enabled.
|
338 |
+
$response = '';
|
339 |
+
$share_counts = array();
|
340 |
+
|
341 |
+
// If we do not need an update, use stored data.
|
342 |
+
if ( false === $need_update ) {
|
343 |
+
$share_counts = $old_share_counts;
|
344 |
+
// Provide update info for debugging and support.
|
345 |
+
$share_counts['updated'] = '0';
|
346 |
+
} elseif ( 'totalnumber' === $services ) {
|
347 |
+
// If only totalnumber is requested we only use cached data.
|
348 |
+
$share_counts = $old_share_counts;
|
349 |
+
} elseif ( isset( $shariff3uu['external_host'] ) && ! empty( $shariff3uu['external_host'] ) ) {
|
350 |
+
// Check if we want to use an external API.
|
351 |
+
$response = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( $shariff3uu['external_host'] . '?url=' . rawurlencode( $url ) . '&services=' . $services . '×tamp=' . $timestamp . '"' ) ) );
|
352 |
+
// Decode response.
|
353 |
+
$share_counts = json_decode( $response, true );
|
354 |
+
// Save transient.
|
355 |
+
set_transient( $post_hash, $share_counts, '604800' );
|
356 |
+
// Offer a hook to work with the share counts.
|
357 |
+
do_action( 'shariff_share_counts', $share_counts );
|
358 |
+
} else {
|
359 |
+
// Else we fetch new counts ourselves.
|
360 |
+
$share_counts = shariff3uu_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $post_url_raw );
|
361 |
+
}
|
362 |
+
|
363 |
+
// Return results, if we have some or an error message if not.
|
364 |
+
if ( isset( $share_counts ) && null !== $share_counts ) {
|
365 |
+
return $share_counts;
|
366 |
+
} else {
|
367 |
+
return new WP_Error( 'nodata', 'Could not receive any data.', array( 'status' => 400 ) );
|
368 |
+
}
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Fetch share counts.
|
373 |
+
*
|
374 |
+
* @param array $service_array Array with the desired services.
|
375 |
+
* @param array $old_share_counts Array of all already stored share counts.
|
376 |
+
* @param string $post_hash MD5-Hash of the current post.
|
377 |
+
* @param string $post_url_raw Raw URL of the current post.
|
378 |
+
*
|
379 |
+
* @return array Array of all fetched share counts.
|
380 |
+
*/
|
381 |
+
function shariff3uu_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $post_url_raw ) {
|
382 |
+
// We only need the backend part from the service phps.
|
383 |
+
$backend = 1;
|
384 |
+
|
385 |
+
// Encode the shareurl.
|
386 |
+
$post_url = rawurlencode( esc_url( $post_url_raw ) );
|
387 |
+
|
388 |
+
// Get options.
|
389 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
390 |
+
|
391 |
+
// Prevent php notices.
|
392 |
+
$total_count = 0;
|
393 |
+
$share_counts = array();
|
394 |
+
|
395 |
+
// Loop through all desired services.
|
396 |
+
foreach ( $service_array as $service ) {
|
397 |
+
// Only include services that are not disabled.
|
398 |
+
if ( ! empty( $service ) && ( ! isset( $shariff3uu['disable'][ $service ] ) || ( isset( $shariff3uu['disable'][ $service ] ) && 0 === $shariff3uu['disable'][ $service ] ) ) ) {
|
399 |
+
// Determine path.
|
400 |
+
$path_service_file = dirname( __FILE__ ) . '/services/shariff-' . $service . '.php';
|
401 |
+
// Include service files.
|
402 |
+
if ( file_exists( $path_service_file ) ) {
|
403 |
+
include $path_service_file;
|
404 |
+
}
|
405 |
+
// if we have an error (e.g. a timeout) and we have an old share count for this service, keep it!
|
406 |
+
if ( array_key_exists( $service, $old_share_counts ) && ( ! array_key_exists( $service, $share_counts ) || empty( $share_counts[ $service ] ) ) ) {
|
407 |
+
$share_counts[ $service ] = $old_share_counts[ $service ];
|
408 |
+
}
|
409 |
+
}
|
410 |
+
// Calculate total share count.
|
411 |
+
if ( isset( $share_counts[ $service ] ) ) {
|
412 |
+
$total_count = $total_count + $share_counts[ $service ];
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
// Add total count.
|
417 |
+
if ( 0 !== $total_count ) {
|
418 |
+
$share_counts['total'] = $total_count;
|
419 |
+
}
|
420 |
+
|
421 |
+
// Save transient, if we have counts.
|
422 |
+
if ( isset( $share_counts ) ) {
|
423 |
+
// Add current timestamp and url.
|
424 |
+
$share_counts['timestamp'] = current_time( 'timestamp', true );
|
425 |
+
$share_counts['url'] = $post_url_raw;
|
426 |
+
// Combine different set of services.
|
427 |
+
if ( get_transient( $post_hash ) !== false ) {
|
428 |
+
$other_request = get_transient( $post_hash );
|
429 |
+
$share_counts = array_merge( $other_request, $share_counts );
|
430 |
+
}
|
431 |
+
// Save transient.
|
432 |
+
set_transient( $post_hash, $share_counts, '604800' );
|
433 |
+
// Offer a hook to work with the share counts.
|
434 |
+
do_action( 'shariff_share_counts', $share_counts );
|
435 |
+
// Update info.
|
436 |
+
$share_counts['updated'] = 1;
|
437 |
+
} elseif ( isset( $old_share_counts ) ) {
|
438 |
+
$share_counts = $old_share_counts;
|
439 |
+
// Update info.
|
440 |
+
$share_counts['updated'] = '0';
|
441 |
+
}
|
442 |
+
|
443 |
+
// Return share counts.
|
444 |
+
return $share_counts;
|
445 |
+
}
|
446 |
+
|
447 |
+
/**
|
448 |
+
* Fills cache automatically.
|
449 |
+
*/
|
450 |
+
function shariff3uu_fill_cache() {
|
451 |
+
// Amount of posts - set to 100 if not set.
|
452 |
+
if ( isset( $GLOBALS['shariff3uu']['ranking'] ) && absint( $GLOBALS['shariff3uu']['ranking'] ) > '0' ) {
|
453 |
+
$numberposts = absint( $GLOBALS['shariff3uu']['ranking'] );
|
454 |
+
} else {
|
455 |
+
$numberposts = '100';
|
456 |
+
}
|
457 |
+
|
458 |
+
// Avoid errors if no services are given - instead use the default set of services.
|
459 |
+
if ( empty( $GLOBALS['shariff3uu']['services'] ) ) {
|
460 |
+
$services = 'twitter|facebook|linkedin';
|
461 |
+
} else {
|
462 |
+
$services = $GLOBALS['shariff3uu']['services'];
|
463 |
+
}
|
464 |
+
|
465 |
+
// Explode services.
|
466 |
+
$service_array = explode( '|', $services );
|
467 |
+
|
468 |
+
// Arguments for wp_get_recent_posts().
|
469 |
+
$args = array(
|
470 |
+
'numberposts' => $numberposts,
|
471 |
+
'orderby' => 'post_date',
|
472 |
+
'order' => 'DESC',
|
473 |
+
'post_status' => 'publish',
|
474 |
+
'suppress_filters' => false,
|
475 |
+
);
|
476 |
+
|
477 |
+
// Catch last 100 posts or whatever number is set for it.
|
478 |
+
$recent_posts = wp_get_recent_posts( $args );
|
479 |
+
if ( $recent_posts ) {
|
480 |
+
foreach ( $recent_posts as $recent ) {
|
481 |
+
// Get the url.
|
482 |
+
$url = get_permalink( $recent['ID'] );
|
483 |
+
$post_url = rawurlencode( $url );
|
484 |
+
// Set transient name.
|
485 |
+
$post_hash = 'shariff' . hash( 'md5', $post_url );
|
486 |
+
// Get old share counts.
|
487 |
+
if ( get_transient( $post_hash ) !== false ) {
|
488 |
+
$old_share_counts = get_transient( $post_hash );
|
489 |
+
} else {
|
490 |
+
$old_share_counts = array();
|
491 |
+
}
|
492 |
+
// Fetch share counts and save them.
|
493 |
+
shariff3uu_fetch_sharecounts( $service_array, $old_share_counts, $post_hash, $url );
|
494 |
+
}
|
495 |
+
}
|
496 |
+
}
|
497 |
+
add_action( 'shariff3uu_fill_cache', 'shariff3uu_fill_cache' );
|
498 |
+
|
499 |
+
/**
|
500 |
+
* Adds schedule event in order to fill cache automatically.
|
501 |
+
*/
|
502 |
+
function shariff3uu_fill_cache_schedule() {
|
503 |
+
// Get options manually bc of start on activation.
|
504 |
+
$shariff3uu_statistic = (array) get_option( 'shariff3uu_statistic' );
|
505 |
+
// Check if option is set.
|
506 |
+
if ( isset( $shariff3uu_statistic['automaticcache'] ) && 1 === $shariff3uu_statistic['automaticcache'] ) {
|
507 |
+
// Check if job is already scheduled.
|
508 |
+
if ( ! wp_next_scheduled( 'shariff3uu_fill_cache' ) ) {
|
509 |
+
// Add cron job.
|
510 |
+
wp_schedule_event( time(), 'weekly', 'shariff3uu_fill_cache' );
|
511 |
+
}
|
512 |
+
} else {
|
513 |
+
// Else option is not set therefore remove cron job if scheduled.
|
514 |
+
if ( wp_next_scheduled( 'shariff3uu_fill_cache' ) ) {
|
515 |
+
// Remove cron job.
|
516 |
+
wp_clear_scheduled_hook( 'shariff3uu_fill_cache' );
|
517 |
+
}
|
518 |
+
}
|
519 |
+
}
|
520 |
+
add_action( 'shariff3uu_save_statistic_options', 'shariff3uu_fill_cache_schedule' );
|
521 |
+
|
522 |
+
/** Registers activation hook to start cron job after an update. */
|
523 |
+
register_activation_hook( __FILE__, 'shariff3uu_fill_cache_schedule' );
|
524 |
+
|
525 |
+
/**
|
526 |
+
* Adds custom weekly cron recurrences.
|
527 |
+
*
|
528 |
+
* @param array $schedules Array of existing schedules.
|
529 |
+
*
|
530 |
+
* @return array Updated array including our new schedule.
|
531 |
+
*/
|
532 |
+
function shariff3uu_fill_cache_schedule_custom_recurrence( $schedules ) {
|
533 |
+
$schedules['weekly'] = array(
|
534 |
+
'display' => __( 'Once weekly', 'shariff' ),
|
535 |
+
'interval' => 604800,
|
536 |
+
);
|
537 |
+
return $schedules;
|
538 |
+
}
|
539 |
+
add_filter( 'cron_schedules', 'shariff3uu_fill_cache_schedule_custom_recurrence' );
|
540 |
+
|
541 |
+
/**
|
542 |
+
* Adds short tag to posts and pages (including custom post types).
|
543 |
+
*
|
544 |
+
* @param string $content The current post content.
|
545 |
+
*
|
546 |
+
* @return string The post content including our short tag.
|
547 |
+
*/
|
548 |
+
function shariff3uu_posts( $content ) {
|
549 |
+
// Get options.
|
550 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
551 |
+
|
552 |
+
// Do not add Shariff to excerpts or outside the loop, if option is checked.
|
553 |
+
if ( in_array( 'get_the_excerpt', $GLOBALS['wp_current_filter'], true ) || ( ! in_the_loop() && isset( $shariff3uu['disable_outside_loop'] ) && 1 === $shariff3uu['disable_outside_loop'] ) ) {
|
554 |
+
return $content;
|
555 |
+
}
|
556 |
+
|
557 |
+
// Disable share buttons on password protected posts if configured in the admin menu.
|
558 |
+
if ( ( 1 === post_password_required( get_the_ID() ) || ! empty( $GLOBALS['post']->post_password ) ) && isset( $shariff3uu['disable_on_protected'] ) && 1 === $shariff3uu['disable_on_protected'] ) {
|
559 |
+
$shariff3uu['add_before']['posts'] = 0;
|
560 |
+
$shariff3uu['add_before']['posts_blogpage'] = 0;
|
561 |
+
$shariff3uu['add_before']['pages'] = 0;
|
562 |
+
$shariff3uu['add_after']['posts'] = 0;
|
563 |
+
$shariff3uu['add_after']['posts_blogpage'] = 0;
|
564 |
+
$shariff3uu['add_after']['pages'] = 0;
|
565 |
+
$shariff3uu['add_after']['custom_type'] = 0;
|
566 |
+
}
|
567 |
+
|
568 |
+
// If we want to see it as text - replace the slash.
|
569 |
+
if ( false !== strpos( $content, '/hideshariff' ) ) {
|
570 |
+
$content = str_replace( '/hideshariff', 'hideshariff', $content );
|
571 |
+
} elseif ( false !== strpos( $content, 'hideshariff' ) ) {
|
572 |
+
// Remove the sign.
|
573 |
+
$content = str_replace( 'hideshariff', '', $content );
|
574 |
+
// Return the content without adding Shariff.
|
575 |
+
return $content;
|
576 |
+
}
|
577 |
+
|
578 |
+
// Type of current post.
|
579 |
+
$current_post_type = get_post_type();
|
580 |
+
if ( 'post' === $current_post_type ) {
|
581 |
+
$current_post_type = 'posts';
|
582 |
+
}
|
583 |
+
|
584 |
+
// Prevent php warnings in debug mode.
|
585 |
+
$add_before = 0;
|
586 |
+
$add_after = 0;
|
587 |
+
|
588 |
+
// Check if shariff should be added automatically (plugin options).
|
589 |
+
if ( ! is_singular() ) {
|
590 |
+
// On blog page.
|
591 |
+
if ( isset( $shariff3uu['add_before']['posts_blogpage'] ) && 1 === $shariff3uu['add_before']['posts_blogpage'] ) {
|
592 |
+
$add_before = 1;
|
593 |
+
}
|
594 |
+
if ( isset( $shariff3uu['add_after']['posts_blogpage'] ) && 1 === $shariff3uu['add_after']['posts_blogpage'] ) {
|
595 |
+
$add_after = 1;
|
596 |
+
}
|
597 |
+
} elseif ( is_singular( 'post' ) ) {
|
598 |
+
// On single post.
|
599 |
+
if ( isset( $shariff3uu['add_before'][ $current_post_type ] ) && 1 === $shariff3uu['add_before'][ $current_post_type ] ) {
|
600 |
+
$add_before = 1;
|
601 |
+
}
|
602 |
+
if ( isset( $shariff3uu['add_after'][ $current_post_type ] ) && 1 === $shariff3uu['add_after'][ $current_post_type ] ) {
|
603 |
+
$add_after = 1;
|
604 |
+
}
|
605 |
+
} elseif ( is_singular( 'page' ) ) {
|
606 |
+
// On pages.
|
607 |
+
if ( isset( $shariff3uu['add_before']['pages'] ) && 1 === $shariff3uu['add_before']['pages'] ) {
|
608 |
+
$add_before = 1;
|
609 |
+
}
|
610 |
+
if ( isset( $shariff3uu['add_after']['pages'] ) && 1 === $shariff3uu['add_after']['pages'] ) {
|
611 |
+
$add_after = 1;
|
612 |
+
}
|
613 |
+
} else {
|
614 |
+
// On custom_post_types.
|
615 |
+
$all_custom_post_types = get_post_types( array( '_builtin' => false ) );
|
616 |
+
if ( is_array( $all_custom_post_types ) ) {
|
617 |
+
$custom_types = array_keys( $all_custom_post_types );
|
618 |
+
// Add shariff, if custom type and option checked in the admin menu.
|
619 |
+
if ( isset( $shariff3uu['add_before'][ $current_post_type ] ) && 1 === $shariff3uu['add_before'][ $current_post_type ] ) {
|
620 |
+
$add_before = 1;
|
621 |
+
}
|
622 |
+
if ( isset( $shariff3uu['add_after'][ $current_post_type ] ) && 1 === $shariff3uu['add_after'][ $current_post_type ] ) {
|
623 |
+
$add_after = 1;
|
624 |
+
}
|
625 |
+
}
|
626 |
+
}
|
627 |
+
|
628 |
+
// Check if buttons are enabled on a single post or page via the meta box.
|
629 |
+
if ( get_post_meta( get_the_ID(), 'shariff_metabox_before', true ) ) {
|
630 |
+
$add_before = 1;
|
631 |
+
}
|
632 |
+
if ( get_post_meta( get_the_ID(), 'shariff_metabox_after', true ) ) {
|
633 |
+
$add_after = 1;
|
634 |
+
}
|
635 |
+
|
636 |
+
// Add shariff.
|
637 |
+
if ( 1 === $add_before ) {
|
638 |
+
$content = '[shariff]' . $content;
|
639 |
+
}
|
640 |
+
if ( 1 === $add_after ) {
|
641 |
+
$content .= '[shariff]';
|
642 |
+
}
|
643 |
+
|
644 |
+
// Return content.
|
645 |
+
return $content;
|
646 |
+
}
|
647 |
+
if ( ! isset( $GLOBALS['shariff3uu']['shortcodeprio'] ) ) {
|
648 |
+
$GLOBALS['shariff3uu']['shortcodeprio'] = '10';
|
649 |
+
}
|
650 |
+
add_filter( 'the_content', 'shariff3uu_posts', $GLOBALS['shariff3uu']['shortcodeprio'] );
|
651 |
+
|
652 |
+
/**
|
653 |
+
* Add shorttag to excerpt.
|
654 |
+
*
|
655 |
+
* @param string $content The current content of the excerpt.
|
656 |
+
*
|
657 |
+
* @return string The new content of the post including the shorttag.
|
658 |
+
*/
|
659 |
+
function shariff3uu_excerpt( $content ) {
|
660 |
+
// Get options.
|
661 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
662 |
+
// Remove headline in post.
|
663 |
+
if ( isset( $shariff3uu['headline'] ) ) {
|
664 |
+
$content = str_replace( wp_strip_all_tags( $shariff3uu['headline'] ), ' ', $content );
|
665 |
+
}
|
666 |
+
// Add shariff before the excerpt, if option checked in the admin menu.
|
667 |
+
if ( isset( $shariff3uu['add_before']['excerpt'] ) && 1 === $shariff3uu['add_before']['excerpt'] ) {
|
668 |
+
$content = do_shortcode( '[shariff]' ) . $content;
|
669 |
+
}
|
670 |
+
// Add shariff after the excerpt, if option checked in the admin menu.
|
671 |
+
if ( isset( $shariff3uu['add_after']['excerpt'] ) && 1 === $shariff3uu['add_after']['excerpt'] ) {
|
672 |
+
$content .= do_shortcode( '[shariff]' );
|
673 |
+
}
|
674 |
+
return $content;
|
675 |
+
}
|
676 |
+
add_filter( 'the_excerpt', 'shariff3uu_excerpt' );
|
677 |
+
|
678 |
+
/**
|
679 |
+
* Removes hideshariff from content in cases of excerpts or other plain text usages.
|
680 |
+
*
|
681 |
+
* @param string $content The current content of the post.
|
682 |
+
*
|
683 |
+
* @return string The modified content without hideshariff.
|
684 |
+
*/
|
685 |
+
function shariff3uu_hideshariff( $content ) {
|
686 |
+
if ( true === strpos( $content, 'hideshariff' ) ) {
|
687 |
+
$content = str_replace( 'hideshariff', '', $content );
|
688 |
+
}
|
689 |
+
return $content;
|
690 |
+
}
|
691 |
+
add_filter( 'the_content', 'shariff3uu_hideshariff', 999 );
|
692 |
+
|
693 |
+
/**
|
694 |
+
* Removes shariff from rss feeds.
|
695 |
+
*
|
696 |
+
* @param string $content The current content of the post.
|
697 |
+
*
|
698 |
+
* @return string The modified content without shariff.
|
699 |
+
*/
|
700 |
+
function shariff3uu_remove_from_rss( $content ) {
|
701 |
+
$content = preg_replace( '/<div class="shariff\b[^>]*>(.*?)<\/div>/i', '', $content );
|
702 |
+
$content = preg_replace( '/<div class="ShariffSC\b[^>]*>(.*?)<\/div>/i', '', $content );
|
703 |
+
return $content;
|
704 |
+
}
|
705 |
+
add_filter( 'the_content_feed', 'shariff3uu_remove_from_rss', 999 );
|
706 |
+
|
707 |
+
/**
|
708 |
+
* Adds shariff buttons after bbpress forums.
|
709 |
+
*/
|
710 |
+
function shariff3uu_bbp_add_shariff_after_forum() {
|
711 |
+
// Get options.
|
712 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
713 |
+
if ( isset( $shariff3uu['add_after']['forum'] ) && 1 === $shariff3uu['add_after']['forum'] ) {
|
714 |
+
// phpcs:ignore
|
715 |
+
echo shariff3uu_render( array() );
|
716 |
+
}
|
717 |
+
}
|
718 |
+
add_action( 'bbp_template_after_forums_loop', 'shariff3uu_bbp_add_shariff_after_forum' );
|
719 |
+
|
720 |
+
/**
|
721 |
+
* Adds shariff buttons after bbpress topics.
|
722 |
+
*/
|
723 |
+
function shariff3uu_bbp_add_shariff_after_topic() {
|
724 |
+
// Get options.
|
725 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
726 |
+
if ( isset( $shariff3uu['add_after']['topic'] ) && 1 === $shariff3uu['add_after']['topic'] ) {
|
727 |
+
// phpcs:ignore
|
728 |
+
echo shariff3uu_render( array() );
|
729 |
+
}
|
730 |
+
}
|
731 |
+
add_action( 'bbp_template_after_topics_loop', 'shariff3uu_bbp_add_shariff_after_topic' );
|
732 |
+
|
733 |
+
/**
|
734 |
+
* Adds shariff buttons after bbpress replies.
|
735 |
+
*/
|
736 |
+
function shariff3uu_bbp_add_shariff_after_reply() {
|
737 |
+
// Get options.
|
738 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
739 |
+
if ( isset( $shariff3uu['add_after']['reply'] ) && 1 === $shariff3uu['add_after']['reply'] ) {
|
740 |
+
// phpcs:ignore
|
741 |
+
echo shariff3uu_render( array() );
|
742 |
+
}
|
743 |
+
}
|
744 |
+
add_action( 'bbp_theme_after_reply_content', 'shariff3uu_bbp_add_shariff_after_reply' );
|
745 |
+
|
746 |
+
/**
|
747 |
+
* Adds shariff buttons before bbpress forums.
|
748 |
+
*/
|
749 |
+
function shariff3uu_bbp_add_shariff_before_forum() {
|
750 |
+
// Get options.
|
751 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
752 |
+
if ( isset( $shariff3uu['add_before']['forum'] ) && 1 === $shariff3uu['add_before']['forum'] ) {
|
753 |
+
// phpcs:ignore
|
754 |
+
echo shariff3uu_render( array() );
|
755 |
+
}
|
756 |
+
}
|
757 |
+
add_action( 'bbp_template_before_forums_loop', 'shariff3uu_bbp_add_shariff_before_forum' );
|
758 |
+
|
759 |
+
/**
|
760 |
+
* Adds shariff buttons before bbpress topics.
|
761 |
+
*/
|
762 |
+
function shariff3uu_bbp_add_shariff_before_topic() {
|
763 |
+
// Get options.
|
764 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
765 |
+
if ( isset( $shariff3uu['add_before']['topic'] ) && 1 === $shariff3uu['add_before']['topic'] ) {
|
766 |
+
// phpcs:ignore
|
767 |
+
echo shariff3uu_render( array() );
|
768 |
+
}
|
769 |
+
}
|
770 |
+
add_action( 'bbp_template_before_topics_loop', 'shariff3uu_bbp_add_shariff_before_topic' );
|
771 |
+
|
772 |
+
/**
|
773 |
+
* Adds shariff buttons before bbpress replies.
|
774 |
+
*/
|
775 |
+
function shariff3uu_bbp_add_shariff_before_reply() {
|
776 |
+
// Get options.
|
777 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
778 |
+
if ( isset( $shariff3uu['add_before']['reply'] ) && 1 === $shariff3uu['add_before']['reply'] ) {
|
779 |
+
// phpcs:ignore
|
780 |
+
echo shariff3uu_render( array() );
|
781 |
+
}
|
782 |
+
}
|
783 |
+
add_action( 'bbp_theme_before_reply_content', 'shariff3uu_bbp_add_shariff_before_reply' );
|
784 |
+
|
785 |
+
/**
|
786 |
+
* Adds shariff to custom hooks.
|
787 |
+
*/
|
788 |
+
function shariff3uu_add_shariff_custom_hooks() {
|
789 |
+
// Get options.
|
790 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
791 |
+
|
792 |
+
if ( isset( $shariff3uu['custom_hooks_shortcode'] ) && ! empty( $shariff3uu['custom_hooks_shortcode'] ) ) {
|
793 |
+
// Replaces shariff with shariffmeta.
|
794 |
+
$shariff3uu_custom_hooks_shortcode = str_replace( '[shariff ', '[shariffmeta ', $shariff3uu['custom_hooks_shortcode'] );
|
795 |
+
|
796 |
+
// Extracts attributes.
|
797 |
+
if ( '[shariffmeta]' !== $shariff3uu_custom_hooks_shortcode ) {
|
798 |
+
do_shortcode( $shariff3uu_custom_hooks_shortcode );
|
799 |
+
}
|
800 |
+
|
801 |
+
if ( isset( $GLOBALS['shariff3uu']['metabox'] ) && ! empty( $GLOBALS['shariff3uu']['metabox'] ) ) {
|
802 |
+
$shariff3uu_custom_hooks_shortcode = $GLOBALS['shariff3uu']['metabox'];
|
803 |
+
} else {
|
804 |
+
$shariff3uu_custom_hooks_shortcode = array();
|
805 |
+
}
|
806 |
+
|
807 |
+
// Clears the metabox global.
|
808 |
+
$GLOBALS['shariff3uu']['metabox'] = '';
|
809 |
+
|
810 |
+
// phpcs:ignore
|
811 |
+
echo shariff3uu_render( $shariff3uu_custom_hooks_shortcode );
|
812 |
+
} else {
|
813 |
+
// phpcs:ignore
|
814 |
+
echo shariff3uu_render( array() );
|
815 |
+
}
|
816 |
+
}
|
817 |
+
if ( isset( $shariff3uu['custom_hooks'] ) && ! empty( $shariff3uu['custom_hooks'] ) ) {
|
818 |
+
// Explodes hooks.
|
819 |
+
$hook_array = explode( '|', $shariff3uu['custom_hooks'] );
|
820 |
+
|
821 |
+
// Remove duplicated hooks.
|
822 |
+
$hook_array = array_unique( $hook_array );
|
823 |
+
|
824 |
+
// Loops through all desired hooks.
|
825 |
+
foreach ( $hook_array as $hook ) {
|
826 |
+
add_action( esc_html( $hook ), 'shariff3uu_add_shariff_custom_hooks' );
|
827 |
+
}
|
828 |
+
}
|
829 |
+
|
830 |
+
/**
|
831 |
+
* Function is called to include the shariff.css in the header of AMP pages.
|
832 |
+
* Currently only called by the amp_post_template_css hook.
|
833 |
+
* Supports the AMP plugin by Automatic and the AMP for WP plugin by Ahmed and Mohammed Kaludi.
|
834 |
+
* We need to strip out all !important in order to pass AMP test.
|
835 |
+
*/
|
836 |
+
function shariff3uu_amp_css() {
|
837 |
+
// Get options.
|
838 |
+
$shariff3uu = $GLOBALS['shariff3uu'];
|
839 |
+
// Output CSS.
|
840 |
+
ob_start();
|
841 |
+
include dirname( __FILE__ ) . '/css/shariff.min.css';
|
842 |
+
$shariff_css = ob_get_clean();
|
843 |
+
if ( false !== $shariff_css ) {
|
844 |
+
echo esc_html( str_replace( '!important', '', $shariff_css ) );
|
845 |
+
} else {
|
846 |
+
include dirname( __FILE__ ) . '/css/shariff.min.css';
|
847 |
+
}
|
848 |
+
if ( array_key_exists( 'dynamic_css', $shariff3uu ) && ! empty( $shariff3uu['dynamic_css'] ) ) {
|
849 |
+
echo esc_html( $shariff3uu['dynamic_css'] );
|
850 |
+
}
|
851 |
+
}
|
852 |
+
add_action( 'amp_post_template_css', 'shariff3uu_amp_css' );
|
853 |
+
|
854 |
+
// Registers the shortcode.
|
855 |
+
add_shortcode( 'shariff', 'shariff3uu_render' );
|
856 |
+
|
857 |
+
/**
|
858 |
+
* Renders the shorttag to the HTML shorttag of Shariff.
|
859 |
+
*
|
860 |
+
* @param array $atts (optional) Array of shariff options provided in the shorttag.
|
861 |
+
*
|
862 |
+
* @return string|null The rendered HTML shorttag or null if a disable condition is met.
|
863 |
+
*/
|
864 |
+
function shariff3uu_render( $atts ) {
|
865 |
+
// Get options.
|
866 |
+
$shariff3uu_basic = (array) get_option( 'shariff3uu_basic' );
|
867 |
+
$shariff3uu_design = (array) get_option( 'shariff3uu_design' );
|
868 |
+
$shariff3uu_advanced = (array) get_option( 'shariff3uu_advanced' );
|
869 |
+
$shariff3uu_statistic = (array) get_option( 'shariff3uu_statistic' );
|
870 |
+
$shariff3uu = array_merge( $shariff3uu_basic, $shariff3uu_design, $shariff3uu_advanced, $shariff3uu_statistic );
|
871 |
+
|
872 |
+
if ( array_key_exists( 'dynamic_css', $shariff3uu ) && ! empty( $shariff3uu['dynamic_css'] ) ) {
|
873 |
+
$dynamic_css = $shariff3uu['dynamic_css'];
|
874 |
+
} else {
|
875 |
+
$dynamic_css = '';
|
876 |
+
}
|
877 |
+
|
878 |
+
// Stops all further actions if we are on an admin page.
|
879 |
+
if ( is_admin() ) {
|
880 |
+
return null;
|
881 |
+
}
|
882 |
+
|
883 |
+
// Avoids errors if no attributes are given - instead uses the old set of services to make it backward compatible.
|
884 |
+
if ( empty( $shariff3uu['services'] ) ) {
|
885 |
+
$shariff3uu['services'] = 'twitter|facebook|linkedin|info';
|
886 |
+
}
|
887 |
+
|
888 |
+
// Uses the backend option for every option that is not set in the shorttag.
|
889 |
+
$backend_options = $shariff3uu;
|
890 |
+
if ( isset( $shariff3uu['vertical'] ) && 1 === $shariff3uu['vertical'] ) {
|
891 |
+
$backend_options['orientation'] = 'vertical';
|
892 |
+
}
|
893 |
+
if ( isset( $shariff3uu['backend'] ) && 1 === $shariff3uu['backend'] ) {
|
894 |
+
$backend_options['backend'] = 'on';
|
895 |
+
}
|
896 |
+
if ( isset( $shariff3uu['buttonsize'] ) && 1 === $shariff3uu['buttonsize'] ) {
|
897 |
+
$backend_options['buttonsize'] = 'small';
|
898 |
+
}
|
899 |
+
if ( empty( $atts ) ) {
|
900 |
+
$atts = $backend_options;
|
901 |
+
} else {
|
902 |
+
$atts = array_merge( $backend_options, $atts );
|
903 |
+
}
|
904 |
+
|
905 |
+
// Gets the metabox ignore widget value.
|
906 |
+
$shariff_metabox_ignore_widget = get_post_meta( get_the_ID(), 'shariff_metabox_ignore_widget', true );
|
907 |
+
|
908 |
+
// Adds the meta box settings if it is not a widget or if it is a widget and not being set to be ignored.
|
909 |
+
if ( ( ! isset( $atts['widget'] ) || ( isset( $atts['widget'] ) && 1 === $atts['widget'] && 1 !== $shariff_metabox_ignore_widget ) ) && 'total' !== $atts['services'] && 'totalnumber' !== $atts['services'] ) {
|
910 |
+
// Gets the meta box disable value.
|
911 |
+
$shariff3uu_metabox_disable = get_post_meta( get_the_ID(), 'shariff_metabox_disable', true );
|
912 |
+
|
913 |
+
// Stops all further actions if the meta box setting is set to disabled.
|
914 |
+
if ( '1' === $shariff3uu_metabox_disable ) {
|
915 |
+
return null;
|
916 |
+
}
|
917 |
+
|
918 |
+
// Gets the meta box shortcode.
|
919 |
+
$shariff3uu_metabox = get_post_meta( get_the_ID(), 'shariff_metabox', true );
|
920 |
+
|
921 |
+
// Replaces shariff with shariffmeta.
|
922 |
+
$shariff3uu_metabox = str_replace( '[shariff ', '[shariffmeta ', $shariff3uu_metabox );
|
923 |
+
|
924 |
+
// Gets the meta box attributes.
|
925 |
+
if ( '[shariffmeta]' !== $shariff3uu_metabox ) {
|
926 |
+
do_shortcode( $shariff3uu_metabox );
|
927 |
+
}
|
928 |
+
|
929 |
+
if ( isset( $GLOBALS['shariff3uu']['metabox'] ) && ! empty( $GLOBALS['shariff3uu']['metabox'] ) ) {
|
930 |
+
$metabox = $GLOBALS['shariff3uu']['metabox'];
|
931 |
+
} else {
|
932 |
+
$metabox = array();
|
933 |
+
}
|
934 |
+
|
935 |
+
// Gets the meta box media attribute.
|
936 |
+
$shariff3uu_metabox_media = get_post_meta( get_the_ID(), 'shariff_metabox_media', true );
|
937 |
+
if ( ! empty( $shariff3uu_metabox_media ) ) {
|
938 |
+
$metabox['media'] = $shariff3uu_metabox_media;
|
939 |
+
}
|
940 |
+
|
941 |
+
// Merges the meta box atts array with the atts array (meta box shortcode overrides all others).
|
942 |
+
if ( ! empty( $metabox ) ) {
|
943 |
+
$atts = array_merge( $atts, $metabox );
|
944 |
+
}
|
945 |
+
|
946 |
+
// Clears the metabox global.
|
947 |
+
$GLOBALS['shariff3uu']['metabox'] = '';
|
948 |
+
} // End meta box if.
|
949 |
+
|
950 |
+
// Ov3rfly: Makes the attributes configurable from outside, e.g. for language etc.
|
951 |
+
$atts = apply_filters( 'shariff3uu_render_atts', $atts );
|
952 |
+
|
953 |
+
// Removes empty elements.
|
954 |
+
$atts = array_filter( $atts );
|
955 |
+
|
956 |
+
// Cleans up services (remove leading or trailing |, spaces, etc.).
|
957 |
+
$atts['services'] = trim( preg_replace( '/[^A-Za-z|]/', '', $atts['services'] ), '|' );
|
958 |
+
|
959 |
+
// Cleans up the headline in case it was used in a shorttag.
|
960 |
+
if ( array_key_exists( 'headline', $atts ) ) {
|
961 |
+
$atts['headline'] = wp_kses( $atts['headline'], $GLOBALS['allowed_tags'] );
|
962 |
+
}
|
963 |
+
|
964 |
+
// Cleans up the alternative headline in case it was used in a shorttag.
|
965 |
+
if ( array_key_exists( 'headline_zero', $atts ) ) {
|
966 |
+
$atts['headline_zero'] = wp_kses( $atts['headline_zero'], $GLOBALS['allowed_tags'] );
|
967 |
+
}
|
968 |
+
|
969 |
+
// Remove previous added inline styles to prevent duplications.
|
970 |
+
if ( wp_style_is( 'shariffcss', 'enqueued' ) ) {
|
971 |
+
wp_deregister_style( 'shariffcss' );
|
972 |
+
}
|
973 |
+
|
974 |
+
// Enqueues the stylesheet (loading it here makes sure that it is only loaded on pages that actually contain shariff buttons).
|
975 |
+
// If SCRIPT_DEBUG is set to true, the non minified version will be loaded.
|
976 |
+
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG === true ) {
|
977 |
+
wp_enqueue_style( 'shariffcss', plugins_url( '/css/shariff.css', __FILE__ ), '', $shariff3uu['version'] );
|
978 |
+
} else {
|
979 |
+
wp_enqueue_style( 'shariffcss', plugins_url( '/css/shariff.min.css', __FILE__ ), '', $shariff3uu['version'] );
|
980 |
+
}
|
981 |
+
|
982 |
+
// Enqueues the share count script (the JS should be loaded at the footer - make sure that wp_footer() is present in your theme!)
|
983 |
+
// If SCRIPT_DEBUG is set to true, the non minified version will be loaded.
|
984 |
+
if ( array_key_exists( 'backend', $atts ) && 'on' === $atts['backend'] ) {
|
985 |
+
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG === true ) {
|
986 |
+
wp_enqueue_script( 'shariffjs', plugins_url( '/js/shariff.js', __FILE__ ), '', $shariff3uu['version'], true );
|
987 |
+
} else {
|
988 |
+
wp_enqueue_script( 'shariffjs', plugins_url( '/js/shariff.min.js', __FILE__ ), '', $shariff3uu['version'], true );
|
989 |
+
}
|
990 |
+
}
|
991 |
+
|
992 |
+
// Enqueues the popup script (the JS should be loaded at the footer - make sure that wp_footer() is present in your theme!).
|
993 |
+
// If SCRIPT_DEBUG is set to true, the non minified version will be loaded.
|
994 |
+
if ( array_key_exists( 'popup', $atts ) && 1 === $atts['popup'] ) {
|
995 |
+
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG === true ) {
|
996 |
+
wp_enqueue_script( 'shariff_popup', plugins_url( '/js/shariff-popup.js', __FILE__ ), '', $shariff3uu['version'], true );
|
997 |
+
} else {
|
998 |
+
wp_enqueue_script( 'shariff_popup', plugins_url( '/js/shariff-popup.min.js', __FILE__ ), '', $shariff3uu['version'], true );
|
999 |
+
}
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
// Sets the share url.
|
1003 |
+
if ( array_key_exists( 'url', $atts ) ) {
|
1004 |
+
$share_url = rawurlencode( $atts['url'] );
|
1005 |
+
} else {
|
1006 |
+
$share_url = rawurlencode( get_permalink() );
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
// Sets the share title.
|
1010 |
+
if ( array_key_exists( 'title', $atts ) ) {
|
1011 |
+
$share_title = rawurlencode( wp_strip_all_tags( $atts['title'] ) );
|
1012 |
+
} else {
|
1013 |
+
$share_title = rawurlencode( wp_strip_all_tags( html_entity_decode( get_the_title(), ENT_COMPAT, 'UTF-8' ) ) );
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
// Sets the transient name.
|
1017 |
+
$post_hash = 'shariff' . hash( 'md5', $share_url );
|
1018 |
+
|
1019 |
+
// Prevents php notices.
|
1020 |
+
$share_counts = array();
|
1021 |
+
$output = '';
|
1022 |
+
|
1023 |
+
// Gets the cached share counts.
|
1024 |
+
if ( array_key_exists( 'backend', $atts ) && 'on' === $atts['backend'] && get_transient( $post_hash ) !== false ) {
|
1025 |
+
$share_counts = get_transient( $post_hash );
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
// Adds ShariffSC container including custom styles if a custom style attribute or class exists.
|
1029 |
+
if ( array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts ) ) {
|
1030 |
+
$output .= '<div class="ShariffSC';
|
1031 |
+
if ( array_key_exists( 'cssclass', $atts ) ) {
|
1032 |
+
$output .= ' ' . esc_html( $atts['cssclass'] ) . '"';
|
1033 |
+
} else {
|
1034 |
+
$output .= '"';
|
1035 |
+
}
|
1036 |
+
if ( array_key_exists( 'style', $atts ) ) {
|
1037 |
+
$output .= ' style="' . esc_html( $atts['style'] ) . '"';
|
1038 |
+
}
|
1039 |
+
$output .= '>';
|
1040 |
+
}
|
1041 |
+
|
1042 |
+
// Sets the language using get_locale(), if no language is set or if automatic language selection is set as an option.
|
1043 |
+
if ( ! array_key_exists( 'lang', $atts ) || ( array_key_exists( 'autolang', $atts ) && 1 === $atts['autolang'] ) ) {
|
1044 |
+
$atts['lang'] = substr( get_locale(), 0, 2 );
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
// Sets the default button share text.
|
1048 |
+
$default_button_text_array = array(
|
1049 |
+
'bg' => 'cподеляне',
|
1050 |
+
'cs' => 'sdílet',
|
1051 |
+
'da' => 'del',
|
1052 |
+
'de' => 'teilen',
|
1053 |
+
'en' => 'share',
|
1054 |
+
'es' => 'compartir',
|
1055 |
+
'fi' => 'Jaa',
|
1056 |
+
'fr' => 'partager',
|
1057 |
+
'hr' => 'podijelite',
|
1058 |
+
'hu' => 'megosztás',
|
1059 |
+
'it' => 'condividi',
|
1060 |
+
'ja' => '共有',
|
1061 |
+
'ko' => '공유하기',
|
1062 |
+
'nl' => 'delen',
|
1063 |
+
'no' => 'del',
|
1064 |
+
'pl' => 'udostępnij',
|
1065 |
+
'pt' => 'compartilhar',
|
1066 |
+
'ro' => 'partajează',
|
1067 |
+
'ru' => 'поделиться',
|
1068 |
+
'sk' => 'zdieľať',
|
1069 |
+
'sl' => 'deli',
|
1070 |
+
'sr' => 'podeli',
|
1071 |
+
'sv' => 'dela',
|
1072 |
+
'tr' => 'paylaş',
|
1073 |
+
'zh' => '分享',
|
1074 |
+
);
|
1075 |
+
|
1076 |
+
// Adds the timestamp for the cache.
|
1077 |
+
if ( array_key_exists( 'timestamp', $atts ) ) {
|
1078 |
+
$post_timestamp = $atts['timestamp'];
|
1079 |
+
} else {
|
1080 |
+
$post_timestamp = absint( get_the_modified_date( 'U' ) );
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
// Starts the output of the actual Shariff buttons.
|
1084 |
+
$output .= '<div class="shariff';
|
1085 |
+
// Alignment.
|
1086 |
+
if ( array_key_exists( 'align', $atts ) && 'none' !== $atts['align'] ) {
|
1087 |
+
$output .= ' shariff-align-' . $atts['align'];
|
1088 |
+
}
|
1089 |
+
// Alignment widget.
|
1090 |
+
if ( array_key_exists( 'align_widget', $atts ) && 'none' !== $atts['align_widget'] ) {
|
1091 |
+
$output .= ' shariff-widget-align-' . $atts['align_widget'];
|
1092 |
+
}
|
1093 |
+
// Button Stretch.
|
1094 |
+
// phpcs:ignore
|
1095 |
+
if ( array_key_exists( 'buttonstretch', $atts ) && 1 == $atts['buttonstretch'] ) {
|
1096 |
+
$output .= ' shariff-buttonstretch';
|
1097 |
+
}
|
1098 |
+
$output .= '"';
|
1099 |
+
|
1100 |
+
// Hides buttons until css is loaded.
|
1101 |
+
if ( array_key_exists( 'hideuntilcss', $atts ) && 1 === $atts['hideuntilcss'] && ( ! function_exists( 'is_amp_endpoint' ) || ( function_exists( 'is_amp_endpoint' ) && false === is_amp_endpoint() ) ) ) {
|
1102 |
+
$output .= ' style="display:none"';
|
1103 |
+
}
|
1104 |
+
// Adds information for share count request.
|
1105 |
+
if ( array_key_exists( 'backend', $atts ) && 'on' === $atts['backend'] ) {
|
1106 |
+
// Share url.
|
1107 |
+
$output .= ' data-url="' . esc_html( $share_url ) . '"';
|
1108 |
+
// Timestamp for cache.
|
1109 |
+
$output .= ' data-timestamp="' . $post_timestamp . '"';
|
1110 |
+
// Hides share counts when they are zero.
|
1111 |
+
if ( isset( $atts['hidezero'] ) && 1 === $atts['hidezero'] ) {
|
1112 |
+
$output .= ' data-hidezero="1"';
|
1113 |
+
}
|
1114 |
+
// Add external api if entered, elseif test the subapi setting, elseif pretty permalinks are not activated fall back to manual rest route, else use the home url.
|
1115 |
+
if ( isset( $shariff3uu['external_host'] ) && ! empty( $shariff3uu['external_host'] ) && isset( $shariff3uu['external_direct'] ) ) {
|
1116 |
+
$output .= ' data-backendurl="' . $shariff3uu['external_host'] . '"';
|
1117 |
+
} elseif ( isset( $shariff3uu['subapi'] ) && 1 === $shariff3uu['subapi'] ) {
|
1118 |
+
$output .= ' data-backendurl="' . strtok( get_bloginfo( 'wpurl' ), '?' ) . '/wp-json/shariff/v1/share_counts?"';
|
1119 |
+
} elseif ( ! get_option( 'permalink_structure' ) ) {
|
1120 |
+
$output .= ' data-backendurl="?rest_route=/shariff/v1/share_counts&"';
|
1121 |
+
} else {
|
1122 |
+
$output .= ' data-backendurl="' . rtrim( strtok( home_url(), '?' ), '/' ) . '/wp-json/shariff/v1/share_counts?"';
|
1123 |
+
}
|
1124 |
+
}
|
1125 |
+
$output .= '>';
|
1126 |
+
|
1127 |
+
// Adds the headline.
|
1128 |
+
if ( array_key_exists( 'headline', $atts ) ) {
|
1129 |
+
if ( ! array_key_exists( 'total', $share_counts ) ) {
|
1130 |
+
$share_counts['total'] = 0;
|
1131 |
+
}
|
1132 |
+
if ( 0 === $share_counts['total'] && array_key_exists( 'headline_zero', $atts ) && ! empty( $atts['headline_zero'] ) ) {
|
1133 |
+
$atts['headline_zero'] = str_replace( '%total', '<span class="shariff-total">' . absint( $share_counts['total'] ) . '</span>', $atts['headline_zero'] );
|
1134 |
+
$output .= '<div class="ShariffHeadline">' . $atts['headline_zero'] . '</div>';
|
1135 |
+
} else {
|
1136 |
+
$atts['headline'] = str_replace( '%total', '<span class="shariff-total">' . absint( $share_counts['total'] ) . '</span>', $atts['headline'] );
|
1137 |
+
$output .= '<div class="ShariffHeadline">' . $atts['headline'] . '</div>';
|
1138 |
+
}
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
// Start the ul list with design classes.
|
1142 |
+
$output .= '<ul class="shariff-buttons ';
|
1143 |
+
// Theme.
|
1144 |
+
if ( array_key_exists( 'theme', $atts ) && 'wcag' !== $atts['theme'] ) {
|
1145 |
+
$output .= 'theme-' . esc_html( $atts['theme'] ) . ' ';
|
1146 |
+
} else {
|
1147 |
+
$output .= 'theme-default ';
|
1148 |
+
if ( array_key_exists( 'theme', $atts ) && 'wcag' === $atts['theme'] ) {
|
1149 |
+
$output .= 'wcag_colors ';
|
1150 |
+
}
|
1151 |
+
}
|
1152 |
+
// Orientation.
|
1153 |
+
if ( array_key_exists( 'orientation', $atts ) ) {
|
1154 |
+
$output .= 'orientation-' . esc_html( $atts['orientation'] ) . ' ';
|
1155 |
+
} else {
|
1156 |
+
$output .= 'orientation-horizontal ';
|
1157 |
+
}
|
1158 |
+
// Size.
|
1159 |
+
if ( array_key_exists( 'buttonsize', $atts ) ) {
|
1160 |
+
$output .= 'buttonsize-' . esc_html( $atts['buttonsize'] );
|
1161 |
+
} else {
|
1162 |
+
$output .= 'buttonsize-medium';
|
1163 |
+
}
|
1164 |
+
$output .= '">';
|
1165 |
+
|
1166 |
+
// Prevents warnings while debug mode is on.
|
1167 |
+
$flattr_error = '';
|
1168 |
+
$paypal_error = '';
|
1169 |
+
$paypalme_error = '';
|
1170 |
+
$bitcoin_error = '';
|
1171 |
+
$patreon_error = '';
|
1172 |
+
$button_text_array = '';
|
1173 |
+
$backend_available = '';
|
1174 |
+
$mobile_only = '';
|
1175 |
+
$button_url = '';
|
1176 |
+
$border_radius = '';
|
1177 |
+
|
1178 |
+
// Explodes services.
|
1179 |
+
$service_array = explode( '|', $atts['services'] );
|
1180 |
+
|
1181 |
+
// Migrates mail to mailto.
|
1182 |
+
$service_array = preg_replace( '/\bmail\b/', 'mailto', $service_array );
|
1183 |
+
|
1184 |
+
// Migrates mailform to mailto.
|
1185 |
+
$service_array = preg_replace( '/\bmailform\b/', 'mailto', $service_array );
|
1186 |
+
|
1187 |
+
// Remove duplicated services.
|
1188 |
+
$service_array = array_unique( $service_array );
|
1189 |
+
|
1190 |
+
// Loops through all desired services.
|
1191 |
+
foreach ( $service_array as $service ) {
|
1192 |
+
// Check if necessary usernames are set and display warning to admins, if needed.
|
1193 |
+
if ( 'flattr' === $service && ! array_key_exists( 'flattruser', $atts ) ) {
|
1194 |
+
$flattr_error = 1;
|
1195 |
+
} elseif ( 'paypal' === $service && ! array_key_exists( 'paypalbuttonid', $atts ) ) {
|
1196 |
+
$paypal_error = 1;
|
1197 |
+
} elseif ( 'paypalme' === $service && ! array_key_exists( 'paypalmeid', $atts ) ) {
|
1198 |
+
$paypalme_error = 1;
|
1199 |
+
} elseif ( 'bitcoin' === $service && ! array_key_exists( 'bitcoinaddress', $atts ) ) {
|
1200 |
+
$bitcoin_error = 1;
|
1201 |
+
} elseif ( 'patreon' === $service && ! array_key_exists( 'patreonid', $atts ) ) {
|
1202 |
+
$patreon_error = 1;
|
1203 |
+
} elseif ( 'total' !== $service && 'totalnumber' !== $service ) {
|
1204 |
+
|
1205 |
+
// Only the frontend part is needed.
|
1206 |
+
$frontend = 1;
|
1207 |
+
|
1208 |
+
// Determines the path to the service phps.
|
1209 |
+
$path_service_file = dirname( __FILE__ ) . '/services/shariff-' . $service . '.php';
|
1210 |
+
|
1211 |
+
// Checks if service file exists.
|
1212 |
+
if ( file_exists( $path_service_file ) ) {
|
1213 |
+
|
1214 |
+
// Includes service file.
|
1215 |
+
include $path_service_file;
|
1216 |
+
|
1217 |
+
// Replace $main_color with $wcag_color and $secondary_color with $wcag_secondary, if $wacg_theme is selected.
|
1218 |
+
if ( isset( $atts['theme'] ) && 'wcag' === $atts['theme'] && isset( $wcag_color ) && '' !== $wcag_color ) {
|
1219 |
+
$main_color = $wcag_color;
|
1220 |
+
$secondary_color = '#000';
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
// Info button for default theme.
|
1224 |
+
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 ) && 'wcag' === $atts['theme'] ) || ! array_key_exists( 'theme', $atts ) ) ) {
|
1225 |
+
$main_color = '#fff';
|
1226 |
+
$secondary_color = '#eee';
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
// Start <li.
|
1230 |
+
$output .= '<li class="shariff-button ' . $service;
|
1231 |
+
|
1232 |
+
// No custom colors.
|
1233 |
+
if ( ! array_key_exists( 'maincolor', $atts ) ) {
|
1234 |
+
$output .= ' shariff-nocustomcolor';
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
// Mobile only.
|
1238 |
+
if ( 1 === $mobile_only ) {
|
1239 |
+
$output .= ' shariff-mobile';
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
// AMP?
|
1243 |
+
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
|
1244 |
+
// Custom colors?
|
1245 |
+
if ( array_key_exists( 'secondarycolor', $atts ) ) {
|
1246 |
+
$output .= ' shariff-secondary-color';
|
1247 |
+
$css = '.shariff-secondary-color{background-color:' . $atts['secondarycolor'] . '}';
|
1248 |
+
} else {
|
1249 |
+
$output .= ' shariff-' . $service . '-secondary-color';
|
1250 |
+
$css = '.shariff-' . $service . '-secondary-color{background-color:' . $secondary_color . '}';
|
1251 |
+
}
|
1252 |
+
if ( false === strpos( $dynamic_css, $css ) ) {
|
1253 |
+
$dynamic_css .= $css;
|
1254 |
+
}
|
1255 |
+
// Border radius?
|
1256 |
+
if ( array_key_exists( 'borderradius', $atts ) && array_key_exists( 'theme', $atts ) && 'round' === $atts['theme'] ) {
|
1257 |
+
$output .= ' shariff-borderradius';
|
1258 |
+
$css = '.shariff .shariff-buttons.theme-round .shariff-borderradius{border-radius:' . $atts['borderradius'] . '%}';
|
1259 |
+
if ( false === strpos( $dynamic_css, $css ) ) {
|
1260 |
+
$dynamic_css .= $css;
|
1261 |
+
}
|
1262 |
+
}
|
1263 |
+
} else {
|
1264 |
+
$output .= '" style="';
|
1265 |
+
// Custom colors?
|
1266 |
+
if ( array_key_exists( 'secondarycolor', $atts ) ) {
|
1267 |
+
$output .= 'background-color:' . $atts['secondarycolor'];
|
1268 |
+
} else {
|
1269 |
+
$output .= 'background-color:' . $secondary_color;
|
1270 |
+
}
|
1271 |
+
// Border radius?
|
1272 |
+
if ( array_key_exists( 'borderradius', $atts ) && array_key_exists( 'theme', $atts ) && 'round' === $atts['theme'] ) {
|
1273 |
+
$output .= ';border-radius:' . $atts['borderradius'] . '%';
|
1274 |
+
$border_radius = ';border-radius:' . $atts['borderradius'] . '%';
|
1275 |
+
}
|
1276 |
+
}
|
1277 |
+
|
1278 |
+
// End li>.
|
1279 |
+
$output .= '">';
|
1280 |
+
|
1281 |
+
// Uses default button share text, if $button_text_array is empty.
|
1282 |
+
if ( empty( $button_text_array ) ) {
|
1283 |
+
$button_text_array = $default_button_text_array;
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
// Sets button text in desired language, first fallback is default language set in options, second one is English.
|
1287 |
+
if ( array_key_exists( 'lang', $atts ) && array_key_exists( $atts['lang'], $button_text_array ) ) {
|
1288 |
+
$button_text = $button_text_array[ $atts['lang'] ];
|
1289 |
+
} elseif ( isset( $shariff3uu['lang'] ) && ! empty( $shariff3uu['lang'] ) && array_key_exists( $shariff3uu['lang'], $button_text_array ) ) {
|
1290 |
+
$button_text = $button_text_array[ $shariff3uu['lang'] ];
|
1291 |
+
} else {
|
1292 |
+
$button_text = $button_text_array['en'];
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
// Sets the button title / label in desired language; fallback is English.
|
1296 |
+
if ( array_key_exists( 'lang', $atts ) && array_key_exists( $atts['lang'], $button_title_array ) ) {
|
1297 |
+
$button_title = $button_title_array[ $atts['lang'] ];
|
1298 |
+
} else {
|
1299 |
+
$button_title = $button_title_array['en'];
|
1300 |
+
}
|
1301 |
+
|
1302 |
+
// Resets $button_text_array.
|
1303 |
+
$button_text_array = '';
|
1304 |
+
|
1305 |
+
/** Build the actual button. */
|
1306 |
+
|
1307 |
+
// Begin <a.
|
1308 |
+
$output .= '<a ';
|
1309 |
+
|
1310 |
+
// Check if we are on an AMP page and the print button is requested.
|
1311 |
+
if ( 'printer' === $service && function_exists( 'is_amp_endpoint' ) && true === is_amp_endpoint() ) {
|
1312 |
+
$output .= 'on="tap:AMP.print" ';
|
1313 |
+
} else {
|
1314 |
+
$output .= 'href="' . $button_url . '" ';
|
1315 |
+
}
|
1316 |
+
|
1317 |
+
// Output title, label and role.
|
1318 |
+
$output .= 'title="' . $button_title . '" aria-label="' . $button_title . '" role="button"';
|
1319 |
+
if ( 'rss' !== $service ) {
|
1320 |
+
$output .= ' rel="';
|
1321 |
+
if ( 'facebook' !== $service ) {
|
1322 |
+
$output .= 'noopener ';
|
1323 |
+
}
|
1324 |
+
$output .= 'nofollow"';
|
1325 |
+
}
|
1326 |
+
$output .= ' class="shariff-link';
|
1327 |
+
|
1328 |
+
// AMP?
|
1329 |
+
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
|
1330 |
+
$output .= ' shariff-borderradius';
|
1331 |
+
// Custom color?
|
1332 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1333 |
+
$output .= ' shariff-main-color';
|
1334 |
+
$css = '.shariff-main-color{background-color:' . $atts['maincolor'] . '}';
|
1335 |
+
} else {
|
1336 |
+
$output .= ' shariff-' . $service . '-main-color';
|
1337 |
+
$css = '.shariff-' . $service . '-main-color{background-color:' . $main_color . '}';
|
1338 |
+
}
|
1339 |
+
if ( false === strpos( $dynamic_css, $css ) ) {
|
1340 |
+
$dynamic_css .= $css;
|
1341 |
+
}
|
1342 |
+
// Theme white?
|
1343 |
+
if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
|
1344 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1345 |
+
$output .= ' shariff-text-color"';
|
1346 |
+
$css = '.shariff-text-color{color:' . $atts['maincolor'] . '}';
|
1347 |
+
} else {
|
1348 |
+
$output .= ' shariff-' . $service . '-text-color"';
|
1349 |
+
$css = '.shariff-' . $service . '-text-color{color:' . $main_color . '}';
|
1350 |
+
}
|
1351 |
+
if ( false === strpos( $dynamic_css, $css ) ) {
|
1352 |
+
$dynamic_css .= $css;
|
1353 |
+
}
|
1354 |
+
} else {
|
1355 |
+
$output .= ' shariff-text-white"';
|
1356 |
+
}
|
1357 |
+
} else {
|
1358 |
+
// Border radius.
|
1359 |
+
$output .= '" style="' . $border_radius;
|
1360 |
+
// Custom color?
|
1361 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1362 |
+
$output .= '; background-color:' . $atts['maincolor'];
|
1363 |
+
} else {
|
1364 |
+
$output .= '; background-color:' . $main_color;
|
1365 |
+
}
|
1366 |
+
// Theme white?
|
1367 |
+
if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
|
1368 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1369 |
+
$output .= '; color:' . $atts['maincolor'] . '"';
|
1370 |
+
} else {
|
1371 |
+
$output .= '; color:' . $main_color . '"';
|
1372 |
+
}
|
1373 |
+
} else {
|
1374 |
+
$output .= '; color:#fff"';
|
1375 |
+
}
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
// Same window?
|
1379 |
+
if ( ! isset( $same_window ) || isset( $same_window ) && 1 !== $same_window ) {
|
1380 |
+
$output .= ' target="_blank"';
|
1381 |
+
}
|
1382 |
+
|
1383 |
+
// End a>.
|
1384 |
+
$output .= '>';
|
1385 |
+
|
1386 |
+
// Shariff icon.
|
1387 |
+
$output .= '<span class="shariff-icon';
|
1388 |
+
// AMP?
|
1389 |
+
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
|
1390 |
+
// Theme white?
|
1391 |
+
if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
|
1392 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1393 |
+
$output .= ' shariff-svg-color';
|
1394 |
+
$css = '.shariff-svg-color{fill:' . $atts['maincolor'] . '}';
|
1395 |
+
} else {
|
1396 |
+
$output .= ' shariff-' . $service . '-svg-color';
|
1397 |
+
$css = '.shariff-' . $service . '-svg-color{fill:' . $main_color . '}';
|
1398 |
+
}
|
1399 |
+
if ( false === strpos( $dynamic_css, $css ) ) {
|
1400 |
+
$dynamic_css .= $css;
|
1401 |
+
}
|
1402 |
+
}
|
1403 |
+
} else {
|
1404 |
+
$output .= '" style="';
|
1405 |
+
// Theme white?
|
1406 |
+
if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
|
1407 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1408 |
+
$output .= 'fill:' . $atts['maincolor'];
|
1409 |
+
} else {
|
1410 |
+
$output .= 'fill:' . $main_color;
|
1411 |
+
}
|
1412 |
+
}
|
1413 |
+
}
|
1414 |
+
$output .= '">' . $svg_icon . '</span>';
|
1415 |
+
|
1416 |
+
// Shariff text.
|
1417 |
+
if ( ( ! isset( $atts['theme'] ) || ( isset( $atts['theme'] ) && 'round' !== $atts['theme'] ) ) && 'info' !== $service ) {
|
1418 |
+
$output .= '<span class="shariff-text';
|
1419 |
+
// AMP?
|
1420 |
+
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
|
1421 |
+
// Theme white?
|
1422 |
+
if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
|
1423 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1424 |
+
$output .= ' shariff-text-color';
|
1425 |
+
$css = '.shariff-text-color{color:' . $atts['maincolor'] . '}';
|
1426 |
+
} else {
|
1427 |
+
$output .= ' shariff-' . $service . '-text-color';
|
1428 |
+
$css = '.shariff-' . $service . '-text-color{color:' . $main_color . '}';
|
1429 |
+
}
|
1430 |
+
if ( false === strpos( $dynamic_css, $css ) ) {
|
1431 |
+
$dynamic_css .= $css;
|
1432 |
+
}
|
1433 |
+
}
|
1434 |
+
} else {
|
1435 |
+
// Theme white?
|
1436 |
+
if ( isset( $atts['theme'] ) && 'white' === $atts['theme'] ) {
|
1437 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1438 |
+
$output .= '" style="color:' . $atts['maincolor'];
|
1439 |
+
} else {
|
1440 |
+
$output .= '" style="color:' . $main_color;
|
1441 |
+
}
|
1442 |
+
}
|
1443 |
+
}
|
1444 |
+
$output .= '">' . $button_text . '</span> ';
|
1445 |
+
}
|
1446 |
+
|
1447 |
+
// Share counts?
|
1448 |
+
if ( array_key_exists( 'sharecounts', $atts ) && 1 === $atts['sharecounts'] && 1 === $backend_available && ! isset( $shariff3uu['disable'][ $service ] ) ) {
|
1449 |
+
$output .= '<span data-service="' . $service . '"';
|
1450 |
+
// AMP?
|
1451 |
+
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
|
1452 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1453 |
+
$output .= ' class="shariff-count shariff-text-color"';
|
1454 |
+
$css = '.shariff-text-color{color:#fff}';
|
1455 |
+
} else {
|
1456 |
+
$output .= ' class="shariff-count shariff-' . $service . '-text-color';
|
1457 |
+
$css = '.shariff-' . $service . '-text-color{color:' . $main_color . '}';
|
1458 |
+
}
|
1459 |
+
if ( false === strpos( $dynamic_css, $css ) ) {
|
1460 |
+
$dynamic_css .= $css;
|
1461 |
+
}
|
1462 |
+
} else {
|
1463 |
+
if ( array_key_exists( 'maincolor', $atts ) ) {
|
1464 |
+
$output .= ' style="color:#fff" class="shariff-count';
|
1465 |
+
|
1466 |
+
} else {
|
1467 |
+
$output .= ' style="color:' . $main_color . '" class="shariff-count';
|
1468 |
+
|
1469 |
+
}
|
1470 |
+
}
|
1471 |
+
// Hide zero?
|
1472 |
+
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 ) ) ) {
|
1473 |
+
$output .= '"> ' . $share_counts[ $service ];
|
1474 |
+
} else {
|
1475 |
+
$output .= ' shariff-hidezero">';
|
1476 |
+
}
|
1477 |
+
$output .= '</span> ';
|
1478 |
+
}
|
1479 |
+
$output .= '</a>';
|
1480 |
+
$output .= '</li>';
|
1481 |
+
|
1482 |
+
// Adds service to backend service, if available.
|
1483 |
+
if ( 1 === $backend_available && ! isset( $shariff3uu['disable'][ $service ] ) ) {
|
1484 |
+
$backend_service_array[] = $service;
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
// Reset variables.
|
1488 |
+
$backend_available = '';
|
1489 |
+
$mobile_only = '';
|
1490 |
+
$same_window = '';
|
1491 |
+
$wcag_color = '';
|
1492 |
+
} // End if service file exists.
|
1493 |
+
} // End if is real and fully setup service.
|
1494 |
+
} // End foreach() loop.
|
1495 |
+
|
1496 |
+
// Adds the list of backend services.
|
1497 |
+
if ( ! empty( $backend_service_array ) ) {
|
1498 |
+
$backend_services = implode( '|', $backend_service_array );
|
1499 |
+
$output = str_replace( 'data-url=', 'data-services="' . esc_html( rawurlencode( $backend_services ) ) . '" data-url=', $output );
|
1500 |
+
}
|
1501 |
+
|
1502 |
+
// Closes ul and the main shariff div.
|
1503 |
+
$output .= '</ul></div>';
|
1504 |
+
|
1505 |
+
// Closes the style attribute, if there was one.
|
1506 |
+
if ( array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts ) ) {
|
1507 |
+
$output .= '</div>';
|
1508 |
+
}
|
1509 |
+
|
1510 |
+
// Update the dynamic css db entry if needed.
|
1511 |
+
if ( ( array_key_exists( 'dynamic_css', $shariff3uu ) && $shariff3uu['dynamic_css'] !== $dynamic_css ) || ! array_key_exists( 'dynamic_css', $shariff3uu ) ) {
|
1512 |
+
$shariff3uu_design = array_filter( $GLOBALS['shariff3uu_design'] );
|
1513 |
+
$shariff3uu_design['dynamic_css'] = $dynamic_css;
|
1514 |
+
$GLOBALS['shariff3uu']['dynamic_css'] = $dynamic_css;
|
1515 |
+
update_option( 'shariff3uu_design', $shariff3uu_design );
|
1516 |
+
}
|
1517 |
+
|
1518 |
+
// Displays a warning to admins if flattr is set, but no flattr username was provided.
|
1519 |
+
if ( 1 === $flattr_error && current_user_can( 'manage_options' ) ) {
|
1520 |
+
$output .= '<div class="shariff-warning">' . __( 'Username for Flattr is missing!', 'shariff' ) . '</div>';
|
1521 |
+
}
|
1522 |
+
// Displays a warning to admins if patreon is set, but no patreon username was provided.
|
1523 |
+
if ( 1 === $patreon_error && current_user_can( 'manage_options' ) ) {
|
1524 |
+
$output .= '<div class="shariff-warning">' . __( 'Username for patreon is missing!', 'shariff' ) . '</div>';
|
1525 |
+
}
|
1526 |
+
// Displays a warning to admins if paypal is set, but no paypal button id was provided.
|
1527 |
+
if ( 1 === $paypal_error && current_user_can( 'manage_options' ) ) {
|
1528 |
+
$output .= '<div class="shariff-warning">' . __( 'Button ID for PayPal is missing!', 'shariff' ) . '</div>';
|
1529 |
+
}
|
1530 |
+
// Displays a warning to admins if paypalme is set, but no paypalme id was provided.
|
1531 |
+
if ( 1 === $paypalme_error && current_user_can( 'manage_options' ) ) {
|
1532 |
+
$output .= '<div class="shariff-warning">' . __( 'PayPal.Me ID is missing!', 'shariff' ) . '</div>';
|
1533 |
+
}
|
1534 |
+
// Displays a warning to admins if bitcoin is set, but no bitcoin address was provided.
|
1535 |
+
if ( 1 === $bitcoin_error && current_user_can( 'manage_options' ) ) {
|
1536 |
+
$output .= '<div class="shariff-warning">' . __( 'Address for Bitcoin is missing!', 'shariff' ) . '</div>';
|
1537 |
+
}
|
1538 |
+
|
1539 |
+
// If the service totalnumber is set, just output the total share count.
|
1540 |
+
if ( array_key_exists( '0', $service_array ) && 'totalnumber' === $service_array['0'] ) {
|
1541 |
+
$output = '<span class="shariff" data-services="totalnumber" data-url="' . $share_url . '"';
|
1542 |
+
// Adds the external api.
|
1543 |
+
if ( isset( $shariff3uu['external_host'] ) && ! empty( $shariff3uu['external_host'] ) && isset( $shariff3uu['external_direct'] ) ) {
|
1544 |
+
$output .= ' data-backendurl="' . $shariff3uu['external_host'] . '"';
|
1545 |
+
}
|
1546 |
+
$output .= '><span class="shariff-totalnumber">' . absint( $share_counts['total'] ) . '</span></span>';
|
1547 |
+
}
|
1548 |
+
|
1549 |
+
return $output;
|
1550 |
+
}
|
1551 |
+
|
1552 |
+
// Registers the helper shortcode.
|
1553 |
+
add_shortcode( 'shariffmeta', 'shariff3uu_meta' );
|
1554 |
+
|
1555 |
+
/**
|
1556 |
+
* Meta box helper function. Creates a global variable with the current meta box attributes.
|
1557 |
+
*
|
1558 |
+
* @param array $atts List of shariff shortcode attributes.
|
1559 |
+
*/
|
1560 |
+
function shariff3uu_meta( $atts ) {
|
1561 |
+
if ( ! empty( $atts ) ) {
|
1562 |
+
$GLOBALS['shariff3uu']['metabox'] = $atts;
|
1563 |
+
} else {
|
1564 |
+
$GLOBALS['shariff3uu']['metabox'] = array();
|
1565 |
+
}
|
1566 |
+
}
|
1567 |
+
|
1568 |
+
/**
|
1569 |
+
* Clears transients and removes cron job upon deactivation.
|
1570 |
+
*/
|
1571 |
+
function shariff3uu_deactivate() {
|
1572 |
+
global $wpdb;
|
1573 |
+
// Checks for multisite.
|
1574 |
+
if ( is_multisite() && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
|
1575 |
+
$sites = get_sites();
|
1576 |
+
foreach ( $sites as $site ) {
|
1577 |
+
switch_to_blog( $site->blog_id );
|
1578 |
+
// Purges transients.
|
1579 |
+
shariff3uu_purge_transients_deactivation();
|
1580 |
+
// Removes the cron job.
|
1581 |
+
wp_clear_scheduled_hook( 'shariff3uu_fill_cache' );
|
1582 |
+
// Switches back to main blog.
|
1583 |
+
restore_current_blog();
|
1584 |
+
}
|
1585 |
+
} else {
|
1586 |
+
// Purges transients.
|
1587 |
+
shariff3uu_purge_transients_deactivation();
|
1588 |
+
// Removes cron job.
|
1589 |
+
wp_clear_scheduled_hook( 'shariff3uu_fill_cache' );
|
1590 |
+
}
|
1591 |
+
}
|
1592 |
+
register_deactivation_hook( __FILE__, 'shariff3uu_deactivate' );
|
1593 |
+
|
1594 |
+
/**
|
1595 |
+
* Purges all the transients associated with our plugin.
|
1596 |
+
*/
|
1597 |
+
function shariff3uu_purge_transients_deactivation() {
|
1598 |
+
// Makes sure the $wpdb class is ready.
|
1599 |
+
if ( ! isset( $wpdb ) ) {
|
1600 |
+
global $wpdb;
|
1601 |
+
}
|
1602 |
+
// Deletes transients.
|
1603 |
+
// phpcs:disable
|
1604 |
+
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_timeout_shariff%"' );
|
1605 |
+
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_shariff%"' );
|
1606 |
+
// phpcs:enable
|
1607 |
+
// Clears the object cache.
|
1608 |
+
wp_cache_flush();
|
1609 |
+
}
|
wpml-config.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<wpml-config>
|
2 |
+
<admin-texts>
|
3 |
+
<key name="shariff3uu_design">
|
4 |
+
<key name="headline"/>
|
5 |
+
<key name="headline_zero"/>
|
6 |
+
</key>
|
7 |
+
<key name="shariff3uu_advanced">
|
8 |
+
<key name="info_url"/>
|
9 |
+
<key name="info_text"/>
|
10 |
+
</key>
|
11 |
+
</admin-texts>
|
12 |
+
</wpml-config>
|