コード例 #1
0
// Handle request to delete an entry before we load them all
if (isset($_POST['delete_entry']) && strlen($_POST['delete_entry'])) {
    $del = $_POST['delete_entry'];
    $dr = new AtomRequest('DELETE', $del, $auth);
    $dr->exec();
    $code = $dr->get_httpcode();
    if ($code != 200 && $code != 204) {
        echo "<script language=\"JavaScript\" type=\"text/javascript\">\n";
        echo "<!--\n";
        echo "alert('Can\\'t delete that post - you might not have permission to do so.');\n";
        echo "// -->\n";
        echo "</script>\n";
    }
}
$af = new AtomFeed(urldecode($_REQUEST['f']), $auth);
$entries = $af->get_entries();
if (is_array($entries)) {
    foreach ($entries as $e => $entry) {
        $link = $entry->get_links('rel', 'service.edit');
        $link = $link[0]['href'];
        $title = trim($entry->get_title('title'));
        $title = preg_replace('/(<[^>]*>)/is', '', $title);
        $title = preg_replace('/(&lt;.*&gt;)/sUi', '', $title);
        $title = preg_replace('/(\\n)/sUi', '', $title);
        $title_short = substr($title, 0, 45) . (strlen($title) > 45 ? '...' : '');
        if ($title == '') {
            $title = 'No Title (Created: ' . $entry->get_created() . ')';
        }
        echo "<a href=\"javascript:select(" . $e . ", '" . addslashes($title) . "', '" . urlencode($link) . "', '" . urlencode($_REQUEST['f']) . "');\" ondblclick=\"select(" . $e . ", '" . addslashes($title) . "', '" . urlencode($link) . "', '" . urlencode($_REQUEST['f']) . "'); if (confirm_open()) {parent.document.file.submit();}\" id=\"entry" . $e . "\" title=\"" . $title . "\"><img src=\"../../images/files_file.gif\" width=\"19\" height=\"18\" border=\"0\" align=\"absmiddle\" />�" . $title_short . "</a>\n";
    }
} else {
コード例 #2
0
ファイル: blogger.php プロジェクト: grainrigi/cegcc
    return $buffer;
}
$atom_filename = 'atom.xml';
echo "<h2>News</h2>";
/**********************************************************************
  CONSTRUCT A FEED OBJECT AND ENTRY OBJECTS FOR ALL AVAILABLE ENTRIES
**********************************************************************/
// Collect entries from the cached feed
$rfeed = read_atom_xml($atom_filename);
if ($rfeed === false) {
    echo "could not read atom feed\n";
    return false;
}
$feed = new AtomFeed(false, false, $rfeed);
// Create objects from all available entries
$entries = $feed->get_entries();
$maxdisplay = 2;
echo '<h2>Last ' . $maxdisplay . ' Entries</h2>';
$inum = 0;
foreach ($entries as $entry) {
    if (++$inum > $maxdisplay) {
        break;
    }
    $link = $entry->get_links('type', 'text/html');
    $link = $link[0]['href'];
    // Get the title
    $title = $entry->get_title();
    $title = $title['title'];
    $content = $entry->get_content();
    $content = $content['content'];
    $author = $entry->get_author();