FML Update

This commit is contained in:
Steffen Schröder
2014-06-21 03:18:21 +02:00
parent 816ff486ef
commit c8d599189c
107 changed files with 2484 additions and 3099 deletions

View File

@@ -11,174 +11,167 @@ namespace FML\Elements;
*/
class Dico {
/**
* Czech Language
* Czech language
*
* @var string
*/
const LANG_CZECH = 'cz';
/**
* Danish Language
* Danish language
*
* @var string
*/
const LANG_DANISH = 'da';
/**
* German Language
* German language
*
* @var string
*/
const LANG_GERMAN = 'de';
/**
* English Language
* English language
*
* @var string
*/
const LANG_ENGLISH = 'en';
/**
* Spanish Language
* Spanish language
*
* @var string
*/
const LANG_SPANISH = 'es';
/**
* French Language
* French language
*
* @var string
*/
const LANG_FRENCH = 'fr';
/**
* Hungarian Language
* Hungarian language
*
* @var string
*/
const LANG_HUNGARIAN = 'hu';
/**
* Italian Language
* Italian language
*
* @var string
*/
const LANG_ITALIAN = 'it';
/**
* Japanese Language
* Japanese language
*
* @var string
*/
const LANG_JAPANESE = 'jp';
/**
* Korean Language
* Korean language
*
* @var string
*/
const LANG_KOREAN = 'kr';
/**
* Norwegian Language
* Norwegian language
*
* @var string
*/
const LANG_NORWEGIAN = 'nb';
/**
* Dutch Language
* Dutch language
*
* @var string
*/
const LANG_DUTCH = 'nl';
/**
* Polish Language
* Polish language
*
* @var string
*/
const LANG_POLISH = 'pl';
/**
* Portuguese Language
* Portuguese language
*
* @var string
*/
const LANG_PORTUGUESE = 'pt';
/**
* Brazilian Portuguese Language
* Brazilian Portuguese language
*
* @var string
*/
const LANG_BRAZILIAN_PORTUGUESE = 'pt_BR';
/**
* Romanian Language
* Romanian language
*
* @var string
*/
const LANG_ROMANIAN = 'ro';
/**
* Russian Language
* Russian language
*
* @var string
*/
const LANG_RUSSIAN = 'ru';
/**
* Slovak Language
* Slovak language
*
* @var string
*/
const LANG_SLOVAK = 'sk';
/**
* Turkish Language
* Turkish language
*
* @var string
*/
const LANG_TURKISH = 'tr';
/**
* Chinese Language
* Chinese language
*
* @var string
*/
const LANG_CHINESE = 'zh';
/*
* Protected Properties
* Protected properties
*/
protected $tagName = 'dico';
protected $entries = array();
/**
* Create a new Dictionary Object
* Create a new Dictionary object
*
* @return \FML\Elements\Dico
* @return \FML\Elements\Dico|static
*/
public static function create() {
$dico = new Dico();
return $dico;
return new static();
}
/**
* Construct a new Dictionary Object
*/
public function __construct() {
}
/**
* Set the translatable Entry for the specific Language
* Set the translatable entry for the specific language
*
* @param string $language Language Id
* @param string $entryId Entry Id
* @param string $entryValue Translated Entry Value
* @return \FML\Elements\Dico
* @param string $language Language id
* @param string $entryId Entry id
* @param string $entryValue Translated entry value
* @return \FML\Elements\Dico|static
*/
public function setEntry($language, $entryId, $entryValue) {
$language = (string)$language;
@@ -198,11 +191,11 @@ class Dico {
}
/**
* Remove Entries of the given Id
* Remove entries of the given id
*
* @param string $entryId Entry Id that should be removed
* @param string $language (optional) Only remove Entries of the given Language
* @return \FML\Elements\Dico
* @param string $entryId Entry id that should be removed
* @param string $language (optional) Only remove entries of the given language
* @return \FML\Elements\Dico|static
*/
public function removeEntry($entryId, $language = null) {
$entryId = (string)$entryId;
@@ -222,11 +215,11 @@ class Dico {
}
/**
* Remove Entries of the given Language
* Remove entries of the given language
*
* @param string $language Language of which all Entries should be removed
* @param string $entryId (optional) Only remove the given Entry Id
* @return \FML\Elements\Dico
* @param string $language Language which entries should be removed
* @param string $entryId (optional) Only remove the given entry id
* @return \FML\Elements\Dico|static
*/
public function removeLanguage($language, $entryId = null) {
$language = (string)$language;
@@ -242,9 +235,9 @@ class Dico {
}
/**
* Remove all Entries from the Dictionary
* Remove all entries from the Dictionary
*
* @return \FML\Elements\Dico
* @return \FML\Elements\Dico|static
*/
public function removeEntries() {
$this->entries = array();
@@ -252,9 +245,9 @@ class Dico {
}
/**
* Render the Dico XML Element
* Render the Dico XML element
*
* @param \DOMDocument $domDocument DomDocument for which the Dico XML Element should be rendered
* @param \DOMDocument $domDocument DOMDocument for which the Dico XML element should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument) {

View File

@@ -16,30 +16,23 @@ use FML\Types\TextFormatable;
*/
class Format implements BgColorable, Renderable, Styleable, TextFormatable {
/*
* Protected Properties
* Protected properties
*/
protected $tagName = 'format';
protected $bgColor = '';
protected $style = '';
protected $bgColor = null;
protected $style = null;
protected $textSize = -1;
protected $textColor = '';
protected $focusAreaColor1 = '';
protected $focusAreaColor2 = '';
protected $textColor = null;
protected $focusAreaColor1 = null;
protected $focusAreaColor2 = null;
/**
* Create a new Format Element
*
* @return \FML\Elements\Format
* @return \FML\Elements\Format|static
*/
public static function create() {
$format = new Format();
return $format;
}
/**
* Construct a new Format Element
*/
public function __construct() {
return new static();
}
/**

View File

@@ -4,6 +4,7 @@ namespace FML\Elements;
use FML\Types\Container;
use FML\Types\Renderable;
use FML\UniqueID;
/**
* Class representing a Frame Model
@@ -14,42 +15,43 @@ use FML\Types\Renderable;
*/
class FrameModel implements Container, Renderable {
/*
* Protected Properties
* Protected properties
*/
protected $tagName = 'framemodel';
protected $id = '';
protected $modelId = null;
/** @var Renderable[] $children */
protected $children = array();
/** @var Format $format */
protected $format = null;
/**
* Set Model Id
* Set Model id
*
* @param string $id Model Id
* @return \FML\Elements\FrameModel
* @param string $modelId Model id
* @return \FML\Elements\FrameModel|static
*/
public function setId($id) {
$this->id = (string)$id;
public function setId($modelId) {
$this->modelId = (string)$modelId;
return $this;
}
/**
* Get Model Id
* Get Model id
*
* @return string
*/
public function getId() {
return $this->id;
return $this->modelId;
}
/**
* Assign an Id if necessary
* Assign an id if necessary
*
* @return string
*/
public function checkId() {
if (!$this->id) {
$this->id = uniqid();
if (!$this->modelId) {
$this->setId(new UniqueID());
}
return $this;
}
@@ -102,7 +104,6 @@ class FrameModel implements Container, Renderable {
$xmlElement->appendChild($formatXml);
}
foreach ($this->children as $child) {
/** @var Renderable $child */
$childElement = $child->render($domDocument);
$xmlElement->appendChild($childElement);
}

View File

@@ -13,40 +13,41 @@ use FML\Types\Renderable;
*/
class Including implements Renderable {
/*
* Protected Properties
* Protected properties
*/
protected $tagName = 'include';
protected $url = '';
protected $url = null;
/**
* Construct a new Include Element
* Create a new Include object
*
* @param string $url (optional) Include Url
* @return \FML\Elements\Including
* @param string $url (optional) Include url
* @return \FML\Elements\Including|static
*/
public static function create($url = null) {
$including = new Including($url);
return $including;
return new static($url);
}
/**
* Construct a new Include Element
* Construct a new Include object
*
* @param string $url (optional) Include Url
* @param string $url (optional) Include url
*/
public function __construct($url = null) {
if ($url !== null) {
if (!is_null($url)) {
$this->setUrl($url);
}
}
/**
* Set Url
* Set url
*
* @param string $url Include Url
* @param string $url Include url
* @return \FML\Elements\Including|static
*/
public function setUrl($url) {
$this->url = (string)$url;
return $this;
}
/**

View File

@@ -13,38 +13,37 @@ use FML\Types\Renderable;
*/
class Music implements Renderable {
/*
* Protected Properties
* Protected properties
*/
protected $tagName = 'music';
protected $data = '';
protected $data = null;
/**
* Create a new Music Element
* Create a new Music object
*
* @param string $data (optional) Media Url
* @return \FML\Elements\Music
* @param string $data (optional) Media url
* @return \FML\Elements\Music|static
*/
public static function create($data = null) {
$music = new Music($data);
return $music;
return new static($data);
}
/**
* Construct a new Music Element
* Construct a new Music object
*
* @param string $data (optional) Media Url
* @param string $data (optional) Media url
*/
public function __construct($data = null) {
if ($data !== null) {
if (!is_null($data)) {
$this->setData($data);
}
}
/**
* Set Data Url
* Set data url
*
* @param string $data Media Url
* @return \FML\Elements\Music
* @param string $data Data url
* @return \FML\Elements\Music|static
*/
public function setData($data) {
$this->data = (string)$data;

View File

@@ -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 <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
@@ -13,38 +13,37 @@ use FML\Types\Renderable;
*/
class SimpleScript implements Renderable {
/*
* Protected Properties
* Protected properties
*/
protected $tagName = 'script';
protected $text = '';
protected $text = null;
/**
* Create a new SimpleScript Element
* Create a new SimpleScript object
*
* @param string $text (optional) Script Text
* @return \FML\Elements\SimpleScript
* @param string $text (optional) Script text
* @return \FML\Elements\SimpleScript|static
*/
public static function create($text = null) {
$simpleScript = new SimpleScript($text);
return $simpleScript;
return new static($text);
}
/**
* Construct a new SimpleScript Element
* Construct a new SimpleScript object
*
* @param string $text (optional) Script Text
* @param string $text (optional) Script text
*/
public function __construct($text = null) {
if ($text !== null) {
if (!is_null($text)) {
$this->setText($text);
}
}
/**
* Set Script Text
* Set script text
*
* @param string $text The Complete Script Text
* @return \FML\Script\Script
* @param string $text Complete script text
* @return \FML\Script\Script|static
*/
public function setText($text) {
$this->text = (string)$text;