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.4
6+ * Version: 1.0.5
77 * Author: Heise Zeitschriften Verlag / Yannik Ehlert
88 * Author URI: http://www.heise.de
99 * Text Domain: shariff
@@ -44,6 +44,18 @@ function shariffsharing($content) {
4444 }
4545 $ services = $ services .'"linkedin" ' ;
4646 }
47+ if (get_option ('shariff_pinterest ' ,false ) == true ) {
48+ if ($ services != "[ " ) {
49+ $ services = $ services .", " ;
50+ }
51+ $ services = $ services .'"pinterest" ' ;
52+ }
53+ if (get_option ('shariff_xing ' ,false ) == true ) {
54+ if ($ services != "[ " ) {
55+ $ services = $ services .", " ;
56+ }
57+ $ services = $ services .'"xing" ' ;
58+ }
4759 if (get_option ('shariff_whatsapp ' ,false ) == true ) {
4860 if ($ services != "[ " ) {
4961 $ services = $ services .", " ;
@@ -66,8 +78,25 @@ function shariffsharing($content) {
6678 if (get_option ('shariff_beforeafter ' ,'before ' ) != 'before ' ) {
6779 $ content2 = $ content ;
6880 }
81+ if (get_option ('shariff_image ' ,'leer ' ) != 'leer ' ) {
82+ if (strpos ($ content ,'<img ' ) !== false ) {
83+ $ imgurls = explode ("\"" ,explode ("> " ,strstr ($ content ,"<img " ))[0 ]);
84+ $ int = 0 ;
85+ foreach ($ imgurls as $ imgurl ) {
86+ $ int = $ int + 1 ;
87+ if (strpos ($ imgurl ,"src " ) !== false ) {
88+ if (!(strpos ($ imgurls [$ int ],"http " ) !== false )) {
89+ $ image = get_site_url ()."/ " ;
90+ }
91+ $ image .= $ imgurls [$ int ];
92+ }
93+ }
94+ } else {
95+ $ image = get_option ('shariff_image ' ,'' );
96+ }
97+ }
6998 if (!((strpos ($ content ,'hideshariff ' ) !== false ) && (strpos ($ content ,'/hideshariff ' ) == false )) && !(get_post_meta ($ post ->ID , 'shariff_enabled ' , true ))) {
70- $ content2 .= '<div class="shariff" data-backend-url=" ' .plugins_url ( 'backend/index.php ' , __FILE__ ).'" data-ttl=" ' .get_option ('shariff_ttl ' ,"60 " ).'" 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> ' ;
99+ $ content2 .= '<div class="shariff" data-backend-url=" ' .plugins_url ( 'backend/index.php ' , __FILE__ ).'" data-ttl=" ' .get_option ('shariff_ttl ' ,"60 " ).'" data-service=" ' .$ serv .'" data-services= \'' .$ services .'\' data-image=" ' . $ image . ' " data- url=" ' .get_permalink ().'" data-lang=" ' .__ ('en ' , 'shariff ' ).'" data-theme=" ' .get_option ('shariff_color ' ,"colored " ).'" data-orientation=" ' .get_option ('shariff_orientation ' ,"horizontal " ).'"></div> ' ;
71100 }
72101 if (get_option ('shariff_beforeafter ' ,'before ' ) != 'after ' ) {
73102 $ content2 .= $ content ;
@@ -88,10 +117,13 @@ function init_settings() {
88117 add_settings_field ('shariff_fb ' ,'Facebook ' ,'setting_fb_callback ' ,'shariff ' ,'shariff_platforms ' );
89118 add_settings_field ('shariff_twitter ' ,'Twitter ' ,'setting_twitter_callback ' ,'shariff ' ,'shariff_platforms ' );
90119 add_settings_field ('shariff_linkedin ' ,'LinkedIn ( ' .__ ('Experimental ' ,'shariff ' ).') ' ,'setting_linkedin_callback ' ,'shariff ' ,'shariff_platforms ' );
120+ add_settings_field ('shariff_pinterest ' ,'Pinterest ( ' .__ ('Experimental ' ,'shariff ' ).') ' ,'setting_pinterest_callback ' ,'shariff ' ,'shariff_platforms ' );
121+ add_settings_field ('shariff_xing ' ,'XING ( ' .__ ('Experimental ' ,'shariff ' ).') ' ,'setting_xing_callback ' ,'shariff ' ,'shariff_platforms ' );
91122 add_settings_field ('shariff_whatsapp ' ,'WhatsApp ' ,'setting_whatsapp_callback ' ,'shariff ' ,'shariff_platforms ' );
92123 add_settings_field ('shariff_email ' ,'E-Mail ' ,'setting_email_callback ' ,'shariff ' ,'shariff_platforms ' );
93124 add_settings_section ('shariff_other ' ,__ ('Other Shariff settings ' ,"shariff " ),'setting_plat_callback ' ,'shariff ' );
94125 add_settings_field ('shariff_info ' ,__ ('Privacy information ' ,"shariff " ),'setting_info_callback ' ,'shariff ' ,'shariff_other ' );
126+ add_settings_field ('shariff_image ' ,__ ('Default Image URL ' ,"shariff " ),'setting_imageurl ' ,'shariff ' ,'shariff_other ' );
95127 add_settings_field ('shariff_color ' ,__ ('Color ' ,"shariff " ),'setting_color_callback ' ,'shariff ' ,'shariff_other ' );
96128 add_settings_field ('shariff_orientation ' ,__ ('Orientation ' ,"shariff " ),'setting_orientation_callback ' ,'shariff ' ,'shariff_other ' );
97129 add_settings_field ('shariff_beforeafter ' ,__ ('Button location ' ,"shariff " ),'setting_before_callback ' ,'shariff ' ,'shariff_other ' );
@@ -100,6 +132,9 @@ function init_settings() {
100132 register_setting ('shariff ' ,'shariff_fb ' );
101133 register_setting ('shariff ' ,'shariff_twitter ' );
102134 register_setting ('shariff ' ,'shariff_linkedin ' );
135+ register_setting ('shariff ' ,'shariff_pinterest ' );
136+ register_setting ('shariff ' ,'shariff_xing ' );
137+ register_setting ('shariff ' ,'shariff_image ' );
103138 register_setting ('shariff ' ,'shariff_whatsapp ' );
104139 register_setting ('shariff ' ,'shariff_email ' );
105140 register_setting ('shariff ' ,'shariff_info ' );
@@ -127,12 +162,21 @@ function setting_gplus_callback() {
127162function setting_fb_callback () {
128163 checkbox_setting ('shariff_fb ' ,'Facebook ' ,true );
129164}
165+ function setting_xing_callback () {
166+ checkbox_setting ('shariff_xing ' ,'XING ' ,false );
167+ }
130168function setting_twitter_callback () {
131169 checkbox_setting ('shariff_twitter ' ,'Twitter ' ,true );
132170}
133171function setting_linkedin_callback () {
134172 checkbox_setting ('shariff_linkedin ' ,'LinkedIn ' ,false );
135173}
174+ function setting_pinterest_callback () {
175+ checkbox_setting ('shariff_pinterest ' ,'Pinterest ' ,false );
176+ }
177+ function setting_imageurl () {
178+ echo '<input type="text" name="shariff_image" value=" ' .get_option ('shariff_image ' ,'' ).'"> ' .__ ('Used for services such as Pinterest ' ,'shariff ' );
179+ }
136180function setting_whatsapp_callback () {
137181 checkbox_setting ('shariff_whatsapp ' ,'WhatsApp ' ,false );
138182}
@@ -220,7 +264,7 @@ function save_details(){
220264 update_post_meta ($ post ->ID , "shariff_enabled " , $ _POST ["shariff_enabled " ]);
221265}
222266add_action ("admin_init " , "select_init " );
223- add_action ( 'save_post ' , 'shariff_save_checkbox ' );
267+ add_action ('save_post ' , 'shariff_save_checkbox ' );
224268add_action ('admin_menu ' ,'shariffconfigmenu ' );
225269add_action ('admin_init ' ,'init_settings ' );
226270add_action ('init ' ,'init_locale ' );
0 commit comments