function getShareCounter($forURL, $realm)
 {
     ensureShareCounterTableExists();
     $escapedForURL = str_replace(array("\\", "", "\n", "\r", "'", '"', ""), array("\\\\", "\\0", "\\n", "\\r", "\\'", '\\"', "\\Z"), $forURL);
     //Added for the Wizard results page issue, as the escaped url on the results page add /wizard-results in the url
     //hence no result is retrieved from database.
     //Code begins
     $wizstring = '/wizard-results';
     if (strpos($escapedForURL, $wizstring)) {
         $escapedForURL = str_replace($wizstring, '', $escapedForURL);
     }
     //Code end
     //Code added for the Share counting when the query has some parameters
     $pos = strpos($escapedForURL, '?');
     //dsm($pos);
     if ($pos !== false) {
         $urlpath = explode('?', $escapedForURL);
         $escapedForURL = $urlpath[0];
     }
     //End Code
     $results = db_query("\n            SELECT * \n            FROM sharecounter\n            WHERE url = '{$escapedForURL}'\n        ");
     //dsm($results);
     foreach ($results as $record) {
         switch (strtolower($realm)) {
             case 'facebook':
                 return intval($record->facebook_counter);
             case 'twitter':
                 return intval($record->twitter_counter);
             case 'linkedin':
                 return intval($record->linkedin_counter);
             case 'mail':
                 return intval($record->mail_counter);
             case 'total':
                 return getShareCounter($forURL, 'facebook') + getShareCounter($forURL, 'twitter') + getShareCounter($forURL, 'linkedin') + getShareCounter($forURL, 'mail');
             default:
                 return 0;
         }
         break;
     }
     return 0;
 }
                        <span>
                            <?php 
        print getShareCounter($_SERVER['REQUEST_URI'], 'twitter');
        ?>
                        </span>
                    <?php 
    }
    ?>
                </a>
                <a style="cursor: pointer;" class="linkedin">
                    <?php 
    if ($variables['showCounters']) {
        ?>
                        <span>
                            <?php 
        print getShareCounter($_SERVER['REQUEST_URI'], 'linkedin');
        ?>
                        </span>
                    <?php 
    }
    ?>
                </a>
            </div>
        </div>
    </div>
    <div id="shareWidgetEMailSelector" style="display: none;" rendersource="<?php 
    print basename(__FILE__);
    ?>
">
        <div class="share-emailselector-colorbox" style="background-color: white">