<?php
require_once 'Translator.php';
/**
* represents a single image entry within a rdf file.
*
* @author Michael Lessnau
* @version 0.1
*/
class RDFNodeImage {
/**
* @var $rdfAbout string contains the about attribute
*/
private $rdfAbout;
/**
* @var $title string contains the title text element
*/
private $title;
/**
* @var $url string contains the url text element
*/
private $url;
/**
* @var $link string contains the link text element
*/
private $link;
/**
* constructor
*/
public function __construct( ) {
$this->rdfAbout = '';
$this->title = '';
$this->url = '';
$this->link = '';
}
/**
* destructor
*/
public function __destruct( ) {
// nop
}
/**
* setting the class' attributes
*
* @param $name string attribute name
* @param $value mixed attribute value
*/
public function __set( $name, $value) {
switch( $name) {
case 'rdfAbout':
$this->rdfAbout = $value;
break;
case 'title':
$this->title = $value;
break;
case 'url':
$this->url = $value;
break;
case 'link':
$this->link = $value;
break;
}
}
/**
* access the class' attributes
*
* @param $name string attribute name
* @return string attribute value
*/
public function __get( $name) {
switch( $name) {
case 'rdfAbout':
return $this->rdfAbout;
case 'title':
return $this->title;
case 'url':
return $this->url;
case 'link':
return $this->link;
}
return false;
}
/**
* serialize the image data.
*
* @param $indent string indentation
* @return string serialized image data
*/
public function toString( $indent) {
$output = $indent . '<image rdf:about="' . Translator::encode( $this->rdfAbout) . '">' . "\n";
$output .= $indent . ' <title>' . Translator::encode( $this->title) . '</title>' . "\n";
$output .= $indent . ' <url>' . Translator::encode( $this->url) . '</url>' . "\n";
$output .= $indent . ' <link>' . Translator::encode( $this->link) . '</link>' . "\n";
$output .= $indent . '</image>' . "\n";
return $output;
}
};
?>