1<?php
2
3/**
4 * PIECreator01 is a FeedCreator that implements the emerging PIE specification,
5 * as in http://intertwingly.net/wiki/pie/Syntax.
6 *
7 * @deprecated
8 * @since   1.3
9 * @author  Scott Reynen <scott@randomchaos.com> and Kai Blankenhorn <kaib@bitfolge.de>
10 */
11class PIECreator01 extends FeedCreator
12{
13
14    /**
15     * PIECreator01 constructor.
16     */
17    public function __construct()
18    {
19        $this->encoding = "utf-8";
20    }
21
22    /** @inheritdoc */
23    public function createFeed()
24    {
25        $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
26        $feed .= $this->_createStylesheetReferences();
27        $feed .= "<feed version=\"0.1\" xmlns=\"http://example.com/newformat#\">\n";
28        $feed .= "    <title>".FeedCreator::iTrunc(htmlspecialchars($this->title), 100)."</title>\n";
29        $feed .= "    <subtitle>".$this->getDescription()."</subtitle>\n";
30        $feed .= "    <link>".$this->link."</link>\n";
31        for ($i = 0; $i < count($this->items); $i++) {
32            $feed .= "    <entry>\n";
33            $feed .= "        <title>".FeedCreator::iTrunc(
34                    htmlspecialchars(strip_tags($this->items[$i]->title)),
35                    100
36                )."</title>\n";
37            $feed .= "        <link>".htmlspecialchars($this->items[$i]->link)."</link>\n";
38            $itemDate = new FeedDate($this->items[$i]->date);
39            $feed .= "        <created>".htmlspecialchars($itemDate->iso8601())."</created>\n";
40            $feed .= "        <issued>".htmlspecialchars($itemDate->iso8601())."</issued>\n";
41            $feed .= "        <modified>".htmlspecialchars($itemDate->iso8601())."</modified>\n";
42            $feed .= "        <id>".htmlspecialchars($this->items[$i]->guid)."</id>\n";
43            if ($this->items[$i]->author != "") {
44                $feed .= "        <author>\n";
45                $feed .= "            <name>".htmlspecialchars($this->items[$i]->author)."</name>\n";
46                if ($this->items[$i]->authorEmail != "") {
47                    $feed .= "            <email>".$this->items[$i]->authorEmail."</email>\n";
48                }
49                $feed .= "        </author>\n";
50            }
51            $feed .= "        <content type=\"text/html\" xml:lang=\"en-us\">\n";
52            $feed .= "            <div xmlns=\"http://www.w3.org/1999/xhtml\">".$this->items[$i]->getDescription(
53                )."</div>\n";
54            $feed .= "        </content>\n";
55            $feed .= "    </entry>\n";
56        }
57        $feed .= "</feed>\n";
58
59        return $feed;
60    }
61}
62