Skip to content

Commit

Permalink
version 1.0.2
Browse files Browse the repository at this point in the history
- possibility to hide Shariff on a cirtain page
- own settings page
  • Loading branch information
yanniks committed Nov 30, 2014
1 parent 2475942 commit cffa72f
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 32 deletions.
Binary file modified src/locale/shariff-de_DE.mo
Binary file not shown.
14 changes: 9 additions & 5 deletions src/locale/shariff-de_DE.po
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: shariff\n"
"POT-Creation-Date: 2014-11-30 11:55+0100\n"
"PO-Revision-Date: 2014-11-30 12:47+0100\n"
"POT-Creation-Date: 2014-11-30 21:39+0100\n"
"PO-Revision-Date: 2014-11-30 21:40+0100\n"
"Last-Translator: Yannik Ehlert <[email protected]>\n"
"Language-Team: Yannik Ehlert <[email protected]>\n"
"Language: de\n"
Expand Down Expand Up @@ -64,14 +64,18 @@ msgstr "Horizontal"
msgid "Vertical"
msgstr "Vertikal"

#: shariff-wp.php:148
#: shariff-wp.php:143
msgid "Colored"
msgstr "Farbig"

#: shariff-wp.php:151
#: shariff-wp.php:146
msgid "Grey"
msgstr "Grau"

#: shariff-wp.php:154
#: shariff-wp.php:149
msgid "White"
msgstr "Weiß"

#: shariff-wp.php:158
msgid "Shariff configuration"
msgstr "Shariff-Konfiguration"
12 changes: 11 additions & 1 deletion src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: yanniks
Tags: sharing, social, networks, network, privacy, facebook, twitter, google, whatsapp, heise
Requires at least: 3.0
Tested up to: 4.0.1
Stable tag: 1.0.0
Stable tag: 1.0.2
License: MIT
License URI: http://opensource.org/licenses/MIT

Expand Down Expand Up @@ -34,8 +34,18 @@ Select which color you want, set the button location, select the orientation fit
2. `/assets/screenshot-2.png`
3. `/assets/screenshot-3.png`

== Frequently Asked Questions ==

= How do I hide Shariff on a page? =

Just include `hideshariff` in the article. The word will be removed automatically and Shariff will not be shown. If you want to write hidesharrif in an article without removing Shariff, just write `/hideshariff`.

== Changelog ==

= 1.0.2 =
* Own settings page
* Possibility to hide Shariff on a certain page

= 1.0.1 =
* Fixes a PHP warning

Expand Down
73 changes: 48 additions & 25 deletions src/shariff-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Shariff for Wordpress
* Plugin URI: http://www.heise.de/newsticker/meldung/c-t-entwickelt-datenschutzfreundliche-Social-Media-Buttons-weiter-2466687.html
* Description: Shariff enables website users to share their favorite content without compromising their privacy.
* Version: 1.0.1
* Version: 1.0.2
* Author: Heise Zeitschriften Verlag / Yannik Ehlert
* Author URI: http://www.heise.de
* Text Domain: shariff
Expand Down Expand Up @@ -58,38 +58,45 @@ function shariffsharing($content) {
if (get_option('shariff_beforeafter','before') != 'before') {
$content2 = $content;
}
$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>';
if (!((strpos($content,'hideshariff') !== false) && (strpos($content,'/hideshariff') == false))) {
$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>';
}
if (get_option('shariff_beforeafter','before') != 'after') {
$content2 .= $content;
}
if ((strpos($content,'/hideshariff') !== false)) {
$content2 = str_replace("/hideshariff","hideshariff",$content2);
} else {
$content2 = str_replace("hideshariff","",$content2);
}
return $content2;

}
function setting_plat_callback() {
}
function init_settings() {
add_settings_section('shariff_platforms',__('Shariff platforms',"shariff"),'setting_plat_callback','general');
add_settings_field('shariff_gplus','Google+','setting_gplus_callback','general','shariff_platforms');
add_settings_field('shariff_fb','Facebook','setting_fb_callback','general','shariff_platforms');
add_settings_field('shariff_twitter','Twitter','setting_twitter_callback','general','shariff_platforms');
add_settings_field('shariff_whatsapp','WhatsApp','setting_whatsapp_callback','general','shariff_platforms');
add_settings_field('shariff_email','E-Mail','setting_email_callback','general','shariff_platforms');
add_settings_section('shariff_other',__('Other Shariff settings',"shariff"),'setting_plat_callback','general');
add_settings_field('shariff_info',__('Privacy information',"shariff"),'setting_info_callback','general','shariff_other');
add_settings_field('shariff_color',__('Color',"shariff"),'setting_color_callback','general','shariff_other');
add_settings_field('shariff_orientation',__('Orientation',"shariff"),'setting_orientation_callback','general','shariff_other');
add_settings_field('shariff_beforeafter',__('Button location',"shariff"),'setting_before_callback','general','shariff_other');
add_settings_field('shariff_ttl','TTL','setting_ttl_callback','general','shariff_other');
register_setting('general','shariff_gplus');
register_setting('general','shariff_fb');
register_setting('general','shariff_twitter');
register_setting('general','shariff_whatsapp');
register_setting('general','shariff_email');
register_setting('general','shariff_info');
register_setting('general','shariff_color');
register_setting('general','shariff_orientation');
register_setting('general','shariff_beforeafter');
register_setting('general','shariff_ttl');
add_settings_section('shariff_platforms',__('Shariff platforms',"shariff"),'setting_plat_callback','shariff');
add_settings_field('shariff_gplus','Google+','setting_gplus_callback','shariff','shariff_platforms');
add_settings_field('shariff_fb','Facebook','setting_fb_callback','shariff','shariff_platforms');
add_settings_field('shariff_twitter','Twitter','setting_twitter_callback','shariff','shariff_platforms');
add_settings_field('shariff_whatsapp','WhatsApp','setting_whatsapp_callback','shariff','shariff_platforms');
add_settings_field('shariff_email','E-Mail','setting_email_callback','shariff','shariff_platforms');
add_settings_section('shariff_other',__('Other Shariff settings',"shariff"),'setting_plat_callback','shariff');
add_settings_field('shariff_info',__('Privacy information',"shariff"),'setting_info_callback','shariff','shariff_other');
add_settings_field('shariff_color',__('Color',"shariff"),'setting_color_callback','shariff','shariff_other');
add_settings_field('shariff_orientation',__('Orientation',"shariff"),'setting_orientation_callback','shariff','shariff_other');
add_settings_field('shariff_beforeafter',__('Button location',"shariff"),'setting_before_callback','shariff','shariff_other');
add_settings_field('shariff_ttl','TTL','setting_ttl_callback','shariff','shariff_other');
register_setting('shariff','shariff_gplus');
register_setting('shariff','shariff_fb');
register_setting('shariff','shariff_twitter');
register_setting('shariff','shariff_whatsapp');
register_setting('shariff','shariff_email');
register_setting('shariff','shariff_info');
register_setting('shariff','shariff_color');
register_setting('shariff','shariff_orientation');
register_setting('shariff','shariff_beforeafter');
register_setting('shariff','shariff_ttl');
}
function setting_before_callback() {
echo '<select name="shariff_beforeafter">
Expand Down Expand Up @@ -151,8 +158,24 @@ function setting_color_callback() {
function loadjs() {
echo '<script src="'.plugins_url( 'dep/shariff.min.js', __FILE__ ).'"></script>'."\n";
}
function shariff_options_page() {
?>
<div class="wrap">
<h2><?php echo _e("Shariff configuration","shariff")?></h2>
<form action="options.php" method="POST">
<?php settings_fields( 'shariff' ); ?>
<?php do_settings_sections( 'shariff' ); ?>
<?php submit_button(); ?>
</form>
</div>
<?php
}
function shariffconfigmenu() {
add_options_page('shariff', 'Shariff', 'manage_options', 'shariff', 'shariff_options_page');
}
add_action('admin_menu','shariffconfigmenu');
add_action('admin_init','init_settings');
add_action('init','init_locale');
add_action('wp_enqueue_scripts', 'loadshariff');
add_action('wp_footer','loadjs');
add_filter('the_content','shariffsharing');
add_filter('the_content','shariffsharing');
2 changes: 1 addition & 1 deletion zip.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=1.0.1
version=1.0.2
rm -rf shariff-wp
mkdir -p shariff-wp
cp -R src/ shariff-wp
Expand Down

0 comments on commit cffa72f

Please sign in to comment.