bShare 分享 是一个强大的网页分享插件工具,您的读者可以将您网站上精采的内容快速分享、转贴到社群网络上。点击这里进行配置。
Version: 4.2.0
Author: Buzzinate, Denis
Author URI: http://www.bshare.cn
*/
load_plugin_textdomain('bshare');
if (get_option("bshare_code") == "") {
update_option("bshare_code", '分享&收藏');
}
if (get_option("bshare_pos") == "") {
update_option("bshare_pos", "down");
}
add_filter('the_content', 'bshare');
function bshare($content){
if(is_single() || (is_page() && get_option("bshare_inPage") != "false")) {
if (get_option("bshare_pos") == "up") {
$content = '
'.htmlspecialchars_decode(get_option("bshare_code")).'
'.$content;
} else {
$content = $content.''.htmlspecialchars_decode(get_option("bshare_code")).'
';
}
} else if(is_feed() && get_option("bshare_inFeed") != "false") {
global $post;
$bshare_feed_code = '
';
$content = $content.$bshare_feed_code;
}
return $content;
}
add_action('plugins_loaded', 'widget_sidebar_bshare');
function widget_sidebar_bshare() {
function widget_bshare($args) {
if(is_single()||is_page()) return;
extract($args);
echo $before_widget;
echo $before_title . __('bShare分享', 'bshare') . $after_title;
echo '';
echo htmlspecialchars_decode(get_option("bshare_code")) . '
';
echo $after_widget;
}
register_sidebar_widget(__('bShare分享', 'bshare'), 'widget_bshare');
}
add_action('admin_menu', 'bshare_menu');
function bshare_menu() {
add_options_page(__('bShare选项', 'bshare'), __('bShare分享', 'bshare'), 8, basename(__FILE__), 'bshare_options');
}
function bshare_options() {
if (isset($_POST['bshare_code'])) {
$code = stripslashes_deep($_POST['bshare_code']);
update_option("bshare_code", htmlspecialchars($code));
}
if ($_POST['bshare_infeed'] != "true") {
update_option("bshare_infeed", "false");
} else {
update_option("bshare_infeed", "true");
}
if ($_POST['bshare_inpage'] != "true") {
update_option("bshare_inpage", "false");
} else {
update_option("bshare_inpage", "true");
}
if (isset($_POST['bshare_pos'])) {
update_option("bshare_pos", $_POST['bshare_pos']);
}
echo '';
}
function getChecked($val) {
if ($val == "false") {
return '';
} else {
return 'checked="checked"';
}
}
function getRadioChecked($val, $cur) {
if ($val == $cur) {
return 'checked="checked"';
} else {
return '';
}
}
?>