diff --git a/wp-content/plugins/flattr/flattr.php b/wp-content/plugins/flattr/flattr.php index d6ab638f9e3ba800bebee4f04d0db309372e967a..b9e54a91f7c54b3e691f32ddbb682bd951072752 100644 --- a/wp-content/plugins/flattr/flattr.php +++ b/wp-content/plugins/flattr/flattr.php @@ -2,11 +2,11 @@ /** * @package Flattr * @author Michael Henke - * @version 1.2.0 + * @version 1.2.1 Plugin Name: Flattr Plugin URI: http://wordpress.org/extend/plugins/flattr/ Description: Give your readers the opportunity to Flattr your effort -Version: 1.2.0 +Version: 1.2.1 Author: Michael Henke Author URI: http://www.codingmerc.com/tags/flattr/ License: This code is (un)licensed under the kopimi (copyme) non-license; http://www.kopimi.com. In other words you are free to copy it, taunt it, share it, fork it or whatever. :) @@ -22,7 +22,7 @@ class Flattr const FLATTR_DOMAIN = 'flattr.com'; - const VERSION = "1.2.0"; + const VERSION = "1.2.1"; /** * We should only create Flattr once - make it a singleton @@ -63,7 +63,7 @@ class Flattr * prepare Frontend */ protected function frontend() { - if (!in_array(get_option('flattr_button_style'), array('text', 'image'))) { + if (!in_array(get_option('flattr_button_style'), array('text', 'image', 'image-white'))) { add_action('wp_print_footer_scripts', array($this, 'insert_script')); } @@ -533,8 +533,11 @@ class Flattr $retval = '<a href="'. esc_attr($this->getAutosubmitUrl($buttonData)) .'" title="Flattr" target="_blank">Flattr this!</a>'; break; case "image": - $retval = '<a href="'. esc_attr($this->getAutosubmitUrl($buttonData)) .'" title="Flattr" target="_blank"><img src="'. get_bloginfo('wpurl') . '/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a>'; + $retval = '<a href="'. esc_attr($this->getAutosubmitUrl($buttonData)) .'" title="Flattr" target="_blank">'. Flattr::getStaticImageButton($type) .'</a>'; break; + case "image-white": + $retval = '<a href="'. static_flattr_url($post).'" title="Flattr" target="_blank">'. Flattr::getStaticImageButton($type) .'</a>'; + break; case "autosubmitUrl": $retval = $this->getAutosubmitUrl($buttonData); break; @@ -628,8 +631,11 @@ class Flattr $retval = '<a href="'. static_flattr_url($post).'" title="Flattr" target="_blank">Flattr this!</a>'; break; case "image": - $retval = '<a href="'. static_flattr_url($post).'" title="Flattr" target="_blank"><img src="'. get_bloginfo('wpurl') . '/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a>'; + $retval = '<a href="'. static_flattr_url($post).'" title="Flattr" target="_blank">'. Flattr::getStaticImageButton($type) .'</a>'; break; + case "image-white": + $retval = '<a href="'. static_flattr_url($post).'" title="Flattr" target="_blank">'. Flattr::getStaticImageButton($type) .'</a>'; + break; case "autosubmitUrl": $retval = $this->getAutosubmitUrl($buttonData); break; @@ -689,6 +695,39 @@ class Flattr return 'https://' . self::FLATTR_DOMAIN . '/submit/auto?' . http_build_query($params); } + + public static function getStaticImageButton($type=null) { + + $imgBaseURL = get_bloginfo('wpurl') . '/wp-content/plugins/flattr/img/'; + + $srcset = ""; + $src = ""; + + switch (empty($type) ? get_option('flattr_button_style') : $type) { + + case "image": + $src = $imgBaseURL . "flattr-badge-large.png"; + + $custom = get_option('flattrss_custom_image_url'); + if ($src != $custom) { + $src = $custom; + } + + $srcset .= $src; + break; + case "image-white": + $src = $imgBaseURL . "flattr-badge-white.png"; + $srcset .= $src . ", " . $imgBaseURL . "flattr-badge-white@2x.png 2x"; + $srcset .= $src . ", " . $imgBaseURL . "flattr-badge-white@3x.png 3x"; + break; + + } + + $imgTag = '<img src="' . $src . '" srcset="'. $srcset . '" alt="Flattr this!"/>'; + + return $imgTag; + + } protected static $languages; public static function getLanguages() { @@ -807,7 +846,16 @@ function flattr_post2rss($content) { $postmeta = isset($meta['_flattr_btn_disable'])? $meta['_flattr_btn_disable'] : true; if (($postmeta) && is_feed() && in_array(get_post_type(), $flattr_post_types)) { - $flattr.= ' <p><a href="'. static_flattr_url($post).'" title="Flattr" target="_blank"><img src="'. get_option('flattrss_custom_image_url') .'" alt="flattr this!"/></a></p>'; + + // Determine which button style to use. Default: image-white. + $button_style_pref = get_option('flattr_button_style'); + $button_type = $button_style_pref; + if ($button_type != "image" && $button_type != "image-white") { + $button_type = "image-white"; + } + + $flattr.= '<p><a href="'. static_flattr_url($post) .'">' . Flattr::getStaticImageButton($button_type) . '</a></p>'; + } return ($content.$flattr); } @@ -1031,6 +1079,7 @@ if (get_option('flattrss_autosubmit') && get_option('flattr_access_token')) { /** * prints the Flattr button * Use this from your template + * @param type the button type. See Flattr->getButton for details. */ function the_flattr_permalink() { diff --git a/wp-content/plugins/flattr/img/flattr-badge-white.png b/wp-content/plugins/flattr/img/flattr-badge-white.png new file mode 100644 index 0000000000000000000000000000000000000000..a30904ca13bfd22f52fd48bb2b8b4054dede4557 Binary files /dev/null and b/wp-content/plugins/flattr/img/flattr-badge-white.png differ diff --git a/wp-content/plugins/flattr/img/flattr-badge-white.pxm b/wp-content/plugins/flattr/img/flattr-badge-white.pxm new file mode 100644 index 0000000000000000000000000000000000000000..fa5f615fe5eded02a468cdd6a72b78bed007deba Binary files /dev/null and b/wp-content/plugins/flattr/img/flattr-badge-white.pxm differ diff --git a/wp-content/plugins/flattr/img/flattr-badge-white@2x.png b/wp-content/plugins/flattr/img/flattr-badge-white@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..dc45d1a8c7f033366533c829c2aee863372b95ae Binary files /dev/null and b/wp-content/plugins/flattr/img/flattr-badge-white@2x.png differ diff --git a/wp-content/plugins/flattr/img/flattr-badge-white@3x.png b/wp-content/plugins/flattr/img/flattr-badge-white@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..601d239e4b7c9b8c5fe84c704686dff2d8556e85 Binary files /dev/null and b/wp-content/plugins/flattr/img/flattr-badge-white@3x.png differ diff --git a/wp-content/plugins/flattr/img/flattr-badge-white_full_size.png b/wp-content/plugins/flattr/img/flattr-badge-white_full_size.png new file mode 100644 index 0000000000000000000000000000000000000000..b1b1d98949cd70a64b544f25302984a47c5694a9 Binary files /dev/null and b/wp-content/plugins/flattr/img/flattr-badge-white_full_size.png differ diff --git a/wp-content/plugins/flattr/readme.txt b/wp-content/plugins/flattr/readme.txt index a4e29568cd3882f7a5c45a013f69caff54b3cf25..a795ab13bf42cf39165d10171c81b417e134de4c 100644 --- a/wp-content/plugins/flattr/readme.txt +++ b/wp-content/plugins/flattr/readme.txt @@ -3,8 +3,8 @@ Contributors: aphex3k, VoxPelli Donate link: https://flattr.com/donation/give/to/der_michael Tags: flattr, donate, micropayments Requires at least: 3.3 -Tested up to: 3.4 -Stable tag: 1.2.0 +Tested up to: 4.1.1 +Stable tag: 1.2.1 This plugin allows you to easily add a Flattr donation buttons to your blog and blog posts. @@ -56,6 +56,9 @@ Flattr buttons now detectable by browsers, site itself can now be flattred, a ne == Changelog == += 1.2.1 = +* New Feature: Nicer, modern-looking static buttons for both pages and feed with support for "HiDPI" displays. + = 1.2.0 = * New Feature: The payment links in RSS/Atom can now be added without adding the graphical buttons and are now on by default * New Feature: Payment links are now not only included in feed entries - they are now also by default included in the head-tag of entry pages which is usable for eg. browser extensions to detect the existence of a flattr button. diff --git a/wp-content/plugins/flattr/settings-templates/plugin.php b/wp-content/plugins/flattr/settings-templates/plugin.php index 7149695bb412fe90634bfba835feb2824e133f01..ed53cf3308fb12e8513c6cd9fb27612a105dbf6a 100644 --- a/wp-content/plugins/flattr/settings-templates/plugin.php +++ b/wp-content/plugins/flattr/settings-templates/plugin.php @@ -135,9 +135,14 @@ </a> <span class="description"><label for="flattr_button_style_js"><?php _e('Dynamic javascript version'); ?></label></span> </li> + <li> + <input type="radio" name="flattr_button_style" value="image-white"<?=(get_option('flattr_button_style')=="image-white")?" checked":"";?>/> + <?= Flattr::getStaticImageButton($type='image-white') ?> + <span class="description"><?php _e('Static green-white image with with HiDPI support using srcset.'); ?></span> + </li> <li> <input type="radio" id="flattr_button_style_image" name="flattr_button_style" value="image"<?=(get_option('flattr_button_style')=="image")?" checked":"";?>/> - <img src="<?=get_option('flattrss_custom_image_url');?>"/> + <?= Flattr::getStaticImageButton('image') ?> <span class="description"><label for="flattr_button_style_image"><?php _e('Static image version'); ?></label></span> </li> <li> @@ -169,7 +174,7 @@ Default Value:<br> <input type="text" size="70" value="<?php echo get_bloginfo('wpurl') . '/wp-content/plugins/flattr/img/flattr-badge-large.png';?>" readonly><br /> <?php } ?> - <span class="description"><?php _e('Only applies to the static image button type and the feed buttons.'); ?></span> + <span class="description"><?php _e('Only applies to button on site and in feed if the static (non-white) image type is selected.'); ?></span> </td> </tr> <tr>