예제 #1
0
function install_ShareThis()
{
    $publisher_id = get_option('st_pubid');
    //pub key value
    $widget = get_option('st_widget');
    //entire script tag
    $newUser = false;
    if (get_option('st_version') == '') {
        update_option('st_version', '5x');
    }
    if (empty($publisher_id)) {
        if (!empty($widget)) {
            $newPkey = getKeyFromTag();
            if ($newPkey == false) {
                $newUser = true;
                update_option('st_pubid', trim(makePkey()));
            } else {
                update_option('st_pubid', $newPkey);
                //pkey found set old key
            }
        } else {
            $newUser = true;
            update_option('st_pubid', trim(makePkey()));
        }
    }
    if ($widget == false || !preg_match('/stLight.options/', $widget)) {
        $pkey2 = get_option('st_pubid');
        $widget = "<script charset=\"utf-8\" type=\"text/javascript\">var switchTo5x=true;</script>";
        $widget .= "<script charset=\"utf-8\" type=\"text/javascript\" src=\"http://w.sharethis.com/button/buttons.js\"></script>";
        $widget .= "<script type=\"text/javascript\">stLight.options({publisher:'{$pkey2}'});var st_type='wordpress" . trim(get_bloginfo('version')) . "';</script>";
        update_option('st_widget', $widget);
    }
    $st_sent = get_option('st_sent');
    $st_upgrade_five = get_option('st_upgrade_five');
    if (empty($st_sent)) {
        update_option('st_sent', 'true');
        update_option('st_upgrade_five', '5x');
        $st_sent = get_option('st_sent');
        //confirm if value has been set
        if (!empty($st_sent)) {
            sendWelcomeEmail($newUser);
        }
        $st_upgrade_five = get_option('st_upgrade_five');
    } else {
        if (empty($st_upgrade_five)) {
            update_option('st_upgrade_five', '5x');
            $st_upgrade_five = get_option('st_upgrade_five');
            //confirm if value has been set
            if (!empty($st_upgrade_five)) {
                sendUpgradeEmail();
            }
        }
    }
    if (get_option('st_add_to_content') == '') {
        update_option('st_add_to_content', 'yes');
    }
    if (get_option('st_add_to_page') == '') {
        update_option('st_add_to_page', 'yes');
    }
}
예제 #2
0
파일: sharethis.php 프로젝트: jkreska/test1
function install_ShareThis()
{
    $publisher_id = get_option('st_pubid');
    //pub key value
    $widget = get_option('st_widget');
    //entire script tag
    $newUser = false;
    $widget = getNewTag($widget);
    update_option('st_widget', $widget);
    if (empty($publisher_id)) {
        if (!empty($widget)) {
            $newPkey = getKeyFromTag();
            if ($newPkey == false) {
                $newUser = true;
            } else {
                update_option('st_pubid', $newPkey);
                //pkey found set old key
            }
        } else {
            $newUser = true;
        }
    }
    $st_sent = get_option('st_sent');
    if (empty($st_sent)) {
        update_option('st_sent', 'true');
        $st_sent = get_option('st_sent');
        //confirm if value has been set
        if (!empty($st_sent)) {
            sendWelcomeEmail($newUser);
        }
    }
    if (get_option('st_add_to_content') == '') {
        update_option('st_add_to_content', 'yes');
    }
    if (get_option('st_add_to_page') == '') {
        update_option('st_add_to_page', 'yes');
    }
}