Skip to content

Commit 6261e13

Browse files
authored
Merge pull request #3 from splitbrain-forks/master
PSR1/2 reformatting
2 parents 6a75dbf + 3707dc5 commit 6261e13

29 files changed

+822
-618
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# PHP PSR-2 Coding Standards
5+
# http://www.php-fig.org/psr/psr-2/
6+
7+
root = true
8+
9+
[*.php]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = space
15+
indent_size = 4
16+

lib/Creator/AtomCreator03.php

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,95 @@
11
<?php
2+
23
/**
34
* AtomCreator03 is a FeedCreator that implements the atom specification,
45
* as in http://www.intertwingly.net/wiki/pie/FrontPage.
56
* Please note that just by using AtomCreator03 you won't automatically
67
* produce valid atom files. For example, you have to specify either an editor
78
* for the feed or an author for every single feed item.
8-
*
99
* Some elements have not been implemented yet. These are (incomplete list):
1010
* author URL, item author's email and URL, item contents, alternate links,
1111
* other link content types than text/html. Some of them may be created with
1212
* AtomCreator03::additionalElements.
1313
*
14-
* @see FeedCreator#additionalElements
15-
* @since 1.6
16-
* @author Kai Blankenhorn <kaib@bitfolge.de>, Scott Reynen <scott@randomchaos.com>
14+
* @see FeedCreator#additionalElements
15+
* @since 1.6
16+
* @author Kai Blankenhorn <kaib@bitfolge.de>, Scott Reynen <scott@randomchaos.com>
1717
* @package de.bitfolge.feedcreator
1818
*/
19-
class AtomCreator03 extends FeedCreator {
19+
class AtomCreator03 extends FeedCreator
20+
{
2021

2122
/**
2223
* AtomCreator03 constructor.
2324
*/
24-
public function __construct() {
25+
public function __construct()
26+
{
2527
$this->contentType = "application/atom+xml";
2628
$this->encoding = "utf-8";
2729
}
2830

2931
/** @inheritdoc */
30-
public function createFeed() {
32+
public function createFeed()
33+
{
3134
$feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
32-
$feed.= $this->_createGeneratorComment();
33-
$feed.= $this->_createStylesheetReferences();
34-
$feed.= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\"";
35-
if ($this->format=='TOOLBAR') {
36-
$feed.= " xmlns:gtb=\"http://toolbar.google.com/custombuttons/\"";
35+
$feed .= $this->_createGeneratorComment();
36+
$feed .= $this->_createStylesheetReferences();
37+
$feed .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\"";
38+
if ($this->format == 'TOOLBAR') {
39+
$feed .= " xmlns:gtb=\"http://toolbar.google.com/custombuttons/\"";
3740
}
38-
if ($this->language!="") {
39-
$feed.= " xml:lang=\"".$this->language."\"";
41+
if ($this->language != "") {
42+
$feed .= " xml:lang=\"".$this->language."\"";
4043
}
41-
$feed.= ">\n";
42-
$feed.= " <title>".htmlspecialchars($this->title)."</title>\n";
43-
$feed.= " <tagline>".htmlspecialchars($this->description)."</tagline>\n";
44-
$feed.= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->link)."\"/>\n";
45-
$feed.= " <id>".htmlspecialchars($this->link)."</id>\n";
44+
$feed .= ">\n";
45+
$feed .= " <title>".htmlspecialchars($this->title)."</title>\n";
46+
$feed .= " <tagline>".htmlspecialchars($this->description)."</tagline>\n";
47+
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->link)."\"/>\n";
48+
$feed .= " <id>".htmlspecialchars($this->link)."</id>\n";
4649
$now = new FeedDate();
47-
$feed.= " <modified>".htmlspecialchars($now->iso8601())."</modified>\n";
48-
if ($this->editor!="") {
49-
$feed.= " <author>\n";
50-
$feed.= " <name>".$this->editor."</name>\n";
51-
if ($this->editorEmail!="") {
52-
$feed.= " <email>".$this->editorEmail."</email>\n";
50+
$feed .= " <modified>".htmlspecialchars($now->iso8601())."</modified>\n";
51+
if ($this->editor != "") {
52+
$feed .= " <author>\n";
53+
$feed .= " <name>".$this->editor."</name>\n";
54+
if ($this->editorEmail != "") {
55+
$feed .= " <email>".$this->editorEmail."</email>\n";
5356
}
54-
$feed.= " </author>\n";
57+
$feed .= " </author>\n";
5558
}
56-
$feed.= " <generator>".FEEDCREATOR_VERSION."</generator>\n";
57-
$feed.= $this->_createAdditionalElements($this->additionalElements, " ");
58-
for ($i=0;$i<count($this->items);$i++) {
59-
$feed.= " <entry>\n";
60-
$feed.= " <title>".htmlspecialchars(strip_tags($this->items[$i]->title))."</title>\n";
61-
$feed.= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->items[$i]->link)."\"/>\n";
62-
if ($this->items[$i]->date=="") {
59+
$feed .= " <generator>".FEEDCREATOR_VERSION."</generator>\n";
60+
$feed .= $this->_createAdditionalElements($this->additionalElements, " ");
61+
for ($i = 0; $i < count($this->items); $i++) {
62+
$feed .= " <entry>\n";
63+
$feed .= " <title>".htmlspecialchars(strip_tags($this->items[$i]->title))."</title>\n";
64+
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars(
65+
$this->items[$i]->link
66+
)."\"/>\n";
67+
if ($this->items[$i]->date == "") {
6368
$this->items[$i]->date = time();
6469
}
6570
$itemDate = new FeedDate($this->items[$i]->date);
66-
$feed.= " <created>".htmlspecialchars($itemDate->iso8601())."</created>\n";
67-
$feed.= " <issued>".htmlspecialchars($itemDate->iso8601())."</issued>\n";
68-
$feed.= " <modified>".htmlspecialchars($itemDate->iso8601())."</modified>\n";
69-
$feed.= " <id>".htmlspecialchars($this->items[$i]->link)."</id>\n";
70-
$feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
71-
if ($this->items[$i]->author!="") {
72-
$feed.= " <author>\n";
73-
$feed.= " <name>".htmlspecialchars($this->items[$i]->author)."</name>\n";
74-
$feed.= " </author>\n";
71+
$feed .= " <created>".htmlspecialchars($itemDate->iso8601())."</created>\n";
72+
$feed .= " <issued>".htmlspecialchars($itemDate->iso8601())."</issued>\n";
73+
$feed .= " <modified>".htmlspecialchars($itemDate->iso8601())."</modified>\n";
74+
$feed .= " <id>".htmlspecialchars($this->items[$i]->link)."</id>\n";
75+
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
76+
if ($this->items[$i]->author != "") {
77+
$feed .= " <author>\n";
78+
$feed .= " <name>".htmlspecialchars($this->items[$i]->author)."</name>\n";
79+
$feed .= " </author>\n";
7580
}
76-
if ($this->items[$i]->description!="") {
77-
$feed.= " <summary>".htmlspecialchars($this->items[$i]->description)."</summary>\n";
81+
if ($this->items[$i]->description != "") {
82+
$feed .= " <summary>".htmlspecialchars($this->items[$i]->description)."</summary>\n";
7883
}
7984
if (isset($this->items[$i]->thumbdata)) {
80-
$feed.= " <gtb:icon mode=\"base64\" type=\"image/jpeg\">\n";
81-
$feed.= chunk_split(base64_encode($this->items[$i]->thumbdata))."\n";
82-
$feed.= " </gtb:icon>\n";
85+
$feed .= " <gtb:icon mode=\"base64\" type=\"image/jpeg\">\n";
86+
$feed .= chunk_split(base64_encode($this->items[$i]->thumbdata))."\n";
87+
$feed .= " </gtb:icon>\n";
8388
}
84-
$feed.= " </entry>\n";
89+
$feed .= " </entry>\n";
8590
}
86-
$feed.= "</feed>\n";
91+
$feed .= "</feed>\n";
92+
8793
return $feed;
8894
}
8995
}

0 commit comments

Comments
 (0)