-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from splitbrain-forks/master
PSR1/2 reformatting
- Loading branch information
Showing
29 changed files
with
822 additions
and
618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
# PHP PSR-2 Coding Standards | ||
# http://www.php-fig.org/psr/psr-2/ | ||
|
||
root = true | ||
|
||
[*.php] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,95 @@ | ||
<?php | ||
|
||
/** | ||
* AtomCreator03 is a FeedCreator that implements the atom specification, | ||
* as in http://www.intertwingly.net/wiki/pie/FrontPage. | ||
* Please note that just by using AtomCreator03 you won't automatically | ||
* produce valid atom files. For example, you have to specify either an editor | ||
* for the feed or an author for every single feed item. | ||
* | ||
* Some elements have not been implemented yet. These are (incomplete list): | ||
* author URL, item author's email and URL, item contents, alternate links, | ||
* other link content types than text/html. Some of them may be created with | ||
* AtomCreator03::additionalElements. | ||
* | ||
* @see FeedCreator#additionalElements | ||
* @since 1.6 | ||
* @author Kai Blankenhorn <[email protected]>, Scott Reynen <[email protected]> | ||
* @see FeedCreator#additionalElements | ||
* @since 1.6 | ||
* @author Kai Blankenhorn <[email protected]>, Scott Reynen <[email protected]> | ||
* @package de.bitfolge.feedcreator | ||
*/ | ||
class AtomCreator03 extends FeedCreator { | ||
class AtomCreator03 extends FeedCreator | ||
{ | ||
|
||
/** | ||
* AtomCreator03 constructor. | ||
*/ | ||
public function __construct() { | ||
public function __construct() | ||
{ | ||
$this->contentType = "application/atom+xml"; | ||
$this->encoding = "utf-8"; | ||
} | ||
|
||
/** @inheritdoc */ | ||
public function createFeed() { | ||
public function createFeed() | ||
{ | ||
$feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; | ||
$feed.= $this->_createGeneratorComment(); | ||
$feed.= $this->_createStylesheetReferences(); | ||
$feed.= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\""; | ||
if ($this->format=='TOOLBAR') { | ||
$feed.= " xmlns:gtb=\"http://toolbar.google.com/custombuttons/\""; | ||
$feed .= $this->_createGeneratorComment(); | ||
$feed .= $this->_createStylesheetReferences(); | ||
$feed .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\""; | ||
if ($this->format == 'TOOLBAR') { | ||
$feed .= " xmlns:gtb=\"http://toolbar.google.com/custombuttons/\""; | ||
} | ||
if ($this->language!="") { | ||
$feed.= " xml:lang=\"".$this->language."\""; | ||
if ($this->language != "") { | ||
$feed .= " xml:lang=\"".$this->language."\""; | ||
} | ||
$feed.= ">\n"; | ||
$feed.= " <title>".htmlspecialchars($this->title)."</title>\n"; | ||
$feed.= " <tagline>".htmlspecialchars($this->description)."</tagline>\n"; | ||
$feed.= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->link)."\"/>\n"; | ||
$feed.= " <id>".htmlspecialchars($this->link)."</id>\n"; | ||
$feed .= ">\n"; | ||
$feed .= " <title>".htmlspecialchars($this->title)."</title>\n"; | ||
$feed .= " <tagline>".htmlspecialchars($this->description)."</tagline>\n"; | ||
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->link)."\"/>\n"; | ||
$feed .= " <id>".htmlspecialchars($this->link)."</id>\n"; | ||
$now = new FeedDate(); | ||
$feed.= " <modified>".htmlspecialchars($now->iso8601())."</modified>\n"; | ||
if ($this->editor!="") { | ||
$feed.= " <author>\n"; | ||
$feed.= " <name>".$this->editor."</name>\n"; | ||
if ($this->editorEmail!="") { | ||
$feed.= " <email>".$this->editorEmail."</email>\n"; | ||
$feed .= " <modified>".htmlspecialchars($now->iso8601())."</modified>\n"; | ||
if ($this->editor != "") { | ||
$feed .= " <author>\n"; | ||
$feed .= " <name>".$this->editor."</name>\n"; | ||
if ($this->editorEmail != "") { | ||
$feed .= " <email>".$this->editorEmail."</email>\n"; | ||
} | ||
$feed.= " </author>\n"; | ||
$feed .= " </author>\n"; | ||
} | ||
$feed.= " <generator>".FEEDCREATOR_VERSION."</generator>\n"; | ||
$feed.= $this->_createAdditionalElements($this->additionalElements, " "); | ||
for ($i=0;$i<count($this->items);$i++) { | ||
$feed.= " <entry>\n"; | ||
$feed.= " <title>".htmlspecialchars(strip_tags($this->items[$i]->title))."</title>\n"; | ||
$feed.= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars($this->items[$i]->link)."\"/>\n"; | ||
if ($this->items[$i]->date=="") { | ||
$feed .= " <generator>".FEEDCREATOR_VERSION."</generator>\n"; | ||
$feed .= $this->_createAdditionalElements($this->additionalElements, " "); | ||
for ($i = 0; $i < count($this->items); $i++) { | ||
$feed .= " <entry>\n"; | ||
$feed .= " <title>".htmlspecialchars(strip_tags($this->items[$i]->title))."</title>\n"; | ||
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"".htmlspecialchars( | ||
$this->items[$i]->link | ||
)."\"/>\n"; | ||
if ($this->items[$i]->date == "") { | ||
$this->items[$i]->date = time(); | ||
} | ||
$itemDate = new FeedDate($this->items[$i]->date); | ||
$feed.= " <created>".htmlspecialchars($itemDate->iso8601())."</created>\n"; | ||
$feed.= " <issued>".htmlspecialchars($itemDate->iso8601())."</issued>\n"; | ||
$feed.= " <modified>".htmlspecialchars($itemDate->iso8601())."</modified>\n"; | ||
$feed.= " <id>".htmlspecialchars($this->items[$i]->link)."</id>\n"; | ||
$feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " "); | ||
if ($this->items[$i]->author!="") { | ||
$feed.= " <author>\n"; | ||
$feed.= " <name>".htmlspecialchars($this->items[$i]->author)."</name>\n"; | ||
$feed.= " </author>\n"; | ||
$feed .= " <created>".htmlspecialchars($itemDate->iso8601())."</created>\n"; | ||
$feed .= " <issued>".htmlspecialchars($itemDate->iso8601())."</issued>\n"; | ||
$feed .= " <modified>".htmlspecialchars($itemDate->iso8601())."</modified>\n"; | ||
$feed .= " <id>".htmlspecialchars($this->items[$i]->link)."</id>\n"; | ||
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, " "); | ||
if ($this->items[$i]->author != "") { | ||
$feed .= " <author>\n"; | ||
$feed .= " <name>".htmlspecialchars($this->items[$i]->author)."</name>\n"; | ||
$feed .= " </author>\n"; | ||
} | ||
if ($this->items[$i]->description!="") { | ||
$feed.= " <summary>".htmlspecialchars($this->items[$i]->description)."</summary>\n"; | ||
if ($this->items[$i]->description != "") { | ||
$feed .= " <summary>".htmlspecialchars($this->items[$i]->description)."</summary>\n"; | ||
} | ||
if (isset($this->items[$i]->thumbdata)) { | ||
$feed.= " <gtb:icon mode=\"base64\" type=\"image/jpeg\">\n"; | ||
$feed.= chunk_split(base64_encode($this->items[$i]->thumbdata))."\n"; | ||
$feed.= " </gtb:icon>\n"; | ||
$feed .= " <gtb:icon mode=\"base64\" type=\"image/jpeg\">\n"; | ||
$feed .= chunk_split(base64_encode($this->items[$i]->thumbdata))."\n"; | ||
$feed .= " </gtb:icon>\n"; | ||
} | ||
$feed.= " </entry>\n"; | ||
$feed .= " </entry>\n"; | ||
} | ||
$feed.= "</feed>\n"; | ||
$feed .= "</feed>\n"; | ||
|
||
return $feed; | ||
} | ||
} |
Oops, something went wrong.