Example #1
0
 function setHead($sHead)
 {
     $sHtmlAndPhp = $this->clean($sHead);
     $sHtmlAndPhp = AnwUtils::stripUntr($sHtmlAndPhp);
     $sHtmlAndPhp = AnwPlugins::vhook('outputhtml_clean_head', $sHtmlAndPhp);
     $sHtmlAndPhp = self::do_on_html($sHtmlAndPhp, 'cbk_vhook_outputhtml_clean_head_html');
     //$sHtmlAndPhp = Anwi18n::parseTranslations($sHtmlAndPhp); //apply translations from plugins
     $this->sHead = $sHtmlAndPhp;
     $this->bHasDynamicPhpHead = AnwUtils::contentHasPhpCode($this->sHead);
     $this->bHasDynamicParsingHead = AnwParser::contentHasDynamicParsing($this->sHead);
 }
Example #2
0
 function output()
 {
     $sOut = "";
     switch ($this->getType()) {
         case self::TYPE_RSS1:
             $sOut .= '<?xml version="1.0"?>' . "\n";
             $sOut .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:co="http://purl.org/rss/1.0/modules/company/" xmlns:ti="http://purl.org/rss/1.0/modules/textinput/" xmlns="http://purl.org/rss/1.0/"> ' . "\n";
             $sOut .= '<channel rdf:about="<![CDATA[' . $this->sUrl . ']]>">' . "\n";
             $sOut .= "<title><![CDATA[" . $this->sTitle . "]]></title>\n";
             $sOut .= "<link><![CDATA[" . $this->sLink . "]]></link>\n";
             $sOut .= "<description><![CDATA[" . $this->sDescription . "]]></description>\n";
             $sOut .= "</channel>\n";
             $sOut .= "<items>\n";
             $sOut .= "<rdf:Seq>\n";
             foreach ($this->aoItems as $oItem) {
                 $sOut .= '<rdf:li resource="' . $oItem->getLink() . '" />' . "\n";
             }
             $sOut .= "</rdf:Seq>\n";
             $sOut .= "</items>\n";
             foreach ($this->aoItems as $oItem) {
                 $sOut .= "<item>\n";
                 $sOut .= "<title><![CDATA[" . $oItem->getTitle() . "]]></title>\n";
                 $sOut .= "<link><![CDATA[" . $oItem->getLink() . "]]></link>\n";
                 $sOut .= "<dc:description><![CDATA[" . $oItem->getDescription() . "]]></dc:description>\n";
                 if ($oItem->getDate()) {
                     $sOut .= "<dc:date>" . date("Y-m-d\\TH:i:sP", $oItem->getDate()) . "</dc:date>\n";
                 }
                 $sOut .= "</item>\n";
             }
             $sOut .= "</rdf:RDF>";
             break;
         case self::TYPE_RSS2:
             $sOut .= '<?xml version="1.0"?>' . "\n";
             $sOut .= '<rss version="2.0">' . "\n";
             $sOut .= "<channel>\n";
             $sOut .= "<title><![CDATA[" . $this->sTitle . "]]></title>\n";
             $sOut .= "<link><![CDATA[" . $this->sLink . "]]></link>\n";
             $sOut .= "<description><![CDATA[" . $this->sDescription . "]]></description>\n";
             foreach ($this->aoItems as $oItem) {
                 $sOut .= "<item>\n";
                 $sOut .= "<title><![CDATA[" . $oItem->getTitle() . "]]></title>\n";
                 $sOut .= "<link><![CDATA[" . $oItem->getLink() . "]]></link>\n";
                 $sOut .= "<author><![CDATA[" . $oItem->getAuthor() . "]]></author>\n";
                 $sOut .= "<description><![CDATA[" . $oItem->getDescription() . "]]></description>\n";
                 if ($oItem->getDate()) {
                     $sOut .= "<pubDate>" . date("D, d M Y H:i:s e", $oItem->getDate()) . "</pubDate>\n";
                 }
                 $sOut .= "</item>\n";
             }
             $sOut .= "</channel>\n";
             $sOut .= "</rss>";
             break;
     }
     $sOut = AnwUtils::stripUntr($sOut);
     //do output
     header("Content-type: application/rss+xml; charset=UTF-8");
     print $sOut;
     exit;
 }
Example #3
0
 function getContentFieldValues($sFieldName, $bStripUntr = false, $bDeprecatedParameter = -1)
 {
     if ($bDeprecatedParameter !== -1) {
         //TODO temporary check to remove
         print "usage of deprecated parameter for getContentFieldValues";
         exit;
     }
     //check that contentfield exists (or throw an exception)
     $oContentField = $this->getContentFieldsContainer()->getContentField($sFieldName);
     if (!$oContentField instanceof AnwStructuredContentField_atomic) {
         // you should use getSubContents instead...
         throw new AnwUnexpectedException("getContentFieldValues called on composed field");
     }
     //return contentfield's values
     if (isset($this->aasContentFieldsValues[$sFieldName])) {
         $asReturn = $this->aasContentFieldsValues[$sFieldName];
         if ($bStripUntr) {
             foreach ($asReturn as $i => $null) {
                 $asReturn[$i] = AnwUtils::stripUntr($asReturn[$i]);
             }
         }
     } else {
         AnwDebug::log("WARNING: returning default value for getContentFieldValues(" . $sFieldName . ")");
         $asReturn = $oContentField->getDefaultValues();
     }
     return $asReturn;
 }