/**
 * Update the value of Facebook Page Like Count by ajax
 *
 * @return json total count of like page or error if error occurred.
 */
function flc_update_counter_ajax_callback()
{
    global $flc_message;
    if (isset($_POST['fb_fan_check_frequency'])) {
        update_option('fb_fan_check_frequency', $_POST['fb_fan_check_frequency']);
    }
    update_option('flc_fb_like_page', $_POST['fb_fan_page']);
    $nu_opt = array();
    $apply_no_formate = $_POST['formating_option']['apply'];
    if ($apply_no_formate == 'checked') {
        $nu_opt = $_POST['formating_option'];
    }
    update_option('flc_fb_like_count_number_formate', $nu_opt);
    $counter = flc_update_like_count();
    if (!is_numeric($counter)) {
        die(json_encode(array('error' => $counter)));
    } else {
        $number_formate = get_option('flc_fb_like_count_number_formate');
        if (!is_array($number_formate) || count($number_formate) == 0) {
            $number_formate = array('apply' => '', 'thousand_saprator' => '');
        }
        $count = 0;
        $number_formate_apply = $number_formate['apply'];
        if ($number_formate_apply == 'checked') {
            $thousand_saprator = isset($number_formate['thousand_saprator']) ? $number_formate['thousand_saprator'] : '';
            $counter = number_format($counter, 0, '', $thousand_saprator);
        }
        die(json_encode(array('counter' => $counter)));
    }
}
Esempio n. 2
0
function get_btc_facebook_likes()
{
    $likes = flc_update_like_count('https://www.facebook.com/BrooklynTriClub');
    //cache data
    return $likes;
}