FML Update

This commit is contained in:
Steffen Schröder
2014-05-18 19:45:50 +02:00
parent 31cba03bba
commit 4194f99c2a
45 changed files with 922 additions and 598 deletions

View File

@ -5,9 +5,9 @@ namespace FML\Elements;
/**
* Dictionary Element
*
* @author steeffeen
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Dico {
/**
@ -16,140 +16,140 @@ class Dico {
* @var string
*/
const LANG_CZECH = 'cz';
/**
* Danish Language
*
* @var string
*/
const LANG_DANISH = 'da';
/**
* German Language
*
* @var string
*/
const LANG_GERMAN = 'de';
/**
* English Language
*
* @var string
*/
const LANG_ENGLISH = 'en';
/**
* Spanish Language
*
* @var string
*/
const LANG_SPANISH = 'es';
/**
* French Language
*
* @var string
*/
const LANG_FRENCH = 'fr';
/**
* Hungarian Language
*
* @var string
*/
const LANG_HUNGARIAN = 'hu';
/**
* Italian Language
*
* @var string
*/
const LANG_ITALIAN = 'it';
/**
* Japanese Language
*
* @var string
*/
const LANG_JAPANESE = 'jp';
/**
* Korean Language
*
* @var string
*/
const LANG_KOREAN = 'kr';
/**
* Norwegian Language
*
* @var string
*/
const LANG_NORWEGIAN = 'nb';
/**
* Dutch Language
*
* @var string
*/
const LANG_DUTCH = 'nl';
/**
* Polish Language
*
* @var string
*/
const LANG_POLISH = 'pl';
/**
* Portuguese Language
*
* @var string
*/
const LANG_PORTUGUESE = 'pt';
/**
* Brazilian Portuguese Language
*
* @var string
*/
const LANG_BRAZILIAN_PORTUGUESE = 'pt_BR';
/**
* Romanian Language
*
* @var string
*/
const LANG_ROMANIAN = 'ro';
/**
* Russian Language
*
* @var string
*/
const LANG_RUSSIAN = 'ru';
/**
* Slovak Language
*
* @var string
*/
const LANG_SLOVAK = 'sk';
/**
* Turkish Language
*
* @var string
*/
const LANG_TURKISH = 'tr';
/**
* Chinese Language
*
* @var string
*/
const LANG_CHINESE = 'zh';
/*
* Protected Properties
*/
@ -175,22 +175,21 @@ class Dico {
/**
* Set the translatable Entry for the specific Language
*
* @param string $language Language Id
* @param string $entryId Entry Id
* @param string $language Language Id
* @param string $entryId Entry Id
* @param string $entryValue Translated Entry Value
* @return \FML\Elements\Dico
*/
public function setEntry($language, $entryId, $entryValue) {
$language = (string) $language;
$entryId = (string) $entryId;
$entryValue = (string) $entryValue;
$language = (string)$language;
$entryId = (string)$entryId;
$entryValue = (string)$entryValue;
if (!isset($this->entries[$language]) && $entryValue) {
$this->entries[$language] = array();
}
if ($entryValue) {
$this->entries[$language][$entryId] = $entryValue;
}
else {
} else {
if (isset($this->entries[$language][$entryId])) {
unset($this->entries[$language][$entryId]);
}
@ -201,19 +200,18 @@ class Dico {
/**
* Remove Entries of the given Id
*
* @param string $entryId Entry Id that should be removed
* @param string $entryId Entry Id that should be removed
* @param string $language (optional) Only remove Entries of the given Language
* @return \FML\Elements\Dico
*/
public function removeEntry($entryId, $language = null) {
$entryId = (string) $entryId;
$entryId = (string)$entryId;
if ($language) {
$language = (string) $language;
$language = (string)$language;
if (isset($this->entries[$language])) {
unset($this->entries[$language][$entryId]);
}
}
else {
} else {
foreach ($this->entries as $language => $entries) {
if (isset($entries[$entryId])) {
unset($entries[$language][$entryId]);
@ -227,17 +225,16 @@ class Dico {
* 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
* @param string $entryId (optional) Only remove the given Entry Id
* @return \FML\Elements\Dico
*/
public function removeLanguage($language, $entryId = null) {
$language = (string) $language;
$language = (string)$language;
if (isset($this->entries[$language])) {
if ($entryId) {
$entryId = (string) $entryId;
$entryId = (string)$entryId;
unset($this->entries[$language][$entryId]);
}
else {
} else {
unset($this->entries[$language]);
}
}

View File

@ -10,9 +10,9 @@ use FML\Types\TextFormatable;
/**
* Format Element
*
* @author steeffeen
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Format implements BgColorable, Renderable, Styleable, TextFormatable {
/*
@ -43,61 +43,54 @@ class Format implements BgColorable, Renderable, Styleable, TextFormatable {
}
/**
*
* @see \FML\Types\BgColorable::setBgColor()
*/
public function setBgColor($bgColor) {
$this->bgColor = (string) $bgColor;
$this->bgColor = (string)$bgColor;
return $this;
}
/**
*
* @see \FML\Types\Styleable::setStyle()
*/
public function setStyle($style) {
$this->style = (string) $style;
$this->style = (string)$style;
return $this;
}
/**
*
* @see \FML\Types\TextFormatable::setTextSize()
*/
public function setTextSize($textSize) {
$this->textSize = (int) $textSize;
$this->textSize = (int)$textSize;
return $this;
}
/**
*
* @see \FML\Types\TextFormatable::setTextColor()
*/
public function setTextColor($textColor) {
$this->textColor = (string) $textColor;
$this->textColor = (string)$textColor;
return $this;
}
/**
*
* @see \FML\Types\TextFormatable::setAreaColor()
*/
public function setAreaColor($areaColor) {
$this->focusAreaColor1 = (string) $areaColor;
$this->focusAreaColor1 = (string)$areaColor;
return $this;
}
/**
*
* @see \FML\Types\TextFormatable::setAreaFocusColor()
*/
public function setAreaFocusColor($areaFocusColor) {
$this->focusAreaColor2 = (string) $areaFocusColor;
$this->focusAreaColor2 = (string)$areaFocusColor;
return $this;
}
/**
*
* @see \FML\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {

View File

@ -7,9 +7,9 @@ use FML\Types\Renderable;
/**
* Include Element
*
* @author steeffeen
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Including implements Renderable {
/*
@ -46,11 +46,10 @@ class Including implements Renderable {
* @param string $url Include Url
*/
public function setUrl($url) {
$this->url = (string) $url;
$this->url = (string)$url;
}
/**
*
* @see \FML\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {

View File

@ -7,9 +7,9 @@ use FML\Types\Renderable;
/**
* Music Element
*
* @author steeffeen
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Music implements Renderable {
/*
@ -47,12 +47,11 @@ class Music implements Renderable {
* @return \FML\Elements\Music
*/
public function setData($data) {
$this->data = (string) $data;
$this->data = (string)$data;
return $this;
}
/**
*
* @see \FML\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {

View File

@ -7,9 +7,9 @@ use FML\Types\Renderable;
/**
* Class representing a ManiaLink Script Tag with a simple Script Text
*
* @author steeffeen
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class SimpleScript implements Renderable {
/*
@ -47,12 +47,11 @@ class SimpleScript implements Renderable {
* @return \FML\Script\Script
*/
public function setText($text) {
$this->text = (string) $text;
$this->text = (string)$text;
return $this;
}
/**
*
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {