Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: 
  3: /**
  4:  * description: rss creator
  5:  *
  6:  * @package Module
  7:  * @subpackage ContentRssCreator
  8:  * @version SVN Revision $Rev:$
  9:  *
 10:  * @author timo.trautmann@4fb.de
 11:  * @copyright four for business AG <www.4fb.de>
 12:  * @license http://www.contenido.org/license/LIZENZ.txt
 13:  * @link http://www.4fb.de
 14:  * @link http://www.contenido.org
 15:  */
 16: 
 17: $teaserIndex = 5;
 18: 
 19: $cfgClient = cRegistry::getClientConfig();
 20: $client = cRegistry::getClientId();
 21: $filename = $cfgClient[$client]['xml']['frontendpath'] . 'rss.xml';
 22: 
 23: $labelRssTitle = mi18n("LABEL_RSS_TITLE");
 24: $labelRssLink = mi18n("LABEL_RSS_LINK");
 25: $labelRssDescription = mi18n("LABEL_RSS_DESCRIPTION");
 26: $labelRssConfiguration = mi18n("LABEL_RSS_CONFIGURATION");
 27: $labelRssH1 = mi18n("LABEL_RSS_H1");
 28: $labelRssLogo = mi18n("LABEL_RSS_LOGO");
 29: $labelRssSource = mi18n("LABEL_RSS_SOURCE");
 30: 
 31: $rssTitle = "CMS_TEXT[1]";
 32: $rssLink = "CMS_TEXT[2]";
 33: $rssDescription = "CMS_HTML[1]";
 34: $rssConfiguration = '';
 35: $rssLogo = "CMS_IMGEDITOR[1]";
 36: $rssLogoDisplay = "CMS_IMG[1]";
 37: $rssSource = $filename;
 38: 
 39: $tpl = cSmartyFrontend::getInstance();
 40: $tpl->assign('label_rss_title', $labelRssTitle);
 41: $tpl->assign('label_rss_link', $labelRssLink);
 42: $tpl->assign('label_rss_description', $labelRssDescription);
 43: $tpl->assign('label_rss_configuration', $labelRssConfiguration);
 44: $tpl->assign('label_rss_h1', $labelRssH1);
 45: $tpl->assign('label_rss_logo', $labelRssLogo);
 46: $tpl->assign('label_rss_source', $labelRssSource);
 47: $tpl->assign('rss_title', $rssTitle);
 48: $tpl->assign('rss_source', $rssSource);
 49: $tpl->assign('rss_link', $rssLink);
 50: $tpl->assign('rss_logo', $rssLogo);
 51: $tpl->assign('rss_logo_display', $rssLogoDisplay);
 52: $tpl->assign('rss_description', $rssDescription);
 53: $tpl->assign('rss_configuration', $rssConfiguration);
 54: $tpl->display('rss_edit.tpl');
 55: 
 56: echo "CMS_TEASER[5]";
 57: 
 58: $art = new cApiArticleLanguage(cRegistry::getArticleLanguageId());
 59: $contentValue = $art->getContent("TEASER", $teaserIndex);
 60: 
 61: $teaser = new cContentTypeTeaser($contentValue, $teaserIndex, array());
 62: $articles = $teaser->getConfiguredArticles();
 63: $configuration = $teaser->getConfiguration();
 64: 
 65: $xmlString = '<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"></rss>';
 66: function addCData($cdata_text)
 67: {
 68:     $node= dom_import_simplexml($this);
 69:     $no = $node->ownerDocument;
 70:     $node->appendChild($no->createCDATASection($cdata_text));
 71: }
 72: 
 73: $rssFeed = new SimpleXMLElement($xmlString);
 74: $rssChannel = $rssFeed->addChild('channel');
 75: $rssChannel->title = $art->getContent("CMS_TEXT", 1);
 76: $rssChannel->link = $art->getContent("CMS_TEXT", 2);
 77: $rssChannel->description = conHtmlEntityDecode(strip_tags($art->getContent("CMS_HTML", 1)));;
 78: 
 79: $imgId = $art->getContent("CMS_IMG", 1);
 80: 
 81: if ((int) $imgId > 0) {
 82:     $upload = new cApiUpload($imgId);
 83:     $rssLogo = $cfgClient[$client]['path']['htmlpath'] . 'upload/' . $upload->get('dirname') . $upload->get('filename');
 84: 
 85:     $rssImage = $rssChannel->addChild('image');
 86:     $rssImage->url = $rssLogo;
 87:     $rssImage->title = $art->getContent("CMS_TEXT", 1);
 88:     $rssImage->link = $art->getContent("CMS_TEXT", 2);
 89: }
 90: 
 91: foreach ($articles as $article) {
 92:     $child = $rssChannel->addChild('item');
 93:     $title = strip_tags($article->getContent('HTMLHEAD', 1));
 94:     $text = strip_tags($article->getContent('HTML', 1));
 95:     $text = cApiStrTrimAfterWord($text, $configuration['teaser_character_limit']);
 96:     $link = $cfgClient[$client]['path']['htmlpath'] . $article->getLink();
 97: 
 98:     $child->title = conHtmlEntityDecode(conHtmlSpecialChars($title));
 99:     $child->link = conHtmlEntityDecode($link);
100:     $child->description = conHtmlEntityDecode($text);
101:     $child->pubDate = date('D, d M Y H:i:s T', strtotime($article->getField('published')));
102: }
103: 
104: $result = mi18n("LABEL_RSS_CREATION_FAILED");
105: if (isset($cfgClient[$client]['xml']['frontendpath'])) {
106:     if (false === cFileHandler::exists($cfgClient[$client]['xml']['frontendpath'])) {
107:         cDirHandler::create($cfgClient[$client]['xml']['frontendpath'], true);
108:     }
109:     // try to write xml to disk
110:     $success = $rssFeed->asXML($filename);
111:     if (false !== $success) {
112:         $result = mi18n("LABEL_RSS_CREATED");
113:     }
114:     
115: }
116: 
117: $tpl = cSmartyFrontend::getInstance();
118: $tpl->assign('RESULT_MSG', $result);
119: $tpl->display('result.tpl');
120: 
121: ?>
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen