setPublicStatus() public method

setPublicStatus
public setPublicStatus ( $padID, $publicStatus )
コード例 #1
0
}
/* Example: Get Public Status of a pad and include some logic -- This only works for group pads */
try {
    $getpublicStatus = $instance->getPublicStatus('testPad');
    if ($getpublicStatus->publicStatus === false) {
        echo "This Pad is not public\n\n";
    } else {
        echo "This Pad is public\n\n";
    }
} catch (Exception $e) {
    // the pad already exists or something else went wrong
    echo "\n\ngetPublicStatus Failed with message " . $e->getMessage();
}
/* Example: Set Public Status of a pad -- This only works for group pads */
try {
    $instance->setPublicStatus('testPad', true);
    // true or false
} catch (Exception $e) {
    // the pad already exists or something else went wrong
    echo "\n\nsetPublicStatus Failed with message " . $e->getMessage();
}
/* Example: Set Password on a pad -- This only works for group pads */
try {
    $instance->setPassword('testPad', 'aPassword');
} catch (Exception $e) {
    // the pad already exists or something else went wrong
    echo "\n\nsetPassword Failed with message " . $e->getMessage();
}
/* Example: Get true/false if the pad is password protected and include some logic -- This only works for group pads*/
try {
    $isPasswordProtected = $instance->isPasswordProtected('testPad');
コード例 #2
0
        }
    }
    if ($action == "deletePad") {
        $name = $_GET["name"];
        try {
            $name = urldecode($name);
            $instance->deletePad($name);
        } catch (Exception $e) {
            // the pad doesn't exist?
            echo "\n\ndeletePad Failed with message " . $e->getMessage();
        }
    }
    if ($action == "makePublic") {
        $name = $_GET["name"];
        try {
            $instance->setPublicStatus($name, "true");
        } catch (Exception $e) {
            // the pad doesn't exist?
            echo "\n\nMake Public Failed with message " . $e->getMessage();
        }
    }
    if ($action == "makePrivate") {
        $name = $_GET["name"];
        try {
            $instance->setPublicStatus($name, "false");
        } catch (Exception $e) {
            // the pad doesn't exist?
            echo "\n\nMake Private Failed with message " . $e->getMessage();
        }
    }
}