Skip to content

Commit

Permalink
Merged Nek-:master
Browse files Browse the repository at this point in the history
  • Loading branch information
yohang committed Aug 23, 2011
2 parents 61e0c89 + 7695a77 commit f5e3a7a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Factory/FeedFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Nekland\FeedBundle\Factory;


use Symfony\Component\DependencyInjection\ContainerAware;

use Nekland\FeedBundle\Feed;
Expand Down Expand Up @@ -83,5 +84,4 @@ protected function getRenderer($name)
throw new \InvalidArgumentException('Renderer '.$name.' doesn\'t exists');
}


}
6 changes: 4 additions & 2 deletions Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Feed implements \ArrayAccess, \Countable, \IteratorAggregate
* 'title' => 'My Rss title'
* 'description' => 'My Rss description'
* 'route' => 'My Rss site route' (home if not defined)
* @var array
* @var array $config
*/
protected $config;

Expand All @@ -29,6 +29,7 @@ public function __construct(array $config)
{
$this->config = $config;
$this->items = array();
$this->host = $host;
}

/**
Expand All @@ -50,6 +51,7 @@ public function add(ItemInterface $item)
return $this;
}


/**
* Removes an item by Id
*
Expand Down Expand Up @@ -167,7 +169,7 @@ public function count()
public function setConfig(array $config)
{
$this->config = $config;

return $this;
}

Expand Down
1 change: 1 addition & 0 deletions Item/ItemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function getDescription();
* Return the route of your item
* @return string|array with [0] => 'route_name', [1] => params
*/

public function getRoute();

/**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ TODO
Thank you to
-------------

* Yohan Giarelli <[email protected]> who work and help on this project
* Yohan Giarelli <[email protected]> who work and help on this project
47 changes: 27 additions & 20 deletions XML/XMLManager.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,54 @@

namespace Nekland\FeedBundle\XML;

class XMLManager {
class XMLManager
{
private $filename;
protected $xml;
private $new;

public function __construct($filename) {
public function __construct($filename)
{
$this->filename = $filename;
if($this->new = !file_exists($this->filename)) {

if ($this->new = !file_exists($this->filename)) {

$this->xml = new \DomDocument('1.0', 'utf-8');
} else {
$this->xml = new DomDocument();

$this->xml = new \DomDocument();
$this->xml->load($this->filename);
}
}

public function addTextNode($nodeName, $content, \DOMNode $parentNode) {

public function addTextNode($nodeName, $content, \DOMNode $parentNode)
{
$node = $this->xml->createElement($nodeName);
$node = $parentNode->appendChild($node);

$node_text = $this->xml->createTextNode($content);
$node->appendChild($node_text);

return $this;
}

public function getFilename() {

public function getFilename()
{
return $this->filename;
}

public function getXml() {

public function getXml()
{
return $this->xml;
}

public function isNew() {

public function isNew()
{
return $this->new;
}

public function save() {
return $this->xml->save($filename);

public function save()
{
return $this->xml->save($this->filename);
}
}

0 comments on commit f5e3a7a

Please sign in to comment.