'.st_makeEntries().'
'; } } return $content; } // 2006-06-02 Renamed function from st_add_st_link() to st_add_feed_link() function st_add_feed_link($content) { if (is_feed()) { $content .= st_link(); } return $content; } // 2006-06-02 Filters to Add Sharethis widget on content and/or link on RSS // 2006-06-02 Expected behavior is that the feed link will show up if an option is not 'no' if (get_option('st_add_to_content') != 'no' || get_option('st_add_to_page') != 'no') { add_filter('the_content', 'st_add_widget'); // 2008-08-15 Excerpts don't play nice due to strip_tags(). add_filter('get_the_excerpt', 'st_remove_st_add_link',9); add_filter('the_excerpt', 'st_add_widget'); } function st_widget_fix_domain($widget) { return preg_replace( "/\", $widget); $widget = preg_replace("/widget\/\&wp\=/", "widget/?wp=", $widget); } else { $widget = preg_replace("/([\&\?])wp\=([^\&\"]*)/", "$1wp=".get_bloginfo('version'), $widget); } return $widget; } if (!function_exists('ak_can_update_options')) { function ak_can_update_options() { if (function_exists('current_user_can')) { if (current_user_can('manage_options')) { return true; } } else { global $user_level; get_currentuserinfo(); if ($user_level >= 8) { return true; } } return false; } } function st_request_handler() { if (!empty($_REQUEST['st_action'])) { switch ($_REQUEST['st_action']) { case 'st_update_settings': if (ak_can_update_options()) { if($_POST['Edit'] == ""){ $publisher_id=$_POST['st_pkey']; if($_POST['st_callesi'] == "0"){ $cns_settings = $_POST['copynshareSettings']; }else{ $cns_settings = ""; } //print_r ($_POST); //var_dump($cns_settings); /* updates username in database*/ if($_POST['st_user_name'] != "" && $_POST['st_user_name'] != "undefined"){ update_option('st_username', $_POST['st_user_name']); } //update st_version to figure out which widget to use. if(!empty($_POST['st_version'])) { update_option('st_version', $_POST['st_version']); if (($_POST['st_version']) == '5x') { $st_switchTo5x = true; } elseif (($_POST['st_version']) == '4x') { $st_switchTo5x = false; } } $widgetTemp = ""; $widgetTemp.=""; $widgetTemp.=""; if($_POST['selectedBar'] == "hoverbarStyle" || $_POST['selectedBar'] == "pulldownStyle" || $_POST['sharenowSelected'] == "true"){ $widgetTemp.=""; } if($_POST['selectedBar'] == "hoverbarStyle"){ $st_hoverbar_services = $_POST['hoverbar']['services']; $st_hoverbar_services = '"'.str_replace(',','","',$st_hoverbar_services).'"'; $widgetTemp.=""; }else if($_POST['selectedBar'] == "pulldownStyle"){ $st_pulldown_services = $_POST['pulldownbar']['services']; $st_pulldown_services = '"'.str_replace(',','","',$st_pulldown_services).'"'; $widgetTemp.=""; update_option('st_pulldownlogo', $_POST['pulldownbar']['logo']); } if($_POST['sharenowSelected'] == "true"){ $widgetTemp.=""; } // note: do not convert & to & or append WP version here $widget = st_widget_fix_domain($widgetTemp); update_option('st_pubid', $publisher_id); update_option('st_widget', $widget); if(!empty($_POST['st_tags'])){ $tagsin=$_POST['st_tags']; $tagsin=preg_replace("/\\n|\\t/","", $tagsin); $tagsin=preg_replace("/\\\'/","'", $tagsin); $tagsin=trim($tagsin); update_option('st_tags',$tagsin); }else{ update_option('st_tags',' '); // in case of buttons not selected } if(!empty($_POST['st_services'])){ update_option('st_services', trim($_POST['st_services'],",") ); } if(!empty($_POST['st_current_type'])){ update_option('st_current_type', trim($_POST['st_current_type'],",") ); } $options = array( 'st_add_to_content' , 'st_add_to_page' ); foreach ($options as $option) { if (isset($_POST[$option]) && in_array($_POST[$option], array('yes', 'no'))) { update_option($option, $_POST[$option]); } } //header('Location: '.get_bloginfo('wpurl').'/wp-admin/options-general.php?page=sharethis.php&updated=true'); //$blog_title = get_bloginfo('wpurl'); //$blog_title .= "/wp-admin/options-general.php?page=sharethis.php"; //header('refresh:0;url='.$blog_title); //die(); die("SUCCESS"); } } break; } die("FAILURE"); } } function st_options_form() { $plugin_location=WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)); $publisher_id = get_option('st_pubid'); $services = get_option('st_services'); $tags = get_option('st_tags'); $st_current_type=get_option('st_current_type'); $st_widget_version = get_option('st_version'); $st_prompt = get_option('st_prompt'); $st_username = get_option('st_username'); $st_pulldownlogo = get_option('st_pulldownlogo'); $freshInstalation = empty($services)?1:0; if(empty($st_username)){ $st_username = ""; } if(empty($st_pulldownlogo)){ $st_pulldownlogo = "http://sd.sharethis.com/disc/images/Logo_Area.png"; } if(empty($st_current_type)){ $st_current_type="_large"; } if(empty($services)){ $services="facebook,twitter,linkedin,email,sharethis,fblike,plusone,pinterest"; } if(empty($st_prompt)){ //$services.=",instagram"; update_option('st_prompt', 'true'); } if(empty($tags)){ foreach(explode(',',$services) as $svc){ $tags.=""; } } if(empty($st_widget_version)){ $st_widget_version="5x"; } /* Retrives widget version from the database */ $widget5xSelected = ""; $widget4xSelected = ""; if($st_widget_version == "5x"){ $widget5xSelected = "selected"; }else if($st_widget_version == "4x"){ $widget4xSelected = "selected"; } if(get_option('st_add_to_content') != 'no'){ $st_add_to_contentYes = ' selected="selected" '; $st_add_to_contentNo = ""; }else{ $st_add_to_contentYes = ""; $st_add_to_contentNo = ' selected="selected" '; } if(get_option('st_add_to_page') != 'no') { $st_add_to_pageYes = ' selected="selected" '; $st_add_to_pageNo = ""; }else{ $st_add_to_pageYes = ""; $st_add_to_pageNo = ' selected="selected" '; } $widgetTag = get_option('st_widget'); if(empty($publisher_id)){ $toShow=""; // Re-generate new random publisher key $publisher_id=trim(makePkey()); } else{ $toShow = $widgetTag; } /* Pulls the theme ID for the sharenow feature*/ if (preg_match('/serviceWidget/',$toShow)) { $pattern = "/