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        $this->truncSize = 500;
30        $feed .= "    <subtitle>".$this->getDescription()."</subtitle>\n";
31        $feed .= "    <link>".$this->link."</link>\n";
32        for ($i = 0; $i < count($this->items); $i++) {
33            $feed .= "    <entry>\n";
34            $feed .= "        <title>".FeedCreator::iTrunc(
35                    htmlspecialchars(strip_tags($this->items[$i]->title)),
36                    100
37                )."</title>\n";
38            $feed .= "        <link>".htmlspecialchars($this->items[$i]->link)."</link>\n";
39            $itemDate = new FeedDate($this->items[$i]->date);
40            $feed .= "        <created>".htmlspecialchars($itemDate->iso8601())."</created>\n";
41            $feed .= "        <issued>".htmlspecialchars($itemDate->iso8601())."</issued>\n";
42            $feed .= "        <modified>".htmlspecialchars($itemDate->iso8601())."</modified>\n";
43            $feed .= "        <id>".htmlspecialchars($this->items[$i]->guid)."</id>\n";
44            if ($this->items[$i]->author != "") {
45                $feed .= "        <author>\n";
46                $feed .= "            <name>".htmlspecialchars($this->items[$i]->author)."</name>\n";
47                if ($this->items[$i]->authorEmail != "") {
48                    $feed .= "            <email>".$this->items[$i]->authorEmail."</email>\n";
49                }
50                $feed .= "        </author>\n";
51            }
52            $feed .= "        <content type=\"text/html\" xml:lang=\"en-us\">\n";
53            $feed .= "            <div xmlns=\"http://www.w3.org/1999/xhtml\">".$this->items[$i]->getDescription(
54                )."</div>\n";
55            $feed .= "        </content>\n";
56            $feed .= "    </entry>\n";
57        }
58        $feed .= "</feed>\n";
59
60        return $feed;
61    }
62}
63