Esempio n. 1
0
 function setTightness($tight_top, $tight_bot)
 {
     $this->_tight_top = $tight_top;
     $this->_tight_bot = $tight_bot;
     $first =& $this->firstTR();
     $last =& $this->lastTR();
     $first->setInClass('top', $tight_top);
     if (!empty($last)) {
         $last->setInClass('bottom', $tight_bot);
     } else {
         trigger_error(sprintf("no lastTR: %s", AsXML($this->_content[0])), E_USER_WARNING);
     }
 }
Esempio n. 2
0
 function format($changes)
 {
     global $request;
     include_once 'lib/RssWriter.php';
     $rss = new AtomFeed();
     // "channel" is called "feed" in atom
     $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
     extract($this->_args);
     $title = WIKI_NAME;
     $description = $this->title();
     if ($category) {
         $title = $category;
     } elseif ($pagematch) {
         $title = $pagematch;
     }
     $feed_props = array('title' => $description, 'link' => array('rel' => "alternate", 'type' => "text/html", 'href' => $rc_url), 'id' => md5($rc_url), 'modified' => Iso8601DateTime(time()), 'generator' => 'PhpWiki-' . PHPWIKI_VERSION, 'tagline' => '');
     $rss->feed($feed_props);
     $first = true;
     while ($rev = $changes->next()) {
         // enforce view permission
         if (mayAccessPage('view', $rev->_pagename)) {
             $props = $this->item_properties($rev);
             $rss->addItem($props, false, $this->pageURI($rev));
             if ($first) {
                 $this->setValidators($rev);
             }
             $first = false;
         }
     }
     $request->discardOutput();
     $rss->finish();
     //header("Content-Type: application/atom; charset=" . $GLOBALS['charset']);
     printf("\n<!-- Generated by PhpWiki-%s -->\n", PHPWIKI_VERSION);
     // Flush errors in comment, otherwise it's invalid XML.
     global $ErrorManager;
     if ($errors = $ErrorManager->getPostponedErrorsAsHTML()) {
         printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
     }
     $request->finish();
     // NORETURN!!!!
 }
Esempio n. 3
0
 function format($changes)
 {
     include_once 'lib/RssWriter2.php';
     $rss = new RssWriter2();
     $rss->channel($this->channel_properties());
     if ($props = $this->cloud_properties()) {
         $rss->cloud($props);
     }
     if ($props = $this->image_properties()) {
         $rss->image($props);
     }
     if ($props = $this->textinput_properties()) {
         $rss->textinput($props);
     }
     $first = true;
     while ($rev = $changes->next()) {
         // enforce view permission
         if (mayAccessPage('view', $rev->_pagename)) {
             $rss->addItem($this->item_properties($rev), $this->pageURI($rev));
             if ($first) {
                 $this->setValidators($rev);
             }
             $first = false;
         }
     }
     global $request;
     $request->discardOutput();
     $rss->finish();
     printf("\n<!-- Generated by PhpWiki-%s:\n%s-->\n", PHPWIKI_VERSION, $GLOBALS['RCS_IDS']);
     // Flush errors in comment, otherwise it's invalid XML.
     global $ErrorManager;
     if ($errors = $ErrorManager->getPostponedErrorsAsHTML()) {
         printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
     }
     $request->finish();
     // NORETURN!!!!
 }
Esempio n. 4
0
 /**
  * Return an HTMLified version of this error.
  */
 function asXML()
 {
     return AsXML($this->_getDetail());
 }
Esempio n. 5
0
 function printXML()
 {
     // Not all PHP's have vsprintf, so...
     $args[] = XmlElement::_quote((string) $this->_fs);
     foreach ($this->_args as $arg) {
         $args[] = AsXML($arg);
     }
     call_user_func_array('printf', $args);
 }
Esempio n. 6
0
 function asXML()
 {
     return AsXML($this->getContent());
 }
Esempio n. 7
0
/** Conditionally display content based of whether javascript is supported.
 *
 * This conditionally (on the client side) displays one of two alternate
 * contents depending on whether the client supports javascript.
 *
 * NOTE:
 * The content you pass as arguments to this function must be block-level.
 * (This is because the <noscript> tag is block-level.)
 *
 * @param mixed $if_content Content to display if the browser supports
 * javascript.
 *
 * @param mixed $else_content Content to display if the browser does
 * not support javascript.
 *
 * @return XmlContent
 */
function IfJavaScript($if_content = false, $else_content = false)
{
    $html = array();
    if ($if_content) {
        $xml = AsXML($if_content);
        $js = sprintf('document.write("%s");', addcslashes($xml, "..!@\\..ÿ"));
        $html[] = JavaScript($js);
    }
    if ($else_content) {
        $html[] = HTML::noscript(false, $else_content);
    }
    return HTML($html);
}