eliminate trailing whitespace, expand tabs

This commit is contained in:
Florian Schlichting committed 2016-12-30 08:52:44 +01:00
1 parent 063048802f
commit eb7f2edc0c
50 files changed
+475 -482

No files matched your search

+21 -21
View File
@@ -12,18 +12,18 @@ define('XHTML_XMLNS','http://www.w3.org/1999/xhtml');
* in a DAViCal way, and we have some huge limitations:
* - We *only* support Atom feeds.
* - We *only* support creating them.
*
*
* @author Andrew McMillan <andrew@morphoss.com>
*
*/
class AtomXHTMLContent /* extends XMLElement */ {
private $content_string;
function __construct($xhtml) {
$this->content_string = $xhtml;
}
function Render( $ignore1, $ignore2, $ignore3 ) {
return $this->content_string . "\n";
}
@@ -58,28 +58,28 @@ class AtomEntry {
$this->id = new XMLElement('id', rtrim($new_value,"\r\n"));
return $this->id;
}
public function setTitle( $new_value, $type = 'text' ) {
$this->title = new XMLElement('title', $new_value, array( 'type' => $type ));
return $this->title;
}
public static function setDate( $tagname, $epoch ) {
// e.g. 2010-12-26T17:49:16+13:00
return new XMLElement($tagname, date('Y-m-d\TH:i:sP',$epoch));
}
public function setDateModified( $epoch ) {
$this->updated = self::setDate('updated', $epoch);
return $this->updated;
}
public function setDateCreated( $epoch ) {
$node = self::setDate('published', $epoch);
$this->nodes[] = $node;
return $node;
}
public function setLink( $new_value, $type="text/calendar", $rel='alternate' ) {
return $this->addNode('link', $new_value, array( 'rel' => $rel, 'type' => $type ) );
}
@@ -95,7 +95,7 @@ class AtomEntry {
throw new Exception("AtomFeed::addAuthor(\$new_value) the \$new_value MUST be an array with at least a 'name' element. RFC4287-3.2");
}
public function addCategory( $new_value ) {
if ( is_array($new_value) && isset($new_value['term']) ) {
$category = $this->addNode('category', null, $new_value );
@@ -104,22 +104,22 @@ class AtomEntry {
throw new Exception("AtomFeed::addCategory(\$new_value) the \$new_value MUST be an array with at least a 'term' element, and potentially a 'scheme' and a 'label' element. RFC4287-4.2.2");
}
public function setDescription( $new_value, $type = 'text' ) {
return $this->addNode('summary', $new_value, array( 'type' => $type ) );
}
public function setContent( $new_value, $type = 'xhtml' ) {
$content = $this->addNode('content', null, array( 'type' => $type ) );
if ( $type == 'xhtml' ) {
$content->NewElement('div', array( new AtomXHTMLContent($new_value) ), array('xmlns' => XHTML_XMLNS));
}
else {
$content->SetContent($new_value);
$content->SetContent($new_value);
}
return $content;
}
public function addNode( $in_tag, $content=false, $attributes=false, $xmlns=null ) {
$node = new XMLElement($in_tag,$content,$attributes,$xmlns);
if ( !isset($node) ) return null;
@@ -170,17 +170,17 @@ class AtomFeed extends XMLDocument {
$this->id = $this->NewXMLElement('id', $new_value);
return $this->id;
}
public function setTitle( $new_value, $type = 'text' ) {
$this->title = $this->NewXMLElement('title', $new_value, array( 'type' => $type ));
return $this->title;
}
public function setDateModified( $epoch ) {
$this->updated = AtomEntry::setDate('updated', $epoch);
return $this->updated;
}
public function setLink( $new_value, $type="text/calendar", $rel='alternate' ) {
return $this->addNode('link', $new_value, array( 'rel' => $rel, 'type' => $type ) );
}
@@ -189,15 +189,15 @@ class AtomFeed extends XMLDocument {
/**
* Sets the feed link (rel=self), ignoring the parameter which is for
* compatibility with the Zend library API, although we use this for
* the Id, whereas they use the first link that is set.
* the Id, whereas they use the first link that is set.
* @param uri $new_value The link target
* @return XMLElement the node that was added.
* @return XMLElement the node that was added.
*/
public function setFeedLink( $new_value, $type = null ) {
$this->setId($new_value);
return $this->setLink($new_value , 'application/atom+xml', 'self' );
}
public function addAuthor( $new_value ) {
if ( is_array($new_value) && isset($new_value['name']) ) {
$author = $this->addNode('author' );
@@ -209,11 +209,11 @@ class AtomFeed extends XMLDocument {
throw new Exception("AtomFeed::addAuthor(\$new_value) the \$new_value MUST be an array with at leas a 'name' element. RFC4287-3.2");
}
public function setDescription( $new_value, $type = 'text' ) {
return $this->addNode('subtitle', $new_value, array( 'type' => $type ) );
}
public function addNode( $in_tag, $content=false, $attributes=false, $xmlns=null ) {
$node = $this->NewXMLElement($in_tag,$content,$attributes,$xmlns);
if ( !isset($node) ) return null;