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


PHP blogTextParser::convert_to_rss方法代码示例

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


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

示例1: GetPost

    function GetPost($params, $arPath)
    {
        global $USER;
        $postId = IntVal(CBlogMetaWeblog::DecodeParams($params[0]["#"]["value"][0]["#"]));
        $user = CBlogMetaWeblog::DecodeParams($params[1]["#"]["value"][0]["#"]);
        $password = CBlogMetaWeblog::DecodeParams($params[2]["#"]["value"][0]["#"]);
        if (CBlogMetaWeblog::Authorize($user, $password)) {
            $result = '';
            $userId = $USER->GetID();
            if (IntVal($postId) > 0) {
                $arSelectedFields = array("ID", "BLOG_ID", "TITLE", "DATE_PUBLISH", "AUTHOR_ID", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "BLOG_URL", "BLOG_OWNER_ID");
                $dbPost = CBlogPost::GetList(array(), array("AUTHOR_ID" => $userId, "ID" => $postId), false, array("nTopCount" => 1), $arSelectedFields);
                if ($arPost = $dbPost->Fetch()) {
                    $parser = new blogTextParser();
                    $dateISO = date("Y-m-d\\TH:i:s", MakeTimeStamp($arPost["DATE_PUBLISH"]));
                    $title = htmlspecialcharsEx($arPost["TITLE"]);
                    $arImages = array();
                    $res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "IS_COMMENT" => "N"));
                    while ($arImage = $res->Fetch()) {
                        $arImages[$arImage['ID']] = $arImage['FILE_ID'];
                    }
                    if ($arPost["DETAIL_TEXT_TYPE"] == "html") {
                        $arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "N", "QUOTE" => "N", "CODE" => "N");
                        $text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, $arAllow, false);
                    } else {
                        $arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "N", "CODE" => "N", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "N");
                        $text = $parser->convert_to_rss(htmlspecialcharsEx($arPost["DETAIL_TEXT"]), $arImages, $arAllow, false);
                    }
                    $text = "<![CDATA[" . $text . "]]>";
                    $category = "";
                    $dbCategory = CBlogPostCategory::GetList(array(), array("BLOG_ID" => $arPost["BLOG_ID"], "POST_ID" => $arPost["ID"]));
                    while ($arCategory = $dbCategory->Fetch()) {
                        $category .= '<value>' . htmlspecialcharsEx($arCategory["NAME"]) . '</value>';
                    }
                    $path2Post = "";
                    if (strlen($arPath["PATH_TO_POST"]) > 0) {
                        if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
                            $serverName = SITE_SERVER_NAME;
                        } else {
                            $serverName = COption::GetOptionString("main", "server_name", "www.bitrixsoft.com");
                        }
                        $path2Post = "http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPath["PATH_TO_POST"], array("blog" => $arPost["BLOG_URL"], "user_id" => $arPost["BLOG_OWNER_ID"], "post_id" => $arPost["ID"]));
                    }
                    $result .= '
						<value>
							<struct>';
                    if (strlen($category) > 0) {
                        $result .= '<member>
									<name>categories</name>
									<value>
									<array>
									<data>
									' . $category . '
									</data>
									</array>
									</value>
								</member>
							';
                    }
                    $result .= '
								<member>
									<name>dateCreated</name>
									<value>
									<dateTime.iso8601>' . $dateISO . '</dateTime.iso8601>
									</value>
								</member>
								<member>
									<name>description</name>
									<value>' . $text . '</value>
								</member>
								<member>
									<name>link</name>
									<value>' . htmlspecialcharsEx($path2Post) . '</value>
								</member>
								<member>
									<name>postid</name>
									<value>
									<i4>' . $arPost["ID"] . '</i4>
									</value>
								</member>
								<member>
									<name>title</name>
									<value>' . $title . '</value>
								</member>
								<member>
									<name>publish</name>
									<value>
									<boolean>' . ($arPost["PUBLISH_STATUS"] == "D" ? "0" : "1") . '</boolean>
									</value>
								</member>
							</struct>
						</value>
						';
                }
            }
            return '<params>
						<param>
							<value>
								<array>
									<data>' . $result . '</data>
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:blog_metaweblog.php

示例2: GetRSS


//.........这里部分代码省略.........
     //WHERE
     $arFilter = array("<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "BLOG_ENABLE_RSS" => "Y", "MICRO" => "N");
     if (intval($arSettings["BLOG_CODE"]) === $arSettings["BLOG_CODE"]) {
         $arFilter["BLOG_ID"] = $arSettings["BLOG_CODE"];
     } else {
         $arFilter["BLOG_URL"] = $arSettings["BLOG_CODE"];
     }
     //Extend standart filter
     $arFilter = array_merge($arFilter, $arFilterExt);
     CTimeZone::Disable();
     $dbPosts = CBlogPost::GetList(array("DATE_PUBLISH" => "DESC"), $arFilter, false, array("nTopCount" => $numPosts), $arSelFields);
     CTimeZone::Enable();
     while ($arPost = $dbPosts->Fetch()) {
         //Can read
         if (CBlogPost::GetBlogUserPostPerms($arPost["ID"], $arSettings["CURRENT_USER_ID"]) < BLOG_PERMS_READ) {
             continue;
         }
         $arAuthorUser = $USER->GetByID($arPost["AUTHOR_ID"])->Fetch();
         $author = CBlogUser::GetUserName($arPost["BLOG_USER_ALIAS"], $arAuthorUser["NAME"], $arAuthorUser["LAST_NAME"], $arAuthorUser["LOGIN"], $arAuthorUser["SECOND_NAME"]);
         $title = str_replace(array("&", "<", ">", "\""), array("&amp;", "&lt;", "&gt;", "&quot;"), $author . ": " . $arPost["TITLE"]);
         //Idea Images
         $arImages = array();
         $res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "IS_COMMENT" => "N"));
         while ($arImage = $res->Fetch()) {
             $arImages[$arImage['ID']] = $arImage['FILE_ID'];
         }
         $arDate = ParseDateTime($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $arPost["BLOG_GROUP_SITE_ID"]));
         $date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
         if (!empty($arPathTemplates)) {
             $url = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CComponentEngine::MakePathFromTemplate($arPathTemplates["BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
         } else {
             $url = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CBlogPost::PreparePath(htmlspecialcharsbx($arPost["BLOG_URL"]), $arPost["ID"], $arPost["BLOG_GROUP_SITE_ID"]));
         }
         $category = "";
         if (isset($arPost[self::UFCategroryCodeField]) && is_array($arSettings["CATEGORIES"][ToUpper($arPost[self::UFCategroryCodeField])])) {
             $category = htmlspecialcharsbx($arSettings["CATEGORIES"][ToUpper($arPost[self::UFCategroryCodeField])]["NAME"]);
         }
         if (strlen($arPathTemplates["USER"]) > 0) {
             $authorURL = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CComponentEngine::MakePathFromTemplate($arPathTemplates["USER"], array("user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
         } else {
             $authorURL = htmlspecialcharsbx("http://" . $arSettings["SERVER_NAME"] . CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arPost["BLOG_GROUP_SITE_ID"]));
         }
         if ($arPost["DETAIL_TEXT_TYPE"] == "html") {
             $IdeaText = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "QUOTE" => "Y", "CODE" => "Y"), true, $arParserParams);
         } else {
             $IdeaText = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, false, true, $arParserParams);
         }
         $IdeaText .= "<br /><a href=\"" . $url . "\">" . GetMessage("BLG_GB_RSS_DETAIL") . "</a>";
         $IdeaText = "<![CDATA[" . $IdeaText . "]]>";
         if ($arSettings["RSS_TYPE"] == "rss.92") {
             $arSettings["RSS"] .= "\t<item>\n";
             $arSettings["RSS"] .= "\t  <title>" . $title . "</title>\n";
             $arSettings["RSS"] .= "\t  <description>" . $IdeaText . "</description>\n";
             $arSettings["RSS"] .= "\t  <link>" . $url . "</link>\n";
             $arSettings["RSS"] .= "\t</item>\n";
             $arSettings["RSS"] .= "\n";
         } elseif ($arSettings["RSS_TYPE"] == "rss2.0") {
             $arSettings["RSS"] .= "\t<item>\n";
             $arSettings["RSS"] .= "\t  <title>" . $title . "</title>\n";
             $arSettings["RSS"] .= "\t  <description>" . $IdeaText . "</description>\n";
             $arSettings["RSS"] .= "\t  <link>" . $url . "</link>\n";
             $arSettings["RSS"] .= "\t  <guid>" . $url . "</guid>\n";
             $arSettings["RSS"] .= "\t  <pubDate>" . $date . "</pubDate>\n";
             if (strlen($category) > 0) {
                 $arSettings["RSS"] .= "\t  <category>" . $category . "</category>\n";
             }
             $arSettings["RSS"] .= "\t</item>\n";
             $arSettings["RSS"] .= "\n";
         } elseif ($arSettings["RSS_TYPE"] == "atom.03") {
             $atomID = "tag:" . htmlspecialcharsbx($arSettings["SERVER_NAME"]) . ":" . $arBlog["URL"] . "/" . $arPost["ID"];
             $timeISO = mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]);
             $dateISO = date("Y-m-d\\TH:i:s", $timeISO) . substr(date("O", $timeISO), 0, 3) . ":" . substr(date("O", $timeISO), -2, 2);
             $titleRel = htmlspecialcharsbx($arPost["TITLE"]);
             $arSettings["RSS"] .= "<entry>\n";
             $arSettings["RSS"] .= "  <title type=\"text/html\">" . $title . "</title>\n";
             $arSettings["RSS"] .= "  <link rel=\"alternate\" type=\"text/html\" href=\"" . $url . "\"/>\n";
             $arSettings["RSS"] .= "  <issued>" . $dateISO . "</issued>\n";
             $arSettings["RSS"] .= "  <modified>" . $arSettings["NOW_ISO"] . "</modified>\n";
             $arSettings["RSS"] .= "  <id>" . $atomID . "</id>\n";
             $arSettings["RSS"] .= "  <content type=\"text/html\" mode=\"escaped\" xml:lang=\"" . $arSettings["LANGUAGE"] . "\" xml:base=\"" . $arSettings["BLOG_URL"] . "\">\n";
             $arSettings["RSS"] .= $IdeaText . "\n";
             $arSettings["RSS"] .= "  </content>\n";
             $arSettings["RSS"] .= "  <link rel=\"related\" type=\"text/html\" href=\"" . $url . "\" title=\"" . $titleRel . "\"/>\n";
             $arSettings["RSS"] .= "  <author>\n";
             $arSettings["RSS"] .= "\t<name>" . htmlspecialcharsbx($author) . "</name>\n";
             $arSettings["RSS"] .= "\t<url>" . $authorURL . "</url>\n";
             $arSettings["RSS"] .= "  </author>\n";
             $arSettings["RSS"] .= "</entry>\n";
             $arSettings["RSS"] .= "\n";
         }
     }
     if ($arSettings["RSS_TYPE"] == "rss.92") {
         $arSettings["RSS"] .= "  </channel>\n</rss>";
     } elseif ($arSettings["RSS_TYPE"] == "rss2.0") {
         $arSettings["RSS"] .= "  </channel>\n</rss>";
     } elseif ($arSettings["RSS_TYPE"] == "atom.03") {
         $arSettings["RSS"] .= "\n\n</feed>";
     }
     return $arSettings["RSS"];
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:idea.php

示例3: BuildRSS


//.........这里部分代码省略.........
						{
							$arDate = ParseDateTime($arComments["DATE_CREATE"], CSite::GetDateFormat("FULL", $arGroup["SITE_ID"]));
							$date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));

							if(strpos($url, "?") !== false)
								$url1 = $url."&amp;";
							else
								$url1 = $url."?";
							$url1 .= "commentId=".$arComments["ID"]."#".$arComments["ID"];

							$authorURL = "";
							if(IntVal($arComments["AUTHOR_ID"]) > 0)
							{
								$author = CBlogUser::GetUserName($arComments["BLOG_USER_ALIAS"], $arComments["USER_NAME"], $arComments["USER_LAST_NAME"], $arComments["USER_LOGIN"], $arComments["USER_SECOND_NAME"]);
								if(strLen($arPathTemplate["PATH_TO_USER"])>0)
									$authorURL = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_USER"], array("user_id"=>$arComments["AUTHOR_ID"])));
								else
									$authorURL = htmlspecialcharsbx("http://".$serverName.CBlogUser::PreparePath($arComments["AUTHOR_ID"], $arGroup["SITE_ID"]));
							}
							else
								$author = $arComments["AUTHOR_NAME"];
							$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "TABLE" => "Y", "CUT_ANCHOR" => "N");
							if($arPathTemplate["NO_URL_IN_COMMENTS"] == "L" || (IntVal($arComments["AUTHOR_ID"]) <= 0  && $arPathTemplate["NO_URL_IN_COMMENTS"] == "A"))
								$arAllow["CUT_ANCHOR"] = "Y";

							if($arPathTemplate["NO_URL_IN_COMMENTS_AUTHORITY_CHECK"] == "Y" && $arAllow["CUT_ANCHOR"] != "Y" && IntVal($arComments["AUTHOR_ID"]) > 0)
							{
								$authorityRatingId = CRatings::GetAuthorityRating();
								$arRatingResult = CRatings::GetRatingResult($authorityRatingId, $arComments["AUTHOR_ID"]);
								if($arRatingResult["CURRENT_VALUE"] < $arPathTemplate["NO_URL_IN_COMMENTS_AUTHORITY"])
									$arAllow["CUT_ANCHOR"] = "Y";
							}

							$text = $parser->convert_to_rss($arComments["POST_TEXT"], $arImages, $arAllow, false, $arParserParams);

							$title = GetMessage("BLG_GCM_COMMENT_TITLE", Array("#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"]), "#COMMENT_AUTHOR#" => htmlspecialcharsEx($author)));
							/*$title = str_replace(
								array("&", "<", ">", "\""),
								array("&amp;", "&lt;", "&gt;", "&quot;"),
								$title);
							*/
							//$text1 = HTMLToTxt($text, "", Array("\&nbsp;"), 60);
							$text = "<![CDATA[".$text."]]>";


							if ($type == "rss.92")
							{
								$rssText .= "    <item>\n";
								$rssText .= "      <title>".$title."</title>\n";
								$rssText .= "      <description>".$text."</description>\n";
								$rssText .= "      <link>".$url1."</link>\n";
								$rssText .= "    </item>\n";
								$rssText .= "\n";
							}
							elseif ($type == "rss2.0")
							{
								$rssText .= "    <item>\n";
								$rssText .= "      <title>".$title."</title>\n";
								$rssText .= "      <description>".$text."</description>\n";
								$rssText .= "      <link>".$url1."</link>\n";
								$rssText .= "      <guid>".$url1."</guid>\n";
								$rssText .= "      <pubDate>".$date."</pubDate>\n";
								$rssText .= "    </item>\n";
								$rssText .= "\n";
							}
							elseif ($type == "atom.03")
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:blog_comment.php

示例4: BuildRSSAll


//.........这里部分代码省略.........
     CTimeZone::Disable();
     $dbPosts = CBlogPost::GetList(array("DATE_PUBLISH" => "DESC"), $arFilter, false, array("nTopCount" => $numPosts), $arSelFields);
     CTimeZone::Enable();
     while ($arPost = $dbPosts->Fetch()) {
         $perms = CBlogPost::GetBlogUserPostPerms($arPost["ID"], $GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : 0);
         if ($perms < BLOG_PERMS_READ) {
             continue;
         }
         $dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
         $arUser = $dbUser->Fetch();
         $author = CBlogUser::GetUserName($arPost["BLOG_USER_ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"], $arUser["SECOND_NAME"]);
         $title = str_replace(array("&", "<", ">", "\""), array("&amp;", "&lt;", "&gt;", "&quot;"), $author . ": " . $arPost["TITLE"]);
         $arImages = array();
         $res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "IS_COMMENT" => "N"));
         while ($arImage = $res->Fetch()) {
             $arImages[$arImage['ID']] = $arImage['FILE_ID'];
         }
         $arDate = ParseDateTime($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $arPost["BLOG_GROUP_SITE_ID"]));
         $date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
         if (strlen($arPost["PATH"]) > 0) {
             $url = htmlspecialcharsbx("http://" . $serverName . str_replace("#post_id#", CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), $arPost["PATH"]));
         } elseif (!empty($arPathTemplates)) {
             if (IntVal($arPost["BLOG_SOCNET_GROUP_ID"]) > 0 && strlen($arPathTemplates["GROUP_BLOG_POST"]) > 0) {
                 $url = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPathTemplates["GROUP_BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
             } else {
                 $url = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPathTemplates["BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
             }
         } elseif (strLen($postTemplate) > 0) {
             $url = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($postTemplate, array("blog" => $arPost["BLOG_URL"], "post_id" => $arPost["ID"], "user_id" => $arPost["BLOG_OWNER_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
         } else {
             $url = htmlspecialcharsbx("http://" . $serverName . CBlogPost::PreparePath(htmlspecialcharsbx($arPost["BLOG_URL"]), $arPost["ID"], $arPost["BLOG_GROUP_SITE_ID"]));
         }
         $category = htmlspecialcharsbx($arPost["CATEGORY_NAME"]);
         if (strlen($arPathTemplates["USER"]) > 0) {
             $authorURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($arPathTemplates["USER"], array("user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
         } elseif (strLen($userTemplate) > 0) {
             $authorURL = htmlspecialcharsbx("http://" . $serverName . CComponentEngine::MakePathFromTemplate($userTemplate, array("user_id" => $arPost["AUTHOR_ID"], "group_id" => $arPost["BLOG_SOCNET_GROUP_ID"])));
         } else {
             $authorURL = htmlspecialcharsbx("http://" . $serverName . CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arPost["BLOG_GROUP_SITE_ID"]));
         }
         if ($arPost["DETAIL_TEXT_TYPE"] == "html") {
             $text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "QUOTE" => "Y", "CODE" => "Y"), true, $arParserParams);
         } else {
             $text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, false, true, $arParserParams);
         }
         if ($bUserSocNet != "Y") {
             $text .= "<br /><a href=\"" . $url . "\">" . GetMessage("BLG_GB_RSS_DETAIL") . "</a>";
         }
         $text = "<![CDATA[" . $text . "]]>";
         if ($type == "rss.92") {
             $rssText .= "    <item>\n";
             $rssText .= "      <title>" . $title . "</title>\n";
             $rssText .= "      <description>" . $text . "</description>\n";
             $rssText .= "      <link>" . $url . "</link>\n";
             $rssText .= "    </item>\n";
             $rssText .= "\n";
         } elseif ($type == "rss2.0") {
             $rssText .= "    <item>\n";
             $rssText .= "      <title>" . $title . "</title>\n";
             $rssText .= "      <description>" . $text . "</description>\n";
             $rssText .= "      <link>" . $url . "</link>\n";
             $rssText .= "      <guid>" . $url . "</guid>\n";
             $rssText .= "      <pubDate>" . $date . "</pubDate>\n";
             if (strlen($category) > 0) {
                 $rssText .= "      <category>" . $category . "</category>\n";
             }
             $rssText .= "    </item>\n";
             $rssText .= "\n";
         } elseif ($type == "atom.03") {
             $atomID = "tag:" . htmlspecialcharsbx($serverName) . ":" . $arBlog["URL"] . "/" . $arPost["ID"];
             $timeISO = mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]);
             $dateISO = date("Y-m-d\\TH:i:s", $timeISO) . substr(date("O", $timeISO), 0, 3) . ":" . substr(date("O", $timeISO), -2, 2);
             $titleRel = htmlspecialcharsbx($arPost["TITLE"]);
             $rssText .= "<entry>\n";
             $rssText .= "  <title type=\"text/html\">" . $title . "</title>\n";
             $rssText .= "  <link rel=\"alternate\" type=\"text/html\" href=\"" . $url . "\"/>\n";
             $rssText .= "  <issued>" . $dateISO . "</issued>\n";
             $rssText .= "  <modified>" . $nowISO . "</modified>\n";
             $rssText .= "  <id>" . $atomID . "</id>\n";
             $rssText .= "  <content type=\"text/html\" mode=\"escaped\" xml:lang=\"" . $language . "\" xml:base=\"" . $blogURL . "\">\n";
             $rssText .= $text . "\n";
             $rssText .= "  </content>\n";
             $rssText .= "  <link rel=\"related\" type=\"text/html\" href=\"" . $url . "\" title=\"" . $titleRel . "\"/>\n";
             $rssText .= "  <author>\n";
             $rssText .= "    <name>" . htmlspecialcharsbx($author) . "</name>\n";
             $rssText .= "    <url>" . $authorURL . "</url>\n";
             $rssText .= "  </author>\n";
             $rssText .= "</entry>\n";
             $rssText .= "\n";
         }
     }
     if ($type == "rss.92") {
         $rssText .= "  </channel>\n</rss>";
     } elseif ($type == "rss2.0") {
         $rssText .= "  </channel>\n</rss>";
     } elseif ($type == "atom.03") {
         $rssText .= "\n\n</feed>";
     }
     return $rssText;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:blog.php


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