getReadOnlyID() public method

getReadOnlyID
public getReadOnlyID ( $padID )
Exemplo n.º 1
0
/* Example: Set Text into a Pad */
try {
    $instance->setText('testPad', 'Hello world');
} catch (Exception $e) {
    echo "\n\nsetText Failed with message " . $e->getMessage();
}
/* Example: Create a new Pad */
try {
    $instance->createPad('testPad', 'Hello world');
} catch (Exception $e) {
    // the pad already exists or something else went wrong
    echo "Failed with message " . $e->getMessage();
}
/* Example: Get Ready Only ID of a pad */
try {
    $readOnlyID = $instance->getReadOnlyID('testPad');
    echo "The read only ID of this pad is: {$readOnlyID->readOnlyID}\n\n";
} catch (Exception $e) {
    echo "\n\ngetReadOnlyID Failed with message " . $e->getMessage();
}
/* 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();
foreach ($padList as $pad => $key) {
    // For each pad in the object
    // This should really be ordered based on last modified
    $padname = explode("\$", $pad);
    $padname = $padname[1];
    $padContents = $instance->getText($pad);
    // Get the pad contents
    $contents = $padContents->text;
    $pad = urlencode($pad);
    echo "<div class='pad'>";
    echo "<h1><a href={$host}/p/{$pad}>{$padname}</a></h1>";
    echo " - <h2><a onClick='\$(\"#contents{$count}\").slideDown();'>Preview</a></h2><br/>";
    echo "<div class='contents' id=contents{$count}>{$contents}</div>";
    echo "<h3><a href=/users.php?action=deletePad&name={$pad}>Delete Pad</a></h3>";
    echo "<h3><a href={$host}/p/{$pad}>Edit Pad</a></h3>";
    $readOnlyID = $instance->getReadOnlyID($pad);
    $readOnlyID = $readOnlyID->readOnlyID;
    echo "<h3><a href={$host}/ro/{$readOnlyID}>Read only view</a>";
    $getpublicStatus = $instance->getPublicStatus($pad);
    // get Security status of the pad
    if ($getpublicStatus->publicStatus === false) {
        echo "<h3><a href=/users.php?action=makePublic&name={$pad}>Make pad public</a></h3>";
    } else {
        echo "<h3><a href=/users.php?action=makePrivate&name={$pad}>Make pad private</a></h3>";
    }
    echo "</div>";
    $count++;
}
echo "</div>";
?>
</body>