Shariff Wrapper - Version 4.1.1

Version Description

  • new option to disable the Shariff buttons outside of the main loop
  • fix Facebook App ID request
  • minor css fix
Download this release

Release Info

Developer starguide
Plugin Icon 128x128 Shariff Wrapper
Version 4.1.1
Comparing to
See all releases

Code changes from version 4.1.0 to 4.1.1

Files changed (3) hide show
  1. admin/admin_menu.php +12 -0
  2. readme.txt +6 -1
  3. shariff.php +11 -12
admin/admin_menu.php CHANGED
@@ -60,6 +60,10 @@ function shariff3UU_options_init(){
60
  add_settings_field( 'shariff3UU_checkbox_disable_on_protected', __( 'Disable the Shariff buttons on password protected posts.', 'shariff' ),
61
  'shariff3UU_checkbox_disable_on_protected_render', 'basic', 'shariff3UU_basic_section' );
62
 
 
 
 
 
63
  // second tab - design
64
 
65
  // register second tab (design) settings and call sanitize function
@@ -304,6 +308,7 @@ function shariff3UU_basic_sanitize( $input ) {
304
  if ( isset( $input["add_after"] ) ) $valid["add_after"] = sani_arrays( $input["add_after"] );
305
  if ( isset( $input["add_before"] ) ) $valid["add_before"] = sani_arrays( $input["add_before"] );
306
  if ( isset( $input["disable_on_protected"] ) ) $valid["disable_on_protected"] = absint( $input["disable_on_protected"] );
 
307
 
308
  // remove empty elements
309
  $valid = array_filter( $valid );
@@ -517,6 +522,13 @@ function shariff3UU_checkbox_disable_on_protected_render() {
517
  echo ' value="1">';
518
  }
519
 
 
 
 
 
 
 
 
520
  // design options
521
 
522
  // description design options
60
  add_settings_field( 'shariff3UU_checkbox_disable_on_protected', __( 'Disable the Shariff buttons on password protected posts.', 'shariff' ),
61
  'shariff3UU_checkbox_disable_on_protected_render', 'basic', 'shariff3UU_basic_section' );
62
 
63
+ // disable outside of loop
64
+ add_settings_field( 'shariff3UU_checkbox_disable_outside_loop', __( 'Disable the Shariff buttons outside of the main loop.', 'shariff' ),
65
+ 'shariff3UU_checkbox_disable_outside_loop_render', 'basic', 'shariff3UU_basic_section' );
66
+
67
  // second tab - design
68
 
69
  // register second tab (design) settings and call sanitize function
308
  if ( isset( $input["add_after"] ) ) $valid["add_after"] = sani_arrays( $input["add_after"] );
309
  if ( isset( $input["add_before"] ) ) $valid["add_before"] = sani_arrays( $input["add_before"] );
310
  if ( isset( $input["disable_on_protected"] ) ) $valid["disable_on_protected"] = absint( $input["disable_on_protected"] );
311
+ if ( isset( $input["disable_outside_loop"] ) ) $valid["disable_outside_loop"] = absint( $input["disable_outside_loop"] );
312
 
313
  // remove empty elements
314
  $valid = array_filter( $valid );
522
  echo ' value="1">';
523
  }
524
 
525
+ // disable outside loop
526
+ function shariff3UU_checkbox_disable_outside_loop_render() {
527
+ echo '<input type="checkbox" name="shariff3UU_basic[disable_outside_loop]" ';
528
+ if ( isset( $GLOBALS["shariff3UU_basic"]["disable_outside_loop"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["disable_outside_loop"], 1, 0 );
529
+ echo ' value="1">';
530
+ }
531
+
532
  // design options
533
 
534
  // description design options
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: 3UU, starguide
3
  Tags: Shariff, Facebook, Twitter, VKontakte, VK, GooglePlus, WhatsApp, share buttons, sharing, privacy, social
4
  Requires at least: 4.4
5
  Tested up to: 4.5
6
- Stable tag: 4.1.0
7
  License: MIT
8
  License URI: http://opensource.org/licenses/MIT
9
  Donate link: http://folge.link/?bitcoin=1Ritz1iUaLaxuYcXhUCoFhkVRH6GWiMTP
@@ -172,6 +172,11 @@ fixed in the future - if we have time to spend or you provide us with a lot of "
172
 
173
  == Changelog ==
174
 
 
 
 
 
 
175
  = 4.1.0 =
176
  - new design option to set a custom button color for all buttons
177
  - new design option to set a border radius for the round theme (up to a square)
3
  Tags: Shariff, Facebook, Twitter, VKontakte, VK, GooglePlus, WhatsApp, share buttons, sharing, privacy, social
4
  Requires at least: 4.4
5
  Tested up to: 4.5
6
+ Stable tag: 4.1.1
7
  License: MIT
8
  License URI: http://opensource.org/licenses/MIT
9
  Donate link: http://folge.link/?bitcoin=1Ritz1iUaLaxuYcXhUCoFhkVRH6GWiMTP
172
 
173
  == Changelog ==
174
 
175
+ = 4.1.1 =
176
+ - new option to disable the Shariff buttons outside of the main loop
177
+ - fix Facebook App ID request
178
+ - minor css fix
179
+
180
  = 4.1.0 =
181
  - new design option to set a custom button color for all buttons
182
  - new design option to set a border radius for the round theme (up to a square)
shariff.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Shariff Wrapper
4
  * Plugin URI: https://de.wordpress.org/plugins/shariff/
5
  * Description: The Shariff Wrapper provides share buttons that respect the privacy of your visitors and are compliant to the German data protection laws.
6
- * Version: 4.1.0
7
  * Author: Jan-Peter Lambeck & 3UU
8
  * Author URI: https://de.wordpress.org/plugins/shariff/
9
  * License: MIT
@@ -26,7 +26,7 @@ $shariff3UU = array_merge( $shariff3UU_basic, $shariff3UU_design, $shariff3UU_ad
26
  // update function to perform tasks _once_ after an update, based on version number to work for automatic as well as manual updates
27
  function shariff3UU_update() {
28
  /******************** ADJUST VERSION ********************/
29
- $code_version = "4.1.0"; // set code version - needs to be adjusted for every new version!
30
  /******************** ADJUST VERSION ********************/
31
 
32
  // get options
@@ -253,6 +253,9 @@ function shariff3UU_fetch_sharecounts( $service_array, $old_share_counts, $post_
253
  // we only need the backend part from the service phps
254
  $backend = '1';
255
 
 
 
 
256
  // prevent php notices
257
  $total_count = '0';
258
  $share_counts = array();
@@ -363,12 +366,6 @@ function shariff3UU_fill_cache_schedule() {
363
  }
364
  add_action( 'shariff3UU_save_statistic_options', 'shariff3UU_fill_cache_schedule' );
365
 
366
- add_filter( 'http_request_timeout', 'wp_smushit_filter_timeout_time');
367
- function wp_smushit_filter_timeout_time($time) {
368
- $time = 25; //new number of seconds
369
- return $time;
370
- }
371
-
372
  // custom weekly cron recurrences
373
  function shariff3UU_fill_cache_schedule_custom_recurrence( $schedules ) {
374
  $schedules['weekly'] = array(
@@ -382,12 +379,14 @@ add_filter( 'cron_schedules', 'shariff3UU_fill_cache_schedule_custom_recurrence'
382
  // add shorttag to posts
383
  function shariff3UU_posts( $content ) {
384
 
385
- // do not add Shariff to excerpts
386
- if ( in_array( 'get_the_excerpt', $GLOBALS['wp_current_filter'] ) ) return $content;
387
-
388
  // get options
389
  $shariff3UU = $GLOBALS["shariff3UU"];
390
 
 
 
 
 
 
391
  // disable share buttons on password protected posts if configured in the admin menu
392
  if ( ( post_password_required( get_the_ID() ) == '1' || ! empty( $GLOBALS["post"]->post_password ) ) && isset( $shariff3UU["disable_on_protected"] ) && $shariff3UU["disable_on_protected"] == '1') {
393
  $shariff3UU["add_before"]["posts"] = '0';
@@ -623,7 +622,7 @@ function shariff3UU_render( $atts, $content = null ) {
623
  // add information for share count request
624
  if ( array_key_exists( 'backend', $atts ) && $atts['backend'] == "on" ) {
625
  // share url
626
- $output .= ' data-url="' . esc_url( urlencode( $share_url ) ) . '"';
627
  // timestamp for cache
628
  $output .= ' data-timestamp="' . absint( get_the_modified_date( 'U', true ) ) . '"';
629
  // add external api if entered
3
  * Plugin Name: Shariff Wrapper
4
  * Plugin URI: https://de.wordpress.org/plugins/shariff/
5
  * Description: The Shariff Wrapper provides share buttons that respect the privacy of your visitors and are compliant to the German data protection laws.
6
+ * Version: 4.1.1
7
  * Author: Jan-Peter Lambeck & 3UU
8
  * Author URI: https://de.wordpress.org/plugins/shariff/
9
  * License: MIT
26
  // update function to perform tasks _once_ after an update, based on version number to work for automatic as well as manual updates
27
  function shariff3UU_update() {
28
  /******************** ADJUST VERSION ********************/
29
+ $code_version = "4.1.1"; // set code version - needs to be adjusted for every new version!
30
  /******************** ADJUST VERSION ********************/
31
 
32
  // get options
253
  // we only need the backend part from the service phps
254
  $backend = '1';
255
 
256
+ // get options
257
+ $shariff3UU = $GLOBALS["shariff3UU"];
258
+
259
  // prevent php notices
260
  $total_count = '0';
261
  $share_counts = array();
366
  }
367
  add_action( 'shariff3UU_save_statistic_options', 'shariff3UU_fill_cache_schedule' );
368
 
 
 
 
 
 
 
369
  // custom weekly cron recurrences
370
  function shariff3UU_fill_cache_schedule_custom_recurrence( $schedules ) {
371
  $schedules['weekly'] = array(
379
  // add shorttag to posts
380
  function shariff3UU_posts( $content ) {
381
 
 
 
 
382
  // get options
383
  $shariff3UU = $GLOBALS["shariff3UU"];
384
 
385
+ // do not add Shariff to excerpts or outside the loop, if option is checked
386
+ if ( in_array( 'get_the_excerpt', $GLOBALS['wp_current_filter'] ) || ( ! in_the_loop() && isset( $shariff3UU["disable_outside_loop"] ) && $shariff3UU["disable_outside_loop"] == '1' ) ) {
387
+ return $content;
388
+ }
389
+
390
  // disable share buttons on password protected posts if configured in the admin menu
391
  if ( ( post_password_required( get_the_ID() ) == '1' || ! empty( $GLOBALS["post"]->post_password ) ) && isset( $shariff3UU["disable_on_protected"] ) && $shariff3UU["disable_on_protected"] == '1') {
392
  $shariff3UU["add_before"]["posts"] = '0';
622
  // add information for share count request
623
  if ( array_key_exists( 'backend', $atts ) && $atts['backend'] == "on" ) {
624
  // share url
625
+ $output .= ' data-url="' . esc_html( urlencode( $share_url ) ) . '"';
626
  // timestamp for cache
627
  $output .= ' data-timestamp="' . absint( get_the_modified_date( 'U', true ) ) . '"';
628
  // add external api if entered