function wpfp_link($return = 0, $action = "", $show_span = 1, $args = array()) { global $post; //print_r($post); $post_id =& $post->ID; extract($args); $str = ""; if ($show_span) { $str = "<span class='wpfp-span'>"; } $str .= wpfp_before_link_img(); $str .= wpfp_loading_img(); if ($action == "remove") { $str .= wpfp_link_html($post_id, wpfp_get_option('remove_favorite'), "remove"); } elseif ($action == "add") { $str .= wpfp_link_html($post_id, wpfp_get_option('add_favorite'), "add"); } elseif (wpfp_check_favorited($post_id)) { $str .= wpfp_link_html($post_id, wpfp_get_option('remove_favorite'), "remove"); } else { $str .= wpfp_link_html($post_id, wpfp_get_option('add_favorite'), "add"); } if ($show_span) { $str .= "</span>"; } if ($return) { return $str; } else { echo $str; } }
function wpfp_get_remove_link($post_id, $return = 0, $show_span = 1) { $action = "remove"; $str = ""; if ($show_span) { $str = "<span class='wpfp-span'>"; } $str .= wpfp_before_link_img(); $str .= wpfp_loading_img(); $str .= wpfp_link_html($post_id, wpfp_get_option('remove'), "remove"); if ($show_span) { $str .= "</span>"; } if ($return) { return $str; } else { echo $str; } }