diff --git a/README.md b/README.md
index b2eef48..71465c4 100644
--- a/README.md
+++ b/README.md
@@ -82,6 +82,7 @@ Contributors
* Geoffrey Crofte ([WP Media](http://wp-media.me))
* *Contributors*
* Jean-Baptiste Audras ([Whodunit](http://www.whodunit.fr/))
+ * Marie Comet ([Marie Comet](http://mariecomet.fr/))
* *Translators*
* [Dennis Schmitz](http://compcardinmotion.de)
* [半月 Hangetsu](http://wp.fruit-frappe.net/)
diff --git a/admin/jsps-admin.inc.php b/admin/jsps-admin.inc.php
index db0bc3d..b0afab7 100644
--- a/admin/jsps-admin.inc.php
+++ b/admin/jsps-admin.inc.php
@@ -4,7 +4,7 @@
register_activation_hook( JUIZ_SPS_FILE, 'juiz_sps_activation' );
function juiz_sps_activation() {
- $juiz_sps_options = get_option ( JUIZ_SPS_SETTING_NAME );
+ $juiz_sps_options = jsps_get_option();
if ( ! is_array( $juiz_sps_options ) ) {
@@ -46,7 +46,7 @@ function juiz_sps_activation() {
)
);
- update_option( JUIZ_SPS_SETTING_NAME , $default_array );
+ jsps_update_option( $default_array );
}
else {
// if was version under 1.2.3
@@ -56,7 +56,7 @@ function juiz_sps_activation() {
);
$updated_array = array_merge( $juiz_sps_options, $new_options );
- update_option( JUIZ_SPS_SETTING_NAME , $updated_array );
+ jsps_update_option( $updated_array );
}
// if was version under 1.3.0
@@ -65,7 +65,7 @@ function juiz_sps_activation() {
$juiz_sps_options['juiz_sps_networks']['vk'] = array( 0, __( 'VKontakte', 'juiz-social-post-sharer' ) );
$juiz_sps_options['juiz_sps_colors'] = array( 'bg_color' => '', 'txt_color' => ''); // for next update
- update_option( JUIZ_SPS_SETTING_NAME , $juiz_sps_options );
+ jsps_update_option( $juiz_sps_options );
}
// if was version under 1.3.3.7
@@ -73,7 +73,7 @@ function juiz_sps_activation() {
$juiz_sps_options['juiz_sps_counter_option'] = 'both';
- update_option( JUIZ_SPS_SETTING_NAME , $juiz_sps_options );
+ jsps_update_option( $juiz_sps_options );
}
// if was version under 1.4.1
@@ -84,7 +84,7 @@ function juiz_sps_activation() {
$juiz_sps_options['juiz_sps_networks']['delicious'] = array( 0, __( 'Delicious', 'juiz-social-post-sharer' ) );
$juiz_sps_options['juiz_sps_networks']['reddit'] = array( 0, __( 'Reddit', 'juiz-social-post-sharer' ) );
- update_option( JUIZ_SPS_SETTING_NAME , $juiz_sps_options );
+ jsps_update_option( $juiz_sps_options );
}
// if was version under 1.4.2
@@ -94,7 +94,7 @@ function juiz_sps_activation() {
$juiz_sps_options['juiz_sps_networks']['bookmark'] = array( 0, __( 'Bookmark', 'juiz-social-post-sharer' ) );
$juiz_sps_options['juiz_sps_networks']['print'] = array( 0, __( 'Print', 'juiz-social-post-sharer' ) );
- update_option( JUIZ_SPS_SETTING_NAME , $juiz_sps_options );
+ jsps_update_option( $juiz_sps_options );
}
}
}
@@ -145,7 +145,7 @@ function juiz_sps_custom_admin_header() {
add_action( 'add_meta_boxes', 'juiz_sps_metaboxes' );
function juiz_sps_metaboxes(){
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
$pts = get_post_types( array( 'public'=> true, 'show_ui' => true, '_builtin' => true ) );
$cpts = get_post_types( array( 'public'=> true, 'show_ui' => true, '_builtin' => false ) );
@@ -227,7 +227,7 @@ function juiz_sps_sanitize( $options ) {
if ( is_array( $options['juiz_sps_networks'] ) ) {
$temp_array = array( 'facebook' => 0, 'twitter' => 0, 'google' => 0, 'pinterest' => 0, 'viadeo' => 0, 'linkedin' => 0, 'digg' => 0, 'stumbleupon' => 0, 'weibo' => 0, 'mail' => 0, 'vk' => 0 );
- $juiz_sps_opt = get_option ( JUIZ_SPS_SETTING_NAME );
+ $juiz_sps_opt = jsps_get_option();
// new option (1.2.0)
if ( ! in_array( 'weibo', $juiz_sps_opt['juiz_sps_networks'] ) ) {
@@ -302,7 +302,7 @@ function juiz_sps_section_text() {
if ( ! function_exists( 'juiz_sps_setting_radio_style_choice' ) ) {
function juiz_sps_setting_radio_style_choice() {
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( is_array( $options ) ) {
$n1 = $n2 = $n3 = $n4 = $n5 = $n6 = $n7 = $n8 = '';
${'n' . $options['juiz_sps_style']} = ' checked="checked"';
@@ -348,7 +348,7 @@ function juiz_sps_setting_radio_style_choice() {
if ( ! function_exists( 'juiz_sps_setting_checkbox_network_selection' ) ) {
function juiz_sps_setting_checkbox_network_selection() {
$y = $n = '';
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( is_array( $options ) ) {
foreach ( $options['juiz_sps_networks'] as $k => $v ) {
@@ -370,7 +370,7 @@ function juiz_sps_setting_checkbox_network_selection() {
// input for twitter username
if ( ! function_exists( 'juiz_sps_setting_input_twitter_user' ) ) {
function juiz_sps_setting_input_twitter_user() {
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( is_array( $options ) ) {
$username = isset( $options['juiz_sps_twitter_user'] ) ? $options['juiz_sps_twitter_user'] : '';
echo '
@@ -392,7 +392,7 @@ function juiz_sps_section_text_display() {
function juiz_sps_setting_checkbox_content_type() {
$pts = get_post_types( array( 'public'=> true, 'show_ui' => true, '_builtin' => true ) );
$cpts = get_post_types( array( 'public'=> true, 'show_ui' => true, '_builtin' => false ) );
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
$all_lists_icon = '';
$all_lists_selected = '';
if ( is_array( $options['juiz_sps_display_in_types'] ) ) {
@@ -452,7 +452,7 @@ function juiz_sps_setting_checkbox_content_type() {
if ( ! function_exists( 'juiz_sps_setting_radio_where' ) ) {
function juiz_sps_setting_radio_where() {
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
$w_bottom = $w_top = $w_both = $w_nowhere = '';
if ( is_array( $options ) && isset( $options['juiz_sps_display_where'] ) )
@@ -487,7 +487,7 @@ function juiz_sps_section_text_advanced() {
if ( ! function_exists( 'juiz_sps_setting_radio_hide_social_name' ) ) {
function juiz_sps_setting_radio_hide_social_name() {
$y = $n = '';
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( is_array( $options ) )
( isset( $options['juiz_sps_hide_social_name'] ) && $options['juiz_sps_hide_social_name'] == 1 ) ? $y = ' checked="checked"' : $n = ' checked="checked"';
@@ -506,7 +506,7 @@ function juiz_sps_setting_radio_hide_social_name() {
if ( ! function_exists( 'juiz_sps_setting_radio_target_link' ) ) {
function juiz_sps_setting_radio_target_link() {
$y = $n = '';
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( is_array( $options ) )
( isset( $options['juiz_sps_target_link'] ) && $options['juiz_sps_target_link'] == 1 ) ? $y = ' checked="checked"' : $n = ' checked="checked"';
@@ -523,7 +523,7 @@ function juiz_sps_setting_radio_target_link() {
if ( ! function_exists( 'juiz_sps_setting_radio_force_snif' ) ) {
function juiz_sps_setting_radio_force_snif() {
$y = $n = '';
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( is_array( $options ) )
( isset( $options['juiz_sps_force_pinterest_snif'] ) && $options['juiz_sps_force_pinterest_snif'] == 1 ) ? $y = ' checked="checked"' : $n = ' checked="checked"';
@@ -541,7 +541,7 @@ function juiz_sps_setting_radio_force_snif() {
function juiz_sps_setting_radio_counter() {
$y = $n = '';
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( is_array( $options ) )
( isset( $options['juiz_sps_counter'] ) && $options['juiz_sps_counter'] == 1 ) ? $y = ' checked="checked"' : $n = ' checked="checked"';
@@ -558,7 +558,7 @@ function juiz_sps_setting_radio_counter() {
if ( ! function_exists( 'juiz_sps_setting_radio_counter_option' ) ) {
function juiz_sps_setting_radio_counter_option() {
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( is_array( $options ) ) {
$both = ( isset( $options['juiz_sps_counter_option'] ) && $options['juiz_sps_counter_option'] == 'both' ) ? ' checked="checked"' : '';
$total = ( isset( $options['juiz_sps_counter_option'] ) && $options['juiz_sps_counter_option'] == 'total' ) ? ' checked="checked"' : '';
@@ -586,7 +586,7 @@ function juiz_sps_setting_radio_counter_option() {
if ( ! function_exists( 'juiz_sps_setting_radio_css_in_html' ) ) {
function juiz_sps_setting_radio_css_in_html() {
$y = $n = '';
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( is_array( $options ) )
( isset( $options['juiz_sps_write_css_in_html'] ) && $options['juiz_sps_write_css_in_html'] == 1 ) ? $y = ' checked="checked"' : $n = ' checked="checked"';
@@ -610,7 +610,7 @@ function juiz_sps_section_text_mail() {
}
if ( ! function_exists( 'juiz_sps_setting_input_mail_subject' ) ) {
function juiz_sps_setting_input_mail_subject() {
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( isset( $options['juiz_sps_mail_subject'] ) ) {
echo '';
}
@@ -618,7 +618,7 @@ function juiz_sps_setting_input_mail_subject() {
}
if ( ! function_exists( 'juiz_sps_setting_textarea_mail_body' ) ) {
function juiz_sps_setting_textarea_mail_body() {
- $options = get_option( JUIZ_SPS_SETTING_NAME );
+ $options = jsps_get_option();
if ( isset( $options['juiz_sps_mail_body'] ) ) {
echo '';
}
diff --git a/juiz-social-post-sharer.php b/juiz-social-post-sharer.php
index 61e7cfe..53db248 100644
--- a/juiz-social-post-sharer.php
+++ b/juiz-social-post-sharer.php
@@ -4,7 +4,7 @@
Plugin URI: http://wordpress.org/extend/plugins/juiz-social-post-sharer/
Description: Add buttons after (or before, or both) your posts to allow visitors share your content (includes no JavaScript mode). You can also use juiz_sps($array)
template function or [juiz_sps]
shortcode. For more informations see the setting page located in Settings submenu.
Author: Geoffrey Crofte
-Version: 1.4.6
+Version: 1.4.7
Author URI: http://geoffrey.crofte.fr
License: GPLv2 or later
Text Domain: juiz-social-post-sharer
@@ -12,7 +12,7 @@
-Copyright 2012-2015 Geoffrey Crofte (email : support@creativejuiz.com)
+Copyright 2012-2017 Geoffrey Crofte (email : support@creativejuiz.com)
This program is free software; you can redistribute it and/or
@@ -32,21 +32,83 @@
*/
define( 'JUIZ_SPS_PLUGIN_NAME', 'Juiz Social Post Sharer' );
-define( 'JUIZ_SPS_VERSION', '1.4.6' );
+define( 'JUIZ_SPS_VERSION', '1.4.7' );
define( 'JUIZ_SPS_FILE', __FILE__ );
define( 'JUIZ_SPS_DIRNAME', basename( dirname( __FILE__ ) ) );
define( 'JUIZ_SPS_PLUGIN_URL', plugin_dir_url( __FILE__ ));
define( 'JUIZ_SPS_SLUG', 'juiz-social-post-sharer' );
define( 'JUIZ_SPS_SETTING_NAME', 'juiz_SPS_settings' );
-
-// multilingue
+// Checking network activation.
+$is_nw_activated = function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( JUIZ_SPS_SLUG . '/' . JUIZ_SPS_SLUG . '.php' ) ? true : false;
+
+define( 'JUIZ_SPS_NETWORK_ACTIVATED', $is_nw_activated );
+
+// Multilingal.
add_action( 'init', 'make_juiz_sps_multilang' );
function make_juiz_sps_multilang() {
load_plugin_textdomain( 'juiz-social-post-sharer', false, JUIZ_SPS_DIRNAME.'/languages' );
}
+/**
+ * Getting options from the right place.
+ * Multisite compatibility.
+ *
+ * @author Marie Comet, Geoffrey Crofte
+ * @since 1.4.7
+ */
+function jsps_get_option( $option_name = '' ) {
+
+ // When we want a precise option in a network activated website.
+ if ( ! empty( $option_name ) && true === JUIZ_SPS_NETWORK_ACTIVATED ) {
+ $options = get_blog_option( get_current_blog_id(), JUIZ_SPS_SETTING_NAME );
+ return $options[ $option_name ];
+ }
+
+ // When we want all options in a network activated website.
+ else if ( empty( $option_name ) && true === JUIZ_SPS_NETWORK_ACTIVATED ) {
+ return get_blog_option( get_current_blog_id(), JUIZ_SPS_SETTING_NAME );
+ }
+
+ // When we want a precise option in a simple website.
+ else if ( ! empty( $option_name ) && false === JUIZ_SPS_NETWORK_ACTIVATED ) {
+ $options = get_option( JUIZ_SPS_SETTING_NAME );
+ return $options[ $option_name ];
+ }
+
+ // When we want all options in a simple website.
+ else {
+ return get_option( JUIZ_SPS_SETTING_NAME );
+ }
+
+}
+
+/**
+ * Updating options to the right place.
+ * Multisite compatibility.
+ *
+ * @author Marie Comet, Geoffrey Crofte
+ * @since 1.4.7
+ */
+function jsps_update_option( $options ) {
+
+ if ( ! is_array( $options ) ) {
+ die( '$options has to be an array' );
+ }
+
+ // When we want to update options in a network activated website.
+ if ( true === JUIZ_SPS_NETWORK_ACTIVATED ) {
+ $options = update_blog_option( get_current_blog_id(), JUIZ_SPS_SETTING_NAME, $options );
+ return $options;
+ }
+
+ // When we want to update options in a simple website.
+ else {
+ $options = update_option( JUIZ_SPS_SETTING_NAME, $options );
+ }
+}
+
if ( is_admin() || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) {
include('admin/jsps-admin.inc.php');
@@ -62,7 +124,7 @@ function make_juiz_sps_multilang() {
function juiz_sps_style_and_script() {
- $juiz_sps_options = get_option( JUIZ_SPS_SETTING_NAME );
+ $juiz_sps_options = jsps_get_option();
if ( is_array( $juiz_sps_options ) ) {
@@ -173,7 +235,7 @@ function get_juiz_sps( $networks = array(), $counters = 0, $is_current_page_url
// get the plugin options
- $juiz_sps_options = get_option( JUIZ_SPS_SETTING_NAME );
+ $juiz_sps_options = jsps_get_option();
// classes and attributes options
$juiz_sps_target_link = ( isset( $juiz_sps_options['juiz_sps_target_link'] ) && $juiz_sps_options['juiz_sps_target_link'] == 1 ) ? ' target="_blank"' : '';
@@ -374,7 +436,7 @@ function juiz_sps( $networks = array(), $counters = 0, $current_page = 0, $is_sh
if ( ! function_exists( 'juiz_sps_print_links' ) ) {
function juiz_sps_print_links( $content ) {
- $juiz_sps_options = get_option( JUIZ_SPS_SETTING_NAME );
+ $juiz_sps_options = jsps_get_option();
if ( isset( $juiz_sps_options['juiz_sps_display_in_types'] ) ) {
diff --git a/readme.txt b/readme.txt
index 2a2d88f..5eeb8d9 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,8 +3,8 @@ Contributors: CreativeJuiz
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P39NJPCWVXGDY&lc=FR&item_name=Juiz%20Social%20Post%20Sharer%20%2d%20WP%20Plugin&item_number=%23wp%2djsps¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
Tags: social, twitter, google, facebook, digg, stumbleupon, linkedin, pinterest, viadeo, weibo, vkontakte, post, share
Requires at least: 3.3
-Tested up to: 4.6
-Stable tag: 1.4.6
+Tested up to: 4.7.4
+Stable tag: 1.4.7
Add smart designed buttons after/before your posts to allow visitors sharing your content (includes no JavaScript mode & counters)
@@ -144,6 +144,9 @@ Find my plugins at http://
== Changelog ==
+= 1.4.7 =
+* Compatibility on network (multisite) thanks to Marie Comet ([Marie Comet](http://mariecomet.fr/))
+
= 1.4.6 =
* Tested up to WordPress 4.6
* Facebook counter is back thanks to Jean-Baptiste (from [Whodunit](http://www.whodunit.fr/))
diff --git a/uninstall.php b/uninstall.php
index 9bc1c37..cfa011c 100644
--- a/uninstall.php
+++ b/uninstall.php
@@ -3,4 +3,5 @@
exit();
}
-delete_option( 'juiz_SPS_settings' );
\ No newline at end of file
+delete_option( 'juiz_SPS_settings' );
+delete_site_option( 'juiz_SPS_settings' );
\ No newline at end of file