当前位置: 首页>>代码示例>>PHP>>正文


PHP Timestamp::getRFC1123方法代码示例

本文整理汇总了PHP中Timestamp::getRFC1123方法的典型用法代码示例。如果您正苦于以下问题:PHP Timestamp::getRFC1123方法的具体用法?PHP Timestamp::getRFC1123怎么用?PHP Timestamp::getRFC1123使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Timestamp的用法示例。


在下文中一共展示了Timestamp::getRFC1123方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: publishRSS

function publishRSS($blogid, $data)
{
    $context = Model_Context::getInstance();
    $blogid = getBlogId();
    ob_start();
    echo '<?xml version="1.0" encoding="UTF-8"?>', CRLF;
    echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">', CRLF;
    echo '	<channel>', CRLF;
    echo '		<title>', htmlspecialchars($data['channel']['title'], ENT_QUOTES), '</title>', CRLF;
    echo '		<link>', $data['channel']['link'], '</link>', CRLF;
    echo '		<description>', htmlspecialchars($data['channel']['description'], ENT_QUOTES), '</description>', CRLF;
    echo '		<language>', $data['channel']['language'], '</language>', CRLF;
    echo '		<pubDate>', Timestamp::getRFC1123($data['channel']['pubDate']), '</pubDate>', CRLF;
    echo '		<generator>', $data['channel']['generator'], '</generator>', CRLF;
    if (!empty($data['channel']['feed_link'])) {
        echo '		<atom:link href="', $data['channel']['feed_link'], '" rel="self" type="application/rss+xml" />', CRLF;
    }
    if ($context->getProperty('blog.logo') && file_exists(ROOT . "/attach/{$blogid}/{$context->getProperty('blog.logo')}")) {
        echo '		<image>', CRLF;
        echo '		<title>', htmlspecialchars($data['channel']['title'], ENT_QUOTES), '</title>', CRLF;
        echo '		<url>', $data['channel']['url'], '</url>', CRLF;
        echo '		<link>', $data['channel']['link'], '</link>', CRLF;
        echo '		<width>', $data['channel']['width'], '</width>', CRLF;
        echo '		<height>', $data['channel']['height'], '</height>', CRLF;
        echo '		<description>', htmlspecialchars($data['channel']['description'], ENT_QUOTES), '</description>', CRLF;
        echo '		</image>', CRLF;
    }
    foreach ($data['channel']['items'] as $item) {
        echo '		<item>', CRLF;
        echo '			<title>', htmlspecialchars($item['title'], ENT_QUOTES), '</title>', CRLF;
        echo '			<link>', $item['link'], '</link>', CRLF;
        echo '			<description>', htmlspecialchars($item['description'], ENT_QUOTES), '</description>', CRLF;
        foreach ($item['categories'] as $category) {
            if ($category = trim($category)) {
                echo '			<category>', htmlspecialchars($category, ENT_QUOTES), '</category>', CRLF;
            }
        }
        if (!empty($item['email'])) {
            echo '			<author>', $item['email'], ' (', htmlspecialchars($item['author'], ENT_QUOTES), ')</author>', CRLF;
        } else {
            echo '			<author>', htmlspecialchars($item['author'], ENT_QUOTES), '</author>', CRLF;
        }
        echo '			<guid>', $item['guid'], '</guid>', CRLF;
        echo '			<comments>', $item['comments'], '</comments>', CRLF;
        echo '			<pubDate>', Timestamp::getRFC1123($item['pubDate']), '</pubDate>', CRLF;
        if (!empty($item['enclosure'])) {
            echo '			<enclosure url="', $item['enclosure']['url'], '" length="', $item['enclosure']['length'], '" type="', $item['enclosure']['type'], '" />', CRLF;
        }
        echo '		</item>', CRLF;
    }
    echo '	</channel>', CRLF;
    echo '</rss>', CRLF;
    $rss = ob_get_contents();
    ob_end_clean();
    return $rss;
}
开发者ID:hinablue,项目名称:TextCube,代码行数:56,代码来源:blog.feed.php

示例2: sendAbstractToEolin

/**
 * @brief Send abstract about specific entry.
 * @see Tag, User, DBModel, Model_Context
 */
function sendAbstractToEolin()
{
    // TODO : Rewrite routines to fit Textcube 1.8 or later.
    requireModel('blog.category');
    $entryId = $_GET['entryId'];
    $context = Model_Context::getInstance();
    $blogid = $context->getProperty('blog.id');
    echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<response>\r\n";
    list($allComments, $allTrackbacks) = POD::queryRow("SELECT \n\t\t\tSUM(comments), SUM(trackbacks) \n\t\t\tFROM {$context->getProperty('database.prefix')}Entries \n\t\t\tWHERE blogid = " . $blogid . " AND draft = 0 AND visibility = 3", 'num');
    if ($entry = POD::queryRow("SELECT e.*, c.name AS categoryName \n\t\t\t\tFROM {$context->getProperty('database.prefix')}Entries e \n\t\t\t\tLEFT JOIN {$context->getProperty('database.prefix')}Categories c ON e.blogid = c.blogid AND e.category = c.id \n\t\t\t\tWHERE e.blogid = " . $blogid . " AND e.id = " . $entryId . " AND e.draft = 0 AND e.visibility = 3" . getPrivateCategoryExclusionQuery($blogid))) {
        header('Content-Type: text/xml; charset=utf-8');
        echo '<version>1.1</version>', "\r\n";
        echo '<status>1</status>', "\r\n";
        echo '<blog>', "\r\n";
        echo '<generator>' . TEXTCUBE_NAME . '/' . TEXTCUBE_VERSION . '</generator>', "\r\n";
        echo '<language>', htmlspecialchars($context->getProperty('blog.language')), '</language>', "\r\n";
        echo '<url>', htmlspecialchars($context->getProperty('uri.default')), '</url>', "\r\n";
        echo '<title>', htmlspecialchars($context->getProperty('blog.title')), '</title>', "\r\n";
        echo '<description>', htmlspecialchars($context->getProperty('blog.description')), '</description>', "\r\n";
        echo '<comments>', $allComments, '</comments>', "\r\n";
        echo '<trackbacks>', $allTrackbacks, '</trackbacks>', "\r\n";
        echo '</blog>', "\r\n";
        echo '<entry>', "\r\n";
        echo '<permalink>', htmlspecialchars($context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id'])), '</permalink>', "\r\n";
        echo '<title>', htmlspecialchars($entry['title']), '</title>', "\r\n";
        echo '<content>', htmlspecialchars(getEntryContentView($blogid, $entryId, $entry['content'], $entry['contentformatter'])), '</content>', "\r\n";
        echo '<author>', htmlspecialchars(User::authorName($blogid, $entryId)), '</author>', "\r\n";
        echo '<category>', htmlspecialchars($entry['categoryName']), '</category>', "\r\n";
        $tags = Tag::getTagsWithEntryId($blogid, $entry);
        foreach ($tags as $tag) {
            echo '<tag>', htmlspecialchars($tag), '</tag>', "\r\n";
        }
        echo '<location>', htmlspecialchars($entry['location']), '</location>', "\r\n";
        echo '<comments>', $entry['comments'], '</comments>', "\r\n";
        echo '<trackbacks>', $entry['trackbacks'], '</trackbacks>', "\r\n";
        echo '<written>', Timestamp::getRFC1123($entry['published']), '</written>', "\r\n";
        foreach (getAttachments($blogid, $entry['id']) as $attachment) {
            echo '<attachment>', "\r\n";
            echo '<mimeType>', $attachment['mime'], '</mimeType>', "\r\n";
            echo '<filename>', $attachment['label'], '</filename>', "\r\n";
            echo '<length>', $attachment['size'], '</length>', "\r\n";
            echo '<url>', $context->getProperty('uri.service'), '/attachment/', $attachment['name'], '</url>', "\r\n";
            echo '</attachment>', "\r\n";
        }
        echo '</entry>', "\r\n";
    } else {
        echo '<version>1.1</version>', "\r\n", '<status>0</status>', "\r\n";
    }
    echo "</response>";
    exit;
}
开发者ID:ragi79,项目名称:Textcube,代码行数:55,代码来源:index.php


注:本文中的Timestamp::getRFC1123方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。