Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
svenhoutmeyers committed Mar 24, 2014
2 parents 659939b + 5c31abb commit e547c9e
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
16 changes: 16 additions & 0 deletions lib/CultureFeed/Cdb/Data/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ public function byMediaType($type) {

return $media;
}


/**
* @return self
*/
public function byMediaTypes($types) {
$media = new self();

foreach ($this->details as $file) {
if (in_array($file->getMediaType(), $types)) {
$media->add($file);
}
}

return $media;
}

public function count() {
return count($this->details);
Expand Down
85 changes: 84 additions & 1 deletion lib/CultureFeed/Cdb/Item/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class CultureFeed_Cdb_Item_Page implements CultureFeed_Cdb_IElement {
* @var string[]
*/
protected $categories;

/**
* Keywords of the page.
* @var string[]
*/
protected $keywords;

/**
* Description of the page.
Expand Down Expand Up @@ -60,6 +66,12 @@ class CultureFeed_Cdb_Item_Page implements CultureFeed_Cdb_IElement {
* @var String url
*/
protected $image;

/**
* Cover of this page.
* @var String url
*/
protected $cover;

/**
* Indicates whether the page is visible.
Expand All @@ -71,6 +83,12 @@ class CultureFeed_Cdb_Item_Page implements CultureFeed_Cdb_IElement {
* @var CultureFeed_Cdb_Data_PagePermissions
*/
protected $permissions = NULL;

/**
* Tagline of the page.
* @var string
*/
protected $tagline;

/**
* Get the id of this page.
Expand All @@ -95,6 +113,14 @@ public function getName() {
public function getImage() {
return $this->image;
}

/**
* Get the cover of this page.
* @return string
*/
public function getCover() {
return $this->cover;
}

/**
* Get the categories of this page.
Expand All @@ -103,6 +129,14 @@ public function getImage() {
public function getCategories() {
return $this->categories;
}

/**
* Get the keywords of this page.
* @return string[]
*/
public function getKeywords() {
return $this->keywords;
}

/**
* Get the description of this page.
Expand Down Expand Up @@ -166,7 +200,15 @@ public function getPermissions() {
public function isVisible() {
return $this->getVisibility();
}


/**
* Get the tagline of this page.
* @return string
*/
public function getTagline() {
return $this->tagline;
}

/**
* Set the id.
* @param string $id
Expand All @@ -190,6 +232,14 @@ public function setName($name) {
public function setImage($image) {
$this->image = $image;
}

/**
* Set the cover of this page.
* @param string $cover
*/
public function setCover($cover) {
$this->cover = $cover;
}

/**
* Set the categories of the page.
Expand All @@ -198,6 +248,14 @@ public function setImage($image) {
public function setCategories($categories) {
$this->categories = $categories;
}

/**
* Set the keywords of the page.
* @param array $keywords
*/
public function setKeywords($keywords) {
$this->keywords = $keywords;
}

/**
* Set the description of the page.
Expand Down Expand Up @@ -254,6 +312,14 @@ public function setVisibility($visible) {
public function setPermissions($permissions) {
$this->permissions = $permissions;
}

/**
* Set the name of this page.
* @param string $name
*/
public function setTagline($tagline) {
$this->tagline = $tagline;
}

/**
* @see CultureFeed_Cdb_IElement::appendToDOM()
Expand Down Expand Up @@ -289,6 +355,15 @@ public static function parseFromCdbXml(SimpleXMLElement $xmlElement) {
}
}
$page->setCategories($categories);

// Set keywords
$keywords = array();
if (!empty($xmlElement->keywords->keyword)) {
foreach ($xmlElement->keywords->keyword as $keyword) {
$keywords[] = (string) $keyword;
}
}
$page->setKeywords($keywords);

// Set description.
if (!empty($xmlElement->description)) {
Expand All @@ -299,6 +374,11 @@ public static function parseFromCdbXml(SimpleXMLElement $xmlElement) {
if (!empty($xmlElement->image)) {
$page->setImage((string) $xmlElement->image);
}

// Set the cover.
if (!empty($xmlElement->cover)) {
$page->setCover((string) $xmlElement->cover);
}

// Set the visibility.
if (!empty($xmlElement->visible)) {
Expand Down Expand Up @@ -373,6 +453,9 @@ public static function parseFromCdbXml(SimpleXMLElement $xmlElement) {

// Set the permissions.
$page->setPermissions(CultureFeed_Cdb_Data_PagePermissions::parseFromCdbXml($xmlElement->permissions));

// Set tagline.
$page->setTagline((string) $xmlElement->tagline);

return $page;

Expand Down

0 comments on commit e547c9e

Please sign in to comment.