📄 feedforall_parse_itunes.inc.php
字号:
<?php//// rss2html.php RSS feed to HTML webpage script//// Copyright 2007 NotePage, Inc. all rights reserved// http://www.feedforall.com//// NotePage, Inc. grants registerd users of our FeedForAll and/or// FeedForAll Mac product(s) the right to install and use the// FeedForAll_rss2html_pro.php script free of charge. // Please refer to the EULA included in the download for full license// terms and conditions.//// $Id: FeedForAll_parse_iTunes.inc.php,v 3.0 2007/04/16 14:23:03 housley Exp $//// $Log: FeedForAll_parse_iTunes.inc.php,v $// Revision 3.0 2007/04/16 14:23:03 housley// Release version 3.0 of the scripts//// Revision 2.8 2007/04/16 12:38:22 housley// Shorten the class name add-on to prevent it from becoming too long//// Revision 2.7 2007/03/30 13:18:33 housley// Use getArrayOfFields() and getValueOf() to simplfy tag replacement, except// where special processing needs to be done//// Revision 2.6 2007/03/15 13:50:34 housley// * Clear the current tag, in endElement()// * Trim the feed level items at end of channel//// Revision 2.5 2007/03/07 02:11:59 housley// Add parsing the TrackBack extension//// Revision 2.4 2007/03/04 22:54:03 housley// Add methods to get the filter capabilities//// Revision 2.3 2007/03/04 13:41:53 housley// * Pass the parsing mode to the item class// * Cleanup the feed level processing// * rss2html uses the separate parser too//// Revision 2.2 2007/03/04 02:10:08 housley// Move the parser used by the paid scripts into its own file.//// Revision 2.1 2007/03/03 21:10:09 housley// * Make the item a full class object// * Support parsing the iTunes(R) extension////Function FeedForAll_parse_iTunes_extendClass($className) { $newClassName = $className."_iT"; eval('class ' . $newClassName . ' extends ' . $className . ' { var $iTunes_subtitle; var $iTunes_summary; var $iTunes_keywords; var $iTunes_author; var $iTunes_explicit; var $iTunes_blocked; var $iTunes_duration; var $iTunesUsed; Function ' . $newClassName . '($operateAs) { $this->iTunes_subtitle = ""; $this->iTunes_summary = ""; $this->iTunes_keywords = ""; $this->iTunes_author = ""; $this->iTunes_explicit = ""; $this->iTunes_blocked = ""; $this->iTunes_duration = ""; $this->iTunesUsed = 0; // Call the parent constructor $this->' . $className . '($operateAs); } Function getValueOf($elementName) { if ($elementName == "~~~ItemiTunesSubtitle~~~") { return $this->iTunes_subtitle; } elseif ($elementName == "~~~ItemiTunesSummary~~~") { return $this->iTunes_summary; } elseif ($elementName == "~~~ItemiTunesDuration~~~") { return $this->iTunes_duration; } elseif ($elementName == "~~~ItemiTunesKeywords~~~") { return $this->iTunes_keywords; } elseif ($elementName == "~~~ItemiTunesAuthor~~~") { return $this->iTunes_author; } elseif ($elementName == "~~~ItemiTunesExplicit~~~") { return $this->iTunes_explicit; } elseif ($elementName == "~~~ItemiTunesBlocked~~~") { return $this->iTunes_blocked; } else { return parent::getValueOf($elementName); } return NULL; } Function getArrayOfFields() { $result = Array(); $result[] = "~~~ItemiTunesSubtitle~~~"; $result[] = "~~~ItemiTunesSummary~~~"; $result[] = "~~~ItemiTunesDuration~~~"; $result[] = "~~~ItemiTunesKeywords~~~"; $result[] = "~~~ItemiTunesAuthor~~~"; $result[] = "~~~ItemiTunesExplicit~~~"; $result[] = "~~~ItemiTunesBlocked~~~"; $merged = array_merge(parent::getArrayOfFields(), $result); sort($merged); return $merged; } }'); return $newClassName;}Function FeedForAll_parse_iTunes_extendParserClass($className) { $newClassName = $className."_iT"; eval('class ' . $newClassName . ' extends ' . $className . ' { var $iTunes_categoryLevel = 0; var $iTunes_category = ""; var $iTunes_subtitle; var $iTunes_summary; var $iTunes_categoryArray = Array(); var $iTunes_keywords; var $iTunes_author; var $iTunes_ownerName; var $iTunes_ownerEmail; var $iTunes_image; var $iTunes_explicit; var $iTunes_blocked; var $iTunesUsed; Function ' . $newClassName . '($operateAs) { $this->iTunes_categoryLevel = 0; $this->iTunes_category = ""; $this->iTunes_subtitle = ""; $this->iTunes_summary = ""; $this->iTunes_categoryArray = Array(); $this->iTunes_keywords = ""; $this->iTunes_author = ""; $this->iTunes_ownerName = ""; $this->iTunes_ownerEmail = ""; $this->iTunes_image = ""; $this->iTunes_explicit = ""; $this->iTunes_blocked = ""; $this->iTunesUsed = 0; // Call the parent constructor $this->' . $className . '($operateAs); } }'); return $newClassName;}Function FeedForAll_parse_iTunes_startElemend($parser, &$_this, $tagName, $attrs) { if ($_this->insideChannel) { if ($tagName == "ITUNES:IMAGE") { $_this->iTunesUsed = 1; if (isset($attrs["HREF"])) { $_this->iTunes_image = $attrs["HREF"]; } } elseif ($tagName == "ITUNES:CATEGORY") { $_this->iTunesUsed = 1; if ($_this->iTunes_categoryLevel == 0) { $_this->iTunes_category = $attrs["TEXT"]; } else { $_this->iTunes_subCategory = $attrs["TEXT"]; } $_this->iTunes_categoryLevel++; // // Since "short" tags with elements don't seem to call end_element // I must do the work here $pos = xml_get_current_byte_index($parser); $hereToEnd = substr($_this->wholeString, $pos); $closePos = strpos($hereToEnd, ">"); if ($closePos == 0) { // Can't be a short tag ; } elseif ($hereToEnd[$closePos-1] == "/") { // This is a short tag FeedForAll_parse_iTunes_endCategory($_this); } } }}Function FeedForAll_parse_iTunes_endCategory(&$_this) { $_this->iTunes_categoryLevel--; if ($_this->iTunes_categoryLevel == 0) { $_this->iTunes_categoryArray[] = Array("Category" => $_this->iTunes_category, "SubCategory" => $_this->iTunes_subCategory); $_this->iTunes_category = ""; $_this->iTunes_subCategory = ""; }}Function FeedForAll_parse_iTunes_endElemend($parser, &$_this, $tagName) { if ((($tagName == "ITEM") && ($_this->feedTYPE != "FEE")) || (($tagName == "ENTRY") && ($_this->feedTYPE == "FEE"))) { if ($_this->UseItem) { if ($_this->currentItem->iTunesUsed) { $_this->iTunesUsed = 1; } $_this->currentItem->iTunes_subtitle = trim($_this->currentItem->iTunes_subtitle); $_this->currentItem->iTunes_summary = trim($_this->currentItem->iTunes_summary); $_this->currentItem->iTunes_duration = trim($_this->currentItem->iTunes_duration); $_this->currentItem->iTunes_keywords = trim($_this->currentItem->iTunes_keywords); $_this->currentItem->iTunes_author = trim($_this->currentItem->iTunes_author); $_this->currentItem->iTunes_explicit = trim($_this->currentItem->iTunes_explicit); $_this->currentItem->iTunes_blocked = trim($_this->currentItem->iTunes_blocked); } } elseif (($tagName == "IMAGE") && ($_this->insideChannelImage)) { } elseif ($tagName == "CHANNEL") { $_this->iTunes_subtitle = trim($_this->iTunes_subtitle); $_this->iTunes_summary = trim($_this->iTunes_summary); $_this->iTunes_keywords = trim($_this->iTunes_keywords); $_this->iTunes_author = trim($_this->iTunes_author); $_this->iTunes_ownerName = trim($_this->iTunes_ownerName); $_this->iTunes_ownerEmail = trim($_this->iTunes_ownerEmail); $_this->iTunes_image = trim($_this->iTunes_image); $_this->iTunes_explicit = trim($_this->iTunes_explicit); $_this->iTunes_blocked = trim($_this->iTunes_blocked); if ($_this->operateAs == "rss2html") { // // Escape any links $_this->iTunes_image = FeedForAll_rss2html_EscapeLink($_this->iTunes_image); } } elseif ($_this->level == $_this->level_channel) { if ($tagName == "ITUNES:SUBTITLE") { $_this->iTunesUsed = 1; $_this->iTunes_subtitle = trim($_this->iTunes_subtitle); } elseif ($tagName == "ITUNES:SUMMARY") { $_this->iTunesUsed = 1; $_this->iTunes_summary = trim($_this->iTunes_summary); } elseif ($tagName == "ITUNES:CATEGORY") { FeedForAll_parse_iTunes_endCategory($_this); } elseif ($tagName == "ITUNES:KEYWORDS") { $_this->iTunesUsed = 1; $_this->iTunes_keywords = trim($_this->iTunes_keywords); } elseif ($tagName == "ITUNES:AUTHOR") { $_this->iTunesUsed = 1; $_this->iTunes_author = trim($_this->iTunes_author); } elseif ($tagName == "ITUNES:OWNER") { $_this->iTunesUsed = 1; $_this->iTunes_ownerEmail = trim($_this->iTunes_ownerEmail); $_this->iTunes_ownerName = trim($_this->iTunes_ownerName); } elseif ($tagName == "ITUNES:IMAGE") { $_this->iTunesUsed = 1; $_this->iTunes_image = trim($_this->iTunes_image); } elseif ($tagName == "ITUNES:EXPLICIT") { $_this->iTunesUsed = 1; $_this->iTunes_explicit = trim($_this->iTunes_explicit); } elseif ($tagName == "ITUNES:BLOCKED") { $_this->iTunesUsed = 1; $_this->iTunes_blocked = trim($_this->iTunes_blocked); } }}Function FeedForAll_parse_iTunes_characterData($parser, &$_this, $data) { if (($data == "") || ($data == NULL)) { } else { if (($_this->insideItem) && ($_this->level == $_this->level_item+1)) { // // <item> switch ($_this->tag) { case "ITUNES:SUBTITLE": $_this->currentItem->iTunes_subtitle .= $data; $_this->currentItem->iTunesUsed = 1; $_this->iTunesUsed = 1; break; case "ITUNES:SUMMARY": $_this->currentItem->iTunes_summary .= $data; $_this->currentItem->iTunesUsed = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -