function socialdiscuss_fetch_count($link)
{
    if (!$link) {
        return array();
    }
    $url = 'http://www.linksalpha.com/a/link?link=' . $link;
    $body = array('link' => $link);
    $response_full = socialdiscuss_http_post($url, $body);
    $results = socialdiscuss_http_process($response_full);
    if (!$results) {
        return array();
    }
    return $results;
}
예제 #2
0
function laecho_writeOptionsValuesToWPDatabase($option)
{
    if ($option == 'default') {
        $laecho_tmp = 'defined';
        $laecho_eget = get_bloginfo('admin_email');
        $laecho_uget = get_bloginfo('url');
        $laecho_nget = get_bloginfo('name');
        $laecho_dget = get_bloginfo('description');
        $laecho_cget = get_bloginfo('charset');
        $laecho_vget = get_bloginfo('version');
        $laecho_lget = get_bloginfo('language');
        $link = 'http://www.linksalpha.com/a/bloginfo';
        $laecho_bloginfo = array('email' => $laecho_eget, 'url' => $laecho_uget, 'name' => $laecho_nget, 'desc' => $laecho_dget, 'charset' => $laecho_cget, 'version' => $laecho_vget, 'lang' => $laecho_lget, 'plugin' => 'sd');
        socialdiscuss_http_post($link, $laecho_bloginfo);
        add_option('laecho-html-counters-location', 'after');
        add_option('laecho-html-widget-counters-location', 'before');
        add_option('laecho-html-float', 'float:left');
        add_option('laecho-html-widget-float', 'float:left');
        add_option('laecho-html-twitter-icon', '1');
        add_option('laecho-html-buzz-icon', '1');
        add_option('laecho-html-bitly-icon', '1');
        add_option('laecho-html-yahoo-icon', '1');
        add_option('laecho-html-margin-top', '0');
        add_option('laecho-html-margin-right', '0');
        add_option('laecho-html-margin-bottom', '0');
        add_option('laecho-html-margin-left', '0');
        add_option('laecho-html-widget-margin-top', '5');
        add_option('laecho-html-widget-margin-right', '0');
        add_option('laecho-html-widget-margin-bottom', '5');
        add_option('laecho-html-widget-margin-left', '0');
        add_option('laecho-html-cntr-fb-likes', '0');
        add_option('laecho-html-cntr-fb-comments', '0');
        add_option('laecho-html-cntr-yahoo-updates', '0');
        add_option('laecho-html-cntr-bitly-clicks', '0');
        add_option('laecho-html-cntr-google-buzz', '0');
        add_option('laecho-html-cntr-digg-diggs', '0');
        add_option('laecho-html-cntr-min-val', '-1');
        add_option('laecho-html-disable-cntr-display', '0');
        add_option('laecho-html-widget-disable-cntr-display', '0');
        add_option('laecho-html-display-index-posts', '0');
        add_option('laecho-html-display-archive-posts', '0');
        add_option('laecho-html-display-page-posts', '0');
        add_option('laecho-html-google-uname', '');
        add_option('laecho-html-fb-uname', '');
        add_option('laecho-html-fb-pgname', '');
        add_option('laecho-html-cntr-font-color', '#333333');
        add_option('laecho-html-cntr-bgnd-color', 'none');
        add_option('laechonw-html-warning-msg', '0');
    } else {
        if ($option == 'update') {
            if (isset($_POST['info_update'])) {
                if (!empty($_POST['laecho-html-counters-location'])) {
                    update_option('laecho-html-counters-location', $_POST['laecho-html-counters-location']);
                }
                if (!empty($_POST['laecho-html-float'])) {
                    update_option('laecho-html-float', $_POST['laecho-html-float']);
                }
                if (!empty($_POST['laecho-html-margin-top'])) {
                    update_option('laecho-html-margin-top', (string) $_POST['laecho-html-margin-top']);
                } else {
                    update_option('laecho-html-margin-top', '0');
                }
                if (!empty($_POST['laecho-html-margin-right'])) {
                    update_option('laecho-html-margin-right', (string) $_POST['laecho-html-margin-right']);
                } else {
                    update_option('laecho-html-margin-right', '0');
                }
                if (!empty($_POST['laecho-html-margin-bottom'])) {
                    update_option('laecho-html-margin-bottom', (string) $_POST['laecho-html-margin-bottom']);
                } else {
                    update_option('laecho-html-margin-bottom', '0');
                }
                if (!empty($_POST['laecho-html-margin-left'])) {
                    update_option('laecho-html-margin-left', (string) $_POST['laecho-html-margin-left']);
                } else {
                    update_option('laecho-html-margin-left', '0');
                }
                if (!empty($_POST['laecho-html-disable-cntr-display'])) {
                    update_option('laecho-html-disable-cntr-display', (string) $_POST['laecho-html-disable-cntr-display']);
                } else {
                    update_option('laecho-html-disable-cntr-display', '0');
                }
                if (!empty($_POST['laecho-html-google-uname'])) {
                    update_option('laecho-html-google-uname', (string) $_POST['laecho-html-google-uname']);
                }
                if (!empty($_POST['laecho-html-fb-uname'])) {
                    update_option('laecho-html-fb-uname', (string) $_POST['laecho-html-fb-uname']);
                }
                if (!empty($_POST['laecho-html-fb-pgname'])) {
                    update_option('laecho-html-fb-pgname', (string) $_POST['laecho-html-fb-pgname']);
                }
                if (!empty($_POST['laecho-html-cntr-fb-likes'])) {
                    update_option('laecho-html-cntr-fb-likes', (string) $_POST['laecho-html-cntr-fb-likes']);
                } else {
                    update_option('laecho-html-cntr-fb-likes', '0');
                }
                if (!empty($_POST['laecho-html-cntr-fb-comments'])) {
                    update_option('laecho-html-cntr-fb-comments', (string) $_POST['laecho-html-cntr-fb-comments']);
                } else {
                    update_option('laecho-html-cntr-fb-comments', '0');
                }
                if (!empty($_POST['laecho-html-cntr-yahoo-updates'])) {
                    update_option('laecho-html-cntr-yahoo-updates', (string) $_POST['laecho-html-cntr-yahoo-updates']);
                } else {
                    update_option('laecho-html-cntr-yahoo-updates', '0');
                }
                if (!empty($_POST['laecho-html-cntr-bitly-clicks'])) {
                    update_option('laecho-html-cntr-bitly-clicks', (string) $_POST['laecho-html-cntr-bitly-clicks']);
                } else {
                    update_option('laecho-html-cntr-bitly-clicks', '0');
                }
                if (!empty($_POST['laecho-html-cntr-google-buzz'])) {
                    update_option('laecho-html-cntr-google-buzz', (string) $_POST['laecho-html-cntr-google-buzz']);
                } else {
                    update_option('laecho-html-cntr-google-buzz', '0');
                }
                if (!empty($_POST['laecho-html-cntr-digg-diggs'])) {
                    update_option('laecho-html-cntr-digg-diggs', (string) $_POST['laecho-html-cntr-digg-diggs']);
                } else {
                    update_option('laecho-html-cntr-digg-diggs', '0');
                }
                if (!empty($_POST['laecho-html-cntr-min-val'])) {
                    update_option('laecho-html-cntr-min-val', (string) $_POST['laecho-html-cntr-min-val']);
                }
                // Options for selecting pages on which stats should show/not-show
                if (!empty($_POST['laecho-html-display-index-posts'])) {
                    update_option('laecho-html-display-index-posts', $_POST['laecho-html-display-index-posts'] == '1' ? '1' : '0');
                }
                if (!empty($_POST['laecho-html-display-archive-posts'])) {
                    update_option('laecho-html-display-archive-posts', $_POST['laecho-html-display-archive-posts'] == '1' ? '1' : '0');
                }
                if (!empty($_POST['laecho-html-display-page-posts'])) {
                    update_option('laecho-html-display-page-posts', $_POST['laecho-html-display-page-posts'] == '1' ? '1' : '0');
                }
                //ui
                if (!empty($_POST['laecho-html-cntr-font-color'])) {
                    update_option('laecho-html-cntr-font-color', (string) $_POST['laecho-html-cntr-font-color']);
                } else {
                    update_option('laecho-html-cntr-font-color', '#333333');
                }
                if (!empty($_POST['laecho-html-cntr-bgnd-color'])) {
                    update_option('laecho-html-cntr-bgnd-color', (string) $_POST['laecho-html-cntr-bgnd-color']);
                } else {
                    update_option('laecho-html-cntr-bgnd-color', 'none');
                }
            }
            if (isset($_POST['widget_update'])) {
                if (!empty($_POST['laecho-html-widget-counters-location'])) {
                    update_option('laecho-html-widget-counters-location', $_POST['laecho-html-widget-counters-location']);
                }
                if (!empty($_POST['laecho-html-widget-float'])) {
                    update_option('laecho-html-widget-float', $_POST['laecho-html-widget-float']);
                }
                if (!empty($_POST['laecho-html-widget-margin-top'])) {
                    update_option('laecho-html-widget-margin-top', (string) $_POST['laecho-html-widget-margin-top']);
                } else {
                    update_option('laecho-html-widget-margin-top', '0');
                }
                if (!empty($_POST['laecho-html-widget-margin-right'])) {
                    update_option('laecho-html-widget-margin-right', (string) $_POST['laecho-html-widget-margin-right']);
                } else {
                    update_option('laecho-html-widget-margin-right', '0');
                }
                if (!empty($_POST['laecho-html-widget-margin-bottom'])) {
                    update_option('laecho-html-widget-margin-bottom', (string) $_POST['laecho-html-widget-margin-bottom']);
                } else {
                    update_option('laecho-html-widget-margin-bottom', '0');
                }
                if (!empty($_POST['laecho-html-widget-margin-left'])) {
                    update_option('laecho-html-widget-margin-left', (string) $_POST['laecho-html-widget-margin-left']);
                } else {
                    update_option('laecho-html-widget-margin-left', '0');
                }
                if (!empty($_POST['laecho-html-widget-disable-cntr-display'])) {
                    update_option('laecho-html-widget-disable-cntr-display', (string) $_POST['laecho-html-widget-disable-cntr-display']);
                } else {
                    update_option('laecho-html-widget-disable-cntr-display', '0');
                }
            }
            if (isset($_POST['warning_msg'])) {
                if (!empty($_POST['laechonw-html-warning-msg'])) {
                    update_option('laechonw-html-warning-msg', (string) $_POST['laechonw-html-warning-msg']);
                } else {
                    update_option('laechonw-html-warning-msg', '0');
                }
            }
        } else {
            /*
            delete_option('laecho-html-counters-location');
            delete_option('laecho-html-widget-counters-location');
            delete_option('laecho-html-float');
            delete_option('laecho-html-widget-float');
            delete_option('laecho-html-twitter-icon');
            delete_option('laecho-html-buzz-icon');
            delete_option('laecho-html-bitly-icon');
            delete_option('laecho-html-yahoo-icon');
            delete_option('laecho-html-margin-top');
            delete_option('laecho-html-margin-right');
            delete_option('laecho-html-margin-bottom');
            delete_option('laecho-html-margin-left');
            delete_option('laecho-html-widget-margin-top');
            delete_option('laecho-html-widget-margin-right');
            delete_option('laecho-html-widget-margin-bottom');
            delete_option('laecho-html-widget-margin-left');
            delete_option('laecho-html-cntr-fb-likes');
            delete_option('laecho-html-cntr-fb-comments');
            delete_option('laecho-html-cntr-yahoo-updates');
            delete_option('laecho-html-cntr-bitly-clicks');
            delete_option('laecho-html-cntr-google-buzz');
            delete_option('laecho-html-cntr-digg-diggs');
            delete_option('laecho-html-disable-cntr-display');
            delete_option('laecho-html-widget-disable-cntr-display');
            delete_option('laecho-html-cntr-min-val');
            delete_option('laecho-html-display-index-posts');
            delete_option('laecho-html-display-archive-posts');
            delete_option('laecho-html-display-page-posts');
            delete_option('laecho-html-google-uname');
            delete_option('laecho-html-fb-uname');
            delete_option('laecho-html-fb-pgname');
            delete_option('laecho-html-cntr-font-color');
            delete_option('laecho-html-cntr-bgnd-color');
            delete_option('laechonw-html-warning-msg');
            */
        }
    }
}