Huge FML Update
This commit is contained in:
@ -2,8 +2,13 @@
|
||||
|
||||
namespace FML\Elements;
|
||||
|
||||
use FML\Types\BgColorable;
|
||||
use FML\Types\Renderable;
|
||||
use FML\Types\Styleable;
|
||||
use FML\Types\TextFormatable;
|
||||
|
||||
/**
|
||||
* Class representing a format
|
||||
* Format Element
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
@ -12,13 +17,97 @@ class Format implements BgColorable, Renderable, Styleable, TextFormatable {
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $tagName = 'format';
|
||||
protected $bgColor = '';
|
||||
protected $style = '';
|
||||
protected $textSize = -1;
|
||||
protected $textColor = '';
|
||||
protected $areaColor = '';
|
||||
protected $areaFocusColor = '';
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\BgColorable::setBgColor()
|
||||
* @return \FML\Elements\Format
|
||||
*/
|
||||
public function setBgColor($bgColor) {
|
||||
$this->bgColor = (string) $bgColor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Styleable::setStyle()
|
||||
* @return \FML\Elements\Format
|
||||
*/
|
||||
public function setStyle($style) {
|
||||
$this->style = (string) $style;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\TextFormatable::setTextSize()
|
||||
* @return \FML\Elements\Format
|
||||
*/
|
||||
public function setTextSize($textSize) {
|
||||
$this->textSize = (int) $textSize;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\TextFormatable::setTextColor()
|
||||
* @return \FML\Elements\Format
|
||||
*/
|
||||
public function setTextColor($textColor) {
|
||||
$this->textColor = (string) $textColor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\TextFormatable::setAreaColor()
|
||||
* @return \FML\Elements\Format
|
||||
*/
|
||||
public function setAreaColor($areaColor) {
|
||||
$this->areaColor = (string) $areaColor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\TextFormatable::setAreaFocusColor()
|
||||
* @return \FML\Elements\Format
|
||||
*/
|
||||
public function setAreaFocusColor($areaFocusColor) {
|
||||
$this->areaFocusColor = (string) $areaFocusColor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xml = $domDocument->createElement($this->tagName);
|
||||
return $xml;
|
||||
$xmlElement = $domDocument->createElement($this->tagName);
|
||||
if ($this->bgColor) {
|
||||
$xmlElement->setAttribute('bgcolor', $this->bgColor);
|
||||
}
|
||||
if ($this->style) {
|
||||
$xmlElement->setAttribute('style', $this->style);
|
||||
}
|
||||
if ($this->textSize >= 0) {
|
||||
$xmlElement->setAttribute('textsize', $this->textSize);
|
||||
}
|
||||
if ($this->textColor) {
|
||||
$xmlElement->setAttribute('textcolor', $this->textColor);
|
||||
}
|
||||
if ($this->areaColor) {
|
||||
$xmlElement->setAttribute('areacolor', $this->areaColor);
|
||||
}
|
||||
if ($this->areaFocusColor) {
|
||||
$xmlElement->setAttribute('areafocuscolor', $this->areaFocusColor);
|
||||
}
|
||||
return $xmlElement;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace FML\Elements;
|
||||
|
||||
use FML\Types\Renderable;
|
||||
|
||||
/**
|
||||
* Class representing include
|
||||
* Include Element
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
@ -11,17 +13,16 @@ class Including implements Renderable {
|
||||
/**
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $url = '';
|
||||
protected $tagName = 'include';
|
||||
protected $url = '';
|
||||
|
||||
/**
|
||||
* Set Url
|
||||
*
|
||||
* @param string $url
|
||||
* Include Url
|
||||
* @param string $url Include Url
|
||||
*/
|
||||
public function setUrl($url) {
|
||||
$this->url = $url;
|
||||
$this->url = (string) $url;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -29,10 +30,10 @@ class Including implements Renderable {
|
||||
* @see \FML\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xml = $domDocument->createElement($this->tagName);
|
||||
$xmlElement = $domDocument->createElement($this->tagName);
|
||||
if ($this->url) {
|
||||
$xml->setAttribute('url', $this->url);
|
||||
$xmlElement->setAttribute('url', $this->url);
|
||||
}
|
||||
return $xml;
|
||||
return $xmlElement;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace FML\Elements;
|
||||
|
||||
use FML\Types\Renderable;
|
||||
|
||||
/**
|
||||
* Class representing music
|
||||
* Music Element
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
@ -11,18 +13,17 @@ class Music implements Renderable {
|
||||
/**
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $data = '';
|
||||
protected $tagName = 'music';
|
||||
protected $data = '';
|
||||
|
||||
/**
|
||||
* Set Data Url
|
||||
*
|
||||
* @param string $data
|
||||
* Media Url
|
||||
* @param string $data Media Url
|
||||
* @return \FML\Elements\Music
|
||||
*/
|
||||
public function setData($data) {
|
||||
$this->data = $data;
|
||||
$this->data = (string) $data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -31,10 +32,10 @@ class Music implements Renderable {
|
||||
* @see \FML\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xml = $domDocument->createElement($this->tagName);
|
||||
$xmlElement = $domDocument->createElement($this->tagName);
|
||||
if ($this->data) {
|
||||
$xml->setAttribute('data', $this->data);
|
||||
$xmlElement->setAttribute('data', $this->data);
|
||||
}
|
||||
return $xml;
|
||||
return $xmlElement;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace FML\Elements;
|
||||
use FML\Types\Renderable;
|
||||
|
||||
/**
|
||||
* Class representing a manialink script tag with a simple script text
|
||||
* Class representing a ManiaLink Script Tag with a simple Script Text
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
@ -19,7 +19,7 @@ class SimpleScript implements Renderable {
|
||||
/**
|
||||
* Set Script Text
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $text The Complete Script Text
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function setText($text) {
|
||||
@ -32,9 +32,9 @@ class SimpleScript implements Renderable {
|
||||
* @see \FML\Types\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xml = $domDocument->createElement($this->tagName);
|
||||
$xmlElement = $domDocument->createElement($this->tagName);
|
||||
$scriptComment = $domDocument->createComment($this->text);
|
||||
$xml->appendChild($scriptComment);
|
||||
return $xml;
|
||||
$xmlElement->appendChild($scriptComment);
|
||||
return $xmlElement;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user