33 * Plugin Name: Shariff for Wordpress
44 * Plugin URI: http://www.heise.de/newsticker/meldung/c-t-entwickelt-datenschutzfreundliche-Social-Media-Buttons-weiter-2466687.html
55 * Description: Shariff enables website users to share their favorite content without compromising their privacy.
6- * Version: 1.0.1
6+ * Version: 1.0.2
77 * Author: Heise Zeitschriften Verlag / Yannik Ehlert
88 * Author URI: http://www.heise.de
99 * Text Domain: shariff
@@ -58,38 +58,45 @@ function shariffsharing($content) {
5858 if (get_option ('shariff_beforeafter ' ,'before ' ) != 'before ' ) {
5959 $ content2 = $ content ;
6060 }
61- $ content2 .= '<div class="shariff" data-backend-url=" ' .plugins_url ( 'backend/index.php ' , __FILE__ ).'" data-ttl=" ' .get_option ('shariff_ttl ' ,"30 " ).'" data-service=" ' .$ serv .'" data-services= \'' .$ services .'\' data-url=" ' .get_permalink ().'" data-lang=" ' .__ ('en ' , 'shariff ' ).'" data-theme=" ' .get_option ('shariff_color ' ,"colored " ).'" data-orientation=" ' .get_option ('shariff_orientation ' ,"horizontal " ).'"></div> ' ;
61+ if (!((strpos ($ content ,'hideshariff ' ) !== false ) && (strpos ($ content ,'/hideshariff ' ) == false ))) {
62+ $ content2 .= '<div class="shariff" data-backend-url=" ' .plugins_url ( 'backend/index.php ' , __FILE__ ).'" data-ttl=" ' .get_option ('shariff_ttl ' ,"30 " ).'" data-service=" ' .$ serv .'" data-services= \'' .$ services .'\' data-url=" ' .get_permalink ().'" data-lang=" ' .__ ('en ' , 'shariff ' ).'" data-theme=" ' .get_option ('shariff_color ' ,"colored " ).'" data-orientation=" ' .get_option ('shariff_orientation ' ,"horizontal " ).'"></div> ' ;
63+ }
6264 if (get_option ('shariff_beforeafter ' ,'before ' ) != 'after ' ) {
6365 $ content2 .= $ content ;
6466 }
67+ if ((strpos ($ content ,'/hideshariff ' ) !== false )) {
68+ $ content2 = str_replace ("/hideshariff " ,"hideshariff " ,$ content2 );
69+ } else {
70+ $ content2 = str_replace ("hideshariff " ,"" ,$ content2 );
71+ }
6572 return $ content2 ;
6673
6774}
6875function setting_plat_callback () {
6976}
7077function init_settings () {
71- add_settings_section ('shariff_platforms ' ,__ ('Shariff platforms ' ,"shariff " ),'setting_plat_callback ' ,'general ' );
72- add_settings_field ('shariff_gplus ' ,'Google+ ' ,'setting_gplus_callback ' ,'general ' ,'shariff_platforms ' );
73- add_settings_field ('shariff_fb ' ,'Facebook ' ,'setting_fb_callback ' ,'general ' ,'shariff_platforms ' );
74- add_settings_field ('shariff_twitter ' ,'Twitter ' ,'setting_twitter_callback ' ,'general ' ,'shariff_platforms ' );
75- add_settings_field ('shariff_whatsapp ' ,'WhatsApp ' ,'setting_whatsapp_callback ' ,'general ' ,'shariff_platforms ' );
76- add_settings_field ('shariff_email ' ,'E-Mail ' ,'setting_email_callback ' ,'general ' ,'shariff_platforms ' );
77- add_settings_section ('shariff_other ' ,__ ('Other Shariff settings ' ,"shariff " ),'setting_plat_callback ' ,'general ' );
78- add_settings_field ('shariff_info ' ,__ ('Privacy information ' ,"shariff " ),'setting_info_callback ' ,'general ' ,'shariff_other ' );
79- add_settings_field ('shariff_color ' ,__ ('Color ' ,"shariff " ),'setting_color_callback ' ,'general ' ,'shariff_other ' );
80- add_settings_field ('shariff_orientation ' ,__ ('Orientation ' ,"shariff " ),'setting_orientation_callback ' ,'general ' ,'shariff_other ' );
81- add_settings_field ('shariff_beforeafter ' ,__ ('Button location ' ,"shariff " ),'setting_before_callback ' ,'general ' ,'shariff_other ' );
82- add_settings_field ('shariff_ttl ' ,'TTL ' ,'setting_ttl_callback ' ,'general ' ,'shariff_other ' );
83- register_setting ('general ' ,'shariff_gplus ' );
84- register_setting ('general ' ,'shariff_fb ' );
85- register_setting ('general ' ,'shariff_twitter ' );
86- register_setting ('general ' ,'shariff_whatsapp ' );
87- register_setting ('general ' ,'shariff_email ' );
88- register_setting ('general ' ,'shariff_info ' );
89- register_setting ('general ' ,'shariff_color ' );
90- register_setting ('general ' ,'shariff_orientation ' );
91- register_setting ('general ' ,'shariff_beforeafter ' );
92- register_setting ('general ' ,'shariff_ttl ' );
78+ add_settings_section ('shariff_platforms ' ,__ ('Shariff platforms ' ,"shariff " ),'setting_plat_callback ' ,'shariff ' );
79+ add_settings_field ('shariff_gplus ' ,'Google+ ' ,'setting_gplus_callback ' ,'shariff ' ,'shariff_platforms ' );
80+ add_settings_field ('shariff_fb ' ,'Facebook ' ,'setting_fb_callback ' ,'shariff ' ,'shariff_platforms ' );
81+ add_settings_field ('shariff_twitter ' ,'Twitter ' ,'setting_twitter_callback ' ,'shariff ' ,'shariff_platforms ' );
82+ add_settings_field ('shariff_whatsapp ' ,'WhatsApp ' ,'setting_whatsapp_callback ' ,'shariff ' ,'shariff_platforms ' );
83+ add_settings_field ('shariff_email ' ,'E-Mail ' ,'setting_email_callback ' ,'shariff ' ,'shariff_platforms ' );
84+ add_settings_section ('shariff_other ' ,__ ('Other Shariff settings ' ,"shariff " ),'setting_plat_callback ' ,'shariff ' );
85+ add_settings_field ('shariff_info ' ,__ ('Privacy information ' ,"shariff " ),'setting_info_callback ' ,'shariff ' ,'shariff_other ' );
86+ add_settings_field ('shariff_color ' ,__ ('Color ' ,"shariff " ),'setting_color_callback ' ,'shariff ' ,'shariff_other ' );
87+ add_settings_field ('shariff_orientation ' ,__ ('Orientation ' ,"shariff " ),'setting_orientation_callback ' ,'shariff ' ,'shariff_other ' );
88+ add_settings_field ('shariff_beforeafter ' ,__ ('Button location ' ,"shariff " ),'setting_before_callback ' ,'shariff ' ,'shariff_other ' );
89+ add_settings_field ('shariff_ttl ' ,'TTL ' ,'setting_ttl_callback ' ,'shariff ' ,'shariff_other ' );
90+ register_setting ('shariff ' ,'shariff_gplus ' );
91+ register_setting ('shariff ' ,'shariff_fb ' );
92+ register_setting ('shariff ' ,'shariff_twitter ' );
93+ register_setting ('shariff ' ,'shariff_whatsapp ' );
94+ register_setting ('shariff ' ,'shariff_email ' );
95+ register_setting ('shariff ' ,'shariff_info ' );
96+ register_setting ('shariff ' ,'shariff_color ' );
97+ register_setting ('shariff ' ,'shariff_orientation ' );
98+ register_setting ('shariff ' ,'shariff_beforeafter ' );
99+ register_setting ('shariff ' ,'shariff_ttl ' );
93100}
94101function setting_before_callback () {
95102 echo '<select name="shariff_beforeafter">
@@ -151,8 +158,24 @@ function setting_color_callback() {
151158function loadjs () {
152159 echo '<script src=" ' .plugins_url ( 'dep/shariff.min.js ' , __FILE__ ).'"></script> ' ."\n" ;
153160}
161+ function shariff_options_page () {
162+ ?>
163+ <div class="wrap">
164+ <h2><?php echo _e ("Shariff configuration " ,"shariff " )?> </h2>
165+ <form action="options.php" method="POST">
166+ <?php settings_fields ( 'shariff ' ); ?>
167+ <?php do_settings_sections ( 'shariff ' ); ?>
168+ <?php submit_button (); ?>
169+ </form>
170+ </div>
171+ <?php
172+ }
173+ function shariffconfigmenu () {
174+ add_options_page ('shariff ' , 'Shariff ' , 'manage_options ' , 'shariff ' , 'shariff_options_page ' );
175+ }
176+ add_action ('admin_menu ' ,'shariffconfigmenu ' );
154177add_action ('admin_init ' ,'init_settings ' );
155178add_action ('init ' ,'init_locale ' );
156179add_action ('wp_enqueue_scripts ' , 'loadshariff ' );
157180add_action ('wp_footer ' ,'loadjs ' );
158- add_filter ('the_content ' ,'shariffsharing ' );
181+ add_filter ('the_content ' ,'shariffsharing ' );
0 commit comments