Add custom Facebook share link with share count and variable text

I found a simple solution thanks to this answer:
How do I change the singular/plural on “comment” to “comments” on Facebook’s number of comments?

Here is how I solved without the tag, using the code I was already working for, this goes into function.php

function get_likes($url) {
   $json_string = file_get_contents('http://graph.facebook.com/?ids=" . $url);
   $json = json_decode($json_string, true);
   $count = intval( $json[$url]["shares'] );
   if ($count == 0) {
     echo "share!";
   } elseif ($count == 1) {
     echo "shared 1 time";
   } else {
   echo "$count shares";
   }
} 

and this in the template

<?php $url = get_permalink( $post_id ); echo get_likes($url); ?>