Esempio n. 1
0
function RemoveWidget($id)
{
    global $alert;
    $pac = GetPac($id);
    if ($pac != null) {
        RemovePac($id);
        $author_id = GetPostAuthorId($id);
        $gid = GetUserCode($author_id, true);
        if ($gid != null) {
            $query = GetFeedwebUrl() . "FBanner.aspx?action=rpw&pac={$pac}&gid={$gid}";
            $response = wp_remote_get($query, array('timeout' => 30));
            if (is_wp_error($response)) {
                $alert = __("Cannot connect Feedweb server", "FWTD");
                return false;
            }
            $dom = new DOMDocument();
            if ($dom->loadXML($response['body']) == true) {
                $el = $dom->documentElement;
                if ($el->tagName == "BANNER") {
                    $alert = $el->getAttribute("error");
                }
                if ($alert == "") {
                    $alert = __("The widget has been removed", "FWTD");
                    return true;
                }
                return false;
            }
        }
    }
    $alert = __("Wordpress cannot remove your widget", "FWTD");
    return false;
}
Esempio n. 2
0
function PublishPostHook($deprecated = '')
{
    if (current_user_can('manage_options') == false) {
        return;
    }
    $data = GetFeedwebOptions();
    if ($data == null) {
        return;
    }
    if ($data["widget_prompt"] != "1") {
        return;
    }
    // Get current post id (for newly published post)
    global $post_ID;
    $id = get_the_ID($post_ID);
    $pac = GetPac($id);
    if ($pac != null) {
        // Already exists
        return;
    }
    SetPostStatus($id, 0);
}
Esempio n. 3
0
function SetPageVisibilityStatus($id, $visible)
{
    $pac = GetPac($id);
    if ($pac == null) {
        return false;
    }
    $bac = GetBac(true);
    if ($bac == null) {
        return false;
    }
    $query = GetFeedwebUrl() . "FBanner.aspx?action=spv&pac={$pac}&bac={$bac}&vs={$visible}";
    $response = wp_remote_get($query, array('timeout' => 30));
    if (is_wp_error($response)) {
        return false;
    }
    return true;
}
Esempio n. 4
0
function GetEditPageData()
{
    global $edit_page_data;
    if ($edit_page_data == null) {
        $id = GetPostId();
        $pac = GetPac($id);
        $edit_page_data = GetPageData($pac, true);
    }
    return $edit_page_data;
}