Sync plugins from current page

Signed-off-by: Adrian Nöthlich <git@promasu.tech>
This commit is contained in:
2019-09-11 19:08:46 +02:00
parent 85d41e4216
commit 8515ff9587
1847 changed files with 505469 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,162 @@
<?php
/**
* Will be included in the shariff.php only, when an user is logged in.
*
* @package Shariff Wrapper
* @subpackage admin
*/
// Prevent direct calls to admin_menu.php.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Call setup function on the post editor screen.
add_action( 'load-post.php', 'shariff3uu_metabox_setup' );
add_action( 'load-post-new.php', 'shariff3uu_metabox_setup' );
/**
* Meta box setup function.
*/
function shariff3uu_metabox_setup() {
add_action( 'add_meta_boxes', 'shariff3uu_add_metabox' );
}
/**
* Adds the meta box.
*/
function shariff3uu_add_metabox() {
foreach ( get_post_types() as $posttype ) {
add_meta_box( 'shariff_metabox', __( 'Shariff Settings', 'shariff' ), 'shariff3uu_build_metabox', $posttype, 'side', 'default' );
}
}
/**
* Builds the meta box.
*/
function shariff3uu_build_metabox() {
// Scripts for the pinterest image media uploader.
wp_enqueue_media();
wp_register_script( 'shariff_mediaupload', plugins_url( '../js/shariff-media.js', __FILE__ ), array( 'jquery' ), '1.0', true );
$translation_array = array( 'choose_image' => __( 'Choose image', 'shariff' ) );
wp_localize_script( 'shariff_mediaupload', 'shariff_media', $translation_array );
wp_enqueue_script( 'shariff_mediaupload' );
// Make sure the form request comes from WordPress.
wp_nonce_field( basename( __FILE__ ), 'shariff_metabox_nonce' );
// Retrieve the current metabox disable value.
$shariff_metabox_disable = get_post_meta( get_the_ID(), 'shariff_metabox_disable', true );
// Disable checkbox.
echo '<p><strong>' . esc_html__( 'Disable Shariff', 'shariff' ) . '</strong><br>';
echo '<input type="checkbox" name="shariff_metabox_disable" id="shariff_metabox_disable"';
if ( isset( $shariff_metabox_disable ) ) {
echo checked( $shariff_metabox_disable, 1, 0 );
}
echo '>';
echo '<label for="shariff_metabox_disable">' . esc_html__( 'Disable Shariff for this content.', 'shariff' ) . '</label></p>';
// Retrieve the current metabox add before and after values.
$shariff_metabox_before = get_post_meta( get_the_ID(), 'shariff_metabox_before', true );
$shariff_metabox_after = get_post_meta( get_the_ID(), 'shariff_metabox_after', true );
// Add Shariff checkboxes.
echo '<p><strong>' . esc_html__( 'Add Shariff', 'shariff' ) . '</strong><br>';
// Before checkbox.
echo '<input type="checkbox" name="shariff_metabox_before" id="shariff_metabox_before"';
if ( isset( $shariff_metabox_before ) ) {
echo checked( $shariff_metabox_before, 1, 0 );
}
echo '>';
echo '<label for="shariff_metabox_before">' . esc_html__( 'Add buttons before this content.', 'shariff' ) . '</label><br>';
// After checkbox.
echo '<input type="checkbox" name="shariff_metabox_after" id="shariff_metabox_after"';
if ( isset( $shariff_metabox_after ) ) {
echo checked( $shariff_metabox_after, 1, 0 );
}
echo '>';
echo '<label for="shariff_metabox_after">' . esc_html__( 'Add buttons after this content.', 'shariff' ) . '</label></p>';
// Retrieve the current metabox media value (pinterest image).
$shariff_metabox_media = get_post_meta( get_the_ID(), 'shariff_metabox_media', true );
// Metabox shortcode.
echo '<p><strong>' . esc_html__( 'Pinterest Image', 'shariff' ) . '</strong><br><label for="shariff_metabox_media">' . esc_html__( 'The complete url to your desired custom image for Pinterest.', 'shariff' ) . '</label><br>';
echo '<input type="text" name="shariff_metabox_media" id="shariff-image-url" value="' . esc_html( $shariff_metabox_media ) . '" style="width:90%; margin-right:5px"><input type="button" name="upload-btn" id="shariff-upload-btn" class="button-secondary" value="' . esc_html__( 'Choose image', 'shariff' ) . '"></p>';
// Retrieve the current metabox shortcode value.
$shariff_metabox = get_post_meta( get_the_ID(), 'shariff_metabox', true );
// Metabox shortcode.
echo '<p><strong>' . esc_html__( 'Shortcode', 'shariff' ) . '</strong><br><label for="shariff_metabox">' . esc_html__( 'The settings in this shortcode field overwrite ALL global settings.', 'shariff' ) . '</label><br>';
echo '<input type="text" name="shariff_metabox" id="shariff_metabox" value="' . esc_html( $shariff_metabox ) . '" placeholder="[shariff]" style="width:90%"></p>';
// Retrieve the current metabox ignore widget value.
$shariff_metabox_ignore_widget = get_post_meta( get_the_ID(), 'shariff_metabox_ignore_widget', true );
// Disable checkbox.
echo '<p><strong>' . esc_html__( 'Ignore Widgets', 'shariff' ) . '</strong><br>';
echo '<input type="checkbox" name="shariff_metabox_ignore_widget" id="shariff_metabox_ignore_widget"';
if ( isset( $shariff_metabox_ignore_widget ) ) {
echo checked( $shariff_metabox_ignore_widget, 1, 0 );
}
echo '>';
echo '<label for="shariff_metabox_ignore_widget">' . esc_html__( 'Do not affect buttons in widgets.', 'shariff' ) . '</label></p>';
}
/**
* Save meta data.
*
* @param integer $post_id ID of the current post.
* @param WP_Post $post Current post.
*/
function shariff3uu_save_metabox_data( $post_id, $post ) {
// Check nonce and if shariff_metabox is set.
if ( isset( $_REQUEST['shariff_metabox_nonce'] ) && wp_verify_nonce( sanitize_key( $_REQUEST['shariff_metabox_nonce'] ), basename( __FILE__ ) ) ) {
// Check if we are not autosaving or previewing (revision), else we are good to go and can save our meta box data.
$post_type_object = get_post_type_object( $post->post_type );
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || wp_is_post_revision( $post ) || ( is_multisite() && ms_is_switched() ) || ! current_user_can( $post_type_object->cap->edit_post, $post_id ) ) {
return;
} else {
// Save meta box disable.
if ( isset( $_POST['shariff_metabox_disable'] ) && 'on' === $_POST['shariff_metabox_disable'] ) {
update_post_meta( $post_id, 'shariff_metabox_disable', 1 );
} else {
delete_post_meta( $post_id, 'shariff_metabox_disable', 1 );
}
// Save meta box add before value.
if ( isset( $_POST['shariff_metabox_before'] ) && 'on' === $_POST['shariff_metabox_before'] ) {
update_post_meta( $post_id, 'shariff_metabox_before', 1 );
} else {
delete_post_meta( $post_id, 'shariff_metabox_before', 1 );
}
// Save meta box add after value.
if ( isset( $_POST['shariff_metabox_after'] ) && 'on' === $_POST['shariff_metabox_after'] ) {
update_post_meta( $post_id, 'shariff_metabox_after', 1 );
} else {
delete_post_meta( $post_id, 'shariff_metabox_after', 1 );
}
// Save meta box media.
if ( isset( $_POST['shariff_metabox_media'] ) && ! empty( $_POST['shariff_metabox_media'] ) ) {
update_post_meta( $post_id, 'shariff_metabox_media', esc_url_raw( wp_unslash( $_POST['shariff_metabox_media'] ) ) );
} else {
delete_post_meta( $post_id, 'shariff_metabox_media' );
}
// Save meta box shortcode.
if ( isset( $_POST['shariff_metabox'] ) && ! empty( $_POST['shariff_metabox'] ) ) {
update_post_meta( $post_id, 'shariff_metabox', wp_kses( wp_unslash( $_POST['shariff_metabox'] ), $GLOBALS['allowed_tags'] ) );
} else {
delete_post_meta( $post_id, 'shariff_metabox' );
}
// Save meta box ignore widgets.
if ( isset( $_POST['shariff_metabox_ignore_widget'] ) && 'on' === $_POST['shariff_metabox_ignore_widget'] ) {
update_post_meta( $post_id, 'shariff_metabox_ignore_widget', 1 );
} else {
delete_post_meta( $post_id, 'shariff_metabox_ignore_widget', 1 );
}
}
}
}
add_action( 'save_post', 'shariff3uu_save_metabox_data', 10, 2 );

View File

@@ -0,0 +1,51 @@
<?php
/**
* Will be included in the shariff.php to display admin notices about missing settings.
*
* @package Shariff Wrapper
* @subpackage admin
*/
// Prevent direct calls to admin_menu.php.
if ( ! class_exists( 'WP' ) ) {
die();
}
/**
* Display an info notice, if a service has been selected that requires a username, id, etc. and none has been provided.
*/
function shariff3uu_service_notice() {
// Prevent php info notices.
$services = array();
// Check if any services are set and if user can manage options.
if ( isset( $GLOBALS['shariff3uu']['services'] ) && current_user_can( 'manage_options' ) ) {
// Patreon.
if ( strpos( $GLOBALS['shariff3uu']['services'], 'patreon' ) !== false && empty( $GLOBALS['shariff3uu']['patreonid'] ) ) {
$services[] = 'Patreon';
}
// PayPal.
if ( strpos( $GLOBALS['shariff3uu']['services'], 'paypal' ) !== false && strpos( $GLOBALS['shariff3uu']['services'], 'paypalme' ) === false && empty( $GLOBALS['shariff3uu']['paypalbuttonid'] ) ) {
$services[] = 'PayPal';
}
// PayPal.me.
if ( strpos( $GLOBALS['shariff3uu']['services'], 'paypalme' ) !== false && empty( $GLOBALS['shariff3uu']['paypalmeid'] ) ) {
$services[] = 'PayPal.Me';
}
// Bitcoin.
if ( strpos( $GLOBALS['shariff3uu']['services'], 'bitcoin' ) !== false && empty( $GLOBALS['shariff3uu']['bitcoinaddress'] ) ) {
$services[] = 'Bitcoin';
}
// Loop through services and display an info notice.
foreach ( $services as $service ) {
echo '<div class="notice notice-error"><p>';
$settings_url = get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page=shariff3uu&tab=advanced">';
// Translators: %s will be replaced with the correct URL to the local Shariff Settings page and tab.
printf( wp_kses( __( 'Please check your <a href="%s">Shariff Settings</a>!', 'shariff' ), array( 'a' => array( 'href' => true ) ) ), esc_url( $settings_url ) );
echo ' ';
// Translators: %s will be replaced with a service name e.g. Twitter.
printf( wp_kses( __( '%s has been selected as a service, but no username, ID or address has been provided! Please enter the required information on the advanced tab!', 'shariff' ), array() ), esc_html( $service ) );
echo '</p></div>';
}
}
}
add_action( 'admin_notices', 'shariff3uu_service_notice' );

View File

@@ -0,0 +1,22 @@
<?php /** @noinspection PhpCSValidationInspection */
/**
* Generates an QR code for bitcoin.
*
* @package Shariff Wrapper
*/
// Includes php class for QR code generation.
require './includes/phpqrcode.php';
// Gets the bitcoin address.
$bitcoinaddress = htmlspecialchars( $_GET['bitcoinaddress'] );
// Creates the page.
echo '<html lang="en"><head><title>Bitcoin</title></head><body>';
echo '<div style="text-align:center;"><h1>Bitcoin</h1></div>';
echo '<p style="text-align:center;"><a href="bitcoin:' . $bitcoinaddress . '">bitcoin:' . $bitcoinaddress . '</a></p>';
echo '<p style="text-align:center;">';
QRcode::svg( $bitcoinaddress, false, 'h', 5 );
echo '</p>';
echo '<p style="text-align:center;">Information: <a href="https://www.bitcoin.org" target="_blank">bitcoin.org</a></p>';
echo '</body></html>';

View File

@@ -0,0 +1,670 @@
=== Shariff Wrapper ===
== Changelog ==
= 4.6.3 =
- updated the WhatsApp share link to work with all devices again (thanks to @hanshansenxxx)
- updated to Facebook Graph API v3.3
- updated the Flattr button to reflect the new Flattr (thanks to Chris, @camthor)
- fixed an update issue with WP CLI
- removed the Facebook share counts request without APP ID and Secret
- Facebook now always requires an APP ID and Secret for share counts
- removed Flattr counts due to Flattr removing the API
= 4.6.2 =
- new service MeWe
- new service Buffer
- fixed an issue in case the plugin dir has been moved via symlink
= 4.6.1 =
- replaced Stumbleupon with its successor Mix (thanks to Mark)
- added an option to hide WhatsApp on desktop devices
- updated Odnoklassniki API
- fixed an issue with WPML and some older Shariff setups
= 4.6.0 =
- 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
= 4.5.3 =
- removed LinkedIn Share Counts due to LinkedIn removing them completely
- removed GooglePlus Share Counts due to Google shutting GooglePlus down
- removed OpenShareCount due to the service having shut down
- removed NewShareCount due to the service having shut down
- removed Mastodon temporarily until a new working solution is available
- deprecated GooglePlus as a service, will be removed with the next release
- added TwitCount (twitcount.com) as an alternative for Twitter share counts
- updated to Facebook Graph API v3.2
- updated to WordPress Coding Standards 2.0
- corrected minor typos
- added the new logo thanks to Philipp Wildfeuer (@phil_sauvage)
= 4.5.2 =
- added support for share count requests of multilingual sites
- updated button translations for Twitter and Pinterest (thanks to Jessica, @jess78)
- updated to Facebook Graph API v3.0
= 4.5.1 =
- added support for the new WordPress Privacy Policy Guide added in 4.9.6
- minor css adjustments
- minor bug fixes
= 4.5.0 =
- new option to add Shariff to custom WordPress hooks
- new option to support multilingual sites using WPML and other plugins
- new support for WooCommerce products on the ranking table
- new option to show different headlines based on share counts
- updated button languages, now supporting 25 languages
- fixed a bug causing share counts to not being displayed properly
= 4.4.4 =
- add support for automatic addition to bbpress forums, topics and replies
- fix a bug that caused "hideshariff" to not function properly
= 4.4.3 =
- new support for additional manual AMP integrations
- new support for the print button on AMP pages
- fixed a php error on certain server configurations
- fixed a markup typo
- minor css improvements
= 4.4.2 =
- new support for the "AMP for WP" plugin by Ahmed and Mohammed Kaludi
- improved support for the "AMP for WordPress" plugin by Automattic
- new additional workaround for servers without $_SERVER for category pages
- minor bug fixes
= 4.4.1 =
- new service wallabag (thanks to Torsten, @knodderdachs)
- minor bug fixes
- updated help section
= 4.4.0 =
- new service Telegram (thanks to Daniel Sturm, @dcsturm)
- new service Flipboard (thanks to csigncsign, @csigncsign)
- new service Mastodon (thanks to scroom, @scroom)
- new service Qzone
- new service Weibo
- new service TencentWeibo
- new service SMS (will work on iOS, might not work on other phones)
- new support of the "AMP for WordPress" plugin by Automattic
- new option to set a custom text for the info button
- new option to disable the metabox
- new option to add shariff to CPTs before the content
- new ranking table now also shows pages
- new fix to prevent Shariff buttons from being displayed on admin pages
- new fix to support WP-CLI (thanks to Daniel Jagszent, @d--j)
- fixed HTML errors regarding self closing tags (thanks to Tooni, @tooni)
- fixed a missing closing tag under certain conditions (thanks to Pat, @fortythousandmiles)
- removed GooglePlus share counts due to Google removing the API
- added Czech translation of the buttons
- updated a lot of button translations
- updated to Facebook Graph API 2.12
- updated a lot of strings to allow for easier translation
- updated the reddit icon
- updated help section
- improved documentation of the REST API endpoint for share counts (thanks to David)
- major improvements in regards to code quality
- minor css improvements
- minor security improvements
- removed the mail form for the time being due to technical and legal due diligence
- if you need the mail form functionality, please stick to version 4.3
- https://downloads.wordpress.org/plugin/shariff.4.3.0.zip
= 4.3.0 =
- new service Odnoklassniki (thanks to rockhit)
- new meta box allows for individual settings per post or page
- new option to hide share counts that are zero
- new option to disable dynamic cache lifespan (not recommended)
- new option to set the button size to small, medium or large
- new option to add a custom class to the container around Shariff
- new option to open links in a popup (thanks to jackennils)
- new option to use NewShareCount instead of OpenShareCount (Twitter)
- added timestamp variable to be accessible via shortcode
- fixed post timestamp for caching under certain conditions
- fixed Facebook share count error for never crawled pages
- fixed empty tab after sharing on certain mobile devices
- fixed custom title attribute (thanks to kschlager)
- updated Flattr user id for the future (thanks to poetaster)
- reduced changelog on wordpress.org (thanks to timse201)
- minor css improvements
- updated help section
= 4.2.1 =
- fixed WhatsApp button on Android when using Chrome
- fixed Shariff being added to RSS feeds under certain conditions
- updated to latest Facebook Graph API for share count requests
= 4.2.0 =
- new option to set the rate limit for sending mails using the mail form
- added home url as fallback for share count requests
- added further anti-spam prevention mechanics
- added noopener and noreferrer to share links
- fixed double encoding of share count request links
- updated media uploader request for translation
- updated handling of admin notices following WordPress core
- tested and optimized for WordPress 4.6
= 4.1.2 =
- new fallback for share count requests in case pretty permalinks are disabled
- new filter shariff3UU_render_atts to change options on the fly (thx Ov3rfly)
- fixed share title in cases with html encoded characters
- fixed double counting on ranking tab under certain conditions
- fixed php info notice in admin notices
= 4.1.1 =
- new option to disable the Shariff buttons outside of the main loop
- fixed Facebook App ID request
- minor css fix
= 4.1.0 =
- new design option to set a custom button color for all buttons
- new design option to set a border radius for the round theme (up to a square)
- new design option to hide all buttons until the page is fully loaded
- new mailform option to use a html anchor (again)
- new statistic option to fill the cache automatically
- new statistic option to set the amount of posts for the ranking tab
- new statistic option to use share counts with PHP < 5.4
- fixed preventing buttons from beeing added to excerpts under certain conditions
- fixed url encoding of share count requests
- improved handling of wrong or mistyped service entries
- minor bug fixes
= 4.0.8 =
- new workaround for sites running PHP 5.2 and older
= 4.0.7 =
- new option for WordPress installations with REST API not reachable in root
= 4.0.6 =
- fixed an error in combination with bbpress
- fixed an error on very old PHP versions
- fixed ranking tab
- minor css improvements
= 4.0.5 =
- fixed mail form link
- fixed xmlns for w3c
= 4.0.4 =
- removed some remaining wrong text domains for translations
- minor css fixes
= 4.0.3 =
- fixed mobile services not showing on certain tablets
- fixed type error on totalnumber when cache is empty
- fixed share count requests when WordPress is installed in a subdirectory
- fixed url encoding of share url, title and media
- added width and height to SVGs to prevent large initial icons prior to css
- new classes shariff-buttons and shariff-link added
- removed local translation files due to switching to wordpress.org language packs
- minor css resets added
= 4.0.2 =
- added minor css resets to prevent influence of theme css
- fixed LinkedIn share link
= 4.0.1 =
- prevent php warning messages on unsuccessful includes while WP_DEBUG is active
- change text domain to match plugin slug
= 4.0.0 =
- complete overhaul of the plugin core
- buttons now also work without JavaScript
- icon font has been removed and replaced with SVGs
- share counts now use the WP REST API
- share counts now always show the last cached counts prior to updating them
- fixed duplicated share count requests
- new ranking tab shows the shares of your last 100 posts
- new service pocket
- new option to show the total amount of shares in the headline with %total
- new option to use the total amount of shares in your theme (see FAQ)
- new action hook shariff_share_counts (see FAQ)
- new option to change the priority of the shortcode filter
- new support for selective refresh introduced in WP 4.5
- new external API feature replaces the external host option (experimental, see FAQ)
- new support for SCRIPT_DEBUG
- css and js files are now only loaded on pages with Shariff buttons
- improved compatibility with plugin Autoptimize (force scripts in head)
- improved compatibility with multiple caching plugins
- all shortcodes are now being stripped from the mail message body
- fixed potential double sending of mails
- removed all jQuery dependencies
- requires at least WordPress 4.4 (only for share counts)
- we no longer support IE 8 (if it ever worked)
- updated status tab
- updated help section
- minor bug fixes
- code cleanup
= 3.4.2 =
- fixed share counts on mobile devices with exactly 360px width
- fixed error on the help tab regarding services (thx to Andreas)
- small css improvements
- added h4-h6 to the allowed tags for the headline
= 3.4.1 =
- changed diaspora share url to official one
- fixed css of rss button when using round theme in widget
- fixed accessibility of share button text
- added rssfeed option to help section
- updated to Heise version 1.23.0
= 3.4.0 =
- new service rss
- minor bug fixes
- update to Heise version 1.22.0
= 3.3.3 =
- fix anonymous function request for PHP < version 5.3
= 3.3.2 =
- improve/extend handling of custom post types
- fix Facebook ID call
= 3.3.1 =
- fix ttl setting on statistic tab
- reduce timeout for post requests to five seconds
= 3.3.0 =
- new option to use an external host for Shariff and the share count backend
- new share count service OpenShareCount.com for Twitter
- new settings tab "Statistic" for all options regarding the share counts
- new settings tab "Status" for all system checks to increase performance
- new design preview button without Twitter
- fix counter VK on design round
- fix Facebook total_count again
- fix double Twitter share windows under certain conditions
- reactivate Flattr counts, since they fixed their API
- purge Shariff transients on update, deactivate and uninstall
- code cleanup
- add vk to help section
- add a known bugs section to the readme
= 3.2.0 =
- new service VK
- new share count service VK
- new dynamic cache lifespan (ttl) based on post / page age (last modified)
- new option to disable individual services (only share counts)
- fix Facebook share counts now use total_counts again
- fix search for custom WP locations
- backend optimization
- temporarily disabled the Flattr counts (statistic) due to ongoing problems of the Flattr API
- fix use of wp_title() is/was deprecated in WP4.4
= 3.1.3 =
- fix ajax call when a custom permalink structure is used
= 3.1.2 =
- fix Facebook ID on 32-bit systems
= 3.1.1 =
- make admin help compatible to the new backend
= 3.1.0 =
- new option to add buttons before/after the excerpt
- new service Threema (thanks to medienverbinder)
- new service Diaspora (thanks to craiq)
- new service AddThis (thanks to bozana)
- new share count service AddThis (thanks to bozana)
- new service PayPal.Me
- new google icon
- fix title tag usage in some cases
- fix rel to data-rel popup
- fix round buttons in certain themes
- fix Flattr API to fetch counts again
- workaround to fix the wrong JSON answer of xing API
- up to date with Heise code version 1.21.0 2015-11-06
= 3.0.0 =
- new WP specific statistics backend for share counts
- new SHARIFF_WP_ROOT_PATH constant for custom wp locations
- automatic search for custom WP locations (thanks to hirasso)
- fix timeout issues and a lot of other backend issues
- deprecated Heise shariff-backend-php
- deprecated ZendFramework
- deprecated shariff3uu_cache directory
- deprecated SHARIFF_BACKEND_TMPDIR constant
= 2.4.3 =
- fix proxy settings
- fix PHP error notice caused by a race condition around concurrent requests in Zend_Cache
- fix PHP notice and error in backend on multisite
= 2.4.2 =
- fix lang attribute again
- fix update notice
= 2.4.1 =
- fix lang attribute
- nicer support hints about GD lib
- cleanup readme.txt
= 2.4.0 =
- ensure compatibility to WordPress 4.3
- new service Tumblr
- new service Patreon
- new service PayPal
- new service Bitcoin
- new supporting bbpress
- new using proxy settings from wp_config (thanks to Shogathu)
- fix automatic button language
- fix button language for Facebook
- fix problems with plugin "Hide Title"
- fix backend (statistic) for multisite environments
- fix backend (statistic) if WP_DEBUG is set to true
- fix language info in help section
- update to Heise version 1.16.0
- remove unnesseray guzzle docs
= 2.3.4 =
- add Italian language to the mailform
= 2.3.3 =
- fix Pinterest button, if pinit.js is present
- small css fixes
= 2.3.2 =
- add French (thanks Charlotte) and Italian (thanks Pier) translations
- improve screen reader compatibility
- fix: prefill mail_comment in case of an error
- fix: do not send more than 1 email as CC. Use a new mail for all recipients.
- fix: fallback to English at the email form only if language is not supported by this plugin
- cleanup mf_wait + extend time to wait of robots blocker to 2 sec
= 2.3.1 =
- fix facebook api (app id & secret)
- fix CSS mailform label
= 2.3.0 =
- redesing of the plugins options page
- mail form improved (a lot)
- split mail into mailform and mailto (check your manual shorttags!)
- new backend status section
- new option to use Facebook Graph API ID in case of rate limit problems
- new option to stretch the buttons horizontally
- new option to add a headline above the Shariff buttons
- many new button languages
- new default cache directory
- fix creation of default cache directory in case it is not month / year based
- fix url-shorttag-option in widget
- fix widget mailform link, if pressed twice
- fix widget mailform on blog page
- fix responsive flow of buttons in IE
- fix Twitter: prevent double encoding with text longer than 120 chars
- update shariff backend to 1.5.0 (Heise)
- update shariff JS to 1.14.0 (Heise)
- many more minor improvements
- code cleanup
= 2.2.4 =
- security fix
= 2.2.3 =
- extend blocking of shariff buttons within password protected posts
= 2.2.2 =
- allow email functionality only if service email is configured within the
admin menu as common service for all posts
= 2.2.1 =
- "fix" fallback to old twitter api again
= 2.2.0 =
- add option to hide Shariff on password protected posts
- tested up to WP 4.2.2
- "fix" fallback to old twitter api if another twitter script is found in order to avoid opening the share window twice
- share text of the mailto link now is "email"
- fix typo and cleanup code
= 2.1.2 =
- fix to make it work with PHP < 5.3 (you should really update your PHP version or change your hoster)
= 2.1.1 =
- change code because of a error with some PHP versions
= 2.1.0 =
- replace sender name if a name is provided with the mail form or set in admin menu
- add option to append the post content to the mail
- add mail header "Precedence: bulk" to avoid answers of autoresponder
- fix: rename a function to avoid problems with other plugins
- improve css
= 2.0.2 =
- fix: mail URLs must be a real link and not url-encoded
- hotfix: mail form disabled if not on single post. Avoid the
self destruction by the DOS-checker ;-)
- cleanup Shariff JS code (mailURL no longer needed)
= 2.0.1 =
- fix email form method POST
= 2.0.0 =
- changes to stay compatible to Heise implementation
- remove obsolet SHARIFF_ALL_POSTS
- fix some small css attributes (size)
- code clean up
= 1.9.9 =
- fix widget bug (wrong share links)
= 1.9.8 =
- add headers to avoid caching of backend data
- tested with WP 4.2 beta
- add option to use on custom pages (e.g. WooCommerce)
- better handling of pinterest media attribute
- bugfix: SHARIFF_BACKEND_TMPDIR in backend
- improve uninstal of cache dir
- add option to use smaller size buttons
- fix again target of the mailto-link
- cleanup code
= 1.9.7 =
- roll back to stable
= 1.9.6 =
- now really go back to 1st block in loop at WMPU
= 1.9.5 =
- nu abba: missing version update
= 1.9.4 =
- fix update bug on WPMS
= 1.9.3 =
- add missing backend files. Last change for this Sunday ;-)
= 1.9.2 =
- fix stupid bug with the update file :-( Sorry!
- fix initialisation of REMOTEHOSTS
= 1.9.1 =
- merge with original Shariff JS/CSS code version 1.9.3
- CSS theme default like Heise default again + "add" theme color
- fix the theme "white"
- backend now up to date
- disable WPDebug in backend config
- improve uninstall (options shariff3UU, shariff3UUversion,
widget_shariff) and compatible with multisite installations
- improve deactivation
= 1.9 =
- add Flattr
- improve version control
- update frensh translations
- use configuration from admin menu for blank shariff shortcodes
- own (much smaller) fonts
= 1.8.1 =
- remove the relativ network-path from service declarations (pinterest,
reddit, stumbleupon, xing) because it really makes no sense to change
the protocol within a popup of a secure target to unsecure connections
depending on the protocol the page is using
- change name of jQuery object to avoid conflicts with other plugins/themes
= 1.8 =
- add options to place Shariff (right/left/center)
- fix: migration check
- css optimized
- use the WP bundled jQuery now (save about 80% bandwidth :-)
= 1.7.1 =
- optimize css (thanks again to @jplambeck)
- code cleanup (No more warnings in debug mode. Perhaps ;-)
- sanitize admin input (thanks again to @jplambeck)
- set the title attribute to overwrite get_the_title() now supported
- fix: check SHARIFF_BACKEND_TMPDIR
- add uninstall script
= 1.7 =
- CHANGES: if no attributes are configured within a shorttag first try to
use the option from admin page. However if there are no services
configured use the old defaults of Heise to make it backward compatible
- add the new service attribut `mailto` to prepare getting the original
behavior of the Heise code that provide a email form with `mail`
- add option to put Shariff on overview page too
- add internal version tracker to enable better migration options in the
future
- optimized css for the info attribute, added priority to the title
attribute over DC.title attribute (thanks again to @jplambeck )
= 1.6.1 =
- fix: again enable WhatsUp on mobile now also works with Mozilla. Sorry
this has not been become part of the main branche. Therefor it was lost
with the last update :-(
- added .shariff span { color: inherit; } (thanks again to @jplambeck )
= 1.6. =
- adopted new responsive css code (thanks to @jplambeck )
- update included fa-fonts
- fix: descrition "printer"
- fix: use WP_CONTENT_URL in admin menu
= 1.5.4 =
- remove alternativ css with links to external hosters. If do you really
want enable breaking privacy plz feel free to code you own css
= 1.5.3 =
- hide counter within the theme round
= 1.5.2 =
- default backend temp dir now uses wp content dir
- updated original shariff JS code
= 1.5.1 =
- fix: constant had have a wrong declaration check
= 1.5.0 =
- add option "url" to set a fixed URI for all sites (only in shorttag and
widgets) because usually it is not a good idea to manipulate this
- fix: do not show error in elseif (/tmp check in admin menu)
= 1.4.4 =
- add option to force frensh and spanish buttons
- clean up theme selection
= 1.4.3 =
- look like wp_enqueue_script has problems with the shariff js code. Now own
script link at the end of the site. Should also improve performance ;-)
= 1.4.2 =
- fix: add the attribute data-title that is needed by the shariff on some
themes to render it above the other div containers.
- only long PHP-Tags because auf problems with WAMPs
- some code clean up. Hopefully it will become more robust on WAMP systems.
= 1.4.1 =
- fixed stupid typo with the SHARIFF_BACKEND_TMP constant
= 1.4.0 =
- add a DIV container to use positioning with CSS
- remove long PHP-tags that cause parse problem on Windows
= 1.3.0 =
- clean up the code
- add backend options (TTL and temp dir)
= 1.2.7 =
- fixed: enable WhatsUp on mobile now also works with Mozilla
- print button does not open a new window
- removed min.js make it more readable for own local changes
= 1.2.6 =
- add print button
- add default image for pinterest to avoid broken design and giuve a hint
= 1.2.5 =
- hotfix for pinterest (see FAQ)
= 1.2.4 =
- bugfix: widget does not work if SHARIFF_ALL_POSTS is set but not enabled
in the admin menu (Please remember, that SHARIFF_ALL_POSTS will be
removed with next major version)
- add option to add shariff at the begin of a post
- merge with new original backend for counters
- add spanish language on buttons; hide whatsup on mobile devices
(merge with yanniks code)
- add reddit
- add stumbleupon
= 1.2.3 =
- add round theme to the admin menu
= 1.2.2 =
- tested with WP 4.1
- added french language for buttons
- added theme "round" (round buttons without text but with fixed width)
= 1.2.1 =
- typos
= 1.2 =
- add widget support
= create a Stable1.0 tag =
- no new funtionality to this tag. Only bugfixes!
= 1.1.1 =
- add french language for the admin menu (thanks Celine ;-)
- fix backend problem on shared hosting with no writeable tmp dir
= 1.1 =
- add whatsapp|pinterest|linkedin|xing
- include latest upstream changes (fix mail etc.)
- add old default selection of services to make it backward compatible
= 1.0.2 =
- add German translation to the admin menu (Admin-Menue in Deutsch)
- code cleanup
= 1.0.1 =
- add PHP version check (5.4 is needed by the backend option)
= 1.0 =
- add admin menu page
- disable the default add on a post if a special formed tag was found
- add support for the theme attribute
= 0.4 =
- Include latest upstream changes
- use get_permalink() to set the parameter data-url
= 0.3 =
- add support for "hideshariff"
- add screenshots
= 0.2 =
- removed the private update server and changed test domain
= 0.1 =
- initial release

View File

@@ -0,0 +1,377 @@
/* Shariff Wrapper */
.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;
}
/* theme default */
.shariff .theme-default a {
color: #fff !important;
}
.shariff .theme-default .shariff-icon svg path {
fill: #fff;
}
/* theme color */
.shariff .theme-color .shariff-count {
background-color: transparent !important;
color: #fff !important;
}
.shariff .theme-color .shariff-icon svg path {
fill: #fff;
}
/* theme grey */
.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;
}
/* theme white */
.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;
}
/* theme wcag */
.shariff .wcag_colors .shariff-count {
color: #fff !important;
background-color: rgba(255, 255, 255, 0.2);
}
/* theme round */
.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;
}
/* buttonsize small */
.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
}
/* buttonsize large */
.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;
}
/* orientation vertical */
.shariff .orientation-vertical {
flex-direction: column;
}
.shariff .orientation-vertical li {
width: 135px;
}
/* button alignment */
.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;
}
/* button alignment widget */
.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;
}
/* button stretch */
.shariff.shariff-buttonstretch li {
flex: 1 0 auto !important;
}
.shariff.shariff-buttonstretch .orientation-vertical li {
width: 100% !important;
}
/* widget */
.widget .shariff li {
border: none;
font-weight: 400;
}
.widget .shariff .theme-default a,
.widget .shariff .theme-color a,
.widget .shariff .theme-grey a,
.widget .shariff .theme-round a {
color: #fff;
display: block;
font-weight: 400;
}
.widget .shariff .theme-default a:hover,
.widget .shariff .theme-color a:hover,
.widget .shariff .theme-grey a:hover,
.widget .shariff .theme-round a:hover {
color: #fff;
font-weight: 400;
}
/* missing usernames warning */
.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;
}
/* info button */
.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 queries */
@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) {
/*noinspection CssUnusedSymbol*/
.shariff .shariff-mobile { display: none !important; }
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -0,0 +1,179 @@
<?php
/**
* Will be included in the shariff.php.
*
* @package Shariff Wrapper
*/
/**
* Class ShariffWidget
*/
class Shariff_Widget extends WP_Widget {
/**
* Registers the widget with the WordPress Widget API.
*/
public static function register() {
register_widget( __CLASS__ );
}
/**
* Shariff_Widget constructor.
*/
public function __construct() {
// Add translations.
if ( function_exists( 'load_plugin_textdomain' ) ) {
load_plugin_textdomain( 'shariff' );
}
$widget_options = array(
'classname' => 'Shariff',
'description' => __( 'Add Shariff as configured on the plugin options page.', 'shariff' ),
'customize_selective_refresh' => true,
);
$control_options = array();
parent::__construct( 'Shariff', 'Shariff', $widget_options, $control_options );
}
/**
* Create the actual form.
*
* @param array $instance Current instance.
*
* @return void
*/
public function form( $instance ) {
// Set widgets defaults.
$instance = wp_parse_args(
(array) $instance,
array(
'shariff-title' => '',
'shariff-tag' => '[shariff]',
)
);
// Sets the title.
echo '<p style="border-bottom: 1px solid #DFDFDF;"><strong>' . esc_html__( 'Title', 'shariff' ) . '</strong></p>';
// Set the title.
echo '<p><input id="' . esc_html( $this->get_field_id( 'shariff-title' ) ) . '" name="' . esc_html( $this->get_field_name( 'shariff-title' ) ) . '" type="text" size="45" value="' . esc_html( $instance['shariff-title'] ) . '" /> ' . esc_html__( '(optional)', 'shariff' ) . '</p>';
// Sets the shorttag.
echo '<p style="border-bottom: 1px solid #DFDFDF;"><strong>Shorttag</strong></p>';
// Sets the shorttag.
echo '<p><input id="' . esc_html( $this->get_field_id( 'shariff-tag' ) ) . '" name="' . esc_html( $this->get_field_name( 'shariff-tag' ) ) . '" type="text" value=\'' . esc_html( str_replace( '\'', '"', $instance['shariff-tag'] ) ) . '\' size="45" /> ' . esc_html__( '(optional)', 'shariff' ) . '</p>';
echo '<p style="clear:both;"></p>';
}
/**
* Saves the widget configuration.
*
* @param array $new_instance The new instance.
* @param array $old_instance The old instance.
*
* @return array The updated instance.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
// Sets the widget conf defaults.
$new_instance = wp_parse_args(
(array) $new_instance,
array(
'shariff-title' => '',
'shariff-tag' => '[shariff]',
)
);
// Checks the input values.
$instance['shariff-title'] = (string) wp_strip_all_tags( $new_instance['shariff-title'] );
$instance['shariff-tag'] = (string) wp_kses( $new_instance['shariff-tag'], $GLOBALS['allowed_tags'] );
// Saves the config.
return $instance;
}
/**
* Draws the widget.
*
* @param array $args Provided arguments.
* @param array $instance The current instance.
*/
public function widget( $args, $instance ) {
// Get options.
$shariff3uu = $GLOBALS['shariff3uu'];
// Creates the container.
$allowed_tags = wp_kses_allowed_html( 'post' );
echo wp_kses( $args['before_widget'], $allowed_tags );
// Prints the title of the widget, if provided.
if ( empty( $instance['shariff-title'] ) ) {
$title = '';
} else {
apply_filters( 'shariff_title', $instance['shariff-title'] );
$title = $instance['shariff-title'];
}
if ( ! empty( $title ) ) {
echo wp_kses( $args['before_title'] . $title . $args['after_title'], $GLOBALS['allowed_tags'] );
}
// Print the shorttag, but keep the original shorttag for further reference.
$original_shorttag = $instance['shariff-tag'];
// If nothing is configured, uses the global options from admin menu.
if ( '[shariff]' === $instance['shariff-tag'] ) {
$shorttag = '[shariff]';
} else {
$shorttag = $instance['shariff-tag'];
}
// Sets the url to the current page to prevent sharing the first or last post on pages with multiple posts.
// For example the blog page. Of course only if no manual url is provided in the shorttag.
$page_url = '';
if ( strpos( $original_shorttag, ' url=' ) === false ) {
$wpurl = get_bloginfo( 'wpurl' );
$wpurl = str_replace( wp_make_link_relative( $wpurl ), '', $wpurl );
if ( isset( $_SERVER['REQUEST_URI'] ) ) {
$page_url = ' url="' . $wpurl . esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '"';
} else {
global $wp;
$page_url = ' url="' . home_url( add_query_arg( array(), $wp->request ) ) . '"';
}
}
// Same for title.
$page_title = '';
$wp_title = '';
if ( strpos( $original_shorttag, 'title=' ) === false ) {
$wp_title = wp_get_document_title();
// wp_title for all pages that have it.
if ( ! empty( $wp_title ) ) {
$page_title = $wp_title;
} else {
$page_title = get_bloginfo( 'name' );
}
// Replace brackets [ and ] with ( and ).
$page_title = str_replace( '[', '(', $page_title );
$page_title = str_replace( ']', ')', $page_title );
$page_title = ' title="' . wp_strip_all_tags( html_entity_decode( $page_title, ENT_COMPAT, 'UTF-8' ) ) . '"';
}
// Same for media.
$media = '';
if ( array_key_exists( 'services', $shariff3uu ) && strstr( $shariff3uu['services'], 'pinterest' ) && ( strpos( $original_shorttag, 'media=' ) === false ) ) {
if ( isset( $shariff3uu['default_pinterest'] ) ) {
$media = ' media="' . $shariff3uu['default_pinterest'] . '"';
}
}
// Builds the shorttag and adds the url, title and media if necessary as well as the widget attribute.
$shorttag = substr( $shorttag, 0, -1 ) . $page_title . $page_url . $media . ' widget="1"]';
// Processes the shortcode if it is not password protected or "disable on password protected posts" is not set.
if ( 1 !== post_password_required( get_the_ID() ) || ( isset( $shariff3uu['disable_on_protected'] ) && 1 !== $shariff3uu['disable_on_protected'] ) ) {
echo do_shortcode( $shorttag );
}
// Closes the Container.
echo wp_kses( $args['after_widget'], $allowed_tags );
} // End of widget.
} // End of class ShariffWidget.
add_action( 'widgets_init', array( 'Shariff_Widget', 'register' ) );

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
// shariff media upload
jQuery(document).ready(function($){
$("#shariff-upload-btn").click(function(e) {
e.preventDefault();
var image = wp.media({
title: shariff_media.choose_image,
multiple: false
}).open()
.on("select", function(){
// this will return the selected image from the media uploader, the result is an object
var uploaded_image = image.state().get("selection").first();
// output to the console uploaded_image
console.log(uploaded_image);
// convert uploaded_image to a JSON object to make accessing it easier
var image_url = uploaded_image.toJSON().url;
// assign the url value to the input field
$("#shariff-image-url").val(image_url);
});
});
});

View File

@@ -0,0 +1 @@
jQuery(document).ready(function(a){a("#shariff-upload-btn").click(function(c){c.preventDefault();var b=wp.media({title:shariff_media.choose_image,multiple:false}).open().on("select",function(){var d=b.state().get("selection").first();console.log(d);var e=d.toJSON().url;a("#shariff-image-url").val(e)})})});

View File

@@ -0,0 +1,29 @@
// add click listener function
function shariff_click() {
// enabled strict mode
"use strict";
// get elements
var classname = document.getElementsByClassName( 'shariff-link' );
// set all event listeners
for ( var i = 0; i < classname.length; i++ ) {
classname[i].addEventListener( 'click', shariff_popup, false );
}
}
// actual popup function
function shariff_popup( evt ) {
// set variables
var t = this.getAttribute( 'href' );
var o = screen.width/2-350;
var r = screen.height/2-250;
// open popup if not one of the special services
if ( t.substring( 0, 7 ) !== 'mailto:' && t.substring( 0, 9 ) !== "whatsapp:" && t !== 'javascript:window.print()' && t !== 'http://ct.de/-2467514' ) {
// prevent default action
evt.preventDefault();
// open popup
window.open( t,"_blank","height=500, width=700, status=yes, toolbar=no, menubar=no, location=no, top="+r+", left="+o );
// return false to prevent tab opening in some browsers
return false;
}
}
// add event listener to call shariff popup function after DOM
document.addEventListener( 'DOMContentLoaded', shariff_click, false );

View File

@@ -0,0 +1 @@
function shariff_click(){var b=document.getElementsByClassName("shariff-link");for(var a=0;a<b.length;a++){b[a].addEventListener("click",shariff_popup,false)}}function shariff_popup(a){var b=this.getAttribute("href");var d=screen.width/2-350;var c=screen.height/2-250;if(b.substring(0,7)!=="mailto:"&&b.substring(0,9)!=="whatsapp:"&&b!=="javascript:window.print()"&&b!=="http://ct.de/-2467514"){a.preventDefault();window.open(b,"_blank","height=500, width=700, status=yes, toolbar=no, menubar=no, location=no, top="+c+", left="+d);return false}}document.addEventListener("DOMContentLoaded",shariff_click,false);

View File

@@ -0,0 +1,100 @@
// main shariff function
function shariff_share_counts() {
// enabled strict mode
"use strict";
// get all shariff containers
var containers = document.getElementsByClassName("shariff");
// init request object
var requests = {};
// loop through all containers, create each request url and add all to request array
for ( var c = 0; containers[c]; c++ ) {
var share_url = containers[c].dataset.url;
var services = containers[c].dataset.services;
var timestamp = containers[c].dataset.timestamp;
// check if an external share count api is set
var api = containers[c].dataset.backendurl;
if ( typeof api === "undefined" ) {
api = '/wp-json/shariff/v1/share_counts?';
}
// build request url
var request_url = api + 'url=' + share_url + '&services=' + services + '&timestamp=' + timestamp;
// check if we have backend services at all
if ( typeof services !== "undefined" ) {
// check if the url is already in requests to avoid duplicated requests
if ( requests[ share_url ] ) {
// add additional services to services
services = requests[ share_url ][ 1 ] + '|' + services;
// remove duplicates
var service_array = services.split("|");
service_array = service_array.filter( function( elem, pos, arr ) {
return arr.indexOf( elem ) === pos;
});
services = service_array.join('|');
// update request url
request_url = api + 'url=' + share_url + '&services=' + services + '&timestamp=' + timestamp;
// add to requests
requests[ share_url ] = [ share_url, services, timestamp, request_url ];
}
else {
requests[ share_url ] = [ share_url, services, timestamp, request_url ];
}
}
}
// get share counts
for ( var request in requests ) {
if ( requests.hasOwnProperty( request ) ) {
shariff_get_share_counts( requests[ request ][ 0 ], requests[ request ][ 3 ], containers );
}
}
}
// get share counts
function shariff_get_share_counts( share_url, request_url, containers ) {
// new XMLHttpRequest
var request = new XMLHttpRequest();
// load asynchronously
request.open( 'GET', request_url, true );
// actions after answer
request.onload = function() {
// check if successful
if ( request.status >= 200 && request.status < 400 ) {
// add to buttons
shariff_add_share_counts( share_url, JSON.parse( request.responseText ), containers );
}
};
// start request
request.send();
}
// add share counts
function shariff_add_share_counts( share_url, data, containers ) {
// add share counts to buttons
for ( var d = 0; containers[d]; d++ ) {
// check if it is the corresponding button set
if ( containers[d].dataset.url === share_url ) {
// update total in total number spans
var shariff_totalnumber = containers[d].getElementsByClassName("shariff-totalnumber");
for ( var n = 0; shariff_totalnumber[n]; n++ ) {
if ( data !== null && typeof data.total !== 'undefined' ) {
shariff_totalnumber[n].innerHTML = data.total;
}
}
// update total in shariff headline
var shariff_total = containers[d].getElementsByClassName("shariff-total");
for ( var t = 0; shariff_total[t]; t++ ) {
if ( data !== null && typeof data.total !== 'undefined' ) {
shariff_total[t].innerHTML = data.total;
}
}
// loop through all button in this container
var shariff_count = containers[d].getElementsByClassName("shariff-count");
for ( var s = 0; shariff_count[s]; s++ ) {
// add share count, if we have one, and make it visible
if ( data !== null && typeof data[shariff_count[s].dataset.service] !== 'undefined' && ( typeof containers[d].dataset.hidezero === 'undefined' || ( containers[d].dataset.hidezero === '1' && data[shariff_count[s].dataset.service] > 0 ) ) ) {
shariff_count[s].innerHTML = data[shariff_count[s].dataset.service];
shariff_count[s].style.opacity = 1;
}
}
}
}
}
// add event listener to call main shariff function after DOM
document.addEventListener( 'DOMContentLoaded', shariff_share_counts, false );

View File

@@ -0,0 +1 @@
function shariff_share_counts(){var d=document.getElementsByClassName("shariff");var a={};for(var i=0;d[i];i++){var e=d[i].dataset.url;var j=d[i].dataset.services;var h=d[i].dataset.timestamp;var g=d[i].dataset.backendurl;if(typeof g==="undefined"){g="/wp-json/shariff/v1/share_counts?"}var k=g+"url="+e+"&services="+j+"&timestamp="+h;if(typeof j!=="undefined"){if(a[e]){j=a[e][1]+"|"+j;var b=j.split("|");b=b.filter(function(l,m,c){return c.indexOf(l)===m});j=b.join("|");k=g+"url="+e+"&services="+j+"&timestamp="+h;a[e]=[e,j,h,k]}else{a[e]=[e,j,h,k]}}}for(var f in a){if(a.hasOwnProperty(f)){shariff_get_share_counts(a[f][0],a[f][3],d)}}}function shariff_get_share_counts(c,a,d){var b=new XMLHttpRequest();b.open("GET",a,true);b.onload=function(){if(b.status>=200&&b.status<400){shariff_add_share_counts(c,JSON.parse(b.responseText),d)}};b.send()}function shariff_add_share_counts(c,e,b){for(var g=0;b[g];g++){if(b[g].dataset.url===c){var j=b[g].getElementsByClassName("shariff-totalnumber");for(var a=0;j[a];a++){if(e!==null&&typeof e.total!=="undefined"){j[a].innerHTML=e.total}}var h=b[g].getElementsByClassName("shariff-total");for(var i=0;h[i];i++){if(e!==null&&typeof e.total!=="undefined"){h[i].innerHTML=e.total}}var f=b[g].getElementsByClassName("shariff-count");for(var k=0;f[k];k++){if(e!==null&&typeof e[f[k].dataset.service]!=="undefined"&&(typeof b[g].dataset.hidezero==="undefined"||(b[g].dataset.hidezero==="1"&&e[f[k].dataset.service]>0))){f[k].innerHTML=e[f[k].dataset.service];f[k].style.opacity=1}}}}}document.addEventListener("DOMContentLoaded",shariff_share_counts,false);

View File

@@ -0,0 +1,47 @@
Shariff
The MIT License (MIT)
Copyright (c) 2015 Heise Medien GmbH & Co. KG and other contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Shariff Wrapper (WordPress Plugin)
The MIT License (MIT)
Copyright (c) 2015 3UU productions ("Ritze") and Jan-Peter Lambeck.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,220 @@
=== Shariff Wrapper ===
Contributors: starguide, 3UU
Tags: Shariff, GDPR, DSGVO, share buttons, sharing
Requires at least: 4.9
Requires PHP: 7.0
Tested up to: 5.2
Stable tag: 4.6.3
License: MIT
License URI: http://opensource.org/licenses/mit
Shariff provides share buttons that respect the privacy of your visitors and follow the General Data Protection Regulation (GDPR).
== Description ==
The "original" share buttons automatically transmit data of your visitors to the social network sites as soon as they visit your website. They do not need to click on a share button for this and therefore have no choice, if they want their data to be send. The German computer magazine c't has developed "Shariff" `(ʃɛɹɪf)` that follows the General Data Protection Regulation (GDPR - Regulation (EU) 2016/679). This plugin adapts the Shariff concept and provides an easy to use solution for WordPress. We currently support 32 services in 25 languages: AddThis, Bitcoin, Buffer, Diaspora, Facebook, Flattr, Flipboard, LinkedIn, mailto, MeWe, Odnoklassniki, Patreon, PayPal, PayPal.me, Pinterest, Pocket, Printer, Qzone, Reddit, RSS, SMS, Stumbleupon, Telegram, TencentWeibo, Threema, Tumblr, Twitter, VK, Wallabag, Weibo, WhatsApp, Xing.
For more information about the Shariff project check out the original [GitHub project](https://github.com/heiseonline/shariff) and read about the project itself [ct information page](http://ct.de/shariff) (in German).
You can automatically add share buttons to posts, pages, the main blog page, product sites and many more as well as use it as a widget or add the shortcode `[shariff]` manually to your pages or themes.
== Installation ==
1. Upload everything to the `/wp-content/plugins/` directory
2. Activate the plugin using the plugins menu in WordPress
3. Use <code>[shariff]</code> anywhere on your site and/or use the Shariff settings menu.
To enable it for all posts please check the options in the plugin settings.
== Screenshots ==
1. Differently styled share buttons.
2. Basic options.
3. Design options.
4. Advanced options.
5. Statistic options.
== Frequently Asked Questions ==
= Q: Can I use the Shariff buttons in my theme? =
A: Yes. Simply use the shortcode function `do_shortcode('[shariff]')`.
You can use all options of the shorttag as described on the help tab in the plugin settings.
= Q: Can I use the total amount of shares in my theme? =
A: Yes. You can use `do_shortcode('[shariff services="totalnumber"]')` to simply output the total amount of shares for a post in the loop. It will return the number itself wrapped in a `<span class="shariff-totalnumber"></span>` in order for the shariff.js to update the count. Also only cached data is used, in order to not slow down your site.
= Q: Is there an action hook to use the share counts every time they get updated? =
A: Yes. You can use
`function your_awesome_function( $share_counts ) {
// $share_counts is an array including all enabled services, the timestamp of the update and the url of the post.
// do stuff
}
add_action( 'shariff_share_counts', 'your_awesome_function' );`
WARNING: This hook will get called A LOT. So be sure you know what you are doing.
= Q: How can I configure the widget? =
A: It uses the same options that have been configured on the plugin options page. However, you can put in a shorttag that overwrites the default options. It has the same format as you use in posts. Take a look at the help section of the plugin options page for more information.
= Q: Can I change the options on a single post? =
A: Yes. You can change all options using the shorttag in the Shariff meta box on the right side of the post edit screen.
= Q: Why are shares not listed? =
A: Shariff tries to protect the privacy of your visitors. In order to do this, the statistics have to be requested by your server, so social networks only see a request of your server and not from your visitor. However, we do not know, if you want this. Therefore it is not enabled by default.
= Q: How can I show the share counts? =
A: Enable it on the plugin options page in general or add `backend="on"` to the shariff shorttag in your post.
= Q: I still do not see share counts =
A: Please have a look at the status tab on the plugin options page. It states whether share counts are enabled and if there is a problem with a service. Please also keep in mind that the plugin has a minimum refresh time of 60 seconds and that each service has their own cache as well.
= Q: Why can't I change the TTL to a smaller / bigger value? =
A: The time to live (TTL) value determines, if a share count of a post or page gets refreshed when someone visits this specific page / post of your blog. Too small values create too much useless traffic, too high values negate the goal of motivating visitors to also share a post. The value can be adjusted between 60 and 7200 seconds. Keep in mind, the actual lifespan depends on the age of the post as well.
= Q: I get the Facebook API error message "request limit reached"! =
A: Facebook has a rate limit of 600 requests per 600 seconds per IP address. Especially in shared hosting environments many domains share the same IP address and therefore the same limit. To avoid this you can try to raise the TTL value or provide a Facebook App ID and Secret. Google "facebook app id secret" will provide many guides on how to get these.
= Q: How can I change the position of all buttons? =
A: Have a look at the alignment options in the admin menu or checkout the
style option.
= Q: How can I change the design? =
A: Have a look at the parameters "theme", "orientation" and "buttonsize". They work mostly like the original code parameters that are explained at http://heiseonline.github.io/shariff/ Or you can have a look at the test page at http://shariff.3uu.net/shariff-sample-page-with-all-options to get an
overview. But please be warned: This is a test page! It is possible that you find features that are only provided in the development version. Use it only to get an impression of the design options.
= Q: How can I change the design of a single button? =
A: If you are a CSS guru please feel free to modify the css file. But of course this is a bad idea, because all changes will be destroyed with the next update! Instead take a look at the style and class attribute of the shorttag. If you put in any value it will create a DIV container with the ID "ShariffSC" around the buttons. If you are really a CSS guru you will know what does the magic from here on out. ;-)
= Q: I want the buttons to stay fixed while scrolling! =
A: No problem. Just use the style attribute to add some CSS to the shorttag. For example in a widget (adjust the width as needed):
`[shariff style="position:fixed;width:250px"]`
Of course you can use all other options in that shorttag as well. It also works with the CSS style option on the plugins design options page, if you really want this applied to all buttons on your page.
= Q: I want a horizontal line above my Shariff buttons! =
A: You can use the headline option on the design tab. For example, enter the following code to create a horizontal line and a headline:
`<hr style='margin:20px 0'><p>Please share this post:</p>`
= Q: I want a different or no headline in a single widget, post or page! =
A: Use the headline attribute to add or remove it. For example, you can use the following shorttag to remove a headline set on the plugins options page in a single widget:
`[shariff headline=""]`
Of course you can use all other options in that shorttag as well.
= Q: Can I add [shariff] on all posts? =
A: Yes, check out the plugin options.
= Q: But I want to hide it on a single post! =
A: Do you really know what you want? ;-) However, it is possible. Write anywhere in your post "hideshariff". It will be removed and Shariff will not be added. You can also use "/hideshariff" to write "hideshariff" in your post. You might also want to take a look at the Shariff meta box on the right side of your post edit screen.
= Q: What are the differences between the two Shariff plugins? =
A: One is developed by us, one by someone else. ;-) The main difference is that this plugin has a few more options and a great support. :-) Neither of the plugins are "official" or directly developed by Heise.
= Q: Does it work with a CDN? =
A: Yes.
= Q: Pinterest does not show an image! =
A: You can add media="http://wwww.example.com/yourImage.png"
within the [shariff] shorttag or add it in on the plugin options page - of course with the link to your image.
= Q: Can I set a fixed URL to share? =
A: You can use the "url" parameter within the shortcode
`[shariff url="http://www.example.com/"]`
This is also available within widgets. However, it is not a good idea to manipulate the URI, because it could mislead your visitors. So you should only use it, if this is really needed and you do really know what you are doing. Therefore it is not available on the plugin options page in general.
= Q: What happened to the Twitter share counts and what is OpenShareCount? =
A: Please read: https://www.jplambeck.de/twitter-saveoursharecounts/
= Q: The buttons are not correctly being shown on my custom theme! =
A: Please make sure that wp_footer(); has been added to your theme. For more information please visit: https://codex.wordpress.org/Function_Reference/wp_footer
= Q: What is the external API feature? =
A: First of all: Usually you do not need it! The plugin requests all share counts itself. However, there are some reasons to put the backend on another server:
- avoid requests from you WP server to all the social networks
- use a more powerful server for the statistic
- use the original backend implementation of Heise or your own solution
- make your own backend available for more than one WP installation
But please have in mind that there are also some good reasons not to use external servers:
- you need an additional installation of WP and the plugin or have to create your own implementation of a Shariff backend
- some plugin settings (backend checks, statistic, etc.) will only work on the external server
- you have to use SHARIFF_FRONTENDS as an array with all your frontend domains to enable the backend or find your own solution
- we CANNOT provide support for your own implementation
= Q: How can I configure the external API? =
A: In the statistic settings fill in the URL to the API of the external server. For the WordPress installation on the external server you have to create a "constant" called SHARIFF_FRONTENDS to permit other domains to use it. Please have in mind that you have to fill in all subdomains you want to use! The domains must be defined like this:
`define( 'SHARIFF_FRONTENDS', 'example.com|www.example.com|blog.example.com|another-domain.com' );`
= Q: What does "Request external API directly." mean? =
A: By default, the browser request the share counts from the server your site is running on. If you have entered an external API your server will then request the counts from this external API instead of fetching them itself. Therefore, the external server will only see the IP from your server and not the one from your visitors. If you check this option, the browser of your visitors will instead directly request the share counts from the external API and therefore reveal their IP address to them. This might be faster, but it is less secure. Please also make sure to set the Access-Control-Allow-Origin header right. If your site is available using https, your external API will need to be reached by https as well. Otherwise the request will get blocked for security reasons. All options and features (e.g. the ranking tab) regarding the statistic will only work on the external server.
= KNOWN BUGS =
These are bugs or unexpected glitches that we know of, but that do not have an impact on the majority of users, are not security relevant and will perhaps be fixed in the future - if we have time to spend or you provide us with a lot of "K&#xF6;lsch" ;-)
- If the first post on the start page is password protected and Shariff is disabled on protected posts, a widget at the end of the loop will not be rendered.
== Changelog ==
= 4.6.3 =
- updated the WhatsApp share link (thanks to @hanshansenxxx and @korbball)
- updated to Facebook Graph API v3.3
- updated the Flattr button to reflect the new Flattr (thanks to Chris, @camthor)
- fixed an update issue with WP CLI
- removed the Facebook share counts request without APP ID and Secret
- Facebook now always requires an APP ID and Secret for share counts
- removed Flattr counts due to Flattr removing the API
= 4.6.2 =
- new service MeWe
- new service Buffer
- fixed an issue in case the plugin dir has been moved via symlink
= 4.6.1 =
- replaced Stumbleupon with its successor Mix (thanks to Mark)
- added an option to hide WhatsApp on desktop devices
- updated Odnoklassniki API
- fixed an issue with WPML and some older Shariff setups
= 4.6.0 =
- 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
= 4.5.3 =
- removed LinkedIn Share Counts due to LinkedIn removing them completely
- removed GooglePlus Share Counts due to Google shutting GooglePlus down
- removed OpenShareCount due to the service having shut down
- removed NewShareCount due to the service having shut down
- removed Mastodon temporarily until a new working solution is available
- deprecated GooglePlus as a service, will be removed with the next release
- added TwitCount (twitcount.com) as an alternative for Twitter share counts
- updated to Facebook Graph API v3.2
- updated to WordPress Coding Standards 2.0
- corrected minor typos
- added the new logo thanks to Philipp Wildfeuer (@phil_sauvage)
= 4.5.2 =
- added support for share count requests of multilingual sites
- updated button translations for Twitter and Pinterest (thanks to Jessica, @jess78)
- updated to Facebook Graph API v3.0
= 4.5.1 =
- added support for the new WordPress Privacy Policy Guide added in 4.9.6
- minor css adjustments
- minor bug fixes
= 4.5.0 =
- new option to add Shariff to custom WordPress hooks
- new option to support multilingual sites using WPML and other plugins
- new support for WooCommerce products on the ranking table
- new option to show different headlines based on share counts
- updated button languages, now supporting 25 languages
- fixed a bug causing share counts to not being displayed properly
The complete changelog can be found here: https://plugins.svn.wordpress.org/shariff/trunk/changelog.txt

View File

@@ -0,0 +1,71 @@
<?php
/**
* Will be included in the shariff.php only, when AddThis is selected as a service.
*
* @package Shariff Wrapper
*/
// Prevents direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'http://api.addthis.com/oexchange/0.8/offer' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url;
// Colors.
$main_color = '#f8694d';
$secondary_color = '#f75b44';
$wcag_color = '#AC2207';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в AddThis',
'cs' => 'Sdílet na AddThis',
'da' => 'Del på AddThis',
'de' => 'Bei AddThis teilen',
'en' => 'Share on AddThis',
'es' => 'Compartir en AddThis',
'fi' => 'Jaa AddThisissä',
'fr' => 'Partager sur AddThis',
'hr' => 'Podijelite na AddThis',
'hu' => 'Megosztás AddThisen',
'it' => 'Condividi su AddThis',
'ja' => 'AddThis上で共有',
'ko' => 'AddThis에서 공유하기',
'nl' => 'Delen op AddThis',
'no' => 'Del på AddThis',
'pl' => 'Udostępnij przez AddThis',
'pt' => 'Compartilhar no AddThis',
'ro' => 'Partajează pe AddThis',
'ru' => 'Поделиться на AddThis',
'sk' => 'Zdieľať na AddThis',
'sl' => 'Deli na AddThis',
'sr' => 'Podeli na AddThis',
'sv' => 'Dela på AddThis',
'tr' => 'AddThis\'ta paylaş',
'zh' => '在AddThis上分享',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Fetch share counts.
$addthis = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'http://api-public.addthis.com/url/shares.json?url=' . $post_url ) ) );
$addthis_json = json_decode( $addthis, true );
// Store results, if we have some, else record errors, if enabled (e.g. request from the status tab).
if ( isset( $addthis_json['shares'] ) ) {
$share_counts['addthis'] = intval( $addthis_json['shares'] );
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['addthis'] = $addthis;
}
} // End if Frontend or Backend.

View File

@@ -0,0 +1,51 @@
<?php
/**
* Will be included in the shariff.php only, when Bitcoin is selected as a service.
*
* @package Shariff Wrapper
*/
// Prevents direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( plugins_url( '../', __FILE__ ) . 'bitcoin.php' );
// Bitcoin address.
if ( array_key_exists( 'bitcoinaddress', $atts ) ) {
$bitcoinaddress = esc_html( $atts['bitcoinaddress'] );
} else {
$bitcoinaddress = '';
}
// Build button URL.
$button_url = $service_url . '?bitcoinaddress=' . $bitcoinaddress;
// Colors.
$main_color = '#f7931a';
$secondary_color = '#191919';
$wcag_color = '#824808';
// SVG icon.
$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>';
// Button text label.
$button_text_array = array(
'de' => 'spenden',
'en' => 'donate',
'fr' => 'faire un don',
'es' => 'donar',
);
// Button alt label.
$button_title_array = array(
'de' => 'Spenden mit Bitcoin',
'en' => 'Donate with Bitcoin',
'fr' => 'Faire un don via Bitcoin',
'es' => 'Donar via Bitcoin',
);
}

View File

@@ -0,0 +1,75 @@
<?php
/**
* Will be included in the shariff.php only, when Buffer is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://buffer.com/add' );
// Build the button URL.
$button_url = $service_url . '?url=' . $share_url . '&text=' . $share_title;
// Set the Colors (Hexadecimal including the #).
$main_color = '#168eea';
$secondary_color = '#329ced';
$wcag_color = '#0C5B97';
// SVG icon.
$svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="' . $main_color . '" d="M91-37.4V-52l1.8 1 24 11.2c1.7.8 3.3.7 4.9 0l24-11.2 1-.4c.9-.6 1-1.3 0-1.8l-3.5-1.7a6.2 6.2 0 0 0-6.2 0l-15.1 7.1c-1.7.8-3.4.9-5.1 0-4.7-2.3-9.5-4.3-14.2-6.7-2.7-1.4-5.3-1.7-8-.1-1.1.7-2.3 1.2-3.5 1.7v-14.3l25 11.6c2.2 1.1 4.2 1 6.3 0l23.5-11c.6-.3 1.5-.4 1.4-1.3 0-.8-.8-1-1.3-1.2l-24.5-11.5a5.2 5.2 0 0 0-4.4-.1L91-68.5v-16.2c0-1.1.2-1.3 1.3-1.3h88.9l-.1 2.3v59.6c-.1 1.1.5 1.5 1.6 1.5h9.4c1 0 1.5-.4 1.5-1.5v-4l1.3 1.2c7.9 7.7 21 6.9 27.8-1.8s7-24.2.5-33.3c-6.7-9.3-20.8-10.6-28.4-2.4-.3.3-.4.8-1.2.6V-86H422c1.2 0 1.5.3 1.5 1.5-.1 5.4 0 10.7 0 16.1-5.8-.3-10 2.7-14.2 6.6v-3.8c0-1.4-.4-2-1.8-1.9h-6.2c-4 0-4 0-4 4.1v39.1c0 1.3.4 1.8 1.6 1.8h8c2.3 0 2.3 0 2.3-2.3 0-7.8.3-15.6-.1-23.3-.2-4.1 1.6-6.1 4.9-7.5l2.6-.9c2.2-.7 4.5-.2 6.8-.4v34.6c0 1-.2 1.2-1.2 1.2h-330c-1 0-1.2-.2-1.2-1.2v-13.8l1.4.9 24.2 11.3c1.7.8 3.4.8 5-.1l13-6 11.4-5.4c.5-.2 1-.4 1-1.1 0-.7-.5-1-1-1.2l-3.4-1.6c-2-1-3.7-.9-5.6 0l-15.3 7.2c-2 .9-3.6.9-5.6 0L101-39.2c-2-.9-3.7-1.1-5.6-.1-1.2.4-2.7 1.2-4.3 1.9zm281.5-3.8h14.8c1.3 0 1.8-.5 1.8-1.8-.1-2-.1-4-.4-6A22.1 22.1 0 0 0 362-68.3a23 23 0 0 0-18.6 21.5c-.4 9.6 2.9 17.4 11.7 22.2a27.6 27.6 0 0 0 20.3 1.9c3.3-.8 6.5-2.1 9.2-4.3.6-.5 1.2-1 .5-1.9l-4.1-6c-.4-.7-1-.7-1.5-.2a17.4 17.4 0 0 1-9.7 3.7c-6.4.6-11-1.9-13.4-7.7-.7-1.8-.4-2.1 1.5-2.1zm-108 13.1c0 1.5.2 2.6 0 3.7 0 1.3.5 1.8 1.8 1.7h8.6c1.3 0 1.8-.5 1.8-1.8v-41.4c0-1.2-.5-1.7-1.7-1.7h-8c-2.3 0-2.3 0-2.3 2.4v26.1c0 .9 0 1.7-.6 2.4-2.4 2.3-5 4-8.5 4.1-6.4.2-8.8-2.1-8.8-8.5v-24.3c0-2.2 0-2.2-2.3-2.2h-7.8c-1.6-.1-2.1.6-2 2.1v10.2c0 7.2-.2 14.5.2 21.7.3 5.3 3.5 9.7 8.3 11.1s9.5 1.2 14.2-.6c2.5-1.1 4.8-2.8 7.2-5zm68-11.7v-15.1c0-2.2 0-2.2 2.4-2.2h5.4c1 0 1.5-.4 1.5-1.4v-7.6c0-1.2-.6-1.5-1.6-1.5h-6c-.6 0-1.2.1-1.4-.7a5.9 5.9 0 0 1 6.9-7.4c.7.2 1.5.4 2 .8 1.2.8 1.8.4 2.4-.6.9-1.4 1.7-2.9 2.7-4.2.9-1.2.5-1.9-.5-2.7a17.4 17.4 0 0 0-8.3-3 14.6 14.6 0 0 0-17 11.7c-.3 1.5-.4 3-.4 4.5 0 1.1-.4 1.6-1.5 1.5h-4.2c-1 0-1.5.3-1.5 1.4v7.8c0 1 .4 1.4 1.4 1.3h3.4c2.4 0 2.4 0 2.4 2.4v30c0 1.5.5 2 2 2h8.3c1.5 0 1.9-.5 1.9-2-.2-4.9-.2-10-.2-15zm-42-.3v15.4c0 1.5.6 2 2 2h7.4c2.9 0 2.9 0 2.9-2.8V-55c0-1.6.5-2.1 2-2h5.3c1 0 1.5-.4 1.5-1.5V-66c0-1.1-.4-1.6-1.5-1.5h-5.8c-.6 0-1.2.1-1.4-.7a5.7 5.7 0 0 1 5.4-7.6c1.3 0 2.5.4 3.5 1.1s1.5.4 2-.5l2.7-4.1c1-1.8 1-2-.7-3.2a17.7 17.7 0 0 0-8.1-2.7 15 15 0 0 0-15.2 7.2c-1.6 2.8-2 5.8-2 8.9.2 1.3-.3 1.8-1.6 1.7h-4.4c-1 0-1.4.4-1.4 1.3v7.8c0 1.1.5 1.4 1.5 1.4h4.2c1.4-.1 1.7.5 1.7 1.8v15zM.3 14.1L29.3.5a6 6 0 0 1 4.9.1C43.3 5 52.5 9.1 61.5 13.5c.7.3 1.4.5 1.4 1.3 0 1-.9 1.1-1.5 1.4-8.7 4.2-17.5 8.2-26.2 12.3a7.8 7.8 0 0 1-7 0L.3 15.5v-1.4zm0 34.7l5.1-2.6a7 7 0 0 1 6.3.1l16.8 8c2.1 1 4.1 1 6.2 0l17.1-8c2.1-1 4.1-1 6.2 0l3.8 1.7c.6.3 1.4.6 1.3 1.3 0 .7-.7 1-1.3 1.3l-12.7 6-14.4 6.7c-1.8.9-3.7 1-5.6 0L2 50.9c-.6-.2-1-.7-1.6-1-.2-.2-.2-.6-.2-1z"/><path fill="' . $main_color . '" d="M.3 31.5l4-1.9c3-1.8 5.7-1.4 8.8.1 5.3 2.7 10.6 5 15.9 7.5 2 .9 3.7.9 5.6 0 5.6-2.7 11.3-5.2 16.9-8a7.2 7.2 0 0 1 6.9 0c1.2.8 2.6 1.3 3.9 2 1 .6 1 1.3 0 2l-1 .4-26.9 12.5c-1.8.9-3.6.9-5.3 0L2.2 33.6c-.7-.3-1.2-.8-1.9-1v-1z"/></svg>';
// Backend available?
$backend_available = 1;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в buffer',
'cs' => 'Sdílet na buffer',
'da' => 'Del på buffer',
'de' => 'Bei buffer teilen',
'en' => 'Share on buffer',
'es' => 'Compartir en buffer',
'fi' => 'Jaa bufferissä',
'fr' => 'Partager sur buffer',
'hr' => 'Podijelite na buffer',
'hu' => 'Megosztás bufferen',
'it' => 'Condividi su buffer',
'ja' => 'buffer上で共有',
'ko' => 'buffer에서 공유하기',
'nl' => 'Delen op buffer',
'no' => 'Del på buffer',
'pl' => 'Udostępnij przez buffer',
'pt' => 'Compartilhar no buffer',
'ro' => 'Partajează pe buffer',
'ru' => 'Поделиться на buffer',
'sk' => 'Zdieľať na buffer',
'sl' => 'Deli na buffer',
'sr' => 'Podeli na buffer',
'sv' => 'Dela på buffer',
'tr' => 'buffer\'ta paylaş',
'zh' => '在buffer上分享',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Get share counts.
$buffer = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://api.bufferapp.com/1/links/shares.json?url=' . $post_url ) ) );
// Decode the json response.
$buffer_json = json_decode( $buffer, true );
/**
* Stores results.
* Records errors, if enabled (e.g. request from the status tab).
*/
if ( isset( $buffer_json['shares'] ) ) {
$share_counts['buffer'] = intval( $buffer_json['shares'] );
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['buffer'] = $buffer;
}
}; // End if backend.

View File

@@ -0,0 +1,57 @@
<?php
/**
* Will be included in the shariff.php only, when diaspora is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://share.diasporafoundation.org/' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
// Colors.
$main_color = '#999';
$secondary_color = '#b3b3b3';
$wcag_color = '#595959';
// SVG icon.
$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>';
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в diaspora*',
'cs' => 'Sdílet na diaspora*',
'da' => 'Del på diaspora*',
'de' => 'Bei diaspora* teilen',
'en' => 'Share on diaspora*',
'es' => 'Compartir en diaspora*',
'fi' => 'Jaa diaspora*issä',
'fr' => 'Partager sur diaspora*',
'hr' => 'Podijelite na diaspora*',
'hu' => 'Megosztás diaspora*',
'it' => 'Condividi su diaspora*',
'ja' => 'diaspora*上で共有',
'ko' => 'diaspora*에서 공유하기',
'nl' => 'Delen op diaspora*',
'no' => 'Del på diaspora*',
'pl' => 'Udostępnij przez diaspora*',
'pt' => 'Compartilhar no diaspora*',
'ro' => 'Partajează pe diaspora*',
'ru' => 'Поделиться на diaspora*',
'sk' => 'Zdieľať na diaspora*',
'sl' => 'Deli na diaspora*',
'sr' => 'Podeli na diaspora*-u',
'sv' => 'Dela på diaspora*',
'tr' => 'diaspora*\'ta paylaş',
'zh' => '分享至diaspora*',
);
}

View File

@@ -0,0 +1,97 @@
<?php
/**
* Will be included in the shariff.php only, when Facebook is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://www.facebook.com/sharer/sharer.php' );
// Build the button URL.
$button_url = $service_url . '?u=' . $share_url;
// Set the Colors (Hexadecimal including the #).
$main_color = '#3b5998';
$secondary_color = '#4273c8';
$wcag_color = '#38548F';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели във Facebook',
'cs' => 'Sdílet na Facebooku',
'da' => 'Del på Facebook',
'de' => 'Bei Facebook teilen',
'en' => 'Share on Facebook',
'es' => 'Compartir en Facebook',
'fi' => 'Jaa Facebookissa',
'fr' => 'Partager sur Facebook',
'hr' => 'Podijelite na Facebooku',
'hu' => 'Megosztás Facebookon',
'it' => 'Condividi su Facebook',
'ja' => 'フェイスブック上で共有',
'ko' => '페이스북에서 공유하기',
'nl' => 'Delen op Facebook',
'no' => 'Del på Facebook',
'pl' => 'Udostępnij na Facebooku',
'pt' => 'Compartilhar no Facebook',
'ro' => 'Partajează pe Facebook',
'ru' => 'Поделиться на Facebook',
'sk' => 'Zdieľať na Facebooku',
'sl' => 'Deli na Facebooku',
'sr' => 'Podeli na Facebook-u',
'sv' => 'Dela på Facebook',
'tr' => 'Facebook\'ta paylaş',
'zh' => '在Facebook上分享',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Use the FB ID and Secret, if available.
if ( isset( $shariff3uu['fb_id'] ) && isset( $shariff3uu['fb_secret'] ) ) {
// On 32-bit PHP installations the constant is 4 and we have to disable the check because the id is too long.
if ( ( defined( PHP_INT_SIZE ) && PHP_INT_SIZE === '4' ) || ! defined( PHP_INT_SIZE ) ) {
$fb_app_id = $shariff3uu['fb_id'];
} else {
$fb_app_id = absint( $shariff3uu['fb_id'] );
}
$fb_app_secret = sanitize_text_field( $shariff3uu['fb_secret'] );
// Create the FB access token.
$fb_token = $fb_app_id . '|' . $fb_app_secret;
// Use the token to get the share counts.
$facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/v3.3/?access_token=' . $fb_token . '&fields=engagement&id=' . $post_url ) ) );
// Decode the json response.
$facebook_json = json_decode( $facebook, true );
// Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided.
$nofbid = '0';
}
/**
* Stores results - uses engagement (Graph API > 2.12) if it exists, otherwise uses share_count - ordered based on proximity of occurrence.
* Records errors, if enabled (e.g. request from the status tab).
*/
if ( isset( $facebook_json['engagement'] ) && isset( $facebook_json['engagement']['share_count'] ) ) {
$share_counts['facebook'] = intval( $facebook_json['engagement']['reaction_count'] ) + intval( $facebook_json['engagement']['comment_count'] ) + intval( $facebook_json['engagement']['share_count'] ) + intval( $facebook_json['engagement']['comment_plugin_count'] );
} elseif ( isset( $facebook_json['share'] ) && isset( $facebook_json['share']['share_count'] ) ) {
$share_counts['facebook'] = intval( $facebook_json['share']['share_count'] );
} elseif ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['total_count'] ) ) {
$share_counts['facebook'] = intval( $facebook_json['data'][0]['total_count'] );
} elseif ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['share_count'] ) ) {
$share_counts['facebook'] = intval( $facebook_json['data'][0]['share_count'] );
} elseif ( isset( $facebook_json['id'] ) && ! isset( $facebook_json['error'] ) && 1 === $nofbid ) {
$share_counts['facebook'] = '0';
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['facebook'] = $facebook;
}
}; // End if backend.

View File

@@ -0,0 +1,48 @@
<?php
/**
* Will be included in the shariff.php only, when Flattr is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://flattr.com/domain/' );
// Get WP URL.
$wp_url = wp_parse_url( get_bloginfo( 'url' ) );
// Build button URL.
$button_url = $service_url . preg_replace('#^www\.(.+\.)#i', '$1', $wp_url['host'] );
// Colors.
$main_color = '#7ea352';
$secondary_color = '#F67C1A';
$wcag_color = '#415728';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button text label.
$button_text_array = array(
'de' => 'flattr',
'en' => 'flattr',
);
// Button alt label.
$button_title_array = array(
'de' => 'Beitrag flattrn!',
'en' => 'Flattr this!',
'fr' => 'Flattré!',
'es' => 'Flattr!',
);
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* Will be included in the shariff.php only, when Flipboard is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://share.flipboard.com/bookmarklet/popout' );
// Build the button URL.
$button_url = $service_url . '?v=2&title=' . $share_title . '&url=' . $share_url;
// Set the Colors (Hexadecimal including the #).
$main_color = '#f52828';
$secondary_color = '#373737';
$wcag_color = '#B30A0A';
// SVG icon.
$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>';
// Backend available?
$backend_available = 0;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в Flipboard',
'cs' => 'Sdílet na Flipboardu',
'da' => 'Del på Flipboard',
'de' => 'Bei Flipboard teilen',
'en' => 'Share on Flipboard',
'es' => 'Compartir en Flipboard',
'fi' => 'Jaa Flipboardissä',
'fr' => 'Partager sur Flipboard',
'hr' => 'Podijelite na Flipboardu',
'hu' => 'Megosztás Flipboardon',
'it' => 'Condividi su Flipboard',
'ja' => 'Flipboard上で共有',
'ko' => 'Flipboard에서 공유하기',
'nl' => 'Delen op Flipboard',
'no' => 'Del på Flipboard',
'pl' => 'Udostępnij na Flipboardu',
'pt' => 'Compartilhar no Flipboard',
'ro' => 'Partajează pe Flipboard',
'ru' => 'Поделиться на Flipboard',
'sk' => 'Zdieľať na Flipboardu',
'sl' => 'Deli na Flipboardu',
'sr' => 'Podeli na Flipboard-u',
'sv' => 'Dela på Flipboard',
'tr' => 'Flipboard\'ta paylaş',
'zh' => '在Flipboard上分享',
);
}

View File

@@ -0,0 +1,77 @@
<?php
/**
* Will be included in the shariff.php only, when Info is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Set custom info url or default one.
if ( array_key_exists( 'info_url', $atts ) ) {
$service_url = esc_url( $atts['info_url'] );
} else {
$service_url = esc_url( 'http://ct.de/-2467514' );
}
// Build button URL.
$button_url = $service_url;
// Colors.
$main_color = '#999';
$secondary_color = '#a8a8a8';
$wcag_color = '#595959';
// Replace $main_color with $wcag_color and $secondary_color with #000, if $wacg_theme is selected.
if ( isset( $atts['theme'] ) && 'wcag' === $atts['theme'] && isset( $wcag_color ) && '' !== $wcag_color ) {
$main_color = $wcag_color;
$secondary_color = '#000';
}
// SVG icon.
$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>';
// Button text label.
$button_text_array = array(
'de' => 'info',
'en' => 'info',
);
// Button alt label.
if ( array_key_exists( 'info_text', $atts ) ) {
$button_title_array = array( 'en' => $atts['info_text'] );
} else {
$button_title_array = array(
'bg' => 'Повече информация',
'cs' => 'Více informací',
'da' => 'Flere oplysninger',
'de' => 'Weitere Informationen',
'en' => 'More information',
'es' => 'Más informaciones',
'fi' => 'Lisätietoja',
'fr' => 'Plus d\'informations',
'hr' => 'Više informacija',
'hu' => 'Több információ',
'it' => 'Maggiori informazioni',
'ja' => '詳しい情報',
'ko' => '추가 정보',
'nl' => 'Verdere informatie',
'no' => 'Mer informasjon',
'pl' => 'Więcej informacji',
'pt' => 'Mais informações',
'ro' => 'Mai multe informatii',
'ru' => 'Больше информации',
'sk' => 'Viac informácií',
'sl' => 'Več informacij',
'sr' => 'Više informacija',
'sv' => 'Mer information',
'tr' => 'Daha fazla bilgi',
'zh' => '更多信息',
);
}
}

View File

@@ -0,0 +1,88 @@
<?php
/**
* Will be included in the shariff.php only, when LinedIn is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://www.linkedin.com/shareArticle?mini=true' );
// Build button URL.
$button_url = $service_url . '&url=' . $share_url . '&title=' . $share_title;
// Colors.
$main_color = '#0077b5';
$secondary_color = '#1488bf';
$wcag_color = '#005B8A';
// SVG icon.
$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>';
// Backend available?
$backend_available = 0;
// Button text label.
$button_text_array = array(
'bg' => 'cподеляне',
'cs' => 'sdílet',
'da' => 'del',
'de' => 'mitteilen',
'en' => 'share',
'es' => 'compartir',
'fi' => 'Jaa',
'fr' => 'partager',
'hr' => 'podijelite',
'hu' => 'megosztás',
'it' => 'condividi',
'ja' => 'シェア',
'ko' => '공유하기',
'nl' => 'delen',
'no' => 'del',
'pl' => 'udostępnij',
'pt' => 'compartilhar',
'ro' => 'distribuiți',
'ru' => 'поделиться',
'sk' => 'zdieľať',
'sl' => 'deli',
'sr' => 'podeli',
'sv' => 'dela',
'tr' => 'paylaş',
'zh' => '分享',
);
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в LinkedIn',
'cs' => 'Sdílet na LinkedIn',
'da' => 'Del på LinkedIn',
'de' => 'Bei LinkedIn teilen',
'en' => 'Share on LinkedIn',
'es' => 'Compartir en LinkedIn',
'fi' => 'Jaa LinkedInissä',
'fr' => 'Partager sur LinkedIn',
'hr' => 'Podijelite na LinkedIn',
'hu' => 'Megosztás LinkedInen',
'it' => 'Condividi su LinkedIn',
'ja' => 'LinkedIn上で共有',
'ko' => 'LinkedIn에서 공유하기',
'nl' => 'Delen op LinkedIn',
'no' => 'Del på LinkedIn',
'pl' => 'Udostępnij przez LinkedIn',
'pt' => 'Compartilhar no LinkedIn',
'ro' => 'Partajează pe LinkedIn',
'ru' => 'Поделиться на LinkedIn',
'sk' => 'Zdieľať na LinkedIn',
'sl' => 'Deli na LinkedIn',
'sr' => 'Podeli na LinkedIn-u',
'sv' => 'Dela på LinkedIn',
'tr' => 'LinkedIn\'ta paylaş',
'zh' => '在LinkedIn上分享',
);
}

View File

@@ -0,0 +1,86 @@
<?php
/**
* Will be included in the shariff.php only, when Mailto is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Build button URL.
$button_url = 'mailto:?body=' . $share_url . '&subject=' . rawurlencode( urldecode( $share_title ) );
// Colors.
$main_color = '#999';
$secondary_color = '#a8a8a8';
$wcag_color = '#595959';
// SVG icon.
$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>';
// Same window?
$same_window = 1;
// Button text label.
$button_text_array = array(
'bg' => 'имейл',
'da' => 'e-mail',
'de' => 'E-Mail',
'en' => 'email',
'es' => 'correo',
'fi' => 'sähköpostitse',
'fr' => 'courriel',
'hr' => 'e-pošta',
'hu' => 'e-mail',
'it' => 'e-mail',
'ja' => 'e-mail',
'ko' => 'e-mail',
'nl' => 'e-mail',
'no' => 'e-post',
'pl' => 'e-mail',
'pt' => 'e-mail',
'ro' => 'e-mail',
'ru' => 'e-mail',
'sk' => 'e-mail',
'sl' => 'e-mail',
'sr' => 'e-mail',
'sv' => 'e-post',
'tr' => 'e-posta',
'zh' => '分享',
);
// Button alt label.
$button_title_array = array(
'bg' => 'Изпрати по имейл',
'cs' => 'Poslat mailem',
'da' => 'Sende via e-mail',
'de' => 'Per E-Mail versenden',
'en' => 'Send by email',
'es' => 'Enviar por correo electrónico',
'fi' => 'Lähetä sähköpostitse',
'fr' => 'Envoyer par courriel',
'hr' => 'Pošaljite emailom',
'hu' => 'Elküldés e-mailben',
'it' => 'Inviare via email',
'ja' => '電子メールで送信',
'ko' => '이메일로 보내기',
'nl' => 'Sturen via e-mail',
'no' => 'Send via epost',
'pl' => 'Wyślij e-mailem',
'pt' => 'Enviar por e-mail',
'ro' => 'Trimite prin e-mail',
'ru' => 'Отправить по эл. почте',
'sk' => 'Poslať e-mailom',
'sl' => 'Pošlji po elektronski pošti',
'sr' => 'Pošalji putem email-a',
'sv' => 'Skicka via e-post',
'tr' => 'E-posta ile gönder',
'zh' => '通过电子邮件传送',
);
}

View File

@@ -0,0 +1,59 @@
<?php
/**
* Will be included in the shariff.php only, when MeWe is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://mewe.com/share' );
// Build the button URL.
$button_url = $service_url . '?link=' . $share_url;
// Set the Colors (Hexadecimal including the #).
$main_color = '#16387D';
$secondary_color = '#187ca5';
$wcag_color = '#16387D';
// SVG icon.
$svg_icon = '<svg width="32px" height="32px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="' . $main_color . '" d="M7.48,9.21a1.46,1.46,0,1,1-2.92,0h0a1.46,1.46,0,1,1,2.92,0Zm7.3,0a1.52,1.52,0,1,1-1.52-1.52A1.52,1.52,0,0,1,14.78,9.21Zm8.52,0a1.52,1.52,0,1,1-1.52-1.52A1.52,1.52,0,0,1,23.3,9.21Zm8.53,0a1.47,1.47,0,0,1-2.93,0h0a1.47,1.47,0,0,1,2.93,0ZM.17,13.35a1.09,1.09,0,0,1,1.1-1.09h.12a1,1,0,0,1,1,.61L6,18.46l3.65-5.59a.8.8,0,0,1,.85-.61h.25a1,1,0,0,1,1,1.09v9.74a1,1,0,0,1-.7,1.19,1.24,1.24,0,0,1-.27,0,1.11,1.11,0,0,1-1.11-1.09s0-.09,0-.13V16.15l-2.8,4.26a1.08,1.08,0,0,1-1,.61c-.37,0-.61-.24-.86-.61l-2.8-4.26v7.06a1,1,0,0,1-1.09,1,1,1,0,0,1-1-1Zm13.15.37a1.35,1.35,0,0,1,0-.49,1,1,0,0,1,1-1,1.05,1.05,0,0,1,1,.73l2.8,8.15L20.75,13a.92.92,0,0,1,1-.73h.12c.61,0,1,.24,1.1.73l2.68,8.15L28.3,13a1,1,0,0,1,1-.73,1.06,1.06,0,0,1,1.09,1,1,1,0,0,1,0,.49l-3.65,9.74a1,1,0,0,1-1,.85H25.5a1.31,1.31,0,0,1-1.1-.85l-2.56-7.67-2.67,7.67a1.32,1.32,0,0,1-1.1.85h-.24a1,1,0,0,1-1-.85Z"/></svg>';
// Backend available?
$backend_available = 0;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели във MeWe',
'cs' => 'Sdílet na MeWeu',
'da' => 'Del på MeWe',
'de' => 'Bei MeWe teilen',
'en' => 'Share on MeWe',
'es' => 'Compartir en MeWe',
'fi' => 'Jaa MeWeissa',
'fr' => 'Partager sur MeWe',
'hr' => 'Podijelite na MeWeu',
'hu' => 'Megosztás MeWeon',
'it' => 'Condividi su MeWe',
'ja' => 'フェイスブック上で共有',
'ko' => '페이스북에서 공유하기',
'nl' => 'Delen op MeWe',
'no' => 'Del på MeWe',
'pl' => 'Udostępnij na MeWeu',
'pt' => 'Compartilhar no MeWe',
'ro' => 'Partajează pe MeWe',
'ru' => 'Поделиться на MeWe',
'sk' => 'Zdieľať na MeWeu',
'sl' => 'Deli na MeWeu',
'sr' => 'Podeli na MeWe-u',
'sv' => 'Dela på MeWe',
'tr' => 'MeWe\'ta paylaş',
);
}

View File

@@ -0,0 +1,56 @@
<?php
/**
* Will be included in the shariff.php only, when Mix is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://mix.com/add' );
// Build the button URL.
$button_url = $service_url . '?url=' . $share_url;
// Set the Colors (Hexadecimal including the #).
$main_color = '#ff8226';
$secondary_color = '#FFB27A';
$wcag_color = '#8F3C00';
// SVG icon.
$svg_icon = '<svg width="32px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="' . $main_color . '" d="M0 64v348.9c0 56.2 88 58.1 88 0V174.3c7.9-52.9 88-50.4 88 6.5v175.3c0 57.9 96 58 96 0V240c5.3-54.7 88-52.5 88 4.3v23.8c0 59.9 88 56.6 88 0V64H0z"/></svg>';
// Backend available?
$backend_available = 0;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели във Mix',
'cs' => 'Sdílet na Mix',
'da' => 'Del på Mix',
'de' => 'Bei Mix teilen',
'en' => 'Share on Mix',
'es' => 'Compartir en Mix',
'fi' => 'Jaa Mixissa',
'fr' => 'Partager sur Mix',
'hr' => 'Podijelite na Mix',
'hu' => 'Megosztás Mix',
'it' => 'Condividi su Mix',
'nl' => 'Delen op Mix',
'no' => 'Del på Mix',
'pl' => 'Udostępnij na Mix',
'pt' => 'Compartilhar no Mix',
'ro' => 'Partajează pe Mix',
'ru' => 'Поделиться на Mix',
'sk' => 'Zdieľať na Mix',
'sl' => 'Deli na Mix',
'sr' => 'Podeli na Mix',
'sv' => 'Dela på Mix',
);
}

View File

@@ -0,0 +1,72 @@
<?php
/**
* Will be included in the shariff.php only, when Odnoklassniki is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://connect.ok.ru/offer' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
// Colors.
$main_color = '#ee8208';
$secondary_color = '#f3a752';
$wcag_color = '#874508';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button text label.
$button_title_array = array(
'bg' => 'Сподели във Odnoklassniki',
'da' => 'Del på Odnoklassniki',
'de' => 'Bei Odnoklassniki teilen',
'en' => 'Share on Odnoklassniki',
'es' => 'Compartir en Odnoklassniki',
'fi' => 'Jaa Odnoklassniki',
'fr' => 'Partager sur Odnoklassniki',
'hr' => 'Podijelite na Odnoklassniki',
'hu' => 'Megosztás Odnoklassniki',
'it' => 'Condividi su Odnoklassniki',
'ja' => 'Odnoklassnikiでシェア',
'ko' => '오드 노 클라스 니키 공유',
'nl' => 'Delen op Odnoklassniki',
'no' => 'Del på Odnoklassniki',
'pl' => 'Udostępnij na Odnoklassniki',
'pt' => 'Compartilhar no Odnoklassniki',
'ro' => 'Partajează pe Odnoklassniki',
'ru' => 'Поделиться на Odnoklassniki',
'sk' => 'Zdieľať na Odnoklassniki',
'sl' => 'Deli na Odnoklassniki',
'sr' => 'Podeli na Odnoklassniki',
'sv' => 'Dela på Odnoklassniki',
'tr' => 'Odnoklassniki\'ta paylaş',
'zh' => '在Odnoklassniki上分享',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Fetch share counts.
$odnoklassniki = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://connect.ok.ru/dk?st.cmd=extLike&tp=json&ref=' . $post_url ) ) );
// Decode the json response.
$odnoklassniki_json = json_decode( $odnoklassniki, true );
// Store results and record errors, if enabled (e.g. request from the status tab).
if ( isset( $odnoklassniki_json ) && ! empty( $odnoklassniki_json ) ) {
$share_counts['odnoklassniki'] = intval( $odnoklassniki_json['count'] );
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['odnoklassniki'] = $odnoklassniki;
}
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* Will be included in the shariff.php only, when Patreon is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://www.patreon.com/' );
// Patreon ID.
if ( array_key_exists( 'patreonid', $atts ) ) {
$patreonid = esc_html( $atts['patreonid'] );
} else {
$patreonid = '';
}
// Build button URL.
$button_url = $service_url . $patreonid;
// Colors.
$main_color = '#e6461a';
$secondary_color = '#FF794D';
$wcag_color = '#A23210';
// SVG icon.
$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>';
// Button text label.
$button_text_array = array(
'de' => 'patreon',
'en' => 'patreon',
);
// Button alt label.
$button_title_array = array(
'de' => 'Werde ein patron!',
'en' => 'Become a patron!',
'es' => 'Conviértete en un patron!',
'fr' => 'Devenez un patron!',
);
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Will be included in the shariff.php only, when PayPal is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=' );
// PayPal button ID.
if ( array_key_exists( 'paypalbuttonid', $atts ) ) {
$paypalbuttonid = esc_html( $atts['paypalbuttonid'] );
} else {
$paypalbuttonid = '';
}
// Build button URL.
$button_url = $service_url . $paypalbuttonid;
// Colors.
$main_color = '#009cde';
$secondary_color = '#0285d2';
$wcag_color = '#005C8A';
// SVG icon.
$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>';
// Button text label.
$button_text_array = array(
'de' => 'spenden',
'en' => 'donate',
'fr' => 'faire un don',
'es' => 'donar',
);
// Button alt label.
$button_title_array = array(
'de' => 'Spenden mit PayPal',
'en' => 'Donate with PayPal',
'fr' => 'Faire un don via PayPal',
'es' => 'Donar via PayPal',
);
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Will be included in the shariff.php only, when PayPal.me is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://www.paypal.me/' );
// PayPal.me ID.
if ( array_key_exists( 'paypalmeid', $atts ) ) {
$paypalmeid = esc_html( $atts['paypalmeid'] );
} else {
$paypalmeid = '';
}
// Build button URL.
$button_url = $service_url . $paypalmeid;
// Colors.
$main_color = '#009cde';
$secondary_color = '#0285d2';
$wcag_color = '#005C8A';
// SVG icon.
$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>';
// Button text label.
$button_text_array = array(
'de' => 'spenden',
'en' => 'donate',
'fr' => 'faire un don',
'es' => 'donar',
);
// Button alt label.
$button_title_array = array(
'de' => 'Spenden mit PayPal',
'en' => 'Donate with PayPal',
'fr' => 'Faire un don via PayPal',
'es' => 'Donar via PayPal',
);
}

View File

@@ -0,0 +1,121 @@
<?php
/**
* Will be included in the shariff.php only, when Pinterest is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if function catch_image exists.
if ( ! function_exists( 'shariff3uu_catch_image' ) ) {
/**
* Helper function to get the first image of a post.
*/
function shariff3uu_catch_image() {
$result = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', get_post_field( 'post_content', get_the_ID() ), $matches );
if ( array_key_exists( 0, $matches[1] ) ) {
return $matches[1][0];
} else {
return '';
}
};
};
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://www.pinterest.com/pin/create/link/' );
// Get an image for pinterest (attribute -> featured image -> first image -> default image -> shariff hint).
if ( array_key_exists( 'services', $atts ) ) {
if ( strstr( $atts['services'], 'pinterest' ) ) {
if ( array_key_exists( 'media', $atts ) ) {
$share_media = esc_html( $atts['media'] );
} else {
$feat_image = wp_get_attachment_url( get_post_thumbnail_id() );
if ( ! empty( $feat_image ) ) {
$share_media = esc_html( $feat_image );
} else {
$first_image = shariff3uu_catch_image();
if ( ! empty( $first_image ) ) {
$share_media = esc_html( $first_image );
} else {
if ( isset( $shariff3uu['default_pinterest'] ) ) {
$share_media = $shariff3uu['default_pinterest'];
} else {
$share_media = plugins_url( '/images/defaultHint.png', dirname( __FILE__ ) );
}
}
}
}
}
}
// Build button URL.
$button_url = $service_url . '?url=' . $share_url . '&media=' . rawurlencode( $share_media ) . '&description=' . $share_title;
// Colors.
$main_color = '#cb2027';
$secondary_color = '#e70f18';
$wcag_color = '#AE1920';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button text label.
$button_text_array = array(
'de' => 'merken',
'en' => 'save',
'es' => 'ahorrar',
'fr' => 'enregistrer',
'it' => 'salva',
);
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в Pinterest',
'cs' => 'Přidat na Pinterest',
'da' => 'Del på Pinterest',
'de' => 'Bei Pinterest pinnen',
'en' => 'Pin it on Pinterest',
'es' => 'Ahorrar en Pinterest',
'fi' => 'Jaa Pinterestissä',
'fr' => 'Partager sur Pinterest',
'hr' => 'Podijelite na Pinterest',
'hu' => 'Megosztás Pinteresten',
'it' => 'Condividi su Pinterest',
'ja' => 'Pinterest上で共有',
'ko' => 'Pinterest에서 공유하기',
'nl' => 'Delen op Pinterest',
'no' => 'Del på Pinterest',
'pl' => 'Udostępnij przez Pinterest',
'pt' => 'Compartilhar no Pinterest',
'ro' => 'Partajează pe Pinterest',
'ru' => 'Поделиться на Pinterest',
'sk' => 'Zdieľať na Pinterest',
'sl' => 'Deli na Pinterest',
'sr' => 'Podeli na Pinterest-u',
'sv' => 'Dela på Pinterest',
'tr' => 'Pinterest\'ta paylaş',
'zh' => '分享至Pinterest',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Fetch counts.
$pinterest = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://api.pinterest.com/v1/urls/count.json?callback=x&url=' . $post_url ) ) );
$pinterest_json = rtrim( substr( $pinterest, 2 ), ')' );
$pinterest_json = json_decode( $pinterest_json, true );
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
if ( isset( $pinterest_json['count'] ) ) {
$share_counts['pinterest'] = intval( $pinterest_json['count'] );
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['pinterest'] = $pinterest;
}
}

View File

@@ -0,0 +1,66 @@
<?php
/**
* Will be included in the shariff.php only, when Pocket is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://getpocket.com/save' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
// Colors.
$main_color = '#ff0000';
$secondary_color = '#444';
$wcag_color = '#B30000';
// SVG icon.
$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>';
// Backend available?
$backend_available = 0;
// Button text label.
$button_text_array = array(
'de' => 'Pocket',
'en' => 'pocket',
);
// Button alt label.
$button_title_array = array(
'bg' => 'Запазване в Pocket',
'cs' => 'Uložit do Pocket',
'da' => 'Gem i Pocket',
'de' => 'Bei Pocket speichern',
'en' => 'Save to Pocket',
'es' => 'Guardar en Pocket',
'fi' => 'Tallenna kohtaan Pocket',
'fr' => 'Enregistrer dans Pocket',
'hr' => 'Spremi u Pocket',
'hu' => 'Mentés "Pocket"-be',
'it' => 'Salva in Pocket',
'ja' => '「ポケット」に保存',
'ko' => 'Pocket에 저장',
'nl' => 'Opslaan in Pocket',
'no' => 'Lagre i Pocket',
'pl' => 'Zapisz w Pocket',
'pt' => 'Salvar em Pocket',
'ro' => 'Salvați în Pocket',
'ru' => 'Сохранить в Pocket',
'sk' => 'Uložiť do priečinka Pocket',
'sl' => 'Shrani v Pocket',
'sr' => 'Sačuvaj u Pocket',
'sv' => 'Spara till Pocket',
'tr' => 'Pocket e kaydet',
'zh' => '保存到Pocket',
);
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* Will be included in the shariff.php only, when Printer is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Build button URL.
$button_url = 'javascript:window.print()';
// Colors.
$main_color = '#999';
$secondary_color = '#a8a8a8';
$wcag_color = '#595959';
// SVG icon.
$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>';
// Same window?
$same_window = 1;
// Button text label.
$button_text_array = array(
'cs' => 'tlačit',
'de' => 'drucken',
'en' => 'print',
'fr' => 'imprimer',
'es' => 'imprimir',
'it' => 'imprimere',
'da' => 'dat trykke',
'nl' => 'drukken',
);
// Button alt label.
$button_title_array = array(
'de' => 'drucken',
'cs' => 'tlačit',
'en' => 'print',
'fr' => 'imprimer',
'es' => 'imprimir',
'it' => 'imprimere',
'da' => 'dat trykke',
'nl' => 'drukken',
);
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* Will be included in the shariff.php only, when Qzone is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
// Colors.
$main_color = '#ffce00';
$secondary_color = '#71C5F2';
$wcag_color = '#6B5700';
// SVG icon.
$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>';
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в Qzone',
'cs' => 'Sdílet na Qzone',
'da' => 'Del på Qzone',
'de' => 'Bei Qzone teilen',
'en' => 'Share on Qzone',
'es' => 'Compartir en Qzone',
'fi' => 'Jaa Qzoneissä',
'fr' => 'Partager sur Qzone',
'hr' => 'Podijelite na Qzone',
'hu' => 'Megosztás Qzone',
'it' => 'Condividi su Qzone',
'ja' => 'Qzone上で共有',
'ko' => 'Qzone에서 공유하기',
'nl' => 'Delen op Qzone',
'no' => 'Del på Qzone',
'pl' => 'Udostępnij przez Qzone',
'pt' => 'Compartilhar no Qzone',
'ro' => 'Partajează pe Qzone',
'ru' => 'Поделиться на Qzone',
'sk' => 'Zdieľať na Qzone',
'sl' => 'Deli na Qzone',
'sr' => 'Podeli na Qzone-u',
'sv' => 'Dela på Qzone',
'tr' => 'Qzone\'ta paylaş',
'zh' => '分享至QQ空间',
);
}

View File

@@ -0,0 +1,75 @@
<?php
/**
* Will be included in the shariff.php only, when Reddit is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://www.reddit.com/submit' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url;
// Colors.
$main_color = '#ff4500';
$secondary_color = '#ff5700';
$wcag_color = '#A32D00';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в Reddit',
'cs' => 'Sdílet na Redditu',
'da' => 'Del på Reddit',
'de' => 'Bei Reddit teilen',
'en' => 'Share on Reddit',
'es' => 'Compartir en Reddit',
'fi' => 'Jaa Redditissä',
'fr' => 'Partager sur Reddit',
'hr' => 'Podijelite na Reddit',
'hu' => 'Megosztás Redditen',
'it' => 'Condividi su Reddit',
'ja' => 'Reddit上で共有',
'ko' => 'Reddit에서 공유하기',
'nl' => 'Delen op Reddit',
'no' => 'Del på Reddit',
'pl' => 'Udostępnij przez Reddit',
'pt' => 'Compartilhar no Reddit',
'ro' => 'Partajează pe Reddit',
'ru' => 'Поделиться на Reddit',
'sk' => 'Zdieľať na Reddit',
'sl' => 'Deli na Reddit',
'sr' => 'Podeli na Reddit-u',
'sv' => 'Dela på Reddit',
'tr' => 'Reddit\'ta paylaş',
'zh' => '分享至Reddit',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Fetch counts.
$reddit = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://www.reddit.com/api/info.json?url=' . $post_url ) ) );
$reddit_json = json_decode( $reddit, true );
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
if ( isset( $reddit_json['data']['children'] ) ) {
$count = 0;
foreach ( $reddit_json['data']['children'] as $child ) {
$count += intval( $child['data']['score'] );
}
$share_counts['reddit'] = $count;
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['reddit'] = $reddit;
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* Will be included in the shariff.php only, when RSS is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
if ( array_key_exists( 'rssfeed', $atts ) ) {
$service_url = esc_url( $atts['rssfeed'] );
} else {
$service_url = esc_url( get_bloginfo( 'rss_url' ) );
}
// Build button URL.
$button_url = $service_url;
// Colors.
$main_color = '#fe9312';
$secondary_color = '#ff8c00';
$wcag_color = '#aa2e00';
// SVG icon.
$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>';
// Button text label.
$button_text_array = array(
'de' => 'RSS-feed',
'en' => 'RSS feed',
'fr' => 'flux RSS',
);
// Button alt label.
$button_title_array = array(
'de' => 'RSS-feed',
'en' => 'RSS feed',
'fr' => "S'abonner au flux RSS",
);
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* Will be included in the shariff.php only, when SMS is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = 'sms:';
// Build button URL.
$button_url = $service_url . '?&body=' . $share_url;
// Colors.
$main_color = '#a1e877';
$secondary_color = '#d7d9d8';
$wcag_color = '#31640C';
// SVG icon.
$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>';
// Mobile only?
$mobile_only = 1;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в SMS',
'cs' => 'Sdílet na SMS',
'da' => 'Del på SMS',
'de' => 'Per SMS teilen',
'en' => 'Share on SMS',
'es' => 'Compartir en SMS',
'fi' => 'Jaa SMS',
'fr' => 'Partager sur SMS',
'hr' => 'Podijelite na SMS',
'hu' => 'Megosztás SMS',
'it' => 'Condividi su SMS',
'ja' => 'SMS上で共有',
'ko' => 'SMS에서 공유하기',
'nl' => 'Delen op SMS',
'no' => 'Del på SMS',
'pl' => 'Udostępnij przez SMS',
'pt' => 'Compartilhar no SMS',
'ro' => 'Partajează pe SMS',
'ru' => 'Поделиться на SMS',
'sk' => 'Zdieľať na SMS',
'sl' => 'Deli na SMS',
'sr' => 'Podeli na SMS-u',
'sv' => 'Dela på SMS',
'tr' => 'SMS\'ta paylaş',
'zh' => '在WSMS上分享',
);
}

View File

@@ -0,0 +1,61 @@
<?php
/**
* Will be included in the shariff.php only, when Telegram is requested as a service.
* Thanks to Daniel Sturm (@dcsturm).
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = 'https://telegram.me/share/url';
// Build button URL.
$button_url = $service_url . '?url=' . $share_url . '&text=' . $share_title;
// Colors.
$main_color = '#0088cc';
$secondary_color = '#4084A6';
$wcag_color = '#005E8F';
// SVG icon.
$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>';
// Mobile only?
$mobile_only = 0;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в Telegram',
'cs' => 'Sdílet na Telegramu',
'da' => 'Del på Telegram',
'de' => 'Bei Telegram teilen',
'en' => 'Share on Telegram',
'es' => 'Compartir en Telegram',
'fi' => 'Jaa Telegramissä',
'fr' => 'Partager sur Telegram',
'hr' => 'Podijelite na Telegram',
'hu' => 'Megosztás Telegramen',
'it' => 'Condividi su Telegram',
'ja' => 'Telegram上で共有',
'ko' => 'Telegram에서 공유하기',
'nl' => 'Delen op Telegram',
'no' => 'Del på Telegram',
'pl' => 'Udostępnij przez Telegram',
'pt' => 'Compartilhar no Telegram',
'ro' => 'Partajează pe Telegram',
'ru' => 'Поделиться на Telegram',
'sk' => 'Zdieľať na Telegram',
'sl' => 'Deli na Telegram',
'sr' => 'Podeli na Telegram-u',
'sv' => 'Dela på Telegram',
'tr' => 'Telegram\'ta paylaş',
'zh' => '在Telegram上分享',
);
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* Will be included in the shariff.php only, when TencentWeibo is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'http://v.t.qq.com/share/share.php' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
// Colors.
$main_color = '#02a8f3';
$secondary_color = '#8ac249';
$wcag_color = '#025C88';
// SVG icon.
$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>';
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в tencent weibo',
'cs' => 'Sdílet na tencent weibo',
'da' => 'Del på tencent weibo',
'de' => 'Bei tencent weibo teilen',
'en' => 'Share on tencent weibo',
'es' => 'Compartir en tencent weibo',
'fi' => 'Jaa tencent weiboissä',
'fr' => 'Partager sur tencent weibo',
'hr' => 'Podijelite na tencent weibo',
'hu' => 'Megosztás tencent weiboen',
'it' => 'Condividi su tencent weibo',
'ja' => 'Tencent weibo上で共有',
'ko' => 'Tencent weibo에서 공유하기',
'nl' => 'Delen op tencent weibo',
'no' => 'Del på tencent weibo',
'pl' => 'Udostępnij przez tencent weibo',
'pt' => 'Compartilhar no tencent weibo',
'ro' => 'Partajează pe tencent weibo',
'ru' => 'Поделиться на tencent weibo',
'sk' => 'Zdieľať na tencent weibo',
'sl' => 'Deli na tencent weibo',
'sr' => 'Podeli na tencent weibo-u',
'sv' => 'Dela på tencent weibo',
'tr' => 'Tencent weibo\'ta paylaş',
'zh' => '分享至腾讯微博',
);
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* Will be included in the shariff.php only, when Threema is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = 'threema://compose';
// Build button URL.
$button_url = $service_url . '?text=' . $share_title . '%20' . $share_url;
// Colors.
$main_color = '#1f1f1f';
$secondary_color = '#4fbc24';
$wcag_color = '#1f1f1f';
// SVG icon.
$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>';
// Mobile only?
$mobile_only = 1;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в Threema',
'cs' => 'Sdílet na Threema',
'da' => 'Del på Threema',
'de' => 'Bei Threema teilen',
'en' => 'Share on Threema',
'es' => 'Compartir en Threema',
'fi' => 'Jaa Threemaissä',
'fr' => 'Partager sur Threema',
'hr' => 'Podijelite na Threema',
'hu' => 'Megosztás Threemaen',
'it' => 'Condividi su Threema',
'ja' => 'Threema上で共有',
'ko' => 'Threema에서 공유하기',
'nl' => 'Delen op Threema',
'no' => 'Del på Threema',
'pl' => 'Udostępnij przez Threema',
'pt' => 'Compartilhar no Threema',
'ro' => 'Partajează pe Threema',
'ru' => 'Поделиться на Threema',
'sk' => 'Zdieľať na Threema',
'sl' => 'Deli na Threema',
'sr' => 'Podeli na Threema-u',
'sv' => 'Dela på Threema',
'tr' => 'Threema\'ta paylaş',
'zh' => '在Threema上分享',
);
}

View File

@@ -0,0 +1,80 @@
<?php
/**
* Will be included in the shariff.php only, when Tumblr is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://www.tumblr.com/widgets/share/tool' );
// Domain.
$wpurl = get_bloginfo( 'wpurl' );
$domainname = trim( $wpurl, '/' );
if ( ! preg_match( '#^http(s)?://#', $domainname ) ) {
$domainname = 'http://' . $domainname;
}
$url_parts = wp_parse_url( $domainname );
$domainname = preg_replace( '/^www\./', '', $url_parts['host'] );
// Build button URL.
$button_url = $service_url . '?posttype=link&canonicalUrl=' . $share_url . '&tags=' . rawurlencode( $domainname );
// Colors.
$main_color = '#36465d';
$secondary_color = '#529ecc';
$wcag_color = '#36465d';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в tumblr',
'cs' => 'Sdílet na tumblru',
'da' => 'Del på tumblr',
'de' => 'Bei tumblr teilen',
'en' => 'Share on tumblr',
'es' => 'Compartir en tumblr',
'fi' => 'Jaa tumblrissä',
'fr' => 'Partager sur tumblr',
'hr' => 'Podijelite na tumblr',
'hu' => 'Megosztás tumblren',
'it' => 'Condividi su tumblr',
'ja' => 'tumblr上で共有',
'ko' => 'tumblr에서 공유하기',
'nl' => 'Delen op tumblr',
'no' => 'Del på tumblr',
'pl' => 'Udostępnij przez tumblr',
'pt' => 'Compartilhar no tumblr',
'ro' => 'Partajează pe tumblr',
'ru' => 'Поделиться на tumblr',
'sk' => 'Zdieľať na tumblr',
'sl' => 'Deli na tumblr',
'sr' => 'Podeli na tumblr-u',
'sv' => 'Dela på tumblr',
'tr' => 'tumblr\'ta paylaş',
'zh' => '在tumblr上分享',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Fetch counts.
$tumblr = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://api.tumblr.com/v2/share/stats?url=' . $post_url ) ) );
$tumblr_json = json_decode( $tumblr, true );
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
if ( isset( $tumblr_json['response']['note_count'] ) ) {
$share_counts['tumblr'] = intval( $tumblr_json['response']['note_count'] );
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['tumblr'] = $tumblr;
}
}

View File

@@ -0,0 +1,91 @@
<?php
/**
* Will be included in the shariff.php only, when Twitter is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://twitter.com/share' );
// Via tag.
if ( array_key_exists( 'twitter_via', $atts ) ) {
$twitter_via = '&via=' . esc_html( $atts['twitter_via'] );
} else {
$twitter_via = '';
}
// Build button URL.
$button_url = $service_url . '?url=' . $share_url . '&text=' . $share_title . $twitter_via;
// Colors.
$main_color = '#55acee';
$secondary_color = '#32bbf5';
$wcag_color = '#115A92';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button text label.
$button_text_array = array(
'de' => 'twittern',
'en' => 'tweet',
'fr' => 'tweeter',
'it' => 'twitta',
'ja' => 'のつぶやき',
'ko' => '짹짹',
'ru' => 'твит',
'sr' => 'твеет',
'zh' => '鸣叫',
);
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в Twitter',
'cs' => 'Sdílet na Twiiteru',
'da' => 'Del på Twitter',
'de' => 'Bei Twitter teilen',
'en' => 'Share on Twitter',
'es' => 'Compartir en Twitter',
'fi' => 'Jaa Twitterissä',
'fr' => 'Partager sur Twitter',
'hr' => 'Podijelite na Twitteru',
'hu' => 'Megosztás Twitteren',
'it' => 'Condividi su Twitter',
'ja' => 'ツイッター上で共有',
'ko' => '트위터에서 공유하기',
'nl' => 'Delen op Twitter',
'no' => 'Del på Twitter',
'pl' => 'Udostępnij na Twitterze',
'pt' => 'Compartilhar no Twitter',
'ro' => 'Partajează pe Twitter',
'ru' => 'Поделиться на Twitter',
'sk' => 'Zdieľať na Twitteri',
'sl' => 'Deli na Twitterju',
'sr' => 'Podeli na Twitter-u',
'sv' => 'Dela på Twitter',
'tr' => 'Twitter\'da paylaş',
'zh' => '在Twitter上分享',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Fetch counts.
$twitter = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://counts.twitcount.com/counts.php?url=' . $post_url ) ) );
$twitter_json = json_decode( $twitter, true );
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
if ( isset( $twitter_json['count'] ) && ! isset( $twitter_json['error'] ) ) {
$share_counts['twitter'] = intval( $twitter_json['count'] );
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['twitter'] = $twitter;
}
}

View File

@@ -0,0 +1,73 @@
<?php
/**
* Will be included in the shariff.php only, when VK is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://vk.com/share.php' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url;
// Colors.
$main_color = '#527498';
$secondary_color = '#4273c8';
$wcag_color = '#3A5773';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели във VK',
'cs' => 'Sdílet na VKu',
'da' => 'Del på VK',
'de' => 'Bei VK teilen',
'en' => 'Share on VK',
'es' => 'Compartir en VK',
'fi' => 'Jaa VKissa',
'fr' => 'Partager sur VK',
'hr' => 'Podijelite na VKu',
'hu' => 'Megosztás VKon',
'it' => 'Condividi su VK',
'ja' => 'フェイスブック上で共有',
'ko' => '페이스북에서 공유하기',
'nl' => 'Delen op VK',
'no' => 'Del på VK',
'pl' => 'Udostępnij na VKu',
'pt' => 'Compartilhar no VK',
'ro' => 'Partajează pe VK',
'ru' => 'Поделиться на ВКонтакте',
'sk' => 'Zdieľať na VKu',
'sl' => 'Deli na VKu',
'sr' => 'Podeli na VK-u',
'sv' => 'Dela på VK',
'tr' => 'VK\'ta paylaş',
'zh' => '在VK上分享',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Fetch counts.
$vk = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://vk.com/share.php?act=count&url=' . $post_url ) ) );
if ( isset( $vk ) ) {
preg_match( '/^VK.Share.count\((\d+),\s+(\d+)\);$/i', $vk, $matches );
$vk_count = intval( $matches[2] );
}
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
if ( isset( $vk_count ) ) {
$share_counts['vk'] = $vk_count;
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['vk'] = $vk;
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* Will be included in the shariff.php only, when Wallabag is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://app.wallabag.it/bookmarklet' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url;
// Colors.
$main_color = '#26a69a';
$secondary_color = '#2bbbad';
$wcag_color = '#156058';
// SVG icon.
$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>';
// Button text label.
$button_text_array = array(
'de' => 'wallabag it',
'en' => 'wallabag it',
);
// Button alt label.
$button_title_array = array(
'de' => 'Bei wallabag speichern',
'en' => 'Save to wallabag',
);
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* Will be included in the shariff.php only, when Weibo is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'http://service.weibo.com/share/share.php' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title;
// Colors.
$main_color = '#e6162d';
$secondary_color = '#ff9933';
$wcag_color = '#AB1221';
// SVG icon.
$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>';
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в tencent weibo',
'cs' => 'Sdílet na tencent weibo',
'da' => 'Del på tencent weibo',
'de' => 'Bei tencent weibo teilen',
'en' => 'Share on tencent weibo',
'es' => 'Compartir en tencent weibo',
'fi' => 'Jaa tencent weiboissä',
'fr' => 'Partager sur tencent weibo',
'hr' => 'Podijelite na tencent weibo',
'hu' => 'Megosztás tencent weiboen',
'it' => 'Condividi su tencent weibo',
'ja' => 'Tencent weibo上で共有',
'ko' => 'Tencent weibo에서 공유하기',
'nl' => 'Delen op tencent weibo',
'no' => 'Del på tencent weibo',
'pl' => 'Udostępnij przez tencent weibo',
'pt' => 'Compartilhar no tencent weibo',
'ro' => 'Partajează pe tencent weibo',
'ru' => 'Поделиться на tencent weibo',
'sk' => 'Zdieľať na tencent weibo',
'sl' => 'Deli na tencent weibo',
'sr' => 'Podeli na tencent weibo-u',
'sv' => 'Dela på tencent weibo',
'tr' => 'Tencent weibo\'ta paylaş',
'zh' => '分享至腾讯微博',
);
}

View File

@@ -0,0 +1,64 @@
<?php
/**
* Will be included in the shariff.php only, when WhatsApp is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = 'https://api.whatsapp.com/send';
// Build button URL.
$button_url = $service_url . '?text=' . $share_title . '%20' . $share_url;
// Colors.
$main_color = '#34af23';
$secondary_color = '#5cbe4a';
$wcag_color = '#226411';
// SVG icon.
$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>';
// Mobile only?
if ( isset( $atts['hide_whatsapp'] ) && 1 === $atts['hide_whatsapp'] ) {
$mobile_only = 1;
} else {
$mobile_only = 0;
}
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в Whatsapp',
'cs' => 'Sdílet na Whatsappu',
'da' => 'Del på Whatsapp',
'de' => 'Bei Whatsapp teilen',
'en' => 'Share on Whatsapp',
'es' => 'Compartir en Whatsapp',
'fi' => 'Jaa WhatsAppissä',
'fr' => 'Partager sur Whatsapp',
'hr' => 'Podijelite na Whatsapp',
'hu' => 'Megosztás WhatsAppen',
'it' => 'Condividi su Whatsapp',
'ja' => 'Whatsapp上で共有',
'ko' => 'Whatsapp에서 공유하기',
'nl' => 'Delen op Whatsapp',
'no' => 'Del på Whatsapp',
'pl' => 'Udostępnij przez WhatsApp',
'pt' => 'Compartilhar no Whatsapp',
'ro' => 'Partajează pe Whatsapp',
'ru' => 'Поделиться на Whatsapp',
'sk' => 'Zdieľať na Whatsapp',
'sl' => 'Deli na Whatsapp',
'sr' => 'Podeli na WhatsApp-u',
'sv' => 'Dela på Whatsapp',
'tr' => 'Whatsapp\'ta paylaş',
'zh' => '在Whatsapp上分享',
);
}

View File

@@ -0,0 +1,87 @@
<?php
/**
* Will be included in the shariff.php only, when Xing is requested as a service.
*
* @package Shariff Wrapper
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
// Check if we need the frontend or the backend part.
if ( isset( $frontend ) && 1 === $frontend ) {
// Service URL.
$service_url = esc_url( 'https://www.xing.com/spi/shares/new' );
// Build button URL.
$button_url = $service_url . '?url=' . $share_url;
// Colors.
$main_color = '#126567';
$secondary_color = '#29888a';
$wcag_color = '#0F595C';
// SVG icon.
$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>';
// Backend available?
$backend_available = 1;
// Button alt label.
$button_title_array = array(
'bg' => 'Сподели в XING',
'cs' => 'Sdílet na XINGu',
'da' => 'Del på XING',
'de' => 'Bei XING teilen',
'en' => 'Share on XING',
'es' => 'Compartir en XING',
'fi' => 'Jaa XINGissä',
'fr' => 'Partager sur XING',
'hr' => 'Podijelite na XING',
'hu' => 'Megosztás XINGen',
'it' => 'Condividi su XING',
'ja' => 'XING上で共有',
'ko' => 'XING에서 공유하기',
'nl' => 'Delen op XING',
'no' => 'Del på XING',
'pl' => 'Udostępnij przez XING',
'pt' => 'Compartilhar no XING',
'ro' => 'Partajează pe XING',
'ru' => 'Поделиться на XING',
'sk' => 'Zdieľať na XING',
'sl' => 'Deli na XING',
'sr' => 'Podeli na XING-u',
'sv' => 'Dela på XING',
'tr' => 'XING\'ta paylaş',
'zh' => '分享至XING',
);
} elseif ( isset( $backend ) && 1 === $backend ) {
// Set xing options.
$xing_json = array(
'url' => $post_url_raw,
);
// Set post options.
$xing_post_options = array(
'method' => 'POST',
'timeout' => 5,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array( 'content-type' => 'application/json' ),
'body' => wp_json_encode( $xing_json ),
);
// Fetch counts.
$xing = sanitize_text_field( wp_remote_retrieve_body( wp_remote_post( 'https://www.xing.com/spi/shares/statistics', $xing_post_options ) ) );
$xing_json = json_decode( $xing, true );
// Store results, if we have some and record errors, if enabled (e.g. request from the status tab).
if ( isset( $xing_json['share_counter'] ) ) {
$share_counts['xing'] = intval( $xing_json['share_counter'] );
} elseif ( isset( $record_errors ) && 1 === $record_errors ) {
$service_errors['xing'] = $xing;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
<?php
/**
* Delete options upon uninstall to prevent issues with other plugins and leaving trash behind.
*
* @package WordPress
*/
// Exit, if uninstall.php was not called from WordPress.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
die();
}
// Delete options (even old ones), remove cron job and clear cache.
if ( is_multisite() ) {
global $wpdb;
// phpcs:ignore
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
if ( $blogs ) {
foreach ( $blogs as $blog ) {
// Switch to each blog.
switch_to_blog( $blog['blog_id'] );
// Delete options from options table.
delete_option( 'shariff3UU' );
delete_option( 'shariff3UU_basic' );
delete_option( 'shariff3UU_design' );
delete_option( 'shariff3UU_advanced' );
delete_option( 'shariff3UU_mailform' );
delete_option( 'shariff3UU_statistic' );
delete_option( 'widget_shariff' );
delete_option( 'shariff3UU_hide_update_notice' );
delete_option( 'shariff3uu_basic' );
delete_option( 'shariff3uu_design' );
delete_option( 'shariff3uu_advanced' );
delete_option( 'shariff3uu_mailform' );
delete_option( 'shariff3uu_statistic' );
// Purge transients.
shariff3uu_purge_transients();
// Remove cron job.
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
// Switch back to main.
restore_current_blog();
}
}
} else {
// Delete options from options table.
delete_option( 'shariff3UU' );
delete_option( 'shariff3UU_basic' );
delete_option( 'shariff3UU_design' );
delete_option( 'shariff3UU_advanced' );
delete_option( 'shariff3UU_mailform' );
delete_option( 'shariff3UU_statistic' );
delete_option( 'widget_shariff' );
delete_option( 'shariff3UU_hide_update_notice' );
delete_option( 'shariff3uu_basic' );
delete_option( 'shariff3uu_design' );
delete_option( 'shariff3uu_advanced' );
delete_option( 'shariff3uu_mailform' );
delete_option( 'shariff3uu_statistic' );
// Purge transients.
shariff3uu_purge_transients();
// Remove cron job.
wp_clear_scheduled_hook( 'shariff3UU_fill_cache' );
}
/**
* Helper function to purge all the transients associated with our plugin.
*/
function shariff3uu_purge_transients() {
// Make sure we have the $wpdb class ready.
if ( ! isset( $wpdb ) ) {
global $wpdb;
}
// Delete transients.
// phpcs:disable
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_timeout_shariff%"' );
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_shariff%"' );
// phpcs:enable
// Clear object cache.
wp_cache_flush();
}

View File

@@ -0,0 +1,343 @@
<?php
/**
* Will be included by shariff3uu_update() only if needed.
* Put all update task here. Make sure that all "older" updates are checked first.
* At least you must set $shariff3uu['version'] = [YOUR VERSION]; to avoid includes later on.
*
* @package WordPress
*/
// Prevent direct calls.
if ( ! class_exists( 'WP' ) ) {
die();
}
/**
* Migration < 2.3
* Split options in database according to new setting tabs.
* Delete old cache directory.
*/
if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '2.2.5' ) ) {
// Basic options.
if ( isset( $shariff3uu['version'] ) ) {
$shariff3uu_basic['version'] = $shariff3uu['version'];
}
if ( isset( $shariff3uu['services'] ) ) {
$shariff3uu_basic['services'] = $shariff3uu['services'];
}
if ( isset( $shariff3uu['add_after_all_posts'] ) ) {
$shariff3uu_basic['add_after']['posts'] = $shariff3uu['add_after_all_posts'];
}
if ( isset( $shariff3uu['add_after_all_overview'] ) ) {
$shariff3uu_basic['add_after']['posts_blogpage'] = $shariff3uu['add_after_all_overview'];
}
if ( isset( $shariff3uu['add_after_all_pages'] ) ) {
$shariff3uu_basic['add_after']['pages'] = $shariff3uu['add_after_all_pages'];
}
if ( isset( $shariff3uu['add_after_all_custom_type'] ) ) {
$shariff3uu_basic['add_after']['custom_type'] = $shariff3uu['add_after_all_custom_type'];
}
if ( isset( $shariff3uu['add_before_all_posts'] ) ) {
$shariff3uu_basic['add_before']['posts'] = $shariff3uu['add_before_all_posts'];
}
if ( isset( $shariff3uu['add_before_all_overview'] ) ) {
$shariff3uu_basic['add_before']['posts_blogpage'] = $shariff3uu['add_before_all_overview'];
}
if ( isset( $shariff3uu['add_before_all_pages'] ) ) {
$shariff3uu_basic['add_before']['pages'] = $shariff3uu['add_before_all_pages'];
}
if ( isset( $shariff3uu['disable_on_protected'] ) ) {
$shariff3uu_basic['disable_on_protected'] = $shariff3uu['disable_on_protected'];
}
if ( isset( $shariff3uu['backend'] ) ) {
$shariff3uu_basic['backend'] = $shariff3uu['backend'];
}
// Design options.
if ( isset( $shariff3uu['language'] ) ) {
$shariff3uu_design['language'] = $shariff3uu['language'];
}
if ( isset( $shariff3uu['theme'] ) ) {
$shariff3uu_design['theme'] = $shariff3uu['theme'];
}
if ( isset( $shariff3uu['buttonsize'] ) ) {
$shariff3uu_design['buttonsize'] = $shariff3uu['buttonsize'];
}
if ( isset( $shariff3uu['vertical'] ) ) {
$shariff3uu_design['vertical'] = $shariff3uu['vertical'];
}
if ( isset( $shariff3uu['align'] ) ) {
$shariff3uu_design['align'] = $shariff3uu['align'];
}
if ( isset( $shariff3uu['align_widget'] ) ) {
$shariff3uu_design['align_widget'] = $shariff3uu['align_widget'];
}
if ( isset( $shariff3uu['style'] ) ) {
$shariff3uu_design['style'] = $shariff3uu['style'];
}
// Advanced options.
if ( isset( $shariff3uu['info_url'] ) ) {
$shariff3uu_advanced['info_url'] = $shariff3uu['info_url'];
}
if ( isset( $shariff3uu['twitter_via'] ) ) {
$shariff3uu_advanced['twitter_via'] = $shariff3uu['twitter_via'];
}
if ( isset( $shariff3uu['flattruser'] ) ) {
$shariff3uu_advanced['flattruser'] = $shariff3uu['flattruser'];
}
if ( isset( $shariff3uu['default_pinterest'] ) ) {
$shariff3uu_advanced['default_pinterest'] = $shariff3uu['default_pinterest'];
}
// Mailform options.
if ( isset( $shariff3uu['mail_add_post_content'] ) ) {
$GLOBALS['shariff3UU_mailform']['mail_add_post_content'] = $shariff3uu['mail_add_post_content'];
}
if ( isset( $shariff3uu['mail_sender_name'] ) ) {
$GLOBALS['shariff3UU_mailform']['mail_sender_name'] = $shariff3uu['mail_sender_name'];
}
if ( isset( $shariff3uu['mail_sender_from'] ) ) {
$GLOBALS['shariff3UU_mailform']['mail_sender_from'] = $shariff3uu['mail_sender_from'];
}
// Default options should be as save as possible, same reason the statistics are disabled by default.
$GLOBALS['shariff3UU_mailform']['require_sender'] = 1;
// Update global.
$shariff3uu = array_merge( $shariff3uu_basic, $shariff3uu_design, $shariff3uu_advanced, $GLOBALS['shariff3UU_mailform'] );
// Update version.
$shariff3uu['version'] = '2.3.0';
}
/**
* Migration < 3.3
* Update options that were moved.
* Delete old cache directory and db entry.
*/
if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '3.3.0' ) ) {
// Update options that were moved.
if ( isset( $shariff3uu['backend'] ) ) {
$shariff3uu_statistic['backend'] = $shariff3uu['backend'];
}
if ( isset( $shariff3uu['fb_id'] ) ) {
$shariff3uu_statistic['fb_id'] = $shariff3uu['fb_id'];
}
if ( isset( $shariff3uu['fb_secret'] ) ) {
$shariff3uu_statistic['fb_secret'] = $shariff3uu['fb_secret'];
}
if ( isset( $shariff3uu['ttl'] ) ) {
$shariff3uu_statistic['ttl'] = $shariff3uu['ttl'];
}
if ( isset( $shariff3uu['disable'] ) ) {
$shariff3uu_statistic['disable'] = $shariff3uu['disable'];
}
// Delete old cache directory and db entry.
if ( is_multisite() ) {
global $wpdb;
// phpcs:ignore
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
if ( $blogs ) {
foreach ( $blogs as $blog ) {
// Switch to each blog.
switch_to_blog( $blog['blog_id'] );
// Delete cache dir.
shariff_removeoldcachedir();
// Delete old db entry.
delete_option( 'shariff3UU' );
// Switch back to main.
restore_current_blog();
}
}
} else {
// Delete cache dir.
shariff_removeoldcachedir();
// Delete old db entry.
delete_option( 'shariff3UU' );
}
// Disable Twitter backend due to new service OpenShareCount.com.
$shariff3uu_statistic['disable']['twitter'] = 1;
// Update version.
$shariff3uu['version'] = '3.3.0';
}
/**
* Helper function to delete old cache directory.
*/
function shariff_removeoldcachedir() {
$upload_dir = wp_upload_dir();
$cache_dir = $upload_dir['basedir'] . '/1970/01';
$cache_dir2 = $upload_dir['basedir'] . '/1970';
shariff_removeoldfiles( $cache_dir );
// Remove /1970/01 and /1970 if they are empty.
rmdir( $cache_dir );
rmdir( $cache_dir2 );
}
/**
* Helper function to delete old .dat files that begin with 'Shariff' and empty folders that also start with 'Shariff'.
*
* @param string $directory Path to Shariff cache directory.
*/
function shariff_removeoldfiles( $directory ) {
foreach ( glob( '{$directory}/Shariff* ' ) as $file ) {
if ( is_dir( $file ) ) {
shariff_removeoldfiles( $file );
} elseif ( substr( $file, -4 ) === '.dat' ) {
unlink( $file );
}
}
rmdir( $directory );
}
/**
* Migration < 4.0
*/
if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.0.0' ) ) {
// Set new option share counts, if statistic is enabled.
if ( isset( $shariff3uu_statistic['backend'] ) ) {
$shariff3uu_statistic['sharecounts'] = 1;
}
// Disable share counts if WP version < 4.4.
if ( version_compare( get_bloginfo( 'version' ), '4.4.0' ) < 1 ) {
unset( $shariff3uu_statistic['backend'] );
}
// Change button language to WordPress language, if it is set to auto and http_negotiate_language is not available (auto will not work without it).
if ( ! isset( $shariff3uu_design['lang'] ) && ! function_exists( 'http_negotiate_language' ) ) {
$shariff3uu_design['lang'] = substr( get_bloginfo( 'language' ), 0, 2 );
}
// Update version.
$shariff3uu['version'] = '4.0.0';
}
/**
* Migration < 4.2
*/
if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.2.0' ) ) {
// Make sure we have the $wpdb class ready.
global $wpdb;
// Delete user meta entry shariff3UU_ignore_notice to display update message again after an update (check for multisite).
if ( is_multisite() ) {
// phpcs:ignore
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
if ( $blogs ) {
foreach ( $blogs as $blog ) {
// Switch to each blog.
switch_to_blog( $blog['blog_id'] );
// Delete user meta entry shariff3UU_ignore_notice.
$users = get_users( 'role=administrator' );
foreach ( $users as $user ) {
if ( get_user_meta( $user->ID, 'shariff3UU_ignore_notice', true ) ) {
delete_user_meta( $user->ID, 'shariff3UU_ignore_notice' );
}
}
// Switch back to main.
restore_current_blog();
}
}
} else {
// Delete user meta entry shariff3UU_ignore_notice.
$users = get_users( 'role=administrator' );
foreach ( $users as $user ) {
if ( get_user_meta( $user->ID, 'shariff3UU_ignore_notice', true ) ) {
delete_user_meta( $user->ID, 'shariff3UU_ignore_notice' );
}
}
}
}
/**
* Migration < 4.5
*/
if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.5.0' ) ) {
// Update language settings.
if ( ! isset( $shariff3uu_design['lang'] ) ) {
$shariff3uu_design['autolang'] = 1;
$shariff3uu_design['lang'] = substr( get_locale(), 0, 2 );
}
// Update version.
$shariff3uu['version'] = '4.5.0';
}
/**
* General tasks we do on every update, like clean up transients and so on.
*/
// Purge transients (check for multisite).
if ( is_multisite() ) {
global $wpdb;
// phpcs:ignore
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
if ( $blogs ) {
foreach ( $blogs as $blog ) {
// Switch to each blog.
switch_to_blog( $blog['blog_id'] );
// Purge transients.
shariff3uu_purge_transients();
// Switch back to main.
restore_current_blog();
}
}
} else {
// Purge transients.
shariff3uu_purge_transients();
}
/**
* Helper function to purge all the transients associated with our plugin.
*/
function shariff3uu_purge_transients() {
// Make sure we have the $wpdb class ready.
if ( ! isset( $wpdb ) ) {
global $wpdb;
}
// Delete transients.
// phpcs:disable
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_timeout_shariff%"' );
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_shariff%"' );
// phpcs:enable
// Clear object cache.
wp_cache_flush();
}
// Set new version.
$shariff3uu['version'] = $code_version;
$shariff3uu_basic['version'] = $code_version;
/**
* Remove empty elements and save to options table. We had a mix up with shariff3uu and shariff3UU in the past and update_option is not case senitive. Therefore we actually need to delete and recreate it.
*/
// Basic.
delete_option( 'shariff3uu_basic' );
$shariff3uu_basic = array_filter( $shariff3uu_basic );
update_option( 'shariff3uu_basic', $shariff3uu_basic );
// Design.
delete_option( 'shariff3uu_design' );
$shariff3uu_design = array_filter( $shariff3uu_design );
update_option( 'shariff3uu_design', $shariff3uu_design );
// Advanced.
delete_option( 'shariff3uu_advanced' );
$shariff3uu_advanced = array_filter( $shariff3uu_advanced );
update_option( 'shariff3uu_advanced', $shariff3uu_advanced );
// Statistic.
delete_option( 'shariff3uu_statistic' );
$shariff3uu_statistic = array_filter( $shariff3uu_statistic );
update_option( 'shariff3uu_statistic', $shariff3uu_statistic );
// Remove old settings.
delete_option( 'shariff3UU_mailform' );
delete_option( 'shariff3UU_hide_update_notice' );
// Remove Shariff cron job and add it again, if wanted.
wp_clear_scheduled_hook( 'shariff3uu_fill_cache' );
do_action( 'shariff3uu_save_statistic_options' );

View File

@@ -0,0 +1,12 @@
<wpml-config>
<admin-texts>
<key name="shariff3uu_design">
<key name="headline"/>
<key name="headline_zero"/>
</key>
<key name="shariff3uu_advanced">
<key name="info_url"/>
<key name="info_text"/>
</key>
</admin-texts>
</wpml-config>